From d4df315e8787f6230aa55b6d8542e7adda89cd48 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 16 Feb 2014 15:22:57 -0500 Subject: MADS: Initial implementation of Adlib sound driver --- engines/mads/configure.engine | 3 + engines/mads/detection.cpp | 171 ++++++ engines/mads/detection_tables.h | 45 ++ engines/mads/mads.cpp | 74 +++ engines/mads/mads.h | 86 +++ engines/mads/module.mk | 15 + engines/mads/sound.cpp | 53 ++ engines/mads/sound.h | 51 ++ engines/mads/sound_nebular.cpp | 1097 +++++++++++++++++++++++++++++++++++++++ engines/mads/sound_nebular.h | 354 +++++++++++++ 10 files changed, 1949 insertions(+) create mode 100644 engines/mads/configure.engine create mode 100644 engines/mads/detection.cpp create mode 100644 engines/mads/detection_tables.h create mode 100644 engines/mads/mads.cpp create mode 100644 engines/mads/mads.h create mode 100644 engines/mads/module.mk create mode 100644 engines/mads/sound.cpp create mode 100644 engines/mads/sound.h create mode 100644 engines/mads/sound_nebular.cpp create mode 100644 engines/mads/sound_nebular.h diff --git a/engines/mads/configure.engine b/engines/mads/configure.engine new file mode 100644 index 0000000000..60d833e9e8 --- /dev/null +++ b/engines/mads/configure.engine @@ -0,0 +1,3 @@ +# This file is included from the main "configure" script +# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps] +add_engine mads "Rex Nebular and the Cosmic Gender Bender" no diff --git a/engines/mads/detection.cpp b/engines/mads/detection.cpp new file mode 100644 index 0000000000..4e56655f40 --- /dev/null +++ b/engines/mads/detection.cpp @@ -0,0 +1,171 @@ +/* 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 "mads/mads.h" + +#include "base/plugins.h" +#include "common/savefile.h" +#include "common/str-array.h" +#include "common/memstream.h" +#include "engines/advancedDetector.h" +#include "common/system.h" +#include "graphics/colormasks.h" +#include "graphics/surface.h" + +#define MAX_SAVES 99 + +namespace MADS { + +struct MADSGameDescription { + ADGameDescription desc; +}; + +uint32 MADSEngine::getFeatures() const { + return _gameDescription->desc.flags; +} + +Common::Language MADSEngine::getLanguage() const { + return _gameDescription->desc.language; +} + +Common::Platform MADSEngine::getPlatform() const { + return _gameDescription->desc.platform; +} + +bool MADSEngine::getIsDemo() const { + return _gameDescription->desc.flags & ADGF_DEMO; +} + +} // End of namespace MADS + +static const PlainGameDescriptor MADSGames[] = { + {"MADS", "MADS"}, + {"nebular", "Rex Nebular and the Cosmic Gender Bender"}, + {0, 0} +}; + +#include "mads/detection_tables.h" + +class MADSMetaEngine : public AdvancedMetaEngine { +public: + MADSMetaEngine() : AdvancedMetaEngine(MADS::gameDescriptions, sizeof(MADS::MADSGameDescription), MADSGames) { + _maxScanDepth = 3; + } + + virtual const char *getName() const { + return "MADS Engine"; + } + + virtual const char *getOriginalCopyright() const { + return "MADS (c)"; + } + + virtual bool hasFeature(MetaEngineFeature f) const; + virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; + virtual SaveStateList listSaves(const char *target) const; + virtual int getMaximumSaveSlot() const; + virtual void removeSaveState(const char *target, int slot) const; + SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; +}; + +bool MADSMetaEngine::hasFeature(MetaEngineFeature f) const { + return + (f == kSupportsListSaves) || + (f == kSupportsLoadingDuringStartup) || + (f == kSupportsDeleteSave) || + (f == kSavesSupportMetaInfo) || + (f == kSavesSupportThumbnail); +} + +bool MADS::MADSEngine::hasFeature(EngineFeature f) const { + return + (f == kSupportsRTL) || + (f == kSupportsLoadingDuringRuntime) || + (f == kSupportsSavingDuringRuntime); +} + +bool MADSMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const { + const MADS::MADSGameDescription *gd = (const MADS::MADSGameDescription *)desc; + if (gd) { + *engine = new MADS::MADSEngine(syst, gd); + } + return gd != 0; +} + +SaveStateList MADSMetaEngine::listSaves(const char *target) const { + Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); + Common::StringArray filenames; + Common::String saveDesc; + Common::String pattern = Common::String::format("%s.0??", target); + + filenames = saveFileMan->listSavefiles(pattern); + sort(filenames.begin(), filenames.end()); // Sort to get the files in numerical order + + SaveStateList saveList; + for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { + const char *ext = strrchr(file->c_str(), '.'); + int slot = ext ? atoi(ext + 1) : -1; + + if (slot >= 0 && slot < MAX_SAVES) { + Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(*file); + + if (in) { + delete in; + } + } + } + + return saveList; +} + +int MADSMetaEngine::getMaximumSaveSlot() const { + return MAX_SAVES; +} + +void MADSMetaEngine::removeSaveState(const char *target, int slot) const { + Common::String filename = Common::String::format("%s.%03d", target, slot); + g_system->getSavefileManager()->removeSavefile(filename); +} + +SaveStateDescriptor MADSMetaEngine::querySaveMetaInfos(const char *target, int slot) const { + Common::String filename = Common::String::format("%s.%03d", target, slot); + Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(filename); + + if (f) { + delete f; + + // Create the return descriptor + SaveStateDescriptor desc(slot, ""); + + return desc; + } + + return SaveStateDescriptor(); +} + + +#if PLUGIN_ENABLED_DYNAMIC(MADS) +REGISTER_PLUGIN_DYNAMIC(MADS, PLUGIN_TYPE_ENGINE, MADSMetaEngine); +#else +REGISTER_PLUGIN_STATIC(MADS, PLUGIN_TYPE_ENGINE, MADSMetaEngine); +#endif diff --git a/engines/mads/detection_tables.h b/engines/mads/detection_tables.h new file mode 100644 index 0000000000..7a66029b9b --- /dev/null +++ b/engines/mads/detection_tables.h @@ -0,0 +1,45 @@ +/* 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. + * + */ + +namespace MADS { + +static const MADSGameDescription gameDescriptions[] = { + { + // Rex Nebular and the Cosmic Gender Bender DOS English + { + "nebular", + 0, + { + {"mpslabs.001", 0, "4df5c557b52abb5b661cf4befe5ae301", 1315354}, + AD_LISTEND + }, + Common::EN_ANY, + Common::kPlatformDOS, + ADGF_NO_FLAGS, + GUIO1(GUIO_NONE) + }, + }, + + { AD_TABLE_END_MARKER } +}; + +} // End of namespace MADS diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp new file mode 100644 index 0000000000..39ef195cd6 --- /dev/null +++ b/engines/mads/mads.cpp @@ -0,0 +1,74 @@ +/* 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 "mads/mads.h" +#include "mads/sound.h" +#include "common/scummsys.h" +#include "common/config-manager.h" +#include "common/debug-channels.h" +#include "engines/util.h" +#include "common/events.h" + +namespace MADS { + +MADSEngine *g_vm; + +MADSEngine::MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc) : + Engine(syst), _randomSource("MADS") { + DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level"); + DebugMan.addDebugChannel(kDebugScripts, "scripts", "Game scripts"); +} + +MADSEngine::~MADSEngine() { +} + +void MADSEngine::initialise() { + _soundManager.setVm(this, _mixer); +} + +static uint32 lastSoundFrame = 0; + +Common::Error MADSEngine::run() { + initGraphics(320, 200, false); + initialise(); + _soundManager.test(); + + Common::Event e; + while (!shouldQuit()) { + g_system->getEventManager()->pollEvent(e); + g_system->delayMillis(10); + + uint32 milli = g_system->getMillis(); + if (milli > (lastSoundFrame + 50)) { + lastSoundFrame = milli; + _soundManager.poll(); + } + } + + return Common::kNoError; +} + +int MADSEngine::getRandomNumber(int maxNumber) { + return _randomSource.getRandomNumber(maxNumber); +} + +} // End of namespace MADS diff --git a/engines/mads/mads.h b/engines/mads/mads.h new file mode 100644 index 0000000000..b54c46ea96 --- /dev/null +++ b/engines/mads/mads.h @@ -0,0 +1,86 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_MADS_H +#define MADS_MADS_H + +#include "common/scummsys.h" +#include "common/system.h" +#include "common/error.h" +#include "common/random.h" +#include "common/util.h" +#include "engines/engine.h" +#include "graphics/surface.h" +#include "mads/sound.h" + +/** + * This is the namespace of the MADS engine. + * + * Status of this engine: In Development + * + * Games using this engine: + * - Rex Nebular and the Cosmic Gender Bender + */ +namespace MADS { + +#define DEBUG_BASIC 1 +#define DEBUG_INTERMEDIATE 2 +#define DEBUG_DETAILED 3 + +#define MAX_RESOLVE 1000 + +enum MADSDebugChannels { + kDebugPath = 1 << 0, + kDebugScripts = 1 << 1 +}; + + +struct MADSGameDescription; + + +class MADSEngine : public Engine { +private: + const MADSGameDescription *_gameDescription; + Common::RandomSource _randomSource; + SoundManager _soundManager; + + void initialise(); +protected: + // Engine APIs + virtual Common::Error run(); + virtual bool hasFeature(EngineFeature f) const; +public: + MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc); + virtual ~MADSEngine(); + + uint32 getFeatures() const; + Common::Language getLanguage() const; + Common::Platform getPlatform() const; + uint16 getVersion() const; + bool getIsDemo() const; + + int getRandomNumber(int maxNumber); +}; + +} // End of namespace MADS + +#endif /* MADS_MADS_H */ diff --git a/engines/mads/module.mk b/engines/mads/module.mk new file mode 100644 index 0000000000..d8a26a2704 --- /dev/null +++ b/engines/mads/module.mk @@ -0,0 +1,15 @@ +MODULE := engines/mads + +MODULE_OBJS := \ + detection.o \ + sound.o \ + sound_nebular.o \ + mads.o + +# This module can be built as a plugin +ifeq ($(ENABLE_MADS), DYNAMIC_PLUGIN) +PLUGIN := 1 +endif + +# Include common rules +include $(srcdir)/rules.mk diff --git a/engines/mads/sound.cpp b/engines/mads/sound.cpp new file mode 100644 index 0000000000..335afb4cdb --- /dev/null +++ b/engines/mads/sound.cpp @@ -0,0 +1,53 @@ +/* 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 "audio/audiostream.h" +#include "audio/decoders/raw.h" +#include "common/memstream.h" +#include "mads/sound.h" + +namespace MADS { + +SoundManager::SoundManager() { + _asound = nullptr; +} + +SoundManager::~SoundManager() { + delete _asound; +} + +void SoundManager::setVm(MADSEngine *vm, Audio::Mixer *mixer) { + _vm = vm; + _mixer = mixer; +} + +void SoundManager::test() { + _asound = new Nebular::ASound1(_mixer); + _asound->command(28); +} + +void SoundManager::poll() { + if (_asound) + _asound->poll(); +} + +} // End of namespace MADS diff --git a/engines/mads/sound.h b/engines/mads/sound.h new file mode 100644 index 0000000000..20b56ec4a1 --- /dev/null +++ b/engines/mads/sound.h @@ -0,0 +1,51 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_SOUND_H +#define MADS_SOUND_H + +#include "common/scummsys.h" +#include "audio/audiostream.h" +#include "audio/mixer.h" +#include "mads/sound_nebular.h" + +namespace MADS { + +class MADSEngine; + +class SoundManager { +private: + MADSEngine *_vm; + Audio::Mixer *_mixer; + Nebular::ASound *_asound; +public: + SoundManager(); + ~SoundManager(); + + void setVm(MADSEngine *vm, Audio::Mixer *mixer); + void test(); + void poll(); +}; + +} // End of namespace MADS + +#endif /* MADS_SOUND_H */ diff --git a/engines/mads/sound_nebular.cpp b/engines/mads/sound_nebular.cpp new file mode 100644 index 0000000000..03fdc5ffae --- /dev/null +++ b/engines/mads/sound_nebular.cpp @@ -0,0 +1,1097 @@ +/* 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 "audio/audiostream.h" +#include "audio/decoders/raw.h" +#include "common/algorithm.h" +#include "common/debug.h" +#include "common/memstream.h" +#include "mads/sound.h" +#include "mads/sound_nebular.h" + +namespace MADS { + +namespace Nebular { + +AdlibChannel::AdlibChannel() { + _activeCount = 0; + _field1 = 0; + _field2 = 0; + _field3 = 0; + _field4 = 0; + _field5 = 0; + _volume = 0; + _field7 = 0; + _field8 = 0; + _field9 = 0; + _fieldA = 0; + _fieldB = 0; + _fieldC = 0; + _fieldD = 0; + _fieldE = 0; + _ptr1 = nullptr; + _pSrc = nullptr; + _ptr3 = nullptr; + _ptr4 = nullptr; + _field17 = 0; + _field19 = 0; + _soundData = nullptr; + _field1D = 0; + _field1E = 0; + _field1F = 0; +} + +void AdlibChannel::reset() { + _activeCount = 0; + _field1 = 0; + _field2 = 0; + _field3 = 0; +} + +void AdlibChannel::enable(int flag) { + if (_activeCount) { + _fieldE = flag; + _soundData = nullptr; // TODO: Check original set it to flag??! + } +} + +void AdlibChannel::setPtr2(byte *pData) { + _pSrc = pData; + _field2 = 0xFF; + _fieldA = 1; + _field9 = 1; +} + +void AdlibChannel::load(byte *pData) { + _ptr1 = _pSrc = _ptr3 = pData; + _ptr4 = _soundData = pData; + _fieldA = 0xFF; + _activeCount = 1; + _fieldD = 64; + _field1 = 0; + _field1F = 0; + _field2 = _field3 = 0; + _volume = _field7 = 0; + _field1D = _field1E = 0; + _fieldE = 0; + _field9 = 0; + _fieldB = 0; + _field17 = 0; + _field19 = 0; +} + +void AdlibChannel::check(byte *nullPtr) { + if (_activeCount && _fieldE) { + if (!_field1E) { + _pSrc = nullPtr; + _fieldE = 0; + } else { + _field2 = 0xFF; + _fieldA = 4; + if (!_field9) + _field9 = 1; + } + } +} + +/*-----------------------------------------------------------------------*/ + +SoundData::SoundData(Common::SeekableReadStream &s) { + _field0 = s.readByte(); + _field1 = s.readByte(); + _field2 = s.readByte(); + _field3 = s.readByte(); + _field4 = s.readByte(); + _field5 = s.readByte(); + _field6 = s.readByte(); + _field7 = s.readByte(); + _field8 = s.readByte(); + _field9 = s.readByte(); + _fieldA = s.readByte(); + _fieldB = s.readByte(); + _fieldC = s.readByte(); + _fieldD = s.readByte(); + _fieldE = s.readByte(); + _field10 = s.readUint16LE(); + _field12 = s.readUint16LE(); + _field14 = s.readUint16LE(); +} + +/*-----------------------------------------------------------------------*/ + +ASound::ASound(Audio::Mixer *mixer, const Common::String &filename, int dataOffset) { + // Open up the appropriate sound file + if (!_soundFile.open(filename)) + error("Could not open file - %s", filename.c_str()); + + _dataOffset = dataOffset; + _mixer = mixer; + _opl = OPL::Config::create(); + assert(_opl); + _opl->init(11025); + + // Initialise fields + _activeChannelPtr = nullptr; + _soundDataPtr = nullptr; + _frameCounter = 0; + _isDisabled = false; + _v1 = 0; + _v2 = 0; + _activeChannelNumber = 0; + _freqMask1 = _freqMask2 = 0; + _freqBase1 = _freqBase2 = 0; + _channelNum1 = _channelNum2 = 0; + _v7 = 0; + _v8 = 0; + _v9 = 0; + _v10 = 0; + _pollResult = 0; + _resultFlag = 0; + _nullData[0] = _nullData[1] = 0; + Common::fill(&_ports[0], &_ports[256], 0); + _stateFlag = false; + _activeChannelReg = 0; + _v11 = 0; + _randomSeed = 1234; + _amDep = _vibDep = _splitPoint = true; + + // Initialise the Adlib + adlibInit(); + + // Reset the adlib + command0(); +} + +ASound::~ASound() { + Common::List::iterator i; + for (i = _dataCache.begin(); i != _dataCache.end(); ++i) + delete[] (*i)._data; + + delete _opl; +} + +void ASound::adlibInit() { + // No implementation +} + +int ASound::stop() { + command0(); + int result = _pollResult; + _pollResult = 0; + return result; +} + +int ASound::poll() { + // Update any playing sounds + update(); + + // Return result + int result = _pollResult; + _pollResult = 0; + return result; +} + +void ASound::noise() { + int randomVal = getRandomNumber(); + + if (_v1) { + setFrequency(_channelNum1, (randomVal ^ 0xFFFF) & _freqMask1 + _freqBase1); + } + + if (_v2) { + setFrequency(_channelNum2, randomVal & _freqMask2 + _freqBase2); + } +} + +void ASound::write(int reg, int val) { + debug("reg %.2x = %.2x", reg, val); + _opl->write(reg, val); +} + +int ASound::write2(int state, int reg, int val) { + // TODO: Original has a state parameter, not used when in Adlib mode? + _ports[reg] = val; + write(reg, val); + return state; +} + +void ASound::channelOn(int reg, int volume) { + write2(8, reg, (_ports[reg] & 0xC0) | (volume & 0x3F)); +} + +void ASound::channelOff(int reg) { + write2(8, reg, _ports[reg] | 0x3F); +} + +void ASound::resultCheck() { + if (_resultFlag != 1) { + _resultFlag = 1; + _pollResult = 1; + } +} + +byte *ASound::loadData(int offset, int size) { + // First scan for an existing copy + Common::List::iterator i; + for (i = _dataCache.begin(); i != _dataCache.end(); ++i) { + CachedDataEntry &e = *i; + if (e._offset == offset) + return e._data; + } + + // No existing entry found, so load up data and store as a new entry + CachedDataEntry rec; + rec._offset = offset; + rec._data = new byte[size]; + _soundFile.seek(_dataOffset + offset); + _soundFile.read(rec._data, size); + _dataCache.push_back(rec); + + // Return the data + return rec._data; +} + +void ASound::playSound(int offset, int size) { + // Load the specified data block + playSound(loadData(offset, size)); +} + +void ASound::playSound(byte *pData) { + // Scan for a high level free channel + for (int i = 5; i < ADLIB_CHANNEL_COUNT; ++i) { + if (!_channels[i]._activeCount) { + _channels[i].load(pData); + return; + } + } + + // None found, do a secondary scan for an interruptable channel + for (int i = ADLIB_CHANNEL_COUNT - 1; i >= ADLIB_CHANNEL_MIDWAY; --i) { + if (_channels[i]._fieldE == 0xFF) { + _channels[i].load(pData); + return; + } + } +} + +bool ASound::isSoundActive(byte *pData) { + for (int i = 0; i < ADLIB_CHANNEL_MIDWAY; ++i) { + if (_channels[i]._activeCount && _channels[i]._soundData == pData) + return true; + } + + return false; +} + +void ASound::setFrequency(int channel, int freq) { + write2(8, 0xA0 + channel, freq & 0xFF); + write2(8, 0xB0 + channel, (freq >> 8) | 0x20); +} + +int ASound::getRandomNumber() { + int v = 0x9248 + (int)_randomSeed; + _randomSeed = ((v >> 3) | (v << 13)) & 0xFFFF; + return _randomSeed; +} + +void ASound::update() { + getRandomNumber(); + if (_isDisabled) + return; + + ++_frameCounter; + pollChannels(); + checkChannels(); + + if (_v1 == _v2) { + if (_resultFlag != -1) { + _resultFlag = -1; + _pollResult = -1; + } + } else { + if (_v1) { + _freqBase1 += _v7; + if (!--_v1) { + if (!_v2 || _channelNum1 != _channelNum2) { + write2(8, 0xA0 + _channelNum1, 0); + write2(8, 0xB0 + _channelNum1, 0); + } + } + } + + if (_v2) { + _freqBase2 += _v8; + if (!--_v2) { + if (!_v1 || _channelNum2 != _channelNum1) { + write2(8, 0xA0 + _channelNum2, 0); + write2(8, 0xB0 + _channelNum2, 0); + } + } + } + } +} + +void ASound::pollChannels() { + _activeChannelNumber = 0; + for (int i = 0; i < ADLIB_CHANNEL_COUNT; ++i) { + _activeChannelPtr = &_channels[i]; + pollActiveChannel(); + } +} + +void ASound::checkChannels() { + for (int i = 0; i < ADLIB_CHANNEL_COUNT; ++i) + _channels[i].check(_nullData); +} + +void ASound::pollActiveChannel() { + bool flag = false; + + AdlibChannel *chan = _activeChannelPtr; + if (chan->_activeCount) { + if (chan->_field8 > 0 && --chan->_field8 == 0) + updateOctave(); + + if (--_activeChannelPtr->_activeCount <= 0) { + for (;;) { + byte *pSrc = chan->_pSrc; + if (!(*pSrc & 0x80) || (*pSrc <= 0xF0)) { + if (flag) + updateActiveChannel(); + + chan->_field4 = *pSrc++; + chan->_activeCount = *pSrc++; + chan->_pSrc += 2; + + if (!chan->_field4 || !chan->_activeCount) { + updateOctave(); + } else { + chan->_field8 = chan->_activeCount - chan->_field7; + updateChannelState(); + } + + break; + } else { + flag = false; + + switch ((~*pSrc) & 0xF) { + case 0: + if (!chan->_field17) { + if (*++pSrc == 0) { + chan->_pSrc += 2; + chan->_ptr3 = chan->_pSrc; + chan->_field17 = 0; + } else { + chan->_field17 = *pSrc; + chan->_pSrc = chan->_ptr3; + } + } else if (--chan->_field17) { + chan->_pSrc = chan->_ptr3; + } else { + chan->_pSrc += 2; + chan->_ptr3 = chan->_pSrc; + } + break; + + case 1: + if (!chan->_field19) { + if (*++pSrc == 0) { + chan->_pSrc += 2; + chan->_ptr4 = chan->_pSrc; + chan->_ptr3 = chan->_pSrc; + chan->_field17 = 0; + chan->_field19 = 0; + } else { + chan->_field19 = *pSrc; + chan->_pSrc = chan->_ptr4; + chan->_ptr3 = chan->_ptr4; + } + } else if (--chan->_field19) { + chan->_ptr4 = chan->_pSrc; + chan->_ptr3 = chan->_pSrc; + } else { + chan->_pSrc += 2; + chan->_ptr4 = chan->_pSrc; + chan->_ptr3 = chan->_pSrc; + } + break; + + case 2: + // Loop sound data + chan->_field1 = 0; + chan->_field2 = chan->_field3 = 0; + chan->_volume = chan->_field7 = 0; + chan->_field1D = chan->_field1E = 0; + chan->_field8 = 0; + chan->_field9 = 0; + chan->_fieldB = 0; + chan->_field17 = 0; + chan->_field19 = 0; + chan->_fieldD = 0x40; + chan->_ptr1 = chan->_soundData; + chan->_pSrc = chan->_soundData; + chan->_ptr3 = chan->_soundData; + chan->_ptr4 = chan->_soundData; + + chan->_pSrc += 2; + break; + + case 3: + chan->_field5 = *++pSrc; + chan->_pSrc += 2; + channelProc1(chan->_field5); + break; + + case 4: + chan->_field7 = *++pSrc; + chan->_pSrc += 2; + break; + + case 5: + chan->_field1 = *++pSrc; + chan->_pSrc += 2; + break; + + case 6: + ++pSrc; + if (chan->_fieldE) { + chan->_volume = *pSrc >> 1; + flag = 1; + chan->_pSrc += 2; + } else { + chan->_pSrc += 2; + } + break; + + case 7: + ++pSrc; + if (!chan->_fieldE) { + chan->_fieldA = *pSrc; + chan->_field2 = *++pSrc; + chan->_field9 = 1; + } + + chan->_pSrc += 3; + break; + + case 8: + chan->_field1D = *++pSrc; + chan->_pSrc += 2; + break; + + case 9: { + int v1 = *++pSrc; + ++pSrc; + int v2 = (v1 - 1) & getRandomNumber(); + int v3 = pSrc[v2]; + int v4 = pSrc[v1]; + + pSrc[v4 + v1 + 1] = v3; + chan->_pSrc += v1 + 3; + break; + } + + case 10: + ++pSrc; + if (chan->_fieldE) { + chan->_pSrc += 2; + } else { + chan->_field1E = *pSrc >> 1; + flag = 1; + chan->_pSrc += 2; + } + break; + + case 11: + chan->_fieldD = *++pSrc; + flag = 1; + chan->_pSrc += 2; + break; + + case 12: + chan->_fieldC = *++pSrc; + chan->_field3 = *++pSrc; + chan->_fieldB = 1; + chan->_pSrc += 2; + break; + + case 13: + ++pSrc; + chan->_pSrc += 2; + break; + + case 14: + chan->_field1F = *++pSrc; + chan->_pSrc += 2; + break; + + default: + break; + } + } + } + } + + if (chan->_field1) + updateFNumber(); + + flag = false; + if (chan->_field9 || chan->_field8) { + if (!--chan->_field9) { + chan->_field9 = chan->_fieldA; + if (chan->_field2) { + chan->_field9 = CLIP(chan->_field2 + chan->_field1E, 0, 63); + } + } + + if (!--chan->_fieldB) { + chan->_fieldB = chan->_fieldC; + if (chan->_field3) { + chan->_fieldD = chan->_field3; + flag = true; + } + } + + if (flag) + updateActiveChannel(); + } + } + + ++_activeChannelNumber; +} + +void ASound::updateOctave() { + int reg = 0xB0 + _activeChannelNumber; + write2(8, reg, _ports[reg] & 0xDF); +} + +static int _vList1[] = { + 0x200, 0x21E, 0x23F, 0x261, 0x285, 0x2AB, + 0x2D4, 0x2FF, 0x32D, 0x35D, 0x390, 0x3C7 +}; + +void ASound::updateChannelState() { + updateActiveChannel(); + + if (_channelData[_activeChannelNumber]._field0) { + if (_channelNum1 == _activeChannelNumber) + _stateFlag = 0; + if (_channelNum2 == _activeChannelNumber) + _stateFlag = 1; + + if (!_stateFlag) { + _stateFlag = 1; + if (_v1) + write2(8, 0xB0 + _channelNum1, _ports[0xB0 + _channelNum1] & 0xDF); + + _channelNum1 = _activeChannelNumber; + _v1 = _channelData[_channelNum1]._field0; + _freqMask1 = _channelData[_channelNum1]._freqMask; + _freqBase1 = _channelData[_channelNum1]._freqBase; + _v7 = _channelData[_channelNum1]._field6; + } else { + _stateFlag = 0; + if (_v2) + write2(8, 0xB0 + _channelNum2, _ports[0xB0 + _channelNum2] & 0xDF); + + _channelNum2 = _activeChannelNumber; + _v2 = _channelData[_channelNum2]._field0; + _freqMask2 = _channelData[_channelNum2]._freqMask; + _freqBase2 = _channelData[_channelNum2]._freqBase; + _v8 = _channelData[_channelNum2]._field6; + } + + resultCheck(); + } else { + int reg = 0xA0 + _activeChannelNumber; + int v = (_activeChannelPtr->_field4 + _activeChannelPtr->_field1F) / 12; + int vHi = v >> 8; + int vLo = v & 0xFF; + int val = _vList1[vHi] + vHi; + write2(8, reg, val & 0xFF); + + reg += 0x10; + write2(8, reg, (_ports[reg] & 0x20) | (vLo << 2) | (val >> 8)); + + write2(8, reg, _ports[reg] | 0x20); + } +} + +static const int outputIndexes[] = { + 3, 1, 4, 2, 5, 6, 9, 7, 10, 8, 11, 12, 15, 13, 16, 14, 17 +}; +static const int outputChannels[] = { + 0, 1, 2, 3, 4, 5, 8, 9, 10, 11, 12, 13, 16, 17, 18, 19, 20, 21, 0 +}; +static const int volumeList[] = { + 0x3F, 0x3F, 0x36, 0x31, 0x2D, 0x2A, 0x28, 0x26, 0x24, 0x22, 0x21, 0x20, 0x1F, 0x1E, 0x1D, 0x1C, + 0x1B, 0x1A, 0x19, 0x19, 0x18, 0x17, 0x17, 0x16, 0x16, 0x15, 0x15, 0x14, 0x14, 0x13, 0x12, 0x12, + 0x11, 0x11, 0x10, 0x10, 0x0F, 0x0F, 0x0E, 0x0E, 0x0D, 0x0D, 0x0C, 0x0C, 0x0B, 0x0B, 0x0A, 0x0A, + 0x0A, 0x09, 0x09, 0x09, 0x09, 0x09, 0x08, 0x08, 0x08, 0x08, 0x08, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +void ASound::updateActiveChannel() { + int reg = 0x40 + outputChannels[outputIndexes[_activeChannelNumber * 2]]; + int portVal = _ports[reg] & 0xFFC0; + int newVolume = CLIP(_activeChannelPtr->_volume + _activeChannelPtr->_field1E, 0, 63); + + // TODO: Double-check _v5660 = 5600h + int val = CLIP(newVolume - volumeList[_activeChannelPtr->_fieldD], 0, 63); + val = (63 - val) | portVal; + + int val2 = CLIP(newVolume - volumeList[-(_activeChannelPtr->_fieldD - 127)], 0, 63); + val2 = (63 - val2) | portVal; + write2(0, reg, val); + write2(2, reg, val2); +} + +void ASound::channelProc1(int recIndex) { + _activeChannelReg = 0xB0 + _activeChannelNumber; + write2(8, _activeChannelReg, _ports[_activeChannelReg] & 0xDF); + + _activeChannelReg = _activeChannelNumber; + _soundDataPtr = &_soundData[recIndex * 2]; + _v11 = outputChannels[outputIndexes[_activeChannelReg * 2 - 1]]; + channelProc2(); + + AdlibChannelData &cd = _channelData[_activeChannelNumber]; + cd._field6 = _soundDataPtr->_field14; + cd._freqBase = _soundDataPtr->_field12; + cd._freqMask = _soundDataPtr->_field10; + cd._field0 = _soundDataPtr->_fieldE; + + _soundDataPtr = &_soundData[recIndex * 2 + 1]; + _v11 = outputChannels[outputIndexes[_activeChannelReg * 2]]; + channelProc2(); +} + +void ASound::channelProc2() { + // Write out vib flags and split point + write2(8, 0x40 + _v11, 0x3F); + int depthRhythm = _ports[0xBD] & 0x3F | (_amDep ? 0x80 : 0) | + (_vibDep ? 0x40 : 0); + write2(8, 0xBD, depthRhythm); + write2(8, 8, _splitPoint ? 0x40 : 0); + + int val = _soundDataPtr->_fieldA; + val = (val << 1) | (1 - _soundDataPtr->_fieldD); + write2(8, 0xC0 + _activeChannelReg, val); + + val = (_soundDataPtr->_field0 << 4) | (_soundDataPtr->_field1 & 0xF); + write2(8, 0x60 + _v11, val); + + val = (_soundDataPtr->_field2 << 4) | (_soundDataPtr->_field3 & 0xF); + write2(8, 0x80 + _v11, val); + + val = (_soundDataPtr->_fieldB ? 0x80 : 0) | (_soundDataPtr->_fieldC ? 0x40 : 0) + | (_soundDataPtr->_field4 ? 0x20 : 0) | (_soundDataPtr->_field5 ? 0x10 : 0) + | (_soundDataPtr->_field9 & 0xF); + write2(8, 0x20 + _v11, val); + + write2(8, 0xE0 + _v11, _soundDataPtr->_field8 & 3); + + val = -(_soundDataPtr->_field6 & 0x3F - 0x3F) | (_soundDataPtr->_field7 << 6); + write2(8, 0x40 + _v11, val); +} + +void ASound::updateFNumber() { + int loReg = 0xA0 + _activeChannelNumber; + int hiReg = 0xB0 + _activeChannelNumber; + int val1 = (_ports[hiReg] & 0x1F) << 8; + val1 += _ports[loReg] + _activeChannelPtr->_field1; + write2(8, loReg, val1); + + int val2 = (_ports[hiReg] & 0x20) | (val1 >> 8); + write2(8, hiReg, val2); +} + +int ASound::command0() { + bool isDisabled = _isDisabled; + _isDisabled = true; + + for (int i = 0; i < ADLIB_CHANNEL_COUNT; ++i) + _channels[i].reset(); + + _v1 = 0; + _v2 = 0; + _freqMask1 = _freqMask2 = 0; + _freqBase1 = _freqBase2 = 0; + _v7 = 0; + _v8 = 0; + + _isDisabled = isDisabled; + return 0; +} + +int ASound::command1() { + for (int i = 0; i < ADLIB_CHANNEL_COUNT; ++i) + _channels[i].enable(0xFF); + return 0; +} + +int ASound::command2() { + for (int i = 0; i < ADLIB_CHANNEL_MIDWAY; ++i) + _channels[i].setPtr2(_nullData); + return 0; +} + +int ASound::command3() { + for (int i = 0; i < ADLIB_CHANNEL_MIDWAY; ++i) + _channels[i].enable(0xFF); + return 0; +} + +int ASound::command4() { + for (int i = ADLIB_CHANNEL_MIDWAY; i < ADLIB_CHANNEL_COUNT; ++i) + _channels[i].setPtr2(_nullData); + return 0; +} + +int ASound::command5() { + for (int i = 5; i < ADLIB_CHANNEL_COUNT; ++i) + _channels[i].enable(0xFF); + return 0; +} + +int ASound::command6() { + _v9 = _v1; + _v1 = 0; + _v10 = _v2; + _v2 = 0; + + channelOff(0x43); + channelOff(0x44); + channelOff(0x45); + channelOff(0x4B); + channelOff(0x4C); + channelOff(0x4D); + channelOff(0x53); + channelOff(0x54); + channelOff(0x55); + + return 0; +} + +int ASound::command7() { + channelOn(0x43, _channels[0]._volume); + channelOn(0x44, _channels[1]._volume); + channelOn(0x45, _channels[2]._volume); + channelOn(0x4B, _channels[3]._volume); + channelOn(0x4C, _channels[4]._volume); + channelOn(0x4D, _channels[5]._volume); + + _v1 = _v9; + _v2 = _v10; + + if (_v9 != _v10) + resultCheck(); + + _isDisabled = 0; + return _v10; +} + +int ASound::command8() { + int result = 0; + for (int i = 0; i < ADLIB_CHANNEL_COUNT; ++i) + result |= _channels[i]._activeCount; + + return result; +} + +/*-----------------------------------------------------------------------*/ + +const ASound1::CommandPtr ASound1::_commandList[42] = { + &ASound1::command0, &ASound1::command1, &ASound1::command2, &ASound1::command3, + &ASound1::command4, &ASound1::command5, &ASound1::command6, &ASound1::command7, + &ASound1::command8, &ASound1::command9, &ASound1::command10, &ASound1::command11, + &ASound1::command12, &ASound1::command13, &ASound1::command14, &ASound1::command15, + &ASound1::command16, &ASound1::command17, &ASound1::command18, &ASound1::command19, + &ASound1::command20, &ASound1::command21, &ASound1::command22, &ASound1::command23, + &ASound1::command24, &ASound1::command25, &ASound1::command26, &ASound1::command27, + &ASound1::command28, &ASound1::command29, &ASound1::command30, &ASound1::command31, + &ASound1::command32, &ASound1::command33, &ASound1::command34, &ASound1::command35, + &ASound1::command36, &ASound1::command37, &ASound1::command38, &ASound1::command39, + &ASound1::command40, &ASound1::command41 +}; + +ASound1::ASound1(Audio::Mixer *mixer): ASound(mixer, "asound.001", 0x1520) { + _cmd23Toggle = false; + + // Load sound data + _soundFile.seek(_dataOffset + 0x12C); + for (int i = 0; i < 98; ++i) + _soundData.push_back(SoundData(_soundFile)); +} + +int ASound1::command(int commandId) { + if (commandId > 41) + return 0; + + _frameCounter = 0; + return (this->*_commandList[commandId])(); +} + +int ASound1::command9() { + playSound(0xC68, 12); + return 0; +} + +int ASound1::command10() { + byte *pData1 = loadData(0x130E, 48); + if (!isSoundActive(pData1)) { + command1(); + _channels[0].load(pData1); + _channels[1].load(loadData(0x133E, 392)); + _channels[2].load(loadData(0x14C6, 46)); + _channels[3].load(loadData(0x14F4, 48)); + } + + return 0; +} + +int ASound1::command11() { + command111213(); + _channels[0]._field1E = 0; + _channels[1]._field1E = 0; + return 0; +} + +int ASound1::command12() { + command111213(); + _channels[0]._field1E = 40; + _channels[1]._field1E = 0; + return 0; +} + +int ASound1::command13() { + command111213(); + _channels[0]._field1E = 40; + _channels[1]._field1E = 50; + return 0; +} + +int ASound1::command14() { + playSound(0x1216, 248); + return 0; +} + +int ASound1::command15() { + byte *pData1 = loadData(0x1524, 152); + if (!isSoundActive(pData1)) { + command1(); + _channels[4].load(pData1); + _channels[5].load(loadData(0x15BC, 94)); + _channels[6].load(loadData(0x161A, 94)); + _channels[7].load(loadData(0x1678, 42)); + _channels[8].load(loadData(0x16A2, 42)); + } + + return 0; +} + +int ASound1::command16() { + playSound(0xC74, 14); + return 0; +} + +int ASound1::command17() { + playSound(0xE9A, 10); + return 0; +} + +int ASound1::command18() { + playSound(0xCA6, 20); + return 0; +} + +int ASound1::command19() { + playSound(0xCBA, 74); + return 0; +} + +int ASound1::command20() { + byte *pData = loadData(0xD18, 28); + if (!isSoundActive(pData)) + playSound(pData); + return 0; +} + +int ASound1::command21() { + playSound(0xD04, 20); + return 0; +} + +int ASound1::command22() { + byte *pData = loadData(0xD34, 10); + pData[6] = (getRandomNumber() & 7) + 85; + + if (!isSoundActive(pData)) + playSound(pData); + + return 0; +} + +int ASound1::command23() { + _cmd23Toggle = !_cmd23Toggle; + playSound(_cmd23Toggle ? 0xD3E : 0xD46, 8); + return 0; +} + +int ASound1::command24() { + playSound(0xD4E, 18); + playSound(0xD60, 20); + playSound(0xD74, 14); + return 0; +} + +int ASound1::command25() { + byte *pData = loadData(0xD82, 16); + if (!isSoundActive(pData)) + playSound(pData); + + return 0; +} + +int ASound1::command26() { + error("TODO: command26"); + return 0; +} + +int ASound1::command27() { + error("TODO: ASound::command27"); + return 0; +} + +int ASound1::command28() { + playSound(0xD92, 28); + return 0; +} + +int ASound1::command29() { + error("TODO: ASound::command29"); + return 0; +} + +int ASound1::command30() { + error("TODO: ASound::command30"); + return 0; +} + +int ASound1::command31() { + byte *pData = loadData(0xDAE, 14); + if (!isSoundActive(pData)) + playSound(pData); + + return 0; +} + +int ASound1::command32() { + error("TODO: ASound::command32"); + return 0; +} + +int ASound1::command33() { + playSound(0xDBC, 10); + playSound(0xDC6, 10); + return 0; +} + +int ASound1::command34() { + int v = getRandomNumber() & 0x20; + if (!v) + v = 0x60; + + byte *pData = loadData(0xDD0, 22); + pData[8] = pData[15] = v; + playSound(pData); + return 0; +} + +int ASound1::command35() { + playSound(0xDE6, 16); + return 0; +} + +int ASound1::command36() { + playSound(0xE10, 10); + command34(); + + return 0; +} + +int ASound1::command37() { + playSound(0xE1A, 14); + return 0; +} + +int ASound1::command38() { + playSound(0xE28, 114); + return 0; +} + +int ASound1::command39() { + byte *pData1 = loadData(0x16CC, 82); + if (!isSoundActive(pData1)) { + _channels[5].load(pData1); + _channels[6].load(loadData(0x171E, 30)); + _channels[7].load(loadData(0x173C, 40)); + _channels[8].load(loadData(0x1764, 64)); + } + return 0; +} + +int ASound1::command40() { + playSound(0xDF6, 26); + return 0; +} + +int ASound1::command41() { + playSound(0xC32, 34); + playSound(0xC54, 20); + return 0; +} + +void ASound1::command111213() { + byte *pData1 = loadData(0xEF6, 408); + if (!isSoundActive(pData1)) { + command1(); + _channels[0].load(pData1); + _channels[1].load(loadData(0x108E, 266)); + _channels[2].load(loadData(0x1198, 66)); + _channels[2].load(loadData(0x11DA, 60)); + } +} + +void ASound1::command2627293032() { + // TODO: This method takes a parameter off the stack for several levels up. + // i.e. something the caller's caller pushed onto the stack. Need to figure + // out a better way to pass parameters down if this is actually in use. +} + +} // End of namespace Nebular + +} // End of namespace MADS diff --git a/engines/mads/sound_nebular.h b/engines/mads/sound_nebular.h new file mode 100644 index 0000000000..8f92389ee1 --- /dev/null +++ b/engines/mads/sound_nebular.h @@ -0,0 +1,354 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_SOUND_NEBULAR_H +#define MADS_SOUND_NEBULAR_H + +#include "common/scummsys.h" +#include "common/file.h" +#include "audio/audiostream.h" +#include "audio/fmopl.h" +#include "audio/mixer.h" + +namespace MADS { + +namespace Nebular { + +class SoundManager; + +/** + * Represents the data for a channel on the Adlib + */ +class AdlibChannel { +public: + int _activeCount; + int _field1; + int _field2; + int _field3; + int _field4; + int _field5; + int _volume; + int _field7; + int _field8; + int _field9; + int _fieldA; + int _fieldB; + int _fieldC; + int _fieldD; + int _fieldE; + byte *_ptr1; + byte *_pSrc; + byte *_ptr3; + byte *_ptr4; + int _field17; + int _field19; + byte *_soundData; + int _field1D; + int _field1E; + int _field1F; +public: + AdlibChannel(); + + void reset(); + void enable(int flag); + void setPtr2(byte *pData); + void load(byte *pData); + void check(byte *nullPtr); +}; + +class AdlibChannelData { +public: + int _field0; + int _freqMask; + int _freqBase; + int _field6; +}; + +class SoundData { +public: + int _field0; + int _field1; + int _field2; + int _field3; + int _field4; + int _field5; + int _field6; + int _field7; + int _field8; + int _field9; + int _fieldA; + int _fieldB; + int _fieldC; + int _fieldD; + int _fieldE; + int _field10; + int _field12; + int _field14; + + SoundData() {} + SoundData(Common::SeekableReadStream &s); +}; + +#define ADLIB_CHANNEL_COUNT 9 +#define ADLIB_CHANNEL_MIDWAY 5 + +/** + * Base class for the sound player resource files + */ +class ASound { +private: + struct CachedDataEntry { + int _offset; + byte *_data; + }; + Common::List _dataCache; + uint16 _randomSeed; + + /** + * Does the initial Adlib initialisation + */ + void adlibInit(); + + /** + * Does on-going processing for the Adlib sounds being played + */ + void update(); + + /** + * Polls each of the channels for updates + */ + void pollChannels(); + + /** + * Checks the status of the channels + */ + void checkChannels(); + + /** + * Polls the currently active channel + */ + void pollActiveChannel(); + + /** + * Updates the octave of the currently active channel + */ + void updateOctave(); + + void updateChannelState(); + void updateActiveChannel(); + void channelProc1(int recIndex); + void channelProc2(); + void updateFNumber(); +protected: + /** + * Write a byte to an Adlib register + */ + void write(int reg, int val); + + /** + * Write a byte to an Adlib register, and store it in the _ports array + */ + int write2(int state, int reg, int val); + + /** + * Turn a channel on + */ + void channelOn(int reg, int volume); + + /** + * Turn a channel off + */ + void channelOff(int reg); + + /** + * Checks for whether a poll result needs to be set + */ + void resultCheck(); + + /** + * Loads a data block from the sound file, caching the result for any future + * calls for the same data + */ + byte *loadData(int offset, int size); + + /** + * Play the specified sound + * @param offset Offset of sound data within sound player data segment + * @param size Size of sound data block + */ + void playSound(int offset, int size); + + /** + * Play the specified raw sound data + * @param pData Pointer to data block containing sound data + */ + void playSound(byte *pData); + + /** + * Checks to see whether the given block of data is already loaded into a channel. + */ + bool isSoundActive(byte *pData); + + /** + * Sets the frequency for a given channel. + */ + void setFrequency(int channel, int freq); + + /** + * Returns a 16-bit random number + */ + int getRandomNumber(); + + int command0(); + int command1(); + int command2(); + int command3(); + int command4(); + int command5(); + int command6(); + int command7(); + int command8(); +public: + Audio::Mixer *_mixer; + FM_OPL *_opl; + AdlibChannel _channels[ADLIB_CHANNEL_COUNT]; + AdlibChannel *_activeChannelPtr; + AdlibChannelData _channelData[11]; + Common::Array _soundData; + SoundData *_soundDataPtr; + Common::File _soundFile; + int _dataOffset; + int _frameCounter; + bool _isDisabled; + int _v1; + int _v2; + int _activeChannelNumber; + int _freqMask1; + int _freqMask2; + int _freqBase1; + int _freqBase2; + int _channelNum1, _channelNum2; + int _v7; + int _v8; + int _v9; + int _v10; + int _pollResult; + int _resultFlag; + byte _nullData[2]; + int _ports[256]; + bool _stateFlag; + int _activeChannelReg; + int _v11; + bool _amDep, _vibDep, _splitPoint; +public: + /** + * Constructor + * @param filename Specifies the adlib sound player file to use + * @param dataOffset Offset in the file of the data segment + */ + ASound(Audio::Mixer *mixer, const Common::String &filename, int dataOffset); + + /** + * Destructor + */ + virtual ~ASound(); + + /** + * Execute a player command. Most commands represent sounds to play, but some + * low number commands also provide control operations + */ + virtual int command(int commandId) = 0; + + /** + * Stop all currently playing sounds + */ + int stop(); + + /** + * Main poll method to allow sounds to progress + */ + int poll(); + + /** + * General noise/note output + */ + void noise(); + + /** + * Return the current frame counter + */ + int getFrameCounter() { return _frameCounter; } +}; + +class ASound1: public ASound { +private: + typedef int (ASound1::*CommandPtr)(); + static const CommandPtr _commandList[42]; + bool _cmd23Toggle; + + int command9(); + int command10(); + int command11(); + int command12(); + int command13(); + int command14(); + int command15(); + int command16(); + int command17(); + int command18(); + int command19(); + int command20(); + int command21(); + int command22(); + int command23(); + int command24(); + int command25(); + int command26(); + int command27(); + int command28(); + int command29(); + int command30(); + int command31(); + int command32(); + int command33(); + int command34(); + int command35(); + int command36(); + int command37(); + int command38(); + int command39(); + int command40(); + int command41(); + + void command111213(); + void command2627293032(); +public: + ASound1(Audio::Mixer *mixer); + + virtual int command(int commandId); +}; + +} // End of namespace Nebular + +} // End of namespace MADS + +#endif /* MADS_SOUND_NEBULAR_H */ -- cgit v1.2.3 From 85e913864cb618211086c752ae79b0af51d28ae9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 16 Feb 2014 17:02:13 -0500 Subject: MADS: Renaming and fixes for loading sample data --- engines/mads/sound_nebular.cpp | 90 ++++++++++++++++++++++-------------------- engines/mads/sound_nebular.h | 57 +++++++++++++++----------- 2 files changed, 81 insertions(+), 66 deletions(-) diff --git a/engines/mads/sound_nebular.cpp b/engines/mads/sound_nebular.cpp index 03fdc5ffae..e364fbdf5d 100644 --- a/engines/mads/sound_nebular.cpp +++ b/engines/mads/sound_nebular.cpp @@ -38,7 +38,7 @@ AdlibChannel::AdlibChannel() { _field2 = 0; _field3 = 0; _field4 = 0; - _field5 = 0; + _sampleIndex = 0; _volume = 0; _field7 = 0; _field8 = 0; @@ -115,24 +115,25 @@ void AdlibChannel::check(byte *nullPtr) { /*-----------------------------------------------------------------------*/ -SoundData::SoundData(Common::SeekableReadStream &s) { - _field0 = s.readByte(); - _field1 = s.readByte(); - _field2 = s.readByte(); - _field3 = s.readByte(); - _field4 = s.readByte(); - _field5 = s.readByte(); - _field6 = s.readByte(); - _field7 = s.readByte(); - _field8 = s.readByte(); - _field9 = s.readByte(); - _fieldA = s.readByte(); - _fieldB = s.readByte(); - _fieldC = s.readByte(); - _fieldD = s.readByte(); +AdlibSample::AdlibSample(Common::SeekableReadStream &s) { + _attackRate = s.readByte(); + _decayRate = s.readByte(); + _sustainLevel = s.readByte(); + _releaseRate = s.readByte(); + _egTyp = s.readByte() != 0; + _ksr = s.readByte() != 0; + _totalLevel = s.readByte(); + _scalingLevel = s.readByte(); + _waveformSelect = s.readByte(); + _freqMultiple = s.readByte(); + _feedback = s.readByte(); + _ampMod = s.readByte() != 0; + _vib = s.readByte(); + _alg = s.readByte(); _fieldE = s.readByte(); - _field10 = s.readUint16LE(); - _field12 = s.readUint16LE(); + s.skip(1); + _freqMask = s.readUint16LE(); + _freqBase = s.readUint16LE(); _field14 = s.readUint16LE(); } @@ -151,7 +152,7 @@ ASound::ASound(Audio::Mixer *mixer, const Common::String &filename, int dataOffs // Initialise fields _activeChannelPtr = nullptr; - _soundDataPtr = nullptr; + _samplePtr = nullptr; _frameCounter = 0; _isDisabled = false; _v1 = 0; @@ -456,9 +457,9 @@ void ASound::pollActiveChannel() { break; case 3: - chan->_field5 = *++pSrc; + chan->_sampleIndex = *++pSrc; chan->_pSrc += 2; - channelProc1(chan->_field5); + loadSample(chan->_sampleIndex); break; case 4: @@ -669,27 +670,27 @@ void ASound::updateActiveChannel() { write2(2, reg, val2); } -void ASound::channelProc1(int recIndex) { +void ASound::loadSample(int sampleIndex) { _activeChannelReg = 0xB0 + _activeChannelNumber; write2(8, _activeChannelReg, _ports[_activeChannelReg] & 0xDF); _activeChannelReg = _activeChannelNumber; - _soundDataPtr = &_soundData[recIndex * 2]; + _samplePtr = &_samples[sampleIndex * 2]; _v11 = outputChannels[outputIndexes[_activeChannelReg * 2 - 1]]; - channelProc2(); + processSample(); AdlibChannelData &cd = _channelData[_activeChannelNumber]; - cd._field6 = _soundDataPtr->_field14; - cd._freqBase = _soundDataPtr->_field12; - cd._freqMask = _soundDataPtr->_field10; - cd._field0 = _soundDataPtr->_fieldE; + cd._field6 = _samplePtr->_field14; + cd._freqBase = _samplePtr->_freqBase; + cd._freqMask = _samplePtr->_freqMask; + cd._field0 = _samplePtr->_fieldE; - _soundDataPtr = &_soundData[recIndex * 2 + 1]; + _samplePtr = &_samples[sampleIndex * 2 + 1]; _v11 = outputChannels[outputIndexes[_activeChannelReg * 2]]; - channelProc2(); + processSample(); } -void ASound::channelProc2() { +void ASound::processSample() { // Write out vib flags and split point write2(8, 0x40 + _v11, 0x3F); int depthRhythm = _ports[0xBD] & 0x3F | (_amDep ? 0x80 : 0) | @@ -697,24 +698,29 @@ void ASound::channelProc2() { write2(8, 0xBD, depthRhythm); write2(8, 8, _splitPoint ? 0x40 : 0); - int val = _soundDataPtr->_fieldA; - val = (val << 1) | (1 - _soundDataPtr->_fieldD); + // Write out feedback & Alg + int val = (_samplePtr->_feedback << 1) | (1 - _samplePtr->_alg); write2(8, 0xC0 + _activeChannelReg, val); - val = (_soundDataPtr->_field0 << 4) | (_soundDataPtr->_field1 & 0xF); + // Write out attack/decay rate + val = (_samplePtr->_attackRate << 4) | (_samplePtr->_decayRate & 0xF); write2(8, 0x60 + _v11, val); - val = (_soundDataPtr->_field2 << 4) | (_soundDataPtr->_field3 & 0xF); + // Write out sustain level/release rate + val = (_samplePtr->_sustainLevel << 4) | (_samplePtr->_releaseRate & 0xF); write2(8, 0x80 + _v11, val); - val = (_soundDataPtr->_fieldB ? 0x80 : 0) | (_soundDataPtr->_fieldC ? 0x40 : 0) - | (_soundDataPtr->_field4 ? 0x20 : 0) | (_soundDataPtr->_field5 ? 0x10 : 0) - | (_soundDataPtr->_field9 & 0xF); + // Write out misc flags + val = (_samplePtr->_ampMod ? 0x80 : 0) | (_samplePtr->_vib ? 0x40 : 0) + | (_samplePtr->_egTyp ? 0x20 : 0) | (_samplePtr->_ksr ? 0x10 : 0) + | (_samplePtr->_freqMultiple & 0xF); write2(8, 0x20 + _v11, val); - write2(8, 0xE0 + _v11, _soundDataPtr->_field8 & 3); + // Write out waveform select + write2(8, 0xE0 + _v11, _samplePtr->_waveformSelect & 3); - val = -(_soundDataPtr->_field6 & 0x3F - 0x3F) | (_soundDataPtr->_field7 << 6); + // Write out total level & scaling level + val = -(_samplePtr->_totalLevel & 0x3F - 0x3F) | (_samplePtr->_scalingLevel << 6); write2(8, 0x40 + _v11, val); } @@ -841,10 +847,10 @@ const ASound1::CommandPtr ASound1::_commandList[42] = { ASound1::ASound1(Audio::Mixer *mixer): ASound(mixer, "asound.001", 0x1520) { _cmd23Toggle = false; - // Load sound data + // Load sound samples _soundFile.seek(_dataOffset + 0x12C); for (int i = 0; i < 98; ++i) - _soundData.push_back(SoundData(_soundFile)); + _samples.push_back(AdlibSample(_soundFile)); } int ASound1::command(int commandId) { diff --git a/engines/mads/sound_nebular.h b/engines/mads/sound_nebular.h index 8f92389ee1..d37c52e9b8 100644 --- a/engines/mads/sound_nebular.h +++ b/engines/mads/sound_nebular.h @@ -45,7 +45,7 @@ public: int _field2; int _field3; int _field4; - int _field5; + int _sampleIndex; int _volume; int _field7; int _field8; @@ -83,29 +83,29 @@ public: int _field6; }; -class SoundData { +class AdlibSample { public: - int _field0; - int _field1; - int _field2; - int _field3; - int _field4; - int _field5; - int _field6; - int _field7; - int _field8; - int _field9; - int _fieldA; - int _fieldB; - int _fieldC; - int _fieldD; + int _attackRate; + int _decayRate; + int _sustainLevel; + int _releaseRate; + bool _egTyp; + bool _ksr; + int _totalLevel; + int _scalingLevel; + int _waveformSelect; + int _freqMultiple; + int _feedback; + bool _ampMod; + int _vib; + int _alg; int _fieldE; - int _field10; - int _field12; + int _freqMask; + int _freqBase; int _field14; - SoundData() {} - SoundData(Common::SeekableReadStream &s); + AdlibSample() {} + AdlibSample(Common::SeekableReadStream &s); }; #define ADLIB_CHANNEL_COUNT 9 @@ -155,8 +155,17 @@ private: void updateChannelState(); void updateActiveChannel(); - void channelProc1(int recIndex); - void channelProc2(); + + /** + * Loads up the specified sample + */ + void loadSample(int sampleIndex); + + /** + * Writes out the data of the selected sample to the Adlib + */ + void processSample(); + void updateFNumber(); protected: /** @@ -233,8 +242,8 @@ public: AdlibChannel _channels[ADLIB_CHANNEL_COUNT]; AdlibChannel *_activeChannelPtr; AdlibChannelData _channelData[11]; - Common::Array _soundData; - SoundData *_soundDataPtr; + Common::Array _samples; + AdlibSample *_samplePtr; Common::File _soundFile; int _dataOffset; int _frameCounter; -- cgit v1.2.3 From a47bb52d2e5a76a88e039b80cc6e064f8e74a199 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 16 Feb 2014 17:14:28 -0500 Subject: MADS: Add some missing channel initialisation --- engines/mads/sound.cpp | 2 ++ engines/mads/sound_nebular.cpp | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/engines/mads/sound.cpp b/engines/mads/sound.cpp index 335afb4cdb..e3590f5ce7 100644 --- a/engines/mads/sound.cpp +++ b/engines/mads/sound.cpp @@ -42,7 +42,9 @@ void SoundManager::setVm(MADSEngine *vm, Audio::Mixer *mixer) { void SoundManager::test() { _asound = new Nebular::ASound1(_mixer); + _asound->command(5); _asound->command(28); + _asound->command(19); } void SoundManager::poll() { diff --git a/engines/mads/sound_nebular.cpp b/engines/mads/sound_nebular.cpp index e364fbdf5d..6733f4e02e 100644 --- a/engines/mads/sound_nebular.cpp +++ b/engines/mads/sound_nebular.cpp @@ -70,7 +70,11 @@ void AdlibChannel::reset() { void AdlibChannel::enable(int flag) { if (_activeCount) { _fieldE = flag; - _soundData = nullptr; // TODO: Check original set it to flag??! + + // WORKAROUND: Original set _soundData pointer to flag. Since this seems + // just intended to invalidate any prior pointer, I've replaced it with + // a simple null pointer + _soundData = nullptr; } } @@ -930,11 +934,13 @@ int ASound1::command17() { } int ASound1::command18() { + command1(); playSound(0xCA6, 20); return 0; } int ASound1::command19() { + command1(); playSound(0xCBA, 74); return 0; } -- cgit v1.2.3 From 409f51cb99bcd9e1024e57b250d70327f61e6d15 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 16 Feb 2014 22:26:31 -0500 Subject: MADS: Further sound udpate fixes --- engines/mads/sound_nebular.cpp | 66 ++++++++++++++++++++++++++++-------------- engines/mads/sound_nebular.h | 2 +- 2 files changed, 46 insertions(+), 22 deletions(-) diff --git a/engines/mads/sound_nebular.cpp b/engines/mads/sound_nebular.cpp index 6733f4e02e..a1116932d1 100644 --- a/engines/mads/sound_nebular.cpp +++ b/engines/mads/sound_nebular.cpp @@ -195,7 +195,12 @@ ASound::~ASound() { } void ASound::adlibInit() { - // No implementation + write(4, 0x60); + write(4, 0x80); + write(2, 0xff); + write(4, 0x21); + write(4, 0x60); + write(4, 0x80); } int ASound::stop() { @@ -228,7 +233,6 @@ void ASound::noise() { } void ASound::write(int reg, int val) { - debug("reg %.2x = %.2x", reg, val); _opl->write(reg, val); } @@ -369,9 +373,9 @@ void ASound::checkChannels() { } void ASound::pollActiveChannel() { - bool flag = false; - AdlibChannel *chan = _activeChannelPtr; + bool updateFlag = true; + if (chan->_activeCount) { if (chan->_field8 > 0 && --chan->_field8 == 0) updateOctave(); @@ -380,7 +384,7 @@ void ASound::pollActiveChannel() { for (;;) { byte *pSrc = chan->_pSrc; if (!(*pSrc & 0x80) || (*pSrc <= 0xF0)) { - if (flag) + if (updateFlag) updateActiveChannel(); chan->_field4 = *pSrc++; @@ -394,9 +398,10 @@ void ASound::pollActiveChannel() { updateChannelState(); } + // Break out of processing loop break; } else { - flag = false; + updateFlag = false; switch ((~*pSrc) & 0xF) { case 0: @@ -479,10 +484,10 @@ void ASound::pollActiveChannel() { case 6: ++pSrc; if (chan->_fieldE) { - chan->_volume = *pSrc >> 1; - flag = 1; chan->_pSrc += 2; } else { + chan->_volume = *pSrc >> 1; + updateFlag = true; chan->_pSrc += 2; } break; @@ -521,14 +526,14 @@ void ASound::pollActiveChannel() { chan->_pSrc += 2; } else { chan->_field1E = *pSrc >> 1; - flag = 1; + updateFlag = true; chan->_pSrc += 2; } break; case 11: chan->_fieldD = *++pSrc; - flag = 1; + updateFlag = true; chan->_pSrc += 2; break; @@ -559,12 +564,22 @@ void ASound::pollActiveChannel() { if (chan->_field1) updateFNumber(); - flag = false; - if (chan->_field9 || chan->_field8) { + updateFlag = false; + if (chan->_field9 || chan->_fieldB) { if (!--chan->_field9) { chan->_field9 = chan->_fieldA; if (chan->_field2) { - chan->_field9 = CLIP(chan->_field2 + chan->_field1E, 0, 63); + int8 newVal = (int8)chan->_field2 + (int8)chan->_field1E; + if (newVal < 0) { + chan->_field9 = 0; + newVal = 0; + } else if (newVal > 63) { + chan->_field9 = 0; + newVal = 63; + } + + chan->_field1E = newVal; + updateFlag = true; } } @@ -572,11 +587,11 @@ void ASound::pollActiveChannel() { chan->_fieldB = chan->_fieldC; if (chan->_field3) { chan->_fieldD = chan->_field3; - flag = true; + updateFlag = true; } } - if (flag) + if (updateFlag) updateActiveChannel(); } } @@ -628,14 +643,13 @@ void ASound::updateChannelState() { resultCheck(); } else { int reg = 0xA0 + _activeChannelNumber; - int v = (_activeChannelPtr->_field4 + _activeChannelPtr->_field1F) / 12; - int vHi = v >> 8; - int vLo = v & 0xFF; - int val = _vList1[vHi] + vHi; + int vTimes = (_activeChannelPtr->_field4 + _activeChannelPtr->_field1F) / 12; + int vOffset = (_activeChannelPtr->_field4 + _activeChannelPtr->_field1F) % 12; + int val = _vList1[vOffset] + _activeChannelPtr->_field1D; write2(8, reg, val & 0xFF); reg += 0x10; - write2(8, reg, (_ports[reg] & 0x20) | (vLo << 2) | (val >> 8)); + write2(8, reg, (_ports[reg] & 0x20) | (vTimes << 2) | (val >> 8)); write2(8, reg, _ports[reg] | 0x20); } @@ -664,7 +678,8 @@ void ASound::updateActiveChannel() { int portVal = _ports[reg] & 0xFFC0; int newVolume = CLIP(_activeChannelPtr->_volume + _activeChannelPtr->_field1E, 0, 63); - // TODO: Double-check _v5660 = 5600h + // Note: Original had a whole block not seeming to be used, since the initialisation + // sets a variable to 5660h, and doesn't change it, so the branch is never taken int val = CLIP(newVolume - volumeList[_activeChannelPtr->_fieldD], 0, 63); val = (63 - val) | portVal; @@ -753,6 +768,15 @@ int ASound::command0() { _v7 = 0; _v8 = 0; + // Reset Adlib port registers + for (int reg = 0x4F; reg >= 0x40; --reg) + write2(8, reg, 0x3F); + for (int reg = 0xFF; reg >= 0x60; --reg) + write2(8, reg, 0); + for (int reg = 0x3F; reg > 0; --reg) + write2(8, reg, 0); + write2(8, 1, 0x20); + _isDisabled = isDisabled; return 0; } diff --git a/engines/mads/sound_nebular.h b/engines/mads/sound_nebular.h index d37c52e9b8..e2367a5bd8 100644 --- a/engines/mads/sound_nebular.h +++ b/engines/mads/sound_nebular.h @@ -51,7 +51,7 @@ public: int _field8; int _field9; int _fieldA; - int _fieldB; + uint8 _fieldB; int _fieldC; int _fieldD; int _fieldE; -- cgit v1.2.3 From ece3e9a2200052cc65f60e0295b674095d7a6a66 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 16 Feb 2014 23:04:02 -0500 Subject: MADS: Booyah! Copy protection failure air escaping sound playing --- engines/mads/mads.cpp | 8 ------ engines/mads/sound_nebular.cpp | 61 +++++++++++++++++++++++++++++++++++++----- engines/mads/sound_nebular.h | 51 ++++++++++++++++++++++++++++++++--- 3 files changed, 102 insertions(+), 18 deletions(-) diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index 39ef195cd6..25730fa9e4 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -45,8 +45,6 @@ void MADSEngine::initialise() { _soundManager.setVm(this, _mixer); } -static uint32 lastSoundFrame = 0; - Common::Error MADSEngine::run() { initGraphics(320, 200, false); initialise(); @@ -56,12 +54,6 @@ Common::Error MADSEngine::run() { while (!shouldQuit()) { g_system->getEventManager()->pollEvent(e); g_system->delayMillis(10); - - uint32 milli = g_system->getMillis(); - if (milli > (lastSoundFrame + 50)) { - lastSoundFrame = milli; - _soundManager.poll(); - } } return Common::kNoError; diff --git a/engines/mads/sound_nebular.cpp b/engines/mads/sound_nebular.cpp index a1116932d1..146a620261 100644 --- a/engines/mads/sound_nebular.cpp +++ b/engines/mads/sound_nebular.cpp @@ -148,12 +148,6 @@ ASound::ASound(Audio::Mixer *mixer, const Common::String &filename, int dataOffs if (!_soundFile.open(filename)) error("Could not open file - %s", filename.c_str()); - _dataOffset = dataOffset; - _mixer = mixer; - _opl = OPL::Config::create(); - assert(_opl); - _opl->init(11025); - // Initialise fields _activeChannelPtr = nullptr; _samplePtr = nullptr; @@ -179,6 +173,21 @@ ASound::ASound(Audio::Mixer *mixer, const Common::String &filename, int dataOffs _randomSeed = 1234; _amDep = _vibDep = _splitPoint = true; + _samplesTillCallback = 0; + _samplesTillCallbackRemainder = 0; + _samplesPerCallback = getRate() / CALLBACKS_PER_SECOND; + _samplesPerCallbackRemainder = getRate() % CALLBACKS_PER_SECOND; + + // Store passed parameters, and setup OPL + _dataOffset = dataOffset; + _mixer = mixer; + _opl = OPL::Config::create(); + assert(_opl); + + _opl->init(getRate()); + _mixer->playStream(Audio::Mixer::kPlainSoundType, &_soundHandle, this, -1, + Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true); + // Initialise the Adlib adlibInit(); @@ -191,6 +200,7 @@ ASound::~ASound() { for (i = _dataCache.begin(); i != _dataCache.end(); ++i) delete[] (*i)._data; + _mixer->stopHandle(_soundHandle); delete _opl; } @@ -233,7 +243,7 @@ void ASound::noise() { } void ASound::write(int reg, int val) { - _opl->write(reg, val); + _queue.push(RegisterValue(reg, val)); } int ASound::write2(int state, int reg, int val) { @@ -243,6 +253,15 @@ int ASound::write2(int state, int reg, int val) { return state; } +void ASound::flush() { + Common::StackLock slock(_driverMutex); + + while (!_queue.empty()) { + RegisterValue v = _queue.pop(); + _opl->writeReg(v._regNum, v._value); + } +} + void ASound::channelOn(int reg, int volume) { write2(8, reg, (_ports[reg] & 0xC0) | (volume & 0x3F)); } @@ -754,6 +773,34 @@ void ASound::updateFNumber() { write2(8, hiReg, val2); } +int ASound::readBuffer(int16 *buffer, const int numSamples) { + Common::StackLock slock(_driverMutex); + + int32 samplesLeft = numSamples; + memset(buffer, 0, sizeof(int16) * numSamples); + while (samplesLeft) { + if (!_samplesTillCallback) { + poll(); + flush(); + + _samplesTillCallback = _samplesPerCallback; + _samplesTillCallbackRemainder += _samplesPerCallbackRemainder; + if (_samplesTillCallbackRemainder >= CALLBACKS_PER_SECOND) { + _samplesTillCallback++; + _samplesTillCallbackRemainder -= CALLBACKS_PER_SECOND; + } + } + + int32 render = MIN(samplesLeft, _samplesTillCallback); + samplesLeft -= render; + _samplesTillCallback -= render; + + _opl->readBuffer(buffer, render); + buffer += render; + } + return numSamples; +} + int ASound::command0() { bool isDisabled = _isDisabled; _isDisabled = true; diff --git a/engines/mads/sound_nebular.h b/engines/mads/sound_nebular.h index e2367a5bd8..f9251c9329 100644 --- a/engines/mads/sound_nebular.h +++ b/engines/mads/sound_nebular.h @@ -25,6 +25,8 @@ #include "common/scummsys.h" #include "common/file.h" +#include "common/mutex.h" +#include "common/queue.h" #include "audio/audiostream.h" #include "audio/fmopl.h" #include "audio/mixer.h" @@ -108,13 +110,23 @@ public: AdlibSample(Common::SeekableReadStream &s); }; +struct RegisterValue { + uint8 _regNum; + uint8 _value; + + RegisterValue(int regNum, int value) { + _regNum = regNum; _value = value; + } +}; + #define ADLIB_CHANNEL_COUNT 9 #define ADLIB_CHANNEL_MIDWAY 5 +#define CALLBACKS_PER_SECOND 60 /** * Base class for the sound player resource files */ -class ASound { +class ASound: public Audio::AudioStream { private: struct CachedDataEntry { int _offset; @@ -169,15 +181,20 @@ private: void updateFNumber(); protected: /** - * Write a byte to an Adlib register + * Queue a byte for an Adlib register */ void write(int reg, int val); /** - * Write a byte to an Adlib register, and store it in the _ports array + * Queue a byte for an Adlib register, and store it in the _ports array */ int write2(int state, int reg, int val); + /** + * Flush any pending Adlib register values to the OPL driver + */ + void flush(); + /** * Turn a channel on */ @@ -239,12 +256,15 @@ protected: public: Audio::Mixer *_mixer; FM_OPL *_opl; + Audio::SoundHandle _soundHandle; AdlibChannel _channels[ADLIB_CHANNEL_COUNT]; AdlibChannel *_activeChannelPtr; AdlibChannelData _channelData[11]; Common::Array _samples; AdlibSample *_samplePtr; Common::File _soundFile; + Common::Queue _queue; + Common::Mutex _driverMutex; int _dataOffset; int _frameCounter; bool _isDisabled; @@ -268,6 +288,10 @@ public: int _activeChannelReg; int _v11; bool _amDep, _vibDep, _splitPoint; + int _samplesPerCallback; + int _samplesPerCallbackRemainder; + int _samplesTillCallback; + int _samplesTillCallbackRemainder; public: /** * Constructor @@ -306,6 +330,27 @@ public: * Return the current frame counter */ int getFrameCounter() { return _frameCounter; } + + // AudioStream interface + /** + * Main buffer read + */ + virtual int readBuffer(int16 *buffer, const int numSamples); + + /** + * Mono sound only + */ + virtual bool isStereo() const { return false; } + + /** + * Data is continuously pushed, so definitive end + */ + virtual bool endOfData() const { return false; } + + /** + * Return sample rate + */ + virtual int getRate() const { return 11025; } }; class ASound1: public ASound { -- cgit v1.2.3 From 0e46c809d10dcd8fd766d7adcb966785e7955f5b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 18 Feb 2014 20:08:58 -0500 Subject: MADS: Initial implementation of MSurface class and dependant classes --- engines/mads/compression.cpp | 185 ++++++++++++ engines/mads/compression.h | 80 +++++ engines/mads/detection.cpp | 19 +- engines/mads/events.cpp | 34 +++ engines/mads/events.h | 43 +++ engines/mads/mads.cpp | 42 ++- engines/mads/mads.h | 34 ++- engines/mads/module.mk | 9 +- engines/mads/msprite.cpp | 207 +++++++++++++ engines/mads/msprite.h | 152 ++++++++++ engines/mads/msurface.cpp | 690 +++++++++++++++++++++++++++++++++++++++++++ engines/mads/msurface.h | 185 ++++++++++++ engines/mads/palette.cpp | 289 ++++++++++++++++++ engines/mads/palette.h | 110 +++++++ engines/mads/resources.cpp | 32 ++ engines/mads/resources.h | 57 ++++ engines/mads/sound.cpp | 9 +- engines/mads/sound.h | 3 +- engines/mads/sound_nebular.h | 4 +- 19 files changed, 2153 insertions(+), 31 deletions(-) create mode 100644 engines/mads/compression.cpp create mode 100644 engines/mads/compression.h create mode 100644 engines/mads/events.cpp create mode 100644 engines/mads/events.h create mode 100644 engines/mads/msprite.cpp create mode 100644 engines/mads/msprite.h create mode 100644 engines/mads/msurface.cpp create mode 100644 engines/mads/msurface.h create mode 100644 engines/mads/palette.cpp create mode 100644 engines/mads/palette.h create mode 100644 engines/mads/resources.cpp create mode 100644 engines/mads/resources.h diff --git a/engines/mads/compression.cpp b/engines/mads/compression.cpp new file mode 100644 index 0000000000..f8df5a5e43 --- /dev/null +++ b/engines/mads/compression.cpp @@ -0,0 +1,185 @@ +/* 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 "mads/compression.h" + +namespace MADS { + +const char *const madsPackString = "MADSPACK"; + +bool MadsPack::isCompressed(Common::SeekableReadStream *stream) { + // Check whether the passed stream is packed + + char tempBuffer[8]; + stream->seek(0); + if (stream->read(tempBuffer, 8) == 8) { + if (!strncmp(tempBuffer, madsPackString, 8)) + return true; + } + + return false; +} + +MadsPack::MadsPack(Common::SeekableReadStream *stream) { + initialise(stream); +} + +MadsPack::MadsPack(const Common::String &resourceName, MADSEngine *vm) { + Common::SeekableReadStream *stream = vm->_resources->get(resourceName); + initialise(stream); + vm->_resources->toss(resourceName); +} + +void MadsPack::initialise(Common::SeekableReadStream *stream) { + if (!MadsPack::isCompressed(stream)) + error("Attempted to decompress a resource that was not MadsPacked"); + + stream->seek(14); + _count = stream->readUint16LE(); + _items = new MadsPackEntry[_count]; + + byte *headerData = new byte[0xA0]; + byte *header = headerData; + stream->read(headerData, 0xA0); + + for (int i = 0; i < _count; ++i, header += 10) { + // Get header data + _items[i].hash = READ_LE_UINT16(header); + _items[i].size = READ_LE_UINT32(header + 2); + _items[i].compressedSize = READ_LE_UINT32(header + 6); + + _items[i].data = new byte[_items[i].size]; + if (_items[i].size == _items[i].compressedSize) { + // Entry isn't compressed + stream->read(_items[i].data, _items[i].size); + } else { + // Decompress the entry + byte *compressedData = new byte[_items[i].compressedSize]; + stream->read(compressedData, _items[i].compressedSize); + + FabDecompressor fab; + fab.decompress(compressedData, _items[i].compressedSize, _items[i].data, _items[i].size); + delete[] compressedData; + } + } + + delete[] headerData; + _dataOffset = stream->pos(); +} + +MadsPack::~MadsPack() { + for (int i = 0; i < _count; ++i) + delete[] _items[i].data; + delete[] _items; +} + +//-------------------------------------------------------------------------- + +const char *FabInputExceededError = "FabDecompressor - Passed end of input buffer during decompression"; +const char *FabOutputExceededError = "FabDecompressor - Decompressed data exceeded specified size"; + +void FabDecompressor::decompress(const byte *srcData, int srcSize, byte *destData, int destSize) { + byte copyLen, copyOfsShift, copyOfsMask, copyLenMask; + unsigned long copyOfs; + byte *destP; + + // Validate that the data starts with the FAB header + if (strncmp((const char *)srcData, "FAB", 3) != 0) + error("FabDecompressor - Invalid compressed data"); + + int shiftVal = srcData[3]; + if ((shiftVal < 10) || (shiftVal > 13)) + error("FabDecompressor - Invalid shift start"); + + copyOfsShift = 16 - shiftVal; + copyOfsMask = 0xFF << (shiftVal - 8); + copyLenMask = (1 << copyOfsShift) - 1; + copyOfs = 0xFFFF0000; + destP = destData; + + // Initialise data fields + _srcData = srcData; + _srcP = _srcData + 6; + _srcSize = srcSize; + _bitsLeft = 16; + _bitBuffer = READ_LE_UINT16(srcData + 4); + + for (;;) { + if (getBit() == 0) { + if (getBit() == 0) { + copyLen = ((getBit() << 1) | getBit()) + 2; + copyOfs = *_srcP++ | 0xFFFFFF00; + } else { + copyOfs = (((_srcP[1] >> copyOfsShift) | copyOfsMask) << 8) | _srcP[0]; + copyLen = _srcP[1] & copyLenMask; + _srcP += 2; + if (copyLen == 0) { + copyLen = *_srcP++; + if (copyLen == 0) + break; + else if (copyLen == 1) + continue; + else + copyLen++; + } else { + copyLen += 2; + } + copyOfs |= 0xFFFF0000; + } + while (copyLen-- > 0) { + if (destP - destData == destSize) + error(FabOutputExceededError); + + *destP = destP[(signed int)copyOfs]; + destP++; + } + } else { + if (_srcP - srcData == srcSize) + error(FabInputExceededError); + if (destP - destData == destSize) + error(FabOutputExceededError); + + *destP++ = *_srcP++; + } + } + + if (destP - destData != destSize) + error("FabDecompressor - Decompressed data does not match header decompressed size"); +} + +int FabDecompressor::getBit() { + _bitsLeft--; + if (_bitsLeft == 0) { + if (_srcP - _srcData == _srcSize) + error(FabInputExceededError); + + _bitBuffer = (READ_LE_UINT16(_srcP) << 1) | (_bitBuffer & 1); + _srcP += 2; + _bitsLeft = 16; + } + + int bit = _bitBuffer & 1; + _bitBuffer >>= 1; + return bit; +} + +} // End of namespace M4 diff --git a/engines/mads/compression.h b/engines/mads/compression.h new file mode 100644 index 0000000000..bf690dcc46 --- /dev/null +++ b/engines/mads/compression.h @@ -0,0 +1,80 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_COMPRESSION_H +#define MADS_COMPRESSION_H + +#include "common/scummsys.h" +#include "common/endian.h" +#include "common/memstream.h" +#include "common/stream.h" + +#include "mads/mads.h" + +namespace MADS { + +struct MadsPackEntry { +public: + uint16 hash; + uint32 size; + uint32 compressedSize; + byte *data; +}; + +class MadsPack { +private: + MadsPackEntry *_items; + int _count; + int _dataOffset; + + void initialise(Common::SeekableReadStream *stream); +public: + static bool isCompressed(Common::SeekableReadStream *stream); + MadsPack(Common::SeekableReadStream *stream); + MadsPack(const Common::String &resourceName, MADSEngine *_vm); + ~MadsPack(); + + int getCount() const { return _count; } + MadsPackEntry &getItem(int index) const { return _items[index]; } + MadsPackEntry &operator[](int index) const { return _items[index]; } + Common::MemoryReadStream *getItemStream(int index) { + return new Common::MemoryReadStream(_items[index].data, _items[index].size, + DisposeAfterUse::NO); + } + int getDataOffset() const { return _dataOffset; } +}; + +class FabDecompressor { +private: + int _bitsLeft; + uint32 _bitBuffer; + const byte *_srcData, *_srcP; + int _srcSize; + + int getBit(); +public: + void decompress(const byte *srcData, int srcSize, byte *destData, int destSize); +}; + +} // End of namespace MADS + +#endif diff --git a/engines/mads/detection.cpp b/engines/mads/detection.cpp index 4e56655f40..73a4b97931 100644 --- a/engines/mads/detection.cpp +++ b/engines/mads/detection.cpp @@ -38,8 +38,19 @@ namespace MADS { struct MADSGameDescription { ADGameDescription desc; + + int gameID; + uint32 features; }; +uint32 MADSEngine::getGameID() const { + return _gameDescription->gameID; +} + +uint32 MADSEngine::getGameFeatures() const { + return _gameDescription->gameID; +} + uint32 MADSEngine::getFeatures() const { return _gameDescription->desc.flags; } @@ -52,10 +63,6 @@ Common::Platform MADSEngine::getPlatform() const { return _gameDescription->desc.platform; } -bool MADSEngine::getIsDemo() const { - return _gameDescription->desc.flags & ADGF_DEMO; -} - } // End of namespace MADS static const PlainGameDescriptor MADSGames[] = { @@ -165,7 +172,7 @@ SaveStateDescriptor MADSMetaEngine::querySaveMetaInfos(const char *target, int s #if PLUGIN_ENABLED_DYNAMIC(MADS) -REGISTER_PLUGIN_DYNAMIC(MADS, PLUGIN_TYPE_ENGINE, MADSMetaEngine); + REGISTER_PLUGIN_DYNAMIC(MADS, PLUGIN_TYPE_ENGINE, MADSMetaEngine); #else -REGISTER_PLUGIN_STATIC(MADS, PLUGIN_TYPE_ENGINE, MADSMetaEngine); + REGISTER_PLUGIN_STATIC(MADS, PLUGIN_TYPE_ENGINE, MADSMetaEngine); #endif diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp new file mode 100644 index 0000000000..8d6262aec3 --- /dev/null +++ b/engines/mads/events.cpp @@ -0,0 +1,34 @@ +/* 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 "common/scummsys.h" +#include "common/events.h" +#include "mads/mads.h" +#include "mads/events.h" + +namespace MADS { + +EventsManager::EventsManager(MADSEngine *vm) { + _vm = vm; +} + +} // End of namespace MADS diff --git a/engines/mads/events.h b/engines/mads/events.h new file mode 100644 index 0000000000..ea52c7ab9c --- /dev/null +++ b/engines/mads/events.h @@ -0,0 +1,43 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_EVENTS_H +#define MADS_EVENTS_H + +#include "common/scummsys.h" + +namespace MADS { + +class MADSEngine; + +class EventsManager { +private: + MADSEngine *_vm; +public: + EventsManager(MADSEngine *vm); + + void handleEvents() { /* TODO */ } +}; + +} // End of namespace MADS + +#endif /* MADS_EVENTS_H */ diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index 25730fa9e4..9998bc02e9 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -20,35 +20,57 @@ * */ -#include "mads/mads.h" -#include "mads/sound.h" #include "common/scummsys.h" #include "common/config-manager.h" #include "common/debug-channels.h" -#include "engines/util.h" #include "common/events.h" +#include "engines/util.h" +#include "mads/mads.h" +#include "mads/resources.h" +#include "mads/sound.h" +#include "mads/msurface.h" +#include "mads/msprite.h" namespace MADS { -MADSEngine *g_vm; - MADSEngine::MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc) : - Engine(syst), _randomSource("MADS") { - DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level"); - DebugMan.addDebugChannel(kDebugScripts, "scripts", "Game scripts"); + _gameDescription(gameDesc), Engine(syst), _randomSource("MADS") { + + // Initialise fields + _easyMouse = true; + _invObjectStill = false; + _textWindowStill = false; + _palette = nullptr; + _resources = nullptr; + _screen = nullptr; + _sound = nullptr; } MADSEngine::~MADSEngine() { + delete _events; + delete _resources; + delete _screen; + delete _sound; } void MADSEngine::initialise() { - _soundManager.setVm(this, _mixer); + // Set up debug channels + DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level"); + DebugMan.addDebugChannel(kDebugScripts, "scripts", "Game scripts"); + + // Initial sub-system engine references + MSurface::setVm(this); + MSprite::setVm(this); + + _events = new EventsManager(this); + _resources = new ResourcesManager(this); + _screen = MSurface::init(); + _sound = new SoundManager(this, _mixer); } Common::Error MADSEngine::run() { initGraphics(320, 200, false); initialise(); - _soundManager.test(); Common::Event e; while (!shouldQuit()) { diff --git a/engines/mads/mads.h b/engines/mads/mads.h index b54c46ea96..8ca181ea02 100644 --- a/engines/mads/mads.h +++ b/engines/mads/mads.h @@ -30,6 +30,9 @@ #include "common/util.h" #include "engines/engine.h" #include "graphics/surface.h" +#include "mads/events.h" +#include "mads/msurface.h" +#include "mads/resources.h" #include "mads/sound.h" /** @@ -46,13 +49,22 @@ namespace MADS { #define DEBUG_INTERMEDIATE 2 #define DEBUG_DETAILED 3 -#define MAX_RESOLVE 1000 - enum MADSDebugChannels { kDebugPath = 1 << 0, kDebugScripts = 1 << 1 }; +enum { + GType_RexNebular = 0, + GType_DragonSphere = 1, + GType_Phantom = 2, + GType_Riddle = 3 +}; + +enum { + GF_MADS = 1 << 0, + GF_M4 = 1 << 1 +}; struct MADSGameDescription; @@ -61,13 +73,26 @@ class MADSEngine : public Engine { private: const MADSGameDescription *_gameDescription; Common::RandomSource _randomSource; - SoundManager _soundManager; + bool _easyMouse; + bool _invObjectStill; + bool _textWindowStill; + + /** + * Handles basic initialisation + */ void initialise(); protected: // Engine APIs virtual Common::Error run(); virtual bool hasFeature(EngineFeature f) const; +public: + EventsManager *_events; + Palette *_palette; + ResourcesManager *_resources; + MSurface *_screen; + SoundManager *_sound; + public: MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc); virtual ~MADSEngine(); @@ -76,7 +101,8 @@ public: Common::Language getLanguage() const; Common::Platform getPlatform() const; uint16 getVersion() const; - bool getIsDemo() const; + uint32 getGameID() const; + uint32 getGameFeatures() const; int getRandomNumber(int maxNumber); }; diff --git a/engines/mads/module.mk b/engines/mads/module.mk index d8a26a2704..7ac919f246 100644 --- a/engines/mads/module.mk +++ b/engines/mads/module.mk @@ -1,10 +1,17 @@ MODULE := engines/mads MODULE_OBJS := \ + compression.o \ detection.o \ + events.o \ + mads.o \ + msprite.o \ + msurface.o \ + palette.o \ + resources.o \ sound.o \ sound_nebular.o \ - mads.o + sprite.o # This module can be built as a plugin ifeq ($(ENABLE_MADS), DYNAMIC_PLUGIN) diff --git a/engines/mads/msprite.cpp b/engines/mads/msprite.cpp new file mode 100644 index 0000000000..60c22d8c06 --- /dev/null +++ b/engines/mads/msprite.cpp @@ -0,0 +1,207 @@ +/* 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 "common/scummsys.h" +#include "engines/util.h" +#include "graphics/palette.h" +#include "mads/mads.h" +#include "mads/msurface.h" +#include "mads/msprite.h" + +namespace MADS { + +enum { + kEndOfLine = 0, + kEndOfSprite = 1, + kMarker = 2 +}; + +MADSEngine *MSprite::_vm; + +MSprite *MSprite::init(MSurface &s) { + if (_vm->getGameFeatures() & GF_MADS) { + return new MSpriteMADS(s); + } else { + return new MSpriteM4(s); + } +} + +MSprite *MSprite::init(Common::SeekableReadStream *source, const Common::Point &offset, + int widthVal, int heightVal, bool decodeRle, uint8 encodingVal) { + + if (_vm->getGameFeatures() & GF_MADS) { + return new MSpriteMADS(source, offset, widthVal, heightVal, decodeRle, encodingVal); + } else { + return new MSpriteM4(source, offset, widthVal, heightVal, decodeRle, encodingVal); + } +} + +MSprite::MSprite(MSurface &s): _surface(s) { + _encoding = 0; +} + +MSprite::MSprite(Common::SeekableReadStream *source, const Common::Point &offset, + int widthVal, int heightVal, bool decodeRle, uint8 encodingVal) + : _surface(*MSurface::init(widthVal, heightVal)), + _encoding(encodingVal), _offset(offset) { + + // Load the sprite data + load(source, widthVal, heightVal, decodeRle); +} + +MSprite::~MSprite() { +} + +/*------------------------------------------------------------------------*/ + +void MSpriteMADS::load(Common::SeekableReadStream *stream, int widthVal, int heightVal, + bool decodeRle) { + loadSprite(stream); +} + +// TODO: The sprite outlines (pixel value 0xFD) are not shown +void MSpriteMADS::loadSprite(Common::SeekableReadStream *source) { + byte *outp, *lineStart; + bool newLine = false; + + outp = _surface.getData(); + lineStart = _surface.getData(); + + while (1) { + byte cmd1, cmd2, count, pixel; + + if (newLine) { + outp = lineStart + _surface.w; + lineStart = outp; + newLine = false; + } + + cmd1 = source->readByte(); + + if (cmd1 == 0xFC) + break; + else if (cmd1 == 0xFF) + newLine = true; + else if (cmd1 == 0xFD) { + while (!newLine) { + count = source->readByte(); + if (count == 0xFF) { + newLine = true; + } else { + pixel = source->readByte(); + while (count--) + *outp++ = (pixel == 0xFD) ? 0 : pixel; + } + } + } else { + while (!newLine) { + cmd2 = source->readByte(); + if (cmd2 == 0xFF) { + newLine = true; + } else if (cmd2 == 0xFE) { + count = source->readByte(); + pixel = source->readByte(); + while (count--) + *outp++ = (pixel == 0xFD) ? 0 : pixel; + } else { + *outp++ = (cmd2 == 0xFD) ? 0 : cmd2; + } + } + } + } +} + +/*------------------------------------------------------------------------*/ + +void MSpriteM4::load(Common::SeekableReadStream *stream, int widthVal, int heightVal, + bool decodeRle) { + if (decodeRle) { + loadRle(stream); + } else { + // Raw sprite data, load directly + byte *dst = _surface.getData(); + stream->read(dst, widthVal * heightVal); + } +} + +void MSpriteM4::loadRle(Common::SeekableReadStream* rleData) { + byte *dst = _surface.getData(); + for (;;) { + byte len = rleData->readByte(); + if (len == 0) { + len = rleData->readByte(); + if (len <= kMarker) { + if (len == kEndOfSprite) + break; + } else { + while (len--) { + *dst++ = rleData->readByte(); + } + } + } else { + byte value = rleData->readByte(); + while (len--) + *dst++ = value; + } + } +} + +void MSpriteM4::loadDeltaRle(Common::SeekableReadStream* rleData, int destX, int destY) { + int lineNum = 0; + byte *dst = _surface.getBasePtr(destX, destY); + + for (;;) { + byte len = rleData->readByte(); + if (len == 0) { + len = rleData->readByte(); + if (len <= kMarker) { + if (len == kEndOfLine) { + dst = _surface.getBasePtr(destX, destY + lineNum); + lineNum++; + } else if (len == kEndOfSprite) + break; + } else { + while (len--) { + byte pixel = rleData->readByte(); + if (pixel == 0) + dst++; + else + *dst++ = pixel; + /* NOTE: The change below behaved differently than the old code, + so I put the old code back in again above. + If the pixel value is 0, nothing should be written to the + output buffer, since 0 means transparent. */ + //*dst++ = (pixel == 0xFD) ? 0 : pixel; + } + } + } else { + byte value = rleData->readByte(); + if (value == 0) + dst += len; + else + while (len--) + *dst++ = value; + } + } +} + +} // End of namespace MADS diff --git a/engines/mads/msprite.h b/engines/mads/msprite.h new file mode 100644 index 0000000000..c49aac4fba --- /dev/null +++ b/engines/mads/msprite.h @@ -0,0 +1,152 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_MSPRITE_H +#define MADS_MSPRITE_H + +#include "common/scummsys.h" +#include "mads/msurface.h" + +namespace MADS { + +class MADSEngine; + +struct BGR8 { + uint8 b, g, r; +}; + +typedef struct { + int32 x; // x position relative to GrBuff(0, 0) + int32 y; // y position relative to GrBuff(0, 0) + int32 scale_x; // x scale factor (can be negative for reverse draw) + int32 scale_y; // y scale factor (can't be negative) + uint8* depth_map; // depth code array for destination (doesn't care if srcDepth is 0) + BGR8* Pal; // palette for shadow draw (doesn't care if SHADOW bit is not set in Src.encoding) + uint8* ICT; // Inverse Color Table (doesn't care if SHADOW bit is not set in Src.encoding) + uint8 depth; // depth code for source (0 if no depth processing) +} DrawRequestX; + +typedef struct +{ + uint32 Pack; + uint32 Stream; + long hot_x; + long hot_y; + uint32 Width; + uint32 Height; + uint32 Comp; + uint32 Reserved[8]; + uint8* data; +} RendCell; + +#define SS_HEADER_NUM_FIELDS 14 +struct SpriteSeriesHeader { + uint32 header; + uint32 size; + uint32 packing; + uint32 frameRate; + uint32 pixSpeed; + uint32 maxWidth; + uint32 maxHeight; + uint32 reserved3; + uint32 reserved4; + uint32 reserved5; + uint32 reserved6; + uint32 reserved7; + uint32 reserved8; + uint32 count; +}; + +#define SF_HEADER_NUM_FIELDS 15 +struct SpriteFrameHeader { + uint32 pack; + uint32 stream; + uint32 x; + uint32 y; + uint32 width; + uint32 height; + uint32 comp; + uint32 reserved1; + uint32 reserved2; + uint32 reserved3; + uint32 reserved4; + uint32 reserved5; + uint32 reserved6; + uint32 reserved7; + uint32 reserved8; +}; + +class MSprite { +public: + MSprite *init(MSurface &s); + MSprite *init(Common::SeekableReadStream *source, const Common::Point &offset, int widthVal, + int heightVal, bool decodeRle = true, uint8 encodingVal = 0); +protected: + static MADSEngine *_vm; + + MSprite(MSurface &s); + MSprite(Common::SeekableReadStream *source, const Common::Point &offset, + int widthVal, int heightVal, bool decodeRle = true, uint8 encodingVal = 0); + + virtual void load(Common::SeekableReadStream *stream, int widthVal, int heightVal, bool decodeRle) {} +public: + static void setVm(MADSEngine *vm) { _vm = vm; } + virtual ~MSprite(); + + MSurface &_surface; + Common::Point _pos; + Common::Point _offset; + uint8 _encoding; +}; + +class MSpriteMADS: public MSprite { + friend class MSprite; +private: + void loadSprite(Common::SeekableReadStream *source); +protected: + MSpriteMADS(MSurface &s): MSprite(s) {} + MSpriteMADS(Common::SeekableReadStream *source, const Common::Point &offset, + int widthVal, int heightVal, bool decodeRle = true, uint8 encodingVal = 0): + MSprite(source, offset, widthVal, heightVal, decodeRle, encodingVal) {} + + virtual void load(Common::SeekableReadStream *stream, int widthVal, int heightVal, bool decodeRle); +}; + +class MSpriteM4: public MSprite { + friend class MSprite; +private: + // Loads a sprite from the given stream, and optionally decompresses the RLE-encoded data + // Loads an RLE compressed sprite; the surface must have been created before + void loadRle(Common::SeekableReadStream *rleData); + void loadDeltaRle(Common::SeekableReadStream *rleData, int destX, int destY); +protected: + MSpriteM4(MSurface &s): MSprite(s) {} + MSpriteM4(Common::SeekableReadStream *source, const Common::Point &offset, + int widthVal, int heightVal, bool decodeRle = true, uint8 encodingVal = 0): + MSprite(source, offset, widthVal, heightVal, decodeRle, encodingVal) {} + + virtual void load(Common::SeekableReadStream *stream, int widthVal, int heightVal, bool decodeRle); +}; + +} // End of namespace MADS + +#endif /* MADS_MSPRITE_H */ diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp new file mode 100644 index 0000000000..810f9326f7 --- /dev/null +++ b/engines/mads/msurface.cpp @@ -0,0 +1,690 @@ +/* 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 "engines/util.h" +#include "mads/mads.h" +#include "mads/compression.h" +#include "mads/msurface.h" +#include "mads/msprite.h" + +namespace MADS { + +MADSEngine *MSurface::_vm = nullptr; + +MSurface *MSurface::init(bool isScreen) { + if (_vm->getGameID() == GType_RexNebular) { + return new MSurfaceNebular(isScreen); + } else if (_vm->getGameFeatures() & GF_MADS) { + return new MSurfaceMADS(isScreen); + } else { + return new MSurfaceM4(isScreen); + } +} + +MSurface *MSurface::init(int w, int h) { + if (_vm->getGameID() == GType_RexNebular) { + return new MSurfaceNebular(w, h); + } else if (_vm->getGameFeatures() & GF_MADS) { + return new MSurfaceMADS(w, h); + } else { + return new MSurfaceM4(w, h); + } +} + +MSurface::MSurface(bool isScreen) { + create(g_system->getWidth(), g_system->getHeight()); + _isScreen = isScreen; +} + +MSurface::MSurface(int Width, int Height) { + create(Width, Height); + _isScreen = false; +} + +void MSurface::vLine(int x, int y1, int y2) { + Graphics::Surface::vLine(x, y1, y2, _color); +} + +void MSurface::hLine(int x1, int x2, int y) { + Graphics::Surface::hLine(x1, y, x2, _color); +} + +void MSurface::vLineXor(int x, int y1, int y2) { + // Clipping + if (x < 0 || x >= w) + return; + + if (y2 < y1) + SWAP(y2, y1); + + if (y1 < 0) + y1 = 0; + if (y2 >= h) + y2 = h - 1; + + byte *ptr = (byte *)getBasePtr(x, y1); + while (y1++ <= y2) { + *ptr ^= 0xFF; + ptr += pitch; + } + +} + +void MSurface::hLineXor(int x1, int x2, int y) { + // Clipping + if (y < 0 || y >= h) + return; + + if (x2 < x1) + SWAP(x2, x1); + + if (x1 < 0) + x1 = 0; + if (x2 >= w) + x2 = w - 1; + + if (x2 < x1) + return; + + byte *ptr = (byte *)getBasePtr(x1, y); + while (x1++ <= x2) + *ptr++ ^= 0xFF; + +} + +void MSurface::line(int x1, int y1, int x2, int y2, byte color) { + Graphics::Surface::drawLine(x1, y1, x2, y2, color); +} + + +void MSurface::frameRect(int x1, int y1, int x2, int y2) { + Graphics::Surface::frameRect(Common::Rect(x1, y1, x2, y2), _color); +} + +void MSurface::fillRect(int x1, int y1, int x2, int y2) { + Graphics::Surface::fillRect(Common::Rect(x1, y1, x2, y2), _color); +} + +int MSurface::scaleValue(int value, int scale, int err) { + int scaled = 0; + while (value--) { + err -= scale; + while (err < 0) { + scaled++; + err += 100; + } + } + return scaled; +} + +void MSurface::drawSprite(int x, int y, SpriteInfo &info, const Common::Rect &clipRect) { + + enum { + kStatusSkip, + kStatusScale, + kStatusDraw + }; + + // NOTE: The current clipping code assumes that the top left corner of the clip + // rectangle is always 0, 0 + assert(clipRect.top == 0 && clipRect.left == 0); + + // TODO: Put err* and scaled* into SpriteInfo + int errX = info.hotX * info.scaleX % 100; + int errY = info.hotY * info.scaleY % 100; + int scaledWidth = scaleValue(info.width, info.scaleX, errX); + int scaledHeight = scaleValue(info.height, info.scaleY, errY); + + /* + printf("MSurface::drawSprite() info.width = %d; info.scaleX = %d; info.height = %d; info.scaleY = %d; scaledWidth = %d; scaledHeight = %d\n", + info.width, info.scaleX, info.height, info.scaleY, scaledWidth, scaledHeight); fflush(stdout); + */ + + int clipX = 0, clipY = 0; + // Clip the sprite's width and height according to the clip rectangle's dimensions + // This clips the sprite to the bottom and right + if (x >= 0) { + scaledWidth = MIN(x + scaledWidth, clipRect.right) - x; + } else { + clipX = x; + scaledWidth = x + scaledWidth; + } + if (y >= 0) { + scaledHeight = MIN(y + scaledHeight, clipRect.bottom) - y; + } else { + clipY = y; + scaledHeight = y + scaledHeight; + } + + //printf("MSurface::drawSprite() width = %d; height = %d; scaledWidth = %d; scaledHeight = %d\n", info.width, info.height, scaledWidth, scaledHeight); fflush(stdout); + + // Check if sprite is inside the screen. If it's not, there's no need to draw it + if (scaledWidth + x <= 0 || scaledHeight + y <= 0) // check left and top (in case x,y are negative) + return; + if (scaledWidth <= 0 || scaledHeight <= 0) // check right and bottom + return; + int heightAmt = scaledHeight; + + byte *src = info.sprite->_surface.getData(); + byte *dst = getBasePtr(x - info.hotX - clipX, y - info.hotY - clipY); + + int status = kStatusSkip; + byte *scaledLineBuf = new byte[scaledWidth]; + + while (heightAmt > 0) { + + if (status == kStatusSkip) { + // Skip line + errY -= info.scaleY; + if (errY < 0) + status = kStatusScale; + else + src += info.width; + } else { + + if (status == kStatusScale) { + // Scale current line + byte *lineDst = scaledLineBuf; + int curErrX = errX; + int widthVal = scaledWidth; + byte *tempSrc = src; + int startX = clipX; + while (widthVal > 0) { + byte pixel = *tempSrc++; + curErrX -= info.scaleX; + while (curErrX < 0) { + if (startX == 0) { + *lineDst++ = pixel; + widthVal--; + } else { + startX++; + } + curErrX += 100; + } + } + src += info.width; + status = kStatusDraw; + } + + if (status == kStatusDraw && clipY == 0) { + // Draw previously scaled line + // TODO Implement different drawing types (depth, shadow etc.) + byte *tempDst = dst; + for (int lineX = 0; lineX < scaledWidth; lineX++) { + byte pixel = scaledLineBuf[lineX]; + + if (info.encoding & 0x80) { + + if (pixel == 0x80) { + pixel = 0; + } else { + byte destPixel = *tempDst; + byte r, g, b; + r = CLIP((info.palette[destPixel].r * pixel) >> 10, 0, 31); + g = CLIP((info.palette[destPixel].g * pixel) >> 10, 0, 31); + b = CLIP((info.palette[destPixel].b * pixel) >> 10, 0, 31); + pixel = info.inverseColorTable[(b << 10) | (g << 5) | r]; + } + } + + if (pixel) + *tempDst = pixel; + + tempDst++; + } + dst += pitch; + heightAmt--; + // TODO depth etc. + //depthAddress += Destination -> Width; + + errY += 100; + if (errY >= 0) + status = kStatusSkip; + } else if (status == kStatusDraw && clipY < 0) { + clipY++; + + errY += 100; + if (errY >= 0) + status = kStatusSkip; + } + + } + + } + + delete[] scaledLineBuf; + +} + +// Surface methods + +byte *MSurface::getData() { + return (byte *)Graphics::Surface::getPixels(); +} + +byte *MSurface::getBasePtr(int x, int y) { + return (byte *)Graphics::Surface::getBasePtr(x, y); +} + +void MSurface::freeData() { +} + +void MSurface::empty() { + Common::fill(getBasePtr(0, 0), getBasePtr(w, h), _vm->_palette->BLACK); +} + +void MSurface::frameRect(const Common::Rect &r, uint8 color) { + Graphics::Surface::frameRect(r, color); +} + +void MSurface::fillRect(const Common::Rect &r, uint8 color) { + Graphics::Surface::fillRect(r, color); +} + +void MSurface::copyFrom(MSurface *src, const Common::Rect &srcBounds, int destX, int destY, + int transparentColor) { + // Validation of the rectangle and position + if ((destX >= w) || (destY >= h)) + return; + + Common::Rect copyRect = srcBounds; + if (destX < 0) { + copyRect.left += -destX; + destX = 0; + } else if (destX + copyRect.width() > w) { + copyRect.right -= destX + copyRect.width() - w; + } + if (destY < 0) { + copyRect.top += -destY; + destY = 0; + } else if (destY + copyRect.height() > h) { + copyRect.bottom -= destY + copyRect.height() - h; + } + + if (!copyRect.isValidRect()) + return; + + // Copy the specified area + + byte *data = src->getData(); + byte *srcPtr = data + (src->width() * copyRect.top + copyRect.left); + byte *destPtr = (byte *)pixels + (destY * width()) + destX; + + for (int rowCtr = 0; rowCtr < copyRect.height(); ++rowCtr) { + if (transparentColor == -1) + // No transparency, so copy line over + Common::copy(srcPtr, srcPtr + copyRect.width(), destPtr); + else { + // Copy each byte one at a time checking for the transparency color + for (int xCtr = 0; xCtr < copyRect.width(); ++xCtr) + if (srcPtr[xCtr] != transparentColor) destPtr[xCtr] = srcPtr[xCtr]; + } + + srcPtr += src->width(); + destPtr += width(); + } + + src->freeData(); +} + +#undef COL_TRANS + +void MSurface::translate(RGBList *list, bool isTransparent) { + byte *p = getBasePtr(0, 0); + byte *palIndexes = list->palIndexes(); + + for (int i = 0; i < width() * height(); ++i, ++p) { + if (!isTransparent || (*p != 0)) { + assert(*p < list->size()); + *p = palIndexes[*p]; + } + } + + freeData(); +} + +/*------------------------------------------------------------------------*/ + +void MSurfaceMADS::loadCodes(Common::SeekableReadStream *source) { + if (!source) { + free(); + return; + } + + uint16 widthVal = 320; + uint16 heightVal = 156; + byte *walkMap = new byte[source->size()]; + + create(widthVal, heightVal); + source->read(walkMap, source->size()); + + byte *ptr = (byte *)getBasePtr(0, 0); + + for (int y = 0; y < heightVal; y++) { + for (int x = 0; x < widthVal; x++) { + int ofs = x + (y * widthVal); + if ((walkMap[ofs / 8] << (ofs % 8)) & 0x80) + *ptr++ = 1; // walkable + else + *ptr++ = 0; + } + } +} + +void MSurfaceMADS::loadBackground(int roomNumber, RGBList **palData) { + // clear previous data + empty(); + + // Get a MadsPack reference to the tile set and mapping + char resourceName[20]; + int i; + + // Uncompressed tile map resource + sprintf(resourceName, "rm%d.mm", roomNumber); + MadsPack tileMapFile(resourceName, _vm); + Common::SeekableReadStream *mapStream = tileMapFile.getItemStream(0); + + // Get the details of the tiles and map + mapStream->readUint32LE(); + int tileCountX = mapStream->readUint16LE(); + int tileCountY = mapStream->readUint16LE(); + int tileWidthMap = mapStream->readUint16LE(); + int tileHeightMap = mapStream->readUint16LE(); + int screenWidth = mapStream->readUint16LE(); + int screenHeight = mapStream->readUint16LE(); + int tileCountMap = tileCountX * tileCountY; + delete mapStream; + + // Obtain tile map information + typedef Common::List > TileSetList; + typedef TileSetList::iterator TileSetIterator; + TileSetList tileSet; + uint16 *tileMap = new uint16[tileCountMap]; + mapStream = tileMapFile.getItemStream(1); + for (i = 0; i < tileCountMap; ++i) + tileMap[i] = mapStream->readUint16LE(); + delete mapStream; + + _vm->_resources->toss(resourceName); + + // -------------------------------------------------------------------------------- + + // Tile map data, which needs to be kept compressed, as the tile offsets refer to + // the compressed data. Each tile is then uncompressed separately + sprintf(resourceName, "rm%d.tt", roomNumber); + Common::SeekableReadStream *tileDataComp = _vm->_resources->get(resourceName); + MadsPack tileData(tileDataComp); + Common::SeekableReadStream *tileDataUncomp = tileData.getItemStream(0); + + // Validate that the data matches between the tiles and tile map file and is valid + int tileCount = tileDataUncomp->readUint16LE(); + int tileWidth = tileDataUncomp->readUint16LE(); + int tileHeight = tileDataUncomp->readUint16LE(); + delete tileDataUncomp; + assert(tileCountMap == tileCount); + assert(tileWidth == tileWidthMap); + assert(tileHeight == tileHeightMap); + assert(screenWidth == _vm->_screen->width()); + assert(screenHeight <= _vm->_screen->height()); + + // -------------------------------------------------------------------------------- + + // Get the palette to use + tileDataUncomp = tileData.getItemStream(2); + // Set palette + if (!palData) { + _vm->_palette->setMadsPalette(tileDataUncomp, 4); + } else { + int numColors; + RGB8 *rgbList = _vm->_palette->decodeMadsPalette(tileDataUncomp, &numColors); + *palData = new RGBList(numColors, rgbList, true); + } + delete tileDataUncomp; + + // -------------------------------------------------------------------------------- + + // Get tile data + + tileDataUncomp = tileData.getItemStream(1); + FabDecompressor fab; + uint32 compressedTileDataSize = 0; + + for (i = 0; i < tileCount; i++) { + tileDataUncomp->seek(i * 4, SEEK_SET); + uint32 tileOfs = tileDataUncomp->readUint32LE(); + MSurface *newTile = MSurface::init(tileWidth, tileHeight); + + if (i == tileCount - 1) + compressedTileDataSize = tileDataComp->size() - tileOfs; + else + compressedTileDataSize = tileDataUncomp->readUint32LE() - tileOfs; + + //printf("Tile: %i, compressed size: %i\n", i, compressedTileDataSize); + + newTile->empty(); + + byte *compressedTileData = new byte[compressedTileDataSize]; + + tileDataComp->seek(tileData.getDataOffset() + tileOfs, SEEK_SET); + tileDataComp->read(compressedTileData, compressedTileDataSize); + + fab.decompress(compressedTileData, compressedTileDataSize, newTile->getData(), + tileWidth * tileHeight); + tileSet.push_back(TileSetList::value_type(newTile)); + delete[] compressedTileData; + } + + delete tileDataUncomp; + + // -------------------------------------------------------------------------------- + + // Loop through the mapping data to place the tiles on the screen + + uint16 *tIndex = &tileMap[0]; + for (int y = 0; y < tileCountY; y++) { + for (int x = 0; x < tileCountX; x++) { + int tileIndex = *tIndex++; + assert(tileIndex < tileCount); + TileSetIterator tile = tileSet.begin(); + for (i = 0; i < tileIndex; i++) + ++tile; + ((*tile).get())->copyTo(this, x * tileWidth, y * tileHeight); + } + } + tileSet.clear(); + _vm->_resources->toss(resourceName); +} + +void MSurfaceMADS::loadInterface(int index, RGBList **palData) { + char resourceName[20]; + sprintf(resourceName, "i%d.int", index); + MadsPack intFile(resourceName, _vm); + RGB8 *palette = new RGB8[16]; + + // Chunk 0, palette + Common::SeekableReadStream *intStream = intFile.getItemStream(0); + + for (int i = 0; i < 16; i++) { + palette[i].r = intStream->readByte() << 2; + palette[i].g = intStream->readByte() << 2; + palette[i].b = intStream->readByte() << 2; + intStream->readByte(); + intStream->readByte(); + intStream->readByte(); + } + *palData = new RGBList(16, palette, true); + delete intStream; + + // Chunk 1, data + intStream = intFile.getItemStream(1); + create(320, 44); + intStream->read(pixels, 320 * 44); + delete intStream; +} + +/*------------------------------------------------------------------------*/ + +void MSurfaceNebular::loadBackground(int roomNumber, RGBList **palData) { + // clear previous data + empty(); + + Common::String resourceName = Common::String::format("rm%d.art", roomNumber); + Common::SeekableReadStream *stream = _vm->_resources->get(resourceName); + loadBackgroundStream(stream, palData); + + _vm->_resources->toss(resourceName); +} + +void MSurfaceNebular::loadBackgroundStream(Common::SeekableReadStream *source, RGBList **palData) { + MadsPack packData(source); + Common::MemoryReadStream *sourceUnc = packData.getItemStream(0); + + int sceneWidth = sourceUnc->readUint16LE(); + int sceneHeight = sourceUnc->readUint16LE(); + int sceneSize = sceneWidth * sceneHeight; + if (sceneWidth > this->width()) { + warning("Background width is %i, too large to fit in screen. Setting it to %i", sceneWidth, this->width()); + sceneWidth = this->width(); + sceneSize = sceneWidth * sceneHeight; + } + if (sceneHeight > this->height()) { + warning("Background height is %i, too large to fit in screen.Setting it to %i", sceneHeight, this->height()); + sceneHeight = this->height(); + sceneSize = sceneWidth * sceneHeight; + } + + // Set palette + if (!palData) { + _vm->_palette->setMadsPalette(sourceUnc, 4); + } else { + int numColors; + RGB8 *rgbList = _vm->_palette->decodeMadsPalette(sourceUnc, &numColors); + *palData = new RGBList(numColors, rgbList, true); + } + delete sourceUnc; + + // Get the raw data for the background + sourceUnc = packData.getItemStream(1); + assert((int)sourceUnc->size() >= sceneSize); + + byte *pData = (byte *)pixels; + sourceUnc->read(pData, sceneSize); + + freeData(); + delete sourceUnc; +} + +/*------------------------------------------------------------------------*/ + +void MSurfaceM4::loadCodes(Common::SeekableReadStream *source) { + if (!source) { + free(); + return; + } + + uint16 widthVal = source->readUint16LE(); + uint16 heightVal = source->readUint16LE(); + + create(widthVal, heightVal); + source->read(pixels, widthVal * heightVal); +} + +void MSurfaceM4::loadBackground(int roomNumber, RGBList **palData) { + if (palData) + *palData = NULL; + Common::String resourceName = Common::String::format("%i.tt", roomNumber); + Common::SeekableReadStream *stream = _vm->_resources->get(resourceName); + loadBackgroundStream(stream); + + _vm->_resources->toss(resourceName); +} + +void MSurfaceM4::loadBackgroundStream(Common::SeekableReadStream *source) { + MSurface *tileBuffer = MSurface::init(); + uint curTileX = 0, curTileY = 0; + int clipX = 0, clipY = 0; + RGB8 palette[256]; + + source->skip(4); + /*uint32 size =*/ source->readUint32LE(); + uint32 widthVal = source->readUint32LE(); + uint32 heightVal = source->readUint32LE(); + uint32 tilesX = source->readUint32LE(); + uint32 tilesY = source->readUint32LE(); + uint32 tileWidth = source->readUint32LE(); + uint32 tileHeight = source->readUint32LE(); + uint8 blackIndex = 0; + + // BGR data, which is converted to RGB8 + for (uint i = 0; i < 256; i++) { + palette[i].b = source->readByte() << 2; + palette[i].g = source->readByte() << 2; + palette[i].r = source->readByte() << 2; + palette[i].u = source->readByte() << 2; + + if ((blackIndex == 0) && !palette[i].r && !palette[i].g && !palette[i].b) + blackIndex = i; + } + + _vm->_palette->setPalette(palette, 0, 256); + + // resize or create the surface + // Note that the height of the scene in game scenes is smaller than the screen height, + // as the bottom part of the screen is the inventory + assert(width() == (int)widthVal); + + tileBuffer->create(tileWidth, tileHeight); + + for (curTileY = 0; curTileY < tilesY; curTileY++) { + clipY = MIN(heightVal, (1 + curTileY) * tileHeight) - (curTileY * tileHeight); + + for (curTileX = 0; curTileX < tilesX; curTileX++) { + clipX = MIN(widthVal, (1 + curTileX) * tileWidth) - (curTileX * tileWidth); + + // Read a tile and copy it to the destination surface + source->read(tileBuffer->getData(), tileWidth * tileHeight); + Common::Rect srcBounds(0, 0, clipX, clipY); + copyFrom(tileBuffer, srcBounds, curTileX * tileWidth, curTileY * tileHeight); + } + } + + if (heightVal < (uint)height()) + fillRect(Common::Rect(0, heightVal, width(), height()), blackIndex); + + delete tileBuffer; +} + +/*------------------------------------------------------------------------*/ + +void MSurfaceRiddle::loadBackground(const Common::String &sceneName) { + char resourceName[20]; + Common::SeekableReadStream *stream; + // Loads a Riddle scene + Common::String resName = Common::String::format("%s.tt", sceneName.c_str()); + stream = _vm->_resources->get(resourceName); + + loadBackgroundStream(stream); + + _vm->_resources->toss(resourceName); +} + +} // End of namespace MADS diff --git a/engines/mads/msurface.h b/engines/mads/msurface.h new file mode 100644 index 0000000000..9bb651b02b --- /dev/null +++ b/engines/mads/msurface.h @@ -0,0 +1,185 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_MSURFACE_H +#define MADS_MSURFACE_H + +#include "common/scummsys.h" +#include "common/rect.h" +#include "graphics/surface.h" +#include "mads/palette.h" + +namespace MADS { + +class MADSEngine; +class MSprite; + +struct SpriteInfo { + MSprite *sprite; + int hotX, hotY; + int width, height; + int scaleX, scaleY; + uint8 encoding; + byte *inverseColorTable; + RGB8 *palette; +}; + +class MSurface : public Graphics::Surface { +public: + static MADSEngine *_vm; + + /** + * Sets the engine reference + */ + static void setVm(MADSEngine *vm) { _vm = vm; } + + /** + * Create a new surface the same size as the screen. + * @param isScreen Set to true for the screen surface + */ + static MSurface *init(bool isScreen = false); + + /** + * Create a surface + */ + static MSurface *init(int w, int h); +private: + byte _color; + bool _isScreen; +protected: + MSurface(bool isScreen = false); + MSurface(int w, int h); +public: + void create(int w, int h) { + Graphics::Surface::create(w, h, Graphics::PixelFormat::createFormatCLUT8()); + } + + void setColor(byte value) { _color = value; } + byte getColor() { return _color; } + void vLine(int x, int y1, int y2); + void hLine(int x1, int x2, int y); + void vLineXor(int x, int y1, int y2); + void hLineXor(int x1, int x2, int y); + void line(int x1, int y1, int x2, int y2, byte color); + void frameRect(int x1, int y1, int x2, int y2); + void fillRect(int x1, int y1, int x2, int y2); + + static int scaleValue(int value, int scale, int err); + void drawSprite(int x, int y, SpriteInfo &info, const Common::Rect &clipRect); + + // Surface methods + int width() { return w; } + int height() { return h; } + void setSize(int sizeX, int sizeY); + byte *getData(); + byte *getBasePtr(int x, int y); + void freeData(); + void empty(); + void frameRect(const Common::Rect &r, uint8 color); + void fillRect(const Common::Rect &r, uint8 color); + void copyFrom(MSurface *src, const Common::Rect &srcBounds, int destX, int destY, + int transparentColor = -1); + + void update() { + if (_isScreen) { + g_system->copyRectToScreen((const byte *)pixels, pitch, 0, 0, w, h); + g_system->updateScreen(); + } + } + + // copyTo methods + void copyTo(MSurface *dest, int transparentColor = -1) { + dest->copyFrom(this, Common::Rect(width(), height()), 0, 0, transparentColor); + } + void copyTo(MSurface *dest, int x, int y, int transparentColor = -1) { + dest->copyFrom(this, Common::Rect(width(), height()), x, y, transparentColor); + } + void copyTo(MSurface *dest, const Common::Rect &srcBounds, int destX, int destY, + int transparentColor = -1) { + dest->copyFrom(this, srcBounds, destX, destY, transparentColor); + } + + void translate(RGBList *list, bool isTransparent = false); + + // Base virtual methods + virtual void loadBackground(const Common::String &sceneName) {} + virtual void loadBackground(int roomNumber, RGBList **palData) = 0; + virtual void loadBackground(Common::SeekableReadStream *source, RGBList **palData) {} + virtual void loadCodes(Common::SeekableReadStream *source) = 0; + virtual void loadInterface(int index, RGBList **palData) {} +}; + +class MSurfaceMADS: public MSurface { + friend class MSurface; +protected: + MSurfaceMADS(bool isScreen = false): MSurface(isScreen) {} + MSurfaceMADS(int w, int h): MSurface(w, h) {} +public: + virtual void loadCodes(Common::SeekableReadStream *source); + virtual void loadBackground(const Common::String &sceneName) {} + virtual void loadBackground(int roomNumber, RGBList **palData); + virtual void loadInterface(int index, RGBList **palData); +}; + +class MSurfaceNebular: public MSurfaceMADS { + friend class MSurface; +protected: + MSurfaceNebular(bool isScreen = false): MSurfaceMADS(isScreen) {} + MSurfaceNebular(int w, int h): MSurfaceMADS(w, h) {} +private: + void loadBackgroundStream(Common::SeekableReadStream *source, RGBList **palData); +public: + virtual void loadBackground(int roomNumber, RGBList **palData); +}; + +class MSurfaceM4: public MSurface { + friend class MSurface; +protected: + MSurfaceM4(bool isScreen = false): MSurface(isScreen) {} + MSurfaceM4(int w, int h): MSurface(w, h) {} + + void loadBackgroundStream(Common::SeekableReadStream *source); +public: + virtual void loadCodes(Common::SeekableReadStream *source); + virtual void loadBackground(int roomNumber, RGBList **palData); +}; + +class MSurfaceRiddle: public MSurfaceM4 { + friend class MSurface; +protected: + MSurfaceRiddle(bool isScreen = false): MSurfaceM4(isScreen) {} + MSurfaceRiddle(int w, int h): MSurfaceM4(w, h) {} +public: + virtual void loadBackground(const Common::String &sceneName); +}; +/* + void rexLoadBackground(Common::SeekableReadStream *source, RGBList **palData = NULL); + void madsLoadBackground(int roomNumber, RGBList **palData = NULL); + void m4LoadBackground(Common::SeekableReadStream *source); + + void madsloadInterface(int index, RGBList **palData); + + */ + +} // End of namespace MADS + +#endif /* MADS_MSURFACE_H */ diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp new file mode 100644 index 0000000000..cfd8568407 --- /dev/null +++ b/engines/mads/palette.cpp @@ -0,0 +1,289 @@ +/* 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 "common/scummsys.h" +#include "engines/util.h" +#include "graphics/palette.h" +#include "mads/mads.h" +#include "mads/msurface.h" + +namespace MADS { + +RGBList::RGBList(int numEntries, RGB8 *srcData, bool freeData) { + _size = numEntries; + assert(numEntries <= 256); + + if (srcData == NULL) { + _data = new RGB8[numEntries]; + _freeData = true; + } else { + _data = srcData; + _freeData = freeData; + } + + _palIndexes = new byte[numEntries]; + Common::fill(&_palIndexes[0], &_palIndexes[numEntries], 0); +} + +RGBList::~RGBList() { + if (_freeData) + delete[] _data; + delete[] _palIndexes; +} + +/*------------------------------------------------------------------------*/ + +#define VGA_COLOR_TRANS(x) (x == 0x3f ? 255 : x << 2) + +Palette::Palette(MADSEngine *vm) : _vm(vm) { + reset(); + _fading_in_progress = false; + Common::fill(&_usageCount[0], &_usageCount[256], 0); +} + +void Palette::setPalette(const byte *colors, uint start, uint num) { + g_system->getPaletteManager()->setPalette(colors, start, num); + reset(); +} + +void Palette::setPalette(const RGB8 *colors, uint start, uint num) { + g_system->getPaletteManager()->setPalette((const byte *)colors, start, num); + reset(); +} + +void Palette::grabPalette(byte *colors, uint start, uint num) { + g_system->getPaletteManager()->grabPalette(colors, start, num); + reset(); +} + +uint8 Palette::palIndexFromRgb(byte r, byte g, byte b, RGB8 *paletteData) { + byte index = 0; + int32 minDist = 0x7fffffff; + RGB8 palData[256]; + int Rdiff, Gdiff, Bdiff; + + if (paletteData == NULL) { + g_system->getPaletteManager()->grabPalette((byte *)palData, 0, 256); + paletteData = &palData[0]; + } + + for (int palIndex = 0; palIndex < 256; ++palIndex) { + Rdiff = r - paletteData[palIndex].r; + Gdiff = g - paletteData[palIndex].g; + Bdiff = b - paletteData[palIndex].b; + + if (Rdiff * Rdiff + Gdiff * Gdiff + Bdiff * Bdiff < minDist) { + minDist = Rdiff * Rdiff + Gdiff * Gdiff + Bdiff * Bdiff; + index = (uint8)palIndex; + } + } + + return (uint8)index; +} + +void Palette::reset() { + RGB8 palData[256]; + g_system->getPaletteManager()->grabPalette((byte *)palData, 0, 256); + + BLACK = palIndexFromRgb(0, 0, 0, palData); + BLUE = palIndexFromRgb(0, 0, 255, palData); + GREEN = palIndexFromRgb(0, 255, 0, palData); + CYAN = palIndexFromRgb(0, 255, 255, palData); + RED = palIndexFromRgb(255, 0, 0, palData); + VIOLET = palIndexFromRgb(255, 0, 255, palData); + BROWN = palIndexFromRgb(168, 84, 84, palData); + LIGHT_GRAY = palIndexFromRgb(168, 168, 168, palData); + DARK_GRAY = palIndexFromRgb(84, 84, 84, palData); + LIGHT_BLUE = palIndexFromRgb(0, 0, 127, palData); + LIGHT_GREEN = palIndexFromRgb(0, 127, 0, palData); + LIGHT_CYAN = palIndexFromRgb(0, 127, 127, palData); + LIGHT_RED = palIndexFromRgb(84, 0, 0, palData); + PINK = palIndexFromRgb(84, 0, 0, palData); + YELLOW = palIndexFromRgb(0, 84, 84, palData); + WHITE = palIndexFromRgb(255, 255, 255, palData); +} + +void Palette::fadeIn(int numSteps, uint delayAmount, RGBList *destPalette) { + fadeIn(numSteps, delayAmount, destPalette->data(), destPalette->size()); +} + +void Palette::fadeIn(int numSteps, uint delayAmount, RGB8 *destPalette, int numColors) { + if (_fading_in_progress) + return; + + _fading_in_progress = true; + RGB8 blackPalette[256]; + Common::fill((byte *)&blackPalette[0], (byte *)&blackPalette[256], 0); + + // Initially set the black palette + _vm->_palette->setPalette(blackPalette, 0, numColors); + + // Handle the actual fading + fadeRange(blackPalette, destPalette, 0, numColors - 1, numSteps, delayAmount); + + _fading_in_progress = false; +} + +RGB8 *Palette::decodeMadsPalette(Common::SeekableReadStream *palStream, int *numColors) { + *numColors = palStream->readUint16LE(); + assert(*numColors <= 252); + + RGB8 *palData = new RGB8[*numColors]; + Common::fill((byte *)&palData[0], (byte *)&palData[*numColors], 0); + + for (int i = 0; i < *numColors; ++i) { + byte r = palStream->readByte(); + byte g = palStream->readByte(); + byte b = palStream->readByte(); + palData[i].r = VGA_COLOR_TRANS(r); + palData[i].g = VGA_COLOR_TRANS(g); + palData[i].b = VGA_COLOR_TRANS(b); + + // The next 3 bytes are unused + palStream->skip(3); + } + + return palData; +} + +int Palette::setMadsPalette(Common::SeekableReadStream *palStream, int indexStart) { + int colorCount; + RGB8 *palData = Palette::decodeMadsPalette(palStream, &colorCount); + _vm->_palette->setPalette(palData, indexStart, colorCount); + delete palData; + return colorCount; +} + +void Palette::setMadsSystemPalette() { + // Rex Nebular default system palette + resetColorCounts(); + + RGB8 palData[4]; + palData[0].r = palData[0].g = palData[0].b = 0; + palData[1].r = palData[1].g = palData[1].b = 0x54; + palData[2].r = palData[2].g = palData[2].b = 0xb4; + palData[3].r = palData[3].g = palData[3].b = 0xff; + + setPalette(palData, 0, 4); + blockRange(0, 4); +} + +void Palette::resetColorCounts() { + Common::fill(&_usageCount[0], &_usageCount[256], 0); +} + +void Palette::blockRange(int startIndex, int size) { + // Use a reference count of -1 to signal a palette index shouldn't be used + Common::fill(&_usageCount[startIndex], &_usageCount[startIndex + size], -1); +} + +void Palette::addRange(RGBList *list) { + RGB8 *data = list->data(); + byte *palIndexes = list->palIndexes(); + RGB8 palData[256]; + g_system->getPaletteManager()->grabPalette((byte *)&palData[0], 0, 256); + bool paletteChanged = false; + + for (int colIndex = 0; colIndex < list->size(); ++colIndex) { + // Scan through for an existing copy of the RGB value + int palIndex = -1; + while (++palIndex < 256) { + if (_usageCount[palIndex] <= 0) + // Palette index is to be skipped + continue; + + if ((palData[palIndex].r == data[colIndex].r) && + (palData[palIndex].g == data[colIndex].g) && + (palData[palIndex].b == data[colIndex].b)) + // Match found + break; + } + + if (palIndex == 256) { + // No match found, so find a free slot to use + palIndex = -1; + while (++palIndex < 256) { + if (_usageCount[palIndex] == 0) + break; + } + + if (palIndex == 256) + error("addRange - Ran out of palette space to allocate"); + + palData[palIndex].r = data[colIndex].r; + palData[palIndex].g = data[colIndex].g; + palData[palIndex].b = data[colIndex].b; + paletteChanged = true; + } + + palIndexes[colIndex] = palIndex; + ++_usageCount[palIndex]; + } + + if (paletteChanged) { + g_system->getPaletteManager()->setPalette((byte *)&palData[0], 0, 256); + reset(); + } +} + +void Palette::deleteRange(RGBList *list) { + // Release the reference count on each of the palette entries + for (int colIndex = 0; colIndex < list->size(); ++colIndex) { + int palIndex = list->palIndexes()[colIndex]; + assert(_usageCount[palIndex] > 0); + --_usageCount[palIndex]; + } +} + +void Palette::deleteAllRanges() { + for (int colIndex = 0; colIndex < 255; ++colIndex) + _usageCount[colIndex] = 0; +} + +void Palette::fadeRange(RGB8 *srcPal, RGB8 *destPal, int startIndex, int endIndex, + int numSteps, uint delayAmount) { + RGB8 tempPal[256]; + + // perform the fade + for(int stepCtr = 1; stepCtr <= numSteps; ++stepCtr) { + // Delay the specified amount + uint32 startTime = g_system->getMillis(); + while ((g_system->getMillis() - startTime) < delayAmount) { + _vm->_events->handleEvents(); + g_system->delayMillis(10); + } + + for (int i = startIndex; i <= endIndex; ++i) { + // Handle the intermediate rgb values for fading + tempPal[i].r = (byte) (srcPal[i].r + (destPal[i].r - srcPal[i].r) * stepCtr / numSteps); + tempPal[i].g = (byte) (srcPal[i].g + (destPal[i].g - srcPal[i].g) * stepCtr / numSteps); + tempPal[i].b = (byte) (srcPal[i].b + (destPal[i].b - srcPal[i].b) * stepCtr / numSteps); + } + + _vm->_palette->setPalette(&tempPal[startIndex], startIndex, endIndex - startIndex + 1); + } + + // Make sure the end palette exactly matches what is wanted + _vm->_palette->setPalette(&destPal[startIndex], startIndex, endIndex - startIndex + 1); +} + +} // End of namespace MADS diff --git a/engines/mads/palette.h b/engines/mads/palette.h new file mode 100644 index 0000000000..ab03d8d20b --- /dev/null +++ b/engines/mads/palette.h @@ -0,0 +1,110 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_PALETTE_H +#define MADS_PALETTE_H + +#include "common/scummsys.h" + +namespace MADS { + +class MADSEngine; + +struct RGB8 { + uint8 r, g, b, u; +}; + +class RGBList { +private: + int _size; + RGB8 *_data; + byte *_palIndexes; + bool _freeData; +public: + RGBList(int numEntries = 256, RGB8 *srcData = NULL, bool freeData = true); + ~RGBList(); + + RGB8 *data() { return _data; } + byte *palIndexes() { return _palIndexes; } + int size() { return _size; } +}; + +#define PALETTE_COUNT 256 + +class Palette { +private: + MADSEngine *_vm; + bool _colorsChanged; + bool _fading_in_progress; + byte _originalPalette[PALETTE_COUNT * 4]; + byte _fadedPalette[PALETTE_COUNT * 4]; + int _usageCount[PALETTE_COUNT]; + + void reset(); +public: + Palette(MADSEngine *vm); + + void setPalette(const byte *colors, uint start, uint num); + void setPalette(const RGB8 *colors, uint start, uint num); + void grabPalette(byte *colors, uint start, uint num); + void grabPalette(RGB8 *colors, uint start, uint num) { + grabPalette((byte *)colors, start, num); + } + uint8 palIndexFromRgb(byte r, byte g, byte b, RGB8 *paletteData = NULL); + + void fadeIn(int numSteps, uint delayAmount, RGB8 *destPalette, int numColors); + void fadeIn(int numSteps, uint delayAmount, RGBList *destPalette); + static RGB8 *decodeMadsPalette(Common::SeekableReadStream *palStream, int *numColors); + int setMadsPalette(Common::SeekableReadStream *palStream, int indexStart = 0); + void setMadsSystemPalette(); + void fadeRange(RGB8 *srcPal, RGB8 *destPal, int startIndex, int endIndex, + int numSteps, uint delayAmount); + + // Methods used for reference counting color usage + void resetColorCounts(); + void blockRange(int startIndex, int size); + void addRange(RGBList *list); + void deleteRange(RGBList *list); + void deleteAllRanges(); + + // Color indexes + uint8 BLACK; + uint8 BLUE; + uint8 GREEN; + uint8 CYAN; + uint8 RED; + uint8 VIOLET; + uint8 BROWN; + uint8 LIGHT_GRAY; + uint8 DARK_GRAY; + uint8 LIGHT_BLUE; + uint8 LIGHT_GREEN; + uint8 LIGHT_CYAN; + uint8 LIGHT_RED; + uint8 PINK; + uint8 YELLOW; + uint8 WHITE; +}; + +} // End of namespace MADS + +#endif /* MADS_PALETTE_H */ diff --git a/engines/mads/resources.cpp b/engines/mads/resources.cpp new file mode 100644 index 0000000000..27b94a9e55 --- /dev/null +++ b/engines/mads/resources.cpp @@ -0,0 +1,32 @@ +/* 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 "common/scummsys.h" +#include "mads/resources.h" + +namespace MADS { + +ResourcesManager::ResourcesManager(MADSEngine *vm) { + _vm = vm; +} + +} // End of namespace MADS diff --git a/engines/mads/resources.h b/engines/mads/resources.h new file mode 100644 index 0000000000..6eee0eac88 --- /dev/null +++ b/engines/mads/resources.h @@ -0,0 +1,57 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_RESOURCES_H +#define MADS_RESOURCES_H + +#include "common/scummsys.h" +#include "common/stream.h" + +namespace MADS { + +class MADSEngine; + +class ResourcesManager { +private: + MADSEngine *_vm; +public: + ResourcesManager(MADSEngine *vm); + + /** + * Return a named resource + */ + Common::SeekableReadStream *get(const Common::String &resourceName) { + // TODO + return nullptr; + } + + /** + * Release a previously loaded resource + */ + void toss(const Common::String &resourceName) { + // TODO + } +}; + +} // End of namespace MADS + +#endif /* MADS_RESOURCES_H */ diff --git a/engines/mads/sound.cpp b/engines/mads/sound.cpp index e3590f5ce7..46ba997198 100644 --- a/engines/mads/sound.cpp +++ b/engines/mads/sound.cpp @@ -27,7 +27,9 @@ namespace MADS { -SoundManager::SoundManager() { +SoundManager::SoundManager(MADSEngine *vm, Audio::Mixer *mixer) { + _vm = vm; + _mixer = mixer; _asound = nullptr; } @@ -35,11 +37,6 @@ SoundManager::~SoundManager() { delete _asound; } -void SoundManager::setVm(MADSEngine *vm, Audio::Mixer *mixer) { - _vm = vm; - _mixer = mixer; -} - void SoundManager::test() { _asound = new Nebular::ASound1(_mixer); _asound->command(5); diff --git a/engines/mads/sound.h b/engines/mads/sound.h index 20b56ec4a1..cbd6511518 100644 --- a/engines/mads/sound.h +++ b/engines/mads/sound.h @@ -38,10 +38,9 @@ private: Audio::Mixer *_mixer; Nebular::ASound *_asound; public: - SoundManager(); + SoundManager(MADSEngine *vm, Audio::Mixer *mixer); ~SoundManager(); - void setVm(MADSEngine *vm, Audio::Mixer *mixer); void test(); void poll(); }; diff --git a/engines/mads/sound_nebular.h b/engines/mads/sound_nebular.h index f9251c9329..11836e6559 100644 --- a/engines/mads/sound_nebular.h +++ b/engines/mads/sound_nebular.h @@ -33,10 +33,10 @@ namespace MADS { -namespace Nebular { - class SoundManager; +namespace Nebular { + /** * Represents the data for a channel on the Adlib */ -- cgit v1.2.3 From 530cbb4bc3406757ee3daeb3fc1972f79fd9199b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 18 Feb 2014 23:43:06 -0500 Subject: MADS: Adding in classes for fonts, game, user interfaec, and graphics --- engines/mads/compression.cpp | 5 +- engines/mads/font.cpp | 283 ++++++++++++++++++++++++++++++++++++++++ engines/mads/font.h | 106 +++++++++++++++ engines/mads/game.cpp | 39 ++++++ engines/mads/game.h | 46 +++++++ engines/mads/graphics.cpp | 30 +++++ engines/mads/graphics.h | 36 +++++ engines/mads/mads.cpp | 17 ++- engines/mads/mads.h | 4 + engines/mads/module.mk | 6 +- engines/mads/msurface.cpp | 13 +- engines/mads/resources.h | 7 +- engines/mads/user_interface.cpp | 43 ++++++ engines/mads/user_interface.h | 46 +++++++ 14 files changed, 668 insertions(+), 13 deletions(-) create mode 100644 engines/mads/font.cpp create mode 100644 engines/mads/font.h create mode 100644 engines/mads/game.cpp create mode 100644 engines/mads/game.h create mode 100644 engines/mads/graphics.cpp create mode 100644 engines/mads/graphics.h create mode 100644 engines/mads/user_interface.cpp create mode 100644 engines/mads/user_interface.h diff --git a/engines/mads/compression.cpp b/engines/mads/compression.cpp index f8df5a5e43..b5e24dfc5e 100644 --- a/engines/mads/compression.cpp +++ b/engines/mads/compression.cpp @@ -25,6 +25,8 @@ namespace MADS { const char *const madsPackString = "MADSPACK"; +const char *const FabInputExceededError = "FabDecompressor - Passed end of input buffer during decompression"; +const char *const FabOutputExceededError = "FabDecompressor - Decompressed data exceeded specified size"; bool MadsPack::isCompressed(Common::SeekableReadStream *stream) { // Check whether the passed stream is packed @@ -94,9 +96,6 @@ MadsPack::~MadsPack() { //-------------------------------------------------------------------------- -const char *FabInputExceededError = "FabDecompressor - Passed end of input buffer during decompression"; -const char *FabOutputExceededError = "FabDecompressor - Decompressed data exceeded specified size"; - void FabDecompressor::decompress(const byte *srcData, int srcSize, byte *destData, int destSize) { byte copyLen, copyOfsShift, copyOfsMask, copyLenMask; unsigned long copyOfs; diff --git a/engines/mads/font.cpp b/engines/mads/font.cpp new file mode 100644 index 0000000000..b7400ed337 --- /dev/null +++ b/engines/mads/font.cpp @@ -0,0 +1,283 @@ +/* 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 "common/scummsys.h" +#include "mads/mads.h" +#include "mads/compression.h" +#include "mads/font.h" +#include "mads/msurface.h" + +namespace MADS { + +Font *Font::init(MADSEngine *vm) { + if (vm->getGameFeatures() & GF_MADS) { + return new FontMADS(vm); + } else { + return new FontM4(vm); + } +} + +Font::Font(MADSEngine *vm) : _vm(vm) { + _sysFont = true; + + _fontColors[0] = _vm->_palette->BLACK; + _fontColors[1] = _vm->_palette->WHITE; + _fontColors[2] = _vm->_palette->BLACK; + _fontColors[3] = _vm->_palette->DARK_GRAY; +} + +Font::~Font() { + if (!_sysFont) { + delete[] _charWidths; + delete[] _charOffs; + delete[] _charData; + } +} + +void Font::setColor(uint8 color) { + if (_sysFont) + _fontColors[1] = color; + else + _fontColors[3] = color; +} + +void Font::setColors(uint8 alt1, uint8 alt2, uint8 foreground) { + if (_sysFont) + _fontColors[1] = foreground; + else { + _fontColors[1] = alt1; + _fontColors[2] = alt2; + _fontColors[3] = foreground; + } +} + +int Font::write(MSurface *surface, const Common::String &msg, const Common::Point &pt, int width, int spaceWidth, uint8 colors[]) { + + /*TODO + if (custom_ascii_converter) { // if there is a function to convert the extended ASCII characters + custom_ascii_converter(out_string); // call it with the string + } + */ + + if (width > 0) + width = MIN(surface->width(), pt.x + width); + else + width = surface->width(); + + int x = pt.x + 1; + int y = pt.y + 1; + + int skipY = 0; + if (y < 0) { + skipY = -y; + y = 0; + } + + int height = MAX(0, _maxHeight - skipY); + if (height == 0) + return x; + + int bottom = y + height - 1; + if (bottom > surface->height() - 1) { + height -= MIN(height, bottom - (surface->height() - 1)); + } + + if (height <= 0) + return x; + + byte *destPtr = surface->getBasePtr(x, y); + uint8 *oldDestPtr = destPtr; + + int xPos = x; + + const char *text = msg.c_str(); + while (*text) { + char theChar = (*text++) & 0x7F; + int charWidth = _charWidths[theChar]; + + if (charWidth > 0) { + + if (xPos + charWidth >= width) + return xPos; + + uint8 *charData = &_charData[_charOffs[theChar]]; + int bpp = getBpp(charWidth); + + if (skipY != 0) + charData += bpp * skipY; + + for (int i = 0; i < height; i++) { + for (int j = 0; j < bpp; j++) { + if (*charData & 0xc0) + *destPtr = colors[(*charData & 0xc0) >> 6]; + destPtr++; + if (*charData & 0x30) + *destPtr = colors[(*charData & 0x30) >> 4]; + destPtr++; + if (*charData & 0x0C) + *destPtr = colors[(*charData & 0x0C) >> 2]; + destPtr++; + if (*charData & 0x03) + *destPtr = colors[*charData & 0x03]; + destPtr++; + charData++; + } + + destPtr += surface->width() - bpp * 4; + + } + + destPtr = oldDestPtr + charWidth + spaceWidth; + oldDestPtr = destPtr; + + } + + xPos += charWidth + spaceWidth; + + } + + surface->freeData(); + return xPos; + +} + +int Font::getWidth(const Common::String &msg, int spaceWidth) { + /* + if (custom_ascii_converter) { // if there is a function to convert the extended ASCII characters + custom_ascii_converter(out_string); // call it with the string + } + */ + int width = 0; + const char *text = msg.c_str(); + + while (*text) + width += _charWidths[*text++ & 0x7F] + spaceWidth; + return width; +} + +/*------------------------------------------------------------------------*/ + +void FontMADS::setFont(const Common::String &filename) { + if (!_filename.empty() && (filename == _filename)) + // Already using specified font, so don't bother reloading + return; + + _sysFont = false; + _filename = filename; + + MadsPack fontData(filename, _vm); + Common::SeekableReadStream *fontFile = fontData.getItemStream(0); + + _maxHeight = fontFile->readByte(); + _maxWidth = fontFile->readByte(); + + _charWidths = new uint8[128]; + // Char data is shifted by 1 + _charWidths[0] = 0; + fontFile->read(_charWidths + 1, 127); + fontFile->readByte(); // remainder + + _charOffs = new uint16[128]; + + uint startOffs = 2 + 128 + 256; + uint fontSize = fontFile->size() - startOffs; + + // Char data is shifted by 1 + _charOffs[0] = 0; + for (int i = 1; i < 128; i++) + _charOffs[i] = fontFile->readUint16LE() - startOffs; + fontFile->readUint16LE(); // remainder + + _charData = new uint8[fontSize]; + fontFile->read(_charData, fontSize); + + delete fontFile; +} + +int FontMADS::getBpp(int charWidth) { + if (charWidth > 12) + return 4; + else if (charWidth > 8) + return 3; + else if (charWidth > 4) + return 2; + else + return 1; +} + +/*------------------------------------------------------------------------*/ + +void FontM4::setFont(const Common::String &filename) { + if (!_filename.empty() && (filename == _filename)) + // Already using specified font, so don't bother reloading + return; + + _sysFont = false; + _filename = filename; + + Common::SeekableReadStream *fontFile = _vm->_resources->openFile(filename); + + if (fontFile->readUint32LE() != MKTAG('F', 'O', 'N', 'T')) { + warning("Font: FONT tag expected"); + return; + } + + _maxHeight = fontFile->readByte(); + _maxWidth = fontFile->readByte(); + uint fontSize = fontFile->readUint32LE(); + + //printf("Font::Font: _maxWidth = %d, _maxHeight = %d, fontSize = %d\n", _maxWidth, _maxHeight, fontSize); + + if (fontFile->readUint32LE() != MKTAG('W', 'I', 'D', 'T')) { + warning("Font: WIDT tag expected"); + return; + } + + _charWidths = new uint8[256]; + fontFile->read(_charWidths, 256); + + if (fontFile->readUint32LE() != MKTAG('O', 'F', 'F', 'S')) { + warning("Font: OFFS tag expected\n"); + return; + } + + _charOffs = new uint16[256]; + + for (int i = 0; i < 256; i++) + _charOffs[i] = fontFile->readUint16LE(); + + if (fontFile->readUint32LE() != MKTAG('P', 'I', 'X', 'S')) { + warning("Font: PIXS tag expected\n"); + return; + } + + _charData = new uint8[fontSize]; + fontFile->read(_charData, fontSize); + + _vm->_resources->toss(filename); +} + +int FontM4::getBpp(int charWidth) { + return charWidth / 4 + 1; +} + +} // End of namespace MADS diff --git a/engines/mads/font.h b/engines/mads/font.h new file mode 100644 index 0000000000..d36be80830 --- /dev/null +++ b/engines/mads/font.h @@ -0,0 +1,106 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_FONT_H +#define MADS_FONT_H + +#include "common/scummsys.h" +#include "common/util.h" +#include "common/endian.h" +#include "mads/msurface.h" + +namespace MADS { + +#define FONT_MENU "fontmenu.fnt" +#define FONT_INTERFACE "fontintr.fnt" +#define FONT_TINY "small.fnt" +#define FONT_SMALL "small.fnt" +#define FONT_MEDIUM "medium.fnt" +#define FONT_LINE "fontline.fnt" +#define FONT_CONVERSATION "fontconv.fnt" +#define FONT_4X6 "4x6pp.fnt" +#define FONT_5X6 "5x6pp.fnt" + +#define FONT_CONVERSATION_MADS "fontconv.ff" +#define FONT_INTERFACE_MADS "fontintr.ff" +#define FONT_MAIN_MADS "fontmain.ff" +#define FONT_MENU_MADS "fontmenu.ff" // Not in Rex (uses bitmap files for menu strings) +#define FONT_MISC_MADS "fontmisc.ff" +#define FONT_TELE_MADS "fonttele.ff" // Not in Phantom +#define FONT_PHAN_MADS "fontphan.ff" // Phantom only + +class MADSEngine; + +class Font { +protected: + MADSEngine *_vm; + + uint8 _maxWidth, _maxHeight; + uint8 *_charWidths; + uint16 *_charOffs; + uint8 *_charData; + bool _sysFont; + Common::String _filename; + uint8 _fontColors[4]; + +protected: + Font(MADSEngine *vm); + + virtual void setFont(const Common::String &filename) = 0; + virtual int getBpp(int charWidth) = 0; +public: + static Font *init(MADSEngine *vm); +public: + virtual ~Font(); + + void setColor(uint8 color); + void setColors(uint8 alt1, uint8 alt2, uint8 foreground); + + int getWidth(const Common::String &msg, int spaceWidth = -1); + int getHeight() const { return _maxHeight; } + int write(MSurface *surface, const Common::String &msg, const Common::Point &pt, int width, int spaceWidth, uint8 colors[]); + int writeString(MSurface *surface, const Common::String &msg, const Common::Point &pt, int width = 0, int spaceWidth = -1) { + return write(surface, msg, pt, width, spaceWidth, _fontColors); + } +}; + +class FontMADS: public Font { + friend class Font; +protected: + virtual void setFont(const Common::String &filename); + virtual int getBpp(int charWidth); + + FontMADS(MADSEngine *vm): Font(vm) {} +}; + +class FontM4: public Font { + friend class Font; +protected: + virtual void setFont(const Common::String &filename); + virtual int getBpp(int charWidth); + + FontM4(MADSEngine *vm): Font(vm) {} +}; + +} // End of namespace MADS + +#endif /* MADS_FONT_H */ diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp new file mode 100644 index 0000000000..491117f977 --- /dev/null +++ b/engines/mads/game.cpp @@ -0,0 +1,39 @@ +/* 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 "common/scummsys.h" +#include "mads/mads.h" +#include "mads/game.h" +#include "mads/graphics.h" +#include "mads/msurface.h" + +namespace MADS { + +Game *Game::init(MADSEngine *vm) { + return new Game(vm); +} + +Game::Game(MADSEngine *vm): _vm(vm), _surface(MSurface::init( + MADS_SCREEN_WIDTH, MADS_SCREEN_HEIGHT - MADS_INTERFACE_HEIGHT)) { +} + +} // End of namespace MADS diff --git a/engines/mads/game.h b/engines/mads/game.h new file mode 100644 index 0000000000..190dc883d2 --- /dev/null +++ b/engines/mads/game.h @@ -0,0 +1,46 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_GAME_H +#define MADS_GAME_H + +#include "common/scummsys.h" + +namespace MADS { + +class MADSEngine; + +class Game { +private: + MADSEngine *_vm; + MSurface *_surface; + + Game(MADSEngine *vm); +public: + static Game *init(MADSEngine *vm); +public: + ~Game(); +}; + +} // End of namespace MADS + +#endif /* MADS_GAME_H */ diff --git a/engines/mads/graphics.cpp b/engines/mads/graphics.cpp new file mode 100644 index 0000000000..267785b76b --- /dev/null +++ b/engines/mads/graphics.cpp @@ -0,0 +1,30 @@ +/* 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 "common/scummsys.h" +#include "mads/mads.h" +#include "mads/graphics.h" + +namespace MADS { + + +} // End of namespace MADS diff --git a/engines/mads/graphics.h b/engines/mads/graphics.h new file mode 100644 index 0000000000..87cd8be3c9 --- /dev/null +++ b/engines/mads/graphics.h @@ -0,0 +1,36 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_GRAPHICS_H +#define MADS_GRAPHICS_H + +#include "common/scummsys.h" + +namespace MADS { + +#define MADS_SCREEN_WIDTH 320 +#define MADS_SCREEN_HEIGHT 200 +#define MADS_INTERFACE_HEIGHT 44 + +} // End of namespace MADS + +#endif /* MADS_GRAPHICS_H */ diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index 9998bc02e9..0ddb6bf401 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -26,6 +26,7 @@ #include "common/events.h" #include "engines/util.h" #include "mads/mads.h" +#include "mads/graphics.h" #include "mads/resources.h" #include "mads/sound.h" #include "mads/msurface.h" @@ -40,17 +41,24 @@ MADSEngine::MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc) : _easyMouse = true; _invObjectStill = false; _textWindowStill = false; + + _events = nullptr; + _font = nullptr; _palette = nullptr; _resources = nullptr; _screen = nullptr; _sound = nullptr; + _userInterface = nullptr; } MADSEngine::~MADSEngine() { delete _events; + delete _font; + delete _palette; delete _resources; delete _screen; delete _sound; + delete _userInterface; } void MADSEngine::initialise() { @@ -63,13 +71,18 @@ void MADSEngine::initialise() { MSprite::setVm(this); _events = new EventsManager(this); + _palette = new Palette(this); + _font = Font::init(this); _resources = new ResourcesManager(this); - _screen = MSurface::init(); + _screen = MSurface::init(true); _sound = new SoundManager(this, _mixer); + _userInterface = UserInterface::init(this); + + _screen->empty(); } Common::Error MADSEngine::run() { - initGraphics(320, 200, false); + initGraphics(MADS_SCREEN_WIDTH, MADS_SCREEN_HEIGHT, false); initialise(); Common::Event e; diff --git a/engines/mads/mads.h b/engines/mads/mads.h index 8ca181ea02..86a5499e62 100644 --- a/engines/mads/mads.h +++ b/engines/mads/mads.h @@ -31,9 +31,11 @@ #include "engines/engine.h" #include "graphics/surface.h" #include "mads/events.h" +#include "mads/font.h" #include "mads/msurface.h" #include "mads/resources.h" #include "mads/sound.h" +#include "mads/user_interface.h" /** * This is the namespace of the MADS engine. @@ -88,10 +90,12 @@ protected: virtual bool hasFeature(EngineFeature f) const; public: EventsManager *_events; + Font *_font; Palette *_palette; ResourcesManager *_resources; MSurface *_screen; SoundManager *_sound; + UserInterface *_userInterface; public: MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc); diff --git a/engines/mads/module.mk b/engines/mads/module.mk index 7ac919f246..d2ae9ea4cf 100644 --- a/engines/mads/module.mk +++ b/engines/mads/module.mk @@ -4,6 +4,9 @@ MODULE_OBJS := \ compression.o \ detection.o \ events.o \ + font.o \ + game.o \ + graphics.o \ mads.o \ msprite.o \ msurface.o \ @@ -11,7 +14,8 @@ MODULE_OBJS := \ resources.o \ sound.o \ sound_nebular.o \ - sprite.o + sprite.o \ + user_interface.o # This module can be built as a plugin ifeq ($(ENABLE_MADS), DYNAMIC_PLUGIN) diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp index 810f9326f7..eca3f76ad9 100644 --- a/engines/mads/msurface.cpp +++ b/engines/mads/msurface.cpp @@ -21,10 +21,11 @@ */ #include "engines/util.h" -#include "mads/mads.h" #include "mads/compression.h" -#include "mads/msurface.h" +#include "mads/graphics.h" +#include "mads/mads.h" #include "mads/msprite.h" +#include "mads/msurface.h" namespace MADS { @@ -370,8 +371,8 @@ void MSurfaceMADS::loadCodes(Common::SeekableReadStream *source) { return; } - uint16 widthVal = 320; - uint16 heightVal = 156; + uint16 widthVal = MADS_SCREEN_WIDTH; + uint16 heightVal = MADS_SCREEN_HEIGHT - MADS_INTERFACE_HEIGHT; byte *walkMap = new byte[source->size()]; create(widthVal, heightVal); @@ -536,8 +537,8 @@ void MSurfaceMADS::loadInterface(int index, RGBList **palData) { // Chunk 1, data intStream = intFile.getItemStream(1); - create(320, 44); - intStream->read(pixels, 320 * 44); + create(MADS_SCREEN_WIDTH, MADS_INTERFACE_HEIGHT); + intStream->read(pixels, MADS_SCREEN_WIDTH * MADS_INTERFACE_HEIGHT); delete intStream; } diff --git a/engines/mads/resources.h b/engines/mads/resources.h index 6eee0eac88..68bb475aee 100644 --- a/engines/mads/resources.h +++ b/engines/mads/resources.h @@ -25,6 +25,7 @@ #include "common/scummsys.h" #include "common/stream.h" +#include "common/str.h" namespace MADS { @@ -39,11 +40,15 @@ public: /** * Return a named resource */ - Common::SeekableReadStream *get(const Common::String &resourceName) { + Common::SeekableReadStream *get(const Common::String &resourceName, bool loadFlag = false) { // TODO return nullptr; } + Common::SeekableReadStream *openFile(const Common::String &resourceName) { + return get(resourceName, false); + } + /** * Release a previously loaded resource */ diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp new file mode 100644 index 0000000000..2af134a8ee --- /dev/null +++ b/engines/mads/user_interface.cpp @@ -0,0 +1,43 @@ +/* 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 "common/scummsys.h" +#include "mads/mads.h" +#include "mads/graphics.h" +#include "mads/user_interface.h" +#include "mads/msurface.h" + +namespace MADS { + +UserInterface *UserInterface::init(MADSEngine *vm) { + return new UserInterface(vm); +} + +UserInterface::UserInterface(MADSEngine *vm): _vm(vm), _surface( + MSurface::init(MADS_SCREEN_WIDTH, MADS_INTERFACE_HEIGHT)) { +} + +UserInterface::~UserInterface() { + delete _surface; +} + +} // End of namespace MADS diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h new file mode 100644 index 0000000000..838638ba0b --- /dev/null +++ b/engines/mads/user_interface.h @@ -0,0 +1,46 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_USER_INTERFACE_H +#define MADS_USER_INTERFACE_H + +#include "common/scummsys.h" + +namespace MADS { + +class MADSEngine; + +class UserInterface { +private: + MADSEngine *_vm; + MSurface *_surface; + + UserInterface(MADSEngine *vm); +public: + static UserInterface *init(MADSEngine *vm); +public: + ~UserInterface(); +}; + +} // End of namespace MADS + +#endif /* MADS_USER_INTERFACE_H */ -- cgit v1.2.3 From 97087e8cd1aee602217c36f1c71d4ca3f74e0e40 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 18 Feb 2014 23:56:41 -0500 Subject: MADS: Fix warnings identified by gcc --- engines/mads/module.mk | 1 - engines/mads/msurface.h | 14 ++++---------- engines/mads/sound_nebular.cpp | 8 ++++---- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/engines/mads/module.mk b/engines/mads/module.mk index d2ae9ea4cf..401b909ac8 100644 --- a/engines/mads/module.mk +++ b/engines/mads/module.mk @@ -14,7 +14,6 @@ MODULE_OBJS := \ resources.o \ sound.o \ sound_nebular.o \ - sprite.o \ user_interface.o # This module can be built as a plugin diff --git a/engines/mads/msurface.h b/engines/mads/msurface.h index 9bb651b02b..21b0cbcd2f 100644 --- a/engines/mads/msurface.h +++ b/engines/mads/msurface.h @@ -69,6 +69,8 @@ protected: MSurface(bool isScreen = false); MSurface(int w, int h); public: + virtual ~MSurface() {} + void create(int w, int h) { Graphics::Surface::create(w, h, Graphics::PixelFormat::createFormatCLUT8()); } @@ -155,7 +157,7 @@ class MSurfaceM4: public MSurface { friend class MSurface; protected: MSurfaceM4(bool isScreen = false): MSurface(isScreen) {} - MSurfaceM4(int w, int h): MSurface(w, h) {} + MSurfaceM4(int widthVal, int heightVal): MSurface(widthVal, heightVal) {} void loadBackgroundStream(Common::SeekableReadStream *source); public: @@ -167,18 +169,10 @@ class MSurfaceRiddle: public MSurfaceM4 { friend class MSurface; protected: MSurfaceRiddle(bool isScreen = false): MSurfaceM4(isScreen) {} - MSurfaceRiddle(int w, int h): MSurfaceM4(w, h) {} + MSurfaceRiddle(int widthVal, int heightVal): MSurfaceM4(widthVal, heightVal) {} public: virtual void loadBackground(const Common::String &sceneName); }; -/* - void rexLoadBackground(Common::SeekableReadStream *source, RGBList **palData = NULL); - void madsLoadBackground(int roomNumber, RGBList **palData = NULL); - void m4LoadBackground(Common::SeekableReadStream *source); - - void madsloadInterface(int index, RGBList **palData); - - */ } // End of namespace MADS diff --git a/engines/mads/sound_nebular.cpp b/engines/mads/sound_nebular.cpp index 146a620261..7c1410c24c 100644 --- a/engines/mads/sound_nebular.cpp +++ b/engines/mads/sound_nebular.cpp @@ -234,11 +234,11 @@ void ASound::noise() { int randomVal = getRandomNumber(); if (_v1) { - setFrequency(_channelNum1, (randomVal ^ 0xFFFF) & _freqMask1 + _freqBase1); + setFrequency(_channelNum1, ((randomVal ^ 0xFFFF) & _freqMask1) + _freqBase1); } if (_v2) { - setFrequency(_channelNum2, randomVal & _freqMask2 + _freqBase2); + setFrequency(_channelNum2, (randomVal & _freqMask2) + _freqBase2); } } @@ -731,7 +731,7 @@ void ASound::loadSample(int sampleIndex) { void ASound::processSample() { // Write out vib flags and split point write2(8, 0x40 + _v11, 0x3F); - int depthRhythm = _ports[0xBD] & 0x3F | (_amDep ? 0x80 : 0) | + int depthRhythm = (_ports[0xBD] & 0x3F) | (_amDep ? 0x80 : 0) | (_vibDep ? 0x40 : 0); write2(8, 0xBD, depthRhythm); write2(8, 8, _splitPoint ? 0x40 : 0); @@ -758,7 +758,7 @@ void ASound::processSample() { write2(8, 0xE0 + _v11, _samplePtr->_waveformSelect & 3); // Write out total level & scaling level - val = -(_samplePtr->_totalLevel & 0x3F - 0x3F) | (_samplePtr->_scalingLevel << 6); + val = -((_samplePtr->_totalLevel & 0x3F) - 0x3F) | (_samplePtr->_scalingLevel << 6); write2(8, 0x40 + _v11, val); } -- cgit v1.2.3 From 5c565797e5516de97686650be8cc810007111641 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 19 Feb 2014 20:22:06 -0500 Subject: MADS: Extra cleanup and commenting for MSurface methods --- engines/mads/font.cpp | 11 ++- engines/mads/msurface.cpp | 126 +++++++++++++------------------ engines/mads/msurface.h | 186 ++++++++++++++++++++++++++++++++++++++-------- 3 files changed, 213 insertions(+), 110 deletions(-) diff --git a/engines/mads/font.cpp b/engines/mads/font.cpp index b7400ed337..9da46c30b1 100644 --- a/engines/mads/font.cpp +++ b/engines/mads/font.cpp @@ -79,9 +79,9 @@ int Font::write(MSurface *surface, const Common::String &msg, const Common::Poin */ if (width > 0) - width = MIN(surface->width(), pt.x + width); + width = MIN(surface->getWidth(), pt.x + width); else - width = surface->width(); + width = surface->getWidth(); int x = pt.x + 1; int y = pt.y + 1; @@ -97,8 +97,8 @@ int Font::write(MSurface *surface, const Common::String &msg, const Common::Poin return x; int bottom = y + height - 1; - if (bottom > surface->height() - 1) { - height -= MIN(height, bottom - (surface->height() - 1)); + if (bottom > surface->getHeight() - 1) { + height -= MIN(height, bottom - (surface->getHeight() - 1)); } if (height <= 0) @@ -142,7 +142,7 @@ int Font::write(MSurface *surface, const Common::String &msg, const Common::Poin charData++; } - destPtr += surface->width() - bpp * 4; + destPtr += surface->getWidth() - bpp * 4; } @@ -155,7 +155,6 @@ int Font::write(MSurface *surface, const Common::String &msg, const Common::Poin } - surface->freeData(); return xPos; } diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp index eca3f76ad9..b3a4510793 100644 --- a/engines/mads/msurface.cpp +++ b/engines/mads/msurface.cpp @@ -41,23 +41,23 @@ MSurface *MSurface::init(bool isScreen) { } } -MSurface *MSurface::init(int w, int h) { +MSurface *MSurface::init(int width, int height) { if (_vm->getGameID() == GType_RexNebular) { - return new MSurfaceNebular(w, h); + return new MSurfaceNebular(width, height); } else if (_vm->getGameFeatures() & GF_MADS) { - return new MSurfaceMADS(w, h); + return new MSurfaceMADS(width, height); } else { - return new MSurfaceM4(w, h); + return new MSurfaceM4(width, height); } } MSurface::MSurface(bool isScreen) { - create(g_system->getWidth(), g_system->getHeight()); + setSize(g_system->getWidth(), g_system->getHeight()); _isScreen = isScreen; } -MSurface::MSurface(int Width, int Height) { - create(Width, Height); +MSurface::MSurface(int width, int height) { + setSize(width, height); _isScreen = false; } @@ -137,7 +137,7 @@ int MSurface::scaleValue(int value, int scale, int err) { return scaled; } -void MSurface::drawSprite(int x, int y, SpriteInfo &info, const Common::Rect &clipRect) { +void MSurface::drawSprite(const Common::Point &pt, SpriteInfo &info, const Common::Rect &clipRect) { enum { kStatusSkip, @@ -155,11 +155,7 @@ void MSurface::drawSprite(int x, int y, SpriteInfo &info, const Common::Rect &cl int scaledWidth = scaleValue(info.width, info.scaleX, errX); int scaledHeight = scaleValue(info.height, info.scaleY, errY); - /* - printf("MSurface::drawSprite() info.width = %d; info.scaleX = %d; info.height = %d; info.scaleY = %d; scaledWidth = %d; scaledHeight = %d\n", - info.width, info.scaleX, info.height, info.scaleY, scaledWidth, scaledHeight); fflush(stdout); - */ - + int x = pt.x, y = pt.y; int clipX = 0, clipY = 0; // Clip the sprite's width and height according to the clip rectangle's dimensions // This clips the sprite to the bottom and right @@ -176,8 +172,6 @@ void MSurface::drawSprite(int x, int y, SpriteInfo &info, const Common::Rect &cl scaledHeight = y + scaledHeight; } - //printf("MSurface::drawSprite() width = %d; height = %d; scaledWidth = %d; scaledHeight = %d\n", info.width, info.height, scaledWidth, scaledHeight); fflush(stdout); - // Check if sprite is inside the screen. If it's not, there's no need to draw it if (scaledWidth + x <= 0 || scaledHeight + y <= 0) // check left and top (in case x,y are negative) return; @@ -206,16 +200,16 @@ void MSurface::drawSprite(int x, int y, SpriteInfo &info, const Common::Rect &cl // Scale current line byte *lineDst = scaledLineBuf; int curErrX = errX; - int widthVal = scaledWidth; + int width = scaledWidth; byte *tempSrc = src; int startX = clipX; - while (widthVal > 0) { + while (width > 0) { byte pixel = *tempSrc++; curErrX -= info.scaleX; while (curErrX < 0) { if (startX == 0) { *lineDst++ = pixel; - widthVal--; + width--; } else { startX++; } @@ -276,19 +270,6 @@ void MSurface::drawSprite(int x, int y, SpriteInfo &info, const Common::Rect &cl } -// Surface methods - -byte *MSurface::getData() { - return (byte *)Graphics::Surface::getPixels(); -} - -byte *MSurface::getBasePtr(int x, int y) { - return (byte *)Graphics::Surface::getBasePtr(x, y); -} - -void MSurface::freeData() { -} - void MSurface::empty() { Common::fill(getBasePtr(0, 0), getBasePtr(w, h), _vm->_palette->BLACK); } @@ -301,9 +282,10 @@ void MSurface::fillRect(const Common::Rect &r, uint8 color) { Graphics::Surface::fillRect(r, color); } -void MSurface::copyFrom(MSurface *src, const Common::Rect &srcBounds, int destX, int destY, - int transparentColor) { - // Validation of the rectangle and position +void MSurface::copyFrom(MSurface *src, const Common::Rect &srcBounds, + const Common::Point &destPos, int transparentColor) { + // Validation of the rectangle and position + int destX = destPos.x, destY = destPos.y; if ((destX >= w) || (destY >= h)) return; @@ -327,8 +309,8 @@ void MSurface::copyFrom(MSurface *src, const Common::Rect &srcBounds, int destX, // Copy the specified area byte *data = src->getData(); - byte *srcPtr = data + (src->width() * copyRect.top + copyRect.left); - byte *destPtr = (byte *)pixels + (destY * width()) + destX; + byte *srcPtr = data + (src->getWidth() * copyRect.top + copyRect.left); + byte *destPtr = (byte *)pixels + (destY * getWidth()) + destX; for (int rowCtr = 0; rowCtr < copyRect.height(); ++rowCtr) { if (transparentColor == -1) @@ -340,27 +322,21 @@ void MSurface::copyFrom(MSurface *src, const Common::Rect &srcBounds, int destX, if (srcPtr[xCtr] != transparentColor) destPtr[xCtr] = srcPtr[xCtr]; } - srcPtr += src->width(); - destPtr += width(); + srcPtr += src->getWidth(); + destPtr += getWidth(); } - - src->freeData(); } -#undef COL_TRANS - void MSurface::translate(RGBList *list, bool isTransparent) { byte *p = getBasePtr(0, 0); byte *palIndexes = list->palIndexes(); - for (int i = 0; i < width() * height(); ++i, ++p) { + for (int i = 0; i < getWidth() * getHeight(); ++i, ++p) { if (!isTransparent || (*p != 0)) { assert(*p < list->size()); *p = palIndexes[*p]; } } - - freeData(); } /*------------------------------------------------------------------------*/ @@ -371,18 +347,18 @@ void MSurfaceMADS::loadCodes(Common::SeekableReadStream *source) { return; } - uint16 widthVal = MADS_SCREEN_WIDTH; - uint16 heightVal = MADS_SCREEN_HEIGHT - MADS_INTERFACE_HEIGHT; + uint16 width = MADS_SCREEN_WIDTH; + uint16 height = MADS_SCREEN_HEIGHT - MADS_INTERFACE_HEIGHT; byte *walkMap = new byte[source->size()]; - create(widthVal, heightVal); + setSize(width, height); source->read(walkMap, source->size()); byte *ptr = (byte *)getBasePtr(0, 0); - for (int y = 0; y < heightVal; y++) { - for (int x = 0; x < widthVal; x++) { - int ofs = x + (y * widthVal); + for (int y = 0; y < height; y++) { + for (int x = 0; x < width; x++) { + int ofs = x + (y * width); if ((walkMap[ofs / 8] << (ofs % 8)) & 0x80) *ptr++ = 1; // walkable else @@ -444,8 +420,8 @@ void MSurfaceMADS::loadBackground(int roomNumber, RGBList **palData) { assert(tileCountMap == tileCount); assert(tileWidth == tileWidthMap); assert(tileHeight == tileHeightMap); - assert(screenWidth == _vm->_screen->width()); - assert(screenHeight <= _vm->_screen->height()); + assert(screenWidth == _vm->_screen->getWidth()); + assert(screenHeight <= _vm->_screen->getHeight()); // -------------------------------------------------------------------------------- @@ -508,7 +484,7 @@ void MSurfaceMADS::loadBackground(int roomNumber, RGBList **palData) { TileSetIterator tile = tileSet.begin(); for (i = 0; i < tileIndex; i++) ++tile; - ((*tile).get())->copyTo(this, x * tileWidth, y * tileHeight); + ((*tile).get())->copyTo(this, Common::Point(x * tileWidth, y * tileHeight)); } } tileSet.clear(); @@ -537,7 +513,7 @@ void MSurfaceMADS::loadInterface(int index, RGBList **palData) { // Chunk 1, data intStream = intFile.getItemStream(1); - create(MADS_SCREEN_WIDTH, MADS_INTERFACE_HEIGHT); + setSize(MADS_SCREEN_WIDTH, MADS_INTERFACE_HEIGHT); intStream->read(pixels, MADS_SCREEN_WIDTH * MADS_INTERFACE_HEIGHT); delete intStream; } @@ -562,14 +538,14 @@ void MSurfaceNebular::loadBackgroundStream(Common::SeekableReadStream *source, R int sceneWidth = sourceUnc->readUint16LE(); int sceneHeight = sourceUnc->readUint16LE(); int sceneSize = sceneWidth * sceneHeight; - if (sceneWidth > this->width()) { - warning("Background width is %i, too large to fit in screen. Setting it to %i", sceneWidth, this->width()); - sceneWidth = this->width(); + if (sceneWidth > this->getWidth()) { + warning("Background width is %i, too large to fit in screen. Setting it to %i", sceneWidth, getWidth()); + sceneWidth = this->getWidth(); sceneSize = sceneWidth * sceneHeight; } - if (sceneHeight > this->height()) { - warning("Background height is %i, too large to fit in screen.Setting it to %i", sceneHeight, this->height()); - sceneHeight = this->height(); + if (sceneHeight > getHeight()) { + warning("Background height is %i, too large to fit in screen.Setting it to %i", sceneHeight, getHeight()); + sceneHeight = getHeight(); sceneSize = sceneWidth * sceneHeight; } @@ -590,7 +566,6 @@ void MSurfaceNebular::loadBackgroundStream(Common::SeekableReadStream *source, R byte *pData = (byte *)pixels; sourceUnc->read(pData, sceneSize); - freeData(); delete sourceUnc; } @@ -602,11 +577,11 @@ void MSurfaceM4::loadCodes(Common::SeekableReadStream *source) { return; } - uint16 widthVal = source->readUint16LE(); - uint16 heightVal = source->readUint16LE(); + uint16 width = source->readUint16LE(); + uint16 height = source->readUint16LE(); - create(widthVal, heightVal); - source->read(pixels, widthVal * heightVal); + setSize(width, height); + source->read(pixels, width * height); } void MSurfaceM4::loadBackground(int roomNumber, RGBList **palData) { @@ -627,8 +602,8 @@ void MSurfaceM4::loadBackgroundStream(Common::SeekableReadStream *source) { source->skip(4); /*uint32 size =*/ source->readUint32LE(); - uint32 widthVal = source->readUint32LE(); - uint32 heightVal = source->readUint32LE(); + uint32 width = source->readUint32LE(); + uint32 height = source->readUint32LE(); uint32 tilesX = source->readUint32LE(); uint32 tilesY = source->readUint32LE(); uint32 tileWidth = source->readUint32LE(); @@ -651,25 +626,26 @@ void MSurfaceM4::loadBackgroundStream(Common::SeekableReadStream *source) { // resize or create the surface // Note that the height of the scene in game scenes is smaller than the screen height, // as the bottom part of the screen is the inventory - assert(width() == (int)widthVal); + assert(getWidth() == (int)width); - tileBuffer->create(tileWidth, tileHeight); + tileBuffer->setSize(tileWidth, tileHeight); for (curTileY = 0; curTileY < tilesY; curTileY++) { - clipY = MIN(heightVal, (1 + curTileY) * tileHeight) - (curTileY * tileHeight); + clipY = MIN(height, (1 + curTileY) * tileHeight) - (curTileY * tileHeight); for (curTileX = 0; curTileX < tilesX; curTileX++) { - clipX = MIN(widthVal, (1 + curTileX) * tileWidth) - (curTileX * tileWidth); + clipX = MIN(width, (1 + curTileX) * tileWidth) - (curTileX * tileWidth); // Read a tile and copy it to the destination surface source->read(tileBuffer->getData(), tileWidth * tileHeight); Common::Rect srcBounds(0, 0, clipX, clipY); - copyFrom(tileBuffer, srcBounds, curTileX * tileWidth, curTileY * tileHeight); + copyFrom(tileBuffer, srcBounds, + Common::Point(curTileX * tileWidth, curTileY * tileHeight)); } } - if (heightVal < (uint)height()) - fillRect(Common::Rect(0, heightVal, width(), height()), blackIndex); + if (height < (uint)getHeight()) + fillRect(Common::Rect(0, height, getWidth(), getHeight()), blackIndex); delete tileBuffer; } diff --git a/engines/mads/msurface.h b/engines/mads/msurface.h index 21b0cbcd2f..05777d3b8f 100644 --- a/engines/mads/msurface.h +++ b/engines/mads/msurface.h @@ -33,6 +33,9 @@ namespace MADS { class MADSEngine; class MSprite; +/** + * Basic sprite information + */ struct SpriteInfo { MSprite *sprite; int hotX, hotY; @@ -43,6 +46,9 @@ struct SpriteInfo { RGB8 *palette; }; +/* + * MADS graphics surface + */ class MSurface : public Graphics::Surface { public: static MADSEngine *_vm; @@ -61,46 +67,126 @@ public: /** * Create a surface */ - static MSurface *init(int w, int h); + static MSurface *init(int width, int height); private: byte _color; bool _isScreen; protected: + /** + * Basic constructor + */ MSurface(bool isScreen = false); - MSurface(int w, int h); + + /** + * Constructor for a surface with fixed dimensions + */ + MSurface(int width, int height); +public: + /** + * Helper method for calculating new dimensions when scaling a sprite + */ + static int scaleValue(int value, int scale, int err); public: virtual ~MSurface() {} - void create(int w, int h) { - Graphics::Surface::create(w, h, Graphics::PixelFormat::createFormatCLUT8()); + /** + * Reinitialises a surface to have a given set of dimensions + */ + void setSize(int width, int height) { + Graphics::Surface::create(width, height, Graphics::PixelFormat::createFormatCLUT8()); } + /** + * Sets the color used for drawing on the surface + */ void setColor(byte value) { _color = value; } - byte getColor() { return _color; } + + /** + * Returns the currently active color + */ + byte getColor() const { return _color; } + + /** + * Draws a vertical line using the currently set color + */ void vLine(int x, int y1, int y2); + + /** + * Draws a horizontal line using the currently set color + */ void hLine(int x1, int x2, int y); + + /** + * Draws a vertical line using an Xor on each pixel + */ void vLineXor(int x, int y1, int y2); + + /** + * Draws a horizontal line using an Xor on each pixel + */ void hLineXor(int x1, int x2, int y); + + /** + * Draws an arbitrary line on the screen using a specified color + */ void line(int x1, int y1, int x2, int y2, byte color); + + /** + * Draws a rectangular frame using the currently set color + */ void frameRect(int x1, int y1, int x2, int y2); - void fillRect(int x1, int y1, int x2, int y2); - static int scaleValue(int value, int scale, int err); - void drawSprite(int x, int y, SpriteInfo &info, const Common::Rect &clipRect); - - // Surface methods - int width() { return w; } - int height() { return h; } - void setSize(int sizeX, int sizeY); - byte *getData(); - byte *getBasePtr(int x, int y); - void freeData(); - void empty(); + /** + * Draws a rectangular frame using a specified color + */ void frameRect(const Common::Rect &r, uint8 color); + + /** + * Draws a filled in box using the currently set color + */ + void fillRect(int x1, int y1, int x2, int y2); + + /** + * Draws a filled in box using a specified color + */ void fillRect(const Common::Rect &r, uint8 color); - void copyFrom(MSurface *src, const Common::Rect &srcBounds, int destX, int destY, - int transparentColor = -1); + /** + * Draws a sprite + * @param pt Position to draw sprite at + * @param info General sprite details + * @param clipRect Clipping rectangle to constrain sprite drawing within + */ + void drawSprite(const Common::Point &pt, SpriteInfo &info, const Common::Rect &clipRect); + + /** + * Returns the width of the surface + */ + int getWidth() const { return w; } + + /** + * Returns the height of the surface + */ + int getHeight() const { return h; } + + /** + * Returns a pointer to the surface data + */ + byte *getData() { return (byte *)Graphics::Surface::getPixels(); } + + /** + * Returns a pointer to a given position within the surface + */ + byte *getBasePtr(int x, int y) { return (byte *)Graphics::Surface::getBasePtr(x, y); } + + /** + * Clears the surface + */ + void empty(); + + /** + * Updates the surface. If it's the screen surface, copies it to the physical screen. + */ void update() { if (_isScreen) { g_system->copyRectToScreen((const byte *)pixels, pitch, 0, 0, w, h); @@ -108,25 +194,67 @@ public: } } - // copyTo methods + /** + * Copys a sub-section of another surface into the current one. + * @param src Source surface + * @param srcBounds Area of source surface to copy + * @param destPos Destination position to draw in current surface + * @param transparentColor Transparency palette index + */ + void copyFrom(MSurface *src, const Common::Rect &srcBounds, const Common::Point &destPos, + int transparentColor = -1); + + /** + * Copies the surface to a given destination surface + */ void copyTo(MSurface *dest, int transparentColor = -1) { - dest->copyFrom(this, Common::Rect(width(), height()), 0, 0, transparentColor); + dest->copyFrom(this, Common::Rect(w, h), Common::Point(), transparentColor); } - void copyTo(MSurface *dest, int x, int y, int transparentColor = -1) { - dest->copyFrom(this, Common::Rect(width(), height()), x, y, transparentColor); + + /** + * Copies the surface to a given destination surface + */ + void copyTo(MSurface *dest, const Common::Point &pt, int transparentColor = -1) { + dest->copyFrom(this, Common::Rect(w, h), pt, transparentColor); } - void copyTo(MSurface *dest, const Common::Rect &srcBounds, int destX, int destY, + + /** + * Copies the surface to a given destination surface + */ + void copyTo(MSurface *dest, const Common::Rect &srcBounds, const Common::Point &destPos, int transparentColor = -1) { - dest->copyFrom(this, srcBounds, destX, destY, transparentColor); + dest->copyFrom(this, srcBounds, destPos, transparentColor); } + /** + * Translates the data of a surface using a specified RGBList translation matrix. + */ void translate(RGBList *list, bool isTransparent = false); // Base virtual methods + /** + * Loads a background by scene name + */ virtual void loadBackground(const Common::String &sceneName) {} + + /** + * Load background by room number + */ virtual void loadBackground(int roomNumber, RGBList **palData) = 0; + + /** + * Load background from a passed stream + */ virtual void loadBackground(Common::SeekableReadStream *source, RGBList **palData) {} + + /** + * Load scene codes from a passed stream + */ virtual void loadCodes(Common::SeekableReadStream *source) = 0; + + /** + * Load a given user interface by index + */ virtual void loadInterface(int index, RGBList **palData) {} }; @@ -134,7 +262,7 @@ class MSurfaceMADS: public MSurface { friend class MSurface; protected: MSurfaceMADS(bool isScreen = false): MSurface(isScreen) {} - MSurfaceMADS(int w, int h): MSurface(w, h) {} + MSurfaceMADS(int width, int height): MSurface(width, height) {} public: virtual void loadCodes(Common::SeekableReadStream *source); virtual void loadBackground(const Common::String &sceneName) {} @@ -146,7 +274,7 @@ class MSurfaceNebular: public MSurfaceMADS { friend class MSurface; protected: MSurfaceNebular(bool isScreen = false): MSurfaceMADS(isScreen) {} - MSurfaceNebular(int w, int h): MSurfaceMADS(w, h) {} + MSurfaceNebular(int width, int height): MSurfaceMADS(width, height) {} private: void loadBackgroundStream(Common::SeekableReadStream *source, RGBList **palData); public: @@ -157,7 +285,7 @@ class MSurfaceM4: public MSurface { friend class MSurface; protected: MSurfaceM4(bool isScreen = false): MSurface(isScreen) {} - MSurfaceM4(int widthVal, int heightVal): MSurface(widthVal, heightVal) {} + MSurfaceM4(int width, int height): MSurface(width, height) {} void loadBackgroundStream(Common::SeekableReadStream *source); public: @@ -169,7 +297,7 @@ class MSurfaceRiddle: public MSurfaceM4 { friend class MSurface; protected: MSurfaceRiddle(bool isScreen = false): MSurfaceM4(isScreen) {} - MSurfaceRiddle(int widthVal, int heightVal): MSurfaceM4(widthVal, heightVal) {} + MSurfaceRiddle(int width, int height): MSurfaceM4(width, height) {} public: virtual void loadBackground(const Common::String &sceneName); }; -- cgit v1.2.3 From c687d3f64cc5ac6ec09539129c5f8b0d3a7148ad Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 19 Feb 2014 21:28:54 -0500 Subject: MADS: Cleanup of palette code, updated old-style 4 byte RGB usage to 3 bytes --- engines/mads/mads.cpp | 2 +- engines/mads/msurface.cpp | 39 +++++----- engines/mads/msurface.h | 2 +- engines/mads/palette.cpp | 179 ++++++++++++++++++++++++---------------------- engines/mads/palette.h | 142 ++++++++++++++++++++++++++++++------ 5 files changed, 233 insertions(+), 131 deletions(-) diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index 0ddb6bf401..36b5ec51f5 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -71,7 +71,7 @@ void MADSEngine::initialise() { MSprite::setVm(this); _events = new EventsManager(this); - _palette = new Palette(this); + _palette = Palette::init(this); _font = Font::init(this); _resources = new ResourcesManager(this); _screen = MSurface::init(true); diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp index b3a4510793..e7cc08e636 100644 --- a/engines/mads/msurface.cpp +++ b/engines/mads/msurface.cpp @@ -234,9 +234,9 @@ void MSurface::drawSprite(const Common::Point &pt, SpriteInfo &info, const Commo } else { byte destPixel = *tempDst; byte r, g, b; - r = CLIP((info.palette[destPixel].r * pixel) >> 10, 0, 31); - g = CLIP((info.palette[destPixel].g * pixel) >> 10, 0, 31); - b = CLIP((info.palette[destPixel].b * pixel) >> 10, 0, 31); + r = CLIP((info.palette[destPixel * 3] * pixel) >> 10, 0, 31); + g = CLIP((info.palette[destPixel * 3 + 1] * pixel) >> 10, 0, 31); + b = CLIP((info.palette[destPixel * 3 + 2] * pixel) >> 10, 0, 31); pixel = info.inverseColorTable[(b << 10) | (g << 5) | r]; } } @@ -429,10 +429,10 @@ void MSurfaceMADS::loadBackground(int roomNumber, RGBList **palData) { tileDataUncomp = tileData.getItemStream(2); // Set palette if (!palData) { - _vm->_palette->setMadsPalette(tileDataUncomp, 4); + _vm->_palette->loadPalette(tileDataUncomp, 4); } else { int numColors; - RGB8 *rgbList = _vm->_palette->decodeMadsPalette(tileDataUncomp, &numColors); + byte *rgbList = _vm->_palette->decodePalette(tileDataUncomp, &numColors); *palData = new RGBList(numColors, rgbList, true); } delete tileDataUncomp; @@ -495,18 +495,16 @@ void MSurfaceMADS::loadInterface(int index, RGBList **palData) { char resourceName[20]; sprintf(resourceName, "i%d.int", index); MadsPack intFile(resourceName, _vm); - RGB8 *palette = new RGB8[16]; + byte *palette = new byte[16 * 3]; // Chunk 0, palette Common::SeekableReadStream *intStream = intFile.getItemStream(0); for (int i = 0; i < 16; i++) { - palette[i].r = intStream->readByte() << 2; - palette[i].g = intStream->readByte() << 2; - palette[i].b = intStream->readByte() << 2; - intStream->readByte(); - intStream->readByte(); - intStream->readByte(); + palette[i * 3] = intStream->readByte() << 2; + palette[i * 3 + 1] = intStream->readByte() << 2; + palette[i * 3 + 2] = intStream->readByte() << 2; + intStream->skip(3); } *palData = new RGBList(16, palette, true); delete intStream; @@ -551,10 +549,10 @@ void MSurfaceNebular::loadBackgroundStream(Common::SeekableReadStream *source, R // Set palette if (!palData) { - _vm->_palette->setMadsPalette(sourceUnc, 4); + _vm->_palette->loadPalette(sourceUnc, 4); } else { int numColors; - RGB8 *rgbList = _vm->_palette->decodeMadsPalette(sourceUnc, &numColors); + byte *rgbList = _vm->_palette->decodePalette(sourceUnc, &numColors); *palData = new RGBList(numColors, rgbList, true); } delete sourceUnc; @@ -598,7 +596,7 @@ void MSurfaceM4::loadBackgroundStream(Common::SeekableReadStream *source) { MSurface *tileBuffer = MSurface::init(); uint curTileX = 0, curTileY = 0; int clipX = 0, clipY = 0; - RGB8 palette[256]; + byte palette[256]; source->skip(4); /*uint32 size =*/ source->readUint32LE(); @@ -612,12 +610,13 @@ void MSurfaceM4::loadBackgroundStream(Common::SeekableReadStream *source) { // BGR data, which is converted to RGB8 for (uint i = 0; i < 256; i++) { - palette[i].b = source->readByte() << 2; - palette[i].g = source->readByte() << 2; - palette[i].r = source->readByte() << 2; - palette[i].u = source->readByte() << 2; + byte r, g, b; + palette[i * 3] = r = source->readByte() << 2; + palette[i * 3 + 1] = g = source->readByte() << 2; + palette[i * 3 + 2] = b = source->readByte() << 2; + source->skip(1); - if ((blackIndex == 0) && !palette[i].r && !palette[i].g && !palette[i].b) + if ((blackIndex == 0) && !r && !g && !b) blackIndex = i; } diff --git a/engines/mads/msurface.h b/engines/mads/msurface.h index 05777d3b8f..fe6d1f22b4 100644 --- a/engines/mads/msurface.h +++ b/engines/mads/msurface.h @@ -43,7 +43,7 @@ struct SpriteInfo { int scaleX, scaleY; uint8 encoding; byte *inverseColorTable; - RGB8 *palette; + byte *palette; }; /* diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index cfd8568407..6a5d507c13 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -28,12 +28,12 @@ namespace MADS { -RGBList::RGBList(int numEntries, RGB8 *srcData, bool freeData) { +RGBList::RGBList(int numEntries, byte *srcData, bool freeData) { _size = numEntries; - assert(numEntries <= 256); + assert(numEntries <= PALETTE_COUNT); if (srcData == NULL) { - _data = new RGB8[numEntries]; + _data = new byte[numEntries * 3]; _freeData = true; } else { _data = srcData; @@ -54,10 +54,18 @@ RGBList::~RGBList() { #define VGA_COLOR_TRANS(x) (x == 0x3f ? 255 : x << 2) +Palette *Palette::init(MADSEngine *vm) { + if (vm->getGameFeatures() & GF_MADS) { + return new PaletteMADS(vm); + } else { + return new PaletteM4(vm); + } +} + Palette::Palette(MADSEngine *vm) : _vm(vm) { reset(); _fading_in_progress = false; - Common::fill(&_usageCount[0], &_usageCount[256], 0); + Common::fill(&_usageCount[0], &_usageCount[PALETTE_COUNT], 0); } void Palette::setPalette(const byte *colors, uint start, uint num) { @@ -65,31 +73,26 @@ void Palette::setPalette(const byte *colors, uint start, uint num) { reset(); } -void Palette::setPalette(const RGB8 *colors, uint start, uint num) { - g_system->getPaletteManager()->setPalette((const byte *)colors, start, num); - reset(); -} - void Palette::grabPalette(byte *colors, uint start, uint num) { g_system->getPaletteManager()->grabPalette(colors, start, num); reset(); } -uint8 Palette::palIndexFromRgb(byte r, byte g, byte b, RGB8 *paletteData) { +uint8 Palette::palIndexFromRgb(byte r, byte g, byte b, byte *paletteData) { byte index = 0; int32 minDist = 0x7fffffff; - RGB8 palData[256]; + byte palData[PALETTE_SIZE]; int Rdiff, Gdiff, Bdiff; if (paletteData == NULL) { - g_system->getPaletteManager()->grabPalette((byte *)palData, 0, 256); + g_system->getPaletteManager()->grabPalette(palData, 0, PALETTE_COUNT); paletteData = &palData[0]; } - for (int palIndex = 0; palIndex < 256; ++palIndex) { - Rdiff = r - paletteData[palIndex].r; - Gdiff = g - paletteData[palIndex].g; - Bdiff = b - paletteData[palIndex].b; + for (int palIndex = 0; palIndex < PALETTE_COUNT; ++palIndex) { + Rdiff = r - paletteData[palIndex * 3]; + Gdiff = g - paletteData[palIndex * 3 + 1]; + Bdiff = b - paletteData[palIndex * 3 + 2]; if (Rdiff * Rdiff + Gdiff * Gdiff + Bdiff * Bdiff < minDist) { minDist = Rdiff * Rdiff + Gdiff * Gdiff + Bdiff * Bdiff; @@ -101,8 +104,8 @@ uint8 Palette::palIndexFromRgb(byte r, byte g, byte b, RGB8 *paletteData) { } void Palette::reset() { - RGB8 palData[256]; - g_system->getPaletteManager()->grabPalette((byte *)palData, 0, 256); + byte palData[PALETTE_SIZE]; + g_system->getPaletteManager()->grabPalette(palData, 0, PALETTE_COUNT); BLACK = palIndexFromRgb(0, 0, 0, palData); BLUE = palIndexFromRgb(0, 0, 255, palData); @@ -126,13 +129,13 @@ void Palette::fadeIn(int numSteps, uint delayAmount, RGBList *destPalette) { fadeIn(numSteps, delayAmount, destPalette->data(), destPalette->size()); } -void Palette::fadeIn(int numSteps, uint delayAmount, RGB8 *destPalette, int numColors) { +void Palette::fadeIn(int numSteps, uint delayAmount, byte *destPalette, int numColors) { if (_fading_in_progress) return; _fading_in_progress = true; - RGB8 blackPalette[256]; - Common::fill((byte *)&blackPalette[0], (byte *)&blackPalette[256], 0); + byte blackPalette[PALETTE_SIZE]; + Common::fill(&blackPalette[0], &blackPalette[PALETTE_SIZE], 0); // Initially set the black palette _vm->_palette->setPalette(blackPalette, 0, numColors); @@ -143,52 +146,8 @@ void Palette::fadeIn(int numSteps, uint delayAmount, RGB8 *destPalette, int numC _fading_in_progress = false; } -RGB8 *Palette::decodeMadsPalette(Common::SeekableReadStream *palStream, int *numColors) { - *numColors = palStream->readUint16LE(); - assert(*numColors <= 252); - - RGB8 *palData = new RGB8[*numColors]; - Common::fill((byte *)&palData[0], (byte *)&palData[*numColors], 0); - - for (int i = 0; i < *numColors; ++i) { - byte r = palStream->readByte(); - byte g = palStream->readByte(); - byte b = palStream->readByte(); - palData[i].r = VGA_COLOR_TRANS(r); - palData[i].g = VGA_COLOR_TRANS(g); - palData[i].b = VGA_COLOR_TRANS(b); - - // The next 3 bytes are unused - palStream->skip(3); - } - - return palData; -} - -int Palette::setMadsPalette(Common::SeekableReadStream *palStream, int indexStart) { - int colorCount; - RGB8 *palData = Palette::decodeMadsPalette(palStream, &colorCount); - _vm->_palette->setPalette(palData, indexStart, colorCount); - delete palData; - return colorCount; -} - -void Palette::setMadsSystemPalette() { - // Rex Nebular default system palette - resetColorCounts(); - - RGB8 palData[4]; - palData[0].r = palData[0].g = palData[0].b = 0; - palData[1].r = palData[1].g = palData[1].b = 0x54; - palData[2].r = palData[2].g = palData[2].b = 0xb4; - palData[3].r = palData[3].g = palData[3].b = 0xff; - - setPalette(palData, 0, 4); - blockRange(0, 4); -} - void Palette::resetColorCounts() { - Common::fill(&_usageCount[0], &_usageCount[256], 0); + Common::fill(&_usageCount[0], &_usageCount[PALETTE_COUNT], 0); } void Palette::blockRange(int startIndex, int size) { @@ -197,41 +156,41 @@ void Palette::blockRange(int startIndex, int size) { } void Palette::addRange(RGBList *list) { - RGB8 *data = list->data(); + byte *data = list->data(); byte *palIndexes = list->palIndexes(); - RGB8 palData[256]; - g_system->getPaletteManager()->grabPalette((byte *)&palData[0], 0, 256); + byte palData[PALETTE_COUNT]; + g_system->getPaletteManager()->grabPalette(palData, 0, PALETTE_COUNT); bool paletteChanged = false; for (int colIndex = 0; colIndex < list->size(); ++colIndex) { // Scan through for an existing copy of the RGB value int palIndex = -1; - while (++palIndex < 256) { + while (++palIndex < PALETTE_COUNT) { if (_usageCount[palIndex] <= 0) // Palette index is to be skipped continue; - if ((palData[palIndex].r == data[colIndex].r) && - (palData[palIndex].g == data[colIndex].g) && - (palData[palIndex].b == data[colIndex].b)) + if ((palData[palIndex * 3] == data[colIndex * 3]) && + (palData[palIndex * 3 + 1] == data[colIndex * 3 + 1]) && + (palData[palIndex * 3 + 2] == data[colIndex * 3 + 2])) // Match found break; } - if (palIndex == 256) { + if (palIndex == PALETTE_COUNT) { // No match found, so find a free slot to use palIndex = -1; - while (++palIndex < 256) { + while (++palIndex < PALETTE_COUNT) { if (_usageCount[palIndex] == 0) break; } - if (palIndex == 256) + if (palIndex == PALETTE_COUNT) error("addRange - Ran out of palette space to allocate"); - palData[palIndex].r = data[colIndex].r; - palData[palIndex].g = data[colIndex].g; - palData[palIndex].b = data[colIndex].b; + palData[palIndex * 3] = data[colIndex * 3]; + palData[palIndex * 3 + 1] = data[colIndex * 3 + 1]; + palData[palIndex * 3 + 2] = data[colIndex * 3 + 2]; paletteChanged = true; } @@ -240,7 +199,7 @@ void Palette::addRange(RGBList *list) { } if (paletteChanged) { - g_system->getPaletteManager()->setPalette((byte *)&palData[0], 0, 256); + g_system->getPaletteManager()->setPalette(&palData[0], 0, 256); reset(); } } @@ -259,9 +218,9 @@ void Palette::deleteAllRanges() { _usageCount[colIndex] = 0; } -void Palette::fadeRange(RGB8 *srcPal, RGB8 *destPal, int startIndex, int endIndex, +void Palette::fadeRange(byte *srcPal, byte *destPal, int startIndex, int endIndex, int numSteps, uint delayAmount) { - RGB8 tempPal[256]; + byte tempPal[256 * 3]; // perform the fade for(int stepCtr = 1; stepCtr <= numSteps; ++stepCtr) { @@ -274,16 +233,62 @@ void Palette::fadeRange(RGB8 *srcPal, RGB8 *destPal, int startIndex, int endInd for (int i = startIndex; i <= endIndex; ++i) { // Handle the intermediate rgb values for fading - tempPal[i].r = (byte) (srcPal[i].r + (destPal[i].r - srcPal[i].r) * stepCtr / numSteps); - tempPal[i].g = (byte) (srcPal[i].g + (destPal[i].g - srcPal[i].g) * stepCtr / numSteps); - tempPal[i].b = (byte) (srcPal[i].b + (destPal[i].b - srcPal[i].b) * stepCtr / numSteps); + tempPal[i * 3] = (byte) (srcPal[i * 3] + (destPal[i * 3] - srcPal[i * 3]) * stepCtr / numSteps); + tempPal[i * 3 + 1] = (byte) (srcPal[i * 3 + 1] + (destPal[i * 3 + 1] - srcPal[i * 3 + 1]) * stepCtr / numSteps); + tempPal[i * 3 + 2] = (byte) (srcPal[i * 3 + 2] + (destPal[i * 3 + 2] - srcPal[i * 3 + 2]) * stepCtr / numSteps); } - _vm->_palette->setPalette(&tempPal[startIndex], startIndex, endIndex - startIndex + 1); + _vm->_palette->setPalette(&tempPal[startIndex * 3], startIndex, endIndex - startIndex + 1); } // Make sure the end palette exactly matches what is wanted - _vm->_palette->setPalette(&destPal[startIndex], startIndex, endIndex - startIndex + 1); + _vm->_palette->setPalette(&destPal[startIndex * 3], startIndex, endIndex - startIndex + 1); +} + +/*------------------------------------------------------------------------*/ + +byte *PaletteMADS::decodePalette(Common::SeekableReadStream *palStream, int *numColors) { + *numColors = palStream->readUint16LE(); + assert(*numColors <= 252); + + byte *palData = new byte[*numColors * 3]; + Common::fill(&palData[0], &palData[*numColors * 3], 0); + + for (int i = 0; i < *numColors; ++i) { + byte r = palStream->readByte(); + byte g = palStream->readByte(); + byte b = palStream->readByte(); + palData[i * 3] = VGA_COLOR_TRANS(r); + palData[i * 3 + 1] = VGA_COLOR_TRANS(g); + palData[i * 3 + 2] = VGA_COLOR_TRANS(b); + + // The next 3 bytes are unused + palStream->skip(3); + } + + return palData; +} + +int PaletteMADS::loadPalette(Common::SeekableReadStream *palStream, int indexStart) { + int colorCount; + byte *palData = decodePalette(palStream, &colorCount); + _vm->_palette->setPalette(palData, indexStart, colorCount); + + delete palData; + return colorCount; +} + +void PaletteMADS::setSystemPalette() { + resetColorCounts(); + + byte palData[4 * 3]; + palData[0 * 3] = palData[0 * 3 + 1] = palData[0 * 3 + 2] = 0; + palData[1 * 3] = palData[1 * 3 + 1] = palData[1 * 3 + 2] = 0x54; + palData[2 * 3] = palData[2 * 3 + 1] = palData[2 * 3 + 2] = 0xb4; + palData[3 * 3] = palData[3 * 3 + 1] = palData[3 * 3 + 2] = 0xff; + + setPalette(palData, 0, 4); + blockRange(0, 4); } } // End of namespace MADS diff --git a/engines/mads/palette.h b/engines/mads/palette.h index ab03d8d20b..a5d9c6ad1e 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -29,63 +29,137 @@ namespace MADS { class MADSEngine; -struct RGB8 { - uint8 r, g, b, u; -}; - +/** + * Used to store a list of RGB values + */ class RGBList { private: int _size; - RGB8 *_data; + byte *_data; byte *_palIndexes; bool _freeData; public: - RGBList(int numEntries = 256, RGB8 *srcData = NULL, bool freeData = true); + /** + * Constructor + */ + RGBList(int numEntries = 256, byte *srcData = NULL, bool freeData = true); + + /** + * Destructor + */ ~RGBList(); - RGB8 *data() { return _data; } + /** + * Returns the raw data containing the RGB values as 3 bytes per entry + */ + byte *data() { return _data; } + + /** + * Returns the list of palette indexes each RGB tuple maps to in the current palette + */ byte *palIndexes() { return _palIndexes; } - int size() { return _size; } + + /** + * Returns the size of the palette + */ + int size() const { return _size; } }; #define PALETTE_COUNT 256 +#define PALETTE_SIZE (256 * 3) class Palette { private: + /** + * Support method used by the fading code + */ + void fadeRange(byte *srcPal, byte *destPal, int startIndex, int endIndex, + int numSteps, uint delayAmount); +protected: MADSEngine *_vm; bool _colorsChanged; + bool _fading_in_progress; byte _originalPalette[PALETTE_COUNT * 4]; byte _fadedPalette[PALETTE_COUNT * 4]; int _usageCount[PALETTE_COUNT]; + Palette(MADSEngine *vm); void reset(); public: - Palette(MADSEngine *vm); - + /** + * Creates a new palette instance + */ + static Palette *init(MADSEngine *vm); + + /** + * Sets a new palette + */ void setPalette(const byte *colors, uint start, uint num); - void setPalette(const RGB8 *colors, uint start, uint num); - void grabPalette(byte *colors, uint start, uint num); - void grabPalette(RGB8 *colors, uint start, uint num) { - grabPalette((byte *)colors, start, num); - } - uint8 palIndexFromRgb(byte r, byte g, byte b, RGB8 *paletteData = NULL); - void fadeIn(int numSteps, uint delayAmount, RGB8 *destPalette, int numColors); + /** + * Returns a subset of the currently loaded palette + */ + void grabPalette(byte *colors, uint start, uint num); + + /** + * Returns the palette index in the palette that most closely matches the + * specified RGB pair + */ + uint8 palIndexFromRgb(byte r, byte g, byte b, byte *paletteData = nullptr); + + /** + * Performs a fade in + */ + void fadeIn(int numSteps, uint delayAmount, byte *destPalette, int numColors); + + /** + * Performs a fade in + */ void fadeIn(int numSteps, uint delayAmount, RGBList *destPalette); - static RGB8 *decodeMadsPalette(Common::SeekableReadStream *palStream, int *numColors); - int setMadsPalette(Common::SeekableReadStream *palStream, int indexStart = 0); - void setMadsSystemPalette(); - void fadeRange(RGB8 *srcPal, RGB8 *destPal, int startIndex, int endIndex, - int numSteps, uint delayAmount); // Methods used for reference counting color usage + /** + * Resets the usage counts for the palette + */ void resetColorCounts(); + + /** + * Blocks out a range of the palette from being used + */ void blockRange(int startIndex, int size); + + /** + * Adds the data of an RGBList into the current palette and increment usage counts. + */ void addRange(RGBList *list); + + /** + * Delets a range from the current palette, dercementing the accompanying usage counts. + */ void deleteRange(RGBList *list); + + /** + * Deletes all loaded RGB lists are their usage references. + */ void deleteAllRanges(); + // Virtual method table + /** + * Decode a palette and return it, without affecting the Palette itself + */ + virtual byte *decodePalette(Common::SeekableReadStream *palStream, int *numColors) = 0; + + /** + * Loads a palette from a stream + */ + virtual int loadPalette(Common::SeekableReadStream *palStream, int indexStart = 0) = 0; + + /** + * Sets a small set of system/core colors needed by the game + */ + virtual void setSystemPalette() = 0; + // Color indexes uint8 BLACK; uint8 BLUE; @@ -105,6 +179,30 @@ public: uint8 WHITE; }; +class PaletteMADS: protected Palette { + friend class Palette; +protected: + PaletteMADS(MADSEngine *vm): Palette(vm) {} +public: + virtual byte *decodePalette(Common::SeekableReadStream *palStream, int *numColors); + virtual int loadPalette(Common::SeekableReadStream *palStream, int indexStart = 0); + virtual void setSystemPalette(); +}; + +class PaletteM4: protected Palette { + friend class Palette; +protected: + PaletteM4(MADSEngine *vm): Palette(vm) {} +public: + virtual byte *decodePalette(Common::SeekableReadStream *palStream, int *numColors) { + return nullptr; + } + virtual int loadPalette(Common::SeekableReadStream *palStream, int indexStart = 0) { + return 0; + } + virtual void setSystemPalette() {} +}; + } // End of namespace MADS #endif /* MADS_PALETTE_H */ -- cgit v1.2.3 From 1b0c1b3f561576cbcd7c1494d3893200442dace4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 19 Feb 2014 21:31:41 -0500 Subject: MADS: Fix GCC warnings --- engines/mads/font.cpp | 4 ++-- engines/mads/palette.h | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/engines/mads/font.cpp b/engines/mads/font.cpp index 9da46c30b1..e97cc95fdf 100644 --- a/engines/mads/font.cpp +++ b/engines/mads/font.cpp @@ -112,14 +112,14 @@ int Font::write(MSurface *surface, const Common::String &msg, const Common::Poin const char *text = msg.c_str(); while (*text) { char theChar = (*text++) & 0x7F; - int charWidth = _charWidths[theChar]; + int charWidth = _charWidths[(byte)theChar]; if (charWidth > 0) { if (xPos + charWidth >= width) return xPos; - uint8 *charData = &_charData[_charOffs[theChar]]; + uint8 *charData = &_charData[_charOffs[(byte)theChar]]; int bpp = getBpp(charWidth); if (skipY != 0) diff --git a/engines/mads/palette.h b/engines/mads/palette.h index a5d9c6ad1e..a97d5de20f 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -91,6 +91,11 @@ public: * Creates a new palette instance */ static Palette *init(MADSEngine *vm); + + /** + * Destructor + */ + virtual ~Palette() {} /** * Sets a new palette -- cgit v1.2.3 From 488bf66c3e451a65ab14a387f681fb91aa5c6253 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 19 Feb 2014 21:56:38 -0500 Subject: MADS: Fix memory leaks in MSurface --- engines/mads/msurface.cpp | 15 +++++++++++++-- engines/mads/msurface.h | 9 +++++---- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp index e7cc08e636..f71a4a7a4e 100644 --- a/engines/mads/msurface.cpp +++ b/engines/mads/msurface.cpp @@ -51,16 +51,27 @@ MSurface *MSurface::init(int width, int height) { } } -MSurface::MSurface(bool isScreen) { +MSurface::MSurface(bool isScreen) { + pixels = nullptr; setSize(g_system->getWidth(), g_system->getHeight()); _isScreen = isScreen; } MSurface::MSurface(int width, int height) { + pixels = nullptr; setSize(width, height); _isScreen = false; } +MSurface::~MSurface() { + Graphics::Surface::free(); +} + +void MSurface::setSize(int width, int height) { + Graphics::Surface::free(); + Graphics::Surface::create(width, height, Graphics::PixelFormat::createFormatCLUT8()); +} + void MSurface::vLine(int x, int y1, int y2) { Graphics::Surface::vLine(x, y1, y2, _color); } @@ -271,7 +282,7 @@ void MSurface::drawSprite(const Common::Point &pt, SpriteInfo &info, const Commo } void MSurface::empty() { - Common::fill(getBasePtr(0, 0), getBasePtr(w, h), _vm->_palette->BLACK); + Common::fill(getBasePtr(0, 0), getBasePtr(0, h), _vm->_palette->BLACK); } void MSurface::frameRect(const Common::Rect &r, uint8 color) { diff --git a/engines/mads/msurface.h b/engines/mads/msurface.h index fe6d1f22b4..42c56e9393 100644 --- a/engines/mads/msurface.h +++ b/engines/mads/msurface.h @@ -87,14 +87,15 @@ public: */ static int scaleValue(int value, int scale, int err); public: - virtual ~MSurface() {} + /** + * Destructor + */ + virtual ~MSurface(); /** * Reinitialises a surface to have a given set of dimensions */ - void setSize(int width, int height) { - Graphics::Surface::create(width, height, Graphics::PixelFormat::createFormatCLUT8()); - } + void setSize(int width, int height); /** * Sets the color used for drawing on the surface -- cgit v1.2.3 From 7593ec29d060268b7102509324d83e87c4ddd77c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 19 Feb 2014 22:01:10 -0500 Subject: MADS: Fix feature flags for Rex Nebular detection entry --- engines/mads/detection.cpp | 2 +- engines/mads/detection_tables.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/mads/detection.cpp b/engines/mads/detection.cpp index 73a4b97931..015859f827 100644 --- a/engines/mads/detection.cpp +++ b/engines/mads/detection.cpp @@ -48,7 +48,7 @@ uint32 MADSEngine::getGameID() const { } uint32 MADSEngine::getGameFeatures() const { - return _gameDescription->gameID; + return _gameDescription->features; } uint32 MADSEngine::getFeatures() const { diff --git a/engines/mads/detection_tables.h b/engines/mads/detection_tables.h index 7a66029b9b..7410dce2f6 100644 --- a/engines/mads/detection_tables.h +++ b/engines/mads/detection_tables.h @@ -37,6 +37,8 @@ static const MADSGameDescription gameDescriptions[] = { ADGF_NO_FLAGS, GUIO1(GUIO_NONE) }, + GType_RexNebular, + GF_MADS }, { AD_TABLE_END_MARKER } -- cgit v1.2.3 From 58bb1383d0b11d357128ca2b0a7634f091c0fb5b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 19 Feb 2014 23:17:57 -0500 Subject: MADS: Added skeleton files for the game and dialogs --- engines/mads/events.cpp | 9 ++++++ engines/mads/events.h | 2 +- engines/mads/game.cpp | 18 ++++++++++-- engines/mads/game.h | 14 +++++++-- engines/mads/mads.cpp | 13 +++++---- engines/mads/mads.h | 2 ++ engines/mads/module.mk | 2 ++ engines/mads/nebular/dialogs_nebular.cpp | 37 ++++++++++++++++++++++++ engines/mads/nebular/dialogs_nebular.h | 42 +++++++++++++++++++++++++++ engines/mads/nebular/game_nebular.cpp | 49 ++++++++++++++++++++++++++++++++ engines/mads/nebular/game_nebular.h | 45 +++++++++++++++++++++++++++++ 11 files changed, 222 insertions(+), 11 deletions(-) create mode 100644 engines/mads/nebular/dialogs_nebular.cpp create mode 100644 engines/mads/nebular/dialogs_nebular.h create mode 100644 engines/mads/nebular/game_nebular.cpp create mode 100644 engines/mads/nebular/game_nebular.h diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp index 8d6262aec3..0950ac02d2 100644 --- a/engines/mads/events.cpp +++ b/engines/mads/events.cpp @@ -22,6 +22,7 @@ #include "common/scummsys.h" #include "common/events.h" +#include "engines/util.h" #include "mads/mads.h" #include "mads/events.h" @@ -31,4 +32,12 @@ EventsManager::EventsManager(MADSEngine *vm) { _vm = vm; } +void EventsManager::handleEvents() { + Common::Event e; + while (!_vm->shouldQuit()) { + g_system->getEventManager()->pollEvent(e); + g_system->delayMillis(10); + } +} + } // End of namespace MADS diff --git a/engines/mads/events.h b/engines/mads/events.h index ea52c7ab9c..33d5c8e31b 100644 --- a/engines/mads/events.h +++ b/engines/mads/events.h @@ -35,7 +35,7 @@ private: public: EventsManager(MADSEngine *vm); - void handleEvents() { /* TODO */ } + void handleEvents(); }; } // End of namespace MADS diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 491117f977..0a04fda6cf 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -23,17 +23,29 @@ #include "common/scummsys.h" #include "mads/mads.h" #include "mads/game.h" +#include "mads/nebular/game_nebular.h" #include "mads/graphics.h" #include "mads/msurface.h" namespace MADS { Game *Game::init(MADSEngine *vm) { - return new Game(vm); + if (vm->getGameID() == GType_RexNebular) + return new Nebular::GameNebular(vm); + + return nullptr; +} + +Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr) { +} + +Game::~Game() { + delete _surface; } -Game::Game(MADSEngine *vm): _vm(vm), _surface(MSurface::init( - MADS_SCREEN_WIDTH, MADS_SCREEN_HEIGHT - MADS_INTERFACE_HEIGHT)) { +void Game::run() { + if (!checkCopyProtection()) + return; } } // End of namespace MADS diff --git a/engines/mads/game.h b/engines/mads/game.h index 190dc883d2..2f0dcf7d48 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -30,15 +30,25 @@ namespace MADS { class MADSEngine; class Game { -private: +protected: MADSEngine *_vm; MSurface *_surface; Game(MADSEngine *vm); + + /** + * Perform any copy protection check + */ + virtual bool checkCopyProtection() = 0; public: static Game *init(MADSEngine *vm); public: - ~Game(); + virtual ~Game(); + + /** + * Run the game + */ + void run(); }; } // End of namespace MADS diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index 36b5ec51f5..05c11409db 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -44,6 +44,7 @@ MADSEngine::MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc) : _events = nullptr; _font = nullptr; + _game = nullptr; _palette = nullptr; _resources = nullptr; _screen = nullptr; @@ -54,6 +55,7 @@ MADSEngine::MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc) : MADSEngine::~MADSEngine() { delete _events; delete _font; + delete _game; delete _palette; delete _resources; delete _screen; @@ -77,6 +79,7 @@ void MADSEngine::initialise() { _screen = MSurface::init(true); _sound = new SoundManager(this, _mixer); _userInterface = UserInterface::init(this); + _game = Game::init(this); _screen->empty(); } @@ -85,11 +88,11 @@ Common::Error MADSEngine::run() { initGraphics(MADS_SCREEN_WIDTH, MADS_SCREEN_HEIGHT, false); initialise(); - Common::Event e; - while (!shouldQuit()) { - g_system->getEventManager()->pollEvent(e); - g_system->delayMillis(10); - } + // Run the game + _game->run(); + + // Dummy loop to keep application active + _events->handleEvents(); return Common::kNoError; } diff --git a/engines/mads/mads.h b/engines/mads/mads.h index 86a5499e62..a6ae776690 100644 --- a/engines/mads/mads.h +++ b/engines/mads/mads.h @@ -32,6 +32,7 @@ #include "graphics/surface.h" #include "mads/events.h" #include "mads/font.h" +#include "mads/game.h" #include "mads/msurface.h" #include "mads/resources.h" #include "mads/sound.h" @@ -91,6 +92,7 @@ protected: public: EventsManager *_events; Font *_font; + Game *_game; Palette *_palette; ResourcesManager *_resources; MSurface *_screen; diff --git a/engines/mads/module.mk b/engines/mads/module.mk index 401b909ac8..3f78103f6d 100644 --- a/engines/mads/module.mk +++ b/engines/mads/module.mk @@ -1,6 +1,8 @@ MODULE := engines/mads MODULE_OBJS := \ + nebular/dialogs_nebular.o \ + nebular/game_nebular.o \ compression.o \ detection.o \ events.o \ diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp new file mode 100644 index 0000000000..5aede49b90 --- /dev/null +++ b/engines/mads/nebular/dialogs_nebular.cpp @@ -0,0 +1,37 @@ +/* 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 "common/scummsys.h" +#include "common/config-manager.h" +#include "mads/mads.h" +#include "mads/graphics.h" +#include "mads/msurface.h" +#include "mads/nebular/dialogs_nebular.h" + +namespace MADS { + +namespace Nebular { + + +} // End of namespace Nebular + +} // End of namespace MADS diff --git a/engines/mads/nebular/dialogs_nebular.h b/engines/mads/nebular/dialogs_nebular.h new file mode 100644 index 0000000000..669ac1e775 --- /dev/null +++ b/engines/mads/nebular/dialogs_nebular.h @@ -0,0 +1,42 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_GAME_NEBULAR_H +#define MADS_GAME_NEBULAR_H + +#include "common/scummsys.h" +#include "mads/game.h" + +namespace MADS { + +namespace Nebular { + +class CopyProtectionDialog { +public: + static bool show() { return false; } +}; + +} // End of namespace Nebular + +} // End of namespace MADS + +#endif /* MADS_GAME_NEBULAR_H */ diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp new file mode 100644 index 0000000000..43d705fcf8 --- /dev/null +++ b/engines/mads/nebular/game_nebular.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 "common/scummsys.h" +#include "common/config-manager.h" +#include "mads/mads.h" +#include "mads/game.h" +#include "mads/graphics.h" +#include "mads/msurface.h" +#include "mads/nebular/game_nebular.h" + +namespace MADS { + +namespace Nebular { + +GameNebular::GameNebular(MADSEngine *vm): Game(vm) { + _surface =MSurface::init(MADS_SCREEN_WIDTH, MADS_SCREEN_HEIGHT - MADS_INTERFACE_HEIGHT); +} + +bool GameNebular::checkCopyProtection() { + if (!ConfMan.getBool("copy_protection") || (ConfMan.hasKey("passed_protection") && + ConfMan.getInt("passed_protection") == 1)) + return true; + + return false; +} + +} // End of namespace Nebular + +} // End of namespace MADS diff --git a/engines/mads/nebular/game_nebular.h b/engines/mads/nebular/game_nebular.h new file mode 100644 index 0000000000..b0f088f891 --- /dev/null +++ b/engines/mads/nebular/game_nebular.h @@ -0,0 +1,45 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_GAME_NEBULAR_H +#define MADS_GAME_NEBULAR_H + +#include "common/scummsys.h" +#include "mads/game.h" + +namespace MADS { + +namespace Nebular { + +class GameNebular: public Game { + friend class Game; +protected: + GameNebular(MADSEngine *vm); + + virtual bool checkCopyProtection(); +}; + +} // End of namespace Nebular + +} // End of namespace MADS + +#endif /* MADS_GAME_NEBULAR_H */ -- cgit v1.2.3 From de384bae2ef1b904224b0fe00326e5a0597aafb6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 19 Feb 2014 23:21:05 -0500 Subject: MADS: Moved sound_nebular file into new nebular/ folder --- engines/mads/module.mk | 2 +- engines/mads/nebular/sound_nebular.cpp | 1180 ++++++++++++++++++++++++++++++++ engines/mads/nebular/sound_nebular.h | 408 +++++++++++ engines/mads/sound.h | 2 +- engines/mads/sound_nebular.cpp | 1180 -------------------------------- engines/mads/sound_nebular.h | 408 ----------- 6 files changed, 1590 insertions(+), 1590 deletions(-) create mode 100644 engines/mads/nebular/sound_nebular.cpp create mode 100644 engines/mads/nebular/sound_nebular.h delete mode 100644 engines/mads/sound_nebular.cpp delete mode 100644 engines/mads/sound_nebular.h diff --git a/engines/mads/module.mk b/engines/mads/module.mk index 3f78103f6d..9d115b8b6e 100644 --- a/engines/mads/module.mk +++ b/engines/mads/module.mk @@ -3,6 +3,7 @@ MODULE := engines/mads MODULE_OBJS := \ nebular/dialogs_nebular.o \ nebular/game_nebular.o \ + nebular/sound_nebular.o \ compression.o \ detection.o \ events.o \ @@ -15,7 +16,6 @@ MODULE_OBJS := \ palette.o \ resources.o \ sound.o \ - sound_nebular.o \ user_interface.o # This module can be built as a plugin diff --git a/engines/mads/nebular/sound_nebular.cpp b/engines/mads/nebular/sound_nebular.cpp new file mode 100644 index 0000000000..9c3ac61f2d --- /dev/null +++ b/engines/mads/nebular/sound_nebular.cpp @@ -0,0 +1,1180 @@ +/* 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 "audio/audiostream.h" +#include "audio/decoders/raw.h" +#include "common/algorithm.h" +#include "common/debug.h" +#include "common/memstream.h" +#include "mads/sound.h" +#include "mads/nebular/sound_nebular.h" + +namespace MADS { + +namespace Nebular { + +AdlibChannel::AdlibChannel() { + _activeCount = 0; + _field1 = 0; + _field2 = 0; + _field3 = 0; + _field4 = 0; + _sampleIndex = 0; + _volume = 0; + _field7 = 0; + _field8 = 0; + _field9 = 0; + _fieldA = 0; + _fieldB = 0; + _fieldC = 0; + _fieldD = 0; + _fieldE = 0; + _ptr1 = nullptr; + _pSrc = nullptr; + _ptr3 = nullptr; + _ptr4 = nullptr; + _field17 = 0; + _field19 = 0; + _soundData = nullptr; + _field1D = 0; + _field1E = 0; + _field1F = 0; +} + +void AdlibChannel::reset() { + _activeCount = 0; + _field1 = 0; + _field2 = 0; + _field3 = 0; +} + +void AdlibChannel::enable(int flag) { + if (_activeCount) { + _fieldE = flag; + + // WORKAROUND: Original set _soundData pointer to flag. Since this seems + // just intended to invalidate any prior pointer, I've replaced it with + // a simple null pointer + _soundData = nullptr; + } +} + +void AdlibChannel::setPtr2(byte *pData) { + _pSrc = pData; + _field2 = 0xFF; + _fieldA = 1; + _field9 = 1; +} + +void AdlibChannel::load(byte *pData) { + _ptr1 = _pSrc = _ptr3 = pData; + _ptr4 = _soundData = pData; + _fieldA = 0xFF; + _activeCount = 1; + _fieldD = 64; + _field1 = 0; + _field1F = 0; + _field2 = _field3 = 0; + _volume = _field7 = 0; + _field1D = _field1E = 0; + _fieldE = 0; + _field9 = 0; + _fieldB = 0; + _field17 = 0; + _field19 = 0; +} + +void AdlibChannel::check(byte *nullPtr) { + if (_activeCount && _fieldE) { + if (!_field1E) { + _pSrc = nullPtr; + _fieldE = 0; + } else { + _field2 = 0xFF; + _fieldA = 4; + if (!_field9) + _field9 = 1; + } + } +} + +/*-----------------------------------------------------------------------*/ + +AdlibSample::AdlibSample(Common::SeekableReadStream &s) { + _attackRate = s.readByte(); + _decayRate = s.readByte(); + _sustainLevel = s.readByte(); + _releaseRate = s.readByte(); + _egTyp = s.readByte() != 0; + _ksr = s.readByte() != 0; + _totalLevel = s.readByte(); + _scalingLevel = s.readByte(); + _waveformSelect = s.readByte(); + _freqMultiple = s.readByte(); + _feedback = s.readByte(); + _ampMod = s.readByte() != 0; + _vib = s.readByte(); + _alg = s.readByte(); + _fieldE = s.readByte(); + s.skip(1); + _freqMask = s.readUint16LE(); + _freqBase = s.readUint16LE(); + _field14 = s.readUint16LE(); +} + +/*-----------------------------------------------------------------------*/ + +ASound::ASound(Audio::Mixer *mixer, const Common::String &filename, int dataOffset) { + // Open up the appropriate sound file + if (!_soundFile.open(filename)) + error("Could not open file - %s", filename.c_str()); + + // Initialise fields + _activeChannelPtr = nullptr; + _samplePtr = nullptr; + _frameCounter = 0; + _isDisabled = false; + _v1 = 0; + _v2 = 0; + _activeChannelNumber = 0; + _freqMask1 = _freqMask2 = 0; + _freqBase1 = _freqBase2 = 0; + _channelNum1 = _channelNum2 = 0; + _v7 = 0; + _v8 = 0; + _v9 = 0; + _v10 = 0; + _pollResult = 0; + _resultFlag = 0; + _nullData[0] = _nullData[1] = 0; + Common::fill(&_ports[0], &_ports[256], 0); + _stateFlag = false; + _activeChannelReg = 0; + _v11 = 0; + _randomSeed = 1234; + _amDep = _vibDep = _splitPoint = true; + + _samplesTillCallback = 0; + _samplesTillCallbackRemainder = 0; + _samplesPerCallback = getRate() / CALLBACKS_PER_SECOND; + _samplesPerCallbackRemainder = getRate() % CALLBACKS_PER_SECOND; + + // Store passed parameters, and setup OPL + _dataOffset = dataOffset; + _mixer = mixer; + _opl = OPL::Config::create(); + assert(_opl); + + _opl->init(getRate()); + _mixer->playStream(Audio::Mixer::kPlainSoundType, &_soundHandle, this, -1, + Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true); + + // Initialise the Adlib + adlibInit(); + + // Reset the adlib + command0(); +} + +ASound::~ASound() { + Common::List::iterator i; + for (i = _dataCache.begin(); i != _dataCache.end(); ++i) + delete[] (*i)._data; + + _mixer->stopHandle(_soundHandle); + delete _opl; +} + +void ASound::adlibInit() { + write(4, 0x60); + write(4, 0x80); + write(2, 0xff); + write(4, 0x21); + write(4, 0x60); + write(4, 0x80); +} + +int ASound::stop() { + command0(); + int result = _pollResult; + _pollResult = 0; + return result; +} + +int ASound::poll() { + // Update any playing sounds + update(); + + // Return result + int result = _pollResult; + _pollResult = 0; + return result; +} + +void ASound::noise() { + int randomVal = getRandomNumber(); + + if (_v1) { + setFrequency(_channelNum1, ((randomVal ^ 0xFFFF) & _freqMask1) + _freqBase1); + } + + if (_v2) { + setFrequency(_channelNum2, (randomVal & _freqMask2) + _freqBase2); + } +} + +void ASound::write(int reg, int val) { + _queue.push(RegisterValue(reg, val)); +} + +int ASound::write2(int state, int reg, int val) { + // TODO: Original has a state parameter, not used when in Adlib mode? + _ports[reg] = val; + write(reg, val); + return state; +} + +void ASound::flush() { + Common::StackLock slock(_driverMutex); + + while (!_queue.empty()) { + RegisterValue v = _queue.pop(); + _opl->writeReg(v._regNum, v._value); + } +} + +void ASound::channelOn(int reg, int volume) { + write2(8, reg, (_ports[reg] & 0xC0) | (volume & 0x3F)); +} + +void ASound::channelOff(int reg) { + write2(8, reg, _ports[reg] | 0x3F); +} + +void ASound::resultCheck() { + if (_resultFlag != 1) { + _resultFlag = 1; + _pollResult = 1; + } +} + +byte *ASound::loadData(int offset, int size) { + // First scan for an existing copy + Common::List::iterator i; + for (i = _dataCache.begin(); i != _dataCache.end(); ++i) { + CachedDataEntry &e = *i; + if (e._offset == offset) + return e._data; + } + + // No existing entry found, so load up data and store as a new entry + CachedDataEntry rec; + rec._offset = offset; + rec._data = new byte[size]; + _soundFile.seek(_dataOffset + offset); + _soundFile.read(rec._data, size); + _dataCache.push_back(rec); + + // Return the data + return rec._data; +} + +void ASound::playSound(int offset, int size) { + // Load the specified data block + playSound(loadData(offset, size)); +} + +void ASound::playSound(byte *pData) { + // Scan for a high level free channel + for (int i = 5; i < ADLIB_CHANNEL_COUNT; ++i) { + if (!_channels[i]._activeCount) { + _channels[i].load(pData); + return; + } + } + + // None found, do a secondary scan for an interruptable channel + for (int i = ADLIB_CHANNEL_COUNT - 1; i >= ADLIB_CHANNEL_MIDWAY; --i) { + if (_channels[i]._fieldE == 0xFF) { + _channels[i].load(pData); + return; + } + } +} + +bool ASound::isSoundActive(byte *pData) { + for (int i = 0; i < ADLIB_CHANNEL_MIDWAY; ++i) { + if (_channels[i]._activeCount && _channels[i]._soundData == pData) + return true; + } + + return false; +} + +void ASound::setFrequency(int channel, int freq) { + write2(8, 0xA0 + channel, freq & 0xFF); + write2(8, 0xB0 + channel, (freq >> 8) | 0x20); +} + +int ASound::getRandomNumber() { + int v = 0x9248 + (int)_randomSeed; + _randomSeed = ((v >> 3) | (v << 13)) & 0xFFFF; + return _randomSeed; +} + +void ASound::update() { + getRandomNumber(); + if (_isDisabled) + return; + + ++_frameCounter; + pollChannels(); + checkChannels(); + + if (_v1 == _v2) { + if (_resultFlag != -1) { + _resultFlag = -1; + _pollResult = -1; + } + } else { + if (_v1) { + _freqBase1 += _v7; + if (!--_v1) { + if (!_v2 || _channelNum1 != _channelNum2) { + write2(8, 0xA0 + _channelNum1, 0); + write2(8, 0xB0 + _channelNum1, 0); + } + } + } + + if (_v2) { + _freqBase2 += _v8; + if (!--_v2) { + if (!_v1 || _channelNum2 != _channelNum1) { + write2(8, 0xA0 + _channelNum2, 0); + write2(8, 0xB0 + _channelNum2, 0); + } + } + } + } +} + +void ASound::pollChannels() { + _activeChannelNumber = 0; + for (int i = 0; i < ADLIB_CHANNEL_COUNT; ++i) { + _activeChannelPtr = &_channels[i]; + pollActiveChannel(); + } +} + +void ASound::checkChannels() { + for (int i = 0; i < ADLIB_CHANNEL_COUNT; ++i) + _channels[i].check(_nullData); +} + +void ASound::pollActiveChannel() { + AdlibChannel *chan = _activeChannelPtr; + bool updateFlag = true; + + if (chan->_activeCount) { + if (chan->_field8 > 0 && --chan->_field8 == 0) + updateOctave(); + + if (--_activeChannelPtr->_activeCount <= 0) { + for (;;) { + byte *pSrc = chan->_pSrc; + if (!(*pSrc & 0x80) || (*pSrc <= 0xF0)) { + if (updateFlag) + updateActiveChannel(); + + chan->_field4 = *pSrc++; + chan->_activeCount = *pSrc++; + chan->_pSrc += 2; + + if (!chan->_field4 || !chan->_activeCount) { + updateOctave(); + } else { + chan->_field8 = chan->_activeCount - chan->_field7; + updateChannelState(); + } + + // Break out of processing loop + break; + } else { + updateFlag = false; + + switch ((~*pSrc) & 0xF) { + case 0: + if (!chan->_field17) { + if (*++pSrc == 0) { + chan->_pSrc += 2; + chan->_ptr3 = chan->_pSrc; + chan->_field17 = 0; + } else { + chan->_field17 = *pSrc; + chan->_pSrc = chan->_ptr3; + } + } else if (--chan->_field17) { + chan->_pSrc = chan->_ptr3; + } else { + chan->_pSrc += 2; + chan->_ptr3 = chan->_pSrc; + } + break; + + case 1: + if (!chan->_field19) { + if (*++pSrc == 0) { + chan->_pSrc += 2; + chan->_ptr4 = chan->_pSrc; + chan->_ptr3 = chan->_pSrc; + chan->_field17 = 0; + chan->_field19 = 0; + } else { + chan->_field19 = *pSrc; + chan->_pSrc = chan->_ptr4; + chan->_ptr3 = chan->_ptr4; + } + } else if (--chan->_field19) { + chan->_ptr4 = chan->_pSrc; + chan->_ptr3 = chan->_pSrc; + } else { + chan->_pSrc += 2; + chan->_ptr4 = chan->_pSrc; + chan->_ptr3 = chan->_pSrc; + } + break; + + case 2: + // Loop sound data + chan->_field1 = 0; + chan->_field2 = chan->_field3 = 0; + chan->_volume = chan->_field7 = 0; + chan->_field1D = chan->_field1E = 0; + chan->_field8 = 0; + chan->_field9 = 0; + chan->_fieldB = 0; + chan->_field17 = 0; + chan->_field19 = 0; + chan->_fieldD = 0x40; + chan->_ptr1 = chan->_soundData; + chan->_pSrc = chan->_soundData; + chan->_ptr3 = chan->_soundData; + chan->_ptr4 = chan->_soundData; + + chan->_pSrc += 2; + break; + + case 3: + chan->_sampleIndex = *++pSrc; + chan->_pSrc += 2; + loadSample(chan->_sampleIndex); + break; + + case 4: + chan->_field7 = *++pSrc; + chan->_pSrc += 2; + break; + + case 5: + chan->_field1 = *++pSrc; + chan->_pSrc += 2; + break; + + case 6: + ++pSrc; + if (chan->_fieldE) { + chan->_pSrc += 2; + } else { + chan->_volume = *pSrc >> 1; + updateFlag = true; + chan->_pSrc += 2; + } + break; + + case 7: + ++pSrc; + if (!chan->_fieldE) { + chan->_fieldA = *pSrc; + chan->_field2 = *++pSrc; + chan->_field9 = 1; + } + + chan->_pSrc += 3; + break; + + case 8: + chan->_field1D = *++pSrc; + chan->_pSrc += 2; + break; + + case 9: { + int v1 = *++pSrc; + ++pSrc; + int v2 = (v1 - 1) & getRandomNumber(); + int v3 = pSrc[v2]; + int v4 = pSrc[v1]; + + pSrc[v4 + v1 + 1] = v3; + chan->_pSrc += v1 + 3; + break; + } + + case 10: + ++pSrc; + if (chan->_fieldE) { + chan->_pSrc += 2; + } else { + chan->_field1E = *pSrc >> 1; + updateFlag = true; + chan->_pSrc += 2; + } + break; + + case 11: + chan->_fieldD = *++pSrc; + updateFlag = true; + chan->_pSrc += 2; + break; + + case 12: + chan->_fieldC = *++pSrc; + chan->_field3 = *++pSrc; + chan->_fieldB = 1; + chan->_pSrc += 2; + break; + + case 13: + ++pSrc; + chan->_pSrc += 2; + break; + + case 14: + chan->_field1F = *++pSrc; + chan->_pSrc += 2; + break; + + default: + break; + } + } + } + } + + if (chan->_field1) + updateFNumber(); + + updateFlag = false; + if (chan->_field9 || chan->_fieldB) { + if (!--chan->_field9) { + chan->_field9 = chan->_fieldA; + if (chan->_field2) { + int8 newVal = (int8)chan->_field2 + (int8)chan->_field1E; + if (newVal < 0) { + chan->_field9 = 0; + newVal = 0; + } else if (newVal > 63) { + chan->_field9 = 0; + newVal = 63; + } + + chan->_field1E = newVal; + updateFlag = true; + } + } + + if (!--chan->_fieldB) { + chan->_fieldB = chan->_fieldC; + if (chan->_field3) { + chan->_fieldD = chan->_field3; + updateFlag = true; + } + } + + if (updateFlag) + updateActiveChannel(); + } + } + + ++_activeChannelNumber; +} + +void ASound::updateOctave() { + int reg = 0xB0 + _activeChannelNumber; + write2(8, reg, _ports[reg] & 0xDF); +} + +static int _vList1[] = { + 0x200, 0x21E, 0x23F, 0x261, 0x285, 0x2AB, + 0x2D4, 0x2FF, 0x32D, 0x35D, 0x390, 0x3C7 +}; + +void ASound::updateChannelState() { + updateActiveChannel(); + + if (_channelData[_activeChannelNumber]._field0) { + if (_channelNum1 == _activeChannelNumber) + _stateFlag = 0; + if (_channelNum2 == _activeChannelNumber) + _stateFlag = 1; + + if (!_stateFlag) { + _stateFlag = 1; + if (_v1) + write2(8, 0xB0 + _channelNum1, _ports[0xB0 + _channelNum1] & 0xDF); + + _channelNum1 = _activeChannelNumber; + _v1 = _channelData[_channelNum1]._field0; + _freqMask1 = _channelData[_channelNum1]._freqMask; + _freqBase1 = _channelData[_channelNum1]._freqBase; + _v7 = _channelData[_channelNum1]._field6; + } else { + _stateFlag = 0; + if (_v2) + write2(8, 0xB0 + _channelNum2, _ports[0xB0 + _channelNum2] & 0xDF); + + _channelNum2 = _activeChannelNumber; + _v2 = _channelData[_channelNum2]._field0; + _freqMask2 = _channelData[_channelNum2]._freqMask; + _freqBase2 = _channelData[_channelNum2]._freqBase; + _v8 = _channelData[_channelNum2]._field6; + } + + resultCheck(); + } else { + int reg = 0xA0 + _activeChannelNumber; + int vTimes = (_activeChannelPtr->_field4 + _activeChannelPtr->_field1F) / 12; + int vOffset = (_activeChannelPtr->_field4 + _activeChannelPtr->_field1F) % 12; + int val = _vList1[vOffset] + _activeChannelPtr->_field1D; + write2(8, reg, val & 0xFF); + + reg += 0x10; + write2(8, reg, (_ports[reg] & 0x20) | (vTimes << 2) | (val >> 8)); + + write2(8, reg, _ports[reg] | 0x20); + } +} + +static const int outputIndexes[] = { + 3, 1, 4, 2, 5, 6, 9, 7, 10, 8, 11, 12, 15, 13, 16, 14, 17 +}; +static const int outputChannels[] = { + 0, 1, 2, 3, 4, 5, 8, 9, 10, 11, 12, 13, 16, 17, 18, 19, 20, 21, 0 +}; +static const int volumeList[] = { + 0x3F, 0x3F, 0x36, 0x31, 0x2D, 0x2A, 0x28, 0x26, 0x24, 0x22, 0x21, 0x20, 0x1F, 0x1E, 0x1D, 0x1C, + 0x1B, 0x1A, 0x19, 0x19, 0x18, 0x17, 0x17, 0x16, 0x16, 0x15, 0x15, 0x14, 0x14, 0x13, 0x12, 0x12, + 0x11, 0x11, 0x10, 0x10, 0x0F, 0x0F, 0x0E, 0x0E, 0x0D, 0x0D, 0x0C, 0x0C, 0x0B, 0x0B, 0x0A, 0x0A, + 0x0A, 0x09, 0x09, 0x09, 0x09, 0x09, 0x08, 0x08, 0x08, 0x08, 0x08, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +void ASound::updateActiveChannel() { + int reg = 0x40 + outputChannels[outputIndexes[_activeChannelNumber * 2]]; + int portVal = _ports[reg] & 0xFFC0; + int newVolume = CLIP(_activeChannelPtr->_volume + _activeChannelPtr->_field1E, 0, 63); + + // Note: Original had a whole block not seeming to be used, since the initialisation + // sets a variable to 5660h, and doesn't change it, so the branch is never taken + int val = CLIP(newVolume - volumeList[_activeChannelPtr->_fieldD], 0, 63); + val = (63 - val) | portVal; + + int val2 = CLIP(newVolume - volumeList[-(_activeChannelPtr->_fieldD - 127)], 0, 63); + val2 = (63 - val2) | portVal; + write2(0, reg, val); + write2(2, reg, val2); +} + +void ASound::loadSample(int sampleIndex) { + _activeChannelReg = 0xB0 + _activeChannelNumber; + write2(8, _activeChannelReg, _ports[_activeChannelReg] & 0xDF); + + _activeChannelReg = _activeChannelNumber; + _samplePtr = &_samples[sampleIndex * 2]; + _v11 = outputChannels[outputIndexes[_activeChannelReg * 2 - 1]]; + processSample(); + + AdlibChannelData &cd = _channelData[_activeChannelNumber]; + cd._field6 = _samplePtr->_field14; + cd._freqBase = _samplePtr->_freqBase; + cd._freqMask = _samplePtr->_freqMask; + cd._field0 = _samplePtr->_fieldE; + + _samplePtr = &_samples[sampleIndex * 2 + 1]; + _v11 = outputChannels[outputIndexes[_activeChannelReg * 2]]; + processSample(); +} + +void ASound::processSample() { + // Write out vib flags and split point + write2(8, 0x40 + _v11, 0x3F); + int depthRhythm = (_ports[0xBD] & 0x3F) | (_amDep ? 0x80 : 0) | + (_vibDep ? 0x40 : 0); + write2(8, 0xBD, depthRhythm); + write2(8, 8, _splitPoint ? 0x40 : 0); + + // Write out feedback & Alg + int val = (_samplePtr->_feedback << 1) | (1 - _samplePtr->_alg); + write2(8, 0xC0 + _activeChannelReg, val); + + // Write out attack/decay rate + val = (_samplePtr->_attackRate << 4) | (_samplePtr->_decayRate & 0xF); + write2(8, 0x60 + _v11, val); + + // Write out sustain level/release rate + val = (_samplePtr->_sustainLevel << 4) | (_samplePtr->_releaseRate & 0xF); + write2(8, 0x80 + _v11, val); + + // Write out misc flags + val = (_samplePtr->_ampMod ? 0x80 : 0) | (_samplePtr->_vib ? 0x40 : 0) + | (_samplePtr->_egTyp ? 0x20 : 0) | (_samplePtr->_ksr ? 0x10 : 0) + | (_samplePtr->_freqMultiple & 0xF); + write2(8, 0x20 + _v11, val); + + // Write out waveform select + write2(8, 0xE0 + _v11, _samplePtr->_waveformSelect & 3); + + // Write out total level & scaling level + val = -((_samplePtr->_totalLevel & 0x3F) - 0x3F) | (_samplePtr->_scalingLevel << 6); + write2(8, 0x40 + _v11, val); +} + +void ASound::updateFNumber() { + int loReg = 0xA0 + _activeChannelNumber; + int hiReg = 0xB0 + _activeChannelNumber; + int val1 = (_ports[hiReg] & 0x1F) << 8; + val1 += _ports[loReg] + _activeChannelPtr->_field1; + write2(8, loReg, val1); + + int val2 = (_ports[hiReg] & 0x20) | (val1 >> 8); + write2(8, hiReg, val2); +} + +int ASound::readBuffer(int16 *buffer, const int numSamples) { + Common::StackLock slock(_driverMutex); + + int32 samplesLeft = numSamples; + memset(buffer, 0, sizeof(int16) * numSamples); + while (samplesLeft) { + if (!_samplesTillCallback) { + poll(); + flush(); + + _samplesTillCallback = _samplesPerCallback; + _samplesTillCallbackRemainder += _samplesPerCallbackRemainder; + if (_samplesTillCallbackRemainder >= CALLBACKS_PER_SECOND) { + _samplesTillCallback++; + _samplesTillCallbackRemainder -= CALLBACKS_PER_SECOND; + } + } + + int32 render = MIN(samplesLeft, _samplesTillCallback); + samplesLeft -= render; + _samplesTillCallback -= render; + + _opl->readBuffer(buffer, render); + buffer += render; + } + return numSamples; +} + +int ASound::command0() { + bool isDisabled = _isDisabled; + _isDisabled = true; + + for (int i = 0; i < ADLIB_CHANNEL_COUNT; ++i) + _channels[i].reset(); + + _v1 = 0; + _v2 = 0; + _freqMask1 = _freqMask2 = 0; + _freqBase1 = _freqBase2 = 0; + _v7 = 0; + _v8 = 0; + + // Reset Adlib port registers + for (int reg = 0x4F; reg >= 0x40; --reg) + write2(8, reg, 0x3F); + for (int reg = 0xFF; reg >= 0x60; --reg) + write2(8, reg, 0); + for (int reg = 0x3F; reg > 0; --reg) + write2(8, reg, 0); + write2(8, 1, 0x20); + + _isDisabled = isDisabled; + return 0; +} + +int ASound::command1() { + for (int i = 0; i < ADLIB_CHANNEL_COUNT; ++i) + _channels[i].enable(0xFF); + return 0; +} + +int ASound::command2() { + for (int i = 0; i < ADLIB_CHANNEL_MIDWAY; ++i) + _channels[i].setPtr2(_nullData); + return 0; +} + +int ASound::command3() { + for (int i = 0; i < ADLIB_CHANNEL_MIDWAY; ++i) + _channels[i].enable(0xFF); + return 0; +} + +int ASound::command4() { + for (int i = ADLIB_CHANNEL_MIDWAY; i < ADLIB_CHANNEL_COUNT; ++i) + _channels[i].setPtr2(_nullData); + return 0; +} + +int ASound::command5() { + for (int i = 5; i < ADLIB_CHANNEL_COUNT; ++i) + _channels[i].enable(0xFF); + return 0; +} + +int ASound::command6() { + _v9 = _v1; + _v1 = 0; + _v10 = _v2; + _v2 = 0; + + channelOff(0x43); + channelOff(0x44); + channelOff(0x45); + channelOff(0x4B); + channelOff(0x4C); + channelOff(0x4D); + channelOff(0x53); + channelOff(0x54); + channelOff(0x55); + + return 0; +} + +int ASound::command7() { + channelOn(0x43, _channels[0]._volume); + channelOn(0x44, _channels[1]._volume); + channelOn(0x45, _channels[2]._volume); + channelOn(0x4B, _channels[3]._volume); + channelOn(0x4C, _channels[4]._volume); + channelOn(0x4D, _channels[5]._volume); + + _v1 = _v9; + _v2 = _v10; + + if (_v9 != _v10) + resultCheck(); + + _isDisabled = 0; + return _v10; +} + +int ASound::command8() { + int result = 0; + for (int i = 0; i < ADLIB_CHANNEL_COUNT; ++i) + result |= _channels[i]._activeCount; + + return result; +} + +/*-----------------------------------------------------------------------*/ + +const ASound1::CommandPtr ASound1::_commandList[42] = { + &ASound1::command0, &ASound1::command1, &ASound1::command2, &ASound1::command3, + &ASound1::command4, &ASound1::command5, &ASound1::command6, &ASound1::command7, + &ASound1::command8, &ASound1::command9, &ASound1::command10, &ASound1::command11, + &ASound1::command12, &ASound1::command13, &ASound1::command14, &ASound1::command15, + &ASound1::command16, &ASound1::command17, &ASound1::command18, &ASound1::command19, + &ASound1::command20, &ASound1::command21, &ASound1::command22, &ASound1::command23, + &ASound1::command24, &ASound1::command25, &ASound1::command26, &ASound1::command27, + &ASound1::command28, &ASound1::command29, &ASound1::command30, &ASound1::command31, + &ASound1::command32, &ASound1::command33, &ASound1::command34, &ASound1::command35, + &ASound1::command36, &ASound1::command37, &ASound1::command38, &ASound1::command39, + &ASound1::command40, &ASound1::command41 +}; + +ASound1::ASound1(Audio::Mixer *mixer): ASound(mixer, "asound.001", 0x1520) { + _cmd23Toggle = false; + + // Load sound samples + _soundFile.seek(_dataOffset + 0x12C); + for (int i = 0; i < 98; ++i) + _samples.push_back(AdlibSample(_soundFile)); +} + +int ASound1::command(int commandId) { + if (commandId > 41) + return 0; + + _frameCounter = 0; + return (this->*_commandList[commandId])(); +} + +int ASound1::command9() { + playSound(0xC68, 12); + return 0; +} + +int ASound1::command10() { + byte *pData1 = loadData(0x130E, 48); + if (!isSoundActive(pData1)) { + command1(); + _channels[0].load(pData1); + _channels[1].load(loadData(0x133E, 392)); + _channels[2].load(loadData(0x14C6, 46)); + _channels[3].load(loadData(0x14F4, 48)); + } + + return 0; +} + +int ASound1::command11() { + command111213(); + _channels[0]._field1E = 0; + _channels[1]._field1E = 0; + return 0; +} + +int ASound1::command12() { + command111213(); + _channels[0]._field1E = 40; + _channels[1]._field1E = 0; + return 0; +} + +int ASound1::command13() { + command111213(); + _channels[0]._field1E = 40; + _channels[1]._field1E = 50; + return 0; +} + +int ASound1::command14() { + playSound(0x1216, 248); + return 0; +} + +int ASound1::command15() { + byte *pData1 = loadData(0x1524, 152); + if (!isSoundActive(pData1)) { + command1(); + _channels[4].load(pData1); + _channels[5].load(loadData(0x15BC, 94)); + _channels[6].load(loadData(0x161A, 94)); + _channels[7].load(loadData(0x1678, 42)); + _channels[8].load(loadData(0x16A2, 42)); + } + + return 0; +} + +int ASound1::command16() { + playSound(0xC74, 14); + return 0; +} + +int ASound1::command17() { + playSound(0xE9A, 10); + return 0; +} + +int ASound1::command18() { + command1(); + playSound(0xCA6, 20); + return 0; +} + +int ASound1::command19() { + command1(); + playSound(0xCBA, 74); + return 0; +} + +int ASound1::command20() { + byte *pData = loadData(0xD18, 28); + if (!isSoundActive(pData)) + playSound(pData); + return 0; +} + +int ASound1::command21() { + playSound(0xD04, 20); + return 0; +} + +int ASound1::command22() { + byte *pData = loadData(0xD34, 10); + pData[6] = (getRandomNumber() & 7) + 85; + + if (!isSoundActive(pData)) + playSound(pData); + + return 0; +} + +int ASound1::command23() { + _cmd23Toggle = !_cmd23Toggle; + playSound(_cmd23Toggle ? 0xD3E : 0xD46, 8); + return 0; +} + +int ASound1::command24() { + playSound(0xD4E, 18); + playSound(0xD60, 20); + playSound(0xD74, 14); + return 0; +} + +int ASound1::command25() { + byte *pData = loadData(0xD82, 16); + if (!isSoundActive(pData)) + playSound(pData); + + return 0; +} + +int ASound1::command26() { + error("TODO: command26"); + return 0; +} + +int ASound1::command27() { + error("TODO: ASound::command27"); + return 0; +} + +int ASound1::command28() { + playSound(0xD92, 28); + return 0; +} + +int ASound1::command29() { + error("TODO: ASound::command29"); + return 0; +} + +int ASound1::command30() { + error("TODO: ASound::command30"); + return 0; +} + +int ASound1::command31() { + byte *pData = loadData(0xDAE, 14); + if (!isSoundActive(pData)) + playSound(pData); + + return 0; +} + +int ASound1::command32() { + error("TODO: ASound::command32"); + return 0; +} + +int ASound1::command33() { + playSound(0xDBC, 10); + playSound(0xDC6, 10); + return 0; +} + +int ASound1::command34() { + int v = getRandomNumber() & 0x20; + if (!v) + v = 0x60; + + byte *pData = loadData(0xDD0, 22); + pData[8] = pData[15] = v; + playSound(pData); + return 0; +} + +int ASound1::command35() { + playSound(0xDE6, 16); + return 0; +} + +int ASound1::command36() { + playSound(0xE10, 10); + command34(); + + return 0; +} + +int ASound1::command37() { + playSound(0xE1A, 14); + return 0; +} + +int ASound1::command38() { + playSound(0xE28, 114); + return 0; +} + +int ASound1::command39() { + byte *pData1 = loadData(0x16CC, 82); + if (!isSoundActive(pData1)) { + _channels[5].load(pData1); + _channels[6].load(loadData(0x171E, 30)); + _channels[7].load(loadData(0x173C, 40)); + _channels[8].load(loadData(0x1764, 64)); + } + return 0; +} + +int ASound1::command40() { + playSound(0xDF6, 26); + return 0; +} + +int ASound1::command41() { + playSound(0xC32, 34); + playSound(0xC54, 20); + return 0; +} + +void ASound1::command111213() { + byte *pData1 = loadData(0xEF6, 408); + if (!isSoundActive(pData1)) { + command1(); + _channels[0].load(pData1); + _channels[1].load(loadData(0x108E, 266)); + _channels[2].load(loadData(0x1198, 66)); + _channels[2].load(loadData(0x11DA, 60)); + } +} + +void ASound1::command2627293032() { + // TODO: This method takes a parameter off the stack for several levels up. + // i.e. something the caller's caller pushed onto the stack. Need to figure + // out a better way to pass parameters down if this is actually in use. +} + +} // End of namespace Nebular + +} // End of namespace MADS diff --git a/engines/mads/nebular/sound_nebular.h b/engines/mads/nebular/sound_nebular.h new file mode 100644 index 0000000000..11836e6559 --- /dev/null +++ b/engines/mads/nebular/sound_nebular.h @@ -0,0 +1,408 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_SOUND_NEBULAR_H +#define MADS_SOUND_NEBULAR_H + +#include "common/scummsys.h" +#include "common/file.h" +#include "common/mutex.h" +#include "common/queue.h" +#include "audio/audiostream.h" +#include "audio/fmopl.h" +#include "audio/mixer.h" + +namespace MADS { + +class SoundManager; + +namespace Nebular { + +/** + * Represents the data for a channel on the Adlib + */ +class AdlibChannel { +public: + int _activeCount; + int _field1; + int _field2; + int _field3; + int _field4; + int _sampleIndex; + int _volume; + int _field7; + int _field8; + int _field9; + int _fieldA; + uint8 _fieldB; + int _fieldC; + int _fieldD; + int _fieldE; + byte *_ptr1; + byte *_pSrc; + byte *_ptr3; + byte *_ptr4; + int _field17; + int _field19; + byte *_soundData; + int _field1D; + int _field1E; + int _field1F; +public: + AdlibChannel(); + + void reset(); + void enable(int flag); + void setPtr2(byte *pData); + void load(byte *pData); + void check(byte *nullPtr); +}; + +class AdlibChannelData { +public: + int _field0; + int _freqMask; + int _freqBase; + int _field6; +}; + +class AdlibSample { +public: + int _attackRate; + int _decayRate; + int _sustainLevel; + int _releaseRate; + bool _egTyp; + bool _ksr; + int _totalLevel; + int _scalingLevel; + int _waveformSelect; + int _freqMultiple; + int _feedback; + bool _ampMod; + int _vib; + int _alg; + int _fieldE; + int _freqMask; + int _freqBase; + int _field14; + + AdlibSample() {} + AdlibSample(Common::SeekableReadStream &s); +}; + +struct RegisterValue { + uint8 _regNum; + uint8 _value; + + RegisterValue(int regNum, int value) { + _regNum = regNum; _value = value; + } +}; + +#define ADLIB_CHANNEL_COUNT 9 +#define ADLIB_CHANNEL_MIDWAY 5 +#define CALLBACKS_PER_SECOND 60 + +/** + * Base class for the sound player resource files + */ +class ASound: public Audio::AudioStream { +private: + struct CachedDataEntry { + int _offset; + byte *_data; + }; + Common::List _dataCache; + uint16 _randomSeed; + + /** + * Does the initial Adlib initialisation + */ + void adlibInit(); + + /** + * Does on-going processing for the Adlib sounds being played + */ + void update(); + + /** + * Polls each of the channels for updates + */ + void pollChannels(); + + /** + * Checks the status of the channels + */ + void checkChannels(); + + /** + * Polls the currently active channel + */ + void pollActiveChannel(); + + /** + * Updates the octave of the currently active channel + */ + void updateOctave(); + + void updateChannelState(); + void updateActiveChannel(); + + /** + * Loads up the specified sample + */ + void loadSample(int sampleIndex); + + /** + * Writes out the data of the selected sample to the Adlib + */ + void processSample(); + + void updateFNumber(); +protected: + /** + * Queue a byte for an Adlib register + */ + void write(int reg, int val); + + /** + * Queue a byte for an Adlib register, and store it in the _ports array + */ + int write2(int state, int reg, int val); + + /** + * Flush any pending Adlib register values to the OPL driver + */ + void flush(); + + /** + * Turn a channel on + */ + void channelOn(int reg, int volume); + + /** + * Turn a channel off + */ + void channelOff(int reg); + + /** + * Checks for whether a poll result needs to be set + */ + void resultCheck(); + + /** + * Loads a data block from the sound file, caching the result for any future + * calls for the same data + */ + byte *loadData(int offset, int size); + + /** + * Play the specified sound + * @param offset Offset of sound data within sound player data segment + * @param size Size of sound data block + */ + void playSound(int offset, int size); + + /** + * Play the specified raw sound data + * @param pData Pointer to data block containing sound data + */ + void playSound(byte *pData); + + /** + * Checks to see whether the given block of data is already loaded into a channel. + */ + bool isSoundActive(byte *pData); + + /** + * Sets the frequency for a given channel. + */ + void setFrequency(int channel, int freq); + + /** + * Returns a 16-bit random number + */ + int getRandomNumber(); + + int command0(); + int command1(); + int command2(); + int command3(); + int command4(); + int command5(); + int command6(); + int command7(); + int command8(); +public: + Audio::Mixer *_mixer; + FM_OPL *_opl; + Audio::SoundHandle _soundHandle; + AdlibChannel _channels[ADLIB_CHANNEL_COUNT]; + AdlibChannel *_activeChannelPtr; + AdlibChannelData _channelData[11]; + Common::Array _samples; + AdlibSample *_samplePtr; + Common::File _soundFile; + Common::Queue _queue; + Common::Mutex _driverMutex; + int _dataOffset; + int _frameCounter; + bool _isDisabled; + int _v1; + int _v2; + int _activeChannelNumber; + int _freqMask1; + int _freqMask2; + int _freqBase1; + int _freqBase2; + int _channelNum1, _channelNum2; + int _v7; + int _v8; + int _v9; + int _v10; + int _pollResult; + int _resultFlag; + byte _nullData[2]; + int _ports[256]; + bool _stateFlag; + int _activeChannelReg; + int _v11; + bool _amDep, _vibDep, _splitPoint; + int _samplesPerCallback; + int _samplesPerCallbackRemainder; + int _samplesTillCallback; + int _samplesTillCallbackRemainder; +public: + /** + * Constructor + * @param filename Specifies the adlib sound player file to use + * @param dataOffset Offset in the file of the data segment + */ + ASound(Audio::Mixer *mixer, const Common::String &filename, int dataOffset); + + /** + * Destructor + */ + virtual ~ASound(); + + /** + * Execute a player command. Most commands represent sounds to play, but some + * low number commands also provide control operations + */ + virtual int command(int commandId) = 0; + + /** + * Stop all currently playing sounds + */ + int stop(); + + /** + * Main poll method to allow sounds to progress + */ + int poll(); + + /** + * General noise/note output + */ + void noise(); + + /** + * Return the current frame counter + */ + int getFrameCounter() { return _frameCounter; } + + // AudioStream interface + /** + * Main buffer read + */ + virtual int readBuffer(int16 *buffer, const int numSamples); + + /** + * Mono sound only + */ + virtual bool isStereo() const { return false; } + + /** + * Data is continuously pushed, so definitive end + */ + virtual bool endOfData() const { return false; } + + /** + * Return sample rate + */ + virtual int getRate() const { return 11025; } +}; + +class ASound1: public ASound { +private: + typedef int (ASound1::*CommandPtr)(); + static const CommandPtr _commandList[42]; + bool _cmd23Toggle; + + int command9(); + int command10(); + int command11(); + int command12(); + int command13(); + int command14(); + int command15(); + int command16(); + int command17(); + int command18(); + int command19(); + int command20(); + int command21(); + int command22(); + int command23(); + int command24(); + int command25(); + int command26(); + int command27(); + int command28(); + int command29(); + int command30(); + int command31(); + int command32(); + int command33(); + int command34(); + int command35(); + int command36(); + int command37(); + int command38(); + int command39(); + int command40(); + int command41(); + + void command111213(); + void command2627293032(); +public: + ASound1(Audio::Mixer *mixer); + + virtual int command(int commandId); +}; + +} // End of namespace Nebular + +} // End of namespace MADS + +#endif /* MADS_SOUND_NEBULAR_H */ diff --git a/engines/mads/sound.h b/engines/mads/sound.h index cbd6511518..7a9a4ef29b 100644 --- a/engines/mads/sound.h +++ b/engines/mads/sound.h @@ -26,7 +26,7 @@ #include "common/scummsys.h" #include "audio/audiostream.h" #include "audio/mixer.h" -#include "mads/sound_nebular.h" +#include "mads/nebular/sound_nebular.h" namespace MADS { diff --git a/engines/mads/sound_nebular.cpp b/engines/mads/sound_nebular.cpp deleted file mode 100644 index 7c1410c24c..0000000000 --- a/engines/mads/sound_nebular.cpp +++ /dev/null @@ -1,1180 +0,0 @@ -/* 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 "audio/audiostream.h" -#include "audio/decoders/raw.h" -#include "common/algorithm.h" -#include "common/debug.h" -#include "common/memstream.h" -#include "mads/sound.h" -#include "mads/sound_nebular.h" - -namespace MADS { - -namespace Nebular { - -AdlibChannel::AdlibChannel() { - _activeCount = 0; - _field1 = 0; - _field2 = 0; - _field3 = 0; - _field4 = 0; - _sampleIndex = 0; - _volume = 0; - _field7 = 0; - _field8 = 0; - _field9 = 0; - _fieldA = 0; - _fieldB = 0; - _fieldC = 0; - _fieldD = 0; - _fieldE = 0; - _ptr1 = nullptr; - _pSrc = nullptr; - _ptr3 = nullptr; - _ptr4 = nullptr; - _field17 = 0; - _field19 = 0; - _soundData = nullptr; - _field1D = 0; - _field1E = 0; - _field1F = 0; -} - -void AdlibChannel::reset() { - _activeCount = 0; - _field1 = 0; - _field2 = 0; - _field3 = 0; -} - -void AdlibChannel::enable(int flag) { - if (_activeCount) { - _fieldE = flag; - - // WORKAROUND: Original set _soundData pointer to flag. Since this seems - // just intended to invalidate any prior pointer, I've replaced it with - // a simple null pointer - _soundData = nullptr; - } -} - -void AdlibChannel::setPtr2(byte *pData) { - _pSrc = pData; - _field2 = 0xFF; - _fieldA = 1; - _field9 = 1; -} - -void AdlibChannel::load(byte *pData) { - _ptr1 = _pSrc = _ptr3 = pData; - _ptr4 = _soundData = pData; - _fieldA = 0xFF; - _activeCount = 1; - _fieldD = 64; - _field1 = 0; - _field1F = 0; - _field2 = _field3 = 0; - _volume = _field7 = 0; - _field1D = _field1E = 0; - _fieldE = 0; - _field9 = 0; - _fieldB = 0; - _field17 = 0; - _field19 = 0; -} - -void AdlibChannel::check(byte *nullPtr) { - if (_activeCount && _fieldE) { - if (!_field1E) { - _pSrc = nullPtr; - _fieldE = 0; - } else { - _field2 = 0xFF; - _fieldA = 4; - if (!_field9) - _field9 = 1; - } - } -} - -/*-----------------------------------------------------------------------*/ - -AdlibSample::AdlibSample(Common::SeekableReadStream &s) { - _attackRate = s.readByte(); - _decayRate = s.readByte(); - _sustainLevel = s.readByte(); - _releaseRate = s.readByte(); - _egTyp = s.readByte() != 0; - _ksr = s.readByte() != 0; - _totalLevel = s.readByte(); - _scalingLevel = s.readByte(); - _waveformSelect = s.readByte(); - _freqMultiple = s.readByte(); - _feedback = s.readByte(); - _ampMod = s.readByte() != 0; - _vib = s.readByte(); - _alg = s.readByte(); - _fieldE = s.readByte(); - s.skip(1); - _freqMask = s.readUint16LE(); - _freqBase = s.readUint16LE(); - _field14 = s.readUint16LE(); -} - -/*-----------------------------------------------------------------------*/ - -ASound::ASound(Audio::Mixer *mixer, const Common::String &filename, int dataOffset) { - // Open up the appropriate sound file - if (!_soundFile.open(filename)) - error("Could not open file - %s", filename.c_str()); - - // Initialise fields - _activeChannelPtr = nullptr; - _samplePtr = nullptr; - _frameCounter = 0; - _isDisabled = false; - _v1 = 0; - _v2 = 0; - _activeChannelNumber = 0; - _freqMask1 = _freqMask2 = 0; - _freqBase1 = _freqBase2 = 0; - _channelNum1 = _channelNum2 = 0; - _v7 = 0; - _v8 = 0; - _v9 = 0; - _v10 = 0; - _pollResult = 0; - _resultFlag = 0; - _nullData[0] = _nullData[1] = 0; - Common::fill(&_ports[0], &_ports[256], 0); - _stateFlag = false; - _activeChannelReg = 0; - _v11 = 0; - _randomSeed = 1234; - _amDep = _vibDep = _splitPoint = true; - - _samplesTillCallback = 0; - _samplesTillCallbackRemainder = 0; - _samplesPerCallback = getRate() / CALLBACKS_PER_SECOND; - _samplesPerCallbackRemainder = getRate() % CALLBACKS_PER_SECOND; - - // Store passed parameters, and setup OPL - _dataOffset = dataOffset; - _mixer = mixer; - _opl = OPL::Config::create(); - assert(_opl); - - _opl->init(getRate()); - _mixer->playStream(Audio::Mixer::kPlainSoundType, &_soundHandle, this, -1, - Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true); - - // Initialise the Adlib - adlibInit(); - - // Reset the adlib - command0(); -} - -ASound::~ASound() { - Common::List::iterator i; - for (i = _dataCache.begin(); i != _dataCache.end(); ++i) - delete[] (*i)._data; - - _mixer->stopHandle(_soundHandle); - delete _opl; -} - -void ASound::adlibInit() { - write(4, 0x60); - write(4, 0x80); - write(2, 0xff); - write(4, 0x21); - write(4, 0x60); - write(4, 0x80); -} - -int ASound::stop() { - command0(); - int result = _pollResult; - _pollResult = 0; - return result; -} - -int ASound::poll() { - // Update any playing sounds - update(); - - // Return result - int result = _pollResult; - _pollResult = 0; - return result; -} - -void ASound::noise() { - int randomVal = getRandomNumber(); - - if (_v1) { - setFrequency(_channelNum1, ((randomVal ^ 0xFFFF) & _freqMask1) + _freqBase1); - } - - if (_v2) { - setFrequency(_channelNum2, (randomVal & _freqMask2) + _freqBase2); - } -} - -void ASound::write(int reg, int val) { - _queue.push(RegisterValue(reg, val)); -} - -int ASound::write2(int state, int reg, int val) { - // TODO: Original has a state parameter, not used when in Adlib mode? - _ports[reg] = val; - write(reg, val); - return state; -} - -void ASound::flush() { - Common::StackLock slock(_driverMutex); - - while (!_queue.empty()) { - RegisterValue v = _queue.pop(); - _opl->writeReg(v._regNum, v._value); - } -} - -void ASound::channelOn(int reg, int volume) { - write2(8, reg, (_ports[reg] & 0xC0) | (volume & 0x3F)); -} - -void ASound::channelOff(int reg) { - write2(8, reg, _ports[reg] | 0x3F); -} - -void ASound::resultCheck() { - if (_resultFlag != 1) { - _resultFlag = 1; - _pollResult = 1; - } -} - -byte *ASound::loadData(int offset, int size) { - // First scan for an existing copy - Common::List::iterator i; - for (i = _dataCache.begin(); i != _dataCache.end(); ++i) { - CachedDataEntry &e = *i; - if (e._offset == offset) - return e._data; - } - - // No existing entry found, so load up data and store as a new entry - CachedDataEntry rec; - rec._offset = offset; - rec._data = new byte[size]; - _soundFile.seek(_dataOffset + offset); - _soundFile.read(rec._data, size); - _dataCache.push_back(rec); - - // Return the data - return rec._data; -} - -void ASound::playSound(int offset, int size) { - // Load the specified data block - playSound(loadData(offset, size)); -} - -void ASound::playSound(byte *pData) { - // Scan for a high level free channel - for (int i = 5; i < ADLIB_CHANNEL_COUNT; ++i) { - if (!_channels[i]._activeCount) { - _channels[i].load(pData); - return; - } - } - - // None found, do a secondary scan for an interruptable channel - for (int i = ADLIB_CHANNEL_COUNT - 1; i >= ADLIB_CHANNEL_MIDWAY; --i) { - if (_channels[i]._fieldE == 0xFF) { - _channels[i].load(pData); - return; - } - } -} - -bool ASound::isSoundActive(byte *pData) { - for (int i = 0; i < ADLIB_CHANNEL_MIDWAY; ++i) { - if (_channels[i]._activeCount && _channels[i]._soundData == pData) - return true; - } - - return false; -} - -void ASound::setFrequency(int channel, int freq) { - write2(8, 0xA0 + channel, freq & 0xFF); - write2(8, 0xB0 + channel, (freq >> 8) | 0x20); -} - -int ASound::getRandomNumber() { - int v = 0x9248 + (int)_randomSeed; - _randomSeed = ((v >> 3) | (v << 13)) & 0xFFFF; - return _randomSeed; -} - -void ASound::update() { - getRandomNumber(); - if (_isDisabled) - return; - - ++_frameCounter; - pollChannels(); - checkChannels(); - - if (_v1 == _v2) { - if (_resultFlag != -1) { - _resultFlag = -1; - _pollResult = -1; - } - } else { - if (_v1) { - _freqBase1 += _v7; - if (!--_v1) { - if (!_v2 || _channelNum1 != _channelNum2) { - write2(8, 0xA0 + _channelNum1, 0); - write2(8, 0xB0 + _channelNum1, 0); - } - } - } - - if (_v2) { - _freqBase2 += _v8; - if (!--_v2) { - if (!_v1 || _channelNum2 != _channelNum1) { - write2(8, 0xA0 + _channelNum2, 0); - write2(8, 0xB0 + _channelNum2, 0); - } - } - } - } -} - -void ASound::pollChannels() { - _activeChannelNumber = 0; - for (int i = 0; i < ADLIB_CHANNEL_COUNT; ++i) { - _activeChannelPtr = &_channels[i]; - pollActiveChannel(); - } -} - -void ASound::checkChannels() { - for (int i = 0; i < ADLIB_CHANNEL_COUNT; ++i) - _channels[i].check(_nullData); -} - -void ASound::pollActiveChannel() { - AdlibChannel *chan = _activeChannelPtr; - bool updateFlag = true; - - if (chan->_activeCount) { - if (chan->_field8 > 0 && --chan->_field8 == 0) - updateOctave(); - - if (--_activeChannelPtr->_activeCount <= 0) { - for (;;) { - byte *pSrc = chan->_pSrc; - if (!(*pSrc & 0x80) || (*pSrc <= 0xF0)) { - if (updateFlag) - updateActiveChannel(); - - chan->_field4 = *pSrc++; - chan->_activeCount = *pSrc++; - chan->_pSrc += 2; - - if (!chan->_field4 || !chan->_activeCount) { - updateOctave(); - } else { - chan->_field8 = chan->_activeCount - chan->_field7; - updateChannelState(); - } - - // Break out of processing loop - break; - } else { - updateFlag = false; - - switch ((~*pSrc) & 0xF) { - case 0: - if (!chan->_field17) { - if (*++pSrc == 0) { - chan->_pSrc += 2; - chan->_ptr3 = chan->_pSrc; - chan->_field17 = 0; - } else { - chan->_field17 = *pSrc; - chan->_pSrc = chan->_ptr3; - } - } else if (--chan->_field17) { - chan->_pSrc = chan->_ptr3; - } else { - chan->_pSrc += 2; - chan->_ptr3 = chan->_pSrc; - } - break; - - case 1: - if (!chan->_field19) { - if (*++pSrc == 0) { - chan->_pSrc += 2; - chan->_ptr4 = chan->_pSrc; - chan->_ptr3 = chan->_pSrc; - chan->_field17 = 0; - chan->_field19 = 0; - } else { - chan->_field19 = *pSrc; - chan->_pSrc = chan->_ptr4; - chan->_ptr3 = chan->_ptr4; - } - } else if (--chan->_field19) { - chan->_ptr4 = chan->_pSrc; - chan->_ptr3 = chan->_pSrc; - } else { - chan->_pSrc += 2; - chan->_ptr4 = chan->_pSrc; - chan->_ptr3 = chan->_pSrc; - } - break; - - case 2: - // Loop sound data - chan->_field1 = 0; - chan->_field2 = chan->_field3 = 0; - chan->_volume = chan->_field7 = 0; - chan->_field1D = chan->_field1E = 0; - chan->_field8 = 0; - chan->_field9 = 0; - chan->_fieldB = 0; - chan->_field17 = 0; - chan->_field19 = 0; - chan->_fieldD = 0x40; - chan->_ptr1 = chan->_soundData; - chan->_pSrc = chan->_soundData; - chan->_ptr3 = chan->_soundData; - chan->_ptr4 = chan->_soundData; - - chan->_pSrc += 2; - break; - - case 3: - chan->_sampleIndex = *++pSrc; - chan->_pSrc += 2; - loadSample(chan->_sampleIndex); - break; - - case 4: - chan->_field7 = *++pSrc; - chan->_pSrc += 2; - break; - - case 5: - chan->_field1 = *++pSrc; - chan->_pSrc += 2; - break; - - case 6: - ++pSrc; - if (chan->_fieldE) { - chan->_pSrc += 2; - } else { - chan->_volume = *pSrc >> 1; - updateFlag = true; - chan->_pSrc += 2; - } - break; - - case 7: - ++pSrc; - if (!chan->_fieldE) { - chan->_fieldA = *pSrc; - chan->_field2 = *++pSrc; - chan->_field9 = 1; - } - - chan->_pSrc += 3; - break; - - case 8: - chan->_field1D = *++pSrc; - chan->_pSrc += 2; - break; - - case 9: { - int v1 = *++pSrc; - ++pSrc; - int v2 = (v1 - 1) & getRandomNumber(); - int v3 = pSrc[v2]; - int v4 = pSrc[v1]; - - pSrc[v4 + v1 + 1] = v3; - chan->_pSrc += v1 + 3; - break; - } - - case 10: - ++pSrc; - if (chan->_fieldE) { - chan->_pSrc += 2; - } else { - chan->_field1E = *pSrc >> 1; - updateFlag = true; - chan->_pSrc += 2; - } - break; - - case 11: - chan->_fieldD = *++pSrc; - updateFlag = true; - chan->_pSrc += 2; - break; - - case 12: - chan->_fieldC = *++pSrc; - chan->_field3 = *++pSrc; - chan->_fieldB = 1; - chan->_pSrc += 2; - break; - - case 13: - ++pSrc; - chan->_pSrc += 2; - break; - - case 14: - chan->_field1F = *++pSrc; - chan->_pSrc += 2; - break; - - default: - break; - } - } - } - } - - if (chan->_field1) - updateFNumber(); - - updateFlag = false; - if (chan->_field9 || chan->_fieldB) { - if (!--chan->_field9) { - chan->_field9 = chan->_fieldA; - if (chan->_field2) { - int8 newVal = (int8)chan->_field2 + (int8)chan->_field1E; - if (newVal < 0) { - chan->_field9 = 0; - newVal = 0; - } else if (newVal > 63) { - chan->_field9 = 0; - newVal = 63; - } - - chan->_field1E = newVal; - updateFlag = true; - } - } - - if (!--chan->_fieldB) { - chan->_fieldB = chan->_fieldC; - if (chan->_field3) { - chan->_fieldD = chan->_field3; - updateFlag = true; - } - } - - if (updateFlag) - updateActiveChannel(); - } - } - - ++_activeChannelNumber; -} - -void ASound::updateOctave() { - int reg = 0xB0 + _activeChannelNumber; - write2(8, reg, _ports[reg] & 0xDF); -} - -static int _vList1[] = { - 0x200, 0x21E, 0x23F, 0x261, 0x285, 0x2AB, - 0x2D4, 0x2FF, 0x32D, 0x35D, 0x390, 0x3C7 -}; - -void ASound::updateChannelState() { - updateActiveChannel(); - - if (_channelData[_activeChannelNumber]._field0) { - if (_channelNum1 == _activeChannelNumber) - _stateFlag = 0; - if (_channelNum2 == _activeChannelNumber) - _stateFlag = 1; - - if (!_stateFlag) { - _stateFlag = 1; - if (_v1) - write2(8, 0xB0 + _channelNum1, _ports[0xB0 + _channelNum1] & 0xDF); - - _channelNum1 = _activeChannelNumber; - _v1 = _channelData[_channelNum1]._field0; - _freqMask1 = _channelData[_channelNum1]._freqMask; - _freqBase1 = _channelData[_channelNum1]._freqBase; - _v7 = _channelData[_channelNum1]._field6; - } else { - _stateFlag = 0; - if (_v2) - write2(8, 0xB0 + _channelNum2, _ports[0xB0 + _channelNum2] & 0xDF); - - _channelNum2 = _activeChannelNumber; - _v2 = _channelData[_channelNum2]._field0; - _freqMask2 = _channelData[_channelNum2]._freqMask; - _freqBase2 = _channelData[_channelNum2]._freqBase; - _v8 = _channelData[_channelNum2]._field6; - } - - resultCheck(); - } else { - int reg = 0xA0 + _activeChannelNumber; - int vTimes = (_activeChannelPtr->_field4 + _activeChannelPtr->_field1F) / 12; - int vOffset = (_activeChannelPtr->_field4 + _activeChannelPtr->_field1F) % 12; - int val = _vList1[vOffset] + _activeChannelPtr->_field1D; - write2(8, reg, val & 0xFF); - - reg += 0x10; - write2(8, reg, (_ports[reg] & 0x20) | (vTimes << 2) | (val >> 8)); - - write2(8, reg, _ports[reg] | 0x20); - } -} - -static const int outputIndexes[] = { - 3, 1, 4, 2, 5, 6, 9, 7, 10, 8, 11, 12, 15, 13, 16, 14, 17 -}; -static const int outputChannels[] = { - 0, 1, 2, 3, 4, 5, 8, 9, 10, 11, 12, 13, 16, 17, 18, 19, 20, 21, 0 -}; -static const int volumeList[] = { - 0x3F, 0x3F, 0x36, 0x31, 0x2D, 0x2A, 0x28, 0x26, 0x24, 0x22, 0x21, 0x20, 0x1F, 0x1E, 0x1D, 0x1C, - 0x1B, 0x1A, 0x19, 0x19, 0x18, 0x17, 0x17, 0x16, 0x16, 0x15, 0x15, 0x14, 0x14, 0x13, 0x12, 0x12, - 0x11, 0x11, 0x10, 0x10, 0x0F, 0x0F, 0x0E, 0x0E, 0x0D, 0x0D, 0x0C, 0x0C, 0x0B, 0x0B, 0x0A, 0x0A, - 0x0A, 0x09, 0x09, 0x09, 0x09, 0x09, 0x08, 0x08, 0x08, 0x08, 0x08, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -void ASound::updateActiveChannel() { - int reg = 0x40 + outputChannels[outputIndexes[_activeChannelNumber * 2]]; - int portVal = _ports[reg] & 0xFFC0; - int newVolume = CLIP(_activeChannelPtr->_volume + _activeChannelPtr->_field1E, 0, 63); - - // Note: Original had a whole block not seeming to be used, since the initialisation - // sets a variable to 5660h, and doesn't change it, so the branch is never taken - int val = CLIP(newVolume - volumeList[_activeChannelPtr->_fieldD], 0, 63); - val = (63 - val) | portVal; - - int val2 = CLIP(newVolume - volumeList[-(_activeChannelPtr->_fieldD - 127)], 0, 63); - val2 = (63 - val2) | portVal; - write2(0, reg, val); - write2(2, reg, val2); -} - -void ASound::loadSample(int sampleIndex) { - _activeChannelReg = 0xB0 + _activeChannelNumber; - write2(8, _activeChannelReg, _ports[_activeChannelReg] & 0xDF); - - _activeChannelReg = _activeChannelNumber; - _samplePtr = &_samples[sampleIndex * 2]; - _v11 = outputChannels[outputIndexes[_activeChannelReg * 2 - 1]]; - processSample(); - - AdlibChannelData &cd = _channelData[_activeChannelNumber]; - cd._field6 = _samplePtr->_field14; - cd._freqBase = _samplePtr->_freqBase; - cd._freqMask = _samplePtr->_freqMask; - cd._field0 = _samplePtr->_fieldE; - - _samplePtr = &_samples[sampleIndex * 2 + 1]; - _v11 = outputChannels[outputIndexes[_activeChannelReg * 2]]; - processSample(); -} - -void ASound::processSample() { - // Write out vib flags and split point - write2(8, 0x40 + _v11, 0x3F); - int depthRhythm = (_ports[0xBD] & 0x3F) | (_amDep ? 0x80 : 0) | - (_vibDep ? 0x40 : 0); - write2(8, 0xBD, depthRhythm); - write2(8, 8, _splitPoint ? 0x40 : 0); - - // Write out feedback & Alg - int val = (_samplePtr->_feedback << 1) | (1 - _samplePtr->_alg); - write2(8, 0xC0 + _activeChannelReg, val); - - // Write out attack/decay rate - val = (_samplePtr->_attackRate << 4) | (_samplePtr->_decayRate & 0xF); - write2(8, 0x60 + _v11, val); - - // Write out sustain level/release rate - val = (_samplePtr->_sustainLevel << 4) | (_samplePtr->_releaseRate & 0xF); - write2(8, 0x80 + _v11, val); - - // Write out misc flags - val = (_samplePtr->_ampMod ? 0x80 : 0) | (_samplePtr->_vib ? 0x40 : 0) - | (_samplePtr->_egTyp ? 0x20 : 0) | (_samplePtr->_ksr ? 0x10 : 0) - | (_samplePtr->_freqMultiple & 0xF); - write2(8, 0x20 + _v11, val); - - // Write out waveform select - write2(8, 0xE0 + _v11, _samplePtr->_waveformSelect & 3); - - // Write out total level & scaling level - val = -((_samplePtr->_totalLevel & 0x3F) - 0x3F) | (_samplePtr->_scalingLevel << 6); - write2(8, 0x40 + _v11, val); -} - -void ASound::updateFNumber() { - int loReg = 0xA0 + _activeChannelNumber; - int hiReg = 0xB0 + _activeChannelNumber; - int val1 = (_ports[hiReg] & 0x1F) << 8; - val1 += _ports[loReg] + _activeChannelPtr->_field1; - write2(8, loReg, val1); - - int val2 = (_ports[hiReg] & 0x20) | (val1 >> 8); - write2(8, hiReg, val2); -} - -int ASound::readBuffer(int16 *buffer, const int numSamples) { - Common::StackLock slock(_driverMutex); - - int32 samplesLeft = numSamples; - memset(buffer, 0, sizeof(int16) * numSamples); - while (samplesLeft) { - if (!_samplesTillCallback) { - poll(); - flush(); - - _samplesTillCallback = _samplesPerCallback; - _samplesTillCallbackRemainder += _samplesPerCallbackRemainder; - if (_samplesTillCallbackRemainder >= CALLBACKS_PER_SECOND) { - _samplesTillCallback++; - _samplesTillCallbackRemainder -= CALLBACKS_PER_SECOND; - } - } - - int32 render = MIN(samplesLeft, _samplesTillCallback); - samplesLeft -= render; - _samplesTillCallback -= render; - - _opl->readBuffer(buffer, render); - buffer += render; - } - return numSamples; -} - -int ASound::command0() { - bool isDisabled = _isDisabled; - _isDisabled = true; - - for (int i = 0; i < ADLIB_CHANNEL_COUNT; ++i) - _channels[i].reset(); - - _v1 = 0; - _v2 = 0; - _freqMask1 = _freqMask2 = 0; - _freqBase1 = _freqBase2 = 0; - _v7 = 0; - _v8 = 0; - - // Reset Adlib port registers - for (int reg = 0x4F; reg >= 0x40; --reg) - write2(8, reg, 0x3F); - for (int reg = 0xFF; reg >= 0x60; --reg) - write2(8, reg, 0); - for (int reg = 0x3F; reg > 0; --reg) - write2(8, reg, 0); - write2(8, 1, 0x20); - - _isDisabled = isDisabled; - return 0; -} - -int ASound::command1() { - for (int i = 0; i < ADLIB_CHANNEL_COUNT; ++i) - _channels[i].enable(0xFF); - return 0; -} - -int ASound::command2() { - for (int i = 0; i < ADLIB_CHANNEL_MIDWAY; ++i) - _channels[i].setPtr2(_nullData); - return 0; -} - -int ASound::command3() { - for (int i = 0; i < ADLIB_CHANNEL_MIDWAY; ++i) - _channels[i].enable(0xFF); - return 0; -} - -int ASound::command4() { - for (int i = ADLIB_CHANNEL_MIDWAY; i < ADLIB_CHANNEL_COUNT; ++i) - _channels[i].setPtr2(_nullData); - return 0; -} - -int ASound::command5() { - for (int i = 5; i < ADLIB_CHANNEL_COUNT; ++i) - _channels[i].enable(0xFF); - return 0; -} - -int ASound::command6() { - _v9 = _v1; - _v1 = 0; - _v10 = _v2; - _v2 = 0; - - channelOff(0x43); - channelOff(0x44); - channelOff(0x45); - channelOff(0x4B); - channelOff(0x4C); - channelOff(0x4D); - channelOff(0x53); - channelOff(0x54); - channelOff(0x55); - - return 0; -} - -int ASound::command7() { - channelOn(0x43, _channels[0]._volume); - channelOn(0x44, _channels[1]._volume); - channelOn(0x45, _channels[2]._volume); - channelOn(0x4B, _channels[3]._volume); - channelOn(0x4C, _channels[4]._volume); - channelOn(0x4D, _channels[5]._volume); - - _v1 = _v9; - _v2 = _v10; - - if (_v9 != _v10) - resultCheck(); - - _isDisabled = 0; - return _v10; -} - -int ASound::command8() { - int result = 0; - for (int i = 0; i < ADLIB_CHANNEL_COUNT; ++i) - result |= _channels[i]._activeCount; - - return result; -} - -/*-----------------------------------------------------------------------*/ - -const ASound1::CommandPtr ASound1::_commandList[42] = { - &ASound1::command0, &ASound1::command1, &ASound1::command2, &ASound1::command3, - &ASound1::command4, &ASound1::command5, &ASound1::command6, &ASound1::command7, - &ASound1::command8, &ASound1::command9, &ASound1::command10, &ASound1::command11, - &ASound1::command12, &ASound1::command13, &ASound1::command14, &ASound1::command15, - &ASound1::command16, &ASound1::command17, &ASound1::command18, &ASound1::command19, - &ASound1::command20, &ASound1::command21, &ASound1::command22, &ASound1::command23, - &ASound1::command24, &ASound1::command25, &ASound1::command26, &ASound1::command27, - &ASound1::command28, &ASound1::command29, &ASound1::command30, &ASound1::command31, - &ASound1::command32, &ASound1::command33, &ASound1::command34, &ASound1::command35, - &ASound1::command36, &ASound1::command37, &ASound1::command38, &ASound1::command39, - &ASound1::command40, &ASound1::command41 -}; - -ASound1::ASound1(Audio::Mixer *mixer): ASound(mixer, "asound.001", 0x1520) { - _cmd23Toggle = false; - - // Load sound samples - _soundFile.seek(_dataOffset + 0x12C); - for (int i = 0; i < 98; ++i) - _samples.push_back(AdlibSample(_soundFile)); -} - -int ASound1::command(int commandId) { - if (commandId > 41) - return 0; - - _frameCounter = 0; - return (this->*_commandList[commandId])(); -} - -int ASound1::command9() { - playSound(0xC68, 12); - return 0; -} - -int ASound1::command10() { - byte *pData1 = loadData(0x130E, 48); - if (!isSoundActive(pData1)) { - command1(); - _channels[0].load(pData1); - _channels[1].load(loadData(0x133E, 392)); - _channels[2].load(loadData(0x14C6, 46)); - _channels[3].load(loadData(0x14F4, 48)); - } - - return 0; -} - -int ASound1::command11() { - command111213(); - _channels[0]._field1E = 0; - _channels[1]._field1E = 0; - return 0; -} - -int ASound1::command12() { - command111213(); - _channels[0]._field1E = 40; - _channels[1]._field1E = 0; - return 0; -} - -int ASound1::command13() { - command111213(); - _channels[0]._field1E = 40; - _channels[1]._field1E = 50; - return 0; -} - -int ASound1::command14() { - playSound(0x1216, 248); - return 0; -} - -int ASound1::command15() { - byte *pData1 = loadData(0x1524, 152); - if (!isSoundActive(pData1)) { - command1(); - _channels[4].load(pData1); - _channels[5].load(loadData(0x15BC, 94)); - _channels[6].load(loadData(0x161A, 94)); - _channels[7].load(loadData(0x1678, 42)); - _channels[8].load(loadData(0x16A2, 42)); - } - - return 0; -} - -int ASound1::command16() { - playSound(0xC74, 14); - return 0; -} - -int ASound1::command17() { - playSound(0xE9A, 10); - return 0; -} - -int ASound1::command18() { - command1(); - playSound(0xCA6, 20); - return 0; -} - -int ASound1::command19() { - command1(); - playSound(0xCBA, 74); - return 0; -} - -int ASound1::command20() { - byte *pData = loadData(0xD18, 28); - if (!isSoundActive(pData)) - playSound(pData); - return 0; -} - -int ASound1::command21() { - playSound(0xD04, 20); - return 0; -} - -int ASound1::command22() { - byte *pData = loadData(0xD34, 10); - pData[6] = (getRandomNumber() & 7) + 85; - - if (!isSoundActive(pData)) - playSound(pData); - - return 0; -} - -int ASound1::command23() { - _cmd23Toggle = !_cmd23Toggle; - playSound(_cmd23Toggle ? 0xD3E : 0xD46, 8); - return 0; -} - -int ASound1::command24() { - playSound(0xD4E, 18); - playSound(0xD60, 20); - playSound(0xD74, 14); - return 0; -} - -int ASound1::command25() { - byte *pData = loadData(0xD82, 16); - if (!isSoundActive(pData)) - playSound(pData); - - return 0; -} - -int ASound1::command26() { - error("TODO: command26"); - return 0; -} - -int ASound1::command27() { - error("TODO: ASound::command27"); - return 0; -} - -int ASound1::command28() { - playSound(0xD92, 28); - return 0; -} - -int ASound1::command29() { - error("TODO: ASound::command29"); - return 0; -} - -int ASound1::command30() { - error("TODO: ASound::command30"); - return 0; -} - -int ASound1::command31() { - byte *pData = loadData(0xDAE, 14); - if (!isSoundActive(pData)) - playSound(pData); - - return 0; -} - -int ASound1::command32() { - error("TODO: ASound::command32"); - return 0; -} - -int ASound1::command33() { - playSound(0xDBC, 10); - playSound(0xDC6, 10); - return 0; -} - -int ASound1::command34() { - int v = getRandomNumber() & 0x20; - if (!v) - v = 0x60; - - byte *pData = loadData(0xDD0, 22); - pData[8] = pData[15] = v; - playSound(pData); - return 0; -} - -int ASound1::command35() { - playSound(0xDE6, 16); - return 0; -} - -int ASound1::command36() { - playSound(0xE10, 10); - command34(); - - return 0; -} - -int ASound1::command37() { - playSound(0xE1A, 14); - return 0; -} - -int ASound1::command38() { - playSound(0xE28, 114); - return 0; -} - -int ASound1::command39() { - byte *pData1 = loadData(0x16CC, 82); - if (!isSoundActive(pData1)) { - _channels[5].load(pData1); - _channels[6].load(loadData(0x171E, 30)); - _channels[7].load(loadData(0x173C, 40)); - _channels[8].load(loadData(0x1764, 64)); - } - return 0; -} - -int ASound1::command40() { - playSound(0xDF6, 26); - return 0; -} - -int ASound1::command41() { - playSound(0xC32, 34); - playSound(0xC54, 20); - return 0; -} - -void ASound1::command111213() { - byte *pData1 = loadData(0xEF6, 408); - if (!isSoundActive(pData1)) { - command1(); - _channels[0].load(pData1); - _channels[1].load(loadData(0x108E, 266)); - _channels[2].load(loadData(0x1198, 66)); - _channels[2].load(loadData(0x11DA, 60)); - } -} - -void ASound1::command2627293032() { - // TODO: This method takes a parameter off the stack for several levels up. - // i.e. something the caller's caller pushed onto the stack. Need to figure - // out a better way to pass parameters down if this is actually in use. -} - -} // End of namespace Nebular - -} // End of namespace MADS diff --git a/engines/mads/sound_nebular.h b/engines/mads/sound_nebular.h deleted file mode 100644 index 11836e6559..0000000000 --- a/engines/mads/sound_nebular.h +++ /dev/null @@ -1,408 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef MADS_SOUND_NEBULAR_H -#define MADS_SOUND_NEBULAR_H - -#include "common/scummsys.h" -#include "common/file.h" -#include "common/mutex.h" -#include "common/queue.h" -#include "audio/audiostream.h" -#include "audio/fmopl.h" -#include "audio/mixer.h" - -namespace MADS { - -class SoundManager; - -namespace Nebular { - -/** - * Represents the data for a channel on the Adlib - */ -class AdlibChannel { -public: - int _activeCount; - int _field1; - int _field2; - int _field3; - int _field4; - int _sampleIndex; - int _volume; - int _field7; - int _field8; - int _field9; - int _fieldA; - uint8 _fieldB; - int _fieldC; - int _fieldD; - int _fieldE; - byte *_ptr1; - byte *_pSrc; - byte *_ptr3; - byte *_ptr4; - int _field17; - int _field19; - byte *_soundData; - int _field1D; - int _field1E; - int _field1F; -public: - AdlibChannel(); - - void reset(); - void enable(int flag); - void setPtr2(byte *pData); - void load(byte *pData); - void check(byte *nullPtr); -}; - -class AdlibChannelData { -public: - int _field0; - int _freqMask; - int _freqBase; - int _field6; -}; - -class AdlibSample { -public: - int _attackRate; - int _decayRate; - int _sustainLevel; - int _releaseRate; - bool _egTyp; - bool _ksr; - int _totalLevel; - int _scalingLevel; - int _waveformSelect; - int _freqMultiple; - int _feedback; - bool _ampMod; - int _vib; - int _alg; - int _fieldE; - int _freqMask; - int _freqBase; - int _field14; - - AdlibSample() {} - AdlibSample(Common::SeekableReadStream &s); -}; - -struct RegisterValue { - uint8 _regNum; - uint8 _value; - - RegisterValue(int regNum, int value) { - _regNum = regNum; _value = value; - } -}; - -#define ADLIB_CHANNEL_COUNT 9 -#define ADLIB_CHANNEL_MIDWAY 5 -#define CALLBACKS_PER_SECOND 60 - -/** - * Base class for the sound player resource files - */ -class ASound: public Audio::AudioStream { -private: - struct CachedDataEntry { - int _offset; - byte *_data; - }; - Common::List _dataCache; - uint16 _randomSeed; - - /** - * Does the initial Adlib initialisation - */ - void adlibInit(); - - /** - * Does on-going processing for the Adlib sounds being played - */ - void update(); - - /** - * Polls each of the channels for updates - */ - void pollChannels(); - - /** - * Checks the status of the channels - */ - void checkChannels(); - - /** - * Polls the currently active channel - */ - void pollActiveChannel(); - - /** - * Updates the octave of the currently active channel - */ - void updateOctave(); - - void updateChannelState(); - void updateActiveChannel(); - - /** - * Loads up the specified sample - */ - void loadSample(int sampleIndex); - - /** - * Writes out the data of the selected sample to the Adlib - */ - void processSample(); - - void updateFNumber(); -protected: - /** - * Queue a byte for an Adlib register - */ - void write(int reg, int val); - - /** - * Queue a byte for an Adlib register, and store it in the _ports array - */ - int write2(int state, int reg, int val); - - /** - * Flush any pending Adlib register values to the OPL driver - */ - void flush(); - - /** - * Turn a channel on - */ - void channelOn(int reg, int volume); - - /** - * Turn a channel off - */ - void channelOff(int reg); - - /** - * Checks for whether a poll result needs to be set - */ - void resultCheck(); - - /** - * Loads a data block from the sound file, caching the result for any future - * calls for the same data - */ - byte *loadData(int offset, int size); - - /** - * Play the specified sound - * @param offset Offset of sound data within sound player data segment - * @param size Size of sound data block - */ - void playSound(int offset, int size); - - /** - * Play the specified raw sound data - * @param pData Pointer to data block containing sound data - */ - void playSound(byte *pData); - - /** - * Checks to see whether the given block of data is already loaded into a channel. - */ - bool isSoundActive(byte *pData); - - /** - * Sets the frequency for a given channel. - */ - void setFrequency(int channel, int freq); - - /** - * Returns a 16-bit random number - */ - int getRandomNumber(); - - int command0(); - int command1(); - int command2(); - int command3(); - int command4(); - int command5(); - int command6(); - int command7(); - int command8(); -public: - Audio::Mixer *_mixer; - FM_OPL *_opl; - Audio::SoundHandle _soundHandle; - AdlibChannel _channels[ADLIB_CHANNEL_COUNT]; - AdlibChannel *_activeChannelPtr; - AdlibChannelData _channelData[11]; - Common::Array _samples; - AdlibSample *_samplePtr; - Common::File _soundFile; - Common::Queue _queue; - Common::Mutex _driverMutex; - int _dataOffset; - int _frameCounter; - bool _isDisabled; - int _v1; - int _v2; - int _activeChannelNumber; - int _freqMask1; - int _freqMask2; - int _freqBase1; - int _freqBase2; - int _channelNum1, _channelNum2; - int _v7; - int _v8; - int _v9; - int _v10; - int _pollResult; - int _resultFlag; - byte _nullData[2]; - int _ports[256]; - bool _stateFlag; - int _activeChannelReg; - int _v11; - bool _amDep, _vibDep, _splitPoint; - int _samplesPerCallback; - int _samplesPerCallbackRemainder; - int _samplesTillCallback; - int _samplesTillCallbackRemainder; -public: - /** - * Constructor - * @param filename Specifies the adlib sound player file to use - * @param dataOffset Offset in the file of the data segment - */ - ASound(Audio::Mixer *mixer, const Common::String &filename, int dataOffset); - - /** - * Destructor - */ - virtual ~ASound(); - - /** - * Execute a player command. Most commands represent sounds to play, but some - * low number commands also provide control operations - */ - virtual int command(int commandId) = 0; - - /** - * Stop all currently playing sounds - */ - int stop(); - - /** - * Main poll method to allow sounds to progress - */ - int poll(); - - /** - * General noise/note output - */ - void noise(); - - /** - * Return the current frame counter - */ - int getFrameCounter() { return _frameCounter; } - - // AudioStream interface - /** - * Main buffer read - */ - virtual int readBuffer(int16 *buffer, const int numSamples); - - /** - * Mono sound only - */ - virtual bool isStereo() const { return false; } - - /** - * Data is continuously pushed, so definitive end - */ - virtual bool endOfData() const { return false; } - - /** - * Return sample rate - */ - virtual int getRate() const { return 11025; } -}; - -class ASound1: public ASound { -private: - typedef int (ASound1::*CommandPtr)(); - static const CommandPtr _commandList[42]; - bool _cmd23Toggle; - - int command9(); - int command10(); - int command11(); - int command12(); - int command13(); - int command14(); - int command15(); - int command16(); - int command17(); - int command18(); - int command19(); - int command20(); - int command21(); - int command22(); - int command23(); - int command24(); - int command25(); - int command26(); - int command27(); - int command28(); - int command29(); - int command30(); - int command31(); - int command32(); - int command33(); - int command34(); - int command35(); - int command36(); - int command37(); - int command38(); - int command39(); - int command40(); - int command41(); - - void command111213(); - void command2627293032(); -public: - ASound1(Audio::Mixer *mixer); - - virtual int command(int commandId); -}; - -} // End of namespace Nebular - -} // End of namespace MADS - -#endif /* MADS_SOUND_NEBULAR_H */ -- cgit v1.2.3 From 4581b26b12d21801eee0c5df2dbd1b260300498c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 20 Feb 2014 22:27:01 -0500 Subject: MADS: Implemented resource manager using ScummVM Archive interface --- engines/mads/compression.cpp | 4 +- engines/mads/font.cpp | 4 +- engines/mads/mads.cpp | 2 +- engines/mads/msurface.cpp | 23 ++- engines/mads/nebular/dialogs_nebular.h | 2 + engines/mads/resources.cpp | 259 ++++++++++++++++++++++++++++++++- engines/mads/resources.h | 35 +++-- 7 files changed, 293 insertions(+), 36 deletions(-) diff --git a/engines/mads/compression.cpp b/engines/mads/compression.cpp index b5e24dfc5e..febb6ec90f 100644 --- a/engines/mads/compression.cpp +++ b/engines/mads/compression.cpp @@ -46,9 +46,9 @@ MadsPack::MadsPack(Common::SeekableReadStream *stream) { } MadsPack::MadsPack(const Common::String &resourceName, MADSEngine *vm) { - Common::SeekableReadStream *stream = vm->_resources->get(resourceName); + Common::SeekableReadStream *stream = nullptr; //vm->_resources->get(resourceName); initialise(stream); - vm->_resources->toss(resourceName); +// vm->_resources->toss(resourceName); } void MadsPack::initialise(Common::SeekableReadStream *stream) { diff --git a/engines/mads/font.cpp b/engines/mads/font.cpp index e97cc95fdf..076eca92c6 100644 --- a/engines/mads/font.cpp +++ b/engines/mads/font.cpp @@ -233,7 +233,7 @@ void FontM4::setFont(const Common::String &filename) { _sysFont = false; _filename = filename; - Common::SeekableReadStream *fontFile = _vm->_resources->openFile(filename); + Common::SeekableReadStream *fontFile = nullptr; //_vm->_resources->openFile(filename); if (fontFile->readUint32LE() != MKTAG('F', 'O', 'N', 'T')) { warning("Font: FONT tag expected"); @@ -272,7 +272,7 @@ void FontM4::setFont(const Common::String &filename) { _charData = new uint8[fontSize]; fontFile->read(_charData, fontSize); - _vm->_resources->toss(filename); +// _vm->_resources->toss(filename); } int FontM4::getBpp(int charWidth) { diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index 05c11409db..ec99b314a7 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -72,10 +72,10 @@ void MADSEngine::initialise() { MSurface::setVm(this); MSprite::setVm(this); + ResourcesManager::init(this); _events = new EventsManager(this); _palette = Palette::init(this); _font = Font::init(this); - _resources = new ResourcesManager(this); _screen = MSurface::init(true); _sound = new SoundManager(this, _mixer); _userInterface = UserInterface::init(this); diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp index f71a4a7a4e..2c0b433159 100644 --- a/engines/mads/msurface.cpp +++ b/engines/mads/msurface.cpp @@ -26,6 +26,7 @@ #include "mads/mads.h" #include "mads/msprite.h" #include "mads/msurface.h" +#include "mads/resources.h" namespace MADS { @@ -412,14 +413,14 @@ void MSurfaceMADS::loadBackground(int roomNumber, RGBList **palData) { tileMap[i] = mapStream->readUint16LE(); delete mapStream; - _vm->_resources->toss(resourceName); +// _vm->_resources->toss(resourceName); // -------------------------------------------------------------------------------- // Tile map data, which needs to be kept compressed, as the tile offsets refer to // the compressed data. Each tile is then uncompressed separately sprintf(resourceName, "rm%d.tt", roomNumber); - Common::SeekableReadStream *tileDataComp = _vm->_resources->get(resourceName); + Common::SeekableReadStream *tileDataComp = nullptr; //_vm->_resources->get(resourceName); MadsPack tileData(tileDataComp); Common::SeekableReadStream *tileDataUncomp = tileData.getItemStream(0); @@ -499,7 +500,7 @@ void MSurfaceMADS::loadBackground(int roomNumber, RGBList **palData) { } } tileSet.clear(); - _vm->_resources->toss(resourceName); +// _vm->_resources->toss(resourceName); } void MSurfaceMADS::loadInterface(int index, RGBList **palData) { @@ -534,10 +535,10 @@ void MSurfaceNebular::loadBackground(int roomNumber, RGBList **palData) { empty(); Common::String resourceName = Common::String::format("rm%d.art", roomNumber); - Common::SeekableReadStream *stream = _vm->_resources->get(resourceName); + Common::SeekableReadStream *stream = nullptr; //_vm->_resources->get(resourceName); loadBackgroundStream(stream, palData); - _vm->_resources->toss(resourceName); +// _vm->_resources->toss(resourceName); } void MSurfaceNebular::loadBackgroundStream(Common::SeekableReadStream *source, RGBList **palData) { @@ -597,10 +598,10 @@ void MSurfaceM4::loadBackground(int roomNumber, RGBList **palData) { if (palData) *palData = NULL; Common::String resourceName = Common::String::format("%i.tt", roomNumber); - Common::SeekableReadStream *stream = _vm->_resources->get(resourceName); + Common::SeekableReadStream *stream = nullptr;//_vm->_resources->get(resourceName); loadBackgroundStream(stream); - _vm->_resources->toss(resourceName); +// _vm->_resources->toss(resourceName); } void MSurfaceM4::loadBackgroundStream(Common::SeekableReadStream *source) { @@ -663,15 +664,11 @@ void MSurfaceM4::loadBackgroundStream(Common::SeekableReadStream *source) { /*------------------------------------------------------------------------*/ void MSurfaceRiddle::loadBackground(const Common::String &sceneName) { - char resourceName[20]; - Common::SeekableReadStream *stream; // Loads a Riddle scene Common::String resName = Common::String::format("%s.tt", sceneName.c_str()); - stream = _vm->_resources->get(resourceName); - - loadBackgroundStream(stream); + File stream(resName); - _vm->_resources->toss(resourceName); + loadBackgroundStream(&stream); } } // End of namespace MADS diff --git a/engines/mads/nebular/dialogs_nebular.h b/engines/mads/nebular/dialogs_nebular.h index 669ac1e775..a747f7575d 100644 --- a/engines/mads/nebular/dialogs_nebular.h +++ b/engines/mads/nebular/dialogs_nebular.h @@ -31,6 +31,8 @@ namespace MADS { namespace Nebular { class CopyProtectionDialog { +private: + public: static bool show() { return false; } }; diff --git a/engines/mads/resources.cpp b/engines/mads/resources.cpp index 27b94a9e55..0630230bec 100644 --- a/engines/mads/resources.cpp +++ b/engines/mads/resources.cpp @@ -21,12 +21,267 @@ */ #include "common/scummsys.h" +#include "common/archive.h" +#include "common/substream.h" +#include "common/textconsole.h" +#include "mads/mads.h" #include "mads/resources.h" namespace MADS { -ResourcesManager::ResourcesManager(MADSEngine *vm) { - _vm = vm; +enum ResourceType {RESTYPE_ROOM, RESTYPE_SC, RESTYPE_TEXT, RESTYPE_QUO, RESTYPE_I, + RESTYPE_OB, RESTYPE_FONT, RESTYPE_SOUND, RESTYPE_SPEECH, RESTYPE_HAS_EXT, RESTYPE_NO_EXT}; + +/** + * HAG Archives implementation + */ +class HagArchive : public Common::Archive { +private: + /** + * Details of a single entry in a HAG file index + */ + struct HagEntry { + Common::String _resourceName; + uint32 _offset; + uint32 _size; + + HagEntry(): _offset(0), _size(0) {} + HagEntry(Common::String resourceName, uint32 offset, uint32 size): + _resourceName(resourceName), _offset(offset), _size(size) {} + }; + + class HagIndex { + public: + Common::List _entries; + Common::String _filename; + }; + + Common::Array _index; + + /** + * Load the index of all the game's HAG files + */ + void loadIndex(); + + /** + * Given a resource name, opens up the correct HAG file and returns whether + * an entry with the given name exists. + */ + bool getHeaderEntry(const Common::String &resourceName, HagIndex &hagIndex, HagEntry &hagEntry) const; + + /** + * Returns the HAG resource filename that will contain a given resource + */ + Common::String getResourceFilename(const Common::String &resourceName) const; + + /** + * Return a resource type given a resource name + */ + ResourceType getResourceType(const Common::String &resourceName) const; +public: + HagArchive(); + virtual ~HagArchive(); + + // Archive implementation + virtual bool hasFile(const Common::String &name) const; + virtual int listMembers(Common::ArchiveMemberList &list) const; + virtual const Common::ArchiveMemberPtr getMember(const Common::String &name) const; + virtual Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const; +}; + +void ResourcesManager::init(MADSEngine *vm) { + if (vm->getGameFeatures() & GF_MADS) + SearchMan.add("HAG", new HagArchive()); + else + error("Unsupported game engine"); +} + +/*------------------------------------------------------------------------*/ + +void File::openFile(const Common::String &filename) { + if (!Common::File::open(filename)) + error("Could not open file - %s", filename.c_str()); +} + +/*------------------------------------------------------------------------*/ + +const char *const MADSCONCAT_STRING = "MADSCONCAT"; + +HagArchive::HagArchive() { + loadIndex(); +} + +HagArchive::~HagArchive() { +} + +// Archive implementation +bool HagArchive::hasFile(const Common::String &name) const { + HagIndex hagIndex; + HagEntry hagEntry; + return getHeaderEntry(name, hagIndex, hagEntry); +} + +int HagArchive::listMembers(Common::ArchiveMemberList &list) const { + int members = 0; + + for (uint hagCtr = 0; hagCtr < _index.size(); ++hagCtr) { + HagIndex hagIndex = _index[hagCtr]; + Common::List::iterator i; + + for (i = hagIndex._entries.begin(); i != hagIndex._entries.end(); ++i) { + list.push_back(Common::ArchiveMemberList::value_type( + new Common::GenericArchiveMember((*i)._resourceName, this))); + ++members; + } + } + + return members; +} + +const Common::ArchiveMemberPtr HagArchive::getMember(const Common::String &name) const { + if (!hasFile(name)) + return Common::ArchiveMemberPtr(); + + return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this)); +} + +Common::SeekableReadStream *HagArchive::createReadStreamForMember(const Common::String &name) const { + HagIndex hagIndex; + HagEntry hagEntry; + + if (getHeaderEntry(name, hagIndex, hagEntry)) { + // Entry found. If the correct file is not already open, open it + Common::File f; + if (!f.open(hagIndex._filename)) + error("Could not open HAG file"); + + // Return a substream for the specific resource + return new Common::SeekableSubReadStream(&f, + hagEntry._offset, hagEntry._size, DisposeAfterUse::YES); + } + + return nullptr; +} + +void HagArchive::loadIndex() { + Common::File hagFile; + + for (int sectionIndex = -1; sectionIndex < 10; ++sectionIndex) { + Common::String filename = (sectionIndex == -1) ? "GLOBAL.HAG" : + Common::String::format("SECTION%d.HAG", sectionIndex); + if (!hagFile.open(filename)) + error("Could not locate HAG file - %s", filename.c_str()); + + // Check for header + char headerBuffer[16]; + if ((hagFile.read(headerBuffer, 16) != 16) || + (strncmp(headerBuffer, MADSCONCAT_STRING, 10) != 0)) + error("Invalid HAG file opened"); + + // Scan through the HAG index + int numEntries = hagFile.readUint16LE(); + + HagIndex hagIndex; + for (int idx = 0; idx < numEntries; ++idx) { + // Read in the details of the next resource + char resourceBuffer[14]; + uint32 offset = hagFile.readUint32LE(); + uint32 size = hagFile.readUint32LE(); + hagFile.read(resourceBuffer, 14); + + hagIndex._entries.push_back(HagEntry(resourceBuffer, offset, size)); + } + + hagFile.close(); + _index.push_back(hagIndex); + } +} + +bool HagArchive::getHeaderEntry(const Common::String &resourceName, + HagIndex &hagIndex, HagEntry &hagEntry) const { + Common::String resName = resourceName; + resName.toUppercase(); + if (resName[0] == '*') + resName.deleteChar(0); + + Common::String hagFilename = getResourceFilename(resName); + + // Find the index for the given file + for (uint hagCtr = 0; hagCtr < _index.size(); ++hagCtr) { + hagIndex = _index[hagCtr]; + + if (hagIndex._filename == hagFilename) { + Common::List::iterator ei; + for (ei = hagIndex._entries.begin(); ei != hagIndex._entries.end(); ++ei) { + hagEntry = *ei; + if (hagEntry._resourceName == resName) + return true; + } + } + } + + return false; +} + +Common::String HagArchive::getResourceFilename(const Common::String &resourceName) const { + ResourceType resType = getResourceType(resourceName); + Common::String outputFilename = "GLOBAL.HAG"; + + if ((resType == RESTYPE_ROOM) || (resType == RESTYPE_SC)) { + int value = atoi(resourceName.c_str() + 2); + int hagFileNum = (resType == RESTYPE_ROOM) ? value / 100 : value; + + if (hagFileNum > 0) + outputFilename = Common::String::format("SECTION%d.HAG", hagFileNum); + } + + if (resType == RESTYPE_SPEECH) + outputFilename = "SPEECH.HAG"; + + return outputFilename; +} + +ResourceType HagArchive::getResourceType(const Common::String &resourceName) const { + if (resourceName.hasPrefix("RM")) { + // Room resource + return RESTYPE_ROOM; + } else if (resourceName.hasPrefix("SC")) { + // SC resource + return RESTYPE_SC; + } else if (resourceName.hasSuffix(".TXT")) { + // Text resource + return RESTYPE_TEXT; + } else if (resourceName.hasSuffix(".QUO")) { + // QUO resource + return RESTYPE_QUO; + } else if (resourceName.hasPrefix("I")) { + // I resource + return RESTYPE_I; + } else if (resourceName.hasPrefix("OB")) { + // OB resource + return RESTYPE_OB; + } else if (resourceName.hasPrefix("FONT")) { + // FONT resource + return RESTYPE_FONT; + } else if (resourceName.hasPrefix("SOUND")) { + // SOUND resource + return RESTYPE_SOUND; + } else if (resourceName.hasPrefix("SPCHC")) { + // SPEECH resource + return RESTYPE_SPEECH; + } + + // Check for a known extension + const char *extPos = strchr(resourceName.c_str(), '.'); + if (extPos) { + ++extPos; + if (!strcmp(extPos, "FL") || !strcmp(extPos, "LBM") || !strcmp(extPos, "ANM") || + !strcmp(extPos, "AA") || !strcmp(extPos, "SS")) { + return RESTYPE_HAS_EXT; + } + } + + return RESTYPE_NO_EXT; } } // End of namespace MADS diff --git a/engines/mads/resources.h b/engines/mads/resources.h index 68bb475aee..f4b7009e13 100644 --- a/engines/mads/resources.h +++ b/engines/mads/resources.h @@ -24,7 +24,7 @@ #define MADS_RESOURCES_H #include "common/scummsys.h" -#include "common/stream.h" +#include "common/file.h" #include "common/str.h" namespace MADS { @@ -32,29 +32,32 @@ namespace MADS { class MADSEngine; class ResourcesManager { -private: - MADSEngine *_vm; public: - ResourcesManager(MADSEngine *vm); + /** + * Instantiates the resource manager + */ + static void init(MADSEngine *vm); +}; +/** + * Derived file class + */ +class File: public Common::File { +public: /** - * Return a named resource + * Constructor */ - Common::SeekableReadStream *get(const Common::String &resourceName, bool loadFlag = false) { - // TODO - return nullptr; - } + File(): Common::File() {} - Common::SeekableReadStream *openFile(const Common::String &resourceName) { - return get(resourceName, false); - } + /** + * Constructor + */ + File(const Common::String &filename) { openFile(filename); } /** - * Release a previously loaded resource + * Opens the given file, throwing an error if it can't be opened */ - void toss(const Common::String &resourceName) { - // TODO - } + void openFile(const Common::String &filename); }; } // End of namespace MADS -- cgit v1.2.3 From 08386210025c65d7199d26962a00a4206e06a899 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 21 Feb 2014 20:16:08 -0500 Subject: MADS: Added remaining commands from the asound.001 player --- engines/mads/nebular/sound_nebular.cpp | 53 +++++++++++++++++++++++++--------- engines/mads/nebular/sound_nebular.h | 14 +++++---- 2 files changed, 49 insertions(+), 18 deletions(-) diff --git a/engines/mads/nebular/sound_nebular.cpp b/engines/mads/nebular/sound_nebular.cpp index 9c3ac61f2d..dba4b363bb 100644 --- a/engines/mads/nebular/sound_nebular.cpp +++ b/engines/mads/nebular/sound_nebular.cpp @@ -303,9 +303,9 @@ void ASound::playSound(int offset, int size) { playSound(loadData(offset, size)); } -void ASound::playSound(byte *pData) { +void ASound::playSound(byte *pData, int startingChannel) { // Scan for a high level free channel - for (int i = 5; i < ADLIB_CHANNEL_COUNT; ++i) { + for (int i = startingChannel; i < ADLIB_CHANNEL_COUNT; ++i) { if (!_channels[i]._activeCount) { _channels[i].load(pData); return; @@ -313,7 +313,7 @@ void ASound::playSound(byte *pData) { } // None found, do a secondary scan for an interruptable channel - for (int i = ADLIB_CHANNEL_COUNT - 1; i >= ADLIB_CHANNEL_MIDWAY; --i) { + for (int i = ADLIB_CHANNEL_COUNT - 1; i >= startingChannel; --i) { if (_channels[i]._fieldE == 0xFF) { _channels[i].load(pData); return; @@ -928,10 +928,11 @@ ASound1::ASound1(Audio::Mixer *mixer): ASound(mixer, "asound.001", 0x1520) { _samples.push_back(AdlibSample(_soundFile)); } -int ASound1::command(int commandId) { +int ASound1::command(int commandId, int param) { if (commandId > 41) return 0; + _commandParam = param; _frameCounter = 0; return (this->*_commandList[commandId])(); } @@ -1060,12 +1061,22 @@ int ASound1::command25() { } int ASound1::command26() { - error("TODO: command26"); + byte *pData = loadData(0xEEC, 10); + pData[5] = (command2627293032() + 0x7F) & 0xFF; + + if (!isSoundActive(pData)) + _channels[6].load(pData); + return 0; } int ASound1::command27() { - error("TODO: ASound::command27"); + byte *pData = loadData(0xEE2, 10); + pData[5] = (command2627293032() + 0x40) & 0xFF; + + if (!isSoundActive(pData)) + _channels[7].load(pData); + return 0; } @@ -1075,12 +1086,23 @@ int ASound1::command28() { } int ASound1::command29() { - error("TODO: ASound::command29"); + byte *pData = loadData(0xC82, 36); + byte v = (command2627293032() + 0x40) & 0xFF; + pData[7] = pData[13] = pData[21] = pData[27] = v; + + if (!isSoundActive(pData)) + playSound(pData, 0); + return 0; } int ASound1::command30() { - error("TODO: ASound::command30"); + byte *pData = loadData(0xEA6, 16); + pData[7] = (command2627293032() + 0x40) & 0xFF; + + if (!isSoundActive(pData)) + playSound(pData, 0); + return 0; } @@ -1093,7 +1115,14 @@ int ASound1::command31() { } int ASound1::command32() { - error("TODO: ASound::command32"); + byte *pData = loadData(0xEB4, 46); + int v = command2627293032() + 0x40; + pData[9] = pData[17] = pData[25] = pData[33] = v & 0xFF; + pData[11] = pData[19] = pData[27] = pData[35] = v >> 8; + + if (!isSoundActive(pData)) + playSound(pData, 0); + return 0; } @@ -1169,10 +1198,8 @@ void ASound1::command111213() { } } -void ASound1::command2627293032() { - // TODO: This method takes a parameter off the stack for several levels up. - // i.e. something the caller's caller pushed onto the stack. Need to figure - // out a better way to pass parameters down if this is actually in use. +int ASound1::command2627293032() { + return (_commandParam > 0x40) ? _commandParam - 0x40 : _commandParam & 0xff00; } } // End of namespace Nebular diff --git a/engines/mads/nebular/sound_nebular.h b/engines/mads/nebular/sound_nebular.h index 11836e6559..c7a28620be 100644 --- a/engines/mads/nebular/sound_nebular.h +++ b/engines/mads/nebular/sound_nebular.h @@ -226,8 +226,9 @@ protected: /** * Play the specified raw sound data * @param pData Pointer to data block containing sound data + * @param startingChannel Channel to start scan from */ - void playSound(byte *pData); + void playSound(byte *pData, int startingChannel = ADLIB_CHANNEL_COUNT); /** * Checks to see whether the given block of data is already loaded into a channel. @@ -307,9 +308,11 @@ public: /** * Execute a player command. Most commands represent sounds to play, but some - * low number commands also provide control operations + * low number commands also provide control operations. + * @param commandId Player ommand to execute. + * @param param Optional parameter used by a few commands */ - virtual int command(int commandId) = 0; + virtual int command(int commandId, int param = 0) = 0; /** * Stop all currently playing sounds @@ -358,6 +361,7 @@ private: typedef int (ASound1::*CommandPtr)(); static const CommandPtr _commandList[42]; bool _cmd23Toggle; + int _commandParam; int command9(); int command10(); @@ -394,11 +398,11 @@ private: int command41(); void command111213(); - void command2627293032(); + int command2627293032(); public: ASound1(Audio::Mixer *mixer); - virtual int command(int commandId); + virtual int command(int commandId, int param = 0); }; } // End of namespace Nebular -- cgit v1.2.3 From 7020dbea6a56e41dc199257e898240451bb5bfb1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 21 Feb 2014 21:03:15 -0500 Subject: MADS: Fixes for the HagArchive reading resources --- engines/mads/resources.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/engines/mads/resources.cpp b/engines/mads/resources.cpp index 0630230bec..ac46df96c5 100644 --- a/engines/mads/resources.cpp +++ b/engines/mads/resources.cpp @@ -22,7 +22,6 @@ #include "common/scummsys.h" #include "common/archive.h" -#include "common/substream.h" #include "common/textconsole.h" #include "mads/mads.h" #include "mads/resources.h" @@ -155,9 +154,9 @@ Common::SeekableReadStream *HagArchive::createReadStreamForMember(const Common:: if (!f.open(hagIndex._filename)) error("Could not open HAG file"); - // Return a substream for the specific resource - return new Common::SeekableSubReadStream(&f, - hagEntry._offset, hagEntry._size, DisposeAfterUse::YES); + // Return a new stream for the specific resource + f.seek(hagEntry._offset); + return f.readStream(hagEntry._size); } return nullptr; @@ -182,6 +181,8 @@ void HagArchive::loadIndex() { int numEntries = hagFile.readUint16LE(); HagIndex hagIndex; + hagIndex._filename = filename; + for (int idx = 0; idx < numEntries; ++idx) { // Read in the details of the next resource char resourceBuffer[14]; -- cgit v1.2.3 From 40b3ab62ca8a16c2fd06bfcc691967c4f510d52a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 21 Feb 2014 21:03:44 -0500 Subject: MADS: Fixes for reading in HOGANUS entries --- engines/mads/nebular/dialogs_nebular.cpp | 39 ++++++++++++++++++++++++++++++++ engines/mads/nebular/dialogs_nebular.h | 30 ++++++++++++++++++++---- engines/mads/nebular/game_nebular.cpp | 5 ++-- 3 files changed, 68 insertions(+), 6 deletions(-) diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp index 5aede49b90..cd7ab86590 100644 --- a/engines/mads/nebular/dialogs_nebular.cpp +++ b/engines/mads/nebular/dialogs_nebular.cpp @@ -31,6 +31,45 @@ namespace MADS { namespace Nebular { +bool CopyProtectionDialog::show(MADSEngine *vm) { + CopyProtectionDialog *dlg = new CopyProtectionDialog(vm); + + delete dlg; + return true; +} + +CopyProtectionDialog::CopyProtectionDialog(MADSEngine *vm): _vm(vm) { + getHogAnusEntry(_hogEntry); +} + +bool CopyProtectionDialog::getHogAnusEntry(HOGANUS &entry) { + File f; + f.open("*HOGANUS.DAT"); + + // Read in the total number of entries, and randomly pick an entry to use + int numEntries = f.readUint16LE(); + int entryIndex = _vm->getRandomNumber(numEntries - 2) + 1; + + // Read in the encrypted entry + f.seek(28 * entryIndex + 2); + byte entryData[28]; + f.read(entryData, 28); + + // Decrypt it + for (int i = 0; i < 28; ++i) + entryData[i] = ~entryData[i]; + + // Fill out the fields + entry._bookId = entryData[0]; + entry._pageNum = READ_LE_UINT16(&entryData[2]); + entry._lineNum = READ_LE_UINT16(&entryData[4]); + entry._wordNum = READ_LE_UINT16(&entryData[6]); + entry._word = Common::String((char *)&entryData[8]); + + f.close(); + return true; +} + } // End of namespace Nebular diff --git a/engines/mads/nebular/dialogs_nebular.h b/engines/mads/nebular/dialogs_nebular.h index a747f7575d..6417c2cdc3 100644 --- a/engines/mads/nebular/dialogs_nebular.h +++ b/engines/mads/nebular/dialogs_nebular.h @@ -20,8 +20,8 @@ * */ -#ifndef MADS_GAME_NEBULAR_H -#define MADS_GAME_NEBULAR_H +#ifndef MADS_DIALOGS_NEBULAR_H +#define MADS_DIALOGS_NEBULAR_H #include "common/scummsys.h" #include "mads/game.h" @@ -30,15 +30,37 @@ namespace MADS { namespace Nebular { +struct HOGANUS { + int _bookId; + int _pageNum; + int _lineNum; + int _wordNum; + Common::String _word; +}; + class CopyProtectionDialog { private: + MADSEngine *_vm; + HOGANUS _hogEntry; + + /** + * Constructor + */ + CopyProtectionDialog(MADSEngine *vm); + /** + * Get a random copy protection entry from the HOGANUS resource + */ + bool getHogAnusEntry(HOGANUS &entry); public: - static bool show() { return false; } + /** + * Show the dialog + */ + static bool show(MADSEngine *vm); }; } // End of namespace Nebular } // End of namespace MADS -#endif /* MADS_GAME_NEBULAR_H */ +#endif /* MADS_DIALOGS_NEBULAR_H */ diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index 43d705fcf8..10c210c6eb 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -27,6 +27,7 @@ #include "mads/graphics.h" #include "mads/msurface.h" #include "mads/nebular/game_nebular.h" +#include "mads/nebular/dialogs_nebular.h" namespace MADS { @@ -37,10 +38,10 @@ GameNebular::GameNebular(MADSEngine *vm): Game(vm) { } bool GameNebular::checkCopyProtection() { - if (!ConfMan.getBool("copy_protection") || (ConfMan.hasKey("passed_protection") && - ConfMan.getInt("passed_protection") == 1)) + if (!ConfMan.getBool("copy_protection")) return true; + CopyProtectionDialog::show(_vm); return false; } -- cgit v1.2.3 From 9f1416c6a358eb1dc860ff1176ae89721d82fc50 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 22 Feb 2014 00:24:39 -0500 Subject: MADS: Implemented constructor for copy protection dialog, and support methods --- engines/mads/font.cpp | 160 ++++++++--------------------- engines/mads/font.h | 31 +----- engines/mads/mads.cpp | 4 +- engines/mads/nebular/dialogs_nebular.cpp | 167 ++++++++++++++++++++++++++++++- engines/mads/nebular/dialogs_nebular.h | 75 +++++++++++++- engines/mads/palette.cpp | 43 +++++--- engines/mads/palette.h | 42 +++----- 7 files changed, 330 insertions(+), 192 deletions(-) diff --git a/engines/mads/font.cpp b/engines/mads/font.cpp index 076eca92c6..52541500c9 100644 --- a/engines/mads/font.cpp +++ b/engines/mads/font.cpp @@ -28,14 +28,6 @@ namespace MADS { -Font *Font::init(MADSEngine *vm) { - if (vm->getGameFeatures() & GF_MADS) { - return new FontMADS(vm); - } else { - return new FontM4(vm); - } -} - Font::Font(MADSEngine *vm) : _vm(vm) { _sysFont = true; @@ -53,6 +45,43 @@ Font::~Font() { } } +void Font::setFont(const Common::String &filename) { + if (!_filename.empty() && (filename == _filename)) + // Already using specified font, so don't bother reloading + return; + + _sysFont = false; + _filename = filename; + + MadsPack fontData(filename, _vm); + Common::SeekableReadStream *fontFile = fontData.getItemStream(0); + + _maxHeight = fontFile->readByte(); + _maxWidth = fontFile->readByte(); + + _charWidths = new uint8[128]; + // Char data is shifted by 1 + _charWidths[0] = 0; + fontFile->read(_charWidths + 1, 127); + fontFile->readByte(); // remainder + + _charOffs = new uint16[128]; + + uint startOffs = 2 + 128 + 256; + uint fontSize = fontFile->size() - startOffs; + + // Char data is shifted by 1 + _charOffs[0] = 0; + for (int i = 1; i < 128; i++) + _charOffs[i] = fontFile->readUint16LE() - startOffs; + fontFile->readUint16LE(); // remainder + + _charData = new uint8[fontSize]; + fontFile->read(_charData, fontSize); + + delete fontFile; +} + void Font::setColor(uint8 color) { if (_sysFont) _fontColors[1] = color; @@ -60,14 +89,11 @@ void Font::setColor(uint8 color) { _fontColors[3] = color; } -void Font::setColors(uint8 alt1, uint8 alt2, uint8 foreground) { - if (_sysFont) - _fontColors[1] = foreground; - else { - _fontColors[1] = alt1; - _fontColors[2] = alt2; - _fontColors[3] = foreground; - } +void Font::setColors(uint8 v1, uint8 v2, uint8 v3, uint8 v4) { + _fontColors[0] = v1; + _fontColors[1] = v2; + _fontColors[2] = v3; + _fontColors[3] = v4; } int Font::write(MSurface *surface, const Common::String &msg, const Common::Point &pt, int width, int spaceWidth, uint8 colors[]) { @@ -160,11 +186,6 @@ int Font::write(MSurface *surface, const Common::String &msg, const Common::Poin } int Font::getWidth(const Common::String &msg, int spaceWidth) { - /* - if (custom_ascii_converter) { // if there is a function to convert the extended ASCII characters - custom_ascii_converter(out_string); // call it with the string - } - */ int width = 0; const char *text = msg.c_str(); @@ -173,46 +194,7 @@ int Font::getWidth(const Common::String &msg, int spaceWidth) { return width; } -/*------------------------------------------------------------------------*/ - -void FontMADS::setFont(const Common::String &filename) { - if (!_filename.empty() && (filename == _filename)) - // Already using specified font, so don't bother reloading - return; - - _sysFont = false; - _filename = filename; - - MadsPack fontData(filename, _vm); - Common::SeekableReadStream *fontFile = fontData.getItemStream(0); - - _maxHeight = fontFile->readByte(); - _maxWidth = fontFile->readByte(); - - _charWidths = new uint8[128]; - // Char data is shifted by 1 - _charWidths[0] = 0; - fontFile->read(_charWidths + 1, 127); - fontFile->readByte(); // remainder - - _charOffs = new uint16[128]; - - uint startOffs = 2 + 128 + 256; - uint fontSize = fontFile->size() - startOffs; - - // Char data is shifted by 1 - _charOffs[0] = 0; - for (int i = 1; i < 128; i++) - _charOffs[i] = fontFile->readUint16LE() - startOffs; - fontFile->readUint16LE(); // remainder - - _charData = new uint8[fontSize]; - fontFile->read(_charData, fontSize); - - delete fontFile; -} - -int FontMADS::getBpp(int charWidth) { +int Font::getBpp(int charWidth) { if (charWidth > 12) return 4; else if (charWidth > 8) @@ -223,60 +205,4 @@ int FontMADS::getBpp(int charWidth) { return 1; } -/*------------------------------------------------------------------------*/ - -void FontM4::setFont(const Common::String &filename) { - if (!_filename.empty() && (filename == _filename)) - // Already using specified font, so don't bother reloading - return; - - _sysFont = false; - _filename = filename; - - Common::SeekableReadStream *fontFile = nullptr; //_vm->_resources->openFile(filename); - - if (fontFile->readUint32LE() != MKTAG('F', 'O', 'N', 'T')) { - warning("Font: FONT tag expected"); - return; - } - - _maxHeight = fontFile->readByte(); - _maxWidth = fontFile->readByte(); - uint fontSize = fontFile->readUint32LE(); - - //printf("Font::Font: _maxWidth = %d, _maxHeight = %d, fontSize = %d\n", _maxWidth, _maxHeight, fontSize); - - if (fontFile->readUint32LE() != MKTAG('W', 'I', 'D', 'T')) { - warning("Font: WIDT tag expected"); - return; - } - - _charWidths = new uint8[256]; - fontFile->read(_charWidths, 256); - - if (fontFile->readUint32LE() != MKTAG('O', 'F', 'F', 'S')) { - warning("Font: OFFS tag expected\n"); - return; - } - - _charOffs = new uint16[256]; - - for (int i = 0; i < 256; i++) - _charOffs[i] = fontFile->readUint16LE(); - - if (fontFile->readUint32LE() != MKTAG('P', 'I', 'X', 'S')) { - warning("Font: PIXS tag expected\n"); - return; - } - - _charData = new uint8[fontSize]; - fontFile->read(_charData, fontSize); - -// _vm->_resources->toss(filename); -} - -int FontM4::getBpp(int charWidth) { - return charWidth / 4 + 1; -} - } // End of namespace MADS diff --git a/engines/mads/font.h b/engines/mads/font.h index d36be80830..3f01260fbd 100644 --- a/engines/mads/font.h +++ b/engines/mads/font.h @@ -62,19 +62,16 @@ protected: Common::String _filename; uint8 _fontColors[4]; -protected: - Font(MADSEngine *vm); - - virtual void setFont(const Common::String &filename) = 0; - virtual int getBpp(int charWidth) = 0; -public: - static Font *init(MADSEngine *vm); + int getBpp(int charWidth); public: + Font(MADSEngine *vm); virtual ~Font(); + void setFont(const Common::String &filename); void setColor(uint8 color); - void setColors(uint8 alt1, uint8 alt2, uint8 foreground); + void setColors(uint8 v1, uint8 v2, uint8 v3, uint8 v4); + int maxWidth() const { return _maxWidth; } int getWidth(const Common::String &msg, int spaceWidth = -1); int getHeight() const { return _maxHeight; } int write(MSurface *surface, const Common::String &msg, const Common::Point &pt, int width, int spaceWidth, uint8 colors[]); @@ -83,24 +80,6 @@ public: } }; -class FontMADS: public Font { - friend class Font; -protected: - virtual void setFont(const Common::String &filename); - virtual int getBpp(int charWidth); - - FontMADS(MADSEngine *vm): Font(vm) {} -}; - -class FontM4: public Font { - friend class Font; -protected: - virtual void setFont(const Common::String &filename); - virtual int getBpp(int charWidth); - - FontM4(MADSEngine *vm): Font(vm) {} -}; - } // End of namespace MADS #endif /* MADS_FONT_H */ diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index ec99b314a7..827c62ac61 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -74,8 +74,8 @@ void MADSEngine::initialise() { ResourcesManager::init(this); _events = new EventsManager(this); - _palette = Palette::init(this); - _font = Font::init(this); + _palette = new Palette(this); + _font = new Font(this); _screen = MSurface::init(true); _sound = new SoundManager(this, _mixer); _userInterface = UserInterface::init(this); diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp index cd7ab86590..85b06ce592 100644 --- a/engines/mads/nebular/dialogs_nebular.cpp +++ b/engines/mads/nebular/dialogs_nebular.cpp @@ -31,15 +31,178 @@ namespace MADS { namespace Nebular { +TextDialog::TextDialog(MADSEngine *vm, const Common::String &fontName, + const Common::Point &pos, int maxChars) { + _vm = vm; + _fontName = fontName; + _position = pos; + + _vm->_font->setFont(FONT_INTERFACE); + _vm->_font->setColors(TEXTDIALOG_FONT, TEXTDIALOG_FONT, TEXTDIALOG_FONT, TEXTDIALOG_FONT); + + _innerWidth = (_vm->_font->maxWidth() + 1) * maxChars; + _width = _innerWidth + 10; + _lineSize = maxChars * 2; + _lineWidth = 0; + _currentX = 0; + _numLines = 0; + Common::fill(&_lineXp[0], &_lineXp[TEXT_DIALOG_MAX_LINES], 0); + + Common::copy(&_vm->_palette->_mainPalette[TEXTDIALOG_F8 * 3], + &_vm->_palette->_mainPalette[TEXTDIALOG_F8 * 3 + 8 * 3], + &_savedPalette[0]); + Palette::setGradient(_vm->_palette->_mainPalette, TEXTDIALOG_F8, 2, 0x24, 0x20); + Palette::setGradient(_vm->_palette->_mainPalette, TEXTDIALOG_FA, 2, 0x27, 0x1C); + Palette::setGradient(_vm->_palette->_mainPalette, TEXTDIALOG_FC, 2, 0x24, 0x20); + Palette::setGradient(_vm->_palette->_mainPalette, TEXTDIALOG_FE, 1, 0x37, 0x37); + + _vm->_palette->setPalette(_vm->_palette->_mainPalette + (TEXTDIALOG_F8 * 3), + TEXTDIALOG_F8, 8); +} + +TextDialog::~TextDialog() { +} + +void TextDialog::addLine(const Common::String &line, bool underline) { + if (_lineWidth > 0 || _currentX > 0) + incNumLines(); + + int stringWidth = _vm->_font->getWidth(line); + if (stringWidth >= _innerWidth || (int)line.size() >= _lineSize) { + wordWrap(line); + } else { + _lineXp[_numLines] = (_innerWidth / 2) - (stringWidth / 2); + _lines[_numLines] = line; + + if (underline) + underlineLine(); + } + + incNumLines(); +} + +void TextDialog::underlineLine() { + _lineXp[_numLines] |= 0x80; +} + +void TextDialog::incNumLines() { + _lineWidth = 0; + _currentX = 0; + if (++_numLines == TEXT_DIALOG_MAX_LINES) + error("Exceeded text dialog line max"); +} + +void TextDialog::wordWrap(const Common::String &line) { + Common::String tempLine; + + if (!line.empty()) { + const char *srcP = line.c_str(); + + do { + tempLine = ""; + bool endWord = false; + bool newLine = false; + bool continueFlag = true; + + do { + if (!*srcP) { + continueFlag = false; + } else { + tempLine += *srcP; + + if (*srcP == 10) { + continueFlag = false; + newLine = true; + ++srcP; + tempLine.deleteLastChar(); + } else if (*srcP == ' ') { + ++srcP; + endWord = true; + } else if (!endWord) { + ++srcP; + } else { + tempLine.deleteLastChar(); + continueFlag = false; + } + } + } while (continueFlag); + + if (tempLine.hasSuffix(" ")) + tempLine.deleteLastChar(); + + Common::String tempLine2; + if (_currentX > 0) + tempLine2 += ' '; + tempLine2 += tempLine; + + int lineWidth = _vm->_font->getWidth(tempLine2, 1); + if (((_currentX + (int)tempLine2.size()) > _lineSize) || + ((_lineWidth + lineWidth) > _innerWidth)) { + incNumLines(); + appendLine(tempLine); + } else { + appendLine(tempLine2); + } + + if (newLine) + incNumLines(); + } while (*srcP); + } +} + +void TextDialog::appendLine(const Common::String &line) { + _currentX += line.size(); + _lineWidth += _vm->_font->getWidth(line, 1); + _lines[_numLines] += line; +} + +/*------------------------------------------------------------------------*/ + bool CopyProtectionDialog::show(MADSEngine *vm) { - CopyProtectionDialog *dlg = new CopyProtectionDialog(vm); + CopyProtectionDialog *dlg = new CopyProtectionDialog(vm, false); delete dlg; return true; } -CopyProtectionDialog::CopyProtectionDialog(MADSEngine *vm): _vm(vm) { +CopyProtectionDialog::CopyProtectionDialog(MADSEngine *vm, bool priorAnswerWrong): + TextDialog(vm, FONT_INTERFACE_MADS, Common::Point(-1, -1), 32) { getHogAnusEntry(_hogEntry); + + if (priorAnswerWrong) { + addLine("ANSWER INCORRECT!", true); + wordWrap("\n"); + addLine("(But we'll give you another chance!)"); + } else { + addLine("REX NEBULAR version 8.43", true); + wordWrap("\n"); + addLine("(Copy Protection, for your convenience)"); + } + wordWrap("\n"); + + wordWrap("Now comes the part that everybody hates. But if we don't"); + wordWrap("do this, nasty rodent-like people will pirate this game"); + wordWrap("and a whole generation of talented designers, programmers,"); + wordWrap("artists, and playtesters will go hungry, and will wander"); + wordWrap("aimlessly through the land at night searching for peace."); + wordWrap("So let's grit our teeth and get it over with. Just get"); + + Common::String line = "out your copy of "; + line += _hogEntry._bookId == 103 ? "the GAME MANUAL" : "REX'S LOGBOOK"; + line += ". See! That was easy. "; + wordWrap(line); + + line = Common::String::format("Next, just turn to page %d. On line %d, find word number %d, ", + _hogEntry._pageNum, _hogEntry._lineNum, _hogEntry._wordNum); + wordWrap(line); + + wordWrap("and type it on the line below (we',27h,'ve even given you"); + wordWrap("first letter as a hint). As soon as you do that, we can get"); + wordWrap("right into this really COOL adventure game!\n"); + wordWrap("\n"); + wordWrap(" "); + wordWrap("\n"); + } bool CopyProtectionDialog::getHogAnusEntry(HOGANUS &entry) { diff --git a/engines/mads/nebular/dialogs_nebular.h b/engines/mads/nebular/dialogs_nebular.h index 6417c2cdc3..3e28ee39b3 100644 --- a/engines/mads/nebular/dialogs_nebular.h +++ b/engines/mads/nebular/dialogs_nebular.h @@ -30,6 +30,76 @@ namespace MADS { namespace Nebular { +enum { + TEXTDIALOG_F8 = 0XF8, + TEXTDIALOG_F9 = 0XF8, + TEXTDIALOG_FA = 0XF8, + TEXTDIALOG_FB = 0XF8, + TEXTDIALOG_FC = 0XF8, + TEXTDIALOG_FD = 0XF8, + TEXTDIALOG_FE = 0XF8, + TEXTDIALOG_FONT = 0 +}; + +#define TEXT_DIALOG_MAX_LINES 20 + +class TextDialog { +private: + /** + * Increments the number of text lines the text dialog uses + */ + void incNumLines(); + + /** + * Flags the previously added line to be underlined + */ + void underlineLine(); + + /** + * Append text to the currently end line. + */ + void appendLine(const Common::String &line); +protected: + MADSEngine *_vm; + Common::Point _position; + Common::String _fontName; + int _width; + int _innerWidth; + int _lineWidth; + int _currentX; + int _numLines; + int _lineSize; + Common::String _lines[TEXT_DIALOG_MAX_LINES]; + int _lineXp[TEXT_DIALOG_MAX_LINES]; + byte _savedPalette[8 * 3]; + + /** + * Add a new line to the dialog + */ + void addLine(const Common::String &line, bool underline = false); + + /** + * Adds one or more lines, word wrapping the passed text + */ + void wordWrap(const Common::String &line); +public: + /** + * Constructor + * @param vm Engine reference + * @param fontName Font to use for display + * @param pos Position for window top-left + * @param maxChars Horizontal width of window in characters + */ + TextDialog(MADSEngine *vm, const Common::String &fontName, const Common::Point &pos, + int maxChars); + + /** + * Destructor + */ + ~TextDialog(); + +}; + struct HOGANUS { int _bookId; int _pageNum; @@ -38,15 +108,14 @@ struct HOGANUS { Common::String _word; }; -class CopyProtectionDialog { +class CopyProtectionDialog: public TextDialog { private: - MADSEngine *_vm; HOGANUS _hogEntry; /** * Constructor */ - CopyProtectionDialog(MADSEngine *vm); + CopyProtectionDialog(MADSEngine *vm, bool priorAnswerWrong); /** * Get a random copy protection entry from the HOGANUS resource diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index 6a5d507c13..c858984a52 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -54,18 +54,11 @@ RGBList::~RGBList() { #define VGA_COLOR_TRANS(x) (x == 0x3f ? 255 : x << 2) -Palette *Palette::init(MADSEngine *vm) { - if (vm->getGameFeatures() & GF_MADS) { - return new PaletteMADS(vm); - } else { - return new PaletteM4(vm); - } -} - Palette::Palette(MADSEngine *vm) : _vm(vm) { reset(); _fading_in_progress = false; Common::fill(&_usageCount[0], &_usageCount[PALETTE_COUNT], 0); + Common::fill(&_mainPalette[0], &_mainPalette[PALETTE_SIZE], 0); } void Palette::setPalette(const byte *colors, uint start, uint num) { @@ -245,9 +238,35 @@ void Palette::fadeRange(byte *srcPal, byte *destPal, int startIndex, int endInd _vm->_palette->setPalette(&destPal[startIndex * 3], startIndex, endIndex - startIndex + 1); } -/*------------------------------------------------------------------------*/ +void Palette::setGradient(byte *palette, int start, int count, int rgbValue1, int rgbValue2) { + int rgbCtr = 0; + int rgbDiff = -(rgbValue2 - rgbValue1); + int rgbCurrent = rgbValue2; + + if (count > 0) { + byte *pDest = palette + start * 3; + int endVal = count - 1; + int numLeft = count; + + do { + pDest[0] = pDest[1] = pDest[2] = rgbCurrent; + + if (count > 1) { + rgbCtr += rgbDiff; + if (rgbCtr >= endVal) { + do { + ++rgbCurrent; + rgbCtr += 1 - numLeft; + } while (rgbCtr >= endVal); + } + } + + pDest += 3; + } while (--numLeft > 0); + } +} -byte *PaletteMADS::decodePalette(Common::SeekableReadStream *palStream, int *numColors) { +byte *Palette::decodePalette(Common::SeekableReadStream *palStream, int *numColors) { *numColors = palStream->readUint16LE(); assert(*numColors <= 252); @@ -269,7 +288,7 @@ byte *PaletteMADS::decodePalette(Common::SeekableReadStream *palStream, int *num return palData; } -int PaletteMADS::loadPalette(Common::SeekableReadStream *palStream, int indexStart) { +int Palette::loadPalette(Common::SeekableReadStream *palStream, int indexStart) { int colorCount; byte *palData = decodePalette(palStream, &colorCount); _vm->_palette->setPalette(palData, indexStart, colorCount); @@ -278,7 +297,7 @@ int PaletteMADS::loadPalette(Common::SeekableReadStream *palStream, int indexSta return colorCount; } -void PaletteMADS::setSystemPalette() { +void Palette::setSystemPalette() { resetColorCounts(); byte palData[4 * 3]; diff --git a/engines/mads/palette.h b/engines/mads/palette.h index a97d5de20f..0ef8693a1f 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -84,13 +84,14 @@ protected: byte _fadedPalette[PALETTE_COUNT * 4]; int _usageCount[PALETTE_COUNT]; - Palette(MADSEngine *vm); void reset(); +public: + byte _mainPalette[PALETTE_SIZE]; public: /** - * Creates a new palette instance + * Constructor */ - static Palette *init(MADSEngine *vm); + Palette(MADSEngine *vm); /** * Destructor @@ -153,17 +154,22 @@ public: /** * Decode a palette and return it, without affecting the Palette itself */ - virtual byte *decodePalette(Common::SeekableReadStream *palStream, int *numColors) = 0; + byte *decodePalette(Common::SeekableReadStream *palStream, int *numColors); /** * Loads a palette from a stream */ - virtual int loadPalette(Common::SeekableReadStream *palStream, int indexStart = 0) = 0; + int loadPalette(Common::SeekableReadStream *palStream, int indexStart = 0); /** * Sets a small set of system/core colors needed by the game */ - virtual void setSystemPalette() = 0; + void setSystemPalette(); + + /** + * Update a range of an arbitrary palette + */ + static void setGradient(byte *palette, int start, int count, int rgbValue1, int rgbValue2); // Color indexes uint8 BLACK; @@ -184,30 +190,6 @@ public: uint8 WHITE; }; -class PaletteMADS: protected Palette { - friend class Palette; -protected: - PaletteMADS(MADSEngine *vm): Palette(vm) {} -public: - virtual byte *decodePalette(Common::SeekableReadStream *palStream, int *numColors); - virtual int loadPalette(Common::SeekableReadStream *palStream, int indexStart = 0); - virtual void setSystemPalette(); -}; - -class PaletteM4: protected Palette { - friend class Palette; -protected: - PaletteM4(MADSEngine *vm): Palette(vm) {} -public: - virtual byte *decodePalette(Common::SeekableReadStream *palStream, int *numColors) { - return nullptr; - } - virtual int loadPalette(Common::SeekableReadStream *palStream, int indexStart = 0) { - return 0; - } - virtual void setSystemPalette() {} -}; - } // End of namespace MADS #endif /* MADS_PALETTE_H */ -- cgit v1.2.3 From 54c4515232ec26397903373ed46e9492223ce2f2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 22 Feb 2014 08:39:44 -0500 Subject: MADS: Beginnings of dialog class hierarchy --- engines/mads/dialogs.cpp | 200 +++++++++++++++++++++++++++++++ engines/mads/dialogs.h | 137 +++++++++++++++++++++ engines/mads/font.h | 24 ++-- engines/mads/module.mk | 1 + engines/mads/nebular/dialogs_nebular.cpp | 129 +------------------- engines/mads/nebular/dialogs_nebular.h | 71 +---------- 6 files changed, 347 insertions(+), 215 deletions(-) create mode 100644 engines/mads/dialogs.cpp create mode 100644 engines/mads/dialogs.h diff --git a/engines/mads/dialogs.cpp b/engines/mads/dialogs.cpp new file mode 100644 index 0000000000..4e64f08822 --- /dev/null +++ b/engines/mads/dialogs.cpp @@ -0,0 +1,200 @@ +/* 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 "common/scummsys.h" +#include "common/config-manager.h" +#include "mads/mads.h" +#include "mads/graphics.h" +#include "mads/msurface.h" +#include "mads/nebular/dialogs_nebular.h" + +namespace MADS { + +Dialog::Dialog(MADSEngine *vm): _vm(vm), _savedSurface(nullptr), + _position(Common::Point(-1, -1)), _width(0), _height(0) { +} + +Dialog::~Dialog() { + delete _savedSurface; +} + + +void Dialog::save(MSurface *s) { + _savedSurface = MSurface::init(_width, _height); + s->copyTo(_savedSurface, + Common::Rect(_position.x, _position.y, _position.x + _width, _position.y + _height), + Common::Point()); +} + +void Dialog::restore(MSurface *s) { + _savedSurface->copyTo(s, _position); + delete _savedSurface; + _savedSurface = nullptr; +} + +/*------------------------------------------------------------------------*/ + +TextDialog::TextDialog(MADSEngine *vm, const Common::String &fontName, + const Common::Point &pos, int maxChars): + Dialog(vm) { + _vm = vm; + _fontName = fontName; + _position = pos; + + _vm->_font->setFont(FONT_INTERFACE); + _vm->_font->setColors(TEXTDIALOG_FONT, TEXTDIALOG_FONT, TEXTDIALOG_FONT, TEXTDIALOG_FONT); + + _innerWidth = (_vm->_font->maxWidth() + 1) * maxChars; + _width = _innerWidth + 10; + _lineSize = maxChars * 2; + _lineWidth = 0; + _currentX = 0; + _numLines = 0; + Common::fill(&_lineXp[0], &_lineXp[TEXT_DIALOG_MAX_LINES], 0); + + Common::copy(&_vm->_palette->_mainPalette[TEXTDIALOG_F8 * 3], + &_vm->_palette->_mainPalette[TEXTDIALOG_F8 * 3 + 8 * 3], + &_savedPalette[0]); + Palette::setGradient(_vm->_palette->_mainPalette, TEXTDIALOG_F8, 2, 0x24, 0x20); + Palette::setGradient(_vm->_palette->_mainPalette, TEXTDIALOG_FA, 2, 0x27, 0x1C); + Palette::setGradient(_vm->_palette->_mainPalette, TEXTDIALOG_FC, 2, 0x24, 0x20); + Palette::setGradient(_vm->_palette->_mainPalette, TEXTDIALOG_FE, 1, 0x37, 0x37); + + _vm->_palette->setPalette(_vm->_palette->_mainPalette + (TEXTDIALOG_F8 * 3), + TEXTDIALOG_F8, 8); +} + +TextDialog::~TextDialog() { +} + +void TextDialog::addLine(const Common::String &line, bool underline) { + if (_lineWidth > 0 || _currentX > 0) + incNumLines(); + + int stringWidth = _vm->_font->getWidth(line); + if (stringWidth >= _innerWidth || (int)line.size() >= _lineSize) { + wordWrap(line); + } else { + _lineXp[_numLines] = (_innerWidth / 2) - (stringWidth / 2); + _lines[_numLines] = line; + + if (underline) + underlineLine(); + } + + incNumLines(); +} + +void TextDialog::underlineLine() { + _lineXp[_numLines] |= 0x80; +} + +void TextDialog::incNumLines() { + _lineWidth = 0; + _currentX = 0; + if (++_numLines == TEXT_DIALOG_MAX_LINES) + error("Exceeded text dialog line max"); +} + +void TextDialog::wordWrap(const Common::String &line) { + Common::String tempLine; + + if (!line.empty()) { + const char *srcP = line.c_str(); + + do { + tempLine = ""; + bool endWord = false; + bool newLine = false; + bool continueFlag = true; + + do { + if (!*srcP) { + continueFlag = false; + } else { + tempLine += *srcP; + + if (*srcP == 10) { + continueFlag = false; + newLine = true; + ++srcP; + tempLine.deleteLastChar(); + } else if (*srcP == ' ') { + ++srcP; + endWord = true; + } else if (!endWord) { + ++srcP; + } else { + tempLine.deleteLastChar(); + continueFlag = false; + } + } + } while (continueFlag); + + if (tempLine.hasSuffix(" ")) + tempLine.deleteLastChar(); + + Common::String tempLine2; + if (_currentX > 0) + tempLine2 += ' '; + tempLine2 += tempLine; + + int lineWidth = _vm->_font->getWidth(tempLine2, 1); + if (((_currentX + (int)tempLine2.size()) > _lineSize) || + ((_lineWidth + lineWidth) > _innerWidth)) { + incNumLines(); + appendLine(tempLine); + } else { + appendLine(tempLine2); + } + + if (newLine) + incNumLines(); + } while (*srcP); + } +} + +void TextDialog::appendLine(const Common::String &line) { + _currentX += line.size(); + _lineWidth += _vm->_font->getWidth(line, 1); + _lines[_numLines] += line; +} + +/*------------------------------------------------------------------------*/ + +MessageDialog::MessageDialog(MADSEngine *vm, int maxChars, ...): + TextDialog(vm, FONT_INTERFACE, Common::Point(-1, -1), maxChars) { + // Add in passed line list + va_list va; + va_start(va, maxChars); + + const char *line = va_arg(va, const char *); + while (line) { + addLine(line); + line = va_arg(va, const char *); + } + va_end(va); + + // TODO +} + +} // End of namespace MADS diff --git a/engines/mads/dialogs.h b/engines/mads/dialogs.h new file mode 100644 index 0000000000..03710b6b82 --- /dev/null +++ b/engines/mads/dialogs.h @@ -0,0 +1,137 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_DIALOGS_H +#define MADS_DIALOGS_H + +#include "common/scummsys.h" +#include "mads/game.h" +#include "mads/msurface.h" + +namespace MADS { + +class Dialog { +protected: + MADSEngine *_vm; + MSurface *_savedSurface; + Common::Point _position; + int _width; + int _height; + + /** + * Save the section of the passed surface the dialog will cover. + * @param s Screen surface to save + */ + void save(MSurface *s); + + /** + * Restore saved dialog surface + * @param s Screen surface to restore to. + */ + void restore(MSurface *s); +public: + /** + * Constructor + */ + Dialog(MADSEngine *vm); + + /** + * Destructor + */ + ~Dialog(); +}; + +enum { + TEXTDIALOG_F8 = 0XF8, + TEXTDIALOG_F9 = 0XF8, + TEXTDIALOG_FA = 0XF8, + TEXTDIALOG_FB = 0XF8, + TEXTDIALOG_FC = 0XF8, + TEXTDIALOG_FD = 0XF8, + TEXTDIALOG_FE = 0XF8, + TEXTDIALOG_FONT = 0 +}; + +#define TEXT_DIALOG_MAX_LINES 20 + +class TextDialog: protected Dialog { +private: + /** + * Increments the number of text lines the text dialog uses + */ + void incNumLines(); + + /** + * Flags the previously added line to be underlined + */ + void underlineLine(); + + /** + * Append text to the currently end line. + */ + void appendLine(const Common::String &line); +protected: + Common::String _fontName; + int _innerWidth; + int _lineWidth; + int _currentX; + int _numLines; + int _lineSize; + Common::String _lines[TEXT_DIALOG_MAX_LINES]; + int _lineXp[TEXT_DIALOG_MAX_LINES]; + byte _savedPalette[8 * 3]; + + /** + * Add a new line to the dialog + */ + void addLine(const Common::String &line, bool underline = false); + + /** + * Adds one or more lines, word wrapping the passed text + */ + void wordWrap(const Common::String &line); +public: + /** + * Constructor + * @param vm Engine reference + * @param fontName Font to use for display + * @param pos Position for window top-left + * @param maxChars Horizontal width of window in characters + */ + TextDialog(MADSEngine *vm, const Common::String &fontName, const Common::Point &pos, + int maxChars); + + /** + * Destructor + */ + ~TextDialog(); + +}; + +class MessageDialog: protected TextDialog { +public: + MessageDialog(MADSEngine *vm, int lines, ...); +}; + +} // End of namespace MADS + +#endif /* MADS_DIALOGS_H */ diff --git a/engines/mads/font.h b/engines/mads/font.h index 3f01260fbd..e042768c40 100644 --- a/engines/mads/font.h +++ b/engines/mads/font.h @@ -30,23 +30,13 @@ namespace MADS { -#define FONT_MENU "fontmenu.fnt" -#define FONT_INTERFACE "fontintr.fnt" -#define FONT_TINY "small.fnt" -#define FONT_SMALL "small.fnt" -#define FONT_MEDIUM "medium.fnt" -#define FONT_LINE "fontline.fnt" -#define FONT_CONVERSATION "fontconv.fnt" -#define FONT_4X6 "4x6pp.fnt" -#define FONT_5X6 "5x6pp.fnt" - -#define FONT_CONVERSATION_MADS "fontconv.ff" -#define FONT_INTERFACE_MADS "fontintr.ff" -#define FONT_MAIN_MADS "fontmain.ff" -#define FONT_MENU_MADS "fontmenu.ff" // Not in Rex (uses bitmap files for menu strings) -#define FONT_MISC_MADS "fontmisc.ff" -#define FONT_TELE_MADS "fonttele.ff" // Not in Phantom -#define FONT_PHAN_MADS "fontphan.ff" // Phantom only +#define FONT_CONVERSATION "fontconv.ff" +#define FONT_INTERFACE "fontintr.ff" +#define FONT_MAIN "fontmain.ff" +#define FONT_MENU "fontmenu.ff" // Not in Rex (uses bitmap files for menu strings) +#define FONT_MISC "fontmisc.ff" +#define FONT_TELE "fonttele.ff" // Not in Phantom +#define FONT_PHAN "fontphan.ff" // Phantom only class MADSEngine; diff --git a/engines/mads/module.mk b/engines/mads/module.mk index 9d115b8b6e..179c1979b4 100644 --- a/engines/mads/module.mk +++ b/engines/mads/module.mk @@ -6,6 +6,7 @@ MODULE_OBJS := \ nebular/sound_nebular.o \ compression.o \ detection.o \ + dialogs.o \ events.o \ font.o \ game.o \ diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp index 85b06ce592..76b6162d14 100644 --- a/engines/mads/nebular/dialogs_nebular.cpp +++ b/engines/mads/nebular/dialogs_nebular.cpp @@ -31,133 +31,6 @@ namespace MADS { namespace Nebular { -TextDialog::TextDialog(MADSEngine *vm, const Common::String &fontName, - const Common::Point &pos, int maxChars) { - _vm = vm; - _fontName = fontName; - _position = pos; - - _vm->_font->setFont(FONT_INTERFACE); - _vm->_font->setColors(TEXTDIALOG_FONT, TEXTDIALOG_FONT, TEXTDIALOG_FONT, TEXTDIALOG_FONT); - - _innerWidth = (_vm->_font->maxWidth() + 1) * maxChars; - _width = _innerWidth + 10; - _lineSize = maxChars * 2; - _lineWidth = 0; - _currentX = 0; - _numLines = 0; - Common::fill(&_lineXp[0], &_lineXp[TEXT_DIALOG_MAX_LINES], 0); - - Common::copy(&_vm->_palette->_mainPalette[TEXTDIALOG_F8 * 3], - &_vm->_palette->_mainPalette[TEXTDIALOG_F8 * 3 + 8 * 3], - &_savedPalette[0]); - Palette::setGradient(_vm->_palette->_mainPalette, TEXTDIALOG_F8, 2, 0x24, 0x20); - Palette::setGradient(_vm->_palette->_mainPalette, TEXTDIALOG_FA, 2, 0x27, 0x1C); - Palette::setGradient(_vm->_palette->_mainPalette, TEXTDIALOG_FC, 2, 0x24, 0x20); - Palette::setGradient(_vm->_palette->_mainPalette, TEXTDIALOG_FE, 1, 0x37, 0x37); - - _vm->_palette->setPalette(_vm->_palette->_mainPalette + (TEXTDIALOG_F8 * 3), - TEXTDIALOG_F8, 8); -} - -TextDialog::~TextDialog() { -} - -void TextDialog::addLine(const Common::String &line, bool underline) { - if (_lineWidth > 0 || _currentX > 0) - incNumLines(); - - int stringWidth = _vm->_font->getWidth(line); - if (stringWidth >= _innerWidth || (int)line.size() >= _lineSize) { - wordWrap(line); - } else { - _lineXp[_numLines] = (_innerWidth / 2) - (stringWidth / 2); - _lines[_numLines] = line; - - if (underline) - underlineLine(); - } - - incNumLines(); -} - -void TextDialog::underlineLine() { - _lineXp[_numLines] |= 0x80; -} - -void TextDialog::incNumLines() { - _lineWidth = 0; - _currentX = 0; - if (++_numLines == TEXT_DIALOG_MAX_LINES) - error("Exceeded text dialog line max"); -} - -void TextDialog::wordWrap(const Common::String &line) { - Common::String tempLine; - - if (!line.empty()) { - const char *srcP = line.c_str(); - - do { - tempLine = ""; - bool endWord = false; - bool newLine = false; - bool continueFlag = true; - - do { - if (!*srcP) { - continueFlag = false; - } else { - tempLine += *srcP; - - if (*srcP == 10) { - continueFlag = false; - newLine = true; - ++srcP; - tempLine.deleteLastChar(); - } else if (*srcP == ' ') { - ++srcP; - endWord = true; - } else if (!endWord) { - ++srcP; - } else { - tempLine.deleteLastChar(); - continueFlag = false; - } - } - } while (continueFlag); - - if (tempLine.hasSuffix(" ")) - tempLine.deleteLastChar(); - - Common::String tempLine2; - if (_currentX > 0) - tempLine2 += ' '; - tempLine2 += tempLine; - - int lineWidth = _vm->_font->getWidth(tempLine2, 1); - if (((_currentX + (int)tempLine2.size()) > _lineSize) || - ((_lineWidth + lineWidth) > _innerWidth)) { - incNumLines(); - appendLine(tempLine); - } else { - appendLine(tempLine2); - } - - if (newLine) - incNumLines(); - } while (*srcP); - } -} - -void TextDialog::appendLine(const Common::String &line) { - _currentX += line.size(); - _lineWidth += _vm->_font->getWidth(line, 1); - _lines[_numLines] += line; -} - -/*------------------------------------------------------------------------*/ - bool CopyProtectionDialog::show(MADSEngine *vm) { CopyProtectionDialog *dlg = new CopyProtectionDialog(vm, false); @@ -166,7 +39,7 @@ bool CopyProtectionDialog::show(MADSEngine *vm) { } CopyProtectionDialog::CopyProtectionDialog(MADSEngine *vm, bool priorAnswerWrong): - TextDialog(vm, FONT_INTERFACE_MADS, Common::Point(-1, -1), 32) { + TextDialog(vm, FONT_INTERFACE, Common::Point(-1, -1), 32) { getHogAnusEntry(_hogEntry); if (priorAnswerWrong) { diff --git a/engines/mads/nebular/dialogs_nebular.h b/engines/mads/nebular/dialogs_nebular.h index 3e28ee39b3..7a63397603 100644 --- a/engines/mads/nebular/dialogs_nebular.h +++ b/engines/mads/nebular/dialogs_nebular.h @@ -25,81 +25,12 @@ #include "common/scummsys.h" #include "mads/game.h" +#include "mads/dialogs.h" namespace MADS { namespace Nebular { -enum { - TEXTDIALOG_F8 = 0XF8, - TEXTDIALOG_F9 = 0XF8, - TEXTDIALOG_FA = 0XF8, - TEXTDIALOG_FB = 0XF8, - TEXTDIALOG_FC = 0XF8, - TEXTDIALOG_FD = 0XF8, - TEXTDIALOG_FE = 0XF8, - TEXTDIALOG_FONT = 0 -}; - -#define TEXT_DIALOG_MAX_LINES 20 - -class TextDialog { -private: - /** - * Increments the number of text lines the text dialog uses - */ - void incNumLines(); - - /** - * Flags the previously added line to be underlined - */ - void underlineLine(); - - /** - * Append text to the currently end line. - */ - void appendLine(const Common::String &line); -protected: - MADSEngine *_vm; - Common::Point _position; - Common::String _fontName; - int _width; - int _innerWidth; - int _lineWidth; - int _currentX; - int _numLines; - int _lineSize; - Common::String _lines[TEXT_DIALOG_MAX_LINES]; - int _lineXp[TEXT_DIALOG_MAX_LINES]; - byte _savedPalette[8 * 3]; - - /** - * Add a new line to the dialog - */ - void addLine(const Common::String &line, bool underline = false); - - /** - * Adds one or more lines, word wrapping the passed text - */ - void wordWrap(const Common::String &line); -public: - /** - * Constructor - * @param vm Engine reference - * @param fontName Font to use for display - * @param pos Position for window top-left - * @param maxChars Horizontal width of window in characters - */ - TextDialog(MADSEngine *vm, const Common::String &fontName, const Common::Point &pos, - int maxChars); - - /** - * Destructor - */ - ~TextDialog(); - -}; - struct HOGANUS { int _bookId; int _pageNum; -- cgit v1.2.3 From 82514b4a28904ead97552f6605cd3bde6924660b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 22 Feb 2014 11:13:35 -0500 Subject: MADS: Beginnings of cursor initialization --- engines/mads/assets.cpp | 30 +++++++++++++++++++++++ engines/mads/assets.h | 34 +++++++++++++++++++++++++ engines/mads/events.cpp | 19 ++++++++++++++ engines/mads/events.h | 30 +++++++++++++++++++++++ engines/mads/game.cpp | 11 +++++++++ engines/mads/game.h | 9 +++++++ engines/mads/mads.cpp | 1 + engines/mads/module.mk | 1 + engines/mads/palette.cpp | 64 ++++++++++++++++++++++++++++++++++++++++++++++++ engines/mads/palette.h | 23 +++++++++++++++++ 10 files changed, 222 insertions(+) create mode 100644 engines/mads/assets.cpp create mode 100644 engines/mads/assets.h diff --git a/engines/mads/assets.cpp b/engines/mads/assets.cpp new file mode 100644 index 0000000000..7c1b169396 --- /dev/null +++ b/engines/mads/assets.cpp @@ -0,0 +1,30 @@ +/* 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 "common/scummsys.h" +#include "mads/mads.h" +#include "mads/events.h" + +namespace MADS { + + +} // End of namespace MADS diff --git a/engines/mads/assets.h b/engines/mads/assets.h new file mode 100644 index 0000000000..dcd7390b75 --- /dev/null +++ b/engines/mads/assets.h @@ -0,0 +1,34 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_ASSETS_H +#define MADS_ASSETS_H + +#include "common/scummsys.h" +#include "mads/msprite.h" + +namespace MADS { + + +} // End of namespace MADS + +#endif /* MADS_ASSETS_H */ diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp index 0950ac02d2..ec0628710c 100644 --- a/engines/mads/events.cpp +++ b/engines/mads/events.cpp @@ -30,6 +30,25 @@ namespace MADS { EventsManager::EventsManager(MADSEngine *vm) { _vm = vm; + _cursorSprites = nullptr; +} + +EventsManager::~EventsManager() { + delete _cursorSprites; +} + +void EventsManager::loadCursors(const Common::String &spritesName) { + error("TODO: load SpriteSet"); +} + +void EventsManager::setCursor(CursorType cursorId) { + _cursorId = cursorId; + _newCursorId = cursorId; + changeCursor(); +} + +void EventsManager::changeCursor() { + } void EventsManager::handleEvents() { diff --git a/engines/mads/events.h b/engines/mads/events.h index 33d5c8e31b..860f36d69f 100644 --- a/engines/mads/events.h +++ b/engines/mads/events.h @@ -24,17 +24,47 @@ #define MADS_EVENTS_H #include "common/scummsys.h" +#include "mads/msprite.h" namespace MADS { +enum CursorType { CURSOR_NONE = 0, CURSOR_ARROW = 1, CURSOR_WAIT = 2, CURSOR_GO_DOWN = 3, + CURSOR_GO_UP = 4, CURSOR_GO_LEFT = 5, CURSOR_GO_RIGHT = 6 }; + class MADSEngine; class EventsManager { private: MADSEngine *_vm; + CursorType _cursorId; + CursorType _newCursorId; + void *_cursorSprites; + + /** + * Updates the cursor image when the current cursor changes + */ + void changeCursor(); public: + /** + * Constructor + */ EventsManager(MADSEngine *vm); + /** + * Destructor + */ + ~EventsManager(); + + /** + * Loads the sprite set containing the cursors + */ + void loadCursors(const Common::String &spritesName); + + /** + * Sets the cursor + */ + void setCursor(CursorType cursorId); + void handleEvents(); }; diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 0a04fda6cf..48c79ba32d 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -37,6 +37,7 @@ Game *Game::init(MADSEngine *vm) { } Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr) { + _sectionNumber = _priorSectionNumber = 0; } Game::~Game() { @@ -48,4 +49,14 @@ void Game::run() { return; } +void Game::initSection(int sectionNumber) { + _priorSectionNumber = _sectionNumber; + _sectionNumber = sectionNumber; + + _vm->_palette->resetGamePalette(18, 10); + _vm->_palette->setLowRange(); + + // TODO +} + } // End of namespace MADS diff --git a/engines/mads/game.h b/engines/mads/game.h index 2f0dcf7d48..bb15a8e35b 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -40,8 +40,17 @@ protected: * Perform any copy protection check */ virtual bool checkCopyProtection() = 0; + + /** + * Initialises the current section number of the game + */ + void initSection(int sectionNumber); + public: static Game *init(MADSEngine *vm); +public: + int _sectionNumber; + int _priorSectionNumber; public: virtual ~Game(); diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index 827c62ac61..687852a59b 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -81,6 +81,7 @@ void MADSEngine::initialise() { _userInterface = UserInterface::init(this); _game = Game::init(this); + _events->loadCursors("*CURSOR.SS"); _screen->empty(); } diff --git a/engines/mads/module.mk b/engines/mads/module.mk index 179c1979b4..ec85355abb 100644 --- a/engines/mads/module.mk +++ b/engines/mads/module.mk @@ -4,6 +4,7 @@ MODULE_OBJS := \ nebular/dialogs_nebular.o \ nebular/game_nebular.o \ nebular/sound_nebular.o \ + assets.o \ compression.o \ detection.o \ dialogs.o \ diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index c858984a52..2d7bd42f29 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -310,4 +310,68 @@ void Palette::setSystemPalette() { blockRange(0, 4); } +void Palette::resetGamePalette(int lowRange, int highRange) { + Common::fill((byte *)&_gamePalette[0], (byte *)&_gamePalette[PALETTE_COUNT], 0); + initRange(_mainPalette); + + // Init low range to common RGB values + if (lowRange) { + _gamePalette[0].r = 1; + _gamePalette[0].b = 0; + + Common::fill(&_gamePalette[1], &_gamePalette[lowRange - 1], _gamePalette[0]); + } + + // Init high range to common RGB values + if (highRange) { + _gamePalette[255].r = 1; + _gamePalette[255].b = 0; + + Common::fill(&_gamePalette[255 - highRange], &_gamePalette[254], _gamePalette[255]); + } +} + +void Palette::initRange(byte *palette) { + int var6 = 0; + int vdx = 0; + int vbx = 0; + do { + int vdi = (vdx == 1) ? 0 : 0x2A; + int var8 = 0; + int varE = vbx; + int var10 = vdx; + do { + int vdx = 0; + do { + int vcx = 0; + int var4 = vdx; + do { + int var2 = var6 + vcx; + byte *destP = &palette[var2 * 3]; + + destP[0] = (var8) ? vdi & 0xFF : vbx & 0XFF; + destP[1] = (var4) ? vdi & 0xFF : vbx & 0XFF; + destP[2] = (vcx) ? vdi & 0xFF : vbx & 0XFF; + } while (++vcx < 2); + + var6 += 2; + vdx = var4; + } while (++vdx < 2); + } while (++var8 < 2); + + vdx = var10 + 1; + vbx = varE + 21; + } while (vbx < 42); + + palette[19] = 21; +} + +void Palette::setLowRange() { + _mainPalette[0] = _mainPalette[1] = _mainPalette[2] = 0; + _mainPalette[3] = _mainPalette[4] = _mainPalette[5] = 0x15; + _mainPalette[6] = _mainPalette[7] = _mainPalette[8] = 0x2A; + _mainPalette[9] = _mainPalette[10] = _mainPalette[11] = 0x3F; + _vm->_palette->setPalette(_mainPalette, 0, 4); +} + } // End of namespace MADS diff --git a/engines/mads/palette.h b/engines/mads/palette.h index 0ef8693a1f..53620d8fff 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -29,6 +29,13 @@ namespace MADS { class MADSEngine; +struct RGB4 { + byte r; + byte g; + byte b; + byte u; +}; + /** * Used to store a list of RGB values */ @@ -75,6 +82,11 @@ private: */ void fadeRange(byte *srcPal, byte *destPal, int startIndex, int endIndex, int numSteps, uint delayAmount); + + /** + * Initialises a stanadrd range of colours for the given palette + */ + void initRange(byte *palette); protected: MADSEngine *_vm; bool _colorsChanged; @@ -87,6 +99,7 @@ protected: void reset(); public: byte _mainPalette[PALETTE_SIZE]; + RGB4 _gamePalette[PALETTE_COUNT]; public: /** * Constructor @@ -171,6 +184,16 @@ public: */ static void setGradient(byte *palette, int start, int count, int rgbValue1, int rgbValue2); + /** + * Resets the game palette + */ + void resetGamePalette(int v1, int v2); + + /** + * Set the first four palette entries with preset values + */ + void setLowRange(); + // Color indexes uint8 BLACK; uint8 BLUE; -- cgit v1.2.3 From 02a1d0eaa3f462425d115f4d88c3d2badbc7a236 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 22 Feb 2014 12:17:37 -0500 Subject: MADS: Further cursor/event initialisation --- engines/mads/assets.cpp | 65 ++++++++++++++++++++++++++++++++++++++++++++ engines/mads/assets.h | 35 ++++++++++++++++++++++++ engines/mads/compression.cpp | 6 ++-- engines/mads/events.cpp | 7 ++++- engines/mads/events.h | 9 +++++- engines/mads/font.h | 14 +++++----- engines/mads/game.cpp | 6 ++-- engines/mads/mads.cpp | 1 + engines/mads/mads.h | 3 +- engines/mads/msprite.h | 4 +-- engines/mads/palette.cpp | 4 +-- 11 files changed, 135 insertions(+), 19 deletions(-) diff --git a/engines/mads/assets.cpp b/engines/mads/assets.cpp index 7c1b169396..6ad313ce3e 100644 --- a/engines/mads/assets.cpp +++ b/engines/mads/assets.cpp @@ -22,9 +22,74 @@ #include "common/scummsys.h" #include "mads/mads.h" +#include "mads/assets.h" +#include "mads/compression.h" #include "mads/events.h" namespace MADS { +SpriteAsset::SpriteAsset(MADSEngine *vm, const Common::String &resourceName, int flags): + _vm(vm) { + Common::String resName = resourceName; + if (!resName.hasSuffix(".SS")) + resName += ".SS"; + + File file(resName); + MadsPack sprites(&file); + + int curFrame = 0; + uint32 frameOffset = 0; + _frameRate = 0; + _pixelSpeed = 0; + _maxWidth = 0; + _maxHeight = 0; + + Common::SeekableReadStream *spriteStream = sprites.getItemStream(0); + for (int i = 0; i < 19; i++) { + spriteStream->readUint16LE(); + } + _frameCount = spriteStream->readUint16LE(); + // we skip the rest of the data + delete spriteStream; + + // Get the palette data + spriteStream = sprites.getItemStream(2); + int numColors = 0; + byte *palData = _vm->_palette->decodePalette(spriteStream, &numColors); + + Common::copy(palData, &palData[numColors], &_palette[0]); + if (numColors < 256) + Common::fill(&_palette[numColors * 3], &_palette[PALETTE_SIZE], 0); + _colorCount = numColors; + delete[] palData; + delete spriteStream; + + spriteStream = sprites.getItemStream(1); + Common::SeekableReadStream *spriteDataStream = sprites.getItemStream(3); + + SpriteAssetFrame frame; + for (curFrame = 0; curFrame < _frameCount; curFrame++) { + frame.comp = 0; + frameOffset = spriteStream->readUint32LE(); + _frameOffsets.push_back(frameOffset); + spriteStream->readUint32LE(); // frame size + frame.x = spriteStream->readUint16LE(); + frame.y = spriteStream->readUint16LE(); + frame.w = spriteStream->readUint16LE(); + frame.h = spriteStream->readUint16LE(); + if (curFrame == 0) { + debugN(kDebugGraphics, "%i frames, x = %i, y = %i, w = %i, h = %i\n", + _frameCount, frame.x, frame.y, frame.w, frame.h); + } + + frame.frame = MSprite::init(spriteDataStream, Common::Point(frame.x, frame.y), + frame.w, frame.h, false); + _frames.push_back(frame); + } + + delete spriteStream; + delete spriteDataStream; + file.close(); +} } // End of namespace MADS diff --git a/engines/mads/assets.h b/engines/mads/assets.h index dcd7390b75..c64209eab2 100644 --- a/engines/mads/assets.h +++ b/engines/mads/assets.h @@ -24,10 +24,45 @@ #define MADS_ASSETS_H #include "common/scummsys.h" +#include "common/array.h" +#include "mads/msprite.h" +#include "mads/palette.h" #include "mads/msprite.h" namespace MADS { +struct SpriteAssetFrame { + uint32 stream; + int x, y, w, h; + uint32 comp; + MSprite *frame; +}; + +class SpriteAsset { +private: + MADSEngine *_vm; + byte _palette[PALETTE_SIZE]; + int _colorCount; + uint32 _srcSize; + int _frameRate, _pixelSpeed; + int _maxWidth, _maxHeight; + int _frameCount; + Common::Array _frameOffsets; + Common::Array _frames; + uint32 _frameStartOffset; +public: + SpriteAsset(MADSEngine *vm, const Common::String &resourceName, int flags); + int getCount() { return _frameCount; } + int getFrameRate() const { return _frameRate; } + int getPixelSpeed() const { return _pixelSpeed; } + int getFrameWidth(int index); + int getFrameHeight(int index); + int getMaxFrameWidth() const { return _maxWidth; } + int getMaxFrameHeight() const { return _maxHeight; } + MSprite *getFrame(int frameIndex); + byte *getPalette() { return _palette; } + int getColorCount() { return _colorCount; } +}; } // End of namespace MADS diff --git a/engines/mads/compression.cpp b/engines/mads/compression.cpp index febb6ec90f..5000319a63 100644 --- a/engines/mads/compression.cpp +++ b/engines/mads/compression.cpp @@ -46,9 +46,9 @@ MadsPack::MadsPack(Common::SeekableReadStream *stream) { } MadsPack::MadsPack(const Common::String &resourceName, MADSEngine *vm) { - Common::SeekableReadStream *stream = nullptr; //vm->_resources->get(resourceName); - initialise(stream); -// vm->_resources->toss(resourceName); + File file(resourceName); + initialise(&file); + file.close(); } void MadsPack::initialise(Common::SeekableReadStream *stream) { diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp index ec0628710c..bb980af7ff 100644 --- a/engines/mads/events.cpp +++ b/engines/mads/events.cpp @@ -38,10 +38,15 @@ EventsManager::~EventsManager() { } void EventsManager::loadCursors(const Common::String &spritesName) { - error("TODO: load SpriteSet"); + _cursorSprites = new SpriteAsset(_vm, "*CURSOR.SS", 0x4000); } void EventsManager::setCursor(CursorType cursorId) { + _cursorId = cursorId; + changeCursor(); +} + +void EventsManager::setCursor2(CursorType cursorId) { _cursorId = cursorId; _newCursorId = cursorId; changeCursor(); diff --git a/engines/mads/events.h b/engines/mads/events.h index 860f36d69f..c5cc5bf352 100644 --- a/engines/mads/events.h +++ b/engines/mads/events.h @@ -25,6 +25,7 @@ #include "common/scummsys.h" #include "mads/msprite.h" +#include "mads/assets.h" namespace MADS { @@ -38,12 +39,13 @@ private: MADSEngine *_vm; CursorType _cursorId; CursorType _newCursorId; - void *_cursorSprites; /** * Updates the cursor image when the current cursor changes */ void changeCursor(); +public: + SpriteAsset *_cursorSprites; public: /** * Constructor @@ -65,6 +67,11 @@ public: */ void setCursor(CursorType cursorId); + /** + * Sets the cursor + */ + void setCursor2(CursorType cursorId); + void handleEvents(); }; diff --git a/engines/mads/font.h b/engines/mads/font.h index e042768c40..3deb3f4d2d 100644 --- a/engines/mads/font.h +++ b/engines/mads/font.h @@ -30,13 +30,13 @@ namespace MADS { -#define FONT_CONVERSATION "fontconv.ff" -#define FONT_INTERFACE "fontintr.ff" -#define FONT_MAIN "fontmain.ff" -#define FONT_MENU "fontmenu.ff" // Not in Rex (uses bitmap files for menu strings) -#define FONT_MISC "fontmisc.ff" -#define FONT_TELE "fonttele.ff" // Not in Phantom -#define FONT_PHAN "fontphan.ff" // Phantom only +#define FONT_CONVERSATION "*FONTCONV.FF" +#define FONT_INTERFACE "*FONTINTR.FF" +#define FONT_MAIN "*FONTMAIN.FF" +#define FONT_MENU "*FONTMENU.FF" // Not in Rex (uses bitmap files for menu strings) +#define FONT_MISC "*FONTMISC.FF" +#define FONT_TELE "*FONTTELE.FF" // Not in Phantom +#define FONT_PHAN "*FONTPHAN.FF" // Phantom only class MADSEngine; diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 48c79ba32d..774ec98eb4 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -55,8 +55,10 @@ void Game::initSection(int sectionNumber) { _vm->_palette->resetGamePalette(18, 10); _vm->_palette->setLowRange(); - - // TODO + + assert(_vm->_events->_cursorSprites); + _vm->_events->setCursor2((_vm->_events->_cursorSprites->getCount() <= 1) ? + CURSOR_ARROW : CURSOR_WAIT); } } // End of namespace MADS diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index 687852a59b..aa2bd55dd8 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -67,6 +67,7 @@ void MADSEngine::initialise() { // Set up debug channels DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level"); DebugMan.addDebugChannel(kDebugScripts, "scripts", "Game scripts"); + DebugMan.addDebugChannel(kDebugGraphics, "graphics", "Graphics handling"); // Initial sub-system engine references MSurface::setVm(this); diff --git a/engines/mads/mads.h b/engines/mads/mads.h index a6ae776690..b50cf07678 100644 --- a/engines/mads/mads.h +++ b/engines/mads/mads.h @@ -54,7 +54,8 @@ namespace MADS { enum MADSDebugChannels { kDebugPath = 1 << 0, - kDebugScripts = 1 << 1 + kDebugScripts = 1 << 1, + kDebugGraphics = 1 << 2 }; enum { diff --git a/engines/mads/msprite.h b/engines/mads/msprite.h index c49aac4fba..c454597a3a 100644 --- a/engines/mads/msprite.h +++ b/engines/mads/msprite.h @@ -97,8 +97,8 @@ struct SpriteFrameHeader { class MSprite { public: - MSprite *init(MSurface &s); - MSprite *init(Common::SeekableReadStream *source, const Common::Point &offset, int widthVal, + static MSprite *init(MSurface &s); + static MSprite *init(Common::SeekableReadStream *source, const Common::Point &offset, int widthVal, int heightVal, bool decodeRle = true, uint8 encodingVal = 0); protected: static MADSEngine *_vm; diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index 2d7bd42f29..82ffa4e43a 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -240,8 +240,8 @@ void Palette::fadeRange(byte *srcPal, byte *destPal, int startIndex, int endInd void Palette::setGradient(byte *palette, int start, int count, int rgbValue1, int rgbValue2) { int rgbCtr = 0; - int rgbDiff = -(rgbValue2 - rgbValue1); int rgbCurrent = rgbValue2; + int rgbDiff = -(rgbValue2 - rgbValue1); if (count > 0) { byte *pDest = palette + start * 3; @@ -251,7 +251,7 @@ void Palette::setGradient(byte *palette, int start, int count, int rgbValue1, in do { pDest[0] = pDest[1] = pDest[2] = rgbCurrent; - if (count > 1) { + if (numLeft > 1) { rgbCtr += rgbDiff; if (rgbCtr >= endVal) { do { -- cgit v1.2.3 From 3df12371873cb8e3380422aa3095e367408526af Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 22 Feb 2014 14:20:34 -0500 Subject: MADS: Removed M4-specific code. Keeping engine MADS-specific for now --- engines/mads/compression.cpp | 2 +- engines/mads/detection_tables.h | 2 +- engines/mads/mads.h | 5 -- engines/mads/msprite.cpp | 96 ++------------------------------------ engines/mads/msprite.h | 31 +------------ engines/mads/msurface.cpp | 100 +--------------------------------------- engines/mads/msurface.h | 21 --------- engines/mads/resources.cpp | 5 +- 8 files changed, 10 insertions(+), 252 deletions(-) diff --git a/engines/mads/compression.cpp b/engines/mads/compression.cpp index 5000319a63..2190fc4ac0 100644 --- a/engines/mads/compression.cpp +++ b/engines/mads/compression.cpp @@ -181,4 +181,4 @@ int FabDecompressor::getBit() { return bit; } -} // End of namespace M4 +} // End of namespace MADS diff --git a/engines/mads/detection_tables.h b/engines/mads/detection_tables.h index 7410dce2f6..ac5316d4b4 100644 --- a/engines/mads/detection_tables.h +++ b/engines/mads/detection_tables.h @@ -38,7 +38,7 @@ static const MADSGameDescription gameDescriptions[] = { GUIO1(GUIO_NONE) }, GType_RexNebular, - GF_MADS + 0 }, { AD_TABLE_END_MARKER } diff --git a/engines/mads/mads.h b/engines/mads/mads.h index b50cf07678..b7598eb03d 100644 --- a/engines/mads/mads.h +++ b/engines/mads/mads.h @@ -65,11 +65,6 @@ enum { GType_Riddle = 3 }; -enum { - GF_MADS = 1 << 0, - GF_M4 = 1 << 1 -}; - struct MADSGameDescription; diff --git a/engines/mads/msprite.cpp b/engines/mads/msprite.cpp index 60c22d8c06..b15796d57c 100644 --- a/engines/mads/msprite.cpp +++ b/engines/mads/msprite.cpp @@ -38,21 +38,13 @@ enum { MADSEngine *MSprite::_vm; MSprite *MSprite::init(MSurface &s) { - if (_vm->getGameFeatures() & GF_MADS) { - return new MSpriteMADS(s); - } else { - return new MSpriteM4(s); - } + return new MSprite(s); } MSprite *MSprite::init(Common::SeekableReadStream *source, const Common::Point &offset, int widthVal, int heightVal, bool decodeRle, uint8 encodingVal) { - if (_vm->getGameFeatures() & GF_MADS) { - return new MSpriteMADS(source, offset, widthVal, heightVal, decodeRle, encodingVal); - } else { - return new MSpriteM4(source, offset, widthVal, heightVal, decodeRle, encodingVal); - } + return new MSprite(source, offset, widthVal, heightVal, decodeRle, encodingVal); } MSprite::MSprite(MSurface &s): _surface(s) { @@ -65,21 +57,15 @@ MSprite::MSprite(Common::SeekableReadStream *source, const Common::Point &offset _encoding(encodingVal), _offset(offset) { // Load the sprite data - load(source, widthVal, heightVal, decodeRle); + loadSprite(source); } MSprite::~MSprite() { } -/*------------------------------------------------------------------------*/ - -void MSpriteMADS::load(Common::SeekableReadStream *stream, int widthVal, int heightVal, - bool decodeRle) { - loadSprite(stream); -} // TODO: The sprite outlines (pixel value 0xFD) are not shown -void MSpriteMADS::loadSprite(Common::SeekableReadStream *source) { +void MSprite::loadSprite(Common::SeekableReadStream *source) { byte *outp, *lineStart; bool newLine = false; @@ -130,78 +116,4 @@ void MSpriteMADS::loadSprite(Common::SeekableReadStream *source) { } } -/*------------------------------------------------------------------------*/ - -void MSpriteM4::load(Common::SeekableReadStream *stream, int widthVal, int heightVal, - bool decodeRle) { - if (decodeRle) { - loadRle(stream); - } else { - // Raw sprite data, load directly - byte *dst = _surface.getData(); - stream->read(dst, widthVal * heightVal); - } -} - -void MSpriteM4::loadRle(Common::SeekableReadStream* rleData) { - byte *dst = _surface.getData(); - for (;;) { - byte len = rleData->readByte(); - if (len == 0) { - len = rleData->readByte(); - if (len <= kMarker) { - if (len == kEndOfSprite) - break; - } else { - while (len--) { - *dst++ = rleData->readByte(); - } - } - } else { - byte value = rleData->readByte(); - while (len--) - *dst++ = value; - } - } -} - -void MSpriteM4::loadDeltaRle(Common::SeekableReadStream* rleData, int destX, int destY) { - int lineNum = 0; - byte *dst = _surface.getBasePtr(destX, destY); - - for (;;) { - byte len = rleData->readByte(); - if (len == 0) { - len = rleData->readByte(); - if (len <= kMarker) { - if (len == kEndOfLine) { - dst = _surface.getBasePtr(destX, destY + lineNum); - lineNum++; - } else if (len == kEndOfSprite) - break; - } else { - while (len--) { - byte pixel = rleData->readByte(); - if (pixel == 0) - dst++; - else - *dst++ = pixel; - /* NOTE: The change below behaved differently than the old code, - so I put the old code back in again above. - If the pixel value is 0, nothing should be written to the - output buffer, since 0 means transparent. */ - //*dst++ = (pixel == 0xFD) ? 0 : pixel; - } - } - } else { - byte value = rleData->readByte(); - if (value == 0) - dst += len; - else - while (len--) - *dst++ = value; - } - } -} - } // End of namespace MADS diff --git a/engines/mads/msprite.h b/engines/mads/msprite.h index c454597a3a..bb21772908 100644 --- a/engines/mads/msprite.h +++ b/engines/mads/msprite.h @@ -107,7 +107,7 @@ protected: MSprite(Common::SeekableReadStream *source, const Common::Point &offset, int widthVal, int heightVal, bool decodeRle = true, uint8 encodingVal = 0); - virtual void load(Common::SeekableReadStream *stream, int widthVal, int heightVal, bool decodeRle) {} + void loadSprite(Common::SeekableReadStream *source); public: static void setVm(MADSEngine *vm) { _vm = vm; } virtual ~MSprite(); @@ -118,35 +118,6 @@ public: uint8 _encoding; }; -class MSpriteMADS: public MSprite { - friend class MSprite; -private: - void loadSprite(Common::SeekableReadStream *source); -protected: - MSpriteMADS(MSurface &s): MSprite(s) {} - MSpriteMADS(Common::SeekableReadStream *source, const Common::Point &offset, - int widthVal, int heightVal, bool decodeRle = true, uint8 encodingVal = 0): - MSprite(source, offset, widthVal, heightVal, decodeRle, encodingVal) {} - - virtual void load(Common::SeekableReadStream *stream, int widthVal, int heightVal, bool decodeRle); -}; - -class MSpriteM4: public MSprite { - friend class MSprite; -private: - // Loads a sprite from the given stream, and optionally decompresses the RLE-encoded data - // Loads an RLE compressed sprite; the surface must have been created before - void loadRle(Common::SeekableReadStream *rleData); - void loadDeltaRle(Common::SeekableReadStream *rleData, int destX, int destY); -protected: - MSpriteM4(MSurface &s): MSprite(s) {} - MSpriteM4(Common::SeekableReadStream *source, const Common::Point &offset, - int widthVal, int heightVal, bool decodeRle = true, uint8 encodingVal = 0): - MSprite(source, offset, widthVal, heightVal, decodeRle, encodingVal) {} - - virtual void load(Common::SeekableReadStream *stream, int widthVal, int heightVal, bool decodeRle); -}; - } // End of namespace MADS #endif /* MADS_MSPRITE_H */ diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp index 2c0b433159..b4ee129545 100644 --- a/engines/mads/msurface.cpp +++ b/engines/mads/msurface.cpp @@ -35,20 +35,16 @@ MADSEngine *MSurface::_vm = nullptr; MSurface *MSurface::init(bool isScreen) { if (_vm->getGameID() == GType_RexNebular) { return new MSurfaceNebular(isScreen); - } else if (_vm->getGameFeatures() & GF_MADS) { - return new MSurfaceMADS(isScreen); } else { - return new MSurfaceM4(isScreen); + return new MSurfaceMADS(isScreen); } } MSurface *MSurface::init(int width, int height) { if (_vm->getGameID() == GType_RexNebular) { return new MSurfaceNebular(width, height); - } else if (_vm->getGameFeatures() & GF_MADS) { - return new MSurfaceMADS(width, height); } else { - return new MSurfaceM4(width, height); + return new MSurfaceMADS(width, height); } } @@ -579,96 +575,4 @@ void MSurfaceNebular::loadBackgroundStream(Common::SeekableReadStream *source, R delete sourceUnc; } -/*------------------------------------------------------------------------*/ - -void MSurfaceM4::loadCodes(Common::SeekableReadStream *source) { - if (!source) { - free(); - return; - } - - uint16 width = source->readUint16LE(); - uint16 height = source->readUint16LE(); - - setSize(width, height); - source->read(pixels, width * height); -} - -void MSurfaceM4::loadBackground(int roomNumber, RGBList **palData) { - if (palData) - *palData = NULL; - Common::String resourceName = Common::String::format("%i.tt", roomNumber); - Common::SeekableReadStream *stream = nullptr;//_vm->_resources->get(resourceName); - loadBackgroundStream(stream); - -// _vm->_resources->toss(resourceName); -} - -void MSurfaceM4::loadBackgroundStream(Common::SeekableReadStream *source) { - MSurface *tileBuffer = MSurface::init(); - uint curTileX = 0, curTileY = 0; - int clipX = 0, clipY = 0; - byte palette[256]; - - source->skip(4); - /*uint32 size =*/ source->readUint32LE(); - uint32 width = source->readUint32LE(); - uint32 height = source->readUint32LE(); - uint32 tilesX = source->readUint32LE(); - uint32 tilesY = source->readUint32LE(); - uint32 tileWidth = source->readUint32LE(); - uint32 tileHeight = source->readUint32LE(); - uint8 blackIndex = 0; - - // BGR data, which is converted to RGB8 - for (uint i = 0; i < 256; i++) { - byte r, g, b; - palette[i * 3] = r = source->readByte() << 2; - palette[i * 3 + 1] = g = source->readByte() << 2; - palette[i * 3 + 2] = b = source->readByte() << 2; - source->skip(1); - - if ((blackIndex == 0) && !r && !g && !b) - blackIndex = i; - } - - _vm->_palette->setPalette(palette, 0, 256); - - // resize or create the surface - // Note that the height of the scene in game scenes is smaller than the screen height, - // as the bottom part of the screen is the inventory - assert(getWidth() == (int)width); - - tileBuffer->setSize(tileWidth, tileHeight); - - for (curTileY = 0; curTileY < tilesY; curTileY++) { - clipY = MIN(height, (1 + curTileY) * tileHeight) - (curTileY * tileHeight); - - for (curTileX = 0; curTileX < tilesX; curTileX++) { - clipX = MIN(width, (1 + curTileX) * tileWidth) - (curTileX * tileWidth); - - // Read a tile and copy it to the destination surface - source->read(tileBuffer->getData(), tileWidth * tileHeight); - Common::Rect srcBounds(0, 0, clipX, clipY); - copyFrom(tileBuffer, srcBounds, - Common::Point(curTileX * tileWidth, curTileY * tileHeight)); - } - } - - if (height < (uint)getHeight()) - fillRect(Common::Rect(0, height, getWidth(), getHeight()), blackIndex); - - delete tileBuffer; -} - -/*------------------------------------------------------------------------*/ - -void MSurfaceRiddle::loadBackground(const Common::String &sceneName) { - // Loads a Riddle scene - Common::String resName = Common::String::format("%s.tt", sceneName.c_str()); - File stream(resName); - - loadBackgroundStream(&stream); -} - } // End of namespace MADS diff --git a/engines/mads/msurface.h b/engines/mads/msurface.h index 42c56e9393..940c5b5704 100644 --- a/engines/mads/msurface.h +++ b/engines/mads/msurface.h @@ -282,27 +282,6 @@ public: virtual void loadBackground(int roomNumber, RGBList **palData); }; -class MSurfaceM4: public MSurface { - friend class MSurface; -protected: - MSurfaceM4(bool isScreen = false): MSurface(isScreen) {} - MSurfaceM4(int width, int height): MSurface(width, height) {} - - void loadBackgroundStream(Common::SeekableReadStream *source); -public: - virtual void loadCodes(Common::SeekableReadStream *source); - virtual void loadBackground(int roomNumber, RGBList **palData); -}; - -class MSurfaceRiddle: public MSurfaceM4 { - friend class MSurface; -protected: - MSurfaceRiddle(bool isScreen = false): MSurfaceM4(isScreen) {} - MSurfaceRiddle(int width, int height): MSurfaceM4(width, height) {} -public: - virtual void loadBackground(const Common::String &sceneName); -}; - } // End of namespace MADS #endif /* MADS_MSURFACE_H */ diff --git a/engines/mads/resources.cpp b/engines/mads/resources.cpp index ac46df96c5..fe021fcfd8 100644 --- a/engines/mads/resources.cpp +++ b/engines/mads/resources.cpp @@ -89,10 +89,7 @@ public: }; void ResourcesManager::init(MADSEngine *vm) { - if (vm->getGameFeatures() & GF_MADS) - SearchMan.add("HAG", new HagArchive()); - else - error("Unsupported game engine"); + SearchMan.add("HAG", new HagArchive()); } /*------------------------------------------------------------------------*/ -- cgit v1.2.3 From 6c354bccf253118d459f92f16d8f702ae07806fb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 22 Feb 2014 17:25:30 -0500 Subject: MADS: Implemented more logic for dialog display --- engines/mads/debugger.cpp | 49 +++++++++++++++ engines/mads/debugger.h | 45 ++++++++++++++ engines/mads/dialogs.cpp | 108 +++++++++++++++++++++++++++++++--- engines/mads/dialogs.h | 37 +++++++++--- engines/mads/events.cpp | 87 +++++++++++++++++++++++++-- engines/mads/events.h | 36 +++++++++++- engines/mads/mads.cpp | 7 ++- engines/mads/mads.h | 2 + engines/mads/module.mk | 1 + engines/mads/msurface.cpp | 39 ++++++------ engines/mads/msurface.h | 51 +++++++++------- engines/mads/nebular/game_nebular.cpp | 6 +- engines/mads/palette.cpp | 48 --------------- engines/mads/palette.h | 16 ----- 14 files changed, 403 insertions(+), 129 deletions(-) create mode 100644 engines/mads/debugger.cpp create mode 100644 engines/mads/debugger.h diff --git a/engines/mads/debugger.cpp b/engines/mads/debugger.cpp new file mode 100644 index 0000000000..ceaeeaa5dd --- /dev/null +++ b/engines/mads/debugger.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 "mads/mads.h" +#include "mads/debugger.h" + +namespace MADS { + +Debugger::Debugger(MADSEngine *vm) : GUI::Debugger(), _vm(vm) { + DCmd_Register("continue", WRAP_METHOD(Debugger, Cmd_Exit)); +} +/* +static int strToInt(const char *s) { + if (!*s) + // No string at all + return 0; + else if (toupper(s[strlen(s) - 1]) != 'H') + // Standard decimal string + return atoi(s); + + // Hexadecimal string + uint tmp = 0; + int read = sscanf(s, "%xh", &tmp); + if (read < 1) + error("strToInt failed on string \"%s\"", s); + return (int)tmp; +} +*/ + +} // End of namespace MADS diff --git a/engines/mads/debugger.h b/engines/mads/debugger.h new file mode 100644 index 0000000000..044151c0bb --- /dev/null +++ b/engines/mads/debugger.h @@ -0,0 +1,45 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_DEBUGGER_H +#define MADS_DEBUGGER_H + +#include "common/scummsys.h" +#include "gui/debugger.h" + +namespace MADS { + +class MADSEngine; + +class Debugger : public GUI::Debugger { +private: + MADSEngine *_vm; +public: + Debugger(MADSEngine *vm); + virtual ~Debugger() {} + +protected: +}; + +} // End of namespace MADS + +#endif /* MADS_DEBUGGER_H */ diff --git a/engines/mads/dialogs.cpp b/engines/mads/dialogs.cpp index 4e64f08822..ebb21418b1 100644 --- a/engines/mads/dialogs.cpp +++ b/engines/mads/dialogs.cpp @@ -51,6 +51,44 @@ void Dialog::restore(MSurface *s) { _savedSurface = nullptr; } +void Dialog::draw() { + // Save the screen portion the dialog will overlap + save(_vm->_screen); + + // Draw the dialog + // Fill entire content of dialog + _vm->_screen->fillRect(Common::Rect(_position.x, _position.y, + _position.x + _width, _position.y + _height), TEXTDIALOG_BACKGROUND); + + // Draw the outer edge line + _vm->_screen->frameRect(Common::Rect(_position.x, _position.y, + _position.x + _width, _position.y + _height), TEXTDIALOG_EDGE); + + // Draw the gravelly dialog content + drawContent(Common::Rect(_position.x + 2, _position.y + 2, + _position.x + _width - 4, _position.y + _height - 4), 0, + TEXTDIALOG_CONTENT1, TEXTDIALOG_CONTENT2); +} + +void Dialog::drawContent(const Common::Rect &r, int seed, byte color1, byte color2) { + uint16 currSeed = seed ? seed : 0xB78E; + + for (int yp = 0; yp < r.height(); ++yp) { + byte *destP = _vm->_screen->getBasePtr(r.left, r.top + yp); + + for (int xp = 0; xp < r.width(); ++xp) { + uint16 seedAdjust = currSeed; + currSeed += 0x181D; + seedAdjust = (seedAdjust >> 9) | ((seedAdjust & 0x1ff) << 7); + currSeed ^= seedAdjust; + seedAdjust = (seedAdjust >> 3) | ((seedAdjust & 7) << 13); + currSeed += seedAdjust; + + *destP++ = (currSeed & 0x10) ? color1 : color2; + } + } +} + /*------------------------------------------------------------------------*/ TextDialog::TextDialog(MADSEngine *vm, const Common::String &fontName, @@ -61,7 +99,7 @@ TextDialog::TextDialog(MADSEngine *vm, const Common::String &fontName, _position = pos; _vm->_font->setFont(FONT_INTERFACE); - _vm->_font->setColors(TEXTDIALOG_FONT, TEXTDIALOG_FONT, TEXTDIALOG_FONT, TEXTDIALOG_FONT); + _vm->_font->setColors(TEXTDIALOG_BLACK, TEXTDIALOG_BLACK, TEXTDIALOG_BLACK, TEXTDIALOG_BLACK); _innerWidth = (_vm->_font->maxWidth() + 1) * maxChars; _width = _innerWidth + 10; @@ -71,16 +109,16 @@ TextDialog::TextDialog(MADSEngine *vm, const Common::String &fontName, _numLines = 0; Common::fill(&_lineXp[0], &_lineXp[TEXT_DIALOG_MAX_LINES], 0); - Common::copy(&_vm->_palette->_mainPalette[TEXTDIALOG_F8 * 3], - &_vm->_palette->_mainPalette[TEXTDIALOG_F8 * 3 + 8 * 3], + Common::copy(&_vm->_palette->_mainPalette[TEXTDIALOG_CONTENT1 * 3], + &_vm->_palette->_mainPalette[TEXTDIALOG_CONTENT1 * 3 + 8 * 3], &_savedPalette[0]); - Palette::setGradient(_vm->_palette->_mainPalette, TEXTDIALOG_F8, 2, 0x24, 0x20); - Palette::setGradient(_vm->_palette->_mainPalette, TEXTDIALOG_FA, 2, 0x27, 0x1C); + Palette::setGradient(_vm->_palette->_mainPalette, TEXTDIALOG_CONTENT1, 2, 0x24, 0x20); + Palette::setGradient(_vm->_palette->_mainPalette, TEXTDIALOG_EDGE, 2, 0x27, 0x1C); Palette::setGradient(_vm->_palette->_mainPalette, TEXTDIALOG_FC, 2, 0x24, 0x20); Palette::setGradient(_vm->_palette->_mainPalette, TEXTDIALOG_FE, 1, 0x37, 0x37); - _vm->_palette->setPalette(_vm->_palette->_mainPalette + (TEXTDIALOG_F8 * 3), - TEXTDIALOG_F8, 8); + _vm->_palette->setPalette(_vm->_palette->_mainPalette + (TEXTDIALOG_CONTENT1 * 3), + TEXTDIALOG_CONTENT1, 8); } TextDialog::~TextDialog() { @@ -179,6 +217,58 @@ void TextDialog::appendLine(const Common::String &line) { _lines[_numLines] += line; } +void TextDialog::draw() { + if (!_lineWidth) + --_numLines; + + // Figure out the size and position for the dialog + _height = (_vm->_font->getHeight() + 1) * (_numLines + 1) + 10; + if (_position.x == -1) + _position.x = 160 - (_width / 2); + if (_position.y == -1) + _position.y = 100 - (_height / 2); + + if ((_position.x + _width) > _vm->_screen->getWidth()) + _position.x = _vm->_screen->getWidth() - (_position.x + _width); + if ((_position.y + _height) > _vm->_screen->getHeight()) + _position.y = _vm->_screen->getHeight() - (_position.y + _height); + +// int askYp = (_vm->_font->getHeight() + 1) * _vm->_font->getHeight() + 3; + + // Draw the underlying dialog + Dialog::draw(); + + // Draw the text lines + int lineYp = _position.y + 5; + for (int lineNum = 0; lineNum < _numLines; ++lineNum) { + if (_lineXp[lineNum] == -1) { + // Draw a line across the entire dialog + _vm->_screen->setColor(TEXTDIALOG_BLACK); + _vm->_screen->hLine(_position.x + 2, + lineYp + (_vm->_font->getHeight() + 1) / 2, + _position.x + _width - 4); + } else { + // Draw a text line + int xp = (_lineXp[lineNum] & 0x7F) + 5; + int yp = lineYp; + if (_lineXp[lineNum] & 0x40) + ++yp; + + _vm->_font->writeString(_vm->_screen, _lines[lineNum], + Common::Point(xp, yp), 1); + + if (_lineXp[lineNum] & 0x80) { + // Draw an underline under the text + int lineWidth = _vm->_font->getWidth(_lines[lineNum]); + _vm->_screen->setColor(TEXTDIALOG_BLACK); + _vm->_screen->hLine(xp, yp + _vm->_font->getHeight(), xp + lineWidth); + } + } + + lineYp += _vm->_font->getHeight() + 1; + } +} + /*------------------------------------------------------------------------*/ MessageDialog::MessageDialog(MADSEngine *vm, int maxChars, ...): @@ -193,8 +283,10 @@ MessageDialog::MessageDialog(MADSEngine *vm, int maxChars, ...): line = va_arg(va, const char *); } va_end(va); +} + +void MessageDialog::show() { - // TODO } } // End of namespace MADS diff --git a/engines/mads/dialogs.h b/engines/mads/dialogs.h index 03710b6b82..407f6d38bf 100644 --- a/engines/mads/dialogs.h +++ b/engines/mads/dialogs.h @@ -48,6 +48,16 @@ protected: * @param s Screen surface to restore to. */ void restore(MSurface *s); + + /** + * Draws the content of a dialog with a gravelly alternating color. + */ + void drawContent(const Common::Rect &r, int seed, byte color1, byte color2); +protected: + /** + * Draw the dialog + */ + virtual void draw(); public: /** * Constructor @@ -61,14 +71,14 @@ public: }; enum { - TEXTDIALOG_F8 = 0XF8, - TEXTDIALOG_F9 = 0XF8, - TEXTDIALOG_FA = 0XF8, - TEXTDIALOG_FB = 0XF8, - TEXTDIALOG_FC = 0XF8, - TEXTDIALOG_FD = 0XF8, - TEXTDIALOG_FE = 0XF8, - TEXTDIALOG_FONT = 0 + TEXTDIALOG_CONTENT1 = 0XF8, + TEXTDIALOG_CONTENT2 = 0XF9, + TEXTDIALOG_EDGE = 0XFA, + TEXTDIALOG_BACKGROUND = 0XFB, + TEXTDIALOG_FC = 0XFC, + TEXTDIALOG_FD = 0XFD, + TEXTDIALOG_FE = 0XFE, + TEXTDIALOG_BLACK = 0 }; #define TEXT_DIALOG_MAX_LINES 20 @@ -96,6 +106,8 @@ protected: int _currentX; int _numLines; int _lineSize; + int _askXp; + int _askLineNum; Common::String _lines[TEXT_DIALOG_MAX_LINES]; int _lineXp[TEXT_DIALOG_MAX_LINES]; byte _savedPalette[8 * 3]; @@ -125,11 +137,20 @@ public: */ ~TextDialog(); + /** + * Draw the dialog + */ + virtual void draw(); }; class MessageDialog: protected TextDialog { public: MessageDialog(MADSEngine *vm, int lines, ...); + + /** + * Show the dialog, and wait until a key or mouse press. + */ + void show(); }; } // End of namespace MADS diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp index bb980af7ff..3c50063c2e 100644 --- a/engines/mads/events.cpp +++ b/engines/mads/events.cpp @@ -21,16 +21,22 @@ */ #include "common/scummsys.h" +#include "graphics/cursorman.h" #include "common/events.h" #include "engines/util.h" #include "mads/mads.h" #include "mads/events.h" +#define GAME_FRAME_RATE 50 +#define GAME_FRAME_TIME (1000 / GAME_FRAME_RATE) + namespace MADS { EventsManager::EventsManager(MADSEngine *vm) { _vm = vm; _cursorSprites = nullptr; + _gameCounter = 0; + _priorFrameTime = 0; } EventsManager::~EventsManager() { @@ -38,7 +44,7 @@ EventsManager::~EventsManager() { } void EventsManager::loadCursors(const Common::String &spritesName) { - _cursorSprites = new SpriteAsset(_vm, "*CURSOR.SS", 0x4000); + _cursorSprites = new SpriteAsset(_vm, spritesName, 0x4000); } void EventsManager::setCursor(CursorType cursorId) { @@ -52,15 +58,86 @@ void EventsManager::setCursor2(CursorType cursorId) { changeCursor(); } +void EventsManager::showCursor() { + CursorMan.showMouse(true); +} + +void EventsManager::hideCursor() { + CursorMan.showMouse(false); +} + void EventsManager::changeCursor() { } -void EventsManager::handleEvents() { - Common::Event e; - while (!_vm->shouldQuit()) { - g_system->getEventManager()->pollEvent(e); +void EventsManager::pollEvents() { + checkForNextFrameCounter(); + _mouseClicked = false; + _mouseReleased = false; + _keyPressed = false; + + Common::Event event; + while (g_system->getEventManager()->pollEvent(event)) { + // Handle keypress + switch (event.type) { + case Common::EVENT_QUIT: + case Common::EVENT_RTL: + case Common::EVENT_KEYUP: + return; + + case Common::EVENT_KEYDOWN: + // Check for debugger + if (event.kbd.keycode == Common::KEYCODE_d && (event.kbd.flags & Common::KBD_CTRL)) { + // Attach to the debugger + _vm->_debugger->attach(); + _vm->_debugger->onFrame(); + } else { + _keyPressed = true; + } + return; + case Common::EVENT_LBUTTONDOWN: + case Common::EVENT_RBUTTONDOWN: + _mouseClicked = true; + return; + case Common::EVENT_LBUTTONUP: + case Common::EVENT_RBUTTONUP: + _mouseReleased = true; + return; + case Common::EVENT_MOUSEMOVE: + _mousePos = event.mouse; + break; + default: + break; + } + } +} + +void EventsManager::checkForNextFrameCounter() { + // Check for next game frame + uint32 milli = g_system->getMillis(); + if ((milli - _priorFrameTime) >= GAME_FRAME_TIME) { + ++_gameCounter; + _priorFrameTime = milli; + + // Give time to the debugger + _vm->_debugger->onFrame(); + + // Display the frame + _vm->_screen->updateScreen(); + + // Signal the ScummVM debugger + _vm->_debugger->onFrame(); + } +} + +void EventsManager::delay(int cycles) { + uint32 totalMilli = cycles * 1000 / GAME_FRAME_RATE; + uint32 delayEnd = g_system->getMillis() + totalMilli; + + while (!_vm->shouldQuit() && g_system->getMillis() < delayEnd) { g_system->delayMillis(10); + + pollEvents(); } } diff --git a/engines/mads/events.h b/engines/mads/events.h index c5cc5bf352..fefc64d630 100644 --- a/engines/mads/events.h +++ b/engines/mads/events.h @@ -39,13 +39,24 @@ private: MADSEngine *_vm; CursorType _cursorId; CursorType _newCursorId; + uint32 _gameCounter; + uint32 _priorFrameTime; + Common::Point _mousePos; /** * Updates the cursor image when the current cursor changes */ void changeCursor(); + + /** + * Checks for whether the next game frame number has been reached. + */ + void checkForNextFrameCounter(); public: SpriteAsset *_cursorSprites; + bool _mouseClicked; + bool _mouseReleased; + bool _keyPressed; public: /** * Constructor @@ -72,7 +83,30 @@ public: */ void setCursor2(CursorType cursorId); - void handleEvents(); + /** + * Show the mouse cursor + */ + void showCursor(); + + /** + * Hide the mouse cursor + */ + void hideCursor(); + + /** + * Poll any pending events + */ + void pollEvents(); + + /** + * Return the current mouse position + */ + Common::Point mousePos() const { return _mousePos; } + + /** + * Delay for a given number of frames + */ + void delay(int amount); }; } // End of namespace MADS diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index aa2bd55dd8..3a121d082b 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -42,6 +42,7 @@ MADSEngine::MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc) : _invObjectStill = false; _textWindowStill = false; + _debugger = nullptr; _events = nullptr; _font = nullptr; _game = nullptr; @@ -53,6 +54,7 @@ MADSEngine::MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc) : } MADSEngine::~MADSEngine() { + delete _debugger; delete _events; delete _font; delete _game; @@ -74,10 +76,11 @@ void MADSEngine::initialise() { MSprite::setVm(this); ResourcesManager::init(this); + _debugger = new Debugger(this); _events = new EventsManager(this); _palette = new Palette(this); _font = new Font(this); - _screen = MSurface::init(true); + _screen = MSurface::init(g_system->getWidth(), g_system->getHeight()); _sound = new SoundManager(this, _mixer); _userInterface = UserInterface::init(this); _game = Game::init(this); @@ -94,7 +97,7 @@ Common::Error MADSEngine::run() { _game->run(); // Dummy loop to keep application active - _events->handleEvents(); + _events->delay(9999); return Common::kNoError; } diff --git a/engines/mads/mads.h b/engines/mads/mads.h index b7598eb03d..5166b7b2b1 100644 --- a/engines/mads/mads.h +++ b/engines/mads/mads.h @@ -30,6 +30,7 @@ #include "common/util.h" #include "engines/engine.h" #include "graphics/surface.h" +#include "mads/debugger.h" #include "mads/events.h" #include "mads/font.h" #include "mads/game.h" @@ -86,6 +87,7 @@ protected: virtual Common::Error run(); virtual bool hasFeature(EngineFeature f) const; public: + Debugger *_debugger; EventsManager *_events; Font *_font; Game *_game; diff --git a/engines/mads/module.mk b/engines/mads/module.mk index ec85355abb..0b5f4c7b48 100644 --- a/engines/mads/module.mk +++ b/engines/mads/module.mk @@ -6,6 +6,7 @@ MODULE_OBJS := \ nebular/sound_nebular.o \ assets.o \ compression.o \ + debugger.o \ detection.o \ dialogs.o \ events.o \ diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp index b4ee129545..0846470e60 100644 --- a/engines/mads/msurface.cpp +++ b/engines/mads/msurface.cpp @@ -32,11 +32,11 @@ namespace MADS { MADSEngine *MSurface::_vm = nullptr; -MSurface *MSurface::init(bool isScreen) { +MSurface *MSurface::init() { if (_vm->getGameID() == GType_RexNebular) { - return new MSurfaceNebular(isScreen); + return new MSurfaceNebular(); } else { - return new MSurfaceMADS(isScreen); + return new MSurfaceMADS(); } } @@ -48,16 +48,13 @@ MSurface *MSurface::init(int width, int height) { } } -MSurface::MSurface(bool isScreen) { +MSurface::MSurface() { pixels = nullptr; - setSize(g_system->getWidth(), g_system->getHeight()); - _isScreen = isScreen; } MSurface::MSurface(int width, int height) { pixels = nullptr; setSize(width, height); - _isScreen = false; } MSurface::~MSurface() { @@ -120,17 +117,24 @@ void MSurface::hLineXor(int x1, int x2, int y) { } -void MSurface::line(int x1, int y1, int x2, int y2, byte color) { - Graphics::Surface::drawLine(x1, y1, x2, y2, color); +void MSurface::line(const Common::Point &startPos, const Common::Point &endPos, byte color) { + Graphics::Surface::drawLine(startPos.x, startPos.y, endPos.x, endPos.y, color); } +void MSurface::frameRect(const Common::Rect &r) { + Graphics::Surface::frameRect(r, _color); +} -void MSurface::frameRect(int x1, int y1, int x2, int y2) { - Graphics::Surface::frameRect(Common::Rect(x1, y1, x2, y2), _color); +void MSurface::frameRect(const Common::Rect &r, byte color) { + Graphics::Surface::frameRect(r, color); } -void MSurface::fillRect(int x1, int y1, int x2, int y2) { - Graphics::Surface::fillRect(Common::Rect(x1, y1, x2, y2), _color); +void MSurface::fillRect(const Common::Rect &r) { + Graphics::Surface::fillRect(r, _color); +} + +void MSurface::fillRect(const Common::Rect &r, byte color) { + Graphics::Surface::fillRect(r, color); } int MSurface::scaleValue(int value, int scale, int err) { @@ -282,12 +286,9 @@ void MSurface::empty() { Common::fill(getBasePtr(0, 0), getBasePtr(0, h), _vm->_palette->BLACK); } -void MSurface::frameRect(const Common::Rect &r, uint8 color) { - Graphics::Surface::frameRect(r, color); -} - -void MSurface::fillRect(const Common::Rect &r, uint8 color) { - Graphics::Surface::fillRect(r, color); +void MSurface::updateScreen() { + g_system->copyRectToScreen((const byte *)pixels, pitch, 0, 0, w, h); + g_system->updateScreen(); } void MSurface::copyFrom(MSurface *src, const Common::Rect &srcBounds, diff --git a/engines/mads/msurface.h b/engines/mads/msurface.h index 940c5b5704..2e4ca7e728 100644 --- a/engines/mads/msurface.h +++ b/engines/mads/msurface.h @@ -59,10 +59,9 @@ public: static void setVm(MADSEngine *vm) { _vm = vm; } /** - * Create a new surface the same size as the screen. - * @param isScreen Set to true for the screen surface + * Create a new surface. */ - static MSurface *init(bool isScreen = false); + static MSurface *init(); /** * Create a surface @@ -70,12 +69,11 @@ public: static MSurface *init(int width, int height); private: byte _color; - bool _isScreen; protected: /** * Basic constructor */ - MSurface(bool isScreen = false); + MSurface(); /** * Constructor for a surface with fixed dimensions @@ -129,28 +127,37 @@ public: /** * Draws an arbitrary line on the screen using a specified color + * @param startPos Starting position + * @param endPos Ending position + * @param color Color to use */ - void line(int x1, int y1, int x2, int y2, byte color); + void line(const Common::Point &startPos, const Common::Point &endPos, byte color); /** * Draws a rectangular frame using the currently set color + * @param r Bounds for rectangle */ - void frameRect(int x1, int y1, int x2, int y2); + void frameRect(const Common::Rect &r); /** - * Draws a rectangular frame using a specified color + * Draws a rectangular frame using the currently set color + * @param r Bounds for rectangle + * @param color Color to use */ - void frameRect(const Common::Rect &r, uint8 color); + void frameRect(const Common::Rect &r, byte color); /** * Draws a filled in box using the currently set color + * @param r Bounds for rectangle */ - void fillRect(int x1, int y1, int x2, int y2); + void fillRect(const Common::Rect &r); /** - * Draws a filled in box using a specified color + * Draws a filled in box using the currently set color + * @param r Bounds for rectangle + * @param color Color to use */ - void fillRect(const Common::Rect &r, uint8 color); + void fillRect(const Common::Rect &r, byte color); /** * Draws a sprite @@ -170,6 +177,13 @@ public: */ int getHeight() const { return h; } + /** + * Returns the size of the surface as a Rect + */ + Common::Rect getBounds() const { + return Common::Rect(0, 0, w, h); + } + /** * Returns a pointer to the surface data */ @@ -186,14 +200,9 @@ public: void empty(); /** - * Updates the surface. If it's the screen surface, copies it to the physical screen. + * Updates the screen with the contents of the surface */ - void update() { - if (_isScreen) { - g_system->copyRectToScreen((const byte *)pixels, pitch, 0, 0, w, h); - g_system->updateScreen(); - } - } + void updateScreen(); /** * Copys a sub-section of another surface into the current one. @@ -262,7 +271,7 @@ public: class MSurfaceMADS: public MSurface { friend class MSurface; protected: - MSurfaceMADS(bool isScreen = false): MSurface(isScreen) {} + MSurfaceMADS(): MSurface() {} MSurfaceMADS(int width, int height): MSurface(width, height) {} public: virtual void loadCodes(Common::SeekableReadStream *source); @@ -274,7 +283,7 @@ public: class MSurfaceNebular: public MSurfaceMADS { friend class MSurface; protected: - MSurfaceNebular(bool isScreen = false): MSurfaceMADS(isScreen) {} + MSurfaceNebular(): MSurfaceMADS() {} MSurfaceNebular(int width, int height): MSurfaceMADS(width, height) {} private: void loadBackgroundStream(Common::SeekableReadStream *source, RGBList **palData); diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index 10c210c6eb..dc2b1450ec 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -41,7 +41,11 @@ bool GameNebular::checkCopyProtection() { if (!ConfMan.getBool("copy_protection")) return true; - CopyProtectionDialog::show(_vm); + MessageDialog *dlg = new MessageDialog(_vm, 40, "Line 1", "Line 2", nullptr); + dlg->show(); + delete dlg; + + //CopyProtectionDialog::show(_vm); return false; } diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index 82ffa4e43a..8ec43b90b9 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -118,27 +118,6 @@ void Palette::reset() { WHITE = palIndexFromRgb(255, 255, 255, palData); } -void Palette::fadeIn(int numSteps, uint delayAmount, RGBList *destPalette) { - fadeIn(numSteps, delayAmount, destPalette->data(), destPalette->size()); -} - -void Palette::fadeIn(int numSteps, uint delayAmount, byte *destPalette, int numColors) { - if (_fading_in_progress) - return; - - _fading_in_progress = true; - byte blackPalette[PALETTE_SIZE]; - Common::fill(&blackPalette[0], &blackPalette[PALETTE_SIZE], 0); - - // Initially set the black palette - _vm->_palette->setPalette(blackPalette, 0, numColors); - - // Handle the actual fading - fadeRange(blackPalette, destPalette, 0, numColors - 1, numSteps, delayAmount); - - _fading_in_progress = false; -} - void Palette::resetColorCounts() { Common::fill(&_usageCount[0], &_usageCount[PALETTE_COUNT], 0); } @@ -211,33 +190,6 @@ void Palette::deleteAllRanges() { _usageCount[colIndex] = 0; } -void Palette::fadeRange(byte *srcPal, byte *destPal, int startIndex, int endIndex, - int numSteps, uint delayAmount) { - byte tempPal[256 * 3]; - - // perform the fade - for(int stepCtr = 1; stepCtr <= numSteps; ++stepCtr) { - // Delay the specified amount - uint32 startTime = g_system->getMillis(); - while ((g_system->getMillis() - startTime) < delayAmount) { - _vm->_events->handleEvents(); - g_system->delayMillis(10); - } - - for (int i = startIndex; i <= endIndex; ++i) { - // Handle the intermediate rgb values for fading - tempPal[i * 3] = (byte) (srcPal[i * 3] + (destPal[i * 3] - srcPal[i * 3]) * stepCtr / numSteps); - tempPal[i * 3 + 1] = (byte) (srcPal[i * 3 + 1] + (destPal[i * 3 + 1] - srcPal[i * 3 + 1]) * stepCtr / numSteps); - tempPal[i * 3 + 2] = (byte) (srcPal[i * 3 + 2] + (destPal[i * 3 + 2] - srcPal[i * 3 + 2]) * stepCtr / numSteps); - } - - _vm->_palette->setPalette(&tempPal[startIndex * 3], startIndex, endIndex - startIndex + 1); - } - - // Make sure the end palette exactly matches what is wanted - _vm->_palette->setPalette(&destPal[startIndex * 3], startIndex, endIndex - startIndex + 1); -} - void Palette::setGradient(byte *palette, int start, int count, int rgbValue1, int rgbValue2) { int rgbCtr = 0; int rgbCurrent = rgbValue2; diff --git a/engines/mads/palette.h b/engines/mads/palette.h index 53620d8fff..9a4e4518f7 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -77,12 +77,6 @@ public: class Palette { private: - /** - * Support method used by the fading code - */ - void fadeRange(byte *srcPal, byte *destPal, int startIndex, int endIndex, - int numSteps, uint delayAmount); - /** * Initialises a stanadrd range of colours for the given palette */ @@ -127,16 +121,6 @@ public: */ uint8 palIndexFromRgb(byte r, byte g, byte b, byte *paletteData = nullptr); - /** - * Performs a fade in - */ - void fadeIn(int numSteps, uint delayAmount, byte *destPalette, int numColors); - - /** - * Performs a fade in - */ - void fadeIn(int numSteps, uint delayAmount, RGBList *destPalette); - // Methods used for reference counting color usage /** * Resets the usage counts for the palette -- cgit v1.2.3 From 6b774d228495e2dc9de08520a3064889d439335d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 22 Feb 2014 18:21:18 -0500 Subject: MADS: Copy protection dialog is starting to be displayed --- engines/mads/dialogs.cpp | 40 ++++++++++++++++++++++---------- engines/mads/dialogs.h | 5 ++++ engines/mads/events.cpp | 11 +++++---- engines/mads/events.h | 1 - engines/mads/nebular/dialogs_nebular.cpp | 21 +++++++++++------ engines/mads/nebular/dialogs_nebular.h | 12 +++++----- engines/mads/nebular/game_nebular.cpp | 3 +-- 7 files changed, 60 insertions(+), 33 deletions(-) diff --git a/engines/mads/dialogs.cpp b/engines/mads/dialogs.cpp index ebb21418b1..d5a6bfd5be 100644 --- a/engines/mads/dialogs.cpp +++ b/engines/mads/dialogs.cpp @@ -34,7 +34,7 @@ Dialog::Dialog(MADSEngine *vm): _vm(vm), _savedSurface(nullptr), } Dialog::~Dialog() { - delete _savedSurface; + restore(_vm->_screen); } @@ -46,9 +46,11 @@ void Dialog::save(MSurface *s) { } void Dialog::restore(MSurface *s) { - _savedSurface->copyTo(s, _position); - delete _savedSurface; - _savedSurface = nullptr; + if (_savedSurface) { + _savedSurface->copyTo(s, _position); + delete _savedSurface; + _savedSurface = nullptr; + } } void Dialog::draw() { @@ -109,26 +111,28 @@ TextDialog::TextDialog(MADSEngine *vm, const Common::String &fontName, _numLines = 0; Common::fill(&_lineXp[0], &_lineXp[TEXT_DIALOG_MAX_LINES], 0); + // Save the high end of the palette, and set up the entries for dialog display Common::copy(&_vm->_palette->_mainPalette[TEXTDIALOG_CONTENT1 * 3], &_vm->_palette->_mainPalette[TEXTDIALOG_CONTENT1 * 3 + 8 * 3], &_savedPalette[0]); - Palette::setGradient(_vm->_palette->_mainPalette, TEXTDIALOG_CONTENT1, 2, 0x24, 0x20); - Palette::setGradient(_vm->_palette->_mainPalette, TEXTDIALOG_EDGE, 2, 0x27, 0x1C); - Palette::setGradient(_vm->_palette->_mainPalette, TEXTDIALOG_FC, 2, 0x24, 0x20); - Palette::setGradient(_vm->_palette->_mainPalette, TEXTDIALOG_FE, 1, 0x37, 0x37); + Palette::setGradient(_vm->_palette->_mainPalette, TEXTDIALOG_CONTENT1, 2, 0x90, 0x80); + Palette::setGradient(_vm->_palette->_mainPalette, TEXTDIALOG_EDGE, 2, 0x9C, 0x70); + Palette::setGradient(_vm->_palette->_mainPalette, TEXTDIALOG_FC, 2, 0x90, 0x80); + Palette::setGradient(_vm->_palette->_mainPalette, TEXTDIALOG_FE, 1, 0xDC, 0xDC); _vm->_palette->setPalette(_vm->_palette->_mainPalette + (TEXTDIALOG_CONTENT1 * 3), TEXTDIALOG_CONTENT1, 8); } TextDialog::~TextDialog() { + restorePalette(); } void TextDialog::addLine(const Common::String &line, bool underline) { if (_lineWidth > 0 || _currentX > 0) incNumLines(); - int stringWidth = _vm->_font->getWidth(line); + int stringWidth = _vm->_font->getWidth(line, 1); if (stringWidth >= _innerWidth || (int)line.size() >= _lineSize) { wordWrap(line); } else { @@ -249,17 +253,17 @@ void TextDialog::draw() { _position.x + _width - 4); } else { // Draw a text line - int xp = (_lineXp[lineNum] & 0x7F) + 5; + int xp = (_lineXp[lineNum] & 0x7F) + _position.x + 5; int yp = lineYp; if (_lineXp[lineNum] & 0x40) ++yp; _vm->_font->writeString(_vm->_screen, _lines[lineNum], - Common::Point(xp, yp), 1); + Common::Point(xp, yp), 0, 1); if (_lineXp[lineNum] & 0x80) { // Draw an underline under the text - int lineWidth = _vm->_font->getWidth(_lines[lineNum]); + int lineWidth = _vm->_font->getWidth(_lines[lineNum], 1); _vm->_screen->setColor(TEXTDIALOG_BLACK); _vm->_screen->hLine(xp, yp + _vm->_font->getHeight(), xp + lineWidth); } @@ -269,6 +273,12 @@ void TextDialog::draw() { } } +void TextDialog::restorePalette() { + Common::copy(&_savedPalette[0], &_savedPalette[8 * 3], + &_vm->_palette->_mainPalette[248 * 3]); + _vm->_palette->setPalette(_vm->_palette->_mainPalette, 248, 8); +} + /*------------------------------------------------------------------------*/ MessageDialog::MessageDialog(MADSEngine *vm, int maxChars, ...): @@ -286,7 +296,13 @@ MessageDialog::MessageDialog(MADSEngine *vm, int maxChars, ...): } void MessageDialog::show() { + draw(); + _vm->_events->showCursor(); + while (!_vm->shouldQuit() && !_vm->_events->_keyPressed && + !_vm->_events->_mouseClicked) { + _vm->_events->delay(1); + } } } // End of namespace MADS diff --git a/engines/mads/dialogs.h b/engines/mads/dialogs.h index 407f6d38bf..163d66ed51 100644 --- a/engines/mads/dialogs.h +++ b/engines/mads/dialogs.h @@ -99,6 +99,11 @@ private: * Append text to the currently end line. */ void appendLine(const Common::String &line); + + /** + * Clean up after finishing displaying the dialog + */ + void restorePalette(); protected: Common::String _fontName; int _innerWidth; diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp index 3c50063c2e..89d1560714 100644 --- a/engines/mads/events.cpp +++ b/engines/mads/events.cpp @@ -37,6 +37,8 @@ EventsManager::EventsManager(MADSEngine *vm) { _cursorSprites = nullptr; _gameCounter = 0; _priorFrameTime = 0; + _keyPressed = false; + _mouseClicked = false; } EventsManager::~EventsManager() { @@ -72,9 +74,6 @@ void EventsManager::changeCursor() { void EventsManager::pollEvents() { checkForNextFrameCounter(); - _mouseClicked = false; - _mouseReleased = false; - _keyPressed = false; Common::Event event; while (g_system->getEventManager()->pollEvent(event)) { @@ -82,7 +81,6 @@ void EventsManager::pollEvents() { switch (event.type) { case Common::EVENT_QUIT: case Common::EVENT_RTL: - case Common::EVENT_KEYUP: return; case Common::EVENT_KEYDOWN: @@ -95,13 +93,16 @@ void EventsManager::pollEvents() { _keyPressed = true; } return; + case Common::EVENT_KEYUP: + _keyPressed = false; + return; case Common::EVENT_LBUTTONDOWN: case Common::EVENT_RBUTTONDOWN: _mouseClicked = true; return; case Common::EVENT_LBUTTONUP: case Common::EVENT_RBUTTONUP: - _mouseReleased = true; + _mouseClicked = false; return; case Common::EVENT_MOUSEMOVE: _mousePos = event.mouse; diff --git a/engines/mads/events.h b/engines/mads/events.h index fefc64d630..4705e6258f 100644 --- a/engines/mads/events.h +++ b/engines/mads/events.h @@ -55,7 +55,6 @@ private: public: SpriteAsset *_cursorSprites; bool _mouseClicked; - bool _mouseReleased; bool _keyPressed; public: /** diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp index 76b6162d14..95a485d170 100644 --- a/engines/mads/nebular/dialogs_nebular.cpp +++ b/engines/mads/nebular/dialogs_nebular.cpp @@ -31,13 +31,6 @@ namespace MADS { namespace Nebular { -bool CopyProtectionDialog::show(MADSEngine *vm) { - CopyProtectionDialog *dlg = new CopyProtectionDialog(vm, false); - - delete dlg; - return true; -} - CopyProtectionDialog::CopyProtectionDialog(MADSEngine *vm, bool priorAnswerWrong): TextDialog(vm, FONT_INTERFACE, Common::Point(-1, -1), 32) { getHogAnusEntry(_hogEntry); @@ -76,6 +69,20 @@ CopyProtectionDialog::CopyProtectionDialog(MADSEngine *vm, bool priorAnswerWrong wordWrap(" "); wordWrap("\n"); + // TODO: Rest of setup +} + +bool CopyProtectionDialog::show() { + draw(); + _vm->_events->showCursor(); + + // TODO: Replace with text input + while (!_vm->shouldQuit() && !_vm->_events->_keyPressed && + !_vm->_events->_mouseClicked) { + _vm->_events->delay(1); + } + + return true; } bool CopyProtectionDialog::getHogAnusEntry(HOGANUS &entry) { diff --git a/engines/mads/nebular/dialogs_nebular.h b/engines/mads/nebular/dialogs_nebular.h index 7a63397603..53f377ae0a 100644 --- a/engines/mads/nebular/dialogs_nebular.h +++ b/engines/mads/nebular/dialogs_nebular.h @@ -43,20 +43,20 @@ class CopyProtectionDialog: public TextDialog { private: HOGANUS _hogEntry; - /** - * Constructor - */ - CopyProtectionDialog(MADSEngine *vm, bool priorAnswerWrong); - /** * Get a random copy protection entry from the HOGANUS resource */ bool getHogAnusEntry(HOGANUS &entry); public: + /** + * Constructor + */ + CopyProtectionDialog(MADSEngine *vm, bool priorAnswerWrong); + /** * Show the dialog */ - static bool show(MADSEngine *vm); + bool show(); }; } // End of namespace Nebular diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index dc2b1450ec..bf52af3733 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -41,11 +41,10 @@ bool GameNebular::checkCopyProtection() { if (!ConfMan.getBool("copy_protection")) return true; - MessageDialog *dlg = new MessageDialog(_vm, 40, "Line 1", "Line 2", nullptr); + CopyProtectionDialog *dlg = new CopyProtectionDialog(_vm, false); dlg->show(); delete dlg; - //CopyProtectionDialog::show(_vm); return false; } -- cgit v1.2.3 From 1d80edb2dd092b7e91805f359f0e2a7d470ed7c4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 23 Feb 2014 13:39:53 -0500 Subject: MADS: Fixes for the display of dialogs --- engines/mads/dialogs.cpp | 47 +++++++++++++++------ engines/mads/dialogs.h | 10 +++++ engines/mads/msurface.cpp | 71 -------------------------------- engines/mads/msurface.h | 58 -------------------------- engines/mads/nebular/dialogs_nebular.cpp | 3 +- 5 files changed, 46 insertions(+), 143 deletions(-) diff --git a/engines/mads/dialogs.cpp b/engines/mads/dialogs.cpp index d5a6bfd5be..c6049c3c1a 100644 --- a/engines/mads/dialogs.cpp +++ b/engines/mads/dialogs.cpp @@ -62,13 +62,19 @@ void Dialog::draw() { _vm->_screen->fillRect(Common::Rect(_position.x, _position.y, _position.x + _width, _position.y + _height), TEXTDIALOG_BACKGROUND); - // Draw the outer edge line - _vm->_screen->frameRect(Common::Rect(_position.x, _position.y, - _position.x + _width, _position.y + _height), TEXTDIALOG_EDGE); + // Draw the outer edge lines + _vm->_screen->hLine(_position.x + 1, _position.y + _height - 2, + _position.x + _width - 2, TEXTDIALOG_EDGE); + _vm->_screen->hLine(_position.x, _position.y + _height - 1, + _position.x + _width - 1, TEXTDIALOG_EDGE); + _vm->_screen->vLine(_position.x + _width - 2, _position.y + 2, + _position.y + _height - 2, TEXTDIALOG_EDGE); + _vm->_screen->vLine(_position.x + _width - 1, _position.y + 1, + _position.y + _height - 1, TEXTDIALOG_EDGE); // Draw the gravelly dialog content drawContent(Common::Rect(_position.x + 2, _position.y + 2, - _position.x + _width - 4, _position.y + _height - 4), 0, + _position.x + _width - 2, _position.y + _height - 2), 0, TEXTDIALOG_CONTENT1, TEXTDIALOG_CONTENT2); } @@ -86,7 +92,7 @@ void Dialog::drawContent(const Common::Rect &r, int seed, byte color1, byte colo seedAdjust = (seedAdjust >> 3) | ((seedAdjust & 7) << 13); currSeed += seedAdjust; - *destP++ = (currSeed & 0x10) ? color1 : color2; + *destP++ = (currSeed & 0x10) ? color2 : color1; } } } @@ -110,7 +116,9 @@ TextDialog::TextDialog(MADSEngine *vm, const Common::String &fontName, _currentX = 0; _numLines = 0; Common::fill(&_lineXp[0], &_lineXp[TEXT_DIALOG_MAX_LINES], 0); - + _askLineNum = -1; + _askXp = 0; + // Save the high end of the palette, and set up the entries for dialog display Common::copy(&_vm->_palette->_mainPalette[TEXTDIALOG_CONTENT1 * 3], &_vm->_palette->_mainPalette[TEXTDIALOG_CONTENT1 * 3 + 8 * 3], @@ -221,6 +229,12 @@ void TextDialog::appendLine(const Common::String &line) { _lines[_numLines] += line; } +void TextDialog::addInput() { + _askXp = _currentX + 1; + _askLineNum = _numLines; + incNumLines(); +} + void TextDialog::draw() { if (!_lineWidth) --_numLines; @@ -237,8 +251,6 @@ void TextDialog::draw() { if ((_position.y + _height) > _vm->_screen->getHeight()) _position.y = _vm->_screen->getHeight() - (_position.y + _height); -// int askYp = (_vm->_font->getHeight() + 1) * _vm->_font->getHeight() + 3; - // Draw the underlying dialog Dialog::draw(); @@ -247,10 +259,9 @@ void TextDialog::draw() { for (int lineNum = 0; lineNum < _numLines; ++lineNum) { if (_lineXp[lineNum] == -1) { // Draw a line across the entire dialog - _vm->_screen->setColor(TEXTDIALOG_BLACK); _vm->_screen->hLine(_position.x + 2, lineYp + (_vm->_font->getHeight() + 1) / 2, - _position.x + _width - 4); + _position.x + _width - 4, TEXTDIALOG_BLACK); } else { // Draw a text line int xp = (_lineXp[lineNum] & 0x7F) + _position.x + 5; @@ -264,8 +275,8 @@ void TextDialog::draw() { if (_lineXp[lineNum] & 0x80) { // Draw an underline under the text int lineWidth = _vm->_font->getWidth(_lines[lineNum], 1); - _vm->_screen->setColor(TEXTDIALOG_BLACK); - _vm->_screen->hLine(xp, yp + _vm->_font->getHeight(), xp + lineWidth); + _vm->_screen->hLine(xp, yp + _vm->_font->getHeight(), xp + lineWidth, + TEXTDIALOG_BLACK); } } @@ -273,6 +284,18 @@ void TextDialog::draw() { } } +void TextDialog::drawWithInput() { + int innerWidth = _innerWidth; + int lineHeight = _vm->_font->getHeight() + 1; + int xp = _position.x + 5; + + // Draw the content of the dialog + drawContent(Common::Rect(_position.x + 2, _position.y + 2, + _position.x + _width - 2, _position.y + _height - 2), 0, + TEXTDIALOG_CONTENT1, TEXTDIALOG_CONTENT2); + +} + void TextDialog::restorePalette() { Common::copy(&_savedPalette[0], &_savedPalette[8 * 3], &_vm->_palette->_mainPalette[248 * 3]); diff --git a/engines/mads/dialogs.h b/engines/mads/dialogs.h index 163d66ed51..0945ad9436 100644 --- a/engines/mads/dialogs.h +++ b/engines/mads/dialogs.h @@ -126,6 +126,11 @@ protected: * Adds one or more lines, word wrapping the passed text */ void wordWrap(const Common::String &line); + + /** + * Adds an input area following previously added text + */ + void addInput(); public: /** * Constructor @@ -146,6 +151,11 @@ public: * Draw the dialog */ virtual void draw(); + + /** + * Draw the dialog along with any input box + */ + void drawWithInput(); }; class MessageDialog: protected TextDialog { diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp index 0846470e60..a9561cdd9b 100644 --- a/engines/mads/msurface.cpp +++ b/engines/mads/msurface.cpp @@ -66,77 +66,6 @@ void MSurface::setSize(int width, int height) { Graphics::Surface::create(width, height, Graphics::PixelFormat::createFormatCLUT8()); } -void MSurface::vLine(int x, int y1, int y2) { - Graphics::Surface::vLine(x, y1, y2, _color); -} - -void MSurface::hLine(int x1, int x2, int y) { - Graphics::Surface::hLine(x1, y, x2, _color); -} - -void MSurface::vLineXor(int x, int y1, int y2) { - // Clipping - if (x < 0 || x >= w) - return; - - if (y2 < y1) - SWAP(y2, y1); - - if (y1 < 0) - y1 = 0; - if (y2 >= h) - y2 = h - 1; - - byte *ptr = (byte *)getBasePtr(x, y1); - while (y1++ <= y2) { - *ptr ^= 0xFF; - ptr += pitch; - } - -} - -void MSurface::hLineXor(int x1, int x2, int y) { - // Clipping - if (y < 0 || y >= h) - return; - - if (x2 < x1) - SWAP(x2, x1); - - if (x1 < 0) - x1 = 0; - if (x2 >= w) - x2 = w - 1; - - if (x2 < x1) - return; - - byte *ptr = (byte *)getBasePtr(x1, y); - while (x1++ <= x2) - *ptr++ ^= 0xFF; - -} - -void MSurface::line(const Common::Point &startPos, const Common::Point &endPos, byte color) { - Graphics::Surface::drawLine(startPos.x, startPos.y, endPos.x, endPos.y, color); -} - -void MSurface::frameRect(const Common::Rect &r) { - Graphics::Surface::frameRect(r, _color); -} - -void MSurface::frameRect(const Common::Rect &r, byte color) { - Graphics::Surface::frameRect(r, color); -} - -void MSurface::fillRect(const Common::Rect &r) { - Graphics::Surface::fillRect(r, _color); -} - -void MSurface::fillRect(const Common::Rect &r, byte color) { - Graphics::Surface::fillRect(r, color); -} - int MSurface::scaleValue(int value, int scale, int err) { int scaled = 0; while (value--) { diff --git a/engines/mads/msurface.h b/engines/mads/msurface.h index 2e4ca7e728..3904aa1e92 100644 --- a/engines/mads/msurface.h +++ b/engines/mads/msurface.h @@ -67,8 +67,6 @@ public: * Create a surface */ static MSurface *init(int width, int height); -private: - byte _color; protected: /** * Basic constructor @@ -95,36 +93,6 @@ public: */ void setSize(int width, int height); - /** - * Sets the color used for drawing on the surface - */ - void setColor(byte value) { _color = value; } - - /** - * Returns the currently active color - */ - byte getColor() const { return _color; } - - /** - * Draws a vertical line using the currently set color - */ - void vLine(int x, int y1, int y2); - - /** - * Draws a horizontal line using the currently set color - */ - void hLine(int x1, int x2, int y); - - /** - * Draws a vertical line using an Xor on each pixel - */ - void vLineXor(int x, int y1, int y2); - - /** - * Draws a horizontal line using an Xor on each pixel - */ - void hLineXor(int x1, int x2, int y); - /** * Draws an arbitrary line on the screen using a specified color * @param startPos Starting position @@ -133,32 +101,6 @@ public: */ void line(const Common::Point &startPos, const Common::Point &endPos, byte color); - /** - * Draws a rectangular frame using the currently set color - * @param r Bounds for rectangle - */ - void frameRect(const Common::Rect &r); - - /** - * Draws a rectangular frame using the currently set color - * @param r Bounds for rectangle - * @param color Color to use - */ - void frameRect(const Common::Rect &r, byte color); - - /** - * Draws a filled in box using the currently set color - * @param r Bounds for rectangle - */ - void fillRect(const Common::Rect &r); - - /** - * Draws a filled in box using the currently set color - * @param r Bounds for rectangle - * @param color Color to use - */ - void fillRect(const Common::Rect &r, byte color); - /** * Draws a sprite * @param pt Position to draw sprite at diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp index 95a485d170..6d2321eae2 100644 --- a/engines/mads/nebular/dialogs_nebular.cpp +++ b/engines/mads/nebular/dialogs_nebular.cpp @@ -67,9 +67,8 @@ CopyProtectionDialog::CopyProtectionDialog(MADSEngine *vm, bool priorAnswerWrong wordWrap("right into this really COOL adventure game!\n"); wordWrap("\n"); wordWrap(" "); + addInput(); wordWrap("\n"); - - // TODO: Rest of setup } bool CopyProtectionDialog::show() { -- cgit v1.2.3 From 8c9420a8349b0cdb93dcace36c2bd5f93e03476f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 23 Feb 2014 19:33:26 -0500 Subject: MADS: Added game initialisation code --- engines/mads/dialogs.cpp | 9 ++- engines/mads/events.cpp | 16 +++- engines/mads/events.h | 10 +++ engines/mads/game.cpp | 125 +++++++++++++++++++++++++++++- engines/mads/game.h | 112 ++++++++++++++++++++++++++- engines/mads/module.mk | 1 + engines/mads/nebular/game_nebular.cpp | 142 +++++++++++++++++++++++++++++++++- engines/mads/nebular/game_nebular.h | 28 ++++++- engines/mads/scene.cpp | 37 +++++++++ engines/mads/scene.h | 44 +++++++++++ 10 files changed, 512 insertions(+), 12 deletions(-) create mode 100644 engines/mads/scene.cpp create mode 100644 engines/mads/scene.h diff --git a/engines/mads/dialogs.cpp b/engines/mads/dialogs.cpp index c6049c3c1a..34a0b86abc 100644 --- a/engines/mads/dialogs.cpp +++ b/engines/mads/dialogs.cpp @@ -285,15 +285,16 @@ void TextDialog::draw() { } void TextDialog::drawWithInput() { - int innerWidth = _innerWidth; - int lineHeight = _vm->_font->getHeight() + 1; - int xp = _position.x + 5; + //int innerWidth = _innerWidth; + //int lineHeight = _vm->_font->getHeight() + 1; + //int xp = _position.x + 5; // Draw the content of the dialog drawContent(Common::Rect(_position.x + 2, _position.y + 2, _position.x + _width - 2, _position.y + _height - 2), 0, TEXTDIALOG_CONTENT1, TEXTDIALOG_CONTENT2); - + + error("TODO: drawWithInput"); } void TextDialog::restorePalette() { diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp index 89d1560714..23d2e72eeb 100644 --- a/engines/mads/events.cpp +++ b/engines/mads/events.cpp @@ -42,7 +42,7 @@ EventsManager::EventsManager(MADSEngine *vm) { } EventsManager::~EventsManager() { - delete _cursorSprites; + freeCursors(); } void EventsManager::loadCursors(const Common::String &spritesName) { @@ -68,8 +68,22 @@ void EventsManager::hideCursor() { CursorMan.showMouse(false); } +void EventsManager::resetCursor() { + CursorType cursorId = (CursorType)MIN(_cursorSprites->getCount(), (int)CURSOR_WAIT); + _newCursorId = cursorId; + if (_cursorId != _newCursorId) { + changeCursor(); + _cursorId = _newCursorId; + } +} + void EventsManager::changeCursor() { + warning("TODO: changeCursor"); +} +void EventsManager::freeCursors() { + delete _cursorSprites; + _cursorSprites = nullptr; } void EventsManager::pollEvents() { diff --git a/engines/mads/events.h b/engines/mads/events.h index 4705e6258f..01f48170d4 100644 --- a/engines/mads/events.h +++ b/engines/mads/events.h @@ -92,6 +92,16 @@ public: */ void hideCursor(); + /** + * Resets the cursor, if necessary + */ + void resetCursor(); + + /** + * Free currently loaded cursors + */ + void freeCursors(); + /** * Poll any pending events */ diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 774ec98eb4..aa0d1dcac6 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -26,6 +26,7 @@ #include "mads/nebular/game_nebular.h" #include "mads/graphics.h" #include "mads/msurface.h" +#include "mads/resources.h" namespace MADS { @@ -38,15 +39,66 @@ Game *Game::init(MADSEngine *vm) { Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr) { _sectionNumber = _priorSectionNumber = 0; + _difficultyLevel = DIFFICULTY_HARD; + _saveSlot = -1; + _statusFlag = 0; + _sectionHandler = nullptr; } Game::~Game() { delete _surface; + delete _sectionHandler; } void Game::run() { - if (!checkCopyProtection()) - return; + int protectionResult = checkCopyProtection(); + switch (protectionResult) { + case 1: + // Copy protection failed + _scene._nextSceneId = 804; + initialiseGlobals(); + _globalFlags[5] = 0xFFFF; + _saveSlot = -1; + break; + case 2: + _statusFlag = 0; + break; + default: + break; + } + + if (_saveSlot == -1 && protectionResult != -1 && protectionResult != -2) { + initSection(_scene._sectionNum); + _statusFlag = _scene._sectionNum != 1; + _pendingDialog = DIALOG_DIFFICULTY; + + showDialog(); + _pendingDialog = DIALOG_NONE; + + _vm->_events->freeCursors(); + _scene._priorSectionNum = 0; + _scene._priorSceneId = 0; + _scene._sectionNum2 = -1; + _scene._currentSceneId = -1; + } + + if (protectionResult != 1 && protectionResult != 2) { + initialiseGlobals(); + + if (_saveSlot != -1) { + warning("TODO: loadGame(\"REX.SAV\", 210)"); + _statusFlag = false; + } + } + + if (_statusFlag) + gameLoop(); +} + +void Game::gameLoop() { + setSectionHandler(); + + // TODO: More stuff } void Game::initSection(int sectionNumber) { @@ -61,4 +113,73 @@ void Game::initSection(int sectionNumber) { CURSOR_ARROW : CURSOR_WAIT); } +void Game::loadObjects() { + File f("*OBJECTS.DAT"); + + // Get the total numer of inventory objects + int count = f.readUint16LE(); + _objects.reserve(count); + + // Read in each object + for (int i = 0; i < count; ++i) { + InventoryObject obj; + obj.load(f); + _objects.push_back(obj); + + // If it's for the player's inventory, add the index to the inventory list + if (obj._roomNumber == PLAYER_INVENTORY) { + _inventoryList.push_back(i); + assert(_inventoryList.size() <= 32); + } + } +} + +void Game::setObjectData(int objIndex, int id, const byte *p) { + // TODO: This whole method seems weird. Check it out more thoroughly once + // more of the engine is implemented + for (int i = 0; i < (int)_objects.size(); ++i) { + InventoryObject &obj = _objects[i]; + if (obj._vocabList[0]._actionFlags1 <= i) + break; + + if (obj._mutilateString[6 + i] == id) { + _objects[objIndex]._objFolder = p; + } + } +} + +void Game::setObjectRoom(int objectId, int roomNumber) { + warning("TODO: setObjectRoom"); +} + +void Game::loadResourceSequence(const Common::String prefix, int v) { + warning("TODO: loadResourceSequence"); +} + +/*------------------------------------------------------------------------*/ + +void InventoryObject::load(Common::SeekableReadStream &f) { + _descId = f.readUint16LE(); + _roomNumber = f.readUint16LE(); + _article = f.readByte(); + _vocabCount = f.readByte(); + + for (int i = 0; i < 3; ++i) { + _vocabList[i]._actionFlags1 = f.readByte(); + _vocabList[i]._actionFlags2 = f.readByte(); + _vocabList[i]._vocabId = f.readByte(); + } + + f.skip(4); // field12 + f.read(&_mutilateString[0], 10); + f.skip(16); +} + +/*------------------------------------------------------------------------*/ + +Player::Player() { + _direction = 8; + _newDirection = 8; +} + } // End of namespace MADS diff --git a/engines/mads/game.h b/engines/mads/game.h index bb15a8e35b..9dd7ca0ace 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -24,28 +24,136 @@ #define MADS_GAME_H #include "common/scummsys.h" +#include "mads/scene.h" namespace MADS { class MADSEngine; +enum { + PLAYER_INVENTORY = 2 +}; + +enum Difficulty { + DIFFICULTY_HARD = 1, DIFFICULTY_MEDIUM = 2, DIFFICULTY_EASY = 3 +}; + +enum DialogId { + DIALOG_NONE = 0, DIALOG_GAME_MENU = 1, DIALOG_SAVE = 2, DIALOG_RESTORE = 3, + DIALOG_OPTIONS = 4, DIALOG_DIFFICULTY = 5, DIALOG_ERROR = 6 +}; + +class InventoryObject { +public: + int _descId; + int _roomNumber; + int _article; + int _vocabCount; + struct { + int _actionFlags1; + int _actionFlags2; + int _vocabId; + } _vocabList[3]; + char _mutilateString[10]; // ??? + const byte *_objFolder; // ??? + + /** + * Loads the data for a given object + */ + void load(Common::SeekableReadStream &f); +}; + +class Player { +public: + int _direction; + int _newDirection; +public: + Player(); +}; + +class SectionHandler { +protected: + MADSEngine *_vm; +public: + SectionHandler(MADSEngine *vm): _vm(vm) {} + + virtual void loadSection() = 0; + virtual void sectionPtr2() = 0; + virtual void sectionPtr3() = 0; +}; + class Game { +private: + /** + * Main game loop + */ + void gameLoop(); protected: MADSEngine *_vm; MSurface *_surface; + Difficulty _difficultyLevel; + Common::Array _globalFlags; + Common::Array _objects; + Common::Array _inventoryList; + Player _player; + Scene _scene; + int _saveSlot; + int _statusFlag; + DialogId _pendingDialog; + + SectionHandler *_sectionHandler; + /** + * Constructor + */ Game(MADSEngine *vm); /** - * Perform any copy protection check + * Loads the game's object list + */ + void loadObjects(); + + /** + * Set the associated data? pointer with an inventory object */ - virtual bool checkCopyProtection() = 0; + void setObjectData(int objIndex, int id, const byte *p); + + /** + * Sets the room number + */ + void setObjectRoom(int objectId, int roomNumber); /** * Initialises the current section number of the game */ void initSection(int sectionNumber); + void loadResourceSequence(const Common::String prefix, int v); + + //@{ + /** @name Virtual Method list */ + + /** + * Perform any copy protection check + */ + virtual int checkCopyProtection() = 0; + + /** + * Initialises global variables for a new game + */ + virtual void initialiseGlobals() = 0; + + /** + * Show a game dialog + */ + virtual void showDialog() = 0; + + /** + * Set up the section handler specific to each section + */ + virtual void setSectionHandler() = 0; + //@} + public: static Game *init(MADSEngine *vm); public: diff --git a/engines/mads/module.mk b/engines/mads/module.mk index 0b5f4c7b48..9219d04fdc 100644 --- a/engines/mads/module.mk +++ b/engines/mads/module.mk @@ -18,6 +18,7 @@ MODULE_OBJS := \ msurface.o \ palette.o \ resources.o \ + scene.o \ sound.o \ user_interface.o diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index bf52af3733..2e27eaea0f 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -37,15 +37,153 @@ GameNebular::GameNebular(MADSEngine *vm): Game(vm) { _surface =MSurface::init(MADS_SCREEN_WIDTH, MADS_SCREEN_HEIGHT - MADS_INTERFACE_HEIGHT); } -bool GameNebular::checkCopyProtection() { +int GameNebular::checkCopyProtection() { if (!ConfMan.getBool("copy_protection")) return true; + /* DEBUG: Disabled for now CopyProtectionDialog *dlg = new CopyProtectionDialog(_vm, false); dlg->show(); delete dlg; + */ - return false; + // DEBUG: Return that copy protection failed + return 1; +} + +void GameNebular::initialiseGlobals() { + // Allocate globals space + _globalFlags.resize(210); + for (int i = 0; i < 210; ++i) + _globalFlags[i] = 0; + + // Set specific values needed by the game + _globalFlags[4] = 8; + _globalFlags[33] = 1; + _globalFlags[10] = 0xFFFF; + _globalFlags[13] = 0xFFFF; + _globalFlags[15] = 0xFFFF; + _globalFlags[19] = 0xFFFF; + _globalFlags[20] = 0xFFFF; + _globalFlags[21] = 0xFFFF; + _globalFlags[95] = 0xFFFF; + + setObjectData(3, 17, nullptr); + + // Put the values 0 through 3 in a random order in global slots 83 to 86 + for (int i = 0; i < 4;) { + int randomVal = _vm->getRandomNumber(3); + _globalFlags[83 + i] = randomVal; + + bool flag = false; + for (int idx2 = 0; idx2 < i; ++idx2) { + if (_globalFlags[83 + idx2] == randomVal) + flag = true; + } + + if (!flag) + ++i; + } + + // Put the values 0 through 3 in a random order in global slots 87 to 90 + for (int i = 0; i < 4;) { + int randomVal = _vm->getRandomNumber(3); + _globalFlags[87 + i] = randomVal; + + bool flag = false; + for (int idx2 = 0; idx2 < i; ++idx2) { + if (_globalFlags[87 + idx2] == randomVal) + flag = true; + } + + if (!flag) + ++i; + } + + _globalFlags[120] = 501; + _globalFlags[121] = 0xFFFF; + _globalFlags[55] = 0xFFFF; + _globalFlags[119] = 1; + _globalFlags[134] = 4; + + // Fill out the globals 200 to 209 with unique random values less than 10000 + for (int i = 0; i < 10; ++i) { + int randomVal = _vm->getRandomNumber(9999); + _globalFlags[200 + i] = randomVal; + + bool flag = false; + for (int idx2 = 0; idx2 < i; ++idx2) { + if (_globalFlags[200 + idx2] == randomVal) + flag = true; + } + + if (!flag) + ++i; + } + + // Difficulty level control + switch (_difficultyLevel) { + case DIFFICULTY_HARD: + _globalFlags[35] = 0; + setObjectRoom(9, 1); + setObjectRoom(50, 1); + _globalFlags[137] = 5; + _globalFlags[136] = 0; + break; + case DIFFICULTY_MEDIUM: + _globalFlags[35] = 0; + setObjectRoom(8, 1); + _globalFlags[137] = 0xFFFF; + _globalFlags[136] = 6; + break; + case DIFFICULTY_EASY: + _globalFlags[35] = 2; + setObjectRoom(8, 1); + setObjectRoom(27, 1); + break; + default: + break; + } + + _player._direction = 8; + _player._newDirection = 8; + + loadResourceSequence("RXM", 1); + loadResourceSequence("ROX", 1); +} + +void GameNebular::showDialog() { + warning("TODO: showDialog"); +} + +void GameNebular::setSectionHandler() { + delete _sectionHandler; + + switch (_scene._sectionNum) { + case 1: + _sectionHandler = new Section1Handler(_vm); + break; + case 2: + _sectionHandler = new Section2Handler(_vm); + break; + case 3: + _sectionHandler = new Section3Handler(_vm); + break; + case 4: + _sectionHandler = new Section4Handler(_vm); + break; + case 5: + _sectionHandler = new Section5Handler(_vm); + break; + case 6: + _sectionHandler = new Section6Handler(_vm); + break; + case 7: + _sectionHandler = new Section7Handler(_vm); + break; + default: + break; + } } } // End of namespace Nebular diff --git a/engines/mads/nebular/game_nebular.h b/engines/mads/nebular/game_nebular.h index b0f088f891..b7f47aa9cd 100644 --- a/engines/mads/nebular/game_nebular.h +++ b/engines/mads/nebular/game_nebular.h @@ -35,9 +35,35 @@ class GameNebular: public Game { protected: GameNebular(MADSEngine *vm); - virtual bool checkCopyProtection(); + virtual int checkCopyProtection(); + + virtual void initialiseGlobals(); + + virtual void showDialog(); + + virtual void setSectionHandler(); }; + +class Section1Handler: public SectionHandler { +public: + Section1Handler(MADSEngine *vm): SectionHandler(vm) {} + + // TODO: Properly implement handler methods + virtual void loadSection() {} + virtual void sectionPtr2() {} + virtual void sectionPtr3() {} +}; + +// TODO: Properly implement handler classes +typedef Section1Handler Section2Handler; +typedef Section1Handler Section3Handler; +typedef Section1Handler Section4Handler; +typedef Section1Handler Section5Handler; +typedef Section1Handler Section6Handler; +typedef Section1Handler Section7Handler; + + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp new file mode 100644 index 0000000000..f6bbf32e40 --- /dev/null +++ b/engines/mads/scene.cpp @@ -0,0 +1,37 @@ +/* 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 "common/scummsys.h" +#include "mads/scene.h" + +namespace MADS { + +Scene::Scene() { + _sectionNum = 1; + _sectionNum2 = -1; + _priorSectionNum = 0; + _priorSceneId = 0; + _nextSceneId = 0; + _currentSceneId = 0; +} + +} // End of namespace MADS diff --git a/engines/mads/scene.h b/engines/mads/scene.h new file mode 100644 index 0000000000..a5359a9895 --- /dev/null +++ b/engines/mads/scene.h @@ -0,0 +1,44 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_SCENE_H +#define MADS_SCENE_H + +#include "common/scummsys.h" + +namespace MADS { + +class Scene { +public: + int _priorSectionNum; + int _sectionNum; + int _sectionNum2; + int _priorSceneId; + int _nextSceneId; + int _currentSceneId; + + Scene(); +}; + +} // End of namespace MADS + +#endif /* MADS_SCENE_H */ -- cgit v1.2.3 From 8ee283d921ec88bad61469e136a31aef0ff5b9ca Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 23 Feb 2014 21:34:20 -0500 Subject: MADS: Implemented sound player logic and outer game loop --- engines/mads/game.cpp | 26 +++++++++++- engines/mads/game.h | 12 ++++-- engines/mads/nebular/game_nebular.h | 4 +- engines/mads/palette.h | 7 ++++ engines/mads/scene.cpp | 40 +++++++++++++++++++ engines/mads/scene.h | 53 +++++++++++++++++++++++- engines/mads/sound.cpp | 80 ++++++++++++++++++++++++++++++++----- engines/mads/sound.h | 61 ++++++++++++++++++++++++++-- 8 files changed, 261 insertions(+), 22 deletions(-) diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index aa0d1dcac6..3acbd41ba6 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -43,6 +43,7 @@ Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr) { _saveSlot = -1; _statusFlag = 0; _sectionHandler = nullptr; + _v1 = _v2 = 0; } Game::~Game() { @@ -96,9 +97,30 @@ void Game::run() { } void Game::gameLoop() { - setSectionHandler(); + while (!_vm->shouldQuit() && _statusFlag) { + setSectionHandler(); + _sectionHandler->preLoadSection(); + initSection(_scene._sectionNum); + _sectionHandler->postLoadSection(); + + _scene.clearSprites(true); + + if (_scene._sectionNum == _scene._sectionNum2) { + sectionLoop(); + } + + // TODO: Extra reset methods + _vm->_events->resetCursor(); + _vm->_events->freeCursors(); + _vm->_sound->closeDriver(); + + } + + _vm->_palette->close(); +} + +void Game::sectionLoop() { - // TODO: More stuff } void Game::initSection(int sectionNumber) { diff --git a/engines/mads/game.h b/engines/mads/game.h index 9dd7ca0ace..4a8daed6ca 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -77,9 +77,9 @@ protected: public: SectionHandler(MADSEngine *vm): _vm(vm) {} - virtual void loadSection() = 0; + virtual void preLoadSection() = 0; virtual void sectionPtr2() = 0; - virtual void sectionPtr3() = 0; + virtual void postLoadSection() = 0; }; class Game { @@ -88,6 +88,11 @@ private: * Main game loop */ void gameLoop(); + + /** + * Inner game loop for executing gameplay within a game section + */ + void sectionLoop(); protected: MADSEngine *_vm; MSurface *_surface; @@ -100,8 +105,9 @@ protected: int _saveSlot; int _statusFlag; DialogId _pendingDialog; - SectionHandler *_sectionHandler; + int _v1; + int _v2; /** * Constructor diff --git a/engines/mads/nebular/game_nebular.h b/engines/mads/nebular/game_nebular.h index b7f47aa9cd..31bd4ae2b2 100644 --- a/engines/mads/nebular/game_nebular.h +++ b/engines/mads/nebular/game_nebular.h @@ -50,9 +50,9 @@ public: Section1Handler(MADSEngine *vm): SectionHandler(vm) {} // TODO: Properly implement handler methods - virtual void loadSection() {} + virtual void preLoadSection() {} virtual void sectionPtr2() {} - virtual void sectionPtr3() {} + virtual void postLoadSection() {} }; // TODO: Properly implement handler classes diff --git a/engines/mads/palette.h b/engines/mads/palette.h index 9a4e4518f7..b5588fecd6 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -178,6 +178,13 @@ public: */ void setLowRange(); + /** + * Set up the palette as the game ends + */ + void close() { + warning("TODO: Palette::close"); + } + // Color indexes uint8 BLACK; uint8 BLUE; diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index f6bbf32e40..cf7ba6c674 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -34,4 +34,44 @@ Scene::Scene() { _currentSceneId = 0; } +void Scene::clearSprites(bool flag) { + for (int i = 0; i < TEXT_DISPLAY_COUNT; ++i) + _textDisplay[i]._active = false; + + if (flag) + _spriteList.clear(); + + _spriteSlots.clear(); + _spriteSlots.push_back(SpriteSlot(ST_FULL_SCREEN_REFRESH, -1)); +} + +/*------------------------------------------------------------------------*/ + +SpriteSlot::SpriteSlot() { + _spriteType = ST_NONE; + _seqIndex = 0; + _spriteListIndex = 0; + _frameNumber = 0; + _depth = 0; + _scale = 0; +} + +SpriteSlot::SpriteSlot(SpriteType type, int seqIndex) { + _spriteType = type; + _seqIndex = seqIndex; + _spriteListIndex = 0; + _frameNumber = 0; + _depth = 0; + _scale = 0; +} + +/*------------------------------------------------------------------------*/ + +TextDisplay::TextDisplay() { + _active = false; + _spacing = 0; + _expire = 0; + _col1 = _col2 = 0; +} + } // End of namespace MADS diff --git a/engines/mads/scene.h b/engines/mads/scene.h index a5359a9895..e2afd081b3 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -24,9 +24,47 @@ #define MADS_SCENE_H #include "common/scummsys.h" +#include "common/array.h" +#include "common/rect.h" namespace MADS { +enum SpriteType { + ST_NONE = 0, ST_FOREGROUND = 1, ST_BACKGROUND = -4, + ST_FULL_SCREEN_REFRESH = -2, ST_EXPIRED = -1 +}; + +class SpriteSlot { +public: + SpriteType _spriteType; + int _seqIndex; + int _spriteListIndex; + int _frameNumber; + Common::Point _position; + int _depth; + int _scale; +public: + SpriteSlot(); + SpriteSlot(SpriteType type, int seqIndex); +}; + +class TextDisplay { +public: + bool _active; + int _spacing; + Common::Rect _bounds; + int _expire; + int _col1; + int _col2; + Common::String _fontName; + Common::String _msg; + + TextDisplay(); +}; + +#define SPRITE_COUNT 50 +#define TEXT_DISPLAY_COUNT 40 + class Scene { public: int _priorSectionNum; @@ -35,8 +73,21 @@ public: int _priorSceneId; int _nextSceneId; int _currentSceneId; - + TextDisplay _textDisplay[TEXT_DISPLAY_COUNT]; + Common::Array _spriteSlots; + Common::Array _spriteList; + int _spriteListIndex; + + /** + * Constructor + */ Scene(); + + /** + * Initialise the sprite data + * @param flag Also reset sprite list + */ + void clearSprites(bool flag); }; } // End of namespace MADS diff --git a/engines/mads/sound.cpp b/engines/mads/sound.cpp index 46ba997198..8608abf4e7 100644 --- a/engines/mads/sound.cpp +++ b/engines/mads/sound.cpp @@ -24,29 +24,89 @@ #include "audio/decoders/raw.h" #include "common/memstream.h" #include "mads/sound.h" +#include "mads/mads.h" +#include "mads/nebular/sound_nebular.h" namespace MADS { SoundManager::SoundManager(MADSEngine *vm, Audio::Mixer *mixer) { _vm = vm; _mixer = mixer; - _asound = nullptr; + _driver = nullptr; + _pollSoundEnabled = false; + _soundPollFlag = false; + _newSoundsPaused = false; } SoundManager::~SoundManager() { - delete _asound; + delete _driver; } -void SoundManager::test() { - _asound = new Nebular::ASound1(_mixer); - _asound->command(5); - _asound->command(28); - _asound->command(19); +void SoundManager::init(int sectionNumber) { + assert(sectionNumber > 0 && sectionNumber < 10); + + switch (_vm->getGameID()) { + case GType_RexNebular: + // TODO: Other Rex Adlib section drivers + assert(sectionNumber == 1); + _driver = new Nebular::ASound1(_mixer); + break; + + default: + error("Unknown game"); + } +} + +void SoundManager::closeDriver() { + if (_driver) { + command(0); + setEnabled(false); + stop(); + + removeDriver(); + } +} + +void SoundManager::removeDriver() { + delete _driver; + _driver = nullptr; +} + +void SoundManager::setEnabled(bool flag) { + _pollSoundEnabled = flag; + _soundPollFlag = false; +} + +void SoundManager::queueNewCommands() { + _newSoundsPaused = true; +} + +void SoundManager::startQueuedCommands() { + _newSoundsPaused = false; + + while (!_queuedCommands.empty()) { + int commandId = _queuedCommands.front(); + command(commandId); + } +} + +void SoundManager::command(int commandId, int param) { + if (_newSoundsPaused) { + if (_queuedCommands.size() < 8) + _queuedCommands.push(commandId); + } else if (_driver) { + _driver->command(commandId, param); + } +} + +void SoundManager::stop() { + if (_driver) + _driver->stop(); } -void SoundManager::poll() { - if (_asound) - _asound->poll(); +void SoundManager::noise() { + if (_driver) + _driver->noise(); } } // End of namespace MADS diff --git a/engines/mads/sound.h b/engines/mads/sound.h index 7a9a4ef29b..51213f0e4e 100644 --- a/engines/mads/sound.h +++ b/engines/mads/sound.h @@ -24,6 +24,7 @@ #define MADS_SOUND_H #include "common/scummsys.h" +#include "common/queue.h" #include "audio/audiostream.h" #include "audio/mixer.h" #include "mads/nebular/sound_nebular.h" @@ -36,13 +37,65 @@ class SoundManager { private: MADSEngine *_vm; Audio::Mixer *_mixer; - Nebular::ASound *_asound; + Nebular::ASound *_driver; + bool _pollSoundEnabled; + bool _soundPollFlag; + bool _newSoundsPaused; + Common::Queue _queuedCommands; public: SoundManager(MADSEngine *vm, Audio::Mixer *mixer); ~SoundManager(); - - void test(); - void poll(); + + /** + * Initialises the sound driver for a given game section + */ + void init(int sectionNumber); + + /** + * Stop any currently active sound and remove the driver + */ + void closeDriver(); + + /** + * Remove the driver + */ + void removeDriver(); + + /** + * Sets the enabled status of the sound + * @flag True if sound should be enabled + */ + void setEnabled(bool flag); + + /** + * Temporarily pause the playback of any new sound commands + */ + void queueNewCommands(); + + /** + * Stop queueing sound commands, and execute any previously queued ones + */ + void startQueuedCommands(); + + //@{ + /** + * Executes a command on the sound driver + * @param commandid Command Id to execute + * @param param Optional paramater specific to a few commands + */ + void command(int commandId, int param = 0); + + /** + * Stops any currently playing sound + */ + void stop(); + + /** + * Noise + * Some sort of random noise generation? + */ + void noise(); + //@} }; } // End of namespace MADS -- cgit v1.2.3 From 37b788b7ddb679f32653be326ae96ad9132feb1f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 24 Feb 2014 00:20:53 -0500 Subject: MADS: Added skeleton framework for game scene classes --- engines/mads/dialogs.cpp | 12 +++ engines/mads/dialogs.h | 17 ++++ engines/mads/game.cpp | 53 ++++++++++-- engines/mads/game.h | 20 +++-- engines/mads/mads.cpp | 3 + engines/mads/mads.h | 2 + engines/mads/module.mk | 2 + engines/mads/nebular/nebular_scenes.cpp | 49 +++++++++++ engines/mads/nebular/nebular_scenes.h | 91 +++++++++++++++++++++ engines/mads/nebular/nebular_scenes8.cpp | 50 ++++++++++++ engines/mads/nebular/nebular_scenes8.h | 55 +++++++++++++ engines/mads/palette.cpp | 2 +- engines/mads/palette.h | 1 + engines/mads/scene.cpp | 105 +++++++++++++++++++++++- engines/mads/scene.h | 134 ++++++++++++++++++++++++++++++- 15 files changed, 577 insertions(+), 19 deletions(-) create mode 100644 engines/mads/nebular/nebular_scenes.cpp create mode 100644 engines/mads/nebular/nebular_scenes.h create mode 100644 engines/mads/nebular/nebular_scenes8.cpp create mode 100644 engines/mads/nebular/nebular_scenes8.h diff --git a/engines/mads/dialogs.cpp b/engines/mads/dialogs.cpp index 34a0b86abc..fd42eb5db0 100644 --- a/engines/mads/dialogs.cpp +++ b/engines/mads/dialogs.cpp @@ -329,4 +329,16 @@ void MessageDialog::show() { } } +/*------------------------------------------------------------------------*/ + +Dialogs *Dialogs::init(MADSEngine *vm) { + if (vm->getGameID() == GType_RexNebular) + return new Dialogs(vm); + + error("Unknown game"); +} + +Dialogs::Dialogs(MADSEngine *vm): _vm(vm) { +} + } // End of namespace MADS diff --git a/engines/mads/dialogs.h b/engines/mads/dialogs.h index 0945ad9436..f77590deee 100644 --- a/engines/mads/dialogs.h +++ b/engines/mads/dialogs.h @@ -168,6 +168,23 @@ public: void show(); }; +enum DialogId { + DIALOG_NONE = 0, DIALOG_GAME_MENU = 1, DIALOG_SAVE = 2, DIALOG_RESTORE = 3, + DIALOG_OPTIONS = 4, DIALOG_DIFFICULTY = 5, DIALOG_ERROR = 6 +}; + +class Dialogs { +private: + MADSEngine *_vm; + + Dialogs(MADSEngine *vm); +public: + static Dialogs *init(MADSEngine *vm); +public: + Common::Point _defaultPosition; + DialogId _pendingDialog; +}; + } // End of namespace MADS #endif /* MADS_DIALOGS_H */ diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 3acbd41ba6..14dbcde01f 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -37,13 +37,15 @@ Game *Game::init(MADSEngine *vm) { return nullptr; } -Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr) { +Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _scene(vm) { _sectionNumber = _priorSectionNumber = 0; _difficultyLevel = DIFFICULTY_HARD; _saveSlot = -1; _statusFlag = 0; _sectionHandler = nullptr; _v1 = _v2 = 0; + _v3 = _v4 = 0; + _v5 = _v6 = 0; } Game::~Game() { @@ -71,15 +73,15 @@ void Game::run() { if (_saveSlot == -1 && protectionResult != -1 && protectionResult != -2) { initSection(_scene._sectionNum); _statusFlag = _scene._sectionNum != 1; - _pendingDialog = DIALOG_DIFFICULTY; + _vm->_dialogs->_pendingDialog = DIALOG_DIFFICULTY; showDialog(); - _pendingDialog = DIALOG_NONE; + _vm->_dialogs->_pendingDialog = DIALOG_NONE; _vm->_events->freeCursors(); _scene._priorSectionNum = 0; _scene._priorSceneId = 0; - _scene._sectionNum2 = -1; + _scene._sectionNumPrior = -1; _scene._currentSceneId = -1; } @@ -105,7 +107,7 @@ void Game::gameLoop() { _scene.clearSprites(true); - if (_scene._sectionNum == _scene._sectionNum2) { + if (_scene._sectionNum == _scene._sectionNumPrior) { sectionLoop(); } @@ -113,14 +115,47 @@ void Game::gameLoop() { _vm->_events->resetCursor(); _vm->_events->freeCursors(); _vm->_sound->closeDriver(); - } _vm->_palette->close(); } void Game::sectionLoop() { - + while (!_vm->shouldQuit() && _statusFlag && _scene._sectionNum == _scene._sectionNumPrior) { + + if (_vm->_dialogs->_pendingDialog && _player._stepEnabled && !_globalFlags[5]) { + _v1 = 3; + _player._spritesChanged = true; + _v5 = 0; + _v6 = 0; + _vm->_events->resetCursor(); + + _quotes = nullptr; + _scene.clearVocab(); + _scene.loadScene(); + + _v4 = 0; + _player._stepEnabled = true; + _player._visible = true; + _vm->_dialogs->_defaultPosition = Common::Point(-1, -1); + _scene.addVisitedScene(_scene._nextSceneId); + + // TODO: main section loop logic goes here + + // Clear the scene + _scene.free(); + _scene._sectionNum = _scene._nextSceneId / 100; + + // TODO: sub_1DD46(3) + + // Check whether to show a dialog + if (_vm->_dialogs->_pendingDialog && _player._stepEnabled && !_globalFlags[5]) { + _scene.releasePlayerSprites(); + showDialog(); + _vm->_dialogs->_pendingDialog = DIALOG_NONE; + } + } + } } void Game::initSection(int sectionNumber) { @@ -202,6 +237,10 @@ void InventoryObject::load(Common::SeekableReadStream &f) { Player::Player() { _direction = 8; _newDirection = 8; + _spritesLoaded = false; + _spriteListStart = _numSprites = 0; + _stepEnabled = false; + _visible = false; } } // End of namespace MADS diff --git a/engines/mads/game.h b/engines/mads/game.h index 4a8daed6ca..58b6ff968a 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -38,11 +38,6 @@ enum Difficulty { DIFFICULTY_HARD = 1, DIFFICULTY_MEDIUM = 2, DIFFICULTY_EASY = 3 }; -enum DialogId { - DIALOG_NONE = 0, DIALOG_GAME_MENU = 1, DIALOG_SAVE = 2, DIALOG_RESTORE = 3, - DIALOG_OPTIONS = 4, DIALOG_DIFFICULTY = 5, DIALOG_ERROR = 6 -}; - class InventoryObject { public: int _descId; @@ -67,6 +62,12 @@ class Player { public: int _direction; int _newDirection; + bool _spritesLoaded; + int _spriteListStart; + int _numSprites; + bool _stepEnabled; + bool _spritesChanged; + bool _visible; public: Player(); }; @@ -76,6 +77,7 @@ protected: MADSEngine *_vm; public: SectionHandler(MADSEngine *vm): _vm(vm) {} + virtual ~SectionHandler() {} virtual void preLoadSection() = 0; virtual void sectionPtr2() = 0; @@ -104,10 +106,14 @@ protected: Scene _scene; int _saveSlot; int _statusFlag; - DialogId _pendingDialog; SectionHandler *_sectionHandler; int _v1; int _v2; + int _v3; + int _v4; + int _v5; + int _v6; + byte *_quotes; /** * Constructor @@ -172,6 +178,8 @@ public: * Run the game */ void run(); + + Player &player() { return _player; } }; } // End of namespace MADS diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index 3a121d082b..db73ec7d23 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -43,6 +43,7 @@ MADSEngine::MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc) : _textWindowStill = false; _debugger = nullptr; + _dialogs = nullptr; _events = nullptr; _font = nullptr; _game = nullptr; @@ -55,6 +56,7 @@ MADSEngine::MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc) : MADSEngine::~MADSEngine() { delete _debugger; + delete _dialogs; delete _events; delete _font; delete _game; @@ -77,6 +79,7 @@ void MADSEngine::initialise() { ResourcesManager::init(this); _debugger = new Debugger(this); + _dialogs = Dialogs::init(this); _events = new EventsManager(this); _palette = new Palette(this); _font = new Font(this); diff --git a/engines/mads/mads.h b/engines/mads/mads.h index 5166b7b2b1..b3a05dc56c 100644 --- a/engines/mads/mads.h +++ b/engines/mads/mads.h @@ -31,6 +31,7 @@ #include "engines/engine.h" #include "graphics/surface.h" #include "mads/debugger.h" +#include "mads/dialogs.h" #include "mads/events.h" #include "mads/font.h" #include "mads/game.h" @@ -88,6 +89,7 @@ protected: virtual bool hasFeature(EngineFeature f) const; public: Debugger *_debugger; + Dialogs *_dialogs; EventsManager *_events; Font *_font; Game *_game; diff --git a/engines/mads/module.mk b/engines/mads/module.mk index 9219d04fdc..a729533bcc 100644 --- a/engines/mads/module.mk +++ b/engines/mads/module.mk @@ -4,6 +4,8 @@ MODULE_OBJS := \ nebular/dialogs_nebular.o \ nebular/game_nebular.o \ nebular/sound_nebular.o \ + nebular/nebular_scenes.o \ + nebular/nebular_scenes8.o \ assets.o \ compression.o \ debugger.o \ diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp new file mode 100644 index 0000000000..efd831a4b7 --- /dev/null +++ b/engines/mads/nebular/nebular_scenes.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 "common/scummsys.h" +#include "common/config-manager.h" +#include "mads/mads.h" +#include "mads/scene.h" +#include "mads/nebular/nebular_scenes.h" +#include "mads/nebular/nebular_scenes8.h" + +namespace MADS { + +namespace Nebular { + +SceneLogic *SceneFactory::createScene(Scene *scene) { + scene->addActiveVocab(NOUN_DROP); + scene->addActiveVocab(NOUN_DOLLOP); + scene->addActiveVocab(NOUN_DASH); + scene->addActiveVocab(NOUN_SPLASH); + scene->addActiveVocab(NOUN_ALCOHOL); + + // TODO: Implement all the game scenes + assert(scene->_nextSceneId == 804); + + return new Scene804(scene); +} + +} // End of namespace Nebular + +} // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h new file mode 100644 index 0000000000..28d24f090f --- /dev/null +++ b/engines/mads/nebular/nebular_scenes.h @@ -0,0 +1,91 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_NEBULAR_SCENES_H +#define MADS_NEBULAR_SCENES_H + +#include "common/scummsys.h" +#include "mads/game.h" +#include "mads/scene.h" + +namespace MADS { + +namespace Nebular { + +enum Noun { + NOUN_BLOWGUN = 0x29, + NOUN_BURGER = 0x35, + NOUN_CHAIR = 0x47, + NOUN_DEAD_FISH = 0x65, + NOUN_DOOR = 0x6E, + NOUN_EAT = 0x75, + NOUN_EXAMINE = 0x7D, + NOUN_FRONT_WINDOW = 0x8E, + NOUN_FUZZY_DICE = 0x91, + NOUN_HOSE_DOWN = 0x0A6, + NOUN_HOTPANTS = 0x0A7, + NOUN_HULL = 0x0A8, + NOUN_HURL = 0x0A9, + NOUN_IGNITE = 0x0B4, + NOUN_INFLATE = 0x0B5, + NOUN_INSERT = 0x0B6, + NOUN_INSPECT = 0x0B7, + NOUN_JUNGLE = 0x0B8, + NOUN_LIFE_SUPPORT_SECTION = 0x0CC, + NOUN_LOG = 0x0D0, + NOUN_LOOK_AT = 0x0D1, + NOUN_LOOK_IN = 0x0D2, + NOUN_LOOK_THROUGH = 0x0D3, + NOUN_MONKEY = 0x0E3, + NOUN_OUTER_HULL = 0x0F8, + NOUN_OUTSIDE = 0x0F9, + NOUN_PEER_THROUGH = 0x103, + NOUN_PLANT_STALK = 0x10F, + NOUN_READ = 0x11F, + NOUN_REFRIDGERATOR = 0x122, + NOUN_ROBO_KITCHEN = 0x127, + NOUN_SHIELD_ACCESS_PANEL = 0x135, + NOUN_SHIELD_MODULATOR = 0x137, + NOUN_SHOOT = 0x13A, + NOUN_SIT_IN = 0x13F, + NOUN_SMELL = 0x147, + NOUN_STUFFED_FISH = 0x157, + NOUN_VIEW_SCREEN = 0x180, + NOUN_CAPTIVE_CREATURE = 0x1C3, + NOUN_NATIVE_WOMAN = 0x1DC, + NOUN_ALCOHOL = 0x310, + NOUN_DOLLOP = 0x3AC, + NOUN_DROP = 0x3AD, + NOUN_DASH = 0x3AE, + NOUN_SPLASH = 0x3AF +}; + +class SceneFactory { +public: + static SceneLogic *createScene(Scene *scene); +}; + +} // End of namespace Nebular + +} // End of namespace MADS + +#endif /* MADS_NEBULAR_SCENES_H */ diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp new file mode 100644 index 0000000000..8feabc8037 --- /dev/null +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -0,0 +1,50 @@ +/* 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 "common/scummsys.h" +#include "mads/nebular/nebular_scenes8.h" + +namespace MADS { + +namespace Nebular { + +void Scene804::setup() { +} + +void Scene804::enter() { +} + +void Scene804::step() { +} + +void Scene804::preActions() { +} + +void Scene804::actions() { +} + +void Scene804::postActions() { +} + +} // End of namespace Nebular + +} // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes8.h b/engines/mads/nebular/nebular_scenes8.h new file mode 100644 index 0000000000..11bb8b0d81 --- /dev/null +++ b/engines/mads/nebular/nebular_scenes8.h @@ -0,0 +1,55 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_NEBULAR_SCENES8_H +#define MADS_NEBULAR_SCENES8_H + +#include "common/scummsys.h" +#include "mads/game.h" +#include "mads/scene.h" + +namespace MADS { + +namespace Nebular { + +class Scene804: public SceneLogic { +public: + Scene804(Scene *scene): SceneLogic(scene) {} + + virtual void setup(); + + virtual void enter(); + + virtual void step(); + + virtual void preActions(); + + virtual void actions(); + + virtual void postActions(); +}; + +} // End of namespace Nebular + +} // End of namespace MADS + +#endif /* MADS_NEBULAR_SCENES8_H */ diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index 8ec43b90b9..5438c782aa 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -293,7 +293,7 @@ void Palette::initRange(byte *palette) { int varE = vbx; int var10 = vdx; do { - int vdx = 0; + vdx = 0; do { int vcx = 0; int var4 = vdx; diff --git a/engines/mads/palette.h b/engines/mads/palette.h index b5588fecd6..14cebc7092 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -24,6 +24,7 @@ #define MADS_PALETTE_H #include "common/scummsys.h" +#include "common/stream.h" namespace MADS { diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index cf7ba6c674..46190d12be 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -22,16 +22,26 @@ #include "common/scummsys.h" #include "mads/scene.h" +#include "mads/mads.h" +#include "mads/nebular/nebular_scenes.h" namespace MADS { -Scene::Scene() { +Scene::Scene(MADSEngine *vm): _vm(vm) { _sectionNum = 1; - _sectionNum2 = -1; + _sectionNumPrior = -1; _priorSectionNum = 0; _priorSceneId = 0; _nextSceneId = 0; _currentSceneId = 0; + _vocabCount = 0; + _vocabBuffer = nullptr; + _sceneLogic = nullptr; +} + +Scene::~Scene() { + delete[] _vocabBuffer; + delete _sceneLogic; } void Scene::clearSprites(bool flag) { @@ -45,6 +55,86 @@ void Scene::clearSprites(bool flag) { _spriteSlots.push_back(SpriteSlot(ST_FULL_SCREEN_REFRESH, -1)); } +/** + * Releases any sprites used by the player + */ +void Scene::releasePlayerSprites() { + Player &player = _vm->_game->player(); + + if (player._spritesLoaded && player._numSprites > 0) { + int spriteEnd = player._spriteListStart + player._numSprites - 1; + do { + deleteSpriteEntry(spriteEnd); + } while (--spriteEnd >= player._spriteListStart); + } +} + +void Scene::deleteSpriteEntry(int listIndex) { + delete _spriteList[listIndex]; + _spriteList.remove_at(listIndex); +} + +void Scene::clearDynamicHotspots() { + _dynamicHotspots.clear(); + _dynamicHotspotsChanged = false; +} + +void Scene::clearVocab() { + freeVocab(); + _vocabCount = 0; +} + +void Scene::freeVocab() { + delete[] _vocabBuffer; + _vocabBuffer = nullptr; +} + +void Scene::addActiveVocab(int vocabId) { + if (activeVocabIndexOf(vocabId) == -1) { + assert(_activeVocabs.size() < 200); + _activeVocabs.push_back(vocabId); + } +} + +int Scene::activeVocabIndexOf(int vocabId) { + for (uint i = 0; i < _activeVocabs.size(); ++i) { + if (_activeVocabs[i] == vocabId) + return i; + } + + return -1; +} + +void Scene::addVisitedScene(int sceneId) { + if (!visitedScenesExists(sceneId)) + _visitedScenes.push_back(sceneId); +} + +bool Scene::visitedScenesExists(int sceneId) { + for (int i = 0; i < _visitedScenes.size(); ++i) { + if (_visitedScenes[i] == sceneId) + return true; + } + + return false; +} + +void Scene::loadScene() { + delete _sceneLogic; + + switch (_vm->getGameID()) { + case GType_RexNebular: + _sceneLogic = Nebular::SceneFactory::createScene(this); + break; + default: + error("Unknown game"); + } +} + +void Scene::free() { + warning("TODO: Scene::free"); +} + /*------------------------------------------------------------------------*/ SpriteSlot::SpriteSlot() { @@ -74,4 +164,15 @@ TextDisplay::TextDisplay() { _col1 = _col2 = 0; } +/*------------------------------------------------------------------------*/ + +DynamicHotspot::DynamicHotspot() { + _seqIndex = 0; + _facing = 0; + _descId = 0; + _field14 = 0; + _articleNumber = 0; + _cursor = 0; +} + } // End of namespace MADS diff --git a/engines/mads/scene.h b/engines/mads/scene.h index e2afd081b3..9f4f392289 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -26,6 +26,7 @@ #include "common/scummsys.h" #include "common/array.h" #include "common/rect.h" +#include "mads/assets.h" namespace MADS { @@ -62,32 +63,159 @@ public: TextDisplay(); }; +class DynamicHotspot { +public: + int _seqIndex; + Common::Rect _bounds; + Common::Point _feetPos; + int _facing; + int _descId; + int _field14; + int _articleNumber; + int _cursor; + + DynamicHotspot(); +}; + #define SPRITE_COUNT 50 #define TEXT_DISPLAY_COUNT 40 +#define DYNAMIC_HOTSPOT_COUNT 8 + +class MADSEngine; +class Scene; + +class SceneLogic { +protected: + Scene *_scene; +public: + /** + * Constructor + */ + SceneLogic(Scene *scene): _scene(scene) {} + + /** + * Called to initially setup a scene + */ + virtual void setup() = 0; + + /** + * Called as the scene is entered (made active) + */ + virtual void enter() = 0; + + /** + * Called one per frame + */ + virtual void step() = 0; + + /** + * Called before an action is started + */ + virtual void preActions() = 0; + + /** + * Handles scene actions + */ + virtual void actions() = 0; + + /** + * Post-action handling + */ + virtual void postActions() = 0; +}; class Scene { +private: + /** + * Free the voculary list buffer + */ + void freeVocab(); + + /** + * Return the index of a given Vocab in the active vocab list + */ + int activeVocabIndexOf(int vocabId); + + /** + * Returns true if a given Scene Id exists in the listed of previously visited scenes. + */ + bool visitedScenesExists(int sceneId); +protected: + MADSEngine *_vm; public: + SceneLogic *_sceneLogic; int _priorSectionNum; int _sectionNum; - int _sectionNum2; + int _sectionNumPrior; int _priorSceneId; int _nextSceneId; int _currentSceneId; TextDisplay _textDisplay[TEXT_DISPLAY_COUNT]; Common::Array _spriteSlots; - Common::Array _spriteList; + Common::Array _spriteList; int _spriteListIndex; + Common::Array _dynamicHotspots; + bool _dynamicHotspotsChanged; + byte *_vocabBuffer; + int _vocabCount; + Common::Array _activeVocabs; + Common::Array _visitedScenes; /** * Constructor */ - Scene(); + Scene(MADSEngine *vm); + + /** + * Destructor + */ + ~Scene(); /** * Initialise the sprite data * @param flag Also reset sprite list */ void clearSprites(bool flag); + + /** + * Delete any sprites used by the player + */ + void releasePlayerSprites(); + + /** + * Delete a sprite entry + */ + void deleteSpriteEntry(int listIndex); + + /** + * Clear the dynamic hotspot list + */ + void clearDynamicHotspots(); + + /** + * Clear the vocabulary list + */ + void clearVocab(); + + /** + * Add a given vocab entry to the active list + */ + void addActiveVocab(int vocabId); + + /** + * Add a scene to the visited scene list if it doesn't already exist + */ + void addVisitedScene(int sceneId); + + /** + * Loads the scene logic for a given scene + */ + void loadScene(); + + /** + * Clear the data for the scene + */ + void free(); }; } // End of namespace MADS -- cgit v1.2.3 From 4c867aa62fea19f2bff7d3aa632b340aae110306 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 24 Feb 2014 00:38:49 -0500 Subject: MADS: Shift some fields and methods to Dialogs and Game classes --- engines/mads/dialogs.cpp | 2 +- engines/mads/dialogs.h | 4 +++- engines/mads/game.cpp | 20 +++++++++++++++++--- engines/mads/game.h | 18 ++++++++++++------ engines/mads/nebular/dialogs_nebular.h | 10 ++++++++++ engines/mads/nebular/game_nebular.cpp | 4 ---- engines/mads/nebular/game_nebular.h | 2 -- engines/mads/scene.cpp | 17 +---------------- engines/mads/scene.h | 11 ----------- 9 files changed, 44 insertions(+), 44 deletions(-) diff --git a/engines/mads/dialogs.cpp b/engines/mads/dialogs.cpp index fd42eb5db0..c865e048da 100644 --- a/engines/mads/dialogs.cpp +++ b/engines/mads/dialogs.cpp @@ -333,7 +333,7 @@ void MessageDialog::show() { Dialogs *Dialogs::init(MADSEngine *vm) { if (vm->getGameID() == GType_RexNebular) - return new Dialogs(vm); + return new Nebular::DialogsNebular(vm); error("Unknown game"); } diff --git a/engines/mads/dialogs.h b/engines/mads/dialogs.h index f77590deee..a915ed3452 100644 --- a/engines/mads/dialogs.h +++ b/engines/mads/dialogs.h @@ -174,7 +174,7 @@ enum DialogId { }; class Dialogs { -private: +protected: MADSEngine *_vm; Dialogs(MADSEngine *vm); @@ -183,6 +183,8 @@ public: public: Common::Point _defaultPosition; DialogId _pendingDialog; + + virtual void showDialog() = 0; }; } // End of namespace MADS diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 14dbcde01f..4e0be59122 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -75,7 +75,7 @@ void Game::run() { _statusFlag = _scene._sectionNum != 1; _vm->_dialogs->_pendingDialog = DIALOG_DIFFICULTY; - showDialog(); + _vm->_dialogs->showDialog(); _vm->_dialogs->_pendingDialog = DIALOG_NONE; _vm->_events->freeCursors(); @@ -138,7 +138,7 @@ void Game::sectionLoop() { _player._stepEnabled = true; _player._visible = true; _vm->_dialogs->_defaultPosition = Common::Point(-1, -1); - _scene.addVisitedScene(_scene._nextSceneId); + addVisitedScene(_scene._nextSceneId); // TODO: main section loop logic goes here @@ -151,7 +151,7 @@ void Game::sectionLoop() { // Check whether to show a dialog if (_vm->_dialogs->_pendingDialog && _player._stepEnabled && !_globalFlags[5]) { _scene.releasePlayerSprites(); - showDialog(); + _vm->_dialogs->showDialog(); _vm->_dialogs->_pendingDialog = DIALOG_NONE; } } @@ -213,6 +213,20 @@ void Game::loadResourceSequence(const Common::String prefix, int v) { warning("TODO: loadResourceSequence"); } +void Game::addVisitedScene(int sceneId) { + if (!visitedScenesExists(sceneId)) + _visitedScenes.push_back(sceneId); +} + +bool Game::visitedScenesExists(int sceneId) { + for (int i = 0; i < _visitedScenes.size(); ++i) { + if (_visitedScenes[i] == sceneId) + return true; + } + + return false; +} + /*------------------------------------------------------------------------*/ void InventoryObject::load(Common::SeekableReadStream &f) { diff --git a/engines/mads/game.h b/engines/mads/game.h index 58b6ff968a..e2b8deede5 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -95,6 +95,16 @@ private: * Inner game loop for executing gameplay within a game section */ void sectionLoop(); + + /** + * Returns true if a given Scene Id exists in the listed of previously visited scenes. + */ + bool visitedScenesExists(int sceneId); + + /** + * Adds a scene Id to the list of previously visited scenes, if it doesn't already exist + */ + void addVisitedScene(int sceneId); protected: MADSEngine *_vm; MSurface *_surface; @@ -107,13 +117,14 @@ protected: int _saveSlot; int _statusFlag; SectionHandler *_sectionHandler; + Common::Array _visitedScenes; + byte *_quotes; int _v1; int _v2; int _v3; int _v4; int _v5; int _v6; - byte *_quotes; /** * Constructor @@ -155,11 +166,6 @@ protected: */ virtual void initialiseGlobals() = 0; - /** - * Show a game dialog - */ - virtual void showDialog() = 0; - /** * Set up the section handler specific to each section */ diff --git a/engines/mads/nebular/dialogs_nebular.h b/engines/mads/nebular/dialogs_nebular.h index 53f377ae0a..d4e4fe921e 100644 --- a/engines/mads/nebular/dialogs_nebular.h +++ b/engines/mads/nebular/dialogs_nebular.h @@ -31,6 +31,16 @@ namespace MADS { namespace Nebular { +class DialogsNebular: public Dialogs { + friend class Dialogs; +protected: + DialogsNebular(MADSEngine *vm): Dialogs(vm) {} +public: + virtual void showDialog() { + warning("TODO: showDialog"); + } +}; + struct HOGANUS { int _bookId; int _pageNum; diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index 2e27eaea0f..6e2b77d477 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -152,10 +152,6 @@ void GameNebular::initialiseGlobals() { loadResourceSequence("ROX", 1); } -void GameNebular::showDialog() { - warning("TODO: showDialog"); -} - void GameNebular::setSectionHandler() { delete _sectionHandler; diff --git a/engines/mads/nebular/game_nebular.h b/engines/mads/nebular/game_nebular.h index 31bd4ae2b2..9232b26969 100644 --- a/engines/mads/nebular/game_nebular.h +++ b/engines/mads/nebular/game_nebular.h @@ -39,8 +39,6 @@ protected: virtual void initialiseGlobals(); - virtual void showDialog(); - virtual void setSectionHandler(); }; diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 46190d12be..406c3cc616 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -34,7 +34,6 @@ Scene::Scene(MADSEngine *vm): _vm(vm) { _priorSceneId = 0; _nextSceneId = 0; _currentSceneId = 0; - _vocabCount = 0; _vocabBuffer = nullptr; _sceneLogic = nullptr; } @@ -81,7 +80,7 @@ void Scene::clearDynamicHotspots() { void Scene::clearVocab() { freeVocab(); - _vocabCount = 0; + _activeVocabs.clear(); } void Scene::freeVocab() { @@ -105,20 +104,6 @@ int Scene::activeVocabIndexOf(int vocabId) { return -1; } -void Scene::addVisitedScene(int sceneId) { - if (!visitedScenesExists(sceneId)) - _visitedScenes.push_back(sceneId); -} - -bool Scene::visitedScenesExists(int sceneId) { - for (int i = 0; i < _visitedScenes.size(); ++i) { - if (_visitedScenes[i] == sceneId) - return true; - } - - return false; -} - void Scene::loadScene() { delete _sceneLogic; diff --git a/engines/mads/scene.h b/engines/mads/scene.h index 9f4f392289..775517b2e6 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -136,10 +136,6 @@ private: */ int activeVocabIndexOf(int vocabId); - /** - * Returns true if a given Scene Id exists in the listed of previously visited scenes. - */ - bool visitedScenesExists(int sceneId); protected: MADSEngine *_vm; public: @@ -157,9 +153,7 @@ public: Common::Array _dynamicHotspots; bool _dynamicHotspotsChanged; byte *_vocabBuffer; - int _vocabCount; Common::Array _activeVocabs; - Common::Array _visitedScenes; /** * Constructor @@ -202,11 +196,6 @@ public: */ void addActiveVocab(int vocabId); - /** - * Add a scene to the visited scene list if it doesn't already exist - */ - void addVisitedScene(int sceneId); - /** * Loads the scene logic for a given scene */ -- cgit v1.2.3 From cc16e42f2029955e066450d63bfb666b9ab47109 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 24 Feb 2014 20:05:35 -0500 Subject: MADS: Beginnings of scene-specific data loading --- engines/mads/game.cpp | 4 +- engines/mads/game.h | 6 +-- engines/mads/mads.cpp | 2 +- engines/mads/mads.h | 2 +- engines/mads/resources.cpp | 54 +++++++++++++++----- engines/mads/resources.h | 12 ++++- engines/mads/scene.cpp | 113 +++++++++++++++++++++++++++++++++++++++++- engines/mads/scene.h | 119 ++++++++++++++++++++++++++++++++++++++++++++- 8 files changed, 289 insertions(+), 23 deletions(-) diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 4e0be59122..bff0e6e73e 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -132,7 +132,7 @@ void Game::sectionLoop() { _quotes = nullptr; _scene.clearVocab(); - _scene.loadScene(); + _scene.loadSceneLogic(); _v4 = 0; _player._stepEnabled = true; @@ -219,7 +219,7 @@ void Game::addVisitedScene(int sceneId) { } bool Game::visitedScenesExists(int sceneId) { - for (int i = 0; i < _visitedScenes.size(); ++i) { + for (uint i = 0; i < _visitedScenes.size(); ++i) { if (_visitedScenes[i] == sceneId) return true; } diff --git a/engines/mads/game.h b/engines/mads/game.h index e2b8deede5..4735615d7a 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -109,9 +109,6 @@ protected: MADSEngine *_vm; MSurface *_surface; Difficulty _difficultyLevel; - Common::Array _globalFlags; - Common::Array _objects; - Common::Array _inventoryList; Player _player; Scene _scene; int _saveSlot; @@ -177,6 +174,9 @@ public: public: int _sectionNumber; int _priorSectionNumber; + Common::Array _globalFlags; + Common::Array _objects; + Common::Array _inventoryList; public: virtual ~Game(); diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index db73ec7d23..f7fe03e2be 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -77,7 +77,7 @@ void MADSEngine::initialise() { MSurface::setVm(this); MSprite::setVm(this); - ResourcesManager::init(this); + Resources::init(this); _debugger = new Debugger(this); _dialogs = Dialogs::init(this); _events = new EventsManager(this); diff --git a/engines/mads/mads.h b/engines/mads/mads.h index b3a05dc56c..44630ca135 100644 --- a/engines/mads/mads.h +++ b/engines/mads/mads.h @@ -94,7 +94,7 @@ public: Font *_font; Game *_game; Palette *_palette; - ResourcesManager *_resources; + Resources *_resources; MSurface *_screen; SoundManager *_sound; UserInterface *_userInterface; diff --git a/engines/mads/resources.cpp b/engines/mads/resources.cpp index fe021fcfd8..9f856eeefc 100644 --- a/engines/mads/resources.cpp +++ b/engines/mads/resources.cpp @@ -88,19 +88,6 @@ public: virtual Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const; }; -void ResourcesManager::init(MADSEngine *vm) { - SearchMan.add("HAG", new HagArchive()); -} - -/*------------------------------------------------------------------------*/ - -void File::openFile(const Common::String &filename) { - if (!Common::File::open(filename)) - error("Could not open file - %s", filename.c_str()); -} - -/*------------------------------------------------------------------------*/ - const char *const MADSCONCAT_STRING = "MADSCONCAT"; HagArchive::HagArchive() { @@ -282,4 +269,45 @@ ResourceType HagArchive::getResourceType(const Common::String &resourceName) con return RESTYPE_NO_EXT; } +/*------------------------------------------------------------------------*/ + +void Resources::init(MADSEngine *vm) { + SearchMan.add("HAG", new HagArchive()); +} + +Common::String Resources::formatName(RESPREFIX resType, int id, const Common::String &ext) { + Common::String result = "*"; + + if (resType == 3 && !id) { + id = id / 100; + } + + if (!ext.empty()) { + switch (resType) { + case RESPREFIX_GL: + result += "GL000"; + break; + case RESPREFIX_SC: + result += Common::String::format("SC%.3d", id); + break; + case RESPREFIX_RM: + result += Common::String::format("RM%.3d", id); + break; + default: + break; + } + + result += ext; + } + + return result; +} + +/*------------------------------------------------------------------------*/ + +void File::openFile(const Common::String &filename) { + if (!Common::File::open(filename)) + error("Could not open file - %s", filename.c_str()); +} + } // End of namespace MADS diff --git a/engines/mads/resources.h b/engines/mads/resources.h index f4b7009e13..033157ed60 100644 --- a/engines/mads/resources.h +++ b/engines/mads/resources.h @@ -31,12 +31,22 @@ namespace MADS { class MADSEngine; -class ResourcesManager { +enum RESPREFIX { + RESPREFIX_GL = 1, RESPREFIX_SC = 2, RESPREFIX_RM = 3 +}; + +enum EXTTYPE { + EXT_SS = 1, EXT_AA = 2, EXT_DAT = 3, EXT_HH = 4, EXT_ART = 5, EXT_INT = 6 +}; + +class Resources { public: /** * Instantiates the resource manager */ static void init(MADSEngine *vm); + + static Common::String formatName(RESPREFIX resType, int id, const Common::String &ext); }; /** diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 406c3cc616..19071d1352 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -36,6 +36,17 @@ Scene::Scene(MADSEngine *vm): _vm(vm) { _currentSceneId = 0; _vocabBuffer = nullptr; _sceneLogic = nullptr; + + _verbList.push_back(VerbInit(VERB_LOOK, 2, 0)); + _verbList.push_back(VerbInit(VERB_TAKE, 2, 0)); + _verbList.push_back(VerbInit(VERB_PUSH, 2, 0)); + _verbList.push_back(VerbInit(VERB_OPEN, 2, 0)); + _verbList.push_back(VerbInit(VERB_PUT, 1, -1)); + _verbList.push_back(VerbInit(VERB_TALKTO, 2, 0)); + _verbList.push_back(VerbInit(VERB_GIVE, 1, 2)); + _verbList.push_back(VerbInit(VERB_PULL, 2, 0)); + _verbList.push_back(VerbInit(VERB_CLOSE, 2, 0)); + _verbList.push_back(VerbInit(VERB_THROW, 1, 2)); } Scene::~Scene() { @@ -104,7 +115,17 @@ int Scene::activeVocabIndexOf(int vocabId) { return -1; } -void Scene::loadScene() { +void Scene::clearSequenceList() { + _sequenceList.clear(); +} + +void Scene::clearMessageList() { + _messageList.clear(); + _talkFont = "*FONTCONV.FF"; + _textSpacing = -1; +} + +void Scene::loadSceneLogic() { delete _sceneLogic; switch (_vm->getGameID()) { @@ -116,6 +137,31 @@ void Scene::loadScene() { } } +void Scene::loadHotspots() { + File f(Resources::formatName(RESPREFIX_RM, _currentSceneId, ".HH")); + int count = f.readUint16LE(); + + _hotspotList.clear(); + for (int i = 0; i < count; ++i) + _hotspotList.push_back(Hotspot(f)); +} + +void Scene::loadVocab() { + // Add all the verbs to the active vocab list + for (uint i = 0; i < _verbList.size(); ++i) + addActiveVocab(_verbList[i]._id); + + // Load the vocabs for any object descriptions and custom actions + for (uint objIndex = 0; objIndex < _vm->_game->_objects.size(); ++objIndex) { + InventoryObject &io = _vm->_game->_objects[objIndex]; + addActiveVocab(io._descId); + + if (io._vocabCount > 0) { + // TODO + } + } +} + void Scene::free() { warning("TODO: Scene::free"); } @@ -160,4 +206,69 @@ DynamicHotspot::DynamicHotspot() { _cursor = 0; } +/*------------------------------------------------------------------------*/ + +SequenceEntry::SequenceEntry() { + _spriteListIndex = 0; + _flipped =0; + _frameIndex = 0; + _frameStart = 0; + _numSprites = 0; + _animType = 0; + _frameInc = 0; + _depth = 0; + _scale = 0; + _dynamicHotspotIndex = -1; + _triggerCountdown = 0; + _doneFlag = 0; + _entries._count = 0; + _abortMode = 0; + _actionNouns[0] = _actionNouns[1] = _actionNouns[2] = 0; + _numTicks = 0; + _extraTicks = 0; + _timeout = 0; +} + +KernelMessage::KernelMessage() { + _flags = 0; + _seqInex = 0; + _asciiChar = '\0'; + _asciiChar2 = '\0'; + _colors = 0; + Common::Point _posiition; + _msgOffset = 0; + _numTicks = 0; + _frameTimer2 = 0; + _frameTimer = 0; + _timeout = 0; + _field1C = 0; + _abortMode = 0; + _nounList[0] = _nounList[1] = _nounList[2] = 0; +} + +/*------------------------------------------------------------------------*/ + +Hotspot::Hotspot() { + _facing = 0; + _articleNumber = 0; + _cursor = 0; + _vocabId = 0; + _verbId = 0; +} + +Hotspot::Hotspot(Common::SeekableReadStream &f) { + _bounds.left = f.readSint16LE(); + _bounds.top = f.readSint16LE(); + _bounds.right = f.readSint16LE(); + _bounds.bottom = f.readSint16LE(); + _feetPos.x = f.readSint16LE(); + _feetPos.y = f.readSint16LE(); + _facing = f.readByte(); + _articleNumber = f.readByte(); + f.skip(1); + _cursor = f.readByte(); + _vocabId = f.readUint16LE(); + _verbId = f.readUint16LE(); +} + } // End of namespace MADS diff --git a/engines/mads/scene.h b/engines/mads/scene.h index 775517b2e6..27bcdb118a 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -30,6 +30,30 @@ namespace MADS { +enum { + VERB_LOOK = 3, + VERB_TAKE = 4, + VERB_PUSH = 5, + VERB_OPEN = 6, + VERB_PUT = 7, + VERB_TALKTO = 8, + VERB_GIVE = 9, + VERB_PULL = 10, + VERB_CLOSE = 11, + VERB_THROW = 12, + VERB_WALKTO = 13 +}; + +class VerbInit { +public: + int _id; + int _action1; + int _action2; + + VerbInit() {} + VerbInit(int id, int action1, int action2): _id(id), _action1(action1), _action2(action2) {} +}; + enum SpriteType { ST_NONE = 0, ST_FOREGROUND = 1, ST_BACKGROUND = -4, ST_FULL_SCREEN_REFRESH = -2, ST_EXPIRED = -1 @@ -77,6 +101,73 @@ public: DynamicHotspot(); }; +class SequenceEntry { +public: + int _spriteListIndex; + int _flipped; + int _frameIndex; + int _frameStart; + int _numSprites; + int _animType; + int _frameInc; + int _depth; + int _scale; + int _dynamicHotspotIndex; + + Common::Point _msgPos; + + int _triggerCountdown; + bool _doneFlag; + struct { + int _count; + int _mode[5]; + int _frameIndex[5]; + int _abortVal[5]; + } _entries; + int _abortMode; + int _actionNouns[3]; + int _numTicks; + int _extraTicks; + int _timeout; + + SequenceEntry(); +}; + +class KernelMessage { +public: + int _flags; + int _seqInex; + char _asciiChar; + char _asciiChar2; + int _colors; + Common::Point _posiition; + int _msgOffset; + int _numTicks; + int _frameTimer2; + int _frameTimer; + int _timeout; + int _field1C; + int _abortMode; + int _nounList[3]; + Common::String _msg; + + KernelMessage(); +}; + +class Hotspot { +public: + Common::Rect _bounds; + Common::Point _feetPos; + int _facing; + int _articleNumber; + int _cursor; + int _vocabId; + int _verbId; + + Hotspot(); + Hotspot(Common::SeekableReadStream &f); +}; + #define SPRITE_COUNT 50 #define TEXT_DISPLAY_COUNT 40 #define DYNAMIC_HOTSPOT_COUNT 8 @@ -146,6 +237,7 @@ public: int _priorSceneId; int _nextSceneId; int _currentSceneId; + Common::Array _verbList; TextDisplay _textDisplay[TEXT_DISPLAY_COUNT]; Common::Array _spriteSlots; Common::Array _spriteList; @@ -154,6 +246,11 @@ public: bool _dynamicHotspotsChanged; byte *_vocabBuffer; Common::Array _activeVocabs; + Common::Array _sequenceList; + Common::Array _messageList; + Common::String _talkFont; + int _textSpacing; + Common::Array _hotspotList; /** * Constructor @@ -196,10 +293,30 @@ public: */ void addActiveVocab(int vocabId); + /** + * Clear the sequence list + */ + void clearSequenceList(); + + /** + * Clear the message list + */ + void clearMessageList(); + /** * Loads the scene logic for a given scene */ - void loadScene(); + void loadSceneLogic(); + + /** + * Loads the hotstpots for the scene + */ + void loadHotspots(); + + /** + * Loads the vocab list + */ + void loadVocab(); /** * Clear the data for the scene -- cgit v1.2.3 From c9057bd6a8ee2b039e2ba528b1e2e59814b8ef88 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 25 Feb 2014 09:21:19 -0500 Subject: MADS: Moved scene data classes into their own code file --- engines/mads/events.cpp | 1 + engines/mads/game.cpp | 100 +++++++++------ engines/mads/game.h | 7 ++ engines/mads/module.mk | 1 + engines/mads/nebular/game_nebular.cpp | 5 +- engines/mads/nebular/game_nebular.h | 2 +- engines/mads/palette.cpp | 4 + engines/mads/palette.h | 5 + engines/mads/scene.cpp | 35 +++++- engines/mads/scene.h | 201 ++---------------------------- engines/mads/scene_data.cpp | 133 ++++++++++++++++++++ engines/mads/scene_data.h | 227 ++++++++++++++++++++++++++++++++++ 12 files changed, 490 insertions(+), 231 deletions(-) create mode 100644 engines/mads/scene_data.cpp create mode 100644 engines/mads/scene_data.h diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp index 23d2e72eeb..8f177f2c20 100644 --- a/engines/mads/events.cpp +++ b/engines/mads/events.cpp @@ -46,6 +46,7 @@ EventsManager::~EventsManager() { } void EventsManager::loadCursors(const Common::String &spritesName) { + delete _cursorSprites; _cursorSprites = new SpriteAsset(_vm, spritesName, 0x4000); } diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index bff0e6e73e..9b60302c7c 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -43,9 +43,14 @@ Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _scene(vm) { _saveSlot = -1; _statusFlag = 0; _sectionHandler = nullptr; + _sectionNumber = 1; + _priorSectionNumber = 0; + _currentSectionNumber = -1; _v1 = _v2 = 0; _v3 = _v4 = 0; _v5 = _v6 = 0; + _aaName = "*I0.AA"; + _playerSpritesFlag = false; } Game::~Game() { @@ -54,6 +59,7 @@ Game::~Game() { } void Game::run() { + _statusFlag = true; int protectionResult = checkCopyProtection(); switch (protectionResult) { case 1: @@ -71,17 +77,16 @@ void Game::run() { } if (_saveSlot == -1 && protectionResult != -1 && protectionResult != -2) { - initSection(_scene._sectionNum); - _statusFlag = _scene._sectionNum != 1; - _vm->_dialogs->_pendingDialog = DIALOG_DIFFICULTY; + initSection(_sectionNumber); + _statusFlag = true; + _vm->_dialogs->_pendingDialog = DIALOG_DIFFICULTY; _vm->_dialogs->showDialog(); _vm->_dialogs->_pendingDialog = DIALOG_NONE; - _vm->_events->freeCursors(); - _scene._priorSectionNum = 0; + _priorSectionNumber = 0; + _priorSectionNumber = -1; _scene._priorSceneId = 0; - _scene._sectionNumPrior = -1; _scene._currentSceneId = -1; } @@ -102,12 +107,12 @@ void Game::gameLoop() { while (!_vm->shouldQuit() && _statusFlag) { setSectionHandler(); _sectionHandler->preLoadSection(); - initSection(_scene._sectionNum); + initSection(_sectionNumber); _sectionHandler->postLoadSection(); _scene.clearSprites(true); - if (_scene._sectionNum == _scene._sectionNumPrior) { + if (_sectionNumber == _currentSectionNumber) { sectionLoop(); } @@ -121,49 +126,72 @@ void Game::gameLoop() { } void Game::sectionLoop() { - while (!_vm->shouldQuit() && _statusFlag && _scene._sectionNum == _scene._sectionNumPrior) { + while (!_vm->shouldQuit() && _statusFlag && _sectionNumber == _currentSectionNumber) { + _v1 = 3; + _player._spritesChanged = true; + _v5 = 0; + _v6 = 0; + _vm->_events->resetCursor(); - if (_vm->_dialogs->_pendingDialog && _player._stepEnabled && !_globalFlags[5]) { - _v1 = 3; - _player._spritesChanged = true; - _v5 = 0; - _v6 = 0; - _vm->_events->resetCursor(); + _quotes = nullptr; + _scene.clearVocab(); + _scene.loadSceneLogic(); - _quotes = nullptr; - _scene.clearVocab(); - _scene.loadSceneLogic(); + _v4 = 0; + _player._stepEnabled = true; + _player._visible = true; + _vm->_dialogs->_defaultPosition = Common::Point(-1, -1); + addVisitedScene(_scene._nextSceneId); - _v4 = 0; - _player._stepEnabled = true; - _player._visible = true; - _vm->_dialogs->_defaultPosition = Common::Point(-1, -1); - addVisitedScene(_scene._nextSceneId); + _scene._screenObjects._v8333C = -1; + _scene._screenObjects._v832EC = 0; + _scene._screenObjects._yp = 0; + _v3 = -1; - // TODO: main section loop logic goes here + _scene._sceneLogic->setup(); + if (_player._spritesChanged || _v3) { + if (_player._spritesLoaded) + _scene.releasePlayerSprites(); + _vm->_palette->resetGamePalette(18, 10); + _scene.clearSprites(true); + } else { + _vm->_palette->initGamePalette(); + } - // Clear the scene - _scene.free(); - _scene._sectionNum = _scene._nextSceneId / 100; + // TODO: Further palette init + + //_scene.loadScene(_aaName, _scene._nextSceneId, 0); + _vm->_sound->queueNewCommands(); + if (!_player._spritesLoaded) { + _player.loadSprites(""); + _playerSpritesFlag = false; + } - // TODO: sub_1DD46(3) - // Check whether to show a dialog - if (_vm->_dialogs->_pendingDialog && _player._stepEnabled && !_globalFlags[5]) { - _scene.releasePlayerSprites(); - _vm->_dialogs->showDialog(); - _vm->_dialogs->_pendingDialog = DIALOG_NONE; - } + // TODO: main section loop logic goes here + + // Clear the scene + _scene.free(); + _sectionNumber = _scene._nextSceneId / 100; + + // TODO: sub_1DD46(3) + + // Check whether to show a dialog + if (_vm->_dialogs->_pendingDialog && _player._stepEnabled && !_globalFlags[5]) { + _scene.releasePlayerSprites(); + _vm->_dialogs->showDialog(); + _vm->_dialogs->_pendingDialog = DIALOG_NONE; } } } void Game::initSection(int sectionNumber) { - _priorSectionNumber = _sectionNumber; - _sectionNumber = sectionNumber; + _priorSectionNumber = _currentSectionNumber; + _currentSectionNumber = sectionNumber; _vm->_palette->resetGamePalette(18, 10); _vm->_palette->setLowRange(); + _vm->_events->loadCursors("*CURSOR.SS"); assert(_vm->_events->_cursorSprites); _vm->_events->setCursor2((_vm->_events->_cursorSprites->getCount() <= 1) ? diff --git a/engines/mads/game.h b/engines/mads/game.h index 4735615d7a..fbac20ce1f 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -70,6 +70,10 @@ public: bool _visible; public: Player(); + + void loadSprites(const Common::String &prefix) { + warning("TODO: Player::loadSprites"); + } }; class SectionHandler { @@ -122,6 +126,8 @@ protected: int _v4; int _v5; int _v6; + Common::String _aaName; + bool _playerSpritesFlag; /** * Constructor @@ -174,6 +180,7 @@ public: public: int _sectionNumber; int _priorSectionNumber; + int _currentSectionNumber; Common::Array _globalFlags; Common::Array _objects; Common::Array _inventoryList; diff --git a/engines/mads/module.mk b/engines/mads/module.mk index a729533bcc..09adc9c5bc 100644 --- a/engines/mads/module.mk +++ b/engines/mads/module.mk @@ -21,6 +21,7 @@ MODULE_OBJS := \ palette.o \ resources.o \ scene.o \ + scene_data.o \ sound.o \ user_interface.o diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index 6e2b77d477..34fe0c7d19 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -155,7 +155,7 @@ void GameNebular::initialiseGlobals() { void GameNebular::setSectionHandler() { delete _sectionHandler; - switch (_scene._sectionNum) { + switch (_sectionNumber) { case 1: _sectionHandler = new Section1Handler(_vm); break; @@ -177,6 +177,9 @@ void GameNebular::setSectionHandler() { case 7: _sectionHandler = new Section7Handler(_vm); break; + case 8: + _sectionHandler = new Section8Handler(_vm); + break; default: break; } diff --git a/engines/mads/nebular/game_nebular.h b/engines/mads/nebular/game_nebular.h index 9232b26969..6395ba0e4e 100644 --- a/engines/mads/nebular/game_nebular.h +++ b/engines/mads/nebular/game_nebular.h @@ -60,7 +60,7 @@ typedef Section1Handler Section4Handler; typedef Section1Handler Section5Handler; typedef Section1Handler Section6Handler; typedef Section1Handler Section7Handler; - +typedef Section1Handler Section8Handler; } // End of namespace Nebular diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index 5438c782aa..7c51842ae2 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -283,6 +283,10 @@ void Palette::resetGamePalette(int lowRange, int highRange) { } } +void Palette::initGamePalette() { + // TODO +} + void Palette::initRange(byte *palette) { int var6 = 0; int vdx = 0; diff --git a/engines/mads/palette.h b/engines/mads/palette.h index 14cebc7092..d0d7007586 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -174,6 +174,11 @@ public: */ void resetGamePalette(int v1, int v2); + /** + * Initialises game palette + */ + void initGamePalette(); + /** * Set the first four palette entries with preset values */ diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 19071d1352..09e965bac3 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -28,9 +28,6 @@ namespace MADS { Scene::Scene(MADSEngine *vm): _vm(vm) { - _sectionNum = 1; - _sectionNumPrior = -1; - _priorSectionNum = 0; _priorSceneId = 0; _nextSceneId = 0; _currentSceneId = 0; @@ -47,6 +44,7 @@ Scene::Scene(MADSEngine *vm): _vm(vm) { _verbList.push_back(VerbInit(VERB_PULL, 2, 0)); _verbList.push_back(VerbInit(VERB_CLOSE, 2, 0)); _verbList.push_back(VerbInit(VERB_THROW, 1, 2)); + Common::fill((byte *)&_nullPalette[0], (byte *)&_nullPalette[3], 0); } Scene::~Scene() { @@ -156,16 +154,43 @@ void Scene::loadVocab() { InventoryObject &io = _vm->_game->_objects[objIndex]; addActiveVocab(io._descId); - if (io._vocabCount > 0) { - // TODO + for (int vocabIndex = 0; vocabIndex _hotspotList; + ScreenObjects _screenObjects; + RGB4 *_scenePalette; + RGB4 _nullPalette[2]; /** * Constructor @@ -317,6 +137,11 @@ public: * Loads the vocab list */ void loadVocab(); + + /** + * Set the scene palette + */ + void setPalette(RGB4 *p); /** * Clear the data for the scene diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp new file mode 100644 index 0000000000..6821395004 --- /dev/null +++ b/engines/mads/scene_data.cpp @@ -0,0 +1,133 @@ +/* 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 "common/scummsys.h" +#include "mads/scene.h" +#include "mads/mads.h" +#include "mads/nebular/nebular_scenes.h" + +namespace MADS { + +SpriteSlot::SpriteSlot() { + _spriteType = ST_NONE; + _seqIndex = 0; + _spriteListIndex = 0; + _frameNumber = 0; + _depth = 0; + _scale = 0; +} + +SpriteSlot::SpriteSlot(SpriteType type, int seqIndex) { + _spriteType = type; + _seqIndex = seqIndex; + _spriteListIndex = 0; + _frameNumber = 0; + _depth = 0; + _scale = 0; +} + +/*------------------------------------------------------------------------*/ + +TextDisplay::TextDisplay() { + _active = false; + _spacing = 0; + _expire = 0; + _col1 = _col2 = 0; +} + +/*------------------------------------------------------------------------*/ + +DynamicHotspot::DynamicHotspot() { + _seqIndex = 0; + _facing = 0; + _descId = 0; + _field14 = 0; + _articleNumber = 0; + _cursor = 0; +} + +/*------------------------------------------------------------------------*/ + +SequenceEntry::SequenceEntry() { + _spriteListIndex = 0; + _flipped =0; + _frameIndex = 0; + _frameStart = 0; + _numSprites = 0; + _animType = 0; + _frameInc = 0; + _depth = 0; + _scale = 0; + _dynamicHotspotIndex = -1; + _triggerCountdown = 0; + _doneFlag = 0; + _entries._count = 0; + _abortMode = 0; + _actionNouns[0] = _actionNouns[1] = _actionNouns[2] = 0; + _numTicks = 0; + _extraTicks = 0; + _timeout = 0; +} + +KernelMessage::KernelMessage() { + _flags = 0; + _seqInex = 0; + _asciiChar = '\0'; + _asciiChar2 = '\0'; + _colors = 0; + Common::Point _posiition; + _msgOffset = 0; + _numTicks = 0; + _frameTimer2 = 0; + _frameTimer = 0; + _timeout = 0; + _field1C = 0; + _abortMode = 0; + _nounList[0] = _nounList[1] = _nounList[2] = 0; +} + +/*------------------------------------------------------------------------*/ + +Hotspot::Hotspot() { + _facing = 0; + _articleNumber = 0; + _cursor = 0; + _vocabId = 0; + _verbId = 0; +} + +Hotspot::Hotspot(Common::SeekableReadStream &f) { + _bounds.left = f.readSint16LE(); + _bounds.top = f.readSint16LE(); + _bounds.right = f.readSint16LE(); + _bounds.bottom = f.readSint16LE(); + _feetPos.x = f.readSint16LE(); + _feetPos.y = f.readSint16LE(); + _facing = f.readByte(); + _articleNumber = f.readByte(); + f.skip(1); + _cursor = f.readByte(); + _vocabId = f.readUint16LE(); + _verbId = f.readUint16LE(); +} + +} // End of namespace MADS diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h new file mode 100644 index 0000000000..a4950dbc0a --- /dev/null +++ b/engines/mads/scene_data.h @@ -0,0 +1,227 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_SCENE_DATA_H +#define MADS_SCENE_DATA_H + +#include "common/scummsys.h" +#include "common/array.h" +#include "common/rect.h" +#include "mads/assets.h" + +namespace MADS { + +enum { + VERB_LOOK = 3, + VERB_TAKE = 4, + VERB_PUSH = 5, + VERB_OPEN = 6, + VERB_PUT = 7, + VERB_TALKTO = 8, + VERB_GIVE = 9, + VERB_PULL = 10, + VERB_CLOSE = 11, + VERB_THROW = 12, + VERB_WALKTO = 13 +}; + +class VerbInit { +public: + int _id; + int _action1; + int _action2; + + VerbInit() {} + VerbInit(int id, int action1, int action2): _id(id), _action1(action1), _action2(action2) {} +}; + +class ScreenObjects { +public: + int _v8333C; + int _v832EC; + int _yp; +}; + +enum SpriteType { + ST_NONE = 0, ST_FOREGROUND = 1, ST_BACKGROUND = -4, + ST_FULL_SCREEN_REFRESH = -2, ST_EXPIRED = -1 +}; + +class SpriteSlot { +public: + SpriteType _spriteType; + int _seqIndex; + int _spriteListIndex; + int _frameNumber; + Common::Point _position; + int _depth; + int _scale; +public: + SpriteSlot(); + SpriteSlot(SpriteType type, int seqIndex); +}; + +class TextDisplay { +public: + bool _active; + int _spacing; + Common::Rect _bounds; + int _expire; + int _col1; + int _col2; + Common::String _fontName; + Common::String _msg; + + TextDisplay(); +}; + +class DynamicHotspot { +public: + int _seqIndex; + Common::Rect _bounds; + Common::Point _feetPos; + int _facing; + int _descId; + int _field14; + int _articleNumber; + int _cursor; + + DynamicHotspot(); +}; + +class SequenceEntry { +public: + int _spriteListIndex; + int _flipped; + int _frameIndex; + int _frameStart; + int _numSprites; + int _animType; + int _frameInc; + int _depth; + int _scale; + int _dynamicHotspotIndex; + + Common::Point _msgPos; + + int _triggerCountdown; + bool _doneFlag; + struct { + int _count; + int _mode[5]; + int _frameIndex[5]; + int _abortVal[5]; + } _entries; + int _abortMode; + int _actionNouns[3]; + int _numTicks; + int _extraTicks; + int _timeout; + + SequenceEntry(); +}; + +class KernelMessage { +public: + int _flags; + int _seqInex; + char _asciiChar; + char _asciiChar2; + int _colors; + Common::Point _posiition; + int _msgOffset; + int _numTicks; + int _frameTimer2; + int _frameTimer; + int _timeout; + int _field1C; + int _abortMode; + int _nounList[3]; + Common::String _msg; + + KernelMessage(); +}; + +class Hotspot { +public: + Common::Rect _bounds; + Common::Point _feetPos; + int _facing; + int _articleNumber; + int _cursor; + int _vocabId; + int _verbId; + + Hotspot(); + Hotspot(Common::SeekableReadStream &f); +}; + +#define SPRITE_COUNT 50 +#define TEXT_DISPLAY_COUNT 40 +#define DYNAMIC_HOTSPOT_COUNT 8 + +class MADSEngine; +class Scene; + +class SceneLogic { +protected: + Scene *_scene; +public: + /** + * Constructor + */ + SceneLogic(Scene *scene): _scene(scene) {} + + /** + * Called to initially setup a scene + */ + virtual void setup() = 0; + + /** + * Called as the scene is entered (made active) + */ + virtual void enter() = 0; + + /** + * Called one per frame + */ + virtual void step() = 0; + + /** + * Called before an action is started + */ + virtual void preActions() = 0; + + /** + * Handles scene actions + */ + virtual void actions() = 0; + + /** + * Post-action handling + */ + virtual void postActions() = 0; +}; + +} // End of namespace MADS + +#endif /* MADS_SCENE_DATA_H */ -- cgit v1.2.3 From 9eaab29afedf9eceee50f882b64cb39a14e616a2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 25 Feb 2014 19:52:35 -0500 Subject: MADS: Starting to refactor some Scene array fields as separate classes --- engines/mads/game.cpp | 102 +++-------------------- engines/mads/game.h | 83 +----------------- engines/mads/game_data.cpp | 116 ++++++++++++++++++++++++++ engines/mads/game_data.h | 126 ++++++++++++++++++++++++++++ engines/mads/module.mk | 1 + engines/mads/nebular/game_nebular.cpp | 12 +-- engines/mads/scene.cpp | 153 ++++------------------------------ engines/mads/scene.h | 34 ++++---- engines/mads/scene_data.cpp | 39 ++++++++- engines/mads/scene_data.h | 38 +++++++-- engines/mads/sound.cpp | 2 +- engines/mads/sound.h | 2 +- 12 files changed, 359 insertions(+), 349 deletions(-) create mode 100644 engines/mads/game_data.cpp create mode 100644 engines/mads/game_data.h diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 9b60302c7c..2a45c3ee90 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -23,6 +23,7 @@ #include "common/scummsys.h" #include "mads/mads.h" #include "mads/game.h" +#include "mads/game_data.h" #include "mads/nebular/game_nebular.h" #include "mads/graphics.h" #include "mads/msurface.h" @@ -37,7 +38,8 @@ Game *Game::init(MADSEngine *vm) { return nullptr; } -Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _scene(vm) { +Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), + _objects(vm), _scene(vm) { _sectionNumber = _priorSectionNumber = 0; _difficultyLevel = DIFFICULTY_HARD; _saveSlot = -1; @@ -110,7 +112,7 @@ void Game::gameLoop() { initSection(_sectionNumber); _sectionHandler->postLoadSection(); - _scene.clearSprites(true); + _scene._spriteSlots.clear(true); if (_sectionNumber == _currentSectionNumber) { sectionLoop(); @@ -141,7 +143,7 @@ void Game::sectionLoop() { _player._stepEnabled = true; _player._visible = true; _vm->_dialogs->_defaultPosition = Common::Point(-1, -1); - addVisitedScene(_scene._nextSceneId); + _visitedScenes.add(_scene._nextSceneId); _scene._screenObjects._v8333C = -1; _scene._screenObjects._v832EC = 0; @@ -151,17 +153,18 @@ void Game::sectionLoop() { _scene._sceneLogic->setup(); if (_player._spritesChanged || _v3) { if (_player._spritesLoaded) - _scene.releasePlayerSprites(); + _scene._spriteSlots.releasePlayerSprites(); _vm->_palette->resetGamePalette(18, 10); - _scene.clearSprites(true); + _scene._spriteSlots.clear(true); } else { _vm->_palette->initGamePalette(); } // TODO: Further palette init - //_scene.loadScene(_aaName, _scene._nextSceneId, 0); - _vm->_sound->queueNewCommands(); + _scene.loadScene(_scene._nextSceneId, _aaName, 0); + _vm->_sound->pauseNewCommands(); + if (!_player._spritesLoaded) { _player.loadSprites(""); _playerSpritesFlag = false; @@ -178,7 +181,7 @@ void Game::sectionLoop() { // Check whether to show a dialog if (_vm->_dialogs->_pendingDialog && _player._stepEnabled && !_globalFlags[5]) { - _scene.releasePlayerSprites(); + _scene._spriteSlots.releasePlayerSprites(); _vm->_dialogs->showDialog(); _vm->_dialogs->_pendingDialog = DIALOG_NONE; } @@ -198,91 +201,8 @@ void Game::initSection(int sectionNumber) { CURSOR_ARROW : CURSOR_WAIT); } -void Game::loadObjects() { - File f("*OBJECTS.DAT"); - - // Get the total numer of inventory objects - int count = f.readUint16LE(); - _objects.reserve(count); - - // Read in each object - for (int i = 0; i < count; ++i) { - InventoryObject obj; - obj.load(f); - _objects.push_back(obj); - - // If it's for the player's inventory, add the index to the inventory list - if (obj._roomNumber == PLAYER_INVENTORY) { - _inventoryList.push_back(i); - assert(_inventoryList.size() <= 32); - } - } -} - -void Game::setObjectData(int objIndex, int id, const byte *p) { - // TODO: This whole method seems weird. Check it out more thoroughly once - // more of the engine is implemented - for (int i = 0; i < (int)_objects.size(); ++i) { - InventoryObject &obj = _objects[i]; - if (obj._vocabList[0]._actionFlags1 <= i) - break; - - if (obj._mutilateString[6 + i] == id) { - _objects[objIndex]._objFolder = p; - } - } -} - -void Game::setObjectRoom(int objectId, int roomNumber) { - warning("TODO: setObjectRoom"); -} - void Game::loadResourceSequence(const Common::String prefix, int v) { warning("TODO: loadResourceSequence"); } -void Game::addVisitedScene(int sceneId) { - if (!visitedScenesExists(sceneId)) - _visitedScenes.push_back(sceneId); -} - -bool Game::visitedScenesExists(int sceneId) { - for (uint i = 0; i < _visitedScenes.size(); ++i) { - if (_visitedScenes[i] == sceneId) - return true; - } - - return false; -} - -/*------------------------------------------------------------------------*/ - -void InventoryObject::load(Common::SeekableReadStream &f) { - _descId = f.readUint16LE(); - _roomNumber = f.readUint16LE(); - _article = f.readByte(); - _vocabCount = f.readByte(); - - for (int i = 0; i < 3; ++i) { - _vocabList[i]._actionFlags1 = f.readByte(); - _vocabList[i]._actionFlags2 = f.readByte(); - _vocabList[i]._vocabId = f.readByte(); - } - - f.skip(4); // field12 - f.read(&_mutilateString[0], 10); - f.skip(16); -} - -/*------------------------------------------------------------------------*/ - -Player::Player() { - _direction = 8; - _newDirection = 8; - _spritesLoaded = false; - _spriteListStart = _numSprites = 0; - _stepEnabled = false; - _visible = false; -} - } // End of namespace MADS diff --git a/engines/mads/game.h b/engines/mads/game.h index fbac20ce1f..4797908b1a 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -25,6 +25,7 @@ #include "common/scummsys.h" #include "mads/scene.h" +#include "mads/game_data.h" namespace MADS { @@ -38,56 +39,6 @@ enum Difficulty { DIFFICULTY_HARD = 1, DIFFICULTY_MEDIUM = 2, DIFFICULTY_EASY = 3 }; -class InventoryObject { -public: - int _descId; - int _roomNumber; - int _article; - int _vocabCount; - struct { - int _actionFlags1; - int _actionFlags2; - int _vocabId; - } _vocabList[3]; - char _mutilateString[10]; // ??? - const byte *_objFolder; // ??? - - /** - * Loads the data for a given object - */ - void load(Common::SeekableReadStream &f); -}; - -class Player { -public: - int _direction; - int _newDirection; - bool _spritesLoaded; - int _spriteListStart; - int _numSprites; - bool _stepEnabled; - bool _spritesChanged; - bool _visible; -public: - Player(); - - void loadSprites(const Common::String &prefix) { - warning("TODO: Player::loadSprites"); - } -}; - -class SectionHandler { -protected: - MADSEngine *_vm; -public: - SectionHandler(MADSEngine *vm): _vm(vm) {} - virtual ~SectionHandler() {} - - virtual void preLoadSection() = 0; - virtual void sectionPtr2() = 0; - virtual void postLoadSection() = 0; -}; - class Game { private: /** @@ -99,26 +50,15 @@ private: * Inner game loop for executing gameplay within a game section */ void sectionLoop(); - - /** - * Returns true if a given Scene Id exists in the listed of previously visited scenes. - */ - bool visitedScenesExists(int sceneId); - - /** - * Adds a scene Id to the list of previously visited scenes, if it doesn't already exist - */ - void addVisitedScene(int sceneId); protected: MADSEngine *_vm; MSurface *_surface; Difficulty _difficultyLevel; Player _player; - Scene _scene; int _saveSlot; int _statusFlag; SectionHandler *_sectionHandler; - Common::Array _visitedScenes; + VisitedScenes _visitedScenes; byte *_quotes; int _v1; int _v2; @@ -134,21 +74,6 @@ protected: */ Game(MADSEngine *vm); - /** - * Loads the game's object list - */ - void loadObjects(); - - /** - * Set the associated data? pointer with an inventory object - */ - void setObjectData(int objIndex, int id, const byte *p); - - /** - * Sets the room number - */ - void setObjectRoom(int objectId, int roomNumber); - /** * Initialises the current section number of the game */ @@ -182,8 +107,8 @@ public: int _priorSectionNumber; int _currentSectionNumber; Common::Array _globalFlags; - Common::Array _objects; - Common::Array _inventoryList; + InventoryObjects _objects; + Scene _scene; public: virtual ~Game(); diff --git a/engines/mads/game_data.cpp b/engines/mads/game_data.cpp new file mode 100644 index 0000000000..df4a902c25 --- /dev/null +++ b/engines/mads/game_data.cpp @@ -0,0 +1,116 @@ +/* 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 "common/scummsys.h" +#include "mads/mads.h" +#include "mads/game.h" +#include "mads/nebular/game_nebular.h" +#include "mads/graphics.h" +#include "mads/msurface.h" +#include "mads/resources.h" + +namespace MADS { + +void VisitedScenes::add(int sceneId) { + if (!exists(sceneId)) + push_back(sceneId); +} + +bool VisitedScenes::exists(int sceneId) { + for (uint i = 0; i < size(); ++i) { + if ((*this)[i] == sceneId) + return true; + } + + return false; +} + +void InventoryObject::load(Common::SeekableReadStream &f) { + _descId = f.readUint16LE(); + _roomNumber = f.readUint16LE(); + _article = f.readByte(); + _vocabCount = f.readByte(); + + for (int i = 0; i < 3; ++i) { + _vocabList[i]._actionFlags1 = f.readByte(); + _vocabList[i]._actionFlags2 = f.readByte(); + _vocabList[i]._vocabId = f.readByte(); + } + + f.skip(4); // field12 + f.read(&_mutilateString[0], 10); + f.skip(16); +} + +/*------------------------------------------------------------------------*/ + +void InventoryObjects::load() { + File f("*OBJECTS.DAT"); + + // Get the total numer of inventory objects + int count = f.readUint16LE(); + reserve(count); + + // Read in each object + for (int i = 0; i < count; ++i) { + InventoryObject obj; + obj.load(f); + push_back(obj); + + // If it's for the player's inventory, add the index to the inventory list + if (obj._roomNumber == PLAYER_INVENTORY) { + _inventoryList.push_back(i); + assert(_inventoryList.size() <= 32); + } + } +} + +void InventoryObjects::setData(int objIndex, int id, const byte *p) { + // TODO: This whole method seems weird. Check it out more thoroughly once + // more of the engine is implemented + for (int i = 0; i < (int)size(); ++i) { + InventoryObject &obj = (*this)[i]; + if (obj._vocabList[0]._actionFlags1 <= i) + break; + + if (obj._mutilateString[6 + i] == id) { + (*this)[objIndex]._objFolder = p; + } + } +} + +void InventoryObjects::setRoom(int objectId, int roomNumber) { + warning("TODO: setObjectRoom"); +} + +/*------------------------------------------------------------------------*/ + +Player::Player() { + _direction = 8; + _newDirection = 8; + _spritesLoaded = false; + _spritesStart = _numSprites = 0; + _stepEnabled = false; + _visible = false; +} + +} // End of namespace MADS diff --git a/engines/mads/game_data.h b/engines/mads/game_data.h new file mode 100644 index 0000000000..2d2badd38b --- /dev/null +++ b/engines/mads/game_data.h @@ -0,0 +1,126 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_GAME_DATA_H +#define MADS_GAME_DATA_H + +#include "common/scummsys.h" +#include "common/array.h" + +namespace MADS { + +class MADSEngine; +class Game; + +class VisitedScenes: public Common::Array { +public: + /** + * Returns true if a given Scene Id exists in the listed of previously visited scenes. + */ + bool exists(int sceneId); + + /** + * Adds a scene Id to the list of previously visited scenes, if it doesn't already exist + */ + void add(int sceneId); +}; + +class InventoryObject { +public: + int _descId; + int _roomNumber; + int _article; + int _vocabCount; + struct { + int _actionFlags1; + int _actionFlags2; + int _vocabId; + } _vocabList[3]; + char _mutilateString[10]; // ??? + const byte *_objFolder; // ??? + + /** + * Loads the data for a given object + */ + void load(Common::SeekableReadStream &f); +}; + +class InventoryObjects: public Common::Array { +private: + MADSEngine *_vm; +public: + Common::Array _inventoryList; + + /** + * Constructor + */ + InventoryObjects(MADSEngine *vm): _vm(vm) {} + + /** + * Loads the game's object list + */ + void load(); + + /** + * Set the associated data? pointer with an inventory object + */ + void setData(int objIndex, int id, const byte *p); + + /** + * Sets the room number + */ + void setRoom(int objectId, int roomNumber); +}; + +class Player { +public: + int _direction; + int _newDirection; + bool _spritesLoaded; + int _spritesStart; + int _numSprites; + bool _stepEnabled; + bool _spritesChanged; + bool _visible; +public: + Player(); + + void loadSprites(const Common::String &prefix) { + warning("TODO: Player::loadSprites"); + } +}; + +class SectionHandler { +protected: + MADSEngine *_vm; +public: + SectionHandler(MADSEngine *vm): _vm(vm) {} + virtual ~SectionHandler() {} + + virtual void preLoadSection() = 0; + virtual void sectionPtr2() = 0; + virtual void postLoadSection() = 0; +}; + +} // End of namespace MADS + +#endif /* MADS_GAME_DATA_H */ diff --git a/engines/mads/module.mk b/engines/mads/module.mk index 09adc9c5bc..62441ab3c9 100644 --- a/engines/mads/module.mk +++ b/engines/mads/module.mk @@ -14,6 +14,7 @@ MODULE_OBJS := \ events.o \ font.o \ game.o \ + game_data.o \ graphics.o \ mads.o \ msprite.o \ diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index 34fe0c7d19..e777ff8def 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -68,7 +68,7 @@ void GameNebular::initialiseGlobals() { _globalFlags[21] = 0xFFFF; _globalFlags[95] = 0xFFFF; - setObjectData(3, 17, nullptr); + _objects.setData(3, 17, nullptr); // Put the values 0 through 3 in a random order in global slots 83 to 86 for (int i = 0; i < 4;) { @@ -125,21 +125,21 @@ void GameNebular::initialiseGlobals() { switch (_difficultyLevel) { case DIFFICULTY_HARD: _globalFlags[35] = 0; - setObjectRoom(9, 1); - setObjectRoom(50, 1); + _objects.setRoom(9, 1); + _objects.setRoom(50, 1); _globalFlags[137] = 5; _globalFlags[136] = 0; break; case DIFFICULTY_MEDIUM: _globalFlags[35] = 0; - setObjectRoom(8, 1); + _objects.setRoom(8, 1); _globalFlags[137] = 0xFFFF; _globalFlags[136] = 6; break; case DIFFICULTY_EASY: _globalFlags[35] = 2; - setObjectRoom(8, 1); - setObjectRoom(27, 1); + _objects.setRoom(8, 1); + _objects.setRoom(27, 1); break; default: break; diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 09e965bac3..7bbb4e98ae 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -27,7 +27,7 @@ namespace MADS { -Scene::Scene(MADSEngine *vm): _vm(vm) { +Scene::Scene(MADSEngine *vm): _vm(vm), _spriteSlots(vm) { _priorSceneId = 0; _nextSceneId = 0; _currentSceneId = 0; @@ -52,36 +52,6 @@ Scene::~Scene() { delete _sceneLogic; } -void Scene::clearSprites(bool flag) { - for (int i = 0; i < TEXT_DISPLAY_COUNT; ++i) - _textDisplay[i]._active = false; - - if (flag) - _spriteList.clear(); - - _spriteSlots.clear(); - _spriteSlots.push_back(SpriteSlot(ST_FULL_SCREEN_REFRESH, -1)); -} - -/** - * Releases any sprites used by the player - */ -void Scene::releasePlayerSprites() { - Player &player = _vm->_game->player(); - - if (player._spritesLoaded && player._numSprites > 0) { - int spriteEnd = player._spriteListStart + player._numSprites - 1; - do { - deleteSpriteEntry(spriteEnd); - } while (--spriteEnd >= player._spriteListStart); - } -} - -void Scene::deleteSpriteEntry(int listIndex) { - delete _spriteList[listIndex]; - _spriteList.remove_at(listIndex); -} - void Scene::clearDynamicHotspots() { _dynamicHotspots.clear(); _dynamicHotspotsChanged = false; @@ -135,6 +105,18 @@ void Scene::loadSceneLogic() { } } +void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) { + // Store the previously active scene number and set the new one + _priorSceneId = _currentSceneId; + _currentSceneId = sceneId; + + _v1 = 0; + if (palFlag) + _vm->_palette->resetGamePalette(18, 10); + + +} + void Scene::loadHotspots() { File f(Resources::formatName(RESPREFIX_RM, _currentSceneId, ".HH")); int count = f.readUint16LE(); @@ -177,9 +159,9 @@ void Scene::loadVocabStrings() { f.read(d, f.size()); - int vocabId = 1; +// int vocabId = 1; for (uint strIndex = 0; strIndex < _activeVocabs.size(); ++strIndex) { - + // TODO: Rest of this method } } @@ -191,109 +173,4 @@ void Scene::setPalette(RGB4 *p) { _scenePalette = p; } -/*------------------------------------------------------------------------*/ - -SpriteSlot::SpriteSlot() { - _spriteType = ST_NONE; - _seqIndex = 0; - _spriteListIndex = 0; - _frameNumber = 0; - _depth = 0; - _scale = 0; -} - -SpriteSlot::SpriteSlot(SpriteType type, int seqIndex) { - _spriteType = type; - _seqIndex = seqIndex; - _spriteListIndex = 0; - _frameNumber = 0; - _depth = 0; - _scale = 0; -} - -/*------------------------------------------------------------------------*/ - -TextDisplay::TextDisplay() { - _active = false; - _spacing = 0; - _expire = 0; - _col1 = _col2 = 0; -} - -/*------------------------------------------------------------------------*/ - -DynamicHotspot::DynamicHotspot() { - _seqIndex = 0; - _facing = 0; - _descId = 0; - _field14 = 0; - _articleNumber = 0; - _cursor = 0; -} - -/*------------------------------------------------------------------------*/ - -SequenceEntry::SequenceEntry() { - _spriteListIndex = 0; - _flipped =0; - _frameIndex = 0; - _frameStart = 0; - _numSprites = 0; - _animType = 0; - _frameInc = 0; - _depth = 0; - _scale = 0; - _dynamicHotspotIndex = -1; - _triggerCountdown = 0; - _doneFlag = 0; - _entries._count = 0; - _abortMode = 0; - _actionNouns[0] = _actionNouns[1] = _actionNouns[2] = 0; - _numTicks = 0; - _extraTicks = 0; - _timeout = 0; -} - -KernelMessage::KernelMessage() { - _flags = 0; - _seqInex = 0; - _asciiChar = '\0'; - _asciiChar2 = '\0'; - _colors = 0; - Common::Point _posiition; - _msgOffset = 0; - _numTicks = 0; - _frameTimer2 = 0; - _frameTimer = 0; - _timeout = 0; - _field1C = 0; - _abortMode = 0; - _nounList[0] = _nounList[1] = _nounList[2] = 0; -} - -/*------------------------------------------------------------------------*/ - -Hotspot::Hotspot() { - _facing = 0; - _articleNumber = 0; - _cursor = 0; - _vocabId = 0; - _verbId = 0; -} - -Hotspot::Hotspot(Common::SeekableReadStream &f) { - _bounds.left = f.readSint16LE(); - _bounds.top = f.readSint16LE(); - _bounds.right = f.readSint16LE(); - _bounds.bottom = f.readSint16LE(); - _feetPos.x = f.readSint16LE(); - _feetPos.y = f.readSint16LE(); - _facing = f.readByte(); - _articleNumber = f.readByte(); - f.skip(1); - _cursor = f.readByte(); - _vocabId = f.readUint16LE(); - _verbId = f.readUint16LE(); -} - } // End of namespace MADS diff --git a/engines/mads/scene.h b/engines/mads/scene.h index 0e788c9ebd..7db10771ed 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -55,10 +55,10 @@ public: int _nextSceneId; int _currentSceneId; Common::Array _verbList; - TextDisplay _textDisplay[TEXT_DISPLAY_COUNT]; - Common::Array _spriteSlots; - Common::Array _spriteList; - int _spriteListIndex; + Common::Array _textDisplay; + SpriteSlots _spriteSlots; + Common::Array _sprites; + int _spritesIndex; Common::Array _dynamicHotspots; bool _dynamicHotspotsChanged; byte *_vocabBuffer; @@ -71,6 +71,7 @@ public: ScreenObjects _screenObjects; RGB4 *_scenePalette; RGB4 _nullPalette[2]; + int _v1; /** * Constructor @@ -82,22 +83,6 @@ public: */ ~Scene(); - /** - * Initialise the sprite data - * @param flag Also reset sprite list - */ - void clearSprites(bool flag); - - /** - * Delete any sprites used by the player - */ - void releasePlayerSprites(); - - /** - * Delete a sprite entry - */ - void deleteSpriteEntry(int listIndex); - /** * Clear the dynamic hotspot list */ @@ -128,6 +113,14 @@ public: */ void loadSceneLogic(); + /** + * Loads the resources associated with the given scene + * @param sceneId Scene to load + * @param prefix Prefix to use for retrieving animation data + * @param palFlag Flag for whether to reset the high/lo palette areas + */ + void loadScene(int sceneId, const Common::String &prefix, bool palFlag); + /** * Loads the hotstpots for the scene */ @@ -143,6 +136,7 @@ public: */ void setPalette(RGB4 *p); + /** * Clear the data for the scene */ diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index 6821395004..d0e40d4097 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -21,7 +21,7 @@ */ #include "common/scummsys.h" -#include "mads/scene.h" +#include "mads/scene_data.h" #include "mads/mads.h" #include "mads/nebular/nebular_scenes.h" @@ -30,7 +30,7 @@ namespace MADS { SpriteSlot::SpriteSlot() { _spriteType = ST_NONE; _seqIndex = 0; - _spriteListIndex = 0; + _spritesIndex = 0; _frameNumber = 0; _depth = 0; _scale = 0; @@ -39,12 +39,43 @@ SpriteSlot::SpriteSlot() { SpriteSlot::SpriteSlot(SpriteType type, int seqIndex) { _spriteType = type; _seqIndex = seqIndex; - _spriteListIndex = 0; + _spritesIndex = 0; _frameNumber = 0; _depth = 0; _scale = 0; } +/*------------------------------------------------------------------------*/ + +void SpriteSlots::clear(bool flag) { + _vm->_game->_scene._textDisplay.clear(); + + if (flag) + _vm->_game->_scene._sprites.clear(); + + Common::Array::clear(); + push_back(SpriteSlot(ST_FULL_SCREEN_REFRESH, -1)); +} + +/** + * Releases any sprites used by the player + */ +void SpriteSlots::releasePlayerSprites() { + Player &player = _vm->_game->player(); + + if (player._spritesLoaded && player._numSprites > 0) { + int spriteEnd = player._spritesStart + player._numSprites - 1; + do { + deleteEntry(spriteEnd); + } while (--spriteEnd >= player._spritesStart); + } +} + +void SpriteSlots::deleteEntry(int index) { + remove_at(index); +} + + /*------------------------------------------------------------------------*/ TextDisplay::TextDisplay() { @@ -68,7 +99,7 @@ DynamicHotspot::DynamicHotspot() { /*------------------------------------------------------------------------*/ SequenceEntry::SequenceEntry() { - _spriteListIndex = 0; + _spritesIndex = 0; _flipped =0; _frameIndex = 0; _frameStart = 0; diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index a4950dbc0a..b464cbaee3 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -30,6 +30,9 @@ namespace MADS { +class MADSEngine; +class Scene; + enum { VERB_LOOK = 3, VERB_TAKE = 4, @@ -70,7 +73,7 @@ class SpriteSlot { public: SpriteType _spriteType; int _seqIndex; - int _spriteListIndex; + int _spritesIndex; int _frameNumber; Common::Point _position; int _depth; @@ -80,6 +83,30 @@ public: SpriteSlot(SpriteType type, int seqIndex); }; +class SpriteSlots: public Common::Array { +private: + MADSEngine *_vm; +public: + SpriteSlots(MADSEngine *vm): _vm(vm) {} + + /** + * Clears any pending slot data and schedules a full screen refresh. + * @param flag Also reset sprite list + */ + void clear(bool flag); + + /** + * Delete any sprites used by the player + */ + void releasePlayerSprites(); + + /** + * Delete a sprite entry + * @param index Specifies the index in the array + */ + void deleteEntry(int index); +}; + class TextDisplay { public: bool _active; @@ -110,7 +137,7 @@ public: class SequenceEntry { public: - int _spriteListIndex; + int _spritesIndex; int _flipped; int _frameIndex; int _frameStart; @@ -175,13 +202,6 @@ public: Hotspot(Common::SeekableReadStream &f); }; -#define SPRITE_COUNT 50 -#define TEXT_DISPLAY_COUNT 40 -#define DYNAMIC_HOTSPOT_COUNT 8 - -class MADSEngine; -class Scene; - class SceneLogic { protected: Scene *_scene; diff --git a/engines/mads/sound.cpp b/engines/mads/sound.cpp index 8608abf4e7..ea0239076b 100644 --- a/engines/mads/sound.cpp +++ b/engines/mads/sound.cpp @@ -77,7 +77,7 @@ void SoundManager::setEnabled(bool flag) { _soundPollFlag = false; } -void SoundManager::queueNewCommands() { +void SoundManager::pauseNewCommands() { _newSoundsPaused = true; } diff --git a/engines/mads/sound.h b/engines/mads/sound.h index 51213f0e4e..0fd9ac1095 100644 --- a/engines/mads/sound.h +++ b/engines/mads/sound.h @@ -70,7 +70,7 @@ public: /** * Temporarily pause the playback of any new sound commands */ - void queueNewCommands(); + void pauseNewCommands(); /** * Stop queueing sound commands, and execute any previously queued ones -- cgit v1.2.3 From c49d7196fcabf18d9e97711f67b864808ca7848a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 25 Feb 2014 23:10:51 -0500 Subject: MADS: In progress implementation of loadScene --- engines/mads/assets.cpp | 2 +- engines/mads/dialogs.cpp | 2 +- engines/mads/game.h | 2 +- engines/mads/mads.cpp | 2 +- engines/mads/msprite.cpp | 22 +---- engines/mads/msprite.h | 17 +--- engines/mads/msurface.cpp | 51 +--------- engines/mads/msurface.h | 73 ++------------ engines/mads/nebular/game_nebular.cpp | 2 +- engines/mads/resources.cpp | 13 +++ engines/mads/resources.h | 1 + engines/mads/scene.cpp | 27 ++++-- engines/mads/scene.h | 12 ++- engines/mads/scene_data.cpp | 173 ++++++++++++++++++++++++++++++++++ engines/mads/scene_data.h | 67 +++++++++++++ engines/mads/user_interface.cpp | 2 +- 16 files changed, 307 insertions(+), 161 deletions(-) diff --git a/engines/mads/assets.cpp b/engines/mads/assets.cpp index 6ad313ce3e..4c075d054e 100644 --- a/engines/mads/assets.cpp +++ b/engines/mads/assets.cpp @@ -82,7 +82,7 @@ SpriteAsset::SpriteAsset(MADSEngine *vm, const Common::String &resourceName, int _frameCount, frame.x, frame.y, frame.w, frame.h); } - frame.frame = MSprite::init(spriteDataStream, Common::Point(frame.x, frame.y), + frame.frame = new MSprite(spriteDataStream, Common::Point(frame.x, frame.y), frame.w, frame.h, false); _frames.push_back(frame); } diff --git a/engines/mads/dialogs.cpp b/engines/mads/dialogs.cpp index c865e048da..e4c7682a38 100644 --- a/engines/mads/dialogs.cpp +++ b/engines/mads/dialogs.cpp @@ -39,7 +39,7 @@ Dialog::~Dialog() { void Dialog::save(MSurface *s) { - _savedSurface = MSurface::init(_width, _height); + _savedSurface = new MSurface(_width, _height); s->copyTo(_savedSurface, Common::Rect(_position.x, _position.y, _position.x + _width, _position.y + _height), Common::Point()); diff --git a/engines/mads/game.h b/engines/mads/game.h index 4797908b1a..b8add9ab00 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -61,7 +61,6 @@ protected: VisitedScenes _visitedScenes; byte *_quotes; int _v1; - int _v2; int _v3; int _v4; int _v5; @@ -109,6 +108,7 @@ public: Common::Array _globalFlags; InventoryObjects _objects; Scene _scene; + int _v2; public: virtual ~Game(); diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index f7fe03e2be..d78f37dd8b 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -83,7 +83,7 @@ void MADSEngine::initialise() { _events = new EventsManager(this); _palette = new Palette(this); _font = new Font(this); - _screen = MSurface::init(g_system->getWidth(), g_system->getHeight()); + _screen = new MSurface(g_system->getWidth(), g_system->getHeight()); _sound = new SoundManager(this, _mixer); _userInterface = UserInterface::init(this); _game = Game::init(this); diff --git a/engines/mads/msprite.cpp b/engines/mads/msprite.cpp index b15796d57c..279192fbdc 100644 --- a/engines/mads/msprite.cpp +++ b/engines/mads/msprite.cpp @@ -35,25 +35,13 @@ enum { kMarker = 2 }; -MADSEngine *MSprite::_vm; - -MSprite *MSprite::init(MSurface &s) { - return new MSprite(s); -} - -MSprite *MSprite::init(Common::SeekableReadStream *source, const Common::Point &offset, - int widthVal, int heightVal, bool decodeRle, uint8 encodingVal) { - - return new MSprite(source, offset, widthVal, heightVal, decodeRle, encodingVal); -} - -MSprite::MSprite(MSurface &s): _surface(s) { +MSprite::MSprite(): MSurface() { _encoding = 0; } MSprite::MSprite(Common::SeekableReadStream *source, const Common::Point &offset, int widthVal, int heightVal, bool decodeRle, uint8 encodingVal) - : _surface(*MSurface::init(widthVal, heightVal)), + : MSurface(widthVal, heightVal), _encoding(encodingVal), _offset(offset) { // Load the sprite data @@ -69,14 +57,14 @@ void MSprite::loadSprite(Common::SeekableReadStream *source) { byte *outp, *lineStart; bool newLine = false; - outp = _surface.getData(); - lineStart = _surface.getData(); + outp = getData(); + lineStart = getData(); while (1) { byte cmd1, cmd2, count, pixel; if (newLine) { - outp = lineStart + _surface.w; + outp = lineStart + getWidth(); lineStart = outp; newLine = false; } diff --git a/engines/mads/msprite.h b/engines/mads/msprite.h index bb21772908..f2194dab08 100644 --- a/engines/mads/msprite.h +++ b/engines/mads/msprite.h @@ -95,24 +95,15 @@ struct SpriteFrameHeader { uint32 reserved8; }; -class MSprite { +class MSprite: public MSurface { +private: + void loadSprite(Common::SeekableReadStream *source); public: - static MSprite *init(MSurface &s); - static MSprite *init(Common::SeekableReadStream *source, const Common::Point &offset, int widthVal, - int heightVal, bool decodeRle = true, uint8 encodingVal = 0); -protected: - static MADSEngine *_vm; - - MSprite(MSurface &s); + MSprite(); MSprite(Common::SeekableReadStream *source, const Common::Point &offset, int widthVal, int heightVal, bool decodeRle = true, uint8 encodingVal = 0); - - void loadSprite(Common::SeekableReadStream *source); -public: - static void setVm(MADSEngine *vm) { _vm = vm; } virtual ~MSprite(); - MSurface &_surface; Common::Point _pos; Common::Point _offset; uint8 _encoding; diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp index a9561cdd9b..4c17b3a159 100644 --- a/engines/mads/msurface.cpp +++ b/engines/mads/msurface.cpp @@ -32,22 +32,6 @@ namespace MADS { MADSEngine *MSurface::_vm = nullptr; -MSurface *MSurface::init() { - if (_vm->getGameID() == GType_RexNebular) { - return new MSurfaceNebular(); - } else { - return new MSurfaceMADS(); - } -} - -MSurface *MSurface::init(int width, int height) { - if (_vm->getGameID() == GType_RexNebular) { - return new MSurfaceNebular(width, height); - } else { - return new MSurfaceMADS(width, height); - } -} - MSurface::MSurface() { pixels = nullptr; } @@ -120,7 +104,7 @@ void MSurface::drawSprite(const Common::Point &pt, SpriteInfo &info, const Commo return; int heightAmt = scaledHeight; - byte *src = info.sprite->_surface.getData(); + byte *src = info.sprite->getData(); byte *dst = getBasePtr(x - info.hotX - clipX, y - info.hotY - clipY); int status = kStatusSkip; @@ -278,33 +262,7 @@ void MSurface::translate(RGBList *list, bool isTransparent) { } /*------------------------------------------------------------------------*/ - -void MSurfaceMADS::loadCodes(Common::SeekableReadStream *source) { - if (!source) { - free(); - return; - } - - uint16 width = MADS_SCREEN_WIDTH; - uint16 height = MADS_SCREEN_HEIGHT - MADS_INTERFACE_HEIGHT; - byte *walkMap = new byte[source->size()]; - - setSize(width, height); - source->read(walkMap, source->size()); - - byte *ptr = (byte *)getBasePtr(0, 0); - - for (int y = 0; y < height; y++) { - for (int x = 0; x < width; x++) { - int ofs = x + (y * width); - if ((walkMap[ofs / 8] << (ofs % 8)) & 0x80) - *ptr++ = 1; // walkable - else - *ptr++ = 0; - } - } -} - +/* void MSurfaceMADS::loadBackground(int roomNumber, RGBList **palData) { // clear previous data empty(); @@ -386,7 +344,7 @@ void MSurfaceMADS::loadBackground(int roomNumber, RGBList **palData) { for (i = 0; i < tileCount; i++) { tileDataUncomp->seek(i * 4, SEEK_SET); uint32 tileOfs = tileDataUncomp->readUint32LE(); - MSurface *newTile = MSurface::init(tileWidth, tileHeight); + MSurface *newTile = new MSurface(tileWidth, tileHeight); if (i == tileCount - 1) compressedTileDataSize = tileDataComp->size() - tileOfs; @@ -454,7 +412,7 @@ void MSurfaceMADS::loadInterface(int index, RGBList **palData) { delete intStream; } -/*------------------------------------------------------------------------*/ +------------------------------------------------------------------------ void MSurfaceNebular::loadBackground(int roomNumber, RGBList **palData) { // clear previous data @@ -504,5 +462,6 @@ void MSurfaceNebular::loadBackgroundStream(Common::SeekableReadStream *source, R delete sourceUnc; } +*/ } // End of namespace MADS diff --git a/engines/mads/msurface.h b/engines/mads/msurface.h index 3904aa1e92..209ac97d58 100644 --- a/engines/mads/msurface.h +++ b/engines/mads/msurface.h @@ -50,24 +50,19 @@ struct SpriteInfo { * MADS graphics surface */ class MSurface : public Graphics::Surface { -public: +private: static MADSEngine *_vm; - +public: /** - * Sets the engine reference + * Sets the engine refrence used all surfaces */ static void setVm(MADSEngine *vm) { _vm = vm; } /** - * Create a new surface. - */ - static MSurface *init(); - - /** - * Create a surface + * Helper method for calculating new dimensions when scaling a sprite */ - static MSurface *init(int width, int height); -protected: + static int scaleValue(int value, int scale, int err); +public: /** * Basic constructor */ @@ -77,12 +72,7 @@ protected: * Constructor for a surface with fixed dimensions */ MSurface(int width, int height); -public: - /** - * Helper method for calculating new dimensions when scaling a sprite - */ - static int scaleValue(int value, int scale, int err); -public: + /** * Destructor */ @@ -182,55 +172,6 @@ public: * Translates the data of a surface using a specified RGBList translation matrix. */ void translate(RGBList *list, bool isTransparent = false); - - // Base virtual methods - /** - * Loads a background by scene name - */ - virtual void loadBackground(const Common::String &sceneName) {} - - /** - * Load background by room number - */ - virtual void loadBackground(int roomNumber, RGBList **palData) = 0; - - /** - * Load background from a passed stream - */ - virtual void loadBackground(Common::SeekableReadStream *source, RGBList **palData) {} - - /** - * Load scene codes from a passed stream - */ - virtual void loadCodes(Common::SeekableReadStream *source) = 0; - - /** - * Load a given user interface by index - */ - virtual void loadInterface(int index, RGBList **palData) {} -}; - -class MSurfaceMADS: public MSurface { - friend class MSurface; -protected: - MSurfaceMADS(): MSurface() {} - MSurfaceMADS(int width, int height): MSurface(width, height) {} -public: - virtual void loadCodes(Common::SeekableReadStream *source); - virtual void loadBackground(const Common::String &sceneName) {} - virtual void loadBackground(int roomNumber, RGBList **palData); - virtual void loadInterface(int index, RGBList **palData); -}; - -class MSurfaceNebular: public MSurfaceMADS { - friend class MSurface; -protected: - MSurfaceNebular(): MSurfaceMADS() {} - MSurfaceNebular(int width, int height): MSurfaceMADS(width, height) {} -private: - void loadBackgroundStream(Common::SeekableReadStream *source, RGBList **palData); -public: - virtual void loadBackground(int roomNumber, RGBList **palData); }; } // End of namespace MADS diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index e777ff8def..c55abf5601 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -34,7 +34,7 @@ namespace MADS { namespace Nebular { GameNebular::GameNebular(MADSEngine *vm): Game(vm) { - _surface =MSurface::init(MADS_SCREEN_WIDTH, MADS_SCREEN_HEIGHT - MADS_INTERFACE_HEIGHT); + _surface = new MSurface(MADS_SCREEN_WIDTH, MADS_SCREEN_HEIGHT - MADS_INTERFACE_HEIGHT); } int GameNebular::checkCopyProtection() { diff --git a/engines/mads/resources.cpp b/engines/mads/resources.cpp index 9f856eeefc..f24f7d2fc7 100644 --- a/engines/mads/resources.cpp +++ b/engines/mads/resources.cpp @@ -303,6 +303,19 @@ Common::String Resources::formatName(RESPREFIX resType, int id, const Common::St return result; } +Common::String Resources::formatResource(const Common::String &resName, + const Common::String &hagFilename) { + int v1 = 0, v2 = 0; + + if (resName.hasPrefix("*")) { + // Resource file specified + error("TODO: formatResource"); + } else { + // File outside of hag file + return resName; + } +} + /*------------------------------------------------------------------------*/ void File::openFile(const Common::String &filename) { diff --git a/engines/mads/resources.h b/engines/mads/resources.h index 033157ed60..8fed0ab437 100644 --- a/engines/mads/resources.h +++ b/engines/mads/resources.h @@ -47,6 +47,7 @@ public: static void init(MADSEngine *vm); static Common::String formatName(RESPREFIX resType, int id, const Common::String &ext); + static Common::String formatResource(const Common::String &resName, const Common::String &hagFilename); }; /** diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 7bbb4e98ae..138cab500a 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -33,6 +33,8 @@ Scene::Scene(MADSEngine *vm): _vm(vm), _spriteSlots(vm) { _currentSceneId = 0; _vocabBuffer = nullptr; _sceneLogic = nullptr; + _sceneInfo = nullptr; + _scenePalette = nullptr; _verbList.push_back(VerbInit(VERB_LOOK, 2, 0)); _verbList.push_back(VerbInit(VERB_TAKE, 2, 0)); @@ -50,6 +52,7 @@ Scene::Scene(MADSEngine *vm): _vm(vm), _spriteSlots(vm) { Scene::~Scene() { delete[] _vocabBuffer; delete _sceneLogic; + delete _sceneInfo; } void Scene::clearDynamicHotspots() { @@ -84,11 +87,11 @@ int Scene::activeVocabIndexOf(int vocabId) { } void Scene::clearSequenceList() { - _sequenceList.clear(); + _sequences.clear(); } void Scene::clearMessageList() { - _messageList.clear(); + _messages.clear(); _talkFont = "*FONTCONV.FF"; _textSpacing = -1; } @@ -114,16 +117,22 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) { if (palFlag) _vm->_palette->resetGamePalette(18, 10); + _spriteSlots.clear(false); + _sequences.clear(); + _messages.clear(); + setPalette(_nullPalette); + _sceneInfo = SceneInfo::load(_vm, _currentSceneId, _v1, Common::String(), _vm->_game->_v2 ? 17 : 16, + _depthSurface, _backgroundSurface); } void Scene::loadHotspots() { File f(Resources::formatName(RESPREFIX_RM, _currentSceneId, ".HH")); int count = f.readUint16LE(); - _hotspotList.clear(); + _hotspots.clear(); for (int i = 0; i < count; ++i) - _hotspotList.push_back(Hotspot(f)); + _hotspots.push_back(Hotspot(f)); } void Scene::loadVocab() { @@ -142,10 +151,10 @@ void Scene::loadVocab() { } // Load scene hotspot list vocabs and verbs - for (uint i = 0; i < _hotspotList.size(); ++i) { - addActiveVocab(_hotspotList[i]._vocabId); - if (_hotspotList[i]._verbId) - addActiveVocab(_hotspotList[i]._verbId); + for (uint i = 0; i < _hotspots.size(); ++i) { + addActiveVocab(_hotspots[i]._vocabId); + if (_hotspots[i]._verbId) + addActiveVocab(_hotspots[i]._verbId); } loadVocabStrings(); @@ -170,7 +179,7 @@ void Scene::free() { } void Scene::setPalette(RGB4 *p) { - _scenePalette = p; +// _scenePalette = p; } } // End of namespace MADS diff --git a/engines/mads/scene.h b/engines/mads/scene.h index 7db10771ed..efe89c2b09 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -27,6 +27,7 @@ #include "common/array.h" #include "common/rect.h" #include "mads/assets.h" +#include "mads/msurface.h" #include "mads/scene_data.h" namespace MADS { @@ -63,15 +64,18 @@ public: bool _dynamicHotspotsChanged; byte *_vocabBuffer; Common::Array _activeVocabs; - Common::Array _sequenceList; - Common::Array _messageList; + Common::Array _sequences; + Common::Array _messages; Common::String _talkFont; int _textSpacing; - Common::Array _hotspotList; + Common::Array _hotspots; ScreenObjects _screenObjects; - RGB4 *_scenePalette; + ScenePalette *_scenePalette; RGB4 _nullPalette[2]; int _v1; + SceneInfo *_sceneInfo; + MSurface _backgroundSurface; + MSurface _depthSurface; /** * Constructor diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index d0e40d4097..aac70750b8 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -23,6 +23,7 @@ #include "common/scummsys.h" #include "mads/scene_data.h" #include "mads/mads.h" +#include "mads/resources.h" #include "mads/nebular/nebular_scenes.h" namespace MADS { @@ -161,4 +162,176 @@ Hotspot::Hotspot(Common::SeekableReadStream &f) { _verbId = f.readUint16LE(); } +/*------------------------------------------------------------------------*/ + +void ARTHeader::load(Common::SeekableReadStream &f) { + _width = f.readUint16LE(); + _height = f.readUint16LE(); + + _palCount = f.readUint16LE(); + for (int i = 0; i < 256; ++i) { + RGB6 rgb; + rgb.r = f.readByte(); + rgb.g = f.readByte(); + rgb.b = f.readByte(); + f.read(&rgb.unused[0], 3); + + _palette.push_back(rgb); + } + + int palCount = f.readUint16LE(); + for (int i = 0; i < palCount; ++i) { + RGB4 rgb; + rgb.r = f.readByte(); + rgb.g = f.readByte(); + rgb.b = f.readByte(); + rgb.u = f.readByte(); + + _palData.push_back(rgb); + } +} + +/*------------------------------------------------------------------------*/ + +SceneInfo *SceneInfo::load(MADSEngine *vm, int sceneId, int v1, const Common::String &resName, + int v3, MSurface &depthSurface, MSurface &bgSurface) { + return new SceneInfo(vm, sceneId, v1, resName, v3, depthSurface, bgSurface); +} + +SceneInfo::SceneInfo(MADSEngine *vm, int sceneId, int v1, const Common::String &resName, + int flags, MSurface &depthSurface, MSurface &bgSurface) { + bool flag = true; + bool sceneFlag = sceneId >= 0; + bool ssFlag = false, wsFlag = false; + int handle = 0; + + SpriteAsset *spriteSets[10]; + int xpList[10]; + Common::fill(&spriteSets[0], &spriteSets[10], (SpriteAsset *)nullptr); + Common::fill(&xpList[0], &xpList[10], -1); + + // Figure out the resource to use + Common::String resourceName; + if (sceneFlag) { + resourceName = Resources::formatName(RESPREFIX_RM, sceneId, ".DAT"); + } else { + resourceName = "*" + Resources::formatResource(resName, resName); + } + + // Open the scene info resource for access + File infoFile(resName); + + // Read in basic data + _sceneId = infoFile.readUint16LE(); + _artFileNum = infoFile.readUint16LE(); + _depthStyle = infoFile.readUint16LE(); + _width = infoFile.readUint16LE(); + _height = infoFile.readUint16LE(); + infoFile.skip(24); + _nodeCount = infoFile.readUint16LE(); + _yBandsEnd = infoFile.readUint16LE(); + _yBandsStart = infoFile.readUint16LE(); + _maxScale = infoFile.readUint16LE(); + _minScale = infoFile.readUint16LE(); + for (int i = 0; i < 15; ++i) + _depthList[i] = infoFile.readUint16LE(); + _field4A = infoFile.readUint16LE(); + + // Load the set of objects that are associated with the scene + for (int i = 0; i < 20; ++i) { + InventoryObject obj; + obj.load(infoFile); + _objects.push_back(obj); + } + + int setCount = infoFile.readUint16LE(); + int field40E = infoFile.readUint16LE(); + + for (int i = 0; i < 20; ++i) { + char name[64]; + infoFile.read(name, 64); + _setNames.push_back(Common::String(name)); + } + + infoFile.close(); + int width = _width; + int height = _height; + + if (!bgSurface.getPixels()) { + bgSurface.setSize(width, height); + ssFlag = true; + } + + if (_depthStyle == 2) + width >>= 2; + if (!depthSurface.getPixels()) { + depthSurface.setSize(width, height); + wsFlag = true; + } + + // Load the depth surface with the scene codes + loadCodes(depthSurface); + + // Get the ART resource + if (sceneFlag) { + resourceName = Resources::formatName(RESPREFIX_RM, sceneId, ".ART"); + } else { + resourceName = "*" + Resources::formatResource(resName, resName); + } + + // Load in the ART header and palette + File artFile(resourceName); + ARTHeader artHeader; + artHeader.load(artFile); + artFile.close(); + + // Copy out the palette data + for (int i = 0; i < artHeader._palData.size(); ++i) + _palette.push_back(artHeader._palData[i]); +/* + if (!(flags & 1)) { + if (_vm->_game->_scene->_scenePalette) { + //_vm->_game->_scene->_scenePalette->clean(&artHeader._palCount); + //_vm->_game->_scene->_scenePalette->process(&artHeader._palCount) + } + } + */ + warning("TODO"); +} + +void SceneInfo::loadCodes(MSurface &depthSurface) { + File f(Resources::formatName(RESPREFIX_RM, _sceneId, ".DAT")); + + uint16 width = _width; + uint16 height = _height; + byte *walkMap = new byte[f.size()]; + + depthSurface.setSize(width, height); + f.read(walkMap, f.size()); + + byte *ptr = (byte *)depthSurface.getPixels(); + + for (int y = 0; y < height; y++) { + for (int x = 0; x < width; x++) { + int ofs = x + (y * width); + if ((walkMap[ofs / 8] << (ofs % 8)) & 0x80) + *ptr++ = 1; // walkable + else + *ptr++ = 0; + } + } + + delete[] walkMap; +} + +/*------------------------------------------------------------------------*/ + +void ScenePalette::clean(int *palCount) { + warning("TODO: ScenePalette::clean"); +} + +void ScenePalette::process(int *palCount) { + warning("TODO: ScenePalette::process"); +} + } // End of namespace MADS diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index b464cbaee3..2fcd3f9ae4 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -25,8 +25,11 @@ #include "common/scummsys.h" #include "common/array.h" +#include "common/str.h" +#include "common/str-array.h" #include "common/rect.h" #include "mads/assets.h" +#include "mads/game_data.h" namespace MADS { @@ -242,6 +245,70 @@ public: virtual void postActions() = 0; }; +struct RGB6 { + byte r; + byte g; + byte b; + byte unused[3]; +}; + +struct ARTHeader { + int _width; + int _height; + int _palCount; + Common::Array _palette; + Common::Array _palData; + + void load(Common::SeekableReadStream &f); +}; + +/** + * Handles general data for a given scene + */ +class SceneInfo { +private: + MADSEngine *_vm; + + SceneInfo(MADSEngine *vm, int sceneId, int v1, const Common::String &resName, + int v3, MSurface &depthSurface, MSurface &bgSurface); + + /** + * Loads the given surface with depth information of a given scene + */ + void loadCodes(MSurface &depthSurface); +public: + int _sceneId; + int _artFileNum; + int _depthStyle; + int _width; + int _height; + + int _nodeCount; + int _yBandsEnd; + int _yBandsStart; + int _maxScale; + int _minScale; + int _depthList[15]; + int _field4A; + + int _field4C; + Common::Array _objects; + Common::StringArray _setNames; + Common::Array _palette; +public: + /** + * Instantiates the class and loads the data + */ + static SceneInfo *load(MADSEngine *vm, int sceneId, int flags, + const Common::String &resName, int v3, MSurface &depthSurface, MSurface &bgSurface); +}; + +class ScenePalette { +public: + void clean(int *palCount); + void process(int *palCount); +}; + } // End of namespace MADS #endif /* MADS_SCENE_DATA_H */ diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 2af134a8ee..3bbf6a0b2b 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -33,7 +33,7 @@ UserInterface *UserInterface::init(MADSEngine *vm) { } UserInterface::UserInterface(MADSEngine *vm): _vm(vm), _surface( - MSurface::init(MADS_SCREEN_WIDTH, MADS_INTERFACE_HEIGHT)) { + new MSurface(MADS_SCREEN_WIDTH, MADS_INTERFACE_HEIGHT)) { } UserInterface::~UserInterface() { -- cgit v1.2.3 From badb8d97444767b7d8fea0f877ac044249696a5f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 28 Feb 2014 20:37:42 -0500 Subject: MADS: More work implementing scene info loading --- engines/mads/dialogs.h | 8 +- engines/mads/game.cpp | 2 +- engines/mads/msurface.cpp | 215 +-------------------------------- engines/mads/msurface.h | 4 +- engines/mads/nebular/sound_nebular.cpp | 20 +-- engines/mads/nebular/sound_nebular.h | 6 +- engines/mads/palette.cpp | 114 +++++++++++++++++ engines/mads/palette.h | 50 ++++++++ engines/mads/resources.cpp | 2 +- engines/mads/scene.cpp | 8 +- engines/mads/scene.h | 8 -- engines/mads/scene_data.cpp | 93 ++++++++------ engines/mads/scene_data.h | 21 +--- 13 files changed, 256 insertions(+), 295 deletions(-) diff --git a/engines/mads/dialogs.h b/engines/mads/dialogs.h index a915ed3452..0f9a098ee1 100644 --- a/engines/mads/dialogs.h +++ b/engines/mads/dialogs.h @@ -67,7 +67,7 @@ public: /** * Destructor */ - ~Dialog(); + virtual ~Dialog(); }; enum { @@ -145,7 +145,7 @@ public: /** * Destructor */ - ~TextDialog(); + virtual ~TextDialog(); /** * Draw the dialog @@ -162,6 +162,8 @@ class MessageDialog: protected TextDialog { public: MessageDialog(MADSEngine *vm, int lines, ...); + virtual ~MessageDialog() {} + /** * Show the dialog, and wait until a key or mouse press. */ @@ -184,6 +186,8 @@ public: Common::Point _defaultPosition; DialogId _pendingDialog; + virtual ~Dialogs() {} + virtual void showDialog() = 0; }; diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 2a45c3ee90..08d548e235 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -160,7 +160,7 @@ void Game::sectionLoop() { _vm->_palette->initGamePalette(); } - // TODO: Further palette init + _vm->_palette->_paletteUsage.load(3, 0xF0, 0xF1, 0xF2); _scene.loadScene(_scene._nextSceneId, _aaName, 0); _vm->_sound->pauseNewCommands(); diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp index 4c17b3a159..ca75a50bde 100644 --- a/engines/mads/msurface.cpp +++ b/engines/mads/msurface.cpp @@ -249,219 +249,14 @@ void MSurface::copyFrom(MSurface *src, const Common::Rect &srcBounds, } } -void MSurface::translate(RGBList *list, bool isTransparent) { - byte *p = getBasePtr(0, 0); - byte *palIndexes = list->palIndexes(); - - for (int i = 0; i < getWidth() * getHeight(); ++i, ++p) { - if (!isTransparent || (*p != 0)) { - assert(*p < list->size()); - *p = palIndexes[*p]; - } - } -} - -/*------------------------------------------------------------------------*/ -/* -void MSurfaceMADS::loadBackground(int roomNumber, RGBList **palData) { - // clear previous data - empty(); - - // Get a MadsPack reference to the tile set and mapping - char resourceName[20]; - int i; - - // Uncompressed tile map resource - sprintf(resourceName, "rm%d.mm", roomNumber); - MadsPack tileMapFile(resourceName, _vm); - Common::SeekableReadStream *mapStream = tileMapFile.getItemStream(0); - - // Get the details of the tiles and map - mapStream->readUint32LE(); - int tileCountX = mapStream->readUint16LE(); - int tileCountY = mapStream->readUint16LE(); - int tileWidthMap = mapStream->readUint16LE(); - int tileHeightMap = mapStream->readUint16LE(); - int screenWidth = mapStream->readUint16LE(); - int screenHeight = mapStream->readUint16LE(); - int tileCountMap = tileCountX * tileCountY; - delete mapStream; - - // Obtain tile map information - typedef Common::List > TileSetList; - typedef TileSetList::iterator TileSetIterator; - TileSetList tileSet; - uint16 *tileMap = new uint16[tileCountMap]; - mapStream = tileMapFile.getItemStream(1); - for (i = 0; i < tileCountMap; ++i) - tileMap[i] = mapStream->readUint16LE(); - delete mapStream; - -// _vm->_resources->toss(resourceName); - - // -------------------------------------------------------------------------------- - - // Tile map data, which needs to be kept compressed, as the tile offsets refer to - // the compressed data. Each tile is then uncompressed separately - sprintf(resourceName, "rm%d.tt", roomNumber); - Common::SeekableReadStream *tileDataComp = nullptr; //_vm->_resources->get(resourceName); - MadsPack tileData(tileDataComp); - Common::SeekableReadStream *tileDataUncomp = tileData.getItemStream(0); - - // Validate that the data matches between the tiles and tile map file and is valid - int tileCount = tileDataUncomp->readUint16LE(); - int tileWidth = tileDataUncomp->readUint16LE(); - int tileHeight = tileDataUncomp->readUint16LE(); - delete tileDataUncomp; - assert(tileCountMap == tileCount); - assert(tileWidth == tileWidthMap); - assert(tileHeight == tileHeightMap); - assert(screenWidth == _vm->_screen->getWidth()); - assert(screenHeight <= _vm->_screen->getHeight()); - - // -------------------------------------------------------------------------------- - - // Get the palette to use - tileDataUncomp = tileData.getItemStream(2); - // Set palette - if (!palData) { - _vm->_palette->loadPalette(tileDataUncomp, 4); - } else { - int numColors; - byte *rgbList = _vm->_palette->decodePalette(tileDataUncomp, &numColors); - *palData = new RGBList(numColors, rgbList, true); - } - delete tileDataUncomp; - - // -------------------------------------------------------------------------------- - - // Get tile data - - tileDataUncomp = tileData.getItemStream(1); - FabDecompressor fab; - uint32 compressedTileDataSize = 0; - - for (i = 0; i < tileCount; i++) { - tileDataUncomp->seek(i * 4, SEEK_SET); - uint32 tileOfs = tileDataUncomp->readUint32LE(); - MSurface *newTile = new MSurface(tileWidth, tileHeight); +void MSurface::translate(Common::Array &palette) { + for (int y = 0; y < this->h; ++y) { + byte *pDest = getBasePtr(0, y); - if (i == tileCount - 1) - compressedTileDataSize = tileDataComp->size() - tileOfs; - else - compressedTileDataSize = tileDataUncomp->readUint32LE() - tileOfs; - - //printf("Tile: %i, compressed size: %i\n", i, compressedTileDataSize); - - newTile->empty(); - - byte *compressedTileData = new byte[compressedTileDataSize]; - - tileDataComp->seek(tileData.getDataOffset() + tileOfs, SEEK_SET); - tileDataComp->read(compressedTileData, compressedTileDataSize); - - fab.decompress(compressedTileData, compressedTileDataSize, newTile->getData(), - tileWidth * tileHeight); - tileSet.push_back(TileSetList::value_type(newTile)); - delete[] compressedTileData; - } - - delete tileDataUncomp; - - // -------------------------------------------------------------------------------- - - // Loop through the mapping data to place the tiles on the screen - - uint16 *tIndex = &tileMap[0]; - for (int y = 0; y < tileCountY; y++) { - for (int x = 0; x < tileCountX; x++) { - int tileIndex = *tIndex++; - assert(tileIndex < tileCount); - TileSetIterator tile = tileSet.begin(); - for (i = 0; i < tileIndex; i++) - ++tile; - ((*tile).get())->copyTo(this, Common::Point(x * tileWidth, y * tileHeight)); + for (int x = 0; x < this->w; ++x, ++pDest) { + *pDest = palette[*pDest].palIndex; } } - tileSet.clear(); -// _vm->_resources->toss(resourceName); -} - -void MSurfaceMADS::loadInterface(int index, RGBList **palData) { - char resourceName[20]; - sprintf(resourceName, "i%d.int", index); - MadsPack intFile(resourceName, _vm); - byte *palette = new byte[16 * 3]; - - // Chunk 0, palette - Common::SeekableReadStream *intStream = intFile.getItemStream(0); - - for (int i = 0; i < 16; i++) { - palette[i * 3] = intStream->readByte() << 2; - palette[i * 3 + 1] = intStream->readByte() << 2; - palette[i * 3 + 2] = intStream->readByte() << 2; - intStream->skip(3); - } - *palData = new RGBList(16, palette, true); - delete intStream; - - // Chunk 1, data - intStream = intFile.getItemStream(1); - setSize(MADS_SCREEN_WIDTH, MADS_INTERFACE_HEIGHT); - intStream->read(pixels, MADS_SCREEN_WIDTH * MADS_INTERFACE_HEIGHT); - delete intStream; -} - ------------------------------------------------------------------------- - -void MSurfaceNebular::loadBackground(int roomNumber, RGBList **palData) { - // clear previous data - empty(); - - Common::String resourceName = Common::String::format("rm%d.art", roomNumber); - Common::SeekableReadStream *stream = nullptr; //_vm->_resources->get(resourceName); - loadBackgroundStream(stream, palData); - -// _vm->_resources->toss(resourceName); -} - -void MSurfaceNebular::loadBackgroundStream(Common::SeekableReadStream *source, RGBList **palData) { - MadsPack packData(source); - Common::MemoryReadStream *sourceUnc = packData.getItemStream(0); - - int sceneWidth = sourceUnc->readUint16LE(); - int sceneHeight = sourceUnc->readUint16LE(); - int sceneSize = sceneWidth * sceneHeight; - if (sceneWidth > this->getWidth()) { - warning("Background width is %i, too large to fit in screen. Setting it to %i", sceneWidth, getWidth()); - sceneWidth = this->getWidth(); - sceneSize = sceneWidth * sceneHeight; - } - if (sceneHeight > getHeight()) { - warning("Background height is %i, too large to fit in screen.Setting it to %i", sceneHeight, getHeight()); - sceneHeight = getHeight(); - sceneSize = sceneWidth * sceneHeight; - } - - // Set palette - if (!palData) { - _vm->_palette->loadPalette(sourceUnc, 4); - } else { - int numColors; - byte *rgbList = _vm->_palette->decodePalette(sourceUnc, &numColors); - *palData = new RGBList(numColors, rgbList, true); - } - delete sourceUnc; - - // Get the raw data for the background - sourceUnc = packData.getItemStream(1); - assert((int)sourceUnc->size() >= sceneSize); - - byte *pData = (byte *)pixels; - sourceUnc->read(pData, sceneSize); - - delete sourceUnc; } -*/ } // End of namespace MADS diff --git a/engines/mads/msurface.h b/engines/mads/msurface.h index 209ac97d58..7f4cec3c1c 100644 --- a/engines/mads/msurface.h +++ b/engines/mads/msurface.h @@ -169,9 +169,9 @@ public: } /** - * Translates the data of a surface using a specified RGBList translation matrix. + * Translates the pixels of an image used the passed palette with RGB mapping */ - void translate(RGBList *list, bool isTransparent = false); + void translate(Common::Array &palette); }; } // End of namespace MADS diff --git a/engines/mads/nebular/sound_nebular.cpp b/engines/mads/nebular/sound_nebular.cpp index dba4b363bb..5f1d80513e 100644 --- a/engines/mads/nebular/sound_nebular.cpp +++ b/engines/mads/nebular/sound_nebular.cpp @@ -300,10 +300,10 @@ byte *ASound::loadData(int offset, int size) { void ASound::playSound(int offset, int size) { // Load the specified data block - playSound(loadData(offset, size)); + playSoundData(loadData(offset, size)); } -void ASound::playSound(byte *pData, int startingChannel) { +void ASound::playSoundData(byte *pData, int startingChannel) { // Scan for a high level free channel for (int i = startingChannel; i < ADLIB_CHANNEL_COUNT; ++i) { if (!_channels[i]._activeCount) { @@ -1020,7 +1020,7 @@ int ASound1::command19() { int ASound1::command20() { byte *pData = loadData(0xD18, 28); if (!isSoundActive(pData)) - playSound(pData); + playSoundData(pData); return 0; } @@ -1034,7 +1034,7 @@ int ASound1::command22() { pData[6] = (getRandomNumber() & 7) + 85; if (!isSoundActive(pData)) - playSound(pData); + playSoundData(pData); return 0; } @@ -1055,7 +1055,7 @@ int ASound1::command24() { int ASound1::command25() { byte *pData = loadData(0xD82, 16); if (!isSoundActive(pData)) - playSound(pData); + playSoundData(pData); return 0; } @@ -1091,7 +1091,7 @@ int ASound1::command29() { pData[7] = pData[13] = pData[21] = pData[27] = v; if (!isSoundActive(pData)) - playSound(pData, 0); + playSoundData(pData, 0); return 0; } @@ -1101,7 +1101,7 @@ int ASound1::command30() { pData[7] = (command2627293032() + 0x40) & 0xFF; if (!isSoundActive(pData)) - playSound(pData, 0); + playSoundData(pData, 0); return 0; } @@ -1109,7 +1109,7 @@ int ASound1::command30() { int ASound1::command31() { byte *pData = loadData(0xDAE, 14); if (!isSoundActive(pData)) - playSound(pData); + playSoundData(pData); return 0; } @@ -1121,7 +1121,7 @@ int ASound1::command32() { pData[11] = pData[19] = pData[27] = pData[35] = v >> 8; if (!isSoundActive(pData)) - playSound(pData, 0); + playSoundData(pData, 0); return 0; } @@ -1139,7 +1139,7 @@ int ASound1::command34() { byte *pData = loadData(0xDD0, 22); pData[8] = pData[15] = v; - playSound(pData); + playSoundData(pData); return 0; } diff --git a/engines/mads/nebular/sound_nebular.h b/engines/mads/nebular/sound_nebular.h index c7a28620be..caafdcaf77 100644 --- a/engines/mads/nebular/sound_nebular.h +++ b/engines/mads/nebular/sound_nebular.h @@ -228,7 +228,7 @@ protected: * @param pData Pointer to data block containing sound data * @param startingChannel Channel to start scan from */ - void playSound(byte *pData, int startingChannel = ADLIB_CHANNEL_COUNT); + void playSoundData(byte *pData, int startingChannel = ADLIB_CHANNEL_MIDWAY); /** * Checks to see whether the given block of data is already loaded into a channel. @@ -312,7 +312,7 @@ public: * @param commandId Player ommand to execute. * @param param Optional parameter used by a few commands */ - virtual int command(int commandId, int param = 0) = 0; + virtual int command(int commandId, int param) = 0; /** * Stop all currently playing sounds @@ -402,7 +402,7 @@ private: public: ASound1(Audio::Mixer *mixer); - virtual int command(int commandId, int param = 0); + virtual int command(int commandId, int param); }; } // End of namespace Nebular diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index 7c51842ae2..aca1298a23 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -28,6 +28,15 @@ namespace MADS { +void RGB6::load(Common::SeekableReadStream *f) { + r = f->readByte(); + g = f->readByte(); + b = f->readByte(); + palIndex = f->readByte(); + u2 = f->readByte(); + flags = f->readByte(); +} + RGBList::RGBList(int numEntries, byte *srcData, bool freeData) { _size = numEntries; assert(numEntries <= PALETTE_COUNT); @@ -52,6 +61,111 @@ RGBList::~RGBList() { /*------------------------------------------------------------------------*/ +PaletteUsage::PaletteUsage() { +} + +void PaletteUsage::load(int count, ...) { + va_list va; + va_start(va, count); + + _data.clear(); + for (int i = 0; i < count; ++i) + _data.push_back(va_arg(va, int)); + + va_end(va); +} + + +void PaletteUsage::getKeyEntries(Common::Array &palette) { + _data.clear(); + + for (uint i = 0; i < palette.size(); ++i) { + byte *uPtr = &palette[i].flags; + if ((*uPtr & 0x10) && _data.size() < 3) { + _data.push_back(i); + } + } +} + +void PaletteUsage::prioritize(Common::Array &palette) { + int lst[3]; + + for (uint i = 0; i < _data.size(); ++i) { + RGB6 &palEntry = palette[_data[i]]; + lst[i] = rgbMerge(palEntry); + } + + prioritizeFromList(lst); +} + +int PaletteUsage::rgbMerge(RGB6 &palEntry) { + return palEntry.r * 38 + palEntry.g * 76 + palEntry.b * 14; +} + +void PaletteUsage::prioritizeFromList(int lst[3]) { + int idx1 = _data.size() - 1; + bool continueFlag; + int count2; + + do { + continueFlag = false; + count2 = 0; + + if (idx1 > 0) { + int numEntries = _data.size() - 1; + int usageIndex = 0, lstIndex = 0; + + do { + if (lst[lstIndex] < lst[lstIndex + 1]) { + int lstVal = lst[lstIndex]; + int usageVal = _data[usageIndex]; + + if (numEntries > 0) { + Common::copy(&lst[lstIndex + 1], &lst[lstIndex + numEntries], &lst[lstIndex]); + _data.remove_at(usageIndex); + _data.push_back(0); + } + + int newIdx = 0; + if (idx1 > 0 && !continueFlag) { + for (newIdx = 0; newIdx <= idx1; ++newIdx) { + if (lst[newIdx] > lstVal) + break; + } + } + + continueFlag = true; + int idxDiff = _data.size() - newIdx - 1; + if (idxDiff > 0) { + Common::copy_backward(&lst[0], &lst[2], &lst[1]); + _data.remove_at(2); + _data.insert_at(0, 0); + } + + lst[newIdx] = lstVal; + _data[newIdx] = usageVal; + } + + ++usageIndex; + --numEntries; + ++lstIndex; + ++count2; + } while (count2 > idx1 && !continueFlag); + } + } while (continueFlag); +} + +void PaletteUsage::transform(Common::Array &palette) { + if (!empty()) { + for (uint i = 0; i < _data.size(); ++i) { + int palIndex = _data[i]; + _data[i] = palette[palIndex].palIndex; + } + } +} + +/*------------------------------------------------------------------------*/ + #define VGA_COLOR_TRANS(x) (x == 0x3f ? 255 : x << 2) Palette::Palette(MADSEngine *vm) : _vm(vm) { diff --git a/engines/mads/palette.h b/engines/mads/palette.h index d0d7007586..820e50fb21 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -37,6 +37,17 @@ struct RGB4 { byte u; }; +struct RGB6 { + byte r; + byte g; + byte b; + byte palIndex; + byte u2; + byte flags; + + void load(Common::SeekableReadStream *f); +}; + /** * Used to store a list of RGB values */ @@ -73,6 +84,44 @@ public: int size() const { return _size; } }; +class PaletteUsage { +private: + Common::Array _data; + + int rgbMerge(RGB6 &palEntry); + + void prioritizeFromList(int lst[3]); +public: + PaletteUsage(); + + void load(int count, ...); + + /** + * Returns whether the usage list is empty + */ + bool empty() const { return _data.size() == 0; } + + /** + * Gets key entries from the passed palette + * @param palette 6-bit per entry read in palette + */ + void getKeyEntries(Common::Array &palette); + + /** + * Prioritizes the palette index list based on the intensity of the + * RGB values of the palette entries that they refer to + */ + void prioritize(Common::Array &palette); + + bool process(Common::Array &palette, int v) { + warning("TODO: PaletteUsage::process"); + return 0; + } + + void transform(Common::Array &palette); +}; + + #define PALETTE_COUNT 256 #define PALETTE_SIZE (256 * 3) @@ -95,6 +144,7 @@ protected: public: byte _mainPalette[PALETTE_SIZE]; RGB4 _gamePalette[PALETTE_COUNT]; + PaletteUsage _paletteUsage; public: /** * Constructor diff --git a/engines/mads/resources.cpp b/engines/mads/resources.cpp index f24f7d2fc7..8cfc1a290a 100644 --- a/engines/mads/resources.cpp +++ b/engines/mads/resources.cpp @@ -305,7 +305,7 @@ Common::String Resources::formatName(RESPREFIX resType, int id, const Common::St Common::String Resources::formatResource(const Common::String &resName, const Common::String &hagFilename) { - int v1 = 0, v2 = 0; +// int v1 = 0, v2 = 0; if (resName.hasPrefix("*")) { // Resource file specified diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 138cab500a..e9ae3e6ddd 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -34,7 +34,6 @@ Scene::Scene(MADSEngine *vm): _vm(vm), _spriteSlots(vm) { _vocabBuffer = nullptr; _sceneLogic = nullptr; _sceneInfo = nullptr; - _scenePalette = nullptr; _verbList.push_back(VerbInit(VERB_LOOK, 2, 0)); _verbList.push_back(VerbInit(VERB_TAKE, 2, 0)); @@ -46,7 +45,6 @@ Scene::Scene(MADSEngine *vm): _vm(vm), _spriteSlots(vm) { _verbList.push_back(VerbInit(VERB_PULL, 2, 0)); _verbList.push_back(VerbInit(VERB_CLOSE, 2, 0)); _verbList.push_back(VerbInit(VERB_THROW, 1, 2)); - Common::fill((byte *)&_nullPalette[0], (byte *)&_nullPalette[3], 0); } Scene::~Scene() { @@ -121,7 +119,7 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) { _sequences.clear(); _messages.clear(); - setPalette(_nullPalette); + // TODO: palletteUsage reset? setPalette(_nullPalette); _sceneInfo = SceneInfo::load(_vm, _currentSceneId, _v1, Common::String(), _vm->_game->_v2 ? 17 : 16, _depthSurface, _backgroundSurface); } @@ -178,8 +176,4 @@ void Scene::free() { warning("TODO: Scene::free"); } -void Scene::setPalette(RGB4 *p) { -// _scenePalette = p; -} - } // End of namespace MADS diff --git a/engines/mads/scene.h b/engines/mads/scene.h index efe89c2b09..a1edff5bdf 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -70,8 +70,6 @@ public: int _textSpacing; Common::Array _hotspots; ScreenObjects _screenObjects; - ScenePalette *_scenePalette; - RGB4 _nullPalette[2]; int _v1; SceneInfo *_sceneInfo; MSurface _backgroundSurface; @@ -134,12 +132,6 @@ public: * Loads the vocab list */ void loadVocab(); - - /** - * Set the scene palette - */ - void setPalette(RGB4 *p); - /** * Clear the data for the scene diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index aac70750b8..e0c25d89fb 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -23,6 +23,7 @@ #include "common/scummsys.h" #include "mads/scene_data.h" #include "mads/mads.h" +#include "mads/compression.h" #include "mads/resources.h" #include "mads/nebular/nebular_scenes.h" @@ -126,7 +127,6 @@ KernelMessage::KernelMessage() { _asciiChar = '\0'; _asciiChar2 = '\0'; _colors = 0; - Common::Point _posiition; _msgOffset = 0; _numTicks = 0; _frameTimer2 = 0; @@ -164,28 +164,28 @@ Hotspot::Hotspot(Common::SeekableReadStream &f) { /*------------------------------------------------------------------------*/ -void ARTHeader::load(Common::SeekableReadStream &f) { - _width = f.readUint16LE(); - _height = f.readUint16LE(); +void ARTHeader::load(Common::SeekableReadStream *f) { + // Read in dimensions of image + _width = f->readUint16LE(); + _height = f->readUint16LE(); - _palCount = f.readUint16LE(); - for (int i = 0; i < 256; ++i) { + // Read in palette information + int palCount = f->readUint16LE(); + for (int i = 0; i < palCount; ++i) { RGB6 rgb; - rgb.r = f.readByte(); - rgb.g = f.readByte(); - rgb.b = f.readByte(); - f.read(&rgb.unused[0], 3); - + rgb.load(f); _palette.push_back(rgb); } + f->skip(6 * (256 - palCount)); - int palCount = f.readUint16LE(); + // Read unknown??? + palCount = f->readUint16LE(); for (int i = 0; i < palCount; ++i) { RGB4 rgb; - rgb.r = f.readByte(); - rgb.g = f.readByte(); - rgb.b = f.readByte(); - rgb.u = f.readByte(); + rgb.r = f->readByte(); + rgb.g = f->readByte(); + rgb.b = f->readByte(); + rgb.u = f->readByte(); _palData.push_back(rgb); } @@ -203,12 +203,9 @@ SceneInfo::SceneInfo(MADSEngine *vm, int sceneId, int v1, const Common::String & bool flag = true; bool sceneFlag = sceneId >= 0; bool ssFlag = false, wsFlag = false; - int handle = 0; - SpriteAsset *spriteSets[10]; - int xpList[10]; - Common::fill(&spriteSets[0], &spriteSets[10], (SpriteAsset *)nullptr); - Common::fill(&xpList[0], &xpList[10], -1); + Common::Array spriteSets; + Common::Array xpList; // Figure out the resource to use Common::String resourceName; @@ -281,21 +278,53 @@ SceneInfo::SceneInfo(MADSEngine *vm, int sceneId, int v1, const Common::String & // Load in the ART header and palette File artFile(resourceName); + MadsPack artResource(&artFile); + Common::SeekableReadStream *stream = artResource.getItemStream(0); + ARTHeader artHeader; - artHeader.load(artFile); + artHeader.load(stream); artFile.close(); // Copy out the palette data - for (int i = 0; i < artHeader._palData.size(); ++i) + for (uint i = 0; i < artHeader._palData.size(); ++i) _palette.push_back(artHeader._palData[i]); -/* + if (!(flags & 1)) { - if (_vm->_game->_scene->_scenePalette) { - //_vm->_game->_scene->_scenePalette->clean(&artHeader._palCount); - //_vm->_game->_scene->_scenePalette->process(&artHeader._palCount) + if (!_vm->_palette->_paletteUsage.empty()) { + _vm->_palette->_paletteUsage.getKeyEntries(artHeader._palette); + _vm->_palette->_paletteUsage.prioritize(artHeader._palette); + } + + _field4C = _vm->_palette->_paletteUsage.process(artHeader._palette, 0xF800); + if (_field4C > 0) { + _vm->_palette->_paletteUsage.transform(artHeader._palette); + + for (uint i = 0; i < _palette.size(); ++i) { + byte g = _palette[i].g; + _palette[g].b = artHeader._palette[g].palIndex; + } } } - */ + + // Read in the background surface data + assert(_width == bgSurface.w && _height == bgSurface.h); + stream->read(bgSurface.getPixels(), bgSurface.w * bgSurface.h); + + if (flags & 1) { + for (uint i = 0; i < _setNames.size(); ++i) { + Common::String setResName; + if (sceneFlag || resName.hasPrefix("*")) + setResName += "*"; + setResName += _setNames[i]; + + SpriteAsset *sprites = new SpriteAsset(_vm, setResName, flags); + spriteSets.push_back(sprites); + xpList.push_back(-1); // TODO:: sprites->_field6 + } + } + + + warning("TODO"); } @@ -326,12 +355,4 @@ void SceneInfo::loadCodes(MSurface &depthSurface) { /*------------------------------------------------------------------------*/ -void ScenePalette::clean(int *palCount) { - warning("TODO: ScenePalette::clean"); -} - -void ScenePalette::process(int *palCount) { - warning("TODO: ScenePalette::process"); -} - } // End of namespace MADS diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index 2fcd3f9ae4..74a1ff8e68 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -214,6 +214,11 @@ public: */ SceneLogic(Scene *scene): _scene(scene) {} + /** + * Destructor + */ + virtual ~SceneLogic() {} + /** * Called to initially setup a scene */ @@ -245,21 +250,13 @@ public: virtual void postActions() = 0; }; -struct RGB6 { - byte r; - byte g; - byte b; - byte unused[3]; -}; - struct ARTHeader { int _width; int _height; - int _palCount; Common::Array _palette; Common::Array _palData; - void load(Common::SeekableReadStream &f); + void load(Common::SeekableReadStream *f); }; /** @@ -303,12 +300,6 @@ public: const Common::String &resName, int v3, MSurface &depthSurface, MSurface &bgSurface); }; -class ScenePalette { -public: - void clean(int *palCount); - void process(int *palCount); -}; - } // End of namespace MADS #endif /* MADS_SCENE_DATA_H */ -- cgit v1.2.3 From 7f8b2025c0f4e8ee3378b4c7317f31bf31e889ec Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 1 Mar 2014 20:19:02 -0500 Subject: MADS: Basic scne info loading is now working --- engines/mads/assets.cpp | 9 ++-- engines/mads/assets.h | 3 ++ engines/mads/game_data.cpp | 2 +- engines/mads/scene_data.cpp | 103 +++++++++++++++++++++++++++++++------------- engines/mads/scene_data.h | 10 ++++- 5 files changed, 90 insertions(+), 37 deletions(-) diff --git a/engines/mads/assets.cpp b/engines/mads/assets.cpp index 4c075d054e..f7188e9551 100644 --- a/engines/mads/assets.cpp +++ b/engines/mads/assets.cpp @@ -49,8 +49,6 @@ SpriteAsset::SpriteAsset(MADSEngine *vm, const Common::String &resourceName, int spriteStream->readUint16LE(); } _frameCount = spriteStream->readUint16LE(); - // we skip the rest of the data - delete spriteStream; // Get the palette data spriteStream = sprites.getItemStream(2); @@ -64,7 +62,6 @@ SpriteAsset::SpriteAsset(MADSEngine *vm, const Common::String &resourceName, int delete[] palData; delete spriteStream; - spriteStream = sprites.getItemStream(1); Common::SeekableReadStream *spriteDataStream = sprites.getItemStream(3); SpriteAssetFrame frame; @@ -87,9 +84,13 @@ SpriteAsset::SpriteAsset(MADSEngine *vm, const Common::String &resourceName, int _frames.push_back(frame); } - delete spriteStream; delete spriteDataStream; file.close(); } +void SpriteAsset::drawScaled(int frameNumber, MSurface &depthSurface, MSurface &destSurface, + int scale, int depth, const Common::Point &pos) { + warning("TODO: SpriteAsset::drawScaled"); +} + } // End of namespace MADS diff --git a/engines/mads/assets.h b/engines/mads/assets.h index c64209eab2..5964036789 100644 --- a/engines/mads/assets.h +++ b/engines/mads/assets.h @@ -62,6 +62,9 @@ public: MSprite *getFrame(int frameIndex); byte *getPalette() { return _palette; } int getColorCount() { return _colorCount; } + + void drawScaled(int frameNumber, MSurface &depthSurface, MSurface &destSurface, + int scale, int depth, const Common::Point &pos); }; } // End of namespace MADS diff --git a/engines/mads/game_data.cpp b/engines/mads/game_data.cpp index df4a902c25..e39b85c9ae 100644 --- a/engines/mads/game_data.cpp +++ b/engines/mads/game_data.cpp @@ -53,7 +53,7 @@ void InventoryObject::load(Common::SeekableReadStream &f) { for (int i = 0; i < 3; ++i) { _vocabList[i]._actionFlags1 = f.readByte(); _vocabList[i]._actionFlags2 = f.readByte(); - _vocabList[i]._vocabId = f.readByte(); + _vocabList[i]._vocabId = f.readUint16LE(); } f.skip(4); // field12 diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index e0c25d89fb..8fe03f2056 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -193,6 +193,18 @@ void ARTHeader::load(Common::SeekableReadStream *f) { /*------------------------------------------------------------------------*/ +void SceneInfo::SpriteInfo::load(Common::SeekableReadStream *f) { + f->skip(3); + _spriteSetIndex = f->readByte(); + f->skip(2); + _position.x = f->readSint16LE(); + _position.y = f->readSint16LE(); + _depth = f->readByte(); + _scale = f->readByte(); +} + +/*------------------------------------------------------------------------*/ + SceneInfo *SceneInfo::load(MADSEngine *vm, int sceneId, int v1, const Common::String &resName, int v3, MSurface &depthSurface, MSurface &bgSurface) { return new SceneInfo(vm, sceneId, v1, resName, v3, depthSurface, bgSurface); @@ -200,13 +212,9 @@ SceneInfo *SceneInfo::load(MADSEngine *vm, int sceneId, int v1, const Common::St SceneInfo::SceneInfo(MADSEngine *vm, int sceneId, int v1, const Common::String &resName, int flags, MSurface &depthSurface, MSurface &bgSurface) { - bool flag = true; + _vm = vm; bool sceneFlag = sceneId >= 0; - bool ssFlag = false, wsFlag = false; - Common::Array spriteSets; - Common::Array xpList; - // Figure out the resource to use Common::String resourceName; if (sceneFlag) { @@ -216,54 +224,70 @@ SceneInfo::SceneInfo(MADSEngine *vm, int sceneId, int v1, const Common::String & } // Open the scene info resource for access - File infoFile(resName); + File infoFile(resourceName); + MadsPack infoPack(&infoFile); // Read in basic data - _sceneId = infoFile.readUint16LE(); - _artFileNum = infoFile.readUint16LE(); - _depthStyle = infoFile.readUint16LE(); - _width = infoFile.readUint16LE(); - _height = infoFile.readUint16LE(); - infoFile.skip(24); - _nodeCount = infoFile.readUint16LE(); - _yBandsEnd = infoFile.readUint16LE(); - _yBandsStart = infoFile.readUint16LE(); - _maxScale = infoFile.readUint16LE(); - _minScale = infoFile.readUint16LE(); + Common::SeekableReadStream *infoStream = infoPack.getItemStream(0); + _sceneId = infoStream->readUint16LE(); + _artFileNum = infoStream->readUint16LE(); + _depthStyle = infoStream->readUint16LE(); + _width = infoStream->readUint16LE(); + _height = infoStream->readUint16LE(); + infoStream->skip(24); + _nodeCount = infoStream->readUint16LE(); + _yBandsEnd = infoStream->readUint16LE(); + _yBandsStart = infoStream->readUint16LE(); + _maxScale = infoStream->readUint16LE(); + _minScale = infoStream->readUint16LE(); for (int i = 0; i < 15; ++i) - _depthList[i] = infoFile.readUint16LE(); - _field4A = infoFile.readUint16LE(); + _depthList[i] = infoStream->readUint16LE(); + _field4A = infoStream->readUint16LE(); // Load the set of objects that are associated with the scene for (int i = 0; i < 20; ++i) { InventoryObject obj; - obj.load(infoFile); + obj.load(*infoStream); _objects.push_back(obj); } - int setCount = infoFile.readUint16LE(); - int field40E = infoFile.readUint16LE(); + int spriteSetsCount = infoStream->readUint16LE(); + int spriteInfoCount = infoStream->readUint16LE(); - for (int i = 0; i < 20; ++i) { + // Load in sprite sets + Common::StringArray setNames; + for (int i = 0; i < 10; ++i) { char name[64]; - infoFile.read(name, 64); - _setNames.push_back(Common::String(name)); + infoStream->read(name, 64); + + if (i < spriteSetsCount) + setNames.push_back(Common::String(name)); } + // Load in sprite draw information + Common::Array spriteInfo; + for (int i = 0; i < 50; ++i) { + SpriteInfo info; + info.load(infoStream); + + if (i < spriteInfoCount) + spriteInfo.push_back(info); + } + + delete infoStream; infoFile.close(); + int width = _width; int height = _height; if (!bgSurface.getPixels()) { bgSurface.setSize(width, height); - ssFlag = true; } if (_depthStyle == 2) width >>= 2; if (!depthSurface.getPixels()) { depthSurface.setSize(width, height); - wsFlag = true; } // Load the depth surface with the scene codes @@ -271,7 +295,7 @@ SceneInfo::SceneInfo(MADSEngine *vm, int sceneId, int v1, const Common::String & // Get the ART resource if (sceneFlag) { - resourceName = Resources::formatName(RESPREFIX_RM, sceneId, ".ART"); + resourceName = Resources::formatName(RESPREFIX_RM, _artFileNum, ".ART"); } else { resourceName = "*" + Resources::formatResource(resName, resName); } @@ -283,6 +307,7 @@ SceneInfo::SceneInfo(MADSEngine *vm, int sceneId, int v1, const Common::String & ARTHeader artHeader; artHeader.load(stream); + delete stream; artFile.close(); // Copy out the palette data @@ -310,12 +335,15 @@ SceneInfo::SceneInfo(MADSEngine *vm, int sceneId, int v1, const Common::String & assert(_width == bgSurface.w && _height == bgSurface.h); stream->read(bgSurface.getPixels(), bgSurface.w * bgSurface.h); + Common::Array spriteSets; + Common::Array xpList; + if (flags & 1) { - for (uint i = 0; i < _setNames.size(); ++i) { + for (uint i = 0; i < setNames.size(); ++i) { Common::String setResName; if (sceneFlag || resName.hasPrefix("*")) setResName += "*"; - setResName += _setNames[i]; + setResName += setNames[i]; SpriteAsset *sprites = new SpriteAsset(_vm, setResName, flags); spriteSets.push_back(sprites); @@ -323,9 +351,22 @@ SceneInfo::SceneInfo(MADSEngine *vm, int sceneId, int v1, const Common::String & } } + warning("TODO: sub_201E4(xpList, namesCount, &pal data2"); + + for (uint i = 0; i < spriteInfo.size(); ++i) { + SpriteInfo &si = spriteInfo[i]; + SpriteAsset *asset = spriteSets[si._spriteSetIndex]; + assert(asset && _depthStyle != 2); + asset->drawScaled(asset->getCount(), depthSurface, bgSurface, + si._scale, si._depth, si._position); + } - warning("TODO"); + // Free the sprite sets + for (int i = (int)spriteSets.size() - 1; i >= 0; --i) { + warning("TODO: sub_201C8 SPRITE_SET.field_6"); + delete spriteSets[i]; + } } void SceneInfo::loadCodes(MSurface &depthSurface) { diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index 74a1ff8e68..bcdd50a9d0 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -263,6 +263,15 @@ struct ARTHeader { * Handles general data for a given scene */ class SceneInfo { + class SpriteInfo { + public: + int _spriteSetIndex; + Common::Point _position; + int _depth; + int _scale; + + void load(Common::SeekableReadStream *f); + }; private: MADSEngine *_vm; @@ -290,7 +299,6 @@ public: int _field4C; Common::Array _objects; - Common::StringArray _setNames; Common::Array _palette; public: /** -- cgit v1.2.3 From 411a4054006be03c0c465b2707c5ef7c50eb87a1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 1 Mar 2014 22:53:08 -0500 Subject: MADS: Further fixes for SceneInfo data loading --- engines/mads/scene.cpp | 3 ++- engines/mads/scene_data.cpp | 53 ++++++++++++++++++++++++++++++++++++++------- engines/mads/scene_data.h | 39 ++++++++++++++++++++++++++------- 3 files changed, 78 insertions(+), 17 deletions(-) diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index e9ae3e6ddd..c640ff8da1 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -120,7 +120,8 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) { _messages.clear(); // TODO: palletteUsage reset? setPalette(_nullPalette); - _sceneInfo = SceneInfo::load(_vm, _currentSceneId, _v1, Common::String(), _vm->_game->_v2 ? 17 : 16, + _sceneInfo = SceneInfo::init(_vm); + _sceneInfo->load(_currentSceneId, _v1, Common::String(), _vm->_game->_v2 ? 17 : 16, _depthSurface, _backgroundSurface); } diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index 8fe03f2056..0204699165 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -205,14 +205,17 @@ void SceneInfo::SpriteInfo::load(Common::SeekableReadStream *f) { /*------------------------------------------------------------------------*/ -SceneInfo *SceneInfo::load(MADSEngine *vm, int sceneId, int v1, const Common::String &resName, - int v3, MSurface &depthSurface, MSurface &bgSurface) { - return new SceneInfo(vm, sceneId, v1, resName, v3, depthSurface, bgSurface); +SceneInfo *SceneInfo::init(MADSEngine *vm) { + if (vm->getGameID() == GType_RexNebular) { + return new SceneInfoNebular(vm); + } + else { + return new SceneInfo(vm); + } } -SceneInfo::SceneInfo(MADSEngine *vm, int sceneId, int v1, const Common::String &resName, +void SceneInfo::load(int sceneId, int v1, const Common::String &resName, int flags, MSurface &depthSurface, MSurface &bgSurface) { - _vm = vm; bool sceneFlag = sceneId >= 0; // Figure out the resource to use @@ -308,7 +311,6 @@ SceneInfo::SceneInfo(MADSEngine *vm, int sceneId, int v1, const Common::String & ARTHeader artHeader; artHeader.load(stream); delete stream; - artFile.close(); // Copy out the palette data for (uint i = 0; i < artHeader._palData.size(); ++i) @@ -333,8 +335,13 @@ SceneInfo::SceneInfo(MADSEngine *vm, int sceneId, int v1, const Common::String & // Read in the background surface data assert(_width == bgSurface.w && _height == bgSurface.h); + stream = artResource.getItemStream(1); stream->read(bgSurface.getPixels(), bgSurface.w * bgSurface.h); + // Close the ART file + delete stream; + artFile.close(); + Common::Array spriteSets; Common::Array xpList; @@ -371,13 +378,17 @@ SceneInfo::SceneInfo(MADSEngine *vm, int sceneId, int v1, const Common::String & void SceneInfo::loadCodes(MSurface &depthSurface) { File f(Resources::formatName(RESPREFIX_RM, _sceneId, ".DAT")); + MadsPack codesPack(&f); + Common::SeekableReadStream *stream = codesPack.getItemStream(0); uint16 width = _width; uint16 height = _height; - byte *walkMap = new byte[f.size()]; + byte *walkMap = new byte[stream->size()]; depthSurface.setSize(width, height); - f.read(walkMap, f.size()); + stream->read(walkMap, f.size()); + delete stream; + f.close(); byte *ptr = (byte *)depthSurface.getPixels(); @@ -396,4 +407,30 @@ void SceneInfo::loadCodes(MSurface &depthSurface) { /*------------------------------------------------------------------------*/ +void SceneInfoNebular::loadCodes(MSurface &depthSurface) { + File f(Resources::formatName(RESPREFIX_RM, _sceneId, ".DAT")); + MadsPack codesPack(&f); + Common::SeekableReadStream *stream = codesPack.getItemStream(0); + + byte *destP = depthSurface.getData(); + byte *endP = depthSurface.getBasePtr(0, depthSurface.h); + + byte runLength = stream->readByte(); + while (destP < endP && runLength > 0) { + byte runValue = stream->readByte(); + + // Write out the run length + Common::fill(destP, destP + runLength, runValue); + destP += runLength; + + // Get the next run length + runLength = stream->readByte(); + } + + if (destP < endP) + Common::fill(destP, endP, 0); + delete stream; + f.close(); +} + } // End of namespace MADS diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index bcdd50a9d0..1b98b9d165 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -272,16 +272,18 @@ class SceneInfo { void load(Common::SeekableReadStream *f); }; -private: +protected: MADSEngine *_vm; - SceneInfo(MADSEngine *vm, int sceneId, int v1, const Common::String &resName, - int v3, MSurface &depthSurface, MSurface &bgSurface); - + /** + * Constructor + */ + SceneInfo(MADSEngine *vm) : _vm(vm) {} + /** * Loads the given surface with depth information of a given scene */ - void loadCodes(MSurface &depthSurface); + virtual void loadCodes(MSurface &depthSurface); public: int _sceneId; int _artFileNum; @@ -302,10 +304,31 @@ public: Common::Array _palette; public: /** - * Instantiates the class and loads the data + * Destructor */ - static SceneInfo *load(MADSEngine *vm, int sceneId, int flags, - const Common::String &resName, int v3, MSurface &depthSurface, MSurface &bgSurface); + virtual ~SceneInfo() {} + + /** + * Instantiates the class + */ + static SceneInfo *init(MADSEngine *vm); + + /** + loads the data + */ + void load(int sceneId, int flags, const Common::String &resName, int v3, + MSurface &depthSurface, MSurface &bgSurface); +}; + +class SceneInfoNebular : public SceneInfo { + friend class SceneInfo; +protected: + virtual void loadCodes(MSurface &depthSurface); + + /** + * Constructor + */ + SceneInfoNebular(MADSEngine *vm) : SceneInfo(vm) {} }; } // End of namespace MADS -- cgit v1.2.3 From 4bd1217dafbc2c28b731bd58d4ebd7b0b16a712e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 2 Mar 2014 10:49:20 -0500 Subject: MADS: Added loading for scene nodes and hotspost --- engines/mads/events.h | 5 +++ engines/mads/mads.h | 7 ++--- engines/mads/palette.cpp | 6 ++-- engines/mads/palette.h | 3 ++ engines/mads/scene.cpp | 76 ++++++++++++++++++++++++++++++++++++++++----- engines/mads/scene.h | 12 +++++++ engines/mads/scene_data.cpp | 35 ++++++++++++++------- engines/mads/scene_data.h | 30 +++++++++++++++--- 8 files changed, 145 insertions(+), 29 deletions(-) diff --git a/engines/mads/events.h b/engines/mads/events.h index 01f48170d4..0e990c5258 100644 --- a/engines/mads/events.h +++ b/engines/mads/events.h @@ -116,6 +116,11 @@ public: * Delay for a given number of frames */ void delay(int amount); + + /** + * Gets the current frame counter + */ + uint32 getFrameCounter() const { return _gameCounter; } }; } // End of namespace MADS diff --git a/engines/mads/mads.h b/engines/mads/mads.h index 44630ca135..92758b72a5 100644 --- a/engines/mads/mads.h +++ b/engines/mads/mads.h @@ -75,10 +75,6 @@ private: const MADSGameDescription *_gameDescription; Common::RandomSource _randomSource; - bool _easyMouse; - bool _invObjectStill; - bool _textWindowStill; - /** * Handles basic initialisation */ @@ -98,6 +94,9 @@ public: MSurface *_screen; SoundManager *_sound; UserInterface *_userInterface; + bool _easyMouse; + bool _invObjectStill; + bool _textWindowStill; public: MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc); diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index aca1298a23..b26329a65c 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -68,9 +68,11 @@ void PaletteUsage::load(int count, ...) { va_list va; va_start(va, count); - _data.clear(); + if (count > (int)_data.size()) + _data.resize(count); + for (int i = 0; i < count; ++i) - _data.push_back(va_arg(va, int)); + _data[i] = va_arg(va, int); va_end(va); } diff --git a/engines/mads/palette.h b/engines/mads/palette.h index 820e50fb21..18b058cccc 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -30,6 +30,8 @@ namespace MADS { class MADSEngine; +#define PALETTE_USAGE_COUNT 4 + struct RGB4 { byte r; byte g; @@ -143,6 +145,7 @@ protected: void reset(); public: byte _mainPalette[PALETTE_SIZE]; + byte _savedPalette[PALETTE_SIZE]; RGB4 _gamePalette[PALETTE_COUNT]; PaletteUsage _paletteUsage; public: diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index c640ff8da1..af53710c34 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -22,6 +22,7 @@ #include "common/scummsys.h" #include "mads/scene.h" +#include "mads/compression.h" #include "mads/mads.h" #include "mads/nebular/nebular_scenes.h" @@ -34,6 +35,8 @@ Scene::Scene(MADSEngine *vm): _vm(vm), _spriteSlots(vm) { _vocabBuffer = nullptr; _sceneLogic = nullptr; _sceneInfo = nullptr; + _animFlag = false; + _animVal1 = 0; _verbList.push_back(VerbInit(VERB_LOOK, 2, 0)); _verbList.push_back(VerbInit(VERB_TAKE, 2, 0)); @@ -123,15 +126,46 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) { _sceneInfo = SceneInfo::init(_vm); _sceneInfo->load(_currentSceneId, _v1, Common::String(), _vm->_game->_v2 ? 17 : 16, _depthSurface, _backgroundSurface); + + // Initialise palette animation for the scene + initPaletteAnimation(_sceneInfo->_palAnimData, false); + + // Copy over nodes + _nodes.clear(); + for (uint i = 0; i < _sceneInfo->_nodes.size(); ++i) + _nodes.push_back(_sceneInfo->_nodes[i]); + + // Load hotspots + loadHotspots(); + + // Load vocab + loadVocab(); + + // Load palette usage + _vm->_palette->_paletteUsage.load(1, 0xF); + + // Load interface + int flags = _vm->_game->_v2 ? 0x4101 : 0x4100; + if (!_vm->_textWindowStill) + flags |= 0x200; + // TODO } void Scene::loadHotspots() { File f(Resources::formatName(RESPREFIX_RM, _currentSceneId, ".HH")); - int count = f.readUint16LE(); + MadsPack madsPack(&f); + + Common::SeekableReadStream *stream = madsPack.getItemStream(0); + int count = stream->readUint16LE(); + delete stream; + stream = madsPack.getItemStream(1); _hotspots.clear(); for (int i = 0; i < count; ++i) - _hotspots.push_back(Hotspot(f)); + _hotspots.push_back(Hotspot(*stream)); + + delete stream; + f.close(); } void Scene::loadVocab() { @@ -163,14 +197,42 @@ void Scene::loadVocabStrings() { freeVocab(); File f("*VOCAB.DAT"); - byte *d = new byte[ f.size()]; - f.read(d, f.size()); - + char *textStrings = new char[f.size()]; + f.read(textStrings, f.size()); -// int vocabId = 1; for (uint strIndex = 0; strIndex < _activeVocabs.size(); ++strIndex) { - // TODO: Rest of this method + const char *s = textStrings; + for (int vocabIndex = 0; vocabIndex < _activeVocabs[strIndex]; ++vocabIndex) + s += strlen(s) + 1; + + _vocabStrings.push_back(s); } + + delete[] textStrings; + f.close(); +} + +void Scene::initPaletteAnimation(Common::Array &animData, bool animFlag) { + // Initialise the animation palette and ticks list + _animTicksList.clear(); + _animPalData.clear(); + + for (uint i = 0; i < animData.size(); ++i) { + _animTicksList.push_back(_vm->_events->getFrameCounter()); + _animPalData.push_back(animData[i]); + } + + // Save the initial starting palette + Common::copy(&_vm->_palette->_mainPalette[0], &_vm->_palette->_mainPalette[PALETTE_SIZE], + &_vm->_palette->_savedPalette[0]); + + // Calculate total + _animCount = 0; + for (uint i = 0; i < _animPalData.size(); ++i) + _animCount += _animPalData[i].r; + + _animVal1 = (_animCount > 16) ? 3 : 0; + _animFlag = animFlag; } void Scene::free() { diff --git a/engines/mads/scene.h b/engines/mads/scene.h index a1edff5bdf..6bbab0fbbd 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -48,6 +48,11 @@ private: * Secondary loading vocab list */ void loadVocabStrings(); + + /* + * Initialises the data for palette animation within the scene + */ + void initPaletteAnimation(Common::Array &animData, bool animFlag); protected: MADSEngine *_vm; public: @@ -74,6 +79,13 @@ public: SceneInfo *_sceneInfo; MSurface _backgroundSurface; MSurface _depthSurface; + bool _animFlag; + int _animVal1; + int _animCount; + Common::Array _animTicksList; + Common::Array _animPalData; + SceneNodeList _nodes; + Common::StringArray _vocabStrings; /** * Constructor diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index 0204699165..07a2ae856d 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -187,12 +187,21 @@ void ARTHeader::load(Common::SeekableReadStream *f) { rgb.b = f->readByte(); rgb.u = f->readByte(); - _palData.push_back(rgb); + _palAnimData.push_back(rgb); } } /*------------------------------------------------------------------------*/ +void SceneNode::load(Common::SeekableReadStream *f) { + _walkPos.x = f->readSint16LE(); + _walkPos.y = f->readSint16LE(); + for (int i = 0; i < MAX_ROUTE_NODES; ++i) + _indexes[i] = f->readUint16LE(); +} + +/*------------------------------------------------------------------------*/ + void SceneInfo::SpriteInfo::load(Common::SeekableReadStream *f) { f->skip(3); _spriteSetIndex = f->readByte(); @@ -237,21 +246,25 @@ void SceneInfo::load(int sceneId, int v1, const Common::String &resName, _depthStyle = infoStream->readUint16LE(); _width = infoStream->readUint16LE(); _height = infoStream->readUint16LE(); + infoStream->skip(24); - _nodeCount = infoStream->readUint16LE(); + + int nodeCount = infoStream->readUint16LE(); _yBandsEnd = infoStream->readUint16LE(); _yBandsStart = infoStream->readUint16LE(); _maxScale = infoStream->readUint16LE(); _minScale = infoStream->readUint16LE(); - for (int i = 0; i < 15; ++i) + for (int i = 0; i < DEPTH_BANDS_SIZE; ++i) _depthList[i] = infoStream->readUint16LE(); _field4A = infoStream->readUint16LE(); // Load the set of objects that are associated with the scene for (int i = 0; i < 20; ++i) { - InventoryObject obj; - obj.load(*infoStream); - _objects.push_back(obj); + SceneNode node; + node.load(infoStream); + + if (i < nodeCount) + _nodes.push_back(node); } int spriteSetsCount = infoStream->readUint16LE(); @@ -313,8 +326,8 @@ void SceneInfo::load(int sceneId, int v1, const Common::String &resName, delete stream; // Copy out the palette data - for (uint i = 0; i < artHeader._palData.size(); ++i) - _palette.push_back(artHeader._palData[i]); + for (uint i = 0; i < artHeader._palAnimData.size(); ++i) + _palAnimData.push_back(artHeader._palAnimData[i]); if (!(flags & 1)) { if (!_vm->_palette->_paletteUsage.empty()) { @@ -326,9 +339,9 @@ void SceneInfo::load(int sceneId, int v1, const Common::String &resName, if (_field4C > 0) { _vm->_palette->_paletteUsage.transform(artHeader._palette); - for (uint i = 0; i < _palette.size(); ++i) { - byte g = _palette[i].g; - _palette[g].b = artHeader._palette[g].palIndex; + for (uint i = 0; i < _palAnimData.size(); ++i) { + byte g = _palAnimData[i].g; + _palAnimData[g].b = artHeader._palAnimData[g].u; } } } diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index 1b98b9d165..2fe5c849c1 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -50,6 +50,9 @@ enum { VERB_WALKTO = 13 }; +#define DEPTH_BANDS_SIZE 15 +#define MAX_ROUTE_NODES 22 + class VerbInit { public: int _id; @@ -254,10 +257,28 @@ struct ARTHeader { int _width; int _height; Common::Array _palette; - Common::Array _palData; + Common::Array _palAnimData; + + void load(Common::SeekableReadStream *f); +}; + +class SceneNode { +public: + Common::Point _walkPos; + int _indexes[MAX_ROUTE_NODES]; + bool _active; + /** + * Constructor + */ + SceneNode() : _active(false) {} + + /** + * Loads the scene node + */ void load(Common::SeekableReadStream *f); }; +typedef Common::Array SceneNodeList; /** * Handles general data for a given scene @@ -291,17 +312,16 @@ public: int _width; int _height; - int _nodeCount; int _yBandsEnd; int _yBandsStart; int _maxScale; int _minScale; - int _depthList[15]; + int _depthList[DEPTH_BANDS_SIZE]; int _field4A; int _field4C; - Common::Array _objects; - Common::Array _palette; + Common::Array _palAnimData; + SceneNodeList _nodes; public: /** * Destructor -- cgit v1.2.3 From 7912f81f2cef0a3dfad86d1a87d68771c13f7744 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 2 Mar 2014 11:38:56 -0500 Subject: MADS: Added skeleton file for animation class --- engines/mads/module.mk | 1 + engines/mads/palette.cpp | 6 ++---- engines/mads/scene.cpp | 3 ++- engines/mads/scene.h | 3 +++ engines/mads/scene_data.h | 20 +++++++++++++++++--- 5 files changed, 25 insertions(+), 8 deletions(-) diff --git a/engines/mads/module.mk b/engines/mads/module.mk index 62441ab3c9..94c231e206 100644 --- a/engines/mads/module.mk +++ b/engines/mads/module.mk @@ -6,6 +6,7 @@ MODULE_OBJS := \ nebular/sound_nebular.o \ nebular/nebular_scenes.o \ nebular/nebular_scenes8.o \ + animation.o \ assets.o \ compression.o \ debugger.o \ diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index b26329a65c..aca1298a23 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -68,11 +68,9 @@ void PaletteUsage::load(int count, ...) { va_list va; va_start(va, count); - if (count > (int)_data.size()) - _data.resize(count); - + _data.clear(); for (int i = 0; i < count; ++i) - _data[i] = va_arg(va, int); + _data.push_back(va_arg(va, int)); va_end(va); } diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index af53710c34..eaa1cab7fa 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -148,7 +148,8 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) { int flags = _vm->_game->_v2 ? 0x4101 : 0x4100; if (!_vm->_textWindowStill) flags |= 0x200; - // TODO + _animation = Animation::init(_vm, this); + } void Scene::loadHotspots() { diff --git a/engines/mads/scene.h b/engines/mads/scene.h index 6bbab0fbbd..7a7959e917 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -29,6 +29,7 @@ #include "mads/assets.h" #include "mads/msurface.h" #include "mads/scene_data.h" +#include "mads/animation.h" namespace MADS { @@ -79,6 +80,7 @@ public: SceneInfo *_sceneInfo; MSurface _backgroundSurface; MSurface _depthSurface; + MSurface _interfaceSurface; bool _animFlag; int _animVal1; int _animCount; @@ -86,6 +88,7 @@ public: Common::Array _animPalData; SceneNodeList _nodes; Common::StringArray _vocabStrings; + Animation *_animation; /** * Constructor diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index 2fe5c849c1..c646215bbf 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -50,9 +50,19 @@ enum { VERB_WALKTO = 13 }; +enum MadsActionMode { ACTMODE_NONE = 0, ACTMODE_VERB = 1, ACTMODE_OBJECT = 3, ACTMODE_TALK = 6 }; +enum MadsActionMode2 { ACTMODE2_0 = 0, ACTMODE2_2 = 2, ACTMODE2_4 = 4, ACTMODE2_5 = 5 }; +enum AbortTimerMode { ABORTMODE_0 = 0, ABORTMODE_1 = 1, ABORTMODE_2 = 2 }; + #define DEPTH_BANDS_SIZE 15 #define MAX_ROUTE_NODES 22 +struct ActionDetails { + int verbId; + int objectNameId; + int indirectObjectId; +}; + class VerbInit { public: int _id; @@ -75,15 +85,19 @@ enum SpriteType { ST_FULL_SCREEN_REFRESH = -2, ST_EXPIRED = -1 }; -class SpriteSlot { +class SpriteSlotSubset { public: - SpriteType _spriteType; - int _seqIndex; int _spritesIndex; int _frameNumber; Common::Point _position; int _depth; int _scale; +}; + +class SpriteSlot: public SpriteSlotSubset { +public: + SpriteType _spriteType; + int _seqIndex; public: SpriteSlot(); SpriteSlot(SpriteType type, int seqIndex); -- cgit v1.2.3 From e17fdb5aaba0c4a4482367282fdc1df56f4b6115 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 2 Mar 2014 11:41:46 -0500 Subject: MADS: Actually added new animation files --- engines/mads/animation.cpp | 37 +++++++++++++++++++++++++++++++ engines/mads/animation.h | 55 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 engines/mads/animation.cpp create mode 100644 engines/mads/animation.h diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp new file mode 100644 index 0000000000..f5144c3c49 --- /dev/null +++ b/engines/mads/animation.cpp @@ -0,0 +1,37 @@ +/* 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 "mads/animation.h" + +namespace MADS { + +Animation *Animation::init(MADSEngine *vm, Scene *scene) { + return new Animation(vm, scene); +} + +void Animation::load(MSurface *sceneSurface, MSurface *interfaceSurface, int sceneId, + int flags, byte *palette, SceneInfo *sceneInfo) { + +} + + +} // End of namespace MADS diff --git a/engines/mads/animation.h b/engines/mads/animation.h new file mode 100644 index 0000000000..cc46143b32 --- /dev/null +++ b/engines/mads/animation.h @@ -0,0 +1,55 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_ANIMATION_H +#define MADS_ANIMATION_H + +#include "common/scummsys.h" +#include "common/array.h" +#include "common/rect.h" +#include "mads/msurface.h" +#include "mads/scene_data.h" + +namespace MADS { + +class MADSEngine; +class Scene; + +class Animation { +private: + MADSEngine *_vm; + Scene *_scene; +protected: + Animation(MADSEngine *vm, Scene *scene) : _vm(vm), _scene(scene) {} +public: + static Animation *init(MADSEngine *vm, Scene *scene); +public: + /** + * Loads animation data + */ + void load(MSurface *sceneSurface, MSurface *interfaceSurface, int sceneId, int flags, + byte *palette, SceneInfo *sceneInfo); +}; + +} // End of namespace MADS + +#endif /* MADS_ANIMATION_H */ -- cgit v1.2.3 From cc810add7479b024138f31fc559f5a9cf7f7a459 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 2 Mar 2014 16:42:39 -0500 Subject: MADS: In progress implementing animation loader --- engines/mads/animation.cpp | 242 +++++++++++++++++++++++++++++++++++++++++++- engines/mads/animation.h | 83 ++++++++++++++- engines/mads/font.cpp | 6 ++ engines/mads/font.h | 5 + engines/mads/graphics.h | 1 - engines/mads/scene.cpp | 1 + engines/mads/scene.h | 3 +- engines/mads/scene_data.cpp | 35 ++++++- engines/mads/scene_data.h | 8 ++ engines/mads/sound.cpp | 4 + engines/mads/sound.h | 5 + 11 files changed, 384 insertions(+), 9 deletions(-) diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index f5144c3c49..dd62e7b0f0 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -21,17 +21,255 @@ */ #include "mads/animation.h" +#include "mads/compression.h" + +#define FILENAME_SIZE 64 namespace MADS { + +AAHeader::AAHeader(Common::SeekableReadStream *f) { + _spriteListCount = f->readUint16LE(); + _miscEntriesCount = f->readUint16LE(); + _frameEntriesCount = f->readUint16LE(); + _messagesCount = f->readUint16LE(); + f->skip(1); + _flags = f->readByte(); + + f->skip(2); + _animMode = f->readUint16LE(); + _roomNumber = f->readUint16LE(); + f->skip(2); + _field12 = f->readUint16LE() != 0; + _spriteListIndex = f->readUint16LE(); + _scrollPosition.x = f->readSint16LE(); + _scrollPosition.y = f->readSint16LE(); + _scrollTicks = f->readUint16LE(); + f->skip(8); + + char buffer[FILENAME_SIZE]; + f->read(buffer, FILENAME_SIZE); + buffer[FILENAME_SIZE] = '\0'; + _interfaceFile = Common::String(buffer); + + for (int i = 0; i < 10; ++i) { + f->read(buffer, FILENAME_SIZE); + buffer[FILENAME_SIZE] = '\0'; + _spriteSetNames[i] = Common::String(buffer); + } + + f->skip(81); + f->read(buffer, FILENAME_SIZE); + buffer[FILENAME_SIZE] = '\0'; + _lbmFilename = Common::String(buffer); + + f->skip(365); + f->read(buffer, FILENAME_SIZE); + buffer[FILENAME_SIZE] = '\0'; + _spritesFilename = Common::String(buffer); + + f->skip(48); + f->read(buffer, FILENAME_SIZE); + buffer[FILENAME_SIZE] = '\0'; + _soundName = Common::String(buffer); + + f->skip(13); + f->read(buffer, FILENAME_SIZE); + buffer[FILENAME_SIZE] = '\0'; + _dsrName = Common::String(buffer); + + f->read(buffer, FILENAME_SIZE); + buffer[FILENAME_SIZE] = '\0'; + Common::String fontResource(buffer); +} + +/*------------------------------------------------------------------------*/ + +void AnimMessage::load(Common::SeekableReadStream *f) { + _soundId = f->readSint16LE(); + + char buffer[64]; + f->read(&buffer[0], 64); + _msg = Common::String(buffer); + f->skip(4); + _pos.x = f->readSint16LE(); + _pos.y = f->readSint16LE(); + _flags = f->readUint16LE(); + _rgb1[0] = f->readByte() << 2; + _rgb1[1] = f->readByte() << 2; + _rgb1[2] = f->readByte() << 2; + _rgb2[0] = f->readByte() << 2; + _rgb2[1] = f->readByte() << 2; + _rgb2[2] = f->readByte() << 2; + f->skip(2); // Space for kernelMsgIndex + _kernelMsgIndex = -1; + f->skip(6); + _startFrame = f->readUint16LE(); + _endFrame = f->readUint16LE(); + f->skip(2); +} + +void AnimFrameEntry::load(Common::SeekableReadStream *f) { + _frameNumber = f->readUint16LE(); + _seqIndex = f->readByte(); + _spriteSlot._spritesIndex = f->readByte(); + _spriteSlot._frameNumber = f->readUint16LE(); + _spriteSlot._position.x = f->readSint16LE(); + _spriteSlot._position.y = f->readSint16LE(); + _spriteSlot._depth = f->readSByte(); + _spriteSlot._scale = (int8)f->readByte(); +} + +/*------------------------------------------------------------------------*/ + +void AnimMiscEntry::load(Common::SeekableReadStream *f) { + _soundId = f->readByte(); + _msgIndex = f->readSByte(); + _numTicks = f->readUint16LE(); + _posAdjust.x = f->readSint16LE(); + _posAdjust.y = f->readSint16LE(); + _scrollPos.x = f->readSint16LE(); + _scrollPos.y = f->readSint16LE(); +} + +/*------------------------------------------------------------------------*/ Animation *Animation::init(MADSEngine *vm, Scene *scene) { return new Animation(vm, scene); } -void Animation::load(MSurface *sceneSurface, MSurface *interfaceSurface, int sceneId, - int flags, byte *palette, SceneInfo *sceneInfo) { +void Animation::load(MSurface &depthSurface, InterfaceSurface &interfaceSurface, + const Common::String &resName, int flags, Common::Array *palAnimData, + SceneInfo *sceneInfo) { + Common::String resourceName = resName; + if (!resourceName.contains(".")) + resourceName += ".AA"; + + File f(resourceName); + MadsPack madsPack(&f); + Common::SeekableReadStream *stream = madsPack.getItemStream(0); + AAHeader aaHeader(stream); + delete stream; + + if (aaHeader._animMode == 4) + flags |= 0x4000; + + if (flags & 0x100) { + loadInterface(interfaceSurface, depthSurface, aaHeader, flags, palAnimData, sceneInfo); + } + if (flags & 0x200) { + // No data + aaHeader._messagesCount = 0; + aaHeader._frameEntriesCount = 0; + aaHeader._miscEntriesCount = 0; + } + + // Initialize the reference list + for (int i = 0; i < aaHeader._spriteListCount; ++i) + _spriteListIndexes.push_back(-1); + + if (aaHeader._messagesCount > 0) { + // Chunk 2: Following is a list of any messages for the animation + Common::SeekableReadStream *msgStream = madsPack.getItemStream(1); + + for (int i = 0; i < aaHeader._messagesCount; ++i) { + AnimMessage rec; + rec.load(msgStream); + _messages.push_back(rec); + } + + delete msgStream; + } + + if (aaHeader._frameEntriesCount > 0) { + // Chunk 3: animation frame info + Common::SeekableReadStream *frameStream = madsPack.getItemStream(2); + + for (int i = 0; i < aaHeader._frameEntriesCount; i++) { + AnimFrameEntry rec; + rec.load(frameStream); + _frameEntries.push_back(rec); + } + + delete frameStream; + } + + if (aaHeader._miscEntriesCount > 0) { + // Chunk 4: Misc Data + Common::SeekableReadStream *miscStream = madsPack.getItemStream(3); + + for (int i = 0; i < aaHeader._miscEntriesCount; ++i) { + AnimMiscEntry rec; + rec.load(miscStream); + _miscEntries.push_back(rec); + } + + delete miscStream; + } + /* + // If the animation specifies a font, then load it for access + if (_flags & ANIM_CUSTOM_FONT) { + Common::String fontName; + if (madsRes) + fontName += "*"; + fontName += fontResource; + + if (fontName != "") + _font = _vm->_font->getFont(fontName.c_str()); + else + warning("Attempted to set a font with an empty name"); + } + + // If a speech file is specified, then load it + if (!_dsrName.empty()) + _vm->_sound->loadDSRFile(_dsrName.c_str()); + + // Load all the sprite sets for the animation + for (int i = 0; i < spriteListCount; ++i) { + if (_field12 && (i == _spriteListIndex)) + // Skip over field, since it's manually loaded + continue; + + _spriteListIndexes[i] = _view->_spriteSlots.addSprites(_spriteSetNames[i].c_str()); + } + + + if (_field12) { + Common::String resName; + if (madsRes) + resName += "*"; + resName += _spriteSetNames[_spriteListIndex]; + + _spriteListIndexes[_spriteListIndex] = _view->_spriteSlots.addSprites(resName.c_str()); + } + */ + f.close(); } +void Animation::loadInterface(InterfaceSurface &interfaceSurface, MSurface &depthSurface, + AAHeader &header, int flags, Common::Array *palAnimData, SceneInfo *sceneInfo) { + _scene->_depthStyle = 0; + if (header._animMode <= 2) { + sceneInfo->load(header._roomNumber, flags, header._interfaceFile, 0, depthSurface, interfaceSurface); + _scene->_depthStyle = sceneInfo->_depthStyle == 2 ? 1 : 0; + if (palAnimData) { + palAnimData->clear(); + for (uint i = 0; i < sceneInfo->_palAnimData.size(); ++i) + palAnimData->push_back(sceneInfo->_palAnimData[i]); + } + } + else if (header._animMode == 4) { + // Load a scene interface + Common::String resourceName = "*" + header._interfaceFile; + interfaceSurface.load(_vm, resourceName); + + if (palAnimData) + palAnimData->clear(); + } + else { + // Original has useless code here + } +} + } // End of namespace MADS diff --git a/engines/mads/animation.h b/engines/mads/animation.h index cc46143b32..1e542da590 100644 --- a/engines/mads/animation.h +++ b/engines/mads/animation.h @@ -31,23 +31,102 @@ namespace MADS { +enum AnimFlag { ANIM_CUSTOM_FONT = 0x20 }; + class MADSEngine; class Scene; +class AnimMessage { +public: + int16 _soundId; + Common::String _msg; + Common::Point _pos; + byte _rgb1[3], _rgb2[3]; + int _flags; + int _startFrame, _endFrame; + int _kernelMsgIndex; + + /** + * Loads data for the message from a stream + */ + void load(Common::SeekableReadStream *f); +}; + +class AnimFrameEntry { +public: + int _frameNumber; + int _seqIndex; + SpriteSlotSubset _spriteSlot; + + /** + * Loads data for the record + */ + void load(Common::SeekableReadStream *f); +}; + +class AnimMiscEntry { +public: + int _soundId; + int _msgIndex; + int _numTicks; + Common::Point _posAdjust; + Common::Point _scrollPos; + + /** + * Loads data for the record + */ + void load(Common::SeekableReadStream *f); +}; + +class AAHeader { +public: + int _spriteListCount; + int _miscEntriesCount; + int _frameEntriesCount; + int _messagesCount; + byte _flags; + int _animMode; + int _roomNumber; + int _field12; + int _spriteListIndex; + Common::Point _scrollPosition; + uint32 _scrollTicks; + Common::String _interfaceFile; + Common::StringArray _spriteSetNames; + Common::String _lbmFilename; + Common::String _spritesFilename; + Common::String _soundName; + Common::String _dsrName; + Common::String _fontResource; + + /** + * Loads the data for a animation file header + */ + AAHeader(Common::SeekableReadStream *f); +}; + class Animation { private: MADSEngine *_vm; Scene *_scene; + + void loadInterface(InterfaceSurface &interfaceSurface, MSurface &depthSurface, + AAHeader &header, int flags, Common::Array *palAnimData, SceneInfo *sceneInfo); protected: Animation(MADSEngine *vm, Scene *scene) : _vm(vm), _scene(scene) {} public: static Animation *init(MADSEngine *vm, Scene *scene); +public: + Common::Array _spriteListIndexes; + Common::Array _messages; + Common::Array _frameEntries; + Common::Array _miscEntries; public: /** * Loads animation data */ - void load(MSurface *sceneSurface, MSurface *interfaceSurface, int sceneId, int flags, - byte *palette, SceneInfo *sceneInfo); + void load(MSurface &depthSurface, InterfaceSurface &interfaceSurface, const Common::String &resName, + int flags, Common::Array *palAnimData, SceneInfo *sceneInfo); }; } // End of namespace MADS diff --git a/engines/mads/font.cpp b/engines/mads/font.cpp index 52541500c9..10d51fbbc0 100644 --- a/engines/mads/font.cpp +++ b/engines/mads/font.cpp @@ -205,4 +205,10 @@ int Font::getBpp(int charWidth) { return 1; } +Font *Font::getFont(const Common::String &fontName) { + Font *font = new Font(_vm); + font->setFont(fontName); + return font; +} + } // End of namespace MADS diff --git a/engines/mads/font.h b/engines/mads/font.h index 3deb3f4d2d..c642831952 100644 --- a/engines/mads/font.h +++ b/engines/mads/font.h @@ -68,6 +68,11 @@ public: int writeString(MSurface *surface, const Common::String &msg, const Common::Point &pt, int width = 0, int spaceWidth = -1) { return write(surface, msg, pt, width, spaceWidth, _fontColors); } + + /** + * Returns a new Font instance using the specified font name + */ + Font *getFont(const Common::String &fontName); }; } // End of namespace MADS diff --git a/engines/mads/graphics.h b/engines/mads/graphics.h index 87cd8be3c9..cadbbc8e8e 100644 --- a/engines/mads/graphics.h +++ b/engines/mads/graphics.h @@ -29,7 +29,6 @@ namespace MADS { #define MADS_SCREEN_WIDTH 320 #define MADS_SCREEN_HEIGHT 200 -#define MADS_INTERFACE_HEIGHT 44 } // End of namespace MADS diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index eaa1cab7fa..e6c02b89e0 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -37,6 +37,7 @@ Scene::Scene(MADSEngine *vm): _vm(vm), _spriteSlots(vm) { _sceneInfo = nullptr; _animFlag = false; _animVal1 = 0; + _depthStyle = 0; _verbList.push_back(VerbInit(VERB_LOOK, 2, 0)); _verbList.push_back(VerbInit(VERB_TAKE, 2, 0)); diff --git a/engines/mads/scene.h b/engines/mads/scene.h index 7a7959e917..2c5880a405 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -80,7 +80,7 @@ public: SceneInfo *_sceneInfo; MSurface _backgroundSurface; MSurface _depthSurface; - MSurface _interfaceSurface; + InterfaceSurface _interfaceSurface; bool _animFlag; int _animVal1; int _animCount; @@ -89,6 +89,7 @@ public: SceneNodeList _nodes; Common::StringArray _vocabStrings; Animation *_animation; + int _depthStyle; /** * Constructor diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index 07a2ae856d..cec3e457a0 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -24,6 +24,7 @@ #include "mads/scene_data.h" #include "mads/mads.h" #include "mads/compression.h" +#include "mads/graphics.h" #include "mads/resources.h" #include "mads/nebular/nebular_scenes.h" @@ -214,6 +215,34 @@ void SceneInfo::SpriteInfo::load(Common::SeekableReadStream *f) { /*------------------------------------------------------------------------*/ +void InterfaceSurface::load(MADSEngine *vm, const Common::String &resName) { + File f(resName); + MadsPack madsPack(&f); + + // Load in the palette + Common::SeekableReadStream *palStream = madsPack.getItemStream(0); + + RGB4 *gamePalP = &vm->_palette->_gamePalette[0]; + byte *palP = &vm->_palette->_mainPalette[0]; + + for (int i = 0; i < 16; ++i, gamePalP++, palP += 3) { + palP[0] = palStream->readByte(); + palP[1] = palStream->readByte(); + palP[2] = palStream->readByte(); + gamePalP->r |= 1; + palStream->skip(3); + } + delete palStream; + + // set the size for the interface + setSize(MADS_SCREEN_WIDTH, MADS_INTERFACE_HEIGHT); + Common::SeekableReadStream *pixelsStream = madsPack.getItemStream(1); + pixelsStream->read(getData(), MADS_SCREEN_WIDTH * MADS_INTERFACE_HEIGHT); + delete pixelsStream; +} + +/*------------------------------------------------------------------------*/ + SceneInfo *SceneInfo::init(MADSEngine *vm) { if (vm->getGameID() == GType_RexNebular) { return new SceneInfoNebular(vm); @@ -356,7 +385,7 @@ void SceneInfo::load(int sceneId, int v1, const Common::String &resName, artFile.close(); Common::Array spriteSets; - Common::Array xpList; + Common::Array indexList; if (flags & 1) { for (uint i = 0; i < setNames.size(); ++i) { @@ -367,11 +396,11 @@ void SceneInfo::load(int sceneId, int v1, const Common::String &resName, SpriteAsset *sprites = new SpriteAsset(_vm, setResName, flags); spriteSets.push_back(sprites); - xpList.push_back(-1); // TODO:: sprites->_field6 + indexList.push_back(-1); // TODO:: sprites->_field6 } } - warning("TODO: sub_201E4(xpList, namesCount, &pal data2"); + warning("TODO: sub_201E4(indexList, namesCount, &pal data2"); for (uint i = 0; i < spriteInfo.size(); ++i) { SpriteInfo &si = spriteInfo[i]; diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index c646215bbf..23eee3403f 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -54,6 +54,9 @@ enum MadsActionMode { ACTMODE_NONE = 0, ACTMODE_VERB = 1, ACTMODE_OBJECT = 3, AC enum MadsActionMode2 { ACTMODE2_0 = 0, ACTMODE2_2 = 2, ACTMODE2_4 = 4, ACTMODE2_5 = 5 }; enum AbortTimerMode { ABORTMODE_0 = 0, ABORTMODE_1 = 1, ABORTMODE_2 = 2 }; +#define MADS_INTERFACE_HEIGHT 44 +#define MADS_SCENE_HEIGHT (MADS_SCREEN_HEIGHT - MADS_INTERFACE_HEIGHT) + #define DEPTH_BANDS_SIZE 15 #define MAX_ROUTE_NODES 22 @@ -294,6 +297,11 @@ public: }; typedef Common::Array SceneNodeList; +class InterfaceSurface : public MSurface { +public: + void load(MADSEngine *vm, const Common::String &resName); +}; + /** * Handles general data for a given scene */ diff --git a/engines/mads/sound.cpp b/engines/mads/sound.cpp index ea0239076b..ae338461ec 100644 --- a/engines/mads/sound.cpp +++ b/engines/mads/sound.cpp @@ -90,6 +90,10 @@ void SoundManager::startQueuedCommands() { } } +void SoundManager::loadDSRFile(const Common::String &filename) { + error("TODO: SoundManager::loadDSRFile"); +} + void SoundManager::command(int commandId, int param) { if (_newSoundsPaused) { if (_queuedCommands.size() < 8) diff --git a/engines/mads/sound.h b/engines/mads/sound.h index 0fd9ac1095..1fe322d6fb 100644 --- a/engines/mads/sound.h +++ b/engines/mads/sound.h @@ -77,6 +77,11 @@ public: */ void startQueuedCommands(); + /** + * Loads a DSR resource + */ + void loadDSRFile(const Common::String &filename); + //@{ /** * Executes a command on the sound driver -- cgit v1.2.3 From d5b5cbbb686596f50cdb9ea072c9178775ada720 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 2 Mar 2014 17:49:52 -0500 Subject: MADS: Implemented rest of animation loading --- engines/mads/animation.cpp | 88 +++++++++++++++++++++++++++++---------------- engines/mads/animation.h | 12 +++++-- engines/mads/scene.h | 2 +- engines/mads/scene_data.cpp | 13 +++++++ engines/mads/scene_data.h | 8 +++++ engines/mads/sound.cpp | 4 --- engines/mads/sound.h | 5 --- 7 files changed, 89 insertions(+), 43 deletions(-) diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index dd62e7b0f0..339ee72d46 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -39,7 +39,7 @@ AAHeader::AAHeader(Common::SeekableReadStream *f) { _animMode = f->readUint16LE(); _roomNumber = f->readUint16LE(); f->skip(2); - _field12 = f->readUint16LE() != 0; + _manualFlag = f->readUint16LE() != 0; _spriteListIndex = f->readUint16LE(); _scrollPosition.x = f->readSint16LE(); _scrollPosition.y = f->readSint16LE(); @@ -137,9 +137,19 @@ Animation *Animation::init(MADSEngine *vm, Scene *scene) { return new Animation(vm, scene); } +Animation::Animation(MADSEngine *vm, Scene *scene) : _vm(vm), _scene(scene) { + _font = nullptr; +} + +Animation::~Animation() { + delete _font; + for (uint i = 0; i < _spriteSets.size(); ++i) + delete _spriteSets[i]; +} + void Animation::load(MSurface &depthSurface, InterfaceSurface &interfaceSurface, - const Common::String &resName, int flags, Common::Array *palAnimData, - SceneInfo *sceneInfo) { + const Common::String &resName, int flags, Common::Array *palAnimData, + SceneInfo *sceneInfo) { Common::String resourceName = resName; if (!resourceName.contains(".")) resourceName += ".AA"; @@ -165,9 +175,11 @@ void Animation::load(MSurface &depthSurface, InterfaceSurface &interfaceSurface, } // Initialize the reference list + _spriteListIndexes.clear(); for (int i = 0; i < aaHeader._spriteListCount; ++i) _spriteListIndexes.push_back(-1); + _messages.clear(); if (aaHeader._messagesCount > 0) { // Chunk 2: Following is a list of any messages for the animation Common::SeekableReadStream *msgStream = madsPack.getItemStream(1); @@ -181,6 +193,7 @@ void Animation::load(MSurface &depthSurface, InterfaceSurface &interfaceSurface, delete msgStream; } + _frameEntries.clear(); if (aaHeader._frameEntriesCount > 0) { // Chunk 3: animation frame info Common::SeekableReadStream *frameStream = madsPack.getItemStream(2); @@ -194,6 +207,7 @@ void Animation::load(MSurface &depthSurface, InterfaceSurface &interfaceSurface, delete frameStream; } + _miscEntries.clear(); if (aaHeader._miscEntriesCount > 0) { // Chunk 4: Misc Data Common::SeekableReadStream *miscStream = madsPack.getItemStream(3); @@ -206,43 +220,55 @@ void Animation::load(MSurface &depthSurface, InterfaceSurface &interfaceSurface, delete miscStream; } - /* + // If the animation specifies a font, then load it for access - if (_flags & ANIM_CUSTOM_FONT) { - Common::String fontName; - if (madsRes) - fontName += "*"; - fontName += fontResource; - - if (fontName != "") - _font = _vm->_font->getFont(fontName.c_str()); - else - warning("Attempted to set a font with an empty name"); + delete _font; + if (aaHeader._flags & ANIM_CUSTOM_FONT) { + Common::String fontName = "*" + aaHeader._fontResource; + _font = _vm->_font->getFont(fontName.c_str()); + } else { + _font = nullptr; } - - // If a speech file is specified, then load it - if (!_dsrName.empty()) - _vm->_sound->loadDSRFile(_dsrName.c_str()); - + // Load all the sprite sets for the animation - for (int i = 0; i < spriteListCount; ++i) { - if (_field12 && (i == _spriteListIndex)) - // Skip over field, since it's manually loaded - continue; + for (uint i = 0; i < _spriteSets.size(); ++i) + delete _spriteSets[i]; + _spriteSets.clear(); + _spriteSets.resize(aaHeader._spriteListCount); - _spriteListIndexes[i] = _view->_spriteSlots.addSprites(_spriteSetNames[i].c_str()); + for (int i = 0; i < aaHeader._spriteListCount; ++i) { + if (aaHeader._manualFlag && (i == aaHeader._spriteListIndex)) { + // Skip over field, since it's manually loaded + _spriteSets[i] = nullptr; + } else { + _spriteSets[i] = new SpriteAsset(_vm, aaHeader._spriteSetNames[i], flags); + } } + if (aaHeader._manualFlag) { + Common::String resName = "*" + aaHeader._spriteSetNames[aaHeader._spriteListIndex]; + SpriteAsset *sprites = new SpriteAsset(_vm, resName, flags); + _spriteSets[aaHeader._spriteListIndex] = sprites; + + _spriteListIndexes[aaHeader._spriteListIndex] = _scene->_sprites.add(sprites); + } - if (_field12) { - Common::String resName; - if (madsRes) - resName += "*"; - resName += _spriteSetNames[_spriteListIndex]; + // TODO: List var_420/var_422 population that seems to overwrite other structures? - _spriteListIndexes[_spriteListIndex] = _view->_spriteSlots.addSprites(resName.c_str()); + if (aaHeader._animMode == 4) { + // Remaps the sprite list indexes for frames to the loaded sprite list indexes + for (uint i = 0; i < _frameEntries.size(); ++i) { + int spriteListIndex = _frameEntries[i]._spriteSlot._spritesIndex; + _frameEntries[i]._spriteSlot._spritesIndex = _spriteListIndexes[spriteListIndex]; + } + } else { + // Remaps the sprite list indexes for frames to the loaded sprite list indexes + for (uint i = 0; i < _frameEntries.size(); ++i) { + int spriteListIndex = _frameEntries[i]._spriteSlot._spritesIndex; + _frameEntries[i]._spriteSlot._spritesIndex = _spriteListIndexes[spriteListIndex]; + } } - */ + f.close(); } diff --git a/engines/mads/animation.h b/engines/mads/animation.h index 1e542da590..d96e89b1b9 100644 --- a/engines/mads/animation.h +++ b/engines/mads/animation.h @@ -28,6 +28,7 @@ #include "common/rect.h" #include "mads/msurface.h" #include "mads/scene_data.h" +#include "mads/font.h" namespace MADS { @@ -87,7 +88,7 @@ public: byte _flags; int _animMode; int _roomNumber; - int _field12; + bool _manualFlag; int _spriteListIndex; Common::Point _scrollPosition; uint32 _scrollTicks; @@ -113,7 +114,7 @@ private: void loadInterface(InterfaceSurface &interfaceSurface, MSurface &depthSurface, AAHeader &header, int flags, Common::Array *palAnimData, SceneInfo *sceneInfo); protected: - Animation(MADSEngine *vm, Scene *scene) : _vm(vm), _scene(scene) {} + Animation(MADSEngine *vm, Scene *scene); public: static Animation *init(MADSEngine *vm, Scene *scene); public: @@ -121,7 +122,14 @@ public: Common::Array _messages; Common::Array _frameEntries; Common::Array _miscEntries; + Common::Array _spriteSets; + Font *_font; public: + /* + * Destructor + */ + ~Animation(); + /** * Loads animation data */ diff --git a/engines/mads/scene.h b/engines/mads/scene.h index 2c5880a405..03980f7043 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -64,7 +64,7 @@ public: Common::Array _verbList; Common::Array _textDisplay; SpriteSlots _spriteSlots; - Common::Array _sprites; + SpriteSets _sprites; int _spritesIndex; Common::Array _dynamicHotspots; bool _dynamicHotspotsChanged; diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index cec3e457a0..db2237557b 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -78,6 +78,19 @@ void SpriteSlots::deleteEntry(int index) { remove_at(index); } +/*------------------------------------------------------------------------*/ + +int SpriteSets::add(SpriteAsset *asset, int idx) { + if (!idx) + idx = size(); + + if (idx >= (size() + 1)) + resize(idx + 1); + delete (*this)[idx]; + (*this)[idx] = asset; + + return idx; +} /*------------------------------------------------------------------------*/ diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index 23eee3403f..87fddfedd7 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -130,6 +130,14 @@ public: void deleteEntry(int index); }; +class SpriteSets: public Common::Array { +public: + /** + * Add a sprite asset to the list + */ + int add(SpriteAsset *asset, int idx = 0); +}; + class TextDisplay { public: bool _active; diff --git a/engines/mads/sound.cpp b/engines/mads/sound.cpp index ae338461ec..ea0239076b 100644 --- a/engines/mads/sound.cpp +++ b/engines/mads/sound.cpp @@ -90,10 +90,6 @@ void SoundManager::startQueuedCommands() { } } -void SoundManager::loadDSRFile(const Common::String &filename) { - error("TODO: SoundManager::loadDSRFile"); -} - void SoundManager::command(int commandId, int param) { if (_newSoundsPaused) { if (_queuedCommands.size() < 8) diff --git a/engines/mads/sound.h b/engines/mads/sound.h index 1fe322d6fb..0fd9ac1095 100644 --- a/engines/mads/sound.h +++ b/engines/mads/sound.h @@ -77,11 +77,6 @@ public: */ void startQueuedCommands(); - /** - * Loads a DSR resource - */ - void loadDSRFile(const Common::String &filename); - //@{ /** * Executes a command on the sound driver -- cgit v1.2.3 From 4931c8257df6d5dbc3d7fa1bc2b85f859cec17d9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 2 Mar 2014 18:37:09 -0500 Subject: MADS: Further animation loading and final section of scene loading code --- engines/mads/animation.cpp | 33 ++++++++++++++++----------------- engines/mads/animation.h | 2 +- engines/mads/scene.cpp | 16 ++++++++++++++++ engines/mads/scene.h | 5 +++++ engines/mads/scene_data.cpp | 2 +- engines/mads/scene_data.h | 2 +- 6 files changed, 40 insertions(+), 20 deletions(-) diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index 339ee72d46..ebb2289443 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -23,12 +23,12 @@ #include "mads/animation.h" #include "mads/compression.h" -#define FILENAME_SIZE 64 +#define FILENAME_SIZE 13 namespace MADS { AAHeader::AAHeader(Common::SeekableReadStream *f) { - _spriteListCount = f->readUint16LE(); + _spriteSetsCount = f->readUint16LE(); _miscEntriesCount = f->readUint16LE(); _frameEntriesCount = f->readUint16LE(); _messagesCount = f->readUint16LE(); @@ -43,43 +43,43 @@ AAHeader::AAHeader(Common::SeekableReadStream *f) { _spriteListIndex = f->readUint16LE(); _scrollPosition.x = f->readSint16LE(); _scrollPosition.y = f->readSint16LE(); - _scrollTicks = f->readUint16LE(); - f->skip(8); + _scrollTicks = f->readUint32LE(); + f->skip(6); char buffer[FILENAME_SIZE]; f->read(buffer, FILENAME_SIZE); - buffer[FILENAME_SIZE] = '\0'; + buffer[FILENAME_SIZE - 1] = '\0'; _interfaceFile = Common::String(buffer); for (int i = 0; i < 10; ++i) { f->read(buffer, FILENAME_SIZE); - buffer[FILENAME_SIZE] = '\0'; - _spriteSetNames[i] = Common::String(buffer); + buffer[FILENAME_SIZE - 1] = '\0'; + _spriteSetNames.push_back(Common::String(buffer)); } f->skip(81); f->read(buffer, FILENAME_SIZE); - buffer[FILENAME_SIZE] = '\0'; + buffer[FILENAME_SIZE - 1] = '\0'; _lbmFilename = Common::String(buffer); f->skip(365); f->read(buffer, FILENAME_SIZE); - buffer[FILENAME_SIZE] = '\0'; + buffer[FILENAME_SIZE - 1] = '\0'; _spritesFilename = Common::String(buffer); f->skip(48); f->read(buffer, FILENAME_SIZE); - buffer[FILENAME_SIZE] = '\0'; + buffer[FILENAME_SIZE - 1] = '\0'; _soundName = Common::String(buffer); f->skip(13); f->read(buffer, FILENAME_SIZE); - buffer[FILENAME_SIZE] = '\0'; + buffer[FILENAME_SIZE - 1] = '\0'; _dsrName = Common::String(buffer); f->read(buffer, FILENAME_SIZE); - buffer[FILENAME_SIZE] = '\0'; - Common::String fontResource(buffer); + buffer[FILENAME_SIZE - 1] = '\0'; + _fontResource = Common::String(buffer); } /*------------------------------------------------------------------------*/ @@ -176,7 +176,7 @@ void Animation::load(MSurface &depthSurface, InterfaceSurface &interfaceSurface, // Initialize the reference list _spriteListIndexes.clear(); - for (int i = 0; i < aaHeader._spriteListCount; ++i) + for (int i = 0; i < aaHeader._spriteSetsCount; ++i) _spriteListIndexes.push_back(-1); _messages.clear(); @@ -234,9 +234,9 @@ void Animation::load(MSurface &depthSurface, InterfaceSurface &interfaceSurface, for (uint i = 0; i < _spriteSets.size(); ++i) delete _spriteSets[i]; _spriteSets.clear(); - _spriteSets.resize(aaHeader._spriteListCount); + _spriteSets.resize(aaHeader._spriteSetsCount); - for (int i = 0; i < aaHeader._spriteListCount; ++i) { + for (int i = 0; i < aaHeader._spriteSetsCount; ++i) { if (aaHeader._manualFlag && (i == aaHeader._spriteListIndex)) { // Skip over field, since it's manually loaded _spriteSets[i] = nullptr; @@ -272,7 +272,6 @@ void Animation::load(MSurface &depthSurface, InterfaceSurface &interfaceSurface, f.close(); } - void Animation::loadInterface(InterfaceSurface &interfaceSurface, MSurface &depthSurface, AAHeader &header, int flags, Common::Array *palAnimData, SceneInfo *sceneInfo) { _scene->_depthStyle = 0; diff --git a/engines/mads/animation.h b/engines/mads/animation.h index d96e89b1b9..ce145cdd35 100644 --- a/engines/mads/animation.h +++ b/engines/mads/animation.h @@ -81,7 +81,7 @@ public: class AAHeader { public: - int _spriteListCount; + int _spriteSetsCount; int _miscEntriesCount; int _frameEntriesCount; int _messagesCount; diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index e6c02b89e0..23c118eaf2 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -149,8 +149,24 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) { int flags = _vm->_game->_v2 ? 0x4101 : 0x4100; if (!_vm->_textWindowStill) flags |= 0x200; + _animation = Animation::init(_vm, this); + MSurface surface; + _animation->load(surface, _interfaceSurface, prefix, flags, nullptr, nullptr); + _vm->_palette->_paletteUsage.load(0); + + _bandsRange = _sceneInfo->_yBandsEnd - _sceneInfo->_yBandsStart; + _scaleRange = _sceneInfo->_maxScale - _sceneInfo->_minScale; + + _spriteSlots.clear(false); + _screenY = 0; + _interfaceY = MADS_SCENE_HEIGHT; + _spritesCount = _sprites.size(); + + warning("TODO: sub_1EA80 / showMouse"); + + warning("TODO: inventory_anim_allocate"); } void Scene::loadHotspots() { diff --git a/engines/mads/scene.h b/engines/mads/scene.h index 03980f7043..4968291146 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -90,6 +90,11 @@ public: Common::StringArray _vocabStrings; Animation *_animation; int _depthStyle; + int _bandsRange; + int _scaleRange; + int _screenY; + int _interfaceY; + int _spritesCount; /** * Constructor diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index db2237557b..d7aaa6216d 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -84,7 +84,7 @@ int SpriteSets::add(SpriteAsset *asset, int idx) { if (!idx) idx = size(); - if (idx >= (size() + 1)) + if (idx >= (int)(size() + 1)) resize(idx + 1); delete (*this)[idx]; (*this)[idx] = asset; diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index 87fddfedd7..557a6aab2b 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -55,7 +55,7 @@ enum MadsActionMode2 { ACTMODE2_0 = 0, ACTMODE2_2 = 2, ACTMODE2_4 = 4, ACTMODE2_ enum AbortTimerMode { ABORTMODE_0 = 0, ABORTMODE_1 = 1, ABORTMODE_2 = 2 }; #define MADS_INTERFACE_HEIGHT 44 -#define MADS_SCENE_HEIGHT (MADS_SCREEN_HEIGHT - MADS_INTERFACE_HEIGHT) +#define MADS_SCENE_HEIGHT 156 #define DEPTH_BANDS_SIZE 15 #define MAX_ROUTE_NODES 22 -- cgit v1.2.3 From b816b9990d98633794f42ba49aeb971d6f9d930b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 2 Mar 2014 19:29:54 -0500 Subject: MADS: Added skeleton class for actions --- engines/mads/action.cpp | 340 ++++++++++++++++++++++++++++++++++++++++++++++ engines/mads/action.h | 113 +++++++++++++++ engines/mads/events.cpp | 6 + engines/mads/events.h | 6 + engines/mads/game.cpp | 7 +- engines/mads/game.h | 1 + engines/mads/module.mk | 1 + engines/mads/scene.cpp | 1 + engines/mads/scene.h | 3 + engines/mads/scene_data.h | 25 +--- 10 files changed, 478 insertions(+), 25 deletions(-) create mode 100644 engines/mads/action.cpp create mode 100644 engines/mads/action.h diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp new file mode 100644 index 0000000000..d27bd85a45 --- /dev/null +++ b/engines/mads/action.cpp @@ -0,0 +1,340 @@ +/* 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 "common/scummsys.h" +#include "mads/action.h" +#include "mads/scene.h" + +namespace MADS { + +MadsAction::MadsAction(Scene *scene) : _scene(scene) { + clear(); + _currentAction = VERB_NONE; + _startWalkFlag = false; + _statusTextIndex = -1; + _selectedAction = 0; + _inProgress = false; +} + +void MadsAction::clear() { + _v83338 = 1; + _actionMode = ACTMODE_NONE; + _actionMode2 = ACTMODE2_0; + _v86F42 = 0; + _v86F4E = 0; + _articleNumber = 0; + _lookFlag = false; + _v86F4A = 0; + _statusText[0] = '\0'; + _selectedRow = -1; + _hotspotId = -1; + _v86F3A = -1; + _v86F4C = -1; + _action.verbId = -1; + _action.objectNameId = -1; + _action.indirectObjectId = -1; + _textChanged = true; + _walkFlag = false; +} + +void MadsAction::appendVocab(int vocabId, bool capitalise) { + /* + char *s = _statusText + strlen(_statusText); + vocabStr = _madsVm->globals()->getVocab(vocabId); + strcpy(s, vocabStr); + if (capitalise) + *s = toupper(*s); + + strcat(s, " "); + */ +} + +void MadsAction::set() { + /* + int hotspotCount = _madsVm->scene()->getSceneResources().hotspots->size(); + bool flag = false; // FIXME: unused + strcpy(_statusText, ""); + + _currentAction = -1; + _action.objectNameId = -1; + _action.indirectObjectId = -1; + + if (_actionMode == ACTMODE_TALK) { + // Handle showing the conversation selection. Rex at least doesn't actually seem to use this + if (_selectedRow >= 0) { + const char *desc = _madsVm->_converse[_selectedRow].desc; + if (desc) + strcpy(_statusText, desc); + } + } else if (_lookFlag && (_selectedRow == 0)) { + // Two 'look' actions in succession, so the action becomes 'Look around' + strcpy(_statusText, lookAroundStr); + } else { + if ((_actionMode == ACTMODE_OBJECT) && (_selectedRow >= 0) && (_flags1 == 2) && (_flags2 == 0)) { + // Use/to action + int selectedObject = _madsVm->scene()->getInterface()->getSelectedObject(); + MadsObject *objEntry = _madsVm->globals()->getObject(selectedObject); + + _action.objectNameId = objEntry->_descId; + _currentAction = objEntry->_vocabList[_selectedRow].vocabId; + + // Set up the status text stirng + strcpy(_statusText, useStr); + appendVocab(_action.objectNameId); + strcpy(_statusText, toStr); + appendVocab(_currentAction); + } else { + // Handling for if an action has been selected + if (_selectedRow >= 0) { + if (_actionMode == ACTMODE_VERB) { + // Standard verb action + _currentAction = verbList[_selectedRow].verb; + } else { + // Selected action on an inventory object + int selectedObject = _madsVm->scene()->getInterface()->getSelectedObject(); + MadsObject *objEntry = _madsVm->globals()->getObject(selectedObject); + + _currentAction = objEntry->_vocabList[_selectedRow].vocabId; + } + + appendVocab(_currentAction, true); + + if (_currentAction == kVerbLook) { + // Add in the word 'add' + strcat(_statusText, atStr); + strcat(_statusText, " "); + } + } + + // Handling for if a hotspot has been selected/highlighted + if ((_hotspotId >= 0) && (_selectedRow >= 0) && (_articleNumber > 0) && (_flags1 == 2)) { + flag = true; + + strcat(_statusText, englishMADSArticleList[_articleNumber]); + strcat(_statusText, " "); + } + + if (_hotspotId >= 0) { + if (_selectedRow < 0) { + int verbId; + + if (_hotspotId < hotspotCount) { + // Get the verb Id from the hotspot + verbId = (*_madsVm->scene()->getSceneResources().hotspots)[_hotspotId].getVerbID(); + } else { + // Get the verb Id from the scene object + verbId = (*_madsVm->scene()->getSceneResources().dynamicHotspots)[_hotspotId - hotspotCount].getVerbID(); + } + + if (verbId > 0) { + // Set the specified action + _currentAction = verbId; + appendVocab(_currentAction, true); + } else { + // Default to a standard 'walk to' + _currentAction = kVerbWalkTo; + strcat(_statusText, walkToStr); + } + } + + if ((_actionMode2 == ACTMODE2_2) || (_actionMode2 == ACTMODE2_5)) { + // Get name from given inventory object + int objectId = _madsVm->scene()->getInterface()->getInventoryObject(_hotspotId); + _action.objectNameId = _madsVm->globals()->getObject(objectId)->_descId; + } else if (_hotspotId < hotspotCount) { + // Get name from scene hotspot + _action.objectNameId = (*_madsVm->scene()->getSceneResources().hotspots)[_hotspotId].getVocabID(); + } else { + // Get name from temporary scene hotspot + _action.objectNameId = (*_madsVm->scene()->getSceneResources().dynamicHotspots)[_hotspotId].getVocabID(); + } + appendVocab(_action.objectNameId); + } + } + + if ((_hotspotId >= 0) && (_articleNumber > 0) && !flag) { + if (_articleNumber == -1) { + if (_v86F3A >= 0) { + int articleNum = 0; + + if ((_v86F42 == 2) || (_v86F42 == 5)) { + int objectId = _madsVm->scene()->getInterface()->getInventoryObject(_hotspotId); + articleNum = _madsVm->globals()->getObject(objectId)->_article; + } else if (_v86F3A < hotspotCount) { + articleNum = (*_madsVm->scene()->getSceneResources().hotspots)[_hotspotId].getArticle(); + } else { + + } + } + + } else if ((_articleNumber == kVerbLook) || (_vm->getGameType() != GType_RexNebular) || + (strcmp(_madsVm->globals()->getVocab(_action.indirectObjectId), fenceStr) != 0)) { + // Write out the article + strcat(_statusText, englishMADSArticleList[_articleNumber]); + } else { + // Special case for a 'fence' entry in Rex Nebular + strcat(_statusText, overStr); + } + + strcat(_statusText, " "); + } + + // Append object description if necessary + if (_v86F3A >= 0) + appendVocab(_action.indirectObjectId); + + // Remove any trailing space character + int statusLen = strlen(_statusText); + if ((statusLen > 0) && (_statusText[statusLen - 1] == ' ')) + _statusText[statusLen - 1] = '\0'; + } + + _textChanged = true; + */ +} + +void MadsAction::refresh() { + /* + // Exit immediately if nothing has changed + if (!_textChanged) + return; + + // Remove any old copy of the status text + if (_statusTextIndex >= 0) { + _owner._textDisplay.expire(_statusTextIndex); + _statusTextIndex = -1; + } + + if (_statusText[0] != '\0') { + if ((_owner._screenObjects._v832EC == 0) || (_owner._screenObjects._v832EC == 2)) { + Font *font = _madsVm->_font->getFont(FONT_MAIN_MADS); + int textSpacing = -1; + + int strWidth = font->getWidth(_statusText); + if (strWidth > 320) { + // Too large to fit, so fall back on interface font + font = _madsVm->_font->getFont(FONT_INTERFACE_MADS); + strWidth = font->getWidth(_statusText, 0); + textSpacing = 0; + } + + // Add a new text display entry to display the status text at the bottom of the screen area + uint colors = (_vm->getGameType() == GType_DragonSphere) ? 0x0300 : 0x0003; + + _statusTextIndex = _owner._textDisplay.add(160 - (strWidth / 2), + MADS_SURFACE_HEIGHT + _owner._posAdjust.y - 13, colors, textSpacing, _statusText, font); + } + } + + _textChanged = false; + */ +} + +void MadsAction::startAction() { + /* + _madsVm->_player.moveComplete(); + + _inProgress = true; + _v8453A = ABORTMODE_0; + _savedFields.selectedRow = _selectedRow; + _savedFields.articleNumber = _articleNumber; + _savedFields.actionMode = _actionMode; + _savedFields.actionMode2 = _actionMode2; + _savedFields.lookFlag = _lookFlag; + int savedHotspotId = _hotspotId; + int savedV86F3A = _v86F3A; + int savedV86F42 = _v86F42; + + // Copy the action to be active + _activeAction = _action; + strcpy(_dialogTitle, _statusText); + + if ((_savedFields.actionMode2 == ACTMODE2_4) && (savedV86F42 == 0)) + _v8453A = ABORTMODE_1; + + _startWalkFlag = false; + int hotspotId = -1; + HotSpotList &dynHotspots = *_madsVm->scene()->getSceneResources().dynamicHotspots; + HotSpotList &hotspots = *_madsVm->scene()->getSceneResources().hotspots; + + if (!_savedFields.lookFlag && (_madsVm->scene()->_screenObjects._v832EC != 1)) { + if (_savedFields.actionMode2 == ACTMODE2_4) + hotspotId = savedHotspotId; + else if (savedV86F42 == 4) + hotspotId = savedV86F3A; + + if (hotspotId >= hotspots.size()) { + HotSpot &hs = dynHotspots[hotspotId - hotspots.size()]; + if ((hs.getFeetX() == -1) || (hs.getFeetX() == -3)) { + if (_v86F4A && ((hs.getFeetX() == -3) || (_savedFields.selectedRow < 0))) { + _startWalkFlag = true; + _madsVm->scene()->_destPos = _madsVm->scene()->_customDest; + } + } else if ((hs.getFeetX() >= 0) && ((_savedFields.actionMode == ACTMODE_NONE) || (hs.getCursor() < 2))) { + _startWalkFlag = true; + _madsVm->scene()->_destPos.x = hs.getFeetX(); + _madsVm->scene()->_destPos.y = hs.getFeetY(); + } + _madsVm->scene()->_destFacing = hs.getFacing(); + hotspotId = -1; + } + } + + if (hotspotId >= 0) { + HotSpot &hs = hotspots[hotspotId]; + if ((hs.getFeetX() == -1) || (hs.getFeetX() == -3)) { + if (_v86F4A && ((hs.getFeetX() == -3) || (_savedFields.selectedRow < 0))) { + _startWalkFlag = true; + _madsVm->scene()->_destPos = _madsVm->scene()->_customDest; + } + } else if ((hs.getFeetX() >= 0) && ((_savedFields.actionMode == ACTMODE_NONE) || (hs.getCursor() < 2))) { + _startWalkFlag = true; + _madsVm->scene()->_destPos.x = hs.getFeetX(); + _madsVm->scene()->_destPos.y = hs.getFeetY(); + } + _madsVm->scene()->_destFacing = hs.getFacing(); + } + + _walkFlag = _startWalkFlag; + */ +} + +void MadsAction::checkAction() { + /* + if (isAction(kVerbLookAt) || isAction(kVerbThrow)) + _startWalkFlag = 0; + */ +} + +bool MadsAction::isAction(int verbId, int objectNameId, int indirectObjectId) { + /* + if (_activeAction.verbId != verbId) + return false; + if ((objectNameId != 0) && (_activeAction.objectNameId != objectNameId)) + return false; + if ((indirectObjectId != 0) && (_activeAction.indirectObjectId != indirectObjectId)) + return false; + */ + return true; +} + +} // End of namespace MADS diff --git a/engines/mads/action.h b/engines/mads/action.h new file mode 100644 index 0000000000..a29d43baa0 --- /dev/null +++ b/engines/mads/action.h @@ -0,0 +1,113 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_ACTION_H +#define MADS_ACTION_H + +#include "common/scummsys.h" + +namespace MADS { + +enum ActionMode { ACTMODE_NONE = 0, ACTMODE_VERB = 1, ACTMODE_OBJECT = 3, ACTMODE_TALK = 6 }; +enum ActionMode2 { ACTMODE2_0 = 0, ACTMODE2_2 = 2, ACTMODE2_4 = 4, ACTMODE2_5 = 5 }; +enum AbortTimerMode { ABORTMODE_0 = 0, ABORTMODE_1 = 1, ABORTMODE_2 = 2 }; + +enum { + VERB_NONE = 0, + VERB_LOOK = 3, + VERB_TAKE = 4, + VERB_PUSH = 5, + VERB_OPEN = 6, + VERB_PUT = 7, + VERB_TALKTO = 8, + VERB_GIVE = 9, + VERB_PULL = 10, + VERB_CLOSE = 11, + VERB_THROW = 12, + VERB_WALKTO = 13 +}; + +class Scene; + +struct ActionDetails { + int verbId; + int objectNameId; + int indirectObjectId; +}; + +struct MadsActionSavedFields { + int articleNumber; + int actionMode; + int actionMode2; + bool lookFlag; + int selectedRow; +}; + +class MadsAction { +private: + Scene *_scene; + char _statusText[100]; + char _dialogTitle[100]; + + void appendVocab(int vocabId, bool capitalise = false); +public: + ActionDetails _action, _activeAction; + int _currentAction; + int8 _flags1, _flags2; + ActionMode _actionMode; + ActionMode2 _actionMode2; + int _articleNumber; + bool _lookFlag; + int _selectedRow; + bool _textChanged; + int _selectedAction; + bool _startWalkFlag; + int _statusTextIndex; + int _hotspotId; + MadsActionSavedFields _savedFields; + bool _walkFlag; + + // Unknown fields + int16 _v86F3A; + int16 _v86F42; + int16 _v86F4E; + bool _v86F4A; + int16 _v86F4C; + int _v83338; + bool _inProgress; + AbortTimerMode _v8453A; + +public: + MadsAction(Scene *scene); + + void clear(); + void set(); + const char *statusText() const { return _statusText; } + void refresh(); + void startAction(); + void checkAction(); + bool isAction(int verbId, int objectNameId = 0, int indirectObjectId = 0); +}; + +} // End of namespace MADS + +#endif /* MADS_ACTION_H */ diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp index 8f177f2c20..5d905ca8d6 100644 --- a/engines/mads/events.cpp +++ b/engines/mads/events.cpp @@ -157,4 +157,10 @@ void EventsManager::delay(int cycles) { } } +void EventsManager::initVars() { + _mousePos = Common::Point(-1, -1); + _vD4 = _vCC; + _vD2 = _vD8 = 0; +} + } // End of namespace MADS diff --git a/engines/mads/events.h b/engines/mads/events.h index 0e990c5258..2a8ae84e6a 100644 --- a/engines/mads/events.h +++ b/engines/mads/events.h @@ -42,6 +42,10 @@ private: uint32 _gameCounter; uint32 _priorFrameTime; Common::Point _mousePos; + int _vCC; + int _vD4; + int _vD8; + int _vD2; /** * Updates the cursor image when the current cursor changes @@ -121,6 +125,8 @@ public: * Gets the current frame counter */ uint32 getFrameCounter() const { return _gameCounter; } + + void initVars(); }; } // End of namespace MADS diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 08d548e235..a3351f5a7b 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -24,10 +24,11 @@ #include "mads/mads.h" #include "mads/game.h" #include "mads/game_data.h" -#include "mads/nebular/game_nebular.h" +#include "mads/events.h" #include "mads/graphics.h" #include "mads/msurface.h" #include "mads/resources.h" +#include "mads/nebular/game_nebular.h" namespace MADS { @@ -170,6 +171,10 @@ void Game::sectionLoop() { _playerSpritesFlag = false; } + _vm->_events->initVars(); + _scene._v1A = -1; + _scene._v1C = -1; + _objectHiliteVocabIdx = -1; // TODO: main section loop logic goes here diff --git a/engines/mads/game.h b/engines/mads/game.h index b8add9ab00..562e0b99d0 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -67,6 +67,7 @@ protected: int _v6; Common::String _aaName; bool _playerSpritesFlag; + int _objectHiliteVocabIdx; /** * Constructor diff --git a/engines/mads/module.mk b/engines/mads/module.mk index 94c231e206..f27b808099 100644 --- a/engines/mads/module.mk +++ b/engines/mads/module.mk @@ -6,6 +6,7 @@ MODULE_OBJS := \ nebular/sound_nebular.o \ nebular/nebular_scenes.o \ nebular/nebular_scenes8.o \ + action.o \ animation.o \ assets.o \ compression.o \ diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 23c118eaf2..90f5cbd0cf 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -38,6 +38,7 @@ Scene::Scene(MADSEngine *vm): _vm(vm), _spriteSlots(vm) { _animFlag = false; _animVal1 = 0; _depthStyle = 0; + _v1A = _v1C = 0; _verbList.push_back(VerbInit(VERB_LOOK, 2, 0)); _verbList.push_back(VerbInit(VERB_TAKE, 2, 0)); diff --git a/engines/mads/scene.h b/engines/mads/scene.h index 4968291146..bafe499d09 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -95,6 +95,8 @@ public: int _screenY; int _interfaceY; int _spritesCount; + int _v1A; + int _v1C; /** * Constructor @@ -154,6 +156,7 @@ public: */ void loadVocab(); + /** * Clear the data for the scene */ diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index 557a6aab2b..6be54cf3e1 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -28,6 +28,7 @@ #include "common/str.h" #include "common/str-array.h" #include "common/rect.h" +#include "mads/action.h" #include "mads/assets.h" #include "mads/game_data.h" @@ -36,36 +37,12 @@ namespace MADS { class MADSEngine; class Scene; -enum { - VERB_LOOK = 3, - VERB_TAKE = 4, - VERB_PUSH = 5, - VERB_OPEN = 6, - VERB_PUT = 7, - VERB_TALKTO = 8, - VERB_GIVE = 9, - VERB_PULL = 10, - VERB_CLOSE = 11, - VERB_THROW = 12, - VERB_WALKTO = 13 -}; - -enum MadsActionMode { ACTMODE_NONE = 0, ACTMODE_VERB = 1, ACTMODE_OBJECT = 3, ACTMODE_TALK = 6 }; -enum MadsActionMode2 { ACTMODE2_0 = 0, ACTMODE2_2 = 2, ACTMODE2_4 = 4, ACTMODE2_5 = 5 }; -enum AbortTimerMode { ABORTMODE_0 = 0, ABORTMODE_1 = 1, ABORTMODE_2 = 2 }; - #define MADS_INTERFACE_HEIGHT 44 #define MADS_SCENE_HEIGHT 156 #define DEPTH_BANDS_SIZE 15 #define MAX_ROUTE_NODES 22 -struct ActionDetails { - int verbId; - int objectNameId; - int indirectObjectId; -}; - class VerbInit { public: int _id; -- cgit v1.2.3 From 72163a233f980a385c432fbf66fd6bb21f6acdf2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 2 Mar 2014 20:06:21 -0500 Subject: MADS: Moved Player class into it's own file --- engines/mads/action.cpp | 18 ++++++------ engines/mads/action.h | 19 +++++++------ engines/mads/game.cpp | 9 ++++-- engines/mads/game.h | 3 +- engines/mads/game_data.cpp | 11 -------- engines/mads/game_data.h | 18 ------------ engines/mads/module.mk | 1 + engines/mads/player.cpp | 69 ++++++++++++++++++++++++++++++++++++++++++++++ engines/mads/player.h | 69 ++++++++++++++++++++++++++++++++++++++++++++++ engines/mads/scene.cpp | 2 +- engines/mads/scene.h | 1 + 11 files changed, 169 insertions(+), 51 deletions(-) create mode 100644 engines/mads/player.cpp create mode 100644 engines/mads/player.h diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index d27bd85a45..ce2cf6aba8 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -21,12 +21,13 @@ */ #include "common/scummsys.h" +#include "mads/mads.h" #include "mads/action.h" #include "mads/scene.h" namespace MADS { -MadsAction::MadsAction(Scene *scene) : _scene(scene) { +MADSAction::MADSAction(MADSEngine *vm) : _vm(vm) { clear(); _currentAction = VERB_NONE; _startWalkFlag = false; @@ -35,7 +36,7 @@ MadsAction::MadsAction(Scene *scene) : _scene(scene) { _inProgress = false; } -void MadsAction::clear() { +void MADSAction::clear() { _v83338 = 1; _actionMode = ACTMODE_NONE; _actionMode2 = ACTMODE2_0; @@ -44,7 +45,6 @@ void MadsAction::clear() { _articleNumber = 0; _lookFlag = false; _v86F4A = 0; - _statusText[0] = '\0'; _selectedRow = -1; _hotspotId = -1; _v86F3A = -1; @@ -56,7 +56,7 @@ void MadsAction::clear() { _walkFlag = false; } -void MadsAction::appendVocab(int vocabId, bool capitalise) { +void MADSAction::appendVocab(int vocabId, bool capitalise) { /* char *s = _statusText + strlen(_statusText); vocabStr = _madsVm->globals()->getVocab(vocabId); @@ -68,7 +68,7 @@ void MadsAction::appendVocab(int vocabId, bool capitalise) { */ } -void MadsAction::set() { +void MADSAction::set() { /* int hotspotCount = _madsVm->scene()->getSceneResources().hotspots->size(); bool flag = false; // FIXME: unused @@ -212,7 +212,7 @@ void MadsAction::set() { */ } -void MadsAction::refresh() { +void MADSAction::refresh() { /* // Exit immediately if nothing has changed if (!_textChanged) @@ -249,7 +249,7 @@ void MadsAction::refresh() { */ } -void MadsAction::startAction() { +void MADSAction::startAction() { /* _madsVm->_player.moveComplete(); @@ -318,14 +318,14 @@ void MadsAction::startAction() { */ } -void MadsAction::checkAction() { +void MADSAction::checkAction() { /* if (isAction(kVerbLookAt) || isAction(kVerbThrow)) _startWalkFlag = 0; */ } -bool MadsAction::isAction(int verbId, int objectNameId, int indirectObjectId) { +bool MADSAction::isAction(int verbId, int objectNameId, int indirectObjectId) { /* if (_activeAction.verbId != verbId) return false; diff --git a/engines/mads/action.h b/engines/mads/action.h index a29d43baa0..c38b842992 100644 --- a/engines/mads/action.h +++ b/engines/mads/action.h @@ -24,6 +24,7 @@ #define MADS_ACTION_H #include "common/scummsys.h" +#include "common/str.h" namespace MADS { @@ -46,7 +47,7 @@ enum { VERB_WALKTO = 13 }; -class Scene; +class MADSEngine; struct ActionDetails { int verbId; @@ -54,7 +55,7 @@ struct ActionDetails { int indirectObjectId; }; -struct MadsActionSavedFields { +struct MADSActionSavedFields { int articleNumber; int actionMode; int actionMode2; @@ -62,11 +63,11 @@ struct MadsActionSavedFields { int selectedRow; }; -class MadsAction { +class MADSAction { private: - Scene *_scene; - char _statusText[100]; - char _dialogTitle[100]; + MADSEngine *_vm; + Common::String _statusText; + Common::String _dialogTitle; void appendVocab(int vocabId, bool capitalise = false); public: @@ -83,7 +84,7 @@ public: bool _startWalkFlag; int _statusTextIndex; int _hotspotId; - MadsActionSavedFields _savedFields; + MADSActionSavedFields _savedFields; bool _walkFlag; // Unknown fields @@ -97,11 +98,11 @@ public: AbortTimerMode _v8453A; public: - MadsAction(Scene *scene); + MADSAction(MADSEngine *vm); void clear(); void set(); - const char *statusText() const { return _statusText; } + const Common::String &statusText() const { return _statusText; } void refresh(); void startAction(); void checkAction(); diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index a3351f5a7b..2fa701093e 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -39,8 +39,8 @@ Game *Game::init(MADSEngine *vm) { return nullptr; } -Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), - _objects(vm), _scene(vm) { +Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm), + _scene(vm), _player(vm) { _sectionNumber = _priorSectionNumber = 0; _difficultyLevel = DIFFICULTY_HARD; _saveSlot = -1; @@ -176,6 +176,11 @@ void Game::sectionLoop() { _scene._v1C = -1; _objectHiliteVocabIdx = -1; + _scene._action.clear(); + _player.turnToDestFacing(); + _player._direction = _player._newDirection; + _player.moveComplete(); + // TODO: main section loop logic goes here // Clear the scene diff --git a/engines/mads/game.h b/engines/mads/game.h index 562e0b99d0..88c5bebf63 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -26,6 +26,7 @@ #include "common/scummsys.h" #include "mads/scene.h" #include "mads/game_data.h" +#include "mads/player.h" namespace MADS { @@ -62,7 +63,6 @@ protected: byte *_quotes; int _v1; int _v3; - int _v4; int _v5; int _v6; Common::String _aaName; @@ -110,6 +110,7 @@ public: InventoryObjects _objects; Scene _scene; int _v2; + int _v4; public: virtual ~Game(); diff --git a/engines/mads/game_data.cpp b/engines/mads/game_data.cpp index e39b85c9ae..ba24ed9ca1 100644 --- a/engines/mads/game_data.cpp +++ b/engines/mads/game_data.cpp @@ -102,15 +102,4 @@ void InventoryObjects::setRoom(int objectId, int roomNumber) { warning("TODO: setObjectRoom"); } -/*------------------------------------------------------------------------*/ - -Player::Player() { - _direction = 8; - _newDirection = 8; - _spritesLoaded = false; - _spritesStart = _numSprites = 0; - _stepEnabled = false; - _visible = false; -} - } // End of namespace MADS diff --git a/engines/mads/game_data.h b/engines/mads/game_data.h index 2d2badd38b..56ab3665e3 100644 --- a/engines/mads/game_data.h +++ b/engines/mads/game_data.h @@ -91,24 +91,6 @@ public: void setRoom(int objectId, int roomNumber); }; -class Player { -public: - int _direction; - int _newDirection; - bool _spritesLoaded; - int _spritesStart; - int _numSprites; - bool _stepEnabled; - bool _spritesChanged; - bool _visible; -public: - Player(); - - void loadSprites(const Common::String &prefix) { - warning("TODO: Player::loadSprites"); - } -}; - class SectionHandler { protected: MADSEngine *_vm; diff --git a/engines/mads/module.mk b/engines/mads/module.mk index f27b808099..f715e1a4da 100644 --- a/engines/mads/module.mk +++ b/engines/mads/module.mk @@ -22,6 +22,7 @@ MODULE_OBJS := \ msprite.o \ msurface.o \ palette.o \ + player.o \ resources.o \ scene.o \ scene_data.o \ diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp new file mode 100644 index 0000000000..d88feea0d8 --- /dev/null +++ b/engines/mads/player.cpp @@ -0,0 +1,69 @@ +/* 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 "common/scummsys.h" +#include "mads/mads.h" +#include "mads/player.h" + +namespace MADS { + +Player::Player(MADSEngine *vm): _vm(vm) { + _action = nullptr; + _direction = 8; + _newDirection = 8; + _destFacing = 0; + _spritesLoaded = false; + _spritesStart = _numSprites = 0; + _stepEnabled = false; + _visible = false; +} + +void Player::reset() { + _action = &_vm->_game->_scene._action; + _destPos = _playerPos; + _destFacing = 5; + _newDirection = _direction; + _moving = false; + _v844C0 = _v844BE = 0; + _next = 0; + _routeCount = 0; + + _vm->_game->_v4 = 0; + _action->_startWalkFlag = false; + _action->_walkFlag = false; +} + +void Player::loadSprites(const Common::String &prefix) { + warning("TODO: Player::loadSprites"); +} + +void Player::turnToDestFacing() { + if (_destFacing != 5) + _newDirection = _destFacing; +} + +void Player::moveComplete() { + reset(); + _action->_inProgress = false; +} + +} // End of namespace MADS diff --git a/engines/mads/player.h b/engines/mads/player.h new file mode 100644 index 0000000000..0466f7aeee --- /dev/null +++ b/engines/mads/player.h @@ -0,0 +1,69 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_PLAYER_H +#define MADS_PLAYER_H + +#include "common/scummsys.h" +#include "common/str.h" + +namespace MADS { + +class MADSEngine; +class Action; + +class Player { +private: + MADSEngine *_vm; + MADSAction *_action; + + void reset(); +public: + int _direction; + int _newDirection; + int _destFacing; + bool _spritesLoaded; + int _spritesStart; + int _numSprites; + bool _stepEnabled; + bool _spritesChanged; + bool _visible; + Common::Point _playerPos; + Common::Point _destPos; + bool _moving; + int _v844C0, _v844BE; + int _next; + int _routeCount; + +public: + Player(MADSEngine *vm); + + void loadSprites(const Common::String &prefix); + + void turnToDestFacing(); + + void moveComplete(); +}; + +} // End of namespace MADS + +#endif /* MADS_PLAYER_H */ diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 90f5cbd0cf..2f12139246 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -28,7 +28,7 @@ namespace MADS { -Scene::Scene(MADSEngine *vm): _vm(vm), _spriteSlots(vm) { +Scene::Scene(MADSEngine *vm): _vm(vm), _spriteSlots(vm), _action(_vm) { _priorSceneId = 0; _nextSceneId = 0; _currentSceneId = 0; diff --git a/engines/mads/scene.h b/engines/mads/scene.h index bafe499d09..d3a6aeeb6d 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -97,6 +97,7 @@ public: int _spritesCount; int _v1A; int _v1C; + MADSAction _action; /** * Constructor -- cgit v1.2.3 From a0996b7384e5c3321af97347613120d2f90ab64e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 2 Mar 2014 20:50:35 -0500 Subject: MADS: Implemented more of the multi-scene loop --- engines/mads/events.cpp | 1 + engines/mads/events.h | 1 + engines/mads/game.cpp | 62 ++++++++++++++++++++++++++++++++++++++++++++++++- engines/mads/game.h | 5 ++++ engines/mads/mads.cpp | 1 + engines/mads/mads.h | 8 ++++++- engines/mads/player.cpp | 21 +++++++++++++++++ engines/mads/player.h | 13 ++++++++++- engines/mads/scene.cpp | 15 ++++++++++++ engines/mads/scene.h | 8 +++++++ 10 files changed, 132 insertions(+), 3 deletions(-) diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp index 5d905ca8d6..56bd87cbc6 100644 --- a/engines/mads/events.cpp +++ b/engines/mads/events.cpp @@ -39,6 +39,7 @@ EventsManager::EventsManager(MADSEngine *vm) { _priorFrameTime = 0; _keyPressed = false; _mouseClicked = false; + _currentTimer = 0; } EventsManager::~EventsManager() { diff --git a/engines/mads/events.h b/engines/mads/events.h index 2a8ae84e6a..c4fb8786cb 100644 --- a/engines/mads/events.h +++ b/engines/mads/events.h @@ -60,6 +60,7 @@ public: SpriteAsset *_cursorSprites; bool _mouseClicked; bool _keyPressed; + uint32 _currentTimer; public: /** * Constructor diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 2fa701093e..64b41d23c3 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -54,6 +54,8 @@ Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm), _v5 = _v6 = 0; _aaName = "*I0.AA"; _playerSpritesFlag = false; + _currentTimer = 0; + _updateSceneFlag = false; } Game::~Game() { @@ -181,7 +183,65 @@ void Game::sectionLoop() { _player._direction = _player._newDirection; _player.moveComplete(); - // TODO: main section loop logic goes here + switch (_vm->_screenFade) { + case SCREEN_FADE_SMOOTH: + _abortTimers2 = 2; + break; + case SCREEN_FADE_FAST: + _abortTimers2 = 20; + break; + default: + _abortTimers2 = 21; + break; + } + _abortTimers = 0; + _abortTimersMode2 = ABORTMODE_1; + _currentTimer = _vm->_events->_currentTimer; + + // Call the scene logic for entering the given scene + _scene._sceneLogic->enter(); + + // Set player data + _player._destPos = _player._playerPos; + _player._newDirection = _player._direction; + _player._destFacing = _player._direction; + _player.setupFrame(); + _player.updateFrame(); + _player._visible3 = _player._visible; + _player._special = _scene.getDepthHighBits(_player._playerPos); + _player._priorTimer = _vm->_events->_currentTimer + _player._ticksAmount; + _player.idle(); + + warning("TODO: _selectedObject IF block"); + + _v1 = 5; + _scene._roomChanged = false; + + if ((_v5 || _v6) && !_updateSceneFlag) { + _scene._currentSceneId = _scene._priorSceneId; + _updateSceneFlag = true; + } + else { + _updateSceneFlag = false; + _scene.loop(); + } + + _vm->_events->resetCursor(); + _v1 = 3; + + delete _quotes; + _quotes = nullptr; + delete _scene._animation; + _scene._animation = nullptr; + + _scene._reloadSceneFlag = false; + + warning("TODO: sub_1DD8C, sub_1DD7E"); + + if (!_playerSpritesFlag) { + _player._spritesLoaded = false; + _player._spritesChanged = true; + } // Clear the scene _scene.free(); diff --git a/engines/mads/game.h b/engines/mads/game.h index 88c5bebf63..cd727af902 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -65,6 +65,7 @@ protected: int _v3; int _v5; int _v6; + bool _updateSceneFlag; Common::String _aaName; bool _playerSpritesFlag; int _objectHiliteVocabIdx; @@ -111,6 +112,10 @@ public: Scene _scene; int _v2; int _v4; + int _abortTimers; + int _abortTimers2; + AbortTimerMode _abortTimersMode2; + uint32 _currentTimer; public: virtual ~Game(); diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index d78f37dd8b..e9fbf918c4 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -41,6 +41,7 @@ MADSEngine::MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc) : _easyMouse = true; _invObjectStill = false; _textWindowStill = false; + _screenFade = SCREEN_FADE_FAST; _debugger = nullptr; _dialogs = nullptr; diff --git a/engines/mads/mads.h b/engines/mads/mads.h index 92758b72a5..2d85236d8d 100644 --- a/engines/mads/mads.h +++ b/engines/mads/mads.h @@ -67,6 +67,12 @@ enum { GType_Riddle = 3 }; +enum ScreenFade { + SCREEN_FADE_SMOOTH = 0, + SCREEN_FADE_MEDIUM = 1, + SCREEN_FADE_FAST = 2 +}; + struct MADSGameDescription; @@ -97,7 +103,7 @@ public: bool _easyMouse; bool _invObjectStill; bool _textWindowStill; - + ScreenFade _screenFade; public: MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc); virtual ~MADSEngine(); diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index d88feea0d8..e09549c6d9 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -35,6 +35,10 @@ Player::Player(MADSEngine *vm): _vm(vm) { _spritesStart = _numSprites = 0; _stepEnabled = false; _visible = false; + _visible3 = false; + _special = 0; + _ticksAmount = 0; + _priorTimer = 0; } void Player::reset() { @@ -66,4 +70,21 @@ void Player::moveComplete() { _action->_inProgress = false; } +void Player::setupFrame() { + resetActionList(); + warning("TODO: Player::setupFrame"); +} + +void Player::updateFrame() { + warning("TODO: Player::updateFrame"); +} + +void Player::resetActionList() { + warning("TODO: Player::resetActionList"); +} + +void Player::idle() { + warning("TODO: Player::idle"); +} + } // End of namespace MADS diff --git a/engines/mads/player.h b/engines/mads/player.h index 0466f7aeee..67766d8572 100644 --- a/engines/mads/player.h +++ b/engines/mads/player.h @@ -37,6 +37,8 @@ private: MADSAction *_action; void reset(); + + void resetActionList(); public: int _direction; int _newDirection; @@ -47,13 +49,16 @@ public: bool _stepEnabled; bool _spritesChanged; bool _visible; + bool _visible3; Common::Point _playerPos; Common::Point _destPos; bool _moving; int _v844C0, _v844BE; int _next; int _routeCount; - + int _special; + int _ticksAmount; + uint32 _priorTimer; public: Player(MADSEngine *vm); @@ -62,6 +67,12 @@ public: void turnToDestFacing(); void moveComplete(); + + void setupFrame(); + + void updateFrame(); + + void idle(); }; } // End of namespace MADS diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 2f12139246..2c6cb8a112 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -39,6 +39,8 @@ Scene::Scene(MADSEngine *vm): _vm(vm), _spriteSlots(vm), _action(_vm) { _animVal1 = 0; _depthStyle = 0; _v1A = _v1C = 0; + _roomChanged = false; + _reloadSceneFlag = false; _verbList.push_back(VerbInit(VERB_LOOK, 2, 0)); _verbList.push_back(VerbInit(VERB_TAKE, 2, 0)); @@ -254,6 +256,19 @@ void Scene::initPaletteAnimation(Common::Array &animData, bool animFlag) { _animFlag = animFlag; } +bool Scene::getDepthHighBits(const Common::Point &pt) { + if (_sceneInfo->_depthStyle == 2) { + return 0; + } else { + const byte *p = _depthSurface.getBasePtr(pt.x, pt.y); + return (*p & 0x70) >> 4; + } +} + +void Scene::loop() { + +} + void Scene::free() { warning("TODO: Scene::free"); } diff --git a/engines/mads/scene.h b/engines/mads/scene.h index d3a6aeeb6d..4da6fb297e 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -98,6 +98,8 @@ public: int _v1A; int _v1C; MADSAction _action; + bool _roomChanged; + bool _reloadSceneFlag; /** * Constructor @@ -157,6 +159,12 @@ public: */ void loadVocab(); + bool getDepthHighBits(const Common::Point &pt); + + /** + * Main scene loop + */ + void loop(); /** * Clear the data for the scene -- cgit v1.2.3 From 3a842a079c668e9dfc52a6056119d4932e8ef56d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 2 Mar 2014 23:09:17 -0500 Subject: MADS: Bulk of implementation of ScreenObjects::check --- engines/mads/action.cpp | 4 ++ engines/mads/action.h | 2 + engines/mads/animation.cpp | 2 +- engines/mads/events.cpp | 7 ++ engines/mads/events.h | 17 +++-- engines/mads/game.cpp | 3 +- engines/mads/game.h | 4 +- engines/mads/player.cpp | 1 + engines/mads/player.h | 1 + engines/mads/scene.cpp | 37 +++++++++-- engines/mads/scene.h | 20 +++--- engines/mads/scene_data.cpp | 154 ++++++++++++++++++++++++++++++++++++++++++-- engines/mads/scene_data.h | 97 ++++++++++++++++++++++++++-- 13 files changed, 314 insertions(+), 35 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index ce2cf6aba8..9a8080761b 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -337,4 +337,8 @@ bool MADSAction::isAction(int verbId, int objectNameId, int indirectObjectId) { return true; } +void MADSAction::checkActionAtMousePos() { + warning("TODO: checkActionAtMousePos"); +} + } // End of namespace MADS diff --git a/engines/mads/action.h b/engines/mads/action.h index c38b842992..780168a62a 100644 --- a/engines/mads/action.h +++ b/engines/mads/action.h @@ -107,6 +107,8 @@ public: void startAction(); void checkAction(); bool isAction(int verbId, int objectNameId = 0, int indirectObjectId = 0); + + void checkActionAtMousePos(); }; } // End of namespace MADS diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index ebb2289443..8ea95ee168 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -287,7 +287,7 @@ void Animation::loadInterface(InterfaceSurface &interfaceSurface, MSurface &dept else if (header._animMode == 4) { // Load a scene interface Common::String resourceName = "*" + header._interfaceFile; - interfaceSurface.load(_vm, resourceName); + interfaceSurface.load(resourceName); if (palAnimData) palAnimData->clear(); diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp index 56bd87cbc6..0c2e2f2aea 100644 --- a/engines/mads/events.cpp +++ b/engines/mads/events.cpp @@ -39,7 +39,13 @@ EventsManager::EventsManager(MADSEngine *vm) { _priorFrameTime = 0; _keyPressed = false; _mouseClicked = false; + _mouseReleased = false; _currentTimer = 0; + _mouseButtons = 0; + _vD2 = 0; + _vD4 = 0; + _vD6 = 0; + _vD8 = 0; } EventsManager::~EventsManager() { @@ -115,6 +121,7 @@ void EventsManager::pollEvents() { case Common::EVENT_LBUTTONDOWN: case Common::EVENT_RBUTTONDOWN: _mouseClicked = true; + _mouseButtons = 1; return; case Common::EVENT_LBUTTONUP: case Common::EVENT_RBUTTONUP: diff --git a/engines/mads/events.h b/engines/mads/events.h index c4fb8786cb..0a6913b38e 100644 --- a/engines/mads/events.h +++ b/engines/mads/events.h @@ -42,10 +42,7 @@ private: uint32 _gameCounter; uint32 _priorFrameTime; Common::Point _mousePos; - int _vCC; - int _vD4; - int _vD8; - int _vD2; + Common::Point _currentPos; /** * Updates the cursor image when the current cursor changes @@ -59,8 +56,15 @@ private: public: SpriteAsset *_cursorSprites; bool _mouseClicked; + bool _mouseReleased; + byte _mouseButtons; bool _keyPressed; uint32 _currentTimer; + int _vCC; + int _vD2; + int _vD4; + int _vD6; + int _vD8; public: /** * Constructor @@ -117,6 +121,11 @@ public: */ Common::Point mousePos() const { return _mousePos; } + /** + * Return the current mouse position + */ + Common::Point currentPos() const { return _currentPos; } + /** * Delay for a given number of frames */ diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 64b41d23c3..c90cf62210 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -140,6 +140,7 @@ void Game::sectionLoop() { _quotes = nullptr; _scene.clearVocab(); + _scene._dynamicHotspots.clear(); _scene.loadSceneLogic(); _v4 = 0; @@ -148,7 +149,7 @@ void Game::sectionLoop() { _vm->_dialogs->_defaultPosition = Common::Point(-1, -1); _visitedScenes.add(_scene._nextSceneId); - _scene._screenObjects._v8333C = -1; + _scene._screenObjects._v8333C = true; _scene._screenObjects._v832EC = 0; _scene._screenObjects._yp = 0; _v3 = -1; diff --git a/engines/mads/game.h b/engines/mads/game.h index cd727af902..2bfa53db18 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -55,7 +55,6 @@ protected: MADSEngine *_vm; MSurface *_surface; Difficulty _difficultyLevel; - Player _player; int _saveSlot; int _statusFlag; SectionHandler *_sectionHandler; @@ -104,6 +103,7 @@ protected: public: static Game *init(MADSEngine *vm); public: + Player _player; int _sectionNumber; int _priorSectionNumber; int _currentSectionNumber; @@ -123,8 +123,6 @@ public: * Run the game */ void run(); - - Player &player() { return _player; } }; } // End of namespace MADS diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index e09549c6d9..4130ad295f 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -39,6 +39,7 @@ Player::Player(MADSEngine *vm): _vm(vm) { _special = 0; _ticksAmount = 0; _priorTimer = 0; + _unk3 = 0; } void Player::reset() { diff --git a/engines/mads/player.h b/engines/mads/player.h index 67766d8572..f82492f243 100644 --- a/engines/mads/player.h +++ b/engines/mads/player.h @@ -59,6 +59,7 @@ public: int _special; int _ticksAmount; uint32 _priorTimer; + int _unk3; public: Player(MADSEngine *vm); diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 2c6cb8a112..86b59ccc8b 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -28,7 +28,8 @@ namespace MADS { -Scene::Scene(MADSEngine *vm): _vm(vm), _spriteSlots(vm), _action(_vm) { +Scene::Scene(MADSEngine *vm): _vm(vm), _spriteSlots(vm), _action(_vm), + _dynamicHotspots(vm), _screenObjects(vm), _interface(vm) { _priorSceneId = 0; _nextSceneId = 0; _currentSceneId = 0; @@ -60,11 +61,6 @@ Scene::~Scene() { delete _sceneInfo; } -void Scene::clearDynamicHotspots() { - _dynamicHotspots.clear(); - _dynamicHotspotsChanged = false; -} - void Scene::clearVocab() { freeVocab(); _activeVocabs.clear(); @@ -155,7 +151,7 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) { _animation = Animation::init(_vm, this); MSurface surface; - _animation->load(surface, _interfaceSurface, prefix, flags, nullptr, nullptr); + _animation->load(surface, _interface, prefix, flags, nullptr, nullptr); _vm->_palette->_paletteUsage.load(0); @@ -266,7 +262,34 @@ bool Scene::getDepthHighBits(const Common::Point &pt) { } void Scene::loop() { + _nextSceneId = _currentSceneId; + + while (!_vm->shouldQuit() && !_reloadSceneFlag && _nextSceneId == _currentSceneId) { + // Handle drawing a game frame + doFrame(); + + if (_vm->_dialogs->_pendingDialog != DIALOG_NONE && !_vm->_game->_abortTimers + && _vm->_game->_player._stepEnabled) + _reloadSceneFlag = true; + } +} + +void Scene::doFrame() { + Player &player = _vm->_game->_player; + + if (_action._selectedAction || !player._stepEnabled) { + _action.clear(); + _action._selectedAction = 0; + } + + if (!_vm->_game->_abortTimers && !player._unk3) { + if (_dynamicHotspots._changed) + _dynamicHotspots.refresh(); + } +} +void Scene::leftClick() { + warning("TODO: Scene::leftClick"); } void Scene::free() { diff --git a/engines/mads/scene.h b/engines/mads/scene.h index 4da6fb297e..a02c4a5d79 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -54,6 +54,11 @@ private: * Initialises the data for palette animation within the scene */ void initPaletteAnimation(Common::Array &animData, bool animFlag); + + /** + * Handles a single frame within the game scene + */ + void doFrame(); protected: MADSEngine *_vm; public: @@ -66,8 +71,7 @@ public: SpriteSlots _spriteSlots; SpriteSets _sprites; int _spritesIndex; - Common::Array _dynamicHotspots; - bool _dynamicHotspotsChanged; + DynamicHotspots _dynamicHotspots; byte *_vocabBuffer; Common::Array _activeVocabs; Common::Array _sequences; @@ -80,7 +84,7 @@ public: SceneInfo *_sceneInfo; MSurface _backgroundSurface; MSurface _depthSurface; - InterfaceSurface _interfaceSurface; + InterfaceSurface _interface; bool _animFlag; int _animVal1; int _animCount; @@ -111,11 +115,6 @@ public: */ ~Scene(); - /** - * Clear the dynamic hotspot list - */ - void clearDynamicHotspots(); - /** * Clear the vocabulary list */ @@ -166,6 +165,11 @@ public: */ void loop(); + /** + * Execute a click within the scene + */ + void leftClick(); + /** * Clear the data for the scene */ diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index d7aaa6216d..601d719b8d 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -30,6 +30,114 @@ namespace MADS { +ScreenObject::ScreenObject() { + _category = CAT_NONE; + _descId = 0; + _layer = 0; +} + +/*------------------------------------------------------------------------*/ + +ScreenObjects::ScreenObjects(MADSEngine *vm): _vm(vm) { + _v8333C = false; + _v832EC = 0; + _yp = 0; + _v7FECA = 0; + _v7FED6 = 0; + _v8332A = 0; + _selectedObject = 0; + _category = CAT_NONE; + _objectIndex = 0; + _released = false; +} + +void ScreenObjects::add(const Common::Rect &bounds, ScrCategory category, int descId) { + assert(size() < 100); + + ScreenObject so; + so._bounds = bounds; + so._category = category; + so._descId = descId; + so._layer = 0x1413; + + push_back(so); +} + +void ScreenObjects::check(bool scanFlag) { + Scene &scene = _vm->_game->_scene; + + if (!_vm->_events->_mouseButtons || _v832EC) + _v7FECA = false; + + if ((_vm->_events->_vD6 || _v8332A || _yp || _v8333C) && scanFlag) { + _selectedObject = scanBackwards(_vm->_events->currentPos(), LAYER_GUI); + if (_selectedObject > 0) { + _category = (ScrCategory)((*this)[_selectedObject - 1]._category & 7); + _objectIndex = (*this)[_selectedObject - 1]._descId; + } + + // Handling for easy mouse + ScrCategory category = scene._interface._category; + if (_vm->_easyMouse && !_vm->_events->_vD4 && category != _category + && scene._interface._category != CAT_NONE) { + _released = true; + if (category >= CAT_ACTION && category <= CAT_6) { + scene._interface.elementHighlighted(); + } + } + + _released = _vm->_events->_mouseReleased; + if (_vm->_events->_vD2 || (_vm->_easyMouse && !_vm->_events->_vD4)) + scene._interface._category = _category; + + if (!_vm->_events->_mouseButtons || _vm->_easyMouse) { + if (category >= CAT_ACTION && category <= CAT_6) { + scene._interface.elementHighlighted(); + } + } + + if (_vm->_events->_mouseButtons || (_vm->_easyMouse && scene._action._v83338 > 1 + && scene._interface._category == CAT_INV_LIST) || + (_vm->_easyMouse && scene._interface._category == CAT_HOTSPOT)) { + scene._action.checkActionAtMousePos(); + } + + if (_vm->_events->_mouseReleased) { + scene.leftClick(); + scene._interface._category = CAT_NONE; + } + + if (_vm->_events->_mouseButtons || _vm->_easyMouse || _yp) + proc1(); + + if (_vm->_events->_mouseButtons || _vm->_easyMouse) + scene._action.set(); + + _v8333C = 0; + } + + scene._action.refresh(); + + // Loop through image inter list + warning("TODO: iimageInterList loop"); +} + +int ScreenObjects::scanBackwards(const Common::Point &pt, int layer) { + for (int i = (int)size() - 1; i >= 0; --i) { + if ((*this)[i]._bounds.contains(pt) && ((*this)[i]._layer == layer)) + return i + 1; + } + + // Entry not found + return 0; +} + +void ScreenObjects::proc1() { + warning("TODO: ScreenObjects::proc1"); +} + +/*------------------------------------------------------------------------*/ + SpriteSlot::SpriteSlot() { _spriteType = ST_NONE; _seqIndex = 0; @@ -64,7 +172,7 @@ void SpriteSlots::clear(bool flag) { * Releases any sprites used by the player */ void SpriteSlots::releasePlayerSprites() { - Player &player = _vm->_game->player(); + Player &player = _vm->_game->_player; if (player._spritesLoaded && player._numSprites > 0) { int spriteEnd = player._spritesStart + player._numSprites - 1; @@ -114,6 +222,34 @@ DynamicHotspot::DynamicHotspot() { /*------------------------------------------------------------------------*/ +DynamicHotspots::DynamicHotspots(MADSEngine *vm): _vm(vm) { + _changed = false; +} + +void DynamicHotspots::clear() { + Common::Array::clear(); + _changed = false; +} + +void DynamicHotspots::refresh() { + Scene &scene = _vm->_game->_scene; + + for (uint idx = 0; idx < size(); ++idx) { + DynamicHotspot &dh = (*this)[idx]; + + switch (scene._screenObjects._v832EC) { + case 0: + case 2: + scene._screenObjects.add(dh._bounds, CAT_12, dh._descId); + scene._screenObjects._v8333C = true; + default: + break; + } + } +} + +/*------------------------------------------------------------------------*/ + SequenceEntry::SequenceEntry() { _spritesIndex = 0; _flipped =0; @@ -216,6 +352,16 @@ void SceneNode::load(Common::SeekableReadStream *f) { /*------------------------------------------------------------------------*/ +InterfaceSurface::InterfaceSurface(MADSEngine *vm): _vm(vm) { + _category = CAT_NONE; +} + +void InterfaceSurface::elementHighlighted() { + warning("TODO: InterfaceSurface::elementHighlighted"); +} + +/*------------------------------------------------------------------------*/ + void SceneInfo::SpriteInfo::load(Common::SeekableReadStream *f) { f->skip(3); _spriteSetIndex = f->readByte(); @@ -228,15 +374,15 @@ void SceneInfo::SpriteInfo::load(Common::SeekableReadStream *f) { /*------------------------------------------------------------------------*/ -void InterfaceSurface::load(MADSEngine *vm, const Common::String &resName) { +void InterfaceSurface::load(const Common::String &resName) { File f(resName); MadsPack madsPack(&f); // Load in the palette Common::SeekableReadStream *palStream = madsPack.getItemStream(0); - RGB4 *gamePalP = &vm->_palette->_gamePalette[0]; - byte *palP = &vm->_palette->_mainPalette[0]; + RGB4 *gamePalP = &_vm->_palette->_gamePalette[0]; + byte *palP = &_vm->_palette->_mainPalette[0]; for (int i = 0; i < 16; ++i, gamePalP++, palP += 3) { palP[0] = palStream->readByte(); diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index 6be54cf3e1..8b874a144f 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -43,6 +43,21 @@ class Scene; #define DEPTH_BANDS_SIZE 15 #define MAX_ROUTE_NODES 22 +enum ScrCategory { + CAT_NONE = 0, CAT_ACTION = 1, CAT_INV_LIST = 2, CAT_INV_VOCAB = 3, + CAT_HOTSPOT = 4, CAT_INV_ANIM = 5, CAT_6 = 6, CAT_INV_SCROLLER = 7, + CAT_12 = 12 +}; + +enum Layer { + LAYER_GUI = 19 +}; + +enum SpriteType { + ST_NONE = 0, ST_FOREGROUND = 1, ST_BACKGROUND = -4, + ST_FULL_SCREEN_REFRESH = -2, ST_EXPIRED = -1 +}; + class VerbInit { public: int _id; @@ -53,16 +68,48 @@ public: VerbInit(int id, int action1, int action2): _id(id), _action1(action1), _action2(action2) {} }; -class ScreenObjects { +class ScreenObject { +public: + Common::Rect _bounds; + ScrCategory _category; + int _descId; + int _layer; + + ScreenObject(); +}; + +class ScreenObjects: public Common::Array { +private: + MADSEngine *_vm; + + int scanBackwards(const Common::Point &pt, int layer); + + void proc1(); public: - int _v8333C; int _v832EC; + int _v7FECA; + int _v7FED6; + int _v8332A; int _yp; -}; + int _v8333C; + int _selectedObject; + ScrCategory _category; + int _objectIndex; + bool _released; -enum SpriteType { - ST_NONE = 0, ST_FOREGROUND = 1, ST_BACKGROUND = -4, - ST_FULL_SCREEN_REFRESH = -2, ST_EXPIRED = -1 + /* + * Constructor + */ + ScreenObjects(MADSEngine *vm); + + /** + * Add a new item to the list + */ + void add(const Common::Rect &bounds, ScrCategory category, int descId); + + /** + */ + void check(bool scanFlag); }; class SpriteSlotSubset { @@ -143,6 +190,28 @@ public: DynamicHotspot(); }; +class DynamicHotspots : public Common::Array { +private: + MADSEngine *_vm; +public: + bool _changed; + + /** + * Constructor + */ + DynamicHotspots(MADSEngine *vm); + + /** + * Clear the list + */ + void clear(); + + /** + * Refresh the list + */ + void refresh(); +}; + class SequenceEntry { public: int _spritesIndex; @@ -283,8 +352,22 @@ public: typedef Common::Array SceneNodeList; class InterfaceSurface : public MSurface { +private: + MADSEngine *_vm; +public: + ScrCategory _category; public: - void load(MADSEngine *vm, const Common::String &resName); + /** + * Constructor + */ + InterfaceSurface(MADSEngine *vm); + + /** + * Loads an interface from a specified resource + */ + void load(const Common::String &resName); + + void elementHighlighted(); }; /** -- cgit v1.2.3 From d8026b9ef72d7ca22721486244309ccd4a003cae Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 3 Mar 2014 00:42:41 -0500 Subject: MADS: Implementing Scene::doFrame --- engines/mads/action.cpp | 7 ++-- engines/mads/action.h | 7 ++-- engines/mads/events.h | 4 +- engines/mads/game.cpp | 2 + engines/mads/game.h | 1 + engines/mads/player.cpp | 31 +++++++++++++++ engines/mads/player.h | 10 +++++ engines/mads/scene.cpp | 95 +++++++++++++++++++++++++++++++++++++++++++++ engines/mads/scene.h | 13 +++++++ engines/mads/scene_data.cpp | 7 ++-- engines/mads/scene_data.h | 6 ++- 11 files changed, 170 insertions(+), 13 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index 9a8080761b..134321f4c7 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -34,6 +34,7 @@ MADSAction::MADSAction(MADSEngine *vm) : _vm(vm) { _statusTextIndex = -1; _selectedAction = 0; _inProgress = false; + _savedSelectedRow = false; } void MADSAction::clear() { @@ -49,9 +50,9 @@ void MADSAction::clear() { _hotspotId = -1; _v86F3A = -1; _v86F4C = -1; - _action.verbId = -1; - _action.objectNameId = -1; - _action.indirectObjectId = -1; + _action._verbId = -1; + _action._objectNameId = -1; + _action._indirectObjectId = -1; _textChanged = true; _walkFlag = false; } diff --git a/engines/mads/action.h b/engines/mads/action.h index 780168a62a..da738ac34f 100644 --- a/engines/mads/action.h +++ b/engines/mads/action.h @@ -50,9 +50,9 @@ enum { class MADSEngine; struct ActionDetails { - int verbId; - int objectNameId; - int indirectObjectId; + int _verbId; + int _objectNameId; + int _indirectObjectId; }; struct MADSActionSavedFields { @@ -86,6 +86,7 @@ public: int _hotspotId; MADSActionSavedFields _savedFields; bool _walkFlag; + bool _savedSelectedRow; // Unknown fields int16 _v86F3A; diff --git a/engines/mads/events.h b/engines/mads/events.h index 0a6913b38e..2782253bcc 100644 --- a/engines/mads/events.h +++ b/engines/mads/events.h @@ -37,8 +37,6 @@ class MADSEngine; class EventsManager { private: MADSEngine *_vm; - CursorType _cursorId; - CursorType _newCursorId; uint32 _gameCounter; uint32 _priorFrameTime; Common::Point _mousePos; @@ -55,6 +53,8 @@ private: void checkForNextFrameCounter(); public: SpriteAsset *_cursorSprites; + CursorType _cursorId; + CursorType _newCursorId; bool _mouseClicked; bool _mouseReleased; byte _mouseButtons; diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index c90cf62210..37027685dd 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -56,6 +56,8 @@ Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm), _playerSpritesFlag = false; _currentTimer = 0; _updateSceneFlag = false; + _abortTimersMode = ABORTMODE_0; + _abortTimersMode2 = ABORTMODE_0; } Game::~Game() { diff --git a/engines/mads/game.h b/engines/mads/game.h index 2bfa53db18..148fc121cd 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -114,6 +114,7 @@ public: int _v4; int _abortTimers; int _abortTimers2; + AbortTimerMode _abortTimersMode; AbortTimerMode _abortTimersMode2; uint32 _currentTimer; public: diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index 4130ad295f..b0f4b72667 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -84,8 +84,39 @@ void Player::resetActionList() { warning("TODO: Player::resetActionList"); } +void Player::setDest(const Common::Point &pt, int facing) { + warning("TODO: Player::setDest"); +} + +void Player::nextFrame() { + _priorTimer += _ticksAmount; + if (_vm->_events->_currentTimer >= _priorTimer) { + _priorTimer = _vm->_events->_currentTimer; + if (_moving) { + move(); + } else { + idle(); + } + + postUpdate(); + update(); + } +} + +void Player::move() { + warning("TODO: Player::move"); +} + void Player::idle() { warning("TODO: Player::idle"); } +void Player::postUpdate() { + warning("TODO: Player::postUpdate"); +} + +void Player::update() { + warning("TODO: Player::update"); +} + } // End of namespace MADS diff --git a/engines/mads/player.h b/engines/mads/player.h index f82492f243..7792fb6bdd 100644 --- a/engines/mads/player.h +++ b/engines/mads/player.h @@ -39,6 +39,12 @@ private: void reset(); void resetActionList(); + + void move(); + + void postUpdate(); + + void update(); public: int _direction; int _newDirection; @@ -74,6 +80,10 @@ public: void updateFrame(); void idle(); + + void setDest(const Common::Point &pt, int facing); + + void nextFrame(); }; } // End of namespace MADS diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 86b59ccc8b..47b9bfac0d 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -42,6 +42,8 @@ Scene::Scene(MADSEngine *vm): _vm(vm), _spriteSlots(vm), _action(_vm), _v1A = _v1C = 0; _roomChanged = false; _reloadSceneFlag = false; + _destFacing = 0; + _freeAnimationFlag = false; _verbList.push_back(VerbInit(VERB_LOOK, 2, 0)); _verbList.push_back(VerbInit(VERB_TAKE, 2, 0)); @@ -276,6 +278,7 @@ void Scene::loop() { void Scene::doFrame() { Player &player = _vm->_game->_player; + bool flag = false; if (_action._selectedAction || !player._stepEnabled) { _action.clear(); @@ -285,6 +288,75 @@ void Scene::doFrame() { if (!_vm->_game->_abortTimers && !player._unk3) { if (_dynamicHotspots._changed) _dynamicHotspots.refresh(); + + _screenObjects.check(player._stepEnabled && !_action._startWalkFlag && + !_vm->_game->_abortTimers2); + } + + if (_action._selectedAction && player._stepEnabled && !_action._startWalkFlag && + !_vm->_game->_abortTimers && !player._unk3) { + _action.startAction(); + if (_action._activeAction._verbId == Nebular::NOUN_LOOK_AT) { + _action._activeAction._verbId = VERB_LOOK; + _action._savedSelectedRow = false; + } + + flag = true; + } + + if (flag || (_vm->_game->_abortTimers && _vm->_game->_abortTimersMode == ABORTMODE_2)) { + doPreactions(); + } + + checkStartWalk(); + if (!_vm->_game->_abortTimers2) + _vm->_events->_currentTimer = _vm->_events->getFrameCounter(); + + if ((_action._inProgress && !player._moving && !_action._startWalkFlag && + player._newDirection == player._direction) || + (_vm->_game->_abortTimers && _vm->_game->_abortTimersMode == ABORTMODE_0)) { + doAction(); + } + + if (_currentSceneId != _nextSceneId) { + _freeAnimationFlag = true; + } else { + doSceneStep(); + checkKeyboard(); + + if (_currentSceneId != _nextSceneId) { + _freeAnimationFlag = true; + } else { + player.nextFrame(); + + // Cursor update code + CursorType cursorId = CURSOR_ARROW; + if (_action._v83338 == 1 && !_screenObjects._v7FECA && + _screenObjects._category == CAT_HOTSPOT) { + int idx = _screenObjects._selectedObject - _interface._screenObjectsCount; + if (idx >= (int)_hotspots.size()) { + idx -= _hotspots.size(); + _vm->_events->_newCursorId = _dynamicHotspots[idx]._cursor; + } else { + _vm->_events->_newCursorId = _hotspots[idx]._cursor; + } + + cursorId = _vm->_events->_newCursorId == CURSOR_NONE ? + CURSOR_ARROW : _vm->_events->_newCursorId; + } + + if (!player._stepEnabled) + cursorId = CURSOR_WAIT; + if (cursorId >= _vm->_events->_cursorSprites->getCount()) + cursorId = (CursorType)_vm->_events->_cursorSprites->getCount(); + _vm->_events->_newCursorId = cursorId; + + if (cursorId != _vm->_events->_cursorId) { + _vm->_events->setCursor(cursorId); + } + + // TODO: Rest of Scene::doFrame + } } } @@ -292,6 +364,29 @@ void Scene::leftClick() { warning("TODO: Scene::leftClick"); } +void Scene::doPreactions() { + warning("TODO: Scene::doPreactions"); +} + +void Scene::doAction() { + warning("TODO: Scene::doAction"); +} + +void Scene::checkStartWalk() { + if (_action._startWalkFlag && _action._walkFlag) { + _vm->_game->_player.setDest(_destPos, _destFacing); + _action._startWalkFlag = false; + } +} + +void Scene::doSceneStep() { + warning("TODO: Scene::doSceneStep"); +} + +void Scene::checkKeyboard() { + warning("TODO: Scene::checkKeyboard"); +} + void Scene::free() { warning("TODO: Scene::free"); } diff --git a/engines/mads/scene.h b/engines/mads/scene.h index a02c4a5d79..4b822d111b 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -59,6 +59,16 @@ private: * Handles a single frame within the game scene */ void doFrame(); + + void doPreactions(); + + void doAction(); + + void checkStartWalk(); + + void doSceneStep(); + + void checkKeyboard(); protected: MADSEngine *_vm; public: @@ -93,6 +103,7 @@ public: SceneNodeList _nodes; Common::StringArray _vocabStrings; Animation *_animation; + bool _freeAnimationFlag; int _depthStyle; int _bandsRange; int _scaleRange; @@ -104,6 +115,8 @@ public: MADSAction _action; bool _roomChanged; bool _reloadSceneFlag; + Common::Point _destPos; + int _destFacing; /** * Constructor diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index 601d719b8d..10d346ed11 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -217,7 +217,7 @@ DynamicHotspot::DynamicHotspot() { _descId = 0; _field14 = 0; _articleNumber = 0; - _cursor = 0; + _cursor = CURSOR_NONE; } /*------------------------------------------------------------------------*/ @@ -292,7 +292,7 @@ KernelMessage::KernelMessage() { Hotspot::Hotspot() { _facing = 0; _articleNumber = 0; - _cursor = 0; + _cursor = CURSOR_NONE; _vocabId = 0; _verbId = 0; } @@ -307,7 +307,7 @@ Hotspot::Hotspot(Common::SeekableReadStream &f) { _facing = f.readByte(); _articleNumber = f.readByte(); f.skip(1); - _cursor = f.readByte(); + _cursor = (CursorType)f.readByte(); _vocabId = f.readUint16LE(); _verbId = f.readUint16LE(); } @@ -354,6 +354,7 @@ void SceneNode::load(Common::SeekableReadStream *f) { InterfaceSurface::InterfaceSurface(MADSEngine *vm): _vm(vm) { _category = CAT_NONE; + _screenObjectsCount = 0; } void InterfaceSurface::elementHighlighted() { diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index 8b874a144f..c11c59aee1 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -30,6 +30,7 @@ #include "common/rect.h" #include "mads/action.h" #include "mads/assets.h" +#include "mads/events.h" #include "mads/game_data.h" namespace MADS { @@ -185,7 +186,7 @@ public: int _descId; int _field14; int _articleNumber; - int _cursor; + CursorType _cursor; DynamicHotspot(); }; @@ -271,7 +272,7 @@ public: Common::Point _feetPos; int _facing; int _articleNumber; - int _cursor; + CursorType _cursor; int _vocabId; int _verbId; @@ -356,6 +357,7 @@ private: MADSEngine *_vm; public: ScrCategory _category; + int _screenObjectsCount; public: /** * Constructor -- cgit v1.2.3 From 3a3a295758a87817e9d66d3c06df56859ef55529 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 3 Mar 2014 20:53:27 -0500 Subject: MADS: Implemented sequence list, improvements for sprite assets --- engines/mads/assets.cpp | 141 +++++++++++++---- engines/mads/assets.h | 43 ++++- engines/mads/module.mk | 1 + engines/mads/scene.cpp | 7 +- engines/mads/scene.h | 3 +- engines/mads/scene_data.cpp | 112 +++++++++----- engines/mads/scene_data.h | 69 +++------ engines/mads/sequence.cpp | 370 ++++++++++++++++++++++++++++++++++++++++++++ engines/mads/sequence.h | 109 +++++++++++++ 9 files changed, 744 insertions(+), 111 deletions(-) create mode 100644 engines/mads/sequence.cpp create mode 100644 engines/mads/sequence.h diff --git a/engines/mads/assets.cpp b/engines/mads/assets.cpp index f7188e9551..c968afc311 100644 --- a/engines/mads/assets.cpp +++ b/engines/mads/assets.cpp @@ -25,72 +25,161 @@ #include "mads/assets.h" #include "mads/compression.h" #include "mads/events.h" +#include "mads/palette.h" namespace MADS { -SpriteAsset::SpriteAsset(MADSEngine *vm, const Common::String &resourceName, int flags): - _vm(vm) { +SpriteAsset::SpriteAsset(MADSEngine *vm, const Common::String &resourceName, int flags) : + _vm(vm) { Common::String resName = resourceName; if (!resName.hasSuffix(".SS")) resName += ".SS"; - + File file(resName); - MadsPack sprites(&file); + load(&file, flags); + + file.close(); +} + +SpriteAsset::SpriteAsset(MADSEngine *vm, Common::SeekableReadStream *stream, int flags) : + _vm(vm) { + load(stream, flags); +} +void SpriteAsset::load(Common::SeekableReadStream *stream, int flags) { int curFrame = 0; uint32 frameOffset = 0; + MadsPack sprite(stream); _frameRate = 0; _pixelSpeed = 0; _maxWidth = 0; _maxHeight = 0; - Common::SeekableReadStream *spriteStream = sprites.getItemStream(0); - for (int i = 0; i < 19; i++) { - spriteStream->readUint16LE(); - } + Common::SeekableReadStream *spriteStream = sprite.getItemStream(0); + _mode = spriteStream->readByte(); + spriteStream->skip(1); + int type1 = spriteStream->readUint16LE(); + int type2 = spriteStream->readUint16LE(); + _isBackground = (type1 != 0) && (type2 < 4); + spriteStream->skip(32); _frameCount = spriteStream->readUint16LE(); + if ((flags & SPRITE_SET_CHAR_INFO) == 0) + _charInfo = nullptr; + else + _charInfo = new SpriteSetCharInfo(spriteStream); + + delete spriteStream; + // Get the palette data - spriteStream = sprites.getItemStream(2); + spriteStream = sprite.getItemStream(2); int numColors = 0; byte *palData = _vm->_palette->decodePalette(spriteStream, &numColors); - Common::copy(palData, &palData[numColors], &_palette[0]); - if (numColors < 256) - Common::fill(&_palette[numColors * 3], &_palette[PALETTE_SIZE], 0); + if (numColors < 256) + Common::fill((byte *)&_palette[numColors], (byte *)&_palette[256], 0); _colorCount = numColors; delete[] palData; delete spriteStream; - Common::SeekableReadStream *spriteDataStream = sprites.getItemStream(3); - + spriteStream = sprite.getItemStream(1); + Common::SeekableReadStream *spriteDataStream = sprite.getItemStream(3); SpriteAssetFrame frame; + Common::Array frameSizes; for (curFrame = 0; curFrame < _frameCount; curFrame++) { - frame.comp = 0; + frame._stream = 0; + frame._comp = 0; frameOffset = spriteStream->readUint32LE(); _frameOffsets.push_back(frameOffset); - spriteStream->readUint32LE(); // frame size - frame.x = spriteStream->readUint16LE(); - frame.y = spriteStream->readUint16LE(); - frame.w = spriteStream->readUint16LE(); - frame.h = spriteStream->readUint16LE(); - if (curFrame == 0) { - debugN(kDebugGraphics, "%i frames, x = %i, y = %i, w = %i, h = %i\n", - _frameCount, frame.x, frame.y, frame.w, frame.h); + uint32 frameSize = spriteStream->readUint32LE(); + frameSizes.push_back(frameSize); + + frame._bounds.left = spriteStream->readSint16LE(); + frame._bounds.top = spriteStream->readSint16LE(); + frame._bounds.setWidth(spriteStream->readUint16LE()); + frame._bounds.setHeight(spriteStream->readUint16LE()); + + if (curFrame == 0) + debugC(1, kDebugGraphics, "%i frames, x = %i, y = %i, w = %i, h = %i\n", + _frameCount, frame._bounds.left, frame._bounds.top, + frame._bounds.width(), frame._bounds.height()); + + if (_mode == 0) { + // Create a frame and decompress the raw pixel data + uint32 currPos = (uint32)spriteDataStream->pos(); + frame._frame = new MSprite(spriteDataStream, + Common::Point(frame._bounds.left, frame._bounds.top), + frame._bounds.width(), frame._bounds.height(), false); + assert((uint32)spriteDataStream->pos() == (currPos + frameSize)); } - frame.frame = new MSprite(spriteDataStream, Common::Point(frame.x, frame.y), - frame.w, frame.h, false); _frames.push_back(frame); } + if (_mode != 0) { + // Handle decompressing Fab encoded data + for (curFrame = 0; curFrame < _frameCount; curFrame++) { + FabDecompressor fab; + + int srcSize = (curFrame == (_frameCount - 1)) ? spriteDataStream->size() - _frameOffsets[curFrame] : + _frameOffsets[curFrame + 1] - _frameOffsets[curFrame]; + byte *srcData = new byte[srcSize]; + assert(srcData); + spriteDataStream->read(srcData, srcSize); + + byte *destData = new byte[frameSizes[curFrame]]; + assert(destData); + + fab.decompress(srcData, srcSize, destData, frameSizes[curFrame]); + + // Load the frame + Common::MemoryReadStream *rs = new Common::MemoryReadStream(destData, frameSizes[curFrame]); + _frames[curFrame]._frame = new MSprite(rs, + Common::Point(_frames[curFrame]._bounds.left, _frames[curFrame]._bounds.top), + _frames[curFrame]._bounds.width(), _frames[curFrame]._bounds.height(), false); + delete rs; + + delete[] srcData; + delete[] destData; + } + } + + delete spriteStream; delete spriteDataStream; - file.close(); } +MSprite *SpriteAsset::getFrame(int frameIndex) { + if ((uint)frameIndex < _frames.size()) { + return _frames[frameIndex]._frame; + } else { + debugC(kDebugGraphics, "SpriteAsset::getFrame: Invalid frame %d, out of %d", frameIndex, _frames.size()); + return _frames[_frames.size() - 1]._frame; + } +} + + void SpriteAsset::drawScaled(int frameNumber, MSurface &depthSurface, MSurface &destSurface, int scale, int depth, const Common::Point &pos) { warning("TODO: SpriteAsset::drawScaled"); } +/*------------------------------------------------------------------------*/ + +SpriteSetCharInfo::SpriteSetCharInfo(Common::SeekableReadStream *s) { + _totalFrames = s->readByte(); + s->skip(1); + _numEntries = s->readUint16LE(); + + for (int i = 0; i < 16; ++i) + _frameList[i] = s->readUint16LE(); + for (int i = 0; i < 16; ++i) + _frameList2[i] = s->readUint16LE(); + for (int i = 0; i < 16; ++i) + _ticksList[i] = s->readUint16LE(); + + _unk1 = s->readUint16LE(); + _ticksAmount = s->readByte(); + _yScale = s->readByte(); +} + } // End of namespace MADS diff --git a/engines/mads/assets.h b/engines/mads/assets.h index 5964036789..7a6939b222 100644 --- a/engines/mads/assets.h +++ b/engines/mads/assets.h @@ -31,11 +31,27 @@ namespace MADS { +#define SPRITE_SET_CHAR_INFO 4 + struct SpriteAssetFrame { - uint32 stream; - int x, y, w, h; - uint32 comp; - MSprite *frame; + uint32 _stream; + Common::Rect _bounds; + uint32 _comp; + MSprite *_frame; +}; + +class SpriteSetCharInfo { +public: + SpriteSetCharInfo(Common::SeekableReadStream *s); + + int _totalFrames; + int _numEntries; + int _frameList2[16]; + int _frameList[16]; + int _ticksList[16]; + int _unk1; + int _ticksAmount; + int _yScale; }; class SpriteAsset { @@ -50,8 +66,26 @@ private: Common::Array _frameOffsets; Common::Array _frames; uint32 _frameStartOffset; + uint8 _mode; + bool _isBackground; + + /** + * Load the data for the asset + */ + void load(Common::SeekableReadStream *stream, int flags); +public: + SpriteSetCharInfo *_charInfo; public: + /** + * Constructor + */ SpriteAsset(MADSEngine *vm, const Common::String &resourceName, int flags); + + /** + * Constructor + */ + SpriteAsset(MADSEngine *vm, Common::SeekableReadStream *stream, int flags); + int getCount() { return _frameCount; } int getFrameRate() const { return _frameRate; } int getPixelSpeed() const { return _pixelSpeed; } @@ -62,6 +96,7 @@ public: MSprite *getFrame(int frameIndex); byte *getPalette() { return _palette; } int getColorCount() { return _colorCount; } + bool isBackground() const { return _isBackground; } void drawScaled(int frameNumber, MSurface &depthSurface, MSurface &destSurface, int scale, int depth, const Common::Point &pos); diff --git a/engines/mads/module.mk b/engines/mads/module.mk index f715e1a4da..826e54f8fd 100644 --- a/engines/mads/module.mk +++ b/engines/mads/module.mk @@ -26,6 +26,7 @@ MODULE_OBJS := \ resources.o \ scene.o \ scene_data.o \ + sequence.o \ sound.o \ user_interface.o diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 47b9bfac0d..6efbdf5072 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -29,7 +29,8 @@ namespace MADS { Scene::Scene(MADSEngine *vm): _vm(vm), _spriteSlots(vm), _action(_vm), - _dynamicHotspots(vm), _screenObjects(vm), _interface(vm) { + _dynamicHotspots(vm), _screenObjects(vm), _interface(vm), + _sequences(vm) { _priorSceneId = 0; _nextSceneId = 0; _currentSceneId = 0; @@ -355,6 +356,10 @@ void Scene::doFrame() { _vm->_events->setCursor(cursorId); } + if (!_vm->_game->_abortTimers) + _sequences.tick(); + + // TODO: Rest of Scene::doFrame } } diff --git a/engines/mads/scene.h b/engines/mads/scene.h index 4b822d111b..71bfe317d9 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -30,6 +30,7 @@ #include "mads/msurface.h" #include "mads/scene_data.h" #include "mads/animation.h" +#include "mads/sequence.h" namespace MADS { @@ -84,7 +85,7 @@ public: DynamicHotspots _dynamicHotspots; byte *_vocabBuffer; Common::Array _activeVocabs; - Common::Array _sequences; + SequenceList _sequences; Common::Array _messages; Common::String _talkFont; int _textSpacing; diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index 10d346ed11..6fa2f5b326 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -223,54 +223,96 @@ DynamicHotspot::DynamicHotspot() { /*------------------------------------------------------------------------*/ DynamicHotspots::DynamicHotspots(MADSEngine *vm): _vm(vm) { - _changed = false; + for (int i = 0; i < DYNAMIC_HOTSPOTS_SIZE; ++i) { + DynamicHotspot rec; + rec._active = false; + _entries.push_back(rec); + } + + _changed = true; + _count = 0; } -void DynamicHotspots::clear() { - Common::Array::clear(); - _changed = false; +int DynamicHotspots::add(int descId, int field14, int seqIndex, const Common::Rect &bounds) { + // Find a free slot + uint idx = 0; + while ((idx < _entries.size()) && _entries[idx]._active) + ++idx; + if (idx == _entries.size()) + error("DynamicHotspots overflow"); + + _entries[idx]._active = true; + _entries[idx]._descId = descId; + _entries[idx]._seqIndex = seqIndex; + _entries[idx]._bounds = bounds; + _entries[idx]._feetPos.x = -3; + _entries[idx]._feetPos.y = 0; + _entries[idx]._facing = 5; + _entries[idx]._field14 = field14; + _entries[idx]._articleNumber = 6; + _entries[idx]._cursor = CURSOR_NONE; + + ++_count; + _changed = true; + + if (seqIndex >= 0) + _vm->_game->_scene._sequences[seqIndex]._dynamicHotspotIndex = idx; + + return idx; } -void DynamicHotspots::refresh() { +int DynamicHotspots::setPosition(int index, int xp, int yp, int facing) { + if (index >= 0) { + _entries[index]._feetPos.x = xp; + _entries[index]._feetPos.y = yp; + _entries[index]._facing = facing; + } + + return index; +} + +int DynamicHotspots::setCursor(int index, CursorType cursor) { + if (index >= 0) + _entries[index]._cursor = cursor; + + return index; +} + +void DynamicHotspots::remove(int index) { Scene &scene = _vm->_game->_scene; - for (uint idx = 0; idx < size(); ++idx) { - DynamicHotspot &dh = (*this)[idx]; + if (_entries[index]._active) { + if (_entries[index]._seqIndex >= 0) + scene._sequences[_entries[index]._seqIndex]._dynamicHotspotIndex = -1; + _entries[index]._active = false; - switch (scene._screenObjects._v832EC) { - case 0: - case 2: - scene._screenObjects.add(dh._bounds, CAT_12, dh._descId); - scene._screenObjects._v8333C = true; - default: - break; - } + --_count; + _changed = true; } } -/*------------------------------------------------------------------------*/ +void DynamicHotspots::clear() { + for (uint i = 0; i < _entries.size(); ++i) + _entries[i]._active = false; -SequenceEntry::SequenceEntry() { - _spritesIndex = 0; - _flipped =0; - _frameIndex = 0; - _frameStart = 0; - _numSprites = 0; - _animType = 0; - _frameInc = 0; - _depth = 0; - _scale = 0; - _dynamicHotspotIndex = -1; - _triggerCountdown = 0; - _doneFlag = 0; - _entries._count = 0; - _abortMode = 0; - _actionNouns[0] = _actionNouns[1] = _actionNouns[2] = 0; - _numTicks = 0; - _extraTicks = 0; - _timeout = 0; + _changed = false; + _count = 0; } +void DynamicHotspots::reset() { + for (uint i = 0; i < _entries.size(); ++i) + remove(i); + + _count = 0; + _changed = false; +} + +void DynamicHotspots::refresh() { + error("DynamicHotspots::refresh"); +} + +/*------------------------------------------------------------------------*/ + KernelMessage::KernelMessage() { _flags = 0; _seqInex = 0; diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index c11c59aee1..dc59bff4cf 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -153,6 +153,18 @@ public: * @param index Specifies the index in the array */ void deleteEntry(int index); + + SpriteAsset &getSprite(int idx) { + error("TODO"); + } + void deleteTimer(int idx) { + warning("TODO: SpriteSlots::deleteTimer"); + } + int getIndex() { + warning("TODO: SpriteSlots::indexOf"); + return -1; + } + }; class SpriteSets: public Common::Array { @@ -179,6 +191,7 @@ public: class DynamicHotspot { public: + bool _active; int _seqIndex; Common::Rect _bounds; Common::Point _feetPos; @@ -191,60 +204,28 @@ public: DynamicHotspot(); }; -class DynamicHotspots : public Common::Array { +#define DYNAMIC_HOTSPOTS_SIZE 8 + +class DynamicHotspots { private: MADSEngine *_vm; + Common::Array _entries; + int _count; public: bool _changed; - - /** - * Constructor - */ +public: DynamicHotspots(MADSEngine *vm); - /** - * Clear the list - */ + DynamicHotspot &operator[](uint idx) { return _entries[idx]; } + int add(int descId, int field14, int seqIndex, const Common::Rect &bounds); + int setPosition(int index, int xp, int yp, int facing); + int setCursor(int index, CursorType cursor); + void remove(int index); void clear(); - - /** - * Refresh the list - */ + void reset(); void refresh(); }; -class SequenceEntry { -public: - int _spritesIndex; - int _flipped; - int _frameIndex; - int _frameStart; - int _numSprites; - int _animType; - int _frameInc; - int _depth; - int _scale; - int _dynamicHotspotIndex; - - Common::Point _msgPos; - - int _triggerCountdown; - bool _doneFlag; - struct { - int _count; - int _mode[5]; - int _frameIndex[5]; - int _abortVal[5]; - } _entries; - int _abortMode; - int _actionNouns[3]; - int _numTicks; - int _extraTicks; - int _timeout; - - SequenceEntry(); -}; - class KernelMessage { public: int _flags; diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp new file mode 100644 index 0000000000..7c7b25d32a --- /dev/null +++ b/engines/mads/sequence.cpp @@ -0,0 +1,370 @@ +/* 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 "common/scummsys.h" +#include "mads/mads.h" +#include "mads/assets.h" +#include "mads/sequence.h" +#include "mads/scene.h" + +namespace MADS { + +SequenceEntry::SequenceEntry() { + _spritesIndex = 0; + _flipped = 0; + _frameIndex = 0; + _frameStart = 0; + _numSprites = 0; + _animType = ANIMTYPE_NONE; + _frameInc = 0; + _depth = 0; + _scale = 0; + _dynamicHotspotIndex = -1; + _triggerCountdown = 0; + _doneFlag = 0; + _entries._count = 0; + _abortMode = ABORTMODE_0; + _actionNouns[0] = _actionNouns[1] = _actionNouns[2] = 0; + _numTicks = 0; + _extraTicks = 0; + _timeout = 0; +} + +/*------------------------------------------------------------------------*/ + +#define TIMER_LIST_SIZE 30 + +SequenceList::SequenceList(MADSEngine *vm) : _vm(vm) { + for (int i = 0; i < TIMER_LIST_SIZE; ++i) { + SequenceEntry rec; + rec._active = false; + rec._dynamicHotspotIndex = -1; + _entries.push_back(rec); + } +} + +void SequenceList::clear() { + for (uint i = 0; i < _entries.size(); ++i) { + _entries[i]._active = false; + _entries[i]._dynamicHotspotIndex = -1; + } +} + +bool SequenceList::addSubEntry(int index, SequenceSubEntryMode mode, int frameIndex, int abortVal) { + if (_entries[index]._entries._count >= TIMER_ENTRY_SUBSET_MAX) + return true; + + int subIndex = _entries[index]._entries._count++; + _entries[index]._entries._mode[subIndex] = mode; + _entries[index]._entries._frameIndex[subIndex] = frameIndex; + _entries[index]._entries._abortVal[subIndex] = abortVal; + + return false; +} + +int SequenceList::add(int spriteListIndex, bool flipped, int frameIndex, int triggerCountdown, int delayTicks, int extraTicks, int numTicks, + int msgX, int msgY, bool nonFixed, char scale, uint8 depth, int frameInc, SpriteAnimType animType, int numSprites, + int frameStart) { + Scene &scene = _vm->_game->_scene; + + // Find a free slot + uint seqIndex = 0; + while ((seqIndex < _entries.size()) && _entries[seqIndex]._active) + ++seqIndex; + if (seqIndex == _entries.size()) + error("TimerList full"); + + if (frameStart <= 0) + frameStart = 1; + if (numSprites == 0) + numSprites = scene._spriteSlots.getSprite(spriteListIndex).getCount(); + if (frameStart == numSprites) + frameInc = 0; + + // Set the list entry fields + _entries[seqIndex]._active = true; + _entries[seqIndex]._spritesIndex = spriteListIndex; + _entries[seqIndex]._flipped = flipped; + _entries[seqIndex]._frameIndex = frameIndex; + _entries[seqIndex]._frameStart = frameStart; + _entries[seqIndex]._numSprites = numSprites; + _entries[seqIndex]._animType = animType; + _entries[seqIndex]._frameInc = frameInc; + _entries[seqIndex]._depth = depth; + _entries[seqIndex]._scale = scale; + _entries[seqIndex]._nonFixed = nonFixed; + _entries[seqIndex]._msgPos.x = msgX; + _entries[seqIndex]._msgPos.y = msgY; + _entries[seqIndex]._numTicks = numTicks; + _entries[seqIndex]._extraTicks = extraTicks; + + _entries[seqIndex]._timeout = _vm->_events->_currentTimer + delayTicks; + + _entries[seqIndex]._triggerCountdown = triggerCountdown; + _entries[seqIndex]._doneFlag = false; + _entries[seqIndex]._field13 = 0; + _entries[seqIndex]._dynamicHotspotIndex = -1; + _entries[seqIndex]._entries._count = 0; + _entries[seqIndex]._abortMode = _vm->_game->_abortTimersMode2; + + for (int i = 0; i < 3; ++i) + _entries[seqIndex]._actionNouns[i] = _actionNouns[i]; + + return seqIndex; +} + +void SequenceList::remove(int seqIndex) { + Scene &scene = _vm->_game->_scene; + + if (_entries[seqIndex]._active) { + if (_entries[seqIndex]._dynamicHotspotIndex >= 0) + scene._dynamicHotspots.remove(_entries[seqIndex]._dynamicHotspotIndex); + } + + _entries[seqIndex]._active = false; + scene._spriteSlots.deleteTimer(seqIndex); +} + +void SequenceList::setSpriteSlot(int seqIndex, SpriteSlot &spriteSlot) { + Scene &scene = _vm->_game->_scene; + SequenceEntry &timerEntry = _entries[seqIndex]; + SpriteAsset &spriteSet = scene._spriteSlots.getSprite(timerEntry._spritesIndex); + + spriteSlot._spriteType = spriteSet.isBackground() ? ST_BACKGROUND : ST_FOREGROUND; + spriteSlot._seqIndex = seqIndex; + spriteSlot._spritesIndex = timerEntry._spritesIndex; + spriteSlot._frameNumber = (timerEntry._flipped ? 0x8000 : 0) | timerEntry._frameIndex; + spriteSlot._depth = timerEntry._depth; + spriteSlot._scale = timerEntry._scale; + + if (!timerEntry._nonFixed) { + spriteSlot._position = timerEntry._msgPos; + } else { + spriteSlot._position = spriteSet.getFrame(timerEntry._frameIndex - 1)->_pos; + } +} + +bool SequenceList::loadSprites(int seqIndex) { + Scene &scene = _vm->_game->_scene; + SequenceEntry &seqEntry = _entries[seqIndex]; + int slotIndex; + bool result = false; + int idx = -1; + + scene._spriteSlots.deleteTimer(seqIndex); + if (seqEntry._doneFlag) { + remove(seqIndex); + return false; + } + + if (seqEntry._spritesIndex == -1) { + // Doesn't have an associated sprite anymore, so mark as done + seqEntry._doneFlag = true; + } + else if ((slotIndex = scene._spriteSlots.getIndex()) >= 0) { + SpriteSlot &spriteSlot = scene._spriteSlots[slotIndex]; + setSpriteSlot(seqIndex, spriteSlot); + + int x2 = 0, y2 = 0; + + if ((seqEntry._field13 != 0) || (seqEntry._dynamicHotspotIndex >= 0)) { + SpriteAsset &spriteSet = scene._spriteSlots.getSprite(seqEntry._spritesIndex); + MSprite *frame = spriteSet.getFrame(seqEntry._frameIndex - 1); + int width = frame->getWidth() * seqEntry._scale / 200; + int height = frame->getHeight() * seqEntry._scale / 100; + + warning("frame size %d x %d", width, height); + + // TODO: Missing stuff here, and I'm not certain about the dynamic hotspot stuff below + + if (seqEntry._dynamicHotspotIndex >= 0) { + DynamicHotspot &dynHotspot = scene._dynamicHotspots[seqEntry._dynamicHotspotIndex]; + + dynHotspot._bounds.left = MAX(x2 - width, 0); + dynHotspot._bounds.right = MAX(x2 - width, 319) - dynHotspot._bounds.left + 1; + dynHotspot._bounds.top = MAX(y2 - height, 0); + dynHotspot._bounds.bottom = MIN(y2, 155) - dynHotspot._bounds.top; + + scene._dynamicHotspots._changed = true; + } + } + + // Frame adjustments + if (seqEntry._frameStart != seqEntry._numSprites) + seqEntry._frameIndex += seqEntry._frameInc; + + if (seqEntry._frameIndex >= seqEntry._frameStart) { + if (seqEntry._frameIndex > seqEntry._numSprites) { + result = true; + if (seqEntry._animType == ANIMTYPE_CYCLED) { + // Reset back to the starting frame (cyclic) + seqEntry._frameIndex = seqEntry._frameStart; + } + else { + // Switch into reverse mode + seqEntry._frameIndex = seqEntry._numSprites - 1; + seqEntry._frameInc = -1; + } + } + } + else { + // Currently in reverse mode and moved past starting frame + result = true; + + if (seqEntry._animType == ANIMTYPE_CYCLED) + { + // Switch back to forward direction again + seqEntry._frameIndex = seqEntry._frameStart + 1; + seqEntry._frameInc = 1; + } + else { + // Otherwise reset back to last sprite for further reverse animating + seqEntry._frameIndex = seqEntry._numSprites; + } + } + + if (result && (seqEntry._triggerCountdown != 0)) { + if (--seqEntry._triggerCountdown == 0) + seqEntry._doneFlag = true; + } + } + else { + // Out of sprite display slots, so mark entry as done + seqEntry._doneFlag = true; + } + + if (seqEntry._entries._count > 0) { + for (int i = 0; i <= seqEntry._entries._count; ++i) { + switch (seqEntry._entries._mode[i]) { + case SM_0: + case SM_1: + if (((seqEntry._entries._mode[i] == SM_0) && seqEntry._doneFlag) || + ((seqEntry._entries._mode[i] == SM_1) && result)) + idx = i; + break; + + case SM_FRAME_INDEX: { + int v = seqEntry._entries._frameIndex[i]; + if ((v == seqEntry._frameIndex) || (v == 0)) + idx = i; + break; + } + + default: + break; + } + } + } + + if (idx >= 0) { + _vm->_game->_abortTimers = seqEntry._entries._abortVal[idx]; + _vm->_game->_abortTimersMode = seqEntry._abortMode; + } + + return result; +} + +/** +* Handles counting down entries in the timer list for action +*/ +void SequenceList::tick() { + for (uint idx = 0; idx < _entries.size(); ++idx) { + if ((_vm->_game->_abortTimers2 == 0) && (_vm->_game->_abortTimers != 0)) + break; + + SequenceEntry &seqEntry = _entries[idx]; + uint32 currentTimer = _vm->_events->_currentTimer; + + if (!seqEntry._active || (currentTimer < seqEntry._timeout)) + continue; + + // Set the next timeout for the timer entry + seqEntry._timeout = currentTimer + seqEntry._numTicks; + + // Action the sprite + if (loadSprites(idx)) { + seqEntry._timeout += seqEntry._extraTicks; + } + } +} + +void SequenceList::delay(uint32 v1, uint32 v2) { + for (uint idx = 0; idx < _entries.size(); ++idx) { + if (_entries[idx]._active) { + _entries[idx]._timeout += v1 - v2; + } + } +} + +void SequenceList::setAnimRange(int seqIndex, int startVal, int endVal) { + Scene &scene = _vm->_game->_scene; + SequenceEntry &seqEntry = _entries[seqIndex]; + SpriteAsset &spriteSet = scene._spriteSlots.getSprite(seqEntry._spritesIndex); + int numSprites = spriteSet.getCount(); + int tempStart = startVal, tempEnd = endVal; + + switch (startVal) { + case -2: + tempStart = numSprites; + break; + case -1: + tempStart = 1; + break; + } + + switch (endVal) { + case -2: + case 0: + tempEnd = numSprites; + break; + case -1: + tempEnd = 1; + break; + default: + tempEnd = numSprites; + break; + } + + seqEntry._frameStart = tempStart; + seqEntry._numSprites = tempEnd; + + seqEntry._frameIndex = (seqEntry._frameInc < 0) ? tempStart : tempEnd; +} + +void SequenceList::scan() { + Scene &scene = _vm->_game->_scene; + + for (uint i = 0; i < _entries.size(); ++i) { + if (!_entries[i]._active && (_entries[i]._spritesIndex != -1)) { + int idx = scene._spriteSlots.getIndex(); + setSpriteSlot(i, scene._spriteSlots[idx]); + } + } +} + +/** +* Sets the depth of the specified entry in the sequence list +*/ +void SequenceList::setDepth(int seqIndex, int depth) { + _entries[seqIndex]._depth = depth; +} +} // End of namespace diff --git a/engines/mads/sequence.h b/engines/mads/sequence.h new file mode 100644 index 0000000000..1b9aefe294 --- /dev/null +++ b/engines/mads/sequence.h @@ -0,0 +1,109 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_SEQUENCE_H +#define MADS_SEQUENCE_H + +#include "common/scummsys.h" +#include "common/array.h" +#include "common/rect.h" +#include "mads/action.h" + +namespace MADS { + +class SpriteSlot; + +enum SequenceSubEntryMode { SM_0 = 0, SM_1 = 1, SM_FRAME_INDEX = 2 }; + +enum SpriteAnimType { ANIMTYPE_NONE = 0, ANIMTYPE_CYCLED = 1, ANIMTYPE_REVERSIBLE = 2 }; + +#define TIMER_ENTRY_SUBSET_MAX 5 + +struct SequenceSubEntries { + int _count; + SequenceSubEntryMode _mode[TIMER_ENTRY_SUBSET_MAX]; + int _frameIndex[TIMER_ENTRY_SUBSET_MAX]; + int8 _abortVal[TIMER_ENTRY_SUBSET_MAX]; +}; + +struct SequenceEntry { + bool _active; + int8 _spritesIndex; + bool _flipped; + + int _frameIndex; + int _frameStart; + int _numSprites; + + SpriteAnimType _animType; + int _frameInc; + + int _depth; + int _scale; + int _dynamicHotspotIndex; + + bool _nonFixed; + int _field13; + + Common::Point _msgPos; + int _triggerCountdown; + bool _doneFlag; + SequenceSubEntries _entries; + AbortTimerMode _abortMode; + + uint16 _actionNouns[3]; + int _numTicks; + int _extraTicks; + uint32 _timeout; + + SequenceEntry(); +}; + +class MADSEngine; + +class SequenceList { +private: + MADSEngine *_vm; + Common::Array _entries; + int _actionNouns[3]; +public: + SequenceList(MADSEngine *vm); + + SequenceEntry &operator[](int index) { return _entries[index]; } + void clear(); + bool addSubEntry(int index, SequenceSubEntryMode mode, int frameIndex, int abortVal); + int add(int spriteListIndex, bool flipped, int frameIndex, int triggerCountdown, int delayTicks, + int extraTicks, int numTicks, int msgX, int msgY, bool nonFixed, char scale, uint8 depth, + int frameInc, SpriteAnimType animType, int numSprites, int frameStart); + void remove(int seqIndex); + void setSpriteSlot(int seqIndex, SpriteSlot &spriteSlot); + bool loadSprites(int seqIndex); + void tick(); + void delay(uint32 v1, uint32 v2); + void setAnimRange(int seqIndex, int startVal, int endVal); + void scan(); + void setDepth(int seqIndex, int depth); +}; + +} // End of namespace MADS + +#endif /* MADS_SEQUENCE_H */ -- cgit v1.2.3 From 9e356dd945863a4c4dfa89f2a94dd1a56c2d03a6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 3 Mar 2014 23:40:23 -0500 Subject: MADS: Implemented extra message and dirty area classes --- engines/mads/animation.cpp | 4 + engines/mads/animation.h | 5 + engines/mads/debugger.cpp | 12 ++ engines/mads/debugger.h | 6 +- engines/mads/font.cpp | 1 - engines/mads/game.cpp | 18 +++ engines/mads/game.h | 5 + engines/mads/messages.cpp | 384 ++++++++++++++++++++++++++++++++++++++++++++ engines/mads/messages.h | 148 +++++++++++++++++ engines/mads/module.mk | 1 + engines/mads/scene.cpp | 20 ++- engines/mads/scene.h | 8 +- engines/mads/scene_data.cpp | 164 +++++++++++++++++-- engines/mads/scene_data.h | 79 +++++---- 14 files changed, 802 insertions(+), 53 deletions(-) create mode 100644 engines/mads/messages.cpp create mode 100644 engines/mads/messages.h diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index 8ea95ee168..0546fc3d34 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -297,4 +297,8 @@ void Animation::loadInterface(InterfaceSurface &interfaceSurface, MSurface &dept } } +void Animation::update() { + warning("TODO: Animation::update"); +} + } // End of namespace MADS diff --git a/engines/mads/animation.h b/engines/mads/animation.h index ce145cdd35..1f0e1fda65 100644 --- a/engines/mads/animation.h +++ b/engines/mads/animation.h @@ -135,6 +135,11 @@ public: */ void load(MSurface &depthSurface, InterfaceSurface &interfaceSurface, const Common::String &resName, int flags, Common::Array *palAnimData, SceneInfo *sceneInfo); + + /** + * Update the animation + */ + void update(); }; } // End of namespace MADS diff --git a/engines/mads/debugger.cpp b/engines/mads/debugger.cpp index ceaeeaa5dd..34b12c1680 100644 --- a/engines/mads/debugger.cpp +++ b/engines/mads/debugger.cpp @@ -26,6 +26,8 @@ namespace MADS { Debugger::Debugger(MADSEngine *vm) : GUI::Debugger(), _vm(vm) { + _showMousePos = false; + DCmd_Register("continue", WRAP_METHOD(Debugger, Cmd_Exit)); } /* @@ -46,4 +48,14 @@ static int strToInt(const char *s) { } */ +bool Debugger::Cmd_Mouse(int argc, const char **argv) { + if (argc < 2) { + DebugPrintf("Format: mouse [ on | off ]\n"); + } else { + _showMousePos = strcmp(argv[1], "on") == 0; + } + + return true; +} + } // End of namespace MADS diff --git a/engines/mads/debugger.h b/engines/mads/debugger.h index 044151c0bb..983b9931fc 100644 --- a/engines/mads/debugger.h +++ b/engines/mads/debugger.h @@ -33,11 +33,13 @@ class MADSEngine; class Debugger : public GUI::Debugger { private: MADSEngine *_vm; +protected: + bool Cmd_Mouse(int argc, const char **argv); +public: + bool _showMousePos; public: Debugger(MADSEngine *vm); virtual ~Debugger() {} - -protected: }; } // End of namespace MADS diff --git a/engines/mads/font.cpp b/engines/mads/font.cpp index 10d51fbbc0..0ff01905ce 100644 --- a/engines/mads/font.cpp +++ b/engines/mads/font.cpp @@ -93,7 +93,6 @@ void Font::setColors(uint8 v1, uint8 v2, uint8 v3, uint8 v4) { _fontColors[0] = v1; _fontColors[1] = v2; _fontColors[2] = v3; - _fontColors[3] = v4; } int Font::write(MSurface *surface, const Common::String &msg, const Common::Point &pt, int width, int spaceWidth, uint8 colors[]) { diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 37027685dd..479c48cc2f 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -278,4 +278,22 @@ void Game::loadResourceSequence(const Common::String prefix, int v) { warning("TODO: loadResourceSequence"); } +Common::String Game::getQuote(int quoteId) { + if (_quotes && *_quotes) { + // Loop through the list of quotes + char *p = (char *)_quotes; + while (*p) { + // Get a pointer to the quote Id after the string + char *idP = p + strlen(p) + 1; + if (READ_LE_UINT16(idP) == quoteId) + // Found the correct string, so return it + return Common::String(p); + + p = idP + 2; + } + } + + return Common::String(); +} + } // End of namespace MADS diff --git a/engines/mads/game.h b/engines/mads/game.h index 148fc121cd..47eed34393 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -124,6 +124,11 @@ public: * Run the game */ void run(); + + /** + * Get a quote + */ + Common::String getQuote(int quoteId); }; } // End of namespace MADS diff --git a/engines/mads/messages.cpp b/engines/mads/messages.cpp new file mode 100644 index 0000000000..c08f29fd91 --- /dev/null +++ b/engines/mads/messages.cpp @@ -0,0 +1,384 @@ +/* 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 "common/scummsys.h" +#include "mads/mads.h" +#include "mads/font.h" +#include "mads/graphics.h" +#include "mads/messages.h" +#include "mads/scene_data.h" + +namespace MADS { + +KernelMessages::KernelMessages(MADSEngine *vm): _vm(vm) { + Scene &scene = _vm->_game->_scene; + + for (int i = 0; i < KERNEL_MESSAGES_SIZE; ++i) { + KernelMessage rec; + _entries.push_back(rec); + } + + scene._textSpacing = -1; + _talkFont = _vm->_font->getFont(FONT_CONVERSATION); + word_8469E = 0; +} + +void KernelMessages::clear() { + Scene &scene = _vm->_game->_scene; + + for (uint i = 0; i < _entries.size(); ++i) + _entries[i]._flags = 0; + + scene._textSpacing = -1; + _talkFont = _vm->_font->getFont(FONT_CONVERSATION); +} + +int KernelMessages::add(const Common::Point &pt, uint fontColor, uint8 flags, + uint8 abortTimers, uint32 timeout, const Common::String &msg) { + Scene &scene = _vm->_game->_scene; + + // Find a free slot + uint idx = 0; + while ((idx < _entries.size()) && ((_entries[idx]._flags & KMSG_ACTIVE) != 0)) + ++idx; + if (idx == _entries.size()) { + if (abortTimers == 0) + return -1; + + error("KernelMessages overflow"); + } + + KernelMessage &rec = _entries[idx]; + rec._msg = msg; + rec._flags = flags | KMSG_ACTIVE; + rec._color1 = fontColor & 0xff; + rec._color2 = fontColor >> 8; + rec._position = pt; + rec._textDisplayIndex = -1; + rec._timeout = timeout; + rec._frameTimer = _vm->_game->_currentTimer; + rec._abortTimers = abortTimers; + rec._abortMode = _vm->_game->_abortTimersMode2; + + rec._actionDetails = scene._action._activeAction; + + if (flags & KMSG_PLAYER_TIMEOUT) + rec._frameTimer = _vm->_game->_player._ticksAmount + + _vm->_game->_player._priorTimer; + + return idx; +} + +int KernelMessages::addQuote(int quoteId, int abortTimers, uint32 timeout) { + Common::String quoteStr = _vm->_game->getQuote(quoteId); + return add(Common::Point(), 0x1110, KMSG_PLAYER_TIMEOUT | KMSG_CENTER_ALIGN, abortTimers, timeout, quoteStr); +} + +void KernelMessages::scrollMessage(int msgIndex, int numTicks, bool quoted) { + if (msgIndex < 0) + return; + + _entries[msgIndex]._flags |= quoted ? (KMSG_SCROLL | KMSG_QUOTED) : KMSG_SCROLL; + _entries[msgIndex]._msgOffset = 0; + _entries[msgIndex]._numTicks = numTicks; + _entries[msgIndex]._frameTimer2 = _vm->_game->_currentTimer; + + Common::String msg = _entries[msgIndex]._msg; + _entries[msgIndex]._asciiChar = msg[0]; + _entries[msgIndex]._asciiChar2 = msg[1]; + + if (_entries[msgIndex]._flags & KMSG_PLAYER_TIMEOUT) + _entries[msgIndex]._frameTimer2 = _vm->_game->_player._ticksAmount + + _vm->_game->_player._priorTimer; + + _entries[msgIndex]._frameTimer = _entries[msgIndex]._frameTimer2; +} + +void KernelMessages::setSeqIndex(int msgIndex, int seqIndex) { + if (msgIndex >= 0) { + _entries[msgIndex]._flags |= KMSG_SEQ_ENTRY; + _entries[msgIndex]._sequenceIndex = seqIndex; + } +} + +void KernelMessages::remove(int msgIndex) { + KernelMessage &rec = _entries[msgIndex]; + Scene &scene = _vm->_game->_scene; + + if (rec._flags & KMSG_ACTIVE) { + if (rec._flags & KMSG_SCROLL) { + rec._msg.setChar(rec._asciiChar, rec._msgOffset); + rec._msg.setChar(rec._asciiChar2, rec._msgOffset + 1); + } + + if (rec._textDisplayIndex >= 0) + scene._textDisplay.expire(rec._textDisplayIndex); + + rec._flags &= ~KMSG_ACTIVE; + } +} + +void KernelMessages::reset() { + for (uint i = 0; i < _entries.size(); ++i) + remove(i); + + warning("TODO: KernelMessages::reset - sub_20454"); +} + +void KernelMessages::update() { + uint32 currentTimer = _vm->_game->_currentTimer; + + for (uint i = 0; i < _entries.size(); ++i) { + if (((_entries[i]._flags & KMSG_ACTIVE) != 0) && + (currentTimer >= _entries[i]._frameTimer)) + processText(i); + } +} + +void KernelMessages::processText(int msgIndex) { + Scene &scene = _vm->_game->_scene; + KernelMessage &msg = _entries[msgIndex]; + uint32 currentTimer = _vm->_game->_currentTimer; + bool flag = false; + + if ((msg._flags & KMSG_EXPIRE) != 0) { + scene._textDisplay.expire(msg._textDisplayIndex); + msg._flags &= !KMSG_ACTIVE; + return; + } + + if ((msg._flags & KMSG_SCROLL) == 0) { + msg._timeout -= 3; + } + + if (msg._flags & KMSG_SEQ_ENTRY) { + SequenceEntry &seqEntry = scene._sequences[msg._sequenceIndex]; + if (seqEntry._doneFlag || !seqEntry._active) + msg._timeout = 0; + } + + if ((msg._timeout <= 0) && (_vm->_game->_abortTimers == 0)) { + msg._flags |= KMSG_EXPIRE; + if (msg._abortTimers != 0) { + _vm->_game->_abortTimers = msg._abortTimers; + _vm->_game->_abortTimersMode = msg._abortMode; + + if (_vm->_game->_abortTimersMode != ABORTMODE_1) { + scene._action._activeAction = msg._actionDetails; + } + } + } + + msg._frameTimer = currentTimer + 3; + int x1 = 0, y1 = 0; + + if (msg._flags & KMSG_SEQ_ENTRY) { + SequenceEntry &seqEntry = scene._sequences[msg._sequenceIndex]; + if (!seqEntry._nonFixed) { + SpriteAsset &spriteSet = scene._spriteSlots.getSprite(seqEntry._spritesIndex); + MSprite *frame = spriteSet.getFrame(seqEntry._frameIndex - 1); + x1 = frame->getBounds().left; + y1 = frame->getBounds().top; + } else { + x1 = seqEntry._msgPos.x; + y1 = seqEntry._msgPos.y; + } + } + + if (msg._flags & KMSG_PLAYER_TIMEOUT) { + if (word_8469E != 0) { + warning("TODO: KernelMessages::processText"); + // TODO: Figure out various flags + } else { + x1 = 160; + y1 = 78; + } + } + + x1 += msg._position.x; + y1 += msg._position.y; + + if ((msg._flags & KMSG_SCROLL) && (msg._frameTimer >= currentTimer)) { + msg._msg.setChar(msg._asciiChar, msg._msgOffset); + + ++msg._msgOffset; + msg._msg.setChar(msg._asciiChar2, msg._msgOffset); + msg._asciiChar = msg._msg[msg._msgOffset]; + msg._asciiChar2 = msg._msg[msg._msgOffset + 1]; + + if (!msg._asciiChar) { + // End of message + msg._msg.setChar('\0', msg._msgOffset); + msg._flags &= ~KMSG_SCROLL; + } else if (msg._flags & KMSG_QUOTED) { + msg._msg.setChar('"', msg._msgOffset); + msg._msg.setChar('\0', msg._msgOffset + 1); + } + + msg._frameTimer = msg._frameTimer2 = currentTimer + msg._numTicks; + flag = true; + } + + int strWidth = _talkFont->getWidth(msg._msg, scene._textSpacing); + + if (msg._flags & (KMSG_RIGHT_ALIGN | KMSG_CENTER_ALIGN)) { + x1 -= (msg._flags & KMSG_CENTER_ALIGN) ? strWidth / 2 : strWidth; + } + + // Make sure text appears entirely on-screen + int x2 = x1 + strWidth; + if (x2 > MADS_SCREEN_WIDTH) + x1 -= x2 - MADS_SCREEN_WIDTH; + if (x1 > (MADS_SCREEN_WIDTH - 1)) + x1 = MADS_SCREEN_WIDTH - 1; + if (x1 < 0) + x1 = 0; + + if (y1 >(MADS_SCENE_HEIGHT - 1)) + y1 = MADS_SCENE_HEIGHT - 1; + if (y1 < 0) + y1 = 0; + + if (msg._textDisplayIndex >= 0) { + TextDisplay &textEntry = scene._textDisplay[msg._textDisplayIndex]; + + if (flag || (textEntry._bounds.left != x1) || (textEntry._bounds.top != y1)) { + // Mark the associated text entry as deleted, so it can be re-created + scene._textDisplay.expire(msg._textDisplayIndex); + msg._textDisplayIndex = -1; + } + } + + if (msg._textDisplayIndex < 0) { + // Need to create a new text display entry for this message + int idx = scene._textDisplay.add(x1, y1, msg._color1 | (msg._color2 << 8), + scene._textSpacing, msg._msg, _talkFont); + if (idx >= 0) + msg._textDisplayIndex = idx; + } +} + +/*------------------------------------------------------------------------*/ + +TextDisplay::TextDisplay() { + _active = false; + _expire = 0; + _spacing = 0; + _color1 = 0; + _color2 = 0; + _font = nullptr; +} + +/*------------------------------------------------------------------------*/ + +TextDisplayList::TextDisplayList(MADSEngine *vm) : _vm(vm) { + for (int i = 0; i < TEXT_DISPLAY_SIZE; ++i) { + TextDisplay rec; + rec._active = false; + rec._expire = 0; + _entries.push_back(rec); + } +} + +void TextDisplayList::clear() { + for (int i = 0; i < TEXT_DISPLAY_SIZE; ++i) + _entries[i]._active = false; +} + +int TextDisplayList::add(int xp, int yp, uint fontColor, int charSpacing, + const Common::String &msg, Font *font) { + int usedSlot = -1; + + for (int idx = 0; idx < TEXT_DISPLAY_SIZE; ++idx) { + if (!_entries[idx]._active) { + usedSlot = idx; + + _entries[idx]._bounds.left = xp; + _entries[idx]._bounds.top = yp; + _entries[idx]._font = font; + _entries[idx]._msg = msg; + _entries[idx]._bounds.setWidth(font->getWidth(msg, charSpacing)); + _entries[idx]._bounds.setHeight(font->getHeight()); + _entries[idx]._color1 = fontColor & 0xff; + _entries[idx]._color2 = fontColor >> 8; + _entries[idx]._spacing = charSpacing; + _entries[idx]._expire = 1; + _entries[idx]._active = true; + break; + } + } + + return usedSlot; +} + +void TextDisplayList::setDirtyAreas() { + Scene &scene = _vm->_game->_scene; + + for (uint idx = 0, dirtyIdx = DIRTY_AREAS_TEXT_DISPLAY_IDX; dirtyIdx < DIRTY_AREAS_SIZE; ++idx, ++dirtyIdx) { + if ((_entries[idx]._expire >= 0) || !_entries[idx]._active) + scene._dirtyAreas[dirtyIdx]._active = false; + else { + scene._dirtyAreas[dirtyIdx]._textActive = true; + scene._dirtyAreas.setTextDisplay(dirtyIdx, _entries[idx]); + } + } +} + +void TextDisplayList::setDirtyAreas2() { + Scene &scene = _vm->_game->_scene; + + for (uint idx = 0, dirtyIdx = DIRTY_AREAS_TEXT_DISPLAY_IDX; dirtyIdx < DIRTY_AREAS_SIZE; ++idx, ++dirtyIdx) { + if (_entries[idx]._active && (_entries[idx]._expire >= 0)) { + scene._dirtyAreas.setTextDisplay(dirtyIdx, _entries[idx]); + scene._dirtyAreas[dirtyIdx]._textActive = (_entries[idx]._expire <= 0) ? 0 : 1; + } + } +} + +void TextDisplayList::draw(MSurface *view) { + error("TODO"); + /* + for (uint idx = 0; idx < _entries.size(); ++idx) { + if (_entries[idx]._active && (_entries[idx]._expire >= 0)) { + _entries[idx]._font->setColors(_entries[idx]._color1, _entries[idx]._color2, 0); + _entries[idx]._font->writeString(view, _entries[idx]._msg, + Common::Point(_entries[idx]._bounds.left, _entries[idx]._bounds.top), + _entries[idx]._bounds.width(), _entries[idx]._spacing); + } + } + */ +} + +void TextDisplayList::cleanUp() { + for (uint idx = 0; idx < _entries.size(); ++idx) { + if (_entries[idx]._expire < 0) { + _entries[idx]._active = false; + _entries[idx]._expire = 0; + } + } +} + +void TextDisplayList::expire(int idx) { + _entries[idx]._expire = -1; +} + +} // End of namespace MADS diff --git a/engines/mads/messages.h b/engines/mads/messages.h new file mode 100644 index 0000000000..b60ca8cedc --- /dev/null +++ b/engines/mads/messages.h @@ -0,0 +1,148 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_MESSAGES_H +#define MADS_MESSAGES_H + +#include "common/scummsys.h" +#include "common/array.h" +#include "mads/action.h" +#include "mads/font.h" +#include "mads/msurface.h" + +namespace MADS { + +#define KERNEL_MESSAGES_SIZE 10 +#define INDEFINITE_TIMEOUT 9999999 +#define TEXT_DISPLAY_SIZE 40 + +enum KernelMessageFlags { + KMSG_QUOTED = 1, KMSG_PLAYER_TIMEOUT = 2, KMSG_SEQ_ENTRY = 4, KMSG_SCROLL = 8, + KMSG_RIGHT_ALIGN = 0x10, KMSG_CENTER_ALIGN = 0x20, KMSG_EXPIRE = 0x40, + KMSG_ACTIVE = 0x80 +}; + +class MADSEngine; + +class KernelMessage { +public: + uint8 _flags; + int _sequenceIndex; + char _asciiChar; + char _asciiChar2; + int _color1; + int _color2; + Common::Point _position; + int _textDisplayIndex; + int _msgOffset; + int _numTicks; + uint32 _frameTimer2; + uint32 _frameTimer; + uint32 _timeout; + int _abortTimers; + AbortTimerMode _abortMode; + ActionDetails _actionDetails; + Common::String _msg; + + KernelMessage(); +}; + +class KernelMessages { +private: + MADSEngine *_vm; + Common::Array _entries; + Font *_talkFont; +public: + int word_8469E; +public: + KernelMessages(MADSEngine *vm); + + void clear(); + int add(const Common::Point &pt, uint fontColor, uint8 flags, uint8 abortTimers, + uint32 timeout, const Common::String &msg); + int addQuote(int quoteId, int abortTimers, uint32 timeout); + void scrollMessage(int msgIndex, int numTicks, bool quoted); + void setSeqIndex(int msgIndex, int seqIndex); + void remove(int msgIndex); + void reset(); + void update(); + void processText(int msgIndex); +}; + +class TextDisplay { +public: + bool _active; + int _expire; + int _spacing; + Common::Rect _bounds; + uint8 _color1; + uint8 _color2; + Font *_font; + Common::String _msg; + + TextDisplay(); +}; + +#define TEXT_DISPLAY_SIZE 40 + +class TextDisplayList { +private: + MADSEngine *_vm; + Common::Array _entries; + + /** + * Determine dirty areas for active text areas + */ + void setDirtyAreas2(); +public: + TextDisplayList(MADSEngine *vm); + + /** + * Item operator + */ + TextDisplay &operator[](int idx) { + return _entries[idx]; + } + + /** + * Expire a given text display entry + */ + void expire(int idx); + + int add(int xp, int yp, uint fontColor, int charSpacing, const Common::String &, Font *font); + void clear(); + void draw(MSurface *view); + + /** + * Determine dirty areas for active text areas + */ + void setDirtyAreas(); + + /** + * Deactivates any text display entries that are finished + */ + void cleanUp(); +}; + +} // End of namespace MADS + +#endif /* MADS_MESSAGES_H */ diff --git a/engines/mads/module.mk b/engines/mads/module.mk index 826e54f8fd..36d0c49ff7 100644 --- a/engines/mads/module.mk +++ b/engines/mads/module.mk @@ -19,6 +19,7 @@ MODULE_OBJS := \ game_data.o \ graphics.o \ mads.o \ + messages.o \ msprite.o \ msurface.o \ palette.o \ diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 6efbdf5072..a0888f7d68 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -29,8 +29,8 @@ namespace MADS { Scene::Scene(MADSEngine *vm): _vm(vm), _spriteSlots(vm), _action(_vm), - _dynamicHotspots(vm), _screenObjects(vm), _interface(vm), - _sequences(vm) { + _dirtyAreas(_vm), _dynamicHotspots(vm), _interface(vm), _messages(vm), + _screenObjects(vm), _sequences(vm), _textDisplay(vm) { _priorSceneId = 0; _nextSceneId = 0; _currentSceneId = 0; @@ -45,6 +45,8 @@ Scene::Scene(MADSEngine *vm): _vm(vm), _spriteSlots(vm), _action(_vm), _reloadSceneFlag = false; _destFacing = 0; _freeAnimationFlag = false; + _animation = nullptr; + _activeAnimation = nullptr; _verbList.push_back(VerbInit(VERB_LOOK, 2, 0)); _verbList.push_back(VerbInit(VERB_TAKE, 2, 0)); @@ -356,9 +358,21 @@ void Scene::doFrame() { _vm->_events->setCursor(cursorId); } - if (!_vm->_game->_abortTimers) + if (!_vm->_game->_abortTimers) { + // Handle any active sequences _sequences.tick(); + // Handle any active animation + if (_activeAnimation) + _activeAnimation->update(); + } + + // If the debugget flag is set, show the mouse position + if (_vm->_debugger->_showMousePos) { + Common::Point pt = _vm->_events->mousePos(); + Common::String msg = Common::String::format("(%d,%d)", pt.x, pt.y); + _messages.add(Common::Point(5, 5), 0x203, 0, 0, 1, msg); + } // TODO: Rest of Scene::doFrame } diff --git a/engines/mads/scene.h b/engines/mads/scene.h index 71bfe317d9..f6eecbf093 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -27,6 +27,7 @@ #include "common/array.h" #include "common/rect.h" #include "mads/assets.h" +#include "mads/messages.h" #include "mads/msurface.h" #include "mads/scene_data.h" #include "mads/animation.h" @@ -78,7 +79,7 @@ public: int _nextSceneId; int _currentSceneId; Common::Array _verbList; - Common::Array _textDisplay; + TextDisplayList _textDisplay; SpriteSlots _spriteSlots; SpriteSets _sprites; int _spritesIndex; @@ -86,11 +87,12 @@ public: byte *_vocabBuffer; Common::Array _activeVocabs; SequenceList _sequences; - Common::Array _messages; + KernelMessages _messages; Common::String _talkFont; int _textSpacing; Common::Array _hotspots; ScreenObjects _screenObjects; + DirtyAreas _dirtyAreas; int _v1; SceneInfo *_sceneInfo; MSurface _backgroundSurface; @@ -104,6 +106,7 @@ public: SceneNodeList _nodes; Common::StringArray _vocabStrings; Animation *_animation; + Animation *_activeAnimation; bool _freeAnimationFlag; int _depthStyle; int _bandsRange; @@ -118,6 +121,7 @@ public: bool _reloadSceneFlag; Common::Point _destPos; int _destFacing; + Common::Point _posAdjust; /** * Constructor diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index 6fa2f5b326..985b961e00 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -202,11 +202,152 @@ int SpriteSets::add(SpriteAsset *asset, int idx) { /*------------------------------------------------------------------------*/ -TextDisplay::TextDisplay() { - _active = false; - _spacing = 0; - _expire = 0; - _col1 = _col2 = 0; +void DirtyArea::setArea(int width, int height, int maxWidth, int maxHeight) { + if (_bounds.left % 2) { + --_bounds.left; + ++width; + } + + if (_bounds.left < 0) + _bounds.left = 0; + else if (_bounds.left > maxWidth) + _bounds.left = maxWidth; + int right = _bounds.left + width; + if (right < 0) + right = 0; + if (right > maxWidth) + right = maxWidth; + + _bounds.right = right; + _bounds2.left = _bounds.width() / 2; + _bounds2.right = _bounds.left + (_bounds.width() + 1) / 2 - 1; + + if (_bounds.top < 0) + _bounds.top = 0; + else if (_bounds.top > maxHeight) + _bounds.top = maxHeight; + int bottom = _bounds.top + height; + if (bottom < 0) + bottom = 0; + if (bottom > maxHeight) + bottom = maxHeight; + + _bounds.bottom = bottom; + _bounds2.top = _bounds.height() / 2; + _bounds2.bottom = _bounds.top + (_bounds.height() + 1) / 2 - 1; + + _active = true; +} + +/*------------------------------------------------------------------------*/ + +DirtyAreas::DirtyAreas(MADSEngine *vm) : _vm(vm) { + for (int i = 0; i < DIRTY_AREAS_SIZE; ++i) { + DirtyArea rec; + rec._active = false; + _entries.push_back(rec); + } +} + +void DirtyAreas::setSpriteSlot(int dirtyIdx, const SpriteSlot &spriteSlot) { + int width, height; + DirtyArea &dirtyArea = _entries[dirtyIdx]; + Scene &scene = _vm->_game->_scene; + + if (spriteSlot._spriteType == ST_FULL_SCREEN_REFRESH) { + // Special entry to refresh the entire screen + dirtyArea._bounds.left = 0; + dirtyArea._bounds.top = 0; + width = MADS_SCREEN_WIDTH; + height = MADS_SCENE_HEIGHT; + } else { + // Standard sprite slots + dirtyArea._bounds.left = spriteSlot._position.x - scene._posAdjust.x; + dirtyArea._bounds.top = spriteSlot._position.y - scene._posAdjust.y; + + SpriteAsset &spriteSet = scene._spriteSlots.getSprite(spriteSlot._spritesIndex); + MSprite *frame = spriteSet.getFrame(((spriteSlot._frameNumber & 0x7fff) - 1) & 0x7f); + + if (spriteSlot._scale == -1) { + width = frame->getWidth(); + height = frame->getHeight(); + } else { + width = frame->getWidth() * spriteSlot._scale / 100; + height = frame->getHeight() * spriteSlot._scale / 100; + + dirtyArea._bounds.left -= width / 2; + dirtyArea._bounds.top += -(height - 1); + } + } + + dirtyArea.setArea(width, height, MADS_SCREEN_WIDTH, MADS_SCENE_HEIGHT); +} + +void DirtyAreas::setTextDisplay(int dirtyIdx, const TextDisplay &textDisplay) { + DirtyArea &dirtyArea = _entries[dirtyIdx]; + dirtyArea._bounds.left = textDisplay._bounds.left; + dirtyArea._bounds.top = textDisplay._bounds.top; + + dirtyArea.setArea(textDisplay._bounds.width(), textDisplay._bounds.height(), + MADS_SCREEN_WIDTH, MADS_SCENE_HEIGHT); +} + +void DirtyAreas::merge(int startIndex, int count) { + error("TODO: DirtyAreas::merge"); + if (startIndex >= count) + return; + + for (int outerCtr = startIndex - 1, idx = 0; idx < count; ++outerCtr, ++idx) { + if (!_entries[outerCtr]._active) + continue; + + for (int innerCtr = outerCtr + 1; innerCtr < count; ++innerCtr) { + if (!_entries[innerCtr]._active || !intersects(outerCtr, innerCtr)) + continue; + + if (_entries[outerCtr]._textActive && _entries[innerCtr]._textActive) + mergeAreas(outerCtr, innerCtr); + } + } +} + +/** +* Returns true if two dirty areas intersect +*/ +bool DirtyAreas::intersects(int idx1, int idx2) { + return _entries[idx1]._bounds2.intersects(_entries[idx2]._bounds2); +} + +void DirtyAreas::mergeAreas(int idx1, int idx2) { + DirtyArea &da1 = _entries[idx1]; + DirtyArea &da2 = _entries[idx2]; + + da1._bounds.extend(da2._bounds); + + da1._bounds2.left = da1._bounds.width() / 2; + da1._bounds2.right = da1._bounds.left + (da1._bounds.width() + 1) / 2 - 1; + da1._bounds2.top = da1._bounds.height() / 2; + da1._bounds2.bottom = da1._bounds.top + (da1._bounds.height() + 1) / 2 - 1; + + da2._active = false; + da1._textActive = true; +} + +void DirtyAreas::copy(MSurface *dest, MSurface *src, const Common::Point &posAdjust) { + for (uint i = 0; i < _entries.size(); ++i) { + const Common::Rect &srcBounds = _entries[i]._bounds; + + Common::Rect bounds(srcBounds.left + posAdjust.x, srcBounds.top + posAdjust.y, + srcBounds.right + posAdjust.x, srcBounds.bottom + posAdjust.y); + + if (_entries[i]._active && _entries[i]._bounds.isValidRect()) + src->copyTo(dest, bounds, Common::Point(_entries[i]._bounds.left, _entries[i]._bounds.top)); + } +} + +void DirtyAreas::clear() { + for (uint i = 0; i < _entries.size(); ++i) + _entries[i]._active = false; } /*------------------------------------------------------------------------*/ @@ -315,18 +456,21 @@ void DynamicHotspots::refresh() { KernelMessage::KernelMessage() { _flags = 0; - _seqInex = 0; + _sequenceIndex = 0; _asciiChar = '\0'; _asciiChar2 = '\0'; - _colors = 0; + _color1 = 0; + _color2 = 0; _msgOffset = 0; _numTicks = 0; _frameTimer2 = 0; _frameTimer = 0; _timeout = 0; - _field1C = 0; - _abortMode = 0; - _nounList[0] = _nounList[1] = _nounList[2] = 0; + _abortTimers = 0; + _abortMode = ABORTMODE_0; + _actionDetails._verbId = 0; + _actionDetails._objectNameId = 0; + _actionDetails._indirectObjectId = 0; } /*------------------------------------------------------------------------*/ diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index dc59bff4cf..f26069ca7e 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -32,6 +32,7 @@ #include "mads/assets.h" #include "mads/events.h" #include "mads/game_data.h" +#include "mads/messages.h" namespace MADS { @@ -44,6 +45,9 @@ class Scene; #define DEPTH_BANDS_SIZE 15 #define MAX_ROUTE_NODES 22 +#define DIRTY_AREAS_SIZE 90 +#define DIRTY_AREAS_TEXT_DISPLAY_IDX 50 + enum ScrCategory { CAT_NONE = 0, CAT_ACTION = 1, CAT_INV_LIST = 2, CAT_INV_VOCAB = 3, CAT_HOTSPOT = 4, CAT_INV_ANIM = 5, CAT_6 = 6, CAT_INV_SCROLLER = 7, @@ -175,20 +179,6 @@ public: int add(SpriteAsset *asset, int idx = 0); }; -class TextDisplay { -public: - bool _active; - int _spacing; - Common::Rect _bounds; - int _expire; - int _col1; - int _col2; - Common::String _fontName; - Common::String _msg; - - TextDisplay(); -}; - class DynamicHotspot { public: bool _active; @@ -226,27 +216,6 @@ public: void refresh(); }; -class KernelMessage { -public: - int _flags; - int _seqInex; - char _asciiChar; - char _asciiChar2; - int _colors; - Common::Point _posiition; - int _msgOffset; - int _numTicks; - int _frameTimer2; - int _frameTimer; - int _timeout; - int _field1C; - int _abortMode; - int _nounList[3]; - Common::String _msg; - - KernelMessage(); -}; - class Hotspot { public: Common::Rect _bounds; @@ -261,6 +230,46 @@ public: Hotspot(Common::SeekableReadStream &f); }; +class DirtyArea { +public: + Common::Rect _bounds; + Common::Rect _bounds2; + bool _textActive; + bool _active; + + DirtyArea() { _active = false; } + void setArea(int width, int height, int maxWidth, int maxHeight); +}; + +class DirtyAreas { +private: + MADSEngine *_vm; + Common::Array _entries; +public: + DirtyAreas(MADSEngine *vm); + + DirtyArea &operator[](uint idx) { + assert(idx < _entries.size()); + return _entries[idx]; + } + + void setSpriteSlot(int dirtyIdx, const SpriteSlot &spriteSlot); + + void setTextDisplay(int dirtyIdx, const TextDisplay &textDisplay); + + /** + * Merge together any designated dirty areas that overlap + * @param startIndex 1-based starting dirty area starting index + * @param count Number of entries to process + */ + void merge(int startIndex, int count); + + bool intersects(int idx1, int idx2); + void mergeAreas(int idx1, int idx2); + void copy(MSurface *dest, MSurface *src, const Common::Point &posAdjust); + void clear(); +}; + class SceneLogic { protected: Scene *_scene; -- cgit v1.2.3 From f6888eef1069ac5df07c3f4dcc3a30755bc4ebb0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 4 Mar 2014 09:33:57 -0500 Subject: MADS: Implementation of timer functionality for Scene::doFrame --- engines/mads/animation.cpp | 4 ++-- engines/mads/animation.h | 2 +- engines/mads/game.cpp | 4 ++-- engines/mads/game.h | 2 +- engines/mads/messages.cpp | 14 ++++++++++---- engines/mads/messages.h | 1 + engines/mads/scene.cpp | 39 +++++++++++++++++++++++++++++++++++---- engines/mads/scene.h | 7 ++++++- engines/mads/scene_data.cpp | 4 ++++ engines/mads/scene_data.h | 2 ++ engines/mads/sequence.cpp | 4 ++-- engines/mads/sequence.h | 2 +- 12 files changed, 67 insertions(+), 18 deletions(-) diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index 0546fc3d34..941533fa63 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -179,7 +179,7 @@ void Animation::load(MSurface &depthSurface, InterfaceSurface &interfaceSurface, for (int i = 0; i < aaHeader._spriteSetsCount; ++i) _spriteListIndexes.push_back(-1); - _messages.clear(); + _kernelMessages.clear(); if (aaHeader._messagesCount > 0) { // Chunk 2: Following is a list of any messages for the animation Common::SeekableReadStream *msgStream = madsPack.getItemStream(1); @@ -187,7 +187,7 @@ void Animation::load(MSurface &depthSurface, InterfaceSurface &interfaceSurface, for (int i = 0; i < aaHeader._messagesCount; ++i) { AnimMessage rec; rec.load(msgStream); - _messages.push_back(rec); + _kernelMessages.push_back(rec); } delete msgStream; diff --git a/engines/mads/animation.h b/engines/mads/animation.h index 1f0e1fda65..484856f769 100644 --- a/engines/mads/animation.h +++ b/engines/mads/animation.h @@ -119,7 +119,7 @@ public: static Animation *init(MADSEngine *vm, Scene *scene); public: Common::Array _spriteListIndexes; - Common::Array _messages; + Common::Array _kernelMessages; Common::Array _frameEntries; Common::Array _miscEntries; Common::Array _spriteSets; diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 479c48cc2f..025cf8d530 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -54,7 +54,7 @@ Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm), _v5 = _v6 = 0; _aaName = "*I0.AA"; _playerSpritesFlag = false; - _currentTimer = 0; + _priorFrameTimer = 0; _updateSceneFlag = false; _abortTimersMode = ABORTMODE_0; _abortTimersMode2 = ABORTMODE_0; @@ -199,7 +199,7 @@ void Game::sectionLoop() { } _abortTimers = 0; _abortTimersMode2 = ABORTMODE_1; - _currentTimer = _vm->_events->_currentTimer; + _priorFrameTimer = _vm->_events->_currentTimer; // Call the scene logic for entering the given scene _scene._sceneLogic->enter(); diff --git a/engines/mads/game.h b/engines/mads/game.h index 47eed34393..5330cd3138 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -116,7 +116,7 @@ public: int _abortTimers2; AbortTimerMode _abortTimersMode; AbortTimerMode _abortTimersMode2; - uint32 _currentTimer; + uint32 _priorFrameTimer; public: virtual ~Game(); diff --git a/engines/mads/messages.cpp b/engines/mads/messages.cpp index c08f29fd91..cc618c4b76 100644 --- a/engines/mads/messages.cpp +++ b/engines/mads/messages.cpp @@ -75,7 +75,7 @@ int KernelMessages::add(const Common::Point &pt, uint fontColor, uint8 flags, rec._position = pt; rec._textDisplayIndex = -1; rec._timeout = timeout; - rec._frameTimer = _vm->_game->_currentTimer; + rec._frameTimer = _vm->_game->_priorFrameTimer; rec._abortTimers = abortTimers; rec._abortMode = _vm->_game->_abortTimersMode2; @@ -100,7 +100,7 @@ void KernelMessages::scrollMessage(int msgIndex, int numTicks, bool quoted) { _entries[msgIndex]._flags |= quoted ? (KMSG_SCROLL | KMSG_QUOTED) : KMSG_SCROLL; _entries[msgIndex]._msgOffset = 0; _entries[msgIndex]._numTicks = numTicks; - _entries[msgIndex]._frameTimer2 = _vm->_game->_currentTimer; + _entries[msgIndex]._frameTimer2 = _vm->_game->_priorFrameTimer; Common::String msg = _entries[msgIndex]._msg; _entries[msgIndex]._asciiChar = msg[0]; @@ -145,7 +145,7 @@ void KernelMessages::reset() { } void KernelMessages::update() { - uint32 currentTimer = _vm->_game->_currentTimer; + uint32 currentTimer = _vm->_game->_priorFrameTimer; for (uint i = 0; i < _entries.size(); ++i) { if (((_entries[i]._flags & KMSG_ACTIVE) != 0) && @@ -157,7 +157,7 @@ void KernelMessages::update() { void KernelMessages::processText(int msgIndex) { Scene &scene = _vm->_game->_scene; KernelMessage &msg = _entries[msgIndex]; - uint32 currentTimer = _vm->_game->_currentTimer; + uint32 currentTimer = _vm->_game->_priorFrameTimer; bool flag = false; if ((msg._flags & KMSG_EXPIRE) != 0) { @@ -277,6 +277,12 @@ void KernelMessages::processText(int msgIndex) { } } +void KernelMessages::delay(uint32 priorFrameTime, uint32 currentTime) { + for (uint i = 0; i < _entries.size(); ++i) { + _entries[i]._timeout += currentTime - priorFrameTime; + } +} + /*------------------------------------------------------------------------*/ TextDisplay::TextDisplay() { diff --git a/engines/mads/messages.h b/engines/mads/messages.h index b60ca8cedc..6967755cdd 100644 --- a/engines/mads/messages.h +++ b/engines/mads/messages.h @@ -86,6 +86,7 @@ public: void reset(); void update(); void processText(int msgIndex); + void delay(uint32 priorFrameTime, uint32 currentTime); }; class TextDisplay { diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index a0888f7d68..4d62e64f31 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -29,7 +29,7 @@ namespace MADS { Scene::Scene(MADSEngine *vm): _vm(vm), _spriteSlots(vm), _action(_vm), - _dirtyAreas(_vm), _dynamicHotspots(vm), _interface(vm), _messages(vm), + _dirtyAreas(_vm), _dynamicHotspots(vm), _interface(vm), _kernelMessages(vm), _screenObjects(vm), _sequences(vm), _textDisplay(vm) { _priorSceneId = 0; _nextSceneId = 0; @@ -97,7 +97,7 @@ void Scene::clearSequenceList() { } void Scene::clearMessageList() { - _messages.clear(); + _kernelMessages.clear(); _talkFont = "*FONTCONV.FF"; _textSpacing = -1; } @@ -125,7 +125,7 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) { _spriteSlots.clear(false); _sequences.clear(); - _messages.clear(); + _kernelMessages.clear(); // TODO: palletteUsage reset? setPalette(_nullPalette); _sceneInfo = SceneInfo::init(_vm); @@ -371,14 +371,45 @@ void Scene::doFrame() { if (_vm->_debugger->_showMousePos) { Common::Point pt = _vm->_events->mousePos(); Common::String msg = Common::String::format("(%d,%d)", pt.x, pt.y); - _messages.add(Common::Point(5, 5), 0x203, 0, 0, 1, msg); + _kernelMessages.add(Common::Point(5, 5), 0x203, 0, 0, 1, msg); } + if (!_vm->_game->_abortTimers) { + if (_reloadSceneFlag || _currentSceneId != _nextSceneId) + _kernelMessages.reset(); + _kernelMessages.update(); + } + + _vm->_game->_abortTimers2 = !_vm->_game->_abortTimers2; + + warning("TODO: image_inter_list_call"); + + // Write any text needed by the interface + if (_vm->_game->_abortTimers2) + _interface.writeText(); + + // Draw any elements + drawElements(_vm->_game->_abortTimers2, _vm->_game->_abortTimers2); + + // Handle message updates + if (_vm->_game->_abortTimers2) { + uint32 priorTime = _vm->_game->_priorFrameTimer; + uint32 newTime = _vm->_events->getFrameCounter(); + _sequences.delay(newTime, priorTime); + _kernelMessages.delay(newTime, priorTime); + } + + warning("TODO: sub_1DA5A"); + // TODO: Rest of Scene::doFrame } } } +void Scene::drawElements(bool transitionFlag, bool surfaceFlag) { + +} + void Scene::leftClick() { warning("TODO: Scene::leftClick"); } diff --git a/engines/mads/scene.h b/engines/mads/scene.h index f6eecbf093..483ecae23c 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -87,7 +87,7 @@ public: byte *_vocabBuffer; Common::Array _activeVocabs; SequenceList _sequences; - KernelMessages _messages; + KernelMessages _kernelMessages; Common::String _talkFont; int _textSpacing; Common::Array _hotspots; @@ -183,6 +183,11 @@ public: */ void loop(); + /** + * Draw all the elements onto the scene + */ + void drawElements(bool transitionFlag, bool surfaceFlag); + /** * Execute a click within the scene */ diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index 985b961e00..5f60a1e56f 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -547,6 +547,10 @@ void InterfaceSurface::elementHighlighted() { warning("TODO: InterfaceSurface::elementHighlighted"); } +void InterfaceSurface::writeText() { + warning("TODO: InterfaceSurface::writeText"); +} + /*------------------------------------------------------------------------*/ void SceneInfo::SpriteInfo::load(Common::SeekableReadStream *f) { diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index f26069ca7e..b18eaffcbd 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -360,6 +360,8 @@ public: void load(const Common::String &resName); void elementHighlighted(); + + void writeText(); }; /** diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index 7c7b25d32a..8f25007b48 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -307,10 +307,10 @@ void SequenceList::tick() { } } -void SequenceList::delay(uint32 v1, uint32 v2) { +void SequenceList::delay(uint32 priorFrameTime, uint32 currentTime) { for (uint idx = 0; idx < _entries.size(); ++idx) { if (_entries[idx]._active) { - _entries[idx]._timeout += v1 - v2; + _entries[idx]._timeout += currentTime - priorFrameTime; } } } diff --git a/engines/mads/sequence.h b/engines/mads/sequence.h index 1b9aefe294..f73d48bb8f 100644 --- a/engines/mads/sequence.h +++ b/engines/mads/sequence.h @@ -98,7 +98,7 @@ public: void setSpriteSlot(int seqIndex, SpriteSlot &spriteSlot); bool loadSprites(int seqIndex); void tick(); - void delay(uint32 v1, uint32 v2); + void delay(uint32 priorFrameTime, uint32 currentTime); void setAnimRange(int seqIndex, int startVal, int endVal); void scan(); void setDepth(int seqIndex, int depth); -- cgit v1.2.3 From 1607a9104700e987cacfec41aaafd25d979aeb98 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 4 Mar 2014 20:06:48 -0500 Subject: MADS: Finished remainder of Scene::doFrame --- engines/mads/animation.cpp | 30 ++++++++++++++++++++++++++++-- engines/mads/animation.h | 8 +++++++- engines/mads/events.cpp | 11 +++++++++-- engines/mads/events.h | 10 ++++++++-- engines/mads/player.cpp | 9 +++++---- engines/mads/player.h | 5 +++-- engines/mads/scene.cpp | 23 ++++++++++++++++++++--- engines/mads/scene_data.cpp | 7 +++++++ engines/mads/scene_data.h | 6 +++++- 9 files changed, 92 insertions(+), 17 deletions(-) diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index 941533fa63..c97d707f39 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -139,6 +139,7 @@ Animation *Animation::init(MADSEngine *vm, Scene *scene) { Animation::Animation(MADSEngine *vm, Scene *scene) : _vm(vm), _scene(scene) { _font = nullptr; + _resetFlag = false; } Animation::~Animation() { @@ -147,6 +148,31 @@ Animation::~Animation() { delete _spriteSets[i]; } +void Animation::free() { + Scene &scene = _vm->_game->_scene; + Player &player = _vm->_game->_player; + + if (!scene._freeAnimationFlag) { + scene._spriteSlots.fullRefresh(true); + scene._sequences.scan(); + } + + // Refresh the player + if (player._visible) { + player._forceRefresh = true; + player.update(); + } + + // Remove any kernel messages in use by the animation + for (uint i = 0; i < _messages.size(); ++i) { + int msgIndex = _messages[i]._kernelMsgIndex; + scene._kernelMessages.remove(msgIndex); + } + + _resetFlag = false; + delete this; +} + void Animation::load(MSurface &depthSurface, InterfaceSurface &interfaceSurface, const Common::String &resName, int flags, Common::Array *palAnimData, SceneInfo *sceneInfo) { @@ -179,7 +205,7 @@ void Animation::load(MSurface &depthSurface, InterfaceSurface &interfaceSurface, for (int i = 0; i < aaHeader._spriteSetsCount; ++i) _spriteListIndexes.push_back(-1); - _kernelMessages.clear(); + _messages.clear(); if (aaHeader._messagesCount > 0) { // Chunk 2: Following is a list of any messages for the animation Common::SeekableReadStream *msgStream = madsPack.getItemStream(1); @@ -187,7 +213,7 @@ void Animation::load(MSurface &depthSurface, InterfaceSurface &interfaceSurface, for (int i = 0; i < aaHeader._messagesCount; ++i) { AnimMessage rec; rec.load(msgStream); - _kernelMessages.push_back(rec); + _messages.push_back(rec); } delete msgStream; diff --git a/engines/mads/animation.h b/engines/mads/animation.h index 484856f769..297abf4eee 100644 --- a/engines/mads/animation.h +++ b/engines/mads/animation.h @@ -119,17 +119,23 @@ public: static Animation *init(MADSEngine *vm, Scene *scene); public: Common::Array _spriteListIndexes; - Common::Array _kernelMessages; + Common::Array _messages; Common::Array _frameEntries; Common::Array _miscEntries; Common::Array _spriteSets; Font *_font; + bool _resetFlag; public: /* * Destructor */ ~Animation(); + /** + * Releases scene resources used by the animation, and then deletes it + */ + void free(); + /** * Loads animation data */ diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp index 0c2e2f2aea..1acb081d8a 100644 --- a/engines/mads/events.cpp +++ b/engines/mads/events.cpp @@ -35,7 +35,8 @@ namespace MADS { EventsManager::EventsManager(MADSEngine *vm) { _vm = vm; _cursorSprites = nullptr; - _gameCounter = 0; + _frameCounter = 0; + _frameNumber = 0; _priorFrameTime = 0; _keyPressed = false; _mouseClicked = false; @@ -140,7 +141,7 @@ void EventsManager::checkForNextFrameCounter() { // Check for next game frame uint32 milli = g_system->getMillis(); if ((milli - _priorFrameTime) >= GAME_FRAME_TIME) { - ++_gameCounter; + ++_frameCounter; _priorFrameTime = milli; // Give time to the debugger @@ -165,6 +166,12 @@ void EventsManager::delay(int cycles) { } } +void EventsManager::waitForNextFrame() { + uint32 frameNum = getFrameCounter(); + while (!_vm->shouldQuit() && !_vm->_game->_abortTimers && frameNum == _frameNumber) + delay(1); +} + void EventsManager::initVars() { _mousePos = Common::Point(-1, -1); _vD4 = _vCC; diff --git a/engines/mads/events.h b/engines/mads/events.h index 2782253bcc..add8fc34c0 100644 --- a/engines/mads/events.h +++ b/engines/mads/events.h @@ -37,7 +37,8 @@ class MADSEngine; class EventsManager { private: MADSEngine *_vm; - uint32 _gameCounter; + uint32 _frameCounter; + uint32 _frameNumber; uint32 _priorFrameTime; Common::Point _mousePos; Common::Point _currentPos; @@ -131,10 +132,15 @@ public: */ void delay(int amount); + /** + * Wait for the next frame + */ + void waitForNextFrame(); + /** * Gets the current frame counter */ - uint32 getFrameCounter() const { return _gameCounter; } + uint32 getFrameCounter() const { return _frameCounter; } void initVars(); }; diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index b0f4b72667..d19a0cb93e 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -40,6 +40,7 @@ Player::Player(MADSEngine *vm): _vm(vm) { _ticksAmount = 0; _priorTimer = 0; _unk3 = 0; + _forceRefresh = false; } void Player::reset() { @@ -80,6 +81,10 @@ void Player::updateFrame() { warning("TODO: Player::updateFrame"); } +void Player::update() { + warning("TODO: Player::update"); +} + void Player::resetActionList() { warning("TODO: Player::resetActionList"); } @@ -115,8 +120,4 @@ void Player::postUpdate() { warning("TODO: Player::postUpdate"); } -void Player::update() { - warning("TODO: Player::update"); -} - } // End of namespace MADS diff --git a/engines/mads/player.h b/engines/mads/player.h index 7792fb6bdd..cff131342d 100644 --- a/engines/mads/player.h +++ b/engines/mads/player.h @@ -43,8 +43,6 @@ private: void move(); void postUpdate(); - - void update(); public: int _direction; int _newDirection; @@ -66,6 +64,7 @@ public: int _ticksAmount; uint32 _priorTimer; int _unk3; + bool _forceRefresh; public: Player(MADSEngine *vm); @@ -79,6 +78,8 @@ public: void updateFrame(); + void update(); + void idle(); void setDest(const Common::Point &pt, int facing); diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 4d62e64f31..db252a95a4 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -368,10 +368,12 @@ void Scene::doFrame() { } // If the debugget flag is set, show the mouse position + int mouseTextIndex = 0; if (_vm->_debugger->_showMousePos) { Common::Point pt = _vm->_events->mousePos(); Common::String msg = Common::String::format("(%d,%d)", pt.x, pt.y); - _kernelMessages.add(Common::Point(5, 5), 0x203, 0, 0, 1, msg); + mouseTextIndex = _kernelMessages.add(Common::Point(5, 5), + 0x203, 0, 0, 1, msg); } if (!_vm->_game->_abortTimers) { @@ -399,11 +401,26 @@ void Scene::doFrame() { _kernelMessages.delay(newTime, priorTime); } - warning("TODO: sub_1DA5A"); + if (_vm->_debugger->_showMousePos) + // Mouse position display isn't persistent, so remove it + _kernelMessages.remove(mouseTextIndex); - // TODO: Rest of Scene::doFrame + + warning("TODO: sub_1DA3E"); } } + + if (_vm->_game->_abortTimers2) + _animFlag = true; + _vm->_game->_abortTimers2 = 0; + + if (_freeAnimationFlag) { + _activeAnimation->free(); + _activeAnimation = nullptr; + } + + // TODO: Verify correctness of frame wait + } void Scene::drawElements(bool transitionFlag, bool surfaceFlag) { diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index 5f60a1e56f..46ef2c3058 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -186,6 +186,13 @@ void SpriteSlots::deleteEntry(int index) { remove_at(index); } +void SpriteSlots::fullRefresh(bool clearAll) { + if (clearAll) + Common::Array::clear(); + + push_back(SpriteSlot(ST_FULL_SCREEN_REFRESH, -1)); +} + /*------------------------------------------------------------------------*/ int SpriteSets::add(SpriteAsset *asset, int idx) { diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index b18eaffcbd..522cd178d0 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -158,6 +158,11 @@ public: */ void deleteEntry(int index); + /** + * Adds a full screen refresh to the sprite slots + */ + void fullRefresh(bool clearAll = false); + SpriteAsset &getSprite(int idx) { error("TODO"); } @@ -168,7 +173,6 @@ public: warning("TODO: SpriteSlots::indexOf"); return -1; } - }; class SpriteSets: public Common::Array { -- cgit v1.2.3 From 568fc31b3090a70aa922479991540d4f5c2e918c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 4 Mar 2014 22:33:27 -0500 Subject: MADS: Beginnings of code support for Scene::drawElements --- engines/mads/assets.cpp | 9 ++ engines/mads/assets.h | 9 +- engines/mads/dialogs.cpp | 30 +++--- engines/mads/events.cpp | 2 +- engines/mads/events.h | 2 +- engines/mads/mads.cpp | 10 +- engines/mads/mads.h | 2 +- engines/mads/messages.cpp | 49 ++++----- engines/mads/messages.h | 10 +- engines/mads/module.mk | 2 +- engines/mads/msprite.cpp | 107 -------------------- engines/mads/msprite.h | 114 --------------------- engines/mads/msurface.cpp | 2 +- engines/mads/scene.cpp | 7 ++ engines/mads/scene.h | 1 + engines/mads/scene_data.cpp | 165 +++++++++--------------------- engines/mads/scene_data.h | 99 +++--------------- engines/mads/sprites.cpp | 239 ++++++++++++++++++++++++++++++++++++++++++++ engines/mads/sprites.h | 197 ++++++++++++++++++++++++++++++++++++ 19 files changed, 575 insertions(+), 481 deletions(-) delete mode 100644 engines/mads/msprite.cpp delete mode 100644 engines/mads/msprite.h create mode 100644 engines/mads/sprites.cpp create mode 100644 engines/mads/sprites.h diff --git a/engines/mads/assets.cpp b/engines/mads/assets.cpp index c968afc311..ebedeb8141 100644 --- a/engines/mads/assets.cpp +++ b/engines/mads/assets.cpp @@ -163,6 +163,15 @@ void SpriteAsset::drawScaled(int frameNumber, MSurface &depthSurface, MSurface & warning("TODO: SpriteAsset::drawScaled"); } +void SpriteAsset::draw(MSurface *surface, int frameNumber, const Common::Point &pt) { + error("TODO: draw"); +} + +void SpriteAsset::depthDraw(MSurface *surface, MSurface *depthSurface, int frameNumber, + const Common::Point &pt, int depth) { + error("TODO: depthDraw"); +} + /*------------------------------------------------------------------------*/ SpriteSetCharInfo::SpriteSetCharInfo(Common::SeekableReadStream *s) { diff --git a/engines/mads/assets.h b/engines/mads/assets.h index 7a6939b222..30676a1d7e 100644 --- a/engines/mads/assets.h +++ b/engines/mads/assets.h @@ -25,14 +25,16 @@ #include "common/scummsys.h" #include "common/array.h" -#include "mads/msprite.h" #include "mads/palette.h" -#include "mads/msprite.h" namespace MADS { #define SPRITE_SET_CHAR_INFO 4 +class MADSEngine; +class MSprite; +class MSurface; + struct SpriteAssetFrame { uint32 _stream; Common::Rect _bounds; @@ -100,6 +102,9 @@ public: void drawScaled(int frameNumber, MSurface &depthSurface, MSurface &destSurface, int scale, int depth, const Common::Point &pos); + void draw(MSurface *surface, int frameNumber, const Common::Point &pt); + void depthDraw(MSurface *surface, MSurface *depthSurface, int frameNumber, + const Common::Point &pt, int depth); }; } // End of namespace MADS diff --git a/engines/mads/dialogs.cpp b/engines/mads/dialogs.cpp index e4c7682a38..d159d48ace 100644 --- a/engines/mads/dialogs.cpp +++ b/engines/mads/dialogs.cpp @@ -34,7 +34,7 @@ Dialog::Dialog(MADSEngine *vm): _vm(vm), _savedSurface(nullptr), } Dialog::~Dialog() { - restore(_vm->_screen); + restore(&_vm->_screen); } @@ -55,21 +55,21 @@ void Dialog::restore(MSurface *s) { void Dialog::draw() { // Save the screen portion the dialog will overlap - save(_vm->_screen); + save(&_vm->_screen); // Draw the dialog // Fill entire content of dialog - _vm->_screen->fillRect(Common::Rect(_position.x, _position.y, + _vm->_screen.fillRect(Common::Rect(_position.x, _position.y, _position.x + _width, _position.y + _height), TEXTDIALOG_BACKGROUND); // Draw the outer edge lines - _vm->_screen->hLine(_position.x + 1, _position.y + _height - 2, + _vm->_screen.hLine(_position.x + 1, _position.y + _height - 2, _position.x + _width - 2, TEXTDIALOG_EDGE); - _vm->_screen->hLine(_position.x, _position.y + _height - 1, + _vm->_screen.hLine(_position.x, _position.y + _height - 1, _position.x + _width - 1, TEXTDIALOG_EDGE); - _vm->_screen->vLine(_position.x + _width - 2, _position.y + 2, + _vm->_screen.vLine(_position.x + _width - 2, _position.y + 2, _position.y + _height - 2, TEXTDIALOG_EDGE); - _vm->_screen->vLine(_position.x + _width - 1, _position.y + 1, + _vm->_screen.vLine(_position.x + _width - 1, _position.y + 1, _position.y + _height - 1, TEXTDIALOG_EDGE); // Draw the gravelly dialog content @@ -82,7 +82,7 @@ void Dialog::drawContent(const Common::Rect &r, int seed, byte color1, byte colo uint16 currSeed = seed ? seed : 0xB78E; for (int yp = 0; yp < r.height(); ++yp) { - byte *destP = _vm->_screen->getBasePtr(r.left, r.top + yp); + byte *destP = _vm->_screen.getBasePtr(r.left, r.top + yp); for (int xp = 0; xp < r.width(); ++xp) { uint16 seedAdjust = currSeed; @@ -246,10 +246,10 @@ void TextDialog::draw() { if (_position.y == -1) _position.y = 100 - (_height / 2); - if ((_position.x + _width) > _vm->_screen->getWidth()) - _position.x = _vm->_screen->getWidth() - (_position.x + _width); - if ((_position.y + _height) > _vm->_screen->getHeight()) - _position.y = _vm->_screen->getHeight() - (_position.y + _height); + if ((_position.x + _width) > _vm->_screen.getWidth()) + _position.x = _vm->_screen.getWidth() - (_position.x + _width); + if ((_position.y + _height) > _vm->_screen.getHeight()) + _position.y = _vm->_screen.getHeight() - (_position.y + _height); // Draw the underlying dialog Dialog::draw(); @@ -259,7 +259,7 @@ void TextDialog::draw() { for (int lineNum = 0; lineNum < _numLines; ++lineNum) { if (_lineXp[lineNum] == -1) { // Draw a line across the entire dialog - _vm->_screen->hLine(_position.x + 2, + _vm->_screen.hLine(_position.x + 2, lineYp + (_vm->_font->getHeight() + 1) / 2, _position.x + _width - 4, TEXTDIALOG_BLACK); } else { @@ -269,13 +269,13 @@ void TextDialog::draw() { if (_lineXp[lineNum] & 0x40) ++yp; - _vm->_font->writeString(_vm->_screen, _lines[lineNum], + _vm->_font->writeString(&_vm->_screen, _lines[lineNum], Common::Point(xp, yp), 0, 1); if (_lineXp[lineNum] & 0x80) { // Draw an underline under the text int lineWidth = _vm->_font->getWidth(_lines[lineNum], 1); - _vm->_screen->hLine(xp, yp + _vm->_font->getHeight(), xp + lineWidth, + _vm->_screen.hLine(xp, yp + _vm->_font->getHeight(), xp + lineWidth, TEXTDIALOG_BLACK); } } diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp index 1acb081d8a..7fa31d7616 100644 --- a/engines/mads/events.cpp +++ b/engines/mads/events.cpp @@ -148,7 +148,7 @@ void EventsManager::checkForNextFrameCounter() { _vm->_debugger->onFrame(); // Display the frame - _vm->_screen->updateScreen(); + _vm->_screen.updateScreen(); // Signal the ScummVM debugger _vm->_debugger->onFrame(); diff --git a/engines/mads/events.h b/engines/mads/events.h index add8fc34c0..f30e588bb4 100644 --- a/engines/mads/events.h +++ b/engines/mads/events.h @@ -24,8 +24,8 @@ #define MADS_EVENTS_H #include "common/scummsys.h" -#include "mads/msprite.h" #include "mads/assets.h" +#include "mads/sprites.h" namespace MADS { diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index e9fbf918c4..fd2aebaecf 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -27,10 +27,10 @@ #include "engines/util.h" #include "mads/mads.h" #include "mads/graphics.h" +#include "mads/msurface.h" #include "mads/resources.h" #include "mads/sound.h" -#include "mads/msurface.h" -#include "mads/msprite.h" +#include "mads/sprites.h" namespace MADS { @@ -50,7 +50,6 @@ MADSEngine::MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc) : _game = nullptr; _palette = nullptr; _resources = nullptr; - _screen = nullptr; _sound = nullptr; _userInterface = nullptr; } @@ -63,7 +62,6 @@ MADSEngine::~MADSEngine() { delete _game; delete _palette; delete _resources; - delete _screen; delete _sound; delete _userInterface; } @@ -84,13 +82,13 @@ void MADSEngine::initialise() { _events = new EventsManager(this); _palette = new Palette(this); _font = new Font(this); - _screen = new MSurface(g_system->getWidth(), g_system->getHeight()); + _screen.setSize(g_system->getWidth(), g_system->getHeight()); _sound = new SoundManager(this, _mixer); _userInterface = UserInterface::init(this); _game = Game::init(this); _events->loadCursors("*CURSOR.SS"); - _screen->empty(); + _screen.empty(); } Common::Error MADSEngine::run() { diff --git a/engines/mads/mads.h b/engines/mads/mads.h index 2d85236d8d..0d5e16ac47 100644 --- a/engines/mads/mads.h +++ b/engines/mads/mads.h @@ -97,7 +97,7 @@ public: Game *_game; Palette *_palette; Resources *_resources; - MSurface *_screen; + MSurface _screen; SoundManager *_sound; UserInterface *_userInterface; bool _easyMouse; diff --git a/engines/mads/messages.cpp b/engines/mads/messages.cpp index cc618c4b76..3b6663e71d 100644 --- a/engines/mads/messages.cpp +++ b/engines/mads/messages.cpp @@ -301,13 +301,13 @@ TextDisplayList::TextDisplayList(MADSEngine *vm) : _vm(vm) { TextDisplay rec; rec._active = false; rec._expire = 0; - _entries.push_back(rec); + push_back(rec); } } void TextDisplayList::clear() { for (int i = 0; i < TEXT_DISPLAY_SIZE; ++i) - _entries[i]._active = false; + (*this)[i]._active = false; } int TextDisplayList::add(int xp, int yp, uint fontColor, int charSpacing, @@ -315,20 +315,21 @@ int TextDisplayList::add(int xp, int yp, uint fontColor, int charSpacing, int usedSlot = -1; for (int idx = 0; idx < TEXT_DISPLAY_SIZE; ++idx) { - if (!_entries[idx]._active) { + TextDisplay &td = (*this)[idx]; + if (!td._active) { usedSlot = idx; - _entries[idx]._bounds.left = xp; - _entries[idx]._bounds.top = yp; - _entries[idx]._font = font; - _entries[idx]._msg = msg; - _entries[idx]._bounds.setWidth(font->getWidth(msg, charSpacing)); - _entries[idx]._bounds.setHeight(font->getHeight()); - _entries[idx]._color1 = fontColor & 0xff; - _entries[idx]._color2 = fontColor >> 8; - _entries[idx]._spacing = charSpacing; - _entries[idx]._expire = 1; - _entries[idx]._active = true; + td._bounds.left = xp; + td._bounds.top = yp; + td._font = font; + td._msg = msg; + td._bounds.setWidth(font->getWidth(msg, charSpacing)); + td._bounds.setHeight(font->getHeight()); + td._color1 = fontColor & 0xff; + td._color2 = fontColor >> 8; + td._spacing = charSpacing; + td._expire = 1; + td._active = true; break; } } @@ -340,11 +341,11 @@ void TextDisplayList::setDirtyAreas() { Scene &scene = _vm->_game->_scene; for (uint idx = 0, dirtyIdx = DIRTY_AREAS_TEXT_DISPLAY_IDX; dirtyIdx < DIRTY_AREAS_SIZE; ++idx, ++dirtyIdx) { - if ((_entries[idx]._expire >= 0) || !_entries[idx]._active) + if (((*this)[idx]._expire >= 0) || !(*this)[idx]._active) scene._dirtyAreas[dirtyIdx]._active = false; else { scene._dirtyAreas[dirtyIdx]._textActive = true; - scene._dirtyAreas.setTextDisplay(dirtyIdx, _entries[idx]); + scene._dirtyAreas[dirtyIdx].setTextDisplay(&(*this)[idx]); } } } @@ -353,9 +354,9 @@ void TextDisplayList::setDirtyAreas2() { Scene &scene = _vm->_game->_scene; for (uint idx = 0, dirtyIdx = DIRTY_AREAS_TEXT_DISPLAY_IDX; dirtyIdx < DIRTY_AREAS_SIZE; ++idx, ++dirtyIdx) { - if (_entries[idx]._active && (_entries[idx]._expire >= 0)) { - scene._dirtyAreas.setTextDisplay(dirtyIdx, _entries[idx]); - scene._dirtyAreas[dirtyIdx]._textActive = (_entries[idx]._expire <= 0) ? 0 : 1; + if ((*this)[idx]._active && ((*this)[idx]._expire >= 0)) { + scene._dirtyAreas[dirtyIdx].setTextDisplay(&(*this)[idx]); + scene._dirtyAreas[dirtyIdx]._textActive = ((*this)[idx]._expire <= 0) ? 0 : 1; } } } @@ -375,16 +376,16 @@ void TextDisplayList::draw(MSurface *view) { } void TextDisplayList::cleanUp() { - for (uint idx = 0; idx < _entries.size(); ++idx) { - if (_entries[idx]._expire < 0) { - _entries[idx]._active = false; - _entries[idx]._expire = 0; + for (uint idx = 0; idx < size(); ++idx) { + if ((*this)[idx]._expire < 0) { + (*this)[idx]._active = false; + (*this)[idx]._expire = 0; } } } void TextDisplayList::expire(int idx) { - _entries[idx]._expire = -1; + (*this)[idx]._expire = -1; } } // End of namespace MADS diff --git a/engines/mads/messages.h b/engines/mads/messages.h index 6967755cdd..1357b98d03 100644 --- a/engines/mads/messages.h +++ b/engines/mads/messages.h @@ -105,10 +105,9 @@ public: #define TEXT_DISPLAY_SIZE 40 -class TextDisplayList { +class TextDisplayList: public Common::Array { private: MADSEngine *_vm; - Common::Array _entries; /** * Determine dirty areas for active text areas @@ -117,13 +116,6 @@ private: public: TextDisplayList(MADSEngine *vm); - /** - * Item operator - */ - TextDisplay &operator[](int idx) { - return _entries[idx]; - } - /** * Expire a given text display entry */ diff --git a/engines/mads/module.mk b/engines/mads/module.mk index 36d0c49ff7..2bff5b782e 100644 --- a/engines/mads/module.mk +++ b/engines/mads/module.mk @@ -20,7 +20,6 @@ MODULE_OBJS := \ graphics.o \ mads.o \ messages.o \ - msprite.o \ msurface.o \ palette.o \ player.o \ @@ -29,6 +28,7 @@ MODULE_OBJS := \ scene_data.o \ sequence.o \ sound.o \ + sprites.o \ user_interface.o # This module can be built as a plugin diff --git a/engines/mads/msprite.cpp b/engines/mads/msprite.cpp deleted file mode 100644 index 279192fbdc..0000000000 --- a/engines/mads/msprite.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* 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 "common/scummsys.h" -#include "engines/util.h" -#include "graphics/palette.h" -#include "mads/mads.h" -#include "mads/msurface.h" -#include "mads/msprite.h" - -namespace MADS { - -enum { - kEndOfLine = 0, - kEndOfSprite = 1, - kMarker = 2 -}; - -MSprite::MSprite(): MSurface() { - _encoding = 0; -} - -MSprite::MSprite(Common::SeekableReadStream *source, const Common::Point &offset, - int widthVal, int heightVal, bool decodeRle, uint8 encodingVal) - : MSurface(widthVal, heightVal), - _encoding(encodingVal), _offset(offset) { - - // Load the sprite data - loadSprite(source); -} - -MSprite::~MSprite() { -} - - -// TODO: The sprite outlines (pixel value 0xFD) are not shown -void MSprite::loadSprite(Common::SeekableReadStream *source) { - byte *outp, *lineStart; - bool newLine = false; - - outp = getData(); - lineStart = getData(); - - while (1) { - byte cmd1, cmd2, count, pixel; - - if (newLine) { - outp = lineStart + getWidth(); - lineStart = outp; - newLine = false; - } - - cmd1 = source->readByte(); - - if (cmd1 == 0xFC) - break; - else if (cmd1 == 0xFF) - newLine = true; - else if (cmd1 == 0xFD) { - while (!newLine) { - count = source->readByte(); - if (count == 0xFF) { - newLine = true; - } else { - pixel = source->readByte(); - while (count--) - *outp++ = (pixel == 0xFD) ? 0 : pixel; - } - } - } else { - while (!newLine) { - cmd2 = source->readByte(); - if (cmd2 == 0xFF) { - newLine = true; - } else if (cmd2 == 0xFE) { - count = source->readByte(); - pixel = source->readByte(); - while (count--) - *outp++ = (pixel == 0xFD) ? 0 : pixel; - } else { - *outp++ = (cmd2 == 0xFD) ? 0 : cmd2; - } - } - } - } -} - -} // End of namespace MADS diff --git a/engines/mads/msprite.h b/engines/mads/msprite.h deleted file mode 100644 index f2194dab08..0000000000 --- a/engines/mads/msprite.h +++ /dev/null @@ -1,114 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef MADS_MSPRITE_H -#define MADS_MSPRITE_H - -#include "common/scummsys.h" -#include "mads/msurface.h" - -namespace MADS { - -class MADSEngine; - -struct BGR8 { - uint8 b, g, r; -}; - -typedef struct { - int32 x; // x position relative to GrBuff(0, 0) - int32 y; // y position relative to GrBuff(0, 0) - int32 scale_x; // x scale factor (can be negative for reverse draw) - int32 scale_y; // y scale factor (can't be negative) - uint8* depth_map; // depth code array for destination (doesn't care if srcDepth is 0) - BGR8* Pal; // palette for shadow draw (doesn't care if SHADOW bit is not set in Src.encoding) - uint8* ICT; // Inverse Color Table (doesn't care if SHADOW bit is not set in Src.encoding) - uint8 depth; // depth code for source (0 if no depth processing) -} DrawRequestX; - -typedef struct -{ - uint32 Pack; - uint32 Stream; - long hot_x; - long hot_y; - uint32 Width; - uint32 Height; - uint32 Comp; - uint32 Reserved[8]; - uint8* data; -} RendCell; - -#define SS_HEADER_NUM_FIELDS 14 -struct SpriteSeriesHeader { - uint32 header; - uint32 size; - uint32 packing; - uint32 frameRate; - uint32 pixSpeed; - uint32 maxWidth; - uint32 maxHeight; - uint32 reserved3; - uint32 reserved4; - uint32 reserved5; - uint32 reserved6; - uint32 reserved7; - uint32 reserved8; - uint32 count; -}; - -#define SF_HEADER_NUM_FIELDS 15 -struct SpriteFrameHeader { - uint32 pack; - uint32 stream; - uint32 x; - uint32 y; - uint32 width; - uint32 height; - uint32 comp; - uint32 reserved1; - uint32 reserved2; - uint32 reserved3; - uint32 reserved4; - uint32 reserved5; - uint32 reserved6; - uint32 reserved7; - uint32 reserved8; -}; - -class MSprite: public MSurface { -private: - void loadSprite(Common::SeekableReadStream *source); -public: - MSprite(); - MSprite(Common::SeekableReadStream *source, const Common::Point &offset, - int widthVal, int heightVal, bool decodeRle = true, uint8 encodingVal = 0); - virtual ~MSprite(); - - Common::Point _pos; - Common::Point _offset; - uint8 _encoding; -}; - -} // End of namespace MADS - -#endif /* MADS_MSPRITE_H */ diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp index ca75a50bde..bb9b3089df 100644 --- a/engines/mads/msurface.cpp +++ b/engines/mads/msurface.cpp @@ -24,9 +24,9 @@ #include "mads/compression.h" #include "mads/graphics.h" #include "mads/mads.h" -#include "mads/msprite.h" #include "mads/msurface.h" #include "mads/resources.h" +#include "mads/sprites.h" namespace MADS { diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index db252a95a4..994f58230e 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -424,7 +424,14 @@ void Scene::doFrame() { } void Scene::drawElements(bool transitionFlag, bool surfaceFlag) { + // Draw any background objects + _spriteSlots.drawBackground(); + // Merge any identified dirty areas + _dirtyAreas.merge(1, _dirtyAreas.size()); + + // Copy dirty areas to the main display surface + _dirtyAreas.copy(&_vm->_screen, &_backgroundSurface, _posAdjust); } void Scene::leftClick() { diff --git a/engines/mads/scene.h b/engines/mads/scene.h index 483ecae23c..c466f97c02 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -32,6 +32,7 @@ #include "mads/scene_data.h" #include "mads/animation.h" #include "mads/sequence.h" +#include "mads/sprites.h" namespace MADS { diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index 46ef2c3058..371fa43501 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -138,76 +138,7 @@ void ScreenObjects::proc1() { /*------------------------------------------------------------------------*/ -SpriteSlot::SpriteSlot() { - _spriteType = ST_NONE; - _seqIndex = 0; - _spritesIndex = 0; - _frameNumber = 0; - _depth = 0; - _scale = 0; -} - -SpriteSlot::SpriteSlot(SpriteType type, int seqIndex) { - _spriteType = type; - _seqIndex = seqIndex; - _spritesIndex = 0; - _frameNumber = 0; - _depth = 0; - _scale = 0; -} - -/*------------------------------------------------------------------------*/ - -void SpriteSlots::clear(bool flag) { - _vm->_game->_scene._textDisplay.clear(); - - if (flag) - _vm->_game->_scene._sprites.clear(); - - Common::Array::clear(); - push_back(SpriteSlot(ST_FULL_SCREEN_REFRESH, -1)); -} - -/** - * Releases any sprites used by the player - */ -void SpriteSlots::releasePlayerSprites() { - Player &player = _vm->_game->_player; - - if (player._spritesLoaded && player._numSprites > 0) { - int spriteEnd = player._spritesStart + player._numSprites - 1; - do { - deleteEntry(spriteEnd); - } while (--spriteEnd >= player._spritesStart); - } -} - -void SpriteSlots::deleteEntry(int index) { - remove_at(index); -} - -void SpriteSlots::fullRefresh(bool clearAll) { - if (clearAll) - Common::Array::clear(); - - push_back(SpriteSlot(ST_FULL_SCREEN_REFRESH, -1)); -} - -/*------------------------------------------------------------------------*/ - -int SpriteSets::add(SpriteAsset *asset, int idx) { - if (!idx) - idx = size(); - - if (idx >= (int)(size() + 1)) - resize(idx + 1); - delete (*this)[idx]; - (*this)[idx] = asset; - - return idx; -} - -/*------------------------------------------------------------------------*/ +MADSEngine *DirtyArea::_vm = nullptr; void DirtyArea::setArea(int width, int height, int maxWidth, int maxHeight) { if (_bounds.left % 2) { @@ -246,73 +177,75 @@ void DirtyArea::setArea(int width, int height, int maxWidth, int maxHeight) { _active = true; } -/*------------------------------------------------------------------------*/ - -DirtyAreas::DirtyAreas(MADSEngine *vm) : _vm(vm) { - for (int i = 0; i < DIRTY_AREAS_SIZE; ++i) { - DirtyArea rec; - rec._active = false; - _entries.push_back(rec); - } -} -void DirtyAreas::setSpriteSlot(int dirtyIdx, const SpriteSlot &spriteSlot) { +void DirtyArea::setSpriteSlot(const SpriteSlot *spriteSlot) { int width, height; - DirtyArea &dirtyArea = _entries[dirtyIdx]; Scene &scene = _vm->_game->_scene; - if (spriteSlot._spriteType == ST_FULL_SCREEN_REFRESH) { + if (spriteSlot->_spriteType == ST_FULL_SCREEN_REFRESH) { // Special entry to refresh the entire screen - dirtyArea._bounds.left = 0; - dirtyArea._bounds.top = 0; + _bounds.left = 0; + _bounds.top = 0; width = MADS_SCREEN_WIDTH; height = MADS_SCENE_HEIGHT; } else { // Standard sprite slots - dirtyArea._bounds.left = spriteSlot._position.x - scene._posAdjust.x; - dirtyArea._bounds.top = spriteSlot._position.y - scene._posAdjust.y; + _bounds.left = spriteSlot->_position.x - scene._posAdjust.x; + _bounds.top = spriteSlot->_position.y - scene._posAdjust.y; - SpriteAsset &spriteSet = scene._spriteSlots.getSprite(spriteSlot._spritesIndex); - MSprite *frame = spriteSet.getFrame(((spriteSlot._frameNumber & 0x7fff) - 1) & 0x7f); + SpriteAsset &spriteSet = scene._spriteSlots.getSprite(spriteSlot->_spritesIndex); + MSprite *frame = spriteSet.getFrame(((spriteSlot->_frameNumber & 0x7fff) - 1) & 0x7f); - if (spriteSlot._scale == -1) { - width = frame->getWidth(); - height = frame->getHeight(); - } else { - width = frame->getWidth() * spriteSlot._scale / 100; - height = frame->getHeight() * spriteSlot._scale / 100; + if (spriteSlot->_scale == -1) { + width = frame->w; + height = frame->h; + } + else { + width = frame->w * spriteSlot->_scale / 100; + height = frame->h * spriteSlot->_scale / 100; - dirtyArea._bounds.left -= width / 2; - dirtyArea._bounds.top += -(height - 1); + _bounds.left -= width / 2; + _bounds.top += -(height - 1); } } - dirtyArea.setArea(width, height, MADS_SCREEN_WIDTH, MADS_SCENE_HEIGHT); + setArea(width, height, MADS_SCREEN_WIDTH, MADS_SCENE_HEIGHT); } -void DirtyAreas::setTextDisplay(int dirtyIdx, const TextDisplay &textDisplay) { - DirtyArea &dirtyArea = _entries[dirtyIdx]; - dirtyArea._bounds.left = textDisplay._bounds.left; - dirtyArea._bounds.top = textDisplay._bounds.top; +void DirtyArea::setTextDisplay(const TextDisplay *textDisplay) { + _bounds.left = textDisplay->_bounds.left; + _bounds.top = textDisplay->_bounds.top; - dirtyArea.setArea(textDisplay._bounds.width(), textDisplay._bounds.height(), + setArea(textDisplay->_bounds.width(), textDisplay->_bounds.height(), MADS_SCREEN_WIDTH, MADS_SCENE_HEIGHT); } +/*------------------------------------------------------------------------*/ + +DirtyAreas::DirtyAreas(MADSEngine *vm) : _vm(vm) { + DirtyArea::_vm = vm; + + for (int i = 0; i < DIRTY_AREAS_SIZE; ++i) { + DirtyArea rec; + rec._active = false; + push_back(rec); + } +} + void DirtyAreas::merge(int startIndex, int count) { error("TODO: DirtyAreas::merge"); if (startIndex >= count) return; for (int outerCtr = startIndex - 1, idx = 0; idx < count; ++outerCtr, ++idx) { - if (!_entries[outerCtr]._active) + if (!(*this)[outerCtr]._active) continue; for (int innerCtr = outerCtr + 1; innerCtr < count; ++innerCtr) { - if (!_entries[innerCtr]._active || !intersects(outerCtr, innerCtr)) + if (!(*this)[innerCtr]._active || !intersects(outerCtr, innerCtr)) continue; - if (_entries[outerCtr]._textActive && _entries[innerCtr]._textActive) + if ((*this)[outerCtr]._textActive && (*this)[innerCtr]._textActive) mergeAreas(outerCtr, innerCtr); } } @@ -322,12 +255,12 @@ void DirtyAreas::merge(int startIndex, int count) { * Returns true if two dirty areas intersect */ bool DirtyAreas::intersects(int idx1, int idx2) { - return _entries[idx1]._bounds2.intersects(_entries[idx2]._bounds2); + return (*this)[idx1]._bounds2.intersects((*this)[idx2]._bounds2); } void DirtyAreas::mergeAreas(int idx1, int idx2) { - DirtyArea &da1 = _entries[idx1]; - DirtyArea &da2 = _entries[idx2]; + DirtyArea &da1 = (*this)[idx1]; + DirtyArea &da2 = (*this)[idx2]; da1._bounds.extend(da2._bounds); @@ -341,20 +274,22 @@ void DirtyAreas::mergeAreas(int idx1, int idx2) { } void DirtyAreas::copy(MSurface *dest, MSurface *src, const Common::Point &posAdjust) { - for (uint i = 0; i < _entries.size(); ++i) { - const Common::Rect &srcBounds = _entries[i]._bounds; + for (uint i = 0; i < size(); ++i) { + const Common::Rect &srcBounds = (*this)[i]._bounds; Common::Rect bounds(srcBounds.left + posAdjust.x, srcBounds.top + posAdjust.y, srcBounds.right + posAdjust.x, srcBounds.bottom + posAdjust.y); - if (_entries[i]._active && _entries[i]._bounds.isValidRect()) - src->copyTo(dest, bounds, Common::Point(_entries[i]._bounds.left, _entries[i]._bounds.top)); + if ((*this)[i]._active && (*this)[i]._bounds.isValidRect()) { + src->copyTo(dest, bounds, Common::Point((*this)[i]._bounds.left, + (*this)[i]._bounds.top)); + } } } -void DirtyAreas::clear() { - for (uint i = 0; i < _entries.size(); ++i) - _entries[i]._active = false; +void DirtyAreas::reset() { + for (uint i = 0; i < size(); ++i) + (*this)[i]._active = false; } /*------------------------------------------------------------------------*/ diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index 522cd178d0..15371e405f 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -38,6 +38,7 @@ namespace MADS { class MADSEngine; class Scene; +class SpriteSlot; #define MADS_INTERFACE_HEIGHT 44 #define MADS_SCENE_HEIGHT 156 @@ -58,11 +59,6 @@ enum Layer { LAYER_GUI = 19 }; -enum SpriteType { - ST_NONE = 0, ST_FOREGROUND = 1, ST_BACKGROUND = -4, - ST_FULL_SCREEN_REFRESH = -2, ST_EXPIRED = -1 -}; - class VerbInit { public: int _id; @@ -117,72 +113,6 @@ public: void check(bool scanFlag); }; -class SpriteSlotSubset { -public: - int _spritesIndex; - int _frameNumber; - Common::Point _position; - int _depth; - int _scale; -}; - -class SpriteSlot: public SpriteSlotSubset { -public: - SpriteType _spriteType; - int _seqIndex; -public: - SpriteSlot(); - SpriteSlot(SpriteType type, int seqIndex); -}; - -class SpriteSlots: public Common::Array { -private: - MADSEngine *_vm; -public: - SpriteSlots(MADSEngine *vm): _vm(vm) {} - - /** - * Clears any pending slot data and schedules a full screen refresh. - * @param flag Also reset sprite list - */ - void clear(bool flag); - - /** - * Delete any sprites used by the player - */ - void releasePlayerSprites(); - - /** - * Delete a sprite entry - * @param index Specifies the index in the array - */ - void deleteEntry(int index); - - /** - * Adds a full screen refresh to the sprite slots - */ - void fullRefresh(bool clearAll = false); - - SpriteAsset &getSprite(int idx) { - error("TODO"); - } - void deleteTimer(int idx) { - warning("TODO: SpriteSlots::deleteTimer"); - } - int getIndex() { - warning("TODO: SpriteSlots::indexOf"); - return -1; - } -}; - -class SpriteSets: public Common::Array { -public: - /** - * Add a sprite asset to the list - */ - int add(SpriteAsset *asset, int idx = 0); -}; - class DynamicHotspot { public: bool _active; @@ -235,6 +165,9 @@ public: }; class DirtyArea { +private: + static MADSEngine *_vm; + friend class DirtyAreas; public: Common::Rect _bounds; Common::Rect _bounds2; @@ -242,25 +175,23 @@ public: bool _active; DirtyArea() { _active = false; } + void setArea(int width, int height, int maxWidth, int maxHeight); + + void setSpriteSlot(const SpriteSlot *spriteSlot); + + /** + * Set up a dirty area for a text display + */ + void setTextDisplay(const TextDisplay *textDisplay); }; -class DirtyAreas { +class DirtyAreas: public Common::Array { private: MADSEngine *_vm; - Common::Array _entries; public: DirtyAreas(MADSEngine *vm); - - DirtyArea &operator[](uint idx) { - assert(idx < _entries.size()); - return _entries[idx]; - } - - void setSpriteSlot(int dirtyIdx, const SpriteSlot &spriteSlot); - - void setTextDisplay(int dirtyIdx, const TextDisplay &textDisplay); - + /** * Merge together any designated dirty areas that overlap * @param startIndex 1-based starting dirty area starting index @@ -271,7 +202,7 @@ public: bool intersects(int idx1, int idx2); void mergeAreas(int idx1, int idx2); void copy(MSurface *dest, MSurface *src, const Common::Point &posAdjust); - void clear(); + void reset(); }; class SceneLogic { diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp new file mode 100644 index 0000000000..3cba6989b1 --- /dev/null +++ b/engines/mads/sprites.cpp @@ -0,0 +1,239 @@ +/* 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 "common/scummsys.h" +#include "engines/util.h" +#include "graphics/palette.h" +#include "mads/mads.h" +#include "mads/graphics.h" +#include "mads/msurface.h" +#include "mads/sprites.h" + +namespace MADS { + +enum { + kEndOfLine = 0, + kEndOfSprite = 1, + kMarker = 2 +}; + +MSprite::MSprite(): MSurface() { + _encoding = 0; +} + +MSprite::MSprite(Common::SeekableReadStream *source, const Common::Point &offset, + int widthVal, int heightVal, bool decodeRle, uint8 encodingVal) + : MSurface(widthVal, heightVal), + _encoding(encodingVal), _offset(offset) { + + // Load the sprite data + loadSprite(source); +} + +MSprite::~MSprite() { +} + + +// TODO: The sprite outlines (pixel value 0xFD) are not shown +void MSprite::loadSprite(Common::SeekableReadStream *source) { + byte *outp, *lineStart; + bool newLine = false; + + outp = getData(); + lineStart = getData(); + + while (1) { + byte cmd1, cmd2, count, pixel; + + if (newLine) { + outp = lineStart + getWidth(); + lineStart = outp; + newLine = false; + } + + cmd1 = source->readByte(); + + if (cmd1 == 0xFC) + break; + else if (cmd1 == 0xFF) + newLine = true; + else if (cmd1 == 0xFD) { + while (!newLine) { + count = source->readByte(); + if (count == 0xFF) { + newLine = true; + } else { + pixel = source->readByte(); + while (count--) + *outp++ = (pixel == 0xFD) ? 0 : pixel; + } + } + } else { + while (!newLine) { + cmd2 = source->readByte(); + if (cmd2 == 0xFF) { + newLine = true; + } else if (cmd2 == 0xFE) { + count = source->readByte(); + pixel = source->readByte(); + while (count--) + *outp++ = (pixel == 0xFD) ? 0 : pixel; + } else { + *outp++ = (cmd2 == 0xFD) ? 0 : cmd2; + } + } + } + } +} + +/*------------------------------------------------------------------------*/ + +MADSEngine *SpriteSlot::_vm = nullptr; + +SpriteSlot::SpriteSlot() { + _spriteType = ST_NONE; + _seqIndex = 0; + _spritesIndex = 0; + _frameNumber = 0; + _depth = 0; + _scale = 0; +} + +SpriteSlot::SpriteSlot(SpriteType type, int seqIndex) { + _spriteType = type; + _seqIndex = seqIndex; + _spritesIndex = 0; + _frameNumber = 0; + _depth = 0; + _scale = 0; +} + +/*------------------------------------------------------------------------*/ + +SpriteSlots::SpriteSlots(MADSEngine *vm) : _vm(vm) { + SpriteSlot::_vm = vm; +} + +void SpriteSlots::clear(bool flag) { + _vm->_game->_scene._textDisplay.clear(); + + if (flag) + _vm->_game->_scene._sprites.clear(); + + Common::Array::clear(); + push_back(SpriteSlot(ST_FULL_SCREEN_REFRESH, -1)); +} + +/** +* Releases any sprites used by the player +*/ +void SpriteSlots::releasePlayerSprites() { + Player &player = _vm->_game->_player; + + if (player._spritesLoaded && player._numSprites > 0) { + int spriteEnd = player._spritesStart + player._numSprites - 1; + do { + deleteEntry(spriteEnd); + } while (--spriteEnd >= player._spritesStart); + } +} + +void SpriteSlots::deleteEntry(int index) { + remove_at(index); +} + +void SpriteSlots::fullRefresh(bool clearAll) { + if (clearAll) + Common::Array::clear(); + + push_back(SpriteSlot(ST_FULL_SCREEN_REFRESH, -1)); +} + +void SpriteSlots::drawBackground() { + Scene &scene = _vm->_game->_scene; + + // Initial draw loop for any active sprites in the background + for (uint i = 0; i < scene._spriteSlots.size(); ++i) { + if (scene._spriteSlots[i]._spriteType >= ST_NONE) { + scene._dirtyAreas[i]._active = false; + } + else { + scene._dirtyAreas[i]._active = true; + scene._dirtyAreas[i].setSpriteSlot(&scene._spriteSlots[i]); + + SpriteAsset *asset = scene._sprites[scene._spriteSlots[i]._spritesIndex]; + MSprite *frame = asset->getFrame(scene._spriteSlots[i]._frameNumber); + + if (scene._spriteSlots[i]._spriteType == ST_BACKGROUND) { + Common::Point pt = scene._spriteSlots[i]._position; + if (scene._spriteSlots[i]._scale != -1) { + // Adjust the drawing position + pt.x -= frame->w / 2; + pt.y -= frame->h / 2; + } + + if (scene._spriteSlots[i]._depth <= 1) { + asset->draw(&scene._backgroundSurface, scene._spriteSlots[i]._frameNumber, pt); + } + else if (scene._depthStyle == 0) { + asset->depthDraw(&scene._backgroundSurface, &scene._depthSurface, scene._spriteSlots[i]._frameNumber, + pt, scene._spriteSlots[i]._depth); + } else { + error("Unsupported depth style"); + } + } + } + } + + // Mark any remaning dirty areas as inactive + for (uint i = scene._spriteSlots.size(); i < 50; ++i) + scene._dirtyAreas[i]._active = false; + + // Flag any active text display + for (uint i = 50; i < scene._textDisplay.size(); ++i) { + TextDisplay &textDisplay = scene._textDisplay[i - 50]; + if (scene._textDisplay[i]._expire >= 0 || !textDisplay._active) { + scene._dirtyAreas[i]._active = false; + } else { + scene._dirtyAreas[i]._active = true; + scene._dirtyAreas[i].setTextDisplay(&textDisplay); + } + } +} + +/*------------------------------------------------------------------------*/ + +int SpriteSets::add(SpriteAsset *asset, int idx) { + if (!idx) + idx = size(); + + if (idx >= (int)(size() + 1)) + resize(idx + 1); + delete (*this)[idx]; + (*this)[idx] = asset; + + return idx; +} + +/*------------------------------------------------------------------------*/ + +} // End of namespace MADS diff --git a/engines/mads/sprites.h b/engines/mads/sprites.h new file mode 100644 index 0000000000..6b131105dc --- /dev/null +++ b/engines/mads/sprites.h @@ -0,0 +1,197 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_SPRITES_H +#define MADS_SPRITES_H + +#include "common/scummsys.h" +#include "common/array.h" +#include "mads/assets.h" +#include "mads/msurface.h" + +namespace MADS { + +enum SpriteType { + ST_NONE = 0, ST_FOREGROUND = 1, ST_BACKGROUND = -4, + ST_FULL_SCREEN_REFRESH = -2, ST_EXPIRED = -1 +}; + +class MADSEngine; + +struct BGR8 { + uint8 b, g, r; +}; + +typedef struct { + int32 x; // x position relative to GrBuff(0, 0) + int32 y; // y position relative to GrBuff(0, 0) + int32 scale_x; // x scale factor (can be negative for reverse draw) + int32 scale_y; // y scale factor (can't be negative) + uint8* depth_map; // depth code array for destination (doesn't care if srcDepth is 0) + BGR8* Pal; // palette for shadow draw (doesn't care if SHADOW bit is not set in Src.encoding) + uint8* ICT; // Inverse Color Table (doesn't care if SHADOW bit is not set in Src.encoding) + uint8 depth; // depth code for source (0 if no depth processing) +} DrawRequestX; + +typedef struct +{ + uint32 Pack; + uint32 Stream; + long hot_x; + long hot_y; + uint32 Width; + uint32 Height; + uint32 Comp; + uint32 Reserved[8]; + uint8* data; +} RendCell; + +#define SS_HEADER_NUM_FIELDS 14 +struct SpriteSeriesHeader { + uint32 header; + uint32 size; + uint32 packing; + uint32 frameRate; + uint32 pixSpeed; + uint32 maxWidth; + uint32 maxHeight; + uint32 reserved3; + uint32 reserved4; + uint32 reserved5; + uint32 reserved6; + uint32 reserved7; + uint32 reserved8; + uint32 count; +}; + +#define SF_HEADER_NUM_FIELDS 15 +struct SpriteFrameHeader { + uint32 pack; + uint32 stream; + uint32 x; + uint32 y; + uint32 width; + uint32 height; + uint32 comp; + uint32 reserved1; + uint32 reserved2; + uint32 reserved3; + uint32 reserved4; + uint32 reserved5; + uint32 reserved6; + uint32 reserved7; + uint32 reserved8; +}; + +class MSprite: public MSurface { +private: + void loadSprite(Common::SeekableReadStream *source); +public: + MSprite(); + MSprite(Common::SeekableReadStream *source, const Common::Point &offset, + int widthVal, int heightVal, bool decodeRle = true, uint8 encodingVal = 0); + virtual ~MSprite(); + + Common::Point _pos; + Common::Point _offset; + uint8 _encoding; +}; + +class SpriteSlotSubset { +public: + int _spritesIndex; + int _frameNumber; + Common::Point _position; + int _depth; + int _scale; +}; + +class SpriteSlot : public SpriteSlotSubset { +private: + static MADSEngine *_vm; + friend class SpriteSlots; +public: + SpriteType _spriteType; + int _seqIndex; +public: + SpriteSlot(); + SpriteSlot(SpriteType type, int seqIndex); + + void setup(int dirtyAreaIndex); +}; + +class SpriteSlots : public Common::Array { +private: + MADSEngine *_vm; +public: + SpriteSlots(MADSEngine *vm); + + /** + * Clears any pending slot data and schedules a full screen refresh. + * @param flag Also reset sprite list + */ + void clear(bool flag); + + /** + * Delete any sprites used by the player + */ + void releasePlayerSprites(); + + /** + * Delete a sprite entry + * @param index Specifies the index in the array + */ + void deleteEntry(int index); + + /** + * Adds a full screen refresh to the sprite slots + */ + void fullRefresh(bool clearAll = false); + + SpriteAsset &getSprite(int idx) { + error("TODO"); + } + void deleteTimer(int idx) { + warning("TODO: SpriteSlots::deleteTimer"); + } + int getIndex() { + warning("TODO: SpriteSlots::indexOf"); + return -1; + } + + /** + * Draw any sprites into the background of the scene + */ + void drawBackground(); +}; + +class SpriteSets : public Common::Array { +public: + /** + * Add a sprite asset to the list + */ + int add(SpriteAsset *asset, int idx = 0); +}; + +} // End of namespace MADS + +#endif /* MADS_SPRITES_H */ -- cgit v1.2.3 From 23ebeec600f8210601dd45fc42c21a596fa6d127 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 5 Mar 2014 07:27:39 -0500 Subject: MADS: Further implementation of drawElements --- engines/mads/animation.h | 1 + engines/mads/graphics.cpp | 18 ++++++++++ engines/mads/graphics.h | 28 +++++++++++++++ engines/mads/interface.cpp | 87 +++++++++++++++++++++++++++++++++++++++++++++ engines/mads/interface.h | 60 +++++++++++++++++++++++++++++++ engines/mads/mads.cpp | 2 +- engines/mads/mads.h | 3 +- engines/mads/module.mk | 1 + engines/mads/msurface.cpp | 5 --- engines/mads/msurface.h | 5 --- engines/mads/scene.cpp | 23 +++++++++++- engines/mads/scene.h | 1 - engines/mads/scene_data.cpp | 52 --------------------------- engines/mads/scene_data.h | 21 ----------- engines/mads/sprites.cpp | 20 +++++++++++ engines/mads/sprites.h | 7 ++++ 16 files changed, 247 insertions(+), 87 deletions(-) create mode 100644 engines/mads/interface.cpp create mode 100644 engines/mads/interface.h diff --git a/engines/mads/animation.h b/engines/mads/animation.h index 297abf4eee..9498483fb6 100644 --- a/engines/mads/animation.h +++ b/engines/mads/animation.h @@ -29,6 +29,7 @@ #include "mads/msurface.h" #include "mads/scene_data.h" #include "mads/font.h" +#include "mads/interface.h" namespace MADS { diff --git a/engines/mads/graphics.cpp b/engines/mads/graphics.cpp index 267785b76b..f4d788fea5 100644 --- a/engines/mads/graphics.cpp +++ b/engines/mads/graphics.cpp @@ -26,5 +26,23 @@ namespace MADS { +void ScreenSurface::init() { + setSize(g_system->getWidth(), g_system->getHeight()); +} + +void ScreenSurface::updateScreen() { + g_system->copyRectToScreen((const byte *)pixels, pitch, 0, 0, w, h); + g_system->updateScreen(); +} + +void ScreenSurface::transition(bool transitionFlag, bool surfaceFlag) { + +} + +void ScreenSurface::setPointer(MSurface *s) { + _pixels = s->getData(); + _pitch = s->w; +} + } // End of namespace MADS diff --git a/engines/mads/graphics.h b/engines/mads/graphics.h index cadbbc8e8e..b64bced245 100644 --- a/engines/mads/graphics.h +++ b/engines/mads/graphics.h @@ -24,12 +24,40 @@ #define MADS_GRAPHICS_H #include "common/scummsys.h" +#include "common/array.h" +#include "mads/msurface.h" namespace MADS { #define MADS_SCREEN_WIDTH 320 #define MADS_SCREEN_HEIGHT 200 +class ScreenSurface : public MSurface { +public: + Common::Point _offset; + byte *_pixels; + int _pitch; +public: + /** + * Constructor + */ + ScreenSurface() {} + + /** + * Initialise the surface + */ + void init(); + + void setPointer(MSurface *s); + + /** + * Updates the screen with the contents of the surface + */ + void updateScreen(); + + void transition(bool transitionFlag, bool surfaceFlag); +}; + } // End of namespace MADS #endif /* MADS_GRAPHICS_H */ diff --git a/engines/mads/interface.cpp b/engines/mads/interface.cpp new file mode 100644 index 0000000000..fa50cbd1be --- /dev/null +++ b/engines/mads/interface.cpp @@ -0,0 +1,87 @@ +/* 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 "common/scummsys.h" +#include "mads/mads.h" +#include "mads/compression.h" +#include "mads/interface.h" + +namespace MADS { + +void SceneNode::load(Common::SeekableReadStream *f) { + _walkPos.x = f->readSint16LE(); + _walkPos.y = f->readSint16LE(); + for (int i = 0; i < MAX_ROUTE_NODES; ++i) + _indexes[i] = f->readUint16LE(); +} + +/*------------------------------------------------------------------------*/ + +InterfaceSurface::InterfaceSurface(MADSEngine *vm) : _vm(vm) { + _category = CAT_NONE; + _screenObjectsCount = 0; +} + + +void InterfaceSurface::load(const Common::String &resName) { + File f(resName); + MadsPack madsPack(&f); + + // Load in the palette + Common::SeekableReadStream *palStream = madsPack.getItemStream(0); + + RGB4 *gamePalP = &_vm->_palette->_gamePalette[0]; + byte *palP = &_vm->_palette->_mainPalette[0]; + + for (int i = 0; i < 16; ++i, gamePalP++, palP += 3) { + palP[0] = palStream->readByte(); + palP[1] = palStream->readByte(); + palP[2] = palStream->readByte(); + gamePalP->r |= 1; + palStream->skip(3); + } + delete palStream; + + // set the size for the interface + setSize(MADS_SCREEN_WIDTH, MADS_INTERFACE_HEIGHT); + Common::SeekableReadStream *pixelsStream = madsPack.getItemStream(1); + pixelsStream->read(getData(), MADS_SCREEN_WIDTH * MADS_INTERFACE_HEIGHT); + delete pixelsStream; +} + +void InterfaceSurface::elementHighlighted() { + warning("TODO: InterfaceSurface::elementHighlighted"); +} + +void InterfaceSurface::writeText() { + warning("TODO: InterfaceSurface::writeText"); +} + + +void InterfaceSurface::setBounds(const Common::Rect &r) { + _bounds = r; +} + +/*------------------------------------------------------------------------*/ + + +} // End of namespace MADS diff --git a/engines/mads/interface.h b/engines/mads/interface.h new file mode 100644 index 0000000000..3295fa450e --- /dev/null +++ b/engines/mads/interface.h @@ -0,0 +1,60 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_INTERFACE_H +#define MADS_INTERFACE_H + +#include "common/scummsys.h" +#include "common/rect.h" +#include "common/str.h" + +namespace MADS { + +class InterfaceSurface : public MSurface { +private: + MADSEngine *_vm; +public: + ScrCategory _category; + int _screenObjectsCount; + Common::Rect _bounds; + Common::Rect *_rectP; +public: + /** + * Constructor + */ + InterfaceSurface(MADSEngine *vm); + + /** + * Loads an interface from a specified resource + */ + void load(const Common::String &resName); + + void elementHighlighted(); + + void writeText(); + + void setBounds(const Common::Rect &r); +}; + +} // End of namespace MADS + +#endif /* MADS_INTERFACE_H */ diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index fd2aebaecf..fcf03952c7 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -82,7 +82,7 @@ void MADSEngine::initialise() { _events = new EventsManager(this); _palette = new Palette(this); _font = new Font(this); - _screen.setSize(g_system->getWidth(), g_system->getHeight()); + _screen.init(); _sound = new SoundManager(this, _mixer); _userInterface = UserInterface::init(this); _game = Game::init(this); diff --git a/engines/mads/mads.h b/engines/mads/mads.h index 0d5e16ac47..abe6e790c2 100644 --- a/engines/mads/mads.h +++ b/engines/mads/mads.h @@ -35,6 +35,7 @@ #include "mads/events.h" #include "mads/font.h" #include "mads/game.h" +#include "mads/graphics.h" #include "mads/msurface.h" #include "mads/resources.h" #include "mads/sound.h" @@ -97,7 +98,7 @@ public: Game *_game; Palette *_palette; Resources *_resources; - MSurface _screen; + ScreenSurface _screen; SoundManager *_sound; UserInterface *_userInterface; bool _easyMouse; diff --git a/engines/mads/module.mk b/engines/mads/module.mk index 2bff5b782e..6a44621283 100644 --- a/engines/mads/module.mk +++ b/engines/mads/module.mk @@ -18,6 +18,7 @@ MODULE_OBJS := \ game.o \ game_data.o \ graphics.o \ + interface.o \ mads.o \ messages.o \ msurface.o \ diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp index bb9b3089df..5f7b37b1cd 100644 --- a/engines/mads/msurface.cpp +++ b/engines/mads/msurface.cpp @@ -199,11 +199,6 @@ void MSurface::empty() { Common::fill(getBasePtr(0, 0), getBasePtr(0, h), _vm->_palette->BLACK); } -void MSurface::updateScreen() { - g_system->copyRectToScreen((const byte *)pixels, pitch, 0, 0, w, h); - g_system->updateScreen(); -} - void MSurface::copyFrom(MSurface *src, const Common::Rect &srcBounds, const Common::Point &destPos, int transparentColor) { // Validation of the rectangle and position diff --git a/engines/mads/msurface.h b/engines/mads/msurface.h index 7f4cec3c1c..7043cd4eff 100644 --- a/engines/mads/msurface.h +++ b/engines/mads/msurface.h @@ -131,11 +131,6 @@ public: */ void empty(); - /** - * Updates the screen with the contents of the surface - */ - void updateScreen(); - /** * Copys a sub-section of another surface into the current one. * @param src Source surface diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 994f58230e..1d489ddb2d 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -164,7 +164,6 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) { _scaleRange = _sceneInfo->_maxScale - _sceneInfo->_minScale; _spriteSlots.clear(false); - _screenY = 0; _interfaceY = MADS_SCENE_HEIGHT; _spritesCount = _sprites.size(); @@ -432,6 +431,28 @@ void Scene::drawElements(bool transitionFlag, bool surfaceFlag) { // Copy dirty areas to the main display surface _dirtyAreas.copy(&_vm->_screen, &_backgroundSurface, _posAdjust); + + // Set dirty areas + _spriteSlots.setDirtyAreas(); + _textDisplay.setDirtyAreas(); + + // + _vm->_screen.setPointer(&_vm->_screen); + _interface.setBounds(Common::Rect(_vm->_screen._offset.x, _vm->_screen._offset.y, + _vm->_screen._offset.x + _vm->_screen.w, _vm->_screen._offset.y + _vm->_screen.h)); + + if (transitionFlag) { + // Fading in the screen + _vm->_screen.transition(transitionFlag, surfaceFlag); + _vm->_sound->startQueuedCommands(); + } else { + // Copy dirty areas to the screen + _dirtyAreas.copy(&_vm->_screen, &_backgroundSurface, _vm->_screen._offset); + } + + warning("TODO: sub_115A2"); + _spriteSlots.cleanUp(); + _textDisplay.cleanUp(); } void Scene::leftClick() { diff --git a/engines/mads/scene.h b/engines/mads/scene.h index c466f97c02..d9bc15add1 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -112,7 +112,6 @@ public: int _depthStyle; int _bandsRange; int _scaleRange; - int _screenY; int _interfaceY; int _spritesCount; int _v1A; diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index 371fa43501..00632f6d2e 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -471,30 +471,6 @@ void ARTHeader::load(Common::SeekableReadStream *f) { /*------------------------------------------------------------------------*/ -void SceneNode::load(Common::SeekableReadStream *f) { - _walkPos.x = f->readSint16LE(); - _walkPos.y = f->readSint16LE(); - for (int i = 0; i < MAX_ROUTE_NODES; ++i) - _indexes[i] = f->readUint16LE(); -} - -/*------------------------------------------------------------------------*/ - -InterfaceSurface::InterfaceSurface(MADSEngine *vm): _vm(vm) { - _category = CAT_NONE; - _screenObjectsCount = 0; -} - -void InterfaceSurface::elementHighlighted() { - warning("TODO: InterfaceSurface::elementHighlighted"); -} - -void InterfaceSurface::writeText() { - warning("TODO: InterfaceSurface::writeText"); -} - -/*------------------------------------------------------------------------*/ - void SceneInfo::SpriteInfo::load(Common::SeekableReadStream *f) { f->skip(3); _spriteSetIndex = f->readByte(); @@ -507,34 +483,6 @@ void SceneInfo::SpriteInfo::load(Common::SeekableReadStream *f) { /*------------------------------------------------------------------------*/ -void InterfaceSurface::load(const Common::String &resName) { - File f(resName); - MadsPack madsPack(&f); - - // Load in the palette - Common::SeekableReadStream *palStream = madsPack.getItemStream(0); - - RGB4 *gamePalP = &_vm->_palette->_gamePalette[0]; - byte *palP = &_vm->_palette->_mainPalette[0]; - - for (int i = 0; i < 16; ++i, gamePalP++, palP += 3) { - palP[0] = palStream->readByte(); - palP[1] = palStream->readByte(); - palP[2] = palStream->readByte(); - gamePalP->r |= 1; - palStream->skip(3); - } - delete palStream; - - // set the size for the interface - setSize(MADS_SCREEN_WIDTH, MADS_INTERFACE_HEIGHT); - Common::SeekableReadStream *pixelsStream = madsPack.getItemStream(1); - pixelsStream->read(getData(), MADS_SCREEN_WIDTH * MADS_INTERFACE_HEIGHT); - delete pixelsStream; -} - -/*------------------------------------------------------------------------*/ - SceneInfo *SceneInfo::init(MADSEngine *vm) { if (vm->getGameID() == GType_RexNebular) { return new SceneInfoNebular(vm); diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index 15371e405f..ce785e76ae 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -277,27 +277,6 @@ public: }; typedef Common::Array SceneNodeList; -class InterfaceSurface : public MSurface { -private: - MADSEngine *_vm; -public: - ScrCategory _category; - int _screenObjectsCount; -public: - /** - * Constructor - */ - InterfaceSurface(MADSEngine *vm); - - /** - * Loads an interface from a specified resource - */ - void load(const Common::String &resName); - - void elementHighlighted(); - - void writeText(); -}; /** * Handles general data for a given scene diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp index 3cba6989b1..e7349f6c60 100644 --- a/engines/mads/sprites.cpp +++ b/engines/mads/sprites.cpp @@ -161,6 +161,19 @@ void SpriteSlots::deleteEntry(int index) { remove_at(index); } +void SpriteSlots::setDirtyAreas() { + Scene &scene = _vm->_game->_scene; + + for (uint i = 0; i < size(); ++i) { + if ((*this)[i]._spriteType >= ST_NONE) { + scene._dirtyAreas[i].setSpriteSlot(&(*this)[i]); + + scene._dirtyAreas[i]._textActive = ((*this)[i]._spriteType <= ST_NONE) ? 0 : 1; + (*this)[i]._spriteType = ST_NONE; + } + } +} + void SpriteSlots::fullRefresh(bool clearAll) { if (clearAll) Common::Array::clear(); @@ -220,6 +233,13 @@ void SpriteSlots::drawBackground() { } } +void SpriteSlots::cleanUp() { + for (int i = (int)size() - 1; i >= 0; --i) { + if ((*this)[i]._spriteType >= ST_NONE) + remove_at(i); + } +} + /*------------------------------------------------------------------------*/ int SpriteSets::add(SpriteAsset *asset, int idx) { diff --git a/engines/mads/sprites.h b/engines/mads/sprites.h index 6b131105dc..b1208d0df5 100644 --- a/engines/mads/sprites.h +++ b/engines/mads/sprites.h @@ -162,6 +162,11 @@ public: */ void deleteEntry(int index); + /** + * Setup dirty areas for the sprite slots + */ + void setDirtyAreas(); + /** * Adds a full screen refresh to the sprite slots */ @@ -182,6 +187,8 @@ public: * Draw any sprites into the background of the scene */ void drawBackground(); + + void cleanUp(); }; class SpriteSets : public Common::Array { -- cgit v1.2.3 From d98f890029936dfa8139cf8dce4756ec92bc2568 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 5 Mar 2014 09:04:53 -0500 Subject: MADS: Completed implementing drawElements and support methods --- engines/mads/messages.cpp | 20 +++--- engines/mads/messages.h | 23 ++++-- engines/mads/msurface.cpp | 176 ++++++++++++++++++++++++++++++++++++++++++++++ engines/mads/msurface.h | 21 ++++++ engines/mads/scene.cpp | 20 ++++-- engines/mads/sprites.cpp | 89 ++++++++++++++++++++++- engines/mads/sprites.h | 7 ++ 7 files changed, 332 insertions(+), 24 deletions(-) diff --git a/engines/mads/messages.cpp b/engines/mads/messages.cpp index 3b6663e71d..11db00f1b9 100644 --- a/engines/mads/messages.cpp +++ b/engines/mads/messages.cpp @@ -305,7 +305,7 @@ TextDisplayList::TextDisplayList(MADSEngine *vm) : _vm(vm) { } } -void TextDisplayList::clear() { +void TextDisplayList::reset() { for (int i = 0; i < TEXT_DISPLAY_SIZE; ++i) (*this)[i]._active = false; } @@ -361,18 +361,16 @@ void TextDisplayList::setDirtyAreas2() { } } -void TextDisplayList::draw(MSurface *view) { - error("TODO"); - /* - for (uint idx = 0; idx < _entries.size(); ++idx) { - if (_entries[idx]._active && (_entries[idx]._expire >= 0)) { - _entries[idx]._font->setColors(_entries[idx]._color1, _entries[idx]._color2, 0); - _entries[idx]._font->writeString(view, _entries[idx]._msg, - Common::Point(_entries[idx]._bounds.left, _entries[idx]._bounds.top), - _entries[idx]._bounds.width(), _entries[idx]._spacing); +void TextDisplayList::draw(MSurface *s) { + for (uint idx = 0; idx < size(); ++idx) { + TextDisplay &td = (*this)[idx]; + if (td._active && (td._expire >= 0)) { + td._font->setColors(0xFF, td._color1, td._color2, 0); + td._font->writeString(s, td._msg, + Common::Point(td._bounds.left, td._bounds.top), + td._bounds.width(), td._spacing); } } - */ } void TextDisplayList::cleanUp() { diff --git a/engines/mads/messages.h b/engines/mads/messages.h index 1357b98d03..19a0115f94 100644 --- a/engines/mads/messages.h +++ b/engines/mads/messages.h @@ -108,11 +108,6 @@ public: class TextDisplayList: public Common::Array { private: MADSEngine *_vm; - - /** - * Determine dirty areas for active text areas - */ - void setDirtyAreas2(); public: TextDisplayList(MADSEngine *vm); @@ -122,14 +117,28 @@ public: void expire(int idx); int add(int xp, int yp, uint fontColor, int charSpacing, const Common::String &, Font *font); - void clear(); - void draw(MSurface *view); + + /** + * Reset all of the text display entries in the list to inactive + */ + void reset(); + + /** + * Draw any text in the list to the specified surface + * @param surface Surface + */ + void draw(MSurface *s); /** * Determine dirty areas for active text areas */ void setDirtyAreas(); + /** + * Secondary setup dirty areas for the text areas + */ + void setDirtyAreas2(); + /** * Deactivates any text display entries that are finished */ diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp index 5f7b37b1cd..aed00f5553 100644 --- a/engines/mads/msurface.cpp +++ b/engines/mads/msurface.cpp @@ -244,6 +244,168 @@ void MSurface::copyFrom(MSurface *src, const Common::Rect &srcBounds, } } +void MSurface::copyFrom(MSurface *src, const Common::Point &destPos, int depth, + MSurface *depthsSurface, int scale, int transparentColor) { + + int destX = destPos.x, destY = destPos.y; + if (scale == 100) { + // Copy the specified area + Common::Rect copyRect(0, 0, src->getWidth(), src->getHeight()); + + if (destX < 0) { + copyRect.left += -destX; + destX = 0; + } + else if (destX + copyRect.width() > w) { + copyRect.right -= destX + copyRect.width() - w; + } + if (destY < 0) { + copyRect.top += -destY; + destY = 0; + } + else if (destY + copyRect.height() > h) { + copyRect.bottom -= destY + copyRect.height() - h; + } + + if (!copyRect.isValidRect()) + return; + + byte *data = src->getData(); + byte *srcPtr = data + (src->getWidth() * copyRect.top + copyRect.left); + byte *depthsData = depthsSurface->getData(); + byte *depthsPtr = depthsData + (depthsSurface->pitch * destY) + destX; + byte *destPtr = (byte *)pixels + (destY * pitch) + destX; + + // 100% scaling variation + for (int rowCtr = 0; rowCtr < copyRect.height(); ++rowCtr) { + // Copy each byte one at a time checking against the depth + for (int xCtr = 0; xCtr < copyRect.width(); ++xCtr) { + if ((depth <= (depthsPtr[xCtr] & 0x7f)) && (srcPtr[xCtr] != transparentColor)) + destPtr[xCtr] = srcPtr[xCtr]; + } + + srcPtr += src->getWidth(); + depthsPtr += depthsSurface->getWidth(); + destPtr += getWidth(); + } + + return; + } + + // Start of draw logic for scaled sprites + const byte *srcPixelsP = src->getData(); + + int destRight = this->getWidth() - 1; + int destBottom = this->getHeight() - 1; + bool normalFrame = true; // TODO: false for negative frame numbers + int frameWidth = src->getWidth(); + int frameHeight = src->getHeight(); + + int highestDim = MAX(frameWidth, frameHeight); + bool lineDist[MADS_SCREEN_WIDTH]; + int distIndex = 0; + int distXCount = 0, distYCount = 0; + + int distCtr = 0; + do { + distCtr += scale; + if (distCtr < 100) { + lineDist[distIndex] = false; + } + else { + lineDist[distIndex] = true; + distCtr -= 100; + + if (distIndex < frameWidth) + ++distXCount; + + if (distIndex < frameHeight) + ++distYCount; + } + } while (++distIndex < highestDim); + + destX -= distXCount / 2; + destY -= distYCount - 1; + + // Check x bounding area + int spriteLeft = 0; + int spriteWidth = distXCount; + int widthAmount = destX + distXCount - 1; + + if (destX < 0) { + spriteWidth += destX; + spriteLeft -= destX; + } + widthAmount -= destRight; + if (widthAmount > 0) + spriteWidth -= widthAmount; + + int spriteRight = spriteLeft + spriteWidth; + if (spriteWidth <= 0) + return; + if (!normalFrame) { + destX += distXCount - 1; + spriteLeft = -(distXCount - spriteRight); + spriteRight = (-spriteLeft + spriteWidth); + } + + // Check y bounding area + int spriteTop = 0; + int spriteHeight = distYCount; + int heightAmount = destY + distYCount - 1; + + if (destY < 0) { + spriteHeight += destY; + spriteTop -= destY; + } + heightAmount -= destBottom; + if (heightAmount > 0) + spriteHeight -= heightAmount; + int spriteBottom = spriteTop + spriteHeight; + + if (spriteHeight <= 0) + return; + + byte *destPixelsP = this->getBasePtr(destX + spriteLeft, destY + spriteTop); + const byte *depthPixelsP = depthsSurface->getBasePtr(destX + spriteLeft, destY + spriteTop); + + spriteLeft = (spriteLeft * (normalFrame ? 1 : -1)); + + // Loop through the lines of the sprite + for (int yp = 0, sprY = -1; yp < frameHeight; ++yp, srcPixelsP += src->pitch) { + if (!lineDist[yp]) + // Not a display line, so skip it + continue; + // Check whether the sprite line is in the display range + ++sprY; + if ((sprY >= spriteBottom) || (sprY < spriteTop)) + continue; + + // Found a line to display. Loop through the pixels + const byte *srcP = srcPixelsP; + const byte *depthP = depthPixelsP; + byte *destP = destPixelsP; + for (int xp = 0, sprX = 0; xp < frameWidth; ++xp, ++srcP) { + if (xp < spriteLeft) + // Not yet reached start of display area + continue; + if (!lineDist[sprX++]) + // Not a display pixel + continue; + + if ((*srcP != transparentColor) && (depth <= (*depthP & 0x7f))) + *destP = *srcP; + + ++destP; + ++depthP; + } + + // Move to the next destination line + destPixelsP += this->pitch; + depthPixelsP += depthsSurface->pitch; + } +} + void MSurface::translate(Common::Array &palette) { for (int y = 0; y < this->h; ++y) { byte *pDest = getBasePtr(0, y); @@ -254,4 +416,18 @@ void MSurface::translate(Common::Array &palette) { } } +MSurface *MSurface::flipHorizontal() const { + MSurface *dest = new MSurface(this->w, this->h); + + for (int y = 0; y < this->h; ++y) { + const byte *srcP = getBasePtr(this->w - 1, y); + byte *destP = dest->getData(); + + for (int x = 0; x < this->w; ++x) + *destP++ = *srcP--; + } + + return dest; +} + } // End of namespace MADS diff --git a/engines/mads/msurface.h b/engines/mads/msurface.h index 7043cd4eff..c797033859 100644 --- a/engines/mads/msurface.h +++ b/engines/mads/msurface.h @@ -126,6 +126,11 @@ public: */ byte *getBasePtr(int x, int y) { return (byte *)Graphics::Surface::getBasePtr(x, y); } + /** + * Returns a pointer to a given position within the surface + */ + const byte *getBasePtr(int x, int y) const { return (const byte *)Graphics::Surface::getBasePtr(x, y); } + /** * Clears the surface */ @@ -141,6 +146,17 @@ public: void copyFrom(MSurface *src, const Common::Rect &srcBounds, const Common::Point &destPos, int transparentColor = -1); + /** + * Copys a sub-section of another surface into the current one. + * @param src Source surface + * @param destPos Destination position to draw in current surface + * @param depth Depth of sprite + * @param depthSurface Depth surface to use with sprite depth + * @param transparentColor Transparency palette index + */ + void copyFrom(MSurface *src, const Common::Point &destPos, int depth, MSurface *depthSurface, + int scale, int transparentColor = -1); + /** * Copies the surface to a given destination surface */ @@ -167,6 +183,11 @@ public: * Translates the pixels of an image used the passed palette with RGB mapping */ void translate(Common::Array &palette); + + /** + * Create a new surface which is a flipped horizontal copy of the current one + */ + MSurface *flipHorizontal() const; }; } // End of namespace MADS diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 1d489ddb2d..7359562180 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -423,18 +423,30 @@ void Scene::doFrame() { } void Scene::drawElements(bool transitionFlag, bool surfaceFlag) { - // Draw any background objects + // Draw any sprites + _dirtyAreas.clear(); _spriteSlots.drawBackground(); + // Process dirty areas + _textDisplay.setDirtyAreas(); + // Merge any identified dirty areas - _dirtyAreas.merge(1, _dirtyAreas.size()); + _dirtyAreas.merge(1, DIRTY_AREAS_SIZE); // Copy dirty areas to the main display surface _dirtyAreas.copy(&_vm->_screen, &_backgroundSurface, _posAdjust); - // Set dirty areas + // Handle dirty areas for foreground objects _spriteSlots.setDirtyAreas(); - _textDisplay.setDirtyAreas(); + _textDisplay.setDirtyAreas2(); + _dirtyAreas.merge(1, DIRTY_AREAS_SIZE); + + + // Draw foreground sprites + _spriteSlots.drawForeground(&_vm->_screen); + + // Draw text elements onto the view + _textDisplay.draw(&_vm->_screen); // _vm->_screen.setPointer(&_vm->_screen); diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp index e7349f6c60..aa15f665f4 100644 --- a/engines/mads/sprites.cpp +++ b/engines/mads/sprites.cpp @@ -36,6 +36,24 @@ enum { kMarker = 2 }; +#define TRANSPARENT_COLOR_INDEX 0xFF + +class DepthEntry { +public: + int depth; + int index; + + DepthEntry(int depthAmt, int indexVal) { depth = depthAmt; index = indexVal; } +}; + +bool sortHelper(const DepthEntry &entry1, const DepthEntry &entry2) { + return entry1.depth < entry2.depth; +} + +typedef Common::List DepthList; + +/*------------------------------------------------------------------------*/ + MSprite::MSprite(): MSurface() { _encoding = 0; } @@ -105,6 +123,10 @@ void MSprite::loadSprite(Common::SeekableReadStream *source) { } } +byte MSprite::getTransparencyIndex() const { + return TRANSPARENT_COLOR_INDEX; +} + /*------------------------------------------------------------------------*/ MADSEngine *SpriteSlot::_vm = nullptr; @@ -233,6 +255,71 @@ void SpriteSlots::drawBackground() { } } +void SpriteSlots::drawForeground(MSurface *s) { + DepthList depthList; + Scene &scene = _vm->_game->_scene; + + // Get a list of sprite object depths for active objects + for (uint i = 0; i < size(); ++i) { + if ((*this)[i]._spriteType >= ST_NONE) { + DepthEntry rec(16 - (*this)[i]._depth, i); + depthList.push_back(rec); + } + } + + // Sort the list in order of the depth + Common::sort(depthList.begin(), depthList.end(), sortHelper); + + // Loop through each of the objects + DepthList::iterator i; + for (i = depthList.begin(); i != depthList.end(); ++i) { + DepthEntry &de = *i; + SpriteSlot &slot = (*this)[de.index]; + assert(slot._spritesIndex < (int)scene._sprites.size()); + SpriteAsset &spriteSet = *scene._sprites[slot._spritesIndex]; + + // Get the sprite frame + int frameNumber = slot._frameNumber & 0x7fff; + bool flipped = (slot._frameNumber & 0x8000) != 0; + MSprite *sprite = spriteSet.getFrame(frameNumber - 1); + + MSurface *spr = sprite; + if (flipped) { + // Create a flipped copy of the sprite temporarily + spr = sprite->flipHorizontal(); + } + + if ((slot._scale < 100) && (slot._scale != -1)) { + // Minimalised drawing + s->copyFrom(spr, slot._position, slot._depth, &scene._depthSurface, + slot._scale, sprite->getTransparencyIndex()); + } else { + int xp, yp; + + if (slot._scale == -1) { + xp = slot._position.x - scene._posAdjust.x; + yp = slot._position.y - scene._posAdjust.y; + } else { + xp = slot._position.x - (spr->w / 2) - scene._posAdjust.x; + yp = slot._position.y - spr->h - scene._posAdjust.y + 1; + } + + if (slot._depth > 1) { + // Draw the frame with depth processing + s->copyFrom(spr, Common::Point(xp, yp), slot._depth, &scene._depthSurface, + 100, sprite->getTransparencyIndex()); + } else { + // No depth, so simply draw the image + spr->copyTo(s, Common::Point(xp, yp), sprite->getTransparencyIndex()); + } + } + + // Free sprite if it was a flipped one + if (flipped) + delete spr; + } +} + void SpriteSlots::cleanUp() { for (int i = (int)size() - 1; i >= 0; --i) { if ((*this)[i]._spriteType >= ST_NONE) @@ -254,6 +341,4 @@ int SpriteSets::add(SpriteAsset *asset, int idx) { return idx; } -/*------------------------------------------------------------------------*/ - } // End of namespace MADS diff --git a/engines/mads/sprites.h b/engines/mads/sprites.h index b1208d0df5..f9ae46ad9b 100644 --- a/engines/mads/sprites.h +++ b/engines/mads/sprites.h @@ -114,6 +114,8 @@ public: Common::Point _pos; Common::Point _offset; uint8 _encoding; + + byte getTransparencyIndex() const; }; class SpriteSlotSubset { @@ -188,6 +190,11 @@ public: */ void drawBackground(); + /** + * Draw any sprites into the foreground of the scene + */ + void drawForeground(MSurface *s); + void cleanUp(); }; -- cgit v1.2.3 From a0e955d8d327afa83ad96fe1ce765eeba0ce561f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 5 Mar 2014 20:45:02 -0500 Subject: MADS: More Animation class implementation --- engines/mads/animation.cpp | 255 ++++++++++++++++++++++++++++++++++++++++----- engines/mads/animation.h | 54 ++++++++-- engines/mads/msurface.cpp | 67 ++++++++++++ engines/mads/msurface.h | 12 +++ engines/mads/palette.cpp | 9 ++ engines/mads/palette.h | 5 + engines/mads/sprites.cpp | 14 +++ engines/mads/sprites.h | 2 + 8 files changed, 382 insertions(+), 36 deletions(-) diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index c97d707f39..d0c7d3079b 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -27,7 +27,7 @@ namespace MADS { -AAHeader::AAHeader(Common::SeekableReadStream *f) { +void AAHeader::load(Common::SeekableReadStream *f) { _spriteSetsCount = f->readUint16LE(); _miscEntriesCount = f->readUint16LE(); _frameEntriesCount = f->readUint16LE(); @@ -40,7 +40,7 @@ AAHeader::AAHeader(Common::SeekableReadStream *f) { _roomNumber = f->readUint16LE(); f->skip(2); _manualFlag = f->readUint16LE() != 0; - _spriteListIndex = f->readUint16LE(); + _spritesIndex = f->readUint16LE(); _scrollPosition.x = f->readSint16LE(); _scrollPosition.y = f->readSint16LE(); _scrollTicks = f->readUint32LE(); @@ -184,33 +184,33 @@ void Animation::load(MSurface &depthSurface, InterfaceSurface &interfaceSurface, MadsPack madsPack(&f); Common::SeekableReadStream *stream = madsPack.getItemStream(0); - AAHeader aaHeader(stream); + _header.load(stream); delete stream; - if (aaHeader._animMode == 4) + if (_header._animMode == 4) flags |= 0x4000; if (flags & 0x100) { - loadInterface(interfaceSurface, depthSurface, aaHeader, flags, palAnimData, sceneInfo); + loadInterface(interfaceSurface, depthSurface, _header, flags, palAnimData, sceneInfo); } if (flags & 0x200) { // No data - aaHeader._messagesCount = 0; - aaHeader._frameEntriesCount = 0; - aaHeader._miscEntriesCount = 0; + _header._messagesCount = 0; + _header._frameEntriesCount = 0; + _header._miscEntriesCount = 0; } // Initialize the reference list _spriteListIndexes.clear(); - for (int i = 0; i < aaHeader._spriteSetsCount; ++i) + for (int i = 0; i < _header._spriteSetsCount; ++i) _spriteListIndexes.push_back(-1); _messages.clear(); - if (aaHeader._messagesCount > 0) { + if (_header._messagesCount > 0) { // Chunk 2: Following is a list of any messages for the animation Common::SeekableReadStream *msgStream = madsPack.getItemStream(1); - for (int i = 0; i < aaHeader._messagesCount; ++i) { + for (int i = 0; i < _header._messagesCount; ++i) { AnimMessage rec; rec.load(msgStream); _messages.push_back(rec); @@ -220,11 +220,11 @@ void Animation::load(MSurface &depthSurface, InterfaceSurface &interfaceSurface, } _frameEntries.clear(); - if (aaHeader._frameEntriesCount > 0) { + if (_header._frameEntriesCount > 0) { // Chunk 3: animation frame info Common::SeekableReadStream *frameStream = madsPack.getItemStream(2); - for (int i = 0; i < aaHeader._frameEntriesCount; i++) { + for (int i = 0; i < _header._frameEntriesCount; i++) { AnimFrameEntry rec; rec.load(frameStream); _frameEntries.push_back(rec); @@ -234,11 +234,11 @@ void Animation::load(MSurface &depthSurface, InterfaceSurface &interfaceSurface, } _miscEntries.clear(); - if (aaHeader._miscEntriesCount > 0) { + if (_header._miscEntriesCount > 0) { // Chunk 4: Misc Data Common::SeekableReadStream *miscStream = madsPack.getItemStream(3); - for (int i = 0; i < aaHeader._miscEntriesCount; ++i) { + for (int i = 0; i < _header._miscEntriesCount; ++i) { AnimMiscEntry rec; rec.load(miscStream); _miscEntries.push_back(rec); @@ -249,8 +249,8 @@ void Animation::load(MSurface &depthSurface, InterfaceSurface &interfaceSurface, // If the animation specifies a font, then load it for access delete _font; - if (aaHeader._flags & ANIM_CUSTOM_FONT) { - Common::String fontName = "*" + aaHeader._fontResource; + if (_header._flags & ANIM_CUSTOM_FONT) { + Common::String fontName = "*" + _header._fontResource; _font = _vm->_font->getFont(fontName.c_str()); } else { _font = nullptr; @@ -260,28 +260,28 @@ void Animation::load(MSurface &depthSurface, InterfaceSurface &interfaceSurface, for (uint i = 0; i < _spriteSets.size(); ++i) delete _spriteSets[i]; _spriteSets.clear(); - _spriteSets.resize(aaHeader._spriteSetsCount); + _spriteSets.resize(_header._spriteSetsCount); - for (int i = 0; i < aaHeader._spriteSetsCount; ++i) { - if (aaHeader._manualFlag && (i == aaHeader._spriteListIndex)) { + for (int i = 0; i < _header._spriteSetsCount; ++i) { + if (_header._manualFlag && (i == _header._spritesIndex)) { // Skip over field, since it's manually loaded _spriteSets[i] = nullptr; } else { - _spriteSets[i] = new SpriteAsset(_vm, aaHeader._spriteSetNames[i], flags); + _spriteSets[i] = new SpriteAsset(_vm, _header._spriteSetNames[i], flags); } } - if (aaHeader._manualFlag) { - Common::String resName = "*" + aaHeader._spriteSetNames[aaHeader._spriteListIndex]; + if (_header._manualFlag) { + Common::String resName = "*" + _header._spriteSetNames[_header._spritesIndex]; SpriteAsset *sprites = new SpriteAsset(_vm, resName, flags); - _spriteSets[aaHeader._spriteListIndex] = sprites; + _spriteSets[_header._spritesIndex] = sprites; - _spriteListIndexes[aaHeader._spriteListIndex] = _scene->_sprites.add(sprites); + _spriteListIndexes[_header._spritesIndex] = _scene->_sprites.add(sprites); } // TODO: List var_420/var_422 population that seems to overwrite other structures? - if (aaHeader._animMode == 4) { + if (_header._animMode == 4) { // Remaps the sprite list indexes for frames to the loaded sprite list indexes for (uint i = 0; i < _frameEntries.size(); ++i) { int spriteListIndex = _frameEntries[i]._spriteSlot._spritesIndex; @@ -298,6 +298,33 @@ void Animation::load(MSurface &depthSurface, InterfaceSurface &interfaceSurface, f.close(); } +void Animation::loadFrame(int frameNumber) { + Scene &scene = _vm->_game->_scene; + if (_skipLoad) + return; + + Common::Point pt; + int listIndex = _spriteListIndexes[_header._spritesIndex]; + SpriteAsset &spriteSet = scene._spriteSlots.getSprite(listIndex); + + if (_unkIndex < 0) { + MSurface *frame = spriteSet.getFrame(0); + pt.x = frame->getBounds().left; + pt.y = frame->getBounds().top; + } else { + pt.x = _unkList[_unkIndex].x; + pt.y = _unkList[_unkIndex].y; + _unkIndex = 1 - _unkIndex; + } + + if (drawFrame(spriteSet, pt, frameNumber)) + error("proc1 failure"); +} + +bool Animation::drawFrame(SpriteAsset &spriteSet, const Common::Point &pt, int frameNumber) { + return 0; +} + void Animation::loadInterface(InterfaceSurface &interfaceSurface, MSurface &depthSurface, AAHeader &header, int flags, Common::Array *palAnimData, SceneInfo *sceneInfo) { _scene->_depthStyle = 0; @@ -323,8 +350,182 @@ void Animation::loadInterface(InterfaceSurface &interfaceSurface, MSurface &dept } } +bool Animation::hasScroll() const { + return (_header._scrollPosition.x != 0) || (_header._scrollPosition.x != 0); +} + void Animation::update() { - warning("TODO: Animation::update"); + Scene &scene = _vm->_game->_scene; + + if (_header._manualFlag) { + int spriteListIndex = _spriteListIndexes[_header._spritesIndex]; + int newIndex = -1; + + for (uint idx = _oldFrameEntry; idx < _frameEntries.size(); ++idx) { + if (_frameEntries[idx]._frameNumber > _currentFrame) + break; + if (_frameEntries[idx]._spriteSlot._spritesIndex == spriteListIndex) + newIndex = _frameEntries[idx]._spriteSlot._frameNumber; + } + + if (newIndex >= 0) + loadFrame(newIndex); + } + + // If it's not time for the next frame, then exit + if (_vm->_events->_currentTimer < _nextFrameTimer) + return; + + for (uint idx = 0; idx < scene._spriteSlots.size(); ++idx) { + if (scene._spriteSlots[idx]._seqIndex >= 0x80) + scene._spriteSlots[idx]._spriteType = ST_EXPIRED; + } + + // Validate the current frame + if (_currentFrame >= (int)_miscEntries.size()) { + // Is the animation allowed to be repeated? + if (_resetFlag) { + _currentFrame = 0; + _oldFrameEntry = 0; + } else { + _freeFlag = true; + return; + } + } + + // Handle executing any sound command for this frame + AnimMiscEntry &misc = _miscEntries[_currentFrame]; + if (misc._soundId) + _vm->_sound->command(misc._soundId); + + // Handle any screen scrolling + if (hasScroll()) { + scene._backgroundSurface.scrollX(_header._scrollPosition.x); + scene._backgroundSurface.scrollY(_header._scrollPosition.y); + scene._spriteSlots.fullRefresh(); + } + + // Handle any offset adjustment for sprites as of this frame + bool paChanged = false; + if (scene._posAdjust.x != misc._posAdjust.x) { + scene._posAdjust.x = misc._posAdjust.x; + paChanged = true; + } + if (scene._posAdjust.y != misc._posAdjust.y) { + scene._posAdjust.y = misc._posAdjust.y; + paChanged = true; + } + + int newIndex = -1; + if (paChanged) { + newIndex = scene._spriteSlots.getIndex(); + scene._spriteSlots[newIndex]._seqIndex = -1; + scene._spriteSlots[newIndex]._spriteType = ST_FULL_SCREEN_REFRESH; + } + + // Main frame animation loop - frames get animated by being placed, as necessary, into the + // main sprite slot array + while ((uint)_oldFrameEntry < _frameEntries.size()) { + if (_frameEntries[_oldFrameEntry]._frameNumber > _currentFrame) + break; + else if (_frameEntries[_oldFrameEntry]._frameNumber == _currentFrame) { + // Found the correct frame + int spriteSlotIndex = 0; + int index = 0; + + for (;;) { + if ((spriteSlotIndex == 0) && (index < (int)scene._spriteSlots.size())) { + int seqIndex = _frameEntries[_oldFrameEntry]._seqIndex - scene._spriteSlots[index]._seqIndex; + if (seqIndex == 0x80) { + if (scene._spriteSlots[index] == _frameEntries[_oldFrameEntry]._spriteSlot) { + scene._spriteSlots[index]._spriteType = ST_NONE; + spriteSlotIndex = -1; + } + } + ++index; + continue; + } + + if (spriteSlotIndex == 0) { + int slotIndex = scene._spriteSlots.getIndex(); + SpriteSlot &slot = scene._spriteSlots[slotIndex]; + slot.copy(_frameEntries[_oldFrameEntry]._spriteSlot); + slot._seqIndex = _frameEntries[_oldFrameEntry]._seqIndex + 0x80; + + SpriteAsset &spriteSet = scene._spriteSlots.getSprite( + scene._spriteSlots[slotIndex]._spritesIndex); + slot._spriteType = spriteSet.isBackground() ? ST_BACKGROUND : ST_FOREGROUND; + } + break; + } + } + + ++_oldFrameEntry; + } + + // Handle the display of any messages + for (uint idx = 0; idx < _messages.size(); ++idx) { + if (_messages[idx]._kernelMsgIndex >= 0) { + // Handle currently active message + if ((_currentFrame < _messages[idx]._startFrame) || (_currentFrame > _messages[idx]._endFrame)) { + scene._kernelMessages.remove(_messages[idx]._kernelMsgIndex); + _messages[idx]._kernelMsgIndex = -1; + --_messageCtr; + } + } else if ((_currentFrame >= _messages[idx]._startFrame) && (_currentFrame <= _messages[idx]._endFrame)) { + // Start displaying the message + AnimMessage &me = _messages[idx]; + + // The color index to use is dependant on how many messages are currently on-screen + uint8 colIndex; + switch (_messageCtr) { + case 1: + colIndex = 252; + break; + case 2: + colIndex = 16; + break; + default: + colIndex = 250; + break; + } + + _vm->_palette->setEntry(colIndex, me._rgb1[0], me._rgb1[1], me._rgb1[2]); + _vm->_palette->setEntry(colIndex + 1, me._rgb2[0], me._rgb2[1], me._rgb2[2]); + + // Add a kernel message to display the given text + me._kernelMsgIndex = scene._kernelMessages.add(me._pos, colIndex * 0x101 + 0x100, + 0, 0, INDEFINITE_TIMEOUT, me._msg); + assert(me._kernelMsgIndex >= 0); + ++_messageCtr; + } + } + + // Move to the next frame + _currentFrame++; + if (_currentFrame >= (int)_miscEntries.size()) { + // Animation is complete + if (_abortTimers != 0) { + _vm->_game->_abortTimers = _abortTimers; + _vm->_game->_abortTimersMode = _abortMode; + + if (_abortMode != ABORTMODE_1) { + // Copy the noun list + scene._action._action = _actionNouns; + } + } + } + + int frameNum = MIN(_currentFrame, (int)_miscEntries.size() - 1); + _nextFrameTimer = _vm->_events->_currentTimer + _miscEntries[frameNum]._numTicks; +} + +void Animation::setCurrentFrame(int frameNumber) { + _currentFrame = frameNumber; + _oldFrameEntry = 0; + _freeFlag = false; + + _nextScrollTimer = _nextFrameTimer = _vm->_events->_currentTimer; } } // End of namespace MADS diff --git a/engines/mads/animation.h b/engines/mads/animation.h index 9498483fb6..8df7b37439 100644 --- a/engines/mads/animation.h +++ b/engines/mads/animation.h @@ -90,7 +90,7 @@ public: int _animMode; int _roomNumber; bool _manualFlag; - int _spriteListIndex; + int _spritesIndex; Common::Point _scrollPosition; uint32 _scrollTicks; Common::String _interfaceFile; @@ -104,28 +104,57 @@ public: /** * Loads the data for a animation file header */ - AAHeader(Common::SeekableReadStream *f); + void load(Common::SeekableReadStream *f); }; class Animation { private: MADSEngine *_vm; Scene *_scene; + AAHeader _header; - void loadInterface(InterfaceSurface &interfaceSurface, MSurface &depthSurface, - AAHeader &header, int flags, Common::Array *palAnimData, SceneInfo *sceneInfo); -protected: - Animation(MADSEngine *vm, Scene *scene); -public: - static Animation *init(MADSEngine *vm, Scene *scene); -public: Common::Array _spriteListIndexes; Common::Array _messages; Common::Array _frameEntries; Common::Array _miscEntries; Common::Array _spriteSets; Font *_font; + + int _currentFrame, _oldFrameEntry; bool _resetFlag; + bool _freeFlag; + bool _skipLoad; + int _unkIndex; + Common::Point _unkList[2]; + uint32 _nextFrameTimer; + uint32 _nextScrollTimer; + int _messageCtr; + int _abortTimers; + AbortTimerMode _abortMode; + ActionDetails _actionNouns; + + /** + * Load data for a given frame + * @param frameNumber Frame number + */ + void loadFrame(int frameNumber); + + bool drawFrame(SpriteAsset &spriteSet, const Common::Point &pt, int frameNumber); + + /** + * Load the user interface display for an animation + */ + void loadInterface(InterfaceSurface &interfaceSurface, MSurface &depthSurface, + AAHeader &header, int flags, Common::Array *palAnimData, SceneInfo *sceneInfo); + + /** + * Returns true if there is a scroll required + */ + bool hasScroll() const; +protected: + Animation(MADSEngine *vm, Scene *scene); +public: + static Animation *init(MADSEngine *vm, Scene *scene); public: /* * Destructor @@ -147,6 +176,13 @@ public: * Update the animation */ void update(); + + virtual void setCurrentFrame(int frameNumber); + virtual int getCurrentFrame() const { return _currentFrame; } + + bool freeFlag() const { return _freeFlag; } + bool getAnimMode() const { return _header._animMode; } + int roomNumber() const { return _header._roomNumber; } }; } // End of namespace MADS diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp index aed00f5553..754fea851d 100644 --- a/engines/mads/msurface.cpp +++ b/engines/mads/msurface.cpp @@ -406,6 +406,73 @@ void MSurface::copyFrom(MSurface *src, const Common::Point &destPos, int depth, } } +void MSurface::scrollX(int xAmount) { + if (xAmount == 0) + return; + + byte buffer[80]; + int direction = (xAmount > 0) ? -1 : 1; + int xSize = ABS(xAmount); + assert(xSize <= 80); + + byte *srcP = getBasePtr(0, 0); + + for (int y = 0; y < this->h; ++y, srcP += pitch) { + if (direction < 0) { + // Copy area to be overwritten + Common::copy(srcP, srcP + xSize, &buffer[0]); + // Shift the remainder of the line over the given area + Common::copy(srcP + xSize, srcP + this->w, srcP); + // Move buffered area to the end of the line + Common::copy(&buffer[0], &buffer[xSize], srcP + this->w - xSize); + } + else { + // Copy area to be overwritten + Common::copy_backward(srcP + this->w - xSize, srcP + this->w, &buffer[80]); + // Shift the remainder of the line over the given area + Common::copy_backward(srcP, srcP + this->w - xSize, srcP + this->w); + // Move buffered area to the start of the line + Common::copy_backward(&buffer[80 - xSize], &buffer[80], srcP + xSize); + } + } +} + +void MSurface::scrollY(int yAmount) { + if (yAmount == 0) + return; + + int direction = (yAmount > 0) ? 1 : -1; + int ySize = ABS(yAmount); + assert(ySize < (this->h / 2)); + assert(this->w == pitch); + + int blockSize = ySize * this->w; + byte *tempData = new byte[blockSize]; + byte *pixelsP = getBasePtr(0, 0); + + if (direction > 0) { + // Buffer the lines to be overwritten + byte *srcP = (byte *)getBasePtr(0, this->h - ySize); + Common::copy(srcP, srcP + (pitch * ySize), tempData); + // Vertically shift all the lines + Common::copy_backward(pixelsP, pixelsP + (pitch * (this->h - ySize)), + pixelsP + (pitch * this->h)); + // Transfer the buffered lines top the top of the screen + Common::copy(tempData, tempData + blockSize, pixelsP); + } + else { + // Buffer the lines to be overwritten + Common::copy(pixelsP, pixelsP + (pitch * ySize), tempData); + // Vertically shift all the lines + Common::copy(pixelsP + (pitch * ySize), pixelsP + (pitch * this->h), pixelsP); + // Transfer the buffered lines to the bottom of the screen + Common::copy(tempData, tempData + blockSize, pixelsP + (pitch * (this->h - ySize))); + } + + delete[] tempData; +} + + void MSurface::translate(Common::Array &palette) { for (int y = 0; y < this->h; ++y) { byte *pDest = getBasePtr(0, y); diff --git a/engines/mads/msurface.h b/engines/mads/msurface.h index c797033859..bd8142fd1a 100644 --- a/engines/mads/msurface.h +++ b/engines/mads/msurface.h @@ -179,6 +179,18 @@ public: dest->copyFrom(this, srcBounds, destPos, transparentColor); } + /** + * Scroll the screen horizontally by a given amount + * @param xAmount Horizontal amount + */ + void scrollX(int xAmount); + + /** + * Scroll the screen vertically by a given amount + * @param yAmount Vertical amount + */ + void scrollY(int yAmount); + /** * Translates the pixels of an image used the passed palette with RGB mapping */ diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index aca1298a23..4568f7d39a 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -180,6 +180,15 @@ void Palette::setPalette(const byte *colors, uint start, uint num) { reset(); } +void Palette::setEntry(byte palIndex, byte r, byte g, byte b) { + _mainPalette[palIndex * 3] = r; + _mainPalette[palIndex * 3 + 1] = g; + _mainPalette[palIndex * 3 + 2] = b; + + setPalette((const byte *)&_mainPalette[palIndex * 3], palIndex, 1); +} + + void Palette::grabPalette(byte *colors, uint start, uint num) { g_system->getPaletteManager()->grabPalette(colors, start, num); reset(); diff --git a/engines/mads/palette.h b/engines/mads/palette.h index 18b058cccc..a00e1789f4 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -164,6 +164,11 @@ public: */ void setPalette(const byte *colors, uint start, uint num); + /** + * Set a palette entry + */ + void setEntry(byte palIndex, byte r, byte g, byte b); + /** * Returns a subset of the currently loaded palette */ diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp index aa15f665f4..23360b0a00 100644 --- a/engines/mads/sprites.cpp +++ b/engines/mads/sprites.cpp @@ -149,6 +149,20 @@ SpriteSlot::SpriteSlot(SpriteType type, int seqIndex) { _scale = 0; } +bool SpriteSlot::operator==(const SpriteSlotSubset &other) const { + return (_spritesIndex == other._spritesIndex) && (_frameNumber == other._frameNumber) && + (_position == other._position) && (_depth == other._depth) && + (_scale == other._scale); +} + +void SpriteSlot::copy(const SpriteSlotSubset &other) { + _spritesIndex = other._spritesIndex; + _frameNumber = other._frameNumber; + _position = other._position; + _depth = other._depth; + _scale = other._scale; +} + /*------------------------------------------------------------------------*/ SpriteSlots::SpriteSlots(MADSEngine *vm) : _vm(vm) { diff --git a/engines/mads/sprites.h b/engines/mads/sprites.h index f9ae46ad9b..49f13add21 100644 --- a/engines/mads/sprites.h +++ b/engines/mads/sprites.h @@ -139,6 +139,8 @@ public: SpriteSlot(SpriteType type, int seqIndex); void setup(int dirtyAreaIndex); + bool operator==(const SpriteSlotSubset &other) const; + void copy(const SpriteSlotSubset &other); }; class SpriteSlots : public Common::Array { -- cgit v1.2.3 From 73a7140be775693533db183f353fc9c82c14fa53 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 5 Mar 2014 21:36:02 -0500 Subject: MADS: Starting implementation of scene group 8 --- engines/mads/game.h | 2 +- engines/mads/nebular/nebular_scenes.cpp | 18 +++++++------ engines/mads/nebular/nebular_scenes.h | 6 ++++- engines/mads/nebular/nebular_scenes8.cpp | 24 +++++++++++++++++ engines/mads/nebular/nebular_scenes8.h | 19 ++++++++++++-- engines/mads/player.h | 1 + engines/mads/resources.cpp | 45 ++++++++++++++++++++++++++++++++ engines/mads/resources.h | 3 +++ engines/mads/scene.cpp | 2 +- engines/mads/scene_data.cpp | 6 +++++ engines/mads/scene_data.h | 3 ++- 11 files changed, 115 insertions(+), 14 deletions(-) diff --git a/engines/mads/game.h b/engines/mads/game.h index 5330cd3138..aa3c38596c 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -65,7 +65,6 @@ protected: int _v5; int _v6; bool _updateSceneFlag; - Common::String _aaName; bool _playerSpritesFlag; int _objectHiliteVocabIdx; @@ -117,6 +116,7 @@ public: AbortTimerMode _abortTimersMode; AbortTimerMode _abortTimersMode2; uint32 _priorFrameTimer; + Common::String _aaName; public: virtual ~Game(); diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index efd831a4b7..e1dec2c34c 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -31,17 +31,19 @@ namespace MADS { namespace Nebular { -SceneLogic *SceneFactory::createScene(Scene *scene) { - scene->addActiveVocab(NOUN_DROP); - scene->addActiveVocab(NOUN_DOLLOP); - scene->addActiveVocab(NOUN_DASH); - scene->addActiveVocab(NOUN_SPLASH); - scene->addActiveVocab(NOUN_ALCOHOL); +SceneLogic *SceneFactory::createScene(MADSEngine *vm) { + Scene &scene = vm->_game->_scene; + + scene.addActiveVocab(NOUN_DROP); + scene.addActiveVocab(NOUN_DOLLOP); + scene.addActiveVocab(NOUN_DASH); + scene.addActiveVocab(NOUN_SPLASH); + scene.addActiveVocab(NOUN_ALCOHOL); // TODO: Implement all the game scenes - assert(scene->_nextSceneId == 804); + assert(scene._nextSceneId == 804); - return new Scene804(scene); + return new Scene804(vm); } } // End of namespace Nebular diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index 28d24f090f..1997202fbd 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -31,6 +31,10 @@ namespace MADS { namespace Nebular { +enum { + SEX_MALE = 0, SEX_FEMALE = 2 +}; + enum Noun { NOUN_BLOWGUN = 0x29, NOUN_BURGER = 0x35, @@ -81,7 +85,7 @@ enum Noun { class SceneFactory { public: - static SceneLogic *createScene(Scene *scene); + static SceneLogic *createScene(MADSEngine *vm); }; } // End of namespace Nebular diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index 8feabc8037..ee06dd00d3 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -21,12 +21,36 @@ */ #include "common/scummsys.h" +#include "mads/mads.h" +#include "mads/scene.h" +#include "mads/nebular/nebular_scenes.h" #include "mads/nebular/nebular_scenes8.h" namespace MADS { namespace Nebular { +void Scene8xx::setup1() { + _vm->_sound->command(5); + if ((_vm->_game->_globalFlags[178] && !_vm->_game->_globalFlags[179]) || + _scene->_nextSceneId == 804 || _scene->_nextSceneId == 805 || + _scene->_nextSceneId == 808 || _scene->_nextSceneId == 810) { + _vm->_game->_player._spritesPrefix = ""; + } else { + _vm->_game->_player._spritesPrefix = _vm->_game->_globalFlags[0] + == SEX_FEMALE ? "ROX" : "RXM"; + } + + _vm->_palette->setEntry(16, 0x0A, 0x3F, 0x3F); + _vm->_palette->setEntry(17, 0x0A, 0x2D, 0x2D); +} + +void Scene8xx::setup2() { + _vm->_game->_aaName = Resources::formatAAName(5); +} + +/*------------------------------------------------------------------------*/ + void Scene804::setup() { } diff --git a/engines/mads/nebular/nebular_scenes8.h b/engines/mads/nebular/nebular_scenes8.h index 11bb8b0d81..3f5d2744fa 100644 --- a/engines/mads/nebular/nebular_scenes8.h +++ b/engines/mads/nebular/nebular_scenes8.h @@ -31,9 +31,24 @@ namespace MADS { namespace Nebular { -class Scene804: public SceneLogic { +class Scene8xx : public SceneLogic { +protected: + /** + * Initial setup code shared by several scenes + */ + void setup1(); + + /** + * Initial setup code shared by several scenes + */ + void setup2(); public: - Scene804(Scene *scene): SceneLogic(scene) {} + Scene8xx(MADSEngine *vm) : SceneLogic(vm) {} +}; + +class Scene804: public Scene8xx { +public: + Scene804(MADSEngine *vm) : Scene8xx(vm) {} virtual void setup(); diff --git a/engines/mads/player.h b/engines/mads/player.h index cff131342d..896b8d5b16 100644 --- a/engines/mads/player.h +++ b/engines/mads/player.h @@ -65,6 +65,7 @@ public: uint32 _priorTimer; int _unk3; bool _forceRefresh; + Common::String _spritesPrefix; public: Player(MADSEngine *vm); diff --git a/engines/mads/resources.cpp b/engines/mads/resources.cpp index 8cfc1a290a..5e490c2719 100644 --- a/engines/mads/resources.cpp +++ b/engines/mads/resources.cpp @@ -303,6 +303,47 @@ Common::String Resources::formatName(RESPREFIX resType, int id, const Common::St return result; } +Common::String Resources::formatName(int prefix, char asciiCh, int id, EXTTYPE extType, + const Common::String &suffix) { + Common::String result; + if (prefix <= 0) { + result = "*"; + } + else { + result = Common::String::format("%s%.3d", + (prefix < 100) ? "*SC" : "*RM", prefix); + } + + result += Common::String::format("%c%d", asciiCh, id); + if (!suffix.empty()) + result += suffix; + + switch (extType) { + case EXT_SS: + result += ".SS"; + break; + case EXT_AA: + result += ".AA"; + break; + case EXT_DAT: + result += ".DAT"; + break; + case EXT_HH: + result += ".HH"; + break; + case EXT_ART: + result += ".ART"; + break; + case EXT_INT: + result += ".INT"; + break; + default: + break; + } + + return result; +} + Common::String Resources::formatResource(const Common::String &resName, const Common::String &hagFilename) { // int v1 = 0, v2 = 0; @@ -316,6 +357,10 @@ Common::String Resources::formatResource(const Common::String &resName, } } +Common::String Resources::formatAAName(int idx) { + return formatName(0, 'I', idx, EXT_AA, ""); +} + /*------------------------------------------------------------------------*/ void File::openFile(const Common::String &filename) { diff --git a/engines/mads/resources.h b/engines/mads/resources.h index 8fed0ab437..01f6490ecc 100644 --- a/engines/mads/resources.h +++ b/engines/mads/resources.h @@ -47,7 +47,10 @@ public: static void init(MADSEngine *vm); static Common::String formatName(RESPREFIX resType, int id, const Common::String &ext); + static Common::String formatName(int prefix, char asciiCh, int id, + EXTTYPE extType, const Common::String &suffix); static Common::String formatResource(const Common::String &resName, const Common::String &hagFilename); + static Common::String formatAAName(int idx); }; /** diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 7359562180..b285229926 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -107,7 +107,7 @@ void Scene::loadSceneLogic() { switch (_vm->getGameID()) { case GType_RexNebular: - _sceneLogic = Nebular::SceneFactory::createScene(this); + _sceneLogic = Nebular::SceneFactory::createScene(_vm); break; default: error("Unknown game"); diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index 00632f6d2e..58fa36e037 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -715,4 +715,10 @@ void SceneInfoNebular::loadCodes(MSurface &depthSurface) { f.close(); } +/*------------------------------------------------------------------------*/ + +SceneLogic::SceneLogic(MADSEngine *vm) : _vm(vm) { + _scene = &_vm->_game->_scene; +} + } // End of namespace MADS diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index ce785e76ae..c4b6610e85 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -207,12 +207,13 @@ public: class SceneLogic { protected: + MADSEngine *_vm; Scene *_scene; public: /** * Constructor */ - SceneLogic(Scene *scene): _scene(scene) {} + SceneLogic(MADSEngine *vm); /** * Destructor -- cgit v1.2.3 From c35271f20c82d35e613246779ada14fc79ee6c0a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 5 Mar 2014 21:50:12 -0500 Subject: MADS: Moved hotspot code to a separate file --- engines/mads/hotspots.cpp | 128 ++++++++++++++++++++++++++++++++++++++++++++ engines/mads/hotspots.h | 88 ++++++++++++++++++++++++++++++ engines/mads/module.mk | 1 + engines/mads/scene.h | 1 + engines/mads/scene_data.cpp | 102 ----------------------------------- engines/mads/scene_data.h | 51 ------------------ 6 files changed, 218 insertions(+), 153 deletions(-) create mode 100644 engines/mads/hotspots.cpp create mode 100644 engines/mads/hotspots.h diff --git a/engines/mads/hotspots.cpp b/engines/mads/hotspots.cpp new file mode 100644 index 0000000000..340ad7ddf1 --- /dev/null +++ b/engines/mads/hotspots.cpp @@ -0,0 +1,128 @@ +/* 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 "mads/mads.h" +#include "mads/hotspots.h" + +namespace MADS { + +DynamicHotspot::DynamicHotspot() { + _seqIndex = 0; + _facing = 0; + _descId = 0; + _field14 = 0; + _articleNumber = 0; + _cursor = CURSOR_NONE; +} + +/*------------------------------------------------------------------------*/ + +DynamicHotspots::DynamicHotspots(MADSEngine *vm) : _vm(vm) { + for (int i = 0; i < DYNAMIC_HOTSPOTS_SIZE; ++i) { + DynamicHotspot rec; + rec._active = false; + _entries.push_back(rec); + } + + _changed = true; + _count = 0; +} + +int DynamicHotspots::add(int descId, int field14, int seqIndex, const Common::Rect &bounds) { + // Find a free slot + uint idx = 0; + while ((idx < _entries.size()) && _entries[idx]._active) + ++idx; + if (idx == _entries.size()) + error("DynamicHotspots overflow"); + + _entries[idx]._active = true; + _entries[idx]._descId = descId; + _entries[idx]._seqIndex = seqIndex; + _entries[idx]._bounds = bounds; + _entries[idx]._feetPos.x = -3; + _entries[idx]._feetPos.y = 0; + _entries[idx]._facing = 5; + _entries[idx]._field14 = field14; + _entries[idx]._articleNumber = 6; + _entries[idx]._cursor = CURSOR_NONE; + + ++_count; + _changed = true; + + if (seqIndex >= 0) + _vm->_game->_scene._sequences[seqIndex]._dynamicHotspotIndex = idx; + + return idx; +} + +int DynamicHotspots::setPosition(int index, int xp, int yp, int facing) { + if (index >= 0) { + _entries[index]._feetPos.x = xp; + _entries[index]._feetPos.y = yp; + _entries[index]._facing = facing; + } + + return index; +} + +int DynamicHotspots::setCursor(int index, CursorType cursor) { + if (index >= 0) + _entries[index]._cursor = cursor; + + return index; +} + +void DynamicHotspots::remove(int index) { + Scene &scene = _vm->_game->_scene; + + if (_entries[index]._active) { + if (_entries[index]._seqIndex >= 0) + scene._sequences[_entries[index]._seqIndex]._dynamicHotspotIndex = -1; + _entries[index]._active = false; + + --_count; + _changed = true; + } +} + +void DynamicHotspots::clear() { + for (uint i = 0; i < _entries.size(); ++i) + _entries[i]._active = false; + + _changed = false; + _count = 0; +} + +void DynamicHotspots::reset() { + for (uint i = 0; i < _entries.size(); ++i) + remove(i); + + _count = 0; + _changed = false; +} + +void DynamicHotspots::refresh() { + error("DynamicHotspots::refresh"); +} + +} // End of namespace MADS diff --git a/engines/mads/hotspots.h b/engines/mads/hotspots.h new file mode 100644 index 0000000000..acbc72d60d --- /dev/null +++ b/engines/mads/hotspots.h @@ -0,0 +1,88 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_HOTSPOTS_H +#define MADS_HOTSPOTS_H + +#include "common/scummsys.h" +#include "mads/events.h" + +namespace MADS { + +class MADSEngine; + + +class DynamicHotspot { +public: + bool _active; + int _seqIndex; + Common::Rect _bounds; + Common::Point _feetPos; + int _facing; + int _descId; + int _field14; + int _articleNumber; + CursorType _cursor; + + DynamicHotspot(); +}; + +#define DYNAMIC_HOTSPOTS_SIZE 8 + +class DynamicHotspots { +private: + MADSEngine *_vm; + Common::Array _entries; + int _count; +public: + bool _changed; +public: + DynamicHotspots(MADSEngine *vm); + + DynamicHotspot &operator[](uint idx) { return _entries[idx]; } + int add(int descId, int field14, int seqIndex, const Common::Rect &bounds); + int setPosition(int index, int xp, int yp, int facing); + int setCursor(int index, CursorType cursor); + void remove(int index); + void clear(); + void reset(); + void refresh(); +}; + +class Hotspot { +public: + Common::Rect _bounds; + Common::Point _feetPos; + int _facing; + int _articleNumber; + CursorType _cursor; + int _vocabId; + int _verbId; + + Hotspot(); + Hotspot(Common::SeekableReadStream &f); +}; + + +} // End of namespace MADS + +#endif /* MADS_HOTSPOTS_H */ diff --git a/engines/mads/module.mk b/engines/mads/module.mk index 6a44621283..7197a60955 100644 --- a/engines/mads/module.mk +++ b/engines/mads/module.mk @@ -18,6 +18,7 @@ MODULE_OBJS := \ game.o \ game_data.o \ graphics.o \ + hotspots.o \ interface.o \ mads.o \ messages.o \ diff --git a/engines/mads/scene.h b/engines/mads/scene.h index d9bc15add1..f31927d877 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -27,6 +27,7 @@ #include "common/array.h" #include "common/rect.h" #include "mads/assets.h" +#include "mads/hotspots.h" #include "mads/messages.h" #include "mads/msurface.h" #include "mads/scene_data.h" diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index 58fa36e037..813e9062cf 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -294,108 +294,6 @@ void DirtyAreas::reset() { /*------------------------------------------------------------------------*/ -DynamicHotspot::DynamicHotspot() { - _seqIndex = 0; - _facing = 0; - _descId = 0; - _field14 = 0; - _articleNumber = 0; - _cursor = CURSOR_NONE; -} - -/*------------------------------------------------------------------------*/ - -DynamicHotspots::DynamicHotspots(MADSEngine *vm): _vm(vm) { - for (int i = 0; i < DYNAMIC_HOTSPOTS_SIZE; ++i) { - DynamicHotspot rec; - rec._active = false; - _entries.push_back(rec); - } - - _changed = true; - _count = 0; -} - -int DynamicHotspots::add(int descId, int field14, int seqIndex, const Common::Rect &bounds) { - // Find a free slot - uint idx = 0; - while ((idx < _entries.size()) && _entries[idx]._active) - ++idx; - if (idx == _entries.size()) - error("DynamicHotspots overflow"); - - _entries[idx]._active = true; - _entries[idx]._descId = descId; - _entries[idx]._seqIndex = seqIndex; - _entries[idx]._bounds = bounds; - _entries[idx]._feetPos.x = -3; - _entries[idx]._feetPos.y = 0; - _entries[idx]._facing = 5; - _entries[idx]._field14 = field14; - _entries[idx]._articleNumber = 6; - _entries[idx]._cursor = CURSOR_NONE; - - ++_count; - _changed = true; - - if (seqIndex >= 0) - _vm->_game->_scene._sequences[seqIndex]._dynamicHotspotIndex = idx; - - return idx; -} - -int DynamicHotspots::setPosition(int index, int xp, int yp, int facing) { - if (index >= 0) { - _entries[index]._feetPos.x = xp; - _entries[index]._feetPos.y = yp; - _entries[index]._facing = facing; - } - - return index; -} - -int DynamicHotspots::setCursor(int index, CursorType cursor) { - if (index >= 0) - _entries[index]._cursor = cursor; - - return index; -} - -void DynamicHotspots::remove(int index) { - Scene &scene = _vm->_game->_scene; - - if (_entries[index]._active) { - if (_entries[index]._seqIndex >= 0) - scene._sequences[_entries[index]._seqIndex]._dynamicHotspotIndex = -1; - _entries[index]._active = false; - - --_count; - _changed = true; - } -} - -void DynamicHotspots::clear() { - for (uint i = 0; i < _entries.size(); ++i) - _entries[i]._active = false; - - _changed = false; - _count = 0; -} - -void DynamicHotspots::reset() { - for (uint i = 0; i < _entries.size(); ++i) - remove(i); - - _count = 0; - _changed = false; -} - -void DynamicHotspots::refresh() { - error("DynamicHotspots::refresh"); -} - -/*------------------------------------------------------------------------*/ - KernelMessage::KernelMessage() { _flags = 0; _sequenceIndex = 0; diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index c4b6610e85..4d8cfc72cf 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -113,57 +113,6 @@ public: void check(bool scanFlag); }; -class DynamicHotspot { -public: - bool _active; - int _seqIndex; - Common::Rect _bounds; - Common::Point _feetPos; - int _facing; - int _descId; - int _field14; - int _articleNumber; - CursorType _cursor; - - DynamicHotspot(); -}; - -#define DYNAMIC_HOTSPOTS_SIZE 8 - -class DynamicHotspots { -private: - MADSEngine *_vm; - Common::Array _entries; - int _count; -public: - bool _changed; -public: - DynamicHotspots(MADSEngine *vm); - - DynamicHotspot &operator[](uint idx) { return _entries[idx]; } - int add(int descId, int field14, int seqIndex, const Common::Rect &bounds); - int setPosition(int index, int xp, int yp, int facing); - int setCursor(int index, CursorType cursor); - void remove(int index); - void clear(); - void reset(); - void refresh(); -}; - -class Hotspot { -public: - Common::Rect _bounds; - Common::Point _feetPos; - int _facing; - int _articleNumber; - CursorType _cursor; - int _vocabId; - int _verbId; - - Hotspot(); - Hotspot(Common::SeekableReadStream &f); -}; - class DirtyArea { private: static MADSEngine *_vm; -- cgit v1.2.3 From 2d9bb392aeef7beab60986a57889eb38001407ef Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 5 Mar 2014 21:57:38 -0500 Subject: MADS: Implemented missing hotspot method --- engines/mads/hotspots.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/engines/mads/hotspots.cpp b/engines/mads/hotspots.cpp index 340ad7ddf1..a3660dfd81 100644 --- a/engines/mads/hotspots.cpp +++ b/engines/mads/hotspots.cpp @@ -122,7 +122,21 @@ void DynamicHotspots::reset() { } void DynamicHotspots::refresh() { - error("DynamicHotspots::refresh"); + for (uint i = 0; i < _entries.size(); ++i) { + DynamicHotspot &dh = (*this)[i]; + + if ((*this)[i]._active) { + switch (_vm->_game->_scene._screenObjects._v832EC) { + case 0: + case 2: + _vm->_game->_scene._screenObjects.add(dh._bounds, CAT_12, dh._descId); + _vm->_game->_scene._screenObjects._v8333C = true; + break; + default: + break; + } + } + } } } // End of namespace MADS -- cgit v1.2.3 From c9186f51b9502a4cfb1881f2db4f92eeb6227144 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 6 Mar 2014 20:30:05 -0500 Subject: MADS: Added in Rex Nebular globals class --- engines/mads/game.cpp | 10 ++--- engines/mads/game.h | 7 +++- engines/mads/mads.cpp | 1 + engines/mads/mads.h | 1 + engines/mads/messages.cpp | 1 - engines/mads/module.mk | 1 + engines/mads/nebular/game_nebular.cpp | 71 ++++++++++++++++++-------------- engines/mads/nebular/game_nebular.h | 6 +++ engines/mads/nebular/globals_nebular.cpp | 51 +++++++++++++++++++++++ engines/mads/nebular/globals_nebular.h | 63 ++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes.cpp | 3 ++ engines/mads/nebular/nebular_scenes.h | 14 +++++++ engines/mads/nebular/nebular_scenes1.cpp | 53 ++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes1.h | 56 +++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes8.cpp | 29 +++++++++++-- engines/mads/nebular/nebular_scenes8.h | 10 ++++- engines/mads/scene.cpp | 9 ++-- 17 files changed, 336 insertions(+), 50 deletions(-) create mode 100644 engines/mads/nebular/globals_nebular.cpp create mode 100644 engines/mads/nebular/globals_nebular.h create mode 100644 engines/mads/nebular/nebular_scenes1.cpp create mode 100644 engines/mads/nebular/nebular_scenes1.h diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 025cf8d530..b64c59c986 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -66,14 +66,14 @@ Game::~Game() { } void Game::run() { + initialiseGlobals(); + _statusFlag = true; int protectionResult = checkCopyProtection(); switch (protectionResult) { case 1: // Copy protection failed _scene._nextSceneId = 804; - initialiseGlobals(); - _globalFlags[5] = 0xFFFF; _saveSlot = -1; break; case 2: @@ -253,11 +253,7 @@ void Game::sectionLoop() { // TODO: sub_1DD46(3) // Check whether to show a dialog - if (_vm->_dialogs->_pendingDialog && _player._stepEnabled && !_globalFlags[5]) { - _scene._spriteSlots.releasePlayerSprites(); - _vm->_dialogs->showDialog(); - _vm->_dialogs->_pendingDialog = DIALOG_NONE; - } + checkShowDialog(); } } diff --git a/engines/mads/game.h b/engines/mads/game.h index aa3c38596c..0cd46b6f7e 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -97,6 +97,12 @@ protected: * Set up the section handler specific to each section */ virtual void setSectionHandler() = 0; + + /** + * Checks for whether to show a dialog + */ + virtual void checkShowDialog() = 0; + //@} public: @@ -106,7 +112,6 @@ public: int _sectionNumber; int _priorSectionNumber; int _currentSectionNumber; - Common::Array _globalFlags; InventoryObjects _objects; Scene _scene; int _v2; diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index fcf03952c7..c6d2e2ec26 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -42,6 +42,7 @@ MADSEngine::MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc) : _invObjectStill = false; _textWindowStill = false; _screenFade = SCREEN_FADE_FAST; + _musicFlag = false; _debugger = nullptr; _dialogs = nullptr; diff --git a/engines/mads/mads.h b/engines/mads/mads.h index abe6e790c2..2fbac32c4a 100644 --- a/engines/mads/mads.h +++ b/engines/mads/mads.h @@ -105,6 +105,7 @@ public: bool _invObjectStill; bool _textWindowStill; ScreenFade _screenFade; + bool _musicFlag; public: MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc); virtual ~MADSEngine(); diff --git a/engines/mads/messages.cpp b/engines/mads/messages.cpp index 11db00f1b9..33a6a8ef6c 100644 --- a/engines/mads/messages.cpp +++ b/engines/mads/messages.cpp @@ -37,7 +37,6 @@ KernelMessages::KernelMessages(MADSEngine *vm): _vm(vm) { _entries.push_back(rec); } - scene._textSpacing = -1; _talkFont = _vm->_font->getFont(FONT_CONVERSATION); word_8469E = 0; } diff --git a/engines/mads/module.mk b/engines/mads/module.mk index 7197a60955..2f4982f9f8 100644 --- a/engines/mads/module.mk +++ b/engines/mads/module.mk @@ -3,6 +3,7 @@ MODULE := engines/mads MODULE_OBJS := \ nebular/dialogs_nebular.o \ nebular/game_nebular.o \ + nebular/globals_nebular.o \ nebular/sound_nebular.o \ nebular/nebular_scenes.o \ nebular/nebular_scenes8.o \ diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index c55abf5601..c18561bac0 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -28,6 +28,7 @@ #include "mads/msurface.h" #include "mads/nebular/game_nebular.h" #include "mads/nebular/dialogs_nebular.h" +#include "mads/nebular/globals_nebular.h" namespace MADS { @@ -38,6 +39,9 @@ GameNebular::GameNebular(MADSEngine *vm): Game(vm) { } int GameNebular::checkCopyProtection() { + // DEBUG: Flag copy protection failure + _globals[5] = 0xFFFF; + if (!ConfMan.getBool("copy_protection")) return true; @@ -52,32 +56,27 @@ int GameNebular::checkCopyProtection() { } void GameNebular::initialiseGlobals() { - // Allocate globals space - _globalFlags.resize(210); - for (int i = 0; i < 210; ++i) - _globalFlags[i] = 0; - // Set specific values needed by the game - _globalFlags[4] = 8; - _globalFlags[33] = 1; - _globalFlags[10] = 0xFFFF; - _globalFlags[13] = 0xFFFF; - _globalFlags[15] = 0xFFFF; - _globalFlags[19] = 0xFFFF; - _globalFlags[20] = 0xFFFF; - _globalFlags[21] = 0xFFFF; - _globalFlags[95] = 0xFFFF; + _globals[4] = 8; + _globals[33] = 1; + _globals[10] = 0xFFFF; + _globals[13] = 0xFFFF; + _globals[15] = 0xFFFF; + _globals[19] = 0xFFFF; + _globals[20] = 0xFFFF; + _globals[21] = 0xFFFF; + _globals[95] = 0xFFFF; _objects.setData(3, 17, nullptr); // Put the values 0 through 3 in a random order in global slots 83 to 86 for (int i = 0; i < 4;) { int randomVal = _vm->getRandomNumber(3); - _globalFlags[83 + i] = randomVal; + _globals[83 + i] = randomVal; bool flag = false; for (int idx2 = 0; idx2 < i; ++idx2) { - if (_globalFlags[83 + idx2] == randomVal) + if (_globals[83 + idx2] == randomVal) flag = true; } @@ -88,11 +87,11 @@ void GameNebular::initialiseGlobals() { // Put the values 0 through 3 in a random order in global slots 87 to 90 for (int i = 0; i < 4;) { int randomVal = _vm->getRandomNumber(3); - _globalFlags[87 + i] = randomVal; + _globals[87 + i] = randomVal; bool flag = false; for (int idx2 = 0; idx2 < i; ++idx2) { - if (_globalFlags[87 + idx2] == randomVal) + if (_globals[87 + idx2] == randomVal) flag = true; } @@ -100,20 +99,20 @@ void GameNebular::initialiseGlobals() { ++i; } - _globalFlags[120] = 501; - _globalFlags[121] = 0xFFFF; - _globalFlags[55] = 0xFFFF; - _globalFlags[119] = 1; - _globalFlags[134] = 4; + _globals[120] = 501; + _globals[121] = 0xFFFF; + _globals[55] = 0xFFFF; + _globals[119] = 1; + _globals[134] = 4; // Fill out the globals 200 to 209 with unique random values less than 10000 for (int i = 0; i < 10; ++i) { int randomVal = _vm->getRandomNumber(9999); - _globalFlags[200 + i] = randomVal; + _globals[200 + i] = randomVal; bool flag = false; for (int idx2 = 0; idx2 < i; ++idx2) { - if (_globalFlags[200 + idx2] == randomVal) + if (_globals[200 + idx2] == randomVal) flag = true; } @@ -124,20 +123,20 @@ void GameNebular::initialiseGlobals() { // Difficulty level control switch (_difficultyLevel) { case DIFFICULTY_HARD: - _globalFlags[35] = 0; + _globals[35] = 0; _objects.setRoom(9, 1); _objects.setRoom(50, 1); - _globalFlags[137] = 5; - _globalFlags[136] = 0; + _globals[137] = 5; + _globals[136] = 0; break; case DIFFICULTY_MEDIUM: - _globalFlags[35] = 0; + _globals[35] = 0; _objects.setRoom(8, 1); - _globalFlags[137] = 0xFFFF; - _globalFlags[136] = 6; + _globals[137] = 0xFFFF; + _globals[136] = 6; break; case DIFFICULTY_EASY: - _globalFlags[35] = 2; + _globals[35] = 2; _objects.setRoom(8, 1); _objects.setRoom(27, 1); break; @@ -185,6 +184,14 @@ void GameNebular::setSectionHandler() { } } +void GameNebular::checkShowDialog() { + if (_vm->_dialogs->_pendingDialog && _player._stepEnabled && !_globals[5]) { + _scene._spriteSlots.releasePlayerSprites(); + _vm->_dialogs->showDialog(); + _vm->_dialogs->_pendingDialog = DIALOG_NONE; + } +} + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/game_nebular.h b/engines/mads/nebular/game_nebular.h index 6395ba0e4e..0250f66d8e 100644 --- a/engines/mads/nebular/game_nebular.h +++ b/engines/mads/nebular/game_nebular.h @@ -25,6 +25,7 @@ #include "common/scummsys.h" #include "mads/game.h" +#include "mads/nebular/globals_nebular.h" namespace MADS { @@ -40,6 +41,11 @@ protected: virtual void initialiseGlobals(); virtual void setSectionHandler(); + + virtual void checkShowDialog(); + +public: + Globals _globals; }; diff --git a/engines/mads/nebular/globals_nebular.cpp b/engines/mads/nebular/globals_nebular.cpp new file mode 100644 index 0000000000..20789cd154 --- /dev/null +++ b/engines/mads/nebular/globals_nebular.cpp @@ -0,0 +1,51 @@ +/* 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 "common/scummsys.h" +#include "common/config-manager.h" +#include "mads/nebular/globals_nebular.h" + +namespace MADS { + +namespace Nebular { + +Globals::Globals() { + // Initialise global flags + _flags.resize(210); + for (int i = 0; i < 210; ++i) + _flags[i] = 0; + + // Initialise game flags + _chairHotspotIndex = 0; + _v1 = 0; + _v2 = 0; + _v3 = 0; + _v4 = 0; + _v5 = 0; + _v6 = 0; + _v7 = 0; + _v8 = 0; +} + +} // End of namespace Nebular + +} // End of namespace MADS diff --git a/engines/mads/nebular/globals_nebular.h b/engines/mads/nebular/globals_nebular.h new file mode 100644 index 0000000000..0d8da78e42 --- /dev/null +++ b/engines/mads/nebular/globals_nebular.h @@ -0,0 +1,63 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_GLOBALS_NEBULAR_H +#define MADS_GLOBALS_NEBULAR_H + +#include "common/scummsys.h" +#include "common/array.h" +#include "mads/game.h" + +namespace MADS { + +namespace Nebular { + +class Globals { +private: + Common::Array _flags; +public: + int _chairHotspotIndex; + int _v1; + int _v2; + int _v3; + int _v4; + int _v5; + int _v6; + int _v7; + int _v8; +public: + /** + * Constructor + */ + Globals(); + + /** + * Square brackets operator for accessing flags + */ + uint16 &operator[](int idx) { return _flags[idx]; } +}; + +} // End of namespace Nebular + +} // End of namespace MADS + +#endif /* MADS_GLOBALS_NEBULAR_H */ diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index e1dec2c34c..f82e102bfa 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -46,6 +46,9 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene804(vm); } +NebularScene::NebularScene(MADSEngine *vm) : SceneLogic(vm) { +} + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index 1997202fbd..9d617bb543 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -26,6 +26,7 @@ #include "common/scummsys.h" #include "mads/game.h" #include "mads/scene.h" +#include "mads/nebular/globals_nebular.h" namespace MADS { @@ -88,6 +89,19 @@ public: static SceneLogic *createScene(MADSEngine *vm); }; +/** + * Specialized base class for Rex Nebular game scenes + */ +class NebularScene : public SceneLogic { +protected: + Globals &_globals; +public: + /** + * Constructor + */ + NebularScene(MADSEngine *vm); +}; + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp new file mode 100644 index 0000000000..1de4eca509 --- /dev/null +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -0,0 +1,53 @@ +/* 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 "common/scummsys.h" +#include "mads/mads.h" +#include "mads/scene.h" +#include "mads/nebular/nebular_scenes.h" +#include "mads/nebular/nebular_scenes1.h" + +namespace MADS { + +namespace Nebular { + +void Scene101::setup() { +} + +void Scene101::enter() { +} + +void Scene101::step() { +} + +void Scene101::preActions() { +} + +void Scene101::actions() { +} + +void Scene101::postActions() { +} + +} // End of namespace Nebular + +} // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes1.h b/engines/mads/nebular/nebular_scenes1.h new file mode 100644 index 0000000000..da6a2f0903 --- /dev/null +++ b/engines/mads/nebular/nebular_scenes1.h @@ -0,0 +1,56 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_NEBULAR_SCENES1_H +#define MADS_NEBULAR_SCENES1_H + +#include "common/scummsys.h" +#include "mads/game.h" +#include "mads/scene.h" +#include "mads/nebular/nebular_scenes.h" + +namespace MADS { + +namespace Nebular { + +class Scene101: public NebularScene { +public: + Scene101(MADSEngine *vm) : NebularScene(vm) {} + + virtual void setup(); + + virtual void enter(); + + virtual void step(); + + virtual void preActions(); + + virtual void actions(); + + virtual void postActions(); +}; + +} // End of namespace Nebular + +} // End of namespace MADS + +#endif /* MADS_NEBULAR_SCENES1_H */ diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index ee06dd00d3..d08e64506e 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -32,13 +32,12 @@ namespace Nebular { void Scene8xx::setup1() { _vm->_sound->command(5); - if ((_vm->_game->_globalFlags[178] && !_vm->_game->_globalFlags[179]) || + if ((_globals[178] && !_globals[179]) || _scene->_nextSceneId == 804 || _scene->_nextSceneId == 805 || _scene->_nextSceneId == 808 || _scene->_nextSceneId == 810) { _vm->_game->_player._spritesPrefix = ""; } else { - _vm->_game->_player._spritesPrefix = _vm->_game->_globalFlags[0] - == SEX_FEMALE ? "ROX" : "RXM"; + _vm->_game->_player._spritesPrefix = _globals[0] == SEX_FEMALE ? "ROX" : "RXM"; } _vm->_palette->setEntry(16, 0x0A, 0x3F, 0x3F); @@ -49,6 +48,30 @@ void Scene8xx::setup2() { _vm->_game->_aaName = Resources::formatAAName(5); } +void Scene8xx::enter1() { + if (_vm->_musicFlag) { + switch (_scene->_nextSceneId) { + case 801: + case 802: + case 803: + case 804: + case 806: + case 807: + case 808: + _vm->_sound->command(20); + break; + case 805: + _vm->_sound->command(23); + break; + case 810: + _vm->_sound->command(10); + break; + default: + break; + } + } +} + /*------------------------------------------------------------------------*/ void Scene804::setup() { diff --git a/engines/mads/nebular/nebular_scenes8.h b/engines/mads/nebular/nebular_scenes8.h index 3f5d2744fa..a3bc97a990 100644 --- a/engines/mads/nebular/nebular_scenes8.h +++ b/engines/mads/nebular/nebular_scenes8.h @@ -26,12 +26,13 @@ #include "common/scummsys.h" #include "mads/game.h" #include "mads/scene.h" +#include "mads/nebular/nebular_scenes.h" namespace MADS { namespace Nebular { -class Scene8xx : public SceneLogic { +class Scene8xx : public NebularScene { protected: /** * Initial setup code shared by several scenes @@ -42,8 +43,13 @@ protected: * Initial setup code shared by several scenes */ void setup2(); + + /** + * Common scene enter code used by multiple scenes + */ + void enter1(); public: - Scene8xx(MADSEngine *vm) : SceneLogic(vm) {} + Scene8xx(MADSEngine *vm) : NebularScene(vm) {} }; class Scene804: public Scene8xx { diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index b285229926..f974be4d1e 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -28,9 +28,10 @@ namespace MADS { -Scene::Scene(MADSEngine *vm): _vm(vm), _spriteSlots(vm), _action(_vm), - _dirtyAreas(_vm), _dynamicHotspots(vm), _interface(vm), _kernelMessages(vm), - _screenObjects(vm), _sequences(vm), _textDisplay(vm) { +Scene::Scene(MADSEngine *vm): _vm(vm), _action(_vm), _dirtyAreas(_vm), + _dynamicHotspots(vm), _interface(vm), _kernelMessages(vm), + _screenObjects(vm), _sequences(vm), _spriteSlots(vm), + _textDisplay(vm) { _priorSceneId = 0; _nextSceneId = 0; _currentSceneId = 0; @@ -47,6 +48,7 @@ Scene::Scene(MADSEngine *vm): _vm(vm), _spriteSlots(vm), _action(_vm), _freeAnimationFlag = false; _animation = nullptr; _activeAnimation = nullptr; + _textSpacing = -1; _verbList.push_back(VerbInit(VERB_LOOK, 2, 0)); _verbList.push_back(VerbInit(VERB_TAKE, 2, 0)); @@ -424,7 +426,6 @@ void Scene::doFrame() { void Scene::drawElements(bool transitionFlag, bool surfaceFlag) { // Draw any sprites - _dirtyAreas.clear(); _spriteSlots.drawBackground(); // Process dirty areas -- cgit v1.2.3 From a77ed90618664e50705b3e59dd2111faec2f5f39 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 6 Mar 2014 22:31:41 -0500 Subject: MADS: Implementing support methods needed for scene 804 initialisation --- engines/mads/game.cpp | 37 ++++++++++++++-------------- engines/mads/game.h | 20 ++++++++++++---- engines/mads/messages.cpp | 2 -- engines/mads/msurface.cpp | 13 ++++++++++ engines/mads/msurface.h | 15 ++++++++++++ engines/mads/nebular/globals_nebular.cpp | 5 ++-- engines/mads/nebular/globals_nebular.h | 2 ++ engines/mads/nebular/nebular_scenes.cpp | 41 +++++++++++++++++++++++++++++++- engines/mads/nebular/nebular_scenes.h | 16 +++++++++++++ engines/mads/nebular/nebular_scenes8.cpp | 32 +++++++++++++++++++++++++ engines/mads/resources.h | 3 ++- engines/mads/scene.cpp | 8 +++---- engines/mads/scene.h | 2 +- engines/mads/scene_data.cpp | 33 ++----------------------- engines/mads/scene_data.h | 11 --------- engines/mads/sequence.cpp | 19 +++++++++++++++ engines/mads/sequence.h | 2 ++ engines/mads/sprites.cpp | 4 ++++ engines/mads/sprites.h | 14 +++++++++++ 19 files changed, 202 insertions(+), 77 deletions(-) diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index b64c59c986..962e82ca18 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -140,7 +140,6 @@ void Game::sectionLoop() { _v6 = 0; _vm->_events->resetCursor(); - _quotes = nullptr; _scene.clearVocab(); _scene._dynamicHotspots.clear(); _scene.loadSceneLogic(); @@ -223,8 +222,7 @@ void Game::sectionLoop() { if ((_v5 || _v6) && !_updateSceneFlag) { _scene._currentSceneId = _scene._priorSceneId; _updateSceneFlag = true; - } - else { + } else { _updateSceneFlag = false; _scene.loop(); } @@ -232,8 +230,6 @@ void Game::sectionLoop() { _vm->_events->resetCursor(); _v1 = 3; - delete _quotes; - _quotes = nullptr; delete _scene._animation; _scene._animation = nullptr; @@ -274,22 +270,27 @@ void Game::loadResourceSequence(const Common::String prefix, int v) { warning("TODO: loadResourceSequence"); } -Common::String Game::getQuote(int quoteId) { - if (_quotes && *_quotes) { - // Loop through the list of quotes - char *p = (char *)_quotes; - while (*p) { - // Get a pointer to the quote Id after the string - char *idP = p + strlen(p) + 1; - if (READ_LE_UINT16(idP) == quoteId) - // Found the correct string, so return it - return Common::String(p); - - p = idP + 2; +void Game::loadQuotes() { + File f("*QUOTES.DAT"); + int curPos = 0; + + char buffer[128]; + strcpy(buffer, ""); + + while (true) { + uint8 b = f.readByte(); + if (f.eos()) break; + + buffer[curPos++] = b; + if (buffer[curPos - 1] == '\0') { + // end of string, add it to the strings list + _quotes.push_back(buffer); + curPos = 0; + strcpy(buffer, ""); } } - return Common::String(); + f.close(); } } // End of namespace MADS diff --git a/engines/mads/game.h b/engines/mads/game.h index 0cd46b6f7e..aa1810963d 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -24,6 +24,7 @@ #define MADS_GAME_H #include "common/scummsys.h" +#include "common/str-array.h" #include "mads/scene.h" #include "mads/game_data.h" #include "mads/player.h" @@ -51,6 +52,11 @@ private: * Inner game loop for executing gameplay within a game section */ void sectionLoop(); + + /** + * Load quotes data + */ + void loadQuotes(); protected: MADSEngine *_vm; MSurface *_surface; @@ -59,7 +65,7 @@ protected: int _statusFlag; SectionHandler *_sectionHandler; VisitedScenes _visitedScenes; - byte *_quotes; + Common::StringArray _quotes; int _v1; int _v3; int _v5; @@ -130,10 +136,14 @@ public: */ void run(); - /** - * Get a quote - */ - Common::String getQuote(int quoteId); + uint32 getQuotesSize() { return _quotes.size(); } + const Common::String &getQuote(uint32 index) { return _quotes[index - 1]; } + + // DEPRECATED: ScummVM re-implementation keeps all the quotes loaded, so the methods below are stubs + void clearQuotes() {} + void loadQuoteRange(int startNum, int endNum) {} + void loadQuoteSet(...) {} + void loadQuote(int quoteNum) {} }; } // End of namespace MADS diff --git a/engines/mads/messages.cpp b/engines/mads/messages.cpp index 33a6a8ef6c..aaf6c4100e 100644 --- a/engines/mads/messages.cpp +++ b/engines/mads/messages.cpp @@ -30,8 +30,6 @@ namespace MADS { KernelMessages::KernelMessages(MADSEngine *vm): _vm(vm) { - Scene &scene = _vm->_game->_scene; - for (int i = 0; i < KERNEL_MESSAGES_SIZE; ++i) { KernelMessage rec; _entries.push_back(rec); diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp index 754fea851d..74043bf91f 100644 --- a/engines/mads/msurface.cpp +++ b/engines/mads/msurface.cpp @@ -497,4 +497,17 @@ MSurface *MSurface::flipHorizontal() const { return dest; } +/*------------------------------------------------------------------------*/ + +int DepthSurface::getDepth(const Common::Point &pt) { + + if (_vm->_game->_scene._sceneInfo->_depthStyle == 2) { + int bits = (3 - (pt.x % 4)) * 2; + byte v = *getBasePtr(pt.x >> 2, pt.y); + return v >> bits; + } else { + return *getBasePtr(pt.x, pt.y) & 0xF; + } +} + } // End of namespace MADS diff --git a/engines/mads/msurface.h b/engines/mads/msurface.h index bd8142fd1a..96994170aa 100644 --- a/engines/mads/msurface.h +++ b/engines/mads/msurface.h @@ -202,6 +202,21 @@ public: MSurface *flipHorizontal() const; }; +class DepthSurface : public MSurface { +private: + MADSEngine *_vm; +public: + /** + * Constructor + */ + DepthSurface(MADSEngine *vm) : _vm(vm) {} + + /** + * Returns the depth at a given position + */ + int getDepth(const Common::Point &pt); +}; + } // End of namespace MADS #endif /* MADS_MSURFACE_H */ diff --git a/engines/mads/nebular/globals_nebular.cpp b/engines/mads/nebular/globals_nebular.cpp index 20789cd154..37ebf5f8d6 100644 --- a/engines/mads/nebular/globals_nebular.cpp +++ b/engines/mads/nebular/globals_nebular.cpp @@ -29,10 +29,9 @@ namespace MADS { namespace Nebular { Globals::Globals() { - // Initialise global flags + // Initialise lists _flags.resize(210); - for (int i = 0; i < 210; ++i) - _flags[i] = 0; + _spriteIndexes.resize(30); // Initialise game flags _chairHotspotIndex = 0; diff --git a/engines/mads/nebular/globals_nebular.h b/engines/mads/nebular/globals_nebular.h index 0d8da78e42..daa384f88f 100644 --- a/engines/mads/nebular/globals_nebular.h +++ b/engines/mads/nebular/globals_nebular.h @@ -35,6 +35,8 @@ class Globals { private: Common::Array _flags; public: + Common::Array _spriteIndexes; + int _chairHotspotIndex; int _v1; int _v2; diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index f82e102bfa..d14120a5b7 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -23,7 +23,10 @@ #include "common/scummsys.h" #include "common/config-manager.h" #include "mads/mads.h" +#include "mads/compression.h" +#include "mads/resources.h" #include "mads/scene.h" +#include "mads/nebular/game_nebular.h" #include "mads/nebular/nebular_scenes.h" #include "mads/nebular/nebular_scenes8.h" @@ -46,7 +49,43 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene804(vm); } -NebularScene::NebularScene(MADSEngine *vm) : SceneLogic(vm) { +/*------------------------------------------------------------------------*/ + +NebularScene::NebularScene(MADSEngine *vm) : SceneLogic(vm), + _globals(static_cast(vm->_game)->_globals) { +} + +Common::String NebularScene::formAnimName(char sepChar, int suffixNum) { + return Resources::formatName(_scene->_currentSceneId, sepChar, suffixNum, + EXT_NONE, ""); +} + +/*------------------------------------------------------------------------*/ + +void SceneInfoNebular::loadCodes(MSurface &depthSurface) { + File f(Resources::formatName(RESPREFIX_RM, _sceneId, ".DAT")); + MadsPack codesPack(&f); + Common::SeekableReadStream *stream = codesPack.getItemStream(0); + + byte *destP = depthSurface.getData(); + byte *endP = depthSurface.getBasePtr(0, depthSurface.h); + + byte runLength = stream->readByte(); + while (destP < endP && runLength > 0) { + byte runValue = stream->readByte(); + + // Write out the run length + Common::fill(destP, destP + runLength, runValue); + destP += runLength; + + // Get the next run length + runLength = stream->readByte(); + } + + if (destP < endP) + Common::fill(destP, endP, 0); + delete stream; + f.close(); } } // End of namespace Nebular diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index 9d617bb543..92b5626bf0 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -95,6 +95,11 @@ public: class NebularScene : public SceneLogic { protected: Globals &_globals; + + /** + * Forms an animation resoucre name + */ + Common::String formAnimName(char sepChar, int suffixNum); public: /** * Constructor @@ -102,6 +107,17 @@ public: NebularScene(MADSEngine *vm); }; +class SceneInfoNebular : public SceneInfo { + friend class SceneInfo; +protected: + virtual void loadCodes(MSurface &depthSurface); + + /** + * Constructor + */ + SceneInfoNebular(MADSEngine *vm) : SceneInfo(vm) {} +}; + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index d08e64506e..773b0e6d7a 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -75,6 +75,38 @@ void Scene8xx::enter1() { /*------------------------------------------------------------------------*/ void Scene804::setup() { + _globals._chairHotspotIndex = 0; + _globals._v1 = _globals._v2 = 0; + _globals._v3 = _globals._v4 = 0; + _globals._v5 = -1; + _globals._v6 = _globals._v7 = 0; + _globals._v8 = 0; + if (_globals[5]) { + // Copy protection failed + _globals[165] = 0xFFFF; + _globals[164] = 0; + } + + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 0)); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('x', 1)); + _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('x', 2)); + _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('x', 3)); + _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('x', 4)); + _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('f', 1)); + + _vm->_game->loadQuoteSet(791, 0); + + if (_globals[165]) { + if (_globals[164]) { + _globals._spriteIndexes[19] = _scene->_sequences.startCycle( + _globals._spriteIndexes[4], 0, 1); + // TODO + } else { + + } + } else { + // TODO + } } void Scene804::enter() { diff --git a/engines/mads/resources.h b/engines/mads/resources.h index 01f6490ecc..3d5d582707 100644 --- a/engines/mads/resources.h +++ b/engines/mads/resources.h @@ -36,7 +36,8 @@ enum RESPREFIX { }; enum EXTTYPE { - EXT_SS = 1, EXT_AA = 2, EXT_DAT = 3, EXT_HH = 4, EXT_ART = 5, EXT_INT = 6 + EXT_NONE = -1, EXT_SS = 1, EXT_AA = 2, EXT_DAT = 3, EXT_HH = 4, + EXT_ART = 5, EXT_INT = 6 }; class Resources { diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index f974be4d1e..bbf46f164c 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -28,10 +28,10 @@ namespace MADS { -Scene::Scene(MADSEngine *vm): _vm(vm), _action(_vm), _dirtyAreas(_vm), - _dynamicHotspots(vm), _interface(vm), _kernelMessages(vm), - _screenObjects(vm), _sequences(vm), _spriteSlots(vm), - _textDisplay(vm) { +Scene::Scene(MADSEngine *vm): _vm(vm), _action(_vm), _depthSurface(vm), + _dirtyAreas(_vm), _dynamicHotspots(vm), _interface(vm), + _kernelMessages(vm), _screenObjects(vm), _sequences(vm), + _sprites(vm), _spriteSlots(vm), _textDisplay(vm) { _priorSceneId = 0; _nextSceneId = 0; _currentSceneId = 0; diff --git a/engines/mads/scene.h b/engines/mads/scene.h index f31927d877..3fe3a4eddf 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -98,7 +98,7 @@ public: int _v1; SceneInfo *_sceneInfo; MSurface _backgroundSurface; - MSurface _depthSurface; + DepthSurface _depthSurface; InterfaceSurface _interface; bool _animFlag; int _animVal1; diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index 813e9062cf..c15a3876a8 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -383,9 +383,8 @@ void SceneInfo::SpriteInfo::load(Common::SeekableReadStream *f) { SceneInfo *SceneInfo::init(MADSEngine *vm) { if (vm->getGameID() == GType_RexNebular) { - return new SceneInfoNebular(vm); - } - else { + return new Nebular::SceneInfoNebular(vm); + } else { return new SceneInfo(vm); } } @@ -587,34 +586,6 @@ void SceneInfo::loadCodes(MSurface &depthSurface) { /*------------------------------------------------------------------------*/ -void SceneInfoNebular::loadCodes(MSurface &depthSurface) { - File f(Resources::formatName(RESPREFIX_RM, _sceneId, ".DAT")); - MadsPack codesPack(&f); - Common::SeekableReadStream *stream = codesPack.getItemStream(0); - - byte *destP = depthSurface.getData(); - byte *endP = depthSurface.getBasePtr(0, depthSurface.h); - - byte runLength = stream->readByte(); - while (destP < endP && runLength > 0) { - byte runValue = stream->readByte(); - - // Write out the run length - Common::fill(destP, destP + runLength, runValue); - destP += runLength; - - // Get the next run length - runLength = stream->readByte(); - } - - if (destP < endP) - Common::fill(destP, endP, 0); - delete stream; - f.close(); -} - -/*------------------------------------------------------------------------*/ - SceneLogic::SceneLogic(MADSEngine *vm) : _vm(vm) { _scene = &_vm->_game->_scene; } diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index 4d8cfc72cf..d2fd624512 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -288,17 +288,6 @@ public: MSurface &depthSurface, MSurface &bgSurface); }; -class SceneInfoNebular : public SceneInfo { - friend class SceneInfo; -protected: - virtual void loadCodes(MSurface &depthSurface); - - /** - * Constructor - */ - SceneInfoNebular(MADSEngine *vm) : SceneInfo(vm) {} -}; - } // End of namespace MADS #endif /* MADS_SCENE_DATA_H */ diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index 8f25007b48..33febe3ec7 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -367,4 +367,23 @@ void SequenceList::scan() { void SequenceList::setDepth(int seqIndex, int depth) { _entries[seqIndex]._depth = depth; } + +int SequenceList::addSpriteCycle(int srcSpriteIdx, bool flipped, int numTicks, int triggerCountdown, int timeoutTicks, int extraTicks) { + Scene &scene = _vm->_game->_scene; + MSprite *spriteFrame = scene._spriteSlots.getSprite(srcSpriteIdx).getFrame(0); + int depth = scene._depthSurface.getDepth(Common::Point(spriteFrame->_pos.x + + (spriteFrame->w / 2), spriteFrame->_pos.y + (spriteFrame->h / 2))); + + return add(srcSpriteIdx, flipped, 1, triggerCountdown, timeoutTicks, extraTicks, numTicks, 0, 0, + true, 100, depth - 1, 1, ANIMTYPE_CYCLED, 0, 0); +} + +int SequenceList::startCycle(int srcSpriteIndex, bool flipped, int cycleIndex) { + int result = addSpriteCycle(srcSpriteIndex, flipped, INDEFINITE_TIMEOUT, 0, 0, 0); + if (result >= 0) + setAnimRange(result, cycleIndex, cycleIndex); + + return result; +} + } // End of namespace diff --git a/engines/mads/sequence.h b/engines/mads/sequence.h index f73d48bb8f..80f695cf5a 100644 --- a/engines/mads/sequence.h +++ b/engines/mads/sequence.h @@ -102,6 +102,8 @@ public: void setAnimRange(int seqIndex, int startVal, int endVal); void scan(); void setDepth(int seqIndex, int depth); + int addSpriteCycle(int srcSpriteIdx, bool flipped, int numTicks, int triggerCountdown, int timeoutTicks, int extraTicks); + int startCycle(int srcSpriteIdx, bool flipped, int cycleIndex); }; } // End of namespace MADS diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp index 23360b0a00..321acf026d 100644 --- a/engines/mads/sprites.cpp +++ b/engines/mads/sprites.cpp @@ -355,4 +355,8 @@ int SpriteSets::add(SpriteAsset *asset, int idx) { return idx; } +int SpriteSets::addSprites(const Common::String &resName, int flags) { + return add(new SpriteAsset(_vm, resName, flags)); +} + } // End of namespace MADS diff --git a/engines/mads/sprites.h b/engines/mads/sprites.h index 49f13add21..2061a41043 100644 --- a/engines/mads/sprites.h +++ b/engines/mads/sprites.h @@ -201,11 +201,25 @@ public: }; class SpriteSets : public Common::Array { +private: + MADSEngine *_vm; public: + /** + * Constructor + */ + SpriteSets(MADSEngine *vm) : _vm(vm) {} + /** * Add a sprite asset to the list */ int add(SpriteAsset *asset, int idx = 0); + + /** + * Adds a sprite asset to the list by name + */ + int addSprites(const Common::String &resName, int flags = 0); + + int startCycle(int srcSpriteIndex, bool flipped, int cycleIndex); }; } // End of namespace MADS -- cgit v1.2.3 From 1874ec2111fd944d3e554acde8a0f06c651c95fb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 7 Mar 2014 08:04:10 -0500 Subject: MADS: More initialisation code for scene 804, and missing engine methods --- engines/mads/nebular/nebular_scenes8.cpp | 26 ++++++++-- engines/mads/sequence.cpp | 84 +++++++++++++++++++++++--------- engines/mads/sequence.h | 7 ++- engines/mads/sprites.h | 2 - 4 files changed, 89 insertions(+), 30 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index 773b0e6d7a..b3997e110c 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -100,13 +100,33 @@ void Scene804::setup() { if (_globals[164]) { _globals._spriteIndexes[19] = _scene->_sequences.startCycle( _globals._spriteIndexes[4], 0, 1); - // TODO + _scene->_sequences.addTimer(60, 100); } else { - + _globals._spriteIndexes[20] = _scene->_sequences.startCycle( + _globals._spriteIndexes[5], false, 1); + _globals._spriteIndexes[21] = _scene->_sequences.startReverseCycle( + _globals._spriteIndexes[6], false, 4, 0, 0, 0); + _scene->_sequences.addTimer(160, 70); + _vm->_game->_player._stepEnabled = false; } } else { - // TODO + if (_globals[167] == 0) { + _globals._spriteIndexes[22] = _scene->_sequences.startCycle( + _globals._spriteIndexes[7], false, 1); + } + + if (_globals[164] == 0) { + _globals._spriteIndexes[22] = _scene->_sequences.startCycle( + _globals._spriteIndexes[18], false, 1); + } + + _globals._spriteIndexes[0] = _scene->_sequences.startCycle( + _globals._spriteIndexes[0], false, 1); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[15], Common::Point(133, 139)); + _scene->_sequences.setDepth(_globals._spriteIndexes[15], 8); } + + // TODO: More setup } void Scene804::enter() { diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index 33febe3ec7..23fa0528ab 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -28,28 +28,27 @@ namespace MADS { -SequenceEntry::SequenceEntry() { - _spritesIndex = 0; - _flipped = 0; - _frameIndex = 0; - _frameStart = 0; - _numSprites = 0; - _animType = ANIMTYPE_NONE; - _frameInc = 0; - _depth = 0; - _scale = 0; - _dynamicHotspotIndex = -1; - _triggerCountdown = 0; - _doneFlag = 0; - _entries._count = 0; - _abortMode = ABORTMODE_0; - _actionNouns[0] = _actionNouns[1] = _actionNouns[2] = 0; - _numTicks = 0; - _extraTicks = 0; - _timeout = 0; -} + SequenceEntry::SequenceEntry() { + _spritesIndex = 0; + _flipped = 0; + _frameIndex = 0; + _frameStart = 0; + _numSprites = 0; + _animType = ANIMTYPE_NONE; + _frameInc = 0; + _depth = 0; + _scale = 0; + _dynamicHotspotIndex = -1; + _triggerCountdown = 0; + _doneFlag = 0; + _entries._count = 0; + _abortMode = ABORTMODE_0; + _numTicks = 0; + _extraTicks = 0; + _timeout = 0; + } -/*------------------------------------------------------------------------*/ + /*------------------------------------------------------------------------*/ #define TIMER_LIST_SIZE 30 @@ -126,8 +125,31 @@ int SequenceList::add(int spriteListIndex, bool flipped, int frameIndex, int tri _entries[seqIndex]._entries._count = 0; _entries[seqIndex]._abortMode = _vm->_game->_abortTimersMode2; - for (int i = 0; i < 3; ++i) - _entries[seqIndex]._actionNouns[i] = _actionNouns[i]; + _entries[seqIndex]._actionNouns = _vm->_game->_scene._action._activeAction; + + return seqIndex; +} + +int SequenceList::addTimer(int time, int abortVal) { + int seqIndex; + for (seqIndex = 0; seqIndex < _entries.size(); ++seqIndex) { + if (!_entries[seqIndex]._active) + break; + } + assert(seqIndex < (int)_entries.size()); + + SequenceEntry &se = _entries[seqIndex]; + se._active = true; + se._spritesIndex = -1; + se._numTicks = time; + se._extraTicks = 0; + se._timeout = _vm->_events->_currentTimer + time; + se._triggerCountdown = true; + se._doneFlag = false; + se._entries._count = 0; + se._abortMode = _vm->_game->_abortTimersMode2; + se._actionNouns = _vm->_game->_scene._action._activeAction; + addSubEntry(seqIndex, SM_0, 0, abortVal); return seqIndex; } @@ -368,6 +390,11 @@ void SequenceList::setDepth(int seqIndex, int depth) { _entries[seqIndex]._depth = depth; } +void SequenceList::setMsgPosition(int seqIndex, const Common::Point &pt) { + _entries[seqIndex]._msgPos = pt; + _entries[seqIndex]._nonFixed = false; +} + int SequenceList::addSpriteCycle(int srcSpriteIdx, bool flipped, int numTicks, int triggerCountdown, int timeoutTicks, int extraTicks) { Scene &scene = _vm->_game->_scene; MSprite *spriteFrame = scene._spriteSlots.getSprite(srcSpriteIdx).getFrame(0); @@ -386,4 +413,15 @@ int SequenceList::startCycle(int srcSpriteIndex, bool flipped, int cycleIndex) { return result; } +int SequenceList::startReverseCycle(int srcSpriteIndex, bool flipped, int numTicks, + int triggerCountdown, int timeoutTicks, int extraTicks) { + SpriteAsset *sprites = _vm->_game->_scene._sprites[srcSpriteIndex]; + MSprite *frame = sprites->getFrame(0); + int depth = _vm->_game->_scene._depthSurface.getDepth(Common::Point( + frame->_pos.x + frame->w / 2, frame->_pos.y + frame->h / 2)); + + return add(srcSpriteIndex, flipped, 1, triggerCountdown, timeoutTicks, extraTicks, + numTicks, 0, 0, true, 100, depth - 1, 1, ANIMTYPE_REVERSIBLE, 0, 0); +} + } // End of namespace diff --git a/engines/mads/sequence.h b/engines/mads/sequence.h index 80f695cf5a..85e4f660e5 100644 --- a/engines/mads/sequence.h +++ b/engines/mads/sequence.h @@ -70,7 +70,7 @@ struct SequenceEntry { SequenceSubEntries _entries; AbortTimerMode _abortMode; - uint16 _actionNouns[3]; + ActionDetails _actionNouns; int _numTicks; int _extraTicks; uint32 _timeout; @@ -84,7 +84,6 @@ class SequenceList { private: MADSEngine *_vm; Common::Array _entries; - int _actionNouns[3]; public: SequenceList(MADSEngine *vm); @@ -94,6 +93,7 @@ public: int add(int spriteListIndex, bool flipped, int frameIndex, int triggerCountdown, int delayTicks, int extraTicks, int numTicks, int msgX, int msgY, bool nonFixed, char scale, uint8 depth, int frameInc, SpriteAnimType animType, int numSprites, int frameStart); + int addTimer(int time, int abortVal); void remove(int seqIndex); void setSpriteSlot(int seqIndex, SpriteSlot &spriteSlot); bool loadSprites(int seqIndex); @@ -102,8 +102,11 @@ public: void setAnimRange(int seqIndex, int startVal, int endVal); void scan(); void setDepth(int seqIndex, int depth); + void setMsgPosition(int seqIndex, const Common::Point &pt); int addSpriteCycle(int srcSpriteIdx, bool flipped, int numTicks, int triggerCountdown, int timeoutTicks, int extraTicks); int startCycle(int srcSpriteIdx, bool flipped, int cycleIndex); + int startReverseCycle(int srcSpriteIndex, bool flipped, int numTicks, int triggerCountdown, + int timeoutTicks, int extraTicks); }; } // End of namespace MADS diff --git a/engines/mads/sprites.h b/engines/mads/sprites.h index 2061a41043..598b9e4e3b 100644 --- a/engines/mads/sprites.h +++ b/engines/mads/sprites.h @@ -218,8 +218,6 @@ public: * Adds a sprite asset to the list by name */ int addSprites(const Common::String &resName, int flags = 0); - - int startCycle(int srcSpriteIndex, bool flipped, int cycleIndex); }; } // End of namespace MADS -- cgit v1.2.3 From 3399516c5e4c2931adf76a25944cb3e46f9934ee Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 7 Mar 2014 23:07:36 -0500 Subject: MADS: Implemented remainder of scene 804 setup code and support methods --- engines/mads/animation.cpp | 34 +++++++++++++++++++++--- engines/mads/animation.h | 9 +++++-- engines/mads/game.cpp | 7 ++--- engines/mads/game.h | 5 ++-- engines/mads/interface.cpp | 45 ++++++++++++++++++++++++++++++++ engines/mads/interface.h | 9 +++++++ engines/mads/nebular/nebular_scenes8.cpp | 9 ++++++- engines/mads/scene.cpp | 17 +++++++++--- engines/mads/scene.h | 10 +++++-- engines/mads/sequence.cpp | 2 +- engines/mads/sprites.cpp | 26 ++++++++++++++++++ engines/mads/sprites.h | 19 ++++++++++++++ 12 files changed, 175 insertions(+), 17 deletions(-) diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index d0c7d3079b..588e4eaf36 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -140,6 +140,8 @@ Animation *Animation::init(MADSEngine *vm, Scene *scene) { Animation::Animation(MADSEngine *vm, Scene *scene) : _vm(vm), _scene(scene) { _font = nullptr; _resetFlag = false; + _messageCtr = 0; + _skipLoad = false; } Animation::~Animation() { @@ -298,6 +300,32 @@ void Animation::load(MSurface &depthSurface, InterfaceSurface &interfaceSurface, f.close(); } +void Animation::startAnimation(int abortTimers) { + _messageCtr = 0; + _skipLoad = true; + + if (_header._manualFlag) { + _unkIndex = -1; + //SpriteAsset *asset = _scene->_sprites[_spriteListIndexes[_header._spritesIndex]]; + + // TODO: Weird stuff with _unkList. Seems like it's treated as pointers + // here, but in processText, it's used as POINTs? + + loadFrame(1); + } + + _currentFrame = 0; + _oldFrameEntry = 0; + _nextFrameTimer = _vm->_events->_currentTimer; + _abortTimers = abortTimers; + _abortTimersMode = _vm->_game->_abortTimersMode2; + _vm->_game->_scene._action._activeAction = _actionDetails; + + for (int idx = 0; idx < _header._messagesCount; ++idx) { + _messages[idx]._kernelMsgIndex = -1; + } +} + void Animation::loadFrame(int frameNumber) { Scene &scene = _vm->_game->_scene; if (_skipLoad) @@ -507,11 +535,11 @@ void Animation::update() { // Animation is complete if (_abortTimers != 0) { _vm->_game->_abortTimers = _abortTimers; - _vm->_game->_abortTimersMode = _abortMode; + _vm->_game->_abortTimersMode = _abortTimersMode; - if (_abortMode != ABORTMODE_1) { + if (_abortTimersMode != ABORTMODE_1) { // Copy the noun list - scene._action._action = _actionNouns; + scene._action._action = _actionDetails; } } } diff --git a/engines/mads/animation.h b/engines/mads/animation.h index 8df7b37439..ca04e86ed6 100644 --- a/engines/mads/animation.h +++ b/engines/mads/animation.h @@ -130,8 +130,8 @@ private: uint32 _nextScrollTimer; int _messageCtr; int _abortTimers; - AbortTimerMode _abortMode; - ActionDetails _actionNouns; + AbortTimerMode _abortTimersMode; + ActionDetails _actionDetails; /** * Load data for a given frame @@ -172,6 +172,11 @@ public: void load(MSurface &depthSurface, InterfaceSurface &interfaceSurface, const Common::String &resName, int flags, Common::Array *palAnimData, SceneInfo *sceneInfo); + /** + * Setups up a loaded animation for playback + */ + void startAnimation(int abortTimers); + /** * Update the animation */ diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 962e82ca18..08a5f97a3d 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -58,6 +58,7 @@ Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm), _updateSceneFlag = false; _abortTimersMode = ABORTMODE_0; _abortTimersMode2 = ABORTMODE_0; + _ticksExpiry = 0; } Game::~Game() { @@ -176,7 +177,7 @@ void Game::sectionLoop() { } _vm->_events->initVars(); - _scene._v1A = -1; + _scene._v1A = true; _scene._v1C = -1; _objectHiliteVocabIdx = -1; @@ -230,8 +231,8 @@ void Game::sectionLoop() { _vm->_events->resetCursor(); _v1 = 3; - delete _scene._animation; - _scene._animation = nullptr; + delete _scene._animationData; + _scene._animationData = nullptr; _scene._reloadSceneFlag = false; diff --git a/engines/mads/game.h b/engines/mads/game.h index aa1810963d..143259dc2f 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -66,13 +66,11 @@ protected: SectionHandler *_sectionHandler; VisitedScenes _visitedScenes; Common::StringArray _quotes; - int _v1; int _v3; int _v5; int _v6; bool _updateSceneFlag; bool _playerSpritesFlag; - int _objectHiliteVocabIdx; /** * Constructor @@ -120,6 +118,7 @@ public: int _currentSectionNumber; InventoryObjects _objects; Scene _scene; + int _v1; int _v2; int _v4; int _abortTimers; @@ -128,6 +127,8 @@ public: AbortTimerMode _abortTimersMode2; uint32 _priorFrameTimer; Common::String _aaName; + uint32 _ticksExpiry; + int _objectHiliteVocabIdx; public: virtual ~Game(); diff --git a/engines/mads/interface.cpp b/engines/mads/interface.cpp index fa50cbd1be..e3105614ca 100644 --- a/engines/mads/interface.cpp +++ b/engines/mads/interface.cpp @@ -68,6 +68,47 @@ void InterfaceSurface::load(const Common::String &resName) { delete pixelsStream; } +void InterfaceSurface::setup(int id) { + Scene &scene = _vm->_game->_scene; + + if (scene._screenObjects._v832EC != id) { + Common::String resName = _vm->_game->_aaName; + + // Strip off any extension + const char *p = strchr(resName.c_str(), '.'); + if (p) { + resName = Common::String(resName.c_str(), p - 1); + } + + // Add on suffix if necessary + if (id) + resName += "A"; + + resName += ".INT"; + free(); + load(resName); + } + scene._screenObjects._v832EC = id; + + scene._imageInterEntries.clear(); + scene._imageInterEntries.add(-2, 0xff); + _vm->_game->_ticksExpiry = _vm->_events->getFrameCounter(); + scene._v1A = true; + _vm->_game->_objectHiliteVocabIdx = -1; + scene._v1C = -1; + + // Make a copy of the surface + copyTo(&_surface); + + if (_vm->_game->_v1 == 5) + scene._imageInterEntries.call(0); + + scene._action.clear(); + writeText(); + loadElements(); + scene._dynamicHotspots.refresh(); +} + void InterfaceSurface::elementHighlighted() { warning("TODO: InterfaceSurface::elementHighlighted"); } @@ -81,6 +122,10 @@ void InterfaceSurface::setBounds(const Common::Rect &r) { _bounds = r; } +void InterfaceSurface::loadElements() { + warning("TODO: InterfaceSurface::loadElements"); +} + /*------------------------------------------------------------------------*/ diff --git a/engines/mads/interface.h b/engines/mads/interface.h index 3295fa450e..0d7860b30a 100644 --- a/engines/mads/interface.h +++ b/engines/mads/interface.h @@ -26,17 +26,21 @@ #include "common/scummsys.h" #include "common/rect.h" #include "common/str.h" +#include "mads/msurface.h" namespace MADS { class InterfaceSurface : public MSurface { private: MADSEngine *_vm; + + void loadElements(); public: ScrCategory _category; int _screenObjectsCount; Common::Rect _bounds; Common::Rect *_rectP; + MSurface _surface; public: /** * Constructor @@ -48,6 +52,11 @@ public: */ void load(const Common::String &resName); + /** + * Set up the interface + */ + void setup(int id); + void elementHighlighted(); void writeText(); diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index b3997e110c..caad1e79a7 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -126,7 +126,14 @@ void Scene804::setup() { _scene->_sequences.setDepth(_globals._spriteIndexes[15], 8); } - // TODO: More setup + _scene->loadAnimation(Resources::formatName(804, 'r', 1, EXT_AA, "")); + + Scene8xx::enter1(); + + if (_globals[165] && !_globals[164]) { + _scene->_interface.setup(2); + _vm->_sound->command(19); + } } void Scene804::enter() { diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index bbf46f164c..c7a6edee20 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -46,7 +46,7 @@ Scene::Scene(MADSEngine *vm): _vm(vm), _action(_vm), _depthSurface(vm), _reloadSceneFlag = false; _destFacing = 0; _freeAnimationFlag = false; - _animation = nullptr; + _animationData = nullptr; _activeAnimation = nullptr; _textSpacing = -1; @@ -156,9 +156,9 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) { if (!_vm->_textWindowStill) flags |= 0x200; - _animation = Animation::init(_vm, this); + _animationData = Animation::init(_vm, this); MSurface surface; - _animation->load(surface, _interface, prefix, flags, nullptr, nullptr); + _animationData->load(surface, _interface, prefix, flags, nullptr, nullptr); _vm->_palette->_paletteUsage.load(0); @@ -495,6 +495,17 @@ void Scene::checkKeyboard() { warning("TODO: Scene::checkKeyboard"); } +void Scene::loadAnimation(const Common::String &resName, int abortTimers) { + assert(_activeAnimation == nullptr); + MSurface sceneSurface; + InterfaceSurface interfaceSurface(_vm); + + _activeAnimation = Animation::init(_vm, this); + _activeAnimation->load(sceneSurface, interfaceSurface, resName, + _vm->_game->_v2 ? 1 : 0, nullptr, nullptr); + _activeAnimation->startAnimation(abortTimers); +} + void Scene::free() { warning("TODO: Scene::free"); } diff --git a/engines/mads/scene.h b/engines/mads/scene.h index 3fe3a4eddf..e2aa1098ed 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -94,6 +94,7 @@ public: int _textSpacing; Common::Array _hotspots; ScreenObjects _screenObjects; + ImageInterEntries _imageInterEntries; DirtyAreas _dirtyAreas; int _v1; SceneInfo *_sceneInfo; @@ -107,7 +108,7 @@ public: Common::Array _animPalData; SceneNodeList _nodes; Common::StringArray _vocabStrings; - Animation *_animation; + Animation *_animationData; Animation *_activeAnimation; bool _freeAnimationFlag; int _depthStyle; @@ -115,7 +116,7 @@ public: int _scaleRange; int _interfaceY; int _spritesCount; - int _v1A; + bool _v1A; int _v1C; MADSAction _action; bool _roomChanged; @@ -194,6 +195,11 @@ public: */ void leftClick(); + /** + * Load an animation + */ + void loadAnimation(const Common::String &resName, int abortTimers = 0); + /** * Clear the data for the scene */ diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index 23fa0528ab..93cc9ea39e 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -131,7 +131,7 @@ int SequenceList::add(int spriteListIndex, bool flipped, int frameIndex, int tri } int SequenceList::addTimer(int time, int abortVal) { - int seqIndex; + uint seqIndex; for (seqIndex = 0; seqIndex < _entries.size(); ++seqIndex) { if (!_entries[seqIndex]._active) break; diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp index 321acf026d..9a56ed3895 100644 --- a/engines/mads/sprites.cpp +++ b/engines/mads/sprites.cpp @@ -359,4 +359,30 @@ int SpriteSets::addSprites(const Common::String &resName, int flags) { return add(new SpriteAsset(_vm, resName, flags)); } +/*------------------------------------------------------------------------*/ + +ImageInterEntry::ImageInterEntry() { + _field0 = 0; + _field2 = 0; + _field3 = 0; + _field4 = 0; + _field6 = 0; + _field8 = 0; +} + +/*------------------------------------------------------------------------*/ + +int ImageInterEntries::add(int field0, int field2) { + ImageInterEntry ie; + ie._field0 = field0; + ie._field2 = field2; + + push_back(ie); + return size() - 1; +} + +void ImageInterEntries::call(int v1) { + debug("TODO: ImageInterEntries::call"); +} + } // End of namespace MADS diff --git a/engines/mads/sprites.h b/engines/mads/sprites.h index 598b9e4e3b..b7e63a0d24 100644 --- a/engines/mads/sprites.h +++ b/engines/mads/sprites.h @@ -220,6 +220,25 @@ public: int addSprites(const Common::String &resName, int flags = 0); }; +class ImageInterEntry { +public: + int _field0; + int _field2; + int _field3; + int _field4; + int _field6; + int _field8; + + ImageInterEntry(); +}; + +class ImageInterEntries: public Common::Array { +public: + int add(int field0, int field2); + + void call(int v1); +}; + } // End of namespace MADS #endif /* MADS_SPRITES_H */ -- cgit v1.2.3 From 8bfa5f1da2d84fafdda88aac0cdd5e17ebfbc100 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 8 Mar 2014 08:25:46 -0500 Subject: MADS: Make resource file access case insensitive --- engines/mads/resources.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/resources.cpp b/engines/mads/resources.cpp index 5e490c2719..f85d5ce340 100644 --- a/engines/mads/resources.cpp +++ b/engines/mads/resources.cpp @@ -199,7 +199,7 @@ bool HagArchive::getHeaderEntry(const Common::String &resourceName, Common::List::iterator ei; for (ei = hagIndex._entries.begin(); ei != hagIndex._entries.end(); ++ei) { hagEntry = *ei; - if (hagEntry._resourceName == resName) + if (hagEntry._resourceName.compareToIgnoreCase(resName) == 0) return true; } } -- cgit v1.2.3 From 7310080967d506de91b99611e468c209456b3f81 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 8 Mar 2014 08:26:09 -0500 Subject: MADS: Fix memory leak with conversation font loading --- engines/mads/messages.cpp | 5 ++++- engines/mads/messages.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/engines/mads/messages.cpp b/engines/mads/messages.cpp index aaf6c4100e..69d984313b 100644 --- a/engines/mads/messages.cpp +++ b/engines/mads/messages.cpp @@ -39,6 +39,10 @@ KernelMessages::KernelMessages(MADSEngine *vm): _vm(vm) { word_8469E = 0; } +KernelMessages::~KernelMessages() { + delete _talkFont; +} + void KernelMessages::clear() { Scene &scene = _vm->_game->_scene; @@ -46,7 +50,6 @@ void KernelMessages::clear() { _entries[i]._flags = 0; scene._textSpacing = -1; - _talkFont = _vm->_font->getFont(FONT_CONVERSATION); } int KernelMessages::add(const Common::Point &pt, uint fontColor, uint8 flags, diff --git a/engines/mads/messages.h b/engines/mads/messages.h index 19a0115f94..340f33ef46 100644 --- a/engines/mads/messages.h +++ b/engines/mads/messages.h @@ -75,6 +75,7 @@ public: int word_8469E; public: KernelMessages(MADSEngine *vm); + ~KernelMessages(); void clear(); int add(const Common::Point &pt, uint fontColor, uint8 flags, uint8 abortTimers, -- cgit v1.2.3 From 80bba746406743ab7a7ae6c163c79c652f6d7624 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 8 Mar 2014 08:33:13 -0500 Subject: MADS: Fix sprites loading for scene 804 --- engines/mads/nebular/nebular_scenes8.cpp | 14 +++++++++----- engines/mads/sprites.cpp | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index caad1e79a7..56c3679409 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -75,6 +75,11 @@ void Scene8xx::enter1() { /*------------------------------------------------------------------------*/ void Scene804::setup() { + Scene8xx::setup1(); + Scene8xx::setup2(); +} + +void Scene804::enter() { _globals._chairHotspotIndex = 0; _globals._v1 = _globals._v2 = 0; _globals._v3 = _globals._v4 = 0; @@ -101,7 +106,8 @@ void Scene804::setup() { _globals._spriteIndexes[19] = _scene->_sequences.startCycle( _globals._spriteIndexes[4], 0, 1); _scene->_sequences.addTimer(60, 100); - } else { + } + else { _globals._spriteIndexes[20] = _scene->_sequences.startCycle( _globals._spriteIndexes[5], false, 1); _globals._spriteIndexes[21] = _scene->_sequences.startReverseCycle( @@ -109,7 +115,8 @@ void Scene804::setup() { _scene->_sequences.addTimer(160, 70); _vm->_game->_player._stepEnabled = false; } - } else { + } + else { if (_globals[167] == 0) { _globals._spriteIndexes[22] = _scene->_sequences.startCycle( _globals._spriteIndexes[7], false, 1); @@ -136,9 +143,6 @@ void Scene804::setup() { } } -void Scene804::enter() { -} - void Scene804::step() { } diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp index 9a56ed3895..87a23d1296 100644 --- a/engines/mads/sprites.cpp +++ b/engines/mads/sprites.cpp @@ -347,7 +347,7 @@ int SpriteSets::add(SpriteAsset *asset, int idx) { if (!idx) idx = size(); - if (idx >= (int)(size() + 1)) + if (idx >= (int)size()) resize(idx + 1); delete (*this)[idx]; (*this)[idx] = asset; -- cgit v1.2.3 From 8d3857c0536e47a6a03497346424c111b5bebd7b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 8 Mar 2014 08:44:01 -0500 Subject: MADS: Cleanup code for accessing sprite assets --- engines/mads/animation.cpp | 8 ++++---- engines/mads/messages.cpp | 2 +- engines/mads/scene_data.cpp | 2 +- engines/mads/sequence.cpp | 10 +++++----- engines/mads/sprites.h | 3 --- 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index 588e4eaf36..3508631690 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -332,8 +332,8 @@ void Animation::loadFrame(int frameNumber) { return; Common::Point pt; - int listIndex = _spriteListIndexes[_header._spritesIndex]; - SpriteAsset &spriteSet = scene._spriteSlots.getSprite(listIndex); + int spriteListIndex = _spriteListIndexes[_header._spritesIndex]; + SpriteAsset &spriteSet = *scene._sprites[spriteListIndex]; if (_unkIndex < 0) { MSurface *frame = spriteSet.getFrame(0); @@ -480,8 +480,8 @@ void Animation::update() { slot.copy(_frameEntries[_oldFrameEntry]._spriteSlot); slot._seqIndex = _frameEntries[_oldFrameEntry]._seqIndex + 0x80; - SpriteAsset &spriteSet = scene._spriteSlots.getSprite( - scene._spriteSlots[slotIndex]._spritesIndex); + SpriteAsset &spriteSet = *scene._sprites[ + scene._spriteSlots[slotIndex]._spritesIndex]; slot._spriteType = spriteSet.isBackground() ? ST_BACKGROUND : ST_FOREGROUND; } break; diff --git a/engines/mads/messages.cpp b/engines/mads/messages.cpp index 69d984313b..0e66626bbc 100644 --- a/engines/mads/messages.cpp +++ b/engines/mads/messages.cpp @@ -194,7 +194,7 @@ void KernelMessages::processText(int msgIndex) { if (msg._flags & KMSG_SEQ_ENTRY) { SequenceEntry &seqEntry = scene._sequences[msg._sequenceIndex]; if (!seqEntry._nonFixed) { - SpriteAsset &spriteSet = scene._spriteSlots.getSprite(seqEntry._spritesIndex); + SpriteAsset &spriteSet = *scene._sprites[seqEntry._spritesIndex]; MSprite *frame = spriteSet.getFrame(seqEntry._frameIndex - 1); x1 = frame->getBounds().left; y1 = frame->getBounds().top; diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index c15a3876a8..ed53bca52a 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -193,7 +193,7 @@ void DirtyArea::setSpriteSlot(const SpriteSlot *spriteSlot) { _bounds.left = spriteSlot->_position.x - scene._posAdjust.x; _bounds.top = spriteSlot->_position.y - scene._posAdjust.y; - SpriteAsset &spriteSet = scene._spriteSlots.getSprite(spriteSlot->_spritesIndex); + SpriteAsset &spriteSet = *scene._sprites[spriteSlot->_spritesIndex]; MSprite *frame = spriteSet.getFrame(((spriteSlot->_frameNumber & 0x7fff) - 1) & 0x7f); if (spriteSlot->_scale == -1) { diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index 93cc9ea39e..1e9281090b 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -95,7 +95,7 @@ int SequenceList::add(int spriteListIndex, bool flipped, int frameIndex, int tri if (frameStart <= 0) frameStart = 1; if (numSprites == 0) - numSprites = scene._spriteSlots.getSprite(spriteListIndex).getCount(); + numSprites = scene._sprites[spriteListIndex]->getCount(); if (frameStart == numSprites) frameInc = 0; @@ -169,7 +169,7 @@ void SequenceList::remove(int seqIndex) { void SequenceList::setSpriteSlot(int seqIndex, SpriteSlot &spriteSlot) { Scene &scene = _vm->_game->_scene; SequenceEntry &timerEntry = _entries[seqIndex]; - SpriteAsset &spriteSet = scene._spriteSlots.getSprite(timerEntry._spritesIndex); + SpriteAsset &spriteSet = *scene._sprites[timerEntry._spritesIndex]; spriteSlot._spriteType = spriteSet.isBackground() ? ST_BACKGROUND : ST_FOREGROUND; spriteSlot._seqIndex = seqIndex; @@ -209,7 +209,7 @@ bool SequenceList::loadSprites(int seqIndex) { int x2 = 0, y2 = 0; if ((seqEntry._field13 != 0) || (seqEntry._dynamicHotspotIndex >= 0)) { - SpriteAsset &spriteSet = scene._spriteSlots.getSprite(seqEntry._spritesIndex); + SpriteAsset &spriteSet = *scene._sprites[seqEntry._spritesIndex]; MSprite *frame = spriteSet.getFrame(seqEntry._frameIndex - 1); int width = frame->getWidth() * seqEntry._scale / 200; int height = frame->getHeight() * seqEntry._scale / 100; @@ -340,7 +340,7 @@ void SequenceList::delay(uint32 priorFrameTime, uint32 currentTime) { void SequenceList::setAnimRange(int seqIndex, int startVal, int endVal) { Scene &scene = _vm->_game->_scene; SequenceEntry &seqEntry = _entries[seqIndex]; - SpriteAsset &spriteSet = scene._spriteSlots.getSprite(seqEntry._spritesIndex); + SpriteAsset &spriteSet = *scene._sprites[seqEntry._spritesIndex]; int numSprites = spriteSet.getCount(); int tempStart = startVal, tempEnd = endVal; @@ -397,7 +397,7 @@ void SequenceList::setMsgPosition(int seqIndex, const Common::Point &pt) { int SequenceList::addSpriteCycle(int srcSpriteIdx, bool flipped, int numTicks, int triggerCountdown, int timeoutTicks, int extraTicks) { Scene &scene = _vm->_game->_scene; - MSprite *spriteFrame = scene._spriteSlots.getSprite(srcSpriteIdx).getFrame(0); + MSprite *spriteFrame = scene._sprites[srcSpriteIdx]->getFrame(0); int depth = scene._depthSurface.getDepth(Common::Point(spriteFrame->_pos.x + (spriteFrame->w / 2), spriteFrame->_pos.y + (spriteFrame->h / 2))); diff --git a/engines/mads/sprites.h b/engines/mads/sprites.h index b7e63a0d24..b92a6c22a2 100644 --- a/engines/mads/sprites.h +++ b/engines/mads/sprites.h @@ -176,9 +176,6 @@ public: */ void fullRefresh(bool clearAll = false); - SpriteAsset &getSprite(int idx) { - error("TODO"); - } void deleteTimer(int idx) { warning("TODO: SpriteSlots::deleteTimer"); } -- cgit v1.2.3 From 0f214e4c9d72d088ccf088496710b20576ec73f5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 8 Mar 2014 08:59:10 -0500 Subject: MADS: Fix for loading animation data --- engines/mads/animation.cpp | 7 ++++--- engines/mads/compression.h | 10 ++++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index 3508631690..90f1331d92 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -207,10 +207,11 @@ void Animation::load(MSurface &depthSurface, InterfaceSurface &interfaceSurface, for (int i = 0; i < _header._spriteSetsCount; ++i) _spriteListIndexes.push_back(-1); + int streamIndex = 1; _messages.clear(); if (_header._messagesCount > 0) { // Chunk 2: Following is a list of any messages for the animation - Common::SeekableReadStream *msgStream = madsPack.getItemStream(1); + Common::SeekableReadStream *msgStream = madsPack.getItemStream(streamIndex++); for (int i = 0; i < _header._messagesCount; ++i) { AnimMessage rec; @@ -224,7 +225,7 @@ void Animation::load(MSurface &depthSurface, InterfaceSurface &interfaceSurface, _frameEntries.clear(); if (_header._frameEntriesCount > 0) { // Chunk 3: animation frame info - Common::SeekableReadStream *frameStream = madsPack.getItemStream(2); + Common::SeekableReadStream *frameStream = madsPack.getItemStream(streamIndex++); for (int i = 0; i < _header._frameEntriesCount; i++) { AnimFrameEntry rec; @@ -238,7 +239,7 @@ void Animation::load(MSurface &depthSurface, InterfaceSurface &interfaceSurface, _miscEntries.clear(); if (_header._miscEntriesCount > 0) { // Chunk 4: Misc Data - Common::SeekableReadStream *miscStream = madsPack.getItemStream(3); + Common::SeekableReadStream *miscStream = madsPack.getItemStream(streamIndex++); for (int i = 0; i < _header._miscEntriesCount; ++i) { AnimMiscEntry rec; diff --git a/engines/mads/compression.h b/engines/mads/compression.h index bf690dcc46..aa1f0d9bdc 100644 --- a/engines/mads/compression.h +++ b/engines/mads/compression.h @@ -54,9 +54,15 @@ public: ~MadsPack(); int getCount() const { return _count; } - MadsPackEntry &getItem(int index) const { return _items[index]; } - MadsPackEntry &operator[](int index) const { return _items[index]; } + MadsPackEntry &getItem(int index) const { + assert(index < _count); + return _items[index]; } + MadsPackEntry &operator[](int index) const { + assert(index < _count); + return _items[index]; + } Common::MemoryReadStream *getItemStream(int index) { + assert(index < _count); return new Common::MemoryReadStream(_items[index].data, _items[index].size, DisposeAfterUse::NO); } -- cgit v1.2.3 From 9c88ed16828ef6dde467fc03bb9af8d04b0bb3e2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 8 Mar 2014 10:28:59 -0500 Subject: MADS: Fix loading user interface background --- engines/mads/interface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/interface.cpp b/engines/mads/interface.cpp index e3105614ca..79ae1d7826 100644 --- a/engines/mads/interface.cpp +++ b/engines/mads/interface.cpp @@ -77,7 +77,7 @@ void InterfaceSurface::setup(int id) { // Strip off any extension const char *p = strchr(resName.c_str(), '.'); if (p) { - resName = Common::String(resName.c_str(), p - 1); + resName = Common::String(resName.c_str(), p); } // Add on suffix if necessary -- cgit v1.2.3 From 984099ae2ca9dd53b47e44e7815c560c68acbd61 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 8 Mar 2014 10:53:10 -0500 Subject: MADS: Implemented stubbed SpriteSlots methods --- engines/mads/animation.cpp | 4 ++-- engines/mads/sequence.cpp | 4 ++-- engines/mads/sprites.cpp | 16 +++++++++++++++- engines/mads/sprites.h | 16 +++++++++------- 4 files changed, 28 insertions(+), 12 deletions(-) diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index 90f1331d92..e4549d1054 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -447,7 +447,7 @@ void Animation::update() { int newIndex = -1; if (paChanged) { - newIndex = scene._spriteSlots.getIndex(); + newIndex = scene._spriteSlots.add(); scene._spriteSlots[newIndex]._seqIndex = -1; scene._spriteSlots[newIndex]._spriteType = ST_FULL_SCREEN_REFRESH; } @@ -476,7 +476,7 @@ void Animation::update() { } if (spriteSlotIndex == 0) { - int slotIndex = scene._spriteSlots.getIndex(); + int slotIndex = scene._spriteSlots.add(); SpriteSlot &slot = scene._spriteSlots[slotIndex]; slot.copy(_frameEntries[_oldFrameEntry]._spriteSlot); slot._seqIndex = _frameEntries[_oldFrameEntry]._seqIndex + 0x80; diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index 1e9281090b..ec9c1a8c62 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -202,7 +202,7 @@ bool SequenceList::loadSprites(int seqIndex) { // Doesn't have an associated sprite anymore, so mark as done seqEntry._doneFlag = true; } - else if ((slotIndex = scene._spriteSlots.getIndex()) >= 0) { + else if ((slotIndex = scene._spriteSlots.add()) >= 0) { SpriteSlot &spriteSlot = scene._spriteSlots[slotIndex]; setSpriteSlot(seqIndex, spriteSlot); @@ -377,7 +377,7 @@ void SequenceList::scan() { for (uint i = 0; i < _entries.size(); ++i) { if (!_entries[i]._active && (_entries[i]._spritesIndex != -1)) { - int idx = scene._spriteSlots.getIndex(); + int idx = scene._spriteSlots.add(); setSpriteSlot(i, scene._spriteSlots[idx]); } } diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp index 87a23d1296..82e45deffc 100644 --- a/engines/mads/sprites.cpp +++ b/engines/mads/sprites.cpp @@ -70,7 +70,6 @@ MSprite::MSprite(Common::SeekableReadStream *source, const Common::Point &offset MSprite::~MSprite() { } - // TODO: The sprite outlines (pixel value 0xFD) are not shown void MSprite::loadSprite(Common::SeekableReadStream *source) { byte *outp, *lineStart; @@ -217,6 +216,21 @@ void SpriteSlots::fullRefresh(bool clearAll) { push_back(SpriteSlot(ST_FULL_SCREEN_REFRESH, -1)); } +void SpriteSlots::deleteTimer(int seqIndex) { + for (uint idx = 0; idx < size(); ++idx) { + if ((*this)[idx]._seqIndex == seqIndex) { + remove_at(idx); + return; + } + } +} + +int SpriteSlots::add() { + SpriteSlot ss; + push_back(ss); + return size() - 1; +} + void SpriteSlots::drawBackground() { Scene &scene = _vm->_game->_scene; diff --git a/engines/mads/sprites.h b/engines/mads/sprites.h index b92a6c22a2..2a85115330 100644 --- a/engines/mads/sprites.h +++ b/engines/mads/sprites.h @@ -176,13 +176,15 @@ public: */ void fullRefresh(bool clearAll = false); - void deleteTimer(int idx) { - warning("TODO: SpriteSlots::deleteTimer"); - } - int getIndex() { - warning("TODO: SpriteSlots::indexOf"); - return -1; - } + /** + * Delete a timer entry with the given Id + */ + void deleteTimer(int seqIndex); + + /** + * Add a new slot entry and return it's index + */ + int add(); /** * Draw any sprites into the background of the scene -- cgit v1.2.3 From c2587af8f29b2b79beae7fda5a9b983614840b17 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 8 Mar 2014 14:05:17 -0500 Subject: MADS: Clarified Events::_currentTimer as Scene::_frameStartTime --- engines/mads/animation.cpp | 8 ++++---- engines/mads/events.cpp | 1 - engines/mads/events.h | 1 - engines/mads/game.cpp | 7 +++++-- engines/mads/player.cpp | 6 ++++-- engines/mads/scene.cpp | 3 ++- engines/mads/scene.h | 1 + engines/mads/sequence.cpp | 8 +++++--- 8 files changed, 21 insertions(+), 14 deletions(-) diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index e4549d1054..fad5b27ea7 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -317,7 +317,7 @@ void Animation::startAnimation(int abortTimers) { _currentFrame = 0; _oldFrameEntry = 0; - _nextFrameTimer = _vm->_events->_currentTimer; + _nextFrameTimer = _vm->_game->_scene._frameStartTime; _abortTimers = abortTimers; _abortTimersMode = _vm->_game->_abortTimersMode2; _vm->_game->_scene._action._activeAction = _actionDetails; @@ -402,7 +402,7 @@ void Animation::update() { } // If it's not time for the next frame, then exit - if (_vm->_events->_currentTimer < _nextFrameTimer) + if (_vm->_game->_scene._frameStartTime < _nextFrameTimer) return; for (uint idx = 0; idx < scene._spriteSlots.size(); ++idx) { @@ -546,7 +546,7 @@ void Animation::update() { } int frameNum = MIN(_currentFrame, (int)_miscEntries.size() - 1); - _nextFrameTimer = _vm->_events->_currentTimer + _miscEntries[frameNum]._numTicks; + _nextFrameTimer = _vm->_game->_scene._frameStartTime + _miscEntries[frameNum]._numTicks; } void Animation::setCurrentFrame(int frameNumber) { @@ -554,7 +554,7 @@ void Animation::setCurrentFrame(int frameNumber) { _oldFrameEntry = 0; _freeFlag = false; - _nextScrollTimer = _nextFrameTimer = _vm->_events->_currentTimer; + _nextScrollTimer = _nextFrameTimer = _vm->_game->_scene._frameStartTime; } } // End of namespace MADS diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp index 7fa31d7616..59cdfbfffb 100644 --- a/engines/mads/events.cpp +++ b/engines/mads/events.cpp @@ -41,7 +41,6 @@ EventsManager::EventsManager(MADSEngine *vm) { _keyPressed = false; _mouseClicked = false; _mouseReleased = false; - _currentTimer = 0; _mouseButtons = 0; _vD2 = 0; _vD4 = 0; diff --git a/engines/mads/events.h b/engines/mads/events.h index f30e588bb4..6f716d8083 100644 --- a/engines/mads/events.h +++ b/engines/mads/events.h @@ -60,7 +60,6 @@ public: bool _mouseReleased; byte _mouseButtons; bool _keyPressed; - uint32 _currentTimer; int _vCC; int _vD2; int _vD4; diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 08a5f97a3d..0367aa690f 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -84,6 +84,9 @@ void Game::run() { break; } + // Get the initial starting time for the first scene + _scene._frameStartTime = _vm->_events->getFrameCounter(); + if (_saveSlot == -1 && protectionResult != -1 && protectionResult != -2) { initSection(_sectionNumber); _statusFlag = true; @@ -199,7 +202,7 @@ void Game::sectionLoop() { } _abortTimers = 0; _abortTimersMode2 = ABORTMODE_1; - _priorFrameTimer = _vm->_events->_currentTimer; + _priorFrameTimer = _scene._frameStartTime; // Call the scene logic for entering the given scene _scene._sceneLogic->enter(); @@ -212,7 +215,7 @@ void Game::sectionLoop() { _player.updateFrame(); _player._visible3 = _player._visible; _player._special = _scene.getDepthHighBits(_player._playerPos); - _player._priorTimer = _vm->_events->_currentTimer + _player._ticksAmount; + _player._priorTimer = _scene._frameStartTime + _player._ticksAmount; _player.idle(); warning("TODO: _selectedObject IF block"); diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index d19a0cb93e..ef2ce9f27c 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -94,9 +94,11 @@ void Player::setDest(const Common::Point &pt, int facing) { } void Player::nextFrame() { + Scene &scene = _vm->_game->_scene; + _priorTimer += _ticksAmount; - if (_vm->_events->_currentTimer >= _priorTimer) { - _priorTimer = _vm->_events->_currentTimer; + if (scene._frameStartTime >= _priorTimer) { + _priorTimer = scene._frameStartTime; if (_moving) { move(); } else { diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index c7a6edee20..17c579bddd 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -49,6 +49,7 @@ Scene::Scene(MADSEngine *vm): _vm(vm), _action(_vm), _depthSurface(vm), _animationData = nullptr; _activeAnimation = nullptr; _textSpacing = -1; + _frameStartTime = 0; _verbList.push_back(VerbInit(VERB_LOOK, 2, 0)); _verbList.push_back(VerbInit(VERB_TAKE, 2, 0)); @@ -314,7 +315,7 @@ void Scene::doFrame() { checkStartWalk(); if (!_vm->_game->_abortTimers2) - _vm->_events->_currentTimer = _vm->_events->getFrameCounter(); + _frameStartTime = _vm->_events->getFrameCounter(); if ((_action._inProgress && !player._moving && !_action._startWalkFlag && player._newDirection == player._direction) || diff --git a/engines/mads/scene.h b/engines/mads/scene.h index e2aa1098ed..969fb0b70d 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -124,6 +124,7 @@ public: Common::Point _destPos; int _destFacing; Common::Point _posAdjust; + uint32 _frameStartTime; /** * Constructor diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index ec9c1a8c62..e8c5a37298 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -116,7 +116,7 @@ int SequenceList::add(int spriteListIndex, bool flipped, int frameIndex, int tri _entries[seqIndex]._numTicks = numTicks; _entries[seqIndex]._extraTicks = extraTicks; - _entries[seqIndex]._timeout = _vm->_events->_currentTimer + delayTicks; + _entries[seqIndex]._timeout = scene._frameStartTime + delayTicks; _entries[seqIndex]._triggerCountdown = triggerCountdown; _entries[seqIndex]._doneFlag = false; @@ -131,6 +131,7 @@ int SequenceList::add(int spriteListIndex, bool flipped, int frameIndex, int tri } int SequenceList::addTimer(int time, int abortVal) { + Scene &scene = _vm->_game->_scene; uint seqIndex; for (seqIndex = 0; seqIndex < _entries.size(); ++seqIndex) { if (!_entries[seqIndex]._active) @@ -143,7 +144,7 @@ int SequenceList::addTimer(int time, int abortVal) { se._spritesIndex = -1; se._numTicks = time; se._extraTicks = 0; - se._timeout = _vm->_events->_currentTimer + time; + se._timeout = scene._frameStartTime + time; se._triggerCountdown = true; se._doneFlag = false; se._entries._count = 0; @@ -309,12 +310,13 @@ bool SequenceList::loadSprites(int seqIndex) { * Handles counting down entries in the timer list for action */ void SequenceList::tick() { + Scene &scene = _vm->_game->_scene; for (uint idx = 0; idx < _entries.size(); ++idx) { if ((_vm->_game->_abortTimers2 == 0) && (_vm->_game->_abortTimers != 0)) break; SequenceEntry &seqEntry = _entries[idx]; - uint32 currentTimer = _vm->_events->_currentTimer; + uint32 currentTimer = scene._frameStartTime; if (!seqEntry._active || (currentTimer < seqEntry._timeout)) continue; -- cgit v1.2.3 From 5536b8a933f792f45d08ab5126e826a9a20fa476 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 8 Mar 2014 15:42:07 -0500 Subject: MADS: Fixes for sprite list initialisation --- engines/mads/animation.cpp | 1 + engines/mads/game.cpp | 4 ++-- engines/mads/scene.cpp | 4 ++-- engines/mads/sequence.cpp | 8 +++++--- engines/mads/sprites.cpp | 2 +- engines/mads/sprites.h | 2 +- 6 files changed, 12 insertions(+), 9 deletions(-) diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index fad5b27ea7..2117ae2068 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -271,6 +271,7 @@ void Animation::load(MSurface &depthSurface, InterfaceSurface &interfaceSurface, _spriteSets[i] = nullptr; } else { _spriteSets[i] = new SpriteAsset(_vm, _header._spriteSetNames[i], flags); + _spriteListIndexes[i] = _vm->_game->_scene._sprites.add(_spriteSets[i]); } } diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 0367aa690f..d206823058 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -121,7 +121,7 @@ void Game::gameLoop() { initSection(_sectionNumber); _sectionHandler->postLoadSection(); - _scene._spriteSlots.clear(true); + _scene._spriteSlots.reset(); if (_sectionNumber == _currentSectionNumber) { sectionLoop(); @@ -164,7 +164,7 @@ void Game::sectionLoop() { if (_player._spritesLoaded) _scene._spriteSlots.releasePlayerSprites(); _vm->_palette->resetGamePalette(18, 10); - _scene._spriteSlots.clear(true); + _scene._spriteSlots.reset(); } else { _vm->_palette->initGamePalette(); } diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 17c579bddd..8521c2e0b4 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -126,7 +126,7 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) { if (palFlag) _vm->_palette->resetGamePalette(18, 10); - _spriteSlots.clear(false); + _spriteSlots.reset(false); _sequences.clear(); _kernelMessages.clear(); @@ -166,7 +166,7 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) { _bandsRange = _sceneInfo->_yBandsEnd - _sceneInfo->_yBandsStart; _scaleRange = _sceneInfo->_maxScale - _sceneInfo->_minScale; - _spriteSlots.clear(false); + _spriteSlots.reset(false); _interfaceY = MADS_SCENE_HEIGHT; _spritesCount = _sprites.size(); diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index e8c5a37298..f703ce3b3a 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -50,10 +50,12 @@ namespace MADS { /*------------------------------------------------------------------------*/ -#define TIMER_LIST_SIZE 30 +#define SEQUENCE_LIST_SIZE 30 SequenceList::SequenceList(MADSEngine *vm) : _vm(vm) { - for (int i = 0; i < TIMER_LIST_SIZE; ++i) { + // IMPORTANT: Preallocate timer slots. Note that sprite slots refer to entries + // in this list by index, so we can't just add or delete entries later + for (int i = 0; i < SEQUENCE_LIST_SIZE; ++i) { SequenceEntry rec; rec._active = false; rec._dynamicHotspotIndex = -1; @@ -239,7 +241,7 @@ bool SequenceList::loadSprites(int seqIndex) { if (seqEntry._frameIndex > seqEntry._numSprites) { result = true; if (seqEntry._animType == ANIMTYPE_CYCLED) { - // Reset back to the starting frame (cyclic) + // back to the starting frame (cyclic) seqEntry._frameIndex = seqEntry._frameStart; } else { diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp index 82e45deffc..b18efa223b 100644 --- a/engines/mads/sprites.cpp +++ b/engines/mads/sprites.cpp @@ -168,7 +168,7 @@ SpriteSlots::SpriteSlots(MADSEngine *vm) : _vm(vm) { SpriteSlot::_vm = vm; } -void SpriteSlots::clear(bool flag) { +void SpriteSlots::reset(bool flag) { _vm->_game->_scene._textDisplay.clear(); if (flag) diff --git a/engines/mads/sprites.h b/engines/mads/sprites.h index 2a85115330..0e4e86a273 100644 --- a/engines/mads/sprites.h +++ b/engines/mads/sprites.h @@ -153,7 +153,7 @@ public: * Clears any pending slot data and schedules a full screen refresh. * @param flag Also reset sprite list */ - void clear(bool flag); + void reset(bool flag = true); /** * Delete any sprites used by the player -- cgit v1.2.3 From 8cd85f3a000ab755da7b13c8589d3c67c081122a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 8 Mar 2014 16:06:37 -0500 Subject: MADS: Fixes for drawing scene elements --- engines/mads/messages.cpp | 4 ++-- engines/mads/scene.cpp | 2 +- engines/mads/scene_data.cpp | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/engines/mads/messages.cpp b/engines/mads/messages.cpp index 0e66626bbc..8bdbe72512 100644 --- a/engines/mads/messages.cpp +++ b/engines/mads/messages.cpp @@ -340,7 +340,7 @@ int TextDisplayList::add(int xp, int yp, uint fontColor, int charSpacing, void TextDisplayList::setDirtyAreas() { Scene &scene = _vm->_game->_scene; - for (uint idx = 0, dirtyIdx = DIRTY_AREAS_TEXT_DISPLAY_IDX; dirtyIdx < DIRTY_AREAS_SIZE; ++idx, ++dirtyIdx) { + for (uint idx = 0, dirtyIdx = DIRTY_AREAS_TEXT_DISPLAY_IDX; dirtyIdx < size(); ++idx, ++dirtyIdx) { if (((*this)[idx]._expire >= 0) || !(*this)[idx]._active) scene._dirtyAreas[dirtyIdx]._active = false; else { @@ -353,7 +353,7 @@ void TextDisplayList::setDirtyAreas() { void TextDisplayList::setDirtyAreas2() { Scene &scene = _vm->_game->_scene; - for (uint idx = 0, dirtyIdx = DIRTY_AREAS_TEXT_DISPLAY_IDX; dirtyIdx < DIRTY_AREAS_SIZE; ++idx, ++dirtyIdx) { + for (uint idx = 0, dirtyIdx = DIRTY_AREAS_TEXT_DISPLAY_IDX; idx < size(); ++idx, ++dirtyIdx) { if ((*this)[idx]._active && ((*this)[idx]._expire >= 0)) { scene._dirtyAreas[dirtyIdx].setTextDisplay(&(*this)[idx]); scene._dirtyAreas[dirtyIdx]._textActive = ((*this)[idx]._expire <= 0) ? 0 : 1; diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 8521c2e0b4..11a59356c0 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -422,7 +422,7 @@ void Scene::doFrame() { } // TODO: Verify correctness of frame wait - + _vm->_events->waitForNextFrame(); } void Scene::drawElements(bool transitionFlag, bool surfaceFlag) { diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index ed53bca52a..36efcb31de 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -233,7 +233,6 @@ DirtyAreas::DirtyAreas(MADSEngine *vm) : _vm(vm) { } void DirtyAreas::merge(int startIndex, int count) { - error("TODO: DirtyAreas::merge"); if (startIndex >= count) return; -- cgit v1.2.3 From c89193f24f252cf1a7f744f2712218b6808370fc Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 8 Mar 2014 18:12:06 -0500 Subject: MADS: Removed old RGBList code from old M4 engine --- engines/mads/font.cpp | 3 +- engines/mads/msurface.cpp | 2 +- engines/mads/palette.cpp | 116 ---------------------------------------------- engines/mads/palette.h | 81 -------------------------------- 4 files changed, 3 insertions(+), 199 deletions(-) diff --git a/engines/mads/font.cpp b/engines/mads/font.cpp index 0ff01905ce..b8f8187fc7 100644 --- a/engines/mads/font.cpp +++ b/engines/mads/font.cpp @@ -30,11 +30,12 @@ namespace MADS { Font::Font(MADSEngine *vm) : _vm(vm) { _sysFont = true; - + /* _fontColors[0] = _vm->_palette->BLACK; _fontColors[1] = _vm->_palette->WHITE; _fontColors[2] = _vm->_palette->BLACK; _fontColors[3] = _vm->_palette->DARK_GRAY; + */ } Font::~Font() { diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp index 74043bf91f..3a38360bfe 100644 --- a/engines/mads/msurface.cpp +++ b/engines/mads/msurface.cpp @@ -196,7 +196,7 @@ void MSurface::drawSprite(const Common::Point &pt, SpriteInfo &info, const Commo } void MSurface::empty() { - Common::fill(getBasePtr(0, 0), getBasePtr(0, h), _vm->_palette->BLACK); + Common::fill(getBasePtr(0, 0), getBasePtr(0, h), 0); } void MSurface::copyFrom(MSurface *src, const Common::Rect &srcBounds, diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index 4568f7d39a..a0e58ca54b 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -37,28 +37,6 @@ void RGB6::load(Common::SeekableReadStream *f) { flags = f->readByte(); } -RGBList::RGBList(int numEntries, byte *srcData, bool freeData) { - _size = numEntries; - assert(numEntries <= PALETTE_COUNT); - - if (srcData == NULL) { - _data = new byte[numEntries * 3]; - _freeData = true; - } else { - _data = srcData; - _freeData = freeData; - } - - _palIndexes = new byte[numEntries]; - Common::fill(&_palIndexes[0], &_palIndexes[numEntries], 0); -} - -RGBList::~RGBList() { - if (_freeData) - delete[] _data; - delete[] _palIndexes; -} - /*------------------------------------------------------------------------*/ PaletteUsage::PaletteUsage() { @@ -220,97 +198,6 @@ uint8 Palette::palIndexFromRgb(byte r, byte g, byte b, byte *paletteData) { } void Palette::reset() { - byte palData[PALETTE_SIZE]; - g_system->getPaletteManager()->grabPalette(palData, 0, PALETTE_COUNT); - - BLACK = palIndexFromRgb(0, 0, 0, palData); - BLUE = palIndexFromRgb(0, 0, 255, palData); - GREEN = palIndexFromRgb(0, 255, 0, palData); - CYAN = palIndexFromRgb(0, 255, 255, palData); - RED = palIndexFromRgb(255, 0, 0, palData); - VIOLET = palIndexFromRgb(255, 0, 255, palData); - BROWN = palIndexFromRgb(168, 84, 84, palData); - LIGHT_GRAY = palIndexFromRgb(168, 168, 168, palData); - DARK_GRAY = palIndexFromRgb(84, 84, 84, palData); - LIGHT_BLUE = palIndexFromRgb(0, 0, 127, palData); - LIGHT_GREEN = palIndexFromRgb(0, 127, 0, palData); - LIGHT_CYAN = palIndexFromRgb(0, 127, 127, palData); - LIGHT_RED = palIndexFromRgb(84, 0, 0, palData); - PINK = palIndexFromRgb(84, 0, 0, palData); - YELLOW = palIndexFromRgb(0, 84, 84, palData); - WHITE = palIndexFromRgb(255, 255, 255, palData); -} - -void Palette::resetColorCounts() { - Common::fill(&_usageCount[0], &_usageCount[PALETTE_COUNT], 0); -} - -void Palette::blockRange(int startIndex, int size) { - // Use a reference count of -1 to signal a palette index shouldn't be used - Common::fill(&_usageCount[startIndex], &_usageCount[startIndex + size], -1); -} - -void Palette::addRange(RGBList *list) { - byte *data = list->data(); - byte *palIndexes = list->palIndexes(); - byte palData[PALETTE_COUNT]; - g_system->getPaletteManager()->grabPalette(palData, 0, PALETTE_COUNT); - bool paletteChanged = false; - - for (int colIndex = 0; colIndex < list->size(); ++colIndex) { - // Scan through for an existing copy of the RGB value - int palIndex = -1; - while (++palIndex < PALETTE_COUNT) { - if (_usageCount[palIndex] <= 0) - // Palette index is to be skipped - continue; - - if ((palData[palIndex * 3] == data[colIndex * 3]) && - (palData[palIndex * 3 + 1] == data[colIndex * 3 + 1]) && - (palData[palIndex * 3 + 2] == data[colIndex * 3 + 2])) - // Match found - break; - } - - if (palIndex == PALETTE_COUNT) { - // No match found, so find a free slot to use - palIndex = -1; - while (++palIndex < PALETTE_COUNT) { - if (_usageCount[palIndex] == 0) - break; - } - - if (palIndex == PALETTE_COUNT) - error("addRange - Ran out of palette space to allocate"); - - palData[palIndex * 3] = data[colIndex * 3]; - palData[palIndex * 3 + 1] = data[colIndex * 3 + 1]; - palData[palIndex * 3 + 2] = data[colIndex * 3 + 2]; - paletteChanged = true; - } - - palIndexes[colIndex] = palIndex; - ++_usageCount[palIndex]; - } - - if (paletteChanged) { - g_system->getPaletteManager()->setPalette(&palData[0], 0, 256); - reset(); - } -} - -void Palette::deleteRange(RGBList *list) { - // Release the reference count on each of the palette entries - for (int colIndex = 0; colIndex < list->size(); ++colIndex) { - int palIndex = list->palIndexes()[colIndex]; - assert(_usageCount[palIndex] > 0); - --_usageCount[palIndex]; - } -} - -void Palette::deleteAllRanges() { - for (int colIndex = 0; colIndex < 255; ++colIndex) - _usageCount[colIndex] = 0; } void Palette::setGradient(byte *palette, int start, int count, int rgbValue1, int rgbValue2) { @@ -373,8 +260,6 @@ int Palette::loadPalette(Common::SeekableReadStream *palStream, int indexStart) } void Palette::setSystemPalette() { - resetColorCounts(); - byte palData[4 * 3]; palData[0 * 3] = palData[0 * 3 + 1] = palData[0 * 3 + 2] = 0; palData[1 * 3] = palData[1 * 3 + 1] = palData[1 * 3 + 2] = 0x54; @@ -382,7 +267,6 @@ void Palette::setSystemPalette() { palData[3 * 3] = palData[3 * 3 + 1] = palData[3 * 3 + 2] = 0xff; setPalette(palData, 0, 4); - blockRange(0, 4); } void Palette::resetGamePalette(int lowRange, int highRange) { diff --git a/engines/mads/palette.h b/engines/mads/palette.h index a00e1789f4..d85e25b8b6 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -50,42 +50,6 @@ struct RGB6 { void load(Common::SeekableReadStream *f); }; -/** - * Used to store a list of RGB values - */ -class RGBList { -private: - int _size; - byte *_data; - byte *_palIndexes; - bool _freeData; -public: - /** - * Constructor - */ - RGBList(int numEntries = 256, byte *srcData = NULL, bool freeData = true); - - /** - * Destructor - */ - ~RGBList(); - - /** - * Returns the raw data containing the RGB values as 3 bytes per entry - */ - byte *data() { return _data; } - - /** - * Returns the list of palette indexes each RGB tuple maps to in the current palette - */ - byte *palIndexes() { return _palIndexes; } - - /** - * Returns the size of the palette - */ - int size() const { return _size; } -}; - class PaletteUsage { private: Common::Array _data; @@ -180,33 +144,6 @@ public: */ uint8 palIndexFromRgb(byte r, byte g, byte b, byte *paletteData = nullptr); - // Methods used for reference counting color usage - /** - * Resets the usage counts for the palette - */ - void resetColorCounts(); - - /** - * Blocks out a range of the palette from being used - */ - void blockRange(int startIndex, int size); - - /** - * Adds the data of an RGBList into the current palette and increment usage counts. - */ - void addRange(RGBList *list); - - /** - * Delets a range from the current palette, dercementing the accompanying usage counts. - */ - void deleteRange(RGBList *list); - - /** - * Deletes all loaded RGB lists are their usage references. - */ - void deleteAllRanges(); - - // Virtual method table /** * Decode a palette and return it, without affecting the Palette itself */ @@ -248,24 +185,6 @@ public: void close() { warning("TODO: Palette::close"); } - - // Color indexes - uint8 BLACK; - uint8 BLUE; - uint8 GREEN; - uint8 CYAN; - uint8 RED; - uint8 VIOLET; - uint8 BROWN; - uint8 LIGHT_GRAY; - uint8 DARK_GRAY; - uint8 LIGHT_BLUE; - uint8 LIGHT_GREEN; - uint8 LIGHT_CYAN; - uint8 LIGHT_RED; - uint8 PINK; - uint8 YELLOW; - uint8 WHITE; }; } // End of namespace MADS -- cgit v1.2.3 From 680b5a4487a6c1b08f79c4a657b63715e69240de Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 10 Mar 2014 00:00:39 -0400 Subject: MADS: In progress implementation of PaletteUsage::process --- engines/mads/assets.cpp | 1 + engines/mads/assets.h | 1 + engines/mads/game.cpp | 7 +- engines/mads/graphics.cpp | 45 +++++++- engines/mads/graphics.h | 25 ++++- engines/mads/interface.cpp | 2 +- engines/mads/mads.cpp | 2 +- engines/mads/msurface.cpp | 2 +- engines/mads/msurface.h | 2 +- engines/mads/palette.cpp | 257 +++++++++++++++++++++++++++++++++++++++++++-- engines/mads/palette.h | 70 +++++++++--- engines/mads/scene.cpp | 13 ++- engines/mads/scene.h | 3 +- engines/mads/sprites.cpp | 2 +- engines/mads/sprites.h | 2 +- 15 files changed, 390 insertions(+), 44 deletions(-) diff --git a/engines/mads/assets.cpp b/engines/mads/assets.cpp index ebedeb8141..554cd9ad48 100644 --- a/engines/mads/assets.cpp +++ b/engines/mads/assets.cpp @@ -54,6 +54,7 @@ void SpriteAsset::load(Common::SeekableReadStream *stream, int flags) { _pixelSpeed = 0; _maxWidth = 0; _maxHeight = 0; + _field6 = -1; Common::SeekableReadStream *spriteStream = sprite.getItemStream(0); _mode = spriteStream->readByte(); diff --git a/engines/mads/assets.h b/engines/mads/assets.h index 30676a1d7e..c0d1feb883 100644 --- a/engines/mads/assets.h +++ b/engines/mads/assets.h @@ -77,6 +77,7 @@ private: void load(Common::SeekableReadStream *stream, int flags); public: SpriteSetCharInfo *_charInfo; + int _field6; public: /** * Constructor diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index d206823058..e0d3ca1914 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -191,15 +191,16 @@ void Game::sectionLoop() { switch (_vm->_screenFade) { case SCREEN_FADE_SMOOTH: - _abortTimers2 = 2; + _abortTimers2 = kTransitionFadeOutIn; break; case SCREEN_FADE_FAST: - _abortTimers2 = 20; + _abortTimers2 = kCenterVertTransition; break; default: - _abortTimers2 = 21; + _abortTimers2 = kTransitionNone; break; } + _abortTimers = 0; _abortTimersMode2 = ABORTMODE_1; _priorFrameTimer = _scene._frameStartTime; diff --git a/engines/mads/graphics.cpp b/engines/mads/graphics.cpp index f4d788fea5..769b4dd2d2 100644 --- a/engines/mads/graphics.cpp +++ b/engines/mads/graphics.cpp @@ -22,7 +22,9 @@ #include "common/scummsys.h" #include "mads/mads.h" +#include "mads/game.h" #include "mads/graphics.h" +#include "mads/palette.h" namespace MADS { @@ -35,8 +37,41 @@ void ScreenSurface::updateScreen() { g_system->updateScreen(); } -void ScreenSurface::transition(bool transitionFlag, bool surfaceFlag) { +void ScreenSurface::transition(ScreenTransition transitionType, bool surfaceFlag) { + switch (transitionType) { + case kTransitionFadeOutIn: + fadeOut(); + fadeIn(); + break; + case kTransitionFadeIn: + fadeIn(); + break; + + case kTransitionBoxInBottomLeft: + case kTransitionBoxInBottomRight: + case kTransitionBoxInTopLeft: + case kTransitionBoxInTopRight: + error("TODO: transition"); + break; + + case kTransitionPanLeftToRight: + case kTransitionPanRightToLeft: + error("TODO: transition"); + + case kTransitionCircleIn1: + case kTransitionCircleIn2: + case kTransitionCircleIn3: + case kTransitionCircleIn4: + error("TODO circle transition"); + + case kCenterVertTransition: + error("TODO: center vert transition"); + + default: + // Quick transitions + break; + } } void ScreenSurface::setPointer(MSurface *s) { @@ -44,5 +79,13 @@ void ScreenSurface::setPointer(MSurface *s) { _pitch = s->w; } +void ScreenSurface::fadeOut() { + warning("TODO: Proper fade out"); +} + +void ScreenSurface::fadeIn() { + warning("TODO: Proper fade in"); + _vm->_palette->setFullPalette(_vm->_palette->_mainPalette); +} } // End of namespace MADS diff --git a/engines/mads/graphics.h b/engines/mads/graphics.h index b64bced245..d4933ae68d 100644 --- a/engines/mads/graphics.h +++ b/engines/mads/graphics.h @@ -32,7 +32,30 @@ namespace MADS { #define MADS_SCREEN_WIDTH 320 #define MADS_SCREEN_HEIGHT 200 +enum ScreenTransition { + kTransitionNone = 0, + kTransitionFadeIn, kTransitionFadeOutIn, + kTransitionBoxInBottomLeft, kTransitionBoxInBottomRight, + kTransitionBoxInTopLeft, kTransitionBoxInTopRight, + kTransitionPanLeftToRight, kTransitionPanRightToLeft, + kTransitionCircleIn1, kTransitionCircleIn2, + kTransitionCircleIn3, kTransitionCircleIn4, + kVertTransition1, kVertTransition2, kVertTransition3, + kVertTransition4, kVertTransition5, kVertTransition6, + kVertTransition7, kCenterVertTransition +}; + class ScreenSurface : public MSurface { +private: + /** + * Handles screen fade out + */ + void fadeOut(); + + /** + * Handles screen fade in + */ + void fadeIn(); public: Common::Point _offset; byte *_pixels; @@ -55,7 +78,7 @@ public: */ void updateScreen(); - void transition(bool transitionFlag, bool surfaceFlag); + void transition(ScreenTransition transitionType, bool surfaceFlag); }; } // End of namespace MADS diff --git a/engines/mads/interface.cpp b/engines/mads/interface.cpp index 79ae1d7826..cd2f162cf3 100644 --- a/engines/mads/interface.cpp +++ b/engines/mads/interface.cpp @@ -101,7 +101,7 @@ void InterfaceSurface::setup(int id) { copyTo(&_surface); if (_vm->_game->_v1 == 5) - scene._imageInterEntries.call(0); + scene._imageInterEntries.call(0, 0); scene._action.clear(); writeText(); diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index c6d2e2ec26..0327a9fc67 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -41,7 +41,7 @@ MADSEngine::MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc) : _easyMouse = true; _invObjectStill = false; _textWindowStill = false; - _screenFade = SCREEN_FADE_FAST; + _screenFade = SCREEN_FADE_SMOOTH; _musicFlag = false; _debugger = nullptr; diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp index 3a38360bfe..f21836eb09 100644 --- a/engines/mads/msurface.cpp +++ b/engines/mads/msurface.cpp @@ -478,7 +478,7 @@ void MSurface::translate(Common::Array &palette) { byte *pDest = getBasePtr(0, y); for (int x = 0; x < this->w; ++x, ++pDest) { - *pDest = palette[*pDest].palIndex; + *pDest = palette[*pDest]._palIndex; } } } diff --git a/engines/mads/msurface.h b/engines/mads/msurface.h index 96994170aa..d5b8741188 100644 --- a/engines/mads/msurface.h +++ b/engines/mads/msurface.h @@ -50,7 +50,7 @@ struct SpriteInfo { * MADS graphics surface */ class MSurface : public Graphics::Surface { -private: +protected: static MADSEngine *_vm; public: /** diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index a0e58ca54b..da59707a91 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -32,14 +32,15 @@ void RGB6::load(Common::SeekableReadStream *f) { r = f->readByte(); g = f->readByte(); b = f->readByte(); - palIndex = f->readByte(); - u2 = f->readByte(); - flags = f->readByte(); + _palIndex = f->readByte(); + _u2 = f->readByte(); + _flags = f->readByte(); } /*------------------------------------------------------------------------*/ -PaletteUsage::PaletteUsage() { +PaletteUsage::PaletteUsage(MADSEngine *vm) { + _vm = vm; } void PaletteUsage::load(int count, ...) { @@ -58,7 +59,7 @@ void PaletteUsage::getKeyEntries(Common::Array &palette) { _data.clear(); for (uint i = 0; i < palette.size(); ++i) { - byte *uPtr = &palette[i].flags; + byte *uPtr = &palette[i]._flags; if ((*uPtr & 0x10) && _data.size() < 3) { _data.push_back(i); } @@ -76,6 +77,124 @@ void PaletteUsage::prioritize(Common::Array &palette) { prioritizeFromList(lst); } +int PaletteUsage::process(Common::Array &palette, int v) { + byte *palette1 = nullptr, *palette2 = nullptr; + int palLow; + int palHigh = (v & 0x800) ? 0x100 : 0xC; + int palIdx; + assert(v >= 0); + + if (v & 0x4000) { + palLow = 0; + palIdx = palHigh; + } else { + palLow = _vm->_palette->_lowRange; + if ((PALETTE_COUNT - _vm->_palette->_highRange) > palHigh) { + palIdx = palHigh; + } else { + palIdx = PALETTE_COUNT - _vm->_palette->_highRange; + } + } + + int rgbIndex = _vm->_palette->_rgbList.scan(); + uint32 rgbMask = 1 << rgbIndex; + int varA = v & 0x8000; + bool hasUsage = !_vm->_palette->_paletteUsage.empty(); + bool flag1 = false; + + if (hasUsage) { + if (varA || !_vm->_palette->_paletteUsage[0]) + hasUsage = false; + + if (varA && _vm->_palette->_paletteUsage[0]) + flag1 = true; + } + + if (hasUsage) { + getKeyEntries(palette); + prioritize(palette); + } + + int freeIndex; + int palCount = getGamePalFreeIndex(&freeIndex); + byte *pal1 = new byte[PALETTE_COUNT]; + byte *pal2 = new byte[PALETTE_COUNT]; + + for (uint palIndex = 0; palIndex < palette.size(); ++palIndex) { + pal2[palIndex] = palIndex; + pal1[palIndex] = 0; + + if (!(palette[palIndex]._flags & 0x80)) { + pal1[palIndex] = 0x40; + } + if (!(palette[palIndex]._flags & 0x60)) { + pal1[palIndex] |= 0x20; + } + } + + _vm->_palette->processLists(palette.size(), pal1, pal2); + + int var3A = (v & 0x4000) ? 0xffff : 0xfffe; + + for (uint palIndex = 0; palIndex < palette.size(); ++palIndex) { + bool var48 = false; + int var4 = 0xffff; + int v1 = pal1[palIndex]; + + if (palette[v1]._flags & 8) { + var48 = true; + var4 = 0xFD; + } + + if (hasUsage && palette[v1]._flags & 0x10) { + for (uint usageIndex = 0; usageIndex < _data.size() && !var48; ++usageIndex) { + if (_data[usageIndex] == palIndex) { + var48 = true; + int dataIndex = MIN(usageIndex, _data.size() - 1); + var4 = _data[dataIndex]; + } + } + } + + if (flag1 && palette[palIndex]._flags & 0x10) { + for (uint usageIndex = 0; usageIndex < _data.size() && !var48; ++usageIndex) { + if (_data[usageIndex] == palIndex) { + var48 = true; + var4 = 0xF0 + usageIndex; + + // Copy data into the high end of the main palette + RGB6 &pSrc = palette[palIndex]; + byte *pDest = &_vm->_palette->_mainPalette[var4 * 3]; + pDest[0] = pSrc.r; + pDest[1] = pSrc.g; + pDest[2] = pSrc.b; + } + } + } + + if (!var48 && !varA) { + int var2 = !(palette[palIndex]._flags & 0x20) && ( + ((v & 0x2000) && !(palette[palIndex]._flags & 0x40)) || + ((v & 0x1000) && (palCount > 0)) + ) ? 1 : 0x7fff; + int var36 = (palette[palIndex]._flags & 0x80) ? 0 : 2; + + for (int idx = palLow; idx < palIdx; ++idx) { + // TODO + } + } + //TODO + } + + _vm->_palette->_rgbList[rgbIndex] = 0xffff; + + delete[] pal1; + delete[] pal2; + + return rgbIndex; +} + + int PaletteUsage::rgbMerge(RGB6 &palEntry) { return palEntry.r * 38 + palEntry.g * 76 + palEntry.b * 14; } @@ -137,19 +256,56 @@ void PaletteUsage::transform(Common::Array &palette) { if (!empty()) { for (uint i = 0; i < _data.size(); ++i) { int palIndex = _data[i]; - _data[i] = palette[palIndex].palIndex; + _data[i] = palette[palIndex]._palIndex; + } + } +} + +int PaletteUsage::getGamePalFreeIndex(int *palIndex) { + *palIndex = -1; + int count = 0; + + for (int i = 0; i < PALETTE_COUNT; ++i) { + RGB4 &r = _vm->_palette->_gamePalette[i]; + if (!(r.r | r.g | r.b | r.u)) { + ++count; + if (*palIndex < 0) + *palIndex = i; } } + + return count; +} + +/*------------------------------------------------------------------------*/ + +void RGBList::clear() { + Common::fill(&_data[0], &_data[32], 0); +} + +void RGBList::reset() { + Common::fill(&_data[2], &_data[32], 0); +} + +int RGBList::scan() { + for (int i = 0; i < 32; ++i) { + if (!_data[i]) + return i; + } + + error("List was full"); } /*------------------------------------------------------------------------*/ #define VGA_COLOR_TRANS(x) (x == 0x3f ? 255 : x << 2) -Palette::Palette(MADSEngine *vm) : _vm(vm) { +Palette::Palette(MADSEngine *vm) : _vm(vm), _paletteUsage(vm) { reset(); - _fading_in_progress = false; - Common::fill(&_usageCount[0], &_usageCount[PALETTE_COUNT], 0); + + _v1 = 0; + _lowRange = 0; + _highRange = 0; Common::fill(&_mainPalette[0], &_mainPalette[PALETTE_SIZE], 0); } @@ -228,6 +384,49 @@ void Palette::setGradient(byte *palette, int start, int count, int rgbValue1, in } } +void Palette::processLists(int count, byte *pal1, byte *pal2) { + bool continueFlag; + int endIndex = count - 1; + + do { + continueFlag = false; + + for (int palIndex = 0; palIndex < endIndex && !continueFlag; ++palIndex) { + byte *palP = &pal1[palIndex]; + byte *pal2P = &pal2[palIndex]; + + if (palP[1] < palP[0]) { + int v1 = palP[0]; + int v2 = pal2P[0]; + + int size = count - palIndex - 1; + if (size > 0) { + Common::copy(palP + 1, palP + size + 1, palP); + Common::copy(pal2P + 1, pal2P + size + 1, pal2P); + } + + int idx; + for (idx = 0; idx < endIndex && !continueFlag; ++idx) { + if (pal1[idx] > v1) + continueFlag = true; + } + continueFlag = true; + + int size2 = count - idx - 1; + if (size2 > 0) { + Common::copy(palP + idx, palP + idx + size2 + 1, palP); + Common::copy(pal2P + idx, pal2P + idx + size2 + 1, pal2P); + } + + pal1[idx] = v1; + pal2[idx] = v2; + } + } + + } while (continueFlag); +} + + byte *Palette::decodePalette(Common::SeekableReadStream *palStream, int *numColors) { *numColors = palStream->readUint16LE(); assert(*numColors <= 252); @@ -288,10 +487,43 @@ void Palette::resetGamePalette(int lowRange, int highRange) { Common::fill(&_gamePalette[255 - highRange], &_gamePalette[254], _gamePalette[255]); } + + _rgbList.clear(); + _v1 = 0; + _lowRange = lowRange; + _highRange = highRange; } void Palette::initGamePalette() { - // TODO + RGB4 rgb; + rgb.r = 1; + + if (_vm->_game->_player._spritesLoaded && _vm->_game->_player._numSprites) { + + for (int idx = 0; idx < _vm->_game->_player._numSprites; ++idx) { + SpriteAsset *asset = _vm->_game->_scene._sprites[ + _vm->_game->_player._spritesStart + idx]; + + uint32 mask = 1; + if (asset->_field6) + mask <<= asset->_field6; + + rgb.r = mask & 0xff; + rgb.g = (mask >> 8) & 0xff; + rgb.b = (mask >> 16) & 0xff; + rgb.u = (mask >> 24) & 0xff; + } + } + + for (int idx = 0; idx < PALETTE_COUNT; ++idx) { + _gamePalette[idx].r &= rgb.r; + _gamePalette[idx].g &= rgb.g; + _gamePalette[idx].b &= rgb.b; + _gamePalette[idx].u &= rgb.u; + } + + _v1 = 0; + _rgbList.reset(); } void Palette::initRange(byte *palette) { @@ -337,4 +569,9 @@ void Palette::setLowRange() { _vm->_palette->setPalette(_mainPalette, 0, 4); } +void Palette::fadeOut(byte palette[PALETTE_SIZE], int v1, int v2, int v3, int v4, int v5, int v6) { + +} + + } // End of namespace MADS diff --git a/engines/mads/palette.h b/engines/mads/palette.h index d85e25b8b6..83e406a229 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -37,28 +37,36 @@ struct RGB4 { byte g; byte b; byte u; + + RGB4() { r = g = b = u = 0; } }; struct RGB6 { byte r; byte g; byte b; - byte palIndex; - byte u2; - byte flags; + byte _palIndex; + byte _u2; + byte _flags; void load(Common::SeekableReadStream *f); }; class PaletteUsage { private: - Common::Array _data; + MADSEngine *_vm; + Common::Array _data; int rgbMerge(RGB6 &palEntry); void prioritizeFromList(int lst[3]); + + int getGamePalFreeIndex(int *palIndex); public: - PaletteUsage(); + /** + * Constructor + */ + PaletteUsage(MADSEngine *vm); void load(int count, ...); @@ -67,6 +75,8 @@ public: */ bool empty() const { return _data.size() == 0; } + uint16 &operator[](int index) { return _data[index]; } + /** * Gets key entries from the passed palette * @param palette 6-bit per entry read in palette @@ -79,14 +89,28 @@ public: */ void prioritize(Common::Array &palette); - bool process(Common::Array &palette, int v) { - warning("TODO: PaletteUsage::process"); - return 0; - } + int process(Common::Array &palette, int v); void transform(Common::Array &palette); }; +class RGBList { +private: + uint16 _data[32]; +public: + RGBList() { clear(); } + + void clear(); + + void reset(); + + /** + * Scans for a free slot + */ + int scan(); + + uint16 &operator[](int idx) { return _data[idx]; } +}; #define PALETTE_COUNT 256 #define PALETTE_SIZE (256 * 3) @@ -99,12 +123,6 @@ private: void initRange(byte *palette); protected: MADSEngine *_vm; - bool _colorsChanged; - - bool _fading_in_progress; - byte _originalPalette[PALETTE_COUNT * 4]; - byte _fadedPalette[PALETTE_COUNT * 4]; - int _usageCount[PALETTE_COUNT]; void reset(); public: @@ -112,6 +130,10 @@ public: byte _savedPalette[PALETTE_SIZE]; RGB4 _gamePalette[PALETTE_COUNT]; PaletteUsage _paletteUsage; + RGBList _rgbList; + int _v1; + int _lowRange; + int _highRange; public: /** * Constructor @@ -138,6 +160,20 @@ public: */ void grabPalette(byte *colors, uint start, uint num); + /** + * Gets the entire palette at once + */ + void getFullPalette(byte palette[PALETTE_SIZE]) { + grabPalette(&palette[0], 0, PALETTE_COUNT); + } + + /** + * Sets the entire palette at once + */ + void setFullPalette(byte palette[PALETTE_SIZE]) { + setPalette(&palette[0], 0, PALETTE_COUNT); + } + /** * Returns the palette index in the palette that most closely matches the * specified RGB pair @@ -164,6 +200,8 @@ public: */ static void setGradient(byte *palette, int start, int count, int rgbValue1, int rgbValue2); + static void processLists(int count, byte *pal1, byte *pal2); + /** * Resets the game palette */ @@ -185,6 +223,8 @@ public: void close() { warning("TODO: Palette::close"); } + + void fadeOut(byte palette[PALETTE_SIZE], int v1, int v2, int v3, int v4, int v5, int v6); }; } // End of namespace MADS diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 11a59356c0..15577971e0 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -384,16 +384,15 @@ void Scene::doFrame() { _kernelMessages.update(); } - _vm->_game->_abortTimers2 = !_vm->_game->_abortTimers2; - - warning("TODO: image_inter_list_call"); + _imageInterEntries.call(_vm->_game->_abortTimers2 == kTransitionFadeIn ? 0xff : 0, + _vm->_game->_abortTimers2); // Write any text needed by the interface if (_vm->_game->_abortTimers2) _interface.writeText(); // Draw any elements - drawElements(_vm->_game->_abortTimers2, _vm->_game->_abortTimers2); + drawElements((ScreenTransition)_vm->_game->_abortTimers2, _vm->_game->_abortTimers2); // Handle message updates if (_vm->_game->_abortTimers2) { @@ -425,7 +424,7 @@ void Scene::doFrame() { _vm->_events->waitForNextFrame(); } -void Scene::drawElements(bool transitionFlag, bool surfaceFlag) { +void Scene::drawElements(ScreenTransition transitionType, bool surfaceFlag) { // Draw any sprites _spriteSlots.drawBackground(); @@ -455,9 +454,9 @@ void Scene::drawElements(bool transitionFlag, bool surfaceFlag) { _interface.setBounds(Common::Rect(_vm->_screen._offset.x, _vm->_screen._offset.y, _vm->_screen._offset.x + _vm->_screen.w, _vm->_screen._offset.y + _vm->_screen.h)); - if (transitionFlag) { + if (transitionType) { // Fading in the screen - _vm->_screen.transition(transitionFlag, surfaceFlag); + _vm->_screen.transition(transitionType, surfaceFlag); _vm->_sound->startQueuedCommands(); } else { // Copy dirty areas to the screen diff --git a/engines/mads/scene.h b/engines/mads/scene.h index 969fb0b70d..79c5910d85 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -27,6 +27,7 @@ #include "common/array.h" #include "common/rect.h" #include "mads/assets.h" +#include "mads/graphics.h" #include "mads/hotspots.h" #include "mads/messages.h" #include "mads/msurface.h" @@ -189,7 +190,7 @@ public: /** * Draw all the elements onto the scene */ - void drawElements(bool transitionFlag, bool surfaceFlag); + void drawElements(ScreenTransition transitionType, bool surfaceFlag); /** * Execute a click within the scene diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp index b18efa223b..398c1c91b7 100644 --- a/engines/mads/sprites.cpp +++ b/engines/mads/sprites.cpp @@ -395,7 +395,7 @@ int ImageInterEntries::add(int field0, int field2) { return size() - 1; } -void ImageInterEntries::call(int v1) { +void ImageInterEntries::call(int v1, int v2) { debug("TODO: ImageInterEntries::call"); } diff --git a/engines/mads/sprites.h b/engines/mads/sprites.h index 0e4e86a273..848aa1a488 100644 --- a/engines/mads/sprites.h +++ b/engines/mads/sprites.h @@ -235,7 +235,7 @@ class ImageInterEntries: public Common::Array { public: int add(int field0, int field2); - void call(int v1); + void call(int v1, int v2); }; } // End of namespace MADS -- cgit v1.2.3 From 9e69e64d3fc54a3d9e2065eb2af75950353c7f64 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 10 Mar 2014 00:52:33 -0400 Subject: MADS: Completed PaletteUsage::process --- engines/mads/interface.cpp | 4 +-- engines/mads/palette.cpp | 85 ++++++++++++++++++++++++++++++++++------------ engines/mads/palette.h | 4 ++- 3 files changed, 68 insertions(+), 25 deletions(-) diff --git a/engines/mads/interface.cpp b/engines/mads/interface.cpp index cd2f162cf3..68e2341ccc 100644 --- a/engines/mads/interface.cpp +++ b/engines/mads/interface.cpp @@ -49,14 +49,14 @@ void InterfaceSurface::load(const Common::String &resName) { // Load in the palette Common::SeekableReadStream *palStream = madsPack.getItemStream(0); - RGB4 *gamePalP = &_vm->_palette->_gamePalette[0]; + uint32 *gamePalP = &_vm->_palette->_gamePalette[0]; byte *palP = &_vm->_palette->_mainPalette[0]; for (int i = 0; i < 16; ++i, gamePalP++, palP += 3) { palP[0] = palStream->readByte(); palP[1] = palStream->readByte(); palP[2] = palStream->readByte(); - gamePalP->r |= 1; + *gamePalP |= 1; palStream->skip(3); } delete palStream; diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index da59707a91..1303ea264a 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -78,7 +78,7 @@ void PaletteUsage::prioritize(Common::Array &palette) { } int PaletteUsage::process(Common::Array &palette, int v) { - byte *palette1 = nullptr, *palette2 = nullptr; + byte *pal1 = nullptr, *pal2 = nullptr; int palLow; int palHigh = (v & 0x800) ? 0x100 : 0xC; int palIdx; @@ -117,8 +117,8 @@ int PaletteUsage::process(Common::Array &palette, int v) { int freeIndex; int palCount = getGamePalFreeIndex(&freeIndex); - byte *pal1 = new byte[PALETTE_COUNT]; - byte *pal2 = new byte[PALETTE_COUNT]; + pal1 = new byte[PALETTE_COUNT]; + pal2 = new byte[PALETTE_COUNT]; for (uint palIndex = 0; palIndex < palette.size(); ++palIndex) { pal2[palIndex] = palIndex; @@ -180,10 +180,52 @@ int PaletteUsage::process(Common::Array &palette, int v) { int var36 = (palette[palIndex]._flags & 0x80) ? 0 : 2; for (int idx = palLow; idx < palIdx; ++idx) { - // TODO + uint32 v = _vm->_palette->_gamePalette[idx]; + if ((v & var3A) && !(v & var36)) { + int var10; + + if (var2 > 1) { + var10 = rgbFactor(&_vm->_palette->_mainPalette[idx * 3], palette[palIndex]); + } + else if (_vm->_palette->_mainPalette[idx * 3] != palette[palIndex].r || + _vm->_palette->_mainPalette[idx * 3 + 1] != palette[palIndex].g || + _vm->_palette->_mainPalette[idx * 3 + 2] != palette[palIndex].b) { + var10 = 1; + } else { + var10 = 0; + } + + if (var2 > var10) { + var48 = true; + var2 = idx; + var2 = var10; + } + } } } - //TODO + + if (!var48 && (!(v & 0x1000) || (!(palette[palIndex]._flags & 0x60) && !(v & 0x2000)))) { + for (int idx = freeIndex; idx < palIdx && !var48; ++idx) { + if (!_vm->_palette->_gamePalette[idx]) { + --palCount; + ++freeIndex; + var48 = true; + var4 = idx; + + RGB6 &pSrc = palette[palIndex]; + byte *pDest = &_vm->_palette->_mainPalette[idx * 3]; + pDest[0] = pSrc.r; + pDest[1] = pSrc.g; + pDest[2] = pSrc.b; + } + } + } + + assert(var48); + int var52 = (varA && palette[palIndex]._u2) ? 2 : 0; + + _vm->_palette->_gamePalette[var4] |= var52 | rgbMask; + palette[palIndex]._palIndex = var4; } _vm->_palette->_rgbList[rgbIndex] = 0xffff; @@ -266,8 +308,7 @@ int PaletteUsage::getGamePalFreeIndex(int *palIndex) { int count = 0; for (int i = 0; i < PALETTE_COUNT; ++i) { - RGB4 &r = _vm->_palette->_gamePalette[i]; - if (!(r.r | r.g | r.b | r.u)) { + if (!_vm->_palette->_gamePalette[i]) { ++count; if (*palIndex < 0) *palIndex = i; @@ -277,6 +318,15 @@ int PaletteUsage::getGamePalFreeIndex(int *palIndex) { return count; } +int PaletteUsage::rgbFactor(byte *palEntry, RGB6 &pal6) { + int total = 0; + total += (palEntry[0] - pal6.r) * (palEntry[0] - pal6.r); + total += (palEntry[1] - pal6.g) * (palEntry[1] - pal6.g); + total += (palEntry[2] - pal6.b) * (palEntry[2] - pal6.b); + + return total; +} + /*------------------------------------------------------------------------*/ void RGBList::clear() { @@ -474,16 +524,14 @@ void Palette::resetGamePalette(int lowRange, int highRange) { // Init low range to common RGB values if (lowRange) { - _gamePalette[0].r = 1; - _gamePalette[0].b = 0; + _gamePalette[0] = 1; Common::fill(&_gamePalette[1], &_gamePalette[lowRange - 1], _gamePalette[0]); } // Init high range to common RGB values if (highRange) { - _gamePalette[255].r = 1; - _gamePalette[255].b = 0; + _gamePalette[255] = 1; Common::fill(&_gamePalette[255 - highRange], &_gamePalette[254], _gamePalette[255]); } @@ -496,7 +544,7 @@ void Palette::resetGamePalette(int lowRange, int highRange) { void Palette::initGamePalette() { RGB4 rgb; - rgb.r = 1; + uint32 palMask = 1; if (_vm->_game->_player._spritesLoaded && _vm->_game->_player._numSprites) { @@ -508,19 +556,12 @@ void Palette::initGamePalette() { if (asset->_field6) mask <<= asset->_field6; - rgb.r = mask & 0xff; - rgb.g = (mask >> 8) & 0xff; - rgb.b = (mask >> 16) & 0xff; - rgb.u = (mask >> 24) & 0xff; + palMask = mask; } } - for (int idx = 0; idx < PALETTE_COUNT; ++idx) { - _gamePalette[idx].r &= rgb.r; - _gamePalette[idx].g &= rgb.g; - _gamePalette[idx].b &= rgb.b; - _gamePalette[idx].u &= rgb.u; - } + for (int idx = 0; idx < PALETTE_COUNT; ++idx) + _gamePalette[idx] = palMask; _v1 = 0; _rgbList.reset(); diff --git a/engines/mads/palette.h b/engines/mads/palette.h index 83e406a229..a7c3285aa3 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -62,6 +62,8 @@ private: void prioritizeFromList(int lst[3]); int getGamePalFreeIndex(int *palIndex); + + int rgbFactor(byte *palEntry, RGB6 &pal6); public: /** * Constructor @@ -128,7 +130,7 @@ protected: public: byte _mainPalette[PALETTE_SIZE]; byte _savedPalette[PALETTE_SIZE]; - RGB4 _gamePalette[PALETTE_COUNT]; + uint32 _gamePalette[PALETTE_COUNT]; PaletteUsage _paletteUsage; RGBList _rgbList; int _v1; -- cgit v1.2.3 From d295a1654547d4f3636ea6d64939a0a91c5b2c25 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 10 Mar 2014 01:00:11 -0400 Subject: MADS: Properly hook up use of PaletteUsage::process --- engines/mads/assets.cpp | 2 +- engines/mads/assets.h | 2 +- engines/mads/palette.cpp | 4 ++-- engines/mads/scene_data.cpp | 4 ++-- engines/mads/scene_data.h | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/engines/mads/assets.cpp b/engines/mads/assets.cpp index 554cd9ad48..1a2d542c95 100644 --- a/engines/mads/assets.cpp +++ b/engines/mads/assets.cpp @@ -54,7 +54,7 @@ void SpriteAsset::load(Common::SeekableReadStream *stream, int flags) { _pixelSpeed = 0; _maxWidth = 0; _maxHeight = 0; - _field6 = -1; + _usageIndex = -1; Common::SeekableReadStream *spriteStream = sprite.getItemStream(0); _mode = spriteStream->readByte(); diff --git a/engines/mads/assets.h b/engines/mads/assets.h index c0d1feb883..31d46881ff 100644 --- a/engines/mads/assets.h +++ b/engines/mads/assets.h @@ -77,7 +77,7 @@ private: void load(Common::SeekableReadStream *stream, int flags); public: SpriteSetCharInfo *_charInfo; - int _field6; + int _usageIndex; public: /** * Constructor diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index 1303ea264a..d9eb3ffa93 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -553,8 +553,8 @@ void Palette::initGamePalette() { _vm->_game->_player._spritesStart + idx]; uint32 mask = 1; - if (asset->_field6) - mask <<= asset->_field6; + if (asset->_usageIndex) + mask <<= asset->_usageIndex; palMask = mask; } diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index 36efcb31de..eb4b221af9 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -500,8 +500,8 @@ void SceneInfo::load(int sceneId, int v1, const Common::String &resName, _vm->_palette->_paletteUsage.prioritize(artHeader._palette); } - _field4C = _vm->_palette->_paletteUsage.process(artHeader._palette, 0xF800); - if (_field4C > 0) { + _usageIndex = _vm->_palette->_paletteUsage.process(artHeader._palette, 0xF800); + if (_usageIndex > 0) { _vm->_palette->_paletteUsage.transform(artHeader._palette); for (uint i = 0; i < _palAnimData.size(); ++i) { diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index d2fd624512..67393fc75d 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -267,7 +267,7 @@ public: int _depthList[DEPTH_BANDS_SIZE]; int _field4A; - int _field4C; + int _usageIndex; Common::Array _palAnimData; SceneNodeList _nodes; public: -- cgit v1.2.3 From 5543d5884cbc32012bfcf9e111817cd01770cd7e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 10 Mar 2014 22:08:55 -0400 Subject: MADS: Refactoring calls to PaletteUsage::process, and initial bugfixes --- engines/mads/assets.cpp | 11 +++----- engines/mads/mads.cpp | 1 - engines/mads/palette.cpp | 64 ++++++++++++++++----------------------------- engines/mads/palette.h | 11 +++----- engines/mads/scene_data.cpp | 3 ++- 5 files changed, 31 insertions(+), 59 deletions(-) diff --git a/engines/mads/assets.cpp b/engines/mads/assets.cpp index 1a2d542c95..1c958adfce 100644 --- a/engines/mads/assets.cpp +++ b/engines/mads/assets.cpp @@ -74,13 +74,8 @@ void SpriteAsset::load(Common::SeekableReadStream *stream, int flags) { // Get the palette data spriteStream = sprite.getItemStream(2); - int numColors = 0; - byte *palData = _vm->_palette->decodePalette(spriteStream, &numColors); - Common::copy(palData, &palData[numColors], &_palette[0]); - if (numColors < 256) - Common::fill((byte *)&_palette[numColors], (byte *)&_palette[256], 0); - _colorCount = numColors; - delete[] palData; + _vm->_palette->decodePalette(spriteStream, flags); + delete spriteStream; spriteStream = sprite.getItemStream(1); @@ -133,7 +128,7 @@ void SpriteAsset::load(Common::SeekableReadStream *stream, int flags) { fab.decompress(srcData, srcSize, destData, frameSizes[curFrame]); - // Load the frame + // Load the frames Common::MemoryReadStream *rs = new Common::MemoryReadStream(destData, frameSizes[curFrame]); _frames[curFrame]._frame = new MSprite(rs, Common::Point(_frames[curFrame]._bounds.left, _frames[curFrame]._bounds.top), diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index 0327a9fc67..6dfdf7b3b8 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -88,7 +88,6 @@ void MADSEngine::initialise() { _userInterface = UserInterface::init(this); _game = Game::init(this); - _events->loadCursors("*CURSOR.SS"); _screen.empty(); } diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index d9eb3ffa93..1525be982d 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -77,14 +77,13 @@ void PaletteUsage::prioritize(Common::Array &palette) { prioritizeFromList(lst); } -int PaletteUsage::process(Common::Array &palette, int v) { +int PaletteUsage::process(Common::Array &palette, uint flags) { byte *pal1 = nullptr, *pal2 = nullptr; int palLow; - int palHigh = (v & 0x800) ? 0x100 : 0xC; + int palHigh = (flags & 0x800) ? 0x100 : 0xFC; int palIdx; - assert(v >= 0); - if (v & 0x4000) { + if (flags & 0x4000) { palLow = 0; palIdx = palHigh; } else { @@ -98,7 +97,7 @@ int PaletteUsage::process(Common::Array &palette, int v) { int rgbIndex = _vm->_palette->_rgbList.scan(); uint32 rgbMask = 1 << rgbIndex; - int varA = v & 0x8000; + int varA = flags & 0x8000; bool hasUsage = !_vm->_palette->_paletteUsage.empty(); bool flag1 = false; @@ -127,14 +126,14 @@ int PaletteUsage::process(Common::Array &palette, int v) { if (!(palette[palIndex]._flags & 0x80)) { pal1[palIndex] = 0x40; } - if (!(palette[palIndex]._flags & 0x60)) { + if (palette[palIndex]._flags & 0x60) { pal1[palIndex] |= 0x20; } } _vm->_palette->processLists(palette.size(), pal1, pal2); - int var3A = (v & 0x4000) ? 0xffff : 0xfffe; + int var3A = (flags & 0x4000) ? 0xffff : 0xfffe; for (uint palIndex = 0; palIndex < palette.size(); ++palIndex) { bool var48 = false; @@ -174,8 +173,8 @@ int PaletteUsage::process(Common::Array &palette, int v) { if (!var48 && !varA) { int var2 = !(palette[palIndex]._flags & 0x20) && ( - ((v & 0x2000) && !(palette[palIndex]._flags & 0x40)) || - ((v & 0x1000) && (palCount > 0)) + ((flags & 0x2000) && !(palette[palIndex]._flags & 0x40)) || + ((flags & 0x1000) && (palCount > 0)) ) ? 1 : 0x7fff; int var36 = (palette[palIndex]._flags & 0x80) ? 0 : 2; @@ -204,7 +203,7 @@ int PaletteUsage::process(Common::Array &palette, int v) { } } - if (!var48 && (!(v & 0x1000) || (!(palette[palIndex]._flags & 0x60) && !(v & 0x2000)))) { + if (!var48 && (!(flags & 0x1000) || (!(palette[palIndex]._flags & 0x60) && !(flags & 0x2000)))) { for (int idx = freeIndex; idx < palIdx && !var48; ++idx) { if (!_vm->_palette->_gamePalette[idx]) { --palCount; @@ -477,35 +476,18 @@ void Palette::processLists(int count, byte *pal1, byte *pal2) { } -byte *Palette::decodePalette(Common::SeekableReadStream *palStream, int *numColors) { - *numColors = palStream->readUint16LE(); - assert(*numColors <= 252); +void Palette::decodePalette(Common::SeekableReadStream *palStream, uint flags) { + int numColors = palStream->readUint16LE(); + assert(numColors <= 252); - byte *palData = new byte[*numColors * 3]; - Common::fill(&palData[0], &palData[*numColors * 3], 0); - - for (int i = 0; i < *numColors; ++i) { - byte r = palStream->readByte(); - byte g = palStream->readByte(); - byte b = palStream->readByte(); - palData[i * 3] = VGA_COLOR_TRANS(r); - palData[i * 3 + 1] = VGA_COLOR_TRANS(g); - palData[i * 3 + 2] = VGA_COLOR_TRANS(b); - - // The next 3 bytes are unused - palStream->skip(3); - } - - return palData; -} - -int Palette::loadPalette(Common::SeekableReadStream *palStream, int indexStart) { - int colorCount; - byte *palData = decodePalette(palStream, &colorCount); - _vm->_palette->setPalette(palData, indexStart, colorCount); - - delete palData; - return colorCount; + // Load in the palette + Common::Array palette; + palette.resize(numColors); + for (int i = 0; i < numColors; ++i) + palette[i].load(palStream); + + // Process the palette data + _paletteUsage.process(palette, flags); } void Palette::setSystemPalette() { @@ -524,9 +506,7 @@ void Palette::resetGamePalette(int lowRange, int highRange) { // Init low range to common RGB values if (lowRange) { - _gamePalette[0] = 1; - - Common::fill(&_gamePalette[1], &_gamePalette[lowRange - 1], _gamePalette[0]); + Common::fill(&_gamePalette[0], &_gamePalette[lowRange], 1); } // Init high range to common RGB values @@ -537,6 +517,8 @@ void Palette::resetGamePalette(int lowRange, int highRange) { } _rgbList.clear(); + _rgbList[0] = _rgbList[1] = 0xffff; + _v1 = 0; _lowRange = lowRange; _highRange = highRange; diff --git a/engines/mads/palette.h b/engines/mads/palette.h index a7c3285aa3..ad9d1f3c4b 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -91,7 +91,7 @@ public: */ void prioritize(Common::Array &palette); - int process(Common::Array &palette, int v); + int process(Common::Array &palette, uint flags); void transform(Common::Array &palette); }; @@ -183,14 +183,9 @@ public: uint8 palIndexFromRgb(byte r, byte g, byte b, byte *paletteData = nullptr); /** - * Decode a palette and return it, without affecting the Palette itself + * Decodes a palette and loads it into the main palette */ - byte *decodePalette(Common::SeekableReadStream *palStream, int *numColors); - - /** - * Loads a palette from a stream - */ - int loadPalette(Common::SeekableReadStream *palStream, int indexStart = 0); + void decodePalette(Common::SeekableReadStream *palStream, uint flags); /** * Sets a small set of system/core colors needed by the game diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index eb4b221af9..d4fefff4f6 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -500,7 +500,8 @@ void SceneInfo::load(int sceneId, int v1, const Common::String &resName, _vm->_palette->_paletteUsage.prioritize(artHeader._palette); } - _usageIndex = _vm->_palette->_paletteUsage.process(artHeader._palette, 0xF800); + _usageIndex = _vm->_palette->_paletteUsage.process(artHeader._palette, + (flags & 0xF800) | 0x8000); if (_usageIndex > 0) { _vm->_palette->_paletteUsage.transform(artHeader._palette); -- cgit v1.2.3 From 5d4b6b79db701fac2e9511de8cc977a5def4160c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 11 Mar 2014 21:01:07 -0400 Subject: MADS: Fix for palette initialisation in Palette::initRange --- engines/mads/palette.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index 1525be982d..9b93fb3cd3 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -553,8 +553,10 @@ void Palette::initRange(byte *palette) { int var6 = 0; int vdx = 0; int vbx = 0; + byte *destP = palette; + do { - int vdi = (vdx == 1) ? 0 : 0x2A; + int vdi = (vdx == 1) ? 0x3F : 0x2A; int var8 = 0; int varE = vbx; int var10 = vdx; @@ -565,11 +567,10 @@ void Palette::initRange(byte *palette) { int var4 = vdx; do { int var2 = var6 + vcx; - byte *destP = &palette[var2 * 3]; - destP[0] = (var8) ? vdi & 0xFF : vbx & 0XFF; - destP[1] = (var4) ? vdi & 0xFF : vbx & 0XFF; - destP[2] = (vcx) ? vdi & 0xFF : vbx & 0XFF; + *destP++ = (var8) ? vdi & 0xFF : vbx & 0XFF; + *destP++ = (var4) ? vdi & 0xFF : vbx & 0XFF; + *destP++ = (vcx) ? vdi & 0xFF : vbx & 0XFF; } while (++vcx < 2); var6 += 2; -- cgit v1.2.3 From 5a1c64e7329bd85c0089c7ee55217266be36c921 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 11 Mar 2014 21:32:42 -0400 Subject: MADS: Further fixes for PaletteUsage::process --- engines/mads/palette.cpp | 8 ++++---- engines/mads/palette.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index 9b93fb3cd3..2e4995e939 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -138,7 +138,7 @@ int PaletteUsage::process(Common::Array &palette, uint flags) { for (uint palIndex = 0; palIndex < palette.size(); ++palIndex) { bool var48 = false; int var4 = 0xffff; - int v1 = pal1[palIndex]; + int v1 = pal2[palIndex]; if (palette[v1]._flags & 8) { var48 = true; @@ -196,7 +196,7 @@ int PaletteUsage::process(Common::Array &palette, uint flags) { if (var2 > var10) { var48 = true; - var2 = idx; + var4 = idx; var2 = var10; } } @@ -502,7 +502,7 @@ void Palette::setSystemPalette() { void Palette::resetGamePalette(int lowRange, int highRange) { Common::fill((byte *)&_gamePalette[0], (byte *)&_gamePalette[PALETTE_COUNT], 0); - initRange(_mainPalette); + initVGAPalette(_mainPalette); // Init low range to common RGB values if (lowRange) { @@ -549,7 +549,7 @@ void Palette::initGamePalette() { _rgbList.reset(); } -void Palette::initRange(byte *palette) { +void Palette::initVGAPalette(byte *palette) { int var6 = 0; int vdx = 0; int vbx = 0; diff --git a/engines/mads/palette.h b/engines/mads/palette.h index ad9d1f3c4b..b540aa572f 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -120,9 +120,9 @@ public: class Palette { private: /** - * Initialises a stanadrd range of colours for the given palette + * Initialises a stanadrd VGA palette */ - void initRange(byte *palette); + void initVGAPalette(byte *palette); protected: MADSEngine *_vm; -- cgit v1.2.3 From 5047c118f1b3bb60136bc4088e9db53f38dbb087 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 11 Mar 2014 21:35:18 -0400 Subject: MADS: Fix for executing queued sound commands --- engines/mads/sound.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/sound.cpp b/engines/mads/sound.cpp index ea0239076b..eaac70c670 100644 --- a/engines/mads/sound.cpp +++ b/engines/mads/sound.cpp @@ -85,7 +85,7 @@ void SoundManager::startQueuedCommands() { _newSoundsPaused = false; while (!_queuedCommands.empty()) { - int commandId = _queuedCommands.front(); + int commandId = _queuedCommands.pop(); command(commandId); } } -- cgit v1.2.3 From 41e86d553e087e1b4276748064fb5893859196b2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 11 Mar 2014 21:40:49 -0400 Subject: MADS: Renamed game palette to palette flags --- engines/mads/game.cpp | 2 +- engines/mads/interface.cpp | 2 +- engines/mads/palette.cpp | 22 ++++++++++------------ engines/mads/palette.h | 6 +++--- 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index e0d3ca1914..f290ab0fc3 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -166,7 +166,7 @@ void Game::sectionLoop() { _vm->_palette->resetGamePalette(18, 10); _scene._spriteSlots.reset(); } else { - _vm->_palette->initGamePalette(); + _vm->_palette->initPalette(); } _vm->_palette->_paletteUsage.load(3, 0xF0, 0xF1, 0xF2); diff --git a/engines/mads/interface.cpp b/engines/mads/interface.cpp index 68e2341ccc..0c983dc133 100644 --- a/engines/mads/interface.cpp +++ b/engines/mads/interface.cpp @@ -49,7 +49,7 @@ void InterfaceSurface::load(const Common::String &resName) { // Load in the palette Common::SeekableReadStream *palStream = madsPack.getItemStream(0); - uint32 *gamePalP = &_vm->_palette->_gamePalette[0]; + uint32 *gamePalP = &_vm->_palette->_palFlags[0]; byte *palP = &_vm->_palette->_mainPalette[0]; for (int i = 0; i < 16; ++i, gamePalP++, palP += 3) { diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index 2e4995e939..e63d9c03ed 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -179,7 +179,7 @@ int PaletteUsage::process(Common::Array &palette, uint flags) { int var36 = (palette[palIndex]._flags & 0x80) ? 0 : 2; for (int idx = palLow; idx < palIdx; ++idx) { - uint32 v = _vm->_palette->_gamePalette[idx]; + uint32 v = _vm->_palette->_palFlags[idx]; if ((v & var3A) && !(v & var36)) { int var10; @@ -205,7 +205,7 @@ int PaletteUsage::process(Common::Array &palette, uint flags) { if (!var48 && (!(flags & 0x1000) || (!(palette[palIndex]._flags & 0x60) && !(flags & 0x2000)))) { for (int idx = freeIndex; idx < palIdx && !var48; ++idx) { - if (!_vm->_palette->_gamePalette[idx]) { + if (!_vm->_palette->_palFlags[idx]) { --palCount; ++freeIndex; var48 = true; @@ -223,7 +223,7 @@ int PaletteUsage::process(Common::Array &palette, uint flags) { assert(var48); int var52 = (varA && palette[palIndex]._u2) ? 2 : 0; - _vm->_palette->_gamePalette[var4] |= var52 | rgbMask; + _vm->_palette->_palFlags[var4] |= var52 | rgbMask; palette[palIndex]._palIndex = var4; } @@ -307,7 +307,7 @@ int PaletteUsage::getGamePalFreeIndex(int *palIndex) { int count = 0; for (int i = 0; i < PALETTE_COUNT; ++i) { - if (!_vm->_palette->_gamePalette[i]) { + if (!_vm->_palette->_palFlags[i]) { ++count; if (*palIndex < 0) *palIndex = i; @@ -501,19 +501,19 @@ void Palette::setSystemPalette() { } void Palette::resetGamePalette(int lowRange, int highRange) { - Common::fill((byte *)&_gamePalette[0], (byte *)&_gamePalette[PALETTE_COUNT], 0); + Common::fill((byte *)&_palFlags[0], (byte *)&_palFlags[PALETTE_COUNT], 0); initVGAPalette(_mainPalette); // Init low range to common RGB values if (lowRange) { - Common::fill(&_gamePalette[0], &_gamePalette[lowRange], 1); + Common::fill(&_palFlags[0], &_palFlags[lowRange], 1); } // Init high range to common RGB values if (highRange) { - _gamePalette[255] = 1; + _palFlags[255] = 1; - Common::fill(&_gamePalette[255 - highRange], &_gamePalette[254], _gamePalette[255]); + Common::fill(&_palFlags[255 - highRange], &_palFlags[254], _palFlags[255]); } _rgbList.clear(); @@ -524,7 +524,7 @@ void Palette::resetGamePalette(int lowRange, int highRange) { _highRange = highRange; } -void Palette::initGamePalette() { +void Palette::initPalette() { RGB4 rgb; uint32 palMask = 1; @@ -543,7 +543,7 @@ void Palette::initGamePalette() { } for (int idx = 0; idx < PALETTE_COUNT; ++idx) - _gamePalette[idx] = palMask; + _palFlags[idx] = palMask; _v1 = 0; _rgbList.reset(); @@ -566,8 +566,6 @@ void Palette::initVGAPalette(byte *palette) { int vcx = 0; int var4 = vdx; do { - int var2 = var6 + vcx; - *destP++ = (var8) ? vdi & 0xFF : vbx & 0XFF; *destP++ = (var4) ? vdi & 0xFF : vbx & 0XFF; *destP++ = (vcx) ? vdi & 0xFF : vbx & 0XFF; diff --git a/engines/mads/palette.h b/engines/mads/palette.h index b540aa572f..2744d47190 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -130,7 +130,7 @@ protected: public: byte _mainPalette[PALETTE_SIZE]; byte _savedPalette[PALETTE_SIZE]; - uint32 _gamePalette[PALETTE_COUNT]; + uint32 _palFlags[PALETTE_COUNT]; PaletteUsage _paletteUsage; RGBList _rgbList; int _v1; @@ -205,9 +205,9 @@ public: void resetGamePalette(int v1, int v2); /** - * Initialises game palette + * Initialises the main palette */ - void initGamePalette(); + void initPalette(); /** * Set the first four palette entries with preset values -- cgit v1.2.3 From be1a53062a21b6af27b504c64c1ddf8b33f0880a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 11 Mar 2014 21:48:16 -0400 Subject: MADS: Convert 6 bit palettes to 8 bit values --- engines/mads/palette.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index e63d9c03ed..aeb97d2ff2 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -28,10 +28,12 @@ namespace MADS { +#define VGA_COLOR_TRANS(x) (((((int)(x)) + 1) << 2) - 1) + void RGB6::load(Common::SeekableReadStream *f) { - r = f->readByte(); - g = f->readByte(); - b = f->readByte(); + r = VGA_COLOR_TRANS(f->readByte()); + g = VGA_COLOR_TRANS(f->readByte()); + b = VGA_COLOR_TRANS(f->readByte()); _palIndex = f->readByte(); _u2 = f->readByte(); _flags = f->readByte(); @@ -347,8 +349,6 @@ int RGBList::scan() { /*------------------------------------------------------------------------*/ -#define VGA_COLOR_TRANS(x) (x == 0x3f ? 255 : x << 2) - Palette::Palette(MADSEngine *vm) : _vm(vm), _paletteUsage(vm) { reset(); @@ -566,9 +566,9 @@ void Palette::initVGAPalette(byte *palette) { int vcx = 0; int var4 = vdx; do { - *destP++ = (var8) ? vdi & 0xFF : vbx & 0XFF; - *destP++ = (var4) ? vdi & 0xFF : vbx & 0XFF; - *destP++ = (vcx) ? vdi & 0xFF : vbx & 0XFF; + *destP++ = VGA_COLOR_TRANS((var8) ? vdi & 0xFF : vbx & 0XFF); + *destP++ = VGA_COLOR_TRANS((var4) ? vdi & 0xFF : vbx & 0XFF); + *destP++ = VGA_COLOR_TRANS((vcx) ? vdi & 0xFF : vbx & 0XFF); } while (++vcx < 2); var6 += 2; -- cgit v1.2.3 From 2d99f761f0bb0a8db4468846f0643fbdc4da450a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 11 Mar 2014 23:26:31 -0400 Subject: MADS: Implemented scene 804 step --- engines/mads/dialogs.h | 4 + engines/mads/game.cpp | 1 + engines/mads/game.h | 1 + engines/mads/nebular/game_nebular.cpp | 1 + engines/mads/nebular/game_nebular.h | 19 ++++ engines/mads/nebular/nebular_scenes.cpp | 3 +- engines/mads/nebular/nebular_scenes.h | 3 + engines/mads/nebular/nebular_scenes8.cpp | 159 ++++++++++++++++++++++++++++++- 8 files changed, 185 insertions(+), 6 deletions(-) diff --git a/engines/mads/dialogs.h b/engines/mads/dialogs.h index 0f9a098ee1..bec7f84976 100644 --- a/engines/mads/dialogs.h +++ b/engines/mads/dialogs.h @@ -68,6 +68,10 @@ public: * Destructor */ virtual ~Dialog(); + + static void show(int msgId) { + warning("TODO: Dialog::show"); + } }; enum { diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index f290ab0fc3..6a7f6fb18d 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -59,6 +59,7 @@ Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm), _abortTimersMode = ABORTMODE_0; _abortTimersMode2 = ABORTMODE_0; _ticksExpiry = 0; + _exitFlag = 0; } Game::~Game() { diff --git a/engines/mads/game.h b/engines/mads/game.h index 143259dc2f..01f23605d5 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -129,6 +129,7 @@ public: Common::String _aaName; uint32 _ticksExpiry; int _objectHiliteVocabIdx; + int _exitFlag; public: virtual ~Game(); diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index c18561bac0..c2a23b607b 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -36,6 +36,7 @@ namespace Nebular { GameNebular::GameNebular(MADSEngine *vm): Game(vm) { _surface = new MSurface(MADS_SCREEN_WIDTH, MADS_SCREEN_HEIGHT - MADS_INTERFACE_HEIGHT); + _storyMode = STORYMODE_NAUGHTY; } int GameNebular::checkCopyProtection() { diff --git a/engines/mads/nebular/game_nebular.h b/engines/mads/nebular/game_nebular.h index 0250f66d8e..3d1d915332 100644 --- a/engines/mads/nebular/game_nebular.h +++ b/engines/mads/nebular/game_nebular.h @@ -31,6 +31,24 @@ namespace MADS { namespace Nebular { +enum StoryMode { STORYMODE_NAUGHTY = 1, STORYMODE_NICE = 2 }; + +enum InventoryObject { + OBJ_BURGER = 1, OBJ_DEAD_FISH = 2, OBJ_STUFFED_FISH = 3, OBJ_REBREATHER = 4, + OBJ_TIMER_MODULE = 5, OBJ_BIG_LEAVES = 6, OBJ_POISON_DARTS = 7, OBJ_PLANT_STALK = 8, + OBJ_BLOWGUN = 9, OBJ_TWINKIFRUIT = 10, OBJ_BONE = 11, OBJ_CHICKEN = 12, + OBJ_SCALPEL = 13, OBJ_AUDIO_TAPE = 14, OBJ_CREDIT_CHIP = 15, OBJ_SECURITY_CARD = 16, + OBJ_CHARGE_CASES = 17, OBJ_ESTROTOXIN = 18, OBJ_BOMB = 19, OBJ_TIMEBOMB = 20, + OBJ_REPAIR_LIST = 21, OBJ_ALIEN_LIQUOR = 22, OBJ_TARGET_MODULE = 23, OBJ_SHIELD_MODULATOR = 24, + OBJ_TAPE_PLAYER = 25, OBJ_PHONE_CELLS = 26, OBJ_PENLIGHT = 27, OBJ_DURAFAIL_CELLS = 28, + OBJ_FAKE_ID = 29, OBJ_ID_CARD = 30, OBJ_POLYCEMENT = 31, OBJ_FISHING_LINE = 33, + OBJ_PADLOCK_KEY = 34, OBJ_DOOR_KEY = 35, OBJ_REARVIEW_MIRROR = 36, OBJ_COMPACT_CASE = 37, + OBJ_DETONATORS = 39, OBJ_BOTTLE = 40, OBJ_CHICKEN_BOMB = 41, OBJ_VASE = 42, + OBJ_REMOTE = 43, OBJ_COMPUTER_GAME = 44, OBJ_PHONE_HANDSET = 45, OBJ_BONES = 46, + OBJ_GUARDS_ARM = 47, OBJ_LOG = 48, OBJ_BOMBS = 49, OBJ_NOTE = 50, + OBJ_COMBINATION = 51, OBJ_FORMALDEHYDE = 52, OBJ_PETROX = 53, OBJ_LECITHIN = 54 +}; + class GameNebular: public Game { friend class Game; protected: @@ -46,6 +64,7 @@ protected: public: Globals _globals; + StoryMode _storyMode; }; diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index d14120a5b7..baee40cc47 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -52,7 +52,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { /*------------------------------------------------------------------------*/ NebularScene::NebularScene(MADSEngine *vm) : SceneLogic(vm), - _globals(static_cast(vm->_game)->_globals) { + _globals(static_cast(vm->_game)->_globals), + _game(*static_cast(vm->_game)) { } Common::String NebularScene::formAnimName(char sepChar, int suffixNum) { diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index 92b5626bf0..da36c71905 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -26,8 +26,10 @@ #include "common/scummsys.h" #include "mads/game.h" #include "mads/scene.h" +#include "mads/nebular/game_nebular.h" #include "mads/nebular/globals_nebular.h" + namespace MADS { namespace Nebular { @@ -95,6 +97,7 @@ public: class NebularScene : public SceneLogic { protected: Globals &_globals; + GameNebular &_game; /** * Forms an animation resoucre name diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index 56c3679409..c912d32eed 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -35,9 +35,9 @@ void Scene8xx::setup1() { if ((_globals[178] && !_globals[179]) || _scene->_nextSceneId == 804 || _scene->_nextSceneId == 805 || _scene->_nextSceneId == 808 || _scene->_nextSceneId == 810) { - _vm->_game->_player._spritesPrefix = ""; + _game._player._spritesPrefix = ""; } else { - _vm->_game->_player._spritesPrefix = _globals[0] == SEX_FEMALE ? "ROX" : "RXM"; + _game._player._spritesPrefix = _globals[0] == SEX_FEMALE ? "ROX" : "RXM"; } _vm->_palette->setEntry(16, 0x0A, 0x3F, 0x3F); @@ -45,7 +45,7 @@ void Scene8xx::setup1() { } void Scene8xx::setup2() { - _vm->_game->_aaName = Resources::formatAAName(5); + _game._aaName = Resources::formatAAName(5); } void Scene8xx::enter1() { @@ -99,7 +99,7 @@ void Scene804::enter() { _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('x', 4)); _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('f', 1)); - _vm->_game->loadQuoteSet(791, 0); + _game.loadQuoteSet(791, 0); if (_globals[165]) { if (_globals[164]) { @@ -113,7 +113,7 @@ void Scene804::enter() { _globals._spriteIndexes[21] = _scene->_sequences.startReverseCycle( _globals._spriteIndexes[6], false, 4, 0, 0, 0); _scene->_sequences.addTimer(160, 70); - _vm->_game->_player._stepEnabled = false; + _game._player._stepEnabled = false; } } else { @@ -144,6 +144,155 @@ void Scene804::enter() { } void Scene804::step() { + if (_globals._chairHotspotIndex) { + if (_scene->_activeAnimation->getCurrentFrame() == 36 && !_globals._v3) { + _scene->_sequences.remove(_globals._spriteIndexes[15]); + _globals._v3 = -1; + } + if (_scene->_activeAnimation->getCurrentFrame() == 39) { + _globals._v2 = 0; + if (_globals._v1 == 3) + _scene->_sequences.addTimer(130, 120); + } + + if (!_globals._v2) { + ++_globals._v1; + _globals._v2 = -1; + + if (_globals._v1 >= 4) { + _globals._chairHotspotIndex = 0; + _globals._v1 = 0; + _game._player._stepEnabled = true; + } else { + _globals._v5 = 34; + } + } + } else { + if (_globals._v3 && _globals._v2 && _scene->_activeAnimation->getCurrentFrame() == 39) { + _globals._spriteIndexes[15] = _scene->_sequences.startCycle( + _globals._spriteIndexes[0], false, 1); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[15], + Common::Point(133, 139)); + _scene->_sequences.setDepth(_globals._spriteIndexes[15], 8); + _globals._v3 = 0; + } + + if (_globals._v2 && _scene->_activeAnimation->getCurrentFrame() == 42) { + _globals._v5 = 0; + _globals._v2 = 0; + } + + if (_game._abortTimers == 70) + _globals._v5 = 42; + if (_scene->_activeAnimation->getCurrentFrame() == 65) + _scene->_sequences.remove(_globals._spriteIndexes[21]); + + switch (_game._storyMode) { + case STORYMODE_NAUGHTY: + if (_scene->_activeAnimation->getCurrentFrame() == 81) { + _globals._v5 = 80; + } else { + _globals[165] = 0; + _globals[167] = -1; + assert(!_globals[5]); + _game._exitFlag = 4; + _vm->quitGame(); + } + break; + + case STORYMODE_NICE: + if (_scene->_activeAnimation->getCurrentFrame() == 68) { + _globals._v5 = 66; + } else { + _globals[165] = 0; + _globals[167] = -1; + assert(!_globals[5]); + _game._exitFlag = 4; + _vm->quitGame(); + } + break; + } + + if (_scene->_activeAnimation->getCurrentFrame() == 34) { + _globals._v5 = 36; + _scene->_sequences.remove(_globals._spriteIndexes[15]); + } + if (_scene->_activeAnimation->getCurrentFrame() == 37) { + _globals._v5 = 36; + if (!_globals._v4) + _scene->_sequences.addTimer(60, 80); + } + + if (_game._abortTimers == 80) + _scene->_nextSceneId = 803; + + if (_scene->_activeAnimation->getCurrentFrame() == 7 && !_globals[164]) { + _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); + _scene->_sequences.addTimer(20, 110); + _globals[164] = -1; + } + + if (_scene->_activeAnimation->getCurrentFrame() == 10) { + _globals._v5 = 0; + _game._player._stepEnabled = true; + _game._objects.setRoom(OBJ_POLYCEMENT, 1); + } + + switch (_scene->_activeAnimation->getCurrentFrame()) { + case 1: + _globals[29] = _vm->getRandomNumber(29) + 1; + switch (_globals[29]) { + case 1: + _globals._v5 = 25; + break; + case 2: + _globals._v5 = 27; + break; + case 3: + _globals._v5 = 9; + break; + default: + _globals._v5 = 0; + break; + } + break; + + case 26: + case 28: + case 31: + _globals._v5 = 0; + break; + + default: + break; + } + } + + if (_game._abortTimers == 120) + Dialog::show(0x13a26); + if (_game._abortTimers == 110) + Dialog::show(0x13a2a); + + if (_globals._v6) { + _globals._v5 = 32; + _globals._v6 = 0; + } + if (_globals._v5 >= 0 && (_scene->_activeAnimation->getCurrentFrame() != _globals._v5)) { + _scene->_activeAnimation->setCurrentFrame(_globals._v5); + _globals._v5 = -1; + } + + if (_game._abortTimers == 90) + _scene->_nextSceneId = 803; + + if (_scene->_activeAnimation->getCurrentFrame() == 7 &&!_globals._v8) { + _vm->_sound->command(21); + _globals._v8 = -1; + } + if (_scene->_activeAnimation->getCurrentFrame() == 80 && !_globals._v7) { + _vm->_sound->command(22); + _globals._v7 = -1; + } } void Scene804::preActions() { -- cgit v1.2.3 From 709fcc6fac4e1449064c4ddd5de3c443d0290c93 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 11 Mar 2014 23:42:20 -0400 Subject: MADS: Fix inter-frame wait loop --- engines/mads/events.cpp | 5 ++--- engines/mads/events.h | 1 - engines/mads/nebular/game_nebular.cpp | 22 +++++++++++----------- engines/mads/nebular/globals_nebular.h | 4 ++-- engines/mads/nebular/nebular_scenes8.cpp | 2 +- 5 files changed, 16 insertions(+), 18 deletions(-) diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp index 59cdfbfffb..182d6cbea7 100644 --- a/engines/mads/events.cpp +++ b/engines/mads/events.cpp @@ -36,7 +36,6 @@ EventsManager::EventsManager(MADSEngine *vm) { _vm = vm; _cursorSprites = nullptr; _frameCounter = 0; - _frameNumber = 0; _priorFrameTime = 0; _keyPressed = false; _mouseClicked = false; @@ -166,8 +165,8 @@ void EventsManager::delay(int cycles) { } void EventsManager::waitForNextFrame() { - uint32 frameNum = getFrameCounter(); - while (!_vm->shouldQuit() && !_vm->_game->_abortTimers && frameNum == _frameNumber) + uint32 frameCtr = getFrameCounter(); + while (!_vm->shouldQuit() && frameCtr == _frameCounter) delay(1); } diff --git a/engines/mads/events.h b/engines/mads/events.h index 6f716d8083..17224227c6 100644 --- a/engines/mads/events.h +++ b/engines/mads/events.h @@ -38,7 +38,6 @@ class EventsManager { private: MADSEngine *_vm; uint32 _frameCounter; - uint32 _frameNumber; uint32 _priorFrameTime; Common::Point _mousePos; Common::Point _currentPos; diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index c2a23b607b..65abb40f1e 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -41,7 +41,7 @@ GameNebular::GameNebular(MADSEngine *vm): Game(vm) { int GameNebular::checkCopyProtection() { // DEBUG: Flag copy protection failure - _globals[5] = 0xFFFF; + _globals[5] = -1; if (!ConfMan.getBool("copy_protection")) return true; @@ -60,13 +60,13 @@ void GameNebular::initialiseGlobals() { // Set specific values needed by the game _globals[4] = 8; _globals[33] = 1; - _globals[10] = 0xFFFF; - _globals[13] = 0xFFFF; - _globals[15] = 0xFFFF; - _globals[19] = 0xFFFF; - _globals[20] = 0xFFFF; - _globals[21] = 0xFFFF; - _globals[95] = 0xFFFF; + _globals[10] = -1; + _globals[13] = -1; + _globals[15] = -1; + _globals[19] = -1; + _globals[20] = -1; + _globals[21] = -1; + _globals[95] = -1; _objects.setData(3, 17, nullptr); @@ -101,8 +101,8 @@ void GameNebular::initialiseGlobals() { } _globals[120] = 501; - _globals[121] = 0xFFFF; - _globals[55] = 0xFFFF; + _globals[121] = -1; + _globals[55] = -1; _globals[119] = 1; _globals[134] = 4; @@ -133,7 +133,7 @@ void GameNebular::initialiseGlobals() { case DIFFICULTY_MEDIUM: _globals[35] = 0; _objects.setRoom(8, 1); - _globals[137] = 0xFFFF; + _globals[137] = -1; _globals[136] = 6; break; case DIFFICULTY_EASY: diff --git a/engines/mads/nebular/globals_nebular.h b/engines/mads/nebular/globals_nebular.h index daa384f88f..31340446d2 100644 --- a/engines/mads/nebular/globals_nebular.h +++ b/engines/mads/nebular/globals_nebular.h @@ -33,7 +33,7 @@ namespace Nebular { class Globals { private: - Common::Array _flags; + Common::Array _flags; public: Common::Array _spriteIndexes; @@ -55,7 +55,7 @@ public: /** * Square brackets operator for accessing flags */ - uint16 &operator[](int idx) { return _flags[idx]; } + int16 &operator[](int idx) { return _flags[idx]; } }; } // End of namespace Nebular diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index c912d32eed..ac3f029cc9 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -88,7 +88,7 @@ void Scene804::enter() { _globals._v8 = 0; if (_globals[5]) { // Copy protection failed - _globals[165] = 0xFFFF; + _globals[165] = -1; _globals[164] = 0; } -- cgit v1.2.3 From 98f7ba964369b128f65755c918f4c5e6d1d16dbe Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 12 Mar 2014 08:44:57 -0400 Subject: MADS: Fix definition/loading of animation frame change data --- engines/mads/animation.cpp | 3 +-- engines/mads/animation.h | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index 2117ae2068..ec043a3079 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -127,8 +127,7 @@ void AnimMiscEntry::load(Common::SeekableReadStream *f) { _numTicks = f->readUint16LE(); _posAdjust.x = f->readSint16LE(); _posAdjust.y = f->readSint16LE(); - _scrollPos.x = f->readSint16LE(); - _scrollPos.y = f->readSint16LE(); + _field8 = f->readUint16LE(); } /*------------------------------------------------------------------------*/ diff --git a/engines/mads/animation.h b/engines/mads/animation.h index ca04e86ed6..492fb9dbe4 100644 --- a/engines/mads/animation.h +++ b/engines/mads/animation.h @@ -72,7 +72,7 @@ public: int _msgIndex; int _numTicks; Common::Point _posAdjust; - Common::Point _scrollPos; + int _field8; /** * Loads data for the record -- cgit v1.2.3 From d9bb593b5f39f31f078d9b479d569c56c6eda563 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 12 Mar 2014 20:54:50 -0400 Subject: MADS: Implemented PaletteUsage::updateUsage --- engines/mads/palette.cpp | 24 ++++++++++++++++++++++++ engines/mads/palette.h | 2 ++ engines/mads/scene_data.cpp | 6 +++--- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index aeb97d2ff2..7e0d5bbdb5 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -304,6 +304,30 @@ void PaletteUsage::transform(Common::Array &palette) { } } +void PaletteUsage::updateUsage(Common::Array &usageList, int sceneUsageIndex) { + uint32 mask1 = 0xFFFFFFFF; + uint32 mask2 = 0; + + for (uint idx = 0; idx < usageList.size(); ++idx) { + uint32 bitMask = 1 << usageList[idx]; + mask1 ^= bitMask; + mask2 |= bitMask; + _vm->_palette->_rgbList[usageList[idx]] = 0; + } + + uint32 mask3 = 1 << sceneUsageIndex; + + for (uint idx = 0; idx < PALETTE_COUNT; ++idx) { + uint32 mask = mask2 & _vm->_palette->_palFlags[idx]; + if (mask) { + _vm->_palette->_palFlags[idx] = (_vm->_palette->_palFlags[idx] & + mask1) | mask3; + } + } + + _vm->_palette->_rgbList[sceneUsageIndex] = -1; +} + int PaletteUsage::getGamePalFreeIndex(int *palIndex) { *palIndex = -1; int count = 0; diff --git a/engines/mads/palette.h b/engines/mads/palette.h index 2744d47190..5f21bd9a21 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -94,6 +94,8 @@ public: int process(Common::Array &palette, uint flags); void transform(Common::Array &palette); + + void updateUsage(Common::Array &usageList, int sceneUsageIndex); }; class RGBList { diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index d4fefff4f6..18a3b6ceda 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -522,7 +522,7 @@ void SceneInfo::load(int sceneId, int v1, const Common::String &resName, artFile.close(); Common::Array spriteSets; - Common::Array indexList; + Common::Array usageList; if (flags & 1) { for (uint i = 0; i < setNames.size(); ++i) { @@ -533,11 +533,11 @@ void SceneInfo::load(int sceneId, int v1, const Common::String &resName, SpriteAsset *sprites = new SpriteAsset(_vm, setResName, flags); spriteSets.push_back(sprites); - indexList.push_back(-1); // TODO:: sprites->_field6 + usageList.push_back(sprites->_usageIndex); } } - warning("TODO: sub_201E4(indexList, namesCount, &pal data2"); + _vm->_palette->_paletteUsage.updateUsage(usageList, _usageIndex); for (uint i = 0; i < spriteInfo.size(); ++i) { SpriteInfo &si = spriteInfo[i]; -- cgit v1.2.3 From 408f5e79df5e8a33367fdf2a9c17b424953edace Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 12 Mar 2014 22:45:33 -0400 Subject: MADS: General cleanup and minor fixes --- engines/mads/animation.cpp | 5 ++- engines/mads/assets.h | 1 + engines/mads/messages.cpp | 8 ++--- engines/mads/msurface.cpp | 13 +++----- engines/mads/nebular/nebular_scenes8.cpp | 6 ++-- engines/mads/resources.cpp | 3 +- engines/mads/scene.cpp | 4 ++- engines/mads/scene_data.cpp | 3 +- engines/mads/scene_data.h | 5 +-- engines/mads/sequence.cpp | 21 +++++------- engines/mads/sprites.cpp | 57 +++++++++++++++++--------------- engines/mads/sprites.h | 4 +-- 12 files changed, 63 insertions(+), 67 deletions(-) diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index ec043a3079..b5ebb2c278 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -347,7 +347,7 @@ void Animation::loadFrame(int frameNumber) { } if (drawFrame(spriteSet, pt, frameNumber)) - error("proc1 failure"); + error("drawFrame failure"); } bool Animation::drawFrame(SpriteAsset &spriteSet, const Common::Point &pt, int frameNumber) { @@ -373,8 +373,7 @@ void Animation::loadInterface(InterfaceSurface &interfaceSurface, MSurface &dept if (palAnimData) palAnimData->clear(); - } - else { + } else { // Original has useless code here } } diff --git a/engines/mads/assets.h b/engines/mads/assets.h index 31d46881ff..b4856605eb 100644 --- a/engines/mads/assets.h +++ b/engines/mads/assets.h @@ -78,6 +78,7 @@ private: public: SpriteSetCharInfo *_charInfo; int _usageIndex; + Common::Point _pos; public: /** * Constructor diff --git a/engines/mads/messages.cpp b/engines/mads/messages.cpp index 8bdbe72512..dcac541cf8 100644 --- a/engines/mads/messages.cpp +++ b/engines/mads/messages.cpp @@ -340,10 +340,10 @@ int TextDisplayList::add(int xp, int yp, uint fontColor, int charSpacing, void TextDisplayList::setDirtyAreas() { Scene &scene = _vm->_game->_scene; - for (uint idx = 0, dirtyIdx = DIRTY_AREAS_TEXT_DISPLAY_IDX; dirtyIdx < size(); ++idx, ++dirtyIdx) { - if (((*this)[idx]._expire >= 0) || !(*this)[idx]._active) + for (uint idx = 0, dirtyIdx = SPRITE_SLOTS_MAX_SIZE; dirtyIdx < size(); ++idx, ++dirtyIdx) { + if (((*this)[idx]._expire >= 0) || !(*this)[idx]._active) { scene._dirtyAreas[dirtyIdx]._active = false; - else { + } else { scene._dirtyAreas[dirtyIdx]._textActive = true; scene._dirtyAreas[dirtyIdx].setTextDisplay(&(*this)[idx]); } @@ -353,7 +353,7 @@ void TextDisplayList::setDirtyAreas() { void TextDisplayList::setDirtyAreas2() { Scene &scene = _vm->_game->_scene; - for (uint idx = 0, dirtyIdx = DIRTY_AREAS_TEXT_DISPLAY_IDX; idx < size(); ++idx, ++dirtyIdx) { + for (uint idx = 0, dirtyIdx = SPRITE_SLOTS_MAX_SIZE; idx < size(); ++idx, ++dirtyIdx) { if ((*this)[idx]._active && ((*this)[idx]._expire >= 0)) { scene._dirtyAreas[dirtyIdx].setTextDisplay(&(*this)[idx]); scene._dirtyAreas[dirtyIdx]._textActive = ((*this)[idx]._expire <= 0) ? 0 : 1; diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp index f21836eb09..2adb3e5b81 100644 --- a/engines/mads/msurface.cpp +++ b/engines/mads/msurface.cpp @@ -230,10 +230,10 @@ void MSurface::copyFrom(MSurface *src, const Common::Rect &srcBounds, byte *destPtr = (byte *)pixels + (destY * getWidth()) + destX; for (int rowCtr = 0; rowCtr < copyRect.height(); ++rowCtr) { - if (transparentColor == -1) + if (transparentColor == -1) { // No transparency, so copy line over Common::copy(srcPtr, srcPtr + copyRect.width(), destPtr); - else { + } else { // Copy each byte one at a time checking for the transparency color for (int xCtr = 0; xCtr < copyRect.width(); ++xCtr) if (srcPtr[xCtr] != transparentColor) destPtr[xCtr] = srcPtr[xCtr]; @@ -311,8 +311,7 @@ void MSurface::copyFrom(MSurface *src, const Common::Point &destPos, int depth, distCtr += scale; if (distCtr < 100) { lineDist[distIndex] = false; - } - else { + } else { lineDist[distIndex] = true; distCtr -= 100; @@ -425,8 +424,7 @@ void MSurface::scrollX(int xAmount) { Common::copy(srcP + xSize, srcP + this->w, srcP); // Move buffered area to the end of the line Common::copy(&buffer[0], &buffer[xSize], srcP + this->w - xSize); - } - else { + } else { // Copy area to be overwritten Common::copy_backward(srcP + this->w - xSize, srcP + this->w, &buffer[80]); // Shift the remainder of the line over the given area @@ -459,8 +457,7 @@ void MSurface::scrollY(int yAmount) { pixelsP + (pitch * this->h)); // Transfer the buffered lines top the top of the screen Common::copy(tempData, tempData + blockSize, pixelsP); - } - else { + } else { // Buffer the lines to be overwritten Common::copy(pixelsP, pixelsP + (pitch * ySize), tempData); // Vertically shift all the lines diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index ac3f029cc9..2d123660bd 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -106,8 +106,7 @@ void Scene804::enter() { _globals._spriteIndexes[19] = _scene->_sequences.startCycle( _globals._spriteIndexes[4], 0, 1); _scene->_sequences.addTimer(60, 100); - } - else { + } else { _globals._spriteIndexes[20] = _scene->_sequences.startCycle( _globals._spriteIndexes[5], false, 1); _globals._spriteIndexes[21] = _scene->_sequences.startReverseCycle( @@ -115,8 +114,7 @@ void Scene804::enter() { _scene->_sequences.addTimer(160, 70); _game._player._stepEnabled = false; } - } - else { + } else { if (_globals[167] == 0) { _globals._spriteIndexes[22] = _scene->_sequences.startCycle( _globals._spriteIndexes[7], false, 1); diff --git a/engines/mads/resources.cpp b/engines/mads/resources.cpp index f85d5ce340..140a34749a 100644 --- a/engines/mads/resources.cpp +++ b/engines/mads/resources.cpp @@ -308,8 +308,7 @@ Common::String Resources::formatName(int prefix, char asciiCh, int id, EXTTYPE e Common::String result; if (prefix <= 0) { result = "*"; - } - else { + } else { result = Common::String::format("%s%.3d", (prefix < 100) ? "*SC" : "*RM", prefix); } diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 15577971e0..ebc35f0f27 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -170,7 +170,9 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) { _interfaceY = MADS_SCENE_HEIGHT; _spritesCount = _sprites.size(); - warning("TODO: sub_1EA80 / showMouse"); + _interface.setup(_screenObjects._v832EC); + + warning("TODO: showMouse"); warning("TODO: inventory_anim_allocate"); } diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index 18a3b6ceda..d2071e3ba5 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -199,8 +199,7 @@ void DirtyArea::setSpriteSlot(const SpriteSlot *spriteSlot) { if (spriteSlot->_scale == -1) { width = frame->w; height = frame->h; - } - else { + } else { width = frame->w * spriteSlot->_scale / 100; height = frame->h * spriteSlot->_scale / 100; diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index 67393fc75d..b8b2056c12 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -46,8 +46,9 @@ class SpriteSlot; #define DEPTH_BANDS_SIZE 15 #define MAX_ROUTE_NODES 22 -#define DIRTY_AREAS_SIZE 90 -#define DIRTY_AREAS_TEXT_DISPLAY_IDX 50 +#define SPRITE_SLOTS_MAX_SIZE 50 +#define TEXT_DISPLAY_MAX_SIZE 40 +#define DIRTY_AREAS_SIZE (SPRITE_SLOTS_MAX_SIZE + TEXT_DISPLAY_MAX_SIZE) enum ScrCategory { CAT_NONE = 0, CAT_ACTION = 1, CAT_INV_LIST = 2, CAT_INV_VOCAB = 3, diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index f703ce3b3a..dfb3d6fbcd 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -184,7 +184,7 @@ void SequenceList::setSpriteSlot(int seqIndex, SpriteSlot &spriteSlot) { if (!timerEntry._nonFixed) { spriteSlot._position = timerEntry._msgPos; } else { - spriteSlot._position = spriteSet.getFrame(timerEntry._frameIndex - 1)->_pos; + spriteSlot._position = spriteSet._pos; } } @@ -243,15 +243,13 @@ bool SequenceList::loadSprites(int seqIndex) { if (seqEntry._animType == ANIMTYPE_CYCLED) { // back to the starting frame (cyclic) seqEntry._frameIndex = seqEntry._frameStart; - } - else { + } else { // Switch into reverse mode seqEntry._frameIndex = seqEntry._numSprites - 1; seqEntry._frameInc = -1; } } - } - else { + } else { // Currently in reverse mode and moved past starting frame result = true; @@ -260,8 +258,7 @@ bool SequenceList::loadSprites(int seqIndex) { // Switch back to forward direction again seqEntry._frameIndex = seqEntry._frameStart + 1; seqEntry._frameInc = 1; - } - else { + } else { // Otherwise reset back to last sprite for further reverse animating seqEntry._frameIndex = seqEntry._numSprites; } @@ -271,8 +268,7 @@ bool SequenceList::loadSprites(int seqIndex) { if (--seqEntry._triggerCountdown == 0) seqEntry._doneFlag = true; } - } - else { + } else { // Out of sprite display slots, so mark entry as done seqEntry._doneFlag = true; } @@ -402,8 +398,9 @@ void SequenceList::setMsgPosition(int seqIndex, const Common::Point &pt) { int SequenceList::addSpriteCycle(int srcSpriteIdx, bool flipped, int numTicks, int triggerCountdown, int timeoutTicks, int extraTicks) { Scene &scene = _vm->_game->_scene; MSprite *spriteFrame = scene._sprites[srcSpriteIdx]->getFrame(0); - int depth = scene._depthSurface.getDepth(Common::Point(spriteFrame->_pos.x + - (spriteFrame->w / 2), spriteFrame->_pos.y + (spriteFrame->h / 2))); + int depth = scene._depthSurface.getDepth(Common::Point( + spriteFrame->_offset.x + (spriteFrame->w / 2), + spriteFrame->_offset.y + (spriteFrame->h / 2))); return add(srcSpriteIdx, flipped, 1, triggerCountdown, timeoutTicks, extraTicks, numTicks, 0, 0, true, 100, depth - 1, 1, ANIMTYPE_CYCLED, 0, 0); @@ -422,7 +419,7 @@ int SequenceList::startReverseCycle(int srcSpriteIndex, bool flipped, int numTic SpriteAsset *sprites = _vm->_game->_scene._sprites[srcSpriteIndex]; MSprite *frame = sprites->getFrame(0); int depth = _vm->_game->_scene._depthSurface.getDepth(Common::Point( - frame->_pos.x + frame->w / 2, frame->_pos.y + frame->h / 2)); + frame->_offset.x + frame->w / 2, frame->_offset.y + frame->h / 2)); return add(srcSpriteIndex, flipped, 1, triggerCountdown, timeoutTicks, extraTicks, numTicks, 0, 0, true, 100, depth - 1, 1, ANIMTYPE_REVERSIBLE, 0, 0); diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp index 398c1c91b7..228071af23 100644 --- a/engines/mads/sprites.cpp +++ b/engines/mads/sprites.cpp @@ -235,31 +235,33 @@ void SpriteSlots::drawBackground() { Scene &scene = _vm->_game->_scene; // Initial draw loop for any active sprites in the background - for (uint i = 0; i < scene._spriteSlots.size(); ++i) { - if (scene._spriteSlots[i]._spriteType >= ST_NONE) { - scene._dirtyAreas[i]._active = false; - } - else { - scene._dirtyAreas[i]._active = true; - scene._dirtyAreas[i].setSpriteSlot(&scene._spriteSlots[i]); + for (uint i = 0; i < size(); ++i) { + SpriteSlot &spriteSlot = (*this)[i]; + DirtyArea &dirtyArea = scene._dirtyAreas[i]; + + if (spriteSlot._spriteType >= ST_NONE) { + dirtyArea._active = false; + } else { + dirtyArea._active = true; + dirtyArea.setSpriteSlot(&spriteSlot); - SpriteAsset *asset = scene._sprites[scene._spriteSlots[i]._spritesIndex]; - MSprite *frame = asset->getFrame(scene._spriteSlots[i]._frameNumber); + SpriteAsset *asset = scene._sprites[spriteSlot._spritesIndex]; + MSprite *frame = asset->getFrame(spriteSlot._frameNumber); - if (scene._spriteSlots[i]._spriteType == ST_BACKGROUND) { - Common::Point pt = scene._spriteSlots[i]._position; - if (scene._spriteSlots[i]._scale != -1) { + if (spriteSlot._spriteType == ST_BACKGROUND) { + Common::Point pt = spriteSlot._position; + if (spriteSlot._scale != -1) { // Adjust the drawing position pt.x -= frame->w / 2; pt.y -= frame->h / 2; } - if (scene._spriteSlots[i]._depth <= 1) { - asset->draw(&scene._backgroundSurface, scene._spriteSlots[i]._frameNumber, pt); + if (spriteSlot._depth <= 1) { + asset->draw(&scene._backgroundSurface, spriteSlot._frameNumber, pt); } else if (scene._depthStyle == 0) { - asset->depthDraw(&scene._backgroundSurface, &scene._depthSurface, scene._spriteSlots[i]._frameNumber, - pt, scene._spriteSlots[i]._depth); + asset->depthDraw(&scene._backgroundSurface, &scene._depthSurface, spriteSlot._frameNumber, + pt, spriteSlot._depth); } else { error("Unsupported depth style"); } @@ -267,18 +269,20 @@ void SpriteSlots::drawBackground() { } } - // Mark any remaning dirty areas as inactive - for (uint i = scene._spriteSlots.size(); i < 50; ++i) + // Mark any remaning sprite slot dirty areas as inactive + for (uint i = size(); i < SPRITE_SLOTS_MAX_SIZE; ++i) scene._dirtyAreas[i]._active = false; // Flag any active text display - for (uint i = 50; i < scene._textDisplay.size(); ++i) { - TextDisplay &textDisplay = scene._textDisplay[i - 50]; - if (scene._textDisplay[i]._expire >= 0 || !textDisplay._active) { - scene._dirtyAreas[i]._active = false; + for (uint i = 0; i < scene._textDisplay.size(); ++i) { + TextDisplay &textDisplay = scene._textDisplay[i]; + DirtyArea &dirtyArea = scene._dirtyAreas[i + SPRITE_SLOTS_MAX_SIZE]; + + if (textDisplay._expire >= 0 || !textDisplay._active) { + dirtyArea._active = false; } else { - scene._dirtyAreas[i]._active = true; - scene._dirtyAreas[i].setTextDisplay(&textDisplay); + dirtyArea._active = true; + dirtyArea.setTextDisplay(&textDisplay); } } } @@ -289,8 +293,9 @@ void SpriteSlots::drawForeground(MSurface *s) { // Get a list of sprite object depths for active objects for (uint i = 0; i < size(); ++i) { - if ((*this)[i]._spriteType >= ST_NONE) { - DepthEntry rec(16 - (*this)[i]._depth, i); + SpriteSlot &spriteSlot = (*this)[i]; + if (spriteSlot._spriteType >= ST_NONE) { + DepthEntry rec(16 - spriteSlot._depth, i); depthList.push_back(rec); } } diff --git a/engines/mads/sprites.h b/engines/mads/sprites.h index 848aa1a488..603518a923 100644 --- a/engines/mads/sprites.h +++ b/engines/mads/sprites.h @@ -52,8 +52,7 @@ typedef struct { uint8 depth; // depth code for source (0 if no depth processing) } DrawRequestX; -typedef struct -{ +typedef struct { uint32 Pack; uint32 Stream; long hot_x; @@ -111,7 +110,6 @@ public: int widthVal, int heightVal, bool decodeRle = true, uint8 encodingVal = 0); virtual ~MSprite(); - Common::Point _pos; Common::Point _offset; uint8 _encoding; -- cgit v1.2.3 From 0df4d0aed1678f81cb75bb56cb2a1fc19603312c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 12 Mar 2014 23:45:57 -0400 Subject: MADS: Fixed loading of scene depth surface for Rex Nebular --- engines/mads/nebular/nebular_scenes.cpp | 9 ++++++-- engines/mads/nebular/nebular_scenes.h | 2 ++ engines/mads/palette.cpp | 4 ++-- engines/mads/palette.h | 4 ++-- engines/mads/scene_data.cpp | 39 +++++---------------------------- engines/mads/scene_data.h | 7 +++++- 6 files changed, 25 insertions(+), 40 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index baee40cc47..3587822f19 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -68,6 +68,13 @@ void SceneInfoNebular::loadCodes(MSurface &depthSurface) { MadsPack codesPack(&f); Common::SeekableReadStream *stream = codesPack.getItemStream(0); + loadCodes(depthSurface, stream); + + delete stream; + f.close(); +} + +void SceneInfoNebular::loadCodes(MSurface &depthSurface, Common::SeekableReadStream *stream) { byte *destP = depthSurface.getData(); byte *endP = depthSurface.getBasePtr(0, depthSurface.h); @@ -85,8 +92,6 @@ void SceneInfoNebular::loadCodes(MSurface &depthSurface) { if (destP < endP) Common::fill(destP, endP, 0); - delete stream; - f.close(); } } // End of namespace Nebular diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index da36c71905..5ac708d398 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -115,6 +115,8 @@ class SceneInfoNebular : public SceneInfo { protected: virtual void loadCodes(MSurface &depthSurface); + virtual void loadCodes(MSurface &depthSurface, Common::SeekableReadStream *stream); + /** * Constructor */ diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index 7e0d5bbdb5..b42fa144e7 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -229,7 +229,7 @@ int PaletteUsage::process(Common::Array &palette, uint flags) { palette[palIndex]._palIndex = var4; } - _vm->_palette->_rgbList[rgbIndex] = 0xffff; + _vm->_palette->_rgbList[rgbIndex] = -1; delete[] pal1; delete[] pal2; @@ -541,7 +541,7 @@ void Palette::resetGamePalette(int lowRange, int highRange) { } _rgbList.clear(); - _rgbList[0] = _rgbList[1] = 0xffff; + _rgbList[0] = _rgbList[1] = -1; _v1 = 0; _lowRange = lowRange; diff --git a/engines/mads/palette.h b/engines/mads/palette.h index 5f21bd9a21..906f62c3f3 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -100,7 +100,7 @@ public: class RGBList { private: - uint16 _data[32]; + int16 _data[32]; public: RGBList() { clear(); } @@ -113,7 +113,7 @@ public: */ int scan(); - uint16 &operator[](int idx) { return _data[idx]; } + int16 &operator[](int idx) { return _data[idx]; } }; #define PALETTE_COUNT 256 diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index d2071e3ba5..0cb273a0f4 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -383,7 +383,7 @@ SceneInfo *SceneInfo::init(MADSEngine *vm) { if (vm->getGameID() == GType_RexNebular) { return new Nebular::SceneInfoNebular(vm); } else { - return new SceneInfo(vm); + error("Unknown game"); } } @@ -453,9 +453,7 @@ void SceneInfo::load(int sceneId, int v1, const Common::String &resName, if (i < spriteInfoCount) spriteInfo.push_back(info); } - delete infoStream; - infoFile.close(); int width = _width; int height = _height; @@ -471,7 +469,11 @@ void SceneInfo::load(int sceneId, int v1, const Common::String &resName, } // Load the depth surface with the scene codes - loadCodes(depthSurface); + Common::SeekableReadStream *depthStream = infoPack.getItemStream(1); + loadCodes(depthSurface, depthStream); + delete depthStream; + + infoFile.close(); // Get the ART resource if (sceneFlag) { @@ -554,35 +556,6 @@ void SceneInfo::load(int sceneId, int v1, const Common::String &resName, } } -void SceneInfo::loadCodes(MSurface &depthSurface) { - File f(Resources::formatName(RESPREFIX_RM, _sceneId, ".DAT")); - MadsPack codesPack(&f); - Common::SeekableReadStream *stream = codesPack.getItemStream(0); - - uint16 width = _width; - uint16 height = _height; - byte *walkMap = new byte[stream->size()]; - - depthSurface.setSize(width, height); - stream->read(walkMap, f.size()); - delete stream; - f.close(); - - byte *ptr = (byte *)depthSurface.getPixels(); - - for (int y = 0; y < height; y++) { - for (int x = 0; x < width; x++) { - int ofs = x + (y * width); - if ((walkMap[ofs / 8] << (ofs % 8)) & 0x80) - *ptr++ = 1; // walkable - else - *ptr++ = 0; - } - } - - delete[] walkMap; -} - /*------------------------------------------------------------------------*/ SceneLogic::SceneLogic(MADSEngine *vm) : _vm(vm) { diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index b8b2056c12..d5c7281fae 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -253,7 +253,12 @@ protected: /** * Loads the given surface with depth information of a given scene */ - virtual void loadCodes(MSurface &depthSurface); + virtual void loadCodes(MSurface &depthSurface) = 0; + + /** + * Loads the given surface with depth information of a given scene + */ + virtual void loadCodes(MSurface &depthSurface, Common::SeekableReadStream *stream) = 0; public: int _sceneId; int _artFileNum; -- cgit v1.2.3 From e80373c823215c8d1ac59a6a1a81dc9233b1eb07 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 13 Mar 2014 00:26:19 -0400 Subject: MADS: Add guard against reading depth value outside bounds of depth surface --- engines/mads/msurface.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp index 2adb3e5b81..e8d391ff89 100644 --- a/engines/mads/msurface.cpp +++ b/engines/mads/msurface.cpp @@ -497,12 +497,14 @@ MSurface *MSurface::flipHorizontal() const { /*------------------------------------------------------------------------*/ int DepthSurface::getDepth(const Common::Point &pt) { - if (_vm->_game->_scene._sceneInfo->_depthStyle == 2) { int bits = (3 - (pt.x % 4)) * 2; byte v = *getBasePtr(pt.x >> 2, pt.y); return v >> bits; } else { + if (pt.x < 0 || pt.y < 0 || pt.x >= this->w || pt.y >= this->h) + return 8; + return *getBasePtr(pt.x, pt.y) & 0xF; } } -- cgit v1.2.3 From b2d90ddaab19702495a2dcc84be0de7443739f0b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 13 Mar 2014 13:05:12 -0400 Subject: MADS: Fix positioning of foreground sprites --- engines/mads/assets.h | 1 - engines/mads/sequence.cpp | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/mads/assets.h b/engines/mads/assets.h index b4856605eb..31d46881ff 100644 --- a/engines/mads/assets.h +++ b/engines/mads/assets.h @@ -78,7 +78,6 @@ private: public: SpriteSetCharInfo *_charInfo; int _usageIndex; - Common::Point _pos; public: /** * Constructor diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index dfb3d6fbcd..c03ff38c71 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -184,7 +184,8 @@ void SequenceList::setSpriteSlot(int seqIndex, SpriteSlot &spriteSlot) { if (!timerEntry._nonFixed) { spriteSlot._position = timerEntry._msgPos; } else { - spriteSlot._position = spriteSet._pos; + MSprite *sprite = spriteSet.getFrame(spriteSlot._frameNumber); + spriteSlot._position = sprite->_offset; } } -- cgit v1.2.3 From 84fb90e7a52daffd862159d54cda4817aa930a6f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 13 Mar 2014 20:56:03 -0400 Subject: MADS: Fix GCC warnings and memory leaks --- engines/mads/animation.cpp | 2 -- engines/mads/animation.h | 4 ++-- engines/mads/scene.cpp | 3 ++- engines/mads/scene_data.cpp | 5 +++++ engines/mads/scene_data.h | 2 +- engines/mads/sequence.cpp | 6 +++++- engines/mads/sprites.cpp | 11 +++++++++++ engines/mads/sprites.h | 10 ++++++++++ 8 files changed, 36 insertions(+), 7 deletions(-) diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index b5ebb2c278..09a9e1fc04 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -145,8 +145,6 @@ Animation::Animation(MADSEngine *vm, Scene *scene) : _vm(vm), _scene(scene) { Animation::~Animation() { delete _font; - for (uint i = 0; i < _spriteSets.size(); ++i) - delete _spriteSets[i]; } void Animation::free() { diff --git a/engines/mads/animation.h b/engines/mads/animation.h index 492fb9dbe4..c5308b7753 100644 --- a/engines/mads/animation.h +++ b/engines/mads/animation.h @@ -182,8 +182,8 @@ public: */ void update(); - virtual void setCurrentFrame(int frameNumber); - virtual int getCurrentFrame() const { return _currentFrame; } + void setCurrentFrame(int frameNumber); + int getCurrentFrame() const { return _currentFrame; } bool freeFlag() const { return _freeFlag; } bool getAnimMode() const { return _header._animMode; } diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index ebc35f0f27..ef5fd78f74 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -41,7 +41,8 @@ Scene::Scene(MADSEngine *vm): _vm(vm), _action(_vm), _depthSurface(vm), _animFlag = false; _animVal1 = 0; _depthStyle = 0; - _v1A = _v1C = 0; + _v1A = 0; + _v1C = 0; _roomChanged = false; _reloadSceneFlag = false; _destFacing = 0; diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index 0cb273a0f4..8f981ef37d 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -140,6 +140,11 @@ void ScreenObjects::proc1() { MADSEngine *DirtyArea::_vm = nullptr; +DirtyArea::DirtyArea() { + _active = false; + _textActive = false; +} + void DirtyArea::setArea(int width, int height, int maxWidth, int maxHeight) { if (_bounds.left % 2) { --_bounds.left; diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index d5c7281fae..d0c61ae3f7 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -124,7 +124,7 @@ public: bool _textActive; bool _active; - DirtyArea() { _active = false; } + DirtyArea(); void setArea(int width, int height, int maxWidth, int maxHeight); diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index c03ff38c71..c7cbf19693 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -41,11 +41,15 @@ namespace MADS { _dynamicHotspotIndex = -1; _triggerCountdown = 0; _doneFlag = 0; - _entries._count = 0; _abortMode = ABORTMODE_0; _numTicks = 0; _extraTicks = 0; _timeout = 0; + + _entries._count = 0; + Common::fill(&_entries._mode[0], &_entries._mode[TIMER_ENTRY_SUBSET_MAX], SM_0); + Common::fill(&_entries._frameIndex[0], &_entries._frameIndex[TIMER_ENTRY_SUBSET_MAX], 0); + Common::fill(&_entries._abortVal[0], &_entries._abortVal[TIMER_ENTRY_SUBSET_MAX], 0); } /*------------------------------------------------------------------------*/ diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp index 228071af23..a7a46ce29f 100644 --- a/engines/mads/sprites.cpp +++ b/engines/mads/sprites.cpp @@ -362,6 +362,10 @@ void SpriteSlots::cleanUp() { /*------------------------------------------------------------------------*/ +SpriteSets::~SpriteSets() { + clear(); +} + int SpriteSets::add(SpriteAsset *asset, int idx) { if (!idx) idx = size(); @@ -378,6 +382,13 @@ int SpriteSets::addSprites(const Common::String &resName, int flags) { return add(new SpriteAsset(_vm, resName, flags)); } +void SpriteSets::clear() { + for (uint i = 0; i < size(); ++i) + delete (*this)[i]; + + Common::Array::clear(); +} + /*------------------------------------------------------------------------*/ ImageInterEntry::ImageInterEntry() { diff --git a/engines/mads/sprites.h b/engines/mads/sprites.h index 603518a923..bf19be1afe 100644 --- a/engines/mads/sprites.h +++ b/engines/mads/sprites.h @@ -206,6 +206,16 @@ public: */ SpriteSets(MADSEngine *vm) : _vm(vm) {} + /** + * Destructor + */ + ~SpriteSets(); + + /** + * Clears the current list, freeing any laoded assets + */ + void clear(); + /** * Add a sprite asset to the list */ -- cgit v1.2.3 From 3f0cd4771c94a83c72f09f74ba351a3905357d1c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 13 Mar 2014 22:25:16 -0400 Subject: MADS: Fixed handling of dirty rects to copy areas to the physical screen --- engines/mads/dialogs.cpp | 2 +- engines/mads/game.cpp | 2 +- engines/mads/game_data.cpp | 2 +- engines/mads/graphics.cpp | 91 -------------------------- engines/mads/graphics.h | 86 ------------------------- engines/mads/mads.cpp | 2 +- engines/mads/mads.h | 2 +- engines/mads/messages.cpp | 2 +- engines/mads/module.mk | 2 +- engines/mads/msurface.cpp | 2 +- engines/mads/nebular/dialogs_nebular.cpp | 2 +- engines/mads/nebular/game_nebular.cpp | 2 +- engines/mads/scene.cpp | 4 +- engines/mads/scene.h | 2 +- engines/mads/scene_data.cpp | 20 ++++-- engines/mads/scene_data.h | 16 ++++- engines/mads/screen.cpp | 106 +++++++++++++++++++++++++++++++ engines/mads/screen.h | 99 +++++++++++++++++++++++++++++ engines/mads/sprites.cpp | 2 +- engines/mads/user_interface.cpp | 2 +- 20 files changed, 251 insertions(+), 197 deletions(-) delete mode 100644 engines/mads/graphics.cpp delete mode 100644 engines/mads/graphics.h create mode 100644 engines/mads/screen.cpp create mode 100644 engines/mads/screen.h diff --git a/engines/mads/dialogs.cpp b/engines/mads/dialogs.cpp index d159d48ace..571cca5d29 100644 --- a/engines/mads/dialogs.cpp +++ b/engines/mads/dialogs.cpp @@ -23,7 +23,7 @@ #include "common/scummsys.h" #include "common/config-manager.h" #include "mads/mads.h" -#include "mads/graphics.h" +#include "mads/screen.h" #include "mads/msurface.h" #include "mads/nebular/dialogs_nebular.h" diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 6a7f6fb18d..bcebc04a00 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -25,7 +25,7 @@ #include "mads/game.h" #include "mads/game_data.h" #include "mads/events.h" -#include "mads/graphics.h" +#include "mads/screen.h" #include "mads/msurface.h" #include "mads/resources.h" #include "mads/nebular/game_nebular.h" diff --git a/engines/mads/game_data.cpp b/engines/mads/game_data.cpp index ba24ed9ca1..cbc8f93a4b 100644 --- a/engines/mads/game_data.cpp +++ b/engines/mads/game_data.cpp @@ -24,7 +24,7 @@ #include "mads/mads.h" #include "mads/game.h" #include "mads/nebular/game_nebular.h" -#include "mads/graphics.h" +#include "mads/screen.h" #include "mads/msurface.h" #include "mads/resources.h" diff --git a/engines/mads/graphics.cpp b/engines/mads/graphics.cpp deleted file mode 100644 index 769b4dd2d2..0000000000 --- a/engines/mads/graphics.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* 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 "common/scummsys.h" -#include "mads/mads.h" -#include "mads/game.h" -#include "mads/graphics.h" -#include "mads/palette.h" - -namespace MADS { - -void ScreenSurface::init() { - setSize(g_system->getWidth(), g_system->getHeight()); -} - -void ScreenSurface::updateScreen() { - g_system->copyRectToScreen((const byte *)pixels, pitch, 0, 0, w, h); - g_system->updateScreen(); -} - -void ScreenSurface::transition(ScreenTransition transitionType, bool surfaceFlag) { - switch (transitionType) { - case kTransitionFadeOutIn: - fadeOut(); - fadeIn(); - break; - - case kTransitionFadeIn: - fadeIn(); - break; - - case kTransitionBoxInBottomLeft: - case kTransitionBoxInBottomRight: - case kTransitionBoxInTopLeft: - case kTransitionBoxInTopRight: - error("TODO: transition"); - break; - - case kTransitionPanLeftToRight: - case kTransitionPanRightToLeft: - error("TODO: transition"); - - case kTransitionCircleIn1: - case kTransitionCircleIn2: - case kTransitionCircleIn3: - case kTransitionCircleIn4: - error("TODO circle transition"); - - case kCenterVertTransition: - error("TODO: center vert transition"); - - default: - // Quick transitions - break; - } -} - -void ScreenSurface::setPointer(MSurface *s) { - _pixels = s->getData(); - _pitch = s->w; -} - -void ScreenSurface::fadeOut() { - warning("TODO: Proper fade out"); -} - -void ScreenSurface::fadeIn() { - warning("TODO: Proper fade in"); - _vm->_palette->setFullPalette(_vm->_palette->_mainPalette); -} - -} // End of namespace MADS diff --git a/engines/mads/graphics.h b/engines/mads/graphics.h deleted file mode 100644 index d4933ae68d..0000000000 --- a/engines/mads/graphics.h +++ /dev/null @@ -1,86 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef MADS_GRAPHICS_H -#define MADS_GRAPHICS_H - -#include "common/scummsys.h" -#include "common/array.h" -#include "mads/msurface.h" - -namespace MADS { - -#define MADS_SCREEN_WIDTH 320 -#define MADS_SCREEN_HEIGHT 200 - -enum ScreenTransition { - kTransitionNone = 0, - kTransitionFadeIn, kTransitionFadeOutIn, - kTransitionBoxInBottomLeft, kTransitionBoxInBottomRight, - kTransitionBoxInTopLeft, kTransitionBoxInTopRight, - kTransitionPanLeftToRight, kTransitionPanRightToLeft, - kTransitionCircleIn1, kTransitionCircleIn2, - kTransitionCircleIn3, kTransitionCircleIn4, - kVertTransition1, kVertTransition2, kVertTransition3, - kVertTransition4, kVertTransition5, kVertTransition6, - kVertTransition7, kCenterVertTransition -}; - -class ScreenSurface : public MSurface { -private: - /** - * Handles screen fade out - */ - void fadeOut(); - - /** - * Handles screen fade in - */ - void fadeIn(); -public: - Common::Point _offset; - byte *_pixels; - int _pitch; -public: - /** - * Constructor - */ - ScreenSurface() {} - - /** - * Initialise the surface - */ - void init(); - - void setPointer(MSurface *s); - - /** - * Updates the screen with the contents of the surface - */ - void updateScreen(); - - void transition(ScreenTransition transitionType, bool surfaceFlag); -}; - -} // End of namespace MADS - -#endif /* MADS_GRAPHICS_H */ diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index 6dfdf7b3b8..9cab1ad8f9 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -26,7 +26,7 @@ #include "common/events.h" #include "engines/util.h" #include "mads/mads.h" -#include "mads/graphics.h" +#include "mads/screen.h" #include "mads/msurface.h" #include "mads/resources.h" #include "mads/sound.h" diff --git a/engines/mads/mads.h b/engines/mads/mads.h index 2fbac32c4a..749c69a64c 100644 --- a/engines/mads/mads.h +++ b/engines/mads/mads.h @@ -35,7 +35,7 @@ #include "mads/events.h" #include "mads/font.h" #include "mads/game.h" -#include "mads/graphics.h" +#include "mads/screen.h" #include "mads/msurface.h" #include "mads/resources.h" #include "mads/sound.h" diff --git a/engines/mads/messages.cpp b/engines/mads/messages.cpp index dcac541cf8..21463aa58a 100644 --- a/engines/mads/messages.cpp +++ b/engines/mads/messages.cpp @@ -23,7 +23,7 @@ #include "common/scummsys.h" #include "mads/mads.h" #include "mads/font.h" -#include "mads/graphics.h" +#include "mads/screen.h" #include "mads/messages.h" #include "mads/scene_data.h" diff --git a/engines/mads/module.mk b/engines/mads/module.mk index 2f4982f9f8..a65519faea 100644 --- a/engines/mads/module.mk +++ b/engines/mads/module.mk @@ -18,7 +18,6 @@ MODULE_OBJS := \ font.o \ game.o \ game_data.o \ - graphics.o \ hotspots.o \ interface.o \ mads.o \ @@ -29,6 +28,7 @@ MODULE_OBJS := \ resources.o \ scene.o \ scene_data.o \ + screen.o \ sequence.o \ sound.o \ sprites.o \ diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp index e8d391ff89..c8c66234cb 100644 --- a/engines/mads/msurface.cpp +++ b/engines/mads/msurface.cpp @@ -22,7 +22,7 @@ #include "engines/util.h" #include "mads/compression.h" -#include "mads/graphics.h" +#include "mads/screen.h" #include "mads/mads.h" #include "mads/msurface.h" #include "mads/resources.h" diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp index 6d2321eae2..dc74f39fe8 100644 --- a/engines/mads/nebular/dialogs_nebular.cpp +++ b/engines/mads/nebular/dialogs_nebular.cpp @@ -23,7 +23,7 @@ #include "common/scummsys.h" #include "common/config-manager.h" #include "mads/mads.h" -#include "mads/graphics.h" +#include "mads/screen.h" #include "mads/msurface.h" #include "mads/nebular/dialogs_nebular.h" diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index 65abb40f1e..8948689622 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -24,7 +24,7 @@ #include "common/config-manager.h" #include "mads/mads.h" #include "mads/game.h" -#include "mads/graphics.h" +#include "mads/screen.h" #include "mads/msurface.h" #include "mads/nebular/game_nebular.h" #include "mads/nebular/dialogs_nebular.h" diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index ef5fd78f74..8bf0b6a527 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -438,7 +438,7 @@ void Scene::drawElements(ScreenTransition transitionType, bool surfaceFlag) { _dirtyAreas.merge(1, DIRTY_AREAS_SIZE); // Copy dirty areas to the main display surface - _dirtyAreas.copy(&_vm->_screen, &_backgroundSurface, _posAdjust); + _dirtyAreas.copy(&_backgroundSurface, &_vm->_screen, _posAdjust); // Handle dirty areas for foreground objects _spriteSlots.setDirtyAreas(); @@ -463,7 +463,7 @@ void Scene::drawElements(ScreenTransition transitionType, bool surfaceFlag) { _vm->_sound->startQueuedCommands(); } else { // Copy dirty areas to the screen - _dirtyAreas.copy(&_vm->_screen, &_backgroundSurface, _vm->_screen._offset); + _dirtyAreas.copyToScreen(_vm->_screen._offset); } warning("TODO: sub_115A2"); diff --git a/engines/mads/scene.h b/engines/mads/scene.h index 79c5910d85..0b20fb077f 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -27,7 +27,7 @@ #include "common/array.h" #include "common/rect.h" #include "mads/assets.h" -#include "mads/graphics.h" +#include "mads/screen.h" #include "mads/hotspots.h" #include "mads/messages.h" #include "mads/msurface.h" diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index 8f981ef37d..fe768934c3 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -24,7 +24,7 @@ #include "mads/scene_data.h" #include "mads/mads.h" #include "mads/compression.h" -#include "mads/graphics.h" +#include "mads/screen.h" #include "mads/resources.h" #include "mads/nebular/nebular_scenes.h" @@ -276,7 +276,20 @@ void DirtyAreas::mergeAreas(int idx1, int idx2) { da1._textActive = true; } -void DirtyAreas::copy(MSurface *dest, MSurface *src, const Common::Point &posAdjust) { +void DirtyAreas::copy(MSurface *srcSurface, MSurface *destSurface, const Common::Point &posAdjust) { + for (uint i = 0; i < size(); ++i) { + const Common::Rect &srcBounds = (*this)[i]._bounds; + + Common::Rect bounds(srcBounds.left + posAdjust.x, srcBounds.top + posAdjust.y, + srcBounds.right + posAdjust.x, srcBounds.bottom + posAdjust.y); + + if ((*this)[i]._active && bounds.isValidRect()) { + srcSurface->copyTo(destSurface, bounds, Common::Point(bounds.left, bounds.top)); + } + } +} + +void DirtyAreas::copyToScreen(const Common::Point &posAdjust) { for (uint i = 0; i < size(); ++i) { const Common::Rect &srcBounds = (*this)[i]._bounds; @@ -284,8 +297,7 @@ void DirtyAreas::copy(MSurface *dest, MSurface *src, const Common::Point &posAdj srcBounds.right + posAdjust.x, srcBounds.bottom + posAdjust.y); if ((*this)[i]._active && (*this)[i]._bounds.isValidRect()) { - src->copyTo(dest, bounds, Common::Point((*this)[i]._bounds.left, - (*this)[i]._bounds.top)); + _vm->_screen.copyRectToScreen(bounds); } } } diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index d0c61ae3f7..7a41bab1f8 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -151,7 +151,21 @@ public: bool intersects(int idx1, int idx2); void mergeAreas(int idx1, int idx2); - void copy(MSurface *dest, MSurface *src, const Common::Point &posAdjust); + + /** + * Copy the data specified by the dirty rect list between surfaces + * @param srcSurface Source surface + * @param destSurface Dest surface + * @param posAdjust Position adjustment + */ + void copy(MSurface *srcSurface, MSurface *destSurface, const Common::Point &posAdjust); + + /** + * Use the lsit of dirty areas to copy areas of the screen surface to + * the physical screen + * @param posAdjust Position adjustment */ + void copyToScreen(const Common::Point &posAdjust); + void reset(); }; diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp new file mode 100644 index 0000000000..20ff4f6df2 --- /dev/null +++ b/engines/mads/screen.cpp @@ -0,0 +1,106 @@ +/* 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 "common/scummsys.h" +#include "mads/mads.h" +#include "mads/game.h" +#include "mads/screen.h" +#include "mads/palette.h" + +namespace MADS { + +ScreenSurface::ScreenSurface() { + _dataP = nullptr; +} + +void ScreenSurface::init() { + setSize(g_system->getWidth(), g_system->getHeight()); +} + +void ScreenSurface::copyRectToScreen(const Common::Point &destPos, + const Common::Rect &bounds) { + byte *buf = getBasePtr(destPos.x, destPos.y); + g_system->copyRectToScreen(buf, this->pitch, bounds.left, bounds.top, + bounds.width(), bounds.height()); +} + +void ScreenSurface::copyRectToScreen(const Common::Rect &bounds) { + copyRectToScreen(Common::Point(bounds.left, bounds.top), bounds); +} + + +void ScreenSurface::updateScreen() { + g_system->updateScreen(); +} + +void ScreenSurface::transition(ScreenTransition transitionType, bool surfaceFlag) { + switch (transitionType) { + case kTransitionFadeOutIn: + fadeOut(); + fadeIn(); + break; + + case kTransitionFadeIn: + fadeIn(); + break; + + case kTransitionBoxInBottomLeft: + case kTransitionBoxInBottomRight: + case kTransitionBoxInTopLeft: + case kTransitionBoxInTopRight: + error("TODO: transition"); + break; + + case kTransitionPanLeftToRight: + case kTransitionPanRightToLeft: + error("TODO: transition"); + + case kTransitionCircleIn1: + case kTransitionCircleIn2: + case kTransitionCircleIn3: + case kTransitionCircleIn4: + error("TODO circle transition"); + + case kCenterVertTransition: + error("TODO: center vert transition"); + + default: + // Quick transitions + break; + } +} + +void ScreenSurface::setPointer(MSurface *s) { + _dataP = s->getData(); +} + +void ScreenSurface::fadeOut() { + warning("TODO: Proper fade out"); +} + +void ScreenSurface::fadeIn() { + warning("TODO: Proper fade in"); + _vm->_palette->setFullPalette(_vm->_palette->_mainPalette); + _vm->_screen.copyRectToScreen(Common::Rect(0, 0, 320, 200)); +} + +} // End of namespace MADS diff --git a/engines/mads/screen.h b/engines/mads/screen.h new file mode 100644 index 0000000000..e101020fc8 --- /dev/null +++ b/engines/mads/screen.h @@ -0,0 +1,99 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_SCREEN_H +#define MADS_SCREEN_H + +#include "common/scummsys.h" +#include "common/array.h" +#include "mads/msurface.h" + +namespace MADS { + +#define MADS_SCREEN_WIDTH 320 +#define MADS_SCREEN_HEIGHT 200 + +enum ScreenTransition { + kTransitionNone = 0, + kTransitionFadeIn, kTransitionFadeOutIn, + kTransitionBoxInBottomLeft, kTransitionBoxInBottomRight, + kTransitionBoxInTopLeft, kTransitionBoxInTopRight, + kTransitionPanLeftToRight, kTransitionPanRightToLeft, + kTransitionCircleIn1, kTransitionCircleIn2, + kTransitionCircleIn3, kTransitionCircleIn4, + kVertTransition1, kVertTransition2, kVertTransition3, + kVertTransition4, kVertTransition5, kVertTransition6, + kVertTransition7, kCenterVertTransition +}; + +class ScreenSurface : public MSurface { +private: + /** + * Handles screen fade out + */ + void fadeOut(); + + /** + * Handles screen fade in + */ + void fadeIn(); +public: + Common::Point _offset; + byte *_dataP; +public: + /** + * Constructor + */ + ScreenSurface(); + + /** + * Initialise the surface + */ + void init(); + + void setPointer(MSurface *s); + + /** + * Copys an area of the screen surface to a given destination position on + * the ScummVM physical screen buffer + * @param destPos Destination position + * @param bounds Area of screen surface to copy + */ + void copyRectToScreen(const Common::Point &destPos, const Common::Rect &bounds); + + /** + * Copys an area of the screen surface to the ScmmVM physical screen buffer + * @param bounds Area of screen surface to copy + */ + void copyRectToScreen(const Common::Rect &bounds); + + /** + * Updates the screen with the contents of the surface + */ + void updateScreen(); + + void transition(ScreenTransition transitionType, bool surfaceFlag); +}; + +} // End of namespace MADS + +#endif /* MADS_SCREEN_H */ diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp index a7a46ce29f..6f227fa341 100644 --- a/engines/mads/sprites.cpp +++ b/engines/mads/sprites.cpp @@ -24,7 +24,7 @@ #include "engines/util.h" #include "graphics/palette.h" #include "mads/mads.h" -#include "mads/graphics.h" +#include "mads/screen.h" #include "mads/msurface.h" #include "mads/sprites.h" diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 3bbf6a0b2b..ec5ca8a0b5 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -22,7 +22,7 @@ #include "common/scummsys.h" #include "mads/mads.h" -#include "mads/graphics.h" +#include "mads/screen.h" #include "mads/user_interface.h" #include "mads/msurface.h" -- cgit v1.2.3 From 12b79e817833fe17da717b88999da96e9bb1ec76 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 14 Mar 2014 21:56:01 -0400 Subject: MADS: Fix for sprite slot cleanup post-frame draw --- engines/mads/sprites.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp index 6f227fa341..ff953ac21c 100644 --- a/engines/mads/sprites.cpp +++ b/engines/mads/sprites.cpp @@ -240,6 +240,7 @@ void SpriteSlots::drawBackground() { DirtyArea &dirtyArea = scene._dirtyAreas[i]; if (spriteSlot._spriteType >= ST_NONE) { + // Foreground sprite, so we can ignore it dirtyArea._active = false; } else { dirtyArea._active = true; @@ -249,6 +250,7 @@ void SpriteSlots::drawBackground() { MSprite *frame = asset->getFrame(spriteSlot._frameNumber); if (spriteSlot._spriteType == ST_BACKGROUND) { + // Background object, so need to draw it Common::Point pt = spriteSlot._position; if (spriteSlot._scale != -1) { // Adjust the drawing position @@ -258,8 +260,7 @@ void SpriteSlots::drawBackground() { if (spriteSlot._depth <= 1) { asset->draw(&scene._backgroundSurface, spriteSlot._frameNumber, pt); - } - else if (scene._depthStyle == 0) { + } else if (scene._depthStyle == 0) { asset->depthDraw(&scene._backgroundSurface, &scene._depthSurface, spriteSlot._frameNumber, pt, spriteSlot._depth); } else { @@ -355,7 +356,7 @@ void SpriteSlots::drawForeground(MSurface *s) { void SpriteSlots::cleanUp() { for (int i = (int)size() - 1; i >= 0; --i) { - if ((*this)[i]._spriteType >= ST_NONE) + if ((*this)[i]._spriteType < ST_NONE) remove_at(i); } } -- cgit v1.2.3 From 37bb5150d0d2c901b9bb88ec009a348f1de3d5b0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 14 Mar 2014 22:21:52 -0400 Subject: MADS: Fixes for handling sprite transparency --- engines/mads/sprites.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp index ff953ac21c..2d318c5ae2 100644 --- a/engines/mads/sprites.cpp +++ b/engines/mads/sprites.cpp @@ -70,15 +70,15 @@ MSprite::MSprite(Common::SeekableReadStream *source, const Common::Point &offset MSprite::~MSprite() { } -// TODO: The sprite outlines (pixel value 0xFD) are not shown void MSprite::loadSprite(Common::SeekableReadStream *source) { byte *outp, *lineStart; bool newLine = false; outp = getData(); lineStart = getData(); + Common::fill(outp, outp + this->w * this->h, getTransparencyIndex()); - while (1) { + for (;;) { byte cmd1, cmd2, count, pixel; if (newLine) { @@ -101,7 +101,7 @@ void MSprite::loadSprite(Common::SeekableReadStream *source) { } else { pixel = source->readByte(); while (count--) - *outp++ = (pixel == 0xFD) ? 0 : pixel; + *outp++ = (pixel == 0xFD) ? getTransparencyIndex() : pixel; } } } else { @@ -113,9 +113,9 @@ void MSprite::loadSprite(Common::SeekableReadStream *source) { count = source->readByte(); pixel = source->readByte(); while (count--) - *outp++ = (pixel == 0xFD) ? 0 : pixel; + *outp++ = (pixel == 0xFD) ? getTransparencyIndex() : pixel; } else { - *outp++ = (cmd2 == 0xFD) ? 0 : cmd2; + *outp++ = (cmd2 == 0xFD) ? getTransparencyIndex() : cmd2; } } } -- cgit v1.2.3 From c9661ca88cbe3554a455c320fe7bcdcb203823a5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 15 Mar 2014 08:41:17 -0400 Subject: MADS: Fix off by 1 frame references in srite drawing --- engines/mads/interface.cpp | 6 ++-- engines/mads/palette.cpp | 71 +++++++++++++++++++++++++--------------------- engines/mads/palette.h | 3 ++ engines/mads/sequence.cpp | 3 +- engines/mads/sprites.cpp | 9 ++++-- 5 files changed, 53 insertions(+), 39 deletions(-) diff --git a/engines/mads/interface.cpp b/engines/mads/interface.cpp index 0c983dc133..8ea8913b69 100644 --- a/engines/mads/interface.cpp +++ b/engines/mads/interface.cpp @@ -53,9 +53,9 @@ void InterfaceSurface::load(const Common::String &resName) { byte *palP = &_vm->_palette->_mainPalette[0]; for (int i = 0; i < 16; ++i, gamePalP++, palP += 3) { - palP[0] = palStream->readByte(); - palP[1] = palStream->readByte(); - palP[2] = palStream->readByte(); + palP[0] = VGA_COLOR_TRANS(palStream->readByte()); + palP[1] = VGA_COLOR_TRANS(palStream->readByte()); + palP[2] = VGA_COLOR_TRANS(palStream->readByte()); *gamePalP |= 1; palStream->skip(3); } diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index b42fa144e7..9f6e3c77ae 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -28,8 +28,6 @@ namespace MADS { -#define VGA_COLOR_TRANS(x) (((((int)(x)) + 1) << 2) - 1) - void RGB6::load(Common::SeekableReadStream *f) { r = VGA_COLOR_TRANS(f->readByte()); g = VGA_COLOR_TRANS(f->readByte()); @@ -573,38 +571,47 @@ void Palette::initPalette() { _rgbList.reset(); } +const uint32 DEFAULT_VGA_PALETTE[PALETTE_COUNT] = { + 0x000000, 0x0000a8, 0x00a800, 0x00a8a8, 0xa80000, 0xa800a8, 0xa85400, 0xa8a8a8, + 0x545454, 0x5454fc, 0x54fc54, 0x54fcfc, 0xfc5454, 0xfc54fc, 0xfcfc54, 0xfcfcfc, + 0x000000, 0x141414, 0x202020, 0x2c2c2c, 0x383838, 0x444444, 0x505050, 0x606060, + 0x707070, 0x808080, 0x909090, 0xa0a0a0, 0xb4b4b4, 0xc8c8c8, 0xe0e0e0, 0xfcfcfc, + 0x0000fc, 0x4000fc, 0x7c00fc, 0xbc00fc, 0xfc00fc, 0xfc00bc, 0xfc007c, 0xfc0040, + 0xfc0000, 0xfc4000, 0xfc7c00, 0xfcbc00, 0xfcfc00, 0xbcfc00, 0x7cfc00, 0x40fc00, + 0x00fc00, 0x00fc40, 0x00fc7c, 0x00fcbc, 0x00fcfc, 0x00bcfc, 0x007cfc, 0x0040fc, + 0x7c7cfc, 0x9c7cfc, 0xbc7cfc, 0xdc7cfc, 0xfc7cfc, 0xfc7cdc, 0xfc7cbc, 0xfc7c9c, + 0xfc7c7c, 0xfc9c7c, 0xfcbc7c, 0xfcdc7c, 0xfcfc7c, 0xdcfc7c, 0xbcfc7c, 0x9cfc7c, + 0x7cfc7c, 0x7cfc9c, 0x7cfcbc, 0x7cfcdc, 0x7cfcfc, 0x7cdcfc, 0x7cbcfc, 0x7c9cfc, + 0xb4b4fc, 0xc4b4fc, 0xd8b4fc, 0xe8b4fc, 0xfcb4fc, 0xfcb4e8, 0xfcb4d8, 0xfcb4c4, + 0xfcb4b4, 0xfcc4b4, 0xfcd8b4, 0xfce8b4, 0xfcfcb4, 0xe8fcb4, 0xd8fcb4, 0xc4fcb4, + 0xb4fcb4, 0xb4fcc4, 0xb4fcd8, 0xb4fce8, 0xb4fcfc, 0xb4e8fc, 0xb4d8fc, 0xb4c4fc, + 0x000070, 0x1c0070, 0x380070, 0x540070, 0x700070, 0x700054, 0x700038, 0x70001c, + 0x700000, 0x701c00, 0x703800, 0x705400, 0x707000, 0x547000, 0x387000, 0x1c7000, + 0x007000, 0x00701c, 0x007038, 0x007054, 0x007070, 0x005470, 0x003870, 0x001c70, + 0x383870, 0x443870, 0x543870, 0x603870, 0x703870, 0x703860, 0x703854, 0x703844, + 0x703838, 0x704438, 0x705438, 0x706038, 0x707038, 0x607038, 0x547038, 0x447038, + 0x387038, 0x387044, 0x387054, 0x387060, 0x387070, 0x386070, 0x385470, 0x384470, + 0x505070, 0x585070, 0x605070, 0x685070, 0x705070, 0x705068, 0x705060, 0x705058, + 0x705050, 0x705850, 0x706050, 0x706850, 0x707050, 0x687050, 0x607050, 0x587050, + 0x507050, 0x507058, 0x507060, 0x507068, 0x507070, 0x506870, 0x506070, 0x505870, + 0x000040, 0x100040, 0x200040, 0x300040, 0x400040, 0x400030, 0x400020, 0x400010, + 0x400000, 0x401000, 0x402000, 0x403000, 0x404000, 0x304000, 0x204000, 0x104000, + 0x004000, 0x004010, 0x004020, 0x004030, 0x004040, 0x003040, 0x002040, 0x001040, + 0x202040, 0x282040, 0x302040, 0x382040, 0x402040, 0x402038, 0x402030, 0x402028, + 0x402020, 0x402820, 0x403020, 0x403820, 0x404020, 0x384020, 0x304020, 0x284020, + 0x204020, 0x204028, 0x204030, 0x204038, 0x204040, 0x203840, 0x203040, 0x202840, + 0x2c2c40, 0x302c40, 0x342c40, 0x3c2c40, 0x402c40, 0x402c3c, 0x402c34, 0x402c30, + 0x402c2c, 0x40302c, 0x40342c, 0x403c2c, 0x40402c, 0x3c402c, 0x34402c, 0x30402c, + 0x2c402c, 0x2c4030, 0x2c4034, 0x2c403c, 0x2c4040, 0x2c3c40, 0x2c3440, 0x2c3040, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000 +}; + void Palette::initVGAPalette(byte *palette) { - int var6 = 0; - int vdx = 0; - int vbx = 0; byte *destP = palette; - - do { - int vdi = (vdx == 1) ? 0x3F : 0x2A; - int var8 = 0; - int varE = vbx; - int var10 = vdx; - do { - vdx = 0; - do { - int vcx = 0; - int var4 = vdx; - do { - *destP++ = VGA_COLOR_TRANS((var8) ? vdi & 0xFF : vbx & 0XFF); - *destP++ = VGA_COLOR_TRANS((var4) ? vdi & 0xFF : vbx & 0XFF); - *destP++ = VGA_COLOR_TRANS((vcx) ? vdi & 0xFF : vbx & 0XFF); - } while (++vcx < 2); - - var6 += 2; - vdx = var4; - } while (++vdx < 2); - } while (++var8 < 2); - - vdx = var10 + 1; - vbx = varE + 21; - } while (vbx < 42); - - palette[19] = 21; + for (int palIndex = 0; palIndex < PALETTE_COUNT; ++palIndex) { + for (int byteCtr = 2; byteCtr >= 0; --byteCtr) + *destP++ = ((DEFAULT_VGA_PALETTE[palIndex] >> (8 * byteCtr)) & 0xff) >> 2; + } } void Palette::setLowRange() { diff --git a/engines/mads/palette.h b/engines/mads/palette.h index 906f62c3f3..1a540755d7 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -32,6 +32,9 @@ class MADSEngine; #define PALETTE_USAGE_COUNT 4 +//#define VGA_COLOR_TRANS(x) (((((int)(x)) + 1) << 2) - 1) +#define VGA_COLOR_TRANS(x) (x) + struct RGB4 { byte r; byte g; diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index c7cbf19693..1b4f8a9e6e 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -188,7 +188,8 @@ void SequenceList::setSpriteSlot(int seqIndex, SpriteSlot &spriteSlot) { if (!timerEntry._nonFixed) { spriteSlot._position = timerEntry._msgPos; } else { - MSprite *sprite = spriteSet.getFrame(spriteSlot._frameNumber); + assert(spriteSlot._frameNumber > 0); + MSprite *sprite = spriteSet.getFrame(spriteSlot._frameNumber - 1); spriteSlot._position = sprite->_offset; } } diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp index 2d318c5ae2..78743e6a87 100644 --- a/engines/mads/sprites.cpp +++ b/engines/mads/sprites.cpp @@ -246,11 +246,12 @@ void SpriteSlots::drawBackground() { dirtyArea._active = true; dirtyArea.setSpriteSlot(&spriteSlot); - SpriteAsset *asset = scene._sprites[spriteSlot._spritesIndex]; - MSprite *frame = asset->getFrame(spriteSlot._frameNumber); - if (spriteSlot._spriteType == ST_BACKGROUND) { // Background object, so need to draw it + assert(spriteSlot._frameNumber > 0); + SpriteAsset *asset = scene._sprites[spriteSlot._spritesIndex]; + MSprite *frame = asset->getFrame(spriteSlot._frameNumber - 1); + Common::Point pt = spriteSlot._position; if (spriteSlot._scale != -1) { // Adjust the drawing position @@ -315,6 +316,8 @@ void SpriteSlots::drawForeground(MSurface *s) { // Get the sprite frame int frameNumber = slot._frameNumber & 0x7fff; bool flipped = (slot._frameNumber & 0x8000) != 0; + + assert(frameNumber > 0); MSprite *sprite = spriteSet.getFrame(frameNumber - 1); MSurface *spr = sprite; -- cgit v1.2.3 From d2bbdd255a43915267bac8dce6998c8f843979da Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 15 Mar 2014 11:12:31 -0400 Subject: MADS: Implement palette shifting for loaded sprites --- engines/mads/assets.cpp | 24 +++++++++++++++--------- engines/mads/palette.cpp | 15 --------------- engines/mads/palette.h | 8 +------- engines/mads/sprites.cpp | 25 +++++++++++++++++-------- engines/mads/sprites.h | 6 +++--- 5 files changed, 36 insertions(+), 42 deletions(-) diff --git a/engines/mads/assets.cpp b/engines/mads/assets.cpp index 1c958adfce..136a3fffd6 100644 --- a/engines/mads/assets.cpp +++ b/engines/mads/assets.cpp @@ -73,10 +73,20 @@ void SpriteAsset::load(Common::SeekableReadStream *stream, int flags) { delete spriteStream; // Get the palette data - spriteStream = sprite.getItemStream(2); - _vm->_palette->decodePalette(spriteStream, flags); + Common::SeekableReadStream *palStream = sprite.getItemStream(2); + Common::Array palette; - delete spriteStream; + int numColors = palStream->readUint16LE(); + assert(numColors <= 252); + + // Load in the palette + palette.resize(numColors); + for (int i = 0; i < numColors; ++i) + palette[i].load(palStream); + + // Process the palette data + _vm->_palette->_paletteUsage.process(palette, flags); + delete palStream; spriteStream = sprite.getItemStream(1); Common::SeekableReadStream *spriteDataStream = sprite.getItemStream(3); @@ -103,9 +113,7 @@ void SpriteAsset::load(Common::SeekableReadStream *stream, int flags) { if (_mode == 0) { // Create a frame and decompress the raw pixel data uint32 currPos = (uint32)spriteDataStream->pos(); - frame._frame = new MSprite(spriteDataStream, - Common::Point(frame._bounds.left, frame._bounds.top), - frame._bounds.width(), frame._bounds.height(), false); + frame._frame = new MSprite(spriteDataStream, palette, frame._bounds); assert((uint32)spriteDataStream->pos() == (currPos + frameSize)); } @@ -130,9 +138,7 @@ void SpriteAsset::load(Common::SeekableReadStream *stream, int flags) { // Load the frames Common::MemoryReadStream *rs = new Common::MemoryReadStream(destData, frameSizes[curFrame]); - _frames[curFrame]._frame = new MSprite(rs, - Common::Point(_frames[curFrame]._bounds.left, _frames[curFrame]._bounds.top), - _frames[curFrame]._bounds.width(), _frames[curFrame]._bounds.height(), false); + _frames[curFrame]._frame = new MSprite(rs, palette, _frames[curFrame]._bounds); delete rs; delete[] srcData; diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index 9f6e3c77ae..8f803d109f 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -497,21 +497,6 @@ void Palette::processLists(int count, byte *pal1, byte *pal2) { } while (continueFlag); } - -void Palette::decodePalette(Common::SeekableReadStream *palStream, uint flags) { - int numColors = palStream->readUint16LE(); - assert(numColors <= 252); - - // Load in the palette - Common::Array palette; - palette.resize(numColors); - for (int i = 0; i < numColors; ++i) - palette[i].load(palStream); - - // Process the palette data - _paletteUsage.process(palette, flags); -} - void Palette::setSystemPalette() { byte palData[4 * 3]; palData[0 * 3] = palData[0 * 3 + 1] = palData[0 * 3 + 2] = 0; diff --git a/engines/mads/palette.h b/engines/mads/palette.h index 1a540755d7..5a563a5aa5 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -32,8 +32,7 @@ class MADSEngine; #define PALETTE_USAGE_COUNT 4 -//#define VGA_COLOR_TRANS(x) (((((int)(x)) + 1) << 2) - 1) -#define VGA_COLOR_TRANS(x) (x) +#define VGA_COLOR_TRANS(x) (((((int)(x)) + 1) << 2) - 1) struct RGB4 { byte r; @@ -187,11 +186,6 @@ public: */ uint8 palIndexFromRgb(byte r, byte g, byte b, byte *paletteData = nullptr); - /** - * Decodes a palette and loads it into the main palette - */ - void decodePalette(Common::SeekableReadStream *palStream, uint flags); - /** * Sets a small set of system/core colors needed by the game */ diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp index 78743e6a87..1b65442b4c 100644 --- a/engines/mads/sprites.cpp +++ b/engines/mads/sprites.cpp @@ -58,25 +58,27 @@ MSprite::MSprite(): MSurface() { _encoding = 0; } -MSprite::MSprite(Common::SeekableReadStream *source, const Common::Point &offset, - int widthVal, int heightVal, bool decodeRle, uint8 encodingVal) - : MSurface(widthVal, heightVal), - _encoding(encodingVal), _offset(offset) { - +MSprite::MSprite(Common::SeekableReadStream *source, const Common::Array &palette, + const Common::Rect &bounds): + MSurface(bounds.width(), bounds.height()), + _encoding(0), _offset(Common::Point(bounds.left, bounds.top)) { // Load the sprite data - loadSprite(source); + loadSprite(source, palette); } MSprite::~MSprite() { } -void MSprite::loadSprite(Common::SeekableReadStream *source) { +void MSprite::loadSprite(Common::SeekableReadStream *source, + const Common::Array &palette) { byte *outp, *lineStart; bool newLine = false; outp = getData(); lineStart = getData(); - Common::fill(outp, outp + this->w * this->h, getTransparencyIndex()); + int spriteSize = this->w * this->h; + byte transIndex = getTransparencyIndex(); + Common::fill(outp, outp + spriteSize, transIndex); for (;;) { byte cmd1, cmd2, count, pixel; @@ -120,6 +122,13 @@ void MSprite::loadSprite(Common::SeekableReadStream *source) { } } } + + // Do a final iteration over the sprite to convert it's pixels to + // the final positions in the main palette + for (outp = getData(); spriteSize > 0; --spriteSize, ++outp) { + if (*outp != transIndex) + *outp = palette[*outp]._palIndex; + } } byte MSprite::getTransparencyIndex() const { diff --git a/engines/mads/sprites.h b/engines/mads/sprites.h index bf19be1afe..e0e91dc974 100644 --- a/engines/mads/sprites.h +++ b/engines/mads/sprites.h @@ -103,11 +103,11 @@ struct SpriteFrameHeader { class MSprite: public MSurface { private: - void loadSprite(Common::SeekableReadStream *source); + void loadSprite(Common::SeekableReadStream *source, const Common::Array &palette); public: MSprite(); - MSprite(Common::SeekableReadStream *source, const Common::Point &offset, - int widthVal, int heightVal, bool decodeRle = true, uint8 encodingVal = 0); + MSprite(Common::SeekableReadStream *source, const Common::Array &palette, + const Common::Rect &bounds); virtual ~MSprite(); Common::Point _offset; -- cgit v1.2.3 From 49ca357e9ef19aa2650ca42b1f42c8aacf937ec6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 15 Mar 2014 11:22:19 -0400 Subject: MADS: Remove redundant _encoding field from MSprite --- engines/mads/sprites.cpp | 3 +-- engines/mads/sprites.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp index 1b65442b4c..8979fdb12c 100644 --- a/engines/mads/sprites.cpp +++ b/engines/mads/sprites.cpp @@ -55,13 +55,12 @@ typedef Common::List DepthList; /*------------------------------------------------------------------------*/ MSprite::MSprite(): MSurface() { - _encoding = 0; } MSprite::MSprite(Common::SeekableReadStream *source, const Common::Array &palette, const Common::Rect &bounds): MSurface(bounds.width(), bounds.height()), - _encoding(0), _offset(Common::Point(bounds.left, bounds.top)) { + _offset(Common::Point(bounds.left, bounds.top)) { // Load the sprite data loadSprite(source, palette); } diff --git a/engines/mads/sprites.h b/engines/mads/sprites.h index e0e91dc974..2d5b2089b9 100644 --- a/engines/mads/sprites.h +++ b/engines/mads/sprites.h @@ -111,7 +111,6 @@ public: virtual ~MSprite(); Common::Point _offset; - uint8 _encoding; byte getTransparencyIndex() const; }; -- cgit v1.2.3 From e00a1b88ca7500516d78f4bad515b5a558af82a6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 15 Mar 2014 14:08:43 -0400 Subject: MADS: Perform palette translation on background --- engines/mads/scene_data.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index fe768934c3..de053a62e9 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -535,6 +535,11 @@ void SceneInfo::load(int sceneId, int v1, const Common::String &resName, stream = artResource.getItemStream(1); stream->read(bgSurface.getPixels(), bgSurface.w * bgSurface.h); + if (!(flags & 1)) { + // Translate the background to use the correct palette indexes + bgSurface.translate(artHeader._palette); + } + // Close the ART file delete stream; artFile.close(); -- cgit v1.2.3 From 10124f6806150aad409f6db9a6c7a60afcb44872 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 15 Mar 2014 17:38:44 -0400 Subject: MADS: Implemented scene 103 setup and needed support methods --- engines/mads/game.h | 5 +- engines/mads/game_data.cpp | 62 +------------- engines/mads/game_data.h | 52 ++--------- engines/mads/hotspots.cpp | 6 ++ engines/mads/hotspots.h | 4 + engines/mads/inventory.cpp | 92 ++++++++++++++++++++ engines/mads/inventory.h | 87 +++++++++++++++++++ engines/mads/messages.cpp | 23 +++++ engines/mads/messages.h | 1 + engines/mads/module.mk | 2 + engines/mads/nebular/globals_nebular.cpp | 4 +- engines/mads/nebular/globals_nebular.h | 4 +- engines/mads/nebular/nebular_scenes.cpp | 34 ++++++++ engines/mads/nebular/nebular_scenes.h | 17 +++- engines/mads/nebular/nebular_scenes1.cpp | 142 +++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes1.h | 31 ++++++- engines/mads/nebular/nebular_scenes8.cpp | 77 ++++++++--------- engines/mads/palette.cpp | 6 +- engines/mads/scene.h | 2 +- engines/mads/sequence.cpp | 15 ++++ engines/mads/sequence.h | 7 +- 21 files changed, 515 insertions(+), 158 deletions(-) create mode 100644 engines/mads/inventory.cpp create mode 100644 engines/mads/inventory.h diff --git a/engines/mads/game.h b/engines/mads/game.h index 01f23605d5..8e1559ed21 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -27,6 +27,7 @@ #include "common/str-array.h" #include "mads/scene.h" #include "mads/game_data.h" +#include "mads/inventory.h" #include "mads/player.h" namespace MADS { @@ -64,9 +65,7 @@ protected: int _saveSlot; int _statusFlag; SectionHandler *_sectionHandler; - VisitedScenes _visitedScenes; Common::StringArray _quotes; - int _v3; int _v5; int _v6; bool _updateSceneFlag; @@ -117,9 +116,11 @@ public: int _priorSectionNumber; int _currentSectionNumber; InventoryObjects _objects; + VisitedScenes _visitedScenes; Scene _scene; int _v1; int _v2; + int _v3; int _v4; int _abortTimers; int _abortTimers2; diff --git a/engines/mads/game_data.cpp b/engines/mads/game_data.cpp index cbc8f93a4b..0f41692e2c 100644 --- a/engines/mads/game_data.cpp +++ b/engines/mads/game_data.cpp @@ -31,7 +31,9 @@ namespace MADS { void VisitedScenes::add(int sceneId) { - if (!exists(sceneId)) + _sceneRevisited = exists(sceneId); + + if (!_sceneRevisited) push_back(sceneId); } @@ -44,62 +46,4 @@ bool VisitedScenes::exists(int sceneId) { return false; } -void InventoryObject::load(Common::SeekableReadStream &f) { - _descId = f.readUint16LE(); - _roomNumber = f.readUint16LE(); - _article = f.readByte(); - _vocabCount = f.readByte(); - - for (int i = 0; i < 3; ++i) { - _vocabList[i]._actionFlags1 = f.readByte(); - _vocabList[i]._actionFlags2 = f.readByte(); - _vocabList[i]._vocabId = f.readUint16LE(); - } - - f.skip(4); // field12 - f.read(&_mutilateString[0], 10); - f.skip(16); -} - -/*------------------------------------------------------------------------*/ - -void InventoryObjects::load() { - File f("*OBJECTS.DAT"); - - // Get the total numer of inventory objects - int count = f.readUint16LE(); - reserve(count); - - // Read in each object - for (int i = 0; i < count; ++i) { - InventoryObject obj; - obj.load(f); - push_back(obj); - - // If it's for the player's inventory, add the index to the inventory list - if (obj._roomNumber == PLAYER_INVENTORY) { - _inventoryList.push_back(i); - assert(_inventoryList.size() <= 32); - } - } -} - -void InventoryObjects::setData(int objIndex, int id, const byte *p) { - // TODO: This whole method seems weird. Check it out more thoroughly once - // more of the engine is implemented - for (int i = 0; i < (int)size(); ++i) { - InventoryObject &obj = (*this)[i]; - if (obj._vocabList[0]._actionFlags1 <= i) - break; - - if (obj._mutilateString[6 + i] == id) { - (*this)[objIndex]._objFolder = p; - } - } -} - -void InventoryObjects::setRoom(int objectId, int roomNumber) { - warning("TODO: setObjectRoom"); -} - } // End of namespace MADS diff --git a/engines/mads/game_data.h b/engines/mads/game_data.h index 56ab3665e3..7674beed81 100644 --- a/engines/mads/game_data.h +++ b/engines/mads/game_data.h @@ -33,6 +33,11 @@ class Game; class VisitedScenes: public Common::Array { public: + /** + * Stores true when a previously visited scene is revisited + */ + bool _sceneRevisited; + /** * Returns true if a given Scene Id exists in the listed of previously visited scenes. */ @@ -44,53 +49,6 @@ public: void add(int sceneId); }; -class InventoryObject { -public: - int _descId; - int _roomNumber; - int _article; - int _vocabCount; - struct { - int _actionFlags1; - int _actionFlags2; - int _vocabId; - } _vocabList[3]; - char _mutilateString[10]; // ??? - const byte *_objFolder; // ??? - - /** - * Loads the data for a given object - */ - void load(Common::SeekableReadStream &f); -}; - -class InventoryObjects: public Common::Array { -private: - MADSEngine *_vm; -public: - Common::Array _inventoryList; - - /** - * Constructor - */ - InventoryObjects(MADSEngine *vm): _vm(vm) {} - - /** - * Loads the game's object list - */ - void load(); - - /** - * Set the associated data? pointer with an inventory object - */ - void setData(int objIndex, int id, const byte *p); - - /** - * Sets the room number - */ - void setRoom(int objectId, int roomNumber); -}; - class SectionHandler { protected: MADSEngine *_vm; diff --git a/engines/mads/hotspots.cpp b/engines/mads/hotspots.cpp index a3660dfd81..d754c47fe3 100644 --- a/engines/mads/hotspots.cpp +++ b/engines/mads/hotspots.cpp @@ -139,4 +139,10 @@ void DynamicHotspots::refresh() { } } +/*------------------------------------------------------------------------*/ + +void Hotspots::activate(int hotspotId, bool active) { + warning("TODO: Hotspots::activate"); +} + } // End of namespace MADS diff --git a/engines/mads/hotspots.h b/engines/mads/hotspots.h index acbc72d60d..0dcde1d14b 100644 --- a/engines/mads/hotspots.h +++ b/engines/mads/hotspots.h @@ -82,6 +82,10 @@ public: Hotspot(Common::SeekableReadStream &f); }; +class Hotspots : public Common::Array { +public: + void activate(int hotspotId, bool active); +}; } // End of namespace MADS diff --git a/engines/mads/inventory.cpp b/engines/mads/inventory.cpp new file mode 100644 index 0000000000..89eaaadb1b --- /dev/null +++ b/engines/mads/inventory.cpp @@ -0,0 +1,92 @@ +/* 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 "common/scummsys.h" +#include "mads/mads.h" +#include "mads/inventory.h" + +namespace MADS { + +void InventoryObject::load(Common::SeekableReadStream &f) { + _descId = f.readUint16LE(); + _roomNumber = f.readUint16LE(); + _article = f.readByte(); + _vocabCount = f.readByte(); + + for (int i = 0; i < 3; ++i) { + _vocabList[i]._actionFlags1 = f.readByte(); + _vocabList[i]._actionFlags2 = f.readByte(); + _vocabList[i]._vocabId = f.readUint16LE(); + } + + f.skip(4); // field12 + f.read(&_mutilateString[0], 10); + f.skip(16); +} + +/*------------------------------------------------------------------------*/ + +void InventoryObjects::load() { + File f("*OBJECTS.DAT"); + + // Get the total numer of inventory objects + int count = f.readUint16LE(); + reserve(count); + + // Read in each object + for (int i = 0; i < count; ++i) { + InventoryObject obj; + obj.load(f); + push_back(obj); + + // If it's for the player's inventory, add the index to the inventory list + if (obj._roomNumber == PLAYER_INVENTORY) { + _inventoryList.push_back(i); + assert(_inventoryList.size() <= 32); + } + } +} + +void InventoryObjects::setData(int objIndex, int id, const byte *p) { + // TODO: This whole method seems weird. Check it out more thoroughly once + // more of the engine is implemented + for (int i = 0; i < (int)size(); ++i) { + InventoryObject &obj = (*this)[i]; + if (obj._vocabList[0]._actionFlags1 <= i) + break; + + if (obj._mutilateString[6 + i] == id) { + (*this)[objIndex]._objFolder = p; + } + } +} + +void InventoryObjects::setRoom(int objectId, int roomNumber) { + warning("TODO: setObjectRoom"); +} + +bool InventoryObjects::isInRoom(int objectId) const { + return (*this)[objectId]._roomNumber == _vm->_game->_scene._currentSceneId; +} + + +} // End of namespace MADS diff --git a/engines/mads/inventory.h b/engines/mads/inventory.h new file mode 100644 index 0000000000..57ae43b059 --- /dev/null +++ b/engines/mads/inventory.h @@ -0,0 +1,87 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_INVENTORY_H +#define MADS_INVENTORY_H + +#include "common/scummsys.h" +#include "common/array.h" + +namespace MADS { + +class MADSEngine; + +class InventoryObject { +public: + int _descId; + int _roomNumber; + int _article; + int _vocabCount; + struct { + int _actionFlags1; + int _actionFlags2; + int _vocabId; + } _vocabList[3]; + char _mutilateString[10]; // ??? + const byte *_objFolder; // ??? + + /** + * Loads the data for a given object + */ + void load(Common::SeekableReadStream &f); +}; + +class InventoryObjects: public Common::Array { +private: + MADSEngine *_vm; +public: + Common::Array _inventoryList; + + /** + * Constructor + */ + InventoryObjects(MADSEngine *vm): _vm(vm) {} + + /** + * Loads the game's object list + */ + void load(); + + /** + * Set the associated data? pointer with an inventory object + */ + void setData(int objIndex, int id, const byte *p); + + /** + * Sets the room number + */ + void setRoom(int objectId, int roomNumber); + + /** + * Returns true if a given object is in the player's current scene + */ + bool isInRoom(int objectId) const; +}; + +} // End of namespace MADS + +#endif /* MADS_INVENTORY_H */ diff --git a/engines/mads/messages.cpp b/engines/mads/messages.cpp index 21463aa58a..a9ce093c1f 100644 --- a/engines/mads/messages.cpp +++ b/engines/mads/messages.cpp @@ -283,6 +283,29 @@ void KernelMessages::delay(uint32 priorFrameTime, uint32 currentTime) { } } +void KernelMessages::setQuoted(int msgIndex, int numTicks, bool quoted) { + if (msgIndex >= 0) { + KernelMessage &msg = _entries[msgIndex]; + + msg._flags |= KMSG_SCROLL; + if (quoted) + msg._flags |= KMSG_QUOTED; + + msg._msgOffset = 0; + msg._numTicks = numTicks; + msg._frameTimer2 = _vm->_game->_scene._frameStartTime; + msg._asciiChar = msg._msg[0]; + msg._asciiChar2 = msg._msg[1]; + + if (msg._flags & KMSG_PLAYER_TIMEOUT) { + msg._frameTimer2 = _vm->_game->_player._priorTimer + + _vm->_game->_player._ticksAmount; + } + + msg._frameTimer = msg._frameTimer2; + } +} + /*------------------------------------------------------------------------*/ TextDisplay::TextDisplay() { diff --git a/engines/mads/messages.h b/engines/mads/messages.h index 340f33ef46..205cbf8f30 100644 --- a/engines/mads/messages.h +++ b/engines/mads/messages.h @@ -88,6 +88,7 @@ public: void update(); void processText(int msgIndex); void delay(uint32 priorFrameTime, uint32 currentTime); + void setQuoted(int msgIndex, int numTicks, bool quoted); }; class TextDisplay { diff --git a/engines/mads/module.mk b/engines/mads/module.mk index a65519faea..76d80bc3e3 100644 --- a/engines/mads/module.mk +++ b/engines/mads/module.mk @@ -6,6 +6,7 @@ MODULE_OBJS := \ nebular/globals_nebular.o \ nebular/sound_nebular.o \ nebular/nebular_scenes.o \ + nebular/nebular_scenes1.o \ nebular/nebular_scenes8.o \ action.o \ animation.o \ @@ -20,6 +21,7 @@ MODULE_OBJS := \ game_data.o \ hotspots.o \ interface.o \ + inventory.o \ mads.o \ messages.o \ msurface.o \ diff --git a/engines/mads/nebular/globals_nebular.cpp b/engines/mads/nebular/globals_nebular.cpp index 37ebf5f8d6..3c16cd180b 100644 --- a/engines/mads/nebular/globals_nebular.cpp +++ b/engines/mads/nebular/globals_nebular.cpp @@ -34,8 +34,8 @@ Globals::Globals() { _spriteIndexes.resize(30); // Initialise game flags - _chairHotspotIndex = 0; - _v1 = 0; + _v0 = 0; + _frameTime = 0; _v2 = 0; _v3 = 0; _v4 = 0; diff --git a/engines/mads/nebular/globals_nebular.h b/engines/mads/nebular/globals_nebular.h index 31340446d2..b2a1f0d497 100644 --- a/engines/mads/nebular/globals_nebular.h +++ b/engines/mads/nebular/globals_nebular.h @@ -37,8 +37,8 @@ private: public: Common::Array _spriteIndexes; - int _chairHotspotIndex; - int _v1; + int _v0; + uint32 _frameTime; int _v2; int _v3; int _v4; diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 3587822f19..6644d957ed 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -61,6 +61,40 @@ Common::String NebularScene::formAnimName(char sepChar, int suffixNum) { EXT_NONE, ""); } +void NebularScene::setPlayerSpritesPrefix() { + _vm->_sound->command(5); + Common::String oldName = _game._player._spritesPrefix; + if (_scene->_nextSceneId <= 103 || _scene->_nextSceneId == 111) { + if (_globals[0] == SEX_FEMALE) { + _game._player._spritesPrefix = "ROX"; + } else { + _game._player._spritesPrefix = "RXM"; + _globals[0] = SEX_MALE; + } + } else if (_scene->_nextSceneId <= 110) { + _game._player._spritesPrefix = "RXSW"; + _globals[0] = SEX_UNKNOWN; + } else if (_scene->_nextSceneId == 112) { + _game._player._spritesPrefix = ""; + } + + if (oldName == _game._player._spritesPrefix) + _game._player._spritesChanged = true; + if (_scene->_nextSceneId == 105 || (_scene->_nextSceneId == 109 && _globals[15])) { + _game._player._spritesChanged = true; + _game._v3 = 0; + } + + _game._player._unk3 = 0; + _vm->_palette->setEntry(16, 10, 63, 63); + _vm->_palette->setEntry(17, 10, 45, 45); +} + +void NebularScene::setAAName() { + int idx = (_scene->_nextSceneId > 103 && _scene->_nextSceneId < 112) ? 1 : 0; + _game._aaName = Resources::formatAAName(idx); +} + /*------------------------------------------------------------------------*/ void SceneInfoNebular::loadCodes(MSurface &depthSurface) { diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index 5ac708d398..4da8b49996 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -35,7 +35,7 @@ namespace MADS { namespace Nebular { enum { - SEX_MALE = 0, SEX_FEMALE = 2 + SEX_MALE = 0, SEX_UNKNOWN = 1, SEX_FEMALE = 2 }; enum Noun { @@ -103,6 +103,21 @@ protected: * Forms an animation resoucre name */ Common::String formAnimName(char sepChar, int suffixNum); + + /** + *Sets the AA file to use for the scene + */ + void setAAName(); + + /** + * Updates the prefix used for getting player sprites for the scene + */ + void setPlayerSpritesPrefix(); + + /** + * Plays appropriate sound for entering varous rooms + */ + void lowRoomsEntrySound(); public: /** * Constructor diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 1de4eca509..d684f02c84 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -30,6 +30,41 @@ namespace MADS { namespace Nebular { +void Scene1xx::sceneEntrySound() { + if (_vm->_musicFlag) { + switch (_scene->_nextSceneId) { + case 101: + _vm->_sound->command(11); + break; + case 102: + _vm->_sound->command(12); + break; + case 103: + _vm->_sound->command(3); + _vm->_sound->command(25); + break; + case 109: + _vm->_sound->command(13); + break; + case 110: + _vm->_sound->command(10); + break; + case 111: + _vm->_sound->command(3); + break; + case 112: + _vm->_sound->command(15); + break; + default: + if (_scene->_priorSceneId < 104 || _scene->_priorSceneId > 108) + _vm->_sound->command(10); + break; + } + } +} + +/*------------------------------------------------------------------------*/ + void Scene101::setup() { } @@ -48,6 +83,113 @@ void Scene101::actions() { void Scene101::postActions() { } +/*------------------------------------------------------------------------*/ + +void Scene103::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene103::enter() { + _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('x', 0)); + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 1)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 2)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 3)); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('x', 4)); + _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('x', 5)); + _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('b', -1)); + _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('h', -1)); + _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('m', -1)); + _globals._spriteIndexes[9] = _scene->_sprites.addSprites(formAnimName('t', -1)); + _globals._spriteIndexes[10] = _scene->_sprites.addSprites(formAnimName('r', -1)); + _globals._spriteIndexes[11] = _scene->_sprites.addSprites(formAnimName('c', -1)); + + _globals._spriteIndexes[12] = _scene->_sprites.addSprites("*RXMBD_2"); + _globals._spriteIndexes[13] = _scene->_sprites.addSprites("*RXMRD_3"); + _globals._spriteIndexes[15] = _scene->_sequences.addSpriteCycle( + _globals._spriteIndexes[0], false, 7, 0, 1, 0); + _globals._spriteIndexes[16] = _scene->_sequences.addSpriteCycle( + _globals._spriteIndexes[1], false, 6, 0, 2, 0); + _scene->_sequences.setDepth(_globals._spriteIndexes[16], 0); + _globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle( + _globals._spriteIndexes[2], false, 6, 0, 0, 25); + _globals._spriteIndexes[18] = _scene->_sequences.addSubEntry( + _globals._spriteIndexes[17], SM_FRAME_INDEX, 2, 72); + _globals._spriteIndexes[19] = _scene->_sequences.addSubEntry( + _globals._spriteIndexes[17], SM_FRAME_INDEX, 2, 72); + int idx = _scene->_sequences.addSubEntry(_globals._spriteIndexes[17], + SM_FRAME_INDEX, 2, 73); + + _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle( + _globals._spriteIndexes[8], false, 8); + _globals._spriteIndexes[22] = _scene->_sequences.addSpriteCycle( + _globals._spriteIndexes[7], false, 6); + _globals._spriteIndexes[19] = _scene->_sequences.addSpriteCycle( + _globals._spriteIndexes[4], false, 6); + _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle( + _globals._spriteIndexes[5], false, 6); + + if (_game._objects.isInRoom(OBJ_TIMER_MODULE)) { + _vm->_game->_scene._hotspots.activate(371, false); + } else { + _globals._spriteIndexes[26] = _scene->_sequences.addSpriteCycle( + _globals._spriteIndexes[11], false, 6); + } + + if (_game._objects.isInRoom(OBJ_REBREATHER)) { + _vm->_game->_scene._hotspots.activate(289, false); + } else { + _globals._spriteIndexes[25] = _scene->_sequences.addSpriteCycle( + _globals._spriteIndexes[10], false, 6); + } + + if (_globals[11]) { + _globals._spriteIndexes[24] = _scene->_sequences.addSpriteCycle( + _globals._spriteIndexes[9], false, 6); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[24], -2, -2); + _scene->_hotspots.activate(362, false); + } + + if (_scene->_priorSceneId != -2) + _game._player._playerPos = Common::Point(237, 74); + if (_scene->_priorSceneId == 102) { + _game._player._stepEnabled = false; + + _globals._spriteIndexes[21] = _scene->_sequences.addReverseSpriteCycle( + _globals._spriteIndexes[6], false, 6, 1, 0, 0); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[21], SM_0, 0, 70); + } + + sceneEntrySound(); + _vm->_game->loadQuoteSet(70, 51, 71, 7, 73, 0); + + if (!_game._visitedScenes._sceneRevisited) { + int msgIndex = _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, + 34, 0, 120, _game.getQuote(70)); + _scene->_kernelMessages.setQuoted(msgIndex, 4, true); + } + + if (_scene->_priorSceneId == 102) + _vm->_sound->command(20); + + _vm->_palette->setEntry(252, 63, 63, 10); + _vm->_palette->setEntry(253, 45, 45, 10); + _globals._v0 = 0; + _globals._frameTime = _scene->_frameStartTime; +} + +void Scene103::step() { +} + +void Scene103::preActions() { +} + +void Scene103::actions() { +} + +void Scene103::postActions() { +} + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes1.h b/engines/mads/nebular/nebular_scenes1.h index da6a2f0903..6077e1e797 100644 --- a/engines/mads/nebular/nebular_scenes1.h +++ b/engines/mads/nebular/nebular_scenes1.h @@ -32,9 +32,36 @@ namespace MADS { namespace Nebular { -class Scene101: public NebularScene { +class Scene1xx : protected NebularScene { +protected: + /** + * Plays an appropriate sound when entering a scene + */ + void sceneEntrySound(); public: - Scene101(MADSEngine *vm) : NebularScene(vm) {} + Scene1xx(MADSEngine *vm) : NebularScene(vm) {} +}; + +class Scene101: public Scene1xx { +public: + Scene101(MADSEngine *vm) : Scene1xx(vm) {} + + virtual void setup(); + + virtual void enter(); + + virtual void step(); + + virtual void preActions(); + + virtual void actions(); + + virtual void postActions(); +}; + +class Scene103 : public Scene1xx { +public: + Scene103(MADSEngine *vm) : Scene1xx(vm) {} virtual void setup(); diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index 2d123660bd..7bc1af9298 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -80,11 +80,13 @@ void Scene804::setup() { } void Scene804::enter() { - _globals._chairHotspotIndex = 0; - _globals._v1 = _globals._v2 = 0; - _globals._v3 = _globals._v4 = 0; + _globals._frameTime = 0; + _globals._v2 = 0; + _globals._v3 = 0; + _globals._v4 = 0; _globals._v5 = -1; - _globals._v6 = _globals._v7 = 0; + _globals._v6 = 0; + _globals._v7 = 0; _globals._v8 = 0; if (_globals[5]) { // Copy protection failed @@ -92,43 +94,43 @@ void Scene804::enter() { _globals[164] = 0; } - _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 0)); - _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('x', 1)); - _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('x', 2)); - _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('x', 3)); - _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('x', 4)); - _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('f', 1)); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('x', 0)); + _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('x', 1)); + _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('x', 2)); + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 3)); + _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('x', 4)); + _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('f', 1)); _game.loadQuoteSet(791, 0); if (_globals[165]) { if (_globals[164]) { - _globals._spriteIndexes[19] = _scene->_sequences.startCycle( - _globals._spriteIndexes[4], 0, 1); + _globals._spriteIndexes[20] = _scene->_sequences.startCycle( + _globals._spriteIndexes[5], 0, 1); _scene->_sequences.addTimer(60, 100); } else { - _globals._spriteIndexes[20] = _scene->_sequences.startCycle( - _globals._spriteIndexes[5], false, 1); - _globals._spriteIndexes[21] = _scene->_sequences.startReverseCycle( - _globals._spriteIndexes[6], false, 4, 0, 0, 0); + _globals._spriteIndexes[21] = _scene->_sequences.startCycle( + _globals._spriteIndexes[6], false, 1); + _globals._spriteIndexes[22] = _scene->_sequences.startReverseCycle( + _globals._spriteIndexes[7], false, 4, 0, 0, 0); _scene->_sequences.addTimer(160, 70); _game._player._stepEnabled = false; } } else { if (_globals[167] == 0) { - _globals._spriteIndexes[22] = _scene->_sequences.startCycle( - _globals._spriteIndexes[7], false, 1); + _globals._spriteIndexes[23] = _scene->_sequences.startCycle( + _globals._spriteIndexes[8], false, 1); } if (_globals[164] == 0) { - _globals._spriteIndexes[22] = _scene->_sequences.startCycle( - _globals._spriteIndexes[18], false, 1); + _globals._spriteIndexes[23] = _scene->_sequences.startCycle( + _globals._spriteIndexes[19], false, 1); } - _globals._spriteIndexes[0] = _scene->_sequences.startCycle( - _globals._spriteIndexes[0], false, 1); - _scene->_sequences.setMsgPosition(_globals._spriteIndexes[15], Common::Point(133, 139)); - _scene->_sequences.setDepth(_globals._spriteIndexes[15], 8); + _globals._spriteIndexes[1] = _scene->_sequences.startCycle( + _globals._spriteIndexes[1], false, 1); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[16], Common::Point(133, 139)); + _scene->_sequences.setDepth(_globals._spriteIndexes[16], 8); } _scene->loadAnimation(Resources::formatName(804, 'r', 1, EXT_AA, "")); @@ -142,24 +144,23 @@ void Scene804::enter() { } void Scene804::step() { - if (_globals._chairHotspotIndex) { + if (_globals._frameTime) { if (_scene->_activeAnimation->getCurrentFrame() == 36 && !_globals._v3) { - _scene->_sequences.remove(_globals._spriteIndexes[15]); + _scene->_sequences.remove(_globals._spriteIndexes[16]); _globals._v3 = -1; } if (_scene->_activeAnimation->getCurrentFrame() == 39) { _globals._v2 = 0; - if (_globals._v1 == 3) + if ((_globals._frameTime / 256) == 3) _scene->_sequences.addTimer(130, 120); } if (!_globals._v2) { - ++_globals._v1; + _globals._frameTime += 0x100; _globals._v2 = -1; - if (_globals._v1 >= 4) { - _globals._chairHotspotIndex = 0; - _globals._v1 = 0; + if ((_globals._frameTime / 256) >= 4) { + _globals._frameTime = 0; _game._player._stepEnabled = true; } else { _globals._v5 = 34; @@ -167,11 +168,11 @@ void Scene804::step() { } } else { if (_globals._v3 && _globals._v2 && _scene->_activeAnimation->getCurrentFrame() == 39) { - _globals._spriteIndexes[15] = _scene->_sequences.startCycle( - _globals._spriteIndexes[0], false, 1); - _scene->_sequences.setMsgPosition(_globals._spriteIndexes[15], + _globals._spriteIndexes[16] = _scene->_sequences.startCycle( + _globals._spriteIndexes[1], false, 1); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[16], Common::Point(133, 139)); - _scene->_sequences.setDepth(_globals._spriteIndexes[15], 8); + _scene->_sequences.setDepth(_globals._spriteIndexes[16], 8); _globals._v3 = 0; } @@ -183,7 +184,7 @@ void Scene804::step() { if (_game._abortTimers == 70) _globals._v5 = 42; if (_scene->_activeAnimation->getCurrentFrame() == 65) - _scene->_sequences.remove(_globals._spriteIndexes[21]); + _scene->_sequences.remove(_globals._spriteIndexes[22]); switch (_game._storyMode) { case STORYMODE_NAUGHTY: @@ -213,7 +214,7 @@ void Scene804::step() { if (_scene->_activeAnimation->getCurrentFrame() == 34) { _globals._v5 = 36; - _scene->_sequences.remove(_globals._spriteIndexes[15]); + _scene->_sequences.remove(_globals._spriteIndexes[16]); } if (_scene->_activeAnimation->getCurrentFrame() == 37) { _globals._v5 = 36; @@ -225,7 +226,7 @@ void Scene804::step() { _scene->_nextSceneId = 803; if (_scene->_activeAnimation->getCurrentFrame() == 7 && !_globals[164]) { - _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); + _globals._spriteIndexes[19] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); _scene->_sequences.addTimer(20, 110); _globals[164] = -1; } diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index 8f803d109f..d7301bb369 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -386,9 +386,9 @@ void Palette::setPalette(const byte *colors, uint start, uint num) { } void Palette::setEntry(byte palIndex, byte r, byte g, byte b) { - _mainPalette[palIndex * 3] = r; - _mainPalette[palIndex * 3 + 1] = g; - _mainPalette[palIndex * 3 + 2] = b; + _mainPalette[palIndex * 3] = VGA_COLOR_TRANS(r); + _mainPalette[palIndex * 3 + 1] = VGA_COLOR_TRANS(g); + _mainPalette[palIndex * 3 + 2] = VGA_COLOR_TRANS(b); setPalette((const byte *)&_mainPalette[palIndex * 3], palIndex, 1); } diff --git a/engines/mads/scene.h b/engines/mads/scene.h index 0b20fb077f..f96cb592e2 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -93,7 +93,7 @@ public: KernelMessages _kernelMessages; Common::String _talkFont; int _textSpacing; - Common::Array _hotspots; + Hotspots _hotspots; ScreenObjects _screenObjects; ImageInterEntries _imageInterEntries; DirtyAreas _dirtyAreas; diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index 1b4f8a9e6e..6418a03477 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -412,6 +412,21 @@ int SequenceList::addSpriteCycle(int srcSpriteIdx, bool flipped, int numTicks, i true, 100, depth - 1, 1, ANIMTYPE_CYCLED, 0, 0); } +int SequenceList::addReverseSpriteCycle(int srcSpriteIdx, bool flipped, int numTicks, + int triggerCountdown, int timeoutTicks, int extraTicks) { + Scene &scene = _vm->_game->_scene; + + SpriteAsset *asset = scene._sprites[srcSpriteIdx]; + MSprite *spriteFrame = asset->getFrame(0); + int depth = scene._depthSurface.getDepth(Common::Point( + spriteFrame->_offset.x + (spriteFrame->w / 2), + spriteFrame->_offset.y + (spriteFrame->h / 2))); + + return add(srcSpriteIdx, flipped, asset->getCount(), triggerCountdown, timeoutTicks, extraTicks, + numTicks, 0, 0, true, 100, depth - 1, -1, ANIMTYPE_CYCLED, 0, 0); +} + + int SequenceList::startCycle(int srcSpriteIndex, bool flipped, int cycleIndex) { int result = addSpriteCycle(srcSpriteIndex, flipped, INDEFINITE_TIMEOUT, 0, 0, 0); if (result >= 0) diff --git a/engines/mads/sequence.h b/engines/mads/sequence.h index 85e4f660e5..a62ad7ee7a 100644 --- a/engines/mads/sequence.h +++ b/engines/mads/sequence.h @@ -93,6 +93,7 @@ public: int add(int spriteListIndex, bool flipped, int frameIndex, int triggerCountdown, int delayTicks, int extraTicks, int numTicks, int msgX, int msgY, bool nonFixed, char scale, uint8 depth, int frameInc, SpriteAnimType animType, int numSprites, int frameStart); + int addTimer(int time, int abortVal); void remove(int seqIndex); void setSpriteSlot(int seqIndex, SpriteSlot &spriteSlot); @@ -103,7 +104,11 @@ public: void scan(); void setDepth(int seqIndex, int depth); void setMsgPosition(int seqIndex, const Common::Point &pt); - int addSpriteCycle(int srcSpriteIdx, bool flipped, int numTicks, int triggerCountdown, int timeoutTicks, int extraTicks); + int addSpriteCycle(int srcSpriteIdx, bool flipped, int numTicks, + int triggerCountdown = 0, int timeoutTicks = 0, int extraTicks = 0); + int addReverseSpriteCycle(int srcSpriteIdx, bool flipped, int numTicks, + int triggerCountdown = 0, int timeoutTicks = 0, int extraTicks = 0); + int startCycle(int srcSpriteIdx, bool flipped, int cycleIndex); int startReverseCycle(int srcSpriteIndex, bool flipped, int numTicks, int triggerCountdown, int timeoutTicks, int extraTicks); -- cgit v1.2.3 From b652e2eafd3de5436b45619659b5299d945074be Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 15 Mar 2014 18:43:39 -0400 Subject: MADS: Merged the InterfaceSurface and UserInterface classes --- engines/mads/animation.cpp | 11 ++- engines/mads/animation.h | 6 +- engines/mads/interface.cpp | 132 ------------------------------- engines/mads/interface.h | 69 ---------------- engines/mads/mads.cpp | 3 - engines/mads/mads.h | 1 - engines/mads/module.mk | 1 - engines/mads/nebular/nebular_scenes1.cpp | 2 +- engines/mads/nebular/nebular_scenes8.cpp | 2 +- engines/mads/scene.cpp | 24 +++--- engines/mads/scene.h | 3 +- engines/mads/scene_data.cpp | 16 ++-- engines/mads/user_interface.cpp | 101 +++++++++++++++++++++-- engines/mads/user_interface.h | 37 +++++++-- 14 files changed, 155 insertions(+), 253 deletions(-) delete mode 100644 engines/mads/interface.cpp delete mode 100644 engines/mads/interface.h diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index 09a9e1fc04..783611e3da 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -172,9 +172,9 @@ void Animation::free() { delete this; } -void Animation::load(MSurface &depthSurface, InterfaceSurface &interfaceSurface, - const Common::String &resName, int flags, Common::Array *palAnimData, - SceneInfo *sceneInfo) { +void Animation::load(UserInterface &interfaceSurface, MSurface &depthSurface, + const Common::String &resName, int flags, Common::Array *palAnimData, + SceneInfo *sceneInfo) { Common::String resourceName = resName; if (!resourceName.contains(".")) resourceName += ".AA"; @@ -352,7 +352,7 @@ bool Animation::drawFrame(SpriteAsset &spriteSet, const Common::Point &pt, int f return 0; } -void Animation::loadInterface(InterfaceSurface &interfaceSurface, MSurface &depthSurface, +void Animation::loadInterface(UserInterface &interfaceSurface, MSurface &depthSurface, AAHeader &header, int flags, Common::Array *palAnimData, SceneInfo *sceneInfo) { _scene->_depthStyle = 0; if (header._animMode <= 2) { @@ -363,8 +363,7 @@ void Animation::loadInterface(InterfaceSurface &interfaceSurface, MSurface &dept for (uint i = 0; i < sceneInfo->_palAnimData.size(); ++i) palAnimData->push_back(sceneInfo->_palAnimData[i]); } - } - else if (header._animMode == 4) { + } else if (header._animMode == 4) { // Load a scene interface Common::String resourceName = "*" + header._interfaceFile; interfaceSurface.load(resourceName); diff --git a/engines/mads/animation.h b/engines/mads/animation.h index c5308b7753..dd902b8b68 100644 --- a/engines/mads/animation.h +++ b/engines/mads/animation.h @@ -29,7 +29,7 @@ #include "mads/msurface.h" #include "mads/scene_data.h" #include "mads/font.h" -#include "mads/interface.h" +#include "mads/user_interface.h" namespace MADS { @@ -144,7 +144,7 @@ private: /** * Load the user interface display for an animation */ - void loadInterface(InterfaceSurface &interfaceSurface, MSurface &depthSurface, + void loadInterface(UserInterface &interfaceSurface, MSurface &depthSurface, AAHeader &header, int flags, Common::Array *palAnimData, SceneInfo *sceneInfo); /** @@ -169,7 +169,7 @@ public: /** * Loads animation data */ - void load(MSurface &depthSurface, InterfaceSurface &interfaceSurface, const Common::String &resName, + void load(UserInterface &interfaceSurface, MSurface &depthSurface, const Common::String &resName, int flags, Common::Array *palAnimData, SceneInfo *sceneInfo); /** diff --git a/engines/mads/interface.cpp b/engines/mads/interface.cpp deleted file mode 100644 index 8ea8913b69..0000000000 --- a/engines/mads/interface.cpp +++ /dev/null @@ -1,132 +0,0 @@ -/* 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 "common/scummsys.h" -#include "mads/mads.h" -#include "mads/compression.h" -#include "mads/interface.h" - -namespace MADS { - -void SceneNode::load(Common::SeekableReadStream *f) { - _walkPos.x = f->readSint16LE(); - _walkPos.y = f->readSint16LE(); - for (int i = 0; i < MAX_ROUTE_NODES; ++i) - _indexes[i] = f->readUint16LE(); -} - -/*------------------------------------------------------------------------*/ - -InterfaceSurface::InterfaceSurface(MADSEngine *vm) : _vm(vm) { - _category = CAT_NONE; - _screenObjectsCount = 0; -} - - -void InterfaceSurface::load(const Common::String &resName) { - File f(resName); - MadsPack madsPack(&f); - - // Load in the palette - Common::SeekableReadStream *palStream = madsPack.getItemStream(0); - - uint32 *gamePalP = &_vm->_palette->_palFlags[0]; - byte *palP = &_vm->_palette->_mainPalette[0]; - - for (int i = 0; i < 16; ++i, gamePalP++, palP += 3) { - palP[0] = VGA_COLOR_TRANS(palStream->readByte()); - palP[1] = VGA_COLOR_TRANS(palStream->readByte()); - palP[2] = VGA_COLOR_TRANS(palStream->readByte()); - *gamePalP |= 1; - palStream->skip(3); - } - delete palStream; - - // set the size for the interface - setSize(MADS_SCREEN_WIDTH, MADS_INTERFACE_HEIGHT); - Common::SeekableReadStream *pixelsStream = madsPack.getItemStream(1); - pixelsStream->read(getData(), MADS_SCREEN_WIDTH * MADS_INTERFACE_HEIGHT); - delete pixelsStream; -} - -void InterfaceSurface::setup(int id) { - Scene &scene = _vm->_game->_scene; - - if (scene._screenObjects._v832EC != id) { - Common::String resName = _vm->_game->_aaName; - - // Strip off any extension - const char *p = strchr(resName.c_str(), '.'); - if (p) { - resName = Common::String(resName.c_str(), p); - } - - // Add on suffix if necessary - if (id) - resName += "A"; - - resName += ".INT"; - free(); - load(resName); - } - scene._screenObjects._v832EC = id; - - scene._imageInterEntries.clear(); - scene._imageInterEntries.add(-2, 0xff); - _vm->_game->_ticksExpiry = _vm->_events->getFrameCounter(); - scene._v1A = true; - _vm->_game->_objectHiliteVocabIdx = -1; - scene._v1C = -1; - - // Make a copy of the surface - copyTo(&_surface); - - if (_vm->_game->_v1 == 5) - scene._imageInterEntries.call(0, 0); - - scene._action.clear(); - writeText(); - loadElements(); - scene._dynamicHotspots.refresh(); -} - -void InterfaceSurface::elementHighlighted() { - warning("TODO: InterfaceSurface::elementHighlighted"); -} - -void InterfaceSurface::writeText() { - warning("TODO: InterfaceSurface::writeText"); -} - - -void InterfaceSurface::setBounds(const Common::Rect &r) { - _bounds = r; -} - -void InterfaceSurface::loadElements() { - warning("TODO: InterfaceSurface::loadElements"); -} - -/*------------------------------------------------------------------------*/ - - -} // End of namespace MADS diff --git a/engines/mads/interface.h b/engines/mads/interface.h deleted file mode 100644 index 0d7860b30a..0000000000 --- a/engines/mads/interface.h +++ /dev/null @@ -1,69 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef MADS_INTERFACE_H -#define MADS_INTERFACE_H - -#include "common/scummsys.h" -#include "common/rect.h" -#include "common/str.h" -#include "mads/msurface.h" - -namespace MADS { - -class InterfaceSurface : public MSurface { -private: - MADSEngine *_vm; - - void loadElements(); -public: - ScrCategory _category; - int _screenObjectsCount; - Common::Rect _bounds; - Common::Rect *_rectP; - MSurface _surface; -public: - /** - * Constructor - */ - InterfaceSurface(MADSEngine *vm); - - /** - * Loads an interface from a specified resource - */ - void load(const Common::String &resName); - - /** - * Set up the interface - */ - void setup(int id); - - void elementHighlighted(); - - void writeText(); - - void setBounds(const Common::Rect &r); -}; - -} // End of namespace MADS - -#endif /* MADS_INTERFACE_H */ diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index 9cab1ad8f9..ded94871f6 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -52,7 +52,6 @@ MADSEngine::MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc) : _palette = nullptr; _resources = nullptr; _sound = nullptr; - _userInterface = nullptr; } MADSEngine::~MADSEngine() { @@ -64,7 +63,6 @@ MADSEngine::~MADSEngine() { delete _palette; delete _resources; delete _sound; - delete _userInterface; } void MADSEngine::initialise() { @@ -85,7 +83,6 @@ void MADSEngine::initialise() { _font = new Font(this); _screen.init(); _sound = new SoundManager(this, _mixer); - _userInterface = UserInterface::init(this); _game = Game::init(this); _screen.empty(); diff --git a/engines/mads/mads.h b/engines/mads/mads.h index 749c69a64c..10f4badf75 100644 --- a/engines/mads/mads.h +++ b/engines/mads/mads.h @@ -100,7 +100,6 @@ public: Resources *_resources; ScreenSurface _screen; SoundManager *_sound; - UserInterface *_userInterface; bool _easyMouse; bool _invObjectStill; bool _textWindowStill; diff --git a/engines/mads/module.mk b/engines/mads/module.mk index 76d80bc3e3..74376dc149 100644 --- a/engines/mads/module.mk +++ b/engines/mads/module.mk @@ -20,7 +20,6 @@ MODULE_OBJS := \ game.o \ game_data.o \ hotspots.o \ - interface.o \ inventory.o \ mads.o \ messages.o \ diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index d684f02c84..cdc754702c 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -117,7 +117,7 @@ void Scene103::enter() { _globals._spriteIndexes[17], SM_FRAME_INDEX, 2, 72); _globals._spriteIndexes[19] = _scene->_sequences.addSubEntry( _globals._spriteIndexes[17], SM_FRAME_INDEX, 2, 72); - int idx = _scene->_sequences.addSubEntry(_globals._spriteIndexes[17], + _scene->_sequences.addSubEntry(_globals._spriteIndexes[17], SM_FRAME_INDEX, 2, 73); _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle( diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index 7bc1af9298..2aa65d90f0 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -138,7 +138,7 @@ void Scene804::enter() { Scene8xx::enter1(); if (_globals[165] && !_globals[164]) { - _scene->_interface.setup(2); + _scene->_userInterface.setup(2); _vm->_sound->command(19); } } diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 8bf0b6a527..d1e83f6d0a 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -29,9 +29,9 @@ namespace MADS { Scene::Scene(MADSEngine *vm): _vm(vm), _action(_vm), _depthSurface(vm), - _dirtyAreas(_vm), _dynamicHotspots(vm), _interface(vm), - _kernelMessages(vm), _screenObjects(vm), _sequences(vm), - _sprites(vm), _spriteSlots(vm), _textDisplay(vm) { + _dirtyAreas(_vm), _dynamicHotspots(vm), _kernelMessages(vm), + _screenObjects(vm), _sequences(vm), _sprites(vm), _spriteSlots(vm), + _textDisplay(vm), _userInterface(vm) { _priorSceneId = 0; _nextSceneId = 0; _currentSceneId = 0; @@ -159,8 +159,8 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) { flags |= 0x200; _animationData = Animation::init(_vm, this); - MSurface surface; - _animationData->load(surface, _interface, prefix, flags, nullptr, nullptr); + UserInterface surface(_vm); + _animationData->load(surface, _userInterface, prefix, flags, nullptr, nullptr); _vm->_palette->_paletteUsage.load(0); @@ -171,7 +171,7 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) { _interfaceY = MADS_SCENE_HEIGHT; _spritesCount = _sprites.size(); - _interface.setup(_screenObjects._v832EC); + _userInterface.setup(_screenObjects._v832EC); warning("TODO: showMouse"); @@ -341,7 +341,7 @@ void Scene::doFrame() { CursorType cursorId = CURSOR_ARROW; if (_action._v83338 == 1 && !_screenObjects._v7FECA && _screenObjects._category == CAT_HOTSPOT) { - int idx = _screenObjects._selectedObject - _interface._screenObjectsCount; + int idx = _screenObjects._selectedObject - _userInterface._screenObjectsCount; if (idx >= (int)_hotspots.size()) { idx -= _hotspots.size(); _vm->_events->_newCursorId = _dynamicHotspots[idx]._cursor; @@ -392,7 +392,7 @@ void Scene::doFrame() { // Write any text needed by the interface if (_vm->_game->_abortTimers2) - _interface.writeText(); + _userInterface.writeText(); // Draw any elements drawElements((ScreenTransition)_vm->_game->_abortTimers2, _vm->_game->_abortTimers2); @@ -454,7 +454,7 @@ void Scene::drawElements(ScreenTransition transitionType, bool surfaceFlag) { // _vm->_screen.setPointer(&_vm->_screen); - _interface.setBounds(Common::Rect(_vm->_screen._offset.x, _vm->_screen._offset.y, + _userInterface.setBounds(Common::Rect(_vm->_screen._offset.x, _vm->_screen._offset.y, _vm->_screen._offset.x + _vm->_screen.w, _vm->_screen._offset.y + _vm->_screen.h)); if (transitionType) { @@ -500,11 +500,11 @@ void Scene::checkKeyboard() { void Scene::loadAnimation(const Common::String &resName, int abortTimers) { assert(_activeAnimation == nullptr); - MSurface sceneSurface; - InterfaceSurface interfaceSurface(_vm); + MSurface depthSurface; + UserInterface interfaceSurface(_vm); _activeAnimation = Animation::init(_vm, this); - _activeAnimation->load(sceneSurface, interfaceSurface, resName, + _activeAnimation->load(interfaceSurface, depthSurface, resName, _vm->_game->_v2 ? 1 : 0, nullptr, nullptr); _activeAnimation->startAnimation(abortTimers); } diff --git a/engines/mads/scene.h b/engines/mads/scene.h index f96cb592e2..292eb4af80 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -35,6 +35,7 @@ #include "mads/animation.h" #include "mads/sequence.h" #include "mads/sprites.h" +#include "mads/user_interface.h" namespace MADS { @@ -101,7 +102,7 @@ public: SceneInfo *_sceneInfo; MSurface _backgroundSurface; DepthSurface _depthSurface; - InterfaceSurface _interface; + UserInterface _userInterface; bool _animFlag; int _animVal1; int _animCount; diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index de053a62e9..94bbb7b4c1 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -77,34 +77,34 @@ void ScreenObjects::check(bool scanFlag) { } // Handling for easy mouse - ScrCategory category = scene._interface._category; + ScrCategory category = scene._userInterface._category; if (_vm->_easyMouse && !_vm->_events->_vD4 && category != _category - && scene._interface._category != CAT_NONE) { + && scene._userInterface._category != CAT_NONE) { _released = true; if (category >= CAT_ACTION && category <= CAT_6) { - scene._interface.elementHighlighted(); + scene._userInterface.elementHighlighted(); } } _released = _vm->_events->_mouseReleased; if (_vm->_events->_vD2 || (_vm->_easyMouse && !_vm->_events->_vD4)) - scene._interface._category = _category; + scene._userInterface._category = _category; if (!_vm->_events->_mouseButtons || _vm->_easyMouse) { if (category >= CAT_ACTION && category <= CAT_6) { - scene._interface.elementHighlighted(); + scene._userInterface.elementHighlighted(); } } if (_vm->_events->_mouseButtons || (_vm->_easyMouse && scene._action._v83338 > 1 - && scene._interface._category == CAT_INV_LIST) || - (_vm->_easyMouse && scene._interface._category == CAT_HOTSPOT)) { + && scene._userInterface._category == CAT_INV_LIST) || + (_vm->_easyMouse && scene._userInterface._category == CAT_HOTSPOT)) { scene._action.checkActionAtMousePos(); } if (_vm->_events->_mouseReleased) { scene.leftClick(); - scene._interface._category = CAT_NONE; + scene._userInterface._category = CAT_NONE; } if (_vm->_events->_mouseButtons || _vm->_easyMouse || _yp) diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index ec5ca8a0b5..6afbf4c09c 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -22,22 +22,107 @@ #include "common/scummsys.h" #include "mads/mads.h" -#include "mads/screen.h" +#include "mads/compression.h" #include "mads/user_interface.h" -#include "mads/msurface.h" namespace MADS { -UserInterface *UserInterface::init(MADSEngine *vm) { - return new UserInterface(vm); +void SceneNode::load(Common::SeekableReadStream *f) { + _walkPos.x = f->readSint16LE(); + _walkPos.y = f->readSint16LE(); + for (int i = 0; i < MAX_ROUTE_NODES; ++i) + _indexes[i] = f->readUint16LE(); } -UserInterface::UserInterface(MADSEngine *vm): _vm(vm), _surface( - new MSurface(MADS_SCREEN_WIDTH, MADS_INTERFACE_HEIGHT)) { +/*------------------------------------------------------------------------*/ + +UserInterface::UserInterface(MADSEngine *vm) : _vm(vm) { + _category = CAT_NONE; + _screenObjectsCount = 0; +} + +void UserInterface::load(const Common::String &resName) { + File f(resName); + MadsPack madsPack(&f); + + // Load in the palette + Common::SeekableReadStream *palStream = madsPack.getItemStream(0); + + uint32 *gamePalP = &_vm->_palette->_palFlags[0]; + byte *palP = &_vm->_palette->_mainPalette[0]; + + for (int i = 0; i < 16; ++i, gamePalP++, palP += 3) { + palP[0] = VGA_COLOR_TRANS(palStream->readByte()); + palP[1] = VGA_COLOR_TRANS(palStream->readByte()); + palP[2] = VGA_COLOR_TRANS(palStream->readByte()); + *gamePalP |= 1; + palStream->skip(3); + } + delete palStream; + + // set the size for the interface + setSize(MADS_SCREEN_WIDTH, MADS_INTERFACE_HEIGHT); + Common::SeekableReadStream *pixelsStream = madsPack.getItemStream(1); + pixelsStream->read(getData(), MADS_SCREEN_WIDTH * MADS_INTERFACE_HEIGHT); + delete pixelsStream; +} + +void UserInterface::setup(int id) { + Scene &scene = _vm->_game->_scene; + + if (scene._screenObjects._v832EC != id) { + Common::String resName = _vm->_game->_aaName; + + // Strip off any extension + const char *p = strchr(resName.c_str(), '.'); + if (p) { + resName = Common::String(resName.c_str(), p); + } + + // Add on suffix if necessary + if (id) + resName += "A"; + + resName += ".INT"; + free(); + load(resName); + } + scene._screenObjects._v832EC = id; + + scene._imageInterEntries.clear(); + scene._imageInterEntries.add(-2, 0xff); + _vm->_game->_ticksExpiry = _vm->_events->getFrameCounter(); + scene._v1A = true; + _vm->_game->_objectHiliteVocabIdx = -1; + scene._v1C = -1; + + // Make a copy of the surface + copyTo(&_surface); + + if (_vm->_game->_v1 == 5) + scene._imageInterEntries.call(0, 0); + + scene._action.clear(); + writeText(); + loadElements(); + scene._dynamicHotspots.refresh(); +} + +void UserInterface::elementHighlighted() { + warning("TODO: UserInterface::elementHighlighted"); +} + +void UserInterface::writeText() { + warning("TODO: UserInterface::writeText"); +} + + +void UserInterface::setBounds(const Common::Rect &r) { + _bounds = r; } -UserInterface::~UserInterface() { - delete _surface; +void UserInterface::loadElements() { + warning("TODO: UserInterface::loadElements"); } } // End of namespace MADS diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h index 838638ba0b..8bd02ff6fc 100644 --- a/engines/mads/user_interface.h +++ b/engines/mads/user_interface.h @@ -24,21 +24,44 @@ #define MADS_USER_INTERFACE_H #include "common/scummsys.h" +#include "common/rect.h" +#include "common/str.h" +#include "mads/msurface.h" namespace MADS { -class MADSEngine; - -class UserInterface { +class UserInterface : public MSurface { private: MADSEngine *_vm; - MSurface *_surface; - UserInterface(MADSEngine *vm); + void loadElements(); public: - static UserInterface *init(MADSEngine *vm); + ScrCategory _category; + int _screenObjectsCount; + Common::Rect _bounds; + Common::Rect *_rectP; + MSurface _surface; public: - ~UserInterface(); + /** + * Constructor + */ + UserInterface(MADSEngine *vm); + + /** + * Loads an interface from a specified resource + */ + void load(const Common::String &resName); + + /** + * Set up the interface + */ + void setup(int id); + + void elementHighlighted(); + + void writeText(); + + void setBounds(const Common::Rect &r); }; } // End of namespace MADS -- cgit v1.2.3 From ca6cf0eaf2692ac5c787b86e193e8e6980d2b7ee Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 15 Mar 2014 18:52:44 -0400 Subject: MADS: Fix display of user interface during animation --- engines/mads/mads.h | 1 - engines/mads/msurface.cpp | 16 ++++++++++++++-- engines/mads/msurface.h | 8 ++++++++ engines/mads/user_interface.cpp | 5 +++-- 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/engines/mads/mads.h b/engines/mads/mads.h index 10f4badf75..f19abb3889 100644 --- a/engines/mads/mads.h +++ b/engines/mads/mads.h @@ -39,7 +39,6 @@ #include "mads/msurface.h" #include "mads/resources.h" #include "mads/sound.h" -#include "mads/user_interface.h" /** * This is the namespace of the MADS engine. diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp index c8c66234cb..62807e5543 100644 --- a/engines/mads/msurface.cpp +++ b/engines/mads/msurface.cpp @@ -34,20 +34,32 @@ MADSEngine *MSurface::_vm = nullptr; MSurface::MSurface() { pixels = nullptr; + _freeFlag = false; } MSurface::MSurface(int width, int height) { pixels = nullptr; + _freeFlag = false; setSize(width, height); } MSurface::~MSurface() { - Graphics::Surface::free(); + if (_freeFlag) + Graphics::Surface::free(); } void MSurface::setSize(int width, int height) { - Graphics::Surface::free(); + if (_freeFlag) + Graphics::Surface::free(); Graphics::Surface::create(width, height, Graphics::PixelFormat::createFormatCLUT8()); + _freeFlag = true; +} + +void MSurface::setPixels(byte *pData, int horizSize, int vertSize) { + _freeFlag = false; + pixels = pData; + w = horizSize; + h = vertSize; } int MSurface::scaleValue(int value, int scale, int err) { diff --git a/engines/mads/msurface.h b/engines/mads/msurface.h index d5b8741188..37ab305fb0 100644 --- a/engines/mads/msurface.h +++ b/engines/mads/msurface.h @@ -50,6 +50,8 @@ struct SpriteInfo { * MADS graphics surface */ class MSurface : public Graphics::Surface { +private: + bool _freeFlag; protected: static MADSEngine *_vm; public: @@ -83,6 +85,12 @@ public: */ void setSize(int width, int height); + /** + * Sets the pixels the surface is associated with + * @remarks The surface will not free the data block + */ + void setPixels(byte *pData, int horizSize, int vertSize); + /** * Draws an arbitrary line on the screen using a specified color * @param startPos Starting position diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 6afbf4c09c..63a0ec0a80 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -39,6 +39,9 @@ void SceneNode::load(Common::SeekableReadStream *f) { UserInterface::UserInterface(MADSEngine *vm) : _vm(vm) { _category = CAT_NONE; _screenObjectsCount = 0; + + byte *pData = _vm->_screen.getBasePtr(0, MADS_SCREEN_HEIGHT - MADS_INTERFACE_HEIGHT); + setPixels(pData, MADS_SCREEN_WIDTH, MADS_INTERFACE_HEIGHT); } void UserInterface::load(const Common::String &resName) { @@ -61,7 +64,6 @@ void UserInterface::load(const Common::String &resName) { delete palStream; // set the size for the interface - setSize(MADS_SCREEN_WIDTH, MADS_INTERFACE_HEIGHT); Common::SeekableReadStream *pixelsStream = madsPack.getItemStream(1); pixelsStream->read(getData(), MADS_SCREEN_WIDTH * MADS_INTERFACE_HEIGHT); delete pixelsStream; @@ -84,7 +86,6 @@ void UserInterface::setup(int id) { resName += "A"; resName += ".INT"; - free(); load(resName); } scene._screenObjects._v832EC = id; -- cgit v1.2.3 From c4ed42e6d5974e635b4241aa110d8ffe2a8c99c7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 15 Mar 2014 20:19:01 -0400 Subject: MADS: Implementing UserInterface loading --- engines/mads/scene_data.h | 7 +-- engines/mads/user_interface.cpp | 102 +++++++++++++++++++++++++++++++++++++++- engines/mads/user_interface.h | 21 +++++++++ 3 files changed, 123 insertions(+), 7 deletions(-) diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index 7a41bab1f8..1cd262755f 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -33,6 +33,7 @@ #include "mads/events.h" #include "mads/game_data.h" #include "mads/messages.h" +#include "mads/user_interface.h" namespace MADS { @@ -50,12 +51,6 @@ class SpriteSlot; #define TEXT_DISPLAY_MAX_SIZE 40 #define DIRTY_AREAS_SIZE (SPRITE_SLOTS_MAX_SIZE + TEXT_DISPLAY_MAX_SIZE) -enum ScrCategory { - CAT_NONE = 0, CAT_ACTION = 1, CAT_INV_LIST = 2, CAT_INV_VOCAB = 3, - CAT_HOTSPOT = 4, CAT_INV_ANIM = 5, CAT_6 = 6, CAT_INV_SCROLLER = 7, - CAT_12 = 12 -}; - enum Layer { LAYER_GUI = 19 }; diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 63a0ec0a80..e6840ac01a 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -39,6 +39,8 @@ void SceneNode::load(Common::SeekableReadStream *f) { UserInterface::UserInterface(MADSEngine *vm) : _vm(vm) { _category = CAT_NONE; _screenObjectsCount = 0; + _inventoryTopIndex = 0; + _objectY = 0; byte *pData = _vm->_screen.getBasePtr(0, MADS_SCREEN_HEIGHT - MADS_INTERFACE_HEIGHT); setPixels(pData, MADS_SCREEN_WIDTH, MADS_INTERFACE_HEIGHT); @@ -123,7 +125,105 @@ void UserInterface::setBounds(const Common::Rect &r) { } void UserInterface::loadElements() { - warning("TODO: UserInterface::loadElements"); + Scene &scene = _vm->_game->_scene; + Common::Rect bounds; + scene._screenObjects.clear(); + + if (!scene._screenObjects._v832EC) { + for (int idx = 1; idx <= 3; ++idx) { + getBounds(CAT_INV_SCROLLER, idx, bounds); + // TODO + } + } +} + +bool UserInterface::getBounds(ScrCategory category, int v, Common::Rect &bounds) { + Common::Rect result; + int heightMultiplier, widthMultiplier; + int leftStart, yOffset, widthAmt; + + switch (category) { + case CAT_ACTION: + heightMultiplier = v / 5; + widthMultiplier = v / 5; + leftStart = 2; + yOffset = 3; + widthAmt = 32; + break; + + case CAT_INV_LIST: + if (v < _inventoryTopIndex || v > (_inventoryTopIndex + 5)) + return false; + + heightMultiplier = v - _inventoryTopIndex; + widthMultiplier = 0; + leftStart = 90; + yOffset = 3; + widthAmt = 69; + break; + + case CAT_6: + heightMultiplier = v; + widthMultiplier = 0; + leftStart = 2; + yOffset = 3; + widthAmt = 310; + break; + + case CAT_INV_SCROLLER: + heightMultiplier = 0; + widthMultiplier = 73; + yOffset = 0; + widthAmt = 9; + leftStart = (v != 73) ? 73 : 75; + break; + + default: + heightMultiplier = v; + widthMultiplier = 0; + leftStart = 240; + yOffset = 3; + widthAmt = 80; + break; + } + + result.left = (widthMultiplier > 0) ? widthMultiplier * widthAmt + leftStart : leftStart; + result.setWidth(widthAmt); + result.top = heightMultiplier * 3 + yOffset; + result.setHeight(8); + + if (category == CAT_INV_SCROLLER) { + switch (v) { + case 1: + // Arrow up + result.top = 4; + result.setHeight(7); + break; + case 2: + // Arrow down + result.top = 35; + result.setHeight(7); + break; + case 3: + // Scroller + result.top = 12; + result.setHeight(22); + break; + case 4: + // Thumb + result.top = _objectY + 14; + result.setHeight(1); + break; + default: + break; + } + } + + return true; +} + +void UserInterface::extendRect(Common::Rect &bounds) { + } } // End of namespace MADS diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h index 8bd02ff6fc..b8e86bfefb 100644 --- a/engines/mads/user_interface.h +++ b/engines/mads/user_interface.h @@ -30,17 +30,38 @@ namespace MADS { +enum ScrCategory { + CAT_NONE = 0, CAT_ACTION = 1, CAT_INV_LIST = 2, CAT_INV_VOCAB = 3, + CAT_HOTSPOT = 4, CAT_INV_ANIM = 5, CAT_6 = 6, CAT_INV_SCROLLER = 7, + CAT_12 = 12 +}; + class UserInterface : public MSurface { private: MADSEngine *_vm; + /** + * Loads the elements of the user interface + */ void loadElements(); + + /** + * Returns the area within the user interface a given element falls + */ + bool getBounds(ScrCategory category, int invIndex, Common::Rect &bounds); + + /** + * Reposition a bounding rectangle to physical co-ordinates + */ + void extendRect(Common::Rect &bounds); public: ScrCategory _category; int _screenObjectsCount; Common::Rect _bounds; Common::Rect *_rectP; MSurface _surface; + int _inventoryTopIndex; + int _objectY; public: /** * Constructor -- cgit v1.2.3 From 630679a5c8d72242866638b470cd361c0d5c6b0a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 15 Mar 2014 21:33:15 -0400 Subject: MADS: Completed UserInterface::loadElements --- engines/mads/game.cpp | 4 ++++ engines/mads/hotspots.cpp | 3 ++- engines/mads/scene.cpp | 1 + engines/mads/scene.h | 1 + engines/mads/scene_data.cpp | 6 ++--- engines/mads/scene_data.h | 2 +- engines/mads/user_interface.cpp | 53 ++++++++++++++++++++++++++++++++++++++--- engines/mads/user_interface.h | 2 +- 8 files changed, 63 insertions(+), 9 deletions(-) diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index bcebc04a00..ad3ea5e85d 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -265,6 +265,10 @@ void Game::initSection(int sectionNumber) { _vm->_palette->resetGamePalette(18, 10); _vm->_palette->setLowRange(); + + if (_scene._layer == LAYER_GUI) + _vm->_palette->setPalette(_vm->_palette->_mainPalette, 0, 4); + _vm->_events->loadCursors("*CURSOR.SS"); assert(_vm->_events->_cursorSprites); diff --git a/engines/mads/hotspots.cpp b/engines/mads/hotspots.cpp index d754c47fe3..b33b4b2f28 100644 --- a/engines/mads/hotspots.cpp +++ b/engines/mads/hotspots.cpp @@ -129,7 +129,8 @@ void DynamicHotspots::refresh() { switch (_vm->_game->_scene._screenObjects._v832EC) { case 0: case 2: - _vm->_game->_scene._screenObjects.add(dh._bounds, CAT_12, dh._descId); + _vm->_game->_scene._screenObjects.add(dh._bounds, _vm->_game->_scene._layer, + CAT_12, dh._descId); _vm->_game->_scene._screenObjects._v8333C = true; break; default: diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index d1e83f6d0a..9ece16fab5 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -51,6 +51,7 @@ Scene::Scene(MADSEngine *vm): _vm(vm), _action(_vm), _depthSurface(vm), _activeAnimation = nullptr; _textSpacing = -1; _frameStartTime = 0; + _layer = LAYER_GUI; _verbList.push_back(VerbInit(VERB_LOOK, 2, 0)); _verbList.push_back(VerbInit(VERB_TAKE, 2, 0)); diff --git a/engines/mads/scene.h b/engines/mads/scene.h index 292eb4af80..d88f5eccf2 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -127,6 +127,7 @@ public: int _destFacing; Common::Point _posAdjust; uint32 _frameStartTime; + Layer _layer; /** * Constructor diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index 94bbb7b4c1..aa3670ee41 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -51,14 +51,14 @@ ScreenObjects::ScreenObjects(MADSEngine *vm): _vm(vm) { _released = false; } -void ScreenObjects::add(const Common::Rect &bounds, ScrCategory category, int descId) { +void ScreenObjects::add(const Common::Rect &bounds, Layer layer, ScrCategory category, int descId) { assert(size() < 100); ScreenObject so; so._bounds = bounds; so._category = category; so._descId = descId; - so._layer = 0x1413; + so._layer = layer; push_back(so); } @@ -119,7 +119,7 @@ void ScreenObjects::check(bool scanFlag) { scene._action.refresh(); // Loop through image inter list - warning("TODO: iimageInterList loop"); + warning("TODO: imageInterList loop"); } int ScreenObjects::scanBackwards(const Common::Point &pt, int layer) { diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index 1cd262755f..ffea369166 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -102,7 +102,7 @@ public: /** * Add a new item to the list */ - void add(const Common::Rect &bounds, ScrCategory category, int descId); + void add(const Common::Rect &bounds, Layer layer, ScrCategory category, int descId); /** */ diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index e6840ac01a..cbd4573eb4 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -130,9 +130,56 @@ void UserInterface::loadElements() { scene._screenObjects.clear(); if (!scene._screenObjects._v832EC) { + // Set up screen objects for the inventory scroller for (int idx = 1; idx <= 3; ++idx) { getBounds(CAT_INV_SCROLLER, idx, bounds); - // TODO + moveRect(bounds); + + scene._screenObjects.add(bounds, LAYER_GUI, CAT_INV_SCROLLER, idx); + } + + // Set up actions + for (int idx = 0; idx < 10; ++idx) { + getBounds(CAT_ACTION, idx, bounds); + moveRect(bounds); + + scene._screenObjects.add(bounds, LAYER_GUI, CAT_ACTION, idx); + } + + // Set up inventory list + for (int idx = 0; idx < 5; ++idx) { + getBounds(CAT_INV_LIST, idx, bounds); + moveRect(bounds); + + scene._screenObjects.add(bounds, LAYER_GUI, CAT_INV_LIST, idx); + } + + // Set up the inventory vocab list + for (int idx = 0; idx < 5; ++idx) { + getBounds(CAT_INV_VOCAB, idx, bounds); + moveRect(bounds); + + scene._screenObjects.add(bounds, LAYER_GUI, CAT_INV_VOCAB, idx); + } + + // Set up the inventory item picture + scene._screenObjects.add(Common::Rect(160, 159, 231, 194), LAYER_GUI, + CAT_INV_ANIM, 0); + } + + if (!scene._screenObjects._v832EC || scene._screenObjects._v832EC == 2) { + for (int hotspotIdx = scene._hotspots.size() - 1; hotspotIdx >= 0; --hotspotIdx) { + Hotspot &hs = scene._hotspots[hotspotIdx]; + scene._screenObjects.add(hs._bounds, LAYER_GUI, CAT_HOTSPOT, hotspotIdx); + } + } + + if (scene._screenObjects._v832EC == 1) { + for (int idx = 0; idx < 5; ++idx) { + getBounds(CAT_6, idx, bounds); + moveRect(bounds); + + scene._screenObjects.add(bounds, LAYER_GUI, CAT_6, idx); } } } @@ -222,8 +269,8 @@ bool UserInterface::getBounds(ScrCategory category, int v, Common::Rect &bounds) return true; } -void UserInterface::extendRect(Common::Rect &bounds) { - +void UserInterface::moveRect(Common::Rect &bounds) { + bounds.translate(0, MADS_SCREEN_HEIGHT - MADS_INTERFACE_HEIGHT); } } // End of namespace MADS diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h index b8e86bfefb..d50a820563 100644 --- a/engines/mads/user_interface.h +++ b/engines/mads/user_interface.h @@ -53,7 +53,7 @@ private: /** * Reposition a bounding rectangle to physical co-ordinates */ - void extendRect(Common::Rect &bounds); + void moveRect(Common::Rect &bounds); public: ScrCategory _category; int _screenObjectsCount; -- cgit v1.2.3 From 2fb9edc4ee80c99b5a56a66cf52c614939748bd9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 15 Mar 2014 21:51:40 -0400 Subject: MADS: Added some more ImageInterEntries methods --- engines/mads/sprites.cpp | 27 +++++++++++++++++++++++---- engines/mads/sprites.h | 4 +++- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp index 8979fdb12c..be066ba2db 100644 --- a/engines/mads/sprites.cpp +++ b/engines/mads/sprites.cpp @@ -414,15 +414,34 @@ ImageInterEntry::ImageInterEntry() { /*------------------------------------------------------------------------*/ -int ImageInterEntries::add(int field0, int field2) { +void ImageInterEntries::add(int v1, int v2) { ImageInterEntry ie; - ie._field0 = field0; - ie._field2 = field2; + ie._field0 = -2; + ie._field2 = -1; + + push_back(ie); +} + +void ImageInterEntries::add(int v1, int v2, int v3, int v4) { + assert(size() < 50); + + ImageInterEntry ie; + ie._field0 = -3; + ie._field2 = 201; + ie._field6 = v1; + ie._field8 = v2; + ie._field4 = v3; + ie._field3 = v4; push_back(ie); - return size() - 1; } +ImageInterEntry &ImageInterEntries::add() { + resize(size() + 1); + return (*this)[size() - 1]; +} + + void ImageInterEntries::call(int v1, int v2) { debug("TODO: ImageInterEntries::call"); } diff --git a/engines/mads/sprites.h b/engines/mads/sprites.h index 2d5b2089b9..82f0a9b10d 100644 --- a/engines/mads/sprites.h +++ b/engines/mads/sprites.h @@ -240,7 +240,9 @@ public: class ImageInterEntries: public Common::Array { public: - int add(int field0, int field2); + void add(int v1, int v2); + void add(int v1, int v2, int v3, int v4); + ImageInterEntry &add(); void call(int v1, int v2); }; -- cgit v1.2.3 From dfcef632eacc27b4e035e3796550dced425e836d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 16 Mar 2014 00:00:18 -0400 Subject: MADS: Hooked up the in-progress scene 103 --- engines/mads/game.cpp | 1 + engines/mads/nebular/game_nebular.cpp | 5 +++-- engines/mads/nebular/nebular_scenes.cpp | 15 ++++++++++++--- engines/mads/nebular/nebular_scenes1.h | 2 +- engines/mads/palette.cpp | 3 ++- 5 files changed, 19 insertions(+), 7 deletions(-) diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index ad3ea5e85d..a4f3b24542 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -82,6 +82,7 @@ void Game::run() { _statusFlag = 0; break; default: + _scene._nextSceneId = 103; break; } diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index 8948689622..1476620f9d 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -40,20 +40,21 @@ GameNebular::GameNebular(MADSEngine *vm): Game(vm) { } int GameNebular::checkCopyProtection() { + /* // DEBUG: Flag copy protection failure _globals[5] = -1; if (!ConfMan.getBool("copy_protection")) return true; - /* DEBUG: Disabled for now + * DEBUG: Disabled for now CopyProtectionDialog *dlg = new CopyProtectionDialog(_vm, false); dlg->show(); delete dlg; */ // DEBUG: Return that copy protection failed - return 1; + return 0; } void GameNebular::initialiseGlobals() { diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 6644d957ed..21592b07bf 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -28,6 +28,7 @@ #include "mads/scene.h" #include "mads/nebular/game_nebular.h" #include "mads/nebular/nebular_scenes.h" +#include "mads/nebular/nebular_scenes1.h" #include "mads/nebular/nebular_scenes8.h" namespace MADS { @@ -43,10 +44,18 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { scene.addActiveVocab(NOUN_SPLASH); scene.addActiveVocab(NOUN_ALCOHOL); - // TODO: Implement all the game scenes - assert(scene._nextSceneId == 804); + switch (scene._nextSceneId) { + // Scene group #1 + case 103: + return new Scene103(vm); - return new Scene804(vm); + // Scene group #8 + case 804: + return new Scene804(vm); + + default: + error("Invalid scene %d called", scene._nextSceneId); + } } /*------------------------------------------------------------------------*/ diff --git a/engines/mads/nebular/nebular_scenes1.h b/engines/mads/nebular/nebular_scenes1.h index 6077e1e797..0af34dfff5 100644 --- a/engines/mads/nebular/nebular_scenes1.h +++ b/engines/mads/nebular/nebular_scenes1.h @@ -32,7 +32,7 @@ namespace MADS { namespace Nebular { -class Scene1xx : protected NebularScene { +class Scene1xx : public NebularScene { protected: /** * Plays an appropriate sound when entering a scene diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index d7301bb369..ba63dd3145 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -237,7 +237,8 @@ int PaletteUsage::process(Common::Array &palette, uint flags) { int PaletteUsage::rgbMerge(RGB6 &palEntry) { - return palEntry.r * 38 + palEntry.g * 76 + palEntry.b * 14; + return ((palEntry.r + 1) / 4 - 1) * 38 + ((palEntry.g + 1) / 4 - 1) * 76 + + ((palEntry.b + 1) / 4 - 1) * 14; } void PaletteUsage::prioritizeFromList(int lst[3]) { -- cgit v1.2.3 From 5e3684b37a5dad7aaf76275f2a84f054e31d6d06 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 16 Mar 2014 00:43:08 -0400 Subject: MADS: Simplified code for PaletteUsage::prioritize --- engines/mads/palette.cpp | 77 ++++++++---------------------------------------- engines/mads/palette.h | 13 +++++--- 2 files changed, 22 insertions(+), 68 deletions(-) diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index ba63dd3145..94a3117a5c 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -49,7 +49,7 @@ void PaletteUsage::load(int count, ...) { _data.clear(); for (int i = 0; i < count; ++i) - _data.push_back(va_arg(va, int)); + _data.push_back(UsageEntry(va_arg(va, int))); va_end(va); } @@ -61,20 +61,22 @@ void PaletteUsage::getKeyEntries(Common::Array &palette) { for (uint i = 0; i < palette.size(); ++i) { byte *uPtr = &palette[i]._flags; if ((*uPtr & 0x10) && _data.size() < 3) { - _data.push_back(i); + _data.push_back(UsageEntry(i)); } } } -void PaletteUsage::prioritize(Common::Array &palette) { - int lst[3]; +static bool sortHelper(const PaletteUsage::UsageEntry &ue1, const PaletteUsage::UsageEntry &ue2) { + return ue1._sortValue < ue2._sortValue; +} +void PaletteUsage::prioritize(Common::Array &palette) { for (uint i = 0; i < _data.size(); ++i) { - RGB6 &palEntry = palette[_data[i]]; - lst[i] = rgbMerge(palEntry); + RGB6 &palEntry = palette[_data[i]._palIndex]; + _data[i]._sortValue = rgbMerge(palEntry); } - prioritizeFromList(lst); + Common::sort(_data.begin(), _data.end(), sortHelper); } int PaletteUsage::process(Common::Array &palette, uint flags) { @@ -147,17 +149,17 @@ int PaletteUsage::process(Common::Array &palette, uint flags) { if (hasUsage && palette[v1]._flags & 0x10) { for (uint usageIndex = 0; usageIndex < _data.size() && !var48; ++usageIndex) { - if (_data[usageIndex] == palIndex) { + if (_data[usageIndex]._palIndex == palIndex) { var48 = true; int dataIndex = MIN(usageIndex, _data.size() - 1); - var4 = _data[dataIndex]; + var4 = _data[dataIndex]._palIndex; } } } if (flag1 && palette[palIndex]._flags & 0x10) { for (uint usageIndex = 0; usageIndex < _data.size() && !var48; ++usageIndex) { - if (_data[usageIndex] == palIndex) { + if (_data[usageIndex]._palIndex == palIndex) { var48 = true; var4 = 0xF0 + usageIndex; @@ -241,63 +243,10 @@ int PaletteUsage::rgbMerge(RGB6 &palEntry) { ((palEntry.b + 1) / 4 - 1) * 14; } -void PaletteUsage::prioritizeFromList(int lst[3]) { - int idx1 = _data.size() - 1; - bool continueFlag; - int count2; - - do { - continueFlag = false; - count2 = 0; - - if (idx1 > 0) { - int numEntries = _data.size() - 1; - int usageIndex = 0, lstIndex = 0; - - do { - if (lst[lstIndex] < lst[lstIndex + 1]) { - int lstVal = lst[lstIndex]; - int usageVal = _data[usageIndex]; - - if (numEntries > 0) { - Common::copy(&lst[lstIndex + 1], &lst[lstIndex + numEntries], &lst[lstIndex]); - _data.remove_at(usageIndex); - _data.push_back(0); - } - - int newIdx = 0; - if (idx1 > 0 && !continueFlag) { - for (newIdx = 0; newIdx <= idx1; ++newIdx) { - if (lst[newIdx] > lstVal) - break; - } - } - - continueFlag = true; - int idxDiff = _data.size() - newIdx - 1; - if (idxDiff > 0) { - Common::copy_backward(&lst[0], &lst[2], &lst[1]); - _data.remove_at(2); - _data.insert_at(0, 0); - } - - lst[newIdx] = lstVal; - _data[newIdx] = usageVal; - } - - ++usageIndex; - --numEntries; - ++lstIndex; - ++count2; - } while (count2 > idx1 && !continueFlag); - } - } while (continueFlag); -} - void PaletteUsage::transform(Common::Array &palette) { if (!empty()) { for (uint i = 0; i < _data.size(); ++i) { - int palIndex = _data[i]; + int palIndex = _data[i]._palIndex; _data[i] = palette[palIndex]._palIndex; } } diff --git a/engines/mads/palette.h b/engines/mads/palette.h index 5a563a5aa5..a28810e70b 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -55,14 +55,19 @@ struct RGB6 { }; class PaletteUsage { +public: + struct UsageEntry { + uint16 _palIndex; + int _sortValue; + + UsageEntry(int palIndex) { _palIndex = palIndex; } + }; private: MADSEngine *_vm; - Common::Array _data; + Common::Array _data; int rgbMerge(RGB6 &palEntry); - void prioritizeFromList(int lst[3]); - int getGamePalFreeIndex(int *palIndex); int rgbFactor(byte *palEntry, RGB6 &pal6); @@ -79,7 +84,7 @@ public: */ bool empty() const { return _data.size() == 0; } - uint16 &operator[](int index) { return _data[index]; } + uint16 &operator[](int index) { return _data[index]._palIndex; } /** * Gets key entries from the passed palette -- cgit v1.2.3 From 120374b7d0eb1af089111f3dfa710122d2ab7424 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 16 Mar 2014 01:08:16 -0400 Subject: MADS: Simplified PaletteUsage::process list sorting --- engines/mads/palette.cpp | 67 ++++++++++-------------------------------------- engines/mads/palette.h | 7 +++-- 2 files changed, 18 insertions(+), 56 deletions(-) diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index 94a3117a5c..bd467aa16b 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -79,8 +79,11 @@ void PaletteUsage::prioritize(Common::Array &palette) { Common::sort(_data.begin(), _data.end(), sortHelper); } +static bool rangeSorter(const PaletteUsage::UsageRange &ur1, const PaletteUsage::UsageRange &ur2) { + return ur1._v2 < ur2._v2; +} + int PaletteUsage::process(Common::Array &palette, uint flags) { - byte *pal1 = nullptr, *pal2 = nullptr; int palLow; int palHigh = (flags & 0x800) ? 0x100 : 0xFC; int palIdx; @@ -118,29 +121,30 @@ int PaletteUsage::process(Common::Array &palette, uint flags) { int freeIndex; int palCount = getGamePalFreeIndex(&freeIndex); - pal1 = new byte[PALETTE_COUNT]; - pal2 = new byte[PALETTE_COUNT]; + Common::Array palRange; for (uint palIndex = 0; palIndex < palette.size(); ++palIndex) { - pal2[palIndex] = palIndex; - pal1[palIndex] = 0; + byte pal2 = palIndex; + byte pal1 = 0; if (!(palette[palIndex]._flags & 0x80)) { - pal1[palIndex] = 0x40; + pal1 = 0x40; } if (palette[palIndex]._flags & 0x60) { - pal1[palIndex] |= 0x20; + pal1 |= 0x20; } + + palRange.push_back(UsageRange(pal1, pal2)); } - _vm->_palette->processLists(palette.size(), pal1, pal2); + Common::sort(palRange.begin(), palRange.end(), rangeSorter); int var3A = (flags & 0x4000) ? 0xffff : 0xfffe; for (uint palIndex = 0; palIndex < palette.size(); ++palIndex) { bool var48 = false; int var4 = 0xffff; - int v1 = pal2[palIndex]; + int v1 = palRange[palIndex]._v2; if (palette[v1]._flags & 8) { var48 = true; @@ -231,9 +235,6 @@ int PaletteUsage::process(Common::Array &palette, uint flags) { _vm->_palette->_rgbList[rgbIndex] = -1; - delete[] pal1; - delete[] pal2; - return rgbIndex; } @@ -405,48 +406,6 @@ void Palette::setGradient(byte *palette, int start, int count, int rgbValue1, in } } -void Palette::processLists(int count, byte *pal1, byte *pal2) { - bool continueFlag; - int endIndex = count - 1; - - do { - continueFlag = false; - - for (int palIndex = 0; palIndex < endIndex && !continueFlag; ++palIndex) { - byte *palP = &pal1[palIndex]; - byte *pal2P = &pal2[palIndex]; - - if (palP[1] < palP[0]) { - int v1 = palP[0]; - int v2 = pal2P[0]; - - int size = count - palIndex - 1; - if (size > 0) { - Common::copy(palP + 1, palP + size + 1, palP); - Common::copy(pal2P + 1, pal2P + size + 1, pal2P); - } - - int idx; - for (idx = 0; idx < endIndex && !continueFlag; ++idx) { - if (pal1[idx] > v1) - continueFlag = true; - } - continueFlag = true; - - int size2 = count - idx - 1; - if (size2 > 0) { - Common::copy(palP + idx, palP + idx + size2 + 1, palP); - Common::copy(pal2P + idx, pal2P + idx + size2 + 1, pal2P); - } - - pal1[idx] = v1; - pal2[idx] = v2; - } - } - - } while (continueFlag); -} - void Palette::setSystemPalette() { byte palData[4 * 3]; palData[0 * 3] = palData[0 * 3 + 1] = palData[0 * 3 + 2] = 0; diff --git a/engines/mads/palette.h b/engines/mads/palette.h index a28810e70b..e9549fd0bd 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -62,6 +62,11 @@ public: UsageEntry(int palIndex) { _palIndex = palIndex; } }; + struct UsageRange { + byte _v1, _v2; + + UsageRange(byte v1, byte v2) { _v1 = v1; _v2 = v2; } + }; private: MADSEngine *_vm; Common::Array _data; @@ -201,8 +206,6 @@ public: */ static void setGradient(byte *palette, int start, int count, int rgbValue1, int rgbValue2); - static void processLists(int count, byte *pal1, byte *pal2); - /** * Resets the game palette */ -- cgit v1.2.3 From 17870490873bd9ba040b58cb5fbfc1c8480d5461 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 16 Mar 2014 01:29:02 -0400 Subject: MADS: Add loading of game inventory list and quotes --- engines/mads/game.cpp | 22 +++++++++++++--------- engines/mads/resources.cpp | 4 +++- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index a4f3b24542..5c034bf8bf 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -60,6 +60,12 @@ Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm), _abortTimersMode2 = ABORTMODE_0; _ticksExpiry = 0; _exitFlag = 0; + + // Load the inventory object list + _objects.load(); + + // Load the quotes + loadQuotes(); } Game::~Game() { @@ -285,20 +291,18 @@ void Game::loadQuotes() { File f("*QUOTES.DAT"); int curPos = 0; - char buffer[128]; - strcpy(buffer, ""); - + Common::String msg; while (true) { uint8 b = f.readByte(); - if (f.eos()) break; - buffer[curPos++] = b; - if (buffer[curPos - 1] == '\0') { + msg += b; + if (f.eos() || b == '\0') { // end of string, add it to the strings list - _quotes.push_back(buffer); - curPos = 0; - strcpy(buffer, ""); + _quotes.push_back(msg); + msg = ""; } + + if (f.eos()) break; } f.close(); diff --git a/engines/mads/resources.cpp b/engines/mads/resources.cpp index 140a34749a..2742b5b435 100644 --- a/engines/mads/resources.cpp +++ b/engines/mads/resources.cpp @@ -313,7 +313,9 @@ Common::String Resources::formatName(int prefix, char asciiCh, int id, EXTTYPE e (prefix < 100) ? "*SC" : "*RM", prefix); } - result += Common::String::format("%c%d", asciiCh, id); + result += Common::String::format("%c", asciiCh); + if (id >= 0) + result += Common::String::format("%d", id); if (!suffix.empty()) result += suffix; -- cgit v1.2.3 From 136b64db83a36f0c6ac00d52b11afba497d7c212 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 16 Mar 2014 17:26:51 +0100 Subject: MADS: Move setAAName() to Scene1xx --- engines/mads/nebular/nebular_scenes.cpp | 5 ----- engines/mads/nebular/nebular_scenes.h | 5 ----- engines/mads/nebular/nebular_scenes1.cpp | 6 ++++++ engines/mads/nebular/nebular_scenes1.h | 16 ++++++---------- 4 files changed, 12 insertions(+), 20 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 21592b07bf..085eee1bbb 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -99,11 +99,6 @@ void NebularScene::setPlayerSpritesPrefix() { _vm->_palette->setEntry(17, 10, 45, 45); } -void NebularScene::setAAName() { - int idx = (_scene->_nextSceneId > 103 && _scene->_nextSceneId < 112) ? 1 : 0; - _game._aaName = Resources::formatAAName(idx); -} - /*------------------------------------------------------------------------*/ void SceneInfoNebular::loadCodes(MSurface &depthSurface) { diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index 4da8b49996..c1dbcb8b26 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -104,11 +104,6 @@ protected: */ Common::String formAnimName(char sepChar, int suffixNum); - /** - *Sets the AA file to use for the scene - */ - void setAAName(); - /** * Updates the prefix used for getting player sprites for the scene */ diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index cdc754702c..3d36b19c13 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -30,6 +30,12 @@ namespace MADS { namespace Nebular { +void Scene1xx::setAAName() { + int idx = (_scene->_nextSceneId > 103 && _scene->_nextSceneId < 112) ? 1 : 0; + _game._aaName = Resources::formatAAName(idx); +} + + void Scene1xx::sceneEntrySound() { if (_vm->_musicFlag) { switch (_scene->_nextSceneId) { diff --git a/engines/mads/nebular/nebular_scenes1.h b/engines/mads/nebular/nebular_scenes1.h index 0af34dfff5..93de7c86e7 100644 --- a/engines/mads/nebular/nebular_scenes1.h +++ b/engines/mads/nebular/nebular_scenes1.h @@ -38,6 +38,12 @@ protected: * Plays an appropriate sound when entering a scene */ void sceneEntrySound(); + + /** + *Sets the AA file to use for the scene + */ + void setAAName(); + public: Scene1xx(MADSEngine *vm) : NebularScene(vm) {} }; @@ -47,15 +53,10 @@ public: Scene101(MADSEngine *vm) : Scene1xx(vm) {} virtual void setup(); - virtual void enter(); - virtual void step(); - virtual void preActions(); - virtual void actions(); - virtual void postActions(); }; @@ -64,15 +65,10 @@ public: Scene103(MADSEngine *vm) : Scene1xx(vm) {} virtual void setup(); - virtual void enter(); - virtual void step(); - virtual void preActions(); - virtual void actions(); - virtual void postActions(); }; -- cgit v1.2.3 From 9ffaf672ff0f2d05c55db3a69af1f1cf873f4f1b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 16 Mar 2014 18:10:22 +0100 Subject: MADS: Move setPlayerSpritesPrefix() to Scene1xx --- engines/mads/nebular/nebular_scenes.cpp | 29 ----------------------------- engines/mads/nebular/nebular_scenes.h | 5 ----- engines/mads/nebular/nebular_scenes1.cpp | 30 +++++++++++++++++++++++++++++- engines/mads/nebular/nebular_scenes1.h | 4 ++++ 4 files changed, 33 insertions(+), 35 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 085eee1bbb..6b922a45ed 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -70,35 +70,6 @@ Common::String NebularScene::formAnimName(char sepChar, int suffixNum) { EXT_NONE, ""); } -void NebularScene::setPlayerSpritesPrefix() { - _vm->_sound->command(5); - Common::String oldName = _game._player._spritesPrefix; - if (_scene->_nextSceneId <= 103 || _scene->_nextSceneId == 111) { - if (_globals[0] == SEX_FEMALE) { - _game._player._spritesPrefix = "ROX"; - } else { - _game._player._spritesPrefix = "RXM"; - _globals[0] = SEX_MALE; - } - } else if (_scene->_nextSceneId <= 110) { - _game._player._spritesPrefix = "RXSW"; - _globals[0] = SEX_UNKNOWN; - } else if (_scene->_nextSceneId == 112) { - _game._player._spritesPrefix = ""; - } - - if (oldName == _game._player._spritesPrefix) - _game._player._spritesChanged = true; - if (_scene->_nextSceneId == 105 || (_scene->_nextSceneId == 109 && _globals[15])) { - _game._player._spritesChanged = true; - _game._v3 = 0; - } - - _game._player._unk3 = 0; - _vm->_palette->setEntry(16, 10, 63, 63); - _vm->_palette->setEntry(17, 10, 45, 45); -} - /*------------------------------------------------------------------------*/ void SceneInfoNebular::loadCodes(MSurface &depthSurface) { diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index c1dbcb8b26..5b7dd6a726 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -104,11 +104,6 @@ protected: */ Common::String formAnimName(char sepChar, int suffixNum); - /** - * Updates the prefix used for getting player sprites for the scene - */ - void setPlayerSpritesPrefix(); - /** * Plays appropriate sound for entering varous rooms */ diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 3d36b19c13..65787af655 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -35,7 +35,6 @@ void Scene1xx::setAAName() { _game._aaName = Resources::formatAAName(idx); } - void Scene1xx::sceneEntrySound() { if (_vm->_musicFlag) { switch (_scene->_nextSceneId) { @@ -69,6 +68,35 @@ void Scene1xx::sceneEntrySound() { } } +void Scene1xx::setPlayerSpritesPrefix() { + _vm->_sound->command(5); + Common::String oldName = _game._player._spritesPrefix; + if (_scene->_nextSceneId <= 103 || _scene->_nextSceneId == 111) { + if (_globals[0] == SEX_FEMALE) { + _game._player._spritesPrefix = "ROX"; + } else { + _game._player._spritesPrefix = "RXM"; + _globals[0] = SEX_MALE; + } + } else if (_scene->_nextSceneId <= 110) { + _game._player._spritesPrefix = "RXSW"; + _globals[0] = SEX_UNKNOWN; + } else if (_scene->_nextSceneId == 112) { + _game._player._spritesPrefix = ""; + } + + if (oldName == _game._player._spritesPrefix) + _game._player._spritesChanged = true; + if (_scene->_nextSceneId == 105 || (_scene->_nextSceneId == 109 && _globals[15])) { + _game._player._spritesChanged = true; + _game._v3 = 0; + } + + _game._player._unk3 = 0; + _vm->_palette->setEntry(16, 10, 63, 63); + _vm->_palette->setEntry(17, 10, 45, 45); +} + /*------------------------------------------------------------------------*/ void Scene101::setup() { diff --git a/engines/mads/nebular/nebular_scenes1.h b/engines/mads/nebular/nebular_scenes1.h index 93de7c86e7..56c70b1bf8 100644 --- a/engines/mads/nebular/nebular_scenes1.h +++ b/engines/mads/nebular/nebular_scenes1.h @@ -44,6 +44,10 @@ protected: */ void setAAName(); + /** + * Updates the prefix used for getting player sprites for the scene + */ + void setPlayerSpritesPrefix(); public: Scene1xx(MADSEngine *vm) : NebularScene(vm) {} }; -- cgit v1.2.3 From ecbe2c87fde0b3f5d8264d4e56426cb5f73521a5 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 16 Mar 2014 18:16:21 +0100 Subject: MADS: Implement Scene2xx functions --- engines/mads/module.mk | 1 + engines/mads/nebular/nebular_scenes2.cpp | 90 ++++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes2.h | 64 +++++++++++++++++++++++ engines/mads/player.cpp | 2 +- engines/mads/player.h | 2 +- 5 files changed, 157 insertions(+), 2 deletions(-) create mode 100644 engines/mads/nebular/nebular_scenes2.cpp create mode 100644 engines/mads/nebular/nebular_scenes2.h diff --git a/engines/mads/module.mk b/engines/mads/module.mk index 74376dc149..c2e269e8c1 100644 --- a/engines/mads/module.mk +++ b/engines/mads/module.mk @@ -7,6 +7,7 @@ MODULE_OBJS := \ nebular/sound_nebular.o \ nebular/nebular_scenes.o \ nebular/nebular_scenes1.o \ + nebular/nebular_scenes2.o \ nebular/nebular_scenes8.o \ action.o \ animation.o \ diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp new file mode 100644 index 0000000000..062ea93487 --- /dev/null +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -0,0 +1,90 @@ +/* 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 "common/scummsys.h" +#include "mads/mads.h" +#include "mads/scene.h" +#include "mads/nebular/nebular_scenes.h" +#include "mads/nebular/nebular_scenes2.h" + +namespace MADS { + +namespace Nebular { + +void Scene2xx::setAAName() { + int idx = (_scene->_nextSceneId == 216) ? 4 : 2; + _game._aaName = Resources::formatAAName(idx); +} + +void Scene2xx::setPlayerSpritesPrefix() { + _vm->_sound->command(5); + Common::String oldName = _game._player._spritesPrefix; + + switch(_scene->_nextSceneId) { + case 213: + case 216: + _game._player._spritesPrefix = ""; + break; + default: + if (_globals[0] == SEX_MALE) { + _game._player._spritesPrefix = "ROX"; + } else { + _game._player._spritesPrefix = "RXM"; + } + break; + } + + if (_scene->_nextSceneId > 212) + _game._player._unk4 = 0; + else + _game._player._unk4 = -1; + + if (oldName == _game._player._spritesPrefix) + _game._player._spritesChanged = true; + + if ((_scene->_nextSceneId == 203 || _scene->_nextSceneId == 204) && _globals[34]) + _game._v3 = 0; + + _vm->_palette->setEntry(16, 10, 63, 63); + _vm->_palette->setEntry(17, 10, 45, 45); +} + +void Scene201::setup() { +} + +void Scene201::enter() { +} + +void Scene201::step() { +} + +void Scene201::preActions() { +} + +void Scene201::actions() { +} + +void Scene201::postActions() { +} + +} // End of namespace Nebular +} // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h new file mode 100644 index 0000000000..32da9ea79a --- /dev/null +++ b/engines/mads/nebular/nebular_scenes2.h @@ -0,0 +1,64 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_NEBULAR_SCENES2_H +#define MADS_NEBULAR_SCENES2_H + +#include "common/scummsys.h" +#include "mads/game.h" +#include "mads/scene.h" +#include "mads/nebular/nebular_scenes.h" + +namespace MADS { + +namespace Nebular { + +class Scene2xx : public NebularScene { +protected: + /** + * Plays an appropriate sound when entering a scene + */ + void setAAName(); + + /** + * Updates the prefix used for getting player sprites for the scene + */ + void setPlayerSpritesPrefix(); +public: + Scene2xx(MADSEngine *vm) : NebularScene(vm) {} +}; + +class Scene201: public Scene2xx { +public: + Scene201(MADSEngine *vm) : Scene2xx(vm) {} + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions(); +}; + +} // End of namespace Nebular +} // End of namespace MADS + +#endif /* MADS_NEBULAR_SCENES2_H */ diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index ef2ce9f27c..73b8ce06ba 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -39,7 +39,7 @@ Player::Player(MADSEngine *vm): _vm(vm) { _special = 0; _ticksAmount = 0; _priorTimer = 0; - _unk3 = 0; + _unk3 = _unk4 = 0; _forceRefresh = false; } diff --git a/engines/mads/player.h b/engines/mads/player.h index 896b8d5b16..92e28896c4 100644 --- a/engines/mads/player.h +++ b/engines/mads/player.h @@ -63,7 +63,7 @@ public: int _special; int _ticksAmount; uint32 _priorTimer; - int _unk3; + int _unk3, _unk4; bool _forceRefresh; Common::String _spritesPrefix; public: -- cgit v1.2.3 From 834cf846f14ac613b96a662b9701380e7a132d9b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 16 Mar 2014 18:32:46 +0100 Subject: MADS: Implement Scene201::setup, remove some function definition, add some Noun enum values --- engines/mads/nebular/nebular_scenes.h | 5 ++++- engines/mads/nebular/nebular_scenes2.cpp | 13 +++++++------ engines/mads/nebular/nebular_scenes2.h | 2 -- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index 5b7dd6a726..6021e6715a 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -39,6 +39,7 @@ enum { }; enum Noun { + NOUN_D = 0xD, NOUN_BLOWGUN = 0x29, NOUN_BURGER = 0x35, NOUN_CHAIR = 0x47, @@ -76,6 +77,7 @@ enum Noun { NOUN_SIT_IN = 0x13F, NOUN_SMELL = 0x147, NOUN_STUFFED_FISH = 0x157, + NOUN_15F = 0x15F, NOUN_VIEW_SCREEN = 0x180, NOUN_CAPTIVE_CREATURE = 0x1C3, NOUN_NATIVE_WOMAN = 0x1DC, @@ -83,7 +85,8 @@ enum Noun { NOUN_DOLLOP = 0x3AC, NOUN_DROP = 0x3AD, NOUN_DASH = 0x3AE, - NOUN_SPLASH = 0x3AF + NOUN_SPLASH = 0x3AF, + NOUN_487 = 0x487 }; class SceneFactory { diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 062ea93487..ec8af4ca29 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -69,6 +69,13 @@ void Scene2xx::setPlayerSpritesPrefix() { } void Scene201::setup() { + setPlayerSpritesPrefix(); + setAAName(); + + Scene &scene = _vm->_game->_scene; + scene.addActiveVocab(NOUN_15F); + scene.addActiveVocab(NOUN_487); + scene.addActiveVocab(NOUN_D); } void Scene201::enter() { @@ -77,14 +84,8 @@ void Scene201::enter() { void Scene201::step() { } -void Scene201::preActions() { -} - void Scene201::actions() { } -void Scene201::postActions() { -} - } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index 32da9ea79a..c4de73192f 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -53,9 +53,7 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions(); virtual void actions(); - virtual void postActions(); }; } // End of namespace Nebular -- cgit v1.2.3 From f3415b762eede6481cbfcb48faecfec505150eab Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 16 Mar 2014 14:53:10 -0400 Subject: MADS: Implemented lots of Player methods --- engines/mads/game.cpp | 9 +- engines/mads/msurface.cpp | 14 + engines/mads/msurface.h | 4 + engines/mads/nebular/game_nebular.cpp | 2 +- engines/mads/player.cpp | 637 +++++++++++++++++++++++++++++++++- engines/mads/player.h | 75 +++- engines/mads/scene_data.cpp | 81 +++++ engines/mads/scene_data.h | 8 + engines/mads/user_interface.cpp | 4 +- 9 files changed, 814 insertions(+), 20 deletions(-) diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 5c034bf8bf..af23998b74 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -179,11 +179,18 @@ void Game::sectionLoop() { _vm->_palette->_paletteUsage.load(3, 0xF0, 0xF1, 0xF2); + if (!_player._spritesLoaded && _v3) { + if (_player.loadSprites("")) + _vm->quitGame(); + _playerSpritesFlag = true; + } + _scene.loadScene(_scene._nextSceneId, _aaName, 0); _vm->_sound->pauseNewCommands(); if (!_player._spritesLoaded) { - _player.loadSprites(""); + if (_player.loadSprites("")) + _vm->quitGame(); _playerSpritesFlag = false; } diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp index 62807e5543..65858f520e 100644 --- a/engines/mads/msurface.cpp +++ b/engines/mads/msurface.cpp @@ -521,4 +521,18 @@ int DepthSurface::getDepth(const Common::Point &pt) { } } +int DepthSurface::getDepthHighBit(const Common::Point &pt) { + if (_vm->_game->_scene._sceneInfo->_depthStyle == 2) { + int bits = (3 - (pt.x % 4)) * 2; + byte v = *getBasePtr(pt.x >> 2, pt.y); + return (v >> bits) & 2; + } else { + if (pt.x < 0 || pt.y < 0 || pt.x >= this->w || pt.y >= this->h) + return 0; + + return *getBasePtr(pt.x, pt.y) & 0x80; + } +} + + } // End of namespace MADS diff --git a/engines/mads/msurface.h b/engines/mads/msurface.h index 37ab305fb0..7cf2bbe15b 100644 --- a/engines/mads/msurface.h +++ b/engines/mads/msurface.h @@ -223,6 +223,10 @@ public: * Returns the depth at a given position */ int getDepth(const Common::Point &pt); + + /** + */ + int getDepthHighBit(const Common::Point &pt); }; } // End of namespace MADS diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index 1476620f9d..91c10a50ee 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -35,7 +35,7 @@ namespace MADS { namespace Nebular { GameNebular::GameNebular(MADSEngine *vm): Game(vm) { - _surface = new MSurface(MADS_SCREEN_WIDTH, MADS_SCREEN_HEIGHT - MADS_INTERFACE_HEIGHT); + _surface = new MSurface(MADS_SCREEN_WIDTH, MADS_SCENE_HEIGHT); _storyMode = STORYMODE_NAUGHTY; } diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index 73b8ce06ba..fe1065cbed 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -26,21 +26,47 @@ namespace MADS { +#define PLAYER_SEQ_INDEX -2 + +const int Player::_directionListIndexes[32] = { + 0, 7, 4, 3, 6, 0, 2, 5, 0, 1, 9, 4, 1, 2, 7, 9, 3, 8, 9, 6, 7, 2, 3, 6, 1, 7, 9, 4, 7, 8, 0, 0 +}; + Player::Player(MADSEngine *vm): _vm(vm) { _action = nullptr; _direction = 8; _newDirection = 8; _destFacing = 0; _spritesLoaded = false; - _spritesStart = _numSprites = 0; + _spritesStart = 0; + _spritesIdx = 0; + _numSprites = 0; _stepEnabled = false; _visible = false; + _priorVisible = false; _visible3 = false; _special = 0; _ticksAmount = 0; _priorTimer = 0; _unk3 = _unk4 = 0; _forceRefresh = false; + _highSprites = false; + _currentDepth = 0; + _currentScale = 0; + _frameOffset = 0; + _frameNum = 0; + _yScale = 0; + _frameCount = 0; + _unk1 = 0; + _unk2 = 0; + _unk3 = 0; + _frameListIndex = 0; + _actionIndex = 0; + _hypotenuse = 0; + + Common::fill(&_actionList[0], &_actionList[12], 0); + Common::fill(&_actionList2[0], &_actionList2[12], 0); + Common::fill(&_spriteSetsPresent[0], &_spriteSetsPresent[PLAYER_SPRITES_FILE_COUNT], false); } void Player::reset() { @@ -49,7 +75,7 @@ void Player::reset() { _destFacing = 5; _newDirection = _direction; _moving = false; - _v844C0 = _v844BE = 0; + _newSceneId = _v844BE = 0; _next = 0; _routeCount = 0; @@ -58,8 +84,49 @@ void Player::reset() { _action->_walkFlag = false; } -void Player::loadSprites(const Common::String &prefix) { - warning("TODO: Player::loadSprites"); +bool Player::loadSprites(const Common::String &prefix) { + Common::String suffixList = "89632741"; + + Common::String newPrefix; + if (prefix.empty()) { + newPrefix = _spritesPrefix; + } else { + _spritesPrefix = prefix; + newPrefix = prefix; + } + + _numSprites = 0; + if (!_spritesPrefix.empty()) { + for (int fileIndex = 0; fileIndex < PLAYER_SPRITES_FILE_COUNT; ++fileIndex) { + Common::String setName = Common::String::format("*%s_%c.SS", + newPrefix.c_str(), suffixList[fileIndex]); + if (fileIndex >= 5) + _highSprites = true; + + _spriteSetsPresent[fileIndex] = true; + int setIndex = _vm->_game->_scene._sprites.addSprites(setName, 4); + if (setIndex >= 0) { + ++_numSprites; + } else if (fileIndex >= 5) { + _highSprites = 0; + return true; + } else { + _spriteSetsPresent[fileIndex] = false; + } + + if (fileIndex == 0) + _spritesStart = setIndex; + } + + _spritesLoaded = true; + _spritesChanged = false; + _highSprites = false; + return false; + } else { + Common::fill(&_spriteSetsPresent[0], &_spriteSetsPresent[PLAYER_SPRITES_FILE_COUNT], false); + _highSprites = false; + return true; + } } void Player::turnToDestFacing() { @@ -67,30 +134,227 @@ void Player::turnToDestFacing() { _newDirection = _destFacing; } +void Player::dirChanged() { + int dirIndex = 0, dirIndex2 = 0; + int newDir = 0, newDir2 = 0; + + if (_direction != _newDirection) { + // Find the index for the given direction in the player direction list + int tempDir = _direction; + do { + ++dirIndex; + newDir += tempDir; + tempDir = _directionListIndexes[tempDir + 10]; + } while (tempDir != _newDirection); + } + + + if (_direction != _newDirection) { + // Find the index for the given direction in the player direction list + int tempDir = _direction; + do { + ++dirIndex2; + newDir2 += tempDir; + tempDir = _directionListIndexes[tempDir + 20]; + } while (tempDir != _newDirection); + } + + int diff = dirIndex - dirIndex2; + if (diff == 0) + diff = newDir - newDir2; + + _direction = (diff >= 0) ? _directionListIndexes[_direction + 20] : _directionListIndexes[_direction + 10]; + setupFrame(); + if ((_direction == _newDirection) && !_moving) + updateFrame(); + + _priorTimer += 1; +} + void Player::moveComplete() { reset(); _action->_inProgress = false; } void Player::setupFrame() { + Scene &scene = _vm->_game->_scene; + resetActionList(); - warning("TODO: Player::setupFrame"); + _frameOffset = 0; + _spritesIdx = _directionListIndexes[_direction]; + if (!_spriteSetsPresent[_spritesIdx]) { + // Direction isn't present, so use alternate direction, with entries flipped + _spritesIdx -= 4; + _frameOffset = 0x8000; + } + + SpriteAsset &spriteSet = *scene._sprites[_spritesStart + _spritesIdx]; + assert(spriteSet._charInfo); + _unk1 = MAX(spriteSet._charInfo->_unk1, 100); + setTicksAmount(); + + _frameCount = spriteSet._charInfo->_totalFrames; + if (_frameCount == 0) + _frameCount = spriteSet.getCount(); + + _yScale = spriteSet._charInfo->_yScale; + + if ((_frameNum <= 0) || (_frameNum > _frameCount)) + _frameNum = 1; + _forceRefresh = true; } void Player::updateFrame() { - warning("TODO: Player::updateFrame"); + Scene &scene = _vm->_game->_scene; + SpriteAsset &spriteSet = *scene._sprites[_spritesStart + _spritesIdx]; + assert(spriteSet._charInfo); + + if (!spriteSet._charInfo->_numEntries) { + _frameNum = 1; + } else { + _frameListIndex = _actionList[_actionIndex]; + + if (!_visible) { + _unk2 = 0; + } + else { + _unk2 = _actionList2[_actionIndex]; + + if (_actionIndex > 0) + --_actionIndex; + } + + // Set the player frame number + int frameIndex = ABS(_frameListIndex); + _frameNum = (_frameListIndex <= 0) ? spriteSet._charInfo->_frameList[frameIndex] : + spriteSet._charInfo->_frameList2[frameIndex]; + + // Set next waiting period in ticks + if (frameIndex == 0) { + setTicksAmount(); + } else { + _ticksAmount = spriteSet._charInfo->_ticksList[frameIndex]; + } + } } void Player::update() { - warning("TODO: Player::update"); + Scene &scene = _vm->_game->_scene; + + if (_forceRefresh || (_visible != _priorVisible)) { + int slotIndex = getSpriteSlot(); + if (slotIndex >= 0) + scene._spriteSlots[slotIndex]._spriteType = ST_EXPIRED; + + int newDepth = 1; + int yp = MAX(_playerPos.y, (int16)(MADS_SCENE_HEIGHT - 1)); + + for (int idx = 1; idx < 15; ++idx) { + if (scene._sceneInfo->_depthList[newDepth] >= yp) + newDepth = idx + 1; + } + _currentDepth = newDepth; + + // Get the scale + int newScale = getScale(_playerPos.y); + _currentScale = MIN(newScale, 100); + + if (_visible) { + // Player sprite needs to be rendered + SpriteSlot slot; + slot._spriteType = ST_FOREGROUND; + slot._seqIndex = PLAYER_SEQ_INDEX; + slot._spritesIndex = _spritesStart + _spritesIdx; + slot._frameNumber = _frameOffset + _frameNum; + slot._position.x = _playerPos.x; + slot._position.y = _playerPos.y + (_yScale * newScale) / 100; + slot._depth = newDepth; + slot._scale = newScale; + + if (slotIndex >= 0) { + // Check if the existing player slot has the same details, and can be re-used + SpriteSlot &s2 = scene._spriteSlots[slotIndex]; + bool equal = (s2._seqIndex == slot._seqIndex) + && (s2._spritesIndex == slot._spritesIndex) + && (s2._frameNumber == slot._frameNumber) + && (s2._position == slot._position) + && (s2._depth == slot._depth) + && (s2._scale == slot._scale); + + if (equal) + // Undo the prior expiry of the player sprite + s2._spriteType = ST_NONE; + else + slotIndex = -1; + } + + if (slotIndex < 0) { + // New slot needed, so allocate one and copy the slot data + slotIndex = scene._spriteSlots.add(); + scene._spriteSlots[slotIndex] = slot; + } + + // If changing a scene, check to change the scene when the player + // has moved off-screen + if (_newSceneId) { + SpriteAsset *asset = scene._sprites[slot._spritesIndex]; + MSprite *frame = asset->getFrame(_frameNum - 1); + int xScale = frame->w * newScale / 200; + int yScale = frame->h * newScale / 100; + int playerX = slot._position.x; + int playerY = slot._position.y; + + if ((playerX + xScale) < 0 || (playerX + xScale) >= MADS_SCREEN_WIDTH || + playerY < 0 || (playerY + yScale) >= MADS_SCENE_HEIGHT) { + scene._nextSceneId = _newSceneId; + _newSceneId = 0; + _vm->_game->_v4 = 0; + } + } + + } + } + + _visible3 = _visible; + _priorVisible = _visible; + _forceRefresh = false; } void Player::resetActionList() { - warning("TODO: Player::resetActionList"); + _actionList[0] = 0; + _actionList2[0] = 0; + _actionIndex = 0; + _unk2 = 0; + _unk3 = 0; } void Player::setDest(const Common::Point &pt, int facing) { - warning("TODO: Player::setDest"); + Scene &scene = _vm->_game->_scene; + + resetActionList(); + setTicksAmount(); + _moving = true; + _destFacing = facing; + + scene._sceneInfo->setRouteNode(scene._sceneInfo->_nodes.size() - 2, + _playerPos, scene._depthSurface); + scene._sceneInfo->setRouteNode(scene._sceneInfo->_nodes.size() - 1, + pt, scene._depthSurface); + + bool v = scene._depthSurface.getDepthHighBit(pt); + setupRoute(v); + _next = 0; + + if (_routeCount > 0) { + Common::Point srcPos = _playerPos; + for (int routeCtr = _routeCount - 1; (routeCtr >= 0) && (_next == 0); --routeCtr) { + int idx = _routeIndexes[routeCtr]; + const Common::Point &pt =scene._sceneInfo->_nodes[idx]._walkPos; + + _next = scanPath(scene._depthSurface, srcPos, pt); + srcPos = pt; + } + } } void Player::nextFrame() { @@ -111,15 +375,364 @@ void Player::nextFrame() { } void Player::move() { - warning("TODO: Player::move"); + Scene &scene = _vm->_game->_scene; + bool routeFlag = false; + + if (_moving) { + int idx = _routeCount; + while (!_newSceneId && (_destPos.x == _playerPos.x) && (_destPos.y == _playerPos.y)) { + if (idx != 0) { + --idx; + SceneNode &node = scene._sceneInfo->_nodes[_routeIndexes[idx]]; + _destPos = node._walkPos; + routeFlag = true; + } + else if (_v844BE == idx) { + // End of walking path + _routeCount = 0; + _moving = false; + turnToDestFacing(); + routeFlag = true; + idx = _routeCount; + } + else { + _newSceneId = _v844BE; + _v844BC = true; + _v844BE = 0; + _stepEnabled = true; + routeFlag = false; + } + + if (!_moving) + break; + } + _routeCount = idx; + } + + if (routeFlag && _moving) + startMovement(); + + if (_newDirection != _direction) + dirChanged(); + else if (!_moving) + updateFrame(); + + int var1 = _unk1; + if (_unk4 && (_hypotenuse > 0)) { + int v1 = -(_currentScale - 100) * (_posDiff.x - 1) / _hypotenuse + _currentScale; + var1 = MAX(1, 10000 / (v1 * _currentScale * var1)); + } + + if (!_moving || (_direction != _newDirection)) + return; + + Common::Point newPos = _playerPos; + + if (_v8452E < var1) { + do { + if (_v8452C < _posDiff.x) + _v8452C += _posDiff.y; + if (_v8452C >= _posDiff.x) { + if ((_posChange.y > 0) || (_newSceneId != 0)) + newPos.y += _yDirection; + --_posChange.y; + _v8452C -= _posDiff.x; + } + + if (_v8452C < _posDiff.x) { + if ((_posChange.x > 0) || (_newSceneId != 0)) + newPos.x += _xDirection; + --_posChange.x; + } + + if ((_v844BC == 0) && (_newSceneId == 0) && (_v844BE == 0)) { + routeFlag = scene._depthSurface.getDepthHighBit(newPos); + + if (_special == 0) + _special = scene.getDepthHighBits(newPos); + } + + _v8452E += _v84530; + + } while ((_v8452E < var1) && !routeFlag && ((_posChange.x > 0) || (_posChange.y > 0) || (_newSceneId != 0))); + } + + _v8452E -= var1; + + if (routeFlag) + moveComplete(); + else { + if (!_newSceneId) { + // If the move is complete, make sure the position is exactly on the given destination + if (_posChange.x == 0) + newPos.x = _destPos.x; + if (_posChange.y == 0) + newPos.y = _destPos.y; + } + + _playerPos = newPos; + } } void Player::idle() { - warning("TODO: Player::idle"); + Scene &scene = _vm->_game->_scene; + + if (_direction != _newDirection) { + // The direction has changed, so reset for new direction + dirChanged(); + return; + } + + SpriteAsset &spriteSet = *scene._sprites[_spritesStart + _spritesIdx]; + assert(spriteSet._charInfo); + if (spriteSet._charInfo->_numEntries == 0) + // No entries, so exit immediately + return; + + int frameIndex = ABS(_frameListIndex); + int direction = (_frameListIndex < 0) ? -1 : 1; + + if (frameIndex >= spriteSet._charInfo->_numEntries) + // Reset back to the start of the list + _frameListIndex = 0; + else { + _frameNum += direction; + _forceRefresh = true; + + if (spriteSet._charInfo->_frameList2[frameIndex] < _frameNum) { + _unk3 = _unk2; + updateFrame(); + } + if (spriteSet._charInfo->_frameList[frameIndex] < _frameNum) { + _unk3 = _unk2; + updateFrame(); + } + } } void Player::postUpdate() { - warning("TODO: Player::postUpdate"); + if (_moving) { + if (++_frameNum > _frameCount) + _frameNum = 1; + _forceRefresh = true; + } else { + if (!_forceRefresh) + idle(); + } +} + +int Player::getSpriteSlot() { + SpriteSlots &spriteSlots = _vm->_game->_scene._spriteSlots; + + for (uint idx = 0; idx < spriteSlots.size(); ++idx) { + if (spriteSlots[idx]._seqIndex == PLAYER_SEQ_INDEX && + spriteSlots[idx]._spriteType >= ST_NONE) + return idx; + } + + return - 1; +} + +int Player::getScale(int yp) { + Scene &scene = _vm->_game->_scene; + + int scale = (scene._bandsRange == 0) ? scene._sceneInfo->_maxScale : + (yp - scene._sceneInfo->_yBandsStart) * scene._scaleRange / scene._bandsRange + + scene._sceneInfo->_minScale; + + return MIN(scale, 100); +} + +void Player::setTicksAmount() { + Scene &scene = _vm->_game->_scene; + + SpriteAsset &spriteSet = *scene._sprites[_spritesStart + _spritesIdx]; + assert(spriteSet._charInfo); + + _ticksAmount = spriteSet._charInfo->_ticksAmount; + if (_ticksAmount == 0) + _ticksAmount = 6; +} + +void Player::setupRoute(bool bitFlag) { + Scene &scene = _vm->_game->_scene; + + // Reset the flag set of nodes in use + SceneNodeList &nodes = scene._sceneInfo->_nodes; + for (uint i = 0; i < nodes.size(); ++i) + nodes[i]._active = false; + + // Start constructing route node list + _routeLength = 0x3FFF; + _routeCount = 0; + + setupRouteNode(_tempRoute, nodes.size() - 1, bitFlag ? 0xC000 : 0x8000, 0); +} + +void Player::setupRouteNode(int *routeIndexP, int nodeIndex, int flags, int routeLength) { + Scene &scene = _vm->_game->_scene; + SceneNodeList &nodes = scene._sceneInfo->_nodes; + SceneNode ¤tNode = nodes[nodeIndex]; + currentNode._active = true; + + *routeIndexP++ = nodeIndex; + + int subIndex = nodes.size() - 2; + int indexVal = nodes[nodeIndex]._indexes[subIndex]; + if (indexVal & flags) { + routeLength += indexVal & 0x3FFF; + if (routeLength < _routeLength) { + // Found a new shorter route to destination, so set up the route with the found one + Common::copy(_tempRoute, routeIndexP, _routeIndexes); + _routeCount = routeIndexP - _tempRoute; + _routeLength = indexVal & 0x3FFF; + } + } else { + for (int idx = nodes.size() - 2; idx > 0; --idx) { + int nodePos = idx - 1; + if (!nodes[nodePos]._active && ((currentNode._indexes[nodePos] & flags) != 0)) + setupRouteNode(routeIndexP, nodePos, 0x8000, indexVal & 0x3fff); + } + } + + currentNode._active = false; +} + +int Player::scanPath(MSurface &depthSurface, const Common::Point &srcPos, const Common::Point &destPos) { + Scene &scene = _vm->_game->_scene; + + // For compressed depth surfaces, always return 0 + if (scene._sceneInfo->_depthStyle != 2) + return 0; + + int yDiff = destPos.y - srcPos.y; + int yAmount = MADS_SCREEN_WIDTH; + + if (yDiff < 0) { + yDiff = -yDiff; + yAmount = -yAmount; + } + + int xDiff = destPos.x - srcPos.y; + int xDirection = 1; + int xAmount = 0; + if (xDiff < 0) { + xDiff = -xDiff; + xDirection = -xDirection; + xAmount = MIN(yDiff, xDiff); + } + + ++xDiff; + ++yDiff; + + const byte *srcP = depthSurface.getBasePtr(srcPos.x, srcPos.y); + int index = xAmount; + + // Outer horizontal movement loop + for (int yIndex = 0; yIndex < yDiff; ++yIndex) { + index += yDiff; + int v = (*srcP & 0x7F) >> 4; + if (v) + return v; + + // Inner loop for handling vertical movement + while (index >= xDiff) { + index -= xDiff; + + v = (*srcP & 0x7F) >> 4; + if (v) + return v; + + srcP += yAmount; + } + + srcP += xDirection; + } + + return 0; +} + +void Player::startMovement() { + int xDiff = _destPos.x - _playerPos.x; + int yDiff = _destPos.y - _playerPos.y; + int srcScale = getScale(_playerPos.y); + int destScale = getScale(_destPos.y); + + // Sets the X direction + if (xDiff > 0) + _xDirection = 1; + else if (xDiff < 0) + _xDirection = -1; + else + _xDirection = 0; + + // Sets the Y direction + if (yDiff > 0) + _yDirection = 1; + else if (yDiff < 0) + _yDirection = -1; + else + _yDirection = 0; + + xDiff = ABS(xDiff); + yDiff = ABS(yDiff); + int scaleDiff = ABS(srcScale - destScale); + + int xAmt100 = xDiff * 100; + int yAmt100 = yDiff * 100; + int xAmt33 = xDiff * 33; + + int scaleAmount = (_unk4 ? scaleDiff * 3 : 0) + 100 * yDiff / 100; + int scaleAmount100 = scaleAmount * 100; + + // Figure out direction that will need to be moved in + int majorDir; + if (xDiff == 0) + majorDir = 1; + else if (yDiff == 0) + majorDir = 3; + else { + if ((scaleAmount < xDiff) && ((xAmt33 / scaleAmount) >= 141)) + majorDir = 3; + else if (yDiff <= xDiff) + majorDir = 2; + else if ((scaleAmount100 / xDiff) >= 141) + majorDir = 1; + else + majorDir = 2; + } + + switch (majorDir) { + case 1: + _newDirection = (_yDirection <= 0) ? 8 : 2; + break; + case 2: { + _newDirection = ((_yDirection <= 0) ? 9 : 3) - ((_xDirection <= 0) ? 2 : 0); + break; + } + case 3: + _newDirection = (_xDirection <= 0) ? 4 : 6; + break; + default: + break; + } + + _hypotenuse = sqrt((double)(xAmt100 * xAmt100 + yAmt100 * yAmt100)); + _posDiff.x = xDiff + 1; + _posDiff.y = yDiff + 1; + _posChange.x = xDiff; + _posChange.y = yDiff; + + int majorChange = MAX(xDiff, yDiff); + _v84530 = (majorChange == 0) ? 0 : _hypotenuse / majorChange; + + if (_playerPos.x > _destPos.x) + _v8452C = MAX(_posChange.x, _posChange.y); + else + _v8452C = 0; + + _hypotenuse /= 100; + _v8452E = -_v84530; } } // End of namespace MADS diff --git a/engines/mads/player.h b/engines/mads/player.h index 92e28896c4..9a615e544f 100644 --- a/engines/mads/player.h +++ b/engines/mads/player.h @@ -31,10 +31,32 @@ namespace MADS { class MADSEngine; class Action; +#define PLAYER_SPRITES_FILE_COUNT 8 + class Player { +private: + static const int _directionListIndexes[32]; private: MADSEngine *_vm; MADSAction *_action; + bool _highSprites; + bool _spriteSetsPresent[PLAYER_SPRITES_FILE_COUNT]; + int _currentDepth; + int _currentScale; + int _frameOffset; + int _frameNum; + int _yScale; + int _frameCount; + int _frameListIndex; + int _actionIndex; + bool _v844BC; + int _v8452E; + int _v8452C; + int _v84530; + int _routeLength; + int _actionList[12]; + int _actionList2[12]; + int _hypotenuse; void reset(); @@ -43,33 +65,78 @@ private: void move(); void postUpdate(); + + /** + * Get the sprite slot index for the player + */ + int getSpriteSlot(); + + /** + * Get the scale for the player at the given Y position + */ + int getScale(int yp); + + void setTicksAmount(); + + void setupRoute(); + + void setupRoute(bool bitFlag); + + void setupRouteNode(int *routeIndexP, int nodeIndex, int flags, int routeLength); + + /** + * Scans along an edge connecting two points within the depths/walk surface, and returns the information of the first + * pixel high nibble encountered with a non-zero value + */ + int scanPath(MSurface &depthSurface, const Common::Point &srcPos, const Common::Point &destPos); + + /** + * Starts a player moving to a given destination + */ + void startMovement(); + + void dirChanged(); public: int _direction; int _newDirection; + int _xDirection, _yDirection; int _destFacing; bool _spritesLoaded; int _spritesStart; + int _spritesIdx; int _numSprites; bool _stepEnabled; bool _spritesChanged; bool _visible; + bool _priorVisible; bool _visible3; Common::Point _playerPos; Common::Point _destPos; + Common::Point _posChange; + Common::Point _posDiff; bool _moving; - int _v844C0, _v844BE; + int _newSceneId, _v844BE; int _next; - int _routeCount; int _special; int _ticksAmount; uint32 _priorTimer; - int _unk3, _unk4; + int _unk1; + int _unk2; + int _unk3; + bool _unk4; bool _forceRefresh; Common::String _spritesPrefix; + int _routeCount; + int _routeOffset; + int _tempRoute[MAX_ROUTE_NODES]; + int _routeIndexes[MAX_ROUTE_NODES]; public: Player(MADSEngine *vm); - void loadSprites(const Common::String &prefix); + /** + * Load sprites for the player + */ + bool loadSprites(const Common::String &prefix); void turnToDestFacing(); diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index aa3670ee41..04dfc4be44 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -394,6 +394,87 @@ void SceneInfo::SpriteInfo::load(Common::SeekableReadStream *f) { _scale = f->readByte(); } +void SceneInfo::setRouteNode(int nodeIndex, const Common::Point &pt, MSurface &depthSurface) { + int flags, hypotenuse; + + _nodes[nodeIndex]._walkPos = pt; + + // Recalculate inter-node lengths + for (uint idx = 0; idx < _nodes.size(); ++idx) { + int entry; + if (idx == (uint)nodeIndex) { + entry = 0x3FFF; + } + else { + // Process the node + flags = getRouteFlags(pt, _nodes[idx]._walkPos, depthSurface); + + int xDiff = ABS(_nodes[idx]._walkPos.x - pt.x); + int yDiff = ABS(_nodes[idx]._walkPos.y - pt.y); + hypotenuse = sqrt((double)(xDiff * xDiff + yDiff * yDiff)); + + if (hypotenuse >= 0x3FFF) + // Shouldn't ever be this large + hypotenuse = 0x3FFF; + + entry = hypotenuse | flags; + _nodes[idx]._indexes[nodeIndex] = entry; + _nodes[nodeIndex]._indexes[idx] = entry; + } + } +} + +int SceneInfo::getRouteFlags(const Common::Point &src, const Common::Point &dest, + MSurface &depthSurface) { + int result = 0x8000; + bool flag = false; + + int xDiff = ABS(dest.x - src.x); + int yDiff = ABS(dest.y - src.y); + int xDirection = dest.x >= src.x ? 1 : -1; + int yDirection = dest.y >= src.y ? depthSurface.w : -depthSurface.w; + int majorDiff = 0; + if (dest.x < src.x) + majorDiff = MAX(xDiff, yDiff); + ++xDiff; + ++yDiff; + + byte *srcP = depthSurface.getBasePtr(src.x, src.y); + + int totalCtr = majorDiff; + for (int xCtr = 0; xCtr < xDiff; ++xCtr, srcP += xDirection) { + totalCtr += yDiff; + + if ((*srcP & 0x80) == 0) + flag = false; + else if (!flag) { + flag = true; + result -= 0x4000; + if (result == 0) + break; + } + + while (totalCtr >= xDiff) { + totalCtr -= xDiff; + + if ((*srcP & 0x80) == 0) + flag = false; + else if (!flag) { + flag = true; + result -= 0x4000; + if (result == 0) + break; + } + + srcP += yDirection; + } + if (result == 0) + break; + } + + return result; +} + /*------------------------------------------------------------------------*/ SceneInfo *SceneInfo::init(MADSEngine *vm) { diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index ffea369166..00edefbf91 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -251,6 +251,9 @@ class SceneInfo { void load(Common::SeekableReadStream *f); }; + + + int getRouteFlags(const Common::Point &src, const Common::Point &dest, MSurface &depthSurface); protected: MADSEngine *_vm; @@ -301,6 +304,11 @@ public: */ void load(int sceneId, int flags, const Common::String &resName, int v3, MSurface &depthSurface, MSurface &bgSurface); + + /** + * Set up a route node + */ + void setRouteNode(int nodeIndex, const Common::Point &pt, MSurface &depthSurface); }; } // End of namespace MADS diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index cbd4573eb4..3b3fc9379a 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -42,7 +42,7 @@ UserInterface::UserInterface(MADSEngine *vm) : _vm(vm) { _inventoryTopIndex = 0; _objectY = 0; - byte *pData = _vm->_screen.getBasePtr(0, MADS_SCREEN_HEIGHT - MADS_INTERFACE_HEIGHT); + byte *pData = _vm->_screen.getBasePtr(0, MADS_SCENE_HEIGHT); setPixels(pData, MADS_SCREEN_WIDTH, MADS_INTERFACE_HEIGHT); } @@ -270,7 +270,7 @@ bool UserInterface::getBounds(ScrCategory category, int v, Common::Rect &bounds) } void UserInterface::moveRect(Common::Rect &bounds) { - bounds.translate(0, MADS_SCREEN_HEIGHT - MADS_INTERFACE_HEIGHT); + bounds.translate(0, MADS_SCENE_HEIGHT); } } // End of namespace MADS -- cgit v1.2.3 From 74da0c2ef7a5a77ddfcda26b28ebdeab68a9f8f5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 16 Mar 2014 15:50:17 -0400 Subject: MADS: Fix for loading player sprites during scene startup --- engines/mads/player.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index fe1065cbed..c3ce270954 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -104,10 +104,12 @@ bool Player::loadSprites(const Common::String &prefix) { _highSprites = true; _spriteSetsPresent[fileIndex] = true; - int setIndex = _vm->_game->_scene._sprites.addSprites(setName, 4); - if (setIndex >= 0) { + + int setIndex = -1; + if (Common::File::exists(setName)) { + setIndex = _vm->_game->_scene._sprites.addSprites(setName, 4); ++_numSprites; - } else if (fileIndex >= 5) { + } else if (fileIndex < 5) { _highSprites = 0; return true; } else { -- cgit v1.2.3 From d599c7c404729217cf4cf85ee02b2d8b3f3b9ec9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 16 Mar 2014 16:50:53 -0400 Subject: MADS: Fix to display player --- engines/mads/game.cpp | 1 + engines/mads/nebular/game_nebular.cpp | 2 +- engines/mads/player.cpp | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index af23998b74..03c0544689 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -89,6 +89,7 @@ void Game::run() { break; default: _scene._nextSceneId = 103; + _scene._priorSceneId = 102; break; } diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index 91c10a50ee..e5c344b738 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -54,7 +54,7 @@ int GameNebular::checkCopyProtection() { */ // DEBUG: Return that copy protection failed - return 0; + return -2; } void GameNebular::initialiseGlobals() { diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index c3ce270954..3fc7ca53dd 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -362,8 +362,8 @@ void Player::setDest(const Common::Point &pt, int facing) { void Player::nextFrame() { Scene &scene = _vm->_game->_scene; - _priorTimer += _ticksAmount; - if (scene._frameStartTime >= _priorTimer) { + uint32 newTime = _priorTimer + _ticksAmount; + if (scene._frameStartTime >= newTime) { _priorTimer = scene._frameStartTime; if (_moving) { move(); -- cgit v1.2.3 From 4dd057edd93bdb121cd046bfc1b2d770c5c0dbc4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 16 Mar 2014 22:44:53 +0100 Subject: MADS: First real try - Implement Scene201::enter() --- engines/mads/nebular/nebular_scenes2.cpp | 71 ++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index ec8af4ca29..3eff596484 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -79,6 +79,77 @@ void Scene201::setup() { } void Scene201::enter() { + if ((_globals._frameTime) && (_vm->getRandomNumber(5000) == 9)) { + _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 5, 1, 6, 0); + int idx = _scene->_dynamicHotspots.add(351, 13, _globals._spriteIndexes[20], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, 270, 80, 6); + _scene->_sequences.setDepth(_globals._spriteIndexes[20], 8); + _vm->_sound->command(14); + _globals._frameTime = 0; + } + + if (_game._abortTimers == 70) { + _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 9, 1, 0, 0); + _game._player._visible = false; + _scene->_sequences.setAnimRange(_globals._spriteIndexes[21], 12, 16); + _globals._spriteIndexes[22] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 9, 1, 0, 0); + _vm->_sound->command(42); + _scene->_sequences.setDepth(_globals._spriteIndexes[21], 1); + _scene->_sequences.setDepth(_globals._spriteIndexes[22], 1); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[22], SM_FRAME_INDEX, 3, 81); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[22], SM_0, 0, 71); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[21], SM_0, 0, 73); + } + + if (_game._abortTimers == 81) { + _scene->_kernelMessages.reset(); + } + + if (_game._abortTimers == 71) { + _globals._spriteIndexes[22] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 9, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[22], -2, -2); + _scene->_sequences.setDepth(_globals._spriteIndexes[22], 1); + } + + if (_game._abortTimers == 73) { + _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 9, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[21], 17, -2); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[21], SM_0, 0, 74); + _scene->_sequences.setDepth(_globals._spriteIndexes[21], 1); + } + + if (_game._abortTimers == 74) { + _vm->_sound->command(40); + + _scene->_kernelMessages.add(Common::Point(125, 56), 0xFDFC, 32, 82, 180, _game.getQuote(91)); + _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 9, 0, 0, 0); + _scene->_sequences.setDepth(_globals._spriteIndexes[21], 1); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[21], -2, -2); + _scene->_sequences.addTimer(180, 75); + } + + if (_game._abortTimers == 75) { + _globals[37] = 0; + _scene->_nextSceneId = 202; + } + + if (_game._abortTimers == 76) { + _game._player._stepEnabled = true; + _game._player._visible = true; + _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; + } + + if (_game._abortTimers == 77) { + _globals[39] = 1; + _scene->_nextSceneId = _globals[40]; + _scene->_reloadSceneFlag = true; + } + + if (_game._abortTimers == 78) { + _vm->_sound->command(40); + Dialog::show(0x4E92); + _scene->_reloadSceneFlag = true; + } } void Scene201::step() { -- cgit v1.2.3 From 39a36064ac91ad7864c04dfe4d88c97824f070ae Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 16 Mar 2014 17:50:47 -0400 Subject: MADS: In progress text draw methods for user interface --- engines/mads/scene.cpp | 2 +- engines/mads/scene_data.cpp | 9 ++++----- engines/mads/user_interface.cpp | 40 +++++++++++++++++++++++++++++++++++++--- engines/mads/user_interface.h | 28 +++++++++++++++++++++++++++- 4 files changed, 69 insertions(+), 10 deletions(-) diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 9ece16fab5..0258f15bb8 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -393,7 +393,7 @@ void Scene::doFrame() { // Write any text needed by the interface if (_vm->_game->_abortTimers2) - _userInterface.writeText(); + _userInterface.drawTextElements(); // Draw any elements drawElements((ScreenTransition)_vm->_game->_abortTimers2, _vm->_game->_abortTimers2); diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index 04dfc4be44..bbc6e1c3b5 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -45,7 +45,6 @@ ScreenObjects::ScreenObjects(MADSEngine *vm): _vm(vm) { _v7FECA = 0; _v7FED6 = 0; _v8332A = 0; - _selectedObject = 0; _category = CAT_NONE; _objectIndex = 0; _released = false; @@ -70,10 +69,10 @@ void ScreenObjects::check(bool scanFlag) { _v7FECA = false; if ((_vm->_events->_vD6 || _v8332A || _yp || _v8333C) && scanFlag) { - _selectedObject = scanBackwards(_vm->_events->currentPos(), LAYER_GUI); - if (_selectedObject > 0) { - _category = (ScrCategory)((*this)[_selectedObject - 1]._category & 7); - _objectIndex = (*this)[_selectedObject - 1]._descId; + scene._userInterface._selectedObject = scanBackwards(_vm->_events->currentPos(), LAYER_GUI); + if (scene._userInterface._selectedObject > 0) { + _category = (ScrCategory)((*this)[scene._userInterface._selectedObject - 1]._category & 7); + _objectIndex = (*this)[scene._userInterface._selectedObject - 1]._descId; } // Handling for easy mouse diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 3b3fc9379a..9cff2217c1 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -41,6 +41,7 @@ UserInterface::UserInterface(MADSEngine *vm) : _vm(vm) { _screenObjectsCount = 0; _inventoryTopIndex = 0; _objectY = 0; + _selectedObject = -1; byte *pData = _vm->_screen.getBasePtr(0, MADS_SCENE_HEIGHT); setPixels(pData, MADS_SCREEN_WIDTH, MADS_INTERFACE_HEIGHT); @@ -106,7 +107,7 @@ void UserInterface::setup(int id) { scene._imageInterEntries.call(0, 0); scene._action.clear(); - writeText(); + drawTextElements(); loadElements(); scene._dynamicHotspots.refresh(); } @@ -115,10 +116,38 @@ void UserInterface::elementHighlighted() { warning("TODO: UserInterface::elementHighlighted"); } -void UserInterface::writeText() { - warning("TODO: UserInterface::writeText"); +void UserInterface::drawTextElements() { + Scene &scene = _vm->_game->_scene; + if (scene._screenObjects._v832EC) { + drawTalkList(); + } else { + // Draw the actions + drawActions(); + drawInventoryList(); + drawItemVocabList(); + } +} + +void UserInterface::drawActions() { + for (int idx = 0; idx < 10; ++idx) { + drawVocab(CAT_ACTION, idx); + } +} + +void UserInterface::drawInventoryList() { + int endIndex = MIN((int)_vm->_game->_objects._inventoryList.size(), _inventoryTopIndex + 5); + for (int idx = _inventoryTopIndex; idx < endIndex; ++idx) { + drawVocab(CAT_INV_LIST, idx); + } } +void UserInterface::drawItemVocabList() { + +} + +void UserInterface::drawVocab(ScrCategory category, int id) { + +} void UserInterface::setBounds(const Common::Rect &r) { _bounds = r; @@ -273,4 +302,9 @@ void UserInterface::moveRect(Common::Rect &bounds) { bounds.translate(0, MADS_SCENE_HEIGHT); } +void UserInterface::drawTalkList() { + warning("TODO: drawTalkList"); +} + + } // End of namespace MADS diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h index d50a820563..e3a1b2098e 100644 --- a/engines/mads/user_interface.h +++ b/engines/mads/user_interface.h @@ -54,6 +54,31 @@ private: * Reposition a bounding rectangle to physical co-ordinates */ void moveRect(Common::Rect &bounds); + + /** + * Draw options during a conversation. + */ + void drawTalkList(); + + /** + * Draw the action list + */ + void drawActions(); + + /** + * Draw the inventory list + */ + void drawInventoryList(); + + /** + * Draw the inventory item vocab list + */ + void drawItemVocabList(); + + /** + * Draw a vocab text entry + */ + void drawVocab(ScrCategory category, int id); public: ScrCategory _category; int _screenObjectsCount; @@ -62,6 +87,7 @@ public: MSurface _surface; int _inventoryTopIndex; int _objectY; + int _selectedObject; public: /** * Constructor @@ -80,7 +106,7 @@ public: void elementHighlighted(); - void writeText(); + void drawTextElements(); void setBounds(const Common::Rect &r); }; -- cgit v1.2.3 From e24a4b7b16f5ded50974220d546b2ff0483f99f7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 16 Mar 2014 17:55:47 -0400 Subject: MADS: Fix for Scene2xx::setPlayerSpritesPrefix --- engines/mads/nebular/nebular_scenes2.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 3eff596484..53e876b216 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -58,7 +58,7 @@ void Scene2xx::setPlayerSpritesPrefix() { else _game._player._unk4 = -1; - if (oldName == _game._player._spritesPrefix) + if (oldName != _game._player._spritesPrefix) _game._player._spritesChanged = true; if ((_scene->_nextSceneId == 203 || _scene->_nextSceneId == 204) && _globals[34]) @@ -68,6 +68,8 @@ void Scene2xx::setPlayerSpritesPrefix() { _vm->_palette->setEntry(17, 10, 45, 45); } +/*------------------------------------------------------------------------*/ + void Scene201::setup() { setPlayerSpritesPrefix(); setAAName(); -- cgit v1.2.3 From acba8f9254a724ce9c57f5ddd81e6b9264c07274 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 16 Mar 2014 23:40:21 -0400 Subject: MADS: Implementing user interface text display methods --- engines/mads/dialogs.cpp | 2 +- engines/mads/font.cpp | 66 +++++++++++------- engines/mads/font.h | 30 +++++---- engines/mads/game.cpp | 9 ++- engines/mads/game.h | 1 - engines/mads/inventory.h | 7 ++ engines/mads/mads.cpp | 3 +- engines/mads/messages.cpp | 2 +- engines/mads/msurface.cpp | 3 +- engines/mads/scene.cpp | 31 +++------ engines/mads/scene.h | 13 ++-- engines/mads/scene_data.cpp | 17 +++-- engines/mads/scene_data.h | 1 - engines/mads/user_interface.cpp | 146 +++++++++++++++++++++++++++++++++------- engines/mads/user_interface.h | 19 ++++-- 15 files changed, 234 insertions(+), 116 deletions(-) diff --git a/engines/mads/dialogs.cpp b/engines/mads/dialogs.cpp index 571cca5d29..4c1a789a57 100644 --- a/engines/mads/dialogs.cpp +++ b/engines/mads/dialogs.cpp @@ -270,7 +270,7 @@ void TextDialog::draw() { ++yp; _vm->_font->writeString(&_vm->_screen, _lines[lineNum], - Common::Point(xp, yp), 0, 1); + Common::Point(xp, yp), 1); if (_lineXp[lineNum] & 0x80) { // Draw an underline under the text diff --git a/engines/mads/font.cpp b/engines/mads/font.cpp index b8f8187fc7..205e653639 100644 --- a/engines/mads/font.cpp +++ b/engines/mads/font.cpp @@ -28,14 +28,26 @@ namespace MADS { -Font::Font(MADSEngine *vm) : _vm(vm) { +MADSEngine *Font::_vm = nullptr; + +uint8 Font::_fontColors[4]; + +void Font::init(MADSEngine *vm) { + _vm = vm; + _fontColors[0] = 0xFF; + _fontColors[1] = 0xF; + _fontColors[2] = 7; + _fontColors[3] = 8; +} + +Font *Font::getFont(const Common::String &fontName) { + Font *font = new Font(); + font->setFont(fontName); + return font; +} + +Font::Font() { _sysFont = true; - /* - _fontColors[0] = _vm->_palette->BLACK; - _fontColors[1] = _vm->_palette->WHITE; - _fontColors[2] = _vm->_palette->BLACK; - _fontColors[3] = _vm->_palette->DARK_GRAY; - */ } Font::~Font() { @@ -96,18 +108,28 @@ void Font::setColors(uint8 v1, uint8 v2, uint8 v3, uint8 v4) { _fontColors[2] = v3; } -int Font::write(MSurface *surface, const Common::String &msg, const Common::Point &pt, int width, int spaceWidth, uint8 colors[]) { - - /*TODO - if (custom_ascii_converter) { // if there is a function to convert the extended ASCII characters - custom_ascii_converter(out_string); // call it with the string +void Font::setColorMode(int mode) { + switch (mode) { + case 0: + setColors(0xFF, 4, 4, 0); + break; + case 1: + setColors(0xFF, 5, 5, 0); + break; + case 2: + setColors(0xFF, 6, 6, 0); + break; + default: + break; } - */ +} +int Font::writeString(MSurface *surface, const Common::String &msg, const Common::Point &pt, + int spaceWidth, int width) { if (width > 0) - width = MIN(surface->getWidth(), pt.x + width); + width = MIN((int)surface->w, pt.x + width); else - width = surface->getWidth(); + width = surface->w - pt.x; int x = pt.x + 1; int y = pt.y + 1; @@ -154,16 +176,16 @@ int Font::write(MSurface *surface, const Common::String &msg, const Common::Poin for (int i = 0; i < height; i++) { for (int j = 0; j < bpp; j++) { if (*charData & 0xc0) - *destPtr = colors[(*charData & 0xc0) >> 6]; + *destPtr = _fontColors[(*charData & 0xc0) >> 6]; destPtr++; if (*charData & 0x30) - *destPtr = colors[(*charData & 0x30) >> 4]; + *destPtr = _fontColors[(*charData & 0x30) >> 4]; destPtr++; if (*charData & 0x0C) - *destPtr = colors[(*charData & 0x0C) >> 2]; + *destPtr = _fontColors[(*charData & 0x0C) >> 2]; destPtr++; if (*charData & 0x03) - *destPtr = colors[*charData & 0x03]; + *destPtr = _fontColors[*charData & 0x03]; destPtr++; charData++; } @@ -205,10 +227,4 @@ int Font::getBpp(int charWidth) { return 1; } -Font *Font::getFont(const Common::String &fontName) { - Font *font = new Font(_vm); - font->setFont(fontName); - return font; -} - } // End of namespace MADS diff --git a/engines/mads/font.h b/engines/mads/font.h index c642831952..9b3e5bc828 100644 --- a/engines/mads/font.h +++ b/engines/mads/font.h @@ -41,38 +41,42 @@ namespace MADS { class MADSEngine; class Font { -protected: - MADSEngine *_vm; +private: + static uint8 _fontColors[4]; + static MADSEngine *_vm; +public: + /** + * Initialise the font system + */ + static void init(MADSEngine *vm); + /** + * Returns a new Font instance using the specified font name + */ + static Font *getFont(const Common::String &fontName); +protected: uint8 _maxWidth, _maxHeight; uint8 *_charWidths; uint16 *_charOffs; uint8 *_charData; bool _sysFont; Common::String _filename; - uint8 _fontColors[4]; int getBpp(int charWidth); public: - Font(MADSEngine *vm); + Font(); virtual ~Font(); void setFont(const Common::String &filename); void setColor(uint8 color); void setColors(uint8 v1, uint8 v2, uint8 v3, uint8 v4); + void setColorMode(int mode); int maxWidth() const { return _maxWidth; } int getWidth(const Common::String &msg, int spaceWidth = -1); int getHeight() const { return _maxHeight; } - int write(MSurface *surface, const Common::String &msg, const Common::Point &pt, int width, int spaceWidth, uint8 colors[]); - int writeString(MSurface *surface, const Common::String &msg, const Common::Point &pt, int width = 0, int spaceWidth = -1) { - return write(surface, msg, pt, width, spaceWidth, _fontColors); - } - - /** - * Returns a new Font instance using the specified font name - */ - Font *getFont(const Common::String &fontName); + int writeString(MSurface *surface, const Common::String &msg, const Common::Point &pt, + int spaceWidth = 0, int width = 0); }; } // End of namespace MADS diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 03c0544689..3778e834ed 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -165,7 +165,7 @@ void Game::sectionLoop() { _scene._screenObjects._v8333C = true; _scene._screenObjects._v832EC = 0; - _scene._screenObjects._yp = 0; + _scene._userInterface._scrollerY = 0; _v3 = -1; _scene._sceneLogic->setup(); @@ -196,9 +196,9 @@ void Game::sectionLoop() { } _vm->_events->initVars(); - _scene._v1A = true; - _scene._v1C = -1; - _objectHiliteVocabIdx = -1; + _scene._userInterface._v1A = -1; + _scene._userInterface._v1C = -1; + _scene._userInterface._v1E = -1; _scene._action.clear(); _player.turnToDestFacing(); @@ -297,7 +297,6 @@ void Game::loadResourceSequence(const Common::String prefix, int v) { void Game::loadQuotes() { File f("*QUOTES.DAT"); - int curPos = 0; Common::String msg; while (true) { diff --git a/engines/mads/game.h b/engines/mads/game.h index 8e1559ed21..6ef1ca9ef5 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -129,7 +129,6 @@ public: uint32 _priorFrameTimer; Common::String _aaName; uint32 _ticksExpiry; - int _objectHiliteVocabIdx; int _exitFlag; public: virtual ~Game(); diff --git a/engines/mads/inventory.h b/engines/mads/inventory.h index 57ae43b059..1eef0f7f82 100644 --- a/engines/mads/inventory.h +++ b/engines/mads/inventory.h @@ -66,6 +66,13 @@ public: */ void load(); + /** + * Returns the inventory item from the player's inventory + */ + InventoryObject &getItem(int itemIndex) { + return (*this)[_inventoryList[itemIndex]]; + } + /** * Set the associated data? pointer with an inventory object */ diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index ded94871f6..80a797b8d4 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -80,7 +80,8 @@ void MADSEngine::initialise() { _dialogs = Dialogs::init(this); _events = new EventsManager(this); _palette = new Palette(this); - _font = new Font(this); + Font::init(this); + _font = new Font(); _screen.init(); _sound = new SoundManager(this, _mixer); _game = Game::init(this); diff --git a/engines/mads/messages.cpp b/engines/mads/messages.cpp index a9ce093c1f..c355dacb7c 100644 --- a/engines/mads/messages.cpp +++ b/engines/mads/messages.cpp @@ -391,7 +391,7 @@ void TextDisplayList::draw(MSurface *s) { td._font->setColors(0xFF, td._color1, td._color2, 0); td._font->writeString(s, td._msg, Common::Point(td._bounds.left, td._bounds.top), - td._bounds.width(), td._spacing); + td._spacing, td._bounds.width()); } } } diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp index 65858f520e..3ce5bdacd3 100644 --- a/engines/mads/msurface.cpp +++ b/engines/mads/msurface.cpp @@ -58,8 +58,9 @@ void MSurface::setSize(int width, int height) { void MSurface::setPixels(byte *pData, int horizSize, int vertSize) { _freeFlag = false; pixels = pData; - w = horizSize; + w = pitch = horizSize; h = vertSize; + format.bytesPerPixel = 1; } int MSurface::scaleValue(int value, int scale, int err) { diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 0258f15bb8..88533a9ffd 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -35,14 +35,11 @@ Scene::Scene(MADSEngine *vm): _vm(vm), _action(_vm), _depthSurface(vm), _priorSceneId = 0; _nextSceneId = 0; _currentSceneId = 0; - _vocabBuffer = nullptr; _sceneLogic = nullptr; _sceneInfo = nullptr; _animFlag = false; _animVal1 = 0; _depthStyle = 0; - _v1A = 0; - _v1C = 0; _roomChanged = false; _reloadSceneFlag = false; _destFacing = 0; @@ -66,21 +63,14 @@ Scene::Scene(MADSEngine *vm): _vm(vm), _action(_vm), _depthSurface(vm), } Scene::~Scene() { - delete[] _vocabBuffer; delete _sceneLogic; delete _sceneInfo; } void Scene::clearVocab() { - freeVocab(); _activeVocabs.clear(); } -void Scene::freeVocab() { - delete[] _vocabBuffer; - _vocabBuffer = nullptr; -} - void Scene::addActiveVocab(int vocabId) { if (activeVocabIndexOf(vocabId) == -1) { assert(_activeVocabs.size() < 200); @@ -222,21 +212,22 @@ void Scene::loadVocab() { } void Scene::loadVocabStrings() { - freeVocab(); + _vocabStrings.clear(); File f("*VOCAB.DAT"); + Common::String msg; - char *textStrings = new char[f.size()]; - f.read(textStrings, f.size()); - - for (uint strIndex = 0; strIndex < _activeVocabs.size(); ++strIndex) { - const char *s = textStrings; - for (int vocabIndex = 0; vocabIndex < _activeVocabs[strIndex]; ++vocabIndex) - s += strlen(s) + 1; + for (;;) { + char c = (char)f.readByte(); + if (f.eos()) break; - _vocabStrings.push_back(s); + if (c == '\0') { + _vocabStrings.push_back(msg); + msg = ""; + } else { + msg += c; + } } - delete[] textStrings; f.close(); } diff --git a/engines/mads/scene.h b/engines/mads/scene.h index d88f5eccf2..dce799a378 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -41,11 +41,6 @@ namespace MADS { class Scene { private: - /** - * Free the voculary list buffer - */ - void freeVocab(); - /** * Return the index of a given Vocab in the active vocab list */ @@ -88,7 +83,6 @@ public: SpriteSets _sprites; int _spritesIndex; DynamicHotspots _dynamicHotspots; - byte *_vocabBuffer; Common::Array _activeVocabs; SequenceList _sequences; KernelMessages _kernelMessages; @@ -118,8 +112,6 @@ public: int _scaleRange; int _interfaceY; int _spritesCount; - bool _v1A; - int _v1C; MADSAction _action; bool _roomChanged; bool _reloadSceneFlag; @@ -204,6 +196,11 @@ public: */ void loadAnimation(const Common::String &resName, int abortTimers = 0); + /** + * Returns a vocab entry + */ + Common::String getVocab(int vocabId) { return _vocabStrings[vocabId]; } + /** * Clear the data for the scene */ diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index bbc6e1c3b5..c37f0b1f74 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -41,7 +41,6 @@ ScreenObject::ScreenObject() { ScreenObjects::ScreenObjects(MADSEngine *vm): _vm(vm) { _v8333C = false; _v832EC = 0; - _yp = 0; _v7FECA = 0; _v7FED6 = 0; _v8332A = 0; @@ -68,11 +67,11 @@ void ScreenObjects::check(bool scanFlag) { if (!_vm->_events->_mouseButtons || _v832EC) _v7FECA = false; - if ((_vm->_events->_vD6 || _v8332A || _yp || _v8333C) && scanFlag) { - scene._userInterface._selectedObject = scanBackwards(_vm->_events->currentPos(), LAYER_GUI); - if (scene._userInterface._selectedObject > 0) { - _category = (ScrCategory)((*this)[scene._userInterface._selectedObject - 1]._category & 7); - _objectIndex = (*this)[scene._userInterface._selectedObject - 1]._descId; + if ((_vm->_events->_vD6 || _v8332A || _vm->_game->_scene._userInterface._scrollerY || _v8333C) && scanFlag) { + scene._userInterface._selectedInvIndex = scanBackwards(_vm->_events->currentPos(), LAYER_GUI); + if (scene._userInterface._selectedInvIndex > 0) { + _category = (ScrCategory)((*this)[scene._userInterface._selectedInvIndex - 1]._category & 7); + _objectIndex = (*this)[scene._userInterface._selectedInvIndex - 1]._descId; } // Handling for easy mouse @@ -80,7 +79,7 @@ void ScreenObjects::check(bool scanFlag) { if (_vm->_easyMouse && !_vm->_events->_vD4 && category != _category && scene._userInterface._category != CAT_NONE) { _released = true; - if (category >= CAT_ACTION && category <= CAT_6) { + if (category >= CAT_ACTION && category <= CAT_TALK_ENTRY) { scene._userInterface.elementHighlighted(); } } @@ -90,7 +89,7 @@ void ScreenObjects::check(bool scanFlag) { scene._userInterface._category = _category; if (!_vm->_events->_mouseButtons || _vm->_easyMouse) { - if (category >= CAT_ACTION && category <= CAT_6) { + if (category >= CAT_ACTION && category <= CAT_TALK_ENTRY) { scene._userInterface.elementHighlighted(); } } @@ -106,7 +105,7 @@ void ScreenObjects::check(bool scanFlag) { scene._userInterface._category = CAT_NONE; } - if (_vm->_events->_mouseButtons || _vm->_easyMouse || _yp) + if (_vm->_events->_mouseButtons || _vm->_easyMouse || scene._userInterface._scrollerY) proc1(); if (_vm->_events->_mouseButtons || _vm->_easyMouse) diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index 00edefbf91..f2893c5fe1 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -87,7 +87,6 @@ public: int _v7FECA; int _v7FED6; int _v8332A; - int _yp; int _v8333C; int _selectedObject; ScrCategory _category; diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 9cff2217c1..985e28872a 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -41,7 +41,13 @@ UserInterface::UserInterface(MADSEngine *vm) : _vm(vm) { _screenObjectsCount = 0; _inventoryTopIndex = 0; _objectY = 0; - _selectedObject = -1; + _selectedInvIndex = -1; + _selectedActionIndex = -1; + _selectedItemVocabIdx = -1; + _scrollerY = 0; + _v1A = -1; + _v1C = -1; + _v1E = -1; byte *pData = _vm->_screen.getBasePtr(0, MADS_SCENE_HEIGHT); setPixels(pData, MADS_SCREEN_WIDTH, MADS_INTERFACE_HEIGHT); @@ -96,9 +102,9 @@ void UserInterface::setup(int id) { scene._imageInterEntries.clear(); scene._imageInterEntries.add(-2, 0xff); _vm->_game->_ticksExpiry = _vm->_events->getFrameCounter(); - scene._v1A = true; - _vm->_game->_objectHiliteVocabIdx = -1; - scene._v1C = -1; + _v1A = -1; + _v1E = -1; + _v1C = -1; // Make a copy of the surface copyTo(&_surface); @@ -123,30 +129,118 @@ void UserInterface::drawTextElements() { } else { // Draw the actions drawActions(); - drawInventoryList(); - drawItemVocabList(); +// drawInventoryList(); +// drawItemVocabList(); } } void UserInterface::drawActions() { for (int idx = 0; idx < 10; ++idx) { - drawVocab(CAT_ACTION, idx); + writeVocab(CAT_ACTION, idx); } } void UserInterface::drawInventoryList() { int endIndex = MIN((int)_vm->_game->_objects._inventoryList.size(), _inventoryTopIndex + 5); for (int idx = _inventoryTopIndex; idx < endIndex; ++idx) { - drawVocab(CAT_INV_LIST, idx); + writeVocab(CAT_INV_LIST, idx); } } void UserInterface::drawItemVocabList() { + if (_selectedInvIndex >= 0) { + InventoryObject &io = _vm->_game->_objects[ + _vm->_game->_objects._inventoryList[_selectedInvIndex]]; + for (int idx = 0; idx < io._vocabCount; ++idx) { + writeVocab(CAT_INV_VOCAB, idx); + } + } +} +void UserInterface::drawScrolller() { + if (_scrollerY > 0) + writeVocab(CAT_INV_SCROLLER, _scrollerY); + writeVocab(CAT_INV_SCROLLER, 4); } -void UserInterface::drawVocab(ScrCategory category, int id) { +void UserInterface::writeVocab(ScrCategory category, int id) { + Common::Rect bounds; + if (!getBounds(category, id, bounds)) + return; + + Scene &scene = _vm->_game->_scene; + Font *font = nullptr; + + int vocabId; + Common::String vocabStr; + switch (category) { + case CAT_ACTION: + font = _vm->_font->getFont(FONT_INTERFACE); + vocabId = scene._verbList[id]._id; + if (_v1A) { + _vm->_font->setColorMode(1); + } else { + _vm->_font->setColorMode(id == _selectedActionIndex ? 2 : 0); + } + vocabStr = scene.getVocab(vocabId); + vocabStr.toUppercase(); + font->writeString(this, vocabStr, Common::Point(bounds.left, bounds.top)); + break; + + case CAT_INV_LIST: + font = _vm->_font->getFont(FONT_INTERFACE); + vocabId = _vm->_game->_objects.getItem(id)._descId; + if (_v1C == id) { + _vm->_font->setColorMode(1); + } else { + _vm->_font->setColorMode(id == _selectedInvIndex ? 2 : 0); + vocabStr = scene.getVocab(vocabId); + vocabStr.toUppercase(); + font->writeString(this, vocabStr, Common::Point(bounds.left, bounds.top)); + break; + } + break; + + case CAT_TALK_ENTRY: + error("TODO: CAT_TALK_ENTRY"); + + case CAT_INV_SCROLLER: + font = _vm->_font->getFont(FONT_MISC); + switch (id) { + case 1: + vocabStr = "a"; + break; + case 2: + vocabStr = "b"; + break; + case 3: + vocabStr = "d"; + break; + case 4: + vocabStr = "c"; + break; + default: + break; + } + + font->setColorMode((id == 4) || (_scrollerY == 3) ? 1 : 0); + font->writeString(this, vocabStr, Common::Point(bounds.left, bounds.top)); + break; + default: + font = _vm->_font->getFont(FONT_INTERFACE); + vocabId = _vm->_game->_objects.getItem(_selectedInvIndex)._vocabList[id]._vocabId; + if (_v1E == id) { + _vm->_font->setColorMode(1); + } else { + _vm->_font->setColorMode(id == _selectedInvIndex ? 2 : 0); + vocabStr = scene.getVocab(vocabId); + vocabStr.toUppercase(); + font->writeString(this, vocabStr, Common::Point(bounds.left, bounds.top)); + break; + } + break; + } } void UserInterface::setBounds(const Common::Rect &r) { @@ -204,23 +298,23 @@ void UserInterface::loadElements() { } if (scene._screenObjects._v832EC == 1) { + // setup areas for talk entries for (int idx = 0; idx < 5; ++idx) { - getBounds(CAT_6, idx, bounds); + getBounds(CAT_TALK_ENTRY, idx, bounds); moveRect(bounds); - scene._screenObjects.add(bounds, LAYER_GUI, CAT_6, idx); + scene._screenObjects.add(bounds, LAYER_GUI, CAT_TALK_ENTRY, idx); } } } bool UserInterface::getBounds(ScrCategory category, int v, Common::Rect &bounds) { - Common::Rect result; int heightMultiplier, widthMultiplier; int leftStart, yOffset, widthAmt; switch (category) { case CAT_ACTION: - heightMultiplier = v / 5; + heightMultiplier = v % 5; widthMultiplier = v / 5; leftStart = 2; yOffset = 3; @@ -238,7 +332,7 @@ bool UserInterface::getBounds(ScrCategory category, int v, Common::Rect &bounds) widthAmt = 69; break; - case CAT_6: + case CAT_TALK_ENTRY: heightMultiplier = v; widthMultiplier = 0; leftStart = 2; @@ -263,32 +357,32 @@ bool UserInterface::getBounds(ScrCategory category, int v, Common::Rect &bounds) break; } - result.left = (widthMultiplier > 0) ? widthMultiplier * widthAmt + leftStart : leftStart; - result.setWidth(widthAmt); - result.top = heightMultiplier * 3 + yOffset; - result.setHeight(8); + bounds.left = (widthMultiplier > 0) ? widthMultiplier * widthAmt + leftStart : leftStart; + bounds.setWidth(widthAmt); + bounds.top = heightMultiplier * 8 + yOffset; + bounds.setHeight(8); if (category == CAT_INV_SCROLLER) { switch (v) { case 1: // Arrow up - result.top = 4; - result.setHeight(7); + bounds.top = 4; + bounds.setHeight(7); break; case 2: // Arrow down - result.top = 35; - result.setHeight(7); + bounds.top = 35; + bounds.setHeight(7); break; case 3: // Scroller - result.top = 12; - result.setHeight(22); + bounds.top = 12; + bounds.setHeight(22); break; case 4: // Thumb - result.top = _objectY + 14; - result.setHeight(1); + bounds.top = _objectY + 14; + bounds.setHeight(1); break; default: break; diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h index e3a1b2098e..cab26534c4 100644 --- a/engines/mads/user_interface.h +++ b/engines/mads/user_interface.h @@ -32,7 +32,7 @@ namespace MADS { enum ScrCategory { CAT_NONE = 0, CAT_ACTION = 1, CAT_INV_LIST = 2, CAT_INV_VOCAB = 3, - CAT_HOTSPOT = 4, CAT_INV_ANIM = 5, CAT_6 = 6, CAT_INV_SCROLLER = 7, + CAT_HOTSPOT = 4, CAT_INV_ANIM = 5, CAT_TALK_ENTRY = 6, CAT_INV_SCROLLER = 7, CAT_12 = 12 }; @@ -76,9 +76,14 @@ private: void drawItemVocabList(); /** - * Draw a vocab text entry + * Draw the inventory scroller */ - void drawVocab(ScrCategory category, int id); + void drawScrolller(); + + /** + * Draw a UI textual element + */ + void writeVocab(ScrCategory category, int id); public: ScrCategory _category; int _screenObjectsCount; @@ -87,7 +92,13 @@ public: MSurface _surface; int _inventoryTopIndex; int _objectY; - int _selectedObject; + int _selectedInvIndex; + int _selectedActionIndex; + int _selectedItemVocabIdx; + int _scrollerY; + int _v1A; + int _v1C; + int _v1E; public: /** * Constructor -- cgit v1.2.3 From b831323c85bb1ca26368cee6690d4664c37e9c0b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 17 Mar 2014 00:00:22 -0400 Subject: MADS: Added caching for font instances --- engines/mads/dialogs.cpp | 1 - engines/mads/font.cpp | 46 ++++++++++++++++++++++++++++------------------ engines/mads/font.h | 17 ++++++++++++----- engines/mads/mads.cpp | 1 + engines/mads/messages.cpp | 1 - 5 files changed, 41 insertions(+), 25 deletions(-) diff --git a/engines/mads/dialogs.cpp b/engines/mads/dialogs.cpp index 4c1a789a57..333bbe98b4 100644 --- a/engines/mads/dialogs.cpp +++ b/engines/mads/dialogs.cpp @@ -106,7 +106,6 @@ TextDialog::TextDialog(MADSEngine *vm, const Common::String &fontName, _fontName = fontName; _position = pos; - _vm->_font->setFont(FONT_INTERFACE); _vm->_font->setColors(TEXTDIALOG_BLACK, TEXTDIALOG_BLACK, TEXTDIALOG_BLACK, TEXTDIALOG_BLACK); _innerWidth = (_vm->_font->maxWidth() + 1) * maxChars; diff --git a/engines/mads/font.cpp b/engines/mads/font.cpp index 205e653639..ed7542d2e5 100644 --- a/engines/mads/font.cpp +++ b/engines/mads/font.cpp @@ -28,7 +28,9 @@ namespace MADS { -MADSEngine *Font::_vm = nullptr; +MADSEngine *Font::_vm; + +Common::HashMap *Font::_fonts; uint8 Font::_fontColors[4]; @@ -38,24 +40,40 @@ void Font::init(MADSEngine *vm) { _fontColors[1] = 0xF; _fontColors[2] = 7; _fontColors[3] = 8; + + _fonts = new Common::HashMap(); +} + +void Font::deinit() { + Common::HashMap::iterator i; + for (i = _fonts->begin(); i != _fonts->end(); ++i) + delete (*i)._value; + + delete _fonts; } Font *Font::getFont(const Common::String &fontName) { - Font *font = new Font(); - font->setFont(fontName); - return font; + if (_fonts->contains(fontName)) { + return _fonts->getVal(fontName); + } else { + Font *font = new Font(fontName); + _fonts->setVal(fontName, font); + return font; + } } Font::Font() { - _sysFont = true; + setFont(FONT_INTERFACE); +} + +Font::Font(const Common::String &filename) { + setFont(filename); } Font::~Font() { - if (!_sysFont) { - delete[] _charWidths; - delete[] _charOffs; - delete[] _charData; - } + delete[] _charWidths; + delete[] _charOffs; + delete[] _charData; } void Font::setFont(const Common::String &filename) { @@ -63,7 +81,6 @@ void Font::setFont(const Common::String &filename) { // Already using specified font, so don't bother reloading return; - _sysFont = false; _filename = filename; MadsPack fontData(filename, _vm); @@ -95,13 +112,6 @@ void Font::setFont(const Common::String &filename) { delete fontFile; } -void Font::setColor(uint8 color) { - if (_sysFont) - _fontColors[1] = color; - else - _fontColors[3] = color; -} - void Font::setColors(uint8 v1, uint8 v2, uint8 v3, uint8 v4) { _fontColors[0] = v1; _fontColors[1] = v2; diff --git a/engines/mads/font.h b/engines/mads/font.h index 9b3e5bc828..5079f1261f 100644 --- a/engines/mads/font.h +++ b/engines/mads/font.h @@ -24,8 +24,9 @@ #define MADS_FONT_H #include "common/scummsys.h" -#include "common/util.h" +#include "common/hashmap.h" #include "common/endian.h" +#include "common/util.h" #include "mads/msurface.h" namespace MADS { @@ -44,31 +45,37 @@ class Font { private: static uint8 _fontColors[4]; static MADSEngine *_vm; + static Common::HashMap *_fonts; public: /** * Initialise the font system */ static void init(MADSEngine *vm); + /** + * Free up the resources used by the font + */ + static void deinit(); + /** * Returns a new Font instance using the specified font name */ static Font *getFont(const Common::String &fontName); -protected: +private: uint8 _maxWidth, _maxHeight; uint8 *_charWidths; uint16 *_charOffs; uint8 *_charData; - bool _sysFont; Common::String _filename; int getBpp(int charWidth); + + void setFont(const Common::String &filename); public: Font(); + Font(const Common::String &filename); virtual ~Font(); - void setFont(const Common::String &filename); - void setColor(uint8 color); void setColors(uint8 v1, uint8 v2, uint8 v3, uint8 v4); void setColorMode(int mode); diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index 80a797b8d4..1785ce3f00 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -59,6 +59,7 @@ MADSEngine::~MADSEngine() { delete _dialogs; delete _events; delete _font; + Font::deinit(); delete _game; delete _palette; delete _resources; diff --git a/engines/mads/messages.cpp b/engines/mads/messages.cpp index c355dacb7c..592dd4bd28 100644 --- a/engines/mads/messages.cpp +++ b/engines/mads/messages.cpp @@ -40,7 +40,6 @@ KernelMessages::KernelMessages(MADSEngine *vm): _vm(vm) { } KernelMessages::~KernelMessages() { - delete _talkFont; } void KernelMessages::clear() { -- cgit v1.2.3 From e6b73f4938e2bdb3601f6d567336fe8167ea7e1f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 17 Mar 2014 00:20:50 -0400 Subject: MADS: Actions text in the UI now displaying correctly --- engines/mads/scene.h | 2 +- engines/mads/user_interface.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/engines/mads/scene.h b/engines/mads/scene.h index dce799a378..3a94754dd2 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -199,7 +199,7 @@ public: /** * Returns a vocab entry */ - Common::String getVocab(int vocabId) { return _vocabStrings[vocabId]; } + Common::String getVocab(int vocabId) { return _vocabStrings[vocabId - 1]; } /** * Clear the data for the scene diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 985e28872a..5ab0b0f356 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -129,8 +129,8 @@ void UserInterface::drawTextElements() { } else { // Draw the actions drawActions(); -// drawInventoryList(); -// drawItemVocabList(); + drawInventoryList(); + drawItemVocabList(); } } @@ -183,7 +183,7 @@ void UserInterface::writeVocab(ScrCategory category, int id) { _vm->_font->setColorMode(id == _selectedActionIndex ? 2 : 0); } vocabStr = scene.getVocab(vocabId); - vocabStr.toUppercase(); + vocabStr.setChar(toupper(vocabStr[0]), 0); font->writeString(this, vocabStr, Common::Point(bounds.left, bounds.top)); break; @@ -195,7 +195,7 @@ void UserInterface::writeVocab(ScrCategory category, int id) { } else { _vm->_font->setColorMode(id == _selectedInvIndex ? 2 : 0); vocabStr = scene.getVocab(vocabId); - vocabStr.toUppercase(); + vocabStr.setChar(toupper(vocabStr[0]), 0); font->writeString(this, vocabStr, Common::Point(bounds.left, bounds.top)); break; } @@ -235,7 +235,7 @@ void UserInterface::writeVocab(ScrCategory category, int id) { } else { _vm->_font->setColorMode(id == _selectedInvIndex ? 2 : 0); vocabStr = scene.getVocab(vocabId); - vocabStr.toUppercase(); + vocabStr.setChar(toupper(vocabStr[0]), 0); font->writeString(this, vocabStr, Common::Point(bounds.left, bounds.top)); break; } -- cgit v1.2.3 From d57d4b876e90d1d043bd171c9de46d93c9e014f4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 17 Mar 2014 08:47:20 +0100 Subject: MADS: Implement some more logic used in scene 201 --- engines/mads/nebular/nebular_scenes2.cpp | 139 +++++++++++++++++++++++++++++-- engines/mads/nebular/nebular_scenes2.h | 2 + engines/mads/player.cpp | 9 ++ engines/mads/player.h | 2 + 4 files changed, 146 insertions(+), 6 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 53e876b216..d3284cc649 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -54,9 +54,9 @@ void Scene2xx::setPlayerSpritesPrefix() { } if (_scene->_nextSceneId > 212) - _game._player._unk4 = 0; + _game._player._unk4 = false; else - _game._player._unk4 = -1; + _game._player._unk4 = true; if (oldName != _game._player._spritesPrefix) _game._player._spritesChanged = true; @@ -70,6 +70,56 @@ void Scene2xx::setPlayerSpritesPrefix() { /*------------------------------------------------------------------------*/ +void Scene2xx::sceneEntrySound() { + if (_vm->_musicFlag) { + switch (_scene->_nextSceneId) { + case 201: + if ((_globals[39] == 2) || (_globals[39] == 4) || (_globals[33] != 1)) + _vm->_sound->command(17); + else + _vm->_sound->command(9); + break; + case 202: + case 203: + case 204: + case 205: + case 208: + case 209: + case 212: + _vm->_sound->command(9); + break; + case 206: + case 211: + case 215: + _vm->_sound->command(10); + break; + case 207: + case 214: + _vm->_sound->command(11); + break; + case 210: + if (_globals[44] == 0) + _vm->_sound->command(15); + else + _vm->_sound->command(10); + break; + case 213: + if (_globals[38] == 0) + _vm->_sound->command(1); + else + _vm->_sound->command(9); + break; + case 216: + _vm->_sound->command(16); + break; + default: + _vm->_sound->command(10); + break; + } + } else + _vm->_sound->command(2); +} + void Scene201::setup() { setPlayerSpritesPrefix(); setAAName(); @@ -81,6 +131,86 @@ void Scene201::setup() { } void Scene201::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 0), 0); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 1), 0); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('m', -1), 0); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('b', -1), 0); + _globals._spriteIndexes[5] = _scene->_sprites.addSprites("*SC002Z1"); + _globals._spriteIndexes[16] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 6, 0, 1, 0); + _globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 15, 0, 0, 50); + _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 4, 0, 0, 0); + _globals._spriteIndexes[19] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 6, 0, 0, 0); + _scene->_sequences.setDepth(_globals._spriteIndexes[19], 8); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[19], Common::Point(185, 46)); + + int idx = _scene->_dynamicHotspots.add(1159, 209, _globals._spriteIndexes[19], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, 186, 81, 8); + + _globals._v0 = 0; + + if ((_scene->_priorSceneId == 202) || (_scene->_priorSceneId == -1)) { + _game._player._playerPos = Common::Point(165, 152); + } else { + _game._player._playerPos = Common::Point(223, 149); + _game._player._direction = 2; + } + + if (_globals[39] != 0) { + _game._player._visible = false; + _game._player._stepEnabled = false; + int sepChar = (_globals[0] == SEX_UNKNOWN) ? 't' : 'u'; + // Guess values. What is the default value used by the compiler? + int suffixNum = -1; + int abortTimers = -1; + switch(_globals[39]) { + case 1: + suffixNum = 3; + abortTimers = 76; + _globals[41] = -1; + break; + case 2: + suffixNum = 1; + abortTimers = 77; + break; + case 3: + _game._player._visible = true; + _game._player._stepEnabled = true; + suffixNum = -1; + break; + case 4: + suffixNum = 2; + abortTimers = 78; + break; + } + _globals[39] = 0; + if (suffixNum >= 0) + _scene->loadAnimation(formAnimName(sepChar, suffixNum), abortTimers); + } + + if ((_scene->_priorSceneId == 202) && (_globals[33] == 1) && !_scene->_roomChanged) { + _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('a', 0), 0); + _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('a', 1), 0); + _game.loadQuoteSet(90, 91, 0); + _game._player._stepEnabled = false; + _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 7, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[21], -1, 12); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[21], SM_FRAME_INDEX, 12, 70); + _scene->_sequences.setDepth(_globals._spriteIndexes[21], 1); + _globals._frameTime = 0; + _game._player.sub7E53C(Common::Point(157, 143), 8); + _vm->_palette->setEntry(252, 45, 63, 45); + _vm->_palette->setEntry(253, 20, 45, 20); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 2, 0, 120, _game.getQuote(90)); + } else + _globals._frameTime = 0xFFFF; + + if (_globals[41] != 0) + _scene->_hotspots.activate(438, false); + + sceneEntrySound(); +} + +void Scene201::step() { if ((_globals._frameTime) && (_vm->getRandomNumber(5000) == 9)) { _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 5, 1, 6, 0); int idx = _scene->_dynamicHotspots.add(351, 13, _globals._spriteIndexes[20], Common::Rect(0, 0, 0, 0)); @@ -89,7 +219,7 @@ void Scene201::enter() { _vm->_sound->command(14); _globals._frameTime = 0; } - + if (_game._abortTimers == 70) { _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 9, 1, 0, 0); _game._player._visible = false; @@ -154,9 +284,6 @@ void Scene201::enter() { } } -void Scene201::step() { -} - void Scene201::actions() { } diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index c4de73192f..4d6e6a20fd 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -43,6 +43,8 @@ protected: * Updates the prefix used for getting player sprites for the scene */ void setPlayerSpritesPrefix(); + + void sceneEntrySound(); public: Scene2xx(MADSEngine *vm) : NebularScene(vm) {} }; diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index 3fc7ca53dd..44dfc88ede 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -737,4 +737,13 @@ void Player::startMovement() { _v8452E = -_v84530; } +void Player::sub7E53C(Common::Point pos, int direction) { + Scene &scene = _vm->_game->_scene; + + reset(); + scene._action._startWalkFlag = true; + scene._action._walkFlag = true; + scene._destPos = pos; + scene._destFacing = direction; +} } // End of namespace MADS diff --git a/engines/mads/player.h b/engines/mads/player.h index 9a615e544f..ed44de2c20 100644 --- a/engines/mads/player.h +++ b/engines/mads/player.h @@ -153,6 +153,8 @@ public: void setDest(const Common::Point &pt, int facing); void nextFrame(); + + void sub7E53C(Common::Point pos, int direction); }; } // End of namespace MADS -- cgit v1.2.3 From 0c8a3a47e28075bd559be43bde910587af35d8ab Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 17 Mar 2014 21:53:22 -0400 Subject: MADS: Transformed ImageInterEntries to be User Interface UISlots --- engines/mads/animation.cpp | 8 +- engines/mads/game.cpp | 7 +- engines/mads/nebular/nebular_scenes2.cpp | 2 +- engines/mads/player.cpp | 27 ++--- engines/mads/player.h | 4 +- engines/mads/scene.cpp | 2 +- engines/mads/scene.h | 1 - engines/mads/scene_data.cpp | 172 +----------------------------- engines/mads/scene_data.h | 55 ---------- engines/mads/screen.cpp | 173 +++++++++++++++++++++++++++++++ engines/mads/screen.h | 58 +++++++++++ engines/mads/sequence.cpp | 2 +- engines/mads/sprites.cpp | 70 ++++--------- engines/mads/sprites.h | 34 ++---- engines/mads/user_interface.cpp | 69 ++++++++++-- engines/mads/user_interface.h | 29 ++++++ 16 files changed, 383 insertions(+), 330 deletions(-) diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index 783611e3da..b0b69b946a 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -403,7 +403,7 @@ void Animation::update() { for (uint idx = 0; idx < scene._spriteSlots.size(); ++idx) { if (scene._spriteSlots[idx]._seqIndex >= 0x80) - scene._spriteSlots[idx]._spriteType = ST_EXPIRED; + scene._spriteSlots[idx]._SlotType = ST_EXPIRED; } // Validate the current frame @@ -445,7 +445,7 @@ void Animation::update() { if (paChanged) { newIndex = scene._spriteSlots.add(); scene._spriteSlots[newIndex]._seqIndex = -1; - scene._spriteSlots[newIndex]._spriteType = ST_FULL_SCREEN_REFRESH; + scene._spriteSlots[newIndex]._SlotType = ST_FULL_SCREEN_REFRESH; } // Main frame animation loop - frames get animated by being placed, as necessary, into the @@ -463,7 +463,7 @@ void Animation::update() { int seqIndex = _frameEntries[_oldFrameEntry]._seqIndex - scene._spriteSlots[index]._seqIndex; if (seqIndex == 0x80) { if (scene._spriteSlots[index] == _frameEntries[_oldFrameEntry]._spriteSlot) { - scene._spriteSlots[index]._spriteType = ST_NONE; + scene._spriteSlots[index]._SlotType = ST_NONE; spriteSlotIndex = -1; } } @@ -479,7 +479,7 @@ void Animation::update() { SpriteAsset &spriteSet = *scene._sprites[ scene._spriteSlots[slotIndex]._spritesIndex]; - slot._spriteType = spriteSet.isBackground() ? ST_BACKGROUND : ST_FOREGROUND; + slot._SlotType = spriteSet.isBackground() ? ST_BACKGROUND : ST_FOREGROUND; } break; } diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 3778e834ed..e65330a5d4 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -235,7 +235,12 @@ void Game::sectionLoop() { _player._priorTimer = _scene._frameStartTime + _player._ticksAmount; _player.idle(); - warning("TODO: _selectedObject IF block"); + if (_scene._userInterface._selectedInvIndex >= 0) { + _scene._userInterface.loadInventoryAnim( + _objects._inventoryList[_scene._userInterface._selectedInvIndex]); + } else { + _scene._userInterface.noInventoryAnim(); + } _v1 = 5; _scene._roomChanged = false; diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index d3284cc649..63c03dc5c8 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -197,7 +197,7 @@ void Scene201::enter() { _scene->_sequences.addSubEntry(_globals._spriteIndexes[21], SM_FRAME_INDEX, 12, 70); _scene->_sequences.setDepth(_globals._spriteIndexes[21], 1); _globals._frameTime = 0; - _game._player.sub7E53C(Common::Point(157, 143), 8); + _game._player.startWalking(Common::Point(157, 143), 8); _vm->_palette->setEntry(252, 45, 63, 45); _vm->_palette->setEntry(253, 20, 45, 20); _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 2, 0, 120, _game.getQuote(90)); diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index 44dfc88ede..80343609b9 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -246,7 +246,7 @@ void Player::update() { if (_forceRefresh || (_visible != _priorVisible)) { int slotIndex = getSpriteSlot(); if (slotIndex >= 0) - scene._spriteSlots[slotIndex]._spriteType = ST_EXPIRED; + scene._spriteSlots[slotIndex]._SlotType = ST_EXPIRED; int newDepth = 1; int yp = MAX(_playerPos.y, (int16)(MADS_SCENE_HEIGHT - 1)); @@ -264,7 +264,7 @@ void Player::update() { if (_visible) { // Player sprite needs to be rendered SpriteSlot slot; - slot._spriteType = ST_FOREGROUND; + slot._SlotType = ST_FOREGROUND; slot._seqIndex = PLAYER_SEQ_INDEX; slot._spritesIndex = _spritesStart + _spritesIdx; slot._frameNumber = _frameOffset + _frameNum; @@ -285,7 +285,7 @@ void Player::update() { if (equal) // Undo the prior expiry of the player sprite - s2._spriteType = ST_NONE; + s2._SlotType = ST_NONE; else slotIndex = -1; } @@ -359,6 +359,16 @@ void Player::setDest(const Common::Point &pt, int facing) { } } +void Player::startWalking(const Common::Point &pos, int direction) { + Scene &scene = _vm->_game->_scene; + + reset(); + scene._action._startWalkFlag = true; + scene._action._walkFlag = true; + scene._destPos = pos; + scene._destFacing = direction; +} + void Player::nextFrame() { Scene &scene = _vm->_game->_scene; @@ -528,7 +538,7 @@ int Player::getSpriteSlot() { for (uint idx = 0; idx < spriteSlots.size(); ++idx) { if (spriteSlots[idx]._seqIndex == PLAYER_SEQ_INDEX && - spriteSlots[idx]._spriteType >= ST_NONE) + spriteSlots[idx]._SlotType >= ST_NONE) return idx; } @@ -737,13 +747,4 @@ void Player::startMovement() { _v8452E = -_v84530; } -void Player::sub7E53C(Common::Point pos, int direction) { - Scene &scene = _vm->_game->_scene; - - reset(); - scene._action._startWalkFlag = true; - scene._action._walkFlag = true; - scene._destPos = pos; - scene._destFacing = direction; -} } // End of namespace MADS diff --git a/engines/mads/player.h b/engines/mads/player.h index ed44de2c20..e330c650de 100644 --- a/engines/mads/player.h +++ b/engines/mads/player.h @@ -152,9 +152,9 @@ public: void setDest(const Common::Point &pt, int facing); - void nextFrame(); + void startWalking(const Common::Point &pos, int direction); - void sub7E53C(Common::Point pos, int direction); + void nextFrame(); }; } // End of namespace MADS diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 88533a9ffd..ed5fca5f6e 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -379,7 +379,7 @@ void Scene::doFrame() { _kernelMessages.update(); } - _imageInterEntries.call(_vm->_game->_abortTimers2 == kTransitionFadeIn ? 0xff : 0, + _userInterface._uiSlots.call(_vm->_game->_abortTimers2 == kTransitionFadeIn ? 0xff : 0, _vm->_game->_abortTimers2); // Write any text needed by the interface diff --git a/engines/mads/scene.h b/engines/mads/scene.h index 3a94754dd2..f5163bb43d 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -90,7 +90,6 @@ public: int _textSpacing; Hotspots _hotspots; ScreenObjects _screenObjects; - ImageInterEntries _imageInterEntries; DirtyAreas _dirtyAreas; int _v1; SceneInfo *_sceneInfo; diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index c37f0b1f74..8980bd4428 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -136,173 +136,11 @@ void ScreenObjects::proc1() { /*------------------------------------------------------------------------*/ -MADSEngine *DirtyArea::_vm = nullptr; - -DirtyArea::DirtyArea() { - _active = false; - _textActive = false; -} - -void DirtyArea::setArea(int width, int height, int maxWidth, int maxHeight) { - if (_bounds.left % 2) { - --_bounds.left; - ++width; - } - - if (_bounds.left < 0) - _bounds.left = 0; - else if (_bounds.left > maxWidth) - _bounds.left = maxWidth; - int right = _bounds.left + width; - if (right < 0) - right = 0; - if (right > maxWidth) - right = maxWidth; - - _bounds.right = right; - _bounds2.left = _bounds.width() / 2; - _bounds2.right = _bounds.left + (_bounds.width() + 1) / 2 - 1; - - if (_bounds.top < 0) - _bounds.top = 0; - else if (_bounds.top > maxHeight) - _bounds.top = maxHeight; - int bottom = _bounds.top + height; - if (bottom < 0) - bottom = 0; - if (bottom > maxHeight) - bottom = maxHeight; - - _bounds.bottom = bottom; - _bounds2.top = _bounds.height() / 2; - _bounds2.bottom = _bounds.top + (_bounds.height() + 1) / 2 - 1; - - _active = true; -} - - -void DirtyArea::setSpriteSlot(const SpriteSlot *spriteSlot) { - int width, height; - Scene &scene = _vm->_game->_scene; - - if (spriteSlot->_spriteType == ST_FULL_SCREEN_REFRESH) { - // Special entry to refresh the entire screen - _bounds.left = 0; - _bounds.top = 0; - width = MADS_SCREEN_WIDTH; - height = MADS_SCENE_HEIGHT; - } else { - // Standard sprite slots - _bounds.left = spriteSlot->_position.x - scene._posAdjust.x; - _bounds.top = spriteSlot->_position.y - scene._posAdjust.y; - - SpriteAsset &spriteSet = *scene._sprites[spriteSlot->_spritesIndex]; - MSprite *frame = spriteSet.getFrame(((spriteSlot->_frameNumber & 0x7fff) - 1) & 0x7f); - - if (spriteSlot->_scale == -1) { - width = frame->w; - height = frame->h; - } else { - width = frame->w * spriteSlot->_scale / 100; - height = frame->h * spriteSlot->_scale / 100; - - _bounds.left -= width / 2; - _bounds.top += -(height - 1); - } - } - - setArea(width, height, MADS_SCREEN_WIDTH, MADS_SCENE_HEIGHT); -} - -void DirtyArea::setTextDisplay(const TextDisplay *textDisplay) { - _bounds.left = textDisplay->_bounds.left; - _bounds.top = textDisplay->_bounds.top; - - setArea(textDisplay->_bounds.width(), textDisplay->_bounds.height(), - MADS_SCREEN_WIDTH, MADS_SCENE_HEIGHT); -} - -/*------------------------------------------------------------------------*/ - -DirtyAreas::DirtyAreas(MADSEngine *vm) : _vm(vm) { - DirtyArea::_vm = vm; - - for (int i = 0; i < DIRTY_AREAS_SIZE; ++i) { - DirtyArea rec; - rec._active = false; - push_back(rec); - } -} - -void DirtyAreas::merge(int startIndex, int count) { - if (startIndex >= count) - return; - - for (int outerCtr = startIndex - 1, idx = 0; idx < count; ++outerCtr, ++idx) { - if (!(*this)[outerCtr]._active) - continue; - - for (int innerCtr = outerCtr + 1; innerCtr < count; ++innerCtr) { - if (!(*this)[innerCtr]._active || !intersects(outerCtr, innerCtr)) - continue; - - if ((*this)[outerCtr]._textActive && (*this)[innerCtr]._textActive) - mergeAreas(outerCtr, innerCtr); - } - } -} - -/** -* Returns true if two dirty areas intersect -*/ -bool DirtyAreas::intersects(int idx1, int idx2) { - return (*this)[idx1]._bounds2.intersects((*this)[idx2]._bounds2); -} - -void DirtyAreas::mergeAreas(int idx1, int idx2) { - DirtyArea &da1 = (*this)[idx1]; - DirtyArea &da2 = (*this)[idx2]; - - da1._bounds.extend(da2._bounds); - - da1._bounds2.left = da1._bounds.width() / 2; - da1._bounds2.right = da1._bounds.left + (da1._bounds.width() + 1) / 2 - 1; - da1._bounds2.top = da1._bounds.height() / 2; - da1._bounds2.bottom = da1._bounds.top + (da1._bounds.height() + 1) / 2 - 1; - - da2._active = false; - da1._textActive = true; -} - -void DirtyAreas::copy(MSurface *srcSurface, MSurface *destSurface, const Common::Point &posAdjust) { - for (uint i = 0; i < size(); ++i) { - const Common::Rect &srcBounds = (*this)[i]._bounds; - - Common::Rect bounds(srcBounds.left + posAdjust.x, srcBounds.top + posAdjust.y, - srcBounds.right + posAdjust.x, srcBounds.bottom + posAdjust.y); - - if ((*this)[i]._active && bounds.isValidRect()) { - srcSurface->copyTo(destSurface, bounds, Common::Point(bounds.left, bounds.top)); - } - } -} - -void DirtyAreas::copyToScreen(const Common::Point &posAdjust) { - for (uint i = 0; i < size(); ++i) { - const Common::Rect &srcBounds = (*this)[i]._bounds; - - Common::Rect bounds(srcBounds.left + posAdjust.x, srcBounds.top + posAdjust.y, - srcBounds.right + posAdjust.x, srcBounds.bottom + posAdjust.y); - - if ((*this)[i]._active && (*this)[i]._bounds.isValidRect()) { - _vm->_screen.copyRectToScreen(bounds); - } - } -} - -void DirtyAreas::reset() { - for (uint i = 0; i < size(); ++i) - (*this)[i]._active = false; +void SceneNode::load(Common::SeekableReadStream *f) { + _walkPos.x = f->readSint16LE(); + _walkPos.y = f->readSint16LE(); + for (int i = 0; i < MAX_ROUTE_NODES; ++i) + _indexes[i] = f->readUint16LE(); } /*------------------------------------------------------------------------*/ diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index f2893c5fe1..1543669f7f 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -108,61 +108,6 @@ public: void check(bool scanFlag); }; -class DirtyArea { -private: - static MADSEngine *_vm; - friend class DirtyAreas; -public: - Common::Rect _bounds; - Common::Rect _bounds2; - bool _textActive; - bool _active; - - DirtyArea(); - - void setArea(int width, int height, int maxWidth, int maxHeight); - - void setSpriteSlot(const SpriteSlot *spriteSlot); - - /** - * Set up a dirty area for a text display - */ - void setTextDisplay(const TextDisplay *textDisplay); -}; - -class DirtyAreas: public Common::Array { -private: - MADSEngine *_vm; -public: - DirtyAreas(MADSEngine *vm); - - /** - * Merge together any designated dirty areas that overlap - * @param startIndex 1-based starting dirty area starting index - * @param count Number of entries to process - */ - void merge(int startIndex, int count); - - bool intersects(int idx1, int idx2); - void mergeAreas(int idx1, int idx2); - - /** - * Copy the data specified by the dirty rect list between surfaces - * @param srcSurface Source surface - * @param destSurface Dest surface - * @param posAdjust Position adjustment - */ - void copy(MSurface *srcSurface, MSurface *destSurface, const Common::Point &posAdjust); - - /** - * Use the lsit of dirty areas to copy areas of the screen surface to - * the physical screen - * @param posAdjust Position adjustment */ - void copyToScreen(const Common::Point &posAdjust); - - void reset(); -}; - class SceneLogic { protected: MADSEngine *_vm; diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index 20ff4f6df2..e760aa465d 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -28,6 +28,179 @@ namespace MADS { +MADSEngine *DirtyArea::_vm = nullptr; + +DirtyArea::DirtyArea() { + _active = false; + _textActive = false; +} + +void DirtyArea::setArea(int width, int height, int maxWidth, int maxHeight) { + if (_bounds.left % 2) { + --_bounds.left; + ++width; + } + + if (_bounds.left < 0) + _bounds.left = 0; + else if (_bounds.left > maxWidth) + _bounds.left = maxWidth; + int right = _bounds.left + width; + if (right < 0) + right = 0; + if (right > maxWidth) + right = maxWidth; + + _bounds.right = right; + _bounds2.left = _bounds.width() / 2; + _bounds2.right = _bounds.left + (_bounds.width() + 1) / 2 - 1; + + if (_bounds.top < 0) + _bounds.top = 0; + else if (_bounds.top > maxHeight) + _bounds.top = maxHeight; + int bottom = _bounds.top + height; + if (bottom < 0) + bottom = 0; + if (bottom > maxHeight) + bottom = maxHeight; + + _bounds.bottom = bottom; + _bounds2.top = _bounds.height() / 2; + _bounds2.bottom = _bounds.top + (_bounds.height() + 1) / 2 - 1; + + _active = true; +} + + +void DirtyArea::setSpriteSlot(const SpriteSlot *spriteSlot) { + int width, height; + Scene &scene = _vm->_game->_scene; + + if (spriteSlot->_SlotType == ST_FULL_SCREEN_REFRESH) { + // Special entry to refresh the entire screen + _bounds.left = 0; + _bounds.top = 0; + width = MADS_SCREEN_WIDTH; + height = MADS_SCENE_HEIGHT; + } + else { + // Standard sprite slots + _bounds.left = spriteSlot->_position.x - scene._posAdjust.x; + _bounds.top = spriteSlot->_position.y - scene._posAdjust.y; + + SpriteAsset &spriteSet = *scene._sprites[spriteSlot->_spritesIndex]; + MSprite *frame = spriteSet.getFrame(((spriteSlot->_frameNumber & 0x7fff) - 1) & 0x7f); + + if (spriteSlot->_scale == -1) { + width = frame->w; + height = frame->h; + } + else { + width = frame->w * spriteSlot->_scale / 100; + height = frame->h * spriteSlot->_scale / 100; + + _bounds.left -= width / 2; + _bounds.top += -(height - 1); + } + } + + setArea(width, height, MADS_SCREEN_WIDTH, MADS_SCENE_HEIGHT); +} + +void DirtyArea::setTextDisplay(const TextDisplay *textDisplay) { + _bounds.left = textDisplay->_bounds.left; + _bounds.top = textDisplay->_bounds.top; + + setArea(textDisplay->_bounds.width(), textDisplay->_bounds.height(), + MADS_SCREEN_WIDTH, MADS_SCENE_HEIGHT); +} + +/*------------------------------------------------------------------------*/ + +DirtyAreas::DirtyAreas(MADSEngine *vm) : _vm(vm) { + DirtyArea::_vm = vm; + + for (int i = 0; i < DIRTY_AREAS_SIZE; ++i) { + DirtyArea rec; + rec._active = false; + push_back(rec); + } +} + +void DirtyAreas::merge(int startIndex, int count) { + if (startIndex >= count) + return; + + for (int outerCtr = startIndex - 1, idx = 0; idx < count; ++outerCtr, ++idx) { + if (!(*this)[outerCtr]._active) + continue; + + for (int innerCtr = outerCtr + 1; innerCtr < count; ++innerCtr) { + if (!(*this)[innerCtr]._active || !intersects(outerCtr, innerCtr)) + continue; + + if ((*this)[outerCtr]._textActive && (*this)[innerCtr]._textActive) + mergeAreas(outerCtr, innerCtr); + } + } +} + +/** +* Returns true if two dirty areas intersect +*/ +bool DirtyAreas::intersects(int idx1, int idx2) { + return (*this)[idx1]._bounds2.intersects((*this)[idx2]._bounds2); +} + +void DirtyAreas::mergeAreas(int idx1, int idx2) { + DirtyArea &da1 = (*this)[idx1]; + DirtyArea &da2 = (*this)[idx2]; + + da1._bounds.extend(da2._bounds); + + da1._bounds2.left = da1._bounds.width() / 2; + da1._bounds2.right = da1._bounds.left + (da1._bounds.width() + 1) / 2 - 1; + da1._bounds2.top = da1._bounds.height() / 2; + da1._bounds2.bottom = da1._bounds.top + (da1._bounds.height() + 1) / 2 - 1; + + da2._active = false; + da1._textActive = true; +} + +void DirtyAreas::copy(MSurface *srcSurface, MSurface *destSurface, const Common::Point &posAdjust) { + for (uint i = 0; i < size(); ++i) { + const Common::Rect &srcBounds = (*this)[i]._bounds; + + Common::Rect bounds(srcBounds.left + posAdjust.x, srcBounds.top + posAdjust.y, + srcBounds.right + posAdjust.x, srcBounds.bottom + posAdjust.y); + + if ((*this)[i]._active && bounds.isValidRect()) { + srcSurface->copyTo(destSurface, bounds, Common::Point(bounds.left, bounds.top)); + } + } +} + +void DirtyAreas::copyToScreen(const Common::Point &posAdjust) { + for (uint i = 0; i < size(); ++i) { + const Common::Rect &srcBounds = (*this)[i]._bounds; + + Common::Rect bounds(srcBounds.left + posAdjust.x, srcBounds.top + posAdjust.y, + srcBounds.right + posAdjust.x, srcBounds.bottom + posAdjust.y); + + if ((*this)[i]._active && (*this)[i]._bounds.isValidRect()) { + _vm->_screen.copyRectToScreen(bounds); + } + } +} + +void DirtyAreas::reset() { + for (uint i = 0; i < size(); ++i) + (*this)[i]._active = false; +} + +/*------------------------------------------------------------------------*/ + ScreenSurface::ScreenSurface() { _dataP = nullptr; } diff --git a/engines/mads/screen.h b/engines/mads/screen.h index e101020fc8..2860462ff1 100644 --- a/engines/mads/screen.h +++ b/engines/mads/screen.h @@ -45,6 +45,64 @@ enum ScreenTransition { kVertTransition7, kCenterVertTransition }; +class SpriteSlot; +class TextDisplay; + +class DirtyArea { +private: + static MADSEngine *_vm; + friend class DirtyAreas; +public: + Common::Rect _bounds; + Common::Rect _bounds2; + bool _textActive; + bool _active; + + DirtyArea(); + + void setArea(int width, int height, int maxWidth, int maxHeight); + + void setSpriteSlot(const SpriteSlot *spriteSlot); + + /** + * Set up a dirty area for a text display + */ + void setTextDisplay(const TextDisplay *textDisplay); +}; + +class DirtyAreas : public Common::Array { +private: + MADSEngine *_vm; +public: + DirtyAreas(MADSEngine *vm); + + /** + * Merge together any designated dirty areas that overlap + * @param startIndex 1-based starting dirty area starting index + * @param count Number of entries to process + */ + void merge(int startIndex, int count); + + bool intersects(int idx1, int idx2); + void mergeAreas(int idx1, int idx2); + + /** + * Copy the data specified by the dirty rect list between surfaces + * @param srcSurface Source surface + * @param destSurface Dest surface + * @param posAdjust Position adjustment + */ + void copy(MSurface *srcSurface, MSurface *destSurface, const Common::Point &posAdjust); + + /** + * Use the lsit of dirty areas to copy areas of the screen surface to + * the physical screen + * @param posAdjust Position adjustment */ + void copyToScreen(const Common::Point &posAdjust); + + void reset(); +}; + class ScreenSurface : public MSurface { private: /** diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index 6418a03477..684e4996bc 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -178,7 +178,7 @@ void SequenceList::setSpriteSlot(int seqIndex, SpriteSlot &spriteSlot) { SequenceEntry &timerEntry = _entries[seqIndex]; SpriteAsset &spriteSet = *scene._sprites[timerEntry._spritesIndex]; - spriteSlot._spriteType = spriteSet.isBackground() ? ST_BACKGROUND : ST_FOREGROUND; + spriteSlot._SlotType = spriteSet.isBackground() ? ST_BACKGROUND : ST_FOREGROUND; spriteSlot._seqIndex = seqIndex; spriteSlot._spritesIndex = timerEntry._spritesIndex; spriteSlot._frameNumber = (timerEntry._flipped ? 0x8000 : 0) | timerEntry._frameIndex; diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp index be066ba2db..18f6a642fd 100644 --- a/engines/mads/sprites.cpp +++ b/engines/mads/sprites.cpp @@ -139,7 +139,7 @@ byte MSprite::getTransparencyIndex() const { MADSEngine *SpriteSlot::_vm = nullptr; SpriteSlot::SpriteSlot() { - _spriteType = ST_NONE; + _SlotType = ST_NONE; _seqIndex = 0; _spritesIndex = 0; _frameNumber = 0; @@ -147,8 +147,8 @@ SpriteSlot::SpriteSlot() { _scale = 0; } -SpriteSlot::SpriteSlot(SpriteType type, int seqIndex) { - _spriteType = type; +SpriteSlot::SpriteSlot(SlotType type, int seqIndex) { + _SlotType = type; _seqIndex = seqIndex; _spritesIndex = 0; _frameNumber = 0; @@ -208,11 +208,11 @@ void SpriteSlots::setDirtyAreas() { Scene &scene = _vm->_game->_scene; for (uint i = 0; i < size(); ++i) { - if ((*this)[i]._spriteType >= ST_NONE) { + if ((*this)[i]._SlotType >= ST_NONE) { scene._dirtyAreas[i].setSpriteSlot(&(*this)[i]); - scene._dirtyAreas[i]._textActive = ((*this)[i]._spriteType <= ST_NONE) ? 0 : 1; - (*this)[i]._spriteType = ST_NONE; + scene._dirtyAreas[i]._textActive = ((*this)[i]._SlotType <= ST_NONE) ? 0 : 1; + (*this)[i]._SlotType = ST_NONE; } } } @@ -247,14 +247,14 @@ void SpriteSlots::drawBackground() { SpriteSlot &spriteSlot = (*this)[i]; DirtyArea &dirtyArea = scene._dirtyAreas[i]; - if (spriteSlot._spriteType >= ST_NONE) { + if (spriteSlot._SlotType >= ST_NONE) { // Foreground sprite, so we can ignore it dirtyArea._active = false; } else { dirtyArea._active = true; dirtyArea.setSpriteSlot(&spriteSlot); - if (spriteSlot._spriteType == ST_BACKGROUND) { + if (spriteSlot._SlotType == ST_BACKGROUND) { // Background object, so need to draw it assert(spriteSlot._frameNumber > 0); SpriteAsset *asset = scene._sprites[spriteSlot._spritesIndex]; @@ -304,7 +304,7 @@ void SpriteSlots::drawForeground(MSurface *s) { // Get a list of sprite object depths for active objects for (uint i = 0; i < size(); ++i) { SpriteSlot &spriteSlot = (*this)[i]; - if (spriteSlot._spriteType >= ST_NONE) { + if (spriteSlot._SlotType >= ST_NONE) { DepthEntry rec(16 - spriteSlot._depth, i); depthList.push_back(rec); } @@ -367,7 +367,7 @@ void SpriteSlots::drawForeground(MSurface *s) { void SpriteSlots::cleanUp() { for (int i = (int)size() - 1; i >= 0; --i) { - if ((*this)[i]._spriteType < ST_NONE) + if ((*this)[i]._SlotType < ST_NONE) remove_at(i); } } @@ -391,6 +391,7 @@ int SpriteSets::add(SpriteAsset *asset, int idx) { } int SpriteSets::addSprites(const Common::String &resName, int flags) { + ++_assetCount; return add(new SpriteAsset(_vm, resName, flags)); } @@ -398,52 +399,17 @@ void SpriteSets::clear() { for (uint i = 0; i < size(); ++i) delete (*this)[i]; + _assetCount = 0; Common::Array::clear(); } -/*------------------------------------------------------------------------*/ - -ImageInterEntry::ImageInterEntry() { - _field0 = 0; - _field2 = 0; - _field3 = 0; - _field4 = 0; - _field6 = 0; - _field8 = 0; -} - -/*------------------------------------------------------------------------*/ - -void ImageInterEntries::add(int v1, int v2) { - ImageInterEntry ie; - ie._field0 = -2; - ie._field2 = -1; - - push_back(ie); -} +void SpriteSets::remove(int idx) { + if (idx >= 0) { + delete (*this)[idx]; + (*this)[idx] = nullptr; -void ImageInterEntries::add(int v1, int v2, int v3, int v4) { - assert(size() < 50); - - ImageInterEntry ie; - ie._field0 = -3; - ie._field2 = 201; - ie._field6 = v1; - ie._field8 = v2; - ie._field4 = v3; - ie._field3 = v4; - - push_back(ie); -} - -ImageInterEntry &ImageInterEntries::add() { - resize(size() + 1); - return (*this)[size() - 1]; -} - - -void ImageInterEntries::call(int v1, int v2) { - debug("TODO: ImageInterEntries::call"); + --_assetCount; + } } } // End of namespace MADS diff --git a/engines/mads/sprites.h b/engines/mads/sprites.h index 82f0a9b10d..cf45be6806 100644 --- a/engines/mads/sprites.h +++ b/engines/mads/sprites.h @@ -30,7 +30,7 @@ namespace MADS { -enum SpriteType { +enum SlotType { ST_NONE = 0, ST_FOREGROUND = 1, ST_BACKGROUND = -4, ST_FULL_SCREEN_REFRESH = -2, ST_EXPIRED = -1 }; @@ -129,11 +129,11 @@ private: static MADSEngine *_vm; friend class SpriteSlots; public: - SpriteType _spriteType; + SlotType _SlotType; int _seqIndex; public: SpriteSlot(); - SpriteSlot(SpriteType type, int seqIndex); + SpriteSlot(SlotType type, int seqIndex); void setup(int dirtyAreaIndex); bool operator==(const SpriteSlotSubset &other) const; @@ -200,10 +200,12 @@ class SpriteSets : public Common::Array { private: MADSEngine *_vm; public: + int _assetCount; + /** * Constructor */ - SpriteSets(MADSEngine *vm) : _vm(vm) {} + SpriteSets(MADSEngine *vm) : _vm(vm), _assetCount(0) {} /** * Destructor @@ -224,27 +226,11 @@ public: * Adds a sprite asset to the list by name */ int addSprites(const Common::String &resName, int flags = 0); -}; - -class ImageInterEntry { -public: - int _field0; - int _field2; - int _field3; - int _field4; - int _field6; - int _field8; - - ImageInterEntry(); -}; -class ImageInterEntries: public Common::Array { -public: - void add(int v1, int v2); - void add(int v1, int v2, int v3, int v4); - ImageInterEntry &add(); - - void call(int v1, int v2); + /** + * Remove an asset from the list + */ + void remove(int idx); }; } // End of namespace MADS diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 5ab0b0f356..fd9f4c0153 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -27,16 +27,47 @@ namespace MADS { -void SceneNode::load(Common::SeekableReadStream *f) { - _walkPos.x = f->readSint16LE(); - _walkPos.y = f->readSint16LE(); - for (int i = 0; i < MAX_ROUTE_NODES; ++i) - _indexes[i] = f->readUint16LE(); +UISlot::UISlot() { + _slotType = ST_NONE; + _field2 = 0; + _field3 = 0; + _field4 = 0; + _field6 = 0; + _field8 = 0; +} + +/*------------------------------------------------------------------------*/ + +void UISlots::fullRefresh() { + UISlot slot; + slot._slotType = ST_FULL_SCREEN_REFRESH; + slot._field2 = -1; + + push_back(slot); +} + +void UISlots::add(int v1, int v2, int v3, int v4) { + assert(size() < 50); + + UISlot ie; + ie._slotType = -3; + ie._field2 = 201; + ie._field6 = v1; + ie._field8 = v2; + ie._field4 = v3; + ie._field3 = v4; + + push_back(ie); +} + +void UISlots::call(int v1, int v2) { + debug("TODO: UISlots::call"); } /*------------------------------------------------------------------------*/ UserInterface::UserInterface(MADSEngine *vm) : _vm(vm) { + _invSpritesIndex = -1; _category = CAT_NONE; _screenObjectsCount = 0; _inventoryTopIndex = 0; @@ -99,8 +130,8 @@ void UserInterface::setup(int id) { } scene._screenObjects._v832EC = id; - scene._imageInterEntries.clear(); - scene._imageInterEntries.add(-2, 0xff); + scene._userInterface._uiSlots.clear(); + scene._userInterface._uiSlots.fullRefresh(); _vm->_game->_ticksExpiry = _vm->_events->getFrameCounter(); _v1A = -1; _v1E = -1; @@ -110,7 +141,7 @@ void UserInterface::setup(int id) { copyTo(&_surface); if (_vm->_game->_v1 == 5) - scene._imageInterEntries.call(0, 0); + scene._userInterface._uiSlots.call(0, 0); scene._action.clear(); drawTextElements(); @@ -400,5 +431,27 @@ void UserInterface::drawTalkList() { warning("TODO: drawTalkList"); } +void UserInterface::loadInventoryAnim(int objectId) { + +} + +void UserInterface::noInventoryAnim() { + Scene &scene = _vm->_game->_scene; + + if (_invSpritesIndex >= 0) { + scene._sprites.remove(_invSpritesIndex); + _vm->_game->_ticksExpiry = _vm->_events->getFrameCounter(); + _invSpritesIndex = -1; + } + + if (!scene._screenObjects._v832EC) + refresh(); +} + +void UserInterface::refresh() { + Scene &scene = _vm->_game->_scene; + scene._userInterface._uiSlots.clear(); +// scene._userInterface._uiSlots.new() +} } // End of namespace MADS diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h index cab26534c4..65c7e1ce55 100644 --- a/engines/mads/user_interface.h +++ b/engines/mads/user_interface.h @@ -36,9 +36,31 @@ enum ScrCategory { CAT_12 = 12 }; +class UISlot { +public: + int _slotType; + int _field2; + int _field3; + int _field4; + int _field6; + int _field8; + + UISlot(); +}; + +class UISlots : public Common::Array { +public: + void add(int v1, int v2, int v3, int v4); + void fullRefresh(); + + void call(int v1, int v2); +}; + + class UserInterface : public MSurface { private: MADSEngine *_vm; + int _invSpritesIndex; /** * Loads the elements of the user interface @@ -84,6 +106,8 @@ private: * Draw a UI textual element */ void writeVocab(ScrCategory category, int id); + + void refresh(); public: ScrCategory _category; int _screenObjectsCount; @@ -99,6 +123,7 @@ public: int _v1A; int _v1C; int _v1E; + UISlots _uiSlots; public: /** * Constructor @@ -120,6 +145,10 @@ public: void drawTextElements(); void setBounds(const Common::Rect &r); + + void loadInventoryAnim(int objectId); + + void noInventoryAnim(); }; } // End of namespace MADS -- cgit v1.2.3 From d494db888e24c04261a46aa89d946ff3c7db3851 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 17 Mar 2014 23:14:54 -0400 Subject: MADS: Beginnings of code for UI inventory item animation --- engines/mads/mads.cpp | 2 +- engines/mads/mads.h | 2 +- engines/mads/sprites.cpp | 4 ++- engines/mads/user_interface.cpp | 63 ++++++++++++++++++++++++++++++++++++----- engines/mads/user_interface.h | 12 ++++++-- 5 files changed, 70 insertions(+), 13 deletions(-) diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index 1785ce3f00..781fd7d01d 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -39,7 +39,7 @@ MADSEngine::MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc) : // Initialise fields _easyMouse = true; - _invObjectStill = false; + _invObjectsAnimated = true; _textWindowStill = false; _screenFade = SCREEN_FADE_SMOOTH; _musicFlag = false; diff --git a/engines/mads/mads.h b/engines/mads/mads.h index f19abb3889..3152e84f25 100644 --- a/engines/mads/mads.h +++ b/engines/mads/mads.h @@ -100,7 +100,7 @@ public: ScreenSurface _screen; SoundManager *_sound; bool _easyMouse; - bool _invObjectStill; + bool _invObjectsAnimated; bool _textWindowStill; ScreenFade _screenFade; bool _musicFlag; diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp index 18f6a642fd..e519c6966b 100644 --- a/engines/mads/sprites.cpp +++ b/engines/mads/sprites.cpp @@ -379,7 +379,9 @@ SpriteSets::~SpriteSets() { } int SpriteSets::add(SpriteAsset *asset, int idx) { - if (!idx) + if (idx) + idx = idx + 49; + else idx = size(); if (idx >= (int)size()) diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index fd9f4c0153..2b5e6c4558 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -30,8 +30,8 @@ namespace MADS { UISlot::UISlot() { _slotType = ST_NONE; _field2 = 0; - _field3 = 0; - _field4 = 0; + _spritesIndex = 0; + _frameNumber = 0; _field6 = 0; _field8 = 0; } @@ -46,7 +46,7 @@ void UISlots::fullRefresh() { push_back(slot); } -void UISlots::add(int v1, int v2, int v3, int v4) { +void UISlots::add(int v1, int v2, int frameNumber, int spritesIndex) { assert(size() < 50); UISlot ie; @@ -54,8 +54,8 @@ void UISlots::add(int v1, int v2, int v3, int v4) { ie._field2 = 201; ie._field6 = v1; ie._field8 = v2; - ie._field4 = v3; - ie._field3 = v4; + ie._frameNumber = frameNumber; + ie._spritesIndex = spritesIndex; push_back(ie); } @@ -68,6 +68,7 @@ void UISlots::call(int v1, int v2) { UserInterface::UserInterface(MADSEngine *vm) : _vm(vm) { _invSpritesIndex = -1; + _invFrameNumber = 1; _category = CAT_NONE; _screenObjectsCount = 0; _inventoryTopIndex = 0; @@ -432,7 +433,23 @@ void UserInterface::drawTalkList() { } void UserInterface::loadInventoryAnim(int objectId) { + Scene &scene = _vm->_game->_scene; + noInventoryAnim(); + bool flag = true; + + if (_vm->_invObjectsAnimated) { + Common::String resName = Common::String::format("*OB%.3dI", objectId); + SpriteAsset *asset = new SpriteAsset(_vm, resName, 8); + _invSpritesIndex = scene._sprites.add(asset, 1); + if (_invSpritesIndex >= 0) { + _invFrameNumber = 1; + flag = false; + } + } + if (flag) { + // TODO: Use of inv_object_data? + } } void UserInterface::noInventoryAnim() { @@ -449,9 +466,41 @@ void UserInterface::noInventoryAnim() { } void UserInterface::refresh() { + _uiSlots.clear(); + _uiSlots.fullRefresh(); + _uiSlots.call(0, 0); + + drawTextElements(); +} + +void UserInterface::inventoryAnim() { Scene &scene = _vm->_game->_scene; - scene._userInterface._uiSlots.clear(); -// scene._userInterface._uiSlots.new() + if (scene._screenObjects._v832EC == 1 || scene._screenObjects._v832EC == 2 + || _invSpritesIndex < 0) + return; + + // Move to the next frame number in the sequence, resetting if at the end + SpriteAsset *asset = scene._sprites[_invSpritesIndex]; + if (++_invFrameNumber > asset->getCount()) + _invFrameNumber = 1; + + // Loop through the slots list for ?? entry + for (uint i = 0; i < _uiSlots.size(); ++i) { + if (_uiSlots[i]._field2 == 200) + _uiSlots[i]._slotType = -5; + } + + // Add a new slot entry for the inventory animation + UISlot slot; + slot._slotType = ST_FOREGROUND; + slot._field2 = 200; + slot._frameNumber = _invFrameNumber; + slot._spritesIndex = _invSpritesIndex; + slot._field6 = 160; + slot._field8 = 3; + + _uiSlots.push_back(slot); } + } // End of namespace MADS diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h index 65c7e1ce55..8b87b4e65d 100644 --- a/engines/mads/user_interface.h +++ b/engines/mads/user_interface.h @@ -40,8 +40,8 @@ class UISlot { public: int _slotType; int _field2; - int _field3; - int _field4; + int _spritesIndex; + int _frameNumber; int _field6; int _field8; @@ -50,7 +50,7 @@ public: class UISlots : public Common::Array { public: - void add(int v1, int v2, int v3, int v4); + void add(int v1, int v2, int frameNumber, int spritesIndex); void fullRefresh(); void call(int v1, int v2); @@ -61,6 +61,7 @@ class UserInterface : public MSurface { private: MADSEngine *_vm; int _invSpritesIndex; + int _invFrameNumber; /** * Loads the elements of the user interface @@ -108,6 +109,11 @@ private: void writeVocab(ScrCategory category, int id); void refresh(); + + /** + * Handles queuing a new frame of an inventory animation for drawing + */ + void inventoryAnim(); public: ScrCategory _category; int _screenObjectsCount; -- cgit v1.2.3 From a82a0f2618049c337ed36e55a3c3c89911c54e55 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 18 Mar 2014 07:25:27 +0100 Subject: MADS: Complete scene 201 --- engines/mads/nebular/nebular_scenes2.cpp | 45 ++++++++++++++++++++++++++++++++ engines/mads/player.h | 3 ++- 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 63c03dc5c8..d8b1308cb2 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -285,6 +285,51 @@ void Scene201::step() { } void Scene201::actions() { + MADSAction *action = _game._player._action; + if (action->_lookFlag == false) { + if (action->isAction(0x18C, 0x83, 0)) + _scene->_nextSceneId = 202; + else if ((action->isAction(0x50, 0x156, 0)) || (action->isAction(0x188, 0x16C, 0)) || (action->isAction(0x188, 0x1B6, 0))) { + if (_game._abortTimers != 0) { + if (_game._abortTimers != 1) + _scene->_nextSceneId = 213; + } else { + _game._player._stepEnabled = false; + _game._player._visible = false; + int sepChar = (_globals[0] == SEX_UNKNOWN) ? 't' : 'u'; + _scene->loadAnimation(formAnimName(sepChar, 0), 1); + } + } else if (action->isAction(0x3, 0x1A6, 0)) { + Dialog::show(0x4E85); + } else if (action->isAction(0x3, 0x129, 0)) { + Dialog::show(0x4E86); + } else if (action->isAction(0x3, 0x16F, 0)) { + Dialog::show(0x4E87); + } else if (action->isAction(0x3, 0x142, 0)) { + Dialog::show(0x4E88); + } else if (action->isAction(0x3, 0x18F, 0)) { + Dialog::show(0x4E89); + } else if (action->isAction(0x3, 0x1B9, 0)) { + Dialog::show(0x4E8A); + } else if (action->isAction(0x3, 0x192, 0)) { + Dialog::show(0x4E8B); + } else if (action->isAction(0x3, 0x1BA, 0)) { + Dialog::show(0x4E8C); + } else if (action->isAction(0x3, 0x83, 0)) { + Dialog::show(0x4E8E); + } else if (action->isAction(0x3, 0x1B6, 0)) { + if (_globals[37]) + Dialog::show(0x4E90); + else + Dialog::show(0x4E8D); + } else if (action->isAction(0x3, 0x16C, 0)) { + Dialog::show(0x4E91); + } else + return; + } else { + Dialog::show(0x4E8F); + } + action->_inProgress = false; } } // End of namespace Nebular diff --git a/engines/mads/player.h b/engines/mads/player.h index e330c650de..b997e26a02 100644 --- a/engines/mads/player.h +++ b/engines/mads/player.h @@ -38,7 +38,6 @@ private: static const int _directionListIndexes[32]; private: MADSEngine *_vm; - MADSAction *_action; bool _highSprites; bool _spriteSetsPresent[PLAYER_SPRITES_FILE_COUNT]; int _currentDepth; @@ -97,6 +96,8 @@ private: void dirChanged(); public: + MADSAction *_action; + int _direction; int _newDirection; int _xDirection, _yDirection; -- cgit v1.2.3 From 26c90afdef0d5ecf11935f2b02add292df562de5 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 18 Mar 2014 07:35:02 +0100 Subject: MADS: Add scene 201 in createScene() --- engines/mads/nebular/nebular_scenes.cpp | 5 +++++ engines/mads/nebular/nebular_scenes2.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 6b922a45ed..b9d244dd11 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -29,6 +29,7 @@ #include "mads/nebular/game_nebular.h" #include "mads/nebular/nebular_scenes.h" #include "mads/nebular/nebular_scenes1.h" +#include "mads/nebular/nebular_scenes2.h" #include "mads/nebular/nebular_scenes8.h" namespace MADS { @@ -49,6 +50,10 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 103: return new Scene103(vm); + // Scene group #2 + case 201: + return new Scene201(vm); + // Scene group #8 case 804: return new Scene804(vm); diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index 4d6e6a20fd..097041bb94 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -55,7 +55,9 @@ public: virtual void setup(); virtual void enter(); virtual void step(); + virtual void preActions() {}; virtual void actions(); + virtual void postActions() {}; }; } // End of namespace Nebular -- cgit v1.2.3 From 306ea295eef03b23882fc4bfa5343b72cb8c4067 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 18 Mar 2014 18:49:36 +0100 Subject: MADS: Add isInInventory() --- engines/mads/inventory.cpp | 3 +++ engines/mads/inventory.h | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/engines/mads/inventory.cpp b/engines/mads/inventory.cpp index 89eaaadb1b..f1a2537d42 100644 --- a/engines/mads/inventory.cpp +++ b/engines/mads/inventory.cpp @@ -88,5 +88,8 @@ bool InventoryObjects::isInRoom(int objectId) const { return (*this)[objectId]._roomNumber == _vm->_game->_scene._currentSceneId; } +bool InventoryObjects::isInInventory(int objectId) const { + return (*this)[objectId]._roomNumber == PLAYER_INVENTORY; +} } // End of namespace MADS diff --git a/engines/mads/inventory.h b/engines/mads/inventory.h index 1eef0f7f82..1ff38abb60 100644 --- a/engines/mads/inventory.h +++ b/engines/mads/inventory.h @@ -87,6 +87,11 @@ public: * Returns true if a given object is in the player's current scene */ bool isInRoom(int objectId) const; + + /** + * Returns true if a given object is in the player's inventory + */ + bool isInInventory(int objectId) const; }; } // End of namespace MADS -- cgit v1.2.3 From 4875c83f1023585ff7c807f5633aac84eb5e3c2b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 18 Mar 2014 19:56:29 -0400 Subject: MADS: Implemented DirtyArea::setUISlot --- engines/mads/scene.cpp | 2 +- engines/mads/screen.cpp | 42 +++++++++++++++++++++++++++++++++++++++++ engines/mads/screen.h | 9 +++++++++ engines/mads/sprites.h | 2 +- engines/mads/user_interface.cpp | 18 +++++++----------- engines/mads/user_interface.h | 7 +++---- 6 files changed, 63 insertions(+), 17 deletions(-) diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index ed5fca5f6e..60b33853a4 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -379,7 +379,7 @@ void Scene::doFrame() { _kernelMessages.update(); } - _userInterface._uiSlots.call(_vm->_game->_abortTimers2 == kTransitionFadeIn ? 0xff : 0, + _userInterface._uiSlots.draw(_vm->_game->_abortTimers2 == kTransitionFadeIn ? 0xff : 0, _vm->_game->_abortTimers2); // Write any text needed by the interface diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index e760aa465d..8b05d7acbe 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -25,6 +25,7 @@ #include "mads/game.h" #include "mads/screen.h" #include "mads/palette.h" +#include "mads/user_interface.h" namespace MADS { @@ -116,6 +117,47 @@ void DirtyArea::setTextDisplay(const TextDisplay *textDisplay) { MADS_SCREEN_WIDTH, MADS_SCENE_HEIGHT); } +void DirtyArea::setUISlot(const UISlot *slot) { + int type = slot->_slotType; + if (type <= -20) + type += 20; + if (type >= 64) + type &= 0xBF; + + MSurface &intSurface = _vm->_game->_scene._userInterface; + switch (type) { + case ST_FULL_SCREEN_REFRESH: + _bounds.left = 0; + _bounds.top = 0; + setArea(intSurface.w, intSurface.h, intSurface.w, intSurface.h); + break; + case ST_MINUS3: + _bounds.left = slot->_position.x; + _bounds.top = slot->_position.y; + // TODO: spritesIndex & frameNumber used as w & h??! + error("TODO: Figure out ST_MINUS3. Maybe need a union?"); + break; + + default: { + SpriteAsset *asset = _vm->_game->_scene._sprites[slot->_spritesIndex]; + MSprite *frame = asset->getFrame(slot->_frameNumber - 1); + int w = frame->w; + int h = frame->h; + + if (slot->_field2 == 200) { + _bounds.left = slot->_position.x; + _bounds.top = slot->_position.y; + } else { + _bounds.left = slot->_position.x + w / 2; + _bounds.top = slot->_position.y + h / 2; + } + + setArea(w, h, intSurface.w, intSurface.h); + break; + } + } +} + /*------------------------------------------------------------------------*/ DirtyAreas::DirtyAreas(MADSEngine *vm) : _vm(vm) { diff --git a/engines/mads/screen.h b/engines/mads/screen.h index 2860462ff1..06053e89dd 100644 --- a/engines/mads/screen.h +++ b/engines/mads/screen.h @@ -47,6 +47,7 @@ enum ScreenTransition { class SpriteSlot; class TextDisplay; +class UISlot; class DirtyArea { private: @@ -62,12 +63,20 @@ public: void setArea(int width, int height, int maxWidth, int maxHeight); + /** + * Set up a dirty area for a sprite slot + */ void setSpriteSlot(const SpriteSlot *spriteSlot); /** * Set up a dirty area for a text display */ void setTextDisplay(const TextDisplay *textDisplay); + + /** + * Set up a dirty area for a UI slot + */ + void setUISlot(const UISlot *slot); }; class DirtyAreas : public Common::Array { diff --git a/engines/mads/sprites.h b/engines/mads/sprites.h index cf45be6806..6118924de7 100644 --- a/engines/mads/sprites.h +++ b/engines/mads/sprites.h @@ -31,7 +31,7 @@ namespace MADS { enum SlotType { - ST_NONE = 0, ST_FOREGROUND = 1, ST_BACKGROUND = -4, + ST_NONE = 0, ST_FOREGROUND = 1, ST_BACKGROUND = -4, ST_MINUS3 = -3, ST_FULL_SCREEN_REFRESH = -2, ST_EXPIRED = -1 }; diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 2b5e6c4558..f34d68c6ce 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -32,8 +32,6 @@ UISlot::UISlot() { _field2 = 0; _spritesIndex = 0; _frameNumber = 0; - _field6 = 0; - _field8 = 0; } /*------------------------------------------------------------------------*/ @@ -46,22 +44,21 @@ void UISlots::fullRefresh() { push_back(slot); } -void UISlots::add(int v1, int v2, int frameNumber, int spritesIndex) { +void UISlots::add(const Common::Point &pt, int frameNumber, int spritesIndex) { assert(size() < 50); UISlot ie; ie._slotType = -3; ie._field2 = 201; - ie._field6 = v1; - ie._field8 = v2; + ie._position = pt; ie._frameNumber = frameNumber; ie._spritesIndex = spritesIndex; push_back(ie); } -void UISlots::call(int v1, int v2) { - debug("TODO: UISlots::call"); +void UISlots::draw(int v1, int v2) { + } /*------------------------------------------------------------------------*/ @@ -142,7 +139,7 @@ void UserInterface::setup(int id) { copyTo(&_surface); if (_vm->_game->_v1 == 5) - scene._userInterface._uiSlots.call(0, 0); + scene._userInterface._uiSlots.draw(0, 0); scene._action.clear(); drawTextElements(); @@ -468,7 +465,7 @@ void UserInterface::noInventoryAnim() { void UserInterface::refresh() { _uiSlots.clear(); _uiSlots.fullRefresh(); - _uiSlots.call(0, 0); + _uiSlots.draw(0, 0); drawTextElements(); } @@ -496,8 +493,7 @@ void UserInterface::inventoryAnim() { slot._field2 = 200; slot._frameNumber = _invFrameNumber; slot._spritesIndex = _invSpritesIndex; - slot._field6 = 160; - slot._field8 = 3; + slot._position = Common::Point(160, 3); _uiSlots.push_back(slot); } diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h index 8b87b4e65d..a474fe1fa1 100644 --- a/engines/mads/user_interface.h +++ b/engines/mads/user_interface.h @@ -42,18 +42,17 @@ public: int _field2; int _spritesIndex; int _frameNumber; - int _field6; - int _field8; + Common::Point _position; UISlot(); }; class UISlots : public Common::Array { public: - void add(int v1, int v2, int frameNumber, int spritesIndex); + void add(const Common::Point &pt, int frameNumber, int spritesIndex); void fullRefresh(); - void call(int v1, int v2); + void draw(int v1, int v2); }; -- cgit v1.2.3 From 5b4b7a5ca972f533c7a6129e84fd5d26e3b2ebb6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 18 Mar 2014 22:37:33 -0400 Subject: MADS: Finished UISlots::draw method --- engines/mads/scene.cpp | 4 +- engines/mads/sprites.h | 4 +- engines/mads/user_interface.cpp | 144 +++++++++++++++++++++++++++++++++++++--- engines/mads/user_interface.h | 33 +++++++-- 4 files changed, 169 insertions(+), 16 deletions(-) diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 60b33853a4..79ac2ceab1 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -379,8 +379,8 @@ void Scene::doFrame() { _kernelMessages.update(); } - _userInterface._uiSlots.draw(_vm->_game->_abortTimers2 == kTransitionFadeIn ? 0xff : 0, - _vm->_game->_abortTimers2); + _userInterface._uiSlots.draw(_vm->_game->_abortTimers2 == kTransitionFadeIn, + _vm->_game->_abortTimers2 != 0); // Write any text needed by the interface if (_vm->_game->_abortTimers2) diff --git a/engines/mads/sprites.h b/engines/mads/sprites.h index 6118924de7..2017961d29 100644 --- a/engines/mads/sprites.h +++ b/engines/mads/sprites.h @@ -31,8 +31,8 @@ namespace MADS { enum SlotType { - ST_NONE = 0, ST_FOREGROUND = 1, ST_BACKGROUND = -4, ST_MINUS3 = -3, - ST_FULL_SCREEN_REFRESH = -2, ST_EXPIRED = -1 + ST_NONE = 0, ST_FOREGROUND = 1, ST_MINUS5 = -5, ST_BACKGROUND = -4, + ST_MINUS3 = -3, ST_FULL_SCREEN_REFRESH = -2, ST_EXPIRED = -1 }; class MADSEngine; diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index f34d68c6ce..d11c1220df 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -57,13 +57,136 @@ void UISlots::add(const Common::Point &pt, int frameNumber, int spritesIndex) { push_back(ie); } -void UISlots::draw(int v1, int v2) { - +void UISlots::draw(bool updateFlag, bool delFlag) { + Scene &scene = _vm->_game->_scene; + UserInterface &userInterface = scene._userInterface; + DirtyArea *dirtyAreaPtr = nullptr; + + // Loop through setting up the dirty areas + for (uint idx = 0; idx < size(); ++idx) { + DirtyArea &dirtyArea = userInterface._dirtyAreas[idx]; + UISlot &slot = (*this)[idx]; + + if (slot._slotType >= ST_NONE) { + dirtyArea._active = false; + } else { + dirtyArea.setUISlot(&slot); + dirtyArea._textActive = true; + if (slot._field2 == 200 && slot._slotType == ST_MINUS5) { + dirtyArea._active = false; + dirtyAreaPtr = &dirtyArea; + } + } + } + + userInterface._dirtyAreas.merge(1, userInterface._uiSlots.size()); + if (dirtyAreaPtr) + dirtyAreaPtr->_active = true; + + // Main draw loop + for (uint idx = 0; idx < size(); ++idx) { + DirtyArea &dirtyArea = userInterface._dirtyAreas[idx]; + UISlot &slot = (*this)[idx]; + + if (dirtyArea._active && dirtyArea._bounds.width() > 0 + && dirtyArea._bounds.height() > 0 && slot._slotType >= -20) { + + // TODO: Figure out the difference between two copy methods used + if (slot._slotType >= ST_EXPIRED) { + userInterface._surface.copyTo(&userInterface, dirtyArea._bounds, + Common::Point(dirtyArea._bounds.left, dirtyArea._bounds.top)); + } else { + userInterface._surface.copyTo(&userInterface, dirtyArea._bounds, + Common::Point(dirtyArea._bounds.left, dirtyArea._bounds.top)); + } + } + } + + for (uint idx = 0; idx < size(); ++idx) { + DirtyArea &dirtyArea = userInterface._dirtyAreas[idx]; + UISlot &slot = (*this)[idx]; + + int slotType = slot._slotType; + if (slotType >= ST_NONE) { + dirtyArea.setUISlot(&slot); + if (!updateFlag) + slotType &= ~0x40; + + dirtyArea._textActive = slotType > 0; + slot._slotType &= 0x40; + } + } + + userInterface._dirtyAreas.merge(1, userInterface._uiSlots.size()); + + for (uint idx = 0; idx < size(); ++idx) { + DirtyArea &dirtyArea = userInterface._dirtyAreas[idx]; + UISlot &slot = (*this)[idx]; + + if (slot._slotType >= ST_NONE && !(slot._slotType & 0x40)) { + if (!dirtyArea._active) { + error("TODO: Original code here doesn't make sense!"); + } + + if (dirtyArea._textActive) { + SpriteAsset *asset = scene._sprites[slot._spritesIndex]; + + if (slot._field2 == 200) { + MSprite *sprite = asset->getFrame(slot._frameNumber & 0x7F); + sprite->copyTo(&userInterface, slot._position); + } else { + MSprite *sprite = asset->getFrame(slot._frameNumber - 1); + sprite->copyTo(&userInterface, slot._position); + } + } + } + } + + // Mark areas of the screen surface for updating + if (updateFlag) { + _vm->_screen.setPointer(&userInterface); + userInterface.setBounds(Common::Rect(0, scene._interfaceY, + MADS_SCREEN_WIDTH - 1, userInterface.h + scene._interfaceY - 1)); + warning("TODO: sub_111C8 / sub_1146C"); + + for (uint idx = 0; idx < size(); ++idx) { + DirtyArea &dirtyArea = userInterface._dirtyAreas[idx]; + UISlot &slot = (*this)[idx]; + + if (dirtyArea._active && dirtyArea._textActive && + dirtyArea._bounds.width() > 0 && dirtyArea._bounds.height() > 0) { + // Flag area of screen as needing update + Common::Rect r = dirtyArea._bounds; + r.translate(0, scene._interfaceY); + _vm->_screen.copyRectToScreen(r); + } + } + + warning("TODO: sub 115A2 / sub111D3"); + } + + // Post-processing to remove slots no longer needed + for (int idx = (int)size() - 1; idx >= 0; --idx) { + UISlot &slot = (*this)[idx]; + + if (slot._slotType < ST_NONE) { + if (delFlag || updateFlag) + remove_at(idx); + else if (slot._slotType >= -20) + slot._slotType -= 20; + } else { + if (updateFlag) + slot._slotType &= 0xBF; + else + slot._slotType |= 0x40; + } + } } /*------------------------------------------------------------------------*/ -UserInterface::UserInterface(MADSEngine *vm) : _vm(vm) { +UserInterface::UserInterface(MADSEngine *vm) : _vm(vm), _dirtyAreas(vm), + _uiSlots(vm) { _invSpritesIndex = -1; _invFrameNumber = 1; _category = CAT_NONE; @@ -77,7 +200,9 @@ UserInterface::UserInterface(MADSEngine *vm) : _vm(vm) { _v1A = -1; _v1C = -1; _v1E = -1; + _dirtyAreas.resize(50); + // Map the user interface to the bottom of the game's screen surface byte *pData = _vm->_screen.getBasePtr(0, MADS_SCENE_HEIGHT); setPixels(pData, MADS_SCREEN_WIDTH, MADS_INTERFACE_HEIGHT); } @@ -101,9 +226,10 @@ void UserInterface::load(const Common::String &resName) { } delete palStream; - // set the size for the interface + // Read in the surface data Common::SeekableReadStream *pixelsStream = madsPack.getItemStream(1); - pixelsStream->read(getData(), MADS_SCREEN_WIDTH * MADS_INTERFACE_HEIGHT); + _surface.setSize(MADS_SCREEN_WIDTH, MADS_INTERFACE_HEIGHT); + pixelsStream->read(_surface.getData(), MADS_SCREEN_WIDTH * MADS_INTERFACE_HEIGHT); delete pixelsStream; } @@ -124,7 +250,9 @@ void UserInterface::setup(int id) { resName += "A"; resName += ".INT"; + load(resName); + _surface.copyTo(this); } scene._screenObjects._v832EC = id; @@ -139,7 +267,7 @@ void UserInterface::setup(int id) { copyTo(&_surface); if (_vm->_game->_v1 == 5) - scene._userInterface._uiSlots.draw(0, 0); + scene._userInterface._uiSlots.draw(false, false); scene._action.clear(); drawTextElements(); @@ -273,7 +401,7 @@ void UserInterface::writeVocab(ScrCategory category, int id) { } void UserInterface::setBounds(const Common::Rect &r) { - _bounds = r; + _drawBounds = r; } void UserInterface::loadElements() { @@ -465,7 +593,7 @@ void UserInterface::noInventoryAnim() { void UserInterface::refresh() { _uiSlots.clear(); _uiSlots.fullRefresh(); - _uiSlots.draw(0, 0); + _uiSlots.draw(false, false); drawTextElements(); } diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h index a474fe1fa1..9d2af0425d 100644 --- a/engines/mads/user_interface.h +++ b/engines/mads/user_interface.h @@ -27,6 +27,7 @@ #include "common/rect.h" #include "common/str.h" #include "mads/msurface.h" +#include "mads/screen.h" namespace MADS { @@ -47,18 +48,42 @@ public: UISlot(); }; +/** + * Sprite list for the user interface + */ class UISlots : public Common::Array { +private: + MADSEngine *_vm; public: + /** + * Constructor + */ + UISlots(MADSEngine *vm) : _vm(vm) {} + + /** + * Add a sprite to the list + */ void add(const Common::Point &pt, int frameNumber, int spritesIndex); + + /** + * Adds a special entry for full refresh of the user interface + */ void fullRefresh(); - void draw(int v1, int v2); + /** + * Draw all the sprites in the list on the user interface. + * @param updateFlag Flag drawn areas to be updated on physical screen + * @param delFlag Controls how used slots are deleted after drawing + */ + void draw(bool updateFlag, bool delFlag); }; class UserInterface : public MSurface { + friend class UISlots; private: MADSEngine *_vm; + MSurface _surface; int _invSpritesIndex; int _invFrameNumber; @@ -114,11 +139,12 @@ private: */ void inventoryAnim(); public: + UISlots _uiSlots; + DirtyAreas _dirtyAreas; ScrCategory _category; int _screenObjectsCount; - Common::Rect _bounds; + Common::Rect _drawBounds; Common::Rect *_rectP; - MSurface _surface; int _inventoryTopIndex; int _objectY; int _selectedInvIndex; @@ -128,7 +154,6 @@ public: int _v1A; int _v1C; int _v1E; - UISlots _uiSlots; public: /** * Constructor -- cgit v1.2.3 From 53eac0d7c045c734e897df1c0246cab185af0463 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 18 Mar 2014 23:13:13 -0400 Subject: MADS: Fixes for scene background loading --- engines/mads/scene.cpp | 4 ++-- engines/mads/user_interface.cpp | 8 +++----- engines/mads/user_interface.h | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 79ac2ceab1..02ef916958 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -150,8 +150,8 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) { flags |= 0x200; _animationData = Animation::init(_vm, this); - UserInterface surface(_vm); - _animationData->load(surface, _userInterface, prefix, flags, nullptr, nullptr); + MSurface depthSurface; + _animationData->load(_userInterface, depthSurface, prefix, flags, nullptr, nullptr); _vm->_palette->_paletteUsage.load(0); diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index d11c1220df..a117ae0d01 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -83,7 +83,7 @@ void UISlots::draw(bool updateFlag, bool delFlag) { if (dirtyAreaPtr) dirtyAreaPtr->_active = true; - // Main draw loop + // Copy parts of the user interface background that are going to have sprites drawn for (uint idx = 0; idx < size(); ++idx) { DirtyArea &dirtyArea = userInterface._dirtyAreas[idx]; UISlot &slot = (*this)[idx]; @@ -205,6 +205,8 @@ UserInterface::UserInterface(MADSEngine *vm) : _vm(vm), _dirtyAreas(vm), // Map the user interface to the bottom of the game's screen surface byte *pData = _vm->_screen.getBasePtr(0, MADS_SCENE_HEIGHT); setPixels(pData, MADS_SCREEN_WIDTH, MADS_INTERFACE_HEIGHT); + + _surface.setSize(MADS_SCREEN_WIDTH, MADS_INTERFACE_HEIGHT); } void UserInterface::load(const Common::String &resName) { @@ -228,7 +230,6 @@ void UserInterface::load(const Common::String &resName) { // Read in the surface data Common::SeekableReadStream *pixelsStream = madsPack.getItemStream(1); - _surface.setSize(MADS_SCREEN_WIDTH, MADS_INTERFACE_HEIGHT); pixelsStream->read(_surface.getData(), MADS_SCREEN_WIDTH * MADS_INTERFACE_HEIGHT); delete pixelsStream; } @@ -263,9 +264,6 @@ void UserInterface::setup(int id) { _v1E = -1; _v1C = -1; - // Make a copy of the surface - copyTo(&_surface); - if (_vm->_game->_v1 == 5) scene._userInterface._uiSlots.draw(false, false); diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h index 9d2af0425d..b9035c59ee 100644 --- a/engines/mads/user_interface.h +++ b/engines/mads/user_interface.h @@ -83,7 +83,6 @@ class UserInterface : public MSurface { friend class UISlots; private: MADSEngine *_vm; - MSurface _surface; int _invSpritesIndex; int _invFrameNumber; @@ -139,6 +138,7 @@ private: */ void inventoryAnim(); public: + MSurface _surface; UISlots _uiSlots; DirtyAreas _dirtyAreas; ScrCategory _category; -- cgit v1.2.3 From 7b808b4464fb20ee37325ce5763504eb2c8e80a2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 19 Mar 2014 00:15:25 -0400 Subject: MADS: Added inventory add/remove methods --- engines/mads/inventory.cpp | 76 +++++++++++++++++++++++++++++++++++++++-- engines/mads/inventory.h | 16 +++++++-- engines/mads/user_interface.cpp | 10 ++++++ engines/mads/user_interface.h | 9 +++++ 4 files changed, 107 insertions(+), 4 deletions(-) diff --git a/engines/mads/inventory.cpp b/engines/mads/inventory.cpp index f1a2537d42..4f6ba48027 100644 --- a/engines/mads/inventory.cpp +++ b/engines/mads/inventory.cpp @@ -80,8 +80,16 @@ void InventoryObjects::setData(int objIndex, int id, const byte *p) { } } -void InventoryObjects::setRoom(int objectId, int roomNumber) { - warning("TODO: setObjectRoom"); +void InventoryObjects::setRoom(int objectId, int sceneNumber) { + InventoryObject &obj = (*this)[objectId]; + + if (obj._roomNumber == PLAYER_INVENTORY) + removeFromInventory(objectId, 1); + + if (sceneNumber == PLAYER_INVENTORY) + addToInventory(objectId); + else + obj._roomNumber = sceneNumber; } bool InventoryObjects::isInRoom(int objectId) const { @@ -92,4 +100,68 @@ bool InventoryObjects::isInInventory(int objectId) const { return (*this)[objectId]._roomNumber == PLAYER_INVENTORY; } +void InventoryObjects::addToInventory(int objectId) { + assert(_inventoryList.size() < 32); + UserInterface &userInterface = _vm->_game->_scene._userInterface; + + if (!isInInventory(objectId)) { + _inventoryList.push_back(objectId); + userInterface._selectedInvIndex = _inventoryList.size() - 1; + userInterface._inventoryTopIndex = CLIP(userInterface._inventoryTopIndex, + 0, (int)_inventoryList.size() - 1); + + if ((userInterface._inventoryTopIndex + 5) <= (size() - 1)) + userInterface._inventoryTopIndex = size() - 5; + userInterface._inventoryChanged = true; + + (*this)[objectId]._roomNumber = PLAYER_INVENTORY; + + if (_vm->_game->_v1 == 5 && !_vm->_game->_scene._screenObjects._v832EC) { + userInterface.categoryChanged(); + userInterface.selectObject(userInterface._selectedInvIndex); + } + } +} + +void InventoryObjects::removeFromInventory(int objectId, int newScene) { + Scene &scene = _vm->_game->_scene; + UserInterface &userInterface = scene._userInterface; + + // Scan the inventory list for the object + int invIndex = -1; + for (int idx = 0; idx < (int)_inventoryList.size() && invIndex == -1; ++idx) { + if (_inventoryList[idx] == objectId) + invIndex = idx; + } + + int selectedIndex = userInterface._selectedInvIndex; + bool noSelection = selectedIndex < 0; + + if (_vm->_game->_v1 == 5 && !scene._screenObjects._v832EC) + userInterface.selectObject(-1); + + // Remove the item from the inventory list + _inventoryList.remove_at(invIndex); + + if (invIndex > userInterface._inventoryTopIndex) { + userInterface._inventoryTopIndex = MAX(userInterface._inventoryTopIndex, 0); + } + + userInterface._inventoryChanged = true; + (*this)[objectId]._roomNumber = newScene; + + int newIndex = selectedIndex; + if (!noSelection) { + if (newIndex >= invIndex) + --newIndex; + if (newIndex < 0 && size() > 0) + newIndex = 0; + } + + if (_vm->_game->_v1 == 5 && !scene._screenObjects._v832EC) { + userInterface.categoryChanged(); + userInterface.selectObject(newIndex); + } +} + } // End of namespace MADS diff --git a/engines/mads/inventory.h b/engines/mads/inventory.h index 1ff38abb60..245d439188 100644 --- a/engines/mads/inventory.h +++ b/engines/mads/inventory.h @@ -53,6 +53,18 @@ public: class InventoryObjects: public Common::Array { private: MADSEngine *_vm; + + /** + * Removes the specified object from the player's inventory + */ + void addToInventory(int objectId); + + /** + * Removes the specified object to the player's inventory + * @param objectId Object to remove + * @param newScene Specifies the new scene to set the item to + */ + void removeFromInventory(int objectId, int newScene); public: Common::Array _inventoryList; @@ -79,9 +91,9 @@ public: void setData(int objIndex, int id, const byte *p); /** - * Sets the room number + * Sets an item's scene number */ - void setRoom(int objectId, int roomNumber); + void setRoom(int objectId, int sceneNumber); /** * Returns true if a given object is in the player's current scene diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index a117ae0d01..5a15293222 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -201,6 +201,7 @@ UserInterface::UserInterface(MADSEngine *vm) : _vm(vm), _dirtyAreas(vm), _v1C = -1; _v1E = -1; _dirtyAreas.resize(50); + _inventoryChanged = false; // Map the user interface to the bottom of the game's screen surface byte *pData = _vm->_screen.getBasePtr(0, MADS_SCENE_HEIGHT); @@ -624,5 +625,14 @@ void UserInterface::inventoryAnim() { _uiSlots.push_back(slot); } +void UserInterface::categoryChanged() { + _v1C = -1; + _vm->_events->initVars(); + _category = CAT_NONE; +} + +void UserInterface::selectObject(int invIndex) { + warning("TODO: selectObject"); +} } // End of namespace MADS diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h index b9035c59ee..07c3f74c31 100644 --- a/engines/mads/user_interface.h +++ b/engines/mads/user_interface.h @@ -154,6 +154,7 @@ public: int _v1A; int _v1C; int _v1E; + bool _inventoryChanged; public: /** * Constructor @@ -179,6 +180,14 @@ public: void loadInventoryAnim(int objectId); void noInventoryAnim(); + + void categoryChanged(); + + /** + * Select an item from the inventory list + * @param invIndex Index in the inventory list of the item to select + */ + void selectObject(int invIndex); }; } // End of namespace MADS -- cgit v1.2.3 From 829a099ad23e187db7cd79353d975d381d6c0338 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 19 Mar 2014 08:03:36 +0100 Subject: MADS: Implement Scene202::actions --- engines/mads/nebular/globals_nebular.cpp | 1 + engines/mads/nebular/globals_nebular.h | 1 + engines/mads/nebular/nebular_scenes2.cpp | 241 ++++++++++++++++++++++++++++++- engines/mads/nebular/nebular_scenes2.h | 10 ++ 4 files changed, 251 insertions(+), 2 deletions(-) diff --git a/engines/mads/nebular/globals_nebular.cpp b/engines/mads/nebular/globals_nebular.cpp index 3c16cd180b..31b7940d19 100644 --- a/engines/mads/nebular/globals_nebular.cpp +++ b/engines/mads/nebular/globals_nebular.cpp @@ -43,6 +43,7 @@ Globals::Globals() { _v6 = 0; _v7 = 0; _v8 = 0; + _abortVal = 0; } } // End of namespace Nebular diff --git a/engines/mads/nebular/globals_nebular.h b/engines/mads/nebular/globals_nebular.h index b2a1f0d497..8d9d009744 100644 --- a/engines/mads/nebular/globals_nebular.h +++ b/engines/mads/nebular/globals_nebular.h @@ -46,6 +46,7 @@ public: int _v6; int _v7; int _v8; + int _abortVal; public: /** * Constructor diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index d8b1308cb2..439ac3eeb2 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -68,8 +68,6 @@ void Scene2xx::setPlayerSpritesPrefix() { _vm->_palette->setEntry(17, 10, 45, 45); } -/*------------------------------------------------------------------------*/ - void Scene2xx::sceneEntrySound() { if (_vm->_musicFlag) { switch (_scene->_nextSceneId) { @@ -120,6 +118,8 @@ void Scene2xx::sceneEntrySound() { _vm->_sound->command(2); } +/*------------------------------------------------------------------------*/ + void Scene201::setup() { setPlayerSpritesPrefix(); setAAName(); @@ -332,5 +332,242 @@ void Scene201::actions() { action->_inProgress = false; } +/*------------------------------------------------------------------------*/ + +void Scene202::setup() { +} + +void Scene202::enter() { +} + +void Scene202::step() { +} + +void Scene202::preActions() { +} + +void Scene202::actions() { + MADSAction *action = _game._player._action; + if (action->_lookFlag == false) { + if (action->isAction(0x4E, 0xC7, 0)) { + action->_inProgress = false; + return; + } else if (action->isAction(0x18C, 0x83, 0)) { + _scene->_nextSceneId = 203; + } else if (action->isAction(0x18C, 0x82, 0)) { + if (_globals[33] != 2) { + if (_scene->_activeAnimation) + _globals[33] = 1; + else + _globals[33] = 0; + } + _scene->_nextSceneId = 201; + } else if (action->isAction(0x4, 0x2C, 0)) { + if (action->_actionMode2 == 4) { + if (_game._abortTimers == 0) { + if (_game._objects.isInInventory(OBJ_BONES)) { + Dialog::show(0x4EFB); + } else { + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._spriteIndexes[22] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[6], false, 3, 2, 0, 0); + warning("TODO: sub71312"); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[22], SM_FRAME_INDEX, 6, 1); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[22], SM_0, 0, 2); + } + } else if (_game._abortTimers == 1) { + if ((_game._player._playerPos.x == 132) && (_game._player._playerPos.y == 97)) { + _scene->_sequences.remove(_globals._spriteIndexes[16]); + _globals[32] |= 1; + } else { + _scene->_sequences.remove(_globals._spriteIndexes[21]); + _globals[32] |= 2; + } + } else if (_game._abortTimers == 2) { + if (_game._objects.isInInventory(OBJ_BONE)) { + warning("TODO: _game._objects.removeFromInventory(OBJ_BONE, 1);"); + warning("TODO: _game._objects.addToInventory(OBJ_BONES);"); + warning("TODO: Dialog::showPicture(OBJ_BONES, 0x4EFA, 0);"); + } else { + warning("TODO: _game._objects.addToInventory(OBJ_BONE);"); + warning("TODO: Dialog::showPicture(OBJ_BONE, 0x4EFA, 0);"); + } + warning("TODO: sub1EB6E(_globals[32];"); + _game._player._stepEnabled = true; + _game._player._visible = true; + } else { + action->_inProgress = false; + return; + } + } + } else if ((action->isAction(0x50, 0xC7, 0)) && (_globals[31] == 0)) { + if (_game._abortTimers == 0) { + _vm->_sound->command(29); + warning("TODO: word_8425E = _scene->_frameStartTime;"); + _game._player._visible = false; + _game._player._stepEnabled = false; + + int idx = _scene->_dynamicHotspots.add(199, 79, -1, Common::Rect(241, 68, 12, 54)); + warning("CHECKME: _globals._frameTime = _scene->_dynamicHotspots.setPosition(idx, 246, 124, 8);"); + _globals._frameTime = _scene->_dynamicHotspots.setPosition(idx, 246, 124, 8); + _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._spriteIndexes[23], 1); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 1); + } else if (_game._abortTimers == 1) { + _globals._spriteIndexes[24] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, 1); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(247, 82)); + _scene->_sequences.setDepth(_globals._spriteIndexes[24], 1); + warning("TODO: TimerList_getTimeout(_globals._spriteIndexes[23], _globals._spriteIndexes[24]);"); + _globals._v4 = -1; + _game._player._stepEnabled = true; + int msgIndex = _scene->_kernelMessages.add(Common::Point(248, 15), 0x1110, 32, 0, 60, _game.getQuote(97)); + _scene->_kernelMessages.setQuoted(msgIndex, 4, true); + } else { + action->_inProgress = false; + return; + } + } else if (((action->isAction(0x3, 0x27, 0x82)) || (action->isAction(0x3, 0x27, 0x1B6))) && (_globals[0] == SEX_MALE)) { + if (_globals._v4 == 0) { + if (_game._abortTimers == 0) { + _game._player._stepEnabled = false; + _game._player._visible= false; + _globals._spriteIndexes[25] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 6, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[25], 1, 6); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(172, 123)); + _scene->_sequences.setDepth(_globals._spriteIndexes[25], 1); + warning("TODO: TimerList_getTimeout(-1, _globals._spriteIndexes[25]);"); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[25], SM_0, 0, 1); + } else if (_game._abortTimers == 1) { + _globals._spriteIndexes[25] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 6); + _scene->_sequences.setDepth(_globals._spriteIndexes[25], 1); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(172, 123)); + if (_scene->_activeAnimation) { + _globals._v5 = -1; + _globals[38] = 1; + } else { + _scene->_sequences.addTimer(120, 2); + } + } else if (_game._abortTimers == 2) { + if (!_scene->_activeAnimation && (_globals._abortVal == 0)) { + Dialog::show(0x4EFE); + } + _scene->_sequences.remove(_globals._spriteIndexes[25]); + _globals._spriteIndexes[25] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[9], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._spriteIndexes[25], 1); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[25], 1, 6); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(172, 123)); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[25], SM_0, 0, 3); + } else if (_game._abortTimers == 3) { + warning("TODO: TimerList_getTimeout(-1, _globals._spriteIndexes[25]);"); + _game._player._stepEnabled = true; + _game._player._visible = true; + } else { + action->_inProgress = false; + return; + } + } else { + if (_game._abortTimers == 0) { + warning("TODO: word_84268 = 1;"); + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._spriteIndexes[24]); + _globals._spriteIndexes[24] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], true, 6, 1, 0, 0); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(247, 82)); + _scene->_sequences.setDepth(_globals._spriteIndexes[24], 1); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[24], SM_0, 0, 1); + } else if (_game._abortTimers == 1) { + _globals._spriteIndexes[25] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, -2); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(247, 82)); + _scene->_sequences.setDepth(_globals._spriteIndexes[25], 1); + if (_scene->_activeAnimation) { + if (_scene->_activeAnimation->getCurrentFrame() > 200) { + _scene->_sequences.addTimer(120, 2); + } else { + _globals._v5 = -1; + _globals[38] = 2; + if ((_scene->_activeAnimation->getCurrentFrame() >= 44) && (_scene->_activeAnimation->getCurrentFrame() <= 75)) { + _scene->_kernelMessages.reset(); + int msgIndex = _scene->_kernelMessages.add(Common::Point(248, 15), 0x1110, 32, 0, 60, _game.getQuote(100)); + _scene->_kernelMessages.setQuoted(msgIndex, 4, false); + } else { + action->_inProgress = false; + return; + } + } + } else { + _scene->_sequences.addTimer(120, 2); + } + } else if (_game._abortTimers == 2) { + if (!_scene->_activeAnimation) + Dialog::show(0x4EFE); + _globals._abortVal = 0; + _scene->_sequences.remove(_globals._spriteIndexes[25]); + _globals._spriteIndexes[24] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[9], false, 6, 1, 0, 0); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(247, 82)); + _scene->_sequences.setDepth(_globals._spriteIndexes[24], 1); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[24], SM_0, 0, 3); + } else if (_game._abortTimers == 3) { + _globals._spriteIndexes[24] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, 1); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(247, 82)); + _scene->_sequences.setDepth(_globals._spriteIndexes[24], 1); + _game._player._stepEnabled = true; + } else { + action->_inProgress = false; + return; + } + } + } else if (action->isAction(0x188, 0xAA, 0)) { + warning("TODO - sub_370C8"); + } else if (action->isAction(0x3, 0x129, 0)) { + Dialog::show(0x4EEA); + } else if (action->isAction(0x3, 0x86, 0)) { + Dialog::show(0x4EEB); + } else if (action->isAction(0x3, 0x19C, 0)) { + Dialog::show(0x4EEC); + } else if (action->isAction(0x3, 0x82, 0)) { + if ((_globals[33] == 0) || (_globals[33] == 2)) { + Dialog::show(0x4EED); + } else if (_globals[33] == 1) { + Dialog::show(0x4EFC); + } else { + action->_inProgress = false; + return; + } + } else if (action->isAction(0x3, 0x18E, 0)) { + Dialog::show(0x4EEE); + } else if (action->isAction(0x3, 0x164, 0)) { + Dialog::show(0x4EEF); + } else if (action->isAction(0x3, 0x175, 0)) { + Dialog::show(0x4EF0); + } else if (action->isAction(0x3, 0x174, 0)) { + Dialog::show(0x4EF1); + } else if (action->isAction(0x3, 0x142, 0)) { + Dialog::show(0x4EF2); + } else if (action->isAction(0x3, 0xAA, 0)) { + if ((_game._player._playerPos == Common::Point(77, 105)) && (_game._player._direction == 8)) + Dialog::show(0x4EF4); + else + Dialog::show(0x4EF3); + } else if (action->isAction(0x3, 0x186, 0)) { + Dialog::show(0x4EF5); + } else if (action->isAction(0x3, 0x1B5, 0)) { + Dialog::show(0x4EF6); + } else if (action->isAction(0x3, 0x140, 0)) { + Dialog::show(0x4EF7); + } else if (action->isAction(0x4, 0x140, 0)) { + Dialog::show(0x4EF8); + } else if (action->isAction(0x3, 0x2D, 0)) { + if (action->_actionMode == 4) + Dialog::show(0x4EF9); + else + return; + } else { + return; + } + } else { + Dialog::show(0x4EFB); + } + action->_inProgress = false; +} + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index 097041bb94..35a6ff1062 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -60,6 +60,16 @@ public: virtual void postActions() {}; }; +class Scene202: public Scene2xx { +public: + Scene202(MADSEngine *vm) : Scene2xx(vm) {} + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From b04f7c16935e63f35a46ffe9eec4e712c2b824c8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 19 Mar 2014 08:12:11 +0100 Subject: MADS: set public 2 inventory functions, fix signed/unsigned comparison --- engines/mads/inventory.cpp | 2 +- engines/mads/inventory.h | 23 ++++++++++++----------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/engines/mads/inventory.cpp b/engines/mads/inventory.cpp index 4f6ba48027..b697462cae 100644 --- a/engines/mads/inventory.cpp +++ b/engines/mads/inventory.cpp @@ -110,7 +110,7 @@ void InventoryObjects::addToInventory(int objectId) { userInterface._inventoryTopIndex = CLIP(userInterface._inventoryTopIndex, 0, (int)_inventoryList.size() - 1); - if ((userInterface._inventoryTopIndex + 5) <= (size() - 1)) + if ((userInterface._inventoryTopIndex + 5) <= ((int) size() - 1)) userInterface._inventoryTopIndex = size() - 5; userInterface._inventoryChanged = true; diff --git a/engines/mads/inventory.h b/engines/mads/inventory.h index 245d439188..2ca270649e 100644 --- a/engines/mads/inventory.h +++ b/engines/mads/inventory.h @@ -54,17 +54,6 @@ class InventoryObjects: public Common::Array { private: MADSEngine *_vm; - /** - * Removes the specified object from the player's inventory - */ - void addToInventory(int objectId); - - /** - * Removes the specified object to the player's inventory - * @param objectId Object to remove - * @param newScene Specifies the new scene to set the item to - */ - void removeFromInventory(int objectId, int newScene); public: Common::Array _inventoryList; @@ -104,6 +93,18 @@ public: * Returns true if a given object is in the player's inventory */ bool isInInventory(int objectId) const; + + /** + * Removes the specified object from the player's inventory + */ + void addToInventory(int objectId); + + /** + * Removes the specified object to the player's inventory + * @param objectId Object to remove + * @param newScene Specifies the new scene to set the item to + */ + void removeFromInventory(int objectId, int newScene); }; } // End of namespace MADS -- cgit v1.2.3 From cfe2257d00af3d608b907f940729138503366760 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 19 Mar 2014 08:13:35 +0100 Subject: MADS: Use removeFromInventory and addToInventory in Scene 202 --- engines/mads/nebular/nebular_scenes2.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 439ac3eeb2..9294378c60 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -385,11 +385,11 @@ void Scene202::actions() { } } else if (_game._abortTimers == 2) { if (_game._objects.isInInventory(OBJ_BONE)) { - warning("TODO: _game._objects.removeFromInventory(OBJ_BONE, 1);"); - warning("TODO: _game._objects.addToInventory(OBJ_BONES);"); + _game._objects.removeFromInventory(OBJ_BONE, 1); + _game._objects.addToInventory(OBJ_BONES); warning("TODO: Dialog::showPicture(OBJ_BONES, 0x4EFA, 0);"); } else { - warning("TODO: _game._objects.addToInventory(OBJ_BONE);"); + _game._objects.addToInventory(OBJ_BONE); warning("TODO: Dialog::showPicture(OBJ_BONE, 0x4EFA, 0);"); } warning("TODO: sub1EB6E(_globals[32];"); -- cgit v1.2.3 From c43f8347922b808458f5114ae0bdfd2f1752f696 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 19 Mar 2014 08:45:42 +0100 Subject: MADS: More work on scene 202 --- engines/mads/nebular/nebular_scenes.h | 5 ++++ engines/mads/nebular/nebular_scenes2.cpp | 45 ++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index 6021e6715a..13e3597335 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -41,8 +41,10 @@ enum { enum Noun { NOUN_D = 0xD, NOUN_BLOWGUN = 0x29, + NOUN_2C = 0x2C, NOUN_BURGER = 0x35, NOUN_CHAIR = 0x47, + NOUN_4E = 0x4E, NOUN_DEAD_FISH = 0x65, NOUN_DOOR = 0x6E, NOUN_EAT = 0x75, @@ -58,6 +60,7 @@ enum Noun { NOUN_INSERT = 0x0B6, NOUN_INSPECT = 0x0B7, NOUN_JUNGLE = 0x0B8, + NOUN_C7 = 0x0C7, NOUN_LIFE_SUPPORT_SECTION = 0x0CC, NOUN_LOG = 0x0D0, NOUN_LOOK_AT = 0x0D1, @@ -75,6 +78,8 @@ enum Noun { NOUN_SHIELD_MODULATOR = 0x137, NOUN_SHOOT = 0x13A, NOUN_SIT_IN = 0x13F, + NOUN_140 = 0x140, + NOUN_1C9 = 0x1C9, NOUN_SMELL = 0x147, NOUN_STUFFED_FISH = 0x157, NOUN_15F = 0x15F, diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 9294378c60..f03bf00e01 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -335,6 +335,16 @@ void Scene201::actions() { /*------------------------------------------------------------------------*/ void Scene202::setup() { + setPlayerSpritesPrefix(); + setAAName(); + + Scene &scene = _vm->_game->_scene; + scene.addActiveVocab(NOUN_C7); + scene.addActiveVocab(NOUN_4E); + scene.addActiveVocab(NOUN_D); + scene.addActiveVocab(NOUN_2C); + scene.addActiveVocab(NOUN_140); + scene.addActiveVocab(NOUN_1C9); } void Scene202::enter() { @@ -344,6 +354,41 @@ void Scene202::step() { } void Scene202::preActions() { + MADSAction *action = _game._player._action; + if (action->_walkFlag) + _scene->_kernelMessages.reset(); + + if ((_globals._v4 == 0) && (action->isAction(0x4E, 0xC7, 0) || !action->_walkFlag)) { + if (_game._abortTimers == 0) { + _vm->_sound->command(29); + action->_walkFlag = false; + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._spriteIndexes[24]); + _globals._spriteIndexes[23] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[8], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._spriteIndexes[23], 1); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 1); + } else if (_game._abortTimers == 1) { + warning("TODO: TimerList_getTimeout(-1, _globals._spriteIndexes[23]);"); + warning("CHECKME: _scene->_dynamicHotspots.remove(_globals._frameTime);"); + _scene->_dynamicHotspots.remove(_globals._frameTime); + _game._player._visible = true; + action->_walkFlag = true; + _game._player._stepEnabled = true; + _globals._v4 = 0; + } else { + // nothing + } + } + + if (action->isAction(0x3, 0x27, 0) && action->_activeAction._indirectObjectId > 0) { + if (!action->_walkFlag || (_globals._v4 != 0)) + action->_startWalkFlag = false; + else + action->_startWalkFlag = true; + + if (_globals._v4 == 0) + _game._player.startWalking(Common::Point(171, 122), 8); + } } void Scene202::actions() { -- cgit v1.2.3 From 66643b3ad6ab2beb3cb42c1b1952aa7ff7cecc02 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 19 Mar 2014 23:30:45 +0100 Subject: MADS: Some more work on Scene 202 --- engines/mads/nebular/game_nebular.h | 2 +- engines/mads/nebular/nebular_scenes2.cpp | 114 ++++++++++++++++++++++++++++++- 2 files changed, 114 insertions(+), 2 deletions(-) diff --git a/engines/mads/nebular/game_nebular.h b/engines/mads/nebular/game_nebular.h index 3d1d915332..685e5c7cd6 100644 --- a/engines/mads/nebular/game_nebular.h +++ b/engines/mads/nebular/game_nebular.h @@ -33,7 +33,7 @@ namespace Nebular { enum StoryMode { STORYMODE_NAUGHTY = 1, STORYMODE_NICE = 2 }; -enum InventoryObject { +enum InventoryObject { OBJ_NONE = 0, OBJ_BURGER = 1, OBJ_DEAD_FISH = 2, OBJ_STUFFED_FISH = 3, OBJ_REBREATHER = 4, OBJ_TIMER_MODULE = 5, OBJ_BIG_LEAVES = 6, OBJ_POISON_DARTS = 7, OBJ_PLANT_STALK = 8, OBJ_BLOWGUN = 9, OBJ_TWINKIFRUIT = 10, OBJ_BONE = 11, OBJ_CHICKEN = 12, diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index f03bf00e01..84941e6b69 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -45,7 +45,7 @@ void Scene2xx::setPlayerSpritesPrefix() { _game._player._spritesPrefix = ""; break; default: - if (_globals[0] == SEX_MALE) { + if (_globals[0] != SEX_MALE) { _game._player._spritesPrefix = "ROX"; } else { _game._player._spritesPrefix = "RXM"; @@ -348,6 +348,118 @@ void Scene202::setup() { } void Scene202::enter() { + _game._player._visible3 = true; + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('b', 0), 0); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('b', 1), 0); + _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('b', 2), 0); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 0), 0); + _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('l', -1), 0); + if (_globals[0] != SEX_MALE) { + _globals._spriteIndexes[7] = _scene->_sprites.addSprites("*ROXBD_2"); + } else { + _globals._spriteIndexes[7] = _scene->_sprites.addSprites("*RXMBD_2"); + } + _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('a', 0), 0); + _globals._spriteIndexes[9] = _scene->_sprites.addSprites(formAnimName('a', 1), 0); + _globals._spriteIndexes[11] = _scene->_sprites.addSprites(formAnimName('a', 2), 0); + + _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 6, 0, 0, 0); + _globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 6, 0, 0, 0); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[17], Common::Point(149, 113)); + _scene->_sequences.setDepth(_globals._spriteIndexes[17], 10); + int idx = _scene->_dynamicHotspots.add(320, 13, _globals._spriteIndexes[17], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, 153, 97, 2); + + if (_globals[32] & 1) { + _globals._spriteIndexes[16] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 6, 0, 0, 0); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[16], Common::Point(130, 108)); + _scene->_sequences.setDepth(_globals._spriteIndexes[16], 10); + idx = _scene->_dynamicHotspots.add(44, 13, _globals._spriteIndexes[16], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, 132, 97, 2); + } + + if (_globals[32] & 2) { + _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 6, 0, 0, 0); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[21], Common::Point(166, 110)); + _scene->_sequences.setDepth(_globals._spriteIndexes[21], 10); + idx = _scene->_dynamicHotspots.add(44, 13, _globals._spriteIndexes[21], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, 165, 99, 2); + } + + if (_globals[32]) + warning("TODO: sub1EB6E(_globals[32];"); + + if (_scene->_priorSceneId == 201) { + _game._player._playerPos = Common::Point(190, 91); + _game._player._direction = 2; + } else if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(178, 152); + _game._player._direction = 8; + } + + if (_globals[31]) { + _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 6, 0, 0, 0); + _scene->_sequences.setDepth(_globals._spriteIndexes[20], 6); + _scene->_hotspots.activate(199, false); + idx = _scene->_dynamicHotspots.add(457, 13, _globals._spriteIndexes[20], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, 246, 124, 8); + } + + _game.loadQuoteSet(0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x62, 0x63, 0x64, 0x65, 0x66, 0x61, 0); + _globals._v0 = 0; + + if (_scene->_priorSceneId == -1) { + if (_globals._v5) { + _globals._spriteIndexes[24] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 1); + _game._player._visible = false; + } + } else { + _globals._v5 = 0; + _globals._v4 = 0; + } + + _globals._v7 = _scene->_frameStartTime; + warning("dword_8425C = _scene->_frameStartTime;"); + + if (_scene->_roomChanged) + _game._objects.addToInventory(OBJ_NONE); + + if (_globals[38]) { + _game._player._visible = false; + _game._player._stepEnabled = false; + if (_globals[38] == 2) + _globals._v4 = 1; + else + _globals._v4 = 0; + + if (_globals[38] < 1) + _globals._spriteIndexes[25] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 6); + else + _globals._spriteIndexes[25] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 8); + _scene->_sequences.setDepth(_globals._spriteIndexes[25], 1); + + if (_globals._v4) { + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(247, 82)); + _game._player._playerPos = Common::Point(246, 124); + _game._player._direction = 8; + _globals[41] = -1; + } else { + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(172, 123)); + _game._player._playerPos = Common::Point(171, 122); + _game._player._direction = 8; + } + + _scene->loadAnimation(formAnimName('M', -1), 71); + _scene->_activeAnimation->setCurrentFrame(200); + } else { + _game._player._visible = false; + _scene->_sequences.startCycle(_globals._spriteIndexes[24], true, 1); + _scene->_sequences.setDepth(_globals._spriteIndexes[24], 1); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(247, 82)); + _game._player._playerPos = Common::Point(246, 124); + _game._player._direction = 8; + } + _globals._abortVal = 0; } void Scene202::step() { -- cgit v1.2.3 From db017b746dded2ea287c04c37fbb88ef82492781 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 19 Mar 2014 19:44:51 -0400 Subject: MADS: Moved ScreenObjects into the Game class --- engines/mads/game.cpp | 6 +-- engines/mads/game.h | 2 + engines/mads/hotspots.cpp | 6 +-- engines/mads/inventory.cpp | 6 +-- engines/mads/scene.cpp | 12 ++--- engines/mads/scene.h | 1 - engines/mads/scene_data.cpp | 106 ---------------------------------------- engines/mads/scene_data.h | 47 ------------------ engines/mads/screen.cpp | 106 ++++++++++++++++++++++++++++++++++++++++ engines/mads/screen.h | 54 ++++++++++++++++++++ engines/mads/user_interface.cpp | 34 ++++++------- engines/mads/user_interface.h | 6 --- 12 files changed, 193 insertions(+), 193 deletions(-) diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index e65330a5d4..06ea2a5437 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -40,7 +40,7 @@ Game *Game::init(MADSEngine *vm) { } Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm), - _scene(vm), _player(vm) { + _scene(vm), _screenObjects(vm), _player(vm) { _sectionNumber = _priorSectionNumber = 0; _difficultyLevel = DIFFICULTY_HARD; _saveSlot = -1; @@ -163,8 +163,8 @@ void Game::sectionLoop() { _vm->_dialogs->_defaultPosition = Common::Point(-1, -1); _visitedScenes.add(_scene._nextSceneId); - _scene._screenObjects._v8333C = true; - _scene._screenObjects._v832EC = 0; + _screenObjects._v8333C = true; + _screenObjects._v832EC = 0; _scene._userInterface._scrollerY = 0; _v3 = -1; diff --git a/engines/mads/game.h b/engines/mads/game.h index 6ef1ca9ef5..444e2fa372 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -29,6 +29,7 @@ #include "mads/game_data.h" #include "mads/inventory.h" #include "mads/player.h" +#include "mads/screen.h" namespace MADS { @@ -112,6 +113,7 @@ public: static Game *init(MADSEngine *vm); public: Player _player; + ScreenObjects _screenObjects; int _sectionNumber; int _priorSectionNumber; int _currentSectionNumber; diff --git a/engines/mads/hotspots.cpp b/engines/mads/hotspots.cpp index b33b4b2f28..df56a69e5a 100644 --- a/engines/mads/hotspots.cpp +++ b/engines/mads/hotspots.cpp @@ -126,12 +126,12 @@ void DynamicHotspots::refresh() { DynamicHotspot &dh = (*this)[i]; if ((*this)[i]._active) { - switch (_vm->_game->_scene._screenObjects._v832EC) { + switch (_vm->_game->_screenObjects._v832EC) { case 0: case 2: - _vm->_game->_scene._screenObjects.add(dh._bounds, _vm->_game->_scene._layer, + _vm->_game->_screenObjects.add(dh._bounds, _vm->_game->_scene._layer, CAT_12, dh._descId); - _vm->_game->_scene._screenObjects._v8333C = true; + _vm->_game->_screenObjects._v8333C = true; break; default: break; diff --git a/engines/mads/inventory.cpp b/engines/mads/inventory.cpp index b697462cae..1443761ada 100644 --- a/engines/mads/inventory.cpp +++ b/engines/mads/inventory.cpp @@ -116,7 +116,7 @@ void InventoryObjects::addToInventory(int objectId) { (*this)[objectId]._roomNumber = PLAYER_INVENTORY; - if (_vm->_game->_v1 == 5 && !_vm->_game->_scene._screenObjects._v832EC) { + if (_vm->_game->_v1 == 5 && !_vm->_game->_screenObjects._v832EC) { userInterface.categoryChanged(); userInterface.selectObject(userInterface._selectedInvIndex); } @@ -137,7 +137,7 @@ void InventoryObjects::removeFromInventory(int objectId, int newScene) { int selectedIndex = userInterface._selectedInvIndex; bool noSelection = selectedIndex < 0; - if (_vm->_game->_v1 == 5 && !scene._screenObjects._v832EC) + if (_vm->_game->_v1 == 5 && !_vm->_game->_screenObjects._v832EC) userInterface.selectObject(-1); // Remove the item from the inventory list @@ -158,7 +158,7 @@ void InventoryObjects::removeFromInventory(int objectId, int newScene) { newIndex = 0; } - if (_vm->_game->_v1 == 5 && !scene._screenObjects._v832EC) { + if (_vm->_game->_v1 == 5 && !_vm->_game->_screenObjects._v832EC) { userInterface.categoryChanged(); userInterface.selectObject(newIndex); } diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 02ef916958..741ba82be4 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -30,7 +30,7 @@ namespace MADS { Scene::Scene(MADSEngine *vm): _vm(vm), _action(_vm), _depthSurface(vm), _dirtyAreas(_vm), _dynamicHotspots(vm), _kernelMessages(vm), - _screenObjects(vm), _sequences(vm), _sprites(vm), _spriteSlots(vm), + _sequences(vm), _sprites(vm), _spriteSlots(vm), _textDisplay(vm), _userInterface(vm) { _priorSceneId = 0; _nextSceneId = 0; @@ -162,7 +162,7 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) { _interfaceY = MADS_SCENE_HEIGHT; _spritesCount = _sprites.size(); - _userInterface.setup(_screenObjects._v832EC); + _userInterface.setup(_vm->_game->_screenObjects._v832EC); warning("TODO: showMouse"); @@ -289,7 +289,7 @@ void Scene::doFrame() { if (_dynamicHotspots._changed) _dynamicHotspots.refresh(); - _screenObjects.check(player._stepEnabled && !_action._startWalkFlag && + _vm->_game->_screenObjects.check(player._stepEnabled && !_action._startWalkFlag && !_vm->_game->_abortTimers2); } @@ -331,9 +331,9 @@ void Scene::doFrame() { // Cursor update code CursorType cursorId = CURSOR_ARROW; - if (_action._v83338 == 1 && !_screenObjects._v7FECA && - _screenObjects._category == CAT_HOTSPOT) { - int idx = _screenObjects._selectedObject - _userInterface._screenObjectsCount; + if (_action._v83338 == 1 && !_vm->_game->_screenObjects._v7FECA && + _vm->_game->_screenObjects._category == CAT_HOTSPOT) { + int idx = _vm->_game->_screenObjects._selectedObject - _userInterface._screenObjectsCount; if (idx >= (int)_hotspots.size()) { idx -= _hotspots.size(); _vm->_events->_newCursorId = _dynamicHotspots[idx]._cursor; diff --git a/engines/mads/scene.h b/engines/mads/scene.h index f5163bb43d..9493eda532 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -89,7 +89,6 @@ public: Common::String _talkFont; int _textSpacing; Hotspots _hotspots; - ScreenObjects _screenObjects; DirtyAreas _dirtyAreas; int _v1; SceneInfo *_sceneInfo; diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index 8980bd4428..625eec758e 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -30,112 +30,6 @@ namespace MADS { -ScreenObject::ScreenObject() { - _category = CAT_NONE; - _descId = 0; - _layer = 0; -} - -/*------------------------------------------------------------------------*/ - -ScreenObjects::ScreenObjects(MADSEngine *vm): _vm(vm) { - _v8333C = false; - _v832EC = 0; - _v7FECA = 0; - _v7FED6 = 0; - _v8332A = 0; - _category = CAT_NONE; - _objectIndex = 0; - _released = false; -} - -void ScreenObjects::add(const Common::Rect &bounds, Layer layer, ScrCategory category, int descId) { - assert(size() < 100); - - ScreenObject so; - so._bounds = bounds; - so._category = category; - so._descId = descId; - so._layer = layer; - - push_back(so); -} - -void ScreenObjects::check(bool scanFlag) { - Scene &scene = _vm->_game->_scene; - - if (!_vm->_events->_mouseButtons || _v832EC) - _v7FECA = false; - - if ((_vm->_events->_vD6 || _v8332A || _vm->_game->_scene._userInterface._scrollerY || _v8333C) && scanFlag) { - scene._userInterface._selectedInvIndex = scanBackwards(_vm->_events->currentPos(), LAYER_GUI); - if (scene._userInterface._selectedInvIndex > 0) { - _category = (ScrCategory)((*this)[scene._userInterface._selectedInvIndex - 1]._category & 7); - _objectIndex = (*this)[scene._userInterface._selectedInvIndex - 1]._descId; - } - - // Handling for easy mouse - ScrCategory category = scene._userInterface._category; - if (_vm->_easyMouse && !_vm->_events->_vD4 && category != _category - && scene._userInterface._category != CAT_NONE) { - _released = true; - if (category >= CAT_ACTION && category <= CAT_TALK_ENTRY) { - scene._userInterface.elementHighlighted(); - } - } - - _released = _vm->_events->_mouseReleased; - if (_vm->_events->_vD2 || (_vm->_easyMouse && !_vm->_events->_vD4)) - scene._userInterface._category = _category; - - if (!_vm->_events->_mouseButtons || _vm->_easyMouse) { - if (category >= CAT_ACTION && category <= CAT_TALK_ENTRY) { - scene._userInterface.elementHighlighted(); - } - } - - if (_vm->_events->_mouseButtons || (_vm->_easyMouse && scene._action._v83338 > 1 - && scene._userInterface._category == CAT_INV_LIST) || - (_vm->_easyMouse && scene._userInterface._category == CAT_HOTSPOT)) { - scene._action.checkActionAtMousePos(); - } - - if (_vm->_events->_mouseReleased) { - scene.leftClick(); - scene._userInterface._category = CAT_NONE; - } - - if (_vm->_events->_mouseButtons || _vm->_easyMouse || scene._userInterface._scrollerY) - proc1(); - - if (_vm->_events->_mouseButtons || _vm->_easyMouse) - scene._action.set(); - - _v8333C = 0; - } - - scene._action.refresh(); - - // Loop through image inter list - warning("TODO: imageInterList loop"); -} - -int ScreenObjects::scanBackwards(const Common::Point &pt, int layer) { - for (int i = (int)size() - 1; i >= 0; --i) { - if ((*this)[i]._bounds.contains(pt) && ((*this)[i]._layer == layer)) - return i + 1; - } - - // Entry not found - return 0; -} - -void ScreenObjects::proc1() { - warning("TODO: ScreenObjects::proc1"); -} - -/*------------------------------------------------------------------------*/ - void SceneNode::load(Common::SeekableReadStream *f) { _walkPos.x = f->readSint16LE(); _walkPos.y = f->readSint16LE(); diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index 1543669f7f..d29d4e319a 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -51,10 +51,6 @@ class SpriteSlot; #define TEXT_DISPLAY_MAX_SIZE 40 #define DIRTY_AREAS_SIZE (SPRITE_SLOTS_MAX_SIZE + TEXT_DISPLAY_MAX_SIZE) -enum Layer { - LAYER_GUI = 19 -}; - class VerbInit { public: int _id; @@ -65,49 +61,6 @@ public: VerbInit(int id, int action1, int action2): _id(id), _action1(action1), _action2(action2) {} }; -class ScreenObject { -public: - Common::Rect _bounds; - ScrCategory _category; - int _descId; - int _layer; - - ScreenObject(); -}; - -class ScreenObjects: public Common::Array { -private: - MADSEngine *_vm; - - int scanBackwards(const Common::Point &pt, int layer); - - void proc1(); -public: - int _v832EC; - int _v7FECA; - int _v7FED6; - int _v8332A; - int _v8333C; - int _selectedObject; - ScrCategory _category; - int _objectIndex; - bool _released; - - /* - * Constructor - */ - ScreenObjects(MADSEngine *vm); - - /** - * Add a new item to the list - */ - void add(const Common::Rect &bounds, Layer layer, ScrCategory category, int descId); - - /** - */ - void check(bool scanFlag); -}; - class SceneLogic { protected: MADSEngine *_vm; diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index 8b05d7acbe..608456e2e3 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -243,6 +243,112 @@ void DirtyAreas::reset() { /*------------------------------------------------------------------------*/ +ScreenObject::ScreenObject() { + _category = CAT_NONE; + _descId = 0; + _layer = 0; +} + +/*------------------------------------------------------------------------*/ + +ScreenObjects::ScreenObjects(MADSEngine *vm) : _vm(vm) { + _v8333C = false; + _v832EC = 0; + _v7FECA = 0; + _v7FED6 = 0; + _v8332A = 0; + _category = CAT_NONE; + _objectIndex = 0; + _released = false; +} + +void ScreenObjects::add(const Common::Rect &bounds, Layer layer, ScrCategory category, int descId) { + assert(size() < 100); + + ScreenObject so; + so._bounds = bounds; + so._category = category; + so._descId = descId; + so._layer = layer; + + push_back(so); +} + +void ScreenObjects::check(bool scanFlag) { + Scene &scene = _vm->_game->_scene; + + if (!_vm->_events->_mouseButtons || _v832EC) + _v7FECA = false; + + if ((_vm->_events->_vD6 || _v8332A || _vm->_game->_scene._userInterface._scrollerY || _v8333C) && scanFlag) { + scene._userInterface._selectedInvIndex = scanBackwards(_vm->_events->currentPos(), LAYER_GUI); + if (scene._userInterface._selectedInvIndex > 0) { + _category = (ScrCategory)((*this)[scene._userInterface._selectedInvIndex - 1]._category & 7); + _objectIndex = (*this)[scene._userInterface._selectedInvIndex - 1]._descId; + } + + // Handling for easy mouse + ScrCategory category = scene._userInterface._category; + if (_vm->_easyMouse && !_vm->_events->_vD4 && category != _category + && scene._userInterface._category != CAT_NONE) { + _released = true; + if (category >= CAT_ACTION && category <= CAT_TALK_ENTRY) { + scene._userInterface.elementHighlighted(); + } + } + + _released = _vm->_events->_mouseReleased; + if (_vm->_events->_vD2 || (_vm->_easyMouse && !_vm->_events->_vD4)) + scene._userInterface._category = _category; + + if (!_vm->_events->_mouseButtons || _vm->_easyMouse) { + if (category >= CAT_ACTION && category <= CAT_TALK_ENTRY) { + scene._userInterface.elementHighlighted(); + } + } + + if (_vm->_events->_mouseButtons || (_vm->_easyMouse && scene._action._v83338 > 1 + && scene._userInterface._category == CAT_INV_LIST) || + (_vm->_easyMouse && scene._userInterface._category == CAT_HOTSPOT)) { + scene._action.checkActionAtMousePos(); + } + + if (_vm->_events->_mouseReleased) { + scene.leftClick(); + scene._userInterface._category = CAT_NONE; + } + + if (_vm->_events->_mouseButtons || _vm->_easyMouse || scene._userInterface._scrollerY) + proc1(); + + if (_vm->_events->_mouseButtons || _vm->_easyMouse) + scene._action.set(); + + _v8333C = 0; + } + + scene._action.refresh(); + + // Loop through image inter list + warning("TODO: imageInterList loop"); +} + +int ScreenObjects::scanBackwards(const Common::Point &pt, int layer) { + for (int i = (int)size() - 1; i >= 0; --i) { + if ((*this)[i]._bounds.contains(pt) && ((*this)[i]._layer == layer)) + return i + 1; + } + + // Entry not found + return 0; +} + +void ScreenObjects::proc1() { + warning("TODO: ScreenObjects::proc1"); +} + +/*------------------------------------------------------------------------*/ + ScreenSurface::ScreenSurface() { _dataP = nullptr; } diff --git a/engines/mads/screen.h b/engines/mads/screen.h index 06053e89dd..9033206852 100644 --- a/engines/mads/screen.h +++ b/engines/mads/screen.h @@ -32,6 +32,16 @@ namespace MADS { #define MADS_SCREEN_WIDTH 320 #define MADS_SCREEN_HEIGHT 200 +enum ScrCategory { + CAT_NONE = 0, CAT_ACTION = 1, CAT_INV_LIST = 2, CAT_INV_VOCAB = 3, + CAT_HOTSPOT = 4, CAT_INV_ANIM = 5, CAT_TALK_ENTRY = 6, CAT_INV_SCROLLER = 7, + CAT_12 = 12 +}; + +enum Layer { + LAYER_GUI = 19 +}; + enum ScreenTransition { kTransitionNone = 0, kTransitionFadeIn, kTransitionFadeOutIn, @@ -112,6 +122,50 @@ public: void reset(); }; + +class ScreenObject { +public: + Common::Rect _bounds; + ScrCategory _category; + int _descId; + int _layer; + + ScreenObject(); +}; + +class ScreenObjects : public Common::Array { +private: + MADSEngine *_vm; + + int scanBackwards(const Common::Point &pt, int layer); + + void proc1(); +public: + int _v832EC; + int _v7FECA; + int _v7FED6; + int _v8332A; + int _v8333C; + int _selectedObject; + ScrCategory _category; + int _objectIndex; + bool _released; + + /* + * Constructor + */ + ScreenObjects(MADSEngine *vm); + + /** + * Add a new item to the list + */ + void add(const Common::Rect &bounds, Layer layer, ScrCategory category, int descId); + + /** + */ + void check(bool scanFlag); +}; + class ScreenSurface : public MSurface { private: /** diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 5a15293222..f46a4c4150 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -151,7 +151,6 @@ void UISlots::draw(bool updateFlag, bool delFlag) { for (uint idx = 0; idx < size(); ++idx) { DirtyArea &dirtyArea = userInterface._dirtyAreas[idx]; - UISlot &slot = (*this)[idx]; if (dirtyArea._active && dirtyArea._textActive && dirtyArea._bounds.width() > 0 && dirtyArea._bounds.height() > 0) { @@ -238,7 +237,7 @@ void UserInterface::load(const Common::String &resName) { void UserInterface::setup(int id) { Scene &scene = _vm->_game->_scene; - if (scene._screenObjects._v832EC != id) { + if (_vm->_game->_screenObjects._v832EC != id) { Common::String resName = _vm->_game->_aaName; // Strip off any extension @@ -256,7 +255,7 @@ void UserInterface::setup(int id) { load(resName); _surface.copyTo(this); } - scene._screenObjects._v832EC = id; + _vm->_game->_screenObjects._v832EC = id; scene._userInterface._uiSlots.clear(); scene._userInterface._uiSlots.fullRefresh(); @@ -279,8 +278,7 @@ void UserInterface::elementHighlighted() { } void UserInterface::drawTextElements() { - Scene &scene = _vm->_game->_scene; - if (scene._screenObjects._v832EC) { + if (_vm->_game->_screenObjects._v832EC) { drawTalkList(); } else { // Draw the actions @@ -406,15 +404,15 @@ void UserInterface::setBounds(const Common::Rect &r) { void UserInterface::loadElements() { Scene &scene = _vm->_game->_scene; Common::Rect bounds; - scene._screenObjects.clear(); + _vm->_game->_screenObjects.clear(); - if (!scene._screenObjects._v832EC) { + if (!_vm->_game->_screenObjects._v832EC) { // Set up screen objects for the inventory scroller for (int idx = 1; idx <= 3; ++idx) { getBounds(CAT_INV_SCROLLER, idx, bounds); moveRect(bounds); - scene._screenObjects.add(bounds, LAYER_GUI, CAT_INV_SCROLLER, idx); + _vm->_game->_screenObjects.add(bounds, LAYER_GUI, CAT_INV_SCROLLER, idx); } // Set up actions @@ -422,7 +420,7 @@ void UserInterface::loadElements() { getBounds(CAT_ACTION, idx, bounds); moveRect(bounds); - scene._screenObjects.add(bounds, LAYER_GUI, CAT_ACTION, idx); + _vm->_game->_screenObjects.add(bounds, LAYER_GUI, CAT_ACTION, idx); } // Set up inventory list @@ -430,7 +428,7 @@ void UserInterface::loadElements() { getBounds(CAT_INV_LIST, idx, bounds); moveRect(bounds); - scene._screenObjects.add(bounds, LAYER_GUI, CAT_INV_LIST, idx); + _vm->_game->_screenObjects.add(bounds, LAYER_GUI, CAT_INV_LIST, idx); } // Set up the inventory vocab list @@ -438,28 +436,28 @@ void UserInterface::loadElements() { getBounds(CAT_INV_VOCAB, idx, bounds); moveRect(bounds); - scene._screenObjects.add(bounds, LAYER_GUI, CAT_INV_VOCAB, idx); + _vm->_game->_screenObjects.add(bounds, LAYER_GUI, CAT_INV_VOCAB, idx); } // Set up the inventory item picture - scene._screenObjects.add(Common::Rect(160, 159, 231, 194), LAYER_GUI, + _vm->_game->_screenObjects.add(Common::Rect(160, 159, 231, 194), LAYER_GUI, CAT_INV_ANIM, 0); } - if (!scene._screenObjects._v832EC || scene._screenObjects._v832EC == 2) { + if (!_vm->_game->_screenObjects._v832EC || _vm->_game->_screenObjects._v832EC == 2) { for (int hotspotIdx = scene._hotspots.size() - 1; hotspotIdx >= 0; --hotspotIdx) { Hotspot &hs = scene._hotspots[hotspotIdx]; - scene._screenObjects.add(hs._bounds, LAYER_GUI, CAT_HOTSPOT, hotspotIdx); + _vm->_game->_screenObjects.add(hs._bounds, LAYER_GUI, CAT_HOTSPOT, hotspotIdx); } } - if (scene._screenObjects._v832EC == 1) { + if (_vm->_game->_screenObjects._v832EC == 1) { // setup areas for talk entries for (int idx = 0; idx < 5; ++idx) { getBounds(CAT_TALK_ENTRY, idx, bounds); moveRect(bounds); - scene._screenObjects.add(bounds, LAYER_GUI, CAT_TALK_ENTRY, idx); + _vm->_game->_screenObjects.add(bounds, LAYER_GUI, CAT_TALK_ENTRY, idx); } } } @@ -585,7 +583,7 @@ void UserInterface::noInventoryAnim() { _invSpritesIndex = -1; } - if (!scene._screenObjects._v832EC) + if (!_vm->_game->_screenObjects._v832EC) refresh(); } @@ -599,7 +597,7 @@ void UserInterface::refresh() { void UserInterface::inventoryAnim() { Scene &scene = _vm->_game->_scene; - if (scene._screenObjects._v832EC == 1 || scene._screenObjects._v832EC == 2 + if (_vm->_game->_screenObjects._v832EC == 1 || _vm->_game->_screenObjects._v832EC == 2 || _invSpritesIndex < 0) return; diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h index 07c3f74c31..b4c581d1c2 100644 --- a/engines/mads/user_interface.h +++ b/engines/mads/user_interface.h @@ -31,12 +31,6 @@ namespace MADS { -enum ScrCategory { - CAT_NONE = 0, CAT_ACTION = 1, CAT_INV_LIST = 2, CAT_INV_VOCAB = 3, - CAT_HOTSPOT = 4, CAT_INV_ANIM = 5, CAT_TALK_ENTRY = 6, CAT_INV_SCROLLER = 7, - CAT_12 = 12 -}; - class UISlot { public: int _slotType; -- cgit v1.2.3 From 4ab73a89abd66890391a977ebf4a23eb361a44a4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 19 Mar 2014 20:12:32 -0400 Subject: MADS: Preliminary code to show game cursor --- engines/mads/events.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp index 182d6cbea7..32d3a09c18 100644 --- a/engines/mads/events.cpp +++ b/engines/mads/events.cpp @@ -85,7 +85,12 @@ void EventsManager::resetCursor() { } void EventsManager::changeCursor() { - warning("TODO: changeCursor"); + if (_cursorSprites) { + MSprite *cursor = _cursorSprites->getFrame(_cursorId - 1); + CursorMan.replaceCursor(cursor->getData(), cursor->w, cursor->h, 0, 0, + cursor->getTransparencyIndex()); + showCursor(); + } } void EventsManager::freeCursors() { -- cgit v1.2.3 From 8d252f4f0e81cfd43e5b311df4a1ed5fb478953b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 19 Mar 2014 23:33:18 -0400 Subject: MADS: Implemented methods for checking action at mouse position and clicking --- engines/mads/action.cpp | 272 +++++++++++++++++++++++++++++++++++++++- engines/mads/action.h | 10 +- engines/mads/hotspots.cpp | 12 +- engines/mads/scene.cpp | 6 +- engines/mads/scene.h | 8 +- engines/mads/screen.cpp | 24 +++- engines/mads/screen.h | 1 + engines/mads/user_interface.cpp | 3 + engines/mads/user_interface.h | 16 ++- 9 files changed, 326 insertions(+), 26 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index 134321f4c7..65abc9454d 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -39,8 +39,8 @@ MADSAction::MADSAction(MADSEngine *vm) : _vm(vm) { void MADSAction::clear() { _v83338 = 1; - _actionMode = ACTMODE_NONE; - _actionMode2 = ACTMODE2_0; + _actionMode = ACTIONMODE_NONE; + _actionMode2 = ACTIONMODE2_0; _v86F42 = 0; _v86F4E = 0; _articleNumber = 0; @@ -339,7 +339,273 @@ bool MADSAction::isAction(int verbId, int objectNameId, int indirectObjectId) { } void MADSAction::checkActionAtMousePos() { - warning("TODO: checkActionAtMousePos"); + Scene &scene = _vm->_game->_scene; + UserInterface &userInterface = scene._userInterface; + ScreenObjects &screenObjects = _vm->_game->_screenObjects; + + if ((userInterface._category == CAT_ACTION || userInterface._category == CAT_INV_VOCAB) && + _v83338 != 1 && scene._highlightedHotspot >= 0) { + if (_v86F4E == userInterface._category || _v86F4C != scene._highlightedHotspot || + (_v83338 != 2 && _v83338 != 3)) + clear(); + else if (_selectedRow != 0 || userInterface._category != CAT_ACTION) + scene._lookFlag = false; + else + scene._lookFlag = true; + } + + if (screenObjects._v7FECA && _vm->_events->_mouseButtons) { + switch (userInterface._category) { + case CAT_ACTION: + case CAT_INV_VOCAB: + return; + + case CAT_INV_LIST: + case CAT_TALK_ENTRY: + if (_v83338 != 3) { + if (userInterface._selectedActionIndex >= 0) { + _actionMode = ACTIONMODE_VERB; + _selectedRow = userInterface._selectedActionIndex; + _flags1 = scene._verbList[_selectedRow]._action1; + _flags2 = scene._verbList[_selectedRow]._action2; + _v83338 = 2; + } else if (userInterface._selectedItemVocabIdx >= 0) { + _actionMode = ACTIONMODE_OBJECT; + _selectedRow = userInterface._selectedItemVocabIdx; + int objectId = _vm->_game->_objects._inventoryList[_selectedRow]; + InventoryObject &invObject = _vm->_game->_objects[objectId]; + + _flags1 = invObject._vocabList[_selectedRow - 1]._actionFlags1; + _flags2 = invObject._vocabList[_selectedRow - 1]._actionFlags2; + _actionMode2 = ACTIONMODE2_2; + _hotspotId = userInterface._selectedInvIndex; + _articleNumber = _flags2; + + if ((_flags1 == 1 && _flags2 == 0) || (_flags1 == 2 && _flags2 != 0)) + _v83338 = 4; + else + _v83338 = 3; + } + } + break; + } + } + + switch (_v83338) { + case 1: + _articleNumber = 0; + switch (userInterface._category) { + case CAT_ACTION: + _actionMode = ACTIONMODE_VERB; + _selectedRow = scene._highlightedHotspot; + if (_selectedRow >= 0) { + _flags1 = scene._verbList[_selectedRow]._action1; + _flags2 = scene._verbList[_selectedRow]._action2; + } + break; + + case CAT_INV_VOCAB: + _actionMode = ACTIONMODE_OBJECT; + _selectedRow = scene._highlightedHotspot; + if (_selectedRow < 0) { + _hotspotId = -1; + _actionMode2 = ACTIONMODE2_0; + } else { + int objectId = _vm->_game->_objects._inventoryList[_selectedRow]; + InventoryObject &invObject = _vm->_game->_objects[objectId]; + + _flags1 = invObject._vocabList[_selectedRow - 2]._actionFlags1; + _flags2 = invObject._vocabList[_selectedRow - 2]._actionFlags2; + _hotspotId = userInterface._selectedInvIndex; + _actionMode2 = ACTIONMODE2_2; + + if (_flags1 == 2) + _articleNumber = _flags2; + } + break; + + case CAT_HOTSPOT: + _selectedRow = -1; + _actionMode = ACTIONMODE_NONE; + _actionMode2 = ACTIONMODE2_4; + _hotspotId = scene._highlightedHotspot; + break; + + case CAT_TALK_ENTRY: + _actionMode = ACTIONMODE_TALK; + _selectedRow = scene._highlightedHotspot; + break; + + default: + break; + } + break; + + case 2: + _articleNumber = 0; + switch (userInterface._category) { + case CAT_INV_LIST: + case CAT_HOTSPOT: + case CAT_INV_ANIM: + // TODO: We may not need a separate ActionMode2 enum + _actionMode2 = (ActionMode2)userInterface._category; + _hotspotId = scene._highlightedHotspot; + break; + default: + break; + } + break; + + case 3: + switch (userInterface._category) { + case CAT_INV_LIST: + case CAT_HOTSPOT: + case CAT_INV_ANIM: + _v86F42 = userInterface._category; + _v86F3A = scene._highlightedHotspot; + break; + default: + break; + } + break; + + default: + break; + } +} + +void MADSAction::leftClick() { + Scene &scene = _vm->_game->_scene; + UserInterface &userInterface = scene._userInterface; + ScreenObjects &screenObjects = _vm->_game->_screenObjects; + bool abortFlag = false; + + if ((userInterface._category == CAT_ACTION || userInterface._category == CAT_INV_VOCAB) && + _v83338 != 1 && scene._highlightedHotspot >= 0 && + _v86F4E == userInterface._category && _v86F4C == scene._highlightedHotspot && + (_v83338 == 2 || userInterface._category == CAT_INV_VOCAB)) { + abortFlag = true; + if (_selectedRow == 0 && userInterface._category == CAT_ACTION) { + _selectedAction = CAT_ACTION; + scene._lookFlag = true; + } else { + _selectedAction = CAT_NONE; + scene._lookFlag = false; + clear(); + } + } + + if (abortFlag || (screenObjects._v7FECA && (userInterface._category == CAT_ACTION || + userInterface._category == CAT_INV_VOCAB))) + return; + + switch (_v83338) { + case 1: + switch (userInterface._category) { + case CAT_ACTION: + if (_selectedRow >= 0) { + if (!_flags1) { + _selectedAction = -1; + } + else { + _v86F4C = _selectedRow; + _v86F4E = _actionMode; + _v83338 = 2; + } + } + break; + + case CAT_INV_LIST: + if (scene._highlightedHotspot >= 0) { + userInterface.selectObject(scene._highlightedHotspot); + } + break; + + case CAT_INV_VOCAB: + if (_selectedRow >= 0) { + if (_flags1 != 1 || _flags2 != 0) { + if (_flags1 != 2 || _flags2 == 0) { + _v83338 = 3; + _articleNumber = _flags2; + } + else { + _articleNumber = _flags2; + _selectedAction = -1; + } + } + else { + _selectedAction = -1; + } + + _v86F4C = _selectedRow; + _v86F4E = _actionMode; + } + break; + + case CAT_HOTSPOT: + _v86F4C = -1; + _v86F4E = 0; + + if (_vm->_events->currentPos().y < MADS_SCENE_HEIGHT) + scene._customDest = _vm->_events->currentPos() + scene._posAdjust; + break; + + case CAT_TALK_ENTRY: + if (_selectedRow >= 0) + _selectedAction = -1; + break; + + default: + break; + } + break; + + case 2: + switch (userInterface._category) { + case CAT_INV_LIST: + case CAT_HOTSPOT: + case CAT_INV_ANIM: + if (_hotspotId >= 0) { + if (_flags2) { + _articleNumber = _flags2; + _v83338 = 3; + } + else { + _selectedAction = -1; + } + + if (userInterface._category == CAT_HOTSPOT) { + scene._customDest = _vm->_events->mousePos() + scene._posAdjust; + _v86F4A = true; + } + } + break; + default: + break; + } + break; + + case 3: + switch (userInterface._category) { + case CAT_INV_LIST: + case CAT_HOTSPOT: + case CAT_INV_ANIM: + if (_v86F3A >= 0) { + _selectedAction = -1; + + if (userInterface._category == CAT_HOTSPOT) { + if (!_v86F4A) { + scene._customDest = _vm->_events->mousePos() + scene._posAdjust; + _v86F4A = true; + } + } + } + break; + default: + break; + } + break; + } } } // End of namespace MADS diff --git a/engines/mads/action.h b/engines/mads/action.h index da738ac34f..440990f79e 100644 --- a/engines/mads/action.h +++ b/engines/mads/action.h @@ -28,8 +28,8 @@ namespace MADS { -enum ActionMode { ACTMODE_NONE = 0, ACTMODE_VERB = 1, ACTMODE_OBJECT = 3, ACTMODE_TALK = 6 }; -enum ActionMode2 { ACTMODE2_0 = 0, ACTMODE2_2 = 2, ACTMODE2_4 = 4, ACTMODE2_5 = 5 }; +enum ActionMode { ACTIONMODE_NONE = 0, ACTIONMODE_VERB = 1, ACTIONMODE_OBJECT = 3, ACTIONMODE_TALK = 6 }; +enum ActionMode2 { ACTIONMODE2_0 = 0, ACTIONMODE2_2 = 2, ACTIONMODE2_4 = 4, ACTIONMODE2_5 = 5 }; enum AbortTimerMode { ABORTMODE_0 = 0, ABORTMODE_1 = 1, ABORTMODE_2 = 2 }; enum { @@ -47,6 +47,7 @@ enum { VERB_WALKTO = 13 }; + class MADSEngine; struct ActionDetails { @@ -110,6 +111,11 @@ public: bool isAction(int verbId, int objectNameId = 0, int indirectObjectId = 0); void checkActionAtMousePos(); + + /** + * Execute a click within the scene + */ + void leftClick(); }; } // End of namespace MADS diff --git a/engines/mads/hotspots.cpp b/engines/mads/hotspots.cpp index df56a69e5a..91b8127d92 100644 --- a/engines/mads/hotspots.cpp +++ b/engines/mads/hotspots.cpp @@ -122,16 +122,20 @@ void DynamicHotspots::reset() { } void DynamicHotspots::refresh() { + // Reset the screen objects back to only contain UI elements + ScreenObjects &scrObjects = _vm->_game->_screenObjects; + scrObjects.resize(scrObjects._uiCount); + + // Loop through adding hotspots for (uint i = 0; i < _entries.size(); ++i) { DynamicHotspot &dh = (*this)[i]; if ((*this)[i]._active) { - switch (_vm->_game->_screenObjects._v832EC) { + switch (scrObjects._v832EC) { case 0: case 2: - _vm->_game->_screenObjects.add(dh._bounds, _vm->_game->_scene._layer, - CAT_12, dh._descId); - _vm->_game->_screenObjects._v8333C = true; + scrObjects.add(dh._bounds, _vm->_game->_scene._layer, CAT_12, dh._descId); + scrObjects._v8333C = true; break; default: break; diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 741ba82be4..baf51fea12 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -49,6 +49,8 @@ Scene::Scene(MADSEngine *vm): _vm(vm), _action(_vm), _depthSurface(vm), _textSpacing = -1; _frameStartTime = 0; _layer = LAYER_GUI; + _lookFlag = false; + _highlightedHotspot = 0; _verbList.push_back(VerbInit(VERB_LOOK, 2, 0)); _verbList.push_back(VerbInit(VERB_TAKE, 2, 0)); @@ -463,10 +465,6 @@ void Scene::drawElements(ScreenTransition transitionType, bool surfaceFlag) { _textDisplay.cleanUp(); } -void Scene::leftClick() { - warning("TODO: Scene::leftClick"); -} - void Scene::doPreactions() { warning("TODO: Scene::doPreactions"); } diff --git a/engines/mads/scene.h b/engines/mads/scene.h index 9493eda532..16684c47a2 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -118,6 +118,9 @@ public: Common::Point _posAdjust; uint32 _frameStartTime; Layer _layer; + bool _lookFlag; + int _highlightedHotspot; + Common::Point _customDest; /** * Constructor @@ -184,11 +187,6 @@ public: */ void drawElements(ScreenTransition transitionType, bool surfaceFlag); - /** - * Execute a click within the scene - */ - void leftClick(); - /** * Load an animation */ diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index 608456e2e3..1f1fc0a41e 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -260,6 +260,7 @@ ScreenObjects::ScreenObjects(MADSEngine *vm) : _vm(vm) { _category = CAT_NONE; _objectIndex = 0; _released = false; + _uiCount = 0; } void ScreenObjects::add(const Common::Rect &bounds, Layer layer, ScrCategory category, int descId) { @@ -314,7 +315,7 @@ void ScreenObjects::check(bool scanFlag) { } if (_vm->_events->_mouseReleased) { - scene.leftClick(); + scene._action.leftClick(); scene._userInterface._category = CAT_NONE; } @@ -329,8 +330,25 @@ void ScreenObjects::check(bool scanFlag) { scene._action.refresh(); - // Loop through image inter list - warning("TODO: imageInterList loop"); + UserInterface &userInterface = _vm->_game->_scene._userInterface; + uint32 currentTicks = _vm->_events->getFrameCounter(); + if (currentTicks >= _vm->_game->_ticksExpiry) { + // Check the user interface slots to see if there's any slots that need to be expired + UISlots &uiSlots = userInterface._uiSlots; + for (uint idx = 0; idx < uiSlots.size(); ++idx) { + UISlot &slot = uiSlots[idx]; + + if (slot._slotType != ST_FULL_SCREEN_REFRESH && slot._slotType > -20 + && slot._field2 != 200) + slot._slotType = ST_EXPIRED; + } + + // Handle animating the selected inventory animation + userInterface.inventoryAnim(); + + // Set the next frame expiry + _vm->_game->_ticksExpiry = currentTicks + 6; + } } int ScreenObjects::scanBackwards(const Common::Point &pt, int layer) { diff --git a/engines/mads/screen.h b/engines/mads/screen.h index 9033206852..862c8720f3 100644 --- a/engines/mads/screen.h +++ b/engines/mads/screen.h @@ -150,6 +150,7 @@ public: ScrCategory _category; int _objectIndex; bool _released; + int _uiCount; /* * Constructor diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index f46a4c4150..f6be725ac2 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -460,6 +460,9 @@ void UserInterface::loadElements() { _vm->_game->_screenObjects.add(bounds, LAYER_GUI, CAT_TALK_ENTRY, idx); } } + + // Store the number of UI elements loaded for easy nuking/refreshing hotspots added later + _vm->_game->_screenObjects._uiCount = _vm->_game->_screenObjects.size(); } bool UserInterface::getBounds(ScrCategory category, int v, Common::Rect &bounds) { diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h index b4c581d1c2..4a26d3450f 100644 --- a/engines/mads/user_interface.h +++ b/engines/mads/user_interface.h @@ -126,11 +126,6 @@ private: void writeVocab(ScrCategory category, int id); void refresh(); - - /** - * Handles queuing a new frame of an inventory animation for drawing - */ - void inventoryAnim(); public: MSurface _surface; UISlots _uiSlots; @@ -171,10 +166,21 @@ public: void setBounds(const Common::Rect &r); + /** + * Loads the animation sprite data for a given inventory object + */ void loadInventoryAnim(int objectId); + /** + * Resets the inventory animation when no inventory item is selected + */ void noInventoryAnim(); + /** + * Handles queuing a new frame of an inventory animation for drawing + */ + void inventoryAnim(); + void categoryChanged(); /** -- cgit v1.2.3 From 436949eba2c51593ad35bab25af1f5fe17f3fe7a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 20 Mar 2014 08:34:56 -0400 Subject: MADS: Implemented more action logic for highlighting hotspots --- engines/mads/action.cpp | 155 +++++++++++++++++++++--------------------- engines/mads/hotspots.cpp | 6 +- engines/mads/hotspots.h | 4 +- engines/mads/module.mk | 1 + engines/mads/scene.cpp | 7 +- engines/mads/user_interface.h | 2 + 6 files changed, 87 insertions(+), 88 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index 65abc9454d..40ece8eb2b 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -23,7 +23,9 @@ #include "common/scummsys.h" #include "mads/mads.h" #include "mads/action.h" +#include "mads/inventory.h" #include "mads/scene.h" +#include "mads/staticres.h" namespace MADS { @@ -58,71 +60,68 @@ void MADSAction::clear() { } void MADSAction::appendVocab(int vocabId, bool capitalise) { - /* - char *s = _statusText + strlen(_statusText); - vocabStr = _madsVm->globals()->getVocab(vocabId); - strcpy(s, vocabStr); + Common::String vocabStr = _vm->_game->_scene.getVocab(vocabId); if (capitalise) - *s = toupper(*s); + vocabStr.setChar(toupper(vocabStr[0]), 0); - strcat(s, " "); - */ + _statusText += vocabStr; + _statusText += " "; } void MADSAction::set() { - /* - int hotspotCount = _madsVm->scene()->getSceneResources().hotspots->size(); - bool flag = false; // FIXME: unused - strcpy(_statusText, ""); + Scene &scene = _vm->_game->_scene; + UserInterface &userInterface = scene._userInterface; + bool flag = false; + _statusText = ""; - _currentAction = -1; - _action.objectNameId = -1; - _action.indirectObjectId = -1; + _action._verbId = -1; + _action._objectNameId = -1; + _action._indirectObjectId = -1; - if (_actionMode == ACTMODE_TALK) { + if (_actionMode == ACTIONMODE_TALK) { // Handle showing the conversation selection. Rex at least doesn't actually seem to use this if (_selectedRow >= 0) { - const char *desc = _madsVm->_converse[_selectedRow].desc; - if (desc) - strcpy(_statusText, desc); + Common::String desc = userInterface._talkStrings[userInterface._talkIds[_selectedRow]]; + if (!desc.empty()) + _statusText = desc; } } else if (_lookFlag && (_selectedRow == 0)) { // Two 'look' actions in succession, so the action becomes 'Look around' - strcpy(_statusText, lookAroundStr); + _statusText = kLookAroundStr; } else { - if ((_actionMode == ACTMODE_OBJECT) && (_selectedRow >= 0) && (_flags1 == 2) && (_flags2 == 0)) { + if ((_actionMode == ACTIONMODE_OBJECT) && (_selectedRow >= 0) && (_flags1 == 2) && (_flags2 == 0)) { // Use/to action - int selectedObject = _madsVm->scene()->getInterface()->getSelectedObject(); - MadsObject *objEntry = _madsVm->globals()->getObject(selectedObject); + int invIndex = userInterface._selectedInvIndex; + InventoryObject &objEntry = _vm->_game->_objects.getItem(invIndex); - _action.objectNameId = objEntry->_descId; - _currentAction = objEntry->_vocabList[_selectedRow].vocabId; + _action._objectNameId = objEntry._descId; + _action._verbId = objEntry._vocabList[_selectedRow]._vocabId; // Set up the status text stirng - strcpy(_statusText, useStr); - appendVocab(_action.objectNameId); - strcpy(_statusText, toStr); - appendVocab(_currentAction); + _statusText = kUseStr; + appendVocab(_action._objectNameId); + _statusText += kToStr; + appendVocab(_action._verbId); } else { // Handling for if an action has been selected if (_selectedRow >= 0) { - if (_actionMode == ACTMODE_VERB) { + if (_actionMode == ACTIONMODE_VERB) { // Standard verb action - _currentAction = verbList[_selectedRow].verb; + _currentAction = scene._verbList[_selectedRow]._id; } else { // Selected action on an inventory object - int selectedObject = _madsVm->scene()->getInterface()->getSelectedObject(); - MadsObject *objEntry = _madsVm->globals()->getObject(selectedObject); + int invIndex = userInterface._selectedInvIndex; + InventoryObject &objEntry = _vm->_game->_objects.getItem(invIndex); - _currentAction = objEntry->_vocabList[_selectedRow].vocabId; + _currentAction = objEntry._vocabList[_selectedRow]._vocabId; } - appendVocab(_currentAction, true); + appendVocab(_action._verbId, true); - if (_currentAction == kVerbLook) { + if (_currentAction == VERB_LOOK) { // Add in the word 'add' - strcat(_statusText, atStr); - strcat(_statusText, " "); + _statusText += kAtStr; + _statusText += " "; } } @@ -130,20 +129,20 @@ void MADSAction::set() { if ((_hotspotId >= 0) && (_selectedRow >= 0) && (_articleNumber > 0) && (_flags1 == 2)) { flag = true; - strcat(_statusText, englishMADSArticleList[_articleNumber]); - strcat(_statusText, " "); + _statusText += kArticleList[_articleNumber]; + _statusText += " "; } if (_hotspotId >= 0) { if (_selectedRow < 0) { int verbId; - if (_hotspotId < hotspotCount) { + if (_hotspotId < (int)scene._hotspots.size()) { // Get the verb Id from the hotspot - verbId = (*_madsVm->scene()->getSceneResources().hotspots)[_hotspotId].getVerbID(); + verbId = scene._hotspots[_hotspotId]._verbId; } else { // Get the verb Id from the scene object - verbId = (*_madsVm->scene()->getSceneResources().dynamicHotspots)[_hotspotId - hotspotCount].getVerbID(); + verbId = scene._dynamicHotspots[_hotspotId - scene._hotspots.size()]._vocabId; } if (verbId > 0) { @@ -152,23 +151,23 @@ void MADSAction::set() { appendVocab(_currentAction, true); } else { // Default to a standard 'walk to' - _currentAction = kVerbWalkTo; - strcat(_statusText, walkToStr); + _currentAction = VERB_WALKTO; + _statusText += kWalkToStr; } } - if ((_actionMode2 == ACTMODE2_2) || (_actionMode2 == ACTMODE2_5)) { + if ((_actionMode2 == ACTIONMODE2_2) || (_actionMode2 == ACTIONMODE2_5)) { // Get name from given inventory object - int objectId = _madsVm->scene()->getInterface()->getInventoryObject(_hotspotId); - _action.objectNameId = _madsVm->globals()->getObject(objectId)->_descId; - } else if (_hotspotId < hotspotCount) { + InventoryObject &invObject = _vm->_game->_objects.getItem(_hotspotId); + _action._objectNameId = invObject._descId; + } else if (_hotspotId < (int)scene._hotspots.size()) { // Get name from scene hotspot - _action.objectNameId = (*_madsVm->scene()->getSceneResources().hotspots)[_hotspotId].getVocabID(); + _action._objectNameId = scene._hotspots[_hotspotId]._vocabId; } else { // Get name from temporary scene hotspot - _action.objectNameId = (*_madsVm->scene()->getSceneResources().dynamicHotspots)[_hotspotId].getVocabID(); + _action._objectNameId = scene._dynamicHotspots[_hotspotId - scene._hotspots.size()]._vocabId; } - appendVocab(_action.objectNameId); + appendVocab(_action._objectNameId); } } @@ -178,76 +177,74 @@ void MADSAction::set() { int articleNum = 0; if ((_v86F42 == 2) || (_v86F42 == 5)) { - int objectId = _madsVm->scene()->getInterface()->getInventoryObject(_hotspotId); - articleNum = _madsVm->globals()->getObject(objectId)->_article; - } else if (_v86F3A < hotspotCount) { - articleNum = (*_madsVm->scene()->getSceneResources().hotspots)[_hotspotId].getArticle(); + InventoryObject &invObject = _vm->_game->_objects.getItem(_hotspotId); + articleNum = invObject._article; + } else if (_v86F3A < (int)scene._hotspots.size()) { + articleNum = scene._hotspots[_hotspotId]._articleNumber; } else { - + articleNum = scene._hotspots[_hotspotId - scene._hotspots.size()]._articleNumber; } - } - } else if ((_articleNumber == kVerbLook) || (_vm->getGameType() != GType_RexNebular) || - (strcmp(_madsVm->globals()->getVocab(_action.indirectObjectId), fenceStr) != 0)) { + _statusText += kArticleList[articleNum]; + _statusText += " "; + } + } else if ((_articleNumber == VERB_LOOK) || (_vm->getGameID() != GType_RexNebular) || + (scene._vocabStrings[_action._indirectObjectId] != kFenceStr)) { // Write out the article - strcat(_statusText, englishMADSArticleList[_articleNumber]); + _statusText += kArticleList[_articleNumber]; } else { // Special case for a 'fence' entry in Rex Nebular - strcat(_statusText, overStr); + _statusText += kOverStr; } - strcat(_statusText, " "); + _statusText += " "; } // Append object description if necessary if (_v86F3A >= 0) - appendVocab(_action.indirectObjectId); + appendVocab(_action._indirectObjectId); // Remove any trailing space character - int statusLen = strlen(_statusText); - if ((statusLen > 0) && (_statusText[statusLen - 1] == ' ')) - _statusText[statusLen - 1] = '\0'; + if (_statusText.hasSuffix(" ")) + _statusText.deleteLastChar(); } _textChanged = true; - */ } void MADSAction::refresh() { - /* + Scene &scene = _vm->_game->_scene; + // Exit immediately if nothing has changed if (!_textChanged) return; // Remove any old copy of the status text if (_statusTextIndex >= 0) { - _owner._textDisplay.expire(_statusTextIndex); + scene._textDisplay.expire(_statusTextIndex); _statusTextIndex = -1; } - if (_statusText[0] != '\0') { - if ((_owner._screenObjects._v832EC == 0) || (_owner._screenObjects._v832EC == 2)) { - Font *font = _madsVm->_font->getFont(FONT_MAIN_MADS); + if (!_statusText.empty()) { + if ((_vm->_game->_screenObjects._v832EC == 0) || (_vm->_game->_screenObjects._v832EC == 2)) { + Font *font = _vm->_font->getFont(FONT_MAIN); int textSpacing = -1; int strWidth = font->getWidth(_statusText); - if (strWidth > 320) { + if (strWidth > MADS_SCREEN_WIDTH) { // Too large to fit, so fall back on interface font - font = _madsVm->_font->getFont(FONT_INTERFACE_MADS); + font = _vm->_font->getFont(FONT_INTERFACE); strWidth = font->getWidth(_statusText, 0); textSpacing = 0; } // Add a new text display entry to display the status text at the bottom of the screen area - uint colors = (_vm->getGameType() == GType_DragonSphere) ? 0x0300 : 0x0003; - - _statusTextIndex = _owner._textDisplay.add(160 - (strWidth / 2), - MADS_SURFACE_HEIGHT + _owner._posAdjust.y - 13, colors, textSpacing, _statusText, font); + _statusTextIndex = scene._textDisplay.add(160 - (strWidth / 2), + MADS_SCENE_HEIGHT + scene._posAdjust.y - 13, 3, textSpacing, _statusText, font); } } _textChanged = false; - */ } void MADSAction::startAction() { diff --git a/engines/mads/hotspots.cpp b/engines/mads/hotspots.cpp index 91b8127d92..4356e787d6 100644 --- a/engines/mads/hotspots.cpp +++ b/engines/mads/hotspots.cpp @@ -29,7 +29,7 @@ DynamicHotspot::DynamicHotspot() { _seqIndex = 0; _facing = 0; _descId = 0; - _field14 = 0; + _vocabId = 0; _articleNumber = 0; _cursor = CURSOR_NONE; } @@ -47,7 +47,7 @@ DynamicHotspots::DynamicHotspots(MADSEngine *vm) : _vm(vm) { _count = 0; } -int DynamicHotspots::add(int descId, int field14, int seqIndex, const Common::Rect &bounds) { +int DynamicHotspots::add(int descId, int vocabId, int seqIndex, const Common::Rect &bounds) { // Find a free slot uint idx = 0; while ((idx < _entries.size()) && _entries[idx]._active) @@ -62,7 +62,7 @@ int DynamicHotspots::add(int descId, int field14, int seqIndex, const Common::Re _entries[idx]._feetPos.x = -3; _entries[idx]._feetPos.y = 0; _entries[idx]._facing = 5; - _entries[idx]._field14 = field14; + _entries[idx]._vocabId = vocabId; _entries[idx]._articleNumber = 6; _entries[idx]._cursor = CURSOR_NONE; diff --git a/engines/mads/hotspots.h b/engines/mads/hotspots.h index 0dcde1d14b..ed18fbf252 100644 --- a/engines/mads/hotspots.h +++ b/engines/mads/hotspots.h @@ -39,7 +39,7 @@ public: Common::Point _feetPos; int _facing; int _descId; - int _field14; + int _vocabId; int _articleNumber; CursorType _cursor; @@ -59,7 +59,7 @@ public: DynamicHotspots(MADSEngine *vm); DynamicHotspot &operator[](uint idx) { return _entries[idx]; } - int add(int descId, int field14, int seqIndex, const Common::Rect &bounds); + int add(int descId, int vocabId, int seqIndex, const Common::Rect &bounds); int setPosition(int index, int xp, int yp, int facing); int setCursor(int index, CursorType cursor); void remove(int index); diff --git a/engines/mads/module.mk b/engines/mads/module.mk index c2e269e8c1..54126b1b06 100644 --- a/engines/mads/module.mk +++ b/engines/mads/module.mk @@ -34,6 +34,7 @@ MODULE_OBJS := \ sequence.o \ sound.o \ sprites.o \ + staticres.o \ user_interface.o # This module can be built as a plugin diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index baf51fea12..154e4c38bd 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -425,13 +425,13 @@ void Scene::drawElements(ScreenTransition transitionType, bool surfaceFlag) { // Draw any sprites _spriteSlots.drawBackground(); - // Process dirty areas + // Set up dirty areas for any text display _textDisplay.setDirtyAreas(); // Merge any identified dirty areas _dirtyAreas.merge(1, DIRTY_AREAS_SIZE); - // Copy dirty areas to the main display surface + // Copy background for the dirty areas to the screen _dirtyAreas.copy(&_backgroundSurface, &_vm->_screen, _posAdjust); // Handle dirty areas for foreground objects @@ -439,14 +439,13 @@ void Scene::drawElements(ScreenTransition transitionType, bool surfaceFlag) { _textDisplay.setDirtyAreas2(); _dirtyAreas.merge(1, DIRTY_AREAS_SIZE); - // Draw foreground sprites _spriteSlots.drawForeground(&_vm->_screen); // Draw text elements onto the view _textDisplay.draw(&_vm->_screen); - // + // _vm->_screen.setPointer(&_vm->_screen); _userInterface.setBounds(Common::Rect(_vm->_screen._offset.x, _vm->_screen._offset.y, _vm->_screen._offset.x + _vm->_screen.w, _vm->_screen._offset.y + _vm->_screen.h)); diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h index 4a26d3450f..80038e80e3 100644 --- a/engines/mads/user_interface.h +++ b/engines/mads/user_interface.h @@ -144,6 +144,8 @@ public: int _v1C; int _v1E; bool _inventoryChanged; + Common::StringArray _talkStrings; + Common::Array _talkIds; public: /** * Constructor -- cgit v1.2.3 From 8df3da1556b05e5aab203125e0c61802e75b971f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 20 Mar 2014 08:41:09 -0400 Subject: MADS: Added new file for static resources --- engines/mads/staticres.cpp | 48 ++++++++++++++++++++++++++++++++++++++++++++++ engines/mads/staticres.h | 45 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 engines/mads/staticres.cpp create mode 100644 engines/mads/staticres.h diff --git a/engines/mads/staticres.cpp b/engines/mads/staticres.cpp new file mode 100644 index 0000000000..cf43576e9b --- /dev/null +++ b/engines/mads/staticres.cpp @@ -0,0 +1,48 @@ +/* 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 "mads/staticres.h" + +namespace MADS { + +const char *const kArticleList[9] = { + nullptr, "with", "to", "at", "from", "on", "in", "under", "behind" +}; + +const char *const kCheatingEnabledDesc[3] = { + "CHEATING ENABLED", + "(For your convenience).", + nullptr +}; + +const char *const kAtStr = "at"; +const char *const kLookAroundStr = "Look around"; +const char *const kToStr = "to "; +const char *const kUseStr = "Use "; +const char *const kWalkToStr = "Walk to "; +const char *const kFenceStr = "fence"; +const char *const kOverStr = "over"; + +const char *const kGameReleaseInfoStr = "ScummVM rev: 8.43 14-Sept-92"; +const char *const kGameReleaseTitleStr = "GAME RELASE VERSION INFO"; + +} // End of namespace MADS diff --git a/engines/mads/staticres.h b/engines/mads/staticres.h new file mode 100644 index 0000000000..5aaa331d25 --- /dev/null +++ b/engines/mads/staticres.h @@ -0,0 +1,45 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_STATICRES_H +#define MADS_STATICRES_H + +namespace MADS { + +extern const char *const kArticleList[9]; + +extern const char *const kCheatingEnabledDesc[3]; + +extern const char *const kAtStr; +extern const char *const kLookAroundStr; +extern const char *const kToStr; +extern const char *const kUseStr; +extern const char *const kWalkToStr; +extern const char *const kFenceStr; +extern const char *const kOverStr; + +extern const char *const kGameReleaseInfoStr; +extern const char *const kGameReleaseTitleStr; + +} // End of namespace MADS + +#endif /* MADS_STATICRES_H */ -- cgit v1.2.3 From 79f51c4ebd377ae91ec639ecf935c5fc4b2d2a32 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 20 Mar 2014 21:59:43 -0400 Subject: MADS: Minor initial sprite slots loading fixes, missing code from SequenceList::loadSprites --- engines/mads/events.cpp | 2 +- engines/mads/game.cpp | 2 +- engines/mads/scene.cpp | 2 + engines/mads/sequence.cpp | 97 +++++++++++++++++++++++++++++------------------ engines/mads/sequence.h | 8 +++- 5 files changed, 72 insertions(+), 39 deletions(-) diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp index 32d3a09c18..90393d665f 100644 --- a/engines/mads/events.cpp +++ b/engines/mads/events.cpp @@ -35,7 +35,7 @@ namespace MADS { EventsManager::EventsManager(MADSEngine *vm) { _vm = vm; _cursorSprites = nullptr; - _frameCounter = 0; + _frameCounter = 10; _priorFrameTime = 0; _keyPressed = false; _mouseClicked = false; diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 06ea2a5437..60481c69e4 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -232,7 +232,7 @@ void Game::sectionLoop() { _player.updateFrame(); _player._visible3 = _player._visible; _player._special = _scene.getDepthHighBits(_player._playerPos); - _player._priorTimer = _scene._frameStartTime + _player._ticksAmount; + _player._priorTimer = _scene._frameStartTime - _player._ticksAmount; _player.idle(); if (_scene._userInterface._selectedInvIndex >= 0) { diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 154e4c38bd..e65460611e 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -288,9 +288,11 @@ void Scene::doFrame() { } if (!_vm->_game->_abortTimers && !player._unk3) { + // Refresh the dynamic hotspots if they've changed if (_dynamicHotspots._changed) _dynamicHotspots.refresh(); + // Check all on-screen visual objects _vm->_game->_screenObjects.check(player._stepEnabled && !_action._startWalkFlag && !_vm->_game->_abortTimers2); } diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index 684e4996bc..6288f0ad61 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -28,31 +28,37 @@ namespace MADS { - SequenceEntry::SequenceEntry() { - _spritesIndex = 0; - _flipped = 0; - _frameIndex = 0; - _frameStart = 0; - _numSprites = 0; - _animType = ANIMTYPE_NONE; - _frameInc = 0; - _depth = 0; - _scale = 0; - _dynamicHotspotIndex = -1; - _triggerCountdown = 0; - _doneFlag = 0; - _abortMode = ABORTMODE_0; - _numTicks = 0; - _extraTicks = 0; - _timeout = 0; - - _entries._count = 0; - Common::fill(&_entries._mode[0], &_entries._mode[TIMER_ENTRY_SUBSET_MAX], SM_0); - Common::fill(&_entries._frameIndex[0], &_entries._frameIndex[TIMER_ENTRY_SUBSET_MAX], 0); - Common::fill(&_entries._abortVal[0], &_entries._abortVal[TIMER_ENTRY_SUBSET_MAX], 0); - } +SequenceEntry::SequenceEntry() { + _spritesIndex = 0; + _flipped = 0; + _frameIndex = 0; + _frameStart = 0; + _numSprites = 0; + _animType = ANIMTYPE_NONE; + _frameInc = 0; + _depth = 0; + _scale = 0; + _dynamicHotspotIndex = -1; + _field18 = 0; + _field1A = 0; + _field1C = 0; + _field1E = 0; + _field20 = 0; + _field22 = 0; + _triggerCountdown = 0; + _doneFlag = 0; + _abortMode = ABORTMODE_0; + _numTicks = 0; + _extraTicks = 0; + _timeout = 0; + + _entries._count = 0; + Common::fill(&_entries._mode[0], &_entries._mode[TIMER_ENTRY_SUBSET_MAX], SM_0); + Common::fill(&_entries._frameIndex[0], &_entries._frameIndex[TIMER_ENTRY_SUBSET_MAX], 0); + Common::fill(&_entries._abortVal[0], &_entries._abortVal[TIMER_ENTRY_SUBSET_MAX], 0); +} - /*------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------*/ #define SEQUENCE_LIST_SIZE 30 @@ -126,7 +132,7 @@ int SequenceList::add(int spriteListIndex, bool flipped, int frameIndex, int tri _entries[seqIndex]._triggerCountdown = triggerCountdown; _entries[seqIndex]._doneFlag = false; - _entries[seqIndex]._field13 = 0; + _entries[seqIndex]._flags = 0; _entries[seqIndex]._dynamicHotspotIndex = -1; _entries[seqIndex]._entries._count = 0; _entries[seqIndex]._abortMode = _vm->_game->_abortTimersMode2; @@ -210,30 +216,49 @@ bool SequenceList::loadSprites(int seqIndex) { if (seqEntry._spritesIndex == -1) { // Doesn't have an associated sprite anymore, so mark as done seqEntry._doneFlag = true; - } - else if ((slotIndex = scene._spriteSlots.add()) >= 0) { + } else if ((slotIndex = scene._spriteSlots.add()) >= 0) { SpriteSlot &spriteSlot = scene._spriteSlots[slotIndex]; setSpriteSlot(seqIndex, spriteSlot); - int x2 = 0, y2 = 0; - - if ((seqEntry._field13 != 0) || (seqEntry._dynamicHotspotIndex >= 0)) { + if ((seqEntry._flags != 0) || (seqEntry._dynamicHotspotIndex >= 0)) { SpriteAsset &spriteSet = *scene._sprites[seqEntry._spritesIndex]; MSprite *frame = spriteSet.getFrame(seqEntry._frameIndex - 1); int width = frame->getWidth() * seqEntry._scale / 200; int height = frame->getHeight() * seqEntry._scale / 100; + Common::Point pt = spriteSlot._position; + + // ToDO: Find out the proper meanings of the following fields + if (seqEntry._flags & 1) { + seqEntry._field20 += seqEntry._field18; + if (seqEntry._field20 >= 100) { + int v = seqEntry._field20 / 100; + seqEntry._msgPos.x += v * seqEntry._field1C; + seqEntry._field20 -= v * 100; + } - warning("frame size %d x %d", width, height); + seqEntry._field22 += seqEntry._field1A; + if (seqEntry._field22 >= 100) { + int v = seqEntry._field22 / 100; + seqEntry._msgPos.y += v * seqEntry._field1E; + seqEntry._field22 -= v * 100; + } + } - // TODO: Missing stuff here, and I'm not certain about the dynamic hotspot stuff below + if (seqEntry._flags & 2) { + if ((pt.x + width) < 0 || (pt.x + width) >= MADS_SCREEN_WIDTH || + pt.y < 0 || (pt.y + height) >= MADS_SCENE_HEIGHT) { + result = true; + seqEntry._doneFlag = true; + } + } if (seqEntry._dynamicHotspotIndex >= 0) { DynamicHotspot &dynHotspot = scene._dynamicHotspots[seqEntry._dynamicHotspotIndex]; - dynHotspot._bounds.left = MAX(x2 - width, 0); - dynHotspot._bounds.right = MAX(x2 - width, 319) - dynHotspot._bounds.left + 1; - dynHotspot._bounds.top = MAX(y2 - height, 0); - dynHotspot._bounds.bottom = MIN(y2, 155) - dynHotspot._bounds.top; + dynHotspot._bounds.left = MAX(pt.x - width, 0); + dynHotspot._bounds.top = MAX(pt.y - height, 0); + dynHotspot._bounds.right = dynHotspot._bounds.left + width; + dynHotspot._bounds.bottom = dynHotspot._bounds.top + height; scene._dynamicHotspots._changed = true; } diff --git a/engines/mads/sequence.h b/engines/mads/sequence.h index a62ad7ee7a..2645e62acc 100644 --- a/engines/mads/sequence.h +++ b/engines/mads/sequence.h @@ -62,9 +62,15 @@ struct SequenceEntry { int _dynamicHotspotIndex; bool _nonFixed; - int _field13; + uint32 _flags; Common::Point _msgPos; + int _field18; + int _field1A; + int _field1C; + int _field1E; + int _field20; + int _field22; int _triggerCountdown; bool _doneFlag; SequenceSubEntries _entries; -- cgit v1.2.3 From 2b141aaba681a3c7b848010cd58768f55f4434a3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 21 Mar 2014 09:27:22 -0400 Subject: MADS: Fixes for screen objects loading and checking --- engines/mads/dialogs.cpp | 1 + engines/mads/game.h | 2 +- engines/mads/game_data.h | 1 + engines/mads/nebular/nebular_scenes1.cpp | 14 ++++++-------- engines/mads/player.cpp | 4 ++++ engines/mads/player.h | 2 ++ engines/mads/scene.cpp | 14 ++++++++++++-- engines/mads/screen.cpp | 10 ++++++---- engines/mads/screen.h | 1 + engines/mads/sequence.cpp | 13 ++++++++----- engines/mads/sequence.h | 8 ++++---- engines/mads/sprites.cpp | 2 +- engines/mads/user_interface.cpp | 2 +- engines/mads/user_interface.h | 1 - 14 files changed, 48 insertions(+), 27 deletions(-) diff --git a/engines/mads/dialogs.cpp b/engines/mads/dialogs.cpp index 333bbe98b4..d5d7d64380 100644 --- a/engines/mads/dialogs.cpp +++ b/engines/mads/dialogs.cpp @@ -338,6 +338,7 @@ Dialogs *Dialogs::init(MADSEngine *vm) { } Dialogs::Dialogs(MADSEngine *vm): _vm(vm) { + _pendingDialog = DIALOG_NONE; } } // End of namespace MADS diff --git a/engines/mads/game.h b/engines/mads/game.h index 444e2fa372..32491ce0d0 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -65,7 +65,6 @@ protected: Difficulty _difficultyLevel; int _saveSlot; int _statusFlag; - SectionHandler *_sectionHandler; Common::StringArray _quotes; int _v5; int _v6; @@ -118,6 +117,7 @@ public: int _priorSectionNumber; int _currentSectionNumber; InventoryObjects _objects; + SectionHandler *_sectionHandler; VisitedScenes _visitedScenes; Scene _scene; int _v1; diff --git a/engines/mads/game_data.h b/engines/mads/game_data.h index 7674beed81..8b31e5260c 100644 --- a/engines/mads/game_data.h +++ b/engines/mads/game_data.h @@ -59,6 +59,7 @@ public: virtual void preLoadSection() = 0; virtual void sectionPtr2() = 0; virtual void postLoadSection() = 0; + virtual void step() {} }; } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 65787af655..d3df1e9787 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -147,15 +147,13 @@ void Scene103::enter() { _scene->_sequences.setDepth(_globals._spriteIndexes[16], 0); _globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle( _globals._spriteIndexes[2], false, 6, 0, 0, 25); - _globals._spriteIndexes[18] = _scene->_sequences.addSubEntry( - _globals._spriteIndexes[17], SM_FRAME_INDEX, 2, 72); - _globals._spriteIndexes[19] = _scene->_sequences.addSubEntry( - _globals._spriteIndexes[17], SM_FRAME_INDEX, 2, 72); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[17], - SM_FRAME_INDEX, 2, 73); - + _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle( + _scene->_sequences.addSubEntry(_globals._spriteIndexes[17], + SM_FRAME_INDEX, 2, 72), false, 8); _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle( - _globals._spriteIndexes[8], false, 8); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], + SM_FRAME_INDEX, 2, 73), false, 8); + _globals._spriteIndexes[22] = _scene->_sequences.addSpriteCycle( _globals._spriteIndexes[7], false, 6); _globals._spriteIndexes[19] = _scene->_sequences.addSpriteCycle( diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index 80343609b9..1e886ae704 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -747,4 +747,8 @@ void Player::startMovement() { _v8452E = -_v84530; } +void Player::step() { + warning("TODO: Player::step"); +} + } // End of namespace MADS diff --git a/engines/mads/player.h b/engines/mads/player.h index b997e26a02..8bc0ae73a1 100644 --- a/engines/mads/player.h +++ b/engines/mads/player.h @@ -156,6 +156,8 @@ public: void startWalking(const Common::Point &pos, int direction); void nextFrame(); + + void step(); }; } // End of namespace MADS diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index e65460611e..ee5ff1f503 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -337,7 +337,9 @@ void Scene::doFrame() { CursorType cursorId = CURSOR_ARROW; if (_action._v83338 == 1 && !_vm->_game->_screenObjects._v7FECA && _vm->_game->_screenObjects._category == CAT_HOTSPOT) { - int idx = _vm->_game->_screenObjects._selectedObject - _userInterface._screenObjectsCount; + int idx = _vm->_game->_screenObjects._selectedObject - _vm->_game->_screenObjects._hotspotsIndex; + assert(idx >= 0); + if (idx >= (int)_hotspots.size()) { idx -= _hotspots.size(); _vm->_events->_newCursorId = _dynamicHotspots[idx]._cursor; @@ -482,7 +484,15 @@ void Scene::checkStartWalk() { } void Scene::doSceneStep() { - warning("TODO: Scene::doSceneStep"); + _vm->_game->_abortTimersMode2 = ABORTMODE_1; + _sceneLogic->step(); + _vm->_game->_sectionHandler->step(); + + _vm->_game->_player.step(); + _vm->_game->_player._unk3 = 0; + + if (_vm->_game->_abortTimersMode == ABORTMODE_1) + _vm->_game->_abortTimers = 0; } void Scene::checkKeyboard() { diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index 1f1fc0a41e..7fea54a2f2 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -261,6 +261,8 @@ ScreenObjects::ScreenObjects(MADSEngine *vm) : _vm(vm) { _objectIndex = 0; _released = false; _uiCount = 0; + _hotspotsIndex = 0; + _selectedObject = -1; } void ScreenObjects::add(const Common::Rect &bounds, Layer layer, ScrCategory category, int descId) { @@ -282,10 +284,10 @@ void ScreenObjects::check(bool scanFlag) { _v7FECA = false; if ((_vm->_events->_vD6 || _v8332A || _vm->_game->_scene._userInterface._scrollerY || _v8333C) && scanFlag) { - scene._userInterface._selectedInvIndex = scanBackwards(_vm->_events->currentPos(), LAYER_GUI); - if (scene._userInterface._selectedInvIndex > 0) { - _category = (ScrCategory)((*this)[scene._userInterface._selectedInvIndex - 1]._category & 7); - _objectIndex = (*this)[scene._userInterface._selectedInvIndex - 1]._descId; + _selectedObject = scanBackwards(_vm->_events->currentPos(), LAYER_GUI); + if (_selectedObject > 0) { + _category = (ScrCategory)((*this)[_selectedObject - 1]._category & 7); + _objectIndex = (*this)[_selectedObject - 1]._descId; } // Handling for easy mouse diff --git a/engines/mads/screen.h b/engines/mads/screen.h index 862c8720f3..c1e51cb193 100644 --- a/engines/mads/screen.h +++ b/engines/mads/screen.h @@ -151,6 +151,7 @@ public: int _objectIndex; bool _released; int _uiCount; + int _hotspotsIndex; /* * Constructor diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index 6288f0ad61..e5cc3b5a2c 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -53,9 +53,9 @@ SequenceEntry::SequenceEntry() { _timeout = 0; _entries._count = 0; - Common::fill(&_entries._mode[0], &_entries._mode[TIMER_ENTRY_SUBSET_MAX], SM_0); - Common::fill(&_entries._frameIndex[0], &_entries._frameIndex[TIMER_ENTRY_SUBSET_MAX], 0); - Common::fill(&_entries._abortVal[0], &_entries._abortVal[TIMER_ENTRY_SUBSET_MAX], 0); + Common::fill(&_entries._mode[0], &_entries._mode[SEQUENCE_ENTRY_SUBSET_MAX], SM_0); + Common::fill(&_entries._frameIndex[0], &_entries._frameIndex[SEQUENCE_ENTRY_SUBSET_MAX], 0); + Common::fill(&_entries._abortVal[0], &_entries._abortVal[SEQUENCE_ENTRY_SUBSET_MAX], 0); } /*------------------------------------------------------------------------*/ @@ -81,7 +81,7 @@ void SequenceList::clear() { } bool SequenceList::addSubEntry(int index, SequenceSubEntryMode mode, int frameIndex, int abortVal) { - if (_entries[index]._entries._count >= TIMER_ENTRY_SUBSET_MAX) + if (_entries[index]._entries._count >= SEQUENCE_ENTRY_SUBSET_MAX) return true; int subIndex = _entries[index]._entries._count++; @@ -305,7 +305,7 @@ bool SequenceList::loadSprites(int seqIndex) { } if (seqEntry._entries._count > 0) { - for (int i = 0; i <= seqEntry._entries._count; ++i) { + for (int i = 0; i < seqEntry._entries._count; ++i) { switch (seqEntry._entries._mode[i]) { case SM_0: case SM_1: @@ -330,6 +330,9 @@ bool SequenceList::loadSprites(int seqIndex) { if (idx >= 0) { _vm->_game->_abortTimers = seqEntry._entries._abortVal[idx]; _vm->_game->_abortTimersMode = seqEntry._abortMode; + + if (seqEntry._abortMode == ABORTMODE_1) + scene._action._activeAction = seqEntry._actionNouns; } return result; diff --git a/engines/mads/sequence.h b/engines/mads/sequence.h index 2645e62acc..f1b963a3dc 100644 --- a/engines/mads/sequence.h +++ b/engines/mads/sequence.h @@ -36,13 +36,13 @@ enum SequenceSubEntryMode { SM_0 = 0, SM_1 = 1, SM_FRAME_INDEX = 2 }; enum SpriteAnimType { ANIMTYPE_NONE = 0, ANIMTYPE_CYCLED = 1, ANIMTYPE_REVERSIBLE = 2 }; -#define TIMER_ENTRY_SUBSET_MAX 5 +#define SEQUENCE_ENTRY_SUBSET_MAX 5 struct SequenceSubEntries { int _count; - SequenceSubEntryMode _mode[TIMER_ENTRY_SUBSET_MAX]; - int _frameIndex[TIMER_ENTRY_SUBSET_MAX]; - int8 _abortVal[TIMER_ENTRY_SUBSET_MAX]; + SequenceSubEntryMode _mode[SEQUENCE_ENTRY_SUBSET_MAX]; + int _frameIndex[SEQUENCE_ENTRY_SUBSET_MAX]; + int8 _abortVal[SEQUENCE_ENTRY_SUBSET_MAX]; }; struct SequenceEntry { diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp index e519c6966b..ea4dbbbaad 100644 --- a/engines/mads/sprites.cpp +++ b/engines/mads/sprites.cpp @@ -177,7 +177,7 @@ SpriteSlots::SpriteSlots(MADSEngine *vm) : _vm(vm) { } void SpriteSlots::reset(bool flag) { - _vm->_game->_scene._textDisplay.clear(); + _vm->_game->_scene._textDisplay.reset(); if (flag) _vm->_game->_scene._sprites.clear(); diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index f6be725ac2..baec13318e 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -189,7 +189,6 @@ UserInterface::UserInterface(MADSEngine *vm) : _vm(vm), _dirtyAreas(vm), _invSpritesIndex = -1; _invFrameNumber = 1; _category = CAT_NONE; - _screenObjectsCount = 0; _inventoryTopIndex = 0; _objectY = 0; _selectedInvIndex = -1; @@ -445,6 +444,7 @@ void UserInterface::loadElements() { } if (!_vm->_game->_screenObjects._v832EC || _vm->_game->_screenObjects._v832EC == 2) { + _vm->_game->_screenObjects._hotspotsIndex = _vm->_game->_screenObjects.size(); for (int hotspotIdx = scene._hotspots.size() - 1; hotspotIdx >= 0; --hotspotIdx) { Hotspot &hs = scene._hotspots[hotspotIdx]; _vm->_game->_screenObjects.add(hs._bounds, LAYER_GUI, CAT_HOTSPOT, hotspotIdx); diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h index 80038e80e3..cd3ac1dd27 100644 --- a/engines/mads/user_interface.h +++ b/engines/mads/user_interface.h @@ -131,7 +131,6 @@ public: UISlots _uiSlots; DirtyAreas _dirtyAreas; ScrCategory _category; - int _screenObjectsCount; Common::Rect _drawBounds; Common::Rect *_rectP; int _inventoryTopIndex; -- cgit v1.2.3 From de09300fdd2194cd78054175b5d4e5231482ab1d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 21 Mar 2014 21:58:53 -0400 Subject: MADS: Fix initialisation of scene 103 --- engines/mads/nebular/nebular_scenes1.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index d3df1e9787..86cac3b8e4 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -145,15 +145,16 @@ void Scene103::enter() { _globals._spriteIndexes[16] = _scene->_sequences.addSpriteCycle( _globals._spriteIndexes[1], false, 6, 0, 2, 0); _scene->_sequences.setDepth(_globals._spriteIndexes[16], 0); + _globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle( _globals._spriteIndexes[2], false, 6, 0, 0, 25); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[17], SM_FRAME_INDEX, 2, 72); _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle( - _scene->_sequences.addSubEntry(_globals._spriteIndexes[17], - SM_FRAME_INDEX, 2, 72), false, 8); - _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle( - _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], - SM_FRAME_INDEX, 2, 73), false, 8); + _globals._spriteIndexes[3], _scene, false, 8); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_FRAME_INDEX, 2, 73); + _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle( + _globals._spriteIndexes[8], false, 8); _globals._spriteIndexes[22] = _scene->_sequences.addSpriteCycle( _globals._spriteIndexes[7], false, 6); _globals._spriteIndexes[19] = _scene->_sequences.addSpriteCycle( -- cgit v1.2.3 From 2090987b81615af4cda189a462bc04cd22d7a180 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 21 Mar 2014 22:47:31 -0400 Subject: MADS: Fixes for handling horizontally flipped frames --- engines/mads/assets.cpp | 1 + engines/mads/msurface.cpp | 2 +- engines/mads/screen.cpp | 11 ++++++----- engines/mads/sequence.cpp | 5 ++--- engines/mads/sprites.cpp | 4 ++-- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/engines/mads/assets.cpp b/engines/mads/assets.cpp index 136a3fffd6..a84d1940df 100644 --- a/engines/mads/assets.cpp +++ b/engines/mads/assets.cpp @@ -78,6 +78,7 @@ void SpriteAsset::load(Common::SeekableReadStream *stream, int flags) { int numColors = palStream->readUint16LE(); assert(numColors <= 252); + _colorCount = numColors; // Load in the palette palette.resize(numColors); diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp index 3ce5bdacd3..8f40173f13 100644 --- a/engines/mads/msurface.cpp +++ b/engines/mads/msurface.cpp @@ -498,7 +498,7 @@ MSurface *MSurface::flipHorizontal() const { for (int y = 0; y < this->h; ++y) { const byte *srcP = getBasePtr(this->w - 1, y); - byte *destP = dest->getData(); + byte *destP = dest->getBasePtr(0, y); for (int x = 0; x < this->w; ++x) *destP++ = *srcP--; diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index 7fea54a2f2..975ec7720b 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -91,13 +91,12 @@ void DirtyArea::setSpriteSlot(const SpriteSlot *spriteSlot) { _bounds.top = spriteSlot->_position.y - scene._posAdjust.y; SpriteAsset &spriteSet = *scene._sprites[spriteSlot->_spritesIndex]; - MSprite *frame = spriteSet.getFrame(((spriteSlot->_frameNumber & 0x7fff) - 1) & 0x7f); + MSprite *frame = spriteSet.getFrame(ABS(spriteSlot->_frameNumber) - 1); if (spriteSlot->_scale == -1) { width = frame->w; height = frame->h; - } - else { + } else { width = frame->w * spriteSlot->_scale / 100; height = frame->h * spriteSlot->_scale / 100; @@ -380,8 +379,10 @@ void ScreenSurface::init() { void ScreenSurface::copyRectToScreen(const Common::Point &destPos, const Common::Rect &bounds) { byte *buf = getBasePtr(destPos.x, destPos.y); - g_system->copyRectToScreen(buf, this->pitch, bounds.left, bounds.top, - bounds.width(), bounds.height()); + + if (bounds.width() != 0 && bounds.height() != 0) + g_system->copyRectToScreen(buf, this->pitch, bounds.left, bounds.top, + bounds.width(), bounds.height()); } void ScreenSurface::copyRectToScreen(const Common::Rect &bounds) { diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index e5cc3b5a2c..a03d0f839c 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -187,15 +187,14 @@ void SequenceList::setSpriteSlot(int seqIndex, SpriteSlot &spriteSlot) { spriteSlot._SlotType = spriteSet.isBackground() ? ST_BACKGROUND : ST_FOREGROUND; spriteSlot._seqIndex = seqIndex; spriteSlot._spritesIndex = timerEntry._spritesIndex; - spriteSlot._frameNumber = (timerEntry._flipped ? 0x8000 : 0) | timerEntry._frameIndex; + spriteSlot._frameNumber = timerEntry._flipped ? -timerEntry._frameIndex : timerEntry._frameIndex; spriteSlot._depth = timerEntry._depth; spriteSlot._scale = timerEntry._scale; if (!timerEntry._nonFixed) { spriteSlot._position = timerEntry._msgPos; } else { - assert(spriteSlot._frameNumber > 0); - MSprite *sprite = spriteSet.getFrame(spriteSlot._frameNumber - 1); + MSprite *sprite = spriteSet.getFrame(timerEntry._frameIndex - 1); spriteSlot._position = sprite->_offset; } } diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp index ea4dbbbaad..c0467ff95f 100644 --- a/engines/mads/sprites.cpp +++ b/engines/mads/sprites.cpp @@ -322,8 +322,8 @@ void SpriteSlots::drawForeground(MSurface *s) { SpriteAsset &spriteSet = *scene._sprites[slot._spritesIndex]; // Get the sprite frame - int frameNumber = slot._frameNumber & 0x7fff; - bool flipped = (slot._frameNumber & 0x8000) != 0; + int frameNumber = ABS(slot._frameNumber); + bool flipped = slot._frameNumber < 0; assert(frameNumber > 0); MSprite *sprite = spriteSet.getFrame(frameNumber - 1); -- cgit v1.2.3 From 202d4ad4f1980bc7367e22ad1061b7b270991692 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 21 Mar 2014 23:36:56 -0400 Subject: MADS: Implemented more of scene 103 code --- engines/mads/mads.cpp | 4 +++ engines/mads/mads.h | 1 + engines/mads/nebular/nebular_scenes.cpp | 3 +- engines/mads/nebular/nebular_scenes.h | 1 + engines/mads/nebular/nebular_scenes1.cpp | 52 +++++++++++++++++++++++++++++++- 5 files changed, 59 insertions(+), 2 deletions(-) diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index 781fd7d01d..d6cd901a4c 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -107,4 +107,8 @@ int MADSEngine::getRandomNumber(int maxNumber) { return _randomSource.getRandomNumber(maxNumber); } +int MADSEngine::hypotenuse(int xv, int yv) { + return (int)sqrt((double)(xv * xv + yv * yv)); +} + } // End of namespace MADS diff --git a/engines/mads/mads.h b/engines/mads/mads.h index 3152e84f25..e9da307bbf 100644 --- a/engines/mads/mads.h +++ b/engines/mads/mads.h @@ -116,6 +116,7 @@ public: uint32 getGameFeatures() const; int getRandomNumber(int maxNumber); + int hypotenuse(int xv, int yv); }; } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index b9d244dd11..42a44a2b51 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -67,7 +67,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { NebularScene::NebularScene(MADSEngine *vm) : SceneLogic(vm), _globals(static_cast(vm->_game)->_globals), - _game(*static_cast(vm->_game)) { + _game(*static_cast(vm->_game)), + _action(vm->_game->_scene._action) { } Common::String NebularScene::formAnimName(char sepChar, int suffixNum) { diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index 13e3597335..6b2b101c62 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -106,6 +106,7 @@ class NebularScene : public SceneLogic { protected: Globals &_globals; GameNebular &_game; + MADSAction &_action; /** * Forms an animation resoucre name diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 86cac3b8e4..1ee1990cdd 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -150,7 +150,7 @@ void Scene103::enter() { _globals._spriteIndexes[2], false, 6, 0, 0, 25); _scene->_sequences.addSubEntry(_globals._spriteIndexes[17], SM_FRAME_INDEX, 2, 72); _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle( - _globals._spriteIndexes[3], _scene, false, 8); + _globals._spriteIndexes[3], false, 6, 0, 1, 37); _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_FRAME_INDEX, 2, 73); _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle( @@ -212,6 +212,45 @@ void Scene103::enter() { } void Scene103::step() { + Common::Point pt; + int dist; + + switch (_vm->_game->_abortTimers) { + case 70: + _vm->_game->_player._stepEnabled = true; + break; + + case 72: + pt = _vm->_game->_player._playerPos; + dist = _vm->hypotenuse(pt.x - 58, pt.y - 93); + _vm->_sound->command(27, (dist * -128 / 378) + 127); + break; + + case 73: + pt = _vm->_game->_player._playerPos; + dist = _vm->hypotenuse(pt.x - 266, pt.y - 81); + _vm->_sound->command(27, (dist * -127 / 378) + 127); + break; + + default: + break; + } + + if (_globals._frameTime <= _scene->_frameStartTime) { + pt = _vm->_game->_player._playerPos; + int dist = _vm->hypotenuse(pt.x - 79, pt.y - 137); + _vm->_sound->command(29, (dist * -127 / 378) + 127); + + pt = _vm->_game->_player._playerPos; + dist = _vm->hypotenuse(pt.x - 69, pt.y - 80); + _vm->_sound->command(30, (dist * -127 / 378) + 127); + + pt = _vm->_game->_player._playerPos; + dist = _vm->hypotenuse(pt.x - 266, pt.y - 138); + _vm->_sound->command(32, (dist * -127 / 378) + 127); + + _globals._frameTime = _scene->_frameStartTime + _vm->_game->_player._ticksAmount; + } } void Scene103::preActions() { @@ -221,6 +260,17 @@ void Scene103::actions() { } void Scene103::postActions() { + if (_action.isAction(27) && !_action.isAction(13)) { + Dialog::show(0x2841); + _action._inProgress = false; + } else { + if (_action.isAction(7, 85, 144)) { + Common::String msg = _game.getQuote(73); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, + 34, 0, 120, msg); + _action._inProgress = false; + } + } } } // End of namespace Nebular -- cgit v1.2.3 From 07b9a54e271f30574a574988fa292e2548dd5a80 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 22 Mar 2014 14:34:11 +0100 Subject: MADS: Implement Scene202::Step --- engines/mads/nebular/nebular_scenes2.cpp | 281 ++++++++++++++++++++++++++++++- engines/mads/nebular/nebular_scenes2.h | 8 + engines/mads/staticres.cpp | 1 + 3 files changed, 288 insertions(+), 2 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 84941e6b69..963a02726e 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -419,7 +419,7 @@ void Scene202::enter() { } _globals._v7 = _scene->_frameStartTime; - warning("dword_8425C = _scene->_frameStartTime;"); + warning("TODO: dword_8425C = _scene->_frameStartTime;"); if (_scene->_roomChanged) _game._objects.addToInventory(OBJ_NONE); @@ -462,7 +462,284 @@ void Scene202::enter() { _globals._abortVal = 0; } +void Scene202::setRandomKernelMessage() { + int vocabId = 92 + _vm->getRandomNumber(4); + _scene->_kernelMessages.reset(); + _game._abortTimersMode2 = ABORTMODE_1; + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 70, 120, _game.getQuote(vocabId)); + _globals._v0 = -1; +} + void Scene202::step() { + if ((_globals._v0 == 0) && (_game._player._playerPos == Common::Point(77, 105)) && (_game._player._direction == 8) && (_vm->getRandomNumber(999) == 0)) { + _scene->_kernelMessages.reset(); + _globals._v0 = 0; + if (_vm->getRandomNumber(4) == 0) + setRandomKernelMessage(); + } + + if (_game._abortTimers == 70) + _globals._v0 = 0; + + if (_game._abortTimers == 71) { + _vm->_sound->command(3); + _vm->_sound->command(9); + warning("TODO: dword_8425C = 900 + _scene->_frameStartTime;"); + Common::Point msgPos; + int msgFlag; + if (_globals._v4 == 0) { + msgPos = Common::Point(0, 0); + msgFlag = 2; + } else { + msgPos = Common::Point(248, 15); + msgFlag = 0; + } + int msgIndex = _scene->_kernelMessages.add(msgPos, 0x1110, msgFlag | 32, 0, 120, _game.getQuote(102)); + _scene->_kernelMessages.setQuoted(msgIndex, 4, true); + + if (_globals[38] == 1) { + MADSAction *action = _game._player._action; + action->_activeAction._verbId = 3; + action->_activeAction._objectNameId = 39; + action->_activeAction._indirectObjectId = 438; + _game._abortTimersMode2 = ABORTMODE_0; + _scene->_sequences.addTimer(120, 2); + _globals._abortVal = -1; + } else if (_globals[38] == 2) { + _scene->_sequences.addTimer(120, 90); + } + _globals[38] = 0; + } + + switch (_game._abortTimers) { + case 90: + _vm->_sound->command(41); + _scene->_sequences.remove(_globals._spriteIndexes[25]); + _globals._spriteIndexes[24] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[9], true, 6, 1, 0, 0); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(247, 82)); + _scene->_sequences.setDepth(_globals._spriteIndexes[24], 1); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[24], SM_0, 0, 91); + break; + case 91: + _globals._spriteIndexes[24] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, 1); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(247, 82)); + _scene->_sequences.setDepth(_globals._spriteIndexes[24], 1); + _scene->_sequences.addTimer(60, 92); + break; + case 92: { + _scene->_sequences.remove(_globals._spriteIndexes[24]); + _globals._spriteIndexes[26] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[11], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._spriteIndexes[26], 1); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[26], SM_0, 0, 93); + _scene->_kernelMessages.reset(); + int msgIndex = _scene->_kernelMessages.add(Common::Point(0, -65), 0x1110, 32, 0, 60, _game.getQuote(98)); + _scene->_kernelMessages.setSeqIndex(msgIndex, _globals._spriteIndexes[26]); + } + break; + case 93: { + _globals[31] = -1; + _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 6, 0, 0, 0); + _scene->_hotspots.activate(199, false); + int idx = _scene->_dynamicHotspots.add(457, 13, _globals._spriteIndexes[20], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, 246, 124, 8); + warning("TODO: TimerList_getTimeout(_globals._spriteIndexes[26], _globals._spriteIndexes[20]);"); + warning("TODO: TimerList_getTimeout(-1, _globals._spriteIndexes[26]);"); + _game._player._stepEnabled = true; + _game._player._visible = true; + _globals._v4 = false; + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(99)); + } + break; + default: + break; + } + + if (!_scene->_activeAnimation && (_globals[33] != 2) && (_globals._v7 <= _scene->_frameStartTime)) { + warning("TODO: && (dword_8425C <= _scene->_frameStartTime) {"); + int randVal = _vm->getRandomNumber(499) + 1; + int threshold = 1; + if (_globals._v4) + threshold = 26; + if (!_globals[37]) + threshold = 25; + if (threshold >= randVal) { + _vm->_sound->command(17); + _scene->loadAnimation(formAnimName('M', -1), 71); + warning("TODO: word84266 = -1;"); + warning("TODO: word84268 = 0;"); + _globals[37] = true; + _globals._v6 = _scene->_frameStartTime; + _globals._v8 = 0; + warning("TODO: _timerIndex = 0;"); + warning("TODO: word84264 = 0;"); + _globals._v7 = _scene->_frameStartTime + 2; + } + } + + if (!_scene->_activeAnimation) + return; + + if (_globals._v5) { + if (_scene->_activeAnimation->getCurrentFrame() >= 200) { + if ((_globals[38] == 2) || _globals[31]) { + _scene->_nextSceneId = 213; + } else { + Dialog::show(0x4EE9); + _scene->_reloadSceneFlag = true; + } + } + + if (_scene->_activeAnimation->getCurrentFrame() == 160) { + warning("TODO: && (word84260 != _scene->_activeAnimation->getCurrentFrame()) {"); + Common::Point msgPos; + int msgFlag; + if (_globals._v4 == 0) { + msgPos = Common::Point(0, 0); + msgFlag = 2; + } else { + msgPos = Common::Point(248, 15); + msgFlag = 0; + } + int msgIndex = _scene->_kernelMessages.add(msgPos, 0x1110, msgFlag | 32, 0, 120, _game.getQuote(101)); + _scene->_kernelMessages.setQuoted(msgIndex, 4, true); + } + } + + if (_globals._v7 + 7200 <= _scene->_frameStartTime) { + warning("TODO: word84268 = -1;"); + } + + warning("TODO: if (_scene->_activeAnimation->getCurrentFrame() == word84260) {"); +// if (_scene->_activeAnimation->getCurrentFrame() == word84260) { +// return; +// } + + warning("TODO: word84260 = _scene->_activeAnimation->getCurrentFrame();"); + int var2 = _vm->getRandomNumber(999) + 1; + int varA = -1; + + if (_scene->_activeAnimation->getCurrentFrame() == 77) { + varA = subStep1(var2); + } else if (_scene->_activeAnimation->getCurrentFrame() < 77) { + if (_scene->_activeAnimation->getCurrentFrame() == 74) { + varA = subStep2(var2); + } else if (_scene->_activeAnimation->getCurrentFrame() <= 74) { + if (_scene->_activeAnimation->getCurrentFrame() == 27) { + varA = subStep3(var2); + } else if (_scene->_activeAnimation->getCurrentFrame() == 42) { + varA = subStep1(var2); + } else if (_scene->_activeAnimation->getCurrentFrame() == 51) { + varA = subStep2(var2); + } else if (_scene->_activeAnimation->getCurrentFrame() == 59) { + warning("TODO: _timerIndex = 3;"); + warning("TODO: ++word84264;"); + if (var2 <= 800) + varA = 55; + } else { + // Nothing + ; + } + } else { + // nothing + ; + } + } else if (_scene->_activeAnimation->getCurrentFrame() == 119) { + varA = subStep3(var2); + } else if (_scene->_activeAnimation->getCurrentFrame() > 119) { + if (_scene->_activeAnimation->getCurrentFrame() == 137) { + warning("TODO: _timerIndex = 2;"); + if (var2 <= 700) + varA = 126; + } else if (_scene->_activeAnimation->getCurrentFrame() == 159) { + varA = subStep3(var2); + } else if (_scene->_activeAnimation->getCurrentFrame() == 176) { + varA = subStep4(var2); + } else { + // Nothing + ; + } + } else if (_scene->_activeAnimation->getCurrentFrame() == 89) { + warning("TODO: _timerIndex = 1;"); + if (var2 <= 700) + varA = 83; + } else if (_scene->_activeAnimation->getCurrentFrame() == 96) { + varA = subStep1(var2); + } else { + // Nothing + ; + } + + if (varA < 0) + return; + + int nextFrame = 1 + _scene->_activeAnimation->getCurrentFrame() - varA; + if (nextFrame) { + _scene->_activeAnimation->setCurrentFrame(nextFrame); + warning("word84260 = nextFrame"); + } +} + +int Scene202::subStep1(int var2) { + warning("TODO: word84264 = 0;"); + + warning("TODO: if ((var2 <= 100) || (word84266 != 0))"); + if (var2 <= 100) + return 42; + + warning("TODO: if ((var2 <= 200) || (word84268 != 0))"); + if (var2 <= 200) + return 96; + + warning("TODO: if ((var2 <= 300) && (_timerIndex != 1))"); + if (var2 <= 300) + return 77; + + return 76; +} + +int Scene202::subStep2(int var2) { + warning("TODO: word84266 = 0;"); + + warning("TODO: if ((var2 <= 150) && (word84264 < 5)"); + if (var2 <= 150) + return 51; + + warning("TODO: if ((var2 <= 300) || word84268)"); + if (var2 <= 300) + return 74; + + if (var2 <= 400) + return 64; + + return 44; +} + +int Scene202::subStep3(int var2) { + warning("TODO: if ((var2 <= 100) || (word84266 != 0))"); + if (var2 <= 100) + return 27; + + warning("TODO: if ((var2 <= 200) || (word84268 != 0))"); + if (var2 <= 200) + return 159; + + warning("TODO: if ((var2 <= 300) && (_timerIndex != 2))"); + if (var2 <= 300) + return 119; + + return 110; +} + +int Scene202::subStep4(int var2) { + warning("TODO: if ((var2 <= 100) || (word84268 != 0))"); + if (var2 <= 100) + return 176; + + if (var2 <= 200) + return 19; + + return 166; } void Scene202::preActions() { @@ -673,7 +950,7 @@ void Scene202::actions() { } } } else if (action->isAction(0x188, 0xAA, 0)) { - warning("TODO - sub_370C8"); + setRandomKernelMessage(); } else if (action->isAction(0x3, 0x129, 0)) { Dialog::show(0x4EEA); } else if (action->isAction(0x3, 0x86, 0)) { diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index 35a6ff1062..918b2f7f5d 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -61,6 +61,12 @@ public: }; class Scene202: public Scene2xx { +private: + int subStep1(int var2); + int subStep2(int var2); + int subStep3(int var2); + int subStep4(int var2); + public: Scene202(MADSEngine *vm) : Scene2xx(vm) {} virtual void setup(); @@ -69,6 +75,8 @@ public: virtual void preActions(); virtual void actions(); virtual void postActions() {}; + + void setRandomKernelMessage(); }; } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/staticres.cpp b/engines/mads/staticres.cpp index cf43576e9b..d57222c57a 100644 --- a/engines/mads/staticres.cpp +++ b/engines/mads/staticres.cpp @@ -20,6 +20,7 @@ * */ +#include "common/scummsys.h" #include "mads/staticres.h" namespace MADS { -- cgit v1.2.3 From 4fec23ad1cc58911ceb88f259c7721a77224982d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 22 Mar 2014 15:15:22 +0100 Subject: MADS: Refactor Scene202::step() --- engines/mads/nebular/nebular_scenes2.cpp | 137 ++++++++++++++----------------- engines/mads/nebular/nebular_scenes2.h | 8 +- 2 files changed, 65 insertions(+), 80 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 963a02726e..90665a8a1e 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -616,127 +616,112 @@ void Scene202::step() { // } warning("TODO: word84260 = _scene->_activeAnimation->getCurrentFrame();"); - int var2 = _vm->getRandomNumber(999) + 1; - int varA = -1; + int randVal = _vm->getRandomNumber(999) + 1; + int frameStep = -1; - if (_scene->_activeAnimation->getCurrentFrame() == 77) { - varA = subStep1(var2); - } else if (_scene->_activeAnimation->getCurrentFrame() < 77) { - if (_scene->_activeAnimation->getCurrentFrame() == 74) { - varA = subStep2(var2); - } else if (_scene->_activeAnimation->getCurrentFrame() <= 74) { - if (_scene->_activeAnimation->getCurrentFrame() == 27) { - varA = subStep3(var2); - } else if (_scene->_activeAnimation->getCurrentFrame() == 42) { - varA = subStep1(var2); - } else if (_scene->_activeAnimation->getCurrentFrame() == 51) { - varA = subStep2(var2); - } else if (_scene->_activeAnimation->getCurrentFrame() == 59) { - warning("TODO: _timerIndex = 3;"); - warning("TODO: ++word84264;"); - if (var2 <= 800) - varA = 55; - } else { - // Nothing - ; - } - } else { - // nothing - ; - } - } else if (_scene->_activeAnimation->getCurrentFrame() == 119) { - varA = subStep3(var2); - } else if (_scene->_activeAnimation->getCurrentFrame() > 119) { - if (_scene->_activeAnimation->getCurrentFrame() == 137) { - warning("TODO: _timerIndex = 2;"); - if (var2 <= 700) - varA = 126; - } else if (_scene->_activeAnimation->getCurrentFrame() == 159) { - varA = subStep3(var2); - } else if (_scene->_activeAnimation->getCurrentFrame() == 176) { - varA = subStep4(var2); - } else { - // Nothing - ; - } - } else if (_scene->_activeAnimation->getCurrentFrame() == 89) { + switch (_scene->_activeAnimation->getCurrentFrame()) { + case 42: + case 77: + case 96: + frameStep = subStep1(randVal); + break; + case 51: + case 74: + frameStep = subStep2(randVal); + break; + case 27: + case 119: + case 159: + frameStep = subStep3(randVal); + break; + case 176: + frameStep = subStep4(randVal); + break; + case 59: + warning("TODO: _timerIndex = 3;"); + warning("TODO: ++word84264;"); + if (randVal <= 800) + frameStep = 55; + break; + case 89: warning("TODO: _timerIndex = 1;"); - if (var2 <= 700) - varA = 83; - } else if (_scene->_activeAnimation->getCurrentFrame() == 96) { - varA = subStep1(var2); - } else { - // Nothing - ; + if (randVal <= 700) + frameStep = 83; + break; + case 137: + warning("TODO: _timerIndex = 2;"); + if (randVal <= 700) + frameStep = 126; + break; } - if (varA < 0) + if (frameStep < 0) return; - int nextFrame = 1 + _scene->_activeAnimation->getCurrentFrame() - varA; + int nextFrame = 1 + _scene->_activeAnimation->getCurrentFrame() - frameStep; if (nextFrame) { _scene->_activeAnimation->setCurrentFrame(nextFrame); warning("word84260 = nextFrame"); } } -int Scene202::subStep1(int var2) { +int Scene202::subStep1(int randVal) { warning("TODO: word84264 = 0;"); - warning("TODO: if ((var2 <= 100) || (word84266 != 0))"); - if (var2 <= 100) + warning("TODO: if ((randVal <= 100) || (word84266 != 0))"); + if (randVal <= 100) return 42; - warning("TODO: if ((var2 <= 200) || (word84268 != 0))"); - if (var2 <= 200) + warning("TODO: if ((randVal <= 200) || (word84268 != 0))"); + if (randVal <= 200) return 96; - warning("TODO: if ((var2 <= 300) && (_timerIndex != 1))"); - if (var2 <= 300) + warning("TODO: if ((randVal <= 300) && (_timerIndex != 1))"); + if (randVal <= 300) return 77; return 76; } -int Scene202::subStep2(int var2) { +int Scene202::subStep2(int randVal) { warning("TODO: word84266 = 0;"); - warning("TODO: if ((var2 <= 150) && (word84264 < 5)"); - if (var2 <= 150) + warning("TODO: if ((randVal <= 150) && (word84264 < 5)"); + if (randVal <= 150) return 51; - warning("TODO: if ((var2 <= 300) || word84268)"); - if (var2 <= 300) + warning("TODO: if ((randVal <= 300) || word84268)"); + if (randVal <= 300) return 74; - if (var2 <= 400) + if (randVal <= 400) return 64; return 44; } -int Scene202::subStep3(int var2) { - warning("TODO: if ((var2 <= 100) || (word84266 != 0))"); - if (var2 <= 100) +int Scene202::subStep3(int randVal) { + warning("TODO: if ((randVal <= 100) || (word84266 != 0))"); + if (randVal <= 100) return 27; - warning("TODO: if ((var2 <= 200) || (word84268 != 0))"); - if (var2 <= 200) + warning("TODO: if ((randVal <= 200) || (word84268 != 0))"); + if (randVal <= 200) return 159; - warning("TODO: if ((var2 <= 300) && (_timerIndex != 2))"); - if (var2 <= 300) + warning("TODO: if ((randVal <= 300) && (_timerIndex != 2))"); + if (randVal <= 300) return 119; return 110; } -int Scene202::subStep4(int var2) { - warning("TODO: if ((var2 <= 100) || (word84268 != 0))"); - if (var2 <= 100) +int Scene202::subStep4(int randVal) { + warning("TODO: if ((randVal <= 100) || (word84268 != 0))"); + if (randVal <= 100) return 176; - if (var2 <= 200) + if (randVal <= 200) return 19; return 166; diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index 918b2f7f5d..a1faf53055 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -62,10 +62,10 @@ public: class Scene202: public Scene2xx { private: - int subStep1(int var2); - int subStep2(int var2); - int subStep3(int var2); - int subStep4(int var2); + int subStep1(int randVal); + int subStep2(int randVal); + int subStep3(int randVal); + int subStep4(int randVal); public: Scene202(MADSEngine *vm) : Scene2xx(vm) {} -- cgit v1.2.3 From 7cdaa9648c0c49345460a0ab194a4ca97869e6bd Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 22 Mar 2014 12:02:17 -0400 Subject: MADS: Implemented ScreenObjects::checkScroller --- engines/mads/events.cpp | 7 ++- engines/mads/events.h | 2 +- engines/mads/screen.cpp | 94 ++++++++++++++++++++++++++++++++++++++--- engines/mads/screen.h | 13 +++++- engines/mads/user_interface.cpp | 8 ++++ engines/mads/user_interface.h | 4 ++ 6 files changed, 118 insertions(+), 10 deletions(-) diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp index 90393d665f..fe2a2532c5 100644 --- a/engines/mads/events.cpp +++ b/engines/mads/events.cpp @@ -41,9 +41,10 @@ EventsManager::EventsManager(MADSEngine *vm) { _mouseClicked = false; _mouseReleased = false; _mouseButtons = 0; + _vCC = 0; _vD2 = 0; _vD4 = 0; - _vD6 = 0; + _mouseMoved = false; _vD8 = 0; } @@ -100,6 +101,7 @@ void EventsManager::freeCursors() { void EventsManager::pollEvents() { checkForNextFrameCounter(); + _mouseMoved = false; Common::Event event; while (g_system->getEventManager()->pollEvent(event)) { @@ -130,9 +132,12 @@ void EventsManager::pollEvents() { case Common::EVENT_LBUTTONUP: case Common::EVENT_RBUTTONUP: _mouseClicked = false; + _mouseMoved = true; return; case Common::EVENT_MOUSEMOVE: _mousePos = event.mouse; + _currentPos = event.mouse; + _mouseMoved = true; break; default: break; diff --git a/engines/mads/events.h b/engines/mads/events.h index 17224227c6..219af20c2a 100644 --- a/engines/mads/events.h +++ b/engines/mads/events.h @@ -62,7 +62,7 @@ public: int _vCC; int _vD2; int _vD4; - int _vD6; + bool _mouseMoved; int _vD8; public: /** diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index 975ec7720b..3565c1ac79 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -251,17 +251,22 @@ ScreenObject::ScreenObject() { /*------------------------------------------------------------------------*/ ScreenObjects::ScreenObjects(MADSEngine *vm) : _vm(vm) { + _objectY = -1; _v8333C = false; _v832EC = 0; _v7FECA = 0; _v7FED6 = 0; _v8332A = 0; _category = CAT_NONE; - _objectIndex = 0; + _newDescId = 0; + _newDescId = 0; _released = false; _uiCount = 0; _hotspotsIndex = 0; _selectedObject = -1; + _scrollerY = -1; + _milliTime = 0; + _eventFlag = false; } void ScreenObjects::add(const Common::Rect &bounds, Layer layer, ScrCategory category, int descId) { @@ -282,11 +287,13 @@ void ScreenObjects::check(bool scanFlag) { if (!_vm->_events->_mouseButtons || _v832EC) _v7FECA = false; - if ((_vm->_events->_vD6 || _v8332A || _vm->_game->_scene._userInterface._scrollerY || _v8333C) && scanFlag) { + if ((_vm->_events->_mouseMoved || _vm->_game->_scene._userInterface._scrollerY + || _v8332A || _v8333C) && scanFlag) { + _category = CAT_NONE; _selectedObject = scanBackwards(_vm->_events->currentPos(), LAYER_GUI); if (_selectedObject > 0) { _category = (ScrCategory)((*this)[_selectedObject - 1]._category & 7); - _objectIndex = (*this)[_selectedObject - 1]._descId; + _newDescId = (*this)[_selectedObject - 1]._descId; } // Handling for easy mouse @@ -297,6 +304,8 @@ void ScreenObjects::check(bool scanFlag) { if (category >= CAT_ACTION && category <= CAT_TALK_ENTRY) { scene._userInterface.elementHighlighted(); } + + scene._action.checkActionAtMousePos(); } _released = _vm->_events->_mouseReleased; @@ -321,7 +330,7 @@ void ScreenObjects::check(bool scanFlag) { } if (_vm->_events->_mouseButtons || _vm->_easyMouse || scene._userInterface._scrollerY) - proc1(); + checkScroller(); if (_vm->_events->_mouseButtons || _vm->_easyMouse) scene._action.set(); @@ -362,8 +371,81 @@ int ScreenObjects::scanBackwards(const Common::Point &pt, int layer) { return 0; } -void ScreenObjects::proc1() { - warning("TODO: ScreenObjects::proc1"); +void ScreenObjects::checkScroller() { + UserInterface &userInterface = _vm->_game->_scene._userInterface; + Common::Array &inventoryList = _vm->_game->_objects._inventoryList; + + if (_v832EC) + return; + + userInterface._scrollerY = 0; + + if ((_category == CAT_INV_SCROLLER || (_scrollerY == 3 && _vm->_events->_vD4)) + && (_vm->_events->_vD4 || _vm->_easyMouse)) { + if ((_vm->_events->_vD2 || (_vm->_easyMouse && !_vm->_events->_vD4)) + && _category == CAT_INV_SCROLLER) { + _currentDescId = _newDescId; + } + } + + if (_newDescId == _currentDescId || _scrollerY == 3) { + _vm->_game->_scene._userInterface._scrollerY = _currentDescId; + uint32 currentMilli = g_system->getMillis(); + uint32 timeInc = _eventFlag ? 100 : 380; + + if (_vm->_events->_vD2 || (_milliTime + timeInc) <= currentMilli) { + _eventFlag = _vm->_events->_vD2 < 1; + _milliTime = currentMilli; + + switch (_currentDescId) { + case 1: + // Scroll up + if (userInterface._inventoryTopIndex > 0 && inventoryList.size() > 0) { + --userInterface._inventoryTopIndex; + userInterface._inventoryChanged = true; + } + break; + + case 2: + // Scroll down + if (userInterface._inventoryTopIndex < (int)inventoryList.size() && + inventoryList.size() > 0) { + ++userInterface._inventoryTopIndex; + userInterface._inventoryChanged = true; + } + break; + + case 3: { + // Inventory slider + int newIndex = CLIP((int)_vm->_events->currentPos().y - 170, 0, 17) + * inventoryList.size() / 10; + if (newIndex >= (int)inventoryList.size()) + newIndex = inventoryList.size() - 1; + + if (inventoryList.size() > 0) { + userInterface._inventoryChanged = newIndex != userInterface._inventoryTopIndex; + userInterface._inventoryTopIndex = newIndex; + } + break; + } + + default: + break; + } + + if (userInterface._inventoryChanged) { + int dummy; + userInterface.drawInventory(2, 0, &dummy); + } + } + } + + if (userInterface._scrollerY != _scrollerY || + userInterface._objectY != _objectY) + userInterface.scrollerChanged(); + + _scrollerY = userInterface._scrollerY; + _objectY = userInterface._objectY; } /*------------------------------------------------------------------------*/ diff --git a/engines/mads/screen.h b/engines/mads/screen.h index c1e51cb193..c8534a0906 100644 --- a/engines/mads/screen.h +++ b/engines/mads/screen.h @@ -136,10 +136,16 @@ public: class ScreenObjects : public Common::Array { private: MADSEngine *_vm; + int _objectY; + int _scrollerY; int scanBackwards(const Common::Point &pt, int layer); - void proc1(); + /** + * Checks for the mouse being on the user interface inventory scroller, + * and update the scroller and selected inventory object as necessary + */ + void checkScroller(); public: int _v832EC; int _v7FECA; @@ -148,10 +154,13 @@ public: int _v8333C; int _selectedObject; ScrCategory _category; - int _objectIndex; + int _newDescId; + int _currentDescId; bool _released; int _uiCount; int _hotspotsIndex; + uint32 _milliTime; + bool _eventFlag; /* * Constructor diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index baec13318e..4dba127d47 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -636,4 +636,12 @@ void UserInterface::selectObject(int invIndex) { warning("TODO: selectObject"); } +void UserInterface::drawInventory(int v1, int v2, int *v3) { + warning("TODO: drawInventory"); +} + +void UserInterface::scrollerChanged() { + warning("TODO: scrollerChanged"); +} + } // End of namespace MADS diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h index cd3ac1dd27..06f1e70975 100644 --- a/engines/mads/user_interface.h +++ b/engines/mads/user_interface.h @@ -189,6 +189,10 @@ public: * @param invIndex Index in the inventory list of the item to select */ void selectObject(int invIndex); + + void drawInventory(int v1, int v2, int *v3); + + void scrollerChanged(); }; } // End of namespace MADS -- cgit v1.2.3 From bbabe2b06b479fb5775b55c0de7b10df7ff67501 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 22 Mar 2014 14:20:04 -0400 Subject: MADS: Fix positioning of kernel messages --- engines/mads/messages.cpp | 19 ++++++++++++------- engines/mads/messages.h | 2 -- engines/mads/player.h | 8 ++++---- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/engines/mads/messages.cpp b/engines/mads/messages.cpp index 592dd4bd28..6dde40bbda 100644 --- a/engines/mads/messages.cpp +++ b/engines/mads/messages.cpp @@ -36,7 +36,6 @@ KernelMessages::KernelMessages(MADSEngine *vm): _vm(vm) { } _talkFont = _vm->_font->getFont(FONT_CONVERSATION); - word_8469E = 0; } KernelMessages::~KernelMessages() { @@ -89,7 +88,8 @@ int KernelMessages::add(const Common::Point &pt, uint fontColor, uint8 flags, int KernelMessages::addQuote(int quoteId, int abortTimers, uint32 timeout) { Common::String quoteStr = _vm->_game->getQuote(quoteId); - return add(Common::Point(), 0x1110, KMSG_PLAYER_TIMEOUT | KMSG_CENTER_ALIGN, abortTimers, timeout, quoteStr); + return add(Common::Point(), 0x1110, KMSG_PLAYER_TIMEOUT | KMSG_CENTER_ALIGN, + abortTimers, timeout, quoteStr); } void KernelMessages::scrollMessage(int msgIndex, int numTicks, bool quoted) { @@ -203,10 +203,16 @@ void KernelMessages::processText(int msgIndex) { } } + Player &player = _vm->_game->_player; if (msg._flags & KMSG_PLAYER_TIMEOUT) { - if (word_8469E != 0) { - warning("TODO: KernelMessages::processText"); - // TODO: Figure out various flags + if (player._visible3) { + SpriteAsset &asset = *_vm->_game->_scene._sprites[player._spritesStart + player._spritesIdx]; + MSprite *frame = asset.getFrame(player._frameNum - 1); + + int yAmount = player._currentScale * player._yScale / 100; + x1 = player._playerPos.x; + y1 = (frame->h * player._currentScale / -100) + yAmount + + player._playerPos.y - 15; } else { x1 = 160; y1 = 78; @@ -222,11 +228,10 @@ void KernelMessages::processText(int msgIndex) { ++msg._msgOffset; msg._msg.setChar(msg._asciiChar2, msg._msgOffset); msg._asciiChar = msg._msg[msg._msgOffset]; - msg._asciiChar2 = msg._msg[msg._msgOffset + 1]; + msg._asciiChar2 = !msg._asciiChar ? '\0' : msg._msg[msg._msgOffset + 1]; if (!msg._asciiChar) { // End of message - msg._msg.setChar('\0', msg._msgOffset); msg._flags &= ~KMSG_SCROLL; } else if (msg._flags & KMSG_QUOTED) { msg._msg.setChar('"', msg._msgOffset); diff --git a/engines/mads/messages.h b/engines/mads/messages.h index 205cbf8f30..8fb75953f6 100644 --- a/engines/mads/messages.h +++ b/engines/mads/messages.h @@ -71,8 +71,6 @@ private: MADSEngine *_vm; Common::Array _entries; Font *_talkFont; -public: - int word_8469E; public: KernelMessages(MADSEngine *vm); ~KernelMessages(); diff --git a/engines/mads/player.h b/engines/mads/player.h index 8bc0ae73a1..d7e074afc8 100644 --- a/engines/mads/player.h +++ b/engines/mads/player.h @@ -40,11 +40,7 @@ private: MADSEngine *_vm; bool _highSprites; bool _spriteSetsPresent[PLAYER_SPRITES_FILE_COUNT]; - int _currentDepth; - int _currentScale; int _frameOffset; - int _frameNum; - int _yScale; int _frameCount; int _frameListIndex; int _actionIndex; @@ -111,6 +107,7 @@ public: bool _visible; bool _priorVisible; bool _visible3; + int _frameNum; Common::Point _playerPos; Common::Point _destPos; Common::Point _posChange; @@ -126,6 +123,9 @@ public: int _unk3; bool _unk4; bool _forceRefresh; + int _yScale; + int _currentDepth; + int _currentScale; Common::String _spritesPrefix; int _routeCount; int _routeOffset; -- cgit v1.2.3 From adddf02e70a82e34e990f932f9955b947f7dcbc0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 22 Mar 2014 19:25:26 +0100 Subject: MADS: Implemente Scene::changeDepthSurface() --- engines/mads/nebular/nebular_scenes2.cpp | 4 ++-- engines/mads/scene.cpp | 6 ++++++ engines/mads/scene.h | 3 +++ engines/mads/scene_data.h | 10 +++++----- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 90665a8a1e..bec3fe4ed5 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -387,7 +387,7 @@ void Scene202::enter() { } if (_globals[32]) - warning("TODO: sub1EB6E(_globals[32];"); + _scene->changeDepthSurface(_globals[32]); if (_scene->_priorSceneId == 201) { _game._player._playerPos = Common::Point(190, 91); @@ -811,7 +811,7 @@ void Scene202::actions() { _game._objects.addToInventory(OBJ_BONE); warning("TODO: Dialog::showPicture(OBJ_BONE, 0x4EFA, 0);"); } - warning("TODO: sub1EB6E(_globals[32];"); + _scene->changeDepthSurface(_globals[32]); _game._player._stepEnabled = true; _game._player._visible = true; } else { diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index ee5ff1f503..e01720f788 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -514,4 +514,10 @@ void Scene::free() { warning("TODO: Scene::free"); } +void Scene::changeDepthSurface(int arg1) { + _v1 = arg1; + _sceneInfo->loadCodes(_depthSurface, nullptr); + _spriteSlots.fullRefresh(); +} + } // End of namespace MADS diff --git a/engines/mads/scene.h b/engines/mads/scene.h index 16684c47a2..a51d820d1c 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -201,6 +201,9 @@ public: * Clear the data for the scene */ void free(); + + void changeDepthSurface(int arg1); + }; } // End of namespace MADS diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index d29d4e319a..8f03783460 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -163,11 +163,6 @@ protected: * Loads the given surface with depth information of a given scene */ virtual void loadCodes(MSurface &depthSurface) = 0; - - /** - * Loads the given surface with depth information of a given scene - */ - virtual void loadCodes(MSurface &depthSurface, Common::SeekableReadStream *stream) = 0; public: int _sceneId; int _artFileNum; @@ -206,6 +201,11 @@ public: * Set up a route node */ void setRouteNode(int nodeIndex, const Common::Point &pt, MSurface &depthSurface); + + /** + * Loads the given surface with depth information of a given scene + */ + virtual void loadCodes(MSurface &depthSurface, Common::SeekableReadStream *stream) = 0; }; } // End of namespace MADS -- cgit v1.2.3 From 74b48ba813b91e240be2f228faacc61be75011e6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 22 Mar 2014 14:43:08 -0400 Subject: MADS: Fixes for displaying kernel messages --- engines/mads/messages.cpp | 34 +++++++++++++--------------------- engines/mads/messages.h | 2 -- engines/mads/scene_data.cpp | 2 -- 3 files changed, 13 insertions(+), 25 deletions(-) diff --git a/engines/mads/messages.cpp b/engines/mads/messages.cpp index 6dde40bbda..be84739fc0 100644 --- a/engines/mads/messages.cpp +++ b/engines/mads/messages.cpp @@ -102,8 +102,6 @@ void KernelMessages::scrollMessage(int msgIndex, int numTicks, bool quoted) { _entries[msgIndex]._frameTimer2 = _vm->_game->_priorFrameTimer; Common::String msg = _entries[msgIndex]._msg; - _entries[msgIndex]._asciiChar = msg[0]; - _entries[msgIndex]._asciiChar2 = msg[1]; if (_entries[msgIndex]._flags & KMSG_PLAYER_TIMEOUT) _entries[msgIndex]._frameTimer2 = _vm->_game->_player._ticksAmount + @@ -125,8 +123,7 @@ void KernelMessages::remove(int msgIndex) { if (rec._flags & KMSG_ACTIVE) { if (rec._flags & KMSG_SCROLL) { - rec._msg.setChar(rec._asciiChar, rec._msgOffset); - rec._msg.setChar(rec._asciiChar2, rec._msgOffset + 1); + // WORKAROUND: Code here no longer needed in ScummVM } if (rec._textDisplayIndex >= 0) @@ -144,11 +141,12 @@ void KernelMessages::reset() { } void KernelMessages::update() { - uint32 currentTimer = _vm->_game->_priorFrameTimer; + uint32 currentTimer = _vm->_game->_scene._frameStartTime; - for (uint i = 0; i < _entries.size(); ++i) { - if (((_entries[i]._flags & KMSG_ACTIVE) != 0) && - (currentTimer >= _entries[i]._frameTimer)) + for (uint i = 0; i < _entries.size() && !_vm->_game->_abortTimers; ++i) { + KernelMessage &msg = _entries[i]; + + if (((msg._flags & KMSG_ACTIVE) != 0) && (currentTimer >= msg._frameTimer)) processText(i); } } @@ -222,27 +220,23 @@ void KernelMessages::processText(int msgIndex) { x1 += msg._position.x; y1 += msg._position.y; - if ((msg._flags & KMSG_SCROLL) && (msg._frameTimer >= currentTimer)) { - msg._msg.setChar(msg._asciiChar, msg._msgOffset); + Common::String displayMsg = msg._msg; + if ((msg._flags & KMSG_SCROLL) && (msg._frameTimer >= currentTimer)) { ++msg._msgOffset; - msg._msg.setChar(msg._asciiChar2, msg._msgOffset); - msg._asciiChar = msg._msg[msg._msgOffset]; - msg._asciiChar2 = !msg._asciiChar ? '\0' : msg._msg[msg._msgOffset + 1]; - if (!msg._asciiChar) { + if (msg._msgOffset >= msg._msg.size()) { // End of message msg._flags &= ~KMSG_SCROLL; - } else if (msg._flags & KMSG_QUOTED) { - msg._msg.setChar('"', msg._msgOffset); - msg._msg.setChar('\0', msg._msgOffset + 1); + } else { + displayMsg = Common::String(msg._msg.c_str(), msg._msg.c_str() + msg._msgOffset); } msg._frameTimer = msg._frameTimer2 = currentTimer + msg._numTicks; flag = true; } - int strWidth = _talkFont->getWidth(msg._msg, scene._textSpacing); + int strWidth = _talkFont->getWidth(displayMsg, scene._textSpacing); if (msg._flags & (KMSG_RIGHT_ALIGN | KMSG_CENTER_ALIGN)) { x1 -= (msg._flags & KMSG_CENTER_ALIGN) ? strWidth / 2 : strWidth; @@ -275,7 +269,7 @@ void KernelMessages::processText(int msgIndex) { if (msg._textDisplayIndex < 0) { // Need to create a new text display entry for this message int idx = scene._textDisplay.add(x1, y1, msg._color1 | (msg._color2 << 8), - scene._textSpacing, msg._msg, _talkFont); + scene._textSpacing, displayMsg, _talkFont); if (idx >= 0) msg._textDisplayIndex = idx; } @@ -298,8 +292,6 @@ void KernelMessages::setQuoted(int msgIndex, int numTicks, bool quoted) { msg._msgOffset = 0; msg._numTicks = numTicks; msg._frameTimer2 = _vm->_game->_scene._frameStartTime; - msg._asciiChar = msg._msg[0]; - msg._asciiChar2 = msg._msg[1]; if (msg._flags & KMSG_PLAYER_TIMEOUT) { msg._frameTimer2 = _vm->_game->_player._priorTimer + diff --git a/engines/mads/messages.h b/engines/mads/messages.h index 8fb75953f6..8ca9bc6f12 100644 --- a/engines/mads/messages.h +++ b/engines/mads/messages.h @@ -47,8 +47,6 @@ class KernelMessage { public: uint8 _flags; int _sequenceIndex; - char _asciiChar; - char _asciiChar2; int _color1; int _color2; Common::Point _position; diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index 625eec758e..a1f273459c 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -42,8 +42,6 @@ void SceneNode::load(Common::SeekableReadStream *f) { KernelMessage::KernelMessage() { _flags = 0; _sequenceIndex = 0; - _asciiChar = '\0'; - _asciiChar2 = '\0'; _color1 = 0; _color2 = 0; _msgOffset = 0; -- cgit v1.2.3 From 265fbce3dd086cb643b46b5f66790738d9f61bc3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 22 Mar 2014 20:46:51 +0100 Subject: MADS: Implement getTimeout() --- engines/mads/nebular/nebular_scenes2.cpp | 12 ++++++------ engines/mads/sequence.cpp | 13 +++++++++++++ engines/mads/sequence.h | 1 + 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index bec3fe4ed5..f9da681947 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -542,8 +542,8 @@ void Scene202::step() { _scene->_hotspots.activate(199, false); int idx = _scene->_dynamicHotspots.add(457, 13, _globals._spriteIndexes[20], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, 246, 124, 8); - warning("TODO: TimerList_getTimeout(_globals._spriteIndexes[26], _globals._spriteIndexes[20]);"); - warning("TODO: TimerList_getTimeout(-1, _globals._spriteIndexes[26]);"); + _scene->_sequences.getTimeout(_globals._spriteIndexes[26], _globals._spriteIndexes[20]); + _scene->_sequences.getTimeout(-1, _globals._spriteIndexes[26]); _game._player._stepEnabled = true; _game._player._visible = true; _globals._v4 = false; @@ -742,7 +742,7 @@ void Scene202::preActions() { _scene->_sequences.setDepth(_globals._spriteIndexes[23], 1); _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 1); } else if (_game._abortTimers == 1) { - warning("TODO: TimerList_getTimeout(-1, _globals._spriteIndexes[23]);"); + _scene->_sequences.getTimeout(-1, _globals._spriteIndexes[23]); warning("CHECKME: _scene->_dynamicHotspots.remove(_globals._frameTime);"); _scene->_dynamicHotspots.remove(_globals._frameTime); _game._player._visible = true; @@ -836,7 +836,7 @@ void Scene202::actions() { _globals._spriteIndexes[24] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, 1); _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(247, 82)); _scene->_sequences.setDepth(_globals._spriteIndexes[24], 1); - warning("TODO: TimerList_getTimeout(_globals._spriteIndexes[23], _globals._spriteIndexes[24]);"); + _scene->_sequences.getTimeout(_globals._spriteIndexes[23], _globals._spriteIndexes[24]); _globals._v4 = -1; _game._player._stepEnabled = true; int msgIndex = _scene->_kernelMessages.add(Common::Point(248, 15), 0x1110, 32, 0, 60, _game.getQuote(97)); @@ -854,7 +854,7 @@ void Scene202::actions() { _scene->_sequences.setAnimRange(_globals._spriteIndexes[25], 1, 6); _scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(172, 123)); _scene->_sequences.setDepth(_globals._spriteIndexes[25], 1); - warning("TODO: TimerList_getTimeout(-1, _globals._spriteIndexes[25]);"); + _scene->_sequences.getTimeout(-1, _globals._spriteIndexes[25]); _scene->_sequences.addSubEntry(_globals._spriteIndexes[25], SM_0, 0, 1); } else if (_game._abortTimers == 1) { _globals._spriteIndexes[25] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 6); @@ -877,7 +877,7 @@ void Scene202::actions() { _scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(172, 123)); _scene->_sequences.addSubEntry(_globals._spriteIndexes[25], SM_0, 0, 3); } else if (_game._abortTimers == 3) { - warning("TODO: TimerList_getTimeout(-1, _globals._spriteIndexes[25]);"); + _scene->_sequences.getTimeout(-1, _globals._spriteIndexes[25]); _game._player._stepEnabled = true; _game._player._visible = true; } else { diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index a03d0f839c..453d90b468 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -473,4 +473,17 @@ int SequenceList::startReverseCycle(int srcSpriteIndex, bool flipped, int numTic numTicks, 0, 0, true, 100, depth - 1, 1, ANIMTYPE_REVERSIBLE, 0, 0); } +void SequenceList::getTimeout(int spriteIdx, int arg2) { + int timeout; + if (spriteIdx >= 0) + timeout = _vm->_game->_scene._sequences._entries[spriteIdx]._timeout; + else + timeout = _vm->_game->_player._priorTimer + _vm->_game->_player._ticksAmount; + + if (arg2 >= 0) + _vm->_game->_scene._sequences._entries[arg2]._timeout = timeout; + else + _vm->_game->_player._priorTimer = timeout - _vm->_game->_player._ticksAmount; + +} } // End of namespace diff --git a/engines/mads/sequence.h b/engines/mads/sequence.h index f1b963a3dc..69059a9ad6 100644 --- a/engines/mads/sequence.h +++ b/engines/mads/sequence.h @@ -118,6 +118,7 @@ public: int startCycle(int srcSpriteIdx, bool flipped, int cycleIndex); int startReverseCycle(int srcSpriteIndex, bool flipped, int numTicks, int triggerCountdown, int timeoutTicks, int extraTicks); + void getTimeout(int spriteIdx, int arg2); }; } // End of namespace MADS -- cgit v1.2.3 From ef152fa2ba5d6e7040434415f5e472da3abc6c5f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 22 Mar 2014 15:55:50 -0400 Subject: MADS: Added _savedLookFlag to MADSAction --- engines/mads/action.cpp | 1 + engines/mads/action.h | 1 + engines/mads/nebular/nebular_scenes1.cpp | 5 +++++ 3 files changed, 7 insertions(+) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index 40ece8eb2b..52be8eabba 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -37,6 +37,7 @@ MADSAction::MADSAction(MADSEngine *vm) : _vm(vm) { _selectedAction = 0; _inProgress = false; _savedSelectedRow = false; + _savedLookFlag = false; } void MADSAction::clear() { diff --git a/engines/mads/action.h b/engines/mads/action.h index 440990f79e..04d9c3607a 100644 --- a/engines/mads/action.h +++ b/engines/mads/action.h @@ -88,6 +88,7 @@ public: MADSActionSavedFields _savedFields; bool _walkFlag; bool _savedSelectedRow; + bool _savedLookFlag; // Unknown fields int16 _v86F3A; diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 1ee1990cdd..d12c2d78d2 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -257,6 +257,11 @@ void Scene103::preActions() { } void Scene103::actions() { + if (_action._savedLookFlag) { + Dialog::show(0x2852); + } + + _action._inProgress = false; } void Scene103::postActions() { -- cgit v1.2.3 From db4e74f4dd1994bd468f78eca57800f9f3970b11 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 22 Mar 2014 21:20:39 +0100 Subject: MADS: Add _v8425C, set _globals._v7 as uint32 --- engines/mads/nebular/globals_nebular.h | 2 +- engines/mads/nebular/nebular_scenes2.cpp | 8 +++----- engines/mads/nebular/nebular_scenes8.cpp | 2 +- engines/mads/scene.cpp | 1 + engines/mads/scene.h | 1 + 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/engines/mads/nebular/globals_nebular.h b/engines/mads/nebular/globals_nebular.h index 8d9d009744..f7e28fc59a 100644 --- a/engines/mads/nebular/globals_nebular.h +++ b/engines/mads/nebular/globals_nebular.h @@ -44,7 +44,7 @@ public: int _v4; int _v5; int _v6; - int _v7; + uint32 _v7; int _v8; int _abortVal; public: diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index f9da681947..4acbe92475 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -418,8 +418,7 @@ void Scene202::enter() { _globals._v4 = 0; } - _globals._v7 = _scene->_frameStartTime; - warning("TODO: dword_8425C = _scene->_frameStartTime;"); + _game._scene._v8425C = _globals._v7 = _scene->_frameStartTime; if (_scene->_roomChanged) _game._objects.addToInventory(OBJ_NONE); @@ -484,7 +483,7 @@ void Scene202::step() { if (_game._abortTimers == 71) { _vm->_sound->command(3); _vm->_sound->command(9); - warning("TODO: dword_8425C = 900 + _scene->_frameStartTime;"); + _game._scene._v8425C = 900 + _scene->_frameStartTime; Common::Point msgPos; int msgFlag; if (_globals._v4 == 0) { @@ -555,8 +554,7 @@ void Scene202::step() { break; } - if (!_scene->_activeAnimation && (_globals[33] != 2) && (_globals._v7 <= _scene->_frameStartTime)) { - warning("TODO: && (dword_8425C <= _scene->_frameStartTime) {"); + if (!_scene->_activeAnimation && (_globals[33] != 2) && (_globals._v7 <= _scene->_frameStartTime) && (_game._scene._v8425C <= _scene->_frameStartTime)) { int randVal = _vm->getRandomNumber(499) + 1; int threshold = 1; if (_globals._v4) diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index 2aa65d90f0..dd86b56a65 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -290,7 +290,7 @@ void Scene804::step() { } if (_scene->_activeAnimation->getCurrentFrame() == 80 && !_globals._v7) { _vm->_sound->command(22); - _globals._v7 = -1; + _globals._v7 = 0xFFFFFFFF; } } diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index e01720f788..9ad494d07d 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -48,6 +48,7 @@ Scene::Scene(MADSEngine *vm): _vm(vm), _action(_vm), _depthSurface(vm), _activeAnimation = nullptr; _textSpacing = -1; _frameStartTime = 0; + _v8425C = 0; _layer = LAYER_GUI; _lookFlag = false; _highlightedHotspot = 0; diff --git a/engines/mads/scene.h b/engines/mads/scene.h index a51d820d1c..787c5e0951 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -117,6 +117,7 @@ public: int _destFacing; Common::Point _posAdjust; uint32 _frameStartTime; + uint32 _v8425C; Layer _layer; bool _lookFlag; int _highlightedHotspot; -- cgit v1.2.3 From eb82e63398c2050cbb72008cd849b8d1fda89c3e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 22 Mar 2014 21:45:28 +0100 Subject: MADS: make _msgOffset a uint32 --- engines/mads/messages.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/messages.h b/engines/mads/messages.h index 8ca9bc6f12..90269c12b5 100644 --- a/engines/mads/messages.h +++ b/engines/mads/messages.h @@ -51,7 +51,7 @@ public: int _color2; Common::Point _position; int _textDisplayIndex; - int _msgOffset; + uint32 _msgOffset; int _numTicks; uint32 _frameTimer2; uint32 _frameTimer; -- cgit v1.2.3 From c42e831817d3eef04f493c08cd288dfe41f764e6 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 22 Mar 2014 22:02:52 +0100 Subject: MADS: Introduce another getRandomNumber function with 2 parameters --- engines/mads/mads.cpp | 6 ++++++ engines/mads/mads.h | 1 + engines/mads/nebular/dialogs_nebular.cpp | 2 +- engines/mads/nebular/nebular_scenes2.cpp | 6 +++--- engines/mads/nebular/nebular_scenes8.cpp | 2 +- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index d6cd901a4c..68d8579dc4 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -107,6 +107,12 @@ int MADSEngine::getRandomNumber(int maxNumber) { return _randomSource.getRandomNumber(maxNumber); } +int MADSEngine::getRandomNumber(int minNumber, int maxNumber) { + int range = maxNumber - minNumber; + + return minNumber + _randomSource.getRandomNumber(range); +} + int MADSEngine::hypotenuse(int xv, int yv) { return (int)sqrt((double)(xv * xv + yv * yv)); } diff --git a/engines/mads/mads.h b/engines/mads/mads.h index e9da307bbf..cf8046f8f6 100644 --- a/engines/mads/mads.h +++ b/engines/mads/mads.h @@ -116,6 +116,7 @@ public: uint32 getGameFeatures() const; int getRandomNumber(int maxNumber); + int getRandomNumber(int minNumber, int maxNumber); int hypotenuse(int xv, int yv); }; diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp index dc74f39fe8..6dabbec1b9 100644 --- a/engines/mads/nebular/dialogs_nebular.cpp +++ b/engines/mads/nebular/dialogs_nebular.cpp @@ -90,7 +90,7 @@ bool CopyProtectionDialog::getHogAnusEntry(HOGANUS &entry) { // Read in the total number of entries, and randomly pick an entry to use int numEntries = f.readUint16LE(); - int entryIndex = _vm->getRandomNumber(numEntries - 2) + 1; + int entryIndex = _vm->getRandomNumber(1, numEntries); // Read in the encrypted entry f.seek(28 * entryIndex + 2); diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 4acbe92475..cc896c6015 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -462,7 +462,7 @@ void Scene202::enter() { } void Scene202::setRandomKernelMessage() { - int vocabId = 92 + _vm->getRandomNumber(4); + int vocabId = _vm->getRandomNumber(92, 96); _scene->_kernelMessages.reset(); _game._abortTimersMode2 = ABORTMODE_1; _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 70, 120, _game.getQuote(vocabId)); @@ -555,7 +555,7 @@ void Scene202::step() { } if (!_scene->_activeAnimation && (_globals[33] != 2) && (_globals._v7 <= _scene->_frameStartTime) && (_game._scene._v8425C <= _scene->_frameStartTime)) { - int randVal = _vm->getRandomNumber(499) + 1; + int randVal = _vm->getRandomNumber(1, 500); int threshold = 1; if (_globals._v4) threshold = 26; @@ -614,7 +614,7 @@ void Scene202::step() { // } warning("TODO: word84260 = _scene->_activeAnimation->getCurrentFrame();"); - int randVal = _vm->getRandomNumber(999) + 1; + int randVal = _vm->getRandomNumber(1, 1000); int frameStep = -1; switch (_scene->_activeAnimation->getCurrentFrame()) { diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index dd86b56a65..2a28edee1d 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -239,7 +239,7 @@ void Scene804::step() { switch (_scene->_activeAnimation->getCurrentFrame()) { case 1: - _globals[29] = _vm->getRandomNumber(29) + 1; + _globals[29] = _vm->getRandomNumber(1, 30); switch (_globals[29]) { case 1: _globals._v5 = 25; -- cgit v1.2.3 From 2ac614d898159096933df061c5c0bd221cf8d16b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 22 Mar 2014 22:30:45 +0100 Subject: MADS: Add some variables in / move a variable to _globals --- engines/mads/nebular/globals_nebular.cpp | 6 +++ engines/mads/nebular/globals_nebular.h | 2 + engines/mads/nebular/nebular_scenes2.cpp | 71 ++++++++++++++------------------ engines/mads/scene.cpp | 1 - engines/mads/scene.h | 1 - 5 files changed, 38 insertions(+), 43 deletions(-) diff --git a/engines/mads/nebular/globals_nebular.cpp b/engines/mads/nebular/globals_nebular.cpp index 31b7940d19..d2a82d50b0 100644 --- a/engines/mads/nebular/globals_nebular.cpp +++ b/engines/mads/nebular/globals_nebular.cpp @@ -44,6 +44,12 @@ Globals::Globals() { _v7 = 0; _v8 = 0; _abortVal = 0; + _v8425C = 0; + _v84260 = 0; + _v84262 = 0; + _v84264 = 0; + _v84266 = 0; + _v84268 = 0; } } // End of namespace Nebular diff --git a/engines/mads/nebular/globals_nebular.h b/engines/mads/nebular/globals_nebular.h index f7e28fc59a..bbc235307f 100644 --- a/engines/mads/nebular/globals_nebular.h +++ b/engines/mads/nebular/globals_nebular.h @@ -47,6 +47,8 @@ public: uint32 _v7; int _v8; int _abortVal; + uint32 _v8425C; + int _v84260, _v84262, _v84264, _v84266, _v84268; public: /** * Constructor diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index cc896c6015..503e0317af 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -418,7 +418,7 @@ void Scene202::enter() { _globals._v4 = 0; } - _game._scene._v8425C = _globals._v7 = _scene->_frameStartTime; + _globals._v8425C = _globals._v7 = _scene->_frameStartTime; if (_scene->_roomChanged) _game._objects.addToInventory(OBJ_NONE); @@ -483,7 +483,7 @@ void Scene202::step() { if (_game._abortTimers == 71) { _vm->_sound->command(3); _vm->_sound->command(9); - _game._scene._v8425C = 900 + _scene->_frameStartTime; + _globals._v8425C = 900 + _scene->_frameStartTime; Common::Point msgPos; int msgFlag; if (_globals._v4 == 0) { @@ -554,7 +554,7 @@ void Scene202::step() { break; } - if (!_scene->_activeAnimation && (_globals[33] != 2) && (_globals._v7 <= _scene->_frameStartTime) && (_game._scene._v8425C <= _scene->_frameStartTime)) { + if (!_scene->_activeAnimation && (_globals[33] != 2) && (_globals._v7 <= _scene->_frameStartTime) && (_globals._v8425C <= _scene->_frameStartTime)) { int randVal = _vm->getRandomNumber(1, 500); int threshold = 1; if (_globals._v4) @@ -564,13 +564,13 @@ void Scene202::step() { if (threshold >= randVal) { _vm->_sound->command(17); _scene->loadAnimation(formAnimName('M', -1), 71); - warning("TODO: word84266 = -1;"); - warning("TODO: word84268 = 0;"); + _globals._v84266 = -1; + _globals._v84268 = 0; _globals[37] = true; _globals._v6 = _scene->_frameStartTime; _globals._v8 = 0; - warning("TODO: _timerIndex = 0;"); - warning("TODO: word84264 = 0;"); + _globals._v84262 = 0; + _globals._v84264 = 0; _globals._v7 = _scene->_frameStartTime + 2; } } @@ -588,8 +588,7 @@ void Scene202::step() { } } - if (_scene->_activeAnimation->getCurrentFrame() == 160) { - warning("TODO: && (word84260 != _scene->_activeAnimation->getCurrentFrame()) {"); + if ((_scene->_activeAnimation->getCurrentFrame() == 160) && (_globals._v84260 != _scene->_activeAnimation->getCurrentFrame())) { Common::Point msgPos; int msgFlag; if (_globals._v4 == 0) { @@ -605,15 +604,14 @@ void Scene202::step() { } if (_globals._v7 + 7200 <= _scene->_frameStartTime) { - warning("TODO: word84268 = -1;"); + _globals._v84268 = -1; } - warning("TODO: if (_scene->_activeAnimation->getCurrentFrame() == word84260) {"); -// if (_scene->_activeAnimation->getCurrentFrame() == word84260) { -// return; -// } + if (_scene->_activeAnimation->getCurrentFrame() == _globals._v84260) { + return; + } - warning("TODO: word84260 = _scene->_activeAnimation->getCurrentFrame();"); + _globals._v84260 = _scene->_activeAnimation->getCurrentFrame(); int randVal = _vm->getRandomNumber(1, 1000); int frameStep = -1; @@ -636,18 +634,18 @@ void Scene202::step() { frameStep = subStep4(randVal); break; case 59: - warning("TODO: _timerIndex = 3;"); - warning("TODO: ++word84264;"); + _globals._v84262 = 3; + ++_globals._v84264; if (randVal <= 800) frameStep = 55; break; case 89: - warning("TODO: _timerIndex = 1;"); + _globals._v84262 = 1; if (randVal <= 700) frameStep = 83; break; case 137: - warning("TODO: _timerIndex = 2;"); + _globals._v84262 = 2; if (randVal <= 700) frameStep = 126; break; @@ -659,37 +657,32 @@ void Scene202::step() { int nextFrame = 1 + _scene->_activeAnimation->getCurrentFrame() - frameStep; if (nextFrame) { _scene->_activeAnimation->setCurrentFrame(nextFrame); - warning("word84260 = nextFrame"); + _globals._v84260 = nextFrame; } } int Scene202::subStep1(int randVal) { - warning("TODO: word84264 = 0;"); + _globals._v84264 = 0; - warning("TODO: if ((randVal <= 100) || (word84266 != 0))"); - if (randVal <= 100) + if ((randVal <= 100) || (_globals._v84266 != 0)) return 42; - warning("TODO: if ((randVal <= 200) || (word84268 != 0))"); - if (randVal <= 200) + if ((randVal <= 200) || (_globals._v84268 != 0)) return 96; - warning("TODO: if ((randVal <= 300) && (_timerIndex != 1))"); - if (randVal <= 300) + if ((randVal <= 300) && (_globals._v84262 != 1)) return 77; return 76; } int Scene202::subStep2(int randVal) { - warning("TODO: word84266 = 0;"); + _globals._v84266 = 0; - warning("TODO: if ((randVal <= 150) && (word84264 < 5)"); - if (randVal <= 150) + if ((randVal <= 150) && (_globals._v84264 < 5)) return 51; - warning("TODO: if ((randVal <= 300) || word84268)"); - if (randVal <= 300) + if ((randVal <= 300) || _globals._v84268) return 74; if (randVal <= 400) @@ -699,24 +692,20 @@ int Scene202::subStep2(int randVal) { } int Scene202::subStep3(int randVal) { - warning("TODO: if ((randVal <= 100) || (word84266 != 0))"); - if (randVal <= 100) + if ((randVal <= 100) || (_globals._v84266 != 0)) return 27; - warning("TODO: if ((randVal <= 200) || (word84268 != 0))"); - if (randVal <= 200) + if ((randVal <= 200) || (_globals._v84268 != 0)) return 159; - warning("TODO: if ((randVal <= 300) && (_timerIndex != 2))"); - if (randVal <= 300) + if ((randVal <= 300) && (_globals._v84262 != 2)) return 119; return 110; } int Scene202::subStep4(int randVal) { - warning("TODO: if ((randVal <= 100) || (word84268 != 0))"); - if (randVal <= 100) + if ((randVal <= 100) || (_globals._v84268 != 0)) return 176; if (randVal <= 200) @@ -884,7 +873,7 @@ void Scene202::actions() { } } else { if (_game._abortTimers == 0) { - warning("TODO: word_84268 = 1;"); + _globals._v84268 = 1; _game._player._stepEnabled = false; _scene->_sequences.remove(_globals._spriteIndexes[24]); _globals._spriteIndexes[24] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], true, 6, 1, 0, 0); diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 9ad494d07d..e01720f788 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -48,7 +48,6 @@ Scene::Scene(MADSEngine *vm): _vm(vm), _action(_vm), _depthSurface(vm), _activeAnimation = nullptr; _textSpacing = -1; _frameStartTime = 0; - _v8425C = 0; _layer = LAYER_GUI; _lookFlag = false; _highlightedHotspot = 0; diff --git a/engines/mads/scene.h b/engines/mads/scene.h index 787c5e0951..a51d820d1c 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -117,7 +117,6 @@ public: int _destFacing; Common::Point _posAdjust; uint32 _frameStartTime; - uint32 _v8425C; Layer _layer; bool _lookFlag; int _highlightedHotspot; -- cgit v1.2.3 From 83a8ec14717b8b3c8ec2dced8465905f8c1c233c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 22 Mar 2014 22:55:02 +0100 Subject: MADS: Add a stub for Dialog::showPicture() --- engines/mads/dialogs.h | 1 + engines/mads/nebular/dialogs_nebular.h | 3 +++ engines/mads/nebular/nebular_scenes2.cpp | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/engines/mads/dialogs.h b/engines/mads/dialogs.h index bec7f84976..b50d07f43c 100644 --- a/engines/mads/dialogs.h +++ b/engines/mads/dialogs.h @@ -193,6 +193,7 @@ public: virtual ~Dialogs() {} virtual void showDialog() = 0; + virtual void showPicture(int objId, int msgId, int arg3) = 0; }; } // End of namespace MADS diff --git a/engines/mads/nebular/dialogs_nebular.h b/engines/mads/nebular/dialogs_nebular.h index d4e4fe921e..c7b0e526a7 100644 --- a/engines/mads/nebular/dialogs_nebular.h +++ b/engines/mads/nebular/dialogs_nebular.h @@ -39,6 +39,9 @@ public: virtual void showDialog() { warning("TODO: showDialog"); } + virtual void showPicture(int objId, int msgId, int arg3) { + warning("TODO: showPicture"); + } }; struct HOGANUS { diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 503e0317af..3d88080e6e 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -793,10 +793,10 @@ void Scene202::actions() { if (_game._objects.isInInventory(OBJ_BONE)) { _game._objects.removeFromInventory(OBJ_BONE, 1); _game._objects.addToInventory(OBJ_BONES); - warning("TODO: Dialog::showPicture(OBJ_BONES, 0x4EFA, 0);"); + _vm->_dialogs->showPicture(OBJ_BONES, 0x4EFA, 0); } else { _game._objects.addToInventory(OBJ_BONE); - warning("TODO: Dialog::showPicture(OBJ_BONE, 0x4EFA, 0);"); + _vm->_dialogs->showPicture(OBJ_BONE, 0x4EFA, 0); } _scene->changeDepthSurface(_globals[32]); _game._player._stepEnabled = true; -- cgit v1.2.3 From a7c4fc7e234f604923aae0d08e03c6b8268688f4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 22 Mar 2014 18:26:41 -0400 Subject: MADS: In progress implementing ScreenObjects::elementHighlighted --- engines/mads/scene.cpp | 3 +- engines/mads/screen.cpp | 135 +++++++++++++++++++++++++++++++++++++++- engines/mads/screen.h | 6 +- engines/mads/user_interface.cpp | 46 ++++++++++++-- engines/mads/user_interface.h | 7 ++- 5 files changed, 185 insertions(+), 12 deletions(-) diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index e01720f788..e357f8b1ad 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -337,7 +337,8 @@ void Scene::doFrame() { CursorType cursorId = CURSOR_ARROW; if (_action._v83338 == 1 && !_vm->_game->_screenObjects._v7FECA && _vm->_game->_screenObjects._category == CAT_HOTSPOT) { - int idx = _vm->_game->_screenObjects._selectedObject - _vm->_game->_screenObjects._hotspotsIndex; + int idx = _vm->_game->_screenObjects._selectedObject - + _userInterface._categoryIndexes[CAT_HOTSPOT - 1]; assert(idx >= 0); if (idx >= (int)_hotspots.size()) { diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index 3565c1ac79..dac61d5bf1 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -262,7 +262,6 @@ ScreenObjects::ScreenObjects(MADSEngine *vm) : _vm(vm) { _newDescId = 0; _released = false; _uiCount = 0; - _hotspotsIndex = 0; _selectedObject = -1; _scrollerY = -1; _milliTime = 0; @@ -302,7 +301,7 @@ void ScreenObjects::check(bool scanFlag) { && scene._userInterface._category != CAT_NONE) { _released = true; if (category >= CAT_ACTION && category <= CAT_TALK_ENTRY) { - scene._userInterface.elementHighlighted(); + elementHighlighted(); } scene._action.checkActionAtMousePos(); @@ -314,7 +313,7 @@ void ScreenObjects::check(bool scanFlag) { if (!_vm->_events->_mouseButtons || _vm->_easyMouse) { if (category >= CAT_ACTION && category <= CAT_TALK_ENTRY) { - scene._userInterface.elementHighlighted(); + elementHighlighted(); } } @@ -448,6 +447,136 @@ void ScreenObjects::checkScroller() { _objectY = userInterface._objectY; } +void ScreenObjects::elementHighlighted() { + Scene &scene = _vm->_game->_scene; + UserInterface &userInterface = scene._userInterface; + Common::Array &invList = _vm->_game->_objects._inventoryList; + MADSAction &action = scene._action; + int varA; + int topIndex; + int *var6; + int var4; + int index, indexEnd; + int var8 = 0; + int uiCount; + + switch (userInterface._category) { + case CAT_ACTION: + index = 10; + indexEnd = 9; + varA = 5; + topIndex = 0; + var6 = !_v7FECA ? &userInterface._v1A : &userInterface._selectedActionIndex; + + if (_v7FECA && userInterface._selectedItemVocabIdx >= 0) + userInterface.drawInventory(3, -1, &userInterface._selectedItemVocabIdx); + + var4 = _released && !_v7FECA ? 1 : 0; + break; + + case CAT_INV_LIST: + userInterface.scrollInventory(); + + index = MIN((int)invList.size() - userInterface._inventoryTopIndex, 5); + indexEnd = invList.size() - 1; + varA = 0; + topIndex = userInterface._inventoryTopIndex; + var6 = &userInterface._v1C; + var4 = (!_released || (_vm->_events->_mouseButtons && action._v83338 == 1)) ? 0 : 1; + break; + + case CAT_INV_VOCAB: + if (userInterface._selectedInvIndex >= 0) { + InventoryObject &invObject = _vm->_game->_objects.getItem( + userInterface._selectedInvIndex); + index = invObject._vocabCount; + indexEnd = index - 1; + } else { + index = 0; + } + + varA = 0; + topIndex = 0; + var6 = _v7FECA ? &userInterface._selectedItemVocabIdx : &userInterface._v1E; + + if (_v7FECA && userInterface._selectedActionIndex >= 0) + userInterface.drawInventory(1, -1, &userInterface._selectedActionIndex); + + var4 = _released && !_v7FECA ? 1 : 0; + break; + + case CAT_INV_ANIM: + index = 1; + indexEnd = invList.size() - 1; + varA = 0; + topIndex = userInterface._selectedInvIndex; + var6 = &var8; + var4 = -1; + break; + + case CAT_TALK_ENTRY: + uiCount = size() - _uiCount; + index = scene._hotspots.size(); + indexEnd = index - 1; + varA = 0; + topIndex = 0; + var6 = &var8; + var4 = -1; + break; + + default: + index = 0; + for (int idx = 0; idx < 5; ++idx) { + if (!userInterface._talkStrings[idx].empty()) + ++index; + } + + indexEnd = index - 1; + varA = 0; + topIndex = 0; + var6 = &userInterface._v1A; + var4 = -1; + break; + } + + int newIndex = -1; + int catIndex = userInterface._categoryIndexes[userInterface._category - 1]; + int newY = 0; + int var1E = 0; + + for (int idx = 0; idx < index & newIndex < 0; ++idx) { + warning("TODO"); + } + + if (newIndex == -1 && index > 0 && !var4) { + if (_vm->_events->currentPos().y <= newY) { + newIndex = 0; + if (varA && _vm->_events->currentPos().x >= var1E) + newIndex = varA; + } else { + newIndex = index - 1; + } + } + + if (newIndex >= 0) + newIndex = MIN(newIndex + topIndex, indexEnd); + + _vm->_game->_scene._highlightedHotspot = newIndex; + + if (_category == CAT_INV_LIST || _category == CAT_INV_ANIM) { + if (action._v83338 == 1 && newIndex >= 0 && _released && + (!_vm->_events->_mouseReleased || !_vm->_easyMouse)) + newIndex = -1; + } + + if (_released && !_vm->_game->_screenObjects._v7FECA && + (_vm->_events->_mouseReleased || !_vm->_easyMouse)) + newIndex = -1; + + if (_category != CAT_HOTSPOT && _category != CAT_INV_ANIM) + userInterface.drawInventory(_category, newIndex, var6); +} + /*------------------------------------------------------------------------*/ ScreenSurface::ScreenSurface() { diff --git a/engines/mads/screen.h b/engines/mads/screen.h index c8534a0906..1d1e6d34f0 100644 --- a/engines/mads/screen.h +++ b/engines/mads/screen.h @@ -158,7 +158,6 @@ public: int _currentDescId; bool _released; int _uiCount; - int _hotspotsIndex; uint32 _milliTime; bool _eventFlag; @@ -175,6 +174,11 @@ public: /** */ void check(bool scanFlag); + + /** + * Handle element being highlighted on the screen + */ + void elementHighlighted(); }; class ScreenSurface : public MSurface { diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 4dba127d47..cae5c116d2 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -188,6 +188,8 @@ UserInterface::UserInterface(MADSEngine *vm) : _vm(vm), _dirtyAreas(vm), _uiSlots(vm) { _invSpritesIndex = -1; _invFrameNumber = 1; + _scrollMilli = 0; + _scrollFlag = false; _category = CAT_NONE; _inventoryTopIndex = 0; _objectY = 0; @@ -200,6 +202,7 @@ UserInterface::UserInterface(MADSEngine *vm) : _vm(vm), _dirtyAreas(vm), _v1E = -1; _dirtyAreas.resize(50); _inventoryChanged = false; + Common::fill(&_categoryIndexes[0], &_categoryIndexes[7], 0); // Map the user interface to the bottom of the game's screen surface byte *pData = _vm->_screen.getBasePtr(0, MADS_SCENE_HEIGHT); @@ -272,10 +275,6 @@ void UserInterface::setup(int id) { scene._dynamicHotspots.refresh(); } -void UserInterface::elementHighlighted() { - warning("TODO: UserInterface::elementHighlighted"); -} - void UserInterface::drawTextElements() { if (_vm->_game->_screenObjects._v832EC) { drawTalkList(); @@ -415,6 +414,7 @@ void UserInterface::loadElements() { } // Set up actions + _categoryIndexes[CAT_ACTION - 1] = _vm->_game->_screenObjects.size() + 1; for (int idx = 0; idx < 10; ++idx) { getBounds(CAT_ACTION, idx, bounds); moveRect(bounds); @@ -423,6 +423,7 @@ void UserInterface::loadElements() { } // Set up inventory list + _categoryIndexes[CAT_INV_LIST - 1] = _vm->_game->_screenObjects.size() + 1; for (int idx = 0; idx < 5; ++idx) { getBounds(CAT_INV_LIST, idx, bounds); moveRect(bounds); @@ -431,6 +432,7 @@ void UserInterface::loadElements() { } // Set up the inventory vocab list + _categoryIndexes[CAT_INV_VOCAB - 1] = _vm->_game->_screenObjects.size() + 1; for (int idx = 0; idx < 5; ++idx) { getBounds(CAT_INV_VOCAB, idx, bounds); moveRect(bounds); @@ -439,12 +441,13 @@ void UserInterface::loadElements() { } // Set up the inventory item picture + _categoryIndexes[CAT_INV_ANIM - 1] = _vm->_game->_screenObjects.size() + 1; _vm->_game->_screenObjects.add(Common::Rect(160, 159, 231, 194), LAYER_GUI, CAT_INV_ANIM, 0); } if (!_vm->_game->_screenObjects._v832EC || _vm->_game->_screenObjects._v832EC == 2) { - _vm->_game->_screenObjects._hotspotsIndex = _vm->_game->_screenObjects.size(); + _categoryIndexes[CAT_HOTSPOT - 1] = _vm->_game->_screenObjects.size(); for (int hotspotIdx = scene._hotspots.size() - 1; hotspotIdx >= 0; --hotspotIdx) { Hotspot &hs = scene._hotspots[hotspotIdx]; _vm->_game->_screenObjects.add(hs._bounds, LAYER_GUI, CAT_HOTSPOT, hotspotIdx); @@ -453,6 +456,7 @@ void UserInterface::loadElements() { if (_vm->_game->_screenObjects._v832EC == 1) { // setup areas for talk entries + _categoryIndexes[CAT_TALK_ENTRY - 1] = _vm->_game->_screenObjects.size() + 1; for (int idx = 0; idx < 5; ++idx) { getBounds(CAT_TALK_ENTRY, idx, bounds); moveRect(bounds); @@ -644,4 +648,36 @@ void UserInterface::scrollerChanged() { warning("TODO: scrollerChanged"); } +void UserInterface::scrollInventory() { + Common::Array &invList = _vm->_game->_objects._inventoryList; + + if (_vm->_events->_mouseButtons) { + int yp = _vm->_events->currentPos().y; + if (yp < MADS_SCENE_HEIGHT || yp == (MADS_SCREEN_HEIGHT - 1)) { + uint32 timeDiff = _scrollFlag ? 100 : 380; + uint32 currentMilli = g_system->getMillis(); + _vm->_game->_screenObjects._v8332A = -1; + + if (currentMilli >= (_scrollMilli + timeDiff)) { + _scrollMilli = currentMilli; + _scrollFlag = true; + + if (yp == (MADS_SCREEN_HEIGHT - 1)) { + if (_inventoryTopIndex < (invList.size() - 1)) { + ++_inventoryTopIndex; + _inventoryChanged = true; + } + } else { + if (_inventoryTopIndex > 0) { + --_inventoryTopIndex; + _inventoryChanged = true; + } + } + } + } + } + + _vm->_game->_screenObjects._v8332A = 0; +} + } // End of namespace MADS diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h index 06f1e70975..abb4619cf5 100644 --- a/engines/mads/user_interface.h +++ b/engines/mads/user_interface.h @@ -79,6 +79,8 @@ private: MADSEngine *_vm; int _invSpritesIndex; int _invFrameNumber; + uint32 _scrollMilli; + bool _scrollFlag; /** * Loads the elements of the user interface @@ -143,6 +145,7 @@ public: int _v1C; int _v1E; bool _inventoryChanged; + int _categoryIndexes[8]; Common::StringArray _talkStrings; Common::Array _talkIds; public: @@ -161,8 +164,6 @@ public: */ void setup(int id); - void elementHighlighted(); - void drawTextElements(); void setBounds(const Common::Rect &r); @@ -193,6 +194,8 @@ public: void drawInventory(int v1, int v2, int *v3); void scrollerChanged(); + + void scrollInventory(); }; } // End of namespace MADS -- cgit v1.2.3 From c64a024aa07d64ab821514f1c82f51fe33c1af0d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 22 Mar 2014 19:09:25 -0400 Subject: MADS: Completed elementHighlighted method --- engines/mads/screen.cpp | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index dac61d5bf1..0fc231822c 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -541,17 +541,41 @@ void ScreenObjects::elementHighlighted() { int newIndex = -1; int catIndex = userInterface._categoryIndexes[userInterface._category - 1]; - int newY = 0; - int var1E = 0; + int newX = 0, newY = 0; + Common::Point currentPos = _vm->_events->currentPos(); for (int idx = 0; idx < index & newIndex < 0; ++idx) { - warning("TODO"); + int scrObjIndex = (_category == CAT_HOTSPOT) ? catIndex - idx + index - 1 : + catIndex + idx; + + ScreenObject &scrObject = (*this)[scrObjIndex]; + Common::Rect bounds = scrObject._bounds; + newY = MAX((int)bounds.bottom, newY); + newX = MAX((int)bounds.left, newX); + + if (currentPos.y > newY && currentPos.y < bounds.bottom) { + if (var4) { + if (currentPos.x > newX && currentPos.x < bounds.right) { + newIndex = scrObjIndex - catIndex; + if (_category == CAT_HOTSPOT && newIndex < scene._hotspots.size()) + newIndex = scene._hotspots.size() - newIndex - 1; + } + } else if (!varA) { + newIndex = idx; + } else if (varA <= idx) { + if (currentPos.x > bounds.left) + newIndex = idx; + } else { + if (currentPos.x > bounds.right) + newIndex = idx; + } + } } if (newIndex == -1 && index > 0 && !var4) { if (_vm->_events->currentPos().y <= newY) { newIndex = 0; - if (varA && _vm->_events->currentPos().x >= var1E) + if (varA && _vm->_events->currentPos().x >= newX) newIndex = varA; } else { newIndex = index - 1; -- cgit v1.2.3 From 06766e930b3c6a858d6dccced7845eeec44708f7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 22 Mar 2014 20:02:02 -0400 Subject: MADS: Fix main switch statement in elementHighlighted --- engines/mads/screen.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index 0fc231822c..d191f49f14 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -282,6 +282,7 @@ void ScreenObjects::add(const Common::Rect &bounds, Layer layer, ScrCategory cat void ScreenObjects::check(bool scanFlag) { Scene &scene = _vm->_game->_scene; + UserInterface &userInterface = scene._userInterface; if (!_vm->_events->_mouseButtons || _v832EC) _v7FECA = false; @@ -312,7 +313,7 @@ void ScreenObjects::check(bool scanFlag) { scene._userInterface._category = _category; if (!_vm->_events->_mouseButtons || _vm->_easyMouse) { - if (category >= CAT_ACTION && category <= CAT_TALK_ENTRY) { + if (userInterface._category >= CAT_ACTION && userInterface._category <= CAT_TALK_ENTRY) { elementHighlighted(); } } @@ -339,7 +340,6 @@ void ScreenObjects::check(bool scanFlag) { scene._action.refresh(); - UserInterface &userInterface = _vm->_game->_scene._userInterface; uint32 currentTicks = _vm->_events->getFrameCounter(); if (currentTicks >= _vm->_game->_ticksExpiry) { // Check the user interface slots to see if there's any slots that need to be expired @@ -456,12 +456,13 @@ void ScreenObjects::elementHighlighted() { int topIndex; int *var6; int var4; - int index, indexEnd; + int index; + int indexEnd = -1; int var8 = 0; int uiCount; switch (userInterface._category) { - case CAT_ACTION: + case CAT_INV_LIST: index = 10; indexEnd = 9; varA = 5; @@ -474,7 +475,7 @@ void ScreenObjects::elementHighlighted() { var4 = _released && !_v7FECA ? 1 : 0; break; - case CAT_INV_LIST: + case CAT_INV_VOCAB: userInterface.scrollInventory(); index = MIN((int)invList.size() - userInterface._inventoryTopIndex, 5); @@ -485,7 +486,7 @@ void ScreenObjects::elementHighlighted() { var4 = (!_released || (_vm->_events->_mouseButtons && action._v83338 == 1)) ? 0 : 1; break; - case CAT_INV_VOCAB: + case CAT_HOTSPOT: if (userInterface._selectedInvIndex >= 0) { InventoryObject &invObject = _vm->_game->_objects.getItem( userInterface._selectedInvIndex); @@ -505,7 +506,7 @@ void ScreenObjects::elementHighlighted() { var4 = _released && !_v7FECA ? 1 : 0; break; - case CAT_INV_ANIM: + case CAT_TALK_ENTRY: index = 1; indexEnd = invList.size() - 1; varA = 0; @@ -514,7 +515,7 @@ void ScreenObjects::elementHighlighted() { var4 = -1; break; - case CAT_TALK_ENTRY: + case CAT_INV_SCROLLER: uiCount = size() - _uiCount; index = scene._hotspots.size(); indexEnd = index - 1; @@ -544,7 +545,7 @@ void ScreenObjects::elementHighlighted() { int newX = 0, newY = 0; Common::Point currentPos = _vm->_events->currentPos(); - for (int idx = 0; idx < index & newIndex < 0; ++idx) { + for (int idx = 0; idx < index && newIndex < 0; ++idx) { int scrObjIndex = (_category == CAT_HOTSPOT) ? catIndex - idx + index - 1 : catIndex + idx; @@ -557,7 +558,7 @@ void ScreenObjects::elementHighlighted() { if (var4) { if (currentPos.x > newX && currentPos.x < bounds.right) { newIndex = scrObjIndex - catIndex; - if (_category == CAT_HOTSPOT && newIndex < scene._hotspots.size()) + if (_category == CAT_HOTSPOT && newIndex < (int)scene._hotspots.size()) newIndex = scene._hotspots.size() - newIndex - 1; } } else if (!varA) { -- cgit v1.2.3 From 0b351f79d8ad874ce07fed54eb745a277da28edc Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 22 Mar 2014 21:55:36 -0400 Subject: MADS: Further fixes for hotspot highlighting --- engines/mads/font.cpp | 19 +++++++++----- engines/mads/hotspots.cpp | 36 +++++++++++++++++++++++-- engines/mads/hotspots.h | 11 ++++++-- engines/mads/scene.cpp | 4 +-- engines/mads/scene_data.cpp | 25 ------------------ engines/mads/screen.cpp | 58 +++++++++++++++++++++++++---------------- engines/mads/screen.h | 18 +++++++++++++ engines/mads/user_interface.cpp | 2 +- 8 files changed, 112 insertions(+), 61 deletions(-) diff --git a/engines/mads/font.cpp b/engines/mads/font.cpp index ed7542d2e5..e3497b3b14 100644 --- a/engines/mads/font.cpp +++ b/engines/mads/font.cpp @@ -136,13 +136,14 @@ void Font::setColorMode(int mode) { int Font::writeString(MSurface *surface, const Common::String &msg, const Common::Point &pt, int spaceWidth, int width) { + int xEnd; if (width > 0) - width = MIN((int)surface->w, pt.x + width); + xEnd = MIN((int)surface->w, pt.x + width); else - width = surface->w - pt.x; + xEnd = surface->w - pt.x; - int x = pt.x + 1; - int y = pt.y + 1; + int x = pt.x; + int y = pt.y; int skipY = 0; if (y < 0) { @@ -174,7 +175,7 @@ int Font::writeString(MSurface *surface, const Common::String &msg, const Common if (charWidth > 0) { - if (xPos + charWidth >= width) + if (xPos + charWidth > xEnd) return xPos; uint8 *charData = &_charData[_charOffs[(byte)theChar]]; @@ -221,8 +222,12 @@ int Font::getWidth(const Common::String &msg, int spaceWidth) { int width = 0; const char *text = msg.c_str(); - while (*text) - width += _charWidths[*text++ & 0x7F] + spaceWidth; + if (msg.size() > 0) { + while (*text) + width += _charWidths[*text++ & 0x7F] + spaceWidth; + width -= spaceWidth; + } + return width; } diff --git a/engines/mads/hotspots.cpp b/engines/mads/hotspots.cpp index 4356e787d6..e082a1e3ce 100644 --- a/engines/mads/hotspots.cpp +++ b/engines/mads/hotspots.cpp @@ -146,8 +146,40 @@ void DynamicHotspots::refresh() { /*------------------------------------------------------------------------*/ -void Hotspots::activate(int hotspotId, bool active) { - warning("TODO: Hotspots::activate"); +Hotspot::Hotspot() { + _facing = 0; + _articleNumber = 0; + _cursor = CURSOR_NONE; + _vocabId = 0; + _verbId = 0; + _active = false; +} + +Hotspot::Hotspot(Common::SeekableReadStream &f) { + _bounds.left = f.readSint16LE(); + _bounds.top = f.readSint16LE(); + _bounds.right = f.readSint16LE(); + _bounds.bottom = f.readSint16LE(); + _feetPos.x = f.readSint16LE(); + _feetPos.y = f.readSint16LE(); + _facing = f.readByte(); + _articleNumber = f.readByte(); + _active = f.readByte() != 0; + _cursor = (CursorType)f.readByte(); + _vocabId = f.readUint16LE(); + _verbId = f.readUint16LE(); +} + +/*------------------------------------------------------------------------*/ + +void Hotspots::activate(int vocabId, bool active) { + for (uint idx = 0; idx < size(); ++idx) { + Hotspot &hotspot = (*this)[idx]; + if (hotspot._vocabId == vocabId) { + hotspot._active = active; + _vm->_game->_screenObjects.setActive(CAT_HOTSPOT, idx, active); + } + } } } // End of namespace MADS diff --git a/engines/mads/hotspots.h b/engines/mads/hotspots.h index ed18fbf252..a53b86d880 100644 --- a/engines/mads/hotspots.h +++ b/engines/mads/hotspots.h @@ -30,7 +30,6 @@ namespace MADS { class MADSEngine; - class DynamicHotspot { public: bool _active; @@ -74,6 +73,7 @@ public: Common::Point _feetPos; int _facing; int _articleNumber; + bool _active; CursorType _cursor; int _vocabId; int _verbId; @@ -83,8 +83,15 @@ public: }; class Hotspots : public Common::Array { +private: + MADSEngine *_vm; public: - void activate(int hotspotId, bool active); + Hotspots(MADSEngine *vm) : _vm(vm) {} + + /** + * Sets the active state of a given hotspot + */ + void activate(int vocabId, bool active); }; } // End of namespace MADS diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index e357f8b1ad..da64def95d 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -29,8 +29,8 @@ namespace MADS { Scene::Scene(MADSEngine *vm): _vm(vm), _action(_vm), _depthSurface(vm), - _dirtyAreas(_vm), _dynamicHotspots(vm), _kernelMessages(vm), - _sequences(vm), _sprites(vm), _spriteSlots(vm), + _dirtyAreas(_vm), _dynamicHotspots(vm), _hotspots(vm), + _kernelMessages(vm), _sequences(vm), _sprites(vm), _spriteSlots(vm), _textDisplay(vm), _userInterface(vm) { _priorSceneId = 0; _nextSceneId = 0; diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index a1f273459c..712d065fb9 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -58,31 +58,6 @@ KernelMessage::KernelMessage() { /*------------------------------------------------------------------------*/ -Hotspot::Hotspot() { - _facing = 0; - _articleNumber = 0; - _cursor = CURSOR_NONE; - _vocabId = 0; - _verbId = 0; -} - -Hotspot::Hotspot(Common::SeekableReadStream &f) { - _bounds.left = f.readSint16LE(); - _bounds.top = f.readSint16LE(); - _bounds.right = f.readSint16LE(); - _bounds.bottom = f.readSint16LE(); - _feetPos.x = f.readSint16LE(); - _feetPos.y = f.readSint16LE(); - _facing = f.readByte(); - _articleNumber = f.readByte(); - f.skip(1); - _cursor = (CursorType)f.readByte(); - _vocabId = f.readUint16LE(); - _verbId = f.readUint16LE(); -} - -/*------------------------------------------------------------------------*/ - void ARTHeader::load(Common::SeekableReadStream *f) { // Read in dimensions of image _width = f->readUint16LE(); diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index d191f49f14..22896e011b 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -276,6 +276,7 @@ void ScreenObjects::add(const Common::Rect &bounds, Layer layer, ScrCategory cat so._category = category; so._descId = descId; so._layer = layer; + so._active = true; push_back(so); } @@ -361,9 +362,10 @@ void ScreenObjects::check(bool scanFlag) { } int ScreenObjects::scanBackwards(const Common::Point &pt, int layer) { - for (int i = (int)size() - 1; i >= 0; --i) { - if ((*this)[i]._bounds.contains(pt) && ((*this)[i]._layer == layer)) - return i + 1; + for (int i = (int)size(); i >= 1; --i) { + ScreenObject &sObj = (*this)[i]; + if (sObj._active && sObj._bounds.contains(pt) && sObj._layer == layer) + return i; } // Entry not found @@ -462,7 +464,7 @@ void ScreenObjects::elementHighlighted() { int uiCount; switch (userInterface._category) { - case CAT_INV_LIST: + case CAT_ACTION: index = 10; indexEnd = 9; varA = 5; @@ -475,7 +477,7 @@ void ScreenObjects::elementHighlighted() { var4 = _released && !_v7FECA ? 1 : 0; break; - case CAT_INV_VOCAB: + case CAT_INV_LIST: userInterface.scrollInventory(); index = MIN((int)invList.size() - userInterface._inventoryTopIndex, 5); @@ -486,7 +488,7 @@ void ScreenObjects::elementHighlighted() { var4 = (!_released || (_vm->_events->_mouseButtons && action._v83338 == 1)) ? 0 : 1; break; - case CAT_HOTSPOT: + case CAT_INV_VOCAB: if (userInterface._selectedInvIndex >= 0) { InventoryObject &invObject = _vm->_game->_objects.getItem( userInterface._selectedInvIndex); @@ -506,7 +508,7 @@ void ScreenObjects::elementHighlighted() { var4 = _released && !_v7FECA ? 1 : 0; break; - case CAT_TALK_ENTRY: + case CAT_INV_ANIM: index = 1; indexEnd = invList.size() - 1; varA = 0; @@ -515,17 +517,7 @@ void ScreenObjects::elementHighlighted() { var4 = -1; break; - case CAT_INV_SCROLLER: - uiCount = size() - _uiCount; - index = scene._hotspots.size(); - indexEnd = index - 1; - varA = 0; - topIndex = 0; - var6 = &var8; - var4 = -1; - break; - - default: + case CAT_TALK_ENTRY: index = 0; for (int idx = 0; idx < 5; ++idx) { if (!userInterface._talkStrings[idx].empty()) @@ -538,6 +530,16 @@ void ScreenObjects::elementHighlighted() { var6 = &userInterface._v1A; var4 = -1; break; + + default: + uiCount = size() - _uiCount; + index = scene._hotspots.size(); + indexEnd = index - 1; + varA = 0; + topIndex = 0; + var6 = &var8; + var4 = -1; + break; } int newIndex = -1; @@ -548,15 +550,19 @@ void ScreenObjects::elementHighlighted() { for (int idx = 0; idx < index && newIndex < 0; ++idx) { int scrObjIndex = (_category == CAT_HOTSPOT) ? catIndex - idx + index - 1 : catIndex + idx; - + ScreenObject &scrObject = (*this)[scrObjIndex]; - Common::Rect bounds = scrObject._bounds; + if (!scrObject._active) + continue; + + const Common::Rect &bounds = scrObject._bounds; newY = MAX((int)bounds.bottom, newY); newX = MAX((int)bounds.left, newX); - if (currentPos.y > newY && currentPos.y < bounds.bottom) { + if (currentPos.y >= bounds.top && currentPos.y < bounds.bottom) { if (var4) { - if (currentPos.x > newX && currentPos.x < bounds.right) { + if (currentPos.x >= bounds.left && currentPos.x < bounds.right) { + // Cursor is inside hotspot bounds newIndex = scrObjIndex - catIndex; if (_category == CAT_HOTSPOT && newIndex < (int)scene._hotspots.size()) newIndex = scene._hotspots.size() - newIndex - 1; @@ -602,6 +608,14 @@ void ScreenObjects::elementHighlighted() { userInterface.drawInventory(_category, newIndex, var6); } +void ScreenObjects::setActive(ScrCategory category, int descId, bool active) { + for (uint idx = 1; idx < size(); ++idx) { + ScreenObject &sObj = (*this)[idx]; + if (sObj._category == category && sObj._descId == descId) + sObj._active = active; + } +} + /*------------------------------------------------------------------------*/ ScreenSurface::ScreenSurface() { diff --git a/engines/mads/screen.h b/engines/mads/screen.h index 1d1e6d34f0..7fa5722e18 100644 --- a/engines/mads/screen.h +++ b/engines/mads/screen.h @@ -125,6 +125,7 @@ public: class ScreenObject { public: + bool _active; Common::Rect _bounds; ScrCategory _category; int _descId; @@ -179,6 +180,23 @@ public: * Handle element being highlighted on the screen */ void elementHighlighted(); + + /** + * Retrieve a ScreenObject from the list + * @remarks This array is 1-based indexed by the game + */ + ScreenObject &operator[](int idx) { + assert(idx > 0); + return Common::Array::operator[](idx - 1); + } + + /** + * Sets an item identified by category and Desc Id as active or not + * @param category Screen category + * @param descId Description for item + * @param active Whether to set item as active or not + */ + void setActive(ScrCategory category, int descId, bool active); }; class ScreenSurface : public MSurface { diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index cae5c116d2..4a35d24ad0 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -447,7 +447,7 @@ void UserInterface::loadElements() { } if (!_vm->_game->_screenObjects._v832EC || _vm->_game->_screenObjects._v832EC == 2) { - _categoryIndexes[CAT_HOTSPOT - 1] = _vm->_game->_screenObjects.size(); + _categoryIndexes[CAT_HOTSPOT - 1] = _vm->_game->_screenObjects.size() + 1; for (int hotspotIdx = scene._hotspots.size() - 1; hotspotIdx >= 0; --hotspotIdx) { Hotspot &hs = scene._hotspots[hotspotIdx]; _vm->_game->_screenObjects.add(hs._bounds, LAYER_GUI, CAT_HOTSPOT, hotspotIdx); -- cgit v1.2.3 From 8dd9dab76c2290a33289ffcc1e1a5582c9550bb4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 23 Mar 2014 11:34:12 +0100 Subject: MADS: Implement Sequence::setScale and GameNebular::sub71312. --- engines/mads/nebular/game_nebular.cpp | 8 ++++++++ engines/mads/nebular/game_nebular.h | 2 ++ engines/mads/sequence.cpp | 8 ++++++-- engines/mads/sequence.h | 1 + 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index e5c344b738..52e8913eb3 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -194,6 +194,14 @@ void GameNebular::checkShowDialog() { } } +void GameNebular::sub71312(int idx) { + int yp = _player._playerPos.y + (_player._yScale * _player._currentScale) / 100; + _scene._sequences.setMsgPosition(idx, Common::Point(_player._playerPos.x, yp)); + _scene._sequences.setDepth(idx, _player._currentDepth); + _scene._sequences.setScale(idx, _player._currentScale); + _scene._sequences.getTimeout(-1, idx); +} + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/game_nebular.h b/engines/mads/nebular/game_nebular.h index 685e5c7cd6..0197766b8f 100644 --- a/engines/mads/nebular/game_nebular.h +++ b/engines/mads/nebular/game_nebular.h @@ -65,6 +65,8 @@ protected: public: Globals _globals; StoryMode _storyMode; + + void sub71312(int idx); }; diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index 453d90b468..53ed02a566 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -476,14 +476,18 @@ int SequenceList::startReverseCycle(int srcSpriteIndex, bool flipped, int numTic void SequenceList::getTimeout(int spriteIdx, int arg2) { int timeout; if (spriteIdx >= 0) - timeout = _vm->_game->_scene._sequences._entries[spriteIdx]._timeout; + timeout = _entries[spriteIdx]._timeout; else timeout = _vm->_game->_player._priorTimer + _vm->_game->_player._ticksAmount; if (arg2 >= 0) - _vm->_game->_scene._sequences._entries[arg2]._timeout = timeout; + _entries[arg2]._timeout = timeout; else _vm->_game->_player._priorTimer = timeout - _vm->_game->_player._ticksAmount; } + +void SequenceList::setScale(int spriteIdx, int scale) { + _entries[spriteIdx]._scale = scale; +} } // End of namespace diff --git a/engines/mads/sequence.h b/engines/mads/sequence.h index 69059a9ad6..9ff34ab34d 100644 --- a/engines/mads/sequence.h +++ b/engines/mads/sequence.h @@ -119,6 +119,7 @@ public: int startReverseCycle(int srcSpriteIndex, bool flipped, int numTicks, int triggerCountdown, int timeoutTicks, int extraTicks); void getTimeout(int spriteIdx, int arg2); + void setScale(int spriteIdx, int scale); }; } // End of namespace MADS -- cgit v1.2.3 From 6fed5933a84421f413daeb0983281381acc7c128 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 23 Mar 2014 11:34:50 +0100 Subject: MADS: Implement and get rid of two warnings --- engines/mads/nebular/nebular_scenes2.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 3d88080e6e..458cd1d844 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -777,7 +777,7 @@ void Scene202::actions() { _game._player._stepEnabled = false; _game._player._visible = false; _globals._spriteIndexes[22] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[6], false, 3, 2, 0, 0); - warning("TODO: sub71312"); + _game.sub71312(_globals._spriteIndexes[22]); _scene->_sequences.addSubEntry(_globals._spriteIndexes[22], SM_FRAME_INDEX, 6, 1); _scene->_sequences.addSubEntry(_globals._spriteIndexes[22], SM_0, 0, 2); } @@ -809,7 +809,7 @@ void Scene202::actions() { } else if ((action->isAction(0x50, 0xC7, 0)) && (_globals[31] == 0)) { if (_game._abortTimers == 0) { _vm->_sound->command(29); - warning("TODO: word_8425E = _scene->_frameStartTime;"); + _globals._v8425C = _scene->_frameStartTime; _game._player._visible = false; _game._player._stepEnabled = false; -- cgit v1.2.3 From 0d158075019940ccf25b4e5b9bd4676e9a06f87d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 23 Mar 2014 09:19:28 -0400 Subject: MADS: Fixes for animating inventory item --- engines/mads/game.cpp | 3 +++ engines/mads/scene.cpp | 2 +- engines/mads/screen.cpp | 8 ++++---- engines/mads/user_interface.cpp | 12 +++++++----- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 60481c69e4..4b907d1880 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -63,6 +63,9 @@ Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm), // Load the inventory object list _objects.load(); + if (_objects._inventoryList.size() > 0) + // At least one item in default inventory, so select first item for display + _scene._userInterface._selectedInvIndex = 0; // Load the quotes loadQuotes(); diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index da64def95d..cfdfa87c61 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -386,7 +386,7 @@ void Scene::doFrame() { _kernelMessages.update(); } - _userInterface._uiSlots.draw(_vm->_game->_abortTimers2 == kTransitionFadeIn, + _userInterface._uiSlots.draw(_vm->_game->_abortTimers2 == 0, _vm->_game->_abortTimers2 != 0); // Write any text needed by the interface diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index 22896e011b..964e83630c 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -120,8 +120,8 @@ void DirtyArea::setUISlot(const UISlot *slot) { int type = slot->_slotType; if (type <= -20) type += 20; - if (type >= 64) - type &= 0xBF; + if (type >= 0x40) + type &= ~0x40; MSurface &intSurface = _vm->_game->_scene._userInterface; switch (type) { @@ -148,7 +148,7 @@ void DirtyArea::setUISlot(const UISlot *slot) { _bounds.top = slot->_position.y; } else { _bounds.left = slot->_position.x + w / 2; - _bounds.top = slot->_position.y + h / 2; + _bounds.top = slot->_position.y - h + 1; } setArea(w, h, intSurface.w, intSurface.h); @@ -182,7 +182,7 @@ void DirtyAreas::merge(int startIndex, int count) { continue; if ((*this)[outerCtr]._textActive && (*this)[innerCtr]._textActive) - mergeAreas(outerCtr, innerCtr); + mergeAreas(innerCtr, outerCtr); } } } diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 4a35d24ad0..2ea656d0c5 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -125,7 +125,7 @@ void UISlots::draw(bool updateFlag, bool delFlag) { if (slot._slotType >= ST_NONE && !(slot._slotType & 0x40)) { if (!dirtyArea._active) { - error("TODO: Original code here doesn't make sense!"); + error("Should never reach this point, even in original"); } if (dirtyArea._textActive) { @@ -133,10 +133,12 @@ void UISlots::draw(bool updateFlag, bool delFlag) { if (slot._field2 == 200) { MSprite *sprite = asset->getFrame(slot._frameNumber & 0x7F); - sprite->copyTo(&userInterface, slot._position); + sprite->copyTo(&userInterface, slot._position, + sprite->getTransparencyIndex()); } else { MSprite *sprite = asset->getFrame(slot._frameNumber - 1); - sprite->copyTo(&userInterface, slot._position); + sprite->copyTo(&userInterface, slot._position, + sprite->getTransparencyIndex()); } } } @@ -175,7 +177,7 @@ void UISlots::draw(bool updateFlag, bool delFlag) { slot._slotType -= 20; } else { if (updateFlag) - slot._slotType &= 0xBF; + slot._slotType &= ~0x40; else slot._slotType |= 0x40; } @@ -613,7 +615,7 @@ void UserInterface::inventoryAnim() { if (++_invFrameNumber > asset->getCount()) _invFrameNumber = 1; - // Loop through the slots list for ?? entry + // Loop through the slots list for inventory animation entry for (uint i = 0; i < _uiSlots.size(); ++i) { if (_uiSlots[i]._field2 == 200) _uiSlots[i]._slotType = -5; -- cgit v1.2.3 From ded2de015ab7daed5c9b34655f1066ebd0bdedc7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 23 Mar 2014 11:07:00 -0400 Subject: MADS: Finished scene 103 action logic --- engines/mads/dialogs.h | 2 +- engines/mads/nebular/nebular_scenes1.cpp | 177 ++++++++++++++++++++++++++++++- engines/mads/sequence.h | 4 +- 3 files changed, 179 insertions(+), 4 deletions(-) diff --git a/engines/mads/dialogs.h b/engines/mads/dialogs.h index b50d07f43c..56bc8ced53 100644 --- a/engines/mads/dialogs.h +++ b/engines/mads/dialogs.h @@ -193,7 +193,7 @@ public: virtual ~Dialogs() {} virtual void showDialog() = 0; - virtual void showPicture(int objId, int msgId, int arg3) = 0; + virtual void showPicture(int objId, int msgId, int arg3 = 0) = 0; }; } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index d12c2d78d2..96c8ceaf17 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -258,7 +258,182 @@ void Scene103::preActions() { void Scene103::actions() { if (_action._savedLookFlag) { - Dialog::show(0x2852); + Dialog::show(10322); + } else if (_action.isAction(395, 110, 0)) { + switch (_vm->_game->_abortTimers) { + case 0: + _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle( + _globals._spriteIndexes[6], false, 6, 1); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[21], SM_0, 0, 1); + _game._player._stepEnabled = false; + _vm->_sound->command(20); + break; + + case 1: + _vm->_sound->command(1); + _scene->_nextSceneId = 102; + _game._player._stepEnabled = true; + break; + + default: + break; + } + } + else if (_action.isAction(OBJ_REBREATHER, 371, 0) && _game._objects.isInRoom(OBJ_TIMER_MODULE)) { + switch (_vm->_game->_abortTimers) { + case 0: + _scene->changeDepthSurface(1); + _globals._spriteIndexes[28] = _scene->_sequences.startReverseCycle( + _globals._spriteIndexes[13], false, 3, 2); + _game.sub71312(_globals._spriteIndexes[28]); + + _scene->_sequences.addSubEntry(_globals._spriteIndexes[28], SM_FRAME_INDEX, 7, 1); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[28], SM_0, 0, 2); + _vm->_game->_player._visible = false; + _vm->_game->_player._stepEnabled = false; + break; + + case 1: + _scene->_sequences.remove(_globals._spriteIndexes[26]); + break; + + case 2: + _vm->_sound->command(22); + _game._objects.addToInventory(OBJ_TIMER_MODULE); + _scene->changeDepthSurface(0); + _scene->drawElements(kTransitionNone, false); + _scene->_hotspots.activate(371, false); + _vm->_game->_player._visible = true; + _vm->_game->_player._stepEnabled = true; + _vm->_dialogs->showPicture(OBJ_REBREATHER, 804); + break; + + default: + break; + } + } else if (_action.isAction(OBJ_REBREATHER, 289, 0) && _game._objects.isInRoom(OBJ_REBREATHER)) { + switch (_vm->_game->_abortTimers) { + case 0: + _scene->changeDepthSurface(1); + _globals._spriteIndexes[27] = _scene->_sequences.startReverseCycle( + _globals._spriteIndexes[12], false, 3, 2); + _game.sub71312(_globals._spriteIndexes[27]); + + _scene->_sequences.addSubEntry(_globals._spriteIndexes[27], SM_FRAME_INDEX, 6, 1); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[27], SM_0, 0, 2); + _vm->_game->_player._visible = false; + _vm->_game->_player._stepEnabled = false; + break; + + case 1: + _scene->_sequences.remove(_globals._spriteIndexes[25]); + break; + + case 2: + _vm->_sound->command(22); + _game._objects.addToInventory(OBJ_REBREATHER); + _scene->_hotspots.activate(289, false); + _vm->_game->_player._visible = true; + _vm->_game->_player._stepEnabled = true; + _vm->_dialogs->showPicture(OBJ_REBREATHER, 804); + break; + + default: + break; + } + } else if (_action.isAction(OBJ_STUFFED_FISH, 362, 0)) { + Dialog::show(10301); + } else if (_action.isAction(OBJ_REBREATHER, 362, 0)) { + if (!_vm->_game->_abortTimers) + _vm->_sound->command(31); + + if (_vm->_game->_abortTimers2 < 2) { + _globals._spriteIndexes[24] = _scene->_sequences.addSpriteCycle( + _globals._spriteIndexes[9], false, 6, + _vm->_game->_abortTimers < 1 ? 1 : 0); + if (_vm->_game->_abortTimers) { + _scene->_sequences.setAnimRange(_globals._spriteIndexes[24], -1, 0); + Common::String msg = _game.getQuote(51); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 18, 0, 60, msg); + _scene->_sequences.addTimer(120, _vm->_game->_abortTimers); + } else { + _scene->_sequences.addSubEntry(_globals._spriteIndexes[24], + SM_0, 0, 1); + } + + _game._player._stepEnabled = _game._abortTimers == 2; + _globals[11] = -1; + if (_game._abortTimers == 2) { + Dialog::show(1030); + _scene->_hotspots.activate(362, false); + } + } + } else if (_action.isAction(OBJ_STUFFED_FISH, 250, 0)) { + Dialog::show(!_globals[11] ? 10323 : 10303); + } + else if (_action.isAction(OBJ_PLANT_STALK, 27, 0)) { + switch (_vm->_game->_abortTimers) { + case 0: { + _game._player._stepEnabled = false; + Common::String msg = _game.getQuote(71); + _scene->_kernelMessages.add(Common::Point(), 0x1110, 18, 1, 120, msg); + break; + } + + case 1: { + Common::String msg = _game.getQuote(72); + _scene->_kernelMessages.add(Common::Point(310, 132), 0xFDFC, 16, 2, 120, msg); + _globals._v0 = 0; + break; + } + + case 2: + _scene->_kernelMessages.reset(); + _scene->_sequences.addTimer(1, 3); + break; + + case 3: + _game._player._stepEnabled = true; + Dialog::show(10306); + break; + + default: + break; + } + } else if (!_action.isAction(OBJ_STUFFED_FISH, 27, 0)) { + Dialog::show(10304); + } else if (!_action.isAction(OBJ_STUFFED_FISH, 36, 0)) { + Dialog::show(10307); + } else if (!_action.isAction(OBJ_STUFFED_FISH, 55, 0)) { + Dialog::show(10308); + } else if (!_action.isAction(OBJ_REBREATHER, 315, 0)) { + Dialog::show(10309); + } else if (!_action.isAction(OBJ_REBREATHER, 85, 0)) { + Dialog::show(10310); + } else if (!_action.isAction(OBJ_STUFFED_FISH, 144, 0)) { + Dialog::show(10312); + } else if (!_action.isAction(OBJ_BIG_LEAVES, 144, 0)) { + Dialog::show(10313); + } else if (!_action.isAction(OBJ_BONE, 27, 0)) { + Dialog::show(10314); + } else if (!_action.isAction(OBJ_STUFFED_FISH, 310, 0)) { + Dialog::show(10315); + } else if (!_action.isAction(OBJ_STUFFED_FISH, 178, 0)) { + Dialog::show(10316); + } else if (!_action.isAction(OBJ_STUFFED_FISH, 283, 0)) { + Dialog::show(10317); + } else if (!_action.isAction(OBJ_STUFFED_FISH, 120, 0)) { + Dialog::show(10318); + } else if (_action.isAction(OBJ_STUFFED_FISH, 289, 0) && + _game._objects.isInInventory(OBJ_REBREATHER)) { + Dialog::show(10319); + } else if (_action.isAction(OBJ_STUFFED_FISH, 371, 0) && + _game._objects.isInInventory(OBJ_TIMER_MODULE)) { + Dialog::show(10320); + } else if (!_action.isAction(OBJ_STUFFED_FISH, 137, 0)) { + Dialog::show(10321); + } else if (_action.isAction(OBJ_STUFFED_FISH, 409, 0)) { + Dialog::show(_game._objects.isInInventory(OBJ_TIMER_MODULE) ? 10324 : 10325); } _action._inProgress = false; diff --git a/engines/mads/sequence.h b/engines/mads/sequence.h index 9ff34ab34d..f8051bde75 100644 --- a/engines/mads/sequence.h +++ b/engines/mads/sequence.h @@ -116,8 +116,8 @@ public: int triggerCountdown = 0, int timeoutTicks = 0, int extraTicks = 0); int startCycle(int srcSpriteIdx, bool flipped, int cycleIndex); - int startReverseCycle(int srcSpriteIndex, bool flipped, int numTicks, int triggerCountdown, - int timeoutTicks, int extraTicks); + int startReverseCycle(int srcSpriteIndex, bool flipped, int numTicks, + int triggerCountdown = 0, int timeoutTicks = 0, int extraTicks = 0); void getTimeout(int spriteIdx, int arg2); void setScale(int spriteIdx, int scale); }; -- cgit v1.2.3 From 1a54ae3de856ddc69004bc57a0aee043772490d7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 23 Mar 2014 12:02:49 -0400 Subject: MADS: Fix incorrect constant usage in scene 103 logic --- engines/mads/nebular/nebular_scenes1.cpp | 44 ++++++++++++++++---------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 96c8ceaf17..9070bca722 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -279,7 +279,7 @@ void Scene103::actions() { break; } } - else if (_action.isAction(OBJ_REBREATHER, 371, 0) && _game._objects.isInRoom(OBJ_TIMER_MODULE)) { + else if (_action.isAction(VERB_TAKE, 371, 0) && _game._objects.isInRoom(OBJ_TIMER_MODULE)) { switch (_vm->_game->_abortTimers) { case 0: _scene->changeDepthSurface(1); @@ -311,7 +311,7 @@ void Scene103::actions() { default: break; } - } else if (_action.isAction(OBJ_REBREATHER, 289, 0) && _game._objects.isInRoom(OBJ_REBREATHER)) { + } else if (_action.isAction(VERB_TAKE, 289, 0) && _game._objects.isInRoom(OBJ_REBREATHER)) { switch (_vm->_game->_abortTimers) { case 0: _scene->changeDepthSurface(1); @@ -341,9 +341,9 @@ void Scene103::actions() { default: break; } - } else if (_action.isAction(OBJ_STUFFED_FISH, 362, 0)) { + } else if (_action.isAction(VERB_LOOK, 362, 0)) { Dialog::show(10301); - } else if (_action.isAction(OBJ_REBREATHER, 362, 0)) { + } else if (_action.isAction(VERB_TAKE, 362, 0)) { if (!_vm->_game->_abortTimers) _vm->_sound->command(31); @@ -368,10 +368,10 @@ void Scene103::actions() { _scene->_hotspots.activate(362, false); } } - } else if (_action.isAction(OBJ_STUFFED_FISH, 250, 0)) { + } else if (_action.isAction(VERB_LOOK, 250, 0)) { Dialog::show(!_globals[11] ? 10323 : 10303); } - else if (_action.isAction(OBJ_PLANT_STALK, 27, 0)) { + else if (_action.isAction(VERB_TALKTO, 27, 0)) { switch (_vm->_game->_abortTimers) { case 0: { _game._player._stepEnabled = false; @@ -400,39 +400,39 @@ void Scene103::actions() { default: break; } - } else if (!_action.isAction(OBJ_STUFFED_FISH, 27, 0)) { + } else if (!_action.isAction(VERB_LOOK, 27, 0)) { Dialog::show(10304); - } else if (!_action.isAction(OBJ_STUFFED_FISH, 36, 0)) { + } else if (!_action.isAction(VERB_LOOK, 36, 0)) { Dialog::show(10307); - } else if (!_action.isAction(OBJ_STUFFED_FISH, 55, 0)) { + } else if (!_action.isAction(VERB_LOOK, 55, 0)) { Dialog::show(10308); - } else if (!_action.isAction(OBJ_REBREATHER, 315, 0)) { + } else if (!_action.isAction(VERB_TAKE, 315, 0)) { Dialog::show(10309); - } else if (!_action.isAction(OBJ_REBREATHER, 85, 0)) { + } else if (!_action.isAction(VERB_TAKE, 85, 0)) { Dialog::show(10310); - } else if (!_action.isAction(OBJ_STUFFED_FISH, 144, 0)) { + } else if (!_action.isAction(VERB_LOOK, 144, 0)) { Dialog::show(10312); - } else if (!_action.isAction(OBJ_BIG_LEAVES, 144, 0)) { + } else if (!_action.isAction(VERB_OPEN, 144, 0)) { Dialog::show(10313); - } else if (!_action.isAction(OBJ_BONE, 27, 0)) { + } else if (!_action.isAction(VERB_CLOSE, 27, 0)) { Dialog::show(10314); - } else if (!_action.isAction(OBJ_STUFFED_FISH, 310, 0)) { + } else if (!_action.isAction(VERB_LOOK, 310, 0)) { Dialog::show(10315); - } else if (!_action.isAction(OBJ_STUFFED_FISH, 178, 0)) { + } else if (!_action.isAction(VERB_LOOK, 178, 0)) { Dialog::show(10316); - } else if (!_action.isAction(OBJ_STUFFED_FISH, 283, 0)) { + } else if (!_action.isAction(VERB_LOOK, 283, 0)) { Dialog::show(10317); - } else if (!_action.isAction(OBJ_STUFFED_FISH, 120, 0)) { + } else if (!_action.isAction(VERB_LOOK, 120, 0)) { Dialog::show(10318); - } else if (_action.isAction(OBJ_STUFFED_FISH, 289, 0) && + } else if (_action.isAction(VERB_LOOK, 289, 0) && _game._objects.isInInventory(OBJ_REBREATHER)) { Dialog::show(10319); - } else if (_action.isAction(OBJ_STUFFED_FISH, 371, 0) && + } else if (_action.isAction(VERB_LOOK, 371, 0) && _game._objects.isInInventory(OBJ_TIMER_MODULE)) { Dialog::show(10320); - } else if (!_action.isAction(OBJ_STUFFED_FISH, 137, 0)) { + } else if (!_action.isAction(VERB_LOOK, 137, 0)) { Dialog::show(10321); - } else if (_action.isAction(OBJ_STUFFED_FISH, 409, 0)) { + } else if (_action.isAction(VERB_LOOK, 409, 0)) { Dialog::show(_game._objects.isInInventory(OBJ_TIMER_MODULE) ? 10324 : 10325); } -- cgit v1.2.3 From 9ef27c4ea0359d3dce74c49b5f2e9b37050097ae Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 23 Mar 2014 13:52:32 -0400 Subject: MADS: Moved sub71312 method to be SequenceList::setMsgLayout --- engines/mads/nebular/game_nebular.cpp | 8 -------- engines/mads/nebular/game_nebular.h | 2 -- engines/mads/nebular/nebular_scenes1.cpp | 4 ++-- engines/mads/nebular/nebular_scenes2.cpp | 14 +++++++------- engines/mads/sequence.cpp | 22 +++++++++++++++++----- engines/mads/sequence.h | 3 ++- 6 files changed, 28 insertions(+), 25 deletions(-) diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index 52e8913eb3..e5c344b738 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -194,14 +194,6 @@ void GameNebular::checkShowDialog() { } } -void GameNebular::sub71312(int idx) { - int yp = _player._playerPos.y + (_player._yScale * _player._currentScale) / 100; - _scene._sequences.setMsgPosition(idx, Common::Point(_player._playerPos.x, yp)); - _scene._sequences.setDepth(idx, _player._currentDepth); - _scene._sequences.setScale(idx, _player._currentScale); - _scene._sequences.getTimeout(-1, idx); -} - } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/game_nebular.h b/engines/mads/nebular/game_nebular.h index 0197766b8f..685e5c7cd6 100644 --- a/engines/mads/nebular/game_nebular.h +++ b/engines/mads/nebular/game_nebular.h @@ -65,8 +65,6 @@ protected: public: Globals _globals; StoryMode _storyMode; - - void sub71312(int idx); }; diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 9070bca722..d6287de993 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -285,7 +285,7 @@ void Scene103::actions() { _scene->changeDepthSurface(1); _globals._spriteIndexes[28] = _scene->_sequences.startReverseCycle( _globals._spriteIndexes[13], false, 3, 2); - _game.sub71312(_globals._spriteIndexes[28]); + _scene->_sequences.setMsgLayout(_globals._spriteIndexes[28]); _scene->_sequences.addSubEntry(_globals._spriteIndexes[28], SM_FRAME_INDEX, 7, 1); _scene->_sequences.addSubEntry(_globals._spriteIndexes[28], SM_0, 0, 2); @@ -317,7 +317,7 @@ void Scene103::actions() { _scene->changeDepthSurface(1); _globals._spriteIndexes[27] = _scene->_sequences.startReverseCycle( _globals._spriteIndexes[12], false, 3, 2); - _game.sub71312(_globals._spriteIndexes[27]); + _scene->_sequences.setMsgLayout(_globals._spriteIndexes[27]); _scene->_sequences.addSubEntry(_globals._spriteIndexes[27], SM_FRAME_INDEX, 6, 1); _scene->_sequences.addSubEntry(_globals._spriteIndexes[27], SM_0, 0, 2); diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 458cd1d844..0e297e10ba 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -541,8 +541,8 @@ void Scene202::step() { _scene->_hotspots.activate(199, false); int idx = _scene->_dynamicHotspots.add(457, 13, _globals._spriteIndexes[20], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, 246, 124, 8); - _scene->_sequences.getTimeout(_globals._spriteIndexes[26], _globals._spriteIndexes[20]); - _scene->_sequences.getTimeout(-1, _globals._spriteIndexes[26]); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[26], _globals._spriteIndexes[20]); + _scene->_sequences.updateTimeout(-1, _globals._spriteIndexes[26]); _game._player._stepEnabled = true; _game._player._visible = true; _globals._v4 = false; @@ -729,7 +729,7 @@ void Scene202::preActions() { _scene->_sequences.setDepth(_globals._spriteIndexes[23], 1); _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 1); } else if (_game._abortTimers == 1) { - _scene->_sequences.getTimeout(-1, _globals._spriteIndexes[23]); + _scene->_sequences.updateTimeout(-1, _globals._spriteIndexes[23]); warning("CHECKME: _scene->_dynamicHotspots.remove(_globals._frameTime);"); _scene->_dynamicHotspots.remove(_globals._frameTime); _game._player._visible = true; @@ -777,7 +777,7 @@ void Scene202::actions() { _game._player._stepEnabled = false; _game._player._visible = false; _globals._spriteIndexes[22] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[6], false, 3, 2, 0, 0); - _game.sub71312(_globals._spriteIndexes[22]); + _scene->_sequences.setMsgLayout(_globals._spriteIndexes[22]); _scene->_sequences.addSubEntry(_globals._spriteIndexes[22], SM_FRAME_INDEX, 6, 1); _scene->_sequences.addSubEntry(_globals._spriteIndexes[22], SM_0, 0, 2); } @@ -823,7 +823,7 @@ void Scene202::actions() { _globals._spriteIndexes[24] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, 1); _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(247, 82)); _scene->_sequences.setDepth(_globals._spriteIndexes[24], 1); - _scene->_sequences.getTimeout(_globals._spriteIndexes[23], _globals._spriteIndexes[24]); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[23], _globals._spriteIndexes[24]); _globals._v4 = -1; _game._player._stepEnabled = true; int msgIndex = _scene->_kernelMessages.add(Common::Point(248, 15), 0x1110, 32, 0, 60, _game.getQuote(97)); @@ -841,7 +841,7 @@ void Scene202::actions() { _scene->_sequences.setAnimRange(_globals._spriteIndexes[25], 1, 6); _scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(172, 123)); _scene->_sequences.setDepth(_globals._spriteIndexes[25], 1); - _scene->_sequences.getTimeout(-1, _globals._spriteIndexes[25]); + _scene->_sequences.updateTimeout(-1, _globals._spriteIndexes[25]); _scene->_sequences.addSubEntry(_globals._spriteIndexes[25], SM_0, 0, 1); } else if (_game._abortTimers == 1) { _globals._spriteIndexes[25] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 6); @@ -864,7 +864,7 @@ void Scene202::actions() { _scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(172, 123)); _scene->_sequences.addSubEntry(_globals._spriteIndexes[25], SM_0, 0, 3); } else if (_game._abortTimers == 3) { - _scene->_sequences.getTimeout(-1, _globals._spriteIndexes[25]); + _scene->_sequences.updateTimeout(-1, _globals._spriteIndexes[25]); _game._player._stepEnabled = true; _game._player._visible = true; } else { diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index 53ed02a566..bb2454d3fc 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -473,21 +473,33 @@ int SequenceList::startReverseCycle(int srcSpriteIndex, bool flipped, int numTic numTicks, 0, 0, true, 100, depth - 1, 1, ANIMTYPE_REVERSIBLE, 0, 0); } -void SequenceList::getTimeout(int spriteIdx, int arg2) { +void SequenceList::updateTimeout(int spriteIdx, int seqIndex) { + Player &player = _vm->_game->_player; int timeout; + if (spriteIdx >= 0) timeout = _entries[spriteIdx]._timeout; else - timeout = _vm->_game->_player._priorTimer + _vm->_game->_player._ticksAmount; + timeout = player._priorTimer + player._ticksAmount; - if (arg2 >= 0) - _entries[arg2]._timeout = timeout; + if (seqIndex >= 0) + _entries[seqIndex]._timeout = timeout; else - _vm->_game->_player._priorTimer = timeout - _vm->_game->_player._ticksAmount; + player._priorTimer = timeout - player._ticksAmount; } void SequenceList::setScale(int spriteIdx, int scale) { _entries[spriteIdx]._scale = scale; } + +void SequenceList::setMsgLayout(int seqIndex) { + Player &player = _vm->_game->_player; + int yp = player._playerPos.y + (player._yScale * player._currentScale) / 100; + setMsgPosition(seqIndex, Common::Point(player._playerPos.x, yp)); + setDepth(seqIndex, player._currentDepth); + setScale(seqIndex, player._currentScale); + updateTimeout(-1, seqIndex); +} + } // End of namespace diff --git a/engines/mads/sequence.h b/engines/mads/sequence.h index f8051bde75..f24a2bd659 100644 --- a/engines/mads/sequence.h +++ b/engines/mads/sequence.h @@ -118,8 +118,9 @@ public: int startCycle(int srcSpriteIdx, bool flipped, int cycleIndex); int startReverseCycle(int srcSpriteIndex, bool flipped, int numTicks, int triggerCountdown = 0, int timeoutTicks = 0, int extraTicks = 0); - void getTimeout(int spriteIdx, int arg2); + void updateTimeout(int spriteIdx, int seqIndex); void setScale(int spriteIdx, int scale); + void setMsgLayout(int seqIndex); }; } // End of namespace MADS -- cgit v1.2.3 From a22318959989caf91916ba792f80103afe71092a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 23 Mar 2014 14:26:50 -0400 Subject: MADS: Added extra debugger commands --- engines/mads/debugger.cpp | 104 +++++++++++++++++++++++++++++++++++++++++++++- engines/mads/debugger.h | 6 +++ engines/mads/hotspots.h | 1 + 3 files changed, 109 insertions(+), 2 deletions(-) diff --git a/engines/mads/debugger.cpp b/engines/mads/debugger.cpp index 34b12c1680..3bc4ed2c16 100644 --- a/engines/mads/debugger.cpp +++ b/engines/mads/debugger.cpp @@ -20,6 +20,7 @@ * */ +#include "common/file.h" #include "mads/mads.h" #include "mads/debugger.h" @@ -29,8 +30,15 @@ Debugger::Debugger(MADSEngine *vm) : GUI::Debugger(), _vm(vm) { _showMousePos = false; DCmd_Register("continue", WRAP_METHOD(Debugger, Cmd_Exit)); + DCmd_Register("scene", WRAP_METHOD(Debugger, Cmd_Mouse)); + DCmd_Register("scene", WRAP_METHOD(Debugger, Cmd_LoadScene)); + DCmd_Register("show_hotspots", WRAP_METHOD(Debugger, Cmd_ShowHotSpots)); + DCmd_Register("list_hotspots", WRAP_METHOD(Debugger, Cmd_ListHotSpots)); + DCmd_Register("play_sound", WRAP_METHOD(Debugger, Cmd_PlaySound)); + DCmd_Register("show_codes", WRAP_METHOD(Debugger, Cmd_ShowCodes)); + DCmd_Register("dump_file", WRAP_METHOD(Debugger, Cmd_DumpFile)); } -/* + static int strToInt(const char *s) { if (!*s) // No string at all @@ -46,7 +54,6 @@ static int strToInt(const char *s) { error("strToInt failed on string \"%s\"", s); return (int)tmp; } -*/ bool Debugger::Cmd_Mouse(int argc, const char **argv) { if (argc < 2) { @@ -58,4 +65,97 @@ bool Debugger::Cmd_Mouse(int argc, const char **argv) { return true; } +bool Debugger::Cmd_LoadScene(int argc, const char **argv) { + if (argc != 2) { + DebugPrintf("Usage: %s \n", argv[0]); + return true; + } else { + _vm->_game->_scene._nextSceneId = strToInt(argv[1]); + return false; + } +} + +bool Debugger::Cmd_ShowHotSpots(int argc, const char **argv) { + Scene &scene = _vm->_game->_scene; + + // hotspots + byte hotspotCol = _vm->getRandomNumber(255); + for (uint i = 0; i < scene._hotspots.size(); i++) { + scene._backgroundSurface.frameRect(scene._hotspots[i]._bounds, hotspotCol); + } + + // Dynamic hotspots (red) + hotspotCol = _vm->getRandomNumber(255); + for (uint i = 0; i < scene._dynamicHotspots.size(); i++) { + scene._backgroundSurface.frameRect(scene._dynamicHotspots[i]._bounds, hotspotCol); + } + + scene._spriteSlots.fullRefresh(); + return false; +} + +bool Debugger::Cmd_ListHotSpots(int argc, const char **argv) { + Hotspots &hotspots = _vm->_game->_scene._hotspots; + + DebugPrintf("%d hotspots present\n", hotspots.size()); + + for (uint index = 0; index < hotspots.size(); ++index) { + DebugPrintf("(%d): %p x1 = %d; y1 = %d; x2 = %d; y2 = %d\n", + index, (void *)&hotspots[index], + hotspots[index]._bounds.left, hotspots[index]._bounds.top, + hotspots[index]._bounds.right, hotspots[index]._bounds.bottom); + } + + return true; +} + +bool Debugger::Cmd_PlaySound(int argc, const char **argv) { + if (argc < 2) { + DebugPrintf("Usage: %s \n", argv[0]); + } else { + int commandId = strToInt(argv[1]); + int param = (argc >= 3) ? strToInt(argv[2]) : 0; + + _vm->_sound->command(commandId, param); + } + + return false; +} + +bool Debugger::Cmd_ShowCodes(int argc, const char **argv) { + Scene &scene = _vm->_game->_scene; + + scene._depthSurface.copyTo(&scene._backgroundSurface); + scene._spriteSlots.fullRefresh(); + + return false; +} + +bool Debugger::Cmd_DumpFile(int argc, const char **argv) { + if (argc != 2) { + DebugPrintf("Usage: %s \n", argv[0]); + } else { + Common::DumpFile outFile; + Common::File inFile; + + if (!inFile.open(argv[1])) { + DebugPrintf("Specified resource does not exist\n"); + } else { + outFile.open(argv[1]); + byte *data = new byte[inFile.size()]; + + inFile.read(data, inFile.size()); + outFile.write(data, inFile.size()); + + delete[] data; + inFile.close(); + outFile.close(); + + DebugPrintf("File written successfully.\n"); + } + } + + return true; +} + } // End of namespace MADS diff --git a/engines/mads/debugger.h b/engines/mads/debugger.h index 983b9931fc..de450b1446 100644 --- a/engines/mads/debugger.h +++ b/engines/mads/debugger.h @@ -35,6 +35,12 @@ private: MADSEngine *_vm; protected: bool Cmd_Mouse(int argc, const char **argv); + bool Cmd_LoadScene(int argc, const char **argv); + bool Cmd_ShowHotSpots(int argc, const char **argv); + bool Cmd_ListHotSpots(int argc, const char **argv); + bool Cmd_PlaySound(int argc, const char **argv); + bool Cmd_ShowCodes(int argc, const char **argv); + bool Cmd_DumpFile(int argc, const char **argv); public: bool _showMousePos; public: diff --git a/engines/mads/hotspots.h b/engines/mads/hotspots.h index a53b86d880..ec9f12dc77 100644 --- a/engines/mads/hotspots.h +++ b/engines/mads/hotspots.h @@ -57,6 +57,7 @@ public: public: DynamicHotspots(MADSEngine *vm); + int size() const { return _entries.size(); } DynamicHotspot &operator[](uint idx) { return _entries[idx]; } int add(int descId, int vocabId, int seqIndex, const Common::Rect &bounds); int setPosition(int index, int xp, int yp, int facing); -- cgit v1.2.3 From a3952509a91b15ccc959e0dbddd12e1678e3814e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 23 Mar 2014 17:31:33 -0400 Subject: MADS: In progress work on action starting --- engines/mads/action.cpp | 87 ++++++++++++++++++++++++++++--------------------- engines/mads/action.h | 21 +++++++----- 2 files changed, 63 insertions(+), 45 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index 52be8eabba..d52adbf0de 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -69,6 +69,15 @@ void MADSAction::appendVocab(int vocabId, bool capitalise) { _statusText += " "; } +void MADSAction::checkCustomDest(int v) { + Scene &scene = _vm->_game->_scene; + + if (_v86F4A && (v == -3 || _savedFields._selectedRow < 0)) { + _startWalkFlag = true; + scene._destPos = scene._customDest; + } +} + void MADSAction::set() { Scene &scene = _vm->_game->_scene; UserInterface &userInterface = scene._userInterface; @@ -249,72 +258,76 @@ void MADSAction::refresh() { } void MADSAction::startAction() { - /* - _madsVm->_player.moveComplete(); + Game &game = *_vm->_game; + Scene &scene = _vm->_game->_scene; + DynamicHotspots &dynHotspots = scene._dynamicHotspots; + Hotspots &hotspots = scene._hotspots; + + game._player.moveComplete(); _inProgress = true; _v8453A = ABORTMODE_0; - _savedFields.selectedRow = _selectedRow; - _savedFields.articleNumber = _articleNumber; - _savedFields.actionMode = _actionMode; - _savedFields.actionMode2 = _actionMode2; - _savedFields.lookFlag = _lookFlag; - int savedHotspotId = _hotspotId; - int savedV86F3A = _v86F3A; - int savedV86F42 = _v86F42; + _savedFields._selectedRow = _selectedRow; + _savedFields._hotspotId = _hotspotId; + _savedFields._v86F3A = _v86F3A; + _savedFields._articleNumber = _articleNumber; + _savedFields._actionMode = _actionMode; + _savedFields._actionMode2 = _actionMode2; + _savedFields._v86F42 = _v86F42; + _savedFields._lookFlag = _lookFlag; + _activeAction = _action; // Copy the action to be active _activeAction = _action; - strcpy(_dialogTitle, _statusText); + _dialogTitle = _statusText; - if ((_savedFields.actionMode2 == ACTMODE2_4) && (savedV86F42 == 0)) - _v8453A = ABORTMODE_1; + if ((_actionMode2 == ACTIONMODE2_4) && (_v86F42 == 0)) + _v8453A = -1; _startWalkFlag = false; int hotspotId = -1; - HotSpotList &dynHotspots = *_madsVm->scene()->getSceneResources().dynamicHotspots; - HotSpotList &hotspots = *_madsVm->scene()->getSceneResources().hotspots; - if (!_savedFields.lookFlag && (_madsVm->scene()->_screenObjects._v832EC != 1)) { - if (_savedFields.actionMode2 == ACTMODE2_4) - hotspotId = savedHotspotId; - else if (savedV86F42 == 4) - hotspotId = savedV86F3A; + if (!_savedFields._lookFlag && (_vm->_game->_screenObjects._v832EC != 1)) { + if (_savedFields._actionMode2 == ACTIONMODE2_4) + hotspotId = _savedFields._hotspotId; + else if (_v86F42 == 4) + hotspotId = _savedFields._v86F3A; if (hotspotId >= hotspots.size()) { - HotSpot &hs = dynHotspots[hotspotId - hotspots.size()]; - if ((hs.getFeetX() == -1) || (hs.getFeetX() == -3)) { - if (_v86F4A && ((hs.getFeetX() == -3) || (_savedFields.selectedRow < 0))) { + DynamicHotspot &hs = dynHotspots[hotspotId - hotspots.size()]; + if ((hs._feetPos.x == -1) || (hs._feetPos.x == -3)) { + if (_v86F4A && ((hs._feetPos.x == -3) || (_savedFields._selectedRow < 0))) { _startWalkFlag = true; - _madsVm->scene()->_destPos = _madsVm->scene()->_customDest; + + + scene._destPos = scene._customDest; } - } else if ((hs.getFeetX() >= 0) && ((_savedFields.actionMode == ACTMODE_NONE) || (hs.getCursor() < 2))) { + } else if ((hs._feetPos.x >= 0) && ((_savedFields._actionMode == ACTIONMODE_NONE) || + (hs._cursor < 2))) { _startWalkFlag = true; - _madsVm->scene()->_destPos.x = hs.getFeetX(); - _madsVm->scene()->_destPos.y = hs.getFeetY(); + scene._destPos.x = hs._feetPos.x; + scene._destPos.y = hs._feetPos.y; } - _madsVm->scene()->_destFacing = hs.getFacing(); + scene._destFacing = hs._facing; hotspotId = -1; } } if (hotspotId >= 0) { - HotSpot &hs = hotspots[hotspotId]; - if ((hs.getFeetX() == -1) || (hs.getFeetX() == -3)) { - if (_v86F4A && ((hs.getFeetX() == -3) || (_savedFields.selectedRow < 0))) { + Hotspot &hs = hotspots[hotspotId]; + if ((hs._feetPos.x == -1) || (hs._feetPos.x == -3)) { + if (_v86F4A && ((hs._feetPos.x == -3) || (_savedFields._selectedRow < 0))) { _startWalkFlag = true; - _madsVm->scene()->_destPos = _madsVm->scene()->_customDest; + scene._destPos = scene._customDest; } - } else if ((hs.getFeetX() >= 0) && ((_savedFields.actionMode == ACTMODE_NONE) || (hs.getCursor() < 2))) { + } else if ((hs._feetPos.x >= 0) && ((_savedFields._actionMode == ACTIONMODE_NONE) || (hs._cursor < 2))) { _startWalkFlag = true; - _madsVm->scene()->_destPos.x = hs.getFeetX(); - _madsVm->scene()->_destPos.y = hs.getFeetY(); + scene._destPos = hs._feetPos; } - _madsVm->scene()->_destFacing = hs.getFacing(); + scene._destFacing = hs._facing; } _walkFlag = _startWalkFlag; - */ } void MADSAction::checkAction() { diff --git a/engines/mads/action.h b/engines/mads/action.h index 04d9c3607a..b32720f4a0 100644 --- a/engines/mads/action.h +++ b/engines/mads/action.h @@ -56,12 +56,15 @@ struct ActionDetails { int _indirectObjectId; }; -struct MADSActionSavedFields { - int articleNumber; - int actionMode; - int actionMode2; - bool lookFlag; - int selectedRow; +struct ActionSavedFields { + int _actionMode; + int _selectedRow; + int _hotspotId; + int _v86F3A; + int _actionMode2; + int _v86F42; + int _articleNumber; + int _lookFlag; }; class MADSAction { @@ -69,8 +72,11 @@ private: MADSEngine *_vm; Common::String _statusText; Common::String _dialogTitle; + ActionSavedFields _savedFields; void appendVocab(int vocabId, bool capitalise = false); + + void checkCustomDest(int v); public: ActionDetails _action, _activeAction; int _currentAction; @@ -85,7 +91,6 @@ public: bool _startWalkFlag; int _statusTextIndex; int _hotspotId; - MADSActionSavedFields _savedFields; bool _walkFlag; bool _savedSelectedRow; bool _savedLookFlag; @@ -98,7 +103,7 @@ public: int16 _v86F4C; int _v83338; bool _inProgress; - AbortTimerMode _v8453A; + int _v8453A; public: MADSAction(MADSEngine *vm); -- cgit v1.2.3 From 7f4dbf7d48b6db8d82d33b569c22f104fc153dd3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 23 Mar 2014 18:48:00 -0400 Subject: MADS: Implemented more action handling methods --- engines/mads/action.cpp | 57 ++++++++++++++++---------------- engines/mads/action.h | 4 +-- engines/mads/game.h | 5 +++ engines/mads/nebular/game_nebular.cpp | 4 +++ engines/mads/nebular/game_nebular.h | 3 +- engines/mads/nebular/nebular_scenes1.cpp | 2 +- engines/mads/scene.cpp | 54 ++++++++++++++++++++++++++++-- 7 files changed, 93 insertions(+), 36 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index d52adbf0de..0c20fec918 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -36,8 +36,15 @@ MADSAction::MADSAction(MADSEngine *vm) : _vm(vm) { _statusTextIndex = -1; _selectedAction = 0; _inProgress = false; - _savedSelectedRow = false; - _savedLookFlag = false; + + _savedFields._actionMode = ABORTMODE_0; + _savedFields._actionMode2 = ABORTMODE_0; + _savedFields._selectedRow = -1; + _savedFields._hotspotId = 0; + _savedFields._v86F3A = 0; + _savedFields._v86F42 = 0; + _savedFields._articleNumber = 0; + _savedFields._lookFlag = false; } void MADSAction::clear() { @@ -293,37 +300,34 @@ void MADSAction::startAction() { else if (_v86F42 == 4) hotspotId = _savedFields._v86F3A; - if (hotspotId >= hotspots.size()) { + if (hotspotId >= (int)hotspots.size()) { DynamicHotspot &hs = dynHotspots[hotspotId - hotspots.size()]; if ((hs._feetPos.x == -1) || (hs._feetPos.x == -3)) { - if (_v86F4A && ((hs._feetPos.x == -3) || (_savedFields._selectedRow < 0))) { - _startWalkFlag = true; - - - scene._destPos = scene._customDest; - } - } else if ((hs._feetPos.x >= 0) && ((_savedFields._actionMode == ACTIONMODE_NONE) || - (hs._cursor < 2))) { + checkCustomDest(hs._feetPos.x); + } else if (hs._feetPos.x == 0) { + scene._destFacing = hs._facing; + } else if (_savedFields._actionMode == ACTIONMODE_NONE || hs._cursor >= CURSOR_WAIT) { _startWalkFlag = true; - scene._destPos.x = hs._feetPos.x; - scene._destPos.y = hs._feetPos.y; + scene._destPos = hs._feetPos; } + scene._destFacing = hs._facing; hotspotId = -1; } } - if (hotspotId >= 0) { + if (hotspotId >= 0 && hotspotId < (int)hotspots.size()) { Hotspot &hs = hotspots[hotspotId]; - if ((hs._feetPos.x == -1) || (hs._feetPos.x == -3)) { - if (_v86F4A && ((hs._feetPos.x == -3) || (_savedFields._selectedRow < 0))) { + + if (hs._feetPos.x == -1 || hs._feetPos.x != -3) { + checkCustomDest(hs._feetPos.x); + } else if (hs._feetPos.x >= 0) { + if (_savedFields._actionMode == ACTIONMODE_NONE || hs._cursor < CURSOR_WAIT) { _startWalkFlag = true; - scene._destPos = scene._customDest; + scene._destPos = hs._feetPos; } - } else if ((hs._feetPos.x >= 0) && ((_savedFields._actionMode == ACTIONMODE_NONE) || (hs._cursor < 2))) { - _startWalkFlag = true; - scene._destPos = hs._feetPos; } + scene._destFacing = hs._facing; } @@ -331,21 +335,18 @@ void MADSAction::startAction() { } void MADSAction::checkAction() { - /* - if (isAction(kVerbLookAt) || isAction(kVerbThrow)) + if (isAction(VERB_LOOK) || isAction(VERB_THROW)) _startWalkFlag = 0; - */ } bool MADSAction::isAction(int verbId, int objectNameId, int indirectObjectId) { - /* - if (_activeAction.verbId != verbId) + if (_activeAction._verbId != verbId) return false; - if ((objectNameId != 0) && (_activeAction.objectNameId != objectNameId)) + if ((objectNameId != 0) && (_activeAction._objectNameId != objectNameId)) return false; - if ((indirectObjectId != 0) && (_activeAction.indirectObjectId != indirectObjectId)) + if ((indirectObjectId != 0) && (_activeAction._indirectObjectId != indirectObjectId)) return false; - */ + return true; } diff --git a/engines/mads/action.h b/engines/mads/action.h index b32720f4a0..802dfb0576 100644 --- a/engines/mads/action.h +++ b/engines/mads/action.h @@ -72,7 +72,6 @@ private: MADSEngine *_vm; Common::String _statusText; Common::String _dialogTitle; - ActionSavedFields _savedFields; void appendVocab(int vocabId, bool capitalise = false); @@ -92,8 +91,7 @@ public: int _statusTextIndex; int _hotspotId; bool _walkFlag; - bool _savedSelectedRow; - bool _savedLookFlag; + ActionSavedFields _savedFields; // Unknown fields int16 _v86F3A; diff --git a/engines/mads/game.h b/engines/mads/game.h index 32491ce0d0..bf81c23d81 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -143,6 +143,11 @@ public: uint32 getQuotesSize() { return _quotes.size(); } const Common::String &getQuote(uint32 index) { return _quotes[index - 1]; } + /** + * Standard object handling across the game + */ + virtual void doObjectAction() = 0; + // DEPRECATED: ScummVM re-implementation keeps all the quotes loaded, so the methods below are stubs void clearQuotes() {} void loadQuoteRange(int startNum, int endNum) {} diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index e5c344b738..76ea1f55de 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -194,6 +194,10 @@ void GameNebular::checkShowDialog() { } } +void GameNebular::doObjectAction() { + warning("TODO: GameNebular::doObjectAction"); +} + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/game_nebular.h b/engines/mads/nebular/game_nebular.h index 685e5c7cd6..98ecb0a41e 100644 --- a/engines/mads/nebular/game_nebular.h +++ b/engines/mads/nebular/game_nebular.h @@ -61,10 +61,11 @@ protected: virtual void setSectionHandler(); virtual void checkShowDialog(); - public: Globals _globals; StoryMode _storyMode; + + virtual void doObjectAction(); }; diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index d6287de993..652ee99d38 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -257,7 +257,7 @@ void Scene103::preActions() { } void Scene103::actions() { - if (_action._savedLookFlag) { + if (_action._savedFields._lookFlag) { Dialog::show(10322); } else if (_action.isAction(395, 110, 0)) { switch (_vm->_game->_abortTimers) { diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index cfdfa87c61..565ef47395 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -302,7 +302,7 @@ void Scene::doFrame() { _action.startAction(); if (_action._activeAction._verbId == Nebular::NOUN_LOOK_AT) { _action._activeAction._verbId = VERB_LOOK; - _action._savedSelectedRow = false; + _action._savedFields._selectedRow = false; } flag = true; @@ -470,11 +470,59 @@ void Scene::drawElements(ScreenTransition transitionType, bool surfaceFlag) { } void Scene::doPreactions() { - warning("TODO: Scene::doPreactions"); + if (_vm->_game->_screenObjects._v832EC == 0 || _vm->_game->_screenObjects._v832EC == 2) { + _vm->_game->_abortTimersMode2 = ABORTMODE_2; + _action.checkAction(); + _sceneLogic->preActions(); + + if (_vm->_game->_abortTimersMode == ABORTMODE_2) + _vm->_game->_abortTimers = 0; + } } void Scene::doAction() { - warning("TODO: Scene::doAction"); + int flag = 0; + + _vm->_game->_abortTimersMode2 = ABORTMODE_0; + if ((_action._inProgress || _vm->_game->_abortTimers) && !_action._v8453A) { + _sceneLogic->actions(); + _action._inProgress = true; + flag = -1; + } + + if (_vm->_game->_screenObjects._v832EC == 1) { + _action._inProgress = false; + } else { + if ((_action._inProgress || _vm->_game->_abortTimers) || + (!flag && _action._v8453A == flag)) { + _vm->_game->_sectionHandler->sectionPtr2(); + _action._inProgress = true; + flag = -1; + } + + if ((_action._inProgress || _vm->_game->_abortTimers) && (!flag || _action._v8453A == flag)) { + _vm->_game->doObjectAction(); + } + + if (!_action._savedFields._lookFlag) { + if (!_action._inProgress) { + _action._v8453A = -1; + _sceneLogic->postActions(); + } + + if (!_action._inProgress) { + _action._v8453A = -1; + warning("TODO: PtrUnk4"); + } + + if (_action._inProgress) + warning("TODO: sub_1D9DE"); + } + } + + _action._inProgress = false; + if (_vm->_game->_abortTimersMode == ABORTMODE_0) + _vm->_game->_abortTimers = 0; } void Scene::checkStartWalk() { -- cgit v1.2.3 From c57acfb154999b3976c07d6512657c02cc4ef468 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 24 Mar 2014 01:14:16 +0100 Subject: MADS: Implement scene 203 --- engines/mads/nebular/nebular_scenes.cpp | 4 ++ engines/mads/nebular/nebular_scenes2.cpp | 112 +++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes2.h | 11 +++ engines/mads/palette.cpp | 13 +++- engines/mads/palette.h | 2 + engines/mads/scene.cpp | 6 ++ engines/mads/scene.h | 1 + 7 files changed, 148 insertions(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 42a44a2b51..6f799475cb 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -53,6 +53,10 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { // Scene group #2 case 201: return new Scene201(vm); + case 202: + return new Scene202(vm); + case 203: + return new Scene203(vm); // Scene group #8 case 804: diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 0e297e10ba..65a285860a 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -975,5 +975,117 @@ void Scene202::actions() { action->_inProgress = false; } +/*****************************************************************************/ + +void Scene203::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(477); +} + +void Scene203::enter() { + if (_scene->_priorSceneId == 202) { + _game._player._playerPos = Common::Point(187, 99); + _game._player._direction = 2; + } else if (_scene->_priorSceneId == 209) { + _game._player._playerPos = Common::Point(308, 117); + _game._player._direction = 4; + } else if (_scene->_priorSceneId == -2) { + _game._player._playerPos = Common::Point(155, 152); + _game._player._direction = 8; + } + + _globals._v0 = 0; + _globals._frameTime = 0; + + if ((_globals[34] == 0) && (_scene->_roomChanged == 0)) { + _globals._v0 = -1; + _game._player.startWalking(Common::Point(158, 135), 2); + int idx = _scene->_dynamicHotspots.add(131, 396, 0, Common::Rect(0, 0, 320, 156)); + _scene->_dynamicHotspots.setPosition(idx, 155, 152, 2); + _scene->_dynamicHotspots.setCursor(idx, CURSOR_GO_DOWN); + } + + if (_globals._v0 == 0) { + _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('b', -1), 0); + if (_vm->getRandomNumber(1, 3) == 2) { + _globals._spriteIndexes[15] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 9, 1, 0, 0); + int idx = _scene->_dynamicHotspots.add(477, 209, _globals._spriteIndexes[15], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, -2, 0, 0); + _vm->_sound->command(14); + } + } + + _game.loadQuoteSet(0x67, 0x68, 0x69, 0x6A, 0x5A, 0); + + if (_globals._v0 != 0) { + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(_vm->getRandomNumber(103, 106))); + } + + sceneEntrySound(); +} + +void Scene203::step() { + if (_globals._v0 == 0) + return; + + if ((_game._abortTimers == 0) && (_globals._frameTime != 0)) + return; + + if ((_game._player._playerPos != Common::Point(158, 136)) || (_game._player._direction != 2)) + return; + + _globals._frameTime = 0xFFFF; + + if (_game._abortTimers == 0) { + _game._player._visible = false; + _game._player._stepEnabled = false; + _vm->_palette->sub7BBF8(); + _scene->_kernelMessages.reset(); + _scene->resetScene(); + _vm->_events->setCursor2(CURSOR_WAIT); + _scene->loadAnimation(Resources::formatName(203, 'a', -1, EXT_AA, ""), 81); + } else if (_game._abortTimers == 81) { + _scene->_nextSceneId = 208; + _scene->_reloadSceneFlag = true; + } +} + +void Scene203::preActions() { + if (_globals._v0 && !_action.isAction(0x18C, 0x83, 0)) { + _game._player.startWalking(Common::Point(158, 136), 2); + _action._inProgress = false; + return; + } + + if (_action.isAction(0xD, 0xF3, 0)) + _game._player._v844BE = 209; +} + +void Scene203::actions() { + if (_action._savedFields._lookFlag) { + Dialog::show(0x4F53); + } else if (_action.isAction(0x18C, 0x83, 0)) { + _scene->_nextSceneId = 208; + } else if (_action.isAction(0x18C, 0x82, 0)) { + _scene->_nextSceneId = 202; + } else if (_action.isAction(0x3, 0x142, 0)) { + Dialog::show(0x4F4D); + } else if (_action.isAction(0x3, 0x4D, 0)) { + Dialog::show(0x4F4E); + } else if (_action.isAction(0x3, 0x100, 0)) { + Dialog::show(0x4F4F); + } else if (_action.isAction(0x3, 0x82, 0)) { + Dialog::show(0x4F50); + } else if (_action.isAction(0x3, 0x1A6, 0)) { + Dialog::show(0x4F51); + } else if (_action.isAction(0x3, 0x30, 0)) { + Dialog::show(0x4F51); + } else + return; + + _action._inProgress = false; +} + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index a1faf53055..b49cf96809 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -78,6 +78,17 @@ public: void setRandomKernelMessage(); }; + +class Scene203: public Scene2xx { +public: + Scene203(MADSEngine *vm) : Scene2xx(vm) {} + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index bd467aa16b..4a62cca5bc 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -517,8 +517,19 @@ void Palette::setLowRange() { } void Palette::fadeOut(byte palette[PALETTE_SIZE], int v1, int v2, int v3, int v4, int v5, int v6) { - } +void Palette::sub7BBF8() { + if ((_rgbList[31] != 0) && (_v1 == 0)) + error("Palette - Unexpected values"); + + _v1 = -1; + _rgbList[31] = -1; + + for (int i = 0; i < 256; i++) { + if (_palFlags[i]) + _palFlags[i] |= 0x80000000; + } +} } // End of namespace MADS diff --git a/engines/mads/palette.h b/engines/mads/palette.h index e9549fd0bd..2fdb38662c 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -229,6 +229,8 @@ public: } void fadeOut(byte palette[PALETTE_SIZE], int v1, int v2, int v3, int v4, int v5, int v6); + + void sub7BBF8(); }; } // End of namespace MADS diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 565ef47395..00460a9d70 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -569,4 +569,10 @@ void Scene::changeDepthSurface(int arg1) { _spriteSlots.fullRefresh(); } +void Scene::resetScene() { + _vm->_game->clearQuotes(); + _spriteSlots.fullRefresh(true); + _sequences.clear(); +} + } // End of namespace MADS diff --git a/engines/mads/scene.h b/engines/mads/scene.h index a51d820d1c..f7d0e56a78 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -204,6 +204,7 @@ public: void changeDepthSurface(int arg1); + void resetScene(); }; } // End of namespace MADS -- cgit v1.2.3 From ce9a15f010d84c8596380eec5226ef22704022e5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 23 Mar 2014 21:52:18 -0400 Subject: MADS: Fix the setting/clearing of _mouseReleased flag --- engines/mads/events.cpp | 6 ++++++ engines/mads/events.h | 2 ++ engines/mads/scene.cpp | 9 ++++++--- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp index fe2a2532c5..a4e1a96a5a 100644 --- a/engines/mads/events.cpp +++ b/engines/mads/events.cpp @@ -132,6 +132,7 @@ void EventsManager::pollEvents() { case Common::EVENT_LBUTTONUP: case Common::EVENT_RBUTTONUP: _mouseClicked = false; + _mouseReleased = true; _mouseMoved = true; return; case Common::EVENT_MOUSEMOVE: @@ -186,4 +187,9 @@ void EventsManager::initVars() { _vD2 = _vD8 = 0; } +void EventsManager::resetMouseFlags() { + _mouseClicked = false; + _mouseReleased = false; +} + } // End of namespace MADS diff --git a/engines/mads/events.h b/engines/mads/events.h index 219af20c2a..b7af148e7e 100644 --- a/engines/mads/events.h +++ b/engines/mads/events.h @@ -141,6 +141,8 @@ public: uint32 getFrameCounter() const { return _frameCounter; } void initVars(); + + void resetMouseFlags(); }; } // End of namespace MADS diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 00460a9d70..8360c1e396 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -272,6 +272,12 @@ void Scene::loop() { // Handle drawing a game frame doFrame(); + // Reset mouse flags + _vm->_events->resetMouseFlags(); + + // TODO: Verify correctness of frame wait + _vm->_events->waitForNextFrame(); + if (_vm->_dialogs->_pendingDialog != DIALOG_NONE && !_vm->_game->_abortTimers && _vm->_game->_player._stepEnabled) _reloadSceneFlag = true; @@ -421,9 +427,6 @@ void Scene::doFrame() { _activeAnimation->free(); _activeAnimation = nullptr; } - - // TODO: Verify correctness of frame wait - _vm->_events->waitForNextFrame(); } void Scene::drawElements(ScreenTransition transitionType, bool surfaceFlag) { -- cgit v1.2.3 From 0dfa60ae00428ad83c6b6d19963e2d7352707637 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 23 Mar 2014 22:11:35 -0400 Subject: MADS: Refactored out and fixed cursor changes for hotspots --- engines/mads/scene.cpp | 61 ++++++++++++++++++++++++++++---------------------- engines/mads/scene.h | 5 +++++ 2 files changed, 39 insertions(+), 27 deletions(-) diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 8360c1e396..1b3143f60e 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -340,33 +340,7 @@ void Scene::doFrame() { player.nextFrame(); // Cursor update code - CursorType cursorId = CURSOR_ARROW; - if (_action._v83338 == 1 && !_vm->_game->_screenObjects._v7FECA && - _vm->_game->_screenObjects._category == CAT_HOTSPOT) { - int idx = _vm->_game->_screenObjects._selectedObject - - _userInterface._categoryIndexes[CAT_HOTSPOT - 1]; - assert(idx >= 0); - - if (idx >= (int)_hotspots.size()) { - idx -= _hotspots.size(); - _vm->_events->_newCursorId = _dynamicHotspots[idx]._cursor; - } else { - _vm->_events->_newCursorId = _hotspots[idx]._cursor; - } - - cursorId = _vm->_events->_newCursorId == CURSOR_NONE ? - CURSOR_ARROW : _vm->_events->_newCursorId; - } - - if (!player._stepEnabled) - cursorId = CURSOR_WAIT; - if (cursorId >= _vm->_events->_cursorSprites->getCount()) - cursorId = (CursorType)_vm->_events->_cursorSprites->getCount(); - _vm->_events->_newCursorId = cursorId; - - if (cursorId != _vm->_events->_cursorId) { - _vm->_events->setCursor(cursorId); - } + updateCursor(); if (!_vm->_game->_abortTimers) { // Handle any active sequences @@ -562,6 +536,39 @@ void Scene::loadAnimation(const Common::String &resName, int abortTimers) { _activeAnimation->startAnimation(abortTimers); } +void Scene::updateCursor() { + Player &player = _vm->_game->_player; + + CursorType cursorId = CURSOR_ARROW; + if (_action._v83338 == 1 && !_vm->_game->_screenObjects._v7FECA && + _vm->_game->_screenObjects._category == CAT_HOTSPOT) { + int idx = _vm->_game->_screenObjects._selectedObject - + _userInterface._categoryIndexes[CAT_HOTSPOT - 1]; + assert(idx >= 0); + + if (idx >= (int)_hotspots.size()) { + idx -= _hotspots.size(); + _vm->_events->_newCursorId = _dynamicHotspots[idx]._cursor; + } else { + idx = _hotspots.size() - idx - 1; + _vm->_events->_newCursorId = _hotspots[idx]._cursor; + } + + cursorId = _vm->_events->_newCursorId == CURSOR_NONE ? + CURSOR_ARROW : _vm->_events->_newCursorId; + } + + if (!player._stepEnabled) + cursorId = CURSOR_WAIT; + if (cursorId >= _vm->_events->_cursorSprites->getCount()) + cursorId = (CursorType)_vm->_events->_cursorSprites->getCount(); + _vm->_events->_newCursorId = cursorId; + + if (cursorId != _vm->_events->_cursorId) { + _vm->_events->setCursor(cursorId); + } +} + void Scene::free() { warning("TODO: Scene::free"); } diff --git a/engines/mads/scene.h b/engines/mads/scene.h index f7d0e56a78..e2eec23477 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -70,6 +70,11 @@ private: void doSceneStep(); void checkKeyboard(); + + /** + * Checks for a highlighted hotspot, and updates the cursor accordingly + */ + void updateCursor(); protected: MADSEngine *_vm; public: -- cgit v1.2.3 From 0b1c15e6dcd2f16d5ef67e61fd4c8c0157f66706 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 23 Mar 2014 22:40:37 -0400 Subject: MADS: Fix setting category/desc Id from highlighted screen elements --- engines/mads/screen.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index 964e83630c..5b0d4422ce 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -293,8 +293,9 @@ void ScreenObjects::check(bool scanFlag) { _category = CAT_NONE; _selectedObject = scanBackwards(_vm->_events->currentPos(), LAYER_GUI); if (_selectedObject > 0) { - _category = (ScrCategory)((*this)[_selectedObject - 1]._category & 7); - _newDescId = (*this)[_selectedObject - 1]._descId; + ScreenObject &scrObject = (*this)[_selectedObject]; + _category = (ScrCategory)(scrObject._category & 7); + _newDescId = scrObject._descId; } // Handling for easy mouse -- cgit v1.2.3 From 48e785c329937868b403869414344dbc78525a95 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 24 Mar 2014 19:15:59 +0100 Subject: MADS: Fix a couple of warnings in the hotspot code --- engines/mads/hotspots.h | 2 +- engines/mads/user_interface.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/mads/hotspots.h b/engines/mads/hotspots.h index ec9f12dc77..37c37fa1c2 100644 --- a/engines/mads/hotspots.h +++ b/engines/mads/hotspots.h @@ -57,7 +57,7 @@ public: public: DynamicHotspots(MADSEngine *vm); - int size() const { return _entries.size(); } + Common::Array::size_type size() const { return _entries.size(); } DynamicHotspot &operator[](uint idx) { return _entries[idx]; } int add(int descId, int vocabId, int seqIndex, const Common::Rect &bounds); int setPosition(int index, int xp, int yp, int facing); diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 2ea656d0c5..28fc5a6e55 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -665,7 +665,7 @@ void UserInterface::scrollInventory() { _scrollFlag = true; if (yp == (MADS_SCREEN_HEIGHT - 1)) { - if (_inventoryTopIndex < (invList.size() - 1)) { + if (_inventoryTopIndex < (int)(invList.size() - 1)) { ++_inventoryTopIndex; _inventoryChanged = true; } -- cgit v1.2.3 From aef340c25a7c7cae2b0955549e412abf842e4f47 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 24 Mar 2014 19:16:52 +0100 Subject: MADS: Implement Scene205::setup and Scene205::enter --- engines/mads/animation.h | 4 +- engines/mads/nebular/globals_nebular.cpp | 1 + engines/mads/nebular/globals_nebular.h | 2 +- engines/mads/nebular/nebular_scenes.h | 6 +- engines/mads/nebular/nebular_scenes2.cpp | 94 ++++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes2.h | 11 ++++ 6 files changed, 114 insertions(+), 4 deletions(-) diff --git a/engines/mads/animation.h b/engines/mads/animation.h index dd902b8b68..1207ff6100 100644 --- a/engines/mads/animation.h +++ b/engines/mads/animation.h @@ -121,7 +121,6 @@ private: Font *_font; int _currentFrame, _oldFrameEntry; - bool _resetFlag; bool _freeFlag; bool _skipLoad; int _unkIndex; @@ -154,8 +153,9 @@ private: protected: Animation(MADSEngine *vm, Scene *scene); public: + bool _resetFlag; + static Animation *init(MADSEngine *vm, Scene *scene); -public: /* * Destructor */ diff --git a/engines/mads/nebular/globals_nebular.cpp b/engines/mads/nebular/globals_nebular.cpp index d2a82d50b0..adc58e66aa 100644 --- a/engines/mads/nebular/globals_nebular.cpp +++ b/engines/mads/nebular/globals_nebular.cpp @@ -50,6 +50,7 @@ Globals::Globals() { _v84264 = 0; _v84266 = 0; _v84268 = 0; + _v84274 = 0; } } // End of namespace Nebular diff --git a/engines/mads/nebular/globals_nebular.h b/engines/mads/nebular/globals_nebular.h index bbc235307f..95117a3389 100644 --- a/engines/mads/nebular/globals_nebular.h +++ b/engines/mads/nebular/globals_nebular.h @@ -48,7 +48,7 @@ public: int _v8; int _abortVal; uint32 _v8425C; - int _v84260, _v84262, _v84264, _v84266, _v84268; + int _v84260, _v84262, _v84264, _v84266, _v84268, _v84274; public: /** * Constructor diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index 6b2b101c62..895ee51cfa 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -44,6 +44,7 @@ enum Noun { NOUN_2C = 0x2C, NOUN_BURGER = 0x35, NOUN_CHAIR = 0x47, + NOUN_49 = 0x49, NOUN_4E = 0x4E, NOUN_DEAD_FISH = 0x65, NOUN_DOOR = 0x6E, @@ -70,6 +71,7 @@ enum Noun { NOUN_OUTER_HULL = 0x0F8, NOUN_OUTSIDE = 0x0F9, NOUN_PEER_THROUGH = 0x103, + NOUN_10D = 0x10D, NOUN_PLANT_STALK = 0x10F, NOUN_READ = 0x11F, NOUN_REFRIDGERATOR = 0x122, @@ -109,7 +111,7 @@ protected: MADSAction &_action; /** - * Forms an animation resoucre name + * Forms an animation resource name */ Common::String formAnimName(char sepChar, int suffixNum); @@ -122,6 +124,8 @@ public: * Constructor */ NebularScene(MADSEngine *vm); + + void sub7178C(); }; class SceneInfoNebular : public SceneInfo { diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 65a285860a..c6ae09c51d 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -1087,5 +1087,99 @@ void Scene203::actions() { _action._inProgress = false; } +/*****************************************************************************/ + +void Scene205::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(NOUN_D); + _scene->addActiveVocab(NOUN_49); + _scene->addActiveVocab(NOUN_10D); +} + +void Scene205::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 0), 0); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 1), 0); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 2), 0); + _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('f', -1), 0); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('c', -1), 0); + _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('p', -1), 0); + + if (_globals[0] == SEX_MALE) + _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('a', 1), 0); + + _globals._spriteIndexes[16] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 10, 0, 0, 3); + int idx = _scene->_dynamicHotspots.add(73, 13, _globals._spriteIndexes[16], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, 162, 120, 9); + + _globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 15, 0, 0, 0); + idx = _scene->_dynamicHotspots.add(73, 13, _globals._spriteIndexes[16], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, 162, 120, 9); + + _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 9, 0, 0, 0); + _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 6, 0, 0, 0); + _scene->_sequences.setDepth(_globals._spriteIndexes[20], 11); + + if (!_game._visitedScenes._sceneRevisited) { + _globals._v2 = _scene->_frameStartTime & 0xFFFF; + _globals._v3 = _scene->_frameStartTime >> 16; + _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 7, 1, 0, 0); + idx = _scene->_dynamicHotspots.add(269, 13, _globals._spriteIndexes[21], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, 49, 86, 8); + } + + if (_game._objects[12]._roomNumber == 0) { + _globals._spriteIndexes[19] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 7, 0, 0, 0); + _scene->_sequences.setDepth(_globals._spriteIndexes[19], 11); + } else { + _scene->_hotspots.activate(450, false); + } + + _globals._frameTime &= 0xFFFF; + _game.loadQuoteSet(0x6B, 0x70, 0x71, 0x72, 0x5A, 0x74, 0x75, 0x76, 0x77, 0x78, 0x73, 0x79, 0x7A, 0x7B, 0x7C, + 0x7D, 0x7E, 0x7F, 0x80, 0xAC, 0xAD, 0xAE, 0x6C, 0x6D, 0x6E, 0x6F, 0x2, 0); + warning("TODO: sub71A50(_globals._v4, 0x5A, 0x78, 0x74, 0x75, 0x76, 0x77, 0);"); + + if (!_game._visitedScenes._sceneRevisited) + warning("TODO: sub71B18(_globals._v4, 0x5A, 0x74, 0x75, 0x77, 0);"); + + + _vm->_palette->setEntry(250, 63, 50, 20); + _vm->_palette->setEntry(251, 50, 40, 15); + _vm->_palette->setEntry(252, 63, 63, 40); + _vm->_palette->setEntry(253, 50, 50, 30); + + _globals._v0 = _globals._frameTime & 0xFFFF; + _globals._frameTime >>= 16; + + if (_globals[0] == SEX_FEMALE) + warning("sub71704(0x3, 0xC3, 0x108, 0x63, 0x86, 0xD, 2, 0xFDFC, 0x3C, 0x6C, 0x6C, 0x6D, 0x6D, 0x6E, 0x6E, 0x6F, 0x6C, 0);"); + + if (_scene->_priorSceneId != -2) + _game._player._playerPos = Common::Point(99, 152); + + if (_globals[0] != SEX_MALE) { + _scene->loadAnimation(formAnimName('a', -1), 0); + _scene->_activeAnimation->_resetFlag = false; + } else { + _globals._frameTime |= 0xFFFF0000; + _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8, 1, 0, 0); + _game._player._visible = false; + _game._player._stepEnabled = false; + _scene->_sequences.setDepth(_globals._spriteIndexes[23], 2); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_FRAME_INDEX, 6, 73); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_FRAME_INDEX, 11, 74); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 0); + } + _globals._v84274 = -1; + sceneEntrySound(); +} + +void Scene205::step() { +} + +void Scene205::actions() { +} + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index b49cf96809..5346b34d08 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -89,6 +89,17 @@ public: virtual void actions(); virtual void postActions() {}; }; + +class Scene205: public Scene2xx { +public: + Scene205(MADSEngine *vm) : Scene2xx(vm) {} + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions(); + virtual void postActions() {}; +}; } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From c177056653d09f16dbf8a28bd93d048f95e9398a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 24 Mar 2014 21:13:46 +0100 Subject: MADS: Add detection for another Rex --- engines/mads/detection_tables.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/engines/mads/detection_tables.h b/engines/mads/detection_tables.h index ac5316d4b4..d7614cfb6e 100644 --- a/engines/mads/detection_tables.h +++ b/engines/mads/detection_tables.h @@ -41,6 +41,24 @@ static const MADSGameDescription gameDescriptions[] = { 0 }, + { + // Rex Nebular and the Cosmic Gender Bender DOS English + { + "nebular", + 0, + { + {"section1.hag", 0, "6f725eb38660de8af31ec7cdd628d615", 927222}, + AD_LISTEND + }, + Common::EN_ANY, + Common::kPlatformDOS, + ADGF_NO_FLAGS, + GUIO1(GUIO_NONE) + }, + GType_RexNebular, + 0 + }, + { AD_TABLE_END_MARKER } }; -- cgit v1.2.3 From d958f509241714f140c95e7afa0005b1fe5c8352 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 24 Mar 2014 22:33:49 -0400 Subject: MADS: Fix incorrect palette for player sprites --- engines/mads/palette.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index 4a62cca5bc..f57766ebf1 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -107,10 +107,10 @@ int PaletteUsage::process(Common::Array &palette, uint flags) { bool flag1 = false; if (hasUsage) { - if (varA || !_vm->_palette->_paletteUsage[0]) + if (varA || _vm->_palette->_paletteUsage.empty()) hasUsage = false; - if (varA && _vm->_palette->_paletteUsage[0]) + if (varA && !_vm->_palette->_paletteUsage.empty()) flag1 = true; } @@ -178,10 +178,9 @@ int PaletteUsage::process(Common::Array &palette, uint flags) { } if (!var48 && !varA) { - int var2 = !(palette[palIndex]._flags & 0x20) && ( - ((flags & 0x2000) && !(palette[palIndex]._flags & 0x40)) || - ((flags & 0x1000) && (palCount > 0)) - ) ? 1 : 0x7fff; + int var2 = (palette[palIndex]._flags & 0x20) || + (((flags & 0x2000) || (palette[palIndex]._flags & 0x4000)) && + ((flags & 0x1000) || (palCount == 0))) ? 0x7fff : 1; int var36 = (palette[palIndex]._flags & 0x80) ? 0 : 2; for (int idx = palLow; idx < palIdx; ++idx) { -- cgit v1.2.3 From 3c504f4d028efdec39b6b250948eb41522de18e2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 24 Mar 2014 22:34:09 -0400 Subject: MADS: Cleanup of user interface selection code --- engines/mads/game.cpp | 2 +- engines/mads/screen.cpp | 23 +++++++++--------- engines/mads/user_interface.cpp | 54 ++++++++++++++++++++++++++++++++++++----- engines/mads/user_interface.h | 6 +++-- 4 files changed, 65 insertions(+), 20 deletions(-) diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 4b907d1880..f155bc81c2 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -199,7 +199,7 @@ void Game::sectionLoop() { } _vm->_events->initVars(); - _scene._userInterface._v1A = -1; + _scene._userInterface._highlightedActionIndex = -1; _scene._userInterface._v1C = -1; _scene._userInterface._v1E = -1; diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index 5b0d4422ce..ba6875205f 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -437,7 +437,7 @@ void ScreenObjects::checkScroller() { if (userInterface._inventoryChanged) { int dummy; - userInterface.drawInventory(2, 0, &dummy); + userInterface.updateSelection(CAT_INV_LIST, 0, &dummy); } } } @@ -457,7 +457,7 @@ void ScreenObjects::elementHighlighted() { MADSAction &action = scene._action; int varA; int topIndex; - int *var6; + int *idxP; int var4; int index; int indexEnd = -1; @@ -470,10 +470,11 @@ void ScreenObjects::elementHighlighted() { indexEnd = 9; varA = 5; topIndex = 0; - var6 = !_v7FECA ? &userInterface._v1A : &userInterface._selectedActionIndex; + idxP = !_v7FECA ? &userInterface._highlightedActionIndex : + &userInterface._selectedActionIndex; if (_v7FECA && userInterface._selectedItemVocabIdx >= 0) - userInterface.drawInventory(3, -1, &userInterface._selectedItemVocabIdx); + userInterface.updateSelection(CAT_INV_VOCAB, -1, &userInterface._selectedItemVocabIdx); var4 = _released && !_v7FECA ? 1 : 0; break; @@ -485,7 +486,7 @@ void ScreenObjects::elementHighlighted() { indexEnd = invList.size() - 1; varA = 0; topIndex = userInterface._inventoryTopIndex; - var6 = &userInterface._v1C; + idxP = &userInterface._v1C; var4 = (!_released || (_vm->_events->_mouseButtons && action._v83338 == 1)) ? 0 : 1; break; @@ -501,10 +502,10 @@ void ScreenObjects::elementHighlighted() { varA = 0; topIndex = 0; - var6 = _v7FECA ? &userInterface._selectedItemVocabIdx : &userInterface._v1E; + idxP = _v7FECA ? &userInterface._selectedItemVocabIdx : &userInterface._v1E; if (_v7FECA && userInterface._selectedActionIndex >= 0) - userInterface.drawInventory(1, -1, &userInterface._selectedActionIndex); + userInterface.updateSelection(CAT_ACTION, -1, &userInterface._selectedActionIndex); var4 = _released && !_v7FECA ? 1 : 0; break; @@ -514,7 +515,7 @@ void ScreenObjects::elementHighlighted() { indexEnd = invList.size() - 1; varA = 0; topIndex = userInterface._selectedInvIndex; - var6 = &var8; + idxP = &var8; var4 = -1; break; @@ -528,7 +529,7 @@ void ScreenObjects::elementHighlighted() { indexEnd = index - 1; varA = 0; topIndex = 0; - var6 = &userInterface._v1A; + idxP = &userInterface._highlightedActionIndex; var4 = -1; break; @@ -538,7 +539,7 @@ void ScreenObjects::elementHighlighted() { indexEnd = index - 1; varA = 0; topIndex = 0; - var6 = &var8; + idxP = &var8; var4 = -1; break; } @@ -606,7 +607,7 @@ void ScreenObjects::elementHighlighted() { newIndex = -1; if (_category != CAT_HOTSPOT && _category != CAT_INV_ANIM) - userInterface.drawInventory(_category, newIndex, var6); + userInterface.updateSelection(_category, newIndex, idxP); } void ScreenObjects::setActive(ScrCategory category, int descId, bool active) { diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 28fc5a6e55..67fb50e4ac 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -199,7 +199,7 @@ UserInterface::UserInterface(MADSEngine *vm) : _vm(vm), _dirtyAreas(vm), _selectedActionIndex = -1; _selectedItemVocabIdx = -1; _scrollerY = 0; - _v1A = -1; + _highlightedActionIndex = -1; _v1C = -1; _v1E = -1; _dirtyAreas.resize(50); @@ -264,7 +264,7 @@ void UserInterface::setup(int id) { scene._userInterface._uiSlots.clear(); scene._userInterface._uiSlots.fullRefresh(); _vm->_game->_ticksExpiry = _vm->_events->getFrameCounter(); - _v1A = -1; + _highlightedActionIndex = -1; _v1E = -1; _v1C = -1; @@ -331,7 +331,7 @@ void UserInterface::writeVocab(ScrCategory category, int id) { case CAT_ACTION: font = _vm->_font->getFont(FONT_INTERFACE); vocabId = scene._verbList[id]._id; - if (_v1A) { + if (_highlightedActionIndex) { _vm->_font->setColorMode(1); } else { _vm->_font->setColorMode(id == _selectedActionIndex ? 2 : 0); @@ -642,8 +642,50 @@ void UserInterface::selectObject(int invIndex) { warning("TODO: selectObject"); } -void UserInterface::drawInventory(int v1, int v2, int *v3) { - warning("TODO: drawInventory"); +void UserInterface::updateSelection(ScrCategory category, int newIndex, int *idx) { + Game &game = *_vm->_game; + Common::Rect bounds; + + if (category == CAT_INV_LIST && _inventoryChanged) { + *idx = newIndex; + bounds = Common::Rect(90, 3, 90 + 69, 3 + 40); + _uiSlots.add(Common::Point(90, 3), 69, 40); + _uiSlots.draw(false, false); + drawInventoryList(); + updateRect(bounds); + _inventoryChanged = false; + + if (game._objects._inventoryList.size() > 1) { + _objectY = 0; + } else { + int v = _inventoryTopIndex * 18 / (game._objects._inventoryList.size() - 1); + _objectY = MIN(v, 17); + } + } else { + int oldIndex = *idx; + *idx = newIndex; + + if (oldIndex >= 0) { + Common::Rect bounds; + writeVocab(category, oldIndex); + + if (getBounds(category, oldIndex, bounds)) + updateRect(bounds); + } + + if (newIndex >= 0) { + writeVocab(category, newIndex); + + if (getBounds(category, newIndex, bounds)) + updateRect(bounds); + } + } +} + +void UserInterface::updateRect(const Common::Rect &bounds) { + _vm->_screen.setPointer(&_surface); + setBounds(Common::Rect(0, MADS_SCENE_HEIGHT, MADS_SCREEN_WIDTH - 1, MADS_SCREEN_HEIGHT)); + _vm->_screen.copyRectToScreen(bounds); } void UserInterface::scrollerChanged() { @@ -665,7 +707,7 @@ void UserInterface::scrollInventory() { _scrollFlag = true; if (yp == (MADS_SCREEN_HEIGHT - 1)) { - if (_inventoryTopIndex < (int)(invList.size() - 1)) { + if (_inventoryTopIndex < ((int)invList.size() - 1)) { ++_inventoryTopIndex; _inventoryChanged = true; } diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h index abb4619cf5..ee5bc7aa0d 100644 --- a/engines/mads/user_interface.h +++ b/engines/mads/user_interface.h @@ -128,6 +128,8 @@ private: void writeVocab(ScrCategory category, int id); void refresh(); + + void updateRect(const Common::Rect &bounds); public: MSurface _surface; UISlots _uiSlots; @@ -141,7 +143,7 @@ public: int _selectedActionIndex; int _selectedItemVocabIdx; int _scrollerY; - int _v1A; + int _highlightedActionIndex; int _v1C; int _v1E; bool _inventoryChanged; @@ -191,7 +193,7 @@ public: */ void selectObject(int invIndex); - void drawInventory(int v1, int v2, int *v3); + void updateSelection(ScrCategory category, int newIndex, int *idx); void scrollerChanged(); -- cgit v1.2.3 From 2879b895bc301b46a4d9098de56fabfc2434f0f8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 25 Mar 2014 08:55:29 -0400 Subject: MADS: Fixes for UI item selection, add added an enum for Font::setColorMode --- engines/mads/font.cpp | 8 ++++---- engines/mads/font.h | 6 +++++- engines/mads/screen.cpp | 2 +- engines/mads/user_interface.cpp | 21 +++++++++++---------- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/engines/mads/font.cpp b/engines/mads/font.cpp index e3497b3b14..e511bd8371 100644 --- a/engines/mads/font.cpp +++ b/engines/mads/font.cpp @@ -118,15 +118,15 @@ void Font::setColors(uint8 v1, uint8 v2, uint8 v3, uint8 v4) { _fontColors[2] = v3; } -void Font::setColorMode(int mode) { +void Font::setColorMode(SelectionMode mode) { switch (mode) { - case 0: + case SELMODE_UNSELECTED: setColors(0xFF, 4, 4, 0); break; - case 1: + case SELMODE_HIGHLIGHTED: setColors(0xFF, 5, 5, 0); break; - case 2: + case SELMODE_SELECTED: setColors(0xFF, 6, 6, 0); break; default: diff --git a/engines/mads/font.h b/engines/mads/font.h index 5079f1261f..1511b60a82 100644 --- a/engines/mads/font.h +++ b/engines/mads/font.h @@ -39,6 +39,10 @@ namespace MADS { #define FONT_TELE "*FONTTELE.FF" // Not in Phantom #define FONT_PHAN "*FONTPHAN.FF" // Phantom only +enum SelectionMode { + SELMODE_UNSELECTED = 0, SELMODE_HIGHLIGHTED = 1, SELMODE_SELECTED = 2 +}; + class MADSEngine; class Font { @@ -77,7 +81,7 @@ public: virtual ~Font(); void setColors(uint8 v1, uint8 v2, uint8 v3, uint8 v4); - void setColorMode(int mode); + void setColorMode(SelectionMode mode); int maxWidth() const { return _maxWidth; } int getWidth(const Common::String &msg, int spaceWidth = -1); diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index ba6875205f..a2cc75f381 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -575,7 +575,7 @@ void ScreenObjects::elementHighlighted() { if (currentPos.x > bounds.left) newIndex = idx; } else { - if (currentPos.x > bounds.right) + if (currentPos.x < bounds.right) newIndex = idx; } } diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 67fb50e4ac..b45ff14633 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -331,10 +331,10 @@ void UserInterface::writeVocab(ScrCategory category, int id) { case CAT_ACTION: font = _vm->_font->getFont(FONT_INTERFACE); vocabId = scene._verbList[id]._id; - if (_highlightedActionIndex) { - _vm->_font->setColorMode(1); + if (id == _highlightedActionIndex) { + _vm->_font->setColorMode(SELMODE_HIGHLIGHTED); } else { - _vm->_font->setColorMode(id == _selectedActionIndex ? 2 : 0); + _vm->_font->setColorMode(id == _selectedActionIndex ? SELMODE_SELECTED : SELMODE_UNSELECTED); } vocabStr = scene.getVocab(vocabId); vocabStr.setChar(toupper(vocabStr[0]), 0); @@ -344,10 +344,10 @@ void UserInterface::writeVocab(ScrCategory category, int id) { case CAT_INV_LIST: font = _vm->_font->getFont(FONT_INTERFACE); vocabId = _vm->_game->_objects.getItem(id)._descId; - if (_v1C == id) { - _vm->_font->setColorMode(1); + if (id == _v1C) { + _vm->_font->setColorMode(SELMODE_HIGHLIGHTED); } else { - _vm->_font->setColorMode(id == _selectedInvIndex ? 2 : 0); + _vm->_font->setColorMode(id == _selectedInvIndex ? SELMODE_SELECTED : SELMODE_UNSELECTED); vocabStr = scene.getVocab(vocabId); vocabStr.setChar(toupper(vocabStr[0]), 0); font->writeString(this, vocabStr, Common::Point(bounds.left, bounds.top)); @@ -378,16 +378,17 @@ void UserInterface::writeVocab(ScrCategory category, int id) { break; } - font->setColorMode((id == 4) || (_scrollerY == 3) ? 1 : 0); + font->setColorMode((id == 4) || (_scrollerY == 3) ? SELMODE_HIGHLIGHTED : SELMODE_UNSELECTED); font->writeString(this, vocabStr, Common::Point(bounds.left, bounds.top)); break; default: + // Item specific verbs font = _vm->_font->getFont(FONT_INTERFACE); vocabId = _vm->_game->_objects.getItem(_selectedInvIndex)._vocabList[id]._vocabId; - if (_v1E == id) { - _vm->_font->setColorMode(1); + if (id == _v1E) { + _vm->_font->setColorMode(SELMODE_HIGHLIGHTED); } else { - _vm->_font->setColorMode(id == _selectedInvIndex ? 2 : 0); + _vm->_font->setColorMode(id == _selectedInvIndex ? SELMODE_SELECTED : SELMODE_UNSELECTED); vocabStr = scene.getVocab(vocabId); vocabStr.setChar(toupper(vocabStr[0]), 0); font->writeString(this, vocabStr, Common::Point(bounds.left, bounds.top)); -- cgit v1.2.3 From 9028484d4b277565005a5a46444ac7b83cba6fe8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 25 Mar 2014 20:34:41 +0100 Subject: MADS: Start work on Scene 207 --- engines/mads/nebular/nebular_scenes.cpp | 4 + engines/mads/nebular/nebular_scenes2.cpp | 125 +++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes2.h | 11 +++ 3 files changed, 140 insertions(+) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 6f799475cb..0f35e5d406 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -57,6 +57,10 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene202(vm); case 203: return new Scene203(vm); + case 205: + return new Scene205(vm); + case 207: + return new Scene207(vm); // Scene group #8 case 804: diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index c6ae09c51d..ed254a47d5 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -1176,9 +1176,134 @@ void Scene205::enter() { } void Scene205::step() { + warning("TODO: Scene205::step"); } void Scene205::actions() { + warning("TODO: Scene205::actions"); +} + +/*****************************************************************************/ + +void Scene207::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(0x185); + _scene->addActiveVocab(NOUN_D); + _scene->addActiveVocab(0x14D); + _scene->addActiveVocab(NOUN_D); +} + +void Scene207::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('h', 0), 0); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('h', 1), 0); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('c', -1), 0); + _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('e', 0), 0); + _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('e', 1), 0); + _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('g', 1), 0); + _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('g', 0), 0); + _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 7, 0, 0, 0); + _scene->_sequences.setDepth(_globals._spriteIndexes[20], 7); + + int var2; + if (!_game._visitedScenes._sceneRevisited) { + var2 = 1; + } else { + var2 = _vm->getRandomNumber(4) + 1; + } + + if (var2 > 2) + _globals._v0 = 0; + else + _globals._v0 = 1; + + _globals._v5 = (var2 & 1); + + if (_globals._v0) { + _globals._spriteIndexes[16] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 30, 0, 0, 400); + _globals._frameTime = _game._player._priorTimer; + + int idx = _scene->_dynamicHotspots.add(389, 13, _globals._spriteIndexes[16], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, 254, 94, 4); + } + + if (_globals._v5) { + _globals._spriteIndexes[19] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 7, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[19], -1, -1); + _globals._v3 = _game._player._priorTimer & 0xFFFF; + _globals._v4 = _game._player._priorTimer >> 16; + int idx = _scene->_dynamicHotspots.add(333, 13, _globals._spriteIndexes[19], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, 59, 132, 2); + } + + _globals._v2 = 0; + if (_scene->_priorSceneId == 211) { + _game._player._playerPos = Common::Point(13, 105); + _game._player._direction = 6; + } else if (_scene->_priorSceneId == 214) { + _game._player._playerPos = Common::Point(164, 117); + _game._player._direction = 2; + } else if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(305, 131); + } + + _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 10, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[21], 1, 22); + _scene->_sequences.setDepth(_globals._spriteIndexes[21], 6); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[21], SM_0, 0, 70); +} + +void Scene207::step() { + if (!_globals._v0) { + warning("TODO: sub3AD90(...)"); + } + + if (_globals._v5) { + warning("TODO: sub3ADD6(...)"); + } + + if (_game._abortTimers == 70) { + _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 10, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[21], 23, 34); + _scene->_sequences.setDepth(_globals._spriteIndexes[21], 6); + } + + if (_game._abortTimers == 71) + _globals._v2 = 0; + + if (_globals._v2) + return; + + if ((_game._player._playerPos.x >= 124) && (_game._player._playerPos.x <= 201)) { + _globals._spriteIndexes[22] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 10, 1, 0, 0); + _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8, 1, 0, 0); + _scene->_sequences.setDepth(_globals._spriteIndexes[22], 6); + _scene->_sequences.setDepth(_globals._spriteIndexes[23], 6); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[22], SM_0, 0, 71); + _globals._v2 = -1; + } +} + +void Scene207::preActions() { + if (_action.isAction(0x1AD, 0x1AE, 0)) + _game._player._v844BE = 211; + + if (_action.isAction(0x18C, 0x1AB, 0)) + _game._player._v844BE = 208; + + if ((_action.isAction(0xD, 0)) || (_action.isAction(0x3, 0))) { + if (_action.isAction(0x185, 0)) { + _globals._frameTime = 0xD8F1; + _globals._frameTime |= 0xFFFF0000; + } else if (_action.isAction(0x14D, 0)) { + _globals._v3 = 0xD8F1; + _globals._v4 = -1; + } + } +} + +void Scene207::actions() { + } } // End of namespace Nebular diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index 5346b34d08..6d25f5d172 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -100,6 +100,17 @@ public: virtual void actions(); virtual void postActions() {}; }; + +class Scene207: public Scene2xx { +public: + Scene207(MADSEngine *vm) : Scene2xx(vm) {} + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From c09bfdab2f00c888debb0e81d956fb0c2397ef9c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 25 Mar 2014 20:46:10 +0100 Subject: MADS: Finish Scene 207 --- engines/mads/nebular/nebular_scenes2.cpp | 55 ++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index ed254a47d5..0e6e715f71 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -1303,8 +1303,63 @@ void Scene207::preActions() { } void Scene207::actions() { + if (_action._savedFields._lookFlag) { + Dialog::show(0x50E7); + } else { + if (_action.isAction(0x18B, 0x70, 0)) + _scene->_nextSceneId = 214; + else { + if ((_game._player._playerPos.x > 150) && (_game._player._playerPos.x < 189) && + (_game._player._playerPos.y > 111) && (_game._player._playerPos.y < 130)) { + if ((_game._player._playerPos.x <= 162) && (_game._player._playerPos.x >= 181) && + (_game._player._playerPos.y <= 115) && (_game._player._playerPos.y >= 126)) { + _globals._spriteIndexes[22] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 10, 2, 0, 0); + _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8, 2, 0, 0); + _scene->_sequences.setDepth(_globals._spriteIndexes[22], 6); + _scene->_sequences.setDepth(_globals._spriteIndexes[23], 6); + } + } else if (_globals._v2) { + _scene->_sequences.remove(_globals._spriteIndexes[22]); + _scene->_sequences.remove(_globals._spriteIndexes[23]); + _globals._v2 = 0; + } + if (_action.isAction(3, 0x69, 0)) { + Dialog::show(0x50DD); + } else if (_action.isAction(3, 0x1AF, 0)) { + Dialog::show(0x50DE); + } else if (_action.isAction(3, 0x141, 0)) { + Dialog::show(0x50DF); + } else if (_action.isAction(3, 0x3E, 0)) { + Dialog::show(0x50E0); + } else if (_action.isAction(3, 0x198, 0)) { + Dialog::show(0x50E1); + } else if (_action.isAction(3, 0x1AE, 0)) { + Dialog::show(0x50E2); + } else if (_action.isAction(3, 0xE8, 0)) { + Dialog::show(0x50E3); + } else if (_action.isAction(3, 0x12, 0)) { + Dialog::show(0x50E4); + } else if (_action.isAction(3, 0x1AC, 0)) { + Dialog::show(0x50E5); + } else if (_action.isAction(3, 0x185, 0)) { + Dialog::show(0x50E6); + } else if (_action.isAction(4, 0x141, 0)) { + Dialog::show(0x50E8); + } else if (_action.isAction(4, 0x12, 0)) { + Dialog::show(0x50E9); + } else if (_action.isAction(3, 0x14D, 0)) { + Dialog::show(0x50EA); + } else if (_action.isAction(4, 0x14D, 0)) { + Dialog::show(0x50EB); + } else + return; + } + } + _action._inProgress = false; } +/*****************************************************************************/ + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 633da299f694a9998a0cdb002a08613750f36e61 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 25 Mar 2014 22:01:25 +0100 Subject: MADS: Add scene 208 --- engines/mads/game.h | 3 +- engines/mads/messages.h | 2 +- engines/mads/nebular/nebular_scenes.cpp | 2 + engines/mads/nebular/nebular_scenes2.cpp | 181 +++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes2.h | 12 ++ 5 files changed, 198 insertions(+), 2 deletions(-) diff --git a/engines/mads/game.h b/engines/mads/game.h index bf81c23d81..c5a3dd3be0 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -62,7 +62,6 @@ private: protected: MADSEngine *_vm; MSurface *_surface; - Difficulty _difficultyLevel; int _saveSlot; int _statusFlag; Common::StringArray _quotes; @@ -110,9 +109,11 @@ protected: public: static Game *init(MADSEngine *vm); + public: Player _player; ScreenObjects _screenObjects; + Difficulty _difficultyLevel; int _sectionNumber; int _priorSectionNumber; int _currentSectionNumber; diff --git a/engines/mads/messages.h b/engines/mads/messages.h index 90269c12b5..03a4e01234 100644 --- a/engines/mads/messages.h +++ b/engines/mads/messages.h @@ -68,8 +68,8 @@ class KernelMessages { private: MADSEngine *_vm; Common::Array _entries; - Font *_talkFont; public: + Font *_talkFont; KernelMessages(MADSEngine *vm); ~KernelMessages(); diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 0f35e5d406..39a8ed58b4 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -61,6 +61,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene205(vm); case 207: return new Scene207(vm); + case 208: + return new Scene208(vm); // Scene group #8 case 804: diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 0e6e715f71..c4fee2be68 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -1361,5 +1361,186 @@ void Scene207::actions() { /*****************************************************************************/ +void Scene208::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(0x1A8); + _scene->addActiveVocab(0x1A9); + _scene->addActiveVocab(0x1AA); + _scene->addActiveVocab(NOUN_D); +} + +void Scene208::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('a', 1), 0); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 0), 0); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 1), 0); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('x', 2), 0); + _globals._spriteIndexes[5] = _scene->_sprites.addSprites("*RXMBD_8"); + + warning("TODO: sub34648()"); + + _globals._v0 = 0; + _globals._frameTime = 0; + _scene->_kernelMessages._talkFont = _vm->_font->getFont(FONT_INTERFACE); + _scene->_textSpacing = 0; + + if (_scene->_priorSceneId == 207) { + _game._player._playerPos = Common::Point(8, 122); + _game._player._direction = 6; + } else if (_scene->_priorSceneId == 203) { + _game._player._playerPos = Common::Point(142, 108); + _game._player._direction = 2; + } else if (_scene->_priorSceneId == 209) { + _game._player._playerPos = Common::Point(307, 123); + _game._player._direction = 4; + } else if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(162, 149); + _game._player._direction = 8; + } + + _game.loadQuoteSet(0x81, 0x46, 0); + + if ((_scene->_priorSceneId == 207) && (_globals[36] == 1)) { + int msgIndex = _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(129)); + _scene->_kernelMessages.setQuoted(msgIndex, 4, true); + } + + _vm->_palette->setEntry(16, 0, 0, 63); + _vm->_palette->setEntry(17, 0, 0, 45); + sceneEntrySound(); +} + +void Scene208::step() { + if ((_globals._frameTime & 0xFFFF) && ((_globals._frameTime >> 16) <= _scene->_activeAnimation->getCurrentFrame())) { + _globals._frameTime = (_globals._frameTime & 0xFFFF) | (_scene->_activeAnimation->getCurrentFrame() << 16); + + if (_scene->_activeAnimation->getCurrentFrame() == 125) + _scene->_sequences.remove(_globals._spriteIndexes[19]); + } + + if (_globals._v0 == 0) + return; + + if ((_game._player._playerPos != Common::Point(20, 148)) || (_game._player._direction != 6)) + return; + + if ((_game._abortTimers == 0) && ((_globals._frameTime & 0xFFFF) != 0)) + return; + + _globals._frameTime |= 0xFFFF; + + if (_game._abortTimers == 82) { + _game._player._stepEnabled = true; + return; + } + + if (_game._abortTimers > 82) + return; + + if (_game._abortTimers & 0xFF) { + if ((_game._abortTimers & 0xFF) == 81) { + _scene->_sequences.remove(_globals._spriteIndexes[15]); + _globals[34] = 1; + warning("TODO: sub34648(...)"); + _scene->_sequences.addTimer(90, 82); + } + } else { + _scene->loadAnimation(formAnimName('A', -1), 81); + } +} + +void Scene208::preActions() { + if (_action.isAction(3, 0) && _action._walkFlag) + _action._startWalkFlag = true; + + if (_action.isAction(0x18C, 0x9B, 0)) + _game._player._v844BE = 209; + + if (_action.isAction(0x18C, 0xF6, 0)) + _game._player._v844BE = 207; +} + +void Scene208::actions() { + if (_action.isAction(0x18C, 0x19F, 0)) { + if (_globals[34]) + _scene->_nextSceneId = 203; + else if (_game._abortTimers == 0) { + _game._player._stepEnabled = false; + int msgIndex = _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 1, 120, _game.getQuote(70)); + _scene->_kernelMessages.setQuoted(msgIndex, 4, true); + } else if (_game._abortTimers == 1) { + _scene->_nextSceneId = 203; + } + } else if (_action.isAction(0x18C, 0x83, 0)) { + _scene->_nextSceneId = 212; + } else if (_action.isAction(0x4, 0x1AA, 0) && (!_globals[35] || _game._abortTimers)) { + warning("TODO: sub3B282(1);"); + if (_game._player._stepEnabled) + _vm->_dialogs->showPicture(OBJ_BIG_LEAVES, 0x326, 0); + } else if (_action.isAction(0x7, 0x23, 0x19E) && (_globals[35] == 1 || _game._abortTimers)) { + warning("TODO: sub3B282(2);"); + } else if (_action.isAction(0x7, 0x17A, 0x1A9)) { + warning("TODO: sub3B282(3);"); + if (_game._player._stepEnabled) { + _game._player._stepEnabled = false; + _globals._v0 = true; + _game._player.startWalking(Common::Point(20, 148), 6); + } + } else if (_action.isAction(0x7, 0x35, 0x1A9)) { + warning("TODO: sub3B282(4);"); + if (_game._player._stepEnabled) { + Dialog::show(0x514C); + } + } else if (_action.isAction(0x7, 0x65, 0x1A9)) { + warning("TODO: sub3B282(5);"); + if (_game._player._stepEnabled) { + Dialog::show(0x514C); + } + } else if (_action.isAction(0x3, 0x5D, 0)) { + Dialog::show(0x5141); + } else if (_action.isAction(0x3, 0xF6, 0)) { + Dialog::show(0x5142); + } else if (_action.isAction(0x3, 0x16F, 0)) { + Dialog::show(0x5143); + } else if (_action.isAction(0x3, 0x129, 0)) { + Dialog::show(0x5144); + } else if (_action.isAction(0x3, 0x1A1, 0)) { + Dialog::show(0x5145); + } else if (_action.isAction(0x4, 0x1A1, 0)) { + Dialog::show(0x5146); + } else if (_action.isAction(0x3, 0x9B, 0)) { + Dialog::show(0x5147); + } else if (_action.isAction(0x3, 0x19E, 0)) { + Dialog::show(0x5148); + } else if (_action.isAction(0x3, 0x1AA, 0)) { + Dialog::show(0x5149); + } else if (_action.isAction(0x3, 0x1A9, 0)) { + if (_game._difficultyLevel == DIFFICULTY_EASY) + Dialog::show(0x514A); + else + Dialog::show(0x514B); + } else if (_action.isAction(0x3, 0x174, 0) || _action.isAction(0x3, 0x175, 0)) { + Dialog::show(0x514D); + } else if (_action.isAction(0x4, 0x1A9, 0)) { + Dialog::show(0x514E); + } else if (_action.isAction(0x3, 0x1A8, 0)) { + Dialog::show(0x514F); + } else if (_action.isAction(0x4, 0x1A8, 0) || _action.isAction(0xA, 0x1A8, 0)) { + Dialog::show(0x5150); + } else if (_action._savedFields._lookFlag == 0) { + return; + } else if (_globals[34] == 1) { + Dialog::show(0x5153); + } else if (_globals[35] == 2) { + Dialog::show(0x5152); + } else { + Dialog::show(0x5151); + } + + _action._inProgress = false; +} + +/*****************************************************************************/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index 6d25f5d172..7a5af6ff41 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -111,6 +111,18 @@ public: virtual void actions(); virtual void postActions() {}; }; + +class Scene208: public Scene2xx { +public: + Scene208(MADSEngine *vm) : Scene2xx(vm) {} + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From e9977e81d0c3ab13d934755e37a93f62b78a65cb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 25 Mar 2014 21:20:44 -0400 Subject: MADS: Fixes and cleanup for palette loading --- engines/mads/assets.cpp | 9 ++++++-- engines/mads/palette.cpp | 46 ++++++----------------------------------- engines/mads/palette.h | 5 +++-- engines/mads/staticres.cpp | 5 +++++ engines/mads/staticres.h | 2 ++ engines/mads/user_interface.cpp | 9 ++++---- 6 files changed, 28 insertions(+), 48 deletions(-) diff --git a/engines/mads/assets.cpp b/engines/mads/assets.cpp index a84d1940df..02b91aac2f 100644 --- a/engines/mads/assets.cpp +++ b/engines/mads/assets.cpp @@ -84,10 +84,15 @@ void SpriteAsset::load(Common::SeekableReadStream *stream, int flags) { palette.resize(numColors); for (int i = 0; i < numColors; ++i) palette[i].load(palStream); + delete palStream; // Process the palette data - _vm->_palette->_paletteUsage.process(palette, flags); - delete palStream; + if (flags & 9) { + warning("TODO: Unknown palette processing"); + } else { + _usageIndex = _vm->_palette->_paletteUsage.process(palette, flags); + assert(_usageIndex >= 0); + } spriteStream = sprite.getItemStream(1); Common::SeekableReadStream *spriteDataStream = sprite.getItemStream(3); diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index f57766ebf1..94ce52e88b 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -25,6 +25,7 @@ #include "graphics/palette.h" #include "mads/mads.h" #include "mads/msurface.h" +#include "mads/staticres.h" namespace MADS { @@ -464,54 +465,19 @@ void Palette::initPalette() { _rgbList.reset(); } -const uint32 DEFAULT_VGA_PALETTE[PALETTE_COUNT] = { - 0x000000, 0x0000a8, 0x00a800, 0x00a8a8, 0xa80000, 0xa800a8, 0xa85400, 0xa8a8a8, - 0x545454, 0x5454fc, 0x54fc54, 0x54fcfc, 0xfc5454, 0xfc54fc, 0xfcfc54, 0xfcfcfc, - 0x000000, 0x141414, 0x202020, 0x2c2c2c, 0x383838, 0x444444, 0x505050, 0x606060, - 0x707070, 0x808080, 0x909090, 0xa0a0a0, 0xb4b4b4, 0xc8c8c8, 0xe0e0e0, 0xfcfcfc, - 0x0000fc, 0x4000fc, 0x7c00fc, 0xbc00fc, 0xfc00fc, 0xfc00bc, 0xfc007c, 0xfc0040, - 0xfc0000, 0xfc4000, 0xfc7c00, 0xfcbc00, 0xfcfc00, 0xbcfc00, 0x7cfc00, 0x40fc00, - 0x00fc00, 0x00fc40, 0x00fc7c, 0x00fcbc, 0x00fcfc, 0x00bcfc, 0x007cfc, 0x0040fc, - 0x7c7cfc, 0x9c7cfc, 0xbc7cfc, 0xdc7cfc, 0xfc7cfc, 0xfc7cdc, 0xfc7cbc, 0xfc7c9c, - 0xfc7c7c, 0xfc9c7c, 0xfcbc7c, 0xfcdc7c, 0xfcfc7c, 0xdcfc7c, 0xbcfc7c, 0x9cfc7c, - 0x7cfc7c, 0x7cfc9c, 0x7cfcbc, 0x7cfcdc, 0x7cfcfc, 0x7cdcfc, 0x7cbcfc, 0x7c9cfc, - 0xb4b4fc, 0xc4b4fc, 0xd8b4fc, 0xe8b4fc, 0xfcb4fc, 0xfcb4e8, 0xfcb4d8, 0xfcb4c4, - 0xfcb4b4, 0xfcc4b4, 0xfcd8b4, 0xfce8b4, 0xfcfcb4, 0xe8fcb4, 0xd8fcb4, 0xc4fcb4, - 0xb4fcb4, 0xb4fcc4, 0xb4fcd8, 0xb4fce8, 0xb4fcfc, 0xb4e8fc, 0xb4d8fc, 0xb4c4fc, - 0x000070, 0x1c0070, 0x380070, 0x540070, 0x700070, 0x700054, 0x700038, 0x70001c, - 0x700000, 0x701c00, 0x703800, 0x705400, 0x707000, 0x547000, 0x387000, 0x1c7000, - 0x007000, 0x00701c, 0x007038, 0x007054, 0x007070, 0x005470, 0x003870, 0x001c70, - 0x383870, 0x443870, 0x543870, 0x603870, 0x703870, 0x703860, 0x703854, 0x703844, - 0x703838, 0x704438, 0x705438, 0x706038, 0x707038, 0x607038, 0x547038, 0x447038, - 0x387038, 0x387044, 0x387054, 0x387060, 0x387070, 0x386070, 0x385470, 0x384470, - 0x505070, 0x585070, 0x605070, 0x685070, 0x705070, 0x705068, 0x705060, 0x705058, - 0x705050, 0x705850, 0x706050, 0x706850, 0x707050, 0x687050, 0x607050, 0x587050, - 0x507050, 0x507058, 0x507060, 0x507068, 0x507070, 0x506870, 0x506070, 0x505870, - 0x000040, 0x100040, 0x200040, 0x300040, 0x400040, 0x400030, 0x400020, 0x400010, - 0x400000, 0x401000, 0x402000, 0x403000, 0x404000, 0x304000, 0x204000, 0x104000, - 0x004000, 0x004010, 0x004020, 0x004030, 0x004040, 0x003040, 0x002040, 0x001040, - 0x202040, 0x282040, 0x302040, 0x382040, 0x402040, 0x402038, 0x402030, 0x402028, - 0x402020, 0x402820, 0x403020, 0x403820, 0x404020, 0x384020, 0x304020, 0x284020, - 0x204020, 0x204028, 0x204030, 0x204038, 0x204040, 0x203840, 0x203040, 0x202840, - 0x2c2c40, 0x302c40, 0x342c40, 0x3c2c40, 0x402c40, 0x402c3c, 0x402c34, 0x402c30, - 0x402c2c, 0x40302c, 0x40342c, 0x403c2c, 0x40402c, 0x3c402c, 0x34402c, 0x30402c, - 0x2c402c, 0x2c4030, 0x2c4034, 0x2c403c, 0x2c4040, 0x2c3c40, 0x2c3440, 0x2c3040, - 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000 -}; - void Palette::initVGAPalette(byte *palette) { byte *destP = palette; - for (int palIndex = 0; palIndex < PALETTE_COUNT; ++palIndex) { + for (int palIndex = 0; palIndex < 16; ++palIndex) { for (int byteCtr = 2; byteCtr >= 0; --byteCtr) *destP++ = ((DEFAULT_VGA_PALETTE[palIndex] >> (8 * byteCtr)) & 0xff) >> 2; } } void Palette::setLowRange() { - _mainPalette[0] = _mainPalette[1] = _mainPalette[2] = 0; - _mainPalette[3] = _mainPalette[4] = _mainPalette[5] = 0x15; - _mainPalette[6] = _mainPalette[7] = _mainPalette[8] = 0x2A; - _mainPalette[9] = _mainPalette[10] = _mainPalette[11] = 0x3F; + _mainPalette[0] = _mainPalette[1] = _mainPalette[2] = VGA_COLOR_TRANS(0); + _mainPalette[3] = _mainPalette[4] = _mainPalette[5] = VGA_COLOR_TRANS(0x15); + _mainPalette[6] = _mainPalette[7] = _mainPalette[8] = VGA_COLOR_TRANS(0x2A); + _mainPalette[9] = _mainPalette[10] = _mainPalette[11] = VGA_COLOR_TRANS(0x3F); _vm->_palette->setPalette(_mainPalette, 0, 4); } diff --git a/engines/mads/palette.h b/engines/mads/palette.h index 2fdb38662c..0f04230a81 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -32,7 +32,7 @@ class MADSEngine; #define PALETTE_USAGE_COUNT 4 -#define VGA_COLOR_TRANS(x) (((((int)(x)) + 1) << 2) - 1) +#define VGA_COLOR_TRANS(x) ((x) * 255 / 63) struct RGB4 { byte r; @@ -134,7 +134,8 @@ public: class Palette { private: /** - * Initialises a stanadrd VGA palette + * Initialises the first 16 palette indexes with the equivalent + * standard VGA palette */ void initVGAPalette(byte *palette); protected: diff --git a/engines/mads/staticres.cpp b/engines/mads/staticres.cpp index d57222c57a..92d2740e2f 100644 --- a/engines/mads/staticres.cpp +++ b/engines/mads/staticres.cpp @@ -46,4 +46,9 @@ const char *const kOverStr = "over"; const char *const kGameReleaseInfoStr = "ScummVM rev: 8.43 14-Sept-92"; const char *const kGameReleaseTitleStr = "GAME RELASE VERSION INFO"; +const uint32 DEFAULT_VGA_PALETTE[16] = { + 0x000000, 0x0000a8, 0x00a800, 0x00a8a8, 0xa80000, 0xa800a8, 0xa85400, 0xa8a8a8, + 0x545454, 0x5454fc, 0x54fc54, 0x54fcfc, 0xfc5454, 0xfc54fc, 0xfcfc54, 0xfcfcfc +}; + } // End of namespace MADS diff --git a/engines/mads/staticres.h b/engines/mads/staticres.h index 5aaa331d25..b4132c8319 100644 --- a/engines/mads/staticres.h +++ b/engines/mads/staticres.h @@ -40,6 +40,8 @@ extern const char *const kOverStr; extern const char *const kGameReleaseInfoStr; extern const char *const kGameReleaseTitleStr; +extern const uint32 DEFAULT_VGA_PALETTE[16]; + } // End of namespace MADS #endif /* MADS_STATICRES_H */ diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index b45ff14633..05e9b70432 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -224,11 +224,12 @@ void UserInterface::load(const Common::String &resName) { byte *palP = &_vm->_palette->_mainPalette[0]; for (int i = 0; i < 16; ++i, gamePalP++, palP += 3) { - palP[0] = VGA_COLOR_TRANS(palStream->readByte()); - palP[1] = VGA_COLOR_TRANS(palStream->readByte()); - palP[2] = VGA_COLOR_TRANS(palStream->readByte()); + RGB6 rgb; + rgb.load(palStream); + palP[0] = rgb.r; + palP[1] = rgb.g; + palP[2] = rgb.b; *gamePalP |= 1; - palStream->skip(3); } delete palStream; -- cgit v1.2.3 From 7b15d2e379ce6ecfc131db803fbe704caaf8d385 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 25 Mar 2014 22:06:21 -0400 Subject: MADS: Moved palette translation define into source file --- engines/mads/palette.cpp | 2 ++ engines/mads/palette.h | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index 94ce52e88b..311bd633e1 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -29,6 +29,8 @@ namespace MADS { +#define VGA_COLOR_TRANS(x) ((x) * 255 / 63) + void RGB6::load(Common::SeekableReadStream *f) { r = VGA_COLOR_TRANS(f->readByte()); g = VGA_COLOR_TRANS(f->readByte()); diff --git a/engines/mads/palette.h b/engines/mads/palette.h index 0f04230a81..ae29d181ec 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -32,8 +32,6 @@ class MADSEngine; #define PALETTE_USAGE_COUNT 4 -#define VGA_COLOR_TRANS(x) ((x) * 255 / 63) - struct RGB4 { byte r; byte g; -- cgit v1.2.3 From 407021d245f1e0446867824c6306337f18fe8eb3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 25 Mar 2014 22:07:33 -0400 Subject: MADS: Added a Facing enum for the player directions --- engines/mads/action.cpp | 6 +-- engines/mads/game.cpp | 2 +- engines/mads/hotspots.cpp | 10 ++--- engines/mads/hotspots.h | 7 ++-- engines/mads/nebular/game_nebular.cpp | 4 +- engines/mads/nebular/nebular_scenes2.cpp | 70 ++++++++++++++++---------------- engines/mads/player.cpp | 31 +++++++------- engines/mads/player.h | 23 ++++++++--- engines/mads/scene.cpp | 4 +- engines/mads/scene.h | 2 +- engines/mads/scene_data.h | 2 +- 11 files changed, 87 insertions(+), 74 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index 0c20fec918..ca29527748 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -305,13 +305,13 @@ void MADSAction::startAction() { if ((hs._feetPos.x == -1) || (hs._feetPos.x == -3)) { checkCustomDest(hs._feetPos.x); } else if (hs._feetPos.x == 0) { - scene._destFacing = hs._facing; + scene._targetFacing = hs._facing; } else if (_savedFields._actionMode == ACTIONMODE_NONE || hs._cursor >= CURSOR_WAIT) { _startWalkFlag = true; scene._destPos = hs._feetPos; } - scene._destFacing = hs._facing; + scene._targetFacing = hs._facing; hotspotId = -1; } } @@ -328,7 +328,7 @@ void MADSAction::startAction() { } } - scene._destFacing = hs._facing; + scene._targetFacing = hs._facing; } _walkFlag = _startWalkFlag; diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index f155bc81c2..6e7c530934 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -230,7 +230,7 @@ void Game::sectionLoop() { // Set player data _player._destPos = _player._playerPos; _player._newDirection = _player._direction; - _player._destFacing = _player._direction; + _player._targetFacing = _player._direction; _player.setupFrame(); _player.updateFrame(); _player._visible3 = _player._visible; diff --git a/engines/mads/hotspots.cpp b/engines/mads/hotspots.cpp index e082a1e3ce..22e4feb8b0 100644 --- a/engines/mads/hotspots.cpp +++ b/engines/mads/hotspots.cpp @@ -27,7 +27,7 @@ namespace MADS { DynamicHotspot::DynamicHotspot() { _seqIndex = 0; - _facing = 0; + _facing = FACING_NONE; _descId = 0; _vocabId = 0; _articleNumber = 0; @@ -61,7 +61,7 @@ int DynamicHotspots::add(int descId, int vocabId, int seqIndex, const Common::Re _entries[idx]._bounds = bounds; _entries[idx]._feetPos.x = -3; _entries[idx]._feetPos.y = 0; - _entries[idx]._facing = 5; + _entries[idx]._facing = FACING_NONE; _entries[idx]._vocabId = vocabId; _entries[idx]._articleNumber = 6; _entries[idx]._cursor = CURSOR_NONE; @@ -75,7 +75,7 @@ int DynamicHotspots::add(int descId, int vocabId, int seqIndex, const Common::Re return idx; } -int DynamicHotspots::setPosition(int index, int xp, int yp, int facing) { +int DynamicHotspots::setPosition(int index, int xp, int yp, Facing facing) { if (index >= 0) { _entries[index]._feetPos.x = xp; _entries[index]._feetPos.y = yp; @@ -147,7 +147,7 @@ void DynamicHotspots::refresh() { /*------------------------------------------------------------------------*/ Hotspot::Hotspot() { - _facing = 0; + _facing = FACING_NONE; _articleNumber = 0; _cursor = CURSOR_NONE; _vocabId = 0; @@ -162,7 +162,7 @@ Hotspot::Hotspot(Common::SeekableReadStream &f) { _bounds.bottom = f.readSint16LE(); _feetPos.x = f.readSint16LE(); _feetPos.y = f.readSint16LE(); - _facing = f.readByte(); + _facing = (Facing)f.readByte(); _articleNumber = f.readByte(); _active = f.readByte() != 0; _cursor = (CursorType)f.readByte(); diff --git a/engines/mads/hotspots.h b/engines/mads/hotspots.h index 37c37fa1c2..a36993f1ac 100644 --- a/engines/mads/hotspots.h +++ b/engines/mads/hotspots.h @@ -25,6 +25,7 @@ #include "common/scummsys.h" #include "mads/events.h" +#include "mads/player.h" namespace MADS { @@ -36,7 +37,7 @@ public: int _seqIndex; Common::Rect _bounds; Common::Point _feetPos; - int _facing; + Facing _facing; int _descId; int _vocabId; int _articleNumber; @@ -60,7 +61,7 @@ public: Common::Array::size_type size() const { return _entries.size(); } DynamicHotspot &operator[](uint idx) { return _entries[idx]; } int add(int descId, int vocabId, int seqIndex, const Common::Rect &bounds); - int setPosition(int index, int xp, int yp, int facing); + int setPosition(int index, int xp, int yp, Facing facing); int setCursor(int index, CursorType cursor); void remove(int index); void clear(); @@ -72,7 +73,7 @@ class Hotspot { public: Common::Rect _bounds; Common::Point _feetPos; - int _facing; + Facing _facing; int _articleNumber; bool _active; CursorType _cursor; diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index 76ea1f55de..f452746360 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -146,8 +146,8 @@ void GameNebular::initialiseGlobals() { break; } - _player._direction = 8; - _player._newDirection = 8; + _player._direction = FACING_NORTH; + _player._newDirection = FACING_NORTH; loadResourceSequence("RXM", 1); loadResourceSequence("ROX", 1); diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index c4fee2be68..4cec40cd9c 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -144,7 +144,7 @@ void Scene201::enter() { _scene->_sequences.setMsgPosition(_globals._spriteIndexes[19], Common::Point(185, 46)); int idx = _scene->_dynamicHotspots.add(1159, 209, _globals._spriteIndexes[19], Common::Rect(0, 0, 0, 0)); - _scene->_dynamicHotspots.setPosition(idx, 186, 81, 8); + _scene->_dynamicHotspots.setPosition(idx, 186, 81, FACING_NORTH); _globals._v0 = 0; @@ -152,7 +152,7 @@ void Scene201::enter() { _game._player._playerPos = Common::Point(165, 152); } else { _game._player._playerPos = Common::Point(223, 149); - _game._player._direction = 2; + _game._player._direction = FACING_SOUTH; } if (_globals[39] != 0) { @@ -197,7 +197,7 @@ void Scene201::enter() { _scene->_sequences.addSubEntry(_globals._spriteIndexes[21], SM_FRAME_INDEX, 12, 70); _scene->_sequences.setDepth(_globals._spriteIndexes[21], 1); _globals._frameTime = 0; - _game._player.startWalking(Common::Point(157, 143), 8); + _game._player.startWalking(Common::Point(157, 143), FACING_NORTH); _vm->_palette->setEntry(252, 45, 63, 45); _vm->_palette->setEntry(253, 20, 45, 20); _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 2, 0, 120, _game.getQuote(90)); @@ -214,7 +214,7 @@ void Scene201::step() { if ((_globals._frameTime) && (_vm->getRandomNumber(5000) == 9)) { _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 5, 1, 6, 0); int idx = _scene->_dynamicHotspots.add(351, 13, _globals._spriteIndexes[20], Common::Rect(0, 0, 0, 0)); - _scene->_dynamicHotspots.setPosition(idx, 270, 80, 6); + _scene->_dynamicHotspots.setPosition(idx, 270, 80, FACING_EAST); _scene->_sequences.setDepth(_globals._spriteIndexes[20], 8); _vm->_sound->command(14); _globals._frameTime = 0; @@ -368,14 +368,14 @@ void Scene202::enter() { _scene->_sequences.setMsgPosition(_globals._spriteIndexes[17], Common::Point(149, 113)); _scene->_sequences.setDepth(_globals._spriteIndexes[17], 10); int idx = _scene->_dynamicHotspots.add(320, 13, _globals._spriteIndexes[17], Common::Rect(0, 0, 0, 0)); - _scene->_dynamicHotspots.setPosition(idx, 153, 97, 2); + _scene->_dynamicHotspots.setPosition(idx, 153, 97, FACING_SOUTH); if (_globals[32] & 1) { _globals._spriteIndexes[16] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 6, 0, 0, 0); _scene->_sequences.setMsgPosition(_globals._spriteIndexes[16], Common::Point(130, 108)); _scene->_sequences.setDepth(_globals._spriteIndexes[16], 10); idx = _scene->_dynamicHotspots.add(44, 13, _globals._spriteIndexes[16], Common::Rect(0, 0, 0, 0)); - _scene->_dynamicHotspots.setPosition(idx, 132, 97, 2); + _scene->_dynamicHotspots.setPosition(idx, 132, 97, FACING_SOUTH); } if (_globals[32] & 2) { @@ -383,7 +383,7 @@ void Scene202::enter() { _scene->_sequences.setMsgPosition(_globals._spriteIndexes[21], Common::Point(166, 110)); _scene->_sequences.setDepth(_globals._spriteIndexes[21], 10); idx = _scene->_dynamicHotspots.add(44, 13, _globals._spriteIndexes[21], Common::Rect(0, 0, 0, 0)); - _scene->_dynamicHotspots.setPosition(idx, 165, 99, 2); + _scene->_dynamicHotspots.setPosition(idx, 165, 99, FACING_SOUTH); } if (_globals[32]) @@ -391,10 +391,10 @@ void Scene202::enter() { if (_scene->_priorSceneId == 201) { _game._player._playerPos = Common::Point(190, 91); - _game._player._direction = 2; + _game._player._direction = FACING_SOUTH; } else if (_scene->_priorSceneId != -2) { _game._player._playerPos = Common::Point(178, 152); - _game._player._direction = 8; + _game._player._direction = FACING_NORTH; } if (_globals[31]) { @@ -402,7 +402,7 @@ void Scene202::enter() { _scene->_sequences.setDepth(_globals._spriteIndexes[20], 6); _scene->_hotspots.activate(199, false); idx = _scene->_dynamicHotspots.add(457, 13, _globals._spriteIndexes[20], Common::Rect(0, 0, 0, 0)); - _scene->_dynamicHotspots.setPosition(idx, 246, 124, 8); + _scene->_dynamicHotspots.setPosition(idx, 246, 124, FACING_NORTH); } _game.loadQuoteSet(0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x62, 0x63, 0x64, 0x65, 0x66, 0x61, 0); @@ -440,12 +440,12 @@ void Scene202::enter() { if (_globals._v4) { _scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(247, 82)); _game._player._playerPos = Common::Point(246, 124); - _game._player._direction = 8; + _game._player._direction = FACING_NORTH; _globals[41] = -1; } else { _scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(172, 123)); _game._player._playerPos = Common::Point(171, 122); - _game._player._direction = 8; + _game._player._direction = FACING_NORTH; } _scene->loadAnimation(formAnimName('M', -1), 71); @@ -456,7 +456,7 @@ void Scene202::enter() { _scene->_sequences.setDepth(_globals._spriteIndexes[24], 1); _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(247, 82)); _game._player._playerPos = Common::Point(246, 124); - _game._player._direction = 8; + _game._player._direction = FACING_NORTH; } _globals._abortVal = 0; } @@ -540,7 +540,7 @@ void Scene202::step() { _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 6, 0, 0, 0); _scene->_hotspots.activate(199, false); int idx = _scene->_dynamicHotspots.add(457, 13, _globals._spriteIndexes[20], Common::Rect(0, 0, 0, 0)); - _scene->_dynamicHotspots.setPosition(idx, 246, 124, 8); + _scene->_dynamicHotspots.setPosition(idx, 246, 124, FACING_NORTH); _scene->_sequences.updateTimeout(_globals._spriteIndexes[26], _globals._spriteIndexes[20]); _scene->_sequences.updateTimeout(-1, _globals._spriteIndexes[26]); _game._player._stepEnabled = true; @@ -748,7 +748,7 @@ void Scene202::preActions() { action->_startWalkFlag = true; if (_globals._v4 == 0) - _game._player.startWalking(Common::Point(171, 122), 8); + _game._player.startWalking(Common::Point(171, 122), FACING_NORTH); } } @@ -815,7 +815,7 @@ void Scene202::actions() { int idx = _scene->_dynamicHotspots.add(199, 79, -1, Common::Rect(241, 68, 12, 54)); warning("CHECKME: _globals._frameTime = _scene->_dynamicHotspots.setPosition(idx, 246, 124, 8);"); - _globals._frameTime = _scene->_dynamicHotspots.setPosition(idx, 246, 124, 8); + _globals._frameTime = _scene->_dynamicHotspots.setPosition(idx, 246, 124, FACING_NORTH); _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 6, 1, 0, 0); _scene->_sequences.setDepth(_globals._spriteIndexes[23], 1); _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 1); @@ -986,13 +986,13 @@ void Scene203::setup() { void Scene203::enter() { if (_scene->_priorSceneId == 202) { _game._player._playerPos = Common::Point(187, 99); - _game._player._direction = 2; + _game._player._direction = FACING_SOUTH; } else if (_scene->_priorSceneId == 209) { _game._player._playerPos = Common::Point(308, 117); - _game._player._direction = 4; + _game._player._direction = FACING_WEST; } else if (_scene->_priorSceneId == -2) { _game._player._playerPos = Common::Point(155, 152); - _game._player._direction = 8; + _game._player._direction = FACING_NORTH; } _globals._v0 = 0; @@ -1000,9 +1000,9 @@ void Scene203::enter() { if ((_globals[34] == 0) && (_scene->_roomChanged == 0)) { _globals._v0 = -1; - _game._player.startWalking(Common::Point(158, 135), 2); + _game._player.startWalking(Common::Point(158, 135), FACING_SOUTH); int idx = _scene->_dynamicHotspots.add(131, 396, 0, Common::Rect(0, 0, 320, 156)); - _scene->_dynamicHotspots.setPosition(idx, 155, 152, 2); + _scene->_dynamicHotspots.setPosition(idx, 155, 152, FACING_SOUTH); _scene->_dynamicHotspots.setCursor(idx, CURSOR_GO_DOWN); } @@ -1011,7 +1011,7 @@ void Scene203::enter() { if (_vm->getRandomNumber(1, 3) == 2) { _globals._spriteIndexes[15] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 9, 1, 0, 0); int idx = _scene->_dynamicHotspots.add(477, 209, _globals._spriteIndexes[15], Common::Rect(0, 0, 0, 0)); - _scene->_dynamicHotspots.setPosition(idx, -2, 0, 0); + _scene->_dynamicHotspots.setPosition(idx, -2, 0, FACING_NONE); _vm->_sound->command(14); } } @@ -1053,7 +1053,7 @@ void Scene203::step() { void Scene203::preActions() { if (_globals._v0 && !_action.isAction(0x18C, 0x83, 0)) { - _game._player.startWalking(Common::Point(158, 136), 2); + _game._player.startWalking(Common::Point(158, 136), FACING_SOUTH); _action._inProgress = false; return; } @@ -1110,11 +1110,11 @@ void Scene205::enter() { _globals._spriteIndexes[16] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 10, 0, 0, 3); int idx = _scene->_dynamicHotspots.add(73, 13, _globals._spriteIndexes[16], Common::Rect(0, 0, 0, 0)); - _scene->_dynamicHotspots.setPosition(idx, 162, 120, 9); + _scene->_dynamicHotspots.setPosition(idx, 162, 120, FACING_NORTHEAST); _globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 15, 0, 0, 0); idx = _scene->_dynamicHotspots.add(73, 13, _globals._spriteIndexes[16], Common::Rect(0, 0, 0, 0)); - _scene->_dynamicHotspots.setPosition(idx, 162, 120, 9); + _scene->_dynamicHotspots.setPosition(idx, 162, 120, FACING_NORTHEAST); _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 9, 0, 0, 0); _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 6, 0, 0, 0); @@ -1125,7 +1125,7 @@ void Scene205::enter() { _globals._v3 = _scene->_frameStartTime >> 16; _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 7, 1, 0, 0); idx = _scene->_dynamicHotspots.add(269, 13, _globals._spriteIndexes[21], Common::Rect(0, 0, 0, 0)); - _scene->_dynamicHotspots.setPosition(idx, 49, 86, 8); + _scene->_dynamicHotspots.setPosition(idx, 49, 86, FACING_NORTH); } if (_game._objects[12]._roomNumber == 0) { @@ -1224,7 +1224,7 @@ void Scene207::enter() { _globals._frameTime = _game._player._priorTimer; int idx = _scene->_dynamicHotspots.add(389, 13, _globals._spriteIndexes[16], Common::Rect(0, 0, 0, 0)); - _scene->_dynamicHotspots.setPosition(idx, 254, 94, 4); + _scene->_dynamicHotspots.setPosition(idx, 254, 94, FACING_WEST); } if (_globals._v5) { @@ -1233,16 +1233,16 @@ void Scene207::enter() { _globals._v3 = _game._player._priorTimer & 0xFFFF; _globals._v4 = _game._player._priorTimer >> 16; int idx = _scene->_dynamicHotspots.add(333, 13, _globals._spriteIndexes[19], Common::Rect(0, 0, 0, 0)); - _scene->_dynamicHotspots.setPosition(idx, 59, 132, 2); + _scene->_dynamicHotspots.setPosition(idx, 59, 132, FACING_SOUTH); } _globals._v2 = 0; if (_scene->_priorSceneId == 211) { _game._player._playerPos = Common::Point(13, 105); - _game._player._direction = 6; + _game._player._direction = FACING_EAST; } else if (_scene->_priorSceneId == 214) { _game._player._playerPos = Common::Point(164, 117); - _game._player._direction = 2; + _game._player._direction = FACING_SOUTH; } else if (_scene->_priorSceneId != -2) { _game._player._playerPos = Common::Point(305, 131); } @@ -1386,16 +1386,16 @@ void Scene208::enter() { if (_scene->_priorSceneId == 207) { _game._player._playerPos = Common::Point(8, 122); - _game._player._direction = 6; + _game._player._direction = FACING_EAST; } else if (_scene->_priorSceneId == 203) { _game._player._playerPos = Common::Point(142, 108); - _game._player._direction = 2; + _game._player._direction = FACING_SOUTH; } else if (_scene->_priorSceneId == 209) { _game._player._playerPos = Common::Point(307, 123); - _game._player._direction = 4; + _game._player._direction = FACING_WEST; } else if (_scene->_priorSceneId != -2) { _game._player._playerPos = Common::Point(162, 149); - _game._player._direction = 8; + _game._player._direction = FACING_NORTH; } _game.loadQuoteSet(0x81, 0x46, 0); @@ -1484,7 +1484,7 @@ void Scene208::actions() { if (_game._player._stepEnabled) { _game._player._stepEnabled = false; _globals._v0 = true; - _game._player.startWalking(Common::Point(20, 148), 6); + _game._player.startWalking(Common::Point(20, 148), FACING_EAST); } } else if (_action.isAction(0x7, 0x35, 0x1A9)) { warning("TODO: sub3B282(4);"); diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index 1e886ae704..03d03cb4a8 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -34,9 +34,9 @@ const int Player::_directionListIndexes[32] = { Player::Player(MADSEngine *vm): _vm(vm) { _action = nullptr; - _direction = 8; - _newDirection = 8; - _destFacing = 0; + _direction = FACING_NORTH; + _newDirection = FACING_NORTH; + _targetFacing = FACING_NORTH; _spritesLoaded = false; _spritesStart = 0; _spritesIdx = 0; @@ -72,7 +72,7 @@ Player::Player(MADSEngine *vm): _vm(vm) { void Player::reset() { _action = &_vm->_game->_scene._action; _destPos = _playerPos; - _destFacing = 5; + _targetFacing = FACING_NONE; _newDirection = _direction; _moving = false; _newSceneId = _v844BE = 0; @@ -132,8 +132,8 @@ bool Player::loadSprites(const Common::String &prefix) { } void Player::turnToDestFacing() { - if (_destFacing != 5) - _newDirection = _destFacing; + if (_targetFacing != 5) + _newDirection = _targetFacing; } void Player::dirChanged() { @@ -165,7 +165,8 @@ void Player::dirChanged() { if (diff == 0) diff = newDir - newDir2; - _direction = (diff >= 0) ? _directionListIndexes[_direction + 20] : _directionListIndexes[_direction + 10]; + _direction = (diff >= 0) ? (Facing)_directionListIndexes[_direction + 20] : + (Facing)_directionListIndexes[_direction + 10]; setupFrame(); if ((_direction == _newDirection) && !_moving) updateFrame(); @@ -330,13 +331,13 @@ void Player::resetActionList() { _unk3 = 0; } -void Player::setDest(const Common::Point &pt, int facing) { +void Player::setDest(const Common::Point &pt, Facing facing) { Scene &scene = _vm->_game->_scene; resetActionList(); setTicksAmount(); _moving = true; - _destFacing = facing; + _targetFacing = facing; scene._sceneInfo->setRouteNode(scene._sceneInfo->_nodes.size() - 2, _playerPos, scene._depthSurface); @@ -359,14 +360,14 @@ void Player::setDest(const Common::Point &pt, int facing) { } } -void Player::startWalking(const Common::Point &pos, int direction) { +void Player::startWalking(const Common::Point &pos, Facing direction) { Scene &scene = _vm->_game->_scene; reset(); scene._action._startWalkFlag = true; scene._action._walkFlag = true; scene._destPos = pos; - scene._destFacing = direction; + scene._targetFacing = direction; } void Player::nextFrame() { @@ -716,14 +717,14 @@ void Player::startMovement() { switch (majorDir) { case 1: - _newDirection = (_yDirection <= 0) ? 8 : 2; + _newDirection = (_yDirection <= 0) ? FACING_NORTH : FACING_SOUTH; break; case 2: { - _newDirection = ((_yDirection <= 0) ? 9 : 3) - ((_xDirection <= 0) ? 2 : 0); - break; + _newDirection = (Facing)(((_yDirection <= 0) ? 9 : 3) - ((_xDirection <= 0) ? 2 : 0)); + break; } case 3: - _newDirection = (_xDirection <= 0) ? 4 : 6; + _newDirection = (_xDirection <= 0) ? FACING_WEST : FACING_EAST; break; default: break; diff --git a/engines/mads/player.h b/engines/mads/player.h index d7e074afc8..6daacd99ab 100644 --- a/engines/mads/player.h +++ b/engines/mads/player.h @@ -29,9 +29,20 @@ namespace MADS { class MADSEngine; -class Action; +class MADSAction; #define PLAYER_SPRITES_FILE_COUNT 8 +#define MAX_ROUTE_NODES 22 + +/** + * Player facings + */ +enum Facing { + FACING_NORTH = 8, FACING_SOUTH = 2, FACING_EAST = 6, FACING_WEST = 4, + FACING_NORTHEAST = 9, FACING_SOUTHEAST = 3, + FACING_SOUTHWEST = 1, FACING_NORTHWEST = 7, + FACING_NONE = 5 +}; class Player { private: @@ -94,10 +105,10 @@ private: public: MADSAction *_action; - int _direction; - int _newDirection; + Facing _direction; + Facing _newDirection; int _xDirection, _yDirection; - int _destFacing; + Facing _targetFacing; bool _spritesLoaded; int _spritesStart; int _spritesIdx; @@ -151,9 +162,9 @@ public: void idle(); - void setDest(const Common::Point &pt, int facing); + void setDest(const Common::Point &pt, Facing facing); - void startWalking(const Common::Point &pos, int direction); + void startWalking(const Common::Point &pos, Facing direction); void nextFrame(); diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 1b3143f60e..6a42ed9005 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -42,7 +42,7 @@ Scene::Scene(MADSEngine *vm): _vm(vm), _action(_vm), _depthSurface(vm), _depthStyle = 0; _roomChanged = false; _reloadSceneFlag = false; - _destFacing = 0; + _targetFacing = FACING_NONE; _freeAnimationFlag = false; _animationData = nullptr; _activeAnimation = nullptr; @@ -504,7 +504,7 @@ void Scene::doAction() { void Scene::checkStartWalk() { if (_action._startWalkFlag && _action._walkFlag) { - _vm->_game->_player.setDest(_destPos, _destFacing); + _vm->_game->_player.setDest(_destPos, _targetFacing); _action._startWalkFlag = false; } } diff --git a/engines/mads/scene.h b/engines/mads/scene.h index e2eec23477..ee1a0c7853 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -119,7 +119,7 @@ public: bool _roomChanged; bool _reloadSceneFlag; Common::Point _destPos; - int _destFacing; + Facing _targetFacing; Common::Point _posAdjust; uint32 _frameStartTime; Layer _layer; diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index 8f03783460..d7c008b66d 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -32,6 +32,7 @@ #include "mads/assets.h" #include "mads/events.h" #include "mads/game_data.h" +#include "mads/hotspots.h" #include "mads/messages.h" #include "mads/user_interface.h" @@ -45,7 +46,6 @@ class SpriteSlot; #define MADS_SCENE_HEIGHT 156 #define DEPTH_BANDS_SIZE 15 -#define MAX_ROUTE_NODES 22 #define SPRITE_SLOTS_MAX_SIZE 50 #define TEXT_DISPLAY_MAX_SIZE 40 -- cgit v1.2.3 From 04cbbb5f0a5cc761c71ead882187c02a0000ec0b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 25 Mar 2014 23:59:57 -0400 Subject: MADS: Added enums for copy protection result and globals --- engines/mads/game.cpp | 10 +- engines/mads/game.h | 10 +- engines/mads/nebular/game_nebular.cpp | 4 +- engines/mads/nebular/game_nebular.h | 2 +- engines/mads/nebular/globals_nebular.h | 206 +++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes8.cpp | 4 +- 6 files changed, 224 insertions(+), 12 deletions(-) diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 6e7c530934..631ce20a32 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -59,7 +59,7 @@ Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm), _abortTimersMode = ABORTMODE_0; _abortTimersMode2 = ABORTMODE_0; _ticksExpiry = 0; - _exitFlag = 0; + _winStatus = 0; // Load the inventory object list _objects.load(); @@ -82,15 +82,17 @@ void Game::run() { _statusFlag = true; int protectionResult = checkCopyProtection(); switch (protectionResult) { - case 1: + case PROTECTION_FAIL: // Copy protection failed _scene._nextSceneId = 804; _saveSlot = -1; break; - case 2: - _statusFlag = 0; + case PROTECTION_ESCAPE: + // User escaped out of copy protection dialog + _vm->quitGame(); break; default: + // Copy protection check succeeded _scene._nextSceneId = 103; _scene._priorSceneId = 102; break; diff --git a/engines/mads/game.h b/engines/mads/game.h index c5a3dd3be0..0abb70bb9f 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -43,6 +43,10 @@ enum Difficulty { DIFFICULTY_HARD = 1, DIFFICULTY_MEDIUM = 2, DIFFICULTY_EASY = 3 }; +enum ProtectionResult { + PROTECTION_SUCCEED = 0, PROTECTION_FAIL = 1, PROTECTION_ESCAPE = 2 +}; + class Game { private: /** @@ -88,7 +92,7 @@ protected: /** * Perform any copy protection check */ - virtual int checkCopyProtection() = 0; + virtual ProtectionResult checkCopyProtection() = 0; /** * Initialises global variables for a new game @@ -132,12 +136,12 @@ public: uint32 _priorFrameTimer; Common::String _aaName; uint32 _ticksExpiry; - int _exitFlag; + int _winStatus; public: virtual ~Game(); /** - * Run the game + * Main outer loop for the game */ void run(); diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index f452746360..9b48bde9da 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -39,7 +39,7 @@ GameNebular::GameNebular(MADSEngine *vm): Game(vm) { _storyMode = STORYMODE_NAUGHTY; } -int GameNebular::checkCopyProtection() { +ProtectionResult GameNebular::checkCopyProtection() { /* // DEBUG: Flag copy protection failure _globals[5] = -1; @@ -54,7 +54,7 @@ int GameNebular::checkCopyProtection() { */ // DEBUG: Return that copy protection failed - return -2; + return PROTECTION_SUCCEED; } void GameNebular::initialiseGlobals() { diff --git a/engines/mads/nebular/game_nebular.h b/engines/mads/nebular/game_nebular.h index 98ecb0a41e..d3d908d153 100644 --- a/engines/mads/nebular/game_nebular.h +++ b/engines/mads/nebular/game_nebular.h @@ -54,7 +54,7 @@ class GameNebular: public Game { protected: GameNebular(MADSEngine *vm); - virtual int checkCopyProtection(); + virtual ProtectionResult checkCopyProtection(); virtual void initialiseGlobals(); diff --git a/engines/mads/nebular/globals_nebular.h b/engines/mads/nebular/globals_nebular.h index 95117a3389..f83c0fa1b7 100644 --- a/engines/mads/nebular/globals_nebular.h +++ b/engines/mads/nebular/globals_nebular.h @@ -31,6 +31,212 @@ namespace MADS { namespace Nebular { +enum GlobalId { + KSexOfRex = 0, + kOldSexOfRex = 1, + kWalkerTiming = 2, + kWalkerTiming0 = 3, + + kTalkInanimateCount = 4, + + kCopyProtectFailed = 5, + + /* Section #1 variables */ + kNeedToStandUp = 10, + + kTurkeyExploded = 11, + kMedicineCabinetOpen = 12, + kMedicineCabinetVirgin = 13, + kWatchedViewScreen = 14, + + kHoovicAlive = 15, + kHoovicSated = 16, + kHoovicFishEaten = 17, + + kWaterInAPuddle = 18, + + kFishIn105 = 19, + kFishIn107 = 20, + kFishIn108 = 21, + + + /* Section #2 variables */ + kCurtainOpen = 30, + kLadderBroken = 31, + kBone202Status = 32, + + kMeteorologistStatus = 33, + + kRhotundaStatus = 34, + kLeavesStatus = 35, + + kMonkeyStatus = 36, + + kMeteorologistEverSeen = 37, + kMeteorologistWatch = 38, + + kTeleporterCommand = 39, + kTeleporterDestination = 40, + kTeleporterUnderstood = 41, + + kConv205 = 42, + kChickenPpermitted = 43, + + kTwinklesStatus = 44, + kTwinklesApproached = 45, + + kConvTwinkles1 = 46, + kConvTwinkles2 = 47, + kConvTwinkles3 = 48, + kConvTwinkles5 = 49, + kConvTwinkles6 = 50, + kConvTwinkles7 = 51, + kConvTwinkles8 = 52, + + kBlowgunStatus = 53, + + + /* Section #3 Variables */ + kAfterHavoc = 60, + kHaveYourStuff = 61, + + kRightView320 = 62, + + kConvBuddy1 = 63, + kConvBuddy2 = 64, + kMetBuddyBeast = 65, + kKnowsBuddyBeast = 66, + + kConvSlache1 = 67, + kConvSlache2 = 68, + kConvSlache3 = 69, + + kRexHasMetSlache = 70, + + kConvIntern = 71, + kHasSeenProfPyro = 72, + + kKickedIn391Grate = 73, + + + /* Section #4 Variables */ + kArmoryDoorOpen = 80, + kStorageDoorOpen = 81, + + kNextIngredient = 82, + + kIngredientList = 83, + kIngredientList1 = 84, + kIngredientList2 = 85, + kIngredientList3 = 86, + + kIngredientQuantity = 87, + kIngredientQuantity1 = 88, + kIngredientQuantity2 = 89, + kIngredientQuantity3 = 90, + + + conv_pyro_1 = 91, + conv_pyro_2 = 92, + conv_pyro_3 = 93, + conv_pyro_4 = 94, + bad_first_ingredient = 95, + + kConvBartender1 = 96, + kConvBartender2 = 97, + kConvBartender3 = 98, + kConvBartender4 = 99, + kHasPurchased = 100, + kBeenThruHelgaScene = 101, + kHasSaidBinocs = 102, + kHasSaidTimer = 103, + kBottleDisplayed = 104, + kHasBeenScanned = 105, + kSomeoneHasExploded = 106, + + + /* Section #5 Variables */ + kBoatRaised = 110, + + kCarStatus = 111, + + kCityFlooded = 112, + kLaserOn = 113, + kLaserHoleIsThere = 114, + kCarIsGone = 115, + kRegisterOpen = 116, + kSafeStatus = 117, + kDogStatus = 118, + kLineStatus = 119, + + kHoverCarLocation = 120, + kHoverCarDestination = 121, + + + /* Section #6 Variables */ + kConvHermit1 = 130, + kconvHermit2 = 131, + kHasTalkedToHermit = 132, + kExecuted_1_11 = 133, + kHandsetCellStatus = 134, + kBeenInVideoStore = 135, + kDurafailRecharged = 136, + kPenlightCellStatus = 137, + kTimebombStatus = 138, + kCheckDaemonTimebomb = 140, + kResurrectRoom = 141, + + + /* Section #6 Time-Bomb Variables */ + kTimebombClock = 142, + kTimebombClock0 = 143, + + kTimebombTimer = 144, + kTimebombTimer0 = 145, + + kWarnedFloodCity = 146, + + /* Section #7 Variables */ + kBottleStatus = 150, + kMonsterAlive = 151, + + kConvBottleFillNode = 152, + kBoatStatus = 153, + + + /* Section #8 Variables */ + kAntigravClock = 160, + kAntigravClock0 = 161, + + kAntigravTiming = 162, + kAntigravTiming0 = 163, + + kWindowFixed = 164, + kinSpace = 165, + kReturnFromCut = 166, + kBeamIsUp = 167, + kForceBeamDown = 168, + kCameFromCut = 169, + kCutX = 170, + kCutY = 171, + kCutFacing = 172, + kDontRepeat = 173, + kHoppyDead = 174, + kHasWatchedAntigrav = 175, + kRemoteSequenceRan = 176, + kRemoteOnGround = 177, + kFromCockpit = 178, + kExitShip = 179, + kBetweenRooms = 180, + kTopButtonPushed = 181, + kTargetModInstalled = 182, + kShieldModInstalled = 183, + kUpBecauseOfRemote = 184, + + kTeleporterRoom = 190, + kTeleporterCode = 200 +}; + class Globals { private: Common::Array _flags; diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index 2a28edee1d..920467f610 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -194,7 +194,7 @@ void Scene804::step() { _globals[165] = 0; _globals[167] = -1; assert(!_globals[5]); - _game._exitFlag = 4; + _game._winStatus = 4; _vm->quitGame(); } break; @@ -206,7 +206,7 @@ void Scene804::step() { _globals[165] = 0; _globals[167] = -1; assert(!_globals[5]); - _game._exitFlag = 4; + _game._winStatus = 4; _vm->quitGame(); } break; -- cgit v1.2.3 From 46021c487b1d0d528a6f9199bff9f2006263bd33 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 26 Mar 2014 07:49:37 +0100 Subject: MADS: Use globalId enum, add a skeletton for scene 209 --- engines/mads/nebular/globals_nebular.h | 59 +++----------- engines/mads/nebular/nebular_scenes.cpp | 2 + engines/mads/nebular/nebular_scenes1.cpp | 14 ++-- engines/mads/nebular/nebular_scenes2.cpp | 134 ++++++++++++++++++------------- engines/mads/nebular/nebular_scenes2.h | 11 +++ engines/mads/nebular/nebular_scenes8.cpp | 37 ++++----- 6 files changed, 128 insertions(+), 129 deletions(-) diff --git a/engines/mads/nebular/globals_nebular.h b/engines/mads/nebular/globals_nebular.h index f83c0fa1b7..d8500e2291 100644 --- a/engines/mads/nebular/globals_nebular.h +++ b/engines/mads/nebular/globals_nebular.h @@ -32,120 +32,95 @@ namespace MADS { namespace Nebular { enum GlobalId { - KSexOfRex = 0, + kSexOfRex = 0, kOldSexOfRex = 1, kWalkerTiming = 2, kWalkerTiming0 = 3, - kTalkInanimateCount = 4, - kCopyProtectFailed = 5, /* Section #1 variables */ kNeedToStandUp = 10, - kTurkeyExploded = 11, kMedicineCabinetOpen = 12, kMedicineCabinetVirgin = 13, kWatchedViewScreen = 14, - kHoovicAlive = 15, kHoovicSated = 16, kHoovicFishEaten = 17, - kWaterInAPuddle = 18, - kFishIn105 = 19, kFishIn107 = 20, kFishIn108 = 21, - /* Section #2 variables */ kCurtainOpen = 30, kLadderBroken = 31, kBone202Status = 32, - kMeteorologistStatus = 33, - kRhotundaStatus = 34, kLeavesStatus = 35, - kMonkeyStatus = 36, - kMeteorologistEverSeen = 37, kMeteorologistWatch = 38, - kTeleporterCommand = 39, + kTeleporterDestination = 40, kTeleporterUnderstood = 41, - kConv205 = 42, kChickenPpermitted = 43, - kTwinklesStatus = 44, kTwinklesApproached = 45, - kConvTwinkles1 = 46, kConvTwinkles2 = 47, kConvTwinkles3 = 48, kConvTwinkles5 = 49, + kConvTwinkles6 = 50, kConvTwinkles7 = 51, kConvTwinkles8 = 52, - kBlowgunStatus = 53, - /* Section #3 Variables */ kAfterHavoc = 60, kHaveYourStuff = 61, - kRightView320 = 62, - kConvBuddy1 = 63, kConvBuddy2 = 64, kMetBuddyBeast = 65, kKnowsBuddyBeast = 66, - kConvSlache1 = 67, kConvSlache2 = 68, kConvSlache3 = 69, kRexHasMetSlache = 70, - kConvIntern = 71, kHasSeenProfPyro = 72, - kKickedIn391Grate = 73, - /* Section #4 Variables */ kArmoryDoorOpen = 80, kStorageDoorOpen = 81, - kNextIngredient = 82, - kIngredientList = 83, kIngredientList1 = 84, kIngredientList2 = 85, kIngredientList3 = 86, - kIngredientQuantity = 87, kIngredientQuantity1 = 88, kIngredientQuantity2 = 89, - kIngredientQuantity3 = 90, - - - conv_pyro_1 = 91, - conv_pyro_2 = 92, - conv_pyro_3 = 93, - conv_pyro_4 = 94, - bad_first_ingredient = 95, + kIngredientQuantity3 = 90, + kconvPyro_1 = 91, + kconvPyro_2 = 92, + kconvPyro_3 = 93, + kconvPyro_4 = 94, + kBadFirstIngredient = 95, kConvBartender1 = 96, kConvBartender2 = 97, kConvBartender3 = 98, kConvBartender4 = 99, + kHasPurchased = 100, kBeenThruHelgaScene = 101, kHasSaidBinocs = 102, @@ -154,12 +129,9 @@ enum GlobalId { kHasBeenScanned = 105, kSomeoneHasExploded = 106, - /* Section #5 Variables */ kBoatRaised = 110, - kCarStatus = 111, - kCityFlooded = 112, kLaserOn = 113, kLaserHoleIsThere = 114, @@ -172,7 +144,6 @@ enum GlobalId { kHoverCarLocation = 120, kHoverCarDestination = 121, - /* Section #6 Variables */ kConvHermit1 = 130, kconvHermit2 = 131, @@ -184,39 +155,34 @@ enum GlobalId { kPenlightCellStatus = 137, kTimebombStatus = 138, kCheckDaemonTimebomb = 140, - kResurrectRoom = 141, + kResurrectRoom = 141, /* Section #6 Time-Bomb Variables */ kTimebombClock = 142, kTimebombClock0 = 143, - kTimebombTimer = 144, kTimebombTimer0 = 145, - kWarnedFloodCity = 146, /* Section #7 Variables */ kBottleStatus = 150, kMonsterAlive = 151, - kConvBottleFillNode = 152, kBoatStatus = 153, - /* Section #8 Variables */ kAntigravClock = 160, kAntigravClock0 = 161, - kAntigravTiming = 162, kAntigravTiming0 = 163, - kWindowFixed = 164, kinSpace = 165, kReturnFromCut = 166, kBeamIsUp = 167, kForceBeamDown = 168, kCameFromCut = 169, + kCutX = 170, kCutY = 171, kCutFacing = 172, @@ -227,6 +193,7 @@ enum GlobalId { kRemoteOnGround = 177, kFromCockpit = 178, kExitShip = 179, + kBetweenRooms = 180, kTopButtonPushed = 181, kTargetModInstalled = 182, diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 39a8ed58b4..3a6e6a609f 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -63,6 +63,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene207(vm); case 208: return new Scene208(vm); + case 209: + return new Scene209(vm); // Scene group #8 case 804: diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 652ee99d38..4c3b67f3c5 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -72,22 +72,22 @@ void Scene1xx::setPlayerSpritesPrefix() { _vm->_sound->command(5); Common::String oldName = _game._player._spritesPrefix; if (_scene->_nextSceneId <= 103 || _scene->_nextSceneId == 111) { - if (_globals[0] == SEX_FEMALE) { + if (_globals[kSexOfRex] == SEX_FEMALE) { _game._player._spritesPrefix = "ROX"; } else { _game._player._spritesPrefix = "RXM"; - _globals[0] = SEX_MALE; + _globals[kSexOfRex] = SEX_MALE; } } else if (_scene->_nextSceneId <= 110) { _game._player._spritesPrefix = "RXSW"; - _globals[0] = SEX_UNKNOWN; + _globals[kSexOfRex] = SEX_UNKNOWN; } else if (_scene->_nextSceneId == 112) { _game._player._spritesPrefix = ""; } if (oldName == _game._player._spritesPrefix) _game._player._spritesChanged = true; - if (_scene->_nextSceneId == 105 || (_scene->_nextSceneId == 109 && _globals[15])) { + if (_scene->_nextSceneId == 105 || (_scene->_nextSceneId == 109 && _globals[kHoovicAlive])) { _game._player._spritesChanged = true; _game._v3 = 0; } @@ -176,7 +176,7 @@ void Scene103::enter() { _globals._spriteIndexes[10], false, 6); } - if (_globals[11]) { + if (_globals[kTurkeyExploded]) { _globals._spriteIndexes[24] = _scene->_sequences.addSpriteCycle( _globals._spriteIndexes[9], false, 6); _scene->_sequences.setAnimRange(_globals._spriteIndexes[24], -2, -2); @@ -362,14 +362,14 @@ void Scene103::actions() { } _game._player._stepEnabled = _game._abortTimers == 2; - _globals[11] = -1; + _globals[kTurkeyExploded] = -1; if (_game._abortTimers == 2) { Dialog::show(1030); _scene->_hotspots.activate(362, false); } } } else if (_action.isAction(VERB_LOOK, 250, 0)) { - Dialog::show(!_globals[11] ? 10323 : 10303); + Dialog::show(!_globals[kTurkeyExploded] ? 10323 : 10303); } else if (_action.isAction(VERB_TALKTO, 27, 0)) { switch (_vm->_game->_abortTimers) { diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 4cec40cd9c..4fc1e3e48d 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -45,7 +45,7 @@ void Scene2xx::setPlayerSpritesPrefix() { _game._player._spritesPrefix = ""; break; default: - if (_globals[0] != SEX_MALE) { + if (_globals[kSexOfRex] != SEX_MALE) { _game._player._spritesPrefix = "ROX"; } else { _game._player._spritesPrefix = "RXM"; @@ -61,7 +61,7 @@ void Scene2xx::setPlayerSpritesPrefix() { if (oldName != _game._player._spritesPrefix) _game._player._spritesChanged = true; - if ((_scene->_nextSceneId == 203 || _scene->_nextSceneId == 204) && _globals[34]) + if ((_scene->_nextSceneId == 203 || _scene->_nextSceneId == 204) && _globals[kRhotundaStatus]) _game._v3 = 0; _vm->_palette->setEntry(16, 10, 63, 63); @@ -72,7 +72,7 @@ void Scene2xx::sceneEntrySound() { if (_vm->_musicFlag) { switch (_scene->_nextSceneId) { case 201: - if ((_globals[39] == 2) || (_globals[39] == 4) || (_globals[33] != 1)) + if ((_globals[kTeleporterCommand] == 2) || (_globals[kTeleporterCommand] == 4) || (_globals[kMeteorologistStatus] != 1)) _vm->_sound->command(17); else _vm->_sound->command(9); @@ -96,13 +96,13 @@ void Scene2xx::sceneEntrySound() { _vm->_sound->command(11); break; case 210: - if (_globals[44] == 0) + if (_globals[kTwinklesStatus] == 0) _vm->_sound->command(15); else _vm->_sound->command(10); break; case 213: - if (_globals[38] == 0) + if (_globals[kMeteorologistWatch] == 0) _vm->_sound->command(1); else _vm->_sound->command(9); @@ -155,18 +155,18 @@ void Scene201::enter() { _game._player._direction = FACING_SOUTH; } - if (_globals[39] != 0) { + if (_globals[kTeleporterCommand] != 0) { _game._player._visible = false; _game._player._stepEnabled = false; - int sepChar = (_globals[0] == SEX_UNKNOWN) ? 't' : 'u'; + int sepChar = (_globals[kSexOfRex] == SEX_UNKNOWN) ? 't' : 'u'; // Guess values. What is the default value used by the compiler? int suffixNum = -1; int abortTimers = -1; - switch(_globals[39]) { + switch(_globals[kTeleporterCommand]) { case 1: suffixNum = 3; abortTimers = 76; - _globals[41] = -1; + _globals[kTeleporterUnderstood] = -1; break; case 2: suffixNum = 1; @@ -182,12 +182,12 @@ void Scene201::enter() { abortTimers = 78; break; } - _globals[39] = 0; + _globals[kTeleporterCommand] = 0; if (suffixNum >= 0) _scene->loadAnimation(formAnimName(sepChar, suffixNum), abortTimers); } - if ((_scene->_priorSceneId == 202) && (_globals[33] == 1) && !_scene->_roomChanged) { + if ((_scene->_priorSceneId == 202) && (_globals[kMeteorologistStatus] == 1) && !_scene->_roomChanged) { _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('a', 0), 0); _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('a', 1), 0); _game.loadQuoteSet(90, 91, 0); @@ -204,7 +204,7 @@ void Scene201::enter() { } else _globals._frameTime = 0xFFFF; - if (_globals[41] != 0) + if (_globals[kTeleporterUnderstood] != 0) _scene->_hotspots.activate(438, false); sceneEntrySound(); @@ -261,7 +261,7 @@ void Scene201::step() { } if (_game._abortTimers == 75) { - _globals[37] = 0; + _globals[kMeteorologistEverSeen] = 0; _scene->_nextSceneId = 202; } @@ -272,8 +272,8 @@ void Scene201::step() { } if (_game._abortTimers == 77) { - _globals[39] = 1; - _scene->_nextSceneId = _globals[40]; + _globals[kTeleporterCommand] = 1; + _scene->_nextSceneId = _globals[kTeleporterDestination]; _scene->_reloadSceneFlag = true; } @@ -296,7 +296,7 @@ void Scene201::actions() { } else { _game._player._stepEnabled = false; _game._player._visible = false; - int sepChar = (_globals[0] == SEX_UNKNOWN) ? 't' : 'u'; + int sepChar = (_globals[kSexOfRex] == SEX_UNKNOWN) ? 't' : 'u'; _scene->loadAnimation(formAnimName(sepChar, 0), 1); } } else if (action->isAction(0x3, 0x1A6, 0)) { @@ -318,7 +318,7 @@ void Scene201::actions() { } else if (action->isAction(0x3, 0x83, 0)) { Dialog::show(0x4E8E); } else if (action->isAction(0x3, 0x1B6, 0)) { - if (_globals[37]) + if (_globals[kMeteorologistEverSeen]) Dialog::show(0x4E90); else Dialog::show(0x4E8D); @@ -354,7 +354,7 @@ void Scene202::enter() { _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('b', 2), 0); _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 0), 0); _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('l', -1), 0); - if (_globals[0] != SEX_MALE) { + if (_globals[kSexOfRex] != SEX_MALE) { _globals._spriteIndexes[7] = _scene->_sprites.addSprites("*ROXBD_2"); } else { _globals._spriteIndexes[7] = _scene->_sprites.addSprites("*RXMBD_2"); @@ -370,7 +370,7 @@ void Scene202::enter() { int idx = _scene->_dynamicHotspots.add(320, 13, _globals._spriteIndexes[17], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, 153, 97, FACING_SOUTH); - if (_globals[32] & 1) { + if (_globals[kBone202Status] & 1) { _globals._spriteIndexes[16] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 6, 0, 0, 0); _scene->_sequences.setMsgPosition(_globals._spriteIndexes[16], Common::Point(130, 108)); _scene->_sequences.setDepth(_globals._spriteIndexes[16], 10); @@ -378,7 +378,7 @@ void Scene202::enter() { _scene->_dynamicHotspots.setPosition(idx, 132, 97, FACING_SOUTH); } - if (_globals[32] & 2) { + if (_globals[kBone202Status] & 2) { _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 6, 0, 0, 0); _scene->_sequences.setMsgPosition(_globals._spriteIndexes[21], Common::Point(166, 110)); _scene->_sequences.setDepth(_globals._spriteIndexes[21], 10); @@ -386,8 +386,8 @@ void Scene202::enter() { _scene->_dynamicHotspots.setPosition(idx, 165, 99, FACING_SOUTH); } - if (_globals[32]) - _scene->changeDepthSurface(_globals[32]); + if (_globals[kBone202Status]) + _scene->changeDepthSurface(_globals[kBone202Status]); if (_scene->_priorSceneId == 201) { _game._player._playerPos = Common::Point(190, 91); @@ -397,7 +397,7 @@ void Scene202::enter() { _game._player._direction = FACING_NORTH; } - if (_globals[31]) { + if (_globals[kLadderBroken]) { _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 6, 0, 0, 0); _scene->_sequences.setDepth(_globals._spriteIndexes[20], 6); _scene->_hotspots.activate(199, false); @@ -423,15 +423,15 @@ void Scene202::enter() { if (_scene->_roomChanged) _game._objects.addToInventory(OBJ_NONE); - if (_globals[38]) { + if (_globals[kMeteorologistWatch]) { _game._player._visible = false; _game._player._stepEnabled = false; - if (_globals[38] == 2) + if (_globals[kMeteorologistWatch] == 2) _globals._v4 = 1; else _globals._v4 = 0; - if (_globals[38] < 1) + if (_globals[kMeteorologistWatch] < 1) _globals._spriteIndexes[25] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 6); else _globals._spriteIndexes[25] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 8); @@ -441,7 +441,7 @@ void Scene202::enter() { _scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(247, 82)); _game._player._playerPos = Common::Point(246, 124); _game._player._direction = FACING_NORTH; - _globals[41] = -1; + _globals[kTeleporterUnderstood] = -1; } else { _scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(172, 123)); _game._player._playerPos = Common::Point(171, 122); @@ -496,7 +496,7 @@ void Scene202::step() { int msgIndex = _scene->_kernelMessages.add(msgPos, 0x1110, msgFlag | 32, 0, 120, _game.getQuote(102)); _scene->_kernelMessages.setQuoted(msgIndex, 4, true); - if (_globals[38] == 1) { + if (_globals[kMeteorologistWatch] == 1) { MADSAction *action = _game._player._action; action->_activeAction._verbId = 3; action->_activeAction._objectNameId = 39; @@ -504,10 +504,10 @@ void Scene202::step() { _game._abortTimersMode2 = ABORTMODE_0; _scene->_sequences.addTimer(120, 2); _globals._abortVal = -1; - } else if (_globals[38] == 2) { + } else if (_globals[kMeteorologistWatch] == 2) { _scene->_sequences.addTimer(120, 90); } - _globals[38] = 0; + _globals[kMeteorologistWatch] = 0; } switch (_game._abortTimers) { @@ -536,7 +536,7 @@ void Scene202::step() { } break; case 93: { - _globals[31] = -1; + _globals[kLadderBroken] = -1; _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 6, 0, 0, 0); _scene->_hotspots.activate(199, false); int idx = _scene->_dynamicHotspots.add(457, 13, _globals._spriteIndexes[20], Common::Rect(0, 0, 0, 0)); @@ -554,19 +554,19 @@ void Scene202::step() { break; } - if (!_scene->_activeAnimation && (_globals[33] != 2) && (_globals._v7 <= _scene->_frameStartTime) && (_globals._v8425C <= _scene->_frameStartTime)) { + if (!_scene->_activeAnimation && (_globals[kMeteorologistStatus] != 2) && (_globals._v7 <= _scene->_frameStartTime) && (_globals._v8425C <= _scene->_frameStartTime)) { int randVal = _vm->getRandomNumber(1, 500); int threshold = 1; if (_globals._v4) threshold = 26; - if (!_globals[37]) + if (!_globals[kMeteorologistEverSeen]) threshold = 25; if (threshold >= randVal) { _vm->_sound->command(17); _scene->loadAnimation(formAnimName('M', -1), 71); _globals._v84266 = -1; _globals._v84268 = 0; - _globals[37] = true; + _globals[kMeteorologistEverSeen] = true; _globals._v6 = _scene->_frameStartTime; _globals._v8 = 0; _globals._v84262 = 0; @@ -580,7 +580,7 @@ void Scene202::step() { if (_globals._v5) { if (_scene->_activeAnimation->getCurrentFrame() >= 200) { - if ((_globals[38] == 2) || _globals[31]) { + if ((_globals[kMeteorologistWatch] == 2) || _globals[kLadderBroken]) { _scene->_nextSceneId = 213; } else { Dialog::show(0x4EE9); @@ -761,11 +761,11 @@ void Scene202::actions() { } else if (action->isAction(0x18C, 0x83, 0)) { _scene->_nextSceneId = 203; } else if (action->isAction(0x18C, 0x82, 0)) { - if (_globals[33] != 2) { + if (_globals[kMeteorologistStatus] != 2) { if (_scene->_activeAnimation) - _globals[33] = 1; + _globals[kMeteorologistStatus] = 1; else - _globals[33] = 0; + _globals[kMeteorologistStatus] = 0; } _scene->_nextSceneId = 201; } else if (action->isAction(0x4, 0x2C, 0)) { @@ -784,10 +784,10 @@ void Scene202::actions() { } else if (_game._abortTimers == 1) { if ((_game._player._playerPos.x == 132) && (_game._player._playerPos.y == 97)) { _scene->_sequences.remove(_globals._spriteIndexes[16]); - _globals[32] |= 1; + _globals[kBone202Status] |= 1; } else { _scene->_sequences.remove(_globals._spriteIndexes[21]); - _globals[32] |= 2; + _globals[kBone202Status] |= 2; } } else if (_game._abortTimers == 2) { if (_game._objects.isInInventory(OBJ_BONE)) { @@ -798,7 +798,7 @@ void Scene202::actions() { _game._objects.addToInventory(OBJ_BONE); _vm->_dialogs->showPicture(OBJ_BONE, 0x4EFA, 0); } - _scene->changeDepthSurface(_globals[32]); + _scene->changeDepthSurface(_globals[kBone202Status]); _game._player._stepEnabled = true; _game._player._visible = true; } else { @@ -806,7 +806,7 @@ void Scene202::actions() { return; } } - } else if ((action->isAction(0x50, 0xC7, 0)) && (_globals[31] == 0)) { + } else if ((action->isAction(0x50, 0xC7, 0)) && (_globals[kLadderBroken] == 0)) { if (_game._abortTimers == 0) { _vm->_sound->command(29); _globals._v8425C = _scene->_frameStartTime; @@ -832,7 +832,7 @@ void Scene202::actions() { action->_inProgress = false; return; } - } else if (((action->isAction(0x3, 0x27, 0x82)) || (action->isAction(0x3, 0x27, 0x1B6))) && (_globals[0] == SEX_MALE)) { + } else if (((action->isAction(0x3, 0x27, 0x82)) || (action->isAction(0x3, 0x27, 0x1B6))) && (_globals[kSexOfRex] == SEX_MALE)) { if (_globals._v4 == 0) { if (_game._abortTimers == 0) { _game._player._stepEnabled = false; @@ -849,7 +849,7 @@ void Scene202::actions() { _scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(172, 123)); if (_scene->_activeAnimation) { _globals._v5 = -1; - _globals[38] = 1; + _globals[kMeteorologistWatch] = 1; } else { _scene->_sequences.addTimer(120, 2); } @@ -889,7 +889,7 @@ void Scene202::actions() { _scene->_sequences.addTimer(120, 2); } else { _globals._v5 = -1; - _globals[38] = 2; + _globals[kMeteorologistWatch] = 2; if ((_scene->_activeAnimation->getCurrentFrame() >= 44) && (_scene->_activeAnimation->getCurrentFrame() <= 75)) { _scene->_kernelMessages.reset(); int msgIndex = _scene->_kernelMessages.add(Common::Point(248, 15), 0x1110, 32, 0, 60, _game.getQuote(100)); @@ -930,9 +930,9 @@ void Scene202::actions() { } else if (action->isAction(0x3, 0x19C, 0)) { Dialog::show(0x4EEC); } else if (action->isAction(0x3, 0x82, 0)) { - if ((_globals[33] == 0) || (_globals[33] == 2)) { + if ((_globals[kMeteorologistStatus] == 0) || (_globals[kMeteorologistStatus] == 2)) { Dialog::show(0x4EED); - } else if (_globals[33] == 1) { + } else if (_globals[kMeteorologistStatus] == 1) { Dialog::show(0x4EFC); } else { action->_inProgress = false; @@ -998,7 +998,7 @@ void Scene203::enter() { _globals._v0 = 0; _globals._frameTime = 0; - if ((_globals[34] == 0) && (_scene->_roomChanged == 0)) { + if ((_globals[kRhotundaStatus] == 0) && (_scene->_roomChanged == 0)) { _globals._v0 = -1; _game._player.startWalking(Common::Point(158, 135), FACING_SOUTH); int idx = _scene->_dynamicHotspots.add(131, 396, 0, Common::Rect(0, 0, 320, 156)); @@ -1105,7 +1105,7 @@ void Scene205::enter() { _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('c', -1), 0); _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('p', -1), 0); - if (_globals[0] == SEX_MALE) + if (_globals[kSexOfRex] == SEX_MALE) _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('a', 1), 0); _globals._spriteIndexes[16] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 10, 0, 0, 3); @@ -1152,13 +1152,13 @@ void Scene205::enter() { _globals._v0 = _globals._frameTime & 0xFFFF; _globals._frameTime >>= 16; - if (_globals[0] == SEX_FEMALE) + if (_globals[kSexOfRex] == SEX_FEMALE) warning("sub71704(0x3, 0xC3, 0x108, 0x63, 0x86, 0xD, 2, 0xFDFC, 0x3C, 0x6C, 0x6C, 0x6D, 0x6D, 0x6E, 0x6E, 0x6F, 0x6C, 0);"); if (_scene->_priorSceneId != -2) _game._player._playerPos = Common::Point(99, 152); - if (_globals[0] != SEX_MALE) { + if (_globals[kSexOfRex] != SEX_MALE) { _scene->loadAnimation(formAnimName('a', -1), 0); _scene->_activeAnimation->_resetFlag = false; } else { @@ -1400,7 +1400,7 @@ void Scene208::enter() { _game.loadQuoteSet(0x81, 0x46, 0); - if ((_scene->_priorSceneId == 207) && (_globals[36] == 1)) { + if ((_scene->_priorSceneId == 207) && (_globals[kMonkeyStatus] == 1)) { int msgIndex = _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(129)); _scene->_kernelMessages.setQuoted(msgIndex, 4, true); } @@ -1440,7 +1440,7 @@ void Scene208::step() { if (_game._abortTimers & 0xFF) { if ((_game._abortTimers & 0xFF) == 81) { _scene->_sequences.remove(_globals._spriteIndexes[15]); - _globals[34] = 1; + _globals[kRhotundaStatus] = 1; warning("TODO: sub34648(...)"); _scene->_sequences.addTimer(90, 82); } @@ -1462,7 +1462,7 @@ void Scene208::preActions() { void Scene208::actions() { if (_action.isAction(0x18C, 0x19F, 0)) { - if (_globals[34]) + if (_globals[kRhotundaStatus]) _scene->_nextSceneId = 203; else if (_game._abortTimers == 0) { _game._player._stepEnabled = false; @@ -1473,11 +1473,11 @@ void Scene208::actions() { } } else if (_action.isAction(0x18C, 0x83, 0)) { _scene->_nextSceneId = 212; - } else if (_action.isAction(0x4, 0x1AA, 0) && (!_globals[35] || _game._abortTimers)) { + } else if (_action.isAction(0x4, 0x1AA, 0) && (!_globals[kLeavesStatus] || _game._abortTimers)) { warning("TODO: sub3B282(1);"); if (_game._player._stepEnabled) _vm->_dialogs->showPicture(OBJ_BIG_LEAVES, 0x326, 0); - } else if (_action.isAction(0x7, 0x23, 0x19E) && (_globals[35] == 1 || _game._abortTimers)) { + } else if (_action.isAction(0x7, 0x23, 0x19E) && (_globals[kLeavesStatus] == 1 || _game._abortTimers)) { warning("TODO: sub3B282(2);"); } else if (_action.isAction(0x7, 0x17A, 0x1A9)) { warning("TODO: sub3B282(3);"); @@ -1529,9 +1529,9 @@ void Scene208::actions() { Dialog::show(0x5150); } else if (_action._savedFields._lookFlag == 0) { return; - } else if (_globals[34] == 1) { + } else if (_globals[kRhotundaStatus] == 1) { Dialog::show(0x5153); - } else if (_globals[35] == 2) { + } else if (_globals[kLeavesStatus] == 2) { Dialog::show(0x5152); } else { Dialog::show(0x5151); @@ -1542,5 +1542,23 @@ void Scene208::actions() { /*****************************************************************************/ +void Scene209::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(0x10F); +} + +void Scene209::enter() { +} + +void Scene209::step() { +} + +void Scene209::preActions() { +} + +void Scene209::actions() { +} + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index 7a5af6ff41..a23ae98b36 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -123,6 +123,17 @@ public: virtual void postActions() {}; }; +class Scene209: public Scene2xx { +public: + Scene209(MADSEngine *vm) : Scene2xx(vm) {} + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index 920467f610..b802c3e3e4 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -32,12 +32,12 @@ namespace Nebular { void Scene8xx::setup1() { _vm->_sound->command(5); - if ((_globals[178] && !_globals[179]) || + if ((_globals[kFromCockpit] && !_globals[kExitShip]) || _scene->_nextSceneId == 804 || _scene->_nextSceneId == 805 || _scene->_nextSceneId == 808 || _scene->_nextSceneId == 810) { _game._player._spritesPrefix = ""; } else { - _game._player._spritesPrefix = _globals[0] == SEX_FEMALE ? "ROX" : "RXM"; + _game._player._spritesPrefix = _globals[kSexOfRex] == SEX_FEMALE ? "ROX" : "RXM"; } _vm->_palette->setEntry(16, 0x0A, 0x3F, 0x3F); @@ -88,10 +88,10 @@ void Scene804::enter() { _globals._v6 = 0; _globals._v7 = 0; _globals._v8 = 0; - if (_globals[5]) { + if (_globals[kCopyProtectFailed]) { // Copy protection failed - _globals[165] = -1; - _globals[164] = 0; + _globals[kinSpace] = -1; + _globals[kWindowFixed] = 0; } _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('x', 0)); @@ -103,8 +103,8 @@ void Scene804::enter() { _game.loadQuoteSet(791, 0); - if (_globals[165]) { - if (_globals[164]) { + if (_globals[kinSpace]) { + if (_globals[kWindowFixed]) { _globals._spriteIndexes[20] = _scene->_sequences.startCycle( _globals._spriteIndexes[5], 0, 1); _scene->_sequences.addTimer(60, 100); @@ -117,12 +117,12 @@ void Scene804::enter() { _game._player._stepEnabled = false; } } else { - if (_globals[167] == 0) { + if (_globals[kBeamIsUp] == 0) { _globals._spriteIndexes[23] = _scene->_sequences.startCycle( _globals._spriteIndexes[8], false, 1); } - if (_globals[164] == 0) { + if (_globals[kWindowFixed] == 0) { _globals._spriteIndexes[23] = _scene->_sequences.startCycle( _globals._spriteIndexes[19], false, 1); } @@ -137,7 +137,7 @@ void Scene804::enter() { Scene8xx::enter1(); - if (_globals[165] && !_globals[164]) { + if (_globals[kinSpace] && !_globals[kWindowFixed]) { _scene->_userInterface.setup(2); _vm->_sound->command(19); } @@ -191,9 +191,9 @@ void Scene804::step() { if (_scene->_activeAnimation->getCurrentFrame() == 81) { _globals._v5 = 80; } else { - _globals[165] = 0; - _globals[167] = -1; - assert(!_globals[5]); + _globals[kinSpace] = 0; + _globals[kBeamIsUp] = -1; + assert(!_globals[kCopyProtectFailed]); _game._winStatus = 4; _vm->quitGame(); } @@ -203,9 +203,9 @@ void Scene804::step() { if (_scene->_activeAnimation->getCurrentFrame() == 68) { _globals._v5 = 66; } else { - _globals[165] = 0; - _globals[167] = -1; - assert(!_globals[5]); + _globals[kinSpace] = 0; + _globals[kBeamIsUp] = -1; + assert(!_globals[kCopyProtectFailed]); _game._winStatus = 4; _vm->quitGame(); } @@ -225,10 +225,10 @@ void Scene804::step() { if (_game._abortTimers == 80) _scene->_nextSceneId = 803; - if (_scene->_activeAnimation->getCurrentFrame() == 7 && !_globals[164]) { + if (_scene->_activeAnimation->getCurrentFrame() == 7 && !_globals[kWindowFixed]) { _globals._spriteIndexes[19] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); _scene->_sequences.addTimer(20, 110); - _globals[164] = -1; + _globals[kWindowFixed] = -1; } if (_scene->_activeAnimation->getCurrentFrame() == 10) { @@ -239,6 +239,7 @@ void Scene804::step() { switch (_scene->_activeAnimation->getCurrentFrame()) { case 1: + // CHECKME: GlobalID not in enum _globals[29] = _vm->getRandomNumber(1, 30); switch (_globals[29]) { case 1: -- cgit v1.2.3 From 56f7b51754e30ec75c596cd80c76991ac158da66 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 26 Mar 2014 07:57:27 +0100 Subject: MADS: Add an enum for kRandomNumber --- engines/mads/nebular/globals_nebular.h | 1 + engines/mads/nebular/nebular_scenes8.cpp | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/mads/nebular/globals_nebular.h b/engines/mads/nebular/globals_nebular.h index d8500e2291..b3cc94acb3 100644 --- a/engines/mads/nebular/globals_nebular.h +++ b/engines/mads/nebular/globals_nebular.h @@ -52,6 +52,7 @@ enum GlobalId { kFishIn105 = 19, kFishIn107 = 20, kFishIn108 = 21, + kRandomNumber = 29, /* Section #2 variables */ kCurtainOpen = 30, diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index b802c3e3e4..c60a43a5e1 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -239,9 +239,8 @@ void Scene804::step() { switch (_scene->_activeAnimation->getCurrentFrame()) { case 1: - // CHECKME: GlobalID not in enum - _globals[29] = _vm->getRandomNumber(1, 30); - switch (_globals[29]) { + _globals[kRandomNumber] = _vm->getRandomNumber(1, 30); + switch (_globals[kRandomNumber]) { case 1: _globals._v5 = 25; break; -- cgit v1.2.3 From f9e2c1c71f29f6dc1ba8e860d597fe93bc79646a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 26 Mar 2014 09:32:33 -0400 Subject: MADS: Cleaned up game initialisation code to use more constants --- engines/mads/game.cpp | 8 +- engines/mads/game.h | 4 +- engines/mads/inventory.cpp | 2 +- engines/mads/inventory.h | 8 +- engines/mads/nebular/game_nebular.cpp | 236 +++++++++++++++++++++---------- engines/mads/nebular/globals_nebular.cpp | 7 + engines/mads/nebular/globals_nebular.h | 82 ++++++++++- engines/mads/nebular/nebular_scenes2.cpp | 40 +++--- engines/mads/nebular/nebular_scenes8.cpp | 10 +- engines/mads/player.cpp | 40 +++--- engines/mads/player.h | 4 +- engines/mads/scene.cpp | 2 +- 12 files changed, 307 insertions(+), 136 deletions(-) diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 631ce20a32..50a4f6358d 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -42,7 +42,7 @@ Game *Game::init(MADSEngine *vm) { Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm), _scene(vm), _screenObjects(vm), _player(vm) { _sectionNumber = _priorSectionNumber = 0; - _difficultyLevel = DIFFICULTY_HARD; + _difficulty = DIFFICULTY_HARD; _saveSlot = -1; _statusFlag = 0; _sectionHandler = nullptr; @@ -207,7 +207,7 @@ void Game::sectionLoop() { _scene._action.clear(); _player.turnToDestFacing(); - _player._direction = _player._newDirection; + _player._facing = _player._turnToFacing; _player.moveComplete(); switch (_vm->_screenFade) { @@ -231,8 +231,8 @@ void Game::sectionLoop() { // Set player data _player._destPos = _player._playerPos; - _player._newDirection = _player._direction; - _player._targetFacing = _player._direction; + _player._turnToFacing = _player._facing; + _player._targetFacing = _player._facing; _player.setupFrame(); _player.updateFrame(); _player._visible3 = _player._visible; diff --git a/engines/mads/game.h b/engines/mads/game.h index 0abb70bb9f..0d7178a567 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -40,7 +40,7 @@ enum { }; enum Difficulty { - DIFFICULTY_HARD = 1, DIFFICULTY_MEDIUM = 2, DIFFICULTY_EASY = 3 + DIFFICULTY_HARD = 1, DIFFICULTY_REALLY_HARD = 2, DIFFICULTY_IMPOSSIBLE = 3 }; enum ProtectionResult { @@ -117,7 +117,7 @@ public: public: Player _player; ScreenObjects _screenObjects; - Difficulty _difficultyLevel; + Difficulty _difficulty; int _sectionNumber; int _priorSectionNumber; int _currentSectionNumber; diff --git a/engines/mads/inventory.cpp b/engines/mads/inventory.cpp index 1443761ada..3237d55b77 100644 --- a/engines/mads/inventory.cpp +++ b/engines/mads/inventory.cpp @@ -66,7 +66,7 @@ void InventoryObjects::load() { } } -void InventoryObjects::setData(int objIndex, int id, const byte *p) { +void InventoryObjects::setQuality(int objIndex, int id, const byte *p) { // TODO: This whole method seems weird. Check it out more thoroughly once // more of the engine is implemented for (int i = 0; i < (int)size(); ++i) { diff --git a/engines/mads/inventory.h b/engines/mads/inventory.h index 2ca270649e..eec272b365 100644 --- a/engines/mads/inventory.h +++ b/engines/mads/inventory.h @@ -28,6 +28,10 @@ namespace MADS { +enum { + NOWHERE = 1 +}; + class MADSEngine; class InventoryObject { @@ -75,9 +79,9 @@ public: } /** - * Set the associated data? pointer with an inventory object + * Set the associated quality data for an inventory object */ - void setData(int objIndex, int id, const byte *p); + void setQuality(int objIndex, int id, const byte *p); /** * Sets an item's scene number diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index 9b48bde9da..55a348a489 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -58,96 +58,178 @@ ProtectionResult GameNebular::checkCopyProtection() { } void GameNebular::initialiseGlobals() { - // Set specific values needed by the game - _globals[4] = 8; - _globals[33] = 1; - _globals[10] = -1; - _globals[13] = -1; - _globals[15] = -1; - _globals[19] = -1; - _globals[20] = -1; - _globals[21] = -1; - _globals[95] = -1; - - _objects.setData(3, 17, nullptr); - - // Put the values 0 through 3 in a random order in global slots 83 to 86 - for (int i = 0; i < 4;) { - int randomVal = _vm->getRandomNumber(3); - _globals[83 + i] = randomVal; - - bool flag = false; - for (int idx2 = 0; idx2 < i; ++idx2) { - if (_globals[83 + idx2] == randomVal) - flag = true; - } - - if (!flag) - ++i; - } + int count, count2; + int bad; + + _globals.reset(); + _globals[kTalkInanimateCount] = 8; + + /* Section #1 variables */ + _globals[kNeedToStandUp] = true; + _globals[kTurkeyExploded] = false; + _globals[kMedicineCabinetOpen] = false; + _globals[kMedicineCabinetVirgin] = true; + _globals[kWatchedViewScreen] = false; + _globals[kHoovicAlive] = true; + _globals[kWaterInAPuddle] = false; + + _globals[kFishIn105] = true; + _globals[kFishIn107] = true; + _globals[kFishIn108] = true; + + /* Section #2 variables */ + _globals[kLadderBroken] = false; + _globals[kBone202Status] = 0; + _globals[kRhotundaStatus] = RHOTUNDA_HUNGRY; + _globals[kMonkeyStatus] = MONKEY_AMBUSH_READY; + _globals[kMeteorologistStatus] = METEOROLOGIST_PRESENT; + _globals[kMeteorologistEverSeen] = false; + _globals[kMeteorologistWatch] = METEOROLOGIST_NORMAL; + _globals[kTeleporterCommand] = TELEPORTER_NONE; + _globals[kTeleporterUnderstood] = false; + _globals[kTwinklesStatus] = TWINKLES_AT_HOME; + _globals[kTwinklesApproached] = 0; + + /* Section #3 variables */ + _globals[kAfterHavoc] = false; + _globals[kKickedIn391Grate] = false; - // Put the values 0 through 3 in a random order in global slots 87 to 90 - for (int i = 0; i < 4;) { - int randomVal = _vm->getRandomNumber(3); - _globals[87 + i] = randomVal; + /* Section #4 variables */ + _globals[kBadFirstIngredient] = -1; + _objects.setQuality(OBJ_CHARGE_CASES, EXPLOSIVES_INSIDE, nullptr); + _globals[kHasPurchased] = false; + _globals[kBeenThruHelgaScene] = false; + _globals[kNextIngredient] = 0; + _globals[kHasSaidTimer] = false; + _globals[kHasSaidBinocs] = false; + _globals[kBottleDisplayed] = false; + _globals[kHasBeenScanned] = false; + _globals[kSomeoneHasExploded] = false; - bool flag = false; - for (int idx2 = 0; idx2 < i; ++idx2) { - if (_globals[87 + idx2] == randomVal) - flag = true; - } + // Generate a random ingredient list + for (count = 0; count < 4; ++count) { + do { + _globals[kIngredientList + count] = _vm->getRandomNumber(3); + bad = false; + for (count2 = 0; count2 < count; ++count2) { + if (_globals[kIngredientList + count] == _globals[kIngredientList + count2]) { + bad = true; + } + } + } while (bad); + } - if (!flag) - ++i; + // Generate random ingredient quantities + for (count = 0; count < 4; ++count) { + do { + _globals[kIngredientQuantity + count] = _vm->getRandomNumber(3); + bad = false; + for (count2 = 0; count2 < count; ++count2) { + if (_globals[kIngredientQuantity + count] == _globals[kIngredientQuantity + count2]) { + bad = true; + } + } + } while (bad); } - _globals[120] = 501; - _globals[121] = -1; - _globals[55] = -1; - _globals[119] = 1; - _globals[134] = 4; - - // Fill out the globals 200 to 209 with unique random values less than 10000 - for (int i = 0; i < 10; ++i) { - int randomVal = _vm->getRandomNumber(9999); - _globals[200 + i] = randomVal; - - bool flag = false; - for (int idx2 = 0; idx2 < i; ++idx2) { - if (_globals[200 + idx2] == randomVal) - flag = true; - } - - if (!flag) - ++i; + + /* Section #5 variables */ + _globals[kHoverCarLocation] = 501; + _globals[kHoverCarDestination] = -1; + _globals[kCityFlooded] = false; + _globals[kBoatRaised] = true; + _globals[kLaserHoleIsThere] = false; + _globals[kLineStatus] = LINE_NOT_DROPPED; + + + /* Section #6 variables */ + _globals[kHasTalkedToHermit] = false; + _globals[kHandsetCellStatus] = FIRST_TIME_PHONE_CELLS; + _globals[kTimebombStatus] = TIMEBOMB_DEACTIVATED; + _globals[kWarnedFloodCity] = false; + _globals._timebombClock = 0; + _globals._timebombTimer = 0; + + + /* Section #7 variables */ + _globals[kBottleStatus] = BOTTLE_EMPTY; + _globals[kBoatStatus] = BOAT_UNFLOODED; + + + /* Section #8 variables */ + _globals[kWindowFixed] = false; + _globals[kInSpace] = false; + _globals[kReturnFromCut] = false; + _globals[kBeamIsUp] = false; + _globals[kForceBeamDown] = false; + _globals[kCameFromCut] = false; + _globals[kDontRepeat] = false; + _globals[kHoppyDead] = false; + _globals[kHasWatchedAntigrav] = false; + _globals[kRemoteSequenceRan] = false; + _globals[kRemoteOnGround] = false; + _globals[kFromCockpit] = false; + _globals[kExitShip] = false; + _globals[kBetweenRooms] = false; + _globals[kTopButtonPushed] = false; + _globals[kShieldModInstalled] = false; + _globals[kTargetModInstalled] = false; + _globals[kUpBecauseOfRemote] = false; + + + /* Set up the game's teleporters */ + _globals[kTeleporterRoom] = 201; + _globals[kTeleporterRoom + 1] = 301; + _globals[kTeleporterRoom + 2] = 413; + _globals[kTeleporterRoom + 3] = 706; + _globals[kTeleporterRoom + 4] = 801; + _globals[kTeleporterRoom + 5] = 551; + _globals[kTeleporterRoom + 6] = 752; + _globals[kTeleporterRoom + 7] = 0; + _globals[kTeleporterRoom + 8] = 0; + _globals[kTeleporterRoom + 9] = 0; + + for (count = 0; count < TELEPORTER_COUNT; ++count) { + do { + _globals[kTeleporterCode + count] = _vm->getRandomNumber(9999); + bad = false; + for (count2 = 0; count2 < count; ++count2) { + if (_globals[kTeleporterCode + count] == _globals[kTeleporterCode + count2]) { + bad = true; + } + } + } while (bad); } - // Difficulty level control - switch (_difficultyLevel) { + // Final setup based on selected difficulty level + switch (_difficulty) { case DIFFICULTY_HARD: - _globals[35] = 0; - _objects.setRoom(9, 1); - _objects.setRoom(50, 1); - _globals[137] = 5; - _globals[136] = 0; - break; - case DIFFICULTY_MEDIUM: - _globals[35] = 0; - _objects.setRoom(8, 1); - _globals[137] = -1; - _globals[136] = 6; + _objects.setRoom(OBJ_PLANT_STALK, NOWHERE); + _objects.setRoom(OBJ_PENLIGHT, NOWHERE); + + _globals[kLeavesStatus] = LEAVES_ON_TRAP; break; - case DIFFICULTY_EASY: - _globals[35] = 2; - _objects.setRoom(8, 1); - _objects.setRoom(27, 1); + + case DIFFICULTY_REALLY_HARD: + _objects.setRoom(OBJ_PLANT_STALK, NOWHERE); + + _globals[kLeavesStatus] = LEAVES_ON_GROUND; + _globals[kDurafailRecharged] = true; + _globals[kPenlightCellStatus] = FIRST_TIME_CHARGED_DURAFAIL; break; - default: + + case DIFFICULTY_IMPOSSIBLE: + _objects.setRoom(OBJ_BLOWGUN, NOWHERE); + _objects.setRoom(OBJ_NOTE, NOWHERE); + + _globals[kLeavesStatus] = LEAVES_ON_GROUND; + _globals[kPenlightCellStatus] = FIRST_TIME_UNCHARGED_DURAFAIL; + _globals[kDurafailRecharged] = false; break; } - _player._direction = FACING_NORTH; - _player._newDirection = FACING_NORTH; + _player._facing = FACING_NORTH; + _player._turnToFacing = FACING_NORTH; loadResourceSequence("RXM", 1); loadResourceSequence("ROX", 1); diff --git a/engines/mads/nebular/globals_nebular.cpp b/engines/mads/nebular/globals_nebular.cpp index adc58e66aa..c0df8007d9 100644 --- a/engines/mads/nebular/globals_nebular.cpp +++ b/engines/mads/nebular/globals_nebular.cpp @@ -34,6 +34,8 @@ Globals::Globals() { _spriteIndexes.resize(30); // Initialise game flags + _timebombClock = 0; + _timebombTimer = 0; _v0 = 0; _frameTime = 0; _v2 = 0; @@ -53,6 +55,11 @@ Globals::Globals() { _v84274 = 0; } +void Globals::reset() { + for (uint i = 0; i < _flags.size(); ++i) + _flags[i] = 0; +} + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/globals_nebular.h b/engines/mads/nebular/globals_nebular.h index b3cc94acb3..703dc1b62a 100644 --- a/engines/mads/nebular/globals_nebular.h +++ b/engines/mads/nebular/globals_nebular.h @@ -178,7 +178,7 @@ enum GlobalId { kAntigravTiming = 162, kAntigravTiming0 = 163, kWindowFixed = 164, - kinSpace = 165, + kInSpace = 165, kReturnFromCut = 166, kBeamIsUp = 167, kForceBeamDown = 168, @@ -205,12 +205,85 @@ enum GlobalId { kTeleporterCode = 200 }; +/* Enums used for specific individual globals */ +/* Section #1 */ +// State of Meteorologist in the outpost +enum { METEOROLOGIST_ABSENT = 0, METEOROLOGIST_PRESENT = 1, METEOROLOGIST_GONE = 2 }; + +// State of watching the Meteorologist +enum { METEOROLOGIST_NORMAL = 0, METEOROLOGIST_GROUND = 1, METEOROLOGIST_TOWER = 2 }; + +// The fat bouncy lady that can squish you on the plains +enum { RHOTUNDA_HUNGRY = 0, RHOTUNDA_STUCK = 1, RHOTUNDA_GONE = 2 }; + +// Flags for the bones you can take +enum { BONE_202_LEFT_GONE = 1, BONE_202_RIGHT_GONE = 2 }; + +// Leaves used to cover the trap +enum { LEAVES_ON_GROUND = 0, LEAVES_WITH_PLAYER = 1, LEAVES_ON_TRAP = 2 }; + +// Monkey ambush state +enum { MONKEY_AMBUSH_READY = 0, MONKEY_HAS_BINOCULARS = 1, MONKEY_IS_GONE = 2 }; + +// Teleporter status flags +enum { + TELEPORTER_NONE = 0, TELEPORTER_BEAM_IN = 1, TELEPORTER_BEAM_OUT = 2, + TELEPORTER_STEP_OUT = 3, TELEPORTER_WRONG = 4 +}; + +// TWinkies status +enum { TWINKLES_AT_HOME = 0, TWINKLES_GONE = 1 }; + +/* Section #4 */ +// Status of the explosives +enum { EXPLOSIVES_INSIDE = 3 }; + +/* Section # 5 */ +enum { LINE_NOT_DROPPED = 1, LINE_DROPPED = 2, LINE_TIED = 3, LINE_NOW_UNTIED = 4 }; + +/* Section #6 */ +enum { + NO_CELLS = 0, // Handset doesn't contain any cells + CHARGED_DURAFAIL = 1, // Handset has charged durafail cells + UNCHARGED_DURAFAIL = 2, // Handset has uncharged durafail cells */ + PHONE_CELLS = 3, // Handset has already charged phone cells + FIRST_TIME_PHONE_CELLS = 4, // First time phone cells are in the handset + FIRST_TIME_UNCHARGED_DURAFAIL = 5, // First time uncharged cells are in penlight + FIRST_TIME_CHARGED_DURAFAIL = 6 // First time charged cells are in penlight +}; + +// Time bomb status +enum { + TIMEBOMB_DEACTIVATED = 0, TIMEBOMB_ACTIVATED = 1, + TIMEBOMB_BLOW_UP = 2, TIMEBOMB_DEAD = 3 +}; + +/* Section #7 */ +// Status of the the bottle +enum { + BOTTLE_EMPTY = 0, BOTTLE_ONE_QUARTER_FULL = 1, BOTTLE_HALF_FULL = 2, + BOTTLE_THREE_QUARTERS_FULL = 3, BOTTLE_FULL = 4 +}; + +// Status of the boat +enum { + BOAT_UNFLOODED = 0, BOAT_ADRIFT = 1, BOAT_TIED_FLOATING = 2, + BOAT_TIED = 3, BOAT_GONE = 4 +}; + + +/* Miscellaneous defines */ +#define TELEPORTER_COUNT 10 // Total number of teleporters +#define TELEPORTER_WORK_COUNT 6 // Total number that actually work + + class Globals { private: Common::Array _flags; public: Common::Array _spriteIndexes; - + + int _timebombClock, _timebombTimer; int _v0; uint32 _frameTime; int _v2; @@ -233,6 +306,11 @@ public: * Square brackets operator for accessing flags */ int16 &operator[](int idx) { return _flags[idx]; } + + /* + * Resets all the globals to empty + */ + void reset(); }; } // End of namespace Nebular diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 4fc1e3e48d..d0814f0ef2 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -152,7 +152,7 @@ void Scene201::enter() { _game._player._playerPos = Common::Point(165, 152); } else { _game._player._playerPos = Common::Point(223, 149); - _game._player._direction = FACING_SOUTH; + _game._player._facing = FACING_SOUTH; } if (_globals[kTeleporterCommand] != 0) { @@ -391,10 +391,10 @@ void Scene202::enter() { if (_scene->_priorSceneId == 201) { _game._player._playerPos = Common::Point(190, 91); - _game._player._direction = FACING_SOUTH; + _game._player._facing = FACING_SOUTH; } else if (_scene->_priorSceneId != -2) { _game._player._playerPos = Common::Point(178, 152); - _game._player._direction = FACING_NORTH; + _game._player._facing = FACING_NORTH; } if (_globals[kLadderBroken]) { @@ -440,12 +440,12 @@ void Scene202::enter() { if (_globals._v4) { _scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(247, 82)); _game._player._playerPos = Common::Point(246, 124); - _game._player._direction = FACING_NORTH; + _game._player._facing = FACING_NORTH; _globals[kTeleporterUnderstood] = -1; } else { _scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(172, 123)); _game._player._playerPos = Common::Point(171, 122); - _game._player._direction = FACING_NORTH; + _game._player._facing = FACING_NORTH; } _scene->loadAnimation(formAnimName('M', -1), 71); @@ -456,7 +456,7 @@ void Scene202::enter() { _scene->_sequences.setDepth(_globals._spriteIndexes[24], 1); _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(247, 82)); _game._player._playerPos = Common::Point(246, 124); - _game._player._direction = FACING_NORTH; + _game._player._facing = FACING_NORTH; } _globals._abortVal = 0; } @@ -470,7 +470,7 @@ void Scene202::setRandomKernelMessage() { } void Scene202::step() { - if ((_globals._v0 == 0) && (_game._player._playerPos == Common::Point(77, 105)) && (_game._player._direction == 8) && (_vm->getRandomNumber(999) == 0)) { + if ((_globals._v0 == 0) && (_game._player._playerPos == Common::Point(77, 105)) && (_game._player._facing == 8) && (_vm->getRandomNumber(999) == 0)) { _scene->_kernelMessages.reset(); _globals._v0 = 0; if (_vm->getRandomNumber(4) == 0) @@ -949,7 +949,7 @@ void Scene202::actions() { } else if (action->isAction(0x3, 0x142, 0)) { Dialog::show(0x4EF2); } else if (action->isAction(0x3, 0xAA, 0)) { - if ((_game._player._playerPos == Common::Point(77, 105)) && (_game._player._direction == 8)) + if ((_game._player._playerPos == Common::Point(77, 105)) && (_game._player._facing == 8)) Dialog::show(0x4EF4); else Dialog::show(0x4EF3); @@ -986,13 +986,13 @@ void Scene203::setup() { void Scene203::enter() { if (_scene->_priorSceneId == 202) { _game._player._playerPos = Common::Point(187, 99); - _game._player._direction = FACING_SOUTH; + _game._player._facing = FACING_SOUTH; } else if (_scene->_priorSceneId == 209) { _game._player._playerPos = Common::Point(308, 117); - _game._player._direction = FACING_WEST; + _game._player._facing = FACING_WEST; } else if (_scene->_priorSceneId == -2) { _game._player._playerPos = Common::Point(155, 152); - _game._player._direction = FACING_NORTH; + _game._player._facing = FACING_NORTH; } _globals._v0 = 0; @@ -1032,7 +1032,7 @@ void Scene203::step() { if ((_game._abortTimers == 0) && (_globals._frameTime != 0)) return; - if ((_game._player._playerPos != Common::Point(158, 136)) || (_game._player._direction != 2)) + if ((_game._player._playerPos != Common::Point(158, 136)) || (_game._player._facing != 2)) return; _globals._frameTime = 0xFFFF; @@ -1239,10 +1239,10 @@ void Scene207::enter() { _globals._v2 = 0; if (_scene->_priorSceneId == 211) { _game._player._playerPos = Common::Point(13, 105); - _game._player._direction = FACING_EAST; + _game._player._facing = FACING_EAST; } else if (_scene->_priorSceneId == 214) { _game._player._playerPos = Common::Point(164, 117); - _game._player._direction = FACING_SOUTH; + _game._player._facing = FACING_SOUTH; } else if (_scene->_priorSceneId != -2) { _game._player._playerPos = Common::Point(305, 131); } @@ -1386,16 +1386,16 @@ void Scene208::enter() { if (_scene->_priorSceneId == 207) { _game._player._playerPos = Common::Point(8, 122); - _game._player._direction = FACING_EAST; + _game._player._facing = FACING_EAST; } else if (_scene->_priorSceneId == 203) { _game._player._playerPos = Common::Point(142, 108); - _game._player._direction = FACING_SOUTH; + _game._player._facing = FACING_SOUTH; } else if (_scene->_priorSceneId == 209) { _game._player._playerPos = Common::Point(307, 123); - _game._player._direction = FACING_WEST; + _game._player._facing = FACING_WEST; } else if (_scene->_priorSceneId != -2) { _game._player._playerPos = Common::Point(162, 149); - _game._player._direction = FACING_NORTH; + _game._player._facing = FACING_NORTH; } _game.loadQuoteSet(0x81, 0x46, 0); @@ -1421,7 +1421,7 @@ void Scene208::step() { if (_globals._v0 == 0) return; - if ((_game._player._playerPos != Common::Point(20, 148)) || (_game._player._direction != 6)) + if ((_game._player._playerPos != Common::Point(20, 148)) || (_game._player._facing != 6)) return; if ((_game._abortTimers == 0) && ((_globals._frameTime & 0xFFFF) != 0)) @@ -1515,7 +1515,7 @@ void Scene208::actions() { } else if (_action.isAction(0x3, 0x1AA, 0)) { Dialog::show(0x5149); } else if (_action.isAction(0x3, 0x1A9, 0)) { - if (_game._difficultyLevel == DIFFICULTY_EASY) + if (_game._difficulty == DIFFICULTY_IMPOSSIBLE) Dialog::show(0x514A); else Dialog::show(0x514B); diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index c60a43a5e1..fa928916d6 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -90,7 +90,7 @@ void Scene804::enter() { _globals._v8 = 0; if (_globals[kCopyProtectFailed]) { // Copy protection failed - _globals[kinSpace] = -1; + _globals[kInSpace] = true; _globals[kWindowFixed] = 0; } @@ -103,7 +103,7 @@ void Scene804::enter() { _game.loadQuoteSet(791, 0); - if (_globals[kinSpace]) { + if (_globals[kInSpace]) { if (_globals[kWindowFixed]) { _globals._spriteIndexes[20] = _scene->_sequences.startCycle( _globals._spriteIndexes[5], 0, 1); @@ -137,7 +137,7 @@ void Scene804::enter() { Scene8xx::enter1(); - if (_globals[kinSpace] && !_globals[kWindowFixed]) { + if (_globals[kInSpace] && !_globals[kWindowFixed]) { _scene->_userInterface.setup(2); _vm->_sound->command(19); } @@ -191,7 +191,7 @@ void Scene804::step() { if (_scene->_activeAnimation->getCurrentFrame() == 81) { _globals._v5 = 80; } else { - _globals[kinSpace] = 0; + _globals[kInSpace] = 0; _globals[kBeamIsUp] = -1; assert(!_globals[kCopyProtectFailed]); _game._winStatus = 4; @@ -203,7 +203,7 @@ void Scene804::step() { if (_scene->_activeAnimation->getCurrentFrame() == 68) { _globals._v5 = 66; } else { - _globals[kinSpace] = 0; + _globals[kInSpace] = 0; _globals[kBeamIsUp] = -1; assert(!_globals[kCopyProtectFailed]); _game._winStatus = 4; diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index 03d03cb4a8..115a63045f 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -34,8 +34,8 @@ const int Player::_directionListIndexes[32] = { Player::Player(MADSEngine *vm): _vm(vm) { _action = nullptr; - _direction = FACING_NORTH; - _newDirection = FACING_NORTH; + _facing = FACING_NORTH; + _turnToFacing = FACING_NORTH; _targetFacing = FACING_NORTH; _spritesLoaded = false; _spritesStart = 0; @@ -73,7 +73,7 @@ void Player::reset() { _action = &_vm->_game->_scene._action; _destPos = _playerPos; _targetFacing = FACING_NONE; - _newDirection = _direction; + _turnToFacing = _facing; _moving = false; _newSceneId = _v844BE = 0; _next = 0; @@ -133,42 +133,42 @@ bool Player::loadSprites(const Common::String &prefix) { void Player::turnToDestFacing() { if (_targetFacing != 5) - _newDirection = _targetFacing; + _turnToFacing = _targetFacing; } void Player::dirChanged() { int dirIndex = 0, dirIndex2 = 0; int newDir = 0, newDir2 = 0; - if (_direction != _newDirection) { + if (_facing != _turnToFacing) { // Find the index for the given direction in the player direction list - int tempDir = _direction; + int tempDir = _facing; do { ++dirIndex; newDir += tempDir; tempDir = _directionListIndexes[tempDir + 10]; - } while (tempDir != _newDirection); + } while (tempDir != _turnToFacing); } - if (_direction != _newDirection) { + if (_facing != _turnToFacing) { // Find the index for the given direction in the player direction list - int tempDir = _direction; + int tempDir = _facing; do { ++dirIndex2; newDir2 += tempDir; tempDir = _directionListIndexes[tempDir + 20]; - } while (tempDir != _newDirection); + } while (tempDir != _turnToFacing); } int diff = dirIndex - dirIndex2; if (diff == 0) diff = newDir - newDir2; - _direction = (diff >= 0) ? (Facing)_directionListIndexes[_direction + 20] : - (Facing)_directionListIndexes[_direction + 10]; + _facing = (diff >= 0) ? (Facing)_directionListIndexes[_facing + 20] : + (Facing)_directionListIndexes[_facing + 10]; setupFrame(); - if ((_direction == _newDirection) && !_moving) + if ((_facing == _turnToFacing) && !_moving) updateFrame(); _priorTimer += 1; @@ -184,7 +184,7 @@ void Player::setupFrame() { resetActionList(); _frameOffset = 0; - _spritesIdx = _directionListIndexes[_direction]; + _spritesIdx = _directionListIndexes[_facing]; if (!_spriteSetsPresent[_spritesIdx]) { // Direction isn't present, so use alternate direction, with entries flipped _spritesIdx -= 4; @@ -425,7 +425,7 @@ void Player::move() { if (routeFlag && _moving) startMovement(); - if (_newDirection != _direction) + if (_turnToFacing != _facing) dirChanged(); else if (!_moving) updateFrame(); @@ -436,7 +436,7 @@ void Player::move() { var1 = MAX(1, 10000 / (v1 * _currentScale * var1)); } - if (!_moving || (_direction != _newDirection)) + if (!_moving || (_facing != _turnToFacing)) return; Common::Point newPos = _playerPos; @@ -490,7 +490,7 @@ void Player::move() { void Player::idle() { Scene &scene = _vm->_game->_scene; - if (_direction != _newDirection) { + if (_facing != _turnToFacing) { // The direction has changed, so reset for new direction dirChanged(); return; @@ -717,14 +717,14 @@ void Player::startMovement() { switch (majorDir) { case 1: - _newDirection = (_yDirection <= 0) ? FACING_NORTH : FACING_SOUTH; + _turnToFacing = (_yDirection <= 0) ? FACING_NORTH : FACING_SOUTH; break; case 2: { - _newDirection = (Facing)(((_yDirection <= 0) ? 9 : 3) - ((_xDirection <= 0) ? 2 : 0)); + _turnToFacing = (Facing)(((_yDirection <= 0) ? 9 : 3) - ((_xDirection <= 0) ? 2 : 0)); break; } case 3: - _newDirection = (_xDirection <= 0) ? FACING_WEST : FACING_EAST; + _turnToFacing = (_xDirection <= 0) ? FACING_WEST : FACING_EAST; break; default: break; diff --git a/engines/mads/player.h b/engines/mads/player.h index 6daacd99ab..754ac7edc8 100644 --- a/engines/mads/player.h +++ b/engines/mads/player.h @@ -105,8 +105,8 @@ private: public: MADSAction *_action; - Facing _direction; - Facing _newDirection; + Facing _facing; + Facing _turnToFacing; int _xDirection, _yDirection; Facing _targetFacing; bool _spritesLoaded; diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 6a42ed9005..c90a54c317 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -323,7 +323,7 @@ void Scene::doFrame() { _frameStartTime = _vm->_events->getFrameCounter(); if ((_action._inProgress && !player._moving && !_action._startWalkFlag && - player._newDirection == player._direction) || + player._turnToFacing == player._facing) || (_vm->_game->_abortTimers && _vm->_game->_abortTimersMode == ABORTMODE_0)) { doAction(); } -- cgit v1.2.3 From 2eaafe1579abf6ab895c903bbe802451cd36f98d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 26 Mar 2014 23:28:40 +0100 Subject: MADS: Review scene 201 --- engines/mads/nebular/nebular_scenes2.cpp | 29 +++++++++++++---------------- engines/mads/nebular/nebular_scenes2.h | 1 + 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index d0814f0ef2..dbd3ccc55f 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -73,9 +73,9 @@ void Scene2xx::sceneEntrySound() { switch (_scene->_nextSceneId) { case 201: if ((_globals[kTeleporterCommand] == 2) || (_globals[kTeleporterCommand] == 4) || (_globals[kMeteorologistStatus] != 1)) - _vm->_sound->command(17); - else _vm->_sound->command(9); + else + _vm->_sound->command(17); break; case 202: case 203: @@ -146,8 +146,6 @@ void Scene201::enter() { int idx = _scene->_dynamicHotspots.add(1159, 209, _globals._spriteIndexes[19], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, 186, 81, FACING_NORTH); - _globals._v0 = 0; - if ((_scene->_priorSceneId == 202) || (_scene->_priorSceneId == -1)) { _game._player._playerPos = Common::Point(165, 152); } else { @@ -155,7 +153,7 @@ void Scene201::enter() { _game._player._facing = FACING_SOUTH; } - if (_globals[kTeleporterCommand] != 0) { + if (_globals[kTeleporterCommand]) { _game._player._visible = false; _game._player._stepEnabled = false; int sepChar = (_globals[kSexOfRex] == SEX_UNKNOWN) ? 't' : 'u'; @@ -166,7 +164,7 @@ void Scene201::enter() { case 1: suffixNum = 3; abortTimers = 76; - _globals[kTeleporterUnderstood] = -1; + _globals[kTeleporterUnderstood] = true; break; case 2: suffixNum = 1; @@ -196,28 +194,28 @@ void Scene201::enter() { _scene->_sequences.setAnimRange(_globals._spriteIndexes[21], -1, 12); _scene->_sequences.addSubEntry(_globals._spriteIndexes[21], SM_FRAME_INDEX, 12, 70); _scene->_sequences.setDepth(_globals._spriteIndexes[21], 1); - _globals._frameTime = 0; + _pterodactylFlag = false; _game._player.startWalking(Common::Point(157, 143), FACING_NORTH); _vm->_palette->setEntry(252, 45, 63, 45); _vm->_palette->setEntry(253, 20, 45, 20); _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 2, 0, 120, _game.getQuote(90)); } else - _globals._frameTime = 0xFFFF; + _pterodactylFlag = true; - if (_globals[kTeleporterUnderstood] != 0) + if (_globals[kTeleporterUnderstood]) _scene->_hotspots.activate(438, false); sceneEntrySound(); } void Scene201::step() { - if ((_globals._frameTime) && (_vm->getRandomNumber(5000) == 9)) { + if (_pterodactylFlag && (_vm->getRandomNumber(5000) == 9)) { _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 5, 1, 6, 0); int idx = _scene->_dynamicHotspots.add(351, 13, _globals._spriteIndexes[20], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, 270, 80, FACING_EAST); _scene->_sequences.setDepth(_globals._spriteIndexes[20], 8); _vm->_sound->command(14); - _globals._frameTime = 0; + _pterodactylFlag = false; } if (_game._abortTimers == 70) { @@ -290,14 +288,13 @@ void Scene201::actions() { if (action->isAction(0x18C, 0x83, 0)) _scene->_nextSceneId = 202; else if ((action->isAction(0x50, 0x156, 0)) || (action->isAction(0x188, 0x16C, 0)) || (action->isAction(0x188, 0x1B6, 0))) { - if (_game._abortTimers != 0) { - if (_game._abortTimers != 1) - _scene->_nextSceneId = 213; - } else { + if (_game._abortTimers == 0) { _game._player._stepEnabled = false; _game._player._visible = false; int sepChar = (_globals[kSexOfRex] == SEX_UNKNOWN) ? 't' : 'u'; _scene->loadAnimation(formAnimName(sepChar, 0), 1); + } else if (_game._abortTimers == 1) { + _scene->_nextSceneId = 213; } } else if (action->isAction(0x3, 0x1A6, 0)) { Dialog::show(0x4E85); @@ -441,7 +438,7 @@ void Scene202::enter() { _scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(247, 82)); _game._player._playerPos = Common::Point(246, 124); _game._player._facing = FACING_NORTH; - _globals[kTeleporterUnderstood] = -1; + _globals[kTeleporterUnderstood] = true; } else { _scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(172, 123)); _game._player._playerPos = Common::Point(171, 122); diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index a23ae98b36..fef9f3c474 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -50,6 +50,7 @@ public: }; class Scene201: public Scene2xx { + bool _pterodactylFlag; public: Scene201(MADSEngine *vm) : Scene2xx(vm) {} virtual void setup(); -- cgit v1.2.3 From 253023b9bb35547c1afe9678f051fb83329d3245 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 26 Mar 2014 20:35:18 -0400 Subject: MADS: Add missing case for sprite assets palette loading --- engines/mads/assets.cpp | 32 +++++++++++++++++++++++++++++++- engines/mads/user_interface.cpp | 2 +- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/engines/mads/assets.cpp b/engines/mads/assets.cpp index 02b91aac2f..ec5d54251f 100644 --- a/engines/mads/assets.cpp +++ b/engines/mads/assets.cpp @@ -88,7 +88,37 @@ void SpriteAsset::load(Common::SeekableReadStream *stream, int flags) { // Process the palette data if (flags & 9) { - warning("TODO: Unknown palette processing"); + _usageIndex = 0; + + if (flags & 8) { + int newPalCtr = 0; + + for (uint i = 0; i < palette.size(); ++i) { + RGB6 &rgb = palette[i]; + + // Scan for existing rgb at beginning of the main palette + bool found = false; + for (int pIndex = 0; pIndex < 4 && !found; ++pIndex) { + byte *palP = &_vm->_palette->_mainPalette[pIndex * 3]; + if (palP[0] == rgb.r && palP[1] == rgb.g && palP[2] == rgb.b) { + rgb._palIndex = pIndex; + found = true; + } + } + + if (!found) { + // Existing palette entry not found, so need to add it in + int palIndex = (0xF7F607 >> (8 * newPalCtr)) & 0xff; + byte *palP = &_vm->_palette->_mainPalette[palIndex * 3]; + palP[0] = rgb.r; + palP[1] = rgb.g; + palP[2] = rgb.b; + rgb._palIndex = palIndex; + + newPalCtr = MIN(newPalCtr + 1, 2); + } + } + } } else { _usageIndex = _vm->_palette->_paletteUsage.process(palette, flags); assert(_usageIndex >= 0); diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 05e9b70432..67e6718c5d 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -196,7 +196,7 @@ UserInterface::UserInterface(MADSEngine *vm) : _vm(vm), _dirtyAreas(vm), _inventoryTopIndex = 0; _objectY = 0; _selectedInvIndex = -1; - _selectedActionIndex = -1; + _selectedActionIndex = 0; _selectedItemVocabIdx = -1; _scrollerY = 0; _highlightedActionIndex = -1; -- cgit v1.2.3 From eeb4b940b7245aedb7056947b4f5c435a43fc136 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 26 Mar 2014 20:47:46 -0400 Subject: MADS: Fixes for highlighting game actions --- engines/mads/font.cpp | 1 + engines/mads/user_interface.cpp | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/engines/mads/font.cpp b/engines/mads/font.cpp index e511bd8371..294139c3dd 100644 --- a/engines/mads/font.cpp +++ b/engines/mads/font.cpp @@ -116,6 +116,7 @@ void Font::setColors(uint8 v1, uint8 v2, uint8 v3, uint8 v4) { _fontColors[0] = v1; _fontColors[1] = v2; _fontColors[2] = v3; + _fontColors[3] = v4; } void Font::setColorMode(SelectionMode mode) { diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 67e6718c5d..2a99b61a63 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -687,7 +687,10 @@ void UserInterface::updateSelection(ScrCategory category, int newIndex, int *idx void UserInterface::updateRect(const Common::Rect &bounds) { _vm->_screen.setPointer(&_surface); setBounds(Common::Rect(0, MADS_SCENE_HEIGHT, MADS_SCREEN_WIDTH - 1, MADS_SCREEN_HEIGHT)); - _vm->_screen.copyRectToScreen(bounds); + + Common::Rect r = bounds; + r.translate(0, MADS_SCENE_HEIGHT); + _vm->_screen.copyRectToScreen(r); } void UserInterface::scrollerChanged() { -- cgit v1.2.3 From fc03e5a4fadaa30efa98902f6650eb3a98651abb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 26 Mar 2014 22:22:50 -0400 Subject: MADS: Fix for selecting actions from the list --- engines/mads/action.cpp | 13 ++++++------- engines/mads/action.h | 1 - engines/mads/events.cpp | 2 ++ engines/mads/screen.cpp | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index ca29527748..07af95e341 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -31,7 +31,6 @@ namespace MADS { MADSAction::MADSAction(MADSEngine *vm) : _vm(vm) { clear(); - _currentAction = VERB_NONE; _startWalkFlag = false; _statusTextIndex = -1; _selectedAction = 0; @@ -124,18 +123,18 @@ void MADSAction::set() { if (_selectedRow >= 0) { if (_actionMode == ACTIONMODE_VERB) { // Standard verb action - _currentAction = scene._verbList[_selectedRow]._id; + _action._verbId = scene._verbList[_selectedRow]._id; } else { // Selected action on an inventory object int invIndex = userInterface._selectedInvIndex; InventoryObject &objEntry = _vm->_game->_objects.getItem(invIndex); - _currentAction = objEntry._vocabList[_selectedRow]._vocabId; + _action._verbId = objEntry._vocabList[_selectedRow]._vocabId; } appendVocab(_action._verbId, true); - if (_currentAction == VERB_LOOK) { + if (_action._verbId == VERB_LOOK) { // Add in the word 'add' _statusText += kAtStr; _statusText += " "; @@ -164,11 +163,11 @@ void MADSAction::set() { if (verbId > 0) { // Set the specified action - _currentAction = verbId; - appendVocab(_currentAction, true); + _action._verbId = verbId; + appendVocab(_action._verbId, true); } else { // Default to a standard 'walk to' - _currentAction = VERB_WALKTO; + _action._verbId = VERB_WALKTO; _statusText += kWalkToStr; } } diff --git a/engines/mads/action.h b/engines/mads/action.h index 802dfb0576..26ab062673 100644 --- a/engines/mads/action.h +++ b/engines/mads/action.h @@ -78,7 +78,6 @@ private: void checkCustomDest(int v); public: ActionDetails _action, _activeAction; - int _currentAction; int8 _flags1, _flags2; ActionMode _actionMode; ActionMode2 _actionMode2; diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp index a4e1a96a5a..70ca166aab 100644 --- a/engines/mads/events.cpp +++ b/engines/mads/events.cpp @@ -128,6 +128,7 @@ void EventsManager::pollEvents() { case Common::EVENT_RBUTTONDOWN: _mouseClicked = true; _mouseButtons = 1; + _mouseMoved = true; return; case Common::EVENT_LBUTTONUP: case Common::EVENT_RBUTTONUP: @@ -190,6 +191,7 @@ void EventsManager::initVars() { void EventsManager::resetMouseFlags() { _mouseClicked = false; _mouseReleased = false; + _mouseButtons = 0; } } // End of namespace MADS diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index a2cc75f381..c881e9560e 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -300,7 +300,7 @@ void ScreenObjects::check(bool scanFlag) { // Handling for easy mouse ScrCategory category = scene._userInterface._category; - if (_vm->_easyMouse && !_vm->_events->_vD4 && category != _category + if (_vm->_easyMouse && _vm->_events->_mouseButtons && category != _category && scene._userInterface._category != CAT_NONE) { _released = true; if (category >= CAT_ACTION && category <= CAT_TALK_ENTRY) { @@ -310,7 +310,7 @@ void ScreenObjects::check(bool scanFlag) { scene._action.checkActionAtMousePos(); } - _released = _vm->_events->_mouseReleased; + //_released = _vm->_events->_mouseReleased; if (_vm->_events->_vD2 || (_vm->_easyMouse && !_vm->_events->_vD4)) scene._userInterface._category = _category; -- cgit v1.2.3 From 0a4c4c8eda3500915372a6c9987e524016ec566f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 26 Mar 2014 22:58:24 -0400 Subject: MADS: Walking is now sort of working --- engines/mads/action.cpp | 5 ++++- engines/mads/events.cpp | 26 +++++++++++++++++++------- engines/mads/events.h | 2 -- engines/mads/scene.cpp | 3 --- 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index 07af95e341..c13f65a96c 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -557,8 +557,11 @@ void MADSAction::leftClick() { _v86F4C = -1; _v86F4E = 0; - if (_vm->_events->currentPos().y < MADS_SCENE_HEIGHT) + if (_vm->_events->currentPos().y < MADS_SCENE_HEIGHT) { scene._customDest = _vm->_events->currentPos() + scene._posAdjust; + _selectedAction = -1; + _v86F4A = -1; + } break; case CAT_TALK_ENTRY: diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp index 70ca166aab..4b143ec0e2 100644 --- a/engines/mads/events.cpp +++ b/engines/mads/events.cpp @@ -177,9 +177,27 @@ void EventsManager::delay(int cycles) { } void EventsManager::waitForNextFrame() { + _mouseClicked = false; + _mouseReleased = false; + _mouseButtons = 0; + + bool mouseClicked = false; + bool mouseReleased = false; + int mouseButtons = 0; + uint32 frameCtr = getFrameCounter(); - while (!_vm->shouldQuit() && frameCtr == _frameCounter) + while (!_vm->shouldQuit() && frameCtr == _frameCounter) { delay(1); + + mouseClicked |= _mouseClicked; + mouseReleased |= _mouseReleased; + mouseButtons |= _mouseButtons; + } + + _mouseClicked = mouseClicked; + _mouseReleased = mouseReleased; + _mouseButtons = mouseButtons; + _mouseMoved = _mouseClicked || _mouseReleased; } void EventsManager::initVars() { @@ -188,10 +206,4 @@ void EventsManager::initVars() { _vD2 = _vD8 = 0; } -void EventsManager::resetMouseFlags() { - _mouseClicked = false; - _mouseReleased = false; - _mouseButtons = 0; -} - } // End of namespace MADS diff --git a/engines/mads/events.h b/engines/mads/events.h index b7af148e7e..219af20c2a 100644 --- a/engines/mads/events.h +++ b/engines/mads/events.h @@ -141,8 +141,6 @@ public: uint32 getFrameCounter() const { return _frameCounter; } void initVars(); - - void resetMouseFlags(); }; } // End of namespace MADS diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index c90a54c317..f16b2c3889 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -272,9 +272,6 @@ void Scene::loop() { // Handle drawing a game frame doFrame(); - // Reset mouse flags - _vm->_events->resetMouseFlags(); - // TODO: Verify correctness of frame wait _vm->_events->waitForNextFrame(); -- cgit v1.2.3 From 0e0792b37fae4f812593b6e167be5d51250a9caa Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 27 Mar 2014 23:06:27 +0100 Subject: MADS: Some polishing work on Scene 202 --- engines/mads/nebular/nebular_scenes2.cpp | 56 +++++++++++++++----------------- engines/mads/nebular/nebular_scenes2.h | 6 ++-- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index dbd3ccc55f..4a1dd097ee 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -367,7 +367,7 @@ void Scene202::enter() { int idx = _scene->_dynamicHotspots.add(320, 13, _globals._spriteIndexes[17], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, 153, 97, FACING_SOUTH); - if (_globals[kBone202Status] & 1) { + if (!(_globals[kBone202Status] & 1)) { _globals._spriteIndexes[16] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 6, 0, 0, 0); _scene->_sequences.setMsgPosition(_globals._spriteIndexes[16], Common::Point(130, 108)); _scene->_sequences.setDepth(_globals._spriteIndexes[16], 10); @@ -375,7 +375,7 @@ void Scene202::enter() { _scene->_dynamicHotspots.setPosition(idx, 132, 97, FACING_SOUTH); } - if (_globals[kBone202Status] & 2) { + if (!(_globals[kBone202Status] & 2)) { _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 6, 0, 0, 0); _scene->_sequences.setMsgPosition(_globals._spriteIndexes[21], Common::Point(166, 110)); _scene->_sequences.setDepth(_globals._spriteIndexes[21], 10); @@ -403,16 +403,16 @@ void Scene202::enter() { } _game.loadQuoteSet(0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x62, 0x63, 0x64, 0x65, 0x66, 0x61, 0); - _globals._v0 = 0; + _activeMsgFl = false; - if (_scene->_priorSceneId == -1) { - if (_globals._v5) { + if (_scene->_priorSceneId == -2) { + if (_waitingMeteorologistFl) { _globals._spriteIndexes[24] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 1); _game._player._visible = false; } } else { - _globals._v5 = 0; - _globals._v4 = 0; + _waitingMeteorologistFl = false; + _ladderTopFl = false; } _globals._v8425C = _globals._v7 = _scene->_frameStartTime; @@ -424,9 +424,9 @@ void Scene202::enter() { _game._player._visible = false; _game._player._stepEnabled = false; if (_globals[kMeteorologistWatch] == 2) - _globals._v4 = 1; + _ladderTopFl = true; else - _globals._v4 = 0; + _ladderTopFl = false; if (_globals[kMeteorologistWatch] < 1) _globals._spriteIndexes[25] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 6); @@ -434,7 +434,7 @@ void Scene202::enter() { _globals._spriteIndexes[25] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 8); _scene->_sequences.setDepth(_globals._spriteIndexes[25], 1); - if (_globals._v4) { + if (_ladderTopFl) { _scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(247, 82)); _game._player._playerPos = Common::Point(246, 124); _game._player._facing = FACING_NORTH; @@ -463,19 +463,19 @@ void Scene202::setRandomKernelMessage() { _scene->_kernelMessages.reset(); _game._abortTimersMode2 = ABORTMODE_1; _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 70, 120, _game.getQuote(vocabId)); - _globals._v0 = -1; + _activeMsgFl = true; } void Scene202::step() { - if ((_globals._v0 == 0) && (_game._player._playerPos == Common::Point(77, 105)) && (_game._player._facing == 8) && (_vm->getRandomNumber(999) == 0)) { + if (!_activeMsgFl && (_game._player._playerPos == Common::Point(77, 105)) && (_game._player._facing == 8) && (_vm->getRandomNumber(999) == 0)) { _scene->_kernelMessages.reset(); - _globals._v0 = 0; + _activeMsgFl = false; if (_vm->getRandomNumber(4) == 0) setRandomKernelMessage(); } if (_game._abortTimers == 70) - _globals._v0 = 0; + _activeMsgFl = false; if (_game._abortTimers == 71) { _vm->_sound->command(3); @@ -483,7 +483,7 @@ void Scene202::step() { _globals._v8425C = 900 + _scene->_frameStartTime; Common::Point msgPos; int msgFlag; - if (_globals._v4 == 0) { + if (!_ladderTopFl) { msgPos = Common::Point(0, 0); msgFlag = 2; } else { @@ -542,7 +542,7 @@ void Scene202::step() { _scene->_sequences.updateTimeout(-1, _globals._spriteIndexes[26]); _game._player._stepEnabled = true; _game._player._visible = true; - _globals._v4 = false; + _ladderTopFl = false; _scene->_kernelMessages.reset(); _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(99)); } @@ -554,7 +554,7 @@ void Scene202::step() { if (!_scene->_activeAnimation && (_globals[kMeteorologistStatus] != 2) && (_globals._v7 <= _scene->_frameStartTime) && (_globals._v8425C <= _scene->_frameStartTime)) { int randVal = _vm->getRandomNumber(1, 500); int threshold = 1; - if (_globals._v4) + if (_ladderTopFl) threshold = 26; if (!_globals[kMeteorologistEverSeen]) threshold = 25; @@ -575,7 +575,7 @@ void Scene202::step() { if (!_scene->_activeAnimation) return; - if (_globals._v5) { + if (_waitingMeteorologistFl) { if (_scene->_activeAnimation->getCurrentFrame() >= 200) { if ((_globals[kMeteorologistWatch] == 2) || _globals[kLadderBroken]) { _scene->_nextSceneId = 213; @@ -588,7 +588,7 @@ void Scene202::step() { if ((_scene->_activeAnimation->getCurrentFrame() == 160) && (_globals._v84260 != _scene->_activeAnimation->getCurrentFrame())) { Common::Point msgPos; int msgFlag; - if (_globals._v4 == 0) { + if (!_ladderTopFl) { msgPos = Common::Point(0, 0); msgFlag = 2; } else { @@ -716,7 +716,7 @@ void Scene202::preActions() { if (action->_walkFlag) _scene->_kernelMessages.reset(); - if ((_globals._v4 == 0) && (action->isAction(0x4E, 0xC7, 0) || !action->_walkFlag)) { + if (!_ladderTopFl && (action->isAction(0x4E, 0xC7, 0) || !action->_walkFlag)) { if (_game._abortTimers == 0) { _vm->_sound->command(29); action->_walkFlag = false; @@ -732,19 +732,17 @@ void Scene202::preActions() { _game._player._visible = true; action->_walkFlag = true; _game._player._stepEnabled = true; - _globals._v4 = 0; - } else { - // nothing + _ladderTopFl = false; } } if (action->isAction(0x3, 0x27, 0) && action->_activeAction._indirectObjectId > 0) { - if (!action->_walkFlag || (_globals._v4 != 0)) + if (!action->_walkFlag || _ladderTopFl) action->_startWalkFlag = false; else action->_startWalkFlag = true; - if (_globals._v4 == 0) + if (!_ladderTopFl) _game._player.startWalking(Common::Point(171, 122), FACING_NORTH); } } @@ -821,7 +819,7 @@ void Scene202::actions() { _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(247, 82)); _scene->_sequences.setDepth(_globals._spriteIndexes[24], 1); _scene->_sequences.updateTimeout(_globals._spriteIndexes[23], _globals._spriteIndexes[24]); - _globals._v4 = -1; + _ladderTopFl = true; _game._player._stepEnabled = true; int msgIndex = _scene->_kernelMessages.add(Common::Point(248, 15), 0x1110, 32, 0, 60, _game.getQuote(97)); _scene->_kernelMessages.setQuoted(msgIndex, 4, true); @@ -830,7 +828,7 @@ void Scene202::actions() { return; } } else if (((action->isAction(0x3, 0x27, 0x82)) || (action->isAction(0x3, 0x27, 0x1B6))) && (_globals[kSexOfRex] == SEX_MALE)) { - if (_globals._v4 == 0) { + if (!_ladderTopFl) { if (_game._abortTimers == 0) { _game._player._stepEnabled = false; _game._player._visible= false; @@ -845,7 +843,7 @@ void Scene202::actions() { _scene->_sequences.setDepth(_globals._spriteIndexes[25], 1); _scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(172, 123)); if (_scene->_activeAnimation) { - _globals._v5 = -1; + _waitingMeteorologistFl = true; _globals[kMeteorologistWatch] = 1; } else { _scene->_sequences.addTimer(120, 2); @@ -885,7 +883,7 @@ void Scene202::actions() { if (_scene->_activeAnimation->getCurrentFrame() > 200) { _scene->_sequences.addTimer(120, 2); } else { - _globals._v5 = -1; + _waitingMeteorologistFl = true; _globals[kMeteorologistWatch] = 2; if ((_scene->_activeAnimation->getCurrentFrame() >= 44) && (_scene->_activeAnimation->getCurrentFrame() <= 75)) { _scene->_kernelMessages.reset(); diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index fef9f3c474..7ef50e1afd 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -52,7 +52,7 @@ public: class Scene201: public Scene2xx { bool _pterodactylFlag; public: - Scene201(MADSEngine *vm) : Scene2xx(vm) {} + Scene201(MADSEngine *vm) : Scene2xx(vm), _pterodactylFlag(false) {} virtual void setup(); virtual void enter(); virtual void step(); @@ -63,13 +63,15 @@ public: class Scene202: public Scene2xx { private: + bool _activeMsgFl, _ladderTopFl, _waitingMeteorologistFl; + int subStep1(int randVal); int subStep2(int randVal); int subStep3(int randVal); int subStep4(int randVal); public: - Scene202(MADSEngine *vm) : Scene2xx(vm) {} + Scene202(MADSEngine *vm) : Scene2xx(vm), _activeMsgFl(false), _ladderTopFl(false), _waitingMeteorologistFl(false) {} virtual void setup(); virtual void enter(); virtual void step(); -- cgit v1.2.3 From 377cbbe77d5c7f16aba086e4fb1707de843ddc1a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 27 Mar 2014 21:04:27 -0400 Subject: MADS: Cleanup of game and player fields used during initialization --- engines/mads/dialogs.cpp | 4 + engines/mads/dialogs.h | 5 +- engines/mads/events.cpp | 2 +- engines/mads/events.h | 4 +- engines/mads/game.cpp | 35 +++---- engines/mads/game.h | 14 ++- engines/mads/inventory.cpp | 6 +- engines/mads/nebular/nebular_scenes1.cpp | 46 ++++----- engines/mads/nebular/nebular_scenes2.cpp | 158 +++++++++++++++---------------- engines/mads/nebular/nebular_scenes8.cpp | 4 +- engines/mads/player.cpp | 6 +- engines/mads/player.h | 2 + engines/mads/user_interface.cpp | 2 +- 13 files changed, 150 insertions(+), 138 deletions(-) diff --git a/engines/mads/dialogs.cpp b/engines/mads/dialogs.cpp index d5d7d64380..c5e99f859e 100644 --- a/engines/mads/dialogs.cpp +++ b/engines/mads/dialogs.cpp @@ -341,4 +341,8 @@ Dialogs::Dialogs(MADSEngine *vm): _vm(vm) { _pendingDialog = DIALOG_NONE; } +void Dialogs::show(int msgId) { + +} + } // End of namespace MADS diff --git a/engines/mads/dialogs.h b/engines/mads/dialogs.h index 56bc8ced53..3f623a688b 100644 --- a/engines/mads/dialogs.h +++ b/engines/mads/dialogs.h @@ -68,10 +68,6 @@ public: * Destructor */ virtual ~Dialog(); - - static void show(int msgId) { - warning("TODO: Dialog::show"); - } }; enum { @@ -194,6 +190,7 @@ public: virtual void showDialog() = 0; virtual void showPicture(int objId, int msgId, int arg3 = 0) = 0; + void show(int msgId); }; } // End of namespace MADS diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp index 4b143ec0e2..37a1eec969 100644 --- a/engines/mads/events.cpp +++ b/engines/mads/events.cpp @@ -76,7 +76,7 @@ void EventsManager::hideCursor() { CursorMan.showMouse(false); } -void EventsManager::resetCursor() { +void EventsManager::waitCursor() { CursorType cursorId = (CursorType)MIN(_cursorSprites->getCount(), (int)CURSOR_WAIT); _newCursorId = cursorId; if (_cursorId != _newCursorId) { diff --git a/engines/mads/events.h b/engines/mads/events.h index 219af20c2a..b0b20b4853 100644 --- a/engines/mads/events.h +++ b/engines/mads/events.h @@ -101,9 +101,9 @@ public: void hideCursor(); /** - * Resets the cursor, if necessary + * Shows the wait cursor */ - void resetCursor(); + void waitCursor(); /** * Free currently loaded cursors diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 50a4f6358d..b89f83384b 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -49,9 +49,10 @@ Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm), _sectionNumber = 1; _priorSectionNumber = 0; _currentSectionNumber = -1; - _v1 = _v2 = 0; - _v3 = _v4 = 0; - _v5 = _v6 = 0; + _kernelMode = KERNEL_GAME_LOAD; + _v2 = 0; + _quoteEmergency = false; + _vocabEmergency = false; _aaName = "*I0.AA"; _playerSpritesFlag = false; _priorFrameTimer = 0; @@ -142,7 +143,7 @@ void Game::gameLoop() { } // TODO: Extra reset methods - _vm->_events->resetCursor(); + _vm->_events->waitCursor(); _vm->_events->freeCursors(); _vm->_sound->closeDriver(); } @@ -152,29 +153,31 @@ void Game::gameLoop() { void Game::sectionLoop() { while (!_vm->shouldQuit() && _statusFlag && _sectionNumber == _currentSectionNumber) { - _v1 = 3; + _kernelMode = KERNEL_ROOM_PRELOAD; _player._spritesChanged = true; - _v5 = 0; - _v6 = 0; - _vm->_events->resetCursor(); + _quoteEmergency = false; + _vocabEmergency = false; + _vm->_events->waitCursor(); _scene.clearVocab(); _scene._dynamicHotspots.clear(); _scene.loadSceneLogic(); - _v4 = 0; + _player._walkAnywhere = false; _player._stepEnabled = true; _player._visible = true; _vm->_dialogs->_defaultPosition = Common::Point(-1, -1); _visitedScenes.add(_scene._nextSceneId); + // Reset the user interface _screenObjects._v8333C = true; _screenObjects._v832EC = 0; _scene._userInterface._scrollerY = 0; - _v3 = -1; + + _player._loadsFirst = true; _scene._sceneLogic->setup(); - if (_player._spritesChanged || _v3) { + if (_player._spritesChanged || _player._loadsFirst) { if (_player._spritesLoaded) _scene._spriteSlots.releasePlayerSprites(); _vm->_palette->resetGamePalette(18, 10); @@ -185,7 +188,7 @@ void Game::sectionLoop() { _vm->_palette->_paletteUsage.load(3, 0xF0, 0xF1, 0xF2); - if (!_player._spritesLoaded && _v3) { + if (!_player._spritesLoaded && _player._loadsFirst) { if (_player.loadSprites("")) _vm->quitGame(); _playerSpritesFlag = true; @@ -247,10 +250,10 @@ void Game::sectionLoop() { _scene._userInterface.noInventoryAnim(); } - _v1 = 5; + _kernelMode = KERNEL_ACTIVE_CODE; _scene._roomChanged = false; - if ((_v5 || _v6) && !_updateSceneFlag) { + if ((_quoteEmergency || _vocabEmergency) && !_updateSceneFlag) { _scene._currentSceneId = _scene._priorSceneId; _updateSceneFlag = true; } else { @@ -258,8 +261,8 @@ void Game::sectionLoop() { _scene.loop(); } - _vm->_events->resetCursor(); - _v1 = 3; + _vm->_events->waitCursor(); + _kernelMode = KERNEL_ROOM_PRELOAD; delete _scene._animationData; _scene._animationData = nullptr; diff --git a/engines/mads/game.h b/engines/mads/game.h index 0d7178a567..11fd95491e 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -43,9 +43,15 @@ enum Difficulty { DIFFICULTY_HARD = 1, DIFFICULTY_REALLY_HARD = 2, DIFFICULTY_IMPOSSIBLE = 3 }; +enum KernelMode { + KERNEL_GAME_LOAD = 0, KERNEL_SECTION_PRELOAD = 1, KERNEL_SECTION_INIT = 2, + KERNEL_ROOM_PRELOAD = 3, KERNEL_ROOM_INIT = 4, KERNEL_ACTIVE_CODE = 5 +}; + enum ProtectionResult { PROTECTION_SUCCEED = 0, PROTECTION_FAIL = 1, PROTECTION_ESCAPE = 2 }; +; class Game { private: @@ -69,8 +75,8 @@ protected: int _saveSlot; int _statusFlag; Common::StringArray _quotes; - int _v5; - int _v6; + bool _quoteEmergency; + bool _vocabEmergency; bool _updateSceneFlag; bool _playerSpritesFlag; @@ -125,10 +131,8 @@ public: SectionHandler *_sectionHandler; VisitedScenes _visitedScenes; Scene _scene; - int _v1; + KernelMode _kernelMode; int _v2; - int _v3; - int _v4; int _abortTimers; int _abortTimers2; AbortTimerMode _abortTimersMode; diff --git a/engines/mads/inventory.cpp b/engines/mads/inventory.cpp index 3237d55b77..a8e50e6ae1 100644 --- a/engines/mads/inventory.cpp +++ b/engines/mads/inventory.cpp @@ -116,7 +116,7 @@ void InventoryObjects::addToInventory(int objectId) { (*this)[objectId]._roomNumber = PLAYER_INVENTORY; - if (_vm->_game->_v1 == 5 && !_vm->_game->_screenObjects._v832EC) { + if (_vm->_game->_kernelMode == KERNEL_ACTIVE_CODE && !_vm->_game->_screenObjects._v832EC) { userInterface.categoryChanged(); userInterface.selectObject(userInterface._selectedInvIndex); } @@ -137,7 +137,7 @@ void InventoryObjects::removeFromInventory(int objectId, int newScene) { int selectedIndex = userInterface._selectedInvIndex; bool noSelection = selectedIndex < 0; - if (_vm->_game->_v1 == 5 && !_vm->_game->_screenObjects._v832EC) + if (_vm->_game->_kernelMode == KERNEL_ACTIVE_CODE && !_vm->_game->_screenObjects._v832EC) userInterface.selectObject(-1); // Remove the item from the inventory list @@ -158,7 +158,7 @@ void InventoryObjects::removeFromInventory(int objectId, int newScene) { newIndex = 0; } - if (_vm->_game->_v1 == 5 && !_vm->_game->_screenObjects._v832EC) { + if (_vm->_game->_kernelMode == KERNEL_ACTIVE_CODE && !_vm->_game->_screenObjects._v832EC) { userInterface.categoryChanged(); userInterface.selectObject(newIndex); } diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 4c3b67f3c5..554c73ddc6 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -89,7 +89,7 @@ void Scene1xx::setPlayerSpritesPrefix() { _game._player._spritesChanged = true; if (_scene->_nextSceneId == 105 || (_scene->_nextSceneId == 109 && _globals[kHoovicAlive])) { _game._player._spritesChanged = true; - _game._v3 = 0; + _game._player._loadsFirst = false; } _game._player._unk3 = 0; @@ -258,7 +258,7 @@ void Scene103::preActions() { void Scene103::actions() { if (_action._savedFields._lookFlag) { - Dialog::show(10322); + _vm->_dialogs->show(10322); } else if (_action.isAction(395, 110, 0)) { switch (_vm->_game->_abortTimers) { case 0: @@ -342,7 +342,7 @@ void Scene103::actions() { break; } } else if (_action.isAction(VERB_LOOK, 362, 0)) { - Dialog::show(10301); + _vm->_dialogs->show(10301); } else if (_action.isAction(VERB_TAKE, 362, 0)) { if (!_vm->_game->_abortTimers) _vm->_sound->command(31); @@ -364,12 +364,12 @@ void Scene103::actions() { _game._player._stepEnabled = _game._abortTimers == 2; _globals[kTurkeyExploded] = -1; if (_game._abortTimers == 2) { - Dialog::show(1030); + _vm->_dialogs->show(1030); _scene->_hotspots.activate(362, false); } } } else if (_action.isAction(VERB_LOOK, 250, 0)) { - Dialog::show(!_globals[kTurkeyExploded] ? 10323 : 10303); + _vm->_dialogs->show(!_globals[kTurkeyExploded] ? 10323 : 10303); } else if (_action.isAction(VERB_TALKTO, 27, 0)) { switch (_vm->_game->_abortTimers) { @@ -394,46 +394,46 @@ void Scene103::actions() { case 3: _game._player._stepEnabled = true; - Dialog::show(10306); + _vm->_dialogs->show(10306); break; default: break; } } else if (!_action.isAction(VERB_LOOK, 27, 0)) { - Dialog::show(10304); + _vm->_dialogs->show(10304); } else if (!_action.isAction(VERB_LOOK, 36, 0)) { - Dialog::show(10307); + _vm->_dialogs->show(10307); } else if (!_action.isAction(VERB_LOOK, 55, 0)) { - Dialog::show(10308); + _vm->_dialogs->show(10308); } else if (!_action.isAction(VERB_TAKE, 315, 0)) { - Dialog::show(10309); + _vm->_dialogs->show(10309); } else if (!_action.isAction(VERB_TAKE, 85, 0)) { - Dialog::show(10310); + _vm->_dialogs->show(10310); } else if (!_action.isAction(VERB_LOOK, 144, 0)) { - Dialog::show(10312); + _vm->_dialogs->show(10312); } else if (!_action.isAction(VERB_OPEN, 144, 0)) { - Dialog::show(10313); + _vm->_dialogs->show(10313); } else if (!_action.isAction(VERB_CLOSE, 27, 0)) { - Dialog::show(10314); + _vm->_dialogs->show(10314); } else if (!_action.isAction(VERB_LOOK, 310, 0)) { - Dialog::show(10315); + _vm->_dialogs->show(10315); } else if (!_action.isAction(VERB_LOOK, 178, 0)) { - Dialog::show(10316); + _vm->_dialogs->show(10316); } else if (!_action.isAction(VERB_LOOK, 283, 0)) { - Dialog::show(10317); + _vm->_dialogs->show(10317); } else if (!_action.isAction(VERB_LOOK, 120, 0)) { - Dialog::show(10318); + _vm->_dialogs->show(10318); } else if (_action.isAction(VERB_LOOK, 289, 0) && _game._objects.isInInventory(OBJ_REBREATHER)) { - Dialog::show(10319); + _vm->_dialogs->show(10319); } else if (_action.isAction(VERB_LOOK, 371, 0) && _game._objects.isInInventory(OBJ_TIMER_MODULE)) { - Dialog::show(10320); + _vm->_dialogs->show(10320); } else if (!_action.isAction(VERB_LOOK, 137, 0)) { - Dialog::show(10321); + _vm->_dialogs->show(10321); } else if (_action.isAction(VERB_LOOK, 409, 0)) { - Dialog::show(_game._objects.isInInventory(OBJ_TIMER_MODULE) ? 10324 : 10325); + _vm->_dialogs->show(_game._objects.isInInventory(OBJ_TIMER_MODULE) ? 10324 : 10325); } _action._inProgress = false; @@ -441,7 +441,7 @@ void Scene103::actions() { void Scene103::postActions() { if (_action.isAction(27) && !_action.isAction(13)) { - Dialog::show(0x2841); + _vm->_dialogs->show(0x2841); _action._inProgress = false; } else { if (_action.isAction(7, 85, 144)) { diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 4a1dd097ee..83dcfa3865 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -62,7 +62,7 @@ void Scene2xx::setPlayerSpritesPrefix() { _game._player._spritesChanged = true; if ((_scene->_nextSceneId == 203 || _scene->_nextSceneId == 204) && _globals[kRhotundaStatus]) - _game._v3 = 0; + _game._player._loadsFirst = false; _vm->_palette->setEntry(16, 10, 63, 63); _vm->_palette->setEntry(17, 10, 45, 45); @@ -277,7 +277,7 @@ void Scene201::step() { if (_game._abortTimers == 78) { _vm->_sound->command(40); - Dialog::show(0x4E92); + _vm->_dialogs->show(0x4E92); _scene->_reloadSceneFlag = true; } } @@ -297,34 +297,34 @@ void Scene201::actions() { _scene->_nextSceneId = 213; } } else if (action->isAction(0x3, 0x1A6, 0)) { - Dialog::show(0x4E85); + _vm->_dialogs->show(0x4E85); } else if (action->isAction(0x3, 0x129, 0)) { - Dialog::show(0x4E86); + _vm->_dialogs->show(0x4E86); } else if (action->isAction(0x3, 0x16F, 0)) { - Dialog::show(0x4E87); + _vm->_dialogs->show(0x4E87); } else if (action->isAction(0x3, 0x142, 0)) { - Dialog::show(0x4E88); + _vm->_dialogs->show(0x4E88); } else if (action->isAction(0x3, 0x18F, 0)) { - Dialog::show(0x4E89); + _vm->_dialogs->show(0x4E89); } else if (action->isAction(0x3, 0x1B9, 0)) { - Dialog::show(0x4E8A); + _vm->_dialogs->show(0x4E8A); } else if (action->isAction(0x3, 0x192, 0)) { - Dialog::show(0x4E8B); + _vm->_dialogs->show(0x4E8B); } else if (action->isAction(0x3, 0x1BA, 0)) { - Dialog::show(0x4E8C); + _vm->_dialogs->show(0x4E8C); } else if (action->isAction(0x3, 0x83, 0)) { - Dialog::show(0x4E8E); + _vm->_dialogs->show(0x4E8E); } else if (action->isAction(0x3, 0x1B6, 0)) { if (_globals[kMeteorologistEverSeen]) - Dialog::show(0x4E90); + _vm->_dialogs->show(0x4E90); else - Dialog::show(0x4E8D); + _vm->_dialogs->show(0x4E8D); } else if (action->isAction(0x3, 0x16C, 0)) { - Dialog::show(0x4E91); + _vm->_dialogs->show(0x4E91); } else return; } else { - Dialog::show(0x4E8F); + _vm->_dialogs->show(0x4E8F); } action->_inProgress = false; } @@ -580,7 +580,7 @@ void Scene202::step() { if ((_globals[kMeteorologistWatch] == 2) || _globals[kLadderBroken]) { _scene->_nextSceneId = 213; } else { - Dialog::show(0x4EE9); + _vm->_dialogs->show(0x4EE9); _scene->_reloadSceneFlag = true; } } @@ -767,7 +767,7 @@ void Scene202::actions() { if (action->_actionMode2 == 4) { if (_game._abortTimers == 0) { if (_game._objects.isInInventory(OBJ_BONES)) { - Dialog::show(0x4EFB); + _vm->_dialogs->show(0x4EFB); } else { _game._player._stepEnabled = false; _game._player._visible = false; @@ -850,7 +850,7 @@ void Scene202::actions() { } } else if (_game._abortTimers == 2) { if (!_scene->_activeAnimation && (_globals._abortVal == 0)) { - Dialog::show(0x4EFE); + _vm->_dialogs->show(0x4EFE); } _scene->_sequences.remove(_globals._spriteIndexes[25]); _globals._spriteIndexes[25] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[9], false, 6, 1, 0, 0); @@ -899,7 +899,7 @@ void Scene202::actions() { } } else if (_game._abortTimers == 2) { if (!_scene->_activeAnimation) - Dialog::show(0x4EFE); + _vm->_dialogs->show(0x4EFE); _globals._abortVal = 0; _scene->_sequences.remove(_globals._spriteIndexes[25]); _globals._spriteIndexes[24] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[9], false, 6, 1, 0, 0); @@ -919,53 +919,53 @@ void Scene202::actions() { } else if (action->isAction(0x188, 0xAA, 0)) { setRandomKernelMessage(); } else if (action->isAction(0x3, 0x129, 0)) { - Dialog::show(0x4EEA); + _vm->_dialogs->show(0x4EEA); } else if (action->isAction(0x3, 0x86, 0)) { - Dialog::show(0x4EEB); + _vm->_dialogs->show(0x4EEB); } else if (action->isAction(0x3, 0x19C, 0)) { - Dialog::show(0x4EEC); + _vm->_dialogs->show(0x4EEC); } else if (action->isAction(0x3, 0x82, 0)) { if ((_globals[kMeteorologistStatus] == 0) || (_globals[kMeteorologistStatus] == 2)) { - Dialog::show(0x4EED); + _vm->_dialogs->show(0x4EED); } else if (_globals[kMeteorologistStatus] == 1) { - Dialog::show(0x4EFC); + _vm->_dialogs->show(0x4EFC); } else { action->_inProgress = false; return; } } else if (action->isAction(0x3, 0x18E, 0)) { - Dialog::show(0x4EEE); + _vm->_dialogs->show(0x4EEE); } else if (action->isAction(0x3, 0x164, 0)) { - Dialog::show(0x4EEF); + _vm->_dialogs->show(0x4EEF); } else if (action->isAction(0x3, 0x175, 0)) { - Dialog::show(0x4EF0); + _vm->_dialogs->show(0x4EF0); } else if (action->isAction(0x3, 0x174, 0)) { - Dialog::show(0x4EF1); + _vm->_dialogs->show(0x4EF1); } else if (action->isAction(0x3, 0x142, 0)) { - Dialog::show(0x4EF2); + _vm->_dialogs->show(0x4EF2); } else if (action->isAction(0x3, 0xAA, 0)) { if ((_game._player._playerPos == Common::Point(77, 105)) && (_game._player._facing == 8)) - Dialog::show(0x4EF4); + _vm->_dialogs->show(0x4EF4); else - Dialog::show(0x4EF3); + _vm->_dialogs->show(0x4EF3); } else if (action->isAction(0x3, 0x186, 0)) { - Dialog::show(0x4EF5); + _vm->_dialogs->show(0x4EF5); } else if (action->isAction(0x3, 0x1B5, 0)) { - Dialog::show(0x4EF6); + _vm->_dialogs->show(0x4EF6); } else if (action->isAction(0x3, 0x140, 0)) { - Dialog::show(0x4EF7); + _vm->_dialogs->show(0x4EF7); } else if (action->isAction(0x4, 0x140, 0)) { - Dialog::show(0x4EF8); + _vm->_dialogs->show(0x4EF8); } else if (action->isAction(0x3, 0x2D, 0)) { if (action->_actionMode == 4) - Dialog::show(0x4EF9); + _vm->_dialogs->show(0x4EF9); else return; } else { return; } } else { - Dialog::show(0x4EFB); + _vm->_dialogs->show(0x4EFB); } action->_inProgress = false; } @@ -1059,23 +1059,23 @@ void Scene203::preActions() { void Scene203::actions() { if (_action._savedFields._lookFlag) { - Dialog::show(0x4F53); + _vm->_dialogs->show(0x4F53); } else if (_action.isAction(0x18C, 0x83, 0)) { _scene->_nextSceneId = 208; } else if (_action.isAction(0x18C, 0x82, 0)) { _scene->_nextSceneId = 202; } else if (_action.isAction(0x3, 0x142, 0)) { - Dialog::show(0x4F4D); + _vm->_dialogs->show(0x4F4D); } else if (_action.isAction(0x3, 0x4D, 0)) { - Dialog::show(0x4F4E); + _vm->_dialogs->show(0x4F4E); } else if (_action.isAction(0x3, 0x100, 0)) { - Dialog::show(0x4F4F); + _vm->_dialogs->show(0x4F4F); } else if (_action.isAction(0x3, 0x82, 0)) { - Dialog::show(0x4F50); + _vm->_dialogs->show(0x4F50); } else if (_action.isAction(0x3, 0x1A6, 0)) { - Dialog::show(0x4F51); + _vm->_dialogs->show(0x4F51); } else if (_action.isAction(0x3, 0x30, 0)) { - Dialog::show(0x4F51); + _vm->_dialogs->show(0x4F51); } else return; @@ -1299,7 +1299,7 @@ void Scene207::preActions() { void Scene207::actions() { if (_action._savedFields._lookFlag) { - Dialog::show(0x50E7); + _vm->_dialogs->show(0x50E7); } else { if (_action.isAction(0x18B, 0x70, 0)) _scene->_nextSceneId = 214; @@ -1320,33 +1320,33 @@ void Scene207::actions() { } if (_action.isAction(3, 0x69, 0)) { - Dialog::show(0x50DD); + _vm->_dialogs->show(0x50DD); } else if (_action.isAction(3, 0x1AF, 0)) { - Dialog::show(0x50DE); + _vm->_dialogs->show(0x50DE); } else if (_action.isAction(3, 0x141, 0)) { - Dialog::show(0x50DF); + _vm->_dialogs->show(0x50DF); } else if (_action.isAction(3, 0x3E, 0)) { - Dialog::show(0x50E0); + _vm->_dialogs->show(0x50E0); } else if (_action.isAction(3, 0x198, 0)) { - Dialog::show(0x50E1); + _vm->_dialogs->show(0x50E1); } else if (_action.isAction(3, 0x1AE, 0)) { - Dialog::show(0x50E2); + _vm->_dialogs->show(0x50E2); } else if (_action.isAction(3, 0xE8, 0)) { - Dialog::show(0x50E3); + _vm->_dialogs->show(0x50E3); } else if (_action.isAction(3, 0x12, 0)) { - Dialog::show(0x50E4); + _vm->_dialogs->show(0x50E4); } else if (_action.isAction(3, 0x1AC, 0)) { - Dialog::show(0x50E5); + _vm->_dialogs->show(0x50E5); } else if (_action.isAction(3, 0x185, 0)) { - Dialog::show(0x50E6); + _vm->_dialogs->show(0x50E6); } else if (_action.isAction(4, 0x141, 0)) { - Dialog::show(0x50E8); + _vm->_dialogs->show(0x50E8); } else if (_action.isAction(4, 0x12, 0)) { - Dialog::show(0x50E9); + _vm->_dialogs->show(0x50E9); } else if (_action.isAction(3, 0x14D, 0)) { - Dialog::show(0x50EA); + _vm->_dialogs->show(0x50EA); } else if (_action.isAction(4, 0x14D, 0)) { - Dialog::show(0x50EB); + _vm->_dialogs->show(0x50EB); } else return; } @@ -1484,52 +1484,52 @@ void Scene208::actions() { } else if (_action.isAction(0x7, 0x35, 0x1A9)) { warning("TODO: sub3B282(4);"); if (_game._player._stepEnabled) { - Dialog::show(0x514C); + _vm->_dialogs->show(0x514C); } } else if (_action.isAction(0x7, 0x65, 0x1A9)) { warning("TODO: sub3B282(5);"); if (_game._player._stepEnabled) { - Dialog::show(0x514C); + _vm->_dialogs->show(0x514C); } } else if (_action.isAction(0x3, 0x5D, 0)) { - Dialog::show(0x5141); + _vm->_dialogs->show(0x5141); } else if (_action.isAction(0x3, 0xF6, 0)) { - Dialog::show(0x5142); + _vm->_dialogs->show(0x5142); } else if (_action.isAction(0x3, 0x16F, 0)) { - Dialog::show(0x5143); + _vm->_dialogs->show(0x5143); } else if (_action.isAction(0x3, 0x129, 0)) { - Dialog::show(0x5144); + _vm->_dialogs->show(0x5144); } else if (_action.isAction(0x3, 0x1A1, 0)) { - Dialog::show(0x5145); + _vm->_dialogs->show(0x5145); } else if (_action.isAction(0x4, 0x1A1, 0)) { - Dialog::show(0x5146); + _vm->_dialogs->show(0x5146); } else if (_action.isAction(0x3, 0x9B, 0)) { - Dialog::show(0x5147); + _vm->_dialogs->show(0x5147); } else if (_action.isAction(0x3, 0x19E, 0)) { - Dialog::show(0x5148); + _vm->_dialogs->show(0x5148); } else if (_action.isAction(0x3, 0x1AA, 0)) { - Dialog::show(0x5149); + _vm->_dialogs->show(0x5149); } else if (_action.isAction(0x3, 0x1A9, 0)) { if (_game._difficulty == DIFFICULTY_IMPOSSIBLE) - Dialog::show(0x514A); + _vm->_dialogs->show(0x514A); else - Dialog::show(0x514B); + _vm->_dialogs->show(0x514B); } else if (_action.isAction(0x3, 0x174, 0) || _action.isAction(0x3, 0x175, 0)) { - Dialog::show(0x514D); + _vm->_dialogs->show(0x514D); } else if (_action.isAction(0x4, 0x1A9, 0)) { - Dialog::show(0x514E); + _vm->_dialogs->show(0x514E); } else if (_action.isAction(0x3, 0x1A8, 0)) { - Dialog::show(0x514F); + _vm->_dialogs->show(0x514F); } else if (_action.isAction(0x4, 0x1A8, 0) || _action.isAction(0xA, 0x1A8, 0)) { - Dialog::show(0x5150); + _vm->_dialogs->show(0x5150); } else if (_action._savedFields._lookFlag == 0) { return; } else if (_globals[kRhotundaStatus] == 1) { - Dialog::show(0x5153); + _vm->_dialogs->show(0x5153); } else if (_globals[kLeavesStatus] == 2) { - Dialog::show(0x5152); + _vm->_dialogs->show(0x5152); } else { - Dialog::show(0x5151); + _vm->_dialogs->show(0x5151); } _action._inProgress = false; diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index fa928916d6..64c4916240 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -268,9 +268,9 @@ void Scene804::step() { } if (_game._abortTimers == 120) - Dialog::show(0x13a26); + _vm->_dialogs->show(0x13a26); if (_game._abortTimers == 110) - Dialog::show(0x13a2a); + _vm->_dialogs->show(0x13a2a); if (_globals._v6) { _globals._v5 = 32; diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index 115a63045f..7e1cebaf32 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -45,6 +45,8 @@ Player::Player(MADSEngine *vm): _vm(vm) { _visible = false; _priorVisible = false; _visible3 = false; + _loadsFirst = false; + _walkAnywhere = false; _special = 0; _ticksAmount = 0; _priorTimer = 0; @@ -78,8 +80,8 @@ void Player::reset() { _newSceneId = _v844BE = 0; _next = 0; _routeCount = 0; + _walkAnywhere = false; - _vm->_game->_v4 = 0; _action->_startWalkFlag = false; _action->_walkFlag = false; } @@ -311,7 +313,7 @@ void Player::update() { playerY < 0 || (playerY + yScale) >= MADS_SCENE_HEIGHT) { scene._nextSceneId = _newSceneId; _newSceneId = 0; - _vm->_game->_v4 = 0; + _walkAnywhere = false; } } diff --git a/engines/mads/player.h b/engines/mads/player.h index 754ac7edc8..afd55b2686 100644 --- a/engines/mads/player.h +++ b/engines/mads/player.h @@ -118,7 +118,9 @@ public: bool _visible; bool _priorVisible; bool _visible3; + bool _walkAnywhere; int _frameNum; + bool _loadsFirst; Common::Point _playerPos; Common::Point _destPos; Common::Point _posChange; diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 2a99b61a63..8a7bac117f 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -269,7 +269,7 @@ void UserInterface::setup(int id) { _v1E = -1; _v1C = -1; - if (_vm->_game->_v1 == 5) + if (_vm->_game->_kernelMode == KERNEL_ACTIVE_CODE) scene._userInterface._uiSlots.draw(false, false); scene._action.clear(); -- cgit v1.2.3 From 6c85572d76245f616ae3bf2ac1ccc713d8271fa9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 27 Mar 2014 22:38:28 -0400 Subject: MADS: Initial cleanup of action/player handling --- engines/mads/action.cpp | 56 ++++++++++----------- engines/mads/action.h | 10 +++- engines/mads/animation.cpp | 6 +-- engines/mads/animation.h | 2 +- engines/mads/game.cpp | 25 +++++----- engines/mads/game.h | 5 +- engines/mads/messages.cpp | 10 ++-- engines/mads/messages.h | 2 +- engines/mads/nebular/nebular_scenes1.cpp | 24 ++++----- engines/mads/nebular/nebular_scenes2.cpp | 86 ++++++++++++++++---------------- engines/mads/nebular/nebular_scenes8.cpp | 10 ++-- engines/mads/player.cpp | 17 ++++--- engines/mads/player.h | 19 +++++-- engines/mads/scene.cpp | 46 ++++++++--------- engines/mads/scene_data.cpp | 2 +- engines/mads/screen.cpp | 22 ++++---- engines/mads/screen.h | 2 +- engines/mads/sequence.cpp | 4 +- engines/mads/user_interface.cpp | 28 +++++------ engines/mads/user_interface.h | 4 +- 20 files changed, 199 insertions(+), 181 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index c13f65a96c..e997261938 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -47,7 +47,7 @@ MADSAction::MADSAction(MADSEngine *vm) : _vm(vm) { } void MADSAction::clear() { - _v83338 = 1; + _interAwaiting = AWAITING_COMMAND; _actionMode = ACTIONMODE_NONE; _actionMode2 = ACTIONMODE2_0; _v86F42 = 0; @@ -269,7 +269,7 @@ void MADSAction::startAction() { DynamicHotspots &dynHotspots = scene._dynamicHotspots; Hotspots &hotspots = scene._hotspots; - game._player.moveComplete(); + game._player.cancelCommand(); _inProgress = true; _v8453A = ABORTMODE_0; @@ -354,12 +354,12 @@ void MADSAction::checkActionAtMousePos() { UserInterface &userInterface = scene._userInterface; ScreenObjects &screenObjects = _vm->_game->_screenObjects; - if ((userInterface._category == CAT_ACTION || userInterface._category == CAT_INV_VOCAB) && - _v83338 != 1 && scene._highlightedHotspot >= 0) { + if ((userInterface._category == CAT_COMMAND || userInterface._category == CAT_INV_VOCAB) && + _interAwaiting != 1 && scene._highlightedHotspot >= 0) { if (_v86F4E == userInterface._category || _v86F4C != scene._highlightedHotspot || - (_v83338 != 2 && _v83338 != 3)) + (_interAwaiting != 2 && _interAwaiting != 3)) clear(); - else if (_selectedRow != 0 || userInterface._category != CAT_ACTION) + else if (_selectedRow != 0 || userInterface._category != CAT_COMMAND) scene._lookFlag = false; else scene._lookFlag = true; @@ -367,19 +367,19 @@ void MADSAction::checkActionAtMousePos() { if (screenObjects._v7FECA && _vm->_events->_mouseButtons) { switch (userInterface._category) { - case CAT_ACTION: + case CAT_COMMAND: case CAT_INV_VOCAB: return; case CAT_INV_LIST: case CAT_TALK_ENTRY: - if (_v83338 != 3) { + if (_interAwaiting != 3) { if (userInterface._selectedActionIndex >= 0) { _actionMode = ACTIONMODE_VERB; _selectedRow = userInterface._selectedActionIndex; _flags1 = scene._verbList[_selectedRow]._action1; _flags2 = scene._verbList[_selectedRow]._action2; - _v83338 = 2; + _interAwaiting = AWAITING_THIS; } else if (userInterface._selectedItemVocabIdx >= 0) { _actionMode = ACTIONMODE_OBJECT; _selectedRow = userInterface._selectedItemVocabIdx; @@ -393,20 +393,20 @@ void MADSAction::checkActionAtMousePos() { _articleNumber = _flags2; if ((_flags1 == 1 && _flags2 == 0) || (_flags1 == 2 && _flags2 != 0)) - _v83338 = 4; + _interAwaiting = AWAITING_RIGHT_MOUSE; else - _v83338 = 3; + _interAwaiting = AWAITING_THAT; } } break; } } - switch (_v83338) { + switch (_interAwaiting) { case 1: _articleNumber = 0; switch (userInterface._category) { - case CAT_ACTION: + case CAT_COMMAND: _actionMode = ACTIONMODE_VERB; _selectedRow = scene._highlightedHotspot; if (_selectedRow >= 0) { @@ -491,13 +491,13 @@ void MADSAction::leftClick() { ScreenObjects &screenObjects = _vm->_game->_screenObjects; bool abortFlag = false; - if ((userInterface._category == CAT_ACTION || userInterface._category == CAT_INV_VOCAB) && - _v83338 != 1 && scene._highlightedHotspot >= 0 && + if ((userInterface._category == CAT_COMMAND || userInterface._category == CAT_INV_VOCAB) && + _interAwaiting != 1 && scene._highlightedHotspot >= 0 && _v86F4E == userInterface._category && _v86F4C == scene._highlightedHotspot && - (_v83338 == 2 || userInterface._category == CAT_INV_VOCAB)) { + (_interAwaiting == 2 || userInterface._category == CAT_INV_VOCAB)) { abortFlag = true; - if (_selectedRow == 0 && userInterface._category == CAT_ACTION) { - _selectedAction = CAT_ACTION; + if (_selectedRow == 0 && userInterface._category == CAT_COMMAND) { + _selectedAction = CAT_COMMAND; scene._lookFlag = true; } else { _selectedAction = CAT_NONE; @@ -506,14 +506,14 @@ void MADSAction::leftClick() { } } - if (abortFlag || (screenObjects._v7FECA && (userInterface._category == CAT_ACTION || + if (abortFlag || (screenObjects._v7FECA && (userInterface._category == CAT_COMMAND || userInterface._category == CAT_INV_VOCAB))) return; - switch (_v83338) { - case 1: + switch (_interAwaiting) { + case AWAITING_COMMAND: switch (userInterface._category) { - case CAT_ACTION: + case CAT_COMMAND: if (_selectedRow >= 0) { if (!_flags1) { _selectedAction = -1; @@ -521,7 +521,7 @@ void MADSAction::leftClick() { else { _v86F4C = _selectedRow; _v86F4E = _actionMode; - _v83338 = 2; + _interAwaiting = AWAITING_THIS; } } break; @@ -536,7 +536,7 @@ void MADSAction::leftClick() { if (_selectedRow >= 0) { if (_flags1 != 1 || _flags2 != 0) { if (_flags1 != 2 || _flags2 == 0) { - _v83338 = 3; + _interAwaiting = AWAITING_THAT; _articleNumber = _flags2; } else { @@ -560,7 +560,7 @@ void MADSAction::leftClick() { if (_vm->_events->currentPos().y < MADS_SCENE_HEIGHT) { scene._customDest = _vm->_events->currentPos() + scene._posAdjust; _selectedAction = -1; - _v86F4A = -1; + _v86F4A = true; } break; @@ -574,7 +574,7 @@ void MADSAction::leftClick() { } break; - case 2: + case AWAITING_THIS: switch (userInterface._category) { case CAT_INV_LIST: case CAT_HOTSPOT: @@ -582,7 +582,7 @@ void MADSAction::leftClick() { if (_hotspotId >= 0) { if (_flags2) { _articleNumber = _flags2; - _v83338 = 3; + _interAwaiting = AWAITING_THAT; } else { _selectedAction = -1; @@ -599,7 +599,7 @@ void MADSAction::leftClick() { } break; - case 3: + case AWAITING_THAT: switch (userInterface._category) { case CAT_INV_LIST: case CAT_HOTSPOT: diff --git a/engines/mads/action.h b/engines/mads/action.h index 26ab062673..74de167a4e 100644 --- a/engines/mads/action.h +++ b/engines/mads/action.h @@ -32,6 +32,14 @@ enum ActionMode { ACTIONMODE_NONE = 0, ACTIONMODE_VERB = 1, ACTIONMODE_OBJECT = enum ActionMode2 { ACTIONMODE2_0 = 0, ACTIONMODE2_2 = 2, ACTIONMODE2_4 = 4, ACTIONMODE2_5 = 5 }; enum AbortTimerMode { ABORTMODE_0 = 0, ABORTMODE_1 = 1, ABORTMODE_2 = 2 }; +enum InterAwaiting { + AWAITING_NONE = 0, + AWAITING_COMMAND = 1, // Initial state: waiting for a command verb + AWAITING_THIS = 2, // Waiting for object + AWAITING_THAT = 3, // Waiting for a second object + AWAITING_RIGHT_MOUSE = 4 // Waiting for mouse button release +}; + enum { VERB_NONE = 0, VERB_LOOK = 3, @@ -98,7 +106,7 @@ public: int16 _v86F4E; bool _v86F4A; int16 _v86F4C; - int _v83338; + InterAwaiting _interAwaiting; bool _inProgress; int _v8453A; diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index b0b69b946a..96b9cfb90e 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -316,7 +316,7 @@ void Animation::startAnimation(int abortTimers) { _currentFrame = 0; _oldFrameEntry = 0; _nextFrameTimer = _vm->_game->_scene._frameStartTime; - _abortTimers = abortTimers; + _trigger = abortTimers; _abortTimersMode = _vm->_game->_abortTimersMode2; _vm->_game->_scene._action._activeAction = _actionDetails; @@ -530,8 +530,8 @@ void Animation::update() { _currentFrame++; if (_currentFrame >= (int)_miscEntries.size()) { // Animation is complete - if (_abortTimers != 0) { - _vm->_game->_abortTimers = _abortTimers; + if (_trigger != 0) { + _vm->_game->_trigger = _trigger; _vm->_game->_abortTimersMode = _abortTimersMode; if (_abortTimersMode != ABORTMODE_1) { diff --git a/engines/mads/animation.h b/engines/mads/animation.h index 1207ff6100..7c3d864184 100644 --- a/engines/mads/animation.h +++ b/engines/mads/animation.h @@ -128,7 +128,7 @@ private: uint32 _nextFrameTimer; uint32 _nextScrollTimer; int _messageCtr; - int _abortTimers; + int _trigger; AbortTimerMode _abortTimersMode; ActionDetails _actionDetails; diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index b89f83384b..900d4dc86a 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -54,7 +54,6 @@ Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm), _quoteEmergency = false; _vocabEmergency = false; _aaName = "*I0.AA"; - _playerSpritesFlag = false; _priorFrameTimer = 0; _updateSceneFlag = false; _abortTimersMode = ABORTMODE_0; @@ -191,7 +190,7 @@ void Game::sectionLoop() { if (!_player._spritesLoaded && _player._loadsFirst) { if (_player.loadSprites("")) _vm->quitGame(); - _playerSpritesFlag = true; + _player._loadedFirst = true; } _scene.loadScene(_scene._nextSceneId, _aaName, 0); @@ -200,33 +199,33 @@ void Game::sectionLoop() { if (!_player._spritesLoaded) { if (_player.loadSprites("")) _vm->quitGame(); - _playerSpritesFlag = false; + _player._loadedFirst = false; } _vm->_events->initVars(); + _scene._userInterface._highlightedCommandIndex = -1; + _scene._userInterface._highlightedItemIndex = -1; _scene._userInterface._highlightedActionIndex = -1; - _scene._userInterface._v1C = -1; - _scene._userInterface._v1E = -1; _scene._action.clear(); - _player.turnToDestFacing(); + _player.setFinalFacing(); _player._facing = _player._turnToFacing; - _player.moveComplete(); + _player.cancelCommand(); + _kernelMode = KERNEL_ROOM_INIT; switch (_vm->_screenFade) { case SCREEN_FADE_SMOOTH: - _abortTimers2 = kTransitionFadeOutIn; + _fx = kTransitionFadeOutIn; break; case SCREEN_FADE_FAST: - _abortTimers2 = kCenterVertTransition; + _fx = kCenterVertTransition; break; default: - _abortTimers2 = kTransitionNone; + _fx = kTransitionNone; break; } - _abortTimers = 0; - _abortTimersMode2 = ABORTMODE_1; + _trigger = 0; _priorFrameTimer = _scene._frameStartTime; // Call the scene logic for entering the given scene @@ -271,7 +270,7 @@ void Game::sectionLoop() { warning("TODO: sub_1DD8C, sub_1DD7E"); - if (!_playerSpritesFlag) { + if (!_player._loadedFirst) { _player._spritesLoaded = false; _player._spritesChanged = true; } diff --git a/engines/mads/game.h b/engines/mads/game.h index 11fd95491e..f3e2a67e23 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -78,7 +78,6 @@ protected: bool _quoteEmergency; bool _vocabEmergency; bool _updateSceneFlag; - bool _playerSpritesFlag; /** * Constructor @@ -133,8 +132,8 @@ public: Scene _scene; KernelMode _kernelMode; int _v2; - int _abortTimers; - int _abortTimers2; + int _trigger; + ScreenTransition _fx; AbortTimerMode _abortTimersMode; AbortTimerMode _abortTimersMode2; uint32 _priorFrameTimer; diff --git a/engines/mads/messages.cpp b/engines/mads/messages.cpp index be84739fc0..617bd6d2a0 100644 --- a/engines/mads/messages.cpp +++ b/engines/mads/messages.cpp @@ -74,7 +74,7 @@ int KernelMessages::add(const Common::Point &pt, uint fontColor, uint8 flags, rec._textDisplayIndex = -1; rec._timeout = timeout; rec._frameTimer = _vm->_game->_priorFrameTimer; - rec._abortTimers = abortTimers; + rec._trigger = abortTimers; rec._abortMode = _vm->_game->_abortTimersMode2; rec._actionDetails = scene._action._activeAction; @@ -143,7 +143,7 @@ void KernelMessages::reset() { void KernelMessages::update() { uint32 currentTimer = _vm->_game->_scene._frameStartTime; - for (uint i = 0; i < _entries.size() && !_vm->_game->_abortTimers; ++i) { + for (uint i = 0; i < _entries.size() && !_vm->_game->_trigger; ++i) { KernelMessage &msg = _entries[i]; if (((msg._flags & KMSG_ACTIVE) != 0) && (currentTimer >= msg._frameTimer)) @@ -173,10 +173,10 @@ void KernelMessages::processText(int msgIndex) { msg._timeout = 0; } - if ((msg._timeout <= 0) && (_vm->_game->_abortTimers == 0)) { + if ((msg._timeout <= 0) && (_vm->_game->_trigger == 0)) { msg._flags |= KMSG_EXPIRE; - if (msg._abortTimers != 0) { - _vm->_game->_abortTimers = msg._abortTimers; + if (msg._trigger != 0) { + _vm->_game->_trigger = msg._trigger; _vm->_game->_abortTimersMode = msg._abortMode; if (_vm->_game->_abortTimersMode != ABORTMODE_1) { diff --git a/engines/mads/messages.h b/engines/mads/messages.h index 03a4e01234..1254b1dafc 100644 --- a/engines/mads/messages.h +++ b/engines/mads/messages.h @@ -56,7 +56,7 @@ public: uint32 _frameTimer2; uint32 _frameTimer; uint32 _timeout; - int _abortTimers; + int _trigger; AbortTimerMode _abortMode; ActionDetails _actionDetails; Common::String _msg; diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 554c73ddc6..e5c0abd4bd 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -215,7 +215,7 @@ void Scene103::step() { Common::Point pt; int dist; - switch (_vm->_game->_abortTimers) { + switch (_vm->_game->_trigger) { case 70: _vm->_game->_player._stepEnabled = true; break; @@ -260,7 +260,7 @@ void Scene103::actions() { if (_action._savedFields._lookFlag) { _vm->_dialogs->show(10322); } else if (_action.isAction(395, 110, 0)) { - switch (_vm->_game->_abortTimers) { + switch (_vm->_game->_trigger) { case 0: _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle( _globals._spriteIndexes[6], false, 6, 1); @@ -280,7 +280,7 @@ void Scene103::actions() { } } else if (_action.isAction(VERB_TAKE, 371, 0) && _game._objects.isInRoom(OBJ_TIMER_MODULE)) { - switch (_vm->_game->_abortTimers) { + switch (_vm->_game->_trigger) { case 0: _scene->changeDepthSurface(1); _globals._spriteIndexes[28] = _scene->_sequences.startReverseCycle( @@ -312,7 +312,7 @@ void Scene103::actions() { break; } } else if (_action.isAction(VERB_TAKE, 289, 0) && _game._objects.isInRoom(OBJ_REBREATHER)) { - switch (_vm->_game->_abortTimers) { + switch (_vm->_game->_trigger) { case 0: _scene->changeDepthSurface(1); _globals._spriteIndexes[27] = _scene->_sequences.startReverseCycle( @@ -344,26 +344,26 @@ void Scene103::actions() { } else if (_action.isAction(VERB_LOOK, 362, 0)) { _vm->_dialogs->show(10301); } else if (_action.isAction(VERB_TAKE, 362, 0)) { - if (!_vm->_game->_abortTimers) + if (!_vm->_game->_trigger) _vm->_sound->command(31); - if (_vm->_game->_abortTimers2 < 2) { + if (_vm->_game->_fx < 2) { _globals._spriteIndexes[24] = _scene->_sequences.addSpriteCycle( _globals._spriteIndexes[9], false, 6, - _vm->_game->_abortTimers < 1 ? 1 : 0); - if (_vm->_game->_abortTimers) { + _vm->_game->_trigger < 1 ? 1 : 0); + if (_vm->_game->_trigger) { _scene->_sequences.setAnimRange(_globals._spriteIndexes[24], -1, 0); Common::String msg = _game.getQuote(51); _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 18, 0, 60, msg); - _scene->_sequences.addTimer(120, _vm->_game->_abortTimers); + _scene->_sequences.addTimer(120, _vm->_game->_trigger); } else { _scene->_sequences.addSubEntry(_globals._spriteIndexes[24], SM_0, 0, 1); } - _game._player._stepEnabled = _game._abortTimers == 2; + _game._player._stepEnabled = _game._trigger == 2; _globals[kTurkeyExploded] = -1; - if (_game._abortTimers == 2) { + if (_game._trigger == 2) { _vm->_dialogs->show(1030); _scene->_hotspots.activate(362, false); } @@ -372,7 +372,7 @@ void Scene103::actions() { _vm->_dialogs->show(!_globals[kTurkeyExploded] ? 10323 : 10303); } else if (_action.isAction(VERB_TALKTO, 27, 0)) { - switch (_vm->_game->_abortTimers) { + switch (_vm->_game->_trigger) { case 0: { _game._player._stepEnabled = false; Common::String msg = _game.getQuote(71); diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 83dcfa3865..38f87ba412 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -218,7 +218,7 @@ void Scene201::step() { _pterodactylFlag = false; } - if (_game._abortTimers == 70) { + if (_game._trigger == 70) { _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 9, 1, 0, 0); _game._player._visible = false; _scene->_sequences.setAnimRange(_globals._spriteIndexes[21], 12, 16); @@ -231,24 +231,24 @@ void Scene201::step() { _scene->_sequences.addSubEntry(_globals._spriteIndexes[21], SM_0, 0, 73); } - if (_game._abortTimers == 81) { + if (_game._trigger == 81) { _scene->_kernelMessages.reset(); } - if (_game._abortTimers == 71) { + if (_game._trigger == 71) { _globals._spriteIndexes[22] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 9, 0, 0, 0); _scene->_sequences.setAnimRange(_globals._spriteIndexes[22], -2, -2); _scene->_sequences.setDepth(_globals._spriteIndexes[22], 1); } - if (_game._abortTimers == 73) { + if (_game._trigger == 73) { _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 9, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._spriteIndexes[21], 17, -2); _scene->_sequences.addSubEntry(_globals._spriteIndexes[21], SM_0, 0, 74); _scene->_sequences.setDepth(_globals._spriteIndexes[21], 1); } - if (_game._abortTimers == 74) { + if (_game._trigger == 74) { _vm->_sound->command(40); _scene->_kernelMessages.add(Common::Point(125, 56), 0xFDFC, 32, 82, 180, _game.getQuote(91)); @@ -258,24 +258,24 @@ void Scene201::step() { _scene->_sequences.addTimer(180, 75); } - if (_game._abortTimers == 75) { + if (_game._trigger == 75) { _globals[kMeteorologistEverSeen] = 0; _scene->_nextSceneId = 202; } - if (_game._abortTimers == 76) { + if (_game._trigger == 76) { _game._player._stepEnabled = true; _game._player._visible = true; _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; } - if (_game._abortTimers == 77) { + if (_game._trigger == 77) { _globals[kTeleporterCommand] = 1; _scene->_nextSceneId = _globals[kTeleporterDestination]; _scene->_reloadSceneFlag = true; } - if (_game._abortTimers == 78) { + if (_game._trigger == 78) { _vm->_sound->command(40); _vm->_dialogs->show(0x4E92); _scene->_reloadSceneFlag = true; @@ -288,12 +288,12 @@ void Scene201::actions() { if (action->isAction(0x18C, 0x83, 0)) _scene->_nextSceneId = 202; else if ((action->isAction(0x50, 0x156, 0)) || (action->isAction(0x188, 0x16C, 0)) || (action->isAction(0x188, 0x1B6, 0))) { - if (_game._abortTimers == 0) { + if (_game._trigger == 0) { _game._player._stepEnabled = false; _game._player._visible = false; int sepChar = (_globals[kSexOfRex] == SEX_UNKNOWN) ? 't' : 'u'; _scene->loadAnimation(formAnimName(sepChar, 0), 1); - } else if (_game._abortTimers == 1) { + } else if (_game._trigger == 1) { _scene->_nextSceneId = 213; } } else if (action->isAction(0x3, 0x1A6, 0)) { @@ -474,10 +474,10 @@ void Scene202::step() { setRandomKernelMessage(); } - if (_game._abortTimers == 70) + if (_game._trigger == 70) _activeMsgFl = false; - if (_game._abortTimers == 71) { + if (_game._trigger == 71) { _vm->_sound->command(3); _vm->_sound->command(9); _globals._v8425C = 900 + _scene->_frameStartTime; @@ -507,7 +507,7 @@ void Scene202::step() { _globals[kMeteorologistWatch] = 0; } - switch (_game._abortTimers) { + switch (_game._trigger) { case 90: _vm->_sound->command(41); _scene->_sequences.remove(_globals._spriteIndexes[25]); @@ -717,7 +717,7 @@ void Scene202::preActions() { _scene->_kernelMessages.reset(); if (!_ladderTopFl && (action->isAction(0x4E, 0xC7, 0) || !action->_walkFlag)) { - if (_game._abortTimers == 0) { + if (_game._trigger == 0) { _vm->_sound->command(29); action->_walkFlag = false; _game._player._stepEnabled = false; @@ -725,7 +725,7 @@ void Scene202::preActions() { _globals._spriteIndexes[23] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[8], false, 6, 1, 0, 0); _scene->_sequences.setDepth(_globals._spriteIndexes[23], 1); _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 1); - } else if (_game._abortTimers == 1) { + } else if (_game._trigger == 1) { _scene->_sequences.updateTimeout(-1, _globals._spriteIndexes[23]); warning("CHECKME: _scene->_dynamicHotspots.remove(_globals._frameTime);"); _scene->_dynamicHotspots.remove(_globals._frameTime); @@ -765,7 +765,7 @@ void Scene202::actions() { _scene->_nextSceneId = 201; } else if (action->isAction(0x4, 0x2C, 0)) { if (action->_actionMode2 == 4) { - if (_game._abortTimers == 0) { + if (_game._trigger == 0) { if (_game._objects.isInInventory(OBJ_BONES)) { _vm->_dialogs->show(0x4EFB); } else { @@ -776,7 +776,7 @@ void Scene202::actions() { _scene->_sequences.addSubEntry(_globals._spriteIndexes[22], SM_FRAME_INDEX, 6, 1); _scene->_sequences.addSubEntry(_globals._spriteIndexes[22], SM_0, 0, 2); } - } else if (_game._abortTimers == 1) { + } else if (_game._trigger == 1) { if ((_game._player._playerPos.x == 132) && (_game._player._playerPos.y == 97)) { _scene->_sequences.remove(_globals._spriteIndexes[16]); _globals[kBone202Status] |= 1; @@ -784,7 +784,7 @@ void Scene202::actions() { _scene->_sequences.remove(_globals._spriteIndexes[21]); _globals[kBone202Status] |= 2; } - } else if (_game._abortTimers == 2) { + } else if (_game._trigger == 2) { if (_game._objects.isInInventory(OBJ_BONE)) { _game._objects.removeFromInventory(OBJ_BONE, 1); _game._objects.addToInventory(OBJ_BONES); @@ -802,7 +802,7 @@ void Scene202::actions() { } } } else if ((action->isAction(0x50, 0xC7, 0)) && (_globals[kLadderBroken] == 0)) { - if (_game._abortTimers == 0) { + if (_game._trigger == 0) { _vm->_sound->command(29); _globals._v8425C = _scene->_frameStartTime; _game._player._visible = false; @@ -814,7 +814,7 @@ void Scene202::actions() { _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 6, 1, 0, 0); _scene->_sequences.setDepth(_globals._spriteIndexes[23], 1); _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 1); - } else if (_game._abortTimers == 1) { + } else if (_game._trigger == 1) { _globals._spriteIndexes[24] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, 1); _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(247, 82)); _scene->_sequences.setDepth(_globals._spriteIndexes[24], 1); @@ -829,7 +829,7 @@ void Scene202::actions() { } } else if (((action->isAction(0x3, 0x27, 0x82)) || (action->isAction(0x3, 0x27, 0x1B6))) && (_globals[kSexOfRex] == SEX_MALE)) { if (!_ladderTopFl) { - if (_game._abortTimers == 0) { + if (_game._trigger == 0) { _game._player._stepEnabled = false; _game._player._visible= false; _globals._spriteIndexes[25] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 6, 1, 0, 0); @@ -838,7 +838,7 @@ void Scene202::actions() { _scene->_sequences.setDepth(_globals._spriteIndexes[25], 1); _scene->_sequences.updateTimeout(-1, _globals._spriteIndexes[25]); _scene->_sequences.addSubEntry(_globals._spriteIndexes[25], SM_0, 0, 1); - } else if (_game._abortTimers == 1) { + } else if (_game._trigger == 1) { _globals._spriteIndexes[25] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 6); _scene->_sequences.setDepth(_globals._spriteIndexes[25], 1); _scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(172, 123)); @@ -848,7 +848,7 @@ void Scene202::actions() { } else { _scene->_sequences.addTimer(120, 2); } - } else if (_game._abortTimers == 2) { + } else if (_game._trigger == 2) { if (!_scene->_activeAnimation && (_globals._abortVal == 0)) { _vm->_dialogs->show(0x4EFE); } @@ -858,7 +858,7 @@ void Scene202::actions() { _scene->_sequences.setAnimRange(_globals._spriteIndexes[25], 1, 6); _scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(172, 123)); _scene->_sequences.addSubEntry(_globals._spriteIndexes[25], SM_0, 0, 3); - } else if (_game._abortTimers == 3) { + } else if (_game._trigger == 3) { _scene->_sequences.updateTimeout(-1, _globals._spriteIndexes[25]); _game._player._stepEnabled = true; _game._player._visible = true; @@ -867,7 +867,7 @@ void Scene202::actions() { return; } } else { - if (_game._abortTimers == 0) { + if (_game._trigger == 0) { _globals._v84268 = 1; _game._player._stepEnabled = false; _scene->_sequences.remove(_globals._spriteIndexes[24]); @@ -875,7 +875,7 @@ void Scene202::actions() { _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(247, 82)); _scene->_sequences.setDepth(_globals._spriteIndexes[24], 1); _scene->_sequences.addSubEntry(_globals._spriteIndexes[24], SM_0, 0, 1); - } else if (_game._abortTimers == 1) { + } else if (_game._trigger == 1) { _globals._spriteIndexes[25] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, -2); _scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(247, 82)); _scene->_sequences.setDepth(_globals._spriteIndexes[25], 1); @@ -897,7 +897,7 @@ void Scene202::actions() { } else { _scene->_sequences.addTimer(120, 2); } - } else if (_game._abortTimers == 2) { + } else if (_game._trigger == 2) { if (!_scene->_activeAnimation) _vm->_dialogs->show(0x4EFE); _globals._abortVal = 0; @@ -906,7 +906,7 @@ void Scene202::actions() { _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(247, 82)); _scene->_sequences.setDepth(_globals._spriteIndexes[24], 1); _scene->_sequences.addSubEntry(_globals._spriteIndexes[24], SM_0, 0, 3); - } else if (_game._abortTimers == 3) { + } else if (_game._trigger == 3) { _globals._spriteIndexes[24] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, 1); _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(247, 82)); _scene->_sequences.setDepth(_globals._spriteIndexes[24], 1); @@ -1024,7 +1024,7 @@ void Scene203::step() { if (_globals._v0 == 0) return; - if ((_game._abortTimers == 0) && (_globals._frameTime != 0)) + if ((_game._trigger == 0) && (_globals._frameTime != 0)) return; if ((_game._player._playerPos != Common::Point(158, 136)) || (_game._player._facing != 2)) @@ -1032,7 +1032,7 @@ void Scene203::step() { _globals._frameTime = 0xFFFF; - if (_game._abortTimers == 0) { + if (_game._trigger == 0) { _game._player._visible = false; _game._player._stepEnabled = false; _vm->_palette->sub7BBF8(); @@ -1040,7 +1040,7 @@ void Scene203::step() { _scene->resetScene(); _vm->_events->setCursor2(CURSOR_WAIT); _scene->loadAnimation(Resources::formatName(203, 'a', -1, EXT_AA, ""), 81); - } else if (_game._abortTimers == 81) { + } else if (_game._trigger == 81) { _scene->_nextSceneId = 208; _scene->_reloadSceneFlag = true; } @@ -1257,13 +1257,13 @@ void Scene207::step() { warning("TODO: sub3ADD6(...)"); } - if (_game._abortTimers == 70) { + if (_game._trigger == 70) { _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 10, 0, 0, 0); _scene->_sequences.setAnimRange(_globals._spriteIndexes[21], 23, 34); _scene->_sequences.setDepth(_globals._spriteIndexes[21], 6); } - if (_game._abortTimers == 71) + if (_game._trigger == 71) _globals._v2 = 0; if (_globals._v2) @@ -1419,21 +1419,21 @@ void Scene208::step() { if ((_game._player._playerPos != Common::Point(20, 148)) || (_game._player._facing != 6)) return; - if ((_game._abortTimers == 0) && ((_globals._frameTime & 0xFFFF) != 0)) + if ((_game._trigger == 0) && ((_globals._frameTime & 0xFFFF) != 0)) return; _globals._frameTime |= 0xFFFF; - if (_game._abortTimers == 82) { + if (_game._trigger == 82) { _game._player._stepEnabled = true; return; } - if (_game._abortTimers > 82) + if (_game._trigger > 82) return; - if (_game._abortTimers & 0xFF) { - if ((_game._abortTimers & 0xFF) == 81) { + if (_game._trigger & 0xFF) { + if ((_game._trigger & 0xFF) == 81) { _scene->_sequences.remove(_globals._spriteIndexes[15]); _globals[kRhotundaStatus] = 1; warning("TODO: sub34648(...)"); @@ -1459,20 +1459,20 @@ void Scene208::actions() { if (_action.isAction(0x18C, 0x19F, 0)) { if (_globals[kRhotundaStatus]) _scene->_nextSceneId = 203; - else if (_game._abortTimers == 0) { + else if (_game._trigger == 0) { _game._player._stepEnabled = false; int msgIndex = _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 1, 120, _game.getQuote(70)); _scene->_kernelMessages.setQuoted(msgIndex, 4, true); - } else if (_game._abortTimers == 1) { + } else if (_game._trigger == 1) { _scene->_nextSceneId = 203; } } else if (_action.isAction(0x18C, 0x83, 0)) { _scene->_nextSceneId = 212; - } else if (_action.isAction(0x4, 0x1AA, 0) && (!_globals[kLeavesStatus] || _game._abortTimers)) { + } else if (_action.isAction(0x4, 0x1AA, 0) && (!_globals[kLeavesStatus] || _game._trigger)) { warning("TODO: sub3B282(1);"); if (_game._player._stepEnabled) _vm->_dialogs->showPicture(OBJ_BIG_LEAVES, 0x326, 0); - } else if (_action.isAction(0x7, 0x23, 0x19E) && (_globals[kLeavesStatus] == 1 || _game._abortTimers)) { + } else if (_action.isAction(0x7, 0x23, 0x19E) && (_globals[kLeavesStatus] == 1 || _game._trigger)) { warning("TODO: sub3B282(2);"); } else if (_action.isAction(0x7, 0x17A, 0x1A9)) { warning("TODO: sub3B282(3);"); diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index 64c4916240..cb761ca138 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -181,7 +181,7 @@ void Scene804::step() { _globals._v2 = 0; } - if (_game._abortTimers == 70) + if (_game._trigger == 70) _globals._v5 = 42; if (_scene->_activeAnimation->getCurrentFrame() == 65) _scene->_sequences.remove(_globals._spriteIndexes[22]); @@ -222,7 +222,7 @@ void Scene804::step() { _scene->_sequences.addTimer(60, 80); } - if (_game._abortTimers == 80) + if (_game._trigger == 80) _scene->_nextSceneId = 803; if (_scene->_activeAnimation->getCurrentFrame() == 7 && !_globals[kWindowFixed]) { @@ -267,9 +267,9 @@ void Scene804::step() { } } - if (_game._abortTimers == 120) + if (_game._trigger == 120) _vm->_dialogs->show(0x13a26); - if (_game._abortTimers == 110) + if (_game._trigger == 110) _vm->_dialogs->show(0x13a2a); if (_globals._v6) { @@ -281,7 +281,7 @@ void Scene804::step() { _globals._v5 = -1; } - if (_game._abortTimers == 90) + if (_game._trigger == 90) _scene->_nextSceneId = 803; if (_scene->_activeAnimation->getCurrentFrame() == 7 &&!_globals._v8) { diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index 7e1cebaf32..eaec85c8fc 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -46,6 +46,7 @@ Player::Player(MADSEngine *vm): _vm(vm) { _priorVisible = false; _visible3 = false; _loadsFirst = false; + _loadedFirst = false; _walkAnywhere = false; _special = 0; _ticksAmount = 0; @@ -71,7 +72,7 @@ Player::Player(MADSEngine *vm): _vm(vm) { Common::fill(&_spriteSetsPresent[0], &_spriteSetsPresent[PLAYER_SPRITES_FILE_COUNT], false); } -void Player::reset() { +void Player::cancelWalk() { _action = &_vm->_game->_scene._action; _destPos = _playerPos; _targetFacing = FACING_NONE; @@ -133,8 +134,8 @@ bool Player::loadSprites(const Common::String &prefix) { } } -void Player::turnToDestFacing() { - if (_targetFacing != 5) +void Player::setFinalFacing() { + if (_targetFacing != FACING_NONE) _turnToFacing = _targetFacing; } @@ -176,8 +177,8 @@ void Player::dirChanged() { _priorTimer += 1; } -void Player::moveComplete() { - reset(); +void Player::cancelCommand() { + cancelWalk(); _action->_inProgress = false; } @@ -365,7 +366,7 @@ void Player::setDest(const Common::Point &pt, Facing facing) { void Player::startWalking(const Common::Point &pos, Facing direction) { Scene &scene = _vm->_game->_scene; - reset(); + cancelWalk(); scene._action._startWalkFlag = true; scene._action._walkFlag = true; scene._destPos = pos; @@ -406,7 +407,7 @@ void Player::move() { // End of walking path _routeCount = 0; _moving = false; - turnToDestFacing(); + setFinalFacing(); routeFlag = true; idx = _routeCount; } @@ -475,7 +476,7 @@ void Player::move() { _v8452E -= var1; if (routeFlag) - moveComplete(); + cancelCommand(); else { if (!_newSceneId) { // If the move is complete, make sure the position is exactly on the given destination diff --git a/engines/mads/player.h b/engines/mads/player.h index afd55b2686..004c412901 100644 --- a/engines/mads/player.h +++ b/engines/mads/player.h @@ -64,8 +64,6 @@ private: int _actionList2[12]; int _hypotenuse; - void reset(); - void resetActionList(); void move(); @@ -121,6 +119,7 @@ public: bool _walkAnywhere; int _frameNum; bool _loadsFirst; + bool _loadedFirst; Common::Point _playerPos; Common::Point _destPos; Common::Point _posChange; @@ -152,9 +151,21 @@ public: */ bool loadSprites(const Common::String &prefix); - void turnToDestFacing(); + /** + * Called when the player has reached the given destination, start him + * turning to the specified facing + */ + void setFinalFacing(); + + /** + * Stops the player walking + */ + void cancelWalk(); - void moveComplete(); + /** + * Cancels any oustanding player action + */ + void cancelCommand(); void setupFrame(); diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index f16b2c3889..aa57a7e6b3 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -275,7 +275,7 @@ void Scene::loop() { // TODO: Verify correctness of frame wait _vm->_events->waitForNextFrame(); - if (_vm->_dialogs->_pendingDialog != DIALOG_NONE && !_vm->_game->_abortTimers + if (_vm->_dialogs->_pendingDialog != DIALOG_NONE && !_vm->_game->_trigger && _vm->_game->_player._stepEnabled) _reloadSceneFlag = true; } @@ -290,18 +290,18 @@ void Scene::doFrame() { _action._selectedAction = 0; } - if (!_vm->_game->_abortTimers && !player._unk3) { + if (!_vm->_game->_trigger && !player._unk3) { // Refresh the dynamic hotspots if they've changed if (_dynamicHotspots._changed) _dynamicHotspots.refresh(); // Check all on-screen visual objects _vm->_game->_screenObjects.check(player._stepEnabled && !_action._startWalkFlag && - !_vm->_game->_abortTimers2); + !_vm->_game->_fx); } if (_action._selectedAction && player._stepEnabled && !_action._startWalkFlag && - !_vm->_game->_abortTimers && !player._unk3) { + !_vm->_game->_trigger && !player._unk3) { _action.startAction(); if (_action._activeAction._verbId == Nebular::NOUN_LOOK_AT) { _action._activeAction._verbId = VERB_LOOK; @@ -311,17 +311,17 @@ void Scene::doFrame() { flag = true; } - if (flag || (_vm->_game->_abortTimers && _vm->_game->_abortTimersMode == ABORTMODE_2)) { + if (flag || (_vm->_game->_trigger && _vm->_game->_abortTimersMode == ABORTMODE_2)) { doPreactions(); } checkStartWalk(); - if (!_vm->_game->_abortTimers2) + if (!_vm->_game->_fx) _frameStartTime = _vm->_events->getFrameCounter(); if ((_action._inProgress && !player._moving && !_action._startWalkFlag && player._turnToFacing == player._facing) || - (_vm->_game->_abortTimers && _vm->_game->_abortTimersMode == ABORTMODE_0)) { + (_vm->_game->_trigger && _vm->_game->_abortTimersMode == ABORTMODE_0)) { doAction(); } @@ -339,7 +339,7 @@ void Scene::doFrame() { // Cursor update code updateCursor(); - if (!_vm->_game->_abortTimers) { + if (!_vm->_game->_trigger) { // Handle any active sequences _sequences.tick(); @@ -357,24 +357,24 @@ void Scene::doFrame() { 0x203, 0, 0, 1, msg); } - if (!_vm->_game->_abortTimers) { + if (!_vm->_game->_trigger) { if (_reloadSceneFlag || _currentSceneId != _nextSceneId) _kernelMessages.reset(); _kernelMessages.update(); } - _userInterface._uiSlots.draw(_vm->_game->_abortTimers2 == 0, - _vm->_game->_abortTimers2 != 0); + _userInterface._uiSlots.draw(_vm->_game->_fx == 0, + _vm->_game->_fx != 0); // Write any text needed by the interface - if (_vm->_game->_abortTimers2) + if (_vm->_game->_fx) _userInterface.drawTextElements(); // Draw any elements - drawElements((ScreenTransition)_vm->_game->_abortTimers2, _vm->_game->_abortTimers2); + drawElements((ScreenTransition)_vm->_game->_fx, _vm->_game->_fx); // Handle message updates - if (_vm->_game->_abortTimers2) { + if (_vm->_game->_fx) { uint32 priorTime = _vm->_game->_priorFrameTimer; uint32 newTime = _vm->_events->getFrameCounter(); _sequences.delay(newTime, priorTime); @@ -390,9 +390,9 @@ void Scene::doFrame() { } } - if (_vm->_game->_abortTimers2) + if (_vm->_game->_fx) _animFlag = true; - _vm->_game->_abortTimers2 = 0; + _vm->_game->_fx = kTransitionNone; if (_freeAnimationFlag) { _activeAnimation->free(); @@ -450,7 +450,7 @@ void Scene::doPreactions() { _sceneLogic->preActions(); if (_vm->_game->_abortTimersMode == ABORTMODE_2) - _vm->_game->_abortTimers = 0; + _vm->_game->_trigger = 0; } } @@ -458,7 +458,7 @@ void Scene::doAction() { int flag = 0; _vm->_game->_abortTimersMode2 = ABORTMODE_0; - if ((_action._inProgress || _vm->_game->_abortTimers) && !_action._v8453A) { + if ((_action._inProgress || _vm->_game->_trigger) && !_action._v8453A) { _sceneLogic->actions(); _action._inProgress = true; flag = -1; @@ -467,14 +467,14 @@ void Scene::doAction() { if (_vm->_game->_screenObjects._v832EC == 1) { _action._inProgress = false; } else { - if ((_action._inProgress || _vm->_game->_abortTimers) || + if ((_action._inProgress || _vm->_game->_trigger) || (!flag && _action._v8453A == flag)) { _vm->_game->_sectionHandler->sectionPtr2(); _action._inProgress = true; flag = -1; } - if ((_action._inProgress || _vm->_game->_abortTimers) && (!flag || _action._v8453A == flag)) { + if ((_action._inProgress || _vm->_game->_trigger) && (!flag || _action._v8453A == flag)) { _vm->_game->doObjectAction(); } @@ -496,7 +496,7 @@ void Scene::doAction() { _action._inProgress = false; if (_vm->_game->_abortTimersMode == ABORTMODE_0) - _vm->_game->_abortTimers = 0; + _vm->_game->_trigger = 0; } void Scene::checkStartWalk() { @@ -515,7 +515,7 @@ void Scene::doSceneStep() { _vm->_game->_player._unk3 = 0; if (_vm->_game->_abortTimersMode == ABORTMODE_1) - _vm->_game->_abortTimers = 0; + _vm->_game->_trigger = 0; } void Scene::checkKeyboard() { @@ -537,7 +537,7 @@ void Scene::updateCursor() { Player &player = _vm->_game->_player; CursorType cursorId = CURSOR_ARROW; - if (_action._v83338 == 1 && !_vm->_game->_screenObjects._v7FECA && + if (_action._interAwaiting == 1 && !_vm->_game->_screenObjects._v7FECA && _vm->_game->_screenObjects._category == CAT_HOTSPOT) { int idx = _vm->_game->_screenObjects._selectedObject - _userInterface._categoryIndexes[CAT_HOTSPOT - 1]; diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index 712d065fb9..b6304679cb 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -49,7 +49,7 @@ KernelMessage::KernelMessage() { _frameTimer2 = 0; _frameTimer = 0; _timeout = 0; - _abortTimers = 0; + _trigger = 0; _abortMode = ABORTMODE_0; _actionDetails._verbId = 0; _actionDetails._objectNameId = 0; diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index c881e9560e..0c78b0c8a1 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -303,7 +303,7 @@ void ScreenObjects::check(bool scanFlag) { if (_vm->_easyMouse && _vm->_events->_mouseButtons && category != _category && scene._userInterface._category != CAT_NONE) { _released = true; - if (category >= CAT_ACTION && category <= CAT_TALK_ENTRY) { + if (category >= CAT_COMMAND && category <= CAT_TALK_ENTRY) { elementHighlighted(); } @@ -315,12 +315,12 @@ void ScreenObjects::check(bool scanFlag) { scene._userInterface._category = _category; if (!_vm->_events->_mouseButtons || _vm->_easyMouse) { - if (userInterface._category >= CAT_ACTION && userInterface._category <= CAT_TALK_ENTRY) { + if (userInterface._category >= CAT_COMMAND && userInterface._category <= CAT_TALK_ENTRY) { elementHighlighted(); } } - if (_vm->_events->_mouseButtons || (_vm->_easyMouse && scene._action._v83338 > 1 + if (_vm->_events->_mouseButtons || (_vm->_easyMouse && scene._action._interAwaiting > 1 && scene._userInterface._category == CAT_INV_LIST) || (_vm->_easyMouse && scene._userInterface._category == CAT_HOTSPOT)) { scene._action.checkActionAtMousePos(); @@ -465,12 +465,12 @@ void ScreenObjects::elementHighlighted() { int uiCount; switch (userInterface._category) { - case CAT_ACTION: + case CAT_COMMAND: index = 10; indexEnd = 9; varA = 5; topIndex = 0; - idxP = !_v7FECA ? &userInterface._highlightedActionIndex : + idxP = !_v7FECA ? &userInterface._highlightedCommandIndex : &userInterface._selectedActionIndex; if (_v7FECA && userInterface._selectedItemVocabIdx >= 0) @@ -486,8 +486,8 @@ void ScreenObjects::elementHighlighted() { indexEnd = invList.size() - 1; varA = 0; topIndex = userInterface._inventoryTopIndex; - idxP = &userInterface._v1C; - var4 = (!_released || (_vm->_events->_mouseButtons && action._v83338 == 1)) ? 0 : 1; + idxP = &userInterface._highlightedItemIndex; + var4 = (!_released || (_vm->_events->_mouseButtons && action._interAwaiting == 1)) ? 0 : 1; break; case CAT_INV_VOCAB: @@ -502,10 +502,10 @@ void ScreenObjects::elementHighlighted() { varA = 0; topIndex = 0; - idxP = _v7FECA ? &userInterface._selectedItemVocabIdx : &userInterface._v1E; + idxP = _v7FECA ? &userInterface._selectedItemVocabIdx : &userInterface._highlightedActionIndex; if (_v7FECA && userInterface._selectedActionIndex >= 0) - userInterface.updateSelection(CAT_ACTION, -1, &userInterface._selectedActionIndex); + userInterface.updateSelection(CAT_COMMAND, -1, &userInterface._selectedActionIndex); var4 = _released && !_v7FECA ? 1 : 0; break; @@ -529,7 +529,7 @@ void ScreenObjects::elementHighlighted() { indexEnd = index - 1; varA = 0; topIndex = 0; - idxP = &userInterface._highlightedActionIndex; + idxP = &userInterface._highlightedCommandIndex; var4 = -1; break; @@ -597,7 +597,7 @@ void ScreenObjects::elementHighlighted() { _vm->_game->_scene._highlightedHotspot = newIndex; if (_category == CAT_INV_LIST || _category == CAT_INV_ANIM) { - if (action._v83338 == 1 && newIndex >= 0 && _released && + if (action._interAwaiting == 1 && newIndex >= 0 && _released && (!_vm->_events->_mouseReleased || !_vm->_easyMouse)) newIndex = -1; } diff --git a/engines/mads/screen.h b/engines/mads/screen.h index 7fa5722e18..c733452aa2 100644 --- a/engines/mads/screen.h +++ b/engines/mads/screen.h @@ -33,7 +33,7 @@ namespace MADS { #define MADS_SCREEN_HEIGHT 200 enum ScrCategory { - CAT_NONE = 0, CAT_ACTION = 1, CAT_INV_LIST = 2, CAT_INV_VOCAB = 3, + CAT_NONE = 0, CAT_COMMAND = 1, CAT_INV_LIST = 2, CAT_INV_VOCAB = 3, CAT_HOTSPOT = 4, CAT_INV_ANIM = 5, CAT_TALK_ENTRY = 6, CAT_INV_SCROLLER = 7, CAT_12 = 12 }; diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index bb2454d3fc..97d8674f51 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -327,7 +327,7 @@ bool SequenceList::loadSprites(int seqIndex) { } if (idx >= 0) { - _vm->_game->_abortTimers = seqEntry._entries._abortVal[idx]; + _vm->_game->_trigger = seqEntry._entries._abortVal[idx]; _vm->_game->_abortTimersMode = seqEntry._abortMode; if (seqEntry._abortMode == ABORTMODE_1) @@ -343,7 +343,7 @@ bool SequenceList::loadSprites(int seqIndex) { void SequenceList::tick() { Scene &scene = _vm->_game->_scene; for (uint idx = 0; idx < _entries.size(); ++idx) { - if ((_vm->_game->_abortTimers2 == 0) && (_vm->_game->_abortTimers != 0)) + if ((_vm->_game->_fx == 0) && (_vm->_game->_trigger != 0)) break; SequenceEntry &seqEntry = _entries[idx]; diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 8a7bac117f..d0139e2897 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -199,9 +199,9 @@ UserInterface::UserInterface(MADSEngine *vm) : _vm(vm), _dirtyAreas(vm), _selectedActionIndex = 0; _selectedItemVocabIdx = -1; _scrollerY = 0; + _highlightedCommandIndex = -1; + _highlightedItemIndex = -1; _highlightedActionIndex = -1; - _v1C = -1; - _v1E = -1; _dirtyAreas.resize(50); _inventoryChanged = false; Common::fill(&_categoryIndexes[0], &_categoryIndexes[7], 0); @@ -265,9 +265,9 @@ void UserInterface::setup(int id) { scene._userInterface._uiSlots.clear(); scene._userInterface._uiSlots.fullRefresh(); _vm->_game->_ticksExpiry = _vm->_events->getFrameCounter(); + _highlightedCommandIndex = -1; _highlightedActionIndex = -1; - _v1E = -1; - _v1C = -1; + _highlightedItemIndex = -1; if (_vm->_game->_kernelMode == KERNEL_ACTIVE_CODE) scene._userInterface._uiSlots.draw(false, false); @@ -291,7 +291,7 @@ void UserInterface::drawTextElements() { void UserInterface::drawActions() { for (int idx = 0; idx < 10; ++idx) { - writeVocab(CAT_ACTION, idx); + writeVocab(CAT_COMMAND, idx); } } @@ -329,10 +329,10 @@ void UserInterface::writeVocab(ScrCategory category, int id) { int vocabId; Common::String vocabStr; switch (category) { - case CAT_ACTION: + case CAT_COMMAND: font = _vm->_font->getFont(FONT_INTERFACE); vocabId = scene._verbList[id]._id; - if (id == _highlightedActionIndex) { + if (id == _highlightedCommandIndex) { _vm->_font->setColorMode(SELMODE_HIGHLIGHTED); } else { _vm->_font->setColorMode(id == _selectedActionIndex ? SELMODE_SELECTED : SELMODE_UNSELECTED); @@ -345,7 +345,7 @@ void UserInterface::writeVocab(ScrCategory category, int id) { case CAT_INV_LIST: font = _vm->_font->getFont(FONT_INTERFACE); vocabId = _vm->_game->_objects.getItem(id)._descId; - if (id == _v1C) { + if (id == _highlightedItemIndex) { _vm->_font->setColorMode(SELMODE_HIGHLIGHTED); } else { _vm->_font->setColorMode(id == _selectedInvIndex ? SELMODE_SELECTED : SELMODE_UNSELECTED); @@ -386,7 +386,7 @@ void UserInterface::writeVocab(ScrCategory category, int id) { // Item specific verbs font = _vm->_font->getFont(FONT_INTERFACE); vocabId = _vm->_game->_objects.getItem(_selectedInvIndex)._vocabList[id]._vocabId; - if (id == _v1E) { + if (id == _highlightedActionIndex) { _vm->_font->setColorMode(SELMODE_HIGHLIGHTED); } else { _vm->_font->setColorMode(id == _selectedInvIndex ? SELMODE_SELECTED : SELMODE_UNSELECTED); @@ -418,12 +418,12 @@ void UserInterface::loadElements() { } // Set up actions - _categoryIndexes[CAT_ACTION - 1] = _vm->_game->_screenObjects.size() + 1; + _categoryIndexes[CAT_COMMAND - 1] = _vm->_game->_screenObjects.size() + 1; for (int idx = 0; idx < 10; ++idx) { - getBounds(CAT_ACTION, idx, bounds); + getBounds(CAT_COMMAND, idx, bounds); moveRect(bounds); - _vm->_game->_screenObjects.add(bounds, LAYER_GUI, CAT_ACTION, idx); + _vm->_game->_screenObjects.add(bounds, LAYER_GUI, CAT_COMMAND, idx); } // Set up inventory list @@ -478,7 +478,7 @@ bool UserInterface::getBounds(ScrCategory category, int v, Common::Rect &bounds) int leftStart, yOffset, widthAmt; switch (category) { - case CAT_ACTION: + case CAT_COMMAND: heightMultiplier = v % 5; widthMultiplier = v / 5; leftStart = 2; @@ -635,7 +635,7 @@ void UserInterface::inventoryAnim() { } void UserInterface::categoryChanged() { - _v1C = -1; + _highlightedItemIndex = -1; _vm->_events->initVars(); _category = CAT_NONE; } diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h index ee5bc7aa0d..740ea66c4e 100644 --- a/engines/mads/user_interface.h +++ b/engines/mads/user_interface.h @@ -143,9 +143,9 @@ public: int _selectedActionIndex; int _selectedItemVocabIdx; int _scrollerY; + int _highlightedCommandIndex; + int _highlightedItemIndex; int _highlightedActionIndex; - int _v1C; - int _v1E; bool _inventoryChanged; int _categoryIndexes[8]; Common::StringArray _talkStrings; -- cgit v1.2.3 From b9daf53bcd14332624f3d18fd21514b1f9146107 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 28 Mar 2014 09:19:55 -0400 Subject: MADS: Cleanup of direction setup, fix sprite mirroring for walking --- engines/mads/assets.cpp | 4 +- engines/mads/assets.h | 4 +- engines/mads/game.cpp | 2 +- engines/mads/messages.cpp | 4 +- engines/mads/nebular/nebular_scenes1.cpp | 2 +- engines/mads/player.cpp | 110 ++++++++++++++++--------------- engines/mads/player.h | 27 ++++---- engines/mads/scene.cpp | 6 +- engines/mads/sequence.cpp | 2 +- 9 files changed, 85 insertions(+), 76 deletions(-) diff --git a/engines/mads/assets.cpp b/engines/mads/assets.cpp index ec5d54251f..9d022871d4 100644 --- a/engines/mads/assets.cpp +++ b/engines/mads/assets.cpp @@ -224,9 +224,9 @@ SpriteSetCharInfo::SpriteSetCharInfo(Common::SeekableReadStream *s) { for (int i = 0; i < 16; ++i) _ticksList[i] = s->readUint16LE(); - _unk1 = s->readUint16LE(); + _velocity = s->readUint16LE(); _ticksAmount = s->readByte(); - _yScale = s->readByte(); + _centerOfGravity = s->readByte(); } } // End of namespace MADS diff --git a/engines/mads/assets.h b/engines/mads/assets.h index 31d46881ff..b5b351242d 100644 --- a/engines/mads/assets.h +++ b/engines/mads/assets.h @@ -51,9 +51,9 @@ public: int _frameList2[16]; int _frameList[16]; int _ticksList[16]; - int _unk1; + int _velocity; int _ticksAmount; - int _yScale; + int _centerOfGravity; }; class SpriteAsset { diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 900d4dc86a..28a1d1d4ea 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -235,7 +235,7 @@ void Game::sectionLoop() { _player._destPos = _player._playerPos; _player._turnToFacing = _player._facing; _player._targetFacing = _player._facing; - _player.setupFrame(); + _player.selectSeries(); _player.updateFrame(); _player._visible3 = _player._visible; _player._special = _scene.getDepthHighBits(_player._playerPos); diff --git a/engines/mads/messages.cpp b/engines/mads/messages.cpp index 617bd6d2a0..5c6e11339c 100644 --- a/engines/mads/messages.cpp +++ b/engines/mads/messages.cpp @@ -205,9 +205,9 @@ void KernelMessages::processText(int msgIndex) { if (msg._flags & KMSG_PLAYER_TIMEOUT) { if (player._visible3) { SpriteAsset &asset = *_vm->_game->_scene._sprites[player._spritesStart + player._spritesIdx]; - MSprite *frame = asset.getFrame(player._frameNum - 1); + MSprite *frame = asset.getFrame(player._frameNumber - 1); - int yAmount = player._currentScale * player._yScale / 100; + int yAmount = player._currentScale * player._centerOfGravity / 100; x1 = player._playerPos.x; y1 = (frame->h * player._currentScale / -100) + yAmount + player._playerPos.y - 15; diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index e5c0abd4bd..839c001619 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -92,7 +92,7 @@ void Scene1xx::setPlayerSpritesPrefix() { _game._player._loadsFirst = false; } - _game._player._unk3 = 0; + _game._player._trigger = 0; _vm->_palette->setEntry(16, 10, 63, 63); _vm->_palette->setEntry(17, 10, 45, 45); } diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index eaec85c8fc..f569e7ee2c 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -37,6 +37,7 @@ Player::Player(MADSEngine *vm): _vm(vm) { _facing = FACING_NORTH; _turnToFacing = FACING_NORTH; _targetFacing = FACING_NORTH; + _mirror = false; _spritesLoaded = false; _spritesStart = 0; _spritesIdx = 0; @@ -51,24 +52,24 @@ Player::Player(MADSEngine *vm): _vm(vm) { _special = 0; _ticksAmount = 0; _priorTimer = 0; - _unk3 = _unk4 = 0; + _trigger = _unk4 = 0; + _spritesChanged = false; _forceRefresh = false; _highSprites = false; _currentDepth = 0; _currentScale = 0; - _frameOffset = 0; - _frameNum = 0; - _yScale = 0; + _frameNumber = 0; + _centerOfGravity = 0; _frameCount = 0; - _unk1 = 0; - _unk2 = 0; - _unk3 = 0; + _velocity = 0; + _upcomingTrigger = 0; + _trigger = 0; _frameListIndex = 0; - _actionIndex = 0; + _stopWalkerIndex = 0; _hypotenuse = 0; - Common::fill(&_actionList[0], &_actionList[12], 0); - Common::fill(&_actionList2[0], &_actionList2[12], 0); + Common::fill(&_stopWalkerList[0], &_stopWalkerList[12], 0); + Common::fill(&_stopWalkerTrigger[0], &_stopWalkerTrigger[12], 0); Common::fill(&_spriteSetsPresent[0], &_spriteSetsPresent[PLAYER_SPRITES_FILE_COUNT], false); } @@ -170,7 +171,8 @@ void Player::dirChanged() { _facing = (diff >= 0) ? (Facing)_directionListIndexes[_facing + 20] : (Facing)_directionListIndexes[_facing + 10]; - setupFrame(); + selectSeries(); + if ((_facing == _turnToFacing) && !_moving) updateFrame(); @@ -182,31 +184,33 @@ void Player::cancelCommand() { _action->_inProgress = false; } -void Player::setupFrame() { +void Player::selectSeries() { Scene &scene = _vm->_game->_scene; - resetActionList(); - _frameOffset = 0; + clearStopList(); + _mirror = false; + _spritesIdx = _directionListIndexes[_facing]; if (!_spriteSetsPresent[_spritesIdx]) { // Direction isn't present, so use alternate direction, with entries flipped _spritesIdx -= 4; - _frameOffset = 0x8000; + _mirror = true; } SpriteAsset &spriteSet = *scene._sprites[_spritesStart + _spritesIdx]; assert(spriteSet._charInfo); - _unk1 = MAX(spriteSet._charInfo->_unk1, 100); - setTicksAmount(); + _velocity = MAX(spriteSet._charInfo->_velocity, 100); + setBaseFrameRate(); _frameCount = spriteSet._charInfo->_totalFrames; if (_frameCount == 0) _frameCount = spriteSet.getCount(); - _yScale = spriteSet._charInfo->_yScale; + _centerOfGravity = spriteSet._charInfo->_centerOfGravity; + + if ((_frameNumber <= 0) || (_frameNumber > _frameCount)) + _frameNumber = 1; - if ((_frameNum <= 0) || (_frameNum > _frameCount)) - _frameNum = 1; _forceRefresh = true; } @@ -216,32 +220,34 @@ void Player::updateFrame() { assert(spriteSet._charInfo); if (!spriteSet._charInfo->_numEntries) { - _frameNum = 1; + _frameNumber = 1; } else { - _frameListIndex = _actionList[_actionIndex]; + _frameListIndex = _stopWalkerList[_stopWalkerIndex]; if (!_visible) { - _unk2 = 0; + _upcomingTrigger = 0; } else { - _unk2 = _actionList2[_actionIndex]; + _upcomingTrigger = _stopWalkerTrigger[_stopWalkerIndex]; - if (_actionIndex > 0) - --_actionIndex; + if (_stopWalkerIndex > 0) + --_stopWalkerIndex; } // Set the player frame number int frameIndex = ABS(_frameListIndex); - _frameNum = (_frameListIndex <= 0) ? spriteSet._charInfo->_frameList[frameIndex] : + _frameNumber = (_frameListIndex <= 0) ? spriteSet._charInfo->_frameList[frameIndex] : spriteSet._charInfo->_frameList2[frameIndex]; // Set next waiting period in ticks if (frameIndex == 0) { - setTicksAmount(); + setBaseFrameRate(); } else { _ticksAmount = spriteSet._charInfo->_ticksList[frameIndex]; } } + + _forceRefresh = true; } void Player::update() { @@ -271,9 +277,9 @@ void Player::update() { slot._SlotType = ST_FOREGROUND; slot._seqIndex = PLAYER_SEQ_INDEX; slot._spritesIndex = _spritesStart + _spritesIdx; - slot._frameNumber = _frameOffset + _frameNum; + slot._frameNumber = _mirror ? -_frameNumber : _frameNumber; slot._position.x = _playerPos.x; - slot._position.y = _playerPos.y + (_yScale * newScale) / 100; + slot._position.y = _playerPos.y + (_centerOfGravity * newScale) / 100; slot._depth = newDepth; slot._scale = newScale; @@ -304,7 +310,7 @@ void Player::update() { // has moved off-screen if (_newSceneId) { SpriteAsset *asset = scene._sprites[slot._spritesIndex]; - MSprite *frame = asset->getFrame(_frameNum - 1); + MSprite *frame = asset->getFrame(_frameNumber - 1); int xScale = frame->w * newScale / 200; int yScale = frame->h * newScale / 100; int playerX = slot._position.x; @@ -326,19 +332,19 @@ void Player::update() { _forceRefresh = false; } -void Player::resetActionList() { - _actionList[0] = 0; - _actionList2[0] = 0; - _actionIndex = 0; - _unk2 = 0; - _unk3 = 0; +void Player::clearStopList() { + _stopWalkerList[0] = 0; + _stopWalkerTrigger[0] = 0; + _stopWalkerIndex = 0; + _upcomingTrigger = 0; + _trigger = 0; } void Player::setDest(const Common::Point &pt, Facing facing) { Scene &scene = _vm->_game->_scene; - resetActionList(); - setTicksAmount(); + clearStopList(); + setBaseFrameRate(); _moving = true; _targetFacing = facing; @@ -433,10 +439,10 @@ void Player::move() { else if (!_moving) updateFrame(); - int var1 = _unk1; + int velocity = _velocity; if (_unk4 && (_hypotenuse > 0)) { int v1 = -(_currentScale - 100) * (_posDiff.x - 1) / _hypotenuse + _currentScale; - var1 = MAX(1, 10000 / (v1 * _currentScale * var1)); + velocity = MAX(1, 10000 / (v1 * _currentScale * velocity)); } if (!_moving || (_facing != _turnToFacing)) @@ -444,7 +450,7 @@ void Player::move() { Common::Point newPos = _playerPos; - if (_v8452E < var1) { + if (_v8452E < velocity) { do { if (_v8452C < _posDiff.x) _v8452C += _posDiff.y; @@ -470,10 +476,10 @@ void Player::move() { _v8452E += _v84530; - } while ((_v8452E < var1) && !routeFlag && ((_posChange.x > 0) || (_posChange.y > 0) || (_newSceneId != 0))); + } while ((_v8452E < velocity) && !routeFlag && ((_posChange.x > 0) || (_posChange.y > 0) || (_newSceneId != 0))); } - _v8452E -= var1; + _v8452E -= velocity; if (routeFlag) cancelCommand(); @@ -512,15 +518,15 @@ void Player::idle() { // Reset back to the start of the list _frameListIndex = 0; else { - _frameNum += direction; + _frameNumber += direction; _forceRefresh = true; - if (spriteSet._charInfo->_frameList2[frameIndex] < _frameNum) { - _unk3 = _unk2; + if (spriteSet._charInfo->_frameList2[frameIndex] < _frameNumber) { + _trigger = _upcomingTrigger; updateFrame(); } - if (spriteSet._charInfo->_frameList[frameIndex] < _frameNum) { - _unk3 = _unk2; + if (spriteSet._charInfo->_frameList[frameIndex] < _frameNumber) { + _trigger = _upcomingTrigger; updateFrame(); } } @@ -528,8 +534,8 @@ void Player::idle() { void Player::postUpdate() { if (_moving) { - if (++_frameNum > _frameCount) - _frameNum = 1; + if (++_frameNumber > _frameCount) + _frameNumber = 1; _forceRefresh = true; } else { if (!_forceRefresh) @@ -559,7 +565,7 @@ int Player::getScale(int yp) { return MIN(scale, 100); } -void Player::setTicksAmount() { +void Player::setBaseFrameRate() { Scene &scene = _vm->_game->_scene; SpriteAsset &spriteSet = *scene._sprites[_spritesStart + _spritesIdx]; diff --git a/engines/mads/player.h b/engines/mads/player.h index 004c412901..71f3406f18 100644 --- a/engines/mads/player.h +++ b/engines/mads/player.h @@ -51,20 +51,20 @@ private: MADSEngine *_vm; bool _highSprites; bool _spriteSetsPresent[PLAYER_SPRITES_FILE_COUNT]; - int _frameOffset; + bool _mirror; int _frameCount; int _frameListIndex; - int _actionIndex; bool _v844BC; int _v8452E; int _v8452C; int _v84530; int _routeLength; - int _actionList[12]; - int _actionList2[12]; + int _stopWalkerList[12]; + int _stopWalkerTrigger[12]; + int _stopWalkerIndex; int _hypotenuse; - void resetActionList(); + void clearStopList(); void move(); @@ -80,7 +80,7 @@ private: */ int getScale(int yp); - void setTicksAmount(); + void setBaseFrameRate(); void setupRoute(); @@ -117,7 +117,7 @@ public: bool _priorVisible; bool _visible3; bool _walkAnywhere; - int _frameNum; + int _frameNumber; bool _loadsFirst; bool _loadedFirst; Common::Point _playerPos; @@ -130,12 +130,12 @@ public: int _special; int _ticksAmount; uint32 _priorTimer; - int _unk1; - int _unk2; - int _unk3; + int _velocity; + int _upcomingTrigger; + int _trigger; bool _unk4; bool _forceRefresh; - int _yScale; + int _centerOfGravity; int _currentDepth; int _currentScale; Common::String _spritesPrefix; @@ -167,7 +167,10 @@ public: */ void cancelCommand(); - void setupFrame(); + /** + * Set up control parameters for the current active series (the + * direction which the player is facing in) */ + void selectSeries(); void updateFrame(); diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index aa57a7e6b3..62702518fc 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -290,7 +290,7 @@ void Scene::doFrame() { _action._selectedAction = 0; } - if (!_vm->_game->_trigger && !player._unk3) { + if (!_vm->_game->_trigger && !player._trigger) { // Refresh the dynamic hotspots if they've changed if (_dynamicHotspots._changed) _dynamicHotspots.refresh(); @@ -301,7 +301,7 @@ void Scene::doFrame() { } if (_action._selectedAction && player._stepEnabled && !_action._startWalkFlag && - !_vm->_game->_trigger && !player._unk3) { + !_vm->_game->_trigger && !player._trigger) { _action.startAction(); if (_action._activeAction._verbId == Nebular::NOUN_LOOK_AT) { _action._activeAction._verbId = VERB_LOOK; @@ -512,7 +512,7 @@ void Scene::doSceneStep() { _vm->_game->_sectionHandler->step(); _vm->_game->_player.step(); - _vm->_game->_player._unk3 = 0; + _vm->_game->_player._trigger = 0; if (_vm->_game->_abortTimersMode == ABORTMODE_1) _vm->_game->_trigger = 0; diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index 97d8674f51..9a8e2c62e6 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -495,7 +495,7 @@ void SequenceList::setScale(int spriteIdx, int scale) { void SequenceList::setMsgLayout(int seqIndex) { Player &player = _vm->_game->_player; - int yp = player._playerPos.y + (player._yScale * player._currentScale) / 100; + int yp = player._playerPos.y + (player._centerOfGravity * player._currentScale) / 100; setMsgPosition(seqIndex, Common::Point(player._playerPos.x, yp)); setDepth(seqIndex, player._currentDepth); setScale(seqIndex, player._currentScale); -- cgit v1.2.3 From 5df6ff9329c46bf4df8fc4dcaa378959eab1d8ee Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 28 Mar 2014 20:15:51 +0100 Subject: MADS: suppress optional parameters of isAction, rework and renaming in scene 202 --- engines/mads/nebular/nebular_scenes1.cpp | 44 +++--- engines/mads/nebular/nebular_scenes2.cpp | 248 +++++++++++++++---------------- engines/mads/nebular/nebular_scenes2.h | 8 +- 3 files changed, 150 insertions(+), 150 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 839c001619..48e9b4bd3f 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -259,7 +259,7 @@ void Scene103::preActions() { void Scene103::actions() { if (_action._savedFields._lookFlag) { _vm->_dialogs->show(10322); - } else if (_action.isAction(395, 110, 0)) { + } else if (_action.isAction(395, 110)) { switch (_vm->_game->_trigger) { case 0: _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle( @@ -279,7 +279,7 @@ void Scene103::actions() { break; } } - else if (_action.isAction(VERB_TAKE, 371, 0) && _game._objects.isInRoom(OBJ_TIMER_MODULE)) { + else if (_action.isAction(VERB_TAKE, 371) && _game._objects.isInRoom(OBJ_TIMER_MODULE)) { switch (_vm->_game->_trigger) { case 0: _scene->changeDepthSurface(1); @@ -341,9 +341,9 @@ void Scene103::actions() { default: break; } - } else if (_action.isAction(VERB_LOOK, 362, 0)) { + } else if (_action.isAction(VERB_LOOK, 362)) { _vm->_dialogs->show(10301); - } else if (_action.isAction(VERB_TAKE, 362, 0)) { + } else if (_action.isAction(VERB_TAKE, 362)) { if (!_vm->_game->_trigger) _vm->_sound->command(31); @@ -368,10 +368,10 @@ void Scene103::actions() { _scene->_hotspots.activate(362, false); } } - } else if (_action.isAction(VERB_LOOK, 250, 0)) { + } else if (_action.isAction(VERB_LOOK, 250)) { _vm->_dialogs->show(!_globals[kTurkeyExploded] ? 10323 : 10303); } - else if (_action.isAction(VERB_TALKTO, 27, 0)) { + else if (_action.isAction(VERB_TALKTO, 27)) { switch (_vm->_game->_trigger) { case 0: { _game._player._stepEnabled = false; @@ -400,39 +400,39 @@ void Scene103::actions() { default: break; } - } else if (!_action.isAction(VERB_LOOK, 27, 0)) { + } else if (!_action.isAction(VERB_LOOK, 27)) { _vm->_dialogs->show(10304); - } else if (!_action.isAction(VERB_LOOK, 36, 0)) { + } else if (!_action.isAction(VERB_LOOK, 36)) { _vm->_dialogs->show(10307); - } else if (!_action.isAction(VERB_LOOK, 55, 0)) { + } else if (!_action.isAction(VERB_LOOK, 55)) { _vm->_dialogs->show(10308); - } else if (!_action.isAction(VERB_TAKE, 315, 0)) { + } else if (!_action.isAction(VERB_TAKE, 315)) { _vm->_dialogs->show(10309); - } else if (!_action.isAction(VERB_TAKE, 85, 0)) { + } else if (!_action.isAction(VERB_TAKE, 85)) { _vm->_dialogs->show(10310); - } else if (!_action.isAction(VERB_LOOK, 144, 0)) { + } else if (!_action.isAction(VERB_LOOK, 144)) { _vm->_dialogs->show(10312); - } else if (!_action.isAction(VERB_OPEN, 144, 0)) { + } else if (!_action.isAction(VERB_OPEN, 144)) { _vm->_dialogs->show(10313); - } else if (!_action.isAction(VERB_CLOSE, 27, 0)) { + } else if (!_action.isAction(VERB_CLOSE, 27)) { _vm->_dialogs->show(10314); - } else if (!_action.isAction(VERB_LOOK, 310, 0)) { + } else if (!_action.isAction(VERB_LOOK, 310)) { _vm->_dialogs->show(10315); - } else if (!_action.isAction(VERB_LOOK, 178, 0)) { + } else if (!_action.isAction(VERB_LOOK, 178)) { _vm->_dialogs->show(10316); - } else if (!_action.isAction(VERB_LOOK, 283, 0)) { + } else if (!_action.isAction(VERB_LOOK, 283)) { _vm->_dialogs->show(10317); - } else if (!_action.isAction(VERB_LOOK, 120, 0)) { + } else if (!_action.isAction(VERB_LOOK, 120)) { _vm->_dialogs->show(10318); - } else if (_action.isAction(VERB_LOOK, 289, 0) && + } else if (_action.isAction(VERB_LOOK, 289) && _game._objects.isInInventory(OBJ_REBREATHER)) { _vm->_dialogs->show(10319); - } else if (_action.isAction(VERB_LOOK, 371, 0) && + } else if (_action.isAction(VERB_LOOK, 371) && _game._objects.isInInventory(OBJ_TIMER_MODULE)) { _vm->_dialogs->show(10320); - } else if (!_action.isAction(VERB_LOOK, 137, 0)) { + } else if (!_action.isAction(VERB_LOOK, 137)) { _vm->_dialogs->show(10321); - } else if (_action.isAction(VERB_LOOK, 409, 0)) { + } else if (_action.isAction(VERB_LOOK, 409)) { _vm->_dialogs->show(_game._objects.isInInventory(OBJ_TIMER_MODULE) ? 10324 : 10325); } diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 38f87ba412..4f404f6a6e 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -285,9 +285,9 @@ void Scene201::step() { void Scene201::actions() { MADSAction *action = _game._player._action; if (action->_lookFlag == false) { - if (action->isAction(0x18C, 0x83, 0)) + if (action->isAction(0x18C, 0x83)) _scene->_nextSceneId = 202; - else if ((action->isAction(0x50, 0x156, 0)) || (action->isAction(0x188, 0x16C, 0)) || (action->isAction(0x188, 0x1B6, 0))) { + else if ((action->isAction(0x50, 0x156)) || (action->isAction(0x188, 0x16C)) || (action->isAction(0x188, 0x1B6))) { if (_game._trigger == 0) { _game._player._stepEnabled = false; _game._player._visible = false; @@ -296,30 +296,30 @@ void Scene201::actions() { } else if (_game._trigger == 1) { _scene->_nextSceneId = 213; } - } else if (action->isAction(0x3, 0x1A6, 0)) { + } else if (action->isAction(0x3, 0x1A6)) { _vm->_dialogs->show(0x4E85); - } else if (action->isAction(0x3, 0x129, 0)) { + } else if (action->isAction(0x3, 0x129)) { _vm->_dialogs->show(0x4E86); - } else if (action->isAction(0x3, 0x16F, 0)) { + } else if (action->isAction(0x3, 0x16F)) { _vm->_dialogs->show(0x4E87); - } else if (action->isAction(0x3, 0x142, 0)) { + } else if (action->isAction(0x3, 0x142)) { _vm->_dialogs->show(0x4E88); - } else if (action->isAction(0x3, 0x18F, 0)) { + } else if (action->isAction(0x3, 0x18F)) { _vm->_dialogs->show(0x4E89); - } else if (action->isAction(0x3, 0x1B9, 0)) { + } else if (action->isAction(0x3, 0x1B9)) { _vm->_dialogs->show(0x4E8A); - } else if (action->isAction(0x3, 0x192, 0)) { + } else if (action->isAction(0x3, 0x192)) { _vm->_dialogs->show(0x4E8B); - } else if (action->isAction(0x3, 0x1BA, 0)) { + } else if (action->isAction(0x3, 0x1BA)) { _vm->_dialogs->show(0x4E8C); - } else if (action->isAction(0x3, 0x83, 0)) { + } else if (action->isAction(0x3, 0x83)) { _vm->_dialogs->show(0x4E8E); - } else if (action->isAction(0x3, 0x1B6, 0)) { + } else if (action->isAction(0x3, 0x1B6)) { if (_globals[kMeteorologistEverSeen]) _vm->_dialogs->show(0x4E90); else _vm->_dialogs->show(0x4E8D); - } else if (action->isAction(0x3, 0x16C, 0)) { + } else if (action->isAction(0x3, 0x16C)) { _vm->_dialogs->show(0x4E91); } else return; @@ -406,16 +406,16 @@ void Scene202::enter() { _activeMsgFl = false; if (_scene->_priorSceneId == -2) { - if (_waitingMeteorologistFl) { + if (_waitingMeteoFl) { _globals._spriteIndexes[24] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 1); _game._player._visible = false; } } else { - _waitingMeteorologistFl = false; + _waitingMeteoFl = false; _ladderTopFl = false; } - _globals._v8425C = _globals._v7 = _scene->_frameStartTime; + _meteoClock1 = _meteoClock2 = _scene->_frameStartTime; if (_scene->_roomChanged) _game._objects.addToInventory(OBJ_NONE); @@ -480,7 +480,7 @@ void Scene202::step() { if (_game._trigger == 71) { _vm->_sound->command(3); _vm->_sound->command(9); - _globals._v8425C = 900 + _scene->_frameStartTime; + _meteoClock1 = 900 + _scene->_frameStartTime; Common::Point msgPos; int msgFlag; if (!_ladderTopFl) { @@ -551,31 +551,29 @@ void Scene202::step() { break; } - if (!_scene->_activeAnimation && (_globals[kMeteorologistStatus] != 2) && (_globals._v7 <= _scene->_frameStartTime) && (_globals._v8425C <= _scene->_frameStartTime)) { + if (!_scene->_activeAnimation && (_globals[kMeteorologistStatus] != 2) && (_meteoClock2 <= _scene->_frameStartTime) && (_meteoClock1 <= _scene->_frameStartTime)) { int randVal = _vm->getRandomNumber(1, 500); int threshold = 1; if (_ladderTopFl) - threshold = 26; + threshold += 25; if (!_globals[kMeteorologistEverSeen]) - threshold = 25; + threshold += 25; if (threshold >= randVal) { _vm->_sound->command(17); _scene->loadAnimation(formAnimName('M', -1), 71); - _globals._v84266 = -1; - _globals._v84268 = 0; + _toStationFl = true; + _toTeleportFl = false; _globals[kMeteorologistEverSeen] = true; - _globals._v6 = _scene->_frameStartTime; - _globals._v8 = 0; - _globals._v84262 = 0; - _globals._v84264 = 0; - _globals._v7 = _scene->_frameStartTime + 2; + _lastRoute = 0; + _stationCounter = 0; + _meteoClock2 = _scene->_frameStartTime + 2; } } if (!_scene->_activeAnimation) return; - if (_waitingMeteorologistFl) { + if (_waitingMeteoFl) { if (_scene->_activeAnimation->getCurrentFrame() >= 200) { if ((_globals[kMeteorologistWatch] == 2) || _globals[kLadderBroken]) { _scene->_nextSceneId = 213; @@ -600,8 +598,8 @@ void Scene202::step() { } } - if (_globals._v7 + 7200 <= _scene->_frameStartTime) { - _globals._v84268 = -1; + if (_meteoClock2 + 7200 <= _scene->_frameStartTime) { + _toTeleportFl = true; } if (_scene->_activeAnimation->getCurrentFrame() == _globals._v84260) { @@ -631,18 +629,18 @@ void Scene202::step() { frameStep = subStep4(randVal); break; case 59: - _globals._v84262 = 3; - ++_globals._v84264; + _lastRoute = 3; + ++_stationCounter; if (randVal <= 800) frameStep = 55; break; case 89: - _globals._v84262 = 1; + _lastRoute = 1; if (randVal <= 700) frameStep = 83; break; case 137: - _globals._v84262 = 2; + _lastRoute = 2; if (randVal <= 700) frameStep = 126; break; @@ -659,27 +657,27 @@ void Scene202::step() { } int Scene202::subStep1(int randVal) { - _globals._v84264 = 0; + _stationCounter = 0; - if ((randVal <= 100) || (_globals._v84266 != 0)) + if ((randVal <= 100) || _toStationFl) return 42; - if ((randVal <= 200) || (_globals._v84268 != 0)) + if ((randVal <= 200) || _toTeleportFl) return 96; - if ((randVal <= 300) && (_globals._v84262 != 1)) + if ((randVal <= 300) && (_lastRoute != 1)) return 77; return 76; } int Scene202::subStep2(int randVal) { - _globals._v84266 = 0; + _toStationFl = false; - if ((randVal <= 150) && (_globals._v84264 < 5)) + if ((randVal <= 150) && (_stationCounter < 5)) return 51; - if ((randVal <= 300) || _globals._v84268) + if ((randVal <= 300) || _toTeleportFl) return 74; if (randVal <= 400) @@ -689,20 +687,20 @@ int Scene202::subStep2(int randVal) { } int Scene202::subStep3(int randVal) { - if ((randVal <= 100) || (_globals._v84266 != 0)) + if ((randVal <= 100) || _toStationFl) return 27; - if ((randVal <= 200) || (_globals._v84268 != 0)) + if ((randVal <= 200) || _toTeleportFl) return 159; - if ((randVal <= 300) && (_globals._v84262 != 2)) + if ((randVal <= 300) && (_lastRoute != 2)) return 119; return 110; } int Scene202::subStep4(int randVal) { - if ((randVal <= 100) || (_globals._v84268 != 0)) + if ((randVal <= 100) || _toTeleportFl) return 176; if (randVal <= 200) @@ -716,7 +714,7 @@ void Scene202::preActions() { if (action->_walkFlag) _scene->_kernelMessages.reset(); - if (!_ladderTopFl && (action->isAction(0x4E, 0xC7, 0) || !action->_walkFlag)) { + if (!_ladderTopFl && (action->isAction(0x4E, 0xC7) || !action->_walkFlag)) { if (_game._trigger == 0) { _vm->_sound->command(29); action->_walkFlag = false; @@ -727,8 +725,7 @@ void Scene202::preActions() { _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 1); } else if (_game._trigger == 1) { _scene->_sequences.updateTimeout(-1, _globals._spriteIndexes[23]); - warning("CHECKME: _scene->_dynamicHotspots.remove(_globals._frameTime);"); - _scene->_dynamicHotspots.remove(_globals._frameTime); + _scene->_dynamicHotspots.remove(_ladderHotspotId); _game._player._visible = true; action->_walkFlag = true; _game._player._stepEnabled = true; @@ -736,7 +733,7 @@ void Scene202::preActions() { } } - if (action->isAction(0x3, 0x27, 0) && action->_activeAction._indirectObjectId > 0) { + if (action->isAction(0x3, 0x27) && action->_activeAction._indirectObjectId > 0) { if (!action->_walkFlag || _ladderTopFl) action->_startWalkFlag = false; else @@ -750,12 +747,12 @@ void Scene202::preActions() { void Scene202::actions() { MADSAction *action = _game._player._action; if (action->_lookFlag == false) { - if (action->isAction(0x4E, 0xC7, 0)) { + if (action->isAction(0x4E, 0xC7)) { action->_inProgress = false; return; - } else if (action->isAction(0x18C, 0x83, 0)) { + } else if (action->isAction(0x18C, 0x83)) { _scene->_nextSceneId = 203; - } else if (action->isAction(0x18C, 0x82, 0)) { + } else if (action->isAction(0x18C, 0x82)) { if (_globals[kMeteorologistStatus] != 2) { if (_scene->_activeAnimation) _globals[kMeteorologistStatus] = 1; @@ -763,7 +760,7 @@ void Scene202::actions() { _globals[kMeteorologistStatus] = 0; } _scene->_nextSceneId = 201; - } else if (action->isAction(0x4, 0x2C, 0)) { + } else if (action->isAction(0x4, 0x2C)) { if (action->_actionMode2 == 4) { if (_game._trigger == 0) { if (_game._objects.isInInventory(OBJ_BONES)) { @@ -801,16 +798,15 @@ void Scene202::actions() { return; } } - } else if ((action->isAction(0x50, 0xC7, 0)) && (_globals[kLadderBroken] == 0)) { + } else if ((action->isAction(0x50, 0xC7)) && (_globals[kLadderBroken] == 0)) { if (_game._trigger == 0) { _vm->_sound->command(29); - _globals._v8425C = _scene->_frameStartTime; + _meteoClock1 = _scene->_frameStartTime; _game._player._visible = false; _game._player._stepEnabled = false; int idx = _scene->_dynamicHotspots.add(199, 79, -1, Common::Rect(241, 68, 12, 54)); - warning("CHECKME: _globals._frameTime = _scene->_dynamicHotspots.setPosition(idx, 246, 124, 8);"); - _globals._frameTime = _scene->_dynamicHotspots.setPosition(idx, 246, 124, FACING_NORTH); + _ladderHotspotId = _scene->_dynamicHotspots.setPosition(idx, 246, 124, FACING_NORTH); _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 6, 1, 0, 0); _scene->_sequences.setDepth(_globals._spriteIndexes[23], 1); _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 1); @@ -843,7 +839,7 @@ void Scene202::actions() { _scene->_sequences.setDepth(_globals._spriteIndexes[25], 1); _scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(172, 123)); if (_scene->_activeAnimation) { - _waitingMeteorologistFl = true; + _waitingMeteoFl = true; _globals[kMeteorologistWatch] = 1; } else { _scene->_sequences.addTimer(120, 2); @@ -868,7 +864,7 @@ void Scene202::actions() { } } else { if (_game._trigger == 0) { - _globals._v84268 = 1; + _toTeleportFl = true; _game._player._stepEnabled = false; _scene->_sequences.remove(_globals._spriteIndexes[24]); _globals._spriteIndexes[24] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], true, 6, 1, 0, 0); @@ -883,7 +879,7 @@ void Scene202::actions() { if (_scene->_activeAnimation->getCurrentFrame() > 200) { _scene->_sequences.addTimer(120, 2); } else { - _waitingMeteorologistFl = true; + _waitingMeteoFl = true; _globals[kMeteorologistWatch] = 2; if ((_scene->_activeAnimation->getCurrentFrame() >= 44) && (_scene->_activeAnimation->getCurrentFrame() <= 75)) { _scene->_kernelMessages.reset(); @@ -916,15 +912,15 @@ void Scene202::actions() { return; } } - } else if (action->isAction(0x188, 0xAA, 0)) { + } else if (action->isAction(0x188, 0xAA)) { setRandomKernelMessage(); - } else if (action->isAction(0x3, 0x129, 0)) { + } else if (action->isAction(0x3, 0x129)) { _vm->_dialogs->show(0x4EEA); - } else if (action->isAction(0x3, 0x86, 0)) { + } else if (action->isAction(0x3, 0x86)) { _vm->_dialogs->show(0x4EEB); - } else if (action->isAction(0x3, 0x19C, 0)) { + } else if (action->isAction(0x3, 0x19C)) { _vm->_dialogs->show(0x4EEC); - } else if (action->isAction(0x3, 0x82, 0)) { + } else if (action->isAction(0x3, 0x82)) { if ((_globals[kMeteorologistStatus] == 0) || (_globals[kMeteorologistStatus] == 2)) { _vm->_dialogs->show(0x4EED); } else if (_globals[kMeteorologistStatus] == 1) { @@ -933,30 +929,30 @@ void Scene202::actions() { action->_inProgress = false; return; } - } else if (action->isAction(0x3, 0x18E, 0)) { + } else if (action->isAction(0x3, 0x18E)) { _vm->_dialogs->show(0x4EEE); - } else if (action->isAction(0x3, 0x164, 0)) { + } else if (action->isAction(0x3, 0x164)) { _vm->_dialogs->show(0x4EEF); - } else if (action->isAction(0x3, 0x175, 0)) { + } else if (action->isAction(0x3, 0x175)) { _vm->_dialogs->show(0x4EF0); - } else if (action->isAction(0x3, 0x174, 0)) { + } else if (action->isAction(0x3, 0x174)) { _vm->_dialogs->show(0x4EF1); - } else if (action->isAction(0x3, 0x142, 0)) { + } else if (action->isAction(0x3, 0x142)) { _vm->_dialogs->show(0x4EF2); - } else if (action->isAction(0x3, 0xAA, 0)) { + } else if (action->isAction(0x3, 0xAA)) { if ((_game._player._playerPos == Common::Point(77, 105)) && (_game._player._facing == 8)) _vm->_dialogs->show(0x4EF4); else _vm->_dialogs->show(0x4EF3); - } else if (action->isAction(0x3, 0x186, 0)) { + } else if (action->isAction(0x3, 0x186)) { _vm->_dialogs->show(0x4EF5); - } else if (action->isAction(0x3, 0x1B5, 0)) { + } else if (action->isAction(0x3, 0x1B5)) { _vm->_dialogs->show(0x4EF6); - } else if (action->isAction(0x3, 0x140, 0)) { + } else if (action->isAction(0x3, 0x140)) { _vm->_dialogs->show(0x4EF7); - } else if (action->isAction(0x4, 0x140, 0)) { + } else if (action->isAction(0x4, 0x140)) { _vm->_dialogs->show(0x4EF8); - } else if (action->isAction(0x3, 0x2D, 0)) { + } else if (action->isAction(0x3, 0x2D)) { if (action->_actionMode == 4) _vm->_dialogs->show(0x4EF9); else @@ -1047,34 +1043,34 @@ void Scene203::step() { } void Scene203::preActions() { - if (_globals._v0 && !_action.isAction(0x18C, 0x83, 0)) { + if (_globals._v0 && !_action.isAction(0x18C, 0x83)) { _game._player.startWalking(Common::Point(158, 136), FACING_SOUTH); _action._inProgress = false; return; } - if (_action.isAction(0xD, 0xF3, 0)) + if (_action.isAction(0xD, 0xF3)) _game._player._v844BE = 209; } void Scene203::actions() { if (_action._savedFields._lookFlag) { _vm->_dialogs->show(0x4F53); - } else if (_action.isAction(0x18C, 0x83, 0)) { + } else if (_action.isAction(0x18C, 0x83)) { _scene->_nextSceneId = 208; - } else if (_action.isAction(0x18C, 0x82, 0)) { + } else if (_action.isAction(0x18C, 0x82)) { _scene->_nextSceneId = 202; - } else if (_action.isAction(0x3, 0x142, 0)) { + } else if (_action.isAction(0x3, 0x142)) { _vm->_dialogs->show(0x4F4D); - } else if (_action.isAction(0x3, 0x4D, 0)) { + } else if (_action.isAction(0x3, 0x4D)) { _vm->_dialogs->show(0x4F4E); - } else if (_action.isAction(0x3, 0x100, 0)) { + } else if (_action.isAction(0x3, 0x100)) { _vm->_dialogs->show(0x4F4F); - } else if (_action.isAction(0x3, 0x82, 0)) { + } else if (_action.isAction(0x3, 0x82)) { _vm->_dialogs->show(0x4F50); - } else if (_action.isAction(0x3, 0x1A6, 0)) { + } else if (_action.isAction(0x3, 0x1A6)) { _vm->_dialogs->show(0x4F51); - } else if (_action.isAction(0x3, 0x30, 0)) { + } else if (_action.isAction(0x3, 0x30)) { _vm->_dialogs->show(0x4F51); } else return; @@ -1280,17 +1276,17 @@ void Scene207::step() { } void Scene207::preActions() { - if (_action.isAction(0x1AD, 0x1AE, 0)) + if (_action.isAction(0x1AD, 0x1AE)) _game._player._v844BE = 211; - if (_action.isAction(0x18C, 0x1AB, 0)) + if (_action.isAction(0x18C, 0x1AB)) _game._player._v844BE = 208; - if ((_action.isAction(0xD, 0)) || (_action.isAction(0x3, 0))) { - if (_action.isAction(0x185, 0)) { + if ((_action.isAction(0xD)) || (_action.isAction(0x3))) { + if (_action.isAction(0x185)) { _globals._frameTime = 0xD8F1; _globals._frameTime |= 0xFFFF0000; - } else if (_action.isAction(0x14D, 0)) { + } else if (_action.isAction(0x14D)) { _globals._v3 = 0xD8F1; _globals._v4 = -1; } @@ -1301,7 +1297,7 @@ void Scene207::actions() { if (_action._savedFields._lookFlag) { _vm->_dialogs->show(0x50E7); } else { - if (_action.isAction(0x18B, 0x70, 0)) + if (_action.isAction(0x18B, 0x70)) _scene->_nextSceneId = 214; else { if ((_game._player._playerPos.x > 150) && (_game._player._playerPos.x < 189) && @@ -1319,33 +1315,33 @@ void Scene207::actions() { _globals._v2 = 0; } - if (_action.isAction(3, 0x69, 0)) { + if (_action.isAction(3, 0x69)) { _vm->_dialogs->show(0x50DD); - } else if (_action.isAction(3, 0x1AF, 0)) { + } else if (_action.isAction(3, 0x1AF)) { _vm->_dialogs->show(0x50DE); - } else if (_action.isAction(3, 0x141, 0)) { + } else if (_action.isAction(3, 0x141)) { _vm->_dialogs->show(0x50DF); - } else if (_action.isAction(3, 0x3E, 0)) { + } else if (_action.isAction(3, 0x3E)) { _vm->_dialogs->show(0x50E0); - } else if (_action.isAction(3, 0x198, 0)) { + } else if (_action.isAction(3, 0x198)) { _vm->_dialogs->show(0x50E1); - } else if (_action.isAction(3, 0x1AE, 0)) { + } else if (_action.isAction(3, 0x1AE)) { _vm->_dialogs->show(0x50E2); - } else if (_action.isAction(3, 0xE8, 0)) { + } else if (_action.isAction(3, 0xE8)) { _vm->_dialogs->show(0x50E3); - } else if (_action.isAction(3, 0x12, 0)) { + } else if (_action.isAction(3, 0x12)) { _vm->_dialogs->show(0x50E4); - } else if (_action.isAction(3, 0x1AC, 0)) { + } else if (_action.isAction(3, 0x1AC)) { _vm->_dialogs->show(0x50E5); - } else if (_action.isAction(3, 0x185, 0)) { + } else if (_action.isAction(3, 0x185)) { _vm->_dialogs->show(0x50E6); - } else if (_action.isAction(4, 0x141, 0)) { + } else if (_action.isAction(4, 0x141)) { _vm->_dialogs->show(0x50E8); - } else if (_action.isAction(4, 0x12, 0)) { + } else if (_action.isAction(4, 0x12)) { _vm->_dialogs->show(0x50E9); - } else if (_action.isAction(3, 0x14D, 0)) { + } else if (_action.isAction(3, 0x14D)) { _vm->_dialogs->show(0x50EA); - } else if (_action.isAction(4, 0x14D, 0)) { + } else if (_action.isAction(4, 0x14D)) { _vm->_dialogs->show(0x50EB); } else return; @@ -1445,18 +1441,18 @@ void Scene208::step() { } void Scene208::preActions() { - if (_action.isAction(3, 0) && _action._walkFlag) + if (_action.isAction(3) && _action._walkFlag) _action._startWalkFlag = true; - if (_action.isAction(0x18C, 0x9B, 0)) + if (_action.isAction(0x18C, 0x9B)) _game._player._v844BE = 209; - if (_action.isAction(0x18C, 0xF6, 0)) + if (_action.isAction(0x18C, 0xF6)) _game._player._v844BE = 207; } void Scene208::actions() { - if (_action.isAction(0x18C, 0x19F, 0)) { + if (_action.isAction(0x18C, 0x19F)) { if (_globals[kRhotundaStatus]) _scene->_nextSceneId = 203; else if (_game._trigger == 0) { @@ -1466,9 +1462,9 @@ void Scene208::actions() { } else if (_game._trigger == 1) { _scene->_nextSceneId = 203; } - } else if (_action.isAction(0x18C, 0x83, 0)) { + } else if (_action.isAction(0x18C, 0x83)) { _scene->_nextSceneId = 212; - } else if (_action.isAction(0x4, 0x1AA, 0) && (!_globals[kLeavesStatus] || _game._trigger)) { + } else if (_action.isAction(0x4, 0x1AA) && (!_globals[kLeavesStatus] || _game._trigger)) { warning("TODO: sub3B282(1);"); if (_game._player._stepEnabled) _vm->_dialogs->showPicture(OBJ_BIG_LEAVES, 0x326, 0); @@ -1491,36 +1487,36 @@ void Scene208::actions() { if (_game._player._stepEnabled) { _vm->_dialogs->show(0x514C); } - } else if (_action.isAction(0x3, 0x5D, 0)) { + } else if (_action.isAction(0x3, 0x5D)) { _vm->_dialogs->show(0x5141); - } else if (_action.isAction(0x3, 0xF6, 0)) { + } else if (_action.isAction(0x3, 0xF6)) { _vm->_dialogs->show(0x5142); - } else if (_action.isAction(0x3, 0x16F, 0)) { + } else if (_action.isAction(0x3, 0x16F)) { _vm->_dialogs->show(0x5143); - } else if (_action.isAction(0x3, 0x129, 0)) { + } else if (_action.isAction(0x3, 0x129)) { _vm->_dialogs->show(0x5144); - } else if (_action.isAction(0x3, 0x1A1, 0)) { + } else if (_action.isAction(0x3, 0x1A1)) { _vm->_dialogs->show(0x5145); - } else if (_action.isAction(0x4, 0x1A1, 0)) { + } else if (_action.isAction(0x4, 0x1A1)) { _vm->_dialogs->show(0x5146); - } else if (_action.isAction(0x3, 0x9B, 0)) { + } else if (_action.isAction(0x3, 0x9B)) { _vm->_dialogs->show(0x5147); - } else if (_action.isAction(0x3, 0x19E, 0)) { + } else if (_action.isAction(0x3, 0x19E)) { _vm->_dialogs->show(0x5148); - } else if (_action.isAction(0x3, 0x1AA, 0)) { + } else if (_action.isAction(0x3, 0x1AA)) { _vm->_dialogs->show(0x5149); - } else if (_action.isAction(0x3, 0x1A9, 0)) { + } else if (_action.isAction(0x3, 0x1A9)) { if (_game._difficulty == DIFFICULTY_IMPOSSIBLE) _vm->_dialogs->show(0x514A); else _vm->_dialogs->show(0x514B); - } else if (_action.isAction(0x3, 0x174, 0) || _action.isAction(0x3, 0x175, 0)) { + } else if (_action.isAction(0x3, 0x174) || _action.isAction(0x3, 0x175)) { _vm->_dialogs->show(0x514D); - } else if (_action.isAction(0x4, 0x1A9, 0)) { + } else if (_action.isAction(0x4, 0x1A9)) { _vm->_dialogs->show(0x514E); - } else if (_action.isAction(0x3, 0x1A8, 0)) { + } else if (_action.isAction(0x3, 0x1A8)) { _vm->_dialogs->show(0x514F); - } else if (_action.isAction(0x4, 0x1A8, 0) || _action.isAction(0xA, 0x1A8, 0)) { + } else if (_action.isAction(0x4, 0x1A8) || _action.isAction(0xA, 0x1A8)) { _vm->_dialogs->show(0x5150); } else if (_action._savedFields._lookFlag == 0) { return; diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index 7ef50e1afd..40ccae62d7 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -63,7 +63,9 @@ public: class Scene202: public Scene2xx { private: - bool _activeMsgFl, _ladderTopFl, _waitingMeteorologistFl; + bool _activeMsgFl, _ladderTopFl, _waitingMeteoFl, _toStationFl, _toTeleportFl; + int _ladderHotspotId, _lastRoute, _stationCounter; + uint32 _meteoClock1, _meteoClock2, _startTime; int subStep1(int randVal); int subStep2(int randVal); @@ -71,7 +73,9 @@ private: int subStep4(int randVal); public: - Scene202(MADSEngine *vm) : Scene2xx(vm), _activeMsgFl(false), _ladderTopFl(false), _waitingMeteorologistFl(false) {} + Scene202(MADSEngine *vm) : Scene2xx(vm), _activeMsgFl(false), _ladderTopFl(false), _waitingMeteoFl(false), + _ladderHotspotId(-1), _meteoClock1(0), _meteoClock2(0), _toStationFl(false), _toTeleportFl(false), + _lastRoute(0), _stationCounter(0) {} virtual void setup(); virtual void enter(); virtual void step(); -- cgit v1.2.3 From 5abec8506bc1e6ad5617544b76bd2cc4f42dcc5b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 28 Mar 2014 23:23:46 +0100 Subject: MADS: Some work on scene 205 --- engines/mads/nebular/globals_nebular.cpp | 1 - engines/mads/nebular/globals_nebular.h | 2 +- engines/mads/nebular/nebular_scenes2.cpp | 52 +++++++++++++++++++++++++++----- engines/mads/nebular/nebular_scenes2.h | 4 ++- 4 files changed, 49 insertions(+), 10 deletions(-) diff --git a/engines/mads/nebular/globals_nebular.cpp b/engines/mads/nebular/globals_nebular.cpp index c0df8007d9..e2886ee293 100644 --- a/engines/mads/nebular/globals_nebular.cpp +++ b/engines/mads/nebular/globals_nebular.cpp @@ -52,7 +52,6 @@ Globals::Globals() { _v84264 = 0; _v84266 = 0; _v84268 = 0; - _v84274 = 0; } void Globals::reset() { diff --git a/engines/mads/nebular/globals_nebular.h b/engines/mads/nebular/globals_nebular.h index 703dc1b62a..eebbd8ed25 100644 --- a/engines/mads/nebular/globals_nebular.h +++ b/engines/mads/nebular/globals_nebular.h @@ -295,7 +295,7 @@ public: int _v8; int _abortVal; uint32 _v8425C; - int _v84260, _v84262, _v84264, _v84266, _v84268, _v84274; + int _v84260, _v84262, _v84264, _v84266, _v84268; public: /** * Constructor diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 4f404f6a6e..d6ce493017 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -1112,14 +1112,13 @@ void Scene205::enter() { _scene->_sequences.setDepth(_globals._spriteIndexes[20], 11); if (!_game._visitedScenes._sceneRevisited) { - _globals._v2 = _scene->_frameStartTime & 0xFFFF; - _globals._v3 = _scene->_frameStartTime >> 16; + _lastFishTime = _scene->_frameStartTime; _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 7, 1, 0, 0); idx = _scene->_dynamicHotspots.add(269, 13, _globals._spriteIndexes[21], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, 49, 86, FACING_NORTH); } - if (_game._objects[12]._roomNumber == 0) { + if (_game._objects[12]._roomNumber == 205) { _globals._spriteIndexes[19] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 7, 0, 0, 0); _scene->_sequences.setDepth(_globals._spriteIndexes[19], 11); } else { @@ -1140,8 +1139,7 @@ void Scene205::enter() { _vm->_palette->setEntry(252, 63, 63, 40); _vm->_palette->setEntry(253, 50, 50, 30); - _globals._v0 = _globals._frameTime & 0xFFFF; - _globals._frameTime >>= 16; + _chickenTime = _globals._frameTime; if (_globals[kSexOfRex] == SEX_FEMALE) warning("sub71704(0x3, 0xC3, 0x108, 0x63, 0x86, 0xD, 2, 0xFDFC, 0x3C, 0x6C, 0x6C, 0x6D, 0x6D, 0x6E, 0x6E, 0x6F, 0x6C, 0);"); @@ -1162,12 +1160,52 @@ void Scene205::enter() { _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_FRAME_INDEX, 11, 74); _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 0); } - _globals._v84274 = -1; sceneEntrySound(); } void Scene205::step() { - warning("TODO: Scene205::step"); + if (_globals[kSexOfRex] == SEX_FEMALE) { + warning("TODO: sub7178C()"); + + if (_globals._frameTime >= _chickenTime) { + warning("minVal = 1 + sub7176C();"); + int minVal = 1; + + warning("TODO: sub717B2(100, minVal);"); +// if (sub717B2(100, minVal)) { + _vm->_sound->command(28); +// } + _chickenTime = _globals._frameTime + 2; + } + } + + if (_globals._frameTime - _lastFishTime > 1300) { + _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 5, 1, 0, 0); + int idx = _scene->_dynamicHotspots.add(269, 13, _globals._spriteIndexes[21], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, 49, 86, FACING_NORTH); + _lastFishTime = _globals._frameTime; + } + + if (_game._trigger == 73) { + _scene->_kernelMessages.add(Common::Point(160, 68), 0xFBFA, 32, 0, 60, _game.getQuote(112)); + } + + if (_game._trigger == 74) { + _vm->_sound->command(26); + _scene->_kernelMessages.add(Common::Point(106, 90), 0x1110, 32, 0, 60, _game.getQuote(113)); + } + + if (_game._trigger == 71) { + _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 6, 0, 0, 0); + _scene->_sequences.setDepth(_globals._spriteIndexes[23], 2); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[23], -2, -2); + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(160, 68), 0xFBFA, 32, 72, 180, _game.getQuote(114)); + } + + if (_game._trigger == 72) { + _scene->_nextSceneId = 211; + } } void Scene205::actions() { diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index 40ccae62d7..143b24c22f 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -98,8 +98,10 @@ public: }; class Scene205: public Scene2xx { + uint32 _lastFishTime, _chickenTime; public: - Scene205(MADSEngine *vm) : Scene2xx(vm) {} + Scene205(MADSEngine *vm) : Scene2xx(vm), _lastFishTime(0), _chickenTime(0) {} + virtual void setup(); virtual void enter(); virtual void step(); -- cgit v1.2.3 From 49278129f6efffaa531ad29d32119d4ab83f3108 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 28 Mar 2014 20:23:25 -0400 Subject: MADS: Cleanup of Player::updateFrame --- engines/mads/assets.cpp | 4 ++-- engines/mads/assets.h | 4 ++-- engines/mads/game.cpp | 1 + engines/mads/player.cpp | 14 +++++++------- engines/mads/player.h | 3 +++ 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/engines/mads/assets.cpp b/engines/mads/assets.cpp index 9d022871d4..47b2763e44 100644 --- a/engines/mads/assets.cpp +++ b/engines/mads/assets.cpp @@ -218,9 +218,9 @@ SpriteSetCharInfo::SpriteSetCharInfo(Common::SeekableReadStream *s) { _numEntries = s->readUint16LE(); for (int i = 0; i < 16; ++i) - _frameList[i] = s->readUint16LE(); + _startFrames[i] = s->readUint16LE(); for (int i = 0; i < 16; ++i) - _frameList2[i] = s->readUint16LE(); + _stopFrames[i] = s->readUint16LE(); for (int i = 0; i < 16; ++i) _ticksList[i] = s->readUint16LE(); diff --git a/engines/mads/assets.h b/engines/mads/assets.h index b5b351242d..54417f84ff 100644 --- a/engines/mads/assets.h +++ b/engines/mads/assets.h @@ -48,8 +48,8 @@ public: int _totalFrames; int _numEntries; - int _frameList2[16]; - int _frameList[16]; + int _startFrames[16]; + int _stopFrames[16]; int _ticksList[16]; int _velocity; int _ticksAmount; diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 28a1d1d4ea..3b22e37e9b 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -237,6 +237,7 @@ void Game::sectionLoop() { _player._targetFacing = _player._facing; _player.selectSeries(); _player.updateFrame(); + _player._visible3 = _player._visible; _player._special = _scene.getDepthHighBits(_player._playerPos); _player._priorTimer = _scene._frameStartTime - _player._ticksAmount; diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index f569e7ee2c..d1759d84f9 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -235,15 +235,15 @@ void Player::updateFrame() { } // Set the player frame number - int frameIndex = ABS(_frameListIndex); - _frameNumber = (_frameListIndex <= 0) ? spriteSet._charInfo->_frameList[frameIndex] : - spriteSet._charInfo->_frameList2[frameIndex]; + int listIndex = ABS(_frameListIndex); + _frameNumber = (_frameListIndex >= 0) ? spriteSet._charInfo->_startFrames[listIndex] : + spriteSet._charInfo->_stopFrames[listIndex]; // Set next waiting period in ticks - if (frameIndex == 0) { + if (listIndex == 0) { setBaseFrameRate(); } else { - _ticksAmount = spriteSet._charInfo->_ticksList[frameIndex]; + _ticksAmount = spriteSet._charInfo->_ticksList[listIndex]; } } @@ -521,11 +521,11 @@ void Player::idle() { _frameNumber += direction; _forceRefresh = true; - if (spriteSet._charInfo->_frameList2[frameIndex] < _frameNumber) { + if (spriteSet._charInfo->_stopFrames[frameIndex] < _frameNumber) { _trigger = _upcomingTrigger; updateFrame(); } - if (spriteSet._charInfo->_frameList[frameIndex] < _frameNumber) { + if (spriteSet._charInfo->_startFrames[frameIndex] < _frameNumber) { _trigger = _upcomingTrigger; updateFrame(); } diff --git a/engines/mads/player.h b/engines/mads/player.h index 71f3406f18..eee1cee67f 100644 --- a/engines/mads/player.h +++ b/engines/mads/player.h @@ -172,6 +172,9 @@ public: * direction which the player is facing in) */ void selectSeries(); + /* + * Moves to the next frame for the currently active player sprite set + */ void updateFrame(); void update(); -- cgit v1.2.3 From 05459ac27f7a4838e6a81e569e6d0d075226780b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 28 Mar 2014 22:02:35 -0400 Subject: MADS: Clean up of Player::move method --- engines/mads/game.cpp | 2 +- engines/mads/nebular/nebular_scenes2.cpp | 15 ++--- engines/mads/player.cpp | 112 +++++++++++++++---------------- engines/mads/player.h | 20 +++--- 4 files changed, 74 insertions(+), 75 deletions(-) diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 3b22e37e9b..a1ca02cbf4 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -232,7 +232,7 @@ void Game::sectionLoop() { _scene._sceneLogic->enter(); // Set player data - _player._destPos = _player._playerPos; + _player._targetPos = _player._playerPos; _player._turnToFacing = _player._facing; _player._targetFacing = _player._facing; _player.selectSeries(); diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index d6ce493017..96347ea226 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -53,10 +53,7 @@ void Scene2xx::setPlayerSpritesPrefix() { break; } - if (_scene->_nextSceneId > 212) - _game._player._unk4 = false; - else - _game._player._unk4 = true; + _game._player._scalingVelocity = (_scene->_nextSceneId <= 212); if (oldName != _game._player._spritesPrefix) _game._player._spritesChanged = true; @@ -1050,7 +1047,7 @@ void Scene203::preActions() { } if (_action.isAction(0xD, 0xF3)) - _game._player._v844BE = 209; + _game._player._walkOffScreenSceneId = 209; } void Scene203::actions() { @@ -1315,10 +1312,10 @@ void Scene207::step() { void Scene207::preActions() { if (_action.isAction(0x1AD, 0x1AE)) - _game._player._v844BE = 211; + _game._player._walkOffScreenSceneId = 211; if (_action.isAction(0x18C, 0x1AB)) - _game._player._v844BE = 208; + _game._player._walkOffScreenSceneId = 208; if ((_action.isAction(0xD)) || (_action.isAction(0x3))) { if (_action.isAction(0x185)) { @@ -1483,10 +1480,10 @@ void Scene208::preActions() { _action._startWalkFlag = true; if (_action.isAction(0x18C, 0x9B)) - _game._player._v844BE = 209; + _game._player._walkOffScreenSceneId = 209; if (_action.isAction(0x18C, 0xF6)) - _game._player._v844BE = 207; + _game._player._walkOffScreenSceneId = 207; } void Scene208::actions() { diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index d1759d84f9..fe92f876d3 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -52,7 +52,8 @@ Player::Player(MADSEngine *vm): _vm(vm) { _special = 0; _ticksAmount = 0; _priorTimer = 0; - _trigger = _unk4 = 0; + _trigger = 0; + _scalingVelocity = false; _spritesChanged = false; _forceRefresh = false; _highSprites = false; @@ -66,7 +67,7 @@ Player::Player(MADSEngine *vm): _vm(vm) { _trigger = 0; _frameListIndex = 0; _stopWalkerIndex = 0; - _hypotenuse = 0; + _totalDistance = 0; Common::fill(&_stopWalkerList[0], &_stopWalkerList[12], 0); Common::fill(&_stopWalkerTrigger[0], &_stopWalkerTrigger[12], 0); @@ -75,11 +76,11 @@ Player::Player(MADSEngine *vm): _vm(vm) { void Player::cancelWalk() { _action = &_vm->_game->_scene._action; - _destPos = _playerPos; + _targetPos = _playerPos; _targetFacing = FACING_NONE; _turnToFacing = _facing; _moving = false; - _newSceneId = _v844BE = 0; + _walkOffScreen = _walkOffScreenSceneId = 0; _next = 0; _routeCount = 0; _walkAnywhere = false; @@ -140,7 +141,7 @@ void Player::setFinalFacing() { _turnToFacing = _targetFacing; } -void Player::dirChanged() { +void Player::changeFacing() { int dirIndex = 0, dirIndex2 = 0; int newDir = 0, newDir2 = 0; @@ -308,7 +309,7 @@ void Player::update() { // If changing a scene, check to change the scene when the player // has moved off-screen - if (_newSceneId) { + if (_walkOffScreen) { SpriteAsset *asset = scene._sprites[slot._spritesIndex]; MSprite *frame = asset->getFrame(_frameNumber - 1); int xScale = frame->w * newScale / 200; @@ -318,8 +319,8 @@ void Player::update() { if ((playerX + xScale) < 0 || (playerX + xScale) >= MADS_SCREEN_WIDTH || playerY < 0 || (playerY + yScale) >= MADS_SCENE_HEIGHT) { - scene._nextSceneId = _newSceneId; - _newSceneId = 0; + scene._nextSceneId = _walkOffScreen; + _walkOffScreen = 0; _walkAnywhere = false; } } @@ -398,31 +399,29 @@ void Player::nextFrame() { void Player::move() { Scene &scene = _vm->_game->_scene; - bool routeFlag = false; + bool newFacing = false; if (_moving) { int idx = _routeCount; - while (!_newSceneId && (_destPos.x == _playerPos.x) && (_destPos.y == _playerPos.y)) { + while (!_walkOffScreen && _playerPos == _targetPos) { if (idx != 0) { --idx; SceneNode &node = scene._sceneInfo->_nodes[_routeIndexes[idx]]; - _destPos = node._walkPos; - routeFlag = true; - } - else if (_v844BE == idx) { + _targetPos = node._walkPos; + newFacing = true; + } else if (_walkOffScreenSceneId == idx) { // End of walking path _routeCount = 0; _moving = false; setFinalFacing(); - routeFlag = true; + newFacing = true; idx = _routeCount; - } - else { - _newSceneId = _v844BE; - _v844BC = true; - _v844BE = 0; + } else { + _walkOffScreen = _walkOffScreenSceneId; + _walkAnywhere = true; + _walkOffScreenSceneId = 0; _stepEnabled = true; - routeFlag = false; + newFacing = false; } if (!_moving) @@ -431,18 +430,19 @@ void Player::move() { _routeCount = idx; } - if (routeFlag && _moving) + if (newFacing && _moving) startMovement(); if (_turnToFacing != _facing) - dirChanged(); + changeFacing(); else if (!_moving) updateFrame(); int velocity = _velocity; - if (_unk4 && (_hypotenuse > 0)) { - int v1 = -(_currentScale - 100) * (_posDiff.x - 1) / _hypotenuse + _currentScale; - velocity = MAX(1, 10000 / (v1 * _currentScale * velocity)); + if (_scalingVelocity && (_totalDistance > 0)) { + int angleRange = 100 - _currentScale; + int angleScale = angleRange * (_posDiff.x - 1) / _totalDistance + _currentScale; + velocity = MAX(1, 10000 / (angleScale * _currentScale * velocity)); } if (!_moving || (_facing != _turnToFacing)) @@ -450,46 +450,46 @@ void Player::move() { Common::Point newPos = _playerPos; - if (_v8452E < velocity) { + if (_distAccum < velocity) { do { - if (_v8452C < _posDiff.x) - _v8452C += _posDiff.y; - if (_v8452C >= _posDiff.x) { - if ((_posChange.y > 0) || (_newSceneId != 0)) + if (_pixelAccum < _posDiff.x) + _pixelAccum += _posDiff.y; + if (_pixelAccum >= _posDiff.x) { + if ((_posChange.y > 0) || (_walkOffScreen != 0)) newPos.y += _yDirection; --_posChange.y; - _v8452C -= _posDiff.x; + _pixelAccum -= _posDiff.x; } - if (_v8452C < _posDiff.x) { - if ((_posChange.x > 0) || (_newSceneId != 0)) + if (_pixelAccum < _posDiff.x) { + if ((_posChange.x > 0) || (_walkOffScreen != 0)) newPos.x += _xDirection; --_posChange.x; } - if ((_v844BC == 0) && (_newSceneId == 0) && (_v844BE == 0)) { - routeFlag = scene._depthSurface.getDepthHighBit(newPos); + if (!_walkAnywhere && !_walkOffScreen && (_walkOffScreenSceneId == 0)) { + newFacing = scene._depthSurface.getDepthHighBit(newPos); if (_special == 0) _special = scene.getDepthHighBits(newPos); } - _v8452E += _v84530; + _distAccum += _deltaDistance; - } while ((_v8452E < velocity) && !routeFlag && ((_posChange.x > 0) || (_posChange.y > 0) || (_newSceneId != 0))); + } while ((_distAccum < velocity) && !newFacing && ((_posChange.x > 0) || (_posChange.y > 0) || (_walkOffScreen != 0))); } - _v8452E -= velocity; + _distAccum -= velocity; - if (routeFlag) + if (newFacing) { cancelCommand(); - else { - if (!_newSceneId) { + } else { + if (!_walkOffScreen) { // If the move is complete, make sure the position is exactly on the given destination if (_posChange.x == 0) - newPos.x = _destPos.x; + newPos.x = _targetPos.x; if (_posChange.y == 0) - newPos.y = _destPos.y; + newPos.y = _targetPos.y; } _playerPos = newPos; @@ -501,7 +501,7 @@ void Player::idle() { if (_facing != _turnToFacing) { // The direction has changed, so reset for new direction - dirChanged(); + changeFacing(); return; } @@ -675,10 +675,10 @@ int Player::scanPath(MSurface &depthSurface, const Common::Point &srcPos, const } void Player::startMovement() { - int xDiff = _destPos.x - _playerPos.x; - int yDiff = _destPos.y - _playerPos.y; + int xDiff = _targetPos.x - _playerPos.x; + int yDiff = _targetPos.y - _playerPos.y; int srcScale = getScale(_playerPos.y); - int destScale = getScale(_destPos.y); + int destScale = getScale(_targetPos.y); // Sets the X direction if (xDiff > 0) @@ -704,7 +704,7 @@ void Player::startMovement() { int yAmt100 = yDiff * 100; int xAmt33 = xDiff * 33; - int scaleAmount = (_unk4 ? scaleDiff * 3 : 0) + 100 * yDiff / 100; + int scaleAmount = (_scalingVelocity ? scaleDiff * 3 : 0) + 100 * yDiff / 100; int scaleAmount100 = scaleAmount * 100; // Figure out direction that will need to be moved in @@ -739,22 +739,22 @@ void Player::startMovement() { break; } - _hypotenuse = sqrt((double)(xAmt100 * xAmt100 + yAmt100 * yAmt100)); + _totalDistance = sqrt((double)(xAmt100 * xAmt100 + yAmt100 * yAmt100)); _posDiff.x = xDiff + 1; _posDiff.y = yDiff + 1; _posChange.x = xDiff; _posChange.y = yDiff; int majorChange = MAX(xDiff, yDiff); - _v84530 = (majorChange == 0) ? 0 : _hypotenuse / majorChange; + _deltaDistance = (majorChange == 0) ? 0 : _totalDistance / majorChange; - if (_playerPos.x > _destPos.x) - _v8452C = MAX(_posChange.x, _posChange.y); + if (_playerPos.x > _targetPos.x) + _pixelAccum = MAX(_posChange.x, _posChange.y); else - _v8452C = 0; + _pixelAccum = 0; - _hypotenuse /= 100; - _v8452E = -_v84530; + _totalDistance /= 100; + _distAccum = -_deltaDistance; } void Player::step() { diff --git a/engines/mads/player.h b/engines/mads/player.h index eee1cee67f..6500806f1f 100644 --- a/engines/mads/player.h +++ b/engines/mads/player.h @@ -54,18 +54,20 @@ private: bool _mirror; int _frameCount; int _frameListIndex; - bool _v844BC; - int _v8452E; - int _v8452C; - int _v84530; + int _distAccum; + int _pixelAccum; + int _deltaDistance; int _routeLength; int _stopWalkerList[12]; int _stopWalkerTrigger[12]; int _stopWalkerIndex; - int _hypotenuse; + int _totalDistance; void clearStopList(); + /** + * If the player is moving, handles figuring out the correct motion + */ void move(); void postUpdate(); @@ -99,7 +101,7 @@ private: */ void startMovement(); - void dirChanged(); + void changeFacing(); public: MADSAction *_action; @@ -121,11 +123,11 @@ public: bool _loadsFirst; bool _loadedFirst; Common::Point _playerPos; - Common::Point _destPos; + Common::Point _targetPos; Common::Point _posChange; Common::Point _posDiff; bool _moving; - int _newSceneId, _v844BE; + int _walkOffScreen, _walkOffScreenSceneId; int _next; int _special; int _ticksAmount; @@ -133,7 +135,7 @@ public: int _velocity; int _upcomingTrigger; int _trigger; - bool _unk4; + bool _scalingVelocity; bool _forceRefresh; int _centerOfGravity; int _currentDepth; -- cgit v1.2.3 From fac216be332ac1540d5ddcf0cffcc7ccf34c4a81 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 28 Mar 2014 23:07:22 -0400 Subject: MADS: Cleanup of Scene::checkStartWalk to become Player::newWalk --- engines/mads/action.cpp | 30 ++++++++++++------------- engines/mads/action.h | 2 -- engines/mads/nebular/nebular_scenes2.cpp | 38 ++++++++++++++++++-------------- engines/mads/player.cpp | 34 ++++++++++++++++++---------- engines/mads/player.h | 35 ++++++++++++++++++++++++++--- engines/mads/scene.cpp | 16 ++++---------- engines/mads/scene.h | 4 ---- 7 files changed, 94 insertions(+), 65 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index e997261938..fe90305c9d 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -31,7 +31,6 @@ namespace MADS { MADSAction::MADSAction(MADSEngine *vm) : _vm(vm) { clear(); - _startWalkFlag = false; _statusTextIndex = -1; _selectedAction = 0; _inProgress = false; @@ -63,7 +62,6 @@ void MADSAction::clear() { _action._objectNameId = -1; _action._indirectObjectId = -1; _textChanged = true; - _walkFlag = false; } void MADSAction::appendVocab(int vocabId, bool capitalise) { @@ -77,10 +75,11 @@ void MADSAction::appendVocab(int vocabId, bool capitalise) { void MADSAction::checkCustomDest(int v) { Scene &scene = _vm->_game->_scene; + Player &player = _vm->_game->_player; if (_v86F4A && (v == -3 || _savedFields._selectedRow < 0)) { - _startWalkFlag = true; - scene._destPos = scene._customDest; + _vm->_game->_player._needToWalk = true; + player._prepareWalkPos = scene._customDest; } } @@ -265,11 +264,12 @@ void MADSAction::refresh() { void MADSAction::startAction() { Game &game = *_vm->_game; + Player &player = game._player; Scene &scene = _vm->_game->_scene; DynamicHotspots &dynHotspots = scene._dynamicHotspots; Hotspots &hotspots = scene._hotspots; - game._player.cancelCommand(); + player.cancelCommand(); _inProgress = true; _v8453A = ABORTMODE_0; @@ -290,7 +290,7 @@ void MADSAction::startAction() { if ((_actionMode2 == ACTIONMODE2_4) && (_v86F42 == 0)) _v8453A = -1; - _startWalkFlag = false; + player._needToWalk = false; int hotspotId = -1; if (!_savedFields._lookFlag && (_vm->_game->_screenObjects._v832EC != 1)) { @@ -304,13 +304,13 @@ void MADSAction::startAction() { if ((hs._feetPos.x == -1) || (hs._feetPos.x == -3)) { checkCustomDest(hs._feetPos.x); } else if (hs._feetPos.x == 0) { - scene._targetFacing = hs._facing; + player._prepareWalkFacing = hs._facing; } else if (_savedFields._actionMode == ACTIONMODE_NONE || hs._cursor >= CURSOR_WAIT) { - _startWalkFlag = true; - scene._destPos = hs._feetPos; + player._needToWalk = true; + player._prepareWalkPos = hs._feetPos; } - scene._targetFacing = hs._facing; + player._prepareWalkFacing = hs._facing; hotspotId = -1; } } @@ -322,20 +322,20 @@ void MADSAction::startAction() { checkCustomDest(hs._feetPos.x); } else if (hs._feetPos.x >= 0) { if (_savedFields._actionMode == ACTIONMODE_NONE || hs._cursor < CURSOR_WAIT) { - _startWalkFlag = true; - scene._destPos = hs._feetPos; + player._needToWalk = true; + player._prepareWalkPos = hs._feetPos; } } - scene._targetFacing = hs._facing; + player._prepareWalkFacing = hs._facing; } - _walkFlag = _startWalkFlag; + player._readyToWalk = player._needToWalk; } void MADSAction::checkAction() { if (isAction(VERB_LOOK) || isAction(VERB_THROW)) - _startWalkFlag = 0; + _vm->_game->_player._needToWalk = false; } bool MADSAction::isAction(int verbId, int objectNameId, int indirectObjectId) { diff --git a/engines/mads/action.h b/engines/mads/action.h index 74de167a4e..a517a65d0e 100644 --- a/engines/mads/action.h +++ b/engines/mads/action.h @@ -94,10 +94,8 @@ public: int _selectedRow; bool _textChanged; int _selectedAction; - bool _startWalkFlag; int _statusTextIndex; int _hotspotId; - bool _walkFlag; ActionSavedFields _savedFields; // Unknown fields diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 96347ea226..d90aa93b20 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -192,7 +192,7 @@ void Scene201::enter() { _scene->_sequences.addSubEntry(_globals._spriteIndexes[21], SM_FRAME_INDEX, 12, 70); _scene->_sequences.setDepth(_globals._spriteIndexes[21], 1); _pterodactylFlag = false; - _game._player.startWalking(Common::Point(157, 143), FACING_NORTH); + _game._player.walk(Common::Point(157, 143), FACING_NORTH); _vm->_palette->setEntry(252, 45, 63, 45); _vm->_palette->setEntry(253, 20, 45, 20); _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 2, 0, 120, _game.getQuote(90)); @@ -707,14 +707,16 @@ int Scene202::subStep4(int randVal) { } void Scene202::preActions() { - MADSAction *action = _game._player._action; - if (action->_walkFlag) + Player &player = _vm->_game->_player; + MADSAction *action = player._action; + + if (player._readyToWalk) _scene->_kernelMessages.reset(); - if (!_ladderTopFl && (action->isAction(0x4E, 0xC7) || !action->_walkFlag)) { + if (!_ladderTopFl && (action->isAction(0x4E, 0xC7) || !player._readyToWalk)) { if (_game._trigger == 0) { _vm->_sound->command(29); - action->_walkFlag = false; + player._readyToWalk = false; _game._player._stepEnabled = false; _scene->_sequences.remove(_globals._spriteIndexes[24]); _globals._spriteIndexes[23] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[8], false, 6, 1, 0, 0); @@ -724,20 +726,20 @@ void Scene202::preActions() { _scene->_sequences.updateTimeout(-1, _globals._spriteIndexes[23]); _scene->_dynamicHotspots.remove(_ladderHotspotId); _game._player._visible = true; - action->_walkFlag = true; + player._readyToWalk = true; _game._player._stepEnabled = true; _ladderTopFl = false; } } if (action->isAction(0x3, 0x27) && action->_activeAction._indirectObjectId > 0) { - if (!action->_walkFlag || _ladderTopFl) - action->_startWalkFlag = false; + if (!player._readyToWalk || _ladderTopFl) + _game._player._needToWalk = false; else - action->_startWalkFlag = true; + _game._player._needToWalk = true; if (!_ladderTopFl) - _game._player.startWalking(Common::Point(171, 122), FACING_NORTH); + _game._player.walk(Common::Point(171, 122), FACING_NORTH); } } @@ -988,7 +990,7 @@ void Scene203::enter() { if ((_globals[kRhotundaStatus] == 0) && (_scene->_roomChanged == 0)) { _globals._v0 = -1; - _game._player.startWalking(Common::Point(158, 135), FACING_SOUTH); + _game._player.walk(Common::Point(158, 135), FACING_SOUTH); int idx = _scene->_dynamicHotspots.add(131, 396, 0, Common::Rect(0, 0, 320, 156)); _scene->_dynamicHotspots.setPosition(idx, 155, 152, FACING_SOUTH); _scene->_dynamicHotspots.setCursor(idx, CURSOR_GO_DOWN); @@ -1041,7 +1043,7 @@ void Scene203::step() { void Scene203::preActions() { if (_globals._v0 && !_action.isAction(0x18C, 0x83)) { - _game._player.startWalking(Common::Point(158, 136), FACING_SOUTH); + _game._player.walk(Common::Point(158, 136), FACING_SOUTH); _action._inProgress = false; return; } @@ -1476,14 +1478,16 @@ void Scene208::step() { } void Scene208::preActions() { - if (_action.isAction(3) && _action._walkFlag) - _action._startWalkFlag = true; + Player &player = _vm->_game->_player; + + if (_action.isAction(3) && player._readyToWalk) + player._needToWalk = true; if (_action.isAction(0x18C, 0x9B)) - _game._player._walkOffScreenSceneId = 209; + player._walkOffScreenSceneId = 209; if (_action.isAction(0x18C, 0xF6)) - _game._player._walkOffScreenSceneId = 207; + player._walkOffScreenSceneId = 207; } void Scene208::actions() { @@ -1510,7 +1514,7 @@ void Scene208::actions() { if (_game._player._stepEnabled) { _game._player._stepEnabled = false; _globals._v0 = true; - _game._player.startWalking(Common::Point(20, 148), FACING_EAST); + _game._player.walk(Common::Point(20, 148), FACING_EAST); } } else if (_action.isAction(0x7, 0x35, 0x1A9)) { warning("TODO: sub3B282(4);"); diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index fe92f876d3..57726e7bef 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -37,6 +37,7 @@ Player::Player(MADSEngine *vm): _vm(vm) { _facing = FACING_NORTH; _turnToFacing = FACING_NORTH; _targetFacing = FACING_NORTH; + _prepareWalkFacing = FACING_NONE; _mirror = false; _spritesLoaded = false; _spritesStart = 0; @@ -45,6 +46,8 @@ Player::Player(MADSEngine *vm): _vm(vm) { _stepEnabled = false; _visible = false; _priorVisible = false; + _needToWalk = false; + _readyToWalk = false; _visible3 = false; _loadsFirst = false; _loadedFirst = false; @@ -85,8 +88,8 @@ void Player::cancelWalk() { _routeCount = 0; _walkAnywhere = false; - _action->_startWalkFlag = false; - _action->_walkFlag = false; + _needToWalk = false; + _readyToWalk = false; } bool Player::loadSprites(const Common::String &prefix) { @@ -341,7 +344,7 @@ void Player::clearStopList() { _trigger = 0; } -void Player::setDest(const Common::Point &pt, Facing facing) { +void Player::startWalking(const Common::Point &pt, Facing facing) { Scene &scene = _vm->_game->_scene; clearStopList(); @@ -370,14 +373,14 @@ void Player::setDest(const Common::Point &pt, Facing facing) { } } -void Player::startWalking(const Common::Point &pos, Facing direction) { +void Player::walk(const Common::Point &pos, Facing facing) { Scene &scene = _vm->_game->_scene; cancelWalk(); - scene._action._startWalkFlag = true; - scene._action._walkFlag = true; - scene._destPos = pos; - scene._targetFacing = direction; + _needToWalk = true; + _readyToWalk = true; + _prepareWalkPos = pos; + _prepareWalkFacing = facing; } void Player::nextFrame() { @@ -392,7 +395,7 @@ void Player::nextFrame() { idle(); } - postUpdate(); + setFrame(); update(); } } @@ -514,10 +517,10 @@ void Player::idle() { int frameIndex = ABS(_frameListIndex); int direction = (_frameListIndex < 0) ? -1 : 1; - if (frameIndex >= spriteSet._charInfo->_numEntries) + if (frameIndex >= spriteSet._charInfo->_numEntries) { // Reset back to the start of the list _frameListIndex = 0; - else { + } else { _frameNumber += direction; _forceRefresh = true; @@ -532,7 +535,7 @@ void Player::idle() { } } -void Player::postUpdate() { +void Player::setFrame() { if (_moving) { if (++_frameNumber > _frameCount) _frameNumber = 1; @@ -757,6 +760,13 @@ void Player::startMovement() { _distAccum = -_deltaDistance; } +void Player::newWalk() { + if (_needToWalk && _readyToWalk) { + startWalking(_prepareWalkPos, _prepareWalkFacing); + _needToWalk = false; + } +} + void Player::step() { warning("TODO: Player::step"); } diff --git a/engines/mads/player.h b/engines/mads/player.h index 6500806f1f..2a9274840c 100644 --- a/engines/mads/player.h +++ b/engines/mads/player.h @@ -70,7 +70,10 @@ private: */ void move(); - void postUpdate(); + /** + * Update the player's frame number + */ + void setFrame(); /** * Get the sprite slot index for the player @@ -82,6 +85,9 @@ private: */ int getScale(int yp); + /** + * Sets the frame rate for the current sprite set + */ void setBaseFrameRate(); void setupRoute(); @@ -107,6 +113,7 @@ public: Facing _facing; Facing _turnToFacing; + Facing _prepareWalkFacing; int _xDirection, _yDirection; Facing _targetFacing; bool _spritesLoaded; @@ -126,6 +133,7 @@ public: Common::Point _targetPos; Common::Point _posChange; Common::Point _posDiff; + Common::Point _prepareWalkPos; bool _moving; int _walkOffScreen, _walkOffScreenSceneId; int _next; @@ -137,6 +145,8 @@ public: int _trigger; bool _scalingVelocity; bool _forceRefresh; + bool _needToWalk; + bool _readyToWalk; int _centerOfGravity; int _currentDepth; int _currentScale; @@ -181,11 +191,30 @@ public: void update(); + /** + * Handler method for when the player is not moving + */ void idle(); - void setDest(const Common::Point &pt, Facing facing); + /** + * Starts the player walking towards a given point and direction facing + * @param pos Destination location + * @param facing Direction to face once the destination is reached + */ + void startWalking(const Common::Point &pt, Facing facing); + + /** + * Used by the game scripst to make the player walk to a given destination. + * The difference from startWalking is that this contains several extra + * layers of checking that startWalking bypasses. + */ + void walk(const Common::Point &pos, Facing facing); - void startWalking(const Common::Point &pos, Facing direction); + /** + * If a new walk sequence is pending, and has been okayed by the preparser, + * start the actual walking + */ + void newWalk(); void nextFrame(); diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 62702518fc..2e788115db 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -42,7 +42,6 @@ Scene::Scene(MADSEngine *vm): _vm(vm), _action(_vm), _depthSurface(vm), _depthStyle = 0; _roomChanged = false; _reloadSceneFlag = false; - _targetFacing = FACING_NONE; _freeAnimationFlag = false; _animationData = nullptr; _activeAnimation = nullptr; @@ -296,11 +295,11 @@ void Scene::doFrame() { _dynamicHotspots.refresh(); // Check all on-screen visual objects - _vm->_game->_screenObjects.check(player._stepEnabled && !_action._startWalkFlag && + _vm->_game->_screenObjects.check(player._stepEnabled && !player._needToWalk && !_vm->_game->_fx); } - if (_action._selectedAction && player._stepEnabled && !_action._startWalkFlag && + if (_action._selectedAction && player._stepEnabled && !player._needToWalk && !_vm->_game->_trigger && !player._trigger) { _action.startAction(); if (_action._activeAction._verbId == Nebular::NOUN_LOOK_AT) { @@ -315,11 +314,11 @@ void Scene::doFrame() { doPreactions(); } - checkStartWalk(); + player.newWalk(); if (!_vm->_game->_fx) _frameStartTime = _vm->_events->getFrameCounter(); - if ((_action._inProgress && !player._moving && !_action._startWalkFlag && + if ((_action._inProgress && !player._moving && !player._needToWalk && player._turnToFacing == player._facing) || (_vm->_game->_trigger && _vm->_game->_abortTimersMode == ABORTMODE_0)) { doAction(); @@ -499,13 +498,6 @@ void Scene::doAction() { _vm->_game->_trigger = 0; } -void Scene::checkStartWalk() { - if (_action._startWalkFlag && _action._walkFlag) { - _vm->_game->_player.setDest(_destPos, _targetFacing); - _action._startWalkFlag = false; - } -} - void Scene::doSceneStep() { _vm->_game->_abortTimersMode2 = ABORTMODE_1; _sceneLogic->step(); diff --git a/engines/mads/scene.h b/engines/mads/scene.h index ee1a0c7853..0af5fa6575 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -65,8 +65,6 @@ private: void doAction(); - void checkStartWalk(); - void doSceneStep(); void checkKeyboard(); @@ -118,8 +116,6 @@ public: MADSAction _action; bool _roomChanged; bool _reloadSceneFlag; - Common::Point _destPos; - Facing _targetFacing; Common::Point _posAdjust; uint32 _frameStartTime; Layer _layer; -- cgit v1.2.3 From f983add480db83a47ccdf2a860d5c9c1fbc664a2 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 29 Mar 2014 08:44:17 +0100 Subject: MADS: Replace some magic values by enums --- engines/mads/nebular/nebular_scenes1.cpp | 4 +- engines/mads/nebular/nebular_scenes2.cpp | 142 +++++++++++++++---------------- 2 files changed, 73 insertions(+), 73 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 48e9b4bd3f..51a2d9586e 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -440,11 +440,11 @@ void Scene103::actions() { } void Scene103::postActions() { - if (_action.isAction(27) && !_action.isAction(13)) { + if (_action.isAction(27) && !_action.isAction(VERB_WALKTO)) { _vm->_dialogs->show(0x2841); _action._inProgress = false; } else { - if (_action.isAction(7, 85, 144)) { + if (_action.isAction(VERB_PUT, 85, 144)) { Common::String msg = _game.getQuote(73); _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, msg); diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index d90aa93b20..2f81b780fe 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -293,30 +293,30 @@ void Scene201::actions() { } else if (_game._trigger == 1) { _scene->_nextSceneId = 213; } - } else if (action->isAction(0x3, 0x1A6)) { + } else if (action->isAction(VERB_LOOK, 0x1A6)) { _vm->_dialogs->show(0x4E85); - } else if (action->isAction(0x3, 0x129)) { + } else if (action->isAction(VERB_LOOK, 0x129)) { _vm->_dialogs->show(0x4E86); - } else if (action->isAction(0x3, 0x16F)) { + } else if (action->isAction(VERB_LOOK, 0x16F)) { _vm->_dialogs->show(0x4E87); - } else if (action->isAction(0x3, 0x142)) { + } else if (action->isAction(VERB_LOOK, 0x142)) { _vm->_dialogs->show(0x4E88); - } else if (action->isAction(0x3, 0x18F)) { + } else if (action->isAction(VERB_LOOK, 0x18F)) { _vm->_dialogs->show(0x4E89); - } else if (action->isAction(0x3, 0x1B9)) { + } else if (action->isAction(VERB_LOOK, 0x1B9)) { _vm->_dialogs->show(0x4E8A); - } else if (action->isAction(0x3, 0x192)) { + } else if (action->isAction(VERB_LOOK, 0x192)) { _vm->_dialogs->show(0x4E8B); - } else if (action->isAction(0x3, 0x1BA)) { + } else if (action->isAction(VERB_LOOK, 0x1BA)) { _vm->_dialogs->show(0x4E8C); - } else if (action->isAction(0x3, 0x83)) { + } else if (action->isAction(VERB_LOOK, 0x83)) { _vm->_dialogs->show(0x4E8E); - } else if (action->isAction(0x3, 0x1B6)) { + } else if (action->isAction(VERB_LOOK, 0x1B6)) { if (_globals[kMeteorologistEverSeen]) _vm->_dialogs->show(0x4E90); else _vm->_dialogs->show(0x4E8D); - } else if (action->isAction(0x3, 0x16C)) { + } else if (action->isAction(VERB_LOOK, 0x16C)) { _vm->_dialogs->show(0x4E91); } else return; @@ -732,7 +732,7 @@ void Scene202::preActions() { } } - if (action->isAction(0x3, 0x27) && action->_activeAction._indirectObjectId > 0) { + if (action->isAction(VERB_LOOK, 0x27) && action->_activeAction._indirectObjectId > 0) { if (!player._readyToWalk || _ladderTopFl) _game._player._needToWalk = false; else @@ -759,7 +759,7 @@ void Scene202::actions() { _globals[kMeteorologistStatus] = 0; } _scene->_nextSceneId = 201; - } else if (action->isAction(0x4, 0x2C)) { + } else if (action->isAction(VERB_TAKE, 0x2C)) { if (action->_actionMode2 == 4) { if (_game._trigger == 0) { if (_game._objects.isInInventory(OBJ_BONES)) { @@ -822,7 +822,7 @@ void Scene202::actions() { action->_inProgress = false; return; } - } else if (((action->isAction(0x3, 0x27, 0x82)) || (action->isAction(0x3, 0x27, 0x1B6))) && (_globals[kSexOfRex] == SEX_MALE)) { + } else if (((action->isAction(VERB_LOOK, 0x27, 0x82)) || (action->isAction(VERB_LOOK, 0x27, 0x1B6))) && (_globals[kSexOfRex] == SEX_MALE)) { if (!_ladderTopFl) { if (_game._trigger == 0) { _game._player._stepEnabled = false; @@ -913,13 +913,13 @@ void Scene202::actions() { } } else if (action->isAction(0x188, 0xAA)) { setRandomKernelMessage(); - } else if (action->isAction(0x3, 0x129)) { + } else if (action->isAction(VERB_LOOK, 0x129)) { _vm->_dialogs->show(0x4EEA); - } else if (action->isAction(0x3, 0x86)) { + } else if (action->isAction(VERB_LOOK, 0x86)) { _vm->_dialogs->show(0x4EEB); - } else if (action->isAction(0x3, 0x19C)) { + } else if (action->isAction(VERB_LOOK, 0x19C)) { _vm->_dialogs->show(0x4EEC); - } else if (action->isAction(0x3, 0x82)) { + } else if (action->isAction(VERB_LOOK, 0x82)) { if ((_globals[kMeteorologistStatus] == 0) || (_globals[kMeteorologistStatus] == 2)) { _vm->_dialogs->show(0x4EED); } else if (_globals[kMeteorologistStatus] == 1) { @@ -928,30 +928,30 @@ void Scene202::actions() { action->_inProgress = false; return; } - } else if (action->isAction(0x3, 0x18E)) { + } else if (action->isAction(VERB_LOOK, 0x18E)) { _vm->_dialogs->show(0x4EEE); - } else if (action->isAction(0x3, 0x164)) { + } else if (action->isAction(VERB_LOOK, 0x164)) { _vm->_dialogs->show(0x4EEF); - } else if (action->isAction(0x3, 0x175)) { + } else if (action->isAction(VERB_LOOK, 0x175)) { _vm->_dialogs->show(0x4EF0); - } else if (action->isAction(0x3, 0x174)) { + } else if (action->isAction(VERB_LOOK, 0x174)) { _vm->_dialogs->show(0x4EF1); - } else if (action->isAction(0x3, 0x142)) { + } else if (action->isAction(VERB_LOOK, 0x142)) { _vm->_dialogs->show(0x4EF2); - } else if (action->isAction(0x3, 0xAA)) { + } else if (action->isAction(VERB_LOOK, 0xAA)) { if ((_game._player._playerPos == Common::Point(77, 105)) && (_game._player._facing == 8)) _vm->_dialogs->show(0x4EF4); else _vm->_dialogs->show(0x4EF3); - } else if (action->isAction(0x3, 0x186)) { + } else if (action->isAction(VERB_LOOK, 0x186)) { _vm->_dialogs->show(0x4EF5); - } else if (action->isAction(0x3, 0x1B5)) { + } else if (action->isAction(VERB_LOOK, 0x1B5)) { _vm->_dialogs->show(0x4EF6); - } else if (action->isAction(0x3, 0x140)) { + } else if (action->isAction(VERB_LOOK, 0x140)) { _vm->_dialogs->show(0x4EF7); - } else if (action->isAction(0x4, 0x140)) { + } else if (action->isAction(VERB_TAKE, 0x140)) { _vm->_dialogs->show(0x4EF8); - } else if (action->isAction(0x3, 0x2D)) { + } else if (action->isAction(VERB_LOOK, 0x2D)) { if (action->_actionMode == 4) _vm->_dialogs->show(0x4EF9); else @@ -1048,7 +1048,7 @@ void Scene203::preActions() { return; } - if (_action.isAction(0xD, 0xF3)) + if (_action.isAction(VERB_WALKTO, 0xF3)) _game._player._walkOffScreenSceneId = 209; } @@ -1059,17 +1059,17 @@ void Scene203::actions() { _scene->_nextSceneId = 208; } else if (_action.isAction(0x18C, 0x82)) { _scene->_nextSceneId = 202; - } else if (_action.isAction(0x3, 0x142)) { + } else if (_action.isAction(VERB_LOOK, 0x142)) { _vm->_dialogs->show(0x4F4D); - } else if (_action.isAction(0x3, 0x4D)) { + } else if (_action.isAction(VERB_LOOK, 0x4D)) { _vm->_dialogs->show(0x4F4E); - } else if (_action.isAction(0x3, 0x100)) { + } else if (_action.isAction(VERB_LOOK, 0x100)) { _vm->_dialogs->show(0x4F4F); - } else if (_action.isAction(0x3, 0x82)) { + } else if (_action.isAction(VERB_LOOK, 0x82)) { _vm->_dialogs->show(0x4F50); - } else if (_action.isAction(0x3, 0x1A6)) { + } else if (_action.isAction(VERB_LOOK, 0x1A6)) { _vm->_dialogs->show(0x4F51); - } else if (_action.isAction(0x3, 0x30)) { + } else if (_action.isAction(VERB_LOOK, 0x30)) { _vm->_dialogs->show(0x4F51); } else return; @@ -1319,7 +1319,7 @@ void Scene207::preActions() { if (_action.isAction(0x18C, 0x1AB)) _game._player._walkOffScreenSceneId = 208; - if ((_action.isAction(0xD)) || (_action.isAction(0x3))) { + if ((_action.isAction(VERB_WALKTO)) || (_action.isAction(VERB_LOOK))) { if (_action.isAction(0x185)) { _globals._frameTime = 0xD8F1; _globals._frameTime |= 0xFFFF0000; @@ -1352,33 +1352,33 @@ void Scene207::actions() { _globals._v2 = 0; } - if (_action.isAction(3, 0x69)) { + if (_action.isAction(VERB_LOOK, 0x69)) { _vm->_dialogs->show(0x50DD); - } else if (_action.isAction(3, 0x1AF)) { + } else if (_action.isAction(VERB_LOOK, 0x1AF)) { _vm->_dialogs->show(0x50DE); - } else if (_action.isAction(3, 0x141)) { + } else if (_action.isAction(VERB_LOOK, 0x141)) { _vm->_dialogs->show(0x50DF); - } else if (_action.isAction(3, 0x3E)) { + } else if (_action.isAction(VERB_LOOK, 0x3E)) { _vm->_dialogs->show(0x50E0); - } else if (_action.isAction(3, 0x198)) { + } else if (_action.isAction(VERB_LOOK, 0x198)) { _vm->_dialogs->show(0x50E1); - } else if (_action.isAction(3, 0x1AE)) { + } else if (_action.isAction(VERB_LOOK, 0x1AE)) { _vm->_dialogs->show(0x50E2); - } else if (_action.isAction(3, 0xE8)) { + } else if (_action.isAction(VERB_LOOK, 0xE8)) { _vm->_dialogs->show(0x50E3); - } else if (_action.isAction(3, 0x12)) { + } else if (_action.isAction(VERB_LOOK, 0x12)) { _vm->_dialogs->show(0x50E4); - } else if (_action.isAction(3, 0x1AC)) { + } else if (_action.isAction(VERB_LOOK, 0x1AC)) { _vm->_dialogs->show(0x50E5); - } else if (_action.isAction(3, 0x185)) { + } else if (_action.isAction(VERB_LOOK, 0x185)) { _vm->_dialogs->show(0x50E6); - } else if (_action.isAction(4, 0x141)) { + } else if (_action.isAction(VERB_TAKE, 0x141)) { _vm->_dialogs->show(0x50E8); - } else if (_action.isAction(4, 0x12)) { + } else if (_action.isAction(VERB_TAKE, 0x12)) { _vm->_dialogs->show(0x50E9); - } else if (_action.isAction(3, 0x14D)) { + } else if (_action.isAction(VERB_LOOK, 0x14D)) { _vm->_dialogs->show(0x50EA); - } else if (_action.isAction(4, 0x14D)) { + } else if (_action.isAction(VERB_TAKE, 0x14D)) { _vm->_dialogs->show(0x50EB); } else return; @@ -1480,7 +1480,7 @@ void Scene208::step() { void Scene208::preActions() { Player &player = _vm->_game->_player; - if (_action.isAction(3) && player._readyToWalk) + if (_action.isAction(VERB_LOOK) && player._readyToWalk) player._needToWalk = true; if (_action.isAction(0x18C, 0x9B)) @@ -1503,59 +1503,59 @@ void Scene208::actions() { } } else if (_action.isAction(0x18C, 0x83)) { _scene->_nextSceneId = 212; - } else if (_action.isAction(0x4, 0x1AA) && (!_globals[kLeavesStatus] || _game._trigger)) { + } else if (_action.isAction(VERB_TAKE, 0x1AA) && (!_globals[kLeavesStatus] || _game._trigger)) { warning("TODO: sub3B282(1);"); if (_game._player._stepEnabled) _vm->_dialogs->showPicture(OBJ_BIG_LEAVES, 0x326, 0); - } else if (_action.isAction(0x7, 0x23, 0x19E) && (_globals[kLeavesStatus] == 1 || _game._trigger)) { + } else if (_action.isAction(VERB_PUT, 0x23, 0x19E) && (_globals[kLeavesStatus] == 1 || _game._trigger)) { warning("TODO: sub3B282(2);"); - } else if (_action.isAction(0x7, 0x17A, 0x1A9)) { + } else if (_action.isAction(VERB_PUT, 0x17A, 0x1A9)) { warning("TODO: sub3B282(3);"); if (_game._player._stepEnabled) { _game._player._stepEnabled = false; _globals._v0 = true; _game._player.walk(Common::Point(20, 148), FACING_EAST); } - } else if (_action.isAction(0x7, 0x35, 0x1A9)) { + } else if (_action.isAction(VERB_PUT, 0x35, 0x1A9)) { warning("TODO: sub3B282(4);"); if (_game._player._stepEnabled) { _vm->_dialogs->show(0x514C); } - } else if (_action.isAction(0x7, 0x65, 0x1A9)) { + } else if (_action.isAction(VERB_PUT, 0x65, 0x1A9)) { warning("TODO: sub3B282(5);"); if (_game._player._stepEnabled) { _vm->_dialogs->show(0x514C); } - } else if (_action.isAction(0x3, 0x5D)) { + } else if (_action.isAction(VERB_LOOK, 0x5D)) { _vm->_dialogs->show(0x5141); - } else if (_action.isAction(0x3, 0xF6)) { + } else if (_action.isAction(VERB_LOOK, 0xF6)) { _vm->_dialogs->show(0x5142); - } else if (_action.isAction(0x3, 0x16F)) { + } else if (_action.isAction(VERB_LOOK, 0x16F)) { _vm->_dialogs->show(0x5143); - } else if (_action.isAction(0x3, 0x129)) { + } else if (_action.isAction(VERB_LOOK, 0x129)) { _vm->_dialogs->show(0x5144); - } else if (_action.isAction(0x3, 0x1A1)) { + } else if (_action.isAction(VERB_LOOK, 0x1A1)) { _vm->_dialogs->show(0x5145); - } else if (_action.isAction(0x4, 0x1A1)) { + } else if (_action.isAction(VERB_TAKE, 0x1A1)) { _vm->_dialogs->show(0x5146); - } else if (_action.isAction(0x3, 0x9B)) { + } else if (_action.isAction(VERB_LOOK, 0x9B)) { _vm->_dialogs->show(0x5147); - } else if (_action.isAction(0x3, 0x19E)) { + } else if (_action.isAction(VERB_LOOK, 0x19E)) { _vm->_dialogs->show(0x5148); - } else if (_action.isAction(0x3, 0x1AA)) { + } else if (_action.isAction(VERB_LOOK, 0x1AA)) { _vm->_dialogs->show(0x5149); - } else if (_action.isAction(0x3, 0x1A9)) { + } else if (_action.isAction(VERB_LOOK, 0x1A9)) { if (_game._difficulty == DIFFICULTY_IMPOSSIBLE) _vm->_dialogs->show(0x514A); else _vm->_dialogs->show(0x514B); - } else if (_action.isAction(0x3, 0x174) || _action.isAction(0x3, 0x175)) { + } else if (_action.isAction(VERB_LOOK, 0x174) || _action.isAction(VERB_LOOK, 0x175)) { _vm->_dialogs->show(0x514D); - } else if (_action.isAction(0x4, 0x1A9)) { + } else if (_action.isAction(VERB_TAKE, 0x1A9)) { _vm->_dialogs->show(0x514E); - } else if (_action.isAction(0x3, 0x1A8)) { + } else if (_action.isAction(VERB_LOOK, 0x1A8)) { _vm->_dialogs->show(0x514F); - } else if (_action.isAction(0x4, 0x1A8) || _action.isAction(0xA, 0x1A8)) { + } else if (_action.isAction(VERB_TAKE, 0x1A8) || _action.isAction(0xA, 0x1A8)) { _vm->_dialogs->show(0x5150); } else if (_action._savedFields._lookFlag == 0) { return; -- cgit v1.2.3 From e8de00f8770ab43259176400a9245006bc3b327a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 29 Mar 2014 08:54:25 +0100 Subject: MADS: Some more renaming in scene 202 --- engines/mads/nebular/globals_nebular.cpp | 1 - engines/mads/nebular/globals_nebular.h | 2 +- engines/mads/nebular/nebular_scenes2.cpp | 8 ++++---- engines/mads/nebular/nebular_scenes2.h | 4 ++-- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/engines/mads/nebular/globals_nebular.cpp b/engines/mads/nebular/globals_nebular.cpp index e2886ee293..80e8dedd3b 100644 --- a/engines/mads/nebular/globals_nebular.cpp +++ b/engines/mads/nebular/globals_nebular.cpp @@ -47,7 +47,6 @@ Globals::Globals() { _v8 = 0; _abortVal = 0; _v8425C = 0; - _v84260 = 0; _v84262 = 0; _v84264 = 0; _v84266 = 0; diff --git a/engines/mads/nebular/globals_nebular.h b/engines/mads/nebular/globals_nebular.h index eebbd8ed25..992e00ab72 100644 --- a/engines/mads/nebular/globals_nebular.h +++ b/engines/mads/nebular/globals_nebular.h @@ -295,7 +295,7 @@ public: int _v8; int _abortVal; uint32 _v8425C; - int _v84260, _v84262, _v84264, _v84266, _v84268; + int _v84262, _v84264, _v84266, _v84268; public: /** * Constructor diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 2f81b780fe..ed43275451 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -580,7 +580,7 @@ void Scene202::step() { } } - if ((_scene->_activeAnimation->getCurrentFrame() == 160) && (_globals._v84260 != _scene->_activeAnimation->getCurrentFrame())) { + if ((_scene->_activeAnimation->getCurrentFrame() == 160) && (_meteoFrame != _scene->_activeAnimation->getCurrentFrame())) { Common::Point msgPos; int msgFlag; if (!_ladderTopFl) { @@ -599,11 +599,11 @@ void Scene202::step() { _toTeleportFl = true; } - if (_scene->_activeAnimation->getCurrentFrame() == _globals._v84260) { + if (_scene->_activeAnimation->getCurrentFrame() == _meteoFrame) { return; } - _globals._v84260 = _scene->_activeAnimation->getCurrentFrame(); + _meteoFrame = _scene->_activeAnimation->getCurrentFrame(); int randVal = _vm->getRandomNumber(1, 1000); int frameStep = -1; @@ -649,7 +649,7 @@ void Scene202::step() { int nextFrame = 1 + _scene->_activeAnimation->getCurrentFrame() - frameStep; if (nextFrame) { _scene->_activeAnimation->setCurrentFrame(nextFrame); - _globals._v84260 = nextFrame; + _meteoFrame = nextFrame; } } diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index 143b24c22f..0f247f3146 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -64,7 +64,7 @@ public: class Scene202: public Scene2xx { private: bool _activeMsgFl, _ladderTopFl, _waitingMeteoFl, _toStationFl, _toTeleportFl; - int _ladderHotspotId, _lastRoute, _stationCounter; + int _ladderHotspotId, _lastRoute, _stationCounter, _meteoFrame; uint32 _meteoClock1, _meteoClock2, _startTime; int subStep1(int randVal); @@ -75,7 +75,7 @@ private: public: Scene202(MADSEngine *vm) : Scene2xx(vm), _activeMsgFl(false), _ladderTopFl(false), _waitingMeteoFl(false), _ladderHotspotId(-1), _meteoClock1(0), _meteoClock2(0), _toStationFl(false), _toTeleportFl(false), - _lastRoute(0), _stationCounter(0) {} + _lastRoute(0), _stationCounter(0), _meteoFrame(0) {} virtual void setup(); virtual void enter(); virtual void step(); -- cgit v1.2.3 From d801c2ffdd1b2e5cfefcea18309a4779e0a824a1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 29 Mar 2014 09:41:55 +0100 Subject: MADS: Implement palette::lock() and unlock(), get rid of some magic values in scene 202 and 203, some renaming --- engines/mads/game.cpp | 1 + engines/mads/nebular/nebular_scenes2.cpp | 32 ++++++++++++------------ engines/mads/nebular/nebular_scenes2.h | 4 ++- engines/mads/palette.cpp | 42 ++++++++++++++++++++------------ engines/mads/palette.h | 9 ++++--- 5 files changed, 52 insertions(+), 36 deletions(-) diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index a1ca02cbf4..faa2bfaefc 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -142,6 +142,7 @@ void Game::gameLoop() { } // TODO: Extra reset methods + _vm->_palette->unlock(); _vm->_events->waitCursor(); _vm->_events->freeCursors(); _vm->_sound->closeDriver(); diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index ed43275451..99c6cf4103 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -464,7 +464,7 @@ void Scene202::setRandomKernelMessage() { } void Scene202::step() { - if (!_activeMsgFl && (_game._player._playerPos == Common::Point(77, 105)) && (_game._player._facing == 8) && (_vm->getRandomNumber(999) == 0)) { + if (!_activeMsgFl && (_game._player._playerPos == Common::Point(77, 105)) && (_game._player._facing == FACING_NORTH) && (_vm->getRandomNumber(999) == 0)) { _scene->_kernelMessages.reset(); _activeMsgFl = false; if (_vm->getRandomNumber(4) == 0) @@ -939,7 +939,7 @@ void Scene202::actions() { } else if (action->isAction(VERB_LOOK, 0x142)) { _vm->_dialogs->show(0x4EF2); } else if (action->isAction(VERB_LOOK, 0xAA)) { - if ((_game._player._playerPos == Common::Point(77, 105)) && (_game._player._facing == 8)) + if ((_game._player._playerPos == Common::Point(77, 105)) && (_game._player._facing == FACING_NORTH)) _vm->_dialogs->show(0x4EF4); else _vm->_dialogs->show(0x4EF3); @@ -980,23 +980,23 @@ void Scene203::enter() { } else if (_scene->_priorSceneId == 209) { _game._player._playerPos = Common::Point(308, 117); _game._player._facing = FACING_WEST; - } else if (_scene->_priorSceneId == -2) { + } else if (_scene->_priorSceneId != -2) { _game._player._playerPos = Common::Point(155, 152); _game._player._facing = FACING_NORTH; } - _globals._v0 = 0; - _globals._frameTime = 0; + _rhotundaEatFl = false; + _rhotundaEat2Fl = false; - if ((_globals[kRhotundaStatus] == 0) && (_scene->_roomChanged == 0)) { - _globals._v0 = -1; + if ((_globals[kRhotundaStatus] == 0) && (!_scene->_roomChanged)) { + _rhotundaEatFl = true; _game._player.walk(Common::Point(158, 135), FACING_SOUTH); int idx = _scene->_dynamicHotspots.add(131, 396, 0, Common::Rect(0, 0, 320, 156)); _scene->_dynamicHotspots.setPosition(idx, 155, 152, FACING_SOUTH); _scene->_dynamicHotspots.setCursor(idx, CURSOR_GO_DOWN); } - if (_globals._v0 == 0) { + if (!_rhotundaEatFl) { _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('b', -1), 0); if (_vm->getRandomNumber(1, 3) == 2) { _globals._spriteIndexes[15] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 9, 1, 0, 0); @@ -1008,7 +1008,7 @@ void Scene203::enter() { _game.loadQuoteSet(0x67, 0x68, 0x69, 0x6A, 0x5A, 0); - if (_globals._v0 != 0) { + if (_rhotundaEatFl) { _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(_vm->getRandomNumber(103, 106))); } @@ -1016,21 +1016,21 @@ void Scene203::enter() { } void Scene203::step() { - if (_globals._v0 == 0) + if (!_rhotundaEatFl) return; - if ((_game._trigger == 0) && (_globals._frameTime != 0)) + if ((_game._trigger == 0) && _rhotundaEat2Fl) return; - if ((_game._player._playerPos != Common::Point(158, 136)) || (_game._player._facing != 2)) + if ((_game._player._playerPos != Common::Point(158, 136)) || (_game._player._facing != FACING_SOUTH)) return; - _globals._frameTime = 0xFFFF; + _rhotundaEat2Fl = true; if (_game._trigger == 0) { _game._player._visible = false; _game._player._stepEnabled = false; - _vm->_palette->sub7BBF8(); + _vm->_palette->lock(); _scene->_kernelMessages.reset(); _scene->resetScene(); _vm->_events->setCursor2(CURSOR_WAIT); @@ -1042,7 +1042,7 @@ void Scene203::step() { } void Scene203::preActions() { - if (_globals._v0 && !_action.isAction(0x18C, 0x83)) { + if (_rhotundaEatFl && !_action.isAction(0x18C, 0x83)) { _game._player.walk(Common::Point(158, 136), FACING_SOUTH); _action._inProgress = false; return; @@ -1449,7 +1449,7 @@ void Scene208::step() { if (_globals._v0 == 0) return; - if ((_game._player._playerPos != Common::Point(20, 148)) || (_game._player._facing != 6)) + if ((_game._player._playerPos != Common::Point(20, 148)) || (_game._player._facing != FACING_EAST)) return; if ((_game._trigger == 0) && ((_globals._frameTime & 0xFFFF) != 0)) diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index 0f247f3146..44ee528b8f 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -87,8 +87,10 @@ public: }; class Scene203: public Scene2xx { +private: + bool _rhotundaEat2Fl, _rhotundaEatFl; public: - Scene203(MADSEngine *vm) : Scene2xx(vm) {} + Scene203(MADSEngine *vm) : Scene2xx(vm), _rhotundaEat2Fl(false), _rhotundaEatFl(false) {} virtual void setup(); virtual void enter(); virtual void step(); diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index 311bd633e1..34ba0acf54 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -235,7 +235,7 @@ int PaletteUsage::process(Common::Array &palette, uint flags) { palette[palIndex]._palIndex = var4; } - _vm->_palette->_rgbList[rgbIndex] = -1; + _vm->_palette->_rgbList[rgbIndex] = true; return rgbIndex; } @@ -263,7 +263,7 @@ void PaletteUsage::updateUsage(Common::Array &usageList, int sceneUsageInde uint32 bitMask = 1 << usageList[idx]; mask1 ^= bitMask; mask2 |= bitMask; - _vm->_palette->_rgbList[usageList[idx]] = 0; + _vm->_palette->_rgbList[usageList[idx]] = false; } uint32 mask3 = 1 << sceneUsageIndex; @@ -276,7 +276,7 @@ void PaletteUsage::updateUsage(Common::Array &usageList, int sceneUsageInde } } - _vm->_palette->_rgbList[sceneUsageIndex] = -1; + _vm->_palette->_rgbList[sceneUsageIndex] = true; } int PaletteUsage::getGamePalFreeIndex(int *palIndex) { @@ -306,11 +306,13 @@ int PaletteUsage::rgbFactor(byte *palEntry, RGB6 &pal6) { /*------------------------------------------------------------------------*/ void RGBList::clear() { - Common::fill(&_data[0], &_data[32], 0); + for (int i = 0; i < 32; i++) + _data[i] = false; } void RGBList::reset() { - Common::fill(&_data[2], &_data[32], 0); + for (int i = 2; i < 32; i++) + _data[i] = false; } int RGBList::scan() { @@ -319,7 +321,7 @@ int RGBList::scan() { return i; } - error("List was full"); + error("RGBList was full"); } /*------------------------------------------------------------------------*/ @@ -327,7 +329,7 @@ int RGBList::scan() { Palette::Palette(MADSEngine *vm) : _vm(vm), _paletteUsage(vm) { reset(); - _v1 = 0; + _lockFl = false; _lowRange = 0; _highRange = 0; Common::fill(&_mainPalette[0], &_mainPalette[PALETTE_SIZE], 0); @@ -435,9 +437,9 @@ void Palette::resetGamePalette(int lowRange, int highRange) { } _rgbList.clear(); - _rgbList[0] = _rgbList[1] = -1; + _rgbList[0] = _rgbList[1] = true; - _v1 = 0; + _lockFl = false; _lowRange = lowRange; _highRange = highRange; } @@ -463,7 +465,7 @@ void Palette::initPalette() { for (int idx = 0; idx < PALETTE_COUNT; ++idx) _palFlags[idx] = palMask; - _v1 = 0; + _lockFl = false; _rgbList.reset(); } @@ -486,12 +488,12 @@ void Palette::setLowRange() { void Palette::fadeOut(byte palette[PALETTE_SIZE], int v1, int v2, int v3, int v4, int v5, int v6) { } -void Palette::sub7BBF8() { - if ((_rgbList[31] != 0) && (_v1 == 0)) - error("Palette - Unexpected values"); +void Palette::lock() { + if (_rgbList[31] && !_lockFl) + error("Palette Lock - Unexpected values"); - _v1 = -1; - _rgbList[31] = -1; + _lockFl = true; + _rgbList[31] = true; for (int i = 0; i < 256; i++) { if (_palFlags[i]) @@ -499,4 +501,14 @@ void Palette::sub7BBF8() { } } +void Palette::unlock() { + if (!_lockFl) + return; + + for (int i = 0; i < 256; i++) + _palFlags[i] &= 0x7FFFFFFF; + + _rgbList[31] = false; + _lockFl = false; +} } // End of namespace MADS diff --git a/engines/mads/palette.h b/engines/mads/palette.h index ae29d181ec..dd5eaf6c2b 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -110,7 +110,7 @@ public: class RGBList { private: - int16 _data[32]; + bool _data[32]; public: RGBList() { clear(); } @@ -123,7 +123,7 @@ public: */ int scan(); - int16 &operator[](int idx) { return _data[idx]; } + bool &operator[](int idx) { return _data[idx]; } }; #define PALETTE_COUNT 256 @@ -146,7 +146,7 @@ public: uint32 _palFlags[PALETTE_COUNT]; PaletteUsage _paletteUsage; RGBList _rgbList; - int _v1; + bool _lockFl; int _lowRange; int _highRange; public: @@ -229,7 +229,8 @@ public: void fadeOut(byte palette[PALETTE_SIZE], int v1, int v2, int v3, int v4, int v5, int v6); - void sub7BBF8(); + void lock(); + void unlock(); }; } // End of namespace MADS -- cgit v1.2.3 From 71b1343adf6e886cfd2e1a0040a12b5025672d14 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 29 Mar 2014 11:18:07 -0400 Subject: MADS: Implemented NebularGame::step --- engines/mads/action.cpp | 6 +-- engines/mads/action.h | 6 ++- engines/mads/animation.cpp | 6 +-- engines/mads/animation.h | 2 +- engines/mads/game.cpp | 4 +- engines/mads/game.h | 9 ++++- engines/mads/messages.cpp | 6 +-- engines/mads/messages.h | 2 +- engines/mads/nebular/game_nebular.cpp | 65 ++++++++++++++++++++++++++++++++ engines/mads/nebular/game_nebular.h | 2 + engines/mads/nebular/globals_nebular.h | 2 + engines/mads/nebular/nebular_scenes2.cpp | 4 +- engines/mads/player.cpp | 4 +- engines/mads/player.h | 7 +++- engines/mads/scene.cpp | 20 +++++----- engines/mads/scene.h | 3 ++ engines/mads/scene_data.cpp | 2 +- engines/mads/sequence.cpp | 10 ++--- engines/mads/sequence.h | 2 +- 19 files changed, 122 insertions(+), 40 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index fe90305c9d..c2cc05e917 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -35,8 +35,8 @@ MADSAction::MADSAction(MADSEngine *vm) : _vm(vm) { _selectedAction = 0; _inProgress = false; - _savedFields._actionMode = ABORTMODE_0; - _savedFields._actionMode2 = ABORTMODE_0; + _savedFields._actionMode = KERNEL_TRIGGER_PARSER; + _savedFields._actionMode2 = KERNEL_TRIGGER_PARSER; _savedFields._selectedRow = -1; _savedFields._hotspotId = 0; _savedFields._v86F3A = 0; @@ -272,7 +272,7 @@ void MADSAction::startAction() { player.cancelCommand(); _inProgress = true; - _v8453A = ABORTMODE_0; + _v8453A = KERNEL_TRIGGER_PARSER; _savedFields._selectedRow = _selectedRow; _savedFields._hotspotId = _hotspotId; _savedFields._v86F3A = _v86F3A; diff --git a/engines/mads/action.h b/engines/mads/action.h index a517a65d0e..4f748f24c9 100644 --- a/engines/mads/action.h +++ b/engines/mads/action.h @@ -30,7 +30,11 @@ namespace MADS { enum ActionMode { ACTIONMODE_NONE = 0, ACTIONMODE_VERB = 1, ACTIONMODE_OBJECT = 3, ACTIONMODE_TALK = 6 }; enum ActionMode2 { ACTIONMODE2_0 = 0, ACTIONMODE2_2 = 2, ACTIONMODE2_4 = 4, ACTIONMODE2_5 = 5 }; -enum AbortTimerMode { ABORTMODE_0 = 0, ABORTMODE_1 = 1, ABORTMODE_2 = 2 }; +enum TriggerMode { + KERNEL_TRIGGER_PARSER = 0, // Triggers parser + KERNEL_TRIGGER_DAEMON = 1, // Triggers step/daemon code + KERNEL_TRIGGER_PREPARE = 2 // Triggers preparser +}; enum InterAwaiting { AWAITING_NONE = 0, diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index 96b9cfb90e..a8adfe3105 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -317,7 +317,7 @@ void Animation::startAnimation(int abortTimers) { _oldFrameEntry = 0; _nextFrameTimer = _vm->_game->_scene._frameStartTime; _trigger = abortTimers; - _abortTimersMode = _vm->_game->_abortTimersMode2; + _triggerMode = _vm->_game->_triggerSetupMode; _vm->_game->_scene._action._activeAction = _actionDetails; for (int idx = 0; idx < _header._messagesCount; ++idx) { @@ -532,9 +532,9 @@ void Animation::update() { // Animation is complete if (_trigger != 0) { _vm->_game->_trigger = _trigger; - _vm->_game->_abortTimersMode = _abortTimersMode; + _vm->_game->_triggerMode = _triggerMode; - if (_abortTimersMode != ABORTMODE_1) { + if (_triggerMode != KERNEL_TRIGGER_DAEMON) { // Copy the noun list scene._action._action = _actionDetails; } diff --git a/engines/mads/animation.h b/engines/mads/animation.h index 7c3d864184..63f77d1fa2 100644 --- a/engines/mads/animation.h +++ b/engines/mads/animation.h @@ -129,7 +129,7 @@ private: uint32 _nextScrollTimer; int _messageCtr; int _trigger; - AbortTimerMode _abortTimersMode; + TriggerMode _triggerMode; ActionDetails _actionDetails; /** diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index faa2bfaefc..f81c752667 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -56,8 +56,8 @@ Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm), _aaName = "*I0.AA"; _priorFrameTimer = 0; _updateSceneFlag = false; - _abortTimersMode = ABORTMODE_0; - _abortTimersMode2 = ABORTMODE_0; + _triggerMode = KERNEL_TRIGGER_PARSER; + _triggerSetupMode = KERNEL_TRIGGER_PARSER; _ticksExpiry = 0; _winStatus = 0; diff --git a/engines/mads/game.h b/engines/mads/game.h index f3e2a67e23..9da2694456 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -134,8 +134,8 @@ public: int _v2; int _trigger; ScreenTransition _fx; - AbortTimerMode _abortTimersMode; - AbortTimerMode _abortTimersMode2; + TriggerMode _triggerMode; + TriggerMode _triggerSetupMode; uint32 _priorFrameTimer; Common::String _aaName; uint32 _ticksExpiry; @@ -156,6 +156,11 @@ public: */ virtual void doObjectAction() = 0; + /** + * Global game step + */ + virtual void step() = 0; + // DEPRECATED: ScummVM re-implementation keeps all the quotes loaded, so the methods below are stubs void clearQuotes() {} void loadQuoteRange(int startNum, int endNum) {} diff --git a/engines/mads/messages.cpp b/engines/mads/messages.cpp index 5c6e11339c..3903b71766 100644 --- a/engines/mads/messages.cpp +++ b/engines/mads/messages.cpp @@ -75,7 +75,7 @@ int KernelMessages::add(const Common::Point &pt, uint fontColor, uint8 flags, rec._timeout = timeout; rec._frameTimer = _vm->_game->_priorFrameTimer; rec._trigger = abortTimers; - rec._abortMode = _vm->_game->_abortTimersMode2; + rec._abortMode = _vm->_game->_triggerSetupMode; rec._actionDetails = scene._action._activeAction; @@ -177,9 +177,9 @@ void KernelMessages::processText(int msgIndex) { msg._flags |= KMSG_EXPIRE; if (msg._trigger != 0) { _vm->_game->_trigger = msg._trigger; - _vm->_game->_abortTimersMode = msg._abortMode; + _vm->_game->_triggerMode = msg._abortMode; - if (_vm->_game->_abortTimersMode != ABORTMODE_1) { + if (_vm->_game->_triggerMode != KERNEL_TRIGGER_DAEMON) { scene._action._activeAction = msg._actionDetails; } } diff --git a/engines/mads/messages.h b/engines/mads/messages.h index 1254b1dafc..4778efdffd 100644 --- a/engines/mads/messages.h +++ b/engines/mads/messages.h @@ -57,7 +57,7 @@ public: uint32 _frameTimer; uint32 _timeout; int _trigger; - AbortTimerMode _abortMode; + TriggerMode _abortMode; ActionDetails _actionDetails; Common::String _msg; diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index 55a348a489..34af685981 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -280,6 +280,71 @@ void GameNebular::doObjectAction() { warning("TODO: GameNebular::doObjectAction"); } +void GameNebular::step() { + if (_player._visible && _player._stepEnabled && !_player._moving && + (_player._facing == _player._turnToFacing)) { + if (_scene._frameStartTime >= *((uint32 *)&_globals[kWalkerTiming])) { + if (!_player._stopWalkerIndex) { + int randomVal = _vm->getRandomNumber(29999);; + if (_globals[kSexOfRex] == REX_MALE) { + switch (_player._facing) { + case FACING_SOUTHWEST: + case FACING_SOUTHEAST: + case FACING_NORTHWEST: + case FACING_NORTHEAST: + if (randomVal < 200) { + _player.addWalker(-1, 0); + _player.addWalker(1, 0); + } + break; + + case FACING_WEST: + case FACING_EAST: + if (randomVal < 500) { + for (int count = 0; count < 10; ++count) { + _player.addWalker(1, 0); + } + } + break; + + case 2: + if (randomVal < 500) { + for (int count = 0; count < 10; ++count) { + _player.addWalker((randomVal < 250) ? 1 : 2, 0); + } + } else if (randomVal < 750) { + for (int count = 0; count < 5; ++count) { + _player.addWalker(1, 0); + } + + _player.addWalker(0, 0); + _player.addWalker(0, 0); + + for (int count = 0; count < 5; ++count) { + _player.addWalker(2, 0); + } + } + break; + } + } + } + + *((uint32 *)&_globals[kWalkerTiming]) += 6; + } + } + + // Below is countdown to set the timebomb off in room 604 + if (_globals[kTimebombStatus] == TIMEBOMB_ACTIVATED) { + int diff = _scene._frameStartTime - *((uint32 *)&_globals[kTimebombClock]); + if ((diff >= 0) && (diff <= 60)) { + *((uint32 *)&_globals[kTimebombTimer]) += diff; + } else { + ++*((uint32 *)&_globals[kTimebombTimer]); + } + *((uint32 *)&_globals[kTimebombClock]) = _scene._frameStartTime; + } +} + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/game_nebular.h b/engines/mads/nebular/game_nebular.h index d3d908d153..5b88f631e3 100644 --- a/engines/mads/nebular/game_nebular.h +++ b/engines/mads/nebular/game_nebular.h @@ -66,6 +66,8 @@ public: StoryMode _storyMode; virtual void doObjectAction(); + + virtual void step(); }; diff --git a/engines/mads/nebular/globals_nebular.h b/engines/mads/nebular/globals_nebular.h index 992e00ab72..14bb2fb5af 100644 --- a/engines/mads/nebular/globals_nebular.h +++ b/engines/mads/nebular/globals_nebular.h @@ -207,6 +207,8 @@ enum GlobalId { /* Enums used for specific individual globals */ /* Section #1 */ +// Rex's sex/swimming state +enum { REX_MALE = 0, REX_MALE_SWIMMER = 1, REX_FEMALE = 2 }; // State of Meteorologist in the outpost enum { METEOROLOGIST_ABSENT = 0, METEOROLOGIST_PRESENT = 1, METEOROLOGIST_GONE = 2 }; diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 99c6cf4103..da9341a71a 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -458,7 +458,7 @@ void Scene202::enter() { void Scene202::setRandomKernelMessage() { int vocabId = _vm->getRandomNumber(92, 96); _scene->_kernelMessages.reset(); - _game._abortTimersMode2 = ABORTMODE_1; + _game._triggerSetupMode = KERNEL_TRIGGER_DAEMON; _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 70, 120, _game.getQuote(vocabId)); _activeMsgFl = true; } @@ -495,7 +495,7 @@ void Scene202::step() { action->_activeAction._verbId = 3; action->_activeAction._objectNameId = 39; action->_activeAction._indirectObjectId = 438; - _game._abortTimersMode2 = ABORTMODE_0; + _game._triggerSetupMode = KERNEL_TRIGGER_PARSER; _scene->_sequences.addTimer(120, 2); _globals._abortVal = -1; } else if (_globals[kMeteorologistWatch] == 2) { diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index 57726e7bef..3625493657 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -767,8 +767,8 @@ void Player::newWalk() { } } -void Player::step() { - warning("TODO: Player::step"); +void Player::addWalker(int walker, int trigger) { + warning("TODO: Player::addWalker"); } } // End of namespace MADS diff --git a/engines/mads/player.h b/engines/mads/player.h index 2a9274840c..7ff14be191 100644 --- a/engines/mads/player.h +++ b/engines/mads/player.h @@ -60,7 +60,6 @@ private: int _routeLength; int _stopWalkerList[12]; int _stopWalkerTrigger[12]; - int _stopWalkerIndex; int _totalDistance; void clearStopList(); @@ -147,6 +146,7 @@ public: bool _forceRefresh; bool _needToWalk; bool _readyToWalk; + int _stopWalkerIndex; int _centerOfGravity; int _currentDepth; int _currentScale; @@ -218,7 +218,10 @@ public: void nextFrame(); - void step(); + /** + * Add a walker to the current queue + */ + void addWalker(int walker, int trigger); }; } // End of namespace MADS diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 2e788115db..f61928f6d0 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -310,7 +310,7 @@ void Scene::doFrame() { flag = true; } - if (flag || (_vm->_game->_trigger && _vm->_game->_abortTimersMode == ABORTMODE_2)) { + if (flag || (_vm->_game->_trigger && _vm->_game->_triggerMode == KERNEL_TRIGGER_PREPARE)) { doPreactions(); } @@ -320,7 +320,7 @@ void Scene::doFrame() { if ((_action._inProgress && !player._moving && !player._needToWalk && player._turnToFacing == player._facing) || - (_vm->_game->_trigger && _vm->_game->_abortTimersMode == ABORTMODE_0)) { + (_vm->_game->_trigger && _vm->_game->_triggerMode == KERNEL_TRIGGER_PARSER)) { doAction(); } @@ -444,11 +444,11 @@ void Scene::drawElements(ScreenTransition transitionType, bool surfaceFlag) { void Scene::doPreactions() { if (_vm->_game->_screenObjects._v832EC == 0 || _vm->_game->_screenObjects._v832EC == 2) { - _vm->_game->_abortTimersMode2 = ABORTMODE_2; + _vm->_game->_triggerSetupMode = KERNEL_TRIGGER_PREPARE; _action.checkAction(); _sceneLogic->preActions(); - if (_vm->_game->_abortTimersMode == ABORTMODE_2) + if (_vm->_game->_triggerMode == KERNEL_TRIGGER_PREPARE) _vm->_game->_trigger = 0; } } @@ -456,7 +456,7 @@ void Scene::doPreactions() { void Scene::doAction() { int flag = 0; - _vm->_game->_abortTimersMode2 = ABORTMODE_0; + _vm->_game->_triggerSetupMode = KERNEL_TRIGGER_PARSER; if ((_action._inProgress || _vm->_game->_trigger) && !_action._v8453A) { _sceneLogic->actions(); _action._inProgress = true; @@ -494,19 +494,17 @@ void Scene::doAction() { } _action._inProgress = false; - if (_vm->_game->_abortTimersMode == ABORTMODE_0) + if (_vm->_game->_triggerMode == KERNEL_TRIGGER_PARSER) _vm->_game->_trigger = 0; } void Scene::doSceneStep() { - _vm->_game->_abortTimersMode2 = ABORTMODE_1; + _vm->_game->_triggerSetupMode = KERNEL_TRIGGER_DAEMON; _sceneLogic->step(); _vm->_game->_sectionHandler->step(); + _vm->_game->step(); - _vm->_game->_player.step(); - _vm->_game->_player._trigger = 0; - - if (_vm->_game->_abortTimersMode == ABORTMODE_1) + if (_vm->_game->_triggerMode == KERNEL_TRIGGER_DAEMON) _vm->_game->_trigger = 0; } diff --git a/engines/mads/scene.h b/engines/mads/scene.h index 0af5fa6575..7b5d791d12 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -65,6 +65,9 @@ private: void doAction(); + /** + * Calls all the necessary step handlers for the current frame + */ void doSceneStep(); void checkKeyboard(); diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index b6304679cb..5b5c47f402 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -50,7 +50,7 @@ KernelMessage::KernelMessage() { _frameTimer = 0; _timeout = 0; _trigger = 0; - _abortMode = ABORTMODE_0; + _abortMode = KERNEL_TRIGGER_PARSER; _actionDetails._verbId = 0; _actionDetails._objectNameId = 0; _actionDetails._indirectObjectId = 0; diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index 9a8e2c62e6..6b9bd9e017 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -47,7 +47,7 @@ SequenceEntry::SequenceEntry() { _field22 = 0; _triggerCountdown = 0; _doneFlag = 0; - _abortMode = ABORTMODE_0; + _abortMode = KERNEL_TRIGGER_PARSER; _numTicks = 0; _extraTicks = 0; _timeout = 0; @@ -135,7 +135,7 @@ int SequenceList::add(int spriteListIndex, bool flipped, int frameIndex, int tri _entries[seqIndex]._flags = 0; _entries[seqIndex]._dynamicHotspotIndex = -1; _entries[seqIndex]._entries._count = 0; - _entries[seqIndex]._abortMode = _vm->_game->_abortTimersMode2; + _entries[seqIndex]._abortMode = _vm->_game->_triggerSetupMode; _entries[seqIndex]._actionNouns = _vm->_game->_scene._action._activeAction; @@ -160,7 +160,7 @@ int SequenceList::addTimer(int time, int abortVal) { se._triggerCountdown = true; se._doneFlag = false; se._entries._count = 0; - se._abortMode = _vm->_game->_abortTimersMode2; + se._abortMode = _vm->_game->_triggerSetupMode; se._actionNouns = _vm->_game->_scene._action._activeAction; addSubEntry(seqIndex, SM_0, 0, abortVal); @@ -328,9 +328,9 @@ bool SequenceList::loadSprites(int seqIndex) { if (idx >= 0) { _vm->_game->_trigger = seqEntry._entries._abortVal[idx]; - _vm->_game->_abortTimersMode = seqEntry._abortMode; + _vm->_game->_triggerMode = seqEntry._abortMode; - if (seqEntry._abortMode == ABORTMODE_1) + if (seqEntry._abortMode == KERNEL_TRIGGER_DAEMON) scene._action._activeAction = seqEntry._actionNouns; } diff --git a/engines/mads/sequence.h b/engines/mads/sequence.h index f24a2bd659..5dfdbce70e 100644 --- a/engines/mads/sequence.h +++ b/engines/mads/sequence.h @@ -74,7 +74,7 @@ struct SequenceEntry { int _triggerCountdown; bool _doneFlag; SequenceSubEntries _entries; - AbortTimerMode _abortMode; + TriggerMode _abortMode; ActionDetails _actionNouns; int _numTicks; -- cgit v1.2.3 From addb3e2900ee417fb71a75f9afae08b00007daa5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 29 Mar 2014 13:38:52 -0400 Subject: MADS: Minor renamings and added display of walk nodes to debugger --- engines/mads/action.cpp | 2 +- engines/mads/debugger.cpp | 10 ++++++++++ engines/mads/player.cpp | 10 +++++++++- engines/mads/scene.cpp | 4 ++++ 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index c2cc05e917..c762b9b993 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -78,7 +78,7 @@ void MADSAction::checkCustomDest(int v) { Player &player = _vm->_game->_player; if (_v86F4A && (v == -3 || _savedFields._selectedRow < 0)) { - _vm->_game->_player._needToWalk = true; + player._needToWalk = true; player._prepareWalkPos = scene._customDest; } } diff --git a/engines/mads/debugger.cpp b/engines/mads/debugger.cpp index 3bc4ed2c16..58bf8388e4 100644 --- a/engines/mads/debugger.cpp +++ b/engines/mads/debugger.cpp @@ -125,9 +125,19 @@ bool Debugger::Cmd_PlaySound(int argc, const char **argv) { bool Debugger::Cmd_ShowCodes(int argc, const char **argv) { Scene &scene = _vm->_game->_scene; + // Copy the depth/walk surface to the background and flag for screen refresh scene._depthSurface.copyTo(&scene._backgroundSurface); scene._spriteSlots.fullRefresh(); + // Draw the locations of scene nodes onto the background + int color = _vm->getRandomNumber(255); + for (int i = 0; i < (int)scene._sceneInfo->_nodes.size(); ++i) { + Common::Point &pt = scene._sceneInfo->_nodes[i]._walkPos; + + scene._backgroundSurface.hLine(pt.x - 2, pt.y, pt.x + 2, color); + scene._backgroundSurface.vLine(pt.x, pt.y - 2, pt.y + 2, color); + } + return false; } diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index 3625493657..1705b117ba 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -768,7 +768,15 @@ void Player::newWalk() { } void Player::addWalker(int walker, int trigger) { - warning("TODO: Player::addWalker"); + Scene &scene = _vm->_game->_scene; + SpriteAsset &spriteSet = *scene._sprites[_spritesStart + _spritesIdx]; + assert(spriteSet._charInfo); + + if (walker < spriteSet._charInfo->_numEntries && _stopWalkerIndex < 11) { + ++_stopWalkerIndex; + _stopWalkerList[_stopWalkerIndex] = walker; + _stopWalkerTrigger[_stopWalkerIndex] = trigger; + } } } // End of namespace MADS diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index f61928f6d0..b8b8888e53 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -136,6 +136,10 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) { for (uint i = 0; i < _sceneInfo->_nodes.size(); ++i) _nodes.push_back(_sceneInfo->_nodes[i]); + // Add two more empty nodes for the start and end points of any walk sequence + _nodes.push_back(SceneNode()); + _nodes.push_back(SceneNode()); + // Load hotspots loadHotspots(); -- cgit v1.2.3 From 5f3a15022584c3eb7377291a278165a1b1b8dd7b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 29 Mar 2014 19:44:52 +0100 Subject: MADS: Some renaming in scene 207 --- engines/mads/nebular/nebular_scenes2.cpp | 132 +++++++++++++++---------------- engines/mads/nebular/nebular_scenes2.h | 5 +- 2 files changed, 68 insertions(+), 69 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index da9341a71a..61ce589b5a 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -1241,30 +1241,29 @@ void Scene207::enter() { } if (var2 > 2) - _globals._v0 = 0; + _vultureFl = false; else - _globals._v0 = 1; + _vultureFl = true; - _globals._v5 = (var2 & 1); + _spiderFl = (var2 & 1); - if (_globals._v0) { + if (_vultureFl) { _globals._spriteIndexes[16] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 30, 0, 0, 400); - _globals._frameTime = _game._player._priorTimer; + _vultureTime = _game._player._priorTimer; int idx = _scene->_dynamicHotspots.add(389, 13, _globals._spriteIndexes[16], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, 254, 94, FACING_WEST); } - if (_globals._v5) { + if (_spiderFl) { _globals._spriteIndexes[19] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 7, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._spriteIndexes[19], -1, -1); - _globals._v3 = _game._player._priorTimer & 0xFFFF; - _globals._v4 = _game._player._priorTimer >> 16; - int idx = _scene->_dynamicHotspots.add(333, 13, _globals._spriteIndexes[19], Common::Rect(0, 0, 0, 0)); - _scene->_dynamicHotspots.setPosition(idx, 59, 132, FACING_SOUTH); + _spiderTime = _game._player._priorTimer; + _spiderHotspotId = _scene->_dynamicHotspots.add(333, 13, _globals._spriteIndexes[19], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(_spiderHotspotId, 59, 132, FACING_SOUTH); } - _globals._v2 = 0; + _eyeFl = false; if (_scene->_priorSceneId == 211) { _game._player._playerPos = Common::Point(13, 105); _game._player._facing = FACING_EAST; @@ -1282,11 +1281,11 @@ void Scene207::enter() { } void Scene207::step() { - if (!_globals._v0) { + if (!_vultureFl) { warning("TODO: sub3AD90(...)"); } - if (_globals._v5) { + if (_spiderFl) { warning("TODO: sub3ADD6(...)"); } @@ -1297,9 +1296,9 @@ void Scene207::step() { } if (_game._trigger == 71) - _globals._v2 = 0; + _eyeFl = false; - if (_globals._v2) + if (_eyeFl) return; if ((_game._player._playerPos.x >= 124) && (_game._player._playerPos.x <= 201)) { @@ -1308,7 +1307,7 @@ void Scene207::step() { _scene->_sequences.setDepth(_globals._spriteIndexes[22], 6); _scene->_sequences.setDepth(_globals._spriteIndexes[23], 6); _scene->_sequences.addSubEntry(_globals._spriteIndexes[22], SM_0, 0, 71); - _globals._v2 = -1; + _eyeFl = true; } } @@ -1321,11 +1320,9 @@ void Scene207::preActions() { if ((_action.isAction(VERB_WALKTO)) || (_action.isAction(VERB_LOOK))) { if (_action.isAction(0x185)) { - _globals._frameTime = 0xD8F1; - _globals._frameTime |= 0xFFFF0000; + _vultureTime = -9999; } else if (_action.isAction(0x14D)) { - _globals._v3 = 0xD8F1; - _globals._v4 = -1; + _spiderTime = -9999; } } } @@ -1333,57 +1330,56 @@ void Scene207::preActions() { void Scene207::actions() { if (_action._savedFields._lookFlag) { _vm->_dialogs->show(0x50E7); - } else { - if (_action.isAction(0x18B, 0x70)) - _scene->_nextSceneId = 214; - else { - if ((_game._player._playerPos.x > 150) && (_game._player._playerPos.x < 189) && - (_game._player._playerPos.y > 111) && (_game._player._playerPos.y < 130)) { - if ((_game._player._playerPos.x <= 162) && (_game._player._playerPos.x >= 181) && - (_game._player._playerPos.y <= 115) && (_game._player._playerPos.y >= 126)) { - _globals._spriteIndexes[22] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 10, 2, 0, 0); - _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8, 2, 0, 0); - _scene->_sequences.setDepth(_globals._spriteIndexes[22], 6); - _scene->_sequences.setDepth(_globals._spriteIndexes[23], 6); - } - } else if (_globals._v2) { - _scene->_sequences.remove(_globals._spriteIndexes[22]); - _scene->_sequences.remove(_globals._spriteIndexes[23]); - _globals._v2 = 0; + } else if (_action.isAction(0x18B, 0x70)) + _scene->_nextSceneId = 214; + else { + if ((_game._player._playerPos.x > 150) && (_game._player._playerPos.x < 189) && + (_game._player._playerPos.y > 111) && (_game._player._playerPos.y < 130)) { + if ((_game._player._playerPos.x <= 162) && (_game._player._playerPos.x >= 181) && + (_game._player._playerPos.y <= 115) && (_game._player._playerPos.y >= 126)) { + _globals._spriteIndexes[22] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 10, 2, 0, 0); + _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8, 2, 0, 0); + _scene->_sequences.setDepth(_globals._spriteIndexes[22], 6); + _scene->_sequences.setDepth(_globals._spriteIndexes[23], 6); } - - if (_action.isAction(VERB_LOOK, 0x69)) { - _vm->_dialogs->show(0x50DD); - } else if (_action.isAction(VERB_LOOK, 0x1AF)) { - _vm->_dialogs->show(0x50DE); - } else if (_action.isAction(VERB_LOOK, 0x141)) { - _vm->_dialogs->show(0x50DF); - } else if (_action.isAction(VERB_LOOK, 0x3E)) { - _vm->_dialogs->show(0x50E0); - } else if (_action.isAction(VERB_LOOK, 0x198)) { - _vm->_dialogs->show(0x50E1); - } else if (_action.isAction(VERB_LOOK, 0x1AE)) { - _vm->_dialogs->show(0x50E2); - } else if (_action.isAction(VERB_LOOK, 0xE8)) { - _vm->_dialogs->show(0x50E3); - } else if (_action.isAction(VERB_LOOK, 0x12)) { - _vm->_dialogs->show(0x50E4); - } else if (_action.isAction(VERB_LOOK, 0x1AC)) { - _vm->_dialogs->show(0x50E5); - } else if (_action.isAction(VERB_LOOK, 0x185)) { - _vm->_dialogs->show(0x50E6); - } else if (_action.isAction(VERB_TAKE, 0x141)) { - _vm->_dialogs->show(0x50E8); - } else if (_action.isAction(VERB_TAKE, 0x12)) { - _vm->_dialogs->show(0x50E9); - } else if (_action.isAction(VERB_LOOK, 0x14D)) { - _vm->_dialogs->show(0x50EA); - } else if (_action.isAction(VERB_TAKE, 0x14D)) { - _vm->_dialogs->show(0x50EB); - } else - return; + } else if (_eyeFl) { + _scene->_sequences.remove(_globals._spriteIndexes[22]); + _scene->_sequences.remove(_globals._spriteIndexes[23]); + _eyeFl = false; } + + if (_action.isAction(VERB_LOOK, 0x69)) { + _vm->_dialogs->show(0x50DD); + } else if (_action.isAction(VERB_LOOK, 0x1AF)) { + _vm->_dialogs->show(0x50DE); + } else if (_action.isAction(VERB_LOOK, 0x141)) { + _vm->_dialogs->show(0x50DF); + } else if (_action.isAction(VERB_LOOK, 0x3E)) { + _vm->_dialogs->show(0x50E0); + } else if (_action.isAction(VERB_LOOK, 0x198)) { + _vm->_dialogs->show(0x50E1); + } else if (_action.isAction(VERB_LOOK, 0x1AE)) { + _vm->_dialogs->show(0x50E2); + } else if (_action.isAction(VERB_LOOK, 0xE8)) { + _vm->_dialogs->show(0x50E3); + } else if (_action.isAction(VERB_LOOK, 0x12)) { + _vm->_dialogs->show(0x50E4); + } else if (_action.isAction(VERB_LOOK, 0x1AC)) { + _vm->_dialogs->show(0x50E5); + } else if (_action.isAction(VERB_LOOK, 0x185)) { + _vm->_dialogs->show(0x50E6); + } else if (_action.isAction(VERB_TAKE, 0x141)) { + _vm->_dialogs->show(0x50E8); + } else if (_action.isAction(VERB_TAKE, 0x12)) { + _vm->_dialogs->show(0x50E9); + } else if (_action.isAction(VERB_LOOK, 0x14D)) { + _vm->_dialogs->show(0x50EA); + } else if (_action.isAction(VERB_TAKE, 0x14D)) { + _vm->_dialogs->show(0x50EB); + } else + return; } + _action._inProgress = false; } diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index 44ee528b8f..1c19ae4d93 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -113,8 +113,11 @@ public: }; class Scene207: public Scene2xx { + bool _vultureFl, _spiderFl, _eyeFl; + int _spiderHotspotId; + int32 _spiderTime, _vultureTime; public: - Scene207(MADSEngine *vm) : Scene2xx(vm) {} + Scene207(MADSEngine *vm) : Scene2xx(vm), _vultureFl(false), _spiderFl(false), _spiderHotspotId(-1), _spiderTime(0), _vultureTime(0) {} virtual void setup(); virtual void enter(); virtual void step(); -- cgit v1.2.3 From f3db90b646d4af5b6daf43d11e99d59de0649b03 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 29 Mar 2014 17:12:12 -0400 Subject: MADS: Refactored pathfinder into it's own class --- engines/mads/module.mk | 1 + engines/mads/player.cpp | 139 ++--------------------- engines/mads/player.h | 17 --- engines/mads/rails.cpp | 269 ++++++++++++++++++++++++++++++++++++++++++++ engines/mads/rails.h | 128 +++++++++++++++++++++ engines/mads/scene.cpp | 8 +- engines/mads/scene.h | 3 +- engines/mads/scene_data.cpp | 92 +-------------- engines/mads/scene_data.h | 27 +---- 9 files changed, 415 insertions(+), 269 deletions(-) create mode 100644 engines/mads/rails.cpp create mode 100644 engines/mads/rails.h diff --git a/engines/mads/module.mk b/engines/mads/module.mk index 54126b1b06..13b4f8589b 100644 --- a/engines/mads/module.mk +++ b/engines/mads/module.mk @@ -27,6 +27,7 @@ MODULE_OBJS := \ msurface.o \ palette.o \ player.o \ + rails.o \ resources.o \ scene.o \ scene_data.o \ diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index 1705b117ba..e726c800fd 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -78,14 +78,14 @@ Player::Player(MADSEngine *vm): _vm(vm) { } void Player::cancelWalk() { - _action = &_vm->_game->_scene._action; + Scene &scene = _vm->_game->_scene; + _action = &scene._action; _targetPos = _playerPos; _targetFacing = FACING_NONE; _turnToFacing = _facing; _moving = false; _walkOffScreen = _walkOffScreenSceneId = 0; - _next = 0; - _routeCount = 0; + scene._rails.resetRoute(); _walkAnywhere = false; _needToWalk = false; @@ -352,30 +352,12 @@ void Player::startWalking(const Common::Point &pt, Facing facing) { _moving = true; _targetFacing = facing; - scene._sceneInfo->setRouteNode(scene._sceneInfo->_nodes.size() - 2, - _playerPos, scene._depthSurface); - scene._sceneInfo->setRouteNode(scene._sceneInfo->_nodes.size() - 1, - pt, scene._depthSurface); - bool v = scene._depthSurface.getDepthHighBit(pt); - setupRoute(v); - _next = 0; - - if (_routeCount > 0) { - Common::Point srcPos = _playerPos; - for (int routeCtr = _routeCount - 1; (routeCtr >= 0) && (_next == 0); --routeCtr) { - int idx = _routeIndexes[routeCtr]; - const Common::Point &pt =scene._sceneInfo->_nodes[idx]._walkPos; - _next = scanPath(scene._depthSurface, srcPos, pt); - srcPos = pt; - } - } + scene._rails.setupRoute(v, _playerPos, pt); } void Player::walk(const Common::Point &pos, Facing facing) { - Scene &scene = _vm->_game->_scene; - cancelWalk(); _needToWalk = true; _readyToWalk = true; @@ -402,23 +384,23 @@ void Player::nextFrame() { void Player::move() { Scene &scene = _vm->_game->_scene; + Rails &rails = scene._rails; bool newFacing = false; if (_moving) { - int idx = _routeCount; + bool isRouteEmpty = rails.empty(); while (!_walkOffScreen && _playerPos == _targetPos) { - if (idx != 0) { - --idx; - SceneNode &node = scene._sceneInfo->_nodes[_routeIndexes[idx]]; + if (!isRouteEmpty) { + const WalkNode &node = rails.popNode(); + _targetPos = node._walkPos; newFacing = true; - } else if (_walkOffScreenSceneId == idx) { + } else if (!_walkOffScreenSceneId) { // End of walking path - _routeCount = 0; + rails.resetRoute(); _moving = false; setFinalFacing(); newFacing = true; - idx = _routeCount; } else { _walkOffScreen = _walkOffScreenSceneId; _walkAnywhere = true; @@ -430,7 +412,6 @@ void Player::move() { if (!_moving) break; } - _routeCount = idx; } if (newFacing && _moving) @@ -579,104 +560,6 @@ void Player::setBaseFrameRate() { _ticksAmount = 6; } -void Player::setupRoute(bool bitFlag) { - Scene &scene = _vm->_game->_scene; - - // Reset the flag set of nodes in use - SceneNodeList &nodes = scene._sceneInfo->_nodes; - for (uint i = 0; i < nodes.size(); ++i) - nodes[i]._active = false; - - // Start constructing route node list - _routeLength = 0x3FFF; - _routeCount = 0; - - setupRouteNode(_tempRoute, nodes.size() - 1, bitFlag ? 0xC000 : 0x8000, 0); -} - -void Player::setupRouteNode(int *routeIndexP, int nodeIndex, int flags, int routeLength) { - Scene &scene = _vm->_game->_scene; - SceneNodeList &nodes = scene._sceneInfo->_nodes; - SceneNode ¤tNode = nodes[nodeIndex]; - currentNode._active = true; - - *routeIndexP++ = nodeIndex; - - int subIndex = nodes.size() - 2; - int indexVal = nodes[nodeIndex]._indexes[subIndex]; - if (indexVal & flags) { - routeLength += indexVal & 0x3FFF; - if (routeLength < _routeLength) { - // Found a new shorter route to destination, so set up the route with the found one - Common::copy(_tempRoute, routeIndexP, _routeIndexes); - _routeCount = routeIndexP - _tempRoute; - _routeLength = indexVal & 0x3FFF; - } - } else { - for (int idx = nodes.size() - 2; idx > 0; --idx) { - int nodePos = idx - 1; - if (!nodes[nodePos]._active && ((currentNode._indexes[nodePos] & flags) != 0)) - setupRouteNode(routeIndexP, nodePos, 0x8000, indexVal & 0x3fff); - } - } - - currentNode._active = false; -} - -int Player::scanPath(MSurface &depthSurface, const Common::Point &srcPos, const Common::Point &destPos) { - Scene &scene = _vm->_game->_scene; - - // For compressed depth surfaces, always return 0 - if (scene._sceneInfo->_depthStyle != 2) - return 0; - - int yDiff = destPos.y - srcPos.y; - int yAmount = MADS_SCREEN_WIDTH; - - if (yDiff < 0) { - yDiff = -yDiff; - yAmount = -yAmount; - } - - int xDiff = destPos.x - srcPos.y; - int xDirection = 1; - int xAmount = 0; - if (xDiff < 0) { - xDiff = -xDiff; - xDirection = -xDirection; - xAmount = MIN(yDiff, xDiff); - } - - ++xDiff; - ++yDiff; - - const byte *srcP = depthSurface.getBasePtr(srcPos.x, srcPos.y); - int index = xAmount; - - // Outer horizontal movement loop - for (int yIndex = 0; yIndex < yDiff; ++yIndex) { - index += yDiff; - int v = (*srcP & 0x7F) >> 4; - if (v) - return v; - - // Inner loop for handling vertical movement - while (index >= xDiff) { - index -= xDiff; - - v = (*srcP & 0x7F) >> 4; - if (v) - return v; - - srcP += yAmount; - } - - srcP += xDirection; - } - - return 0; -} - void Player::startMovement() { int xDiff = _targetPos.x - _playerPos.x; int yDiff = _targetPos.y - _playerPos.y; diff --git a/engines/mads/player.h b/engines/mads/player.h index 7ff14be191..986971bbc1 100644 --- a/engines/mads/player.h +++ b/engines/mads/player.h @@ -57,7 +57,6 @@ private: int _distAccum; int _pixelAccum; int _deltaDistance; - int _routeLength; int _stopWalkerList[12]; int _stopWalkerTrigger[12]; int _totalDistance; @@ -89,18 +88,6 @@ private: */ void setBaseFrameRate(); - void setupRoute(); - - void setupRoute(bool bitFlag); - - void setupRouteNode(int *routeIndexP, int nodeIndex, int flags, int routeLength); - - /** - * Scans along an edge connecting two points within the depths/walk surface, and returns the information of the first - * pixel high nibble encountered with a non-zero value - */ - int scanPath(MSurface &depthSurface, const Common::Point &srcPos, const Common::Point &destPos); - /** * Starts a player moving to a given destination */ @@ -151,10 +138,6 @@ public: int _currentDepth; int _currentScale; Common::String _spritesPrefix; - int _routeCount; - int _routeOffset; - int _tempRoute[MAX_ROUTE_NODES]; - int _routeIndexes[MAX_ROUTE_NODES]; public: Player(MADSEngine *vm); diff --git a/engines/mads/rails.cpp b/engines/mads/rails.cpp new file mode 100644 index 0000000000..0baaa12793 --- /dev/null +++ b/engines/mads/rails.cpp @@ -0,0 +1,269 @@ +/* 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 "common/scummsys.h" +#include "mads/mads.h" +#include "mads/rails.h" + +namespace MADS { + +WalkNode::WalkNode() { + _active = false; + Common::fill(&_distances[0], &_distances[MAX_ROUTE_NODES], 0); +} + +void WalkNode::load(Common::SeekableReadStream *f) { + _walkPos.x = f->readSint16LE(); + _walkPos.y = f->readSint16LE(); + for (int i = 0; i < MAX_ROUTE_NODES; ++i) + _distances[i] = f->readUint16LE(); +} + +/*------------------------------------------------------------------------*/ + +Rails::Rails() { + _depthSurface = nullptr; + _routeLength = 0; +} + +void Rails::load(const WalkNodeList &nodes, DepthSurface *depthSurface, int depthStyle) { + // Store the depth surface and depth style to use + _depthSurface = depthSurface; + _depthStyle = depthStyle; + + // Load the passed node list + _nodes.clear(); + + for (uint i = 0; i < nodes.size(); ++i) + _nodes.push_back(nodes[i]); + + // Add two more empty nodes for the start and end points of any walk sequence + _nodes.push_back(WalkNode()); + _nodes.push_back(WalkNode()); +} + + +void Rails::setupRoute(bool bitFlag, const Common::Point &srcPos, const Common::Point &destPos) { + // Reset the nodes in as being inactive + for (uint i = 0; i < _nodes.size(); ++i) + _nodes[i]._active = false; + + // Set the two extra walk nodes to the start and destination positions + setNodePosition(_nodes.size() - 2, srcPos); + setNodePosition(_nodes.size() - 1, destPos); + + // Start constructing route node list + _routeLength = 0x3FFF; + _routeIndexes.clear(); + + // Recursively form a route from the destination walk node back to the player's position + setupRouteNode(&_tempRoute[0], _nodes.size() - 1, bitFlag ? 0xC000 : 0x8000, 0); + + _next = 0; + if (_routeIndexes.size() > 0) { + Common::Point currPos = srcPos; + for (int routeCtr = size() - 1; (routeCtr >= 0) && (_next == 0); --routeCtr) { + int idx = _routeIndexes[routeCtr]; + const Common::Point &pt = _nodes[idx]._walkPos; + + _next = scanPath(currPos, pt); + currPos = pt; + } + } +} + +void Rails::setupRouteNode(int *routeIndexP, int nodeIndex, int flags, int routeLength) { + WalkNode ¤tNode = _nodes[nodeIndex]; + currentNode._active = true; + + *routeIndexP++ = nodeIndex; + + // Get the index of the ultimate source position (the player) + int subIndex = _nodes.size() - 2; + + int distanceVal = _nodes[nodeIndex]._distances[subIndex]; + if (distanceVal & flags) { + routeLength += distanceVal & 0x3FFF; + if (routeLength < _routeLength) { + // Found a new shorter route to destination, so set up the route with the found one + _routeIndexes.clear(); + for (int i = 0; routeIndexP != &_tempRoute[i]; ++i) + _routeIndexes.push(_tempRoute[i]); + _routeLength = routeLength; + } + } else { + for (int idx = _nodes.size() - 2; idx > 0; --idx) { + int nodePos = idx - 1; + if (!_nodes[nodePos]._active && ((currentNode._distances[nodePos] & flags) != 0)) + setupRouteNode(routeIndexP, nodePos, 0x8000, distanceVal & 0x3fff); + } + } + + currentNode._active = false; +} + + +int Rails::scanPath(const Common::Point &srcPos, const Common::Point &destPos) { + // For compressed depth surfaces, always return 0 + if (_depthStyle != 2) + return 0; + + int yDiff = destPos.y - srcPos.y; + int yAmount = MADS_SCREEN_WIDTH; + + if (yDiff < 0) { + yDiff = -yDiff; + yAmount = -yAmount; + } + + int xDiff = destPos.x - srcPos.y; + int xDirection = 1; + int xAmount = 0; + if (xDiff < 0) { + xDiff = -xDiff; + xDirection = -xDirection; + xAmount = MIN(yDiff, xDiff); + } + + ++xDiff; + ++yDiff; + + const byte *srcP = _depthSurface->getBasePtr(srcPos.x, srcPos.y); + int index = xAmount; + + // Outer horizontal movement loop + for (int yIndex = 0; yIndex < yDiff; ++yIndex) { + index += yDiff; + int v = (*srcP & 0x7F) >> 4; + if (v) + return v; + + // Inner loop for handling vertical movement + while (index >= xDiff) { + index -= xDiff; + + v = (*srcP & 0x7F) >> 4; + if (v) + return v; + + srcP += yAmount; + } + + srcP += xDirection; + } + + return 0; +} + +void Rails::resetRoute() { + _routeIndexes.clear(); + _next = 0; +} + +const WalkNode &Rails::popNode() { + assert(!_routeIndexes.empty()); + + return _nodes[_routeIndexes.pop()]; +} + +void Rails::setNodePosition(int nodeIndex, const Common::Point &pt) { + int flags, hypotenuse; + + _nodes[nodeIndex]._walkPos = pt; + + // Recalculate inter-node lengths + for (uint idx = 0; idx < _nodes.size(); ++idx) { + int entry; + if (idx == (uint)nodeIndex) { + entry = 0x3FFF; + } + else { + // Process the node + flags = getRouteFlags(pt, _nodes[idx]._walkPos); + + int xDiff = ABS(_nodes[idx]._walkPos.x - pt.x); + int yDiff = ABS(_nodes[idx]._walkPos.y - pt.y); + hypotenuse = sqrt((double)(xDiff * xDiff + yDiff * yDiff)); + + if (hypotenuse >= 0x3FFF) + // Shouldn't ever be this large + hypotenuse = 0x3FFF; + + entry = hypotenuse | flags; + _nodes[idx]._distances[nodeIndex] = entry; + _nodes[nodeIndex]._distances[idx] = entry; + } + } +} + +int Rails::getRouteFlags(const Common::Point &src, const Common::Point &dest) { + int result = 0x8000; + bool flag = false; + + int xDiff = ABS(dest.x - src.x); + int yDiff = ABS(dest.y - src.y); + int xDirection = dest.x >= src.x ? 1 : -1; + int yDirection = dest.y >= src.y ? _depthSurface->w : -_depthSurface->w; + int majorDiff = 0; + if (dest.x < src.x) + majorDiff = MAX(xDiff, yDiff); + ++xDiff; + ++yDiff; + + byte *srcP = _depthSurface->getBasePtr(src.x, src.y); + + int totalCtr = majorDiff; + for (int xCtr = 0; xCtr < xDiff; ++xCtr, srcP += xDirection) { + totalCtr += yDiff; + + if ((*srcP & 0x80) == 0) + flag = false; + else if (!flag) { + flag = true; + result -= 0x4000; + if (result == 0) + break; + } + + while (totalCtr >= xDiff) { + totalCtr -= xDiff; + + if ((*srcP & 0x80) == 0) + flag = false; + else if (!flag) { + flag = true; + result -= 0x4000; + if (result == 0) + break; + } + + srcP += yDirection; + } + if (result == 0) + break; + } + + return result; +} + + +} // End of namespace MADS diff --git a/engines/mads/rails.h b/engines/mads/rails.h new file mode 100644 index 0000000000..026eddae1f --- /dev/null +++ b/engines/mads/rails.h @@ -0,0 +1,128 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_RAILS_H +#define MADS_RAILS_H + +#include "common/scummsys.h" +#include "common/array.h" +#include "common/rect.h" +#include "common/stack.h" +#include "mads/msurface.h" + +namespace MADS { + +class WalkNode { +public: + Common::Point _walkPos; + int _distances[MAX_ROUTE_NODES]; + bool _active; + + /** + * Constructor + */ + WalkNode(); + + /** + * Loads the scene node + */ + void load(Common::SeekableReadStream *f); +}; +typedef Common::Array WalkNodeList; + +/** + * This class handles storing the intermediate walk node points for a + * given scene, and calculating walking routes between any two positions. + */ +class Rails { +private: + WalkNodeList _nodes; + DepthSurface *_depthSurface; + int _depthStyle; + int _routeLength; + int _next; + int _routeOffset; + int _tempRoute[MAX_ROUTE_NODES]; + Common::Stack _routeIndexes; +private: + /** + * Change the position of a walking node. Doing so causes a recalculation of the + * distance between it and every other node, and vice versa + */ + void setNodePosition(int nodeIndex, const Common::Point &pt); + + int getRouteFlags(const Common::Point &src, const Common::Point &dest); +public: + /** + * Constructor + */ + Rails(); + + /** + * Loads the scene data for the list of intermediate walk nodes and the + * depth surface to use. + * @param nodes Intermediate walk-points + * @param depthSurface Depth surface to use + */ + void load(const WalkNodeList &nodes, DepthSurface *depthSurface, int depthStyle); + + /** + * Set up a route between two points in a scene + */ + void setupRoute(bool bitFlag, const Common::Point &srcPos, const Common::Point &destPos); + + void setupRouteNode(int *routeIndexP, int nodeIndex, int flags, int routeLength); + + /** + * Resets any currently running route + */ + void resetRoute(); + + /** + * Scans along an edge connecting two points within the depths/walk surface, and returns the information of the first + * pixel high nibble encountered with a non-zero value + */ + int scanPath(const Common::Point &srcPos, const Common::Point &destPos); + + /* + * Return the number of walk nodes in the calculated route + */ + int size() const { return _routeIndexes.size(); } + + /** + * Returns true if the current calculated walk route is empty + */ + bool empty() const { return _routeIndexes.empty(); } + + /** + * Returns the data for a given walk node + */ + const WalkNode &operator[](int idx) { return _nodes[_routeIndexes[idx]]; } + + const WalkNode &popNode(); + + void resetNext() { _next = 0; } +}; + +} // End of namespace MADS + +#endif /* MADS_RAILS_H */ diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index b8b8888e53..83c059444d 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -132,13 +132,7 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) { initPaletteAnimation(_sceneInfo->_palAnimData, false); // Copy over nodes - _nodes.clear(); - for (uint i = 0; i < _sceneInfo->_nodes.size(); ++i) - _nodes.push_back(_sceneInfo->_nodes[i]); - - // Add two more empty nodes for the start and end points of any walk sequence - _nodes.push_back(SceneNode()); - _nodes.push_back(SceneNode()); + _rails.load(_sceneInfo->_nodes, &_depthSurface, _sceneInfo->_depthStyle); // Load hotspots loadHotspots(); diff --git a/engines/mads/scene.h b/engines/mads/scene.h index 7b5d791d12..1caba12851 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -33,6 +33,7 @@ #include "mads/msurface.h" #include "mads/scene_data.h" #include "mads/animation.h" +#include "mads/rails.h" #include "mads/sequence.h" #include "mads/sprites.h" #include "mads/user_interface.h" @@ -92,6 +93,7 @@ public: Common::Array _activeVocabs; SequenceList _sequences; KernelMessages _kernelMessages; + Rails _rails; Common::String _talkFont; int _textSpacing; Hotspots _hotspots; @@ -106,7 +108,6 @@ public: int _animCount; Common::Array _animTicksList; Common::Array _animPalData; - SceneNodeList _nodes; Common::StringArray _vocabStrings; Animation *_animationData; Animation *_activeAnimation; diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index 5b5c47f402..abe0b7bf21 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -30,15 +30,6 @@ namespace MADS { -void SceneNode::load(Common::SeekableReadStream *f) { - _walkPos.x = f->readSint16LE(); - _walkPos.y = f->readSint16LE(); - for (int i = 0; i < MAX_ROUTE_NODES; ++i) - _indexes[i] = f->readUint16LE(); -} - -/*------------------------------------------------------------------------*/ - KernelMessage::KernelMessage() { _flags = 0; _sequenceIndex = 0; @@ -97,87 +88,6 @@ void SceneInfo::SpriteInfo::load(Common::SeekableReadStream *f) { _scale = f->readByte(); } -void SceneInfo::setRouteNode(int nodeIndex, const Common::Point &pt, MSurface &depthSurface) { - int flags, hypotenuse; - - _nodes[nodeIndex]._walkPos = pt; - - // Recalculate inter-node lengths - for (uint idx = 0; idx < _nodes.size(); ++idx) { - int entry; - if (idx == (uint)nodeIndex) { - entry = 0x3FFF; - } - else { - // Process the node - flags = getRouteFlags(pt, _nodes[idx]._walkPos, depthSurface); - - int xDiff = ABS(_nodes[idx]._walkPos.x - pt.x); - int yDiff = ABS(_nodes[idx]._walkPos.y - pt.y); - hypotenuse = sqrt((double)(xDiff * xDiff + yDiff * yDiff)); - - if (hypotenuse >= 0x3FFF) - // Shouldn't ever be this large - hypotenuse = 0x3FFF; - - entry = hypotenuse | flags; - _nodes[idx]._indexes[nodeIndex] = entry; - _nodes[nodeIndex]._indexes[idx] = entry; - } - } -} - -int SceneInfo::getRouteFlags(const Common::Point &src, const Common::Point &dest, - MSurface &depthSurface) { - int result = 0x8000; - bool flag = false; - - int xDiff = ABS(dest.x - src.x); - int yDiff = ABS(dest.y - src.y); - int xDirection = dest.x >= src.x ? 1 : -1; - int yDirection = dest.y >= src.y ? depthSurface.w : -depthSurface.w; - int majorDiff = 0; - if (dest.x < src.x) - majorDiff = MAX(xDiff, yDiff); - ++xDiff; - ++yDiff; - - byte *srcP = depthSurface.getBasePtr(src.x, src.y); - - int totalCtr = majorDiff; - for (int xCtr = 0; xCtr < xDiff; ++xCtr, srcP += xDirection) { - totalCtr += yDiff; - - if ((*srcP & 0x80) == 0) - flag = false; - else if (!flag) { - flag = true; - result -= 0x4000; - if (result == 0) - break; - } - - while (totalCtr >= xDiff) { - totalCtr -= xDiff; - - if ((*srcP & 0x80) == 0) - flag = false; - else if (!flag) { - flag = true; - result -= 0x4000; - if (result == 0) - break; - } - - srcP += yDirection; - } - if (result == 0) - break; - } - - return result; -} - /*------------------------------------------------------------------------*/ SceneInfo *SceneInfo::init(MADSEngine *vm) { @@ -225,7 +135,7 @@ void SceneInfo::load(int sceneId, int v1, const Common::String &resName, // Load the set of objects that are associated with the scene for (int i = 0; i < 20; ++i) { - SceneNode node; + WalkNode node; node.load(infoStream); if (i < nodeCount) diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index d7c008b66d..33c053f8ec 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -34,6 +34,7 @@ #include "mads/game_data.h" #include "mads/hotspots.h" #include "mads/messages.h" +#include "mads/rails.h" #include "mads/user_interface.h" namespace MADS { @@ -116,25 +117,6 @@ struct ARTHeader { void load(Common::SeekableReadStream *f); }; -class SceneNode { -public: - Common::Point _walkPos; - int _indexes[MAX_ROUTE_NODES]; - bool _active; - - /** - * Constructor - */ - SceneNode() : _active(false) {} - - /** - * Loads the scene node - */ - void load(Common::SeekableReadStream *f); -}; -typedef Common::Array SceneNodeList; - - /** * Handles general data for a given scene */ @@ -179,7 +161,7 @@ public: int _usageIndex; Common::Array _palAnimData; - SceneNodeList _nodes; + WalkNodeList _nodes; public: /** * Destructor @@ -197,11 +179,6 @@ public: void load(int sceneId, int flags, const Common::String &resName, int v3, MSurface &depthSurface, MSurface &bgSurface); - /** - * Set up a route node - */ - void setRouteNode(int nodeIndex, const Common::Point &pt, MSurface &depthSurface); - /** * Loads the given surface with depth information of a given scene */ -- cgit v1.2.3 From 87c97a1bcba272245865b8f221ed38d7e7b29e12 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 29 Mar 2014 22:31:55 +0100 Subject: MADS: Implement two stubs in scene 207 (which is now complete) --- engines/mads/nebular/nebular_scenes2.cpp | 32 +++++++++++++++++++++++--------- engines/mads/nebular/nebular_scenes2.h | 8 ++++++-- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 61ce589b5a..f00aae4873 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -1250,9 +1250,8 @@ void Scene207::enter() { if (_vultureFl) { _globals._spriteIndexes[16] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 30, 0, 0, 400); _vultureTime = _game._player._priorTimer; - - int idx = _scene->_dynamicHotspots.add(389, 13, _globals._spriteIndexes[16], Common::Rect(0, 0, 0, 0)); - _scene->_dynamicHotspots.setPosition(idx, 254, 94, FACING_WEST); + _vultureHotspotId = _scene->_dynamicHotspots.add(389, 13, _globals._spriteIndexes[16], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(_vultureHotspotId, 254, 94, FACING_WEST); } if (_spiderFl) { @@ -1280,14 +1279,29 @@ void Scene207::enter() { _scene->_sequences.addSubEntry(_globals._spriteIndexes[21], SM_0, 0, 70); } +void Scene207::moveVulture() { + _scene->_sequences.remove(_globals._spriteIndexes[16]); + _globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 7, 1, 0, 0); + _vm->_sound->command(43); + _vultureFl = false; + _vultureTime = _game._player._priorTimer; + _scene->_dynamicHotspots.remove(_vultureHotspotId); +} + +void Scene207::moveSpider() { + _scene->_sequences.remove(_globals._spriteIndexes[19]); + _globals._spriteIndexes[19] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 5, 1, 0, 0); + _spiderFl = false; + _spiderTime = _game._player._priorTimer; + _scene->_dynamicHotspots.remove(_spiderHotspotId); +} + void Scene207::step() { - if (!_vultureFl) { - warning("TODO: sub3AD90(...)"); - } + if (!_vultureFl) + moveVulture(); - if (_spiderFl) { - warning("TODO: sub3ADD6(...)"); - } + if (_spiderFl) + moveSpider(); if (_game._trigger == 70) { _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 10, 0, 0, 0); diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index 1c19ae4d93..84cd245000 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -114,10 +114,14 @@ public: class Scene207: public Scene2xx { bool _vultureFl, _spiderFl, _eyeFl; - int _spiderHotspotId; + int _spiderHotspotId, _vultureHotspotId; int32 _spiderTime, _vultureTime; + + void moveVulture(); + void moveSpider(); + public: - Scene207(MADSEngine *vm) : Scene2xx(vm), _vultureFl(false), _spiderFl(false), _spiderHotspotId(-1), _spiderTime(0), _vultureTime(0) {} + Scene207(MADSEngine *vm) : Scene2xx(vm), _vultureFl(false), _spiderFl(false), _spiderHotspotId(-1), _vultureHotspotId(-1), _spiderTime(0), _vultureTime(0) {} virtual void setup(); virtual void enter(); virtual void step(); -- cgit v1.2.3 From 03af091a16c937844eb3bd33f7870de79e1cc8b5 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 29 Mar 2014 22:47:21 +0100 Subject: MADS: Remove some magic values related to verbs --- engines/mads/action.cpp | 4 ++-- engines/mads/nebular/nebular_scenes2.cpp | 2 +- engines/mads/scene_data.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index c762b9b993..240b493930 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -58,7 +58,7 @@ void MADSAction::clear() { _hotspotId = -1; _v86F3A = -1; _v86F4C = -1; - _action._verbId = -1; + _action._verbId = VERB_NONE; _action._objectNameId = -1; _action._indirectObjectId = -1; _textChanged = true; @@ -89,7 +89,7 @@ void MADSAction::set() { bool flag = false; _statusText = ""; - _action._verbId = -1; + _action._verbId = VERB_NONE; _action._objectNameId = -1; _action._indirectObjectId = -1; diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index f00aae4873..79143a935d 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -492,7 +492,7 @@ void Scene202::step() { if (_globals[kMeteorologistWatch] == 1) { MADSAction *action = _game._player._action; - action->_activeAction._verbId = 3; + action->_activeAction._verbId = VERB_LOOK; action->_activeAction._objectNameId = 39; action->_activeAction._indirectObjectId = 438; _game._triggerSetupMode = KERNEL_TRIGGER_PARSER; diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index abe0b7bf21..4c19202f4b 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -42,7 +42,7 @@ KernelMessage::KernelMessage() { _timeout = 0; _trigger = 0; _abortMode = KERNEL_TRIGGER_PARSER; - _actionDetails._verbId = 0; + _actionDetails._verbId = VERB_NONE; _actionDetails._objectNameId = 0; _actionDetails._indirectObjectId = 0; } -- cgit v1.2.3 From 0f3d4c02ad6bc3e81381e0efea4c66fba7f8a018 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 30 Mar 2014 00:01:29 +0100 Subject: MADS: Implement Scene208::updateTrap() --- engines/mads/nebular/nebular_scenes2.cpp | 38 ++++++++++++++++++++++++++++---- engines/mads/nebular/nebular_scenes2.h | 9 ++++++++ 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 79143a935d..9421eaee5f 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -804,8 +804,8 @@ void Scene202::actions() { _game._player._visible = false; _game._player._stepEnabled = false; - int idx = _scene->_dynamicHotspots.add(199, 79, -1, Common::Rect(241, 68, 12, 54)); - _ladderHotspotId = _scene->_dynamicHotspots.setPosition(idx, 246, 124, FACING_NORTH); + _ladderHotspotId = _scene->_dynamicHotspots.add(199, 79, -1, Common::Rect(241, 68, 12, 54)); + _scene->_dynamicHotspots.setPosition(_ladderHotspotId, 246, 124, FACING_NORTH); _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 6, 1, 0, 0); _scene->_sequences.setDepth(_globals._spriteIndexes[23], 1); _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 1); @@ -1408,6 +1408,36 @@ void Scene208::setup() { _scene->addActiveVocab(NOUN_D); } +void Scene208::updateTrap() { + if (_globals[kRhotundaStatus] == 1) { + _globals._spriteIndexes[16] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 8, 0, 0, 24); + _scene->_sequences.setDepth(_globals._spriteIndexes[16], 5); + int idx = _scene->_dynamicHotspots.add(424, 13, _globals._spriteIndexes[16], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, 100, 146, FACING_NORTH); + _scene->_hotspots.activate(414, false); + return; + } + + switch (_globals[35]) { + case 0: { + _globals._spriteIndexes[17] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 1); + _scene->_sequences.setDepth(_globals._spriteIndexes[17], 15); + int idx = _scene->_dynamicHotspots.add(426, 13, _globals._spriteIndexes[17], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, 60, 152, FACING_NORTH); + } + break; + case 2: { + _scene->_sequences.setDepth(_globals._spriteIndexes[18], 15); + _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); + _scene->_hotspots.activate(414, false); + int idx = _scene->_dynamicHotspots.add(425, 13, _globals._spriteIndexes[17], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, 100, 146, FACING_NORTH); + _scene->_dynamicHotspots[idx]._articleNumber = 5; + } + break; + } +} + void Scene208::enter() { _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('a', 1), 0); _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 0), 0); @@ -1415,7 +1445,7 @@ void Scene208::enter() { _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('x', 2), 0); _globals._spriteIndexes[5] = _scene->_sprites.addSprites("*RXMBD_8"); - warning("TODO: sub34648()"); + updateTrap(); _globals._v0 = 0; _globals._frameTime = 0; @@ -1479,7 +1509,7 @@ void Scene208::step() { if ((_game._trigger & 0xFF) == 81) { _scene->_sequences.remove(_globals._spriteIndexes[15]); _globals[kRhotundaStatus] = 1; - warning("TODO: sub34648(...)"); + updateTrap(); _scene->_sequences.addTimer(90, 82); } } else { diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index 84cd245000..21d1028911 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -50,7 +50,9 @@ public: }; class Scene201: public Scene2xx { +private: bool _pterodactylFlag; + public: Scene201(MADSEngine *vm) : Scene2xx(vm), _pterodactylFlag(false) {} virtual void setup(); @@ -89,6 +91,7 @@ public: class Scene203: public Scene2xx { private: bool _rhotundaEat2Fl, _rhotundaEatFl; + public: Scene203(MADSEngine *vm) : Scene2xx(vm), _rhotundaEat2Fl(false), _rhotundaEatFl(false) {} virtual void setup(); @@ -100,7 +103,9 @@ public: }; class Scene205: public Scene2xx { +private: uint32 _lastFishTime, _chickenTime; + public: Scene205(MADSEngine *vm) : Scene2xx(vm), _lastFishTime(0), _chickenTime(0) {} @@ -113,6 +118,7 @@ public: }; class Scene207: public Scene2xx { +private: bool _vultureFl, _spiderFl, _eyeFl; int _spiderHotspotId, _vultureHotspotId; int32 _spiderTime, _vultureTime; @@ -131,6 +137,9 @@ public: }; class Scene208: public Scene2xx { +private: + void updateTrap(); + public: Scene208(MADSEngine *vm) : Scene2xx(vm) {} virtual void setup(); -- cgit v1.2.3 From 32b9530789e1c308e3afe849c27c21285dfe1ab3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 29 Mar 2014 19:26:05 -0400 Subject: MADS: Fixes for the pathfinder --- engines/mads/rails.cpp | 13 +++++++------ engines/mads/rails.h | 2 +- engines/mads/scene_data.h | 3 --- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/engines/mads/rails.cpp b/engines/mads/rails.cpp index 0baaa12793..4daa774023 100644 --- a/engines/mads/rails.cpp +++ b/engines/mads/rails.cpp @@ -114,7 +114,7 @@ void Rails::setupRouteNode(int *routeIndexP, int nodeIndex, int flags, int route for (int idx = _nodes.size() - 2; idx > 0; --idx) { int nodePos = idx - 1; if (!_nodes[nodePos]._active && ((currentNode._distances[nodePos] & flags) != 0)) - setupRouteNode(routeIndexP, nodePos, 0x8000, distanceVal & 0x3fff); + setupRouteNode(routeIndexP, nodePos, 0x8000, routeLength + distanceVal & 0x3fff); } } @@ -209,9 +209,10 @@ void Rails::setNodePosition(int nodeIndex, const Common::Point &pt) { hypotenuse = 0x3FFF; entry = hypotenuse | flags; - _nodes[idx]._distances[nodeIndex] = entry; - _nodes[nodeIndex]._distances[idx] = entry; } + + _nodes[idx]._distances[nodeIndex] = entry; + _nodes[nodeIndex]._distances[idx] = entry; } } @@ -223,15 +224,15 @@ int Rails::getRouteFlags(const Common::Point &src, const Common::Point &dest) { int yDiff = ABS(dest.y - src.y); int xDirection = dest.x >= src.x ? 1 : -1; int yDirection = dest.y >= src.y ? _depthSurface->w : -_depthSurface->w; - int majorDiff = 0; + int minorDiff = 0; if (dest.x < src.x) - majorDiff = MAX(xDiff, yDiff); + minorDiff = MIN(xDiff, yDiff); ++xDiff; ++yDiff; byte *srcP = _depthSurface->getBasePtr(src.x, src.y); - int totalCtr = majorDiff; + int totalCtr = minorDiff; for (int xCtr = 0; xCtr < xDiff; ++xCtr, srcP += xDirection) { totalCtr += yDiff; diff --git a/engines/mads/rails.h b/engines/mads/rails.h index 026eddae1f..55f6f8b72e 100644 --- a/engines/mads/rails.h +++ b/engines/mads/rails.h @@ -34,7 +34,7 @@ namespace MADS { class WalkNode { public: Common::Point _walkPos; - int _distances[MAX_ROUTE_NODES]; + uint16 _distances[MAX_ROUTE_NODES]; bool _active; /** diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index 33c053f8ec..81c24ed8ab 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -130,9 +130,6 @@ class SceneInfo { void load(Common::SeekableReadStream *f); }; - - - int getRouteFlags(const Common::Point &src, const Common::Point &dest, MSurface &depthSurface); protected: MADSEngine *_vm; -- cgit v1.2.3 From 89af9dde8c412b4d11cd0107fe20f9bbbfd2e3bc Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 29 Mar 2014 22:28:22 -0400 Subject: MADS: Implemented message loading/decoding --- engines/mads/dialogs.cpp | 3 ++- engines/mads/dialogs.h | 1 + engines/mads/game.cpp | 49 +++++++++++++++++++++++++++++++++++ engines/mads/game.h | 1 + engines/mads/nebular/game_nebular.cpp | 2 ++ 5 files changed, 55 insertions(+), 1 deletion(-) diff --git a/engines/mads/dialogs.cpp b/engines/mads/dialogs.cpp index c5e99f859e..04e89fad61 100644 --- a/engines/mads/dialogs.cpp +++ b/engines/mads/dialogs.cpp @@ -342,7 +342,8 @@ Dialogs::Dialogs(MADSEngine *vm): _vm(vm) { } void Dialogs::show(int msgId) { - + Common::StringArray msg = _vm->_game->getMessage(msgId); + warning("%s\n", msg[0].c_str()); } } // End of namespace MADS diff --git a/engines/mads/dialogs.h b/engines/mads/dialogs.h index 3f623a688b..35e4a85926 100644 --- a/engines/mads/dialogs.h +++ b/engines/mads/dialogs.h @@ -190,6 +190,7 @@ public: virtual void showDialog() = 0; virtual void showPicture(int objId, int msgId, int arg3 = 0) = 0; + void show(int msgId); }; diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index f81c752667..33cb52cec9 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -21,7 +21,9 @@ */ #include "common/scummsys.h" +#include "common/memstream.h" #include "mads/mads.h" +#include "mads/compression.h" #include "mads/game.h" #include "mads/game_data.h" #include "mads/events.h" @@ -329,4 +331,51 @@ void Game::loadQuotes() { f.close(); } +Common::StringArray Game::getMessage(uint32 id) { + File f("*MESSAGES.DAT"); + int count = f.readUint16LE(); + + for (int idx = 0; idx < count; ++idx) { + uint32 itemId = f.readUint32LE(); + uint32 offset = f.readUint32LE(); + uint16 size = f.readUint16LE(); + + if (itemId == id) { + // Get the source buffer size + uint16 sizeIn; + if (idx == (count - 1)) { + sizeIn = f.size() - offset; + } else { + f.skip(4); + uint32 nextOffset = f.readUint32LE(); + sizeIn = nextOffset - offset; + } + + // Get the compressed data + f.seek(offset); + byte *bufferIn = new byte[sizeIn]; + f.read(bufferIn, sizeIn); + + // Decompress it + char *bufferOut = new char[size]; + FabDecompressor fab; + fab.decompress(bufferIn, sizeIn, (byte *)bufferOut, size); + + // Form the output string list + Common::StringArray result; + const char *p = bufferOut; + while (p < (bufferOut + size)) { + result.push_back(p); + p += strlen(p) + 1; + } + + delete[] bufferIn; + delete[] bufferOut; + return result; + } + } + + error("Invalid message Id specified"); +} + } // End of namespace MADS diff --git a/engines/mads/game.h b/engines/mads/game.h index 9da2694456..4521ad68c1 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -150,6 +150,7 @@ public: uint32 getQuotesSize() { return _quotes.size(); } const Common::String &getQuote(uint32 index) { return _quotes[index - 1]; } + Common::StringArray getMessage(uint32 id); /** * Standard object handling across the game diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index 34af685981..2c6be6cfc2 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -52,6 +52,8 @@ ProtectionResult GameNebular::checkCopyProtection() { dlg->show(); delete dlg; */ + // Debug + _vm->_dialogs->show(1); // DEBUG: Return that copy protection failed return PROTECTION_SUCCEED; -- cgit v1.2.3 From fc61e79f29e1f9e734fc05a737849f5952450781 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 30 Mar 2014 11:51:36 +0200 Subject: MADS: Implement Scene208::subAction() --- engines/mads/nebular/nebular_scenes2.cpp | 85 ++++++++++++++++++++++++++++++-- engines/mads/nebular/nebular_scenes2.h | 1 + 2 files changed, 82 insertions(+), 4 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 9421eaee5f..ccf2bb5ca2 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -1530,6 +1530,83 @@ void Scene208::preActions() { player._walkOffScreenSceneId = 207; } +void Scene208::subAction(int mode) { + int nextTrigger; + + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 6, 1, 0, 0); + _scene->_sequences.setMsgLayout(_globals._spriteIndexes[20]); + + if ((mode == 1) || (mode == 2)) + nextTrigger = 1; + else + nextTrigger = 2; + + _scene->_sequences.addSubEntry(_globals._spriteIndexes[20], SM_0, 0, nextTrigger); + break; + + case 1: { + int oldVal = _globals._spriteIndexes[20]; + _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 12, 3, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[20], 3, 4); + _scene->_sequences.setMsgLayout(_globals._spriteIndexes[20]); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[20], oldVal); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[20], SM_0, 0, 2); + _vm->_sound->command(20); + } + break; + + case 2: { + switch (mode) { + case 1: + _game._objects.addToInventory(6); + _scene->_sequences.remove(_globals._spriteIndexes[17]); + _globals[kLeavesStatus] = 1; + break; + + case 2: + _game._objects.setRoom(6, 1); + _globals[kLeavesStatus] = 2; + updateTrap(); + break; + + case 3: + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[19] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); + _game._objects.removeFromInventory(10, 1); + _vm->_sound->command(34); + break; + + case 4: + _game._objects.removeFromInventory(1, 1); + _vm->_sound->command(33); + break; + + case 5: + _game._objects.removeFromInventory(2, 1); + _vm->_sound->command(33); + break; + } + + int oldVal = _globals._spriteIndexes[20]; + _globals._spriteIndexes[20] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[5], false, 6, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[20], 1, 3); + _scene->_sequences.setMsgLayout(_globals._spriteIndexes[20]); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[20], oldVal); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[20], SM_0, 0, 3); + } + break; + + case 3: + _game._player._visible = true; + _game._player._stepEnabled = true; + break; + } +} + void Scene208::actions() { if (_action.isAction(0x18C, 0x19F)) { if (_globals[kRhotundaStatus]) @@ -1544,20 +1621,20 @@ void Scene208::actions() { } else if (_action.isAction(0x18C, 0x83)) { _scene->_nextSceneId = 212; } else if (_action.isAction(VERB_TAKE, 0x1AA) && (!_globals[kLeavesStatus] || _game._trigger)) { - warning("TODO: sub3B282(1);"); + subAction(1); if (_game._player._stepEnabled) _vm->_dialogs->showPicture(OBJ_BIG_LEAVES, 0x326, 0); } else if (_action.isAction(VERB_PUT, 0x23, 0x19E) && (_globals[kLeavesStatus] == 1 || _game._trigger)) { - warning("TODO: sub3B282(2);"); + subAction(2); } else if (_action.isAction(VERB_PUT, 0x17A, 0x1A9)) { - warning("TODO: sub3B282(3);"); + subAction(3); if (_game._player._stepEnabled) { _game._player._stepEnabled = false; _globals._v0 = true; _game._player.walk(Common::Point(20, 148), FACING_EAST); } } else if (_action.isAction(VERB_PUT, 0x35, 0x1A9)) { - warning("TODO: sub3B282(4);"); + subAction(4); if (_game._player._stepEnabled) { _vm->_dialogs->show(0x514C); } diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index 21d1028911..6d716657c5 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -139,6 +139,7 @@ public: class Scene208: public Scene2xx { private: void updateTrap(); + void subAction(int mode); public: Scene208(MADSEngine *vm) : Scene2xx(vm) {} -- cgit v1.2.3 From 30b1bd99eb9ddc847c911bc012b14c3fff66ead9 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 30 Mar 2014 12:05:43 +0200 Subject: MADS: Reduce the scope of a variable in scene 208::subAction() --- engines/mads/nebular/nebular_scenes2.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index ccf2bb5ca2..2281568250 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -1531,21 +1531,22 @@ void Scene208::preActions() { } void Scene208::subAction(int mode) { - int nextTrigger; switch (_game._trigger) { - case 0: + case 0: { _game._player._stepEnabled = false; _game._player._visible = false; _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 6, 1, 0, 0); _scene->_sequences.setMsgLayout(_globals._spriteIndexes[20]); + int nextTrigger; if ((mode == 1) || (mode == 2)) nextTrigger = 1; else nextTrigger = 2; _scene->_sequences.addSubEntry(_globals._spriteIndexes[20], SM_0, 0, nextTrigger); + } break; case 1: { @@ -1601,7 +1602,7 @@ void Scene208::subAction(int mode) { break; case 3: - _game._player._visible = true; + _game._player._visible = true; _game._player._stepEnabled = true; break; } -- cgit v1.2.3 From 49310e4a8eb41aa33eab3d75a6bcfb6d0d89333a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 30 Mar 2014 21:16:45 +0200 Subject: MADS: Some more rework in scene 208 --- engines/mads/nebular/nebular_scenes2.cpp | 64 ++++++++++++++------------------ engines/mads/nebular/nebular_scenes2.h | 5 ++- 2 files changed, 31 insertions(+), 38 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 2281568250..e8d8a2826a 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -1447,8 +1447,8 @@ void Scene208::enter() { updateTrap(); - _globals._v0 = 0; - _globals._frameTime = 0; + _rhotundaTurnFl = false; + _boundingFl = false; _scene->_kernelMessages._talkFont = _vm->_font->getFont(FONT_INTERFACE); _scene->_textSpacing = 0; @@ -1479,41 +1479,38 @@ void Scene208::enter() { } void Scene208::step() { - if ((_globals._frameTime & 0xFFFF) && ((_globals._frameTime >> 16) <= _scene->_activeAnimation->getCurrentFrame())) { - _globals._frameTime = (_globals._frameTime & 0xFFFF) | (_scene->_activeAnimation->getCurrentFrame() << 16); + if (_boundingFl && (_rhotundaTime <= _scene->_activeAnimation->getCurrentFrame())) { + _rhotundaTime = _scene->_activeAnimation->getCurrentFrame(); - if (_scene->_activeAnimation->getCurrentFrame() == 125) + if (_rhotundaTime == 125) _scene->_sequences.remove(_globals._spriteIndexes[19]); } - if (_globals._v0 == 0) + if (!_rhotundaTurnFl) return; if ((_game._player._playerPos != Common::Point(20, 148)) || (_game._player._facing != FACING_EAST)) return; - if ((_game._trigger == 0) && ((_globals._frameTime & 0xFFFF) != 0)) + if ((_game._trigger == 0) && _boundingFl) return; - _globals._frameTime |= 0xFFFF; + _boundingFl = true; - if (_game._trigger == 82) { - _game._player._stepEnabled = true; - return; - } - - if (_game._trigger > 82) - return; - - if (_game._trigger & 0xFF) { - if ((_game._trigger & 0xFF) == 81) { - _scene->_sequences.remove(_globals._spriteIndexes[15]); - _globals[kRhotundaStatus] = 1; - updateTrap(); - _scene->_sequences.addTimer(90, 82); - } - } else { + switch (_game._trigger) { + case 0: _scene->loadAnimation(formAnimName('A', -1), 81); + _rhotundaTime = 0; + break; + case 81: + _scene->_sequences.remove(_globals._spriteIndexes[15]); + _globals[kRhotundaStatus] = 1; + updateTrap(); + _scene->_sequences.addTimer(90, 82); + break; + case 82: + _game._player._stepEnabled = true; + break; } } @@ -1539,16 +1536,15 @@ void Scene208::subAction(int mode) { _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 6, 1, 0, 0); _scene->_sequences.setMsgLayout(_globals._spriteIndexes[20]); - int nextTrigger; + int abortVal; if ((mode == 1) || (mode == 2)) - nextTrigger = 1; + abortVal = 1; else - nextTrigger = 2; + abortVal = 2; - _scene->_sequences.addSubEntry(_globals._spriteIndexes[20], SM_0, 0, nextTrigger); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[20], SM_0, 0, abortVal); } break; - case 1: { int oldVal = _globals._spriteIndexes[20]; _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 12, 3, 0, 0); @@ -1559,7 +1555,6 @@ void Scene208::subAction(int mode) { _vm->_sound->command(20); } break; - case 2: { switch (mode) { case 1: @@ -1567,25 +1562,21 @@ void Scene208::subAction(int mode) { _scene->_sequences.remove(_globals._spriteIndexes[17]); _globals[kLeavesStatus] = 1; break; - case 2: _game._objects.setRoom(6, 1); _globals[kLeavesStatus] = 2; updateTrap(); break; - case 3: _scene->_sequences.remove(_globals._spriteIndexes[18]); _globals._spriteIndexes[19] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); _game._objects.removeFromInventory(10, 1); _vm->_sound->command(34); break; - case 4: _game._objects.removeFromInventory(1, 1); _vm->_sound->command(33); break; - case 5: _game._objects.removeFromInventory(2, 1); _vm->_sound->command(33); @@ -1600,7 +1591,6 @@ void Scene208::subAction(int mode) { _scene->_sequences.addSubEntry(_globals._spriteIndexes[20], SM_0, 0, 3); } break; - case 3: _game._player._visible = true; _game._player._stepEnabled = true; @@ -1631,7 +1621,7 @@ void Scene208::actions() { subAction(3); if (_game._player._stepEnabled) { _game._player._stepEnabled = false; - _globals._v0 = true; + _rhotundaTurnFl = true; _game._player.walk(Common::Point(20, 148), FACING_EAST); } } else if (_action.isAction(VERB_PUT, 0x35, 0x1A9)) { @@ -1640,7 +1630,7 @@ void Scene208::actions() { _vm->_dialogs->show(0x514C); } } else if (_action.isAction(VERB_PUT, 0x65, 0x1A9)) { - warning("TODO: sub3B282(5);"); + subAction(5); if (_game._player._stepEnabled) { _vm->_dialogs->show(0x514C); } diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index 6d716657c5..a749e8afcb 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -138,11 +138,14 @@ public: class Scene208: public Scene2xx { private: + bool _rhotundaTurnFl, _boundingFl; + int32 _rhotundaTime; + void updateTrap(); void subAction(int mode); public: - Scene208(MADSEngine *vm) : Scene2xx(vm) {} + Scene208(MADSEngine *vm) : Scene2xx(vm), _rhotundaTurnFl(false), _boundingFl(false), _rhotundaTime(0) {} virtual void setup(); virtual void enter(); virtual void step(); -- cgit v1.2.3 From 57f1c6e9d9ff82513205a1dc8ec05c335486759f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 30 Mar 2014 21:10:07 -0400 Subject: MADS: Implemented message parser for action dialog display --- engines/mads/action.cpp | 2 +- engines/mads/action.h | 2 +- engines/mads/dialogs.cpp | 41 ++++--- engines/mads/dialogs.h | 75 +++++++------ engines/mads/nebular/dialogs_nebular.cpp | 177 +++++++++++++++++++++++++++++++ engines/mads/nebular/dialogs_nebular.h | 14 ++- engines/mads/nebular/game_nebular.cpp | 2 - 7 files changed, 262 insertions(+), 51 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index 240b493930..35e989bf98 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -285,7 +285,7 @@ void MADSAction::startAction() { // Copy the action to be active _activeAction = _action; - _dialogTitle = _statusText; + _sentence = _statusText; if ((_actionMode2 == ACTIONMODE2_4) && (_v86F42 == 0)) _v8453A = -1; diff --git a/engines/mads/action.h b/engines/mads/action.h index 4f748f24c9..e7a33230a4 100644 --- a/engines/mads/action.h +++ b/engines/mads/action.h @@ -83,7 +83,6 @@ class MADSAction { private: MADSEngine *_vm; Common::String _statusText; - Common::String _dialogTitle; void appendVocab(int vocabId, bool capitalise = false); @@ -101,6 +100,7 @@ public: int _statusTextIndex; int _hotspotId; ActionSavedFields _savedFields; + Common::String _sentence; // Unknown fields int16 _v86F3A; diff --git a/engines/mads/dialogs.cpp b/engines/mads/dialogs.cpp index 04e89fad61..1215df36ae 100644 --- a/engines/mads/dialogs.cpp +++ b/engines/mads/dialogs.cpp @@ -157,6 +157,10 @@ void TextDialog::underlineLine() { _lineXp[_numLines] |= 0x80; } +void TextDialog::downPixelLine() { + _lineXp[_numLines] |= 0x40; +} + void TextDialog::incNumLines() { _lineWidth = 0; _currentX = 0; @@ -234,6 +238,18 @@ void TextDialog::addInput() { incNumLines(); } +void TextDialog::addBarLine() { + if (_lineWidth > 0 || _currentX > 0) + incNumLines(); + + _lineXp[_numLines] = 0xFF; + incNumLines(); +} + +void TextDialog::setLineXp(int xp) { + _lineXp[_numLines] = xp; +} + void TextDialog::draw() { if (!_lineWidth) --_numLines; @@ -302,6 +318,16 @@ void TextDialog::restorePalette() { _vm->_palette->setPalette(_vm->_palette->_mainPalette, 248, 8); } +void TextDialog::show() { + draw(); + _vm->_events->showCursor(); + + while (!_vm->shouldQuit() && !_vm->_events->_keyPressed && + !_vm->_events->_mouseClicked) { + _vm->_events->delay(1); + } +} + /*------------------------------------------------------------------------*/ MessageDialog::MessageDialog(MADSEngine *vm, int maxChars, ...): @@ -318,16 +344,6 @@ MessageDialog::MessageDialog(MADSEngine *vm, int maxChars, ...): va_end(va); } -void MessageDialog::show() { - draw(); - _vm->_events->showCursor(); - - while (!_vm->shouldQuit() && !_vm->_events->_keyPressed && - !_vm->_events->_mouseClicked) { - _vm->_events->delay(1); - } -} - /*------------------------------------------------------------------------*/ Dialogs *Dialogs::init(MADSEngine *vm) { @@ -341,9 +357,4 @@ Dialogs::Dialogs(MADSEngine *vm): _vm(vm) { _pendingDialog = DIALOG_NONE; } -void Dialogs::show(int msgId) { - Common::StringArray msg = _vm->_game->getMessage(msgId); - warning("%s\n", msg[0].c_str()); -} - } // End of namespace MADS diff --git a/engines/mads/dialogs.h b/engines/mads/dialogs.h index 35e4a85926..fe6041eca1 100644 --- a/engines/mads/dialogs.h +++ b/engines/mads/dialogs.h @@ -85,16 +85,6 @@ enum { class TextDialog: protected Dialog { private: - /** - * Increments the number of text lines the text dialog uses - */ - void incNumLines(); - - /** - * Flags the previously added line to be underlined - */ - void underlineLine(); - /** * Append text to the currently end line. */ @@ -116,21 +106,6 @@ protected: Common::String _lines[TEXT_DIALOG_MAX_LINES]; int _lineXp[TEXT_DIALOG_MAX_LINES]; byte _savedPalette[8 * 3]; - - /** - * Add a new line to the dialog - */ - void addLine(const Common::String &line, bool underline = false); - - /** - * Adds one or more lines, word wrapping the passed text - */ - void wordWrap(const Common::String &line); - - /** - * Adds an input area following previously added text - */ - void addInput(); public: /** * Constructor @@ -156,6 +131,48 @@ public: * Draw the dialog along with any input box */ void drawWithInput(); + + /** + * Add a new line to the dialog + */ + void addLine(const Common::String &line, bool underline = false); + + /** + * Adds one or more lines, word wrapping the passed text + */ + void wordWrap(const Common::String &line); + + /** + * Increments the number of text lines the text dialog uses + */ + void incNumLines(); + + /** + * Adds an input area following previously added text + */ + void addInput(); + + /** + * Adds a bar line to separate sections of text + */ + void addBarLine(); + + /** + * Flags the previously added line to be underlined + */ + void underlineLine(); + + void downPixelLine(); + + /** + * Set the x position for the given line + */ + void setLineXp(int xp); + + /** + * Show the dialog, and wait until a key or mouse press. + */ + void show(); }; class MessageDialog: protected TextDialog { @@ -163,11 +180,6 @@ public: MessageDialog(MADSEngine *vm, int lines, ...); virtual ~MessageDialog() {} - - /** - * Show the dialog, and wait until a key or mouse press. - */ - void show(); }; enum DialogId { @@ -185,13 +197,14 @@ public: public: Common::Point _defaultPosition; DialogId _pendingDialog; + int _indexList[10]; virtual ~Dialogs() {} virtual void showDialog() = 0; virtual void showPicture(int objId, int msgId, int arg3 = 0) = 0; - void show(int msgId); + virtual bool show(int msgId) = 0; }; } // End of namespace MADS diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp index 6dabbec1b9..fea5fa5b75 100644 --- a/engines/mads/nebular/dialogs_nebular.cpp +++ b/engines/mads/nebular/dialogs_nebular.cpp @@ -22,9 +22,11 @@ #include "common/scummsys.h" #include "common/config-manager.h" +#include "common/util.h" #include "mads/mads.h" #include "mads/screen.h" #include "mads/msurface.h" +#include "mads/staticres.h" #include "mads/nebular/dialogs_nebular.h" namespace MADS { @@ -112,6 +114,181 @@ bool CopyProtectionDialog::getHogAnusEntry(HOGANUS &entry) { return true; } +/*------------------------------------------------------------------------*/ + +bool DialogsNebular::show(int msgId) { + MADSAction &action = _vm->_game->_scene._action; + Common::StringArray msg = _vm->_game->getMessage(msgId); + Common::String title; + Common::String commandText; + Common::String valStr; + Common::String dialogText; + bool result = true; + bool centerFlag; + bool underlineFlag; + bool commandFlag; + bool crFlag; + TextDialog *dialog = nullptr; + _dialogWidth = 17; + _capitalizationMode = kUppercase; + + // Loop through the lines of the returned text + for (uint idx = 0; idx < msg.size(); ++idx) { + Common::String srcLine = msg[idx]; + + const char *srcP = srcLine.c_str(); + commandFlag = false; + underlineFlag = false; + centerFlag = false; + crFlag = false; + + // Loop through the text of the line + while (srcP < srcLine.c_str() + srcLine.size()) { + if (*srcP == '[') { + // Starting a command + commandText = ""; + commandFlag = true; + } else if (*srcP == ']') { + // Ending a command + if (commandFlag) { + if (commandCheck("CENTER", valStr, commandText)) { + centerFlag = true; + } else if (commandCheck("TITLE", valStr, commandText)) { + centerFlag = true; + underlineFlag = true; + crFlag = true; + int v = atoi(valStr.c_str()); + if (v != 0) + _dialogWidth = v; + } else if (commandCheck("CR", valStr, commandText)) { + if (centerFlag) { + crFlag = true; + } else { + dialog = new TextDialog(_vm, FONT_INTERFACE, _defaultPosition, _dialogWidth); + dialog->wordWrap(dialogText); + dialog->incNumLines(); + } + } else if (commandCheck("ASK", valStr, commandText)) { + dialog->addInput(); + } else if (commandCheck("VERB", valStr, commandText)) { + dialogText += getVocab(action._activeAction._verbId); + } else if (commandCheck("INDEX", valStr, commandText)) { + int idx = atoi(valStr.c_str()); + if (_indexList[idx]) + dialogText += getVocab(_indexList[idx]); + } else if (commandCheck("NUMBER", valStr, commandText)) { + int idx = atoi(valStr.c_str()); + dialogText += Common::String::format("%.4d", _indexList[idx]); + } else if (commandCheck("NOUN1", valStr, commandText)) { + if (!textNoun(dialogText, 1, valStr)) + dialogText += getVocab(action._activeAction._objectNameId); + } else if (commandCheck("NOUN2", valStr, commandText)) { + if (!textNoun(dialogText, 2, valStr)) + dialogText += getVocab(action._activeAction._indirectObjectId); + } else if (commandCheck("PREP", valStr, commandText)) { + dialogText += kArticleList[action._savedFields._articleNumber]; + } else if (commandCheck("SENTENCE", valStr, commandText)) { + dialogText += action._sentence; + } else if (commandCheck("WIDTH", valStr, commandText)) { + _dialogWidth = atoi(valStr.c_str()); + } else if (commandCheck("BAR", valStr, commandText)) { + dialog->addBarLine(); + } else if (commandCheck("UNDER", valStr, commandText)) { + underlineFlag = true; + } else if (commandCheck("DOWN", valStr, commandText)) { + dialog->downPixelLine(); + } else if (commandCheck("TAB", valStr, commandText)) { + int xp = atoi(valStr.c_str()); + dialog->setLineXp(xp); + } + } + + commandFlag = false; + } else if (commandFlag) { + // Add the next character to the command + commandText += *srcP; + } else { + // Add to the text to be displayed in the dialog + dialogText += *srcP; + } + + ++srcP; + } + + if (!dialog) { + dialog = new TextDialog(_vm, FONT_INTERFACE, _defaultPosition, _dialogWidth); + } + + if (centerFlag) { + dialog->addLine(dialogText, underlineFlag); + if (crFlag) + dialog->incNumLines(); + } else { + dialog->wordWrap(dialogText); + } + } + + if (!centerFlag) + dialog->incNumLines(); + + // Show the dialog + dialog->show(); + + delete dialog; + return result; +} + +Common::String DialogsNebular::getVocab(int vocabId) { + assert(vocabId > 0); + + Common::String vocab = _vm->_game->_scene.getVocab(vocabId); + + switch (_capitalizationMode) { + case kUppercase: + vocab.toUppercase(); + break; + case kLowercase: + vocab.toLowercase(); + break; + case kUpperAndLower: + vocab.toLowercase(); + vocab.setChar(toupper(vocab[0]), 0); + default: + break; + } + + return vocab; +} + +bool DialogsNebular::textNoun(Common::String &dialogText, int nounNum, + const Common::String &valStr) { + warning("TODO: textNoun"); + return false; +} + +bool DialogsNebular::commandCheck(const char *idStr, Common::String &valStr, + const Common::String &command) { + int idLen = strlen(idStr); + + valStr = (command.size() <= idLen) ? "" : Common::String(command.c_str() + idLen); + + // Check whether the command starts with the given Id + int result = scumm_strnicmp(idStr, command.c_str(), idLen) == 0; + if (!result) + return false; + + // It does, so set the command case mode + if (Common::isUpper(command[0]) && Common::isUpper(command[1])) { + _capitalizationMode = kUppercase; + } else if (Common::isUpper(command[0])) { + _capitalizationMode = kUpperAndLower; + } else { + _capitalizationMode = kLowercase; + } + + return true; +} + } // End of namespace Nebular diff --git a/engines/mads/nebular/dialogs_nebular.h b/engines/mads/nebular/dialogs_nebular.h index c7b0e526a7..84bbaedd50 100644 --- a/engines/mads/nebular/dialogs_nebular.h +++ b/engines/mads/nebular/dialogs_nebular.h @@ -31,10 +31,21 @@ namespace MADS { namespace Nebular { +enum CapitalizationMode { kUppercase = 0, kLowercase = 1, kUpperAndLower = 2 }; + class DialogsNebular: public Dialogs { friend class Dialogs; -protected: +private: + int _dialogWidth; + CapitalizationMode _capitalizationMode; + DialogsNebular(MADSEngine *vm): Dialogs(vm) {} + + Common::String getVocab(int vocabId); + + bool textNoun(Common::String &dialogText, int nounNum, const Common::String &valStr); + + bool commandCheck(const char *idStr, Common::String &valStr, const Common::String &command); public: virtual void showDialog() { warning("TODO: showDialog"); @@ -42,6 +53,7 @@ public: virtual void showPicture(int objId, int msgId, int arg3) { warning("TODO: showPicture"); } + virtual bool show(int id); }; struct HOGANUS { diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index 2c6be6cfc2..34af685981 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -52,8 +52,6 @@ ProtectionResult GameNebular::checkCopyProtection() { dlg->show(); delete dlg; */ - // Debug - _vm->_dialogs->show(1); // DEBUG: Return that copy protection failed return PROTECTION_SUCCEED; -- cgit v1.2.3 From 195c53a68853db6a77c6a63d392968ba912cf2f4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 30 Mar 2014 22:37:08 -0400 Subject: MADS: Added some missing code for scene change freeing --- engines/mads/game.cpp | 4 ++-- engines/mads/nebular/game_nebular.cpp | 2 +- engines/mads/player.cpp | 15 +++++++++++++++ engines/mads/player.h | 5 +++++ engines/mads/scene.cpp | 16 +++++++++++++++- engines/mads/sprites.cpp | 14 -------------- engines/mads/sprites.h | 5 ----- 7 files changed, 38 insertions(+), 23 deletions(-) diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 33cb52cec9..fd0379972b 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -143,7 +143,7 @@ void Game::gameLoop() { sectionLoop(); } - // TODO: Extra reset methods + _player.releasePlayerSprites(); _vm->_palette->unlock(); _vm->_events->waitCursor(); _vm->_events->freeCursors(); @@ -181,7 +181,7 @@ void Game::sectionLoop() { _scene._sceneLogic->setup(); if (_player._spritesChanged || _player._loadsFirst) { if (_player._spritesLoaded) - _scene._spriteSlots.releasePlayerSprites(); + _player.releasePlayerSprites(); _vm->_palette->resetGamePalette(18, 10); _scene._spriteSlots.reset(); } else { diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index 34af685981..638432ae1a 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -270,7 +270,7 @@ void GameNebular::setSectionHandler() { void GameNebular::checkShowDialog() { if (_vm->_dialogs->_pendingDialog && _player._stepEnabled && !_globals[5]) { - _scene._spriteSlots.releasePlayerSprites(); + _player.releasePlayerSprites(); _vm->_dialogs->showDialog(); _vm->_dialogs->_pendingDialog = DIALOG_NONE; } diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index e726c800fd..5546784083 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -662,4 +662,19 @@ void Player::addWalker(int walker, int trigger) { } } + +/** +* Releases any sprites used by the player +*/ +void Player::releasePlayerSprites() { + Scene &scene = _vm->_game->_scene; + + if (_spritesLoaded && _numSprites > 0) { + int spriteEnd = _spritesStart + _numSprites - 1; + do { + scene._sprites.remove(spriteEnd); + } while (--spriteEnd >= _spritesStart); + } +} + } // End of namespace MADS diff --git a/engines/mads/player.h b/engines/mads/player.h index 986971bbc1..8315206fc3 100644 --- a/engines/mads/player.h +++ b/engines/mads/player.h @@ -205,6 +205,11 @@ public: * Add a walker to the current queue */ void addWalker(int walker, int trigger); + + /** + * Delete any sprites used by the player + */ + void releasePlayerSprites(); }; } // End of namespace MADS diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 83c059444d..21d09fb056 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -555,7 +555,21 @@ void Scene::updateCursor() { } void Scene::free() { - warning("TODO: Scene::free"); + if (_animationData) { + delete _animationData; + _animationData = nullptr; + } + if (_activeAnimation) { + delete _activeAnimation; + _activeAnimation = nullptr; + } + + _hotspots.clear(); + _backgroundSurface.free(); + _depthSurface.free(); + + delete _sceneInfo; + _sceneInfo = nullptr; } void Scene::changeDepthSurface(int arg1) { diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp index c0467ff95f..226835bb23 100644 --- a/engines/mads/sprites.cpp +++ b/engines/mads/sprites.cpp @@ -186,20 +186,6 @@ void SpriteSlots::reset(bool flag) { push_back(SpriteSlot(ST_FULL_SCREEN_REFRESH, -1)); } -/** -* Releases any sprites used by the player -*/ -void SpriteSlots::releasePlayerSprites() { - Player &player = _vm->_game->_player; - - if (player._spritesLoaded && player._numSprites > 0) { - int spriteEnd = player._spritesStart + player._numSprites - 1; - do { - deleteEntry(spriteEnd); - } while (--spriteEnd >= player._spritesStart); - } -} - void SpriteSlots::deleteEntry(int index) { remove_at(index); } diff --git a/engines/mads/sprites.h b/engines/mads/sprites.h index 2017961d29..a9b4e97d40 100644 --- a/engines/mads/sprites.h +++ b/engines/mads/sprites.h @@ -152,11 +152,6 @@ public: */ void reset(bool flag = true); - /** - * Delete any sprites used by the player - */ - void releasePlayerSprites(); - /** * Delete a sprite entry * @param index Specifies the index in the array -- cgit v1.2.3 From 87124b4380abf077a3c97f3997777228f7d825cf Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 30 Mar 2014 23:03:11 -0400 Subject: MADS: Fix for hotspot highlighting when mouse moves --- engines/mads/events.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp index 37a1eec969..c61512ca90 100644 --- a/engines/mads/events.cpp +++ b/engines/mads/events.cpp @@ -197,7 +197,7 @@ void EventsManager::waitForNextFrame() { _mouseClicked = mouseClicked; _mouseReleased = mouseReleased; _mouseButtons = mouseButtons; - _mouseMoved = _mouseClicked || _mouseReleased; + _mouseMoved |= _mouseClicked || _mouseReleased; } void EventsManager::initVars() { -- cgit v1.2.3 From 0c1001fbf4c37379ec685b036e63d6d59055997a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 1 Apr 2014 22:50:03 -0400 Subject: MADS: Minor variable renaming and remove incorrect variable set in scene loop --- engines/mads/game.cpp | 8 ++++---- engines/mads/game.h | 2 +- engines/mads/scene.cpp | 2 -- engines/mads/screen.cpp | 2 +- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index fd0379972b..2b42080d35 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -57,7 +57,7 @@ Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm), _vocabEmergency = false; _aaName = "*I0.AA"; _priorFrameTimer = 0; - _updateSceneFlag = false; + _anyEmergency = false; _triggerMode = KERNEL_TRIGGER_PARSER; _triggerSetupMode = KERNEL_TRIGGER_PARSER; _ticksExpiry = 0; @@ -256,11 +256,11 @@ void Game::sectionLoop() { _kernelMode = KERNEL_ACTIVE_CODE; _scene._roomChanged = false; - if ((_quoteEmergency || _vocabEmergency) && !_updateSceneFlag) { + if ((_quoteEmergency || _vocabEmergency) && !_anyEmergency) { _scene._currentSceneId = _scene._priorSceneId; - _updateSceneFlag = true; + _anyEmergency = true; } else { - _updateSceneFlag = false; + _anyEmergency = false; _scene.loop(); } diff --git a/engines/mads/game.h b/engines/mads/game.h index 4521ad68c1..54aef443a6 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -77,7 +77,7 @@ protected: Common::StringArray _quotes; bool _quoteEmergency; bool _vocabEmergency; - bool _updateSceneFlag; + bool _anyEmergency; /** * Constructor diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 21d09fb056..71e6873de5 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -263,8 +263,6 @@ bool Scene::getDepthHighBits(const Common::Point &pt) { } void Scene::loop() { - _nextSceneId = _currentSceneId; - while (!_vm->shouldQuit() && !_reloadSceneFlag && _nextSceneId == _currentSceneId) { // Handle drawing a game frame doFrame(); diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index 0c78b0c8a1..8bb17d30a6 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -254,7 +254,7 @@ ScreenObjects::ScreenObjects(MADSEngine *vm) : _vm(vm) { _objectY = -1; _v8333C = false; _v832EC = 0; - _v7FECA = 0; + _v7FECA = true; _v7FED6 = 0; _v8332A = 0; _category = CAT_NONE; -- cgit v1.2.3 From 041773705be6dd1fb09d71e482f4974247cee61f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 2 Apr 2014 20:28:57 -0400 Subject: MADS: Fix/clean up ending of ScreenObjects::check --- engines/mads/game.cpp | 1 - engines/mads/game.h | 1 - engines/mads/scene.cpp | 4 ++++ engines/mads/scene.h | 2 ++ engines/mads/screen.cpp | 13 +++++++++---- engines/mads/screen.h | 1 + engines/mads/user_interface.cpp | 4 ++-- 7 files changed, 18 insertions(+), 8 deletions(-) diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 2b42080d35..2736e77ef6 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -60,7 +60,6 @@ Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm), _anyEmergency = false; _triggerMode = KERNEL_TRIGGER_PARSER; _triggerSetupMode = KERNEL_TRIGGER_PARSER; - _ticksExpiry = 0; _winStatus = 0; // Load the inventory object list diff --git a/engines/mads/game.h b/engines/mads/game.h index 54aef443a6..f41e7d248c 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -138,7 +138,6 @@ public: TriggerMode _triggerSetupMode; uint32 _priorFrameTimer; Common::String _aaName; - uint32 _ticksExpiry; int _winStatus; public: virtual ~Game(); diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 71e6873de5..d37834ab55 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -582,4 +582,8 @@ void Scene::resetScene() { _sequences.clear(); } +void Scene::backgroundAnimation() { + warning("TODO: Scene::backgroundAnimation"); +} + } // End of namespace MADS diff --git a/engines/mads/scene.h b/engines/mads/scene.h index 1caba12851..1b0c9c9388 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -210,6 +210,8 @@ public: void changeDepthSurface(int arg1); void resetScene(); + + void backgroundAnimation(); }; } // End of namespace MADS diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index 8bb17d30a6..391ba71eeb 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -266,6 +266,7 @@ ScreenObjects::ScreenObjects(MADSEngine *vm) : _vm(vm) { _scrollerY = -1; _milliTime = 0; _eventFlag = false; + _baseTime = 0; } void ScreenObjects::add(const Common::Rect &bounds, Layer layer, ScrCategory category, int descId) { @@ -343,7 +344,7 @@ void ScreenObjects::check(bool scanFlag) { scene._action.refresh(); uint32 currentTicks = _vm->_events->getFrameCounter(); - if (currentTicks >= _vm->_game->_ticksExpiry) { + if (currentTicks >= _baseTime) { // Check the user interface slots to see if there's any slots that need to be expired UISlots &uiSlots = userInterface._uiSlots; for (uint idx = 0; idx < uiSlots.size(); ++idx) { @@ -354,12 +355,16 @@ void ScreenObjects::check(bool scanFlag) { slot._slotType = ST_EXPIRED; } + // TODO: The stuff here could probably be moved to Scene::doFrame + // Any background animation + scene.backgroundAnimation(); + // Handle animating the selected inventory animation userInterface.inventoryAnim(); - // Set the next frame expiry - _vm->_game->_ticksExpiry = currentTicks + 6; - } + // Set the base time + _baseTime = currentTicks + 6; + } } int ScreenObjects::scanBackwards(const Common::Point &pt, int layer) { diff --git a/engines/mads/screen.h b/engines/mads/screen.h index c733452aa2..d292a7a7d7 100644 --- a/engines/mads/screen.h +++ b/engines/mads/screen.h @@ -161,6 +161,7 @@ public: int _uiCount; uint32 _milliTime; bool _eventFlag; + uint32 _baseTime; /* * Constructor diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index d0139e2897..2cd1662077 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -264,7 +264,7 @@ void UserInterface::setup(int id) { scene._userInterface._uiSlots.clear(); scene._userInterface._uiSlots.fullRefresh(); - _vm->_game->_ticksExpiry = _vm->_events->getFrameCounter(); + _vm->_game->_screenObjects._baseTime = _vm->_events->getFrameCounter(); _highlightedCommandIndex = -1; _highlightedActionIndex = -1; _highlightedItemIndex = -1; @@ -590,7 +590,7 @@ void UserInterface::noInventoryAnim() { if (_invSpritesIndex >= 0) { scene._sprites.remove(_invSpritesIndex); - _vm->_game->_ticksExpiry = _vm->_events->getFrameCounter(); + _vm->_game->_screenObjects._baseTime = _vm->_events->getFrameCounter(); _invSpritesIndex = -1; } -- cgit v1.2.3 From 3f8ee8fafa0166204a6c0b9ec311aa9fb0aa3c39 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 2 Apr 2014 21:24:22 -0400 Subject: MADS: Cleanup of UISlots and flag types --- engines/mads/animation.cpp | 8 +++---- engines/mads/player.cpp | 8 +++---- engines/mads/screen.cpp | 23 ++++++++++---------- engines/mads/sequence.cpp | 2 +- engines/mads/sprites.cpp | 24 ++++++++++----------- engines/mads/sprites.h | 16 +++++++++----- engines/mads/user_interface.cpp | 48 ++++++++++++++++++++--------------------- engines/mads/user_interface.h | 6 ++++-- 8 files changed, 71 insertions(+), 64 deletions(-) diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index a8adfe3105..f4fee20de7 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -403,7 +403,7 @@ void Animation::update() { for (uint idx = 0; idx < scene._spriteSlots.size(); ++idx) { if (scene._spriteSlots[idx]._seqIndex >= 0x80) - scene._spriteSlots[idx]._SlotType = ST_EXPIRED; + scene._spriteSlots[idx]._flags = IMG_ERASE; } // Validate the current frame @@ -445,7 +445,7 @@ void Animation::update() { if (paChanged) { newIndex = scene._spriteSlots.add(); scene._spriteSlots[newIndex]._seqIndex = -1; - scene._spriteSlots[newIndex]._SlotType = ST_FULL_SCREEN_REFRESH; + scene._spriteSlots[newIndex]._flags = IMG_REFRESH; } // Main frame animation loop - frames get animated by being placed, as necessary, into the @@ -463,7 +463,7 @@ void Animation::update() { int seqIndex = _frameEntries[_oldFrameEntry]._seqIndex - scene._spriteSlots[index]._seqIndex; if (seqIndex == 0x80) { if (scene._spriteSlots[index] == _frameEntries[_oldFrameEntry]._spriteSlot) { - scene._spriteSlots[index]._SlotType = ST_NONE; + scene._spriteSlots[index]._flags = IMG_STATIC; spriteSlotIndex = -1; } } @@ -479,7 +479,7 @@ void Animation::update() { SpriteAsset &spriteSet = *scene._sprites[ scene._spriteSlots[slotIndex]._spritesIndex]; - slot._SlotType = spriteSet.isBackground() ? ST_BACKGROUND : ST_FOREGROUND; + slot._flags = spriteSet.isBackground() ? IMG_DELTA : IMG_UPDATE; } break; } diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index 5546784083..a98fdb1b15 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -260,7 +260,7 @@ void Player::update() { if (_forceRefresh || (_visible != _priorVisible)) { int slotIndex = getSpriteSlot(); if (slotIndex >= 0) - scene._spriteSlots[slotIndex]._SlotType = ST_EXPIRED; + scene._spriteSlots[slotIndex]._flags = IMG_ERASE; int newDepth = 1; int yp = MAX(_playerPos.y, (int16)(MADS_SCENE_HEIGHT - 1)); @@ -278,7 +278,7 @@ void Player::update() { if (_visible) { // Player sprite needs to be rendered SpriteSlot slot; - slot._SlotType = ST_FOREGROUND; + slot._flags = IMG_UPDATE; slot._seqIndex = PLAYER_SEQ_INDEX; slot._spritesIndex = _spritesStart + _spritesIdx; slot._frameNumber = _mirror ? -_frameNumber : _frameNumber; @@ -299,7 +299,7 @@ void Player::update() { if (equal) // Undo the prior expiry of the player sprite - s2._SlotType = ST_NONE; + s2._flags = IMG_STATIC; else slotIndex = -1; } @@ -532,7 +532,7 @@ int Player::getSpriteSlot() { for (uint idx = 0; idx < spriteSlots.size(); ++idx) { if (spriteSlots[idx]._seqIndex == PLAYER_SEQ_INDEX && - spriteSlots[idx]._SlotType >= ST_NONE) + spriteSlots[idx]._flags >= IMG_STATIC) return idx; } diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index 391ba71eeb..ca7235a14c 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -78,7 +78,7 @@ void DirtyArea::setSpriteSlot(const SpriteSlot *spriteSlot) { int width, height; Scene &scene = _vm->_game->_scene; - if (spriteSlot->_SlotType == ST_FULL_SCREEN_REFRESH) { + if (spriteSlot->_flags == IMG_REFRESH) { // Special entry to refresh the entire screen _bounds.left = 0; _bounds.top = 0; @@ -117,24 +117,24 @@ void DirtyArea::setTextDisplay(const TextDisplay *textDisplay) { } void DirtyArea::setUISlot(const UISlot *slot) { - int type = slot->_slotType; - if (type <= -20) - type += 20; + int type = slot->_flags; + if (type <= IMG_UPDATE_ONLY) + type += -IMG_UPDATE_ONLY; if (type >= 0x40) type &= ~0x40; MSurface &intSurface = _vm->_game->_scene._userInterface; switch (type) { - case ST_FULL_SCREEN_REFRESH: + case IMG_REFRESH: _bounds.left = 0; _bounds.top = 0; setArea(intSurface.w, intSurface.h, intSurface.w, intSurface.h); break; - case ST_MINUS3: + case IMG_OVERPRINT: _bounds.left = slot->_position.x; _bounds.top = slot->_position.y; // TODO: spritesIndex & frameNumber used as w & h??! - error("TODO: Figure out ST_MINUS3. Maybe need a union?"); + error("TODO: Figure out IMG_OVERPRINT. Maybe need a union?"); break; default: { @@ -143,7 +143,7 @@ void DirtyArea::setUISlot(const UISlot *slot) { int w = frame->w; int h = frame->h; - if (slot->_field2 == 200) { + if (slot->_segmentId == IMG_SPINNING_OBJECT) { _bounds.left = slot->_position.x; _bounds.top = slot->_position.y; } else { @@ -350,12 +350,11 @@ void ScreenObjects::check(bool scanFlag) { for (uint idx = 0; idx < uiSlots.size(); ++idx) { UISlot &slot = uiSlots[idx]; - if (slot._slotType != ST_FULL_SCREEN_REFRESH && slot._slotType > -20 - && slot._field2 != 200) - slot._slotType = ST_EXPIRED; + if (slot._flags != IMG_REFRESH && slot._flags > -20 + && slot._segmentId != IMG_SPINNING_OBJECT) + slot._flags = IMG_ERASE; } - // TODO: The stuff here could probably be moved to Scene::doFrame // Any background animation scene.backgroundAnimation(); diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index 6b9bd9e017..01ca69615f 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -184,7 +184,7 @@ void SequenceList::setSpriteSlot(int seqIndex, SpriteSlot &spriteSlot) { SequenceEntry &timerEntry = _entries[seqIndex]; SpriteAsset &spriteSet = *scene._sprites[timerEntry._spritesIndex]; - spriteSlot._SlotType = spriteSet.isBackground() ? ST_BACKGROUND : ST_FOREGROUND; + spriteSlot._flags = spriteSet.isBackground() ? IMG_DELTA : IMG_UPDATE; spriteSlot._seqIndex = seqIndex; spriteSlot._spritesIndex = timerEntry._spritesIndex; spriteSlot._frameNumber = timerEntry._flipped ? -timerEntry._frameIndex : timerEntry._frameIndex; diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp index 226835bb23..442125e929 100644 --- a/engines/mads/sprites.cpp +++ b/engines/mads/sprites.cpp @@ -139,7 +139,7 @@ byte MSprite::getTransparencyIndex() const { MADSEngine *SpriteSlot::_vm = nullptr; SpriteSlot::SpriteSlot() { - _SlotType = ST_NONE; + _flags = IMG_STATIC; _seqIndex = 0; _spritesIndex = 0; _frameNumber = 0; @@ -147,8 +147,8 @@ SpriteSlot::SpriteSlot() { _scale = 0; } -SpriteSlot::SpriteSlot(SlotType type, int seqIndex) { - _SlotType = type; +SpriteSlot::SpriteSlot(SpriteFlags type, int seqIndex) { + _flags = type; _seqIndex = seqIndex; _spritesIndex = 0; _frameNumber = 0; @@ -183,7 +183,7 @@ void SpriteSlots::reset(bool flag) { _vm->_game->_scene._sprites.clear(); Common::Array::clear(); - push_back(SpriteSlot(ST_FULL_SCREEN_REFRESH, -1)); + push_back(SpriteSlot(IMG_REFRESH, -1)); } void SpriteSlots::deleteEntry(int index) { @@ -194,11 +194,11 @@ void SpriteSlots::setDirtyAreas() { Scene &scene = _vm->_game->_scene; for (uint i = 0; i < size(); ++i) { - if ((*this)[i]._SlotType >= ST_NONE) { + if ((*this)[i]._flags >= IMG_STATIC) { scene._dirtyAreas[i].setSpriteSlot(&(*this)[i]); - scene._dirtyAreas[i]._textActive = ((*this)[i]._SlotType <= ST_NONE) ? 0 : 1; - (*this)[i]._SlotType = ST_NONE; + scene._dirtyAreas[i]._textActive = ((*this)[i]._flags <= IMG_STATIC) ? 0 : 1; + (*this)[i]._flags = IMG_STATIC; } } } @@ -207,7 +207,7 @@ void SpriteSlots::fullRefresh(bool clearAll) { if (clearAll) Common::Array::clear(); - push_back(SpriteSlot(ST_FULL_SCREEN_REFRESH, -1)); + push_back(SpriteSlot(IMG_REFRESH, -1)); } void SpriteSlots::deleteTimer(int seqIndex) { @@ -233,14 +233,14 @@ void SpriteSlots::drawBackground() { SpriteSlot &spriteSlot = (*this)[i]; DirtyArea &dirtyArea = scene._dirtyAreas[i]; - if (spriteSlot._SlotType >= ST_NONE) { + if (spriteSlot._flags >= IMG_STATIC) { // Foreground sprite, so we can ignore it dirtyArea._active = false; } else { dirtyArea._active = true; dirtyArea.setSpriteSlot(&spriteSlot); - if (spriteSlot._SlotType == ST_BACKGROUND) { + if (spriteSlot._flags == IMG_DELTA) { // Background object, so need to draw it assert(spriteSlot._frameNumber > 0); SpriteAsset *asset = scene._sprites[spriteSlot._spritesIndex]; @@ -290,7 +290,7 @@ void SpriteSlots::drawForeground(MSurface *s) { // Get a list of sprite object depths for active objects for (uint i = 0; i < size(); ++i) { SpriteSlot &spriteSlot = (*this)[i]; - if (spriteSlot._SlotType >= ST_NONE) { + if (spriteSlot._flags >= IMG_STATIC) { DepthEntry rec(16 - spriteSlot._depth, i); depthList.push_back(rec); } @@ -353,7 +353,7 @@ void SpriteSlots::drawForeground(MSurface *s) { void SpriteSlots::cleanUp() { for (int i = (int)size() - 1; i >= 0; --i) { - if ((*this)[i]._SlotType < ST_NONE) + if ((*this)[i]._flags < IMG_STATIC) remove_at(i); } } diff --git a/engines/mads/sprites.h b/engines/mads/sprites.h index a9b4e97d40..962d8c9e75 100644 --- a/engines/mads/sprites.h +++ b/engines/mads/sprites.h @@ -30,9 +30,15 @@ namespace MADS { -enum SlotType { - ST_NONE = 0, ST_FOREGROUND = 1, ST_MINUS5 = -5, ST_BACKGROUND = -4, - ST_MINUS3 = -3, ST_FULL_SCREEN_REFRESH = -2, ST_EXPIRED = -1 +enum SpriteFlags { + IMG_STATIC = 0, // Item should remain fixed on the screen + IMG_UPDATE = 1, // Item needs to be redrawn + IMG_ERASE = -1, // Erase image and remove it + IMG_REFRESH = -2, // Full refresh + IMG_OVERPRINT = -3, // Interface overprint + IMG_DELTA = -4, // Delta change + IMG_FULL_UPDATE = -5, // Interface refresh + IMG_UPDATE_ONLY = -20 // Update the active screen area only }; class MADSEngine; @@ -129,11 +135,11 @@ private: static MADSEngine *_vm; friend class SpriteSlots; public: - SlotType _SlotType; + SpriteFlags _flags; int _seqIndex; public: SpriteSlot(); - SpriteSlot(SlotType type, int seqIndex); + SpriteSlot(SpriteFlags type, int seqIndex); void setup(int dirtyAreaIndex); bool operator==(const SpriteSlotSubset &other) const; diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 2cd1662077..7ed1884e88 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -28,8 +28,8 @@ namespace MADS { UISlot::UISlot() { - _slotType = ST_NONE; - _field2 = 0; + _flags = IMG_STATIC; + _segmentId = 0; _spritesIndex = 0; _frameNumber = 0; } @@ -38,8 +38,8 @@ UISlot::UISlot() { void UISlots::fullRefresh() { UISlot slot; - slot._slotType = ST_FULL_SCREEN_REFRESH; - slot._field2 = -1; + slot._flags = IMG_REFRESH; + slot._segmentId = -1; push_back(slot); } @@ -48,8 +48,8 @@ void UISlots::add(const Common::Point &pt, int frameNumber, int spritesIndex) { assert(size() < 50); UISlot ie; - ie._slotType = -3; - ie._field2 = 201; + ie._flags = -3; + ie._segmentId = IMG_TEXT_UPDATE; ie._position = pt; ie._frameNumber = frameNumber; ie._spritesIndex = spritesIndex; @@ -67,12 +67,12 @@ void UISlots::draw(bool updateFlag, bool delFlag) { DirtyArea &dirtyArea = userInterface._dirtyAreas[idx]; UISlot &slot = (*this)[idx]; - if (slot._slotType >= ST_NONE) { + if (slot._flags >= IMG_STATIC) { dirtyArea._active = false; } else { dirtyArea.setUISlot(&slot); dirtyArea._textActive = true; - if (slot._field2 == 200 && slot._slotType == ST_MINUS5) { + if (slot._segmentId == IMG_SPINNING_OBJECT && slot._flags == IMG_FULL_UPDATE) { dirtyArea._active = false; dirtyAreaPtr = &dirtyArea; } @@ -89,10 +89,10 @@ void UISlots::draw(bool updateFlag, bool delFlag) { UISlot &slot = (*this)[idx]; if (dirtyArea._active && dirtyArea._bounds.width() > 0 - && dirtyArea._bounds.height() > 0 && slot._slotType >= -20) { + && dirtyArea._bounds.height() > 0 && slot._flags >= -20) { // TODO: Figure out the difference between two copy methods used - if (slot._slotType >= ST_EXPIRED) { + if (slot._flags >= IMG_ERASE) { userInterface._surface.copyTo(&userInterface, dirtyArea._bounds, Common::Point(dirtyArea._bounds.left, dirtyArea._bounds.top)); } else { @@ -106,14 +106,14 @@ void UISlots::draw(bool updateFlag, bool delFlag) { DirtyArea &dirtyArea = userInterface._dirtyAreas[idx]; UISlot &slot = (*this)[idx]; - int slotType = slot._slotType; - if (slotType >= ST_NONE) { + int slotType = slot._flags; + if (slotType >= IMG_STATIC) { dirtyArea.setUISlot(&slot); if (!updateFlag) slotType &= ~0x40; dirtyArea._textActive = slotType > 0; - slot._slotType &= 0x40; + slot._flags &= 0x40; } } @@ -123,7 +123,7 @@ void UISlots::draw(bool updateFlag, bool delFlag) { DirtyArea &dirtyArea = userInterface._dirtyAreas[idx]; UISlot &slot = (*this)[idx]; - if (slot._slotType >= ST_NONE && !(slot._slotType & 0x40)) { + if (slot._flags >= IMG_STATIC && !(slot._flags & 0x40)) { if (!dirtyArea._active) { error("Should never reach this point, even in original"); } @@ -131,7 +131,7 @@ void UISlots::draw(bool updateFlag, bool delFlag) { if (dirtyArea._textActive) { SpriteAsset *asset = scene._sprites[slot._spritesIndex]; - if (slot._field2 == 200) { + if (slot._segmentId == IMG_SPINNING_OBJECT) { MSprite *sprite = asset->getFrame(slot._frameNumber & 0x7F); sprite->copyTo(&userInterface, slot._position, sprite->getTransparencyIndex()); @@ -170,16 +170,16 @@ void UISlots::draw(bool updateFlag, bool delFlag) { for (int idx = (int)size() - 1; idx >= 0; --idx) { UISlot &slot = (*this)[idx]; - if (slot._slotType < ST_NONE) { + if (slot._flags < IMG_STATIC) { if (delFlag || updateFlag) remove_at(idx); - else if (slot._slotType >= -20) - slot._slotType -= 20; + else if (slot._flags >= -20) + slot._flags -= 20; } else { if (updateFlag) - slot._slotType &= ~0x40; + slot._flags &= ~0x40; else - slot._slotType |= 0x40; + slot._flags |= 0x40; } } } @@ -619,14 +619,14 @@ void UserInterface::inventoryAnim() { // Loop through the slots list for inventory animation entry for (uint i = 0; i < _uiSlots.size(); ++i) { - if (_uiSlots[i]._field2 == 200) - _uiSlots[i]._slotType = -5; + if (_uiSlots[i]._segmentId == IMG_SPINNING_OBJECT) + _uiSlots[i]._flags = -5; } // Add a new slot entry for the inventory animation UISlot slot; - slot._slotType = ST_FOREGROUND; - slot._field2 = 200; + slot._flags = IMG_UPDATE; + slot._segmentId = IMG_SPINNING_OBJECT; slot._frameNumber = _invFrameNumber; slot._spritesIndex = _invSpritesIndex; slot._position = Common::Point(160, 3); diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h index 740ea66c4e..53c1e10466 100644 --- a/engines/mads/user_interface.h +++ b/engines/mads/user_interface.h @@ -31,10 +31,12 @@ namespace MADS { +enum { IMG_SPINNING_OBJECT = 200, IMG_TEXT_UPDATE = 201 }; + class UISlot { public: - int _slotType; - int _field2; + int _flags; + int _segmentId; int _spritesIndex; int _frameNumber; Common::Point _position; -- cgit v1.2.3 From f0458042f212e10155e4206312e46ce0beb7c06f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 2 Apr 2014 22:27:11 -0400 Subject: MADS: In progress cleanup of checkActionAtMousePos --- engines/mads/action.cpp | 43 ++++++++++++++++++++++--------------------- engines/mads/action.h | 9 +++++++-- engines/mads/scene.cpp | 1 - engines/mads/scene.h | 1 - engines/mads/screen.cpp | 4 ++-- engines/mads/screen.h | 2 +- 6 files changed, 32 insertions(+), 28 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index 35e989bf98..7a95e64e04 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -50,18 +50,19 @@ void MADSAction::clear() { _actionMode = ACTIONMODE_NONE; _actionMode2 = ACTIONMODE2_0; _v86F42 = 0; - _v86F4E = 0; + _recentCommandSource = 0; _articleNumber = 0; _lookFlag = false; _v86F4A = 0; _selectedRow = -1; _hotspotId = -1; _v86F3A = -1; - _v86F4C = -1; + _recentCommand = -1; _action._verbId = VERB_NONE; _action._objectNameId = -1; _action._indirectObjectId = -1; _textChanged = true; + _pickedWord = 0; } void MADSAction::appendVocab(int vocabId, bool capitalise) { @@ -355,9 +356,9 @@ void MADSAction::checkActionAtMousePos() { ScreenObjects &screenObjects = _vm->_game->_screenObjects; if ((userInterface._category == CAT_COMMAND || userInterface._category == CAT_INV_VOCAB) && - _interAwaiting != 1 && scene._highlightedHotspot >= 0) { - if (_v86F4E == userInterface._category || _v86F4C != scene._highlightedHotspot || - (_interAwaiting != 2 && _interAwaiting != 3)) + _interAwaiting != AWAITING_COMMAND && _pickedWord >= 0) { + if (_recentCommandSource == userInterface._category || _recentCommand != _pickedWord || + (_interAwaiting != AWAITING_THIS && _interAwaiting != 3)) clear(); else if (_selectedRow != 0 || userInterface._category != CAT_COMMAND) scene._lookFlag = false; @@ -408,7 +409,7 @@ void MADSAction::checkActionAtMousePos() { switch (userInterface._category) { case CAT_COMMAND: _actionMode = ACTIONMODE_VERB; - _selectedRow = scene._highlightedHotspot; + _selectedRow = _pickedWord; if (_selectedRow >= 0) { _flags1 = scene._verbList[_selectedRow]._action1; _flags2 = scene._verbList[_selectedRow]._action2; @@ -417,7 +418,7 @@ void MADSAction::checkActionAtMousePos() { case CAT_INV_VOCAB: _actionMode = ACTIONMODE_OBJECT; - _selectedRow = scene._highlightedHotspot; + _selectedRow = _pickedWord; if (_selectedRow < 0) { _hotspotId = -1; _actionMode2 = ACTIONMODE2_0; @@ -439,12 +440,12 @@ void MADSAction::checkActionAtMousePos() { _selectedRow = -1; _actionMode = ACTIONMODE_NONE; _actionMode2 = ACTIONMODE2_4; - _hotspotId = scene._highlightedHotspot; + _hotspotId = _pickedWord; break; case CAT_TALK_ENTRY: _actionMode = ACTIONMODE_TALK; - _selectedRow = scene._highlightedHotspot; + _selectedRow = _pickedWord; break; default: @@ -460,7 +461,7 @@ void MADSAction::checkActionAtMousePos() { case CAT_INV_ANIM: // TODO: We may not need a separate ActionMode2 enum _actionMode2 = (ActionMode2)userInterface._category; - _hotspotId = scene._highlightedHotspot; + _hotspotId = _pickedWord; break; default: break; @@ -473,7 +474,7 @@ void MADSAction::checkActionAtMousePos() { case CAT_HOTSPOT: case CAT_INV_ANIM: _v86F42 = userInterface._category; - _v86F3A = scene._highlightedHotspot; + _v86F3A = _pickedWord; break; default: break; @@ -492,8 +493,8 @@ void MADSAction::leftClick() { bool abortFlag = false; if ((userInterface._category == CAT_COMMAND || userInterface._category == CAT_INV_VOCAB) && - _interAwaiting != 1 && scene._highlightedHotspot >= 0 && - _v86F4E == userInterface._category && _v86F4C == scene._highlightedHotspot && + _interAwaiting != 1 && _pickedWord >= 0 && + _recentCommandSource == userInterface._category && _recentCommand == _pickedWord && (_interAwaiting == 2 || userInterface._category == CAT_INV_VOCAB)) { abortFlag = true; if (_selectedRow == 0 && userInterface._category == CAT_COMMAND) { @@ -519,16 +520,16 @@ void MADSAction::leftClick() { _selectedAction = -1; } else { - _v86F4C = _selectedRow; - _v86F4E = _actionMode; + _recentCommand = _selectedRow; + _recentCommandSource = _actionMode; _interAwaiting = AWAITING_THIS; } } break; case CAT_INV_LIST: - if (scene._highlightedHotspot >= 0) { - userInterface.selectObject(scene._highlightedHotspot); + if (_pickedWord >= 0) { + userInterface.selectObject(_pickedWord); } break; @@ -548,14 +549,14 @@ void MADSAction::leftClick() { _selectedAction = -1; } - _v86F4C = _selectedRow; - _v86F4E = _actionMode; + _recentCommand = _selectedRow; + _recentCommandSource = _actionMode; } break; case CAT_HOTSPOT: - _v86F4C = -1; - _v86F4E = 0; + _recentCommand = -1; + _recentCommandSource = 0; if (_vm->_events->currentPos().y < MADS_SCENE_HEIGHT) { scene._customDest = _vm->_events->currentPos() + scene._posAdjust; diff --git a/engines/mads/action.h b/engines/mads/action.h index e7a33230a4..45886c1bca 100644 --- a/engines/mads/action.h +++ b/engines/mads/action.h @@ -105,12 +105,13 @@ public: // Unknown fields int16 _v86F3A; int16 _v86F42; - int16 _v86F4E; + int16 _recentCommandSource; bool _v86F4A; - int16 _v86F4C; + int16 _recentCommand; InterAwaiting _interAwaiting; bool _inProgress; int _v8453A; + int _pickedWord; public: MADSAction(MADSEngine *vm); @@ -123,6 +124,10 @@ public: void checkAction(); bool isAction(int verbId, int objectNameId = 0, int indirectObjectId = 0); + /** + * Check the result of the current action on the sentence + * with the provision that the action is not yet complete. + */ void checkActionAtMousePos(); /** diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index d37834ab55..97a131a665 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -49,7 +49,6 @@ Scene::Scene(MADSEngine *vm): _vm(vm), _action(_vm), _depthSurface(vm), _frameStartTime = 0; _layer = LAYER_GUI; _lookFlag = false; - _highlightedHotspot = 0; _verbList.push_back(VerbInit(VERB_LOOK, 2, 0)); _verbList.push_back(VerbInit(VERB_TAKE, 2, 0)); diff --git a/engines/mads/scene.h b/engines/mads/scene.h index 1b0c9c9388..4e3829b838 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -124,7 +124,6 @@ public: uint32 _frameStartTime; Layer _layer; bool _lookFlag; - int _highlightedHotspot; Common::Point _customDest; /** diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index ca7235a14c..f00146e1e2 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -350,7 +350,7 @@ void ScreenObjects::check(bool scanFlag) { for (uint idx = 0; idx < uiSlots.size(); ++idx) { UISlot &slot = uiSlots[idx]; - if (slot._flags != IMG_REFRESH && slot._flags > -20 + if (slot._flags != IMG_REFRESH && slot._flags > IMG_UPDATE_ONLY && slot._segmentId != IMG_SPINNING_OBJECT) slot._flags = IMG_ERASE; } @@ -598,7 +598,7 @@ void ScreenObjects::elementHighlighted() { if (newIndex >= 0) newIndex = MIN(newIndex + topIndex, indexEnd); - _vm->_game->_scene._highlightedHotspot = newIndex; + action._pickedWord = newIndex; if (_category == CAT_INV_LIST || _category == CAT_INV_ANIM) { if (action._interAwaiting == 1 && newIndex >= 0 && _released && diff --git a/engines/mads/screen.h b/engines/mads/screen.h index d292a7a7d7..e6e0f285c7 100644 --- a/engines/mads/screen.h +++ b/engines/mads/screen.h @@ -178,7 +178,7 @@ public: void check(bool scanFlag); /** - * Handle element being highlighted on the screen + * Handle an element being highlighted on the screen, and make it active. */ void elementHighlighted(); -- cgit v1.2.3 From 74c6bafed4eb80f93284a60219f27c150eb2baf5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 2 Apr 2014 22:41:25 -0400 Subject: MADS: Further clean up/renaming of checkActionAtMousePos --- engines/mads/action.cpp | 4 ++-- engines/mads/events.cpp | 4 ++++ engines/mads/events.h | 1 + engines/mads/scene.cpp | 2 +- engines/mads/screen.cpp | 17 ++++++++--------- engines/mads/screen.h | 1 - 6 files changed, 16 insertions(+), 13 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index 7a95e64e04..b5c92c0d64 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -366,7 +366,7 @@ void MADSAction::checkActionAtMousePos() { scene._lookFlag = true; } - if (screenObjects._v7FECA && _vm->_events->_mouseButtons) { + if (_vm->_events->_anyStroke && _vm->_events->_mouseButtons) { switch (userInterface._category) { case CAT_COMMAND: case CAT_INV_VOCAB: @@ -507,7 +507,7 @@ void MADSAction::leftClick() { } } - if (abortFlag || (screenObjects._v7FECA && (userInterface._category == CAT_COMMAND || + if (abortFlag || (_vm->_events->_anyStroke && (userInterface._category == CAT_COMMAND || userInterface._category == CAT_INV_VOCAB))) return; diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp index c61512ca90..29ea927bbc 100644 --- a/engines/mads/events.cpp +++ b/engines/mads/events.cpp @@ -46,6 +46,7 @@ EventsManager::EventsManager(MADSEngine *vm) { _vD4 = 0; _mouseMoved = false; _vD8 = 0; + _anyStroke = false; } EventsManager::~EventsManager() { @@ -129,17 +130,20 @@ void EventsManager::pollEvents() { _mouseClicked = true; _mouseButtons = 1; _mouseMoved = true; + _anyStroke = true; return; case Common::EVENT_LBUTTONUP: case Common::EVENT_RBUTTONUP: _mouseClicked = false; _mouseReleased = true; _mouseMoved = true; + _anyStroke = true; return; case Common::EVENT_MOUSEMOVE: _mousePos = event.mouse; _currentPos = event.mouse; _mouseMoved = true; + _anyStroke = true; break; default: break; diff --git a/engines/mads/events.h b/engines/mads/events.h index b0b20b4853..8537605d4c 100644 --- a/engines/mads/events.h +++ b/engines/mads/events.h @@ -58,6 +58,7 @@ public: bool _mouseClicked; bool _mouseReleased; byte _mouseButtons; + bool _anyStroke; bool _keyPressed; int _vCC; int _vD2; diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 97a131a665..9e27f2724e 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -522,7 +522,7 @@ void Scene::updateCursor() { Player &player = _vm->_game->_player; CursorType cursorId = CURSOR_ARROW; - if (_action._interAwaiting == 1 && !_vm->_game->_screenObjects._v7FECA && + if (_action._interAwaiting == 1 && !_vm->_events->_anyStroke && _vm->_game->_screenObjects._category == CAT_HOTSPOT) { int idx = _vm->_game->_screenObjects._selectedObject - _userInterface._categoryIndexes[CAT_HOTSPOT - 1]; diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index f00146e1e2..b55d80c9ec 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -254,7 +254,6 @@ ScreenObjects::ScreenObjects(MADSEngine *vm) : _vm(vm) { _objectY = -1; _v8333C = false; _v832EC = 0; - _v7FECA = true; _v7FED6 = 0; _v8332A = 0; _category = CAT_NONE; @@ -287,7 +286,7 @@ void ScreenObjects::check(bool scanFlag) { UserInterface &userInterface = scene._userInterface; if (!_vm->_events->_mouseButtons || _v832EC) - _v7FECA = false; + _vm->_events->_anyStroke = false; if ((_vm->_events->_mouseMoved || _vm->_game->_scene._userInterface._scrollerY || _v8332A || _v8333C) && scanFlag) { @@ -474,13 +473,13 @@ void ScreenObjects::elementHighlighted() { indexEnd = 9; varA = 5; topIndex = 0; - idxP = !_v7FECA ? &userInterface._highlightedCommandIndex : + idxP = !_vm->_events->_anyStroke ? &userInterface._highlightedCommandIndex : &userInterface._selectedActionIndex; - if (_v7FECA && userInterface._selectedItemVocabIdx >= 0) + if (_vm->_events->_anyStroke && userInterface._selectedItemVocabIdx >= 0) userInterface.updateSelection(CAT_INV_VOCAB, -1, &userInterface._selectedItemVocabIdx); - var4 = _released && !_v7FECA ? 1 : 0; + var4 = _released && !_vm->_events->_anyStroke ? 1 : 0; break; case CAT_INV_LIST: @@ -506,12 +505,12 @@ void ScreenObjects::elementHighlighted() { varA = 0; topIndex = 0; - idxP = _v7FECA ? &userInterface._selectedItemVocabIdx : &userInterface._highlightedActionIndex; + idxP = _vm->_events->_anyStroke ? &userInterface._selectedItemVocabIdx : &userInterface._highlightedActionIndex; - if (_v7FECA && userInterface._selectedActionIndex >= 0) + if (_vm->_events->_anyStroke && userInterface._selectedActionIndex >= 0) userInterface.updateSelection(CAT_COMMAND, -1, &userInterface._selectedActionIndex); - var4 = _released && !_v7FECA ? 1 : 0; + var4 = _released && !_vm->_events->_anyStroke ? 1 : 0; break; case CAT_INV_ANIM: @@ -606,7 +605,7 @@ void ScreenObjects::elementHighlighted() { newIndex = -1; } - if (_released && !_vm->_game->_screenObjects._v7FECA && + if (_released && !_vm->_events->_anyStroke && (_vm->_events->_mouseReleased || !_vm->_easyMouse)) newIndex = -1; diff --git a/engines/mads/screen.h b/engines/mads/screen.h index e6e0f285c7..31fdd2a470 100644 --- a/engines/mads/screen.h +++ b/engines/mads/screen.h @@ -149,7 +149,6 @@ private: void checkScroller(); public: int _v832EC; - int _v7FECA; int _v7FED6; int _v8332A; int _v8333C; -- cgit v1.2.3 From 83ac9489231e164154ad812034eb6aac9a0fe78b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 3 Apr 2014 20:38:18 -0400 Subject: MADS: Renaming to use InterWaiting enum entries --- engines/mads/action.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index b5c92c0d64..134d474e21 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -373,8 +373,9 @@ void MADSAction::checkActionAtMousePos() { return; case CAT_INV_LIST: - case CAT_TALK_ENTRY: - if (_interAwaiting != 3) { + case CAT_HOTSPOT: + case CAT_INV_ANIM: + if (_interAwaiting != AWAITING_THAT) { if (userInterface._selectedActionIndex >= 0) { _actionMode = ACTIONMODE_VERB; _selectedRow = userInterface._selectedActionIndex; @@ -404,7 +405,7 @@ void MADSAction::checkActionAtMousePos() { } switch (_interAwaiting) { - case 1: + case AWAITING_COMMAND: _articleNumber = 0; switch (userInterface._category) { case CAT_COMMAND: @@ -453,7 +454,7 @@ void MADSAction::checkActionAtMousePos() { } break; - case 2: + case AWAITING_THIS: _articleNumber = 0; switch (userInterface._category) { case CAT_INV_LIST: @@ -468,7 +469,7 @@ void MADSAction::checkActionAtMousePos() { } break; - case 3: + case AWAITING_THAT: switch (userInterface._category) { case CAT_INV_LIST: case CAT_HOTSPOT: -- cgit v1.2.3 From d163ee088a9f3e49463fddd05a41d1b1530e77db Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 3 Apr 2014 22:02:12 -0400 Subject: MADS: Renamings for saving fields in MADSAction::startAction --- engines/mads/action.cpp | 107 +++++++++++++++---------------- engines/mads/action.h | 34 ++++++---- engines/mads/game.cpp | 2 +- engines/mads/hotspots.cpp | 6 +- engines/mads/inventory.cpp | 9 ++- engines/mads/nebular/nebular_scenes2.cpp | 4 +- engines/mads/nebular/nebular_scenes8.cpp | 2 +- engines/mads/scene.cpp | 26 ++++---- engines/mads/screen.cpp | 6 +- engines/mads/screen.h | 8 ++- engines/mads/user_interface.cpp | 24 +++---- engines/mads/user_interface.h | 2 +- 12 files changed, 125 insertions(+), 105 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index 134d474e21..8ee46e2a39 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -35,28 +35,28 @@ MADSAction::MADSAction(MADSEngine *vm) : _vm(vm) { _selectedAction = 0; _inProgress = false; - _savedFields._actionMode = KERNEL_TRIGGER_PARSER; - _savedFields._actionMode2 = KERNEL_TRIGGER_PARSER; - _savedFields._selectedRow = -1; - _savedFields._hotspotId = 0; - _savedFields._v86F3A = 0; - _savedFields._v86F42 = 0; + _savedFields._commandSource = 0; + _savedFields._mainObjectSource = 0; + _savedFields._command = -1; + _savedFields._mainObject = 0; + _savedFields._secondObject = 0; + _savedFields._secondObjectSource = 0; _savedFields._articleNumber = 0; _savedFields._lookFlag = false; } void MADSAction::clear() { _interAwaiting = AWAITING_COMMAND; - _actionMode = ACTIONMODE_NONE; - _actionMode2 = ACTIONMODE2_0; - _v86F42 = 0; + _commandSource = ACTIONMODE_NONE; + _mainObjectSource = ACTIONMODE2_0; + _secondObjectSource = 0; _recentCommandSource = 0; _articleNumber = 0; _lookFlag = false; _v86F4A = 0; _selectedRow = -1; _hotspotId = -1; - _v86F3A = -1; + _secondObject = -1; _recentCommand = -1; _action._verbId = VERB_NONE; _action._objectNameId = -1; @@ -78,7 +78,7 @@ void MADSAction::checkCustomDest(int v) { Scene &scene = _vm->_game->_scene; Player &player = _vm->_game->_player; - if (_v86F4A && (v == -3 || _savedFields._selectedRow < 0)) { + if (_v86F4A && (v == -3 || _savedFields._command < 0)) { player._needToWalk = true; player._prepareWalkPos = scene._customDest; } @@ -94,7 +94,7 @@ void MADSAction::set() { _action._objectNameId = -1; _action._indirectObjectId = -1; - if (_actionMode == ACTIONMODE_TALK) { + if (_commandSource == ACTIONMODE_TALK) { // Handle showing the conversation selection. Rex at least doesn't actually seem to use this if (_selectedRow >= 0) { Common::String desc = userInterface._talkStrings[userInterface._talkIds[_selectedRow]]; @@ -105,7 +105,7 @@ void MADSAction::set() { // Two 'look' actions in succession, so the action becomes 'Look around' _statusText = kLookAroundStr; } else { - if ((_actionMode == ACTIONMODE_OBJECT) && (_selectedRow >= 0) && (_flags1 == 2) && (_flags2 == 0)) { + if ((_commandSource == ACTIONMODE_OBJECT) && (_selectedRow >= 0) && (_flags1 == 2) && (_flags2 == 0)) { // Use/to action int invIndex = userInterface._selectedInvIndex; InventoryObject &objEntry = _vm->_game->_objects.getItem(invIndex); @@ -121,7 +121,7 @@ void MADSAction::set() { } else { // Handling for if an action has been selected if (_selectedRow >= 0) { - if (_actionMode == ACTIONMODE_VERB) { + if (_commandSource == ACTIONMODE_VERB) { // Standard verb action _action._verbId = scene._verbList[_selectedRow]._id; } else { @@ -172,7 +172,7 @@ void MADSAction::set() { } } - if ((_actionMode2 == ACTIONMODE2_2) || (_actionMode2 == ACTIONMODE2_5)) { + if ((_mainObjectSource == ACTIONMODE2_2) || (_mainObjectSource == ACTIONMODE2_5)) { // Get name from given inventory object InventoryObject &invObject = _vm->_game->_objects.getItem(_hotspotId); _action._objectNameId = invObject._descId; @@ -189,13 +189,13 @@ void MADSAction::set() { if ((_hotspotId >= 0) && (_articleNumber > 0) && !flag) { if (_articleNumber == -1) { - if (_v86F3A >= 0) { + if (_secondObject >= 0) { int articleNum = 0; - if ((_v86F42 == 2) || (_v86F42 == 5)) { + if ((_secondObjectSource == 2) || (_secondObjectSource == 5)) { InventoryObject &invObject = _vm->_game->_objects.getItem(_hotspotId); articleNum = invObject._article; - } else if (_v86F3A < (int)scene._hotspots.size()) { + } else if (_secondObject < (int)scene._hotspots.size()) { articleNum = scene._hotspots[_hotspotId]._articleNumber; } else { articleNum = scene._hotspots[_hotspotId - scene._hotspots.size()]._articleNumber; @@ -217,7 +217,7 @@ void MADSAction::set() { } // Append object description if necessary - if (_v86F3A >= 0) + if (_secondObject >= 0) appendVocab(_action._indirectObjectId); // Remove any trailing space character @@ -242,7 +242,8 @@ void MADSAction::refresh() { } if (!_statusText.empty()) { - if ((_vm->_game->_screenObjects._v832EC == 0) || (_vm->_game->_screenObjects._v832EC == 2)) { + if ((_vm->_game->_screenObjects._inputMode == kInputBuildingSentences) || + (_vm->_game->_screenObjects._inputMode == kInputLimitedSentences)) { Font *font = _vm->_font->getFont(FONT_MAIN); int textSpacing = -1; @@ -273,14 +274,14 @@ void MADSAction::startAction() { player.cancelCommand(); _inProgress = true; - _v8453A = KERNEL_TRIGGER_PARSER; - _savedFields._selectedRow = _selectedRow; - _savedFields._hotspotId = _hotspotId; - _savedFields._v86F3A = _v86F3A; + _savedFields._commandError = false; + _savedFields._command = _selectedRow; + _savedFields._mainObject = _hotspotId; + _savedFields._secondObject = _secondObject; _savedFields._articleNumber = _articleNumber; - _savedFields._actionMode = _actionMode; - _savedFields._actionMode2 = _actionMode2; - _savedFields._v86F42 = _v86F42; + _savedFields._commandSource = _commandSource; + _savedFields._mainObjectSource = _mainObjectSource; + _savedFields._secondObjectSource = _secondObjectSource; _savedFields._lookFlag = _lookFlag; _activeAction = _action; @@ -288,17 +289,17 @@ void MADSAction::startAction() { _activeAction = _action; _sentence = _statusText; - if ((_actionMode2 == ACTIONMODE2_4) && (_v86F42 == 0)) - _v8453A = -1; + if ((_mainObjectSource == ACTIONMODE2_4) && (_secondObjectSource == 0)) + _savedFields._commandError = true; player._needToWalk = false; int hotspotId = -1; - if (!_savedFields._lookFlag && (_vm->_game->_screenObjects._v832EC != 1)) { - if (_savedFields._actionMode2 == ACTIONMODE2_4) - hotspotId = _savedFields._hotspotId; - else if (_v86F42 == 4) - hotspotId = _savedFields._v86F3A; + if (!_savedFields._lookFlag && (_vm->_game->_screenObjects._inputMode != kInputConversation)) { + if (_savedFields._mainObjectSource == ACTIONMODE2_4) + hotspotId = _savedFields._mainObject; + else if (_secondObjectSource == 4) + hotspotId = _savedFields._secondObject; if (hotspotId >= (int)hotspots.size()) { DynamicHotspot &hs = dynHotspots[hotspotId - hotspots.size()]; @@ -306,7 +307,7 @@ void MADSAction::startAction() { checkCustomDest(hs._feetPos.x); } else if (hs._feetPos.x == 0) { player._prepareWalkFacing = hs._facing; - } else if (_savedFields._actionMode == ACTIONMODE_NONE || hs._cursor >= CURSOR_WAIT) { + } else if (_savedFields._commandSource == ACTIONMODE_NONE || hs._cursor >= CURSOR_WAIT) { player._needToWalk = true; player._prepareWalkPos = hs._feetPos; } @@ -322,7 +323,7 @@ void MADSAction::startAction() { if (hs._feetPos.x == -1 || hs._feetPos.x != -3) { checkCustomDest(hs._feetPos.x); } else if (hs._feetPos.x >= 0) { - if (_savedFields._actionMode == ACTIONMODE_NONE || hs._cursor < CURSOR_WAIT) { + if (_savedFields._commandSource == ACTIONMODE_NONE || hs._cursor < CURSOR_WAIT) { player._needToWalk = true; player._prepareWalkPos = hs._feetPos; } @@ -353,7 +354,6 @@ bool MADSAction::isAction(int verbId, int objectNameId, int indirectObjectId) { void MADSAction::checkActionAtMousePos() { Scene &scene = _vm->_game->_scene; UserInterface &userInterface = scene._userInterface; - ScreenObjects &screenObjects = _vm->_game->_screenObjects; if ((userInterface._category == CAT_COMMAND || userInterface._category == CAT_INV_VOCAB) && _interAwaiting != AWAITING_COMMAND && _pickedWord >= 0) { @@ -377,20 +377,20 @@ void MADSAction::checkActionAtMousePos() { case CAT_INV_ANIM: if (_interAwaiting != AWAITING_THAT) { if (userInterface._selectedActionIndex >= 0) { - _actionMode = ACTIONMODE_VERB; + _commandSource = ACTIONMODE_VERB; _selectedRow = userInterface._selectedActionIndex; _flags1 = scene._verbList[_selectedRow]._action1; _flags2 = scene._verbList[_selectedRow]._action2; _interAwaiting = AWAITING_THIS; } else if (userInterface._selectedItemVocabIdx >= 0) { - _actionMode = ACTIONMODE_OBJECT; + _commandSource = ACTIONMODE_OBJECT; _selectedRow = userInterface._selectedItemVocabIdx; int objectId = _vm->_game->_objects._inventoryList[_selectedRow]; InventoryObject &invObject = _vm->_game->_objects[objectId]; _flags1 = invObject._vocabList[_selectedRow - 1]._actionFlags1; _flags2 = invObject._vocabList[_selectedRow - 1]._actionFlags2; - _actionMode2 = ACTIONMODE2_2; + _mainObjectSource = ACTIONMODE2_2; _hotspotId = userInterface._selectedInvIndex; _articleNumber = _flags2; @@ -409,7 +409,7 @@ void MADSAction::checkActionAtMousePos() { _articleNumber = 0; switch (userInterface._category) { case CAT_COMMAND: - _actionMode = ACTIONMODE_VERB; + _commandSource = ACTIONMODE_VERB; _selectedRow = _pickedWord; if (_selectedRow >= 0) { _flags1 = scene._verbList[_selectedRow]._action1; @@ -418,11 +418,11 @@ void MADSAction::checkActionAtMousePos() { break; case CAT_INV_VOCAB: - _actionMode = ACTIONMODE_OBJECT; + _commandSource = ACTIONMODE_OBJECT; _selectedRow = _pickedWord; if (_selectedRow < 0) { _hotspotId = -1; - _actionMode2 = ACTIONMODE2_0; + _mainObjectSource = ACTIONMODE2_0; } else { int objectId = _vm->_game->_objects._inventoryList[_selectedRow]; InventoryObject &invObject = _vm->_game->_objects[objectId]; @@ -430,7 +430,7 @@ void MADSAction::checkActionAtMousePos() { _flags1 = invObject._vocabList[_selectedRow - 2]._actionFlags1; _flags2 = invObject._vocabList[_selectedRow - 2]._actionFlags2; _hotspotId = userInterface._selectedInvIndex; - _actionMode2 = ACTIONMODE2_2; + _mainObjectSource = ACTIONMODE2_2; if (_flags1 == 2) _articleNumber = _flags2; @@ -439,13 +439,13 @@ void MADSAction::checkActionAtMousePos() { case CAT_HOTSPOT: _selectedRow = -1; - _actionMode = ACTIONMODE_NONE; - _actionMode2 = ACTIONMODE2_4; + _commandSource = ACTIONMODE_NONE; + _mainObjectSource = ACTIONMODE2_4; _hotspotId = _pickedWord; break; case CAT_TALK_ENTRY: - _actionMode = ACTIONMODE_TALK; + _commandSource = ACTIONMODE_TALK; _selectedRow = _pickedWord; break; @@ -461,7 +461,7 @@ void MADSAction::checkActionAtMousePos() { case CAT_HOTSPOT: case CAT_INV_ANIM: // TODO: We may not need a separate ActionMode2 enum - _actionMode2 = (ActionMode2)userInterface._category; + _mainObjectSource = userInterface._category; _hotspotId = _pickedWord; break; default: @@ -474,8 +474,8 @@ void MADSAction::checkActionAtMousePos() { case CAT_INV_LIST: case CAT_HOTSPOT: case CAT_INV_ANIM: - _v86F42 = userInterface._category; - _v86F3A = _pickedWord; + _secondObjectSource = userInterface._category; + _secondObject = _pickedWord; break; default: break; @@ -490,7 +490,6 @@ void MADSAction::checkActionAtMousePos() { void MADSAction::leftClick() { Scene &scene = _vm->_game->_scene; UserInterface &userInterface = scene._userInterface; - ScreenObjects &screenObjects = _vm->_game->_screenObjects; bool abortFlag = false; if ((userInterface._category == CAT_COMMAND || userInterface._category == CAT_INV_VOCAB) && @@ -522,7 +521,7 @@ void MADSAction::leftClick() { } else { _recentCommand = _selectedRow; - _recentCommandSource = _actionMode; + _recentCommandSource = _commandSource; _interAwaiting = AWAITING_THIS; } } @@ -551,7 +550,7 @@ void MADSAction::leftClick() { } _recentCommand = _selectedRow; - _recentCommandSource = _actionMode; + _recentCommandSource = _commandSource; } break; @@ -606,7 +605,7 @@ void MADSAction::leftClick() { case CAT_INV_LIST: case CAT_HOTSPOT: case CAT_INV_ANIM: - if (_v86F3A >= 0) { + if (_secondObject >= 0) { _selectedAction = -1; if (userInterface._category == CAT_HOTSPOT) { diff --git a/engines/mads/action.h b/engines/mads/action.h index 45886c1bca..4b51ec9b71 100644 --- a/engines/mads/action.h +++ b/engines/mads/action.h @@ -28,8 +28,9 @@ namespace MADS { -enum ActionMode { ACTIONMODE_NONE = 0, ACTIONMODE_VERB = 1, ACTIONMODE_OBJECT = 3, ACTIONMODE_TALK = 6 }; -enum ActionMode2 { ACTIONMODE2_0 = 0, ACTIONMODE2_2 = 2, ACTIONMODE2_4 = 4, ACTIONMODE2_5 = 5 }; +enum { ACTIONMODE_NONE = 0, ACTIONMODE_VERB = 1, ACTIONMODE_OBJECT = 3, ACTIONMODE_TALK = 6 }; +enum { ACTIONMODE2_0 = 0, ACTIONMODE2_2 = 2, ACTIONMODE2_4 = 4, ACTIONMODE2_5 = 5 }; + enum TriggerMode { KERNEL_TRIGGER_PARSER = 0, // Triggers parser KERNEL_TRIGGER_DAEMON = 1, // Triggers step/daemon code @@ -69,12 +70,13 @@ struct ActionDetails { }; struct ActionSavedFields { - int _actionMode; - int _selectedRow; - int _hotspotId; - int _v86F3A; - int _actionMode2; - int _v86F42; + bool _commandError; + int _commandSource; + int _command; + int _mainObject; + int _secondObject; + int _mainObjectSource; + int _secondObjectSource; int _articleNumber; int _lookFlag; }; @@ -90,8 +92,8 @@ private: public: ActionDetails _action, _activeAction; int8 _flags1, _flags2; - ActionMode _actionMode; - ActionMode2 _actionMode2; + int _commandSource; + int _mainObjectSource; int _articleNumber; bool _lookFlag; int _selectedRow; @@ -103,14 +105,13 @@ public: Common::String _sentence; // Unknown fields - int16 _v86F3A; - int16 _v86F42; + int16 _secondObject; + int16 _secondObjectSource; int16 _recentCommandSource; bool _v86F4A; int16 _recentCommand; InterAwaiting _interAwaiting; bool _inProgress; - int _v8453A; int _pickedWord; public: @@ -120,7 +121,14 @@ public: void set(); const Common::String &statusText() const { return _statusText; } void refresh(); + + /** + * Accepts the currently defined sentence from the ScreenObjects parser. + * Copies the data, and checks to see if the action requires the player + * to walk to the given hotspot. + */ void startAction(); + void checkAction(); bool isAction(int verbId, int objectNameId = 0, int indirectObjectId = 0); diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 2736e77ef6..090ddd08ad 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -172,7 +172,7 @@ void Game::sectionLoop() { // Reset the user interface _screenObjects._v8333C = true; - _screenObjects._v832EC = 0; + _screenObjects._inputMode = kInputBuildingSentences; _scene._userInterface._scrollerY = 0; _player._loadsFirst = true; diff --git a/engines/mads/hotspots.cpp b/engines/mads/hotspots.cpp index 22e4feb8b0..fec1f6ef96 100644 --- a/engines/mads/hotspots.cpp +++ b/engines/mads/hotspots.cpp @@ -131,9 +131,9 @@ void DynamicHotspots::refresh() { DynamicHotspot &dh = (*this)[i]; if ((*this)[i]._active) { - switch (scrObjects._v832EC) { - case 0: - case 2: + switch (scrObjects._inputMode) { + case kInputBuildingSentences: + case kInputLimitedSentences: scrObjects.add(dh._bounds, _vm->_game->_scene._layer, CAT_12, dh._descId); scrObjects._v8333C = true; break; diff --git a/engines/mads/inventory.cpp b/engines/mads/inventory.cpp index a8e50e6ae1..43b7b6ea28 100644 --- a/engines/mads/inventory.cpp +++ b/engines/mads/inventory.cpp @@ -116,7 +116,8 @@ void InventoryObjects::addToInventory(int objectId) { (*this)[objectId]._roomNumber = PLAYER_INVENTORY; - if (_vm->_game->_kernelMode == KERNEL_ACTIVE_CODE && !_vm->_game->_screenObjects._v832EC) { + if (_vm->_game->_kernelMode == KERNEL_ACTIVE_CODE && + _vm->_game->_screenObjects._inputMode == kInputBuildingSentences) { userInterface.categoryChanged(); userInterface.selectObject(userInterface._selectedInvIndex); } @@ -137,7 +138,8 @@ void InventoryObjects::removeFromInventory(int objectId, int newScene) { int selectedIndex = userInterface._selectedInvIndex; bool noSelection = selectedIndex < 0; - if (_vm->_game->_kernelMode == KERNEL_ACTIVE_CODE && !_vm->_game->_screenObjects._v832EC) + if (_vm->_game->_kernelMode == KERNEL_ACTIVE_CODE && + _vm->_game->_screenObjects._inputMode == kInputBuildingSentences) userInterface.selectObject(-1); // Remove the item from the inventory list @@ -158,7 +160,8 @@ void InventoryObjects::removeFromInventory(int objectId, int newScene) { newIndex = 0; } - if (_vm->_game->_kernelMode == KERNEL_ACTIVE_CODE && !_vm->_game->_screenObjects._v832EC) { + if (_vm->_game->_kernelMode == KERNEL_ACTIVE_CODE && + _vm->_game->_screenObjects._inputMode == kInputBuildingSentences) { userInterface.categoryChanged(); userInterface.selectObject(newIndex); } diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index e8d8a2826a..b91384d85b 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -760,7 +760,7 @@ void Scene202::actions() { } _scene->_nextSceneId = 201; } else if (action->isAction(VERB_TAKE, 0x2C)) { - if (action->_actionMode2 == 4) { + if (action->_mainObjectSource == 4) { if (_game._trigger == 0) { if (_game._objects.isInInventory(OBJ_BONES)) { _vm->_dialogs->show(0x4EFB); @@ -952,7 +952,7 @@ void Scene202::actions() { } else if (action->isAction(VERB_TAKE, 0x140)) { _vm->_dialogs->show(0x4EF8); } else if (action->isAction(VERB_LOOK, 0x2D)) { - if (action->_actionMode == 4) + if (action->_commandSource == 4) _vm->_dialogs->show(0x4EF9); else return; diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index cb761ca138..f8eeb3748a 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -138,7 +138,7 @@ void Scene804::enter() { Scene8xx::enter1(); if (_globals[kInSpace] && !_globals[kWindowFixed]) { - _scene->_userInterface.setup(2); + _scene->_userInterface.setup(kInputLimitedSentences); _vm->_sound->command(19); } } diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 9e27f2724e..a71eade786 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -160,7 +160,7 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) { _interfaceY = MADS_SCENE_HEIGHT; _spritesCount = _sprites.size(); - _userInterface.setup(_vm->_game->_screenObjects._v832EC); + _userInterface.setup(_vm->_game->_screenObjects._inputMode); warning("TODO: showMouse"); @@ -299,7 +299,7 @@ void Scene::doFrame() { _action.startAction(); if (_action._activeAction._verbId == Nebular::NOUN_LOOK_AT) { _action._activeAction._verbId = VERB_LOOK; - _action._savedFields._selectedRow = false; + _action._savedFields._command = false; } flag = true; @@ -438,7 +438,8 @@ void Scene::drawElements(ScreenTransition transitionType, bool surfaceFlag) { } void Scene::doPreactions() { - if (_vm->_game->_screenObjects._v832EC == 0 || _vm->_game->_screenObjects._v832EC == 2) { + if (_vm->_game->_screenObjects._inputMode == kInputBuildingSentences || + _vm->_game->_screenObjects._inputMode == kInputLimitedSentences) { _vm->_game->_triggerSetupMode = KERNEL_TRIGGER_PREPARE; _action.checkAction(); _sceneLogic->preActions(); @@ -449,37 +450,38 @@ void Scene::doPreactions() { } void Scene::doAction() { - int flag = 0; + bool flag = false; _vm->_game->_triggerSetupMode = KERNEL_TRIGGER_PARSER; - if ((_action._inProgress || _vm->_game->_trigger) && !_action._v8453A) { + if ((_action._inProgress || _vm->_game->_trigger) && !_action._savedFields._commandError) { _sceneLogic->actions(); _action._inProgress = true; - flag = -1; + flag = true; } - if (_vm->_game->_screenObjects._v832EC == 1) { + if (_vm->_game->_screenObjects._inputMode == kInputConversation) { _action._inProgress = false; } else { if ((_action._inProgress || _vm->_game->_trigger) || - (!flag && _action._v8453A == flag)) { + (!flag && _action._savedFields._commandError == flag)) { _vm->_game->_sectionHandler->sectionPtr2(); _action._inProgress = true; - flag = -1; + flag = true; } - if ((_action._inProgress || _vm->_game->_trigger) && (!flag || _action._v8453A == flag)) { + if ((_action._inProgress || _vm->_game->_trigger) && + (!flag || _action._savedFields._commandError == flag)) { _vm->_game->doObjectAction(); } if (!_action._savedFields._lookFlag) { if (!_action._inProgress) { - _action._v8453A = -1; + _action._savedFields._commandError = true; _sceneLogic->postActions(); } if (!_action._inProgress) { - _action._v8453A = -1; + _action._savedFields._commandError = true; warning("TODO: PtrUnk4"); } diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index b55d80c9ec..44f0907040 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -253,7 +253,7 @@ ScreenObject::ScreenObject() { ScreenObjects::ScreenObjects(MADSEngine *vm) : _vm(vm) { _objectY = -1; _v8333C = false; - _v832EC = 0; + _inputMode = kInputBuildingSentences; _v7FED6 = 0; _v8332A = 0; _category = CAT_NONE; @@ -285,7 +285,7 @@ void ScreenObjects::check(bool scanFlag) { Scene &scene = _vm->_game->_scene; UserInterface &userInterface = scene._userInterface; - if (!_vm->_events->_mouseButtons || _v832EC) + if (!_vm->_events->_mouseButtons || _inputMode != kInputBuildingSentences) _vm->_events->_anyStroke = false; if ((_vm->_events->_mouseMoved || _vm->_game->_scene._userInterface._scrollerY @@ -380,7 +380,7 @@ void ScreenObjects::checkScroller() { UserInterface &userInterface = _vm->_game->_scene._userInterface; Common::Array &inventoryList = _vm->_game->_objects._inventoryList; - if (_v832EC) + if (_inputMode != kInputBuildingSentences) return; userInterface._scrollerY = 0; diff --git a/engines/mads/screen.h b/engines/mads/screen.h index 31fdd2a470..3595907b73 100644 --- a/engines/mads/screen.h +++ b/engines/mads/screen.h @@ -55,6 +55,12 @@ enum ScreenTransition { kVertTransition7, kCenterVertTransition }; +enum InputMode { + kInputBuildingSentences = 0, // Normal sentence building + kInputConversation = 1, // Conversation mode + kInputLimitedSentences = 2 // Use only scene hotspots +}; + class SpriteSlot; class TextDisplay; class UISlot; @@ -148,7 +154,7 @@ private: */ void checkScroller(); public: - int _v832EC; + InputMode _inputMode; int _v7FED6; int _v8332A; int _v8333C; diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 7ed1884e88..4b174e8266 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -239,10 +239,10 @@ void UserInterface::load(const Common::String &resName) { delete pixelsStream; } -void UserInterface::setup(int id) { +void UserInterface::setup(InputMode inputMode) { Scene &scene = _vm->_game->_scene; - if (_vm->_game->_screenObjects._v832EC != id) { + if (_vm->_game->_screenObjects._inputMode != inputMode) { Common::String resName = _vm->_game->_aaName; // Strip off any extension @@ -252,7 +252,7 @@ void UserInterface::setup(int id) { } // Add on suffix if necessary - if (id) + if (inputMode != kInputBuildingSentences) resName += "A"; resName += ".INT"; @@ -260,7 +260,7 @@ void UserInterface::setup(int id) { load(resName); _surface.copyTo(this); } - _vm->_game->_screenObjects._v832EC = id; + _vm->_game->_screenObjects._inputMode = inputMode; scene._userInterface._uiSlots.clear(); scene._userInterface._uiSlots.fullRefresh(); @@ -279,7 +279,7 @@ void UserInterface::setup(int id) { } void UserInterface::drawTextElements() { - if (_vm->_game->_screenObjects._v832EC) { + if (_vm->_game->_screenObjects._inputMode) { drawTalkList(); } else { // Draw the actions @@ -408,7 +408,7 @@ void UserInterface::loadElements() { Common::Rect bounds; _vm->_game->_screenObjects.clear(); - if (!_vm->_game->_screenObjects._v832EC) { + if (_vm->_game->_screenObjects._inputMode == kInputBuildingSentences) { // Set up screen objects for the inventory scroller for (int idx = 1; idx <= 3; ++idx) { getBounds(CAT_INV_SCROLLER, idx, bounds); @@ -450,7 +450,8 @@ void UserInterface::loadElements() { CAT_INV_ANIM, 0); } - if (!_vm->_game->_screenObjects._v832EC || _vm->_game->_screenObjects._v832EC == 2) { + if (!_vm->_game->_screenObjects._inputMode == kInputBuildingSentences || + _vm->_game->_screenObjects._inputMode == kInputLimitedSentences) { _categoryIndexes[CAT_HOTSPOT - 1] = _vm->_game->_screenObjects.size() + 1; for (int hotspotIdx = scene._hotspots.size() - 1; hotspotIdx >= 0; --hotspotIdx) { Hotspot &hs = scene._hotspots[hotspotIdx]; @@ -458,7 +459,7 @@ void UserInterface::loadElements() { } } - if (_vm->_game->_screenObjects._v832EC == 1) { + if (_vm->_game->_screenObjects._inputMode == kInputConversation) { // setup areas for talk entries _categoryIndexes[CAT_TALK_ENTRY - 1] = _vm->_game->_screenObjects.size() + 1; for (int idx = 0; idx < 5; ++idx) { @@ -594,7 +595,7 @@ void UserInterface::noInventoryAnim() { _invSpritesIndex = -1; } - if (!_vm->_game->_screenObjects._v832EC) + if (_vm->_game->_screenObjects._inputMode == kInputBuildingSentences) refresh(); } @@ -608,8 +609,9 @@ void UserInterface::refresh() { void UserInterface::inventoryAnim() { Scene &scene = _vm->_game->_scene; - if (_vm->_game->_screenObjects._v832EC == 1 || _vm->_game->_screenObjects._v832EC == 2 - || _invSpritesIndex < 0) + if (_vm->_game->_screenObjects._inputMode == kInputConversation || + _vm->_game->_screenObjects._inputMode == kInputLimitedSentences || + _invSpritesIndex < 0) return; // Move to the next frame number in the sequence, resetting if at the end diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h index 53c1e10466..445cd1e487 100644 --- a/engines/mads/user_interface.h +++ b/engines/mads/user_interface.h @@ -166,7 +166,7 @@ public: /** * Set up the interface */ - void setup(int id); + void setup(InputMode inputMode); void drawTextElements(); -- cgit v1.2.3 From 25b93a11ee28256331bb52ccdf5441e357c367c1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 3 Apr 2014 22:36:36 -0400 Subject: MADS: Fix hotspot loading, and a couple of other warnings --- engines/mads/nebular/dialogs_nebular.cpp | 4 ++-- engines/mads/user_interface.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp index fea5fa5b75..bfc225ee66 100644 --- a/engines/mads/nebular/dialogs_nebular.cpp +++ b/engines/mads/nebular/dialogs_nebular.cpp @@ -124,7 +124,7 @@ bool DialogsNebular::show(int msgId) { Common::String valStr; Common::String dialogText; bool result = true; - bool centerFlag; + bool centerFlag = false; bool underlineFlag; bool commandFlag; bool crFlag; @@ -268,7 +268,7 @@ bool DialogsNebular::textNoun(Common::String &dialogText, int nounNum, bool DialogsNebular::commandCheck(const char *idStr, Common::String &valStr, const Common::String &command) { - int idLen = strlen(idStr); + uint idLen = strlen(idStr); valStr = (command.size() <= idLen) ? "" : Common::String(command.c_str() + idLen); diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 4b174e8266..d229c39c26 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -450,7 +450,7 @@ void UserInterface::loadElements() { CAT_INV_ANIM, 0); } - if (!_vm->_game->_screenObjects._inputMode == kInputBuildingSentences || + if (_vm->_game->_screenObjects._inputMode == kInputBuildingSentences || _vm->_game->_screenObjects._inputMode == kInputLimitedSentences) { _categoryIndexes[CAT_HOTSPOT - 1] = _vm->_game->_screenObjects.size() + 1; for (int hotspotIdx = scene._hotspots.size() - 1; hotspotIdx >= 0; --hotspotIdx) { -- cgit v1.2.3 From 19a814f38ccb6c3758e6dacd3d3e1747e2aa6947 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 3 Apr 2014 22:50:47 -0400 Subject: MADS: Fix setting _commandError in MADSAction::startAction --- engines/mads/action.cpp | 2 +- engines/mads/nebular/nebular_scenes1.cpp | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index 8ee46e2a39..005058078b 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -289,7 +289,7 @@ void MADSAction::startAction() { _activeAction = _action; _sentence = _statusText; - if ((_mainObjectSource == ACTIONMODE2_4) && (_secondObjectSource == 0)) + if ((_mainObjectSource == ACTIONMODE2_4) && (_secondObjectSource == 4)) _savedFields._commandError = true; player._needToWalk = false; diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 51a2d9586e..b429aa095e 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -278,8 +278,7 @@ void Scene103::actions() { default: break; } - } - else if (_action.isAction(VERB_TAKE, 371) && _game._objects.isInRoom(OBJ_TIMER_MODULE)) { + } else if (_action.isAction(VERB_TAKE, 371) && _game._objects.isInRoom(OBJ_TIMER_MODULE)) { switch (_vm->_game->_trigger) { case 0: _scene->changeDepthSurface(1); @@ -370,8 +369,7 @@ void Scene103::actions() { } } else if (_action.isAction(VERB_LOOK, 250)) { _vm->_dialogs->show(!_globals[kTurkeyExploded] ? 10323 : 10303); - } - else if (_action.isAction(VERB_TALKTO, 27)) { + } else if (_action.isAction(VERB_TALKTO, 27)) { switch (_vm->_game->_trigger) { case 0: { _game._player._stepEnabled = false; -- cgit v1.2.3 From 7f15c6d5fd0f2c1bfef1d69d0556233543a6cd8a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 4 Apr 2014 08:19:37 -0400 Subject: MADS: Beginnings of proper look dialog display --- engines/mads/dialogs.cpp | 39 +++++++++++++++++--------------- engines/mads/dialogs.h | 11 ++++++++- engines/mads/nebular/dialogs_nebular.cpp | 2 +- 3 files changed, 32 insertions(+), 20 deletions(-) diff --git a/engines/mads/dialogs.cpp b/engines/mads/dialogs.cpp index 1215df36ae..13342f14f1 100644 --- a/engines/mads/dialogs.cpp +++ b/engines/mads/dialogs.cpp @@ -59,8 +59,8 @@ void Dialog::draw() { // Draw the dialog // Fill entire content of dialog - _vm->_screen.fillRect(Common::Rect(_position.x, _position.y, - _position.x + _width, _position.y + _height), TEXTDIALOG_BACKGROUND); + Common::Rect bounds = getBounds(); + _vm->_screen.fillRect(bounds, TEXTDIALOG_BACKGROUND); // Draw the outer edge lines _vm->_screen.hLine(_position.x + 1, _position.y + _height - 2, @@ -76,6 +76,8 @@ void Dialog::draw() { drawContent(Common::Rect(_position.x + 2, _position.y + 2, _position.x + _width - 2, _position.y + _height - 2), 0, TEXTDIALOG_CONTENT1, TEXTDIALOG_CONTENT2); + + _vm->_screen.copyRectToScreen(bounds); } void Dialog::drawContent(const Common::Rect &r, int seed, byte color1, byte color2) { @@ -103,12 +105,12 @@ TextDialog::TextDialog(MADSEngine *vm, const Common::String &fontName, const Common::Point &pos, int maxChars): Dialog(vm) { _vm = vm; - _fontName = fontName; + _font = _vm->_font->getFont(fontName); _position = pos; _vm->_font->setColors(TEXTDIALOG_BLACK, TEXTDIALOG_BLACK, TEXTDIALOG_BLACK, TEXTDIALOG_BLACK); - _innerWidth = (_vm->_font->maxWidth() + 1) * maxChars; + _innerWidth = (_font->maxWidth() + 1) * maxChars; _width = _innerWidth + 10; _lineSize = maxChars * 2; _lineWidth = 0; @@ -139,7 +141,7 @@ void TextDialog::addLine(const Common::String &line, bool underline) { if (_lineWidth > 0 || _currentX > 0) incNumLines(); - int stringWidth = _vm->_font->getWidth(line, 1); + int stringWidth = _font->getWidth(line, 1); if (stringWidth >= _innerWidth || (int)line.size() >= _lineSize) { wordWrap(line); } else { @@ -211,7 +213,7 @@ void TextDialog::wordWrap(const Common::String &line) { tempLine2 += ' '; tempLine2 += tempLine; - int lineWidth = _vm->_font->getWidth(tempLine2, 1); + int lineWidth = _font->getWidth(tempLine2, 1); if (((_currentX + (int)tempLine2.size()) > _lineSize) || ((_lineWidth + lineWidth) > _innerWidth)) { incNumLines(); @@ -228,7 +230,7 @@ void TextDialog::wordWrap(const Common::String &line) { void TextDialog::appendLine(const Common::String &line) { _currentX += line.size(); - _lineWidth += _vm->_font->getWidth(line, 1); + _lineWidth += _font->getWidth(line, 1); _lines[_numLines] += line; } @@ -255,7 +257,7 @@ void TextDialog::draw() { --_numLines; // Figure out the size and position for the dialog - _height = (_vm->_font->getHeight() + 1) * (_numLines + 1) + 10; + _height = (_font->getHeight() + 1) * (_numLines + 1) + 10; if (_position.x == -1) _position.x = 160 - (_width / 2); if (_position.y == -1) @@ -275,7 +277,7 @@ void TextDialog::draw() { if (_lineXp[lineNum] == -1) { // Draw a line across the entire dialog _vm->_screen.hLine(_position.x + 2, - lineYp + (_vm->_font->getHeight() + 1) / 2, + lineYp + (_font->getHeight() + 1) / 2, _position.x + _width - 4, TEXTDIALOG_BLACK); } else { // Draw a text line @@ -284,24 +286,26 @@ void TextDialog::draw() { if (_lineXp[lineNum] & 0x40) ++yp; - _vm->_font->writeString(&_vm->_screen, _lines[lineNum], + _font->writeString(&_vm->_screen, _lines[lineNum], Common::Point(xp, yp), 1); if (_lineXp[lineNum] & 0x80) { // Draw an underline under the text - int lineWidth = _vm->_font->getWidth(_lines[lineNum], 1); - _vm->_screen.hLine(xp, yp + _vm->_font->getHeight(), xp + lineWidth, + int lineWidth = _font->getWidth(_lines[lineNum], 1); + _vm->_screen.hLine(xp, yp + _font->getHeight(), xp + lineWidth, TEXTDIALOG_BLACK); } } - lineYp += _vm->_font->getHeight() + 1; + lineYp += _font->getHeight() + 1; } + + _vm->_screen.copyRectToScreen(getBounds()); } void TextDialog::drawWithInput() { //int innerWidth = _innerWidth; - //int lineHeight = _vm->_font->getHeight() + 1; + //int lineHeight = _font->getHeight() + 1; //int xp = _position.x + 5; // Draw the content of the dialog @@ -322,10 +326,9 @@ void TextDialog::show() { draw(); _vm->_events->showCursor(); - while (!_vm->shouldQuit() && !_vm->_events->_keyPressed && - !_vm->_events->_mouseClicked) { - _vm->_events->delay(1); - } + do { + _vm->_events->waitForNextFrame(); + } while (!_vm->shouldQuit() && !_vm->_events->_mouseReleased); } /*------------------------------------------------------------------------*/ diff --git a/engines/mads/dialogs.h b/engines/mads/dialogs.h index fe6041eca1..2c7c342319 100644 --- a/engines/mads/dialogs.h +++ b/engines/mads/dialogs.h @@ -25,6 +25,7 @@ #include "common/scummsys.h" #include "mads/game.h" +#include "mads/font.h" #include "mads/msurface.h" namespace MADS { @@ -68,6 +69,14 @@ public: * Destructor */ virtual ~Dialog(); + + /** + * Return the bounds of the dialog. + */ + Common::Rect getBounds() const { + return Common::Rect(_position.x, _position.y, + _position.x + _width, _position.y + _height); + } }; enum { @@ -95,7 +104,7 @@ private: */ void restorePalette(); protected: - Common::String _fontName; + Font *_font; int _innerWidth; int _lineWidth; int _currentX; diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp index bfc225ee66..3be3db33b3 100644 --- a/engines/mads/nebular/dialogs_nebular.cpp +++ b/engines/mads/nebular/dialogs_nebular.cpp @@ -135,8 +135,8 @@ bool DialogsNebular::show(int msgId) { // Loop through the lines of the returned text for (uint idx = 0; idx < msg.size(); ++idx) { Common::String srcLine = msg[idx]; - const char *srcP = srcLine.c_str(); + dialogText = ""; commandFlag = false; underlineFlag = false; centerFlag = false; -- cgit v1.2.3 From 366e6ae38f9916277096f93bed393edd0cd83e45 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 4 Apr 2014 09:07:40 -0400 Subject: MADS: Fix action checks in scene 103 actions code --- engines/mads/nebular/nebular_scenes1.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index b429aa095e..cda8f8995c 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -398,29 +398,29 @@ void Scene103::actions() { default: break; } - } else if (!_action.isAction(VERB_LOOK, 27)) { + } else if (_action.isAction(VERB_LOOK, 27)) { _vm->_dialogs->show(10304); - } else if (!_action.isAction(VERB_LOOK, 36)) { + } else if (_action.isAction(VERB_LOOK, 36)) { _vm->_dialogs->show(10307); - } else if (!_action.isAction(VERB_LOOK, 55)) { + } else if (_action.isAction(VERB_LOOK, 55)) { _vm->_dialogs->show(10308); - } else if (!_action.isAction(VERB_TAKE, 315)) { + } else if (_action.isAction(VERB_TAKE, 315)) { _vm->_dialogs->show(10309); - } else if (!_action.isAction(VERB_TAKE, 85)) { + } else if (_action.isAction(VERB_TAKE, 85)) { _vm->_dialogs->show(10310); - } else if (!_action.isAction(VERB_LOOK, 144)) { + } else if (_action.isAction(VERB_LOOK, 144)) { _vm->_dialogs->show(10312); - } else if (!_action.isAction(VERB_OPEN, 144)) { + } else if (_action.isAction(VERB_OPEN, 144)) { _vm->_dialogs->show(10313); - } else if (!_action.isAction(VERB_CLOSE, 27)) { + } else if (_action.isAction(VERB_CLOSE, 27)) { _vm->_dialogs->show(10314); - } else if (!_action.isAction(VERB_LOOK, 310)) { + } else if (_action.isAction(VERB_LOOK, 310)) { _vm->_dialogs->show(10315); - } else if (!_action.isAction(VERB_LOOK, 178)) { + } else if (_action.isAction(VERB_LOOK, 178)) { _vm->_dialogs->show(10316); - } else if (!_action.isAction(VERB_LOOK, 283)) { + } else if (_action.isAction(VERB_LOOK, 283)) { _vm->_dialogs->show(10317); - } else if (!_action.isAction(VERB_LOOK, 120)) { + } else if (_action.isAction(VERB_LOOK, 120)) { _vm->_dialogs->show(10318); } else if (_action.isAction(VERB_LOOK, 289) && _game._objects.isInInventory(OBJ_REBREATHER)) { @@ -428,7 +428,7 @@ void Scene103::actions() { } else if (_action.isAction(VERB_LOOK, 371) && _game._objects.isInInventory(OBJ_TIMER_MODULE)) { _vm->_dialogs->show(10320); - } else if (!_action.isAction(VERB_LOOK, 137)) { + } else if (_action.isAction(VERB_LOOK, 137)) { _vm->_dialogs->show(10321); } else if (_action.isAction(VERB_LOOK, 409)) { _vm->_dialogs->show(_game._objects.isInInventory(OBJ_TIMER_MODULE) ? 10324 : 10325); -- cgit v1.2.3 From 4639d37609f62bae8d0bcffc5a2e64c79f2659a7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 4 Apr 2014 09:35:18 -0400 Subject: MADS: Fixes for properly displaying the text of a message dialog --- engines/mads/dialogs.cpp | 13 ++++++++++--- engines/mads/font.cpp | 2 +- engines/mads/nebular/dialogs_nebular.cpp | 18 ++++++++++-------- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/engines/mads/dialogs.cpp b/engines/mads/dialogs.cpp index 13342f14f1..d5e8ad5ba9 100644 --- a/engines/mads/dialogs.cpp +++ b/engines/mads/dialogs.cpp @@ -43,6 +43,8 @@ void Dialog::save(MSurface *s) { s->copyTo(_savedSurface, Common::Rect(_position.x, _position.y, _position.x + _width, _position.y + _height), Common::Point()); + + _vm->_screen.copyRectToScreen(getBounds()); } void Dialog::restore(MSurface *s) { @@ -50,6 +52,8 @@ void Dialog::restore(MSurface *s) { _savedSurface->copyTo(s, _position); delete _savedSurface; _savedSurface = nullptr; + + _vm->_screen.copyRectToScreen(getBounds()); } } @@ -76,8 +80,6 @@ void Dialog::draw() { drawContent(Common::Rect(_position.x + 2, _position.y + 2, _position.x + _width - 2, _position.y + _height - 2), 0, TEXTDIALOG_CONTENT1, TEXTDIALOG_CONTENT2); - - _vm->_screen.copyRectToScreen(bounds); } void Dialog::drawContent(const Common::Rect &r, int seed, byte color1, byte color2) { @@ -273,7 +275,7 @@ void TextDialog::draw() { // Draw the text lines int lineYp = _position.y + 5; - for (int lineNum = 0; lineNum < _numLines; ++lineNum) { + for (int lineNum = 0; lineNum <= _numLines; ++lineNum) { if (_lineXp[lineNum] == -1) { // Draw a line across the entire dialog _vm->_screen.hLine(_position.x + 2, @@ -326,9 +328,14 @@ void TextDialog::show() { draw(); _vm->_events->showCursor(); + // Wait for mouse click do { _vm->_events->waitForNextFrame(); } while (!_vm->shouldQuit() && !_vm->_events->_mouseReleased); + + // Allow the mouse release to be gobbled up + if (!_vm->shouldQuit()) + _vm->_events->waitForNextFrame(); } /*------------------------------------------------------------------------*/ diff --git a/engines/mads/font.cpp b/engines/mads/font.cpp index 294139c3dd..ba10099184 100644 --- a/engines/mads/font.cpp +++ b/engines/mads/font.cpp @@ -141,7 +141,7 @@ int Font::writeString(MSurface *surface, const Common::String &msg, const Common if (width > 0) xEnd = MIN((int)surface->w, pt.x + width); else - xEnd = surface->w - pt.x; + xEnd = surface->w; int x = pt.x; int y = pt.y; diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp index 3be3db33b3..ff25696f5d 100644 --- a/engines/mads/nebular/dialogs_nebular.cpp +++ b/engines/mads/nebular/dialogs_nebular.cpp @@ -125,9 +125,9 @@ bool DialogsNebular::show(int msgId) { Common::String dialogText; bool result = true; bool centerFlag = false; - bool underlineFlag; - bool commandFlag; - bool crFlag; + bool underlineFlag = false; + bool commandFlag = false; + bool crFlag = false; TextDialog *dialog = nullptr; _dialogWidth = 17; _capitalizationMode = kUppercase; @@ -136,11 +136,6 @@ bool DialogsNebular::show(int msgId) { for (uint idx = 0; idx < msg.size(); ++idx) { Common::String srcLine = msg[idx]; const char *srcP = srcLine.c_str(); - dialogText = ""; - commandFlag = false; - underlineFlag = false; - centerFlag = false; - crFlag = false; // Loop through the text of the line while (srcP < srcLine.c_str() + srcLine.size()) { @@ -226,6 +221,13 @@ bool DialogsNebular::show(int msgId) { } else { dialog->wordWrap(dialogText); } + + // Reset line processing flags in preparation for next line + dialogText = ""; + commandFlag = false; + underlineFlag = false; + centerFlag = false; + crFlag = false; } if (!centerFlag) -- cgit v1.2.3 From b778217d8eea64d385947a96a94cdea7c686c605 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 4 Apr 2014 20:57:09 -0400 Subject: MADS: Fix for actions get repeated endlessly --- engines/mads/scene.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index a71eade786..64260a69dc 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -455,8 +455,7 @@ void Scene::doAction() { _vm->_game->_triggerSetupMode = KERNEL_TRIGGER_PARSER; if ((_action._inProgress || _vm->_game->_trigger) && !_action._savedFields._commandError) { _sceneLogic->actions(); - _action._inProgress = true; - flag = true; + flag = !_action._inProgress; } if (_vm->_game->_screenObjects._inputMode == kInputConversation) { @@ -465,8 +464,7 @@ void Scene::doAction() { if ((_action._inProgress || _vm->_game->_trigger) || (!flag && _action._savedFields._commandError == flag)) { _vm->_game->_sectionHandler->sectionPtr2(); - _action._inProgress = true; - flag = true; + flag = !_action._inProgress; } if ((_action._inProgress || _vm->_game->_trigger) && -- cgit v1.2.3 From ebe4d369a54d852b7d789ac247a872799e68e495 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 5 Apr 2014 12:43:50 -0400 Subject: MADS: Fixes for actions triggering prematurely --- engines/mads/action.cpp | 2 +- engines/mads/events.cpp | 6 +++--- engines/mads/game.cpp | 2 +- engines/mads/nebular/nebular_scenes1.cpp | 2 ++ engines/mads/scene.cpp | 7 ++++--- engines/mads/sequence.cpp | 10 +++++----- engines/mads/sequence.h | 2 +- 7 files changed, 17 insertions(+), 14 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index 005058078b..ccfd13be1d 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -320,7 +320,7 @@ void MADSAction::startAction() { if (hotspotId >= 0 && hotspotId < (int)hotspots.size()) { Hotspot &hs = hotspots[hotspotId]; - if (hs._feetPos.x == -1 || hs._feetPos.x != -3) { + if (hs._feetPos.x == -1 || hs._feetPos.x == -3) { checkCustomDest(hs._feetPos.x); } else if (hs._feetPos.x >= 0) { if (_savedFields._commandSource == ACTIONMODE_NONE || hs._cursor < CURSOR_WAIT) { diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp index 29ea927bbc..244ae727e3 100644 --- a/engines/mads/events.cpp +++ b/engines/mads/events.cpp @@ -130,20 +130,20 @@ void EventsManager::pollEvents() { _mouseClicked = true; _mouseButtons = 1; _mouseMoved = true; - _anyStroke = true; + //_anyStroke = true; return; case Common::EVENT_LBUTTONUP: case Common::EVENT_RBUTTONUP: _mouseClicked = false; _mouseReleased = true; _mouseMoved = true; - _anyStroke = true; + //_anyStroke = true; return; case Common::EVENT_MOUSEMOVE: _mousePos = event.mouse; _currentPos = event.mouse; _mouseMoved = true; - _anyStroke = true; + //_anyStroke = true; break; default: break; diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 090ddd08ad..d0d3b272ad 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -59,7 +59,7 @@ Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm), _priorFrameTimer = 0; _anyEmergency = false; _triggerMode = KERNEL_TRIGGER_PARSER; - _triggerSetupMode = KERNEL_TRIGGER_PARSER; + _triggerSetupMode = KERNEL_TRIGGER_DAEMON; _winStatus = 0; // Load the inventory object list diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index cda8f8995c..c12e7217eb 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -432,6 +432,8 @@ void Scene103::actions() { _vm->_dialogs->show(10321); } else if (_action.isAction(VERB_LOOK, 409)) { _vm->_dialogs->show(_game._objects.isInInventory(OBJ_TIMER_MODULE) ? 10324 : 10325); + } else { + return; } _action._inProgress = false; diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 64260a69dc..02877aac9c 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -313,9 +313,10 @@ void Scene::doFrame() { if (!_vm->_game->_fx) _frameStartTime = _vm->_events->getFrameCounter(); - if ((_action._inProgress && !player._moving && !player._needToWalk && - player._turnToFacing == player._facing) || - (_vm->_game->_trigger && _vm->_game->_triggerMode == KERNEL_TRIGGER_PARSER)) { + // Handle parser actions as well as game triggers + if ((_action._inProgress && !player._moving && !player._needToWalk && + (player._facing == player._turnToFacing) && !_vm->_game->_trigger) || + (_vm->_game->_trigger && (_vm->_game->_triggerMode == KERNEL_TRIGGER_PARSER))) { doAction(); } diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index 01ca69615f..5150b75c25 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -47,7 +47,7 @@ SequenceEntry::SequenceEntry() { _field22 = 0; _triggerCountdown = 0; _doneFlag = 0; - _abortMode = KERNEL_TRIGGER_PARSER; + _triggerMode = KERNEL_TRIGGER_DAEMON; _numTicks = 0; _extraTicks = 0; _timeout = 0; @@ -135,7 +135,7 @@ int SequenceList::add(int spriteListIndex, bool flipped, int frameIndex, int tri _entries[seqIndex]._flags = 0; _entries[seqIndex]._dynamicHotspotIndex = -1; _entries[seqIndex]._entries._count = 0; - _entries[seqIndex]._abortMode = _vm->_game->_triggerSetupMode; + _entries[seqIndex]._triggerMode = _vm->_game->_triggerSetupMode; _entries[seqIndex]._actionNouns = _vm->_game->_scene._action._activeAction; @@ -160,7 +160,7 @@ int SequenceList::addTimer(int time, int abortVal) { se._triggerCountdown = true; se._doneFlag = false; se._entries._count = 0; - se._abortMode = _vm->_game->_triggerSetupMode; + se._triggerMode = _vm->_game->_triggerSetupMode; se._actionNouns = _vm->_game->_scene._action._activeAction; addSubEntry(seqIndex, SM_0, 0, abortVal); @@ -328,9 +328,9 @@ bool SequenceList::loadSprites(int seqIndex) { if (idx >= 0) { _vm->_game->_trigger = seqEntry._entries._abortVal[idx]; - _vm->_game->_triggerMode = seqEntry._abortMode; + _vm->_game->_triggerMode = seqEntry._triggerMode; - if (seqEntry._abortMode == KERNEL_TRIGGER_DAEMON) + if (seqEntry._triggerMode == KERNEL_TRIGGER_DAEMON) scene._action._activeAction = seqEntry._actionNouns; } diff --git a/engines/mads/sequence.h b/engines/mads/sequence.h index 5dfdbce70e..8db06d5985 100644 --- a/engines/mads/sequence.h +++ b/engines/mads/sequence.h @@ -74,7 +74,7 @@ struct SequenceEntry { int _triggerCountdown; bool _doneFlag; SequenceSubEntries _entries; - TriggerMode _abortMode; + TriggerMode _triggerMode; ActionDetails _actionNouns; int _numTicks; -- cgit v1.2.3 From 2a105149fe734f9cec759b08e8a545bcd0b97078 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 5 Apr 2014 14:27:14 -0400 Subject: MADS: Fix pathfinding when dest pos is exactly the same as source pos --- engines/mads/player.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index a98fdb1b15..3eb6b118d7 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -388,8 +388,8 @@ void Player::move() { bool newFacing = false; if (_moving) { - bool isRouteEmpty = rails.empty(); while (!_walkOffScreen && _playerPos == _targetPos) { + bool isRouteEmpty = rails.empty(); if (!isRouteEmpty) { const WalkNode &node = rails.popNode(); -- cgit v1.2.3 From 06aeba275acb80df86ff103880c07ccc0e9738b1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 5 Apr 2014 14:27:33 -0400 Subject: MADS: Fix right mouse button handling --- engines/mads/action.cpp | 4 ++-- engines/mads/events.cpp | 7 +++---- engines/mads/events.h | 2 +- engines/mads/scene.cpp | 2 +- engines/mads/screen.cpp | 16 ++++++++-------- 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index ccfd13be1d..e227d7c700 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -366,7 +366,7 @@ void MADSAction::checkActionAtMousePos() { scene._lookFlag = true; } - if (_vm->_events->_anyStroke && _vm->_events->_mouseButtons) { + if (_vm->_events->_rightMousePressed && _vm->_events->_mouseButtons) { switch (userInterface._category) { case CAT_COMMAND: case CAT_INV_VOCAB: @@ -507,7 +507,7 @@ void MADSAction::leftClick() { } } - if (abortFlag || (_vm->_events->_anyStroke && (userInterface._category == CAT_COMMAND || + if (abortFlag || (_vm->_events->_rightMousePressed && (userInterface._category == CAT_COMMAND || userInterface._category == CAT_INV_VOCAB))) return; diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp index 244ae727e3..ecc7a528fd 100644 --- a/engines/mads/events.cpp +++ b/engines/mads/events.cpp @@ -46,7 +46,7 @@ EventsManager::EventsManager(MADSEngine *vm) { _vD4 = 0; _mouseMoved = false; _vD8 = 0; - _anyStroke = false; + _rightMousePressed = false; } EventsManager::~EventsManager() { @@ -129,21 +129,20 @@ void EventsManager::pollEvents() { case Common::EVENT_RBUTTONDOWN: _mouseClicked = true; _mouseButtons = 1; + _rightMousePressed = event.type == Common::EVENT_RBUTTONDOWN; _mouseMoved = true; - //_anyStroke = true; return; case Common::EVENT_LBUTTONUP: case Common::EVENT_RBUTTONUP: _mouseClicked = false; _mouseReleased = true; _mouseMoved = true; - //_anyStroke = true; + _rightMousePressed = false; return; case Common::EVENT_MOUSEMOVE: _mousePos = event.mouse; _currentPos = event.mouse; _mouseMoved = true; - //_anyStroke = true; break; default: break; diff --git a/engines/mads/events.h b/engines/mads/events.h index 8537605d4c..3b5820a6df 100644 --- a/engines/mads/events.h +++ b/engines/mads/events.h @@ -58,7 +58,7 @@ public: bool _mouseClicked; bool _mouseReleased; byte _mouseButtons; - bool _anyStroke; + bool _rightMousePressed; bool _keyPressed; int _vCC; int _vD2; diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 02877aac9c..2d95f86636 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -523,7 +523,7 @@ void Scene::updateCursor() { Player &player = _vm->_game->_player; CursorType cursorId = CURSOR_ARROW; - if (_action._interAwaiting == 1 && !_vm->_events->_anyStroke && + if (_action._interAwaiting == 1 && !_vm->_events->_rightMousePressed && _vm->_game->_screenObjects._category == CAT_HOTSPOT) { int idx = _vm->_game->_screenObjects._selectedObject - _userInterface._categoryIndexes[CAT_HOTSPOT - 1]; diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index 44f0907040..f03f89122f 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -286,7 +286,7 @@ void ScreenObjects::check(bool scanFlag) { UserInterface &userInterface = scene._userInterface; if (!_vm->_events->_mouseButtons || _inputMode != kInputBuildingSentences) - _vm->_events->_anyStroke = false; + _vm->_events->_rightMousePressed = false; if ((_vm->_events->_mouseMoved || _vm->_game->_scene._userInterface._scrollerY || _v8332A || _v8333C) && scanFlag) { @@ -473,13 +473,13 @@ void ScreenObjects::elementHighlighted() { indexEnd = 9; varA = 5; topIndex = 0; - idxP = !_vm->_events->_anyStroke ? &userInterface._highlightedCommandIndex : + idxP = !_vm->_events->_rightMousePressed ? &userInterface._highlightedCommandIndex : &userInterface._selectedActionIndex; - if (_vm->_events->_anyStroke && userInterface._selectedItemVocabIdx >= 0) + if (_vm->_events->_rightMousePressed && userInterface._selectedItemVocabIdx >= 0) userInterface.updateSelection(CAT_INV_VOCAB, -1, &userInterface._selectedItemVocabIdx); - var4 = _released && !_vm->_events->_anyStroke ? 1 : 0; + var4 = _released && !_vm->_events->_rightMousePressed ? 1 : 0; break; case CAT_INV_LIST: @@ -505,12 +505,12 @@ void ScreenObjects::elementHighlighted() { varA = 0; topIndex = 0; - idxP = _vm->_events->_anyStroke ? &userInterface._selectedItemVocabIdx : &userInterface._highlightedActionIndex; + idxP = _vm->_events->_rightMousePressed ? &userInterface._selectedItemVocabIdx : &userInterface._highlightedActionIndex; - if (_vm->_events->_anyStroke && userInterface._selectedActionIndex >= 0) + if (_vm->_events->_rightMousePressed && userInterface._selectedActionIndex >= 0) userInterface.updateSelection(CAT_COMMAND, -1, &userInterface._selectedActionIndex); - var4 = _released && !_vm->_events->_anyStroke ? 1 : 0; + var4 = _released && !_vm->_events->_rightMousePressed ? 1 : 0; break; case CAT_INV_ANIM: @@ -605,7 +605,7 @@ void ScreenObjects::elementHighlighted() { newIndex = -1; } - if (_released && !_vm->_events->_anyStroke && + if (_released && !_vm->_events->_rightMousePressed && (_vm->_events->_mouseReleased || !_vm->_easyMouse)) newIndex = -1; -- cgit v1.2.3 From ecdaf23344725c4bddf5e3dddf80d56140374013 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 5 Apr 2014 15:56:24 -0400 Subject: MADS: Fix to stop daemon actions overwriting currently active player actions --- engines/mads/sequence.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index 5150b75c25..92cba84718 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -330,7 +330,7 @@ bool SequenceList::loadSprites(int seqIndex) { _vm->_game->_trigger = seqEntry._entries._abortVal[idx]; _vm->_game->_triggerMode = seqEntry._triggerMode; - if (seqEntry._triggerMode == KERNEL_TRIGGER_DAEMON) + if (seqEntry._triggerMode != KERNEL_TRIGGER_DAEMON) scene._action._activeAction = seqEntry._actionNouns; } -- cgit v1.2.3 From 0b9c802bf0095568d71db5d10b3b6dbe075934fb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 5 Apr 2014 17:19:51 -0400 Subject: MADS: Fix for actions getting aborted due to _commandError being set --- engines/mads/nebular/nebular_scenes1.cpp | 4 ++-- engines/mads/scene.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index c12e7217eb..6d63a564ab 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -343,6 +343,7 @@ void Scene103::actions() { } else if (_action.isAction(VERB_LOOK, 362)) { _vm->_dialogs->show(10301); } else if (_action.isAction(VERB_TAKE, 362)) { + // Take Turkey if (!_vm->_game->_trigger) _vm->_sound->command(31); @@ -356,8 +357,7 @@ void Scene103::actions() { _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 18, 0, 60, msg); _scene->_sequences.addTimer(120, _vm->_game->_trigger); } else { - _scene->_sequences.addSubEntry(_globals._spriteIndexes[24], - SM_0, 0, 1); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[24], SM_0, 0, 1); } _game._player._stepEnabled = _game._trigger == 2; diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 2d95f86636..140077418b 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -474,12 +474,12 @@ void Scene::doAction() { } if (!_action._savedFields._lookFlag) { - if (!_action._inProgress) { + if (_action._inProgress) { _action._savedFields._commandError = true; _sceneLogic->postActions(); } - if (!_action._inProgress) { + if (_action._inProgress) { _action._savedFields._commandError = true; warning("TODO: PtrUnk4"); } -- cgit v1.2.3 From 88dcc7e0d64d3cc1c0963d90dcaad7ea112420df Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 5 Apr 2014 23:36:10 +0200 Subject: MADS: Add debugger command to display quotes --- engines/mads/debugger.cpp | 10 ++++++++++ engines/mads/debugger.h | 1 + 2 files changed, 11 insertions(+) diff --git a/engines/mads/debugger.cpp b/engines/mads/debugger.cpp index 58bf8388e4..276340f240 100644 --- a/engines/mads/debugger.cpp +++ b/engines/mads/debugger.cpp @@ -37,6 +37,7 @@ Debugger::Debugger(MADSEngine *vm) : GUI::Debugger(), _vm(vm) { DCmd_Register("play_sound", WRAP_METHOD(Debugger, Cmd_PlaySound)); DCmd_Register("show_codes", WRAP_METHOD(Debugger, Cmd_ShowCodes)); DCmd_Register("dump_file", WRAP_METHOD(Debugger, Cmd_DumpFile)); + DCmd_Register("show_quote", WRAP_METHOD(Debugger, Cmd_ShowQuote)); } static int strToInt(const char *s) { @@ -168,4 +169,13 @@ bool Debugger::Cmd_DumpFile(int argc, const char **argv) { return true; } +bool Debugger::Cmd_ShowQuote(int argc, const char **argv) { + if (argc != 2) + DebugPrintf("Usage: %s \n", argv[0]); + else + DebugPrintf("%s", _vm->_game->getQuote(strToInt(argv[1])).c_str()); + + return true; +} + } // End of namespace MADS diff --git a/engines/mads/debugger.h b/engines/mads/debugger.h index de450b1446..b2b0949923 100644 --- a/engines/mads/debugger.h +++ b/engines/mads/debugger.h @@ -41,6 +41,7 @@ protected: bool Cmd_PlaySound(int argc, const char **argv); bool Cmd_ShowCodes(int argc, const char **argv); bool Cmd_DumpFile(int argc, const char **argv); + bool Cmd_ShowQuote(int argc, const char **argv); public: bool _showMousePos; public: -- cgit v1.2.3 From c117e59009890d15e3bec65564ad0ac1f728dc79 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 5 Apr 2014 23:37:10 +0200 Subject: MADS: Implement scene 209 --- engines/mads/inventory.cpp | 5 + engines/mads/inventory.h | 2 + engines/mads/nebular/game_nebular.h | 2 +- engines/mads/nebular/nebular_scenes2.cpp | 1701 ++++++++++++++++++++++++++++-- engines/mads/nebular/nebular_scenes2.h | 39 +- 5 files changed, 1682 insertions(+), 67 deletions(-) diff --git a/engines/mads/inventory.cpp b/engines/mads/inventory.cpp index 43b7b6ea28..ec5670b090 100644 --- a/engines/mads/inventory.cpp +++ b/engines/mads/inventory.cpp @@ -167,4 +167,9 @@ void InventoryObjects::removeFromInventory(int objectId, int newScene) { } } +int InventoryObjects::getIdFromDesc(int objectId) { + warning("TODO: InventoryObjects::getIdFromDesc()"); + return objectId; +} + } // End of namespace MADS diff --git a/engines/mads/inventory.h b/engines/mads/inventory.h index eec272b365..13b81094af 100644 --- a/engines/mads/inventory.h +++ b/engines/mads/inventory.h @@ -109,6 +109,8 @@ public: * @param newScene Specifies the new scene to set the item to */ void removeFromInventory(int objectId, int newScene); + + int getIdFromDesc(int objectId); }; } // End of namespace MADS diff --git a/engines/mads/nebular/game_nebular.h b/engines/mads/nebular/game_nebular.h index 5b88f631e3..e4f4efcd8a 100644 --- a/engines/mads/nebular/game_nebular.h +++ b/engines/mads/nebular/game_nebular.h @@ -33,7 +33,7 @@ namespace Nebular { enum StoryMode { STORYMODE_NAUGHTY = 1, STORYMODE_NICE = 2 }; -enum InventoryObject { OBJ_NONE = 0, +enum InventoryObject { OBJ_NONE = -1, OBJ_BINOCULARS = 0, OBJ_BURGER = 1, OBJ_DEAD_FISH = 2, OBJ_STUFFED_FISH = 3, OBJ_REBREATHER = 4, OBJ_TIMER_MODULE = 5, OBJ_BIG_LEAVES = 6, OBJ_POISON_DARTS = 7, OBJ_PLANT_STALK = 8, OBJ_BLOWGUN = 9, OBJ_TWINKIFRUIT = 10, OBJ_BONE = 11, OBJ_CHICKEN = 12, diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index b91384d85b..0bf5c21e59 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -57,7 +57,7 @@ void Scene2xx::setPlayerSpritesPrefix() { if (oldName != _game._player._spritesPrefix) _game._player._spritesChanged = true; - + if ((_scene->_nextSceneId == 203 || _scene->_nextSceneId == 204) && _globals[kRhotundaStatus]) _game._player._loadsFirst = false; @@ -156,7 +156,7 @@ void Scene201::enter() { int sepChar = (_globals[kSexOfRex] == SEX_UNKNOWN) ? 't' : 'u'; // Guess values. What is the default value used by the compiler? int suffixNum = -1; - int abortTimers = -1; + int abortTimers = -1; switch(_globals[kTeleporterCommand]) { case 1: suffixNum = 3; @@ -181,7 +181,7 @@ void Scene201::enter() { if (suffixNum >= 0) _scene->loadAnimation(formAnimName(sepChar, suffixNum), abortTimers); } - + if ((_scene->_priorSceneId == 202) && (_globals[kMeteorologistStatus] == 1) && !_scene->_roomChanged) { _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('a', 0), 0); _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('a', 1), 0); @@ -282,10 +282,10 @@ void Scene201::step() { void Scene201::actions() { MADSAction *action = _game._player._action; if (action->_lookFlag == false) { - if (action->isAction(0x18C, 0x83)) + if (_action.isAction(0x18C, 0x83)) _scene->_nextSceneId = 202; - else if ((action->isAction(0x50, 0x156)) || (action->isAction(0x188, 0x16C)) || (action->isAction(0x188, 0x1B6))) { - if (_game._trigger == 0) { + else if ((_action.isAction(0x50, 0x156)) || (_action.isAction(0x188, 0x16C)) || (_action.isAction(0x188, 0x1B6))) { + if (_game._trigger == 0) { _game._player._stepEnabled = false; _game._player._visible = false; int sepChar = (_globals[kSexOfRex] == SEX_UNKNOWN) ? 't' : 'u'; @@ -293,30 +293,30 @@ void Scene201::actions() { } else if (_game._trigger == 1) { _scene->_nextSceneId = 213; } - } else if (action->isAction(VERB_LOOK, 0x1A6)) { + } else if (_action.isAction(VERB_LOOK, 0x1A6)) { _vm->_dialogs->show(0x4E85); - } else if (action->isAction(VERB_LOOK, 0x129)) { + } else if (_action.isAction(VERB_LOOK, 0x129)) { _vm->_dialogs->show(0x4E86); - } else if (action->isAction(VERB_LOOK, 0x16F)) { + } else if (_action.isAction(VERB_LOOK, 0x16F)) { _vm->_dialogs->show(0x4E87); - } else if (action->isAction(VERB_LOOK, 0x142)) { + } else if (_action.isAction(VERB_LOOK, 0x142)) { _vm->_dialogs->show(0x4E88); - } else if (action->isAction(VERB_LOOK, 0x18F)) { + } else if (_action.isAction(VERB_LOOK, 0x18F)) { _vm->_dialogs->show(0x4E89); - } else if (action->isAction(VERB_LOOK, 0x1B9)) { + } else if (_action.isAction(VERB_LOOK, 0x1B9)) { _vm->_dialogs->show(0x4E8A); - } else if (action->isAction(VERB_LOOK, 0x192)) { + } else if (_action.isAction(VERB_LOOK, 0x192)) { _vm->_dialogs->show(0x4E8B); - } else if (action->isAction(VERB_LOOK, 0x1BA)) { + } else if (_action.isAction(VERB_LOOK, 0x1BA)) { _vm->_dialogs->show(0x4E8C); - } else if (action->isAction(VERB_LOOK, 0x83)) { + } else if (_action.isAction(VERB_LOOK, 0x83)) { _vm->_dialogs->show(0x4E8E); - } else if (action->isAction(VERB_LOOK, 0x1B6)) { + } else if (_action.isAction(VERB_LOOK, 0x1B6)) { if (_globals[kMeteorologistEverSeen]) _vm->_dialogs->show(0x4E90); else _vm->_dialogs->show(0x4E8D); - } else if (action->isAction(VERB_LOOK, 0x16C)) { + } else if (_action.isAction(VERB_LOOK, 0x16C)) { _vm->_dialogs->show(0x4E91); } else return; @@ -415,8 +415,8 @@ void Scene202::enter() { _meteoClock1 = _meteoClock2 = _scene->_frameStartTime; if (_scene->_roomChanged) - _game._objects.addToInventory(OBJ_NONE); - + _game._objects.addToInventory(OBJ_BINOCULARS); + if (_globals[kMeteorologistWatch]) { _game._player._visible = false; _game._player._stepEnabled = false; @@ -489,7 +489,7 @@ void Scene202::step() { } int msgIndex = _scene->_kernelMessages.add(msgPos, 0x1110, msgFlag | 32, 0, 120, _game.getQuote(102)); _scene->_kernelMessages.setQuoted(msgIndex, 4, true); - + if (_globals[kMeteorologistWatch] == 1) { MADSAction *action = _game._player._action; action->_activeAction._verbId = VERB_LOOK; @@ -508,7 +508,7 @@ void Scene202::step() { case 90: _vm->_sound->command(41); _scene->_sequences.remove(_globals._spriteIndexes[25]); - _globals._spriteIndexes[24] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[9], true, 6, 1, 0, 0); + _globals._spriteIndexes[24] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[9], true, 6, 1, 0, 0); _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(247, 82)); _scene->_sequences.setDepth(_globals._spriteIndexes[24], 1); _scene->_sequences.addSubEntry(_globals._spriteIndexes[24], SM_0, 0, 91); @@ -547,7 +547,7 @@ void Scene202::step() { default: break; } - + if (!_scene->_activeAnimation && (_globals[kMeteorologistStatus] != 2) && (_meteoClock2 <= _scene->_frameStartTime) && (_meteoClock1 <= _scene->_frameStartTime)) { int randVal = _vm->getRandomNumber(1, 500); int threshold = 1; @@ -566,7 +566,7 @@ void Scene202::step() { _meteoClock2 = _scene->_frameStartTime + 2; } } - + if (!_scene->_activeAnimation) return; @@ -602,11 +602,11 @@ void Scene202::step() { if (_scene->_activeAnimation->getCurrentFrame() == _meteoFrame) { return; } - + _meteoFrame = _scene->_activeAnimation->getCurrentFrame(); int randVal = _vm->getRandomNumber(1, 1000); int frameStep = -1; - + switch (_scene->_activeAnimation->getCurrentFrame()) { case 42: case 77: @@ -703,7 +703,7 @@ int Scene202::subStep4(int randVal) { if (randVal <= 200) return 19; - return 166; + return 166; } void Scene202::preActions() { @@ -713,7 +713,7 @@ void Scene202::preActions() { if (player._readyToWalk) _scene->_kernelMessages.reset(); - if (!_ladderTopFl && (action->isAction(0x4E, 0xC7) || !player._readyToWalk)) { + if (!_ladderTopFl && (_action.isAction(0x4E, 0xC7) || !player._readyToWalk)) { if (_game._trigger == 0) { _vm->_sound->command(29); player._readyToWalk = false; @@ -729,10 +729,10 @@ void Scene202::preActions() { player._readyToWalk = true; _game._player._stepEnabled = true; _ladderTopFl = false; - } + } } - if (action->isAction(VERB_LOOK, 0x27) && action->_activeAction._indirectObjectId > 0) { + if (_action.isAction(VERB_LOOK, 0x27) && (action->_activeAction._indirectObjectId > 0)) { if (!player._readyToWalk || _ladderTopFl) _game._player._needToWalk = false; else @@ -746,12 +746,12 @@ void Scene202::preActions() { void Scene202::actions() { MADSAction *action = _game._player._action; if (action->_lookFlag == false) { - if (action->isAction(0x4E, 0xC7)) { + if (_action.isAction(0x4E, 0xC7)) { action->_inProgress = false; return; - } else if (action->isAction(0x18C, 0x83)) { + } else if (_action.isAction(0x18C, 0x83)) { _scene->_nextSceneId = 203; - } else if (action->isAction(0x18C, 0x82)) { + } else if (_action.isAction(0x18C, 0x82)) { if (_globals[kMeteorologistStatus] != 2) { if (_scene->_activeAnimation) _globals[kMeteorologistStatus] = 1; @@ -759,7 +759,7 @@ void Scene202::actions() { _globals[kMeteorologistStatus] = 0; } _scene->_nextSceneId = 201; - } else if (action->isAction(VERB_TAKE, 0x2C)) { + } else if (_action.isAction(VERB_TAKE, 0x2C)) { if (action->_mainObjectSource == 4) { if (_game._trigger == 0) { if (_game._objects.isInInventory(OBJ_BONES)) { @@ -797,7 +797,7 @@ void Scene202::actions() { return; } } - } else if ((action->isAction(0x50, 0xC7)) && (_globals[kLadderBroken] == 0)) { + } else if ((_action.isAction(0x50, 0xC7)) && (_globals[kLadderBroken] == 0)) { if (_game._trigger == 0) { _vm->_sound->command(29); _meteoClock1 = _scene->_frameStartTime; @@ -822,7 +822,7 @@ void Scene202::actions() { action->_inProgress = false; return; } - } else if (((action->isAction(VERB_LOOK, 0x27, 0x82)) || (action->isAction(VERB_LOOK, 0x27, 0x1B6))) && (_globals[kSexOfRex] == SEX_MALE)) { + } else if (((_action.isAction(VERB_LOOK, 0x27, 0x82)) || (_action.isAction(VERB_LOOK, 0x27, 0x1B6))) && (_globals[kSexOfRex] == SEX_MALE)) { if (!_ladderTopFl) { if (_game._trigger == 0) { _game._player._stepEnabled = false; @@ -911,15 +911,15 @@ void Scene202::actions() { return; } } - } else if (action->isAction(0x188, 0xAA)) { + } else if (_action.isAction(0x188, 0xAA)) { setRandomKernelMessage(); - } else if (action->isAction(VERB_LOOK, 0x129)) { + } else if (_action.isAction(VERB_LOOK, 0x129)) { _vm->_dialogs->show(0x4EEA); - } else if (action->isAction(VERB_LOOK, 0x86)) { + } else if (_action.isAction(VERB_LOOK, 0x86)) { _vm->_dialogs->show(0x4EEB); - } else if (action->isAction(VERB_LOOK, 0x19C)) { + } else if (_action.isAction(VERB_LOOK, 0x19C)) { _vm->_dialogs->show(0x4EEC); - } else if (action->isAction(VERB_LOOK, 0x82)) { + } else if (_action.isAction(VERB_LOOK, 0x82)) { if ((_globals[kMeteorologistStatus] == 0) || (_globals[kMeteorologistStatus] == 2)) { _vm->_dialogs->show(0x4EED); } else if (_globals[kMeteorologistStatus] == 1) { @@ -927,37 +927,37 @@ void Scene202::actions() { } else { action->_inProgress = false; return; - } - } else if (action->isAction(VERB_LOOK, 0x18E)) { + } + } else if (_action.isAction(VERB_LOOK, 0x18E)) { _vm->_dialogs->show(0x4EEE); - } else if (action->isAction(VERB_LOOK, 0x164)) { + } else if (_action.isAction(VERB_LOOK, 0x164)) { _vm->_dialogs->show(0x4EEF); - } else if (action->isAction(VERB_LOOK, 0x175)) { + } else if (_action.isAction(VERB_LOOK, 0x175)) { _vm->_dialogs->show(0x4EF0); - } else if (action->isAction(VERB_LOOK, 0x174)) { + } else if (_action.isAction(VERB_LOOK, 0x174)) { _vm->_dialogs->show(0x4EF1); - } else if (action->isAction(VERB_LOOK, 0x142)) { + } else if (_action.isAction(VERB_LOOK, 0x142)) { _vm->_dialogs->show(0x4EF2); - } else if (action->isAction(VERB_LOOK, 0xAA)) { + } else if (_action.isAction(VERB_LOOK, 0xAA)) { if ((_game._player._playerPos == Common::Point(77, 105)) && (_game._player._facing == FACING_NORTH)) _vm->_dialogs->show(0x4EF4); else _vm->_dialogs->show(0x4EF3); - } else if (action->isAction(VERB_LOOK, 0x186)) { + } else if (_action.isAction(VERB_LOOK, 0x186)) { _vm->_dialogs->show(0x4EF5); - } else if (action->isAction(VERB_LOOK, 0x1B5)) { + } else if (_action.isAction(VERB_LOOK, 0x1B5)) { _vm->_dialogs->show(0x4EF6); - } else if (action->isAction(VERB_LOOK, 0x140)) { + } else if (_action.isAction(VERB_LOOK, 0x140)) { _vm->_dialogs->show(0x4EF7); - } else if (action->isAction(VERB_TAKE, 0x140)) { + } else if (_action.isAction(VERB_TAKE, 0x140)) { _vm->_dialogs->show(0x4EF8); - } else if (action->isAction(VERB_LOOK, 0x2D)) { + } else if (_action.isAction(VERB_LOOK, 0x2D)) { if (action->_commandSource == 4) _vm->_dialogs->show(0x4EF9); else return; } else { - return; + return; } } else { _vm->_dialogs->show(0x4EFB); @@ -1038,7 +1038,7 @@ void Scene203::step() { } else if (_game._trigger == 81) { _scene->_nextSceneId = 208; _scene->_reloadSceneFlag = true; - } + } } void Scene203::preActions() { @@ -1094,7 +1094,7 @@ void Scene205::enter() { _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('f', -1), 0); _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('c', -1), 0); _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('p', -1), 0); - + if (_globals[kSexOfRex] == SEX_MALE) _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('a', 1), 0); @@ -1144,7 +1144,7 @@ void Scene205::enter() { warning("sub71704(0x3, 0xC3, 0x108, 0x63, 0x86, 0xD, 2, 0xFDFC, 0x3C, 0x6C, 0x6C, 0x6D, 0x6D, 0x6E, 0x6E, 0x6F, 0x6C, 0);"); if (_scene->_priorSceneId != -2) - _game._player._playerPos = Common::Point(99, 152); + _game._player._playerPos = Common::Point(99, 152); if (_globals[kSexOfRex] != SEX_MALE) { _scene->loadAnimation(formAnimName('a', -1), 0); @@ -1246,7 +1246,7 @@ void Scene207::enter() { _vultureFl = true; _spiderFl = (var2 & 1); - + if (_vultureFl) { _globals._spriteIndexes[16] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 30, 0, 0, 400); _vultureTime = _game._player._priorTimer; @@ -1479,7 +1479,7 @@ void Scene208::enter() { } void Scene208::step() { - if (_boundingFl && (_rhotundaTime <= _scene->_activeAnimation->getCurrentFrame())) { + if (_boundingFl && (_rhotundaTime <= _scene->_activeAnimation->getCurrentFrame())) { _rhotundaTime = _scene->_activeAnimation->getCurrentFrame(); if (_rhotundaTime == 125) @@ -1494,9 +1494,9 @@ void Scene208::step() { if ((_game._trigger == 0) && _boundingFl) return; - + _boundingFl = true; - + switch (_game._trigger) { case 0: _scene->loadAnimation(formAnimName('A', -1), 81); @@ -1532,7 +1532,7 @@ void Scene208::subAction(int mode) { switch (_game._trigger) { case 0: { _game._player._stepEnabled = false; - _game._player._visible = false; + _game._player._visible = false; _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 6, 1, 0, 0); _scene->_sequences.setMsgLayout(_globals._spriteIndexes[20]); @@ -1686,16 +1686,1587 @@ void Scene209::setup() { _scene->addActiveVocab(0x10F); } -void Scene209::enter() { +void Scene209::handlePause() { + switch (_game._trigger) { + case 124: + if (++_pauseCounter <= _pauseCounterThreshold) + _scene->_sequences.addTimer(60, 124); + else + _pauseMode = 0; + break; + } } -void Scene209::step() { +void Scene209::initPauseCounterThreshold() { + switch (_game._trigger) { + case 226: + _scene->_sequences.addTimer(1, 124); + _pauseCounterThreshold = _vm->getRandomNumber(7,12); + _pauseMode = 2; + _pauseCounter = 0; + break; + } } -void Scene209::preActions() { +void Scene209::handlePeek() { + switch (_game._trigger) { + case 133: + _vm->_sound->command(18); + _globals._spriteIndexes[18] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 51, 52); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 134); + break; + + case 134: { + int oldIdx = _globals._spriteIndexes[18]; + _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 6); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.addTimer(60, 135); + } + break; + + case 135: + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 7); + _scene->_sequences.addTimer(10, 136); + break; + + case 136: + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 6); + _scene->_sequences.addTimer(50, 137); + break; + + case 137: + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 51, 52); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 138); + break; + + case 138: + _pauseMode = 1; + _scene->_hotspots.activate(227, false); + _playingAnimFl = false; + break; + } } -void Scene209::actions() { +void Scene209::handleVerticalMove() { + switch (_game._trigger) { + case 140: + _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 8, 8, 0, 1); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 1, 5); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 141); + break; + + case 141: { + _vm->_sound->command(18); + int oldIdx = _globals._spriteIndexes[18]; + _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 5); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.addTimer(60, 142); + } + break; + + case 142: + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[18] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 1, 5); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 143); + break; + + case 143: + _pauseMode = 1; + _playingAnimFl = false; + _scene->_hotspots.activate(227, false); + break; + } +} + +void Scene209::handleLookStay() { + switch (_game._trigger) { + case 145: + _vm->_sound->command(18); + _monkeyPosition = 2; + _globals._spriteIndexes[18] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 51, 52); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 146); + break; + + case 146: { + int oldIdx = _globals._spriteIndexes[18]; + _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 6); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.addTimer(15, 147); + } + break; + + case 147: + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 7); + _scene->_sequences.addTimer(8, 148); + break; + + case 148: + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 6); + + if (!_dodgeFl) + _scene->_sequences.addTimer(90, 149); + else { + _scene->_sequences.addTimer(1, 149); + _shouldDodgeFl = true; + } + break; + + case 149: + _playingAnimFl = false; + break; + } +} + +void Scene209::handleLookRight() { + switch (_game._trigger) { + case 151: + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[18] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 8, 2, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 8, 14); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 152); + break; + + case 152: { + int oldIdx = _globals._spriteIndexes[18]; + _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 6); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.addTimer(60, 153); + } + break; + + case 153: + _playingAnimFl = false; + if (_dodgeFl) + _shouldDodgeFl = true; + break; + } +} + +void Scene209::handleBlink() { + switch (_game._trigger) { + case 155: + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 6); + _scene->_sequences.addTimer(50, 156); + break; + + case 156: + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 7); + _scene->_sequences.addTimer(10, 157); + break; + + case 157: + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 6); + _scene->_sequences.addTimer(50, 158); + break; + + case 158: + _playingAnimFl = false; + if (_dodgeFl) + _shouldDodgeFl = true; + break; + } +} + +void Scene209::handleGetBinoculars() { + switch (_game._trigger) { + case 161: + _vm->_sound->command(18); + _monkeyPosition = 3; + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 8, 24); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_FRAME_INDEX, 20, 165); + if (!_fallFl && !_dodgeFl) { + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 162); + } else { + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 163); + } + break; + + case 162: { + int oldIdx = _globals._spriteIndexes[18]; + _globals._spriteIndexes[18] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 8, 6, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 23, 25); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 163); + } + break; + + case 163: { + int oldIdx = _globals._spriteIndexes[18]; + _globals._spriteIndexes[18] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 8, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 23, 24); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.addTimer(8, 164); + } + break; + + case 164: + _playingAnimFl = false; + if (_fallFl) + _shouldFallFl = true; + break; + + case 165: + _vm->_sound->command(18); + break; + } +} + +void Scene209::handleBinocularBlink() { + switch (_game._trigger) { + case 167: { + int oldIdx = _globals._spriteIndexes[18]; + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[18] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 8, 2, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 23, 25); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 168); + } + break; + + case 168: { + int oldIdx = _globals._spriteIndexes[18]; + _globals._spriteIndexes[18] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 8, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 23, 24); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.addTimer(30, 169); + } + break; + + case 169: + _playingAnimFl = false; + if (_fallFl) + _shouldFallFl = true; + break; + } +} + +void Scene209::handleBinocularScan() { + switch (_game._trigger) { + case 171: { + int oldIdx = _globals._spriteIndexes[18]; + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[18] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 12, 2, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 43, 45); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 172); + } + break; + + case 172: { + int oldIdx = _globals._spriteIndexes[18]; + int randAction = _vm->getRandomNumber(1,2); + switch (randAction) { + case 1: + _globals._spriteIndexes[18] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 12, 2, 0, 0); + break; + case 2: + _globals._spriteIndexes[18] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 12, 4, 0, 0); + break; + } + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 23, 25); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 173); + } + break; + + case 173: { + int oldIdx = _globals._spriteIndexes[18]; + _globals._spriteIndexes[18] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 12, 2, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 26, 30); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 174); + } + break; + + case 174: { + int oldIdx = _globals._spriteIndexes[18]; + _globals._spriteIndexes[18] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 12, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 23, 24); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.addTimer(60, 175); + } + break; + + case 175: + _playingAnimFl = false; + if (_fallFl) + _shouldFallFl = true; + break; + } +} + +void Scene209::handleJumpInTree() { + switch (_game._trigger) { + case 178: { + int oldIdx = 0; + _monkeyPosition = 1; + if (_removeMonkeyFl) + _scene->_sequences.remove(_globals._spriteIndexes[18]); + else + oldIdx = _globals._spriteIndexes[18]; + + _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 46, 49); + if (!_removeMonkeyFl) + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 179); + } + break; + + case 179: { + _vm->_sound->command(18); + int oldIdx = _globals._spriteIndexes[18]; + _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 53, 61); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 180); + } + break; + + case 180: + _removeMonkeyFl = true; + _pauseMode = 1; + _playingAnimFl = false; + _scene->_hotspots.activate(227, false); + break; + } +} + +void Scene209::handleTongue() { + switch (_game._trigger) { + case 182: { + int oldIdx = _globals._spriteIndexes[18]; + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 26, 30); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 183); + } + break; + + case 183: { + int oldIdx = _globals._spriteIndexes[18]; + _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 31, 33); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 184); + } + break; + + case 184: { + int oldIdx = _globals._spriteIndexes[18]; + _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 36, 37); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 185); + } + break; + + case 185: { + _vm->_sound->command(18); + int oldIdx = _globals._spriteIndexes[18]; + _globals._spriteIndexes[18] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 6, 20, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 38, 39); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 186); + } + break; + + case 186: { + int oldIdx = _globals._spriteIndexes[18]; + _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 40, 41); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 178); + _removeMonkeyFl = false; + } + break; + } +} + +void Scene209::handleStandFromPeek() { + switch (_game._trigger) { + case 189: + _monkeyPosition = 4; + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 50); + _scene->_sequences.addTimer(8, 190); + break; + + case 190: + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 6); + _scene->_sequences.addTimer(8, 191); + break; + + case 191: + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[21], 1, 5); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[21], SM_0, 0, 192); + break; + + case 192: { + _vm->_sound->command(18); + int oldIdx = _globals._spriteIndexes[21]; + _globals._spriteIndexes[20] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 1); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[20], oldIdx); + _scene->_sequences.addTimer(8, 193); + } + break; + + case 193: + _scene->_sequences.remove(_globals._spriteIndexes[20]); + _globals._spriteIndexes[19] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 22); + _scene->_sequences.addTimer(5, 194); + break; + + case 194: + _playingAnimFl = false; + _counter = 0; + break; + } +} + +void Scene209::handleStandBlink() { + switch (_game._trigger) { + case 246: + _scene->_sequences.remove(_globals._spriteIndexes[19]); + _globals._spriteIndexes[19] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 22); + _scene->_sequences.addTimer(10, 247); + break; + + case 247: + _scene->_sequences.remove(_globals._spriteIndexes[19]); + _globals._spriteIndexes[19] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 23); + _scene->_sequences.addTimer(8, 248); + break; + + case 248: + _scene->_sequences.remove(_globals._spriteIndexes[19]); + _globals._spriteIndexes[19] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 22); + _scene->_sequences.addTimer(10, 249); + break; + + case 249: + _playingAnimFl = false; + break; + } +} + +void Scene209::handleJumpAndHide() { + switch (_game._trigger) { + case 196: + _vm->_sound->command(18); + _monkeyPosition = 1; + _scene->_sequences.remove(_globals._spriteIndexes[19]); + _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[20], 1, 16); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[20], SM_0, 0, 197); + break; + + case 197: + _pauseMode = 1; + _scene->_hotspots.activate(227, false); + _playingAnimFl = false; + break; + } +} + +void Scene209::handleMonkeyEating() { + switch (_game._trigger) { + case 199: + _vm->_sound->command(18); + _scene->_sequences.remove(_globals._spriteIndexes[19]); + _globals._spriteIndexes[19] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 10, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[19], 1, 14); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[19], SM_0, 0, 200); + break; + + case 200: { + int oldIdx = _globals._spriteIndexes[19]; + _globals._spriteIndexes[19] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 10, 10, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[19], 15, 16); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[19], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[19], SM_0, 0, 201); + } + break; + + case 201: { + int oldIdx = _globals._spriteIndexes[19]; + _globals._spriteIndexes[19] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 12); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[19], oldIdx); + _scene->_sequences.addTimer(20, 202); + } + break; + + case 202: + _scene->_sequences.remove(_globals._spriteIndexes[19]); + _globals._spriteIndexes[19] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 19); + _scene->_sequences.addTimer(20, 203); + break; + + case 203: + _scene->_sequences.remove(_globals._spriteIndexes[19]); + _globals._spriteIndexes[19] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 17); + _scene->_sequences.addTimer(20, 204); + break; + + case 204: + _scene->_sequences.remove(_globals._spriteIndexes[19]); + _globals._spriteIndexes[19] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 10, 8, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[19], 18, 19); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[19], SM_0, 0, 205); + break; + + case 205: { + int oldIdx = _globals._spriteIndexes[19]; + _globals._spriteIndexes[19] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 10, 8, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[19], 20, 21); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[19], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[19], SM_0, 0, 206); + } + break; + + case 206: { + int oldIdx = _globals._spriteIndexes[19]; + _globals._spriteIndexes[19] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 10, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[19], 22, 25); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[19], oldIdx); + if (!_dodgeFl && !_fallFl) + _scene->_sequences.addSubEntry(_globals._spriteIndexes[19], SM_0, 0, 207); + else + _scene->_sequences.addSubEntry(_globals._spriteIndexes[19], SM_0, 0, 209); + } + break; + + case 207: { + _vm->_sound->command(18); + int msgIndex = _scene->_kernelMessages.add(Common::Point(180, 25), 0xFDFC, 0, 0, 90, _game.getQuote(130)); + _scene->_kernelMessages.setQuoted(msgIndex, 4, true); + + int oldIdx = _globals._spriteIndexes[19]; + _globals._spriteIndexes[19] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 15, 4, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[19], 26, 27); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[19], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[19], SM_0, 0, 208); + } + break; + + case 208: { + _scene->_kernelMessages.add(Common::Point(180, 39), 0xFDFC, 0, 0, 90, _game.getQuote(131)); + int oldIdx = _globals._spriteIndexes[19]; + _globals._spriteIndexes[19] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 10, 4, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[19], 28, 29); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[19], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[19], SM_0, 0, 209); + } + break; + + case 209: { + int oldIdx = _globals._spriteIndexes[19]; + _globals._spriteIndexes[19] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 22); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[19], oldIdx); + _scene->_sequences.addTimer(1, 210); + } + break; + + case 210: + _playingAnimFl = false; + break; + } +} + +void Scene209::handleMonkeyFall() { + switch (_game._trigger) { + case 219: { + _vm->_sound->command(25); + _scene->_sprites.remove(_globals._spriteIndexes[7]); + _scene->_sprites.remove(_globals._spriteIndexes[6]); + _scene->_sprites.remove(_globals._spriteIndexes[5]); + _scene->_sprites.remove(_globals._spriteIndexes[4]); + + _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('m', 4), 0); + _scene->_kernelMessages.add(Common::Point(180, 26), 0xFDFC, 0, 0, 90, _game.getQuote(151)); + _scene->_sequences.addTimer(40, 100); + _scene->_hotspots.activate(227, false); + int oldIdx = _globals._spriteIndexes[18]; + _monkeyPosition = 1; + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[23], 1, 35); + _scene->_sequences.setDepth (_globals._spriteIndexes[23], 6); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 220); + } + break; + + case 220: { + _vm->_sound->command(18); + _scene->_kernelMessages.add(Common::Point(182, 109), 0xFDFC, 0, 0, 90, _game.getQuote(159)); + _scene->_hotspots.activate(227, false); + int oldIdx = _globals._spriteIndexes[18]; + _monkeyPosition = 1; + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[23], 36, 42); + _scene->_sequences.setDepth (_globals._spriteIndexes[23], 6); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 221); + } + break; + + case 221: { + _game._objects.setRoom(OBJ_BINOCULARS, 209); + _binocularsDroppedFl = true; + int oldIdx = _globals._spriteIndexes[23]; + _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8, 1, 0, 0); + _globals._spriteIndexes[24] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 1); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[24], oldIdx); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(201, 131)); + _scene->_sequences.setDepth(_globals._spriteIndexes[24], 8); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[23], oldIdx); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[23], 43, 72); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 222); + _scene->_dynamicHotspots.setPosition(_scene->_dynamicHotspots.add(39, 13, _globals._spriteIndexes[24], Common::Rect(0, 0, 0, 0)), 200, 133, FACING_NORTH); + } + break; + + case 222: { + _scene->_kernelMessages.add(Common::Point(182, 109), 0xFDFC, 0, 0, 70, _game.getQuote(160)); + int oldIdx = _globals._spriteIndexes[23]; + _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[23], 73, 78); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[23], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 223); + } + break; + + case 223: + _scene->loadAnimation(Resources::formatName(209, 'e', -1, EXT_AA, ""), 224); + _vm->_sound->command(38); + break; + + case 224: + _playingAnimFl = false; + _fallFl = false; + _counter = 0; + _pauseMode = 0; + _vm->_dialogs->show(0x51AE); + _game._player._stepEnabled = true; + break; + } +} + +void Scene209::handleMonkey1() { + switch (_game._trigger) { + case 212: + _scene->_sequences.remove(_globals._spriteIndexes[19]); + _globals._spriteIndexes[19] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 9, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[19], 1, 13); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[19], SM_0, 0, 213); + break; + + case 213: { + int oldIdx = _globals._spriteIndexes[19]; + _globals._spriteIndexes[22] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 7, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[22], 1, 22); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[22], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[22], SM_0, 0, 214); + } + break; + + case 214: { + int oldIdx = _globals._spriteIndexes[22]; + _globals._spriteIndexes[22] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 7, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[22], 23, 26); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[22], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[22], SM_0, 0, 215); + int msgIndex = _scene->_kernelMessages.add(Common::Point(170, 21), 0xFDFC, 0, 0, 90, _game.getQuote(156)); + _scene->_kernelMessages.setQuoted(msgIndex, 3, true); + } + break; + + case 215: { + _vm->_sound->command(18); + _scene->loadAnimation(Resources::formatName(209, 'a', -1, EXT_AA, ""), 251); + int oldIdx = _globals._spriteIndexes[22]; + _globals._spriteIndexes[22] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 7, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[22], 27, 35); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[22], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[22], SM_0, 0, 216); + } + break; + + case 216: { + int oldIdx = _globals._spriteIndexes[22]; + _globals._spriteIndexes[19] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 22); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[19], oldIdx); + _scene->_sequences.addTimer(25, 217); + } + break; + + case 217: + _pitchFl = false; + _counter = 0; + _pauseMode = 0; + _scene->_sequences.addTimer(1, 196); + break; + } +} + +void Scene209::handleMonkey2() { + switch (_game._trigger) { + case 251: + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 60, _game.getQuote(137)); + _vm->_sound->command(22); + _globals._spriteIndexes[27] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[12], false, 11, 1, 0, 0); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[27], Common::Point(111, 133)); + _scene->_sequences.setScale(_globals._spriteIndexes[27], 79); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[27], 1, 6); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[27], SM_0, 0, 252); + _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; + _game._player._visible = false; + break; + + case 252: { + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(132)); + int oldIdx = _globals._spriteIndexes[27]; + _globals._spriteIndexes[27] = _scene->_sequences.startCycle(_globals._spriteIndexes[12], false, 7); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[27], Common::Point(111, 133)); + _scene->_sequences.setScale(_globals._spriteIndexes[27], 79); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[27], oldIdx); + _scene->_sequences.addTimer(120, 253); + } + break; + + case 253: + _scene->_sequences.remove(_globals._spriteIndexes[27]); + _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; + _game._player._visible = true; + _game._player._stepEnabled = true; + break; + } +} + +void Scene209::handleDodge() { + switch (_game._trigger) { + case 241: + _scene->_hotspots.activate(227, true); + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 7); + _scene->_sequences.addTimer(6, 242); + break; + + case 242: + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 5); + _scene->_sequences.addTimer(25, 243); + _vm->_sound->command(24); + break; + + case 243: + _vm->_sound->command(18); + _scene->_sequences.remove(_globals._spriteIndexes[18]); + _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 6); + _playingAnimFl = false; + _pauseMode = 0; + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(180, 21), 0xFDFC, 0, 0, 90, _game.getQuote(155)); + if (!_shootMissedLastFl) { + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(135)); + _shootMissedLastFl = true; + } else { + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(136)); + } + break; + } +} + +void Scene209::enter() { + _globals._spriteIndexes[12] = _scene->_sprites.addSprites(formAnimName('a', 1), 0); + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('e', -1), 0); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('a', 0), 0); + _globals._spriteIndexes[9] = _scene->_sprites.addSprites(formAnimName('b', 1), 0); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('m', 0), 0); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('m', 1), 0); + _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('m', 3), 0); + _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('m', 6), 0); + _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('m', 8), 0); + + _game.loadQuoteSet(0x82, 0x83, 0x84, 0x9C, 0x97, 0x95, 0x99, 0x9E, 0x98, 0x9B, 0xA0, 0x96, 0x9F, + 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x91, 0x92, 0x93, 0x94, 0x89, 0x85, 0x8A, 0x86, 0x87, 0x88, 0); + + _vm->_palette->setEntry(252, 63, 44, 30); + _vm->_palette->setEntry(253, 63, 20, 22); + + if (_game._objects.isInRoom(OBJ_PLANT_STALK)) { + _globals._spriteIndexes[16] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); + int idx = _scene->_dynamicHotspots.add(271, 13, _globals._spriteIndexes[16], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, 263, 129, FACING_SOUTH); + _scene->_sequences.setDepth(_globals._spriteIndexes[16], 13); + } + + if (_scene->_priorSceneId == 208) { + _game._player._playerPos = Common::Point(11, 121); + _game._player._facing = FACING_EAST; + } else if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(28, 121); + _game._player._facing = FACING_SOUTH; + } + + if (_game._objects.isInRoom(OBJ_BINOCULARS)) { + _globals._spriteIndexes[24] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 1); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(201, 131)); + _scene->_sequences.setDepth(_globals._spriteIndexes[24], 8); + int idx = _scene->_dynamicHotspots.add(39, 13, _globals._spriteIndexes[24], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, 200, 133, FACING_NORTH); + } + + if (_scene->_roomChanged) { + _game._objects.addToInventory(OBJ_POISON_DARTS); + _game._objects.addToInventory(OBJ_BLOWGUN); + _globals[36] = 1; + } + + _pitchFl = false; + _fallFl = false; + _dodgeFl = false; + _playingAnimFl = false; + _monkeyPosition = 1; + _counter = 0; + _pauseMode = 0; + _forceFallFl = false; + _shouldFallFl = false; + _forceDodgeFl = false; + _binocularsDroppedFl = false; + _shouldDodgeFl = false; + _startShootingInTimerFl = false; + _dialogAbortVal = 5; + _playingDialogFl = false; + _shootMissedLastFl = false; + _removeMonkeyFl = true; + _shootReadyFl = false; + + _scene->_hotspots.activate(227, false); + + sceneEntrySound(); +} + +void Scene209::step() { + if (!_playingAnimFl && !_pitchFl && !_fallFl && !_dodgeFl && (_pauseMode == 0) && (_globals[36] == 1)) { + int randAction = _vm->getRandomNumber(1,50); + switch (randAction) { + case 1: + if ((_monkeyPosition == 1) && (_counter < 2)) { + _scene->_sequences.addTimer(1, 133); + _playingAnimFl = true; + _scene->_hotspots.activate(227, true); + ++_counter; + } + break; + + case 2: + if ((_monkeyPosition == 1) && (_counter < 2)) { + _scene->_sequences.addTimer(1, 140); + _scene->_hotspots.activate(227, true); + _playingAnimFl = true; + ++_counter; + } + break; + + case 3: + if (_monkeyPosition == 1) { + _scene->_sequences.addTimer(1, 145); + _scene->_hotspots.activate(227, true); + _playingAnimFl = true; + _counter = 0; + } + break; + + case 4: + if ((_monkeyPosition == 2) && (_counter < 2)) { + _scene->_sequences.addTimer(1, 151); + _scene->_hotspots.activate(227, true); + ++_counter; + _playingAnimFl = true; + } + break; + + case 5: + if (_monkeyPosition == 2) { + _scene->_sequences.addTimer(1, 161); + _scene->_hotspots.activate(227, true); + _counter = 0; + _playingAnimFl = true; + } + break; + + case 6: + if (_monkeyPosition == 2) { + _scene->_sequences.addTimer(1, 189); + _scene->_hotspots.activate(227, true); + _counter = 0; + _playingAnimFl = true; + } + break; + case 7: + if (_monkeyPosition == 3) { + _scene->_hotspots.activate(227, true); + _scene->_sequences.addTimer(1, 167); + _playingAnimFl = true; + } + break; + + case 8: + if (_monkeyPosition == 3) { + _scene->_sequences.addTimer(1, 178); + _playingAnimFl = true; + _scene->_hotspots.activate(227, true); + _counter = 0; + } + break; + + case 9: + if ((_monkeyPosition == 3) && (_game._player._playerPos.x<120)) { + _scene->_sequences.addTimer(1, 182); + _scene->_hotspots.activate(227, true); + _counter = 0; + _playingAnimFl = true; + } + break; + + case 10: + if (_monkeyPosition == 4) { + _scene->_sequences.addTimer(1, 196); + _scene->_hotspots.activate(227, true); + _playingAnimFl = true; + _counter = 0; + } + break; + + case 11: + if ((_monkeyPosition == 4) && (_counter < 3)) { + _scene->_sequences.addTimer(1, 199); + _scene->_hotspots.activate(227, true); + ++_counter; + _playingAnimFl = true; + } + break; + + case 30: + if (_monkeyPosition == 4) { + _scene->_sequences.addTimer(1, 246); + _scene->_hotspots.activate(227, true); + _counter = 0; + _playingAnimFl = true; + } + break; + + default: + if ((randAction >= 12) && (randAction <= 20) && (_monkeyPosition == 2) && (_counter < 5)) { + _scene->_sequences.addTimer(1, 155); + ++_counter; + _playingAnimFl = true; + } + + if ((randAction >= 21) && (randAction <= 29) && (_monkeyPosition == 3) && (_counter < 3)) { + _scene->_sequences.addTimer(1, 171); + _playingAnimFl = true; + ++_counter; + } + break; + } + } + + if (!_dodgeFl && !_pitchFl && !_fallFl && (_pauseMode == 1)) + _scene->_sequences.addTimer(1, 226); + + if (!_dodgeFl && !_pitchFl && !_fallFl && (_pauseMode == 2)) + handlePause(); + + if (!_dodgeFl && !_pitchFl && !_fallFl && (_pauseMode == 1)) + initPauseCounterThreshold(); + + handlePeek(); + handleVerticalMove(); + handleLookStay(); + handleLookRight(); + handleBlink(); + handleGetBinoculars(); + handleStandFromPeek(); + handleDodge(); + handleBinocularBlink(); + handleBinocularScan(); + handleJumpInTree(); + handleTongue(); + handleMonkeyFall(); + handleJumpAndHide(); + handleMonkeyEating(); + handleMonkey1(); + handleStandBlink(); + handleMonkey2(); + + if ((_monkeyPosition == 1) && !_playingAnimFl && _fallFl) { + _scene->_sequences.addTimer(1, 145); + _playingAnimFl = true; + } + + if ((_monkeyPosition == 2) && !_playingAnimFl && _fallFl) { + _scene->_sequences.addTimer(1, 161); + _playingAnimFl = true; + } + + if ((_monkeyPosition == 4) && !_playingAnimFl && _fallFl) { + _scene->_sequences.addTimer(1, 196); + _playingAnimFl = true; + } + + if ((_monkeyPosition == 3) && !_playingAnimFl && _fallFl && _forceFallFl) { + _scene->_sequences.addTimer(1, 219); + _playingAnimFl = true; + } + + if ((_monkeyPosition == 1) && !_playingAnimFl && _pitchFl) { + _scene->_sequences.addTimer(1, 145); + _playingAnimFl = true; + } + + if ((_monkeyPosition == 2) && !_playingAnimFl && _pitchFl) { + _scene->_sequences.addTimer(1, 189); + _playingAnimFl = true; + } + + if ((_monkeyPosition == 4) && !_playingAnimFl && _pitchFl) { + _scene->_sequences.addTimer(1, 212); + _playingAnimFl = true; + } + + if ((_monkeyPosition == 3) && !_playingAnimFl && _pitchFl) { + _scene->_sequences.addTimer(1, 178); + _playingAnimFl = true; + } + + if ((_monkeyPosition == 1) && !_playingAnimFl && _dodgeFl) { + _scene->_sequences.addTimer(1, 145); + _playingAnimFl = true; + } + + if ((_monkeyPosition == 4) && !_playingAnimFl && _dodgeFl) { + _scene->_sequences.addTimer(1, 196); + _playingAnimFl = true; + } + + if ((_monkeyPosition == 3) && !_playingAnimFl && _dodgeFl) { + _scene->_sequences.addTimer(1, 178); + _playingAnimFl = true; + } + + if ((_monkeyPosition == 2) && !_playingAnimFl && _dodgeFl && _forceDodgeFl) { + _scene->_sequences.addTimer(1, 241); + _playingAnimFl = true; + } + + if (_dodgeFl || _fallFl) { /* if want to dodge or fall */ + if (!_playingAnimFl && (_monkeyPosition == 2)) + _shouldDodgeFl = true; + + if (!_playingAnimFl && (_monkeyPosition == 3)) + _shouldFallFl = true; + + switch (_game._trigger) { + case 228: + _game._player._visible = false; + _globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle (_globals._spriteIndexes[2], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[17], 1, 7); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[17], Common::Point(116, 131)); + _scene->_sequences.setDepth(_globals._spriteIndexes[17], 4); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[17], SM_0, 0, 228); + break; + + case 229: { + int oldIdx = _globals._spriteIndexes[17]; + _globals._spriteIndexes[17] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 7); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[17], Common::Point(116, 131)); + _scene->_sequences.setDepth(_globals._spriteIndexes[17], 4); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[17], oldIdx); + _scene->_sequences.addTimer(35, 230); + } + break; + + case 230: + _scene->_sequences.remove(_globals._spriteIndexes[17]); + _globals._spriteIndexes[17] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[17], 1, 7); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[17], Common::Point(116, 131)); + _scene->_sequences.setDepth(_globals._spriteIndexes[17], 4); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[17], SM_0, 0, 231); + break; + + case 231: { + int oldIdx = _globals._spriteIndexes[17]; + _globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[17], 8, 10); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[17], Common::Point(116, 131)); + _scene->_sequences.setDepth(_globals._spriteIndexes[17], 4); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[17], oldIdx); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[17], SM_0, 0, 232); + _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; + _scene->_sequences.updateTimeout(_globals._spriteIndexes[17], -1); + _game._player._visible = false; + } + break; + + case 232: { + int oldIdx = _globals._spriteIndexes[17]; + _globals._spriteIndexes[17] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 10); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[17], Common::Point(116, 131)); + _scene->_sequences.setDepth(_globals._spriteIndexes[17], 4); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[17], oldIdx); + _scene->_sequences.addTimer(2, 233); + _scene->_kernelMessages.reset(); + if (_dodgeFl && (_monkeyPosition != 1) && (_monkeyPosition != 2)) + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 34463, _game.getQuote(138)); + if (_fallFl && (_monkeyPosition != 3)) + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 34463, _game.getQuote(138)); + } + break; + + case 233: + _shootReadyFl = true; + break; + + case 234: + _scene->_sequences.remove(_globals._spriteIndexes[17]); + _scene->_kernelMessages.reset(); + if (_action.isAction(NOUN_HOSE_DOWN, NOUN_BLOWGUN, NOUN_MONKEY)) { + _globals._spriteIndexes[17] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[2], false, 7, 16, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[17], 11, 12); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[17], Common::Point(116, 131)); + _scene->_sequences.setDepth(_globals._spriteIndexes[17], 4); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[17], SM_FRAME_INDEX, 12, 239); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[17], SM_0, 0, 235); + } else if (_action.isAction(NOUN_SHOOT, NOUN_BLOWGUN, NOUN_MONKEY)) { + _globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[17], 11, 12); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[17], Common::Point(116, 131)); + _scene->_sequences.setDepth(_globals._spriteIndexes[17], 4); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[17], SM_0, 0, 235); + _vm->_sound->command(23); + } + break; + + case 235: { + int oldIdx = _globals._spriteIndexes[17]; + _globals._spriteIndexes[17] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 13); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[17], Common::Point(116, 131)); + _scene->_sequences.setDepth(_globals._spriteIndexes[17], 4); + _scene->_sequences.updateTimeout(_globals._spriteIndexes[17], oldIdx); + _scene->_sequences.addTimer(12, 236); + _forceFallFl = true; + _forceDodgeFl = true; + } + break; + + case 236: + _scene->_sequences.remove(_globals._spriteIndexes[17]); + _globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[17], 14, 16); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[17], Common::Point(116, 131)); + _scene->_sequences.setDepth(_globals._spriteIndexes[17], 4); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[17], SM_0, 0, 237); + break; + + case 237: + _game._player._visible = true; + _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; + _scene->_sequences.addTimer(1, 238); + break; + + case 238: + _scene->_sequences.remove(_globals._spriteIndexes[17]); + if (_dodgeFl) + _game._player._stepEnabled = true; + + _startShootingInTimerFl = false; + + if (_fallFl) { + _globals[36] = MONKEY_IS_GONE; + _game._objects.setRoom(OBJ_POISON_DARTS, NOWHERE); + } + _dodgeFl = false; + _fallFl = false; + _forceFallFl = false; + _forceDodgeFl = false; + _shouldFallFl = false; + _shouldDodgeFl = false; + break; + + case 239: + _vm->_sound->command(23); + break; + } + } + + if (_game._trigger == 100) + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(134)); + + if (_shootReadyFl && (_shouldFallFl || _shouldDodgeFl)) { + _scene->_sequences.addTimer(4, 234); + _shootReadyFl = false; + } +} + +void Scene209::preActions() { + if (_action.isAction(0x18C, 0x84)) + _game._player._walkOffScreenSceneId = 208; + + if (_globals[36] == 1) { + if ((_action.isAction(NOUN_SHOOT) || _action.isAction(NOUN_HOSE_DOWN)) && _action.isAction(NOUN_MONKEY) + && _action.isAction(NOUN_BLOWGUN) && _game._objects.isInInventory(OBJ_BLOWGUN) && _game._objects.isInInventory(OBJ_POISON_DARTS)) { + _game._player._prepareWalkPos = Common::Point(111, 129); + _game._player._prepareWalkFacing = FACING_NORTHEAST; + _game._player._needToWalk = true; + _game._player._readyToWalk = true; + } + + if (_action.isAction(VERB_LOOK, NOUN_MONKEY) || _action.isAction(VERB_TALKTO, NOUN_MONKEY)) { + _game._player._prepareWalkPos = Common::Point(111, 129); + _game._player._prepareWalkFacing = FACING_NORTHEAST; + _game._player._needToWalk = true; + _game._player._readyToWalk = true; + } + } +} + +void Scene209::actions() { + if (_action._lookFlag) { + _vm->_dialogs->show(0x51B0); + _action._inProgress = false; + return; + } + + if (_action.isAction(0x18C, 0x1A2)) { + _scene->_nextSceneId = 203; + _action._inProgress = false; + return; + } + + if ((_action.isAction(VERB_TALKTO, NOUN_MONKEY)) && !_pitchFl && !_playingDialogFl) { + _scene->_sequences.addTimer(1, _dialogAbortVal); + _playingDialogFl = true; + _game._player._stepEnabled = false; + _action._inProgress = false; + return; + } + + switch (_game._trigger) { + case 130: + _game._player._stepEnabled = true; + _playingDialogFl = false; + _action._inProgress = false; + return; + + case 5: + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 6, 180, _game.getQuote(139)); + _action._inProgress = false; + return; + + case 6: + _scene->_kernelMessages.add(Common::Point(180, 21), 0xFDFC, 0, 0, 60, _game.getQuote(151)); + _scene->_sequences.addTimer(60, 130); + _dialogAbortVal = 7; + _action._inProgress = false; + return; + + case 7: + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 8, 180, _game.getQuote(140)); + _action._inProgress = false; + return; + + case 8: + _scene->_kernelMessages.add(Common::Point(180, 21), 0xFDFC, 0, 0, 60, _game.getQuote(149)); + _scene->_sequences.addTimer(60, 130); + _dialogAbortVal = 9; + _action._inProgress = false; + return; + + case 9: + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 180, _game.getQuote(141)); + _scene->_sequences.addTimer(200, 10); + _action._inProgress = false; + return; + + case 10: + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 11, 180, _game.getQuote(142)); + _action._inProgress = false; + return; + + case 11: + _scene->_kernelMessages.add(Common::Point(180, 21), 0xFDFC, 0, 0, 60, _game.getQuote(152)); + _scene->_sequences.addTimer(60, 130); + _dialogAbortVal = 12; + _action._inProgress = false; + return; + + case 12: + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 130, _game.getQuote(143)); + _scene->_sequences.addTimer(150, 13); + _action._inProgress = false; + return; + + case 13: + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 14, 180, _game.getQuote(145)); + _action._inProgress = false; + return; + + case 14: + _scene->_kernelMessages.add(Common::Point(180, 21), 0xFDFC, 0, 0, 60, _game.getQuote(151)); + _scene->_sequences.addTimer(60, 130); + _dialogAbortVal = 15; + _action._inProgress = false; + return; + + case 15: + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 16, 180, _game.getQuote(146)); + _action._inProgress = false; + return; + + case 16: + _scene->_kernelMessages.add(Common::Point(180, 21), 0xFDFC, 0, 17, 60, _game.getQuote(154)); + _action._inProgress = false; + return; + + case 17: + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 130, 60, _game.getQuote(147)); + _dialogAbortVal = 18; + _action._inProgress = false; + return; + + case 18: + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 180, _game.getQuote(148)); + _pitchFl = true; + _playingDialogFl = false; + _dialogAbortVal = 5; + _action._inProgress = false; + return; + } + + if (_globals[36] == 1) { + if ((_action.isAction(NOUN_SHOOT) || _action.isAction(NOUN_HOSE_DOWN)) && _action.isAction(NOUN_MONKEY) + && _action.isAction(NOUN_BLOWGUN) && _game._objects.isInInventory(OBJ_BLOWGUN) && _game._objects.isInInventory(OBJ_POISON_DARTS)) { + if (_action.isAction(NOUN_SHOOT, NOUN_BLOWGUN, NOUN_MONKEY) && !_startShootingInTimerFl) { + _game._triggerSetupMode = KERNEL_TRIGGER_DAEMON; + _scene->_sequences.addTimer(1, 231); + _startShootingInTimerFl = true; + _game._player._stepEnabled = false; + _dodgeFl = true; + _action._inProgress = false; + return; + } + + if (_action.isAction(NOUN_HOSE_DOWN, NOUN_BLOWGUN, NOUN_MONKEY) && !_startShootingInTimerFl) { + _game._triggerSetupMode = KERNEL_TRIGGER_DAEMON; + _scene->_sequences.addTimer(1, 228); + _game._player._stepEnabled = false; + _fallFl = true; + _startShootingInTimerFl = true; + _action._inProgress = false; + return; + } + } + + if (_action.isAction(VERB_LOOK, NOUN_MONKEY)) { + _pitchFl = true; + _game._player._stepEnabled = false; + _vm->_dialogs->show(0x51B2); + _action._inProgress = false; + return; + } + } + + if (_action.isAction(VERB_TAKE, NOUN_PLANT_STALK) && (_game._trigger || _game._objects.isInRoom(OBJ_PLANT_STALK))) { + switch (_game._trigger) { + case 0: + _globals._spriteIndexes[11] = _scene->_sprites.addSprites("*RXMBD_2", 0); + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._spriteIndexes[26] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[11], false, 3, 2, 0, 0); + _scene->_sequences.setMsgLayout(_globals._spriteIndexes[26]); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[26], SM_FRAME_INDEX, 4, 1); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[26], SM_0, 0, 2); + break; + + case 1: + _scene->_sequences.remove(_globals._spriteIndexes[16]); + _game._objects.addToInventory(OBJ_PLANT_STALK); + break; + + case 2: + _game._player._visible = true; + _game._player._stepEnabled = true; + _scene->_sequences.addTimer(4, 3); + _vm->_dialogs->showPicture(OBJ_PLANT_STALK, 0x328); + break; + + case 3: + _scene->_sprites.remove(_globals._spriteIndexes[11]); + break; + } + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_TAKE, 0x27) && (_game._trigger || _game._objects.isInRoom(OBJ_BINOCULARS))) { + switch (_game._trigger) { + case 0: + _globals._spriteIndexes[10] = _scene->_sprites.addSprites("*RXMBD_8", false); + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._spriteIndexes[25] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[10], false, 3, 2, 0, 0); + _scene->_sequences.setMsgLayout(_globals._spriteIndexes[25]); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[25], SM_FRAME_INDEX, 4, 1); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[25], SM_0, 0, 2); + break; + + case 1: + _scene->_sequences.remove(_globals._spriteIndexes[24]); + _game._objects.addToInventory(OBJ_BINOCULARS); + break; + + case 2: + _game._player._visible = true; + _game._player._stepEnabled = true; + _binocularsDroppedFl = false; + _scene->_sequences.addTimer(4, 3); + break; + + case 3: + _vm->_dialogs->showPicture (OBJ_BINOCULARS, 0x51AF); + _scene->_sprites.remove(_globals._spriteIndexes[10]); + break; + } + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x142)) { + _vm->_dialogs->show(0x51A5); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x1A3)) { + _vm->_dialogs->show(0x51A6); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x1A4)) { + _vm->_dialogs->show(0x51A7); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x1A6)) { + _vm->_dialogs->show(0x51A8); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x84)) { + _vm->_dialogs->show(0x51A9); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x1A2)) { + _vm->_dialogs->show(0x51AA); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x10F) && (_action._savedFields._mainObjectSource == 4)) { + _vm->_dialogs->show(0x51AB); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_GIVE, 0x17A, 0xE3) || _action.isAction(VERB_THROW, 0x17A, 0xE3)) { + _vm->_dialogs->show(0x51AD); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x175)) { + _vm->_dialogs->show(0x51B1); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_THROW, 0xE3) && _game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId))) { + if (!_action.isAction(0x114)) { + _vm->_dialogs->show(0x51B3); + } + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_THROW, 0x114, 0xE3)) { + _vm->_dialogs->show(0x51B4); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x100)) { + if (_globals[36] == 1) { + if (_monkeyPosition == 1) + _vm->_dialogs->show(0x51B5); + else + _vm->_dialogs->show(0x51B6); + } else { + if (_globals[36] == 0) + _vm->_dialogs->show(0x51B5); + else + _vm->_dialogs->show(0x51B7); + } + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x3A4)) { + _vm->_dialogs->show(0x51B8); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_TAKE, 0x3A4)) { + _vm->_dialogs->show(0x51B9); + _action._inProgress = false; + return; + } } } // End of namespace Nebular diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index a749e8afcb..d29b94e522 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -155,8 +155,45 @@ public: }; class Scene209: public Scene2xx { +private: + bool _dodgeFl, _forceDodgeFl, _shouldDodgeFl; + bool _pitchFl; + bool _fallFl, _forceFallFl, _shouldFallFl; + bool _playingAnimFl, _playingDialogFl; + int _pauseMode, _pauseCounterThreshold, _pauseCounter; + bool _removeMonkeyFl; + int _monkeyPosition; + bool _shootReadyFl, _startShootingInTimerFl, _shootMissedLastFl; + bool _binocularsDroppedFl; + int _dialogAbortVal; + int _counter; + + void handlePause(); + void initPauseCounterThreshold(); + void handlePeek(); + void handleVerticalMove(); + void handleLookStay(); + void handleLookRight(); + void handleBlink(); + void handleGetBinoculars(); + void handleStandFromPeek(); + void handleDodge(); + void handleBinocularBlink(); + void handleBinocularScan(); + void handleJumpInTree(); + void handleTongue(); + void handleMonkeyFall(); + void handleJumpAndHide(); + void handleMonkeyEating(); + void handleMonkey1(); + void handleStandBlink(); + void handleMonkey2(); + public: - Scene209(MADSEngine *vm) : Scene2xx(vm) {} + Scene209(MADSEngine *vm) : Scene2xx(vm), _dodgeFl(false), _forceDodgeFl(false), _pitchFl(false), _fallFl(false), _forceFallFl(false), + _playingAnimFl(false), _shouldFallFl(false), _shouldDodgeFl(false), _monkeyPosition(0), _counter(0), _pauseMode(0), + _binocularsDroppedFl(false), _startShootingInTimerFl(false), _dialogAbortVal(0), _playingDialogFl(false),_shootMissedLastFl(false), + _removeMonkeyFl(false), _shootReadyFl(false), _pauseCounterThreshold(0), _pauseCounter(0) {} virtual void setup(); virtual void enter(); virtual void step(); -- cgit v1.2.3 From ae6e19d7fc5b68611b33cdc6aabfce9379a561a2 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 5 Apr 2014 23:37:48 +0200 Subject: MADS: Some rework in scene group 1 and 8 --- engines/mads/nebular/nebular_scenes1.cpp | 57 +++++++++++--------------------- engines/mads/nebular/nebular_scenes8.cpp | 31 ++++++----------- 2 files changed, 31 insertions(+), 57 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 6d63a564ab..7cc4fb36fb 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -140,56 +140,43 @@ void Scene103::enter() { _globals._spriteIndexes[12] = _scene->_sprites.addSprites("*RXMBD_2"); _globals._spriteIndexes[13] = _scene->_sprites.addSprites("*RXMRD_3"); - _globals._spriteIndexes[15] = _scene->_sequences.addSpriteCycle( - _globals._spriteIndexes[0], false, 7, 0, 1, 0); - _globals._spriteIndexes[16] = _scene->_sequences.addSpriteCycle( - _globals._spriteIndexes[1], false, 6, 0, 2, 0); + _globals._spriteIndexes[15] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 7, 0, 1, 0); + _globals._spriteIndexes[16] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 6, 0, 2, 0); _scene->_sequences.setDepth(_globals._spriteIndexes[16], 0); - _globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle( - _globals._spriteIndexes[2], false, 6, 0, 0, 25); + _globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 6, 0, 0, 25); _scene->_sequences.addSubEntry(_globals._spriteIndexes[17], SM_FRAME_INDEX, 2, 72); - _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle( - _globals._spriteIndexes[3], false, 6, 0, 1, 37); + _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 6, 0, 1, 37); _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_FRAME_INDEX, 2, 73); - _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle( - _globals._spriteIndexes[8], false, 8); - _globals._spriteIndexes[22] = _scene->_sequences.addSpriteCycle( - _globals._spriteIndexes[7], false, 6); - _globals._spriteIndexes[19] = _scene->_sequences.addSpriteCycle( - _globals._spriteIndexes[4], false, 6); - _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle( - _globals._spriteIndexes[5], false, 6); + _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8); + _globals._spriteIndexes[22] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 6); + _globals._spriteIndexes[19] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 6); + _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 6); - if (_game._objects.isInRoom(OBJ_TIMER_MODULE)) { + if (_game._objects.isInRoom(OBJ_TIMER_MODULE)) _vm->_game->_scene._hotspots.activate(371, false); - } else { - _globals._spriteIndexes[26] = _scene->_sequences.addSpriteCycle( - _globals._spriteIndexes[11], false, 6); - } + else + _globals._spriteIndexes[26] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[11], false, 6); - if (_game._objects.isInRoom(OBJ_REBREATHER)) { + if (_game._objects.isInRoom(OBJ_REBREATHER)) _vm->_game->_scene._hotspots.activate(289, false); - } else { - _globals._spriteIndexes[25] = _scene->_sequences.addSpriteCycle( - _globals._spriteIndexes[10], false, 6); - } + else + _globals._spriteIndexes[25] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[10], false, 6); if (_globals[kTurkeyExploded]) { - _globals._spriteIndexes[24] = _scene->_sequences.addSpriteCycle( - _globals._spriteIndexes[9], false, 6); + _globals._spriteIndexes[24] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 6); _scene->_sequences.setAnimRange(_globals._spriteIndexes[24], -2, -2); _scene->_hotspots.activate(362, false); } if (_scene->_priorSceneId != -2) _game._player._playerPos = Common::Point(237, 74); + if (_scene->_priorSceneId == 102) { _game._player._stepEnabled = false; - _globals._spriteIndexes[21] = _scene->_sequences.addReverseSpriteCycle( - _globals._spriteIndexes[6], false, 6, 1, 0, 0); + _globals._spriteIndexes[21] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[6], false, 6, 1, 0, 0); _scene->_sequences.addSubEntry(_globals._spriteIndexes[21], SM_0, 0, 70); } @@ -197,8 +184,7 @@ void Scene103::enter() { _vm->_game->loadQuoteSet(70, 51, 71, 7, 73, 0); if (!_game._visitedScenes._sceneRevisited) { - int msgIndex = _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, - 34, 0, 120, _game.getQuote(70)); + int msgIndex = _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(70)); _scene->_kernelMessages.setQuoted(msgIndex, 4, true); } @@ -262,8 +248,7 @@ void Scene103::actions() { } else if (_action.isAction(395, 110)) { switch (_vm->_game->_trigger) { case 0: - _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle( - _globals._spriteIndexes[6], false, 6, 1); + _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 6, 1); _scene->_sequences.addSubEntry(_globals._spriteIndexes[21], SM_0, 0, 1); _game._player._stepEnabled = false; _vm->_sound->command(20); @@ -348,9 +333,7 @@ void Scene103::actions() { _vm->_sound->command(31); if (_vm->_game->_fx < 2) { - _globals._spriteIndexes[24] = _scene->_sequences.addSpriteCycle( - _globals._spriteIndexes[9], false, 6, - _vm->_game->_trigger < 1 ? 1 : 0); + _globals._spriteIndexes[24] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 6, _vm->_game->_trigger < 1 ? 1 : 0); if (_vm->_game->_trigger) { _scene->_sequences.setAnimRange(_globals._spriteIndexes[24], -1, 0); Common::String msg = _game.getQuote(51); diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index f8eeb3748a..6fee0cb973 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -105,30 +105,22 @@ void Scene804::enter() { if (_globals[kInSpace]) { if (_globals[kWindowFixed]) { - _globals._spriteIndexes[20] = _scene->_sequences.startCycle( - _globals._spriteIndexes[5], 0, 1); + _globals._spriteIndexes[20] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], 0, 1); _scene->_sequences.addTimer(60, 100); } else { - _globals._spriteIndexes[21] = _scene->_sequences.startCycle( - _globals._spriteIndexes[6], false, 1); - _globals._spriteIndexes[22] = _scene->_sequences.startReverseCycle( - _globals._spriteIndexes[7], false, 4, 0, 0, 0); + _globals._spriteIndexes[21] = _scene->_sequences.startCycle(_globals._spriteIndexes[6], false, 1); + _globals._spriteIndexes[22] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[7], false, 4, 0, 0, 0); _scene->_sequences.addTimer(160, 70); _game._player._stepEnabled = false; } } else { - if (_globals[kBeamIsUp] == 0) { - _globals._spriteIndexes[23] = _scene->_sequences.startCycle( - _globals._spriteIndexes[8], false, 1); - } + if (_globals[kBeamIsUp] == 0) + _globals._spriteIndexes[23] = _scene->_sequences.startCycle(_globals._spriteIndexes[8], false, 1); - if (_globals[kWindowFixed] == 0) { - _globals._spriteIndexes[23] = _scene->_sequences.startCycle( - _globals._spriteIndexes[19], false, 1); - } + if (_globals[kWindowFixed] == 0) + _globals._spriteIndexes[23] = _scene->_sequences.startCycle(_globals._spriteIndexes[19], false, 1); - _globals._spriteIndexes[1] = _scene->_sequences.startCycle( - _globals._spriteIndexes[1], false, 1); + _globals._spriteIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); _scene->_sequences.setMsgPosition(_globals._spriteIndexes[16], Common::Point(133, 139)); _scene->_sequences.setDepth(_globals._spriteIndexes[16], 8); } @@ -168,10 +160,8 @@ void Scene804::step() { } } else { if (_globals._v3 && _globals._v2 && _scene->_activeAnimation->getCurrentFrame() == 39) { - _globals._spriteIndexes[16] = _scene->_sequences.startCycle( - _globals._spriteIndexes[1], false, 1); - _scene->_sequences.setMsgPosition(_globals._spriteIndexes[16], - Common::Point(133, 139)); + _globals._spriteIndexes[16] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[16], Common::Point(133, 139)); _scene->_sequences.setDepth(_globals._spriteIndexes[16], 8); _globals._v3 = 0; } @@ -183,6 +173,7 @@ void Scene804::step() { if (_game._trigger == 70) _globals._v5 = 42; + if (_scene->_activeAnimation->getCurrentFrame() == 65) _scene->_sequences.remove(_globals._spriteIndexes[22]); -- cgit v1.2.3 From 3b27d99c397d6dca2485d50064c7529be1a44f19 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 5 Apr 2014 23:38:09 +0200 Subject: MADS: Remove useless global variable --- engines/mads/nebular/globals_nebular.cpp | 1 - engines/mads/nebular/globals_nebular.h | 1 - 2 files changed, 2 deletions(-) diff --git a/engines/mads/nebular/globals_nebular.cpp b/engines/mads/nebular/globals_nebular.cpp index 80e8dedd3b..382a31e6e6 100644 --- a/engines/mads/nebular/globals_nebular.cpp +++ b/engines/mads/nebular/globals_nebular.cpp @@ -46,7 +46,6 @@ Globals::Globals() { _v7 = 0; _v8 = 0; _abortVal = 0; - _v8425C = 0; _v84262 = 0; _v84264 = 0; _v84266 = 0; diff --git a/engines/mads/nebular/globals_nebular.h b/engines/mads/nebular/globals_nebular.h index 14bb2fb5af..51e18ee7cb 100644 --- a/engines/mads/nebular/globals_nebular.h +++ b/engines/mads/nebular/globals_nebular.h @@ -296,7 +296,6 @@ public: uint32 _v7; int _v8; int _abortVal; - uint32 _v8425C; int _v84262, _v84264, _v84266, _v84268; public: /** -- cgit v1.2.3 From d3bc036a46ea83a0bd5a4d16577740b25e8eaec4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 5 Apr 2014 17:50:58 -0400 Subject: MADS: Fix display of dialog at end of taking turkey explosion sequence --- engines/mads/nebular/dialogs_nebular.cpp | 1 + engines/mads/nebular/nebular_scenes1.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp index ff25696f5d..871e10416d 100644 --- a/engines/mads/nebular/dialogs_nebular.cpp +++ b/engines/mads/nebular/dialogs_nebular.cpp @@ -234,6 +234,7 @@ bool DialogsNebular::show(int msgId) { dialog->incNumLines(); // Show the dialog + _vm->_events->setCursor(CURSOR_ARROW); dialog->show(); delete dialog; diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 7cc4fb36fb..5e4d1691a8 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -335,18 +335,21 @@ void Scene103::actions() { if (_vm->_game->_fx < 2) { _globals._spriteIndexes[24] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 6, _vm->_game->_trigger < 1 ? 1 : 0); if (_vm->_game->_trigger) { + // Rex says "Gads.." _scene->_sequences.setAnimRange(_globals._spriteIndexes[24], -1, 0); Common::String msg = _game.getQuote(51); _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 18, 0, 60, msg); - _scene->_sequences.addTimer(120, _vm->_game->_trigger); + _scene->_sequences.addTimer(120, _vm->_game->_trigger + 1); } else { + // Start initial explosion _scene->_sequences.addSubEntry(_globals._spriteIndexes[24], SM_0, 0, 1); } _game._player._stepEnabled = _game._trigger == 2; _globals[kTurkeyExploded] = -1; if (_game._trigger == 2) { - _vm->_dialogs->show(1030); + // Show exposition dialog + _vm->_dialogs->show(10302); _scene->_hotspots.activate(362, false); } } -- cgit v1.2.3 From 41e527bb73c6166ce4ed49502de1d8bbee6e4bf6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 5 Apr 2014 18:48:23 -0400 Subject: MADS: Fix incorrect parameter in turky explosion sequence --- engines/mads/nebular/nebular_scenes1.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 5e4d1691a8..f7a2a6031e 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -332,26 +332,30 @@ void Scene103::actions() { if (!_vm->_game->_trigger) _vm->_sound->command(31); - if (_vm->_game->_fx < 2) { + if (_vm->_game->_trigger < 2) { _globals._spriteIndexes[24] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 6, _vm->_game->_trigger < 1 ? 1 : 0); if (_vm->_game->_trigger) { + // Lock the turkey into a permanent "exploded" frame + _scene->_sequences.setAnimRange(_globals._spriteIndexes[24], -1, -1); + // Rex says "Gads.." - _scene->_sequences.setAnimRange(_globals._spriteIndexes[24], -1, 0); Common::String msg = _game.getQuote(51); _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 18, 0, 60, msg); _scene->_sequences.addTimer(120, _vm->_game->_trigger + 1); } else { - // Start initial explosion + // Initial turky explosion _scene->_sequences.addSubEntry(_globals._spriteIndexes[24], SM_0, 0, 1); } + } - _game._player._stepEnabled = _game._trigger == 2; - _globals[kTurkeyExploded] = -1; - if (_game._trigger == 2) { - // Show exposition dialog - _vm->_dialogs->show(10302); - _scene->_hotspots.activate(362, false); - } + // Re-enable player if sequence is ended, and set global flag + _game._player._stepEnabled = _game._trigger == 2; + _globals[kTurkeyExploded] = -1; + + if (_game._trigger == 2) { + // Show exposition dialog at end of sequence + _vm->_dialogs->show(10302); + _scene->_hotspots.activate(362, false); } } else if (_action.isAction(VERB_LOOK, 250)) { _vm->_dialogs->show(!_globals[kTurkeyExploded] ? 10323 : 10303); -- cgit v1.2.3 From 0f1b1e3b8c3e7d5463e722ca608b6f4b942a4dd7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 5 Apr 2014 18:48:46 -0400 Subject: MADS: Remove redundant if block around sequence sub-entries loop --- engines/mads/sequence.cpp | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index 92cba84718..fa6d745675 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -303,26 +303,24 @@ bool SequenceList::loadSprites(int seqIndex) { seqEntry._doneFlag = true; } - if (seqEntry._entries._count > 0) { - for (int i = 0; i < seqEntry._entries._count; ++i) { - switch (seqEntry._entries._mode[i]) { - case SM_0: - case SM_1: - if (((seqEntry._entries._mode[i] == SM_0) && seqEntry._doneFlag) || - ((seqEntry._entries._mode[i] == SM_1) && result)) - idx = i; - break; - - case SM_FRAME_INDEX: { - int v = seqEntry._entries._frameIndex[i]; - if ((v == seqEntry._frameIndex) || (v == 0)) - idx = i; - break; - } + for (int i = 0; i < seqEntry._entries._count; ++i) { + switch (seqEntry._entries._mode[i]) { + case SM_0: + case SM_1: + if (((seqEntry._entries._mode[i] == SM_0) && seqEntry._doneFlag) || + ((seqEntry._entries._mode[i] == SM_1) && result)) + idx = i; + break; - default: - break; - } + case SM_FRAME_INDEX: { + int v = seqEntry._entries._frameIndex[i]; + if ((v == seqEntry._frameIndex) || (v == 0)) + idx = i; + break; + } + + default: + break; } } -- cgit v1.2.3 From e37d1b72808e3179985bb0d6fe320e105c822688 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 5 Apr 2014 21:01:41 -0400 Subject: MADS: Cleanup of the MADSAction class --- engines/mads/action.cpp | 18 +++++++++--------- engines/mads/action.h | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index e227d7c700..a84c329dd0 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -53,7 +53,7 @@ void MADSAction::clear() { _recentCommandSource = 0; _articleNumber = 0; _lookFlag = false; - _v86F4A = 0; + _pointEstablished = 0; _selectedRow = -1; _hotspotId = -1; _secondObject = -1; @@ -74,11 +74,11 @@ void MADSAction::appendVocab(int vocabId, bool capitalise) { _statusText += " "; } -void MADSAction::checkCustomDest(int v) { +void MADSAction::startWalkingDirectly(int walkType) { Scene &scene = _vm->_game->_scene; Player &player = _vm->_game->_player; - if (_v86F4A && (v == -3 || _savedFields._command < 0)) { + if (_pointEstablished && (walkType == -3 || _savedFields._command < 0)) { player._needToWalk = true; player._prepareWalkPos = scene._customDest; } @@ -304,7 +304,7 @@ void MADSAction::startAction() { if (hotspotId >= (int)hotspots.size()) { DynamicHotspot &hs = dynHotspots[hotspotId - hotspots.size()]; if ((hs._feetPos.x == -1) || (hs._feetPos.x == -3)) { - checkCustomDest(hs._feetPos.x); + startWalkingDirectly(hs._feetPos.x); } else if (hs._feetPos.x == 0) { player._prepareWalkFacing = hs._facing; } else if (_savedFields._commandSource == ACTIONMODE_NONE || hs._cursor >= CURSOR_WAIT) { @@ -321,7 +321,7 @@ void MADSAction::startAction() { Hotspot &hs = hotspots[hotspotId]; if (hs._feetPos.x == -1 || hs._feetPos.x == -3) { - checkCustomDest(hs._feetPos.x); + startWalkingDirectly(hs._feetPos.x); } else if (hs._feetPos.x >= 0) { if (_savedFields._commandSource == ACTIONMODE_NONE || hs._cursor < CURSOR_WAIT) { player._needToWalk = true; @@ -561,7 +561,7 @@ void MADSAction::leftClick() { if (_vm->_events->currentPos().y < MADS_SCENE_HEIGHT) { scene._customDest = _vm->_events->currentPos() + scene._posAdjust; _selectedAction = -1; - _v86F4A = true; + _pointEstablished = true; } break; @@ -591,7 +591,7 @@ void MADSAction::leftClick() { if (userInterface._category == CAT_HOTSPOT) { scene._customDest = _vm->_events->mousePos() + scene._posAdjust; - _v86F4A = true; + _pointEstablished = true; } } break; @@ -609,9 +609,9 @@ void MADSAction::leftClick() { _selectedAction = -1; if (userInterface._category == CAT_HOTSPOT) { - if (!_v86F4A) { + if (!_pointEstablished) { scene._customDest = _vm->_events->mousePos() + scene._posAdjust; - _v86F4A = true; + _pointEstablished = true; } } } diff --git a/engines/mads/action.h b/engines/mads/action.h index 4b51ec9b71..343f9154da 100644 --- a/engines/mads/action.h +++ b/engines/mads/action.h @@ -88,7 +88,7 @@ private: void appendVocab(int vocabId, bool capitalise = false); - void checkCustomDest(int v); + void startWalkingDirectly(int v); public: ActionDetails _action, _activeAction; int8 _flags1, _flags2; @@ -108,7 +108,7 @@ public: int16 _secondObject; int16 _secondObjectSource; int16 _recentCommandSource; - bool _v86F4A; + bool _pointEstablished; int16 _recentCommand; InterAwaiting _interAwaiting; bool _inProgress; -- cgit v1.2.3 From 11403c5db6eac282e0e1f28623ac25ab95517792 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 5 Apr 2014 21:30:42 -0400 Subject: MADS: Further cleanup of previously anonymous fields --- engines/mads/action.h | 2 +- engines/mads/game.cpp | 2 +- engines/mads/hotspots.cpp | 2 +- engines/mads/screen.cpp | 8 ++++---- engines/mads/screen.h | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/engines/mads/action.h b/engines/mads/action.h index 343f9154da..b38e9c24e0 100644 --- a/engines/mads/action.h +++ b/engines/mads/action.h @@ -88,7 +88,7 @@ private: void appendVocab(int vocabId, bool capitalise = false); - void startWalkingDirectly(int v); + void startWalkingDirectly(int walkType); public: ActionDetails _action, _activeAction; int8 _flags1, _flags2; diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index d0d3b272ad..d964c14451 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -171,7 +171,7 @@ void Game::sectionLoop() { _visitedScenes.add(_scene._nextSceneId); // Reset the user interface - _screenObjects._v8333C = true; + _screenObjects._forceRescan = true; _screenObjects._inputMode = kInputBuildingSentences; _scene._userInterface._scrollerY = 0; diff --git a/engines/mads/hotspots.cpp b/engines/mads/hotspots.cpp index fec1f6ef96..24ff1722e8 100644 --- a/engines/mads/hotspots.cpp +++ b/engines/mads/hotspots.cpp @@ -135,7 +135,7 @@ void DynamicHotspots::refresh() { case kInputBuildingSentences: case kInputLimitedSentences: scrObjects.add(dh._bounds, _vm->_game->_scene._layer, CAT_12, dh._descId); - scrObjects._v8333C = true; + scrObjects._forceRescan = true; break; default: break; diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index f03f89122f..25623bc215 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -252,7 +252,7 @@ ScreenObject::ScreenObject() { ScreenObjects::ScreenObjects(MADSEngine *vm) : _vm(vm) { _objectY = -1; - _v8333C = false; + _forceRescan = false; _inputMode = kInputBuildingSentences; _v7FED6 = 0; _v8332A = 0; @@ -289,7 +289,7 @@ void ScreenObjects::check(bool scanFlag) { _vm->_events->_rightMousePressed = false; if ((_vm->_events->_mouseMoved || _vm->_game->_scene._userInterface._scrollerY - || _v8332A || _v8333C) && scanFlag) { + || _v8332A || _forceRescan) && scanFlag) { _category = CAT_NONE; _selectedObject = scanBackwards(_vm->_events->currentPos(), LAYER_GUI); if (_selectedObject > 0) { @@ -320,7 +320,7 @@ void ScreenObjects::check(bool scanFlag) { } } - if (_vm->_events->_mouseButtons || (_vm->_easyMouse && scene._action._interAwaiting > 1 + if (_vm->_events->_mouseButtons || (_vm->_easyMouse && scene._action._interAwaiting > AWAITING_COMMAND && scene._userInterface._category == CAT_INV_LIST) || (_vm->_easyMouse && scene._userInterface._category == CAT_HOTSPOT)) { scene._action.checkActionAtMousePos(); @@ -337,7 +337,7 @@ void ScreenObjects::check(bool scanFlag) { if (_vm->_events->_mouseButtons || _vm->_easyMouse) scene._action.set(); - _v8333C = 0; + _forceRescan = 0; } scene._action.refresh(); diff --git a/engines/mads/screen.h b/engines/mads/screen.h index 3595907b73..ed3de80576 100644 --- a/engines/mads/screen.h +++ b/engines/mads/screen.h @@ -157,7 +157,7 @@ public: InputMode _inputMode; int _v7FED6; int _v8332A; - int _v8333C; + int _forceRescan; int _selectedObject; ScrCategory _category; int _newDescId; -- cgit v1.2.3 From ff7d2e2dbf60202cc24b26b1ac61c0e76e802191 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 5 Apr 2014 22:41:25 -0400 Subject: MADS: Add missing scene codes variant handling --- engines/mads/nebular/nebular_scenes.cpp | 4 ++-- engines/mads/nebular/nebular_scenes.h | 2 +- engines/mads/nebular/nebular_scenes1.cpp | 6 +++--- engines/mads/nebular/nebular_scenes2.cpp | 4 ++-- engines/mads/scene.cpp | 10 +++++----- engines/mads/scene.h | 7 +++++-- engines/mads/scene_data.cpp | 4 ++-- engines/mads/scene_data.h | 16 ++++++++++------ 8 files changed, 30 insertions(+), 23 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 3a6e6a609f..0538f1b10e 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -90,10 +90,10 @@ Common::String NebularScene::formAnimName(char sepChar, int suffixNum) { /*------------------------------------------------------------------------*/ -void SceneInfoNebular::loadCodes(MSurface &depthSurface) { +void SceneInfoNebular::loadCodes(MSurface &depthSurface, int variant) { File f(Resources::formatName(RESPREFIX_RM, _sceneId, ".DAT")); MadsPack codesPack(&f); - Common::SeekableReadStream *stream = codesPack.getItemStream(0); + Common::SeekableReadStream *stream = codesPack.getItemStream(variant + 1); loadCodes(depthSurface, stream); diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index 895ee51cfa..8e5bc05348 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -131,7 +131,7 @@ public: class SceneInfoNebular : public SceneInfo { friend class SceneInfo; protected: - virtual void loadCodes(MSurface &depthSurface); + virtual void loadCodes(MSurface &depthSurface, int variant); virtual void loadCodes(MSurface &depthSurface, Common::SeekableReadStream *stream); diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index f7a2a6031e..2a9b3c64ee 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -266,7 +266,7 @@ void Scene103::actions() { } else if (_action.isAction(VERB_TAKE, 371) && _game._objects.isInRoom(OBJ_TIMER_MODULE)) { switch (_vm->_game->_trigger) { case 0: - _scene->changeDepthSurface(1); + _scene->changeVariant(1); _globals._spriteIndexes[28] = _scene->_sequences.startReverseCycle( _globals._spriteIndexes[13], false, 3, 2); _scene->_sequences.setMsgLayout(_globals._spriteIndexes[28]); @@ -284,7 +284,7 @@ void Scene103::actions() { case 2: _vm->_sound->command(22); _game._objects.addToInventory(OBJ_TIMER_MODULE); - _scene->changeDepthSurface(0); + _scene->changeVariant(0); _scene->drawElements(kTransitionNone, false); _scene->_hotspots.activate(371, false); _vm->_game->_player._visible = true; @@ -298,7 +298,7 @@ void Scene103::actions() { } else if (_action.isAction(VERB_TAKE, 289, 0) && _game._objects.isInRoom(OBJ_REBREATHER)) { switch (_vm->_game->_trigger) { case 0: - _scene->changeDepthSurface(1); + _scene->changeVariant(1); _globals._spriteIndexes[27] = _scene->_sequences.startReverseCycle( _globals._spriteIndexes[12], false, 3, 2); _scene->_sequences.setMsgLayout(_globals._spriteIndexes[27]); diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 0bf5c21e59..9e4edc0bca 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -381,7 +381,7 @@ void Scene202::enter() { } if (_globals[kBone202Status]) - _scene->changeDepthSurface(_globals[kBone202Status]); + _scene->changeVariant(_globals[kBone202Status]); if (_scene->_priorSceneId == 201) { _game._player._playerPos = Common::Point(190, 91); @@ -789,7 +789,7 @@ void Scene202::actions() { _game._objects.addToInventory(OBJ_BONE); _vm->_dialogs->showPicture(OBJ_BONE, 0x4EFA, 0); } - _scene->changeDepthSurface(_globals[kBone202Status]); + _scene->changeVariant(_globals[kBone202Status]); _game._player._stepEnabled = true; _game._player._visible = true; } else { diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 140077418b..9ef7d0b245 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -114,7 +114,7 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) { _priorSceneId = _currentSceneId; _currentSceneId = sceneId; - _v1 = 0; + _variant = 0; if (palFlag) _vm->_palette->resetGamePalette(18, 10); @@ -124,7 +124,7 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) { // TODO: palletteUsage reset? setPalette(_nullPalette); _sceneInfo = SceneInfo::init(_vm); - _sceneInfo->load(_currentSceneId, _v1, Common::String(), _vm->_game->_v2 ? 17 : 16, + _sceneInfo->load(_currentSceneId, _variant, Common::String(), _vm->_game->_v2 ? 17 : 16, _depthSurface, _backgroundSurface); // Initialise palette animation for the scene @@ -570,9 +570,9 @@ void Scene::free() { _sceneInfo = nullptr; } -void Scene::changeDepthSurface(int arg1) { - _v1 = arg1; - _sceneInfo->loadCodes(_depthSurface, nullptr); +void Scene::changeVariant(int variant) { + _variant = variant; + _sceneInfo->loadCodes(_depthSurface, variant); _spriteSlots.fullRefresh(); } diff --git a/engines/mads/scene.h b/engines/mads/scene.h index 4e3829b838..dbb218842b 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -98,7 +98,7 @@ public: int _textSpacing; Hotspots _hotspots; DirtyAreas _dirtyAreas; - int _v1; + int _variant; SceneInfo *_sceneInfo; MSurface _backgroundSurface; DepthSurface _depthSurface; @@ -206,7 +206,10 @@ public: */ void free(); - void changeDepthSurface(int arg1); + /** + * Set the walk surface for a scene to a different variant + */ + void changeVariant(int variant); void resetScene(); diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index 4c19202f4b..f92ff86798 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -98,7 +98,7 @@ SceneInfo *SceneInfo::init(MADSEngine *vm) { } } -void SceneInfo::load(int sceneId, int v1, const Common::String &resName, +void SceneInfo::load(int sceneId, int variant, const Common::String &resName, int flags, MSurface &depthSurface, MSurface &bgSurface) { bool sceneFlag = sceneId >= 0; @@ -180,7 +180,7 @@ void SceneInfo::load(int sceneId, int v1, const Common::String &resName, } // Load the depth surface with the scene codes - Common::SeekableReadStream *depthStream = infoPack.getItemStream(1); + Common::SeekableReadStream *depthStream = infoPack.getItemStream(variant + 1); loadCodes(depthSurface, depthStream); delete depthStream; diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index 81c24ed8ab..2a6032a507 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -137,11 +137,6 @@ protected: * Constructor */ SceneInfo(MADSEngine *vm) : _vm(vm) {} - - /** - * Loads the given surface with depth information of a given scene - */ - virtual void loadCodes(MSurface &depthSurface) = 0; public: int _sceneId; int _artFileNum; @@ -173,11 +168,20 @@ public: /** loads the data */ - void load(int sceneId, int flags, const Common::String &resName, int v3, + void load(int sceneId, int variant, const Common::String &resName, int flags, MSurface &depthSurface, MSurface &bgSurface); /** * Loads the given surface with depth information of a given scene + * @param depthSurface Depth/walk surface + * @param variant Variant number to load + */ + virtual void loadCodes(MSurface &depthSurface, int variant) = 0; + + /** + * Loads the given surface with depth information of a given scene + * @param depthSurface Depth/walk surface + * @param stream Stream to load the data from */ virtual void loadCodes(MSurface &depthSurface, Common::SeekableReadStream *stream) = 0; }; -- cgit v1.2.3 From 962d41e8ca6c0495209ffc1832c59606428d3a35 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 5 Apr 2014 23:24:38 -0400 Subject: MADS: Fix calculating player depth in the scene --- engines/mads/player.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index 3eb6b118d7..b337f8ada0 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -263,7 +263,7 @@ void Player::update() { scene._spriteSlots[slotIndex]._flags = IMG_ERASE; int newDepth = 1; - int yp = MAX(_playerPos.y, (int16)(MADS_SCENE_HEIGHT - 1)); + int yp = MIN(_playerPos.y, (int16)(MADS_SCENE_HEIGHT - 1)); for (int idx = 1; idx < 15; ++idx) { if (scene._sceneInfo->_depthList[newDepth] >= yp) -- cgit v1.2.3 From a2871fb1b0eb96755404f584e94e267d8a629263 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 6 Apr 2014 00:24:42 -0400 Subject: MADS: Fix display of scene inventory items --- engines/mads/nebular/nebular_scenes1.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 2a9b3c64ee..775f814999 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -155,14 +155,14 @@ void Scene103::enter() { _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 6); if (_game._objects.isInRoom(OBJ_TIMER_MODULE)) - _vm->_game->_scene._hotspots.activate(371, false); - else _globals._spriteIndexes[26] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[11], false, 6); + else + _vm->_game->_scene._hotspots.activate(371, false); if (_game._objects.isInRoom(OBJ_REBREATHER)) - _vm->_game->_scene._hotspots.activate(289, false); - else _globals._spriteIndexes[25] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[10], false, 6); + else + _vm->_game->_scene._hotspots.activate(289, false); if (_globals[kTurkeyExploded]) { _globals._spriteIndexes[24] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 6); -- cgit v1.2.3 From 0c55beb40ca9f0254c4228e26ae8152fca78957f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 6 Apr 2014 15:20:48 -0400 Subject: MADS: In progress doObjectScene implementation --- engines/mads/nebular/game_nebular.cpp | 145 +++++++++++++++++++++++++++++++++- 1 file changed, 144 insertions(+), 1 deletion(-) diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index 638432ae1a..bc61fa4fb4 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -29,6 +29,7 @@ #include "mads/nebular/game_nebular.h" #include "mads/nebular/dialogs_nebular.h" #include "mads/nebular/globals_nebular.h" +#include "mads/nebular/nebular_scenes.h" namespace MADS { @@ -277,7 +278,149 @@ void GameNebular::checkShowDialog() { } void GameNebular::doObjectAction() { - warning("TODO: GameNebular::doObjectAction"); + Scene &scene = _scene; + MADSAction &action = _scene._action; + Dialogs &dialogs = *_vm->_dialogs; + int id; + + if (action.isAction(NOUN_SMELL) && scene._currentSceneId > 103 && scene._currentSceneId < 111) { + dialogs.show(440); + } else if (action.isAction(NOUN_EAT) && scene._currentSceneId > 103 && scene._currentSceneId < 111) { + dialogs.show(441); + } else if (action.isAction(NOUN_SMELL, NOUN_BURGER)) { + dialogs.show(442); + } else if (action.isAction(NOUN_EAT, NOUN_BURGER)) { + dialogs.show(443); + } else if (action.isAction(NOUN_SMELL, NOUN_STUFFED_FISH)) { + dialogs.show(444); + } else if (action.isAction(NOUN_EAT, NOUN_STUFFED_FISH)) { + dialogs.show(445); + } else if (action.isAction(401, 289)) { + dialogs.show(scene._currentSceneId > 103 && scene._currentSceneId < 111 ? 447 : 446); + } else if (action.isAction(306, 371)) { + dialogs.show(448); + } else if (action.isAction(951, 35)) { + dialogs.show(449); + } else if (action.isAction(203, 276)) { + dialogs.show(450); + } else if (action.isAction(NOUN_EAT, 378)) { + _objects.setRoom(OBJ_TWINKIFRUIT, PLAYER_INVENTORY); + dialogs.show(451); + } else if (action.isAction(153, 378)) { + _objects.setRoom(OBJ_TWINKIFRUIT, PLAYER_INVENTORY); + dialogs.show(452); + } else if (action.isAction(152)) { + dialogs.show(453); + } else if (action.isAction(1187, OBJ_PHONE_CELLS)) { + dialogs.show(454); + } else if (action.isAction(1188, 92)) { + dialogs.show(455); + } else if (action.isAction(140, 72)) { + dialogs.show(456); + } else if (action.isAction(1189, OBJ_VASE)) { + dialogs.show(457); + } else if (action.isAction(306, 369)) { + dialogs.show(458); + } else if (action.isAction(1192, 774)) { + dialogs.show(459); + } else if (action.isAction(1191, 359)) { + dialogs.show(460); + } else if (action.isAction(1190)) { + dialogs.show(461); + } else if (action.isAction(934, 277)) { + dialogs.show(462); + } else if (action.isAction(329, 277)) { + dialogs.show(465); + } else if (action.isAction(368, 135)) { + dialogs.show(463); + } else if (action.isAction(25, 135)) { + dialogs.show(463); + } else if (action.isAction(379)) { + dialogs.show(464); + } else if (action.isAction(869)) { + dialogs.show(466); + } else if (action.isAction(530, 288)) { + dialogs.show(467); + } else if (action.isAction(NOUN_EAT, 74)) { + dialogs.show(469); + } else if (action.isAction(50, 381)) { + dialogs.show(471); + } else if (action.isAction(307, 950)) { + dialogs.show(472); + } else if (action.isAction(NOUN_READ, NOUN_LOG)) { + dialogs.show(473); + } else if (action.isAction(1189, 43)) { + dialogs.show(474); + } else if (action.isAction(114, 726)) { + dialogs.show(475); + } else if (action.isAction(114, 727)) { + dialogs.show(476); + } else if (action.isAction(114, 937)) { + dialogs.show(477); + } else if (action.isAction(VERB_PUT, 276, NOUN_PLANT_STALK) && _objects.isInRoom(OBJ_POISON_DARTS) + && _objects.isInRoom(OBJ_PLANT_STALK)) { + _objects.addToInventory(OBJ_BLOWGUN); + _objects.setRoom(OBJ_PLANT_STALK, PLAYER_INVENTORY); + _globals[kBlowgunStatus] = 0; + dialogs.showPicture(OBJ_BLOWGUN, 809); + } else if (action.isAction(VERB_PUT, 276, NOUN_BLOWGUN) && _objects.isInInventory(OBJ_POISON_DARTS) + && _objects.isInInventory(OBJ_BLOWGUN)) { + dialogs.show(433); + } else if (action.isAction(1161) && action.isAction(1195) && action.isAction(1197)) { + dialogs.show(434); + } else if (action.isAction(1196)) { + dialogs.show(479); + } else if ((action.isAction(287) || action.isAction(NOUN_LOOK_AT) || action.isAction(VERB_LOOK)) && + action.isAction(936) && _objects.isInInventory(OBJ_NOTE)) { + _objects.setRoom(OBJ_NOTE, PLAYER_INVENTORY); + _objects.addToInventory(OBJ_COMBINATION); + dialogs.showPicture(OBJ_COMBINATION, 851); + } else if ((action.isAction(VERB_LOOK) || action.isAction(NOUN_READ)) && + ((id = _objects.getIdFromDesc(action._activeAction._objectNameId)) != 0 || + (action._activeAction._indirectObjectId > 0 && + (id = _objects.getIdFromDesc(action._activeAction._indirectObjectId))))) { + if (id == 21) { + dialogs._indexList[0] = _globals[kTeleporterCode + 7]; + dialogs._indexList[1] = _globals[kTeleporterCode + 8]; + dialogs._indexList[2] = _globals[kTeleporterCode + 6]; + dialogs._indexList[3] = _globals[kTeleporterCode + 9]; + dialogs._indexList[4] = _globals[kTeleporterCode + 0]; + dialogs._indexList[5] = _globals[kTeleporterCode + 1]; + dialogs._indexList[6] = _globals[kTeleporterCode + 4]; + dialogs._indexList[7] = _globals[kTeleporterCode + 5]; + dialogs._indexList[8] = _globals[kTeleporterCode + 2]; + + dialogs.showPicture(id, 402); + } else { + error("TODO: Implement. See loc_29B48"); + } + } else if (action.isAction(VERB_PUT, NOUN_BURGER, NOUN_DEAD_FISH)) { + if (_objects.isInInventory(OBJ_BURGER) || _objects.isInInventory(OBJ_DEAD_FISH)) { + _objects.removeFromInventory(OBJ_DEAD_FISH, PLAYER_INVENTORY); + _objects.removeFromInventory(OBJ_BURGER, PLAYER_INVENTORY); + _objects.addToInventory(OBJ_STUFFED_FISH); + dialogs.showPicture(OBJ_STUFFED_FISH, 803); + } + } else if (action.isAction(VERB_PUT, 26, 357) && _objects.isInInventory(OBJ_AUDIO_TAPE) && + _objects.isInInventory(OBJ_TAPE_PLAYER)) { + _objects.setRoom(OBJ_AUDIO_TAPE, 25); + } else if (action.isAction(118, 357) && _objects.isInInventory(OBJ_TAPE_PLAYER)) { + if (_objects[OBJ_AUDIO_TAPE]._roomNumber == 25) { + _objects.addToInventory(OBJ_AUDIO_TAPE); + } else { + dialogs.show(407); + } + } else if (action.isAction(108, 357)) { + dialogs.show(408); + } else if (action.isAction(14, 291)) { + dialogs.show(_globals[kTopButtonPushed] ? 502 : 501); + } else if ((action.isAction(25, 106, 72) || action.isAction(VERB_PUT, 106, 72)) && + _objects.isInInventory(OBJ_DETONATORS) && _objects.isInInventory(OBJ_CHARGE_CASES)) { + error("TODO: loc_29DBA"); + } else if (action.isAction(25, 106)) { + dialogs.show(470); + } + } void GameNebular::step() { -- cgit v1.2.3 From 783f9a0b6ee002512cf8c6d03c4db46bbfc92d8c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 6 Apr 2014 16:12:24 -0400 Subject: MADS: Completed doObjectScene implementation --- engines/mads/nebular/game_nebular.cpp | 126 +++++++++++++++++++++++++++++++++- 1 file changed, 125 insertions(+), 1 deletion(-) diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index bc61fa4fb4..6994e54243 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -419,8 +419,132 @@ void GameNebular::doObjectAction() { error("TODO: loc_29DBA"); } else if (action.isAction(25, 106)) { dialogs.show(470); + } else if ((action.isAction(25, 371, 43) || action.isAction(7, 371, 43) || action.isAction(25, 371, 42) + || action.isAction(VERB_PUT, 371, 42)) && _objects.isInInventory(OBJ_TIMER_MODULE) && ( + _objects.isInInventory(OBJ_BOMBS) || _objects.isInInventory(OBJ_BOMB))) { + if (_objects.isInInventory(OBJ_BOMBS)) { + _objects.setRoom(OBJ_BOMBS, PLAYER_INVENTORY); + _objects.addToInventory(OBJ_BOMB); + } else { + _objects.setRoom(OBJ_BOMB, PLAYER_INVENTORY); + } + + _objects.setRoom(OBJ_TIMER_MODULE, PLAYER_INVENTORY); + _objects.addToInventory(OBJ_TIMEBOMB); + dialogs.showPicture(OBJ_TIMEBOMB, 404); + } else if (action.isAction(140, 271)) { + dialogs.show(410); + } else if (action.isAction(119, 46)) { + _globals[kBottleStatus] = 0; + dialogs.show(432); + } else if (action.isAction(108, 136)) { + if (_objects[OBJ_FISHING_LINE]._roomNumber == 3) { + _objects.addToInventory(OBJ_FISHING_LINE); + dialogs.showPicture(OBJ_FISHING_LINE, 409); + } else { + dialogs.show(428); + } + } else if (action.isAction(108, 262)) { + switch (_globals[kPenlightCellStatus]) { + case 1: + case 2: + _objects.addToInventory(OBJ_DURAFAIL_CELLS); + dialogs.showPicture(OBJ_DURAFAIL_CELLS, 412); + break; + case 3: + _objects.addToInventory(OBJ_PHONE_CELLS); + dialogs.showPicture(OBJ_DURAFAIL_CELLS, 413); + break; + case 5: + _objects.addToInventory(OBJ_DURAFAIL_CELLS); + dialogs.showPicture(OBJ_DURAFAIL_CELLS, 411); + break; + case 6: + _objects.addToInventory(OBJ_DURAFAIL_CELLS); + dialogs.showPicture(OBJ_DURAFAIL_CELLS, 429); + break; + default: + dialogs.show(478); + break; + } + } else if (action.isAction(108, 264)) { + switch (_globals[kHandsetCellStatus]) { + case 1: + _objects.addToInventory(OBJ_DURAFAIL_CELLS); + dialogs.showPicture(OBJ_DURAFAIL_CELLS, + _difficulty != 1 || _globals[kDurafailRecharged] ? 415 : 414); + break; + case 2: + _objects.addToInventory(OBJ_DURAFAIL_CELLS); + if (_difficulty == 1) { + dialogs.showPicture(OBJ_DURAFAIL_CELLS, 416); + } else { + _globals[kHandsetCellStatus] = 0; + } + break; + case 3: + _objects.addToInventory(OBJ_PHONE_CELLS); + dialogs.showPicture(OBJ_PHONE_CELLS, 418); + break; + case 4: + _objects.addToInventory(OBJ_PHONE_CELLS); + dialogs.showPicture(OBJ_PHONE_CELLS, 417); + break; + default: + dialogs.show(478); + break; + } + } else if (action.isAction(VERB_PUT, 263, 262)) { + if (_globals[kPenlightCellStatus] == 0) { + _globals[kPenlightCellStatus] = 3; + _objects.setRoom(OBJ_PHONE_CELLS, PLAYER_INVENTORY); + dialogs.show(419); + } else { + dialogs.show(420); + } + } else if (action.isAction(VERB_PUT, 263, 264)) { + if (_globals[kHandsetCellStatus] == 0) { + _globals[kHandsetCellStatus] = 3; + _objects.setRoom(OBJ_PHONE_CELLS, PLAYER_INVENTORY); + dialogs.show(421); + } + else { + dialogs.show(422); + } + } else if (action.isAction(VERB_PUT, 115, 262)) { + if (_globals[kPenlightCellStatus]) { + dialogs.show(424); + } else { + _objects.setRoom(OBJ_DURAFAIL_CELLS, PLAYER_INVENTORY); + _globals[kPenlightCellStatus] = _difficulty != 1 || _globals[kDurafailRecharged] ? 1 : 2; + dialogs.show(423); + } + } else if (action.isAction(VERB_PUT, 115, 264)) { + if (_globals[kHandsetCellStatus]) { + dialogs.show(424); + } else { + _objects.setRoom(OBJ_DURAFAIL_CELLS, PLAYER_INVENTORY); + _globals[kDurafailRecharged] = _difficulty != 1 || _globals[kHandsetCellStatus] ? 1 : 2; + dialogs.show(425); + } + } else if (action.isAction(306, 369)) { + dialogs.show(427); + } else if (action.isAction(VERB_PUT, 42, 73) || action.isAction(VERB_PUT, 43, 73)) { + _objects.setRoom(OBJ_CHICKEN, PLAYER_INVENTORY); + if (_objects.isInInventory(OBJ_BOMBS)) { + _objects.setRoom(OBJ_BOMBS, PLAYER_INVENTORY); + _objects.addToInventory(OBJ_BOMB); + } else { + _objects.setRoom(OBJ_BOMB, PLAYER_INVENTORY); + } + + _objects.addToInventory(OBJ_CHICKEN_BOMB); + dialogs.showPicture(OBJ_CHICKEN_BOMB, 430); + } else { + return; } - + + action._inProgress = false; } void GameNebular::step() { -- cgit v1.2.3 From 29789847a86a83cff14a57b12479229ce6ba7ac9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 6 Apr 2014 16:32:18 -0400 Subject: MADS: More implementation for looking at inventory items --- engines/mads/inventory.cpp | 11 ++++++++--- engines/mads/nebular/game_nebular.cpp | 22 ++++++++++++++++++++-- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/engines/mads/inventory.cpp b/engines/mads/inventory.cpp index ec5670b090..89ca9f84c2 100644 --- a/engines/mads/inventory.cpp +++ b/engines/mads/inventory.cpp @@ -167,9 +167,14 @@ void InventoryObjects::removeFromInventory(int objectId, int newScene) { } } -int InventoryObjects::getIdFromDesc(int objectId) { - warning("TODO: InventoryObjects::getIdFromDesc()"); - return objectId; +int InventoryObjects::getIdFromDesc(int descId) { + for (int i = 0; i < (int)size(); ++i) { + InventoryObject &obj = (*this)[i]; + if (obj._descId == descId) + return i; + } + + return -1; } } // End of namespace MADS diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index 6994e54243..69c896a1f8 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -379,7 +379,7 @@ void GameNebular::doObjectAction() { ((id = _objects.getIdFromDesc(action._activeAction._objectNameId)) != 0 || (action._activeAction._indirectObjectId > 0 && (id = _objects.getIdFromDesc(action._activeAction._indirectObjectId))))) { - if (id == 21) { + if (id == OBJ_REPAIR_LIST) { dialogs._indexList[0] = _globals[kTeleporterCode + 7]; dialogs._indexList[1] = _globals[kTeleporterCode + 8]; dialogs._indexList[2] = _globals[kTeleporterCode + 6]; @@ -392,7 +392,25 @@ void GameNebular::doObjectAction() { dialogs.showPicture(id, 402); } else { - error("TODO: Implement. See loc_29B48"); + int messageId = 800 + id; + if (id == OBJ_CHARGE_CASES) { + error("TODO: object_get_folder - loc_29B48"); + messageId = 860; + } + + if (id == OBJ_TAPE_PLAYER && _objects[OBJ_AUDIO_TAPE]._roomNumber == OBJ_TAPE_PLAYER) + messageId = 867; + + if (id == 32 && _objects[OBJ_FISHING_LINE]._roomNumber == 3) + messageId = 862; + + if (id == OBJ_BOTTLE && _globals[kBottleStatus] != 0) + messageId = 862 + _globals[kBottleStatus]; + + if (id == OBJ_PHONE_HANDSET && _globals[kHandsetCellStatus]) + messageId = 861; + + dialogs.showPicture(id, messageId); } } else if (action.isAction(VERB_PUT, NOUN_BURGER, NOUN_DEAD_FISH)) { if (_objects.isInInventory(OBJ_BURGER) || _objects.isInInventory(OBJ_DEAD_FISH)) { -- cgit v1.2.3 From 166a549cd594ada54d58882732ce7d3369e67c54 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 6 Apr 2014 16:41:24 -0400 Subject: MADS: Temporarily hook showPicture method to use standard show method --- engines/mads/nebular/dialogs_nebular.h | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/mads/nebular/dialogs_nebular.h b/engines/mads/nebular/dialogs_nebular.h index 84bbaedd50..e123efd49c 100644 --- a/engines/mads/nebular/dialogs_nebular.h +++ b/engines/mads/nebular/dialogs_nebular.h @@ -51,6 +51,7 @@ public: warning("TODO: showDialog"); } virtual void showPicture(int objId, int msgId, int arg3) { + show(msgId); warning("TODO: showPicture"); } virtual bool show(int id); -- cgit v1.2.3 From 4e13e74f2774a182b82abe6aa9400c5098bac4d9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 6 Apr 2014 17:50:07 -0400 Subject: MADS: Fix to correctly wrap lines in text dialogs --- engines/mads/dialogs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/dialogs.cpp b/engines/mads/dialogs.cpp index d5e8ad5ba9..23015413b8 100644 --- a/engines/mads/dialogs.cpp +++ b/engines/mads/dialogs.cpp @@ -232,7 +232,7 @@ void TextDialog::wordWrap(const Common::String &line) { void TextDialog::appendLine(const Common::String &line) { _currentX += line.size(); - _lineWidth += _font->getWidth(line, 1); + _lineWidth += _font->getWidth(line, 1) + 1; _lines[_numLines] += line; } -- cgit v1.2.3 From bd11534499ef169700b0ddb450cc93cff434be6b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 6 Apr 2014 17:50:56 -0400 Subject: MADS: Fix incorrect look description in scene 103 --- engines/mads/nebular/nebular_scenes1.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 775f814999..f56f5d3fe8 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -289,7 +289,7 @@ void Scene103::actions() { _scene->_hotspots.activate(371, false); _vm->_game->_player._visible = true; _vm->_game->_player._stepEnabled = true; - _vm->_dialogs->showPicture(OBJ_REBREATHER, 804); + _vm->_dialogs->showPicture(OBJ_REBREATHER, 805); break; default: -- cgit v1.2.3 From 2457905ed42820d27264a4beccc9ae45da746c18 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 6 Apr 2014 21:24:35 -0400 Subject: MADS: Fixes for switching between scenes --- engines/mads/game.cpp | 5 ++++- engines/mads/player.cpp | 3 +++ engines/mads/scene.cpp | 7 ++++++- engines/mads/scene.h | 6 ++++++ engines/mads/sprites.cpp | 19 +++++++++++++++---- 5 files changed, 34 insertions(+), 6 deletions(-) diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index d964c14451..90ea105bd1 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -143,6 +143,8 @@ void Game::gameLoop() { } _player.releasePlayerSprites(); + assert(_scene._sprites.size() == 0); + _vm->_palette->unlock(); _vm->_events->waitCursor(); _vm->_events->freeCursors(); @@ -271,7 +273,8 @@ void Game::sectionLoop() { _scene._reloadSceneFlag = false; - warning("TODO: sub_1DD8C, sub_1DD7E"); + _scene._userInterface.noInventoryAnim(); + _scene.removeSprites(); if (!_player._loadedFirst) { _player._spritesLoaded = false; diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index b337f8ada0..10d8b3e327 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -675,6 +675,9 @@ void Player::releasePlayerSprites() { scene._sprites.remove(spriteEnd); } while (--spriteEnd >= _spritesStart); } + + _spritesLoaded = false; + _spritesChanged = true; } } // End of namespace MADS diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 9ef7d0b245..d297cb79ec 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -389,7 +389,7 @@ void Scene::doFrame() { _animFlag = true; _vm->_game->_fx = kTransitionNone; - if (_freeAnimationFlag) { + if (_freeAnimationFlag && _activeAnimation) { _activeAnimation->free(); _activeAnimation = nullptr; } @@ -570,6 +570,11 @@ void Scene::free() { _sceneInfo = nullptr; } +void Scene::removeSprites() { + for (int idx = _sprites.size() - 1; idx >= _spritesCount; --idx) + _sprites.remove(idx); +} + void Scene::changeVariant(int variant) { _variant = variant; _sceneInfo->loadCodes(_depthSurface, variant); diff --git a/engines/mads/scene.h b/engines/mads/scene.h index dbb218842b..b0ecf111e6 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -214,6 +214,12 @@ public: void resetScene(); void backgroundAnimation(); + + /** + * Removes all the scene specific sprites fromt the sprites list, + * leaving any player sprites list in place at the start of the list. + */ + void removeSprites(); }; } // End of namespace MADS diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp index 442125e929..0dd640bca0 100644 --- a/engines/mads/sprites.cpp +++ b/engines/mads/sprites.cpp @@ -372,14 +372,18 @@ int SpriteSets::add(SpriteAsset *asset, int idx) { if (idx >= (int)size()) resize(idx + 1); - delete (*this)[idx]; - (*this)[idx] = asset; + if ((*this)[idx]) { + delete (*this)[idx]; + } else { + ++_assetCount; + } + + (*this)[idx] = asset; return idx; } int SpriteSets::addSprites(const Common::String &resName, int flags) { - ++_assetCount; return add(new SpriteAsset(_vm, resName, flags)); } @@ -394,7 +398,14 @@ void SpriteSets::clear() { void SpriteSets::remove(int idx) { if (idx >= 0) { delete (*this)[idx]; - (*this)[idx] = nullptr; + + if (idx < ((int)size() - 1)) + (*this)[idx] = nullptr; + else { + do { + remove_at(size() - 1); + } while (size() > 0 && (*this)[size() - 1] == nullptr); + } --_assetCount; } -- cgit v1.2.3 From b435c76b2578ad0650606ba6ad59f56eeb94ee01 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 6 Apr 2014 22:05:18 -0400 Subject: MADS: Fix loading of scene sprite set names --- engines/mads/animation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index f4fee20de7..f581bf42ce 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -51,7 +51,7 @@ void AAHeader::load(Common::SeekableReadStream *f) { buffer[FILENAME_SIZE - 1] = '\0'; _interfaceFile = Common::String(buffer); - for (int i = 0; i < 10; ++i) { + for (int i = 0; i < _spriteSetsCount; ++i) { f->read(buffer, FILENAME_SIZE); buffer[FILENAME_SIZE - 1] = '\0'; _spriteSetNames.push_back(Common::String(buffer)); -- cgit v1.2.3 From 54bcb822fbd4e5d573ae5cd00ce3b813fbc7faa6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 6 Apr 2014 22:28:14 -0400 Subject: MADS: Properly free scene-specific sprite sets when leaving scene --- engines/mads/animation.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index f581bf42ce..769bd39aef 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -144,7 +144,15 @@ Animation::Animation(MADSEngine *vm, Scene *scene) : _vm(vm), _scene(scene) { } Animation::~Animation() { - delete _font; + Scene &scene = _vm->_game->_scene; + + if (_header._manualFlag) + scene._sprites.remove(_spriteListIndexes[_header._spritesIndex]); + + for (uint idx = 0; idx < _header._spriteSetsCount; ++idx) { + if (!_header._manualFlag || _header._spritesIndex != idx) + scene._sprites.remove(_spriteListIndexes[idx]); + } } void Animation::free() { -- cgit v1.2.3 From 1c50c69ba69d255e3ba9ed5a88ea0985417b9357 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 6 Apr 2014 23:53:07 -0400 Subject: MADS: Added stubbed Animation::preLoad method --- engines/mads/animation.cpp | 5 +++++ engines/mads/animation.h | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index 769bd39aef..b557a598ed 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -307,6 +307,11 @@ void Animation::load(UserInterface &interfaceSurface, MSurface &depthSurface, f.close(); } +void Animation::preLoad(const Common::String &resName, int level) { + // No implementation in ScummVM, since access is fast enough that data + // doesn't need to be preloaded +} + void Animation::startAnimation(int abortTimers) { _messageCtr = 0; _skipLoad = true; diff --git a/engines/mads/animation.h b/engines/mads/animation.h index 63f77d1fa2..8095bec5e0 100644 --- a/engines/mads/animation.h +++ b/engines/mads/animation.h @@ -172,6 +172,11 @@ public: void load(UserInterface &interfaceSurface, MSurface &depthSurface, const Common::String &resName, int flags, Common::Array *palAnimData, SceneInfo *sceneInfo); + /** + * Preload animation data for the scene + */ + void preLoad(const Common::String &resName, int level); + /** * Setups up a loaded animation for playback */ -- cgit v1.2.3 From 66b7419f30eb4fb0f9df899eea664f529cfb84fd Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 7 Apr 2014 08:29:27 -0400 Subject: MADS: Remove stubbed methods that were undeed mouse handler calls --- engines/mads/scene.cpp | 6 ++---- engines/mads/user_interface.cpp | 3 --- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index d297cb79ec..f5d1ce66f7 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -358,8 +358,7 @@ void Scene::doFrame() { _kernelMessages.update(); } - _userInterface._uiSlots.draw(_vm->_game->_fx == 0, - _vm->_game->_fx != 0); + _userInterface._uiSlots.draw(!_vm->_game->_fx, _vm->_game->_fx); // Write any text needed by the interface if (_vm->_game->_fx) @@ -395,7 +394,7 @@ void Scene::doFrame() { } } -void Scene::drawElements(ScreenTransition transitionType, bool surfaceFlag) { +void Scene::drawElements(ScreenTransition transitionType, bool surfaceFlag) { // Draw any sprites _spriteSlots.drawBackground(); @@ -433,7 +432,6 @@ void Scene::drawElements(ScreenTransition transitionType, bool surfaceFlag) { _dirtyAreas.copyToScreen(_vm->_screen._offset); } - warning("TODO: sub_115A2"); _spriteSlots.cleanUp(); _textDisplay.cleanUp(); } diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index d229c39c26..c371f3d837 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -149,7 +149,6 @@ void UISlots::draw(bool updateFlag, bool delFlag) { _vm->_screen.setPointer(&userInterface); userInterface.setBounds(Common::Rect(0, scene._interfaceY, MADS_SCREEN_WIDTH - 1, userInterface.h + scene._interfaceY - 1)); - warning("TODO: sub_111C8 / sub_1146C"); for (uint idx = 0; idx < size(); ++idx) { DirtyArea &dirtyArea = userInterface._dirtyAreas[idx]; @@ -162,8 +161,6 @@ void UISlots::draw(bool updateFlag, bool delFlag) { _vm->_screen.copyRectToScreen(r); } } - - warning("TODO: sub 115A2 / sub111D3"); } // Post-processing to remove slots no longer needed -- cgit v1.2.3 From f6a6ea974117cd8401a2caecdba9ef553821d41a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 7 Apr 2014 08:34:13 -0400 Subject: MADS: Remove stub warning for originald debugger code not to be implemented --- engines/mads/scene.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index f5d1ce66f7..b178de5839 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -379,8 +379,8 @@ void Scene::doFrame() { // Mouse position display isn't persistent, so remove it _kernelMessages.remove(mouseTextIndex); - - warning("TODO: sub_1DA3E"); + // Original had a debugger check/call here to allow pausing after + // drawing each frame. Not implemented under ScummVM } } -- cgit v1.2.3 From 7e13f488abeb6a7530d591bae880fdb185c8fef1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 7 Apr 2014 22:37:22 -0400 Subject: MADS: Implement loading logic for UI background animations --- engines/mads/animation.cpp | 72 +++++++++++++++++++++++++++----------- engines/mads/animation.h | 32 +++++++++++++++-- engines/mads/game.cpp | 1 - engines/mads/game.h | 1 - engines/mads/mads.cpp | 1 + engines/mads/mads.h | 1 + engines/mads/palette.h | 13 +++++++ engines/mads/scene.cpp | 22 ++++++------ engines/mads/scene.h | 2 -- engines/mads/scene_data.h | 5 +++ engines/mads/screen.cpp | 6 ++-- engines/mads/user_interface.cpp | 76 ++++++++++++++++++++++++++++++++++++++++- engines/mads/user_interface.h | 14 ++++++++ 13 files changed, 206 insertions(+), 40 deletions(-) diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index b557a598ed..40abdbe26b 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -108,15 +108,24 @@ void AnimMessage::load(Common::SeekableReadStream *f) { f->skip(2); } -void AnimFrameEntry::load(Common::SeekableReadStream *f) { - _frameNumber = f->readUint16LE(); - _seqIndex = f->readByte(); - _spriteSlot._spritesIndex = f->readByte(); - _spriteSlot._frameNumber = f->readUint16LE(); - _spriteSlot._position.x = f->readSint16LE(); - _spriteSlot._position.y = f->readSint16LE(); - _spriteSlot._depth = f->readSByte(); - _spriteSlot._scale = (int8)f->readByte(); +void AnimFrameEntry::load(Common::SeekableReadStream *f, bool uiFlag) { + if (uiFlag) { + f->skip(2); + _seqIndex = f->readByte(); + _spriteSlot._spritesIndex = f->readByte(); + _spriteSlot._frameNumber = f->readUint16LE(); + _spriteSlot._position.x = f->readSint16LE(); + _spriteSlot._position.y = f->readSint16LE(); + } else { + _frameNumber = f->readUint16LE(); + _seqIndex = f->readByte(); + _spriteSlot._spritesIndex = f->readByte(); + _spriteSlot._frameNumber = f->readUint16LE(); + _spriteSlot._position.x = f->readSint16LE(); + _spriteSlot._position.y = f->readSint16LE(); + _spriteSlot._depth = f->readSByte(); + _spriteSlot._scale = (int8)f->readByte(); + } } /*------------------------------------------------------------------------*/ @@ -132,6 +141,22 @@ void AnimMiscEntry::load(Common::SeekableReadStream *f) { /*------------------------------------------------------------------------*/ +void AnimUIEntry::load(Common::SeekableReadStream *f) { + _probability = f->readUint16LE(); + _imageCount = f->readUint16LE(); + _firstImage = f->readUint16LE(); + _lastImage = f->readUint16LE(); + _counter = f->readSint16LE(); + for (int i = 0; i < ANIM_SPAWN_COUNT; ++i) + _spawn[i] = f->readByte(); + for (int i = 0; i < ANIM_SPAWN_COUNT; ++i) + _spawnFrame[i] = f->readUint16LE(); + _sound = f->readUint16LE() & 0xFF; + _soundFrame = f->readUint16LE(); +} + +/*------------------------------------------------------------------------*/ + Animation *Animation::init(MADSEngine *vm, Scene *scene) { return new Animation(vm, scene); } @@ -149,7 +174,7 @@ Animation::~Animation() { if (_header._manualFlag) scene._sprites.remove(_spriteListIndexes[_header._spritesIndex]); - for (uint idx = 0; idx < _header._spriteSetsCount; ++idx) { + for (int idx = 0; idx < _header._spriteSetsCount; ++idx) { if (!_header._manualFlag || _header._spritesIndex != idx) scene._sprites.remove(_spriteListIndexes[idx]); } @@ -195,12 +220,12 @@ void Animation::load(UserInterface &interfaceSurface, MSurface &depthSurface, delete stream; if (_header._animMode == 4) - flags |= 0x4000; + flags |= PALFLAG_RESERVED; - if (flags & 0x100) { + if (flags & ANIMFLAG_LOAD_BACKGROUND) { loadInterface(interfaceSurface, depthSurface, _header, flags, palAnimData, sceneInfo); } - if (flags & 0x200) { + if (flags & ANIMFLAG_LOAD_BACKGROUND_ONLY) { // No data _header._messagesCount = 0; _header._frameEntriesCount = 0; @@ -234,7 +259,7 @@ void Animation::load(UserInterface &interfaceSurface, MSurface &depthSurface, for (int i = 0; i < _header._frameEntriesCount; i++) { AnimFrameEntry rec; - rec.load(frameStream); + rec.load(frameStream, flags & ANIMFLAG_LOAD_BACKGROUND); _frameEntries.push_back(rec); } @@ -242,14 +267,23 @@ void Animation::load(UserInterface &interfaceSurface, MSurface &depthSurface, } _miscEntries.clear(); + _uiEntries.clear(); if (_header._miscEntriesCount > 0) { // Chunk 4: Misc Data Common::SeekableReadStream *miscStream = madsPack.getItemStream(streamIndex++); - for (int i = 0; i < _header._miscEntriesCount; ++i) { - AnimMiscEntry rec; - rec.load(miscStream); - _miscEntries.push_back(rec); + if (flags & ANIMFLAG_LOAD_BACKGROUND) { + for (int i = 0; i < _header._miscEntriesCount; ++i) { + AnimUIEntry rec; + rec.load(miscStream); + _uiEntries.push_back(rec); + } + } else { + for (int i = 0; i < _header._miscEntriesCount; ++i) { + AnimMiscEntry rec; + rec.load(miscStream); + _miscEntries.push_back(rec); + } } delete miscStream; @@ -257,7 +291,7 @@ void Animation::load(UserInterface &interfaceSurface, MSurface &depthSurface, // If the animation specifies a font, then load it for access delete _font; - if (_header._flags & ANIM_CUSTOM_FONT) { + if (_header._flags & ANIMFLAG_CUSTOM_FONT) { Common::String fontName = "*" + _header._fontResource; _font = _vm->_font->getFont(fontName.c_str()); } else { diff --git a/engines/mads/animation.h b/engines/mads/animation.h index 8095bec5e0..75f14a52b3 100644 --- a/engines/mads/animation.h +++ b/engines/mads/animation.h @@ -33,7 +33,12 @@ namespace MADS { -enum AnimFlag { ANIM_CUSTOM_FONT = 0x20 }; +enum AnimFlag { + ANIMFLAG_DITHER = 0x0001, // Dither to 16 colors + ANIMFLAG_CUSTOM_FONT = 0x0020, // Load ccustom font + ANIMFLAG_LOAD_BACKGROUND = 0x0100, // Load background + ANIMFLAG_LOAD_BACKGROUND_ONLY = 0x0200 // Load background only +}; class MADSEngine; class Scene; @@ -63,7 +68,7 @@ public: /** * Loads data for the record */ - void load(Common::SeekableReadStream *f); + void load(Common::SeekableReadStream *f, bool uiFlag); }; class AnimMiscEntry { @@ -80,6 +85,26 @@ public: void load(Common::SeekableReadStream *f); }; +#define ANIM_SPAWN_COUNT 2 + +class AnimUIEntry { +public: + int _probability; + int _imageCount; + int _firstImage; + int _lastImage; + int _counter; + int _spawn[ANIM_SPAWN_COUNT]; + int _spawnFrame[ANIM_SPAWN_COUNT]; + int _sound; + int _soundFrame; + + /** + * Loads the data for the record + */ + void load(Common::SeekableReadStream *f); +}; + class AAHeader { public: int _spriteSetsCount; @@ -115,7 +140,6 @@ private: Common::Array _spriteListIndexes; Common::Array _messages; - Common::Array _frameEntries; Common::Array _miscEntries; Common::Array _spriteSets; Font *_font; @@ -153,6 +177,8 @@ private: protected: Animation(MADSEngine *vm, Scene *scene); public: + Common::Array _frameEntries; + Common::Array _uiEntries; bool _resetFlag; static Animation *init(MADSEngine *vm, Scene *scene); diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 90ea105bd1..fd0294161d 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -52,7 +52,6 @@ Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm), _priorSectionNumber = 0; _currentSectionNumber = -1; _kernelMode = KERNEL_GAME_LOAD; - _v2 = 0; _quoteEmergency = false; _vocabEmergency = false; _aaName = "*I0.AA"; diff --git a/engines/mads/game.h b/engines/mads/game.h index f41e7d248c..e4880091cc 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -131,7 +131,6 @@ public: VisitedScenes _visitedScenes; Scene _scene; KernelMode _kernelMode; - int _v2; int _trigger; ScreenTransition _fx; TriggerMode _triggerMode; diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index 68d8579dc4..229d3fcef8 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -43,6 +43,7 @@ MADSEngine::MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc) : _textWindowStill = false; _screenFade = SCREEN_FADE_SMOOTH; _musicFlag = false; + _dithering = false; _debugger = nullptr; _dialogs = nullptr; diff --git a/engines/mads/mads.h b/engines/mads/mads.h index cf8046f8f6..4ea0758f88 100644 --- a/engines/mads/mads.h +++ b/engines/mads/mads.h @@ -104,6 +104,7 @@ public: bool _textWindowStill; ScreenFade _screenFade; bool _musicFlag; + bool _dithering; public: MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc); virtual ~MADSEngine(); diff --git a/engines/mads/palette.h b/engines/mads/palette.h index dd5eaf6c2b..cceef09417 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -32,6 +32,19 @@ class MADSEngine; #define PALETTE_USAGE_COUNT 4 +/** + * Palette mapping options + */ +enum { + PALFLAG_BACKGROUND = 0x8000, // Loading initial background + PALFLAG_RESERVED = 0x4000, // Enable mapping reserved colors + PALFLAG_ANY_TO_CLOSEST = 0x2000, // Any color can map to closest + PALFLAG_ALL_TO_CLOSEST = 0x1000, // Any colors that can map must map + PALFLAG_TOP_COLORS = 0x0800, // Allow mapping to high four colors + PALFLAG_DEFINE_RESERVED = 0x0400, // Define initial reserved color + PALFLAG_MASK = 0xfc00 // Mask for all the palette flags +}; + struct RGB4 { byte r; byte g; diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index b178de5839..ac57e0bcbf 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -123,8 +123,12 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) { _kernelMessages.clear(); // TODO: palletteUsage reset? setPalette(_nullPalette); + int flags = SCENEFLAG_LOAD_SHADOW; + if (_vm->_dithering) + flags |= SCENEFLAG_DITHER; + _sceneInfo = SceneInfo::init(_vm); - _sceneInfo->load(_currentSceneId, _variant, Common::String(), _vm->_game->_v2 ? 17 : 16, + _sceneInfo->load(_currentSceneId, _variant, Common::String(), flags, _depthSurface, _backgroundSurface); // Initialise palette animation for the scene @@ -143,10 +147,12 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) { _vm->_palette->_paletteUsage.load(1, 0xF); // Load interface - int flags = _vm->_game->_v2 ? 0x4101 : 0x4100; - if (!_vm->_textWindowStill) - flags |= 0x200; - + flags = PALFLAG_RESERVED | ANIMFLAG_LOAD_BACKGROUND; + if (_vm->_dithering) + flags |= ANIMFLAG_DITHER; + if (_vm->_textWindowStill) + flags |= ANIMFLAG_LOAD_BACKGROUND_ONLY; + _animationData = Animation::init(_vm, this); MSurface depthSurface; _animationData->load(_userInterface, depthSurface, prefix, flags, nullptr, nullptr); @@ -513,7 +519,7 @@ void Scene::loadAnimation(const Common::String &resName, int abortTimers) { _activeAnimation = Animation::init(_vm, this); _activeAnimation->load(interfaceSurface, depthSurface, resName, - _vm->_game->_v2 ? 1 : 0, nullptr, nullptr); + _vm->_dithering ? ANIMFLAG_DITHER : 0, nullptr, nullptr); _activeAnimation->startAnimation(abortTimers); } @@ -585,8 +591,4 @@ void Scene::resetScene() { _sequences.clear(); } -void Scene::backgroundAnimation() { - warning("TODO: Scene::backgroundAnimation"); -} - } // End of namespace MADS diff --git a/engines/mads/scene.h b/engines/mads/scene.h index b0ecf111e6..f449ededfc 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -213,8 +213,6 @@ public: void resetScene(); - void backgroundAnimation(); - /** * Removes all the scene specific sprites fromt the sprites list, * leaving any player sprites list in place at the start of the list. diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index 2a6032a507..73ca21d092 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -52,6 +52,11 @@ class SpriteSlot; #define TEXT_DISPLAY_MAX_SIZE 40 #define DIRTY_AREAS_SIZE (SPRITE_SLOTS_MAX_SIZE + TEXT_DISPLAY_MAX_SIZE) +enum { + SCENEFLAG_DITHER = 0x01, // Dither to 16 colors + SCENEFLAG_LOAD_SHADOW = 0x10 // Load hard shadows +}; + class VerbInit { public: int _id; diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index 25623bc215..683a56705a 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -354,10 +354,10 @@ void ScreenObjects::check(bool scanFlag) { slot._flags = IMG_ERASE; } - // Any background animation - scene.backgroundAnimation(); + // Any background animation in the user interface + userInterface.doBackgroundAnimation(); - // Handle animating the selected inventory animation + // Handle animating the selected inventory item userInterface.inventoryAnim(); // Set the base time diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index c371f3d837..d7f198f3ce 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -48,7 +48,7 @@ void UISlots::add(const Common::Point &pt, int frameNumber, int spritesIndex) { assert(size() < 50); UISlot ie; - ie._flags = -3; + ie._flags = IMG_OVERPRINT; ie._segmentId = IMG_TEXT_UPDATE; ie._position = pt; ie._frameNumber = frameNumber; @@ -57,6 +57,20 @@ void UISlots::add(const Common::Point &pt, int frameNumber, int spritesIndex) { push_back(ie); } +void UISlots::add(const AnimFrameEntry &frameEntry) { + assert(size() < 50); + + UISlot ie; + ie._flags = IMG_UPDATE; + ie._segmentId = frameEntry._seqIndex; + ie._spritesIndex = frameEntry._spriteSlot._spritesIndex; + ie._frameNumber = frameEntry._frameNumber; + ie._position = frameEntry._spriteSlot._position; + + push_back(ie); +} + + void UISlots::draw(bool updateFlag, bool delFlag) { Scene &scene = _vm->_game->_scene; UserInterface &userInterface = scene._userInterface; @@ -633,6 +647,66 @@ void UserInterface::inventoryAnim() { _uiSlots.push_back(slot); } +void UserInterface::doBackgroundAnimation() { + Scene &scene = _vm->_game->_scene; + Common::Array &uiEntries = scene._animationData->_uiEntries; + Common::Array &frameEntries = scene._animationData->_frameEntries; + + _noSegmentsActive = !_someSegmentsActive; + _someSegmentsActive = false; + + for (int idx = 0; idx < uiEntries.size(); ++idx) { + AnimUIEntry &uiEntry = uiEntries[idx]; + + if (uiEntry._counter < 0) { + if (uiEntry._counter == -1) { + int probabilityRandom = _vm->getRandomNumber(1, 30000); + int probability = uiEntry._probability; + if (uiEntry._probability > 30000) { + if (_noSegmentsActive) { + probability -= 30000; + } else { + probability = -1; + } + } + if (probabilityRandom <= probability) { + uiEntry._counter = uiEntry._firstImage; + _someSegmentsActive = true; + } + } else { + uiEntry._counter = uiEntry._firstImage; + _someSegmentsActive = true; + } + } else { + for (int idx2 = 0; idx2 < ANIM_SPAWN_COUNT; idx2++) { + if (uiEntry._spawnFrame[idx2] == (uiEntry._counter - uiEntry._firstImage)) { + int tempIndex = uiEntry._spawn[idx2]; + if (idx >= tempIndex) { + uiEntries[tempIndex]._counter = uiEntries[tempIndex]._firstImage; + } else { + uiEntries[tempIndex]._counter = -2; + } + _someSegmentsActive = true; + } + } + + ++uiEntry._counter; + if (uiEntry._counter > uiEntry._lastImage) { + uiEntry._counter = -1; + } else { + _someSegmentsActive = true; + } + } + } + + for (int idx = 0; idx < uiEntries.size(); ++idx) { + int imgScan = uiEntries[idx]._counter; + if (imgScan >= 0) { + _uiSlots.add(frameEntries[imgScan]); + } + } +} + void UserInterface::categoryChanged() { _highlightedItemIndex = -1; _vm->_events->initVars(); diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h index 445cd1e487..86b5622a03 100644 --- a/engines/mads/user_interface.h +++ b/engines/mads/user_interface.h @@ -33,6 +33,8 @@ namespace MADS { enum { IMG_SPINNING_OBJECT = 200, IMG_TEXT_UPDATE = 201 }; +class AnimFrameEntry; + class UISlot { public: int _flags; @@ -61,6 +63,11 @@ public: */ void add(const Common::Point &pt, int frameNumber, int spritesIndex); + /** + * Loads the data from an aimation frame entry + */ + void add(const AnimFrameEntry &frameEntry); + /** * Adds a special entry for full refresh of the user interface */ @@ -83,6 +90,8 @@ private: int _invFrameNumber; uint32 _scrollMilli; bool _scrollFlag; + int _noSegmentsActive; + int _someSegmentsActive; /** * Loads the elements of the user interface @@ -182,6 +191,11 @@ public: */ void noInventoryAnim(); + /** + * Handles any animation that occurs in the background of the user interface + */ + void doBackgroundAnimation(); + /** * Handles queuing a new frame of an inventory animation for drawing */ -- cgit v1.2.3 From f6cfd1d53b3ac47744c8393c49ecf51a99633fc4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 7 Apr 2014 23:48:43 -0400 Subject: MADS: Implement missing dirty rect merged area pointer --- engines/mads/screen.cpp | 2 ++ engines/mads/screen.h | 1 + engines/mads/user_interface.cpp | 14 ++++++++------ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index 683a56705a..78980fe2a7 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -34,6 +34,7 @@ MADSEngine *DirtyArea::_vm = nullptr; DirtyArea::DirtyArea() { _active = false; _textActive = false; + _mergedArea = nullptr; } void DirtyArea::setArea(int width, int height, int maxWidth, int maxHeight) { @@ -206,6 +207,7 @@ void DirtyAreas::mergeAreas(int idx1, int idx2) { da1._bounds2.bottom = da1._bounds.top + (da1._bounds.height() + 1) / 2 - 1; da2._active = false; + da2._mergedArea = &da1; da1._textActive = true; } diff --git a/engines/mads/screen.h b/engines/mads/screen.h index ed3de80576..57b53df895 100644 --- a/engines/mads/screen.h +++ b/engines/mads/screen.h @@ -74,6 +74,7 @@ public: Common::Rect _bounds2; bool _textActive; bool _active; + DirtyArea *_mergedArea; DirtyArea(); diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index d7f198f3ce..f51372e0dd 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -134,15 +134,17 @@ void UISlots::draw(bool updateFlag, bool delFlag) { userInterface._dirtyAreas.merge(1, userInterface._uiSlots.size()); for (uint idx = 0; idx < size(); ++idx) { - DirtyArea &dirtyArea = userInterface._dirtyAreas[idx]; + DirtyArea *dirtyArea = &userInterface._dirtyAreas[idx]; UISlot &slot = (*this)[idx]; if (slot._flags >= IMG_STATIC && !(slot._flags & 0x40)) { - if (!dirtyArea._active) { - error("Should never reach this point, even in original"); + if (!dirtyArea->_active) { + do { + dirtyArea = dirtyArea->_mergedArea; + } while (!dirtyArea->_active); } - if (dirtyArea._textActive) { + if (dirtyArea->_textActive) { SpriteAsset *asset = scene._sprites[slot._spritesIndex]; if (slot._segmentId == IMG_SPINNING_OBJECT) { @@ -655,7 +657,7 @@ void UserInterface::doBackgroundAnimation() { _noSegmentsActive = !_someSegmentsActive; _someSegmentsActive = false; - for (int idx = 0; idx < uiEntries.size(); ++idx) { + for (int idx = 0; idx < (int)uiEntries.size(); ++idx) { AnimUIEntry &uiEntry = uiEntries[idx]; if (uiEntry._counter < 0) { @@ -699,7 +701,7 @@ void UserInterface::doBackgroundAnimation() { } } - for (int idx = 0; idx < uiEntries.size(); ++idx) { + for (uint idx = 0; idx < uiEntries.size(); ++idx) { int imgScan = uiEntries[idx]._counter; if (imgScan >= 0) { _uiSlots.add(frameEntries[imgScan]); -- cgit v1.2.3 From 0f476c31ef6edccc218286997a221bcf2e94a990 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 8 Apr 2014 10:26:43 +0200 Subject: MADS: Implement scene 210, some cleanup of some other 2xx scenes, add some stubs --- engines/mads/game.h | 1 + engines/mads/nebular/nebular_scenes2.cpp | 1148 ++++++++++++++++++++++++++++-- engines/mads/nebular/nebular_scenes2.h | 34 + engines/mads/rails.h | 1 + engines/mads/user_interface.cpp | 4 + engines/mads/user_interface.h | 2 + 6 files changed, 1147 insertions(+), 43 deletions(-) diff --git a/engines/mads/game.h b/engines/mads/game.h index e4880091cc..3216da360e 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -148,6 +148,7 @@ public: uint32 getQuotesSize() { return _quotes.size(); } const Common::String &getQuote(uint32 index) { return _quotes[index - 1]; } + void splitQuote(Common::String quote, Common::String part1, Common::String part2) {warning("TODO: splitQuote()");} Common::StringArray getMessage(uint32 id); /** diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 9e4edc0bca..97c658120f 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -280,8 +280,7 @@ void Scene201::step() { } void Scene201::actions() { - MADSAction *action = _game._player._action; - if (action->_lookFlag == false) { + if (_action._lookFlag == false) { if (_action.isAction(0x18C, 0x83)) _scene->_nextSceneId = 202; else if ((_action.isAction(0x50, 0x156)) || (_action.isAction(0x188, 0x16C)) || (_action.isAction(0x188, 0x1B6))) { @@ -323,7 +322,7 @@ void Scene201::actions() { } else { _vm->_dialogs->show(0x4E8F); } - action->_inProgress = false; + _action._inProgress = false; } /*------------------------------------------------------------------------*/ @@ -491,10 +490,9 @@ void Scene202::step() { _scene->_kernelMessages.setQuoted(msgIndex, 4, true); if (_globals[kMeteorologistWatch] == 1) { - MADSAction *action = _game._player._action; - action->_activeAction._verbId = VERB_LOOK; - action->_activeAction._objectNameId = 39; - action->_activeAction._indirectObjectId = 438; + _action._activeAction._verbId = VERB_LOOK; + _action._activeAction._objectNameId = 39; + _action._activeAction._indirectObjectId = 438; _game._triggerSetupMode = KERNEL_TRIGGER_PARSER; _scene->_sequences.addTimer(120, 2); _globals._abortVal = -1; @@ -708,7 +706,6 @@ int Scene202::subStep4(int randVal) { void Scene202::preActions() { Player &player = _vm->_game->_player; - MADSAction *action = player._action; if (player._readyToWalk) _scene->_kernelMessages.reset(); @@ -732,7 +729,7 @@ void Scene202::preActions() { } } - if (_action.isAction(VERB_LOOK, 0x27) && (action->_activeAction._indirectObjectId > 0)) { + if (_action.isAction(VERB_LOOK, 0x27) && (_action._activeAction._indirectObjectId > 0)) { if (!player._readyToWalk || _ladderTopFl) _game._player._needToWalk = false; else @@ -744,10 +741,9 @@ void Scene202::preActions() { } void Scene202::actions() { - MADSAction *action = _game._player._action; - if (action->_lookFlag == false) { + if (_action._lookFlag == false) { if (_action.isAction(0x4E, 0xC7)) { - action->_inProgress = false; + _action._inProgress = false; return; } else if (_action.isAction(0x18C, 0x83)) { _scene->_nextSceneId = 203; @@ -760,8 +756,9 @@ void Scene202::actions() { } _scene->_nextSceneId = 201; } else if (_action.isAction(VERB_TAKE, 0x2C)) { - if (action->_mainObjectSource == 4) { - if (_game._trigger == 0) { + if (_action._mainObjectSource == 4) { + switch (_game._trigger) { + case 0: if (_game._objects.isInInventory(OBJ_BONES)) { _vm->_dialogs->show(0x4EFB); } else { @@ -772,15 +769,17 @@ void Scene202::actions() { _scene->_sequences.addSubEntry(_globals._spriteIndexes[22], SM_FRAME_INDEX, 6, 1); _scene->_sequences.addSubEntry(_globals._spriteIndexes[22], SM_0, 0, 2); } - } else if (_game._trigger == 1) { - if ((_game._player._playerPos.x == 132) && (_game._player._playerPos.y == 97)) { + break; + case 1: + if (_game._player._playerPos == Common::Point(132,97)) { _scene->_sequences.remove(_globals._spriteIndexes[16]); _globals[kBone202Status] |= 1; } else { _scene->_sequences.remove(_globals._spriteIndexes[21]); _globals[kBone202Status] |= 2; } - } else if (_game._trigger == 2) { + break; + case 2: if (_game._objects.isInInventory(OBJ_BONE)) { _game._objects.removeFromInventory(OBJ_BONE, 1); _game._objects.addToInventory(OBJ_BONES); @@ -792,13 +791,15 @@ void Scene202::actions() { _scene->changeVariant(_globals[kBone202Status]); _game._player._stepEnabled = true; _game._player._visible = true; - } else { - action->_inProgress = false; + break; + default: + _action._inProgress = false; return; } } } else if ((_action.isAction(0x50, 0xC7)) && (_globals[kLadderBroken] == 0)) { - if (_game._trigger == 0) { + switch (_game._trigger) { + case 0: _vm->_sound->command(29); _meteoClock1 = _scene->_frameStartTime; _game._player._visible = false; @@ -809,7 +810,8 @@ void Scene202::actions() { _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 6, 1, 0, 0); _scene->_sequences.setDepth(_globals._spriteIndexes[23], 1); _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 1); - } else if (_game._trigger == 1) { + break; + case 1: { _globals._spriteIndexes[24] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, 1); _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(247, 82)); _scene->_sequences.setDepth(_globals._spriteIndexes[24], 1); @@ -818,13 +820,16 @@ void Scene202::actions() { _game._player._stepEnabled = true; int msgIndex = _scene->_kernelMessages.add(Common::Point(248, 15), 0x1110, 32, 0, 60, _game.getQuote(97)); _scene->_kernelMessages.setQuoted(msgIndex, 4, true); - } else { - action->_inProgress = false; + } + break; + default: + _action._inProgress = false; return; } } else if (((_action.isAction(VERB_LOOK, 0x27, 0x82)) || (_action.isAction(VERB_LOOK, 0x27, 0x1B6))) && (_globals[kSexOfRex] == SEX_MALE)) { if (!_ladderTopFl) { - if (_game._trigger == 0) { + switch (_game._trigger) { + case 0: _game._player._stepEnabled = false; _game._player._visible= false; _globals._spriteIndexes[25] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 6, 1, 0, 0); @@ -833,7 +838,8 @@ void Scene202::actions() { _scene->_sequences.setDepth(_globals._spriteIndexes[25], 1); _scene->_sequences.updateTimeout(-1, _globals._spriteIndexes[25]); _scene->_sequences.addSubEntry(_globals._spriteIndexes[25], SM_0, 0, 1); - } else if (_game._trigger == 1) { + break; + case 1: _globals._spriteIndexes[25] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 6); _scene->_sequences.setDepth(_globals._spriteIndexes[25], 1); _scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(172, 123)); @@ -843,7 +849,8 @@ void Scene202::actions() { } else { _scene->_sequences.addTimer(120, 2); } - } else if (_game._trigger == 2) { + break; + case 2: if (!_scene->_activeAnimation && (_globals._abortVal == 0)) { _vm->_dialogs->show(0x4EFE); } @@ -853,16 +860,19 @@ void Scene202::actions() { _scene->_sequences.setAnimRange(_globals._spriteIndexes[25], 1, 6); _scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(172, 123)); _scene->_sequences.addSubEntry(_globals._spriteIndexes[25], SM_0, 0, 3); - } else if (_game._trigger == 3) { + break; + case 3: _scene->_sequences.updateTimeout(-1, _globals._spriteIndexes[25]); _game._player._stepEnabled = true; _game._player._visible = true; - } else { - action->_inProgress = false; + break; + default: + _action._inProgress = false; return; } } else { - if (_game._trigger == 0) { + switch (_game._trigger) { + case 0: _toTeleportFl = true; _game._player._stepEnabled = false; _scene->_sequences.remove(_globals._spriteIndexes[24]); @@ -870,7 +880,8 @@ void Scene202::actions() { _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(247, 82)); _scene->_sequences.setDepth(_globals._spriteIndexes[24], 1); _scene->_sequences.addSubEntry(_globals._spriteIndexes[24], SM_0, 0, 1); - } else if (_game._trigger == 1) { + break; + case 1: _globals._spriteIndexes[25] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, -2); _scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(247, 82)); _scene->_sequences.setDepth(_globals._spriteIndexes[25], 1); @@ -885,14 +896,15 @@ void Scene202::actions() { int msgIndex = _scene->_kernelMessages.add(Common::Point(248, 15), 0x1110, 32, 0, 60, _game.getQuote(100)); _scene->_kernelMessages.setQuoted(msgIndex, 4, false); } else { - action->_inProgress = false; + _action._inProgress = false; return; } } } else { _scene->_sequences.addTimer(120, 2); } - } else if (_game._trigger == 2) { + break; + case 2: if (!_scene->_activeAnimation) _vm->_dialogs->show(0x4EFE); _globals._abortVal = 0; @@ -901,13 +913,15 @@ void Scene202::actions() { _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(247, 82)); _scene->_sequences.setDepth(_globals._spriteIndexes[24], 1); _scene->_sequences.addSubEntry(_globals._spriteIndexes[24], SM_0, 0, 3); - } else if (_game._trigger == 3) { + break; + case 3: _globals._spriteIndexes[24] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, 1); _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(247, 82)); _scene->_sequences.setDepth(_globals._spriteIndexes[24], 1); _game._player._stepEnabled = true; - } else { - action->_inProgress = false; + break; + default: + _action._inProgress = false; return; } } @@ -925,7 +939,7 @@ void Scene202::actions() { } else if (_globals[kMeteorologistStatus] == 1) { _vm->_dialogs->show(0x4EFC); } else { - action->_inProgress = false; + _action._inProgress = false; return; } } else if (_action.isAction(VERB_LOOK, 0x18E)) { @@ -952,7 +966,7 @@ void Scene202::actions() { } else if (_action.isAction(VERB_TAKE, 0x140)) { _vm->_dialogs->show(0x4EF8); } else if (_action.isAction(VERB_LOOK, 0x2D)) { - if (action->_commandSource == 4) + if (_action._commandSource == 4) _vm->_dialogs->show(0x4EF9); else return; @@ -962,7 +976,7 @@ void Scene202::actions() { } else { _vm->_dialogs->show(0x4EFB); } - action->_inProgress = false; + _action._inProgress = false; } /*****************************************************************************/ @@ -1127,10 +1141,10 @@ void Scene205::enter() { _globals._frameTime &= 0xFFFF; _game.loadQuoteSet(0x6B, 0x70, 0x71, 0x72, 0x5A, 0x74, 0x75, 0x76, 0x77, 0x78, 0x73, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, 0x80, 0xAC, 0xAD, 0xAE, 0x6C, 0x6D, 0x6E, 0x6F, 0x2, 0); - warning("TODO: sub71A50(_globals._v4, 0x5A, 0x78, 0x74, 0x75, 0x76, 0x77, 0);"); + warning("TODO: sub71A50(&dialog1, 0x5A, 0x78, 0x74, 0x75, 0x76, 0x77, 0);"); if (!_game._visitedScenes._sceneRevisited) - warning("TODO: sub71B18(_globals._v4, 0x5A, 0x74, 0x75, 0x77, 0);"); + warning("TODO: sub71B18(&dialog1, 0x5A, 0x74, 0x75, 0x77, 0);"); _vm->_palette->setEntry(250, 63, 50, 20); @@ -2310,7 +2324,7 @@ void Scene209::handleMonkeyFall() { _scene->_sequences.remove(_globals._spriteIndexes[18]); _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._spriteIndexes[23], 1, 35); - _scene->_sequences.setDepth (_globals._spriteIndexes[23], 6); + _scene->_sequences.setDepth(_globals._spriteIndexes[23], 6); _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 220); } @@ -2325,7 +2339,7 @@ void Scene209::handleMonkeyFall() { _scene->_sequences.remove(_globals._spriteIndexes[18]); _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._spriteIndexes[23], 36, 42); - _scene->_sequences.setDepth (_globals._spriteIndexes[23], 6); + _scene->_sequences.setDepth(_globals._spriteIndexes[23], 6); _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 221); } @@ -3269,5 +3283,1053 @@ void Scene209::actions() { } } +/*****************************************************************************/ + +void Scene210::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(0x70); + _scene->addActiveVocab(0x18B); +} + +void Scene210::handleDialogs() { + if (_game._trigger == 0) { + _scene->_kernelMessages.reset(); + _game._player._stepEnabled = false; + Common::String curQuote = _game.getQuote(_action._activeAction._verbId); + if (_vm->_font->getWidth(curQuote, _scene->_textSpacing) > 200) { + Common::String subQuote1; + _game.splitQuote(curQuote, subQuote1, _subQuote2); + _scene->_kernelMessages.add(Common::Point(0, -14), 0x1110, 34, 0, 240, subQuote1); + _scene->_sequences.addTimer(60, 50); + } else { + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 1, 12, curQuote); + } + } else if (_game._trigger == 50) { + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 240, _subQuote2); + _scene->_sequences.addTimer(180, 1); + } else { + if (_game._trigger == 1) + _scene->_kernelMessages.reset(); + + switch (_curDialogNode) { + case 1: + handleSubDialog1(); + break; + + case 2: + handleSubDialog2(); + break; + + case 3: + handleSubDialog3(); + break; + + case 5: + handleSubDialog5(); + break; + + case 6: + handleSubDialog6(); + break; + + case 7: + handleSubDialog7(); + break; + + case 8: + handleSubDialog8(); + break; + } + } +} + +void Scene210::handleSubDialog1() { + switch (_action._activeAction._verbId) { + case 180: + setDialogNode(2); + break; + + case 181: + setDialogNode(6); + break; + + case 182: + setDialogNode(4); + break; + + case 183: + setDialogNode(9); + break; + + case 184: + setDialogNode(0); + break; + } +} + +void Scene210::handleSubDialog2() { + switch (_action._activeAction._verbId) { + case 187: + setDialogNode(3); + break; + + case 188: + setDialogNode(4); + break; + + case 189: + setDialogNode(0); + break; + } +} + +void Scene210::handleSubDialog3() { + switch (_action._activeAction._verbId) { + case 193: + setDialogNode(6); + break; + + case 194: + setDialogNode(5); + break; + + case 195: + setDialogNode(4); + break; + + case 196: + setDialogNode(0); + break; + } +} + +void Scene210::handleSubDialog5() { + switch (_action._activeAction._verbId) { + case 204: + setDialogNode(6); + break; + + case 205: + case 206: + setDialogNode(4); + break; + + case 207: + setDialogNode(0); + break; + } +} + +void Scene210::handleSubDialog6() { + switch (_action._activeAction._verbId) { + case 211: + setDialogNode(7); + break; + + case 212: + setDialogNode(4); + break; + + case 213: + setDialogNode(0); + break; + } +} + +void Scene210::handleSubDialog7() { + switch (_action._activeAction._verbId) { + case 216: + case 217: + case 219: + setDialogNode(4); + break; + + case 218: + setDialogNode(8); + break; + + case 220: + setDialogNode(0); + break; + } +} + +void Scene210::handleSubDialog8() { + switch (_action._activeAction._verbId) { + case 223: + case 224: + setDialogNode(4); + break; + + case 225: + case 226: + setDialogNode(9); + break; + + case 227: + setDialogNode(0); + break; + } +} + +void Scene210::setDialogNode(int node) { + switch (node) { + case 0: + _scene->_userInterface.setup(kInputBuildingSentences); + _shouldFaceRex = false; + _shouldTalk = false; + _game._player._stepEnabled = true; + _curDialogNode = 0; + break; + + case 2: + switch (_game._trigger) { + case 1: + _nextHandsPlace = 1; + _shouldTalk = true; + _game._player._stepEnabled = false; + if (_twinklesTalking) { + handleTwinklesSpeech(0xB9, -1, 0); + _scene->_sequences.addTimer(180, 2); + } else { + _scene->_sequences.addTimer(6, 1); + } + break; + + case 2: + _nextHandsPlace = 0; + handleTwinklesSpeech(186, 0, 0); + _scene->_sequences.addTimer(180, 3); + break; + + default: + _nextHandsPlace = 0; + _shouldTalk = false; + _game._player._stepEnabled = true; + initNode(2); + break; + } + break; + + case 3: + switch (_game._trigger) { + case 1: + _nextHandsPlace = 0; + _shouldTalk = true; + _game._player._stepEnabled = false; + if (_twinklesTalking) { + handleTwinklesSpeech(0xBE, -2, 0); + _scene->_sequences.addTimer(180, 2); + } else { + _scene->_sequences.addTimer(6, 1); + } + break; + case 2: + _nextHandsPlace = 2; + handleTwinklesSpeech(191, -1, 0); + _scene->_sequences.addTimer(180, 3); + break; + case 3: + _nextHandsPlace = 0; + handleTwinklesSpeech(192, 0, 0); + _scene->_sequences.addTimer(180, 4); + break; + default: + _shouldTalk = false; + _game._player._stepEnabled = true; + initNode(3); + break; + } + break; + + case 4: + if (_game._trigger == 1) { + _nextHandsPlace = 1; + _shouldTalk = true; + _game._player._stepEnabled = false; + + int quote; + if (_game._storyMode == STORYMODE_NAUGHTY) + quote = _vm->getRandomNumber(199, 201); + else + quote = _vm->getRandomNumber(197, 198); + + if (_twinklesTalking) { + handleTwinklesSpeech(quote, 0, 360); + _scene->_sequences.addTimer(120, 2); + } else { + _scene->_sequences.addTimer(6, 1); + } + } else { + _scene->_userInterface.setup(kInputBuildingSentences); + _shouldFaceRex = false; + _shouldTalk = false; + _game._player._stepEnabled = true; + } + break; + + case 5: + switch (_game._trigger) { + case 1: + _nextHandsPlace = 2; + _shouldTalk = true; + _game._player._stepEnabled = false; + if (_twinklesTalking) { + handleTwinklesSpeech(0xCA, -1, 0); + _scene->_sequences.addTimer(180, 2); + } else { + _scene->_sequences.addTimer(6, 1); + } + break; + + case 2: + _nextHandsPlace = 1; + handleTwinklesSpeech(0xCB, 0, 0); + _scene->_sequences.addTimer(180, 3); + break; + + default: + _nextHandsPlace = 2; + _shouldTalk = false; + _game._player._stepEnabled = true; + initNode(5); + break; + } + break; + + case 6: + switch (_game._trigger) { + case 1: + _nextHandsPlace = 1; + _shouldTalk = true; + _game._player._stepEnabled = false; + if (_twinklesTalking) { + handleTwinklesSpeech(0xD0, -2, 0); + _scene->_sequences.addTimer(180, 2); + } else { + _scene->_sequences.addTimer(6, 1); + } + break; + + case 2: + handleTwinklesSpeech(0xD1, -1, 0); + _scene->_sequences.addTimer(180, 3); + break; + + case 3: + _nextHandsPlace = 1; + handleTwinklesSpeech(0xD2, 0, 0); + _scene->_sequences.addTimer(180, 4); + break; + + default: + _nextHandsPlace = 0; + _shouldTalk = false; + _game._player._stepEnabled = true; + initNode(6); + break; + } + break; + + case 7: + switch (_game._trigger) { + case 1: + _nextHandsPlace = 2; + _shouldTalk = true; + _game._player._stepEnabled = false; + if (_twinklesTalking) { + handleTwinklesSpeech(0xD6, -1, 0); + _scene->_sequences.addTimer(180, 2); + } else { + _scene->_sequences.addTimer(6, 1); + } + break; + + case 2: + handleTwinklesSpeech(0xD7, 0, 0); + _scene->_sequences.addTimer(180, 3); + break; + + default: + _shouldTalk = false; + _game._player._stepEnabled = true; + initNode(7); + break; + } + break; + + case 8: + switch (_game._trigger) { + case 1: + _nextHandsPlace = 2; + _shouldTalk = true; + _game._player._stepEnabled = false; + if (_twinklesTalking) { + handleTwinklesSpeech(0xDD, -1, 0); + _scene->_sequences.addTimer(180, 2); + } else { + _scene->_sequences.addTimer(6, 1); + } + break; + + case 2: + handleTwinklesSpeech(0xDE, 0, 0); + _scene->_sequences.addTimer(180, 3); + break; + + default: + _shouldTalk = false; + _game._player._stepEnabled = true; + initNode(8); + break; + } + break; + + + case 9: + switch (_game._trigger) { + case 1: + _nextHandsPlace = 0; + _shouldTalk = true; + _game._player._stepEnabled = false; + if (_twinklesTalking) { + _scene->_userInterface.emptyTalkList(); + _scene->_userInterface.setup(kInputConversation); + handleTwinklesSpeech(0xE4, -1, 0); + _scene->_sequences.addTimer(180, 2); + } else { + _scene->_sequences.addTimer(6, 1); + } + break; + + case 2: + handleTwinklesSpeech(0xE5, 0, 0); + _scene->_sequences.addTimer(180, 3); + break; + + case 3: + _twinkleAnimationType = 2; + _globals[kCurtainOpen] = true; + _game._player._visible = false; + _vm->_palette->lock(); + _scene->_kernelMessages.reset(); + _scene->_activeAnimation->free(); + _scene->_activeAnimation = nullptr; + _scene->resetScene(); + + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('c', -1), 0); + _game.loadQuoteSet(0xE6, 0xE9, 0xEA, 0xE7, 0xE8, 0); + _scene->loadAnimation(formAnimName('B', -1), 4); + break; + + case 4: { + _globals._spriteIndexes[8] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 5); + _scene->_sequences.setDepth(_globals._spriteIndexes[8], 1); + + int msgIndex = _scene->_kernelMessages.add(Common::Point(160, 20), 0x1110, 32, 5, 180, _game.getQuote(231)); + _scene->_kernelMessages.setQuoted(msgIndex, 4, true); + } + break; + + case 5: { + int msgIndex = _scene->_kernelMessages.add(Common::Point(160, 40), 0xFDFC, 32, 6, 180, _game.getQuote(233)); + _scene->_kernelMessages.setQuoted(msgIndex, 4, true); + } + break; + + case 6: { + int msgIndex = _scene->_kernelMessages.add(Common::Point(160, 60), 0x1110, 32, 7, 180, _game.getQuote(232)); + _scene->_kernelMessages.setQuoted(msgIndex, 4, true); + } + break; + + case 7: { + int msgIndex = _scene->_kernelMessages.add(Common::Point(160, 80), 0xFDFC, 32, 8, 180, _game.getQuote(234)); + _scene->_kernelMessages.setQuoted(msgIndex, 4, true); + } + break; + + case 8: + _globals[kTwinklesStatus] = TWINKLES_GONE; + _scene->_nextSceneId = 216; + break; + } + break; + } +} + +void Scene210::handleTwinklesSpeech(int quoteId, int shiftX, uint32 delay) { + _scene->_kernelMessages.add(Common::Point(10, 70 + (shiftX * 14)), 0xFDFC, 0, 0, (delay == 0) ? 9999999 : delay, _game.getQuote(quoteId)); +} + +void Scene210::initNode(int node) { + _curDialogNode = node; + + switch (_curDialogNode) { + case 1: + warning("TODO: talk_init(&dialog1);"); + break; + + case 2: + warning("TODO: talk_init(&dialog2);"); + break; + + case 3: + warning("TODO: talk_init(&dialog3);"); + break; + + case 5: + warning("TODO: talk_init(&dialog5);"); + break; + + case 6: + warning("TODO: talk_init(&dialog6);"); + break; + + case 7: + warning("TODO: talk_init(&dialog7);"); + break; + + case 8: + warning("TODO: talk_init(&dialog8);"); + break; + } +} + +void Scene210::restoreDialogNode(int node, int msgId, int posY) { + int curQuoteId = msgId; + int curY = 1 - posY; + for (int count = 0; count < posY; count++) { + handleTwinklesSpeech(curQuoteId, curY, 0); + curY++; + curQuoteId++; + } + + initNode(node); +} + +void Scene210::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('c', -1), 0); + + if (!_game._visitedScenes._sceneRevisited) + _globals[kCurtainOpen] = 0; + + if (_scene->_priorSceneId == 205) + _game._player._playerPos = Common::Point(277, 56); + else if (_scene->_priorSceneId == 215) { + _game._player._playerPos = Common::Point(168, 128); + _game._player._facing = FACING_SOUTH; + _globals[kCurtainOpen] = true; + } else if (_scene->_priorSceneId != -2) + _game._player._playerPos = Common::Point(308, 132); + + if (!_globals[kCurtainOpen]) { + _globals._spriteIndexes[8] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 5); + _scene->_sequences.setDepth(_globals._spriteIndexes[8], 5); + } else { + int idx = _scene->_dynamicHotspots.add(112, 395, -1, Common::Rect(163, 87, 19, 36)); + _doorway = _scene->_dynamicHotspots.setPosition(idx, 168, 127, FACING_NORTH); + _scene->_dynamicHotspots.setCursor(_doorway, CURSOR_GO_UP); + } + + _game.loadQuoteSet(0x5A, 0x73, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB8, 0xB7, + 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, + 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, + 0xDD, 0xDE, 0xDF, 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0); + warning("TODO: sub71A50(&dialog1, 0x2E, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0);"); + + if (!_game._visitedScenes._sceneRevisited) { + warning("TODO: sub71B18(0x2E, 0xB4, 0xB5, 0xB6, 0xB8, 0);"); + + warning("TODO: if (Debugger_widepipe_ctr >= 2)"); + warning("TODO: \tsub71B9E(&dialog1, 0xB7, -1);"); + } + + warning("TODO: sub71A50(&dialog2, 0x2F, 0xBC, 0xBB, 0xBD, _game._visitedScenes._sceneRevisited ? 0, -1);"); + warning("TODO: sub71A50(&dialog3, 0x30, 0xC3, 0xC2, 0xC1, 0xC4, _game._visitedScenes._sceneRevisited ? 0, -1);"); + warning("TODO: sub71A50(&dialog5, 0x31, 0xCD, 0xCC, 0xCE, 0xCF, _game._visitedScenes._sceneRevisited ? 0, -1);"); + warning("TODO: sub71A50(&dialog6, 0x32, 0xD3, 0xD4, 0xD5, _game._visitedScenes._sceneRevisited ? 0, -1);"); + warning("TODO: sub71A50(&dialog7, 0x33, 0xD8, 0xDA, 0xD9, 0xDB, 0xDC, _game._visitedScenes._sceneRevisited ? 0, -1);"); + warning("TODO: sub71A50(&dialog8, 0x34, 0xDF, 0xE0, 0xE1, 0xE2, 0xE3, _game._visitedScenes._sceneRevisited ? 0, -1);"); + + _twinkleAnimationType = 0; + _twinklesCurrentFrame = 0; + + if (_scene->_priorSceneId != -2) { + _shouldMoveHead = false; + _shouldFaceRex = false; + _shouldTalk = false; + _nextHandsPlace = 0; + _twinklesTalking = false; + _curDialogNode = 0; + _stopWalking = false; + _twinklesTalk2 = (_globals[kTwinklesApproached] > 0); + } + + if (_globals[kTwinklesStatus] == 0) { + _scene->loadAnimation(formAnimName('A', -1), 0); + _twinkleAnimationType = 1; + } else + _scene->_hotspots.activate(476, false); + + if (_curDialogNode) { + int quote = 0; + int number = 0; + + switch (_curDialogNode) { + case 1: + quote = 0xB3; + number = 1; + break; + case 2: + quote = 0xB9; + number = 2; + break; + case 3: + quote = 0xBE; + number = 3; + break; + case 5: + quote = 0xCA; + number = 2; + break; + case 6: + quote = 0xD0; + number = 3; + break; + case 7: + quote = 0xD6; + number = 2; + break; + case 8: + quote = 0xDD; + number = 2; + break; + } + + restoreDialogNode(_curDialogNode, quote, number); + _scene->_activeAnimation->setCurrentFrame(131); + } + + _vm->_palette->setEntry(252, 63, 63, 10); + _vm->_palette->setEntry(253, 45, 45, 5); + + sceneEntrySound(); +} + +void Scene210::step() { + if ((_twinkleAnimationType == 1) && _scene->_activeAnimation) { + if (_twinklesCurrentFrame != _scene->_activeAnimation->getCurrentFrame()) { + _twinklesCurrentFrame = _scene->_activeAnimation->getCurrentFrame(); + int reset_frame = -1; + int random = _vm->getRandomNumber(1, 1000); + + switch (_twinklesCurrentFrame) { + case 31: + case 58: + case 74: + case 108: + case 190: + if (_shouldFaceRex) + reset_frame = 108; + else if ((random <= 100) || _shouldMoveHead) + reset_frame = 74; + else if (random <= 300) + reset_frame = 58; + else if (random <= 500) + reset_frame = 31; + else + reset_frame = 0; + break; + + case 80: + case 90: + _twinklesTalking = false; + if (_shouldMoveHead) { + reset_frame = 90; + } else if (_twinklesCurrentFrame == 90) { + if ((random <= 400) || _shouldFaceRex) + reset_frame = 99; + else + reset_frame = 79; + } + break; + + case 98: + if (_shouldMoveHead) + reset_frame = 91; + break; + + case 99: + if ((random <= 400) && !_shouldFaceRex) + reset_frame = 79; + break; + + case 124: + case 136: + case 174: + case 143: + case 152: + if (_nextHandsPlace == 3) + reset_frame = 174; + else if (!_shouldFaceRex) + reset_frame = 174; + else if (_nextHandsPlace == 1) + reset_frame = 136; + else if (_nextHandsPlace == 2) + reset_frame = 152; + else if (_shouldTalk) + reset_frame = 124; + else + reset_frame = (random <= 200) ? 131 : 143; + break; + + case 131: + if (_shouldTalk) { + switch (_nextHandsPlace) { + case 1: + reset_frame = 136; + break; + case 2: + reset_frame = 152; + break; + default: + reset_frame = 124; + break; + } + } + break; + + case 138: + case 141: + if ((_nextHandsPlace == 0) || !_shouldFaceRex) + reset_frame = 141; + else if (_nextHandsPlace == 2) + reset_frame = 152; + else if (!_shouldTalk || (_twinklesCurrentFrame == 141)) + reset_frame = 137; + break; + + case 153: + case 169: + if ((_nextHandsPlace == 0) || !_shouldFaceRex) + reset_frame = 169; + else if (_nextHandsPlace == 1) + reset_frame = 136; + else if (_shouldTalk) + reset_frame = 153; + else + reset_frame = 162; + break; + + case 162: + if (_shouldTalk) { + switch (_nextHandsPlace) { + case 0: + reset_frame = 124; + break; + case 1: + reset_frame = 136; + break; + default: + reset_frame = 153; + break; + } + } + break; + } + + if (reset_frame >= 0) { + if (reset_frame != _scene->_activeAnimation->getCurrentFrame()) { + _scene->_activeAnimation->setCurrentFrame(reset_frame); + _twinklesCurrentFrame = reset_frame; + } + + if ((reset_frame == 90) || (reset_frame == 91) || (reset_frame == 124) || (reset_frame == 153) + || ((reset_frame == 137) && _shouldTalk)) { + _twinklesTalking = true; + } else { + _twinklesTalking = false; + } + } + } + } + + if ((_twinkleAnimationType == 2) && _scene->_activeAnimation) { + if (_twinklesCurrentFrame != _scene->_activeAnimation->getCurrentFrame()) { + _twinklesCurrentFrame = _scene->_activeAnimation->getCurrentFrame(); + int reset_frame = -1; + + if (_twinklesCurrentFrame == 53) { + _scene->_kernelMessages.add(Common::Point(151, 61), 0xFDFC, 32, 70, 180, _game.getQuote(230)); + _shouldTalk = true; + } else if ((_twinklesCurrentFrame == 75) && _shouldTalk) + reset_frame = 60; + + if ((reset_frame >= 0) && (reset_frame != _scene->_activeAnimation->getCurrentFrame())) { + _scene->_activeAnimation->setCurrentFrame(reset_frame); + _twinklesCurrentFrame = reset_frame; + } + } + + if (_game._trigger == 70) + _shouldTalk = false; + } + + if ((_twinkleAnimationType == 1) && (_scene->_rails.getNext() > 0)) { + _game._player.walk(Common::Point(214, 150), FACING_NORTHWEST); + _scene->_rails.resetNext(); + _stopWalking = true; + } +} + +void Scene210::preActions() { + _stopWalking = false; + + if (_action.isAction(0x1AD, 0x1C1)) + _game._player._walkOffScreenSceneId = 211; +} + +void Scene210::actions() { + if (_action.isAction(VERB_LOOK, 0x27, 0x1C0)) { + _vm->_dialogs->show(0x5219); + _action._inProgress = false; + return; + } + + if (_game._screenObjects._inputMode == 1) { + handleDialogs(); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_TALKTO, 0x1DC) || + ((_game._player._playerPos == Common::Point(214, 150)) && (_game._player._facing == FACING_NORTHWEST) && (_twinkleAnimationType == 1) && _stopWalking)) { + switch (_game._trigger) { + case 0: { + _game._player._stepEnabled = false; + int quote; + if (_globals[kTwinklesApproached] == 0) + quote = 90; + else if (_globals[kTwinklesApproached] == 1) + quote = 115; + else + quote = 171; + + _shouldFaceRex = true; + _nextHandsPlace = 0; + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.addQuote(quote, 1, 120); + } + break; + + case 1: + _shouldTalk = true; + if (!_twinklesTalking) { + _scene->_sequences.addTimer(6, 1); + } else { + if (_globals[kTwinklesApproached] == 0) { + handleTwinklesSpeech(0xAF, -1, 0); + handleTwinklesSpeech(0xB0, 0, 0); + } else if (_globals[kTwinklesApproached] == 1) { + handleTwinklesSpeech(0xB1, 0, 0); + } else { + int quote = _twinklesTalk2 ? 0xB3 : 0xB2; + _twinklesTalk2 = true; + handleTwinklesSpeech(quote, 0, 0); + } + _scene->_sequences.addTimer(60, 3); + } + break; + + case 3: + _game._player._stepEnabled = true; + _shouldMoveHead = false; + _shouldTalk = false; + + if (_globals[kTwinklesApproached] < 2) + _globals[kTwinklesApproached]++; + + warning("TODO: talk_init(&dialog1);"); + _curDialogNode = 1; + break; + } + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_GIVE, 0x1DC) && _game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId))) { + switch (_game._trigger) { + case 0: { + int quote = _vm->getRandomNumber(172, 174); + _shouldMoveHead = true; + _game._player._stepEnabled = false; + handleTwinklesSpeech(quote, 0, 120); + _scene->_sequences.addTimer(120, 1); + } + break; + + case 1: + _game._player._stepEnabled = true; + _shouldMoveHead = false; + break; + } + _action._inProgress = false; + return; + } + + if (_action.isAction(0x1AD, 0x1BF) || _action.isAction(0x18C, 0x1C0)) { + _scene->_nextSceneId = 205; + _action._inProgress = false; + return; + } + + if (_action.isAction(0x18B, 0x70)) { + _scene->_nextSceneId = 215; + _action._inProgress = false; + return; + } + + if ((_action.isAction(VERB_PULL, 0x5F) || _action.isAction(VERB_OPEN, 0x5F)) && !_globals[kCurtainOpen]) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._spriteIndexes[8]); + _globals._spriteIndexes[8] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[1], false, 12, 1, 0, 0); + _scene->_sequences.setDepth(_globals._spriteIndexes[8], 5); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[8], SM_0, 0, 1); + break; + + case 1: + _game._player._stepEnabled = true; + _globals[kCurtainOpen] = true; + _doorway = _scene->_dynamicHotspots.add(112, 395, -1, Common::Rect(163, 87, 19, 36)); + _scene->_dynamicHotspots.setPosition(_doorway, 168, 127, FACING_NORTH); + _scene->_dynamicHotspots.setCursor(_doorway, CURSOR_GO_UP); + break; + } + _action._inProgress = false; + return; + } + + if ((_action.isAction(VERB_PULL, 0x5F) || _action.isAction(VERB_CLOSE, 0x5F)) && _globals[kCurtainOpen]) { + switch (_game._trigger) { + case 0: + _scene->_sequences.remove(_globals._spriteIndexes[8]); + _game._player._stepEnabled = false; + _game._player._facing = FACING_NORTH; + _globals._spriteIndexes[8] = _scene->_sequences.addSpriteCycle (_globals._spriteIndexes[1], false, 12, 0, 0, 1); + _scene->_sequences.setDepth(_globals._spriteIndexes[8], 5); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[8], SM_0, 0, 1); + _game._player._stepEnabled = false; + break; + case 1: + _globals._spriteIndexes[8] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 5); + _scene->_sequences.setDepth(_globals._spriteIndexes[8], 5); + _scene->_sequences.addTimer(48, 2); + break; + case 2: + _scene->_dynamicHotspots.remove(_doorway); + _game._player._stepEnabled = true; + _globals[kCurtainOpen] = false; + break; + } + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0xAA)) { + if (_globals[kTwinklesStatus] == TWINKLES_GONE) { + if (_game._storyMode == STORYMODE_NAUGHTY) + _vm->_dialogs->show(0x520B); + else + _vm->_dialogs->show(0x520A); + } else { + _vm->_dialogs->show(0x5209); + } + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x31)) { + _vm->_dialogs->show(0x520C); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0xA7)) { + _vm->_dialogs->show(0x520D); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_TAKE, 0xA7) || _action.isAction(VERB_TAKE, 0x31)) { + _vm->_dialogs->show(0x520E); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x1C5)) { + _vm->_dialogs->show(0x520F); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x3A)) { + _vm->_dialogs->show(0x5210); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x1B0)) { + _vm->_dialogs->show(0x5211); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x1DC)) { + _vm->_dialogs->show(0x5212); + _action._inProgress = false; + return; + } + + if (_action.isAction(0x13A, 0x1DC) || _action.isAction(0xA6, 0x1DC)) { + _vm->_dialogs->show(0x5213); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x1BF)) { + _vm->_dialogs->show(0x5214); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x5F)) { + _vm->_dialogs->show(0x5215); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x53)) { + _vm->_dialogs->show(0x5216); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_TAKE, 0x53)) { + _vm->_dialogs->show(0x5217); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x1C0)) { + _vm->_dialogs->show(0x5218); + _action._inProgress = false; + return; + } +} + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index d29b94e522..fb097350ef 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -202,6 +202,40 @@ public: virtual void postActions() {}; }; +class Scene210: public Scene2xx { +private: + int _curDialogNode; + int _nextHandsPlace; + int _twinkleAnimationType; + int _twinklesCurrentFrame; + bool _shouldTalk, _shouldFaceRex, _shouldMoveHead; + bool _stopWalking; + bool _twinklesTalking; + bool _twinklesTalk2; + int _doorway; + Common::String _subQuote2; + + void handleDialogs(); + void handleSubDialog1(); + void handleSubDialog2(); + void handleSubDialog3(); + void handleSubDialog5(); + void handleSubDialog6(); + void handleSubDialog7(); + void handleSubDialog8(); + void setDialogNode(int node); + void handleTwinklesSpeech(int quoteId, int shiftX, uint32 delay); + void initNode(int node); + void restoreDialogNode(int node, int msgId, int posY); +public: + Scene210(MADSEngine *vm) : Scene2xx(vm) {} + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/rails.h b/engines/mads/rails.h index 55f6f8b72e..6338aeab97 100644 --- a/engines/mads/rails.h +++ b/engines/mads/rails.h @@ -121,6 +121,7 @@ public: const WalkNode &popNode(); void resetNext() { _next = 0; } + int getNext() { return _next; } }; } // End of namespace MADS diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index f51372e0dd..8d05402b46 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -579,6 +579,10 @@ void UserInterface::drawTalkList() { warning("TODO: drawTalkList"); } +void UserInterface::emptyTalkList() { + warning("TODO: emptyTalkList"); +} + void UserInterface::loadInventoryAnim(int objectId) { Scene &scene = _vm->_game->_scene; noInventoryAnim(); diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h index 86b5622a03..6b3abf02f8 100644 --- a/engines/mads/user_interface.h +++ b/engines/mads/user_interface.h @@ -214,6 +214,8 @@ public: void scrollerChanged(); void scrollInventory(); + + void emptyTalkList(); }; } // End of namespace MADS -- cgit v1.2.3 From 04cfa85d74aa1ed143475f6d66039b3d51d2506d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 8 Apr 2014 10:36:12 +0200 Subject: MADS: Use Common::Point in DynamicHotspot::setPosition() --- engines/mads/hotspots.cpp | 5 ++-- engines/mads/hotspots.h | 2 +- engines/mads/nebular/nebular_scenes2.cpp | 49 ++++++++++++++++---------------- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/engines/mads/hotspots.cpp b/engines/mads/hotspots.cpp index 24ff1722e8..baae4a9629 100644 --- a/engines/mads/hotspots.cpp +++ b/engines/mads/hotspots.cpp @@ -75,10 +75,9 @@ int DynamicHotspots::add(int descId, int vocabId, int seqIndex, const Common::Re return idx; } -int DynamicHotspots::setPosition(int index, int xp, int yp, Facing facing) { +int DynamicHotspots::setPosition(int index, const Common::Point &pos, Facing facing) { if (index >= 0) { - _entries[index]._feetPos.x = xp; - _entries[index]._feetPos.y = yp; + _entries[index]._feetPos = pos; _entries[index]._facing = facing; } diff --git a/engines/mads/hotspots.h b/engines/mads/hotspots.h index a36993f1ac..bd803e84a0 100644 --- a/engines/mads/hotspots.h +++ b/engines/mads/hotspots.h @@ -61,7 +61,7 @@ public: Common::Array::size_type size() const { return _entries.size(); } DynamicHotspot &operator[](uint idx) { return _entries[idx]; } int add(int descId, int vocabId, int seqIndex, const Common::Rect &bounds); - int setPosition(int index, int xp, int yp, Facing facing); + int setPosition(int index, const Common::Point &pos, Facing facing); int setCursor(int index, CursorType cursor); void remove(int index); void clear(); diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 97c658120f..b7b2b800de 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -141,7 +141,7 @@ void Scene201::enter() { _scene->_sequences.setMsgPosition(_globals._spriteIndexes[19], Common::Point(185, 46)); int idx = _scene->_dynamicHotspots.add(1159, 209, _globals._spriteIndexes[19], Common::Rect(0, 0, 0, 0)); - _scene->_dynamicHotspots.setPosition(idx, 186, 81, FACING_NORTH); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(186, 81), FACING_NORTH); if ((_scene->_priorSceneId == 202) || (_scene->_priorSceneId == -1)) { _game._player._playerPos = Common::Point(165, 152); @@ -209,7 +209,7 @@ void Scene201::step() { if (_pterodactylFlag && (_vm->getRandomNumber(5000) == 9)) { _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 5, 1, 6, 0); int idx = _scene->_dynamicHotspots.add(351, 13, _globals._spriteIndexes[20], Common::Rect(0, 0, 0, 0)); - _scene->_dynamicHotspots.setPosition(idx, 270, 80, FACING_EAST); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(270, 80), FACING_EAST); _scene->_sequences.setDepth(_globals._spriteIndexes[20], 8); _vm->_sound->command(14); _pterodactylFlag = false; @@ -361,14 +361,14 @@ void Scene202::enter() { _scene->_sequences.setMsgPosition(_globals._spriteIndexes[17], Common::Point(149, 113)); _scene->_sequences.setDepth(_globals._spriteIndexes[17], 10); int idx = _scene->_dynamicHotspots.add(320, 13, _globals._spriteIndexes[17], Common::Rect(0, 0, 0, 0)); - _scene->_dynamicHotspots.setPosition(idx, 153, 97, FACING_SOUTH); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(153, 97), FACING_SOUTH); if (!(_globals[kBone202Status] & 1)) { _globals._spriteIndexes[16] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 6, 0, 0, 0); _scene->_sequences.setMsgPosition(_globals._spriteIndexes[16], Common::Point(130, 108)); _scene->_sequences.setDepth(_globals._spriteIndexes[16], 10); idx = _scene->_dynamicHotspots.add(44, 13, _globals._spriteIndexes[16], Common::Rect(0, 0, 0, 0)); - _scene->_dynamicHotspots.setPosition(idx, 132, 97, FACING_SOUTH); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(132, 97), FACING_SOUTH); } if (!(_globals[kBone202Status] & 2)) { @@ -376,7 +376,7 @@ void Scene202::enter() { _scene->_sequences.setMsgPosition(_globals._spriteIndexes[21], Common::Point(166, 110)); _scene->_sequences.setDepth(_globals._spriteIndexes[21], 10); idx = _scene->_dynamicHotspots.add(44, 13, _globals._spriteIndexes[21], Common::Rect(0, 0, 0, 0)); - _scene->_dynamicHotspots.setPosition(idx, 165, 99, FACING_SOUTH); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(165, 99), FACING_SOUTH); } if (_globals[kBone202Status]) @@ -395,7 +395,7 @@ void Scene202::enter() { _scene->_sequences.setDepth(_globals._spriteIndexes[20], 6); _scene->_hotspots.activate(199, false); idx = _scene->_dynamicHotspots.add(457, 13, _globals._spriteIndexes[20], Common::Rect(0, 0, 0, 0)); - _scene->_dynamicHotspots.setPosition(idx, 246, 124, FACING_NORTH); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(246, 124), FACING_NORTH); } _game.loadQuoteSet(0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x62, 0x63, 0x64, 0x65, 0x66, 0x61, 0); @@ -532,7 +532,7 @@ void Scene202::step() { _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 6, 0, 0, 0); _scene->_hotspots.activate(199, false); int idx = _scene->_dynamicHotspots.add(457, 13, _globals._spriteIndexes[20], Common::Rect(0, 0, 0, 0)); - _scene->_dynamicHotspots.setPosition(idx, 246, 124, FACING_NORTH); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(246, 124), FACING_NORTH); _scene->_sequences.updateTimeout(_globals._spriteIndexes[26], _globals._spriteIndexes[20]); _scene->_sequences.updateTimeout(-1, _globals._spriteIndexes[26]); _game._player._stepEnabled = true; @@ -806,7 +806,7 @@ void Scene202::actions() { _game._player._stepEnabled = false; _ladderHotspotId = _scene->_dynamicHotspots.add(199, 79, -1, Common::Rect(241, 68, 12, 54)); - _scene->_dynamicHotspots.setPosition(_ladderHotspotId, 246, 124, FACING_NORTH); + _scene->_dynamicHotspots.setPosition(_ladderHotspotId, Common::Point(246, 124), FACING_NORTH); _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 6, 1, 0, 0); _scene->_sequences.setDepth(_globals._spriteIndexes[23], 1); _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 1); @@ -1006,7 +1006,7 @@ void Scene203::enter() { _rhotundaEatFl = true; _game._player.walk(Common::Point(158, 135), FACING_SOUTH); int idx = _scene->_dynamicHotspots.add(131, 396, 0, Common::Rect(0, 0, 320, 156)); - _scene->_dynamicHotspots.setPosition(idx, 155, 152, FACING_SOUTH); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(155, 152), FACING_SOUTH); _scene->_dynamicHotspots.setCursor(idx, CURSOR_GO_DOWN); } @@ -1015,7 +1015,7 @@ void Scene203::enter() { if (_vm->getRandomNumber(1, 3) == 2) { _globals._spriteIndexes[15] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 9, 1, 0, 0); int idx = _scene->_dynamicHotspots.add(477, 209, _globals._spriteIndexes[15], Common::Rect(0, 0, 0, 0)); - _scene->_dynamicHotspots.setPosition(idx, -2, 0, FACING_NONE); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(-2, 0), FACING_NONE); _vm->_sound->command(14); } } @@ -1114,11 +1114,11 @@ void Scene205::enter() { _globals._spriteIndexes[16] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 10, 0, 0, 3); int idx = _scene->_dynamicHotspots.add(73, 13, _globals._spriteIndexes[16], Common::Rect(0, 0, 0, 0)); - _scene->_dynamicHotspots.setPosition(idx, 162, 120, FACING_NORTHEAST); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(162, 120), FACING_NORTHEAST); _globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 15, 0, 0, 0); idx = _scene->_dynamicHotspots.add(73, 13, _globals._spriteIndexes[16], Common::Rect(0, 0, 0, 0)); - _scene->_dynamicHotspots.setPosition(idx, 162, 120, FACING_NORTHEAST); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(162, 120), FACING_NORTHEAST); _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 9, 0, 0, 0); _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 6, 0, 0, 0); @@ -1128,7 +1128,7 @@ void Scene205::enter() { _lastFishTime = _scene->_frameStartTime; _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 7, 1, 0, 0); idx = _scene->_dynamicHotspots.add(269, 13, _globals._spriteIndexes[21], Common::Rect(0, 0, 0, 0)); - _scene->_dynamicHotspots.setPosition(idx, 49, 86, FACING_NORTH); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(49, 86), FACING_NORTH); } if (_game._objects[12]._roomNumber == 205) { @@ -1195,7 +1195,7 @@ void Scene205::step() { if (_globals._frameTime - _lastFishTime > 1300) { _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 5, 1, 0, 0); int idx = _scene->_dynamicHotspots.add(269, 13, _globals._spriteIndexes[21], Common::Rect(0, 0, 0, 0)); - _scene->_dynamicHotspots.setPosition(idx, 49, 86, FACING_NORTH); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(49, 86), FACING_NORTH); _lastFishTime = _globals._frameTime; } @@ -1265,7 +1265,7 @@ void Scene207::enter() { _globals._spriteIndexes[16] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 30, 0, 0, 400); _vultureTime = _game._player._priorTimer; _vultureHotspotId = _scene->_dynamicHotspots.add(389, 13, _globals._spriteIndexes[16], Common::Rect(0, 0, 0, 0)); - _scene->_dynamicHotspots.setPosition(_vultureHotspotId, 254, 94, FACING_WEST); + _scene->_dynamicHotspots.setPosition(_vultureHotspotId, Common::Point(254, 94), FACING_WEST); } if (_spiderFl) { @@ -1273,7 +1273,7 @@ void Scene207::enter() { _scene->_sequences.setAnimRange(_globals._spriteIndexes[19], -1, -1); _spiderTime = _game._player._priorTimer; _spiderHotspotId = _scene->_dynamicHotspots.add(333, 13, _globals._spriteIndexes[19], Common::Rect(0, 0, 0, 0)); - _scene->_dynamicHotspots.setPosition(_spiderHotspotId, 59, 132, FACING_SOUTH); + _scene->_dynamicHotspots.setPosition(_spiderHotspotId, Common::Point(59, 132), FACING_SOUTH); } _eyeFl = false; @@ -1427,7 +1427,7 @@ void Scene208::updateTrap() { _globals._spriteIndexes[16] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 8, 0, 0, 24); _scene->_sequences.setDepth(_globals._spriteIndexes[16], 5); int idx = _scene->_dynamicHotspots.add(424, 13, _globals._spriteIndexes[16], Common::Rect(0, 0, 0, 0)); - _scene->_dynamicHotspots.setPosition(idx, 100, 146, FACING_NORTH); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(100, 146), FACING_NORTH); _scene->_hotspots.activate(414, false); return; } @@ -1437,7 +1437,7 @@ void Scene208::updateTrap() { _globals._spriteIndexes[17] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 1); _scene->_sequences.setDepth(_globals._spriteIndexes[17], 15); int idx = _scene->_dynamicHotspots.add(426, 13, _globals._spriteIndexes[17], Common::Rect(0, 0, 0, 0)); - _scene->_dynamicHotspots.setPosition(idx, 60, 152, FACING_NORTH); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(60, 152), FACING_NORTH); } break; case 2: { @@ -1445,7 +1445,7 @@ void Scene208::updateTrap() { _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); _scene->_hotspots.activate(414, false); int idx = _scene->_dynamicHotspots.add(425, 13, _globals._spriteIndexes[17], Common::Rect(0, 0, 0, 0)); - _scene->_dynamicHotspots.setPosition(idx, 100, 146, FACING_NORTH); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(100, 146), FACING_NORTH); _scene->_dynamicHotspots[idx]._articleNumber = 5; } break; @@ -2357,7 +2357,8 @@ void Scene209::handleMonkeyFall() { _scene->_sequences.updateTimeout(_globals._spriteIndexes[23], oldIdx); _scene->_sequences.setAnimRange(_globals._spriteIndexes[23], 43, 72); _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 222); - _scene->_dynamicHotspots.setPosition(_scene->_dynamicHotspots.add(39, 13, _globals._spriteIndexes[24], Common::Rect(0, 0, 0, 0)), 200, 133, FACING_NORTH); + int idx = _scene->_dynamicHotspots.add(39, 13, _globals._spriteIndexes[24], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(200, 133), FACING_NORTH); } break; @@ -2533,7 +2534,7 @@ void Scene209::enter() { if (_game._objects.isInRoom(OBJ_PLANT_STALK)) { _globals._spriteIndexes[16] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); int idx = _scene->_dynamicHotspots.add(271, 13, _globals._spriteIndexes[16], Common::Rect(0, 0, 0, 0)); - _scene->_dynamicHotspots.setPosition(idx, 263, 129, FACING_SOUTH); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(263, 129), FACING_SOUTH); _scene->_sequences.setDepth(_globals._spriteIndexes[16], 13); } @@ -2550,7 +2551,7 @@ void Scene209::enter() { _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(201, 131)); _scene->_sequences.setDepth(_globals._spriteIndexes[24], 8); int idx = _scene->_dynamicHotspots.add(39, 13, _globals._spriteIndexes[24], Common::Rect(0, 0, 0, 0)); - _scene->_dynamicHotspots.setPosition(idx, 200, 133, FACING_NORTH); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(200, 133), FACING_NORTH); } if (_scene->_roomChanged) { @@ -3829,7 +3830,7 @@ void Scene210::enter() { _scene->_sequences.setDepth(_globals._spriteIndexes[8], 5); } else { int idx = _scene->_dynamicHotspots.add(112, 395, -1, Common::Rect(163, 87, 19, 36)); - _doorway = _scene->_dynamicHotspots.setPosition(idx, 168, 127, FACING_NORTH); + _doorway = _scene->_dynamicHotspots.setPosition(idx, Common::Point(168, 127), FACING_NORTH); _scene->_dynamicHotspots.setCursor(_doorway, CURSOR_GO_UP); } @@ -4205,7 +4206,7 @@ void Scene210::actions() { _game._player._stepEnabled = true; _globals[kCurtainOpen] = true; _doorway = _scene->_dynamicHotspots.add(112, 395, -1, Common::Rect(163, 87, 19, 36)); - _scene->_dynamicHotspots.setPosition(_doorway, 168, 127, FACING_NORTH); + _scene->_dynamicHotspots.setPosition(_doorway, Common::Point(168, 127), FACING_NORTH); _scene->_dynamicHotspots.setCursor(_doorway, CURSOR_GO_UP); break; } -- cgit v1.2.3 From 3e2cba4cdac011372882336a5572219aa08380f2 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 8 Apr 2014 11:20:15 +0200 Subject: MADS: Hook scene 210 in hardcoded logic --- engines/mads/nebular/nebular_scenes.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 0538f1b10e..67a75c37b5 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -65,6 +65,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene208(vm); case 209: return new Scene209(vm); + case 210: + return new Scene210(vm); // Scene group #8 case 804: -- cgit v1.2.3 From cd77110093c32f07b84325684ada9a425bdf6c93 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 8 Apr 2014 20:34:39 -0400 Subject: MADS: Fixes for movement issues in the grasslands --- engines/mads/player.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index 10d8b3e327..bf5e59ecde 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -426,27 +426,29 @@ void Player::move() { if (_scalingVelocity && (_totalDistance > 0)) { int angleRange = 100 - _currentScale; int angleScale = angleRange * (_posDiff.x - 1) / _totalDistance + _currentScale; - velocity = MAX(1, 10000 / (angleScale * _currentScale * velocity)); + velocity = MAX(1L, (angleScale * _currentScale * velocity) / 10000L); } if (!_moving || (_facing != _turnToFacing)) return; Common::Point newPos = _playerPos; + newFacing = false; + _special = 0; if (_distAccum < velocity) { do { if (_pixelAccum < _posDiff.x) _pixelAccum += _posDiff.y; if (_pixelAccum >= _posDiff.x) { - if ((_posChange.y > 0) || (_walkOffScreen != 0)) + if ((_posChange.y > 0) || _walkOffScreen) newPos.y += _yDirection; --_posChange.y; _pixelAccum -= _posDiff.x; } if (_pixelAccum < _posDiff.x) { - if ((_posChange.x > 0) || (_walkOffScreen != 0)) + if ((_posChange.x > 0) || _walkOffScreen) newPos.x += _xDirection; --_posChange.x; } -- cgit v1.2.3 From 531ebab4da814aac23a9b084772a6156bfb3b9b8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 8 Apr 2014 22:04:43 -0400 Subject: MADS: Added preliminary keyboard handling and keypress process stub --- engines/mads/dialogs.cpp | 8 +++++--- engines/mads/dialogs.h | 2 +- engines/mads/events.cpp | 22 +++++++++++++++------- engines/mads/events.h | 13 ++++++++++--- engines/mads/game.cpp | 23 +++++++++++++++++++++++ engines/mads/game.h | 6 ++++++ engines/mads/nebular/dialogs_nebular.cpp | 3 ++- engines/mads/scene.cpp | 12 +++++++++++- engines/mads/scene.h | 3 +++ engines/mads/screen.cpp | 8 ++++---- 10 files changed, 80 insertions(+), 20 deletions(-) diff --git a/engines/mads/dialogs.cpp b/engines/mads/dialogs.cpp index 23015413b8..8bc73e55dc 100644 --- a/engines/mads/dialogs.cpp +++ b/engines/mads/dialogs.cpp @@ -331,11 +331,13 @@ void TextDialog::show() { // Wait for mouse click do { _vm->_events->waitForNextFrame(); - } while (!_vm->shouldQuit() && !_vm->_events->_mouseReleased); + } while (!_vm->shouldQuit() && !_vm->_events->isKeyPressed() && !_vm->_events->_mouseReleased); - // Allow the mouse release to be gobbled up - if (!_vm->shouldQuit()) + // Allow the mouse release or keypress to be gobbled up + if (!_vm->shouldQuit()) { _vm->_events->waitForNextFrame(); + _vm->_events->_pendingKeys.clear(); + } } /*------------------------------------------------------------------------*/ diff --git a/engines/mads/dialogs.h b/engines/mads/dialogs.h index 2c7c342319..00b714d052 100644 --- a/engines/mads/dialogs.h +++ b/engines/mads/dialogs.h @@ -184,7 +184,7 @@ public: void show(); }; -class MessageDialog: protected TextDialog { +class MessageDialog: public TextDialog { public: MessageDialog(MADSEngine *vm, int lines, ...); diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp index ecc7a528fd..85c62e30bd 100644 --- a/engines/mads/events.cpp +++ b/engines/mads/events.cpp @@ -37,13 +37,12 @@ EventsManager::EventsManager(MADSEngine *vm) { _cursorSprites = nullptr; _frameCounter = 10; _priorFrameTime = 0; - _keyPressed = false; _mouseClicked = false; _mouseReleased = false; _mouseButtons = 0; - _vCC = 0; + _mouseStatus = 0; _vD2 = 0; - _vD4 = 0; + _mouseStatusCopy = 0; _mouseMoved = false; _vD8 = 0; _rightMousePressed = false; @@ -119,18 +118,22 @@ void EventsManager::pollEvents() { _vm->_debugger->attach(); _vm->_debugger->onFrame(); } else { - _keyPressed = true; + _pendingKeys.push(event); } return; case Common::EVENT_KEYUP: - _keyPressed = false; return; case Common::EVENT_LBUTTONDOWN: case Common::EVENT_RBUTTONDOWN: _mouseClicked = true; _mouseButtons = 1; - _rightMousePressed = event.type == Common::EVENT_RBUTTONDOWN; _mouseMoved = true; + if (event.type == Common::EVENT_RBUTTONDOWN) { + _rightMousePressed = true; + _mouseStatus |= 2; + } else { + _mouseStatus |= 1; + } return; case Common::EVENT_LBUTTONUP: case Common::EVENT_RBUTTONUP: @@ -138,6 +141,11 @@ void EventsManager::pollEvents() { _mouseReleased = true; _mouseMoved = true; _rightMousePressed = false; + if (event.type == Common::EVENT_RBUTTONUP) { + _mouseStatus &= ~2; + } else { + _mouseStatus &= ~1; + } return; case Common::EVENT_MOUSEMOVE: _mousePos = event.mouse; @@ -205,7 +213,7 @@ void EventsManager::waitForNextFrame() { void EventsManager::initVars() { _mousePos = Common::Point(-1, -1); - _vD4 = _vCC; + _mouseStatusCopy = _mouseStatus; _vD2 = _vD8 = 0; } diff --git a/engines/mads/events.h b/engines/mads/events.h index 3b5820a6df..529581cae8 100644 --- a/engines/mads/events.h +++ b/engines/mads/events.h @@ -24,6 +24,8 @@ #define MADS_EVENTS_H #include "common/scummsys.h" +#include "common/events.h" +#include "common/stack.h" #include "mads/assets.h" #include "mads/sprites.h" @@ -59,12 +61,12 @@ public: bool _mouseReleased; byte _mouseButtons; bool _rightMousePressed; - bool _keyPressed; - int _vCC; + int _mouseStatus; int _vD2; - int _vD4; + int _mouseStatusCopy; bool _mouseMoved; int _vD8; + Common::Stack _pendingKeys; public: /** * Constructor @@ -142,6 +144,11 @@ public: uint32 getFrameCounter() const { return _frameCounter; } void initVars(); + + /** + * Returns true if there's any pending keys to be processed + */ + bool isKeyPressed() const { return !_pendingKeys.empty(); } }; } // End of namespace MADS diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index fd0294161d..f790341e8a 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -60,6 +60,7 @@ Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm), _triggerMode = KERNEL_TRIGGER_PARSER; _triggerSetupMode = KERNEL_TRIGGER_DAEMON; _winStatus = 0; + _widepipeCtr = 0; // Load the inventory object list _objects.load(); @@ -379,4 +380,26 @@ Common::StringArray Game::getMessage(uint32 id) { error("Invalid message Id specified"); } +static const char *const DEBUG_STRING = "WIDEPIPE"; + +void Game::handleKeypress(const Common::Event &event) { + if (event.kbd.flags & Common::KBD_CTRL) { + if (_widepipeCtr == 8) { + // Implement original game cheating keys here someday + } else { + if (event.kbd.keycode == (Common::KEYCODE_a + + (DEBUG_STRING[_widepipeCtr] - 'a'))) { + if (++_widepipeCtr == 8) { + MessageDialog *dlg = new MessageDialog(_vm, 2, + "CHEATING ENABLED", "(for your convenience)."); + dlg->show(); + delete dlg; + } + } + } + } + + warning("TODO: handleKeypress - %d", (int)event.kbd.keycode); +} + } // End of namespace MADS diff --git a/engines/mads/game.h b/engines/mads/game.h index 3216da360e..296bbcd7ea 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -78,6 +78,7 @@ protected: bool _quoteEmergency; bool _vocabEmergency; bool _anyEmergency; + int _widepipeCtr; /** * Constructor @@ -166,6 +167,11 @@ public: void loadQuoteRange(int startNum, int endNum) {} void loadQuoteSet(...) {} void loadQuote(int quoteNum) {} + + /** + * Handle a keyboard event + */ + void handleKeypress(const Common::Event &event); }; } // End of namespace MADS diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp index 871e10416d..13019d589c 100644 --- a/engines/mads/nebular/dialogs_nebular.cpp +++ b/engines/mads/nebular/dialogs_nebular.cpp @@ -78,11 +78,12 @@ bool CopyProtectionDialog::show() { _vm->_events->showCursor(); // TODO: Replace with text input - while (!_vm->shouldQuit() && !_vm->_events->_keyPressed && + while (!_vm->shouldQuit() && !_vm->_events->isKeyPressed() && !_vm->_events->_mouseClicked) { _vm->_events->delay(1); } + _vm->_events->_pendingKeys.clear(); return true; } diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index ac57e0bcbf..8cb5fbcf87 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -509,7 +509,17 @@ void Scene::doSceneStep() { } void Scene::checkKeyboard() { - warning("TODO: Scene::checkKeyboard"); + if (_vm->_events->isKeyPressed()) { + Common::Event evt = _vm->_events->_pendingKeys.pop(); + _vm->_game->handleKeypress(evt); + } + + if ((_vm->_events->_mouseStatus & 3) == 3 && _vm->_game->_player._stepEnabled) { + _reloadSceneFlag = true; + _vm->_dialogs->_pendingDialog = DIALOG_GAME_MENU; + _action.clear(); + _action._selectedAction = 0; + } } void Scene::loadAnimation(const Common::String &resName, int abortTimers) { diff --git a/engines/mads/scene.h b/engines/mads/scene.h index f449ededfc..a49692dc5b 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -71,6 +71,9 @@ private: */ void doSceneStep(); + /** + * Checks whether there's a pending keypress, and if so handles it. + */ void checkKeyboard(); /** diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index 78980fe2a7..5553f61a11 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -313,7 +313,7 @@ void ScreenObjects::check(bool scanFlag) { } //_released = _vm->_events->_mouseReleased; - if (_vm->_events->_vD2 || (_vm->_easyMouse && !_vm->_events->_vD4)) + if (_vm->_events->_vD2 || (_vm->_easyMouse && !_vm->_events->_mouseStatusCopy)) scene._userInterface._category = _category; if (!_vm->_events->_mouseButtons || _vm->_easyMouse) { @@ -387,9 +387,9 @@ void ScreenObjects::checkScroller() { userInterface._scrollerY = 0; - if ((_category == CAT_INV_SCROLLER || (_scrollerY == 3 && _vm->_events->_vD4)) - && (_vm->_events->_vD4 || _vm->_easyMouse)) { - if ((_vm->_events->_vD2 || (_vm->_easyMouse && !_vm->_events->_vD4)) + if ((_category == CAT_INV_SCROLLER || (_scrollerY == 3 && _vm->_events->_mouseStatusCopy)) + && (_vm->_events->_mouseStatusCopy || _vm->_easyMouse)) { + if ((_vm->_events->_vD2 || (_vm->_easyMouse && !_vm->_events->_mouseStatusCopy)) && _category == CAT_INV_SCROLLER) { _currentDescId = _newDescId; } -- cgit v1.2.3 From 21a0e38f34324423e0f571ccb37a800737cd78d2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 8 Apr 2014 22:21:45 -0400 Subject: MADS: Resolve some old TODOs --- engines/mads/game.cpp | 4 ---- engines/mads/game.h | 2 -- engines/mads/nebular/game_nebular.cpp | 4 ++-- engines/mads/player.h | 4 ++++ engines/mads/scene.cpp | 2 +- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index f790341e8a..eb7ba62fbd 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -309,10 +309,6 @@ void Game::initSection(int sectionNumber) { CURSOR_ARROW : CURSOR_WAIT); } -void Game::loadResourceSequence(const Common::String prefix, int v) { - warning("TODO: loadResourceSequence"); -} - void Game::loadQuotes() { File f("*QUOTES.DAT"); diff --git a/engines/mads/game.h b/engines/mads/game.h index 296bbcd7ea..56593660b5 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -90,8 +90,6 @@ protected: */ void initSection(int sectionNumber); - void loadResourceSequence(const Common::String prefix, int v); - //@{ /** @name Virtual Method list */ diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index 69c896a1f8..d8b00bcf54 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -232,8 +232,8 @@ void GameNebular::initialiseGlobals() { _player._facing = FACING_NORTH; _player._turnToFacing = FACING_NORTH; - loadResourceSequence("RXM", 1); - loadResourceSequence("ROX", 1); + Player::preloadSequences("RXM", 1); + Player::preloadSequences("ROX", 1); } void GameNebular::setSectionHandler() { diff --git a/engines/mads/player.h b/engines/mads/player.h index 8315206fc3..6df1159ad4 100644 --- a/engines/mads/player.h +++ b/engines/mads/player.h @@ -210,6 +210,10 @@ public: * Delete any sprites used by the player */ void releasePlayerSprites(); + + static void preloadSequences(const Common::String &prefix, int level) { + // No implementation in ScummVM + } }; } // End of namespace MADS diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 8cb5fbcf87..76263bd0f6 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -168,7 +168,7 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) { _userInterface.setup(_vm->_game->_screenObjects._inputMode); - warning("TODO: showMouse"); + _vm->_events->showCursor(); warning("TODO: inventory_anim_allocate"); } -- cgit v1.2.3 From 09adb571d35c45941246bdce5db895d9d81fd59c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 8 Apr 2014 23:01:46 -0400 Subject: MADS: Cleanup of verb/preposition flags handling --- engines/mads/action.cpp | 50 +++++++++++++++++++++++----------------------- engines/mads/action.h | 9 ++++++++- engines/mads/inventory.cpp | 6 +++--- engines/mads/inventory.h | 4 ++-- engines/mads/scene.cpp | 20 +++++++++---------- engines/mads/scene_data.h | 7 ++++--- 6 files changed, 52 insertions(+), 44 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index a84c329dd0..8cbc404652 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -105,7 +105,8 @@ void MADSAction::set() { // Two 'look' actions in succession, so the action becomes 'Look around' _statusText = kLookAroundStr; } else { - if ((_commandSource == ACTIONMODE_OBJECT) && (_selectedRow >= 0) && (_flags1 == 2) && (_flags2 == 0)) { + if ((_commandSource == ACTIONMODE_OBJECT) && (_selectedRow >= 0) + && (_verbType == VERB_THAT) && (_prepType == PREP_NONE)) { // Use/to action int invIndex = userInterface._selectedInvIndex; InventoryObject &objEntry = _vm->_game->_objects.getItem(invIndex); @@ -142,7 +143,7 @@ void MADSAction::set() { } // Handling for if a hotspot has been selected/highlighted - if ((_hotspotId >= 0) && (_selectedRow >= 0) && (_articleNumber > 0) && (_flags1 == 2)) { + if ((_hotspotId >= 0) && (_selectedRow >= 0) && (_articleNumber > 0) && (_verbType == VERB_THAT)) { flag = true; _statusText += kArticleList[_articleNumber]; @@ -379,8 +380,8 @@ void MADSAction::checkActionAtMousePos() { if (userInterface._selectedActionIndex >= 0) { _commandSource = ACTIONMODE_VERB; _selectedRow = userInterface._selectedActionIndex; - _flags1 = scene._verbList[_selectedRow]._action1; - _flags2 = scene._verbList[_selectedRow]._action2; + _verbType = scene._verbList[_selectedRow]._verbType; + _prepType = scene._verbList[_selectedRow]._prepType; _interAwaiting = AWAITING_THIS; } else if (userInterface._selectedItemVocabIdx >= 0) { _commandSource = ACTIONMODE_OBJECT; @@ -388,13 +389,14 @@ void MADSAction::checkActionAtMousePos() { int objectId = _vm->_game->_objects._inventoryList[_selectedRow]; InventoryObject &invObject = _vm->_game->_objects[objectId]; - _flags1 = invObject._vocabList[_selectedRow - 1]._actionFlags1; - _flags2 = invObject._vocabList[_selectedRow - 1]._actionFlags2; + _verbType = invObject._vocabList[_selectedRow - 1]._verbType; + _prepType = invObject._vocabList[_selectedRow - 1]._prepType; _mainObjectSource = ACTIONMODE2_2; _hotspotId = userInterface._selectedInvIndex; - _articleNumber = _flags2; + _articleNumber = _prepType; - if ((_flags1 == 1 && _flags2 == 0) || (_flags1 == 2 && _flags2 != 0)) + if ((_verbType == VERB_THIS && _prepType == PREP_NONE) || + (_verbType == VERB_THAT && _prepType != PREP_NONE)) _interAwaiting = AWAITING_RIGHT_MOUSE; else _interAwaiting = AWAITING_THAT; @@ -412,8 +414,8 @@ void MADSAction::checkActionAtMousePos() { _commandSource = ACTIONMODE_VERB; _selectedRow = _pickedWord; if (_selectedRow >= 0) { - _flags1 = scene._verbList[_selectedRow]._action1; - _flags2 = scene._verbList[_selectedRow]._action2; + _verbType = scene._verbList[_selectedRow]._verbType; + _prepType = scene._verbList[_selectedRow]._prepType; } break; @@ -427,13 +429,13 @@ void MADSAction::checkActionAtMousePos() { int objectId = _vm->_game->_objects._inventoryList[_selectedRow]; InventoryObject &invObject = _vm->_game->_objects[objectId]; - _flags1 = invObject._vocabList[_selectedRow - 2]._actionFlags1; - _flags2 = invObject._vocabList[_selectedRow - 2]._actionFlags2; + _verbType = invObject._vocabList[_selectedRow - 2]._verbType; + _prepType = invObject._vocabList[_selectedRow - 2]._prepType; _hotspotId = userInterface._selectedInvIndex; _mainObjectSource = ACTIONMODE2_2; - if (_flags1 == 2) - _articleNumber = _flags2; + if (_verbType == VERB_THAT) + _articleNumber = _prepType; } break; @@ -516,7 +518,7 @@ void MADSAction::leftClick() { switch (userInterface._category) { case CAT_COMMAND: if (_selectedRow >= 0) { - if (!_flags1) { + if (_verbType == VERB_ONLY) { _selectedAction = -1; } else { @@ -535,17 +537,15 @@ void MADSAction::leftClick() { case CAT_INV_VOCAB: if (_selectedRow >= 0) { - if (_flags1 != 1 || _flags2 != 0) { - if (_flags1 != 2 || _flags2 == 0) { + if (_verbType != VERB_THIS || _prepType != PREP_NONE) { + if (_verbType != VERB_THAT || _prepType == PREP_NONE) { _interAwaiting = AWAITING_THAT; - _articleNumber = _flags2; - } - else { - _articleNumber = _flags2; + _articleNumber = _prepType; + } else { + _articleNumber = _prepType; _selectedAction = -1; } - } - else { + } else { _selectedAction = -1; } @@ -581,8 +581,8 @@ void MADSAction::leftClick() { case CAT_HOTSPOT: case CAT_INV_ANIM: if (_hotspotId >= 0) { - if (_flags2) { - _articleNumber = _flags2; + if (_prepType) { + _articleNumber = _prepType; _interAwaiting = AWAITING_THAT; } else { diff --git a/engines/mads/action.h b/engines/mads/action.h index b38e9c24e0..3b238c997f 100644 --- a/engines/mads/action.h +++ b/engines/mads/action.h @@ -60,6 +60,12 @@ enum { VERB_WALKTO = 13 }; +enum VerbType { VERB_ONLY, VERB_THIS, VERB_THAT }; + +enum PrepType { + PREP_NONE, PREP_WITH, PREP_TO, PREP_AT, PREP_FROM, PREP_ON, PREP_IN, + PREP_UNDER, PREP_BEHIND, PREP_RELATIONAL = -1 +}; class MADSEngine; @@ -91,7 +97,8 @@ private: void startWalkingDirectly(int walkType); public: ActionDetails _action, _activeAction; - int8 _flags1, _flags2; + VerbType _verbType; + PrepType _prepType; int _commandSource; int _mainObjectSource; int _articleNumber; diff --git a/engines/mads/inventory.cpp b/engines/mads/inventory.cpp index 89ca9f84c2..607179a3c2 100644 --- a/engines/mads/inventory.cpp +++ b/engines/mads/inventory.cpp @@ -33,8 +33,8 @@ void InventoryObject::load(Common::SeekableReadStream &f) { _vocabCount = f.readByte(); for (int i = 0; i < 3; ++i) { - _vocabList[i]._actionFlags1 = f.readByte(); - _vocabList[i]._actionFlags2 = f.readByte(); + _vocabList[i]._verbType = (VerbType)f.readByte(); + _vocabList[i]._prepType = (PrepType)f.readByte(); _vocabList[i]._vocabId = f.readUint16LE(); } @@ -71,7 +71,7 @@ void InventoryObjects::setQuality(int objIndex, int id, const byte *p) { // more of the engine is implemented for (int i = 0; i < (int)size(); ++i) { InventoryObject &obj = (*this)[i]; - if (obj._vocabList[0]._actionFlags1 <= i) + if (obj._vocabList[0]._verbType <= i) break; if (obj._mutilateString[6 + i] == id) { diff --git a/engines/mads/inventory.h b/engines/mads/inventory.h index 13b81094af..5c2f925e57 100644 --- a/engines/mads/inventory.h +++ b/engines/mads/inventory.h @@ -41,8 +41,8 @@ public: int _article; int _vocabCount; struct { - int _actionFlags1; - int _actionFlags2; + VerbType _verbType; + PrepType _prepType; int _vocabId; } _vocabList[3]; char _mutilateString[10]; // ??? diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 76263bd0f6..02a066a0c6 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -50,16 +50,16 @@ Scene::Scene(MADSEngine *vm): _vm(vm), _action(_vm), _depthSurface(vm), _layer = LAYER_GUI; _lookFlag = false; - _verbList.push_back(VerbInit(VERB_LOOK, 2, 0)); - _verbList.push_back(VerbInit(VERB_TAKE, 2, 0)); - _verbList.push_back(VerbInit(VERB_PUSH, 2, 0)); - _verbList.push_back(VerbInit(VERB_OPEN, 2, 0)); - _verbList.push_back(VerbInit(VERB_PUT, 1, -1)); - _verbList.push_back(VerbInit(VERB_TALKTO, 2, 0)); - _verbList.push_back(VerbInit(VERB_GIVE, 1, 2)); - _verbList.push_back(VerbInit(VERB_PULL, 2, 0)); - _verbList.push_back(VerbInit(VERB_CLOSE, 2, 0)); - _verbList.push_back(VerbInit(VERB_THROW, 1, 2)); + _verbList.push_back(VerbInit(VERB_LOOK, VERB_THAT, PREP_NONE)); + _verbList.push_back(VerbInit(VERB_TAKE, VERB_THAT, PREP_NONE)); + _verbList.push_back(VerbInit(VERB_PUSH, VERB_THAT, PREP_NONE)); + _verbList.push_back(VerbInit(VERB_OPEN, VERB_THAT, PREP_NONE)); + _verbList.push_back(VerbInit(VERB_PUT, VERB_THIS, PREP_RELATIONAL)); + _verbList.push_back(VerbInit(VERB_TALKTO, VERB_THAT, PREP_NONE)); + _verbList.push_back(VerbInit(VERB_GIVE, VERB_THIS, PREP_TO)); + _verbList.push_back(VerbInit(VERB_PULL, VERB_THAT, PREP_NONE)); + _verbList.push_back(VerbInit(VERB_CLOSE, VERB_THAT, PREP_NONE)); + _verbList.push_back(VerbInit(VERB_THROW, VERB_THIS, PREP_TO)); } Scene::~Scene() { diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index 73ca21d092..e37aa43855 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -60,11 +60,12 @@ enum { class VerbInit { public: int _id; - int _action1; - int _action2; + VerbType _verbType; + PrepType _prepType; VerbInit() {} - VerbInit(int id, int action1, int action2): _id(id), _action1(action1), _action2(action2) {} + VerbInit(int id, VerbType verbType, PrepType prepType): _id(id), + _verbType(verbType), _prepType(prepType) {} }; class SceneLogic { -- cgit v1.2.3 From e144e9810f7aad29575b98faad9fcc64a82d785d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 8 Apr 2014 23:25:11 -0400 Subject: MADS: Dropped old ActionMode enums in favour of ScrCategory --- engines/mads/action.cpp | 48 +++++++++++++++++++++++----------------------- engines/mads/action.h | 22 +++++++++++---------- engines/mads/screen.h | 7 +------ engines/mads/staticres.cpp | 1 - engines/mads/staticres.h | 1 - 5 files changed, 37 insertions(+), 42 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index 8cbc404652..b646ca5f2b 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -47,10 +47,10 @@ MADSAction::MADSAction(MADSEngine *vm) : _vm(vm) { void MADSAction::clear() { _interAwaiting = AWAITING_COMMAND; - _commandSource = ACTIONMODE_NONE; - _mainObjectSource = ACTIONMODE2_0; - _secondObjectSource = 0; - _recentCommandSource = 0; + _commandSource = CAT_NONE; + _mainObjectSource = CAT_NONE; + _secondObjectSource = CAT_NONE; + _recentCommandSource = CAT_NONE; _articleNumber = 0; _lookFlag = false; _pointEstablished = 0; @@ -94,7 +94,7 @@ void MADSAction::set() { _action._objectNameId = -1; _action._indirectObjectId = -1; - if (_commandSource == ACTIONMODE_TALK) { + if (_commandSource == CAT_TALK_ENTRY) { // Handle showing the conversation selection. Rex at least doesn't actually seem to use this if (_selectedRow >= 0) { Common::String desc = userInterface._talkStrings[userInterface._talkIds[_selectedRow]]; @@ -105,7 +105,7 @@ void MADSAction::set() { // Two 'look' actions in succession, so the action becomes 'Look around' _statusText = kLookAroundStr; } else { - if ((_commandSource == ACTIONMODE_OBJECT) && (_selectedRow >= 0) + if ((_commandSource == CAT_INV_VOCAB) && (_selectedRow >= 0) && (_verbType == VERB_THAT) && (_prepType == PREP_NONE)) { // Use/to action int invIndex = userInterface._selectedInvIndex; @@ -122,7 +122,7 @@ void MADSAction::set() { } else { // Handling for if an action has been selected if (_selectedRow >= 0) { - if (_commandSource == ACTIONMODE_VERB) { + if (_commandSource == CAT_COMMAND) { // Standard verb action _action._verbId = scene._verbList[_selectedRow]._id; } else { @@ -137,7 +137,7 @@ void MADSAction::set() { if (_action._verbId == VERB_LOOK) { // Add in the word 'add' - _statusText += kAtStr; + _statusText += kArticleList[PREP_AT]; _statusText += " "; } } @@ -173,7 +173,7 @@ void MADSAction::set() { } } - if ((_mainObjectSource == ACTIONMODE2_2) || (_mainObjectSource == ACTIONMODE2_5)) { + if ((_mainObjectSource == CAT_INV_LIST) || (_mainObjectSource == CAT_INV_ANIM)) { // Get name from given inventory object InventoryObject &invObject = _vm->_game->_objects.getItem(_hotspotId); _action._objectNameId = invObject._descId; @@ -290,14 +290,14 @@ void MADSAction::startAction() { _activeAction = _action; _sentence = _statusText; - if ((_mainObjectSource == ACTIONMODE2_4) && (_secondObjectSource == 4)) + if ((_mainObjectSource == CAT_HOTSPOT) && (_secondObjectSource == 4)) _savedFields._commandError = true; player._needToWalk = false; int hotspotId = -1; if (!_savedFields._lookFlag && (_vm->_game->_screenObjects._inputMode != kInputConversation)) { - if (_savedFields._mainObjectSource == ACTIONMODE2_4) + if (_savedFields._mainObjectSource == CAT_HOTSPOT) hotspotId = _savedFields._mainObject; else if (_secondObjectSource == 4) hotspotId = _savedFields._secondObject; @@ -308,7 +308,7 @@ void MADSAction::startAction() { startWalkingDirectly(hs._feetPos.x); } else if (hs._feetPos.x == 0) { player._prepareWalkFacing = hs._facing; - } else if (_savedFields._commandSource == ACTIONMODE_NONE || hs._cursor >= CURSOR_WAIT) { + } else if (_savedFields._commandSource == CAT_NONE || hs._cursor >= CURSOR_WAIT) { player._needToWalk = true; player._prepareWalkPos = hs._feetPos; } @@ -324,7 +324,7 @@ void MADSAction::startAction() { if (hs._feetPos.x == -1 || hs._feetPos.x == -3) { startWalkingDirectly(hs._feetPos.x); } else if (hs._feetPos.x >= 0) { - if (_savedFields._commandSource == ACTIONMODE_NONE || hs._cursor < CURSOR_WAIT) { + if (_savedFields._commandSource == CAT_NONE || hs._cursor < CURSOR_WAIT) { player._needToWalk = true; player._prepareWalkPos = hs._feetPos; } @@ -378,20 +378,20 @@ void MADSAction::checkActionAtMousePos() { case CAT_INV_ANIM: if (_interAwaiting != AWAITING_THAT) { if (userInterface._selectedActionIndex >= 0) { - _commandSource = ACTIONMODE_VERB; + _commandSource = CAT_COMMAND; _selectedRow = userInterface._selectedActionIndex; _verbType = scene._verbList[_selectedRow]._verbType; _prepType = scene._verbList[_selectedRow]._prepType; _interAwaiting = AWAITING_THIS; } else if (userInterface._selectedItemVocabIdx >= 0) { - _commandSource = ACTIONMODE_OBJECT; + _commandSource = CAT_INV_VOCAB; _selectedRow = userInterface._selectedItemVocabIdx; int objectId = _vm->_game->_objects._inventoryList[_selectedRow]; InventoryObject &invObject = _vm->_game->_objects[objectId]; _verbType = invObject._vocabList[_selectedRow - 1]._verbType; _prepType = invObject._vocabList[_selectedRow - 1]._prepType; - _mainObjectSource = ACTIONMODE2_2; + _mainObjectSource = CAT_INV_LIST; _hotspotId = userInterface._selectedInvIndex; _articleNumber = _prepType; @@ -411,7 +411,7 @@ void MADSAction::checkActionAtMousePos() { _articleNumber = 0; switch (userInterface._category) { case CAT_COMMAND: - _commandSource = ACTIONMODE_VERB; + _commandSource = CAT_COMMAND; _selectedRow = _pickedWord; if (_selectedRow >= 0) { _verbType = scene._verbList[_selectedRow]._verbType; @@ -420,11 +420,11 @@ void MADSAction::checkActionAtMousePos() { break; case CAT_INV_VOCAB: - _commandSource = ACTIONMODE_OBJECT; + _commandSource = CAT_INV_VOCAB; _selectedRow = _pickedWord; if (_selectedRow < 0) { _hotspotId = -1; - _mainObjectSource = ACTIONMODE2_0; + _mainObjectSource = CAT_NONE; } else { int objectId = _vm->_game->_objects._inventoryList[_selectedRow]; InventoryObject &invObject = _vm->_game->_objects[objectId]; @@ -432,7 +432,7 @@ void MADSAction::checkActionAtMousePos() { _verbType = invObject._vocabList[_selectedRow - 2]._verbType; _prepType = invObject._vocabList[_selectedRow - 2]._prepType; _hotspotId = userInterface._selectedInvIndex; - _mainObjectSource = ACTIONMODE2_2; + _mainObjectSource = CAT_INV_LIST; if (_verbType == VERB_THAT) _articleNumber = _prepType; @@ -441,13 +441,13 @@ void MADSAction::checkActionAtMousePos() { case CAT_HOTSPOT: _selectedRow = -1; - _commandSource = ACTIONMODE_NONE; - _mainObjectSource = ACTIONMODE2_4; + _commandSource = CAT_NONE; + _mainObjectSource = CAT_HOTSPOT; _hotspotId = _pickedWord; break; case CAT_TALK_ENTRY: - _commandSource = ACTIONMODE_TALK; + _commandSource = CAT_TALK_ENTRY; _selectedRow = _pickedWord; break; @@ -556,7 +556,7 @@ void MADSAction::leftClick() { case CAT_HOTSPOT: _recentCommand = -1; - _recentCommandSource = 0; + _recentCommandSource = CAT_NONE; if (_vm->_events->currentPos().y < MADS_SCENE_HEIGHT) { scene._customDest = _vm->_events->currentPos() + scene._posAdjust; diff --git a/engines/mads/action.h b/engines/mads/action.h index 3b238c997f..6b3f1ca3c2 100644 --- a/engines/mads/action.h +++ b/engines/mads/action.h @@ -28,9 +28,6 @@ namespace MADS { -enum { ACTIONMODE_NONE = 0, ACTIONMODE_VERB = 1, ACTIONMODE_OBJECT = 3, ACTIONMODE_TALK = 6 }; -enum { ACTIONMODE2_0 = 0, ACTIONMODE2_2 = 2, ACTIONMODE2_4 = 4, ACTIONMODE2_5 = 5 }; - enum TriggerMode { KERNEL_TRIGGER_PARSER = 0, // Triggers parser KERNEL_TRIGGER_DAEMON = 1, // Triggers step/daemon code @@ -67,6 +64,12 @@ enum PrepType { PREP_UNDER, PREP_BEHIND, PREP_RELATIONAL = -1 }; +enum ScrCategory { + CAT_NONE = 0, CAT_COMMAND = 1, CAT_INV_LIST = 2, CAT_INV_VOCAB = 3, + CAT_HOTSPOT = 4, CAT_INV_ANIM = 5, CAT_TALK_ENTRY = 6, CAT_INV_SCROLLER = 7, + CAT_12 = 12 +}; + class MADSEngine; struct ActionDetails { @@ -97,10 +100,6 @@ private: void startWalkingDirectly(int walkType); public: ActionDetails _action, _activeAction; - VerbType _verbType; - PrepType _prepType; - int _commandSource; - int _mainObjectSource; int _articleNumber; bool _lookFlag; int _selectedRow; @@ -111,10 +110,13 @@ public: ActionSavedFields _savedFields; Common::String _sentence; - // Unknown fields + VerbType _verbType; + PrepType _prepType; + ScrCategory _commandSource; + ScrCategory _mainObjectSource; int16 _secondObject; - int16 _secondObjectSource; - int16 _recentCommandSource; + ScrCategory _secondObjectSource; + ScrCategory _recentCommandSource; bool _pointEstablished; int16 _recentCommand; InterAwaiting _interAwaiting; diff --git a/engines/mads/screen.h b/engines/mads/screen.h index 57b53df895..11b81346f1 100644 --- a/engines/mads/screen.h +++ b/engines/mads/screen.h @@ -26,18 +26,13 @@ #include "common/scummsys.h" #include "common/array.h" #include "mads/msurface.h" +#include "mads/action.h" namespace MADS { #define MADS_SCREEN_WIDTH 320 #define MADS_SCREEN_HEIGHT 200 -enum ScrCategory { - CAT_NONE = 0, CAT_COMMAND = 1, CAT_INV_LIST = 2, CAT_INV_VOCAB = 3, - CAT_HOTSPOT = 4, CAT_INV_ANIM = 5, CAT_TALK_ENTRY = 6, CAT_INV_SCROLLER = 7, - CAT_12 = 12 -}; - enum Layer { LAYER_GUI = 19 }; diff --git a/engines/mads/staticres.cpp b/engines/mads/staticres.cpp index 92d2740e2f..396e5a13d2 100644 --- a/engines/mads/staticres.cpp +++ b/engines/mads/staticres.cpp @@ -35,7 +35,6 @@ const char *const kCheatingEnabledDesc[3] = { nullptr }; -const char *const kAtStr = "at"; const char *const kLookAroundStr = "Look around"; const char *const kToStr = "to "; const char *const kUseStr = "Use "; diff --git a/engines/mads/staticres.h b/engines/mads/staticres.h index b4132c8319..0680455028 100644 --- a/engines/mads/staticres.h +++ b/engines/mads/staticres.h @@ -29,7 +29,6 @@ extern const char *const kArticleList[9]; extern const char *const kCheatingEnabledDesc[3]; -extern const char *const kAtStr; extern const char *const kLookAroundStr; extern const char *const kToStr; extern const char *const kUseStr; -- cgit v1.2.3 From 6c2c752d055a448dff4cc42e3504be8550f4e72f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 8 Apr 2014 23:37:16 -0400 Subject: MADS: Fix selecting inventory vocab actions in the user interface --- engines/mads/action.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index b646ca5f2b..f3e1d2db1e 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -426,11 +426,9 @@ void MADSAction::checkActionAtMousePos() { _hotspotId = -1; _mainObjectSource = CAT_NONE; } else { - int objectId = _vm->_game->_objects._inventoryList[_selectedRow]; - InventoryObject &invObject = _vm->_game->_objects[objectId]; - - _verbType = invObject._vocabList[_selectedRow - 2]._verbType; - _prepType = invObject._vocabList[_selectedRow - 2]._prepType; + InventoryObject &invObject = _vm->_game->_objects.getItem(userInterface._selectedInvIndex); + _verbType = invObject._vocabList[_selectedRow + 1]._verbType; + _prepType = invObject._vocabList[_selectedRow + 1]._prepType; _hotspotId = userInterface._selectedInvIndex; _mainObjectSource = CAT_INV_LIST; -- cgit v1.2.3 From 57bd5e0683638869e485b1855345b3a95f40c2da Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 9 Apr 2014 10:41:33 +0200 Subject: MADS: Some refactoring, implement Scene 211 --- engines/mads/hotspots.cpp | 3 +- engines/mads/nebular/nebular_scenes.cpp | 2 + engines/mads/nebular/nebular_scenes2.cpp | 296 +++++++++++++++++++++++++++++-- engines/mads/nebular/nebular_scenes2.h | 21 ++- engines/mads/sequence.h | 1 + 5 files changed, 302 insertions(+), 21 deletions(-) diff --git a/engines/mads/hotspots.cpp b/engines/mads/hotspots.cpp index baae4a9629..a5b56eec93 100644 --- a/engines/mads/hotspots.cpp +++ b/engines/mads/hotspots.cpp @@ -59,8 +59,7 @@ int DynamicHotspots::add(int descId, int vocabId, int seqIndex, const Common::Re _entries[idx]._descId = descId; _entries[idx]._seqIndex = seqIndex; _entries[idx]._bounds = bounds; - _entries[idx]._feetPos.x = -3; - _entries[idx]._feetPos.y = 0; + _entries[idx]._feetPos = Common::Point(-3, 0); _entries[idx]._facing = FACING_NONE; _entries[idx]._vocabId = vocabId; _entries[idx]._articleNumber = 6; diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 67a75c37b5..a3a1433062 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -67,6 +67,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene209(vm); case 210: return new Scene210(vm); + case 211: + return new Scene211(vm); // Scene group #8 case 804: diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index b7b2b800de..5c966cf664 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -121,10 +121,9 @@ void Scene201::setup() { setPlayerSpritesPrefix(); setAAName(); - Scene &scene = _vm->_game->_scene; - scene.addActiveVocab(NOUN_15F); - scene.addActiveVocab(NOUN_487); - scene.addActiveVocab(NOUN_D); + _scene->addActiveVocab(NOUN_15F); + _scene->addActiveVocab(NOUN_487); + _scene->addActiveVocab(NOUN_D); } void Scene201::enter() { @@ -331,13 +330,12 @@ void Scene202::setup() { setPlayerSpritesPrefix(); setAAName(); - Scene &scene = _vm->_game->_scene; - scene.addActiveVocab(NOUN_C7); - scene.addActiveVocab(NOUN_4E); - scene.addActiveVocab(NOUN_D); - scene.addActiveVocab(NOUN_2C); - scene.addActiveVocab(NOUN_140); - scene.addActiveVocab(NOUN_1C9); + _scene->addActiveVocab(NOUN_C7); + _scene->addActiveVocab(NOUN_4E); + _scene->addActiveVocab(NOUN_D); + _scene->addActiveVocab(NOUN_2C); + _scene->addActiveVocab(NOUN_140); + _scene->addActiveVocab(NOUN_1C9); } void Scene202::enter() { @@ -1181,11 +1179,7 @@ void Scene205::step() { warning("TODO: sub7178C()"); if (_globals._frameTime >= _chickenTime) { - warning("minVal = 1 + sub7176C();"); - int minVal = 1; - - warning("TODO: sub717B2(100, minVal);"); -// if (sub717B2(100, minVal)) { + warning("TODO: if (sub717B2(100, 1 + sub7176C()))"); _vm->_sound->command(28); // } _chickenTime = _globals._frameTime + 2; @@ -2808,7 +2802,7 @@ void Scene209::step() { switch (_game._trigger) { case 228: _game._player._visible = false; - _globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle (_globals._spriteIndexes[2], false, 8, 1, 0, 0); + _globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._spriteIndexes[17], 1, 7); _scene->_sequences.setMsgPosition(_globals._spriteIndexes[17], Common::Point(116, 131)); _scene->_sequences.setDepth(_globals._spriteIndexes[17], 4); @@ -4220,7 +4214,7 @@ void Scene210::actions() { _scene->_sequences.remove(_globals._spriteIndexes[8]); _game._player._stepEnabled = false; _game._player._facing = FACING_NORTH; - _globals._spriteIndexes[8] = _scene->_sequences.addSpriteCycle (_globals._spriteIndexes[1], false, 12, 0, 0, 1); + _globals._spriteIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 12, 0, 0, 1); _scene->_sequences.setDepth(_globals._spriteIndexes[8], 5); _scene->_sequences.addSubEntry(_globals._spriteIndexes[8], SM_0, 0, 1); _game._player._stepEnabled = false; @@ -4332,5 +4326,271 @@ void Scene210::actions() { } } +/*------------------------------------------------------------------------*/ + +void Scene211::setup() { + setPlayerSpritesPrefix(); + setAAName(); + + _scene->addActiveVocab(0x144); +} + +void Scene211::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites("*SC002Z2", false); + _wakeFl = false; + + if (_scene->_priorSceneId == 210) + _game._player._playerPos = Common::Point(25, 148); + else if (_scene->_priorSceneId == 205) { + _game._player._playerPos = Common::Point(49, 133); + _game._player._facing = FACING_WEST; + _wakeFl = true; + _game._player._stepEnabled = false; + _game._player._visible = false; + _scene->loadAnimation(formAnimName('A', -1), 100); + _scene->_activeAnimation->setCurrentFrame(169); + } else if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(310, 31); + _game._player._facing = FACING_SOUTHWEST; + } + + if (_vm->getRandomNumber(1, 8) == 1) { + _globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 6, 0, 0, 0); + _scene->_sequences.setMsgPosition(_globals._spriteIndexes[17], Common::Point(202, 126)); + _scene->_sequences.setDepth(_globals._spriteIndexes[17], 8); + _scene->_sequences.sub70C52(_globals._spriteIndexes[17], SM_FRAME_INDEX, -200, 0); + _scene->_dynamicHotspots.add(324, 13, _globals._spriteIndexes[17], Common::Rect(1, 1, 41, 10)); + } + + if (_scene->_roomChanged) + _game._objects.addToInventory(OBJ_BINOCULARS); + + _vm->_palette->setEntry(252, 63, 44, 30); + _vm->_palette->setEntry(253, 63, 20, 22); + _game.loadQuoteSet(0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 1, 0); + + if (_globals[kMonkeyStatus] == MONKEY_AMBUSH_READY) + warning("sub71704(0x2, 0x0, 0x36, 0x0, 0x1E, 0xD, 2, 0xFDFC, 0x3C, 0x97, 0x98, 0x99, 0x9A, 0);"); + + _monkeyTime = _globals._frameTime; + _scrollY = 30; + + _ambushFl = false; + _monkeyFrame = 0; + + sceneEntrySound(); +} + +void Scene211::step() { + if (_globals[kMonkeyStatus] == MONKEY_AMBUSH_READY) { + warning("TODO: sub7178C()"); + + if (!_ambushFl && !_wakeFl && (_globals._frameTime >= _monkeyTime)) { + warning("if (sub717B2(80, 1 + sub7176C())) {"); + _vm->_sound->command(18); + // } + _monkeyTime = _globals._frameTime + 2; + } + + if ((_game._player._playerPos == Common::Point(52, 132)) && (_game._player._facing == FACING_WEST) && !_game._player._moving && + (_game._trigger || !_ambushFl)) { + switch (_game._trigger) { + case 0: + if (_game._objects.isInInventory(OBJ_BINOCULARS)) { + _ambushFl = true; + _monkeyFrame = 0; + _game._player._stepEnabled = false; + _game._player._visible = false; + _scene->_kernelMessages.reset(); + _scene->loadAnimation(formAnimName('A', -1), 90); + _vm->_sound->command(19); + int count = (int)_game._objects._inventoryList.size(); + for (int idx = 0; idx < count; idx++) { + if ((_game._objects._inventoryList[idx] == OBJ_BINOCULARS) && (_scene->_userInterface._selectedInvIndex != idx)) + _scene->_userInterface.selectObject(idx); + } + } + break; + + case 90: + _vm->_sound->command(10); + _game._player._stepEnabled = true; + _game._player._visible = true; + _game._player._playerPos = Common::Point(49, 133); + _ambushFl = false; + _globals[kMonkeyStatus] = MONKEY_HAS_BINOCULARS; + break; + } + } + } + + if (_ambushFl && (_scene->_activeAnimation->getCurrentFrame() > _monkeyFrame)) { + _monkeyFrame = _scene->_activeAnimation->getCurrentFrame(); + switch (_monkeyFrame) { + case 2: { + int msgIndex = _scene->_kernelMessages.add(Common::Point(12, 4), 0xFDFC, 0, 0, 60, _game.getQuote(157)); + _scene->_kernelMessages.setQuoted(msgIndex, 2, true); + } + break; + + case 12: { + int msgIndex = _scene->_kernelMessages.add(Common::Point(35, 20), 0xFDFC, 0, 0, 60, _game.getQuote(155)); + _scene->_kernelMessages.setQuoted(msgIndex, 4, true); + } + break; + + case 42: { + int msgIndex = _scene->_kernelMessages.add(Common::Point(60, 45), 0xFDFC, 0, 0, 60, _game.getQuote(156)); + _scene->_kernelMessages.setQuoted(msgIndex, 6, true); + } + break; + + case 73: + _scene->_kernelMessages.add(Common::Point(102, 95), 0xFDFC, 32, 0, 75, _game.getQuote(157)); + break; + + case 90: { + int msgIndex = _scene->_kernelMessages.add(Common::Point(102, 95), 0xFDFC, 32, 0, 60, _game.getQuote(158)); + _scene->_kernelMessages.setQuoted(msgIndex, 6, true); + } + break; + + case 97: + _scene->_userInterface.selectObject(-1); + _game._objects.removeFromInventory(OBJ_BINOCULARS, 1); + break; + + case 177: { + int msgIndex = _scene->_kernelMessages.add(Common::Point(63, _scrollY), 0x1110, 0, 0, 180, _game.getQuote(161)); + _scene->_kernelMessages.setQuoted(msgIndex, 4, true); + _scrollY += 14; + } + break; + + case 181: { + int msgIndex = _scene->_kernelMessages.add(Common::Point(63, _scrollY), 0x1110, 0, 0, 180, _game.getQuote(162)); + _scene->_kernelMessages.setQuoted(msgIndex, 4, true); + _scrollY += 14; + } + break; + + case 188: { + int msgIndex = _scene->_kernelMessages.add(Common::Point(63, _scrollY), 0x1110, 0, 0, 180, _game.getQuote(163)); + _scene->_kernelMessages.setQuoted(msgIndex, 4, true); + _scrollY += 14; + } + break; + + case 200: { + int msgIndex = _scene->_kernelMessages.add(Common::Point(63, _scrollY), 0x1110, 0, 0, 180, _game.getQuote(164)); + _scene->_kernelMessages.setQuoted(msgIndex, 4, true); + _scrollY += 14; + } + break; + } + } + + if (_wakeFl) { + if (_game._trigger == 100) { + _game._player._visible = true; + _game._player._stepEnabled = true; + _wakeFl = false; + } + + if (_scene->_activeAnimation->getCurrentFrame() > _monkeyFrame) { + _monkeyFrame = _scene->_activeAnimation->getCurrentFrame(); + switch (_scene->_activeAnimation->getCurrentFrame()) { + case 177: { + int msgIndex = _scene->_kernelMessages.add(Common::Point(63, _scrollY), 0x1110, 0, 0, 180, _game.getQuote(165)); + _scene->_kernelMessages.setQuoted(msgIndex, 4, true); + _scrollY += 14; + } + break; + + case 181: { + int msgIndex = _scene->_kernelMessages.add(Common::Point(63, _scrollY), 0x1110, 0, 0, 180, _game.getQuote(166)); + _scene->_kernelMessages.setQuoted(msgIndex, 4, true); + _scrollY += 14; + } + break; + + case 188: { + int msgIndex = _scene->_kernelMessages.add(Common::Point(63, _scrollY), 0x1110, 0, 0, 180, _game.getQuote(167)); + _scene->_kernelMessages.setQuoted(msgIndex, 4, true); + _scrollY += 14; + } + break; + + case 200: { + int msgIndex = _scene->_kernelMessages.add(Common::Point(63, _scrollY), 0x1110, 0, 0, 180, _game.getQuote(168)); + _scene->_kernelMessages.setQuoted(msgIndex, 4, true); + _scrollY += 14; + } + break; + } + } + } +} + +void Scene211::preActions() { + if (_action.isAction(0x1AD, 0x1B2) && _game._objects.isInInventory(OBJ_BINOCULARS) && (_globals[kMonkeyStatus] == MONKEY_AMBUSH_READY) + && (_scene->_customDest.x <= 52) && (_scene->_customDest.y >= 132)) + _game._player.walk(Common::Point(52, 132), FACING_WEST); + + if (_action.isAction(0x1AD, 0x1AE)) { + if (_game._objects.isInInventory(OBJ_BINOCULARS) && (_globals[kMonkeyStatus] == MONKEY_AMBUSH_READY) ) { + _game._player.walk(Common::Point(52, 132), FACING_WEST); + } else { + _game._player._walkOffScreenSceneId = 210; + } + } + + if (_action.isAction(0x1AD, 0x1B1)) + _game._player._walkOffScreenSceneId = 207; +} + +void Scene211::actions() { + if (_action._lookFlag && (_globals[kMonkeyStatus] == MONKEY_AMBUSH_READY)) { + _vm->_dialogs->show(0x5277); + } else if (_action.isAction(VERB_LOOK, 0x27, 0x100)) { + _vm->_dialogs->show(0x527C); + } else if (_action.isAction(VERB_LOOK, 0x3A)) { + _vm->_dialogs->show(0x526D); + } else if (_action.isAction(VERB_LOOK, 0x1B2)) { + _vm->_dialogs->show(0x526E); + } else if (_action.isAction(VERB_LOOK, 0x100)) { + if (_globals[kMonkeyStatus] == MONKEY_AMBUSH_READY) { + if (_game._storyMode == STORYMODE_NAUGHTY) + _vm->_dialogs->show(0x526F); + else + _vm->_dialogs->show(0x5270); + } else { + _vm->_dialogs->show(0x5271); + } + } else if (_action.isAction(VERB_LOOK, 0x1B3)) { + if (_game._storyMode == STORYMODE_NAUGHTY) + _vm->_dialogs->show(0x5272); + else + _vm->_dialogs->show(0x5273); + } else if (_action.isAction(VERB_LOOK, 0xB8)) { + _vm->_dialogs->show(0x5274); + } else if (_action.isAction(VERB_LOOK, 0x1B1)) { + _vm->_dialogs->show(0x5275); + } else if (_action.isAction(VERB_LOOK, 0x1AE)) { + _vm->_dialogs->show(0x5276); + } else if (_action.isAction(VERB_LOOK, 0x144)) { + _vm->_dialogs->show(0x5279); + } else if (_action.isAction(VERB_TAKE, 0x144)) { + _vm->_dialogs->show(0x527A); + } else if (_action.isAction(VERB_LOOK, 0x129)) { + _vm->_dialogs->show(0x527B); + } else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index fb097350ef..494556315d 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -228,7 +228,9 @@ private: void initNode(int node); void restoreDialogNode(int node, int msgId, int posY); public: - Scene210(MADSEngine *vm) : Scene2xx(vm) {} + Scene210(MADSEngine *vm) : Scene2xx(vm), _curDialogNode(-1), _nextHandsPlace(0), _twinkleAnimationType(0), _twinklesCurrentFrame(0), + _shouldTalk(false), _shouldFaceRex(false), _shouldMoveHead(false), _stopWalking(false), _twinklesTalking(false), + _twinklesTalk2(false), _doorway(0), _subQuote2("") {} virtual void setup(); virtual void enter(); virtual void step(); @@ -236,6 +238,23 @@ public: virtual void actions(); virtual void postActions() {}; }; + +class Scene211: public Scene2xx { +private: + bool _ambushFl, _wakeFl; + int _monkeyFrame, _scrollY; + uint32 _monkeyTime; + +public: + Scene211(MADSEngine *vm) : Scene2xx(vm) {} + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/sequence.h b/engines/mads/sequence.h index 8db06d5985..6d12367fd9 100644 --- a/engines/mads/sequence.h +++ b/engines/mads/sequence.h @@ -121,6 +121,7 @@ public: void updateTimeout(int spriteIdx, int seqIndex); void setScale(int spriteIdx, int scale); void setMsgLayout(int seqIndex); + void sub70C52(int seqIndex, int flags, int deltaX, int deltaY) { warning("TODO: sub70C52()"); } }; } // End of namespace MADS -- cgit v1.2.3 From 2368ab78865f251184908d523edeab34514e08ed Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 9 Apr 2014 10:42:55 +0200 Subject: MADS: Initialize variables used by Scene 211 --- engines/mads/nebular/nebular_scenes2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index 494556315d..738c61fe5c 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -246,7 +246,7 @@ private: uint32 _monkeyTime; public: - Scene211(MADSEngine *vm) : Scene2xx(vm) {} + Scene211(MADSEngine *vm) : Scene2xx(vm), _ambushFl(false), _wakeFl(false), _monkeyFrame(0), _scrollY(0), _monkeyTime(0) {} virtual void setup(); virtual void enter(); virtual void step(); -- cgit v1.2.3 From 8df08335462db8fc692f18c9dc5bb4293019d2f6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 9 Apr 2014 09:32:14 -0400 Subject: MADS: Fixes for correctly displaying inventory list in the user interface --- engines/mads/game.cpp | 4 +-- engines/mads/inventory.cpp | 2 +- engines/mads/screen.cpp | 10 +++++--- engines/mads/user_interface.cpp | 54 +++++++++++++++++++++++++++++++---------- engines/mads/user_interface.h | 12 ++++++--- 5 files changed, 58 insertions(+), 24 deletions(-) diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index eb7ba62fbd..e2e956e8cb 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -208,8 +208,8 @@ void Game::sectionLoop() { _vm->_events->initVars(); _scene._userInterface._highlightedCommandIndex = -1; - _scene._userInterface._highlightedItemIndex = -1; - _scene._userInterface._highlightedActionIndex = -1; + _scene._userInterface._highlightedInvIndex = -1; + _scene._userInterface._highlightedItemVocabIndex = -1; _scene._action.clear(); _player.setFinalFacing(); diff --git a/engines/mads/inventory.cpp b/engines/mads/inventory.cpp index 607179a3c2..0795233f6c 100644 --- a/engines/mads/inventory.cpp +++ b/engines/mads/inventory.cpp @@ -110,7 +110,7 @@ void InventoryObjects::addToInventory(int objectId) { userInterface._inventoryTopIndex = CLIP(userInterface._inventoryTopIndex, 0, (int)_inventoryList.size() - 1); - if ((userInterface._inventoryTopIndex + 5) <= ((int) size() - 1)) + if ((userInterface._inventoryTopIndex + 5) < (int)_inventoryList.size()) userInterface._inventoryTopIndex = size() - 5; userInterface._inventoryChanged = true; diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index 5553f61a11..519dcabccd 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -131,11 +131,13 @@ void DirtyArea::setUISlot(const UISlot *slot) { _bounds.top = 0; setArea(intSurface.w, intSurface.h, intSurface.w, intSurface.h); break; + case IMG_OVERPRINT: _bounds.left = slot->_position.x; _bounds.top = slot->_position.y; - // TODO: spritesIndex & frameNumber used as w & h??! - error("TODO: Figure out IMG_OVERPRINT. Maybe need a union?"); + _bounds.setWidth(slot->_width); + _bounds.setHeight(slot->_height); + setArea(slot->_width, slot->_height, intSurface.w, intSurface.h); break; default: { @@ -491,7 +493,7 @@ void ScreenObjects::elementHighlighted() { indexEnd = invList.size() - 1; varA = 0; topIndex = userInterface._inventoryTopIndex; - idxP = &userInterface._highlightedItemIndex; + idxP = &userInterface._highlightedInvIndex; var4 = (!_released || (_vm->_events->_mouseButtons && action._interAwaiting == 1)) ? 0 : 1; break; @@ -507,7 +509,7 @@ void ScreenObjects::elementHighlighted() { varA = 0; topIndex = 0; - idxP = _vm->_events->_rightMousePressed ? &userInterface._selectedItemVocabIdx : &userInterface._highlightedActionIndex; + idxP = _vm->_events->_rightMousePressed ? &userInterface._selectedItemVocabIdx : &userInterface._highlightedItemVocabIndex; if (_vm->_events->_rightMousePressed && userInterface._selectedActionIndex >= 0) userInterface.updateSelection(CAT_COMMAND, -1, &userInterface._selectedActionIndex); diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 8d05402b46..941606677d 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -32,6 +32,7 @@ UISlot::UISlot() { _segmentId = 0; _spritesIndex = 0; _frameNumber = 0; + _width = _height = 0; } /*------------------------------------------------------------------------*/ @@ -44,15 +45,15 @@ void UISlots::fullRefresh() { push_back(slot); } -void UISlots::add(const Common::Point &pt, int frameNumber, int spritesIndex) { +void UISlots::add(const Common::Rect &bounds) { assert(size() < 50); UISlot ie; ie._flags = IMG_OVERPRINT; ie._segmentId = IMG_TEXT_UPDATE; - ie._position = pt; - ie._frameNumber = frameNumber; - ie._spritesIndex = spritesIndex; + ie._position = Common::Point(bounds.left, bounds.top); + ie._width = bounds.width(); + ie._height = bounds.height(); push_back(ie); } @@ -213,8 +214,8 @@ UserInterface::UserInterface(MADSEngine *vm) : _vm(vm), _dirtyAreas(vm), _selectedItemVocabIdx = -1; _scrollerY = 0; _highlightedCommandIndex = -1; - _highlightedItemIndex = -1; - _highlightedActionIndex = -1; + _highlightedInvIndex = -1; + _highlightedItemVocabIndex = -1; _dirtyAreas.resize(50); _inventoryChanged = false; Common::fill(&_categoryIndexes[0], &_categoryIndexes[7], 0); @@ -279,8 +280,8 @@ void UserInterface::setup(InputMode inputMode) { scene._userInterface._uiSlots.fullRefresh(); _vm->_game->_screenObjects._baseTime = _vm->_events->getFrameCounter(); _highlightedCommandIndex = -1; - _highlightedActionIndex = -1; - _highlightedItemIndex = -1; + _highlightedItemVocabIndex = -1; + _highlightedInvIndex = -1; if (_vm->_game->_kernelMode == KERNEL_ACTIVE_CODE) scene._userInterface._uiSlots.draw(false, false); @@ -358,7 +359,7 @@ void UserInterface::writeVocab(ScrCategory category, int id) { case CAT_INV_LIST: font = _vm->_font->getFont(FONT_INTERFACE); vocabId = _vm->_game->_objects.getItem(id)._descId; - if (id == _highlightedItemIndex) { + if (id == _highlightedInvIndex) { _vm->_font->setColorMode(SELMODE_HIGHLIGHTED); } else { _vm->_font->setColorMode(id == _selectedInvIndex ? SELMODE_SELECTED : SELMODE_UNSELECTED); @@ -399,7 +400,7 @@ void UserInterface::writeVocab(ScrCategory category, int id) { // Item specific verbs font = _vm->_font->getFont(FONT_INTERFACE); vocabId = _vm->_game->_objects.getItem(_selectedInvIndex)._vocabList[id]._vocabId; - if (id == _highlightedActionIndex) { + if (id == _highlightedItemVocabIndex) { _vm->_font->setColorMode(SELMODE_HIGHLIGHTED); } else { _vm->_font->setColorMode(id == _selectedInvIndex ? SELMODE_SELECTED : SELMODE_UNSELECTED); @@ -714,13 +715,40 @@ void UserInterface::doBackgroundAnimation() { } void UserInterface::categoryChanged() { - _highlightedItemIndex = -1; + _highlightedInvIndex = -1; _vm->_events->initVars(); _category = CAT_NONE; } void UserInterface::selectObject(int invIndex) { - warning("TODO: selectObject"); + if (_selectedInvIndex != invIndex || _inventoryChanged) { + int oldVocabCount = _selectedInvIndex < 0 ? 0 : _vm->_game->_objects.getItem(_selectedInvIndex)._vocabCount; + int newVocabCount = invIndex < 0 ? 0 : _vm->_game->_objects.getItem(invIndex)._vocabCount; + int maxVocab = MAX(oldVocabCount, newVocabCount); + + updateSelection(CAT_INV_LIST, invIndex, &_selectedInvIndex); + _highlightedItemVocabIndex = -1; + _selectedItemVocabIdx = -1; + + if (maxVocab) { + assert(_uiSlots.size() < 50); + int vocabHeight = maxVocab * 8; + + Common::Rect bounds(240, 3, 240 + 80, 3 + vocabHeight); + _uiSlots.add(bounds); + _uiSlots.draw(false, false); + drawItemVocabList(); + updateRect(bounds); + } + } + + if (invIndex == -1) { + noInventoryAnim(); + } else { + loadInventoryAnim(_vm->_game->_objects._inventoryList[invIndex]); + _vm->_palette->setPalette(_vm->_palette->_mainPalette, 7, 1); + _vm->_palette->setPalette(_vm->_palette->_mainPalette, 246, 2); + } } void UserInterface::updateSelection(ScrCategory category, int newIndex, int *idx) { @@ -730,7 +758,7 @@ void UserInterface::updateSelection(ScrCategory category, int newIndex, int *idx if (category == CAT_INV_LIST && _inventoryChanged) { *idx = newIndex; bounds = Common::Rect(90, 3, 90 + 69, 3 + 40); - _uiSlots.add(Common::Point(90, 3), 69, 40); + _uiSlots.add(bounds); _uiSlots.draw(false, false); drawInventoryList(); updateRect(bounds); diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h index 6b3abf02f8..46ba478f5b 100644 --- a/engines/mads/user_interface.h +++ b/engines/mads/user_interface.h @@ -42,6 +42,10 @@ public: int _spritesIndex; int _frameNumber; Common::Point _position; + + // Only used for IMG_OVERPRINT + int _width; + int _height; UISlot(); }; @@ -59,9 +63,9 @@ public: UISlots(MADSEngine *vm) : _vm(vm) {} /** - * Add a sprite to the list + * Add an overprint (text) entry to the list */ - void add(const Common::Point &pt, int frameNumber, int spritesIndex); + void add(const Common::Rect &bounds); /** * Loads the data from an aimation frame entry @@ -155,8 +159,8 @@ public: int _selectedItemVocabIdx; int _scrollerY; int _highlightedCommandIndex; - int _highlightedItemIndex; - int _highlightedActionIndex; + int _highlightedInvIndex; + int _highlightedItemVocabIndex; bool _inventoryChanged; int _categoryIndexes[8]; Common::StringArray _talkStrings; -- cgit v1.2.3 From ee7e7e68343b65ec76eea986075bc0b753386546 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 9 Apr 2014 19:39:03 +0200 Subject: MADS: Implement scene 212 --- engines/mads/nebular/nebular_scenes.cpp | 2 ++ engines/mads/nebular/nebular_scenes2.cpp | 61 ++++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes2.h | 10 ++++++ 3 files changed, 73 insertions(+) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index a3a1433062..0077b5f427 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -69,6 +69,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene210(vm); case 211: return new Scene211(vm); + case 212: + return new Scene212(vm); // Scene group #8 case 804: diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 5c966cf664..77e5234109 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -4592,5 +4592,66 @@ void Scene211::actions() { /*------------------------------------------------------------------------*/ +void Scene212::setup() { + setPlayerSpritesPrefix(); + setAAName(); + + _scene->addActiveVocab(0x19D); +} + +void Scene212::enter() { + // CHECKME: Some useless variables have been remove here + + if (_scene->_priorSceneId == 208) { + _game._player._playerPos = Common::Point(195, 85); + _game._player._facing = FACING_SOUTH; + } else if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(67, 117); + _game._player._facing = FACING_NORTHEAST; + } + + sceneEntrySound(); +} + +void Scene212::step() { +// CHECKME: Could we move the dino? +} + +void Scene212::preActions() { + if (_action.isAction(0x18B, 0x41)) + _game._player._walkOffScreenSceneId = 111; +} + +void Scene212::actions() { + if (_action._lookFlag) + _vm->_dialogs->show(0x52D9); + else if (_action.isAction(0x18C) && (_action.isAction(0x82) || _action.isAction(0xE8))) + _scene->_nextSceneId = 208; + else if (_action.isAction(0x18C, 0x3F)) + _scene->_nextSceneId = 111; + else if (_action.isAction(VERB_LOOK, 0x19C)) + _vm->_dialogs->show(0x52D1); + else if (_action.isAction(VERB_LOOK, 0x129)) + _vm->_dialogs->show(0x52D2); + else if (_action.isAction(VERB_LOOK, 0x41)) + _vm->_dialogs->show(0x52D3); + else if (_action.isAction(VERB_LOOK, 0x142)) + _vm->_dialogs->show(0x52D4); + else if (_action.isAction(VERB_LOOK, 0x82)) + _vm->_dialogs->show(0x52D5); + else if (_action.isAction(VERB_LOOK, 0x175)) + _vm->_dialogs->show(0x52D6); + else if (_action.isAction(VERB_LOOK, 0x110)) + _vm->_dialogs->show(0x52D7); + else if (_action.isAction(VERB_LOOK, 0xE8)) + _vm->_dialogs->show(0x52D8); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index 738c61fe5c..0b446bbeb1 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -255,6 +255,16 @@ public: virtual void postActions() {}; }; +class Scene212: public Scene2xx { +public: + Scene212(MADSEngine *vm) : Scene2xx(vm) {} + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 266c8952508c47bff05d10d0945459c634669f73 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 9 Apr 2014 20:38:21 -0400 Subject: MADS: Fix wear response for rebreather --- engines/mads/nebular/game_nebular.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index d8b00bcf54..467f3c3c6b 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -296,7 +296,7 @@ void GameNebular::doObjectAction() { } else if (action.isAction(NOUN_EAT, NOUN_STUFFED_FISH)) { dialogs.show(445); } else if (action.isAction(401, 289)) { - dialogs.show(scene._currentSceneId > 103 && scene._currentSceneId < 111 ? 447 : 446); + dialogs.show(scene._currentSceneId > 103 && scene._currentSceneId < 111 ? 446 : 447); } else if (action.isAction(306, 371)) { dialogs.show(448); } else if (action.isAction(951, 35)) { -- cgit v1.2.3 From 90a030c35279294b28d828d7e4a12cd7b7f6c2da Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 10 Apr 2014 09:58:24 +0200 Subject: MADS: Implement Scene 101 --- engines/mads/nebular/nebular_scenes.cpp | 4 + engines/mads/nebular/nebular_scenes1.cpp | 509 ++++++++++++++++++++++++++++++- engines/mads/nebular/nebular_scenes1.h | 26 +- 3 files changed, 537 insertions(+), 2 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 0077b5f427..6528afe32c 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -47,6 +47,10 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { switch (scene._nextSceneId) { // Scene group #1 + case 101: + return new Scene101(vm); + case 102: + return new Scene102(vm); case 103: return new Scene103(vm); diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index f56f5d3fe8..5064795d33 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -100,21 +100,528 @@ void Scene1xx::setPlayerSpritesPrefix() { /*------------------------------------------------------------------------*/ void Scene101::setup() { + _scene->_animationData->preLoad(formAnimName('A', -1), 3); + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene101::sayDang() { + _game._triggerSetupMode = KERNEL_TRIGGER_DAEMON; + _game._player._stepEnabled = false; + + switch (_game._trigger) { + case 0: + _scene->_sequences.remove(_globals._spriteIndexes[26]); + _globals._spriteIndexes[26] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[11], false, 3, 6, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[26], 17, 21); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[26], SM_0, 0, 72); + _vm->_sound->command(17); + _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 3, 2, 0, 0); + break; + + case 72: + _globals._spriteIndexes[26] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[11], false, 6, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[26], 17, 17); + _scene->_kernelMessages.add(Common::Point(143, 61), 0x1110, 0, 0, 60, _game.getQuote(57)); + _scene->_sequences.addTimer(120, 73); + break; + + case 73: + _vm->_dialogs->show(0x2785); + _game._player._stepEnabled = true; + break; + } } void Scene101::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 1), false); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 2), false); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 3), false); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('x', 4), false); + _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('x', 5), false); + _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('x', 6), false); + _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('x', 7), false); + _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('m', -1), false); + _globals._spriteIndexes[9] = _scene->_sprites.addSprites(formAnimName('b', 1), false); + _globals._spriteIndexes[10] = _scene->_sprites.addSprites(formAnimName('b', 2), false); + _globals._spriteIndexes[11] = _scene->_sprites.addSprites(formAnimName('a', 0), false); + _globals._spriteIndexes[12] = _scene->_sprites.addSprites(formAnimName('a', 1), false); + _globals._spriteIndexes[13] = _scene->_sprites.addSprites(formAnimName('x', 8), false); + _globals._spriteIndexes[14] = _scene->_sprites.addSprites(formAnimName('x', 0), false); + + _globals._spriteIndexes[16] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 5, 0, 0, 25); + _globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 4, 0, 1, 0); + _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 6, 0, 2, 0); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_FRAME_INDEX, 7, 70); + _globals._spriteIndexes[19] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[4], false, 10, 0, 0, 60); + _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 5, 0, 1, 0); + _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 10, 0, 2, 0); + _globals._spriteIndexes[22] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 6, 0, 0, 0); + _globals._spriteIndexes[24] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 6, 0, 10, 4); + _globals._spriteIndexes[25] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[10], false, 6, 0, 32, 47); + + _scene->_hotspots.activate(0x137, false); + _panelOpened = false; + + if (_scene->_priorSceneId != -1) + _globals[kNeedToStandUp] = false; + + if (_scene->_priorSceneId != -2) + _game._player._playerPos = Common::Point(100, 152); + + if ((_scene->_priorSceneId == 112) || ((_scene->_priorSceneId == -2) && _sittingFl )) { + _game._player._visible = false; + _sittingFl = true; + _game._player._playerPos = Common::Point(161, 123); + _game._player._facing = FACING_NORTHEAST; + _globals._spriteIndexes[26] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[11], false, 3, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[26], 17, 17); + _scene->_hotspots.activate(0x47, false); + _chairHotspotId = _scene->_dynamicHotspots.add(0x47, 0x13F, -1, Common::Rect(159, 84, 33, 36)); + if (_scene->_priorSceneId == 112) + sayDang(); + } else { + _globals._spriteIndexes[27] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[12], false, 6, 0, 0, 0); + _scene->_sequences.setDepth(_globals._spriteIndexes[27], 4); + } + + _game.loadQuoteSet(0x31, 0x32, 0x39, 0x36, 0x37, 0x38, 0); + + if (_globals[10]) { + _scene->loadAnimation(Resources::formatName(101, 'S', -1, EXT_AA, ""), 71); + _game._player._visible = false; + _game._player._stepEnabled = false; + _game._player._playerPos = Common::Point(68, 140); + _game._player._facing = FACING_WEST; + + _messageNum = 0; + _posY = 30; + } + + _oldSpecial = false; + + sceneEntrySound(); } void Scene101::step() { + if (_oldSpecial != _game._player._special) { + _oldSpecial = _game._player._special; + if (_oldSpecial) + _vm->_sound->command(39); + else + _vm->_sound->command(11); + } + + switch (_game._trigger) { + case 70: + _vm->_sound->command(9); + break; + + case 71: + _globals[10] = false; + _game._player._visible = true; + _game._player._stepEnabled = true; + _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; + break; + + case 72: + case 73: + sayDang(); + break; + } + + if (_scene->_activeAnimation != nullptr) { + if ((_scene->_activeAnimation->getCurrentFrame() >= 6) && (_messageNum == 0)) { + _messageNum++; + _scene->_kernelMessages.add(Common::Point(63, _posY), 0x1110, 0, 0, 240, _game.getQuote(49)); + _posY += 14; + } + + if ((_scene->_activeAnimation->getCurrentFrame() >= 7) && (_messageNum == 1)) { + _messageNum++; + _scene->_kernelMessages.add(Common::Point(63, _posY), 0x1110, 0, 0, 240, _game.getQuote(54)); + _posY += 14; + } + + if ((_scene->_activeAnimation->getCurrentFrame() >= 10) && (_messageNum == 2)) { + _messageNum++; + _scene->_kernelMessages.add(Common::Point(63, _posY), 0x1110, 0, 0, 240, _game.getQuote(55)); + _posY += 14; + } + + if ((_scene->_activeAnimation->getCurrentFrame() >= 17) && (_messageNum == 3)) { + _messageNum++; + _scene->_kernelMessages.add(Common::Point(63, _posY), 0x1110, 0, 0, 240, _game.getQuote(56)); + _posY += 14; + } + + if ((_scene->_activeAnimation->getCurrentFrame() >= 20) && (_messageNum == 4)) { + _messageNum++; + _scene->_kernelMessages.add(Common::Point(63, _posY), 0x1110, 0, 0, 240, _game.getQuote(50)); + _posY += 14; + } + } } void Scene101::preActions() { + if (_action.isAction(VERB_LOOK, 0x180)) + _game._player._needToWalk = true; + + if (_sittingFl) { + if (_action.isAction(VERB_LOOK) || _action.isAction(0x47) || _action.isAction(VERB_TALKTO) || _action.isAction(0x103) || _action.isAction(0x7D)) + _game._player._needToWalk = false; + + if (_game._player._needToWalk) { + switch (_game._trigger) { + case 0: + _game._player._needToWalk = false; + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._spriteIndexes[26]); + _globals._spriteIndexes[26] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[11], false, 3, 1, 0, 0); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[26], SM_0, 0, 1); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[26], 1, 17); + _vm->_sound->command(16); + break; + + case 1: + _sittingFl = false; + _game._player._visible = true; + _game._player._stepEnabled = true; + _game._player._needToWalk = true; + _scene->_hotspots.activate(71, true); + _scene->_dynamicHotspots.remove(_chairHotspotId); + _globals._spriteIndexes[27] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[12], false, 6, 0, 0, 0); + _scene->_sequences.setDepth(_globals._spriteIndexes[27], 4); + break; + } + } + } + + if (_panelOpened && !(_action.isAction(0x135) || _action.isAction(0x137))) { + switch (_game._trigger) { + case 0: + if (_game._player._needToWalk) { + _scene->_sequences.remove(_globals._spriteIndexes[28]); + _shieldSpriteIdx = _game._objects.isInRoom(0x18) ? 13 : 14; + _globals._spriteIndexes[28] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[_shieldSpriteIdx], false, 6, 1, 0, 0); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[28], SM_0, 0, 1); + _game._player._stepEnabled = false; + _vm->_sound->command(20); + } + break; + + case 1: + _game._player._stepEnabled = true; + _panelOpened = false; + _scene->_hotspots.activate(0x137, false); + break; + } + } } void Scene101::actions() { + if (_action._lookFlag) { + _vm->_dialogs->show(0x278D); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_WALKTO, 0xCC)) { + _scene->_nextSceneId = 102; + _action._inProgress = false; + return; + } + + if (_action.isAction(0x13F, 0x47) || (_action.isAction(VERB_LOOK, 0x180) && !_sittingFl)) { + if (!_sittingFl) { + switch (_game._trigger) { + case 0: + _scene->_sequences.remove(_globals._spriteIndexes[27]); + _globals._spriteIndexes[26] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[11], false, 3, 0, 0, 1); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[26], 1, 17); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[26], SM_FRAME_INDEX, 10, 1); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[26], SM_0, 0, 2); + _game._player._stepEnabled = false; + _game._player._visible = false; + _action._inProgress = false; + return; + + case 1: + _vm->_sound->command(16); + break; + + case 2: + _globals._spriteIndexes[26] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[11], false, 3, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[26], 17, 17); + _game._player._stepEnabled = true; + _sittingFl = true; + _scene->_hotspots.activate(71, false); + _chairHotspotId = _scene->_dynamicHotspots.add(71, 0x13F, -1, Common::Rect(159, 84, 33, 36)); + if (!_action.isAction(VERB_LOOK, 0x180)) { + _action._inProgress = false; + return; + } + _game._trigger = 0; + break; + } + } else { + _vm->_dialogs->show(0x2793); + _action._inProgress = false; + return; + } + } + + if (((_action.isAction(VERB_WALKTO, 0x135) || _action.isAction(VERB_OPEN, 0x135))) && !_panelOpened) { + switch (_game._trigger) { + case 0: + _shieldSpriteIdx = _game._objects.isInRoom(0x18) ? 13 : 14; + _globals._spriteIndexes[28] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[_shieldSpriteIdx], false, 6, 1, 0, 0); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[28], SM_0, 0, 1); + _game._player._stepEnabled = false; + _vm->_sound->command(20); + break; + + case 1: + _scene->_sequences.remove(_globals._spriteIndexes[28]); + _globals._spriteIndexes[28] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[_shieldSpriteIdx], false, 6, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[28], -2, -2); + _game._player._stepEnabled = true; + _panelOpened = true; + if (_game._objects.isInRoom(0x18)) + _scene->_hotspots.activate(0x137, true); + break; + } + _action._inProgress = false; + return; + } + + if ((_action.isAction(VERB_TAKE, 0x137) || _action.isAction(VERB_PULL, 0x137)) && _game._objects.isInRoom(0x18)) { + _game._objects.addToInventory(0x18); + _scene->_sequences.remove(_globals._spriteIndexes[28]); + _globals._spriteIndexes[28] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[14], false, 6, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[28], -2, -2); + _scene->_hotspots.activate(0x137, false); + _vm->_dialogs->showPicture(0x18, 0x2788); + _vm->_sound->command(22); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x135) || (_action.isAction(VERB_LOOK, 0x137) && !_game._objects.isInInventory(OBJ_SHIELD_MODULATOR)) ) { + if (_panelOpened) { + if (_game._objects.isInRoom(OBJ_SHIELD_MODULATOR)) + _vm->_dialogs->show(0x2790); + else + _vm->_dialogs->show(0x2791); + } else { + _vm->_dialogs->show(0x278F); + } + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_OPEN, 0x135) && _panelOpened) { + _vm->_dialogs->show(0x2792); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x180) && _sittingFl) { + if (_globals[kWatchedViewScreen]) { + sayDang(); + } else { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._spriteIndexes[26]); + _globals._spriteIndexes[26] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[11], false, 3, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[26], 17, 21); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[26], SM_0, 0, 1); + _vm->_sound->command(17); + break; + + case 1: + _globals._spriteIndexes[26] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[11], false, 3, 1, 0, 0); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[26], SM_0, 0, 2); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[26], 17, 21); + break; + + case 2: + _globals._spriteIndexes[26] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[11], false, 3, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[26], 17, 17); + _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 3, 1, 0, 0); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 3); + break; + + case 3: + _game._player._stepEnabled = true; + _globals[kWatchedViewScreen] = true; + _sittingFl = true; + _scene->_nextSceneId = 112; + break; + } + } + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x47)) { + _vm->_dialogs->show(0x2775); + _action._inProgress = false; + return; + } + + if ((_action.isAction(VERB_LOOK) || _action.isAction(0x103)) && (_action.isAction(0x8E) || _action.isAction(0xF9))) { + _vm->_dialogs->show(0x2776); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0xA8) || _action.isAction(VERB_LOOK, 0xF8) || _action.isAction(0x7D, 0xA8) || _action.isAction(0x7D, 0xF8)) { + _vm->_dialogs->show(0x2777); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x91)) { + _vm->_dialogs->show(0x2778); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0xE1) || _action.isAction(0xD2, 0xE1)) { + _vm->_dialogs->show(0x2779); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x60)) { + _vm->_dialogs->show(0x277A); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x111)) { + _vm->_dialogs->show(0x277B); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x7B) || (_action.isAction(VERB_OPEN, 0x7B) && !_game._objects.isInInventory(OBJ_REBREATHER))) { + _vm->_dialogs->show(0x277D); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_OPEN, 0x7B)) { + _vm->_dialogs->show(0x277E); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x166)) { + _vm->_dialogs->show(0x277F); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0xCA)) { + _vm->_dialogs->show(0x278E); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x63)) { + _vm->_dialogs->show(0x2780); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0xEB)) { + _vm->_dialogs->show(0x2781); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x78)) { + _vm->_dialogs->show(0x2782); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x190)) { + _vm->_dialogs->show(0x2783); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x138)) { + _vm->_dialogs->show(0x2784); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_TAKE, 0x111)) { + _vm->_dialogs->show(0x2786); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_TAKE, 0x91)) { + _vm->_dialogs->show(0x2787); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_OPEN, 0x63)) { + _vm->_dialogs->show(0x2789); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_OPEN, 0x60)) { + _vm->_dialogs->show(0x278A); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_CLOSE, 0x60)) { + _vm->_dialogs->show(0x278B); + _action._inProgress = false; + return; + } + + if ((_action.isAction(VERB_LOOK) || _action.isAction(0x112)) && _action.isAction(0x17E)) { + _vm->_dialogs->show(0x278C); + _action._inProgress = false; + return; + } +} + +/*------------------------------------------------------------------------*/ + +void Scene102::setup() { + } -void Scene101::postActions() { +void Scene102::enter() { + +} + +void Scene102::step() { + +} + +void Scene102::preActions() { + +} + +void Scene102::actions() { + +} + +void Scene102::postActions() { + } /*------------------------------------------------------------------------*/ diff --git a/engines/mads/nebular/nebular_scenes1.h b/engines/mads/nebular/nebular_scenes1.h index 56c70b1bf8..3f69223b81 100644 --- a/engines/mads/nebular/nebular_scenes1.h +++ b/engines/mads/nebular/nebular_scenes1.h @@ -53,8 +53,32 @@ public: }; class Scene101: public Scene1xx { +private: + bool _sittingFl; + bool _panelOpened; + + int _messageNum; + int _posY; + int _shieldSpriteIdx; + int _chairHotspotId; + int _oldSpecial; + + void sayDang(); +public: + Scene101(MADSEngine *vm) : Scene1xx(vm), _sittingFl(false), _panelOpened(false), _messageNum(0), + _posY(0), _shieldSpriteIdx(0), _chairHotspotId(0), _oldSpecial(0) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; + +class Scene102 : public Scene1xx { public: - Scene101(MADSEngine *vm) : Scene1xx(vm) {} + Scene102(MADSEngine *vm) : Scene1xx(vm) {} virtual void setup(); virtual void enter(); -- cgit v1.2.3 From 99f947fbc3fab233afdb1974503222c4b6a28e49 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 10 Apr 2014 13:42:37 +0200 Subject: MADS: Avoid to specify the 2nd parameter of addSprites when it's the default value --- engines/mads/nebular/nebular_scenes2.cpp | 96 ++++++++++++++++---------------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 77e5234109..d78b85effc 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -127,10 +127,10 @@ void Scene201::setup() { } void Scene201::enter() { - _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 0), 0); - _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 1), 0); - _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('m', -1), 0); - _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('b', -1), 0); + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 0)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 1)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('m', -1)); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('b', -1)); _globals._spriteIndexes[5] = _scene->_sprites.addSprites("*SC002Z1"); _globals._spriteIndexes[16] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 6, 0, 1, 0); _globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 15, 0, 0, 50); @@ -182,8 +182,8 @@ void Scene201::enter() { } if ((_scene->_priorSceneId == 202) && (_globals[kMeteorologistStatus] == 1) && !_scene->_roomChanged) { - _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('a', 0), 0); - _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('a', 1), 0); + _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('a', 0)); + _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('a', 1)); _game.loadQuoteSet(90, 91, 0); _game._player._stepEnabled = false; _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 7, 1, 0, 0); @@ -340,19 +340,19 @@ void Scene202::setup() { void Scene202::enter() { _game._player._visible3 = true; - _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('b', 0), 0); - _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('b', 1), 0); - _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('b', 2), 0); - _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 0), 0); - _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('l', -1), 0); + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('b', 0)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('b', 1)); + _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('b', 2)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 0)); + _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('l', -1)); if (_globals[kSexOfRex] != SEX_MALE) { _globals._spriteIndexes[7] = _scene->_sprites.addSprites("*ROXBD_2"); } else { _globals._spriteIndexes[7] = _scene->_sprites.addSprites("*RXMBD_2"); } - _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('a', 0), 0); - _globals._spriteIndexes[9] = _scene->_sprites.addSprites(formAnimName('a', 1), 0); - _globals._spriteIndexes[11] = _scene->_sprites.addSprites(formAnimName('a', 2), 0); + _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('a', 0)); + _globals._spriteIndexes[9] = _scene->_sprites.addSprites(formAnimName('a', 1)); + _globals._spriteIndexes[11] = _scene->_sprites.addSprites(formAnimName('a', 2)); _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 6, 0, 0, 0); _globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 6, 0, 0, 0); @@ -1009,7 +1009,7 @@ void Scene203::enter() { } if (!_rhotundaEatFl) { - _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('b', -1), 0); + _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('b', -1)); if (_vm->getRandomNumber(1, 3) == 2) { _globals._spriteIndexes[15] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 9, 1, 0, 0); int idx = _scene->_dynamicHotspots.add(477, 209, _globals._spriteIndexes[15], Common::Rect(0, 0, 0, 0)); @@ -1100,15 +1100,15 @@ void Scene205::setup() { } void Scene205::enter() { - _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 0), 0); - _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 1), 0); - _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 2), 0); - _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('f', -1), 0); - _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('c', -1), 0); - _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('p', -1), 0); + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 0)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 1)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 2)); + _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('f', -1)); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('c', -1)); + _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('p', -1)); if (_globals[kSexOfRex] == SEX_MALE) - _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('a', 1), 0); + _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('a', 1)); _globals._spriteIndexes[16] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 10, 0, 0, 3); int idx = _scene->_dynamicHotspots.add(73, 13, _globals._spriteIndexes[16], Common::Rect(0, 0, 0, 0)); @@ -1231,13 +1231,13 @@ void Scene207::setup() { } void Scene207::enter() { - _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('h', 0), 0); - _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('h', 1), 0); - _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('c', -1), 0); - _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('e', 0), 0); - _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('e', 1), 0); - _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('g', 1), 0); - _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('g', 0), 0); + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('h', 0)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('h', 1)); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('c', -1)); + _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('e', 0)); + _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('e', 1)); + _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('g', 1)); + _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('g', 0)); _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 7, 0, 0, 0); _scene->_sequences.setDepth(_globals._spriteIndexes[20], 7); @@ -1447,10 +1447,10 @@ void Scene208::updateTrap() { } void Scene208::enter() { - _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('a', 1), 0); - _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 0), 0); - _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 1), 0); - _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('x', 2), 0); + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('a', 1)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 0)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 1)); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('x', 2)); _globals._spriteIndexes[5] = _scene->_sprites.addSprites("*RXMBD_8"); updateTrap(); @@ -2309,7 +2309,7 @@ void Scene209::handleMonkeyFall() { _scene->_sprites.remove(_globals._spriteIndexes[5]); _scene->_sprites.remove(_globals._spriteIndexes[4]); - _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('m', 4), 0); + _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('m', 4)); _scene->_kernelMessages.add(Common::Point(180, 26), 0xFDFC, 0, 0, 90, _game.getQuote(151)); _scene->_sequences.addTimer(40, 100); _scene->_hotspots.activate(227, false); @@ -2509,15 +2509,15 @@ void Scene209::handleDodge() { } void Scene209::enter() { - _globals._spriteIndexes[12] = _scene->_sprites.addSprites(formAnimName('a', 1), 0); - _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('e', -1), 0); - _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('a', 0), 0); - _globals._spriteIndexes[9] = _scene->_sprites.addSprites(formAnimName('b', 1), 0); - _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('m', 0), 0); - _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('m', 1), 0); - _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('m', 3), 0); - _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('m', 6), 0); - _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('m', 8), 0); + _globals._spriteIndexes[12] = _scene->_sprites.addSprites(formAnimName('a', 1)); + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('e', -1)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('a', 0)); + _globals._spriteIndexes[9] = _scene->_sprites.addSprites(formAnimName('b', 1)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('m', 0)); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('m', 1)); + _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('m', 3)); + _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('m', 6)); + _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('m', 8)); _game.loadQuoteSet(0x82, 0x83, 0x84, 0x9C, 0x97, 0x95, 0x99, 0x9E, 0x98, 0x9B, 0xA0, 0x96, 0x9F, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x91, 0x92, 0x93, 0x94, 0x89, 0x85, 0x8A, 0x86, 0x87, 0x88, 0); @@ -3119,7 +3119,7 @@ void Scene209::actions() { if (_action.isAction(VERB_TAKE, NOUN_PLANT_STALK) && (_game._trigger || _game._objects.isInRoom(OBJ_PLANT_STALK))) { switch (_game._trigger) { case 0: - _globals._spriteIndexes[11] = _scene->_sprites.addSprites("*RXMBD_2", 0); + _globals._spriteIndexes[11] = _scene->_sprites.addSprites("*RXMBD_2"); _game._player._stepEnabled = false; _game._player._visible = false; _globals._spriteIndexes[26] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[11], false, 3, 2, 0, 0); @@ -3151,7 +3151,7 @@ void Scene209::actions() { if (_action.isAction(VERB_TAKE, 0x27) && (_game._trigger || _game._objects.isInRoom(OBJ_BINOCULARS))) { switch (_game._trigger) { case 0: - _globals._spriteIndexes[10] = _scene->_sprites.addSprites("*RXMBD_8", false); + _globals._spriteIndexes[10] = _scene->_sprites.addSprites("*RXMBD_8"); _game._player._stepEnabled = false; _game._player._visible = false; _globals._spriteIndexes[25] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[10], false, 3, 2, 0, 0); @@ -3713,7 +3713,7 @@ void Scene210::setDialogNode(int node) { _scene->_activeAnimation = nullptr; _scene->resetScene(); - _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('c', -1), 0); + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('c', -1)); _game.loadQuoteSet(0xE6, 0xE9, 0xEA, 0xE7, 0xE8, 0); _scene->loadAnimation(formAnimName('B', -1), 4); break; @@ -3805,7 +3805,7 @@ void Scene210::restoreDialogNode(int node, int msgId, int posY) { } void Scene210::enter() { - _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('c', -1), 0); + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('c', -1)); if (!_game._visitedScenes._sceneRevisited) _globals[kCurtainOpen] = 0; @@ -4336,7 +4336,7 @@ void Scene211::setup() { } void Scene211::enter() { - _globals._spriteIndexes[1] = _scene->_sprites.addSprites("*SC002Z2", false); + _globals._spriteIndexes[1] = _scene->_sprites.addSprites("*SC002Z2"); _wakeFl = false; if (_scene->_priorSceneId == 210) -- cgit v1.2.3 From dbbfdeec8fb2d042844cee67c91c7d639f2a8eaa Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 10 Apr 2014 20:04:58 -0400 Subject: MADS: Added an item command to the debugger --- engines/mads/debugger.cpp | 18 ++++++++++++++++++ engines/mads/debugger.h | 1 + 2 files changed, 19 insertions(+) diff --git a/engines/mads/debugger.cpp b/engines/mads/debugger.cpp index 276340f240..7d66b56989 100644 --- a/engines/mads/debugger.cpp +++ b/engines/mads/debugger.cpp @@ -38,6 +38,7 @@ Debugger::Debugger(MADSEngine *vm) : GUI::Debugger(), _vm(vm) { DCmd_Register("show_codes", WRAP_METHOD(Debugger, Cmd_ShowCodes)); DCmd_Register("dump_file", WRAP_METHOD(Debugger, Cmd_DumpFile)); DCmd_Register("show_quote", WRAP_METHOD(Debugger, Cmd_ShowQuote)); + DCmd_Register("item", WRAP_METHOD(Debugger, Cmd_Item)); } static int strToInt(const char *s) { @@ -178,4 +179,21 @@ bool Debugger::Cmd_ShowQuote(int argc, const char **argv) { return true; } +bool Debugger::Cmd_Item(int argc, const char **argv) { + InventoryObjects &objects = _vm->_game->_objects; + + if (argc != 2) { + DebugPrintf("Usage: %s \n", argv[0]); + return true; + } else { + int objectId = strToInt(argv[1]); + + if (!objects.isInInventory(objectId)) + objects.addToInventory(objectId); + + DebugPrintf("Item added.\n"); + return false; + } +} + } // End of namespace MADS diff --git a/engines/mads/debugger.h b/engines/mads/debugger.h index b2b0949923..c2d66d9118 100644 --- a/engines/mads/debugger.h +++ b/engines/mads/debugger.h @@ -42,6 +42,7 @@ protected: bool Cmd_ShowCodes(int argc, const char **argv); bool Cmd_DumpFile(int argc, const char **argv); bool Cmd_ShowQuote(int argc, const char **argv); + bool Cmd_Item(int argc, const char **argv); public: bool _showMousePos; public: -- cgit v1.2.3 From da43f4438d44e2fee8fb8e99fd463e2c702e683e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 10 Apr 2014 20:06:02 -0400 Subject: MADS: Minor fix to inentory top index setting --- engines/mads/inventory.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/mads/inventory.cpp b/engines/mads/inventory.cpp index 0795233f6c..bb65430bb1 100644 --- a/engines/mads/inventory.cpp +++ b/engines/mads/inventory.cpp @@ -110,8 +110,8 @@ void InventoryObjects::addToInventory(int objectId) { userInterface._inventoryTopIndex = CLIP(userInterface._inventoryTopIndex, 0, (int)_inventoryList.size() - 1); - if ((userInterface._inventoryTopIndex + 5) < (int)_inventoryList.size()) - userInterface._inventoryTopIndex = size() - 5; + if ((userInterface._inventoryTopIndex + 5) <= (int)_inventoryList.size()) + userInterface._inventoryTopIndex = size() - 4; userInterface._inventoryChanged = true; (*this)[objectId]._roomNumber = PLAYER_INVENTORY; -- cgit v1.2.3 From 0eb08fdcc075643e03ead21ff4d0366f26c9625a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 10 Apr 2014 20:06:37 -0400 Subject: MADS: Fix bounds calculation for inventory scroller --- engines/mads/user_interface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 941606677d..3ae571c41c 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -522,7 +522,7 @@ bool UserInterface::getBounds(ScrCategory category, int v, Common::Rect &bounds) case CAT_INV_SCROLLER: heightMultiplier = 0; - widthMultiplier = 73; + widthMultiplier = 0; yOffset = 0; widthAmt = 9; leftStart = (v != 73) ? 73 : 75; -- cgit v1.2.3 From 39c66afe6698faaa5ccac78e6cbb85b11c1118b3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 10 Apr 2014 22:14:57 -0400 Subject: MADS: Fixes for inventory scrollbar display --- engines/mads/game.cpp | 2 +- engines/mads/screen.cpp | 92 +++------------------------------ engines/mads/screen.h | 11 +--- engines/mads/user_interface.cpp | 110 ++++++++++++++++++++++++++++++++++++---- engines/mads/user_interface.h | 26 +++++++++- 5 files changed, 132 insertions(+), 109 deletions(-) diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index e2e956e8cb..9296b95d47 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -175,7 +175,7 @@ void Game::sectionLoop() { // Reset the user interface _screenObjects._forceRescan = true; _screenObjects._inputMode = kInputBuildingSentences; - _scene._userInterface._scrollerY = 0; + _scene._userInterface._scrollbarActive = SCROLLBAR_NONE; _player._loadsFirst = true; diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index 519dcabccd..9824a3e7cc 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -261,13 +261,10 @@ ScreenObjects::ScreenObjects(MADSEngine *vm) : _vm(vm) { _v7FED6 = 0; _v8332A = 0; _category = CAT_NONE; - _newDescId = 0; - _newDescId = 0; + _spotId = 0; _released = false; _uiCount = 0; _selectedObject = -1; - _scrollerY = -1; - _milliTime = 0; _eventFlag = false; _baseTime = 0; } @@ -292,14 +289,14 @@ void ScreenObjects::check(bool scanFlag) { if (!_vm->_events->_mouseButtons || _inputMode != kInputBuildingSentences) _vm->_events->_rightMousePressed = false; - if ((_vm->_events->_mouseMoved || _vm->_game->_scene._userInterface._scrollerY + if ((_vm->_events->_mouseMoved || userInterface._scrollbarActive || _v8332A || _forceRescan) && scanFlag) { _category = CAT_NONE; _selectedObject = scanBackwards(_vm->_events->currentPos(), LAYER_GUI); if (_selectedObject > 0) { ScreenObject &scrObject = (*this)[_selectedObject]; _category = (ScrCategory)(scrObject._category & 7); - _newDescId = scrObject._descId; + _spotId = scrObject._descId; } // Handling for easy mouse @@ -335,13 +332,13 @@ void ScreenObjects::check(bool scanFlag) { scene._userInterface._category = CAT_NONE; } - if (_vm->_events->_mouseButtons || _vm->_easyMouse || scene._userInterface._scrollerY) - checkScroller(); + if (_vm->_events->_mouseButtons || _vm->_easyMouse || userInterface._scrollbarActive) + scene._userInterface.updateInventoryScroller(); if (_vm->_events->_mouseButtons || _vm->_easyMouse) scene._action.set(); - _forceRescan = 0; + _forceRescan = false; } scene._action.refresh(); @@ -380,83 +377,6 @@ int ScreenObjects::scanBackwards(const Common::Point &pt, int layer) { return 0; } -void ScreenObjects::checkScroller() { - UserInterface &userInterface = _vm->_game->_scene._userInterface; - Common::Array &inventoryList = _vm->_game->_objects._inventoryList; - - if (_inputMode != kInputBuildingSentences) - return; - - userInterface._scrollerY = 0; - - if ((_category == CAT_INV_SCROLLER || (_scrollerY == 3 && _vm->_events->_mouseStatusCopy)) - && (_vm->_events->_mouseStatusCopy || _vm->_easyMouse)) { - if ((_vm->_events->_vD2 || (_vm->_easyMouse && !_vm->_events->_mouseStatusCopy)) - && _category == CAT_INV_SCROLLER) { - _currentDescId = _newDescId; - } - } - - if (_newDescId == _currentDescId || _scrollerY == 3) { - _vm->_game->_scene._userInterface._scrollerY = _currentDescId; - uint32 currentMilli = g_system->getMillis(); - uint32 timeInc = _eventFlag ? 100 : 380; - - if (_vm->_events->_vD2 || (_milliTime + timeInc) <= currentMilli) { - _eventFlag = _vm->_events->_vD2 < 1; - _milliTime = currentMilli; - - switch (_currentDescId) { - case 1: - // Scroll up - if (userInterface._inventoryTopIndex > 0 && inventoryList.size() > 0) { - --userInterface._inventoryTopIndex; - userInterface._inventoryChanged = true; - } - break; - - case 2: - // Scroll down - if (userInterface._inventoryTopIndex < (int)inventoryList.size() && - inventoryList.size() > 0) { - ++userInterface._inventoryTopIndex; - userInterface._inventoryChanged = true; - } - break; - - case 3: { - // Inventory slider - int newIndex = CLIP((int)_vm->_events->currentPos().y - 170, 0, 17) - * inventoryList.size() / 10; - if (newIndex >= (int)inventoryList.size()) - newIndex = inventoryList.size() - 1; - - if (inventoryList.size() > 0) { - userInterface._inventoryChanged = newIndex != userInterface._inventoryTopIndex; - userInterface._inventoryTopIndex = newIndex; - } - break; - } - - default: - break; - } - - if (userInterface._inventoryChanged) { - int dummy; - userInterface.updateSelection(CAT_INV_LIST, 0, &dummy); - } - } - } - - if (userInterface._scrollerY != _scrollerY || - userInterface._objectY != _objectY) - userInterface.scrollerChanged(); - - _scrollerY = userInterface._scrollerY; - _objectY = userInterface._objectY; -} - void ScreenObjects::elementHighlighted() { Scene &scene = _vm->_game->_scene; UserInterface &userInterface = scene._userInterface; diff --git a/engines/mads/screen.h b/engines/mads/screen.h index 11b81346f1..5be627a428 100644 --- a/engines/mads/screen.h +++ b/engines/mads/screen.h @@ -140,15 +140,8 @@ class ScreenObjects : public Common::Array { private: MADSEngine *_vm; int _objectY; - int _scrollerY; int scanBackwards(const Common::Point &pt, int layer); - - /** - * Checks for the mouse being on the user interface inventory scroller, - * and update the scroller and selected inventory object as necessary - */ - void checkScroller(); public: InputMode _inputMode; int _v7FED6; @@ -156,13 +149,11 @@ public: int _forceRescan; int _selectedObject; ScrCategory _category; - int _newDescId; - int _currentDescId; bool _released; int _uiCount; - uint32 _milliTime; bool _eventFlag; uint32 _baseTime; + int _spotId; /* * Constructor diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 3ae571c41c..a850c9a68f 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -208,11 +208,15 @@ UserInterface::UserInterface(MADSEngine *vm) : _vm(vm), _dirtyAreas(vm), _scrollFlag = false; _category = CAT_NONE; _inventoryTopIndex = 0; - _objectY = 0; _selectedInvIndex = -1; _selectedActionIndex = 0; _selectedItemVocabIdx = -1; - _scrollerY = 0; + _scrollbarActive = SCROLLBAR_NONE; + _scrollbarOldActive = SCROLLBAR_NONE; + _scrollbarStrokeType = SCROLLBAR_NONE; + _scrollbarQuickly = false; + _scrollbarMilliTime = 0; + _scrollbarElevator = _scrollbarOldElevator = 0; _highlightedCommandIndex = -1; _highlightedInvIndex = -1; _highlightedItemVocabIndex = -1; @@ -327,11 +331,95 @@ void UserInterface::drawItemVocabList() { } void UserInterface::drawScrolller() { - if (_scrollerY > 0) - writeVocab(CAT_INV_SCROLLER, _scrollerY); + if (_scrollbarActive) + writeVocab(CAT_INV_SCROLLER, _scrollbarActive); writeVocab(CAT_INV_SCROLLER, 4); } +void UserInterface::updateInventoryScroller() { + ScreenObjects &screenObjects = _vm->_game->_screenObjects; + Common::Array &inventoryList = _vm->_game->_objects._inventoryList; + + if (screenObjects._inputMode != kInputBuildingSentences) + return; + + _scrollbarActive = SCROLLBAR_NONE; + + if (( + (screenObjects._category == CAT_INV_SCROLLER) || + (screenObjects._category != CAT_INV_SCROLLER && _scrollbarOldActive == SCROLLBAR_ELEVATOR) + ) && (_vm->_events->_mouseStatusCopy || _vm->_easyMouse)) { + if ((_vm->_events->_mouseClicked || (_vm->_easyMouse && !_vm->_events->_mouseStatusCopy)) + && (screenObjects._category == CAT_INV_SCROLLER)) + _scrollbarStrokeType = (ScrollbarActive)screenObjects._spotId; + + if (screenObjects._spotId == _scrollbarStrokeType || _scrollbarOldActive == SCROLLBAR_ELEVATOR) { + _scrollbarActive = _scrollbarStrokeType; + uint32 currentMilli = g_system->getMillis(); + uint32 timeInc = _scrollbarQuickly ? 100 : 380; + + if (_vm->_events->_mouseClicked || (_vm->_events->_mouseStatusCopy && (_scrollbarMilliTime + timeInc) <= currentMilli)) { + _scrollbarQuickly = _vm->_events->_vD2 < 1; + _scrollbarMilliTime = currentMilli; + + switch (_scrollbarStrokeType) { + case 1: + // Scroll up + if (_inventoryTopIndex > 0 && inventoryList.size() > 0) { + --_inventoryTopIndex; + _inventoryChanged = true; + } + break; + + case 2: + // Scroll down + if (_inventoryTopIndex < ((int)inventoryList.size() - 1) && inventoryList.size() > 1) { + ++_inventoryTopIndex; + _inventoryChanged = true; + } + break; + + case 3: { + // Inventory slider + int newIndex = CLIP((int)_vm->_events->currentPos().y - 170, 0, 17) + * inventoryList.size() / 10; + if (newIndex >= (int)inventoryList.size()) + newIndex = inventoryList.size() - 1; + + if (inventoryList.size() > 0) { + _inventoryChanged = newIndex != _inventoryTopIndex; + _inventoryTopIndex = newIndex; + } + break; + } + + default: + break; + } + + if (_inventoryChanged) { + int dummy; + updateSelection(CAT_INV_LIST, 0, &dummy); + } + } + } + } + + if (_scrollbarActive != _scrollbarOldActive || _scrollbarElevator != _scrollbarOldElevator) + scrollbarChanged(); + + _scrollbarOldActive = _scrollbarActive; + _scrollbarOldElevator = _scrollbarElevator; +} + +void UserInterface::scrollbarChanged() { + Common::Rect r(73, 4, 73 + 9, 4 + 38); + _uiSlots.add(r); + _uiSlots.draw(false, false); + drawScrolller(); + updateRect(r); +} + void UserInterface::writeVocab(ScrCategory category, int id) { Common::Rect bounds; if (!getBounds(category, id, bounds)) @@ -393,7 +481,8 @@ void UserInterface::writeVocab(ScrCategory category, int id) { break; } - font->setColorMode((id == 4) || (_scrollerY == 3) ? SELMODE_HIGHLIGHTED : SELMODE_UNSELECTED); + font->setColorMode((id == 4) || (_scrollbarActive == SCROLLBAR_ELEVATOR) ? + SELMODE_HIGHLIGHTED : SELMODE_UNSELECTED); font->writeString(this, vocabStr, Common::Point(bounds.left, bounds.top)); break; default: @@ -561,7 +650,7 @@ bool UserInterface::getBounds(ScrCategory category, int v, Common::Rect &bounds) break; case 4: // Thumb - bounds.top = _objectY + 14; + bounds.top = _scrollbarElevator + 14; bounds.setHeight(1); break; default: @@ -753,6 +842,7 @@ void UserInterface::selectObject(int invIndex) { void UserInterface::updateSelection(ScrCategory category, int newIndex, int *idx) { Game &game = *_vm->_game; + Common::Array &invList = game._objects._inventoryList; Common::Rect bounds; if (category == CAT_INV_LIST && _inventoryChanged) { @@ -764,11 +854,11 @@ void UserInterface::updateSelection(ScrCategory category, int newIndex, int *idx updateRect(bounds); _inventoryChanged = false; - if (game._objects._inventoryList.size() > 1) { - _objectY = 0; + if (invList.size() < 2) { + _scrollbarElevator = 0; } else { - int v = _inventoryTopIndex * 18 / (game._objects._inventoryList.size() - 1); - _objectY = MIN(v, 17); + int v = _inventoryTopIndex * 18 / (invList.size() - 1); + _scrollbarElevator = MIN(v, 17); } } else { int oldIndex = *idx; diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h index 46ba478f5b..f06917310e 100644 --- a/engines/mads/user_interface.h +++ b/engines/mads/user_interface.h @@ -33,6 +33,14 @@ namespace MADS { enum { IMG_SPINNING_OBJECT = 200, IMG_TEXT_UPDATE = 201 }; +enum ScrollbarActive { + SCROLLBAR_NONE = 0, // No state + SCROLLBAR_UP = 1, // Up butotn + SCROLLBAR_DOWN = 2, // Down button + SCROLLBAR_ELEVATOR = 3, // Elevator bar + SCROLLBAR_THUMB = 4 // Scrollbar thumb +}; + class AnimFrameEntry; class UISlot { @@ -96,6 +104,7 @@ private: bool _scrollFlag; int _noSegmentsActive; int _someSegmentsActive; + ScrollbarActive _scrollbarStrokeType; /** * Loads the elements of the user interface @@ -137,6 +146,11 @@ private: */ void drawScrolller(); + /** + * Called when the inventory scrollbar has changed + */ + void scrollbarChanged(); + /** * Draw a UI textual element */ @@ -153,11 +167,10 @@ public: Common::Rect _drawBounds; Common::Rect *_rectP; int _inventoryTopIndex; - int _objectY; int _selectedInvIndex; int _selectedActionIndex; int _selectedItemVocabIdx; - int _scrollerY; + ScrollbarActive _scrollbarActive, _scrollbarOldActive; int _highlightedCommandIndex; int _highlightedInvIndex; int _highlightedItemVocabIndex; @@ -165,6 +178,9 @@ public: int _categoryIndexes[8]; Common::StringArray _talkStrings; Common::Array _talkIds; + bool _scrollbarQuickly; + uint32 _scrollbarMilliTime; + int _scrollbarElevator, _scrollbarOldElevator; public: /** * Constructor @@ -219,6 +235,12 @@ public: void scrollInventory(); + /** + * Checks for the mouse being on the user interface inventory scroller, + * and update the scroller highlight and selected inventory object as necessary + */ + void updateInventoryScroller(); + void emptyTalkList(); }; -- cgit v1.2.3 From a30e78137e326c49d7de09f4fb2293bedfdd4a30 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 10 Apr 2014 22:34:26 -0400 Subject: MADS: Added method stub for unhandled action method --- engines/mads/game.h | 5 +++++ engines/mads/nebular/game_nebular.cpp | 6 +++++- engines/mads/nebular/game_nebular.h | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/engines/mads/game.h b/engines/mads/game.h index 56593660b5..c7cb66081d 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -155,6 +155,11 @@ public: */ virtual void doObjectAction() = 0; + /** + * Fallback handler for any action that isn't explicitly handled + */ + virtual void unhandledAction() = 0; + /** * Global game step */ diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index 467f3c3c6b..ed7d976635 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -376,7 +376,7 @@ void GameNebular::doObjectAction() { _objects.addToInventory(OBJ_COMBINATION); dialogs.showPicture(OBJ_COMBINATION, 851); } else if ((action.isAction(VERB_LOOK) || action.isAction(NOUN_READ)) && - ((id = _objects.getIdFromDesc(action._activeAction._objectNameId)) != 0 || + ((id = _objects.getIdFromDesc(action._activeAction._objectNameId)) > 0 || (action._activeAction._indirectObjectId > 0 && (id = _objects.getIdFromDesc(action._activeAction._indirectObjectId))))) { if (id == OBJ_REPAIR_LIST) { @@ -565,6 +565,10 @@ void GameNebular::doObjectAction() { action._inProgress = false; } +void GameNebular::unhandledAction() { + warning("TODO: unhandledAction"); +} + void GameNebular::step() { if (_player._visible && _player._stepEnabled && !_player._moving && (_player._facing == _player._turnToFacing)) { diff --git a/engines/mads/nebular/game_nebular.h b/engines/mads/nebular/game_nebular.h index e4f4efcd8a..4d011c2f4a 100644 --- a/engines/mads/nebular/game_nebular.h +++ b/engines/mads/nebular/game_nebular.h @@ -67,6 +67,8 @@ public: virtual void doObjectAction(); + virtual void unhandledAction(); + virtual void step(); }; -- cgit v1.2.3 From 4225304a34a5fc04280e72206c4d3dea13e29ad8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 11 Apr 2014 07:47:38 +0200 Subject: MADS: Implement scene 102 --- engines/mads/nebular/nebular_scenes1.cpp | 597 ++++++++++++++++++++++++++++++- engines/mads/nebular/nebular_scenes1.h | 12 + 2 files changed, 594 insertions(+), 15 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 5064795d33..c9a6165488 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -134,20 +134,20 @@ void Scene101::sayDang() { } void Scene101::enter() { - _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 1), false); - _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 2), false); - _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 3), false); - _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('x', 4), false); - _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('x', 5), false); - _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('x', 6), false); - _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('x', 7), false); - _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('m', -1), false); - _globals._spriteIndexes[9] = _scene->_sprites.addSprites(formAnimName('b', 1), false); - _globals._spriteIndexes[10] = _scene->_sprites.addSprites(formAnimName('b', 2), false); - _globals._spriteIndexes[11] = _scene->_sprites.addSprites(formAnimName('a', 0), false); - _globals._spriteIndexes[12] = _scene->_sprites.addSprites(formAnimName('a', 1), false); - _globals._spriteIndexes[13] = _scene->_sprites.addSprites(formAnimName('x', 8), false); - _globals._spriteIndexes[14] = _scene->_sprites.addSprites(formAnimName('x', 0), false); + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 1)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 2)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 3)); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('x', 4)); + _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('x', 5)); + _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('x', 6)); + _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('x', 7)); + _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('m', -1)); + _globals._spriteIndexes[9] = _scene->_sprites.addSprites(formAnimName('b', 1)); + _globals._spriteIndexes[10] = _scene->_sprites.addSprites(formAnimName('b', 2)); + _globals._spriteIndexes[11] = _scene->_sprites.addSprites(formAnimName('a', 0)); + _globals._spriteIndexes[12] = _scene->_sprites.addSprites(formAnimName('a', 1)); + _globals._spriteIndexes[13] = _scene->_sprites.addSprites(formAnimName('x', 8)); + _globals._spriteIndexes[14] = _scene->_sprites.addSprites(formAnimName('x', 0)); _globals._spriteIndexes[16] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 5, 0, 0, 25); _globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 4, 0, 1, 0); @@ -601,27 +601,594 @@ void Scene101::actions() { /*------------------------------------------------------------------------*/ void Scene102::setup() { + _scene->_animationData->preLoad(formAnimName('A', -1), 3); + setPlayerSpritesPrefix(); + setAAName(); +} +void Scene102::addRandomMessage() { + _scene->_kernelMessages.reset(); + _game._triggerSetupMode = KERNEL_TRIGGER_DAEMON; + int quoteId = _vm->getRandomNumber(65, 69); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 73, 120, _game.getQuote(quoteId)); + _activeMsgFl = true; } void Scene102::enter() { + sceneEntrySound(); + + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 1)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 2)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 3)); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('x', 4)); + _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('x', 5)); + + _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('b', -1)); + _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('c', -1)); + _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('e', -1)); + _globals._spriteIndexes[9] = _scene->_sprites.addSprites(formAnimName('n', -1)); + _globals._spriteIndexes[10] = _scene->_sprites.addSprites(formAnimName('g', -1)); + _globals._spriteIndexes[11] = _scene->_sprites.addSprites("*RXMRC_8"); + _globals._spriteIndexes[13] = _scene->_sprites.addSprites(formAnimName('x', 0)); + + _globals._spriteIndexes[15+1] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 8, 0, 0, 0); + _globals._spriteIndexes[15+2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 170, 0, 1, 6); + _globals._spriteIndexes[15+3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 11, 0, 2, 3); + _globals._spriteIndexes[15+4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 4, 0, 1, 0); + _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 3, 0, 0, 5); + + if (!_game._objects.isInRoom(OBJ_BINOCULARS)) + _globals._spriteIndexes[24] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 24, 0, 0, 24); + else + _scene->_hotspots.activate(0x27, false); + _scene->_hotspots.activate(0x35, false); + + if (_globals[kMedicineCabinetOpen]) { + _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 6, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[23], -2, -2); + } + + if (_scene->_priorSceneId == 101) { + _game._player._playerPos = Common::Point(229, 109); + _game._player._stepEnabled = false; + _globals._spriteIndexes[21] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[6], false, 6, 1, 2, 0); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[21], SM_0, 0, 70); + } else if (_scene->_priorSceneId == 103) { + _game._player._playerPos = Common::Point(47, 152); + } else if (_scene->_priorSceneId != -2) { + _game._player._facing = FACING_NORTHWEST; + _game._player._playerPos = Common::Point(32, 129); + } + + if (_scene->_priorSceneId != 106) { + if (_globals[kWaterInAPuddle]) { + _globals._spriteIndexes[28] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[13], false, 6, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[28], -2, -2); + _scene->_sequences.setDepth(_globals._spriteIndexes[28], 5); + } + } else { + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._spriteIndexes[28] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[13], false, 6, 1, 0, 0); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[28], SM_0, 0, 72); + _scene->_sequences.setDepth(_globals._spriteIndexes[28], 5); + _vm->_sound->command(24); + _vm->_sound->command(28); + } + + _fridgeOpenedFl = false; + _fridgeOpenedDescr = false; + _fridgeCommentCount = 0; + _fridgeFirstOpenFl = true; + _chairDescrFl = false; + _activeMsgFl = false; + + _game.loadQuoteSet(0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x45, 0x43, 0); + + if (_scene->_priorSceneId == 101) + _vm->_sound->command(20); } void Scene102::step() { + if (_game._trigger == 70) + _game._player._stepEnabled = true; + if (_game._trigger == 72) { + _globals._spriteIndexes[28] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[13], false, 6, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[28], -2, -2); + _scene->_sequences.setDepth(_globals._spriteIndexes[28], 5); + _scene->_sequences.addTimer(48, 90); + } + + if (_game._trigger >= 90) { + if (_game._trigger >= 94) { + _scene->loadAnimation(formAnimName('B', -1), 71); + _game._player._stepEnabled = false; + _game._player._visible = false; + + _globals[kWaterInAPuddle] = true; + _vm->_sound->command(24); + } else { + _vm->_sound->command(23); + _scene->_sequences.addTimer(48, _game._trigger + 1); + } + } + + if (_game._trigger == 71) { + _game._player._stepEnabled = true; + _game._player._visible = true; + _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; + } + + if (_fridgeOpenedFl && !_fridgeOpenedDescr) { + _fridgeCommentCount++; + if (_fridgeCommentCount > 16384) { + _fridgeOpenedDescr = true; + _vm->_dialogs->show(0x27E5); + } + } + + if (!_activeMsgFl && (_game._player._playerPos == Common::Point(177, 114)) && (_game._player._facing == FACING_NORTH) + && (_vm->getRandomNumber(1, 5000) == 1)) { + _scene->_kernelMessages.reset(); + _activeMsgFl = false; + addRandomMessage(); + } + + if (_game._trigger == 73) + _activeMsgFl = false; } void Scene102::preActions() { + if (_action.isAction(0x122) || _action.isAction(0x117)) + _game._player._needToWalk = _game._player._readyToWalk; + + if (_fridgeOpenedFl && !_action.isAction(0x122)) { + switch (_game._trigger) { + case 0: + if (_game._player._needToWalk) { + _scene->_sequences.remove(_globals._spriteIndexes[22]); + _globals._spriteIndexes[22] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[7], false, 6, 1, 0, 0); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[22], SM_0, 0, 1); + _scene->_sequences.setDepth(_globals._spriteIndexes[22], 15); + _game._player._stepEnabled = false; + _vm->_sound->command(20); + } + break; + + case 1: + if (_game._objects.isInRoom(OBJ_BURGER)) { + _scene->_sequences.remove(_globals._spriteIndexes[25]); + _scene->_hotspots.activate(0x35, false); + } + _fridgeOpenedFl = false; + _game._player._stepEnabled = true; + break; + } + } + if (_game._player._needToWalk) + _scene->_kernelMessages.reset(); } void Scene102::actions() { + bool justOpenedFl = false; + + if (_action._lookFlag) { + _vm->_dialogs->show(0x27FA); + _action._inProgress = false; + return; + } + + if (_action.isAction(0x122) && !_fridgeOpenedFl) { + switch (_game._trigger) { + case 0: + _globals._spriteIndexes[22] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._spriteIndexes[22], 15); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[22], SM_0, 0, 1); + if (_game._objects.isInRoom(OBJ_BURGER)) { + _globals._spriteIndexes[25] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[10], false, 7, 0, 0, 0); + _scene->_sequences.setDepth(_globals._spriteIndexes[25], 14); + } + _game._player._stepEnabled = false; + _vm->_sound->command(20); + _action._inProgress = false; + return; + + case 1: + _globals._spriteIndexes[22] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 6, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[22], -2, -2); + _scene->_sequences.setDepth(_globals._spriteIndexes[22], 15); + int delay; + if (_action.isAction(VERB_WALKTO) && !_fridgeFirstOpenFl) + delay = 0; + else + delay = 48; + _scene->_sequences.addTimer(delay, 2); + _action._inProgress = false; + return; + + case 2: + _fridgeOpenedFl = true; + _fridgeOpenedDescr = false; + _fridgeCommentCount = 0; + _game._player._stepEnabled = true; + justOpenedFl = true; + if (_game._objects.isInRoom(OBJ_BURGER)) + _scene->_hotspots.activate(0x35, true); + break; + } + } + + if (_action.isAction(VERB_LOOK, 0x122) || _action.isAction(VERB_OPEN, 0x122)) { + if (_game._objects.isInRoom(OBJ_BURGER)) + _vm->_dialogs->show(0x27F6); + else + _vm->_dialogs->show(0x27F5); + + _fridgeFirstOpenFl = false; + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_WALKTO, 0x122) && justOpenedFl) { + _fridgeFirstOpenFl = false; + int quoteId = _vm->getRandomNumber(59, 63); + Common::String curQuote = _game.getQuote(quoteId); + int width = _vm->_font->getWidth(curQuote, -1); + _scene->_kernelMessages.reset(); + _game._triggerSetupMode = KERNEL_TRIGGER_DAEMON; + _scene->_kernelMessages.add(Common::Point(210, 60), 0x1110, 0, 73, 120, curQuote); + _scene->_kernelMessages.add(Common::Point(214 + width, 60), 0x1110, 0, 73, 120, _game.getQuote(64)); + _activeMsgFl = true; + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_CLOSE, 0x122)) { + _vm->_dialogs->show(0x27E5); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_TAKE, 0x122)) { + _vm->_dialogs->show(0x8); + _action._inProgress = false; + return; + } + + if (_action.isAction(0x18B, 0x6E)) { + switch (_game._trigger) { + case 0: + _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 6, 1, 0, 0); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[21], SM_0, 0, 1); + _game._player._stepEnabled = false; + _vm->_sound->command(20); + break; + + case 1: + _scene->_nextSceneId = 101; + break; + } + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_WALKTO, 0x79)) { + _scene->_nextSceneId = 103; + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_WALKTO, 0x117) || _action.isAction(VERB_LOOK, 0x117) || _action.isAction(VERB_WALKTO, 0x27)) { + addRandomMessage(); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x194)) { + _vm->_dialogs->show(0x27E4); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x79)) { + _vm->_dialogs->show(0x27DD); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x6E)) { + _vm->_dialogs->show(0x27DC); + _action._inProgress = false; + return; + } + + if (_action.isAction(0x155, 0x46) || _action.isAction(VERB_LOOK, 0x46)) { + _vm->_dialogs->show(0x27DB); + _action._inProgress = false; + return; + } + + if (_action.isAction(0x155, 0xFD) || _action.isAction(VERB_LOOK, 0xFD)) { + _vm->_dialogs->show(0x27DA); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x127)) { + _vm->_dialogs->show(0x27E7); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_PUT, 0x35, 0x127) && _game._objects.isInInventory(OBJ_BURGER)) { + _vm->_dialogs->show(0x27E8); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_PUT, 0x122) && _game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId))) { + _vm->_dialogs->show(0x27E9); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_PUT, 0x127) && (_action.isAction(0x65) || _action.isAction(0x157))) { + _vm->_dialogs->show(0x27F6); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_OPEN, 0x127)) { + _vm->_dialogs->show(0x27EA); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x52)) { + _vm->_dialogs->show(0x27EB); + _action._inProgress = false; + return; + } + + if ((_action.isAction(0xC7) || _action.isAction(0xA3)) && (_action.isAction(VERB_LOOK) || _action.isAction(0x50) || _action.isAction(0x4F))) { + if (_game._objects.isInInventory(OBJ_REBREATHER)) { + if (!_action.isAction(0x50) && !_action.isAction(0x4F)) { + _vm->_dialogs->show(0x27F7); + _action._inProgress = false; + return; + } + } else if (_action.isAction(VERB_LOOK) || (_game._difficulty == DIFFICULTY_IMPOSSIBLE)) { + _vm->_dialogs->show(0x27EE); + _action._inProgress = false; + return; + } + } + + if ( (_action.isAction(0xC7) || _action.isAction(0xA3)) && (_action.isAction(0x50) || _action.isAction(0x4F)) ) { + switch (_game._trigger) { + case 0: + _scene->loadAnimation(formAnimName('A', -1), 1); + _game._player._stepEnabled = false; + _game._player._visible = false; + break; + + case 1: + _vm->_sound->command(24); + _scene->_sequences.addTimer(48, 2); + break; + + case 2: + case 3: + case 4: + _vm->_sound->command(23); + _scene->_sequences.addTimer(48, _game._trigger + 1); + break; + + case 5: + _vm->_sound->command(24); + _scene->_sequences.addTimer(48, _game._trigger + 1); + break; + + case 6: + if (_game._objects.isInInventory(OBJ_REBREATHER) && !_game._visitedScenes.exists(106)) + _vm->_dialogs->show(0x27FD); + _scene->_nextSceneId = 106; + break; + } + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x118)) { + _vm->_dialogs->show(0x27F2); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x197) || _action.isAction(0xD3, 0x197)) { + _vm->_dialogs->show(0x27F3); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x70) || _action.isAction(VERB_WALKTO, 0x70)) { + _vm->_dialogs->show(0x27F4); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x71) || ((_action.isAction(VERB_CLOSE, 0x71) || _action.isAction(VERB_PUSH, 0x71)) && !_drawerDescrFl)) { + _vm->_dialogs->show(0x27EC); + _drawerDescrFl = true; + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_CLOSE, 0x71) || _action.isAction(VERB_PUSH, 0x71)) { + _vm->_dialogs->show(0x27ED); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_OPEN, 0x71)) { + _vm->_dialogs->show(0x27FC); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x47) || (_action.isAction(0x13F, 0x47) && !_chairDescrFl)) { + _chairDescrFl = true; + _vm->_dialogs->show(0x27E2); + _action._inProgress = false; + return; + } + + if (_action.isAction(0x13F, 0x47)) { + _vm->_dialogs->show(0x27E3); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0xDE)) { + if (_globals[kMedicineCabinetOpen]) + _vm->_dialogs->show(0x27DF); + else + _vm->_dialogs->show(0x27DE); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_CLOSE, 0xDE) && _globals[kMedicineCabinetOpen]) { + switch (_game._trigger) { + case 0: + _scene->_sequences.remove(_globals._spriteIndexes[23]); + _globals._spriteIndexes[23] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[8], false, 6, 1, 0, 0); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 1); + _game._player._stepEnabled = false; + _vm->_sound->command(21); + break; + + case 1: + _scene->_sequences.addTimer(48, 2); + break; + + case 2: + _game._player._stepEnabled = true; + _globals[kMedicineCabinetOpen] = false; + _vm->_dialogs->show(0x27E1); + break; + } + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_OPEN, 0xDE) && !_globals[kMedicineCabinetOpen]) { + switch (_game._trigger) { + case 0: + _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 6, 1, 0, 0); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 1); + _game._player._stepEnabled = false; + _vm->_sound->command(21); + break; + + case 1: + _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 6, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._spriteIndexes[23], -2, -2); + _scene->_sequences.addTimer(48, 2); + break; + + case 2: + _game._player._stepEnabled = true; + _globals[kMedicineCabinetOpen] = true; + if (_globals[kMedicineCabinetVirgin]) { + _vm->_dialogs->show(0x27E0); + } else { + _vm->_dialogs->show(0x27DF); + } + _globals[kMedicineCabinetVirgin] = false; + break; + } + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_TAKE, 0x27) && _game._objects.isInRoom(OBJ_BINOCULARS)) { + switch (_game._trigger) { + case 0: + _globals._spriteIndexes[26] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[11], false, 3, 1, 0, 0); + _scene->_sequences.setMsgLayout(_globals._spriteIndexes[26]); + _scene->_sequences.addSubEntry(_globals._spriteIndexes[26], SM_0, 0, 1); + _game._player._visible = false; + _game._player._stepEnabled = false; + break; + + case 1: + _game._objects.addToInventory(OBJ_BINOCULARS); + _scene->_sequences.remove(_globals._spriteIndexes[15+9]); + _scene->_hotspots.activate(0x27, false); + _game._player._visible = true; + _game._player._stepEnabled = true; + _vm->_sound->command(22); + _vm->_dialogs->showPicture(OBJ_BINOCULARS, 0x27D9); + break; + } + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_TAKE, 0x35) && _game._objects.isInRoom(OBJ_BURGER)) { + if (_game._trigger == 0) { + _vm->_dialogs->showPicture(OBJ_BURGER, 0x27FB); + _scene->_sequences.remove(_globals._spriteIndexes[25]); + _game._objects.addToInventory(OBJ_BURGER); + _scene->_hotspots.activate(0x35, false); + _vm->_sound->command(22); + _game._player._visible = true; + _game._player._stepEnabled = true; + } + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_TAKE, 0x117)) { + _vm->_dialogs->show(0x27F0); + _action._inProgress = false; + return; + } + + if ((_action.isAction(VERB_PUSH) || _action.isAction(VERB_PULL)) && _action.isAction(0x194)) { + _vm->_dialogs->show(0x27F1); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x89)) { + _vm->_dialogs->show(0x27F8); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x27) && !_game._objects.isInInventory(OBJ_BINOCULARS)) { + _vm->_dialogs->show(0x27F9); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x35) && (_action._mainObjectSource == 4)) { + _vm->_dialogs->show(0x321); + _action._inProgress = false; + } } void Scene102::postActions() { - + if (_action.isAction(VERB_PUT, 0x127) && _game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId))) { + _vm->_dialogs->show(0x27E9); + _action._inProgress = false; + } } /*------------------------------------------------------------------------*/ diff --git a/engines/mads/nebular/nebular_scenes1.h b/engines/mads/nebular/nebular_scenes1.h index 3f69223b81..782dbb573b 100644 --- a/engines/mads/nebular/nebular_scenes1.h +++ b/engines/mads/nebular/nebular_scenes1.h @@ -77,6 +77,18 @@ public: }; class Scene102 : public Scene1xx { +private: + bool _fridgeOpenedFl; + bool _fridgeOpenedDescr; + bool _fridgeFirstOpenFl; + bool _chairDescrFl; + bool _drawerDescrFl; + bool _activeMsgFl; + + int _fridgeCommentCount; + + void addRandomMessage(); + public: Scene102(MADSEngine *vm) : Scene1xx(vm) {} -- cgit v1.2.3 From d8c35b71dbd310d2012d501529867faab4875b29 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 11 Apr 2014 08:19:18 -0400 Subject: MADS: Fixed incorrect parameter order in scene 101 chair sit down --- engines/mads/nebular/nebular_scenes1.cpp | 2 +- engines/mads/sequence.cpp | 8 ++++---- engines/mads/sequence.h | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index c9a6165488..7cc0ded2f7 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -337,7 +337,7 @@ void Scene101::actions() { switch (_game._trigger) { case 0: _scene->_sequences.remove(_globals._spriteIndexes[27]); - _globals._spriteIndexes[26] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[11], false, 3, 0, 0, 1); + _globals._spriteIndexes[26] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[11], false, 3, 1); _scene->_sequences.setAnimRange(_globals._spriteIndexes[26], 1, 17); _scene->_sequences.addSubEntry(_globals._spriteIndexes[26], SM_FRAME_INDEX, 10, 1); _scene->_sequences.addSubEntry(_globals._spriteIndexes[26], SM_0, 0, 2); diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index fa6d745675..409dc303fe 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -55,7 +55,7 @@ SequenceEntry::SequenceEntry() { _entries._count = 0; Common::fill(&_entries._mode[0], &_entries._mode[SEQUENCE_ENTRY_SUBSET_MAX], SM_0); Common::fill(&_entries._frameIndex[0], &_entries._frameIndex[SEQUENCE_ENTRY_SUBSET_MAX], 0); - Common::fill(&_entries._abortVal[0], &_entries._abortVal[SEQUENCE_ENTRY_SUBSET_MAX], 0); + Common::fill(&_entries._trigger[0], &_entries._trigger[SEQUENCE_ENTRY_SUBSET_MAX], 0); } /*------------------------------------------------------------------------*/ @@ -80,14 +80,14 @@ void SequenceList::clear() { } } -bool SequenceList::addSubEntry(int index, SequenceSubEntryMode mode, int frameIndex, int abortVal) { +bool SequenceList::addSubEntry(int index, SequenceSubEntryMode mode, int frameIndex, int trigger) { if (_entries[index]._entries._count >= SEQUENCE_ENTRY_SUBSET_MAX) return true; int subIndex = _entries[index]._entries._count++; _entries[index]._entries._mode[subIndex] = mode; _entries[index]._entries._frameIndex[subIndex] = frameIndex; - _entries[index]._entries._abortVal[subIndex] = abortVal; + _entries[index]._entries._trigger[subIndex] = trigger; return false; } @@ -325,7 +325,7 @@ bool SequenceList::loadSprites(int seqIndex) { } if (idx >= 0) { - _vm->_game->_trigger = seqEntry._entries._abortVal[idx]; + _vm->_game->_trigger = seqEntry._entries._trigger[idx]; _vm->_game->_triggerMode = seqEntry._triggerMode; if (seqEntry._triggerMode != KERNEL_TRIGGER_DAEMON) diff --git a/engines/mads/sequence.h b/engines/mads/sequence.h index 6d12367fd9..99e8951688 100644 --- a/engines/mads/sequence.h +++ b/engines/mads/sequence.h @@ -42,7 +42,7 @@ struct SequenceSubEntries { int _count; SequenceSubEntryMode _mode[SEQUENCE_ENTRY_SUBSET_MAX]; int _frameIndex[SEQUENCE_ENTRY_SUBSET_MAX]; - int8 _abortVal[SEQUENCE_ENTRY_SUBSET_MAX]; + int8 _trigger[SEQUENCE_ENTRY_SUBSET_MAX]; }; struct SequenceEntry { @@ -95,7 +95,7 @@ public: SequenceEntry &operator[](int index) { return _entries[index]; } void clear(); - bool addSubEntry(int index, SequenceSubEntryMode mode, int frameIndex, int abortVal); + bool addSubEntry(int index, SequenceSubEntryMode mode, int frameIndex, int trigger); int add(int spriteListIndex, bool flipped, int frameIndex, int triggerCountdown, int delayTicks, int extraTicks, int numTicks, int msgX, int msgY, bool nonFixed, char scale, uint8 depth, int frameInc, SpriteAnimType animType, int numSprites, int frameStart); -- cgit v1.2.3 From 9ef9dd24c273950328a4f5ea99b36c91b4a4de81 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 11 Apr 2014 08:52:18 -0400 Subject: MADS: Replace warning with call to stubbed unhandledAction method --- engines/mads/scene.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 02a066a0c6..9f8c922861 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -489,7 +489,7 @@ void Scene::doAction() { } if (_action._inProgress) - warning("TODO: sub_1D9DE"); + _vm->_game->unhandledAction(); } } -- cgit v1.2.3 From f548711b7740fcaa01027a9184e4ae90a1c792e9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 11 Apr 2014 09:34:46 -0400 Subject: MADS: Fix palette transformation during SceneInfo::load --- engines/mads/palette.cpp | 2 +- engines/mads/scene_data.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index 34ba0acf54..2ff16fb5c1 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -250,7 +250,7 @@ void PaletteUsage::transform(Common::Array &palette) { if (!empty()) { for (uint i = 0; i < _data.size(); ++i) { int palIndex = _data[i]._palIndex; - _data[i] = palette[palIndex]._palIndex; + _data[i]._palIndex = palette[palIndex]._palIndex; } } } diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index f92ff86798..a82f65a6f0 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -219,7 +219,7 @@ void SceneInfo::load(int sceneId, int variant, const Common::String &resName, for (uint i = 0; i < _palAnimData.size(); ++i) { byte g = _palAnimData[i].g; - _palAnimData[g].b = artHeader._palAnimData[g].u; + _palAnimData[i].b = artHeader._palette[g]._palIndex; } } } -- cgit v1.2.3 From 84552f07b4992b743695300b860f585806705fbd Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 11 Apr 2014 19:33:56 +0200 Subject: MADS: Implement unhandledAction --- dists/msvc9/create_msvc9.bat | 6 +- engines/mads/nebular/game_nebular.cpp | 110 ++++++++++++++++++++++++++++++- engines/mads/nebular/nebular_scenes.h | 10 ++- engines/mads/nebular/nebular_scenes2.cpp | 2 +- 4 files changed, 120 insertions(+), 8 deletions(-) diff --git a/dists/msvc9/create_msvc9.bat b/dists/msvc9/create_msvc9.bat index 34bcccdd7b..561772b615 100644 --- a/dists/msvc9/create_msvc9.bat +++ b/dists/msvc9/create_msvc9.bat @@ -55,21 +55,21 @@ goto done echo. echo Creating project files with all engines enabled (stable and unstable) echo. -create_project ..\.. --enable-all-engines --msvc --msvc-version 9 +create_project ..\.. --enable-all-engines --msvc --msvc-version 9 --disable-taskbar --disable-freetype --disable-jpeg --disable-engine=zvision goto done :stable echo. echo Creating normal project files, with only the stable engines enabled echo. -create_project ..\.. --msvc --msvc-version 9 +create_project ..\.. --msvc --msvc-version 9 --disable-taskbar --disable-freetype --disable-jpeg --disable-engine=zvision goto done :tools echo. echo Creating tools project files echo. -create_project ..\.. --tools --msvc --msvc-version 9 +create_project ..\.. --tools --msvc --msvc-version 9 --disable-taskbar --disable-freetype --disable-jpeg --disable-engine=zvision goto done :tests diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index ed7d976635..b5c6e33d4f 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -566,7 +566,115 @@ void GameNebular::doObjectAction() { } void GameNebular::unhandledAction() { - warning("TODO: unhandledAction"); + int random = _vm->getRandomNumber(1, 1000); + MADSAction &action = _scene._action; + + if (action.isAction(VERB_THROW, NOUN_BOMB) || action.isAction(VERB_THROW, NOUN_BOMBS) + || action.isAction(VERB_THROW, NOUN_TIMEBOMB) || action.isAction(VERB_THROW, NOUN_CHICKEN_BOMB)) + _vm->_dialogs->show(0x2A); + else if (action.isAction(0x6C)) + _vm->_dialogs->show(0x1B3); + else if ((action.isAction(NOUN_EAT, NOUN_DEAD_FISH) || action.isAction(NOUN_EAT, NOUN_STUFFED_FISH)) && _vm->_game->_objects.isInInventory(_vm->_game->_objects.getIdFromDesc(action._activeAction._objectNameId))) + _vm->_dialogs->show(0xC); + else if ((action.isAction(NOUN_SMELL, NOUN_DEAD_FISH) || action.isAction(NOUN_SMELL, NOUN_STUFFED_FISH)) && _vm->_game->_objects.isInInventory(_vm->_game->_objects.getIdFromDesc(action._activeAction._objectNameId))) + _vm->_dialogs->show(0xD); + else if (action.isAction(NOUN_EAT, NOUN_CHICKEN) && _vm->_game->_objects.isInInventory(OBJ_CHICKEN)) + _vm->_dialogs->show(0x390); + else if ((action.isAction(NOUN_SHOOT) || action.isAction(NOUN_HOSE_DOWN)) && action.isAction(NOUN_BLOWGUN)) { + if ((_scene._currentSceneId >= 104) && (_scene._currentSceneId <= 111)) + _vm->_dialogs->show(0x26); + else if (action.isAction(0x10D)) + _vm->_dialogs->show(0x29); + else if (action.isAction(NOUN_CHICKEN) || action.isAction(0x185) || action.isAction(0x14D) + || action.isAction(0x1DD) || action.isAction(0x15F) || action.isAction(NOUN_CAPTIVE_CREATURE)) { + _vm->_dialogs->show(0x28); + } else + _vm->_dialogs->show(0x27); + } else if (action.isAction(VERB_TALKTO)) { + _globals[kTalkInanimateCount] = (_globals[kTalkInanimateCount] + 1) % 16; + if (!_globals[kTalkInanimateCount]) { + _vm->_dialogs->show(0x2); + } else { + Common::String tmpMsg = "\"Greetings, "; + tmpMsg += _vm->_game->_scene.getVocab(action._activeAction._objectNameId); + tmpMsg += "!\""; + _scene._kernelMessages.reset(); + _scene._kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, tmpMsg); + } + } else if (action.isAction(VERB_GIVE, NOUN_DOOR, 0x46) || action.isAction(VERB_CLOSE, NOUN_CHAIR)) + _vm->_dialogs->show(0x3); + else if (action.isAction(VERB_THROW)) { + int objId = _vm->_game->_objects.getIdFromDesc(action._activeAction._objectNameId); + if (objId < 0) + _vm->_dialogs->show(0x4); + else if (_vm->_game->_objects[objId]._roomNumber != 2) + _vm->_dialogs->show(0x5); + else + _vm->_dialogs->show(0x6); + } else if (action.isAction(VERB_LOOK)) { + if (action.isAction(0x27) && (action._activeAction._indirectObjectId > 0)) + _vm->_dialogs->show(0xA); + else if (random < 600) + _vm->_dialogs->show(0x7); + else + _vm->_dialogs->show(0x15); + } else if (action.isAction(VERB_TAKE)) { + int objId = _vm->_game->_objects.getIdFromDesc(action._activeAction._objectNameId); + if (_vm->_game->_objects.isInInventory(objId)) + _vm->_dialogs->show(0x10); + else if (random <= 333) + _vm->_dialogs->show(0x8); + else if (random <= 666) + _vm->_dialogs->show(0x16); + else + _vm->_dialogs->show(0x17); + } else if (action.isAction(VERB_CLOSE)) { + if (random <= 333) + _vm->_dialogs->show(0x9); + else + _vm->_dialogs->show(0x21); + } else if (action.isAction(VERB_OPEN)) { + if (random <= 500) + _vm->_dialogs->show(0x1E); + else if (random <= 750) + _vm->_dialogs->show(0x1F); + else + _vm->_dialogs->show(0x20); + } else if (action.isAction(VERB_PULL)) + _vm->_dialogs->show(0x12); + else if (action.isAction(VERB_PUSH)) { + if (random < 750) + _vm->_dialogs->show(0x13); + else + _vm->_dialogs->show(0x14); + } else if (action.isAction(VERB_PUT)) { + int objId = _vm->_game->_objects.getIdFromDesc(action._activeAction._objectNameId); + if (_vm->_game->_objects.isInInventory(objId)) + _vm->_dialogs->show(0x19); + else + _vm->_dialogs->show(0x18); + } else if (action.isAction(VERB_GIVE)) { + int objId = _vm->_game->_objects.getIdFromDesc(action._activeAction._objectNameId); + if (!_vm->_game->_objects.isInInventory(objId)) + _vm->_dialogs->show(0x1A); + else if (random <= 500) + _vm->_dialogs->show(0x1C); + else + _vm->_dialogs->show(0x1D); + } else if (!action.isAction(VERB_WALKTO) && !action.isAction(0x187) && !action.isAction(0x18C) && !action.isAction(0x1AD) + && !action.isAction(0x15C) && !action.isAction(0x159) && !action.isAction(0x15A) && !action.isAction(0x15B) + && !action.isAction(0x15E)) { + if (random <= 100) + _vm->_dialogs->show(0x24); + else if (random <= 200) + _vm->_dialogs->show(0x1); + else if (random <= 475) + _vm->_dialogs->show(0x22); + else if (random <= 750) + _vm->_dialogs->show(0x23); + else + _vm->_dialogs->show(0x25); + } } void GameNebular::step() { diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index 8e5bc05348..357180e870 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -41,10 +41,13 @@ enum { enum Noun { NOUN_D = 0xD, NOUN_BLOWGUN = 0x29, + NOUN_BOMB = 0x2A, + NOUN_BOMBS = 0x2B, NOUN_2C = 0x2C, NOUN_BURGER = 0x35, NOUN_CHAIR = 0x47, - NOUN_49 = 0x49, + NOUN_CHICKEN = 0x49, + NOUN_CHICKEN_BOMB = 0x4A, NOUN_4E = 0x4E, NOUN_DEAD_FISH = 0x65, NOUN_DOOR = 0x6E, @@ -85,8 +88,9 @@ enum Noun { NOUN_SMELL = 0x147, NOUN_STUFFED_FISH = 0x157, NOUN_15F = 0x15F, - NOUN_VIEW_SCREEN = 0x180, - NOUN_CAPTIVE_CREATURE = 0x1C3, + NOUN_TIMEBOMB = 0x171, + NOUN_VIEW_SCREEN = 0x180, + NOUN_CAPTIVE_CREATURE = 0x1C3, NOUN_NATIVE_WOMAN = 0x1DC, NOUN_ALCOHOL = 0x310, NOUN_DOLLOP = 0x3AC, diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index d78b85effc..4ef6f245ba 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -1095,7 +1095,7 @@ void Scene205::setup() { setPlayerSpritesPrefix(); setAAName(); _scene->addActiveVocab(NOUN_D); - _scene->addActiveVocab(NOUN_49); + _scene->addActiveVocab(NOUN_CHICKEN); _scene->addActiveVocab(NOUN_10D); } -- cgit v1.2.3 From 5ef46aff111ca2545256ff47fc591ce2f9225af1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 11 Apr 2014 19:45:25 +0200 Subject: MADS: rename a variable in unhandledAction --- engines/mads/nebular/game_nebular.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index b5c6e33d4f..30a67f920b 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -566,7 +566,7 @@ void GameNebular::doObjectAction() { } void GameNebular::unhandledAction() { - int random = _vm->getRandomNumber(1, 1000); + int randVal = _vm->getRandomNumber(1, 1000); MADSAction &action = _scene._action; if (action.isAction(VERB_THROW, NOUN_BOMB) || action.isAction(VERB_THROW, NOUN_BOMBS) @@ -614,7 +614,7 @@ void GameNebular::unhandledAction() { } else if (action.isAction(VERB_LOOK)) { if (action.isAction(0x27) && (action._activeAction._indirectObjectId > 0)) _vm->_dialogs->show(0xA); - else if (random < 600) + else if (randVal < 600) _vm->_dialogs->show(0x7); else _vm->_dialogs->show(0x15); @@ -622,28 +622,28 @@ void GameNebular::unhandledAction() { int objId = _vm->_game->_objects.getIdFromDesc(action._activeAction._objectNameId); if (_vm->_game->_objects.isInInventory(objId)) _vm->_dialogs->show(0x10); - else if (random <= 333) + else if (randVal <= 333) _vm->_dialogs->show(0x8); - else if (random <= 666) + else if (randVal <= 666) _vm->_dialogs->show(0x16); else _vm->_dialogs->show(0x17); } else if (action.isAction(VERB_CLOSE)) { - if (random <= 333) + if (randVal <= 333) _vm->_dialogs->show(0x9); else _vm->_dialogs->show(0x21); } else if (action.isAction(VERB_OPEN)) { - if (random <= 500) + if (randVal <= 500) _vm->_dialogs->show(0x1E); - else if (random <= 750) + else if (randVal <= 750) _vm->_dialogs->show(0x1F); else _vm->_dialogs->show(0x20); } else if (action.isAction(VERB_PULL)) _vm->_dialogs->show(0x12); else if (action.isAction(VERB_PUSH)) { - if (random < 750) + if (randVal < 750) _vm->_dialogs->show(0x13); else _vm->_dialogs->show(0x14); @@ -657,20 +657,20 @@ void GameNebular::unhandledAction() { int objId = _vm->_game->_objects.getIdFromDesc(action._activeAction._objectNameId); if (!_vm->_game->_objects.isInInventory(objId)) _vm->_dialogs->show(0x1A); - else if (random <= 500) + else if (randVal <= 500) _vm->_dialogs->show(0x1C); else _vm->_dialogs->show(0x1D); } else if (!action.isAction(VERB_WALKTO) && !action.isAction(0x187) && !action.isAction(0x18C) && !action.isAction(0x1AD) && !action.isAction(0x15C) && !action.isAction(0x159) && !action.isAction(0x15A) && !action.isAction(0x15B) && !action.isAction(0x15E)) { - if (random <= 100) + if (randVal <= 100) _vm->_dialogs->show(0x24); - else if (random <= 200) + else if (randVal <= 200) _vm->_dialogs->show(0x1); - else if (random <= 475) + else if (randVal <= 475) _vm->_dialogs->show(0x22); - else if (random <= 750) + else if (randVal <= 750) _vm->_dialogs->show(0x23); else _vm->_dialogs->show(0x25); -- cgit v1.2.3 From 3ad447313be0e93f164d68f902e4840a0d1da141 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 11 Apr 2014 19:52:45 +0200 Subject: MADS: Initialize scene102 variables, move an empty function of Scene 103 to header --- engines/mads/nebular/nebular_scenes1.cpp | 3 --- engines/mads/nebular/nebular_scenes1.h | 5 +++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 7cc0ded2f7..3722e4328c 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -1313,9 +1313,6 @@ void Scene103::step() { } } -void Scene103::preActions() { -} - void Scene103::actions() { if (_action._savedFields._lookFlag) { _vm->_dialogs->show(10322); diff --git a/engines/mads/nebular/nebular_scenes1.h b/engines/mads/nebular/nebular_scenes1.h index 782dbb573b..ac1e118d90 100644 --- a/engines/mads/nebular/nebular_scenes1.h +++ b/engines/mads/nebular/nebular_scenes1.h @@ -90,7 +90,8 @@ private: void addRandomMessage(); public: - Scene102(MADSEngine *vm) : Scene1xx(vm) {} + Scene102(MADSEngine *vm) : Scene1xx(vm), _fridgeOpenedFl(false), _fridgeOpenedDescr(false), _fridgeFirstOpenFl(false), + _chairDescrFl(false), _drawerDescrFl(false), _activeMsgFl(false), _fridgeCommentCount(0) {} virtual void setup(); virtual void enter(); @@ -107,7 +108,7 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions(); + virtual void preActions() {}; virtual void actions(); virtual void postActions(); }; -- cgit v1.2.3 From f8469aa20ac767e3de169a8acdc97f06d8f30211 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 11 Apr 2014 19:56:47 +0200 Subject: MADS: Fix CREATE_MSVC9 --- dists/msvc9/create_msvc9.bat | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dists/msvc9/create_msvc9.bat b/dists/msvc9/create_msvc9.bat index 561772b615..34bcccdd7b 100644 --- a/dists/msvc9/create_msvc9.bat +++ b/dists/msvc9/create_msvc9.bat @@ -55,21 +55,21 @@ goto done echo. echo Creating project files with all engines enabled (stable and unstable) echo. -create_project ..\.. --enable-all-engines --msvc --msvc-version 9 --disable-taskbar --disable-freetype --disable-jpeg --disable-engine=zvision +create_project ..\.. --enable-all-engines --msvc --msvc-version 9 goto done :stable echo. echo Creating normal project files, with only the stable engines enabled echo. -create_project ..\.. --msvc --msvc-version 9 --disable-taskbar --disable-freetype --disable-jpeg --disable-engine=zvision +create_project ..\.. --msvc --msvc-version 9 goto done :tools echo. echo Creating tools project files echo. -create_project ..\.. --tools --msvc --msvc-version 9 --disable-taskbar --disable-freetype --disable-jpeg --disable-engine=zvision +create_project ..\.. --tools --msvc --msvc-version 9 goto done :tests -- cgit v1.2.3 From ad346bbd3be18e7b89f07b981dd3f95e4dfbb594 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 11 Apr 2014 23:15:22 +0200 Subject: MADS: Implement scene 104, start splitting the arrays storing sprite and sequence indexes --- engines/mads/nebular/globals_nebular.cpp | 5 +- engines/mads/nebular/globals_nebular.h | 1 + engines/mads/nebular/nebular_scenes.cpp | 2 + engines/mads/nebular/nebular_scenes1.cpp | 195 ++++++++++++++++++++++++++++++- engines/mads/nebular/nebular_scenes1.h | 17 ++- 5 files changed, 216 insertions(+), 4 deletions(-) diff --git a/engines/mads/nebular/globals_nebular.cpp b/engines/mads/nebular/globals_nebular.cpp index 382a31e6e6..11c2b81502 100644 --- a/engines/mads/nebular/globals_nebular.cpp +++ b/engines/mads/nebular/globals_nebular.cpp @@ -29,11 +29,12 @@ namespace MADS { namespace Nebular { Globals::Globals() { - // Initialise lists + // Initialize lists _flags.resize(210); _spriteIndexes.resize(30); + _sequenceIndexes.resize(30); - // Initialise game flags + // Initialize game flags _timebombClock = 0; _timebombTimer = 0; _v0 = 0; diff --git a/engines/mads/nebular/globals_nebular.h b/engines/mads/nebular/globals_nebular.h index 51e18ee7cb..242e0d1b7b 100644 --- a/engines/mads/nebular/globals_nebular.h +++ b/engines/mads/nebular/globals_nebular.h @@ -284,6 +284,7 @@ private: Common::Array _flags; public: Common::Array _spriteIndexes; + Common::Array _sequenceIndexes; int _timebombClock, _timebombTimer; int _v0; diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 6528afe32c..9fa057e556 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -53,6 +53,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene102(vm); case 103: return new Scene103(vm); + case 104: + return new Scene104(vm); // Scene group #2 case 201: diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 3722e4328c..c460d7f498 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -1514,6 +1514,199 @@ void Scene103::postActions() { } } -} // End of namespace Nebular +/*------------------------------------------------------------------------*/ + +void Scene104::setup() { + // Preloading has been skipped + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene104::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('h', -1), false); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 14, 0, 0, 1); + + if (_scene->_priorSceneId == 105) + _game._player._playerPos = Common::Point(302, 107); + else if (_scene->_priorSceneId != -2) + _game._player._playerPos = Common::Point(160, 134); + + _loseFl = false; + _game.loadQuoteSet(0x35, 0x34, 0); + _kargShootingFl = false; + + if (_vm->getRandomNumber(1, 3) == 1) { + _scene->loadAnimation(Resources::formatName(104, 'B', -1, EXT_AA, ""), 0); + _kargShootingFl = true; + } + sceneEntrySound(); +} + +void Scene104::step() { + if ((_game._player._playerPos == Common::Point(189, 70)) && (_game._trigger || !_loseFl)) { + if (_game._player._facing == FACING_SOUTHWEST || _game._player._facing == FACING_SOUTHEAST) + _game._player._facing = FACING_SOUTH; + + if (_game._player._facing == FACING_NORTHWEST || _game._player._facing == FACING_NORTHEAST) + _game._player._facing = FACING_NORTH; + + bool mirrorFl = false; + if (_game._player._facing == FACING_WEST) { + _game._player._facing = FACING_EAST; + mirrorFl = true; + } + + _loseFl = true; + + switch (_game._player._facing) { + case FACING_EAST: + switch (_game._trigger) { + case 0: + _scene->_kernelMessages.reset(); + _scene->_activeAnimation->free(); + _scene->resetScene(); + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('a', 0), false); + warning("TODO: sub7C8DE()"); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], mirrorFl, 7, 1, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(198, 143)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SM_0, 0, 1); + break; + + case 1: + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], mirrorFl, 7, 0, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(198, 143)); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], -2, -2); + _scene->_sequences.addTimer(90, 2); + break; + + case 2: + _vm->_dialogs->show(0x28A6); + _scene->_reloadSceneFlag = true; + break; + } + break; + + case FACING_SOUTH: + switch (_game._trigger) { + case 0: + _scene->_kernelMessages.reset(); + _scene->_activeAnimation->free(); + _scene->resetScene(); + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('a', 1), false); + warning("TODO: sub7C8DE()"); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 6, 1, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[3], Common::Point(198, 143)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 4); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 14); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 1); + break; + + case 1: + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 5, 1, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[3], Common::Point(198, 143)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 4); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 15, 32); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 2); + break; + + case 2: + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 3, 0, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[3], Common::Point(198, 143)); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], -2, -2); + _scene->_sequences.addTimer(90, 3); + break; + + case 3: + _vm->_dialogs->show(0x28A6); + _scene->_reloadSceneFlag = true; + break; + } + break; + + case FACING_NORTH: + switch (_game._trigger) { + case 0: + _scene->_kernelMessages.reset(); + _scene->_activeAnimation->free(); + _scene->resetScene(); + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('a', 2), false); + warning("TODO: sub7C8DE()"); + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 8, 1, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(198, 143)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 4); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SM_0, 0, 1); + if (_game._storyMode >= STORYMODE_NICE) + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SM_FRAME_INDEX, 15, 2); + break; + + case 1: + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 8, 0, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(198, 143)); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], -2, -2); + _scene->_sequences.addTimer(90, 2); + break; + + case 2: + _vm->_dialogs->show(0x28A6); + _scene->_reloadSceneFlag = true; + break; + } + break; + default: + break; + } + + if (!_game._trigger) + _vm->_sound->command(34); + } + + if (_game._player._moving && (_scene->_rails.getNext() > 0)) { + _game._player.cancelCommand(); + _game._player.startWalking(Common::Point(189, 70), FACING_NONE); + _scene->_rails.resetNext(); + } + + if ((_game._player._special > 0) && _game._player._stepEnabled) + _game._player._stepEnabled = false; + + if (_kargShootingFl && (_scene->_activeAnimation->getCurrentFrame() >= 19)) { + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(52)); + _kargShootingFl = false; + } +} + +void Scene104::preActions() { + if (_action.isAction(0x15D, 0x74)) + _game._player._walkOffScreenSceneId = 105; + + if (_action.isAction(0x15D, 0x75)) + _game._player._walkOffScreenSceneId = 106; +} + +void Scene104::actions() { + if (_action._lookFlag) + _vm->_dialogs->show(0x28A5); + else if (_action.isAction(VERB_LOOK, 0x5E)) + _vm->_dialogs->show(0x28A4); + else if (_action.isAction(VERB_LOOK, 0x158)) + _vm->_dialogs->show(0x28A3); + else if (_action.isAction(VERB_LOOK, 0x4D)) + _vm->_dialogs->show(0x28A1); + else if (_action.isAction(VERB_LOOK, 0xF0)) + _vm->_dialogs->show(0x28A2); + else + return; + + _action._inProgress = false; +} + +} // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes1.h b/engines/mads/nebular/nebular_scenes1.h index ac1e118d90..e4c8618ff3 100644 --- a/engines/mads/nebular/nebular_scenes1.h +++ b/engines/mads/nebular/nebular_scenes1.h @@ -113,8 +113,23 @@ public: virtual void postActions(); }; -} // End of namespace Nebular +class Scene104 : public Scene1xx { +private: + bool _kargShootingFl; + bool _loseFl; + +public: + Scene104(MADSEngine *vm) : Scene1xx(vm), _kargShootingFl(false), _loseFl(false) {} + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; + +} // End of namespace Nebular } // End of namespace MADS #endif /* MADS_NEBULAR_SCENES1_H */ -- cgit v1.2.3 From 03be9bb80742045c3d4e2fa7994622328c06bb0a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 11 Apr 2014 23:23:36 +0200 Subject: MADS: Fix check on asset name suffix --- engines/mads/assets.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/assets.cpp b/engines/mads/assets.cpp index 47b2763e44..582b80dd8a 100644 --- a/engines/mads/assets.cpp +++ b/engines/mads/assets.cpp @@ -32,7 +32,7 @@ namespace MADS { SpriteAsset::SpriteAsset(MADSEngine *vm, const Common::String &resourceName, int flags) : _vm(vm) { Common::String resName = resourceName; - if (!resName.hasSuffix(".SS")) + if (!resName.hasSuffix(".SS") && !resName.hasSuffix(".ss")) resName += ".SS"; File file(resName); -- cgit v1.2.3 From 59d18733022b58672cea23d9349c29c22de13a27 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 11 Apr 2014 23:59:22 +0200 Subject: MADS: Split the other sprite and sequence index arrays --- engines/mads/nebular/nebular_scenes1.cpp | 258 +++---- engines/mads/nebular/nebular_scenes2.cpp | 1110 +++++++++++++++--------------- engines/mads/nebular/nebular_scenes8.cpp | 30 +- 3 files changed, 700 insertions(+), 698 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index c460d7f498..32172da760 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -111,17 +111,17 @@ void Scene101::sayDang() { switch (_game._trigger) { case 0: - _scene->_sequences.remove(_globals._spriteIndexes[26]); - _globals._spriteIndexes[26] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[11], false, 3, 6, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[26], 17, 21); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[26], SM_0, 0, 72); + _scene->_sequences.remove(_globals._sequenceIndexes[11]); + _globals._sequenceIndexes[11] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[11], false, 3, 6, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[11], 17, 21); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[11], SM_0, 0, 72); _vm->_sound->command(17); - _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 3, 2, 0, 0); + _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 3, 2, 0, 0); break; case 72: - _globals._spriteIndexes[26] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[11], false, 6, 0, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[26], 17, 17); + _globals._sequenceIndexes[11] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[11], false, 6, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[11], 17, 17); _scene->_kernelMessages.add(Common::Point(143, 61), 0x1110, 0, 0, 60, _game.getQuote(57)); _scene->_sequences.addTimer(120, 73); break; @@ -149,16 +149,16 @@ void Scene101::enter() { _globals._spriteIndexes[13] = _scene->_sprites.addSprites(formAnimName('x', 8)); _globals._spriteIndexes[14] = _scene->_sprites.addSprites(formAnimName('x', 0)); - _globals._spriteIndexes[16] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 5, 0, 0, 25); - _globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 4, 0, 1, 0); - _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 6, 0, 2, 0); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_FRAME_INDEX, 7, 70); - _globals._spriteIndexes[19] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[4], false, 10, 0, 0, 60); - _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 5, 0, 1, 0); - _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 10, 0, 2, 0); - _globals._spriteIndexes[22] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 6, 0, 0, 0); - _globals._spriteIndexes[24] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 6, 0, 10, 4); - _globals._spriteIndexes[25] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[10], false, 6, 0, 32, 47); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 5, 0, 0, 25); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 4, 0, 1, 0); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 6, 0, 2, 0); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_FRAME_INDEX, 7, 70); + _globals._sequenceIndexes[4] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[4], false, 10, 0, 0, 60); + _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 5, 0, 1, 0); + _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 10, 0, 2, 0); + _globals._sequenceIndexes[7] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 6, 0, 0, 0); + _globals._sequenceIndexes[9] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 6, 0, 10, 4); + _globals._sequenceIndexes[10] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[10], false, 6, 0, 32, 47); _scene->_hotspots.activate(0x137, false); _panelOpened = false; @@ -174,15 +174,15 @@ void Scene101::enter() { _sittingFl = true; _game._player._playerPos = Common::Point(161, 123); _game._player._facing = FACING_NORTHEAST; - _globals._spriteIndexes[26] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[11], false, 3, 0, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[26], 17, 17); + _globals._sequenceIndexes[11] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[11], false, 3, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[11], 17, 17); _scene->_hotspots.activate(0x47, false); _chairHotspotId = _scene->_dynamicHotspots.add(0x47, 0x13F, -1, Common::Rect(159, 84, 33, 36)); if (_scene->_priorSceneId == 112) sayDang(); } else { - _globals._spriteIndexes[27] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[12], false, 6, 0, 0, 0); - _scene->_sequences.setDepth(_globals._spriteIndexes[27], 4); + _globals._sequenceIndexes[12] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[12], false, 6, 0, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[12], 4); } _game.loadQuoteSet(0x31, 0x32, 0x39, 0x36, 0x37, 0x38, 0); @@ -276,10 +276,10 @@ void Scene101::preActions() { case 0: _game._player._needToWalk = false; _game._player._stepEnabled = false; - _scene->_sequences.remove(_globals._spriteIndexes[26]); - _globals._spriteIndexes[26] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[11], false, 3, 1, 0, 0); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[26], SM_0, 0, 1); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[26], 1, 17); + _scene->_sequences.remove(_globals._sequenceIndexes[11]); + _globals._sequenceIndexes[11] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[11], false, 3, 1, 0, 0); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[11], SM_0, 0, 1); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[11], 1, 17); _vm->_sound->command(16); break; @@ -290,8 +290,8 @@ void Scene101::preActions() { _game._player._needToWalk = true; _scene->_hotspots.activate(71, true); _scene->_dynamicHotspots.remove(_chairHotspotId); - _globals._spriteIndexes[27] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[12], false, 6, 0, 0, 0); - _scene->_sequences.setDepth(_globals._spriteIndexes[27], 4); + _globals._sequenceIndexes[12] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[12], false, 6, 0, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[12], 4); break; } } @@ -301,10 +301,10 @@ void Scene101::preActions() { switch (_game._trigger) { case 0: if (_game._player._needToWalk) { - _scene->_sequences.remove(_globals._spriteIndexes[28]); + _scene->_sequences.remove(_globals._sequenceIndexes[13]); _shieldSpriteIdx = _game._objects.isInRoom(0x18) ? 13 : 14; - _globals._spriteIndexes[28] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[_shieldSpriteIdx], false, 6, 1, 0, 0); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[28], SM_0, 0, 1); + _globals._sequenceIndexes[13] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[_shieldSpriteIdx], false, 6, 1, 0, 0); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SM_0, 0, 1); _game._player._stepEnabled = false; _vm->_sound->command(20); } @@ -336,11 +336,11 @@ void Scene101::actions() { if (!_sittingFl) { switch (_game._trigger) { case 0: - _scene->_sequences.remove(_globals._spriteIndexes[27]); - _globals._spriteIndexes[26] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[11], false, 3, 1); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[26], 1, 17); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[26], SM_FRAME_INDEX, 10, 1); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[26], SM_0, 0, 2); + _scene->_sequences.remove(_globals._sequenceIndexes[12]); + _globals._sequenceIndexes[11] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[11], false, 3, 1); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[11], 1, 17); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[11], SM_FRAME_INDEX, 10, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[11], SM_0, 0, 2); _game._player._stepEnabled = false; _game._player._visible = false; _action._inProgress = false; @@ -351,8 +351,8 @@ void Scene101::actions() { break; case 2: - _globals._spriteIndexes[26] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[11], false, 3, 0, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[26], 17, 17); + _globals._sequenceIndexes[11] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[11], false, 3, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[11], 17, 17); _game._player._stepEnabled = true; _sittingFl = true; _scene->_hotspots.activate(71, false); @@ -375,16 +375,16 @@ void Scene101::actions() { switch (_game._trigger) { case 0: _shieldSpriteIdx = _game._objects.isInRoom(0x18) ? 13 : 14; - _globals._spriteIndexes[28] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[_shieldSpriteIdx], false, 6, 1, 0, 0); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[28], SM_0, 0, 1); + _globals._sequenceIndexes[13] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[_shieldSpriteIdx], false, 6, 1, 0, 0); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SM_0, 0, 1); _game._player._stepEnabled = false; _vm->_sound->command(20); break; case 1: - _scene->_sequences.remove(_globals._spriteIndexes[28]); - _globals._spriteIndexes[28] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[_shieldSpriteIdx], false, 6, 0, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[28], -2, -2); + _scene->_sequences.remove(_globals._sequenceIndexes[13]); + _globals._sequenceIndexes[13] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[_shieldSpriteIdx], false, 6, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[13], -2, -2); _game._player._stepEnabled = true; _panelOpened = true; if (_game._objects.isInRoom(0x18)) @@ -397,9 +397,9 @@ void Scene101::actions() { if ((_action.isAction(VERB_TAKE, 0x137) || _action.isAction(VERB_PULL, 0x137)) && _game._objects.isInRoom(0x18)) { _game._objects.addToInventory(0x18); - _scene->_sequences.remove(_globals._spriteIndexes[28]); - _globals._spriteIndexes[28] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[14], false, 6, 0, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[28], -2, -2); + _scene->_sequences.remove(_globals._sequenceIndexes[13]); + _globals._sequenceIndexes[13] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[14], false, 6, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[13], -2, -2); _scene->_hotspots.activate(0x137, false); _vm->_dialogs->showPicture(0x18, 0x2788); _vm->_sound->command(22); @@ -433,24 +433,24 @@ void Scene101::actions() { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; - _scene->_sequences.remove(_globals._spriteIndexes[26]); - _globals._spriteIndexes[26] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[11], false, 3, 1, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[26], 17, 21); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[26], SM_0, 0, 1); + _scene->_sequences.remove(_globals._sequenceIndexes[11]); + _globals._sequenceIndexes[11] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[11], false, 3, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[11], 17, 21); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[11], SM_0, 0, 1); _vm->_sound->command(17); break; case 1: - _globals._spriteIndexes[26] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[11], false, 3, 1, 0, 0); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[26], SM_0, 0, 2); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[26], 17, 21); + _globals._sequenceIndexes[11] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[11], false, 3, 1, 0, 0); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[11], SM_0, 0, 2); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[11], 17, 21); break; case 2: - _globals._spriteIndexes[26] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[11], false, 3, 0, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[26], 17, 17); - _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 3, 1, 0, 0); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 3); + _globals._sequenceIndexes[11] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[11], false, 3, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[11], 17, 17); + _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 3, 1, 0, 0); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SM_0, 0, 3); break; case 3: @@ -635,25 +635,25 @@ void Scene102::enter() { _globals._spriteIndexes[15+2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 170, 0, 1, 6); _globals._spriteIndexes[15+3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 11, 0, 2, 3); _globals._spriteIndexes[15+4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 4, 0, 1, 0); - _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 3, 0, 0, 5); + _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 3, 0, 0, 5); if (!_game._objects.isInRoom(OBJ_BINOCULARS)) - _globals._spriteIndexes[24] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 24, 0, 0, 24); + _globals._sequenceIndexes[9] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 24, 0, 0, 24); else _scene->_hotspots.activate(0x27, false); _scene->_hotspots.activate(0x35, false); if (_globals[kMedicineCabinetOpen]) { - _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 6, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[23], -2, -2); + _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 6, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[8], -2, -2); } if (_scene->_priorSceneId == 101) { _game._player._playerPos = Common::Point(229, 109); _game._player._stepEnabled = false; - _globals._spriteIndexes[21] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[6], false, 6, 1, 2, 0); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[21], SM_0, 0, 70); + _globals._sequenceIndexes[6] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[6], false, 6, 1, 2, 0); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SM_0, 0, 70); } else if (_scene->_priorSceneId == 103) { _game._player._playerPos = Common::Point(47, 152); } else if (_scene->_priorSceneId != -2) { @@ -663,16 +663,16 @@ void Scene102::enter() { if (_scene->_priorSceneId != 106) { if (_globals[kWaterInAPuddle]) { - _globals._spriteIndexes[28] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[13], false, 6, 0, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[28], -2, -2); - _scene->_sequences.setDepth(_globals._spriteIndexes[28], 5); + _globals._sequenceIndexes[13] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[13], false, 6, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[13], -2, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 5); } } else { _game._player._stepEnabled = false; _game._player._visible = false; - _globals._spriteIndexes[28] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[13], false, 6, 1, 0, 0); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[28], SM_0, 0, 72); - _scene->_sequences.setDepth(_globals._spriteIndexes[28], 5); + _globals._sequenceIndexes[13] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[13], false, 6, 1, 0, 0); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SM_0, 0, 72); + _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 5); _vm->_sound->command(24); _vm->_sound->command(28); } @@ -695,9 +695,9 @@ void Scene102::step() { _game._player._stepEnabled = true; if (_game._trigger == 72) { - _globals._spriteIndexes[28] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[13], false, 6, 0, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[28], -2, -2); - _scene->_sequences.setDepth(_globals._spriteIndexes[28], 5); + _globals._sequenceIndexes[13] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[13], false, 6, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[13], -2, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 5); _scene->_sequences.addTimer(48, 90); } @@ -748,10 +748,10 @@ void Scene102::preActions() { switch (_game._trigger) { case 0: if (_game._player._needToWalk) { - _scene->_sequences.remove(_globals._spriteIndexes[22]); - _globals._spriteIndexes[22] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[7], false, 6, 1, 0, 0); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[22], SM_0, 0, 1); - _scene->_sequences.setDepth(_globals._spriteIndexes[22], 15); + _scene->_sequences.remove(_globals._sequenceIndexes[7]); + _globals._sequenceIndexes[7] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[7], false, 6, 1, 0, 0); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SM_0, 0, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 15); _game._player._stepEnabled = false; _vm->_sound->command(20); } @@ -759,7 +759,7 @@ void Scene102::preActions() { case 1: if (_game._objects.isInRoom(OBJ_BURGER)) { - _scene->_sequences.remove(_globals._spriteIndexes[25]); + _scene->_sequences.remove(_globals._sequenceIndexes[10]); _scene->_hotspots.activate(0x35, false); } _fridgeOpenedFl = false; @@ -784,12 +784,12 @@ void Scene102::actions() { if (_action.isAction(0x122) && !_fridgeOpenedFl) { switch (_game._trigger) { case 0: - _globals._spriteIndexes[22] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 6, 1, 0, 0); - _scene->_sequences.setDepth(_globals._spriteIndexes[22], 15); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[22], SM_0, 0, 1); + _globals._sequenceIndexes[7] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 15); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SM_0, 0, 1); if (_game._objects.isInRoom(OBJ_BURGER)) { - _globals._spriteIndexes[25] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[10], false, 7, 0, 0, 0); - _scene->_sequences.setDepth(_globals._spriteIndexes[25], 14); + _globals._sequenceIndexes[10] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[10], false, 7, 0, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 14); } _game._player._stepEnabled = false; _vm->_sound->command(20); @@ -797,9 +797,9 @@ void Scene102::actions() { return; case 1: - _globals._spriteIndexes[22] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 6, 0, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[22], -2, -2); - _scene->_sequences.setDepth(_globals._spriteIndexes[22], 15); + _globals._sequenceIndexes[7] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 6, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[7], -2, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 15); int delay; if (_action.isAction(VERB_WALKTO) && !_fridgeFirstOpenFl) delay = 0; @@ -861,8 +861,8 @@ void Scene102::actions() { if (_action.isAction(0x18B, 0x6E)) { switch (_game._trigger) { case 0: - _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 6, 1, 0, 0); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[21], SM_0, 0, 1); + _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 6, 1, 0, 0); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SM_0, 0, 1); _game._player._stepEnabled = false; _vm->_sound->command(20); break; @@ -1065,9 +1065,9 @@ void Scene102::actions() { if (_action.isAction(VERB_CLOSE, 0xDE) && _globals[kMedicineCabinetOpen]) { switch (_game._trigger) { case 0: - _scene->_sequences.remove(_globals._spriteIndexes[23]); - _globals._spriteIndexes[23] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[8], false, 6, 1, 0, 0); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 1); + _scene->_sequences.remove(_globals._sequenceIndexes[8]); + _globals._sequenceIndexes[8] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[8], false, 6, 1, 0, 0); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SM_0, 0, 1); _game._player._stepEnabled = false; _vm->_sound->command(21); break; @@ -1089,15 +1089,15 @@ void Scene102::actions() { if (_action.isAction(VERB_OPEN, 0xDE) && !_globals[kMedicineCabinetOpen]) { switch (_game._trigger) { case 0: - _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 6, 1, 0, 0); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 1); + _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 6, 1, 0, 0); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SM_0, 0, 1); _game._player._stepEnabled = false; _vm->_sound->command(21); break; case 1: - _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 6, 0, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[23], -2, -2); + _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 6, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[8], -2, -2); _scene->_sequences.addTimer(48, 2); break; @@ -1119,9 +1119,9 @@ void Scene102::actions() { if (_action.isAction(VERB_TAKE, 0x27) && _game._objects.isInRoom(OBJ_BINOCULARS)) { switch (_game._trigger) { case 0: - _globals._spriteIndexes[26] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[11], false, 3, 1, 0, 0); - _scene->_sequences.setMsgLayout(_globals._spriteIndexes[26]); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[26], SM_0, 0, 1); + _globals._sequenceIndexes[11] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[11], false, 3, 1, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[11]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[11], SM_0, 0, 1); _game._player._visible = false; _game._player._stepEnabled = false; break; @@ -1143,7 +1143,7 @@ void Scene102::actions() { if (_action.isAction(VERB_TAKE, 0x35) && _game._objects.isInRoom(OBJ_BURGER)) { if (_game._trigger == 0) { _vm->_dialogs->showPicture(OBJ_BURGER, 0x27FB); - _scene->_sequences.remove(_globals._spriteIndexes[25]); + _scene->_sequences.remove(_globals._sequenceIndexes[10]); _game._objects.addToInventory(OBJ_BURGER); _scene->_hotspots.activate(0x35, false); _vm->_sound->command(22); @@ -1215,32 +1215,32 @@ void Scene103::enter() { _globals._spriteIndexes[12] = _scene->_sprites.addSprites("*RXMBD_2"); _globals._spriteIndexes[13] = _scene->_sprites.addSprites("*RXMRD_3"); _globals._spriteIndexes[15] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 7, 0, 1, 0); - _globals._spriteIndexes[16] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 6, 0, 2, 0); - _scene->_sequences.setDepth(_globals._spriteIndexes[16], 0); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 6, 0, 2, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 0); - _globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 6, 0, 0, 25); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[17], SM_FRAME_INDEX, 2, 72); - _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 6, 0, 1, 37); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_FRAME_INDEX, 2, 73); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 6, 0, 0, 25); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SM_FRAME_INDEX, 2, 72); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 6, 0, 1, 37); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_FRAME_INDEX, 2, 73); - _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8); - _globals._spriteIndexes[22] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 6); - _globals._spriteIndexes[19] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 6); - _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 6); + _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8); + _globals._sequenceIndexes[7] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 6); + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 6); + _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 6); if (_game._objects.isInRoom(OBJ_TIMER_MODULE)) - _globals._spriteIndexes[26] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[11], false, 6); + _globals._sequenceIndexes[11] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[11], false, 6); else _vm->_game->_scene._hotspots.activate(371, false); if (_game._objects.isInRoom(OBJ_REBREATHER)) - _globals._spriteIndexes[25] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[10], false, 6); + _globals._sequenceIndexes[10] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[10], false, 6); else _vm->_game->_scene._hotspots.activate(289, false); if (_globals[kTurkeyExploded]) { - _globals._spriteIndexes[24] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 6); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[24], -2, -2); + _globals._sequenceIndexes[9] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 6); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[9], -2, -2); _scene->_hotspots.activate(362, false); } @@ -1250,8 +1250,8 @@ void Scene103::enter() { if (_scene->_priorSceneId == 102) { _game._player._stepEnabled = false; - _globals._spriteIndexes[21] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[6], false, 6, 1, 0, 0); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[21], SM_0, 0, 70); + _globals._sequenceIndexes[6] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[6], false, 6, 1, 0, 0); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SM_0, 0, 70); } sceneEntrySound(); @@ -1319,8 +1319,8 @@ void Scene103::actions() { } else if (_action.isAction(395, 110)) { switch (_vm->_game->_trigger) { case 0: - _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 6, 1); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[21], SM_0, 0, 1); + _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 6, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SM_0, 0, 1); _game._player._stepEnabled = false; _vm->_sound->command(20); break; @@ -1338,18 +1338,18 @@ void Scene103::actions() { switch (_vm->_game->_trigger) { case 0: _scene->changeVariant(1); - _globals._spriteIndexes[28] = _scene->_sequences.startReverseCycle( + _globals._sequenceIndexes[13] = _scene->_sequences.startReverseCycle( _globals._spriteIndexes[13], false, 3, 2); - _scene->_sequences.setMsgLayout(_globals._spriteIndexes[28]); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[13]); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[28], SM_FRAME_INDEX, 7, 1); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[28], SM_0, 0, 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SM_FRAME_INDEX, 7, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SM_0, 0, 2); _vm->_game->_player._visible = false; _vm->_game->_player._stepEnabled = false; break; case 1: - _scene->_sequences.remove(_globals._spriteIndexes[26]); + _scene->_sequences.remove(_globals._sequenceIndexes[11]); break; case 2: @@ -1370,18 +1370,18 @@ void Scene103::actions() { switch (_vm->_game->_trigger) { case 0: _scene->changeVariant(1); - _globals._spriteIndexes[27] = _scene->_sequences.startReverseCycle( + _globals._sequenceIndexes[12] = _scene->_sequences.startReverseCycle( _globals._spriteIndexes[12], false, 3, 2); - _scene->_sequences.setMsgLayout(_globals._spriteIndexes[27]); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[12]); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[27], SM_FRAME_INDEX, 6, 1); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[27], SM_0, 0, 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SM_FRAME_INDEX, 6, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SM_0, 0, 2); _vm->_game->_player._visible = false; _vm->_game->_player._stepEnabled = false; break; case 1: - _scene->_sequences.remove(_globals._spriteIndexes[25]); + _scene->_sequences.remove(_globals._sequenceIndexes[10]); break; case 2: @@ -1404,10 +1404,10 @@ void Scene103::actions() { _vm->_sound->command(31); if (_vm->_game->_trigger < 2) { - _globals._spriteIndexes[24] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 6, _vm->_game->_trigger < 1 ? 1 : 0); + _globals._sequenceIndexes[9] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 6, _vm->_game->_trigger < 1 ? 1 : 0); if (_vm->_game->_trigger) { // Lock the turkey into a permanent "exploded" frame - _scene->_sequences.setAnimRange(_globals._spriteIndexes[24], -1, -1); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[9], -1, -1); // Rex says "Gads.." Common::String msg = _game.getQuote(51); @@ -1415,7 +1415,7 @@ void Scene103::actions() { _scene->_sequences.addTimer(120, _vm->_game->_trigger + 1); } else { // Initial turky explosion - _scene->_sequences.addSubEntry(_globals._spriteIndexes[24], SM_0, 0, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SM_0, 0, 1); } } @@ -1708,5 +1708,7 @@ void Scene104::actions() { _action._inProgress = false; } +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 4ef6f245ba..a804dbbac9 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -132,14 +132,14 @@ void Scene201::enter() { _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('m', -1)); _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('b', -1)); _globals._spriteIndexes[5] = _scene->_sprites.addSprites("*SC002Z1"); - _globals._spriteIndexes[16] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 6, 0, 1, 0); - _globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 15, 0, 0, 50); - _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 4, 0, 0, 0); - _globals._spriteIndexes[19] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 6, 0, 0, 0); - _scene->_sequences.setDepth(_globals._spriteIndexes[19], 8); - _scene->_sequences.setMsgPosition(_globals._spriteIndexes[19], Common::Point(185, 46)); - - int idx = _scene->_dynamicHotspots.add(1159, 209, _globals._spriteIndexes[19], Common::Rect(0, 0, 0, 0)); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 6, 0, 1, 0); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 15, 0, 0, 50); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 4, 0, 0, 0); + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 6, 0, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 8); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(185, 46)); + + int idx = _scene->_dynamicHotspots.add(1159, 209, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(186, 81), FACING_NORTH); if ((_scene->_priorSceneId == 202) || (_scene->_priorSceneId == -1)) { @@ -186,10 +186,10 @@ void Scene201::enter() { _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('a', 1)); _game.loadQuoteSet(90, 91, 0); _game._player._stepEnabled = false; - _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 7, 1, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[21], -1, 12); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[21], SM_FRAME_INDEX, 12, 70); - _scene->_sequences.setDepth(_globals._spriteIndexes[21], 1); + _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 7, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[6], -1, 12); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SM_FRAME_INDEX, 12, 70); + _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 1); _pterodactylFlag = false; _game._player.walk(Common::Point(157, 143), FACING_NORTH); _vm->_palette->setEntry(252, 45, 63, 45); @@ -206,25 +206,25 @@ void Scene201::enter() { void Scene201::step() { if (_pterodactylFlag && (_vm->getRandomNumber(5000) == 9)) { - _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 5, 1, 6, 0); - int idx = _scene->_dynamicHotspots.add(351, 13, _globals._spriteIndexes[20], Common::Rect(0, 0, 0, 0)); + _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 5, 1, 6, 0); + int idx = _scene->_dynamicHotspots.add(351, 13, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(270, 80), FACING_EAST); - _scene->_sequences.setDepth(_globals._spriteIndexes[20], 8); + _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 8); _vm->_sound->command(14); _pterodactylFlag = false; } if (_game._trigger == 70) { - _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 9, 1, 0, 0); + _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 9, 1, 0, 0); _game._player._visible = false; - _scene->_sequences.setAnimRange(_globals._spriteIndexes[21], 12, 16); - _globals._spriteIndexes[22] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 9, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[6], 12, 16); + _globals._sequenceIndexes[7] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 9, 1, 0, 0); _vm->_sound->command(42); - _scene->_sequences.setDepth(_globals._spriteIndexes[21], 1); - _scene->_sequences.setDepth(_globals._spriteIndexes[22], 1); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[22], SM_FRAME_INDEX, 3, 81); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[22], SM_0, 0, 71); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[21], SM_0, 0, 73); + _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SM_FRAME_INDEX, 3, 81); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SM_0, 0, 71); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SM_0, 0, 73); } if (_game._trigger == 81) { @@ -232,25 +232,25 @@ void Scene201::step() { } if (_game._trigger == 71) { - _globals._spriteIndexes[22] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 9, 0, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[22], -2, -2); - _scene->_sequences.setDepth(_globals._spriteIndexes[22], 1); + _globals._sequenceIndexes[7] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 9, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[7], -2, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 1); } if (_game._trigger == 73) { - _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 9, 1, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[21], 17, -2); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[21], SM_0, 0, 74); - _scene->_sequences.setDepth(_globals._spriteIndexes[21], 1); + _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 9, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[6], 17, -2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SM_0, 0, 74); + _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 1); } if (_game._trigger == 74) { _vm->_sound->command(40); _scene->_kernelMessages.add(Common::Point(125, 56), 0xFDFC, 32, 82, 180, _game.getQuote(91)); - _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 9, 0, 0, 0); - _scene->_sequences.setDepth(_globals._spriteIndexes[21], 1); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[21], -2, -2); + _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 9, 0, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 1); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[6], -2, -2); _scene->_sequences.addTimer(180, 75); } @@ -354,26 +354,26 @@ void Scene202::enter() { _globals._spriteIndexes[9] = _scene->_sprites.addSprites(formAnimName('a', 1)); _globals._spriteIndexes[11] = _scene->_sprites.addSprites(formAnimName('a', 2)); - _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 6, 0, 0, 0); - _globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 6, 0, 0, 0); - _scene->_sequences.setMsgPosition(_globals._spriteIndexes[17], Common::Point(149, 113)); - _scene->_sequences.setDepth(_globals._spriteIndexes[17], 10); - int idx = _scene->_dynamicHotspots.add(320, 13, _globals._spriteIndexes[17], Common::Rect(0, 0, 0, 0)); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 6, 0, 0, 0); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 6, 0, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(149, 113)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 10); + int idx = _scene->_dynamicHotspots.add(320, 13, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(153, 97), FACING_SOUTH); if (!(_globals[kBone202Status] & 1)) { - _globals._spriteIndexes[16] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 6, 0, 0, 0); - _scene->_sequences.setMsgPosition(_globals._spriteIndexes[16], Common::Point(130, 108)); - _scene->_sequences.setDepth(_globals._spriteIndexes[16], 10); - idx = _scene->_dynamicHotspots.add(44, 13, _globals._spriteIndexes[16], Common::Rect(0, 0, 0, 0)); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 6, 0, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(130, 108)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); + idx = _scene->_dynamicHotspots.add(44, 13, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(132, 97), FACING_SOUTH); } if (!(_globals[kBone202Status] & 2)) { - _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 6, 0, 0, 0); - _scene->_sequences.setMsgPosition(_globals._spriteIndexes[21], Common::Point(166, 110)); - _scene->_sequences.setDepth(_globals._spriteIndexes[21], 10); - idx = _scene->_dynamicHotspots.add(44, 13, _globals._spriteIndexes[21], Common::Rect(0, 0, 0, 0)); + _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 6, 0, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[6], Common::Point(166, 110)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 10); + idx = _scene->_dynamicHotspots.add(44, 13, _globals._sequenceIndexes[6], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(165, 99), FACING_SOUTH); } @@ -389,10 +389,10 @@ void Scene202::enter() { } if (_globals[kLadderBroken]) { - _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 6, 0, 0, 0); - _scene->_sequences.setDepth(_globals._spriteIndexes[20], 6); + _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 6, 0, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 6); _scene->_hotspots.activate(199, false); - idx = _scene->_dynamicHotspots.add(457, 13, _globals._spriteIndexes[20], Common::Rect(0, 0, 0, 0)); + idx = _scene->_dynamicHotspots.add(457, 13, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(246, 124), FACING_NORTH); } @@ -401,7 +401,7 @@ void Scene202::enter() { if (_scene->_priorSceneId == -2) { if (_waitingMeteoFl) { - _globals._spriteIndexes[24] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 1); + _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 1); _game._player._visible = false; } } else { @@ -423,18 +423,18 @@ void Scene202::enter() { _ladderTopFl = false; if (_globals[kMeteorologistWatch] < 1) - _globals._spriteIndexes[25] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 6); + _globals._sequenceIndexes[10] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 6); else - _globals._spriteIndexes[25] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 8); - _scene->_sequences.setDepth(_globals._spriteIndexes[25], 1); + _globals._sequenceIndexes[10] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 8); + _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 1); if (_ladderTopFl) { - _scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(247, 82)); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[10], Common::Point(247, 82)); _game._player._playerPos = Common::Point(246, 124); _game._player._facing = FACING_NORTH; _globals[kTeleporterUnderstood] = true; } else { - _scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(172, 123)); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[10], Common::Point(172, 123)); _game._player._playerPos = Common::Point(171, 122); _game._player._facing = FACING_NORTH; } @@ -443,9 +443,9 @@ void Scene202::enter() { _scene->_activeAnimation->setCurrentFrame(200); } else { _game._player._visible = false; - _scene->_sequences.startCycle(_globals._spriteIndexes[24], true, 1); - _scene->_sequences.setDepth(_globals._spriteIndexes[24], 1); - _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(247, 82)); + _scene->_sequences.startCycle(_globals._sequenceIndexes[9], true, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[9], Common::Point(247, 82)); _game._player._playerPos = Common::Point(246, 124); _game._player._facing = FACING_NORTH; } @@ -503,36 +503,36 @@ void Scene202::step() { switch (_game._trigger) { case 90: _vm->_sound->command(41); - _scene->_sequences.remove(_globals._spriteIndexes[25]); - _globals._spriteIndexes[24] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[9], true, 6, 1, 0, 0); - _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(247, 82)); - _scene->_sequences.setDepth(_globals._spriteIndexes[24], 1); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[24], SM_0, 0, 91); + _scene->_sequences.remove(_globals._sequenceIndexes[10]); + _globals._sequenceIndexes[9] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[9], true, 6, 1, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[9], Common::Point(247, 82)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SM_0, 0, 91); break; case 91: - _globals._spriteIndexes[24] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, 1); - _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(247, 82)); - _scene->_sequences.setDepth(_globals._spriteIndexes[24], 1); + _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[9], Common::Point(247, 82)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 1); _scene->_sequences.addTimer(60, 92); break; case 92: { - _scene->_sequences.remove(_globals._spriteIndexes[24]); - _globals._spriteIndexes[26] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[11], false, 6, 1, 0, 0); - _scene->_sequences.setDepth(_globals._spriteIndexes[26], 1); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[26], SM_0, 0, 93); + _scene->_sequences.remove(_globals._sequenceIndexes[9]); + _globals._sequenceIndexes[11] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[11], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[11], 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[11], SM_0, 0, 93); _scene->_kernelMessages.reset(); int msgIndex = _scene->_kernelMessages.add(Common::Point(0, -65), 0x1110, 32, 0, 60, _game.getQuote(98)); - _scene->_kernelMessages.setSeqIndex(msgIndex, _globals._spriteIndexes[26]); + _scene->_kernelMessages.setSeqIndex(msgIndex, _globals._sequenceIndexes[11]); } break; case 93: { _globals[kLadderBroken] = -1; - _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 6, 0, 0, 0); + _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 6, 0, 0, 0); _scene->_hotspots.activate(199, false); - int idx = _scene->_dynamicHotspots.add(457, 13, _globals._spriteIndexes[20], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(457, 13, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(246, 124), FACING_NORTH); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[26], _globals._spriteIndexes[20]); - _scene->_sequences.updateTimeout(-1, _globals._spriteIndexes[26]); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[11], _globals._sequenceIndexes[5]); + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[11]); _game._player._stepEnabled = true; _game._player._visible = true; _ladderTopFl = false; @@ -713,12 +713,12 @@ void Scene202::preActions() { _vm->_sound->command(29); player._readyToWalk = false; _game._player._stepEnabled = false; - _scene->_sequences.remove(_globals._spriteIndexes[24]); - _globals._spriteIndexes[23] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[8], false, 6, 1, 0, 0); - _scene->_sequences.setDepth(_globals._spriteIndexes[23], 1); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 1); + _scene->_sequences.remove(_globals._sequenceIndexes[9]); + _globals._sequenceIndexes[8] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[8], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[8], 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SM_0, 0, 1); } else if (_game._trigger == 1) { - _scene->_sequences.updateTimeout(-1, _globals._spriteIndexes[23]); + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[8]); _scene->_dynamicHotspots.remove(_ladderHotspotId); _game._player._visible = true; player._readyToWalk = true; @@ -762,18 +762,18 @@ void Scene202::actions() { } else { _game._player._stepEnabled = false; _game._player._visible = false; - _globals._spriteIndexes[22] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[6], false, 3, 2, 0, 0); - _scene->_sequences.setMsgLayout(_globals._spriteIndexes[22]); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[22], SM_FRAME_INDEX, 6, 1); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[22], SM_0, 0, 2); + _globals._sequenceIndexes[7] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[6], false, 3, 2, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[7]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SM_FRAME_INDEX, 6, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SM_0, 0, 2); } break; case 1: if (_game._player._playerPos == Common::Point(132,97)) { - _scene->_sequences.remove(_globals._spriteIndexes[16]); + _scene->_sequences.remove(_globals._sequenceIndexes[1]); _globals[kBone202Status] |= 1; } else { - _scene->_sequences.remove(_globals._spriteIndexes[21]); + _scene->_sequences.remove(_globals._sequenceIndexes[6]); _globals[kBone202Status] |= 2; } break; @@ -805,15 +805,15 @@ void Scene202::actions() { _ladderHotspotId = _scene->_dynamicHotspots.add(199, 79, -1, Common::Rect(241, 68, 12, 54)); _scene->_dynamicHotspots.setPosition(_ladderHotspotId, Common::Point(246, 124), FACING_NORTH); - _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 6, 1, 0, 0); - _scene->_sequences.setDepth(_globals._spriteIndexes[23], 1); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 1); + _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[8], 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SM_0, 0, 1); break; case 1: { - _globals._spriteIndexes[24] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, 1); - _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(247, 82)); - _scene->_sequences.setDepth(_globals._spriteIndexes[24], 1); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[23], _globals._spriteIndexes[24]); + _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[9], Common::Point(247, 82)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 1); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[8], _globals._sequenceIndexes[9]); _ladderTopFl = true; _game._player._stepEnabled = true; int msgIndex = _scene->_kernelMessages.add(Common::Point(248, 15), 0x1110, 32, 0, 60, _game.getQuote(97)); @@ -830,17 +830,17 @@ void Scene202::actions() { case 0: _game._player._stepEnabled = false; _game._player._visible= false; - _globals._spriteIndexes[25] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 6, 1, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[25], 1, 6); - _scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(172, 123)); - _scene->_sequences.setDepth(_globals._spriteIndexes[25], 1); - _scene->_sequences.updateTimeout(-1, _globals._spriteIndexes[25]); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[25], SM_0, 0, 1); + _globals._sequenceIndexes[10] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 6, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[10], 1, 6); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[10], Common::Point(172, 123)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 1); + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[10]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[10], SM_0, 0, 1); break; case 1: - _globals._spriteIndexes[25] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 6); - _scene->_sequences.setDepth(_globals._spriteIndexes[25], 1); - _scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(172, 123)); + _globals._sequenceIndexes[10] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 6); + _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[10], Common::Point(172, 123)); if (_scene->_activeAnimation) { _waitingMeteoFl = true; _globals[kMeteorologistWatch] = 1; @@ -852,15 +852,15 @@ void Scene202::actions() { if (!_scene->_activeAnimation && (_globals._abortVal == 0)) { _vm->_dialogs->show(0x4EFE); } - _scene->_sequences.remove(_globals._spriteIndexes[25]); - _globals._spriteIndexes[25] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[9], false, 6, 1, 0, 0); - _scene->_sequences.setDepth(_globals._spriteIndexes[25], 1); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[25], 1, 6); - _scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(172, 123)); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[25], SM_0, 0, 3); + _scene->_sequences.remove(_globals._sequenceIndexes[10]); + _globals._sequenceIndexes[10] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[9], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 1); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[10], 1, 6); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[10], Common::Point(172, 123)); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[10], SM_0, 0, 3); break; case 3: - _scene->_sequences.updateTimeout(-1, _globals._spriteIndexes[25]); + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[10]); _game._player._stepEnabled = true; _game._player._visible = true; break; @@ -873,16 +873,16 @@ void Scene202::actions() { case 0: _toTeleportFl = true; _game._player._stepEnabled = false; - _scene->_sequences.remove(_globals._spriteIndexes[24]); - _globals._spriteIndexes[24] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], true, 6, 1, 0, 0); - _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(247, 82)); - _scene->_sequences.setDepth(_globals._spriteIndexes[24], 1); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[24], SM_0, 0, 1); + _scene->_sequences.remove(_globals._sequenceIndexes[9]); + _globals._sequenceIndexes[9] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], true, 6, 1, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[9], Common::Point(247, 82)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SM_0, 0, 1); break; case 1: - _globals._spriteIndexes[25] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, -2); - _scene->_sequences.setMsgPosition(_globals._spriteIndexes[25], Common::Point(247, 82)); - _scene->_sequences.setDepth(_globals._spriteIndexes[25], 1); + _globals._sequenceIndexes[10] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, -2); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[10], Common::Point(247, 82)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 1); if (_scene->_activeAnimation) { if (_scene->_activeAnimation->getCurrentFrame() > 200) { _scene->_sequences.addTimer(120, 2); @@ -906,16 +906,16 @@ void Scene202::actions() { if (!_scene->_activeAnimation) _vm->_dialogs->show(0x4EFE); _globals._abortVal = 0; - _scene->_sequences.remove(_globals._spriteIndexes[25]); - _globals._spriteIndexes[24] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[9], false, 6, 1, 0, 0); - _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(247, 82)); - _scene->_sequences.setDepth(_globals._spriteIndexes[24], 1); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[24], SM_0, 0, 3); + _scene->_sequences.remove(_globals._sequenceIndexes[10]); + _globals._sequenceIndexes[9] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[9], false, 6, 1, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[9], Common::Point(247, 82)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SM_0, 0, 3); break; case 3: - _globals._spriteIndexes[24] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, 1); - _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(247, 82)); - _scene->_sequences.setDepth(_globals._spriteIndexes[24], 1); + _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[9], Common::Point(247, 82)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 1); _game._player._stepEnabled = true; break; default: @@ -1110,28 +1110,28 @@ void Scene205::enter() { if (_globals[kSexOfRex] == SEX_MALE) _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('a', 1)); - _globals._spriteIndexes[16] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 10, 0, 0, 3); - int idx = _scene->_dynamicHotspots.add(73, 13, _globals._spriteIndexes[16], Common::Rect(0, 0, 0, 0)); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 10, 0, 0, 3); + int idx = _scene->_dynamicHotspots.add(73, 13, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(162, 120), FACING_NORTHEAST); - _globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 15, 0, 0, 0); - idx = _scene->_dynamicHotspots.add(73, 13, _globals._spriteIndexes[16], Common::Rect(0, 0, 0, 0)); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 15, 0, 0, 0); + idx = _scene->_dynamicHotspots.add(73, 13, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(162, 120), FACING_NORTHEAST); - _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 9, 0, 0, 0); - _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 6, 0, 0, 0); - _scene->_sequences.setDepth(_globals._spriteIndexes[20], 11); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 9, 0, 0, 0); + _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 6, 0, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 11); if (!_game._visitedScenes._sceneRevisited) { _lastFishTime = _scene->_frameStartTime; - _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 7, 1, 0, 0); - idx = _scene->_dynamicHotspots.add(269, 13, _globals._spriteIndexes[21], Common::Rect(0, 0, 0, 0)); + _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 7, 1, 0, 0); + idx = _scene->_dynamicHotspots.add(269, 13, _globals._sequenceIndexes[6], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(49, 86), FACING_NORTH); } if (_game._objects[12]._roomNumber == 205) { - _globals._spriteIndexes[19] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 7, 0, 0, 0); - _scene->_sequences.setDepth(_globals._spriteIndexes[19], 11); + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 7, 0, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 11); } else { _scene->_hotspots.activate(450, false); } @@ -1163,13 +1163,13 @@ void Scene205::enter() { _scene->_activeAnimation->_resetFlag = false; } else { _globals._frameTime |= 0xFFFF0000; - _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8, 1, 0, 0); + _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8, 1, 0, 0); _game._player._visible = false; _game._player._stepEnabled = false; - _scene->_sequences.setDepth(_globals._spriteIndexes[23], 2); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_FRAME_INDEX, 6, 73); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_FRAME_INDEX, 11, 74); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[8], 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SM_FRAME_INDEX, 6, 73); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SM_FRAME_INDEX, 11, 74); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SM_0, 0, 0); } sceneEntrySound(); } @@ -1187,8 +1187,8 @@ void Scene205::step() { } if (_globals._frameTime - _lastFishTime > 1300) { - _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 5, 1, 0, 0); - int idx = _scene->_dynamicHotspots.add(269, 13, _globals._spriteIndexes[21], Common::Rect(0, 0, 0, 0)); + _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 5, 1, 0, 0); + int idx = _scene->_dynamicHotspots.add(269, 13, _globals._sequenceIndexes[6], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(49, 86), FACING_NORTH); _lastFishTime = _globals._frameTime; } @@ -1203,9 +1203,9 @@ void Scene205::step() { } if (_game._trigger == 71) { - _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 6, 0, 0, 0); - _scene->_sequences.setDepth(_globals._spriteIndexes[23], 2); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[23], -2, -2); + _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 6, 0, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[8], 2); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[8], -2, -2); _scene->_kernelMessages.reset(); _scene->_kernelMessages.add(Common::Point(160, 68), 0xFBFA, 32, 72, 180, _game.getQuote(114)); } @@ -1238,8 +1238,8 @@ void Scene207::enter() { _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('e', 1)); _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('g', 1)); _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('g', 0)); - _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 7, 0, 0, 0); - _scene->_sequences.setDepth(_globals._spriteIndexes[20], 7); + _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 7, 0, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 7); int var2; if (!_game._visitedScenes._sceneRevisited) { @@ -1256,17 +1256,17 @@ void Scene207::enter() { _spiderFl = (var2 & 1); if (_vultureFl) { - _globals._spriteIndexes[16] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 30, 0, 0, 400); + _globals._sequenceIndexes[1] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 30, 0, 0, 400); _vultureTime = _game._player._priorTimer; - _vultureHotspotId = _scene->_dynamicHotspots.add(389, 13, _globals._spriteIndexes[16], Common::Rect(0, 0, 0, 0)); + _vultureHotspotId = _scene->_dynamicHotspots.add(389, 13, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(_vultureHotspotId, Common::Point(254, 94), FACING_WEST); } if (_spiderFl) { - _globals._spriteIndexes[19] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 7, 1, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[19], -1, -1); + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 7, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], -1, -1); _spiderTime = _game._player._priorTimer; - _spiderHotspotId = _scene->_dynamicHotspots.add(333, 13, _globals._spriteIndexes[19], Common::Rect(0, 0, 0, 0)); + _spiderHotspotId = _scene->_dynamicHotspots.add(333, 13, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(_spiderHotspotId, Common::Point(59, 132), FACING_SOUTH); } @@ -1281,15 +1281,15 @@ void Scene207::enter() { _game._player._playerPos = Common::Point(305, 131); } - _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 10, 1, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[21], 1, 22); - _scene->_sequences.setDepth(_globals._spriteIndexes[21], 6); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[21], SM_0, 0, 70); + _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 10, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[6], 1, 22); + _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 6); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SM_0, 0, 70); } void Scene207::moveVulture() { - _scene->_sequences.remove(_globals._spriteIndexes[16]); - _globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 7, 1, 0, 0); + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 7, 1, 0, 0); _vm->_sound->command(43); _vultureFl = false; _vultureTime = _game._player._priorTimer; @@ -1297,8 +1297,8 @@ void Scene207::moveVulture() { } void Scene207::moveSpider() { - _scene->_sequences.remove(_globals._spriteIndexes[19]); - _globals._spriteIndexes[19] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 5, 1, 0, 0); + _scene->_sequences.remove(_globals._sequenceIndexes[4]); + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 5, 1, 0, 0); _spiderFl = false; _spiderTime = _game._player._priorTimer; _scene->_dynamicHotspots.remove(_spiderHotspotId); @@ -1312,9 +1312,9 @@ void Scene207::step() { moveSpider(); if (_game._trigger == 70) { - _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 10, 0, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[21], 23, 34); - _scene->_sequences.setDepth(_globals._spriteIndexes[21], 6); + _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 10, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[6], 23, 34); + _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 6); } if (_game._trigger == 71) @@ -1324,11 +1324,11 @@ void Scene207::step() { return; if ((_game._player._playerPos.x >= 124) && (_game._player._playerPos.x <= 201)) { - _globals._spriteIndexes[22] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 10, 1, 0, 0); - _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8, 1, 0, 0); - _scene->_sequences.setDepth(_globals._spriteIndexes[22], 6); - _scene->_sequences.setDepth(_globals._spriteIndexes[23], 6); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[22], SM_0, 0, 71); + _globals._sequenceIndexes[7] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 10, 1, 0, 0); + _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 6); + _scene->_sequences.setDepth(_globals._sequenceIndexes[8], 6); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SM_0, 0, 71); _eyeFl = true; } } @@ -1359,14 +1359,14 @@ void Scene207::actions() { (_game._player._playerPos.y > 111) && (_game._player._playerPos.y < 130)) { if ((_game._player._playerPos.x <= 162) && (_game._player._playerPos.x >= 181) && (_game._player._playerPos.y <= 115) && (_game._player._playerPos.y >= 126)) { - _globals._spriteIndexes[22] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 10, 2, 0, 0); - _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8, 2, 0, 0); - _scene->_sequences.setDepth(_globals._spriteIndexes[22], 6); - _scene->_sequences.setDepth(_globals._spriteIndexes[23], 6); + _globals._sequenceIndexes[7] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 10, 2, 0, 0); + _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8, 2, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 6); + _scene->_sequences.setDepth(_globals._sequenceIndexes[8], 6); } } else if (_eyeFl) { - _scene->_sequences.remove(_globals._spriteIndexes[22]); - _scene->_sequences.remove(_globals._spriteIndexes[23]); + _scene->_sequences.remove(_globals._sequenceIndexes[7]); + _scene->_sequences.remove(_globals._sequenceIndexes[8]); _eyeFl = false; } @@ -1418,9 +1418,9 @@ void Scene208::setup() { void Scene208::updateTrap() { if (_globals[kRhotundaStatus] == 1) { - _globals._spriteIndexes[16] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 8, 0, 0, 24); - _scene->_sequences.setDepth(_globals._spriteIndexes[16], 5); - int idx = _scene->_dynamicHotspots.add(424, 13, _globals._spriteIndexes[16], Common::Rect(0, 0, 0, 0)); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 8, 0, 0, 24); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 5); + int idx = _scene->_dynamicHotspots.add(424, 13, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(100, 146), FACING_NORTH); _scene->_hotspots.activate(414, false); return; @@ -1428,17 +1428,17 @@ void Scene208::updateTrap() { switch (_globals[35]) { case 0: { - _globals._spriteIndexes[17] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 1); - _scene->_sequences.setDepth(_globals._spriteIndexes[17], 15); - int idx = _scene->_dynamicHotspots.add(426, 13, _globals._spriteIndexes[17], Common::Rect(0, 0, 0, 0)); + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 15); + int idx = _scene->_dynamicHotspots.add(426, 13, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(60, 152), FACING_NORTH); } break; case 2: { - _scene->_sequences.setDepth(_globals._spriteIndexes[18], 15); - _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 15); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); _scene->_hotspots.activate(414, false); - int idx = _scene->_dynamicHotspots.add(425, 13, _globals._spriteIndexes[17], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(425, 13, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(100, 146), FACING_NORTH); _scene->_dynamicHotspots[idx]._articleNumber = 5; } @@ -1491,7 +1491,7 @@ void Scene208::step() { _rhotundaTime = _scene->_activeAnimation->getCurrentFrame(); if (_rhotundaTime == 125) - _scene->_sequences.remove(_globals._spriteIndexes[19]); + _scene->_sequences.remove(_globals._sequenceIndexes[4]); } if (!_rhotundaTurnFl) @@ -1541,8 +1541,8 @@ void Scene208::subAction(int mode) { case 0: { _game._player._stepEnabled = false; _game._player._visible = false; - _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 6, 1, 0, 0); - _scene->_sequences.setMsgLayout(_globals._spriteIndexes[20]); + _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 6, 1, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); int abortVal; if ((mode == 1) || (mode == 2)) @@ -1550,16 +1550,16 @@ void Scene208::subAction(int mode) { else abortVal = 2; - _scene->_sequences.addSubEntry(_globals._spriteIndexes[20], SM_0, 0, abortVal); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SM_0, 0, abortVal); } break; case 1: { - int oldVal = _globals._spriteIndexes[20]; - _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 12, 3, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[20], 3, 4); - _scene->_sequences.setMsgLayout(_globals._spriteIndexes[20]); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[20], oldVal); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[20], SM_0, 0, 2); + int oldVal = _globals._sequenceIndexes[5]; + _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 12, 3, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 3, 4); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[5], oldVal); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SM_0, 0, 2); _vm->_sound->command(20); } break; @@ -1567,7 +1567,7 @@ void Scene208::subAction(int mode) { switch (mode) { case 1: _game._objects.addToInventory(6); - _scene->_sequences.remove(_globals._spriteIndexes[17]); + _scene->_sequences.remove(_globals._sequenceIndexes[2]); _globals[kLeavesStatus] = 1; break; case 2: @@ -1576,8 +1576,8 @@ void Scene208::subAction(int mode) { updateTrap(); break; case 3: - _scene->_sequences.remove(_globals._spriteIndexes[18]); - _globals._spriteIndexes[19] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); _game._objects.removeFromInventory(10, 1); _vm->_sound->command(34); break; @@ -1591,12 +1591,12 @@ void Scene208::subAction(int mode) { break; } - int oldVal = _globals._spriteIndexes[20]; - _globals._spriteIndexes[20] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[5], false, 6, 1, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[20], 1, 3); - _scene->_sequences.setMsgLayout(_globals._spriteIndexes[20]); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[20], oldVal); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[20], SM_0, 0, 3); + int oldVal = _globals._sequenceIndexes[5]; + _globals._sequenceIndexes[5] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[5], false, 6, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 1, 3); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[5], oldVal); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SM_0, 0, 3); } break; case 3: @@ -1720,36 +1720,36 @@ void Scene209::handlePeek() { switch (_game._trigger) { case 133: _vm->_sound->command(18); - _globals._spriteIndexes[18] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 51, 52); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 134); + _globals._sequenceIndexes[3] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 51, 52); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 134); break; case 134: { - int oldIdx = _globals._spriteIndexes[18]; - _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 6); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + int oldIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 6); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], oldIdx); _scene->_sequences.addTimer(60, 135); } break; case 135: - _scene->_sequences.remove(_globals._spriteIndexes[18]); - _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 7); + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 7); _scene->_sequences.addTimer(10, 136); break; case 136: - _scene->_sequences.remove(_globals._spriteIndexes[18]); - _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 6); + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 6); _scene->_sequences.addTimer(50, 137); break; case 137: - _scene->_sequences.remove(_globals._spriteIndexes[18]); - _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 51, 52); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 138); + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 51, 52); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 138); break; case 138: @@ -1763,25 +1763,25 @@ void Scene209::handlePeek() { void Scene209::handleVerticalMove() { switch (_game._trigger) { case 140: - _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 8, 8, 0, 1); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 1, 5); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 141); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 8, 8, 0, 1); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 5); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 141); break; case 141: { _vm->_sound->command(18); - int oldIdx = _globals._spriteIndexes[18]; - _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 5); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + int oldIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 5); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], oldIdx); _scene->_sequences.addTimer(60, 142); } break; case 142: - _scene->_sequences.remove(_globals._spriteIndexes[18]); - _globals._spriteIndexes[18] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 1, 5); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 143); + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 5); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 143); break; case 143: @@ -1797,28 +1797,28 @@ void Scene209::handleLookStay() { case 145: _vm->_sound->command(18); _monkeyPosition = 2; - _globals._spriteIndexes[18] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 51, 52); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 146); + _globals._sequenceIndexes[3] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 51, 52); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 146); break; case 146: { - int oldIdx = _globals._spriteIndexes[18]; - _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 6); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + int oldIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 6); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], oldIdx); _scene->_sequences.addTimer(15, 147); } break; case 147: - _scene->_sequences.remove(_globals._spriteIndexes[18]); - _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 7); + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 7); _scene->_sequences.addTimer(8, 148); break; case 148: - _scene->_sequences.remove(_globals._spriteIndexes[18]); - _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 6); + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 6); if (!_dodgeFl) _scene->_sequences.addTimer(90, 149); @@ -1837,16 +1837,16 @@ void Scene209::handleLookStay() { void Scene209::handleLookRight() { switch (_game._trigger) { case 151: - _scene->_sequences.remove(_globals._spriteIndexes[18]); - _globals._spriteIndexes[18] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 8, 2, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 8, 14); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 152); + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 8, 2, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 8, 14); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 152); break; case 152: { - int oldIdx = _globals._spriteIndexes[18]; - _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 6); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + int oldIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 6); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], oldIdx); _scene->_sequences.addTimer(60, 153); } break; @@ -1862,20 +1862,20 @@ void Scene209::handleLookRight() { void Scene209::handleBlink() { switch (_game._trigger) { case 155: - _scene->_sequences.remove(_globals._spriteIndexes[18]); - _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 6); + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 6); _scene->_sequences.addTimer(50, 156); break; case 156: - _scene->_sequences.remove(_globals._spriteIndexes[18]); - _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 7); + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 7); _scene->_sequences.addTimer(10, 157); break; case 157: - _scene->_sequences.remove(_globals._spriteIndexes[18]); - _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 6); + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 6); _scene->_sequences.addTimer(50, 158); break; @@ -1892,31 +1892,31 @@ void Scene209::handleGetBinoculars() { case 161: _vm->_sound->command(18); _monkeyPosition = 3; - _scene->_sequences.remove(_globals._spriteIndexes[18]); - _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 8, 24); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_FRAME_INDEX, 20, 165); + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 8, 24); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_FRAME_INDEX, 20, 165); if (!_fallFl && !_dodgeFl) { - _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 162); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 162); } else { - _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 163); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 163); } break; case 162: { - int oldIdx = _globals._spriteIndexes[18]; - _globals._spriteIndexes[18] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 8, 6, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 23, 25); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 163); + int oldIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 8, 6, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 23, 25); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], oldIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 163); } break; case 163: { - int oldIdx = _globals._spriteIndexes[18]; - _globals._spriteIndexes[18] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 8, 0, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 23, 24); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + int oldIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 8, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 23, 24); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], oldIdx); _scene->_sequences.addTimer(8, 164); } break; @@ -1936,20 +1936,20 @@ void Scene209::handleGetBinoculars() { void Scene209::handleBinocularBlink() { switch (_game._trigger) { case 167: { - int oldIdx = _globals._spriteIndexes[18]; - _scene->_sequences.remove(_globals._spriteIndexes[18]); - _globals._spriteIndexes[18] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 8, 2, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 23, 25); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 168); + int oldIdx = _globals._sequenceIndexes[3]; + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 8, 2, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 23, 25); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], oldIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 168); } break; case 168: { - int oldIdx = _globals._spriteIndexes[18]; - _globals._spriteIndexes[18] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 8, 0, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 23, 24); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + int oldIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 8, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 23, 24); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], oldIdx); _scene->_sequences.addTimer(30, 169); } break; @@ -1965,46 +1965,46 @@ void Scene209::handleBinocularBlink() { void Scene209::handleBinocularScan() { switch (_game._trigger) { case 171: { - int oldIdx = _globals._spriteIndexes[18]; - _scene->_sequences.remove(_globals._spriteIndexes[18]); - _globals._spriteIndexes[18] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 12, 2, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 43, 45); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 172); + int oldIdx = _globals._sequenceIndexes[3]; + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 12, 2, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 43, 45); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], oldIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 172); } break; case 172: { - int oldIdx = _globals._spriteIndexes[18]; + int oldIdx = _globals._sequenceIndexes[3]; int randAction = _vm->getRandomNumber(1,2); switch (randAction) { case 1: - _globals._spriteIndexes[18] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 12, 2, 0, 0); + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 12, 2, 0, 0); break; case 2: - _globals._spriteIndexes[18] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 12, 4, 0, 0); + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 12, 4, 0, 0); break; } - _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 23, 25); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 173); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 23, 25); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], oldIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 173); } break; case 173: { - int oldIdx = _globals._spriteIndexes[18]; - _globals._spriteIndexes[18] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 12, 2, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 26, 30); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 174); + int oldIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 12, 2, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 26, 30); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], oldIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 174); } break; case 174: { - int oldIdx = _globals._spriteIndexes[18]; - _globals._spriteIndexes[18] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 12, 0, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 23, 24); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + int oldIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 12, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 23, 24); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], oldIdx); _scene->_sequences.addTimer(60, 175); } break; @@ -2023,26 +2023,26 @@ void Scene209::handleJumpInTree() { int oldIdx = 0; _monkeyPosition = 1; if (_removeMonkeyFl) - _scene->_sequences.remove(_globals._spriteIndexes[18]); + _scene->_sequences.remove(_globals._sequenceIndexes[3]); else - oldIdx = _globals._spriteIndexes[18]; + oldIdx = _globals._sequenceIndexes[3]; - _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 46, 49); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 46, 49); if (!_removeMonkeyFl) - _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], oldIdx); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 179); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 179); } break; case 179: { _vm->_sound->command(18); - int oldIdx = _globals._spriteIndexes[18]; - _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 53, 61); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 180); + int oldIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 53, 61); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], oldIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 180); } break; @@ -2058,49 +2058,49 @@ void Scene209::handleJumpInTree() { void Scene209::handleTongue() { switch (_game._trigger) { case 182: { - int oldIdx = _globals._spriteIndexes[18]; - _scene->_sequences.remove(_globals._spriteIndexes[18]); - _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 12, 1, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 26, 30); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 183); + int oldIdx = _globals._sequenceIndexes[3]; + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 26, 30); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], oldIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 183); } break; case 183: { - int oldIdx = _globals._spriteIndexes[18]; - _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 12, 1, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 31, 33); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 184); + int oldIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 31, 33); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], oldIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 184); } break; case 184: { - int oldIdx = _globals._spriteIndexes[18]; - _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 12, 1, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 36, 37); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 185); + int oldIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 36, 37); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], oldIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 185); } break; case 185: { _vm->_sound->command(18); - int oldIdx = _globals._spriteIndexes[18]; - _globals._spriteIndexes[18] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 6, 20, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 38, 39); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 186); + int oldIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 6, 20, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 38, 39); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], oldIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 186); } break; case 186: { - int oldIdx = _globals._spriteIndexes[18]; - _globals._spriteIndexes[18] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 12, 1, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[18], 40, 41); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[18], SM_0, 0, 178); + int oldIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 40, 41); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], oldIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 178); _removeMonkeyFl = false; } break; @@ -2111,36 +2111,36 @@ void Scene209::handleStandFromPeek() { switch (_game._trigger) { case 189: _monkeyPosition = 4; - _scene->_sequences.remove(_globals._spriteIndexes[18]); - _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 50); + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 50); _scene->_sequences.addTimer(8, 190); break; case 190: - _scene->_sequences.remove(_globals._spriteIndexes[18]); - _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 6); + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 6); _scene->_sequences.addTimer(8, 191); break; case 191: - _scene->_sequences.remove(_globals._spriteIndexes[18]); - _globals._spriteIndexes[21] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 8, 1, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[21], 1, 5); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[21], SM_0, 0, 192); + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[6], 1, 5); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SM_0, 0, 192); break; case 192: { _vm->_sound->command(18); - int oldIdx = _globals._spriteIndexes[21]; - _globals._spriteIndexes[20] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 1); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[20], oldIdx); + int oldIdx = _globals._sequenceIndexes[6]; + _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 1); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[5], oldIdx); _scene->_sequences.addTimer(8, 193); } break; case 193: - _scene->_sequences.remove(_globals._spriteIndexes[20]); - _globals._spriteIndexes[19] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 22); + _scene->_sequences.remove(_globals._sequenceIndexes[5]); + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 22); _scene->_sequences.addTimer(5, 194); break; @@ -2154,20 +2154,20 @@ void Scene209::handleStandFromPeek() { void Scene209::handleStandBlink() { switch (_game._trigger) { case 246: - _scene->_sequences.remove(_globals._spriteIndexes[19]); - _globals._spriteIndexes[19] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 22); + _scene->_sequences.remove(_globals._sequenceIndexes[4]); + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 22); _scene->_sequences.addTimer(10, 247); break; case 247: - _scene->_sequences.remove(_globals._spriteIndexes[19]); - _globals._spriteIndexes[19] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 23); + _scene->_sequences.remove(_globals._sequenceIndexes[4]); + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 23); _scene->_sequences.addTimer(8, 248); break; case 248: - _scene->_sequences.remove(_globals._spriteIndexes[19]); - _globals._spriteIndexes[19] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 22); + _scene->_sequences.remove(_globals._sequenceIndexes[4]); + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 22); _scene->_sequences.addTimer(10, 249); break; @@ -2182,10 +2182,10 @@ void Scene209::handleJumpAndHide() { case 196: _vm->_sound->command(18); _monkeyPosition = 1; - _scene->_sequences.remove(_globals._spriteIndexes[19]); - _globals._spriteIndexes[20] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 8, 1, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[20], 1, 16); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[20], SM_0, 0, 197); + _scene->_sequences.remove(_globals._sequenceIndexes[4]); + _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 1, 16); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SM_0, 0, 197); break; case 197: @@ -2200,66 +2200,66 @@ void Scene209::handleMonkeyEating() { switch (_game._trigger) { case 199: _vm->_sound->command(18); - _scene->_sequences.remove(_globals._spriteIndexes[19]); - _globals._spriteIndexes[19] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 10, 1, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[19], 1, 14); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[19], SM_0, 0, 200); + _scene->_sequences.remove(_globals._sequenceIndexes[4]); + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 10, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 1, 14); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SM_0, 0, 200); break; case 200: { - int oldIdx = _globals._spriteIndexes[19]; - _globals._spriteIndexes[19] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 10, 10, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[19], 15, 16); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[19], oldIdx); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[19], SM_0, 0, 201); + int oldIdx = _globals._sequenceIndexes[4]; + _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 10, 10, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 15, 16); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], oldIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SM_0, 0, 201); } break; case 201: { - int oldIdx = _globals._spriteIndexes[19]; - _globals._spriteIndexes[19] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 12); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[19], oldIdx); + int oldIdx = _globals._sequenceIndexes[4]; + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 12); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], oldIdx); _scene->_sequences.addTimer(20, 202); } break; case 202: - _scene->_sequences.remove(_globals._spriteIndexes[19]); - _globals._spriteIndexes[19] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 19); + _scene->_sequences.remove(_globals._sequenceIndexes[4]); + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 19); _scene->_sequences.addTimer(20, 203); break; case 203: - _scene->_sequences.remove(_globals._spriteIndexes[19]); - _globals._spriteIndexes[19] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 17); + _scene->_sequences.remove(_globals._sequenceIndexes[4]); + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 17); _scene->_sequences.addTimer(20, 204); break; case 204: - _scene->_sequences.remove(_globals._spriteIndexes[19]); - _globals._spriteIndexes[19] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 10, 8, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[19], 18, 19); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[19], SM_0, 0, 205); + _scene->_sequences.remove(_globals._sequenceIndexes[4]); + _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 10, 8, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 18, 19); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SM_0, 0, 205); break; case 205: { - int oldIdx = _globals._spriteIndexes[19]; - _globals._spriteIndexes[19] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 10, 8, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[19], 20, 21); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[19], oldIdx); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[19], SM_0, 0, 206); + int oldIdx = _globals._sequenceIndexes[4]; + _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 10, 8, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 20, 21); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], oldIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SM_0, 0, 206); } break; case 206: { - int oldIdx = _globals._spriteIndexes[19]; - _globals._spriteIndexes[19] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 10, 1, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[19], 22, 25); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[19], oldIdx); + int oldIdx = _globals._sequenceIndexes[4]; + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 10, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 22, 25); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], oldIdx); if (!_dodgeFl && !_fallFl) - _scene->_sequences.addSubEntry(_globals._spriteIndexes[19], SM_0, 0, 207); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SM_0, 0, 207); else - _scene->_sequences.addSubEntry(_globals._spriteIndexes[19], SM_0, 0, 209); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SM_0, 0, 209); } break; @@ -2268,28 +2268,28 @@ void Scene209::handleMonkeyEating() { int msgIndex = _scene->_kernelMessages.add(Common::Point(180, 25), 0xFDFC, 0, 0, 90, _game.getQuote(130)); _scene->_kernelMessages.setQuoted(msgIndex, 4, true); - int oldIdx = _globals._spriteIndexes[19]; - _globals._spriteIndexes[19] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 15, 4, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[19], 26, 27); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[19], oldIdx); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[19], SM_0, 0, 208); + int oldIdx = _globals._sequenceIndexes[4]; + _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 15, 4, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 26, 27); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], oldIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SM_0, 0, 208); } break; case 208: { _scene->_kernelMessages.add(Common::Point(180, 39), 0xFDFC, 0, 0, 90, _game.getQuote(131)); - int oldIdx = _globals._spriteIndexes[19]; - _globals._spriteIndexes[19] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 10, 4, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[19], 28, 29); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[19], oldIdx); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[19], SM_0, 0, 209); + int oldIdx = _globals._sequenceIndexes[4]; + _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 10, 4, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 28, 29); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], oldIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SM_0, 0, 209); } break; case 209: { - int oldIdx = _globals._spriteIndexes[19]; - _globals._spriteIndexes[19] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 22); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[19], oldIdx); + int oldIdx = _globals._sequenceIndexes[4]; + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 22); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], oldIdx); _scene->_sequences.addTimer(1, 210); } break; @@ -2313,14 +2313,14 @@ void Scene209::handleMonkeyFall() { _scene->_kernelMessages.add(Common::Point(180, 26), 0xFDFC, 0, 0, 90, _game.getQuote(151)); _scene->_sequences.addTimer(40, 100); _scene->_hotspots.activate(227, false); - int oldIdx = _globals._spriteIndexes[18]; + int oldIdx = _globals._sequenceIndexes[3]; _monkeyPosition = 1; - _scene->_sequences.remove(_globals._spriteIndexes[18]); - _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8, 1, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[23], 1, 35); - _scene->_sequences.setDepth(_globals._spriteIndexes[23], 6); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 220); + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[8], 1, 35); + _scene->_sequences.setDepth(_globals._sequenceIndexes[8], 6); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], oldIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SM_0, 0, 220); } break; @@ -2328,41 +2328,41 @@ void Scene209::handleMonkeyFall() { _vm->_sound->command(18); _scene->_kernelMessages.add(Common::Point(182, 109), 0xFDFC, 0, 0, 90, _game.getQuote(159)); _scene->_hotspots.activate(227, false); - int oldIdx = _globals._spriteIndexes[18]; + int oldIdx = _globals._sequenceIndexes[3]; _monkeyPosition = 1; - _scene->_sequences.remove(_globals._spriteIndexes[18]); - _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8, 1, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[23], 36, 42); - _scene->_sequences.setDepth(_globals._spriteIndexes[23], 6); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[18], oldIdx); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 221); + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[8], 36, 42); + _scene->_sequences.setDepth(_globals._sequenceIndexes[8], 6); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], oldIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SM_0, 0, 221); } break; case 221: { _game._objects.setRoom(OBJ_BINOCULARS, 209); _binocularsDroppedFl = true; - int oldIdx = _globals._spriteIndexes[23]; - _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8, 1, 0, 0); - _globals._spriteIndexes[24] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 1); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[24], oldIdx); - _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(201, 131)); - _scene->_sequences.setDepth(_globals._spriteIndexes[24], 8); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[23], oldIdx); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[23], 43, 72); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 222); - int idx = _scene->_dynamicHotspots.add(39, 13, _globals._spriteIndexes[24], Common::Rect(0, 0, 0, 0)); + int oldIdx = _globals._sequenceIndexes[8]; + _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8, 1, 0, 0); + _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 1); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[9], oldIdx); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[9], Common::Point(201, 131)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 8); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[8], oldIdx); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[8], 43, 72); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SM_0, 0, 222); + int idx = _scene->_dynamicHotspots.add(39, 13, _globals._sequenceIndexes[9], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(200, 133), FACING_NORTH); } break; case 222: { _scene->_kernelMessages.add(Common::Point(182, 109), 0xFDFC, 0, 0, 70, _game.getQuote(160)); - int oldIdx = _globals._spriteIndexes[23]; - _globals._spriteIndexes[23] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8, 1, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[23], 73, 78); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[23], oldIdx); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[23], SM_0, 0, 223); + int oldIdx = _globals._sequenceIndexes[8]; + _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[8], 73, 78); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[8], oldIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SM_0, 0, 223); } break; @@ -2385,27 +2385,27 @@ void Scene209::handleMonkeyFall() { void Scene209::handleMonkey1() { switch (_game._trigger) { case 212: - _scene->_sequences.remove(_globals._spriteIndexes[19]); - _globals._spriteIndexes[19] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 9, 1, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[19], 1, 13); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[19], SM_0, 0, 213); + _scene->_sequences.remove(_globals._sequenceIndexes[4]); + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 9, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 1, 13); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SM_0, 0, 213); break; case 213: { - int oldIdx = _globals._spriteIndexes[19]; - _globals._spriteIndexes[22] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 7, 1, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[22], 1, 22); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[22], oldIdx); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[22], SM_0, 0, 214); + int oldIdx = _globals._sequenceIndexes[4]; + _globals._sequenceIndexes[7] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 7, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[7], 1, 22); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[7], oldIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SM_0, 0, 214); } break; case 214: { - int oldIdx = _globals._spriteIndexes[22]; - _globals._spriteIndexes[22] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 7, 1, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[22], 23, 26); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[22], oldIdx); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[22], SM_0, 0, 215); + int oldIdx = _globals._sequenceIndexes[7]; + _globals._sequenceIndexes[7] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 7, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[7], 23, 26); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[7], oldIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SM_0, 0, 215); int msgIndex = _scene->_kernelMessages.add(Common::Point(170, 21), 0xFDFC, 0, 0, 90, _game.getQuote(156)); _scene->_kernelMessages.setQuoted(msgIndex, 3, true); } @@ -2414,18 +2414,18 @@ void Scene209::handleMonkey1() { case 215: { _vm->_sound->command(18); _scene->loadAnimation(Resources::formatName(209, 'a', -1, EXT_AA, ""), 251); - int oldIdx = _globals._spriteIndexes[22]; - _globals._spriteIndexes[22] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 7, 1, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[22], 27, 35); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[22], oldIdx); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[22], SM_0, 0, 216); + int oldIdx = _globals._sequenceIndexes[7]; + _globals._sequenceIndexes[7] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 7, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[7], 27, 35); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[7], oldIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SM_0, 0, 216); } break; case 216: { - int oldIdx = _globals._spriteIndexes[22]; - _globals._spriteIndexes[19] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 22); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[19], oldIdx); + int oldIdx = _globals._sequenceIndexes[7]; + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 22); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], oldIdx); _scene->_sequences.addTimer(25, 217); } break; @@ -2444,11 +2444,11 @@ void Scene209::handleMonkey2() { case 251: _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 60, _game.getQuote(137)); _vm->_sound->command(22); - _globals._spriteIndexes[27] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[12], false, 11, 1, 0, 0); - _scene->_sequences.setMsgPosition(_globals._spriteIndexes[27], Common::Point(111, 133)); - _scene->_sequences.setScale(_globals._spriteIndexes[27], 79); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[27], 1, 6); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[27], SM_0, 0, 252); + _globals._sequenceIndexes[12] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[12], false, 11, 1, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[12], Common::Point(111, 133)); + _scene->_sequences.setScale(_globals._sequenceIndexes[12], 79); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[12], 1, 6); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SM_0, 0, 252); _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; _game._player._visible = false; break; @@ -2456,17 +2456,17 @@ void Scene209::handleMonkey2() { case 252: { _scene->_kernelMessages.reset(); _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(132)); - int oldIdx = _globals._spriteIndexes[27]; - _globals._spriteIndexes[27] = _scene->_sequences.startCycle(_globals._spriteIndexes[12], false, 7); - _scene->_sequences.setMsgPosition(_globals._spriteIndexes[27], Common::Point(111, 133)); - _scene->_sequences.setScale(_globals._spriteIndexes[27], 79); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[27], oldIdx); + int oldIdx = _globals._sequenceIndexes[12]; + _globals._sequenceIndexes[12] = _scene->_sequences.startCycle(_globals._spriteIndexes[12], false, 7); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[12], Common::Point(111, 133)); + _scene->_sequences.setScale(_globals._sequenceIndexes[12], 79); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[12], oldIdx); _scene->_sequences.addTimer(120, 253); } break; case 253: - _scene->_sequences.remove(_globals._spriteIndexes[27]); + _scene->_sequences.remove(_globals._sequenceIndexes[12]); _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; _game._player._visible = true; _game._player._stepEnabled = true; @@ -2478,22 +2478,22 @@ void Scene209::handleDodge() { switch (_game._trigger) { case 241: _scene->_hotspots.activate(227, true); - _scene->_sequences.remove(_globals._spriteIndexes[18]); - _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 7); + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 7); _scene->_sequences.addTimer(6, 242); break; case 242: - _scene->_sequences.remove(_globals._spriteIndexes[18]); - _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 5); + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 5); _scene->_sequences.addTimer(25, 243); _vm->_sound->command(24); break; case 243: _vm->_sound->command(18); - _scene->_sequences.remove(_globals._spriteIndexes[18]); - _globals._spriteIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 6); + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 6); _playingAnimFl = false; _pauseMode = 0; _scene->_kernelMessages.reset(); @@ -2526,10 +2526,10 @@ void Scene209::enter() { _vm->_palette->setEntry(253, 63, 20, 22); if (_game._objects.isInRoom(OBJ_PLANT_STALK)) { - _globals._spriteIndexes[16] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); - int idx = _scene->_dynamicHotspots.add(271, 13, _globals._spriteIndexes[16], Common::Rect(0, 0, 0, 0)); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); + int idx = _scene->_dynamicHotspots.add(271, 13, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(263, 129), FACING_SOUTH); - _scene->_sequences.setDepth(_globals._spriteIndexes[16], 13); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 13); } if (_scene->_priorSceneId == 208) { @@ -2541,10 +2541,10 @@ void Scene209::enter() { } if (_game._objects.isInRoom(OBJ_BINOCULARS)) { - _globals._spriteIndexes[24] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 1); - _scene->_sequences.setMsgPosition(_globals._spriteIndexes[24], Common::Point(201, 131)); - _scene->_sequences.setDepth(_globals._spriteIndexes[24], 8); - int idx = _scene->_dynamicHotspots.add(39, 13, _globals._spriteIndexes[24], Common::Rect(0, 0, 0, 0)); + _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[9], Common::Point(201, 131)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 8); + int idx = _scene->_dynamicHotspots.add(39, 13, _globals._sequenceIndexes[9], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(200, 133), FACING_NORTH); } @@ -2802,52 +2802,52 @@ void Scene209::step() { switch (_game._trigger) { case 228: _game._player._visible = false; - _globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[17], 1, 7); - _scene->_sequences.setMsgPosition(_globals._spriteIndexes[17], Common::Point(116, 131)); - _scene->_sequences.setDepth(_globals._spriteIndexes[17], 4); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[17], SM_0, 0, 228); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 7); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(116, 131)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SM_0, 0, 228); break; case 229: { - int oldIdx = _globals._spriteIndexes[17]; - _globals._spriteIndexes[17] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 7); - _scene->_sequences.setMsgPosition(_globals._spriteIndexes[17], Common::Point(116, 131)); - _scene->_sequences.setDepth(_globals._spriteIndexes[17], 4); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[17], oldIdx); + int oldIdx = _globals._sequenceIndexes[2]; + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 7); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(116, 131)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], oldIdx); _scene->_sequences.addTimer(35, 230); } break; case 230: - _scene->_sequences.remove(_globals._spriteIndexes[17]); - _globals._spriteIndexes[17] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[17], 1, 7); - _scene->_sequences.setMsgPosition(_globals._spriteIndexes[17], Common::Point(116, 131)); - _scene->_sequences.setDepth(_globals._spriteIndexes[17], 4); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[17], SM_0, 0, 231); + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _globals._sequenceIndexes[2] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 7); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(116, 131)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SM_0, 0, 231); break; case 231: { - int oldIdx = _globals._spriteIndexes[17]; - _globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[17], 8, 10); - _scene->_sequences.setMsgPosition(_globals._spriteIndexes[17], Common::Point(116, 131)); - _scene->_sequences.setDepth(_globals._spriteIndexes[17], 4); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[17], oldIdx); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[17], SM_0, 0, 232); + int oldIdx = _globals._sequenceIndexes[2]; + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 8, 10); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(116, 131)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], oldIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SM_0, 0, 232); _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; - _scene->_sequences.updateTimeout(_globals._spriteIndexes[17], -1); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], -1); _game._player._visible = false; } break; case 232: { - int oldIdx = _globals._spriteIndexes[17]; - _globals._spriteIndexes[17] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 10); - _scene->_sequences.setMsgPosition(_globals._spriteIndexes[17], Common::Point(116, 131)); - _scene->_sequences.setDepth(_globals._spriteIndexes[17], 4); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[17], oldIdx); + int oldIdx = _globals._sequenceIndexes[2]; + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 10); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(116, 131)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], oldIdx); _scene->_sequences.addTimer(2, 233); _scene->_kernelMessages.reset(); if (_dodgeFl && (_monkeyPosition != 1) && (_monkeyPosition != 2)) @@ -2862,31 +2862,31 @@ void Scene209::step() { break; case 234: - _scene->_sequences.remove(_globals._spriteIndexes[17]); + _scene->_sequences.remove(_globals._sequenceIndexes[2]); _scene->_kernelMessages.reset(); if (_action.isAction(NOUN_HOSE_DOWN, NOUN_BLOWGUN, NOUN_MONKEY)) { - _globals._spriteIndexes[17] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[2], false, 7, 16, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[17], 11, 12); - _scene->_sequences.setMsgPosition(_globals._spriteIndexes[17], Common::Point(116, 131)); - _scene->_sequences.setDepth(_globals._spriteIndexes[17], 4); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[17], SM_FRAME_INDEX, 12, 239); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[17], SM_0, 0, 235); + _globals._sequenceIndexes[2] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[2], false, 7, 16, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 11, 12); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(116, 131)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SM_FRAME_INDEX, 12, 239); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SM_0, 0, 235); } else if (_action.isAction(NOUN_SHOOT, NOUN_BLOWGUN, NOUN_MONKEY)) { - _globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[17], 11, 12); - _scene->_sequences.setMsgPosition(_globals._spriteIndexes[17], Common::Point(116, 131)); - _scene->_sequences.setDepth(_globals._spriteIndexes[17], 4); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[17], SM_0, 0, 235); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 11, 12); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(116, 131)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SM_0, 0, 235); _vm->_sound->command(23); } break; case 235: { - int oldIdx = _globals._spriteIndexes[17]; - _globals._spriteIndexes[17] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 13); - _scene->_sequences.setMsgPosition(_globals._spriteIndexes[17], Common::Point(116, 131)); - _scene->_sequences.setDepth(_globals._spriteIndexes[17], 4); - _scene->_sequences.updateTimeout(_globals._spriteIndexes[17], oldIdx); + int oldIdx = _globals._sequenceIndexes[2]; + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 13); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(116, 131)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], oldIdx); _scene->_sequences.addTimer(12, 236); _forceFallFl = true; _forceDodgeFl = true; @@ -2894,12 +2894,12 @@ void Scene209::step() { break; case 236: - _scene->_sequences.remove(_globals._spriteIndexes[17]); - _globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); - _scene->_sequences.setAnimRange(_globals._spriteIndexes[17], 14, 16); - _scene->_sequences.setMsgPosition(_globals._spriteIndexes[17], Common::Point(116, 131)); - _scene->_sequences.setDepth(_globals._spriteIndexes[17], 4); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[17], SM_0, 0, 237); + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 14, 16); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(116, 131)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SM_0, 0, 237); break; case 237: @@ -2909,7 +2909,7 @@ void Scene209::step() { break; case 238: - _scene->_sequences.remove(_globals._spriteIndexes[17]); + _scene->_sequences.remove(_globals._sequenceIndexes[2]); if (_dodgeFl) _game._player._stepEnabled = true; @@ -3122,14 +3122,14 @@ void Scene209::actions() { _globals._spriteIndexes[11] = _scene->_sprites.addSprites("*RXMBD_2"); _game._player._stepEnabled = false; _game._player._visible = false; - _globals._spriteIndexes[26] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[11], false, 3, 2, 0, 0); - _scene->_sequences.setMsgLayout(_globals._spriteIndexes[26]); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[26], SM_FRAME_INDEX, 4, 1); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[26], SM_0, 0, 2); + _globals._sequenceIndexes[11] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[11], false, 3, 2, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[11]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[11], SM_FRAME_INDEX, 4, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[11], SM_0, 0, 2); break; case 1: - _scene->_sequences.remove(_globals._spriteIndexes[16]); + _scene->_sequences.remove(_globals._sequenceIndexes[1]); _game._objects.addToInventory(OBJ_PLANT_STALK); break; @@ -3154,14 +3154,14 @@ void Scene209::actions() { _globals._spriteIndexes[10] = _scene->_sprites.addSprites("*RXMBD_8"); _game._player._stepEnabled = false; _game._player._visible = false; - _globals._spriteIndexes[25] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[10], false, 3, 2, 0, 0); - _scene->_sequences.setMsgLayout(_globals._spriteIndexes[25]); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[25], SM_FRAME_INDEX, 4, 1); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[25], SM_0, 0, 2); + _globals._sequenceIndexes[10] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[10], false, 3, 2, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[10]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[10], SM_FRAME_INDEX, 4, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[10], SM_0, 0, 2); break; case 1: - _scene->_sequences.remove(_globals._spriteIndexes[24]); + _scene->_sequences.remove(_globals._sequenceIndexes[9]); _game._objects.addToInventory(OBJ_BINOCULARS); break; @@ -3820,8 +3820,8 @@ void Scene210::enter() { _game._player._playerPos = Common::Point(308, 132); if (!_globals[kCurtainOpen]) { - _globals._spriteIndexes[8] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 5); - _scene->_sequences.setDepth(_globals._spriteIndexes[8], 5); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 5); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 5); } else { int idx = _scene->_dynamicHotspots.add(112, 395, -1, Common::Rect(163, 87, 19, 36)); _doorway = _scene->_dynamicHotspots.setPosition(idx, Common::Point(168, 127), FACING_NORTH); @@ -4190,10 +4190,10 @@ void Scene210::actions() { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; - _scene->_sequences.remove(_globals._spriteIndexes[8]); - _globals._spriteIndexes[8] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[1], false, 12, 1, 0, 0); - _scene->_sequences.setDepth(_globals._spriteIndexes[8], 5); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[8], SM_0, 0, 1); + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[1], false, 12, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 5); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SM_0, 0, 1); break; case 1: @@ -4211,17 +4211,17 @@ void Scene210::actions() { if ((_action.isAction(VERB_PULL, 0x5F) || _action.isAction(VERB_CLOSE, 0x5F)) && _globals[kCurtainOpen]) { switch (_game._trigger) { case 0: - _scene->_sequences.remove(_globals._spriteIndexes[8]); + _scene->_sequences.remove(_globals._sequenceIndexes[1]); _game._player._stepEnabled = false; _game._player._facing = FACING_NORTH; - _globals._spriteIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 12, 0, 0, 1); - _scene->_sequences.setDepth(_globals._spriteIndexes[8], 5); - _scene->_sequences.addSubEntry(_globals._spriteIndexes[8], SM_0, 0, 1); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 12, 0, 0, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 5); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SM_0, 0, 1); _game._player._stepEnabled = false; break; case 1: - _globals._spriteIndexes[8] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 5); - _scene->_sequences.setDepth(_globals._spriteIndexes[8], 5); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 5); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 5); _scene->_sequences.addTimer(48, 2); break; case 2: @@ -4355,11 +4355,11 @@ void Scene211::enter() { } if (_vm->getRandomNumber(1, 8) == 1) { - _globals._spriteIndexes[17] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 6, 0, 0, 0); - _scene->_sequences.setMsgPosition(_globals._spriteIndexes[17], Common::Point(202, 126)); - _scene->_sequences.setDepth(_globals._spriteIndexes[17], 8); - _scene->_sequences.sub70C52(_globals._spriteIndexes[17], SM_FRAME_INDEX, -200, 0); - _scene->_dynamicHotspots.add(324, 13, _globals._spriteIndexes[17], Common::Rect(1, 1, 41, 10)); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 6, 0, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(202, 126)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 8); + _scene->_sequences.sub70C52(_globals._sequenceIndexes[2], SM_FRAME_INDEX, -200, 0); + _scene->_dynamicHotspots.add(324, 13, _globals._sequenceIndexes[2], Common::Rect(1, 1, 41, 10)); } if (_scene->_roomChanged) diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index 6fee0cb973..8a5c3dfed5 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -105,24 +105,24 @@ void Scene804::enter() { if (_globals[kInSpace]) { if (_globals[kWindowFixed]) { - _globals._spriteIndexes[20] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], 0, 1); + _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], 0, 1); _scene->_sequences.addTimer(60, 100); } else { - _globals._spriteIndexes[21] = _scene->_sequences.startCycle(_globals._spriteIndexes[6], false, 1); - _globals._spriteIndexes[22] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[7], false, 4, 0, 0, 0); + _globals._sequenceIndexes[6] = _scene->_sequences.startCycle(_globals._spriteIndexes[6], false, 1); + _globals._sequenceIndexes[7] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[7], false, 4, 0, 0, 0); _scene->_sequences.addTimer(160, 70); _game._player._stepEnabled = false; } } else { if (_globals[kBeamIsUp] == 0) - _globals._spriteIndexes[23] = _scene->_sequences.startCycle(_globals._spriteIndexes[8], false, 1); + _globals._sequenceIndexes[8] = _scene->_sequences.startCycle(_globals._spriteIndexes[8], false, 1); if (_globals[kWindowFixed] == 0) - _globals._spriteIndexes[23] = _scene->_sequences.startCycle(_globals._spriteIndexes[19], false, 1); + _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 1); - _globals._spriteIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); - _scene->_sequences.setMsgPosition(_globals._spriteIndexes[16], Common::Point(133, 139)); - _scene->_sequences.setDepth(_globals._spriteIndexes[16], 8); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(133, 139)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 8); } _scene->loadAnimation(Resources::formatName(804, 'r', 1, EXT_AA, "")); @@ -138,7 +138,7 @@ void Scene804::enter() { void Scene804::step() { if (_globals._frameTime) { if (_scene->_activeAnimation->getCurrentFrame() == 36 && !_globals._v3) { - _scene->_sequences.remove(_globals._spriteIndexes[16]); + _scene->_sequences.remove(_globals._sequenceIndexes[1]); _globals._v3 = -1; } if (_scene->_activeAnimation->getCurrentFrame() == 39) { @@ -160,9 +160,9 @@ void Scene804::step() { } } else { if (_globals._v3 && _globals._v2 && _scene->_activeAnimation->getCurrentFrame() == 39) { - _globals._spriteIndexes[16] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); - _scene->_sequences.setMsgPosition(_globals._spriteIndexes[16], Common::Point(133, 139)); - _scene->_sequences.setDepth(_globals._spriteIndexes[16], 8); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(133, 139)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 8); _globals._v3 = 0; } @@ -175,7 +175,7 @@ void Scene804::step() { _globals._v5 = 42; if (_scene->_activeAnimation->getCurrentFrame() == 65) - _scene->_sequences.remove(_globals._spriteIndexes[22]); + _scene->_sequences.remove(_globals._sequenceIndexes[7]); switch (_game._storyMode) { case STORYMODE_NAUGHTY: @@ -205,7 +205,7 @@ void Scene804::step() { if (_scene->_activeAnimation->getCurrentFrame() == 34) { _globals._v5 = 36; - _scene->_sequences.remove(_globals._spriteIndexes[16]); + _scene->_sequences.remove(_globals._sequenceIndexes[1]); } if (_scene->_activeAnimation->getCurrentFrame() == 37) { _globals._v5 = 36; @@ -217,7 +217,7 @@ void Scene804::step() { _scene->_nextSceneId = 803; if (_scene->_activeAnimation->getCurrentFrame() == 7 && !_globals[kWindowFixed]) { - _globals._spriteIndexes[19] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); _scene->_sequences.addTimer(20, 110); _globals[kWindowFixed] = -1; } -- cgit v1.2.3 From 5793daa75ea9364b163acaa83c1be126971444e4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 12 Apr 2014 10:28:09 +0200 Subject: MADS: Implement Scene 105 --- engines/mads/nebular/nebular_scenes.cpp | 2 + engines/mads/nebular/nebular_scenes1.cpp | 147 +++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes1.h | 15 ++++ 3 files changed, 164 insertions(+) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 9fa057e556..f9d23be2cf 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -55,6 +55,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene103(vm); case 104: return new Scene104(vm); + case 105: + return new Scene105(vm); // Scene group #2 case 201: diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 32172da760..3d87e9e7c3 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -1710,5 +1710,152 @@ void Scene104::actions() { /*------------------------------------------------------------------------*/ +void Scene105::setup() { + // Preloading has been skipped + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene105::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('m', 1), false); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('f', 4), false); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 8, 0, 0, 0); + + if (_globals[kFishIn105]) { + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 6, 0, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(48, 144)); + + int idx = _scene->_dynamicHotspots.add(101, 348, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(56, 141), FACING_NORTHWEST); + } + + if (_scene->_priorSceneId == 104) + _game._player._playerPos = Common::Point(13, 97); + else if (_scene->_priorSceneId != -2) + _game._player._playerPos = Common::Point(116, 147); + + _game.loadQuoteSet(0x4A, 0x4B, 0x4C, 0x35, 0x34, 0); + _explosionFl = false; + + sceneEntrySound(); +} + +void Scene105::step() { + if ((_game._player._playerPos == Common::Point(170, 87)) && (_game._trigger || !_explosionFl)) { + _explosionFl = true; + switch (_game._trigger) { + case 0: + _scene->_kernelMessages.reset(); + _scene->resetScene(); + _game._player._stepEnabled = false; + _game._player._visible = false; + + _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('m', 0), false); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('m', 2), false); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('m', 3), false); + _vm->_sound->command(33); + _scene->clearSequenceList(); + + warning("TODO: sub7C8DE();"); + + _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 8); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SM_0, 0, 1); + + if (_game._storyMode >= STORYMODE_NICE) + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SM_FRAME_INDEX, 8, 3); + break; + + case 1: + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 6, 0, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 8); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], -2, -2); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 9, 1, 0, 0); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], _globals._sequenceIndexes[0]); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 8); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 5, 7); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SM_0, 0, 2); + break; + + case 2: { + int oldIdx = _globals._sequenceIndexes[2]; + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 9, 0, 0, 0); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], oldIdx); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 8); + _scene->_sequences.addTimer(90, 3); + } + break; + + case 3: + _vm->_dialogs->show(0x290B); + _scene->_reloadSceneFlag = true; + _scene->_sequences.addTimer(90, 4); + break; + } + } + + if (_game._player._moving && (_scene->_rails.getNext() > 0)) { + _game._player.cancelCommand(); + _game._player.startWalking(Common::Point(170, 87), FACING_NONE); + _scene->_rails.resetNext(); + } + + if ((_game._player._special > 0) && _game._player._stepEnabled) + _game._player._stepEnabled = false; +} + +void Scene105::preActions() { + if (_action.isAction(0x15D, 0x195)) + _game._player._walkOffScreenSceneId = 104; + + if (_action.isAction(0x15D, 0xF5)) + _game._player._walkOffScreenSceneId = 107; + + if (_action.isAction(0xE0) && (_action.isAction(VERB_TALKTO) || _action.isAction(VERB_LOOK))) + _game._player._needToWalk = false; +} + +void Scene105::actions() { + if (_action._lookFlag) + _vm->_dialogs->show(0x2910); + else if (_action.isAction(VERB_TAKE, 0x65) && _globals[kFishIn105]) { + if (_game._objects.isInInventory(OBJ_DEAD_FISH)) { + int randVal = _vm->getRandomNumber(74, 76); + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(randVal)); + } else { + _scene->_sequences.remove (_globals._sequenceIndexes[4]); + _game._objects.addToInventory(OBJ_DEAD_FISH); + _globals[kFishIn105] = false; + _vm->_dialogs->showPicture(OBJ_DEAD_FISH, 0x322, 0); + } + } else if (_action.isAction(VERB_LOOK, 0x195)) + _vm->_dialogs->show(0x2905); + else if (_action.isAction(VERB_LOOK, 0x4D)) + _vm->_dialogs->show(0x2906); + else if (_action.isAction(VERB_LOOK, 0xF0)) + _vm->_dialogs->show(0x2907); + else if (_action.isAction(VERB_LOOK, 0xDD)) + _vm->_dialogs->show(0x2908); + else if (_action.isAction(VERB_TAKE, 0xDD)) + _vm->_dialogs->show(0x2909); + else if (_action.isAction(VERB_LOOK, 0xE0)) + _vm->_dialogs->show(0x290A); + else if (_action.isAction(VERB_LOOK, 0x65)) + _vm->_dialogs->show(0x290C); + else if (_action.isAction(VERB_LOOK, 0x158)) + _vm->_dialogs->show(0x290D); + else if (_action.isAction(VERB_LOOK, 0xF5)) + _vm->_dialogs->show(0x290E); + else if (_action.isAction(VERB_LOOK, 0x129)) + _vm->_dialogs->show(0x290F); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes1.h b/engines/mads/nebular/nebular_scenes1.h index e4c8618ff3..2322406fdb 100644 --- a/engines/mads/nebular/nebular_scenes1.h +++ b/engines/mads/nebular/nebular_scenes1.h @@ -129,6 +129,21 @@ public: virtual void postActions() {}; }; +class Scene105 : public Scene1xx { +private: + bool _explosionFl; + +public: + Scene105(MADSEngine *vm) : Scene1xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 2a979e59a0481f62d67b8b323c79cccaa6552d0a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 12 Apr 2014 11:00:29 -0400 Subject: MADS: Refactoring PaletteUsage to use external data arrays --- engines/mads/animation.cpp | 1 + engines/mads/game.cpp | 7 +++++- engines/mads/palette.cpp | 59 ++++++++++++++++++++-------------------------- engines/mads/palette.h | 17 +++++++++---- engines/mads/scene.cpp | 9 ++++--- engines/mads/scene.h | 2 ++ 6 files changed, 53 insertions(+), 42 deletions(-) diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index 40abdbe26b..0547c6b379 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -403,6 +403,7 @@ void Animation::loadInterface(UserInterface &interfaceSurface, MSurface &depthSu AAHeader &header, int flags, Common::Array *palAnimData, SceneInfo *sceneInfo) { _scene->_depthStyle = 0; if (header._animMode <= 2) { + _vm->_palette->_paletteUsage.setEmpty(); sceneInfo->load(header._roomNumber, flags, header._interfaceFile, 0, depthSurface, interfaceSurface); _scene->_depthStyle = sceneInfo->_depthStyle == 2 ? 1 : 0; if (palAnimData) { diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 9296b95d47..9eb2c5c56f 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -189,7 +189,12 @@ void Game::sectionLoop() { _vm->_palette->initPalette(); } - _vm->_palette->_paletteUsage.load(3, 0xF0, 0xF1, 0xF2); + // Set up scene palette usage + _scene._scenePaletteUsage.clear(); + _scene._scenePaletteUsage.push_back(PaletteUsage::UsageEntry(0xF0)); + _scene._scenePaletteUsage.push_back(PaletteUsage::UsageEntry(0xF1)); + _scene._scenePaletteUsage.push_back(PaletteUsage::UsageEntry(0xF2)); + _vm->_palette->_paletteUsage.load(&_scene._scenePaletteUsage); if (!_player._spritesLoaded && _player._loadsFirst) { if (_player.loadSprites("")) diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index 2ff16fb5c1..a307a08848 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -44,27 +44,20 @@ void RGB6::load(Common::SeekableReadStream *f) { PaletteUsage::PaletteUsage(MADSEngine *vm) { _vm = vm; + _data = nullptr; } -void PaletteUsage::load(int count, ...) { - va_list va; - va_start(va, count); - - _data.clear(); - for (int i = 0; i < count; ++i) - _data.push_back(UsageEntry(va_arg(va, int))); - - va_end(va); +void PaletteUsage::load(Common::Array *data) { + _data = data; } - void PaletteUsage::getKeyEntries(Common::Array &palette) { - _data.clear(); + _data->clear(); for (uint i = 0; i < palette.size(); ++i) { byte *uPtr = &palette[i]._flags; - if ((*uPtr & 0x10) && _data.size() < 3) { - _data.push_back(UsageEntry(i)); + if ((*uPtr & 0x10) && _data->size() < 3) { + _data->push_back(UsageEntry(i)); } } } @@ -74,12 +67,12 @@ static bool sortHelper(const PaletteUsage::UsageEntry &ue1, const PaletteUsage:: } void PaletteUsage::prioritize(Common::Array &palette) { - for (uint i = 0; i < _data.size(); ++i) { - RGB6 &palEntry = palette[_data[i]._palIndex]; - _data[i]._sortValue = rgbMerge(palEntry); + for (uint i = 0; i < _data->size(); ++i) { + RGB6 &palEntry = palette[(*_data)[i]._palIndex]; + (*_data)[i]._sortValue = rgbMerge(palEntry); } - Common::sort(_data.begin(), _data.end(), sortHelper); + Common::sort(_data->begin(), _data->end(), sortHelper); } static bool rangeSorter(const PaletteUsage::UsageRange &ur1, const PaletteUsage::UsageRange &ur2) { @@ -105,15 +98,15 @@ int PaletteUsage::process(Common::Array &palette, uint flags) { int rgbIndex = _vm->_palette->_rgbList.scan(); uint32 rgbMask = 1 << rgbIndex; - int varA = flags & 0x8000; - bool hasUsage = !_vm->_palette->_paletteUsage.empty(); + bool noUsageFlag = flags & 0x8000; + bool hasUsage = _data != nullptr; bool flag1 = false; if (hasUsage) { - if (varA || _vm->_palette->_paletteUsage.empty()) + if (noUsageFlag || _data->size() == 0) hasUsage = false; - if (varA && !_vm->_palette->_paletteUsage.empty()) + if (noUsageFlag && _data->size() > 0) flag1 = true; } @@ -155,18 +148,18 @@ int PaletteUsage::process(Common::Array &palette, uint flags) { } if (hasUsage && palette[v1]._flags & 0x10) { - for (uint usageIndex = 0; usageIndex < _data.size() && !var48; ++usageIndex) { - if (_data[usageIndex]._palIndex == palIndex) { + for (uint usageIndex = 0; usageIndex < _data->size() && !var48; ++usageIndex) { + if ((*_data)[usageIndex]._palIndex == palIndex) { var48 = true; - int dataIndex = MIN(usageIndex, _data.size() - 1); - var4 = _data[dataIndex]._palIndex; + int dataIndex = MIN(usageIndex, _data->size() - 1); + var4 = (*_data)[dataIndex]._palIndex; } } } if (flag1 && palette[palIndex]._flags & 0x10) { - for (uint usageIndex = 0; usageIndex < _data.size() && !var48; ++usageIndex) { - if (_data[usageIndex]._palIndex == palIndex) { + for (uint usageIndex = 0; usageIndex < _data->size() && !var48; ++usageIndex) { + if ((*_data)[usageIndex]._palIndex == palIndex) { var48 = true; var4 = 0xF0 + usageIndex; @@ -180,7 +173,7 @@ int PaletteUsage::process(Common::Array &palette, uint flags) { } } - if (!var48 && !varA) { + if (!var48 && !noUsageFlag) { int var2 = (palette[palIndex]._flags & 0x20) || (((flags & 0x2000) || (palette[palIndex]._flags & 0x4000)) && ((flags & 0x1000) || (palCount == 0))) ? 0x7fff : 1; @@ -229,7 +222,7 @@ int PaletteUsage::process(Common::Array &palette, uint flags) { } assert(var48); - int var52 = (varA && palette[palIndex]._u2) ? 2 : 0; + int var52 = (noUsageFlag && palette[palIndex]._u2) ? 2 : 0; _vm->_palette->_palFlags[var4] |= var52 | rgbMask; palette[palIndex]._palIndex = var4; @@ -248,9 +241,9 @@ int PaletteUsage::rgbMerge(RGB6 &palEntry) { void PaletteUsage::transform(Common::Array &palette) { if (!empty()) { - for (uint i = 0; i < _data.size(); ++i) { - int palIndex = _data[i]._palIndex; - _data[i]._palIndex = palette[palIndex]._palIndex; + for (uint i = 0; i < _data->size(); ++i) { + int palIndex = (*_data)[i]._palIndex; + (*_data)[i]._palIndex = palette[palIndex]._palIndex; } } } @@ -433,7 +426,7 @@ void Palette::resetGamePalette(int lowRange, int highRange) { if (highRange) { _palFlags[255] = 1; - Common::fill(&_palFlags[255 - highRange], &_palFlags[254], _palFlags[255]); + Common::fill(&_palFlags[256 - highRange], &_palFlags[254], _palFlags[255]); } _rgbList.clear(); diff --git a/engines/mads/palette.h b/engines/mads/palette.h index cceef09417..74355f8847 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -71,7 +71,7 @@ public: uint16 _palIndex; int _sortValue; - UsageEntry(int palIndex) { _palIndex = palIndex; } + UsageEntry(int palIndex) { _palIndex = palIndex; _sortValue = -1; } }; struct UsageRange { byte _v1, _v2; @@ -80,27 +80,34 @@ public: }; private: MADSEngine *_vm; - Common::Array _data; + Common::Array *_data; int rgbMerge(RGB6 &palEntry); int getGamePalFreeIndex(int *palIndex); int rgbFactor(byte *palEntry, RGB6 &pal6); + + Common::Array _nullUsage; public: /** * Constructor */ PaletteUsage(MADSEngine *vm); - void load(int count, ...); + void load(Common::Array *data); /** * Returns whether the usage list is empty */ - bool empty() const { return _data.size() == 0; } + bool empty() const { return _data == nullptr; } + + uint16 &operator[](int index) { return (*_data)[index]._palIndex; } - uint16 &operator[](int index) { return _data[index]._palIndex; } + /** + * Assigns the class to an empty usage array + */ + void setEmpty() { _data = &_nullUsage; } /** * Gets key entries from the passed palette diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 9f8c922861..92c5cedc04 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -50,6 +50,8 @@ Scene::Scene(MADSEngine *vm): _vm(vm), _action(_vm), _depthSurface(vm), _layer = LAYER_GUI; _lookFlag = false; + _paletteUsageF.push_back(PaletteUsage::UsageEntry(0xF)); + _verbList.push_back(VerbInit(VERB_LOOK, VERB_THAT, PREP_NONE)); _verbList.push_back(VerbInit(VERB_TAKE, VERB_THAT, PREP_NONE)); _verbList.push_back(VerbInit(VERB_PUSH, VERB_THAT, PREP_NONE)); @@ -121,8 +123,8 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) { _spriteSlots.reset(false); _sequences.clear(); _kernelMessages.clear(); + _vm->_palette->_paletteUsage.load(&_scenePaletteUsage); - // TODO: palletteUsage reset? setPalette(_nullPalette); int flags = SCENEFLAG_LOAD_SHADOW; if (_vm->_dithering) flags |= SCENEFLAG_DITHER; @@ -144,7 +146,7 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) { loadVocab(); // Load palette usage - _vm->_palette->_paletteUsage.load(1, 0xF); + _vm->_palette->_paletteUsage.load(&_paletteUsageF); // Load interface flags = PALFLAG_RESERVED | ANIMFLAG_LOAD_BACKGROUND; @@ -157,7 +159,7 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) { MSurface depthSurface; _animationData->load(_userInterface, depthSurface, prefix, flags, nullptr, nullptr); - _vm->_palette->_paletteUsage.load(0); + _vm->_palette->_paletteUsage.load(&_scenePaletteUsage); _bandsRange = _sceneInfo->_yBandsEnd - _sceneInfo->_yBandsStart; _scaleRange = _sceneInfo->_maxScale - _sceneInfo->_minScale; @@ -576,6 +578,7 @@ void Scene::free() { _activeAnimation = nullptr; } + _vm->_palette->_paletteUsage.load(nullptr); _hotspots.clear(); _backgroundSurface.free(); _depthSurface.free(); diff --git a/engines/mads/scene.h b/engines/mads/scene.h index a49692dc5b..4d9a3f8efa 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -128,6 +128,8 @@ public: Layer _layer; bool _lookFlag; Common::Point _customDest; + Common::Array _paletteUsageF; + Common::Array _scenePaletteUsage; /** * Constructor -- cgit v1.2.3 From bb82a344a96bcf63c63ab6a297b83eaefa0383d6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 12 Apr 2014 11:08:50 -0400 Subject: MADS: Further refactoring for PaletteUsage data arrays --- engines/mads/palette.cpp | 14 +++++++++----- engines/mads/palette.h | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index a307a08848..8dfd8f6525 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -84,6 +84,10 @@ int PaletteUsage::process(Common::Array &palette, uint flags) { int palHigh = (flags & 0x800) ? 0x100 : 0xFC; int palIdx; + PaletteUsage tempUsage(_vm); + Common::Array tempUsageData; + tempUsage.load(&tempUsageData); + if (flags & 0x4000) { palLow = 0; palIdx = palHigh; @@ -111,12 +115,12 @@ int PaletteUsage::process(Common::Array &palette, uint flags) { } if (hasUsage) { - getKeyEntries(palette); - prioritize(palette); + tempUsage.getKeyEntries(palette); + tempUsage.prioritize(palette); } int freeIndex; - int palCount = getGamePalFreeIndex(&freeIndex); + int palCount = tempUsage.getGamePalFreeIndex(&freeIndex); Common::Array palRange; for (uint palIndex = 0; palIndex < palette.size(); ++palIndex) { @@ -148,8 +152,8 @@ int PaletteUsage::process(Common::Array &palette, uint flags) { } if (hasUsage && palette[v1]._flags & 0x10) { - for (uint usageIndex = 0; usageIndex < _data->size() && !var48; ++usageIndex) { - if ((*_data)[usageIndex]._palIndex == palIndex) { + for (uint usageIndex = 0; usageIndex < tempUsage._data->size() && !var48; ++usageIndex) { + if ((*tempUsage._data)[usageIndex]._palIndex == palIndex) { var48 = true; int dataIndex = MIN(usageIndex, _data->size() - 1); var4 = (*_data)[dataIndex]._palIndex; diff --git a/engines/mads/palette.h b/engines/mads/palette.h index 74355f8847..5ad7e23d2b 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -72,6 +72,7 @@ public: int _sortValue; UsageEntry(int palIndex) { _palIndex = palIndex; _sortValue = -1; } + UsageEntry() { _palIndex = 0; _sortValue = 0; } }; struct UsageRange { byte _v1, _v2; -- cgit v1.2.3 From 8b2a7525cc6af408f05e2bac9b1b16ed0b36dcda Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 12 Apr 2014 12:09:29 -0400 Subject: MADS: Fix a bunch of GCC warnings --- engines/mads/action.cpp | 6 ++++++ engines/mads/animation.cpp | 4 ++-- engines/mads/detection_tables.h | 2 +- engines/mads/game.h | 1 - engines/mads/nebular/dialogs_nebular.cpp | 10 +++++----- engines/mads/nebular/game_nebular.cpp | 5 ++++- engines/mads/nebular/nebular_scenes1.cpp | 2 +- engines/mads/rails.cpp | 2 +- engines/mads/screen.cpp | 4 ++-- engines/mads/sequence.cpp | 2 +- engines/mads/user_interface.cpp | 1 - 11 files changed, 23 insertions(+), 16 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index f3e1d2db1e..2d3c1159ff 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -403,6 +403,9 @@ void MADSAction::checkActionAtMousePos() { } } break; + + default: + break; } } @@ -618,6 +621,9 @@ void MADSAction::leftClick() { break; } break; + + default: + break; } } diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index 0547c6b379..ddad63ca2f 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -315,8 +315,8 @@ void Animation::load(UserInterface &interfaceSurface, MSurface &depthSurface, } if (_header._manualFlag) { - Common::String resName = "*" + _header._spriteSetNames[_header._spritesIndex]; - SpriteAsset *sprites = new SpriteAsset(_vm, resName, flags); + Common::String assetResName = "*" + _header._spriteSetNames[_header._spritesIndex]; + SpriteAsset *sprites = new SpriteAsset(_vm, assetResName, flags); _spriteSets[_header._spritesIndex] = sprites; _spriteListIndexes[_header._spritesIndex] = _scene->_sprites.add(sprites); diff --git a/engines/mads/detection_tables.h b/engines/mads/detection_tables.h index d7614cfb6e..4eb1dd51db 100644 --- a/engines/mads/detection_tables.h +++ b/engines/mads/detection_tables.h @@ -59,7 +59,7 @@ static const MADSGameDescription gameDescriptions[] = { 0 }, - { AD_TABLE_END_MARKER } + { AD_TABLE_END_MARKER, 0, 0 } }; } // End of namespace MADS diff --git a/engines/mads/game.h b/engines/mads/game.h index c7cb66081d..2c87d70d9d 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -51,7 +51,6 @@ enum KernelMode { enum ProtectionResult { PROTECTION_SUCCEED = 0, PROTECTION_FAIL = 1, PROTECTION_ESCAPE = 2 }; -; class Game { private: diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp index 13019d589c..30b28fe9d7 100644 --- a/engines/mads/nebular/dialogs_nebular.cpp +++ b/engines/mads/nebular/dialogs_nebular.cpp @@ -169,12 +169,12 @@ bool DialogsNebular::show(int msgId) { } else if (commandCheck("VERB", valStr, commandText)) { dialogText += getVocab(action._activeAction._verbId); } else if (commandCheck("INDEX", valStr, commandText)) { - int idx = atoi(valStr.c_str()); - if (_indexList[idx]) - dialogText += getVocab(_indexList[idx]); + int idxLocal = atoi(valStr.c_str()); + if (_indexList[idxLocal]) + dialogText += getVocab(_indexList[idxLocal]); } else if (commandCheck("NUMBER", valStr, commandText)) { - int idx = atoi(valStr.c_str()); - dialogText += Common::String::format("%.4d", _indexList[idx]); + int idxLocal = atoi(valStr.c_str()); + dialogText += Common::String::format("%.4d", _indexList[idxLocal]); } else if (commandCheck("NOUN1", valStr, commandText)) { if (!textNoun(dialogText, 1, valStr)) dialogText += getVocab(action._activeAction._objectNameId); diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index 30a67f920b..4142cb4708 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -704,7 +704,7 @@ void GameNebular::step() { } break; - case 2: + case FACING_SOUTH: if (randomVal < 500) { for (int count = 0; count < 10; ++count) { _player.addWalker((randomVal < 250) ? 1 : 2, 0); @@ -722,6 +722,9 @@ void GameNebular::step() { } } break; + + default: + break; } } } diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 3d87e9e7c3..d6390ddfc8 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -1298,7 +1298,7 @@ void Scene103::step() { if (_globals._frameTime <= _scene->_frameStartTime) { pt = _vm->_game->_player._playerPos; - int dist = _vm->hypotenuse(pt.x - 79, pt.y - 137); + dist = _vm->hypotenuse(pt.x - 79, pt.y - 137); _vm->_sound->command(29, (dist * -127 / 378) + 127); pt = _vm->_game->_player._playerPos; diff --git a/engines/mads/rails.cpp b/engines/mads/rails.cpp index 4daa774023..0c179f8dc1 100644 --- a/engines/mads/rails.cpp +++ b/engines/mads/rails.cpp @@ -114,7 +114,7 @@ void Rails::setupRouteNode(int *routeIndexP, int nodeIndex, int flags, int route for (int idx = _nodes.size() - 2; idx > 0; --idx) { int nodePos = idx - 1; if (!_nodes[nodePos]._active && ((currentNode._distances[nodePos] & flags) != 0)) - setupRouteNode(routeIndexP, nodePos, 0x8000, routeLength + distanceVal & 0x3fff); + setupRouteNode(routeIndexP, nodePos, 0x8000, routeLength + (distanceVal & 0x3fff)); } } diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index 9824a3e7cc..f4441ca969 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -389,7 +389,7 @@ void ScreenObjects::elementHighlighted() { int index; int indexEnd = -1; int var8 = 0; - int uiCount; + //int uiCount; switch (userInterface._category) { case CAT_COMMAND: @@ -461,7 +461,7 @@ void ScreenObjects::elementHighlighted() { break; default: - uiCount = size() - _uiCount; + //uiCount = size() - _uiCount; index = scene._hotspots.size(); indexEnd = index - 1; varA = 0; diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index 409dc303fe..d27f9d289f 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -149,7 +149,7 @@ int SequenceList::addTimer(int time, int abortVal) { if (!_entries[seqIndex]._active) break; } - assert(seqIndex < (int)_entries.size()); + assert(seqIndex < _entries.size()); SequenceEntry &se = _entries[seqIndex]; se._active = true; diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index a850c9a68f..13d5569045 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -865,7 +865,6 @@ void UserInterface::updateSelection(ScrCategory category, int newIndex, int *idx *idx = newIndex; if (oldIndex >= 0) { - Common::Rect bounds; writeVocab(category, oldIndex); if (getBounds(category, oldIndex, bounds)) -- cgit v1.2.3 From 9b0f0b6efec3da058157beb25bab7083328df1da Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 12 Apr 2014 16:14:57 -0400 Subject: MADS: Add missing handling code for palette _rgbList --- engines/mads/animation.cpp | 7 ++++++- engines/mads/assets.cpp | 5 +++++ engines/mads/assets.h | 5 +++++ engines/mads/palette.cpp | 18 +++++++++++++++++- engines/mads/palette.h | 2 ++ 5 files changed, 35 insertions(+), 2 deletions(-) diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index ddad63ca2f..b79a753c28 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -322,7 +322,12 @@ void Animation::load(UserInterface &interfaceSurface, MSurface &depthSurface, _spriteListIndexes[_header._spritesIndex] = _scene->_sprites.add(sprites); } - // TODO: List var_420/var_422 population that seems to overwrite other structures? + Common::Array usageList; + for (int idx = 0; idx < _header._spriteSetsCount; ++idx) + usageList.push_back(_spriteSets[idx]->_usageIndex); + + if (usageList.size() > 0 > 0) + _vm->_palette->_paletteUsage.updateUsage(usageList, _header._messagesCount); if (_header._animMode == 4) { // Remaps the sprite list indexes for frames to the loaded sprite list indexes diff --git a/engines/mads/assets.cpp b/engines/mads/assets.cpp index 582b80dd8a..3e18a6711e 100644 --- a/engines/mads/assets.cpp +++ b/engines/mads/assets.cpp @@ -46,6 +46,11 @@ SpriteAsset::SpriteAsset(MADSEngine *vm, Common::SeekableReadStream *stream, int load(stream, flags); } +SpriteAsset::~SpriteAsset() { + if (_usageIndex) + _vm->_palette->_paletteUsage.resetPalFlags(_usageIndex); +} + void SpriteAsset::load(Common::SeekableReadStream *stream, int flags) { int curFrame = 0; uint32 frameOffset = 0; diff --git a/engines/mads/assets.h b/engines/mads/assets.h index 54417f84ff..a5d3b3ecef 100644 --- a/engines/mads/assets.h +++ b/engines/mads/assets.h @@ -89,6 +89,11 @@ public: */ SpriteAsset(MADSEngine *vm, Common::SeekableReadStream *stream, int flags); + /** + * Destructor + */ + ~SpriteAsset(); + int getCount() { return _frameCount; } int getFrameRate() const { return _frameRate; } int getPixelSpeed() const { return _pixelSpeed; } diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index 8dfd8f6525..0c1819c809 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -276,6 +276,21 @@ void PaletteUsage::updateUsage(Common::Array &usageList, int sceneUsageInde _vm->_palette->_rgbList[sceneUsageIndex] = true; } +void PaletteUsage::resetPalFlags(int idx) { + if (idx >= 0 && idx < 32) { + uint32 rgbMask = ~(1 << idx); + + uint32 *flagP = _vm->_palette->_palFlags; + for (int i = 0; i < 256; ++i, ++flagP) { + *flagP &= rgbMask; + if (*flagP == 2) + *flagP = 0; + } + + _vm->_palette->_rgbList[idx] = 0; + } +} + int PaletteUsage::getGamePalFreeIndex(int *palIndex) { *palIndex = -1; int count = 0; @@ -330,6 +345,7 @@ Palette::Palette(MADSEngine *vm) : _vm(vm), _paletteUsage(vm) { _lowRange = 0; _highRange = 0; Common::fill(&_mainPalette[0], &_mainPalette[PALETTE_SIZE], 0); + Common::fill(&_palFlags[0], &_palFlags[PALETTE_COUNT], 0); } void Palette::setPalette(const byte *colors, uint start, uint num) { @@ -423,7 +439,7 @@ void Palette::resetGamePalette(int lowRange, int highRange) { // Init low range to common RGB values if (lowRange) { - Common::fill(&_palFlags[0], &_palFlags[lowRange], 1); + Common::fill(&_palFlags[0], &_palFlags[lowRange - 1], 1); } // Init high range to common RGB values diff --git a/engines/mads/palette.h b/engines/mads/palette.h index 5ad7e23d2b..9751351a95 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -127,6 +127,8 @@ public: void transform(Common::Array &palette); void updateUsage(Common::Array &usageList, int sceneUsageIndex); + + void resetPalFlags(int idx); }; class RGBList { -- cgit v1.2.3 From d41833e8e587c3cf53c3e3263b32169fb6d1e353 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 12 Apr 2014 23:09:05 +0200 Subject: MADS: Implement Palette::refreshHighColors() --- engines/mads/nebular/nebular_scenes1.cpp | 9 ++++----- engines/mads/palette.cpp | 9 +++++++++ engines/mads/palette.h | 2 ++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index d6390ddfc8..b3fbedf574 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -1569,7 +1569,7 @@ void Scene104::step() { _game._player._stepEnabled = false; _game._player._visible = false; _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('a', 0), false); - warning("TODO: sub7C8DE()"); + _vm->_palette->refreshHighColors(); _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], mirrorFl, 7, 1, 0, 0); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(198, 143)); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); @@ -1599,7 +1599,7 @@ void Scene104::step() { _game._player._stepEnabled = false; _game._player._visible = false; _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('a', 1), false); - warning("TODO: sub7C8DE()"); + _vm->_palette->refreshHighColors(); _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 6, 1, 0, 0); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[3], Common::Point(198, 143)); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 4); @@ -1638,7 +1638,7 @@ void Scene104::step() { _game._player._stepEnabled = false; _game._player._visible = false; _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('a', 2), false); - warning("TODO: sub7C8DE()"); + _vm->_palette->refreshHighColors(); _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 8, 1, 0, 0); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(198, 143)); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 4); @@ -1755,8 +1755,7 @@ void Scene105::step() { _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('m', 3), false); _vm->_sound->command(33); _scene->clearSequenceList(); - - warning("TODO: sub7C8DE();"); + _vm->_palette->refreshHighColors(); _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 6, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 8); diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index 0c1819c809..157754f0d4 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -524,4 +524,13 @@ void Palette::unlock() { _rgbList[31] = false; _lockFl = false; } + +void Palette::refreshHighColors() { + int val = 18; + if (_vm->_game->_scene._animFlag) + val += _vm->_game->_scene._animCount; + + setPalette(_mainPalette, val, 256 - val); +} + } // End of namespace MADS diff --git a/engines/mads/palette.h b/engines/mads/palette.h index 9751351a95..728fd0969a 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -254,6 +254,8 @@ public: void lock(); void unlock(); + + void refreshHighColors(); }; } // End of namespace MADS -- cgit v1.2.3 From 41ea3e237459091338e6057c5cc759dd65451c98 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 12 Apr 2014 17:15:05 -0400 Subject: MADS: Fix misspelling in if statement --- engines/mads/animation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index b79a753c28..d5b8e21fae 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -326,7 +326,7 @@ void Animation::load(UserInterface &interfaceSurface, MSurface &depthSurface, for (int idx = 0; idx < _header._spriteSetsCount; ++idx) usageList.push_back(_spriteSets[idx]->_usageIndex); - if (usageList.size() > 0 > 0) + if (usageList.size() > 0) _vm->_palette->_paletteUsage.updateUsage(usageList, _header._messagesCount); if (_header._animMode == 4) { -- cgit v1.2.3 From 387e7d800d89c25e6a1a89caa7a915f4575fb47b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 12 Apr 2014 17:21:04 -0400 Subject: MADS: Add missing call to new refreshHighColors method --- engines/mads/animation.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index d5b8e21fae..380770fd8f 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -365,6 +365,9 @@ void Animation::startAnimation(int abortTimers) { loadFrame(1); } + if (_vm->_game->_kernelMode == KERNEL_ACTIVE_CODE) + _vm->_palette->refreshHighColors(); + _currentFrame = 0; _oldFrameEntry = 0; _nextFrameTimer = _vm->_game->_scene._frameStartTime; -- cgit v1.2.3 From d58d9075da363a8481859236b197a0e6b01b2bfd Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 12 Apr 2014 23:33:21 +0200 Subject: MADS: Initialize a variable in scene 105 --- engines/mads/nebular/nebular_scenes1.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes1.h b/engines/mads/nebular/nebular_scenes1.h index 2322406fdb..f150e2f135 100644 --- a/engines/mads/nebular/nebular_scenes1.h +++ b/engines/mads/nebular/nebular_scenes1.h @@ -134,7 +134,7 @@ private: bool _explosionFl; public: - Scene105(MADSEngine *vm) : Scene1xx(vm) {} + Scene105(MADSEngine *vm) : Scene1xx(vm), _explosionFl(false) {} virtual void setup(); virtual void enter(); -- cgit v1.2.3 From a2d03dad4c5be915dfbc7a05af85be40d3e749f2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 12 Apr 2014 17:40:26 -0400 Subject: MADS: Fix for sprite animation range --- engines/mads/sequence.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index d27f9d289f..c74fe44305 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -373,7 +373,7 @@ void SequenceList::setAnimRange(int seqIndex, int startVal, int endVal) { SequenceEntry &seqEntry = _entries[seqIndex]; SpriteAsset &spriteSet = *scene._sprites[seqEntry._spritesIndex]; int numSprites = spriteSet.getCount(); - int tempStart = startVal, tempEnd = endVal; + int tempStart, tempEnd; switch (startVal) { case -2: @@ -382,6 +382,9 @@ void SequenceList::setAnimRange(int seqIndex, int startVal, int endVal) { case -1: tempStart = 1; break; + default: + tempStart = startVal; + break; } switch (endVal) { @@ -393,14 +396,14 @@ void SequenceList::setAnimRange(int seqIndex, int startVal, int endVal) { tempEnd = 1; break; default: - tempEnd = numSprites; + tempEnd = endVal; break; } seqEntry._frameStart = tempStart; seqEntry._numSprites = tempEnd; - seqEntry._frameIndex = (seqEntry._frameInc < 0) ? tempStart : tempEnd; + seqEntry._frameIndex = (seqEntry._frameInc >= 0) ? tempStart : tempEnd; } void SequenceList::scan() { -- cgit v1.2.3 From 0e67669001ab1d664b00037c4382cb5e6de56d56 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 12 Apr 2014 17:43:36 -0400 Subject: MADS: Fix sitting down on chair in scene 101 --- engines/mads/nebular/nebular_scenes1.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index b3fbedf574..0c752e9e44 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -356,7 +356,7 @@ void Scene101::actions() { _game._player._stepEnabled = true; _sittingFl = true; _scene->_hotspots.activate(71, false); - _chairHotspotId = _scene->_dynamicHotspots.add(71, 0x13F, -1, Common::Rect(159, 84, 33, 36)); + _chairHotspotId = _scene->_dynamicHotspots.add(71, 0x13F, -1, Common::Rect(159, 84, 159 + 33, 84 + 36)); if (!_action.isAction(VERB_LOOK, 0x180)) { _action._inProgress = false; return; -- cgit v1.2.3 From 85b7a8d019f7ba2246c49b9bb3a713f0388786f8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 12 Apr 2014 20:52:28 -0400 Subject: MADS: Fix for resetting trigger mode between scenes --- engines/mads/game.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 9eb2c5c56f..a6650555ce 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -238,6 +238,7 @@ void Game::sectionLoop() { _priorFrameTimer = _scene._frameStartTime; // Call the scene logic for entering the given scene + _triggerSetupMode = KERNEL_TRIGGER_DAEMON; _scene._sceneLogic->enter(); // Set player data -- cgit v1.2.3 From fc7e91691d73bcc0e58cd89f85597a2c42fd6d57 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 12 Apr 2014 20:53:10 -0400 Subject: MADS: Added noun constants for walking through doors --- engines/mads/nebular/nebular_scenes.h | 1 + engines/mads/nebular/nebular_scenes1.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index 357180e870..56ea52d2c8 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -90,6 +90,7 @@ enum Noun { NOUN_15F = 0x15F, NOUN_TIMEBOMB = 0x171, NOUN_VIEW_SCREEN = 0x180, + NOUN_WALK_THROUGH = 0x18B, NOUN_CAPTIVE_CREATURE = 0x1C3, NOUN_NATIVE_WOMAN = 0x1DC, NOUN_ALCOHOL = 0x310, diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 0c752e9e44..9d0cf5f8ce 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -1316,7 +1316,7 @@ void Scene103::step() { void Scene103::actions() { if (_action._savedFields._lookFlag) { _vm->_dialogs->show(10322); - } else if (_action.isAction(395, 110)) { + } else if (_action.isAction(NOUN_WALK_THROUGH, NOUN_DOOR)) { switch (_vm->_game->_trigger) { case 0: _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 6, 1); -- cgit v1.2.3 From f4165c5f8a2a15a6b3cdf1ce46732e2e5efe772a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 12 Apr 2014 22:08:21 -0400 Subject: MADS: Field/method renaming --- engines/mads/palette.cpp | 2 +- engines/mads/scene.cpp | 12 ++++++------ engines/mads/scene.h | 2 +- engines/mads/sprites.cpp | 2 +- engines/mads/sprites.h | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index 157754f0d4..64e0f80766 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -527,7 +527,7 @@ void Palette::unlock() { void Palette::refreshHighColors() { int val = 18; - if (_vm->_game->_scene._animFlag) + if (_vm->_game->_scene._cyclingActive) val += _vm->_game->_scene._animCount; setPalette(_mainPalette, val, 256 - val); diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 92c5cedc04..1aa1fd7f32 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -37,7 +37,7 @@ Scene::Scene(MADSEngine *vm): _vm(vm), _action(_vm), _depthSurface(vm), _currentSceneId = 0; _sceneLogic = nullptr; _sceneInfo = nullptr; - _animFlag = false; + _cyclingActive = false; _animVal1 = 0; _depthStyle = 0; _roomChanged = false; @@ -257,7 +257,7 @@ void Scene::initPaletteAnimation(Common::Array &animData, bool animFlag) { _animCount += _animPalData[i].r; _animVal1 = (_animCount > 16) ? 3 : 0; - _animFlag = animFlag; + _cyclingActive = animFlag; } bool Scene::getDepthHighBits(const Common::Point &pt) { @@ -393,7 +393,7 @@ void Scene::doFrame() { } if (_vm->_game->_fx) - _animFlag = true; + _cyclingActive = true; _vm->_game->_fx = kTransitionNone; if (_freeAnimationFlag && _activeAnimation) { @@ -403,7 +403,7 @@ void Scene::doFrame() { } void Scene::drawElements(ScreenTransition transitionType, bool surfaceFlag) { - // Draw any sprites + // Draw any sprite backgrounds _spriteSlots.drawBackground(); // Set up dirty areas for any text display @@ -420,8 +420,8 @@ void Scene::drawElements(ScreenTransition transitionType, bool surfaceFlag) { _textDisplay.setDirtyAreas2(); _dirtyAreas.merge(1, DIRTY_AREAS_SIZE); - // Draw foreground sprites - _spriteSlots.drawForeground(&_vm->_screen); + // Draw sprites that have changed + _spriteSlots.drawSprites(&_vm->_screen); // Draw text elements onto the view _textDisplay.draw(&_vm->_screen); diff --git a/engines/mads/scene.h b/engines/mads/scene.h index 4d9a3f8efa..e00924a543 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -106,7 +106,7 @@ public: MSurface _backgroundSurface; DepthSurface _depthSurface; UserInterface _userInterface; - bool _animFlag; + bool _cyclingActive; int _animVal1; int _animCount; Common::Array _animTicksList; diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp index 0dd640bca0..83f01430eb 100644 --- a/engines/mads/sprites.cpp +++ b/engines/mads/sprites.cpp @@ -283,7 +283,7 @@ void SpriteSlots::drawBackground() { } } -void SpriteSlots::drawForeground(MSurface *s) { +void SpriteSlots::drawSprites(MSurface *s) { DepthList depthList; Scene &scene = _vm->_game->_scene; diff --git a/engines/mads/sprites.h b/engines/mads/sprites.h index 962d8c9e75..745e0700e8 100644 --- a/engines/mads/sprites.h +++ b/engines/mads/sprites.h @@ -192,7 +192,7 @@ public: /** * Draw any sprites into the foreground of the scene */ - void drawForeground(MSurface *s); + void drawSprites(MSurface *s); void cleanUp(); }; -- cgit v1.2.3 From 38336886741dc9d980270cfbaae82805e7e4b046 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 13 Apr 2014 11:27:07 +0200 Subject: MADS: Implement scene 106 --- engines/mads/nebular/nebular_scenes.cpp | 2 + engines/mads/nebular/nebular_scenes1.cpp | 241 ++++++++++++++++++++++++++++--- engines/mads/nebular/nebular_scenes1.h | 19 +++ 3 files changed, 243 insertions(+), 19 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index f9d23be2cf..cd233701c3 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -57,6 +57,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene104(vm); case 105: return new Scene105(vm); + case 106: + return new Scene106(vm); // Scene group #2 case 201: diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 9d0cf5f8ce..8871032178 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -1338,10 +1338,8 @@ void Scene103::actions() { switch (_vm->_game->_trigger) { case 0: _scene->changeVariant(1); - _globals._sequenceIndexes[13] = _scene->_sequences.startReverseCycle( - _globals._spriteIndexes[13], false, 3, 2); + _globals._sequenceIndexes[13] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[13], false, 3, 2); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[13]); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SM_FRAME_INDEX, 7, 1); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SM_0, 0, 2); _vm->_game->_player._visible = false; @@ -1370,10 +1368,8 @@ void Scene103::actions() { switch (_vm->_game->_trigger) { case 0: _scene->changeVariant(1); - _globals._sequenceIndexes[12] = _scene->_sequences.startReverseCycle( - _globals._spriteIndexes[12], false, 3, 2); + _globals._sequenceIndexes[12] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[12], false, 3, 2); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[12]); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SM_FRAME_INDEX, 6, 1); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SM_0, 0, 2); _vm->_game->_player._visible = false; @@ -1523,8 +1519,8 @@ void Scene104::setup() { } void Scene104::enter() { - _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('h', -1), false); - _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 14, 0, 0, 1); + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('h', -1)); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 14, 0, 0, 1); if (_scene->_priorSceneId == 105) _game._player._playerPos = Common::Point(302, 107); @@ -1568,7 +1564,7 @@ void Scene104::step() { _scene->resetScene(); _game._player._stepEnabled = false; _game._player._visible = false; - _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('a', 0), false); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('a', 0)); _vm->_palette->refreshHighColors(); _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], mirrorFl, 7, 1, 0, 0); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(198, 143)); @@ -1598,7 +1594,7 @@ void Scene104::step() { _scene->resetScene(); _game._player._stepEnabled = false; _game._player._visible = false; - _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('a', 1), false); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('a', 1)); _vm->_palette->refreshHighColors(); _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 6, 1, 0, 0); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[3], Common::Point(198, 143)); @@ -1636,8 +1632,8 @@ void Scene104::step() { _scene->_activeAnimation->free(); _scene->resetScene(); _game._player._stepEnabled = false; - _game._player._visible = false; - _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('a', 2), false); + _game._player._visible = false; + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('a', 2)); _vm->_palette->refreshHighColors(); _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 8, 1, 0, 0); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(198, 143)); @@ -1717,8 +1713,8 @@ void Scene105::setup() { } void Scene105::enter() { - _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('m', 1), false); - _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('f', 4), false); + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('m', 1)); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('f', 4)); _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 8, 0, 0, 0); if (_globals[kFishIn105]) { @@ -1748,11 +1744,11 @@ void Scene105::step() { _scene->_kernelMessages.reset(); _scene->resetScene(); _game._player._stepEnabled = false; - _game._player._visible = false; + _game._player._visible = false; - _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('m', 0), false); - _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('m', 2), false); - _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('m', 3), false); + _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('m', 0)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('m', 2)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('m', 3)); _vm->_sound->command(33); _scene->clearSequenceList(); _vm->_palette->refreshHighColors(); @@ -1856,5 +1852,212 @@ void Scene105::actions() { /*------------------------------------------------------------------------*/ +void Scene106::setup() { + setPlayerSpritesPrefix(); + setAAName(); + + if ((_scene->_priorSceneId == 102) && !_game._objects.isInInventory(OBJ_REBREATHER) && !_scene->_roomChanged) + _game._player._spritesPrefix = ""; + + _vm->_dialogs->_defaultPosition.y = 100; +} + +void Scene106::enter() { + _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('H', -1)); + + if (_game._objects.isInInventory(OBJ_REBREATHER) || (_scene->_priorSceneId != 102) || _scene->_roomChanged) { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('A', 0)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('A', 1)); + } + + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('G', -1)); + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 21, 0, 0, 0); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('I', -1)); + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 6, 0, 32, 47); + + if (_scene->_priorSceneId == 102) { + _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 6, 1, 4, 0); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SM_0, 0, 70); + _game._player._visible = false; + _game._player._stepEnabled = false; + _game._player._facing = FACING_EAST; + _game._player._playerPos = Common::Point(106, 69); + } else if (_scene->_priorSceneId != -2) { + if (_scene->_priorSceneId == 107) { + _game._player._playerPos = Common::Point(319, 84); + _game._player._facing = _game._player._prepareWalkFacing = FACING_WEST; + } else { + _game._player._playerPos = Common::Point(319, 44); + _game._player._facing = _game._player._prepareWalkFacing = FACING_SOUTHWEST; + _scene->_sprites[_game._player._spritesStart + 3]->_charInfo->_velocity = 24; + } + + _game._player._prepareWalkPos = Common::Point(246, 69); + _game._player._needToWalk = true; + _game._player._readyToWalk = true; + } + + if (_scene->_priorSceneId != 102) { + _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 6, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], -2, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14); + } + + _backToShipFl = false; + _shadowFl = false; + _firstEmergingFl = false; + + _game.loadQuoteSet(0x31, 0x32, 0x34, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0); + sceneEntrySound(); +} + +void Scene106::step() { + if (_game._trigger == 70) { + _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 6, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], -2, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14); + + if (!_game._objects.isInInventory(OBJ_REBREATHER) && !_scene->_roomChanged) { + _scene->loadAnimation(Resources::formatName(106, 'A', -1, EXT_AA, ""), 75); + } else { + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 4, 1, 0, 0); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SM_FRAME_INDEX, 28, 71); + } + } + + if (_game._trigger == 71) { + _game._player._prepareWalkPos = Common::Point(246, 69); + _game._player._prepareWalkFacing = FACING_EAST; + _game._player._needToWalk = true; + _game._player._readyToWalk = true; + _game._player._visible = true; + + if (_game._visitedScenes._sceneRevisited) { + _game._player._stepEnabled = true; + } else { + _game._player._prepareWalkFacing = FACING_SOUTHWEST; + _firstEmergingFl = true; + _scene->loadAnimation(Resources::formatName(106, 'B', -1, EXT_AA, ""), 80); + } + } + + if (_firstEmergingFl && (_scene->_activeAnimation->getCurrentFrame() >= 19)) { + _firstEmergingFl = false; + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(52)); + } + + if ((_game._trigger >= 80) && (_game._trigger <= 87)) { + int tmpVal = _game._trigger - 80; + int msgId = -1; + switch (tmpVal) { + case 0: + _msgPosY = 26; + msgId = 49; + break; + + case 1: + case 2: + case 3: + case 4: + case 5: + msgId = 76 + tmpVal; + break; + + case 6: + msgId = 50; + break; + + default: + msgId = -1; + _game._player._stepEnabled = true; + break; + } + + if (msgId >= 0) { + int nextAbortVal = _game._trigger + 1; + _scene->_kernelMessages.add(Common::Point(15, _msgPosY), 0x1110, 0, 0, 360, _game.getQuote(msgId)); + _scene->_sequences.addTimer(150, nextAbortVal); + _msgPosY += 14; + } + } + + if (_backToShipFl) { + if (!_shadowFl) { + if (_game._player._playerPos.x < 204) { + _shadowFl = true; + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 4, 1, 0, 0); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 72); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_FRAME_INDEX, 44, 73); + } + } else if (_game._trigger == 73) + _game._player._visible = false; + else if (_game._trigger == 72) + _scene->_sequences.addTimer(24, 74); + else if (_game._trigger == 74) + _scene->_nextSceneId = 102; + } + + if (_game._trigger == 75) { + _game._visitedScenes.pop_back(); + _scene->_nextSceneId = 102; + } +} + +void Scene106::preActions() { + if (_action.isAction(0x15D, 0x12E) || _action.isAction(0x15D, 0x130)) { + _game._player._stepEnabled = false; + _scene->_sprites[_game._player._spritesStart + 1]->_charInfo->_velocity = 24; + _game._player._walkOffScreenSceneId = 104; + } + + if (_action.isAction(0x15D, 0xF3)) + _game._player._walkOffScreenSceneId = 107; +} + +void Scene106::actions() { + if (_action._lookFlag) + _vm->_dialogs->show(0x2976); + else if (_action.isAction(0x15C, 0xD9)) { + _game._player._stepEnabled = false; + _game._player._prepareWalkPos = Common::Point(95, 72); + _game._player._prepareWalkFacing = FACING_WEST; + _game._player._needToWalk = true; + _game._player._readyToWalk = true; + _game._player._frameNumber = 9; + _backToShipFl = true; + } else if (_action.isAction(VERB_LOOK, 0x13) || _action.isAction(0xD1, 0x13)) + _vm->_dialogs->show(0x2969); + else if (_action.isAction(VERB_TAKE, 0x13)) + _vm->_dialogs->show(0x296A); + else if (_action.isAction(VERB_LOOK, 0x12F) || _action.isAction(VERB_LOOK, 0x130)) + _vm->_dialogs->show(0x296B); + else if (_action.isAction(VERB_TAKE, 0x12F) || _action.isAction(VERB_TAKE, 0x130)) + _vm->_dialogs->show(0x296C); + else if (_action.isAction(VERB_LOOK, 0xF3)) + _vm->_dialogs->show(0x296D); + else if (_action.isAction(VERB_LOOK, 0x109) || _action.isAction(0xD1, 0x109)) + _vm->_dialogs->show(0x296E); + else if (_action.isAction(0x109) && (_action.isAction(VERB_PUSH) || _action.isAction(VERB_PULL) || _action.isAction(VERB_TAKE))) + _vm->_dialogs->show(0x296F); + else if (_action.isAction(VERB_LOOK, 0x139) || _action.isAction(0xD1, 0x139)) + _vm->_dialogs->show(0x2970); + else if (_action.isAction(VERB_LOOK, 0xD9)) + _vm->_dialogs->show(0x2971); + else if (_action.isAction(VERB_OPEN, 0xD9)) + _vm->_dialogs->show(0x2972); + else if (_action.isAction(VERB_CLOSE, 0xD9)) + _vm->_dialogs->show(0x2973); + else if (_action.isAction(VERB_LOOK, 0x12E)) + _vm->_dialogs->show(0x2974); + else if (_action.isAction(VERB_LOOK, 0xF0)) + _vm->_dialogs->show(0x2975); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes1.h b/engines/mads/nebular/nebular_scenes1.h index f150e2f135..ef6dc3c504 100644 --- a/engines/mads/nebular/nebular_scenes1.h +++ b/engines/mads/nebular/nebular_scenes1.h @@ -144,6 +144,25 @@ public: virtual void postActions() {}; }; +class Scene106 : public Scene1xx { +private: + bool _backToShipFl; + bool _shadowFl; + bool _firstEmergingFl; + + int _msgPosY; + +public: + Scene106(MADSEngine *vm) : Scene1xx(vm), _backToShipFl(false), _shadowFl(false), _firstEmergingFl(false), _msgPosY(0) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 7a6163584c103985766057a7613e597b0b2debc9 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 13 Apr 2014 23:46:59 +0200 Subject: MADS: Implement scene 107 --- engines/mads/nebular/nebular_scenes.cpp | 2 + engines/mads/nebular/nebular_scenes1.cpp | 112 +++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes1.h | 15 +++++ 3 files changed, 129 insertions(+) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index cd233701c3..64852c60f2 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -59,6 +59,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene105(vm); case 106: return new Scene106(vm); + case 107: + return new Scene107(vm); // Scene group #2 case 201: diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 8871032178..418ed1a52e 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -2059,5 +2059,117 @@ void Scene106::actions() { /*------------------------------------------------------------------------*/ +void Scene107::setup() { + setPlayerSpritesPrefix(); + setAAName(); + + _scene->addActiveVocab(0xDA); +} + +void Scene107::enter() { + for (int i = 0; i < 3; i++) + _globals._spriteIndexes[i + 1] = _scene->_sprites.addSprites(formAnimName('G', i)); + + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(Resources::formatName(105, 'f', 4, EXT_SS, "")); + + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 14, 0, 0, 7); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 17, 0, 0, 13); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 19, 0, 0, 9); + + for (int i = 1; i < 4; i++) + _scene->_sequences.setDepth(_globals._sequenceIndexes[i], 0); + + if (_globals[kFishIn107]) { + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 6, 0, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(68, 151)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 1); + int idx = _scene->_dynamicHotspots.add(101, 348, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(78, 135), FACING_SOUTHWEST); + } + + if (_scene->_priorSceneId == 105) + _game._player._playerPos = Common::Point(132, 47); + else if (_scene->_priorSceneId == 106) + _game._player._playerPos = Common::Point(20, 91); + else if (_scene->_priorSceneId != -2) + _game._player._playerPos = Common::Point(223, 151); + + if (((_scene->_priorSceneId == 105) || (_scene->_priorSceneId == 106)) && (_vm->getRandomNumber(1, 3) == 1)) { + _globals._spriteIndexes[0] = _scene->_sprites.addSprites(Resources::formatName(105, 'R', 1, EXT_SS, "")); + _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], true, 4, 0, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[0], Common::Point(270, 150)); + _scene->_sequences.sub70C52(_globals._sequenceIndexes[0], SM_FRAME_INDEX, -200, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 2); + _scene->_dynamicHotspots.add(218, 348, _globals._sequenceIndexes[0], Common::Rect(0, 0, 0, 0)); + } + + _game.loadQuoteSet(0x4A, 0x4B, 0x4C, 0x35, 0x34, 0); + _shootingFl = false; + + if (_vm->getRandomNumber(1, 3) == 1) { + _scene->loadAnimation(Resources::formatName(107, 'B', -1, EXT_AA, ""), 0); + _shootingFl = true; + } + + sceneEntrySound(); +} + +void Scene107::step() { + if (_shootingFl && (_scene->_activeAnimation->getCurrentFrame() >= 19)) { + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(52)); + _shootingFl = false; + } +} + +void Scene107::preActions() { + if (_action.isAction(0x15D, 0xF6)) + _game._player._walkOffScreenSceneId = 106; + + if (_action.isAction(0x15D, 0xF5)) + _game._player._walkOffScreenSceneId = 108; +} + +void Scene107::actions() { + if (_action._lookFlag) + _vm->_dialogs->show(0x29D4); + else if (_action.isAction(VERB_TAKE, 0x65) && _globals[kFishIn107]) { + if (_game._objects.isInInventory(OBJ_DEAD_FISH)) { + int randVal = _vm->getRandomNumber(74, 76); + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(randVal)); + } else { + _scene->_sequences.remove(_globals._sequenceIndexes[4]); + _game._objects.addToInventory(OBJ_DEAD_FISH); + _globals[kFishIn107] = false; + _vm->_dialogs->showPicture(OBJ_DEAD_FISH, 0x322); + } + } else if (_action.isAction(0x15D, 0xEE)) + _scene->_nextSceneId = 105; + else if (_action.isAction(VERB_LOOK, 0xEE)) + _vm->_dialogs->show(0x29CD); + else if (_action.isAction(VERB_LOOK, 0x65) && (_action._mainObjectSource == 4)) + _vm->_dialogs->show(0x29CE); + else if (_action.isAction(VERB_LOOK, 0x38)) + _vm->_dialogs->show(0x29CF); + else if (_action.isAction(VERB_LOOK, 0x128)) + _vm->_dialogs->show(0x29D0); + else if (_action.isAction(VERB_LOOK, 0x12F)) + _vm->_dialogs->show(0x29D1); + else if (_action.isAction(VERB_LOOK, 0xF5)) + _vm->_dialogs->show(0x29D2); + else if (_action.isAction(VERB_LOOK, 0x4D)) + _vm->_dialogs->show(0x29D3); + else if (_action.isAction(VERB_LOOK, 0xDA)) + _vm->_dialogs->show(0x29D5); + else if (_action.isAction(VERB_TAKE, 0xDA)) + _vm->_dialogs->show(0x29D6); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes1.h b/engines/mads/nebular/nebular_scenes1.h index ef6dc3c504..1aa9f3d86e 100644 --- a/engines/mads/nebular/nebular_scenes1.h +++ b/engines/mads/nebular/nebular_scenes1.h @@ -163,6 +163,21 @@ public: virtual void postActions() {}; }; +class Scene107 : public Scene1xx { +private: + bool _shootingFl; + +public: + Scene107(MADSEngine *vm) : Scene1xx(vm), _shootingFl(false) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 5ee4123947cde518cff48030d889afe188a04f2f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 14 Apr 2014 00:34:56 +0200 Subject: MADS: Implement scene 108 --- engines/mads/nebular/nebular_scenes.cpp | 2 + engines/mads/nebular/nebular_scenes1.cpp | 88 ++++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes1.h | 12 +++++ 3 files changed, 102 insertions(+) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 64852c60f2..55194b73a8 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -61,6 +61,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene106(vm); case 107: return new Scene107(vm); + case 108: + return new Scene108(vm); // Scene group #2 case 201: diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 418ed1a52e..2aeb14d7f2 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -2171,5 +2171,93 @@ void Scene107::actions() { /*------------------------------------------------------------------------*/ +void Scene108::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene108::enter() { + if (_globals[kHoovicSated] == 2) + _globals[kHoovicSated] = 0; + + _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('X', 0)); + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('X', 1)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('X', 2)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('X', 3)); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(Resources::formatName(105, 'f', 4, EXT_SS, "")); + + _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 13, 0, 0, 7); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 16, 0, 0, 9); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 17, 0, 0, 3); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 14, 0, 0, 13); + + for (int i = 0; i <= 3; i++) + _scene->_sequences.setDepth(_globals._sequenceIndexes[i], 0); + + if (_globals[kFishIn108]) { + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 6, 0, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(41, 109)); + int idx = _scene->_dynamicHotspots.add(101, 348, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(41, 109), FACING_NORTHWEST); + } + + if (_scene->_priorSceneId == 107) + _game._player._playerPos = Common::Point(138, 58); + else if (_scene->_priorSceneId != -2) + _game._player._playerPos = Common::Point(305, 98); + + _game.loadQuoteSet(0x4A, 0x4B, 0x4C, 0x35, 0x34, 0); + sceneEntrySound(); +} + +void Scene108::preActions() { + if (_action.isAction(0x15E, 0xFB)) + _game._player._walkOffScreenSceneId = 109; +} + +void Scene108::actions() { + if (_action._lookFlag) + _vm->_dialogs->show(0x2A3C); + else if (_action.isAction(VERB_TAKE, 0x65) && _globals[kFishIn108]) { + if (_game._objects.isInInventory(OBJ_DEAD_FISH)) { + int randVal = _vm->getRandomNumber(74, 76); + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(randVal)); + } else { + _scene->_sequences.remove(_globals._sequenceIndexes[4]); + _game._objects.addToInventory(OBJ_DEAD_FISH); + _globals[kFishIn108] = false; + _vm->_dialogs->showPicture(OBJ_DEAD_FISH, 0x2A38); + } + } else if (_action.isAction(0x15D, 0xF4)) + _scene->_nextSceneId = 107; + else if (_action.isAction(VERB_LOOK, 0x4D)) + _vm->_dialogs->show(0x2A31); + else if (_action.isAction(VERB_LOOK, 0xF0)) + _vm->_dialogs->show(0x2A32); + else if (_action.isAction(VERB_LOOK, 0xF1)) + _vm->_dialogs->show(0x2A33); + else if (_action.isAction(VERB_TAKE, 0xF1)) + _vm->_dialogs->show(0x2A34); + else if (_action.isAction(VERB_LOOK, 0x129)) + _vm->_dialogs->show(0x2A35); + else if (_action.isAction(VERB_TAKE, 0x129)) + _vm->_dialogs->show(0x2A36); + else if (_action.isAction(VERB_LOOK, 0x65)) + _vm->_dialogs->show(0x2A37); + else if (_action.isAction(VERB_LOOK, 0xFB)) + _vm->_dialogs->show(0x2A39); + else if (_action.isAction(VERB_LOOK, 0xF4)) + _vm->_dialogs->show(0x2A3A); + else if (_action.isAction(VERB_LOOK, 0x158)) + _vm->_dialogs->show(0x2A3B); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes1.h b/engines/mads/nebular/nebular_scenes1.h index 1aa9f3d86e..6d28252dc9 100644 --- a/engines/mads/nebular/nebular_scenes1.h +++ b/engines/mads/nebular/nebular_scenes1.h @@ -178,6 +178,18 @@ public: virtual void postActions() {}; }; +class Scene108 : public Scene1xx { +public: + Scene108(MADSEngine *vm) : Scene1xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step() {}; + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 3e1bbb724d271623ceb55a3b56d42e80ca2087f2 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 14 Apr 2014 21:52:31 +0200 Subject: MADS: Fix a big in scene 102, implement scene 109 --- engines/mads/messages.h | 2 +- engines/mads/nebular/nebular_scenes.cpp | 2 + engines/mads/nebular/nebular_scenes1.cpp | 413 ++++++++++++++++++++++++++++++- engines/mads/nebular/nebular_scenes1.h | 22 ++ 4 files changed, 432 insertions(+), 7 deletions(-) diff --git a/engines/mads/messages.h b/engines/mads/messages.h index 4778efdffd..7aabf918ff 100644 --- a/engines/mads/messages.h +++ b/engines/mads/messages.h @@ -67,8 +67,8 @@ public: class KernelMessages { private: MADSEngine *_vm; - Common::Array _entries; public: + Common::Array _entries; Font *_talkFont; KernelMessages(MADSEngine *vm); ~KernelMessages(); diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 55194b73a8..50c4b9449a 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -63,6 +63,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene107(vm); case 108: return new Scene108(vm); + case 109: + return new Scene109(vm); // Scene group #2 case 201: diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 2aeb14d7f2..5e2ed3de16 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -631,10 +631,10 @@ void Scene102::enter() { _globals._spriteIndexes[11] = _scene->_sprites.addSprites("*RXMRC_8"); _globals._spriteIndexes[13] = _scene->_sprites.addSprites(formAnimName('x', 0)); - _globals._spriteIndexes[15+1] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 8, 0, 0, 0); - _globals._spriteIndexes[15+2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 170, 0, 1, 6); - _globals._spriteIndexes[15+3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 11, 0, 2, 3); - _globals._spriteIndexes[15+4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 4, 0, 1, 0); + _globals._sequenceIndexes[1] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 8, 0, 0, 0); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 170, 0, 1, 6); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 11, 0, 2, 3); + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 4, 0, 1, 0); _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 3, 0, 0, 5); if (!_game._objects.isInRoom(OBJ_BINOCULARS)) @@ -1128,7 +1128,7 @@ void Scene102::actions() { case 1: _game._objects.addToInventory(OBJ_BINOCULARS); - _scene->_sequences.remove(_globals._spriteIndexes[15+9]); + _scene->_sequences.remove(_globals._sequenceIndexes[9]); _scene->_hotspots.activate(0x27, false); _game._player._visible = true; _game._player._stepEnabled = true; @@ -1819,7 +1819,7 @@ void Scene105::actions() { _scene->_kernelMessages.reset(); _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(randVal)); } else { - _scene->_sequences.remove (_globals._sequenceIndexes[4]); + _scene->_sequences.remove(_globals._sequenceIndexes[4]); _game._objects.addToInventory(OBJ_DEAD_FISH); _globals[kFishIn105] = false; _vm->_dialogs->showPicture(OBJ_DEAD_FISH, 0x322, 0); @@ -2257,6 +2257,407 @@ void Scene108::actions() { _action._inProgress = false; } +/*------------------------------------------------------------------------*/ +Scene109::Scene109(MADSEngine *vm) : Scene1xx(vm) { + _rexThrowingObject = false; + _hoovicDifficultFl = false; + _beforeEatingRex = false; + _eatingRex = false; + _hungryFl = false; + _eatingFirstFish = false; + + _throwingObjectId = -1; + _hoovicTrigger = 0; +} + +void Scene109::setup() { + _scene->addActiveVocab(0x66); + _scene->addActiveVocab(0xE5); + + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene109::enter() { + _globals[kFishIn105] = true; + + _globals._spriteIndexes[0] = _scene->_sprites.addSprites("*RXSWRC_6"); + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('O', 1)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('O', 2)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('O', 0)); + _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('H', 4)); + + _rexThrowingObject = false; + _throwingObjectId = 0; + _beforeEatingRex = false; + _eatingRex = false; + _hungryFl = false; + + if (_scene->_priorSceneId == 110) { + _game._player._playerPos = Common::Point(248, 38); + _globals[kHoovicSated] = 2; + } else if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(20, 68); + _game._player._facing = FACING_EAST; + } + + if (!_globals[kHoovicAlive]) { + _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 4); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[6], -2, -2); + + int idx = _scene->_dynamicHotspots.add(102, 348, -1, Common::Rect(256, 57, 267, 87)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(241, 91), FACING_NORTHEAST); + idx = _scene->_dynamicHotspots.add(102, 348, -1, Common::Rect(242, 79, 265, 90)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(241, 91), FACING_NORTHEAST); + idx = _scene->_dynamicHotspots.add(229, 348, -1, Common::Rect(231, 88, 253, 94)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(241, 91), FACING_NORTHEAST); + } + + if (!_globals[kHoovicAlive] || _globals[kHoovicSated]) + _scene->changeVariant(1); + + if (_game._objects.isInRoom(OBJ_BURGER)) { + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 6, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], -2, -2); + int idx = _scene->_dynamicHotspots.add(53, 348, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(-3, 0), FACING_NORTHEAST); + } else if (_scene->_roomChanged) + _game._objects.addToInventory(OBJ_BURGER); + + if (_scene->_roomChanged) { + _game._objects.addToInventory(OBJ_DEAD_FISH); + _game._objects.addToInventory(OBJ_STUFFED_FISH); + } + + _vm->_palette->setEntry(252, 50, 50, 63); + _vm->_palette->setEntry(253, 30, 30, 50); + + _game.loadQuoteSet(0x53, 0x52, 0x54, 0x55, 0x56, 0x57, 0x58, 0); + _eatingFirstFish = (!_game._visitedScenes._sceneRevisited) && (_scene->_priorSceneId < 110); + + if (_eatingFirstFish) { + _globals._spriteIndexes[10] = _scene->_sprites.addSprites(Resources::formatName(105, 'F', 1, EXT_SS, "")); + _globals._spriteIndexes[9] = _scene->_sprites.addSprites(formAnimName('H', 1)); + + _globals._sequenceIndexes[10] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[10], true, 4, 0, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 5); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[10], Common::Point(126, 39)); + _scene->_sequences.sub70C52(_globals._sequenceIndexes[10], 0, 200, 0); + _scene->_sequences.setScale(_globals._sequenceIndexes[10], 80); + _game._player._stepEnabled = false; + } + + sceneEntrySound(); +} + +void Scene109::step() { + if (_beforeEatingRex) { + if (!_eatingRex) { + if (_game._player._playerPos.x > 205) { + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 4); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SM_FRAME_INDEX, 6, 70); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SM_0, 0, 71); + + _eatingRex = true; + _vm->_sound->command(34); + } + } else { + switch (_game._trigger) { + case 70: + _game._player._visible = false; + break; + + case 71: + _scene->_reloadSceneFlag = true; + break; + } + } + } + + if (_hungryFl && (_game._player._playerPos == Common::Point(160, 32)) && (_game._player._facing == FACING_EAST)) { + _game._player.walk(Common::Point(226, 24), FACING_EAST); + _game._player._stepEnabled = false; + _hungryFl = false; + _beforeEatingRex = true; + _scene->_sprites.remove(_globals._spriteIndexes[6]); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('H', 0)); + _vm->_palette->refreshHighColors(); + } + + if (_game._player._moving && (_scene->_rails.getNext() > 0) && _globals[kHoovicAlive] && !_globals[kHoovicSated] && !_hungryFl && !_beforeEatingRex) { + _game._player.cancelCommand(); + _game._player.startWalking(Common::Point(160, 32), FACING_EAST); + _scene->_rails.resetNext(); + _hungryFl = true; + } + + if (_eatingFirstFish && (_scene->_sequences[_globals._sequenceIndexes[10]]._msgPos.x >= 178)) { + _globals._sequenceIndexes[9] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 4, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 4); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SM_FRAME_INDEX, 29, 72); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SM_0, 29, 73); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[10], _globals._sequenceIndexes[9]); + _eatingFirstFish = false; + _game._player._stepEnabled = true; + _vm->_sound->command(34); + } + + if (_game._trigger == 72) + _scene->_sequences.remove(_globals._sequenceIndexes[10]); + + if (_game._trigger == 73) { + _scene->_sequences.remove(_globals._sequenceIndexes[9]); + _scene->_sprites.remove(_globals._spriteIndexes[9]); + _scene->_sprites.remove(_globals._spriteIndexes[10]); + + _scene->_spriteSlots.clear(); + _scene->_spriteSlots.fullRefresh(); + + int randVal = _vm->getRandomNumber(85, 88); + int idx = _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(randVal)); + _scene->_kernelMessages.setQuoted(idx, 4, true); + _scene->_kernelMessages._entries[idx]._frameTimer = _scene->_frameStartTime + 4; + } +} + +void Scene109::preActions() { + if (_action.isAction(0x15E, 0xFC)) + _game._player._walkOffScreenSceneId = 108; + + if ((_action.isAction(VERB_THROW) || _action.isAction(VERB_GIVE) || _action.isAction(VERB_PUT)) + && (_action.isAction(0x146) || _action.isAction(0x178)) + && (_action.isAction(0x65) || _action.isAction(0x157) || _action.isAction(0x35))) { + int idx = _game._objects.getIdFromDesc(_action._activeAction._objectNameId); + if ((idx >= 0) && _game._objects.isInInventory(idx)) { + _game._player._prepareWalkPos = Common::Point(106, 38); + _game._player._prepareWalkFacing = FACING_EAST; + _game._player._needToWalk = true; + _game._player._readyToWalk = true; + } + } + + if ((_action.isAction(0x15A, 0x178) || _action.isAction(0x15C, 0x146)) + && (!_globals[kHoovicAlive] || _globals[kHoovicSated]) && (_action.isAction(0x178))) + _game._player._walkOffScreenSceneId = 110; + + _hungryFl = false; +} + +void Scene109::actions() { + if (_action._lookFlag) { + _vm->_dialogs->show(0x2AA0); + _action._inProgress = false; + return; + } + + if ((_action.isAction(VERB_THROW) || _action.isAction(VERB_GIVE)) && ((_action.isAction(0x146) || _action.isAction(0x178)))) { + if (_action.isAction(0x65) || _action.isAction(0x157) || _action.isAction(0x35)) { + _throwingObjectId = _game._objects.getIdFromDesc(_action._activeAction._objectNameId); + if (_throwingObjectId >= 0) { + if ((_game._objects.isInInventory(_throwingObjectId) && _globals[kHoovicAlive]) || _rexThrowingObject) { + switch (_game._trigger) { + case 0: + _rexThrowingObject = true; + _hoovicDifficultFl = false; + _game._objects.setRoom(_throwingObjectId, NOWHERE); + _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 4, 1, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[0]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SM_0, 0, 1); + _game._player._visible = false; + _game._player._stepEnabled = false; + + switch (_throwingObjectId) { + case OBJ_DEAD_FISH: + case OBJ_STUFFED_FISH: + _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('H', 1)); + break; + + case OBJ_BURGER: + _hoovicDifficultFl = (_game._difficulty == DIFFICULTY_IMPOSSIBLE); + _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('H', (_hoovicDifficultFl ? 3 : 1))); + break; + } + + _vm->_palette->refreshHighColors(); + break; + + case 1: + _game._player._visible = true; + _hoovicTrigger = 4; + switch (_throwingObjectId) { + case OBJ_BURGER: + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, (_hoovicDifficultFl ? 4 : 6), 1, 0, 0); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_FRAME_INDEX, 2, 2); + if (_hoovicDifficultFl) { + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 30); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 5); + } else { + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 4); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 8); + _hoovicTrigger = 3; + } + break; + case OBJ_DEAD_FISH: + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 4, 1, 0, 0); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SM_FRAME_INDEX, 2, 2); + break; + case OBJ_STUFFED_FISH: + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 4, 1, 0, 0); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SM_FRAME_INDEX, 2, 2); + _hoovicTrigger = 3; + break; + } + break; + + case 2: + if (_hoovicDifficultFl) + _globals._sequenceIndexes[8] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[8], false, 4, 2, 0, 0); + else + _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 4, 1, 0, 0); + + _scene->_sequences.setDepth(_globals._sequenceIndexes[8], 4); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SM_0, 0, _hoovicTrigger); + _vm->_sound->command(34); + break; + + case 3: + _scene->loadAnimation(Resources::formatName(109, 'H', 2, EXT_AA, ""), 4); + _vm->_sound->command(35); + _globals[kHoovicAlive] = false; + break; + + case 4: + if (!_globals[kHoovicAlive]) { + _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 4); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[6], -2, -2); + int idx = _scene->_dynamicHotspots.add(102, 348, -1, Common::Rect(256, 57, 12, 31)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(241, 91), FACING_NORTHEAST); + idx = _scene->_dynamicHotspots.add(102, 348, -1, Common::Rect(242, 79, 24, 12)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(241, 91), FACING_NORTHEAST); + idx = _scene->_dynamicHotspots.add(229, 348, -1, Common::Rect(231, 88, 23, 7)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(241, 91), FACING_NORTHEAST); + _scene->changeVariant(1); + } else { + if (_throwingObjectId == OBJ_DEAD_FISH) { + ++_globals[kHoovicFishEaten]; + int threshold; + switch (_game._difficulty) { + case DIFFICULTY_HARD: + threshold = 1; + break; + case DIFFICULTY_REALLY_HARD: + threshold = 3; + break; + default: + threshold = 50; + break; + } + + if (_globals[kHoovicFishEaten] >= threshold) { + int randVal = _vm->getRandomNumber(83, 84); + _scene->_kernelMessages.add(Common::Point(230, 24), 0xFDFC, 0, 0, 120, _game.getQuote(randVal)); + _globals[kHoovicFishEaten] = 0; + _globals[kHoovicSated] = 1; + _scene->changeVariant(1); + } + } + } + _scene->_activeAnimation->free(); + _scene->_sequences.remove(_globals._sequenceIndexes[8]); + _scene->_sprites.remove(_globals._spriteIndexes[8]); + _scene->_spriteSlots.clear(); + _scene->_spriteSlots.fullRefresh(); + _scene->_sequences.scan(); + if (_game._player._visible) { + _game._player._spritesChanged = true; + _game._player.update(); + } + + _game._player._stepEnabled = true; + _rexThrowingObject = false; + break; + + case 5: { + _game._objects.setRoom(OBJ_BURGER, _scene->_currentSceneId); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 6, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 30, 30); + int idx = _scene->_dynamicHotspots.add(53, 348, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(-3, 0), FACING_NORTHEAST); + _scene->_sequences.addTimer(65, 6); + } + break; + + case 6: { + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 6, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 31, 46); + int idx = _scene->_dynamicHotspots.add(53, 348, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(-3, 0), FACING_NORTHEAST); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 7); + } + break; + + case 7: { + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -2); + int idx = _scene->_dynamicHotspots.add(53, 348, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(-3, 0), FACING_NORTHEAST); + _vm->_dialogs->show(0x2AA3); + } + break; + + case 8: + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 7, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 5, 16); + break; + } + _action._inProgress = false; + return; + } else if (_game._objects.isInInventory(_throwingObjectId)) { + // Nothing. + } + } + } + } + + if (_action.isAction(VERB_TAKE, 0x35) && _game._objects.isInRoom(OBJ_BURGER)) { + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _game._objects.addToInventory(OBJ_BURGER); + } else if (_action.isAction(VERB_LOOK, 0xF0)) + _vm->_dialogs->show(0x2A95); + else if (_action.isAction(VERB_LOOK, 0x5A)) + _vm->_dialogs->show(0x2A96); + else if ((_action.isAction(VERB_TAKE) || _action.isAction(VERB_PULL)) && _action.isAction(0x5A)) + _vm->_dialogs->show(0x2A97); + else if (_action.isAction(VERB_LOOK, 0x129)) + _vm->_dialogs->show(0x2A98); + else if (_action.isAction(VERB_TAKE, 0x129)) + _vm->_dialogs->show(0x2A99); + else if (_action.isAction(VERB_LOOK, 0x45)) + _vm->_dialogs->show(0x2A9A); + else if (_action.isAction(VERB_LOOK, 0x178)) { + if (_globals[kHoovicAlive]) + _vm->_dialogs->show(0x2A9B); + else + _vm->_dialogs->show(0x2AA1); + } else if (_action.isAction(VERB_LOOK, 0x146)) + _vm->_dialogs->show(0x2A9C); + else if (_action.isAction(VERB_LOOK, 0xFC)) + _vm->_dialogs->show(0x2A9F); + else if (_action.isAction(VERB_PUT, 0x146)) + _vm->_dialogs->show(0x2A9E); + else if (_action.isAction(VERB_LOOK, 0x66)) + _vm->_dialogs->show(0x2AA2); + else + return; + + _action._inProgress = false; +} + + /*------------------------------------------------------------------------*/ } // End of namespace Nebular diff --git a/engines/mads/nebular/nebular_scenes1.h b/engines/mads/nebular/nebular_scenes1.h index 6d28252dc9..267234c7d1 100644 --- a/engines/mads/nebular/nebular_scenes1.h +++ b/engines/mads/nebular/nebular_scenes1.h @@ -190,6 +190,28 @@ public: virtual void postActions() {}; }; +class Scene109 : public Scene1xx { +private: + bool _rexThrowingObject; + bool _hoovicDifficultFl; + bool _beforeEatingRex; + bool _eatingRex; + bool _hungryFl; + bool _eatingFirstFish; + + int _throwingObjectId; + int _hoovicTrigger; + +public: + Scene109(MADSEngine *vm); + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 848c94cd0e86bd9f170da7b06371fb0a12d7bb07 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 14 Apr 2014 21:33:58 -0400 Subject: MADS: Fix for sprite refreshes when doing player cutscenes --- engines/mads/sprites.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp index 83f01430eb..cd838f7dfb 100644 --- a/engines/mads/sprites.cpp +++ b/engines/mads/sprites.cpp @@ -212,8 +212,9 @@ void SpriteSlots::fullRefresh(bool clearAll) { void SpriteSlots::deleteTimer(int seqIndex) { for (uint idx = 0; idx < size(); ++idx) { - if ((*this)[idx]._seqIndex == seqIndex) { - remove_at(idx); + SpriteSlot &slot = (*this)[idx]; + if (slot._seqIndex == seqIndex) { + slot._flags = IMG_ERASE; return; } } -- cgit v1.2.3 From 9643b543f088449bc6728c5a884087789aa4c5c7 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 15 Apr 2014 07:45:35 +0200 Subject: MADS: Implement scene 110 --- engines/mads/animation.cpp | 4 + engines/mads/animation.h | 1 + engines/mads/nebular/nebular_scenes.cpp | 2 + engines/mads/nebular/nebular_scenes1.cpp | 123 +++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes1.h | 16 ++++ 5 files changed, 146 insertions(+) diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index 380770fd8f..06eeaf8278 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -609,4 +609,8 @@ void Animation::setCurrentFrame(int frameNumber) { _nextScrollTimer = _nextFrameTimer = _vm->_game->_scene._frameStartTime; } +void Animation::setNextFrameTimer(int frameNumber) { + _nextFrameTimer = frameNumber; +} + } // End of namespace MADS diff --git a/engines/mads/animation.h b/engines/mads/animation.h index 75f14a52b3..3b0341780c 100644 --- a/engines/mads/animation.h +++ b/engines/mads/animation.h @@ -213,6 +213,7 @@ public: */ void update(); + void setNextFrameTimer(int frameNumber); void setCurrentFrame(int frameNumber); int getCurrentFrame() const { return _currentFrame; } diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 50c4b9449a..3ad856bdf8 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -65,6 +65,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene108(vm); case 109: return new Scene109(vm); + case 110: + return new Scene110(vm); // Scene group #2 case 201: diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 5e2ed3de16..37c993ebe7 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -2658,6 +2658,129 @@ void Scene109::actions() { } +/*------------------------------------------------------------------------*/ + +void Scene110::setup() { + setPlayerSpritesPrefix(); + setAAName(); + + _scene->addActiveVocab(0x5B); +} + +void Scene110::enter() { + _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('X', 0)); + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('X', 1)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('X', 2)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('X', 3)); + + crabs_here = false; + + if (_scene->_priorSceneId == 109) { + _game._player._playerPos = Common::Point(59, 71); + + _globals._sequenceIndexes[0] = _scene->_sequences.startCycle(_globals._spriteIndexes[0], false, 1); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 1); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); + + crabs_here = true; + + int idx = _scene->_dynamicHotspots.add(91, 348, _globals._sequenceIndexes[0], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(-1, 0), FACING_NONE); + idx = _scene->_dynamicHotspots.add(91, 348, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(-1, 0), FACING_NONE); + idx = _scene->_dynamicHotspots.add(91, 348, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(-1, 0), FACING_NONE); + idx = _scene->_dynamicHotspots.add(91, 348, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(-1, 0), FACING_NONE); + } else if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(194, 23); + _game._player._facing = FACING_SOUTH; + _game._player._visible = false; + _game._player._stepEnabled = false; + _scene->loadAnimation(Resources::formatName(110, 'T', 1,EXT_AA, ""), 70); + } + + sceneEntrySound(); + _game.loadQuoteSet(0x59, 0); + + if (!_game._visitedScenes._sceneRevisited && (_scene->_priorSceneId == 109)) + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(109)); +} + +void Scene110::step() { + if (_game._trigger == 70) { + _game._player._visible = true; + _game._player._stepEnabled = true; + } +} + +void Scene110::preActions() { + if (_action.isAction(0x15B, 0x41)) + _game._player._walkOffScreenSceneId = 109; + + if (crabs_here) { + crabs_here = false; + + _scene->_sequences.remove(_globals._sequenceIndexes[0]); + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + + _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 16, 1, 0, 0); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 16, 1, 0, 0); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 16, 1, 0, 0); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 16, 1, 0, 0); + + int idx = _scene->_dynamicHotspots.add(91, 348, _globals._sequenceIndexes[0], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(-1, 0), FACING_NONE); + idx = _scene->_dynamicHotspots.add(91, 348, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(-1, 0), FACING_NONE); + idx = _scene->_dynamicHotspots.add(91, 348, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(-1, 0), FACING_NONE); + idx = _scene->_dynamicHotspots.add(91, 348, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(-1, 0), FACING_NONE); + } +} + +void Scene110::actions() { + if (_action.isAction(0x15B, 0x178)) { + switch (_game._trigger) { + case 0: + _scene->loadAnimation(Resources::formatName(110, 'T', 0, EXT_AA, ""), 1); + _scene->_activeAnimation->setNextFrameTimer(_game._player._ticksAmount + _game._player._priorTimer); + _game._player._stepEnabled = false; + _game._player._visible = false; + break; + case 1: + _game._player._visible = true; + _game._player._stepEnabled = true; + _scene->_nextSceneId = 111; + break; + } + } else if ((_action._lookFlag) || _action.isAction(VERB_LOOK, 0x3F)) + _vm->_dialogs->show(0x2AF9); + else if (_action.isAction(VERB_LOOK, 0x40) || _action.isAction(0xD1, 0x40)) + _vm->_dialogs->show(0x2AFA); + else if (_action.isAction(VERB_LOOK, 0x129)) + _vm->_dialogs->show(0x2AFB); + else if (_action.isAction(VERB_TAKE, 0x129)) + _vm->_dialogs->show(0x2AFC); + else if (_action.isAction(VERB_LOOK, 0x178)) + _vm->_dialogs->show(0x2AFD); + else if (_action.isAction(VERB_LOOK, 0x41)) + _vm->_dialogs->show(0x2AFE); + else if (_action.isAction(VERB_LOOK, 0x8F)) + _vm->_dialogs->show(0x2AFF); + else if (_action.isAction(VERB_TAKE, 0x8F)) + _vm->_dialogs->show(0x2B00); + else + return; + + _action._inProgress = false; +} + + /*------------------------------------------------------------------------*/ } // End of namespace Nebular diff --git a/engines/mads/nebular/nebular_scenes1.h b/engines/mads/nebular/nebular_scenes1.h index 267234c7d1..d4f69c321e 100644 --- a/engines/mads/nebular/nebular_scenes1.h +++ b/engines/mads/nebular/nebular_scenes1.h @@ -212,6 +212,22 @@ public: virtual void actions(); virtual void postActions() {}; }; + +class Scene110 : public Scene1xx { +private: + int crabs_here; /* Flag if crabs are here */ + +public: + Scene110(MADSEngine *vm) : Scene1xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 968a8e16a4317d28fc85d4607e7e7627693992dc Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 15 Apr 2014 07:45:35 +0200 Subject: MADS: Implement scene 110 --- engines/mads/nebular/nebular_scenes1.cpp | 8 ++++---- engines/mads/nebular/nebular_scenes1.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 37c993ebe7..7b6f812eb7 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -2673,7 +2673,7 @@ void Scene110::enter() { _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('X', 2)); _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('X', 3)); - crabs_here = false; + _crabsFl = false; if (_scene->_priorSceneId == 109) { _game._player._playerPos = Common::Point(59, 71); @@ -2683,7 +2683,7 @@ void Scene110::enter() { _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 1); _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); - crabs_here = true; + _crabsFl = true; int idx = _scene->_dynamicHotspots.add(91, 348, _globals._sequenceIndexes[0], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(-1, 0), FACING_NONE); @@ -2719,8 +2719,8 @@ void Scene110::preActions() { if (_action.isAction(0x15B, 0x41)) _game._player._walkOffScreenSceneId = 109; - if (crabs_here) { - crabs_here = false; + if (_crabsFl) { + _crabsFl = false; _scene->_sequences.remove(_globals._sequenceIndexes[0]); _scene->_sequences.remove(_globals._sequenceIndexes[1]); diff --git a/engines/mads/nebular/nebular_scenes1.h b/engines/mads/nebular/nebular_scenes1.h index d4f69c321e..b1fb7d1af4 100644 --- a/engines/mads/nebular/nebular_scenes1.h +++ b/engines/mads/nebular/nebular_scenes1.h @@ -215,7 +215,7 @@ public: class Scene110 : public Scene1xx { private: - int crabs_here; /* Flag if crabs are here */ + bool _crabsFl; public: Scene110(MADSEngine *vm) : Scene1xx(vm) {} -- cgit v1.2.3 From eb1f885c42d7ef26ea8c39e67fcc8844b66ca544 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 15 Apr 2014 08:40:40 +0200 Subject: MADS: Implement scene 111 --- engines/mads/nebular/nebular_scenes.cpp | 2 + engines/mads/nebular/nebular_scenes1.cpp | 141 +++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes1.h | 20 ++++- 3 files changed, 162 insertions(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 3ad856bdf8..8b18fad294 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -67,6 +67,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene109(vm); case 110: return new Scene110(vm); + case 111: + return new Scene111(vm); // Scene group #2 case 201: diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 7b6f812eb7..4cb6b8c67e 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -2780,6 +2780,147 @@ void Scene110::actions() { _action._inProgress = false; } +/*------------------------------------------------------------------------*/ + +void Scene111::setup() { + _scene->addActiveVocab(0x1F); + + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene111::enter() { + _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('X', 0)); + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('X', 1)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('X', 2)); + + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('B', 0)); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('B', 1)); + _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('B', 2)); + + _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 8, 0, 0, 0); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SM_FRAME_INDEX, 9, 73); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SM_FRAME_INDEX, 13, 73); + + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 5, 0, 0, 0); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SM_FRAME_INDEX, 71, 71); + + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 12, 0, 0, 0); + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); + _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 1); + + int idx = _scene->_dynamicHotspots.add(0x1F, 0xD1, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(-2, 0), FACING_NONE); + idx = _scene->_dynamicHotspots.add(0x1F, 0xD1, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(-2, 0), FACING_NONE); + idx = _scene->_dynamicHotspots.add(0x1F, 0xD1, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(-2, 0), FACING_NONE); + + _launch1Fl = false; + _launched2Fl = false; + _stampedFl = false; + + if ((_scene->_priorSceneId < 201) && (_scene->_priorSceneId != -2)) { + _game._player._stepEnabled = false; + _game._player._visible = false; + _scene->loadAnimation(Resources::formatName(111, 'A', 0, EXT_AA, ""), 70); + _game._player._playerPos = Common::Point(234, 116); + _game._player._facing = FACING_EAST; + + _launch1Fl = true; + _launched2Fl = true; + + _vm->_sound->command(36); + } else if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(300, 130); + _game._player._facing = FACING_WEST; + } + + _rexDivingFl = false; + + sceneEntrySound(); +} + +void Scene111::step() { + if (_game._trigger == 70) { + _game._player._stepEnabled = true; + _game._player._visible = true; + _launch1Fl = false; + _launched2Fl = false; + } + + if ((_game._trigger == 71) && !_stampedFl) { + _stampedFl = true; + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 18, 1, 0, 0); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SM_0, 0, 72); + } + + if (_game._trigger == 72) { + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 20); + } + + if (!_launch1Fl && (_vm->getRandomNumber(1, 5000) == 1)) { + _scene->_sequences.remove(_globals._sequenceIndexes[4]); + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 5, 1, 0, 0); + _launch1Fl = true; + int idx = _scene->_dynamicHotspots.add(0x1F, 0xD1, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(-2, 0), FACING_NONE); + } + + if (!_launched2Fl && (_vm->getRandomNumber(1, 30000) == 1)) { + _scene->_sequences.remove(_globals._sequenceIndexes[5]); + _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 5, 1, 0, 0); + int idx = _scene->_dynamicHotspots.add(0x1F, 0xD1, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(-2, 0), FACING_NONE); + _launched2Fl = true; + } + + if (_game._trigger == 73) + _vm->_sound->command(37); + + if (_rexDivingFl && (_scene->_activeAnimation->getCurrentFrame() >= 9)) { + _vm->_sound->command(36); + _rexDivingFl = false; + } +} + +void Scene111::preActions() { + if (_action.isAction(0x18B, 0x41)) + _game._player._walkOffScreenSceneId = 212; +} + +void Scene111::actions() { + if (_action.isAction(0x6D, 0x116) && _game._objects.isInInventory(OBJ_REBREATHER)) { + switch (_game._trigger) { + case 0: + _scene->loadAnimation(Resources::formatName(111, 'A', 1, EXT_AA, ""), 1); + _rexDivingFl = true; + _game._player._stepEnabled = false; + _game._player._visible = false; + break; + + case 1: + _scene->_nextSceneId = 110; + break; + } + } else if (_action.isAction(VERB_LOOK, 0x43)) + _vm->_dialogs->show(0x2B5D); + else if (_action.isAction(VERB_LOOK, 0x116)) + _vm->_dialogs->show(0x2B5E); + else if (_action.isAction(VERB_LOOK, 0x41)) + _vm->_dialogs->show(0x2B5F); + else if (_action.isAction(VERB_LOOK, 0x153)) + _vm->_dialogs->show(0x2B60); + else if (_action.isAction(VERB_LOOK, 0xC8)) + _vm->_dialogs->show(0x2B61); + else if ((_action.isAction(VERB_PULL) || _action.isAction(VERB_TAKE)) && (_action.isAction(0x153) || _action.isAction(0xC8))) + _vm->_dialogs->show(0x2B62); + else + return; + + _action._inProgress = false; +} /*------------------------------------------------------------------------*/ diff --git a/engines/mads/nebular/nebular_scenes1.h b/engines/mads/nebular/nebular_scenes1.h index b1fb7d1af4..a2637b57e0 100644 --- a/engines/mads/nebular/nebular_scenes1.h +++ b/engines/mads/nebular/nebular_scenes1.h @@ -218,7 +218,25 @@ private: bool _crabsFl; public: - Scene110(MADSEngine *vm) : Scene1xx(vm) {} + Scene110(MADSEngine *vm) : Scene1xx(vm), _crabsFl(false) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; + +class Scene111 : public Scene1xx { +private: + bool _stampedFl; + bool _launch1Fl; + bool _launched2Fl; + bool _rexDivingFl; + +public: + Scene111(MADSEngine *vm) : Scene1xx(vm), _stampedFl(false), _launch1Fl(false), _launched2Fl(false), _rexDivingFl(false) {} virtual void setup(); virtual void enter(); -- cgit v1.2.3 From 52ba3b408362970b1764e569ddd8a01a66bb495b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 15 Apr 2014 17:43:35 +0200 Subject: MADS: Implement scene 112 --- engines/mads/nebular/nebular_scenes.cpp | 2 ++ engines/mads/nebular/nebular_scenes1.cpp | 55 ++++++++++++++++++++++++++++++-- engines/mads/nebular/nebular_scenes1.h | 12 +++++++ 3 files changed, 66 insertions(+), 3 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 8b18fad294..a3b75c6098 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -69,6 +69,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene110(vm); case 111: return new Scene111(vm); + case 112: + return new Scene112(vm); // Scene group #2 case 201: diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 4cb6b8c67e..63f7f631ea 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -2822,7 +2822,7 @@ void Scene111::enter() { if ((_scene->_priorSceneId < 201) && (_scene->_priorSceneId != -2)) { _game._player._stepEnabled = false; - _game._player._visible = false; + _game._player._visible = false; _scene->loadAnimation(Resources::formatName(111, 'A', 0, EXT_AA, ""), 70); _game._player._playerPos = Common::Point(234, 116); _game._player._facing = FACING_EAST; @@ -2895,9 +2895,9 @@ void Scene111::actions() { switch (_game._trigger) { case 0: _scene->loadAnimation(Resources::formatName(111, 'A', 1, EXT_AA, ""), 1); - _rexDivingFl = true; + _rexDivingFl = true; _game._player._stepEnabled = false; - _game._player._visible = false; + _game._player._visible = false; break; case 1: @@ -2924,5 +2924,54 @@ void Scene111::actions() { /*------------------------------------------------------------------------*/ +void Scene112::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene112::enter() { + sceneEntrySound(); + + _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('X', 0)); + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('X', 1)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('X', 2)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('X', 5)); + + _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 10, 0, 17, 20); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 4, 0, 0, 0); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 6, 0, 3, 0); + + _game._player._stepEnabled = false; + _game._player._visible = false; + + _scene->_userInterface.emptyTalkList(); + _scene->_userInterface.setup(kInputConversation); + + _scene->loadAnimation(Resources::formatName(112, 'X', -1, EXT_AA, ""), 70); +} + +void Scene112::step() { + if ((_scene->_activeAnimation != nullptr) && (_game._storyMode == STORYMODE_NICE)) { + if (_scene->_activeAnimation->getCurrentFrame() >= 54) { + _scene->_activeAnimation->free(); + _game._trigger = 70; + } + } + + if (_game._trigger == 70) { + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 7, 3, 0, 11); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 71); + } + + if (_game._trigger == 71) { + _scene->_nextSceneId = 101; + _game._player._stepEnabled = true; + _game._player._visible = true; + } +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes1.h b/engines/mads/nebular/nebular_scenes1.h index a2637b57e0..b4585b0ed3 100644 --- a/engines/mads/nebular/nebular_scenes1.h +++ b/engines/mads/nebular/nebular_scenes1.h @@ -246,6 +246,18 @@ public: virtual void postActions() {}; }; +class Scene112 : public Scene1xx { +public: + Scene112(MADSEngine *vm) : Scene1xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions() {}; + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 27a2ead1541fb6247b578c03fbb6265e8feb32dd Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 15 Apr 2014 17:52:42 +0200 Subject: MADS: Fix several Rects in scene 101 and 109 --- engines/mads/nebular/nebular_scenes1.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 63f7f631ea..9ae9a46eb5 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -177,7 +177,7 @@ void Scene101::enter() { _globals._sequenceIndexes[11] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[11], false, 3, 0, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[11], 17, 17); _scene->_hotspots.activate(0x47, false); - _chairHotspotId = _scene->_dynamicHotspots.add(0x47, 0x13F, -1, Common::Rect(159, 84, 33, 36)); + _chairHotspotId = _scene->_dynamicHotspots.add(0x47, 0x13F, -1, Common::Rect(159, 84, 159 + 33, 84 + 36)); if (_scene->_priorSceneId == 112) sayDang(); } else { @@ -2533,11 +2533,11 @@ void Scene109::actions() { _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 6, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 4); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[6], -2, -2); - int idx = _scene->_dynamicHotspots.add(102, 348, -1, Common::Rect(256, 57, 12, 31)); + int idx = _scene->_dynamicHotspots.add(102, 348, -1, Common::Rect(256, 57, 256 + 12, 57 + 31)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(241, 91), FACING_NORTHEAST); - idx = _scene->_dynamicHotspots.add(102, 348, -1, Common::Rect(242, 79, 24, 12)); + idx = _scene->_dynamicHotspots.add(102, 348, -1, Common::Rect(242, 79, 242 + 24, 79 + 12)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(241, 91), FACING_NORTHEAST); - idx = _scene->_dynamicHotspots.add(229, 348, -1, Common::Rect(231, 88, 23, 7)); + idx = _scene->_dynamicHotspots.add(229, 348, -1, Common::Rect(231, 88, 231 + 23, 88 + 7)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(241, 91), FACING_NORTHEAST); _scene->changeVariant(1); } else { -- cgit v1.2.3 From 3db3aced02bd028b41939818b5aa1028733886f3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 16 Apr 2014 01:03:37 +0200 Subject: MADS: Implement scene 214 --- engines/mads/nebular/nebular_scenes.cpp | 3 + engines/mads/nebular/nebular_scenes2.cpp | 206 +++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes2.h | 16 +++ 3 files changed, 225 insertions(+) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index a3b75c6098..bf8e5b7140 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -94,6 +94,9 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 212: return new Scene212(vm); + case 214: + return new Scene214(vm); + // Scene group #8 case 804: return new Scene804(vm); diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index a804dbbac9..333bdc2d2b 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -4653,5 +4653,211 @@ void Scene212::actions() { /*------------------------------------------------------------------------*/ + +/*------------------------------------------------------------------------*/ + +void Scene214::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(0x1C3); + _scene->addActiveVocab(0xD); +} + +void Scene214::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('e', 0)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('e', 1)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('t', -1)); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites("*RXMRD_7"); + + _devilTime = _game._player._priorTimer; + _devilRunningFl = false; + + if (_game._objects.isInRoom(OBJ_POISON_DARTS)) { + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 6, 0, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(103, 86)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 11); + } else { + _scene->_hotspots.activate(0x114, false); + } + + if (_game._objects.isInRoom(OBJ_BLOWGUN)) { + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 6, 0, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(90, 87)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 13); + } else { + _scene->_hotspots.activate(0x29, false); + } + + if (_scene->_priorSceneId != -2) + _game._player._playerPos = Common::Point(191, 152); + + sceneEntrySound(); +} + +void Scene214::step() { + if ((_game._player._priorTimer - _devilTime > 800) && !_devilRunningFl) { + _devilRunningFl = true; + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 9, 1, 6, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 4); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 2); + _scene->_dynamicHotspots.add(451, 13, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 71); + } + + if (_devilRunningFl) { + switch (_game._trigger) { + case 71: { + int oldIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 9, 5, 0, 0); + _scene->_sequences.updateTimeout(oldIdx, _globals._sequenceIndexes[3]); + _scene->_dynamicHotspots.add(451, VERB_WALKTO, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 5, 8); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 72); + } + break; + + case 72: { + int oldIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 9, 1, 0, 0); + _scene->_sequences.updateTimeout(oldIdx, _globals._sequenceIndexes[3]); + _scene->_dynamicHotspots.add(451, VERB_WALKTO, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 9, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 2); + _devilTime = _game._player._priorTimer; + _devilRunningFl = false; + } + break; + } + } +} + +void Scene214::actions() { + if (_action._lookFlag) + _vm->_dialogs->show(0x53B3); + else if (_action.isAction(0x18A, 0xAA)) + _scene->_nextSceneId = 207; + else if (_action.isAction(VERB_TAKE, 0x114) && (_game._trigger || _game._objects.isInRoom(OBJ_POISON_DARTS))) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], true, 6, 1, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SM_0, 0, 1); + break; + + case 1: + _globals._sequenceIndexes[4] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[4], true, 6, 1, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SM_0, 0, 2); + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _game._objects.addToInventory(OBJ_POISON_DARTS); + _scene->_hotspots.activate(0x114, false); + break; + + case 2: + _game._player._visible = true; + _scene->_sequences.addTimer(48, 3); + break; + + case 3: + _game._player._stepEnabled = true; + _vm->_dialogs->showPicture(OBJ_POISON_DARTS, 0x53A5); + break; + } + } else if (_action.isAction(VERB_TAKE, 0x29) && (_game._trigger || _game._objects.isInRoom(OBJ_BLOWGUN))) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 6, 1, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SM_0, 0, 1); + break; + + case 1: + _globals._sequenceIndexes[4] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[4], false, 6, 1, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SM_0, 0, 2); + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _game._objects.addToInventory(OBJ_BLOWGUN); + _scene->_hotspots.activate(0x29, false); + break; + + case 2: + _game._player._visible = true; + _scene->_sequences.addTimer(48, 3); + break; + + case 3: + _game._player._stepEnabled = true; + _vm->_dialogs->showPicture(OBJ_BLOWGUN, 0x329); + break; + } + } else if (_action.isAction(VERB_LOOK, 0x197)) + _vm->_dialogs->show(0x5399); + else if (_action.isAction(VERB_LOOK, 0x7E)) + _vm->_dialogs->show(0x539A); + else if (_action.isAction(VERB_LOOK, 0x1C3)) + _vm->_dialogs->show(0x539B); + else if (_action.isAction(VERB_LOOK, 0x21)) + _vm->_dialogs->show(0x539C); + else if (_action.isAction(VERB_LOOK, 0x1BB)) + _vm->_dialogs->show(0x539D); + else if (_action.isAction(VERB_LOOK, 0x1BE)) { + if (_game._storyMode == STORYMODE_NAUGHTY) { + _vm->_dialogs->show(0x539E); + } else { + _vm->_dialogs->show(0x539F); + } + } else if (_action.isAction(VERB_LOOK, 0x1BC)) + _vm->_dialogs->show(0x53A0); + else if (_action.isAction(VERB_TAKE, 0x1BE) || _action.isAction(VERB_TAKE, 0x1BC)) + _vm->_dialogs->show(0x53A1); + else if (_action.isAction(VERB_LOOK, 0x13D)) + _vm->_dialogs->show(0x53A2); + else if (_action.isAction(VERB_TAKE, 0x13D) || _action.isAction(VERB_TAKE, 0x48A)) + _vm->_dialogs->show(0x53A3); + else if (_action.isAction(VERB_LOOK, 0x48A)) + _vm->_dialogs->show(0x53B4); + else if (_action.isAction(VERB_LOOK, 0x114) && (_action._savedFields._mainObjectSource == 4)) + _vm->_dialogs->show(0x53A4); + else if (_action.isAction(VERB_OPEN, 0x7E)) + _vm->_dialogs->show(0x53A6); + else if (_action.isAction(VERB_TALKTO, 0x1C3)) + _vm->_dialogs->show(0x53A7); + else if (_action.isAction(VERB_GIVE, 0x17A, 0x1C3)) + _vm->_dialogs->show(0x53A8); + else if (_action.isAction(0x13A, 0x29, 0x1C3) || _action.isAction(0xA6, 0x29, 0x1C3)) + _vm->_dialogs->show(0x53A9); + else if (_action.isAction(VERB_LOOK, 0x473)) + _vm->_dialogs->show(0x53AA); + else if (_action.isAction(VERB_TAKE, 0x473)) + _vm->_dialogs->show(0x53AB); + else if (_action.isAction(VERB_TAKE, 0x21)) + _vm->_dialogs->show(0x53AC); + else if (_action.isAction(VERB_LOOK, 0x8A)) + _vm->_dialogs->show(0x53AD); + else if (_action.isAction(VERB_LOOK, 0x29)) + _vm->_dialogs->show(0x53AE); + else if (_action.isAction(VERB_LOOK, 0x160)) { + if (_game._objects.isInRoom(OBJ_POISON_DARTS) && _game._objects.isInRoom(OBJ_BLOWGUN)) { + _vm->_dialogs->show(0x53AF); + } else if (_game._objects.isInRoom(OBJ_POISON_DARTS) && !_game._objects.isInRoom(OBJ_BLOWGUN)) { + _vm->_dialogs->show(0x53B0); + } else if (!_game._objects.isInRoom(OBJ_POISON_DARTS) && _game._objects.isInRoom(OBJ_BLOWGUN)) { + _vm->_dialogs->show(0x53B1); + } else { + _vm->_dialogs->show(0x53B2); + } + } else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index 0b446bbeb1..c6ef759c1e 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -265,6 +265,22 @@ public: virtual void actions(); virtual void postActions() {}; }; + +class Scene214: public Scene2xx { +private: + uint32 _devilTime; + bool _devilRunningFl; + +public: + Scene214(MADSEngine *vm) : Scene2xx(vm), _devilTime(0), _devilRunningFl(false) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions(); + virtual void postActions() {}; +}; } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 7b907be93775167eab8efab45bea3b9a2776e288 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 15 Apr 2014 19:28:29 -0400 Subject: MADS: General cleanup and minor renamings --- engines/mads/action.cpp | 3 +-- engines/mads/dialogs.h | 2 +- engines/mads/nebular/dialogs_nebular.cpp | 27 ++++++++++++++++++++++++ engines/mads/nebular/dialogs_nebular.h | 7 +++---- engines/mads/nebular/game_nebular.cpp | 35 ++++++++++++++++---------------- engines/mads/nebular/nebular_scenes1.cpp | 18 ++++++++-------- engines/mads/nebular/nebular_scenes2.cpp | 22 ++++++++++---------- engines/mads/player.cpp | 9 ++++---- engines/mads/rails.cpp | 3 +-- engines/mads/scene.cpp | 5 ----- engines/mads/screen.cpp | 8 +------- engines/mads/screen.h | 3 --- engines/mads/sprites.cpp | 4 ++-- engines/mads/user_interface.cpp | 11 ---------- engines/mads/user_interface.h | 3 --- 15 files changed, 77 insertions(+), 83 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index 2d3c1159ff..2da3c5201e 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -585,8 +585,7 @@ void MADSAction::leftClick() { if (_prepType) { _articleNumber = _prepType; _interAwaiting = AWAITING_THAT; - } - else { + } else { _selectedAction = -1; } diff --git a/engines/mads/dialogs.h b/engines/mads/dialogs.h index 00b714d052..0c24dea5b9 100644 --- a/engines/mads/dialogs.h +++ b/engines/mads/dialogs.h @@ -211,7 +211,7 @@ public: virtual ~Dialogs() {} virtual void showDialog() = 0; - virtual void showPicture(int objId, int msgId, int arg3 = 0) = 0; + virtual void showItem(int objectId, int messageId, int arg = 0) = 0; virtual bool show(int msgId) = 0; }; diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp index 30b28fe9d7..3606830abc 100644 --- a/engines/mads/nebular/dialogs_nebular.cpp +++ b/engines/mads/nebular/dialogs_nebular.cpp @@ -242,6 +242,33 @@ bool DialogsNebular::show(int msgId) { return result; } +void DialogsNebular::showItem(int objectId, int messageId, int arg) { + show(messageId); +#if 0 + Scene &scene = _vm->_game->_scene; + byte highPalette[8 * 3]; + Common::copy(&_vm->_palette->_mainPalette[0x2E8], &_vm->_palette->_mainPalette[PALETTE_SIZE], + &highPalette[0]); + byte *depthP = scene._depthSurface.getData(); + byte greyScale[3]; + greyScale[0] = greyScale[1] = greyScale[2] = 0xFFFF; + Common::String setName = Common::String::format("*OBJ%.3d.SS", objectId); + + // Turn off cycling if active + bool cyclingActive = scene._cyclingActive; + scene._cyclingActive = false; + + // Make a copy of the current screen surface + byte *savedSurface = new byte[MADS_SCREEN_WIDTH * MADS_SCREEN_HEIGHT]; + Common::copy(_vm->_screen.getData(), _vm->_screen.getData() + + MADS_SCREEN_WIDTH * MADS_SCREEN_HEIGHT, savedSurface); + + + + delete[] savedSurface; +#endif +} + Common::String DialogsNebular::getVocab(int vocabId) { assert(vocabId > 0); diff --git a/engines/mads/nebular/dialogs_nebular.h b/engines/mads/nebular/dialogs_nebular.h index e123efd49c..041dedadd5 100644 --- a/engines/mads/nebular/dialogs_nebular.h +++ b/engines/mads/nebular/dialogs_nebular.h @@ -50,10 +50,9 @@ public: virtual void showDialog() { warning("TODO: showDialog"); } - virtual void showPicture(int objId, int msgId, int arg3) { - show(msgId); - warning("TODO: showPicture"); - } + + virtual void showItem(int objectId, int msgId, int arg); + virtual bool show(int id); }; diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index 4142cb4708..23c8b3cdd6 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -362,7 +362,7 @@ void GameNebular::doObjectAction() { _objects.addToInventory(OBJ_BLOWGUN); _objects.setRoom(OBJ_PLANT_STALK, PLAYER_INVENTORY); _globals[kBlowgunStatus] = 0; - dialogs.showPicture(OBJ_BLOWGUN, 809); + dialogs.showItem(OBJ_BLOWGUN, 809); } else if (action.isAction(VERB_PUT, 276, NOUN_BLOWGUN) && _objects.isInInventory(OBJ_POISON_DARTS) && _objects.isInInventory(OBJ_BLOWGUN)) { dialogs.show(433); @@ -374,7 +374,7 @@ void GameNebular::doObjectAction() { action.isAction(936) && _objects.isInInventory(OBJ_NOTE)) { _objects.setRoom(OBJ_NOTE, PLAYER_INVENTORY); _objects.addToInventory(OBJ_COMBINATION); - dialogs.showPicture(OBJ_COMBINATION, 851); + dialogs.showItem(OBJ_COMBINATION, 851); } else if ((action.isAction(VERB_LOOK) || action.isAction(NOUN_READ)) && ((id = _objects.getIdFromDesc(action._activeAction._objectNameId)) > 0 || (action._activeAction._indirectObjectId > 0 && @@ -390,7 +390,7 @@ void GameNebular::doObjectAction() { dialogs._indexList[7] = _globals[kTeleporterCode + 5]; dialogs._indexList[8] = _globals[kTeleporterCode + 2]; - dialogs.showPicture(id, 402); + dialogs.showItem(id, 402); } else { int messageId = 800 + id; if (id == OBJ_CHARGE_CASES) { @@ -410,14 +410,14 @@ void GameNebular::doObjectAction() { if (id == OBJ_PHONE_HANDSET && _globals[kHandsetCellStatus]) messageId = 861; - dialogs.showPicture(id, messageId); + dialogs.showItem(id, messageId); } } else if (action.isAction(VERB_PUT, NOUN_BURGER, NOUN_DEAD_FISH)) { if (_objects.isInInventory(OBJ_BURGER) || _objects.isInInventory(OBJ_DEAD_FISH)) { _objects.removeFromInventory(OBJ_DEAD_FISH, PLAYER_INVENTORY); _objects.removeFromInventory(OBJ_BURGER, PLAYER_INVENTORY); _objects.addToInventory(OBJ_STUFFED_FISH); - dialogs.showPicture(OBJ_STUFFED_FISH, 803); + dialogs.showItem(OBJ_STUFFED_FISH, 803); } } else if (action.isAction(VERB_PUT, 26, 357) && _objects.isInInventory(OBJ_AUDIO_TAPE) && _objects.isInInventory(OBJ_TAPE_PLAYER)) { @@ -449,7 +449,7 @@ void GameNebular::doObjectAction() { _objects.setRoom(OBJ_TIMER_MODULE, PLAYER_INVENTORY); _objects.addToInventory(OBJ_TIMEBOMB); - dialogs.showPicture(OBJ_TIMEBOMB, 404); + dialogs.showItem(OBJ_TIMEBOMB, 404); } else if (action.isAction(140, 271)) { dialogs.show(410); } else if (action.isAction(119, 46)) { @@ -458,7 +458,7 @@ void GameNebular::doObjectAction() { } else if (action.isAction(108, 136)) { if (_objects[OBJ_FISHING_LINE]._roomNumber == 3) { _objects.addToInventory(OBJ_FISHING_LINE); - dialogs.showPicture(OBJ_FISHING_LINE, 409); + dialogs.showItem(OBJ_FISHING_LINE, 409); } else { dialogs.show(428); } @@ -467,19 +467,19 @@ void GameNebular::doObjectAction() { case 1: case 2: _objects.addToInventory(OBJ_DURAFAIL_CELLS); - dialogs.showPicture(OBJ_DURAFAIL_CELLS, 412); + dialogs.showItem(OBJ_DURAFAIL_CELLS, 412); break; case 3: _objects.addToInventory(OBJ_PHONE_CELLS); - dialogs.showPicture(OBJ_DURAFAIL_CELLS, 413); + dialogs.showItem(OBJ_DURAFAIL_CELLS, 413); break; case 5: _objects.addToInventory(OBJ_DURAFAIL_CELLS); - dialogs.showPicture(OBJ_DURAFAIL_CELLS, 411); + dialogs.showItem(OBJ_DURAFAIL_CELLS, 411); break; case 6: _objects.addToInventory(OBJ_DURAFAIL_CELLS); - dialogs.showPicture(OBJ_DURAFAIL_CELLS, 429); + dialogs.showItem(OBJ_DURAFAIL_CELLS, 429); break; default: dialogs.show(478); @@ -489,24 +489,24 @@ void GameNebular::doObjectAction() { switch (_globals[kHandsetCellStatus]) { case 1: _objects.addToInventory(OBJ_DURAFAIL_CELLS); - dialogs.showPicture(OBJ_DURAFAIL_CELLS, + dialogs.showItem(OBJ_DURAFAIL_CELLS, _difficulty != 1 || _globals[kDurafailRecharged] ? 415 : 414); break; case 2: _objects.addToInventory(OBJ_DURAFAIL_CELLS); if (_difficulty == 1) { - dialogs.showPicture(OBJ_DURAFAIL_CELLS, 416); + dialogs.showItem(OBJ_DURAFAIL_CELLS, 416); } else { _globals[kHandsetCellStatus] = 0; } break; case 3: _objects.addToInventory(OBJ_PHONE_CELLS); - dialogs.showPicture(OBJ_PHONE_CELLS, 418); + dialogs.showItem(OBJ_PHONE_CELLS, 418); break; case 4: _objects.addToInventory(OBJ_PHONE_CELLS); - dialogs.showPicture(OBJ_PHONE_CELLS, 417); + dialogs.showItem(OBJ_PHONE_CELLS, 417); break; default: dialogs.show(478); @@ -525,8 +525,7 @@ void GameNebular::doObjectAction() { _globals[kHandsetCellStatus] = 3; _objects.setRoom(OBJ_PHONE_CELLS, PLAYER_INVENTORY); dialogs.show(421); - } - else { + } else { dialogs.show(422); } } else if (action.isAction(VERB_PUT, 115, 262)) { @@ -557,7 +556,7 @@ void GameNebular::doObjectAction() { } _objects.addToInventory(OBJ_CHICKEN_BOMB); - dialogs.showPicture(OBJ_CHICKEN_BOMB, 430); + dialogs.showItem(OBJ_CHICKEN_BOMB, 430); } else { return; } diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 9ae9a46eb5..1de0dcd787 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -396,12 +396,12 @@ void Scene101::actions() { } if ((_action.isAction(VERB_TAKE, 0x137) || _action.isAction(VERB_PULL, 0x137)) && _game._objects.isInRoom(0x18)) { - _game._objects.addToInventory(0x18); + _game._objects.addToInventory(OBJ_SHIELD_MODULATOR); _scene->_sequences.remove(_globals._sequenceIndexes[13]); _globals._sequenceIndexes[13] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[14], false, 6, 0, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[13], -2, -2); _scene->_hotspots.activate(0x137, false); - _vm->_dialogs->showPicture(0x18, 0x2788); + _vm->_dialogs->showItem(OBJ_SHIELD_MODULATOR, 10120); _vm->_sound->command(22); _action._inProgress = false; return; @@ -1133,7 +1133,7 @@ void Scene102::actions() { _game._player._visible = true; _game._player._stepEnabled = true; _vm->_sound->command(22); - _vm->_dialogs->showPicture(OBJ_BINOCULARS, 0x27D9); + _vm->_dialogs->showItem(OBJ_BINOCULARS, 10201); break; } _action._inProgress = false; @@ -1142,7 +1142,7 @@ void Scene102::actions() { if (_action.isAction(VERB_TAKE, 0x35) && _game._objects.isInRoom(OBJ_BURGER)) { if (_game._trigger == 0) { - _vm->_dialogs->showPicture(OBJ_BURGER, 0x27FB); + _vm->_dialogs->showItem(OBJ_BURGER, 10235); _scene->_sequences.remove(_globals._sequenceIndexes[10]); _game._objects.addToInventory(OBJ_BURGER); _scene->_hotspots.activate(0x35, false); @@ -1358,7 +1358,7 @@ void Scene103::actions() { _scene->_hotspots.activate(371, false); _vm->_game->_player._visible = true; _vm->_game->_player._stepEnabled = true; - _vm->_dialogs->showPicture(OBJ_REBREATHER, 805); + _vm->_dialogs->showItem(OBJ_REBREATHER, 805); break; default: @@ -1386,7 +1386,7 @@ void Scene103::actions() { _scene->_hotspots.activate(289, false); _vm->_game->_player._visible = true; _vm->_game->_player._stepEnabled = true; - _vm->_dialogs->showPicture(OBJ_REBREATHER, 804); + _vm->_dialogs->showItem(OBJ_REBREATHER, 804); break; default: @@ -1822,7 +1822,7 @@ void Scene105::actions() { _scene->_sequences.remove(_globals._sequenceIndexes[4]); _game._objects.addToInventory(OBJ_DEAD_FISH); _globals[kFishIn105] = false; - _vm->_dialogs->showPicture(OBJ_DEAD_FISH, 0x322, 0); + _vm->_dialogs->showItem(OBJ_DEAD_FISH, 802, 0); } } else if (_action.isAction(VERB_LOOK, 0x195)) _vm->_dialogs->show(0x2905); @@ -2141,7 +2141,7 @@ void Scene107::actions() { _scene->_sequences.remove(_globals._sequenceIndexes[4]); _game._objects.addToInventory(OBJ_DEAD_FISH); _globals[kFishIn107] = false; - _vm->_dialogs->showPicture(OBJ_DEAD_FISH, 0x322); + _vm->_dialogs->showItem(OBJ_DEAD_FISH, 802); } } else if (_action.isAction(0x15D, 0xEE)) _scene->_nextSceneId = 105; @@ -2227,7 +2227,7 @@ void Scene108::actions() { _scene->_sequences.remove(_globals._sequenceIndexes[4]); _game._objects.addToInventory(OBJ_DEAD_FISH); _globals[kFishIn108] = false; - _vm->_dialogs->showPicture(OBJ_DEAD_FISH, 0x2A38); + _vm->_dialogs->showItem(OBJ_DEAD_FISH, 10808); } } else if (_action.isAction(0x15D, 0xF4)) _scene->_nextSceneId = 107; diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 333bdc2d2b..2e5ef35cd3 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -781,10 +781,10 @@ void Scene202::actions() { if (_game._objects.isInInventory(OBJ_BONE)) { _game._objects.removeFromInventory(OBJ_BONE, 1); _game._objects.addToInventory(OBJ_BONES); - _vm->_dialogs->showPicture(OBJ_BONES, 0x4EFA, 0); + _vm->_dialogs->showItem(OBJ_BONES, 0x4EFA, 0); } else { _game._objects.addToInventory(OBJ_BONE); - _vm->_dialogs->showPicture(OBJ_BONE, 0x4EFA, 0); + _vm->_dialogs->showItem(OBJ_BONE, 0x4EFA, 0); } _scene->changeVariant(_globals[kBone202Status]); _game._player._stepEnabled = true; @@ -1352,9 +1352,9 @@ void Scene207::preActions() { void Scene207::actions() { if (_action._savedFields._lookFlag) { _vm->_dialogs->show(0x50E7); - } else if (_action.isAction(0x18B, 0x70)) + } else if (_action.isAction(0x18B, 0x70)) { _scene->_nextSceneId = 214; - else { + } else { if ((_game._player._playerPos.x > 150) && (_game._player._playerPos.x < 189) && (_game._player._playerPos.y > 111) && (_game._player._playerPos.y < 130)) { if ((_game._player._playerPos.x <= 162) && (_game._player._playerPos.x >= 181) && @@ -1622,7 +1622,7 @@ void Scene208::actions() { } else if (_action.isAction(VERB_TAKE, 0x1AA) && (!_globals[kLeavesStatus] || _game._trigger)) { subAction(1); if (_game._player._stepEnabled) - _vm->_dialogs->showPicture(OBJ_BIG_LEAVES, 0x326, 0); + _vm->_dialogs->showItem(OBJ_BIG_LEAVES, 0x326, 0); } else if (_action.isAction(VERB_PUT, 0x23, 0x19E) && (_globals[kLeavesStatus] == 1 || _game._trigger)) { subAction(2); } else if (_action.isAction(VERB_PUT, 0x17A, 0x1A9)) { @@ -1820,9 +1820,9 @@ void Scene209::handleLookStay() { _scene->_sequences.remove(_globals._sequenceIndexes[3]); _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 6); - if (!_dodgeFl) + if (!_dodgeFl) { _scene->_sequences.addTimer(90, 149); - else { + } else { _scene->_sequences.addTimer(1, 149); _shouldDodgeFl = true; } @@ -3137,7 +3137,7 @@ void Scene209::actions() { _game._player._visible = true; _game._player._stepEnabled = true; _scene->_sequences.addTimer(4, 3); - _vm->_dialogs->showPicture(OBJ_PLANT_STALK, 0x328); + _vm->_dialogs->showItem(OBJ_PLANT_STALK, 0x328); break; case 3: @@ -3173,7 +3173,7 @@ void Scene209::actions() { break; case 3: - _vm->_dialogs->showPicture (OBJ_BINOCULARS, 0x51AF); + _vm->_dialogs->showItem (OBJ_BINOCULARS, 0x51AF); _scene->_sprites.remove(_globals._spriteIndexes[10]); break; } @@ -4763,7 +4763,7 @@ void Scene214::actions() { case 3: _game._player._stepEnabled = true; - _vm->_dialogs->showPicture(OBJ_POISON_DARTS, 0x53A5); + _vm->_dialogs->showItem(OBJ_POISON_DARTS, 0x53A5); break; } } else if (_action.isAction(VERB_TAKE, 0x29) && (_game._trigger || _game._objects.isInRoom(OBJ_BLOWGUN))) { @@ -4792,7 +4792,7 @@ void Scene214::actions() { case 3: _game._player._stepEnabled = true; - _vm->_dialogs->showPicture(OBJ_BLOWGUN, 0x329); + _vm->_dialogs->showItem(OBJ_BLOWGUN, 0x329); break; } } else if (_action.isAction(VERB_LOOK, 0x197)) diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index bf5e59ecde..b55d3f0285 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -230,8 +230,7 @@ void Player::updateFrame() { if (!_visible) { _upcomingTrigger = 0; - } - else { + } else { _upcomingTrigger = _stopWalkerTrigger[_stopWalkerIndex]; if (_stopWalkerIndex > 0) @@ -597,11 +596,11 @@ void Player::startMovement() { // Figure out direction that will need to be moved in int majorDir; - if (xDiff == 0) + if (xDiff == 0) { majorDir = 1; - else if (yDiff == 0) + } else if (yDiff == 0) { majorDir = 3; - else { + } else { if ((scaleAmount < xDiff) && ((xAmt33 / scaleAmount) >= 141)) majorDir = 3; else if (yDiff <= xDiff) diff --git a/engines/mads/rails.cpp b/engines/mads/rails.cpp index 0c179f8dc1..342238ec65 100644 --- a/engines/mads/rails.cpp +++ b/engines/mads/rails.cpp @@ -195,8 +195,7 @@ void Rails::setNodePosition(int nodeIndex, const Common::Point &pt) { int entry; if (idx == (uint)nodeIndex) { entry = 0x3FFF; - } - else { + } else { // Process the node flags = getRouteFlags(pt, _nodes[idx]._walkPos); diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 1aa1fd7f32..a112228859 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -426,11 +426,6 @@ void Scene::drawElements(ScreenTransition transitionType, bool surfaceFlag) { // Draw text elements onto the view _textDisplay.draw(&_vm->_screen); - // - _vm->_screen.setPointer(&_vm->_screen); - _userInterface.setBounds(Common::Rect(_vm->_screen._offset.x, _vm->_screen._offset.y, - _vm->_screen._offset.x + _vm->_screen.w, _vm->_screen._offset.y + _vm->_screen.h)); - if (transitionType) { // Fading in the screen _vm->_screen.transition(transitionType, surfaceFlag); diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index f4441ca969..5f09737620 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -85,8 +85,7 @@ void DirtyArea::setSpriteSlot(const SpriteSlot *spriteSlot) { _bounds.top = 0; width = MADS_SCREEN_WIDTH; height = MADS_SCENE_HEIGHT; - } - else { + } else { // Standard sprite slots _bounds.left = spriteSlot->_position.x - scene._posAdjust.x; _bounds.top = spriteSlot->_position.y - scene._posAdjust.y; @@ -548,7 +547,6 @@ void ScreenObjects::setActive(ScrCategory category, int descId, bool active) { /*------------------------------------------------------------------------*/ ScreenSurface::ScreenSurface() { - _dataP = nullptr; } void ScreenSurface::init() { @@ -610,10 +608,6 @@ void ScreenSurface::transition(ScreenTransition transitionType, bool surfaceFlag } } -void ScreenSurface::setPointer(MSurface *s) { - _dataP = s->getData(); -} - void ScreenSurface::fadeOut() { warning("TODO: Proper fade out"); } diff --git a/engines/mads/screen.h b/engines/mads/screen.h index 5be627a428..272ef9ed56 100644 --- a/engines/mads/screen.h +++ b/engines/mads/screen.h @@ -205,7 +205,6 @@ private: void fadeIn(); public: Common::Point _offset; - byte *_dataP; public: /** * Constructor @@ -217,8 +216,6 @@ public: */ void init(); - void setPointer(MSurface *s); - /** * Copys an area of the screen surface to a given destination position on * the ScummVM physical screen buffer diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp index cd838f7dfb..85e36d6c76 100644 --- a/engines/mads/sprites.cpp +++ b/engines/mads/sprites.cpp @@ -400,9 +400,9 @@ void SpriteSets::remove(int idx) { if (idx >= 0) { delete (*this)[idx]; - if (idx < ((int)size() - 1)) + if (idx < ((int)size() - 1)) { (*this)[idx] = nullptr; - else { + } else { do { remove_at(size() - 1); } while (size() > 0 && (*this)[size() - 1] == nullptr); diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 13d5569045..4348d833c9 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -163,10 +163,6 @@ void UISlots::draw(bool updateFlag, bool delFlag) { // Mark areas of the screen surface for updating if (updateFlag) { - _vm->_screen.setPointer(&userInterface); - userInterface.setBounds(Common::Rect(0, scene._interfaceY, - MADS_SCREEN_WIDTH - 1, userInterface.h + scene._interfaceY - 1)); - for (uint idx = 0; idx < size(); ++idx) { DirtyArea &dirtyArea = userInterface._dirtyAreas[idx]; @@ -502,10 +498,6 @@ void UserInterface::writeVocab(ScrCategory category, int id) { } } -void UserInterface::setBounds(const Common::Rect &r) { - _drawBounds = r; -} - void UserInterface::loadElements() { Scene &scene = _vm->_game->_scene; Common::Rect bounds; @@ -881,9 +873,6 @@ void UserInterface::updateSelection(ScrCategory category, int newIndex, int *idx } void UserInterface::updateRect(const Common::Rect &bounds) { - _vm->_screen.setPointer(&_surface); - setBounds(Common::Rect(0, MADS_SCENE_HEIGHT, MADS_SCREEN_WIDTH - 1, MADS_SCREEN_HEIGHT)); - Common::Rect r = bounds; r.translate(0, MADS_SCENE_HEIGHT); _vm->_screen.copyRectToScreen(r); diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h index f06917310e..52512ef6ca 100644 --- a/engines/mads/user_interface.h +++ b/engines/mads/user_interface.h @@ -164,7 +164,6 @@ public: UISlots _uiSlots; DirtyAreas _dirtyAreas; ScrCategory _category; - Common::Rect _drawBounds; Common::Rect *_rectP; int _inventoryTopIndex; int _selectedInvIndex; @@ -199,8 +198,6 @@ public: void drawTextElements(); - void setBounds(const Common::Rect &r); - /** * Loads the animation sprite data for a given inventory object */ -- cgit v1.2.3 From dea63c9fe8b64c30464119ffbfbc3491e6f158cc Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 15 Apr 2014 22:56:52 -0400 Subject: MADS: Renaming for sprite cycle triggers --- engines/mads/nebular/nebular_scenes1.cpp | 114 ++++++++++----------- engines/mads/nebular/nebular_scenes2.cpp | 166 +++++++++++++++---------------- engines/mads/sequence.cpp | 16 +-- engines/mads/sequence.h | 10 +- 4 files changed, 155 insertions(+), 151 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 1de0dcd787..ec81b5f356 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -114,7 +114,7 @@ void Scene101::sayDang() { _scene->_sequences.remove(_globals._sequenceIndexes[11]); _globals._sequenceIndexes[11] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[11], false, 3, 6, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[11], 17, 21); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[11], SM_0, 0, 72); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[11], SEQUENCE_TRIGGER_EXPIRE, 0, 72); _vm->_sound->command(17); _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 3, 2, 0, 0); break; @@ -152,7 +152,7 @@ void Scene101::enter() { _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 5, 0, 0, 25); _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 4, 0, 1, 0); _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 6, 0, 2, 0); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_FRAME_INDEX, 7, 70); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_SPRITE, 7, 70); _globals._sequenceIndexes[4] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[4], false, 10, 0, 0, 60); _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 5, 0, 1, 0); _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 10, 0, 2, 0); @@ -278,7 +278,7 @@ void Scene101::preActions() { _game._player._stepEnabled = false; _scene->_sequences.remove(_globals._sequenceIndexes[11]); _globals._sequenceIndexes[11] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[11], false, 3, 1, 0, 0); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[11], SM_0, 0, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[11], SEQUENCE_TRIGGER_EXPIRE, 0, 1); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[11], 1, 17); _vm->_sound->command(16); break; @@ -304,7 +304,7 @@ void Scene101::preActions() { _scene->_sequences.remove(_globals._sequenceIndexes[13]); _shieldSpriteIdx = _game._objects.isInRoom(0x18) ? 13 : 14; _globals._sequenceIndexes[13] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[_shieldSpriteIdx], false, 6, 1, 0, 0); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SM_0, 0, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SEQUENCE_TRIGGER_EXPIRE, 0, 1); _game._player._stepEnabled = false; _vm->_sound->command(20); } @@ -339,8 +339,8 @@ void Scene101::actions() { _scene->_sequences.remove(_globals._sequenceIndexes[12]); _globals._sequenceIndexes[11] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[11], false, 3, 1); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[11], 1, 17); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[11], SM_FRAME_INDEX, 10, 1); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[11], SM_0, 0, 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[11], SEQUENCE_TRIGGER_SPRITE, 10, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[11], SEQUENCE_TRIGGER_EXPIRE, 0, 2); _game._player._stepEnabled = false; _game._player._visible = false; _action._inProgress = false; @@ -376,7 +376,7 @@ void Scene101::actions() { case 0: _shieldSpriteIdx = _game._objects.isInRoom(0x18) ? 13 : 14; _globals._sequenceIndexes[13] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[_shieldSpriteIdx], false, 6, 1, 0, 0); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SM_0, 0, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SEQUENCE_TRIGGER_EXPIRE, 0, 1); _game._player._stepEnabled = false; _vm->_sound->command(20); break; @@ -436,13 +436,13 @@ void Scene101::actions() { _scene->_sequences.remove(_globals._sequenceIndexes[11]); _globals._sequenceIndexes[11] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[11], false, 3, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[11], 17, 21); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[11], SM_0, 0, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[11], SEQUENCE_TRIGGER_EXPIRE, 0, 1); _vm->_sound->command(17); break; case 1: _globals._sequenceIndexes[11] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[11], false, 3, 1, 0, 0); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[11], SM_0, 0, 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[11], SEQUENCE_TRIGGER_EXPIRE, 0, 2); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[11], 17, 21); break; @@ -450,7 +450,7 @@ void Scene101::actions() { _globals._sequenceIndexes[11] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[11], false, 3, 0, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[11], 17, 17); _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 3, 1, 0, 0); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SM_0, 0, 3); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_EXPIRE, 0, 3); break; case 3: @@ -653,7 +653,7 @@ void Scene102::enter() { _game._player._playerPos = Common::Point(229, 109); _game._player._stepEnabled = false; _globals._sequenceIndexes[6] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[6], false, 6, 1, 2, 0); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SM_0, 0, 70); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_EXPIRE, 0, 70); } else if (_scene->_priorSceneId == 103) { _game._player._playerPos = Common::Point(47, 152); } else if (_scene->_priorSceneId != -2) { @@ -671,7 +671,7 @@ void Scene102::enter() { _game._player._stepEnabled = false; _game._player._visible = false; _globals._sequenceIndexes[13] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[13], false, 6, 1, 0, 0); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SM_0, 0, 72); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SEQUENCE_TRIGGER_EXPIRE, 0, 72); _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 5); _vm->_sound->command(24); _vm->_sound->command(28); @@ -750,7 +750,7 @@ void Scene102::preActions() { if (_game._player._needToWalk) { _scene->_sequences.remove(_globals._sequenceIndexes[7]); _globals._sequenceIndexes[7] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[7], false, 6, 1, 0, 0); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SM_0, 0, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SEQUENCE_TRIGGER_EXPIRE, 0, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 15); _game._player._stepEnabled = false; _vm->_sound->command(20); @@ -786,7 +786,7 @@ void Scene102::actions() { case 0: _globals._sequenceIndexes[7] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 6, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 15); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SM_0, 0, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SEQUENCE_TRIGGER_EXPIRE, 0, 1); if (_game._objects.isInRoom(OBJ_BURGER)) { _globals._sequenceIndexes[10] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[10], false, 7, 0, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 14); @@ -862,7 +862,7 @@ void Scene102::actions() { switch (_game._trigger) { case 0: _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 6, 1, 0, 0); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SM_0, 0, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_EXPIRE, 0, 1); _game._player._stepEnabled = false; _vm->_sound->command(20); break; @@ -1067,7 +1067,7 @@ void Scene102::actions() { case 0: _scene->_sequences.remove(_globals._sequenceIndexes[8]); _globals._sequenceIndexes[8] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[8], false, 6, 1, 0, 0); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SM_0, 0, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_EXPIRE, 0, 1); _game._player._stepEnabled = false; _vm->_sound->command(21); break; @@ -1090,7 +1090,7 @@ void Scene102::actions() { switch (_game._trigger) { case 0: _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 6, 1, 0, 0); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SM_0, 0, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_EXPIRE, 0, 1); _game._player._stepEnabled = false; _vm->_sound->command(21); break; @@ -1121,7 +1121,7 @@ void Scene102::actions() { case 0: _globals._sequenceIndexes[11] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[11], false, 3, 1, 0, 0); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[11]); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[11], SM_0, 0, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[11], SEQUENCE_TRIGGER_EXPIRE, 0, 1); _game._player._visible = false; _game._player._stepEnabled = false; break; @@ -1219,9 +1219,9 @@ void Scene103::enter() { _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 0); _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 6, 0, 0, 25); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SM_FRAME_INDEX, 2, 72); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_SPRITE, 2, 72); _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 6, 0, 1, 37); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_FRAME_INDEX, 2, 73); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_SPRITE, 2, 73); _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8); _globals._sequenceIndexes[7] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 6); @@ -1251,7 +1251,7 @@ void Scene103::enter() { _game._player._stepEnabled = false; _globals._sequenceIndexes[6] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[6], false, 6, 1, 0, 0); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SM_0, 0, 70); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_EXPIRE, 0, 70); } sceneEntrySound(); @@ -1320,7 +1320,7 @@ void Scene103::actions() { switch (_vm->_game->_trigger) { case 0: _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 6, 1); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SM_0, 0, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_EXPIRE, 0, 1); _game._player._stepEnabled = false; _vm->_sound->command(20); break; @@ -1340,8 +1340,8 @@ void Scene103::actions() { _scene->changeVariant(1); _globals._sequenceIndexes[13] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[13], false, 3, 2); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[13]); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SM_FRAME_INDEX, 7, 1); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SM_0, 0, 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SEQUENCE_TRIGGER_SPRITE, 7, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SEQUENCE_TRIGGER_EXPIRE, 0, 2); _vm->_game->_player._visible = false; _vm->_game->_player._stepEnabled = false; break; @@ -1370,8 +1370,8 @@ void Scene103::actions() { _scene->changeVariant(1); _globals._sequenceIndexes[12] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[12], false, 3, 2); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[12]); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SM_FRAME_INDEX, 6, 1); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SM_0, 0, 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SEQUENCE_TRIGGER_SPRITE, 6, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SEQUENCE_TRIGGER_EXPIRE, 0, 2); _vm->_game->_player._visible = false; _vm->_game->_player._stepEnabled = false; break; @@ -1411,7 +1411,7 @@ void Scene103::actions() { _scene->_sequences.addTimer(120, _vm->_game->_trigger + 1); } else { // Initial turky explosion - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SM_0, 0, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SEQUENCE_TRIGGER_EXPIRE, 0, 1); } } @@ -1569,7 +1569,7 @@ void Scene104::step() { _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], mirrorFl, 7, 1, 0, 0); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(198, 143)); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SM_0, 0, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 1); break; case 1: @@ -1600,7 +1600,7 @@ void Scene104::step() { _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[3], Common::Point(198, 143)); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 4); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 14); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 1); break; case 1: @@ -1608,7 +1608,7 @@ void Scene104::step() { _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[3], Common::Point(198, 143)); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 4); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 15, 32); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 2); break; case 2: @@ -1638,9 +1638,9 @@ void Scene104::step() { _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 8, 1, 0, 0); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(198, 143)); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 4); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SM_0, 0, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 1); if (_game._storyMode >= STORYMODE_NICE) - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SM_FRAME_INDEX, 15, 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_SPRITE, 15, 2); break; case 1: @@ -1755,10 +1755,10 @@ void Scene105::step() { _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 6, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 8); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SM_0, 0, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_EXPIRE, 0, 1); if (_game._storyMode >= STORYMODE_NICE) - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SM_FRAME_INDEX, 8, 3); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_SPRITE, 8, 3); break; case 1: @@ -1769,7 +1769,7 @@ void Scene105::step() { _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], _globals._sequenceIndexes[0]); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 8); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 5, 7); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SM_0, 0, 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 2); break; case 2: { @@ -1877,7 +1877,7 @@ void Scene106::enter() { if (_scene->_priorSceneId == 102) { _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 6, 1, 4, 0); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SM_0, 0, 70); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_EXPIRE, 0, 70); _game._player._visible = false; _game._player._stepEnabled = false; _game._player._facing = FACING_EAST; @@ -1921,7 +1921,7 @@ void Scene106::step() { _scene->loadAnimation(Resources::formatName(106, 'A', -1, EXT_AA, ""), 75); } else { _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 4, 1, 0, 0); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SM_FRAME_INDEX, 28, 71); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_SPRITE, 28, 71); } } @@ -1986,8 +1986,8 @@ void Scene106::step() { if (_game._player._playerPos.x < 204) { _shadowFl = true; _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 4, 1, 0, 0); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 72); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_FRAME_INDEX, 44, 73); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 72); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_SPRITE, 44, 73); } } else if (_game._trigger == 73) _game._player._visible = false; @@ -2098,7 +2098,7 @@ void Scene107::enter() { _globals._spriteIndexes[0] = _scene->_sprites.addSprites(Resources::formatName(105, 'R', 1, EXT_SS, "")); _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], true, 4, 0, 0, 0); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[0], Common::Point(270, 150)); - _scene->_sequences.sub70C52(_globals._sequenceIndexes[0], SM_FRAME_INDEX, -200, 0); + _scene->_sequences.sub70C52(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_SPRITE, -200, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 2); _scene->_dynamicHotspots.add(218, 348, _globals._sequenceIndexes[0], Common::Rect(0, 0, 0, 0)); } @@ -2357,8 +2357,8 @@ void Scene109::step() { if (_game._player._playerPos.x > 205) { _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 6, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 4); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SM_FRAME_INDEX, 6, 70); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SM_0, 0, 71); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_SPRITE, 6, 70); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 71); _eatingRex = true; _vm->_sound->command(34); @@ -2396,8 +2396,8 @@ void Scene109::step() { if (_eatingFirstFish && (_scene->_sequences[_globals._sequenceIndexes[10]]._msgPos.x >= 178)) { _globals._sequenceIndexes[9] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 4, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 4); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SM_FRAME_INDEX, 29, 72); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SM_0, 29, 73); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SEQUENCE_TRIGGER_SPRITE, 29, 72); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SEQUENCE_TRIGGER_EXPIRE, 29, 73); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[10], _globals._sequenceIndexes[9]); _eatingFirstFish = false; _game._player._stepEnabled = true; @@ -2464,7 +2464,7 @@ void Scene109::actions() { _game._objects.setRoom(_throwingObjectId, NOWHERE); _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 4, 1, 0, 0); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[0]); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SM_0, 0, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_EXPIRE, 0, 1); _game._player._visible = false; _game._player._stepEnabled = false; @@ -2489,23 +2489,23 @@ void Scene109::actions() { switch (_throwingObjectId) { case OBJ_BURGER: _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, (_hoovicDifficultFl ? 4 : 6), 1, 0, 0); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_FRAME_INDEX, 2, 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_SPRITE, 2, 2); if (_hoovicDifficultFl) { _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 30); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 5); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 5); } else { _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 4); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 8); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 8); _hoovicTrigger = 3; } break; case OBJ_DEAD_FISH: _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 4, 1, 0, 0); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SM_FRAME_INDEX, 2, 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_SPRITE, 2, 2); break; case OBJ_STUFFED_FISH: _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 4, 1, 0, 0); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SM_FRAME_INDEX, 2, 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_SPRITE, 2, 2); _hoovicTrigger = 3; break; } @@ -2518,7 +2518,7 @@ void Scene109::actions() { _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 4, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[8], 4); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SM_0, 0, _hoovicTrigger); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_EXPIRE, 0, _hoovicTrigger); _vm->_sound->command(34); break; @@ -2596,7 +2596,7 @@ void Scene109::actions() { _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 31, 46); int idx = _scene->_dynamicHotspots.add(53, 348, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(-3, 0), FACING_NORTHEAST); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 7); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 7); } break; @@ -2799,11 +2799,11 @@ void Scene111::enter() { _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('B', 2)); _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 8, 0, 0, 0); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SM_FRAME_INDEX, 9, 73); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SM_FRAME_INDEX, 13, 73); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_SPRITE, 9, 73); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_SPRITE, 13, 73); _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 5, 0, 0, 0); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SM_FRAME_INDEX, 71, 71); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_SPRITE, 71, 71); _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 12, 0, 0, 0); _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); @@ -2852,7 +2852,7 @@ void Scene111::step() { if ((_game._trigger == 71) && !_stampedFl) { _stampedFl = true; _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 18, 1, 0, 0); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SM_0, 0, 72); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 72); } if (_game._trigger == 72) { @@ -2961,7 +2961,7 @@ void Scene112::step() { if (_game._trigger == 70) { _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 7, 3, 0, 11); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 1); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 71); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 71); } if (_game._trigger == 71) { diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 2e5ef35cd3..36f291973b 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -188,7 +188,7 @@ void Scene201::enter() { _game._player._stepEnabled = false; _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 7, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[6], -1, 12); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SM_FRAME_INDEX, 12, 70); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_SPRITE, 12, 70); _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 1); _pterodactylFlag = false; _game._player.walk(Common::Point(157, 143), FACING_NORTH); @@ -222,9 +222,9 @@ void Scene201::step() { _vm->_sound->command(42); _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 1); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SM_FRAME_INDEX, 3, 81); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SM_0, 0, 71); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SM_0, 0, 73); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SEQUENCE_TRIGGER_SPRITE, 3, 81); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SEQUENCE_TRIGGER_EXPIRE, 0, 71); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_EXPIRE, 0, 73); } if (_game._trigger == 81) { @@ -240,7 +240,7 @@ void Scene201::step() { if (_game._trigger == 73) { _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 9, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[6], 17, -2); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SM_0, 0, 74); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_EXPIRE, 0, 74); _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 1); } @@ -507,7 +507,7 @@ void Scene202::step() { _globals._sequenceIndexes[9] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[9], true, 6, 1, 0, 0); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[9], Common::Point(247, 82)); _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 1); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SM_0, 0, 91); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SEQUENCE_TRIGGER_EXPIRE, 0, 91); break; case 91: _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, 1); @@ -519,7 +519,7 @@ void Scene202::step() { _scene->_sequences.remove(_globals._sequenceIndexes[9]); _globals._sequenceIndexes[11] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[11], false, 6, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[11], 1); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[11], SM_0, 0, 93); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[11], SEQUENCE_TRIGGER_EXPIRE, 0, 93); _scene->_kernelMessages.reset(); int msgIndex = _scene->_kernelMessages.add(Common::Point(0, -65), 0x1110, 32, 0, 60, _game.getQuote(98)); _scene->_kernelMessages.setSeqIndex(msgIndex, _globals._sequenceIndexes[11]); @@ -716,7 +716,7 @@ void Scene202::preActions() { _scene->_sequences.remove(_globals._sequenceIndexes[9]); _globals._sequenceIndexes[8] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[8], false, 6, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[8], 1); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SM_0, 0, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_EXPIRE, 0, 1); } else if (_game._trigger == 1) { _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[8]); _scene->_dynamicHotspots.remove(_ladderHotspotId); @@ -764,8 +764,8 @@ void Scene202::actions() { _game._player._visible = false; _globals._sequenceIndexes[7] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[6], false, 3, 2, 0, 0); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[7]); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SM_FRAME_INDEX, 6, 1); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SM_0, 0, 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SEQUENCE_TRIGGER_SPRITE, 6, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SEQUENCE_TRIGGER_EXPIRE, 0, 2); } break; case 1: @@ -807,7 +807,7 @@ void Scene202::actions() { _scene->_dynamicHotspots.setPosition(_ladderHotspotId, Common::Point(246, 124), FACING_NORTH); _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 6, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[8], 1); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SM_0, 0, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_EXPIRE, 0, 1); break; case 1: { _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, 1); @@ -835,7 +835,7 @@ void Scene202::actions() { _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[10], Common::Point(172, 123)); _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 1); _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[10]); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[10], SM_0, 0, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[10], SEQUENCE_TRIGGER_EXPIRE, 0, 1); break; case 1: _globals._sequenceIndexes[10] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 6); @@ -857,7 +857,7 @@ void Scene202::actions() { _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 1); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[10], 1, 6); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[10], Common::Point(172, 123)); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[10], SM_0, 0, 3); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[10], SEQUENCE_TRIGGER_EXPIRE, 0, 3); break; case 3: _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[10]); @@ -877,7 +877,7 @@ void Scene202::actions() { _globals._sequenceIndexes[9] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], true, 6, 1, 0, 0); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[9], Common::Point(247, 82)); _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 1); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SM_0, 0, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SEQUENCE_TRIGGER_EXPIRE, 0, 1); break; case 1: _globals._sequenceIndexes[10] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, -2); @@ -910,7 +910,7 @@ void Scene202::actions() { _globals._sequenceIndexes[9] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[9], false, 6, 1, 0, 0); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[9], Common::Point(247, 82)); _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 1); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SM_0, 0, 3); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SEQUENCE_TRIGGER_EXPIRE, 0, 3); break; case 3: _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, 1); @@ -1167,9 +1167,9 @@ void Scene205::enter() { _game._player._visible = false; _game._player._stepEnabled = false; _scene->_sequences.setDepth(_globals._sequenceIndexes[8], 2); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SM_FRAME_INDEX, 6, 73); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SM_FRAME_INDEX, 11, 74); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SM_0, 0, 0); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_SPRITE, 6, 73); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_SPRITE, 11, 74); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_EXPIRE, 0, 0); } sceneEntrySound(); } @@ -1284,7 +1284,7 @@ void Scene207::enter() { _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 10, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[6], 1, 22); _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 6); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SM_0, 0, 70); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_EXPIRE, 0, 70); } void Scene207::moveVulture() { @@ -1328,7 +1328,7 @@ void Scene207::step() { _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 6); _scene->_sequences.setDepth(_globals._sequenceIndexes[8], 6); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SM_0, 0, 71); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SEQUENCE_TRIGGER_EXPIRE, 0, 71); _eyeFl = true; } } @@ -1550,7 +1550,7 @@ void Scene208::subAction(int mode) { else abortVal = 2; - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SM_0, 0, abortVal); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, abortVal); } break; case 1: { @@ -1559,7 +1559,7 @@ void Scene208::subAction(int mode) { _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 3, 4); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[5], oldVal); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SM_0, 0, 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 2); _vm->_sound->command(20); } break; @@ -1596,7 +1596,7 @@ void Scene208::subAction(int mode) { _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 1, 3); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[5], oldVal); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SM_0, 0, 3); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 3); } break; case 3: @@ -1722,7 +1722,7 @@ void Scene209::handlePeek() { _vm->_sound->command(18); _globals._sequenceIndexes[3] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 51, 52); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 134); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 134); break; case 134: { @@ -1749,7 +1749,7 @@ void Scene209::handlePeek() { _scene->_sequences.remove(_globals._sequenceIndexes[3]); _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 51, 52); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 138); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 138); break; case 138: @@ -1765,7 +1765,7 @@ void Scene209::handleVerticalMove() { case 140: _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 8, 8, 0, 1); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 5); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 141); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 141); break; case 141: { @@ -1781,7 +1781,7 @@ void Scene209::handleVerticalMove() { _scene->_sequences.remove(_globals._sequenceIndexes[3]); _globals._sequenceIndexes[3] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 5); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 143); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 143); break; case 143: @@ -1799,7 +1799,7 @@ void Scene209::handleLookStay() { _monkeyPosition = 2; _globals._sequenceIndexes[3] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 51, 52); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 146); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 146); break; case 146: { @@ -1840,7 +1840,7 @@ void Scene209::handleLookRight() { _scene->_sequences.remove(_globals._sequenceIndexes[3]); _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 8, 2, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 8, 14); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 152); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 152); break; case 152: { @@ -1895,11 +1895,11 @@ void Scene209::handleGetBinoculars() { _scene->_sequences.remove(_globals._sequenceIndexes[3]); _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 8, 24); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_FRAME_INDEX, 20, 165); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_SPRITE, 20, 165); if (!_fallFl && !_dodgeFl) { - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 162); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 162); } else { - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 163); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 163); } break; @@ -1908,7 +1908,7 @@ void Scene209::handleGetBinoculars() { _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 8, 6, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 23, 25); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], oldIdx); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 163); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 163); } break; @@ -1941,7 +1941,7 @@ void Scene209::handleBinocularBlink() { _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 8, 2, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 23, 25); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], oldIdx); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 168); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 168); } break; @@ -1970,7 +1970,7 @@ void Scene209::handleBinocularScan() { _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 12, 2, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 43, 45); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], oldIdx); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 172); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 172); } break; @@ -1987,7 +1987,7 @@ void Scene209::handleBinocularScan() { } _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 23, 25); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], oldIdx); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 173); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 173); } break; @@ -1996,7 +1996,7 @@ void Scene209::handleBinocularScan() { _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 12, 2, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 26, 30); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], oldIdx); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 174); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 174); } break; @@ -2032,7 +2032,7 @@ void Scene209::handleJumpInTree() { if (!_removeMonkeyFl) _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], oldIdx); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 179); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 179); } break; @@ -2042,7 +2042,7 @@ void Scene209::handleJumpInTree() { _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 53, 61); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], oldIdx); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 180); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 180); } break; @@ -2063,7 +2063,7 @@ void Scene209::handleTongue() { _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 12, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 26, 30); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], oldIdx); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 183); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 183); } break; @@ -2072,7 +2072,7 @@ void Scene209::handleTongue() { _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 12, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 31, 33); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], oldIdx); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 184); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 184); } break; @@ -2081,7 +2081,7 @@ void Scene209::handleTongue() { _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 12, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 36, 37); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], oldIdx); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 185); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 185); } break; @@ -2091,7 +2091,7 @@ void Scene209::handleTongue() { _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 6, 20, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 38, 39); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], oldIdx); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 186); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 186); } break; @@ -2100,7 +2100,7 @@ void Scene209::handleTongue() { _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 12, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 40, 41); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], oldIdx); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 178); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 178); _removeMonkeyFl = false; } break; @@ -2126,7 +2126,7 @@ void Scene209::handleStandFromPeek() { _scene->_sequences.remove(_globals._sequenceIndexes[3]); _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 8, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[6], 1, 5); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SM_0, 0, 192); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_EXPIRE, 0, 192); break; case 192: { @@ -2185,7 +2185,7 @@ void Scene209::handleJumpAndHide() { _scene->_sequences.remove(_globals._sequenceIndexes[4]); _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 8, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 1, 16); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SM_0, 0, 197); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 197); break; case 197: @@ -2203,7 +2203,7 @@ void Scene209::handleMonkeyEating() { _scene->_sequences.remove(_globals._sequenceIndexes[4]); _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 10, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 1, 14); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SM_0, 0, 200); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 200); break; case 200: { @@ -2211,7 +2211,7 @@ void Scene209::handleMonkeyEating() { _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 10, 10, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 15, 16); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], oldIdx); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SM_0, 0, 201); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 201); } break; @@ -2239,7 +2239,7 @@ void Scene209::handleMonkeyEating() { _scene->_sequences.remove(_globals._sequenceIndexes[4]); _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 10, 8, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 18, 19); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SM_0, 0, 205); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 205); break; case 205: { @@ -2247,7 +2247,7 @@ void Scene209::handleMonkeyEating() { _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 10, 8, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 20, 21); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], oldIdx); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SM_0, 0, 206); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 206); } break; @@ -2257,9 +2257,9 @@ void Scene209::handleMonkeyEating() { _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 22, 25); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], oldIdx); if (!_dodgeFl && !_fallFl) - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SM_0, 0, 207); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 207); else - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SM_0, 0, 209); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 209); } break; @@ -2272,7 +2272,7 @@ void Scene209::handleMonkeyEating() { _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 15, 4, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 26, 27); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], oldIdx); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SM_0, 0, 208); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 208); } break; @@ -2282,7 +2282,7 @@ void Scene209::handleMonkeyEating() { _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 10, 4, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 28, 29); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], oldIdx); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SM_0, 0, 209); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 209); } break; @@ -2320,7 +2320,7 @@ void Scene209::handleMonkeyFall() { _scene->_sequences.setAnimRange(_globals._sequenceIndexes[8], 1, 35); _scene->_sequences.setDepth(_globals._sequenceIndexes[8], 6); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], oldIdx); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SM_0, 0, 220); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_EXPIRE, 0, 220); } break; @@ -2335,7 +2335,7 @@ void Scene209::handleMonkeyFall() { _scene->_sequences.setAnimRange(_globals._sequenceIndexes[8], 36, 42); _scene->_sequences.setDepth(_globals._sequenceIndexes[8], 6); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], oldIdx); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SM_0, 0, 221); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_EXPIRE, 0, 221); } break; @@ -2350,7 +2350,7 @@ void Scene209::handleMonkeyFall() { _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 8); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[8], oldIdx); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[8], 43, 72); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SM_0, 0, 222); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_EXPIRE, 0, 222); int idx = _scene->_dynamicHotspots.add(39, 13, _globals._sequenceIndexes[9], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(200, 133), FACING_NORTH); } @@ -2362,7 +2362,7 @@ void Scene209::handleMonkeyFall() { _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[8], 73, 78); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[8], oldIdx); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SM_0, 0, 223); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_EXPIRE, 0, 223); } break; @@ -2388,7 +2388,7 @@ void Scene209::handleMonkey1() { _scene->_sequences.remove(_globals._sequenceIndexes[4]); _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 9, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 1, 13); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SM_0, 0, 213); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 213); break; case 213: { @@ -2396,7 +2396,7 @@ void Scene209::handleMonkey1() { _globals._sequenceIndexes[7] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 7, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[7], 1, 22); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[7], oldIdx); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SM_0, 0, 214); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SEQUENCE_TRIGGER_EXPIRE, 0, 214); } break; @@ -2405,7 +2405,7 @@ void Scene209::handleMonkey1() { _globals._sequenceIndexes[7] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 7, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[7], 23, 26); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[7], oldIdx); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SM_0, 0, 215); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SEQUENCE_TRIGGER_EXPIRE, 0, 215); int msgIndex = _scene->_kernelMessages.add(Common::Point(170, 21), 0xFDFC, 0, 0, 90, _game.getQuote(156)); _scene->_kernelMessages.setQuoted(msgIndex, 3, true); } @@ -2418,7 +2418,7 @@ void Scene209::handleMonkey1() { _globals._sequenceIndexes[7] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 7, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[7], 27, 35); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[7], oldIdx); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SM_0, 0, 216); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SEQUENCE_TRIGGER_EXPIRE, 0, 216); } break; @@ -2448,7 +2448,7 @@ void Scene209::handleMonkey2() { _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[12], Common::Point(111, 133)); _scene->_sequences.setScale(_globals._sequenceIndexes[12], 79); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[12], 1, 6); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SM_0, 0, 252); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SEQUENCE_TRIGGER_EXPIRE, 0, 252); _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; _game._player._visible = false; break; @@ -2806,7 +2806,7 @@ void Scene209::step() { _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 7); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(116, 131)); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SM_0, 0, 228); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 228); break; case 229: { @@ -2825,7 +2825,7 @@ void Scene209::step() { _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 7); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(116, 131)); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SM_0, 0, 231); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 231); break; case 231: { @@ -2835,7 +2835,7 @@ void Scene209::step() { _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(116, 131)); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], oldIdx); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SM_0, 0, 232); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 232); _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], -1); _game._player._visible = false; @@ -2869,14 +2869,14 @@ void Scene209::step() { _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 11, 12); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(116, 131)); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SM_FRAME_INDEX, 12, 239); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SM_0, 0, 235); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_SPRITE, 12, 239); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 235); } else if (_action.isAction(NOUN_SHOOT, NOUN_BLOWGUN, NOUN_MONKEY)) { _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 11, 12); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(116, 131)); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SM_0, 0, 235); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 235); _vm->_sound->command(23); } break; @@ -2899,7 +2899,7 @@ void Scene209::step() { _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 14, 16); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(116, 131)); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SM_0, 0, 237); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 237); break; case 237: @@ -3124,8 +3124,8 @@ void Scene209::actions() { _game._player._visible = false; _globals._sequenceIndexes[11] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[11], false, 3, 2, 0, 0); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[11]); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[11], SM_FRAME_INDEX, 4, 1); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[11], SM_0, 0, 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[11], SEQUENCE_TRIGGER_SPRITE, 4, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[11], SEQUENCE_TRIGGER_EXPIRE, 0, 2); break; case 1: @@ -3156,8 +3156,8 @@ void Scene209::actions() { _game._player._visible = false; _globals._sequenceIndexes[10] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[10], false, 3, 2, 0, 0); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[10]); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[10], SM_FRAME_INDEX, 4, 1); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[10], SM_0, 0, 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[10], SEQUENCE_TRIGGER_SPRITE, 4, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[10], SEQUENCE_TRIGGER_EXPIRE, 0, 2); break; case 1: @@ -4193,7 +4193,7 @@ void Scene210::actions() { _scene->_sequences.remove(_globals._sequenceIndexes[1]); _globals._sequenceIndexes[1] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[1], false, 12, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 5); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SM_0, 0, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 1); break; case 1: @@ -4216,7 +4216,7 @@ void Scene210::actions() { _game._player._facing = FACING_NORTH; _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 12, 0, 0, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 5); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SM_0, 0, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 1); _game._player._stepEnabled = false; break; case 1: @@ -4358,7 +4358,7 @@ void Scene211::enter() { _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 6, 0, 0, 0); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(202, 126)); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 8); - _scene->_sequences.sub70C52(_globals._sequenceIndexes[2], SM_FRAME_INDEX, -200, 0); + _scene->_sequences.sub70C52(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_SPRITE, -200, 0); _scene->_dynamicHotspots.add(324, 13, _globals._sequenceIndexes[2], Common::Rect(1, 1, 41, 10)); } @@ -4701,7 +4701,7 @@ void Scene214::step() { _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 4); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 2); _scene->_dynamicHotspots.add(451, 13, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 71); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 71); } if (_devilRunningFl) { @@ -4713,7 +4713,7 @@ void Scene214::step() { _scene->_dynamicHotspots.add(451, VERB_WALKTO, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 5, 8); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 2); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SM_0, 0, 72); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 72); } break; @@ -4744,13 +4744,13 @@ void Scene214::actions() { _game._player._visible = false; _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], true, 6, 1, 0, 0); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SM_0, 0, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 1); break; case 1: _globals._sequenceIndexes[4] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[4], true, 6, 1, 0, 0); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SM_0, 0, 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 2); _scene->_sequences.remove(_globals._sequenceIndexes[1]); _game._objects.addToInventory(OBJ_POISON_DARTS); _scene->_hotspots.activate(0x114, false); @@ -4773,13 +4773,13 @@ void Scene214::actions() { _game._player._visible = false; _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 6, 1, 0, 0); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SM_0, 0, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 1); break; case 1: _globals._sequenceIndexes[4] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[4], false, 6, 1, 0, 0); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SM_0, 0, 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 2); _scene->_sequences.remove(_globals._sequenceIndexes[2]); _game._objects.addToInventory(OBJ_BLOWGUN); _scene->_hotspots.activate(0x29, false); diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index c74fe44305..601d07d478 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -53,7 +53,7 @@ SequenceEntry::SequenceEntry() { _timeout = 0; _entries._count = 0; - Common::fill(&_entries._mode[0], &_entries._mode[SEQUENCE_ENTRY_SUBSET_MAX], SM_0); + Common::fill(&_entries._mode[0], &_entries._mode[SEQUENCE_ENTRY_SUBSET_MAX], KERNEL_TRIGGER_EXPIRE); Common::fill(&_entries._frameIndex[0], &_entries._frameIndex[SEQUENCE_ENTRY_SUBSET_MAX], 0); Common::fill(&_entries._trigger[0], &_entries._trigger[SEQUENCE_ENTRY_SUBSET_MAX], 0); } @@ -80,7 +80,7 @@ void SequenceList::clear() { } } -bool SequenceList::addSubEntry(int index, SequenceSubEntryMode mode, int frameIndex, int trigger) { +bool SequenceList::addSubEntry(int index, SequenceTrigger mode, int frameIndex, int trigger) { if (_entries[index]._entries._count >= SEQUENCE_ENTRY_SUBSET_MAX) return true; @@ -162,7 +162,7 @@ int SequenceList::addTimer(int time, int abortVal) { se._entries._count = 0; se._triggerMode = _vm->_game->_triggerSetupMode; se._actionNouns = _vm->_game->_scene._action._activeAction; - addSubEntry(seqIndex, SM_0, 0, abortVal); + addSubEntry(seqIndex, KERNEL_TRIGGER_EXPIRE, 0, abortVal); return seqIndex; } @@ -305,14 +305,14 @@ bool SequenceList::loadSprites(int seqIndex) { for (int i = 0; i < seqEntry._entries._count; ++i) { switch (seqEntry._entries._mode[i]) { - case SM_0: - case SM_1: - if (((seqEntry._entries._mode[i] == SM_0) && seqEntry._doneFlag) || - ((seqEntry._entries._mode[i] == SM_1) && result)) + case KERNEL_TRIGGER_EXPIRE: + case KERNEL_TRIGGER_LOOP: + if (((seqEntry._entries._mode[i] == KERNEL_TRIGGER_EXPIRE) && seqEntry._doneFlag) || + ((seqEntry._entries._mode[i] == KERNEL_TRIGGER_LOOP) && result)) idx = i; break; - case SM_FRAME_INDEX: { + case KERNEL_TRIGGER_SPRITE: { int v = seqEntry._entries._frameIndex[i]; if ((v == seqEntry._frameIndex) || (v == 0)) idx = i; diff --git a/engines/mads/sequence.h b/engines/mads/sequence.h index 99e8951688..53a8afe071 100644 --- a/engines/mads/sequence.h +++ b/engines/mads/sequence.h @@ -32,7 +32,11 @@ namespace MADS { class SpriteSlot; -enum SequenceSubEntryMode { SM_0 = 0, SM_1 = 1, SM_FRAME_INDEX = 2 }; +enum SequenceTrigger { + SEQUENCE_TRIGGER_EXPIRE = 0, // Trigger when the sequence finishes + SEQUENCE_TRIGGER_LOOP = 1, // Trigger when the sequence loops + SEQUENCE_TRIGGER_SPRITE = 2 // Trigger when sequence reaches specific sprite +}; enum SpriteAnimType { ANIMTYPE_NONE = 0, ANIMTYPE_CYCLED = 1, ANIMTYPE_REVERSIBLE = 2 }; @@ -40,7 +44,7 @@ enum SpriteAnimType { ANIMTYPE_NONE = 0, ANIMTYPE_CYCLED = 1, ANIMTYPE_REVERSIBL struct SequenceSubEntries { int _count; - SequenceSubEntryMode _mode[SEQUENCE_ENTRY_SUBSET_MAX]; + SequenceTrigger _mode[SEQUENCE_ENTRY_SUBSET_MAX]; int _frameIndex[SEQUENCE_ENTRY_SUBSET_MAX]; int8 _trigger[SEQUENCE_ENTRY_SUBSET_MAX]; }; @@ -95,7 +99,7 @@ public: SequenceEntry &operator[](int index) { return _entries[index]; } void clear(); - bool addSubEntry(int index, SequenceSubEntryMode mode, int frameIndex, int trigger); + bool addSubEntry(int index, SequenceTrigger mode, int frameIndex, int trigger); int add(int spriteListIndex, bool flipped, int frameIndex, int triggerCountdown, int delayTicks, int extraTicks, int numTicks, int msgX, int msgY, bool nonFixed, char scale, uint8 depth, int frameInc, SpriteAnimType animType, int numSprites, int frameStart); -- cgit v1.2.3 From 0b340a034330fd5124b1534544a8ef9500349411 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 15 Apr 2014 23:51:41 -0400 Subject: MADS: Fix depth issues with sitting in chair in scene 101 --- engines/mads/action.h | 6 +++--- engines/mads/animation.cpp | 2 +- engines/mads/game.cpp | 6 +++--- engines/mads/messages.cpp | 2 +- engines/mads/msurface.cpp | 2 +- engines/mads/nebular/nebular_scenes1.cpp | 6 +++--- engines/mads/nebular/nebular_scenes2.cpp | 8 ++++---- engines/mads/scene.cpp | 16 ++++++++-------- engines/mads/scene_data.cpp | 2 +- engines/mads/sequence.cpp | 20 ++++++++++---------- engines/mads/sequence.h | 2 +- 11 files changed, 36 insertions(+), 36 deletions(-) diff --git a/engines/mads/action.h b/engines/mads/action.h index 6b3f1ca3c2..599fb0e4f9 100644 --- a/engines/mads/action.h +++ b/engines/mads/action.h @@ -29,9 +29,9 @@ namespace MADS { enum TriggerMode { - KERNEL_TRIGGER_PARSER = 0, // Triggers parser - KERNEL_TRIGGER_DAEMON = 1, // Triggers step/daemon code - KERNEL_TRIGGER_PREPARE = 2 // Triggers preparser + SEQUENCE_TRIGGER_PARSER = 0, // Triggers parser + SEQUENCE_TRIGGER_DAEMON = 1, // Triggers step/daemon code + SEQUENCE_TRIGGER_PREPARE = 2 // Triggers preparser }; enum InterAwaiting { diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index 06eeaf8278..93cc72f613 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -590,7 +590,7 @@ void Animation::update() { _vm->_game->_trigger = _trigger; _vm->_game->_triggerMode = _triggerMode; - if (_triggerMode != KERNEL_TRIGGER_DAEMON) { + if (_triggerMode != SEQUENCE_TRIGGER_DAEMON) { // Copy the noun list scene._action._action = _actionDetails; } diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index a6650555ce..bf3822da09 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -57,8 +57,8 @@ Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm), _aaName = "*I0.AA"; _priorFrameTimer = 0; _anyEmergency = false; - _triggerMode = KERNEL_TRIGGER_PARSER; - _triggerSetupMode = KERNEL_TRIGGER_DAEMON; + _triggerMode = SEQUENCE_TRIGGER_PARSER; + _triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _winStatus = 0; _widepipeCtr = 0; @@ -238,7 +238,7 @@ void Game::sectionLoop() { _priorFrameTimer = _scene._frameStartTime; // Call the scene logic for entering the given scene - _triggerSetupMode = KERNEL_TRIGGER_DAEMON; + _triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _scene._sceneLogic->enter(); // Set player data diff --git a/engines/mads/messages.cpp b/engines/mads/messages.cpp index 3903b71766..46b05c1413 100644 --- a/engines/mads/messages.cpp +++ b/engines/mads/messages.cpp @@ -179,7 +179,7 @@ void KernelMessages::processText(int msgIndex) { _vm->_game->_trigger = msg._trigger; _vm->_game->_triggerMode = msg._abortMode; - if (_vm->_game->_triggerMode != KERNEL_TRIGGER_DAEMON) { + if (_vm->_game->_triggerMode != SEQUENCE_TRIGGER_DAEMON) { scene._action._activeAction = msg._actionDetails; } } diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp index 8f40173f13..2c9d093877 100644 --- a/engines/mads/msurface.cpp +++ b/engines/mads/msurface.cpp @@ -516,7 +516,7 @@ int DepthSurface::getDepth(const Common::Point &pt) { return v >> bits; } else { if (pt.x < 0 || pt.y < 0 || pt.x >= this->w || pt.y >= this->h) - return 8; + return 0; return *getBasePtr(pt.x, pt.y) & 0xF; } diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index ec81b5f356..bb5229ef16 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -106,7 +106,7 @@ void Scene101::setup() { } void Scene101::sayDang() { - _game._triggerSetupMode = KERNEL_TRIGGER_DAEMON; + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _game._player._stepEnabled = false; switch (_game._trigger) { @@ -608,7 +608,7 @@ void Scene102::setup() { void Scene102::addRandomMessage() { _scene->_kernelMessages.reset(); - _game._triggerSetupMode = KERNEL_TRIGGER_DAEMON; + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; int quoteId = _vm->getRandomNumber(65, 69); _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 73, 120, _game.getQuote(quoteId)); _activeMsgFl = true; @@ -838,7 +838,7 @@ void Scene102::actions() { Common::String curQuote = _game.getQuote(quoteId); int width = _vm->_font->getWidth(curQuote, -1); _scene->_kernelMessages.reset(); - _game._triggerSetupMode = KERNEL_TRIGGER_DAEMON; + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _scene->_kernelMessages.add(Common::Point(210, 60), 0x1110, 0, 73, 120, curQuote); _scene->_kernelMessages.add(Common::Point(214 + width, 60), 0x1110, 0, 73, 120, _game.getQuote(64)); _activeMsgFl = true; diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 36f291973b..96f6c6d400 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -455,7 +455,7 @@ void Scene202::enter() { void Scene202::setRandomKernelMessage() { int vocabId = _vm->getRandomNumber(92, 96); _scene->_kernelMessages.reset(); - _game._triggerSetupMode = KERNEL_TRIGGER_DAEMON; + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 70, 120, _game.getQuote(vocabId)); _activeMsgFl = true; } @@ -491,7 +491,7 @@ void Scene202::step() { _action._activeAction._verbId = VERB_LOOK; _action._activeAction._objectNameId = 39; _action._activeAction._indirectObjectId = 438; - _game._triggerSetupMode = KERNEL_TRIGGER_PARSER; + _game._triggerSetupMode = SEQUENCE_TRIGGER_PARSER; _scene->_sequences.addTimer(120, 2); _globals._abortVal = -1; } else if (_globals[kMeteorologistWatch] == 2) { @@ -3087,7 +3087,7 @@ void Scene209::actions() { if ((_action.isAction(NOUN_SHOOT) || _action.isAction(NOUN_HOSE_DOWN)) && _action.isAction(NOUN_MONKEY) && _action.isAction(NOUN_BLOWGUN) && _game._objects.isInInventory(OBJ_BLOWGUN) && _game._objects.isInInventory(OBJ_POISON_DARTS)) { if (_action.isAction(NOUN_SHOOT, NOUN_BLOWGUN, NOUN_MONKEY) && !_startShootingInTimerFl) { - _game._triggerSetupMode = KERNEL_TRIGGER_DAEMON; + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _scene->_sequences.addTimer(1, 231); _startShootingInTimerFl = true; _game._player._stepEnabled = false; @@ -3097,7 +3097,7 @@ void Scene209::actions() { } if (_action.isAction(NOUN_HOSE_DOWN, NOUN_BLOWGUN, NOUN_MONKEY) && !_startShootingInTimerFl) { - _game._triggerSetupMode = KERNEL_TRIGGER_DAEMON; + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _scene->_sequences.addTimer(1, 228); _game._player._stepEnabled = false; _fallFl = true; diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index a112228859..948688e7a2 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -313,7 +313,7 @@ void Scene::doFrame() { flag = true; } - if (flag || (_vm->_game->_trigger && _vm->_game->_triggerMode == KERNEL_TRIGGER_PREPARE)) { + if (flag || (_vm->_game->_trigger && _vm->_game->_triggerMode == SEQUENCE_TRIGGER_PREPARE)) { doPreactions(); } @@ -324,7 +324,7 @@ void Scene::doFrame() { // Handle parser actions as well as game triggers if ((_action._inProgress && !player._moving && !player._needToWalk && (player._facing == player._turnToFacing) && !_vm->_game->_trigger) || - (_vm->_game->_trigger && (_vm->_game->_triggerMode == KERNEL_TRIGGER_PARSER))) { + (_vm->_game->_trigger && (_vm->_game->_triggerMode == SEQUENCE_TRIGGER_PARSER))) { doAction(); } @@ -442,11 +442,11 @@ void Scene::drawElements(ScreenTransition transitionType, bool surfaceFlag) { void Scene::doPreactions() { if (_vm->_game->_screenObjects._inputMode == kInputBuildingSentences || _vm->_game->_screenObjects._inputMode == kInputLimitedSentences) { - _vm->_game->_triggerSetupMode = KERNEL_TRIGGER_PREPARE; + _vm->_game->_triggerSetupMode = SEQUENCE_TRIGGER_PREPARE; _action.checkAction(); _sceneLogic->preActions(); - if (_vm->_game->_triggerMode == KERNEL_TRIGGER_PREPARE) + if (_vm->_game->_triggerMode == SEQUENCE_TRIGGER_PREPARE) _vm->_game->_trigger = 0; } } @@ -454,7 +454,7 @@ void Scene::doPreactions() { void Scene::doAction() { bool flag = false; - _vm->_game->_triggerSetupMode = KERNEL_TRIGGER_PARSER; + _vm->_game->_triggerSetupMode = SEQUENCE_TRIGGER_PARSER; if ((_action._inProgress || _vm->_game->_trigger) && !_action._savedFields._commandError) { _sceneLogic->actions(); flag = !_action._inProgress; @@ -491,17 +491,17 @@ void Scene::doAction() { } _action._inProgress = false; - if (_vm->_game->_triggerMode == KERNEL_TRIGGER_PARSER) + if (_vm->_game->_triggerMode == SEQUENCE_TRIGGER_PARSER) _vm->_game->_trigger = 0; } void Scene::doSceneStep() { - _vm->_game->_triggerSetupMode = KERNEL_TRIGGER_DAEMON; + _vm->_game->_triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _sceneLogic->step(); _vm->_game->_sectionHandler->step(); _vm->_game->step(); - if (_vm->_game->_triggerMode == KERNEL_TRIGGER_DAEMON) + if (_vm->_game->_triggerMode == SEQUENCE_TRIGGER_DAEMON) _vm->_game->_trigger = 0; } diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index a82f65a6f0..6eb6be2c1e 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -41,7 +41,7 @@ KernelMessage::KernelMessage() { _frameTimer = 0; _timeout = 0; _trigger = 0; - _abortMode = KERNEL_TRIGGER_PARSER; + _abortMode = SEQUENCE_TRIGGER_PARSER; _actionDetails._verbId = VERB_NONE; _actionDetails._objectNameId = 0; _actionDetails._indirectObjectId = 0; diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index 601d07d478..3c2bab5329 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -47,13 +47,13 @@ SequenceEntry::SequenceEntry() { _field22 = 0; _triggerCountdown = 0; _doneFlag = 0; - _triggerMode = KERNEL_TRIGGER_DAEMON; + _triggerMode = SEQUENCE_TRIGGER_DAEMON; _numTicks = 0; _extraTicks = 0; _timeout = 0; _entries._count = 0; - Common::fill(&_entries._mode[0], &_entries._mode[SEQUENCE_ENTRY_SUBSET_MAX], KERNEL_TRIGGER_EXPIRE); + Common::fill(&_entries._mode[0], &_entries._mode[SEQUENCE_ENTRY_SUBSET_MAX], SEQUENCE_TRIGGER_EXPIRE); Common::fill(&_entries._frameIndex[0], &_entries._frameIndex[SEQUENCE_ENTRY_SUBSET_MAX], 0); Common::fill(&_entries._trigger[0], &_entries._trigger[SEQUENCE_ENTRY_SUBSET_MAX], 0); } @@ -93,7 +93,7 @@ bool SequenceList::addSubEntry(int index, SequenceTrigger mode, int frameIndex, } int SequenceList::add(int spriteListIndex, bool flipped, int frameIndex, int triggerCountdown, int delayTicks, int extraTicks, int numTicks, - int msgX, int msgY, bool nonFixed, char scale, uint8 depth, int frameInc, SpriteAnimType animType, int numSprites, + int msgX, int msgY, bool nonFixed, int scale, int depth, int frameInc, SpriteAnimType animType, int numSprites, int frameStart) { Scene &scene = _vm->_game->_scene; @@ -162,7 +162,7 @@ int SequenceList::addTimer(int time, int abortVal) { se._entries._count = 0; se._triggerMode = _vm->_game->_triggerSetupMode; se._actionNouns = _vm->_game->_scene._action._activeAction; - addSubEntry(seqIndex, KERNEL_TRIGGER_EXPIRE, 0, abortVal); + addSubEntry(seqIndex, SEQUENCE_TRIGGER_EXPIRE, 0, abortVal); return seqIndex; } @@ -305,14 +305,14 @@ bool SequenceList::loadSprites(int seqIndex) { for (int i = 0; i < seqEntry._entries._count; ++i) { switch (seqEntry._entries._mode[i]) { - case KERNEL_TRIGGER_EXPIRE: - case KERNEL_TRIGGER_LOOP: - if (((seqEntry._entries._mode[i] == KERNEL_TRIGGER_EXPIRE) && seqEntry._doneFlag) || - ((seqEntry._entries._mode[i] == KERNEL_TRIGGER_LOOP) && result)) + case SEQUENCE_TRIGGER_EXPIRE: + case SEQUENCE_TRIGGER_LOOP: + if (((seqEntry._entries._mode[i] == SEQUENCE_TRIGGER_EXPIRE) && seqEntry._doneFlag) || + ((seqEntry._entries._mode[i] == SEQUENCE_TRIGGER_LOOP) && result)) idx = i; break; - case KERNEL_TRIGGER_SPRITE: { + case SEQUENCE_TRIGGER_SPRITE: { int v = seqEntry._entries._frameIndex[i]; if ((v == seqEntry._frameIndex) || (v == 0)) idx = i; @@ -328,7 +328,7 @@ bool SequenceList::loadSprites(int seqIndex) { _vm->_game->_trigger = seqEntry._entries._trigger[idx]; _vm->_game->_triggerMode = seqEntry._triggerMode; - if (seqEntry._triggerMode != KERNEL_TRIGGER_DAEMON) + if (seqEntry._triggerMode != SEQUENCE_TRIGGER_DAEMON) scene._action._activeAction = seqEntry._actionNouns; } diff --git a/engines/mads/sequence.h b/engines/mads/sequence.h index 53a8afe071..6d59175ba2 100644 --- a/engines/mads/sequence.h +++ b/engines/mads/sequence.h @@ -101,7 +101,7 @@ public: void clear(); bool addSubEntry(int index, SequenceTrigger mode, int frameIndex, int trigger); int add(int spriteListIndex, bool flipped, int frameIndex, int triggerCountdown, int delayTicks, - int extraTicks, int numTicks, int msgX, int msgY, bool nonFixed, char scale, uint8 depth, + int extraTicks, int numTicks, int msgX, int msgY, bool nonFixed, int scale, int depth, int frameInc, SpriteAnimType animType, int numSprites, int frameStart); int addTimer(int time, int abortVal); -- cgit v1.2.3 From eb26b70fc55e47a44faefba2fca9570850a25ff2 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 16 Apr 2014 07:44:22 +0200 Subject: MADS: Fix rects in scene 202, 210, 211, implement scene 215 --- engines/mads/nebular/nebular_scenes.cpp | 2 + engines/mads/nebular/nebular_scenes2.cpp | 129 ++++++++++++++++++++++++++++++- engines/mads/nebular/nebular_scenes2.h | 12 +++ 3 files changed, 139 insertions(+), 4 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index bf8e5b7140..7f3a7a44e8 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -96,6 +96,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 214: return new Scene214(vm); + case 215: + return new Scene215(vm); // Scene group #8 case 804: diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 96f6c6d400..45ea496132 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -803,7 +803,7 @@ void Scene202::actions() { _game._player._visible = false; _game._player._stepEnabled = false; - _ladderHotspotId = _scene->_dynamicHotspots.add(199, 79, -1, Common::Rect(241, 68, 12, 54)); + _ladderHotspotId = _scene->_dynamicHotspots.add(199, 79, -1, Common::Rect(241, 68, 241 + 12, 68 + 54)); _scene->_dynamicHotspots.setPosition(_ladderHotspotId, Common::Point(246, 124), FACING_NORTH); _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 6, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[8], 1); @@ -3823,7 +3823,7 @@ void Scene210::enter() { _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 5); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 5); } else { - int idx = _scene->_dynamicHotspots.add(112, 395, -1, Common::Rect(163, 87, 19, 36)); + int idx = _scene->_dynamicHotspots.add(112, 395, -1, Common::Rect(163, 87, 163 + 19, 87 + 36)); _doorway = _scene->_dynamicHotspots.setPosition(idx, Common::Point(168, 127), FACING_NORTH); _scene->_dynamicHotspots.setCursor(_doorway, CURSOR_GO_UP); } @@ -4199,7 +4199,7 @@ void Scene210::actions() { case 1: _game._player._stepEnabled = true; _globals[kCurtainOpen] = true; - _doorway = _scene->_dynamicHotspots.add(112, 395, -1, Common::Rect(163, 87, 19, 36)); + _doorway = _scene->_dynamicHotspots.add(112, 395, -1, Common::Rect(163, 87, 163 + 19, 87 + 36)); _scene->_dynamicHotspots.setPosition(_doorway, Common::Point(168, 127), FACING_NORTH); _scene->_dynamicHotspots.setCursor(_doorway, CURSOR_GO_UP); break; @@ -4359,7 +4359,7 @@ void Scene211::enter() { _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(202, 126)); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 8); _scene->_sequences.sub70C52(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_SPRITE, -200, 0); - _scene->_dynamicHotspots.add(324, 13, _globals._sequenceIndexes[2], Common::Rect(1, 1, 41, 10)); + _scene->_dynamicHotspots.add(324, 13, _globals._sequenceIndexes[2], Common::Rect(1, 1, 1 + 41, 1 + 10)); } if (_scene->_roomChanged) @@ -4859,5 +4859,126 @@ void Scene214::actions() { /*------------------------------------------------------------------------*/ +void Scene215::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene215::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('e', 0)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('a', 0)); + + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle (_globals._spriteIndexes[1], false, 7, 0, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(235, 83)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 15); + + if (_globals[kSexOfRex] == REX_MALE) + _globals._spriteIndexes[2] = _scene->_sprites.addSprites("*RXMRC_9"); + else + _globals._spriteIndexes[2] = _scene->_sprites.addSprites("*ROXRC_9"); + + if (_scene->_priorSceneId == 216) { + _game._player._playerPos = Common::Point(140, 119); + _game._player._facing = FACING_SOUTHWEST; + _game._player._visible = false; + _game._player._stepEnabled = false; + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); + _scene->_sequences.addTimer(120, 70); + } else if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(204, 152); + _game._player._facing = FACING_NORTH; + } + + _game.loadQuoteSet(0xA9, 0xAA, 0); + sceneEntrySound(); +} + +void Scene215::step() { + if (_game._trigger == 70) { + _scene->_sequences.remove (_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 6, 1, 0, 0); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 71); + } + + if (_game._trigger == 71) { + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[3]); + _game._player._visible = true; + _game._player._stepEnabled = true; + } +} + +void Scene215::actions() { + if (_action._lookFlag) + _vm->_dialogs->show(0x5405); + else if (_action.isAction(VERB_TAKE, 0x17A)) { + if (!_game._objects.isInInventory(OBJ_TWINKIFRUIT) || _game._trigger) { + switch (_game._trigger) { + case 0: + if (_globals[kSexOfRex] == REX_MALE) { + _game._player._visible = false; + _game._player._stepEnabled = false; + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 6, 2, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 4); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[2]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_LOOP, 0, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + } else { + _game._objects.addToInventory(OBJ_TWINKIFRUIT); + _vm->_dialogs->showItem(OBJ_TWINKIFRUIT, 0x5404); + } + break; + + case 1: + if (!_game._objects.isInInventory(OBJ_TWINKIFRUIT)) { + _game._objects.addToInventory(OBJ_TWINKIFRUIT); + _vm->_dialogs->showItem(OBJ_TWINKIFRUIT, 0x5404); + } + break; + + case 2: + _game._player._visible = true; + _game._player._stepEnabled = true; + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[2]); + break; + } + } else { + int idx = _vm->getRandomNumber(169, 170); + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(idx)); + } + } else if (_action.isAction(0x18A, 0xAA)) + _scene->_nextSceneId = 210; + else if (_action.isAction(VERB_LOOK, 0x21)) + _vm->_dialogs->show(0x53FD); + else if (_action.isAction(VERB_LOOK, 0x1CB)) + _vm->_dialogs->show(0x53FE); + else if (_action.isAction(VERB_LOOK, 0x3A3)) + _vm->_dialogs->show(0x53FF); + else if (_action.isAction(VERB_LOOK, 0xD5)) + _vm->_dialogs->show(0x5400); + else if (_action.isAction(VERB_LOOK, 0x197)) + _vm->_dialogs->show(0x5401); + else if (_action.isAction(VERB_LOOK, 0x289)) + _vm->_dialogs->show(0x5402); + else if (_action.isAction(VERB_LOOK, 0x17A) && (_action._savedFields._mainObjectSource == 4)) + _vm->_dialogs->show(0x5403); + else if (_action.isAction(VERB_TAKE, 0x21)) + _vm->_dialogs->show(0x5406); + else if (_action.isAction(VERB_TAKE, 0xD5)) + _vm->_dialogs->show(0x5407); + else if (_action.isAction(VERB_LOOK, 0x1CA)) + _vm->_dialogs->show(0x5408); + else if (_action.isAction(VERB_TAKE, 0x1CA)) + _vm->_dialogs->show(0x5409); + else if (_action.isAction(VERB_TAKE, 0x3A3)) + _vm->_dialogs->show(0x540A); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index c6ef759c1e..c5a9cb8426 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -281,6 +281,18 @@ public: virtual void actions(); virtual void postActions() {}; }; + +class Scene215: public Scene2xx { +public: + Scene215(MADSEngine *vm) : Scene2xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions(); + virtual void postActions() {}; +}; } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From ec9c7166abe03e19a663082649fc5be12bc5dae5 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 16 Apr 2014 07:54:46 +0200 Subject: MADS: Remove some useless accolades, implement scene 216 --- engines/mads/nebular/nebular_scenes.cpp | 2 + engines/mads/nebular/nebular_scenes2.cpp | 68 +++++++++++++++++++++----------- engines/mads/nebular/nebular_scenes2.h | 12 ++++++ 3 files changed, 59 insertions(+), 23 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 7f3a7a44e8..562f31c3b2 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -98,6 +98,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene214(vm); case 215: return new Scene215(vm); + case 216: + return new Scene216(vm); // Scene group #8 case 804: diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 45ea496132..6080c09fd4 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -4537,12 +4537,11 @@ void Scene211::preActions() { && (_scene->_customDest.x <= 52) && (_scene->_customDest.y >= 132)) _game._player.walk(Common::Point(52, 132), FACING_WEST); - if (_action.isAction(0x1AD, 0x1AE)) { - if (_game._objects.isInInventory(OBJ_BINOCULARS) && (_globals[kMonkeyStatus] == MONKEY_AMBUSH_READY) ) { + if (_action.isAction(0x1AD, 0x1AE)) { + if (_game._objects.isInInventory(OBJ_BINOCULARS) && (_globals[kMonkeyStatus] == MONKEY_AMBUSH_READY)) _game._player.walk(Common::Point(52, 132), FACING_WEST); - } else { + else _game._player._walkOffScreenSceneId = 210; - } } if (_action.isAction(0x1AD, 0x1B1)) @@ -4550,16 +4549,16 @@ void Scene211::preActions() { } void Scene211::actions() { - if (_action._lookFlag && (_globals[kMonkeyStatus] == MONKEY_AMBUSH_READY)) { + if (_action._lookFlag && (_globals[kMonkeyStatus] == MONKEY_AMBUSH_READY)) _vm->_dialogs->show(0x5277); - } else if (_action.isAction(VERB_LOOK, 0x27, 0x100)) { + else if (_action.isAction(VERB_LOOK, 0x27, 0x100)) _vm->_dialogs->show(0x527C); - } else if (_action.isAction(VERB_LOOK, 0x3A)) { + else if (_action.isAction(VERB_LOOK, 0x3A)) _vm->_dialogs->show(0x526D); - } else if (_action.isAction(VERB_LOOK, 0x1B2)) { + else if (_action.isAction(VERB_LOOK, 0x1B2)) _vm->_dialogs->show(0x526E); - } else if (_action.isAction(VERB_LOOK, 0x100)) { - if (_globals[kMonkeyStatus] == MONKEY_AMBUSH_READY) { + else if (_action.isAction(VERB_LOOK, 0x100)) { + if (_globals[kMonkeyStatus] == MONKEY_AMBUSH_READY) { if (_game._storyMode == STORYMODE_NAUGHTY) _vm->_dialogs->show(0x526F); else @@ -4572,19 +4571,19 @@ void Scene211::actions() { _vm->_dialogs->show(0x5272); else _vm->_dialogs->show(0x5273); - } else if (_action.isAction(VERB_LOOK, 0xB8)) { + } else if (_action.isAction(VERB_LOOK, 0xB8)) _vm->_dialogs->show(0x5274); - } else if (_action.isAction(VERB_LOOK, 0x1B1)) { + else if (_action.isAction(VERB_LOOK, 0x1B1)) _vm->_dialogs->show(0x5275); - } else if (_action.isAction(VERB_LOOK, 0x1AE)) { + else if (_action.isAction(VERB_LOOK, 0x1AE)) _vm->_dialogs->show(0x5276); - } else if (_action.isAction(VERB_LOOK, 0x144)) { + else if (_action.isAction(VERB_LOOK, 0x144)) _vm->_dialogs->show(0x5279); - } else if (_action.isAction(VERB_TAKE, 0x144)) { + else if (_action.isAction(VERB_TAKE, 0x144)) _vm->_dialogs->show(0x527A); - } else if (_action.isAction(VERB_LOOK, 0x129)) { + else if (_action.isAction(VERB_LOOK, 0x129)) _vm->_dialogs->show(0x527B); - } else + else return; _action._inProgress = false; @@ -4681,7 +4680,7 @@ void Scene214::enter() { } if (_game._objects.isInRoom(OBJ_BLOWGUN)) { - _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 6, 0, 0, 0); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 6, 0, 0, 0); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(90, 87)); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 13); } else { @@ -4741,7 +4740,7 @@ void Scene214::actions() { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; - _game._player._visible = false; + _game._player._visible = false; _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], true, 6, 1, 0, 0); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 1); @@ -4846,7 +4845,7 @@ void Scene214::actions() { _vm->_dialogs->show(0x53AF); } else if (_game._objects.isInRoom(OBJ_POISON_DARTS) && !_game._objects.isInRoom(OBJ_BLOWGUN)) { _vm->_dialogs->show(0x53B0); - } else if (!_game._objects.isInRoom(OBJ_POISON_DARTS) && _game._objects.isInRoom(OBJ_BLOWGUN)) { + } else if (!_game._objects.isInRoom(OBJ_POISON_DARTS) && _game._objects.isInRoom(OBJ_BLOWGUN)) { _vm->_dialogs->show(0x53B1); } else { _vm->_dialogs->show(0x53B2); @@ -4868,7 +4867,7 @@ void Scene215::enter() { _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('e', 0)); _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('a', 0)); - _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle (_globals._spriteIndexes[1], false, 7, 0, 0, 0); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle (_globals._spriteIndexes[1], false, 7, 0, 0, 0); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(235, 83)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 15); @@ -4936,7 +4935,7 @@ void Scene215::actions() { break; case 2: - _game._player._visible = true; + _game._player._visible = true; _game._player._stepEnabled = true; _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[2]); break; @@ -4980,5 +4979,28 @@ void Scene215::actions() { /*------------------------------------------------------------------------*/ +void Scene216::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene216::enter() { + _game._player._stepEnabled = false; + _game._player._visible = false; + + _scene->_userInterface.emptyTalkList(); + _scene->_userInterface.setup(kInputConversation); + _scene->loadAnimation(formAnimName('A', -1), 60); + + sceneEntrySound(); +} + +void Scene216::step() { + if (_game._trigger == 60) + _scene->_nextSceneId = 215; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index c5a9cb8426..2537b113f8 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -293,6 +293,18 @@ public: virtual void actions(); virtual void postActions() {}; }; + +class Scene216: public Scene2xx { +public: + Scene216(MADSEngine *vm) : Scene2xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions() {}; + virtual void postActions() {}; +}; } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 48f49eeb8029a36931373de1927aac8021783337 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 16 Apr 2014 08:27:13 -0400 Subject: MADS: Fix player/sprite setup/teardown for scene 112 --- engines/mads/game.cpp | 4 ++-- engines/mads/player.cpp | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index bf3822da09..82a7b66c92 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -274,8 +274,8 @@ void Game::sectionLoop() { _vm->_events->waitCursor(); _kernelMode = KERNEL_ROOM_PRELOAD; - delete _scene._animationData; - _scene._animationData = nullptr; + delete _scene._activeAnimation; + _scene._activeAnimation = nullptr; _scene._reloadSceneFlag = false; diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index b55d3f0285..9301fdc50a 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -201,6 +201,10 @@ void Player::selectSeries() { _mirror = true; } + // If the user isn't to be present (such as for a cutscene), exit immediately + if ((_spritesStart + _spritesIdx) < 0) + return; + SpriteAsset &spriteSet = *scene._sprites[_spritesStart + _spritesIdx]; assert(spriteSet._charInfo); _velocity = MAX(spriteSet._charInfo->_velocity, 100); @@ -219,6 +223,9 @@ void Player::selectSeries() { } void Player::updateFrame() { + if ((_spritesStart + _spritesIdx) < 0) + return; + Scene &scene = _vm->_game->_scene; SpriteAsset &spriteSet = *scene._sprites[_spritesStart + _spritesIdx]; assert(spriteSet._charInfo); @@ -490,6 +497,9 @@ void Player::idle() { return; } + if ((_spritesStart + _spritesIdx) < 0) + return; + SpriteAsset &spriteSet = *scene._sprites[_spritesStart + _spritesIdx]; assert(spriteSet._charInfo); if (spriteSet._charInfo->_numEntries == 0) -- cgit v1.2.3 From 9f67216b11c8c744430d106f36a77068ed8e55d6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 16 Apr 2014 08:44:12 -0400 Subject: MADS: Fix to stop game ending when loading a cutscene scene --- engines/mads/game.cpp | 4 +--- engines/mads/player.cpp | 2 +- engines/mads/scene.cpp | 2 +- engines/mads/scene.h | 4 ++-- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 82a7b66c92..d3e3987d4e 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -288,11 +288,9 @@ void Game::sectionLoop() { } // Clear the scene - _scene.free(); + _scene.freeCurrentScene(); _sectionNumber = _scene._nextSceneId / 100; - // TODO: sub_1DD46(3) - // Check whether to show a dialog checkShowDialog(); } diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index 9301fdc50a..cc482c0608 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -135,7 +135,7 @@ bool Player::loadSprites(const Common::String &prefix) { } else { Common::fill(&_spriteSetsPresent[0], &_spriteSetsPresent[PLAYER_SPRITES_FILE_COUNT], false); _highSprites = false; - return true; + return false; } } diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 948688e7a2..e2892fbbd1 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -563,7 +563,7 @@ void Scene::updateCursor() { } } -void Scene::free() { +void Scene::freeCurrentScene() { if (_animationData) { delete _animationData; _animationData = nullptr; diff --git a/engines/mads/scene.h b/engines/mads/scene.h index e00924a543..f18d6ad4cd 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -207,9 +207,9 @@ public: Common::String getVocab(int vocabId) { return _vocabStrings[vocabId - 1]; } /** - * Clear the data for the scene + * Clear the data for the currently loaded scene */ - void free(); + void freeCurrentScene(); /** * Set the walk surface for a scene to a different variant -- cgit v1.2.3 From c2bf78848d26d51593ab4f08ad361bbf9fa2d13c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 16 Apr 2014 09:24:10 -0400 Subject: MADS: Fix drawing background sprites --- engines/mads/assets.cpp | 8 ++------ engines/mads/assets.h | 1 - engines/mads/sprites.cpp | 3 ++- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/engines/mads/assets.cpp b/engines/mads/assets.cpp index 3e18a6711e..bb6f5bd1eb 100644 --- a/engines/mads/assets.cpp +++ b/engines/mads/assets.cpp @@ -203,16 +203,12 @@ MSprite *SpriteAsset::getFrame(int frameIndex) { void SpriteAsset::drawScaled(int frameNumber, MSurface &depthSurface, MSurface &destSurface, int scale, int depth, const Common::Point &pos) { - warning("TODO: SpriteAsset::drawScaled"); -} - -void SpriteAsset::draw(MSurface *surface, int frameNumber, const Common::Point &pt) { - error("TODO: draw"); + error("TODO: SpriteAsset::drawScaled - map to frame methods"); } void SpriteAsset::depthDraw(MSurface *surface, MSurface *depthSurface, int frameNumber, const Common::Point &pt, int depth) { - error("TODO: depthDraw"); + error("TODO: map depthDraw to frame draw methods"); } /*------------------------------------------------------------------------*/ diff --git a/engines/mads/assets.h b/engines/mads/assets.h index a5d3b3ecef..dfe6db086e 100644 --- a/engines/mads/assets.h +++ b/engines/mads/assets.h @@ -108,7 +108,6 @@ public: void drawScaled(int frameNumber, MSurface &depthSurface, MSurface &destSurface, int scale, int depth, const Common::Point &pos); - void draw(MSurface *surface, int frameNumber, const Common::Point &pt); void depthDraw(MSurface *surface, MSurface *depthSurface, int frameNumber, const Common::Point &pt, int depth); }; diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp index 85e36d6c76..f187295b00 100644 --- a/engines/mads/sprites.cpp +++ b/engines/mads/sprites.cpp @@ -254,8 +254,9 @@ void SpriteSlots::drawBackground() { pt.y -= frame->h / 2; } + if (spriteSlot._depth <= 1) { - asset->draw(&scene._backgroundSurface, spriteSlot._frameNumber, pt); + frame->copyTo(&scene._backgroundSurface, frame->getTransparencyIndex()); } else if (scene._depthStyle == 0) { asset->depthDraw(&scene._backgroundSurface, &scene._depthSurface, spriteSlot._frameNumber, pt, spriteSlot._depth); -- cgit v1.2.3 From c7567a90ca248c8e422769c11a2e24c3129a4f13 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 16 Apr 2014 17:31:21 +0200 Subject: MADS: Add scene3xx functions --- engines/mads/module.mk | 1 + engines/mads/nebular/nebular_scenes3.cpp | 135 +++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes3.h | 55 +++++++++++++ 3 files changed, 191 insertions(+) create mode 100644 engines/mads/nebular/nebular_scenes3.cpp create mode 100644 engines/mads/nebular/nebular_scenes3.h diff --git a/engines/mads/module.mk b/engines/mads/module.mk index 13b4f8589b..716521d6ec 100644 --- a/engines/mads/module.mk +++ b/engines/mads/module.mk @@ -8,6 +8,7 @@ MODULE_OBJS := \ nebular/nebular_scenes.o \ nebular/nebular_scenes1.o \ nebular/nebular_scenes2.o \ + nebular/nebular_scenes3.o \ nebular/nebular_scenes8.o \ action.o \ animation.o \ diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp new file mode 100644 index 0000000000..d74d275b22 --- /dev/null +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -0,0 +1,135 @@ +/* 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 "common/scummsys.h" +#include "mads/mads.h" +#include "mads/scene.h" +#include "mads/nebular/nebular_scenes.h" +#include "mads/nebular/nebular_scenes3.h" + +namespace MADS { + +namespace Nebular { + +void Scene3xx::setAAName() { + _game._aaName = Resources::formatAAName(4); +} + +void Scene3xx::setPlayerSpritesPrefix() { + _vm->_sound->command(5); + + Common::String oldName = _game._player._spritesPrefix; + + if (_globals[kSexOfRex] == REX_MALE) + _game._player._spritesPrefix = "RXM"; + else + _game._player._spritesPrefix = "ROX"; + + if ((_scene->_nextSceneId == 313) || (_scene->_nextSceneId == 366) + || ((_scene->_nextSceneId >= 301) && (_scene->_nextSceneId <= 303)) + || ((_scene->_nextSceneId == 304) && (_scene->_currentSceneId == 303)) + || ((_scene->_nextSceneId == 311) && (_scene->_currentSceneId == 304)) + || ((_scene->_nextSceneId >= 308) && (_scene->_nextSceneId <= 310)) + || ((_scene->_nextSceneId >= 319) && (_scene->_nextSceneId <= 322)) + || ((_scene->_nextSceneId >= 387) && (_scene->_nextSceneId <= 391))) { + _game._player._spritesPrefix = ""; + _game._player._spritesChanged = true; + } + + _game._player._scalingVelocity = true; + if (oldName != _game._player._spritesPrefix) + _game._player._spritesChanged = true; + + _vm->_palette->setEntry(16, 10, 63, 63); + _vm->_palette->setEntry(17, 10, 45, 45); +} + +void Scene3xx::sceneEntrySound() { + if (!_vm->_musicFlag) { + _vm->_sound->command(2); + return; + } + + switch (_scene->_nextSceneId) { + case 301: + case 302: + case 303: + case 304: + case 308: + case 309: + case 310: + _vm->_sound->command(11); + break; + + case 311: + if (_scene->_priorSceneId == 304) + _vm->_sound->command(11); + else + _vm->_sound->command(10); + break; + + case 313: + case 316: + case 320: + case 322: + case 357: + case 358: + case 359: + case 360: + case 361: + case 387: + case 388: + case 389: + case 390: + case 391: + case 399: + _vm->_sound->command(10); + break; + + case 318: + if ((_scene->_priorSceneId == 357) || (_scene->_priorSceneId == 407)) + _vm->_sound->command(10); + else if (_scene->_priorSceneId == 319) + _vm->_sound->command(16); + else + _vm->_sound->command(3); + + _vm->_sound->command(50); + break; + + case 319: + _vm->_sound->command(16); + break; + + case 321: + _vm->_sound->command(18); + break; + + default: + break; + } +} + +/*------------------------------------------------------------------------*/ + +} // End of namespace Nebular +} // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h new file mode 100644 index 0000000000..abba91d897 --- /dev/null +++ b/engines/mads/nebular/nebular_scenes3.h @@ -0,0 +1,55 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_NEBULAR_SCENES3_H +#define MADS_NEBULAR_SCENES3_H + +#include "common/scummsys.h" +#include "mads/game.h" +#include "mads/scene.h" +#include "mads/nebular/nebular_scenes.h" + +namespace MADS { + +namespace Nebular { + +class Scene3xx : public NebularScene { +protected: + /** + * Plays an appropriate sound when entering a scene + */ + void setAAName(); + + /** + * Updates the prefix used for getting player sprites for the scene + */ + void setPlayerSpritesPrefix(); + + void sceneEntrySound(); +public: + Scene3xx(MADSEngine *vm) : NebularScene(vm) {} +}; + +} // End of namespace Nebular +} // End of namespace MADS + +#endif /* MADS_NEBULAR_SCENES3_H */ -- cgit v1.2.3 From 39088c0121dec470f31a4171336ac8bd525b6fde Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 16 Apr 2014 17:48:36 +0200 Subject: MADS: Implement scene 301 --- engines/mads/nebular/nebular_scenes.cpp | 5 +++ engines/mads/nebular/nebular_scenes3.cpp | 62 ++++++++++++++++++++++---------- engines/mads/nebular/nebular_scenes3.h | 11 ++++++ 3 files changed, 60 insertions(+), 18 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 562f31c3b2..fde69b653a 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -30,6 +30,7 @@ #include "mads/nebular/nebular_scenes.h" #include "mads/nebular/nebular_scenes1.h" #include "mads/nebular/nebular_scenes2.h" +#include "mads/nebular/nebular_scenes3.h" #include "mads/nebular/nebular_scenes8.h" namespace MADS { @@ -101,6 +102,10 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 216: return new Scene216(vm); + // Scene group #3 + case 301: + return new Scene301(vm); + // Scene group #8 case 804: return new Scene804(vm); diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index d74d275b22..2d9f2d3de7 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -59,8 +59,8 @@ void Scene3xx::setPlayerSpritesPrefix() { if (oldName != _game._player._spritesPrefix) _game._player._spritesChanged = true; - _vm->_palette->setEntry(16, 10, 63, 63); - _vm->_palette->setEntry(17, 10, 45, 45); + _vm->_palette->setEntry(16, 10, 63, 63); + _vm->_palette->setEntry(17, 10, 45, 45); } void Scene3xx::sceneEntrySound() { @@ -80,28 +80,28 @@ void Scene3xx::sceneEntrySound() { _vm->_sound->command(11); break; - case 311: + case 311: if (_scene->_priorSceneId == 304) _vm->_sound->command(11); else _vm->_sound->command(10); break; - case 313: - case 316: - case 320: - case 322: - case 357: - case 358: - case 359: - case 360: - case 361: - case 387: - case 388: - case 389: - case 390: - case 391: - case 399: + case 313: + case 316: + case 320: + case 322: + case 357: + case 358: + case 359: + case 360: + case 361: + case 387: + case 388: + case 389: + case 390: + case 391: + case 399: _vm->_sound->command(10); break; @@ -131,5 +131,31 @@ void Scene3xx::sceneEntrySound() { /*------------------------------------------------------------------------*/ +void Scene301::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene301::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 0)); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 9, 0, 0, 0); + + _globals[kMeteorologistStatus] = METEOROLOGIST_GONE; + _globals[kTeleporterCommand] = TELEPORTER_NONE; + + _game._player._stepEnabled = false; + _game._player._visible = false; + _scene->loadAnimation(formAnimName('a', -1), 60); + + sceneEntrySound(); +} + +void Scene301::step() { + if (_game._trigger == 60) + _scene->_nextSceneId = 302; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h index abba91d897..eb92de5b85 100644 --- a/engines/mads/nebular/nebular_scenes3.h +++ b/engines/mads/nebular/nebular_scenes3.h @@ -49,6 +49,17 @@ public: Scene3xx(MADSEngine *vm) : NebularScene(vm) {} }; +class Scene301: public Scene3xx { +public: + Scene301(MADSEngine *vm) : Scene3xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions() {}; + virtual void postActions() {}; +}; } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 301ca80915d4b9ad6fa61f732c9e736f81ea1997 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 16 Apr 2014 18:08:26 +0200 Subject: MADS: Implement scene 302 --- engines/mads/nebular/nebular_scenes.cpp | 2 ++ engines/mads/nebular/nebular_scenes3.cpp | 40 +++++++++++++++++++++++++++++++- engines/mads/nebular/nebular_scenes3.h | 15 ++++++++++++ 3 files changed, 56 insertions(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index fde69b653a..c0a1552597 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -105,6 +105,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { // Scene group #3 case 301: return new Scene301(vm); + case 302: + return new Scene302(vm); // Scene group #8 case 804: diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 2d9f2d3de7..8a305b8835 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -156,6 +156,44 @@ void Scene301::step() { } /*------------------------------------------------------------------------*/ - + +void Scene302::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene302::enter() { + _game._player._stepEnabled = false; + _game._player._visible = false; + + _scene->loadAnimation(formAnimName('a',-1), 71); + sceneEntrySound(); +} + +void Scene302::step() { + if (_game._trigger == 71) + _scene->_nextSceneId = 303; + + if ((_scene->_activeAnimation != nullptr) && (_scene->_activeAnimation->getCurrentFrame() != _oldFrame)) { + _oldFrame = _scene->_activeAnimation->getCurrentFrame(); + if (_oldFrame == 147) { + _game._objects.setRoom(OBJ_POISON_DARTS, 1); + _game._objects.setRoom(OBJ_BLOWGUN, 1); + _game._objects.setRoom(OBJ_REBREATHER, 1); + _game._objects.setRoom(OBJ_STUFFED_FISH, 1); + _game._objects.setRoom(OBJ_DEAD_FISH, 1); + _game._objects.setRoom(OBJ_BURGER, 1); + + int count = (int)_game._objects._inventoryList.size(); + for (int idx = 0; idx < count; idx++) { + if (_game._objects.isInInventory(idx)) + _game._objects.setRoom(idx, 50); + } + } + } +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h index eb92de5b85..fad60cf118 100644 --- a/engines/mads/nebular/nebular_scenes3.h +++ b/engines/mads/nebular/nebular_scenes3.h @@ -60,6 +60,21 @@ public: virtual void actions() {}; virtual void postActions() {}; }; + +class Scene302: public Scene3xx { +private: + int _oldFrame; + +public: + Scene302(MADSEngine *vm) : Scene3xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions() {}; + virtual void postActions() {}; +}; } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 5f44b97d089f6e2db89838b50c685d9307997647 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 16 Apr 2014 19:29:42 +0200 Subject: MADS: Implement scene 303 and 304 --- engines/mads/nebular/nebular_scenes.cpp | 4 + engines/mads/nebular/nebular_scenes3.cpp | 155 ++++++++++++++++++++++++++++++- engines/mads/nebular/nebular_scenes3.h | 30 +++++- 3 files changed, 187 insertions(+), 2 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index c0a1552597..67c32fdaa1 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -107,6 +107,10 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene301(vm); case 302: return new Scene302(vm); + case 303: + return new Scene303(vm); + case 304: + return new Scene304(vm); // Scene group #8 case 804: diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 8a305b8835..6d60395c86 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -164,7 +164,7 @@ void Scene302::setup() { void Scene302::enter() { _game._player._stepEnabled = false; - _game._player._visible = false; + _game._player._visible = false; _scene->loadAnimation(formAnimName('a',-1), 71); sceneEntrySound(); @@ -195,5 +195,158 @@ void Scene302::step() { /*------------------------------------------------------------------------*/ +void Scene303::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene303::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('b', 0)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('b', 1)); + + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 10, 0, 50, 120); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 10, 0, 0, 0); + + _game._player._visible = false; + _game._player._stepEnabled = false; + _scene->loadAnimation(formAnimName('a', -1), 60); + + sceneEntrySound(); +} + +void Scene303::step() { + if (_game._trigger == 60) + _scene->_nextSceneId = 304; +} + +/*------------------------------------------------------------------------*/ + +void Scene304::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene304::enter() { + if (_scene->_priorSceneId == 303) { + _game._player._visible = false; + _game._player._stepEnabled = false; + _scene->loadAnimation(formAnimName('a',-1), 60); + } else { + if (_globals[kSexOfRex] == REX_MALE) + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('a', 0)); + else + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('a', 2)); + + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('a', 1)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('b', 0)); + + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 150, 0, 3, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 2); + _vm->_palette->setEntry(252, 45, 63, 45); + _vm->_palette->setEntry(253, 20, 45, 20); + + if (_globals[kSexOfRex] == REX_MALE) + _game._player._playerPos = Common::Point(111, 117); + else + _game._player._playerPos = Common::Point(113, 116); + + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 11, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], -1, -1); + _scene->_sequences.addTimer(48, 70); + } + + sceneEntrySound(); + _game.loadQuoteSet(0xEB, 0xEC, 0); +} + +void Scene304::step() { + if (_game._trigger == 60) + _scene->_nextSceneId = 311; + + if (_game._trigger >= 70) { + switch (_game._trigger) { + case 70: { + _game._player._visible = false; + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 2, 4); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); + if (_globals[kSexOfRex] == REX_MALE) + _explosionSpriteId = _globals._spriteIndexes[1]; + else + _explosionSpriteId = _globals._spriteIndexes[4]; + + int sprIdx = _scene->_sequences.addSpriteCycle(_explosionSpriteId, false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(sprIdx, -1, 4); + _scene->_sequences.setDepth(sprIdx, 1); + _scene->_sequences.addSubEntry(sprIdx, SEQUENCE_TRIGGER_EXPIRE, 0, 71); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 74); + } + break; + + case 71: + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 60, _game.getQuote(0xEB)); + _scene->_sequences.addTimer(1, 72); + break; + + case 72: { + _vm->_sound->command(43); + int sprIdx = _scene->_sequences.addSpriteCycle(_explosionSpriteId, false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(sprIdx, 5, -2); + _scene->_sequences.setDepth(sprIdx, 1); + _scene->_sequences.addSubEntry(sprIdx, SEQUENCE_TRIGGER_EXPIRE, 0, 73); + if (_game._storyMode == STORYMODE_NICE) + _scene->_sequences.addSubEntry(sprIdx, SEQUENCE_TRIGGER_SPRITE, 8, 78); + } + break; + + case 73: { + int sprIdx = _scene->_sequences.addSpriteCycle(_explosionSpriteId, false, 8, 0, 0, 0); + _scene->_sequences.setAnimRange(sprIdx, -2, -2); + _scene->_sequences.setDepth(sprIdx, 1); + } + break; + + case 74: + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 5, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 75); + break; + + case 75: + _globals._sequenceIndexes[2] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 2, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 76); + break; + + case 76: + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 8, 0, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 2, 2); + _scene->_sequences.addTimer(48, 77); + break; + + case 77: + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(211, 45), 0xFDFC, 32, 0, 180, _game.getQuote(0xEC)); + _scene->_sequences.addTimer(120, 78); + break; + + case 78: + _scene->_nextSceneId = 316; + break; + + default: + break; + } + } +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h index fad60cf118..74611a61f9 100644 --- a/engines/mads/nebular/nebular_scenes3.h +++ b/engines/mads/nebular/nebular_scenes3.h @@ -66,7 +66,7 @@ private: int _oldFrame; public: - Scene302(MADSEngine *vm) : Scene3xx(vm) {} + Scene302(MADSEngine *vm) : Scene3xx(vm), _oldFrame(0) {} virtual void setup(); virtual void enter(); @@ -75,6 +75,34 @@ public: virtual void actions() {}; virtual void postActions() {}; }; + +class Scene303: public Scene3xx { +public: + Scene303(MADSEngine *vm) : Scene3xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions() {}; + virtual void postActions() {}; +}; + +class Scene304: public Scene3xx { +private: + int _explosionSpriteId; + +public: + Scene304(MADSEngine *vm) : Scene3xx(vm), _explosionSpriteId(-1) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions() {}; + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From cfd49436478c356c7a9baf320d3ae86dc8485361 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 16 Apr 2014 21:26:46 -0400 Subject: MADS: Fix for correctly loading animation sprite sets --- engines/mads/animation.cpp | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index 93cc72f613..dd7977225f 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -51,23 +51,13 @@ void AAHeader::load(Common::SeekableReadStream *f) { buffer[FILENAME_SIZE - 1] = '\0'; _interfaceFile = Common::String(buffer); - for (int i = 0; i < _spriteSetsCount; ++i) { + for (int i = 0; i < 50; ++i) { f->read(buffer, FILENAME_SIZE); buffer[FILENAME_SIZE - 1] = '\0'; - _spriteSetNames.push_back(Common::String(buffer)); + if (i < _spriteSetsCount) + _spriteSetNames.push_back(Common::String(buffer)); } - f->skip(81); - f->read(buffer, FILENAME_SIZE); - buffer[FILENAME_SIZE - 1] = '\0'; - _lbmFilename = Common::String(buffer); - - f->skip(365); - f->read(buffer, FILENAME_SIZE); - buffer[FILENAME_SIZE - 1] = '\0'; - _spritesFilename = Common::String(buffer); - - f->skip(48); f->read(buffer, FILENAME_SIZE); buffer[FILENAME_SIZE - 1] = '\0'; _soundName = Common::String(buffer); -- cgit v1.2.3 From 73a505543829c5da58f7ac31f3a9ab87f0f8b93a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 16 Apr 2014 22:03:18 -0400 Subject: MADS: Fix unloading animations with associated messages --- engines/mads/animation.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index dd7977225f..b2c257332e 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -188,7 +188,8 @@ void Animation::free() { // Remove any kernel messages in use by the animation for (uint i = 0; i < _messages.size(); ++i) { int msgIndex = _messages[i]._kernelMsgIndex; - scene._kernelMessages.remove(msgIndex); + if (msgIndex >= 0) + scene._kernelMessages.remove(msgIndex); } _resetFlag = false; -- cgit v1.2.3 From 45084a4702bbdbc4a560470fa1dc12dba3549a61 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 16 Apr 2014 22:59:07 -0400 Subject: MADS: Fix scene animation data being unloaded prematurely --- engines/mads/scene.cpp | 1 + engines/mads/scene.h | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index e2892fbbd1..99151c1267 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -398,6 +398,7 @@ void Scene::doFrame() { if (_freeAnimationFlag && _activeAnimation) { _activeAnimation->free(); + _freeAnimationFlag = false; _activeAnimation = nullptr; } } diff --git a/engines/mads/scene.h b/engines/mads/scene.h index f18d6ad4cd..b695f3b1fa 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -91,7 +91,6 @@ public: TextDisplayList _textDisplay; SpriteSlots _spriteSlots; SpriteSets _sprites; - int _spritesIndex; DynamicHotspots _dynamicHotspots; Common::Array _activeVocabs; SequenceList _sequences; -- cgit v1.2.3 From 0483ad2e0d4ffce4a09d47e044c8de12258c705f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 17 Apr 2014 23:57:40 +0200 Subject: MADS: Implement scene 307 --- engines/mads/nebular/nebular_scenes.cpp | 2 + engines/mads/nebular/nebular_scenes3.cpp | 789 ++++++++++++++++++++++++++++++- engines/mads/nebular/nebular_scenes3.h | 52 ++ 3 files changed, 837 insertions(+), 6 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 67c32fdaa1..6a78903645 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -111,6 +111,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene303(vm); case 304: return new Scene304(vm); + case 307: + return new Scene307(vm); // Scene group #8 case 804: diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 6d60395c86..68c2783f7e 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -53,7 +53,7 @@ void Scene3xx::setPlayerSpritesPrefix() { || ((_scene->_nextSceneId >= 387) && (_scene->_nextSceneId <= 391))) { _game._player._spritesPrefix = ""; _game._player._spritesChanged = true; - } + } _game._player._scalingVelocity = true; if (oldName != _game._player._spritesPrefix) @@ -129,6 +129,109 @@ void Scene3xx::sceneEntrySound() { } } +void Scene3xx::initForceField(ForceField *force, bool flag) { + force->_flag = flag; + force->_vertical = 0; + force->_horizontal = 0; + force->_timer = 0; + + for (int count = 0; count < 40; count++) + force->_seqId[count] = -1; + + if (force->_flag) + _vm->_sound->command(24); +} + +int Scene3xx::computeScale(int low, int high, int id) { + int diff = high - (low + 2); + int quotient = diff / 20; + int remainder = diff % 20; + int value = low + 2 + (quotient * id) + (remainder / (id + 1)); + + return (value); +} + +void Scene3xx::handleForceField(ForceField *force, int *sprites) { + if (_game._trigger >= 150) { + int id = _game._trigger - 150; + if (id < 40) { + if (id < 20) + force->_vertical--; + else + force->_horizontal--; + + force->_seqId[id] = -1; + } + return; + } + + if (!force->_flag || (_scene->_frameStartTime < force->_timer) || (force->_vertical + force->_horizontal >= 5)) + return; + + if (_vm->getRandomNumber(1, 1000) <= (200 + ((40 - (force->_vertical + force->_horizontal)) << 5))) { + int id = -1; + for (int i = 0; i < 100; i++) { + int randIdx = _vm->getRandomNumber(0, 39); + if (force->_seqId[randIdx] < 0) { + id = randIdx; + break; + } + } + + if (id < 0) { + for (int i = 0; i < 40; i++) { + if (force->_seqId[i] < 0) { + id = i; + break; + } + } + } + + int speedX, speedY; + int posX, posY; + int randVal = _vm->getRandomNumber(1, 100); + int spriteId; + bool mirror; + + if (id >= 20) { + spriteId = 2; + mirror = (randVal <= 50); + posX = mirror ? 315 : 5; + posY = computeScale(15, 119, id - 20); + speedX = 1000 * (mirror ? -1 : 1); + speedY = 0; + } else if (randVal <= 50) { + spriteId = 1; + mirror = false; + posX = computeScale(21, 258, id); + posY = 0; + speedX = 0; + speedY = 600; + } else { + spriteId = 0; + mirror = false; + posX = computeScale(21, 258, id); + posY = 155; + speedX = 0; + speedY = -600; + } + + if (id >= 0) { + force->_seqId[id] = _scene->_sequences.addSpriteCycle(sprites[spriteId], mirror, 2, 0, 0, 0); + _scene->_sequences.setDepth(force->_seqId[id], 8); + _scene->_sequences.setMsgPosition(force->_seqId[id], Common::Point(posX, posY)); + _scene->_sequences.sub70C52(force->_seqId[id], 2, speedX, speedY); + _scene->_sequences.addSubEntry(force->_seqId[id], SEQUENCE_TRIGGER_EXPIRE, 0, 150 + id); + if (spriteId == 2) + force->_horizontal++; + else + force->_vertical++; + } + } + + force->_timer = _scene->_frameStartTime + 4; +} + /*------------------------------------------------------------------------*/ void Scene301::setup() { @@ -166,7 +269,7 @@ void Scene302::enter() { _game._player._stepEnabled = false; _game._player._visible = false; - _scene->loadAnimation(formAnimName('a',-1), 71); + _scene->loadAnimation(formAnimName('a', -1), 71); sceneEntrySound(); } @@ -231,7 +334,7 @@ void Scene304::enter() { if (_scene->_priorSceneId == 303) { _game._player._visible = false; _game._player._stepEnabled = false; - _scene->loadAnimation(formAnimName('a',-1), 60); + _scene->loadAnimation(formAnimName('a', -1), 60); } else { if (_globals[kSexOfRex] == REX_MALE) _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('a', 0)); @@ -264,7 +367,7 @@ void Scene304::step() { if (_game._trigger == 60) _scene->_nextSceneId = 311; - if (_game._trigger >= 70) { + if (_game._trigger >= 70) { switch (_game._trigger) { case 70: { _game._player._visible = false; @@ -316,7 +419,7 @@ void Scene304::step() { _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 75); break; - case 75: + case 75: _globals._sequenceIndexes[2] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 2, -2); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); @@ -336,7 +439,7 @@ void Scene304::step() { _scene->_sequences.addTimer(120, 78); break; - case 78: + case 78: _scene->_nextSceneId = 316; break; @@ -346,6 +449,680 @@ void Scene304::step() { } } +/*------------------------------------------------------------------------*/ + +void Scene307::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(0x11); + _scene->addActiveVocab(0x2F7); +} + +void Scene307::handleRexDialog(int quote) { + Common::String curQuote = _game.getQuote(_action._activeAction._verbId); + if (_vm->_font->getWidth(curQuote, _scene->_textSpacing) > 200) { + Common::String subQuote1; + _game.splitQuote(curQuote, subQuote1, _subQuote2); + _scene->_kernelMessages.add(Common::Point(0, -14), 0x1110, 34, 0, 240, subQuote1); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 1, 180, _subQuote2); + } else + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 1, 120, curQuote); +} + +void Scene307::handlePrisonerEncounter() { + switch (_action._activeAction._verbId) { + case 275: + setDialogNode(5); + break; + + case 277: + setDialogNode(4); + break; + + case 276: + setDialogNode(6); + break; + } +} + +void Scene307::handlePrisonerSpeech(int firstQuoteId, int number, long time) { + int height = number * 14; + int posY; + + if (height < 60) + posY = 65 - height; + else + posY = 78 - (height / 2); + + _scene->_kernelMessages.reset(); + _activePrisonerFl = true; + + int quoteId = firstQuoteId; + for (int count = 0; count < number; count++) { + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_kernelMessages.add(Common::Point(5, posY), 0xFDFC, 0, 81, time, _game.getQuote(quoteId)); + posY += 14; + quoteId++; + } +} + +void Scene307::setDialogNode(int node) { + switch (node) { + case 0: + handlePrisonerSpeech(0x153, 2, 120); + _scene->_userInterface.setup(kInputBuildingSentences); + break; + + case 1: + _globals[kMetBuddyBeast] = true; + handlePrisonerSpeech(0x10F, 2, 9999999); + warning("TODO: talk_init(&dialog1);"); + break; + + case 2: + _globals[kMetBuddyBeast] = true; + handlePrisonerSpeech(0x111, 2, 9999999); + warning("TODO: talk_init(&dialog1);"); + break; + + case 4: + handlePrisonerSpeech(0x116, 1, 120); + _scene->_userInterface.setup(kInputBuildingSentences); + break; + + case 5: + _globals[kKnowsBuddyBeast] = true; + handlePrisonerSpeech(0x117, 2, 9999999); + warning("TODO: talk_init(&dialog2);"); + break; + + case 6: + handlePrisonerSpeech(0x123, 1, 120); + _scene->_userInterface.setup(kInputBuildingSentences); + break; + + case 7: + _globals[kKnowsBuddyBeast] = true; + handlePrisonerSpeech(0x124, 10, 9999999); + warning("TODO: sub71B9E(&dialog2, 0x11A, false);"); + warning("TODO: sub71B9E(&dialog2, 0x11B, true);"); + warning("TODO: sub71B9E(&dialog2, 0x120, true);"); + warning("TODO: talk_init(&dialog2);"); + break; + + case 8: + handlePrisonerSpeech(0x12E, 6, 9999999); + warning("TODO: sub71B9E(&dialog2, 0x11A, false);"); + warning("TODO: sub71B9E(&dialog2, 0x11B, false);"); + warning("TODO: sub71B9E(&dialog2, 0x11C, true);"); + warning("TODO: sub71B9E(&dialog2, 0x11D, true);"); + warning("TODO: sub71B9E(&dialog2, 0x11F, true);"); + warning("TODO: talk_init(&dialog2);"); + break; + + case 9: + handlePrisonerSpeech(0x134, 4, 9999999); + warning("TODO: sub71B9E(&dialog2, 0x11D, false);"); + warning("TODO: talk_init(&dialog2);"); + break; + + case 10: + handlePrisonerSpeech(0x138, 6, 9999999); + warning("TODO: sub71B9E(&dialog2, 0x11E, false);"); + warning("TODO: talk_init(&dialog2);"); + break; + + case 11: + handlePrisonerSpeech(0x13E, 6, 9999999); + warning("TODO: sub71B9E(&dialog2, 0x11F, false);"); + warning("TODO: sub71B9E(&dialog2, 0x121, true);"); + warning("TODO: talk_init(&dialog2);"); + break; + + case 12: + handlePrisonerSpeech(0x144, 4, 9999999); + warning("TODO: sub71B9E(&dialog2, 0x11C, false);"); + warning("TODO: talk_init(&dialog2);"); + break; + + case 13: + handlePrisonerSpeech(0x148, 7, 9999999); + warning("TODO: sub71B9E(&dialog2, 0x120, false);"); + warning("TODO: talk_init(&dialog2);"); + break; + + case 14: + handlePrisonerSpeech(0x14F, 3, 9999999); + warning("TODO: sub71B9E(&dialog2, 0x121, false);"); + warning("TODO: talk_init(&dialog2);"); + break; + + case 15: + handlePrisonerSpeech(0x152, 1, 120); + _scene->_userInterface.setup(kInputBuildingSentences); + break; + + case 16: + _globals[kKnowsBuddyBeast] = true; + handlePrisonerSpeech(0x10C, 1, 9999999); + warning("TODO: talk_init(&dialog2);"); + break; + + default: + break; + } +} + +void Scene307::handlePrisonerDialog() { + switch (_action._activeAction._verbId) { + case 0x11A: + setDialogNode(7); + break; + + case 0x11B: + setDialogNode(8); + break; + + case 0x11C: + setDialogNode(12); + break; + + case 0x11D: + setDialogNode(9); + break; + + case 0x11E: + setDialogNode(10); + break; + + case 0x11F: + setDialogNode(11); + break; + + case 0x120: + setDialogNode(13); + break; + + case 0x121: + setDialogNode(14); + break; + + case 0x122: + setDialogNode(15); + break; + } +} + +void Scene307::handleDialog() { + if (_game._trigger == 0) { + _scene->_kernelMessages.reset(); + _game._player._stepEnabled = false; + handleRexDialog(_action._activeAction._verbId); + } else { + _game._player._stepEnabled = true; + + if (!_globals[kKnowsBuddyBeast]) { + handlePrisonerEncounter(); + } else { + handlePrisonerDialog(); + } + } +} + +void Scene307::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites("*SC003x0"); + _globals._spriteIndexes[0] = _scene->_sprites.addSprites("*SC003x1"); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites("*SC003x2"); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('x', 0)); + + initForceField(&_forceField, true); + + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(127, 78)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 15); + + _animationMode = 0; + _fieldCollisionCounter = 0; + + _scene->changeVariant(1); + + _game.loadQuoteSet(0xED, 0xEE, 0xEF, 0xF0, 0xF1, 0xF2, 0xF3, 0x10C, 0x104, 0x106, 0x107, 0x108, 0x105, + 0x109, 0x10A, 0x10B, 0x10D, 0x10E, 0x10F, 0x110, 0x111, 0x112, 0x113, 0x114, 0x115, 0x116, 0x117, + 0x118, 0x119, 0x11A, 0x11B, 0x11C, 0x11D, 0x11E, 0x11F, 0x120, 0x121, 0x122, 0x123, 0x124, 0x125, + 0x126, 0x127, 0x128, 0x129, 0x12A, 0x12B, 0x12C, 0x12D, 0x12E, 0x12F, 0x130, 0x131, 0x132, 0x133, + 0x134, 0x135, 0x136, 0x137, 0x138, 0x139, 0x13A, 0x13B, 0x13C, 0x13D, 0x13E, 0x13F, 0x140, 0x141, + 0x142, 0x143, 0x144, 0x145, 0x146, 0x147, 0x148, 0x149, 0x14A, 0x14B, 0x14C, 0x14D, 0x14E, 0x14F, + 0x150, 0x151, 0x152, 0x153, 0); + + warning("TODO: sub71A50(&dialog1, 0x3F, 0x113, 0x114, 0x115, -1);"); + warning("TODO: sub71A50(&dialog2, 0x40, 0x11A, 0x11B, 0x11C, 0x11D, 0x11E, 0x11F, 0x120, 0x121, 0x122, 0);"); + + if (!_game._visitedScenes._sceneRevisited) + warning("TODO: sub71B18(&dialog2, 0x11A, 0x122, 0);"); + else if (_scene->_priorSceneId == 318) + warning("TODO: sub71B9E(&dialog2, 0x11E, -1);"); + + + if (_scene->_priorSceneId == -2) { + if (_grateOpenedFl) + _vm->_sound->command(10); + else + _vm->_sound->command(3); + } else { + _afterPeeingFl = false; + _duringPeeingFl = false; + _guardTime = 0; + _grateOpenedFl = false; + _activePrisonerFl = false; + _prisonerTimer = 0; + _prisonerMessageId = 0x104; + + if (_scene->_priorSceneId == 308) { + _game._player._visible = false; + _game._player._stepEnabled = false; + _game._player._playerPos = Common::Point(156, 113); + _game._player._facing = FACING_NORTH; + _animationMode = 1; + _vm->_sound->command(11); + _scene->loadAnimation(formAnimName('a', -1), 60); + } else if (_scene->_priorSceneId == 387) { + _game._player._playerPos = Common::Point(129, 108); + _game._player._facing = FACING_NORTH; + _vm->_sound->command(3); + _grateOpenedFl = true; + } else { + _game._player._playerPos = Common::Point(159, 109); + _game._player._facing = FACING_SOUTH; + _vm->_sound->command(3); + } + } + + if (_grateOpenedFl) { + _scene->_hotspots.activate(17, false); + + int idx = _scene->_dynamicHotspots.add(17, 0x2F7, -1, Common::Rect(117, 67, 117 + 19, 67 + 13)); + int hotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(129, 104), FACING_NORTH); + _scene->_dynamicHotspots.setCursor(hotspotId, CURSOR_GO_UP); + + _scene->_sequences.remove(_globals._sequenceIndexes[4]); + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 2); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(127, 78)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 15); + } + + _vm->_palette->setEntry(252, 63, 30, 20); + _vm->_palette->setEntry(253, 45, 15, 12); + + sceneEntrySound(); + + if ((_scene->_priorSceneId == 318) || (_scene->_priorSceneId == 387)) + _scene->_kernelMessages.addQuote(0xF3, 120, 0); +} + +void Scene307::step() { + handleForceField(&_forceField, &_globals._spriteIndexes[0]); + + if ((_animationMode == 1) && (_scene->_activeAnimation != nullptr)) { + if (_scene->_activeAnimation->getCurrentFrame() == 126) { + _forceField._flag = false; + _vm->_sound->command(5); + } + + if (_scene->_activeAnimation->getCurrentFrame() == 194) { + _forceField._flag = true; + _vm->_sound->command(24); + } + } + + if ((_animationMode == 2) && (_scene->_activeAnimation != nullptr)) { + if (_scene->_activeAnimation->getCurrentFrame() == 54) + _forceField._flag = false; + + if (_scene->_activeAnimation->getCurrentFrame() == 150) { + _game._player._visible = false; + _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; + } + } + + if (_game._trigger == 60) { + _game._player._visible = true; + _game._player._stepEnabled = true; + _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; + _animationMode = 0; + _vm->_sound->command(9); + } + + if ((_lastFrameTime != _scene->_frameStartTime) && !_duringPeeingFl) { + int32 elapsedTime = _lastFrameTime - _scene->_frameStartTime; + if ((elapsedTime > 0) && (elapsedTime <= 4)) { + _guardTime += elapsedTime; + _prisonerTimer += elapsedTime; + } else { + _guardTime++; + _prisonerTimer++; + } + _lastFrameTime = _scene->_frameStartTime; + + if ((_guardTime > 3000) && !_duringPeeingFl && (_scene->_activeAnimation == nullptr) + && (_game._screenObjects._inputMode != 1) && _globals[kMetBuddyBeast] && !_activePrisonerFl) { + if (!_game._objects.isInInventory(OBJ_SCALPEL) && !_grateOpenedFl) { + _game._player._stepEnabled = false; + _game._player.walk(Common::Point(151, 119), FACING_SOUTHEAST); + _animationMode = 2; + _vm->_sound->command(11); + _scene->loadAnimation(formAnimName('b', -1), 70); + } + _guardTime = 0; + } else if ((_prisonerTimer > 300) && (_game._screenObjects._inputMode != 1) && (_scene->_activeAnimation == nullptr) && !_activePrisonerFl) { + if (!_globals[kMetBuddyBeast]) { + int idx = _scene->_kernelMessages.add(Common::Point(5, 51), 0xFDFC, 0, 81, 120, _game.getQuote(_prisonerMessageId)); + _scene->_kernelMessages.setQuoted(idx, 4, true); + _prisonerMessageId++; + if (_prisonerMessageId > 0x10A) + _prisonerMessageId = 0x104; + } else if (_globals[kKnowsBuddyBeast] && (_vm->getRandomNumber(1, 3) == 1)) { + warning("TODO: if (_globals[kKnowsBuddyBeast] && (sub71C16(&dialog2, 0) > 1) && (_vm->getRandomNumber(1, 3) == 1)) {"); + int idx = _scene->_kernelMessages.add(Common::Point(5, 51), 0xFDFC, 0, 81, 120, _game.getQuote(267)); + _scene->_kernelMessages.setQuoted(idx, 4, true); + } + _prisonerTimer = 0; + } + } + + if (_game._trigger == 70) + _scene->_nextSceneId = 318; + + if (_game._trigger == 81) { + _prisonerTimer = 0; + if (_activePrisonerFl && (_guardTime > 2600)) + _guardTime = 3000 - _vm->getRandomNumber(1, 800); + + _activePrisonerFl = false; + } +} + +void Scene307::actions() { + if (_action._lookFlag) + _vm->_dialogs->show(0x77FB); + else if (_game._screenObjects._inputMode == 1) + handleDialog(); + else if (_action.isAction(VERB_TALKTO, 0x207) || _action.isAction(VERB_TALKTO, 0x18D) || _action.isAction(VERB_TALKTO, 0x21B)) { + int node, say; + if (_globals[kKnowsBuddyBeast]) { + say = 0x10E; + node = 16; + } else if (_globals[kMetBuddyBeast]) { + say = 0x10E; + node = 2; + } else { + say = 0x10D; + node = 1; + } + + switch (_game._trigger) { + case 0: + handleRexDialog(say); + break; + + case 1: + setDialogNode(node); + break; + } + } else if (_action.isAction(0x11C, 0x12C, 0x11)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(239)); + _scene->_sequences.addTimer(120, 1); + break; + + case 1: + _globals._spriteIndexes[5] = _scene->_sprites.addSprites("*RXCL_8"); + _game._player._visible = false; + _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], -1, 3); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + + case 2: { + int oldIdx = _globals._sequenceIndexes[5]; + _globals._sequenceIndexes[5] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[5], false, 12, 6, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 2, 3); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[5], oldIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 3); + } + break; + + case 3: { + int oldIdx = _globals._sequenceIndexes[5]; + _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 1); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[5], oldIdx); + _scene->_sequences.addTimer(48, 4); + } + break; + + case 4: + _vm->_sound->command(26); + _scene->_sequences.remove(_globals._sequenceIndexes[4]); + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 2); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(127, 78)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 15); + _scene->_sequences.addTimer(90, 5); + break; + + case 5: + _vm->_sound->command(10); + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(241)); + _scene->_sequences.addTimer(120, 6); + break; + + case 6: { + _game._player._visible = true; + _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; + _scene->_sequences.remove(_globals._sequenceIndexes[5]); + _grateOpenedFl = true; + _scene->_hotspots.activate(17, false); + int idx = _scene->_dynamicHotspots.add(17, 0x2F7, -1, Common::Rect(117, 67, 117 + 19, 67 + 13)); + int hotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(129, 104), FACING_NORTH); + _scene->_dynamicHotspots.setCursor(hotspotId, CURSOR_GO_UP); + _game._objects.removeFromInventory(OBJ_SCALPEL, NOWHERE); + _scene->_kernelMessages.addQuote(0xF2, 120, 7); + } + break; + + case 7: + _scene->_sprites.remove(_globals._spriteIndexes[5]); + _game._player._stepEnabled = true; + break; + + default: + break; + } + }else if (_action.isAction(0x2F7, 0x11)) { + if (_grateOpenedFl) { + switch (_game._trigger) { + case 0: + _globals._spriteIndexes[5] = _scene->_sprites.addSprites("*RXCL_8"); + _game._player._stepEnabled = false; + _game._player._visible = false; + _scene->_sequences.remove(_globals._sequenceIndexes[4]); + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 60, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 3, -2); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(127, 78)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 15); + _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 18, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], -1, 4); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + + case 1: + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, -2); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(127, 78)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 15); + break; + + case 2: { + int oldIdx = _globals._sequenceIndexes[5]; + _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 4, 10); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[5], oldIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 3); + } + break; + + case 3: + _scene->_sequences.remove(_globals._sequenceIndexes[4]); + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 3); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(127, 78)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 1); + _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 11); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[5], Common::Point(129, 102)); + _scene->_sequences.addTimer(48, 4); + break; + + case 4: + _scene->_sequences.remove(_globals._sequenceIndexes[4]); + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 2); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(127, 78)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 1); + _scene->_sequences.remove(_globals._sequenceIndexes[5]); + _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 12, 14); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[5], Common::Point(129, 102)); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 5); + break; + + case 5: + _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 15); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[5], Common::Point(129, 102)); + _scene->_sequences.addTimer(48, 6); + break; + + case 6: + _scene->_sequences.remove(_globals._sequenceIndexes[5]); + _scene->_sequences.remove(_globals._sequenceIndexes[4]); + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(127, 78)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 1); + _scene->_sequences.addTimer(48, 7); + break; + + case 7: + _scene->_nextSceneId = 313; + break; + + default: + break; + } + } + } else if (_action.isAction(0x20C, 0x21B) && (_game._storyMode != STORYMODE_NAUGHTY)) + _vm->_dialogs->show(0x7803); + else if (_action.isAction(0x20C, 0x21B)) { + if (!_afterPeeingFl) { + switch (_game._trigger) { + case 0: + _vm->_sound->command(25); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('a', 0)); + _duringPeeingFl = true; + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 9, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], -1, 2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 9); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 1); + break; + + case 1: + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 9, 5, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 3, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 9); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + + case 2: + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[3]); + _game._player._visible = true; + _scene->_sequences.addTimer(48, 3); + break; + + case 3: { + _scene->_sprites.remove(_globals._spriteIndexes[3]); + _scene->_kernelMessages.reset(); + int idx = _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 4, 120, _game.getQuote(237)); + _scene->_kernelMessages.setQuoted(idx, 4, true); + } + break; + + case 4: + _game._player._stepEnabled = true; + _duringPeeingFl = false; + _afterPeeingFl = true; + break; + + default: + break; + } + } else { + _scene->_kernelMessages.reset(); + int idx = _scene->_kernelMessages.add(Common::Point(85, 39), 0x1110, 0, 0, 180, _game.getQuote(238)); + _scene->_kernelMessages.setQuoted(idx, 4, true); + } + } else if (_action.isAction(VERB_LOOK, 0x11)) { + if (!_grateOpenedFl) + _vm->_dialogs->show(0x77F6); + else + _vm->_dialogs->show(0x77F7); + } else if (_action.isAction(VERB_LOOK, 0x1CB)) + _vm->_dialogs->show(0x77F8); + else if (_action.isAction(VERB_LOOK, 0x216)) + _vm->_dialogs->show(0x77F9); + else if (_action.isAction(VERB_LOOK, 0x21B)) + _vm->_dialogs->show(0x77FA); + else if (_action.isAction(0x134, 0x12C)) + _vm->_dialogs->show(0x77FC); + else if (_action.isAction(VERB_LOOK, 0x207)) + _vm->_dialogs->show(0x77FD); + else if (_action.isAction(VERB_LOOK, 0xCD)) + _vm->_dialogs->show(0x77FE); + else if (_action.isAction(0x242, 0x204)) { + switch (_fieldCollisionCounter) { + case 0: + _vm->_dialogs->show(0x77FF); + _fieldCollisionCounter = 1; + break; + + case 1: + _vm->_dialogs->show(0x7800); + _fieldCollisionCounter = 2; + break; + + case 2: + _vm->_dialogs->show(0x7801); + _fieldCollisionCounter = 3; + break; + + case 3: + _vm->_dialogs->show(0x7802); + break; + } + } else + return; + + _action._inProgress = false; +} + + /*------------------------------------------------------------------------*/ } // End of namespace Nebular diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h index 74611a61f9..5b25e391eb 100644 --- a/engines/mads/nebular/nebular_scenes3.h +++ b/engines/mads/nebular/nebular_scenes3.h @@ -32,6 +32,14 @@ namespace MADS { namespace Nebular { +typedef struct { + bool _flag; + int _vertical; + int _horizontal; + int _seqId[40]; + uint32 _timer; +} ForceField; + class Scene3xx : public NebularScene { protected: /** @@ -45,6 +53,11 @@ protected: void setPlayerSpritesPrefix(); void sceneEntrySound(); + + void initForceField(ForceField *force, bool flag); + void handleForceField(ForceField *force, int *sprites); + int computeScale(int low, int high, int id); + public: Scene3xx(MADSEngine *vm) : NebularScene(vm) {} }; @@ -103,6 +116,45 @@ public: virtual void postActions() {}; }; +class Scene307: public Scene3xx { +private: + ForceField _forceField; + + bool _afterPeeingFl; + bool _duringPeeingFl; + bool _grateOpenedFl; + bool _activePrisonerFl; + + int _animationMode; + int _prisonerMessageId; + int _fieldCollisionCounter; + + uint32 _lastFrameTime; + uint32 _guardTime; + uint32 _prisonerTimer; + + Common::String _subQuote2; + + // dialog1, dialog2; + + void handleDialog(); + void handleRexDialog(int quote); + void handlePrisonerDialog(); + void handlePrisonerEncounter(); + void setDialogNode(int node); + void handlePrisonerSpeech(int firstQuoteId, int number, long time); + +public: + Scene307(MADSEngine *vm) : Scene3xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions(); + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 8c9b65c34ae264686efb3f4bb276506eb6d727c3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 17 Apr 2014 22:11:25 -0400 Subject: MADS: Fixes for inventory scroller --- engines/mads/user_interface.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 4348d833c9..594d549f87 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -354,12 +354,12 @@ void UserInterface::updateInventoryScroller() { uint32 currentMilli = g_system->getMillis(); uint32 timeInc = _scrollbarQuickly ? 100 : 380; - if (_vm->_events->_mouseClicked || (_vm->_events->_mouseStatusCopy && (_scrollbarMilliTime + timeInc) <= currentMilli)) { + if (_vm->_events->_mouseStatus && (_scrollbarMilliTime + timeInc) <= currentMilli) { _scrollbarQuickly = _vm->_events->_vD2 < 1; _scrollbarMilliTime = currentMilli; switch (_scrollbarStrokeType) { - case 1: + case SCROLLBAR_UP: // Scroll up if (_inventoryTopIndex > 0 && inventoryList.size() > 0) { --_inventoryTopIndex; @@ -367,7 +367,7 @@ void UserInterface::updateInventoryScroller() { } break; - case 2: + case SCROLLBAR_DOWN: // Scroll down if (_inventoryTopIndex < ((int)inventoryList.size() - 1) && inventoryList.size() > 1) { ++_inventoryTopIndex; @@ -375,7 +375,7 @@ void UserInterface::updateInventoryScroller() { } break; - case 3: { + case SCROLLBAR_ELEVATOR: { // Inventory slider int newIndex = CLIP((int)_vm->_events->currentPos().y - 170, 0, 17) * inventoryList.size() / 10; @@ -447,11 +447,11 @@ void UserInterface::writeVocab(ScrCategory category, int id) { _vm->_font->setColorMode(SELMODE_HIGHLIGHTED); } else { _vm->_font->setColorMode(id == _selectedInvIndex ? SELMODE_SELECTED : SELMODE_UNSELECTED); - vocabStr = scene.getVocab(vocabId); - vocabStr.setChar(toupper(vocabStr[0]), 0); - font->writeString(this, vocabStr, Common::Point(bounds.left, bounds.top)); - break; } + + vocabStr = scene.getVocab(vocabId); + vocabStr.setChar(toupper(vocabStr[0]), 0); + font->writeString(this, vocabStr, Common::Point(bounds.left, bounds.top)); break; case CAT_TALK_ENTRY: @@ -583,7 +583,7 @@ bool UserInterface::getBounds(ScrCategory category, int v, Common::Rect &bounds) break; case CAT_INV_LIST: - if (v < _inventoryTopIndex || v > (_inventoryTopIndex + 5)) + if (v < _inventoryTopIndex || v >= (_inventoryTopIndex + 5)) return false; heightMultiplier = v - _inventoryTopIndex; @@ -625,22 +625,22 @@ bool UserInterface::getBounds(ScrCategory category, int v, Common::Rect &bounds) if (category == CAT_INV_SCROLLER) { switch (v) { - case 1: + case SCROLLBAR_UP: // Arrow up bounds.top = 4; bounds.setHeight(7); break; - case 2: + case SCROLLBAR_DOWN: // Arrow down bounds.top = 35; bounds.setHeight(7); break; - case 3: + case SCROLLBAR_ELEVATOR: // Scroller bounds.top = 12; bounds.setHeight(22); break; - case 4: + case SCROLLBAR_THUMB: // Thumb bounds.top = _scrollbarElevator + 14; bounds.setHeight(1); -- cgit v1.2.3 From 15c64dd9725a9799878d80e978120d06b7b7074a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 18 Apr 2014 07:53:25 +0200 Subject: MADS: Implement scene 308 --- engines/mads/nebular/nebular_scenes.cpp | 2 + engines/mads/nebular/nebular_scenes3.cpp | 122 +++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes3.h | 15 ++++ 3 files changed, 139 insertions(+) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 6a78903645..edefd5bf5f 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -113,6 +113,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene304(vm); case 307: return new Scene307(vm); + case 308: + return new Scene308(vm); // Scene group #8 case 804: diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 68c2783f7e..e107c67121 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -1122,6 +1122,128 @@ void Scene307::actions() { _action._inProgress = false; } +/*------------------------------------------------------------------------*/ + +void Scene308::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene308::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites("*SC003x0"); + _globals._spriteIndexes[0] = _scene->_sprites.addSprites("*SC003x1"); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites("*SC003x2"); + + initForceField(&_forceField, true); + + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('b', 0)); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(Resources::formatName(307, 'X', 0, EXT_SS, "")); + + _vm->_palette->setEntry(252, 63, 30, 20); + _vm->_palette->setEntry(253, 45, 15, 12); + + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(127, 78)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 15); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 9); + _scene->_sequences.addTimer(48, 70); + + _game._player._visible = false; + _game._player._stepEnabled = false; + _scene->loadAnimation(formAnimName('a', -1), 60); + + sceneEntrySound(); + _game.loadQuoteSet(0xF4, 0xF5, 0xF6, 0); +} + +void Scene308::step() { + handleForceField(&_forceField, &_globals._spriteIndexes[0]); + + if (_game._trigger == 60) + _scene->_nextSceneId = 307; + + if (_game._trigger < 70) + return; + + switch (_game._trigger) { + case 70: { + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 18, 9, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 2, 3); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 9); + _scene->_kernelMessages.reset(); + int idx = _scene->_kernelMessages.add(Common::Point(171, 21), 0xFDFC, 0, 0, 120, _game.getQuote(244)); + _scene->_kernelMessages.setQuoted(idx, 2, true); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 71); + } + break; + + case 71: { + int seqIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 4); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 9); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], seqIdx); + _scene->_sequences.addTimer(48, 72); + } + break; + + case 72: + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 20, 5, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 3, 4); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 9); + _scene->_kernelMessages.reset(); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 73); + break; + + case 73: { + int seqIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 5); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 9); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], seqIdx); + _scene->_sequences.addTimer(48, 74); + } + break; + + case 74: { + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 20, 8, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 6, 7); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 9); + _scene->_kernelMessages.reset(); + int idx = _scene->_kernelMessages.add(Common::Point(171, 21), 0xFDFC, 0, 0, 120, _game.getQuote(245)); + _scene->_kernelMessages.setQuoted(idx, 2, true); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 75); + } + break; + + case 75: { + int seqIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 23, 5, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 8, 10); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 9); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], seqIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 76); + } + break; + + case 76: { + int seqIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 26, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 2, 3); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 9); + _scene->_kernelMessages.reset(); + int idx = _scene->_kernelMessages.add(Common::Point(171, 21), 0xFDFC, 0, 0, 120, _game.getQuote(246)); + _scene->_kernelMessages.setQuoted(idx, 2, true); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], seqIdx); + } + break; + + default: + break; + } +} /*------------------------------------------------------------------------*/ diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h index 5b25e391eb..d841ce6e3c 100644 --- a/engines/mads/nebular/nebular_scenes3.h +++ b/engines/mads/nebular/nebular_scenes3.h @@ -155,6 +155,21 @@ public: virtual void postActions() {}; }; +class Scene308: public Scene3xx { +private: + ForceField _forceField; + +public: + Scene308(MADSEngine *vm) : Scene3xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions() {}; + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 3813eddf023e25692d92402ddcbdbe491359c698 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 18 Apr 2014 09:01:04 -0400 Subject: MADS: Skip the unused SECTION0.HAG for now --- engines/mads/resources.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engines/mads/resources.cpp b/engines/mads/resources.cpp index 2742b5b435..aef22d3734 100644 --- a/engines/mads/resources.cpp +++ b/engines/mads/resources.cpp @@ -150,6 +150,9 @@ void HagArchive::loadIndex() { Common::File hagFile; for (int sectionIndex = -1; sectionIndex < 10; ++sectionIndex) { + if (sectionIndex == 0) + continue; + Common::String filename = (sectionIndex == -1) ? "GLOBAL.HAG" : Common::String::format("SECTION%d.HAG", sectionIndex); if (!hagFile.open(filename)) -- cgit v1.2.3 From cce0a4a3cf2f3380c25109f055e8b0d87b4c8b32 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 18 Apr 2014 09:16:47 -0400 Subject: MADS: Fix some memory leaks in SpriteAsset class --- engines/mads/assets.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/engines/mads/assets.cpp b/engines/mads/assets.cpp index bb6f5bd1eb..46a6d3c916 100644 --- a/engines/mads/assets.cpp +++ b/engines/mads/assets.cpp @@ -49,6 +49,11 @@ SpriteAsset::SpriteAsset(MADSEngine *vm, Common::SeekableReadStream *stream, int SpriteAsset::~SpriteAsset() { if (_usageIndex) _vm->_palette->_paletteUsage.resetPalFlags(_usageIndex); + + for (uint i = 0; i < _frames.size(); ++i) + delete _frames[i]._frame; + + delete _charInfo; } void SpriteAsset::load(Common::SeekableReadStream *stream, int flags) { -- cgit v1.2.3 From 058e1ae575cdb6acdc9625076c6449d2600c559c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 18 Apr 2014 21:54:21 +0200 Subject: MADS: Implement scene 309 --- engines/mads/animation.h | 7 +- engines/mads/nebular/nebular_scenes.cpp | 2 + engines/mads/nebular/nebular_scenes3.cpp | 195 ++++++++++++++++++++++++++++++- engines/mads/nebular/nebular_scenes3.h | 18 +++ 4 files changed, 214 insertions(+), 8 deletions(-) diff --git a/engines/mads/animation.h b/engines/mads/animation.h index 3b0341780c..1fff2c48d1 100644 --- a/engines/mads/animation.h +++ b/engines/mads/animation.h @@ -136,15 +136,13 @@ class Animation { private: MADSEngine *_vm; Scene *_scene; - AAHeader _header; - Common::Array _spriteListIndexes; Common::Array _messages; Common::Array _miscEntries; Common::Array _spriteSets; Font *_font; - int _currentFrame, _oldFrameEntry; + int _currentFrame; bool _freeFlag; bool _skipLoad; int _unkIndex; @@ -177,9 +175,12 @@ private: protected: Animation(MADSEngine *vm, Scene *scene); public: + AAHeader _header; + Common::Array _spriteListIndexes; Common::Array _frameEntries; Common::Array _uiEntries; bool _resetFlag; + int _oldFrameEntry; static Animation *init(MADSEngine *vm, Scene *scene); /* diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index edefd5bf5f..9978f574e8 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -115,6 +115,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene307(vm); case 308: return new Scene308(vm); + case 309: + return new Scene309(vm); // Scene group #8 case 804: diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index e107c67121..aefc0189cc 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -1149,7 +1149,7 @@ void Scene308::enter() { _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 9); _scene->_sequences.addTimer(48, 70); - _game._player._visible = false; + _game._player._visible = false; _game._player._stepEnabled = false; _scene->loadAnimation(formAnimName('a', -1), 60); @@ -1198,8 +1198,8 @@ void Scene308::step() { break; case 73: { - int seqIdx = _globals._sequenceIndexes[3]; - _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 5); + int seqIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 5); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 9); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], seqIdx); _scene->_sequences.addTimer(48, 74); @@ -1219,7 +1219,7 @@ void Scene308::step() { break; case 75: { - int seqIdx = _globals._sequenceIndexes[3]; + int seqIdx = _globals._sequenceIndexes[3]; _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 23, 5, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 8, 10); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 9); @@ -1229,7 +1229,7 @@ void Scene308::step() { break; case 76: { - int seqIdx = _globals._sequenceIndexes[3]; + int seqIdx = _globals._sequenceIndexes[3]; _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 26, 0, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 2, 3); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 9); @@ -1247,5 +1247,190 @@ void Scene308::step() { /*------------------------------------------------------------------------*/ +void Scene309::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene309::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites("*SC003x0"); + _globals._spriteIndexes[0] = _scene->_sprites.addSprites("*SC003x1"); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites("*SC003x2"); + + initForceField(&_forceField, true); + + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 0)); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(Resources::formatName(307, 'X', 0, EXT_SS, "")); + + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(127, 78)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 15); + + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 7, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], -1, 3); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 11); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_SPRITE, 3, 70); + + _vm->_palette->setEntry(252, 63, 37, 26); + _vm->_palette->setEntry(253, 45, 24, 17); + _vm->_palette->setEntry(16, 63, 63, 63); + _vm->_palette->setEntry(17, 45, 45, 45); + _vm->_palette->setEntry(250, 63, 20, 20); + _vm->_palette->setEntry(251, 45, 10, 10); + + _game._player._visible = false; + _game._player._stepEnabled = false; + _scene->loadAnimation(formAnimName('a', -1), 60); + + _characterSpriteIndexes[0] = _scene->_activeAnimation->_spriteListIndexes[2]; + _characterSpriteIndexes[1] = _scene->_activeAnimation->_spriteListIndexes[2]; + _characterSpriteIndexes[2] = _scene->_activeAnimation->_spriteListIndexes[1]; + + _messagesIndexes[0] = -1; + _messagesIndexes[1] = -1; + _messagesIndexes[2] = -1; + + sceneEntrySound(); + + _game.loadQuoteSet(0xF7, 0xF8, 0xF9, 0x15C, 0x15D, 0x15E, 0); +} + +void Scene309::step() { + handleForceField(&_forceField, &_globals._spriteIndexes[0]); + + if (_game._trigger == 61) { + _messagesIndexes[0] = -1; + _messagesIndexes[1] = -1; + } + + if (_game._trigger == 62) + _messagesIndexes[2] = -1; + + if (_scene->_activeAnimation != nullptr) { + if (_lastFrame != _scene->_activeAnimation->getCurrentFrame()) { + _lastFrame = _scene->_activeAnimation->getCurrentFrame(); + if (_lastFrame == 39) { + _messagesIndexes[0] = _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 32, 61, 210, _game.getQuote(348)); + _messagesIndexes[1] = _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 32, 0, 210, _game.getQuote(349)); + } + + if (_lastFrame == 97) + _messagesIndexes[2] = _scene->_kernelMessages.add(Common::Point(0, 0), 0xFBFA, 32, 62, 180, _game.getQuote(350)); + + for (int charIdx = 0; charIdx < 3; charIdx++) { + if (_messagesIndexes[charIdx] >= 0) { + bool match = false; + int j = -1; + for (j = _scene->_activeAnimation->_oldFrameEntry; j < _scene->_activeAnimation->_header._frameEntriesCount; j++) { + if (_scene->_activeAnimation->_frameEntries[j]._spriteSlot._spritesIndex == _characterSpriteIndexes[charIdx]) { + match = true; + break; + } + } + + if (match) { + SpriteSlotSubset *curSpriteSlot = &_scene->_activeAnimation->_frameEntries[j]._spriteSlot; + _scene->_kernelMessages._entries[_messagesIndexes[charIdx]]._position.x = curSpriteSlot->_position.x; + _scene->_kernelMessages._entries[_messagesIndexes[charIdx]]._position.y = curSpriteSlot->_position.y - (50 + (14 * ((charIdx == 0) ? 2 : 1))); + } + } + } + } + } + + if (_game._trigger >= 70) { + switch (_game._trigger) { + case 70: { + int idx = _scene->_dynamicHotspots.add(689, 690, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(142, 146), FACING_NORTHEAST); + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 7, 4, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 2, 3); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 11); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 71); + } + break; + + case 71: { + int _oldIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 7, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 4, 7); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 11); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], _oldIdx); + int idx = _scene->_kernelMessages.add(Common::Point(85, 37), 0xFDFC, 0, 0, 120, _game.getQuote(248)); + _scene->_kernelMessages.setQuoted(idx, 2, true); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 72); + } + break; + + case 72: { + int _oldIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 7, 8, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 8, 11); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 11); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], _oldIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 73); + } + break; + + case 73: { + int _oldIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 7, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 12, 20); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 11); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], _oldIdx); + int idx = _scene->_kernelMessages.add(Common::Point(170, 49), 0xFDFC, 0, 0, 120, _game.getQuote(249)); + _scene->_kernelMessages.setQuoted(idx, 2, true); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 74); + } + break; + + case 74: { + int _oldIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 7, 6, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 21, 23); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 11); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], _oldIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 75); + } + break; + + case 75: { + int _oldIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 12, 6, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 24, 25); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], _oldIdx); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 11); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 76); + } + break; + + case 76: { + int _oldIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 26, 28); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], _oldIdx); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 11); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 77); + } + break; + + case 77: { + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 90, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 29, 30); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 11); + int idx = _scene->_kernelMessages.add(Common::Point(15, 46), 0xFDFC, 0, 0, 120, _game.getQuote(247)); + _scene->_kernelMessages.setQuoted(idx, 2, true); + _scene->_sequences.addTimer(120, 78); + } + break; + } + } + + if (_game._trigger == 60) + _scene->_nextSceneId = 308; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h index d841ce6e3c..4ca2c5a9ad 100644 --- a/engines/mads/nebular/nebular_scenes3.h +++ b/engines/mads/nebular/nebular_scenes3.h @@ -170,6 +170,24 @@ public: virtual void postActions() {}; }; +class Scene309: public Scene3xx { +private: + ForceField _forceField; + int _characterSpriteIndexes[3]; + int _messagesIndexes[3]; + int _lastFrame; + +public: + Scene309(MADSEngine *vm) : Scene3xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions() {}; + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 66f2a8572155caea28c0ff803d0028710cc7c4ff Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 18 Apr 2014 22:15:22 +0200 Subject: MADS: Implement scene 310 --- engines/mads/nebular/nebular_scenes.cpp | 2 ++ engines/mads/nebular/nebular_scenes3.cpp | 34 ++++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes3.h | 15 ++++++++++++++ 3 files changed, 51 insertions(+) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 9978f574e8..ff32eabfe8 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -117,6 +117,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene308(vm); case 309: return new Scene309(vm); + case 310: + return new Scene310(vm); // Scene group #8 case 804: diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index aefc0189cc..b6f5142165 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -1430,6 +1430,40 @@ void Scene309::step() { _scene->_nextSceneId = 308; } +/*------------------------------------------------------------------------*/ + +void Scene310::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene310::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites("*SC003x0"); + _globals._spriteIndexes[0] = _scene->_sprites.addSprites("*SC003x1"); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites("*SC003x2"); + + initForceField(&_forceField, true); + + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(Resources::formatName(307, 'X', 0, EXT_SS, "")); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[3], Common::Point(127, 78)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 15); + + _game._player._visible = false; + _game._player._stepEnabled = false; + _scene->loadAnimation(formAnimName('a', -1), 70); + + sceneEntrySound(); +} + +void Scene310::step() { + handleForceField(&_forceField, &_globals._spriteIndexes[0]); + + if (_game._trigger == 70) + _scene->_nextSceneId = 309; +} + + /*------------------------------------------------------------------------*/ } // End of namespace Nebular diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h index 4ca2c5a9ad..5b380c3ef1 100644 --- a/engines/mads/nebular/nebular_scenes3.h +++ b/engines/mads/nebular/nebular_scenes3.h @@ -188,6 +188,21 @@ public: virtual void postActions() {}; }; +class Scene310: public Scene3xx { +private: + ForceField _forceField; + +public: + Scene310(MADSEngine *vm) : Scene3xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions() {}; + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 3fa488db3a9174607d066c017a3f923e1919fd51 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 19 Apr 2014 00:57:18 +0200 Subject: MADS: Implement scene 311 --- engines/mads/nebular/nebular_scenes.cpp | 2 + engines/mads/nebular/nebular_scenes3.cpp | 294 ++++++++++++++++++++++++++++++- engines/mads/nebular/nebular_scenes3.h | 14 ++ engines/mads/sequence.cpp | 5 + engines/mads/sequence.h | 1 + 5 files changed, 313 insertions(+), 3 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index ff32eabfe8..ac2ab85644 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -119,6 +119,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene309(vm); case 310: return new Scene310(vm); + case 311: + return new Scene311(vm); // Scene group #8 case 804: diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index b6f5142165..59167cc088 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -1179,8 +1179,8 @@ void Scene308::step() { } break; - case 71: { - int seqIdx = _globals._sequenceIndexes[3]; + case 71: { + int seqIdx = _globals._sequenceIndexes[3]; _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 4); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 9); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], seqIdx); @@ -1218,7 +1218,7 @@ void Scene308::step() { } break; - case 75: { + case 75: { int seqIdx = _globals._sequenceIndexes[3]; _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 23, 5, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 8, 10); @@ -1463,6 +1463,294 @@ void Scene310::step() { _scene->_nextSceneId = 309; } +/*------------------------------------------------------------------------*/ + +void Scene311::setup() { + if (_scene->_currentSceneId == 391) + _globals[kSexOfRex] = REX_MALE; + + setPlayerSpritesPrefix(); + setAAName(); + + if (_scene->_currentSceneId == 304) + _game._player._spritesPrefix = ""; +} + +void Scene311::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(Resources::formatName(307, 'X', 0, EXT_SS, "")); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites("*RXCL_8"); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites("*RXCL_2"); + + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 15); + + _checkGuardFl = false; + _game.loadQuoteSet(0xFA, 0); + + if (_scene->_priorSceneId == 391) { + _globals[kSexOfRex] = REX_MALE; + _game._player._stepEnabled = false; + _game._player._visible = false; + _game._player._facing = FACING_SOUTH; + _game._player._playerPos = Common::Point(166, 101); + _scene->_sequences.addTimer(120, 71); + } else if (_scene->_priorSceneId == 310) + _game._player._playerPos = Common::Point(302, 145); + else if (_scene->_priorSceneId == 320) { + _game._player._playerPos = Common::Point(129, 113); + _game._player._facing = FACING_SOUTH; + } else if (_scene->_priorSceneId != -2) { + _game._player._visible = false; + _game._player._stepEnabled = false; + _scene->loadAnimation(formAnimName('a', -1), 70); + } + + sceneEntrySound(); +} + +void Scene311::step() { + if (_game._trigger == 70) + _scene->_nextSceneId = 310; + + if (_game._trigger >= 71) { + switch (_game._trigger) { + case 71: + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 2); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); + + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.addTimer(15, 72); + break; + + case 72: + _scene->_sequences.setDone(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 2); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.addTimer(15, 73); + break; + + case 73: + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 3); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); + + _scene->_sequences.setDone(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 3); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.addTimer(15, 74); + break; + + case 74: + _scene->_sequences.setDone(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 4, 5); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 75); + break; + + case 75: { + int oldIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 6); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], oldIdx); + _scene->_sequences.addTimer(15, 76); + } + break; + + case 76: + _scene->_sequences.setDone(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 7); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.addTimer(15, 77); + break; + + case 77: + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 2); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); + + _scene->_sequences.setDone(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 8); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.addTimer(15, 78); + break; + + case 78: + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 15); + + _scene->_sequences.setDone(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 9); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.addTimer(15, 79); + break; + + case 79: + _scene->_sequences.setDone(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 10, -2); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 80); + break; + + case 80: + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[3]); + _game._player._stepEnabled = true; + _game._player._visible = true; + break; + + default: + break; + } + } + + if (_game._player._moving && (_scene->_rails.getNext() > 0)) { + int x = _game._player._prepareWalkPos.x; + if (x < 75) + x = 75; + if (x > 207) + x = 207; + + _checkGuardFl = true; + _game._player.startWalking(Common::Point(x, 122), FACING_SOUTH); + _scene->_rails.resetNext(); + } +} + +void Scene311::actions() { + if (_action._lookFlag) + _vm->_dialogs->show(0x798F); + else if (_checkGuardFl) { + _checkGuardFl = false; + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.addQuote(0xFA, 120, 0); + } else if (_action.isAction(0x21F, 0x1E4)) + _scene->_nextSceneId = 320; + else if (_action.isAction(0x2F7, 0x11)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 50, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 3, -2); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 15); + + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 15, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], -1, 4); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[2]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + + case 1: { + int oldIdx = _globals._sequenceIndexes[1]; + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -2); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 15); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[1], oldIdx); + } + break; + + case 2: { + int oldIdx = _globals._sequenceIndexes[2]; + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 4, 10); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[2]); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], oldIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 3); + } + break; + + case 3: { + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 3); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); + + int oldIdx = _globals._sequenceIndexes[2]; + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 11); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[2]); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(167, 100)); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], oldIdx); + _scene->_sequences.addTimer(15, 4); + } + break; + + case 4: + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 2); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); + + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 12, 14); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[2]); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(167, 100)); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 5); + break; + + case 5: { + int oldIdx = _globals._sequenceIndexes[2]; + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 15); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[2]); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(167, 100)); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], oldIdx); + _scene->_sequences.addTimer(15, 6); + } + break; + + case 6: + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); + _scene->_sequences.addTimer(15, 7); + break; + + case 7: + _scene->_nextSceneId = 313; + break; + + default: + break; + } + } else if (_action.isAction(VERB_LOOK, 0x1E4)) + _vm->_dialogs->show(0x7986); + else if (_action.isAction(VERB_LOOK, 0x18D)) + _vm->_dialogs->show(0x7987); + else if (_action.isAction(VERB_LOOK, 0x220) || _action.isAction(0x155, 0x220)) + _vm->_dialogs->show(0x7988); + else if (_action.isAction(VERB_LOOK, 0x208) || _action.isAction(0x155, 0x208)) + _vm->_dialogs->show(0x7989); + else if (_action.isAction(VERB_TAKE, 0x208)) + _vm->_dialogs->show(0x798A); + else if (_action.isAction(VERB_LOOK, 0xCD) || _action.isAction(0x155, 0xCD)) + _vm->_dialogs->show(0x798B); + else if (_action.isAction(VERB_TAKE, 0xCD)) + _vm->_dialogs->show(0x798C); + else if (_action.isAction(VERB_LOOK, 0x2BA)) + _vm->_dialogs->show(0x798D); + else if (_action.isAction(VERB_LOOK, 0x2B9)) + _vm->_dialogs->show(0x798E); + else if (_action.isAction(VERB_LOOK, 0x11)) + _vm->_dialogs->show(0x7990); + else + return; + + _action._inProgress = false; +} /*------------------------------------------------------------------------*/ diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h index 5b380c3ef1..d4f26f40fa 100644 --- a/engines/mads/nebular/nebular_scenes3.h +++ b/engines/mads/nebular/nebular_scenes3.h @@ -203,6 +203,20 @@ public: virtual void postActions() {}; }; +class Scene311: public Scene3xx { +private: + bool _checkGuardFl; + +public: + Scene311(MADSEngine *vm) : Scene3xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions(); + virtual void postActions() {}; +}; } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index 3c2bab5329..07f7f9cdce 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -503,4 +503,9 @@ void SequenceList::setMsgLayout(int seqIndex) { updateTimeout(-1, seqIndex); } +void SequenceList::setDone(int seqIndex) { + _entries[seqIndex]._doneFlag = true; + _entries[seqIndex]._timeout = _vm->_game->_player._priorTimer; +} + } // End of namespace diff --git a/engines/mads/sequence.h b/engines/mads/sequence.h index 6d59175ba2..6cef3de02d 100644 --- a/engines/mads/sequence.h +++ b/engines/mads/sequence.h @@ -125,6 +125,7 @@ public: void updateTimeout(int spriteIdx, int seqIndex); void setScale(int spriteIdx, int scale); void setMsgLayout(int seqIndex); + void setDone(int seqIndex); void sub70C52(int seqIndex, int flags, int deltaX, int deltaY) { warning("TODO: sub70C52()"); } }; -- cgit v1.2.3 From 559efad195b2ec7e77bd9192328d9e48b2a81e29 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 19 Apr 2014 14:46:28 -0400 Subject: MADS: Moved Animation::free to be Scene::freeAnimation --- engines/mads/animation.cpp | 26 ---------------------- engines/mads/animation.h | 7 +----- engines/mads/nebular/nebular_scenes1.cpp | 10 ++++----- engines/mads/nebular/nebular_scenes2.cpp | 2 +- engines/mads/scene.cpp | 38 +++++++++++++++++++++++++++----- engines/mads/scene.h | 5 +++++ 6 files changed, 45 insertions(+), 43 deletions(-) diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index b2c257332e..ed274eb4a3 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -170,32 +170,6 @@ Animation::~Animation() { } } -void Animation::free() { - Scene &scene = _vm->_game->_scene; - Player &player = _vm->_game->_player; - - if (!scene._freeAnimationFlag) { - scene._spriteSlots.fullRefresh(true); - scene._sequences.scan(); - } - - // Refresh the player - if (player._visible) { - player._forceRefresh = true; - player.update(); - } - - // Remove any kernel messages in use by the animation - for (uint i = 0; i < _messages.size(); ++i) { - int msgIndex = _messages[i]._kernelMsgIndex; - if (msgIndex >= 0) - scene._kernelMessages.remove(msgIndex); - } - - _resetFlag = false; - delete this; -} - void Animation::load(UserInterface &interfaceSurface, MSurface &depthSurface, const Common::String &resName, int flags, Common::Array *palAnimData, SceneInfo *sceneInfo) { diff --git a/engines/mads/animation.h b/engines/mads/animation.h index 1fff2c48d1..8afb8cfcef 100644 --- a/engines/mads/animation.h +++ b/engines/mads/animation.h @@ -137,7 +137,6 @@ private: MADSEngine *_vm; Scene *_scene; - Common::Array _messages; Common::Array _miscEntries; Common::Array _spriteSets; Font *_font; @@ -179,6 +178,7 @@ public: Common::Array _spriteListIndexes; Common::Array _frameEntries; Common::Array _uiEntries; + Common::Array _messages; bool _resetFlag; int _oldFrameEntry; @@ -188,11 +188,6 @@ public: */ ~Animation(); - /** - * Releases scene resources used by the animation, and then deletes it - */ - void free(); - /** * Loads animation data */ diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index bb5229ef16..c7ab075d4f 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -1560,7 +1560,7 @@ void Scene104::step() { switch (_game._trigger) { case 0: _scene->_kernelMessages.reset(); - _scene->_activeAnimation->free(); + _scene->freeAnimation(); _scene->resetScene(); _game._player._stepEnabled = false; _game._player._visible = false; @@ -1590,7 +1590,7 @@ void Scene104::step() { switch (_game._trigger) { case 0: _scene->_kernelMessages.reset(); - _scene->_activeAnimation->free(); + _scene->freeAnimation(); _scene->resetScene(); _game._player._stepEnabled = false; _game._player._visible = false; @@ -1629,7 +1629,7 @@ void Scene104::step() { switch (_game._trigger) { case 0: _scene->_kernelMessages.reset(); - _scene->_activeAnimation->free(); + _scene->freeAnimation(); _scene->resetScene(); _game._player._stepEnabled = false; _game._player._visible = false; @@ -2565,7 +2565,7 @@ void Scene109::actions() { } } } - _scene->_activeAnimation->free(); + _scene->freeAnimation(); _scene->_sequences.remove(_globals._sequenceIndexes[8]); _scene->_sprites.remove(_globals._spriteIndexes[8]); _scene->_spriteSlots.clear(); @@ -2953,7 +2953,7 @@ void Scene112::enter() { void Scene112::step() { if ((_scene->_activeAnimation != nullptr) && (_game._storyMode == STORYMODE_NICE)) { if (_scene->_activeAnimation->getCurrentFrame() >= 54) { - _scene->_activeAnimation->free(); + _scene->freeAnimation(); _game._trigger = 70; } } diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 6080c09fd4..a2d3c45460 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -3709,7 +3709,7 @@ void Scene210::setDialogNode(int node) { _game._player._visible = false; _vm->_palette->lock(); _scene->_kernelMessages.reset(); - _scene->_activeAnimation->free(); + _scene->freeAnimation(); _scene->_activeAnimation = nullptr; _scene->resetScene(); diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 99151c1267..65d1c04c0c 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -396,11 +396,8 @@ void Scene::doFrame() { _cyclingActive = true; _vm->_game->_fx = kTransitionNone; - if (_freeAnimationFlag && _activeAnimation) { - _activeAnimation->free(); - _freeAnimationFlag = false; - _activeAnimation = nullptr; - } + if (_freeAnimationFlag) + freeAnimation(); } void Scene::drawElements(ScreenTransition transitionType, bool surfaceFlag) { @@ -600,4 +597,35 @@ void Scene::resetScene() { _sequences.clear(); } +void Scene::freeAnimation() { + if (_activeAnimation) { + Player &player = _vm->_game->_player; + + if (!_freeAnimationFlag) { + _spriteSlots.fullRefresh(true); + _sequences.scan(); + } + + // Refresh the player + if (player._visible) { + player._forceRefresh = true; + player.update(); + } + + // Remove any kernel messages in use by the animation + for (uint i = 0; i < _activeAnimation->_messages.size(); ++i) { + int msgIndex = _activeAnimation->_messages[i]._kernelMsgIndex; + if (msgIndex >= 0) + _kernelMessages.remove(msgIndex); + } + + // Delete the animation + delete _activeAnimation; + _activeAnimation = nullptr; + } + + _freeAnimationFlag = false; +} + + } // End of namespace MADS diff --git a/engines/mads/scene.h b/engines/mads/scene.h index b695f3b1fa..7944576a5a 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -222,6 +222,11 @@ public: * leaving any player sprites list in place at the start of the list. */ void removeSprites(); + + /** + * Frees any currently active animation for the scene + */ + void freeAnimation(); }; } // End of namespace MADS -- cgit v1.2.3 From 34d0bc72b571e5e6e0b4b4f3ee1a627cbf470d72 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 19 Apr 2014 23:26:27 +0200 Subject: MADS: Implement scene 313, come renaming in RGB4 structure, used by AnimPalData --- engines/mads/nebular/nebular_scenes.cpp | 2 + engines/mads/nebular/nebular_scenes3.cpp | 75 ++++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes3.h | 17 ++++++++ engines/mads/palette.h | 6 +-- engines/mads/scene.cpp | 2 +- engines/mads/scene_data.cpp | 6 +-- 6 files changed, 101 insertions(+), 7 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index ac2ab85644..1c19d244b9 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -121,6 +121,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene310(vm); case 311: return new Scene311(vm); + case 313: + return new Scene313(vm); // Scene group #8 case 804: diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 59167cc088..603f87535c 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -1754,5 +1754,80 @@ void Scene311::actions() { /*------------------------------------------------------------------------*/ +void Scene313::setup() { + setPlayerSpritesPrefix(); + _game._player._spritesPrefix = "RM313A"; + setAAName(); +} + +void Scene313::enter() { + _scene->_userInterface.setup(kInputLimitedSentences); + gender_timer = 0; + gender_threshold = _vm->getRandomNumber(3, 9) * 600; + + if ((_scene->_priorSceneId == 366) || (_scene->_priorSceneId == 316)) { + _game._player._playerPos = Common::Point(30, 80); + _game._player._facing = FACING_NORTH; + } else if ((_scene->_priorSceneId == 311) || (_scene->_priorSceneId == 361) || (_scene->_priorSceneId == 391)) { + _game._player._playerPos = Common::Point(90, 70); + _game._player._facing = FACING_EAST; + } else if (_scene->_priorSceneId == 390) { + _game._player._playerPos = Common::Point(126, 70); + _game._player._facing = FACING_EAST; + } else if ((_scene->_priorSceneId == 389) || (_scene->_priorSceneId == 399)) { + _game._player._playerPos = Common::Point(163, 70); + _game._player._facing = FACING_WEST; + } else if (_scene->_priorSceneId == 388) { + _game._player._playerPos = Common::Point(199, 70); + _game._player._facing = FACING_WEST; + } else if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(234, 70); + _game._player._facing = FACING_WEST; + } + + if (_globals[kAfterHavoc]) { + for (uint16 i = 0; i < _scene->_animPalData.size(); i++) { + int palIdx = _scene->_animPalData[i]._firstColorIndex; + int size = _scene->_animPalData[i]._colorCount * 3; + memset(&_vm->_palette->_savedPalette[palIdx], 0, size); + memset(&_vm->_palette->_mainPalette[palIdx], 0, size); + } + } + + sceneEntrySound(); +} + +void Scene313::actions() { + if (_action.isAction(0x2FB, 0x2FC)) + _scene->_nextSceneId = 387; + else if (_action.isAction(0x2FB, 0x2FD)) + _scene->_nextSceneId = 388; + else if (_action.isAction(0x2FB, 0x2FE)) { + if (_globals[kAfterHavoc]) + _scene->_nextSceneId = 399; + else + _scene->_nextSceneId = 389; + } else if (_action.isAction(0x2FB, 0x2FF)) + _scene->_nextSceneId = 390; + else if (_action.isAction(0x2FB, 0x2EF)) { + if (_globals[kSexOfRex] == REX_FEMALE) { + _globals[kSexOfRex] = REX_MALE; + _vm->_dialogs->show(0x7A45); + } + _scene->_nextSceneId = 391; + } else if (_action.isAction(0x2FB, 0x300)) { + if (_globals[kSexOfRex] == REX_FEMALE) { + _globals[kSexOfRex] = REX_MALE; + _vm->_dialogs->show(0x7A45); + } + _scene->_nextSceneId = 366; + } else if (!_action.isAction(0x301, 0x2D4)) + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h index d4f26f40fa..57b05e8e16 100644 --- a/engines/mads/nebular/nebular_scenes3.h +++ b/engines/mads/nebular/nebular_scenes3.h @@ -217,6 +217,23 @@ public: virtual void actions(); virtual void postActions() {}; }; + +class Scene313: public Scene3xx { +private: + uint32 gender_clock; + uint32 gender_timer; + uint32 gender_threshold; + +public: + Scene313(MADSEngine *vm) : Scene3xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step() {}; + virtual void preActions() {}; + virtual void actions(); + virtual void postActions() {}; +}; } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/palette.h b/engines/mads/palette.h index 728fd0969a..b306c8acb0 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -46,12 +46,12 @@ enum { }; struct RGB4 { - byte r; + byte _colorCount; byte g; - byte b; + byte _firstColorIndex; byte u; - RGB4() { r = g = b = u = 0; } + RGB4() { _colorCount = g = _firstColorIndex = u = 0; } }; struct RGB6 { diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 65d1c04c0c..aff4aa36aa 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -254,7 +254,7 @@ void Scene::initPaletteAnimation(Common::Array &animData, bool animFlag) { // Calculate total _animCount = 0; for (uint i = 0; i < _animPalData.size(); ++i) - _animCount += _animPalData[i].r; + _animCount += _animPalData[i]._colorCount; _animVal1 = (_animCount > 16) ? 3 : 0; _cyclingActive = animFlag; diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index 6eb6be2c1e..d921465c04 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -67,9 +67,9 @@ void ARTHeader::load(Common::SeekableReadStream *f) { palCount = f->readUint16LE(); for (int i = 0; i < palCount; ++i) { RGB4 rgb; - rgb.r = f->readByte(); + rgb._colorCount = f->readByte(); rgb.g = f->readByte(); - rgb.b = f->readByte(); + rgb._firstColorIndex = f->readByte(); rgb.u = f->readByte(); _palAnimData.push_back(rgb); @@ -219,7 +219,7 @@ void SceneInfo::load(int sceneId, int variant, const Common::String &resName, for (uint i = 0; i < _palAnimData.size(); ++i) { byte g = _palAnimData[i].g; - _palAnimData[i].b = artHeader._palette[g]._palIndex; + _palAnimData[i]._firstColorIndex = artHeader._palette[g]._palIndex; } } } -- cgit v1.2.3 From c4669dd2f2ec850f3a42794dbbc134febed229e2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 19 Apr 2014 17:43:44 -0400 Subject: MADS: Fix refresh of inventory list after scrolling --- engines/mads/screen.cpp | 12 +----------- engines/mads/screen.h | 1 - engines/mads/user_interface.cpp | 10 ++++++---- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index 5f09737620..9dec5a8b1b 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -54,8 +54,6 @@ void DirtyArea::setArea(int width, int height, int maxWidth, int maxHeight) { right = maxWidth; _bounds.right = right; - _bounds2.left = _bounds.width() / 2; - _bounds2.right = _bounds.left + (_bounds.width() + 1) / 2 - 1; if (_bounds.top < 0) _bounds.top = 0; @@ -68,9 +66,6 @@ void DirtyArea::setArea(int width, int height, int maxWidth, int maxHeight) { bottom = maxHeight; _bounds.bottom = bottom; - _bounds2.top = _bounds.height() / 2; - _bounds2.bottom = _bounds.top + (_bounds.height() + 1) / 2 - 1; - _active = true; } @@ -193,7 +188,7 @@ void DirtyAreas::merge(int startIndex, int count) { * Returns true if two dirty areas intersect */ bool DirtyAreas::intersects(int idx1, int idx2) { - return (*this)[idx1]._bounds2.intersects((*this)[idx2]._bounds2); + return (*this)[idx1]._bounds.intersects((*this)[idx2]._bounds); } void DirtyAreas::mergeAreas(int idx1, int idx2) { @@ -202,11 +197,6 @@ void DirtyAreas::mergeAreas(int idx1, int idx2) { da1._bounds.extend(da2._bounds); - da1._bounds2.left = da1._bounds.width() / 2; - da1._bounds2.right = da1._bounds.left + (da1._bounds.width() + 1) / 2 - 1; - da1._bounds2.top = da1._bounds.height() / 2; - da1._bounds2.bottom = da1._bounds.top + (da1._bounds.height() + 1) / 2 - 1; - da2._active = false; da2._mergedArea = &da1; da1._textActive = true; diff --git a/engines/mads/screen.h b/engines/mads/screen.h index 272ef9ed56..ba01cbc468 100644 --- a/engines/mads/screen.h +++ b/engines/mads/screen.h @@ -66,7 +66,6 @@ private: friend class DirtyAreas; public: Common::Rect _bounds; - Common::Rect _bounds2; bool _textActive; bool _active; DirtyArea *_mergedArea; diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 594d549f87..7b12ef4941 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -98,7 +98,7 @@ void UISlots::draw(bool updateFlag, bool delFlag) { if (dirtyAreaPtr) dirtyAreaPtr->_active = true; - // Copy parts of the user interface background that are going to have sprites drawn + // Copy parts of the user interface background that need to be erased for (uint idx = 0; idx < size(); ++idx) { DirtyArea &dirtyArea = userInterface._dirtyAreas[idx]; UISlot &slot = (*this)[idx]; @@ -106,11 +106,13 @@ void UISlots::draw(bool updateFlag, bool delFlag) { if (dirtyArea._active && dirtyArea._bounds.width() > 0 && dirtyArea._bounds.height() > 0 && slot._flags >= -20) { - // TODO: Figure out the difference between two copy methods used if (slot._flags >= IMG_ERASE) { + // Merge area + error("TODO: Create a sprite merge method"); userInterface._surface.copyTo(&userInterface, dirtyArea._bounds, Common::Point(dirtyArea._bounds.left, dirtyArea._bounds.top)); } else { + // Copy area userInterface._surface.copyTo(&userInterface, dirtyArea._bounds, Common::Point(dirtyArea._bounds.left, dirtyArea._bounds.top)); } @@ -183,7 +185,7 @@ void UISlots::draw(bool updateFlag, bool delFlag) { if (slot._flags < IMG_STATIC) { if (delFlag || updateFlag) remove_at(idx); - else if (slot._flags >= -20) + else if (slot._flags > -20) slot._flags -= 20; } else { if (updateFlag) @@ -721,7 +723,7 @@ void UserInterface::inventoryAnim() { // Loop through the slots list for inventory animation entry for (uint i = 0; i < _uiSlots.size(); ++i) { if (_uiSlots[i]._segmentId == IMG_SPINNING_OBJECT) - _uiSlots[i]._flags = -5; + _uiSlots[i]._flags = IMG_UPDATE_ONLY; } // Add a new slot entry for the inventory animation -- cgit v1.2.3 From 58378a0965dd2a0631973786500b0fd171b8f680 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 19 Apr 2014 19:20:57 -0400 Subject: MADS: Implemented MSurface::mergeFrom method --- engines/mads/msurface.cpp | 44 +++++++++++++++++++++++++++++++++++++++++ engines/mads/msurface.h | 8 ++++++++ engines/mads/user_interface.cpp | 3 +-- 3 files changed, 53 insertions(+), 2 deletions(-) diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp index 2c9d093877..75aad01ee1 100644 --- a/engines/mads/msurface.cpp +++ b/engines/mads/msurface.cpp @@ -418,6 +418,50 @@ void MSurface::copyFrom(MSurface *src, const Common::Point &destPos, int depth, } } +void MSurface::mergeFrom(MSurface *src, const Common::Rect &srcBounds, const Common::Point &destPos) { + // Validation of the rectangle and position + int destX = destPos.x, destY = destPos.y; + if ((destX >= w) || (destY >= h)) + return; + + Common::Rect copyRect = srcBounds; + if (destX < 0) { + copyRect.left += -destX; + destX = 0; + } + else if (destX + copyRect.width() > w) { + copyRect.right -= destX + copyRect.width() - w; + } + if (destY < 0) { + copyRect.top += -destY; + destY = 0; + } + else if (destY + copyRect.height() > h) { + copyRect.bottom -= destY + copyRect.height() - h; + } + + if (!copyRect.isValidRect()) + return; + + // Copy the specified area + + byte *data = src->getData(); + byte *srcPtr = data + (src->getWidth() * copyRect.top + copyRect.left); + byte *destPtr = (byte *)pixels + (destY * getWidth()) + destX; + + for (int rowCtr = 0; rowCtr < copyRect.height(); ++rowCtr) { + // Process each line of the area + for (int xCtr = 0; xCtr < copyRect.width(); ++xCtr) { + // Check for the range used for on-screen text, which should be kept intact + if (srcPtr[xCtr] < 8 || srcPtr[xCtr] > 15) + destPtr[xCtr] = srcPtr[xCtr]; + } + + srcPtr += src->getWidth(); + destPtr += getWidth(); + } +} + void MSurface::scrollX(int xAmount) { if (xAmount == 0) return; diff --git a/engines/mads/msurface.h b/engines/mads/msurface.h index 7cf2bbe15b..f590bac2e5 100644 --- a/engines/mads/msurface.h +++ b/engines/mads/msurface.h @@ -187,6 +187,14 @@ public: dest->copyFrom(this, srcBounds, destPos, transparentColor); } + /** + * Merges a sub-section of another surface into the current one. + * @param src Source surface + * @param srcBounds Area to copy/merge from + * @param destPos Destination position to draw in current surface + */ + void mergeFrom(MSurface *src, const Common::Rect &srcBounds, const Common::Point &destPos); + /** * Scroll the screen horizontally by a given amount * @param xAmount Horizontal amount diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 7b12ef4941..52b466a0aa 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -108,8 +108,7 @@ void UISlots::draw(bool updateFlag, bool delFlag) { if (slot._flags >= IMG_ERASE) { // Merge area - error("TODO: Create a sprite merge method"); - userInterface._surface.copyTo(&userInterface, dirtyArea._bounds, + userInterface.mergeFrom(&userInterface._surface, dirtyArea._bounds, Common::Point(dirtyArea._bounds.left, dirtyArea._bounds.top)); } else { // Copy area -- cgit v1.2.3 From ad6a80cae796f781e7c8a0e53ad008504c54e266 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 19 Apr 2014 20:18:39 -0400 Subject: MADS: Add support for sprite flipping in UI background animations --- engines/mads/animation.cpp | 7 +++++-- engines/mads/user_interface.cpp | 24 +++++++++++++++++------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index ed274eb4a3..fec7f74423 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -101,16 +101,19 @@ void AnimMessage::load(Common::SeekableReadStream *f) { void AnimFrameEntry::load(Common::SeekableReadStream *f, bool uiFlag) { if (uiFlag) { f->skip(2); + _frameNumber = -1; // Unused _seqIndex = f->readByte(); _spriteSlot._spritesIndex = f->readByte(); - _spriteSlot._frameNumber = f->readUint16LE(); + _spriteSlot._frameNumber = (int8)f->readByte(); + f->skip(1); _spriteSlot._position.x = f->readSint16LE(); _spriteSlot._position.y = f->readSint16LE(); } else { _frameNumber = f->readUint16LE(); _seqIndex = f->readByte(); _spriteSlot._spritesIndex = f->readByte(); - _spriteSlot._frameNumber = f->readUint16LE(); + uint frame = f->readUint16LE(); + _spriteSlot._frameNumber = (frame < 0x80) ? frame : -(frame & 0x7f); _spriteSlot._position.x = f->readSint16LE(); _spriteSlot._position.y = f->readSint16LE(); _spriteSlot._depth = f->readSByte(); diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 52b466a0aa..09b3c8d5cf 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -65,7 +65,7 @@ void UISlots::add(const AnimFrameEntry &frameEntry) { ie._flags = IMG_UPDATE; ie._segmentId = frameEntry._seqIndex; ie._spritesIndex = frameEntry._spriteSlot._spritesIndex; - ie._frameNumber = frameEntry._frameNumber; + ie._frameNumber = frameEntry._spriteSlot._frameNumber; ie._position = frameEntry._spriteSlot._position; push_back(ie); @@ -148,15 +148,25 @@ void UISlots::draw(bool updateFlag, bool delFlag) { if (dirtyArea->_textActive) { SpriteAsset *asset = scene._sprites[slot._spritesIndex]; - + + // Get the frame details + int frameNumber = ABS(slot._frameNumber); + bool flipped = slot._frameNumber < 0; + if (slot._segmentId == IMG_SPINNING_OBJECT) { - MSprite *sprite = asset->getFrame(slot._frameNumber & 0x7F); + MSprite *sprite = asset->getFrame(frameNumber); sprite->copyTo(&userInterface, slot._position, sprite->getTransparencyIndex()); } else { - MSprite *sprite = asset->getFrame(slot._frameNumber - 1); - sprite->copyTo(&userInterface, slot._position, - sprite->getTransparencyIndex()); + MSprite *sprite = asset->getFrame(frameNumber - 1); + + if (flipped) { + MSurface *spr = sprite->flipHorizontal(); + spr->copyTo(&userInterface, slot._position, sprite->getTransparencyIndex()); + delete spr; + } else { + sprite->copyTo(&userInterface, slot._position, sprite->getTransparencyIndex()); + } } } } @@ -251,7 +261,7 @@ void UserInterface::load(const Common::String &resName) { // Read in the surface data Common::SeekableReadStream *pixelsStream = madsPack.getItemStream(1); pixelsStream->read(_surface.getData(), MADS_SCREEN_WIDTH * MADS_INTERFACE_HEIGHT); - delete pixelsStream; + delete pixelsStream; } void UserInterface::setup(InputMode inputMode) { -- cgit v1.2.3 From 1362414e77bfbd17d7a0224ce5fb7275c793c7c4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 19 Apr 2014 22:49:14 -0400 Subject: MADS: Implement palette animation code --- engines/mads/animation.cpp | 21 +++++---- engines/mads/animation.h | 4 +- engines/mads/dialogs.cpp | 4 +- engines/mads/dialogs.h | 2 +- engines/mads/events.cpp | 4 ++ engines/mads/nebular/nebular_scenes3.cpp | 8 ++-- engines/mads/palette.cpp | 3 +- engines/mads/palette.h | 10 ++--- engines/mads/scene.cpp | 74 ++++++++++++++++++++++++++------ engines/mads/scene.h | 16 ++++--- engines/mads/scene_data.cpp | 32 +++++++------- engines/mads/scene_data.h | 4 +- 12 files changed, 118 insertions(+), 64 deletions(-) diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index fec7f74423..874ce69301 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -112,8 +112,7 @@ void AnimFrameEntry::load(Common::SeekableReadStream *f, bool uiFlag) { _frameNumber = f->readUint16LE(); _seqIndex = f->readByte(); _spriteSlot._spritesIndex = f->readByte(); - uint frame = f->readUint16LE(); - _spriteSlot._frameNumber = (frame < 0x80) ? frame : -(frame & 0x7f); + _spriteSlot._frameNumber = f->readSint16LE(); _spriteSlot._position.x = f->readSint16LE(); _spriteSlot._position.y = f->readSint16LE(); _spriteSlot._depth = f->readSByte(); @@ -174,7 +173,7 @@ Animation::~Animation() { } void Animation::load(UserInterface &interfaceSurface, MSurface &depthSurface, - const Common::String &resName, int flags, Common::Array *palAnimData, + const Common::String &resName, int flags, Common::Array *palCycles, SceneInfo *sceneInfo) { Common::String resourceName = resName; if (!resourceName.contains(".")) @@ -191,7 +190,7 @@ void Animation::load(UserInterface &interfaceSurface, MSurface &depthSurface, flags |= PALFLAG_RESERVED; if (flags & ANIMFLAG_LOAD_BACKGROUND) { - loadInterface(interfaceSurface, depthSurface, _header, flags, palAnimData, sceneInfo); + loadInterface(interfaceSurface, depthSurface, _header, flags, palCycles, sceneInfo); } if (flags & ANIMFLAG_LOAD_BACKGROUND_ONLY) { // No data @@ -376,24 +375,24 @@ bool Animation::drawFrame(SpriteAsset &spriteSet, const Common::Point &pt, int f } void Animation::loadInterface(UserInterface &interfaceSurface, MSurface &depthSurface, - AAHeader &header, int flags, Common::Array *palAnimData, SceneInfo *sceneInfo) { + AAHeader &header, int flags, Common::Array *palCycles, SceneInfo *sceneInfo) { _scene->_depthStyle = 0; if (header._animMode <= 2) { _vm->_palette->_paletteUsage.setEmpty(); sceneInfo->load(header._roomNumber, flags, header._interfaceFile, 0, depthSurface, interfaceSurface); _scene->_depthStyle = sceneInfo->_depthStyle == 2 ? 1 : 0; - if (palAnimData) { - palAnimData->clear(); - for (uint i = 0; i < sceneInfo->_palAnimData.size(); ++i) - palAnimData->push_back(sceneInfo->_palAnimData[i]); + if (palCycles) { + palCycles->clear(); + for (uint i = 0; i < sceneInfo->_paletteCycles.size(); ++i) + palCycles->push_back(sceneInfo->_paletteCycles[i]); } } else if (header._animMode == 4) { // Load a scene interface Common::String resourceName = "*" + header._interfaceFile; interfaceSurface.load(resourceName); - if (palAnimData) - palAnimData->clear(); + if (palCycles) + palCycles->clear(); } else { // Original has useless code here } diff --git a/engines/mads/animation.h b/engines/mads/animation.h index 8afb8cfcef..5faa47841e 100644 --- a/engines/mads/animation.h +++ b/engines/mads/animation.h @@ -165,7 +165,7 @@ private: * Load the user interface display for an animation */ void loadInterface(UserInterface &interfaceSurface, MSurface &depthSurface, - AAHeader &header, int flags, Common::Array *palAnimData, SceneInfo *sceneInfo); + AAHeader &header, int flags, Common::Array *palCycles, SceneInfo *sceneInfo); /** * Returns true if there is a scroll required @@ -192,7 +192,7 @@ public: * Loads animation data */ void load(UserInterface &interfaceSurface, MSurface &depthSurface, const Common::String &resName, - int flags, Common::Array *palAnimData, SceneInfo *sceneInfo); + int flags, Common::Array *palCycles, SceneInfo *sceneInfo); /** * Preload animation data for the scene diff --git a/engines/mads/dialogs.cpp b/engines/mads/dialogs.cpp index 8bc73e55dc..3c771e7ed9 100644 --- a/engines/mads/dialogs.cpp +++ b/engines/mads/dialogs.cpp @@ -125,7 +125,7 @@ TextDialog::TextDialog(MADSEngine *vm, const Common::String &fontName, // Save the high end of the palette, and set up the entries for dialog display Common::copy(&_vm->_palette->_mainPalette[TEXTDIALOG_CONTENT1 * 3], &_vm->_palette->_mainPalette[TEXTDIALOG_CONTENT1 * 3 + 8 * 3], - &_savedPalette[0]); + &_cyclingPalette[0]); Palette::setGradient(_vm->_palette->_mainPalette, TEXTDIALOG_CONTENT1, 2, 0x90, 0x80); Palette::setGradient(_vm->_palette->_mainPalette, TEXTDIALOG_EDGE, 2, 0x9C, 0x70); Palette::setGradient(_vm->_palette->_mainPalette, TEXTDIALOG_FC, 2, 0x90, 0x80); @@ -319,7 +319,7 @@ void TextDialog::drawWithInput() { } void TextDialog::restorePalette() { - Common::copy(&_savedPalette[0], &_savedPalette[8 * 3], + Common::copy(&_cyclingPalette[0], &_cyclingPalette[8 * 3], &_vm->_palette->_mainPalette[248 * 3]); _vm->_palette->setPalette(_vm->_palette->_mainPalette, 248, 8); } diff --git a/engines/mads/dialogs.h b/engines/mads/dialogs.h index 0c24dea5b9..e4f9bbb038 100644 --- a/engines/mads/dialogs.h +++ b/engines/mads/dialogs.h @@ -114,7 +114,7 @@ protected: int _askLineNum; Common::String _lines[TEXT_DIALOG_MAX_LINES]; int _lineXp[TEXT_DIALOG_MAX_LINES]; - byte _savedPalette[8 * 3]; + byte _cyclingPalette[8 * 3]; public: /** * Constructor diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp index 85c62e30bd..ac03dd5665 100644 --- a/engines/mads/events.cpp +++ b/engines/mads/events.cpp @@ -26,6 +26,7 @@ #include "engines/util.h" #include "mads/mads.h" #include "mads/events.h" +#include "mads/scene.h" #define GAME_FRAME_RATE 50 #define GAME_FRAME_TIME (1000 / GAME_FRAME_RATE) @@ -165,6 +166,9 @@ void EventsManager::checkForNextFrameCounter() { ++_frameCounter; _priorFrameTime = milli; + // Do any palette cycling + _vm->_game->_scene.animatePalette(); + // Give time to the debugger _vm->_debugger->onFrame(); diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 603f87535c..8287605270 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -1786,10 +1786,10 @@ void Scene313::enter() { } if (_globals[kAfterHavoc]) { - for (uint16 i = 0; i < _scene->_animPalData.size(); i++) { - int palIdx = _scene->_animPalData[i]._firstColorIndex; - int size = _scene->_animPalData[i]._colorCount * 3; - memset(&_vm->_palette->_savedPalette[palIdx], 0, size); + for (uint16 i = 0; i < _scene->_paletteCycles.size(); i++) { + int palIdx = _scene->_paletteCycles[i]._firstColorIndex; + int size = _scene->_paletteCycles[i]._colorCount * 3; + memset(&_vm->_palette->_cyclingPalette[palIdx], 0, size); memset(&_vm->_palette->_mainPalette[palIdx], 0, size); } } diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index 64e0f80766..4a3ea04434 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -458,7 +458,6 @@ void Palette::resetGamePalette(int lowRange, int highRange) { } void Palette::initPalette() { - RGB4 rgb; uint32 palMask = 1; if (_vm->_game->_player._spritesLoaded && _vm->_game->_player._numSprites) { @@ -528,7 +527,7 @@ void Palette::unlock() { void Palette::refreshHighColors() { int val = 18; if (_vm->_game->_scene._cyclingActive) - val += _vm->_game->_scene._animCount; + val += _vm->_game->_scene._totalCycleColors; setPalette(_mainPalette, val, 256 - val); } diff --git a/engines/mads/palette.h b/engines/mads/palette.h index b306c8acb0..75aff7a6ec 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -45,13 +45,13 @@ enum { PALFLAG_MASK = 0xfc00 // Mask for all the palette flags }; -struct RGB4 { +struct PaletteCycle { byte _colorCount; - byte g; + byte _firstListColor; byte _firstColorIndex; - byte u; + byte _ticks; - RGB4() { _colorCount = g = _firstColorIndex = u = 0; } + PaletteCycle() { _colorCount = _firstListColor = _firstColorIndex = _ticks = 0; } }; struct RGB6 { @@ -165,7 +165,7 @@ protected: void reset(); public: byte _mainPalette[PALETTE_SIZE]; - byte _savedPalette[PALETTE_SIZE]; + byte _cyclingPalette[PALETTE_SIZE]; uint32 _palFlags[PALETTE_COUNT]; PaletteUsage _paletteUsage; RGBList _rgbList; diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index aff4aa36aa..78a36d97d1 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -38,7 +38,8 @@ Scene::Scene(MADSEngine *vm): _vm(vm), _action(_vm), _depthSurface(vm), _sceneLogic = nullptr; _sceneInfo = nullptr; _cyclingActive = false; - _animVal1 = 0; + _cyclingThreshold = 0; + _cyclingDelay = 0; _depthStyle = 0; _roomChanged = false; _reloadSceneFlag = false; @@ -134,7 +135,7 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) { _depthSurface, _backgroundSurface); // Initialise palette animation for the scene - initPaletteAnimation(_sceneInfo->_palAnimData, false); + initPaletteAnimation(_sceneInfo->_paletteCycles, false); // Copy over nodes _rails.load(_sceneInfo->_nodes, &_depthSurface, _sceneInfo->_depthStyle); @@ -237,29 +238,75 @@ void Scene::loadVocabStrings() { f.close(); } -void Scene::initPaletteAnimation(Common::Array &animData, bool animFlag) { +void Scene::initPaletteAnimation(Common::Array &palCycles, bool animFlag) { // Initialise the animation palette and ticks list - _animTicksList.clear(); - _animPalData.clear(); + _cycleTicks.clear(); + _paletteCycles.clear(); - for (uint i = 0; i < animData.size(); ++i) { - _animTicksList.push_back(_vm->_events->getFrameCounter()); - _animPalData.push_back(animData[i]); + for (uint i = 0; i < palCycles.size(); ++i) { + _cycleTicks.push_back(_vm->_events->getFrameCounter()); + _paletteCycles.push_back(palCycles[i]); } // Save the initial starting palette Common::copy(&_vm->_palette->_mainPalette[0], &_vm->_palette->_mainPalette[PALETTE_SIZE], - &_vm->_palette->_savedPalette[0]); + &_vm->_palette->_cyclingPalette[0]); // Calculate total - _animCount = 0; - for (uint i = 0; i < _animPalData.size(); ++i) - _animCount += _animPalData[i]._colorCount; + _totalCycleColors = 0; + for (uint i = 0; i < _paletteCycles.size(); ++i) + _totalCycleColors += _paletteCycles[i]._colorCount; - _animVal1 = (_animCount > 16) ? 3 : 0; + _cyclingThreshold = (_totalCycleColors > 16) ? 3 : 0; _cyclingActive = animFlag; } +void Scene::animatePalette() { + byte rgb[3]; + + if (_cyclingActive) { + Scene::_cyclingDelay++; + if (_cyclingDelay >= _cyclingThreshold) { + uint32 frameCounter = _vm->_events->getFrameCounter(); + bool changesFlag = false; + for (int idx = 0; idx < _paletteCycles.size(); idx++) { + if (frameCounter >= (_cycleTicks[idx] + _paletteCycles[idx]._ticks)) { + _cycleTicks[idx] = frameCounter; + int count = _paletteCycles[idx]._colorCount; + int first = _paletteCycles[idx]._firstColorIndex; + int listIndex = _paletteCycles[idx]._firstListColor; + changesFlag = true; + + if (count > 1) { + // Make a copy of the last color + byte *pSrc = &_vm->_palette->_cyclingPalette[first * 3]; + byte *pEnd = pSrc + count * 3; + Common::copy(pEnd - 3, pEnd, &rgb[0]); + + // Shift the cycle palette forward one entry + Common::copy_backward(pSrc, pEnd - 3, pEnd); + + // Move the saved color to the start of the cycle + Common::copy(&rgb[0], &rgb[3], pSrc); + + if (++listIndex >= count) + listIndex = 0; + } + + _paletteCycles[idx]._firstListColor = listIndex; + } + } + + if (changesFlag) { + _vm->_palette->setPalette(_vm->_palette->_cyclingPalette, + _paletteCycles[0]._firstColorIndex, _totalCycleColors); + } + + _cyclingDelay = 0; + } + } +} + bool Scene::getDepthHighBits(const Common::Point &pt) { if (_sceneInfo->_depthStyle == 2) { return 0; @@ -627,5 +674,4 @@ void Scene::freeAnimation() { _freeAnimationFlag = false; } - } // End of namespace MADS diff --git a/engines/mads/scene.h b/engines/mads/scene.h index 7944576a5a..eb84fbd814 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -55,7 +55,7 @@ private: /* * Initialises the data for palette animation within the scene */ - void initPaletteAnimation(Common::Array &animData, bool animFlag); + void initPaletteAnimation(Common::Array &palCycles, bool animFlag); /** * Handles a single frame within the game scene @@ -106,10 +106,11 @@ public: DepthSurface _depthSurface; UserInterface _userInterface; bool _cyclingActive; - int _animVal1; - int _animCount; - Common::Array _animTicksList; - Common::Array _animPalData; + int _cyclingThreshold; + int _cyclingDelay; + int _totalCycleColors; + Common::Array _cycleTicks; + Common::Array _paletteCycles; Common::StringArray _vocabStrings; Animation *_animationData; Animation *_activeAnimation; @@ -195,6 +196,11 @@ public: */ void drawElements(ScreenTransition transitionType, bool surfaceFlag); + /** + * Handles cycling palette colors for the scene + */ + void animatePalette(); + /** * Load an animation */ diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index d921465c04..9f4d7d99ec 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -63,16 +63,16 @@ void ARTHeader::load(Common::SeekableReadStream *f) { } f->skip(6 * (256 - palCount)); - // Read unknown??? - palCount = f->readUint16LE(); - for (int i = 0; i < palCount; ++i) { - RGB4 rgb; - rgb._colorCount = f->readByte(); - rgb.g = f->readByte(); - rgb._firstColorIndex = f->readByte(); - rgb.u = f->readByte(); - - _palAnimData.push_back(rgb); + // Read palette animations + int cycleCount = f->readUint16LE(); + for (int i = 0; i < cycleCount; ++i) { + PaletteCycle cycle; + cycle._colorCount = f->readByte(); + cycle._firstListColor = f->readByte(); + cycle._firstColorIndex = f->readByte(); + cycle._ticks = f->readByte(); + + _paletteCycles.push_back(cycle); } } @@ -202,9 +202,9 @@ void SceneInfo::load(int sceneId, int variant, const Common::String &resName, artHeader.load(stream); delete stream; - // Copy out the palette data - for (uint i = 0; i < artHeader._palAnimData.size(); ++i) - _palAnimData.push_back(artHeader._palAnimData[i]); + // Copy out the palette animation data + for (uint i = 0; i < artHeader._paletteCycles.size(); ++i) + _paletteCycles.push_back(artHeader._paletteCycles[i]); if (!(flags & 1)) { if (!_vm->_palette->_paletteUsage.empty()) { @@ -217,9 +217,9 @@ void SceneInfo::load(int sceneId, int variant, const Common::String &resName, if (_usageIndex > 0) { _vm->_palette->_paletteUsage.transform(artHeader._palette); - for (uint i = 0; i < _palAnimData.size(); ++i) { - byte g = _palAnimData[i].g; - _palAnimData[i]._firstColorIndex = artHeader._palette[g]._palIndex; + for (uint i = 0; i < _paletteCycles.size(); ++i) { + byte listColor = _paletteCycles[i]._firstListColor; + _paletteCycles[i]._firstColorIndex = artHeader._palette[listColor]._palIndex; } } } diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index e37aa43855..5b3d818b96 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -118,7 +118,7 @@ struct ARTHeader { int _width; int _height; Common::Array _palette; - Common::Array _palAnimData; + Common::Array _paletteCycles; void load(Common::SeekableReadStream *f); }; @@ -158,7 +158,7 @@ public: int _field4A; int _usageIndex; - Common::Array _palAnimData; + Common::Array _paletteCycles; WalkNodeList _nodes; public: /** -- cgit v1.2.3 From a05f3fef9eb03a0616c602afa4e80ea2e5bb2f92 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 20 Apr 2014 09:26:24 +0200 Subject: MADS: Remove unused variables in scene 313 --- engines/mads/nebular/nebular_scenes3.cpp | 2 -- engines/mads/nebular/nebular_scenes3.h | 17 ++++++++++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 8287605270..7c485481b3 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -1762,8 +1762,6 @@ void Scene313::setup() { void Scene313::enter() { _scene->_userInterface.setup(kInputLimitedSentences); - gender_timer = 0; - gender_threshold = _vm->getRandomNumber(3, 9) * 600; if ((_scene->_priorSceneId == 366) || (_scene->_priorSceneId == 316)) { _game._player._playerPos = Common::Point(30, 80); diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h index 57b05e8e16..f746b9f25e 100644 --- a/engines/mads/nebular/nebular_scenes3.h +++ b/engines/mads/nebular/nebular_scenes3.h @@ -219,11 +219,6 @@ public: }; class Scene313: public Scene3xx { -private: - uint32 gender_clock; - uint32 gender_timer; - uint32 gender_threshold; - public: Scene313(MADSEngine *vm) : Scene3xx(vm) {} @@ -234,6 +229,18 @@ public: virtual void actions(); virtual void postActions() {}; }; + +class Scene316: public Scene3xx { +public: + Scene316(MADSEngine *vm) : Scene3xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 9d25832a8106478eed9a1b581043c6ae16fc4f5c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 20 Apr 2014 11:08:25 -0400 Subject: MADS: Fix color of on-screen text --- engines/mads/palette.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index 4a3ea04434..d6cf652760 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -120,7 +120,7 @@ int PaletteUsage::process(Common::Array &palette, uint flags) { } int freeIndex; - int palCount = tempUsage.getGamePalFreeIndex(&freeIndex); + int palCount = getGamePalFreeIndex(&freeIndex); Common::Array palRange; for (uint palIndex = 0; palIndex < palette.size(); ++palIndex) { @@ -437,16 +437,14 @@ void Palette::resetGamePalette(int lowRange, int highRange) { Common::fill((byte *)&_palFlags[0], (byte *)&_palFlags[PALETTE_COUNT], 0); initVGAPalette(_mainPalette); - // Init low range to common RGB values + // Reserve the start of the palette for things like on-screen text if (lowRange) { - Common::fill(&_palFlags[0], &_palFlags[lowRange - 1], 1); + Common::fill(&_palFlags[0], &_palFlags[lowRange], 1); } - // Init high range to common RGB values + // Reserve the high end of the palette for dialog display if (highRange) { - _palFlags[255] = 1; - - Common::fill(&_palFlags[256 - highRange], &_palFlags[254], _palFlags[255]); + Common::fill(&_palFlags[256 - highRange], &_palFlags[256], 1); } _rgbList.clear(); -- cgit v1.2.3 From a31cae55a113e2103d6e5359bd27f64f84c16ed5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 20 Apr 2014 11:14:11 -0400 Subject: MADS: Added extra initialisation of Scene class fields --- engines/mads/scene.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 78a36d97d1..40a0a8f106 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -40,6 +40,7 @@ Scene::Scene(MADSEngine *vm): _vm(vm), _action(_vm), _depthSurface(vm), _cyclingActive = false; _cyclingThreshold = 0; _cyclingDelay = 0; + _totalCycleColors = 0; _depthStyle = 0; _roomChanged = false; _reloadSceneFlag = false; @@ -50,6 +51,11 @@ Scene::Scene(MADSEngine *vm): _vm(vm), _action(_vm), _depthSurface(vm), _frameStartTime = 0; _layer = LAYER_GUI; _lookFlag = false; + _bandsRange = 0; + _scaleRange = 0; + _interfaceY = 0; + _spritesCount = 0; + _variant = 0; _paletteUsageF.push_back(PaletteUsage::UsageEntry(0xF)); -- cgit v1.2.3 From 2ccaea811f7c1859fc474eda92e7ceb48b3d5adf Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 20 Apr 2014 11:32:55 -0400 Subject: MADS: Fix update of palette due to palette cycling --- engines/mads/scene.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 40a0a8f106..e6888162d3 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -304,8 +304,9 @@ void Scene::animatePalette() { } if (changesFlag) { - _vm->_palette->setPalette(_vm->_palette->_cyclingPalette, - _paletteCycles[0]._firstColorIndex, _totalCycleColors); + int firstColor = _paletteCycles[0]._firstColorIndex; + byte *pSrc = &_vm->_palette->_cyclingPalette[firstColor * 3]; + _vm->_palette->setPalette(pSrc, firstColor, _totalCycleColors); } _cyclingDelay = 0; -- cgit v1.2.3 From fb78efa3a798707f86e8902ce10a5370033a9b8d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 20 Apr 2014 22:12:54 +0200 Subject: MADS: Implement scene 316 --- engines/mads/nebular/nebular_scenes.cpp | 2 + engines/mads/nebular/nebular_scenes3.cpp | 457 +++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes3.h | 4 + 3 files changed, 463 insertions(+) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 1c19d244b9..8c75cbdd7b 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -123,6 +123,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene311(vm); case 313: return new Scene313(vm); + case 316: + return new Scene316(vm); // Scene group #8 case 804: diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 7c485481b3..e1d1180dc4 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -1825,6 +1825,463 @@ void Scene313::actions() { _action._inProgress = false; } +/*------------------------------------------------------------------------*/ + +void Scene316::setup() { + if (_scene->_currentSceneId == 366) + _globals[kSexOfRex] = REX_MALE; + + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene316::handleRexInGrate() { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); + _scene->_sequences.addTimer(15, 1); + break; + + case 1: + _scene->_sequences.setDone(_globals._sequenceIndexes[4]); + _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 12, 3, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 2, 3); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + + case 2: { + int oldIdx = _globals._sequenceIndexes[4]; + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 4, 8); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], oldIdx); + + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 2, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 12); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 3); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 4); + } + break; + + case 3: { + int oldIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 12); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], oldIdx); + } + break; + + case 4: { + int oldIdx = _globals._sequenceIndexes[4]; + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 10, 11); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], oldIdx); + + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[3], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 5, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 3); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 5); + } + break; + + case 5: { + int oldIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 3); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 3); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], oldIdx); + + oldIdx = _globals._sequenceIndexes[4]; + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 12); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], oldIdx); + _scene->_sequences.addTimer(15, 6); + } + break; + + case 6: + _scene->_sequences.setDone(_globals._sequenceIndexes[4]); + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 13, 14); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); + + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[3], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 2, 3); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 3); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 7); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 8); + break; + + case 7: + _scene->_sequences.setDone(_globals._sequenceIndexes[4]); + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 15); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], -1); + break; + + case 8: { + int oldIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 3); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], oldIdx); + _scene->_sequences.addTimer(15, 9); + } + break; + + case 9: + _scene->_sequences.setDone(_globals._sequenceIndexes[4]); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 3); + _scene->_sequences.addTimer(48, 10); + break; + + case 10: + _scene->_nextSceneId = 313; + break; + + default: + break; + } +} + +void Scene316::handleRoxInGrate() { + int temp; + int temp1; + + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 1); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); + _scene->_sequences.addTimer(15, 1); + break; + + case 1: + _scene->_sequences.setDone(_globals._sequenceIndexes[5]); + _globals._sequenceIndexes[5] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[5], false, 17, 3, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 2, 3); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + + case 2: + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 17, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 2, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 12); + + temp = _globals._sequenceIndexes[5]; + _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 17, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 4, 8); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[5], temp); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 3); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 4); + break; + + case 3: + temp1 = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 12); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], temp1); + break; + + case 4: + temp = _globals._sequenceIndexes[5]; + _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 17, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 10, 11); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[5], temp); + + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[3], false, 17, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 5, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 3); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 5); + break; + + case 5: + temp = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 3); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 3); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], temp); + + temp = _globals._sequenceIndexes[5]; + _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 12); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[5], temp); + _scene->_sequences.addTimer(20, 6); + break; + + case 6: + _scene->_sequences.setDone(_globals._sequenceIndexes[5]); + _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 17, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 13, 15); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); + + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[3], false, 17, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 2, 3); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 3); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 7); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 8); + break; + + case 7: + _scene->_sequences.setDone(_globals._sequenceIndexes[5]); + _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 16); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[5], -1); + break; + + case 8: + temp = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 3); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], temp); + _scene->_sequences.addTimer(20, 9); + break; + + case 9: + _scene->_sequences.setDone(_globals._sequenceIndexes[5]); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 3); + _scene->_sequences.addTimer(48, 10); + break; + + case 10: + _scene->_nextSceneId = 313; + break; + + default: + break; + } +} + +void Scene316::enter() { + int series; + + if (_globals[kSexOfRex] == REX_MALE) { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('g', -1)); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites("*RXCL_8"); + _globals._spriteIndexes[6] = _scene->_sprites.addSprites("*RXCL_2"); + } else { + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('g', 0)); + _globals._spriteIndexes[5] = _scene->_sprites.addSprites("*ROXCL_8"); + } + + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('v', 0)); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 12); + + if (_scene->_priorSceneId == 366) { + _game._player._stepEnabled = false; + _game._player._visible = false; + _game._player._playerPos = Common::Point(78, 87); + _game._player._facing = FACING_SOUTH; + _scene->_sequences.addTimer(48, 70); + } else if (_scene->_priorSceneId == 321) { + _game._player._playerPos = Common::Point(153, 102); + _game._player._facing = FACING_SOUTH; + _game._player._stepEnabled = false; + _game._player._visible = false; + _vm->_sound->command(44); + series = (_globals[kSexOfRex] == REX_MALE) ? 1 : 2; + _globals._sequenceIndexes[1] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[series], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 60); + } else if (_scene->_priorSceneId != -2) + _game._player._playerPos = Common::Point(291, 126); + + sceneEntrySound(); + _game.loadQuoteSet(0xFD, 0); +} + +void Scene316::step() { + int temp; + + if (_game._trigger == 60) { + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[1]); + _game._player._visible = true; + _game._player._stepEnabled = true; + } + + if (_game._trigger >= 70) { + switch (_game._trigger) { + case 70: + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 2, 6); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 3); + + _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[6], 1, 5); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[6]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 71); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_EXPIRE, 0, 72); + break; + + case 71: + temp = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 3); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], temp); + break; + + case 72: + temp = _globals._sequenceIndexes[6]; + _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[6], 6, 9); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[6]); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[6], temp); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_EXPIRE, 0, 73); + break; + + case 73: + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[3], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 5); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 12); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[6]); + + _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[6], 10, -2); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[6]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 74); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_EXPIRE, 0, 75); + break; + + case 74: + temp = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 12); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], temp); + break; + + case 75: + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[6]); + _game._player._stepEnabled = true; + _game._player._visible = true; + break; + + default: + break; + } + } +} + +void Scene316::preActions() { + if (_action.isAction(0x1AD, 0x2B9)) { + if (_globals[kAfterHavoc]) + _game._player._walkOffScreenSceneId = 354; + else + _game._player._walkOffScreenSceneId = 304; + } +} + +void Scene316::actions() { + if (_action.isAction(0x2F7, 0x11)) { + if (_globals[kSexOfRex] == REX_FEMALE) + handleRoxInGrate(); + else + handleRexInGrate(); + } else if (_action.isAction(0x227, 0x226) || _action.isAction(0x2B5, 0x22C)) { + switch (_game._trigger) { + case 0: + if (_globals[kCityFlooded]) { + _vm->_dialogs->show(0x7B87); + } else { + _vm->_sound->command(45); + _game._player._stepEnabled = false; + _game._player._visible = false; + if (_globals[kSexOfRex] == REX_MALE) { + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 7, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], -1, 7); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 1); + } else { + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 7, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 3); + } + } + break; + + case 1: + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 7, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 8, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 2); + _scene->_kernelMessages.reset(); + if (!_game._visitedScenes.exists(321)) + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(253)); + + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + + case 2: + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 7, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], -2, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 2); + _scene->_sequences.addTimer(48, 4); + break; + + case 3: + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 7, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], -2, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 2); + _scene->_sequences.addTimer(48, 4); + break; + + case 4: + _scene->_nextSceneId = 321; + break; + } + } else if (_action.isAction(VERB_LOOK, 0x22C)) + _vm->_dialogs->show(0x7B7A); + else if (_action.isAction(VERB_LOOK, 0x1B6)) { + if (_game._visitedScenes.exists(321)) + _vm->_dialogs->show(0x7B7C); + else + _vm->_dialogs->show(0x7B7B); + } else if (_action.isAction(VERB_LOOK, 0x2C6)) + _vm->_dialogs->show(0x7B7D); + else if (_action.isAction(VERB_LOOK, 0x2C7)) + _vm->_dialogs->show(0x7B7E); + else if (_action.isAction(VERB_LOOK, 0x1E0)) + _vm->_dialogs->show(0x7B7F); + else if (_action.isAction(VERB_LOOK, 0xE2)) + _vm->_dialogs->show(0x7B80); + else if (_action.isAction(VERB_LOOK, 0x226)) + _vm->_dialogs->show(0x7B81); + else if (_action.isAction(VERB_LOOK, 0x11)) + _vm->_dialogs->show(0x7B82); + else if (_action.isAction(VERB_LOOK, 0x2B9)) { + if (!_globals[kAfterHavoc]) { + if (_game._difficulty != DIFFICULTY_IMPOSSIBLE) + _vm->_dialogs->show(0x7B84); + else + _vm->_dialogs->show(0x7B83); + } + } else if (_action.isAction(VERB_LOOK, 0x89)) + _vm->_dialogs->show(0x7B85); + else if (_action.isAction(VERB_LOOK, 0x257)) + _vm->_dialogs->show(0x7B86); + else + return; + + _action._inProgress = false; +} + + /*------------------------------------------------------------------------*/ } // End of namespace Nebular diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h index f746b9f25e..9dd2e12421 100644 --- a/engines/mads/nebular/nebular_scenes3.h +++ b/engines/mads/nebular/nebular_scenes3.h @@ -231,6 +231,10 @@ public: }; class Scene316: public Scene3xx { +private: + void handleRexInGrate(); + void handleRoxInGrate(); + public: Scene316(MADSEngine *vm) : Scene3xx(vm) {} -- cgit v1.2.3 From 4559444c54a6e910f89532e899058448eb835b08 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 20 Apr 2014 17:18:06 -0400 Subject: MADS: Fix calculating Rails::_next --- engines/mads/rails.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/engines/mads/rails.cpp b/engines/mads/rails.cpp index 342238ec65..105a85366a 100644 --- a/engines/mads/rails.cpp +++ b/engines/mads/rails.cpp @@ -81,7 +81,7 @@ void Rails::setupRoute(bool bitFlag, const Common::Point &srcPos, const Common:: _next = 0; if (_routeIndexes.size() > 0) { Common::Point currPos = srcPos; - for (int routeCtr = size() - 1; (routeCtr >= 0) && (_next == 0); --routeCtr) { + for (int routeCtr = size() - 1; (routeCtr >= 0) && !_next; --routeCtr) { int idx = _routeIndexes[routeCtr]; const Common::Point &pt = _nodes[idx]._walkPos; @@ -124,7 +124,7 @@ void Rails::setupRouteNode(int *routeIndexP, int nodeIndex, int flags, int route int Rails::scanPath(const Common::Point &srcPos, const Common::Point &destPos) { // For compressed depth surfaces, always return 0 - if (_depthStyle != 2) + if (_depthStyle == 2) return 0; int yDiff = destPos.y - srcPos.y; @@ -135,7 +135,7 @@ int Rails::scanPath(const Common::Point &srcPos, const Common::Point &destPos) { yAmount = -yAmount; } - int xDiff = destPos.x - srcPos.y; + int xDiff = destPos.x - srcPos.x; int xDirection = 1; int xAmount = 0; if (xDiff < 0) { @@ -150,8 +150,8 @@ int Rails::scanPath(const Common::Point &srcPos, const Common::Point &destPos) { const byte *srcP = _depthSurface->getBasePtr(srcPos.x, srcPos.y); int index = xAmount; - // Outer horizontal movement loop - for (int yIndex = 0; yIndex < yDiff; ++yIndex) { + // Outer loop + for (int xCtr = 0; xCtr < xDiff; ++xCtr, srcP += xDirection) { index += yDiff; int v = (*srcP & 0x7F) >> 4; if (v) @@ -167,8 +167,6 @@ int Rails::scanPath(const Common::Point &srcPos, const Common::Point &destPos) { srcP += yAmount; } - - srcP += xDirection; } return 0; -- cgit v1.2.3 From 254519296e87e8a6b29305b91c045446b1421d19 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 20 Apr 2014 18:31:18 -0400 Subject: MADS: Beginnings of implementing conversation methods --- engines/mads/nebular/nebular_scenes1.cpp | 2 +- engines/mads/nebular/nebular_scenes2.cpp | 157 ++++++++----------------------- engines/mads/nebular/nebular_scenes2.h | 2 + engines/mads/user_interface.cpp | 20 +++- engines/mads/user_interface.h | 29 +++++- 5 files changed, 90 insertions(+), 120 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index c7ab075d4f..2440068698 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -2944,7 +2944,7 @@ void Scene112::enter() { _game._player._stepEnabled = false; _game._player._visible = false; - _scene->_userInterface.emptyTalkList(); + _scene->_userInterface.emptyConversationList(); _scene->_userInterface.setup(kInputConversation); _scene->loadAnimation(Resources::formatName(112, 'X', -1, EXT_AA, ""), 70); diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index a2d3c45460..22c7062446 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -3689,7 +3689,7 @@ void Scene210::setDialogNode(int node) { _shouldTalk = true; _game._player._stepEnabled = false; if (_twinklesTalking) { - _scene->_userInterface.emptyTalkList(); + _scene->_userInterface.emptyConversationList(); _scene->_userInterface.setup(kInputConversation); handleTwinklesSpeech(0xE4, -1, 0); _scene->_sequences.addTimer(180, 2); @@ -3805,6 +3805,8 @@ void Scene210::restoreDialogNode(int node, int msgId, int posY) { } void Scene210::enter() { + UserInterface &userInterface = _vm->_game->_scene._userInterface; + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('c', -1)); if (!_game._visitedScenes._sceneRevisited) @@ -3832,7 +3834,8 @@ void Scene210::enter() { 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0); - warning("TODO: sub71A50(&dialog1, 0x2E, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0);"); + + userInterface.initConversation(&_conv1, 0x2E, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0); if (!_game._visitedScenes._sceneRevisited) { warning("TODO: sub71B18(0x2E, 0xB4, 0xB5, 0xB6, 0xB8, 0);"); @@ -3841,12 +3844,13 @@ void Scene210::enter() { warning("TODO: \tsub71B9E(&dialog1, 0xB7, -1);"); } - warning("TODO: sub71A50(&dialog2, 0x2F, 0xBC, 0xBB, 0xBD, _game._visitedScenes._sceneRevisited ? 0, -1);"); - warning("TODO: sub71A50(&dialog3, 0x30, 0xC3, 0xC2, 0xC1, 0xC4, _game._visitedScenes._sceneRevisited ? 0, -1);"); - warning("TODO: sub71A50(&dialog5, 0x31, 0xCD, 0xCC, 0xCE, 0xCF, _game._visitedScenes._sceneRevisited ? 0, -1);"); - warning("TODO: sub71A50(&dialog6, 0x32, 0xD3, 0xD4, 0xD5, _game._visitedScenes._sceneRevisited ? 0, -1);"); - warning("TODO: sub71A50(&dialog7, 0x33, 0xD8, 0xDA, 0xD9, 0xDB, 0xDC, _game._visitedScenes._sceneRevisited ? 0, -1);"); - warning("TODO: sub71A50(&dialog8, 0x34, 0xDF, 0xE0, 0xE1, 0xE2, 0xE3, _game._visitedScenes._sceneRevisited ? 0, -1);"); + bool sceneRevisited = _game._visitedScenes._sceneRevisited; + userInterface.initConversation(&_conv2, 0x2F, 0xBC, 0xBB, 0xBD, (int)!sceneRevisited); + userInterface.initConversation(&_conv3, 0x30, 0xC3, 0xC2, 0xC1, 0xC4, (int)!sceneRevisited); + userInterface.initConversation(&_conv5, 0x31, 0xCD, 0xCC, 0xCE, 0xCF, (int)!sceneRevisited); + userInterface.initConversation(&_conv6, 0x32, 0xD3, 0xD4, 0xD5, (int)!sceneRevisited); + userInterface.initConversation(&_conv7, 0x33, 0xD8, 0xDA, 0xD9, 0xDB, 0xDC, (int)!sceneRevisited); + userInterface.initConversation(&_conv8, 0x34, 0xDF, 0xE0, 0xE1, 0xE2, 0xE3, (int)!sceneRevisited); _twinkleAnimationType = 0; _twinklesCurrentFrame = 0; @@ -4087,19 +4091,13 @@ void Scene210::preActions() { } void Scene210::actions() { + UserInterface &userInterface = _vm->_game->_scene._userInterface; + if (_action.isAction(VERB_LOOK, 0x27, 0x1C0)) { _vm->_dialogs->show(0x5219); - _action._inProgress = false; - return; - } - - if (_game._screenObjects._inputMode == 1) { + } else if (_game._screenObjects._inputMode == 1) { handleDialogs(); - _action._inProgress = false; - return; - } - - if (_action.isAction(VERB_TALKTO, 0x1DC) || + } else if (_action.isAction(VERB_TALKTO, 0x1DC) || ((_game._player._playerPos == Common::Point(214, 150)) && (_game._player._facing == FACING_NORTHWEST) && (_twinkleAnimationType == 1) && _stopWalking)) { switch (_game._trigger) { case 0: { @@ -4146,15 +4144,11 @@ void Scene210::actions() { if (_globals[kTwinklesApproached] < 2) _globals[kTwinklesApproached]++; - warning("TODO: talk_init(&dialog1);"); + userInterface.startConversation(&_conv1); _curDialogNode = 1; break; } - _action._inProgress = false; - return; - } - - if (_action.isAction(VERB_GIVE, 0x1DC) && _game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId))) { + } else if (_action.isAction(VERB_GIVE, 0x1DC) && _game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId))) { switch (_game._trigger) { case 0: { int quote = _vm->getRandomNumber(172, 174); @@ -4170,23 +4164,11 @@ void Scene210::actions() { _shouldMoveHead = false; break; } - _action._inProgress = false; - return; - } - - if (_action.isAction(0x1AD, 0x1BF) || _action.isAction(0x18C, 0x1C0)) { + } else if (_action.isAction(0x1AD, 0x1BF) || _action.isAction(0x18C, 0x1C0)) { _scene->_nextSceneId = 205; - _action._inProgress = false; - return; - } - - if (_action.isAction(0x18B, 0x70)) { + } else if (_action.isAction(0x18B, 0x70)) { _scene->_nextSceneId = 215; - _action._inProgress = false; - return; - } - - if ((_action.isAction(VERB_PULL, 0x5F) || _action.isAction(VERB_OPEN, 0x5F)) && !_globals[kCurtainOpen]) { + } else if ((_action.isAction(VERB_PULL, 0x5F) || _action.isAction(VERB_OPEN, 0x5F)) && !_globals[kCurtainOpen]) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -4204,11 +4186,7 @@ void Scene210::actions() { _scene->_dynamicHotspots.setCursor(_doorway, CURSOR_GO_UP); break; } - _action._inProgress = false; - return; - } - - if ((_action.isAction(VERB_PULL, 0x5F) || _action.isAction(VERB_CLOSE, 0x5F)) && _globals[kCurtainOpen]) { + } else if ((_action.isAction(VERB_PULL, 0x5F) || _action.isAction(VERB_CLOSE, 0x5F)) && _globals[kCurtainOpen]) { switch (_game._trigger) { case 0: _scene->_sequences.remove(_globals._sequenceIndexes[1]); @@ -4230,11 +4208,7 @@ void Scene210::actions() { _globals[kCurtainOpen] = false; break; } - _action._inProgress = false; - return; - } - - if (_action.isAction(VERB_LOOK, 0xAA)) { + } else if (_action.isAction(VERB_LOOK, 0xAA)) { if (_globals[kTwinklesStatus] == TWINKLES_GONE) { if (_game._storyMode == STORYMODE_NAUGHTY) _vm->_dialogs->show(0x520B); @@ -4243,87 +4217,38 @@ void Scene210::actions() { } else { _vm->_dialogs->show(0x5209); } - _action._inProgress = false; - return; - } - - if (_action.isAction(VERB_LOOK, 0x31)) { + } else if (_action.isAction(VERB_LOOK, 0x31)) { _vm->_dialogs->show(0x520C); - _action._inProgress = false; - return; - } - - if (_action.isAction(VERB_LOOK, 0xA7)) { + } else if (_action.isAction(VERB_LOOK, 0xA7)) { _vm->_dialogs->show(0x520D); - _action._inProgress = false; - return; - } - - if (_action.isAction(VERB_TAKE, 0xA7) || _action.isAction(VERB_TAKE, 0x31)) { + } else if (_action.isAction(VERB_TAKE, 0xA7) || _action.isAction(VERB_TAKE, 0x31)) { _vm->_dialogs->show(0x520E); - _action._inProgress = false; - return; - } - - if (_action.isAction(VERB_LOOK, 0x1C5)) { + } else if (_action.isAction(VERB_LOOK, 0x1C5)) { _vm->_dialogs->show(0x520F); - _action._inProgress = false; - return; - } - - if (_action.isAction(VERB_LOOK, 0x3A)) { + } else if (_action.isAction(VERB_LOOK, 0x3A)) { _vm->_dialogs->show(0x5210); - _action._inProgress = false; - return; - } - - if (_action.isAction(VERB_LOOK, 0x1B0)) { + } else if (_action.isAction(VERB_LOOK, 0x1B0)) { _vm->_dialogs->show(0x5211); - _action._inProgress = false; - return; - } - - if (_action.isAction(VERB_LOOK, 0x1DC)) { + } else if (_action.isAction(VERB_LOOK, 0x1DC)) { _vm->_dialogs->show(0x5212); - _action._inProgress = false; - return; - } - - if (_action.isAction(0x13A, 0x1DC) || _action.isAction(0xA6, 0x1DC)) { + } else if (_action.isAction(0x13A, 0x1DC) || _action.isAction(0xA6, 0x1DC)) { _vm->_dialogs->show(0x5213); - _action._inProgress = false; - return; - } - - if (_action.isAction(VERB_LOOK, 0x1BF)) { + } else if (_action.isAction(VERB_LOOK, 0x1BF)) { _vm->_dialogs->show(0x5214); - _action._inProgress = false; - return; - } - - if (_action.isAction(VERB_LOOK, 0x5F)) { + } else if (_action.isAction(VERB_LOOK, 0x5F)) { _vm->_dialogs->show(0x5215); - _action._inProgress = false; - return; - } - - if (_action.isAction(VERB_LOOK, 0x53)) { + } else if (_action.isAction(VERB_LOOK, 0x53)) { _vm->_dialogs->show(0x5216); - _action._inProgress = false; - return; - } - - if (_action.isAction(VERB_TAKE, 0x53)) { + } else if (_action.isAction(VERB_TAKE, 0x53)) { _vm->_dialogs->show(0x5217); - _action._inProgress = false; - return; - } - - if (_action.isAction(VERB_LOOK, 0x1C0)) { + } else if (_action.isAction(VERB_LOOK, 0x1C0)) { _vm->_dialogs->show(0x5218); - _action._inProgress = false; + } else { + // Not handled return; } + + _action._inProgress = false; } /*------------------------------------------------------------------------*/ @@ -4988,7 +4913,7 @@ void Scene216::enter() { _game._player._stepEnabled = false; _game._player._visible = false; - _scene->_userInterface.emptyTalkList(); + _scene->_userInterface.emptyConversationList(); _scene->_userInterface.setup(kInputConversation); _scene->loadAnimation(formAnimName('A', -1), 60); diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index 2537b113f8..f50789999b 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -214,6 +214,8 @@ private: bool _twinklesTalk2; int _doorway; Common::String _subQuote2; + Conversation _conv1, _conv2, _conv3; + Conversation _conv5, _conv6, _conv7, _conv8; void handleDialogs(); void handleSubDialog1(); diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 09b3c8d5cf..0a0b8968e9 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -672,8 +672,24 @@ void UserInterface::drawTalkList() { warning("TODO: drawTalkList"); } -void UserInterface::emptyTalkList() { - warning("TODO: emptyTalkList"); +void UserInterface::initConversation(Conversation *conversatin, int globalId, int quoteId, ...) { + +} + +void UserInterface::setConversation(Conversation *conversation, int quoteId, ...) { + +} + +void UserInterface::writeConversation(Conversation *conversation, int quoteId, int flag) { + +} + +void UserInterface::emptyConversationList() { + _talkStrings.clear(); +} + +void UserInterface::startConversation(Conversation *conversation) { + } void UserInterface::loadInventoryAnim(int objectId) { diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h index 52512ef6ca..a6cc9e3650 100644 --- a/engines/mads/user_interface.h +++ b/engines/mads/user_interface.h @@ -93,6 +93,10 @@ public: void draw(bool updateFlag, bool delFlag); }; +class Conversation { +public: + +}; class UserInterface : public MSurface { friend class UISlots; @@ -238,7 +242,30 @@ public: */ void updateInventoryScroller(); - void emptyTalkList(); + /** + * Set up a conversation sequence + */ + void initConversation(Conversation *conversatin, int globalId, int quoteId, ...); + + /** + * Activates the passed set of quotes in the given conversation node + */ + void setConversation(Conversation *conversation, int quoteId, ...); + + /** + * Activates or deactivates the specified quote in the given conversation node + */ + void writeConversation(Conversation *conversation, int quoteId, int flag); + + /** + * Start an interactive conversation + */ + void startConversation(Conversation *conversation); + + /** + * Empties the current conversation talk list + */ + void emptyConversationList(); }; } // End of namespace MADS -- cgit v1.2.3 From f0ce06f0e9e0ebcf21368fdf01856a026dd4d2fb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 20 Apr 2014 21:32:29 -0400 Subject: MADS: Implemented display of conversation topics --- engines/mads/action.cpp | 3 +- engines/mads/game.h | 2 +- engines/mads/mads.cpp | 1 + engines/mads/nebular/nebular_scenes2.cpp | 22 +++--- engines/mads/screen.cpp | 7 +- engines/mads/user_interface.cpp | 122 ++++++++++++++++++++++++++----- engines/mads/user_interface.h | 51 ++++++++----- 7 files changed, 151 insertions(+), 57 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index 2da3c5201e..9d496d5ebf 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -97,7 +97,8 @@ void MADSAction::set() { if (_commandSource == CAT_TALK_ENTRY) { // Handle showing the conversation selection. Rex at least doesn't actually seem to use this if (_selectedRow >= 0) { - Common::String desc = userInterface._talkStrings[userInterface._talkIds[_selectedRow]]; + _action._verbId = userInterface._talkIds[_selectedRow]; + Common::String desc = userInterface._talkStrings[_selectedRow]; if (!desc.empty()) _statusText = desc; } diff --git a/engines/mads/game.h b/engines/mads/game.h index 2c87d70d9d..44aa0dbee5 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -77,7 +77,6 @@ protected: bool _quoteEmergency; bool _vocabEmergency; bool _anyEmergency; - int _widepipeCtr; /** * Constructor @@ -136,6 +135,7 @@ public: uint32 _priorFrameTimer; Common::String _aaName; int _winStatus; + int _widepipeCtr; public: virtual ~Game(); diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index 229d3fcef8..c40d4bfa1b 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -78,6 +78,7 @@ void MADSEngine::initialise() { MSprite::setVm(this); Resources::init(this); + Conversation::init(this); _debugger = new Debugger(this); _dialogs = Dialogs::init(this); _events = new EventsManager(this); diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 22c7062446..37e7aaab20 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -3835,22 +3835,22 @@ void Scene210::enter() { 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0); - userInterface.initConversation(&_conv1, 0x2E, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0); + _conv1.setup(0x2E, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0); if (!_game._visitedScenes._sceneRevisited) { - warning("TODO: sub71B18(0x2E, 0xB4, 0xB5, 0xB6, 0xB8, 0);"); + _conv1.set(0x2E, 0xB4, 0xB5, 0xB6, 0xB8, 0); - warning("TODO: if (Debugger_widepipe_ctr >= 2)"); - warning("TODO: \tsub71B9E(&dialog1, 0xB7, -1);"); + if (_game._widepipeCtr >= 2) + _conv1.write(0xB7, -1); } bool sceneRevisited = _game._visitedScenes._sceneRevisited; - userInterface.initConversation(&_conv2, 0x2F, 0xBC, 0xBB, 0xBD, (int)!sceneRevisited); - userInterface.initConversation(&_conv3, 0x30, 0xC3, 0xC2, 0xC1, 0xC4, (int)!sceneRevisited); - userInterface.initConversation(&_conv5, 0x31, 0xCD, 0xCC, 0xCE, 0xCF, (int)!sceneRevisited); - userInterface.initConversation(&_conv6, 0x32, 0xD3, 0xD4, 0xD5, (int)!sceneRevisited); - userInterface.initConversation(&_conv7, 0x33, 0xD8, 0xDA, 0xD9, 0xDB, 0xDC, (int)!sceneRevisited); - userInterface.initConversation(&_conv8, 0x34, 0xDF, 0xE0, 0xE1, 0xE2, 0xE3, (int)!sceneRevisited); + _conv2.setup(0x2F, 0xBC, 0xBB, 0xBD, (int)!sceneRevisited); + _conv3.setup(0x30, 0xC3, 0xC2, 0xC1, 0xC4, (int)!sceneRevisited); + _conv5.setup(0x31, 0xCD, 0xCC, 0xCE, 0xCF, (int)!sceneRevisited); + _conv6.setup(0x32, 0xD3, 0xD4, 0xD5, (int)!sceneRevisited); + _conv7.setup(0x33, 0xD8, 0xDA, 0xD9, 0xDB, 0xDC, (int)!sceneRevisited); + _conv8.setup(0x34, 0xDF, 0xE0, 0xE1, 0xE2, 0xE3, (int)!sceneRevisited); _twinkleAnimationType = 0; _twinklesCurrentFrame = 0; @@ -4144,7 +4144,7 @@ void Scene210::actions() { if (_globals[kTwinklesApproached] < 2) _globals[kTwinklesApproached]++; - userInterface.startConversation(&_conv1); + _conv1.start(); _curDialogNode = 1; break; } diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index 9dec5a8b1b..cb914e4f86 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -436,12 +436,7 @@ void ScreenObjects::elementHighlighted() { break; case CAT_TALK_ENTRY: - index = 0; - for (int idx = 0; idx < 5; ++idx) { - if (!userInterface._talkStrings[idx].empty()) - ++index; - } - + index = userInterface._talkStrings.size(); indexEnd = index - 1; varA = 0; topIndex = 0; diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 0a0b8968e9..48e62a5ae5 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -24,6 +24,7 @@ #include "mads/mads.h" #include "mads/compression.h" #include "mads/user_interface.h" +#include "mads/nebular/game_nebular.h" namespace MADS { @@ -71,7 +72,6 @@ void UISlots::add(const AnimFrameEntry &frameEntry) { push_back(ie); } - void UISlots::draw(bool updateFlag, bool delFlag) { Scene &scene = _vm->_game->_scene; UserInterface &userInterface = scene._userInterface; @@ -207,6 +207,95 @@ void UISlots::draw(bool updateFlag, bool delFlag) { /*------------------------------------------------------------------------*/ +MADSEngine *Conversation::_vm; + +void Conversation::init(MADSEngine *vm) { + _vm = vm; +} + +void Conversation::setup(int globalId, ...) { + va_list va; + va_start(va, globalId); + + // Load the list of conversation quotes + _quotes.clear(); + int quoteId = va_arg(va, int); + while (quoteId > 0) { + _quotes.push_back(quoteId); + quoteId = va_arg(va, int); + } + va_end(va); + + assert(_vm->getGameID() == GType_RexNebular); + Nebular::GameNebular *game = (Nebular::GameNebular *)_vm->_game; + game->_globals[globalId] = -1; + + _globalId = globalId; +} + +void Conversation::set(int quoteId, ...) { + assert(_vm->getGameID() == GType_RexNebular); + Nebular::GameNebular *game = (Nebular::GameNebular *)_vm->_game; + game->_globals[_globalId] = 0; + + va_list va; + va_start(va, quoteId); + + // Loop through handling each quote + while (quoteId > 0) { + for (uint idx = 0; idx < _quotes.size(); ++idx) { + if (_quotes[idx] == quoteId) { + // Found index, so set that bit in the global keeping track of conversation state + game->_globals[_globalId] |= 1 << idx; + break; + } + } + + quoteId = va_arg(va, int); + } + va_end(va); +} + +void Conversation::write(int quoteId, bool flag) { + assert(_vm->getGameID() == GType_RexNebular); + Nebular::GameNebular *game = (Nebular::GameNebular *)_vm->_game; + + for (uint idx = 0; idx < _quotes.size(); ++idx) { + if (_quotes[idx] == quoteId) { + // Found index, so set or clear the flag + if (flag) { + // Set bit + game->_globals[_globalId] |= 1 << idx; + } else { + // Clear bit + game->_globals[_globalId] &= ~(1 << idx); + } + return; + } + } +} + +void Conversation::start() { + assert(_vm->getGameID() == GType_RexNebular); + Nebular::GameNebular *game = (Nebular::GameNebular *)_vm->_game; + UserInterface &userInterface = game->_scene._userInterface; + userInterface.emptyConversationList(); + + // Loop through each of the quotes loaded into the conversation + for (uint idx = 0; idx < _quotes.size(); ++idx) { + // Check whether the given quote is enabled or not + if (game->_globals[_globalId] & (1 << idx)) { + // Quote enabled, so add it to the list of talk selections + Common::String msg = game->getQuote(_quotes[idx]); + userInterface.addConversationMessage(_quotes[idx], msg); + } + } + + userInterface.setup(kInputConversation); +} + +/*------------------------------------------------------------------------*/ + UserInterface::UserInterface(MADSEngine *vm) : _vm(vm), _dirtyAreas(vm), _uiSlots(vm) { _invSpritesIndex = -1; @@ -305,7 +394,7 @@ void UserInterface::setup(InputMode inputMode) { void UserInterface::drawTextElements() { if (_vm->_game->_screenObjects._inputMode) { - drawTalkList(); + drawConversationList(); } else { // Draw the actions drawActions(); @@ -466,7 +555,10 @@ void UserInterface::writeVocab(ScrCategory category, int id) { break; case CAT_TALK_ENTRY: - error("TODO: CAT_TALK_ENTRY"); + font = _vm->_font->getFont(FONT_INTERFACE); + font->setColorMode(id == _highlightedCommandIndex ? SELMODE_HIGHLIGHTED : SELMODE_UNSELECTED); + font->writeString(this, _talkStrings[id], Common::Point(bounds.left, bounds.top)); + break; case CAT_INV_SCROLLER: font = _vm->_font->getFont(FONT_MISC); @@ -668,28 +760,22 @@ void UserInterface::moveRect(Common::Rect &bounds) { bounds.translate(0, MADS_SCENE_HEIGHT); } -void UserInterface::drawTalkList() { - warning("TODO: drawTalkList"); -} - -void UserInterface::initConversation(Conversation *conversatin, int globalId, int quoteId, ...) { - -} - -void UserInterface::setConversation(Conversation *conversation, int quoteId, ...) { - -} - -void UserInterface::writeConversation(Conversation *conversation, int quoteId, int flag) { - +void UserInterface::drawConversationList() { + for (uint idx = 0; idx < _talkStrings.size(); ++idx) { + writeVocab(CAT_TALK_ENTRY, idx); + } } void UserInterface::emptyConversationList() { _talkStrings.clear(); + _talkIds.clear(); } -void UserInterface::startConversation(Conversation *conversation) { +void UserInterface::addConversationMessage(int vocabId, const Common::String &msg) { + assert(_talkStrings.size() < 5); + _talkStrings.push_back(msg); + _talkIds.push_back(vocabId); } void UserInterface::loadInventoryAnim(int objectId) { diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h index a6cc9e3650..7541bb8661 100644 --- a/engines/mads/user_interface.h +++ b/engines/mads/user_interface.h @@ -42,6 +42,7 @@ enum ScrollbarActive { }; class AnimFrameEntry; +class MADSEngine; class UISlot { public: @@ -94,8 +95,33 @@ public: }; class Conversation { +private: + static MADSEngine *_vm; +public: + static void init(MADSEngine *vm); public: + int _globalId; + Common::Array _quotes; + /** + * Set up a conversation sequence + */ + void setup(int globalId, ...); + + /** + * Activates the passed set of quotes in the given conversation node + */ + void set(int quoteId, ...); + + /** + * Activates or deactivates the specified quote in the given conversation node + */ + void write(int quoteId, bool flag); + + /** + * Starts the conversation + */ + void start(); }; class UserInterface : public MSurface { @@ -128,7 +154,7 @@ private: /** * Draw options during a conversation. */ - void drawTalkList(); + void drawConversationList(); /** * Draw the action list @@ -243,29 +269,14 @@ public: void updateInventoryScroller(); /** - * Set up a conversation sequence - */ - void initConversation(Conversation *conversatin, int globalId, int quoteId, ...); - - /** - * Activates the passed set of quotes in the given conversation node - */ - void setConversation(Conversation *conversation, int quoteId, ...); - - /** - * Activates or deactivates the specified quote in the given conversation node - */ - void writeConversation(Conversation *conversation, int quoteId, int flag); - - /** - * Start an interactive conversation + * Empties the current conversation talk list */ - void startConversation(Conversation *conversation); + void emptyConversationList(); /** - * Empties the current conversation talk list + * Add a msesage to the list of conversation items to select from */ - void emptyConversationList(); + void addConversationMessage(int vocabId, const Common::String &msg); }; } // End of namespace MADS -- cgit v1.2.3 From ed4cedd81675f2ce57356dee90549ef52fb761b3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 20 Apr 2014 23:07:21 -0400 Subject: MADS: Fixes for scene 210 conversation --- engines/mads/nebular/nebular_scenes2.cpp | 85 ++++++++++++++++---------------- engines/mads/nebular/nebular_scenes2.h | 18 +++---- engines/mads/user_interface.cpp | 10 ++-- 3 files changed, 58 insertions(+), 55 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 37e7aaab20..5054fbef0d 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -3287,7 +3287,7 @@ void Scene210::setup() { _scene->addActiveVocab(0x18B); } -void Scene210::handleDialogs() { +void Scene210::handleConversations() { if (_game._trigger == 0) { _scene->_kernelMessages.reset(); _game._player._stepEnabled = false; @@ -3298,7 +3298,7 @@ void Scene210::handleDialogs() { _scene->_kernelMessages.add(Common::Point(0, -14), 0x1110, 34, 0, 240, subQuote1); _scene->_sequences.addTimer(60, 50); } else { - _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 1, 12, curQuote); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 1, 120, curQuote); } } else if (_game._trigger == 50) { _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 240, _subQuote2); @@ -3309,37 +3309,37 @@ void Scene210::handleDialogs() { switch (_curDialogNode) { case 1: - handleSubDialog1(); + handleConversation1(); break; case 2: - handleSubDialog2(); + handleConversation2(); break; case 3: - handleSubDialog3(); + handleConversation3(); break; case 5: - handleSubDialog5(); + handleConversation5(); break; case 6: - handleSubDialog6(); + handleConversation6(); break; case 7: - handleSubDialog7(); + handleConversation7(); break; case 8: - handleSubDialog8(); + handleConversation8(); break; } } } -void Scene210::handleSubDialog1() { +void Scene210::handleConversation1() { switch (_action._activeAction._verbId) { case 180: setDialogNode(2); @@ -3363,7 +3363,7 @@ void Scene210::handleSubDialog1() { } } -void Scene210::handleSubDialog2() { +void Scene210::handleConversation2() { switch (_action._activeAction._verbId) { case 187: setDialogNode(3); @@ -3379,7 +3379,7 @@ void Scene210::handleSubDialog2() { } } -void Scene210::handleSubDialog3() { +void Scene210::handleConversation3() { switch (_action._activeAction._verbId) { case 193: setDialogNode(6); @@ -3399,7 +3399,7 @@ void Scene210::handleSubDialog3() { } } -void Scene210::handleSubDialog5() { +void Scene210::handleConversation5() { switch (_action._activeAction._verbId) { case 204: setDialogNode(6); @@ -3416,7 +3416,7 @@ void Scene210::handleSubDialog5() { } } -void Scene210::handleSubDialog6() { +void Scene210::handleConversation6() { switch (_action._activeAction._verbId) { case 211: setDialogNode(7); @@ -3432,7 +3432,7 @@ void Scene210::handleSubDialog6() { } } -void Scene210::handleSubDialog7() { +void Scene210::handleConversation7() { switch (_action._activeAction._verbId) { case 216: case 217: @@ -3450,7 +3450,7 @@ void Scene210::handleSubDialog7() { } } -void Scene210::handleSubDialog8() { +void Scene210::handleConversation8() { switch (_action._activeAction._verbId) { case 223: case 224: @@ -3502,7 +3502,7 @@ void Scene210::setDialogNode(int node) { _nextHandsPlace = 0; _shouldTalk = false; _game._player._stepEnabled = true; - initNode(2); + newNode(2); break; } break; @@ -3533,7 +3533,7 @@ void Scene210::setDialogNode(int node) { default: _shouldTalk = false; _game._player._stepEnabled = true; - initNode(3); + newNode(3); break; } break; @@ -3588,7 +3588,7 @@ void Scene210::setDialogNode(int node) { _nextHandsPlace = 2; _shouldTalk = false; _game._player._stepEnabled = true; - initNode(5); + newNode(5); break; } break; @@ -3622,7 +3622,7 @@ void Scene210::setDialogNode(int node) { _nextHandsPlace = 0; _shouldTalk = false; _game._player._stepEnabled = true; - initNode(6); + newNode(6); break; } break; @@ -3649,7 +3649,7 @@ void Scene210::setDialogNode(int node) { default: _shouldTalk = false; _game._player._stepEnabled = true; - initNode(7); + newNode(7); break; } break; @@ -3676,7 +3676,7 @@ void Scene210::setDialogNode(int node) { default: _shouldTalk = false; _game._player._stepEnabled = true; - initNode(8); + newNode(8); break; } break; @@ -3758,36 +3758,39 @@ void Scene210::handleTwinklesSpeech(int quoteId, int shiftX, uint32 delay) { _scene->_kernelMessages.add(Common::Point(10, 70 + (shiftX * 14)), 0xFDFC, 0, 0, (delay == 0) ? 9999999 : delay, _game.getQuote(quoteId)); } -void Scene210::initNode(int node) { +void Scene210::newNode(int node) { _curDialogNode = node; switch (_curDialogNode) { case 1: - warning("TODO: talk_init(&dialog1);"); + _conv1.start(); break; case 2: - warning("TODO: talk_init(&dialog2);"); + _conv2.start(); break; case 3: - warning("TODO: talk_init(&dialog3);"); + _conv3.start(); break; case 5: - warning("TODO: talk_init(&dialog5);"); + _conv5.start(); break; case 6: - warning("TODO: talk_init(&dialog6);"); + _conv6.start(); break; case 7: - warning("TODO: talk_init(&dialog7);"); + _conv7.start(); break; case 8: - warning("TODO: talk_init(&dialog8);"); + _conv8.start(); + break; + + default: break; } } @@ -3801,12 +3804,10 @@ void Scene210::restoreDialogNode(int node, int msgId, int posY) { curQuoteId++; } - initNode(node); + newNode(node); } void Scene210::enter() { - UserInterface &userInterface = _vm->_game->_scene._userInterface; - _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('c', -1)); if (!_game._visitedScenes._sceneRevisited) @@ -3841,16 +3842,16 @@ void Scene210::enter() { _conv1.set(0x2E, 0xB4, 0xB5, 0xB6, 0xB8, 0); if (_game._widepipeCtr >= 2) - _conv1.write(0xB7, -1); + _conv1.write(0xB7, true); } bool sceneRevisited = _game._visitedScenes._sceneRevisited; - _conv2.setup(0x2F, 0xBC, 0xBB, 0xBD, (int)!sceneRevisited); - _conv3.setup(0x30, 0xC3, 0xC2, 0xC1, 0xC4, (int)!sceneRevisited); - _conv5.setup(0x31, 0xCD, 0xCC, 0xCE, 0xCF, (int)!sceneRevisited); - _conv6.setup(0x32, 0xD3, 0xD4, 0xD5, (int)!sceneRevisited); - _conv7.setup(0x33, 0xD8, 0xDA, 0xD9, 0xDB, 0xDC, (int)!sceneRevisited); - _conv8.setup(0x34, 0xDF, 0xE0, 0xE1, 0xE2, 0xE3, (int)!sceneRevisited); + _conv2.setup(0x2F, 0xBC, 0xBB, 0xBD, sceneRevisited ? 0 : -1); + _conv3.setup(0x30, 0xC3, 0xC2, 0xC1, 0xC4, sceneRevisited ? 0 : -1); + _conv5.setup(0x31, 0xCD, 0xCC, 0xCE, 0xCF, sceneRevisited ? 0 : -1); + _conv6.setup(0x32, 0xD3, 0xD4, 0xD5, sceneRevisited ? 0 : -1); + _conv7.setup(0x33, 0xD8, 0xDA, 0xD9, 0xDB, 0xDC, sceneRevisited ? 0 : -1); + _conv8.setup(0x34, 0xDF, 0xE0, 0xE1, 0xE2, 0xE3, sceneRevisited ? 0 : -1); _twinkleAnimationType = 0; _twinklesCurrentFrame = 0; @@ -4091,12 +4092,10 @@ void Scene210::preActions() { } void Scene210::actions() { - UserInterface &userInterface = _vm->_game->_scene._userInterface; - if (_action.isAction(VERB_LOOK, 0x27, 0x1C0)) { _vm->_dialogs->show(0x5219); } else if (_game._screenObjects._inputMode == 1) { - handleDialogs(); + handleConversations(); } else if (_action.isAction(VERB_TALKTO, 0x1DC) || ((_game._player._playerPos == Common::Point(214, 150)) && (_game._player._facing == FACING_NORTHWEST) && (_twinkleAnimationType == 1) && _stopWalking)) { switch (_game._trigger) { diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index f50789999b..ad87681aac 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -217,17 +217,17 @@ private: Conversation _conv1, _conv2, _conv3; Conversation _conv5, _conv6, _conv7, _conv8; - void handleDialogs(); - void handleSubDialog1(); - void handleSubDialog2(); - void handleSubDialog3(); - void handleSubDialog5(); - void handleSubDialog6(); - void handleSubDialog7(); - void handleSubDialog8(); + void handleConversations(); + void handleConversation1(); + void handleConversation2(); + void handleConversation3(); + void handleConversation5(); + void handleConversation6(); + void handleConversation7(); + void handleConversation8(); void setDialogNode(int node); void handleTwinklesSpeech(int quoteId, int shiftX, uint32 delay); - void initNode(int node); + void newNode(int node); void restoreDialogNode(int node, int msgId, int posY); public: Scene210(MADSEngine *vm) : Scene2xx(vm), _curDialogNode(-1), _nextHandsPlace(0), _twinkleAnimationType(0), _twinklesCurrentFrame(0), diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 48e62a5ae5..a5e8a844f9 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -226,9 +226,13 @@ void Conversation::setup(int globalId, ...) { } va_end(va); - assert(_vm->getGameID() == GType_RexNebular); - Nebular::GameNebular *game = (Nebular::GameNebular *)_vm->_game; - game->_globals[globalId] = -1; + if (quoteId < 0) { + // For an ending value of -1, also initial the bitflags for the global + // associated with the conversation entry, which enables all the quote Ids + assert(_vm->getGameID() == GType_RexNebular); + Nebular::GameNebular *game = (Nebular::GameNebular *)_vm->_game; + game->_globals[globalId] = (int16)0xffff; + } _globalId = globalId; } -- cgit v1.2.3 From 034773fda7cab67cd5d5e4446daa1402c4f6054d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 21 Apr 2014 20:00:32 +0200 Subject: MADS: Implement scene 318, some renaming --- engines/mads/nebular/nebular_scenes.cpp | 2 + engines/mads/nebular/nebular_scenes3.cpp | 590 ++++++++++++++++++++++++++++++- engines/mads/nebular/nebular_scenes3.h | 39 +- engines/mads/sequence.cpp | 6 +- engines/mads/sequence.h | 2 +- 5 files changed, 632 insertions(+), 7 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 8c75cbdd7b..77146a0773 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -125,6 +125,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene313(vm); case 316: return new Scene316(vm); + case 318: + return new Scene318(vm); // Scene group #8 case 804: diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index e1d1180dc4..e828c2857e 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -485,7 +485,7 @@ void Scene307::handlePrisonerEncounter() { } } -void Scene307::handlePrisonerSpeech(int firstQuoteId, int number, long time) { +void Scene307::handlePrisonerSpeech(int firstQuoteId, int number, long timeout) { int height = number * 14; int posY; @@ -500,7 +500,7 @@ void Scene307::handlePrisonerSpeech(int firstQuoteId, int number, long time) { int quoteId = firstQuoteId; for (int count = 0; count < number; count++) { _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; - _scene->_kernelMessages.add(Common::Point(5, posY), 0xFDFC, 0, 81, time, _game.getQuote(quoteId)); + _scene->_kernelMessages.add(Common::Point(5, posY), 0xFDFC, 0, 81, timeout, _game.getQuote(quoteId)); posY += 14; quoteId++; } @@ -2282,6 +2282,592 @@ void Scene316::actions() { } +/*------------------------------------------------------------------------*/ + +void Scene318::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene318::handleDialog() { + int temp; + + if (!_game._trigger) { + _game._player._stepEnabled = false; + handleRexDialogs(_action._activeAction._verbId); + } else if (_game._trigger == 2) { + temp = _globals._sequenceIndexes[2]; + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(142, 121)); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], temp); + _vm->_sound->command(3); + _scene->_userInterface.setup(kInputLimitedSentences); + _game._player._stepEnabled = true; + } else { + if (_action._activeAction._verbId < 0x19C) + warning("TODO: sub71B9E(&dialog1, _action._activeAction._verbId, false);"); + + switch (_action._activeAction._verbId) { + case 0x191: + handleInternDialog(0x19E, 2, 9999999); + warning("TODO: sub71B9E(&dialog1, 0x192, true);"); + break; + + case 0x192: + handleInternDialog(0x1A0, 5, 9999999); + warning("TODO: sub71B9E(&dialog1, 0x193, true);"); + break; + + case 0x193: + handleInternDialog(0x1A5, 4, 9999999); + warning("TODO: sub71B9E(&dialog1, 0x194, true);"); + break; + + case 0x194: + handleInternDialog(0x1A9, 6, 9999999); + warning("TODO: sub71B9E(&dialog1, 0x195, true);"); + warning("TODO: sub71B9E(&dialog1, 0x196, true);"); + warning("TODO: sub71B9E(&dialog1, 0x19D, false);"); + break; + + case 0x195: + handleInternDialog(0x1AF, 7, 9999999); + warning("TODO: if (!sub71C16(&_dialog1, 0x196))"); + warning("TODO: \tsub71B9E(&dialog1, 0x197, true);"); + break; + + case 0x196: + handleInternDialog(0x1B6, 5, 9999999); + warning("TODO: if (!sub71C16(&_dialog1, 0x195))"); + warning("TODO: \tsub71B9E(&dialog1, 0x197, true);"); + break; + + case 0x197: + handleInternDialog(0x1BB, 5, 9999999); + break; + + case 0x198: + handleInternDialog(0x1C0, 5, 9999999); + warning("TODO: sub71B9E(&dialog1, 0x19A, true);"); + break; + + case 0x199: + handleInternDialog(0x1C5, 3, 9999999); + break; + + case 0x19A: + handleInternDialog(0x1C8, 5, 9999999); + warning("TODO: sub71B9E(&dialog1, 0x19B, true);"); + break; + + case 0x19B: + handleInternDialog(0x1CD, 3, 9999999); + break; + + case 0x19C: + case 0x19D: + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(142, 121)); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 6, 8); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + + _dialogFl = false; + handleInternDialog(0x1D0, 1, 120); + warning("TODO: if ((sub71C16(&_dialog1, 0) == 1) || (_action._activeAction._verbId == 0x19D)) {"); + _explosionFl = true; + _internCounter = 3420; + // } + break; + } + + if (_action._activeAction._verbId < 0x19C) { + warning("TODO: talk_init(&dialog1);"); + _game._player._stepEnabled = true; + } + + } +} + +void Scene318::handleRexDialogs(int quote) { + _scene->_kernelMessages.reset(); + + Common::String curQuote = _game.getQuote(quote); + if (_vm->_font->getWidth(curQuote, _scene->_textSpacing) > 200) { + Common::String subQuote1; + _game.splitQuote(curQuote, subQuote1, _subQuote2); + _scene->_kernelMessages.add(Common::Point(138, 59), 0x1110, 32, 0, 240, subQuote1); + _scene->_kernelMessages.add(Common::Point(138, 73), 0x1110, 32, 1, 180, _subQuote2); + } else + _scene->_kernelMessages.add(Common::Point(138, 73), 0x1110, 32, 1, 120, curQuote); +} + +void Scene318::handleInternDialog(int quoteId, int quoteNum, uint32 timeout) { + int height = quoteNum * 14; + int posY; + if (height < 85) + posY = 87 - height; + else + posY = 2; + + int curQuoteId= quoteId; + + int maxWidth = 0; + for (int i = 0; i < quoteNum; i++) { + maxWidth = MAX(maxWidth, _vm->_font->getWidth(_game.getQuote(curQuoteId), -1)); + curQuoteId++; + } + + int posX = MIN(319 - maxWidth, 178 - (maxWidth >> 1)); + curQuoteId = quoteId; + + _scene->_kernelMessages.reset(); + _internTalkingFl = true; + + for (int i = 0; i < quoteNum; i++) { + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addTimer(180, 63); + _scene->_kernelMessages.add(Common::Point(posX, posY), 0xFDFC, 0, 0, timeout, _game.getQuote(curQuoteId)); + posY += 14; + curQuoteId++; + } +} + +void Scene318::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 0)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('k', -1)); + + if (_globals[kAfterHavoc]) { + _scene->loadAnimation(formAnimName('f', -1)); + _scene->_activeAnimation->_resetFlag = true; + } else if (!_globals[kHasSeenProfPyro]) { + _scene->_hotspots.activate(0x3A2, false); + _scene->_hotspots.activate(0x3A1, false); + _scene->_hotspots.activate(0x165, false); + } + + if (_game._objects.isInRoom(OBJ_SCALPEL)) { + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 6, 0, 0, 120); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 4); + _scene->_dynamicHotspots.add(0x12C, VERB_TAKE, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); + } + + if (_scene->_priorSceneId == 357) + _game._player._playerPos = Common::Point(15, 110); + else if (_scene->_priorSceneId != -2) + _game._player._playerPos = Common::Point(214, 152); + + warning("TODO: sub71A50(&dialog1, 0x47, 0x191, 0x192, 0x193, 0x194, 0x195, 0x196, 0x197, 0x198, 0x199, 0x19A, 0x19B, 0x19C, 0x19D, 0);"); + + if (!_game._visitedScenes._sceneRevisited) { + warning("TODO: sub71B18(&dialog1, 0x191, 0x198, 0x199, 0x19C, 0);"); + warning("TODO: if (Debugger_widepipe_ctr >= 2)"); + warning("TODO: \tsub71B9E(&dialog1, 0x19D, -1);"); + } + + if (_scene->_priorSceneId == 307) { + _game._player._visible = false; + _game._player._stepEnabled = false; + _scene->loadAnimation(formAnimName('a', -1), 60); + _animMode = 1; + } + + _lastFrame = 0; + _scene->_hotspots.activate(0x307, false); + + if (_scene->_priorSceneId != -2) { + _dialogFl = false; + _internWalkingFl = false; + _counter= 0; + _internCounter= 0; + _internVisibleFl = true; + _explosionFl = false; + } + + _game.loadQuoteSet(0x18C, 0x18D, 0x18E, 0x18F, 0x191, 0x192, 0x193, 0x194, 0x195, 0x196, + 0x197, 0x198, 0x199, 0x19A, 0x19B, 0x19C, 0x19E, 0x19E, 0x1A0, 0x1A1, 0x1A2, 0x1A3, + 0x1A4, 0x1A5, 0x1A6, 0x1A7, 0x1A8, 0x1A9, 0x1AA, 0x1AB, 0x1AC, 0x1AD, 0x1AE, 0x1AF, + 0x1B0, 0x1B1, 0x1B2, 0x1B3, 0x1B4, 0x1B5, 0x1B6, 0x1B7, 0x1B8, 0x1B9, 0x1BA, 0x1BB, + 0x1BC, 0x1BD, 0x1BE, 0x1BF, 0x1C0, 0x1C1, 0x1C2, 0x1C3, 0x1C4, 0x1C5, 0x1C6, 0x1C7, + 0x1C8, 0x1C9, 0x1CA, 0x1CB, 0x1CC, 0x1CD, 0x1CE, 0x1CF, 0x1D0, 0x1D1, 0x1D2, 0x1D3, + 0x190, 0x19D, 0); + + if ((_scene->_priorSceneId== -2) || (((_scene->_priorSceneId == 318) || (_scene->_priorSceneId == -1)) && (!_globals[kAfterHavoc]))) { + if (!_globals[kAfterHavoc]) { + _game._player._visible = false; + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('g', -1)); + _animMode = 2; + + if (_game._visitedScenes.exists(319) || !_internVisibleFl) { + _internVisibleFl = false; + _dialogFl = false; + } else { + _scene->loadAnimation(formAnimName('b', -1), 61); + _scene->_hotspots.activate(0x307, true); + } + + if (_dialogFl) { + warning("TODO: talk_init(&dialog1);"); + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 8); + } else + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 1); + + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(142, 121)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); + } + } + + if (_scene->_priorSceneId == 319) { + _game._player._stepEnabled = false; + _game._player._visible = false; + _animMode = 4; + if (!_globals[kHasSeenProfPyro]) { + _scene->loadAnimation(formAnimName('d', -1), 64); + _globals[kHasSeenProfPyro] = true; + } else { + _scene->loadAnimation(formAnimName('e', -1), 64); + } + } + + _internTalkingFl = false; + _vm->_palette->setEntry(252, 63, 63, 10); + _vm->_palette->setEntry(253, 45, 45, 05); + + _dropTimer = _globals._frameTime; + sceneEntrySound(); + + if (_dialogFl) + _vm->_sound->command(15); +} + +void Scene318::step() { + if ((_scene->_activeAnimation != nullptr) && (_animMode == 2)) { + if (_lastFrame != _scene->_activeAnimation->getCurrentFrame()) { + _lastFrame = _scene->_activeAnimation->getCurrentFrame(); + int nextFrame = -1; + + switch (_lastFrame) { + case 20: + case 30: + case 40: + case 50: + case 60: + case 70: + case 80: + case 90: + case 100: + case 110: + case 120: + case 130: + case 140: + case 149: + if (_internWalkingFl) { + nextFrame = 149; + } else if (_internTalkingFl) { + nextFrame = 149; + } else if (_lastFrame == 149) { + nextFrame = 4; + } + break; + + case 151: + if (_internWalkingFl) + nextFrame = 183; + break; + + case 167: + case 184: + if (_internWalkingFl) { + nextFrame = 184; + } else if (!_internTalkingFl) { + nextFrame = 0; + } else if (_vm->getRandomNumber(1, 100) <= 50) { + nextFrame = 151; + } else { + nextFrame = 167; + } + + if (nextFrame == 184) { + handleInternDialog(0x1D1, 3, 240); + _scene->_hotspots.activate(0x307, false); + _internVisibleFl = false; + } + break; + } + + if ((nextFrame >= 0) && (nextFrame != _scene->_activeAnimation->getCurrentFrame())) { + _scene->_activeAnimation->setCurrentFrame(nextFrame); + _lastFrame = nextFrame; + } + } + } + + switch (_game._trigger) { + case 60: + _vm->_sound->command(3); + _animMode = 2; + _scene->_reloadSceneFlag= true; + break; + + case 61: + _counter = 0; + break; + + case 62: + _scene->_nextSceneId = 319; + break; + + case 63: + _internTalkingFl = false; + break; + + case 64: + _vm->_sound->command(3); + _scene->_nextSceneId = 307; + break; + } + + uint32 tmpFrame = _vm->_events->getFrameCounter(); + uint32 diffFrame = tmpFrame - _lastFrameCounter; + _lastFrameCounter = tmpFrame; + + if ((_animMode == 2) && !_internVisibleFl && _game._player._stepEnabled) { + if ((diffFrame >= 0) && (diffFrame <= 4)) + _counter += diffFrame; + else + _counter++; + + int extraCounter = _game._objects.isInInventory(OBJ_SCALPEL) ? 900 : 0; + + if (_counter + extraCounter >= 1800) { + _scene->freeAnimation(); + _game._player._stepEnabled = false; + _scene->loadAnimation(formAnimName('c', -1), 62); + _animMode = 3; + } + } else if ((_animMode == 2) && _explosionFl && _internVisibleFl && !_dialogFl + && !_internWalkingFl && (_game._screenObjects._inputMode != 1)) { + if ((diffFrame >= 0) && (diffFrame <= 4)) + _internCounter += diffFrame; + else + _internCounter++; + + if (_internCounter >= 3600) { + _vm->_sound->command(59); + warning("TODO: shake_countdown = 20;"); + _internWalkingFl = true; + } + } + + if ((_globals._frameTime - _dropTimer) > 600) { + _vm->_sound->command(51); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 14, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); + _dropTimer = _globals._frameTime; + } +} + +void Scene318::preActions() { + if (_game._player._needToWalk) + _game._player._needToWalk = _game._player._visible; + + if (_action.isAction(0x1AD, 0x2BA)) + _game._player._walkOffScreenSceneId = 357; +} + +void Scene318::actions() { + if (_game._screenObjects._inputMode == 1) { + handleDialog(); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_TALKTO, 0x307)) { + switch (_game._trigger) { + case 0: { + _dialogFl = true; + _vm->_sound->command(15); + _game._player._stepEnabled = false; + handleRexDialogs(_vm->getRandomNumber(0x18C, 0x18E)); + + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 80); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(142, 121)); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 6, 8); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + } + break; + + case 1: + _game._player._stepEnabled = true; + handleInternDialog(0x18F, 1, 9999999); + warning("TODO: talk_init(&dialog1);"); + break; + + case 2: { + int oldIdx = _globals._sequenceIndexes[2]; + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 8); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(142, 121)); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], oldIdx); + } + break; + + default: + break; + } + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_TAKE, 0x12C) && (_game._objects.isInRoom(OBJ_SCALPEL) || _game._trigger)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 8, 2, 0, 80); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(142, 121)); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 2, 5); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_SPRITE, 5, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + + case 1: + if (_internVisibleFl) + handleInternDialog(0x190, 1, 120); + else { + _game._objects.addToInventory(OBJ_SCALPEL); + _vm->_dialogs->showItem(OBJ_SCALPEL, 0x7C5D); + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + } + break; + + case 2: { + int oldIdx = _globals._sequenceIndexes[2]; + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(142, 121)); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], oldIdx); + _scene->_sequences.addTimer(60, 3); + } + break; + + case 3: + _game._player._stepEnabled = true; + break; + } + _action._inProgress = false; + return; + } + + if (_game._player._visible) { + if (_action.isAction(0x1AD, 0x2B3)) { + _scene->_nextSceneId = 407; + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_TAKE, 0x165)) { + if (_game._objects.isInRoom(OBJ_AUDIO_TAPE)) { + _vm->_dialogs->showItem(OBJ_AUDIO_TAPE, 0x7C5B); + _game._objects.addToInventory(OBJ_AUDIO_TAPE); + } else + _vm->_dialogs->show(0x7C5A); + + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x165)) { + if (_game._objects.isInRoom(OBJ_AUDIO_TAPE)) + _vm->_dialogs->show(0x7C59); + else + _vm->_dialogs->show(0x7C5A); + + _action._inProgress = false; + return; + } + + if (_action.isAction(0x242, 0x488)) { + _vm->_dialogs->show(0x7C57); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x2D9)) { + _vm->_dialogs->show(0x7C4F); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x308)) { + _vm->_dialogs->show(0x7C51); + _action._inProgress = false; + return; + } + } else { // Not visible + if (_action.isAction(VERB_LOOK, 0x2D9)) { + _vm->_dialogs->show(0x7C4E); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x308)) { + _vm->_dialogs->show(0x7C50); + _action._inProgress = false; + return; + } + } + + if (_action.isAction(VERB_LOOK, 0x18D)) + _vm->_dialogs->show(0x7C42); + else if (_action.isAction(VERB_LOOK, 0x89)) + _vm->_dialogs->show(0x7C43); + else if (_action.isAction(VERB_LOOK, 0x2BA)) + _vm->_dialogs->show(0x7C44); + else if (_action.isAction(VERB_LOOK, 0x2B3)) + _vm->_dialogs->show(0x7C45); + else if (_action.isAction(VERB_LOOK, 0x2CB)) + _vm->_dialogs->show(0x7C46); + else if (_action.isAction(VERB_LOOK, 0x216)) + _vm->_dialogs->show(0x7C47); + else if (_action.isAction(VERB_LOOK, 0x319)) + _vm->_dialogs->show(0x7C48); + else if (_action.isAction(VERB_LOOK, 0x477)) + _vm->_dialogs->show(0x7C49); + else if (_action.isAction(VERB_LOOK, 0xE2)) + _vm->_dialogs->show(0x7C4A); + else if (_action.isAction(VERB_LOOK, 0x2C9)) + _vm->_dialogs->show(0x7C4B); + else if (_action.isAction(VERB_LOOK, 0x2C7)) + _vm->_dialogs->show(0x7C4C); + else if (_action.isAction(VERB_LOOK, 0x2C8)) + _vm->_dialogs->show(0x7C4D); + else if (_action.isAction(VERB_OPEN, 0x2C9)) + _vm->_dialogs->show(0x7C55); + else if (_action.isAction(VERB_LOOK, 0x307)) + _vm->_dialogs->show(0x7C56); + else if (_action.isAction(VERB_LOOK, 0x3A1)) + _vm->_dialogs->show(0x7C58); + else if (_action.isAction(VERB_LOOK, 0x3A2)) + _vm->_dialogs->show(0x7C5C); + else if (_action._lookFlag) { + if (_game._player._visible || _game._objects.isInInventory(OBJ_SCALPEL)) + _vm->_dialogs->show(0x7C54); + else if (_internVisibleFl) + _vm->_dialogs->show(0x7C52); + else + _vm->_dialogs->show(0x7C53); + } else + return; + + _action._inProgress = false; +} + /*------------------------------------------------------------------------*/ } // End of namespace Nebular diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h index 9dd2e12421..c5631022f8 100644 --- a/engines/mads/nebular/nebular_scenes3.h +++ b/engines/mads/nebular/nebular_scenes3.h @@ -142,7 +142,7 @@ private: void handlePrisonerDialog(); void handlePrisonerEncounter(); void setDialogNode(int node); - void handlePrisonerSpeech(int firstQuoteId, int number, long time); + void handlePrisonerSpeech(int firstQuoteId, int number, long timeout); public: Scene307(MADSEngine *vm) : Scene3xx(vm) {} @@ -245,6 +245,43 @@ public: virtual void actions(); virtual void postActions() {}; }; + +class Scene318: public Scene3xx { +private: + uint32 _dropTimer; + + int _lastFrame; + int _animMode; + int _internCounter; + int _counter; + + bool _dialogFl; + bool _internTalkingFl; + bool _internWalkingFl; + bool _internVisibleFl; + bool _explosionFl; + + uint32 _lastFrameCounter; + + Common::String _subQuote2; + + // dialog1 + + void handleDialog(); + void handleRexDialogs(int quote); + void handleInternDialog(int quoteId, int quoteNum, uint32 timeout); + +public: + Scene318(MADSEngine *vm) : Scene3xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index 07f7f9cdce..b46b5c0969 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -142,7 +142,7 @@ int SequenceList::add(int spriteListIndex, bool flipped, int frameIndex, int tri return seqIndex; } -int SequenceList::addTimer(int time, int abortVal) { +int SequenceList::addTimer(int timeout, int abortVal) { Scene &scene = _vm->_game->_scene; uint seqIndex; for (seqIndex = 0; seqIndex < _entries.size(); ++seqIndex) { @@ -154,9 +154,9 @@ int SequenceList::addTimer(int time, int abortVal) { SequenceEntry &se = _entries[seqIndex]; se._active = true; se._spritesIndex = -1; - se._numTicks = time; + se._numTicks = timeout; se._extraTicks = 0; - se._timeout = scene._frameStartTime + time; + se._timeout = scene._frameStartTime + timeout; se._triggerCountdown = true; se._doneFlag = false; se._entries._count = 0; diff --git a/engines/mads/sequence.h b/engines/mads/sequence.h index 6cef3de02d..5f052e9d0f 100644 --- a/engines/mads/sequence.h +++ b/engines/mads/sequence.h @@ -104,7 +104,7 @@ public: int extraTicks, int numTicks, int msgX, int msgY, bool nonFixed, int scale, int depth, int frameInc, SpriteAnimType animType, int numSprites, int frameStart); - int addTimer(int time, int abortVal); + int addTimer(int timeout, int abortVal); void remove(int seqIndex); void setSpriteSlot(int seqIndex, SpriteSlot &spriteSlot); bool loadSprites(int seqIndex); -- cgit v1.2.3 From 0e6c4abd13e7bea64ce36537cc8c4ebb03ccfbfc Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 21 Apr 2014 23:54:15 +0200 Subject: MADS: Use Conversation class in Scene Group 3 --- engines/mads/nebular/nebular_scenes3.cpp | 98 ++++++++++++++++---------------- engines/mads/nebular/nebular_scenes3.h | 4 +- 2 files changed, 51 insertions(+), 51 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index e828c2857e..1928461f84 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -516,13 +516,13 @@ void Scene307::setDialogNode(int node) { case 1: _globals[kMetBuddyBeast] = true; handlePrisonerSpeech(0x10F, 2, 9999999); - warning("TODO: talk_init(&dialog1);"); + dialog1.start(); break; case 2: _globals[kMetBuddyBeast] = true; handlePrisonerSpeech(0x111, 2, 9999999); - warning("TODO: talk_init(&dialog1);"); + dialog1.start(); break; case 4: @@ -533,7 +533,7 @@ void Scene307::setDialogNode(int node) { case 5: _globals[kKnowsBuddyBeast] = true; handlePrisonerSpeech(0x117, 2, 9999999); - warning("TODO: talk_init(&dialog2);"); + dialog2.start(); break; case 6: @@ -544,57 +544,57 @@ void Scene307::setDialogNode(int node) { case 7: _globals[kKnowsBuddyBeast] = true; handlePrisonerSpeech(0x124, 10, 9999999); - warning("TODO: sub71B9E(&dialog2, 0x11A, false);"); - warning("TODO: sub71B9E(&dialog2, 0x11B, true);"); - warning("TODO: sub71B9E(&dialog2, 0x120, true);"); - warning("TODO: talk_init(&dialog2);"); + dialog2.write(0x11A, false); + dialog2.write(0x11B, true); + dialog2.write(0x120, true); + dialog2.start(); break; case 8: handlePrisonerSpeech(0x12E, 6, 9999999); - warning("TODO: sub71B9E(&dialog2, 0x11A, false);"); - warning("TODO: sub71B9E(&dialog2, 0x11B, false);"); - warning("TODO: sub71B9E(&dialog2, 0x11C, true);"); - warning("TODO: sub71B9E(&dialog2, 0x11D, true);"); - warning("TODO: sub71B9E(&dialog2, 0x11F, true);"); - warning("TODO: talk_init(&dialog2);"); + dialog2.write(0x11A, false); + dialog2.write(0x11B, false); + dialog2.write(0x11C, true); + dialog2.write(0x11D, true); + dialog2.write(0x11F, true); + dialog2.start(); break; case 9: handlePrisonerSpeech(0x134, 4, 9999999); - warning("TODO: sub71B9E(&dialog2, 0x11D, false);"); - warning("TODO: talk_init(&dialog2);"); + dialog2.write(0x11D, false); + dialog2.start(); break; case 10: handlePrisonerSpeech(0x138, 6, 9999999); - warning("TODO: sub71B9E(&dialog2, 0x11E, false);"); - warning("TODO: talk_init(&dialog2);"); + dialog2.write(0x11E, false); + dialog2.start(); break; case 11: handlePrisonerSpeech(0x13E, 6, 9999999); - warning("TODO: sub71B9E(&dialog2, 0x11F, false);"); - warning("TODO: sub71B9E(&dialog2, 0x121, true);"); - warning("TODO: talk_init(&dialog2);"); + dialog2.write(0x11F, false); + dialog2.write(0x121, true); + dialog2.start(); break; case 12: handlePrisonerSpeech(0x144, 4, 9999999); - warning("TODO: sub71B9E(&dialog2, 0x11C, false);"); - warning("TODO: talk_init(&dialog2);"); + dialog2.write(0x11C, false); + dialog2.start(); break; case 13: handlePrisonerSpeech(0x148, 7, 9999999); - warning("TODO: sub71B9E(&dialog2, 0x120, false);"); - warning("TODO: talk_init(&dialog2);"); + dialog2.write(0x120, false); + dialog2.start(); break; case 14: handlePrisonerSpeech(0x14F, 3, 9999999); - warning("TODO: sub71B9E(&dialog2, 0x121, false);"); - warning("TODO: talk_init(&dialog2);"); + dialog2.write(0x121, false); + dialog2.start(); break; case 15: @@ -605,7 +605,7 @@ void Scene307::setDialogNode(int node) { case 16: _globals[kKnowsBuddyBeast] = true; handlePrisonerSpeech(0x10C, 1, 9999999); - warning("TODO: talk_init(&dialog2);"); + dialog2.start(); break; default: @@ -694,13 +694,13 @@ void Scene307::enter() { 0x142, 0x143, 0x144, 0x145, 0x146, 0x147, 0x148, 0x149, 0x14A, 0x14B, 0x14C, 0x14D, 0x14E, 0x14F, 0x150, 0x151, 0x152, 0x153, 0); - warning("TODO: sub71A50(&dialog1, 0x3F, 0x113, 0x114, 0x115, -1);"); - warning("TODO: sub71A50(&dialog2, 0x40, 0x11A, 0x11B, 0x11C, 0x11D, 0x11E, 0x11F, 0x120, 0x121, 0x122, 0);"); + dialog1.setup(0x3F, 0x113, 0x114, 0x115, -1); + dialog2.setup(0x40, 0x11A, 0x11B, 0x11C, 0x11D, 0x11E, 0x11F, 0x120, 0x121, 0x122, 0); if (!_game._visitedScenes._sceneRevisited) - warning("TODO: sub71B18(&dialog2, 0x11A, 0x122, 0);"); + dialog2.set(0x11A, 0x122, 0); else if (_scene->_priorSceneId == 318) - warning("TODO: sub71B9E(&dialog2, 0x11E, -1);"); + dialog2.write(0x11E, true); if (_scene->_priorSceneId == -2) { @@ -2306,41 +2306,41 @@ void Scene318::handleDialog() { _game._player._stepEnabled = true; } else { if (_action._activeAction._verbId < 0x19C) - warning("TODO: sub71B9E(&dialog1, _action._activeAction._verbId, false);"); + dialog1.write(_action._activeAction._verbId, false); switch (_action._activeAction._verbId) { case 0x191: handleInternDialog(0x19E, 2, 9999999); - warning("TODO: sub71B9E(&dialog1, 0x192, true);"); + dialog1.write(0x192, true); break; case 0x192: handleInternDialog(0x1A0, 5, 9999999); - warning("TODO: sub71B9E(&dialog1, 0x193, true);"); + dialog1.write(0x193, true); break; case 0x193: handleInternDialog(0x1A5, 4, 9999999); - warning("TODO: sub71B9E(&dialog1, 0x194, true);"); + dialog1.write(0x194, true); break; case 0x194: handleInternDialog(0x1A9, 6, 9999999); - warning("TODO: sub71B9E(&dialog1, 0x195, true);"); - warning("TODO: sub71B9E(&dialog1, 0x196, true);"); - warning("TODO: sub71B9E(&dialog1, 0x19D, false);"); + dialog1.write(0x195, true); + dialog1.write(0x196, true); + dialog1.write(0x19D, false); break; case 0x195: handleInternDialog(0x1AF, 7, 9999999); warning("TODO: if (!sub71C16(&_dialog1, 0x196))"); - warning("TODO: \tsub71B9E(&dialog1, 0x197, true);"); + dialog1.write(0x197, true); break; case 0x196: handleInternDialog(0x1B6, 5, 9999999); warning("TODO: if (!sub71C16(&_dialog1, 0x195))"); - warning("TODO: \tsub71B9E(&dialog1, 0x197, true);"); + dialog1.write(0x197, true); break; case 0x197: @@ -2349,7 +2349,7 @@ void Scene318::handleDialog() { case 0x198: handleInternDialog(0x1C0, 5, 9999999); - warning("TODO: sub71B9E(&dialog1, 0x19A, true);"); + dialog1.write(0x19A, true); break; case 0x199: @@ -2358,7 +2358,7 @@ void Scene318::handleDialog() { case 0x19A: handleInternDialog(0x1C8, 5, 9999999); - warning("TODO: sub71B9E(&dialog1, 0x19B, true);"); + dialog1.write(0x19B, true); break; case 0x19B: @@ -2384,7 +2384,7 @@ void Scene318::handleDialog() { } if (_action._activeAction._verbId < 0x19C) { - warning("TODO: talk_init(&dialog1);"); + dialog1.start(); _game._player._stepEnabled = true; } @@ -2459,12 +2459,12 @@ void Scene318::enter() { else if (_scene->_priorSceneId != -2) _game._player._playerPos = Common::Point(214, 152); - warning("TODO: sub71A50(&dialog1, 0x47, 0x191, 0x192, 0x193, 0x194, 0x195, 0x196, 0x197, 0x198, 0x199, 0x19A, 0x19B, 0x19C, 0x19D, 0);"); + dialog1.setup(0x47, 0x191, 0x192, 0x193, 0x194, 0x195, 0x196, 0x197, 0x198, 0x199, 0x19A, 0x19B, 0x19C, 0x19D, 0); if (!_game._visitedScenes._sceneRevisited) { - warning("TODO: sub71B18(&dialog1, 0x191, 0x198, 0x199, 0x19C, 0);"); - warning("TODO: if (Debugger_widepipe_ctr >= 2)"); - warning("TODO: \tsub71B9E(&dialog1, 0x19D, -1);"); + dialog1.set(0x191, 0x198, 0x199, 0x19C, 0); + if (_game._widepipeCtr >= 2) + dialog1.write(0x19D, true); } if (_scene->_priorSceneId == 307) { @@ -2509,7 +2509,7 @@ void Scene318::enter() { } if (_dialogFl) { - warning("TODO: talk_init(&dialog1);"); + dialog1.start(); _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 8); } else _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 1); @@ -2704,7 +2704,7 @@ void Scene318::actions() { case 1: _game._player._stepEnabled = true; handleInternDialog(0x18F, 1, 9999999); - warning("TODO: talk_init(&dialog1);"); + dialog1.start(); break; case 2: { diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h index c5631022f8..c48017fc30 100644 --- a/engines/mads/nebular/nebular_scenes3.h +++ b/engines/mads/nebular/nebular_scenes3.h @@ -135,7 +135,7 @@ private: Common::String _subQuote2; - // dialog1, dialog2; + Conversation dialog1, dialog2; void handleDialog(); void handleRexDialog(int quote); @@ -265,7 +265,7 @@ private: Common::String _subQuote2; - // dialog1 + Conversation dialog1; void handleDialog(); void handleRexDialogs(int quote); -- cgit v1.2.3 From ff70186855bec22fe77043d89917b189218ff856 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 21 Apr 2014 19:12:28 -0400 Subject: MADS: Improve background user interface sprite animations --- engines/mads/msurface.cpp | 44 ------------------------------------ engines/mads/msurface.h | 8 ------- engines/mads/user_interface.cpp | 49 +++++++++++++++++++++++++++++++++++++++-- engines/mads/user_interface.h | 11 +++++++++ 4 files changed, 58 insertions(+), 54 deletions(-) diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp index 75aad01ee1..2c9d093877 100644 --- a/engines/mads/msurface.cpp +++ b/engines/mads/msurface.cpp @@ -418,50 +418,6 @@ void MSurface::copyFrom(MSurface *src, const Common::Point &destPos, int depth, } } -void MSurface::mergeFrom(MSurface *src, const Common::Rect &srcBounds, const Common::Point &destPos) { - // Validation of the rectangle and position - int destX = destPos.x, destY = destPos.y; - if ((destX >= w) || (destY >= h)) - return; - - Common::Rect copyRect = srcBounds; - if (destX < 0) { - copyRect.left += -destX; - destX = 0; - } - else if (destX + copyRect.width() > w) { - copyRect.right -= destX + copyRect.width() - w; - } - if (destY < 0) { - copyRect.top += -destY; - destY = 0; - } - else if (destY + copyRect.height() > h) { - copyRect.bottom -= destY + copyRect.height() - h; - } - - if (!copyRect.isValidRect()) - return; - - // Copy the specified area - - byte *data = src->getData(); - byte *srcPtr = data + (src->getWidth() * copyRect.top + copyRect.left); - byte *destPtr = (byte *)pixels + (destY * getWidth()) + destX; - - for (int rowCtr = 0; rowCtr < copyRect.height(); ++rowCtr) { - // Process each line of the area - for (int xCtr = 0; xCtr < copyRect.width(); ++xCtr) { - // Check for the range used for on-screen text, which should be kept intact - if (srcPtr[xCtr] < 8 || srcPtr[xCtr] > 15) - destPtr[xCtr] = srcPtr[xCtr]; - } - - srcPtr += src->getWidth(); - destPtr += getWidth(); - } -} - void MSurface::scrollX(int xAmount) { if (xAmount == 0) return; diff --git a/engines/mads/msurface.h b/engines/mads/msurface.h index f590bac2e5..7cf2bbe15b 100644 --- a/engines/mads/msurface.h +++ b/engines/mads/msurface.h @@ -187,14 +187,6 @@ public: dest->copyFrom(this, srcBounds, destPos, transparentColor); } - /** - * Merges a sub-section of another surface into the current one. - * @param src Source surface - * @param srcBounds Area to copy/merge from - * @param destPos Destination position to draw in current surface - */ - void mergeFrom(MSurface *src, const Common::Rect &srcBounds, const Common::Point &destPos); - /** * Scroll the screen horizontally by a given amount * @param xAmount Horizontal amount diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index a5e8a844f9..f775e459b5 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -162,10 +162,12 @@ void UISlots::draw(bool updateFlag, bool delFlag) { if (flipped) { MSurface *spr = sprite->flipHorizontal(); - spr->copyTo(&userInterface, slot._position, sprite->getTransparencyIndex()); + userInterface.mergeFrom(spr, spr->getBounds(), slot._position, + sprite->getTransparencyIndex()); delete spr; } else { - sprite->copyTo(&userInterface, slot._position, sprite->getTransparencyIndex()); + userInterface.mergeFrom(sprite, sprite->getBounds(), slot._position, + sprite->getTransparencyIndex()); } } } @@ -407,6 +409,49 @@ void UserInterface::drawTextElements() { } } +void UserInterface::mergeFrom(MSurface *src, const Common::Rect &srcBounds, + const Common::Point &destPos, int transparencyIndex) { + // Validation of the rectangle and position + int destX = destPos.x, destY = destPos.y; + if ((destX >= w) || (destY >= h)) + return; + + Common::Rect copyRect = srcBounds; + if (destX < 0) { + copyRect.left += -destX; + destX = 0; + } else if (destX + copyRect.width() > w) { + copyRect.right -= destX + copyRect.width() - w; + } + if (destY < 0) { + copyRect.top += -destY; + destY = 0; + } else if (destY + copyRect.height() > h) { + copyRect.bottom -= destY + copyRect.height() - h; + } + + if (!copyRect.isValidRect()) + return; + + // Copy the specified area + + byte *data = src->getData(); + byte *srcPtr = data + (src->getWidth() * copyRect.top + copyRect.left); + byte *destPtr = (byte *)this->pixels + (destY * getWidth()) + destX; + + for (int rowCtr = 0; rowCtr < copyRect.height(); ++rowCtr) { + // Process each line of the area + for (int xCtr = 0; xCtr < copyRect.width(); ++xCtr) { + // Check for the range used for on-screen text, which should be kept intact + if ((destPtr[xCtr] >= 8 && destPtr[xCtr] <= 15) && (int)srcPtr[xCtr] != transparencyIndex) + destPtr[xCtr] = srcPtr[xCtr]; + } + + srcPtr += src->getWidth(); + destPtr += getWidth(); + } +} + void UserInterface::drawActions() { for (int idx = 0; idx < 10; ++idx) { writeVocab(CAT_COMMAND, idx); diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h index 7541bb8661..a29a0e6de0 100644 --- a/engines/mads/user_interface.h +++ b/engines/mads/user_interface.h @@ -228,6 +228,17 @@ public: void drawTextElements(); + /** + * Merges a sub-section of another surface into the user interface without + * destroying any on-screen text + * @param src Source surface + * @param srcBounds Area to copy/merge from + * @param destPos Destination position to draw in current surface + * @param transparencyIndex Transparency color + */ + void mergeFrom(MSurface *src, const Common::Rect &srcBounds, const Common::Point &destPos, + int transparencyIndex = -1); + /** * Loads the animation sprite data for a given inventory object */ -- cgit v1.2.3 From 692af23f6f0a698e9089fcef0592fcb20e56efa6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 21 Apr 2014 20:50:05 -0400 Subject: MADS: Create a Globals base class that the games will derive from --- engines/mads/game.h | 6 ++++ engines/mads/globals.cpp | 34 ++++++++++++++++++++++ engines/mads/globals.h | 50 ++++++++++++++++++++++++++++++++ engines/mads/module.mk | 1 + engines/mads/nebular/game_nebular.h | 5 +++- engines/mads/nebular/globals_nebular.cpp | 7 +---- engines/mads/nebular/globals_nebular.h | 16 ++-------- engines/mads/nebular/nebular_scenes.h | 2 +- engines/mads/user_interface.cpp | 25 +++++----------- 9 files changed, 107 insertions(+), 39 deletions(-) create mode 100644 engines/mads/globals.cpp create mode 100644 engines/mads/globals.h diff --git a/engines/mads/game.h b/engines/mads/game.h index 44aa0dbee5..5bb7b31973 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -27,6 +27,7 @@ #include "common/str-array.h" #include "mads/scene.h" #include "mads/game_data.h" +#include "mads/globals.h" #include "mads/inventory.h" #include "mads/player.h" #include "mads/screen.h" @@ -149,6 +150,11 @@ public: void splitQuote(Common::String quote, Common::String part1, Common::String part2) {warning("TODO: splitQuote()");} Common::StringArray getMessage(uint32 id); + /** + * Returns the globals for the game + */ + virtual Globals &globals() = 0; + /** * Standard object handling across the game */ diff --git a/engines/mads/globals.cpp b/engines/mads/globals.cpp new file mode 100644 index 0000000000..68a2cf1970 --- /dev/null +++ b/engines/mads/globals.cpp @@ -0,0 +1,34 @@ +/* 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 "common/scummsys.h" +#include "mads/globals.h" + +namespace MADS { + +void Globals::reset() { + for (uint i = 0; i < _flags.size(); ++i) + _flags[i] = 0; +} + + +} // End of namespace MADS diff --git a/engines/mads/globals.h b/engines/mads/globals.h new file mode 100644 index 0000000000..ea327b0045 --- /dev/null +++ b/engines/mads/globals.h @@ -0,0 +1,50 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_GLOBALS_H +#define MADS_GLOBALS_H + +#include "common/scummsys.h" +#include "common/array.h" + +namespace MADS { + +class Globals { +protected: + Common::Array _flags; +public: + Globals() {} + + /** + * Square brackets operator for accessing flags + */ + int16 &operator[](int idx) { return _flags[idx]; } + + /* + * Resets all the globals to empty + */ + void reset(); +}; + +} // End of namespace MADS + +#endif /* MADS_GLOBALS_H */ diff --git a/engines/mads/module.mk b/engines/mads/module.mk index 716521d6ec..43853f5abb 100644 --- a/engines/mads/module.mk +++ b/engines/mads/module.mk @@ -21,6 +21,7 @@ MODULE_OBJS := \ font.o \ game.o \ game_data.o \ + globals.o \ hotspots.o \ inventory.o \ mads.o \ diff --git a/engines/mads/nebular/game_nebular.h b/engines/mads/nebular/game_nebular.h index 4d011c2f4a..7d64e3e49f 100644 --- a/engines/mads/nebular/game_nebular.h +++ b/engines/mads/nebular/game_nebular.h @@ -25,6 +25,7 @@ #include "common/scummsys.h" #include "mads/game.h" +#include "mads/globals.h" #include "mads/nebular/globals_nebular.h" namespace MADS { @@ -62,9 +63,11 @@ protected: virtual void checkShowDialog(); public: - Globals _globals; + NebularGlobals _globals; StoryMode _storyMode; + virtual Globals &globals() { return _globals; } + virtual void doObjectAction(); virtual void unhandledAction(); diff --git a/engines/mads/nebular/globals_nebular.cpp b/engines/mads/nebular/globals_nebular.cpp index 11c2b81502..3e9a9f7e2f 100644 --- a/engines/mads/nebular/globals_nebular.cpp +++ b/engines/mads/nebular/globals_nebular.cpp @@ -28,7 +28,7 @@ namespace MADS { namespace Nebular { -Globals::Globals() { +NebularGlobals::NebularGlobals(): Globals() { // Initialize lists _flags.resize(210); _spriteIndexes.resize(30); @@ -53,11 +53,6 @@ Globals::Globals() { _v84268 = 0; } -void Globals::reset() { - for (uint i = 0; i < _flags.size(); ++i) - _flags[i] = 0; -} - } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/globals_nebular.h b/engines/mads/nebular/globals_nebular.h index 242e0d1b7b..b8fe17f333 100644 --- a/engines/mads/nebular/globals_nebular.h +++ b/engines/mads/nebular/globals_nebular.h @@ -279,9 +279,7 @@ enum { #define TELEPORTER_WORK_COUNT 6 // Total number that actually work -class Globals { -private: - Common::Array _flags; +class NebularGlobals: public Globals { public: Common::Array _spriteIndexes; Common::Array _sequenceIndexes; @@ -302,17 +300,7 @@ public: /** * Constructor */ - Globals(); - - /** - * Square brackets operator for accessing flags - */ - int16 &operator[](int idx) { return _flags[idx]; } - - /* - * Resets all the globals to empty - */ - void reset(); + NebularGlobals(); }; } // End of namespace Nebular diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index 56ea52d2c8..a227b7658a 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -111,7 +111,7 @@ public: */ class NebularScene : public SceneLogic { protected: - Globals &_globals; + NebularGlobals &_globals; GameNebular &_game; MADSAction &_action; diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index f775e459b5..346ad2d688 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -231,18 +231,14 @@ void Conversation::setup(int globalId, ...) { if (quoteId < 0) { // For an ending value of -1, also initial the bitflags for the global // associated with the conversation entry, which enables all the quote Ids - assert(_vm->getGameID() == GType_RexNebular); - Nebular::GameNebular *game = (Nebular::GameNebular *)_vm->_game; - game->_globals[globalId] = (int16)0xffff; + _vm->_game->globals()[globalId] = (int16)0xffff; } _globalId = globalId; } void Conversation::set(int quoteId, ...) { - assert(_vm->getGameID() == GType_RexNebular); - Nebular::GameNebular *game = (Nebular::GameNebular *)_vm->_game; - game->_globals[_globalId] = 0; + _vm->_game->globals()[_globalId] = 0; va_list va; va_start(va, quoteId); @@ -252,7 +248,7 @@ void Conversation::set(int quoteId, ...) { for (uint idx = 0; idx < _quotes.size(); ++idx) { if (_quotes[idx] == quoteId) { // Found index, so set that bit in the global keeping track of conversation state - game->_globals[_globalId] |= 1 << idx; + _vm->_game->globals()[_globalId] |= 1 << idx; break; } } @@ -263,18 +259,15 @@ void Conversation::set(int quoteId, ...) { } void Conversation::write(int quoteId, bool flag) { - assert(_vm->getGameID() == GType_RexNebular); - Nebular::GameNebular *game = (Nebular::GameNebular *)_vm->_game; - for (uint idx = 0; idx < _quotes.size(); ++idx) { if (_quotes[idx] == quoteId) { // Found index, so set or clear the flag if (flag) { // Set bit - game->_globals[_globalId] |= 1 << idx; + _vm->_game->globals()[_globalId] |= 1 << idx; } else { // Clear bit - game->_globals[_globalId] &= ~(1 << idx); + _vm->_game->globals()[_globalId] &= ~(1 << idx); } return; } @@ -282,17 +275,15 @@ void Conversation::write(int quoteId, bool flag) { } void Conversation::start() { - assert(_vm->getGameID() == GType_RexNebular); - Nebular::GameNebular *game = (Nebular::GameNebular *)_vm->_game; - UserInterface &userInterface = game->_scene._userInterface; + UserInterface &userInterface = _vm->_game->_scene._userInterface; userInterface.emptyConversationList(); // Loop through each of the quotes loaded into the conversation for (uint idx = 0; idx < _quotes.size(); ++idx) { // Check whether the given quote is enabled or not - if (game->_globals[_globalId] & (1 << idx)) { + if (_vm->_game->globals()[_globalId] & (1 << idx)) { // Quote enabled, so add it to the list of talk selections - Common::String msg = game->getQuote(_quotes[idx]); + Common::String msg = _vm->_game->getQuote(_quotes[idx]); userInterface.addConversationMessage(_quotes[idx], msg); } } -- cgit v1.2.3 From b2e2a2deeee660ec2b28bc0098dfe0da67869e04 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 22 Apr 2014 23:26:09 +0200 Subject: MADS: Implement scene 319 --- engines/mads/nebular/nebular_scenes.cpp | 2 + engines/mads/nebular/nebular_scenes3.cpp | 460 +++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes3.h | 28 ++ engines/mads/palette.cpp | 3 +- engines/mads/palette.h | 2 +- 5 files changed, 493 insertions(+), 2 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 77146a0773..2c16fdb52e 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -127,6 +127,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene316(vm); case 318: return new Scene318(vm); + case 319: + return new Scene319(vm); // Scene group #8 case 804: diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 1928461f84..15cd4822aa 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -2870,5 +2870,465 @@ void Scene318::actions() { /*------------------------------------------------------------------------*/ +void Scene319::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene319::handleRexDialogues(int quote) { + _scene->_kernelMessages.reset(); + + Common::String curQuote = _game.getQuote(quote); + if (_vm->_font->getWidth(curQuote, _scene->_textSpacing) > 200) { + Common::String subQuote1; + _game.splitQuote(curQuote, subQuote1, _subQuote2); + _scene->_kernelMessages.add(Common::Point(160, 106), 0x1110, 32, 0, 120, subQuote1); + _scene->_kernelMessages.add(Common::Point(160, 120), 0x1110, 32, 1, 120, _subQuote2); + } else + _scene->_kernelMessages.add(Common::Point(160, 120), 0x1110, 32, 1, 120, curQuote); +} + +void Scene319::handleSlacheDialogs(int quoteId, int counter, uint32 timer) { + int curQuote = quoteId; + int posY = 5 + (_slachePosY * 14); + + for (int count = 0; count < counter; count++, curQuote++) { + _scene->_kernelMessages.add(Common::Point(8, posY), 0xFDFC, 0, 0, timer, _game.getQuote(curQuote)); + posY += 14; + } +} + +void Scene319::enter() { + _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('e', 0)); + _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('a', 0)); + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('a', 1)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('a', 2)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('a', 3)); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('k', -1)); + + if (!_game._objects.isInInventory(OBJ_SCALPEL)) { + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 1); + } + + _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 18, 0, 0, 300); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 67, 0, 0, 377); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 173, 0, 0, 233); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 14); + + _globals._sequenceIndexes[0] = _scene->_sequences.startCycle (_globals._spriteIndexes[0], false, 1); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle (_globals._spriteIndexes[1], false, 1); + + _dialog1.setup(0x43, 0x165, 0x166, 0x167, 0x168, 0x169, 0x16A, 0); + _dialog2.setup(0x44, 0x171, 0x172, 0x173, 0x174, 0x175, 0x176, 0); + _dialog3.setup(0x45, 0x17D, 0x17E, 0x17F, 0x180, 0x181, 0x182, 0x183, 0); + + if (_scene->_priorSceneId != -2) { + _dialog1.set(0x165, 0x166, 0x167, 0x168, 0); + _dialog2.set(0x171, 0x172, 0x173, 0x174, 0); + _dialog3.set(0x17D, 0x17E, 0x17F, 0x180, 0); + } + + _game.loadQuoteSet(0x15F, 0x160, 0x161, 0x162, 0x163, 0x164, 0x16B, 0x16C, 0x16D, + 0x16E, 0x16F, 0x170, 0x177, 0x178, 0x178, 0x17A, 0x17B, 0x17C, 0x165, 0x166, + 0x167, 0x168, 0x169, 0x16A, 0x171, 0x172, 0x173, 0x174, 0x175, 0x176, 0x17D, + 0x17E, 0x17F, 0x180, 0x181, 0x182, 0x183, 0x184, 0x185, 0x186, 0x187, 0x188, + 0x189, 0x18A, 0x18B, 0); + + _vm->_palette->setEntry(252, 63, 30, 2); + _vm->_palette->setEntry(253, 45, 15, 1); + + _slachePosY = 0; + _slacheInitFl = false; + _slacheTalkingFl = false; + _slacheReady = false; + _animFrame = 0; + + _scene->loadAnimation(formAnimName('b', 0)); + + if (_scene->_priorSceneId != -2) { + _animMode = 1; + _nextAction1 = 2; + _nextAction2 = 2; + _slacheMode = 1; + _slacheTopic = 1; + _slacheInitFl = true; + + if (_globals[kRexHasMetSlache]) { + handleSlacheDialogs(0x18A, 2, 9999999); + _slachePosY = 3; + } else { + handleSlacheDialogs(0x186, 4, 9999999); + _slachePosY = 5; + } + } + + switch (_slacheTopic) { + case 1: + handleSlacheDialogs(0x15F, 2, 9999999); + _dialog1.start(); + break; + + case 2: + handleSlacheDialogs(0x16B, 2, 9999999); + _dialog2.start(); + break; + + case 3: + handleSlacheDialogs(0x177, 2, 9999999); + _dialog3.start(); + break; + + default: + break; + } + + _slachePosY = 0; + sceneEntrySound(); +} + +void Scene319::step() { + if (_scene->_activeAnimation == nullptr) + return; + + if (_animFrame != _scene->_activeAnimation->getCurrentFrame()) { + _animFrame = _scene->_activeAnimation->getCurrentFrame(); + int nextFrame = -1; + if (_animMode == 1) { + switch (_animFrame) { + case 6: + _slacheTalkingFl = true; + break; + + case 29: + _slacheReady = true; + break; + + case 39: + if (_slacheInitFl) { + _slacheInitFl = false; + if (_nextAction1 == 2) + nextFrame = 0; + } else if (_nextAction1 == 2) + _nextAction1 = 1; + break; + + case 50: + case 60: + case 70: + case 85: + if (_nextAction1 == 2) + nextFrame = 0; + else if (_nextAction1 == 3) { + nextFrame = 85; + _slacheTalkingFl = true; + } else if (_animFrame == 85) { + if (!_game._player._stepEnabled) + _slacheTalkingFl = true; + nextFrame = 40; + } + break; + + case 115: + _slacheReady = true; + break; + + case 129: + if (_nextAction1 == 3) { + nextFrame = 115; + if (!_game._player._stepEnabled) + _slacheTalkingFl = true; + } + break; + + case 145: + nextFrame = 40; + break; + + default: + break; + } + + if ((_animFrame > 40) && (_animFrame < 85) && (nextFrame < 0)) { + switch (_nextAction1) { + case 4: + _animFrame = 0; + _scene->freeAnimation(); + _animMode = 2; + _scene->loadAnimation(formAnimName('b', 3), 70); + break; + + case 5: + _animFrame = 0; + _scene->freeAnimation(); + _animMode = 3; + _scene->loadAnimation(formAnimName('b', 4), 71); + break; + + case 6: + _animFrame = 0; + _scene->freeAnimation(); + _animMode = 4; + _scene->loadAnimation(formAnimName('b', 5), 72); + break; + + default: + break; + } + + if (!_animFrame) { + _scene->_sequences.remove(_globals._sequenceIndexes[0]); + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + + for (int i = 0; i <= 1; i++) { + _globals._sequenceIndexes[i] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[i], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[i], 1, 7); + } + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_EXPIRE, 0, 73); + } + } + } + + if (_animMode == 2) { + if (_animFrame == 13) + warning("TODO: shake_countdown = 40;"); + + if (_animFrame == 16) + warning("TODO: shake_countdown = 1;"); + } + + if (_animMode == 3) { + if (_animFrame == 11) + warning("TODO: shake_countdown = 60;"); + + if (_animFrame == 18) + warning("TODO: shake_countdown = 1;"); + } + + if ((_animMode == 4) && (_animFrame == 16)) + warning("TODO: shake_countdown = 80;"); + + if ((nextFrame >= 0) && (nextFrame != _scene->_activeAnimation->getCurrentFrame())) { + _scene->_activeAnimation->setCurrentFrame(nextFrame); + _animFrame = nextFrame; + } + } + + switch (_game._trigger) { + case 70: + case 71: + _animMode = 1; + _nextAction1 = _nextAction2; + _animFrame = 0; + _scene->freeAnimation(); + _scene->loadAnimation(formAnimName('b', 0), false); + if (_nextAction1 == 3) + _scene->_activeAnimation->setCurrentFrame(85); + else if (_nextAction1 == 1) + _scene->_activeAnimation->setCurrentFrame(40); + + _animFrame = _scene->_activeAnimation->getCurrentFrame(); + _slacheTalkingFl = true; + warning("TODO: shake_countdown = 1;"); + + for (int i = 0; i <= 1; i++) { + int oldIdx = _globals._sequenceIndexes[i]; + _scene->_sequences.remove(_globals._sequenceIndexes[i]); + _globals._sequenceIndexes[i] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[i], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[i], 8, 13); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[i], oldIdx); + } + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_EXPIRE, 0, 74); + break; + + case 72: + warning("TODO: sub7CBD8(-1, 0, 0);"); + warning("TODO: sub7CBE4(0, 0, 0);"); + _vm->_palette->fadeOut(_vm->_palette->_mainPalette, 18, 228, 16, 1, 8, 248, 0, 0); + warning("TODO: shake_countdown = 1;"); + _scene->_reloadSceneFlag = true; + break; + + case 73: + for (int i = 0; i <= 1; i++) { + int oldIdx = _globals._sequenceIndexes[i]; + _scene->_sequences.remove(_globals._sequenceIndexes[i]); + _globals._sequenceIndexes[i] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[i], false, 8, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[i], 6, 7); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[i], oldIdx); + } + break; + + case 74: + for (int i = 0; i <= 1; i++) { + int oldIdx = _globals._sequenceIndexes[i]; + _scene->_sequences.remove(_globals._sequenceIndexes[i]); + _globals._sequenceIndexes[i] = _scene->_sequences.startCycle (_globals._spriteIndexes[i], false, 1); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[i], oldIdx); + } + break; + + default: + break; + } +} + +void Scene319::actions() { + if (_game._trigger == 0) { + _game._player._stepEnabled = false; + handleRexDialogues(_action._activeAction._verbId); + } else { + if ((_action._activeAction._verbId == 0x165) || (_action._activeAction._verbId == 0x166)) { + if (_game._trigger == 1) { + _nextAction1 = 3; + _slacheTalkingFl = false; + _slacheMode = 1; + _slacheTopic = 2; + } + + if (!_slacheTalkingFl) { + _scene->_sequences.addTimer(4, 2); + } else { + handleSlacheDialogs(0x16B, 2, 9999999); + _dialog2.start(); + _game._player._stepEnabled = true; + } + } + + if ((_action._activeAction._verbId == 0x171) || (_action._activeAction._verbId == 0x172)) { + if (_game._trigger == 1) { + _nextAction1 = 2; + _slacheTalkingFl = false; + _slacheMode = 1; + _slacheTopic = 3; + } + + if (!_slacheTalkingFl) { + _scene->_sequences.addTimer(4, 2); + } else { + handleSlacheDialogs(0x177, 2, 9999999); + _dialog3.start(); + _game._player._stepEnabled = true; + } + } + + if ((_action._activeAction._verbId == 0x17D) || (_action._activeAction._verbId == 0x17E)) { + if (_game._trigger == 1) { + _nextAction1 = 3; + _slacheTalkingFl = false; + _slacheReady = false; + _slacheMode = 1; + _slacheTopic = 1; + } + + if (!_slacheTalkingFl) { + _scene->_sequences.addTimer(4, 2); + } else { + if (_game._trigger == 2) + handleSlacheDialogs(0x184, 2, 180); + + if (!_slacheReady) { + _scene->_sequences.addTimer(120, 3); + } else { + _globals[kRexHasMetSlache] = true; + _scene->_nextSceneId = 318; + } + } + } + + if ((_action._activeAction._verbId == 0x168) || (_action._activeAction._verbId == 0x174) || + (_action._activeAction._verbId == 0x180) || (_action._activeAction._verbId == 0x169) || + (_action._activeAction._verbId == 0x175) || (_action._activeAction._verbId == 0x181) || + (_action._activeAction._verbId == 0x16A) || (_action._activeAction._verbId == 0x176) || + (_action._activeAction._verbId == 0x182) || (_action._activeAction._verbId == 0x183) || + (_action._activeAction._verbId == 0x167) || (_action._activeAction._verbId == 0x173) || + (_action._activeAction._verbId == 0x17F)) { + + bool addDialogLine = !((_action._activeAction._verbId == 0x167) || (_action._activeAction._verbId == 0x173) || + (_action._activeAction._verbId == 0x17F) || (_action._activeAction._verbId == 0x16A) || + (_action._activeAction._verbId == 0x176) || (_action._activeAction._verbId == 0x182) || + (_action._activeAction._verbId == 0x183)); + + int addVerbId = _action._activeAction._verbId + 1; + if ((addVerbId == 0x182) && (_game._storyMode != STORYMODE_NAUGHTY)) + addVerbId = 0x183; + + if (_slacheMode == 1) { + if (_game._trigger == 1) { + _nextAction2 = _nextAction1; + _nextAction1 = 4; + } + + if (_nextAction1 != _nextAction2) { + _scene->_sequences.addTimer(4, 2); + } else { + Conversation *curDialog; + int nextDocQuote; + if ((_action._activeAction._verbId == 0x168) || (_action._activeAction._verbId == 0x167)) { + curDialog = &_dialog1; + nextDocQuote = 0x161; + } else if ((_action._activeAction._verbId == 0x174) || (_action._activeAction._verbId == 0x1753)) { + nextDocQuote = 0x16D; + curDialog = &_dialog2; + } else { + nextDocQuote = 0x179; + curDialog = &_dialog3; + } + + handleSlacheDialogs(nextDocQuote, 2, 9999999); + if (addDialogLine) { + curDialog->write(_action._activeAction._verbId, false); + curDialog->write(addVerbId, true); + } + + curDialog->start(); + _game._player._stepEnabled = true; + _slacheMode = 2; + } + } else if (_slacheMode == 2) { + if (_game._trigger == 1) { + _nextAction2 = _nextAction1; + _nextAction1 = 5; + } + + if (_nextAction1 != _nextAction2) { + _scene->_sequences.addTimer(4, 2); + } else { + Conversation *curDialog; + int nextDocQuote; + if ((_action._activeAction._verbId == 0x168) || (_action._activeAction._verbId == 0x169) || (_action._activeAction._verbId == 0x167)) { + curDialog = &_dialog1; + nextDocQuote = 0x163; + } else if ((_action._activeAction._verbId == 0x174) || (_action._activeAction._verbId == 0x175) || (_action._activeAction._verbId == 0x173)) { + nextDocQuote = 0x16F; + curDialog = &_dialog2; + } else { + nextDocQuote = 0x17B; + curDialog = &_dialog3; + } + + handleSlacheDialogs(nextDocQuote, 2, 9999999); + if (addDialogLine) { + curDialog->write(_action._activeAction._verbId, false); + curDialog->write(addVerbId, true); + } + + curDialog->start(); + _game._player._stepEnabled = true; + _slacheMode = 3; + } + } else { + _nextAction2 = _nextAction1; + _nextAction1 = 6; + } + } + } + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h index c48017fc30..b284a2ef9b 100644 --- a/engines/mads/nebular/nebular_scenes3.h +++ b/engines/mads/nebular/nebular_scenes3.h @@ -282,6 +282,34 @@ public: virtual void postActions() {}; }; +class Scene319: public Scene3xx { +private: + Conversation _dialog1, _dialog2, _dialog3; + + int _animMode, _animFrame; + int _nextAction1, _nextAction2; + int _slacheMode; + int _slacheTopic; + int _slachePosY; + + bool _slacheTalkingFl; + bool _slacheReady; + bool _slacheInitFl; + + Common::String _subQuote2; + + void handleRexDialogues(int quote); + void handleSlacheDialogs(int quoteId, int counter, uint32 timer); +public: + Scene319(MADSEngine *vm) : Scene3xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions(); + virtual void postActions() {}; +}; } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index d6cf652760..d9a46a93ef 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -495,7 +495,8 @@ void Palette::setLowRange() { _vm->_palette->setPalette(_mainPalette, 0, 4); } -void Palette::fadeOut(byte palette[PALETTE_SIZE], int v1, int v2, int v3, int v4, int v5, int v6) { +void Palette::fadeOut(byte palette[PALETTE_SIZE], int start, int count, int v1, int v2, int v3, int v4, int v5, int v6) { + warning("TODO: Palette::fadeOut()"); } void Palette::lock() { diff --git a/engines/mads/palette.h b/engines/mads/palette.h index 75aff7a6ec..0d808ce218 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -250,7 +250,7 @@ public: warning("TODO: Palette::close"); } - void fadeOut(byte palette[PALETTE_SIZE], int v1, int v2, int v3, int v4, int v5, int v6); + void fadeOut(byte palette[PALETTE_SIZE], int start, int count, int v1, int v2, int v3, int v4, int v5, int v6); void lock(); void unlock(); -- cgit v1.2.3 From aedf8593034303066bf83d041f63731aa65a3ef6 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 22 Apr 2014 23:28:23 +0200 Subject: MADS: Fix compilation warning --- engines/mads/scene.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index e6888162d3..9d0332e600 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -275,7 +275,7 @@ void Scene::animatePalette() { if (_cyclingDelay >= _cyclingThreshold) { uint32 frameCounter = _vm->_events->getFrameCounter(); bool changesFlag = false; - for (int idx = 0; idx < _paletteCycles.size(); idx++) { + for (uint16 idx = 0; idx < _paletteCycles.size(); idx++) { if (frameCounter >= (_cycleTicks[idx] + _paletteCycles[idx]._ticks)) { _cycleTicks[idx] = frameCounter; int count = _paletteCycles[idx]._colorCount; -- cgit v1.2.3 From 3f1a49b567aac10fe8a195f7a2b8e07603470a72 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 22 Apr 2014 19:47:58 -0400 Subject: MADS: Implemented Conversation::read method --- engines/mads/nebular/nebular_scenes3.cpp | 19 ++++++++++--------- engines/mads/user_interface.cpp | 12 ++++++++++++ engines/mads/user_interface.h | 17 +++++++++++------ 3 files changed, 33 insertions(+), 15 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 15cd4822aa..f7c727bb39 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -821,9 +821,10 @@ void Scene307::step() { if (_prisonerMessageId > 0x10A) _prisonerMessageId = 0x104; } else if (_globals[kKnowsBuddyBeast] && (_vm->getRandomNumber(1, 3) == 1)) { - warning("TODO: if (_globals[kKnowsBuddyBeast] && (sub71C16(&dialog2, 0) > 1) && (_vm->getRandomNumber(1, 3) == 1)) {"); - int idx = _scene->_kernelMessages.add(Common::Point(5, 51), 0xFDFC, 0, 81, 120, _game.getQuote(267)); - _scene->_kernelMessages.setQuoted(idx, 4, true); + if (_globals[kKnowsBuddyBeast] && (dialog2.read(0) > 1) && (_vm->getRandomNumber(1, 3) == 1)) { + int idx = _scene->_kernelMessages.add(Common::Point(5, 51), 0xFDFC, 0, 81, 120, _game.getQuote(267)); + _scene->_kernelMessages.setQuoted(idx, 4, true); + } } _prisonerTimer = 0; } @@ -2333,13 +2334,13 @@ void Scene318::handleDialog() { case 0x195: handleInternDialog(0x1AF, 7, 9999999); - warning("TODO: if (!sub71C16(&_dialog1, 0x196))"); + if (!dialog1.read(0x196)) dialog1.write(0x197, true); break; case 0x196: handleInternDialog(0x1B6, 5, 9999999); - warning("TODO: if (!sub71C16(&_dialog1, 0x195))"); + if (!dialog1.read(0x195)) dialog1.write(0x197, true); break; @@ -2376,10 +2377,10 @@ void Scene318::handleDialog() { _dialogFl = false; handleInternDialog(0x1D0, 1, 120); - warning("TODO: if ((sub71C16(&_dialog1, 0) == 1) || (_action._activeAction._verbId == 0x19D)) {"); - _explosionFl = true; - _internCounter = 3420; - // } + if (dialog1.read(0) || (_action._activeAction._verbId == 0x19D)) { + _explosionFl = true; + _internCounter = 3420; + } break; } diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 346ad2d688..493804c923 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -258,6 +258,18 @@ void Conversation::set(int quoteId, ...) { va_end(va); } +bool Conversation::read(int quoteId) { + uint16 flags = _vm->_game->globals()[_globalId]; + + for (uint idx = 0; idx < _quotes.size(); ++idx) { + if (_quotes[idx] == quoteId) { + return flags & (1 << idx); + } + } + + return false; +} + void Conversation::write(int quoteId, bool flag) { for (uint idx = 0; idx < _quotes.size(); ++idx) { if (_quotes[idx] == quoteId) { diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h index a29a0e6de0..baae269c4f 100644 --- a/engines/mads/user_interface.h +++ b/engines/mads/user_interface.h @@ -104,18 +104,23 @@ public: Common::Array _quotes; /** - * Set up a conversation sequence - */ + * Set up a conversation sequence + */ void setup(int globalId, ...); /** - * Activates the passed set of quotes in the given conversation node - */ + * Activates the passed set of quotes in the given conversation node + */ void set(int quoteId, ...); /** - * Activates or deactivates the specified quote in the given conversation node - */ + * Returns true whether the given quote is enabled in the conversation + */ + bool read(int quoteId); + + /** + * Activates or deactivates the specified quote in the given conversation node + */ void write(int quoteId, bool flag); /** -- cgit v1.2.3 From 0e9e6cda40ee0bf739e6c7a6320a81307df7c8b9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 22 Apr 2014 23:00:41 -0400 Subject: MADS: Beginnings of savegame synchronisation --- engines/mads/action.cpp | 8 ++++ engines/mads/action.h | 3 ++ engines/mads/game.cpp | 34 +++++++++++---- engines/mads/game.h | 10 ++++- engines/mads/inventory.cpp | 63 +++++++++++++++++----------- engines/mads/inventory.h | 10 ++++- engines/mads/messages.cpp | 2 +- engines/mads/nebular/nebular_scenes2.cpp | 2 +- engines/mads/player.cpp | 72 +++++++++++++++++++++++++++++++- engines/mads/player.h | 9 +++- engines/mads/rails.cpp | 17 ++++++++ engines/mads/rails.h | 7 +++- engines/mads/scene.cpp | 5 +++ engines/mads/scene.h | 5 +++ 14 files changed, 204 insertions(+), 43 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index 9d496d5ebf..03c0c1ed8a 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -29,6 +29,14 @@ namespace MADS { +void ActionDetails::synchronize(Common::Serializer &s) { + s.syncAsUint16LE(_verbId); + s.syncAsUint16LE(_objectNameId); + s.syncAsUint16LE(_indirectObjectId); +} + +/*------------------------------------------------------------------------*/ + MADSAction::MADSAction(MADSEngine *vm) : _vm(vm) { clear(); _statusTextIndex = -1; diff --git a/engines/mads/action.h b/engines/mads/action.h index 599fb0e4f9..c588a42324 100644 --- a/engines/mads/action.h +++ b/engines/mads/action.h @@ -24,6 +24,7 @@ #define MADS_ACTION_H #include "common/scummsys.h" +#include "common/serializer.h" #include "common/str.h" namespace MADS { @@ -76,6 +77,8 @@ struct ActionDetails { int _verbId; int _objectNameId; int _indirectObjectId; + + void synchronize(Common::Serializer &s); }; struct ActionSavedFields { diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index d3e3987d4e..3b591d7a9e 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -22,6 +22,7 @@ #include "common/scummsys.h" #include "common/memstream.h" +#include "common/serializer.h" #include "mads/mads.h" #include "mads/compression.h" #include "mads/game.h" @@ -45,7 +46,7 @@ Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm), _scene(vm), _screenObjects(vm), _player(vm) { _sectionNumber = _priorSectionNumber = 0; _difficulty = DIFFICULTY_HARD; - _saveSlot = -1; + _serializer = nullptr; _statusFlag = 0; _sectionHandler = nullptr; _sectionNumber = 1; @@ -86,7 +87,6 @@ void Game::run() { case PROTECTION_FAIL: // Copy protection failed _scene._nextSceneId = 804; - _saveSlot = -1; break; case PROTECTION_ESCAPE: // User escaped out of copy protection dialog @@ -102,7 +102,7 @@ void Game::run() { // Get the initial starting time for the first scene _scene._frameStartTime = _vm->_events->getFrameCounter(); - if (_saveSlot == -1 && protectionResult != -1 && protectionResult != -2) { + if (_serializer == nullptr && protectionResult != -1 && protectionResult != -2) { initSection(_sectionNumber); _statusFlag = true; @@ -118,11 +118,6 @@ void Game::run() { if (protectionResult != 1 && protectionResult != 2) { initialiseGlobals(); - - if (_saveSlot != -1) { - warning("TODO: loadGame(\"REX.SAV\", 210)"); - _statusFlag = false; - } } if (_statusFlag) @@ -131,6 +126,9 @@ void Game::run() { void Game::gameLoop() { while (!_vm->shouldQuit() && _statusFlag) { + if (_serializer) + synchronize(*_serializer, true); + setSectionHandler(); _sectionHandler->preLoadSection(); initSection(_sectionNumber); @@ -248,7 +246,7 @@ void Game::sectionLoop() { _player.selectSeries(); _player.updateFrame(); - _player._visible3 = _player._visible; + _player._beenVisible = _player._visible; _player._special = _scene.getDepthHighBits(_player._playerPos); _player._priorTimer = _scene._frameStartTime - _player._ticksAmount; _player.idle(); @@ -402,4 +400,22 @@ void Game::handleKeypress(const Common::Event &event) { warning("TODO: handleKeypress - %d", (int)event.kbd.keycode); } +void Game::synchronize(Common::Serializer &s, bool phase1) { + if (phase1) { + s.syncAsUint16LE(_scene._nextSceneId); + s.syncAsUint16LE(_scene._priorSceneId); + + if (s.isLoading()) { + _sectionNumber = _scene._nextSceneId / 100; + _currentSectionNumber = _sectionNumber; + } + } else { + s.syncAsByte(_difficulty); + + _scene.synchronize(s); + _objects.synchronize(s); + _player.synchronize(s); + } +} + } // End of namespace MADS diff --git a/engines/mads/game.h b/engines/mads/game.h index 5bb7b31973..ad40fbdcc0 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -25,6 +25,7 @@ #include "common/scummsys.h" #include "common/str-array.h" +#include "common/serializer.h" #include "mads/scene.h" #include "mads/game_data.h" #include "mads/globals.h" @@ -72,12 +73,12 @@ private: protected: MADSEngine *_vm; MSurface *_surface; - int _saveSlot; int _statusFlag; Common::StringArray _quotes; bool _quoteEmergency; bool _vocabEmergency; bool _anyEmergency; + Common::Serializer *_serializer; /** * Constructor @@ -170,6 +171,13 @@ public: */ virtual void step() = 0; + /** + * Synchronise the game data + * @param s Serializer + * @param phase1 If true, it's synchronising the basic scene information + */ + virtual void synchronize(Common::Serializer &s, bool phase1); + // DEPRECATED: ScummVM re-implementation keeps all the quotes loaded, so the methods below are stubs void clearQuotes() {} void loadQuoteRange(int startNum, int endNum) {} diff --git a/engines/mads/inventory.cpp b/engines/mads/inventory.cpp index bb65430bb1..abd281dcc8 100644 --- a/engines/mads/inventory.cpp +++ b/engines/mads/inventory.cpp @@ -26,42 +26,57 @@ namespace MADS { -void InventoryObject::load(Common::SeekableReadStream &f) { - _descId = f.readUint16LE(); - _roomNumber = f.readUint16LE(); - _article = f.readByte(); - _vocabCount = f.readByte(); +void InventoryObject::synchronize(Common::Serializer &s) { + s.syncAsUint16LE(_descId); + s.syncAsUint16LE(_roomNumber); + s.syncAsByte(_article); + s.syncAsByte(_vocabCount); for (int i = 0; i < 3; ++i) { - _vocabList[i]._verbType = (VerbType)f.readByte(); - _vocabList[i]._prepType = (PrepType)f.readByte(); - _vocabList[i]._vocabId = f.readUint16LE(); + s.syncAsByte(_vocabList[i]._verbType); + s.syncAsByte(_vocabList[i]._prepType); + s.syncAsUint16LE( _vocabList[i]._vocabId); } - f.skip(4); // field12 - f.read(&_mutilateString[0], 10); - f.skip(16); + s.skip(4); // field12 + s.syncBytes((byte *)&_mutilateString[0], 10); + s.skip(16); } /*------------------------------------------------------------------------*/ void InventoryObjects::load() { File f("*OBJECTS.DAT"); + Common::Serializer s(&f, nullptr); - // Get the total numer of inventory objects - int count = f.readUint16LE(); - reserve(count); - - // Read in each object - for (int i = 0; i < count; ++i) { - InventoryObject obj; - obj.load(f); - push_back(obj); + // Load the objects data + synchronize(s); +} - // If it's for the player's inventory, add the index to the inventory list - if (obj._roomNumber == PLAYER_INVENTORY) { - _inventoryList.push_back(i); - assert(_inventoryList.size() <= 32); +void InventoryObjects::synchronize(Common::Serializer &s) { + int count = size(); + s.syncAsUint16LE(count); + + if (s.isSaving()) { + // Store the data for each object in the inventory lsit + for (int idx = 0; idx < count; ++idx) + (*this)[idx].synchronize(s); + } else { + clear(); + _inventoryList.clear(); + reserve(count); + + // Read in each object + for (int i = 0; i < count; ++i) { + InventoryObject obj; + obj.synchronize(s); + push_back(obj); + + // If it's for the player's inventory, add the index to the inventory list + if (obj._roomNumber == PLAYER_INVENTORY) { + _inventoryList.push_back(i); + assert(_inventoryList.size() <= 32); + } } } } diff --git a/engines/mads/inventory.h b/engines/mads/inventory.h index 5c2f925e57..5e3ecd6a69 100644 --- a/engines/mads/inventory.h +++ b/engines/mads/inventory.h @@ -25,6 +25,7 @@ #include "common/scummsys.h" #include "common/array.h" +#include "common/serializer.h" namespace MADS { @@ -49,9 +50,9 @@ public: const byte *_objFolder; // ??? /** - * Loads the data for a given object + * Synchronizes the data for a given object */ - void load(Common::SeekableReadStream &f); + void synchronize(Common::Serializer &s); }; class InventoryObjects: public Common::Array { @@ -71,6 +72,11 @@ public: */ void load(); + /** + * Synchronize the objects list in a savegame + */ + void synchronize(Common::Serializer &s); + /** * Returns the inventory item from the player's inventory */ diff --git a/engines/mads/messages.cpp b/engines/mads/messages.cpp index 46b05c1413..2f59a67359 100644 --- a/engines/mads/messages.cpp +++ b/engines/mads/messages.cpp @@ -203,7 +203,7 @@ void KernelMessages::processText(int msgIndex) { Player &player = _vm->_game->_player; if (msg._flags & KMSG_PLAYER_TIMEOUT) { - if (player._visible3) { + if (player._beenVisible) { SpriteAsset &asset = *_vm->_game->_scene._sprites[player._spritesStart + player._spritesIdx]; MSprite *frame = asset.getFrame(player._frameNumber - 1); diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 5054fbef0d..7491ed1479 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -339,7 +339,7 @@ void Scene202::setup() { } void Scene202::enter() { - _game._player._visible3 = true; + _game._player._beenVisible = true; _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('b', 0)); _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('b', 1)); _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('b', 2)); diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index cc482c0608..3b727b397e 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -48,7 +48,7 @@ Player::Player(MADSEngine *vm): _vm(vm) { _priorVisible = false; _needToWalk = false; _readyToWalk = false; - _visible3 = false; + _beenVisible = false; _loadsFirst = false; _loadedFirst = false; _walkAnywhere = false; @@ -337,7 +337,7 @@ void Player::update() { } } - _visible3 = _visible; + _beenVisible |= _visible; _priorVisible = _visible; _forceRefresh = false; } @@ -691,4 +691,72 @@ void Player::releasePlayerSprites() { _spritesChanged = true; } +void Player::synchronize(Common::Serializer &s) { + s.syncAsByte(_visible); + s.syncAsByte(_priorVisible); + s.syncAsByte(_beenVisible); + s.syncAsByte(_moving); + s.syncAsByte(_stepEnabled); + s.syncAsSint16LE(_playerPos.x); + s.syncAsSint16LE(_playerPos.y); + s.syncAsSint16LE(_targetPos.x); + s.syncAsSint16LE(_targetPos.y); + s.syncAsSint16LE(_posChange.x); + s.syncAsSint16LE(_posChange.y); + s.syncAsSint16LE(_posDiff.x); + s.syncAsSint16LE(_posDiff.y); + s.syncAsSint16LE(_xDirection); + s.syncAsSint16LE(_yDirection); + s.syncAsUint16LE(_facing); + s.syncAsUint16LE(_targetFacing); + s.syncAsByte(_spritesChanged); + s.syncAsByte(_walkAnywhere); + s.syncAsByte(_walkOffScreen); + s.syncAsSint16LE(_ticksAmount); + s.syncAsSint16LE(_centerOfGravity); + s.syncAsUint16LE(_walkOffScreenSceneId); + s.syncAsByte(_needToWalk); + s.syncAsByte(_readyToWalk); + s.syncAsUint16LE(_prepareWalkFacing); + s.syncAsSint16LE(_prepareWalkPos.x); + s.syncAsSint16LE(_prepareWalkPos.y); + + s.syncAsByte(_mirror); + s.syncAsUint16LE(_frameCount); + s.syncAsSint16LE(_frameListIndex); + s.syncAsSint16LE(_distAccum); + s.syncAsSint16LE(_pixelAccum); + s.syncAsSint16LE(_deltaDistance); + + for (int i = 0; i < 12; ++i) { + s.syncAsSint16LE(_stopWalkerList[i]); + s.syncAsSint16LE(_stopWalkerTrigger[i]); + } + s.syncAsSint16LE(_stopWalkerIndex); + s.syncAsSint16LE(_totalDistance); + s.syncAsSint16LE(_frameNumber); + s.syncAsSint16LE(_special); + s.syncAsSint16LE(_velocity); + s.syncAsSint16LE(_scalingVelocity); + s.syncAsSint16LE(_upcomingTrigger); + s.syncAsSint16LE(_trigger); + s.syncAsSint16LE(_currentDepth); + s.syncAsSint16LE(_currentScale); + + int count; + char ch; + if (s.isSaving()) { + count = _spritesPrefix.size(); + s.syncAsUint16LE(count); + s.syncBytes((byte *)_spritesPrefix.c_str(), count); + } else { + s.syncAsSint16LE(count); + _spritesPrefix.clear(); + for (int i = 0; i < count; ++i) { + s.syncAsByte(ch); + _spritesPrefix += ch; + } + } +} + } // End of namespace MADS diff --git a/engines/mads/player.h b/engines/mads/player.h index 6df1159ad4..97fc3e75cd 100644 --- a/engines/mads/player.h +++ b/engines/mads/player.h @@ -25,6 +25,7 @@ #include "common/scummsys.h" #include "common/str.h" +#include "common/serializer.h" namespace MADS { @@ -110,7 +111,7 @@ public: bool _spritesChanged; bool _visible; bool _priorVisible; - bool _visible3; + bool _beenVisible; bool _walkAnywhere; int _frameNumber; bool _loadsFirst; @@ -122,7 +123,6 @@ public: Common::Point _prepareWalkPos; bool _moving; int _walkOffScreen, _walkOffScreenSceneId; - int _next; int _special; int _ticksAmount; uint32 _priorTimer; @@ -211,6 +211,11 @@ public: */ void releasePlayerSprites(); + /** + * Serialize the data of the player + */ + void synchronize(Common::Serializer &s); + static void preloadSequences(const Common::String &prefix, int level) { // No implementation in ScummVM } diff --git a/engines/mads/rails.cpp b/engines/mads/rails.cpp index 105a85366a..00f7f4cdbc 100644 --- a/engines/mads/rails.cpp +++ b/engines/mads/rails.cpp @@ -263,5 +263,22 @@ int Rails::getRouteFlags(const Common::Point &src, const Common::Point &dest) { return result; } +void Rails::synchronize(Common::Serializer &s) { + s.syncAsSint16LE(_routeLength); + s.syncAsSint16LE(_next); + + int count = _routeIndexes.size(); + if (s.isSaving()) { + for (int i = 0; i < count; ++i) + s.syncAsUint16LE(_routeIndexes[i]); + } else { + _routeIndexes.clear(); + for (int i = 0; i < count; ++i) { + int v = 0; + s.syncAsUint16LE(v); + _routeIndexes.push(v); + } + } +} } // End of namespace MADS diff --git a/engines/mads/rails.h b/engines/mads/rails.h index 6338aeab97..4014491e25 100644 --- a/engines/mads/rails.h +++ b/engines/mads/rails.h @@ -26,6 +26,7 @@ #include "common/scummsys.h" #include "common/array.h" #include "common/rect.h" +#include "common/serializer.h" #include "common/stack.h" #include "mads/msurface.h" @@ -60,7 +61,6 @@ private: int _depthStyle; int _routeLength; int _next; - int _routeOffset; int _tempRoute[MAX_ROUTE_NODES]; Common::Stack _routeIndexes; private: @@ -122,6 +122,11 @@ public: void resetNext() { _next = 0; } int getNext() { return _next; } + + /** + * Synchronize the data for the route + */ + void synchronize(Common::Serializer &s); }; } // End of namespace MADS diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 9d0332e600..239a91c585 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -681,4 +681,9 @@ void Scene::freeAnimation() { _freeAnimationFlag = false; } +void Scene::synchronize(Common::Serializer &s) { + _action._activeAction.synchronize(s); + _rails.synchronize(s); +} + } // End of namespace MADS diff --git a/engines/mads/scene.h b/engines/mads/scene.h index eb84fbd814..48b01b2acb 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -233,6 +233,11 @@ public: * Frees any currently active animation for the scene */ void freeAnimation(); + + /** + * Synchronise the game + */ + void synchronize(Common::Serializer &s); }; } // End of namespace MADS -- cgit v1.2.3 From ee1a33946fb8f7b61d37e15285e1c5f21f012aa0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 23 Apr 2014 23:42:48 +0200 Subject: MADS: Implement scene 320 --- engines/mads/nebular/nebular_scenes.cpp | 2 + engines/mads/nebular/nebular_scenes3.cpp | 316 ++++++++++++++++++++++++++++++- engines/mads/nebular/nebular_scenes3.h | 27 +++ 3 files changed, 341 insertions(+), 4 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 2c16fdb52e..32d567a6a5 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -129,6 +129,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene318(vm); case 319: return new Scene319(vm); + case 320: + return new Scene320(vm); // Scene group #8 case 804: diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index f7c727bb39..4ca5a6c5b4 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -2918,8 +2918,8 @@ void Scene319::enter() { _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 14); - _globals._sequenceIndexes[0] = _scene->_sequences.startCycle (_globals._spriteIndexes[0], false, 1); - _globals._sequenceIndexes[1] = _scene->_sequences.startCycle (_globals._spriteIndexes[1], false, 1); + _globals._sequenceIndexes[0] = _scene->_sequences.startCycle(_globals._spriteIndexes[0], false, 1); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); _dialog1.setup(0x43, 0x165, 0x166, 0x167, 0x168, 0x169, 0x16A, 0); _dialog2.setup(0x44, 0x171, 0x172, 0x173, 0x174, 0x175, 0x176, 0); @@ -3165,7 +3165,7 @@ void Scene319::step() { for (int i = 0; i <= 1; i++) { int oldIdx = _globals._sequenceIndexes[i]; _scene->_sequences.remove(_globals._sequenceIndexes[i]); - _globals._sequenceIndexes[i] = _scene->_sequences.startCycle (_globals._spriteIndexes[i], false, 1); + _globals._sequenceIndexes[i] = _scene->_sequences.startCycle(_globals._spriteIndexes[i], false, 1); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[i], oldIdx); } break; @@ -3298,7 +3298,7 @@ void Scene319::actions() { } else { Conversation *curDialog; int nextDocQuote; - if ((_action._activeAction._verbId == 0x168) || (_action._activeAction._verbId == 0x169) || (_action._activeAction._verbId == 0x167)) { + if ((_action._activeAction._verbId == 0x168) || (_action._activeAction._verbId == 0x169) || (_action._activeAction._verbId == 0x167)) { curDialog = &_dialog1; nextDocQuote = 0x163; } else if ((_action._activeAction._verbId == 0x174) || (_action._activeAction._verbId == 0x175) || (_action._activeAction._verbId == 0x173)) { @@ -3331,5 +3331,313 @@ void Scene319::actions() { /*------------------------------------------------------------------------*/ +void Scene320::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene320::setRightView(int view) { + if (_rightItemId < 8) _scene->_sequences.remove(_globals._sequenceIndexes[10]); + + int spriteNum; + switch (view) { + case 0: + spriteNum = 16; + break; + + case 1: + spriteNum = 14; + break; + + case 2: + spriteNum = 17; + break; + + case 3: + spriteNum = 15; + break; + + default: + spriteNum = view + 6; + break; + } + + if (view != 8) { + _globals._sequenceIndexes[10] = _scene->_sequences.startCycle(_globals._spriteIndexes[spriteNum], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 0); + } + + _globals[kRightView320] = _rightItemId = view; +} + +void Scene320::setLeftView(int view) { + if (_leftItemId < 10) + _scene->_sequences.remove(_globals._sequenceIndexes[0]); + + if (view != 10) { + _globals._sequenceIndexes[0] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[view], false, 6, 0, 0, 18); + _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 0); + if (!_blinkFl) + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[0], 2, 2); + } + + _leftItemId = view; +} + +void Scene320::handleButtons() { + switch(_action._activeAction._objectNameId) { + case 0x2DD: + _buttonId = 5; + break; + + case 0x2DE: + _buttonId = 4; + break; + + case 0x2E0: + _buttonId = 6; + break; + + case 0x2E1: + _buttonId = 7; + break; + + case 0x2E2: + _buttonId = 8; + break; + + case 0x2E3: + _buttonId = 9; + break; + + case 0x2E4: + _buttonId = 10; + break; + + case 0x2E5: + _buttonId = 11; + break; + + case 0x2E6: + _buttonId = 12; + break; + + case 0x2E7: + _buttonId = 13; + break; + + case 0x2E8: + _buttonId = 0; + break; + + case 0x2E9: + _buttonId = 1; + break; + + case 0x2EA: + _buttonId = 2; + break; + + case 0x2EB: + _buttonId = 3; + break; + + default: + break; + } + + if (_buttonId <= 3) { + _posX = (8 * _buttonId) - 2; + _flippedFl = true; + } else if (_buttonId <= 5) { + _posX = (13 * _buttonId) - 14; + _flippedFl = true; + } else { + _posX = (8 * _buttonId) + 98; + _flippedFl = false; + } +} + +void Scene320::enter() { + _blinkFl = true; + _rightItemId = 8; + _leftItemId = 10; + _lastFrame = 0; + + for (int i = 0; i < 10; i++) + _globals._spriteIndexes[i] = _scene->_sprites.addSprites(formAnimName('M', i)); + + for (int i = 0; i < 8; i++) + _globals._spriteIndexes[10 + i] = _scene->_sprites.addSprites(formAnimName('N', i)); + + _globals._spriteIndexes[18] = _scene->_sprites.addSprites("*REXHAND"); + _game._player._visible = false; + + setRightView(_globals[kRightView320]); + setLeftView(0); + + _vm->_palette->setEntry(252, 63, 30, 20); + _vm->_palette->setEntry(253, 45, 15, 10); + + sceneEntrySound(); +} + +void Scene320::step() { + if (_scene->_activeAnimation != nullptr) { + if (_lastFrame != _scene->_activeAnimation->getCurrentFrame()) { + _lastFrame = _scene->_activeAnimation->getCurrentFrame(); + switch (_lastFrame) { + case 95: + _blinkFl = true; + setLeftView(9); + _vm->_sound->command(41); + break; + + case 139: + _blinkFl = false; + setLeftView(9); + break; + + case 191: + _scene->_kernelMessages.add(Common::Point(1, 1), 0xFDFC, 0, 0, 60, _game.getQuote(0xFE)); + break; + + case 417: + case 457: + warning("TODO: shake_countdown = 40;"); + _vm->_sound->command(59); + break; + + case 430: + _blinkFl = true; + setLeftView(4); + break; + + default: + break; + } + } + } + + if (_game._trigger == 70) { + _globals[kAfterHavoc] = true; + _globals[kTeleporterRoom + 1] = 351; + _scene->_nextSceneId = 361; + } +} + +void Scene320::actions() { + if (_action._lookFlag) + _vm->_dialogs->show(0x7D0B); + else if ((_action.isAction(0x11A) || _action.isAction(VERB_PUSH)) && + (_action.isAction(0x2E8) || _action.isAction(0x2E9) || _action.isAction(0x2EA) || _action.isAction(0x2EB) || + _action.isAction(0x2DE) || _action.isAction(0x2DD) || _action.isAction(0x2E0) || _action.isAction(0x2E1) || + _action.isAction(0x2E2) || _action.isAction(0x2E3) || _action.isAction(0x2E4) || _action.isAction(0x2E5) || + _action.isAction(0x2E6) || _action.isAction(0x2E7) + )) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + handleButtons(); + _globals._sequenceIndexes[18] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[18], _flippedFl, 4, 2, 0, 0); + _scene->_sequences.setScale(_globals._sequenceIndexes[18], 60); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[18], Common::Point(_posX, 170)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[18], 0); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[18], SEQUENCE_TRIGGER_LOOP, 0, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[18], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + + case 1: + if (_buttonId >= 6) { + _vm->_sound->command(60); + setRightView(_buttonId - 6); + } + if (_buttonId == 4) { + _vm->_sound->command(38); + if (_leftItemId == 3) + setLeftView(0); + else + setLeftView(3); + } + if (_buttonId == 5) { + _vm->_sound->command(38); + if (_leftItemId == 1) + setLeftView(2); + else + setLeftView(1); + } + if (_buttonId <= 3) { + _vm->_sound->command(60); + setLeftView(_buttonId + 5); + } + break; + + case 2: + _game._player._stepEnabled = true; + if (_buttonId == 5) { + if (_leftItemId == 2) { + _game._player._stepEnabled = false; + setRightView(8); + setLeftView(10); + _scene->_kernelMessages.reset(); + _scene->resetScene(); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('m', 2)); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('m', 4)); + _globals._spriteIndexes[9] = _scene->_sprites.addSprites(formAnimName('m', 9)); + _blinkFl = false; + setLeftView(2); + _game.loadQuoteSet(0xFE, 0); + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->loadAnimation(formAnimName('a', -1), 70); + _vm->_sound->command(17); + } + } + break; + + default: + break; + } + } else if (_action.isAction(0x1CD, 0x2EF)) + _scene->_nextSceneId = 311; + else if (_action.isAction(VERB_LOOK, 0x2DC)) + _vm->_dialogs->show(0x7D01); + else if (_action.isAction(VERB_LOOK, 0x2DB)) + _vm->_dialogs->show(0x7D02); + else if (_action.isAction(VERB_LOOK, 0x1E4)) + _vm->_dialogs->show(0x7D03); + else if (_action.isAction(VERB_LOOK, 0x2EF)) + _vm->_dialogs->show(0x7D04); + else if (_action.isAction(VERB_LOOK, 0x2ED)) + _vm->_dialogs->show(0x7D05); + else if (_action.isAction(VERB_LOOK, 0x2EE)) + _vm->_dialogs->show(0x7D06); + else if (_action.isAction(VERB_LOOK, 0x2F1)) + _vm->_dialogs->show(0x7D06); + else if (_action.isAction(VERB_LOOK, 0x2F3)) + _vm->_dialogs->show(0x7D08); + else if (_action.isAction(VERB_LOOK, 0x2F0)) + _vm->_dialogs->show(0x7D09); + else if (_action.isAction(VERB_LOOK, 0x2F2)) + _vm->_dialogs->show(0x7D0A); + else if (_action.isAction(VERB_TAKE, 0x2ED)) + _vm->_dialogs->show(0x7D0C); + else if (_action.isAction(VERB_TAKE, 0x2F2)) + _vm->_dialogs->show(0x7D0D); + else if (_action.isAction(VERB_TAKE, 0x2EE) || _action.isAction(0x75, 0x2EE)) + _vm->_dialogs->show(0x7D0E); + else if (_action.isAction(VERB_TAKE, 0x2F3)) + _vm->_dialogs->show(0x7D0F); + else if (_action.isAction(VERB_TAKE, 0x2F1)) + _vm->_dialogs->show(0x7D10); + else if (_action.isAction(VERB_TAKE, 0x2F0)) + _vm->_dialogs->show(0x7D11); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h index b284a2ef9b..79ffa316f2 100644 --- a/engines/mads/nebular/nebular_scenes3.h +++ b/engines/mads/nebular/nebular_scenes3.h @@ -310,6 +310,33 @@ public: virtual void actions(); virtual void postActions() {}; }; + +class Scene320: public Scene3xx { +private: + void setRightView(int view); + void setLeftView(int view); + void handleButtons(); + + bool _blinkFl; + bool _flippedFl; + + int _buttonId; + int _lastFrame; + int _leftItemId; + int _posX; + int _rightItemId; + +public: + Scene320(MADSEngine *vm) : Scene3xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions(); + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From c1a90cdda1f1424cb9b6b2e91b82c47cf0913335 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 23 Apr 2014 21:01:48 -0400 Subject: MADS: Further synchronization implementation --- engines/mads/game.cpp | 1 + engines/mads/globals.cpp | 23 +++++++++++++++++++++-- engines/mads/globals.h | 10 ++++++++-- engines/mads/nebular/game_nebular.cpp | 8 ++++++++ engines/mads/nebular/game_nebular.h | 2 ++ engines/mads/nebular/globals_nebular.cpp | 2 +- engines/mads/scene.cpp | 1 + engines/mads/user_interface.cpp | 8 ++++++++ engines/mads/user_interface.h | 5 +++++ 9 files changed, 55 insertions(+), 5 deletions(-) diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 3b591d7a9e..462c6401a9 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -408,6 +408,7 @@ void Game::synchronize(Common::Serializer &s, bool phase1) { if (s.isLoading()) { _sectionNumber = _scene._nextSceneId / 100; _currentSectionNumber = _sectionNumber; + _scene._frameStartTime = _vm->_events->getFrameCounter(); } } else { s.syncAsByte(_difficulty); diff --git a/engines/mads/globals.cpp b/engines/mads/globals.cpp index 68a2cf1970..de15ba9595 100644 --- a/engines/mads/globals.cpp +++ b/engines/mads/globals.cpp @@ -26,8 +26,27 @@ namespace MADS { void Globals::reset() { - for (uint i = 0; i < _flags.size(); ++i) - _flags[i] = 0; + for (uint i = 0; i < _data.size(); ++i) + _data[i] = 0; +} + +void Globals::synchronize(Common::Serializer &s) { + int count = 0; + int16 v; + s.syncAsUint16LE(count); + + if (s.isSaving()) { + for (int idx = 0; idx < count; ++idx) { + v = _data[idx]; + s.syncAsSint16LE(v); + } + } else { + _data.clear(); + for (int idx = 0; idx < count; ++idx) { + s.syncAsSint16LE(v); + _data.push_back(v); + } + } } diff --git a/engines/mads/globals.h b/engines/mads/globals.h index ea327b0045..fa7a630f7f 100644 --- a/engines/mads/globals.h +++ b/engines/mads/globals.h @@ -25,24 +25,30 @@ #include "common/scummsys.h" #include "common/array.h" +#include "common/serializer.h" namespace MADS { class Globals { protected: - Common::Array _flags; + Common::Array _data; public: Globals() {} /** * Square brackets operator for accessing flags */ - int16 &operator[](int idx) { return _flags[idx]; } + int16 &operator[](int idx) { return _data[idx]; } /* * Resets all the globals to empty */ void reset(); + + /** + * Synchronize the globals data + */ + void synchronize(Common::Serializer &s); }; } // End of namespace MADS diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index 23c8b3cdd6..34eb6f140c 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -744,6 +744,14 @@ void GameNebular::step() { } } +void GameNebular::synchronize(Common::Serializer &s, bool phase1) { + Game::synchronize(s, phase1); + + if (!phase1) { + _globals.synchronize(s); + } +} + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/game_nebular.h b/engines/mads/nebular/game_nebular.h index 7d64e3e49f..0e2d564236 100644 --- a/engines/mads/nebular/game_nebular.h +++ b/engines/mads/nebular/game_nebular.h @@ -73,6 +73,8 @@ public: virtual void unhandledAction(); virtual void step(); + + virtual void synchronize(Common::Serializer &s, bool phase1); }; diff --git a/engines/mads/nebular/globals_nebular.cpp b/engines/mads/nebular/globals_nebular.cpp index 3e9a9f7e2f..a8b7cdce72 100644 --- a/engines/mads/nebular/globals_nebular.cpp +++ b/engines/mads/nebular/globals_nebular.cpp @@ -30,7 +30,7 @@ namespace Nebular { NebularGlobals::NebularGlobals(): Globals() { // Initialize lists - _flags.resize(210); + _data.resize(210); _spriteIndexes.resize(30); _sequenceIndexes.resize(30); diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 239a91c585..24218479ce 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -684,6 +684,7 @@ void Scene::freeAnimation() { void Scene::synchronize(Common::Serializer &s) { _action._activeAction.synchronize(s); _rails.synchronize(s); + _userInterface.synchronize(s); } } // End of namespace MADS diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 493804c923..9a63ac32ad 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -1079,4 +1079,12 @@ void UserInterface::scrollInventory() { _vm->_game->_screenObjects._v8332A = 0; } +void UserInterface::synchronize(Common::Serializer &s) { + InventoryObjects &invObjects = _vm->_game->_objects; + + if (s.isLoading()) { + _selectedInvIndex = invObjects._inventoryList.empty() ? -1 : 0; + } +} + } // End of namespace MADS diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h index baae269c4f..1e07681a6f 100644 --- a/engines/mads/user_interface.h +++ b/engines/mads/user_interface.h @@ -293,6 +293,11 @@ public: * Add a msesage to the list of conversation items to select from */ void addConversationMessage(int vocabId, const Common::String &msg); + + /** + * Synchronize the data + */ + void synchronize(Common::Serializer &s); }; } // End of namespace MADS -- cgit v1.2.3 From 1495f04bbcbe26bb3f2b93131e3d89c30ea47279 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 23 Apr 2014 21:57:25 -0400 Subject: MADS: Fix scenes previously using globals to properly use locals --- engines/mads/game.cpp | 3 + engines/mads/nebular/globals_nebular.cpp | 14 --- engines/mads/nebular/globals_nebular.h | 2 + engines/mads/nebular/nebular_scenes1.cpp | 10 +- engines/mads/nebular/nebular_scenes1.h | 3 + engines/mads/nebular/nebular_scenes2.cpp | 35 +++--- engines/mads/nebular/nebular_scenes2.h | 3 +- engines/mads/nebular/nebular_scenes3.cpp | 6 +- engines/mads/nebular/nebular_scenes8.cpp | 191 +++++++++++++++++-------------- engines/mads/nebular/nebular_scenes8.h | 10 ++ 10 files changed, 153 insertions(+), 124 deletions(-) diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 462c6401a9..9c124aa6a6 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -409,6 +409,9 @@ void Game::synchronize(Common::Serializer &s, bool phase1) { _sectionNumber = _scene._nextSceneId / 100; _currentSectionNumber = _sectionNumber; _scene._frameStartTime = _vm->_events->getFrameCounter(); + + _player._spritesLoaded = false; + _player._spritesChanged = true; } } else { s.syncAsByte(_difficulty); diff --git a/engines/mads/nebular/globals_nebular.cpp b/engines/mads/nebular/globals_nebular.cpp index a8b7cdce72..4144797abc 100644 --- a/engines/mads/nebular/globals_nebular.cpp +++ b/engines/mads/nebular/globals_nebular.cpp @@ -37,20 +37,6 @@ NebularGlobals::NebularGlobals(): Globals() { // Initialize game flags _timebombClock = 0; _timebombTimer = 0; - _v0 = 0; - _frameTime = 0; - _v2 = 0; - _v3 = 0; - _v4 = 0; - _v5 = 0; - _v6 = 0; - _v7 = 0; - _v8 = 0; - _abortVal = 0; - _v84262 = 0; - _v84264 = 0; - _v84266 = 0; - _v84268 = 0; } } // End of namespace Nebular diff --git a/engines/mads/nebular/globals_nebular.h b/engines/mads/nebular/globals_nebular.h index b8fe17f333..56fbc1b4ca 100644 --- a/engines/mads/nebular/globals_nebular.h +++ b/engines/mads/nebular/globals_nebular.h @@ -285,6 +285,7 @@ public: Common::Array _sequenceIndexes; int _timebombClock, _timebombTimer; + /* int _v0; uint32 _frameTime; int _v2; @@ -296,6 +297,7 @@ public: int _v8; int _abortVal; int _v84262, _v84264, _v84266, _v84268; + */ public: /** * Constructor diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 2440068698..da2d358458 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -1267,8 +1267,8 @@ void Scene103::enter() { _vm->_palette->setEntry(252, 63, 63, 10); _vm->_palette->setEntry(253, 45, 45, 10); - _globals._v0 = 0; - _globals._frameTime = _scene->_frameStartTime; + _sayHiToBinky = false; + _updateClock = _scene->_frameStartTime; } void Scene103::step() { @@ -1296,7 +1296,7 @@ void Scene103::step() { break; } - if (_globals._frameTime <= _scene->_frameStartTime) { + if (_scene->_frameStartTime >= _updateClock) { pt = _vm->_game->_player._playerPos; dist = _vm->hypotenuse(pt.x - 79, pt.y - 137); _vm->_sound->command(29, (dist * -127 / 378) + 127); @@ -1309,7 +1309,7 @@ void Scene103::step() { dist = _vm->hypotenuse(pt.x - 266, pt.y - 138); _vm->_sound->command(32, (dist * -127 / 378) + 127); - _globals._frameTime = _scene->_frameStartTime + _vm->_game->_player._ticksAmount; + _updateClock = _scene->_frameStartTime + _vm->_game->_player._ticksAmount; } } @@ -1438,7 +1438,7 @@ void Scene103::actions() { case 1: { Common::String msg = _game.getQuote(72); _scene->_kernelMessages.add(Common::Point(310, 132), 0xFDFC, 16, 2, 120, msg); - _globals._v0 = 0; + _sayHiToBinky = false; break; } diff --git a/engines/mads/nebular/nebular_scenes1.h b/engines/mads/nebular/nebular_scenes1.h index b4585b0ed3..d295c4d727 100644 --- a/engines/mads/nebular/nebular_scenes1.h +++ b/engines/mads/nebular/nebular_scenes1.h @@ -102,6 +102,9 @@ public: }; class Scene103 : public Scene1xx { +private: + bool _sayHiToBinky; + uint32 _updateClock; public: Scene103(MADSEngine *vm) : Scene1xx(vm) {} diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 7491ed1479..88b3f941ea 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -449,7 +449,8 @@ void Scene202::enter() { _game._player._playerPos = Common::Point(246, 124); _game._player._facing = FACING_NORTH; } - _globals._abortVal = 0; + + _meteorologistSpecial = 0; } void Scene202::setRandomKernelMessage() { @@ -493,7 +494,7 @@ void Scene202::step() { _action._activeAction._indirectObjectId = 438; _game._triggerSetupMode = SEQUENCE_TRIGGER_PARSER; _scene->_sequences.addTimer(120, 2); - _globals._abortVal = -1; + _meteorologistSpecial = -1; } else if (_globals[kMeteorologistWatch] == 2) { _scene->_sequences.addTimer(120, 90); } @@ -849,7 +850,7 @@ void Scene202::actions() { } break; case 2: - if (!_scene->_activeAnimation && (_globals._abortVal == 0)) { + if (!_scene->_activeAnimation && !_meteorologistSpecial) { _vm->_dialogs->show(0x4EFE); } _scene->_sequences.remove(_globals._sequenceIndexes[10]); @@ -905,7 +906,7 @@ void Scene202::actions() { case 2: if (!_scene->_activeAnimation) _vm->_dialogs->show(0x4EFE); - _globals._abortVal = 0; + _meteorologistSpecial = 0; _scene->_sequences.remove(_globals._sequenceIndexes[10]); _globals._sequenceIndexes[9] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[9], false, 6, 1, 0, 0); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[9], Common::Point(247, 82)); @@ -1136,7 +1137,7 @@ void Scene205::enter() { _scene->_hotspots.activate(450, false); } - _globals._frameTime &= 0xFFFF; + _beingKicked = false; _game.loadQuoteSet(0x6B, 0x70, 0x71, 0x72, 0x5A, 0x74, 0x75, 0x76, 0x77, 0x78, 0x73, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, 0x80, 0xAC, 0xAD, 0xAE, 0x6C, 0x6D, 0x6E, 0x6F, 0x2, 0); warning("TODO: sub71A50(&dialog1, 0x5A, 0x78, 0x74, 0x75, 0x76, 0x77, 0);"); @@ -1150,7 +1151,7 @@ void Scene205::enter() { _vm->_palette->setEntry(252, 63, 63, 40); _vm->_palette->setEntry(253, 50, 50, 30); - _chickenTime = _globals._frameTime; + _chickenTime = _vm->_game->_scene._frameStartTime; if (_globals[kSexOfRex] == SEX_FEMALE) warning("sub71704(0x3, 0xC3, 0x108, 0x63, 0x86, 0xD, 2, 0xFDFC, 0x3C, 0x6C, 0x6C, 0x6D, 0x6D, 0x6E, 0x6E, 0x6F, 0x6C, 0);"); @@ -1162,7 +1163,7 @@ void Scene205::enter() { _scene->loadAnimation(formAnimName('a', -1), 0); _scene->_activeAnimation->_resetFlag = false; } else { - _globals._frameTime |= 0xFFFF0000; + _beingKicked = true; _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8, 1, 0, 0); _game._player._visible = false; _game._player._stepEnabled = false; @@ -1178,19 +1179,21 @@ void Scene205::step() { if (_globals[kSexOfRex] == SEX_FEMALE) { warning("TODO: sub7178C()"); - if (_globals._frameTime >= _chickenTime) { + if (_vm->_game->_scene._frameStartTime >= _chickenTime) { warning("TODO: if (sub717B2(100, 1 + sub7176C()))"); _vm->_sound->command(28); // } - _chickenTime = _globals._frameTime + 2; + _chickenTime = _vm->_game->_scene._frameStartTime + 2; } } - if (_globals._frameTime - _lastFishTime > 1300) { - _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 5, 1, 0, 0); - int idx = _scene->_dynamicHotspots.add(269, 13, _globals._sequenceIndexes[6], Common::Rect(0, 0, 0, 0)); + if (_vm->_game->_scene._frameStartTime - _lastFishTime > 1300) { + _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle( + _globals._spriteIndexes[6], false, 5, 1, 0, 0); + int idx = _scene->_dynamicHotspots.add(269, 13, _globals._sequenceIndexes[6], + Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(49, 86), FACING_NORTH); - _lastFishTime = _globals._frameTime; + _lastFishTime = _vm->_game->_scene._frameStartTime; } if (_game._trigger == 73) { @@ -4296,7 +4299,7 @@ void Scene211::enter() { if (_globals[kMonkeyStatus] == MONKEY_AMBUSH_READY) warning("sub71704(0x2, 0x0, 0x36, 0x0, 0x1E, 0xD, 2, 0xFDFC, 0x3C, 0x97, 0x98, 0x99, 0x9A, 0);"); - _monkeyTime = _globals._frameTime; + _monkeyTime = _vm->_game->_scene._frameStartTime; _scrollY = 30; _ambushFl = false; @@ -4309,11 +4312,11 @@ void Scene211::step() { if (_globals[kMonkeyStatus] == MONKEY_AMBUSH_READY) { warning("TODO: sub7178C()"); - if (!_ambushFl && !_wakeFl && (_globals._frameTime >= _monkeyTime)) { + if (!_ambushFl && !_wakeFl && (_vm->_game->_scene._frameStartTime >= _monkeyTime)) { warning("if (sub717B2(80, 1 + sub7176C())) {"); _vm->_sound->command(18); // } - _monkeyTime = _globals._frameTime + 2; + _monkeyTime = _vm->_game->_scene._frameStartTime + 2; } if ((_game._player._playerPos == Common::Point(52, 132)) && (_game._player._facing == FACING_WEST) && !_game._player._moving && diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index ad87681aac..45fe7908c6 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -68,6 +68,7 @@ private: bool _activeMsgFl, _ladderTopFl, _waitingMeteoFl, _toStationFl, _toTeleportFl; int _ladderHotspotId, _lastRoute, _stationCounter, _meteoFrame; uint32 _meteoClock1, _meteoClock2, _startTime; + int _meteorologistSpecial; int subStep1(int randVal); int subStep2(int randVal); @@ -105,7 +106,7 @@ public: class Scene205: public Scene2xx { private: uint32 _lastFishTime, _chickenTime; - + bool _beingKicked; public: Scene205(MADSEngine *vm) : Scene2xx(vm), _lastFishTime(0), _chickenTime(0) {} diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 4ca5a6c5b4..9f4873f55a 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -2536,7 +2536,7 @@ void Scene318::enter() { _vm->_palette->setEntry(252, 63, 63, 10); _vm->_palette->setEntry(253, 45, 45, 05); - _dropTimer = _globals._frameTime; + _dropTimer = _vm->_game->_scene._frameStartTime; sceneEntrySound(); if (_dialogFl) @@ -2662,11 +2662,11 @@ void Scene318::step() { } } - if ((_globals._frameTime - _dropTimer) > 600) { + if ((_vm->_game->_scene._frameStartTime - _dropTimer) > 600) { _vm->_sound->command(51); _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 14, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); - _dropTimer = _globals._frameTime; + _dropTimer = _vm->_game->_scene._frameStartTime; } } diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index 8a5c3dfed5..5a283d512d 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -80,14 +80,17 @@ void Scene804::setup() { } void Scene804::enter() { - _globals._frameTime = 0; - _globals._v2 = 0; - _globals._v3 = 0; - _globals._v4 = 0; - _globals._v5 = -1; - _globals._v6 = 0; - _globals._v7 = 0; - _globals._v8 = 0; + _messWithThrottle = false; + _throttleCounter = 0; + _movingThrottle = false; + _throttleGone = false; + _dontPullThrottleAgain = false; + _resetFrame = -1; + _pullThrottleReally = false; + _alreadyOrgan = false; + _alreadyPop = false; + + if (_globals[kCopyProtectFailed]) { // Copy protection failed _globals[kInSpace] = true; @@ -136,152 +139,170 @@ void Scene804::enter() { } void Scene804::step() { - if (_globals._frameTime) { - if (_scene->_activeAnimation->getCurrentFrame() == 36 && !_globals._v3) { - _scene->_sequences.remove(_globals._sequenceIndexes[1]); - _globals._v3 = -1; - } - if (_scene->_activeAnimation->getCurrentFrame() == 39) { - _globals._v2 = 0; - if ((_globals._frameTime / 256) == 3) - _scene->_sequences.addTimer(130, 120); - } + if (!_messWithThrottle) { - if (!_globals._v2) { - _globals._frameTime += 0x100; - _globals._v2 = -1; - - if ((_globals._frameTime / 256) >= 4) { - _globals._frameTime = 0; - _game._player._stepEnabled = true; - } else { - _globals._v5 = 34; - } - } - } else { - if (_globals._v3 && _globals._v2 && _scene->_activeAnimation->getCurrentFrame() == 39) { - _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); + if ((_throttleGone) && (_movingThrottle) && (_scene->_activeAnimation->getCurrentFrame() == 39)) { + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle + (_globals._spriteIndexes[1], false, 1); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(133, 139)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 8); - _globals._v3 = 0; + _throttleGone = false; } - if (_globals._v2 && _scene->_activeAnimation->getCurrentFrame() == 42) { - _globals._v5 = 0; - _globals._v2 = 0; + if ((_movingThrottle) && (_scene->_activeAnimation->getCurrentFrame() == 42)) { + _resetFrame = 0; + _movingThrottle = false; } - if (_game._trigger == 70) - _globals._v5 = 42; + if (_game._trigger == 70) { + _resetFrame = 42; + } - if (_scene->_activeAnimation->getCurrentFrame() == 65) + if (_scene->_activeAnimation->getCurrentFrame() == 65) { _scene->_sequences.remove(_globals._sequenceIndexes[7]); + } - switch (_game._storyMode) { + switch (_game._storyMode) { case STORYMODE_NAUGHTY: if (_scene->_activeAnimation->getCurrentFrame() == 81) { - _globals._v5 = 80; - } else { - _globals[kInSpace] = 0; - _globals[kBeamIsUp] = -1; + _resetFrame = 80; + _globals[kInSpace] = false; + _globals[kBeamIsUp] = true; + assert(!_globals[kCopyProtectFailed]); _game._winStatus = 4; _vm->quitGame(); } break; - case STORYMODE_NICE: + case STORYMODE_NICE: if (_scene->_activeAnimation->getCurrentFrame() == 68) { - _globals._v5 = 66; - } else { - _globals[kInSpace] = 0; - _globals[kBeamIsUp] = -1; + _resetFrame = 66; + _globals[kInSpace] = false; + _globals[kBeamIsUp] = true; + assert(!_globals[kCopyProtectFailed]); _game._winStatus = 4; _vm->quitGame(); } - break; } if (_scene->_activeAnimation->getCurrentFrame() == 34) { - _globals._v5 = 36; + _resetFrame = 36; _scene->_sequences.remove(_globals._sequenceIndexes[1]); } + if (_scene->_activeAnimation->getCurrentFrame() == 37) { - _globals._v5 = 36; - if (!_globals._v4) + _resetFrame = 36; + if (!_dontPullThrottleAgain) { + _dontPullThrottleAgain = true; _scene->_sequences.addTimer(60, 80); + } } - if (_game._trigger == 80) + if (_game._trigger == 80) { _scene->_nextSceneId = 803; + } - if (_scene->_activeAnimation->getCurrentFrame() == 7 && !_globals[kWindowFixed]) { + if ((_scene->_activeAnimation->getCurrentFrame() == 7) && (!_globals[kWindowFixed])) { _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); _scene->_sequences.addTimer(20, 110); - _globals[kWindowFixed] = -1; + _globals[kWindowFixed] = true; } if (_scene->_activeAnimation->getCurrentFrame() == 10) { - _globals._v5 = 0; + _resetFrame = 0; _game._player._stepEnabled = true; - _game._objects.setRoom(OBJ_POLYCEMENT, 1); + _game._objects.setRoom(OBJ_POLYCEMENT, NOWHERE); } - switch (_scene->_activeAnimation->getCurrentFrame()) { - case 1: - _globals[kRandomNumber] = _vm->getRandomNumber(1, 30); - switch (_globals[kRandomNumber]) { + if (_scene->_activeAnimation->getCurrentFrame() == 1) { + int randomVal = _vm->getRandomNumber(29) + 1; + switch (randomVal) { case 1: - _globals._v5 = 25; + _resetFrame = 25; break; case 2: - _globals._v5 = 27; + _resetFrame = 27; break; case 3: - _globals._v5 = 9; + _resetFrame = 29; break; default: - _globals._v5 = 0; + _resetFrame = 0; break; } - break; + } + switch (_scene->_activeAnimation->getCurrentFrame()) { case 26: case 28: case 31: - _globals._v5 = 0; + _resetFrame = 0; break; + } + } else { + if ((_scene->_activeAnimation->getCurrentFrame() == 36) && (!_throttleGone)) { + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _throttleGone = true; + } - default: - break; + if (_scene->_activeAnimation->getCurrentFrame() == 39) { + _movingThrottle = false; + switch (_throttleCounter) { + case 1: + break; + case 3: + _scene->_sequences.addTimer(130, 120); + break; + } } + + if (!_movingThrottle) { + ++_throttleCounter; + _movingThrottle = true; + if (_throttleCounter < 4) { + _resetFrame = 34; + } else { + _messWithThrottle = false; + _throttleCounter = 0; + _game._player._stepEnabled = true; + } + } + } + + if (_game._trigger == 120) { + _vm->_dialogs->show(80422); } - if (_game._trigger == 120) - _vm->_dialogs->show(0x13a26); - if (_game._trigger == 110) - _vm->_dialogs->show(0x13a2a); + if (_game._trigger == 110) { + _vm->_dialogs->show(80426); + } - if (_globals._v6) { - _globals._v5 = 32; - _globals._v6 = 0; + if (_pullThrottleReally) { + _resetFrame = 32; + _pullThrottleReally = false; } - if (_globals._v5 >= 0 && (_scene->_activeAnimation->getCurrentFrame() != _globals._v5)) { - _scene->_activeAnimation->setCurrentFrame(_globals._v5); - _globals._v5 = -1; + + if (_resetFrame >= 0) { + if (_resetFrame != _scene->_activeAnimation->getCurrentFrame()) { + _scene->_activeAnimation->setCurrentFrame(_resetFrame); + _resetFrame = -1; + } } - if (_game._trigger == 90) + if (_game._trigger == 90) { _scene->_nextSceneId = 803; + } - if (_scene->_activeAnimation->getCurrentFrame() == 7 &&!_globals._v8) { + if ((_scene->_activeAnimation->getCurrentFrame() == 72) && !_alreadyPop) { _vm->_sound->command(21); - _globals._v8 = -1; + _alreadyPop = true; } - if (_scene->_activeAnimation->getCurrentFrame() == 80 && !_globals._v7) { + + if ((_scene->_activeAnimation->getCurrentFrame() == 80) && !_alreadyOrgan) { _vm->_sound->command(22); - _globals._v7 = 0xFFFFFFFF; + _alreadyOrgan = true; } } diff --git a/engines/mads/nebular/nebular_scenes8.h b/engines/mads/nebular/nebular_scenes8.h index a3bc97a990..45e8716d14 100644 --- a/engines/mads/nebular/nebular_scenes8.h +++ b/engines/mads/nebular/nebular_scenes8.h @@ -53,6 +53,16 @@ public: }; class Scene804: public Scene8xx { +private: + bool _messWithThrottle; + uint32 _throttleCounter = 0; + bool _movingThrottle; + bool _throttleGone; + bool _dontPullThrottleAgain; + int _resetFrame; + bool _pullThrottleReally; + bool _alreadyOrgan; + bool _alreadyPop; public: Scene804(MADSEngine *vm) : Scene8xx(vm) {} -- cgit v1.2.3 From 0f1cb2a5c123e44c6a21c168fd25ef1a06c911b6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 23 Apr 2014 22:09:15 -0400 Subject: MADS: Add a synchronize method to some of the group 1 scenes --- engines/mads/nebular/nebular_scenes1.cpp | 39 ++++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes1.h | 9 +++++--- engines/mads/scene_data.h | 11 ++++++--- 3 files changed, 53 insertions(+), 6 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index da2d358458..923d8c0cd0 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -598,6 +598,19 @@ void Scene101::actions() { } } +void Scene101::synchronize(Common::Serializer &s) { + Scene1xx::synchronize(s); + + s.syncAsByte(_sittingFl); + s.syncAsByte(_panelOpened); + + s.syncAsSint16LE(_messageNum); + s.syncAsSint16LE(_posY); + s.syncAsSint16LE(_shieldSpriteIdx); + s.syncAsSint16LE(_chairHotspotId); + s.syncAsSint16LE(_oldSpecial); +} + /*------------------------------------------------------------------------*/ void Scene102::setup() { @@ -1191,6 +1204,19 @@ void Scene102::postActions() { } } +void Scene102::synchronize(Common::Serializer &s) { + Scene1xx::synchronize(s); + + s.syncAsByte(_fridgeOpenedFl); + s.syncAsByte(_fridgeOpenedDescr); + s.syncAsByte(_fridgeFirstOpenFl); + s.syncAsByte(_chairDescrFl); + s.syncAsByte(_drawerDescrFl); + s.syncAsByte(_activeMsgFl); + + s.syncAsSint16LE(_fridgeCommentCount); +} + /*------------------------------------------------------------------------*/ void Scene103::setup() { @@ -1510,6 +1536,12 @@ void Scene103::postActions() { } } +void Scene103::synchronize(Common::Serializer &s) { + Scene1xx::synchronize(s); + s.syncAsByte(_sayHiToBinky); + s.syncAsUint32LE(_updateClock); +} + /*------------------------------------------------------------------------*/ void Scene104::setup() { @@ -1704,6 +1736,13 @@ void Scene104::actions() { _action._inProgress = false; } +void Scene104::synchronize(Common::Serializer &s) { + Scene1xx::synchronize(s); + + s.syncAsByte(_kargShootingFl); + s.syncAsByte(_loseFl); +} + /*------------------------------------------------------------------------*/ void Scene105::setup() { diff --git a/engines/mads/nebular/nebular_scenes1.h b/engines/mads/nebular/nebular_scenes1.h index d295c4d727..25a8b52ded 100644 --- a/engines/mads/nebular/nebular_scenes1.h +++ b/engines/mads/nebular/nebular_scenes1.h @@ -24,6 +24,7 @@ #define MADS_NEBULAR_SCENES1_H #include "common/scummsys.h" +#include "common/serializer.h" #include "mads/game.h" #include "mads/scene.h" #include "mads/nebular/nebular_scenes.h" @@ -73,7 +74,8 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; + virtual void postActions(); + virtual void synchronize(Common::Serializer &s); }; class Scene102 : public Scene1xx { @@ -99,6 +101,7 @@ public: virtual void preActions(); virtual void actions(); virtual void postActions(); + virtual void synchronize(Common::Serializer &s); }; class Scene103 : public Scene1xx { @@ -111,9 +114,9 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; virtual void actions(); virtual void postActions(); + virtual void synchronize(Common::Serializer &s); }; class Scene104 : public Scene1xx { @@ -129,7 +132,7 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; + virtual void synchronize(Common::Serializer &s); }; class Scene105 : public Scene1xx { diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index 5b3d818b96..d59d746706 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -96,12 +96,12 @@ public: /** * Called one per frame */ - virtual void step() = 0; + virtual void step() {} /** * Called before an action is started */ - virtual void preActions() = 0; + virtual void preActions() {} /** * Handles scene actions @@ -111,7 +111,12 @@ public: /** * Post-action handling */ - virtual void postActions() = 0; + virtual void postActions() {} + + /** + * Synchronize any local data for the scene + */ + virtual void synchronize(Common::Serializer &s) {} }; struct ARTHeader { -- cgit v1.2.3 From ba34b1f8823e9e39a6d9c5bed76f10910d8c65ec Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 24 Apr 2014 07:13:44 +0200 Subject: MADS: Implement scene 321 --- engines/mads/nebular/nebular_scenes3.cpp | 37 ++++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes3.h | 12 +++++++++++ 2 files changed, 49 insertions(+) diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 9f4873f55a..b0b837bd6f 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -3639,5 +3639,42 @@ void Scene320::actions() { /*------------------------------------------------------------------------*/ +void Scene321::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene321::enter() { + _game._player._visible = false; + _game._player._stepEnabled = false; + + _scene->_userInterface.emptyConversationList(); + _scene->_userInterface.setup(kInputConversation); + + int suffixNum; + if (_globals[kSexOfRex] == REX_FEMALE) { + _globals[kSexOfRex] = REX_MALE; + suffixNum = 1; + } else { + _globals[kSexOfRex] = REX_FEMALE; + suffixNum = _game._visitedScenes._sceneRevisited ? 2 : 0; + } + + _scene->loadAnimation(formAnimName('g', suffixNum), 60); + sceneEntrySound(); +} + +void Scene321::step() { + if (_scene->_activeAnimation != nullptr) { + if ((_scene->_activeAnimation->getCurrentFrame() >= 260) && (_globals[kSexOfRex] == REX_MALE) && (_game._storyMode >= STORYMODE_NICE)) + _scene->_nextSceneId = 316; + } + + if (_game._trigger == 60) + _scene->_nextSceneId = 316; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h index 79ffa316f2..6da0f3e320 100644 --- a/engines/mads/nebular/nebular_scenes3.h +++ b/engines/mads/nebular/nebular_scenes3.h @@ -337,6 +337,18 @@ public: virtual void postActions() {}; }; +class Scene321: public Scene3xx { +public: + Scene321(MADSEngine *vm) : Scene3xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions() {}; + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 26b7deb6106ded2d68ecb4feb4a484b3313b7af2 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 24 Apr 2014 07:14:14 +0200 Subject: MADS: Fix bugs in scene 307 --- engines/mads/nebular/nebular_scenes3.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index b0b837bd6f..6f22b7b7b4 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -821,7 +821,7 @@ void Scene307::step() { if (_prisonerMessageId > 0x10A) _prisonerMessageId = 0x104; } else if (_globals[kKnowsBuddyBeast] && (_vm->getRandomNumber(1, 3) == 1)) { - if (_globals[kKnowsBuddyBeast] && (dialog2.read(0) > 1) && (_vm->getRandomNumber(1, 3) == 1)) { + if (_globals[kKnowsBuddyBeast] && (dialog2.read(0)) && (_vm->getRandomNumber(1, 3) == 1)) { int idx = _scene->_kernelMessages.add(Common::Point(5, 51), 0xFDFC, 0, 81, 120, _game.getQuote(267)); _scene->_kernelMessages.setQuoted(idx, 4, true); } -- cgit v1.2.3 From f330106be2368df453fec7799a2d061c829f525d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 24 Apr 2014 08:24:23 -0400 Subject: MADS: Hook game scene into synchronisation logic --- engines/mads/nebular/nebular_scenes1.h | 1 - engines/mads/scene.cpp | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes1.h b/engines/mads/nebular/nebular_scenes1.h index 25a8b52ded..ee9817957b 100644 --- a/engines/mads/nebular/nebular_scenes1.h +++ b/engines/mads/nebular/nebular_scenes1.h @@ -74,7 +74,6 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions(); virtual void synchronize(Common::Serializer &s); }; diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 24218479ce..9217be6d5d 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -685,6 +685,7 @@ void Scene::synchronize(Common::Serializer &s) { _action._activeAction.synchronize(s); _rails.synchronize(s); _userInterface.synchronize(s); + _sceneLogic->synchronize(s); } } // End of namespace MADS -- cgit v1.2.3 From 1098246f2be705de82dd3077dd25323380c32dd1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 24 Apr 2014 09:12:09 -0400 Subject: MADS: Added methods for can save/load currently --- engines/mads/mads.cpp | 11 +++++++++++ engines/mads/mads.h | 10 ++++++++++ 2 files changed, 21 insertions(+) diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index c40d4bfa1b..6f57b1df60 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -26,6 +26,7 @@ #include "common/events.h" #include "engines/util.h" #include "mads/mads.h" +#include "mads/game.h" #include "mads/screen.h" #include "mads/msurface.h" #include "mads/resources.h" @@ -119,4 +120,14 @@ int MADSEngine::hypotenuse(int xv, int yv) { return (int)sqrt((double)(xv * xv + yv * yv)); } +bool MADSEngine::canLoadGameStateCurrently() { + return !_game->_winStatus && !_game->globals()[5] + && _dialogs->_pendingDialog == DIALOG_NONE; +} + +bool MADSEngine::canSaveGameStateCurrently() { + return !_game->_winStatus && !_game->globals()[5] + && _dialogs->_pendingDialog == DIALOG_NONE; +} + } // End of namespace MADS diff --git a/engines/mads/mads.h b/engines/mads/mads.h index 4ea0758f88..f13b3b9008 100644 --- a/engines/mads/mads.h +++ b/engines/mads/mads.h @@ -119,6 +119,16 @@ public: int getRandomNumber(int maxNumber); int getRandomNumber(int minNumber, int maxNumber); int hypotenuse(int xv, int yv); + + /** + * Returns true if it is currently okay to restore a game + */ + bool canLoadGameStateCurrently(); + + /** + * Returns true if it is currently okay to save the game + */ + bool canSaveGameStateCurrently(); }; } // End of namespace MADS -- cgit v1.2.3 From f18104e7564b9d0b7a0377bd9510959d7a2d8867 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 24 Apr 2014 09:21:21 -0400 Subject: MADS: Fixed Conversation::read method --- engines/mads/user_interface.cpp | 12 ++++++++---- engines/mads/user_interface.h | 5 +++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 9a63ac32ad..d4ab0d3dc5 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -258,16 +258,20 @@ void Conversation::set(int quoteId, ...) { va_end(va); } -bool Conversation::read(int quoteId) { +int Conversation::read(int quoteId) { uint16 flags = _vm->_game->globals()[_globalId]; + int count = 0; for (uint idx = 0; idx < _quotes.size(); ++idx) { - if (_quotes[idx] == quoteId) { + if (flags & (1 << idx)) + ++count; + + if (_quotes[idx] == quoteId) return flags & (1 << idx); - } } - return false; + // Could not find it, simply return number of active quotes + return count; } void Conversation::write(int quoteId, bool flag) { diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h index 1e07681a6f..9948278a55 100644 --- a/engines/mads/user_interface.h +++ b/engines/mads/user_interface.h @@ -114,9 +114,10 @@ public: void set(int quoteId, ...); /** - * Returns true whether the given quote is enabled in the conversation + * Returns the bit for a given quote to indicate whether it's active or not or, + * if 0 is passed, returns the number of currently active quotes */ - bool read(int quoteId); + int read(int quoteId); /** * Activates or deactivates the specified quote in the given conversation node -- cgit v1.2.3 From 41c6ad69716ec4b4df459811fc470e3134bb2229 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 24 Apr 2014 15:26:53 +0200 Subject: MADS: Better fix of scene 307 --- engines/mads/nebular/nebular_scenes3.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 6f22b7b7b4..3f5d6939c4 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -820,11 +820,9 @@ void Scene307::step() { _prisonerMessageId++; if (_prisonerMessageId > 0x10A) _prisonerMessageId = 0x104; - } else if (_globals[kKnowsBuddyBeast] && (_vm->getRandomNumber(1, 3) == 1)) { - if (_globals[kKnowsBuddyBeast] && (dialog2.read(0)) && (_vm->getRandomNumber(1, 3) == 1)) { - int idx = _scene->_kernelMessages.add(Common::Point(5, 51), 0xFDFC, 0, 81, 120, _game.getQuote(267)); - _scene->_kernelMessages.setQuoted(idx, 4, true); - } + } else if (_globals[kKnowsBuddyBeast] && (dialog2.read(0) > 1) && (_vm->getRandomNumber(1, 3) == 1)) { + int idx = _scene->_kernelMessages.add(Common::Point(5, 51), 0xFDFC, 0, 81, 120, _game.getQuote(267)); + _scene->_kernelMessages.setQuoted(idx, 4, true); } _prisonerTimer = 0; } -- cgit v1.2.3 From 6801694070d24b02344899959a25e961ce4fded1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 24 Apr 2014 15:27:18 +0200 Subject: MADS: Fix compilation warning in scene 804 --- engines/mads/nebular/nebular_scenes8.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes8.h b/engines/mads/nebular/nebular_scenes8.h index 45e8716d14..e854fef6d5 100644 --- a/engines/mads/nebular/nebular_scenes8.h +++ b/engines/mads/nebular/nebular_scenes8.h @@ -55,7 +55,7 @@ public: class Scene804: public Scene8xx { private: bool _messWithThrottle; - uint32 _throttleCounter = 0; + uint32 _throttleCounter; bool _movingThrottle; bool _throttleGone; bool _dontPullThrottleAgain; @@ -64,7 +64,7 @@ private: bool _alreadyOrgan; bool _alreadyPop; public: - Scene804(MADSEngine *vm) : Scene8xx(vm) {} + Scene804(MADSEngine *vm) : Scene8xx(vm), _throttleCounter(0) {} virtual void setup(); -- cgit v1.2.3 From 41d8af2d5632099f36573e66b364839cadbc9dff Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 25 Apr 2014 06:57:02 +0200 Subject: MADS: Implement scene 351 --- engines/mads/nebular/nebular_scenes.cpp | 2 + engines/mads/nebular/nebular_scenes3.cpp | 212 +++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes3.h | 11 ++ 3 files changed, 225 insertions(+) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 32d567a6a5..df2433d166 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -132,6 +132,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 320: return new Scene320(vm); + case 351: + return new Scene351(vm); // Scene group #8 case 804: return new Scene804(vm); diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 3f5d6939c4..50cc7cab08 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -3674,5 +3674,217 @@ void Scene321::step() { /*------------------------------------------------------------------------*/ +void Scene351::setup() { + if (_scene->_currentSceneId == 391) + _globals[kSexOfRex] = REX_MALE; + + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(0xD); +} + +void Scene351::enter() { + _globals[kAfterHavoc] = -1; + _globals[kTeleporterRoom + 1] = 351; + + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('c', -1)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites("*ROXRC_7"); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites("*RXRD_7"); + + if (_game._objects.isInRoom(0xF)) { + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 6, 0, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 4); + } else + _scene->_hotspots.activate(0x5C, false); + + if (_scene->_priorSceneId == 352) + _game._player._playerPos = Common::Point(148, 152); + else if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(207, 81); + _game._player._facing = FACING_NORTH; + } + + if (_globals[kTeleporterCommand]) { + _game._player._visible = false; + _game._player._stepEnabled = false; + + char sepChar = 'a'; + if (_globals[kSexOfRex] != REX_MALE) + sepChar = 'b'; + + int suffixNum = -1; + int trigger = 0; + + switch (_globals[kTeleporterCommand]) { + case 1: + suffixNum = 0; + trigger = 60; + _globals[kTeleporterCommand] = true; + break; + + case 2: + suffixNum = 1; + trigger = 61; + break; + + case 3: + case 4: + _game._player._visible = true; + _game._player._stepEnabled = true; + _game._player._turnToFacing = FACING_SOUTH; + suffixNum = -1; + break; + + default: + break; + } + + _globals[kTeleporterCommand] = 0; + + if (suffixNum >= 0) + _scene->loadAnimation(formAnimName(sepChar, suffixNum), trigger); + } + + sceneEntrySound(); +} + +void Scene351::step() { + if (_game._trigger == 60) { + _game._player._stepEnabled = true; + _game._player._visible = true; + _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; + _game._player._turnToFacing = FACING_SOUTH; + } + + if (_game._trigger == 61) { + _globals[kTeleporterCommand] = 1; + _scene->_nextSceneId = _globals[kTeleporterDestination]; + _scene->_reloadSceneFlag = true; + } +} + +void Scene351::actions() { + if (_action._lookFlag) { + _vm->_dialogs->show(0x8931); + goto handled; + } + + if (_action.isAction(0x2F9, 0x16C)) { + _scene->_nextSceneId = 322; + goto handled; + } + + if (_action.isAction(0x1AD, 0x2B3)) { + _scene->_nextSceneId = 352; + goto handled; + } + + if (_action.isAction(VERB_TAKE, 0x5C)) { + if (_game._trigger || !_game._objects.isInInventory(0xF)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + if (_globals[kSexOfRex] == REX_FEMALE) { + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 5, 2, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[2]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_SPRITE, 5, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + } else { + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 5, 2, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_SPRITE, 6, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + } + break; + + case 1: + _scene->_hotspots.activate(0x5C, false); + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _game._objects.addToInventory(0xF); + break; + + case 2: + _game._player._visible = true; + _game._player._stepEnabled = true; + _vm->_dialogs->showItem(0xF, 0x32F); + break; + } + } + goto handled; + } + + if (_action.isAction(VERB_LOOK, 0x180)) { + _vm->_dialogs->show(0x8926); + goto handled; + } + + if (_action.isAction(VERB_LOOK, 0x23A)) { + _vm->_dialogs->show(0x8927); + goto handled; + } + + if (_action.isAction(VERB_LOOK, 0x1E6)) { + _vm->_dialogs->show(0x8928); + goto handled; + } + + if (_action.isAction(VERB_LOOK, 0x239)) { + if (_game._objects[0xF]._roomNumber == 351) + _vm->_dialogs->show(0x892A); + else + _vm->_dialogs->show(0x8929); + + goto handled; + } + + if (_action.isAction(VERB_LOOK, 0x2C7)) { + _vm->_dialogs->show(0x892B); + goto handled; + } + + if (_action.isAction(VERB_LOOK, 0x1E4)) { + _vm->_dialogs->show(0x892C); + goto handled; + } + + if (_action.isAction(VERB_LOOK, 0xD7)) { + _vm->_dialogs->show(0x892D); + goto handled; + } + + if (_action.isAction(VERB_LOOK, 0x16C)) { + _vm->_dialogs->show(0x892E); + goto handled; + } + + if (_action.isAction(VERB_LOOK, 0x59)) { + _vm->_dialogs->show(0x892F); + goto handled; + } + + if (_action.isAction(VERB_LOOK, 0x2B3)) { + _vm->_dialogs->show(0x8930); + goto handled; + } + + if (_action.isAction(VERB_LOOK, 0x1EB)) { + _vm->_dialogs->show(0x8932); + goto handled; + } + + + + goto done; + +handled: + _action._inProgress = false; + +done: + ; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h index 6da0f3e320..5be10ac258 100644 --- a/engines/mads/nebular/nebular_scenes3.h +++ b/engines/mads/nebular/nebular_scenes3.h @@ -349,6 +349,17 @@ public: virtual void postActions() {}; }; +class Scene351: public Scene3xx { +public: + Scene351(MADSEngine *vm) : Scene3xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions(); + virtual void postActions() {}; +}; } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 44fd705fdf39ea0a0b96fbd1f19e31334a3d2113 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 25 Apr 2014 07:13:29 +0200 Subject: MADS: Refactor Scene351::actions() --- engines/mads/nebular/nebular_scenes3.cpp | 85 +++++++------------------------- 1 file changed, 17 insertions(+), 68 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 50cc7cab08..bc4c04d4e3 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -3764,22 +3764,13 @@ void Scene351::step() { } void Scene351::actions() { - if (_action._lookFlag) { + if (_action._lookFlag) _vm->_dialogs->show(0x8931); - goto handled; - } - - if (_action.isAction(0x2F9, 0x16C)) { + else if (_action.isAction(0x2F9, 0x16C)) _scene->_nextSceneId = 322; - goto handled; - } - - if (_action.isAction(0x1AD, 0x2B3)) { + else if (_action.isAction(0x1AD, 0x2B3)) _scene->_nextSceneId = 352; - goto handled; - } - - if (_action.isAction(VERB_TAKE, 0x5C)) { + else if (_action.isAction(VERB_TAKE, 0x5C)) { if (_game._trigger || !_game._objects.isInInventory(0xF)) { switch (_game._trigger) { case 0: @@ -3811,77 +3802,35 @@ void Scene351::actions() { break; } } - goto handled; - } - - if (_action.isAction(VERB_LOOK, 0x180)) { + } else if (_action.isAction(VERB_LOOK, 0x180)) _vm->_dialogs->show(0x8926); - goto handled; - } - - if (_action.isAction(VERB_LOOK, 0x23A)) { + else if (_action.isAction(VERB_LOOK, 0x23A)) _vm->_dialogs->show(0x8927); - goto handled; - } - - if (_action.isAction(VERB_LOOK, 0x1E6)) { + else if (_action.isAction(VERB_LOOK, 0x1E6)) _vm->_dialogs->show(0x8928); - goto handled; - } - - if (_action.isAction(VERB_LOOK, 0x239)) { + else if (_action.isAction(VERB_LOOK, 0x239)) { if (_game._objects[0xF]._roomNumber == 351) _vm->_dialogs->show(0x892A); else _vm->_dialogs->show(0x8929); - - goto handled; - } - - if (_action.isAction(VERB_LOOK, 0x2C7)) { + } else if (_action.isAction(VERB_LOOK, 0x2C7)) _vm->_dialogs->show(0x892B); - goto handled; - } - - if (_action.isAction(VERB_LOOK, 0x1E4)) { + else if (_action.isAction(VERB_LOOK, 0x1E4)) _vm->_dialogs->show(0x892C); - goto handled; - } - - if (_action.isAction(VERB_LOOK, 0xD7)) { + else if (_action.isAction(VERB_LOOK, 0xD7)) _vm->_dialogs->show(0x892D); - goto handled; - } - - if (_action.isAction(VERB_LOOK, 0x16C)) { + else if (_action.isAction(VERB_LOOK, 0x16C)) _vm->_dialogs->show(0x892E); - goto handled; - } - - if (_action.isAction(VERB_LOOK, 0x59)) { + else if (_action.isAction(VERB_LOOK, 0x59)) _vm->_dialogs->show(0x892F); - goto handled; - } - - if (_action.isAction(VERB_LOOK, 0x2B3)) { + else if (_action.isAction(VERB_LOOK, 0x2B3)) _vm->_dialogs->show(0x8930); - goto handled; - } - - if (_action.isAction(VERB_LOOK, 0x1EB)) { + else if (_action.isAction(VERB_LOOK, 0x1EB)) _vm->_dialogs->show(0x8932); - goto handled; - } - - - - goto done; + else + return; -handled: _action._inProgress = false; - -done: - ; } /*------------------------------------------------------------------------*/ -- cgit v1.2.3 From bae0a6590a4ba843ef51f4cc67875c578863f5b2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 26 Apr 2014 09:08:46 -0400 Subject: MADS: Implemented savegame header read/writes --- engines/mads/detection.cpp | 7 +++ engines/mads/game.cpp | 122 +++++++++++++++++++++++++++++++++++++++------ engines/mads/game.h | 36 +++++++++++++ engines/mads/mads.cpp | 8 +++ engines/mads/mads.h | 6 +++ 5 files changed, 164 insertions(+), 15 deletions(-) diff --git a/engines/mads/detection.cpp b/engines/mads/detection.cpp index 015859f827..b8e75b4393 100644 --- a/engines/mads/detection.cpp +++ b/engines/mads/detection.cpp @@ -31,6 +31,7 @@ #include "common/system.h" #include "graphics/colormasks.h" #include "graphics/surface.h" +#include "mads/game.h" #define MAX_SAVES 99 @@ -124,6 +125,7 @@ SaveStateList MADSMetaEngine::listSaves(const char *target) const { Common::StringArray filenames; Common::String saveDesc; Common::String pattern = Common::String::format("%s.0??", target); + MADS::MADSSavegameHeader header; filenames = saveFileMan->listSavefiles(pattern); sort(filenames.begin(), filenames.end()); // Sort to get the files in numerical order @@ -137,6 +139,11 @@ SaveStateList MADSMetaEngine::listSaves(const char *target) const { Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(*file); if (in) { + MADS::Game::readSavegameHeader(in, header); + saveList.push_back(SaveStateDescriptor(slot, header._saveName)); + + header._thumbnail->free(); + delete header._thumbnail; delete in; } } diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 9c124aa6a6..50c3ccd916 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -21,8 +21,12 @@ */ #include "common/scummsys.h" +#include "common/config-manager.h" #include "common/memstream.h" #include "common/serializer.h" +#include "graphics/palette.h" +#include "graphics/scaler.h" +#include "graphics/thumbnail.h" #include "mads/mads.h" #include "mads/compression.h" #include "mads/game.h" @@ -46,6 +50,7 @@ Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm), _scene(vm), _screenObjects(vm), _player(vm) { _sectionNumber = _priorSectionNumber = 0; _difficulty = DIFFICULTY_HARD; + _loadGameSlot = -1; _serializer = nullptr; _statusFlag = 0; _sectionHandler = nullptr; @@ -81,22 +86,33 @@ Game::~Game() { void Game::run() { initialiseGlobals(); + // If requested, load a savegame instead of showing the intro + if (ConfMan.hasKey("save_slot")) { + int saveSlot = ConfMan.getInt("save_slot"); + if (saveSlot >= 0 && saveSlot <= 999) + _loadGameSlot = saveSlot; + } + _statusFlag = true; - int protectionResult = checkCopyProtection(); - switch (protectionResult) { - case PROTECTION_FAIL: - // Copy protection failed - _scene._nextSceneId = 804; - break; - case PROTECTION_ESCAPE: - // User escaped out of copy protection dialog - _vm->quitGame(); - break; - default: - // Copy protection check succeeded - _scene._nextSceneId = 103; - _scene._priorSceneId = 102; - break; + int protectionResult = -1; + + if (_loadGameSlot == -1) { + protectionResult = checkCopyProtection(); + switch (protectionResult) { + case PROTECTION_FAIL: + // Copy protection failed + _scene._nextSceneId = 804; + break; + case PROTECTION_ESCAPE: + // User escaped out of copy protection dialog + _vm->quitGame(); + break; + default: + // Copy protection check succeeded + _scene._nextSceneId = 103; + _scene._priorSceneId = 102; + break; + } } // Get the initial starting time for the first scene @@ -422,4 +438,80 @@ void Game::synchronize(Common::Serializer &s, bool phase1) { } } +void Game::loadGame(int slotNumber) { + +} + +void Game::saveGame(int slotNumber, const Common::String &saveName) { + +} + +const char *const SAVEGAME_STR = "MADS"; +#define SAVEGAME_STR_SIZE 4 + +bool Game::readSavegameHeader(Common::InSaveFile *in, MADSSavegameHeader &header) { + char saveIdentBuffer[SAVEGAME_STR_SIZE + 1]; + header._thumbnail = NULL; + + // Validate the header Id + in->read(saveIdentBuffer, SAVEGAME_STR_SIZE + 1); + if (strncmp(saveIdentBuffer, SAVEGAME_STR, SAVEGAME_STR_SIZE)) + return false; + + header._version = in->readByte(); + if (header._version > MADS_SAVEGAME_VERSION) + return false; + + // Read in the string + header._saveName.clear(); + char ch; + while ((ch = (char)in->readByte()) != '\0') header._saveName += ch; + + // Get the thumbnail + header._thumbnail = Graphics::loadThumbnail(*in); + if (!header._thumbnail) + return false; + + // Read in save date/time + header._year = in->readSint16LE(); + header._month = in->readSint16LE(); + header._day = in->readSint16LE(); + header._hour = in->readSint16LE(); + header._minute = in->readSint16LE(); + header._totalFrames = in->readUint32LE(); + + return true; +} + +void Game::writeSavegameHeader(Common::OutSaveFile *out, MADSSavegameHeader &header) { + // Write out a savegame header + out->write(SAVEGAME_STR, SAVEGAME_STR_SIZE + 1); + + out->writeByte(MADS_SAVEGAME_VERSION); + + // Write savegame name + out->write(header._saveName.c_str(), header._saveName.size() + 1); + + // Get the active palette + uint8 thumbPalette[256 * 3]; + g_system->getPaletteManager()->grabPalette(thumbPalette, 0, 256); + + // Create a thumbnail and save it + Graphics::Surface *thumb = new Graphics::Surface(); + ::createThumbnail(thumb, _vm->_screen.getData(), MADS_SCREEN_WIDTH, MADS_SCREEN_HEIGHT, thumbPalette); + Graphics::saveThumbnail(*out, *thumb); + thumb->free(); + delete thumb; + + // Write out the save date/time + TimeDate td; + g_system->getTimeAndDate(td); + out->writeSint16LE(td.tm_year + 1900); + out->writeSint16LE(td.tm_mon + 1); + out->writeSint16LE(td.tm_mday); + out->writeSint16LE(td.tm_hour); + out->writeSint16LE(td.tm_min); + out->writeUint32LE(_vm->_events->getFrameCounter()); +} + } // End of namespace MADS diff --git a/engines/mads/game.h b/engines/mads/game.h index ad40fbdcc0..8334d94256 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -24,6 +24,7 @@ #define MADS_GAME_H #include "common/scummsys.h" +#include "common/savefile.h" #include "common/str-array.h" #include "common/serializer.h" #include "mads/scene.h" @@ -54,6 +55,17 @@ enum ProtectionResult { PROTECTION_SUCCEED = 0, PROTECTION_FAIL = 1, PROTECTION_ESCAPE = 2 }; +#define MADS_SAVEGAME_VERSION 1 + +struct MADSSavegameHeader { + uint8 _version; + Common::String _saveName; + Graphics::Surface *_thumbnail; + int _year, _month, _day; + int _hour, _minute; + int _totalFrames; +}; + class Game { private: /** @@ -78,6 +90,8 @@ protected: bool _quoteEmergency; bool _vocabEmergency; bool _anyEmergency; + int _loadGameSlot; + Common::String _saveName; Common::Serializer *_serializer; /** @@ -188,6 +202,28 @@ public: * Handle a keyboard event */ void handleKeypress(const Common::Event &event); + + /** + * Starts a savegame loading. + * @remarks Due to the way the engine is implemented, loading is done in two + * parts, the second part after the specific scene has been loaded + */ + void loadGame(int slotNumber); + + /** + * Save the current game + */ + void saveGame(int slotNumber, const Common::String &saveName); + + /** + * Write out a savegame header + */ + void writeSavegameHeader(Common::OutSaveFile *out, MADSSavegameHeader &header); + + /** + * Read in a savegame header + */ + static bool readSavegameHeader(Common::InSaveFile *in, MADSSavegameHeader &header); }; } // End of namespace MADS diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index 6f57b1df60..1df41ad3fd 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -130,4 +130,12 @@ bool MADSEngine::canSaveGameStateCurrently() { && _dialogs->_pendingDialog == DIALOG_NONE; } +/** +* Support method that generates a savegame name +* @param slot Slot number +*/ +Common::String MADSEngine::generateSaveName(int slot) { + return Common::String::format("%s.%03d", _targetName.c_str(), slot); +} + } // End of namespace MADS diff --git a/engines/mads/mads.h b/engines/mads/mads.h index f13b3b9008..8a4b7f64d1 100644 --- a/engines/mads/mads.h +++ b/engines/mads/mads.h @@ -129,6 +129,12 @@ public: * Returns true if it is currently okay to save the game */ bool canSaveGameStateCurrently(); + + /** + * Support method that generates a savegame name + * @param slot Slot number + */ + Common::String generateSaveName(int slot); }; } // End of namespace MADS -- cgit v1.2.3 From bb5edf5426c3d8717d3a3f843a3dbf6193bbe9e9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 26 Apr 2014 11:01:21 -0400 Subject: MADS: Implemented more save/load logic --- engines/mads/game.cpp | 47 ++++++++++++++++++++++++++++++++++++++++++---- engines/mads/game.h | 2 +- engines/mads/game_data.cpp | 19 +++++++++++++++++++ engines/mads/game_data.h | 5 +++++ engines/mads/mads.cpp | 10 ++++++++++ engines/mads/mads.h | 10 ++++++++++ 6 files changed, 88 insertions(+), 5 deletions(-) diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 50c3ccd916..9a5ec1264b 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -51,7 +51,7 @@ Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm), _sectionNumber = _priorSectionNumber = 0; _difficulty = DIFFICULTY_HARD; _loadGameSlot = -1; - _serializer = nullptr; + _saveFile = nullptr; _statusFlag = 0; _sectionHandler = nullptr; _sectionNumber = 1; @@ -79,6 +79,7 @@ Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm), } Game::~Game() { + delete _saveFile; delete _surface; delete _sectionHandler; } @@ -118,7 +119,7 @@ void Game::run() { // Get the initial starting time for the first scene _scene._frameStartTime = _vm->_events->getFrameCounter(); - if (_serializer == nullptr && protectionResult != -1 && protectionResult != -2) { + if (_saveFile == nullptr && protectionResult != -1 && protectionResult != -2) { initSection(_sectionNumber); _statusFlag = true; @@ -142,8 +143,10 @@ void Game::run() { void Game::gameLoop() { while (!_vm->shouldQuit() && _statusFlag) { - if (_serializer) - synchronize(*_serializer, true); + if (_loadGameSlot != -1) { + loadGame(_loadGameSlot); + _loadGameSlot = -1; + } setSectionHandler(); _sectionHandler->preLoadSection(); @@ -255,6 +258,13 @@ void Game::sectionLoop() { _triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _scene._sceneLogic->enter(); + // If in the middle of restoring a game, handle the rest of the loading + if (_saveFile != nullptr) { + Common::Serializer s(_saveFile, nullptr); + synchronize(s, false); + delete _saveFile; + } + // Set player data _player._targetPos = _player._playerPos; _player._turnToFacing = _player._facing; @@ -420,6 +430,7 @@ void Game::synchronize(Common::Serializer &s, bool phase1) { if (phase1) { s.syncAsUint16LE(_scene._nextSceneId); s.syncAsUint16LE(_scene._priorSceneId); + _visitedScenes.synchronize(s); if (s.isLoading()) { _sectionNumber = _scene._nextSceneId / 100; @@ -439,11 +450,39 @@ void Game::synchronize(Common::Serializer &s, bool phase1) { } void Game::loadGame(int slotNumber) { + _saveFile = g_system->getSavefileManager()->openForLoading( + _vm->generateSaveName(slotNumber)); + + Common::Serializer s(_saveFile, nullptr); + + // Load the savaegame header + MADSSavegameHeader header; + if (!readSavegameHeader(_saveFile, header)) + error("Invalid savegame"); + + if (header._thumbnail) { + header._thumbnail->free(); + delete header._thumbnail; + } + // Load the initial data such as what scene needs to be loaded up + synchronize(s, true); } void Game::saveGame(int slotNumber, const Common::String &saveName) { + Common::OutSaveFile *out = g_system->getSavefileManager()->openForSaving( + _vm->generateSaveName(slotNumber)); + + MADSSavegameHeader header; + header._saveName = saveName; + writeSavegameHeader(out, header); + + Common::Serializer s(nullptr, out); + synchronize(s, true); + synchronize(s, false); + out->finalize(); + delete out; } const char *const SAVEGAME_STR = "MADS"; diff --git a/engines/mads/game.h b/engines/mads/game.h index 8334d94256..982f880dca 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -92,7 +92,7 @@ protected: bool _anyEmergency; int _loadGameSlot; Common::String _saveName; - Common::Serializer *_serializer; + Common::InSaveFile *_saveFile; /** * Constructor diff --git a/engines/mads/game_data.cpp b/engines/mads/game_data.cpp index 0f41692e2c..9211bbfa5a 100644 --- a/engines/mads/game_data.cpp +++ b/engines/mads/game_data.cpp @@ -46,4 +46,23 @@ bool VisitedScenes::exists(int sceneId) { return false; } +void VisitedScenes::synchronize(Common::Serializer &s) { + int count = size(); + int v = 0; + s.syncAsUint16LE(count); + + if (s.isSaving()) { + for (uint i = 0; i < size(); ++i) { + v = (*this)[i]; + s.syncAsSint16LE(v); + } + } else { + clear(); + for (uint i = 0; i < count; ++i) { + s.syncAsSint16LE(v); + push_back(v); + } + } +} + } // End of namespace MADS diff --git a/engines/mads/game_data.h b/engines/mads/game_data.h index 8b31e5260c..1a8791e815 100644 --- a/engines/mads/game_data.h +++ b/engines/mads/game_data.h @@ -47,6 +47,11 @@ public: * Adds a scene Id to the list of previously visited scenes, if it doesn't already exist */ void add(int sceneId); + + /** + * Synchronizes the list + */ + void synchronize(Common::Serializer &s); }; class SectionHandler { diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index 1df41ad3fd..cb84f4da88 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -138,4 +138,14 @@ Common::String MADSEngine::generateSaveName(int slot) { return Common::String::format("%s.%03d", _targetName.c_str(), slot); } +Common::Error MADSEngine::loadGameState(int slot) { + _game->loadGame(slot); + return Common::kNoError; +} + +Common::Error MADSEngine::saveGameState(int slot, const Common::String &desc) { + _game->saveGame(slot, desc); + return Common::kNoError; +} + } // End of namespace MADS diff --git a/engines/mads/mads.h b/engines/mads/mads.h index 8a4b7f64d1..9acd469d27 100644 --- a/engines/mads/mads.h +++ b/engines/mads/mads.h @@ -135,6 +135,16 @@ public: * @param slot Slot number */ Common::String generateSaveName(int slot); + + /** + * Handles loading a game via the GMM + */ + virtual Common::Error loadGameState(int slot); + + /** + * Handles saving the game via the GMM + */ + virtual Common::Error saveGameState(int slot, const Common::String &desc); }; } // End of namespace MADS -- cgit v1.2.3 From f9d26d7b4ff2627544ddb3faf11aea91fef9e2a5 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 26 Apr 2014 17:25:28 +0200 Subject: MADS: Add Scene 352 --- engines/mads/nebular/nebular_scenes3.cpp | 539 +++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes3.h | 27 ++ 2 files changed, 566 insertions(+) diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index bc4c04d4e3..b812d432c9 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -3835,5 +3835,544 @@ void Scene351::actions() { /*------------------------------------------------------------------------*/ +void Scene352::setup() { + setPlayerSpritesPrefix(); + setAAName(); + + _scene->addActiveVocab(0xD); + _scene->addActiveVocab(0x2F4); + _scene->addActiveVocab(0x2F5); + _scene->addActiveVocab(0x2F6); +} + +void Scene352::putArmDown(bool corridorExit, bool doorwayExit) { + switch (_game._trigger) { + case 0: + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 60, _game.getQuote(0xFF)); + _scene->_sequences.addTimer(48, 1); + break; + + case 1: + _game._player._stepEnabled = false; + _game._player._visible = false; + if (_globals[kSexOfRex] == REX_FEMALE) { + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 5, 2, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_SPRITE, 5, 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 3); + } else { + _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 5, 2, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_SPRITE, 6, 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 3); + } + break; + + case 2: { + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 6, 0, 0, 0); + int idx = _scene->_dynamicHotspots.add(0x3B6, 0xD, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(230, 117), FACING_NORTHWEST); + _scene->changeVariant(0); + } + break; + + case 3: + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x100)); + _game._objects.setRoom(0x2F, _scene->_currentSceneId); + _game._player._visible = true; + if (corridorExit) + _scene->_sequences.addTimer(48, 6); + else if (doorwayExit) + _scene->_sequences.addTimer(48, 4); + else { + _mustPutArmDownFl = false; + _game._player._stepEnabled = true; + } + break; + + case 4: + _game._player.walk(Common::Point(116, 107), FACING_NORTH); + _game._player._stepEnabled = true; + _mustPutArmDownFl = false; + _scene->_sequences.addTimer(180, 5); + _leaveRoomFl = true; + break; + + case 5: + if (_leaveRoomFl) + _scene->_nextSceneId = 351; + + break; + + case 6: + _game._player.walk(Common::Point(171, 152), FACING_SOUTH); + _game._player._stepEnabled = true; + _mustPutArmDownFl = false; + _scene->_sequences.addTimer(180, 7); + _leaveRoomFl = true; + break; + + case 7: + if (_leaveRoomFl) + _scene->_nextSceneId = 353; + + break; + + default: + break; + } +} + +void Scene352::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites("*RM302x0"); + _globals._spriteIndexes[13] = _scene->_sprites.addSprites("*RM302x2"); + _globals._spriteIndexes[12] = _scene->_sprites.addSprites("*RM302x3"); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('g', -1)); + _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('b', -1)); + + + if (_globals[kSexOfRex] == REX_FEMALE) { + _globals._spriteIndexes[3] = _scene->_sprites.addSprites("*ROXRC_7"); + _globals._spriteIndexes[7] = _scene->_sprites.addSprites("*ROXRC_6"); + _globals._spriteIndexes[15] = _scene->_sprites.addSprites("*ROXRC_9"); + _globals._spriteIndexes[11] = _scene->_sprites.addSprites(formAnimName('a', 3)); + _globals._spriteIndexes[9] = _scene->_sprites.addSprites(formAnimName('a', 2)); + } else { + _globals._spriteIndexes[4] = _scene->_sprites.addSprites("*RXRD_7"); + _globals._spriteIndexes[6] = _scene->_sprites.addSprites("*RXRC_6"); + _globals._spriteIndexes[14] = _scene->_sprites.addSprites("*RXMRC_9"); + _globals._spriteIndexes[10] = _scene->_sprites.addSprites(formAnimName('a', 1)); + _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('a', 0)); + } + + _leaveRoomFl = false; + + if (_game._objects.isInRoom(OBJ_TAPE_PLAYER)) { + _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 12, 0, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 5); + int idx = _scene->_dynamicHotspots.add(0x165, 0xD, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); + _tapePlayerHotspotIdx = _scene->_dynamicHotspots.setPosition(idx, Common::Point(84, 145), FACING_WEST); + } + + _vaultOpenFl = false; + + if (_scene->_priorSceneId != -2) { + _mustPutArmDownFl = false; + if (!_game._visitedScenes._sceneRevisited) + _globals[kHaveYourStuff] = false; + } + + if (_game._objects.isInRoom(OBJ_GUARDS_ARM)) { + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 6, 0, 0, 0); + int idx = _scene->_dynamicHotspots.add(0x3B6, 0xD, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(230, 117), FACING_NORTHWEST); + } else + _mustPutArmDownFl = true; + + if (_scene->_priorSceneId == 353) + _game._player._playerPos = Common::Point(171, 155); + else if (_scene->_priorSceneId != -2) + _game._player._playerPos = Common::Point(116, 107); + + sceneEntrySound(); + + _game.loadQuoteSet(0xFF, 0x100, 0x101, 0x102, 0x103, 0); +} + +void Scene352::preActions() { + _leaveRoomFl = false; + + if (_action.isAction(VERB_OPEN, 0x1F8)) + _game._player.walk(Common::Point(266, 111), FACING_NORTHEAST); + + if (_vaultOpenFl && !_action.isAction(0x1F8) && !_action.isAction(0x2F6) && !_action.isAction(0x2F5) && !_action.isAction(0x2F4)) { + if (_globals[kHaveYourStuff]) { + _commonSpriteIndex = _globals._spriteIndexes[13]; + _commonSequenceIdx = _globals._sequenceIndexes[13]; + } else { + _commonSpriteIndex = _globals._spriteIndexes[1]; + _commonSequenceIdx = _globals._sequenceIndexes[1]; + } + + switch (_game._trigger) { + case 0: + if (_game._player._needToWalk) { + _game._player._stepEnabled = false; + _scene->_sequences.remove(_commonSequenceIdx); + _vm->_sound->command(20); + _commonSequenceIdx = _scene->_sequences.startReverseCycle(_commonSpriteIndex, false, 6, 1, 0, 0); + _scene->_sequences.addSubEntry(_commonSequenceIdx, SEQUENCE_TRIGGER_EXPIRE, 0, 1); + _scene->_sequences.setDepth(_commonSequenceIdx, 15); + } + break; + + case 1: + if (!_globals[kHaveYourStuff]) + _scene->_dynamicHotspots.remove(_hotspot2Idx); + + _scene->_dynamicHotspots.remove(_hotspot1Idx); + _scene->_dynamicHotspots.remove(_lampHostpotIdx); + _vaultOpenFl = false; + _game._player._stepEnabled = true; + break; + + default: + break; + } + } + + if (_action.isAction(VERB_PUT, 0x3B6, 0x1F3)) { + if (_globals[kSexOfRex] == REX_MALE) + _game._player.walk(Common::Point(269, 111), FACING_NORTHEAST); + else + _game._player.walk(Common::Point(271, 111), FACING_NORTHEAST); + } + + if (_action.isAction(0x18B, 0x70) || _action.isAction(0x1AD, 0x2B3) || _action.isAction(VERB_PUT, 0x3B6, 0x89)) { + if (_game._objects.isInInventory(OBJ_GUARDS_ARM)) + _game._player.walk(Common::Point(230, 117), FACING_NORTHWEST); + } +} + +void Scene352::actions() { + if (_action._lookFlag) { + _vm->_dialogs->show(0x8999); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_OPEN, 0x1F8)) { + if (!_vaultOpenFl) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + if (_globals[kSexOfRex] == REX_FEMALE) + _commonSpriteIndex = _globals._spriteIndexes[9]; + else + _commonSpriteIndex = _globals._spriteIndexes[8]; + + _commonSequenceIdx = _scene->_sequences.addSpriteCycle(_commonSpriteIndex, false, 8, 1, 0, 0); + _scene->_sequences.updateTimeout(_commonSequenceIdx, -1); + _scene->_sequences.addSubEntry(_commonSequenceIdx, SEQUENCE_TRIGGER_EXPIRE, 0, 1); + break; + + case 1: { + _vm->_sound->command(21); + _globals._sequenceIndexes[12] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[12], false, 7, 2, 20, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[12], FACING_NORTH); + int oldIdx = _commonSequenceIdx; + _commonSequenceIdx = _scene->_sequences.startCycle(_commonSpriteIndex, false, -2); + _scene->_sequences.updateTimeout(_commonSequenceIdx, oldIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + } + break; + + case 2: + _vm->_sound->command(22); + _scene->_sequences.remove(_commonSequenceIdx); + _commonSequenceIdx = _scene->_sequences.startReverseCycle(_commonSpriteIndex, false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_commonSequenceIdx, 1, 3); + _scene->_sequences.addSubEntry(_commonSequenceIdx, SEQUENCE_TRIGGER_EXPIRE, 0, 3); + break; + + case 3: + _scene->_sequences.updateTimeout(-1, _commonSequenceIdx); + _game._player._visible = true; + _scene->_sequences.addTimer(60, 4); + break; + + case 4: + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x101)); + _game._player._stepEnabled = true; + break; + } + } + _action._inProgress = false; + return; + } + + if (_game._objects.isInInventory(OBJ_GUARDS_ARM)) { + _mustPutArmDownFl = true; + } + + bool exit_corridor = false; + bool exit_doorway = false; + + if (_action.isAction(0x1AD, 0x2B3)) { + exit_corridor = true; + } + + if (_action.isAction(0x18B, 0x70)) { + exit_doorway = true; + } + + if (_action.isAction(0x1AD, 0x2B3) || _action.isAction(0x18B, 0x70) || _action.isAction(VERB_PUT, 0x3B6, 0x89)) { + if (_mustPutArmDownFl) + putArmDown(exit_corridor, exit_doorway); + else if (exit_corridor) + _scene->_nextSceneId = 353; + else + _scene->_nextSceneId = 351; + + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_TAKE, 0x3B6)) { + if (_game._trigger || !_game._objects.isInInventory(OBJ_GUARDS_ARM)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + if (_globals[kSexOfRex] == REX_FEMALE) { + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 5, 2, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_SPRITE, 5, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + } else { + _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 5, 2, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_SPRITE, 6, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + } + break; + + case 1: + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _game._objects.addToInventory(0x2F); + _scene->changeVariant(1); + break; + + case 2: + _game._player._visible = true; + _game._player._stepEnabled = true; + _vm->_dialogs->showItem(0x2F, 0x899C); + break; + } + _action._inProgress = false; + return; + } + } + + if (_action.isAction(VERB_PUT, 0x3B6, 0x1F3)) { + if (!_vaultOpenFl) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + if (_globals[kSexOfRex] == REX_FEMALE) + _commonSpriteIndex = _globals._spriteIndexes[11]; + else + _commonSpriteIndex = _globals._spriteIndexes[10]; + + _commonSequenceIdx = _scene->_sequences.addSpriteCycle(_commonSpriteIndex, false, 8, 1, 0, 0); + _scene->_sequences.updateTimeout(_commonSequenceIdx, -1); + _scene->_sequences.addSubEntry(_commonSequenceIdx, SEQUENCE_TRIGGER_EXPIRE, 0, 1); + break; + + case 1: { + _vm->_sound->command(21); + _globals._sequenceIndexes[12] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[12], false, 7, 2, 20, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[12], 8); + int oldIdx = _commonSequenceIdx; + _commonSequenceIdx = _scene->_sequences.startCycle(_commonSpriteIndex, false, -2); + _scene->_sequences.updateTimeout(_commonSequenceIdx, oldIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + } + break; + + case 2: + _vm->_sound->command(23); + _scene->_sequences.remove(_commonSequenceIdx); + _commonSequenceIdx = _scene->_sequences.startReverseCycle(_commonSpriteIndex, false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_commonSequenceIdx, 1, 4); + _scene->_sequences.addSubEntry(_commonSequenceIdx, SEQUENCE_TRIGGER_EXPIRE, 0, 3); + break; + + + case 3: + _scene->_sequences.updateTimeout(-1, _commonSequenceIdx); + _game._player._visible = true; + if (_globals[kHaveYourStuff]) + _commonSpriteIndex = _globals._spriteIndexes[13]; + else + _commonSpriteIndex = _globals._spriteIndexes[1]; + + _vm->_sound->command(20); + _commonSequenceIdx = _scene->_sequences.addSpriteCycle(_commonSpriteIndex, false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_commonSequenceIdx, 15); + _scene->_sequences.addSubEntry(_commonSequenceIdx, SEQUENCE_TRIGGER_EXPIRE, 0, 4); + break; + + case 4: + _commonSequenceIdx = _scene->_sequences.addSpriteCycle(_commonSpriteIndex, false, 6, 0, 0, 0); + _scene->_sequences.setAnimRange(_commonSequenceIdx, -2, -2); + _scene->_sequences.setDepth(_commonSequenceIdx, 15); + _scene->_sequences.addTimer(60, 5); + break; + + case 5: { + _vaultOpenFl = true; + int idx; + if (!_globals[kHaveYourStuff]) { + idx = _scene->_dynamicHotspots.add(0x2F4, 0xD, -1, Common::Rect(282, 87, 282 + 13, 87 + 7)); + _hotspot2Idx = _scene->_dynamicHotspots.setPosition(idx, Common::Point(280, 111), FACING_NORTHEAST); + _globals._sequenceIndexes[1] = _commonSequenceIdx; + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x102)); + } else { + _globals._sequenceIndexes[13] = _commonSequenceIdx; + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x103)); + } + + idx = _scene->_dynamicHotspots.add(0x2F5, 0xD, -1, Common::Rect(282, 48, 282 + 36, 48 + 27)); + _hotspot1Idx = _scene->_dynamicHotspots.setPosition(idx, Common::Point(287, 115), FACING_NORTHEAST); + idx = _scene->_dynamicHotspots.add(0x2F6, 0xD, -1, Common::Rect(296, 76, 296 + 11, 76 + 17)); + _lampHostpotIdx = _scene->_dynamicHotspots.setPosition(idx, Common::Point(287, 115), FACING_NORTHEAST); + _game._player._stepEnabled = true; + } + break; + } + } + } else if (_action.isAction(VERB_TAKE, 0x2F4)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + if (_globals[kSexOfRex] == REX_MALE) { + _globals._sequenceIndexes[14] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[14], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[14], 1, 2); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[14]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[14], SEQUENCE_TRIGGER_SPRITE, 2, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[14], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + } else { + _globals._sequenceIndexes[15] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[15], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[15], 1, 2); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[15]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[15], SEQUENCE_TRIGGER_SPRITE, 2, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[15], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + } + break; + + case 1: + _scene->_dynamicHotspots.remove(_hotspot2Idx); + _globals[kHaveYourStuff] = true; + + for (uint16 i = 0; i < _game._objects.size(); i++) { + if (_game._objects[i]._roomNumber == 50) + _game._objects.addToInventory(i); + } + + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[13] = _scene->_sequences.startCycle(_globals._spriteIndexes[13], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 15); + break; + + case 2: + if (_globals[kSexOfRex] == REX_MALE) + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[14]); + else + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[15]); + + _game._player._visible = true; + _game._player._stepEnabled = true; + break; + + default: + break; + } + } else if (_action.isAction(VERB_TAKE, 0x165) && !_game._objects.isInInventory(OBJ_TAPE_PLAYER)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + if (_globals[kSexOfRex] == REX_MALE) { + _globals._sequenceIndexes[6] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[6], true, 6, 2, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[6]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_SPRITE, 6, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + } else { + _globals._sequenceIndexes[7] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[7], true, 6, 2, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[7]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SEQUENCE_TRIGGER_SPRITE, 6, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + } + break; + + case 1: + _scene->_sequences.remove(_globals._sequenceIndexes[5]); + _scene->_dynamicHotspots.remove(_tapePlayerHotspotIdx); + break; + + case 2: + _game._objects.addToInventory(OBJ_TAPE_PLAYER); + if (_globals[kSexOfRex] == REX_MALE) + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[6]); + else + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[7]); + + _game._player._visible = true; + _game._player._stepEnabled = true; + _vm->_dialogs->showItem(OBJ_TAPE_PLAYER, 0x899B); + break; + + default: + break; + } + } else if (_action.isAction(VERB_LOOK, 0x1F3)) + _vm->_dialogs->show(0x898A); + else if (_action.isAction(VERB_LOOK, 0xE2)) { + if (_game._storyMode == STORYMODE_NAUGHTY) + _vm->_dialogs->show(0x898B); + else + _vm->_dialogs->show(0x898C); + } else if (_action.isAction(VERB_LOOK, 0x1CC)) + _vm->_dialogs->show(0x898D); + else if (_action.isAction(VERB_LOOK, 0x2CD)) + _vm->_dialogs->show(0x898E); + else if (_action.isAction(VERB_LOOK, 0x165) && (_action._savedFields._mainObjectSource == 4)) + _vm->_dialogs->show(0x898F); + else if (_action.isAction(VERB_LOOK, 0x11)) + _vm->_dialogs->show(0x8990); + else if (_action.isAction(VERB_LOOK, 0x3B6) && (_action._savedFields._mainObjectSource == 4)) + _vm->_dialogs->show(0x8991); + else if (_action.isAction(VERB_LOOK, 0x2DA)) + _vm->_dialogs->show(0x8992); + else if (_action.isAction(VERB_LOOK, 0x51)) + _vm->_dialogs->show(0x8993); + else if (_action.isAction(VERB_LOOK, 0x2CE)) + _vm->_dialogs->show(0x8994); + else if (_action.isAction(VERB_LOOK, 0x1F8)) { + if (!_vaultOpenFl) + _vm->_dialogs->show(0x8995); + } else if (_action.isAction(VERB_LOOK, 0x2F4)) + _vm->_dialogs->show(0x8996); + else if (_action.isAction(VERB_LOOK, 0x2F5)) + _vm->_dialogs->show(0x8997); + else if (_action.isAction(VERB_LOOK, 0x2B3)) + _vm->_dialogs->show(0x8998); + else if (_action.isAction(VERB_TAKE, 0x2F5)) + _vm->_dialogs->show(0x899A); + else if (_action.isAction(VERB_LOOK, 0x1E4)) + _vm->_dialogs->show(0x899D); + else if (_action.isAction(VERB_LOOK, 0x239)) + _vm->_dialogs->show(0x899E); + else if (_action.isAction(VERB_LOOK, 0x70)) + _vm->_dialogs->show(0x899F); + else if (_action.isAction(VERB_LOOK, 0x160)) + _vm->_dialogs->show(0x89A0); + else if (_action.isAction(VERB_LOOK, 0x3B5)) + _vm->_dialogs->show(0x89A1); + else if (_action.isAction(VERB_LOOK, 0x257)) + _vm->_dialogs->show(0x89A2); + else if (_action.isAction(VERB_LOOK, 0x1F5)) + _vm->_dialogs->show(0x89A3); + else + return; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h index 5be10ac258..1834ffe4c1 100644 --- a/engines/mads/nebular/nebular_scenes3.h +++ b/engines/mads/nebular/nebular_scenes3.h @@ -360,6 +360,33 @@ public: virtual void actions(); virtual void postActions() {}; }; + +class Scene352: public Scene3xx { +private: + bool _vaultOpenFl; + bool _mustPutArmDownFl; + bool _leaveRoomFl; + + int _tapePlayerHotspotIdx; + int _hotspot1Idx; + int _hotspot2Idx; + int _lampHostpotIdx; + int _commonSequenceIdx; + int _commonSpriteIndex; + + void putArmDown(bool corridorExit, bool doorwayExit); + +public: + Scene352(MADSEngine *vm) : Scene3xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step() {}; + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 1e024f42605effeb6928ff5c0f5177a6ff9edcb3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 27 Apr 2014 00:05:26 +0200 Subject: MADS: Implement scene 353 --- engines/mads/nebular/nebular_scenes.cpp | 5 ++++ engines/mads/nebular/nebular_scenes3.cpp | 47 ++++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes3.h | 12 ++++++++ 3 files changed, 64 insertions(+) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index df2433d166..21c3e9cd58 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -134,6 +134,11 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 351: return new Scene351(vm); + case 352: + return new Scene352(vm); + case 353: + return new Scene353(vm); + // Scene group #8 case 804: return new Scene804(vm); diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index b812d432c9..22b3c71c95 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -4374,5 +4374,52 @@ void Scene352::actions() { /*------------------------------------------------------------------------*/ +void Scene353::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene353::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(Resources::formatName(303, 'B', 0, EXT_SS, "")); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 5, 0, 5, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); + + if (_scene->_priorSceneId == 352) + _game._player._playerPos = Common::Point(144, 95); + else + _game._player._playerPos = Common::Point(139, 155); + + sceneEntrySound(); +} + +void Scene353::actions() { + if (_action._lookFlag) + _vm->_dialogs->show(0x89F3); + else if (_action.isAction(0x18B, 0x70)) + _scene->_nextSceneId = 352; + else if (_action.isAction(0x1AD, 0x2B3)) + _scene->_nextSceneId = 354; + else if (_action.isAction(VERB_LOOK, 0x23D)) + _vm->_dialogs->show(0x89EE); + else if (_action.isAction(VERB_LOOK, 0x1FA) || _action.isAction(VERB_LOOK, 0x10C)) + _vm->_dialogs->show(0x89EF); + else if (_action.isAction(VERB_LOOK, 0x23C)) + _vm->_dialogs->show(0x89F0); + else if (_action.isAction(VERB_LOOK, 0x70)) + _vm->_dialogs->show(0x89F1); + else if (_action.isAction(VERB_LOOK, 0x2B3)) + _vm->_dialogs->show(0x89F2); + else if (_action.isAction(VERB_LOOK, 0x89)) + _vm->_dialogs->show(0x89F4); + else if (_action.isAction(VERB_LOOK, 0x46)) + _vm->_dialogs->show(0x89F5); + else if (_action.isAction(VERB_LOOK, 0x18D)) + _vm->_dialogs->show(0x89F6); + else + return; + + _action._inProgress = false; +} + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h index 1834ffe4c1..20cd1c331f 100644 --- a/engines/mads/nebular/nebular_scenes3.h +++ b/engines/mads/nebular/nebular_scenes3.h @@ -387,6 +387,18 @@ public: virtual void postActions() {}; }; +class Scene353: public Scene3xx { +public: + Scene353(MADSEngine *vm) : Scene3xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step() {}; + virtual void preActions() {}; + virtual void actions(); + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 6405d96ae487d0a29e6f641eaa4fdb55570586d9 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 27 Apr 2014 00:46:37 +0200 Subject: MADS: Implement scene 354 --- engines/mads/nebular/nebular_scenes3.cpp | 69 ++++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes3.h | 12 ++++++ 2 files changed, 81 insertions(+) diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 22b3c71c95..41777b116e 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -4421,5 +4421,74 @@ void Scene353::actions() { _action._inProgress = false; } +/*------------------------------------------------------------------------*/ + +void Scene354::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene354::enter() { + _globals[kAfterHavoc] = true; + _globals[kTeleporterRoom + 1] = 351; + + if (_scene->_priorSceneId == 361) + _game._player._playerPos = Common::Point(231, 110); + else if (_scene->_priorSceneId == 401) { + _game._player._playerPos = Common::Point(106, 152); + _game._player._facing = FACING_NORTH; + } else if (_scene->_priorSceneId == 316) + _game._player._playerPos = Common::Point(71, 107); + else if (_scene->_priorSceneId != -2) + _game._player._playerPos = Common::Point(167, 57); + + sceneEntrySound(); +} + +void Scene354::preActions() { + if (_action.isAction(0x1AD, 0x2B3)) + _game._player._walkOffScreenSceneId = 401; +} + +void Scene354::actions() { + if (_action._lookFlag) + _vm->_dialogs->show(0x8A56); + else if (_action.isAction(0x1AD, 0x2B4)) { + _game._player.startWalking(Common::Point(208, 0), FACING_NORTHEAST); + _game._player._walkOffScreenSceneId = 353; + } else if (_action.isAction(0x1AD, 0x2B9)) + _scene->_nextSceneId = 361; + else if (_action.isAction(0x1AD, 0x2BA)) + _scene->_nextSceneId = 316; + else if (_action.isAction(0x1AD, 0x2B3)) + _scene->_nextSceneId = 401; + else if (_action.isAction(VERB_LOOK, 0x2C6)) + _vm->_dialogs->show(0x8A52); + else if (_action.isAction(VERB_LOOK, 0x1FD)) + _vm->_dialogs->show(0x8A53); + else if (_action.isAction(VERB_LOOK, 0x2D0)) + _vm->_dialogs->show(0x8A54); + else if (_action.isAction(VERB_LOOK, 0x206)) + _vm->_dialogs->show(0x8A55); + else if (_action.isAction(VERB_LOOK, 0x2B4)) + _vm->_dialogs->show(0x8A57); + else if (_action.isAction(VERB_LOOK, 0x2B3)) + _vm->_dialogs->show(0x8A58); + else if (_action.isAction(VERB_LOOK, 0x2B9)) + _vm->_dialogs->show(0x8A59); + else if (_action.isAction(VERB_LOOK, 0x2BA)) + _vm->_dialogs->show(0x8A5A); + else if (_action.isAction(VERB_LOOK, 0x218)) + _vm->_dialogs->show(0x8A5B); + else if (_action.isAction(VERB_LOOK, 0x239)) + _vm->_dialogs->show(0x8A5C); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h index 20cd1c331f..8950fa5981 100644 --- a/engines/mads/nebular/nebular_scenes3.h +++ b/engines/mads/nebular/nebular_scenes3.h @@ -399,6 +399,18 @@ public: virtual void postActions() {}; }; +class Scene354: public Scene3xx { +public: + Scene354(MADSEngine *vm) : Scene3xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step() {}; + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 2cff7557fe57581c578b8eb17e099597ee33cbc1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 26 Apr 2014 22:35:28 -0400 Subject: MADS: Beginnings of full screen dialogs --- engines/mads/game.cpp | 14 ++ engines/mads/nebular/dialogs_nebular.cpp | 240 +++++++++++++++++++++++++++++++ engines/mads/nebular/dialogs_nebular.h | 78 +++++++++- 3 files changed, 329 insertions(+), 3 deletions(-) diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 9a5ec1264b..d9d1fea0bb 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -423,6 +423,20 @@ void Game::handleKeypress(const Common::Event &event) { } } + switch (event.kbd.keycode) { + case Common::KEYCODE_F1: + _vm->_dialogs->_pendingDialog = DIALOG_GAME_MENU; + break; + case Common::KEYCODE_F5: + _vm->_dialogs->_pendingDialog = DIALOG_SAVE; + break; + case Common::KEYCODE_F7: + _vm->_dialogs->_pendingDialog = DIALOG_RESTORE; + break; + default: + break; + } + warning("TODO: handleKeypress - %d", (int)event.kbd.keycode); } diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp index 3606830abc..98e05ade25 100644 --- a/engines/mads/nebular/dialogs_nebular.cpp +++ b/engines/mads/nebular/dialogs_nebular.cpp @@ -320,6 +320,246 @@ bool DialogsNebular::commandCheck(const char *idStr, Common::String &valStr, return true; } +void DialogsNebular::showDialog() { + switch (_pendingDialog) { + case DIALOG_GAME_MENU: + //GameMenuDialog::show(); + break; + } +} + +/*------------------------------------------------------------------------*/ + +ScreenDialog::DialogLine::DialogLine() { + _state = 0; + _textDisplayIndex = -1; + _font = nullptr; + _widthAdjust = 0; +} + +ScreenDialog::DialogLine::DialogLine(const Common::String &s) { + _state = 0; + _textDisplayIndex = -1; + _font = nullptr; + _widthAdjust = -1; + _msg = s; +} + +/*------------------------------------------------------------------------*/ + +ScreenDialog::ScreenDialog(MADSEngine *vm) : _vm(vm), + _savedSurface(MADS_SCREEN_WIDTH, MADS_SCREEN_HEIGHT) { + Game &game = *_vm->_game; + Scene &scene = game._scene; + + _v1 = 0; + _selectedLine = 0; + _dirFlag = false; + _textLineCount = 0; + + game.loadQuoteSet(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 0); + game._kernelMode = KERNEL_ROOM_PRELOAD; + _vm->_events->waitCursor(); + scene.clearVocab(); + scene._dynamicHotspots.clear(); + _vm->_dialogs->_defaultPosition = Common::Point(-1, -1); + + bool palFlag = false; + int nextSceneId = scene._nextSceneId; + int currentSceneId = scene._currentSceneId; + int priorSceneId = scene._priorSceneId; + + if (_vm->_dialogs->_pendingDialog == DIALOG_DIFFICULTY) { + palFlag = true; + } else { + _vm->_palette->initPalette(); + } + scene.loadScene(_screenId, game._aaName, palFlag); + + scene._priorSceneId = priorSceneId; + scene._currentSceneId = currentSceneId; + scene._nextSceneId = nextSceneId; + _vm->_screen._offset.y = 22; + _vm->_sound->pauseNewCommands(); + _vm->_events->initVars(); + game._kernelMode = KERNEL_ROOM_INIT; + + SpriteAsset *menuSprites = new SpriteAsset(_vm, "*MENU", 0); + _menuSpritesIndex = scene._sprites.add(menuSprites); + + byte pal[768]; + if (_vm->_screenFade) { + Common::fill(&pal[0], &pal[PALETTE_SIZE], 0); + _vm->_palette->setFullPalette(pal); + } else { + _vm->_palette->getFullPalette(pal); + _vm->_palette->fadeOut(pal, 0, PALETTE_COUNT, 16, 1, 1, 0, 0, 0); + } + + _vm->_screen.copyTo(&_savedSurface); + /* + _vm->_screen.hLine(0, 0, MADS_SCREEN_WIDTH, 2); + _vm->_screen.copyRectToScreen(Common::Rect(0, _vm->_screen._offset.y, + MADS_SCREEN_WIDTH, _vm->_screen._offset.y + 1)); + _vm->_screen.copyRectToScreen(Common::Rect(0, _vm->_screen._offset.y + 157, + MADS_SCREEN_WIDTH, _vm->_screen._offset.y + 157)); + */ + + game._fx = _vm->_screenFade == SCREEN_FADE_SMOOTH ? + kCenterVertTransition : kTransitionFadeIn; + game._trigger = 0; + _vm->_events->setCursor(CURSOR_ARROW); + + _vm->_palette->setEntry(10, 0, 63, 0); + _vm->_palette->setEntry(11, 0, 45, 0); + _vm->_palette->setEntry(12, 63, 63, 0); + _vm->_palette->setEntry(13, 45, 45, 0); + _vm->_palette->setEntry(14, 63, 63, 63); + _vm->_palette->setEntry(15, 45, 45, 45); +} + +void ScreenDialog::clearLines() { + Scene &scene = _vm->_game->_scene; + _lines.clear(); + scene._spriteSlots.fullRefresh(true); +} + +void ScreenDialog::addQuote(int id1, int id2, DialogTextAlign align, + const Common::Point &pt, Font *font) { + Common::String msg = _vm->_game->getQuote(id1); + + if (id2 > 0) { + msg += " "; + msg += _vm->_game->getQuote(id2); + } + + addLine(msg, align, pt, font); +} + +void ScreenDialog::addLine(const Common::String &msg, DialogTextAlign align, + const Common::Point &pt, Font *font) { + Scene &scene = _vm->_game->_scene; + DialogLine *line; + + if (_lineIndex < (int)_lines.size()) { + if (_lines.size() >= 20) + goto finish; + + _lines.push_back(msg); + line = &_lines[_lines.size() - 1]; + } else { + line = &_lines[_lineIndex]; + if (msg.compareToIgnoreCase(msg)) + goto finish; + + if (line->_textDisplayIndex >= 0) { + TextDisplay &textDisplay = scene._textDisplay[line->_textDisplayIndex]; + if (textDisplay._active) { + textDisplay._expire = -1; + if (_textLineCount < 20) { + textDisplay._msg = msg; + ++_textLineCount; + } + } + } + } + + line->_font = font; + line->_state = 0; + line->_pos = pt; + line->_widthAdjust = -1; + line->_textDisplayIndex = -1; + + int xOffset; + switch (align) { + case ALIGN_CENTER: + xOffset = (MADS_SCREEN_WIDTH / 2) - font->getWidth(msg, -1) / 2; + line->_pos.x += xOffset; + break; + + case ALIGN_AT_CENTER: { + const char *msgP = msg.c_str(); + const char *ch = strchr(msgP, '@'); + if (ch) { + xOffset = (MADS_SCREEN_WIDTH / 2) - font->getWidth( + Common::String(msgP, ch), line->_widthAdjust); + line->_pos.x += xOffset; + } + break; + } + + case ALIGN_RIGHT: + xOffset = font->getWidth(msg, -1); + line->_pos.x -= xOffset; + break; + + default: + break; + } + +finish: + ++_lineIndex; +} + + +void ScreenDialog::initVars() { + _v1 = -1; + _selectedLine = -1; + _lineIndex = 0; + _enterFlag = false; + _textLineCount = 0; +} + +void ScreenDialog::chooseBackground() { + switch (_vm->_game->_currentSectionNumber) { + case 1: + case 2: + _screenId = 921; + break; + case 3: + case 4: + _screenId = 922; + break; + case 5: + case 6: + case 7: + _screenId = 923; + break; + case 8: + _screenId = 924; + break; + default: + _screenId = 920; + break; + } +} + +void ScreenDialog::setFrame(int frameNumber, int depth) { + Scene &scene = _vm->_game->_scene; + SpriteSlot &spriteSlot = scene._spriteSlots[scene._spriteSlots.add()]; + spriteSlot._flags = IMG_UPDATE; + spriteSlot._seqIndex = 1; + spriteSlot._spritesIndex = _menuSpritesIndex; + spriteSlot._frameNumber = frameNumber; + +} + +/*------------------------------------------------------------------------*/ + +GameMenuDialog::GameMenuDialog(MADSEngine *vm) : ScreenDialog(vm) { + clearLines(); + setFrame(1, 2); +} + +void GameMenuDialog::addLines() { + initVars(); + Font *font = _vm->_font->getFont(FONT_CONVERSATION); + int top = 78 - (font->getHeight() + 2) * 12; + addQuote(10, 0, ALIGN_CENTER, Common::Point(0, top), font); + // TODO +} } // End of namespace Nebular diff --git a/engines/mads/nebular/dialogs_nebular.h b/engines/mads/nebular/dialogs_nebular.h index 041dedadd5..b5ee090efa 100644 --- a/engines/mads/nebular/dialogs_nebular.h +++ b/engines/mads/nebular/dialogs_nebular.h @@ -47,9 +47,7 @@ private: bool commandCheck(const char *idStr, Common::String &valStr, const Common::String &command); public: - virtual void showDialog() { - warning("TODO: showDialog"); - } + virtual void showDialog(); virtual void showItem(int objectId, int msgId, int arg); @@ -84,6 +82,80 @@ public: bool show(); }; +enum DialogTextAlign { ALIGN_CENTER = -1, ALIGN_AT_CENTER = -2, ALIGN_RIGHT = -3 }; + +class ScreenDialog { + struct DialogLine { + int _state; + Common::Point _pos; + int _textDisplayIndex; + Common::String _msg; + Font *_font; + int _widthAdjust; + + DialogLine(); + DialogLine(const Common::String &s); + }; +protected: + MADSEngine *_vm; + MSurface _savedSurface; + Common::Array _lines; + int _v1; + int _selectedLine; + bool _dirFlag; + int _screenId; + int _menuSpritesIndex; + int _lineIndex; + bool _enterFlag; + int _textLineCount; + + /** + * Reset the lines list for the dialog + */ + void clearLines(); + + /** + * Add a quote to the lines list + */ + void addQuote(int id1, int id2, DialogTextAlign align, const Common::Point &pt, Font *font); + + /** + * Adds a line to the lines list + */ + void addLine(const Common::String &msg, DialogTextAlign align, const Common::Point &pt, Font *font); + + /** + * Initializes variables + */ + void initVars(); + + /** + * Sets the display for the screen background behind the dialog + */ + void setFrame(int frameNumber, int depth); + + /** + * Choose the background to display for the dialog + */ + void chooseBackground(); +public: + /** + * Constructor + */ + ScreenDialog(MADSEngine *vm); +}; + +class GameMenuDialog : public ScreenDialog { +private: + /** + * Add the lines for the Game Menu dialog + */ + void addLines(); +public: + GameMenuDialog(MADSEngine *vm); + +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From da1b4c8316d0b960b6e44553a965e863c6ba2345 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 27 Apr 2014 10:28:28 +0200 Subject: MADS: Implement scene 357 --- engines/mads/nebular/nebular_scenes.cpp | 4 ++ engines/mads/nebular/nebular_scenes3.cpp | 67 ++++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes3.h | 11 ++++++ 3 files changed, 82 insertions(+) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 21c3e9cd58..00b49d014f 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -138,6 +138,10 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene352(vm); case 353: return new Scene353(vm); + case 354: + return new Scene354(vm); + case 357: + return new Scene357(vm); // Scene group #8 case 804: diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 41777b116e..e7f1dda703 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -4490,5 +4490,72 @@ void Scene354::actions() { /*------------------------------------------------------------------------*/ +void Scene357::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene357::enter() { + _globals[kAfterHavoc] = true; + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(Resources::formatName(307, 'X', 0, EXT_SS, "")); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(127, 78)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 15); + + if (_scene->_priorSceneId == 318) + _game._player._playerPos = Common::Point(298, 142); + else if (_scene->_priorSceneId == 313) + _game._player._playerPos = Common::Point(127, 101); + else if (_scene->_priorSceneId != -2) + _game._player._playerPos = Common::Point(15, 148); + + sceneEntrySound(); +} + +void Scene357::preActions() { + if (_action.isAction(0x1AD, 0x2B9)) + _game._player._walkOffScreenSceneId = 318; + + if (_action.isAction(0x1AD, 0x2BA)) + _game._player._walkOffScreenSceneId = 358; +} + +void Scene357::actions() { + if (_action._lookFlag) + _vm->_dialogs->show(0x8B83); + else if (_action.isAction(VERB_LOOK, 0x11)) + _vm->_dialogs->show(0x8B7E); + else if (_action.isAction(0x2F7, 0x11)) + _vm->_dialogs->show(0x8B7F); + else if (_action.isAction(VERB_LOOK, 0x1CB)) + _vm->_dialogs->show(0x8B80); + else if (_action.isAction(VERB_LOOK, 0x216)) + _vm->_dialogs->show(0x8B81); + else if (_action.isAction(VERB_LOOK, 0x21B)) + _vm->_dialogs->show(0x8B82); + else if (_action.isAction(VERB_LOOK, 0x207)) + _vm->_dialogs->show(0x8B84); + else if (_action.isAction(VERB_LOOK, 0xCD)) + _vm->_dialogs->show(0x8B85); + else if (_action.isAction(VERB_LOOK, 0x23A)) + _vm->_dialogs->show(0x8B86); + else if (_action.isAction(VERB_LOOK, 0x218)) + _vm->_dialogs->show(0x8B87); + else if (_action.isAction(VERB_TAKE, 0x218)) + _vm->_dialogs->show(0x8B88); + else if (_action.isAction(VERB_LOOK, 0x18D)) + _vm->_dialogs->show(0x8B89); + else if (_action.isAction(VERB_LOOK, 0x2B9)) + _vm->_dialogs->show(0x8B8A); + else if (_action.isAction(VERB_LOOK, 0x2BA)) + _vm->_dialogs->show(0x8B8B); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h index 8950fa5981..e27806b182 100644 --- a/engines/mads/nebular/nebular_scenes3.h +++ b/engines/mads/nebular/nebular_scenes3.h @@ -411,6 +411,17 @@ public: virtual void postActions() {}; }; +class Scene357: public Scene3xx { +public: + Scene357(MADSEngine *vm) : Scene3xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step() {}; + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From bf106aeb6a18dc019c7775f48338346c527f16aa Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 27 Apr 2014 10:47:58 +0200 Subject: MADS: Implement scene 358 --- engines/mads/nebular/nebular_scenes.cpp | 2 ++ engines/mads/nebular/nebular_scenes3.cpp | 52 ++++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes3.h | 12 ++++++++ 3 files changed, 66 insertions(+) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 00b49d014f..46a5e89bdf 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -142,6 +142,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene354(vm); case 357: return new Scene357(vm); + case 358: + return new Scene358(vm); // Scene group #8 case 804: diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index e7f1dda703..647ea67f06 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -4557,5 +4557,57 @@ void Scene357::actions() { /*------------------------------------------------------------------------*/ +void Scene358::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene358::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(Resources::formatName(307, 'X', 0, EXT_SS, "")); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(127, 78)); + _scene->_sequences.setDepth (_globals._sequenceIndexes[1], 15); + + if (_scene->_priorSceneId == 357) + _game._player._playerPos = Common::Point(305, 142); + else if (_scene->_priorSceneId != -2) + _game._player._playerPos = Common::Point(12, 141); + + sceneEntrySound(); +} + +void Scene358::preActions() { + if (_action.isAction(0x1AD, 0x2B9)) + _game._player._walkOffScreenSceneId = 357; + + if (_action.isAction(0x1AD, 0x2BA)) + _game._player._walkOffScreenSceneId = 359; +} + +void Scene358::actions() { + if (_action._lookFlag) + _vm->_dialogs->show(0x8BE7); + else if (_action.isAction(VERB_LOOK, 0x2BA)) + _vm->_dialogs->show(0x8BE2); + else if (_action.isAction(VERB_LOOK, 0x2B9)) + _vm->_dialogs->show(0x8BE3); + else if (_action.isAction(VERB_LOOK, 0x1CB)) + _vm->_dialogs->show(0x8BE4); + else if (_action.isAction(VERB_LOOK, 0x216)) + _vm->_dialogs->show(0x8BE5); + else if (_action.isAction(VERB_LOOK, 0x21B)) + _vm->_dialogs->show(0x8BE6); + else if (_action.isAction(VERB_LOOK, 0x204) || _action.isAction(VERB_LOOK, 0x18D)) + _vm->_dialogs->show(0x8BE8); + else if (_action.isAction(VERB_LOOK, 0x11)) + _vm->_dialogs->show(0x8BE9); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h index e27806b182..60b3bc1869 100644 --- a/engines/mads/nebular/nebular_scenes3.h +++ b/engines/mads/nebular/nebular_scenes3.h @@ -422,6 +422,18 @@ public: virtual void actions(); virtual void postActions() {}; }; + +class Scene358: public Scene3xx { +public: + Scene358(MADSEngine *vm) : Scene3xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step() {}; + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 2e4e0f76aae0121309b86cdbd5ece9be2764b587 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 27 Apr 2014 18:56:41 +0200 Subject: MADS: Implement scene 359 --- engines/mads/nebular/nebular_scenes.cpp | 2 + engines/mads/nebular/nebular_scenes3.cpp | 207 +++++++++++++++++++++++++------ engines/mads/nebular/nebular_scenes3.h | 15 +++ 3 files changed, 189 insertions(+), 35 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 46a5e89bdf..9ef5f05573 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -144,6 +144,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene357(vm); case 358: return new Scene358(vm); + case 359: + return new Scene359(vm); // Scene group #8 case 804: diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 647ea67f06..22f2007b38 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -3702,7 +3702,7 @@ void Scene351::enter() { else if (_scene->_priorSceneId != -2) { _game._player._playerPos = Common::Point(207, 81); _game._player._facing = FACING_NORTH; - } + } if (_globals[kTeleporterCommand]) { _game._player._visible = false; @@ -3775,7 +3775,7 @@ void Scene351::actions() { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; - _game._player._visible = false; + _game._player._visible = false; if (_globals[kSexOfRex] == REX_FEMALE) { _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 5, 2, 0, 0); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[2]); @@ -3786,7 +3786,7 @@ void Scene351::actions() { _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_SPRITE, 6, 1); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 2); - } + } break; case 1: @@ -3858,12 +3858,12 @@ void Scene352::putArmDown(bool corridorExit, bool doorwayExit) { if (_globals[kSexOfRex] == REX_FEMALE) { _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 5, 2, 0, 0); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_SPRITE, 5, 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_SPRITE, 5, 2); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 3); } else { _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 5, 2, 0, 0); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_SPRITE, 6, 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_SPRITE, 6, 2); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 3); } break; @@ -3872,7 +3872,7 @@ void Scene352::putArmDown(bool corridorExit, bool doorwayExit) { _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 6, 0, 0, 0); int idx = _scene->_dynamicHotspots.add(0x3B6, 0xD, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(230, 117), FACING_NORTHWEST); - _scene->changeVariant(0); + _scene->changeVariant(0); } break; @@ -3883,12 +3883,12 @@ void Scene352::putArmDown(bool corridorExit, bool doorwayExit) { _game._player._visible = true; if (corridorExit) _scene->_sequences.addTimer(48, 6); - else if (doorwayExit) + else if (doorwayExit) _scene->_sequences.addTimer(48, 4); else { _mustPutArmDownFl = false; _game._player._stepEnabled = true; - } + } break; case 4: @@ -3903,7 +3903,7 @@ void Scene352::putArmDown(bool corridorExit, bool doorwayExit) { if (_leaveRoomFl) _scene->_nextSceneId = 351; - break; + break; case 6: _game._player.walk(Common::Point(171, 152), FACING_SOUTH); @@ -3917,7 +3917,7 @@ void Scene352::putArmDown(bool corridorExit, bool doorwayExit) { if (_leaveRoomFl) _scene->_nextSceneId = 353; - break; + break; default: break; @@ -4024,9 +4024,9 @@ void Scene352::preActions() { if (_action.isAction(VERB_PUT, 0x3B6, 0x1F3)) { if (_globals[kSexOfRex] == REX_MALE) - _game._player.walk(Common::Point(269, 111), FACING_NORTHEAST); + _game._player.walk(Common::Point(269, 111), FACING_NORTHEAST); else - _game._player.walk(Common::Point(271, 111), FACING_NORTHEAST); + _game._player.walk(Common::Point(271, 111), FACING_NORTHEAST); } if (_action.isAction(0x18B, 0x70) || _action.isAction(0x1AD, 0x2B3) || _action.isAction(VERB_PUT, 0x3B6, 0x89)) { @@ -4042,8 +4042,8 @@ void Scene352::actions() { return; } - if (_action.isAction(VERB_OPEN, 0x1F8)) { - if (!_vaultOpenFl) { + if (_action.isAction(VERB_OPEN, 0x1F8)) { + if (!_vaultOpenFl) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -4061,9 +4061,9 @@ void Scene352::actions() { case 1: { _vm->_sound->command(21); _globals._sequenceIndexes[12] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[12], false, 7, 2, 20, 0); - _scene->_sequences.setDepth(_globals._sequenceIndexes[12], FACING_NORTH); + _scene->_sequences.setDepth(_globals._sequenceIndexes[12], FACING_NORTH); int oldIdx = _commonSequenceIdx; - _commonSequenceIdx = _scene->_sequences.startCycle(_commonSpriteIndex, false, -2); + _commonSequenceIdx = _scene->_sequences.startCycle(_commonSpriteIndex, false, -2); _scene->_sequences.updateTimeout(_commonSequenceIdx, oldIdx); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SEQUENCE_TRIGGER_EXPIRE, 0, 2); } @@ -4110,10 +4110,10 @@ void Scene352::actions() { if (_action.isAction(0x1AD, 0x2B3) || _action.isAction(0x18B, 0x70) || _action.isAction(VERB_PUT, 0x3B6, 0x89)) { if (_mustPutArmDownFl) - putArmDown(exit_corridor, exit_doorway); + putArmDown(exit_corridor, exit_doorway); else if (exit_corridor) _scene->_nextSceneId = 353; - else + else _scene->_nextSceneId = 351; _action._inProgress = false; @@ -4125,7 +4125,7 @@ void Scene352::actions() { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; - _game._player._visible = false; + _game._player._visible = false; if (_globals[kSexOfRex] == REX_FEMALE) { _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 5, 2, 0, 0); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); @@ -4136,13 +4136,13 @@ void Scene352::actions() { _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_SPRITE, 6, 1); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 2); - } + } break; case 1: _scene->_sequences.remove(_globals._sequenceIndexes[2]); _game._objects.addToInventory(0x2F); - _scene->changeVariant(1); + _scene->changeVariant(1); break; case 2: @@ -4157,7 +4157,7 @@ void Scene352::actions() { } if (_action.isAction(VERB_PUT, 0x3B6, 0x1F3)) { - if (!_vaultOpenFl) { + if (!_vaultOpenFl) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -4175,9 +4175,9 @@ void Scene352::actions() { case 1: { _vm->_sound->command(21); _globals._sequenceIndexes[12] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[12], false, 7, 2, 20, 0); - _scene->_sequences.setDepth(_globals._sequenceIndexes[12], 8); + _scene->_sequences.setDepth(_globals._sequenceIndexes[12], 8); int oldIdx = _commonSequenceIdx; - _commonSequenceIdx = _scene->_sequences.startCycle(_commonSpriteIndex, false, -2); + _commonSequenceIdx = _scene->_sequences.startCycle(_commonSpriteIndex, false, -2); _scene->_sequences.updateTimeout(_commonSequenceIdx, oldIdx); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SEQUENCE_TRIGGER_EXPIRE, 0, 2); } @@ -4222,7 +4222,7 @@ void Scene352::actions() { _globals._sequenceIndexes[1] = _commonSequenceIdx; _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x102)); } else { - _globals._sequenceIndexes[13] = _commonSequenceIdx; + _globals._sequenceIndexes[13] = _commonSequenceIdx; _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x103)); } @@ -4239,7 +4239,7 @@ void Scene352::actions() { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; - _game._player._visible = false; + _game._player._visible = false; if (_globals[kSexOfRex] == REX_MALE) { _globals._sequenceIndexes[14] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[14], false, 8, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[14], 1, 2); @@ -4252,7 +4252,7 @@ void Scene352::actions() { _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[15]); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[15], SEQUENCE_TRIGGER_SPRITE, 2, 1); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[15], SEQUENCE_TRIGGER_EXPIRE, 0, 2); - } + } break; case 1: @@ -4265,8 +4265,8 @@ void Scene352::actions() { } _scene->_sequences.remove(_globals._sequenceIndexes[1]); - _globals._sequenceIndexes[13] = _scene->_sequences.startCycle(_globals._spriteIndexes[13], false, -2); - _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 15); + _globals._sequenceIndexes[13] = _scene->_sequences.startCycle(_globals._spriteIndexes[13], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 15); break; case 2: @@ -4286,7 +4286,7 @@ void Scene352::actions() { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; - _game._player._visible = false; + _game._player._visible = false; if (_globals[kSexOfRex] == REX_MALE) { _globals._sequenceIndexes[6] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[6], true, 6, 2, 0, 0); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[6]); @@ -4297,7 +4297,7 @@ void Scene352::actions() { _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[7]); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SEQUENCE_TRIGGER_SPRITE, 6, 1); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SEQUENCE_TRIGGER_EXPIRE, 0, 2); - } + } break; case 1: @@ -4306,7 +4306,7 @@ void Scene352::actions() { break; case 2: - _game._objects.addToInventory(OBJ_TAPE_PLAYER); + _game._objects.addToInventory(OBJ_TAPE_PLAYER); if (_globals[kSexOfRex] == REX_MALE) _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[6]); else @@ -4382,7 +4382,7 @@ void Scene353::setup() { void Scene353::enter() { _globals._spriteIndexes[1] = _scene->_sprites.addSprites(Resources::formatName(303, 'B', 0, EXT_SS, "")); _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 5, 0, 5, 0); - _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); if (_scene->_priorSceneId == 352) _game._player._playerPos = Common::Point(144, 95); @@ -4503,7 +4503,7 @@ void Scene357::enter() { _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 15); if (_scene->_priorSceneId == 318) - _game._player._playerPos = Common::Point(298, 142); + _game._player._playerPos = Common::Point(298, 142); else if (_scene->_priorSceneId == 313) _game._player._playerPos = Common::Point(127, 101); else if (_scene->_priorSceneId != -2) @@ -4566,7 +4566,7 @@ void Scene358::enter() { _globals._spriteIndexes[1] = _scene->_sprites.addSprites(Resources::formatName(307, 'X', 0, EXT_SS, "")); _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(127, 78)); - _scene->_sequences.setDepth (_globals._sequenceIndexes[1], 15); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 15); if (_scene->_priorSceneId == 357) _game._player._playerPos = Common::Point(305, 142); @@ -4609,5 +4609,142 @@ void Scene358::actions() { /*------------------------------------------------------------------------*/ +void Scene359::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(0xD); +} + +void Scene359::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('b', -1)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(Resources::formatName(307, 'X', 0, EXT_SS, "")); + + if (_globals[kSexOfRex] == REX_MALE) + _globals._spriteIndexes[2] = _scene->_sprites.addSprites("*RXMBD_2", false); + else + _globals._spriteIndexes[4] = _scene->_sprites.addSprites("*ROXBD_2", false); + + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[3], Common::Point(127, 78)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 15); + + if (_game._objects.isInRoom(OBJ_SECURITY_CARD)) { + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 9, 0, 0, 0); + _cardHotspotId = _scene->_dynamicHotspots.add(0x131, 0xD, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(_cardHotspotId, Common::Point(107, 107), FACING_SOUTH); + } + + if (_scene->_priorSceneId == 358) + _game._player._playerPos = Common::Point(301, 141); + else if (_scene->_priorSceneId != -2) + _game._player._playerPos = Common::Point(15, 148); + + sceneEntrySound(); +} + +void Scene359::preActions() { + if (_action.isAction(0x1AD, 0x2B9)) + _game._player._walkOffScreenSceneId = 358; + + if (_action.isAction(0x1AD, 0x2BA)) + _game._player._walkOffScreenSceneId = 360; +} + +void Scene359::actions() { + if (_action._lookFlag) { + if ((_game._difficulty != DIFFICULTY_HARD) && (_game._objects[OBJ_SECURITY_CARD]._roomNumber == 359)) + _vm->_dialogs->show(0x8C4A); + else + _vm->_dialogs->show(0x8C4B); + } else if (_action.isAction(VERB_TAKE, 0x131)) { + if (_game._trigger || !_game._objects.isInInventory(OBJ_SECURITY_CARD)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + _vm->_dialogs->show(0x8C50); + if (_globals[kSexOfRex] == REX_MALE) { + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 4, 2, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[2]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_SPRITE, 6, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + } else { + _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], true, 7, 2, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(106, 110)); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_SPRITE, 6, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + } + break; + + case 1: + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _scene->_dynamicHotspots.remove(_cardHotspotId); + _vm->_sound->command(57); + _game._objects.addToInventory(OBJ_SECURITY_CARD); + _vm->_dialogs->showItem(OBJ_SECURITY_CARD, 0x330); + _scene->changeVariant(1); + break; + + case 2: + if (_globals[kSexOfRex] == REX_MALE) + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[2]); + else + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[4]); + + _game._player._visible = true; + _game._player._stepEnabled = true; + break; + + default: + break; + } + } + } else if (_action.isAction(VERB_LOOK, 0x23E)) + _vm->_dialogs->show(0x8C46); + else if (_action.isAction(VERB_LOOK, 0x1CB)) + _vm->_dialogs->show(0x8C47); + else if (_action.isAction(VERB_LOOK, 0x216)) + _vm->_dialogs->show(0x8C48); + else if (_action.isAction(VERB_LOOK, 0x21B)) + _vm->_dialogs->show(0x8C49); + else if (_action.isAction(VERB_LOOK, 0x2B9)) + _vm->_dialogs->show(0x8C4C); + else if (_action.isAction(VERB_LOOK, 0x2BA)) + _vm->_dialogs->show(0x8C4D); + else if (_action.isAction(VERB_LOOK, 0x215)) + _vm->_dialogs->show(0x8C4E); + else if (_action.isAction(VERB_TAKE, 0x215)) + _vm->_dialogs->show(0x8C4F); + else if (_action.isAction(VERB_LOOK, 0x131) && (_action._mainObjectSource == 4)) + _vm->_dialogs->show(0x8C51); + else if (_action.isAction(VERB_LOOK, 0x2D2)) { + if ((_game._difficulty != DIFFICULTY_HARD) && (_game._objects[OBJ_SECURITY_CARD]._roomNumber == 359)) + _vm->_dialogs->show(0x8C52); + else + _vm->_dialogs->show(0x8C53); + } else if (_action.isAction(VERB_LOOK, 0x23F)) + _vm->_dialogs->show(0x8C54); + else if (_action.isAction(VERB_TAKE, 0x23F)) + _vm->_dialogs->show(0x8C55); + else if (_action.isAction(VERB_LOOK, 0x23A)) + _vm->_dialogs->show(0x8C56); + else if (_action.isAction(VERB_LOOK, 0x204)) + _vm->_dialogs->show(0x8C57); + else if (_action.isAction(VERB_LOOK, 0x89)) { + if ((_game._difficulty != DIFFICULTY_HARD) && (_game._objects[OBJ_SECURITY_CARD]._roomNumber == 359)) + _vm->_dialogs->show(0x8C58); + else + _vm->_dialogs->show(0x8C59); + } else if (_action.isAction(VERB_OPEN, 0x11) || _action.isAction(VERB_LOOK, 0x11)) + _vm->_dialogs->show(0x8CB0); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h index 60b3bc1869..247224b7ba 100644 --- a/engines/mads/nebular/nebular_scenes3.h +++ b/engines/mads/nebular/nebular_scenes3.h @@ -434,6 +434,21 @@ public: virtual void actions(); virtual void postActions() {}; }; + +class Scene359: public Scene3xx { +private: + int _cardHotspotId; + +public: + Scene359(MADSEngine *vm) : Scene3xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step() {}; + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 6bac381576488e5865b852705005a94e5b814a69 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 27 Apr 2014 20:06:06 +0200 Subject: MADS: Implement scene 360 --- engines/mads/nebular/nebular_scenes.cpp | 2 ++ engines/mads/nebular/nebular_scenes3.cpp | 54 ++++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes3.h | 12 +++++++ 3 files changed, 68 insertions(+) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 9ef5f05573..fe915ed700 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -146,6 +146,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene358(vm); case 359: return new Scene359(vm); + case 360: + return new Scene360(vm); // Scene group #8 case 804: diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 22f2007b38..1213cd8a86 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -4746,5 +4746,59 @@ void Scene359::actions() { /*------------------------------------------------------------------------*/ +void Scene360::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene360::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(Resources::formatName(307, 'X', 0, EXT_SS, "")); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(127, 78)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 15); + + if (_scene->_priorSceneId == 359) + _game._player._playerPos = Common::Point(304, 143); + else if (_scene->_priorSceneId != -2) + _game._player._playerPos = Common::Point(13, 141); + + sceneEntrySound(); +} + +void Scene360::preActions() { + if (_action.isAction(0x1AD, 0x2B9)) + _game._player._walkOffScreenSceneId = 359; + + if (_action.isAction(0x1AD, 0x2BA)) + _game._player._walkOffScreenSceneId = 361; +} + +void Scene360::actions() { + if (_action._lookFlag) + _vm->_dialogs->show(0x8CAF); + else if (_action.isAction(VERB_LOOK, 0x2BA)) + _vm->_dialogs->show(0x8CAA); + else if (_action.isAction(VERB_LOOK, 0x2B9)) + _vm->_dialogs->show(0x8CAB); + else if (_action.isAction(VERB_LOOK, 0x1CB)) + _vm->_dialogs->show(0x8CAC); + else if (_action.isAction(VERB_LOOK, 0x216)) + _vm->_dialogs->show(0x8CAD); + else if (_action.isAction(VERB_LOOK, 0x21B)) + _vm->_dialogs->show(0x8CAE); + else if (_action.isAction(VERB_LOOK, 0x11)) + _vm->_dialogs->show(0x8CB0); + else if (_action.isAction(VERB_LOOK, 0x204)) + _vm->_dialogs->show(0x8CB1); + else if (_action.isAction(VERB_LOOK, 0x18D)) + _vm->_dialogs->show(0x8CB2); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h index 247224b7ba..7f2996eb4a 100644 --- a/engines/mads/nebular/nebular_scenes3.h +++ b/engines/mads/nebular/nebular_scenes3.h @@ -449,6 +449,18 @@ public: virtual void actions(); virtual void postActions() {}; }; + +class Scene360: public Scene3xx { +public: + Scene360(MADSEngine *vm) : Scene3xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step() {}; + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 15658397d418833d7839e1c85e3093c1fc79fdcf Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 27 Apr 2014 20:55:09 +0300 Subject: MADS: Show the current scene when using "scene" without params --- engines/mads/debugger.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/mads/debugger.cpp b/engines/mads/debugger.cpp index 7d66b56989..a6192b2a34 100644 --- a/engines/mads/debugger.cpp +++ b/engines/mads/debugger.cpp @@ -69,6 +69,7 @@ bool Debugger::Cmd_Mouse(int argc, const char **argv) { bool Debugger::Cmd_LoadScene(int argc, const char **argv) { if (argc != 2) { + DebugPrintf("Current scene is: %d\n", _vm->_game->_scene._currentSceneId); DebugPrintf("Usage: %s \n", argv[0]); return true; } else { -- cgit v1.2.3 From 62f800341dbcab48acafcb1753f86aa51958b69d Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 27 Apr 2014 20:56:53 +0300 Subject: MADS: Add detection entries for Dragonsphere and Phantom Also, disable the unsupported compressed Rex version for now --- engines/mads/detection.cpp | 2 ++ engines/mads/detection_tables.h | 41 ++++++++++++++++++++++++++++++++++++++++- engines/mads/mads.h | 2 +- 3 files changed, 43 insertions(+), 2 deletions(-) diff --git a/engines/mads/detection.cpp b/engines/mads/detection.cpp index b8e75b4393..49253f0e3a 100644 --- a/engines/mads/detection.cpp +++ b/engines/mads/detection.cpp @@ -68,7 +68,9 @@ Common::Platform MADSEngine::getPlatform() const { static const PlainGameDescriptor MADSGames[] = { {"MADS", "MADS"}, + {"dragonsphere", "Dragonsphere"}, {"nebular", "Rex Nebular and the Cosmic Gender Bender"}, + {"phantom", "Return of the Phantom"}, {0, 0} }; diff --git a/engines/mads/detection_tables.h b/engines/mads/detection_tables.h index 4eb1dd51db..a5a9c33456 100644 --- a/engines/mads/detection_tables.h +++ b/engines/mads/detection_tables.h @@ -23,8 +23,10 @@ namespace MADS { static const MADSGameDescription gameDescriptions[] = { +#if 0 { - // Rex Nebular and the Cosmic Gender Bender DOS English + // Rex Nebular and the Cosmic Gender Bender DOS English (compressed) + // Removed for now, until the original floppy compression is supported { "nebular", 0, @@ -40,6 +42,7 @@ static const MADSGameDescription gameDescriptions[] = { GType_RexNebular, 0 }, +#endif { // Rex Nebular and the Cosmic Gender Bender DOS English @@ -59,6 +62,42 @@ static const MADSGameDescription gameDescriptions[] = { 0 }, + { + // Return of the Phantom DOS English + { + "phantom", + 0, + { + {"section1.hag", 0, "76e2d47a7aebafe48edc9884b3d91782", 1130939}, + AD_LISTEND + }, + Common::EN_ANY, + Common::kPlatformDOS, + ADGF_NO_FLAGS, + GUIO1(GUIO_NONE) + }, + GType_Phantom, + 0 + }, + + { + // Dragonsphere DOS English + { + "dragonsphere", + 0, + { + {"section1.hag", 0, "2770e441d296be5e806194693eebd95a", 2061199}, + AD_LISTEND + }, + Common::EN_ANY, + Common::kPlatformDOS, + ADGF_NO_FLAGS, + GUIO1(GUIO_NONE) + }, + GType_Dragonsphere, + 0 + }, + { AD_TABLE_END_MARKER, 0, 0 } }; diff --git a/engines/mads/mads.h b/engines/mads/mads.h index 9acd469d27..5ae8b8eac5 100644 --- a/engines/mads/mads.h +++ b/engines/mads/mads.h @@ -62,7 +62,7 @@ enum MADSDebugChannels { enum { GType_RexNebular = 0, - GType_DragonSphere = 1, + GType_Dragonsphere = 1, GType_Phantom = 2, GType_Riddle = 3 }; -- cgit v1.2.3 From 4d159955a1eb79eb625d8e8dcb0c38d7a0a235ec Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 27 Apr 2014 20:59:29 +0300 Subject: MADS: Set Rex to start from scene 101, like the original There's a temporary hack to skip showing Rex's standing up animation cause it takes ages to finish --- engines/mads/game.cpp | 4 ++-- engines/mads/nebular/nebular_scenes1.cpp | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index d9d1fea0bb..a12f8e8165 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -110,8 +110,8 @@ void Game::run() { break; default: // Copy protection check succeeded - _scene._nextSceneId = 103; - _scene._priorSceneId = 102; + _scene._nextSceneId = 101; + _scene._priorSceneId = -1; break; } } diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 923d8c0cd0..54db1d3919 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -163,6 +163,10 @@ void Scene101::enter() { _scene->_hotspots.activate(0x137, false); _panelOpened = false; + // HACK: set the prior scene to 102 for now when the game starts, to avoid Rex's getting up animation + if (_scene->_priorSceneId == -1) + _scene->_priorSceneId = 102; + if (_scene->_priorSceneId != -1) _globals[kNeedToStandUp] = false; -- cgit v1.2.3 From 76950bf0ac210ecc31e798ce34de9a3f010371b2 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 27 Apr 2014 21:11:12 +0300 Subject: MADS: Add skeleton classes for Phantom and Dragonsphere --- engines/mads/dragonsphere/dragonsphere_scenes.cpp | 112 ++++++++++++++ engines/mads/dragonsphere/dragonsphere_scenes.h | 125 ++++++++++++++++ engines/mads/dragonsphere/game_dragonsphere.cpp | 172 ++++++++++++++++++++++ engines/mads/dragonsphere/game_dragonsphere.h | 99 +++++++++++++ engines/mads/game.cpp | 12 +- engines/mads/module.mk | 4 + engines/mads/phantom/game_phantom.cpp | 172 ++++++++++++++++++++++ engines/mads/phantom/game_phantom.h | 99 +++++++++++++ engines/mads/phantom/phantom_scenes.cpp | 112 ++++++++++++++ engines/mads/phantom/phantom_scenes.h | 125 ++++++++++++++++ 10 files changed, 1031 insertions(+), 1 deletion(-) create mode 100644 engines/mads/dragonsphere/dragonsphere_scenes.cpp create mode 100644 engines/mads/dragonsphere/dragonsphere_scenes.h create mode 100644 engines/mads/dragonsphere/game_dragonsphere.cpp create mode 100644 engines/mads/dragonsphere/game_dragonsphere.h create mode 100644 engines/mads/phantom/game_phantom.cpp create mode 100644 engines/mads/phantom/game_phantom.h create mode 100644 engines/mads/phantom/phantom_scenes.cpp create mode 100644 engines/mads/phantom/phantom_scenes.h diff --git a/engines/mads/dragonsphere/dragonsphere_scenes.cpp b/engines/mads/dragonsphere/dragonsphere_scenes.cpp new file mode 100644 index 0000000000..fd4fcc183c --- /dev/null +++ b/engines/mads/dragonsphere/dragonsphere_scenes.cpp @@ -0,0 +1,112 @@ +/* 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 "common/scummsys.h" +#include "common/config-manager.h" +#include "mads/mads.h" +#include "mads/compression.h" +#include "mads/resources.h" +#include "mads/scene.h" +#include "mads/dragonsphere/game_dragonsphere.h" +#include "mads/dragonsphere/dragonsphere_scenes.h" + +namespace MADS { + +namespace Dragonsphere { + +SceneLogic *SceneFactory::createScene(MADSEngine *vm) { + Scene &scene = vm->_game->_scene; + + // TODO + //scene.addActiveVocab(NOUN_DROP); + + // TODO: Just return a dummy scene for now + return new DummyScene(vm); + + switch (scene._nextSceneId) { + // Scene group #1 + case 101: + // TODO + + // Scene group #2 + // TODO + + // Scene group #3 + // TODO + + // Scene group #8 + // TODO + + default: + error("Invalid scene %d called", scene._nextSceneId); + } +} + +/*------------------------------------------------------------------------*/ + +DragonsphereScene::DragonsphereScene(MADSEngine *vm) : SceneLogic(vm), + _globals(static_cast(vm->_game)->_globals), + _game(*static_cast(vm->_game)), + _action(vm->_game->_scene._action) { +} + +Common::String DragonsphereScene::formAnimName(char sepChar, int suffixNum) { + return Resources::formatName(_scene->_currentSceneId, sepChar, suffixNum, + EXT_NONE, ""); +} + +/*------------------------------------------------------------------------*/ + +void SceneInfoDragonsphere::loadCodes(MSurface &depthSurface, int variant) { + File f(Resources::formatName(RESPREFIX_RM, _sceneId, ".DAT")); + MadsPack codesPack(&f); + Common::SeekableReadStream *stream = codesPack.getItemStream(variant + 1); + + loadCodes(depthSurface, stream); + + delete stream; + f.close(); +} + +void SceneInfoDragonsphere::loadCodes(MSurface &depthSurface, Common::SeekableReadStream *stream) { + byte *destP = depthSurface.getData(); + byte *endP = depthSurface.getBasePtr(0, depthSurface.h); + + byte runLength = stream->readByte(); + while (destP < endP && runLength > 0) { + byte runValue = stream->readByte(); + + // Write out the run length + Common::fill(destP, destP + runLength, runValue); + destP += runLength; + + // Get the next run length + runLength = stream->readByte(); + } + + if (destP < endP) + Common::fill(destP, endP, 0); +} + +} // End of namespace Dragonsphere + +} // End of namespace MADS diff --git a/engines/mads/dragonsphere/dragonsphere_scenes.h b/engines/mads/dragonsphere/dragonsphere_scenes.h new file mode 100644 index 0000000000..596a59e879 --- /dev/null +++ b/engines/mads/dragonsphere/dragonsphere_scenes.h @@ -0,0 +1,125 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_DRAGONSPHERE_SCENES_H +#define MADS_DRAGONSPHERE_SCENES_H + +#include "common/scummsys.h" +#include "mads/game.h" +#include "mads/scene.h" +#include "mads/dragonsphere/game_dragonsphere.h" +//#include "mads/dragonsphere/globals_dragonsphere.h" + + +namespace MADS { + +namespace Dragonsphere { + +enum Noun { + NOUN_LOOK_AT = 0x0D1, + // TODO +}; + +class SceneFactory { +public: + static SceneLogic *createScene(MADSEngine *vm); +}; + +/** + * Specialized base class for Dragonsphere game scenes + */ +class DragonsphereScene : public SceneLogic { +protected: + DragonsphereGlobals &_globals; + GameDragonsphere &_game; + MADSAction &_action; + + /** + * Forms an animation resource name + */ + Common::String formAnimName(char sepChar, int suffixNum); + + /** + * Plays appropriate sound for entering varous rooms + */ + void lowRoomsEntrySound(); +public: + /** + * Constructor + */ + DragonsphereScene(MADSEngine *vm); + + void sub7178C(); +}; + +class SceneInfoDragonsphere : public SceneInfo { + friend class SceneInfo; +protected: + virtual void loadCodes(MSurface &depthSurface, int variant); + + virtual void loadCodes(MSurface &depthSurface, Common::SeekableReadStream *stream); + + /** + * Constructor + */ + SceneInfoDragonsphere(MADSEngine *vm) : SceneInfo(vm) {} +}; + +// TODO: Temporary, remove once implemented properly +class Scene1xx : public DragonsphereScene { +protected: + /** + * Plays an appropriate sound when entering a scene + */ + void sceneEntrySound() {} + + /** + *Sets the AA file to use for the scene + */ + void setAAName() {} + + /** + * Updates the prefix used for getting player sprites for the scene + */ + void setPlayerSpritesPrefix() {} +public: + Scene1xx(MADSEngine *vm) : DragonsphereScene(vm) {} +}; + +// TODO: Temporary, remove once implemented properly +class DummyScene: public Scene1xx { +public: + DummyScene(MADSEngine *vm) : Scene1xx(vm) {} + + virtual void setup() {} + virtual void enter() {} + virtual void step() {} + virtual void preActions() {} + virtual void actions() {} + virtual void synchronize(Common::Serializer &s) {} +}; + +} // End of namespace Dragonsphere + +} // End of namespace MADS + +#endif /* MADS_DRAGONSPHERE_SCENES_H */ diff --git a/engines/mads/dragonsphere/game_dragonsphere.cpp b/engines/mads/dragonsphere/game_dragonsphere.cpp new file mode 100644 index 0000000000..7d3864e680 --- /dev/null +++ b/engines/mads/dragonsphere/game_dragonsphere.cpp @@ -0,0 +1,172 @@ +/* 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 "common/scummsys.h" +#include "common/config-manager.h" +#include "mads/mads.h" +#include "mads/game.h" +#include "mads/screen.h" +#include "mads/msurface.h" +#include "mads/dragonsphere/game_dragonsphere.h" +//#include "mads/nebular/dialogs_nebular.h" +//#include "mads/nebular/globals_nebular.h" +#include "mads/dragonsphere/dragonsphere_scenes.h" + +namespace MADS { + +namespace Dragonsphere { + +GameDragonsphere::GameDragonsphere(MADSEngine *vm): Game(vm) { + _surface = new MSurface(MADS_SCREEN_WIDTH, MADS_SCENE_HEIGHT); + _storyMode = STORYMODE_NAUGHTY; +} + +ProtectionResult GameDragonsphere::checkCopyProtection() { + /* + // DEBUG: Flag copy protection failure + _globals[5] = -1; + + if (!ConfMan.getBool("copy_protection")) + return true; + + * DEBUG: Disabled for now + CopyProtectionDialog *dlg = new CopyProtectionDialog(_vm, false); + dlg->show(); + delete dlg; + */ + + // DEBUG: Return that copy protection failed + return PROTECTION_SUCCEED; +} + +void GameDragonsphere::initialiseGlobals() { + //int count, count2; + //int bad; + + _globals.reset(); + //_globals[kTalkInanimateCount] = 8; + + /* Section #1 variables */ + // TODO + + /* Section #2 variables */ + // TODO + + /* Section #3 variables */ + // TODO + + /* Section #4 variables */ + // TODO + + /* Section #5 variables */ + // TODO + + /* Section #6 variables */ + // TODO + + /* Section #9 variables */ + // TODO + + _player._facing = FACING_NORTH; + _player._turnToFacing = FACING_NORTH; + + //Player::preloadSequences("RXM", 1); + //Player::preloadSequences("ROX", 1); +} + +void GameDragonsphere::setSectionHandler() { + delete _sectionHandler; + + switch (_sectionNumber) { + case 1: + _sectionHandler = new Section1Handler(_vm); + break; + case 2: + _sectionHandler = new Section2Handler(_vm); + break; + case 3: + _sectionHandler = new Section3Handler(_vm); + break; + case 4: + _sectionHandler = new Section4Handler(_vm); + break; + case 5: + _sectionHandler = new Section5Handler(_vm); + break; + case 6: + _sectionHandler = new Section6Handler(_vm); + break; + case 7: + _sectionHandler = new Section7Handler(_vm); + break; + case 8: + _sectionHandler = new Section8Handler(_vm); + break; + default: + break; + } +} + +void GameDragonsphere::checkShowDialog() { + // TODO: Copied from Nebular + if (_vm->_dialogs->_pendingDialog && _player._stepEnabled && !_globals[5]) { + _player.releasePlayerSprites(); + _vm->_dialogs->showDialog(); + _vm->_dialogs->_pendingDialog = DIALOG_NONE; + } +} + +void GameDragonsphere::doObjectAction() { + // TODO: Copied from Nebular + //Scene &scene = _scene; + MADSAction &action = _scene._action; + //Dialogs &dialogs = *_vm->_dialogs; + //int id; + + action._inProgress = false; +} + +void GameDragonsphere::unhandledAction() { + // TODO +} + +void GameDragonsphere::step() { + if (_player._visible && _player._stepEnabled && !_player._moving && + (_player._facing == _player._turnToFacing)) { + + // TODO + } + +} + +void GameDragonsphere::synchronize(Common::Serializer &s, bool phase1) { + Game::synchronize(s, phase1); + + // TODO: Copied from Nebular + if (!phase1) { + _globals.synchronize(s); + } +} + +} // End of namespace Dragonsphere + +} // End of namespace MADS diff --git a/engines/mads/dragonsphere/game_dragonsphere.h b/engines/mads/dragonsphere/game_dragonsphere.h new file mode 100644 index 0000000000..dd96146285 --- /dev/null +++ b/engines/mads/dragonsphere/game_dragonsphere.h @@ -0,0 +1,99 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_GAME_DRAGONSPHERE_H +#define MADS_GAME_DRAGONSPHERE_H + +#include "common/scummsys.h" +#include "mads/game.h" +#include "mads/globals.h" +//#include "mads/nebular/globals_nebular.h" + +namespace MADS { + +namespace Dragonsphere { + +// TODO: Adapt for Dragonsphere's difficulty setting +enum StoryMode { STORYMODE_NAUGHTY = 1, STORYMODE_NICE = 2 }; + +enum InventoryObject { OBJ_NONE = -1 + // TODO +}; + +// HACK: A stub for now, remove from here once it's implemented properly +class DragonsphereGlobals: public Globals { +public: + DragonsphereGlobals() {} +}; + +class GameDragonsphere: public Game { + friend class Game; +protected: + GameDragonsphere(MADSEngine *vm); + + virtual ProtectionResult checkCopyProtection(); + + virtual void initialiseGlobals(); + + virtual void setSectionHandler(); + + virtual void checkShowDialog(); +public: + DragonsphereGlobals _globals; + StoryMode _storyMode; + + virtual Globals &globals() { return _globals; } + + virtual void doObjectAction(); + + virtual void unhandledAction(); + + virtual void step(); + + virtual void synchronize(Common::Serializer &s, bool phase1); +}; + + +class Section1Handler: public SectionHandler { +public: + Section1Handler(MADSEngine *vm): SectionHandler(vm) {} + + // TODO: Properly implement handler methods + virtual void preLoadSection() {} + virtual void sectionPtr2() {} + virtual void postLoadSection() {} +}; + +// TODO: Properly implement handler classes +typedef Section1Handler Section2Handler; +typedef Section1Handler Section3Handler; +typedef Section1Handler Section4Handler; +typedef Section1Handler Section5Handler; +typedef Section1Handler Section6Handler; +typedef Section1Handler Section7Handler; +typedef Section1Handler Section8Handler; + +} // End of namespace Nebular + +} // End of namespace MADS + +#endif /* MADS_GAME_DRAGONSPHERE_H */ diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index a12f8e8165..2c2f6366a4 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -35,13 +35,23 @@ #include "mads/screen.h" #include "mads/msurface.h" #include "mads/resources.h" +#include "mads/dragonsphere/game_dragonsphere.h" #include "mads/nebular/game_nebular.h" +#include "mads/phantom/game_phantom.h" namespace MADS { Game *Game::init(MADSEngine *vm) { - if (vm->getGameID() == GType_RexNebular) + switch (vm->getGameID()) { + case GType_RexNebular: return new Nebular::GameNebular(vm); + case GType_Dragonsphere: + return new Dragonsphere::GameDragonsphere(vm); + case GType_Phantom: + return new Phantom::GamePhantom(vm); + default: + error("Game: Unknown game"); + } return nullptr; } diff --git a/engines/mads/module.mk b/engines/mads/module.mk index 43853f5abb..e5b9efefc8 100644 --- a/engines/mads/module.mk +++ b/engines/mads/module.mk @@ -1,6 +1,10 @@ MODULE := engines/mads MODULE_OBJS := \ + dragonsphere/game_dragonsphere.o \ + dragonsphere/dragonsphere_scenes.o \ + phantom/game_phantom.o \ + phantom/phantom_scenes.o \ nebular/dialogs_nebular.o \ nebular/game_nebular.o \ nebular/globals_nebular.o \ diff --git a/engines/mads/phantom/game_phantom.cpp b/engines/mads/phantom/game_phantom.cpp new file mode 100644 index 0000000000..43dec7cc02 --- /dev/null +++ b/engines/mads/phantom/game_phantom.cpp @@ -0,0 +1,172 @@ +/* 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 "common/scummsys.h" +#include "common/config-manager.h" +#include "mads/mads.h" +#include "mads/game.h" +#include "mads/screen.h" +#include "mads/msurface.h" +#include "mads/phantom/game_phantom.h" +//#include "mads/nebular/dialogs_nebular.h" +//#include "mads/nebular/globals_nebular.h" +#include "mads/phantom/phantom_scenes.h" + +namespace MADS { + +namespace Phantom { + +GamePhantom::GamePhantom(MADSEngine *vm): Game(vm) { + _surface = new MSurface(MADS_SCREEN_WIDTH, MADS_SCENE_HEIGHT); + _storyMode = STORYMODE_NAUGHTY; +} + +ProtectionResult GamePhantom::checkCopyProtection() { + /* + // DEBUG: Flag copy protection failure + _globals[5] = -1; + + if (!ConfMan.getBool("copy_protection")) + return true; + + * DEBUG: Disabled for now + CopyProtectionDialog *dlg = new CopyProtectionDialog(_vm, false); + dlg->show(); + delete dlg; + */ + + // DEBUG: Return that copy protection failed + return PROTECTION_SUCCEED; +} + +void GamePhantom::initialiseGlobals() { + //int count, count2; + //int bad; + + _globals.reset(); + //_globals[kTalkInanimateCount] = 8; + + /* Section #1 variables */ + // TODO + + /* Section #2 variables */ + // TODO + + /* Section #3 variables */ + // TODO + + /* Section #4 variables */ + // TODO + + /* Section #5 variables */ + // TODO + + /* Section #6 variables */ + // TODO + + /* Section #9 variables */ + // TODO + + _player._facing = FACING_NORTH; + _player._turnToFacing = FACING_NORTH; + + //Player::preloadSequences("RXM", 1); + //Player::preloadSequences("ROX", 1); +} + +void GamePhantom::setSectionHandler() { + delete _sectionHandler; + + switch (_sectionNumber) { + case 1: + _sectionHandler = new Section1Handler(_vm); + break; + case 2: + _sectionHandler = new Section2Handler(_vm); + break; + case 3: + _sectionHandler = new Section3Handler(_vm); + break; + case 4: + _sectionHandler = new Section4Handler(_vm); + break; + case 5: + _sectionHandler = new Section5Handler(_vm); + break; + case 6: + _sectionHandler = new Section6Handler(_vm); + break; + case 7: + _sectionHandler = new Section7Handler(_vm); + break; + case 8: + _sectionHandler = new Section8Handler(_vm); + break; + default: + break; + } +} + +void GamePhantom::checkShowDialog() { + // TODO: Copied from Nebular + if (_vm->_dialogs->_pendingDialog && _player._stepEnabled && !_globals[5]) { + _player.releasePlayerSprites(); + _vm->_dialogs->showDialog(); + _vm->_dialogs->_pendingDialog = DIALOG_NONE; + } +} + +void GamePhantom::doObjectAction() { + // TODO: Copied from Nebular + //Scene &scene = _scene; + MADSAction &action = _scene._action; + //Dialogs &dialogs = *_vm->_dialogs; + //int id; + + action._inProgress = false; +} + +void GamePhantom::unhandledAction() { + // TODO +} + +void GamePhantom::step() { + if (_player._visible && _player._stepEnabled && !_player._moving && + (_player._facing == _player._turnToFacing)) { + + // TODO + } + +} + +void GamePhantom::synchronize(Common::Serializer &s, bool phase1) { + Game::synchronize(s, phase1); + + // TODO: Copied from Nebular + if (!phase1) { + _globals.synchronize(s); + } +} + +} // End of namespace Phantom + +} // End of namespace MADS diff --git a/engines/mads/phantom/game_phantom.h b/engines/mads/phantom/game_phantom.h new file mode 100644 index 0000000000..bb574a98b0 --- /dev/null +++ b/engines/mads/phantom/game_phantom.h @@ -0,0 +1,99 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_GAME_PHANTOM_H +#define MADS_GAME_PHANTOM_H + +#include "common/scummsys.h" +#include "mads/game.h" +#include "mads/globals.h" +//#include "mads/nebular/globals_nebular.h" + +namespace MADS { + +namespace Phantom { + +// TODO: Adapt for Phantom's difficulty setting +enum StoryMode { STORYMODE_NAUGHTY = 1, STORYMODE_NICE = 2 }; + +enum InventoryObject { OBJ_NONE = -1 + // TODO +}; + +// HACK: A stub for now, remove from here once it's implemented properly +class PhantomGlobals: public Globals { +public: + PhantomGlobals() {} +}; + +class GamePhantom: public Game { + friend class Game; +protected: + GamePhantom(MADSEngine *vm); + + virtual ProtectionResult checkCopyProtection(); + + virtual void initialiseGlobals(); + + virtual void setSectionHandler(); + + virtual void checkShowDialog(); +public: + PhantomGlobals _globals; + StoryMode _storyMode; + + virtual Globals &globals() { return _globals; } + + virtual void doObjectAction(); + + virtual void unhandledAction(); + + virtual void step(); + + virtual void synchronize(Common::Serializer &s, bool phase1); +}; + + +class Section1Handler: public SectionHandler { +public: + Section1Handler(MADSEngine *vm): SectionHandler(vm) {} + + // TODO: Properly implement handler methods + virtual void preLoadSection() {} + virtual void sectionPtr2() {} + virtual void postLoadSection() {} +}; + +// TODO: Properly implement handler classes +typedef Section1Handler Section2Handler; +typedef Section1Handler Section3Handler; +typedef Section1Handler Section4Handler; +typedef Section1Handler Section5Handler; +typedef Section1Handler Section6Handler; +typedef Section1Handler Section7Handler; +typedef Section1Handler Section8Handler; + +} // End of namespace Nebular + +} // End of namespace MADS + +#endif /* MADS_GAME_PHANTOM_H */ diff --git a/engines/mads/phantom/phantom_scenes.cpp b/engines/mads/phantom/phantom_scenes.cpp new file mode 100644 index 0000000000..83b664b33a --- /dev/null +++ b/engines/mads/phantom/phantom_scenes.cpp @@ -0,0 +1,112 @@ +/* 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 "common/scummsys.h" +#include "common/config-manager.h" +#include "mads/mads.h" +#include "mads/compression.h" +#include "mads/resources.h" +#include "mads/scene.h" +#include "mads/phantom/game_phantom.h" +#include "mads/phantom/phantom_scenes.h" + +namespace MADS { + +namespace Phantom { + +SceneLogic *SceneFactory::createScene(MADSEngine *vm) { + Scene &scene = vm->_game->_scene; + + // TODO + //scene.addActiveVocab(NOUN_DROP); + + // TODO: Just return a dummy scene for now + return new DummyScene(vm); + + switch (scene._nextSceneId) { + // Scene group #1 + case 101: + // TODO + + // Scene group #2 + // TODO + + // Scene group #3 + // TODO + + // Scene group #8 + // TODO + + default: + error("Invalid scene %d called", scene._nextSceneId); + } +} + +/*------------------------------------------------------------------------*/ + +PhantomScene::PhantomScene(MADSEngine *vm) : SceneLogic(vm), + _globals(static_cast(vm->_game)->_globals), + _game(*static_cast(vm->_game)), + _action(vm->_game->_scene._action) { +} + +Common::String PhantomScene::formAnimName(char sepChar, int suffixNum) { + return Resources::formatName(_scene->_currentSceneId, sepChar, suffixNum, + EXT_NONE, ""); +} + +/*------------------------------------------------------------------------*/ + +void SceneInfoPhantom::loadCodes(MSurface &depthSurface, int variant) { + File f(Resources::formatName(RESPREFIX_RM, _sceneId, ".DAT")); + MadsPack codesPack(&f); + Common::SeekableReadStream *stream = codesPack.getItemStream(variant + 1); + + loadCodes(depthSurface, stream); + + delete stream; + f.close(); +} + +void SceneInfoPhantom::loadCodes(MSurface &depthSurface, Common::SeekableReadStream *stream) { + byte *destP = depthSurface.getData(); + byte *endP = depthSurface.getBasePtr(0, depthSurface.h); + + byte runLength = stream->readByte(); + while (destP < endP && runLength > 0) { + byte runValue = stream->readByte(); + + // Write out the run length + Common::fill(destP, destP + runLength, runValue); + destP += runLength; + + // Get the next run length + runLength = stream->readByte(); + } + + if (destP < endP) + Common::fill(destP, endP, 0); +} + +} // End of namespace Phantom + +} // End of namespace MADS diff --git a/engines/mads/phantom/phantom_scenes.h b/engines/mads/phantom/phantom_scenes.h new file mode 100644 index 0000000000..647671040c --- /dev/null +++ b/engines/mads/phantom/phantom_scenes.h @@ -0,0 +1,125 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_PHANTOM_SCENES_H +#define MADS_PHANTOM_SCENES_H + +#include "common/scummsys.h" +#include "mads/game.h" +#include "mads/scene.h" +#include "mads/phantom/game_phantom.h" +//#include "mads/phantom/globals_phantom.h" + + +namespace MADS { + +namespace Phantom { + +enum Noun { + NOUN_LOOK_AT = 0x0D1, + // TODO +}; + +class SceneFactory { +public: + static SceneLogic *createScene(MADSEngine *vm); +}; + +/** + * Specialized base class for Dragonsphere game scenes + */ +class PhantomScene : public SceneLogic { +protected: + PhantomGlobals &_globals; + GamePhantom &_game; + MADSAction &_action; + + /** + * Forms an animation resource name + */ + Common::String formAnimName(char sepChar, int suffixNum); + + /** + * Plays appropriate sound for entering varous rooms + */ + void lowRoomsEntrySound(); +public: + /** + * Constructor + */ + PhantomScene(MADSEngine *vm); + + void sub7178C(); +}; + +class SceneInfoPhantom : public SceneInfo { + friend class SceneInfo; +protected: + virtual void loadCodes(MSurface &depthSurface, int variant); + + virtual void loadCodes(MSurface &depthSurface, Common::SeekableReadStream *stream); + + /** + * Constructor + */ + SceneInfoPhantom(MADSEngine *vm) : SceneInfo(vm) {} +}; + +// TODO: Temporary, remove once implemented properly +class Scene1xx : public PhantomScene { +protected: + /** + * Plays an appropriate sound when entering a scene + */ + void sceneEntrySound() {} + + /** + *Sets the AA file to use for the scene + */ + void setAAName() {} + + /** + * Updates the prefix used for getting player sprites for the scene + */ + void setPlayerSpritesPrefix() {} +public: + Scene1xx(MADSEngine *vm) : PhantomScene(vm) {} +}; + +// TODO: Temporary, remove once implemented properly +class DummyScene: public Scene1xx { +public: + DummyScene(MADSEngine *vm) : Scene1xx(vm) {} + + virtual void setup() {} + virtual void enter() {} + virtual void step() {} + virtual void preActions() {} + virtual void actions() {} + virtual void synchronize(Common::Serializer &s) {} +}; + +} // End of namespace Phantom + +} // End of namespace MADS + +#endif /* MADS_PHANTOM_SCENES_H */ -- cgit v1.2.3 From 4eba5032d817ea32e3f2f7be52826c2e40471852 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 27 Apr 2014 21:14:26 +0300 Subject: MADS: Add initial support for V2 backgrounds and hotspots V2 games include Phantom and Dragonsphere. OUAF hasn't been tested yet --- engines/mads/hotspots.cpp | 7 +- engines/mads/hotspots.h | 2 +- engines/mads/scene_data.cpp | 267 +++++++++++++++++++++++++++++++++++--------- engines/mads/scene_data.h | 35 ++++-- 4 files changed, 247 insertions(+), 64 deletions(-) diff --git a/engines/mads/hotspots.cpp b/engines/mads/hotspots.cpp index a5b56eec93..47d8204437 100644 --- a/engines/mads/hotspots.cpp +++ b/engines/mads/hotspots.cpp @@ -153,7 +153,7 @@ Hotspot::Hotspot() { _active = false; } -Hotspot::Hotspot(Common::SeekableReadStream &f) { +Hotspot::Hotspot(Common::SeekableReadStream &f, bool isV2) { _bounds.left = f.readSint16LE(); _bounds.top = f.readSint16LE(); _bounds.right = f.readSint16LE(); @@ -166,6 +166,11 @@ Hotspot::Hotspot(Common::SeekableReadStream &f) { _cursor = (CursorType)f.readByte(); _vocabId = f.readUint16LE(); _verbId = f.readUint16LE(); + if (isV2) { + // This looks to be some sort of bitmask. Perhaps it signifies + // the valid verbs for this hotspot + f.skip(2); // unknown + } } /*------------------------------------------------------------------------*/ diff --git a/engines/mads/hotspots.h b/engines/mads/hotspots.h index bd803e84a0..a6b991e1dd 100644 --- a/engines/mads/hotspots.h +++ b/engines/mads/hotspots.h @@ -81,7 +81,7 @@ public: int _verbId; Hotspot(); - Hotspot(Common::SeekableReadStream &f); + Hotspot(Common::SeekableReadStream &f, bool isV2); }; class Hotspots : public Common::Array { diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index 9f4d7d99ec..646106ee9a 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -26,7 +26,9 @@ #include "mads/compression.h" #include "mads/screen.h" #include "mads/resources.h" +#include "mads/dragonsphere/dragonsphere_scenes.h" #include "mads/nebular/nebular_scenes.h" +#include "mads/phantom/phantom_scenes.h" namespace MADS { @@ -49,10 +51,12 @@ KernelMessage::KernelMessage() { /*------------------------------------------------------------------------*/ -void ARTHeader::load(Common::SeekableReadStream *f) { - // Read in dimensions of image - _width = f->readUint16LE(); - _height = f->readUint16LE(); +void ARTHeader::load(Common::SeekableReadStream *f, bool isV2) { + if (!isV2) { + // Read in dimensions of image + _width = f->readUint16LE(); + _height = f->readUint16LE(); + } // Read in palette information int palCount = f->readUint16LE(); @@ -91,11 +95,18 @@ void SceneInfo::SpriteInfo::load(Common::SeekableReadStream *f) { /*------------------------------------------------------------------------*/ SceneInfo *SceneInfo::init(MADSEngine *vm) { - if (vm->getGameID() == GType_RexNebular) { + switch (vm->getGameID()) { + case GType_RexNebular: return new Nebular::SceneInfoNebular(vm); - } else { - error("Unknown game"); + case GType_Dragonsphere: + return new Dragonsphere::SceneInfoDragonsphere(vm); + case GType_Phantom: + return new Phantom::SceneInfoPhantom(vm); + default: + error("SceneInfo: Unknown game"); } + + return nullptr; } void SceneInfo::load(int sceneId, int variant, const Common::String &resName, @@ -116,12 +127,25 @@ void SceneInfo::load(int sceneId, int variant, const Common::String &resName, // Read in basic data Common::SeekableReadStream *infoStream = infoPack.getItemStream(0); - _sceneId = infoStream->readUint16LE(); + if (_vm->getGameID() == GType_RexNebular) { + _sceneId = infoStream->readUint16LE(); + } else { + infoStream->skip(6); // actual scene ID (string) + _sceneId = sceneId; + } + + // TODO: The following isn't quite right for V2 games (it's all 0) _artFileNum = infoStream->readUint16LE(); _depthStyle = infoStream->readUint16LE(); _width = infoStream->readUint16LE(); _height = infoStream->readUint16LE(); + // HACK for V2 games (for now) + if (_vm->getGameID() != GType_RexNebular && _width == 0) { + _width = 320; + _height = 156; + } + infoStream->skip(24); int nodeCount = infoStream->readUint16LE(); @@ -157,12 +181,15 @@ void SceneInfo::load(int sceneId, int variant, const Common::String &resName, // Load in sprite draw information Common::Array spriteInfo; - for (int i = 0; i < 50; ++i) { - SpriteInfo info; - info.load(infoStream); - - if (i < spriteInfoCount) - spriteInfo.push_back(info); + // TODO: The following isn't quite right for V2 games + if (_vm->getGameID() == GType_RexNebular) { + for (int i = 0; i < 50; ++i) { + SpriteInfo info; + info.load(infoStream); + + if (i < spriteInfoCount) + spriteInfo.push_back(info); + } } delete infoStream; @@ -179,16 +206,67 @@ void SceneInfo::load(int sceneId, int variant, const Common::String &resName, depthSurface.setSize(width, height); } - // Load the depth surface with the scene codes - Common::SeekableReadStream *depthStream = infoPack.getItemStream(variant + 1); - loadCodes(depthSurface, depthStream); - delete depthStream; + if (_vm->getGameID() == GType_RexNebular) { + // Load the depth surface with the scene codes + Common::SeekableReadStream *depthStream = infoPack.getItemStream(variant + 1); + loadCodes(depthSurface, depthStream); + delete depthStream; + } infoFile.close(); + if (_vm->getGameID() == GType_RexNebular) { + loadMadsV1Background(sceneId, resName, flags, bgSurface); + loadPalette(sceneId, _artFileNum, resName, flags, bgSurface); + } else { + loadMadsV2Background(sceneId, resName, flags, bgSurface); + loadPalette(sceneId, sceneId, resName, flags, bgSurface); + } + + Common::Array spriteSets; + Common::Array usageList; + + if (flags & 1) { + for (uint i = 0; i < setNames.size(); ++i) { + Common::String setResName; + if (sceneFlag || resName.hasPrefix("*")) + setResName += "*"; + setResName += setNames[i]; + + SpriteAsset *sprites = new SpriteAsset(_vm, setResName, flags); + spriteSets.push_back(sprites); + usageList.push_back(sprites->_usageIndex); + } + } + + _vm->_palette->_paletteUsage.updateUsage(usageList, _usageIndex); + + for (uint i = 0; i < spriteInfo.size(); ++i) { + SpriteInfo &si = spriteInfo[i]; + SpriteAsset *asset = spriteSets[si._spriteSetIndex]; + assert(asset && _depthStyle != 2); + + asset->drawScaled(asset->getCount(), depthSurface, bgSurface, + si._scale, si._depth, si._position); + } + + // Free the sprite sets + for (int i = (int)spriteSets.size() - 1; i >= 0; --i) { + warning("TODO: sub_201C8 SPRITE_SET.field_6"); + delete spriteSets[i]; + } +} + +void SceneInfo::loadPalette(int sceneId, int artFileNum, const Common::String &resName, int flags, MSurface &bgSurface) { + bool sceneFlag = sceneId >= 0; + Common::String resourceName; + bool isV2 = (_vm->getGameID() != GType_RexNebular); + Common::String extension = !isV2 ? ".ART" : ".TT"; + int paletteStream = !isV2 ? 0 : 2; + // Get the ART resource if (sceneFlag) { - resourceName = Resources::formatName(RESPREFIX_RM, _artFileNum, ".ART"); + resourceName = Resources::formatName(RESPREFIX_RM, artFileNum, extension); } else { resourceName = "*" + Resources::formatResource(resName, resName); } @@ -196,10 +274,10 @@ void SceneInfo::load(int sceneId, int variant, const Common::String &resName, // Load in the ART header and palette File artFile(resourceName); MadsPack artResource(&artFile); - Common::SeekableReadStream *stream = artResource.getItemStream(0); + Common::SeekableReadStream *stream = artResource.getItemStream(paletteStream); ARTHeader artHeader; - artHeader.load(stream); + artHeader.load(stream, isV2); delete stream; // Copy out the palette animation data @@ -224,52 +302,137 @@ void SceneInfo::load(int sceneId, int variant, const Common::String &resName, } } - // Read in the background surface data - assert(_width == bgSurface.w && _height == bgSurface.h); - stream = artResource.getItemStream(1); - stream->read(bgSurface.getPixels(), bgSurface.w * bgSurface.h); - if (!(flags & 1)) { // Translate the background to use the correct palette indexes bgSurface.translate(artHeader._palette); } +} + +void SceneInfo::loadMadsV1Background(int sceneId, const Common::String &resName, int flags, MSurface &bgSurface) { + bool sceneFlag = sceneId >= 0; + Common::String resourceName; + Common::SeekableReadStream *stream; + + // Get the ART resource + if (sceneFlag) { + resourceName = Resources::formatName(RESPREFIX_RM, _artFileNum, ".ART"); + } else { + resourceName = "*" + Resources::formatResource(resName, resName); + } + + // Load in the ART data + File artFile(resourceName); + MadsPack artResource(&artFile); + + // Read in the background surface data + assert(_width == bgSurface.w && _height == bgSurface.h); + stream = artResource.getItemStream(1); + stream->read(bgSurface.getPixels(), bgSurface.w * bgSurface.h); // Close the ART file delete stream; artFile.close(); +} - Common::Array spriteSets; - Common::Array usageList; - - if (flags & 1) { - for (uint i = 0; i < setNames.size(); ++i) { - Common::String setResName; - if (sceneFlag || resName.hasPrefix("*")) - setResName += "*"; - setResName += setNames[i]; - - SpriteAsset *sprites = new SpriteAsset(_vm, setResName, flags); - spriteSets.push_back(sprites); - usageList.push_back(sprites->_usageIndex); - } +void SceneInfo::loadMadsV2Background(int sceneId, const Common::String &resName, int flags, MSurface &bgSurface) { + Common::String tileMapResourceName = Resources::formatName(RESPREFIX_RM, sceneId, ".MM"); + File tileMapFile(tileMapResourceName); + MadsPack tileMapPack(&tileMapFile); + Common::SeekableReadStream *mapStream = tileMapPack.getItemStream(0); + + // Get the details of the tiles and map + mapStream->readUint32LE(); + int tileCountX = mapStream->readUint16LE(); + int tileCountY = mapStream->readUint16LE(); + int tileWidthMap = mapStream->readUint16LE(); + int tileHeightMap = mapStream->readUint16LE(); + int screenWidth = mapStream->readUint16LE(); + int screenHeight = mapStream->readUint16LE(); + int tileCountMap = tileCountX * tileCountY; + delete mapStream; + + // Obtain tile map information + typedef Common::List > TileSetList; + typedef TileSetList::iterator TileSetIterator; + TileSetList tileSet; + uint16 *tileMap = new uint16[tileCountMap]; + mapStream = tileMapPack.getItemStream(1); + for (int i = 0; i < tileCountMap; ++i) + tileMap[i] = mapStream->readUint16LE(); + delete mapStream; + tileMapFile.close(); + + // -------------------------------------------------------------------------------- + + // Tile data, which needs to be kept compressed, as the tile map offsets refer to + // the compressed data. Each tile is then uncompressed separately + Common::String tileDataResourceName = Resources::formatName(RESPREFIX_RM, sceneId, ".TT"); + File tileDataFile(tileDataResourceName); + MadsPack tileDataPack(&tileDataFile); + Common::SeekableReadStream *tileDataUncomp = tileDataPack.getItemStream(0); + + // Validate that the data matches between the tiles and tile map file and is valid + int tileCount = tileDataUncomp->readUint16LE(); + int tileWidth = tileDataUncomp->readUint16LE(); + int tileHeight = tileDataUncomp->readUint16LE(); + delete tileDataUncomp; + assert(tileCountMap == tileCount); + assert(tileWidth == tileWidthMap); + assert(tileHeight == tileHeightMap); + assert(screenWidth == _width); + assert(screenHeight <= _height); + + // -------------------------------------------------------------------------------- + + // Get tile data + + tileDataUncomp = tileDataPack.getItemStream(1); + FabDecompressor fab; + uint32 compressedTileDataSize = 0; + + for (int i = 0; i < tileCount; i++) { + tileDataUncomp->seek(i * 4, SEEK_SET); + uint32 tileOfs = tileDataUncomp->readUint32LE(); + MSurface* newTile = new MSurface(tileWidth, tileHeight); + + if (i == tileCount - 1) + compressedTileDataSize = tileDataFile.size() - tileOfs; + else + compressedTileDataSize = tileDataUncomp->readUint32LE() - tileOfs; + + //debugCN(kDebugGraphics, "Tile: %i, compressed size: %i\n", i, compressedTileDataSize); + + newTile->empty(); + + byte *compressedTileData = new byte[compressedTileDataSize]; + + tileDataFile.seek(tileDataPack.getDataOffset() + tileOfs, SEEK_SET); + tileDataFile.read(compressedTileData, compressedTileDataSize); + + fab.decompress(compressedTileData, compressedTileDataSize, (byte*)newTile->getPixels(), tileWidth * tileHeight); + tileSet.push_back(TileSetList::value_type(newTile)); + delete[] compressedTileData; } - _vm->_palette->_paletteUsage.updateUsage(usageList, _usageIndex); + delete tileDataUncomp; - for (uint i = 0; i < spriteInfo.size(); ++i) { - SpriteInfo &si = spriteInfo[i]; - SpriteAsset *asset = spriteSets[si._spriteSetIndex]; - assert(asset && _depthStyle != 2); + // -------------------------------------------------------------------------------- - asset->drawScaled(asset->getCount(), depthSurface, bgSurface, - si._scale, si._depth, si._position); - } + // Loop through the mapping data to place the tiles on the screen - // Free the sprite sets - for (int i = (int)spriteSets.size() - 1; i >= 0; --i) { - warning("TODO: sub_201C8 SPRITE_SET.field_6"); - delete spriteSets[i]; + uint16 *tIndex = &tileMap[0]; + for (int y = 0; y < tileCountY; y++) { + for (int x = 0; x < tileCountX; x++) { + int tileIndex = *tIndex++; + assert(tileIndex < tileCount); + TileSetIterator tile = tileSet.begin(); + for (int i = 0; i < tileIndex; i++) + ++tile; + ((*tile).get())->copyTo(&bgSurface, Common::Point(x * tileWidth, y * tileHeight)); + } } + tileSet.clear(); + tileDataFile.close(); } /*------------------------------------------------------------------------*/ diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index d59d746706..9b1825f4b7 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -125,7 +125,7 @@ struct ARTHeader { Common::Array _palette; Common::Array _paletteCycles; - void load(Common::SeekableReadStream *f); + void load(Common::SeekableReadStream *f, bool isV2); }; /** @@ -177,23 +177,38 @@ public: static SceneInfo *init(MADSEngine *vm); /** - loads the data + * loads the data */ void load(int sceneId, int variant, const Common::String &resName, int flags, MSurface &depthSurface, MSurface &bgSurface); /** - * Loads the given surface with depth information of a given scene - * @param depthSurface Depth/walk surface - * @param variant Variant number to load - */ + * Loads the palette for a scene + */ + void loadPalette(int sceneId, int artFileNum, const Common::String &resName, int flags, MSurface &bgSurface); + + /** + * Loads a V1 game background + */ + void loadMadsV1Background(int sceneId, const Common::String &resName, int flags, MSurface &bgSurface); + + /** + * Loads a V2 game background + */ + void loadMadsV2Background(int sceneId, const Common::String &resName, int flags, MSurface &bgSurface); + + /** + * Loads the given surface with depth information of a given scene + * @param depthSurface Depth/walk surface + * @param variant Variant number to load + */ virtual void loadCodes(MSurface &depthSurface, int variant) = 0; /** - * Loads the given surface with depth information of a given scene - * @param depthSurface Depth/walk surface - * @param stream Stream to load the data from - */ + * Loads the given surface with depth information of a given scene + * @param depthSurface Depth/walk surface + * @param stream Stream to load the data from + */ virtual void loadCodes(MSurface &depthSurface, Common::SeekableReadStream *stream) = 0; }; -- cgit v1.2.3 From 16bbc100ddf15da2c321bf54cf1f66f580dcdc93 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 27 Apr 2014 21:15:46 +0300 Subject: MADS: Handle the missing sections in Phantom and Dragonsphere --- engines/mads/resources.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/engines/mads/resources.cpp b/engines/mads/resources.cpp index aef22d3734..b6caed7b0c 100644 --- a/engines/mads/resources.cpp +++ b/engines/mads/resources.cpp @@ -60,7 +60,7 @@ private: /** * Load the index of all the game's HAG files */ - void loadIndex(); + void loadIndex(MADSEngine *vm); /** * Given a resource name, opens up the correct HAG file and returns whether @@ -78,7 +78,7 @@ private: */ ResourceType getResourceType(const Common::String &resourceName) const; public: - HagArchive(); + HagArchive(MADSEngine *vm); virtual ~HagArchive(); // Archive implementation @@ -90,8 +90,8 @@ public: const char *const MADSCONCAT_STRING = "MADSCONCAT"; -HagArchive::HagArchive() { - loadIndex(); +HagArchive::HagArchive(MADSEngine *vm) { + loadIndex(vm); } HagArchive::~HagArchive() { @@ -146,13 +146,25 @@ Common::SeekableReadStream *HagArchive::createReadStreamForMember(const Common:: return nullptr; } -void HagArchive::loadIndex() { +void HagArchive::loadIndex(MADSEngine *vm) { Common::File hagFile; for (int sectionIndex = -1; sectionIndex < 10; ++sectionIndex) { if (sectionIndex == 0) continue; + // Dragonsphere does not have some sections - skip them + if (vm->getGameID() == GType_Dragonsphere) { + if (sectionIndex == 7 || sectionIndex == 8) + continue; + } + + // Phantom does not have some sections - skip them + if (vm->getGameID() == GType_Phantom) { + if (sectionIndex == 6 || sectionIndex == 7 || sectionIndex == 8) + continue; + } + Common::String filename = (sectionIndex == -1) ? "GLOBAL.HAG" : Common::String::format("SECTION%d.HAG", sectionIndex); if (!hagFile.open(filename)) @@ -275,7 +287,7 @@ ResourceType HagArchive::getResourceType(const Common::String &resourceName) con /*------------------------------------------------------------------------*/ void Resources::init(MADSEngine *vm) { - SearchMan.add("HAG", new HagArchive()); + SearchMan.add("HAG", new HagArchive(vm)); } Common::String Resources::formatName(RESPREFIX resType, int id, const Common::String &ext) { -- cgit v1.2.3 From 9c30f3e0734271a2a259c1dc75202cef88f370f3 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 27 Apr 2014 21:17:11 +0300 Subject: MADS: Hook up the new skeleton scene logic for Phantom and Dragonsphere Also, add a HACK to stub out the sprite refresh code for these games, as sprites aren't loaded yet --- engines/mads/scene.cpp | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 9217be6d5d..545ee03fd0 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -24,7 +24,9 @@ #include "mads/scene.h" #include "mads/compression.h" #include "mads/mads.h" +#include "mads/dragonsphere/dragonsphere_scenes.h" #include "mads/nebular/nebular_scenes.h" +#include "mads/phantom/phantom_scenes.h" namespace MADS { @@ -113,8 +115,14 @@ void Scene::loadSceneLogic() { case GType_RexNebular: _sceneLogic = Nebular::SceneFactory::createScene(_vm); break; + case GType_Dragonsphere: + _sceneLogic = Dragonsphere::SceneFactory::createScene(_vm); + break; + case GType_Phantom: + _sceneLogic = Phantom::SceneFactory::createScene(_vm); + break; default: - error("Unknown game"); + error("Scene logic: Unknown game"); } } @@ -185,6 +193,7 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) { void Scene::loadHotspots() { File f(Resources::formatName(RESPREFIX_RM, _currentSceneId, ".HH")); MadsPack madsPack(&f); + bool isV2 = (_vm->getGameID() != GType_RexNebular); Common::SeekableReadStream *stream = madsPack.getItemStream(0); int count = stream->readUint16LE(); @@ -193,7 +202,7 @@ void Scene::loadHotspots() { stream = madsPack.getItemStream(1); _hotspots.clear(); for (int i = 0; i < count; ++i) - _hotspots.push_back(Hotspot(*stream)); + _hotspots.push_back(Hotspot(*stream, isV2)); delete stream; f.close(); @@ -467,6 +476,19 @@ void Scene::drawElements(ScreenTransition transitionType, bool surfaceFlag) { // Copy background for the dirty areas to the screen _dirtyAreas.copy(&_backgroundSurface, &_vm->_screen, _posAdjust); + // TODO: Remove this HACK when sprites are implemented for V2 games + if (_vm->getGameID() != GType_RexNebular) { + if (transitionType) { + // Fading in the screen + _vm->_screen.transition(transitionType, surfaceFlag); + _vm->_sound->startQueuedCommands(); + } else { + // Copy dirty areas to the screen + _dirtyAreas.copyToScreen(_vm->_screen._offset); + } + return; + } + // Handle dirty areas for foreground objects _spriteSlots.setDirtyAreas(); _textDisplay.setDirtyAreas2(); -- cgit v1.2.3 From 87ad5a8397cc332c6e3580725df39925eb5b66c5 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 27 Apr 2014 21:18:24 +0300 Subject: MADS: Add a HACK to reuse the Nebular dialog class for now for V2 games There aren't any dialogs shown yet for these games, we just reuse the implemented class to avoid crashes when it's initialized --- engines/mads/dialogs.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/engines/mads/dialogs.cpp b/engines/mads/dialogs.cpp index 3c771e7ed9..519b273efb 100644 --- a/engines/mads/dialogs.cpp +++ b/engines/mads/dialogs.cpp @@ -362,7 +362,10 @@ Dialogs *Dialogs::init(MADSEngine *vm) { if (vm->getGameID() == GType_RexNebular) return new Nebular::DialogsNebular(vm); - error("Unknown game"); + // Throw a warning for now, since the associated Dialogs class isn't implemented yet + warning("Dialogs: Unknown game"); + // HACK: Reuse the implemented Nebular dialogs for now, to avoid crashing later on + return new Nebular::DialogsNebular(vm); } Dialogs::Dialogs(MADSEngine *vm): _vm(vm) { -- cgit v1.2.3 From 027a2f3710b05fcefc5135ad9a2b562f7c1ab50c Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 27 Apr 2014 21:19:36 +0300 Subject: MADS: Disable the hotspot description code for V2 games This doesn't quite work yet, and it causes crashes, thus it has been disabled for now for these games --- engines/mads/user_interface.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index d4ab0d3dc5..194fda0164 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -704,12 +704,15 @@ void UserInterface::loadElements() { CAT_INV_ANIM, 0); } - if (_vm->_game->_screenObjects._inputMode == kInputBuildingSentences || - _vm->_game->_screenObjects._inputMode == kInputLimitedSentences) { - _categoryIndexes[CAT_HOTSPOT - 1] = _vm->_game->_screenObjects.size() + 1; - for (int hotspotIdx = scene._hotspots.size() - 1; hotspotIdx >= 0; --hotspotIdx) { - Hotspot &hs = scene._hotspots[hotspotIdx]; - _vm->_game->_screenObjects.add(hs._bounds, LAYER_GUI, CAT_HOTSPOT, hotspotIdx); + // TODO: Implement for V2 games + if (_vm->getGameID() == GType_RexNebular) { + if (_vm->_game->_screenObjects._inputMode == kInputBuildingSentences || + _vm->_game->_screenObjects._inputMode == kInputLimitedSentences) { + _categoryIndexes[CAT_HOTSPOT - 1] = _vm->_game->_screenObjects.size() + 1; + for (int hotspotIdx = scene._hotspots.size() - 1; hotspotIdx >= 0; --hotspotIdx) { + Hotspot &hs = scene._hotspots[hotspotIdx]; + _vm->_game->_screenObjects.add(hs._bounds, LAYER_GUI, CAT_HOTSPOT, hotspotIdx); + } } } -- cgit v1.2.3 From 29234dc34d12e0f5fc28819bef34d394d3143b4b Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 27 Apr 2014 22:54:57 +0300 Subject: MADS: Remove the unused GType_Riddle game ID (it's an M4 game) --- engines/mads/mads.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/engines/mads/mads.h b/engines/mads/mads.h index 5ae8b8eac5..d6a2a848bc 100644 --- a/engines/mads/mads.h +++ b/engines/mads/mads.h @@ -63,8 +63,7 @@ enum MADSDebugChannels { enum { GType_RexNebular = 0, GType_Dragonsphere = 1, - GType_Phantom = 2, - GType_Riddle = 3 + GType_Phantom = 2 }; enum ScreenFade { -- cgit v1.2.3 From 6c9075eb2539aa4264ce4298772437caec55b256 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 27 Apr 2014 22:56:15 +0300 Subject: MADS: Implement the audio player This is used for all digital samples, plus voices in talkie versions. Currently, it's only hooked to the "play_audio" debugger command --- engines/mads/audio.cpp | 129 ++++++++++++++++++++++++++++++++++++++++++++++ engines/mads/audio.h | 64 +++++++++++++++++++++++ engines/mads/debugger.cpp | 19 +++++++ engines/mads/debugger.h | 1 + engines/mads/game.h | 1 + engines/mads/mads.cpp | 1 + engines/mads/mads.h | 1 + engines/mads/module.mk | 1 + 8 files changed, 217 insertions(+) create mode 100644 engines/mads/audio.cpp create mode 100644 engines/mads/audio.h diff --git a/engines/mads/audio.cpp b/engines/mads/audio.cpp new file mode 100644 index 0000000000..0a9637bfcf --- /dev/null +++ b/engines/mads/audio.cpp @@ -0,0 +1,129 @@ +/* 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 "mads/audio.h" +#include "mads/compression.h" + +#include "common/stream.h" +#include "audio/audiostream.h" +#include "audio/mixer.h" +#include "audio/decoders/raw.h" + +namespace MADS { + +AudioPlayer::AudioPlayer(Audio::Mixer *mixer, uint32 gameID) : _mixer(mixer), _gameID(gameID) { + setVolume(Audio::Mixer::kMaxChannelVolume); + setDefaultSoundGroup(); +} + +AudioPlayer::~AudioPlayer() { + _dsrEntries.clear(); +} + +bool AudioPlayer::isPlaying() const { + return _mixer->isSoundHandleActive(_handle); +} + +void AudioPlayer::setVolume(int volume) { + _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, volume); + _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, volume); +} + +void AudioPlayer::setDefaultSoundGroup() { + switch (_gameID) { + case GType_RexNebular: + setSoundGroup("rex009.dsr"); + break; + case GType_Dragonsphere: + setSoundGroup("drag009.dsr"); + break; + case GType_Phantom: + setSoundGroup("phan009.dsr"); + break; + default: + error("setDefaultSoundGroup: Unknown game"); + } +} + +void AudioPlayer::setSoundGroup(const Common::String &filename) { + _dsrEntries.clear(); + + _filename = filename; + _dsrFile.open(filename); + + // Read header + uint16 entryCount = _dsrFile.readUint16LE(); + + for (uint16 i = 0; i < entryCount; i++) { + DSREntry newEntry; + newEntry.frequency = _dsrFile.readUint16LE(); + newEntry.channels = _dsrFile.readUint32LE(); + newEntry.compSize = _dsrFile.readUint32LE(); + newEntry.uncompSize = _dsrFile.readUint32LE(); + newEntry.offset = _dsrFile.readUint32LE(); + _dsrEntries.push_back(newEntry); + } + + _dsrFile.close(); +} + +void AudioPlayer::playSound(int soundIndex, bool loop) { + if (_dsrEntries.empty()) { + warning("DSR file not loaded, not playing sound"); + return; + } + + if (soundIndex < 0 || soundIndex > _dsrEntries.size() - 1) { + warning("Invalid sound index: %i (max %i), not playing sound", soundIndex, _dsrEntries.size() - 1); + return; + } + + // Get sound data + FabDecompressor fab; + int32 compSize = _dsrEntries[soundIndex].compSize; + int32 uncompSize = _dsrEntries[soundIndex].uncompSize; + int32 offset = _dsrEntries[soundIndex].offset; + int16 frequency = _dsrEntries[soundIndex].frequency; + byte *compData = new byte[compSize]; + byte *buffer = new byte[uncompSize]; + _dsrFile.open(_filename); + _dsrFile.seek(offset, SEEK_SET); + _dsrFile.read(compData, compSize); + _dsrFile.close(); + + fab.decompress(compData, compSize, buffer, uncompSize); + + // Play sound + Audio::AudioStream *stream = Audio::makeLoopingAudioStream( + Audio::makeRawStream(buffer, uncompSize, frequency, Audio::FLAG_UNSIGNED), + loop ? 0 : 1); + _mixer->playStream(Audio::Mixer::kSFXSoundType, &_handle, stream, -1, Audio::Mixer::kMaxChannelVolume); + + /* + // Dump the sound file + FILE *destFile = fopen("sound.raw", "wb"); + fwrite(_dsrFile.dsrEntries[soundIndex]->data, _dsrFile.dsrEntries[soundIndex].uncompSize, 1, destFile); + fclose(destFile); + */ +} + +} // End of namespace M4 diff --git a/engines/mads/audio.h b/engines/mads/audio.h new file mode 100644 index 0000000000..21f4bed59a --- /dev/null +++ b/engines/mads/audio.h @@ -0,0 +1,64 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_AUDIO_H +#define MADS_AUDIO_H + +#include "mads/resources.h" + +#include "common/array.h" +#include "audio/mixer.h" + +namespace MADS { + +struct DSREntry { + int16 frequency; + int channels; + int32 compSize; + int32 uncompSize; + int32 offset; +}; + +class AudioPlayer { +public: + AudioPlayer(Audio::Mixer *mixer, uint32 gameID); + ~AudioPlayer(); + + void setSoundGroup(const Common::String &filename); + void setDefaultSoundGroup(); + void playSound(int soundIndex, bool loop = false); + void setVolume(int volume); + bool isPlaying() const; + + private: + Audio::Mixer *_mixer; + Audio::SoundHandle _handle; + uint32 _gameID; + + File _dsrFile; + Common::String _filename; + Common::Array _dsrEntries; +}; + +} // End of namespace MADS + +#endif diff --git a/engines/mads/debugger.cpp b/engines/mads/debugger.cpp index a6192b2a34..80a8cb748e 100644 --- a/engines/mads/debugger.cpp +++ b/engines/mads/debugger.cpp @@ -35,6 +35,7 @@ Debugger::Debugger(MADSEngine *vm) : GUI::Debugger(), _vm(vm) { DCmd_Register("show_hotspots", WRAP_METHOD(Debugger, Cmd_ShowHotSpots)); DCmd_Register("list_hotspots", WRAP_METHOD(Debugger, Cmd_ListHotSpots)); DCmd_Register("play_sound", WRAP_METHOD(Debugger, Cmd_PlaySound)); + DCmd_Register("play_audio", WRAP_METHOD(Debugger, Cmd_PlayAudio)); DCmd_Register("show_codes", WRAP_METHOD(Debugger, Cmd_ShowCodes)); DCmd_Register("dump_file", WRAP_METHOD(Debugger, Cmd_DumpFile)); DCmd_Register("show_quote", WRAP_METHOD(Debugger, Cmd_ShowQuote)); @@ -125,6 +126,24 @@ bool Debugger::Cmd_PlaySound(int argc, const char **argv) { return false; } +bool Debugger::Cmd_PlayAudio(int argc, const char **argv) { + if (argc < 2) { + DebugPrintf("Usage: %s \n", argv[0]); + DebugPrintf("If the sound group isn't defined, the default one will be used\n"); + } else { + int index = strToInt(argv[1]); + Common::String soundGroup = (argc >= 3) ? argv[2] : ""; + if (argc >= 3) + _vm->_audio->setSoundGroup(argv[2]); + else + _vm->_audio->setDefaultSoundGroup(); + + _vm->_audio->playSound(index); + } + + return true; +} + bool Debugger::Cmd_ShowCodes(int argc, const char **argv) { Scene &scene = _vm->_game->_scene; diff --git a/engines/mads/debugger.h b/engines/mads/debugger.h index c2d66d9118..19827495d4 100644 --- a/engines/mads/debugger.h +++ b/engines/mads/debugger.h @@ -39,6 +39,7 @@ protected: bool Cmd_ShowHotSpots(int argc, const char **argv); bool Cmd_ListHotSpots(int argc, const char **argv); bool Cmd_PlaySound(int argc, const char **argv); + bool Cmd_PlayAudio(int argc, const char **argv); bool Cmd_ShowCodes(int argc, const char **argv); bool Cmd_DumpFile(int argc, const char **argv); bool Cmd_ShowQuote(int argc, const char **argv); diff --git a/engines/mads/game.h b/engines/mads/game.h index 982f880dca..246a7857a6 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -27,6 +27,7 @@ #include "common/savefile.h" #include "common/str-array.h" #include "common/serializer.h" +#include "mads/audio.h" #include "mads/scene.h" #include "mads/game_data.h" #include "mads/globals.h" diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index cb84f4da88..29db804f16 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -88,6 +88,7 @@ void MADSEngine::initialise() { _font = new Font(); _screen.init(); _sound = new SoundManager(this, _mixer); + _audio = new AudioPlayer(_mixer, getGameID()); _game = Game::init(this); _screen.empty(); diff --git a/engines/mads/mads.h b/engines/mads/mads.h index d6a2a848bc..61d61a2564 100644 --- a/engines/mads/mads.h +++ b/engines/mads/mads.h @@ -98,6 +98,7 @@ public: Resources *_resources; ScreenSurface _screen; SoundManager *_sound; + AudioPlayer *_audio; bool _easyMouse; bool _invObjectsAnimated; bool _textWindowStill; diff --git a/engines/mads/module.mk b/engines/mads/module.mk index e5b9efefc8..9d5857904e 100644 --- a/engines/mads/module.mk +++ b/engines/mads/module.mk @@ -17,6 +17,7 @@ MODULE_OBJS := \ action.o \ animation.o \ assets.o \ + audio.o \ compression.o \ debugger.o \ detection.o \ -- cgit v1.2.3 From 83a1ce6e29fdc0f5a51bc7d912b227f40eacd164 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 28 Apr 2014 03:02:07 +0300 Subject: MADS: Implement scene 366 --- engines/mads/nebular/nebular_scenes.cpp | 2 ++ engines/mads/nebular/nebular_scenes3.cpp | 33 ++++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes3.h | 13 +++++++++++++ 3 files changed, 48 insertions(+) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index fe915ed700..278a2628db 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -148,6 +148,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene359(vm); case 360: return new Scene360(vm); + case 366: + return new Scene366(vm); // Scene group #8 case 804: diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 1213cd8a86..2368e0be48 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -4800,5 +4800,38 @@ void Scene360::actions() { /*------------------------------------------------------------------------*/ +void Scene366::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene366::enter() { + _scene->_userInterface.setup(kInputLimitedSentences); + _game._player._visible = false; + sceneEntrySound(); +} + +void Scene366::actions() { + if (_action.isAction(0x2D5, 0x2D4)) + _scene->_nextSceneId = 302; + else if (_action.isAction(VERB_OPEN, 0x2D3)) { + if (_game._visitedScenes.exists(316)) + _vm->_dialogs->show(0x8F04); // 366, 12 + else + _vm->_dialogs->show(0x8F05); // 366, 13 + _scene->_nextSceneId = 316; + } else if (_action.isAction(0xD3, 0x2D3)) { + if (_game._visitedScenes.exists(321)) + _vm->_dialogs->show(0x8F03); // 366, 11 + else + _vm->_dialogs->show(0x8F02); // 366, 10 + } else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h index 7f2996eb4a..84cf4ce10c 100644 --- a/engines/mads/nebular/nebular_scenes3.h +++ b/engines/mads/nebular/nebular_scenes3.h @@ -461,6 +461,19 @@ public: virtual void actions(); virtual void postActions() {}; }; + +class Scene366: public Scene3xx { +public: + Scene366(MADSEngine *vm) : Scene3xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step() {}; + virtual void preActions() {} + virtual void actions(); + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 1e3061d3bb5a6df2b2daf379af67d45bf313fbc3 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 28 Apr 2014 03:30:33 +0300 Subject: MADS: Bugfixes for Nebular scene 102 This fixes the binoculars, the refrigerator and partly fixes the ladder/hatchway --- engines/mads/nebular/nebular_scenes1.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 54db1d3919..ab1b2d1423 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -654,7 +654,7 @@ void Scene102::enter() { _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 4, 0, 1, 0); _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 3, 0, 0, 5); - if (!_game._objects.isInRoom(OBJ_BINOCULARS)) + if (_game._objects.isInRoom(OBJ_BINOCULARS)) _globals._sequenceIndexes[9] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 24, 0, 0, 24); else _scene->_hotspots.activate(0x27, false); @@ -798,7 +798,7 @@ void Scene102::actions() { return; } - if (_action.isAction(0x122) && !_fridgeOpenedFl) { + if (_action._activeAction._objectNameId == 0x122 && !_fridgeOpenedFl) { switch (_game._trigger) { case 0: _globals._sequenceIndexes[7] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 6, 1, 0, 0); @@ -970,7 +970,7 @@ void Scene102::actions() { return; } - if ((_action.isAction(0xC7) || _action.isAction(0xA3)) && (_action.isAction(VERB_LOOK) || _action.isAction(0x50) || _action.isAction(0x4F))) { + if ((_action._activeAction._objectNameId == 0xC7 || _action._activeAction._objectNameId == 0xA3) && (_action.isAction(VERB_LOOK) || _action.isAction(0x50) || _action.isAction(0x4F))) { if (_game._objects.isInInventory(OBJ_REBREATHER)) { if (!_action.isAction(0x50) && !_action.isAction(0x4F)) { _vm->_dialogs->show(0x27F7); @@ -984,7 +984,7 @@ void Scene102::actions() { } } - if ( (_action.isAction(0xC7) || _action.isAction(0xA3)) && (_action.isAction(0x50) || _action.isAction(0x4F)) ) { + if ((_action._activeAction._objectNameId == 0xC7 || _action._activeAction._objectNameId == 0xA3) && (_action.isAction(0x50) || _action.isAction(0x4F)) ) { switch (_game._trigger) { case 0: _scene->loadAnimation(formAnimName('A', -1), 1); -- cgit v1.2.3 From 5bb66bdd5b2adc0c11da235ddcf02966f38c4411 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 28 Apr 2014 07:07:56 +0200 Subject: MADS: Implement case 361 --- engines/mads/nebular/nebular_scenes.cpp | 3 + engines/mads/nebular/nebular_scenes3.cpp | 384 +++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes3.h | 17 ++ 3 files changed, 404 insertions(+) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 278a2628db..31d139d7e2 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -148,6 +148,9 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene359(vm); case 360: return new Scene360(vm); + case 361: + return new Scene361(vm); + case 366: return new Scene366(vm); diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 2368e0be48..1d5867edfb 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -4800,6 +4800,390 @@ void Scene360::actions() { /*------------------------------------------------------------------------*/ +void Scene361::setup() { + if (_scene->_currentSceneId == 391) + _globals[kSexOfRex] = REX_MALE; + + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene361::handleRexAction() { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 50, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 3, -2); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 15); + + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 15, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], -1, 4); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[2]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + + case 1: { + int seqIdx = _globals._sequenceIndexes[1]; + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 4); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 15); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[1], seqIdx); + } + break; + + case 2: { + int seqIdx = _globals._sequenceIndexes[2]; + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 4, 10); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[2]); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], seqIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 3); + } + break; + + case 3: { + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 3); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); + + int seqIdx = _globals._sequenceIndexes[2]; + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 11); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[2]); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(167, 100)); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], seqIdx); + _scene->_sequences.addTimer(15, 4); + } + break; + + case 4: + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 2); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); + + _scene->_sequences.setDone(_globals._sequenceIndexes[2]); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 12, 14); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[2]); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(167, 100)); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 5); + break; + + case 5: { + int seqIdx = _globals._sequenceIndexes[2]; + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 15); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[2]); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(167, 100)); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], seqIdx); + _scene->_sequences.addTimer(15, 6); + } + break; + + case 6: + _scene->_sequences.setDone(_globals._sequenceIndexes[2]); + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); + _scene->_sequences.addTimer(48, 7); + break; + + case 7: + _scene->_nextSceneId = 313; + break; + + default: + break; + } +} + +void Scene361::handleRoxAction() { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 18, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 2, 4); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 15); + + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 18, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], -1, 3); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + + case 1: { + int tmpIdx = _globals._sequenceIndexes[1]; + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 4); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 15); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[1], tmpIdx); + } + break; + + case 2: { + int tmpIdx = _globals._sequenceIndexes[4]; + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 4, 8); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], tmpIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 3); + } + break; + + case 3: { + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 3); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); + + int tmpIdx = _globals._sequenceIndexes[4]; + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 9, 10); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(167, 100)); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], tmpIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 4); + } + break; + + case 4: { + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 2); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); + + int tmpIdx = _globals._sequenceIndexes[4]; + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 11, 15); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(167, 100)); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], tmpIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 5); + } + break; + + case 5: { + int tmpIdx = _globals._sequenceIndexes[4]; + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 16); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(167, 100)); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], tmpIdx); + _scene->_sequences.addTimer(48, 6); + } + break; + + case 6: + _scene->_sequences.setDone(_globals._sequenceIndexes[4]); + + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); + _scene->_sequences.addTimer(48, 7); + break; + + case 7: + _scene->_nextSceneId = 313; + break; + + default: + break; + } +} + +void Scene361::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(Resources::formatName(307, 'X', 0, EXT_SS, "")); + + if (_globals[kSexOfRex] == REX_MALE) { + _globals._spriteIndexes[2] = _scene->_sprites.addSprites("*RXCL_8"); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites("*RXCL_2"); + } else + _globals._spriteIndexes[4] = _scene->_sprites.addSprites("*ROXCL_8"); + + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 15); + + if (_scene->_priorSceneId == 391) { + _globals[kSexOfRex] = REX_MALE; + _game._player._stepEnabled = false; + _game._player._visible = false; + _game._player._facing = FACING_SOUTH; + _game._player._playerPos = Common::Point(166, 101); + _scene->_sequences.addTimer(120, 70); + } else if (_scene->_priorSceneId == 360) + _game._player._playerPos = Common::Point(302, 145); + else if (_scene->_priorSceneId == 320) { + _game._player._playerPos = Common::Point(129, 113); + _game._player._facing = FACING_SOUTH; + } else if (_scene->_priorSceneId != -2) + _game._player._playerPos = Common::Point(13, 145); + + _game.loadQuoteSet(0xFB, 0xFC, 0); + + if (_scene->_priorSceneId == 320) + _scene->_kernelMessages.setQuoted(_scene->_kernelMessages.addQuote(0xFB, 0, 0x78), 4, true); + + sceneEntrySound(); +} + +void Scene361::step() { + if (_game._trigger >= 70) { + switch (_game._trigger) { + case 70: + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 2); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); + + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.addTimer(15, 71); + break; + + case 71: + _scene->_sequences.setDone(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 2); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.addTimer(15, 72); + break; + + case 72: + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 3); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); + + _scene->_sequences.setDone(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 3); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.addTimer(15, 73); + break; + + case 73: + _scene->_sequences.setDone(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 4, 5); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 74); + break; + + case 74: { + int seqIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 6); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], seqIdx); + _scene->_sequences.addTimer(15, 75); + } + break; + + case 75: + _scene->_sequences.setDone(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 7); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.addTimer(15, 76); + break; + + case 76: + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 2); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); + + _scene->_sequences.setDone(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 8); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.addTimer(15, 77); + break; + + case 77: + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 15); + + _scene->_sequences.setDone(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 9); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.addTimer(15, 78); + break; + + case 78: + _scene->_sequences.setDone(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 10, -2); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 79); + break; + + case 79: + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[3]); + _game._player._stepEnabled = true; + _game._player._visible = true; + break; + + default: + break; + } + } +} + +void Scene361::preActions() { + if (_action.isAction(0x1AD, 0x2B9)) + _game._player._walkOffScreenSceneId = 360; + + if (_action.isAction(0x1AD, 0x2BA)) + _game._player._walkOffScreenSceneId = 354; +} + +void Scene361::actions() { + if (_action._lookFlag) + _vm->_dialogs->show(0x8D17); + else if (_action.isAction(0x21F, 0x1E4)) { + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.addQuote(0xFC, 120, 0); + } else if (_action.isAction(0x2F7, 0x11)) { + if (_globals[kSexOfRex] == REX_FEMALE) + handleRoxAction(); + else + handleRexAction(); + } else if (_action.isAction(VERB_LOOK, 0x1E4)) + _vm->_dialogs->show(0x8D0E); + else if (_action.isAction(VERB_LOOK, 0x18D)) + _vm->_dialogs->show(0x8D0F); + else if (_action.isAction(VERB_LOOK, 0x220) || _action.isAction(0x155, 0x220)) + _vm->_dialogs->show(0x8D10); + else if (_action.isAction(VERB_LOOK, 0x208) || _action.isAction(0x155, 0x208)) + _vm->_dialogs->show(0x8D11); + else if (_action.isAction(VERB_TAKE, 0x208)) + _vm->_dialogs->show(0x8D12); + else if (_action.isAction(VERB_LOOK, 0x2F8) || _action.isAction(0x155, 0x2F8)) + _vm->_dialogs->show(0x8D13); + else if (_action.isAction(VERB_TAKE, 0x2F8)) + _vm->_dialogs->show(0x8D14); + else if (_action.isAction(VERB_LOOK, 0x2BA)) + _vm->_dialogs->show(0x8D15); + else if (_action.isAction(VERB_LOOK, 0x2B9)) + _vm->_dialogs->show(0x8D16); + else if (_action.isAction(VERB_LOOK, 0x11)) + _vm->_dialogs->show(0x8D18); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + void Scene366::setup() { setPlayerSpritesPrefix(); setAAName(); diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h index 84cf4ce10c..b2819d55f9 100644 --- a/engines/mads/nebular/nebular_scenes3.h +++ b/engines/mads/nebular/nebular_scenes3.h @@ -462,6 +462,22 @@ public: virtual void postActions() {}; }; +class Scene361: public Scene3xx { +private: + void handleRexAction(); + void handleRoxAction(); + +public: + Scene361(MADSEngine *vm) : Scene3xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; + class Scene366: public Scene3xx { public: Scene366(MADSEngine *vm) : Scene3xx(vm) {} @@ -474,6 +490,7 @@ public: virtual void postActions() {}; }; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 464627f0432d6038ee6afd6af632a8a34d1d89d8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 28 Apr 2014 07:08:23 +0200 Subject: MADS: Fix a couple of warnings --- engines/mads/audio.cpp | 2 +- engines/mads/game_data.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/mads/audio.cpp b/engines/mads/audio.cpp index 0a9637bfcf..1c61e13957 100644 --- a/engines/mads/audio.cpp +++ b/engines/mads/audio.cpp @@ -92,7 +92,7 @@ void AudioPlayer::playSound(int soundIndex, bool loop) { return; } - if (soundIndex < 0 || soundIndex > _dsrEntries.size() - 1) { + if (soundIndex < 0 || soundIndex > (int)_dsrEntries.size() - 1) { warning("Invalid sound index: %i (max %i), not playing sound", soundIndex, _dsrEntries.size() - 1); return; } diff --git a/engines/mads/game_data.cpp b/engines/mads/game_data.cpp index 9211bbfa5a..72137cfa69 100644 --- a/engines/mads/game_data.cpp +++ b/engines/mads/game_data.cpp @@ -47,7 +47,7 @@ bool VisitedScenes::exists(int sceneId) { } void VisitedScenes::synchronize(Common::Serializer &s) { - int count = size(); + uint count = size(); int v = 0; s.syncAsUint16LE(count); -- cgit v1.2.3 From ff7f30af9906500a53747770d0343d0d9fd4c072 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 28 Apr 2014 07:20:24 +0200 Subject: MADS: Implement scene 387 --- engines/mads/nebular/nebular_scenes.cpp | 3 ++- engines/mads/nebular/nebular_scenes3.cpp | 27 +++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes3.h | 11 +++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 31d139d7e2..87a7a96d28 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -150,9 +150,10 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene360(vm); case 361: return new Scene361(vm); - case 366: return new Scene366(vm); + case 387: + return new Scene387(vm); // Scene group #8 case 804: diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 1d5867edfb..9558edb980 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -5217,5 +5217,32 @@ void Scene366::actions() { /*------------------------------------------------------------------------*/ +void Scene387::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene387::enter() { + _scene->_userInterface.setup(kInputLimitedSentences); + _game._player._visible = false; + + sceneEntrySound(); +} + +void Scene387::actions() { + if (_action.isAction(0x2D5, 0x2D4)) + _scene->_nextSceneId = 313; + else if (_action.isAction(0xD3, 0x2D3)) + _vm->_dialogs->show(0x9736); + else if (_action.isAction(VERB_OPEN, 0x2D3)) + _vm->_dialogs->show(0x9737); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h index b2819d55f9..24b1aef82b 100644 --- a/engines/mads/nebular/nebular_scenes3.h +++ b/engines/mads/nebular/nebular_scenes3.h @@ -490,6 +490,17 @@ public: virtual void postActions() {}; }; +class Scene387: public Scene3xx { +public: + Scene387(MADSEngine *vm) : Scene3xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step() {}; + virtual void preActions() {} + virtual void actions(); + virtual void postActions() {}; +}; } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 396905d90512f265fd95a87208d2295265e500e3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 28 Apr 2014 21:23:43 +0200 Subject: MADS: Implement scene 388 --- engines/mads/nebular/nebular_scenes.cpp | 2 + engines/mads/nebular/nebular_scenes3.cpp | 63 ++++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes3.h | 12 ++++++ 3 files changed, 77 insertions(+) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 87a7a96d28..77a7a223c9 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -154,6 +154,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene366(vm); case 387: return new Scene387(vm); + case 388: + return new Scene388(vm); // Scene group #8 case 804: diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 9558edb980..4db80836e8 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -5244,5 +5244,68 @@ void Scene387::actions() { /*------------------------------------------------------------------------*/ +void Scene388::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene388::enter() { + _scene->_userInterface.setup(kInputLimitedSentences); + + if (_globals[kAfterHavoc]) + _scene->_hotspots.activate(0x303, false); + else { + _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('b', 0)); + _globals._sequenceIndexes[0] = _scene->_sequences.startCycle(_globals._spriteIndexes[0], false, 1); + } + + _game._player._visible = false; + _vm->_palette->setEntry(252, 63, 30, 20); + _vm->_palette->setEntry(253, 45, 15, 12); + _game.loadQuoteSet(0x154, 0x155, 0x156, 0x157, 0x158, 0); + + sceneEntrySound(); +} + +void Scene388::actions() { + if (_action.isAction(0x2D5, 0x2D4)) + _scene->_nextSceneId = 313; + else if (_action.isAction(VERB_TALKTO, 0x303)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(160, 136), 0x1110, 32, 1, 120, _game.getQuote(0x154)); + break; + + case 1: + _scene->_kernelMessages.add(Common::Point(82, 38), 0xFDFC, 0, 0, 300, _game.getQuote(0x156)); + _scene->_kernelMessages.add(Common::Point(82, 52), 0xFDFC, 0, 0, 300, _game.getQuote(0x157)); + _scene->_kernelMessages.add(Common::Point(82, 66), 0xFDFC, 0, 2, 300, _game.getQuote(0x158)); + break; + + case 2: + _game._player._stepEnabled = true; + _scene->_kernelMessages.add(Common::Point(160, 136), 0x1110, 32, 0, 120, _game.getQuote(0x155)); + break; + + default: + break; + } + } else if (_action.isAction(0xD3, 0x2D3)) { + if (_globals[kAfterHavoc]) + _vm->_dialogs->show(0x979B); + else + _vm->_dialogs->show(0x979A); + } else if (_action.isAction(VERB_OPEN, 0x2D3)) + _vm->_dialogs->show(0x979C); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h index 24b1aef82b..4de4fc1a2c 100644 --- a/engines/mads/nebular/nebular_scenes3.h +++ b/engines/mads/nebular/nebular_scenes3.h @@ -502,6 +502,18 @@ public: virtual void postActions() {}; }; +class Scene388: public Scene3xx { +public: + Scene388(MADSEngine *vm) : Scene3xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step() {}; + virtual void preActions() {} + virtual void actions(); + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 5be9157dce4b6ab479f76ecab4086c0ee75d7958 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 28 Apr 2014 22:21:45 +0200 Subject: MADS: Implement scene 389 --- engines/mads/nebular/nebular_scenes.cpp | 2 + engines/mads/nebular/nebular_scenes3.cpp | 80 ++++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes3.h | 17 +++++++ 3 files changed, 99 insertions(+) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 77a7a223c9..d3caa19b8a 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -156,6 +156,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene387(vm); case 388: return new Scene388(vm); + case 389: + return new Scene389(vm); // Scene group #8 case 804: diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 4db80836e8..5d84a3203a 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -5307,5 +5307,85 @@ void Scene388::actions() { /*------------------------------------------------------------------------*/ +void Scene389::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene389::enter() { + _scene->_userInterface.setup(kInputLimitedSentences); + _monsterTime = 0; + _circularQuoteId = 0x159; + + if (_globals[kAfterHavoc]) + _scene->_hotspots.activate(0x304, false); + else { + _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('m', -1)); + _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 6, 0, 0, 0); + warning("TODO: sub71704(1, 88, 177, 19, 17, 0xD, 2, 0xFDFC, 0x3C, 0xF7, 0xF8, 0xF9, 0);"); + } + + _vm->_palette->setEntry(252, 63, 37, 26); + _vm->_palette->setEntry(253, 45, 24, 17); + _game._player._visible = false; + _game.loadQuoteSet(0xF7, 0xF8, 0xF9, 0x159, 0x15A, 0x15B, 0); + + sceneEntrySound(); +} + +void Scene389::step() { + warning("TODO: sub7178C()"); + + if (_scene->_frameStartTime >= _monsterTime) { + warning("sub717B2(20, (sub7176C() << 2) + 1);"); + _monsterTime = _scene->_frameStartTime + 2; + } +} + +void Scene389::actions() { + if (_action.isAction(0x2D5, 0x2D4)) + _scene->_nextSceneId = 313; + else if (_action.isAction(VERB_TALKTO, 0x304)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _scene->_kernelMessages.add(Common::Point(160, 136), 0x1110, 32, 1, 120, _game.getQuote(_circularQuoteId)); + _circularQuoteId++; + if (_circularQuoteId > 0x15B) + _circularQuoteId = 0x159; + + break; + + case 1: + _game._player._stepEnabled = true; + break; + + default: + break; + } + } else if (_action.isAction(0xD3, 0x2D3)) { + if (_globals[kAfterHavoc]) { + if (_game._difficulty != DIFFICULTY_HARD) { + if (_game._objects[OBJ_SECURITY_CARD]._roomNumber == 359) + _vm->_dialogs->show(0x97FF); + else + _vm->_dialogs->show(0x9800); + } else + _vm->_dialogs->show(0x9800); + } else + _vm->_dialogs->show(0x97FE); + } else if (_action.isAction(VERB_OPEN, 0x2D3)) { + if (_globals[kAfterHavoc]) + _vm->_dialogs->show(0x9802); + else + _vm->_dialogs->show(0x9801); + } else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h index 4de4fc1a2c..d05c5e8980 100644 --- a/engines/mads/nebular/nebular_scenes3.h +++ b/engines/mads/nebular/nebular_scenes3.h @@ -514,6 +514,23 @@ public: virtual void postActions() {}; }; +class Scene389: public Scene3xx { +private: + uint32 _monsterTime; + + int _circularQuoteId; + +public: + Scene389(MADSEngine *vm) : Scene3xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {} + virtual void actions(); + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 04b809a7a2fd3bfc8b7d45b8876d286fb98f7b3f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 28 Apr 2014 22:32:44 +0200 Subject: MADS: Implement scene 390 --- engines/mads/nebular/nebular_scenes.cpp | 2 ++ engines/mads/nebular/nebular_scenes3.cpp | 28 ++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes3.h | 12 ++++++++++++ 3 files changed, 42 insertions(+) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index d3caa19b8a..7b9e476fb3 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -158,6 +158,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene388(vm); case 389: return new Scene389(vm); + case 390: + return new Scene390(vm); // Scene group #8 case 804: diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 5d84a3203a..2d4022f944 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -5385,6 +5385,34 @@ void Scene389::actions() { _action._inProgress = false; } +/*------------------------------------------------------------------------*/ + +void Scene390::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene390::enter() { + _scene->_userInterface.setup(kInputLimitedSentences); + _game._player._visible = false; + + sceneEntrySound(); +} + +void Scene390::actions() { + if (_action.isAction(0x2D5, 0x2D4)) + _scene->_nextSceneId = 313; + else if (_action.isAction(0xD3, 0x2D3)) + _vm->_dialogs->show(0x9862); + else if (_action.isAction(VERB_OPEN, 0x2D3)) + _vm->_dialogs->show(0x9863); + else + return; + + _action._inProgress = false; +} + + /*------------------------------------------------------------------------*/ } // End of namespace Nebular diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h index d05c5e8980..3b997a2709 100644 --- a/engines/mads/nebular/nebular_scenes3.h +++ b/engines/mads/nebular/nebular_scenes3.h @@ -531,6 +531,18 @@ public: virtual void postActions() {}; }; +class Scene390: public Scene3xx { +public: + Scene390(MADSEngine *vm) : Scene3xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step() {}; + virtual void preActions() {} + virtual void actions(); + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From aac3206ec824bb6be8943c7afeff474fb0a2183f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 28 Apr 2014 22:43:00 +0200 Subject: MADS: Implement scene 391 --- engines/mads/nebular/nebular_scenes.cpp | 2 ++ engines/mads/nebular/nebular_scenes3.cpp | 38 ++++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes3.h | 12 ++++++++++ 3 files changed, 52 insertions(+) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 7b9e476fb3..caa72b1ffd 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -160,6 +160,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene389(vm); case 390: return new Scene390(vm); + case 391: + return new Scene391(vm); // Scene group #8 case 804: diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 2d4022f944..a5d37b4a9a 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -5412,6 +5412,44 @@ void Scene390::actions() { _action._inProgress = false; } +/*------------------------------------------------------------------------*/ + +void Scene391::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene391::enter() { + _scene->_userInterface.setup(kInputLimitedSentences); + _game._player._visible = false; + sceneEntrySound(); +} + +void Scene391::actions() { + if (_action.isAction(0x2D5, 0x2D4)) + _scene->_nextSceneId = 313; + else if (_action.isAction(VERB_OPEN, 0x2D3)) { + if (_globals[kKickedIn391Grate]) + _vm->_dialogs->show(0x98C9); + else { + _vm->_dialogs->show(0x98C8); + _globals[kKickedIn391Grate] = true; + } + + if (_globals[kAfterHavoc]) + _scene->_nextSceneId = 361; + else + _scene->_nextSceneId = 311; + } else if (_action.isAction(0xD3, 0x2D3)) { + if (_globals[kAfterHavoc]) + _vm->_dialogs->show(0x98C7); + else + _vm->_dialogs->show(0x98C6); + } else + return; + + _action._inProgress = false; +} /*------------------------------------------------------------------------*/ diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h index 3b997a2709..111eade8d5 100644 --- a/engines/mads/nebular/nebular_scenes3.h +++ b/engines/mads/nebular/nebular_scenes3.h @@ -543,6 +543,18 @@ public: virtual void postActions() {}; }; +class Scene391: public Scene3xx { +public: + Scene391(MADSEngine *vm) : Scene3xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step() {}; + virtual void preActions() {} + virtual void actions(); + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From be75349346e943542dfc0f77933a771b2181ba16 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 28 Apr 2014 23:07:33 +0200 Subject: MADS: Refactor a bit scene 389, implement scene 399 --- engines/mads/nebular/nebular_scenes.cpp | 2 ++ engines/mads/nebular/nebular_scenes3.cpp | 44 +++++++++++++++++++++++++++----- engines/mads/nebular/nebular_scenes3.h | 11 ++++++++ 3 files changed, 51 insertions(+), 6 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index caa72b1ffd..f012a6825a 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -162,6 +162,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene390(vm); case 391: return new Scene391(vm); + case 399: + return new Scene399(vm); // Scene group #8 case 804: diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index a5d37b4a9a..62f30d254a 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -5365,12 +5365,9 @@ void Scene389::actions() { } } else if (_action.isAction(0xD3, 0x2D3)) { if (_globals[kAfterHavoc]) { - if (_game._difficulty != DIFFICULTY_HARD) { - if (_game._objects[OBJ_SECURITY_CARD]._roomNumber == 359) - _vm->_dialogs->show(0x97FF); - else - _vm->_dialogs->show(0x9800); - } else + if ((_game._difficulty != DIFFICULTY_HARD) && (_game._objects[OBJ_SECURITY_CARD]._roomNumber == 359)) + _vm->_dialogs->show(0x97FF); + else _vm->_dialogs->show(0x9800); } else _vm->_dialogs->show(0x97FE); @@ -5453,5 +5450,40 @@ void Scene391::actions() { /*------------------------------------------------------------------------*/ +void Scene399::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene399::enter() { + _scene->_userInterface.setup(kInputLimitedSentences); + _game._player._visible = false; + sceneEntrySound(); +} + +void Scene399::actions() { + if (_action.isAction(0x2D5, 0x2D4)) + _scene->_nextSceneId = 313; + else if (_action.isAction(0xD3, 0x2D3)) { + if (_globals[kAfterHavoc]) { + if ((_game._difficulty != DIFFICULTY_HARD) && (_game._objects[OBJ_SECURITY_CARD]._roomNumber == 359)) + _vm->_dialogs->show(0x97FF); + else + _vm->_dialogs->show(0x9800); + } else + _vm->_dialogs->show(0x97FE); + } else if (_action.isAction(VERB_OPEN, 0x2D3)) { + if (_globals[kAfterHavoc]) + _vm->_dialogs->show(0x9802); + else + _vm->_dialogs->show(0x9801); + } else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h index 111eade8d5..45d0c9a9a9 100644 --- a/engines/mads/nebular/nebular_scenes3.h +++ b/engines/mads/nebular/nebular_scenes3.h @@ -555,6 +555,17 @@ public: virtual void postActions() {}; }; +class Scene399: public Scene3xx { +public: + Scene399(MADSEngine *vm) : Scene3xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step() {}; + virtual void preActions() {} + virtual void actions(); + virtual void postActions() {}; +}; } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 487a9d4069281fa2bc1b4d2dcf0bb95007879884 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 29 Apr 2014 00:01:00 +0200 Subject: MADS: Add scene4xx common functions --- engines/mads/module.mk | 1 + engines/mads/nebular/nebular_scenes.cpp | 1 + engines/mads/nebular/nebular_scenes4.cpp | 97 ++++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes4.h | 56 ++++++++++++++++++ 4 files changed, 155 insertions(+) create mode 100644 engines/mads/nebular/nebular_scenes4.cpp create mode 100644 engines/mads/nebular/nebular_scenes4.h diff --git a/engines/mads/module.mk b/engines/mads/module.mk index 9d5857904e..5fe0c90603 100644 --- a/engines/mads/module.mk +++ b/engines/mads/module.mk @@ -13,6 +13,7 @@ MODULE_OBJS := \ nebular/nebular_scenes1.o \ nebular/nebular_scenes2.o \ nebular/nebular_scenes3.o \ + nebular/nebular_scenes4.o \ nebular/nebular_scenes8.o \ action.o \ animation.o \ diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index f012a6825a..19b4f9f177 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -31,6 +31,7 @@ #include "mads/nebular/nebular_scenes1.h" #include "mads/nebular/nebular_scenes2.h" #include "mads/nebular/nebular_scenes3.h" +#include "mads/nebular/nebular_scenes4.h" #include "mads/nebular/nebular_scenes8.h" namespace MADS { diff --git a/engines/mads/nebular/nebular_scenes4.cpp b/engines/mads/nebular/nebular_scenes4.cpp new file mode 100644 index 0000000000..da40d9bbbd --- /dev/null +++ b/engines/mads/nebular/nebular_scenes4.cpp @@ -0,0 +1,97 @@ +/* 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 "common/scummsys.h" +#include "mads/mads.h" +#include "mads/scene.h" +#include "mads/nebular/nebular_scenes.h" +#include "mads/nebular/nebular_scenes4.h" + +namespace MADS { + +namespace Nebular { + +void Scene4xx::setAAName() { + _game._aaName = Resources::formatAAName(4); +} + +void Scene4xx::setPlayerSpritesPrefix() { + _vm->_sound->command(5); + Common::String oldName = _game._player._spritesPrefix; + + if ((_scene->_nextSceneId == 403) || (_scene->_nextSceneId == 409)) + _game._player._spritesPrefix = ""; + else if (_globals[kSexOfRex] == REX_FEMALE) + _game._player._spritesPrefix = "ROX"; + else + _game._player._spritesPrefix = "RXM"; + + _game._player._scalingVelocity = true; + + if (oldName != _game._player._spritesPrefix) + _game._player._spritesChanged = true; + + _vm->_palette->setEntry(16, 10, 63, 63); + _vm->_palette->setEntry(17, 10, 45, 45); +} + +void Scene4xx::sceneEntrySound() { + if (!_vm->_musicFlag) { + _vm->_sound->command(2); + return; + } + + switch (_scene->_nextSceneId) { + case 401: + _vm->_sound->startQueuedCommands(); + if (_scene->_priorSceneId == 402) + _vm->_sound->command(12, 64); + else + _vm->_sound->command(12, 1); + break; + + case 402: + _vm->_sound->startQueuedCommands(); + _vm->_sound->command(12, 127); + break; + + case 405: + case 407: + case 409: + case 410: + case 413: + _vm->_sound->command(10); + break; + + case 408: + _vm->_sound->command(52); + break; + + default: + break; + } +} + +/*------------------------------------------------------------------------*/ + +} // End of namespace Nebular +} // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes4.h b/engines/mads/nebular/nebular_scenes4.h new file mode 100644 index 0000000000..4de6c383b3 --- /dev/null +++ b/engines/mads/nebular/nebular_scenes4.h @@ -0,0 +1,56 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_NEBULAR_SCENES4_H +#define MADS_NEBULAR_SCENES4_H + +#include "common/scummsys.h" +#include "mads/game.h" +#include "mads/scene.h" +#include "mads/nebular/nebular_scenes.h" + +namespace MADS { + +namespace Nebular { + +class Scene4xx : public NebularScene { +protected: + /** + * Plays an appropriate sound when entering a scene + */ + void setAAName(); + + /** + * Updates the prefix used for getting player sprites for the scene + */ + void setPlayerSpritesPrefix(); + + void sceneEntrySound(); + +public: + Scene4xx(MADSEngine *vm) : NebularScene(vm) {} +}; + +} // End of namespace Nebular +} // End of namespace MADS + +#endif /* MADS_NEBULAR_SCENES4_H */ -- cgit v1.2.3 From ad93617aa7d9dd01a6fa6bb20e162ed916665b51 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 29 Apr 2014 04:01:49 +0300 Subject: MADS: Add stubs for all of the missing Rex Nebular scenes --- engines/mads/nebular/nebular_scenes.cpp | 132 ++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 19b4f9f177..8b739618ec 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -166,9 +166,141 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 399: return new Scene399(vm); + // Scene group #4 + case 401: + // TODO + case 402: + // TODO + case 403: + // TODO + case 405: + // TODO + case 406: + // TODO + case 407: + // TODO + case 408: + // TODO + case 409: + // TODO + case 410: + // TODO + case 411: + // TODO + case 413: + // TODO + // Fall-through for unimplemented scenes in group #4 + error("Invalid scene %d called", scene._nextSceneId); + + // Scene group #5 + case 501: + // TODO + case 502: + // TODO + case 503: + // TODO + case 504: + // TODO + case 505: + // TODO + case 506: + // TODO + case 507: + // TODO + case 508: + // TODO + case 511: + // TODO + case 512: + // TODO + case 513: + // TODO + case 515: + // TODO + case 551: + // TODO + // Fall-through for unimplemented scenes in group #5 + error("Invalid scene %d called", scene._nextSceneId); + + // Scene group #6 + case 601: + // TODO + case 602: + // TODO + case 603: + // TODO + case 604: + // TODO + case 605: + // TODO + case 607: + // TODO + case 608: + // TODO + case 609: + // TODO + case 610: + // TODO + case 611: + // TODO + case 612: + // TODO + case 620: + // TODO + // Fall-through for unimplemented scenes in group #6 + error("Invalid scene %d called", scene._nextSceneId); + + // Scene group #7 + case 701: + // TODO + case 702: + // TODO + case 703: + // TODO + case 704: + // TODO + case 705: + // TODO + case 706: + // TODO + case 707: + // TODO + case 708: + // TODO + case 710: + // TODO + case 711: + // TODO + case 751: + // TODO + case 752: + // TODO + // Fall-through for unimplemented scenes in group #7 + error("Invalid scene %d called", scene._nextSceneId); + // Scene group #8 + case 801: + // TODO + case 802: + // TODO + case 803: + // TODO + // Fall-through for unimplemented scenes in group #8 + error("Invalid scene %d called", scene._nextSceneId); case 804: return new Scene804(vm); + case 805: + // TODO + case 806: + // TODO + case 807: + // TODO + case 808: + // TODO + case 810: + // TODO + // Fall-through for unimplemented scenes in group #8 + error("Invalid scene %d called", scene._nextSceneId); default: error("Invalid scene %d called", scene._nextSceneId); -- cgit v1.2.3 From 82933592ff152138a539864fde80705d391bc25e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 28 Apr 2014 21:33:31 -0400 Subject: MADS: Fix original engine bug with highlighted hotspots between scenes --- engines/mads/scene.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 545ee03fd0..f4b2cb1ec8 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -184,7 +184,8 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) { _spritesCount = _sprites.size(); _userInterface.setup(_vm->_game->_screenObjects._inputMode); - + + _vm->_game->_screenObjects._category = CAT_NONE; _vm->_events->showCursor(); warning("TODO: inventory_anim_allocate"); @@ -608,7 +609,7 @@ void Scene::updateCursor() { Player &player = _vm->_game->_player; CursorType cursorId = CURSOR_ARROW; - if (_action._interAwaiting == 1 && !_vm->_events->_rightMousePressed && + if (_action._interAwaiting == AWAITING_COMMAND && !_vm->_events->_rightMousePressed && _vm->_game->_screenObjects._category == CAT_HOTSPOT) { int idx = _vm->_game->_screenObjects._selectedObject - _userInterface._categoryIndexes[CAT_HOTSPOT - 1]; -- cgit v1.2.3 From 5c56c57b96206d7cfb76398de08aeb946fd875b5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 28 Apr 2014 21:57:05 -0400 Subject: MADS: Fix class hierarchy for scene group 3 --- engines/mads/nebular/nebular_scenes3.cpp | 17 +++-- engines/mads/nebular/nebular_scenes3.h | 118 +++++++------------------------ 2 files changed, 39 insertions(+), 96 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 62f30d254a..12917d61a1 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -234,6 +234,12 @@ void Scene3xx::handleForceField(ForceField *force, int *sprites) { /*------------------------------------------------------------------------*/ +void Scene300s::preActions() { + _game._player._needToWalk = false; +} + +/*------------------------------------------------------------------------*/ + void Scene301::setup() { setPlayerSpritesPrefix(); setAAName(); @@ -5200,17 +5206,18 @@ void Scene366::actions() { _scene->_nextSceneId = 302; else if (_action.isAction(VERB_OPEN, 0x2D3)) { if (_game._visitedScenes.exists(316)) - _vm->_dialogs->show(0x8F04); // 366, 12 + _vm->_dialogs->show(36612); else - _vm->_dialogs->show(0x8F05); // 366, 13 + _vm->_dialogs->show(36613); _scene->_nextSceneId = 316; } else if (_action.isAction(0xD3, 0x2D3)) { if (_game._visitedScenes.exists(321)) - _vm->_dialogs->show(0x8F03); // 366, 11 + _vm->_dialogs->show(36611); else - _vm->_dialogs->show(0x8F02); // 366, 10 - } else + _vm->_dialogs->show(36610); + } else { return; + } _action._inProgress = false; } diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h index 45d0c9a9a9..f931dae193 100644 --- a/engines/mads/nebular/nebular_scenes3.h +++ b/engines/mads/nebular/nebular_scenes3.h @@ -60,6 +60,15 @@ protected: public: Scene3xx(MADSEngine *vm) : NebularScene(vm) {} + + virtual void actions() {} +}; + +class Scene300s : public Scene3xx { +public: + Scene300s(MADSEngine *vm) : Scene3xx(vm) {} + + virtual void preActions(); }; class Scene301: public Scene3xx { @@ -69,9 +78,6 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; - virtual void actions() {}; - virtual void postActions() {}; }; class Scene302: public Scene3xx { @@ -84,9 +90,6 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; - virtual void actions() {}; - virtual void postActions() {}; }; class Scene303: public Scene3xx { @@ -96,9 +99,6 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; - virtual void actions() {}; - virtual void postActions() {}; }; class Scene304: public Scene3xx { @@ -111,9 +111,6 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; - virtual void actions() {}; - virtual void postActions() {}; }; class Scene307: public Scene3xx { @@ -150,9 +147,7 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; virtual void actions(); - virtual void postActions() {}; }; class Scene308: public Scene3xx { @@ -165,9 +160,6 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; - virtual void actions() {}; - virtual void postActions() {}; }; class Scene309: public Scene3xx { @@ -183,9 +175,6 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; - virtual void actions() {}; - virtual void postActions() {}; }; class Scene310: public Scene3xx { @@ -198,9 +187,6 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; - virtual void actions() {}; - virtual void postActions() {}; }; class Scene311: public Scene3xx { @@ -213,9 +199,7 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; virtual void actions(); - virtual void postActions() {}; }; class Scene313: public Scene3xx { @@ -224,10 +208,7 @@ public: virtual void setup(); virtual void enter(); - virtual void step() {}; - virtual void preActions() {}; virtual void actions(); - virtual void postActions() {}; }; class Scene316: public Scene3xx { @@ -243,7 +224,6 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene318: public Scene3xx { @@ -279,7 +259,6 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene319: public Scene3xx { @@ -306,12 +285,10 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; virtual void actions(); - virtual void postActions() {}; }; -class Scene320: public Scene3xx { +class Scene320: public Scene300s { private: void setRightView(int view); void setLeftView(int view); @@ -327,14 +304,12 @@ private: int _rightItemId; public: - Scene320(MADSEngine *vm) : Scene3xx(vm) {} + Scene320(MADSEngine *vm) : Scene300s(vm) {} virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; virtual void actions(); - virtual void postActions() {}; }; class Scene321: public Scene3xx { @@ -344,9 +319,6 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; - virtual void actions() {}; - virtual void postActions() {}; }; class Scene351: public Scene3xx { @@ -356,9 +328,7 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; virtual void actions(); - virtual void postActions() {}; }; class Scene352: public Scene3xx { @@ -381,10 +351,8 @@ public: virtual void setup(); virtual void enter(); - virtual void step() {}; virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene353: public Scene3xx { @@ -393,10 +361,7 @@ public: virtual void setup(); virtual void enter(); - virtual void step() {}; - virtual void preActions() {}; virtual void actions(); - virtual void postActions() {}; }; class Scene354: public Scene3xx { @@ -405,10 +370,8 @@ public: virtual void setup(); virtual void enter(); - virtual void step() {}; virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene357: public Scene3xx { @@ -417,10 +380,8 @@ public: virtual void setup(); virtual void enter(); - virtual void step() {}; virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene358: public Scene3xx { @@ -429,10 +390,8 @@ public: virtual void setup(); virtual void enter(); - virtual void step() {}; virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene359: public Scene3xx { @@ -444,10 +403,8 @@ public: virtual void setup(); virtual void enter(); - virtual void step() {}; virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene360: public Scene3xx { @@ -456,10 +413,8 @@ public: virtual void setup(); virtual void enter(); - virtual void step() {}; virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene361: public Scene3xx { @@ -475,98 +430,79 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; -class Scene366: public Scene3xx { +class Scene366: public Scene300s { public: - Scene366(MADSEngine *vm) : Scene3xx(vm) {} + Scene366(MADSEngine *vm) : Scene300s(vm) {} virtual void setup(); virtual void enter(); - virtual void step() {}; - virtual void preActions() {} virtual void actions(); - virtual void postActions() {}; }; -class Scene387: public Scene3xx { +class Scene387: public Scene300s { public: - Scene387(MADSEngine *vm) : Scene3xx(vm) {} + Scene387(MADSEngine *vm) : Scene300s(vm) {} virtual void setup(); virtual void enter(); - virtual void step() {}; - virtual void preActions() {} virtual void actions(); - virtual void postActions() {}; }; -class Scene388: public Scene3xx { +class Scene388: public Scene300s { public: - Scene388(MADSEngine *vm) : Scene3xx(vm) {} + Scene388(MADSEngine *vm) : Scene300s(vm) {} virtual void setup(); virtual void enter(); - virtual void step() {}; - virtual void preActions() {} virtual void actions(); - virtual void postActions() {}; }; -class Scene389: public Scene3xx { +class Scene389: public Scene300s { private: uint32 _monsterTime; int _circularQuoteId; public: - Scene389(MADSEngine *vm) : Scene3xx(vm) {} + Scene389(MADSEngine *vm) : Scene300s(vm) {} virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {} virtual void actions(); - virtual void postActions() {}; }; -class Scene390: public Scene3xx { +class Scene390: public Scene300s { public: - Scene390(MADSEngine *vm) : Scene3xx(vm) {} + Scene390(MADSEngine *vm) : Scene300s(vm) {} virtual void setup(); virtual void enter(); - virtual void step() {}; - virtual void preActions() {} virtual void actions(); - virtual void postActions() {}; }; -class Scene391: public Scene3xx { +class Scene391: public Scene300s { public: - Scene391(MADSEngine *vm) : Scene3xx(vm) {} + Scene391(MADSEngine *vm) : Scene300s(vm) {} virtual void setup(); virtual void enter(); - virtual void step() {}; - virtual void preActions() {} virtual void actions(); - virtual void postActions() {}; }; -class Scene399: public Scene3xx { +class Scene399: public Scene300s { public: - Scene399(MADSEngine *vm) : Scene3xx(vm) {} + Scene399(MADSEngine *vm) : Scene300s(vm) {} virtual void setup(); virtual void enter(); - virtual void step() {}; - virtual void preActions() {} virtual void actions(); - virtual void postActions() {}; }; + } // End of namespace Nebular + } // End of namespace MADS #endif /* MADS_NEBULAR_SCENES3_H */ -- cgit v1.2.3 From d2e93c2f0ef37c4ee4f9d1d0ebd9017f824e485d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 28 Apr 2014 22:01:05 -0400 Subject: MADS: Hook up scene 321 to scene factory --- engines/mads/nebular/nebular_scenes.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 8b739618ec..712acb12ab 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -132,7 +132,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene319(vm); case 320: return new Scene320(vm); - + case 321: + return new Scene321(vm); case 351: return new Scene351(vm); case 352: -- cgit v1.2.3 From 4f435d5e1c7096c22890332da89b4c574b542d7b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 28 Apr 2014 22:05:16 -0400 Subject: MADS: Removed redundant method definitions from scene classes --- engines/mads/nebular/nebular_scenes1.h | 11 +---------- engines/mads/nebular/nebular_scenes2.h | 20 ++------------------ engines/mads/nebular/nebular_scenes8.cpp | 9 --------- engines/mads/nebular/nebular_scenes8.h | 9 +-------- 4 files changed, 4 insertions(+), 45 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes1.h b/engines/mads/nebular/nebular_scenes1.h index ee9817957b..7a421561e7 100644 --- a/engines/mads/nebular/nebular_scenes1.h +++ b/engines/mads/nebular/nebular_scenes1.h @@ -146,7 +146,6 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene106 : public Scene1xx { @@ -165,7 +164,6 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene107 : public Scene1xx { @@ -180,7 +178,6 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene108 : public Scene1xx { @@ -189,10 +186,8 @@ public: virtual void setup(); virtual void enter(); - virtual void step() {}; virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene109 : public Scene1xx { @@ -215,7 +210,6 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene110 : public Scene1xx { @@ -230,7 +224,6 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene111 : public Scene1xx { @@ -248,7 +241,6 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene112 : public Scene1xx { @@ -258,12 +250,11 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; virtual void actions() {}; - virtual void postActions() {}; }; } // End of namespace Nebular + } // End of namespace MADS #endif /* MADS_NEBULAR_SCENES1_H */ diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index 45fe7908c6..886f7cf4ed 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -58,9 +58,7 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; virtual void actions(); - virtual void postActions() {}; }; class Scene202: public Scene2xx { @@ -84,7 +82,6 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; void setRandomKernelMessage(); }; @@ -100,7 +97,6 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene205: public Scene2xx { @@ -113,9 +109,7 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; virtual void actions(); - virtual void postActions() {}; }; class Scene207: public Scene2xx { @@ -134,7 +128,6 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene208: public Scene2xx { @@ -152,7 +145,6 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene209: public Scene2xx { @@ -200,7 +192,6 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene210: public Scene2xx { @@ -239,7 +230,6 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene211: public Scene2xx { @@ -255,7 +245,6 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene212: public Scene2xx { @@ -266,7 +255,6 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene214: public Scene2xx { @@ -280,9 +268,7 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; virtual void actions(); - virtual void postActions() {}; }; class Scene215: public Scene2xx { @@ -292,9 +278,7 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; virtual void actions(); - virtual void postActions() {}; }; class Scene216: public Scene2xx { @@ -304,11 +288,11 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; virtual void actions() {}; - virtual void postActions() {}; }; + } // End of namespace Nebular + } // End of namespace MADS #endif /* MADS_NEBULAR_SCENES2_H */ diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index 5a283d512d..145dbdcfb6 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -306,15 +306,6 @@ void Scene804::step() { } } -void Scene804::preActions() { -} - -void Scene804::actions() { -} - -void Scene804::postActions() { -} - } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes8.h b/engines/mads/nebular/nebular_scenes8.h index e854fef6d5..2fb1abfe19 100644 --- a/engines/mads/nebular/nebular_scenes8.h +++ b/engines/mads/nebular/nebular_scenes8.h @@ -67,16 +67,9 @@ public: Scene804(MADSEngine *vm) : Scene8xx(vm), _throttleCounter(0) {} virtual void setup(); - virtual void enter(); - virtual void step(); - - virtual void preActions(); - - virtual void actions(); - - virtual void postActions(); + virtual void actions() {}; }; } // End of namespace Nebular -- cgit v1.2.3 From cd74c7eac5d5c8f2c6a00b339f510c77b63a2942 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 28 Apr 2014 22:36:49 -0400 Subject: MADS: Further workarounds for player data being accessed during cutscenes --- engines/mads/player.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index 3b727b397e..2049042e07 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -202,7 +202,9 @@ void Player::selectSeries() { } // If the user isn't to be present (such as for a cutscene), exit immediately - if ((_spritesStart + _spritesIdx) < 0) + // WORKAROUND: Original didn't do a secondary check for the sprite set being + // present, but it's needed to prevent invalid reads during cutscenes + if ((_spritesStart + _spritesIdx) < 0 || !_spriteSetsPresent[_spritesIdx]) return; SpriteAsset &spriteSet = *scene._sprites[_spritesStart + _spritesIdx]; @@ -223,7 +225,8 @@ void Player::selectSeries() { } void Player::updateFrame() { - if ((_spritesStart + _spritesIdx) < 0) + // WORKAROUND: Prevent character info being referenced when not present + if ((_spritesStart + _spritesIdx) < 0 || !_spriteSetsPresent[_spritesStart + _spritesIdx]) return; Scene &scene = _vm->_game->_scene; @@ -497,7 +500,7 @@ void Player::idle() { return; } - if ((_spritesStart + _spritesIdx) < 0) + if ((_spritesStart + _spritesIdx) < 0 || !_spriteSetsPresent[_spritesStart + _spritesIdx]) return; SpriteAsset &spriteSet = *scene._sprites[_spritesStart + _spritesIdx]; -- cgit v1.2.3 From 60e78c9f1d779b4e9829e12f1a326e760c036273 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 29 Apr 2014 07:08:41 +0200 Subject: MADS: Implement scene 401 --- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes4.cpp | 130 +++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes4.h | 17 ++++ 3 files changed, 148 insertions(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 712acb12ab..525f18ff9c 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -169,7 +169,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { // Scene group #4 case 401: - // TODO + return new Scene401(vm); case 402: // TODO case 403: diff --git a/engines/mads/nebular/nebular_scenes4.cpp b/engines/mads/nebular/nebular_scenes4.cpp index da40d9bbbd..050c10a2ba 100644 --- a/engines/mads/nebular/nebular_scenes4.cpp +++ b/engines/mads/nebular/nebular_scenes4.cpp @@ -93,5 +93,135 @@ void Scene4xx::sceneEntrySound() { /*------------------------------------------------------------------------*/ +void Scene401::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene401::enter() { + if (_scene->_priorSceneId != -2) + _northFl = false; + + _timer = 0; + + if (_scene->_priorSceneId == 402) { + _game._player._playerPos = Common::Point(203, 115); + _game._player._facing = FACING_WEST; + } else if (_scene->_priorSceneId == 354) { + _game._player._playerPos = Common::Point(149, 90); + _game._player._facing = FACING_SOUTH; + _northFl = true; + } else if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(142, 131); + _game._player._facing = FACING_NORTH; + } + + _game.loadQuoteSet(0x1D4, 0); + sceneEntrySound(); +} + +void Scene401::step() { + if (_game._trigger == 70) { + _scene->_nextSceneId = 354; + _scene->_reloadSceneFlag = true; + } + + if (_game._trigger == 80) { + _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; + _game._player._stepEnabled = true; + _game._player._visible = true; + _northFl = false; + _game._player.walk(Common::Point(149, 110), FACING_SOUTH); + } + + if (_scene->_frameStartTime >= _timer) { + int dist = 64 - ((_vm->hypotenuse(_game._player._playerPos.x - 219, _game._player._playerPos.y - 115) * 64) / 120); + + if (dist > 64) + dist = 64; + else if (dist < 1) + dist = 1; + + _vm->_sound->command(12, dist); + _timer = _scene->_frameStartTime + _game._player._ticksAmount; + } + +} + +void Scene401::preActions() { + if (_action.isAction(0x1AD, 0x2B4)) { + _game._player.walk(Common::Point(149, 89), FACING_NORTH); + _northFl = false; + } + + if (_action.isAction(0x1AD, 0x2B3) && !_northFl) + _game._player._walkOffScreenSceneId = 405; + + if (_action.isAction(VERB_TAKE)) + _game._player._needToWalk = false; + + if (_game._player._needToWalk && _northFl) { + if (_globals[kSexOfRex] == REX_MALE) + _destPos = Common::Point(148, 94); + else + _destPos = Common::Point(149, 99); + + _game._player.walk(_destPos, FACING_SOUTH); + } +} + +void Scene401::actions() { + if ((_game._player._playerPos == _destPos) && _northFl) { + if (_globals[kSexOfRex] == REX_MALE) { + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _game._player._stepEnabled = false; + _game._player._visible = false; + _vm->_sound->command(21); + _scene->loadAnimation(formAnimName('s', 1), 70); + _globals[kHasBeenScanned] = true; + _vm->_sound->command(22); + int idx = _scene->_kernelMessages.add(Common::Point(153, 46), 0x1110, 32, 0, 60, _game.getQuote(0x1D4)); + _scene->_kernelMessages.setQuoted(idx, 4, true); + } + + if (_globals[kSexOfRex] == REX_FEMALE) { + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _game._player._stepEnabled = false; + _game._player._visible = false; + _vm->_sound->command(21); + _scene->loadAnimation(formAnimName('s', 2), 80); + _vm->_sound->command(23); + _globals[kHasBeenScanned] = true; + } + } + + if (_action.isAction(0x242, 0x241)) { + if (!_northFl) + _scene->_nextSceneId = 402; + } else if (_action.isAction(0x1AD, 0x2B4)) + _scene->_nextSceneId = 354; + else if (_action.isAction(VERB_LOOK, 0x1F3)) { + if (_globals[kHasBeenScanned]) + _vm->_dialogs->show(40111); + else + _vm->_dialogs->show(40110); + } else if (_action.isAction(VERB_LOOK, 0x241)) + _vm->_dialogs->show(40112); + else if (_action.isAction(VERB_LOOK, 0x244)) + _vm->_dialogs->show(40113); + else if (_action.isAction(VERB_LOOK, 0x2B3)) + _vm->_dialogs->show(40114); + else if (_action.isAction(VERB_LOOK, 0x2B4)) + _vm->_dialogs->show(40115); + else if (_action._lookFlag) + _vm->_dialogs->show(40116); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes4.h b/engines/mads/nebular/nebular_scenes4.h index 4de6c383b3..4e29753e42 100644 --- a/engines/mads/nebular/nebular_scenes4.h +++ b/engines/mads/nebular/nebular_scenes4.h @@ -50,6 +50,23 @@ public: Scene4xx(MADSEngine *vm) : NebularScene(vm) {} }; +class Scene401: public Scene4xx { +private: + bool _northFl; + Common::Point _destPos; + uint32 _timer; + +public: + Scene401(MADSEngine *vm) : Scene4xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From a770419abcf109ca45b047f2bb361887632db00c Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 29 Apr 2014 12:56:22 +0300 Subject: MADS: Add an isCursorVisible() method This will probably be used by the menu class, but it's nice to have nonetheless --- engines/mads/events.cpp | 4 ++++ engines/mads/events.h | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp index ac03dd5665..6ec16402ef 100644 --- a/engines/mads/events.cpp +++ b/engines/mads/events.cpp @@ -77,6 +77,10 @@ void EventsManager::hideCursor() { CursorMan.showMouse(false); } +bool EventsManager::isCursorVisible() { + return CursorMan.isVisible(); +} + void EventsManager::waitCursor() { CursorType cursorId = (CursorType)MIN(_cursorSprites->getCount(), (int)CURSOR_WAIT); _newCursorId = cursorId; diff --git a/engines/mads/events.h b/engines/mads/events.h index 529581cae8..6428108709 100644 --- a/engines/mads/events.h +++ b/engines/mads/events.h @@ -103,6 +103,11 @@ public: */ void hideCursor(); + /** + * Returns if the mouse cursor is visible + */ + bool isCursorVisible(); + /** * Shows the wait cursor */ -- cgit v1.2.3 From 82a502ea4c11ffdb0aa4e1b3ab6b6445b4e5bed8 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Tue, 29 Apr 2014 12:39:43 +0100 Subject: SCI: Fix compilation due to wrong preprocessor directive. --- engines/sci/detection_tables.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/sci/detection_tables.h b/engines/sci/detection_tables.h index 8c5f9be425..368b82cb93 100644 --- a/engines/sci/detection_tables.h +++ b/engines/sci/detection_tables.h @@ -4054,7 +4054,7 @@ static const struct ADGameDescription SciGameDescriptions[] = { FANMADE("SCI Capture the Flag", "4cd679a51d93b8b27c6b38d81be24b8b", 432, "98ae1f6ed7b4c21f88addbf643dd1d2f", 147878), FANMADE("SCI Companion Template", "ad54d4f504086cd597aa2348d0aa3b09", 354, "6798b7b601ce8154c1d1bc0f0edcdd18", 113061), FANMADE("SCI Logging Demo", "615c30c1445ea9349847e8868312a674", 558, "2df6858526177612ef9473e7af5b31c6", 171012), -#ifdef 0 +#if 0 // Disabled as this requires network access to the Google Translate API, which is not available as OSystem has no network API. FANMADE("SCI Narration Demo", "731f4f2b726a13c153380af08da16591", 360, "38c80558fb942e8568f011d4a1a4af59", 109789), #endif -- cgit v1.2.3 From 2779e6825c266f271cba0da9257dadb5061e963e Mon Sep 17 00:00:00 2001 From: D G Turner Date: Wed, 30 Apr 2014 01:16:42 +0100 Subject: PS2: Fix hardcoded library settings to allow building against old SDK. The autodetection should be fixed or modified to remove these hardcoded library enables. For now, we add another minor HACK to disable the troublesome Tremor Ogg Vorbis enable on older SDK, which should fix the buildbot builds. --- configure | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/configure b/configure index f0c01cea42..4e4e9d1456 100755 --- a/configure +++ b/configure @@ -2710,7 +2710,10 @@ if test -n "$_host"; then # This trick doesn't work for tremor right now, as the PS2 port the resulting library # libtremor, while our code later on expects it to be called libvorbisidec. # TODO: Enable tremor, e.g. by adding -ltremor or by renaming the lib. - _tremor=yes + # Disable this for older SDK as this breaks the build otherwise... + if test -z "$PS2SDK_OLD"; then + _tremor=yes + fi _mad=yes _zlib=yes # HACK to fix compilation of C source files for now. -- cgit v1.2.3 From dccc4510e82a7df9c8d3082a7914f6259382df14 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 29 Apr 2014 21:53:54 -0400 Subject: MADS: Fix for highlighting and using dynamic hotspots --- engines/mads/action.cpp | 4 ++-- engines/mads/hotspots.cpp | 6 +++--- engines/mads/hotspots.h | 4 ++-- engines/mads/screen.cpp | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index 03c0c1ed8a..e278ffb740 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -168,7 +168,7 @@ void MADSAction::set() { verbId = scene._hotspots[_hotspotId]._verbId; } else { // Get the verb Id from the scene object - verbId = scene._dynamicHotspots[_hotspotId - scene._hotspots.size()]._vocabId; + verbId = scene._dynamicHotspots[_hotspotId - scene._hotspots.size()]._verbId; } if (verbId > 0) { @@ -191,7 +191,7 @@ void MADSAction::set() { _action._objectNameId = scene._hotspots[_hotspotId]._vocabId; } else { // Get name from temporary scene hotspot - _action._objectNameId = scene._dynamicHotspots[_hotspotId - scene._hotspots.size()]._vocabId; + _action._objectNameId = scene._dynamicHotspots[_hotspotId - scene._hotspots.size()]._descId; } appendVocab(_action._objectNameId); } diff --git a/engines/mads/hotspots.cpp b/engines/mads/hotspots.cpp index 47d8204437..02617e92c7 100644 --- a/engines/mads/hotspots.cpp +++ b/engines/mads/hotspots.cpp @@ -29,7 +29,7 @@ DynamicHotspot::DynamicHotspot() { _seqIndex = 0; _facing = FACING_NONE; _descId = 0; - _vocabId = 0; + _verbId = 0; _articleNumber = 0; _cursor = CURSOR_NONE; } @@ -47,7 +47,7 @@ DynamicHotspots::DynamicHotspots(MADSEngine *vm) : _vm(vm) { _count = 0; } -int DynamicHotspots::add(int descId, int vocabId, int seqIndex, const Common::Rect &bounds) { +int DynamicHotspots::add(int descId, int verbId, int seqIndex, const Common::Rect &bounds) { // Find a free slot uint idx = 0; while ((idx < _entries.size()) && _entries[idx]._active) @@ -61,7 +61,7 @@ int DynamicHotspots::add(int descId, int vocabId, int seqIndex, const Common::Re _entries[idx]._bounds = bounds; _entries[idx]._feetPos = Common::Point(-3, 0); _entries[idx]._facing = FACING_NONE; - _entries[idx]._vocabId = vocabId; + _entries[idx]._verbId = verbId; _entries[idx]._articleNumber = 6; _entries[idx]._cursor = CURSOR_NONE; diff --git a/engines/mads/hotspots.h b/engines/mads/hotspots.h index a6b991e1dd..9e1cb44a4e 100644 --- a/engines/mads/hotspots.h +++ b/engines/mads/hotspots.h @@ -39,7 +39,7 @@ public: Common::Point _feetPos; Facing _facing; int _descId; - int _vocabId; + int _verbId; int _articleNumber; CursorType _cursor; @@ -60,7 +60,7 @@ public: Common::Array::size_type size() const { return _entries.size(); } DynamicHotspot &operator[](uint idx) { return _entries[idx]; } - int add(int descId, int vocabId, int seqIndex, const Common::Rect &bounds); + int add(int descId, int verbId, int seqIndex, const Common::Rect &bounds); int setPosition(int index, const Common::Point &pos, Facing facing); int setCursor(int index, CursorType cursor); void remove(int index); diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index cb914e4f86..ea73d41222 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -378,7 +378,7 @@ void ScreenObjects::elementHighlighted() { int index; int indexEnd = -1; int var8 = 0; - //int uiCount; + int uiCount; switch (userInterface._category) { case CAT_COMMAND: @@ -445,8 +445,8 @@ void ScreenObjects::elementHighlighted() { break; default: - //uiCount = size() - _uiCount; - index = scene._hotspots.size(); + uiCount = size() - _uiCount; + index = uiCount + scene._hotspots.size(); indexEnd = index - 1; varA = 0; topIndex = 0; -- cgit v1.2.3 From 16d46fda7cb0fcdc1e3243f58dbe99c02511676a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 29 Apr 2014 22:35:15 -0400 Subject: MADS: Fix for on-screen text no longer being removed --- engines/mads/messages.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/messages.h b/engines/mads/messages.h index 7aabf918ff..a6d39281a6 100644 --- a/engines/mads/messages.h +++ b/engines/mads/messages.h @@ -55,7 +55,7 @@ public: int _numTicks; uint32 _frameTimer2; uint32 _frameTimer; - uint32 _timeout; + int32 _timeout; int _trigger; TriggerMode _abortMode; ActionDetails _actionDetails; -- cgit v1.2.3 From 8fde4cf50f7095c17eafd6bc4946837883e0f0c5 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 30 Apr 2014 07:34:01 +0300 Subject: FULLPIPE: Implement ModalSaveGame::processMouse() --- engines/fullpipe/modal.cpp | 21 +++++++++++++++++++++ engines/fullpipe/modal.h | 2 ++ 2 files changed, 23 insertions(+) diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp index bba5df0cd5..83ebdd6ef3 100644 --- a/engines/fullpipe/modal.cpp +++ b/engines/fullpipe/modal.cpp @@ -1629,6 +1629,27 @@ bool ModalSaveGame::getFileInfo(char *filename, FileInfo *fileinfo) { return false; } +void ModalSaveGame::processMouse(int x, int y) { + for (uint i = 0; i < _files.size(); i++) { + if (x >= _files[i]->fx1 && x <= _files[i]->fx2 && y >= _files[i]->fy1 && y <= _files[i]->fy2) { + _queryRes = i + 1; + + if (_mode) { + if (!_files[i]->empty) { + _queryDlg = new ModalQuery; + + _queryDlg->create(_menuScene, 0, PIC_MOV_BGR); + } + } + + return; + } + } + + if (_cancelL->isPixelHitAtPos(x, y)) + _queryRes = 0; +} + void FullpipeEngine::openHelp() { if (!_modalObject) { ModalHelp *help = new ModalHelp; diff --git a/engines/fullpipe/modal.h b/engines/fullpipe/modal.h index a214b1c639..6bbf6ec53a 100644 --- a/engines/fullpipe/modal.h +++ b/engines/fullpipe/modal.h @@ -261,6 +261,8 @@ public: virtual void update() {} virtual void saveload() {} + void processMouse(int x, int y); + void setScene(Scene *sc); void setup(Scene *sc, int mode); void processKey(int key); -- cgit v1.2.3 From 1e4f171e8add003a40454af911d933cd6b9ffd0c Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 30 Apr 2014 07:41:17 +0300 Subject: FULLPIPE: Implement ModalSaveGame::handleMessage() --- engines/fullpipe/modal.cpp | 12 ++++++++++++ engines/fullpipe/modal.h | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp index 83ebdd6ef3..dbbd7beeb2 100644 --- a/engines/fullpipe/modal.cpp +++ b/engines/fullpipe/modal.cpp @@ -1629,6 +1629,18 @@ bool ModalSaveGame::getFileInfo(char *filename, FileInfo *fileinfo) { return false; } +bool ModalSaveGame::handleMessage(ExCommand *cmd) { + if (_queryDlg) + return _queryDlg->handleMessage(cmd); + + if (cmd->_messageNum == 29) + processMouse(cmd->_x, cmd->_y); + else if (cmd->_messageNum == 36) + processKey(cmd->_keyCode); + + return false; +} + void ModalSaveGame::processMouse(int x, int y) { for (uint i = 0; i < _files.size(); i++) { if (x >= _files[i]->fx1 && x <= _files[i]->fx2 && y >= _files[i]->fy1 && y <= _files[i]->fy2) { diff --git a/engines/fullpipe/modal.h b/engines/fullpipe/modal.h index 6bbf6ec53a..48ae2b2970 100644 --- a/engines/fullpipe/modal.h +++ b/engines/fullpipe/modal.h @@ -256,7 +256,7 @@ public: virtual ~ModalSaveGame(); virtual bool pollEvent() { return true; } - virtual bool handleMessage(ExCommand *message) { return false; } + virtual bool handleMessage(ExCommand *message); virtual bool init(int counterdiff); virtual void update() {} virtual void saveload() {} -- cgit v1.2.3 From b5271364a34d753291b58b5eb344894f17cfe797 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 30 Apr 2014 08:22:03 +0300 Subject: FULLPIPE: Implement ModalSaveGame::update() --- engines/fullpipe/modal.cpp | 56 ++++++++++++++++++++++++++++++++++++++++++++++ engines/fullpipe/modal.h | 2 +- 2 files changed, 57 insertions(+), 1 deletion(-) diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp index dbbd7beeb2..39b021b38a 100644 --- a/engines/fullpipe/modal.cpp +++ b/engines/fullpipe/modal.cpp @@ -1629,6 +1629,62 @@ bool ModalSaveGame::getFileInfo(char *filename, FileInfo *fileinfo) { return false; } +void ModalSaveGame::update() { + if (_menuScene) + _menuScene->draw(); + + _bgr->draw(); + + if (_queryDlg) { + _queryDlg->update(); + + return; + } + + g_fp->_cursorId = PIC_CSR_DEFAULT; + + g_fp->setCursor(g_fp->_cursorId); + + Common::Point point; + + for (uint i = 0; i < _files.size(); i++) { + if (g_fp->_mouseScreenPos.x < _files[i]->fx1 || g_fp->_mouseScreenPos.x > _files[i]->fx2 || + g_fp->_mouseScreenPos.y < _files[i]->fy1 || g_fp->_mouseScreenPos.y > _files[i]->fy2 ) { + if (_files[i]->empty) { + _emptyD->setOXY(_files[i]->fx1, _files[i]->fy1); + _emptyD->draw(); + } else { + int x = _files[i]->fx1; + + for (int j = 0; j < 16; j++) { + _arrayL[j + _files[i]->day]->setOXY(x + 1, _files[i]->fy1); + _arrayL[j + _files[i]->day]->draw(); + + x += _arrayL[j + _files[i]->day]->getDimensions(&point)->x + 2; + } + } + } else { + if (_files[i]->empty) { + _emptyL->setOXY(_files[i]->fx1, _files[i]->fy1); + _emptyL->draw(); + } else { + int x = _files[i]->fx1; + + for (int j = 0; j < 16; j++) { + _arrayD[j + _files[i]->day]->setOXY(x + 1, _files[i]->fy1); + _arrayD[j + _files[i]->day]->draw(); + + x += _arrayD[j + _files[i]->day]->getDimensions(&point)->x + 2; + } + } + } + } + if (_cancelL->isPixelHitAtPos(g_fp->_mouseScreenPos.x, g_fp->_mouseScreenPos.y)) + _cancelL->draw(); + else if (_okL->isPixelHitAtPos(g_fp->_mouseScreenPos.x, g_fp->_mouseScreenPos.y)) + _okL->draw(); +} + bool ModalSaveGame::handleMessage(ExCommand *cmd) { if (_queryDlg) return _queryDlg->handleMessage(cmd); diff --git a/engines/fullpipe/modal.h b/engines/fullpipe/modal.h index 48ae2b2970..2c2295f775 100644 --- a/engines/fullpipe/modal.h +++ b/engines/fullpipe/modal.h @@ -258,7 +258,7 @@ public: virtual bool pollEvent() { return true; } virtual bool handleMessage(ExCommand *message); virtual bool init(int counterdiff); - virtual void update() {} + virtual void update(); virtual void saveload() {} void processMouse(int x, int y); -- cgit v1.2.3 From 9d2bcbd499783d83fb85f1235774514e5db8c45b Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 30 Apr 2014 22:41:57 +0300 Subject: MADS: Fix a crash when trying to pick up objects that can't be picked --- engines/mads/nebular/game_nebular.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index 34eb6f140c..b36de8f378 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -619,7 +619,7 @@ void GameNebular::unhandledAction() { _vm->_dialogs->show(0x15); } else if (action.isAction(VERB_TAKE)) { int objId = _vm->_game->_objects.getIdFromDesc(action._activeAction._objectNameId); - if (_vm->_game->_objects.isInInventory(objId)) + if (objId >= 0 && _vm->_game->_objects.isInInventory(objId)) _vm->_dialogs->show(0x10); else if (randVal <= 333) _vm->_dialogs->show(0x8); -- cgit v1.2.3 From c37c45370c888e608184cdb5f145fbc5d2048b54 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 30 Apr 2014 22:43:00 +0300 Subject: MADS: Fix a bug in scene 102 --- engines/mads/nebular/nebular_scenes1.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index ab1b2d1423..4e63ba2060 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -977,7 +977,7 @@ void Scene102::actions() { _action._inProgress = false; return; } - } else if (_action.isAction(VERB_LOOK) || (_game._difficulty == DIFFICULTY_IMPOSSIBLE)) { + } else if (_action.isAction(VERB_LOOK) || (_game._difficulty != DIFFICULTY_IMPOSSIBLE)) { _vm->_dialogs->show(0x27EE); _action._inProgress = false; return; -- cgit v1.2.3 From 521e0394f68267b1ff466e2eb81c00540ff9ece1 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 30 Apr 2014 22:52:02 +0300 Subject: MADS: Check for sane object IDs when checking for inventory objects This avoids crashes in cases where the default excuse is shown, for objects that can't be operated --- engines/mads/inventory.cpp | 4 ++-- engines/mads/nebular/game_nebular.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/mads/inventory.cpp b/engines/mads/inventory.cpp index abd281dcc8..a6459c764b 100644 --- a/engines/mads/inventory.cpp +++ b/engines/mads/inventory.cpp @@ -108,11 +108,11 @@ void InventoryObjects::setRoom(int objectId, int sceneNumber) { } bool InventoryObjects::isInRoom(int objectId) const { - return (*this)[objectId]._roomNumber == _vm->_game->_scene._currentSceneId; + return objectId >= 0 && (*this)[objectId]._roomNumber == _vm->_game->_scene._currentSceneId; } bool InventoryObjects::isInInventory(int objectId) const { - return (*this)[objectId]._roomNumber == PLAYER_INVENTORY; + return objectId >= 0 && (*this)[objectId]._roomNumber == PLAYER_INVENTORY; } void InventoryObjects::addToInventory(int objectId) { diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index b36de8f378..34eb6f140c 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -619,7 +619,7 @@ void GameNebular::unhandledAction() { _vm->_dialogs->show(0x15); } else if (action.isAction(VERB_TAKE)) { int objId = _vm->_game->_objects.getIdFromDesc(action._activeAction._objectNameId); - if (objId >= 0 && _vm->_game->_objects.isInInventory(objId)) + if (_vm->_game->_objects.isInInventory(objId)) _vm->_dialogs->show(0x10); else if (randVal <= 333) _vm->_dialogs->show(0x8); -- cgit v1.2.3 From e24292a72fd97062407f97100fd747161d4dbd56 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 30 Apr 2014 23:53:33 +0200 Subject: MADS: Implement scene 402 --- engines/mads/animation.h | 2 +- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes4.cpp | 2092 +++++++++++++++++++++++++++++- engines/mads/nebular/nebular_scenes4.h | 61 + 4 files changed, 2149 insertions(+), 8 deletions(-) diff --git a/engines/mads/animation.h b/engines/mads/animation.h index 5faa47841e..894fbaecb2 100644 --- a/engines/mads/animation.h +++ b/engines/mads/animation.h @@ -141,7 +141,6 @@ private: Common::Array _spriteSets; Font *_font; - int _currentFrame; bool _freeFlag; bool _skipLoad; int _unkIndex; @@ -180,6 +179,7 @@ public: Common::Array _uiEntries; Common::Array _messages; bool _resetFlag; + int _currentFrame; int _oldFrameEntry; static Animation *init(MADSEngine *vm, Scene *scene); diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 525f18ff9c..d5114133d9 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -171,7 +171,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 401: return new Scene401(vm); case 402: - // TODO + return new Scene402(vm); case 403: // TODO case 405: diff --git a/engines/mads/nebular/nebular_scenes4.cpp b/engines/mads/nebular/nebular_scenes4.cpp index 050c10a2ba..aec1bf45d2 100644 --- a/engines/mads/nebular/nebular_scenes4.cpp +++ b/engines/mads/nebular/nebular_scenes4.cpp @@ -136,7 +136,7 @@ void Scene401::step() { if (_scene->_frameStartTime >= _timer) { int dist = 64 - ((_vm->hypotenuse(_game._player._playerPos.x - 219, _game._player._playerPos.y - 115) * 64) / 120); - + if (dist > 64) dist = 64; else if (dist < 1) @@ -150,9 +150,9 @@ void Scene401::step() { void Scene401::preActions() { if (_action.isAction(0x1AD, 0x2B4)) { - _game._player.walk(Common::Point(149, 89), FACING_NORTH); + _game._player.walk(Common::Point(149, 89), FACING_NORTH); _northFl = false; - } + } if (_action.isAction(0x1AD, 0x2B3) && !_northFl) _game._player._walkOffScreenSceneId = 405; @@ -166,7 +166,7 @@ void Scene401::preActions() { else _destPos = Common::Point(149, 99); - _game._player.walk(_destPos, FACING_SOUTH); + _game._player.walk(_destPos, FACING_SOUTH); } } @@ -175,7 +175,7 @@ void Scene401::actions() { if (_globals[kSexOfRex] == REX_MALE) { _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _game._player._stepEnabled = false; - _game._player._visible = false; + _game._player._visible = false; _vm->_sound->command(21); _scene->loadAnimation(formAnimName('s', 1), 70); _globals[kHasBeenScanned] = true; @@ -187,7 +187,7 @@ void Scene401::actions() { if (_globals[kSexOfRex] == REX_FEMALE) { _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _game._player._stepEnabled = false; - _game._player._visible = false; + _game._player._visible = false; _vm->_sound->command(21); _scene->loadAnimation(formAnimName('s', 2), 80); _vm->_sound->command(23); @@ -221,6 +221,2086 @@ void Scene401::actions() { _action._inProgress = false; } +/*------------------------------------------------------------------------*/ +void Scene402::setup() { + setPlayerSpritesPrefix(); + setAAName(); + + _scene->addActiveVocab(0x30E); + _scene->addActiveVocab(0x306); + _scene->addActiveVocab(0x72); + _scene->addActiveVocab(0x27); + _scene->addActiveVocab(0xD); + _scene->addActiveVocab(0x5C); + _scene->addActiveVocab(0x4); + _scene->addActiveVocab(0x124); + _scene->addActiveVocab(0xD1); +} + +void Scene402::setDialogNode(int node) { + if (node > 0) + _bartenderDialogNode = node; + + _game._player._stepEnabled = true; + + switch (node) { + case 0: + _scene->_userInterface.setup(kInputBuildingSentences); + _conversationFl = false; + _bartenderDialogNode = 0; + break; + + case 1: + _dialog1.start(); + _bartenderDialogNode = 1; + break; + + case 2: + _dialog2.start(); + _bartenderDialogNode = 2; + break; + + case 3: + _dialog3.start(); + _bartenderDialogNode = 3; + break; + + case 4: + _dialog4.start(); + _bartenderDialogNode = 4; + break; + + default: + break; + } +} + +void Scene402::handleConversation1() { + switch (_action._activeAction._verbId) { + case 0x214: { + int quoteId = 0; + int quotePosX = 0; + switch (_vm->getRandomNumber(1, 3)) { + case 1: + quoteId = 0x1E4; + _bartenderCurrentQuestion = 4; + quotePosX = 205; + break; + + case 2: + quoteId = 0x1E5; + _bartenderCurrentQuestion = 5; + quotePosX = 203; + break; + + case 3: + quoteId = 0x1E6; + _bartenderCurrentQuestion = 6; + quotePosX = 260; + break; + + default: + break; + } + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(quotePosX, 41), 0xFDFC, 0, 0, 9999999, _game.getQuote(quoteId)); + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addTimer(1, 100); + _talkTimer = 120; + setDialogNode(2); + } + break; + + case 0x215: + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(260, 41), 0xFDFC, 0, 0, 9999999, _game.getQuote(0x1EC)); + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addTimer(1, 100); + _talkTimer = 120; + _bartenderCurrentQuestion = 1; + setDialogNode(3); + break; + + case 0x237: + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(208, 41), 0xFDFC, 0, 0, 100, _game.getQuote(0x1FD)); + setDialogNode(0); + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addTimer(1, 100); + _talkTimer = 1120; + break; + + default: + break; + } +} + +void Scene402::handleConversation2() { + switch (_action._activeAction._verbId) { + case 0x216: + _dialog2.write(0x216, false); + _dialog2.write(0x21D, true); + break; + + case 0x219: + _dialog2.write(0x219, false); + _dialog2.write(0x220, true); + break; + + case 0x21A: + _dialog2.write(0x21A, false); + _dialog2.write(0x223, true); + break; + + case 0x21B: + _dialog2.write(0x21B, false); + _dialog2.write(0x224, true); + break; + + case 0x21D: + _dialog2.write(0x21D, false); + _dialog2.write(0x227, true); + break; + + case 0x220: + _dialog2.write(0x220, false); + _dialog2.write(0x22A, true); + break; + + case 0x223: + _dialog2.write(0x223, false); + _dialog2.write(0x22D, true); + break; + + case 0x224: + _dialog2.write(0x224, false); + _dialog2.write(0x230, true); + break; + + case 0x227: + _dialog2.write(0x227, false); + break; + + case 0x22A: + _dialog2.write(0x22A, false); + break; + + case 0x22D: + _dialog2.write(0x22D, false); + break; + + case 0x230: + _dialog2.write(0x230, false); + break; + + case 0x21C: + setDialogNode(0); + break; + + default: + break; + + } + + if (_action._activeAction._verbId != 0x21C) { + switch (_vm->getRandomNumber(1, 3)) { + case 1: + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addTimer(1, 100); + _talkTimer = 180; + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(198, 27), 0xFDFC, 0, 0, 9999999, _game.getQuote(0x1E7)); + _scene->_kernelMessages.add(Common::Point(201, 41), 0xFDFC, 0, 0, 9999999, _game.getQuote(0x1E8)); + _bartenderCurrentQuestion = 7; + break; + + case 2: + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addTimer(1, 100); + _talkTimer = 180; + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(220, 27), 0xFDFC, 0, 0, 9999999, _game.getQuote(0x1E9)); + _scene->_kernelMessages.add(Common::Point(190, 41), 0xFDFC, 0, 0, 9999999, _game.getQuote(0x1EA)); + _bartenderCurrentQuestion = 8; + break; + + case 3: + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addTimer(1, 100); + _talkTimer = 150; + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(196, 41), 0xFDFC, 0, 0, 9999999, _game.getQuote(0x1EB)); + _bartenderCurrentQuestion = 9; + break; + + default: + break; + } + _dialog2.start(); + } else { + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(208, 41), 0xFDFC, 0, 0, 100, _game.getQuote(0x1FD)); + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addTimer(1, 100); + _talkTimer = 1120; + } +} + +void Scene402::handleConversation3() { + switch (_action._activeAction._verbId) { + case 0x233: + case 0x234: + case 0x235: + case 0x236: + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addTimer(1, 86); + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(188, 27), 0xFDFC, 0, 0, 9999999, _game.getQuote(0x1ED)); + _scene->_kernelMessages.add(Common::Point(199, 41), 0xFDFC, 0, 0, 9999999, _game.getQuote(0x1EE)); + setDialogNode(4); + _bartenderCurrentQuestion = 2; + break; + + case 0x237: + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(208, 41), 0xFDFC, 0, 0, 100, _game.getQuote(0x1FD)); + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addTimer(1, 100); + _talkTimer = 1120; + setDialogNode(0); + break; + + default: + break; + } +} + +void Scene402::handleConversation4() { + switch (_action._activeAction._verbId) { + case 0x238: + _scene->_kernelMessages.reset(); + setDialogNode(0); + _game._player._stepEnabled = false; + _scene->_kernelMessages.add(Common::Point(196, 13), 0xFDFC, 0, 0, 180, _game.getQuote(0x1F0)); + _scene->_kernelMessages.add(Common::Point(184, 27), 0xFDFC, 0, 0, 180, _game.getQuote(0x1F1)); + _scene->_kernelMessages.add(Common::Point(200, 41), 0xFDFC, 0, 0, 180, _game.getQuote(0x1F2)); + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addTimer(1, 100); + _talkTimer = 1100; + _dialog4.write(0x238, false); + _bartenderMode = 22; + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addTimer(100, 95); + _refuseAlienLiquor = true; + break; + + case 0x239: + _game._player._stepEnabled = false; + _roxMode = 21; + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addTimer(1, 92); + _scene->_userInterface.setup(kInputBuildingSentences); + _conversationFl = false; + break; + + case 0x23A: + setDialogNode(0); + _game._player._stepEnabled = false; + _scene->_kernelMessages.add(Common::Point(193, 27), 0xFDFC, 0, 0, 150, _game.getQuote(0x1F4)); + _scene->_kernelMessages.add(Common::Point(230, 41), 0xFDFC, 0, 0, 150, _game.getQuote(0x1F5)); + _dialog4.write(0x23A, false); + _globals[kHasSaidTimer] = true; + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addTimer(1, 100); + _talkTimer = 1100; + _bartenderMode = 22; + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addTimer(100, 95); + _refuseAlienLiquor = true; + break; + + case 0x23D: + setDialogNode(0); + _game._player._stepEnabled = false; + _scene->_kernelMessages.add(Common::Point(153, 27), 0xFDFC, 0, 0, 150, _game.getQuote(0x1F6)); + _scene->_kernelMessages.add(Common::Point(230, 41), 0xFDFC, 0, 0, 150, _game.getQuote(0x1F7)); + _dialog4.write(0x23D, false); + _globals[kHasSaidBinocs] = true; + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addTimer(1, 100); + _talkTimer = 1100; + _bartenderMode = 22; + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addTimer(100, 95); + _refuseAlienLiquor = true; + break; + + case 0x23E: + _scene->_kernelMessages.reset(); + setDialogNode(0); + _game._player._stepEnabled = false; + _scene->_kernelMessages.add(Common::Point(205, 41), 0xFDFC, 0, 0, 100, _game.getQuote(0x1F8)); + _bartenderMode = 22; + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addTimer(1, 100); + _talkTimer = 1050; + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addTimer(50, 95); + _refuseAlienLiquor = true; + break; + + default: + break; + } +} + +void Scene402::handleDialogs() { + if (_game._trigger == 0) { + _scene->_kernelMessages.reset(); + _game._player._stepEnabled = false; + Common::String curQuote = _game.getQuote(_action._activeAction._verbId); + if (_vm->_font->getWidth(curQuote, _scene->_textSpacing) > 200) { + Common::String subQuote1, subQuote2; + _game.splitQuote(curQuote, subQuote1, subQuote2); + _scene->_kernelMessages.add(Common::Point(230, 42), 0x1110, 32, 0, 140, subQuote1); + _scene->_kernelMessages.add(Common::Point(230, 56), 0x1110, 32, 0, 140, subQuote2); + _scene->_sequences.addTimer(160, 120); + } else { + _scene->_kernelMessages.add(Common::Point(230, 56), 0x1110, 32, 1, 140, curQuote); + _scene->_sequences.addTimer(160, 120); + } + } else if (_game._trigger == 120) { + _game._player._stepEnabled = true; + switch (_bartenderDialogNode) { + case 1: + handleConversation1(); + break; + + case 2: + handleConversation2(); + break; + + case 3: + handleConversation3(); + break; + + case 4: + handleConversation4(); + break; + + default: + break; + } + } +} + +void Scene402::enter() { + _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('n', -1)); + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 2)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 0)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 1)); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('g', 0)); + _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('g', 1)); + _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('a', 0)); + _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('a', 1)); + _globals._spriteIndexes[15] = _scene->_sprites.addSprites(formAnimName('x', 5)); + _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('x', 4)); + _globals._spriteIndexes[9] = _scene->_sprites.addSprites(formAnimName('b', 0)); + _globals._spriteIndexes[10] = _scene->_sprites.addSprites(formAnimName('b', 1)); + _globals._spriteIndexes[11] = _scene->_sprites.addSprites(formAnimName('b', 2)); + _globals._spriteIndexes[12] = _scene->_sprites.addSprites(formAnimName('b', 3)); + _globals._spriteIndexes[13] = _scene->_sprites.addSprites(formAnimName('c', 0)); + _globals._spriteIndexes[14] = _scene->_sprites.addSprites(formAnimName('l', 0)); + _globals._spriteIndexes[16] = _scene->_sprites.addSprites(formAnimName('h', 0)); + _globals._spriteIndexes[17] = _scene->_sprites.addSprites(formAnimName('z', 0)); + _globals._spriteIndexes[18] = _scene->_sprites.addSprites(formAnimName('z', 1)); + _globals._spriteIndexes[19] = _scene->_sprites.addSprites(formAnimName('z', 2)); + _globals._spriteIndexes[20] = _scene->_sprites.addSprites(formAnimName('x', 6)); + _globals._spriteIndexes[21] = _scene->_sprites.addSprites("*ROXRC_9"); + _globals._spriteIndexes[22] = _scene->_sprites.addSprites("*ROXCL_8"); + + if (_scene->_priorSceneId == 401) { + _game._player._playerPos = Common::Point(160, 150); + _game._player._facing = FACING_NORTH; + _roxOnStool = false; + _bartenderDialogNode = 1; + _conversationFl = false; + } else if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(160, 150); + _game._player._facing = FACING_NORTH; + _game._objects.addToInventory(OBJ_CREDIT_CHIP); + _game._objects.addToInventory(OBJ_BINOCULARS); + _game._objects.addToInventory(OBJ_TIMER_MODULE); + _roxOnStool = false; + _bartenderDialogNode = 1; + _conversationFl = false; + } + + _game.loadQuoteSet(0x1D7, 0x1D8, 0x1D9, 0x1DA, 0x1DB, 0x1DC, 0x1DD, 0x1DE, 0x1DF, 0x1E2, 0x1E3, 0x1E6, 0x1E5, 0x1E7, + 0x1E8, 0x1E9, 0x1EA, 0x1EF, 0x1F0, 0x1F1, 0x1F2, 0x1F3, 0x1F4, 0x1F5, 0x1F6, 0x1F7, 0x1F8, 0x1F9, 0x1FA, 0x1FB, + 0x1FC, 0x1EB, 0x1EC, 0x1ED, 0x1EE, 0x1E4, 0x1FD, 0x1E0, 0x1E1, 0x1FE, 0x1FF, 0x200, 0x201, 0x202, 0x203, 0x204, + 0x205, 0x206, 0x207, 0x208, 0x209, 0x20A, 0x20B, 0x20C, 0x20F, 0x20D, 0x20E, 0x210, 0x211, 0x212, 0x213, 0x214, + 0x215, 0x237, 0x216, 0x219, 0x21A, 0x21B, 0x21C, 0x21D, 0x220, 0x223, 0x224, 0x227, 0x22A, 0x22D, 0x230, 0x233, + 0x234, 0x235, 0x236, 0x238, 0x239, 0x23A, 0x23D, 0x23E, 0x23F, 0); + + _vm->_palette->setEntry(250, 47, 41, 40); + _vm->_palette->setEntry(251, 50, 63, 55); + _vm->_palette->setEntry(252, 38, 34, 25); + _vm->_palette->setEntry(253, 45, 41, 35); + + _dialog1.setup(0x60, 0x214, 0x215, 0x237, 0); + _dialog2.setup(0x61, 0x216, 0x219, 0x21A, 0x21B, 0x21D, 0x220, 0x223, 0x224, 0x227, 0x22A, 0x22D, 0x230, 0x21C, 0); + _dialog3.setup(0x62, 0x233, 0x234, 0x235, 0x236, 0x237, -1); + _dialog4.setup(0x63, 0x238, 0x239, 0x23A, 0x23D, 0x23E, 0); + + if (!_game._visitedScenes._sceneRevisited) { + _dialog2.set(0x61, 0x216, 0x219, 0x21A, 0x21B, 0x21C, 0); + _dialog4.set(0x63, 0x238, 0x23E, 0); + _dialog1.set(0x60, 0x214, 0x215, 0x237, 0); + } + + if (_game._objects.isInInventory(OBJ_CREDIT_CHIP)) + _dialog4.write(0x239, true); + else + _dialog4.write(0x239, false); + + if (_game._objects.isInInventory(OBJ_BINOCULARS) && !_globals[kHasSaidBinocs]) + _dialog4.write(0x23D, true); + else + _dialog4.write(0x23D, false); + + if (_game._objects.isInInventory(OBJ_TIMER_MODULE) && !_globals[kHasSaidTimer]) + _dialog4.write(0x23A, true); + else + _dialog4.write(0x23A, false); + + if (_dialog2.read(0) <= 1) + _dialog1.write(0x214, false); + + if (_conversationFl) { + switch (_bartenderDialogNode) { + case 0: + _scene->_userInterface.setup(kInputBuildingSentences); + _bartenderDialogNode = 1; + break; + + case 1: + _dialog1.start(); + break; + + case 2: + _dialog2.start(); + break; + + case 3: + _dialog3.start(); + break; + + case 4: + _dialog4.start(); + break; + + default: + break; + } + + switch (_bartenderCurrentQuestion) { + case 1: + _scene->_kernelMessages.add(Common::Point(260, 41), 0xFDFC, 0, 0, 9999999, _game.getQuote(0x1EC)); + break; + + case 2: + _scene->_kernelMessages.add(Common::Point(188, 27), 0xFDFC, 0, 0, 9999999, _game.getQuote(0x1ED)); + _scene->_kernelMessages.add(Common::Point(199, 41), 0xFDFC, 0, 0, 9999999, _game.getQuote(0x1EE)); + break; + + case 3: + _scene->_kernelMessages.add(Common::Point(177, 41), 0xFDFC, 0, 0, 9999999, _game.getQuote(0x1EF)); + break; + + case 4: + _scene->_kernelMessages.add(Common::Point(205, 41), 0xFDFC, 0, 0, 9999999, _game.getQuote(0x1E4)); + break; + + case 5: + _scene->_kernelMessages.add(Common::Point(203, 41), 0xFDFC, 0, 0, 9999999, _game.getQuote(0x1E5)); + break; + + case 6: + _scene->_kernelMessages.add(Common::Point(260, 41), 0xFDFC, 0, 0, 9999999, _game.getQuote(0x1E6)); + break; + + case 7: + _scene->_kernelMessages.add(Common::Point(198, 27), 0xFDFC, 0, 0, 9999999, _game.getQuote(0x1E7)); + _scene->_kernelMessages.add(Common::Point(201, 41), 0xFDFC, 0, 0, 9999999, _game.getQuote(0x1E8)); + break; + + case 8: + _scene->_kernelMessages.add(Common::Point(220, 27), 0xFDFC, 0, 0, 9999999, _game.getQuote(0x1E9)); + _scene->_kernelMessages.add(Common::Point(190, 41), 0xFDFC, 0, 0, 9999999, _game.getQuote(0x1EA)); + break; + + case 9: + _scene->_kernelMessages.add(Common::Point(196, 41), 0xFDFC, 0, 0, 9999999, _game.getQuote(0x1EB)); + break; + + case 10: + _scene->_kernelMessages.add(Common::Point(198, 27), 0xFDFC, 0, 0, 9999999, _game.getQuote(0x1E2)); + _scene->_kernelMessages.add(Common::Point(199, 41), 0xFDFC, 0, 0, 9999999, _game.getQuote(0x1E3)); + break; + + default: + break; + } + } + + _firstTalkToGirlInChair = false; + _lightOn = false; + _blowingSmoke = false; + _leftWomanMoving = false; + _rightWomanMoving = false; + _ginnyLooking = false; + _beatCounter = 0; + _waitingGinnyMove = false; + _bigBeatFl = true; + _bartenderHandsHips = false; + _bartenderSteady = true; + _bartenderLooksLeft = false; + _activeTeleporter = false; + _activeArrows = false; + _activeArrow1 = false; + _activeArrow2 = false; + _activeArrow3 = false; + _cutSceneReady = false; + _cutSceneNeeded = false; + _helgaReady = true; + _bartenderReady = true; + _drinkTimer = 0; + _bartenderTalking = false; + _bartenderCalled = false; + _helgaTalkMode = 0; + _rexMode = 0; + _refuseAlienLiquor = false; + + _scene->loadAnimation(Resources::formatName(402, 'd', 1, EXT_AA, "")); + _scene->_activeAnimation->_resetFlag = true; + + _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 1); + + _globals._sequenceIndexes[13] = _scene->_sequences.startCycle(_globals._spriteIndexes[13], false, 2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 8); + + if (!_game._objects.isInInventory(OBJ_REPAIR_LIST)) { + _globals._sequenceIndexes[14] = _scene->_sequences.startCycle(_globals._spriteIndexes[14], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[14], 7); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[14], Common::Point(210, 80)); + int idx = _scene->_dynamicHotspots.add(0x124, 0xD1, _globals._sequenceIndexes[14], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(0, 0), FACING_NONE); + } + + { + _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 8); + int idx = _scene->_dynamicHotspots.add(0x30E, 0xD, _globals._sequenceIndexes[9], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(228, 83), FACING_SOUTH); + } + + if (!_game._objects.isInRoom(OBJ_ALIEN_LIQUOR) && !_game._objects.isInInventory(OBJ_CREDIT_CHIP)) { + _globals._sequenceIndexes[15] = _scene->_sequences.startCycle(_globals._spriteIndexes[15], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[15], 8); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[15], Common::Point(250, 80)); + int idx = _scene->_dynamicHotspots.add(0x5C, 0x4, _globals._sequenceIndexes[15], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(0, 0), FACING_NONE); + } + + _globals._sequenceIndexes[20] = _scene->_sequences.startCycle(_globals._spriteIndexes[20], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[20], 7); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[20], Common::Point(234, 72)); + + if (_globals[kBottleDisplayed]) { + _globals._sequenceIndexes[8] = _scene->_sequences.startCycle(_globals._spriteIndexes[8], false, 4); + _scene->_sequences.setDepth(_globals._sequenceIndexes[8], 7); + } + + if (_roxOnStool) { + _globals._sequenceIndexes[6] = _scene->_sequences.startCycle(_globals._spriteIndexes[6], false, 11); + _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 5); + _game._player._visible = false; + } + + sceneEntrySound(); +} + +void Scene402::step() { + if (_game._trigger == 104) { + _game._player._priorTimer = _scene->_frameStartTime + _game._player._ticksAmount; + _game._player._visible = true; + _scene->_sequences.remove(_globals._sequenceIndexes[15]); + _game._objects.addToInventory(OBJ_CREDIT_CHIP); + _vm->_dialogs->showItem(OBJ_CREDIT_CHIP, 40242); + _game._player._stepEnabled = true; + } + + if ((_vm->getRandomNumber(1, 1500) == 1) && (!_activeTeleporter) && (_game._player._playerPos.x < 150)) { + _vm->_sound->command(30); + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 13, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 1, 11); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 14); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 48); + _activeTeleporter = true; + _globals[kSomeoneHasExploded] = true; + } + + if (_game._trigger == 48) + _activeTeleporter = false; + + if (_game._trigger == 100) { + _bartenderReady = false; + if (_bartenderHandsHips) { + _scene->_sequences.remove(_globals._sequenceIndexes[10]); + _bartenderHandsHips = false; + } else if (_bartenderLooksLeft) { + _scene->_sequences.remove(_globals._sequenceIndexes[11]); + _bartenderLooksLeft = false; + } else if (_bartenderSteady) { + _scene->_sequences.remove(_globals._sequenceIndexes[9]); + _bartenderSteady = false; + } + + if (!_bartenderTalking) { + _globals._sequenceIndexes[10] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[10], false, 7, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[10], 3, 4); + _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 8); + int idx = _scene->_dynamicHotspots.add(0x30E, 0xD, _globals._sequenceIndexes[10], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(228, 83), FACING_SOUTH); + _bartenderTalking = true; + if (_talkTimer > 1000) + _scene->_sequences.addTimer(_talkTimer - 1000, 101); + else + _scene->_sequences.addTimer(_talkTimer, 101); + } + } + + if ((_game._trigger == 101) && _bartenderTalking) { + _scene->_sequences.remove(_globals._sequenceIndexes[10]); + _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 1); + int idx = _scene->_dynamicHotspots.add(0x30E, 0xD, _globals._sequenceIndexes[9], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(228, 83), FACING_SOUTH); + _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 8); + _bartenderSteady = true; + _bartenderTalking = false; + if (_talkTimer < 1000) + _bartenderReady = true; + } + + if (_game._trigger == 28) + _game._player._stepEnabled = true; + + switch (_game._trigger) { + case 92: + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._sequenceIndexes[6]); + _globals._sequenceIndexes[7] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 10, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[7], 1, 2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 5); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SEQUENCE_TRIGGER_EXPIRE, 0, 93); + break; + + case 93: { + int seqIdx = _globals._sequenceIndexes[7]; + switch (_roxMode) { + case 20: + _vm->_sound->command(57); + _scene->_sequences.remove(_globals._sequenceIndexes[15]); + _game._objects.addToInventory(OBJ_CREDIT_CHIP); + _vm->_dialogs->showItem(OBJ_CREDIT_CHIP, 40242); + break; + + case 22: + _vm->_sound->command(57); + _scene->_sequences.remove(_globals._sequenceIndexes[8]); + _game._objects.addToInventory(OBJ_ALIEN_LIQUOR); + _globals[kBottleDisplayed] = false; + _vm->_dialogs->showItem(OBJ_ALIEN_LIQUOR, 40241); + break; + + case 21: + _globals._sequenceIndexes[15] = _scene->_sequences.startCycle(_globals._spriteIndexes[15], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[15], 8); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[15], Common::Point(250, 80)); + break; + + default: + break; + } + _globals._sequenceIndexes[7] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[7], false, 10, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[7], 1, 3); + _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 5); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[7], seqIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SEQUENCE_TRIGGER_EXPIRE, 0, 94); + + if (_roxMode == 21) { + if (_game._objects.isInInventory(OBJ_CREDIT_CHIP)) + _game._objects.setRoom (OBJ_CREDIT_CHIP, NOWHERE); + + _bartenderMode = 20; + _scene->_sequences.addTimer(60, 95); + } + } + break; + + case 94: { + int seqIdx = _globals._sequenceIndexes[7]; + _globals._sequenceIndexes[6] = _scene->_sequences.startCycle(_globals._spriteIndexes[6], false, 11); + _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 5); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[6], seqIdx); + if (_roxMode == 22) { + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(230, 56), 0x1110, 32, 0, 120, _game.getQuote(0x23F)); + _bartenderMode = 21; + _globals[kHasPurchased] = true; + _scene->_sequences.addTimer(140, 95); + } else if (_roxMode == 20) + _game._player._stepEnabled = true; + + } + break; + } + + switch (_game._trigger) { + case 95: + _bartenderReady = false; + _game._player._stepEnabled = false; + if (_bartenderHandsHips || _bartenderTalking) { + _scene->_sequences.remove(_globals._sequenceIndexes[10]); + _bartenderHandsHips = false; + _bartenderTalking = false; + } + + if (_bartenderLooksLeft) { + _scene->_sequences.remove(_globals._sequenceIndexes[11]); + _bartenderLooksLeft = false; + } + + if (_bartenderSteady) { + _scene->_sequences.remove(_globals._sequenceIndexes[9]); + _bartenderSteady = false; + } + _globals._sequenceIndexes[12] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[12], false, 10, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[12], 1, 4); + _scene->_sequences.setDepth(_globals._sequenceIndexes[12], 8); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SEQUENCE_TRIGGER_EXPIRE, 0, 96); + break; + + case 96: { + int seqIdx = _globals._sequenceIndexes[12]; + _globals._sequenceIndexes[12] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[12], false, 10, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[12], 6, 7); + _scene->_sequences.setDepth(_globals._sequenceIndexes[12], 8); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[12], seqIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SEQUENCE_TRIGGER_EXPIRE, 0, 97); + } + break; + + case 97: { + int seqIdx = _globals._sequenceIndexes[12]; + switch (_bartenderMode) { + case 20: + _scene->_sequences.remove(_globals._sequenceIndexes[15]); + break; + + case 21: { + _globals._sequenceIndexes[15] = _scene->_sequences.startCycle(_globals._spriteIndexes[15], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[15], 8); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[15], Common::Point(250, 80)); + int idx = _scene->_dynamicHotspots.add(0x5C, 0x4, _globals._sequenceIndexes[15], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(0, 0), FACING_NONE); + } + break; + + case 22: + _scene->_sequences.remove(_globals._sequenceIndexes[8]); + _globals[kBottleDisplayed] = false; + break; + + default: + break; + } + + _globals._sequenceIndexes[12] = _scene->_sequences.startCycle(_globals._spriteIndexes[12], false, 6); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[12], seqIdx); + _scene->_sequences.setDepth(_globals._sequenceIndexes[12], 8); + _scene->_sequences.addTimer(10, 98); + } + break; + + case 98: + _scene->_sequences.remove(_globals._sequenceIndexes[12]); + _globals._sequenceIndexes[12] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[12], false, 10, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[12], 1, 4); + _scene->_sequences.setDepth(_globals._sequenceIndexes[12], 8); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SEQUENCE_TRIGGER_EXPIRE, 0, 99); + break; + + case 99: { + int seqIdx = _globals._sequenceIndexes[12]; + _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 1); + _bartenderSteady = true; + int idx = _scene->_dynamicHotspots.add(0x30E, 0xD, _globals._sequenceIndexes[9], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(228, 83), FACING_SOUTH); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[9], seqIdx); + _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 8); + if (_bartenderMode == 20) { + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(210, 41), 0xFDFC, 0, 0, 100, _game.getQuote(0x1F3)); + _scene->_sequences.addTimer(5, 100); + _talkTimer = 180; + _roxMode = 22; + _scene->_sequences.addTimer(65, 92); + } else if ((_bartenderMode == 21) || (_bartenderMode == 22)) { + _game._player._stepEnabled = true; + _bartenderReady = true; + } + + } + break; + } + + switch (_game._trigger) { + case 86: + _bartenderReady = false; + _game._player._stepEnabled = false; + if ((_bartenderHandsHips) || (_bartenderTalking)) { + _scene->_sequences.remove(_globals._sequenceIndexes[10]); + _bartenderHandsHips = false; + _bartenderTalking = false; + } else if (_bartenderLooksLeft) { + _scene->_sequences.remove(_globals._sequenceIndexes[11]); + _bartenderLooksLeft = false; + } else if (_bartenderSteady) { + _scene->_sequences.remove(_globals._sequenceIndexes[9]); + _bartenderSteady = false; + } + _globals._sequenceIndexes[9] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 10, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[9], 1, 9); + _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 8); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SEQUENCE_TRIGGER_EXPIRE, 0, 87); + break; + + case 87: { + int seqIdx = _globals._sequenceIndexes[9]; + _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 9); + _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 8); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[9], seqIdx); + _scene->_sequences.addTimer(10, 89); + + _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 10, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[8], 1, 4); + _scene->_sequences.setDepth(_globals._sequenceIndexes[8], 7); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_EXPIRE, 0, 88); + } + break; + + case 88: + _globals._sequenceIndexes[8] = _scene->_sequences.startCycle(_globals._spriteIndexes[8], false, 4); + _scene->_sequences.setDepth(_globals._sequenceIndexes[8], 7); + _globals[kBottleDisplayed] = true; + break; + + case 89: + _scene->_sequences.remove(_globals._sequenceIndexes[9]); + _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 6); + _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 8); + _scene->_sequences.addTimer(10, 90); + break; + + case 90: + _scene->_sequences.remove(_globals._sequenceIndexes[9]); + _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 5); + _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 8); + _scene->_sequences.addTimer(10, 91); + break; + + case 91: { + _scene->_sequences.remove(_globals._sequenceIndexes[9]); + _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 1); + int idx = _scene->_dynamicHotspots.add(0x30E, 0xD, _globals._sequenceIndexes[9], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(228, 83), FACING_SOUTH); + _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 8); + _bartenderSteady = true; + _game._player._stepEnabled = true; + _bartenderReady = true; + } + break; + } + + if (!_waitingGinnyMove && !_ginnyLooking) { + _waitingGinnyMove = true; + ++ _beatCounter; + if (_beatCounter >= 20) { + _ginnyLooking = true; + _beatCounter = 0; + _scene->_sequences.addTimer(60, 54); + } else { + _scene->_sequences.addTimer(30, 75); + } + } + + switch (_game._trigger) { + case 75: + _scene->_sequences.remove(_globals._sequenceIndexes[5]); + _bigBeatFl = !_bigBeatFl; + + if (_bigBeatFl) { + _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 5); + _scene->_sequences.addTimer(8, 130); + } else { + _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 5); + _scene->_sequences.addTimer(8, 53); + } + + _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 1); + break; + + case 130: + _scene->_sequences.remove(_globals._sequenceIndexes[5]); + _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 6); + _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 1); + _scene->_sequences.addTimer(8, 131); + break; + + case 131: + _scene->_sequences.remove(_globals._sequenceIndexes[5]); + _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 5); + _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 1); + _scene->_sequences.addTimer(8, 53); + break; + + case 53: + if (_bigBeatFl) { + _scene->_sequences.remove(_globals._sequenceIndexes[5]); + _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 1); + } else { + _scene->_sequences.remove(_globals._sequenceIndexes[5]); + _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 1); + } + _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 1); + _waitingGinnyMove = false; + break; + } + + if ((_game._trigger == 54) && _ginnyLooking) { + ++_beatCounter; + if (_beatCounter >= 10) { + _ginnyLooking = false; + _waitingGinnyMove = false; + _beatCounter = 0; + _bigBeatFl = true; + } else { + _scene->_sequences.remove(_globals._sequenceIndexes[5]); + _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, _vm->getRandomNumber(1, 4)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 1); + _scene->_sequences.addTimer(60, 54); + } + } + + if (_bartenderReady) { + if (_vm->getRandomNumber(1, 250) == 1) { + if (_bartenderLooksLeft) { + _scene->_sequences.remove(_globals._sequenceIndexes[11]); + _bartenderLooksLeft = false; + } else if (_bartenderHandsHips) { + _scene->_sequences.remove(_globals._sequenceIndexes[10]); + _bartenderHandsHips = false; + } else if (_bartenderSteady) { + _scene->_sequences.remove(_globals._sequenceIndexes[9]); + _bartenderSteady = false; + } + + switch (_vm->getRandomNumber(1, 3)) { + case 1: { + _globals._sequenceIndexes[10] = _scene->_sequences.startCycle(_globals._spriteIndexes[10], false, 4); + _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 8); + int idx = _scene->_dynamicHotspots.add(0x30E, 0xD, _globals._sequenceIndexes[10], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(228, 83), FACING_SOUTH); + _bartenderHandsHips = true; + } + break; + + case 2: { + _globals._sequenceIndexes[11] = _scene->_sequences.startCycle(_globals._spriteIndexes[11], false, 2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[11], 8); + int idx = _scene->_dynamicHotspots.add(0x30E, 0xD, _globals._sequenceIndexes[11], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(228, 83), FACING_SOUTH); + _bartenderLooksLeft = true; + } + break; + + case 3: { + _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 8); + int idx = _scene->_dynamicHotspots.add(0x30E, 0xD, _globals._sequenceIndexes[9], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(228, 83), FACING_SOUTH); + _bartenderSteady = true; + } + break; + + default: + break; + } + } + } + + if (_game._trigger == 76) { + int seqIdx = _globals._sequenceIndexes[6]; + _globals._sequenceIndexes[6] = _scene->_sequences.startCycle(_globals._spriteIndexes[6], false, 11); + _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 5); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[6], seqIdx); + if (!_globals[kBeenThruHelgaScene]) { + _game._player._stepEnabled = false; + _cutSceneNeeded = true; + } else { + _game._player._stepEnabled = true; + } + _roxOnStool = true; + } + + switch (_game._trigger) { + case 77: + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._sequenceIndexes[6]); + _globals._sequenceIndexes[7] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 10, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[7], 10, 12); + _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 5); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SEQUENCE_TRIGGER_EXPIRE, 0, 78); + break; + + case 78: { + _vm->_sound->command(57); + int seqIdx = _globals._sequenceIndexes[7]; + _game._objects.addToInventory(OBJ_REPAIR_LIST); + _scene->_sequences.remove(_globals._sequenceIndexes[14]); + _globals._sequenceIndexes[7] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[7], false, 10, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[7], 10, 12); + _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 5); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[7], seqIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SEQUENCE_TRIGGER_EXPIRE, 0, 79); + } + break; + + case 79: { + int seqIdx = _globals._sequenceIndexes[7]; + _globals._sequenceIndexes[6] = _scene->_sequences.startCycle(_globals._spriteIndexes[6], false, 11); + _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 5); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[6], seqIdx); + _scene->_sequences.addTimer(20, 180); + } + break; + + case 180: + _vm->_dialogs->showItem(OBJ_REPAIR_LIST, 40240); + _game._player._stepEnabled = true; + break; + + default: + break; + } + + if (_cutSceneNeeded && _cutSceneReady) { + _cutSceneNeeded = false; + _scene->_sequences.addTimer(20, 55); + _helgaReady = false; + _bartenderReady = false; + } + + if (_vm->getRandomNumber(1, 25) == 1) { + if (_lightOn) { + _scene->_sequences.remove(_globals._sequenceIndexes[0]); + _lightOn = false; + } else { + _globals._sequenceIndexes[0] = _scene->_sequences.startCycle(_globals._spriteIndexes[0], false, 1); + _lightOn = true; + } + } + + if (!_blowingSmoke) { + if (_vm->getRandomNumber(1, 300) == 1) { + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 1, 14); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 30); + _blowingSmoke = true; + } + } + + switch (_game._trigger) { + case 30: + _globals._sequenceIndexes[1] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[1], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 1, 5); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1],SEQUENCE_TRIGGER_EXPIRE, 0, 31); + break; + + case 31: + _blowingSmoke = false; + break; + } + + if (!_leftWomanMoving) { + if (_vm->getRandomNumber(1, 1000) == 1) { + switch (_vm->getRandomNumber(1, 2)) { + case 1: + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 8); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 33); + _leftWomanMoving = true; + break; + + case 2: + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 1); + _scene->_sequences.addTimer(12, 35); + _leftWomanMoving = true; + break; + + default: + break; + } + } + } + + switch (_game._trigger) { + case 33: { + int seqIdx = _globals._sequenceIndexes[2]; + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 9); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], seqIdx); + _scene->_sequences.addTimer(_vm->getRandomNumber(60, 250), 34); + } + break; + + case 34: + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _globals._sequenceIndexes[2] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[2], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 8); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 38); + break; + + case 35: + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 2); + _scene->_sequences.addTimer(_vm->getRandomNumber(60, 300), 36); + break; + + case 36: + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 1); + _scene->_sequences.addTimer(12, 37); + break; + + case 37: + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _leftWomanMoving = false; + break; + + case 38: + _leftWomanMoving = false; + break; + + default: + break; + } + + if (!_rightWomanMoving) { + if (_vm->getRandomNumber(1, 300) == 1) { + switch (_vm->getRandomNumber(1, 4)) { + case 1: + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 4); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 32); + _rightWomanMoving = true; + break; + + case 2: + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 12, 2, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 4, 5); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 32); + _rightWomanMoving = true; + break; + + case 3: + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 12, 2, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 4, 5); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 32); + _rightWomanMoving = true; + break; + + case 4: + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 12, 2, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 3, 4); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 32); + _rightWomanMoving = true; + break; + + default: + break; + } + } + } + + if (_game._trigger == 32) + _rightWomanMoving = false; + + if (_scene->_activeAnimation->getCurrentFrame() == 1) { + switch (_vm->getRandomNumber(1, 50)) { + case 1: + _scene->_activeAnimation->setCurrentFrame(2); + break; + + case 2: + _scene->_activeAnimation->setCurrentFrame(7); + break; + + case 3: + _scene->_activeAnimation->setCurrentFrame(11); + break; + + default: + _scene->_activeAnimation->setCurrentFrame(0); + break; + } + } + + if ((_scene->_activeAnimation->getCurrentFrame() == 4) && (_drinkTimer < 10)) { + ++ _drinkTimer; + _scene->_activeAnimation->setCurrentFrame(3); + } + + if (_drinkTimer == 10) { + _drinkTimer = 0; + _scene->_activeAnimation->setCurrentFrame(4); + _scene->_activeAnimation->_currentFrame = 5; + } + + + switch (_scene->_activeAnimation->getCurrentFrame()) { + case 6: + case 10: + case 14: + _scene->_activeAnimation->setCurrentFrame(0); + break; + + default: + break; + } + + switch (_game._trigger) { + case 39: + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(89, 67), 0xFDFC, 32, 0, 120, _game.getQuote(0x1D8)); + _scene->_sequences.addTimer(150, 40); + break; + + case 40: + _scene->_kernelMessages.add(Common::Point(89, 67), 0xFDFC, 32, 0, 120, _game.getQuote(0x1D9)); + _scene->_sequences.addTimer(150, 41); + break; + + case 41: + _scene->_kernelMessages.add(Common::Point(89, 67), 0xFDFC, 32, 0, 120, _game.getQuote(0x1DA)); + _game._player._stepEnabled = true; + break; + + case 42: + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(89, 67), 0xFDFC, 32, 0, 120, _game.getQuote(0x1DC)); + _scene->_sequences.addTimer(150, 43); + break; + + case 43: + _scene->_kernelMessages.add(Common::Point(89, 67), 0xFDFC, 32, 0, 120, _game.getQuote(0x1DD)); + _game._player._stepEnabled = true; + break; + + case 44: + _game._player._stepEnabled = true; + break; + + default: + break; + } + + switch (_game._trigger) { + case 55: + if (_bartenderHandsHips) { + _scene->_sequences.remove(_globals._sequenceIndexes[10]); + _bartenderHandsHips = false; + _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 1); + int idx = _scene->_dynamicHotspots.add(0x30E, 0xD, _globals._sequenceIndexes[9], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(228, 83), FACING_SOUTH); + _bartenderSteady = true; + _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 8); + } else if (_bartenderLooksLeft) { + _scene->_sequences.remove(_globals._sequenceIndexes[11]); + _bartenderLooksLeft = false; + _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 1); + int idx = _scene->_dynamicHotspots.add(0x30E, 0xD, _globals._sequenceIndexes[9], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(228, 83), FACING_SOUTH); + _bartenderSteady = true; + _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 8); + } + _game._player._stepEnabled = false; + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(180, 47), 0xFBFA, 0, 0, 100, _game.getQuote(0x1FE)); + _scene->_sequences.addTimer(120, 56); + break; + + case 56: + _scene->_sequences.remove(_globals._sequenceIndexes[13]); + _globals._sequenceIndexes[13] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[13], false, 10, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[13], 2, 5); + _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 8); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SEQUENCE_TRIGGER_EXPIRE, 0, 57); + break; + + case 57: { + int seqIdx = _globals._sequenceIndexes[13]; + _scene->_sequences.remove(_globals._sequenceIndexes[20]); + _globals._sequenceIndexes[13] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[13], false, 10, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[13], 6, 9); + _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 8); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[13], seqIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SEQUENCE_TRIGGER_EXPIRE, 0, 58); + } + break; + + case 58: { + int seqIdx = _globals._sequenceIndexes[13]; + _globals._sequenceIndexes[13] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[13], false, 10, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[13], 5, 9); + _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 8); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[13], seqIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SEQUENCE_TRIGGER_EXPIRE, 0, 59); + } + break; + + case 59: { + int seqIdx = _globals._sequenceIndexes[13]; + _globals._sequenceIndexes[13] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[13], false, 10, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[13], 1, 4); + _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 8); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[13], seqIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SEQUENCE_TRIGGER_EXPIRE, 0, 60); + _globals._sequenceIndexes[20] = _scene->_sequences.startCycle(_globals._spriteIndexes[20], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[20], 8); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[20], Common::Point(234, 72)); + } + break; + + case 60: { + int seqIdx = _globals._sequenceIndexes[13]; + _globals._sequenceIndexes[13] = _scene->_sequences.startCycle(_globals._spriteIndexes[13], false, 2); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[13], seqIdx); + _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 8); + _scene->_sequences.addTimer(10, 61); + } + break; + + case 61: + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(181, 33), 0xFBFA, 0, 0, 130, _game.getQuote(0x1FF)); + _scene->_kernelMessages.add(Common::Point(171, 47), 0xFBFA, 0, 0, 130, _game.getQuote(0x200)); + _scene->_sequences.addTimer(150, 63); + _scene->_sequences.remove(_globals._sequenceIndexes[13]); + _globals._sequenceIndexes[13] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[13], false, 30, 4, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[13], 10, 11); + _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 8); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SEQUENCE_TRIGGER_EXPIRE, 0, 62); + break; + + case 62: { + int seqIdx = _globals._sequenceIndexes[13]; + _globals._sequenceIndexes[13] = _scene->_sequences.startCycle(_globals._spriteIndexes[13], false, 2); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[13], seqIdx); + _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 8); + } + break; + + case 63: + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(160, 33), 0xFBFA, 0, 0, 130, _game.getQuote(0x201)); + _scene->_kernelMessages.add(Common::Point(165, 47), 0xFBFA, 0, 0, 130, _game.getQuote(0x202)); + _scene->_sequences.addTimer(150, 64); + break; + + case 64: + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(210, 27), 0xFDFC, 0, 0, 130, _game.getQuote(0x1E0)); + _scene->_kernelMessages.add(Common::Point(198, 41), 0xFDFC, 0, 0, 130, _game.getQuote(0x1E1)); + _scene->_sequences.addTimer(150, 65); + _scene->_sequences.addTimer(1, 100); + _talkTimer = 1130; + break; + + case 65: + _vm->_sound->command(30); + _globals._sequenceIndexes[16] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[16], false, 10, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[16], 1, 6); + _scene->_sequences.setDepth(_globals._sequenceIndexes[16], 9); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[16], SEQUENCE_TRIGGER_EXPIRE, 0, 66); + break; + + case 66: { + int seqIdx = _globals._sequenceIndexes[16]; + _globals._sequenceIndexes[16] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[16], false, 10, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[16], 7, 37); + _scene->_sequences.setDepth(_globals._sequenceIndexes[16], 9); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[16], seqIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[16], SEQUENCE_TRIGGER_EXPIRE, 0, 68); + + _scene->_sequences.remove(_globals._sequenceIndexes[13]); + _globals._sequenceIndexes[13] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[13], false, 10, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[13], 12, 13); + _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 8); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SEQUENCE_TRIGGER_EXPIRE, 0, 67); + } + break; + + case 67: { + int seqIdx = _globals._sequenceIndexes[13]; + _globals._sequenceIndexes[13] = _scene->_sequences.startCycle(_globals._spriteIndexes[13], false, 13); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[13], seqIdx); + _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 8); + } + break; + + case 68: + _scene->_sequences.remove(_globals._sequenceIndexes[13]); + _globals._sequenceIndexes[13] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[13], false, 10, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[13], 12, 13); + _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 8); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SEQUENCE_TRIGGER_EXPIRE, 0, 69); + break; + + case 69: { + int seqIdx = _globals._sequenceIndexes[13]; + _globals._sequenceIndexes[13] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[13], false, 25, 4, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[13], 10, 11); + _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 8); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[13], seqIdx); + + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(179, 33), 0xFBFA, 0, 0, 130, _game.getQuote(0x203)); + _scene->_kernelMessages.add(Common::Point(167, 47), 0xFBFA, 0, 0, 130, _game.getQuote(0x204)); + _scene->_sequences.addTimer(150, 71); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SEQUENCE_TRIGGER_EXPIRE, 0, 70); + } + break; + + case 70: + _globals._sequenceIndexes[13] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[13], false, 25, 4, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[13], 10, 12); + _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 8); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SEQUENCE_TRIGGER_EXPIRE, 0, 72); + break; + + case 71: + _scene->_sequences.addTimer(210, 73); + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(168, 33), 0xFBFA, 0, 0, 180, _game.getQuote(0x205)); + _scene->_kernelMessages.add(Common::Point(151, 47), 0xFBFA, 0, 0, 180, _game.getQuote(0x206)); + if (!_game._objects.isInInventory(OBJ_REPAIR_LIST)) + _activeArrows = true; + break; + + case 72: { + int seqIdx = _globals._sequenceIndexes[13]; + _globals._sequenceIndexes[13] = _scene->_sequences.startCycle(_globals._spriteIndexes[13], false, 2); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[13], seqIdx); + _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 8); + } + break; + + case 73: + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(177, 33), 0xFBFA, 0, 0, 150, _game.getQuote(0x207)); + _scene->_kernelMessages.add(Common::Point(172, 47), 0xFBFA, 0, 0, 150, _game.getQuote(0x208)); + _bartenderSteady = true; + _game._player._stepEnabled = true; + _helgaReady = true; + _bartenderReady = true; + _globals[kBeenThruHelgaScene] = true; + _activeArrows = false; + break; + + default: + break; + } + + if (_helgaReady) { + int rndVal = _vm->getRandomNumber(1, 1000); + if (rndVal < 6) + switch (rndVal) { + case 1: + _cutSceneReady = false; + _helgaReady = false; + _scene->_sequences.remove(_globals._sequenceIndexes[13]); + _globals._sequenceIndexes[13] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[13], false, 10, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[13], 2, 5); + _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 8); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SEQUENCE_TRIGGER_EXPIRE, 0, 82); + break; + + case 2: + _cutSceneReady = false; + _helgaReady = false; + _scene->_sequences.remove(_globals._sequenceIndexes[13]); + _globals._sequenceIndexes[13] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[13], false, 15, 2, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[13], 11, 13); + _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 8); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SEQUENCE_TRIGGER_EXPIRE, 0, 26); + break; + + case 3: + _cutSceneReady = false; + _helgaReady = false; + _scene->_sequences.remove(_globals._sequenceIndexes[13]); + _globals._sequenceIndexes[13] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[13], false, 10, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[13], 10, 11); + _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 8); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SEQUENCE_TRIGGER_EXPIRE, 0, 26); + break; + + case 4: + _cutSceneReady = false; + _helgaReady = false; + _scene->_sequences.remove(_globals._sequenceIndexes[13]); + _globals._sequenceIndexes[13] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[13], false, 15, 2, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[13], 14, 15); + _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 8); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SEQUENCE_TRIGGER_EXPIRE, 0, 26); + break; + + case 5: + _cutSceneReady = false; + _helgaReady = false; + _scene->_sequences.remove(_globals._sequenceIndexes[13]); + _globals._sequenceIndexes[13] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[13], false, 10, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[13], 16, 19); + _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 8); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SEQUENCE_TRIGGER_EXPIRE, 0, 80); + break; + + default: + break; + } + } + + if (_game._trigger == 80) { + int seqIdx = _globals._sequenceIndexes[13]; + _globals._sequenceIndexes[13] = _scene->_sequences.startCycle(_globals._spriteIndexes[13], false, 19); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[13], seqIdx); + _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 8); + _scene->_sequences.addTimer(_vm->getRandomNumber(60, 120), 81); + } + + if (_game._trigger == 81) { + _scene->_sequences.remove(_globals._sequenceIndexes[13]); + _globals._sequenceIndexes[13] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[13], false, 10, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[13], 16, 19); + _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 8); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SEQUENCE_TRIGGER_EXPIRE, 0, 26); + } + + if (_game._trigger == 26) { + int seqIdx = _globals._sequenceIndexes[13]; + _globals._sequenceIndexes[13] = _scene->_sequences.startCycle(_globals._spriteIndexes[13], false, 2); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[13], seqIdx); + _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 8); + _cutSceneReady = true; + + if (!_cutSceneNeeded) + _helgaReady = true; + } + + if (_game._trigger == 82) { + _scene->_sequences.remove(_globals._sequenceIndexes[20]); + int seqIdx = _globals._sequenceIndexes[13]; + _globals._sequenceIndexes[13] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[13], false, 10, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[13], 6, 9); + _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 8); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[13], seqIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SEQUENCE_TRIGGER_EXPIRE, 0, 83); + } + + if (_game._trigger == 83) { + int seqIdx = _globals._sequenceIndexes[13]; + _globals._sequenceIndexes[13] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[13], false, 10, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[13], 5, 9); + _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 8); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[13], seqIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SEQUENCE_TRIGGER_EXPIRE, 0, 84); + } + + if (_game._trigger == 84) { + int seqIdx = _globals._sequenceIndexes[13]; + _globals._sequenceIndexes[13] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[13], false, 10, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[13], 1, 4); + _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 8); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[13], seqIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SEQUENCE_TRIGGER_EXPIRE, 0, 85); + + _globals._sequenceIndexes[20] = _scene->_sequences.startCycle(_globals._spriteIndexes[20], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[20], 8); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[20], Common::Point(234, 72)); + } + + if (_game._trigger == 85) { + int seqIdx = _globals._sequenceIndexes[13]; + _globals._sequenceIndexes[13] = _scene->_sequences.startCycle(_globals._spriteIndexes[13], false, 2); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[13], seqIdx); + _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 8); + _cutSceneReady = true; + if (!_cutSceneNeeded) + _helgaReady = true; + } + + if (_game._trigger == 102) { + _scene->_sequences.remove(_globals._sequenceIndexes[6]); + _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; + _globals._sequenceIndexes[7] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[7], 14, 18); + _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 5); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SEQUENCE_TRIGGER_EXPIRE, 0, 103); + } else if (_game._trigger == 103) { + _game._player._priorTimer = _scene->_frameStartTime + _game._player._ticksAmount; + _roxOnStool = false; + _game._player._facing = FACING_SOUTH; + _game._player.selectSeries(); + _game._player._visible = true; + _game._player._stepEnabled = true; + _game._player._readyToWalk = true; + } + + if (_activeArrows) { + if (!_activeArrow1) { + _globals._sequenceIndexes[17] = _scene->_sequences.startCycle(_globals._spriteIndexes[17], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[17], 1); + _scene->_sequences.addTimer(_vm->getRandomNumber(10, 15), 49); + _activeArrow1 = true; + } + + if (!_activeArrow2) { + _globals._sequenceIndexes[18] = _scene->_sequences.startCycle(_globals._spriteIndexes[18], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[18], 1); + _scene->_sequences.addTimer(_vm->getRandomNumber(10, 15), 50); + _activeArrow2 = true; + } + + if (!_activeArrow3) { + _globals._sequenceIndexes[19] = _scene->_sequences.startCycle(_globals._spriteIndexes[19], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[19], 1); + _scene->_sequences.addTimer(_vm->getRandomNumber(10, 15), 51); + _activeArrow3 = true; + } + } + + if (_game._trigger == 49) { + _scene->_sequences.remove(_globals._sequenceIndexes[17]); + _scene->_sequences.addTimer(_vm->getRandomNumber(10, 15), 45); + } + + if (_game._trigger == 45) + _activeArrow1 = false; + + if (_game._trigger == 50) { + _scene->_sequences.remove(_globals._sequenceIndexes[18]); + _scene->_sequences.addTimer(_vm->getRandomNumber(10, 15), 46); + } + + if (_game._trigger == 46) + _activeArrow2 = false; + + if (_game._trigger == 51) { + _scene->_sequences.remove(_globals._sequenceIndexes[19]); + _scene->_sequences.addTimer(_vm->getRandomNumber(10, 15), 47); + } + + if (_game._trigger == 47) + _activeArrow3 = false; +} + +void Scene402::preActions() { + if (_action.isAction(0x30B, 0x24A) && (_game._player._prepareWalkPos.x != 248)) + _game._player.walk(Common::Point(232, 112), FACING_EAST); + + if (_action.isAction(VERB_WALKTO, 0x309)) + _game._player._needToWalk = _game._player._readyToWalk; + + if (!_roxOnStool && _action.isAction(VERB_TAKE, 0x5C) && !_game._objects.isInInventory(OBJ_CREDIT_CHIP)) + _game._player.walk(Common::Point(246, 108), FACING_NORTH); + + if (_action.isAction(VERB_TAKE)) + _game._player._needToWalk = false; + + if (_action.isAction(VERB_TAKE, 0x5C) && !_roxOnStool) + _game._player._needToWalk = true; + + if (_roxOnStool) { + if (_action.isAction(VERB_LOOK) || _action.isAction(0x24A) || _action.isAction(VERB_TALKTO)) + _game._player._needToWalk = false; + + if (_action.isAction(VERB_TAKE, 0x124) || _action.isAction(VERB_TAKE, 0x5C)) + _game._player._needToWalk = false; + + if (_action.isAction(VERB_TALKTO, 0x30A) || _action.isAction(VERB_TALKTO, 0x30C)) + _game._player._needToWalk = _game._player._readyToWalk; + + if (_game._player._needToWalk) { + _game._player._facing = FACING_SOUTH; + _game._player._readyToWalk = false; + _game._player._stepEnabled = false; + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addTimer(1, 102); + } + } + + if (_action.isAction(VERB_TAKE, 0x124) && !_roxOnStool && !_game._objects.isInInventory(OBJ_REPAIR_LIST)) + _game._player.walk(Common::Point(191, 99), FACING_NORTHEAST); + + if (_action.isAction(VERB_TALKTO, 0x30E) && !_roxOnStool) + _game._player.walk(Common::Point(228, 83), FACING_SOUTH); + + if (_action.isAction(VERB_TALKTO, 0x3AA) && !_roxOnStool) + _game._player.walk(Common::Point(208, 102), FACING_NORTHEAST); +} + +void Scene402::actions() { + if (_action.isAction(VERB_TAKE, 0x124) && _game._objects.isInRoom(OBJ_REPAIR_LIST) && _roxOnStool) { + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addTimer(1, 77); + _game._player._needToWalk = false; + } else if (_action.isAction(VERB_TAKE, 0x124) && _game._objects.isInRoom(OBJ_REPAIR_LIST) && !_roxOnStool) { + if (_game._trigger == 0) { + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[21] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[21], false, 7, 2, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[21], 1, 2); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[21]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[21], SEQUENCE_TRIGGER_SPRITE, 2, 165); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[21], SEQUENCE_TRIGGER_EXPIRE, 0, 166); + } else if (_game._trigger == 165) { + _scene->_sequences.remove(_globals._sequenceIndexes[14]); + _game._objects.addToInventory(OBJ_REPAIR_LIST); + } + } else if (_game._trigger == 166) { + _game._player._priorTimer = _scene->_frameStartTime + _game._player._ticksAmount; + _game._player._visible = true; + _scene->_sequences.addTimer(20, 167); + } else if (_game._trigger == 167) { + _vm->_dialogs->showItem(OBJ_REPAIR_LIST, 40240); + _game._player._stepEnabled = true; + } else if (_game._screenObjects._inputMode == 1) + handleDialogs(); + else if (_action.isAction(0x242, 0x2B3)) + _scene->_nextSceneId = 401; + else if (_action.isAction(0x2B5, 0x248)) + ; // just... nothing + else if (_action.isAction(VERB_TALKTO, 0x3AA)) { + switch (_game._trigger) { + case 0: { + _game._player._stepEnabled = false; + int random = _vm->getRandomNumber(1, 3); + if (_helgaTalkMode == 0) + random = 1; + + int centerFlag; + Common::Point centerPos; + if (_roxOnStool) { + centerFlag = 0; + centerPos = Common::Point(230, 56); + } else { + centerFlag = 2; + centerPos = Common::Point(0, 0); + } + + switch (random) { + case 1: + _scene->_kernelMessages.add(centerPos, 0x1110, 32 | centerFlag, 0, 90, _game.getQuote(0x211)); + _scene->_sequences.addTimer(110, 25); + break; + + case 2: + _scene->_kernelMessages.add(centerPos, 0x1110, 32 | centerFlag, 0, 90, _game.getQuote(0x212)); + _scene->_sequences.addTimer(110, 25); + break; + + case 3: + _scene->_kernelMessages.add(centerPos, 0x1110, 32 | centerFlag, 0, 90, _game.getQuote(0x213)); + _scene->_sequences.addTimer(110, 25); + break; + + default: + break; + } + } + break; + + case 25: + switch (_helgaTalkMode) { + case 0: + _game._player._stepEnabled = false; + _helgaTalkMode = 1; + _scene->_kernelMessages.add(Common::Point(177, 33), 0xFBFA, 0, 0, 130, _game.getQuote(0x209)); + _scene->_kernelMessages.add(Common::Point(182, 47), 0xFBFA, 0, 0, 130, _game.getQuote(0x20A)); + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addTimer(130, 28); + break; + + case 1: + _game._player._stepEnabled = false; + _helgaTalkMode = 2; + _scene->_kernelMessages.add(Common::Point(157, 47), 0xFBFA, 0, 0, 100, _game.getQuote(0x20B)); + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addTimer(100, 28); + break; + + case 2: + _game._player._stepEnabled = false; + _helgaTalkMode = 3; + _scene->_kernelMessages.add(Common::Point(172, 47), 0xFBFA, 0, 0, 100, _game.getQuote(0x20C)); + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addTimer(100, 28); + break; + + case 3: + _game._player._stepEnabled = true; + break; + + default: + break; + } + break; + } + } else if (_action.isAction(VERB_TALKTO, 0x30A) && !_firstTalkToGirlInChair) { + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x1D7)); + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addTimer(150, 39); + _game._player._stepEnabled = false; + _firstTalkToGirlInChair = true; + } else if (_action.isAction(VERB_TALKTO, 0x30A) && _firstTalkToGirlInChair) { + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x1DB)); + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addTimer(150, 42); + _game._player._stepEnabled = false; + } else if (_action.isAction(VERB_TALKTO, 0x30C) || _action.isAction(VERB_WALKTO, 0x30C)) { + _scene->_kernelMessages.add(Common::Point(102, 48), 0xFBFA, 0, 0, 120, _game.getQuote(0x1DE)); + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addTimer(120, 44); + _game._player._stepEnabled = false; + } else if (_action.isAction(0x30B, 0x24A) && (_game._player._targetPos.x == 248)){ + _scene->_kernelMessages.add(Common::Point(0, -14), 0x1110, 34, 0, 120, _game.getQuote(0x20D)); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x20E)); + } else if (_action.isAction(0x30B, 0x24A) && !_roxOnStool && (_game._player._targetPos.x != 248)) { + _game._player._visible = false; + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 7, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[6], 1, 11); + _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 5); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_EXPIRE, 0, 76); + _game._player._stepEnabled = false; + } else if (_action.isAction(VERB_TAKE, 0x5C) && !_game._objects.isInInventory(OBJ_CREDIT_CHIP) && _roxOnStool) { + _roxMode = 20; + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addTimer(1, 92); + } else if (_action.isAction(VERB_TAKE, 0x5C) && !_game._objects.isInInventory(OBJ_CREDIT_CHIP) && !_roxOnStool) { + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[22] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[22], false, 7, 2, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[22], 1, 2); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[22], Common::Point(_game._player._playerPos.x, _game._player._playerPos.y + 1)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[22], 5); + _scene->_sequences.setScale(_globals._sequenceIndexes[22], 88); + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[22], SEQUENCE_TRIGGER_EXPIRE, 0, 104); + } else if (_action.isAction(VERB_TALKTO, 0x30E)) { + switch (_game._trigger) { + case 0: { + int centerFlag; + Common::Point centerPos; + if (_roxOnStool) { + centerFlag = 0; + centerPos = Common::Point(230, 56); + } else { + centerFlag = 2; + centerPos = Common::Point(0, 0); + } + + _game._player._stepEnabled = false; + int quoteId; + if (_bartenderCalled) { + quoteId = 0x210; + } else { + quoteId = 0x20F; + _bartenderCalled = true; + } + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(centerPos, 0x1110, 32 | centerFlag, 0, 90, _game.getQuote(quoteId)); + _scene->_sequences.addTimer(110, 29); + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addTimer(90, 28); + } + break; + + case 29: + _scene->_kernelMessages.reset(); + if (!_roxOnStool) { + if (_game._objects.isInRoom(OBJ_ALIEN_LIQUOR)) { + _scene->_kernelMessages.add(Common::Point(177, 41), 0xFDFC, 0, 0, 120, _game.getQuote(0x1DF)); + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addTimer(1, 100); + _talkTimer = 120; + } else if (_rexMode == 0) { + _scene->_kernelMessages.add(Common::Point(175, 13), 0xFDFC, 0, 0, 180, _game.getQuote(0x1F9)); + _scene->_kernelMessages.add(Common::Point(184, 27), 0xFDFC, 0, 0, 180, _game.getQuote(0x1FA)); + _scene->_kernelMessages.add(Common::Point(200, 41), 0xFDFC, 0, 0, 180, _game.getQuote(0x1FB)); + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addTimer(1, 100); + _talkTimer = 180; + _rexMode = 1; + } else if (_rexMode == 1) { + _scene->_kernelMessages.add(Common::Point(205, 41), 0xFDFC, 0, 0, 120, _game.getQuote(0x1FC)); + _game._player._stepEnabled = true; + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addTimer(1, 100); + _talkTimer = 120; + _rexMode = 3; + } else { + _game._player._stepEnabled = true; + } + } else { + if (_game._objects.isInRoom(OBJ_ALIEN_LIQUOR)) { + if (!_refuseAlienLiquor) { + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(198, 27), 0xFDFC, 0, 0, 9999999, _game.getQuote(0x1E2)); + _scene->_kernelMessages.add(Common::Point(199, 41), 0xFDFC, 0, 0, 9999999, _game.getQuote(0x1E3)); + _bartenderCurrentQuestion = 10; + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addTimer(1, 100); + _talkTimer = 120; + _conversationFl = true; + _bartenderDialogNode = 1; + if (_dialog2.read(0) <= 1) + _dialog1.write(0x214, false); + + _dialog1.start(); + } else { + _scene->_kernelMessages.add(Common::Point(177, 41), 0xFDFC, 0, 0, 9999999, _game.getQuote(0x1EF)); + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addTimer(1, 100); + _talkTimer = 120; + _bartenderCurrentQuestion = 3; + _conversationFl = true; + _bartenderDialogNode = 1; + if (_dialog2.read(0) <= 1) + _dialog1.write(0x214, false); + + _dialog1.start(); + _game._player._stepEnabled = true; + } + } else { + if (_rexMode == 0) { + _scene->_kernelMessages.add(Common::Point(175, 13), 0xFDFC, 0, 0, 180, _game.getQuote(0x1F9)); + _scene->_kernelMessages.add(Common::Point(184, 27), 0xFDFC, 0, 0, 180, _game.getQuote(0x1FA)); + _scene->_kernelMessages.add(Common::Point(200, 41), 0xFDFC, 0, 0, 180, _game.getQuote(0x1FB)); + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addTimer(1, 100); + _talkTimer = 180; + _rexMode = 1; + } else if (_rexMode == 1) { + _scene->_kernelMessages.add(Common::Point(205, 41), 0xFDFC, 0, 0, 120, _game.getQuote(0x1FC)); + _game._player._stepEnabled = true; + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addTimer(1, 100); + _talkTimer = 120; + _rexMode = 3; + } else { + _game._player._stepEnabled = true; + } + } + } + break; + + default: + break; + } + } else if (_action.isAction(VERB_LOOK, 0x248)) + _vm->_dialogs->show(40210); + else if (_action.isAction(VERB_LOOK, 0x16C)) { + if (_globals[kSomeoneHasExploded]) + _vm->_dialogs->show(40212); + else + _vm->_dialogs->show(40211); + } else if (_action.isAction(VERB_LOOK, 0x241)) + _vm->_dialogs->show(40213); + else if (_action.isAction(VERB_LOOK, 0x30E)) + _vm->_dialogs->show(40214); + else if (_action.isAction(VERB_LOOK, 0x30C)) + _vm->_dialogs->show(40215); + else if (_action.isAction(VERB_LOOK, 0x309)) + _vm->_dialogs->show(40216); + else if (_action.isAction(VERB_LOOK, 0x30A)) + _vm->_dialogs->show(40217); + else if (_action.isAction(VERB_LOOK, 0x3AA)) + _vm->_dialogs->show(40218); + else if (_action.isAction(VERB_LOOK, 0x2B3)) + _vm->_dialogs->show(40219); + else if (_action._lookFlag) + _vm->_dialogs->show(40220); + else if (_action.isAction(VERB_LOOK, 0x2B8)) + _vm->_dialogs->show(40221); + else if (_action.isAction(VERB_PUSH, 0x3AA) || _action.isAction(VERB_PULL, 0x3AA)) + _vm->_dialogs->show(40222); + else if (_action.isAction(VERB_TALKTO, 0x2B8)) + _vm->_dialogs->show(40223); + else if (_action.isAction(VERB_TALKTO, 0x309)) + _vm->_dialogs->show(40224); + else if (_action.isAction(VERB_LOOK, 0x249)) + _vm->_dialogs->show(40225); + else if (_action.isAction(VERB_LOOK, 0x160)) + _vm->_dialogs->show(40226); + else if (_action.isAction(VERB_TAKE, 0x160)) + _vm->_dialogs->show(40227); + else if (_action.isAction(VERB_LOOK, 0x244)) + _vm->_dialogs->show(40228); + else if (_action.isAction(VERB_TAKE, 0x244)) + _vm->_dialogs->show(40229); + else if (_action.isAction(VERB_LOOK, 0x24A)) + _vm->_dialogs->show(40230); + else if (_action.isAction(VERB_TAKE, 0x24A)) + _vm->_dialogs->show(40231); + else if (_action.isAction(VERB_LOOK, 0x3B)) + _vm->_dialogs->show(40232); + else if (_action.isAction(VERB_TAKE, 0x3B)) + _vm->_dialogs->show(40233); + else if (_action.isAction(VERB_LOOK, 0x24E)) + _vm->_dialogs->show(40234); + else if (_action.isAction(VERB_LOOK, 0x247)) + _vm->_dialogs->show(40235); + else if (_action.isAction(VERB_LOOK, 0x174)) + _vm->_dialogs->show(40236); + else if (_action.isAction(VERB_LOOK, 0x10E)) + _vm->_dialogs->show(40237); + else if (_action.isAction(VERB_TAKE, 0x10E)) + _vm->_dialogs->show(40238); + else if (_action.isAction(VERB_LOOK, 0x124) && _game._objects.isInRoom(OBJ_REPAIR_LIST)) + _vm->_dialogs->show(40239); + else + return; + + _action._inProgress = false; +} + /*------------------------------------------------------------------------*/ } // End of namespace Nebular diff --git a/engines/mads/nebular/nebular_scenes4.h b/engines/mads/nebular/nebular_scenes4.h index 4e29753e42..4293408426 100644 --- a/engines/mads/nebular/nebular_scenes4.h +++ b/engines/mads/nebular/nebular_scenes4.h @@ -67,6 +67,67 @@ public: virtual void postActions() {}; }; +class Scene402: public Scene4xx { +private: + bool _lightOn; + bool _blowingSmoke; + bool _leftWomanMoving; + bool _rightWomanMoving; + bool _firstTalkToGirlInChair; + bool _waitingGinnyMove; + bool _ginnyLooking; + bool _bigBeatFl; + bool _roxOnStool; + bool _bartenderSteady; + bool _bartenderHandsHips; + bool _bartenderLooksLeft; + bool _bartenderReady; + bool _bartenderTalking; + bool _bartenderCalled; + bool _conversationFl; + bool _activeTeleporter; + bool _activeArrows; + bool _activeArrow1; + bool _activeArrow2; + bool _activeArrow3; + bool _cutSceneReady; + bool _cutSceneNeeded; + bool _helgaReady; + bool _refuseAlienLiquor; + + int _drinkTimer; + int _beatCounter; + int _bartenderMode; + int _bartenderDialogNode; + int _bartenderCurrentQuestion; + int _helgaTalkMode; + int _roxMode; + int _rexMode; + int _talkTimer; + + Conversation _dialog1; + Conversation _dialog2; + Conversation _dialog3; + Conversation _dialog4; + + void setDialogNode(int node); + void handleConversation1(); + void handleConversation2(); + void handleConversation3(); + void handleConversation4(); + void handleDialogs(); + +public: + Scene402(MADSEngine *vm) : Scene4xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From b7776bdbddba57a5503dcbf3fcb63cf44dfdb5cb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 30 Apr 2014 21:28:49 -0400 Subject: MADS: Fixes for using items on other items --- engines/mads/action.cpp | 18 ++++++++++++++---- engines/mads/action.h | 2 +- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index e278ffb740..0a0e79c660 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -151,7 +151,7 @@ void MADSAction::set() { } } - // Handling for if a hotspot has been selected/highlighted + // Add in any necessary article if necessary if ((_hotspotId >= 0) && (_selectedRow >= 0) && (_articleNumber > 0) && (_verbType == VERB_THAT)) { flag = true; @@ -159,6 +159,7 @@ void MADSAction::set() { _statusText += " "; } + // Handling for hotspot if (_hotspotId >= 0) { if (_selectedRow < 0) { int verbId; @@ -197,8 +198,19 @@ void MADSAction::set() { } } + if (_secondObject >= 0) { + if (_secondObjectSource == CAT_INV_LIST || _secondObjectSource == CAT_INV_ANIM) { + InventoryObject &invObject = _vm->_game->_objects.getItem(_hotspotId); + _action._indirectObjectId = invObject._descId; + } else if (_secondObject < (int)scene._hotspots.size()) { + _action._indirectObjectId = scene._hotspots[_hotspotId]._vocabId; + } else { + _action._indirectObjectId = scene._hotspots[_hotspotId - scene._hotspots.size()]._vocabId; + } + } + if ((_hotspotId >= 0) && (_articleNumber > 0) && !flag) { - if (_articleNumber == -1) { + if (_articleNumber == 0xff) { if (_secondObject >= 0) { int articleNum = 0; @@ -212,7 +224,6 @@ void MADSAction::set() { } _statusText += kArticleList[articleNum]; - _statusText += " "; } } else if ((_articleNumber == VERB_LOOK) || (_vm->getGameID() != GType_RexNebular) || (scene._vocabStrings[_action._indirectObjectId] != kFenceStr)) { @@ -472,7 +483,6 @@ void MADSAction::checkActionAtMousePos() { case CAT_INV_LIST: case CAT_HOTSPOT: case CAT_INV_ANIM: - // TODO: We may not need a separate ActionMode2 enum _mainObjectSource = userInterface._category; _hotspotId = _pickedWord; break; diff --git a/engines/mads/action.h b/engines/mads/action.h index c588a42324..6e51e12483 100644 --- a/engines/mads/action.h +++ b/engines/mads/action.h @@ -62,7 +62,7 @@ enum VerbType { VERB_ONLY, VERB_THIS, VERB_THAT }; enum PrepType { PREP_NONE, PREP_WITH, PREP_TO, PREP_AT, PREP_FROM, PREP_ON, PREP_IN, - PREP_UNDER, PREP_BEHIND, PREP_RELATIONAL = -1 + PREP_UNDER, PREP_BEHIND, PREP_RELATIONAL = 0xff }; enum ScrCategory { -- cgit v1.2.3 From 7a34dcf83d8dc80520e28cf6f698512d129af3bb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 30 Apr 2014 21:43:16 -0400 Subject: MADS: Further fix for using items on objects --- engines/mads/action.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index 0a0e79c660..cfd84bf762 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -200,12 +200,12 @@ void MADSAction::set() { if (_secondObject >= 0) { if (_secondObjectSource == CAT_INV_LIST || _secondObjectSource == CAT_INV_ANIM) { - InventoryObject &invObject = _vm->_game->_objects.getItem(_hotspotId); + InventoryObject &invObject = _vm->_game->_objects.getItem(_secondObject); _action._indirectObjectId = invObject._descId; } else if (_secondObject < (int)scene._hotspots.size()) { - _action._indirectObjectId = scene._hotspots[_hotspotId]._vocabId; + _action._indirectObjectId = scene._hotspots[_secondObject]._vocabId; } else { - _action._indirectObjectId = scene._hotspots[_hotspotId - scene._hotspots.size()]._vocabId; + _action._indirectObjectId = scene._hotspots[_secondObject - scene._hotspots.size()]._vocabId; } } -- cgit v1.2.3 From 39f771a3c5a2c750fae3c357d3ddec66d63a03dc Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 1 May 2014 09:44:47 +0300 Subject: FULLPIPE: Implement ModalSaveGame::saveload() --- engines/fullpipe/gameloader.cpp | 8 ++++++++ engines/fullpipe/gameloader.h | 3 +++ engines/fullpipe/modal.cpp | 34 ++++++++++++++++++++++++++++++++++ engines/fullpipe/modal.h | 5 +++-- engines/fullpipe/utils.h | 1 + 5 files changed, 49 insertions(+), 2 deletions(-) diff --git a/engines/fullpipe/gameloader.cpp b/engines/fullpipe/gameloader.cpp index d9f7327a6b..f60b8040ad 100644 --- a/engines/fullpipe/gameloader.cpp +++ b/engines/fullpipe/gameloader.cpp @@ -501,6 +501,14 @@ void GameLoader::updateSystems(int counterdiff) { } } +void GameLoader::readSavegame(const char *fname) { + warning("STUB: readSavegame(%s)", fname); +} + +void GameLoader::writeSavegame(Scene *sc, const char *fname) { + warning("STUB: writeSavegame(sc, %s)", fname); +} + Sc2::Sc2() { _sceneId = 0; _field_2 = 0; diff --git a/engines/fullpipe/gameloader.h b/engines/fullpipe/gameloader.h index a79c0e11b4..61a8b7aafc 100644 --- a/engines/fullpipe/gameloader.h +++ b/engines/fullpipe/gameloader.h @@ -89,6 +89,9 @@ class GameLoader : public CObject { void applyPicAniInfos(Scene *sc, PicAniInfo **picAniInfo, int picAniInfoCount); void saveScenePicAniInfos(int sceneId); + void readSavegame(const char *fname); + void writeSavegame(Scene *sc, const char *fname); + GameProject *_gameProject; InteractionController *_interactionController; InputController *_inputController; diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp index 39b021b38a..10d841e7df 100644 --- a/engines/fullpipe/modal.cpp +++ b/engines/fullpipe/modal.cpp @@ -1460,6 +1460,8 @@ ModalSaveGame::ModalSaveGame() { _rect = g_fp->_sceneRect; _queryDlg = 0; _mode = 1; + + _objtype = kObjTypeModalSaveGame; } ModalSaveGame::~ModalSaveGame() { @@ -1718,6 +1720,38 @@ void ModalSaveGame::processMouse(int x, int y) { _queryRes = 0; } +void ModalSaveGame::saveload() { + if (_objtype != kObjTypeModalSaveGame) + return; + + if (_mode) { + if (getSaveName()) { + bool allowed = true; + + for (Common::Array::iterator s = g_fp->_globalMessageQueueList->begin(); s != g_fp->_globalMessageQueueList->end(); ++s) { + if (!(*s)->_isFinished && ((*s)->getFlags() & 1)) + allowed = false; + } + + if (g_fp->_isSaveAllowed && allowed) + g_fp->_gameLoader->writeSavegame(g_fp->_currentScene, getSaveName()); + } + } else { + if (getSaveName()) { + if (_parentObj) { + delete _parentObj; + + _parentObj = 0; + } + + g_fp->stopAllSoundStreams(); + g_fp->stopSoundStream2(); + + g_fp->_gameLoader->readSavegame(getSaveName()); + } + } +} + void FullpipeEngine::openHelp() { if (!_modalObject) { ModalHelp *help = new ModalHelp; diff --git a/engines/fullpipe/modal.h b/engines/fullpipe/modal.h index 2c2295f775..0d73ddb595 100644 --- a/engines/fullpipe/modal.h +++ b/engines/fullpipe/modal.h @@ -46,9 +46,10 @@ class BaseModalObject { public: BaseModalObject *_parentObj; + ObjType _objtype; public: - BaseModalObject() : _parentObj(0) {} + BaseModalObject() : _parentObj(0) { _objtype = kObjTypeDefault; } virtual ~BaseModalObject() {} @@ -259,7 +260,7 @@ public: virtual bool handleMessage(ExCommand *message); virtual bool init(int counterdiff); virtual void update(); - virtual void saveload() {} + virtual void saveload(); void processMouse(int x, int y); diff --git a/engines/fullpipe/utils.h b/engines/fullpipe/utils.h index 72e746cd03..3e3ec0b2fc 100644 --- a/engines/fullpipe/utils.h +++ b/engines/fullpipe/utils.h @@ -68,6 +68,7 @@ enum ObjType { kObjTypeDefault, kObjTypeExCommand, kObjTypeExCommand2, + kObjTypeModalSaveGame, kObjTypeMovGraph, kObjTypeMovGraphLink, kObjTypeMovGraphNode, -- cgit v1.2.3 From c7d017e166e3dd486ed443bdaa6591a7655fd15f Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 1 May 2014 12:06:40 +0300 Subject: FULLPIPE: Implement ModalSaveGame::getFileInfo() and stubbed saveload support --- engines/fullpipe/detection.cpp | 64 +++++++++++++++++++++++++++++++++++++-- engines/fullpipe/fullpipe.h | 1 - engines/fullpipe/gameloader.cpp | 33 +++++++++++++++++++++ engines/fullpipe/gameloader.h | 11 +++++++ engines/fullpipe/modal.cpp | 66 ++++++++++++++++++++++++++++++++++------- engines/fullpipe/modal.h | 7 ++--- 6 files changed, 162 insertions(+), 20 deletions(-) diff --git a/engines/fullpipe/detection.cpp b/engines/fullpipe/detection.cpp index 62c5dd3b80..de0ed04d25 100644 --- a/engines/fullpipe/detection.cpp +++ b/engines/fullpipe/detection.cpp @@ -26,6 +26,7 @@ #include "common/file.h" #include "fullpipe/fullpipe.h" +#include "fullpipe/gameloader.h" namespace Fullpipe { @@ -87,15 +88,72 @@ public: } virtual bool hasFeature(MetaEngineFeature f) const; + virtual int getMaximumSaveSlot() const { return 8; } + virtual SaveStateList listSaves(const char *target) const; + virtual void removeSaveState(const char *target, int slot) const; + virtual SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const; virtual bool createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const; }; bool FullpipeMetaEngine::hasFeature(MetaEngineFeature f) const { - return false; + return + (f == kSupportsListSaves) || + (f == kSupportsDeleteSave) || + (f == kSavesSupportMetaInfo) || + (f == kSavesSupportThumbnail) || + (f == kSavesSupportCreationDate) || + (f == kSupportsLoadingDuringStartup); } -bool Fullpipe::FullpipeEngine::hasFeature(EngineFeature f) const { - return false; +SaveStateList FullpipeMetaEngine::listSaves(const char *target) const { + Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); + Common::StringArray filenames; + Common::String pattern("fullpipe.s??"); + + filenames = saveFileMan->listSavefiles(pattern); + sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..) + + SaveStateList saveList; + for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { + // Obtain the last 2 digits of the filename, since they correspond to the save slot + int slotNum = atoi(file->c_str() + file->size() - 2); + + if (slotNum >= 0 && slotNum <= getMaximumSaveSlot()) { + Common::InSaveFile *in = saveFileMan->openForLoading(*file); + if (in) { + Fullpipe::FullpipeSavegameHeader header; + Fullpipe::readSavegameHeader(in, header); + saveList.push_back(SaveStateDescriptor(slotNum, header.saveName)); + delete header.thumbnail; + delete in; + } + } + } + + return saveList; +} + +void FullpipeMetaEngine::removeSaveState(const char *target, int slot) const { + g_system->getSavefileManager()->removeSavefile(Fullpipe::getSavegameFile(slot)); +} + +SaveStateDescriptor FullpipeMetaEngine::querySaveMetaInfos(const char *target, int slot) const { + Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading( + Fullpipe::getSavegameFile(slot)); + + if (f) { + Fullpipe::FullpipeSavegameHeader header; + Fullpipe::readSavegameHeader(f, header); + delete f; + + // Create the return descriptor + SaveStateDescriptor desc(slot, header.saveName); + desc.setThumbnail(header.thumbnail); + + return desc; + } + + return SaveStateDescriptor(); } bool FullpipeMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const { diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h index 27505252ab..afdc493258 100644 --- a/engines/fullpipe/fullpipe.h +++ b/engines/fullpipe/fullpipe.h @@ -99,7 +99,6 @@ public: const ADGameDescription *_gameDescription; const char *getGameId() const; Common::Platform getPlatform() const; - bool hasFeature(EngineFeature f) const; Common::RandomSource *_rnd; diff --git a/engines/fullpipe/gameloader.cpp b/engines/fullpipe/gameloader.cpp index f60b8040ad..5c528c41f8 100644 --- a/engines/fullpipe/gameloader.cpp +++ b/engines/fullpipe/gameloader.cpp @@ -21,6 +21,7 @@ */ #include "fullpipe/fullpipe.h" +#include "graphics/thumbnail.h" #include "fullpipe/gameloader.h" #include "fullpipe/scene.h" @@ -601,6 +602,38 @@ bool PreloadItems::load(MfcArchive &file) { return true; } +const char *getSavegameFile(int saveGameIdx) { + static char buffer[20]; + sprintf(buffer, "fullpipe.s%02d", saveGameIdx); + return buffer; +} + +bool readSavegameHeader(Common::InSaveFile *in, FullpipeSavegameHeader &header) { + char saveIdentBuffer[6]; + header.thumbnail = NULL; + + // Validate the header Id + in->read(saveIdentBuffer, 6); + if (strcmp(saveIdentBuffer, "SVMCR")) + return false; + + header.version = in->readByte(); + if (header.version != FULLPIPE_SAVEGAME_VERSION) + return false; + + // Read in the string + header.saveName.clear(); + char ch; + while ((ch = (char)in->readByte()) != '\0') header.saveName += ch; + + // Get the thumbnail + header.thumbnail = Graphics::loadThumbnail(*in); + if (!header.thumbnail) + return false; + + return true; +} + GameVar *FullpipeEngine::getGameLoaderGameVar() { if (_gameLoader) return _gameLoader->_gameVar; diff --git a/engines/fullpipe/gameloader.h b/engines/fullpipe/gameloader.h index 61a8b7aafc..0796396549 100644 --- a/engines/fullpipe/gameloader.h +++ b/engines/fullpipe/gameloader.h @@ -29,6 +29,8 @@ namespace Fullpipe { +#define FULLPIPE_SAVEGAME_VERSION 1 + class SceneTag; class MctlCompound; class InputController; @@ -72,6 +74,12 @@ class PreloadItems : public Common::Array, public CObject { virtual bool load(MfcArchive &file); }; +struct FullpipeSavegameHeader { + uint8 version; + Common::String saveName; + Graphics::Surface *thumbnail; +}; + class GameLoader : public CObject { public: GameLoader(); @@ -111,6 +119,9 @@ class GameLoader : public CObject { int _preloadEntranceId; }; +const char *getSavegameFile(int saveGameIdx); +bool readSavegameHeader(Common::InSaveFile *in, FullpipeSavegameHeader &header); + Inventory2 *getGameLoaderInventory(); InteractionController *getGameLoaderInteractionController(); MctlCompound *getSc2MctlCompoundBySceneId(int16 sceneId); diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp index 10d841e7df..ca082e6f5d 100644 --- a/engines/fullpipe/modal.cpp +++ b/engines/fullpipe/modal.cpp @@ -34,6 +34,8 @@ #include "graphics/palette.h" #include "video/avi_decoder.h" +#include "engines/savestate.h" + namespace Fullpipe { ModalIntro::ModalIntro() { @@ -1593,9 +1595,9 @@ void ModalSaveGame::setup(Scene *sc, int mode) { fileinfo = new FileInfo; memset(fileinfo, 0, sizeof(FileInfo)); - snprintf(fileinfo->filename, 160, "save%02d.sav", i); + strncpy(fileinfo->filename, getSavegameFile(i), 160); - if (!getFileInfo(fileinfo->filename, fileinfo)) { + if (!getFileInfo(i, fileinfo)) { fileinfo->empty = true; w = _emptyD->getDimensions(&point)->x; } else { @@ -1625,10 +1627,52 @@ char *ModalSaveGame::getSaveName() { return _files[_queryRes]->filename; } -bool ModalSaveGame::getFileInfo(char *filename, FileInfo *fileinfo) { - warning("STUB: ModalSaveGame::getFileInfo()"); +bool ModalSaveGame::getFileInfo(int slot, FileInfo *fileinfo) { + Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading( + Fullpipe::getSavegameFile(slot)); - return false; + if (!f) + return false; + + Fullpipe::FullpipeSavegameHeader header; + Fullpipe::readSavegameHeader(f, header); + delete f; + + // Create the return descriptor + SaveStateDescriptor desc(slot, header.saveName); + char res[17]; + + snprintf(res, 17, "%s %s", desc.getSaveDate().c_str(), desc.getSaveTime().c_str()); + + for (int i = 0; i < 16; i++) { + switch(res[i]) { + case '.': + fileinfo->date[i] = 11; + break; + case ' ': + fileinfo->date[i] = 12; + break; + case ':': + fileinfo->date[i] = 10; + break; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + fileinfo->date[i] = res[i] - '0'; + break; + default: + error("Incorrect date format: %s", res); + } + } + + return true; } void ModalSaveGame::update() { @@ -1659,10 +1703,10 @@ void ModalSaveGame::update() { int x = _files[i]->fx1; for (int j = 0; j < 16; j++) { - _arrayL[j + _files[i]->day]->setOXY(x + 1, _files[i]->fy1); - _arrayL[j + _files[i]->day]->draw(); + _arrayL[_files[i]->date[j]]->setOXY(x + 1, _files[i]->fy1); + _arrayL[_files[i]->date[j]]->draw(); - x += _arrayL[j + _files[i]->day]->getDimensions(&point)->x + 2; + x += _arrayL[_files[i]->date[j]]->getDimensions(&point)->x + 2; } } } else { @@ -1673,10 +1717,10 @@ void ModalSaveGame::update() { int x = _files[i]->fx1; for (int j = 0; j < 16; j++) { - _arrayD[j + _files[i]->day]->setOXY(x + 1, _files[i]->fy1); - _arrayD[j + _files[i]->day]->draw(); + _arrayD[_files[i]->date[j]]->setOXY(x + 1, _files[i]->fy1); + _arrayD[_files[i]->date[j]]->draw(); - x += _arrayD[j + _files[i]->day]->getDimensions(&point)->x + 2; + x += _arrayD[_files[i]->date[j]]->getDimensions(&point)->x + 2; } } } diff --git a/engines/fullpipe/modal.h b/engines/fullpipe/modal.h index 0d73ddb595..01d8e6b0ee 100644 --- a/engines/fullpipe/modal.h +++ b/engines/fullpipe/modal.h @@ -32,10 +32,7 @@ class Sound; struct FileInfo { char filename[260]; bool empty; - int day; - int month; - int year; - int time; + char date[16]; int fx1; int fx2; int fy1; @@ -269,7 +266,7 @@ public: void processKey(int key); char *getSaveName(); - bool getFileInfo(char *filename, FileInfo *fileinfo); + bool getFileInfo(int slot, FileInfo *fileinfo); Common::Rect _rect; int _oldBgX; -- cgit v1.2.3 From b031373ba7fe7515311e1c7528e566ecbe4668cc Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 1 May 2014 12:18:18 +0300 Subject: FULLPIPE: Implement MctlCompound::removeObject() --- engines/fullpipe/motion.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 35da154570..d8fa24cbc1 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -125,9 +125,10 @@ void MctlCompound::addObject(StaticANIObject *obj) { } int MctlCompound::removeObject(StaticANIObject *obj) { - warning("STUB: MctlCompound::removeObject()"); + for (uint i = 0; i < _motionControllers.size(); i++) + _motionControllers[i]->_motionControllerObj->removeObject(obj); - return 0; + return 1; } void MctlCompound::initMovGraph2() { -- cgit v1.2.3 From f18ad22d22cd220a1f1f8ed46d279fc45402b2ff Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 1 May 2014 12:28:17 +0300 Subject: FULLPIPE: Implement MctlCompound::replaceNodeX() --- engines/fullpipe/motion.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index d8fa24cbc1..84f09efbeb 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -435,7 +435,20 @@ MctlConnectionPoint *MctlCompound::findClosestConnectionPoint(int ox, int oy, in } void MctlCompound::replaceNodeX(int from, int to) { - warning("STUB: MctlCompound::replaceNodeX()"); + for (uint i = 0; i < _motionControllers.size(); i++) { + if (_motionControllers[i]->_motionControllerObj->_objtype == kObjTypeMovGraph) { + MovGraph *gr = (MovGraph *)_motionControllers[i]->_motionControllerObj; + + for (ObList::iterator n = gr->_nodes.begin(); n != gr->_nodes.end(); ++n) { + MovGraphNode *node = (MovGraphNode *)*n; + + if (node->_x == from) + node->_x = to; + } + + gr->calcNodeDistancesAndAngles(); + } + } } MctlConnectionPoint::MctlConnectionPoint() { -- cgit v1.2.3 From 0da6934b701e6b9fd278128ab441a215f4413c25 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 1 May 2014 12:14:44 +0200 Subject: MADS: Implement scene 405 --- engines/mads/nebular/nebular_scenes.cpp | 4 +- engines/mads/nebular/nebular_scenes4.cpp | 171 ++++++++++++++++++++++++++++++- engines/mads/nebular/nebular_scenes4.h | 12 +++ 3 files changed, 182 insertions(+), 5 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index d5114133d9..6422b6f9e8 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -172,10 +172,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene401(vm); case 402: return new Scene402(vm); - case 403: - // TODO case 405: - // TODO + return new Scene405(vm); case 406: // TODO case 407: diff --git a/engines/mads/nebular/nebular_scenes4.cpp b/engines/mads/nebular/nebular_scenes4.cpp index aec1bf45d2..d1c5acac2c 100644 --- a/engines/mads/nebular/nebular_scenes4.cpp +++ b/engines/mads/nebular/nebular_scenes4.cpp @@ -130,7 +130,7 @@ void Scene401::step() { _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; _game._player._stepEnabled = true; _game._player._visible = true; - _northFl = false; + _northFl = false; _game._player.walk(Common::Point(149, 110), FACING_SOUTH); } @@ -2004,7 +2004,7 @@ void Scene402::actions() { else if (_action.isAction(0x242, 0x2B3)) _scene->_nextSceneId = 401; else if (_action.isAction(0x2B5, 0x248)) - ; // just... nothing + ; // just... nothing else if (_action.isAction(VERB_TALKTO, 0x3AA)) { switch (_game._trigger) { case 0: { @@ -2303,5 +2303,172 @@ void Scene402::actions() { /*------------------------------------------------------------------------*/ +void Scene405::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene405::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 0)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 1)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites("*ROXCL_8"); + + if (_scene->_priorSceneId == 401) { + _game._player._playerPos = Common::Point(23, 123); + _game._player._facing = FACING_EAST; + } else if (_scene->_priorSceneId == 406) { + _game._player._playerPos = Common::Point(300, 128); + _game._player._facing = FACING_WEST; + } else if (_scene->_priorSceneId == 408) { + _game._player._playerPos = Common::Point(154, 109); + _game._player._facing = FACING_SOUTH; + } else if (_scene->_priorSceneId == 413) { + _game._player._playerPos = Common::Point(284, 109); + _game._player._facing = FACING_SOUTH; + } else if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(23, 123); + _game._player._facing = FACING_EAST; + } + + if (_globals[kArmoryDoorOpen]) + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 1); + else + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); + + if (_scene->_roomChanged) { + _globals[kArmoryDoorOpen] = false; + _game._objects.addToInventory(OBJ_SECURITY_CARD); + } + + _game.loadQuoteSet(0x24F, 0); + sceneEntrySound(); +} + +void Scene405::step() { + if (_game._trigger == 80) { + _scene->_sequences.addTimer (20, 81); + _game._player._priorTimer = _scene->_frameStartTime + _game._player._ticksAmount; + _game._player._visible = true; + } + + if (_game._trigger == 81) { + _game._player._stepEnabled = true; + _vm->_dialogs->show(40525); + } + + if (_game._trigger == 70) { + _game._player._priorTimer = _scene->_frameStartTime + _game._player._ticksAmount ; + _game._player._visible = true; + _globals._sequenceIndexes[1] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 6, 1, 0, 0); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 71); + _vm->_sound->command(19); + } + + if (_game._trigger == 71) { + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); + _globals[kArmoryDoorOpen] = false; + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _game._player._stepEnabled = true; + } + + if (_game._trigger == 75) { + _game._player._priorTimer = _scene->_frameStartTime + _game._player._ticksAmount ; + _game._player._visible = true; + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle (_globals._spriteIndexes[1], false, 6, 1, 0, 0); + _globals[kArmoryDoorOpen] = true; + _game._player._stepEnabled = true; + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle (_globals._spriteIndexes[2], + false, 1); + _vm->_sound->command(19); + } +} + +void Scene405::preActions() { + if (_action.isAction(VERB_TAKE)) + _game._player._needToWalk = false; + + if (_action.isAction(0x1AD, 0x2BA)) + _game._player._walkOffScreenSceneId = 401; + + if (_action.isAction(0x1AD, 0x2B9)) + _game._player._walkOffScreenSceneId = 406; + + if (_action.isAction(VERB_CLOSE, 0x259) && _globals[kArmoryDoorOpen]) + _game._player.walk(Common::Point(212, 113), FACING_NORTH); +} + +void Scene405::actions() { + if (_action.isAction(0x18B, 0x6E)) + _scene->_nextSceneId = 413; + else if (_action.isAction(0x18B, 0x259) && _globals[kArmoryDoorOpen]) + _scene->_nextSceneId = 408; + else if (_action.isAction(0x18B, 0x259) && !_globals[kArmoryDoorOpen]) + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 60, _game.getQuote(0x24F)); + else if (_action.isAction(VERB_PUT, 0x131, 0x251) && !_globals[kArmoryDoorOpen]) { + _game._player._stepEnabled = false; + _game._player._visible = false; + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 7, 2, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 75); + Common::Point msgPos = Common::Point(_game._player._playerPos.x, _game._player._playerPos.y + 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[3], msgPos); + _scene->_sequences.setScale(_globals._sequenceIndexes[3], 87); + } else if ((_action.isAction(VERB_PUT, 0x131, 0x251) || _action.isAction(VERB_CLOSE, 0x259)) && _globals[kArmoryDoorOpen]) { + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 7, 2, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 70); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[3], _game._player._playerPos); + _scene->_sequences.setScale(_globals._sequenceIndexes[3], 87); + } else if (_action.isAction(VERB_PUT, 0x251)) { + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 7, 2, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 80); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[3], _game._player._playerPos); + _scene->_sequences.setScale(_globals._sequenceIndexes[3], 87); + } else if (_action.isAction(VERB_LOOK, 0x31A)) + _vm->_dialogs->show(40510); + else if (_action.isAction(VERB_TAKE, 0x31A)) + _vm->_dialogs->show(40511); + else if (_action.isAction(VERB_LOOK, 0x254)) + _vm->_dialogs->show(40512); + else if (_action.isAction(VERB_LOOK, 0x258) || _action.isAction(VERB_LOOK, 0x252)) + _vm->_dialogs->show(40513); + else if (_action.isAction(VERB_LOOK, 0xCD)) + _vm->_dialogs->show(40514); + else if (_action.isAction(VERB_LOOK, 0x251)) + _vm->_dialogs->show(40515); + else if (_action.isAction(VERB_LOOK, 0x2B9)) + _vm->_dialogs->show(40516); + else if (_action.isAction(VERB_LOOK, 0x2BA)) + _vm->_dialogs->show(40517); + else if (_action.isAction(VERB_LOOK, 0xE2)) + _vm->_dialogs->show(40518); + else if (_action.isAction(VERB_LOOK, 0x204) || _action._lookFlag) + _vm->_dialogs->show(40519); + else if (_action.isAction(VERB_LOOK, 0x259)) { + if (_globals[kArmoryDoorOpen]) + _vm->_dialogs->show(40521); + else + _vm->_dialogs->show(40520); + } else if (_action.isAction(VERB_LOOK, 0x6E)) + _vm->_dialogs->show(40522); + else if (_action.isAction(VERB_LOOK, 0x250)) + _vm->_dialogs->show(40523); + else if (_action.isAction(VERB_LOOK, 0x257)) + _vm->_dialogs->show(40524); + else + return; + + _action._inProgress = false; +} + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes4.h b/engines/mads/nebular/nebular_scenes4.h index 4293408426..38803fe00f 100644 --- a/engines/mads/nebular/nebular_scenes4.h +++ b/engines/mads/nebular/nebular_scenes4.h @@ -128,6 +128,18 @@ public: virtual void postActions() {}; }; +class Scene405: public Scene4xx { +public: + Scene405(MADSEngine *vm) : Scene4xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 8fc73ea0c541391ce7352d7cd0aba0ff320405a7 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 1 May 2014 14:21:18 +0300 Subject: FULLPIPE: Implement MovGraphLink::~MovGraphLink() --- engines/fullpipe/motion.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 84f09efbeb..54854e3043 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -2542,7 +2542,10 @@ MovGraphLink::MovGraphLink() { } MovGraphLink::~MovGraphLink() { - warning("STUB: MovGraphLink::~MovGraphLink()"); + delete _movGraphReact; + + _dwordArray1.clear(); + _dwordArray2.clear(); } -- cgit v1.2.3 From 57bf0673d70311da7b2bddda91f4a0566c51c340 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 1 May 2014 09:16:48 -0400 Subject: MADS: Default game to impossible difficulty by default --- engines/mads/game.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 2c2f6366a4..1435681612 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -59,7 +59,7 @@ Game *Game::init(MADSEngine *vm) { Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm), _scene(vm), _screenObjects(vm), _player(vm) { _sectionNumber = _priorSectionNumber = 0; - _difficulty = DIFFICULTY_HARD; + _difficulty = DIFFICULTY_IMPOSSIBLE; _loadGameSlot = -1; _saveFile = nullptr; _statusFlag = 0; -- cgit v1.2.3 From 88cf2c7caab3ce74460a980640b9fe832f4fba5f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 1 May 2014 09:17:10 -0400 Subject: MADS: Fix actions being triggered at the end of animation sequences --- engines/mads/animation.cpp | 8 ++++---- engines/mads/animation.h | 2 +- engines/mads/scene.cpp | 4 ++-- engines/mads/scene.h | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index 874ce69301..bfcbe16e28 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -318,7 +318,7 @@ void Animation::preLoad(const Common::String &resName, int level) { // doesn't need to be preloaded } -void Animation::startAnimation(int abortTimers) { +void Animation::startAnimation(int endTrigger) { _messageCtr = 0; _skipLoad = true; @@ -338,9 +338,9 @@ void Animation::startAnimation(int abortTimers) { _currentFrame = 0; _oldFrameEntry = 0; _nextFrameTimer = _vm->_game->_scene._frameStartTime; - _trigger = abortTimers; + _trigger = endTrigger; _triggerMode = _vm->_game->_triggerSetupMode; - _vm->_game->_scene._action._activeAction = _actionDetails; + _actionDetails = _vm->_game->_scene._action._activeAction; for (int idx = 0; idx < _header._messagesCount; ++idx) { _messages[idx]._kernelMsgIndex = -1; @@ -559,7 +559,7 @@ void Animation::update() { if (_triggerMode != SEQUENCE_TRIGGER_DAEMON) { // Copy the noun list - scene._action._action = _actionDetails; + scene._action._activeAction = _actionDetails; } } } diff --git a/engines/mads/animation.h b/engines/mads/animation.h index 894fbaecb2..aab1743b42 100644 --- a/engines/mads/animation.h +++ b/engines/mads/animation.h @@ -202,7 +202,7 @@ public: /** * Setups up a loaded animation for playback */ - void startAnimation(int abortTimers); + void startAnimation(int endTrigger); /** * Update the animation diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index f4b2cb1ec8..5c86e4590e 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -594,7 +594,7 @@ void Scene::checkKeyboard() { } } -void Scene::loadAnimation(const Common::String &resName, int abortTimers) { +void Scene::loadAnimation(const Common::String &resName, int trigger) { assert(_activeAnimation == nullptr); MSurface depthSurface; UserInterface interfaceSurface(_vm); @@ -602,7 +602,7 @@ void Scene::loadAnimation(const Common::String &resName, int abortTimers) { _activeAnimation = Animation::init(_vm, this); _activeAnimation->load(interfaceSurface, depthSurface, resName, _vm->_dithering ? ANIMFLAG_DITHER : 0, nullptr, nullptr); - _activeAnimation->startAnimation(abortTimers); + _activeAnimation->startAnimation(trigger); } void Scene::updateCursor() { diff --git a/engines/mads/scene.h b/engines/mads/scene.h index 48b01b2acb..3661bd6502 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -204,7 +204,7 @@ public: /** * Load an animation */ - void loadAnimation(const Common::String &resName, int abortTimers = 0); + void loadAnimation(const Common::String &resName, int trigger = 0); /** * Returns a vocab entry -- cgit v1.2.3 From 1ed814259972ac5ea75087e62f8bf9289f2d9f35 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 1 May 2014 15:29:43 +0200 Subject: MADS: Add scene 406 --- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes4.cpp | 209 ++++++++++++++++++++++++++++++- engines/mads/nebular/nebular_scenes4.h | 15 +++ 3 files changed, 224 insertions(+), 2 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 6422b6f9e8..edee1d9d8e 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -175,7 +175,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 405: return new Scene405(vm); case 406: - // TODO + return new Scene406(vm); case 407: // TODO case 408: diff --git a/engines/mads/nebular/nebular_scenes4.cpp b/engines/mads/nebular/nebular_scenes4.cpp index d1c5acac2c..f6f3b418bb 100644 --- a/engines/mads/nebular/nebular_scenes4.cpp +++ b/engines/mads/nebular/nebular_scenes4.cpp @@ -2346,7 +2346,7 @@ void Scene405::enter() { void Scene405::step() { if (_game._trigger == 80) { - _scene->_sequences.addTimer (20, 81); + _scene->_sequences.addTimer(20, 81); _game._player._priorTimer = _scene->_frameStartTime + _game._player._ticksAmount; _game._player._visible = true; } @@ -2470,5 +2470,212 @@ void Scene405::actions() { _action._inProgress = false; } +/*------------------------------------------------------------------------*/ + +void Scene406::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene406::enter() { + _game._player._visible = true; + if (_scene->_priorSceneId == 405) { + _game._player._playerPos = Common::Point(15, 129); + _game._player._facing = FACING_EAST; + } else if (_scene->_priorSceneId == 407) { + _game._player._playerPos = Common::Point(270, 127); + _game._player._facing = FACING_WEST; + } else if (_scene->_priorSceneId == 410) { + _game._player._playerPos = Common::Point(30, 108); + _game._player._facing = FACING_SOUTH; + } else if (_scene->_priorSceneId == 411) { + _game._player._playerPos = Common::Point(153, 108); + _game._player._facing = FACING_SOUTH; + } else if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(15, 129); + _game._player._facing = FACING_EAST; + } + + _globals._spriteIndexes[2] = _scene->_sprites.addSprites("*ROXCL_8"); + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 0)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 1)); + + if (_scene->_roomChanged) { + _globals[kStorageDoorOpen] = false; + _game._objects.addToInventory(OBJ_SECURITY_CARD); + } + + if (!_globals[kStorageDoorOpen]) + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); + + if (_scene->_priorSceneId != 411) + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); + else { + _game._player._stepEnabled = false; + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 3, 1, 0, 0); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 90); + _vm->_sound->command(19); + } + + _game.loadQuoteSet(0x24F, 0); + _hitStorageDoor = false; + sceneEntrySound(); +} + +void Scene406::step() { + if (_game._trigger == 90) { + _game._player._stepEnabled = true; + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); + } + + if (_game._trigger == 80) + _scene->_nextSceneId = 411; + + if (_game._trigger == 100) { + _vm->_dialogs->show(40622); + _hitStorageDoor = true; + } + + if (_game._trigger == 110) { + _scene->_sequences.addTimer(20, 111); + _game._player._priorTimer = _scene->_frameStartTime + _game._player._ticksAmount; + _game._player._visible = true; + } + + if (_game._trigger == 111) { + _game._player._stepEnabled = true; + _vm->_dialogs->show(40613); + } + + if (_game._trigger == 70) { + _game._player._priorTimer = _scene->_frameStartTime + _game._player._ticksAmount; + _game._player._visible = true; + _globals._sequenceIndexes[1] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 4, 1, 0, 0); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 71); + _vm->_sound->command(19); + } + + if (_game._trigger == 71) { + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); + _globals[kStorageDoorOpen] = false; + _game._player._stepEnabled = true; + } + + if (_game._trigger == 75) { + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle (_globals._spriteIndexes[1], false, 4, 1, 0, 0); + _globals[kStorageDoorOpen] = true; + _game._player._stepEnabled = true; + _game._player._priorTimer = _scene->_frameStartTime + _game._player._ticksAmount; + _game._player._visible = true; + _vm->_sound->command(19); + } +} + +void Scene406::preActions() { + if (_action.isAction(0x1AD, 0x2BA)) + _game._player._walkOffScreenSceneId = 405; + + if (_action.isAction(0x1AD, 0x2B9)) + _game._player._walkOffScreenSceneId = 407; + + if (_action.isAction(VERB_TAKE)) + _game._player._needToWalk = false; + + if (_action.isAction(VERB_LOOK, 0x244) || _action.isAction(VERB_LOOK, 0x25C)) + _game._player._needToWalk = true; +} + +void Scene406::actions() { + if (_action.isAction(0x18B, 0x6E) && (_game._player._targetPos.x> 100)) { + _game._player._stepEnabled = false; + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle (_globals._spriteIndexes[3], false, 3, 1, 0, 0); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 80); + _vm->_sound->command(19); + } else if (_action.isAction(0x18B, 0x6E) && _globals[kStorageDoorOpen] && (_game._player._targetPos.x < 100)) + _scene->_nextSceneId = 410; + else if (_action.isAction(0x18B, 0x6E) && !_globals[kStorageDoorOpen] && (_game._player._targetPos.x < 100)) { + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 60, _game.getQuote(0x24F)); + if (!_hitStorageDoor) { + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addTimer(80, 100); + } + } else if (_action.isAction(VERB_PUT, 0x131, 0x251) && !_globals[kStorageDoorOpen]) { + _game._player._stepEnabled = false; + _game._player._visible = false; + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 7, 2, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 75); + Common::Point msgPos = Common::Point(_game._player._playerPos.x, _game._player._playerPos.y + 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], msgPos); + _scene->_sequences.setScale(_globals._sequenceIndexes[2], 87); + } else if (_action.isAction(VERB_PUT, 0x131, 0x251) && _globals[kStorageDoorOpen]) { + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 7, 2, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 70); + Common::Point msgPos = Common::Point(_game._player._playerPos.x, _game._player._playerPos.y + 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], msgPos); + _scene->_sequences.setScale(_globals._sequenceIndexes[2], 87); + } else if (_action.isAction(VERB_PUT, 0x251)) { + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 7, 2, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 110); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], _game._player._playerPos); + _scene->_sequences.setScale(_globals._sequenceIndexes[2], 87); + } else if (_action.isAction(VERB_LOOK, 0x25C)) + _vm->_dialogs->show(40610); + else if (_action.isAction(VERB_TAKE, 0x25C)) + _vm->_dialogs->show(40611); + else if (_action.isAction(VERB_LOOK, 0x251)) + _vm->_dialogs->show(40612); + else if (_action.isAction(VERB_LOOK, 0x25B)) + _vm->_dialogs->show(40614); + else if (_action.isAction(VERB_TAKE, 0x25B)) + _vm->_dialogs->show(40615); + else if (_action.isAction(VERB_LOOK, 0x2B9)) + _vm->_dialogs->show(40616); + else if (_action.isAction(VERB_LOOK, 0x2BA)) + _vm->_dialogs->show(40617); + else if (_action.isAction(VERB_LOOK, 0x204) || _action._lookFlag) + _vm->_dialogs->show(40618); + else if (_action.isAction(VERB_LOOK, 0x18D)) + _vm->_dialogs->show(40619); + else if (_action.isAction(VERB_LOOK, 0x6E)) { + if (_globals[kStorageDoorOpen]) + _vm->_dialogs->show(40621); + else + _vm->_dialogs->show(40620); + } else if (_action.isAction(VERB_LOOK, 0xE2)) + _vm->_dialogs->show(40623); + else if (_action.isAction(VERB_LOOK, 0x47A)) + _vm->_dialogs->show(40624); + else if (_action.isAction(VERB_TAKE, 0x47A)) + _vm->_dialogs->show(40625); + else if (_action.isAction(VERB_LOOK, 0x2F)) + _vm->_dialogs->show(40626); + else if (_action.isAction(VERB_TAKE, 0x2F)) + _vm->_dialogs->show(40627); + else if (_action.isAction(VERB_LOOK, 0x244)) + _vm->_dialogs->show(40628); + else if (_action.isAction(VERB_TAKE, 0x244)) + _vm->_dialogs->show(40629); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes4.h b/engines/mads/nebular/nebular_scenes4.h index 38803fe00f..02115d7d81 100644 --- a/engines/mads/nebular/nebular_scenes4.h +++ b/engines/mads/nebular/nebular_scenes4.h @@ -140,6 +140,21 @@ public: virtual void postActions() {}; }; +class Scene406: public Scene4xx { +private: + bool _hitStorageDoor; + +public: + Scene406(MADSEngine *vm) : Scene4xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 0350cc79b3db9eb3e35314730f6e067bc6693c82 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 1 May 2014 18:20:10 +0200 Subject: MADS: Implement scene 407 --- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes4.cpp | 108 +++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes4.h | 15 +++++ 3 files changed, 124 insertions(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index edee1d9d8e..e25f39cfd2 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -177,7 +177,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 406: return new Scene406(vm); case 407: - // TODO + return new Scene407(vm); case 408: // TODO case 409: diff --git a/engines/mads/nebular/nebular_scenes4.cpp b/engines/mads/nebular/nebular_scenes4.cpp index f6f3b418bb..1335bd609f 100644 --- a/engines/mads/nebular/nebular_scenes4.cpp +++ b/engines/mads/nebular/nebular_scenes4.cpp @@ -2677,5 +2677,113 @@ void Scene406::actions() { /*------------------------------------------------------------------------*/ +void Scene407::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene407::enter() { + if (_scene->_priorSceneId != -2) + _fromNorth = false; + + if (_scene->_priorSceneId == 318) { + _game._player._playerPos = Common::Point(172, 92); + _game._player._facing = FACING_SOUTH; + _fromNorth = true; + } else if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(172, 132); + _game._player._facing = FACING_NORTH; + } + + _game.loadQuoteSet(0x250, 0); + sceneEntrySound(); +} + +void Scene407::step() { + if (_game._trigger == 70) { + _scene->_nextSceneId = 318; + _scene->_reloadSceneFlag = true; + } + + if (_game._trigger == 80) { + _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; + _game._player._stepEnabled = true; + _game._player._visible = true; + _fromNorth = false; + _game._player.walk(Common::Point(173, 104), FACING_SOUTH); + } +} + +void Scene407::preActions() { + if (_action.isAction(VERB_TAKE)) + _game._player._needToWalk = false; + + if (_action.isAction(VERB_LOOK, 0x6E)) + _game._player._needToWalk = true; + + if (_action.isAction(0x1AD, 0x2B4)) { + _game._player.walk(Common::Point(172, 91), FACING_NORTH); + _fromNorth = false; + } + + if (_game._player._needToWalk && _fromNorth) { + if (_globals[kSexOfRex] == REX_MALE) + destPos = Common::Point(171, 95); + else + destPos = Common::Point(173, 96); + + _game._player.walk(destPos, FACING_SOUTH); + } +} + +void Scene407::actions() { + if ((_game._player._playerPos == destPos) && _fromNorth) { + if (_globals[kSexOfRex] == REX_MALE) { + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _game._player._stepEnabled = false; + _game._player._visible = false; + _vm->_sound->command(21); + _scene->loadAnimation(formAnimName('s', 1), 70); + _globals[kHasBeenScanned] = true; + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 60, _game.getQuote(60)); + _vm->_sound->command(22); + } + + if (_globals[kSexOfRex] == REX_FEMALE) { + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _game._player._stepEnabled = false; + _game._player._visible = false; + _vm->_sound->command(21); + _scene->loadAnimation(formAnimName('s', 2), 80); + _vm->_sound->command(23); + _globals[kHasBeenScanned] = true; + } + } + + if (_action.isAction(0x1AD, 0x2B3) && !_fromNorth) + _scene->_nextSceneId = 406; + else if (_action.isAction(0x1AD, 0x2B4)) + _scene->_nextSceneId = 318; + else if (_action.isAction(VERB_LOOK, 0x1F3)) { + if (_globals[kHasBeenScanned]) + _vm->_dialogs->show(40711); + else + _vm->_dialogs->show(40710); + } else if (_action.isAction(VERB_LOOK, 0x6E)) + _vm->_dialogs->show(40712); + else if (_action.isAction(VERB_LOOK, 0x2B3)) + _vm->_dialogs->show(40713); + else if (_action.isAction(VERB_LOOK, 0x2B4)) + _vm->_dialogs->show(40714); + else if (_action._lookFlag) + _vm->_dialogs->show(40715); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes4.h b/engines/mads/nebular/nebular_scenes4.h index 02115d7d81..e105547740 100644 --- a/engines/mads/nebular/nebular_scenes4.h +++ b/engines/mads/nebular/nebular_scenes4.h @@ -155,6 +155,21 @@ public: virtual void postActions() {}; }; +class Scene407: public Scene4xx { +private: + bool _fromNorth; + Common::Point destPos; + +public: + Scene407(MADSEngine *vm) : Scene4xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From b9a1b5376188c2e75d6aa2dba0fceba17fe3b2a6 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 1 May 2014 19:15:28 +0200 Subject: MADS: Implement scene 408 --- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes4.cpp | 154 +++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes4.h | 12 +++ 3 files changed, 167 insertions(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index e25f39cfd2..ab1256ada5 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -179,7 +179,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 407: return new Scene407(vm); case 408: - // TODO + return new Scene408(vm); case 409: // TODO case 410: diff --git a/engines/mads/nebular/nebular_scenes4.cpp b/engines/mads/nebular/nebular_scenes4.cpp index 1335bd609f..9b0c5affbb 100644 --- a/engines/mads/nebular/nebular_scenes4.cpp +++ b/engines/mads/nebular/nebular_scenes4.cpp @@ -2785,5 +2785,159 @@ void Scene407::actions() { /*------------------------------------------------------------------------*/ +void Scene408::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(0x167); + _scene->addActiveVocab(0xD); +} + +void Scene408::enter() { + _game._player._playerPos = Common::Point(137, 150); + _game._player._facing = FACING_NORTH; + + _globals._spriteIndexes[1] = _scene->_sprites.addSprites("*ROXRC_7"); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('m', -1)); + + if (_game._objects.isInRoom(OBJ_TARGET_MODULE)) { + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 3); + int idx = _scene->_dynamicHotspots.add(0x167, 0xD, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(283, 128), FACING_NORTHEAST); + } + sceneEntrySound(); +} + +void Scene408::preActions() { + if ((_action.isAction(VERB_TAKE) && !_action.isAction(0x167)) || _action.isAction(VERB_PULL, 0x47B) || _action.isAction(VERB_OPEN, 0x265)) + _game._player._needToWalk = false; + + if ((_action.isAction(VERB_LOOK, 0x167) && _game._objects.isInRoom(0x17)) || _action.isAction(VERB_LOOK, 0x263)) + _game._player._needToWalk = true; +} + +void Scene408::actions() { + if (_action.isAction(0x242, 0x2B3)) { + _scene->_nextSceneId = 405; + _vm->_sound->command(58); + } else if (_action.isAction(VERB_TAKE, 0x167) && (_game._objects.isInRoom(OBJ_TARGET_MODULE) || _game._trigger)) { + switch (_game._trigger) { + case (0): + _vm->_sound->command(57); + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[1] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], true, 7, 2, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 1, 2); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[1]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_SPRITE, 2, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + + case 1: + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _game._objects.addToInventory(OBJ_TARGET_MODULE); + _vm->_dialogs->showItem(OBJ_TARGET_MODULE, 40847); + break; + + case 2: + _game._player._priorTimer = _game._player._ticksAmount + _scene->_frameStartTime; + _game._player._visible = true; + _scene->_sequences.addTimer(20, 3); + break; + + case 3: + _game._player._stepEnabled = true; + break; + + default: + break; + } + } else if (_action.isAction(VERB_LOOK, 0x2BC)) + _vm->_dialogs->show(40810); + else if (_action.isAction(VERB_TAKE, 0x2BC) || _action.isAction(VERB_TAKE, 0x261) || _action.isAction(VERB_TAKE, 0x25F)) + _vm->_dialogs->show(40811); + else if (_action.isAction(VERB_LOOK, 0x2BE)) + _vm->_dialogs->show(40812); + else if (_action.isAction(VERB_TAKE, 0x2BE)) + _vm->_dialogs->show(40813); + else if (_action.isAction(VERB_LOOK, 0x2C2)) + _vm->_dialogs->show(40814); + else if (_action.isAction(VERB_TAKE, 0x2C2)) + _vm->_dialogs->show(40815); + else if (_action.isAction(VERB_TAKE, 0x47B) || _action.isAction(VERB_PULL, 0x47B)) + _vm->_dialogs->show(40816); + else if (_action.isAction(VERB_LOOK, 0x26D)) + _vm->_dialogs->show(40817); + else if (_action.isAction(VERB_TAKE, 0x26D)) + _vm->_dialogs->show(40818); + else if (_action.isAction(VERB_LOOK, 0x2BB)) + _vm->_dialogs->show(40819); + else if (_action.isAction(VERB_TAKE, 0x2BB)) + _vm->_dialogs->show(40820); + else if (_action.isAction(VERB_LOOK, 0x269)) + _vm->_dialogs->show(40821); + else if (_action.isAction(VERB_TAKE, 0x269)) + _vm->_dialogs->show(40822); + else if (_action.isAction(VERB_LOOK, 0x263)) { + if (_game._objects.isInRoom(OBJ_TARGET_MODULE)) + _vm->_dialogs->show(40823); + else + _vm->_dialogs->show(40824); + } else if (_action.isAction(VERB_TAKE, 0x263)) + _vm->_dialogs->show(40825); + else if (_action.isAction(VERB_LOOK, 0x2BF)) + _vm->_dialogs->show(40826); + else if (_action.isAction(VERB_TAKE, 0x2BF)) + _vm->_dialogs->show(40827); + else if (_action.isAction(VERB_LOOK, 0x7B)) + _vm->_dialogs->show(40828); + else if (_action.isAction(VERB_OPEN, 0x7B) || _action.isAction(VERB_PULL, 0x7B)) + _vm->_dialogs->show(40829); + else if (_action.isAction(VERB_LOOK, 0x26B)) + _vm->_dialogs->show(40830); + else if (_action.isAction(VERB_TAKE, 0x26B)) + _vm->_dialogs->show(40831); + else if (_action.isAction(VERB_LOOK, 0x2C1)) + _vm->_dialogs->show(40832); + else if (_action.isAction(VERB_TAKE, 0x2C1)) + _vm->_dialogs->show(40833); + else if (_action.isAction(VERB_LOOK, 0x2BD)) + _vm->_dialogs->show(40834); + else if (_action.isAction(VERB_TAKE, 0x2BD)) + _vm->_dialogs->show(40835); + else if (_action.isAction(VERB_LOOK, 0x261)) + _vm->_dialogs->show(40836); + else if (_action.isAction(VERB_LOOK, 0x25F)) + _vm->_dialogs->show(40837); + else if (_action.isAction(VERB_LOOK, 0x2C0)) + _vm->_dialogs->show(40838); + else if (_action.isAction(VERB_LOOK, 0x47C)) + _vm->_dialogs->show(40839); + else if (_action.isAction(VERB_TAKE, 0x47C)) + _vm->_dialogs->show(40840); + else if (_action.isAction(VERB_LOOK, 0x265)) + _vm->_dialogs->show(40841); + else if (_action.isAction(VERB_TAKE, 0x265)) + _vm->_dialogs->show(40842); + else if (_action.isAction(VERB_OPEN, 0x265)) + _vm->_dialogs->show(40843); + else if (_action.isAction(VERB_LOOK, 0x2B3)) + _vm->_dialogs->show(40844); + else if (_action._lookFlag) + _vm->_dialogs->show(40845); + else if (_action.isAction(VERB_LOOK, 0x167) && _game._objects.isInRoom(OBJ_TARGET_MODULE)) + _vm->_dialogs->show(40846); + else if (_action.isAction(VERB_LOOK, 0x26C)) + _vm->_dialogs->show(40848); + else if (_action.isAction(VERB_OPEN, 0x263)) + _vm->_dialogs->show(40849); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes4.h b/engines/mads/nebular/nebular_scenes4.h index e105547740..77d34d760c 100644 --- a/engines/mads/nebular/nebular_scenes4.h +++ b/engines/mads/nebular/nebular_scenes4.h @@ -170,6 +170,18 @@ public: virtual void actions(); virtual void postActions() {}; }; + +class Scene408: public Scene4xx { +public: + Scene408(MADSEngine *vm) : Scene4xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step() {}; + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From c5aa86f9651e9518a56e7714561e4569f1be785d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 1 May 2014 23:58:02 +0200 Subject: MADS: Implement scene 410 --- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes4.cpp | 162 +++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes4.h | 12 +++ 3 files changed, 175 insertions(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index ab1256ada5..a3cfe8b4ed 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -183,7 +183,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 409: // TODO case 410: - // TODO + return new Scene410(vm); case 411: // TODO case 413: diff --git a/engines/mads/nebular/nebular_scenes4.cpp b/engines/mads/nebular/nebular_scenes4.cpp index 9b0c5affbb..93ab7dd4d3 100644 --- a/engines/mads/nebular/nebular_scenes4.cpp +++ b/engines/mads/nebular/nebular_scenes4.cpp @@ -2939,5 +2939,167 @@ void Scene408::actions() { /*------------------------------------------------------------------------*/ +void Scene410::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene410::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('y', -1)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites("*ROXRC_7"); + + if (_game._objects.isInRoom(OBJ_CHARGE_CASES)) + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); + else + _scene->_hotspots.activate(0x48, false); + + if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(155, 150); + _game._player._facing = FACING_NORTH; + } + + sceneEntrySound(); + + _scene->loadAnimation(Resources::formatName(410, 'r', -1, EXT_AA, "")); + _scene->_activeAnimation->_resetFlag = true; +} + +void Scene410::step() { + if (_scene->_activeAnimation->getCurrentFrame() == 1) { + if (_vm->getRandomNumber(1, 30) == 1) + _scene->_activeAnimation->setCurrentFrame(2); + else + _scene->_activeAnimation->setCurrentFrame(0); + } + + if (_scene->_activeAnimation->getCurrentFrame() == 9) { + if (_vm->getRandomNumber(1, 30) == 1) + _scene->_activeAnimation->setCurrentFrame(10); + else + _scene->_activeAnimation->setCurrentFrame(8); + } + + if (_scene->_activeAnimation->getCurrentFrame() == 5) { + if (_vm->getRandomNumber(1, 30) == 1) + _scene->_activeAnimation->setCurrentFrame(6); + else + _scene->_activeAnimation->setCurrentFrame(4); + } + + if (_scene->_activeAnimation->getCurrentFrame() == 3) { + if (_vm->getRandomNumber(1, 2) == 1) + _scene->_activeAnimation->setCurrentFrame(4); + else // == 2 + _scene->_activeAnimation->setCurrentFrame(8); + } +} + +void Scene410::preActions() { + if (_action.isAction(VERB_TAKE) && !_action.isAction(0x48)) + _game._player._needToWalk = false; + + if (_action.isAction(VERB_LOOK, 0x48) && _game._objects.isInRoom(OBJ_CHARGE_CASES)) + _game._player._needToWalk = true; + + if (_action.isAction(VERB_OPEN, 0x278) || _action.isAction(VERB_OPEN, 0x214)) + _game._player._needToWalk = false; + + if (_action.isAction(VERB_LOOK, 0x272)) + _game._player._needToWalk = true; +} + +void Scene410::actions() { + if (_action.isAction(0x242, 0x2B3)) + _scene->_nextSceneId = 406; + else if (_action.isAction(VERB_TAKE, 0x48) && (_game._objects.isInRoom(OBJ_CHARGE_CASES) || _game._trigger)) { + switch (_game._trigger) { + case (0): + _vm->_sound->command(57); + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 7, 2, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 3); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[2]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_SPRITE, 3, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + + case 1: + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _scene->_hotspots.activate(0x48, false); + _game._objects.addToInventory(OBJ_CHARGE_CASES); + _vm->_dialogs->showItem(OBJ_CHARGE_CASES, 41032); + break; + + case 2: + _game._player._priorTimer = _game._player._ticksAmount + _scene->_frameStartTime; + _game._player._visible = true; + _scene->_sequences.addTimer(20, 3); + break; + + case 3: + _game._player._stepEnabled = true; + break; + + default: + break; + } + } else if (_action.isAction(VERB_LOOK, 0x276)) + _vm->_dialogs->show(41010); + else if (_action.isAction(VERB_TAKE, 0x276)) + _vm->_dialogs->show(41011); + else if (_action.isAction(VERB_OPEN, 0x276)) + _vm->_dialogs->show(41012); + else if (_action.isAction(VERB_LOOK, 0x270)) + _vm->_dialogs->show(41013); + else if (_action.isAction(VERB_TAKE, 0x270)) + _vm->_dialogs->show(41014); + else if (_action.isAction(VERB_LOOK, 0x265) || _action.isAction(VERB_OPEN, 0x265)) { + if (_game._objects.isInRoom(OBJ_CHARGE_CASES)) + _vm->_dialogs->show(41015); + else + _vm->_dialogs->show(41016); + } else if (_action.isAction(VERB_LOOK, 0x26E)) + _vm->_dialogs->show(41017); + else if (_action.isAction(VERB_TAKE, 0x26E)) + _vm->_dialogs->show(41018); + else if (_action.isAction(VERB_LOOK, 0x278)) + _vm->_dialogs->show(41019); + else if (_action.isAction(VERB_LOOK, 0x214)) + _vm->_dialogs->show(41019); + else if (_action.isAction(VERB_OPEN, 0x278)) + _vm->_dialogs->show(41020); + else if (_action.isAction(VERB_OPEN, 0x214)) + _vm->_dialogs->show(41020); + else if (_action.isAction(VERB_LOOK, 0x277)) + _vm->_dialogs->show(41021); + else if (_action.isAction(VERB_TAKE, 0x277)) + _vm->_dialogs->show(41022); + else if (_action.isAction(VERB_LOOK, 0x272)) + _vm->_dialogs->show(41023); + else if (_action.isAction(VERB_TAKE, 0x272)) + _vm->_dialogs->show(41024); + else if (_action.isAction(VERB_LOOK, 0x48) && _game._objects.isInRoom(OBJ_CHARGE_CASES)) + _vm->_dialogs->show(41025); + else if (_action.isAction(VERB_LOOK, 0x2C3)) + _vm->_dialogs->show(41027); + else if (_action.isAction(VERB_LOOK, 0x47D)) + _vm->_dialogs->show(41028); + else if (_action.isAction(VERB_LOOK, 0x275)) + _vm->_dialogs->show(41029); + else if (_action.isAction(VERB_TAKE, 0x275)) + _vm->_dialogs->show(41030); + else if (_action.isAction(VERB_THROW, 0x275)) + _vm->_dialogs->show(41031); + else if (_action._lookFlag) + _vm->_dialogs->show(41033); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes4.h b/engines/mads/nebular/nebular_scenes4.h index 77d34d760c..2b96b7e7ef 100644 --- a/engines/mads/nebular/nebular_scenes4.h +++ b/engines/mads/nebular/nebular_scenes4.h @@ -182,6 +182,18 @@ public: virtual void actions(); virtual void postActions() {}; }; + +class Scene410: public Scene4xx { +public: + Scene410(MADSEngine *vm) : Scene4xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 8c58a046dbae7c07b06b21c4b42d3b5206841569 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 1 May 2014 20:54:17 -0400 Subject: MADS: Fix palette corruption when playing animations --- engines/mads/animation.cpp | 2 +- engines/mads/nebular/nebular_scenes1.cpp | 12 ++++++------ engines/mads/palette.cpp | 4 ++-- engines/mads/palette.h | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index bfcbe16e28..32f432001e 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -333,7 +333,7 @@ void Animation::startAnimation(int endTrigger) { } if (_vm->_game->_kernelMode == KERNEL_ACTIVE_CODE) - _vm->_palette->refreshHighColors(); + _vm->_palette->refreshSceneColors(); _currentFrame = 0; _oldFrameEntry = 0; diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 4e63ba2060..54973b7de3 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -1601,7 +1601,7 @@ void Scene104::step() { _game._player._stepEnabled = false; _game._player._visible = false; _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('a', 0)); - _vm->_palette->refreshHighColors(); + _vm->_palette->refreshSceneColors(); _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], mirrorFl, 7, 1, 0, 0); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(198, 143)); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); @@ -1631,7 +1631,7 @@ void Scene104::step() { _game._player._stepEnabled = false; _game._player._visible = false; _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('a', 1)); - _vm->_palette->refreshHighColors(); + _vm->_palette->refreshSceneColors(); _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 6, 1, 0, 0); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[3], Common::Point(198, 143)); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 4); @@ -1670,7 +1670,7 @@ void Scene104::step() { _game._player._stepEnabled = false; _game._player._visible = false; _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('a', 2)); - _vm->_palette->refreshHighColors(); + _vm->_palette->refreshSceneColors(); _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 8, 1, 0, 0); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(198, 143)); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 4); @@ -1794,7 +1794,7 @@ void Scene105::step() { _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('m', 3)); _vm->_sound->command(33); _scene->clearSequenceList(); - _vm->_palette->refreshHighColors(); + _vm->_palette->refreshSceneColors(); _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 6, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 8); @@ -2426,7 +2426,7 @@ void Scene109::step() { _beforeEatingRex = true; _scene->_sprites.remove(_globals._spriteIndexes[6]); _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('H', 0)); - _vm->_palette->refreshHighColors(); + _vm->_palette->refreshSceneColors(); } if (_game._player._moving && (_scene->_rails.getNext() > 0) && _globals[kHoovicAlive] && !_globals[kHoovicSated] && !_hungryFl && !_beforeEatingRex) { @@ -2523,7 +2523,7 @@ void Scene109::actions() { break; } - _vm->_palette->refreshHighColors(); + _vm->_palette->refreshSceneColors(); break; case 1: diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index d9a46a93ef..51de2768ed 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -523,12 +523,12 @@ void Palette::unlock() { _lockFl = false; } -void Palette::refreshHighColors() { +void Palette::refreshSceneColors() { int val = 18; if (_vm->_game->_scene._cyclingActive) val += _vm->_game->_scene._totalCycleColors; - setPalette(_mainPalette, val, 256 - val); + setPalette(_mainPalette + (val * 3), val, 256 - val); } } // End of namespace MADS diff --git a/engines/mads/palette.h b/engines/mads/palette.h index 0d808ce218..d1c7c1da7a 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -255,7 +255,7 @@ public: void lock(); void unlock(); - void refreshHighColors(); + void refreshSceneColors(); }; } // End of namespace MADS -- cgit v1.2.3 From d888938d9b6d2e393eeac3a1b2551ccc8d36f49e Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 2 May 2014 04:14:19 +0300 Subject: MADS: Add a sanity check in MADSAction::set() --- engines/mads/action.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index cfd84bf762..f1e27d7482 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -226,7 +226,7 @@ void MADSAction::set() { _statusText += kArticleList[articleNum]; } } else if ((_articleNumber == VERB_LOOK) || (_vm->getGameID() != GType_RexNebular) || - (scene._vocabStrings[_action._indirectObjectId] != kFenceStr)) { + (_action._indirectObjectId >= 0 && scene._vocabStrings[_action._indirectObjectId] != kFenceStr)) { // Write out the article _statusText += kArticleList[_articleNumber]; } else { -- cgit v1.2.3 From 92ab7e87a0e0afc9db1612b4c7d16597fe6499a0 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 2 May 2014 04:15:28 +0300 Subject: MADS: sub70C52 is setMotion --- engines/mads/nebular/nebular_scenes1.cpp | 4 ++-- engines/mads/nebular/nebular_scenes2.cpp | 2 +- engines/mads/nebular/nebular_scenes3.cpp | 2 +- engines/mads/sequence.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 54973b7de3..7d8b077fc2 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -2141,7 +2141,7 @@ void Scene107::enter() { _globals._spriteIndexes[0] = _scene->_sprites.addSprites(Resources::formatName(105, 'R', 1, EXT_SS, "")); _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], true, 4, 0, 0, 0); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[0], Common::Point(270, 150)); - _scene->_sequences.sub70C52(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_SPRITE, -200, 0); + _scene->_sequences.setMotion(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_SPRITE, -200, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 2); _scene->_dynamicHotspots.add(218, 348, _globals._sequenceIndexes[0], Common::Rect(0, 0, 0, 0)); } @@ -2386,7 +2386,7 @@ void Scene109::enter() { _globals._sequenceIndexes[10] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[10], true, 4, 0, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 5); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[10], Common::Point(126, 39)); - _scene->_sequences.sub70C52(_globals._sequenceIndexes[10], 0, 200, 0); + _scene->_sequences.setMotion(_globals._sequenceIndexes[10], 0, 200, 0); _scene->_sequences.setScale(_globals._sequenceIndexes[10], 80); _game._player._stepEnabled = false; } diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 88b3f941ea..a62ad6b94d 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -4285,7 +4285,7 @@ void Scene211::enter() { _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 6, 0, 0, 0); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(202, 126)); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 8); - _scene->_sequences.sub70C52(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_SPRITE, -200, 0); + _scene->_sequences.setMotion(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_SPRITE, -200, 0); _scene->_dynamicHotspots.add(324, 13, _globals._sequenceIndexes[2], Common::Rect(1, 1, 1 + 41, 1 + 10)); } diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 12917d61a1..09b3152347 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -220,7 +220,7 @@ void Scene3xx::handleForceField(ForceField *force, int *sprites) { force->_seqId[id] = _scene->_sequences.addSpriteCycle(sprites[spriteId], mirror, 2, 0, 0, 0); _scene->_sequences.setDepth(force->_seqId[id], 8); _scene->_sequences.setMsgPosition(force->_seqId[id], Common::Point(posX, posY)); - _scene->_sequences.sub70C52(force->_seqId[id], 2, speedX, speedY); + _scene->_sequences.setMotion(force->_seqId[id], 2, speedX, speedY); _scene->_sequences.addSubEntry(force->_seqId[id], SEQUENCE_TRIGGER_EXPIRE, 0, 150 + id); if (spriteId == 2) force->_horizontal++; diff --git a/engines/mads/sequence.h b/engines/mads/sequence.h index 5f052e9d0f..19759001de 100644 --- a/engines/mads/sequence.h +++ b/engines/mads/sequence.h @@ -126,7 +126,7 @@ public: void setScale(int spriteIdx, int scale); void setMsgLayout(int seqIndex); void setDone(int seqIndex); - void sub70C52(int seqIndex, int flags, int deltaX, int deltaY) { warning("TODO: sub70C52()"); } + void setMotion(int seqIndex, int flags, int deltaX, int deltaY) { warning("TODO: setMotion()"); } }; } // End of namespace MADS -- cgit v1.2.3 From b5949010a61e3d12f22ea762ed8d09cc1a79b850 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 1 May 2014 22:36:36 -0400 Subject: MADS: Implemented more savegame synchronization --- engines/mads/action.cpp | 40 ++++++++++++++++ engines/mads/action.h | 17 ++++++- engines/mads/game.cpp | 26 +++++----- engines/mads/game.h | 6 +-- engines/mads/game_data.cpp | 18 +------ engines/mads/game_data.h | 3 +- engines/mads/globals.h | 2 +- engines/mads/hotspots.cpp | 18 +++++++ engines/mads/hotspots.h | 13 +++++ engines/mads/nebular/game_nebular.cpp | 3 ++ engines/mads/nebular/game_nebular.h | 5 ++ engines/mads/nebular/globals_nebular.cpp | 10 ++++ engines/mads/nebular/globals_nebular.h | 23 ++++----- engines/mads/player.cpp | 81 ++++++++++++++++---------------- engines/mads/resources.cpp | 41 ++++++++++++++++ engines/mads/resources.h | 14 ++++++ engines/mads/scene.cpp | 8 +++- engines/mads/scene_data.h | 1 + engines/mads/screen.cpp | 5 ++ engines/mads/screen.h | 5 ++ engines/mads/user_interface.cpp | 3 ++ 21 files changed, 247 insertions(+), 95 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index f1e27d7482..48393e17f6 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -24,6 +24,7 @@ #include "mads/mads.h" #include "mads/action.h" #include "mads/inventory.h" +#include "mads/resources.h" #include "mads/scene.h" #include "mads/staticres.h" @@ -35,6 +36,18 @@ void ActionDetails::synchronize(Common::Serializer &s) { s.syncAsUint16LE(_indirectObjectId); } +void ActionSavedFields::synchronize(Common::Serializer &s) { + s.syncAsByte(_commandError); + s.syncAsSint16LE(_commandSource); + s.syncAsSint16LE(_command); + s.syncAsSint16LE(_mainObject); + s.syncAsSint16LE(_secondObject); + s.syncAsSint16LE(_mainObjectSource); + s.syncAsSint16LE(_secondObjectSource); + s.syncAsSint16LE(_articleNumber); + s.syncAsSint16LE(_lookFlag); +} + /*------------------------------------------------------------------------*/ MADSAction::MADSAction(MADSEngine *vm) : _vm(vm) { @@ -645,4 +658,31 @@ void MADSAction::leftClick() { } } +void MADSAction::synchronize(Common::Serializer &s) { + _action.synchronize(s); + _activeAction.synchronize(s); + s.syncAsSint16LE(_articleNumber); + s.syncAsByte(_lookFlag); + s.syncAsByte(_textChanged); + s.syncAsSint16LE(_selectedRow); + s.syncAsSint16LE(_selectedAction); + s.syncAsSint16LE(_statusTextIndex); + s.syncAsSint16LE(_hotspotId); + _savedFields.synchronize(s); + synchronizeString(s, _sentence); + + s.syncAsSint16LE(_verbType); + s.syncAsSint16LE(_prepType); + s.syncAsSint16LE(_commandSource); + s.syncAsSint16LE(_mainObjectSource); + s.syncAsSint16LE(_secondObject); + s.syncAsSint16LE(_secondObjectSource); + s.syncAsSint16LE(_recentCommandSource); + s.syncAsSint16LE(_recentCommand); + s.syncAsSint16LE(_interAwaiting); + s.syncAsSint16LE(_pickedWord); + s.syncAsByte(_pointEstablished); + s.syncAsByte(_inProgress); +} + } // End of namespace MADS diff --git a/engines/mads/action.h b/engines/mads/action.h index 6e51e12483..ac6c35c863 100644 --- a/engines/mads/action.h +++ b/engines/mads/action.h @@ -78,6 +78,9 @@ struct ActionDetails { int _objectNameId; int _indirectObjectId; + /** + * Synchronize the action details + */ void synchronize(Common::Serializer &s); }; @@ -91,6 +94,11 @@ struct ActionSavedFields { int _secondObjectSource; int _articleNumber; int _lookFlag; + + /** + * Synchronize the saved action details + */ + void synchronize(Common::Serializer &s); }; class MADSAction { @@ -117,11 +125,11 @@ public: PrepType _prepType; ScrCategory _commandSource; ScrCategory _mainObjectSource; - int16 _secondObject; + int _secondObject; ScrCategory _secondObjectSource; ScrCategory _recentCommandSource; bool _pointEstablished; - int16 _recentCommand; + int _recentCommand; InterAwaiting _interAwaiting; bool _inProgress; int _pickedWord; @@ -154,6 +162,11 @@ public: * Execute a click within the scene */ void leftClick(); + + /** + * Synchronize the saved action details + */ + void synchronize(Common::Serializer &s); }; } // End of namespace MADS diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 1435681612..4b8805df3e 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -59,8 +59,8 @@ Game *Game::init(MADSEngine *vm) { Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm), _scene(vm), _screenObjects(vm), _player(vm) { _sectionNumber = _priorSectionNumber = 0; - _difficulty = DIFFICULTY_IMPOSSIBLE; _loadGameSlot = -1; + _lastSave = -1; _saveFile = nullptr; _statusFlag = 0; _sectionHandler = nullptr; @@ -452,24 +452,26 @@ void Game::handleKeypress(const Common::Event &event) { void Game::synchronize(Common::Serializer &s, bool phase1) { if (phase1) { - s.syncAsUint16LE(_scene._nextSceneId); - s.syncAsUint16LE(_scene._priorSceneId); + s.syncAsSint16LE(_fx); + s.syncAsSint16LE(_trigger); + s.syncAsUint16LE(_triggerSetupMode); + s.syncAsUint16LE(_triggerMode); + synchronizeString(s, _aaName); + s.syncAsSint16LE(_lastSave); + + _scene.synchronize(s); + _objects.synchronize(s); _visitedScenes.synchronize(s); + _player.synchronize(s); + _screenObjects.synchronize(s); if (s.isLoading()) { _sectionNumber = _scene._nextSceneId / 100; _currentSectionNumber = _sectionNumber; - _scene._frameStartTime = _vm->_events->getFrameCounter(); - - _player._spritesLoaded = false; - _player._spritesChanged = true; } } else { - s.syncAsByte(_difficulty); - - _scene.synchronize(s); - _objects.synchronize(s); - _player.synchronize(s); + // Load scene specific data for the loaded scene + _scene._sceneLogic->synchronize(s); } } diff --git a/engines/mads/game.h b/engines/mads/game.h index 246a7857a6..5ae670df76 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -43,10 +43,6 @@ enum { PLAYER_INVENTORY = 2 }; -enum Difficulty { - DIFFICULTY_HARD = 1, DIFFICULTY_REALLY_HARD = 2, DIFFICULTY_IMPOSSIBLE = 3 -}; - enum KernelMode { KERNEL_GAME_LOAD = 0, KERNEL_SECTION_PRELOAD = 1, KERNEL_SECTION_INIT = 2, KERNEL_ROOM_PRELOAD = 3, KERNEL_ROOM_INIT = 4, KERNEL_ACTIVE_CODE = 5 @@ -92,6 +88,7 @@ protected: bool _vocabEmergency; bool _anyEmergency; int _loadGameSlot; + int _lastSave; Common::String _saveName; Common::InSaveFile *_saveFile; @@ -136,7 +133,6 @@ public: public: Player _player; ScreenObjects _screenObjects; - Difficulty _difficulty; int _sectionNumber; int _priorSectionNumber; int _currentSectionNumber; diff --git a/engines/mads/game_data.cpp b/engines/mads/game_data.cpp index 72137cfa69..4a9d02c75f 100644 --- a/engines/mads/game_data.cpp +++ b/engines/mads/game_data.cpp @@ -47,22 +47,8 @@ bool VisitedScenes::exists(int sceneId) { } void VisitedScenes::synchronize(Common::Serializer &s) { - uint count = size(); - int v = 0; - s.syncAsUint16LE(count); - - if (s.isSaving()) { - for (uint i = 0; i < size(); ++i) { - v = (*this)[i]; - s.syncAsSint16LE(v); - } - } else { - clear(); - for (uint i = 0; i < count; ++i) { - s.syncAsSint16LE(v); - push_back(v); - } - } + SynchronizedList:synchronize(s); + s.syncAsByte(_sceneRevisited); } } // End of namespace MADS diff --git a/engines/mads/game_data.h b/engines/mads/game_data.h index 1a8791e815..6ea59d6d2b 100644 --- a/engines/mads/game_data.h +++ b/engines/mads/game_data.h @@ -25,13 +25,14 @@ #include "common/scummsys.h" #include "common/array.h" +#include "mads/resources.h" namespace MADS { class MADSEngine; class Game; -class VisitedScenes: public Common::Array { +class VisitedScenes: public SynchronizedList { public: /** * Stores true when a previously visited scene is revisited diff --git a/engines/mads/globals.h b/engines/mads/globals.h index fa7a630f7f..e44e97fd3c 100644 --- a/engines/mads/globals.h +++ b/engines/mads/globals.h @@ -48,7 +48,7 @@ public: /** * Synchronize the globals data */ - void synchronize(Common::Serializer &s); + virtual void synchronize(Common::Serializer &s); }; } // End of namespace MADS diff --git a/engines/mads/hotspots.cpp b/engines/mads/hotspots.cpp index 02617e92c7..560726bda6 100644 --- a/engines/mads/hotspots.cpp +++ b/engines/mads/hotspots.cpp @@ -34,6 +34,10 @@ DynamicHotspot::DynamicHotspot() { _cursor = CURSOR_NONE; } +void DynamicHotspot::synchronize(Common::Serializer &s) { + +} + /*------------------------------------------------------------------------*/ DynamicHotspots::DynamicHotspots(MADSEngine *vm) : _vm(vm) { @@ -142,6 +146,20 @@ void DynamicHotspots::refresh() { } } +void DynamicHotspots::synchronize(Common::Serializer &s) { + int count = _entries.size(); + s.syncAsSint16LE(count); + + if (s.isSaving()) { + for (int i = 0; i < count; ++i) + _entries[i].synchronize(s); + } else { + DynamicHotspot rec; + rec.synchronize(s); + _entries.push_back(rec); + } +} + /*------------------------------------------------------------------------*/ Hotspot::Hotspot() { diff --git a/engines/mads/hotspots.h b/engines/mads/hotspots.h index 9e1cb44a4e..5fd910e1aa 100644 --- a/engines/mads/hotspots.h +++ b/engines/mads/hotspots.h @@ -43,7 +43,15 @@ public: int _articleNumber; CursorType _cursor; + /** + * Constructor + */ DynamicHotspot(); + + /** + * Synchronize the data + */ + void synchronize(Common::Serializer &s); }; #define DYNAMIC_HOTSPOTS_SIZE 8 @@ -67,6 +75,11 @@ public: void clear(); void reset(); void refresh(); + + /** + * Synchronize the data + */ + void synchronize(Common::Serializer &s); }; class Hotspot { diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index 34eb6f140c..ce3f0869cd 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -38,6 +38,7 @@ namespace Nebular { GameNebular::GameNebular(MADSEngine *vm): Game(vm) { _surface = new MSurface(MADS_SCREEN_WIDTH, MADS_SCENE_HEIGHT); _storyMode = STORYMODE_NAUGHTY; + _difficulty = DIFFICULTY_IMPOSSIBLE; } ProtectionResult GameNebular::checkCopyProtection() { @@ -749,6 +750,8 @@ void GameNebular::synchronize(Common::Serializer &s, bool phase1) { if (!phase1) { _globals.synchronize(s); + s.syncAsByte(_storyMode); + s.syncAsByte(_difficulty); } } diff --git a/engines/mads/nebular/game_nebular.h b/engines/mads/nebular/game_nebular.h index 0e2d564236..ab82cf68d7 100644 --- a/engines/mads/nebular/game_nebular.h +++ b/engines/mads/nebular/game_nebular.h @@ -34,6 +34,10 @@ namespace Nebular { enum StoryMode { STORYMODE_NAUGHTY = 1, STORYMODE_NICE = 2 }; +enum Difficulty { + DIFFICULTY_HARD = 1, DIFFICULTY_REALLY_HARD = 2, DIFFICULTY_IMPOSSIBLE = 3 +}; + enum InventoryObject { OBJ_NONE = -1, OBJ_BINOCULARS = 0, OBJ_BURGER = 1, OBJ_DEAD_FISH = 2, OBJ_STUFFED_FISH = 3, OBJ_REBREATHER = 4, OBJ_TIMER_MODULE = 5, OBJ_BIG_LEAVES = 6, OBJ_POISON_DARTS = 7, OBJ_PLANT_STALK = 8, @@ -65,6 +69,7 @@ protected: public: NebularGlobals _globals; StoryMode _storyMode; + Difficulty _difficulty; virtual Globals &globals() { return _globals; } diff --git a/engines/mads/nebular/globals_nebular.cpp b/engines/mads/nebular/globals_nebular.cpp index 4144797abc..d839d29d9a 100644 --- a/engines/mads/nebular/globals_nebular.cpp +++ b/engines/mads/nebular/globals_nebular.cpp @@ -39,6 +39,16 @@ NebularGlobals::NebularGlobals(): Globals() { _timebombTimer = 0; } +void NebularGlobals::synchronize(Common::Serializer &s) { + Globals::synchronize(s); + + s.syncAsUint32BE(_timebombClock); + s.syncAsUint32LE(_timebombTimer); + _spriteIndexes.synchronize(s); + _sequenceIndexes.synchronize(s); +} + + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/globals_nebular.h b/engines/mads/nebular/globals_nebular.h index 56fbc1b4ca..9a7873f5b5 100644 --- a/engines/mads/nebular/globals_nebular.h +++ b/engines/mads/nebular/globals_nebular.h @@ -26,6 +26,7 @@ #include "common/scummsys.h" #include "common/array.h" #include "mads/game.h" +#include "mads/resources.h" namespace MADS { @@ -281,28 +282,20 @@ enum { class NebularGlobals: public Globals { public: - Common::Array _spriteIndexes; - Common::Array _sequenceIndexes; + SynchronizedList _spriteIndexes; + SynchronizedList _sequenceIndexes; int _timebombClock, _timebombTimer; - /* - int _v0; - uint32 _frameTime; - int _v2; - int _v3; - int _v4; - int _v5; - int _v6; - uint32 _v7; - int _v8; - int _abortVal; - int _v84262, _v84264, _v84266, _v84268; - */ public: /** * Constructor */ NebularGlobals(); + + /** + * Synchronize the globals data + */ + virtual void synchronize(Common::Serializer &s); }; } // End of namespace Nebular diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index 2049042e07..0c9a496144 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -695,71 +695,70 @@ void Player::releasePlayerSprites() { } void Player::synchronize(Common::Serializer &s) { - s.syncAsByte(_visible); - s.syncAsByte(_priorVisible); - s.syncAsByte(_beenVisible); s.syncAsByte(_moving); - s.syncAsByte(_stepEnabled); s.syncAsSint16LE(_playerPos.x); s.syncAsSint16LE(_playerPos.y); s.syncAsSint16LE(_targetPos.x); s.syncAsSint16LE(_targetPos.y); - s.syncAsSint16LE(_posChange.x); - s.syncAsSint16LE(_posChange.y); - s.syncAsSint16LE(_posDiff.x); - s.syncAsSint16LE(_posDiff.y); s.syncAsSint16LE(_xDirection); s.syncAsSint16LE(_yDirection); - s.syncAsUint16LE(_facing); + s.syncAsSint16LE(_posDiff.x); + s.syncAsSint16LE(_posDiff.y); + s.syncAsSint16LE(_posChange.x); + s.syncAsSint16LE(_posChange.y); s.syncAsUint16LE(_targetFacing); - s.syncAsByte(_spritesChanged); - s.syncAsByte(_walkAnywhere); - s.syncAsByte(_walkOffScreen); + s.syncAsSint16LE(_special); + s.syncAsByte(_forceRefresh); s.syncAsSint16LE(_ticksAmount); - s.syncAsSint16LE(_centerOfGravity); + s.syncAsByte(_walkAnywhere); s.syncAsUint16LE(_walkOffScreenSceneId); + s.syncAsByte(_walkOffScreen); s.syncAsByte(_needToWalk); s.syncAsByte(_readyToWalk); s.syncAsUint16LE(_prepareWalkFacing); s.syncAsSint16LE(_prepareWalkPos.x); s.syncAsSint16LE(_prepareWalkPos.y); + s.syncAsByte(_stepEnabled); + s.syncAsByte(_visible); + s.syncAsByte(_priorVisible); - s.syncAsByte(_mirror); - s.syncAsUint16LE(_frameCount); + s.syncAsSint16LE(_spritesStart); + for (int i = 0; i < 8; ++i) + s.syncAsByte(_spriteSetsPresent[i]); + + s.syncAsByte(_facing); + s.syncAsByte(_turnToFacing); + s.syncAsSint16LE(_spritesIdx); + s.syncAsSint16LE(_frameNumber); + s.syncAsSint16LE(_currentDepth); + s.syncAsSint16LE(_currentScale); s.syncAsSint16LE(_frameListIndex); - s.syncAsSint16LE(_distAccum); - s.syncAsSint16LE(_pixelAccum); - s.syncAsSint16LE(_deltaDistance); - + for (int i = 0; i < 12; ++i) { s.syncAsSint16LE(_stopWalkerList[i]); s.syncAsSint16LE(_stopWalkerTrigger[i]); } + s.syncAsSint16LE(_stopWalkerIndex); - s.syncAsSint16LE(_totalDistance); - s.syncAsSint16LE(_frameNumber); - s.syncAsSint16LE(_special); - s.syncAsSint16LE(_velocity); - s.syncAsSint16LE(_scalingVelocity); s.syncAsSint16LE(_upcomingTrigger); s.syncAsSint16LE(_trigger); - s.syncAsSint16LE(_currentDepth); - s.syncAsSint16LE(_currentScale); - - int count; - char ch; - if (s.isSaving()) { - count = _spritesPrefix.size(); - s.syncAsUint16LE(count); - s.syncBytes((byte *)_spritesPrefix.c_str(), count); - } else { - s.syncAsSint16LE(count); - _spritesPrefix.clear(); - for (int i = 0; i < count; ++i) { - s.syncAsByte(ch); - _spritesPrefix += ch; - } - } + s.syncAsSint16LE(_scalingVelocity); + s.syncAsSint16LE(_pixelAccum); + s.syncAsSint16LE(_distAccum); + s.syncAsSint16LE(_deltaDistance); + s.syncAsSint16LE(_totalDistance); + s.syncAsSint16LE(_velocity); + s.syncAsUint16LE(_frameCount); + synchronizeString(s, _spritesPrefix); + s.syncAsUint32LE(_priorTimer); + s.syncAsSint16LE(_numSprites); + s.syncAsByte(_loadsFirst); + s.syncAsByte(_loadedFirst); + s.syncAsByte(_spritesLoaded); + s.syncAsByte(_spritesChanged); + s.syncAsByte(_beenVisible); + s.syncAsSint16LE(_centerOfGravity); + s.syncAsByte(_mirror); } } // End of namespace MADS diff --git a/engines/mads/resources.cpp b/engines/mads/resources.cpp index b6caed7b0c..f0609448bb 100644 --- a/engines/mads/resources.cpp +++ b/engines/mads/resources.cpp @@ -384,4 +384,45 @@ void File::openFile(const Common::String &filename) { error("Could not open file - %s", filename.c_str()); } +/*------------------------------------------------------------------------*/ + +void SynchronizedList::synchronize(Common::Serializer &s) { + int v; + int count = size(); + s.syncAsUint16LE(count); + + if (s.isSaving()) { + for (int idx = 0; idx < count; ++idx) { + v = (*this)[idx]; + s.syncAsSint32LE(v); + } + } else { + clear(); + reserve(count); + for (int idx = 0; idx < count; ++idx) { + s.syncAsSint32LE(v); + push_back(v); + } + } +} + +/*------------------------------------------------------------------------*/ + +void synchronizeString(Common::Serializer &s, Common::String &str) { + int len = str.size(); + char c; + s.syncAsUint16LE(len); + + if (s.isSaving()) { + s.syncBytes((byte *)str.c_str(), len); + } else { + str.clear(); + for (int i = 0; i < len; ++i) { + s.syncAsByte(c); + str += c; + } + } +} + + } // End of namespace MADS diff --git a/engines/mads/resources.h b/engines/mads/resources.h index 3d5d582707..7d56138da5 100644 --- a/engines/mads/resources.h +++ b/engines/mads/resources.h @@ -25,6 +25,7 @@ #include "common/scummsys.h" #include "common/file.h" +#include "common/serializer.h" #include "common/str.h" namespace MADS { @@ -75,6 +76,19 @@ public: void openFile(const Common::String &filename); }; +class SynchronizedList : public Common::Array { +public: + /** + * Synchronize the list + */ + void synchronize(Common::Serializer &s); +}; + +/** +* Synchronize string support method +*/ +void synchronizeString(Common::Serializer &s, Common::String &str); + } // End of namespace MADS #endif /* MADS_RESOURCES_H */ diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 5c86e4590e..e53061c750 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -705,10 +705,14 @@ void Scene::freeAnimation() { } void Scene::synchronize(Common::Serializer &s) { - _action._activeAction.synchronize(s); + _action.synchronize(s); _rails.synchronize(s); _userInterface.synchronize(s); - _sceneLogic->synchronize(s); + s.syncAsByte(_reloadSceneFlag); + s.syncAsByte(_roomChanged); + s.syncAsUint16LE(_nextSceneId); + s.syncAsUint16LE(_priorSceneId); + _dynamicHotspots.synchronize(s); } } // End of namespace MADS diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index 9b1825f4b7..c295ae0de8 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -25,6 +25,7 @@ #include "common/scummsys.h" #include "common/array.h" +#include "common/serializer.h" #include "common/str.h" #include "common/str-array.h" #include "common/rect.h" diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index ea73d41222..640617e127 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -529,6 +529,11 @@ void ScreenObjects::setActive(ScrCategory category, int descId, bool active) { } } +void ScreenObjects::synchronize(Common::Serializer &s) { + s.syncAsSint16LE(_selectedObject); + s.syncAsSint16LE(_category); +} + /*------------------------------------------------------------------------*/ ScreenSurface::ScreenSurface() { diff --git a/engines/mads/screen.h b/engines/mads/screen.h index ba01cbc468..4ad5820d14 100644 --- a/engines/mads/screen.h +++ b/engines/mads/screen.h @@ -189,6 +189,11 @@ public: * @param active Whether to set item as active or not */ void setActive(ScrCategory category, int descId, bool active); + + /** + * Synchronize the data + */ + void synchronize(Common::Serializer &s); }; class ScreenSurface : public MSurface { diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 194fda0164..8208c14f4d 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -1092,6 +1092,9 @@ void UserInterface::synchronize(Common::Serializer &s) { if (s.isLoading()) { _selectedInvIndex = invObjects._inventoryList.empty() ? -1 : 0; } + + for (int i = 0; i < 8; ++i) + s.syncAsSint16LE(_categoryIndexes[i]); } } // End of namespace MADS -- cgit v1.2.3 From e258419a3e21f274839fdd39796bb9a75652ef99 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 1 May 2014 22:42:47 -0400 Subject: MADS: Add some further savegame loading logic --- engines/mads/game.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 4b8805df3e..36b0c315d7 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -466,8 +466,11 @@ void Game::synchronize(Common::Serializer &s, bool phase1) { _screenObjects.synchronize(s); if (s.isLoading()) { + _scene._userInterface._selectedInvIndex = -1; + _currentSectionNumber = -2; + _scene._currentSceneId = -2; _sectionNumber = _scene._nextSceneId / 100; - _currentSectionNumber = _sectionNumber; + _scene._frameStartTime = _vm->_events->getFrameCounter(); } } else { // Load scene specific data for the loaded scene -- cgit v1.2.3 From f9c7a5d83f0a57cd285fef10f5aa0eda8e0fa177 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 2 May 2014 11:00:47 +0300 Subject: FULLPIPE: Implement Movement::~Movement() --- engines/fullpipe/statics.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp index f1abac5778..3b99afc059 100644 --- a/engines/fullpipe/statics.cpp +++ b/engines/fullpipe/statics.cpp @@ -1493,7 +1493,20 @@ Movement::Movement() { } Movement::~Movement() { - warning("STUB: Movement::~Movement()"); + for (uint i = 0; i < _dynamicPhases.size(); i++) + delete _framePosOffsets[i]; + + if (!_currMovement ) { + if (_updateFlag1) + _dynamicPhases.remove_at(0); + + for (uint i = 0; i < _dynamicPhases.size(); i++) + delete (DynamicPhase *)_dynamicPhases[i]; + + _dynamicPhases.clear(); + } + + free(_framePosOffsets); } Movement::Movement(Movement *src, StaticANIObject *ani) { -- cgit v1.2.3 From 23ef7fb9017b9560dac1c3f877a7c6ba305dc866 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 2 May 2014 11:16:28 +0300 Subject: FULLPIPE: Implement Scene::~Scene() --- engines/fullpipe/scene.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp index 462401b3b2..746db3b129 100644 --- a/engines/fullpipe/scene.cpp +++ b/engines/fullpipe/scene.cpp @@ -133,7 +133,27 @@ Scene::Scene() { } Scene::~Scene() { - warning("STUB: Scene::~Scene()"); + delete _soundList; + delete _shadows; + delete _palette; + + // _faObjlist is not used + + for (int i = 0; i < _messageQueueList.size(); i++) + delete (MessageQueue *)_messageQueueList[i]; + + _messageQueueList.clear(); + + for (int i = 0; i < _staticANIObjectList1.size(); i++) + delete (StaticANIObject *)_staticANIObjectList1[i]; + + _staticANIObjectList1.clear(); + + delete _libHandle; + + // delete _field_BC; + + free(_sceneName); } bool Scene::load(MfcArchive &file) { -- cgit v1.2.3 From 2542f68e45f6fe4cfd60044b8df23efce40c352e Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 2 May 2014 11:21:27 +0300 Subject: FULLPIPE: Implement Scene::stopAllSounds() --- engines/fullpipe/scene.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp index 746db3b129..a626b01974 100644 --- a/engines/fullpipe/scene.cpp +++ b/engines/fullpipe/scene.cpp @@ -355,7 +355,8 @@ void Scene::setPictureObjectsFlag4() { } void Scene::stopAllSounds() { - warning("STUB: Scene:stopAllSounds()"); + for (uint i = 0; i < _soundList->getCount(); i++) + _soundList->getSoundByIndex(i)->stop(); } PictureObject *Scene::getPictureObjectById(int objId, int flags) { -- cgit v1.2.3 From 6b0d938737f99cd9388462bf7167619f609e116e Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 2 May 2014 12:09:21 +0300 Subject: FULLPIPE: Removed couple of PtrList usages for code clarity --- engines/fullpipe/gfx.cpp | 22 ++++++++++-- engines/fullpipe/gfx.h | 5 +-- engines/fullpipe/scene.cpp | 73 ++++++++++++++++++++++------------------ engines/fullpipe/scene.h | 7 ++-- engines/fullpipe/scenes.cpp | 6 ++-- engines/fullpipe/stateloader.cpp | 5 ++- 6 files changed, 72 insertions(+), 46 deletions(-) diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp index 7c66a9a747..74f6b6c3e4 100644 --- a/engines/fullpipe/gfx.cpp +++ b/engines/fullpipe/gfx.cpp @@ -145,7 +145,7 @@ void Background::addPictureObject(PictureObject *pct) { bool inserted = false; for (uint i = 1; i < _picObjList.size(); i++) { - if (((PictureObject *)_picObjList[i])->_priority <= pct->_priority) { + if (_picObjList[i]->_priority <= pct->_priority) { _picObjList.insert_at(i, pct); inserted = true; break; @@ -351,7 +351,25 @@ void GameObject::setOXY(int x, int y) { _oy = y; } -void GameObject::renumPictures(PtrList *lst) { +void GameObject::renumPictures(Common::Array *lst) { + int *buf = (int *)calloc(lst->size() + 2, sizeof(int)); + + for (uint i = 0; i < lst->size(); i++) { + if (_id == ((GameObject *)((*lst)[i]))->_id) + buf[((GameObject *)((*lst)[i]))->_okeyCode] = 1; + } + + if (buf[_okeyCode]) { + uint count; + for (count = 1; buf[count] && count < lst->size() + 2; count++) + ; + _okeyCode = count; + } + + free(buf); +} + +void GameObject::renumPictures(Common::Array *lst) { int *buf = (int *)calloc(lst->size() + 2, sizeof(int)); for (uint i = 0; i < lst->size(); i++) { diff --git a/engines/fullpipe/gfx.h b/engines/fullpipe/gfx.h index b3e22b610b..7e40d4be39 100644 --- a/engines/fullpipe/gfx.h +++ b/engines/fullpipe/gfx.h @@ -141,7 +141,8 @@ class GameObject : public CObject { virtual bool load(MfcArchive &file); void setOXY(int x, int y); - void renumPictures(PtrList *lst); + void renumPictures(Common::Array *lst); + void renumPictures(Common::Array *lst); void setFlags(int16 flags) { _flags = flags; } void clearFlags() { _flags = 0; } const char *getName() { return _objectName; } @@ -178,7 +179,7 @@ class PictureObject : public GameObject { class Background : public CObject { public: - PtrList _picObjList; + Common::Array _picObjList; char *_bgname; int _x; diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp index a626b01974..b1af0350a0 100644 --- a/engines/fullpipe/scene.cpp +++ b/engines/fullpipe/scene.cpp @@ -145,7 +145,7 @@ Scene::~Scene() { _messageQueueList.clear(); for (int i = 0; i < _staticANIObjectList1.size(); i++) - delete (StaticANIObject *)_staticANIObjectList1[i]; + delete _staticANIObjectList1[i]; _staticANIObjectList1.clear(); @@ -269,7 +269,7 @@ bool Scene::load(MfcArchive &file) { void Scene::initStaticANIObjects() { for (uint i = 0; i < _staticANIObjectList1.size(); i++) - ((StaticANIObject *)_staticANIObjectList1[i])->initMovements(); + _staticANIObjectList1[i]->initMovements(); } void Scene::init() { @@ -282,13 +282,13 @@ void Scene::init() { ((PictureObject *)_picObjList[i])->clearFlags(); for (uint i = 0; i < _staticANIObjectList1.size(); i++) - ((StaticANIObject *)_staticANIObjectList1[i])->clearFlags(); + _staticANIObjectList1[i]->clearFlags(); if (_staticANIObjectList2.size() != _staticANIObjectList1.size()) { _staticANIObjectList2.clear(); - for (PtrList::iterator s = _staticANIObjectList1.begin(); s != _staticANIObjectList1.end(); ++s) - _staticANIObjectList2.push_back(*s); + for (int i = 0; i < _staticANIObjectList1.size(); i++) + _staticANIObjectList2.push_back(_staticANIObjectList1[i]); } } @@ -301,35 +301,33 @@ StaticANIObject *Scene::getAniMan() { } StaticANIObject *Scene::getStaticANIObject1ById(int obj, int a3) { - for (PtrList::iterator s = _staticANIObjectList1.begin(); s != _staticANIObjectList1.end(); ++s) { - StaticANIObject *o = (StaticANIObject *)*s; - if (o->_id == obj && (a3 == -1 || o->_okeyCode == a3)) - return o; + for (uint i = 0; i < _staticANIObjectList1.size(); i++) { + if (_staticANIObjectList1[i]->_id == obj && (a3 == -1 || _staticANIObjectList1[i]->_okeyCode == a3)) + return _staticANIObjectList1[i]; } return 0; } StaticANIObject *Scene::getStaticANIObject1ByName(char *name, int a3) { - for (uint n = 0; n < _staticANIObjectList1.size(); n++) { - StaticANIObject *o = (StaticANIObject *)_staticANIObjectList1[n]; - if (!strcmp(o->_objectName, name) && (a3 == -1 || o->_okeyCode == a3)) - return o; + for (uint i = 0; i < _staticANIObjectList1.size(); i++) { + if (!strcmp(_staticANIObjectList1[i]->_objectName, name) && (a3 == -1 || _staticANIObjectList1[i]->_okeyCode == a3)) + return _staticANIObjectList1[i]; } return 0; } void Scene::deleteStaticANIObject(StaticANIObject *obj) { - for (uint n = 0; n < _staticANIObjectList1.size(); n++) - if ((StaticANIObject *)_staticANIObjectList1[n] == obj) { - _staticANIObjectList1.remove_at(n); + for (uint i = 0; i < _staticANIObjectList1.size(); i++) + if (_staticANIObjectList1[i] == obj) { + _staticANIObjectList1.remove_at(i); break; } - for (uint n = 0; n < _staticANIObjectList2.size(); n++) - if ((StaticANIObject *)_staticANIObjectList2[n] == obj) { - _staticANIObjectList2.remove_at(n); + for (uint i = 0; i < _staticANIObjectList2.size(); i++) + if (_staticANIObjectList2[i] == obj) { + _staticANIObjectList2.remove_at(i); break; } } @@ -468,15 +466,27 @@ void Scene::initObjectCursors(const char *varname) { } bool Scene::compareObjPriority(const void *p1, const void *p2) { - if (((const StaticANIObject *)p1)->_priority > ((const StaticANIObject *)p2)->_priority) + if (((const GameObject *)p1)->_priority > ((const GameObject *)p2)->_priority) return true; return false; } -void Scene::objectList_sortByPriority(PtrList &list, bool skipFirst) { +void Scene::objectList_sortByPriority(Common::Array &list, bool skipFirst) { + if (skipFirst) { + Common::Array::iterator s = list.begin(); + + ++s; + + Common::sort(s, list.end(), Scene::compareObjPriority); + } else { + Common::sort(list.begin(), list.end(), Scene::compareObjPriority); + } +} + +void Scene::objectList_sortByPriority(Common::Array &list, bool skipFirst) { if (skipFirst) { - PtrList::iterator s = list.begin(); + Common::Array::iterator s = list.begin(); ++s; @@ -497,16 +507,15 @@ void Scene::draw() { objectList_sortByPriority(_staticANIObjectList2); - for (PtrList::iterator s = _staticANIObjectList2.begin(); s != _staticANIObjectList2.end(); ++s) { - ((StaticANIObject *)*s)->draw2(); - } + for (int i = 0; i < _staticANIObjectList2.size(); i++) + _staticANIObjectList2[i]->draw2(); int priority = -1; - for (PtrList::iterator s = _staticANIObjectList2.begin(); s != _staticANIObjectList2.end(); ++s) { - drawContent(((StaticANIObject *)*s)->_priority, priority, false); - ((StaticANIObject *)*s)->draw(); + for (int i = 0; i < _staticANIObjectList2.size(); i++) { + drawContent(_staticANIObjectList2[i]->_priority, priority, false); + _staticANIObjectList2[i]->draw(); - priority = ((StaticANIObject *)*s)->_priority; + priority = _staticANIObjectList2[i]->_priority; } drawContent(-1, priority, false); @@ -587,7 +596,7 @@ StaticANIObject *Scene::getStaticANIObjectAtPos(int x, int y) { StaticANIObject *res = 0; for (uint i = 0; i < _staticANIObjectList1.size(); i++) { - StaticANIObject *p = (StaticANIObject *)_staticANIObjectList1[i]; + StaticANIObject *p = _staticANIObjectList1[i]; int pixel; if ((p->_field_8 & 0x100) && (p->_flags & 4) && @@ -633,8 +642,8 @@ int Scene::getPictureObjectIdAtPos(int x, int y) { void Scene::update(int counterdiff) { debug(6, "Scene::update(%d)", counterdiff); - for (PtrList::iterator s = _staticANIObjectList2.begin(); s != _staticANIObjectList2.end(); ++s) - ((StaticANIObject *)*s)->update(counterdiff); + for (int i = 0; i < _staticANIObjectList2.size(); i++) + _staticANIObjectList2[i]->update(counterdiff); } void Scene::drawContent(int minPri, int maxPri, bool drawBg) { diff --git a/engines/fullpipe/scene.h b/engines/fullpipe/scene.h index 8306974f7b..ef39bbf03f 100644 --- a/engines/fullpipe/scene.h +++ b/engines/fullpipe/scene.h @@ -31,8 +31,8 @@ class MessageQueue; class Scene : public Background { public: - PtrList _staticANIObjectList1; - PtrList _staticANIObjectList2; + Common::Array _staticANIObjectList1; + Common::Array _staticANIObjectList2; PtrList _messageQueueList; PtrList _faObjectList; Shadows *_shadows; @@ -82,7 +82,8 @@ class Scene : public Background { private: static bool compareObjPriority(const void *p1, const void *p2); - void objectList_sortByPriority(PtrList &list, bool skipFirst = false); + void objectList_sortByPriority(Common::Array &list, bool skipFirst = false); + void objectList_sortByPriority(Common::Array &list, bool skipFirst = false); }; class SceneTag : public CObject { diff --git a/engines/fullpipe/scenes.cpp b/engines/fullpipe/scenes.cpp index 7420c1b1cf..72d73a9cf8 100644 --- a/engines/fullpipe/scenes.cpp +++ b/engines/fullpipe/scenes.cpp @@ -590,10 +590,8 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { scene->setPictureObjectsFlag4(); - for (PtrList::iterator s = scene->_staticANIObjectList1.begin(); s != scene->_staticANIObjectList1.end(); ++s) { - StaticANIObject *o = (StaticANIObject *)*s; - o->setFlags(o->_flags & 0xFE7F); - } + for (uint i = 0; i < scene->_staticANIObjectList1.size(); i++) + scene->_staticANIObjectList1[i]->_flags &= 0xFE7F; PictureObject *p = accessScene(SC_INV)->getPictureObjectById(PIC_INV_MENU, 0); p->setFlags(p->_flags & 0xFFFB); diff --git a/engines/fullpipe/stateloader.cpp b/engines/fullpipe/stateloader.cpp index e36b196517..41641457d3 100644 --- a/engines/fullpipe/stateloader.cpp +++ b/engines/fullpipe/stateloader.cpp @@ -55,9 +55,8 @@ bool FullpipeEngine::loadGam(const char *fname, int scene) { _inventory->rebuildItemRects(); - for (PtrList::iterator p = _inventory->getScene()->_picObjList.begin(); p != _inventory->getScene()->_picObjList.end(); ++p) { - ((MemoryObject *)((PictureObject *)*p)->_picture)->load(); - } + for (uint i = 0; i < _inventory->getScene()->_picObjList.size(); i++) + ((MemoryObject *)_inventory->getScene()->_picObjList[i]->_picture)->load(); // _sceneSwitcher = sceneSwitcher; // substituted with direct call _gameLoader->_preloadCallback = preloadCallback; -- cgit v1.2.3 From 3b54cc0e8153d0a91ecc5825ccb3144f7303b260 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 2 May 2014 12:11:42 +0300 Subject: FULLPIPE: ditto for Scene::_messageQueueList --- engines/fullpipe/scene.cpp | 10 +++++----- engines/fullpipe/scene.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp index b1af0350a0..5dde566192 100644 --- a/engines/fullpipe/scene.cpp +++ b/engines/fullpipe/scene.cpp @@ -140,7 +140,7 @@ Scene::~Scene() { // _faObjlist is not used for (int i = 0; i < _messageQueueList.size(); i++) - delete (MessageQueue *)_messageQueueList[i]; + delete _messageQueueList[i]; _messageQueueList.clear(); @@ -388,16 +388,16 @@ void Scene::deletePictureObject(PictureObject *obj) { MessageQueue *Scene::getMessageQueueById(int messageId) { for (uint i = 0; i < _messageQueueList.size(); i++) - if (((MessageQueue *)_messageQueueList[i])->_dataId == messageId) - return (MessageQueue *)_messageQueueList[i]; + if (_messageQueueList[i]->_dataId == messageId) + return _messageQueueList[i]; return 0; } MessageQueue *Scene::getMessageQueueByName(char *name) { for (uint i = 0; i < _messageQueueList.size(); i++) - if (!strcmp(((MessageQueue *)_messageQueueList[i])->_queueName, name)) - return (MessageQueue *)_messageQueueList[i]; + if (!strcmp(_messageQueueList[i]->_queueName, name)) + return _messageQueueList[i]; return 0; } diff --git a/engines/fullpipe/scene.h b/engines/fullpipe/scene.h index ef39bbf03f..6c53755eb8 100644 --- a/engines/fullpipe/scene.h +++ b/engines/fullpipe/scene.h @@ -33,7 +33,7 @@ class Scene : public Background { public: Common::Array _staticANIObjectList1; Common::Array _staticANIObjectList2; - PtrList _messageQueueList; + Common::Array _messageQueueList; PtrList _faObjectList; Shadows *_shadows; SoundList *_soundList; -- cgit v1.2.3 From cdcf9c5d89154b55b6b034ff84b35acab1b80a41 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 2 May 2014 12:12:30 +0300 Subject: FULLPIPE: Remove unused class variable --- engines/fullpipe/scene.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/fullpipe/scene.h b/engines/fullpipe/scene.h index 6c53755eb8..1e2dae81fe 100644 --- a/engines/fullpipe/scene.h +++ b/engines/fullpipe/scene.h @@ -34,7 +34,7 @@ class Scene : public Background { Common::Array _staticANIObjectList1; Common::Array _staticANIObjectList2; Common::Array _messageQueueList; - PtrList _faObjectList; + // PtrList _faObjectList; // not used Shadows *_shadows; SoundList *_soundList; int16 _sceneId; -- cgit v1.2.3 From 79cb4b994dbe063b8f891f3282f25417b250a3a1 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 2 May 2014 12:18:39 +0300 Subject: FULLPIPE: Remove PtrList usage in gfx.cpp --- engines/fullpipe/gfx.cpp | 2 +- engines/fullpipe/gfx.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp index 74f6b6c3e4..b4eba44a64 100644 --- a/engines/fullpipe/gfx.cpp +++ b/engines/fullpipe/gfx.cpp @@ -192,7 +192,7 @@ bool PictureObject::load(MfcArchive &file, bool bigPicture) { _picture->load(file); - _pictureObject2List = new PtrList(); + _pictureObject2List = new Common::Array; int count = file.readUint16LE(); diff --git a/engines/fullpipe/gfx.h b/engines/fullpipe/gfx.h index 7e40d4be39..714247e1bd 100644 --- a/engines/fullpipe/gfx.h +++ b/engines/fullpipe/gfx.h @@ -154,7 +154,7 @@ class GameObject : public CObject { class PictureObject : public GameObject { public: Picture *_picture; - PtrList *_pictureObject2List; + Common::Array *_pictureObject2List; int _ox2; int _oy2; -- cgit v1.2.3 From 2e7d5caa315c586d486f22f79fef38d3b0d2431c Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 2 May 2014 12:29:15 +0300 Subject: FULLPIPE: Removed PtrList usage in statics.cpp --- engines/fullpipe/statics.cpp | 89 ++++++++++++++++++++++---------------------- engines/fullpipe/statics.h | 6 +-- 2 files changed, 47 insertions(+), 48 deletions(-) diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp index 3b99afc059..03cbc8ecd5 100644 --- a/engines/fullpipe/statics.cpp +++ b/engines/fullpipe/statics.cpp @@ -164,22 +164,21 @@ StaticANIObject::StaticANIObject(StaticANIObject *src) : GameObject(src) { _objtype = kObjTypeStaticANIObject; for (uint i = 0; i < src->_staticsList.size(); i++) - _staticsList.push_back(new Statics((Statics *)src->_staticsList[i], 0)); + _staticsList.push_back(new Statics(src->_staticsList[i], 0)); _movement = 0; _statics = 0; for (uint i = 0; i < src->_movements.size(); i++) { Movement *newmov; - Movement *mov = (Movement *)src->_movements[i]; - if (mov->_currMovement) { + if (src->_movements[i]->_currMovement) { // WORKAROUND: Original uses weird construction here: // new Movement(getMovementById(src->getMovementIdById(mov->_id)), this); - newmov = new Movement(src->getMovementById(src->getMovementIdById(mov->_id)), this); - newmov->_id = mov->_id; + newmov = new Movement(src->getMovementById(src->getMovementIdById(src->_movements[i]->_id)), this); + newmov->_id = src->_movements[i]->_id; } else { - newmov = new Movement(mov, 0, -1, this); + newmov = new Movement(src->_movements[i], 0, -1, this); } _movements.push_back(newmov); @@ -224,7 +223,7 @@ bool StaticANIObject::load(MfcArchive &file) { Common::Point pt; if (count) { // We have movements - ((Movement *)_movements[0])->getCurrDynamicPhaseXY(pt); + _movements[0]->getCurrDynamicPhaseXY(pt); } else { pt.x = pt.y = 100; } @@ -392,34 +391,36 @@ bool StaticANIObject::isIdle() { Statics *StaticANIObject::getStaticsById(int itemId) { for (uint i = 0; i < _staticsList.size(); i++) - if (((Statics *)_staticsList[i])->_staticsId == itemId) - return (Statics *)_staticsList[i]; + if (_staticsList[i]->_staticsId == itemId) + return _staticsList[i]; return 0; } Statics *StaticANIObject::getStaticsByName(char *name) { for (uint i = 0; i < _staticsList.size(); i++) - if (!strcmp(((Statics *)_staticsList[i])->_staticsName, name)) - return (Statics *)_staticsList[i]; + if (!strcmp(_staticsList[i]->_staticsName, name)) + return _staticsList[i]; return 0; } Movement *StaticANIObject::getMovementById(int itemId) { for (uint i = 0; i < _movements.size(); i++) - if (((Movement *)_movements[i])->_id == itemId) - return (Movement *)_movements[i]; + if (_movements[i]->_id == itemId) + return _movements[i]; return 0; } int StaticANIObject::getMovementIdById(int itemId) { for (uint i = 0; i < _movements.size(); i++) { - Movement *mov = (Movement *)_movements[i]; + Movement *mov = _movements[i]; + if (mov->_currMovement) { if (mov->_id == itemId) return mov->_id; + if (mov->_currMovement->_id == itemId) return mov->_id; } @@ -430,8 +431,8 @@ int StaticANIObject::getMovementIdById(int itemId) { Movement *StaticANIObject::getMovementByName(char *name) { for (uint i = 0; i < _movements.size(); i++) - if (!strcmp(((Movement *)_movements[i])->_objectName, name)) - return (Movement *)_movements[i]; + if (!strcmp(_movements[i]->_objectName, name)) + return _movements[i]; return 0; } @@ -551,12 +552,12 @@ void Movement::draw(bool flipFlag, int angle) { void StaticANIObject::loadMovementsPixelData() { for (uint i = 0; i < _movements.size(); i++) - ((Movement *)_movements[i])->loadPixelData(); + _movements[i]->loadPixelData(); } void StaticANIObject::freeMovementsPixelData() { for (uint i = 0; i < _movements.size(); i++) - ((Movement *)_movements[i])->freePixelData(); + _movements[i]->freePixelData(); } Statics *StaticANIObject::addReverseStatics(Statics *st) { @@ -665,11 +666,10 @@ MovTable *StaticANIObject::countMovements() { movTable->movs = (int16 *)calloc(_movements.size(), sizeof(int16)); for (uint i = 0; i < _movements.size(); i++) { - GameObject *obj = (GameObject *)_movements[i]; movTable->movs[i] = 2; for (GameVar *sub = preloadSubVar->_subVars; sub; sub = sub->_nextVarObj) { - if (scumm_stricmp(obj->getName(), sub->_varName) == 0) { + if (scumm_stricmp(_movements[i]->getName(), sub->_varName) == 0) { movTable->movs[i] = 1; break; } @@ -702,21 +702,21 @@ void StaticANIObject::setSpeed(int speed) { void StaticANIObject::setAlpha(int alpha) { for (uint i = 0; i < _movements.size(); i++) - ((Movement *)_movements[i])->setAlpha(alpha); + _movements[i]->setAlpha(alpha); for (uint i = 0; i < _staticsList.size(); i++) - ((Statics *)_staticsList[i])->setAlpha(alpha); + _staticsList[i]->setAlpha(alpha); } void StaticANIObject::initMovements() { for (uint i = 0; i < _movements.size(); i++) - ((Movement *)_movements[i])->removeFirstPhase(); + _movements[i]->removeFirstPhase(); } void StaticANIObject::preloadMovements(MovTable *mt) { - if ( mt ) { + if (mt) { for (uint i = 0; i < _movements.size(); i++) { - Movement *mov = (Movement *)_movements[i]; + Movement *mov = _movements[i]; if (mt->movs[i] == 1) mov->loadPixelData(); @@ -1177,8 +1177,8 @@ void StaticANIObject::startAnimSteps(int movementId, int messageQueueId, int x, if (!(_flags & 0x80)) { if (!_messageQueueId) for (uint i = 0; i < _movements.size(); i++) { - if (((Movement *)_movements[i])->_id == movementId) { - mov = (Movement *)_movements[i]; + if (_movements[i]->_id == movementId) { + mov = _movements[i]; break; } } @@ -1276,9 +1276,8 @@ bool StaticANIObject::startAnim(int movementId, int messageQueueId, int dynPhase Movement *mov = 0; for (uint i = 0; i < _movements.size(); i++) { - - if (((Movement *)_movements[i])->_id == movementId) { - mov = (Movement *)_movements[i]; + if (_movements[i]->_id == movementId) { + mov = _movements[i]; break; } } @@ -1501,7 +1500,7 @@ Movement::~Movement() { _dynamicPhases.remove_at(0); for (uint i = 0; i < _dynamicPhases.size(); i++) - delete (DynamicPhase *)_dynamicPhases[i]; + delete _dynamicPhases[i]; _dynamicPhases.clear(); } @@ -1761,11 +1760,11 @@ Common::Point *Movement::calcSomeXY(Common::Point &p, int idx) { void Movement::setAlpha(int alpha) { if (_currMovement) for (uint i = 0; i < _currMovement->_dynamicPhases.size(); i++) { - ((DynamicPhase *)_currMovement->_dynamicPhases[i])->setAlpha(alpha); + _currMovement->_dynamicPhases[i]->setAlpha(alpha); } else for (uint i = 0; i < _dynamicPhases.size(); i++) { - ((DynamicPhase *)_dynamicPhases[i])->setAlpha(alpha); + _dynamicPhases[i]->setAlpha(alpha); } } @@ -1778,9 +1777,9 @@ Common::Point *Movement::getDimensionsOfPhase(Common::Point *p, int phaseIndex) DynamicPhase *dyn; if (_currMovement) - dyn = (DynamicPhase *)_currMovement->_dynamicPhases[idx]; + dyn = _currMovement->_dynamicPhases[idx]; else - dyn = (DynamicPhase *)_dynamicPhases[idx]; + dyn = _dynamicPhases[idx]; Common::Point point; @@ -1829,13 +1828,13 @@ void Movement::updateCurrDynamicPhase() { return; if (_currMovement->_dynamicPhases[_currDynamicPhaseIndex]) - _currDynamicPhase = (DynamicPhase *)_currMovement->_dynamicPhases[_currDynamicPhaseIndex]; + _currDynamicPhase = _currMovement->_dynamicPhases[_currDynamicPhaseIndex]; } else { if (_dynamicPhases.size() == 0 || (uint)_currDynamicPhaseIndex >= _dynamicPhases.size()) return; if (_dynamicPhases[_currDynamicPhaseIndex]) - _currDynamicPhase = (DynamicPhase *)_dynamicPhases[_currDynamicPhaseIndex]; + _currDynamicPhase = _dynamicPhases[_currDynamicPhaseIndex]; } } @@ -1844,11 +1843,11 @@ int Movement::calcDuration() { if (_currMovement) for (uint i = 0; i < _currMovement->_dynamicPhases.size(); i++) { - res += ((DynamicPhase *)_currMovement->_dynamicPhases[i])->_initialCountdown; + res += _currMovement->_dynamicPhases[i]->_initialCountdown; } else for (uint i = 0; i < _dynamicPhases.size(); i++) { - res += ((DynamicPhase *)_dynamicPhases[i])->_initialCountdown; + res += _dynamicPhases[i]->_initialCountdown; } return res; @@ -1889,12 +1888,12 @@ DynamicPhase *Movement::getDynamicPhaseByIndex(int idx) { if (_currMovement->_dynamicPhases.size() == 0 || (uint)idx >= _currMovement->_dynamicPhases.size()) return 0; - return (DynamicPhase *)_currMovement->_dynamicPhases[idx]; + return _currMovement->_dynamicPhases[idx]; } else { if (_dynamicPhases.size() == 0 || (uint)idx >= _dynamicPhases.size()) return 0; - return (DynamicPhase *)_dynamicPhases[idx]; + return _dynamicPhases[idx]; } } @@ -1905,7 +1904,7 @@ void Movement::loadPixelData() { for (uint i = 0; i < _dynamicPhases.size(); i++) { if ((Statics *)_dynamicPhases[i] != mov->_staticsObj2 || !(mov->_staticsObj2->_staticsId & 0x4000)) - ((Statics *)_dynamicPhases[i])->getPixelData(); + _dynamicPhases[i]->getPixelData(); } if (!(mov->_staticsObj1->_staticsId & 0x4000)) @@ -1915,7 +1914,7 @@ void Movement::loadPixelData() { void Movement::freePixelData() { if (!_currMovement) for (uint i = 0; i < _dynamicPhases.size(); i++) - ((DynamicPhase *)_dynamicPhases[i])->freePixelData(); + _dynamicPhases[i]->freePixelData(); if (_staticsObj1) _staticsObj1->freePixelData(); @@ -1947,11 +1946,11 @@ bool Movement::gotoNextFrame(void (*callback1)(int, Common::Point *point, int, i if (!callback2) { if (_currMovement) { if ((uint)_currDynamicPhaseIndex == _currMovement->_dynamicPhases.size() - 1 - && !(((DynamicPhase *)(_currMovement->_dynamicPhases.back()))->_countdown)) { + && !(_currMovement->_dynamicPhases.back()->_countdown)) { return false; } } else if ((uint)_currDynamicPhaseIndex == _dynamicPhases.size() - 1 - && !(((DynamicPhase *)(_dynamicPhases.back()))->_countdown)) { + && !(_dynamicPhases.back()->_countdown)) { return false; } } diff --git a/engines/fullpipe/statics.h b/engines/fullpipe/statics.h index d678957163..be88b4ec2d 100644 --- a/engines/fullpipe/statics.h +++ b/engines/fullpipe/statics.h @@ -121,7 +121,7 @@ class Movement : public GameObject { int _field_50; int _counterMax; int _counter; - PtrList _dynamicPhases; + Common::Array _dynamicPhases; int _field_78; Common::Point **_framePosOffsets; Movement *_currMovement; @@ -181,8 +181,8 @@ class StaticANIObject : public GameObject { int _initialCounter; void (*_callback1)(int, Common::Point *point, int, int); void (*_callback2)(int *); - PtrList _movements; - PtrList _staticsList; + Common::Array _movements; + Common::Array _staticsList; StepArray _stepArray; int16 _field_96; int _messageQueueId; -- cgit v1.2.3 From b5385f600341b9dab3ae9322da9b4b7182f52292 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 2 May 2014 12:30:09 +0300 Subject: FULLPIPE: Remove now unused PtrList --- engines/fullpipe/utils.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/engines/fullpipe/utils.h b/engines/fullpipe/utils.h index 3e3ec0b2fc..da3ab7ee4f 100644 --- a/engines/fullpipe/utils.h +++ b/engines/fullpipe/utils.h @@ -149,8 +149,6 @@ class DWordArray : public Common::Array, public CObject { virtual bool load(MfcArchive &file); }; -typedef Common::Array PtrList; - char *genFileName(int superId, int sceneId, const char *ext); byte *transCyrillic(byte *s); -- cgit v1.2.3 From e714dea7c773645cbb0e2aeaf1dd260888391806 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 2 May 2014 12:40:06 +0300 Subject: FULLPIPE: Implement Statics::init() --- engines/fullpipe/gfx.h | 2 +- engines/fullpipe/statics.cpp | 13 +++++++++++++ engines/fullpipe/statics.h | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/engines/fullpipe/gfx.h b/engines/fullpipe/gfx.h index 714247e1bd..191df7709a 100644 --- a/engines/fullpipe/gfx.h +++ b/engines/fullpipe/gfx.h @@ -92,7 +92,7 @@ class Picture : public MemoryObject { virtual bool load(MfcArchive &file); void setAOIDs(); - void init(); + virtual void init(); void getDibInfo(); Bitmap *getPixelData(); virtual void draw(int x, int y, int style, int angle); diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp index 03cbc8ecd5..e31267fda9 100644 --- a/engines/fullpipe/statics.cpp +++ b/engines/fullpipe/statics.cpp @@ -1440,6 +1440,19 @@ bool Statics::load(MfcArchive &file) { return true; } +void Statics::init() { + Picture::init(); + + if (_staticsId & 0x4000) { + Bitmap *bmp = _bitmap->reverseImage(); + + freePixelData(); + + _bitmap = bmp; + _data = bmp->_pixels; + } +} + Common::Point *Statics::getSomeXY(Common::Point &p) { p.x = _someX; p.y = _someY; diff --git a/engines/fullpipe/statics.h b/engines/fullpipe/statics.h index be88b4ec2d..63661157b2 100644 --- a/engines/fullpipe/statics.h +++ b/engines/fullpipe/statics.h @@ -98,6 +98,7 @@ class Statics : public DynamicPhase { virtual ~Statics(); virtual bool load(MfcArchive &file); + virtual void init(); Statics *getStaticsById(int itemId); Common::Point *getSomeXY(Common::Point &p); -- cgit v1.2.3 From 28cb3e82d14a872d8b55bb192211c03af2dac7ed Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 2 May 2014 12:45:42 +0300 Subject: FULLPIPE: Implement StaticANIObject::~StaticANIObject() --- engines/fullpipe/statics.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp index e31267fda9..d15da94ab1 100644 --- a/engines/fullpipe/statics.cpp +++ b/engines/fullpipe/statics.cpp @@ -141,7 +141,17 @@ StaticANIObject::StaticANIObject() { } StaticANIObject::~StaticANIObject() { - warning("STUB: StaticANIObject::~StaticANIObject()"); + for (uint i = 0; i < _staticsList.size(); i++) + delete _staticsList[i]; + + _staticsList.clear(); + + for (uint i = 0; i < _movements.size(); i++) + delete _movements[i]; + + _movements.clear(); + + g_fp->_mgm->clear(); } StaticANIObject::StaticANIObject(StaticANIObject *src) : GameObject(src) { -- cgit v1.2.3 From dbbd7feab727e463f4aed0e9b496aaca99efddcd Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 3 May 2014 00:01:52 +0200 Subject: MADS: Implement scene 411 --- engines/mads/nebular/nebular_scenes.cpp | 7 +- engines/mads/nebular/nebular_scenes4.cpp | 753 ++++++++++++++++++++++++++++++- engines/mads/nebular/nebular_scenes4.h | 36 ++ 3 files changed, 790 insertions(+), 6 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index a3cfe8b4ed..b48109ddb6 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -180,14 +180,15 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene407(vm); case 408: return new Scene408(vm); - case 409: - // TODO case 410: return new Scene410(vm); case 411: - // TODO + return new Scene411(vm); case 413: // TODO + + case 409: + // TODO // Fall-through for unimplemented scenes in group #4 error("Invalid scene %d called", scene._nextSceneId); diff --git a/engines/mads/nebular/nebular_scenes4.cpp b/engines/mads/nebular/nebular_scenes4.cpp index 93ab7dd4d3..77f2d46e05 100644 --- a/engines/mads/nebular/nebular_scenes4.cpp +++ b/engines/mads/nebular/nebular_scenes4.cpp @@ -2375,7 +2375,7 @@ void Scene405::step() { _game._player._priorTimer = _scene->_frameStartTime + _game._player._ticksAmount ; _game._player._visible = true; _scene->_sequences.remove(_globals._sequenceIndexes[1]); - _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle (_globals._spriteIndexes[1], false, 6, 1, 0, 0); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 6, 1, 0, 0); _globals[kArmoryDoorOpen] = true; _game._player._stepEnabled = true; _globals._sequenceIndexes[2] = _scene->_sequences.startCycle (_globals._spriteIndexes[2], @@ -2564,7 +2564,7 @@ void Scene406::step() { if (_game._trigger == 75) { _scene->_sequences.remove(_globals._sequenceIndexes[1]); - _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle (_globals._spriteIndexes[1], false, 4, 1, 0, 0); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 4, 1, 0, 0); _globals[kStorageDoorOpen] = true; _game._player._stepEnabled = true; _game._player._priorTimer = _scene->_frameStartTime + _game._player._ticksAmount; @@ -2592,7 +2592,7 @@ void Scene406::actions() { _game._player._stepEnabled = false; _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _scene->_sequences.remove(_globals._sequenceIndexes[3]); - _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle (_globals._spriteIndexes[3], false, 3, 1, 0, 0); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 3, 1, 0, 0); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 80); _vm->_sound->command(19); } else if (_action.isAction(0x18B, 0x6E) && _globals[kStorageDoorOpen] && (_game._player._targetPos.x < 100)) @@ -3101,5 +3101,752 @@ void Scene410::actions() { /*------------------------------------------------------------------------*/ +bool Scene411::addIngredient() { + bool retVal = false; + + switch (_newIngredient) { + case OBJ_LECITHIN: + if (_globals[kIngredientList + _globals[kNextIngredient]] == 1) + retVal = true; + + _badThreshold = 1; + break; + + case OBJ_ALIEN_LIQUOR: + if (_globals[kIngredientList + _globals[kNextIngredient]] == 0) + retVal = true; + + _badThreshold = 0; + break; + + case OBJ_FORMALDEHYDE: + if (_globals[kIngredientList + _globals[kNextIngredient]] == 3) + retVal = true; + + _badThreshold = 3; + break; + + case OBJ_PETROX: + if (_globals[kIngredientList + _globals[kNextIngredient]] == 2) + retVal = true; + + _badThreshold = 2; + break; + + default: + break; + } + + if (!retVal && (_globals[kNextIngredient] == 0)) + _globals[kBadFirstIngredient] = _badThreshold; + + if (_globals[kNextIngredient] == 0) + retVal = true; + + return(retVal); +} + +bool Scene411::addQuantity() { + bool retVal = false; + + if (_globals[kIngredientQuantity + _globals[kNextIngredient]] == _newQuantity) + retVal = true; + + if (!retVal && (_globals[kNextIngredient] == 0)) + _globals[kBadFirstIngredient] = _badThreshold; + + if (_globals[kNextIngredient] == 0) + retVal = true; + + return(retVal); +} + +int Scene411::computeQuoteAndQuantity() { + int quoteId; + int quantity; + + switch (_action._activeAction._verbId) { + case 0x252: + quoteId = 0x26F; + quantity = 0; + break; + + case 0x253: + quoteId = 0x271; + quantity = 0; + break; + + case 0x254: + quoteId = 0x270; + quantity = 0; + break; + + case 0x255: + quoteId = 0x272; + quantity = 0; + break; + + case 0x256: + quoteId = 0x267; + quantity = 2; + break; + + case 0x257: + quoteId = 0x269; + quantity = 2; + break; + + case 0x258: + quoteId = 0x268; + quantity = 2; + break; + + case 0x259: + quoteId = 0x26A; + quantity = 2; + break; + + case 0x25A: + quoteId = 0x26B; + quantity = 3; + break; + + case 0x25B: + quoteId = 0x26D; + quantity = 3; + break; + + case 0x25C: + quoteId = 0x26C; + quantity = 3; + break; + + case 0x25D: + quoteId = 0x26E; + quantity = 3; + break; + + case 0x25E: + quoteId = 0x263; + quantity = 1; + break; + + case 0x25F: + quoteId = 0x265; + quantity = 1; + break; + + case 0x260: + quoteId = 0x264; + quantity = 1; + break; + + case 0x261: + quoteId = 0x266; + quantity = 1; + break; + + default: + quoteId = 0; + quantity = 0; + break; + } + + _scene->_kernelMessages.add(Common::Point(202, 82), 0x1110, 32, 0, 120, _game.getQuote(quoteId)); + return quantity; +} + +void Scene411::handleKettleAction() { + switch (_globals[kNextIngredient]) { + case (1): + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], + false, 15, 0, 0, 0); + break; + + case (2): + _scene->_sequences.remove(_globals._sequenceIndexes[4]); + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], + false, 6, 0, 0, 0); + break; + + case (3): + _makeMushroomCloud = true; + break; + + default: + break; + } +} + +void Scene411::handleDialog() { + if ((_action._activeAction._verbId != 0x262) && (_game._trigger == 0)) { + if (_game._objects.isInInventory(_newIngredient)) { + switch (_newIngredient) { + case OBJ_FORMALDEHYDE: + _resetFrame = 17; + break; + + case OBJ_PETROX: + _resetFrame = 55; + break; + + case OBJ_LECITHIN: + _resetFrame = 36; + break; + + default: + _resetFrame = 112; + break; + } + + _game._player._priorTimer = _scene->_frameStartTime + _game._player._ticksAmount; + _game._player._visible = false; + _game._player._stepEnabled = false; + _scene->_activeAnimation->setCurrentFrame(_resetFrame); + } + _scene->_kernelMessages.reset(); + _newQuantity = computeQuoteAndQuantity (); + + if ((_globals[kNextIngredient] == 1) && (_globals[kBadFirstIngredient] > -1)) + _killRox = true; + else if (addIngredient() && addQuantity()) { + handleKettleAction(); + _globals[kNextIngredient]++; + } else + _killRox = true; + + _scene->_userInterface.setup(kInputBuildingSentences); + } else if (_action._activeAction._verbId == 0x262) + _scene->_userInterface.setup(kInputBuildingSentences); +} + +void Scene411::giveToRex(int object) { + switch (object) { + case (0): + _game._objects.addToInventory(OBJ_ALIEN_LIQUOR); + break; + + case (1): + _game._objects.addToInventory(OBJ_LECITHIN); + break; + + case (2): + _game._objects.addToInventory(OBJ_PETROX); + break; + + case (3): + _game._objects.addToInventory(OBJ_FORMALDEHYDE); + break; + + default: + break; + } +} + +void Scene411::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(0xD); + _scene->addActiveVocab(0x306); + _scene->addActiveVocab(0x2D6); + _scene->addActiveVocab(0x2D7); + _scene->addActiveVocab(0x3A9); +} + +void Scene411::enter() { + if (_scene->_priorSceneId == 411) { + if ((_globals[kNextIngredient] == 1) && (_globals[kBadFirstIngredient] > -1)) + giveToRex(_globals[kBadFirstIngredient]); + else if (_globals[kNextIngredient] > 0) { + for (int i = 0; i < _globals[kNextIngredient]; i ++) + giveToRex(_globals[kIngredientList + i]); + } + _globals[kNextIngredient] = 0; + _globals[kBadFirstIngredient] = -1; + } + + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 0)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 1)); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('c', 0)); + _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('f', 0)); + _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('f', 1)); + _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('f', 2)); + _globals._spriteIndexes[9] = _scene->_sprites.addSprites(formAnimName('c', 1)); + _globals._spriteIndexes[10] = _scene->_sprites.addSprites(formAnimName('a', 6)); + _globals._spriteIndexes[11] = _scene->_sprites.addSprites(formAnimName('a', 1)); + _globals._spriteIndexes[8] = _scene->_sprites.addSprites("*ROXRC_9"); + + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 5, 0, 0, 0); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 50, 0, 0, 0); + + _game.loadQuoteSet(0x252, 0x25E, 0x25A, 0x256, 0x253, 0x25F, 0x25B, 0x257, 0x254, 0x260, 0x25C, 0x258, 0x255, + 0x261, 0x25D, 0x259, 0x262, 0x267, 0x263, 0x26B, 0x26F, 0x268, 0x264, 0x26C, 0x270, 0x26A, 0x266, 0x26E, + 0x272, 0x269, 0x265, 0x26D, 0x271, 0); + + _dialog1.setup(0x5B, 0x252, 0x25E, 0x25A, 0x256, 0x262, -1); + _dialog2.setup(0x5C, 0x253, 0x25F, 0x25B, 0x257, 0x262, -1); + _dialog3.setup(0x5D, 0x254, 0x260, 0x25C, 0x258, 0x262, -1); + _dialog4.setup(0x5E, 0x255, 0x261, 0x25D, 0x259, 0x262, -1); + + warning("TODO: Replace the next line by: if ((_globals[kNextIngredient] >= 4) && (!object_get_folder(OBJ_CHARGE_CASES, 3))) {"); + if (_globals[kNextIngredient] >= 4) { + _scene->_hotspots.activate(0x3AB, false); + _scene->_hotspots.activate(0x30D, true); + } else { + _scene->_hotspots.activate(0x30D, false); + _scene->_hotspots.activate(0x3AB, true); + } + + warning("TODO: Replace the next line by: if ((!_globals[kNextIngredient] >= 4) && (object_get_folder(OBJ_CHARGE_CASES, 3))) {"); + if (!(_globals[kNextIngredient] >= 4)) + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], true, 6); + else if (true) { + warning("TODO: The previous if was: else if (!object_get_folder(OBJ_CHARGE_CASES, 3)) {"); + switch (_globals[kNextIngredient]) { + case 1: + _vm->_sound->command(53); + break; + + case 2: + _vm->_sound->command(53); + _vm->_sound->command(54); + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 15, 0, 0, 0); + break; + + case 3: + _vm->_sound->command(53); + _vm->_sound->command(54); + _vm->_sound->command(55); + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 6, 0, 0, 0); + break; + + case (4): + _vm->_sound->command(53); + _vm->_sound->command(54); + _vm->_sound->command(55); + _vm->_sound->command(56); + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 6, 0, 0, 0); + break; + + default: + _vm->_sound->command(10); + break; + } + } + + warning("TODO: Replace the next if by: if ((_globals[kNextIngredient] >= 4) && (object_get_folder(OBJ_CHARGE_CASES, 3))) {"); + if (_globals[kNextIngredient] >= 4) { + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], true, 6); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 1); + } + + if (_game._objects.isInRoom(OBJ_FORMALDEHYDE)) { + _globals._sequenceIndexes[7] = _scene->_sequences.startCycle(_globals._spriteIndexes[7], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 1); + int idx = _scene->_dynamicHotspots.add(0x2D6, VERB_WALKTO, _globals._sequenceIndexes[7], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(206, 145), FACING_SOUTHEAST); + } + + if (_game._objects.isInRoom(OBJ_PETROX)) { + _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 8); + int idx = _scene->_dynamicHotspots.add(0x2D7, VERB_WALKTO, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(186, 112), FACING_NORTHEAST); + } + + if (_game._objects.isInRoom(OBJ_LECITHIN)) { + _globals._sequenceIndexes[6] = _scene->_sequences.startCycle(_globals._spriteIndexes[6], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 8); + int idx = _scene->_dynamicHotspots.add(0x3A9, VERB_WALKTO, _globals._sequenceIndexes[6], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(220, 121), FACING_NORTHEAST); + } + + if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(60, 146); + _game._player._facing = FACING_NORTHEAST; + } + + sceneEntrySound(); + + if (_scene->_roomChanged) { + _game._objects.addToInventory(OBJ_ALIEN_LIQUOR); + _game._objects.addToInventory(OBJ_CHARGE_CASES); + _game._objects.addToInventory(OBJ_TAPE_PLAYER); + _game._objects.addToInventory(OBJ_AUDIO_TAPE); + } + + _scene->loadAnimation(formAnimName('a', -1)); + _scene->_activeAnimation->setCurrentFrame(128); + + _makeMushroomCloud = false; + _killRox = false; +} + +void Scene411::step() { + if (_scene->_activeAnimation != nullptr) { + if (_curAnimationFrame != _scene->_activeAnimation->getCurrentFrame()) { + _curAnimationFrame = _scene->_activeAnimation->getCurrentFrame(); + _resetFrame = -1; + + switch (_curAnimationFrame) { + case 16: + _game._player._stepEnabled = true; + _game._player._priorTimer = _scene->_frameStartTime + _game._player._ticksAmount; + _game._player._visible = true; + _resetFrame = 128; + break; + + case 35: + case 54: + case 71: + case 127: + if (_killRox) { + _resetFrame = 72; + } else { + _resetFrame = 0; + _game._objects.removeFromInventory(_newIngredient, NOWHERE); + switch (_globals[kNextIngredient]) { + case 1: + _vm->_sound->command(53); + break; + + case 2: + _vm->_sound->command(54); + break; + + case 3: + _vm->_sound->command(55); + break; + + case 4: + _vm->_sound->command(56); + break; + + default: + break; + } + } + break; + + case (22): + case (41): + case (59): + case (115): + if (_makeMushroomCloud) { + _globals._sequenceIndexes[9] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 5, 1, 0, 0); + _makeMushroomCloud = false; + _scene->_hotspots.activate(0x3AB, false); + _scene->_hotspots.activate(0x30D, true); + } + break; + + case 111: + _resetFrame = 111; + _scene->_reloadSceneFlag = true; + break; + + case 129: + _resetFrame = 128; + break; + + default: + break; + } + + if ((_resetFrame >= 0) && (_resetFrame != _scene->_activeAnimation->getCurrentFrame())) { + _scene->_activeAnimation->setCurrentFrame(_resetFrame); + _curAnimationFrame = _resetFrame; + } + } + } + + if (_scene->_activeAnimation->getCurrentFrame() == 86) + _vm->_sound->command(59); +} + +void Scene411::preActions() { + if (_action.isAction(VERB_LOOK, 0x2D7) && (_game._objects.isInRoom(OBJ_PETROX))) + _game._player._needToWalk = true; + + if (_action.isAction(VERB_LOOK, 0x3A9) && (_game._objects.isInRoom(OBJ_LECITHIN))) + _game._player._needToWalk = true; + + if (_action.isAction(VERB_LOOK, 0x2D6) && (_game._objects.isInRoom(OBJ_FORMALDEHYDE))) + _game._player._needToWalk = true; + + if (_action.isAction(VERB_LOOK, 0x3AB) || _action.isAction(VERB_LOOK, 0x30D) || _action.isAction(VERB_LOOK, 0x47F) || + _action.isAction(VERB_LOOK, 0x24D) || _action.isAction(VERB_LOOK, 0x216) || _action.isAction(VERB_PUT, 0x216) || + _action.isAction(VERB_LOOK, 0x284) || _action.isAction(VERB_LOOK, 0x285)) + _game._player._needToWalk = true; + + if (_action.isAction(VERB_PULL, 0x280) || _action.isAction(VERB_PUSH, 0x280)) + _game._player._needToWalk = false; +} + +void Scene411::actions() { + if (_game._screenObjects._inputMode != 1) { + handleDialog(); + _action._inProgress = false; + return; + } + + if (_action.isAction(0x242, 0x2B3)) { + _scene->_nextSceneId = 406; + _vm->_sound->command(10); + _action._inProgress = false; + return; + } + + warning("TODO: add the following condition to the if statement: (!object_get_folder(OBJ_CHARGE_CASES, 3)) &&"); + if ((_globals[kNextIngredient] >= 4) && (_action.isAction(VERB_TAKE, 0x3AB) || _action.isAction(VERB_PUT, 0x48, 0x3AB)) && + (_game._objects.isInInventory(OBJ_CHARGE_CASES))) { + switch (_game._trigger) { + case 0: + _vm->_sound->command(10); + _vm->_sound->command(57); + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[10] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[10], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[10], 1, 6); + _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 3); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[10], SEQUENCE_TRIGGER_EXPIRE, 0, 110); + break; + + case 110: { + int idx = _globals._sequenceIndexes[10]; + _globals._sequenceIndexes[10] = _scene->_sequences.startCycle(_globals._spriteIndexes[10], false, 6); + _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 3); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[10], idx); + _scene->_sequences.addTimer(180, 111); + } + break; + + case 111: + _scene->_hotspots.activate(0x30D, true); + _scene->_hotspots.activate(0x3AB, false); + _scene->_sequences.remove(_globals._sequenceIndexes[4]); + _scene->_sequences.remove(_globals._sequenceIndexes[10]); + + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], true, 6); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 1); + + _globals._sequenceIndexes[10] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[10], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[10], 1, 6); + _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 3); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[10], SEQUENCE_TRIGGER_EXPIRE, 0, 112); + // No break on purpose + case 112: + _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; + _game._player._visible = true; + _game._player._stepEnabled = true; + warning("TODO: InventoryObjects_setData(OBJ_CHARGE_CASES, 3, true);"); + _vm->_dialogs->showItem(OBJ_CHARGE_CASES, 41142); + break; + } + _action._inProgress = false; + return; + } else if (!_game._objects.isInInventory(OBJ_CHARGE_CASES) && _action.isAction(VERB_TAKE, 0x3AB)) { + _vm->_dialogs->show(41143); + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_TAKE, 0x2D7) && (_game._objects.isInRoom(OBJ_PETROX) || _game._trigger)) { + switch (_game._trigger) { + case (0): + _vm->_sound->command(57); + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[8] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[8], false, 7, 2, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[8], 1, 2); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[8]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_SPRITE, 2, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + + case 1: + _scene->_sequences.remove(_globals._sequenceIndexes[5]); + _game._objects.addToInventory(OBJ_PETROX); + _vm->_dialogs->showItem(OBJ_PETROX, 41120); + break; + + case 2: + _game._player._priorTimer = _scene->_frameStartTime + _game._player._ticksAmount; + _game._player._priorTimer = _scene->_frameStartTime + _game._player._ticksAmount; + _game._player._visible = true; + _scene->_sequences.addTimer(20, 3); + break; + + case 3: + _game._player._stepEnabled = true; + break; + + default: + break; + } + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_TAKE, 0x3A9) && (_game._objects.isInRoom(OBJ_LECITHIN) || _game._trigger)) { + switch (_game._trigger) { + case (0): + _vm->_sound->command(57); + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[8] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[8], false, 7, 2, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[8], 1, 2); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[8]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_SPRITE, 2, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + + case 1: + _scene->_sequences.remove(_globals._sequenceIndexes[6]); + _game._objects.addToInventory(OBJ_LECITHIN); + _vm->_dialogs->showItem(OBJ_LECITHIN, 41124); + break; + + case 2: + _game._player._priorTimer = _scene->_frameStartTime + _game._player._ticksAmount; + _game._player._visible = true; + _scene->_sequences.addTimer(20, 3); + break; + + case 3: + _game._player._stepEnabled = true; + break; + + default: + break; + } + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_TAKE, 0x2D6) && _game._objects.isInRoom(OBJ_FORMALDEHYDE) && (_game._trigger == 0)) { + _vm->_sound->command(57); + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[11] = _scene->_sequences.startCycle(_globals._spriteIndexes[11], false, 2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[11], 1); + _scene->_sequences.addTimer(20, 100); + _scene->_sequences.remove(_globals._sequenceIndexes[7]); + _game._objects.addToInventory(OBJ_FORMALDEHYDE); + _action._inProgress = false; + return; + } + + if (_game._trigger == 100) { + _scene->_sequences.remove(_globals._sequenceIndexes[11]); + _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; + _game._player._visible = true; + _game._player._stepEnabled = true; + _scene->_sequences.addTimer(20, 10); + } + + if (_game._trigger == 10) + _vm->_dialogs->showItem(OBJ_FORMALDEHYDE, 41124); + + if (_action.isAction(VERB_PUT, 0x30D)) { + if (_action.isAction(0x2D7) || _action.isAction(0x2D6) || _action.isAction(0x3A9) || _action.isAction(0x306)) { + _newIngredient = _game._objects.getIdFromDesc(_action._activeAction._objectNameId); + switch (_newIngredient) { + case (OBJ_ALIEN_LIQUOR): + _dialog1.start(); + break; + + case (OBJ_FORMALDEHYDE): + _dialog3.start(); + break; + + case (OBJ_PETROX): + _dialog4.start(); + break; + + case (OBJ_LECITHIN): + _dialog2.start(); + break; + + default: + break; + } + } + } + + + if (_action.isAction(VERB_LOOK, 0xE2)) + _vm->_dialogs->show(41110); + else if (_action.isAction(VERB_LOOK, 0x287)) + _vm->_dialogs->show(41111); + else if (_action.isAction(VERB_LOOK, 0x27B)) + _vm->_dialogs->show(41112); + else if (_action.isAction(VERB_LOOK, 0x280)) + _vm->_dialogs->show(41113); + else if (_action.isAction(VERB_PUSH, 0x280) || _action.isAction(VERB_PULL, 0x280)) + _vm->_dialogs->show(41114); + else if (_action.isAction(VERB_LOOK, 0x283)) + _vm->_dialogs->show(41115); + else if (_action.isAction(VERB_TAKE, 0x283)) + _vm->_dialogs->show(41116); + else if (_action.isAction(VERB_LOOK, 0x285)) + _vm->_dialogs->show(41117); + else if (_action.isAction(VERB_LOOK, 0x284)) + _vm->_dialogs->show(41118); + else if (_action.isAction(VERB_LOOK, 0x2D7) && _game._objects.isInRoom(OBJ_PETROX)) + _vm->_dialogs->show(41119); + else if (_action.isAction(VERB_LOOK, 0x24D)) + _vm->_dialogs->show(41121); + else if ((_action.isAction(VERB_LOOK, 0x2D6)) && (_game._objects.isInRoom(OBJ_FORMALDEHYDE))) + _vm->_dialogs->show(41122); + else if ((_action.isAction(VERB_LOOK, 0x3A9)) && (_game._objects.isInRoom(OBJ_LECITHIN))) + _vm->_dialogs->show(41123); + else if (_action.isAction(VERB_LOOK, 0x30D)) { + if (_globals[kNextIngredient] > 0) { + warning("TODO: the if statement should be: if ((_globals[kNextIngredient] > 0) && !object_get_folder(OBJ_CHARGE_CASES, 3))"); + _vm->_dialogs->show(41126); + } else if (_globals[kNextIngredient] == 0) { + warning("TODO: the if statement should be: else if ((_globals[kNextIngredient] == 0) || object_get_folder(OBJ_CHARGE_CASES, 3)) {"); + _vm->_dialogs->show(41125); + } + } else if (_action.isAction(VERB_LOOK, 0x3AB)) { + warning("TODO: The if statement should be if (_action.isAction(VERB_LOOK, 0x3AB) && !object_get_folder(OBJ_CHARGE_CASES, 3)) {"); + _vm->_dialogs->show(41127); + } else if (_action.isAction(VERB_TAKE, 0x30D)) + _vm->_dialogs->show(41128); + else if (_action.isAction(VERB_LOOK, 0x59)) + _vm->_dialogs->show(41129); + else if (_action.isAction(VERB_LOOK, 0x47F)) + _vm->_dialogs->show(41130); + else if (_action.isAction(VERB_LOOK, 0x2B3)) + _vm->_dialogs->show(41131); + else if (_action._lookFlag) + _vm->_dialogs->show(41132); + else if (_action.isAction(VERB_LOOK, 0x27C)) + _vm->_dialogs->show(41133); + else if (_action.isAction(VERB_LOOK, 0x218)) + _vm->_dialogs->show(41134); + else if (_action.isAction(VERB_LOOK, 0x282)) + _vm->_dialogs->show(41135); + else if (_action.isAction(VERB_LOOK, 0x10C)) + _vm->_dialogs->show(41136); + else if (_action.isAction(VERB_LOOK, 0x216)) + _vm->_dialogs->show(41137); + else if (_action.isAction(VERB_PUT, 0x216)) + _vm->_dialogs->show(41138); + else if (_action.isAction(VERB_TAKE, 0x284)) + _vm->_dialogs->show(41139); + else if (_action.isAction(VERB_LOOK, 0x47E)) + _vm->_dialogs->show(41140); + else if (_action.isAction(VERB_TAKE, 0x47E)) + _vm->_dialogs->show(41141); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes4.h b/engines/mads/nebular/nebular_scenes4.h index 2b96b7e7ef..2540c5e2e1 100644 --- a/engines/mads/nebular/nebular_scenes4.h +++ b/engines/mads/nebular/nebular_scenes4.h @@ -194,6 +194,42 @@ public: virtual void actions(); virtual void postActions() {}; }; + +class Scene411: public Scene4xx { +private: + int _curAnimationFrame; + int _newIngredient; + int _newQuantity; + int _resetFrame; + int _badThreshold; + + bool _killRox; + bool _makeMushroomCloud; + + Conversation _dialog1; + Conversation _dialog2; + Conversation _dialog3; + Conversation _dialog4; + + void giveToRex(int object); + void handleDialog(); + void handleKettleAction(); + + int computeQuoteAndQuantity(); + + bool addQuantity(); + bool addIngredient(); + +public: + Scene411(MADSEngine *vm) : Scene4xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From a54aeaccce5d3db455a0017ce302065b29e6c215 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 2 May 2014 21:29:33 -0400 Subject: MADS: Misc savegame fixes and added meta query info --- engines/mads/detection.cpp | 9 ++++++++- engines/mads/events.cpp | 3 --- engines/mads/events.h | 3 +++ engines/mads/game.cpp | 5 +++-- engines/mads/game_data.cpp | 2 +- engines/mads/mads.cpp | 8 +++++--- 6 files changed, 20 insertions(+), 10 deletions(-) diff --git a/engines/mads/detection.cpp b/engines/mads/detection.cpp index 49253f0e3a..971acde024 100644 --- a/engines/mads/detection.cpp +++ b/engines/mads/detection.cpp @@ -31,6 +31,7 @@ #include "common/system.h" #include "graphics/colormasks.h" #include "graphics/surface.h" +#include "mads/events.h" #include "mads/game.h" #define MAX_SAVES 99 @@ -168,10 +169,16 @@ SaveStateDescriptor MADSMetaEngine::querySaveMetaInfos(const char *target, int s Common::InSaveFile *f = g_system->getSavefileManager()->openForLoading(filename); if (f) { + MADS::MADSSavegameHeader header; + MADS::Game::readSavegameHeader(f, header); delete f; // Create the return descriptor - SaveStateDescriptor desc(slot, ""); + SaveStateDescriptor desc(slot, header._saveName); + desc.setThumbnail(header._thumbnail); + desc.setSaveDate(header._year, header._month, header._day); + desc.setSaveTime(header._hour, header._minute); + desc.setPlayTime(header._totalFrames * GAME_FRAME_TIME); return desc; } diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp index 6ec16402ef..5d6a16ff1f 100644 --- a/engines/mads/events.cpp +++ b/engines/mads/events.cpp @@ -28,9 +28,6 @@ #include "mads/events.h" #include "mads/scene.h" -#define GAME_FRAME_RATE 50 -#define GAME_FRAME_TIME (1000 / GAME_FRAME_RATE) - namespace MADS { EventsManager::EventsManager(MADSEngine *vm) { diff --git a/engines/mads/events.h b/engines/mads/events.h index 6428108709..5f9a899f65 100644 --- a/engines/mads/events.h +++ b/engines/mads/events.h @@ -34,6 +34,9 @@ namespace MADS { enum CursorType { CURSOR_NONE = 0, CURSOR_ARROW = 1, CURSOR_WAIT = 2, CURSOR_GO_DOWN = 3, CURSOR_GO_UP = 4, CURSOR_GO_LEFT = 5, CURSOR_GO_RIGHT = 6 }; +#define GAME_FRAME_RATE 50 +#define GAME_FRAME_TIME (1000 / GAME_FRAME_RATE) + class MADSEngine; class EventsManager { diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 36b0c315d7..a63fec424e 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -519,7 +519,7 @@ const char *const SAVEGAME_STR = "MADS"; bool Game::readSavegameHeader(Common::InSaveFile *in, MADSSavegameHeader &header) { char saveIdentBuffer[SAVEGAME_STR_SIZE + 1]; - header._thumbnail = NULL; + header._thumbnail = nullptr; // Validate the header Id in->read(saveIdentBuffer, SAVEGAME_STR_SIZE + 1); @@ -558,7 +558,8 @@ void Game::writeSavegameHeader(Common::OutSaveFile *out, MADSSavegameHeader &hea out->writeByte(MADS_SAVEGAME_VERSION); // Write savegame name - out->write(header._saveName.c_str(), header._saveName.size() + 1); + out->write(header._saveName.c_str(), header._saveName.size()); + out->writeByte('\0'); // Get the active palette uint8 thumbPalette[256 * 3]; diff --git a/engines/mads/game_data.cpp b/engines/mads/game_data.cpp index 4a9d02c75f..0e2dcec70f 100644 --- a/engines/mads/game_data.cpp +++ b/engines/mads/game_data.cpp @@ -47,7 +47,7 @@ bool VisitedScenes::exists(int sceneId) { } void VisitedScenes::synchronize(Common::Serializer &s) { - SynchronizedList:synchronize(s); + SynchronizedList::synchronize(s); s.syncAsByte(_sceneRevisited); } diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index 29db804f16..a099f5904e 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -122,13 +122,15 @@ int MADSEngine::hypotenuse(int xv, int yv) { } bool MADSEngine::canLoadGameStateCurrently() { - return !_game->_winStatus && !_game->globals()[5] - && _dialogs->_pendingDialog == DIALOG_NONE; + return !_game->_winStatus && !_game->globals()[5] + && _dialogs->_pendingDialog == DIALOG_NONE + && _events->_cursorId == CURSOR_ARROW; } bool MADSEngine::canSaveGameStateCurrently() { return !_game->_winStatus && !_game->globals()[5] - && _dialogs->_pendingDialog == DIALOG_NONE; + && _dialogs->_pendingDialog == DIALOG_NONE + && _events->_cursorId == CURSOR_ARROW; } /** -- cgit v1.2.3 From 2975ef3ebeffe1beb6857c0cc0336d2dd515440d Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 3 May 2014 11:18:47 +0300 Subject: FULLPIPE: Implement FullpipeEngine::stopAllSounds() --- engines/fullpipe/sound.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp index 3c13bad854..06e664faf9 100644 --- a/engines/fullpipe/sound.cpp +++ b/engines/fullpipe/sound.cpp @@ -298,8 +298,12 @@ void FullpipeEngine::startSoundStream1(char *trackName) { } void FullpipeEngine::stopAllSounds() { - // TODO: Differences from stopAllSoundStreams() - _mixer->stopAll(); + // _mixer->stopAll(); + + for (int i = 0; i < _currSoundListCount; i++) + for (int j = 0; i < _currSoundList1[i]->getCount(); j++) { + _currSoundList1[i]->getSoundByIndex(j)->stop(); + } } void FullpipeEngine::toggleMute() { -- cgit v1.2.3 From a708e4ffc9daaece6a2fae8512c0f754101ec945 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 3 May 2014 11:22:45 +0300 Subject: FULLPIPE: Implement FullpipeEngine::setMusicVolume() --- engines/fullpipe/sound.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp index 06e664faf9..3578e2a1df 100644 --- a/engines/fullpipe/sound.cpp +++ b/engines/fullpipe/sound.cpp @@ -451,7 +451,7 @@ void FullpipeEngine::updateSoundVolume() { void FullpipeEngine::setMusicVolume(int vol) { _musicVolume = vol; - debug(3, "STUB FullpipeEngine::setMusicVolume()"); + g_fp->_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, vol); } } // End of namespace Fullpipe -- cgit v1.2.3 From 9630e28bd986494b3f8cc3059685ced27705df94 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 3 May 2014 11:37:13 +0300 Subject: FULLPIPE: Implement FullpipeEngine::restartGame() --- engines/fullpipe/fullpipe.cpp | 35 ++++++++++++++++++++++++++++++++++- engines/fullpipe/gameloader.cpp | 4 ++++ engines/fullpipe/gameloader.h | 2 ++ 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp index 5369c05de7..539781679d 100644 --- a/engines/fullpipe/fullpipe.cpp +++ b/engines/fullpipe/fullpipe.cpp @@ -37,6 +37,7 @@ #include "fullpipe/scenes.h" #include "fullpipe/floaters.h" #include "fullpipe/console.h" +#include "fullpipe/constants.h" namespace Fullpipe { @@ -205,7 +206,39 @@ void FullpipeEngine::initialize() { } void FullpipeEngine::restartGame() { - warning("STUB: FullpipeEngine::restartGame()"); + _floaters->stopAll(); + + clearGlobalMessageQueueList(); + clearMessages(); + + initObjectStates(); + + if (_scene2) { + _scene2->getAniMan(); + _scene2 = 0; + } + + if (_currentScene) { + _gameLoader->unloadScene(_currentScene->_sceneId); + + _currentScene = 0; + } + + _gameLoader->restoreDefPicAniInfos(); + + getGameLoaderInventory()->clear(); + getGameLoaderInventory()->addItem(ANI_INV_MAP, 1); + getGameLoaderInventory()->rebuildItemRects(); + + initMap(); + + if (_flgPlayIntro) { + _gameLoader->loadScene(SC_INTRO1); + _gameLoader->gotoScene(SC_INTRO1, TrubaUp); + } else { + _gameLoader->loadScene(SC_1); + _gameLoader->gotoScene(SC_1, TrubaLeft); + } } Common::Error FullpipeEngine::run() { diff --git a/engines/fullpipe/gameloader.cpp b/engines/fullpipe/gameloader.cpp index 5c528c41f8..c8b01939dd 100644 --- a/engines/fullpipe/gameloader.cpp +++ b/engines/fullpipe/gameloader.cpp @@ -634,6 +634,10 @@ bool readSavegameHeader(Common::InSaveFile *in, FullpipeSavegameHeader &header) return true; } +void GameLoader::restoreDefPicAniInfos() { + warning("STUB: restoreDefPicAniInfos()"); +} + GameVar *FullpipeEngine::getGameLoaderGameVar() { if (_gameLoader) return _gameLoader->_gameVar; diff --git a/engines/fullpipe/gameloader.h b/engines/fullpipe/gameloader.h index 0796396549..772cc51130 100644 --- a/engines/fullpipe/gameloader.h +++ b/engines/fullpipe/gameloader.h @@ -100,6 +100,8 @@ class GameLoader : public CObject { void readSavegame(const char *fname); void writeSavegame(Scene *sc, const char *fname); + void restoreDefPicAniInfos(); + GameProject *_gameProject; InteractionController *_interactionController; InputController *_inputController; -- cgit v1.2.3 From 5e455e489fe252b9833db03e2186a46d79fec9a0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 3 May 2014 13:02:02 +0200 Subject: MADS: Implement scene 413 --- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes4.cpp | 195 +++++++++++++++++++++++++++---- engines/mads/nebular/nebular_scenes4.h | 16 +++ 3 files changed, 187 insertions(+), 26 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index b48109ddb6..0a92cd3bd1 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -185,7 +185,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 411: return new Scene411(vm); case 413: - // TODO + return new Scene413(vm); case 409: // TODO diff --git a/engines/mads/nebular/nebular_scenes4.cpp b/engines/mads/nebular/nebular_scenes4.cpp index 77f2d46e05..9d20c687e7 100644 --- a/engines/mads/nebular/nebular_scenes4.cpp +++ b/engines/mads/nebular/nebular_scenes4.cpp @@ -3016,7 +3016,7 @@ void Scene410::actions() { case (0): _vm->_sound->command(57); _game._player._stepEnabled = false; - _game._player._visible = false; + _game._player._visible = false; _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 7, 2, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 3); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[2]); @@ -3107,7 +3107,7 @@ bool Scene411::addIngredient() { switch (_newIngredient) { case OBJ_LECITHIN: if (_globals[kIngredientList + _globals[kNextIngredient]] == 1) - retVal = true; + retVal = true; _badThreshold = 1; break; @@ -3254,7 +3254,7 @@ int Scene411::computeQuoteAndQuantity() { _scene->_kernelMessages.add(Common::Point(202, 82), 0x1110, 32, 0, 120, _game.getQuote(quoteId)); return quantity; -} +} void Scene411::handleKettleAction() { switch (_globals[kNextIngredient]) { @@ -3379,14 +3379,14 @@ void Scene411::enter() { _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 5, 0, 0, 0); _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 50, 0, 0, 0); - _game.loadQuoteSet(0x252, 0x25E, 0x25A, 0x256, 0x253, 0x25F, 0x25B, 0x257, 0x254, 0x260, 0x25C, 0x258, 0x255, + _game.loadQuoteSet(0x252, 0x25E, 0x25A, 0x256, 0x253, 0x25F, 0x25B, 0x257, 0x254, 0x260, 0x25C, 0x258, 0x255, 0x261, 0x25D, 0x259, 0x262, 0x267, 0x263, 0x26B, 0x26F, 0x268, 0x264, 0x26C, 0x270, 0x26A, 0x266, 0x26E, 0x272, 0x269, 0x265, 0x26D, 0x271, 0); - _dialog1.setup(0x5B, 0x252, 0x25E, 0x25A, 0x256, 0x262, -1); - _dialog2.setup(0x5C, 0x253, 0x25F, 0x25B, 0x257, 0x262, -1); - _dialog3.setup(0x5D, 0x254, 0x260, 0x25C, 0x258, 0x262, -1); - _dialog4.setup(0x5E, 0x255, 0x261, 0x25D, 0x259, 0x262, -1); + _dialog1.setup(0x5B, 0x252, 0x25E, 0x25A, 0x256, 0x262, -1); + _dialog2.setup(0x5C, 0x253, 0x25F, 0x25B, 0x257, 0x262, -1); + _dialog3.setup(0x5D, 0x254, 0x260, 0x25C, 0x258, 0x262, -1); + _dialog4.setup(0x5E, 0x255, 0x261, 0x25D, 0x259, 0x262, -1); warning("TODO: Replace the next line by: if ((_globals[kNextIngredient] >= 4) && (!object_get_folder(OBJ_CHARGE_CASES, 3))) {"); if (_globals[kNextIngredient] >= 4) { @@ -3445,21 +3445,21 @@ void Scene411::enter() { _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 1); int idx = _scene->_dynamicHotspots.add(0x2D6, VERB_WALKTO, _globals._sequenceIndexes[7], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(206, 145), FACING_SOUTHEAST); - } + } if (_game._objects.isInRoom(OBJ_PETROX)) { _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 8); int idx = _scene->_dynamicHotspots.add(0x2D7, VERB_WALKTO, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(186, 112), FACING_NORTHEAST); - } + } if (_game._objects.isInRoom(OBJ_LECITHIN)) { _globals._sequenceIndexes[6] = _scene->_sequences.startCycle(_globals._spriteIndexes[6], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 8); int idx = _scene->_dynamicHotspots.add(0x3A9, VERB_WALKTO, _globals._sequenceIndexes[6], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(220, 121), FACING_NORTHEAST); - } + } if (_scene->_priorSceneId != -2) { _game._player._playerPos = Common::Point(60, 146); @@ -3501,9 +3501,9 @@ void Scene411::step() { case 71: case 127: if (_killRox) { - _resetFrame = 72; + _resetFrame = 72; } else { - _resetFrame = 0; + _resetFrame = 0; _game._objects.removeFromInventory(_newIngredient, NOWHERE); switch (_globals[kNextIngredient]) { case 1: @@ -3595,7 +3595,7 @@ void Scene411::actions() { _vm->_sound->command(10); _action._inProgress = false; return; - } + } warning("TODO: add the following condition to the if statement: (!object_get_folder(OBJ_CHARGE_CASES, 3)) &&"); if ((_globals[kNextIngredient] >= 4) && (_action.isAction(VERB_TAKE, 0x3AB) || _action.isAction(VERB_PUT, 0x48, 0x3AB)) && @@ -3604,8 +3604,8 @@ void Scene411::actions() { case 0: _vm->_sound->command(10); _vm->_sound->command(57); - _game._player._stepEnabled = false; - _game._player._visible = false; + _game._player._stepEnabled = false; + _game._player._visible = false; _globals._sequenceIndexes[10] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[10], false, 8, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[10], 1, 6); _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 3); @@ -3655,8 +3655,8 @@ void Scene411::actions() { switch (_game._trigger) { case (0): _vm->_sound->command(57); - _game._player._stepEnabled = false; - _game._player._visible = false; + _game._player._stepEnabled = false; + _game._player._visible = false; _globals._sequenceIndexes[8] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[8], false, 7, 2, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[8], 1, 2); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[8]); @@ -3673,7 +3673,7 @@ void Scene411::actions() { case 2: _game._player._priorTimer = _scene->_frameStartTime + _game._player._ticksAmount; _game._player._priorTimer = _scene->_frameStartTime + _game._player._ticksAmount; - _game._player._visible = true; + _game._player._visible = true; _scene->_sequences.addTimer(20, 3); break; @@ -3692,8 +3692,8 @@ void Scene411::actions() { switch (_game._trigger) { case (0): _vm->_sound->command(57); - _game._player._stepEnabled = false; - _game._player._visible = false; + _game._player._stepEnabled = false; + _game._player._visible = false; _globals._sequenceIndexes[8] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[8], false, 7, 2, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[8], 1, 2); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[8]); @@ -3709,7 +3709,7 @@ void Scene411::actions() { case 2: _game._player._priorTimer = _scene->_frameStartTime + _game._player._ticksAmount; - _game._player._visible = true; + _game._player._visible = true; _scene->_sequences.addTimer(20, 3); break; @@ -3726,8 +3726,8 @@ void Scene411::actions() { if (_action.isAction(VERB_TAKE, 0x2D6) && _game._objects.isInRoom(OBJ_FORMALDEHYDE) && (_game._trigger == 0)) { _vm->_sound->command(57); - _game._player._stepEnabled = false; - _game._player._visible = false; + _game._player._stepEnabled = false; + _game._player._visible = false; _globals._sequenceIndexes[11] = _scene->_sequences.startCycle(_globals._spriteIndexes[11], false, 2); _scene->_sequences.setDepth(_globals._sequenceIndexes[11], 1); _scene->_sequences.addTimer(20, 100); @@ -3740,7 +3740,7 @@ void Scene411::actions() { if (_game._trigger == 100) { _scene->_sequences.remove(_globals._sequenceIndexes[11]); _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; - _game._player._visible = true; + _game._player._visible = true; _game._player._stepEnabled = true; _scene->_sequences.addTimer(20, 10); } @@ -3848,5 +3848,150 @@ void Scene411::actions() { /*------------------------------------------------------------------------*/ +void Scene413::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene413::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('a', 2)); + _rexDeath = false; + + if (_scene->_priorSceneId == 405) { + _game._player._playerPos = Common::Point(142, 146); + _game._player._facing = FACING_NORTH; + _game._player._visible = true; + } else if (_scene->_priorSceneId != -2) { + if (_globals[kSexOfRex] == REX_MALE) { + _scene->loadAnimation(Resources::formatName(413, 'd', 1, EXT_AA, ""), 78); + _vm->_sound->command(30); + _game._player._visible = false; + _game._player._stepEnabled = false; + _rexDeath = true; + } else if (!_globals[kTeleporterCommand]) { + _game._player._playerPos = Common::Point(136, 117); + _game._player.walk(Common::Point(141, 130), FACING_SOUTH); + _game._player._facing = FACING_SOUTH; + _game._player._visible = true; + } + } + + if ((_globals[kTeleporterCommand]) && (!_rexDeath)) { + switch (_globals[kTeleporterCommand]) { + case 1: + _vm->_sound->command(30); + _game._player._visible = false; + _globals._sequenceIndexes[1] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 7, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 1, 19); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 8); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 76); + break; + + case 2: + _game._player._visible = false; + _vm->_sound->command(30); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 7, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 1, 20); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 8); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 77); + break; + + case 3: + case 4: + _game._player._playerPos = Common::Point(136, 117); + _game._player._facing = FACING_SOUTH; + _game._player.walk(Common::Point(141, 130), FACING_SOUTH); + _game._player._visible = true; + _game._player._stepEnabled = true; + break; + + default: + break; + } + _globals[kTeleporterCommand] = 0; + } + + _canMove = true; + sceneEntrySound(); +} + +void Scene413::step() { + if (_scene->_activeAnimation->getCurrentFrame() == 38) + _scene->_activeAnimation->setCurrentFrame(37); + + if ((_scene->_activeAnimation->getCurrentFrame() == 21) && _canMove) { + _vm->_sound->command(27); + _canMove = false; + } + + if (_game._trigger == 76) { + _game._player._playerPos = Common::Point(136, 117); + _game._player.walk(Common::Point(141, 130), FACING_SOUTH); + _game._player._facing = FACING_SOUTH; + _game._player.selectSeries(); + _game._player._visible = true; + _game._player._stepEnabled = true; + } + + if (_game._trigger == 77) { + _globals[kTeleporterCommand] = TELEPORTER_BEAM_IN; + _scene->_nextSceneId = _globals[kTeleporterDestination]; + _scene->_reloadSceneFlag = true; + } + + if (_game._trigger == 78) { + _scene->_reloadSceneFlag = true; + _scene->_nextSceneId = _scene->_priorSceneId; + _globals[kTeleporterCommand] = TELEPORTER_NONE; + } +} + +void Scene413::preActions() { + if (_action.isAction(VERB_TAKE) || _action.isAction(VERB_PUT, 0x319)) + _game._player._needToWalk = false; + + if (_action.isAction(VERB_LOOK, 0x2C4) || _action.isAction(VERB_LOOK, 0x1CC) + || _action.isAction(VERB_LOOK, 0x289) || _action.isAction(VERB_LOOK, 0x10E)) { + _game._player._needToWalk = true; + } +} + +void Scene413::actions() { + if (_action.isAction(0x188, 0x16C)) { + _game._player._stepEnabled = false; + _game._player._visible = false; + _scene->_nextSceneId = 409; + } else if (_action.isAction(0x188, 0x2B3)) + _scene->_nextSceneId = 405; + else if (_action.isAction(VERB_LOOK, 0x2C4)) + _vm->_dialogs->show(41310); + else if (_action.isAction(VERB_TAKE, 0x2C4)) + _vm->_dialogs->show(41311); + else if (_action.isAction(VERB_LOOK, 0x319)) + _vm->_dialogs->show(41312); + else if (_action.isAction(VERB_PUT, 0x319)) + _vm->_dialogs->show(41313); + else if (_action.isAction(VERB_LOOK, 0x16C)) + _vm->_dialogs->show(41314); + else if (_action.isAction(VERB_LOOK, 0x1CC)) + _vm->_dialogs->show(41315); + else if (_action.isAction(VERB_LOOK, 0x2B3)) + _vm->_dialogs->show(41316); + else if (_action.isAction(VERB_LOOK, 0x289)) + _vm->_dialogs->show(41317); + else if (_action.isAction(VERB_LOOK, 0x10E)) + _vm->_dialogs->show(41318); + else if (_action.isAction(VERB_TAKE, 0x10E)) + _vm->_dialogs->show(41319); + else if (_action._lookFlag) + _vm->_dialogs->show(41320); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes4.h b/engines/mads/nebular/nebular_scenes4.h index 2540c5e2e1..2010931981 100644 --- a/engines/mads/nebular/nebular_scenes4.h +++ b/engines/mads/nebular/nebular_scenes4.h @@ -230,6 +230,22 @@ public: virtual void actions(); virtual void postActions() {}; }; + +class Scene413: public Scene4xx { +private: + int _rexDeath; + int _canMove; + +public: + Scene413(MADSEngine *vm) : Scene4xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 84159c59efe95c682d4d727f48e93b08a93860da Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 3 May 2014 11:09:28 -0400 Subject: MADS: Savegames are now working --- engines/mads/game.cpp | 21 ++++++++++++--------- engines/mads/game.h | 2 +- engines/mads/globals.cpp | 4 ++-- engines/mads/mads.cpp | 8 +++++--- engines/mads/nebular/game_nebular.cpp | 2 +- engines/mads/player.cpp | 3 +-- 6 files changed, 22 insertions(+), 18 deletions(-) diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index a63fec424e..862ecf9a54 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -273,6 +273,7 @@ void Game::sectionLoop() { Common::Serializer s(_saveFile, nullptr); synchronize(s, false); delete _saveFile; + _saveFile = nullptr; } // Set player data @@ -464,14 +465,6 @@ void Game::synchronize(Common::Serializer &s, bool phase1) { _visitedScenes.synchronize(s); _player.synchronize(s); _screenObjects.synchronize(s); - - if (s.isLoading()) { - _scene._userInterface._selectedInvIndex = -1; - _currentSectionNumber = -2; - _scene._currentSceneId = -2; - _sectionNumber = _scene._nextSceneId / 100; - _scene._frameStartTime = _vm->_events->getFrameCounter(); - } } else { // Load scene specific data for the loaded scene _scene._sceneLogic->synchronize(s); @@ -494,8 +487,18 @@ void Game::loadGame(int slotNumber) { delete header._thumbnail; } - // Load the initial data such as what scene needs to be loaded up + // Load most of the savegame data with the exception of scene specific info synchronize(s, true); + + // Set up section/scene and other initial states for post-load + _scene._userInterface._selectedInvIndex = -1; + _currentSectionNumber = -2; + _scene._currentSceneId = -2; + _sectionNumber = _scene._nextSceneId / 100; + _scene._frameStartTime = _vm->_events->getFrameCounter(); + + _player._spritesLoaded = false; + _player._spritesChanged = true; } void Game::saveGame(int slotNumber, const Common::String &saveName) { diff --git a/engines/mads/game.h b/engines/mads/game.h index 5ae670df76..358a266e09 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -87,7 +87,6 @@ protected: bool _quoteEmergency; bool _vocabEmergency; bool _anyEmergency; - int _loadGameSlot; int _lastSave; Common::String _saveName; Common::InSaveFile *_saveFile; @@ -149,6 +148,7 @@ public: Common::String _aaName; int _winStatus; int _widepipeCtr; + int _loadGameSlot; public: virtual ~Game(); diff --git a/engines/mads/globals.cpp b/engines/mads/globals.cpp index de15ba9595..2343dd9c68 100644 --- a/engines/mads/globals.cpp +++ b/engines/mads/globals.cpp @@ -31,9 +31,9 @@ void Globals::reset() { } void Globals::synchronize(Common::Serializer &s) { - int count = 0; - int16 v; + int count = _data.size(); s.syncAsUint16LE(count); + int16 v; if (s.isSaving()) { for (int idx = 0; idx < count; ++idx) { diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index a099f5904e..9587efa443 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -124,13 +124,13 @@ int MADSEngine::hypotenuse(int xv, int yv) { bool MADSEngine::canLoadGameStateCurrently() { return !_game->_winStatus && !_game->globals()[5] && _dialogs->_pendingDialog == DIALOG_NONE - && _events->_cursorId == CURSOR_ARROW; + && _events->_cursorId != CURSOR_WAIT; } bool MADSEngine::canSaveGameStateCurrently() { return !_game->_winStatus && !_game->globals()[5] && _dialogs->_pendingDialog == DIALOG_NONE - && _events->_cursorId == CURSOR_ARROW; + && _events->_cursorId != CURSOR_WAIT; } /** @@ -142,7 +142,9 @@ Common::String MADSEngine::generateSaveName(int slot) { } Common::Error MADSEngine::loadGameState(int slot) { - _game->loadGame(slot); + _game->_loadGameSlot = slot; + _game->_scene._currentSceneId = -1; + _game->_currentSectionNumber = -1; return Common::kNoError; } diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index ce3f0869cd..546fdbea7c 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -748,7 +748,7 @@ void GameNebular::step() { void GameNebular::synchronize(Common::Serializer &s, bool phase1) { Game::synchronize(s, phase1); - if (!phase1) { + if (phase1) { _globals.synchronize(s); s.syncAsByte(_storyMode); s.syncAsByte(_difficulty); diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index 0c9a496144..20d54902dd 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -690,6 +690,7 @@ void Player::releasePlayerSprites() { } while (--spriteEnd >= _spritesStart); } + _numSprites = 0; _spritesLoaded = false; _spritesChanged = true; } @@ -722,7 +723,6 @@ void Player::synchronize(Common::Serializer &s) { s.syncAsByte(_visible); s.syncAsByte(_priorVisible); - s.syncAsSint16LE(_spritesStart); for (int i = 0; i < 8; ++i) s.syncAsByte(_spriteSetsPresent[i]); @@ -751,7 +751,6 @@ void Player::synchronize(Common::Serializer &s) { s.syncAsUint16LE(_frameCount); synchronizeString(s, _spritesPrefix); s.syncAsUint32LE(_priorTimer); - s.syncAsSint16LE(_numSprites); s.syncAsByte(_loadsFirst); s.syncAsByte(_loadedFirst); s.syncAsByte(_spritesLoaded); -- cgit v1.2.3 From 800ff80c52523fd044df3aa879caddb8a617134c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 3 May 2014 13:20:29 -0400 Subject: MADS: Default to first inventory item after loading a savegame --- engines/mads/game.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 862ecf9a54..65790d3c3d 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -491,12 +491,15 @@ void Game::loadGame(int slotNumber) { synchronize(s, true); // Set up section/scene and other initial states for post-load - _scene._userInterface._selectedInvIndex = -1; _currentSectionNumber = -2; _scene._currentSceneId = -2; _sectionNumber = _scene._nextSceneId / 100; _scene._frameStartTime = _vm->_events->getFrameCounter(); + // Default the selected inventory item to the first one, if the player has any + _scene._userInterface._selectedInvIndex = _objects._inventoryList.size() > 0 ? 0 : -1; + + // Set player sprites sets flags _player._spritesLoaded = false; _player._spritesChanged = true; } -- cgit v1.2.3 From 9cd7e8b886c2c72d659cd3439ae4f004126393de Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 3 May 2014 13:47:04 -0400 Subject: MADS: Maintain inventory ordering in savegames --- engines/mads/inventory.cpp | 29 ++++++++++++++++++++--------- engines/mads/inventory.h | 2 +- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/engines/mads/inventory.cpp b/engines/mads/inventory.cpp index a6459c764b..fecb1b34eb 100644 --- a/engines/mads/inventory.cpp +++ b/engines/mads/inventory.cpp @@ -47,10 +47,22 @@ void InventoryObject::synchronize(Common::Serializer &s) { void InventoryObjects::load() { File f("*OBJECTS.DAT"); + int count = f.readUint16LE(); Common::Serializer s(&f, nullptr); // Load the objects data - synchronize(s); + reserve(count); + for (int i = 0; i < count; ++i) { + InventoryObject obj; + obj.synchronize(s); + push_back(obj); + + // If it's for the player's inventory, add the index to the inventory list + if (obj._roomNumber == PLAYER_INVENTORY) { + _inventoryList.push_back(i); + assert(_inventoryList.size() <= 32); + } + } } void InventoryObjects::synchronize(Common::Serializer &s) { @@ -61,23 +73,22 @@ void InventoryObjects::synchronize(Common::Serializer &s) { // Store the data for each object in the inventory lsit for (int idx = 0; idx < count; ++idx) (*this)[idx].synchronize(s); + + // Synchronize the player's inventory + _inventoryList.synchronize(s); } else { clear(); - _inventoryList.clear(); - reserve(count); // Read in each object + reserve(count); for (int i = 0; i < count; ++i) { InventoryObject obj; obj.synchronize(s); push_back(obj); - - // If it's for the player's inventory, add the index to the inventory list - if (obj._roomNumber == PLAYER_INVENTORY) { - _inventoryList.push_back(i); - assert(_inventoryList.size() <= 32); - } } + + // Synchronize the player's inventory + _inventoryList.synchronize(s); } } diff --git a/engines/mads/inventory.h b/engines/mads/inventory.h index 5e3ecd6a69..f3c63f8c4b 100644 --- a/engines/mads/inventory.h +++ b/engines/mads/inventory.h @@ -60,7 +60,7 @@ private: MADSEngine *_vm; public: - Common::Array _inventoryList; + SynchronizedList _inventoryList; /** * Constructor -- cgit v1.2.3 From d38e1aa5006266dedf5e7de6382df8c321009ee7 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 3 May 2014 14:18:33 -0400 Subject: MADS: Reorganise Nebular dialog methods --- engines/mads/nebular/dialogs_nebular.cpp | 170 +++++++++++++++---------------- 1 file changed, 85 insertions(+), 85 deletions(-) diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp index 98e05ade25..dc7d432cb8 100644 --- a/engines/mads/nebular/dialogs_nebular.cpp +++ b/engines/mads/nebular/dialogs_nebular.cpp @@ -33,90 +33,6 @@ namespace MADS { namespace Nebular { -CopyProtectionDialog::CopyProtectionDialog(MADSEngine *vm, bool priorAnswerWrong): - TextDialog(vm, FONT_INTERFACE, Common::Point(-1, -1), 32) { - getHogAnusEntry(_hogEntry); - - if (priorAnswerWrong) { - addLine("ANSWER INCORRECT!", true); - wordWrap("\n"); - addLine("(But we'll give you another chance!)"); - } else { - addLine("REX NEBULAR version 8.43", true); - wordWrap("\n"); - addLine("(Copy Protection, for your convenience)"); - } - wordWrap("\n"); - - wordWrap("Now comes the part that everybody hates. But if we don't"); - wordWrap("do this, nasty rodent-like people will pirate this game"); - wordWrap("and a whole generation of talented designers, programmers,"); - wordWrap("artists, and playtesters will go hungry, and will wander"); - wordWrap("aimlessly through the land at night searching for peace."); - wordWrap("So let's grit our teeth and get it over with. Just get"); - - Common::String line = "out your copy of "; - line += _hogEntry._bookId == 103 ? "the GAME MANUAL" : "REX'S LOGBOOK"; - line += ". See! That was easy. "; - wordWrap(line); - - line = Common::String::format("Next, just turn to page %d. On line %d, find word number %d, ", - _hogEntry._pageNum, _hogEntry._lineNum, _hogEntry._wordNum); - wordWrap(line); - - wordWrap("and type it on the line below (we',27h,'ve even given you"); - wordWrap("first letter as a hint). As soon as you do that, we can get"); - wordWrap("right into this really COOL adventure game!\n"); - wordWrap("\n"); - wordWrap(" "); - addInput(); - wordWrap("\n"); -} - -bool CopyProtectionDialog::show() { - draw(); - _vm->_events->showCursor(); - - // TODO: Replace with text input - while (!_vm->shouldQuit() && !_vm->_events->isKeyPressed() && - !_vm->_events->_mouseClicked) { - _vm->_events->delay(1); - } - - _vm->_events->_pendingKeys.clear(); - return true; -} - -bool CopyProtectionDialog::getHogAnusEntry(HOGANUS &entry) { - File f; - f.open("*HOGANUS.DAT"); - - // Read in the total number of entries, and randomly pick an entry to use - int numEntries = f.readUint16LE(); - int entryIndex = _vm->getRandomNumber(1, numEntries); - - // Read in the encrypted entry - f.seek(28 * entryIndex + 2); - byte entryData[28]; - f.read(entryData, 28); - - // Decrypt it - for (int i = 0; i < 28; ++i) - entryData[i] = ~entryData[i]; - - // Fill out the fields - entry._bookId = entryData[0]; - entry._pageNum = READ_LE_UINT16(&entryData[2]); - entry._lineNum = READ_LE_UINT16(&entryData[4]); - entry._wordNum = READ_LE_UINT16(&entryData[6]); - entry._word = Common::String((char *)&entryData[8]); - - f.close(); - return true; -} - -/*------------------------------------------------------------------------*/ - bool DialogsNebular::show(int msgId) { MADSAction &action = _vm->_game->_scene._action; Common::StringArray msg = _vm->_game->getMessage(msgId); @@ -330,6 +246,91 @@ void DialogsNebular::showDialog() { /*------------------------------------------------------------------------*/ +CopyProtectionDialog::CopyProtectionDialog(MADSEngine *vm, bool priorAnswerWrong) : +TextDialog(vm, FONT_INTERFACE, Common::Point(-1, -1), 32) { + getHogAnusEntry(_hogEntry); + + if (priorAnswerWrong) { + addLine("ANSWER INCORRECT!", true); + wordWrap("\n"); + addLine("(But we'll give you another chance!)"); + } + else { + addLine("REX NEBULAR version 8.43", true); + wordWrap("\n"); + addLine("(Copy Protection, for your convenience)"); + } + wordWrap("\n"); + + wordWrap("Now comes the part that everybody hates. But if we don't"); + wordWrap("do this, nasty rodent-like people will pirate this game"); + wordWrap("and a whole generation of talented designers, programmers,"); + wordWrap("artists, and playtesters will go hungry, and will wander"); + wordWrap("aimlessly through the land at night searching for peace."); + wordWrap("So let's grit our teeth and get it over with. Just get"); + + Common::String line = "out your copy of "; + line += _hogEntry._bookId == 103 ? "the GAME MANUAL" : "REX'S LOGBOOK"; + line += ". See! That was easy. "; + wordWrap(line); + + line = Common::String::format("Next, just turn to page %d. On line %d, find word number %d, ", + _hogEntry._pageNum, _hogEntry._lineNum, _hogEntry._wordNum); + wordWrap(line); + + wordWrap("and type it on the line below (we',27h,'ve even given you"); + wordWrap("first letter as a hint). As soon as you do that, we can get"); + wordWrap("right into this really COOL adventure game!\n"); + wordWrap("\n"); + wordWrap(" "); + addInput(); + wordWrap("\n"); +} + +bool CopyProtectionDialog::show() { + draw(); + _vm->_events->showCursor(); + + // TODO: Replace with text input + while (!_vm->shouldQuit() && !_vm->_events->isKeyPressed() && + !_vm->_events->_mouseClicked) { + _vm->_events->delay(1); + } + + _vm->_events->_pendingKeys.clear(); + return true; +} + +bool CopyProtectionDialog::getHogAnusEntry(HOGANUS &entry) { + File f; + f.open("*HOGANUS.DAT"); + + // Read in the total number of entries, and randomly pick an entry to use + int numEntries = f.readUint16LE(); + int entryIndex = _vm->getRandomNumber(1, numEntries); + + // Read in the encrypted entry + f.seek(28 * entryIndex + 2); + byte entryData[28]; + f.read(entryData, 28); + + // Decrypt it + for (int i = 0; i < 28; ++i) + entryData[i] = ~entryData[i]; + + // Fill out the fields + entry._bookId = entryData[0]; + entry._pageNum = READ_LE_UINT16(&entryData[2]); + entry._lineNum = READ_LE_UINT16(&entryData[4]); + entry._wordNum = READ_LE_UINT16(&entryData[6]); + entry._word = Common::String((char *)&entryData[8]); + + f.close(); + return true; +} + +/*------------------------------------------------------------------------*/ + ScreenDialog::DialogLine::DialogLine() { _state = 0; _textDisplayIndex = -1; @@ -503,7 +504,6 @@ finish: ++_lineIndex; } - void ScreenDialog::initVars() { _v1 = -1; _selectedLine = -1; -- cgit v1.2.3 From 159f2128bb21fb1675a45ef1cdf46ba04f1e9cac Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Sat, 3 May 2014 14:47:04 -0400 Subject: DRACI: Silence warning --- engines/draci/walking.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/draci/walking.cpp b/engines/draci/walking.cpp index 6914898ec1..04cd929ac6 100644 --- a/engines/draci/walking.cpp +++ b/engines/draci/walking.cpp @@ -453,7 +453,7 @@ void WalkingState::callback() { _callback = NULL; _vm->_script->runWrapper(originalCallback, _callbackOffset, true, false); _callbackLast = NULL; - _callbackOffset = NULL; + _callbackOffset = 0; } void WalkingState::callbackLast() { -- cgit v1.2.3 From 363b23f55d3bf143f1c3221fc6ea7d523bb06ea1 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Sat, 3 May 2014 15:10:13 -0400 Subject: MOHAWK: Use properly cased names for Riven variables --- engines/mohawk/riven_vars.cpp | 418 +++++++++++++++++++++--------------------- 1 file changed, 209 insertions(+), 209 deletions(-) diff --git a/engines/mohawk/riven_vars.cpp b/engines/mohawk/riven_vars.cpp index 1cd748d8d6..efb9c1c3a2 100644 --- a/engines/mohawk/riven_vars.cpp +++ b/engines/mohawk/riven_vars.cpp @@ -31,240 +31,240 @@ namespace Mohawk { static const char *variableNames[] = { // aspit - "aatrusbook", - "aatruspage", - "acathbook", - "acathpage", - "acathstate", - "adoit", - "adomecombo", - "agehn", - "ainventory", - "aova", - "apower", - "araw", - "atemp", - "atrap", - "atrapbook", - "auservolume", - "azip", + "aAtrusBook", + "aAtrusPage", + "aCathBook", + "aCathPage", + "aCathState", + "aDoIt", + "aDomeCombo", + "aGehn", + "aInventory", + "aOva", + "aPower", + "aRaw", + "aTemp", + "aTrap", + "aTrapBook", + "aUserVolume", + "aZip", // bspit - "bbacklock", - "bbait", - "bbigbridge", - "bbirds", - "bblrarm", - "bblrdoor", - "bblrgrt", - "bblrsw", - "bblrvalve", - "bblrwtr", - "bbook", - "bbrlever", - "bcavedoor", + "bBackLock", + "bBait", + "bBigBridge", + "bBirds", + "bBlrArm", + "bBlrDoor", + "bBlrGrt", + "bBlrSw", + "bBlrValve", + "bBlrWtr", + "bBook", + "bBrLever", + "bCaveDoor", "bcombo", - "bcpipegr", - "bcratergg", - "bdome", - "bdrwr", - "bfans", - "bfmdoor", - "bidvlv", - "blab", - "blabbackdr", - "blabbook", - "blabeye", - "blabfrontdr", - "blabpage", - "blever", - "bfrontlock", - "bheat", - "bmagcar", - "bpipdr", - "bprs", - "bstove", - "btrap", - "bvalve", - "bvise", - "bytram", - "bytramtime", - "bytrap", - "bytrapped", + "bCPipeGr", + "bCraterGg", + "bDome", + "bDrwr", + "bFans", + "bFMDoor", + "bIdVlv", + "bLab", + "bLabBackDr", + "bLabBook", + "bLabEye", + "bLabFrontDr", + "bLabPage", + "bLever", + "bFrontLock", + "bHeat", + "bMagCar", + "bPipDr", + "bPrs", + "bStove", + "bTrap", + "bValve", + "bVise", + "bYtram", + "bYtramTime", + "bYtrap", + "bYtrapped", // gspit - "gbook", - "gcathtime", - "gcathstate", - "gcombo", - "gdome", - "gemagcar", - "gimagecurr", + "gBook", + "gCathTime", + "gCathState", + "gCombo", + "gDome", + "gEmagCar", + "gImageCurr", "gimagemax", - "gimagerot", - "glkbtns", - "glkbridge", - "glkelev", - "glview", - "glviewmpos", - "glviewpos", - "gnmagrot", - "gnmagcar", - "gpinup", - "gpinpos", - "gpinsmpos", - "grview", - "grviewmpos", - "grviewpos", - "gscribe", - "gscribetime", - "gsubelev", - "gsubdr", - "gupmoov", - "gwhark", - "gwharktime", + "gImageRot", + "gLkBtns", + "gLkBridge", + "gLkElev", + "gLView", + "gLViewMPos", + "gLViewPos", + "gNmagRot", + "gNmagCar", + "gPinUp", + "gPinPos", + "gPinsMPos", + "gRView", + "gRViewMPos", + "gRViewPos", + "gScribe", + "gScribeTime" + "gSubElev", + "gSubDr", + "gUpMoov", + "gWhark", + "gWharkTime", // jspit - "jwmagcar", - "jbeetle", - "jbeetlepool", - "jbook", - "jbridge1", - "jbridge2", - "jbridge3", - "jbridge4", - "jbridge5", - "jccb", - "jcombo", - "jcrg", - "jdome", - "jdrain", - "jgallows", - "jgate", - "jgirl", - "jiconcorrectorder", - "jiconorder", - "jicons", - "jladder", - "jleftpos", - "jpeek", - "jplaybeetle", - "jprebel", - "jprisondr", - "jprisonsecdr", - "jrbook", - "jrightpos", - "jsouthpathdr", - "jschooldr", - "jsub", - "jsubdir", - "jsubhatch", - "jsubsw", - "jsunners", - "jsunnertime", - "jthronedr", - "jtunneldr", - "jtunnellamps", - "jvillagepeople", - "jwarning", - "jwharkpos", - "jwharkram", - "jwmouth", - "jwmagcar", - "jymagcar", + "jWMagCar", + "jBeetle", + "jBeetlePool", + "jBook", + "jBridge1", + "jBridge2", + "jBridge3", + "jBridge4", + "jBridge5", + "jCCB", + "jCombo", + "jCrg", + "jDome", + "jDrain", + "jGallows", + "jGate", + "jGirl", + "jIconCorrectOrder", + "jIconOrder", + "jIcons", + "jLadder", + "jLeftPos", + "jPeek", + "jPlayBeetle", + "jPRebel", + "jPrisonDr", + "jPrisonSecDr", + "jrBook", + "jRightPos", + "jSouthPathDr", + "jSchoolDr", + "jSub", + "jSubDir", + "jSubHatch", + "jSubSw", + "jSunners", + "jSunnerTime", + "jThroneDr", + "jTunnelDr", + "jTunnelLamps", + "jVillagePeople", + "jWarning", + "jWharkPos", + "jWharkRam", + "jWMouth", + "jWMagCar", + "jYMagCar", // ospit "oambient", - "obutton", + "oButton", "ocage", - "odeskbook", - "ogehnpage", - "omusicplayer", - "ostanddrawer", - "ostove", + "oDeskBook", + "oGehnPage", + "oMusicPlayer", + "oStandDrawer", + "oStove", // pspit - "pbook", - "pcage", - "pcathcheck", - "pcathstate", - "pcathtime", - "pcombo", - "pcorrectorder", + "pBook", + "pCage", + "pCathCheck", + "pCathState", + "pCathTime", + "pCombo", + "pCorrectOrder", "pdome", - "pelevcombo", - "pleftpos", - "prightpos", - "ptemp", - "pwharkpos", + "pElevCombo", + "pLeftPos", + "pRightPos", + "pTemp", + "pWharkPos", // rspit - "rrebel", - "rrebelview", - "rrichard", - "rvillagetime", + "rRebel", + "rRebelView", + "rRichard", + "rVillageTime", // tspit - "tbars", - "tbeetle", - "tblue", - "tbook", - "tbookvalve", - "tcage", - "tcombo", - "tcorrectorder", - "tcovercombo", - "tdl", - "tdome", - "tdomeelev", - "tdomeelevbtn", - "tgatebrhandle", - "tgatebridge", - "tgatestate", - "tgreen", - "tgridoor", - "tgrodoor", - "tgrmdoor", - "tguard", - "timagedoor", - "tmagcar", - "torange", - "tred", - "tsecdoor", - "tsubbridge", - "ttelecover", - "ttelehandle", - "ttelepin", - "ttelescope", - "ttelevalve", - "ttemple", - "ttempledoor", - "ttunneldoor", - "tviewer", - "tviolet", - "twabrvalve", - "twaffle", - "tyellow", + "tBars", + "tBeetle", + "tBlue", + "tBook", + "tBookValve", + "tCage", + "tCombo", + "tCorrectOrder", + "tCoverCombo", + "tDL", + "tDome", + "tDomeElev", + "tDomeElevBtn", + "tGateBrHandle", + "tGateBridge", + "tGateState", + "tGreen", + "tGRIDoor", + "tGRODoor", + "tGRMDoor", + "tGuard", + "tImageDoor", + "tMagCar", + "tOrange", + "tRed", + "tSecDoor", + "tSubBridge", + "tTeleCover", + "tTeleHandle", + "tTelePin", + "tTelescope", + "tTeleValve", + "tTemple", + "tTempleDoor", + "tTunnelDoor", + "tViewer", + "tViolet", + "tWaBrValve", + "tWaffle", + "tYellow", // Miscellaneous "elevbtn1", "elevbtn2", "elevbtn3", - "domecheck", - "transitionsenabled", - "transitionmode", - "waterenabled", - "rivenambients", - "stackvarsinitialized", - "doingsetupscreens", + "domeCheck", + "transitionsEnabled", + "transitionMode", + "waterEnabled", + "RivenAmbients", + "stackVarsInitialized", + "DoingSetupScreens", "all_book", - "playerhasbook", - "returnstackid", - "returncardid", - "newpos", - "themarble", - "currentstackid", - "currentcardid" + "playerHasBook", + "returnStackID", + "returnCardID", + "NewPos", + "theMarble", + "CurrentStackID", + "CurrentCardID" }; uint32 &MohawkEngine_Riven::getStackVar(uint32 index) { -- cgit v1.2.3 From f9b52398bdd621d4466a845c6d49f9f27e7a4482 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 4 May 2014 03:48:36 +0300 Subject: MADS: Add a sanity check in DynamicHotspots::remove() Fixes a crash when loading outside the hut --- engines/mads/hotspots.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/hotspots.cpp b/engines/mads/hotspots.cpp index 560726bda6..0853f66eac 100644 --- a/engines/mads/hotspots.cpp +++ b/engines/mads/hotspots.cpp @@ -97,7 +97,7 @@ int DynamicHotspots::setCursor(int index, CursorType cursor) { void DynamicHotspots::remove(int index) { Scene &scene = _vm->_game->_scene; - if (_entries[index]._active) { + if (index >= 0 && _entries[index]._active) { if (_entries[index]._seqIndex >= 0) scene._sequences[_entries[index]._seqIndex]._dynamicHotspotIndex = -1; _entries[index]._active = false; -- cgit v1.2.3 From 27982c850a66cf1db10078b9ac576170b8c34bf5 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 4 May 2014 03:52:13 +0300 Subject: MADS: Fix several logic bugs in scenes 102, 109 and 212 --- engines/mads/action.cpp | 8 ++++++++ engines/mads/action.h | 4 +++- engines/mads/nebular/nebular_scenes1.cpp | 16 ++++++++-------- engines/mads/nebular/nebular_scenes2.cpp | 2 +- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index 48393e17f6..ab4a112b71 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -385,6 +385,14 @@ bool MADSAction::isAction(int verbId, int objectNameId, int indirectObjectId) { return true; } +bool MADSAction::isObject(int objectNameId) { + return _activeAction._objectNameId == objectNameId; +} + +bool MADSAction::isTarget(int objectNameId) { + return _activeAction._indirectObjectId == objectNameId; +} + void MADSAction::checkActionAtMousePos() { Scene &scene = _vm->_game->_scene; UserInterface &userInterface = scene._userInterface; diff --git a/engines/mads/action.h b/engines/mads/action.h index ac6c35c863..24521d074d 100644 --- a/engines/mads/action.h +++ b/engines/mads/action.h @@ -151,7 +151,9 @@ public: void checkAction(); bool isAction(int verbId, int objectNameId = 0, int indirectObjectId = 0); - + bool isObject(int objectNameId); + bool isTarget(int objectNameId); + /** * Check the result of the current action on the sentence * with the provision that the action is not yet complete. diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 7d8b077fc2..5629dc0934 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -798,7 +798,7 @@ void Scene102::actions() { return; } - if (_action._activeAction._objectNameId == 0x122 && !_fridgeOpenedFl) { + if (_action.isObject(0x122) && !_fridgeOpenedFl) { switch (_game._trigger) { case 0: _globals._sequenceIndexes[7] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 6, 1, 0, 0); @@ -970,7 +970,7 @@ void Scene102::actions() { return; } - if ((_action._activeAction._objectNameId == 0xC7 || _action._activeAction._objectNameId == 0xA3) && (_action.isAction(VERB_LOOK) || _action.isAction(0x50) || _action.isAction(0x4F))) { + if ((_action.isObject(0xC7) || _action.isObject(0xA3)) && (_action.isAction(VERB_LOOK) || _action.isAction(0x50) || _action.isAction(0x4F))) { if (_game._objects.isInInventory(OBJ_REBREATHER)) { if (!_action.isAction(0x50) && !_action.isAction(0x4F)) { _vm->_dialogs->show(0x27F7); @@ -984,7 +984,7 @@ void Scene102::actions() { } } - if ((_action._activeAction._objectNameId == 0xC7 || _action._activeAction._objectNameId == 0xA3) && (_action.isAction(0x50) || _action.isAction(0x4F)) ) { + if ((_action.isObject(0xC7) || _action.isObject(0xA3)) && (_action.isAction(0x50) || _action.isAction(0x4F)) ) { switch (_game._trigger) { case 0: _scene->loadAnimation(formAnimName('A', -1), 1); @@ -2470,8 +2470,8 @@ void Scene109::preActions() { _game._player._walkOffScreenSceneId = 108; if ((_action.isAction(VERB_THROW) || _action.isAction(VERB_GIVE) || _action.isAction(VERB_PUT)) - && (_action.isAction(0x146) || _action.isAction(0x178)) - && (_action.isAction(0x65) || _action.isAction(0x157) || _action.isAction(0x35))) { + && (_action.isObject(0x146) || _action.isObject(0x178)) + && (_action.isObject(0x65) || _action.isObject(0x157) || _action.isObject(0x35))) { int idx = _game._objects.getIdFromDesc(_action._activeAction._objectNameId); if ((idx >= 0) && _game._objects.isInInventory(idx)) { _game._player._prepareWalkPos = Common::Point(106, 38); @@ -2482,7 +2482,7 @@ void Scene109::preActions() { } if ((_action.isAction(0x15A, 0x178) || _action.isAction(0x15C, 0x146)) - && (!_globals[kHoovicAlive] || _globals[kHoovicSated]) && (_action.isAction(0x178))) + && (!_globals[kHoovicAlive] || _globals[kHoovicSated]) && (_action.isObject(0x178))) _game._player._walkOffScreenSceneId = 110; _hungryFl = false; @@ -2495,8 +2495,8 @@ void Scene109::actions() { return; } - if ((_action.isAction(VERB_THROW) || _action.isAction(VERB_GIVE)) && ((_action.isAction(0x146) || _action.isAction(0x178)))) { - if (_action.isAction(0x65) || _action.isAction(0x157) || _action.isAction(0x35)) { + if ((_action.isAction(VERB_THROW) || _action.isAction(VERB_GIVE)) && (_action.isTarget(0x146) || _action.isTarget(0x178))) { + if (_action.isObject(0x65) || _action.isObject(0x157) || _action.isObject(0x35)) { _throwingObjectId = _game._objects.getIdFromDesc(_action._activeAction._objectNameId); if (_throwingObjectId >= 0) { if ((_game._objects.isInInventory(_throwingObjectId) && _globals[kHoovicAlive]) || _rexThrowingObject) { diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index a62ad6b94d..2ead2c02eb 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -4551,7 +4551,7 @@ void Scene212::preActions() { void Scene212::actions() { if (_action._lookFlag) _vm->_dialogs->show(0x52D9); - else if (_action.isAction(0x18C) && (_action.isAction(0x82) || _action.isAction(0xE8))) + else if (_action.isAction(0x18C) && (_action.isObject(0x82) || _action.isObject(0xE8))) _scene->_nextSceneId = 208; else if (_action.isAction(0x18C, 0x3F)) _scene->_nextSceneId = 111; -- cgit v1.2.3 From 0023e99621ba91ba87e4241e2a1ef6f97da4e7c0 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 4 May 2014 03:54:54 +0300 Subject: MADS: Fix bugs in SpriteSets::remove() This fixes several crashes when sprites get erased, like for example in death animations --- engines/mads/sprites.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp index f187295b00..36cbdbea12 100644 --- a/engines/mads/sprites.cpp +++ b/engines/mads/sprites.cpp @@ -399,17 +399,21 @@ void SpriteSets::clear() { void SpriteSets::remove(int idx) { if (idx >= 0) { - delete (*this)[idx]; - if (idx < ((int)size() - 1)) { + delete (*this)[idx]; (*this)[idx] = nullptr; } else { - do { + while (size() > 0 && (*this)[size() - 1] == nullptr) { + delete (*this)[size() - 1]; remove_at(size() - 1); - } while (size() > 0 && (*this)[size() - 1] == nullptr); + } } - --_assetCount; + if (_assetCount > 0) + --_assetCount; + else + // FIXME: This is needed, otherwise scene sprites are not cleared in this case + clear(); } } -- cgit v1.2.3 From e5e5bdd7f1445cbbeaf1bebdd84d80ef5e665593 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 4 May 2014 03:56:26 +0300 Subject: MADS: Add a FIXME for scene 109 --- engines/mads/nebular/nebular_scenes1.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 5629dc0934..f68a613d5b 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -2436,7 +2436,8 @@ void Scene109::step() { _hungryFl = true; } - if (_eatingFirstFish && (_scene->_sequences[_globals._sequenceIndexes[10]]._msgPos.x >= 178)) { + // FIXME: The fish animation never moves, so x is never updated and the scene freezes + if (_eatingFirstFish /*&& (_scene->_sequences[_globals._sequenceIndexes[10]]._msgPos.x >= 178)*/) { _globals._sequenceIndexes[9] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 4, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 4); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SEQUENCE_TRIGGER_SPRITE, 29, 72); -- cgit v1.2.3 From 0a899876e760419b913495e17052da2903371cb6 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Sat, 3 May 2014 22:55:50 -0400 Subject: MOHAWK: Use original stack ID mapping for Riven --- engines/mohawk/console.cpp | 28 +++++++------ engines/mohawk/riven.cpp | 82 +++++++++++++++++++++------------------ engines/mohawk/riven.h | 22 ++++++----- engines/mohawk/riven_external.cpp | 6 +-- engines/mohawk/riven_graphics.cpp | 2 +- engines/mohawk/riven_saveload.cpp | 79 +++---------------------------------- engines/mohawk/riven_scripts.cpp | 4 +- 7 files changed, 81 insertions(+), 142 deletions(-) diff --git a/engines/mohawk/console.cpp b/engines/mohawk/console.cpp index 2e83eb3328..d95c91e3be 100644 --- a/engines/mohawk/console.cpp +++ b/engines/mohawk/console.cpp @@ -426,13 +426,11 @@ bool RivenConsole::Cmd_CurStack(int argc, const char **argv) { } bool RivenConsole::Cmd_ChangeStack(int argc, const char **argv) { - byte i; - if (argc < 3) { DebugPrintf("Usage: changeStack \n\n"); DebugPrintf("Stacks:\n=======\n"); - for (i = 0; i <= tspit; i++) + for (uint i = kStackFirst; i <= kStackLast; i++) DebugPrintf(" %s\n", _vm->getStackName(i).c_str()); DebugPrintf("\n"); @@ -440,20 +438,21 @@ bool RivenConsole::Cmd_ChangeStack(int argc, const char **argv) { return true; } - byte stackNum = 0; + uint stack = kStackUnknown; - for (i = 1; i <= tspit + 1; i++) - if (!scumm_stricmp(argv[1], _vm->getStackName(i - 1).c_str())) { - stackNum = i; + for (uint i = kStackFirst; i <= kStackLast; i++) { + if (!scumm_stricmp(argv[1], _vm->getStackName(i).c_str())) { + stack = i; break; } + } - if (!stackNum) { + if (stack == kStackUnknown) { DebugPrintf("\'%s\' is not a stack name!\n", argv[1]); return true; } - _vm->changeToStack(stackNum - 1); + _vm->changeToStack(stack); _vm->changeToCard((uint16)atoi(argv[2])); return false; @@ -494,21 +493,20 @@ bool RivenConsole::Cmd_DumpScript(int argc, const char **argv) { } uint16 oldStack = _vm->getCurStack(); + uint newStack = kStackUnknown; - byte newStack = 0; - - for (byte i = 1; i <= tspit + 1; i++) - if (!scumm_stricmp(argv[1], _vm->getStackName(i - 1).c_str())) { + for (uint i = kStackFirst; i <= kStackLast; i++) { + if (!scumm_stricmp(argv[1], _vm->getStackName(i).c_str())) { newStack = i; break; } + } - if (!newStack) { + if (newStack == kStackUnknown) { DebugPrintf("\'%s\' is not a stack name!\n", argv[1]); return true; } - newStack--; _vm->changeToStack(newStack); // Load in Variable Names diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp index e1059bebaa..a7fe12b9e1 100644 --- a/engines/mohawk/riven.cpp +++ b/engines/mohawk/riven.cpp @@ -55,7 +55,7 @@ MohawkEngine_Riven::MohawkEngine_Riven(OSystem *syst, const MohawkGameDescriptio _activatedSLST = false; _ignoreNextMouseUp = false; _extrasFile = 0; - _curStack = aspit; + _curStack = kStackUnknown; _hotspots = 0; removeTimer(); @@ -161,7 +161,7 @@ Common::Error MohawkEngine_Riven::run() { // Let's begin, shall we? if (getFeatures() & GF_DEMO) { // Start the demo off with the videos - changeToStack(aspit); + changeToStack(kStackAspit); changeToCard(6); } else if (ConfMan.hasKey("save_slot")) { // Load game from launcher/command line if requested @@ -172,12 +172,12 @@ Common::Error MohawkEngine_Riven::run() { // Attempt to load the game. On failure, just send us to the main menu. if (_saveLoad->loadGame(savedGamesList[gameToLoad]).getCode() != Common::kNoError) { - changeToStack(aspit); + changeToStack(kStackAspit); changeToCard(1); } } else { // Otherwise, start us off at aspit's card 1 (the main menu) - changeToStack(aspit); + changeToStack(kStackAspit); changeToCard(1); } @@ -255,16 +255,16 @@ void MohawkEngine_Riven::handleEvents() { case Common::KEYCODE_r: // Return to the main menu in the demo on ctrl+r if (event.kbd.flags & Common::KBD_CTRL && getFeatures() & GF_DEMO) { - if (_curStack != aspit) - changeToStack(aspit); + if (_curStack != kStackAspit) + changeToStack(kStackAspit); changeToCard(1); } break; case Common::KEYCODE_p: // Play the intro videos in the demo on ctrl+p if (event.kbd.flags & Common::KBD_CTRL && getFeatures() & GF_DEMO) { - if (_curStack != aspit) - changeToStack(aspit); + if (_curStack != kStackAspit) + changeToStack(kStackAspit); changeToCard(6); } break; @@ -343,20 +343,22 @@ struct RivenSpecialChange { uint32 startCardRMAP; byte targetStack; uint32 targetCardRMAP; -} rivenSpecialChange[] = { - { aspit, 0x1f04, ospit, 0x44ad }, // Trap Book - { bspit, 0x1c0e7, ospit, 0x2e76 }, // Dome Linking Book - { gspit, 0x111b1, ospit, 0x2e76 }, // Dome Linking Book - { jspit, 0x28a18, rspit, 0xf94 }, // Tay Linking Book - { jspit, 0x26228, ospit, 0x2e76 }, // Dome Linking Book - { ospit, 0x5f0d, pspit, 0x3bf0 }, // Return from 233rd Age - { ospit, 0x470a, jspit, 0x1508e }, // Return from 233rd Age - { ospit, 0x5c52, gspit, 0x10bea }, // Return from 233rd Age - { ospit, 0x5d68, bspit, 0x1adfd }, // Return from 233rd Age - { ospit, 0x5e49, tspit, 0xe87 }, // Return from 233rd Age - { pspit, 0x4108, ospit, 0x2e76 }, // Dome Linking Book - { rspit, 0x32d8, jspit, 0x1c474 }, // Return from Tay - { tspit, 0x21b69, ospit, 0x2e76 } // Dome Linking Book +}; + +static const RivenSpecialChange rivenSpecialChange[] = { + { kStackAspit, 0x1f04, kStackOspit, 0x44ad }, // Trap Book + { kStackBspit, 0x1c0e7, kStackOspit, 0x2e76 }, // Dome Linking Book + { kStackGspit, 0x111b1, kStackOspit, 0x2e76 }, // Dome Linking Book + { kStackJspit, 0x28a18, kStackRspit, 0xf94 }, // Tay Linking Book + { kStackJspit, 0x26228, kStackOspit, 0x2e76 }, // Dome Linking Book + { kStackOspit, 0x5f0d, kStackPspit, 0x3bf0 }, // Return from 233rd Age + { kStackOspit, 0x470a, kStackJspit, 0x1508e }, // Return from 233rd Age + { kStackOspit, 0x5c52, kStackGspit, 0x10bea }, // Return from 233rd Age + { kStackOspit, 0x5d68, kStackBspit, 0x1adfd }, // Return from 233rd Age + { kStackOspit, 0x5e49, kStackTspit, 0xe87 }, // Return from 233rd Age + { kStackPspit, 0x4108, kStackOspit, 0x2e76 }, // Dome Linking Book + { kStackRspit, 0x32d8, kStackJspit, 0x1c474 }, // Return from Tay + { kStackTspit, 0x21b69, kStackOspit, 0x2e76 } // Dome Linking Book }; void MohawkEngine_Riven::changeToCard(uint16 dest) { @@ -556,16 +558,16 @@ void MohawkEngine_Riven::checkInventoryClick() { // In the demo, check if we've clicked the exit button if (getFeatures() & GF_DEMO) { if (g_demoExitRect->contains(mousePos)) { - if (_curStack == aspit && _curCard == 1) { + if (_curStack == kStackAspit && _curCard == 1) { // From the main menu, go to the "quit" screen changeToCard(12); - } else if (_curStack == aspit && _curCard == 12) { + } else if (_curStack == kStackAspit && _curCard == 12) { // From the "quit" screen, just quit _gameOver = true; } else { // Otherwise, return to the main menu - if (_curStack != aspit) - changeToStack(aspit); + if (_curStack != kStackAspit) + changeToStack(kStackAspit); changeToCard(1); } } @@ -573,7 +575,7 @@ void MohawkEngine_Riven::checkInventoryClick() { } // No inventory shown on aspit - if (_curStack == aspit) + if (_curStack == kStackAspit) return; // Set the return stack/card id's. @@ -589,31 +591,31 @@ void MohawkEngine_Riven::checkInventoryClick() { if (!hasCathBook) { if (g_atrusJournalRect1->contains(mousePos)) { _gfx->hideInventory(); - changeToStack(aspit); + changeToStack(kStackAspit); changeToCard(5); } } else if (!hasTrapBook) { if (g_atrusJournalRect2->contains(mousePos)) { _gfx->hideInventory(); - changeToStack(aspit); + changeToStack(kStackAspit); changeToCard(5); } else if (g_cathJournalRect2->contains(mousePos)) { _gfx->hideInventory(); - changeToStack(aspit); + changeToStack(kStackAspit); changeToCard(6); } } else { if (g_atrusJournalRect3->contains(mousePos)) { _gfx->hideInventory(); - changeToStack(aspit); + changeToStack(kStackAspit); changeToCard(5); } else if (g_cathJournalRect3->contains(mousePos)) { _gfx->hideInventory(); - changeToStack(aspit); + changeToStack(kStackAspit); changeToCard(6); } else if (g_trapBookRect3->contains(mousePos)) { _gfx->hideInventory(); - changeToStack(aspit); + changeToStack(kStackAspit); changeToCard(7); } } @@ -735,16 +737,20 @@ Common::Error MohawkEngine_Riven::saveGameState(int slot, const Common::String & Common::String MohawkEngine_Riven::getStackName(uint16 stack) const { static const char *rivenStackNames[] = { - "aspit", - "bspit", - "gspit", - "jspit", + "", "ospit", "pspit", "rspit", - "tspit" + "tspit", + "bspit", + "gspit", + "jspit", + "aspit" }; + // Sanity check. + assert(stack < ARRAYSIZE(rivenStackNames)); + return rivenStackNames[stack]; } diff --git a/engines/mohawk/riven.h b/engines/mohawk/riven.h index c22b9f7f87..9c23d07c52 100644 --- a/engines/mohawk/riven.h +++ b/engines/mohawk/riven.h @@ -44,18 +44,20 @@ class RivenConsole; class RivenSaveLoad; class RivenOptionsDialog; -#define RIVEN_STACKS 8 - // Riven Stack Types enum { - aspit = 0, // Main Menu, Books, Setup - bspit = 1, // Book-Making Island - gspit = 2, // Garden Island - jspit = 3, // Jungle Island - ospit = 4, // 233rd Age (Gehn's Office) - pspit = 5, // Prison Island - rspit = 6, // Rebel Age (Tay) - tspit = 7 // Temple Island + kStackUnknown = 0, // Default value for ReturnStackID + kStackOspit = 1, // 233rd Age (Gehn's Office) + kStackPspit = 2, // Prison Island + kStackRspit = 3, // Temple Island + kStackTspit = 4, // Rebel Age (Tay) + kStackBspit = 5, // Book-Making Island + kStackGspit = 6, // Garden Island + kStackJspit = 7, // Jungle Island + kStackAspit = 8, // Main Menu, Books, Setup + + kStackFirst = kStackOspit, + kStackLast = kStackAspit }; // NAME Resource ID's diff --git a/engines/mohawk/riven_external.cpp b/engines/mohawk/riven_external.cpp index 10dcfd9fa7..3d0bccc47f 100644 --- a/engines/mohawk/riven_external.cpp +++ b/engines/mohawk/riven_external.cpp @@ -405,7 +405,7 @@ void RivenExternal::drawDomeSliders(uint16 startHotspot) { // On pspit, the rect is different by two pixels // (alternatively, we could just use hotspot 3 here, but only on pspit is there a hotspot for this) - if (_vm->getCurStack() == pspit) + if (_vm->getCurStack() == kStackPspit) dstAreaRect.translate(-2, 0); // Find out bitmap id @@ -2016,8 +2016,8 @@ void RivenExternal::xorollcredittime(uint16 argc, uint16 *argv) { // WORKAROUND: The special change stuff only handles one destination and it would // be messy to modify the way that currently works. If we use the trap book on Tay, // we should be using the Tay end game sequences. - if (_vm->_vars["returnstackid"] == rspit) { - _vm->changeToStack(rspit); + if (_vm->_vars["returnstackid"] == kStackRspit) { + _vm->changeToStack(kStackRspit); _vm->changeToCard(2); return; } diff --git a/engines/mohawk/riven_graphics.cpp b/engines/mohawk/riven_graphics.cpp index 615b2fdadb..b44fbb828e 100644 --- a/engines/mohawk/riven_graphics.cpp +++ b/engines/mohawk/riven_graphics.cpp @@ -289,7 +289,7 @@ void RivenGraphics::showInventory() { drawInventoryImage(101, g_demoExitRect); } else { // We don't want to show the inventory on setup screens or in other journals. - if (_vm->getCurStack() == aspit) + if (_vm->getCurStack() == kStackAspit) return; // There are three books and three vars. We have three different diff --git a/engines/mohawk/riven_saveload.cpp b/engines/mohawk/riven_saveload.cpp index d97d0e174b..6af66f7a2d 100644 --- a/engines/mohawk/riven_saveload.cpp +++ b/engines/mohawk/riven_saveload.cpp @@ -38,56 +38,6 @@ Common::StringArray RivenSaveLoad::generateSaveGameList() { return _saveFileMan->listSavefiles("*.rvn"); } -// Note: The stack numbers we use do not match up to what the original executable, -// so, match them ;) -static uint16 mapOldStackIDToNew(uint16 oldID) { - switch (oldID) { - case 1: - return ospit; - case 2: - return pspit; - case 3: - return rspit; - case 4: - return tspit; - case 5: - return bspit; - case 6: - return gspit; - case 7: - return jspit; - case 8: - return aspit; - } - - error("Unknown old stack ID %d", oldID); - return 0; -} - -static uint16 mapNewStackIDToOld(uint16 newID) { - switch (newID) { - case aspit: - return 8; - case bspit: - return 5; - case gspit: - return 6; - case jspit: - return 7; - case ospit: - return 1; - case pspit: - return 2; - case rspit: - return 3; - case tspit: - return 4; - } - - error("Unknown new stack ID %d", newID); - return 0; -} - Common::Error RivenSaveLoad::loadGame(Common::String filename) { if (_vm->getFeatures() & GF_DEMO) // Don't load games in the demo return Common::kNoError; @@ -141,9 +91,6 @@ Common::Error RivenSaveLoad::loadGame(Common::String filename) { names->readUint16BE(); // Skip unknown values uint32 curNamesPos = names->pos(); - uint16 stackID = 0; - uint16 cardID = 0; - for (uint32 i = 0; i < namesCount && !names->eos(); i++) { names->seek(curNamesPos); names->seek(stringOffsets[i], SEEK_CUR); @@ -165,25 +112,18 @@ Common::Error RivenSaveLoad::loadGame(Common::String filename) { uint32 &var = _vm->_vars[name]; name.toLowercase(); - // Handle any special variables here // WORKAROUND: time variables are reset here for one main reason: // The save does not store any start point for the time, so we don't know the real time. // Because of this, in many cases, the original would just give a 'free' Ytram upon saving // since the time would be used in a new (improper) time frame. - if (name.equalsIgnoreCase("CurrentStackID")) // Remap to our definitions, store for later - stackID = mapOldStackIDToNew(rawVariables[i]); - else if (name.equalsIgnoreCase("CurrentCardID")) // Store for later - cardID = rawVariables[i]; - else if (name.equalsIgnoreCase("ReturnStackID") && var != 0) // if 0, the game did not use the variable yet - var = mapOldStackIDToNew(rawVariables[i]); - else if (name.contains("time")) // WORKAROUND: See above + if (name.contains("time")) var = 0; - else // Otherwise, just store it + else var = rawVariables[i]; } - _vm->changeToStack(stackID); - _vm->changeToCard(cardID); + _vm->changeToStack(_vm->_vars["CurrentStackID"]); + _vm->changeToCard(_vm->_vars["CurrentCardID"]); delete names; delete[] stringOffsets; @@ -224,14 +164,7 @@ Common::MemoryWriteStreamDynamic *RivenSaveLoad::genVARSSection() { for (RivenVariableMap::const_iterator it = _vm->_vars.begin(); it != _vm->_vars.end(); it++) { stream->writeUint32BE(0); // Unknown stream->writeUint32BE(0); // Unknown - - // Remap returnstackid here because we don't actually want to change - // our internal returnstackid. - uint32 variable = it->_value; - if (it->_key == "returnstackid") - variable = mapNewStackIDToOld(variable); - - stream->writeUint32BE(variable); + stream->writeUint32BE(it->_value); } return stream; @@ -290,7 +223,7 @@ Common::Error RivenSaveLoad::saveGame(Common::String filename) { filename += ".rvn"; // Convert class variables to variable numbers - _vm->_vars["currentstackid"] = mapNewStackIDToOld(_vm->getCurStack()); + _vm->_vars["currentstackid"] = _vm->getCurStack(); _vm->_vars["currentcardid"] = _vm->getCurCard(); Common::OutSaveFile *saveFile = _saveFileMan->openForSaving(filename); diff --git a/engines/mohawk/riven_scripts.cpp b/engines/mohawk/riven_scripts.cpp index 06b6afdf30..29ee5cd50b 100644 --- a/engines/mohawk/riven_scripts.cpp +++ b/engines/mohawk/riven_scripts.cpp @@ -403,7 +403,7 @@ void RivenScript::stopSound(uint16 op, uint16 argc, uint16 *argv) { // would cause all ambient sounds not to play. An alternative // fix would be to stop all scripts on a stack change, but this // does fine for now. - if (_vm->getCurStack() == tspit && (_vm->getCurCardRMAP() == 0x6e9a || _vm->getCurCardRMAP() == 0xfeeb)) + if (_vm->getCurStack() == kStackTspit && (_vm->getCurCardRMAP() == 0x6e9a || _vm->getCurCardRMAP() == 0xfeeb)) return; // The argument is a bitflag for the setting. @@ -586,7 +586,7 @@ void RivenScript::activatePLST(uint16 op, uint16 argc, uint16 *argv) { void RivenScript::activateSLST(uint16 op, uint16 argc, uint16 *argv) { // WORKAROUND: Disable the SLST that is played during Riven's intro. // Riven X does this too (spoke this over with Jeff) - if (_vm->getCurStack() == tspit && _vm->getCurCardRMAP() == 0x6e9a && argv[0] == 2) + if (_vm->getCurStack() == kStackTspit && _vm->getCurCardRMAP() == 0x6e9a && argv[0] == 2) return; _vm->_sound->playSLST(argv[0], _vm->getCurCard()); -- cgit v1.2.3 From bd5736c641688ab11a68532810be9fcdf4c450b7 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 4 May 2014 09:33:25 +0300 Subject: FULLPIPE: Implement MovGraph::genMovArr() --- engines/fullpipe/motion.cpp | 70 +++++++++++++++++++++++++++++++++++++++++++++ engines/fullpipe/motion.h | 10 +++++++ 2 files changed, 80 insertions(+) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 54854e3043..a1ad4de89f 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -682,6 +682,76 @@ int MovGraph::getItemIndexByStaticAni(StaticANIObject *ani) { return -1; } +Common::Array *MovGraph::genMovArr(int x, int y, int *arrSize, int flag1, int flag2) { + if (!_links.size()) { + *arrSize = 0; + + return 0; + } + + Common::Array *arr = new Common::Array; + MovArr *movarr; + + for (ObList::iterator i = _links.begin(); i != _links.end(); ++i) { + MovGraphLink *lnk = (MovGraphLink *)*i; + + if (flag1) { + Common::Point point(x, y); + double dist = calcDistance(&point, lnk, 0); + + if (dist >= 0.0 && dist < 2.0) { + movarr = new MovArr; + + movarr->_link = lnk; + movarr->_dist = ((double)(lnk->_movGraphNode1->_y - lnk->_movGraphNode2->_y) * (double)(lnk->_movGraphNode1->_y - point.y) + + (double)(lnk->_movGraphNode2->_x - lnk->_movGraphNode1->_x) * (double)(point.x - lnk->_movGraphNode1->_x)) / + lnk->_distance / lnk->_distance; + movarr->_point = point; + + arr->push_back(movarr); + } + } else { + if (lnk->_movGraphReact) { + if (lnk->_movGraphReact->pointInRegion(x, y)) { + if (!(lnk->_flags & 0x10000000) || lnk->_flags & 0x20000000) { + if (!flag2) { + movarr = new MovArr; + movarr->_link = lnk; + movarr->_dist = 0.0; + movarr->_point.x = lnk->_movGraphNode1->_x; + movarr->_point.y = lnk->_movGraphNode1->_y; + arr->push_back(movarr); + + movarr = new MovArr; + movarr->_link = lnk; + movarr->_dist = 1.0; + movarr->_point.x = lnk->_movGraphNode1->_x; + movarr->_point.y = lnk->_movGraphNode1->_y; + arr->push_back(movarr); + } + } else { + movarr = new MovArr; + movarr->_link = lnk; + movarr->_dist = ((double)(lnk->_movGraphNode1->_y - lnk->_movGraphNode2->_y) * (double)(lnk->_movGraphNode1->_y - y) + + (double)(lnk->_movGraphNode2->_x - lnk->_movGraphNode1->_x) * (double)(x - lnk->_movGraphNode1->_x)) / + lnk->_distance / lnk->_distance; + movarr->_point.x = x; + movarr->_point.y = y; + + calcDistance(&movarr->_point, lnk, 0); + + arr->push_back(movarr); + } + } + } + } + } + + *arrSize = arr->size(); + + return arr; +} + int MovGraph2::getItemIndexByGameObjectId(int objectId) { for (uint i = 0; i < _items2.size(); i++) if (_items2[i]->_objectId == objectId) diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index 4d92fd7fed..aa1fa436c2 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -320,6 +320,15 @@ struct MovGraphItem { MovGraphItem(); }; +struct MovArr { + int _afield_0; + int _afield_4; + int _afield_8; + MovGraphLink *_link; + double _dist; + Common::Point _point; +}; + class MovGraph : public MotionController { public: ObList _nodes; @@ -351,6 +360,7 @@ public: void calcNodeDistancesAndAngles(); MovGraphNode *calcOffset(int ox, int oy); int getItemIndexByStaticAni(StaticANIObject *ani); + Common::Array *genMovArr(int x, int y, int *arrSize, int flag1, int flag2); }; class Movement; -- cgit v1.2.3 From 71002e26e7f798a583d408f0154d204ae65e29be Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 4 May 2014 10:41:36 +0300 Subject: FULLPIPE: Implement MovGraph::freeItems() --- engines/fullpipe/motion.cpp | 17 +++++++++++++++-- engines/fullpipe/motion.h | 21 +++++++++++---------- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index a1ad4de89f..8aa879477f 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -507,7 +507,7 @@ bool MctlCompoundArray::load(MfcArchive &file) { MovGraphItem::MovGraphItem() { ani = 0; field_4 = 0; - field_8 = 0; + movarr = 0; field_C = 0; field_10 = 0; field_14 = 0; @@ -523,6 +523,10 @@ MovGraphItem::MovGraphItem() { field_3C = 0; } +void MovGraphItem::free() { + warning("STUB: MovGraphItem::free()"); +} + int MovGraph_messageHandler(ExCommand *cmd); int MovGraphCallback(int a1, int a2, int a3) { @@ -576,7 +580,16 @@ int MovGraph::removeObject(StaticANIObject *obj) { } void MovGraph::freeItems() { - warning("STUB: MovGraph::freeItems()"); + for (uint i = 0; i < _items.size(); i++) { + _items[i]->free(); + + for (int j = 0; j < _items[i]->movarr->size(); j++) + delete (_items[i]->movarr)->operator[](j); + + delete _items[i]->movarr; + } + + _items.clear(); } int MovGraph::method28() { diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index aa1fa436c2..396fc6578f 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -299,10 +299,19 @@ class MovGraphLink : public CObject { void calcNodeDistanceAndAngle(); }; +struct MovArr { + int _afield_0; + int _afield_4; + int _afield_8; + MovGraphLink *_link; + double _dist; + Common::Point _point; +}; + struct MovGraphItem { StaticANIObject *ani; int field_4; - int field_8; + Common::Array *movarr; int field_C; int field_10; int field_14; @@ -318,15 +327,7 @@ struct MovGraphItem { int field_3C; MovGraphItem(); -}; - -struct MovArr { - int _afield_0; - int _afield_4; - int _afield_8; - MovGraphLink *_link; - double _dist; - Common::Point _point; + void free(); }; class MovGraph : public MotionController { -- cgit v1.2.3 From 17b253a2519c021b36cd9f4ed00af9e051369068 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 4 May 2014 09:42:50 +0200 Subject: MADS: Add synchronize in scene 401 and 402 --- engines/mads/nebular/nebular_scenes4.cpp | 54 ++++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes4.h | 2 ++ engines/mads/user_interface.h | 6 ++++ 3 files changed, 62 insertions(+) diff --git a/engines/mads/nebular/nebular_scenes4.cpp b/engines/mads/nebular/nebular_scenes4.cpp index 9d20c687e7..7b50460b9e 100644 --- a/engines/mads/nebular/nebular_scenes4.cpp +++ b/engines/mads/nebular/nebular_scenes4.cpp @@ -98,6 +98,15 @@ void Scene401::setup() { setAAName(); } +void Scene401::synchronize(Common::Serializer &s) { + Scene4xx::synchronize(s); + + s.syncAsByte(_northFl); + s.syncAsSint16LE(_destPos.x); + s.syncAsSint16LE(_destPos.y); + s.syncAsUint32LE(_timer); +} + void Scene401::enter() { if (_scene->_priorSceneId != -2) _northFl = false; @@ -237,6 +246,51 @@ void Scene402::setup() { _scene->addActiveVocab(0xD1); } +void Scene402::synchronize(Common::Serializer &s) { + Scene4xx::synchronize(s); + + s.syncAsByte(_lightOn); + s.syncAsByte(_blowingSmoke); + s.syncAsByte(_leftWomanMoving); + s.syncAsByte(_rightWomanMoving); + s.syncAsByte(_firstTalkToGirlInChair); + s.syncAsByte(_waitingGinnyMove); + s.syncAsByte(_ginnyLooking); + s.syncAsByte(_bigBeatFl); + s.syncAsByte(_roxOnStool); + s.syncAsByte(_bartenderSteady); + s.syncAsByte(_bartenderHandsHips); + s.syncAsByte(_bartenderLooksLeft); + s.syncAsByte(_bartenderReady); + s.syncAsByte(_bartenderTalking); + s.syncAsByte(_bartenderCalled); + s.syncAsByte(_conversationFl); + s.syncAsByte(_activeTeleporter); + s.syncAsByte(_activeArrows); + s.syncAsByte(_activeArrow1); + s.syncAsByte(_activeArrow2); + s.syncAsByte(_activeArrow3); + s.syncAsByte(_cutSceneReady); + s.syncAsByte(_cutSceneNeeded); + s.syncAsByte(_helgaReady); + s.syncAsByte(_refuseAlienLiquor); + + s.syncAsSint16LE(_drinkTimer); + s.syncAsSint16LE(_beatCounter); + s.syncAsSint16LE(_bartenderMode); + s.syncAsSint16LE(_bartenderDialogNode); + s.syncAsSint16LE(_bartenderCurrentQuestion); + s.syncAsSint16LE(_helgaTalkMode); + s.syncAsSint16LE(_roxMode); + s.syncAsSint16LE(_rexMode); + s.syncAsSint16LE(_talkTimer); + + _dialog1.synchronize(s); + _dialog2.synchronize(s); + _dialog3.synchronize(s); + _dialog4.synchronize(s); +} + void Scene402::setDialogNode(int node) { if (node > 0) _bartenderDialogNode = node; diff --git a/engines/mads/nebular/nebular_scenes4.h b/engines/mads/nebular/nebular_scenes4.h index 2010931981..c48d0277ce 100644 --- a/engines/mads/nebular/nebular_scenes4.h +++ b/engines/mads/nebular/nebular_scenes4.h @@ -58,6 +58,7 @@ private: public: Scene401(MADSEngine *vm) : Scene4xx(vm) {} + void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); @@ -119,6 +120,7 @@ private: public: Scene402(MADSEngine *vm) : Scene4xx(vm) {} + void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h index 9948278a55..04a8d090dd 100644 --- a/engines/mads/user_interface.h +++ b/engines/mads/user_interface.h @@ -128,6 +128,12 @@ public: * Starts the conversation */ void start(); + + /** + * Synchronize the conversation + */ + void synchronize(Common::Serializer &s) { warning("TODO: Synchronize Conversation"); }; + }; class UserInterface : public MSurface { -- cgit v1.2.3 From 5c063a1f6ce80d98611d961ef928a592456a51da Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 4 May 2014 12:20:49 +0300 Subject: FULLPIPE: Implement MovGraph2::freeItems() --- engines/fullpipe/motion.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 8aa879477f..df0e8d8e35 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -1186,7 +1186,10 @@ int MovGraph2::removeObject(StaticANIObject *obj) { } void MovGraph2::freeItems() { - warning("STUB: MovGraph2::freeItems()"); + for (uint i = 0; i < _items2.size(); i++) + delete _items2[i]; + + _items2.clear(); } MessageQueue *MovGraph2::method34(StaticANIObject *ani, int xpos, int ypos, int fuzzyMatch, int staticsId) { -- cgit v1.2.3 From 68671d77c2028d41b6b848eb5bf6f40cc2c36f7a Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 4 May 2014 13:57:55 +0300 Subject: MADS: Fix a bug in SequenceList::scan() This resolves the FIXME in SpriteSets::remove() --- engines/mads/sequence.cpp | 2 +- engines/mads/sprites.cpp | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index b46b5c0969..cbe0471315 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -410,7 +410,7 @@ void SequenceList::scan() { Scene &scene = _vm->_game->_scene; for (uint i = 0; i < _entries.size(); ++i) { - if (!_entries[i]._active && (_entries[i]._spritesIndex != -1)) { + if (_entries[i]._active && (_entries[i]._spritesIndex != -1)) { int idx = scene._spriteSlots.add(); setSpriteSlot(i, scene._spriteSlots[idx]); } diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp index 36cbdbea12..7bd8407c41 100644 --- a/engines/mads/sprites.cpp +++ b/engines/mads/sprites.cpp @@ -404,16 +404,12 @@ void SpriteSets::remove(int idx) { (*this)[idx] = nullptr; } else { while (size() > 0 && (*this)[size() - 1] == nullptr) { - delete (*this)[size() - 1]; remove_at(size() - 1); } } if (_assetCount > 0) --_assetCount; - else - // FIXME: This is needed, otherwise scene sprites are not cleared in this case - clear(); } } -- cgit v1.2.3 From dfb53b180f294eeb9cf912dad54e949a87e379a9 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 4 May 2014 14:00:33 +0300 Subject: MADS: Sprites aren't always cleared properly - add a FIXME --- engines/mads/player.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index 20d54902dd..aea73bbbec 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -693,6 +693,12 @@ void Player::releasePlayerSprites() { _numSprites = 0; _spritesLoaded = false; _spritesChanged = true; + + // FIXME: Find out why this occurs + if (scene._sprites.size() > 0) { + warning("Player::releasePlayerSprites(): leftover sprites remain, clearing list"); + scene._sprites.clear(); + } } void Player::synchronize(Common::Serializer &s) { -- cgit v1.2.3 From 8a4bb1d48ca84fe573c073f3d31ca13fa8bc7c4c Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 4 May 2014 14:03:07 +0300 Subject: MADS: Add enums for some magic numbers in Nebular scene group 2 --- engines/mads/nebular/nebular_scenes.h | 12 ++-- engines/mads/nebular/nebular_scenes2.cpp | 105 +++++++++++++++++-------------- 2 files changed, 62 insertions(+), 55 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index a227b7658a..851e5993a3 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -39,16 +39,14 @@ enum { }; enum Noun { - NOUN_D = 0xD, NOUN_BLOWGUN = 0x29, NOUN_BOMB = 0x2A, NOUN_BOMBS = 0x2B, - NOUN_2C = 0x2C, + NOUN_BONE = 0x2C, NOUN_BURGER = 0x35, NOUN_CHAIR = 0x47, NOUN_CHICKEN = 0x49, NOUN_CHICKEN_BOMB = 0x4A, - NOUN_4E = 0x4E, NOUN_DEAD_FISH = 0x65, NOUN_DOOR = 0x6E, NOUN_EAT = 0x75, @@ -64,7 +62,7 @@ enum Noun { NOUN_INSERT = 0x0B6, NOUN_INSPECT = 0x0B7, NOUN_JUNGLE = 0x0B8, - NOUN_C7 = 0x0C7, + NOUN_LADDER = 0x0C7, NOUN_LIFE_SUPPORT_SECTION = 0x0CC, NOUN_LOG = 0x0D0, NOUN_LOOK_AT = 0x0D1, @@ -74,7 +72,7 @@ enum Noun { NOUN_OUTER_HULL = 0x0F8, NOUN_OUTSIDE = 0x0F9, NOUN_PEER_THROUGH = 0x103, - NOUN_10D = 0x10D, + NOUN_PIRANHA = 0x10D, NOUN_PLANT_STALK = 0x10F, NOUN_READ = 0x11F, NOUN_REFRIDGERATOR = 0x122, @@ -83,8 +81,8 @@ enum Noun { NOUN_SHIELD_MODULATOR = 0x137, NOUN_SHOOT = 0x13A, NOUN_SIT_IN = 0x13F, - NOUN_140 = 0x140, - NOUN_1C9 = 0x1C9, + NOUN_SKULL = 0x140, + NOUN_BROKEN_LADDER = 0x1C9, NOUN_SMELL = 0x147, NOUN_STUFFED_FISH = 0x157, NOUN_15F = 0x15F, diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 2ead2c02eb..deded5c772 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -30,6 +30,15 @@ namespace MADS { namespace Nebular { +// Scene 2xx verbs +enum { + VERB_WALK_THROUGH = 0x18B, + VERB_WALK_TOWARDS = 0x18C, + VERB_CLIMB_DOWN = 0x4E, + VERB_WALK_DOWN = 0x1AD + +}; + void Scene2xx::setAAName() { int idx = (_scene->_nextSceneId == 216) ? 4 : 2; _game._aaName = Resources::formatAAName(idx); @@ -123,7 +132,7 @@ void Scene201::setup() { _scene->addActiveVocab(NOUN_15F); _scene->addActiveVocab(NOUN_487); - _scene->addActiveVocab(NOUN_D); + _scene->addActiveVocab(VERB_WALKTO); } void Scene201::enter() { @@ -280,7 +289,7 @@ void Scene201::step() { void Scene201::actions() { if (_action._lookFlag == false) { - if (_action.isAction(0x18C, 0x83)) + if (_action.isAction(VERB_WALK_TOWARDS, 0x83)) _scene->_nextSceneId = 202; else if ((_action.isAction(0x50, 0x156)) || (_action.isAction(0x188, 0x16C)) || (_action.isAction(0x188, 0x1B6))) { if (_game._trigger == 0) { @@ -330,12 +339,12 @@ void Scene202::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(NOUN_C7); - _scene->addActiveVocab(NOUN_4E); - _scene->addActiveVocab(NOUN_D); - _scene->addActiveVocab(NOUN_2C); - _scene->addActiveVocab(NOUN_140); - _scene->addActiveVocab(NOUN_1C9); + _scene->addActiveVocab(NOUN_LADDER); + _scene->addActiveVocab(VERB_CLIMB_DOWN); + _scene->addActiveVocab(VERB_WALKTO); + _scene->addActiveVocab(NOUN_BONE); + _scene->addActiveVocab(NOUN_SKULL); + _scene->addActiveVocab(NOUN_BROKEN_LADDER); } void Scene202::enter() { @@ -358,14 +367,14 @@ void Scene202::enter() { _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 6, 0, 0, 0); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(149, 113)); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 10); - int idx = _scene->_dynamicHotspots.add(320, 13, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_BONE, VERB_WALKTO, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(153, 97), FACING_SOUTH); if (!(_globals[kBone202Status] & 1)) { _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 6, 0, 0, 0); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(130, 108)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); - idx = _scene->_dynamicHotspots.add(44, 13, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + idx = _scene->_dynamicHotspots.add(NOUN_BONE, VERB_WALKTO, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(132, 97), FACING_SOUTH); } @@ -373,7 +382,7 @@ void Scene202::enter() { _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 6, 0, 0, 0); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[6], Common::Point(166, 110)); _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 10); - idx = _scene->_dynamicHotspots.add(44, 13, _globals._sequenceIndexes[6], Common::Rect(0, 0, 0, 0)); + idx = _scene->_dynamicHotspots.add(NOUN_BONE, VERB_WALKTO, _globals._sequenceIndexes[6], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(165, 99), FACING_SOUTH); } @@ -391,8 +400,8 @@ void Scene202::enter() { if (_globals[kLadderBroken]) { _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 6, 0, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 6); - _scene->_hotspots.activate(199, false); - idx = _scene->_dynamicHotspots.add(457, 13, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); + _scene->_hotspots.activate(NOUN_LADDER, false); + idx = _scene->_dynamicHotspots.add(NOUN_BROKEN_LADDER, VERB_WALKTO, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(246, 124), FACING_NORTH); } @@ -529,8 +538,8 @@ void Scene202::step() { case 93: { _globals[kLadderBroken] = -1; _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 6, 0, 0, 0); - _scene->_hotspots.activate(199, false); - int idx = _scene->_dynamicHotspots.add(457, 13, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); + _scene->_hotspots.activate(NOUN_LADDER, false); + int idx = _scene->_dynamicHotspots.add(NOUN_BROKEN_LADDER, VERB_WALKTO, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(246, 124), FACING_NORTH); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[11], _globals._sequenceIndexes[5]); _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[11]); @@ -709,7 +718,7 @@ void Scene202::preActions() { if (player._readyToWalk) _scene->_kernelMessages.reset(); - if (!_ladderTopFl && (_action.isAction(0x4E, 0xC7) || !player._readyToWalk)) { + if (!_ladderTopFl && (_action.isAction(0x4E, NOUN_LADDER) || !player._readyToWalk)) { if (_game._trigger == 0) { _vm->_sound->command(29); player._readyToWalk = false; @@ -741,12 +750,12 @@ void Scene202::preActions() { void Scene202::actions() { if (_action._lookFlag == false) { - if (_action.isAction(0x4E, 0xC7)) { + if (_action.isAction(0x4E, NOUN_LADDER)) { _action._inProgress = false; return; - } else if (_action.isAction(0x18C, 0x83)) { + } else if (_action.isAction(VERB_WALK_TOWARDS, 0x83)) { _scene->_nextSceneId = 203; - } else if (_action.isAction(0x18C, 0x82)) { + } else if (_action.isAction(VERB_WALK_TOWARDS, 0x82)) { if (_globals[kMeteorologistStatus] != 2) { if (_scene->_activeAnimation) _globals[kMeteorologistStatus] = 1; @@ -796,7 +805,7 @@ void Scene202::actions() { return; } } - } else if ((_action.isAction(0x50, 0xC7)) && (_globals[kLadderBroken] == 0)) { + } else if ((_action.isAction(0x50, NOUN_LADDER)) && (_globals[kLadderBroken] == 0)) { switch (_game._trigger) { case 0: _vm->_sound->command(29); @@ -804,7 +813,7 @@ void Scene202::actions() { _game._player._visible = false; _game._player._stepEnabled = false; - _ladderHotspotId = _scene->_dynamicHotspots.add(199, 79, -1, Common::Rect(241, 68, 241 + 12, 68 + 54)); + _ladderHotspotId = _scene->_dynamicHotspots.add(NOUN_LADDER, 79, -1, Common::Rect(241, 68, 241 + 12, 68 + 54)); _scene->_dynamicHotspots.setPosition(_ladderHotspotId, Common::Point(246, 124), FACING_NORTH); _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 6, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[8], 1); @@ -1055,7 +1064,7 @@ void Scene203::step() { } void Scene203::preActions() { - if (_rhotundaEatFl && !_action.isAction(0x18C, 0x83)) { + if (_rhotundaEatFl && !_action.isAction(VERB_WALK_TOWARDS, 0x83)) { _game._player.walk(Common::Point(158, 136), FACING_SOUTH); _action._inProgress = false; return; @@ -1068,9 +1077,9 @@ void Scene203::preActions() { void Scene203::actions() { if (_action._savedFields._lookFlag) { _vm->_dialogs->show(0x4F53); - } else if (_action.isAction(0x18C, 0x83)) { + } else if (_action.isAction(VERB_WALK_TOWARDS, 0x83)) { _scene->_nextSceneId = 208; - } else if (_action.isAction(0x18C, 0x82)) { + } else if (_action.isAction(VERB_WALK_TOWARDS, 0x82)) { _scene->_nextSceneId = 202; } else if (_action.isAction(VERB_LOOK, 0x142)) { _vm->_dialogs->show(0x4F4D); @@ -1095,9 +1104,9 @@ void Scene203::actions() { void Scene205::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(NOUN_D); + _scene->addActiveVocab(VERB_WALKTO); _scene->addActiveVocab(NOUN_CHICKEN); - _scene->addActiveVocab(NOUN_10D); + _scene->addActiveVocab(NOUN_PIRANHA); } void Scene205::enter() { @@ -1228,9 +1237,9 @@ void Scene207::setup() { setPlayerSpritesPrefix(); setAAName(); _scene->addActiveVocab(0x185); - _scene->addActiveVocab(NOUN_D); + _scene->addActiveVocab(VERB_WALKTO); _scene->addActiveVocab(0x14D); - _scene->addActiveVocab(NOUN_D); + _scene->addActiveVocab(VERB_WALKTO); } void Scene207::enter() { @@ -1337,10 +1346,10 @@ void Scene207::step() { } void Scene207::preActions() { - if (_action.isAction(0x1AD, 0x1AE)) + if (_action.isAction(VERB_WALK_DOWN, 0x1AE)) _game._player._walkOffScreenSceneId = 211; - if (_action.isAction(0x18C, 0x1AB)) + if (_action.isAction(VERB_WALK_TOWARDS, 0x1AB)) _game._player._walkOffScreenSceneId = 208; if ((_action.isAction(VERB_WALKTO)) || (_action.isAction(VERB_LOOK))) { @@ -1355,7 +1364,7 @@ void Scene207::preActions() { void Scene207::actions() { if (_action._savedFields._lookFlag) { _vm->_dialogs->show(0x50E7); - } else if (_action.isAction(0x18B, 0x70)) { + } else if (_action.isAction(VERB_WALK_THROUGH, 0x70)) { _scene->_nextSceneId = 214; } else { if ((_game._player._playerPos.x > 150) && (_game._player._playerPos.x < 189) && @@ -1416,7 +1425,7 @@ void Scene208::setup() { _scene->addActiveVocab(0x1A8); _scene->addActiveVocab(0x1A9); _scene->addActiveVocab(0x1AA); - _scene->addActiveVocab(NOUN_D); + _scene->addActiveVocab(VERB_WALKTO); } void Scene208::updateTrap() { @@ -1531,10 +1540,10 @@ void Scene208::preActions() { if (_action.isAction(VERB_LOOK) && player._readyToWalk) player._needToWalk = true; - if (_action.isAction(0x18C, 0x9B)) + if (_action.isAction(VERB_WALK_TOWARDS, 0x9B)) player._walkOffScreenSceneId = 209; - if (_action.isAction(0x18C, 0xF6)) + if (_action.isAction(VERB_WALK_TOWARDS, 0xF6)) player._walkOffScreenSceneId = 207; } @@ -1610,7 +1619,7 @@ void Scene208::subAction(int mode) { } void Scene208::actions() { - if (_action.isAction(0x18C, 0x19F)) { + if (_action.isAction(VERB_WALK_TOWARDS, 0x19F)) { if (_globals[kRhotundaStatus]) _scene->_nextSceneId = 203; else if (_game._trigger == 0) { @@ -1620,7 +1629,7 @@ void Scene208::actions() { } else if (_game._trigger == 1) { _scene->_nextSceneId = 203; } - } else if (_action.isAction(0x18C, 0x83)) { + } else if (_action.isAction(VERB_WALK_TOWARDS, 0x83)) { _scene->_nextSceneId = 212; } else if (_action.isAction(VERB_TAKE, 0x1AA) && (!_globals[kLeavesStatus] || _game._trigger)) { subAction(1); @@ -2946,7 +2955,7 @@ void Scene209::step() { } void Scene209::preActions() { - if (_action.isAction(0x18C, 0x84)) + if (_action.isAction(VERB_WALK_TOWARDS, 0x84)) _game._player._walkOffScreenSceneId = 208; if (_globals[36] == 1) { @@ -2974,7 +2983,7 @@ void Scene209::actions() { return; } - if (_action.isAction(0x18C, 0x1A2)) { + if (_action.isAction(VERB_WALK_TOWARDS, 0x1A2)) { _scene->_nextSceneId = 203; _action._inProgress = false; return; @@ -3287,7 +3296,7 @@ void Scene210::setup() { setPlayerSpritesPrefix(); setAAName(); _scene->addActiveVocab(0x70); - _scene->addActiveVocab(0x18B); + _scene->addActiveVocab(VERB_WALK_THROUGH); } void Scene210::handleConversations() { @@ -4090,7 +4099,7 @@ void Scene210::step() { void Scene210::preActions() { _stopWalking = false; - if (_action.isAction(0x1AD, 0x1C1)) + if (_action.isAction(VERB_WALK_DOWN, 0x1C1)) _game._player._walkOffScreenSceneId = 211; } @@ -4166,9 +4175,9 @@ void Scene210::actions() { _shouldMoveHead = false; break; } - } else if (_action.isAction(0x1AD, 0x1BF) || _action.isAction(0x18C, 0x1C0)) { + } else if (_action.isAction(VERB_WALK_DOWN, 0x1BF) || _action.isAction(VERB_WALK_TOWARDS, 0x1C0)) { _scene->_nextSceneId = 205; - } else if (_action.isAction(0x18B, 0x70)) { + } else if (_action.isAction(VERB_WALK_THROUGH, 0x70)) { _scene->_nextSceneId = 215; } else if ((_action.isAction(VERB_PULL, 0x5F) || _action.isAction(VERB_OPEN, 0x5F)) && !_globals[kCurtainOpen]) { switch (_game._trigger) { @@ -4460,18 +4469,18 @@ void Scene211::step() { } void Scene211::preActions() { - if (_action.isAction(0x1AD, 0x1B2) && _game._objects.isInInventory(OBJ_BINOCULARS) && (_globals[kMonkeyStatus] == MONKEY_AMBUSH_READY) + if (_action.isAction(VERB_WALK_DOWN, 0x1B2) && _game._objects.isInInventory(OBJ_BINOCULARS) && (_globals[kMonkeyStatus] == MONKEY_AMBUSH_READY) && (_scene->_customDest.x <= 52) && (_scene->_customDest.y >= 132)) _game._player.walk(Common::Point(52, 132), FACING_WEST); - if (_action.isAction(0x1AD, 0x1AE)) { + if (_action.isAction(VERB_WALK_DOWN, 0x1AE)) { if (_game._objects.isInInventory(OBJ_BINOCULARS) && (_globals[kMonkeyStatus] == MONKEY_AMBUSH_READY)) _game._player.walk(Common::Point(52, 132), FACING_WEST); else _game._player._walkOffScreenSceneId = 210; } - if (_action.isAction(0x1AD, 0x1B1)) + if (_action.isAction(VERB_WALK_DOWN, 0x1B1)) _game._player._walkOffScreenSceneId = 207; } @@ -4544,16 +4553,16 @@ void Scene212::step() { } void Scene212::preActions() { - if (_action.isAction(0x18B, 0x41)) + if (_action.isAction(VERB_WALK_THROUGH, 0x41)) _game._player._walkOffScreenSceneId = 111; } void Scene212::actions() { if (_action._lookFlag) _vm->_dialogs->show(0x52D9); - else if (_action.isAction(0x18C) && (_action.isObject(0x82) || _action.isObject(0xE8))) + else if (_action.isAction(VERB_WALK_TOWARDS) && (_action.isObject(0x82) || _action.isObject(0xE8))) _scene->_nextSceneId = 208; - else if (_action.isAction(0x18C, 0x3F)) + else if (_action.isAction(VERB_WALK_TOWARDS, 0x3F)) _scene->_nextSceneId = 111; else if (_action.isAction(VERB_LOOK, 0x19C)) _vm->_dialogs->show(0x52D1); -- cgit v1.2.3 From 356e0655cc5094c50a92fbd334a32a918c05b82e Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 4 May 2014 14:37:12 +0300 Subject: MADS: Clean up the Rex object IDs a bit --- engines/mads/nebular/game_nebular.h | 69 +++++++++++++++++++++++++++++-------- 1 file changed, 55 insertions(+), 14 deletions(-) diff --git a/engines/mads/nebular/game_nebular.h b/engines/mads/nebular/game_nebular.h index ab82cf68d7..0c859fadff 100644 --- a/engines/mads/nebular/game_nebular.h +++ b/engines/mads/nebular/game_nebular.h @@ -38,20 +38,61 @@ enum Difficulty { DIFFICULTY_HARD = 1, DIFFICULTY_REALLY_HARD = 2, DIFFICULTY_IMPOSSIBLE = 3 }; -enum InventoryObject { OBJ_NONE = -1, OBJ_BINOCULARS = 0, - OBJ_BURGER = 1, OBJ_DEAD_FISH = 2, OBJ_STUFFED_FISH = 3, OBJ_REBREATHER = 4, - OBJ_TIMER_MODULE = 5, OBJ_BIG_LEAVES = 6, OBJ_POISON_DARTS = 7, OBJ_PLANT_STALK = 8, - OBJ_BLOWGUN = 9, OBJ_TWINKIFRUIT = 10, OBJ_BONE = 11, OBJ_CHICKEN = 12, - OBJ_SCALPEL = 13, OBJ_AUDIO_TAPE = 14, OBJ_CREDIT_CHIP = 15, OBJ_SECURITY_CARD = 16, - OBJ_CHARGE_CASES = 17, OBJ_ESTROTOXIN = 18, OBJ_BOMB = 19, OBJ_TIMEBOMB = 20, - OBJ_REPAIR_LIST = 21, OBJ_ALIEN_LIQUOR = 22, OBJ_TARGET_MODULE = 23, OBJ_SHIELD_MODULATOR = 24, - OBJ_TAPE_PLAYER = 25, OBJ_PHONE_CELLS = 26, OBJ_PENLIGHT = 27, OBJ_DURAFAIL_CELLS = 28, - OBJ_FAKE_ID = 29, OBJ_ID_CARD = 30, OBJ_POLYCEMENT = 31, OBJ_FISHING_LINE = 33, - OBJ_PADLOCK_KEY = 34, OBJ_DOOR_KEY = 35, OBJ_REARVIEW_MIRROR = 36, OBJ_COMPACT_CASE = 37, - OBJ_DETONATORS = 39, OBJ_BOTTLE = 40, OBJ_CHICKEN_BOMB = 41, OBJ_VASE = 42, - OBJ_REMOTE = 43, OBJ_COMPUTER_GAME = 44, OBJ_PHONE_HANDSET = 45, OBJ_BONES = 46, - OBJ_GUARDS_ARM = 47, OBJ_LOG = 48, OBJ_BOMBS = 49, OBJ_NOTE = 50, - OBJ_COMBINATION = 51, OBJ_FORMALDEHYDE = 52, OBJ_PETROX = 53, OBJ_LECITHIN = 54 +enum InventoryObject { + OBJ_NONE = -1, + OBJ_BINOCULARS = 0, + OBJ_BURGER = 1, + OBJ_DEAD_FISH = 2, + OBJ_STUFFED_FISH = 3, + OBJ_REBREATHER = 4, + OBJ_TIMER_MODULE = 5, + OBJ_BIG_LEAVES = 6, + OBJ_POISON_DARTS = 7, + OBJ_PLANT_STALK = 8, + OBJ_BLOWGUN = 9, + OBJ_TWINKIFRUIT = 10, + OBJ_BONE = 11, + OBJ_CHICKEN = 12, + OBJ_SCALPEL = 13, + OBJ_AUDIO_TAPE = 14, + OBJ_CREDIT_CHIP = 15, + OBJ_SECURITY_CARD = 16, + OBJ_CHARGE_CASES = 17, + OBJ_ESTROTOXIN = 18, + OBJ_BOMB = 19, + OBJ_TIMEBOMB = 20, + OBJ_REPAIR_LIST = 21, + OBJ_ALIEN_LIQUOR = 22, + OBJ_TARGET_MODULE = 23, + OBJ_SHIELD_MODULATOR = 24, + OBJ_TAPE_PLAYER = 25, + OBJ_PHONE_CELLS = 26, + OBJ_PENLIGHT = 27, + OBJ_DURAFAIL_CELLS = 28, + OBJ_FAKE_ID = 29, + OBJ_ID_CARD = 30, + OBJ_POLYCEMENT = 31, + OBJ_FISHING_LINE = 33, + OBJ_PADLOCK_KEY = 34, + OBJ_DOOR_KEY = 35, + OBJ_REARVIEW_MIRROR = 36, + OBJ_COMPACT_CASE = 37, + OBJ_DETONATORS = 39, + OBJ_BOTTLE = 40, + OBJ_CHICKEN_BOMB = 41, + OBJ_VASE = 42, + OBJ_REMOTE = 43, + OBJ_COMPUTER_GAME = 44, + OBJ_PHONE_HANDSET = 45, + OBJ_BONES = 46, + OBJ_GUARDS_ARM = 47, + OBJ_LOG = 48, + OBJ_BOMBS = 49, + OBJ_NOTE = 50, + OBJ_COMBINATION = 51, + OBJ_FORMALDEHYDE = 52, + OBJ_PETROX = 53, + OBJ_LECITHIN = 54 }; class GameNebular: public Game { -- cgit v1.2.3 From d730abf16fa6b41d9f4d620ea4e6c709980ccb44 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 4 May 2014 14:38:17 +0300 Subject: MADS: Replace some more magic values for inventory items and actions --- engines/mads/nebular/nebular_scenes.h | 3 ++- engines/mads/nebular/nebular_scenes2.cpp | 26 +++++++++++++------------- engines/mads/nebular/nebular_scenes3.cpp | 6 +++--- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index 851e5993a3..a4481ba193 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -89,6 +89,7 @@ enum Noun { NOUN_TIMEBOMB = 0x171, NOUN_VIEW_SCREEN = 0x180, NOUN_WALK_THROUGH = 0x18B, + NOUN_PILE_OF_LEAVES = 0x1AA, NOUN_CAPTIVE_CREATURE = 0x1C3, NOUN_NATIVE_WOMAN = 0x1DC, NOUN_ALCOHOL = 0x310, @@ -96,7 +97,7 @@ enum Noun { NOUN_DROP = 0x3AD, NOUN_DASH = 0x3AE, NOUN_SPLASH = 0x3AF, - NOUN_487 = 0x487 + NOUN_BIRDS = 0x487 }; class SceneFactory { diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index deded5c772..1e5079c792 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -34,9 +34,9 @@ namespace Nebular { enum { VERB_WALK_THROUGH = 0x18B, VERB_WALK_TOWARDS = 0x18C, - VERB_CLIMB_DOWN = 0x4E, - VERB_WALK_DOWN = 0x1AD + VERB_WALK_DOWN = 0x1AD, + VERB_CLIMB_DOWN = 0x4E }; void Scene2xx::setAAName() { @@ -131,7 +131,7 @@ void Scene201::setup() { setAAName(); _scene->addActiveVocab(NOUN_15F); - _scene->addActiveVocab(NOUN_487); + _scene->addActiveVocab(NOUN_BIRDS); _scene->addActiveVocab(VERB_WALKTO); } @@ -148,7 +148,7 @@ void Scene201::enter() { _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 8); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(185, 46)); - int idx = _scene->_dynamicHotspots.add(1159, 209, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_BIRDS, 209, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(186, 81), FACING_NORTH); if ((_scene->_priorSceneId == 202) || (_scene->_priorSceneId == -1)) { @@ -1424,7 +1424,7 @@ void Scene208::setup() { setAAName(); _scene->addActiveVocab(0x1A8); _scene->addActiveVocab(0x1A9); - _scene->addActiveVocab(0x1AA); + _scene->addActiveVocab(NOUN_PILE_OF_LEAVES); _scene->addActiveVocab(VERB_WALKTO); } @@ -1578,27 +1578,27 @@ void Scene208::subAction(int mode) { case 2: { switch (mode) { case 1: - _game._objects.addToInventory(6); + _game._objects.addToInventory(OBJ_BIG_LEAVES); _scene->_sequences.remove(_globals._sequenceIndexes[2]); _globals[kLeavesStatus] = 1; break; case 2: - _game._objects.setRoom(6, 1); + _game._objects.setRoom(OBJ_BIG_LEAVES, 1); _globals[kLeavesStatus] = 2; updateTrap(); break; case 3: _scene->_sequences.remove(_globals._sequenceIndexes[3]); _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); - _game._objects.removeFromInventory(10, 1); + _game._objects.removeFromInventory(OBJ_TWINKIFRUIT, 1); _vm->_sound->command(34); break; case 4: - _game._objects.removeFromInventory(1, 1); + _game._objects.removeFromInventory(OBJ_BURGER, 1); _vm->_sound->command(33); break; case 5: - _game._objects.removeFromInventory(2, 1); + _game._objects.removeFromInventory(OBJ_DEAD_FISH, 1); _vm->_sound->command(33); break; } @@ -1631,13 +1631,13 @@ void Scene208::actions() { } } else if (_action.isAction(VERB_WALK_TOWARDS, 0x83)) { _scene->_nextSceneId = 212; - } else if (_action.isAction(VERB_TAKE, 0x1AA) && (!_globals[kLeavesStatus] || _game._trigger)) { + } else if (_action.isAction(VERB_TAKE, NOUN_PILE_OF_LEAVES) && (!_globals[kLeavesStatus] || _game._trigger)) { subAction(1); if (_game._player._stepEnabled) _vm->_dialogs->showItem(OBJ_BIG_LEAVES, 0x326, 0); } else if (_action.isAction(VERB_PUT, 0x23, 0x19E) && (_globals[kLeavesStatus] == 1 || _game._trigger)) { subAction(2); - } else if (_action.isAction(VERB_PUT, 0x17A, 0x1A9)) { + } else if (_action.isAction(VERB_PUT, OBJ_TWINKIFRUIT, 0x1A9)) { subAction(3); if (_game._player._stepEnabled) { _game._player._stepEnabled = false; @@ -1670,7 +1670,7 @@ void Scene208::actions() { _vm->_dialogs->show(0x5147); } else if (_action.isAction(VERB_LOOK, 0x19E)) { _vm->_dialogs->show(0x5148); - } else if (_action.isAction(VERB_LOOK, 0x1AA)) { + } else if (_action.isAction(VERB_LOOK, NOUN_PILE_OF_LEAVES)) { _vm->_dialogs->show(0x5149); } else if (_action.isAction(VERB_LOOK, 0x1A9)) { if (_game._difficulty == DIFFICULTY_IMPOSSIBLE) diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 09b3152347..c69990706f 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -3798,13 +3798,13 @@ void Scene351::actions() { case 1: _scene->_hotspots.activate(0x5C, false); _scene->_sequences.remove(_globals._sequenceIndexes[1]); - _game._objects.addToInventory(0xF); + _game._objects.addToInventory(OBJ_CREDIT_CHIP); break; case 2: _game._player._visible = true; _game._player._stepEnabled = true; - _vm->_dialogs->showItem(0xF, 0x32F); + _vm->_dialogs->showItem(OBJ_CREDIT_CHIP, 0x32F); break; } } @@ -4147,7 +4147,7 @@ void Scene352::actions() { case 1: _scene->_sequences.remove(_globals._sequenceIndexes[2]); - _game._objects.addToInventory(0x2F); + _game._objects.addToInventory(OBJ_GUARDS_ARM); _scene->changeVariant(1); break; -- cgit v1.2.3 From 5f2ca95771241f657b02cdbcb5c17c1038776c77 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 4 May 2014 15:34:10 +0300 Subject: MADS: Replace some more article magic numbers with their enum --- engines/mads/action.cpp | 4 ++-- engines/mads/hotspots.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index ab4a112b71..3367521d88 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -62,7 +62,7 @@ MADSAction::MADSAction(MADSEngine *vm) : _vm(vm) { _savedFields._mainObject = 0; _savedFields._secondObject = 0; _savedFields._secondObjectSource = 0; - _savedFields._articleNumber = 0; + _savedFields._articleNumber = PREP_NONE; _savedFields._lookFlag = false; } @@ -223,7 +223,7 @@ void MADSAction::set() { } if ((_hotspotId >= 0) && (_articleNumber > 0) && !flag) { - if (_articleNumber == 0xff) { + if (_articleNumber == PREP_RELATIONAL) { if (_secondObject >= 0) { int articleNum = 0; diff --git a/engines/mads/hotspots.cpp b/engines/mads/hotspots.cpp index 0853f66eac..ca05ad618c 100644 --- a/engines/mads/hotspots.cpp +++ b/engines/mads/hotspots.cpp @@ -66,7 +66,7 @@ int DynamicHotspots::add(int descId, int verbId, int seqIndex, const Common::Rec _entries[idx]._feetPos = Common::Point(-3, 0); _entries[idx]._facing = FACING_NONE; _entries[idx]._verbId = verbId; - _entries[idx]._articleNumber = 6; + _entries[idx]._articleNumber = PREP_IN; _entries[idx]._cursor = CURSOR_NONE; ++_count; -- cgit v1.2.3 From 2e5fcc1460bca88338c70142ba31246f6dc15421 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 4 May 2014 15:35:13 +0300 Subject: MADS: Replace some magic values in scene 208 with their enums --- engines/mads/nebular/nebular_scenes.h | 2 ++ engines/mads/nebular/nebular_scenes2.cpp | 26 +++++++++++++------------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index a4481ba193..0c39899e46 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -89,6 +89,8 @@ enum Noun { NOUN_TIMEBOMB = 0x171, NOUN_VIEW_SCREEN = 0x180, NOUN_WALK_THROUGH = 0x18B, + NOUN_HUGE_LEGS = 0x1A8, + NOUN_LEAF_COVERED_PIT = 0x1A9, NOUN_PILE_OF_LEAVES = 0x1AA, NOUN_CAPTIVE_CREATURE = 0x1C3, NOUN_NATIVE_WOMAN = 0x1DC, diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 1e5079c792..5f64ebc07f 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -1422,8 +1422,8 @@ void Scene207::actions() { void Scene208::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(0x1A8); - _scene->addActiveVocab(0x1A9); + _scene->addActiveVocab(NOUN_HUGE_LEGS); + _scene->addActiveVocab(NOUN_LEAF_COVERED_PIT); _scene->addActiveVocab(NOUN_PILE_OF_LEAVES); _scene->addActiveVocab(VERB_WALKTO); } @@ -1432,7 +1432,7 @@ void Scene208::updateTrap() { if (_globals[kRhotundaStatus] == 1) { _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 8, 0, 0, 24); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 5); - int idx = _scene->_dynamicHotspots.add(424, 13, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_HUGE_LEGS, VERB_WALKTO, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(100, 146), FACING_NORTH); _scene->_hotspots.activate(414, false); return; @@ -1442,7 +1442,7 @@ void Scene208::updateTrap() { case 0: { _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 15); - int idx = _scene->_dynamicHotspots.add(426, 13, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_PILE_OF_LEAVES, VERB_WALKTO, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(60, 152), FACING_NORTH); } break; @@ -1450,9 +1450,9 @@ void Scene208::updateTrap() { _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 15); _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); _scene->_hotspots.activate(414, false); - int idx = _scene->_dynamicHotspots.add(425, 13, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_LEAF_COVERED_PIT, VERB_WALKTO, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(100, 146), FACING_NORTH); - _scene->_dynamicHotspots[idx]._articleNumber = 5; + _scene->_dynamicHotspots[idx]._articleNumber = PREP_ON; } break; } @@ -1637,19 +1637,19 @@ void Scene208::actions() { _vm->_dialogs->showItem(OBJ_BIG_LEAVES, 0x326, 0); } else if (_action.isAction(VERB_PUT, 0x23, 0x19E) && (_globals[kLeavesStatus] == 1 || _game._trigger)) { subAction(2); - } else if (_action.isAction(VERB_PUT, OBJ_TWINKIFRUIT, 0x1A9)) { + } else if (_action.isAction(VERB_PUT, OBJ_TWINKIFRUIT, NOUN_LEAF_COVERED_PIT)) { subAction(3); if (_game._player._stepEnabled) { _game._player._stepEnabled = false; _rhotundaTurnFl = true; _game._player.walk(Common::Point(20, 148), FACING_EAST); } - } else if (_action.isAction(VERB_PUT, 0x35, 0x1A9)) { + } else if (_action.isAction(VERB_PUT, 0x35, NOUN_LEAF_COVERED_PIT)) { subAction(4); if (_game._player._stepEnabled) { _vm->_dialogs->show(0x514C); } - } else if (_action.isAction(VERB_PUT, 0x65, 0x1A9)) { + } else if (_action.isAction(VERB_PUT, 0x65, NOUN_LEAF_COVERED_PIT)) { subAction(5); if (_game._player._stepEnabled) { _vm->_dialogs->show(0x514C); @@ -1672,18 +1672,18 @@ void Scene208::actions() { _vm->_dialogs->show(0x5148); } else if (_action.isAction(VERB_LOOK, NOUN_PILE_OF_LEAVES)) { _vm->_dialogs->show(0x5149); - } else if (_action.isAction(VERB_LOOK, 0x1A9)) { + } else if (_action.isAction(VERB_LOOK, NOUN_LEAF_COVERED_PIT)) { if (_game._difficulty == DIFFICULTY_IMPOSSIBLE) _vm->_dialogs->show(0x514A); else _vm->_dialogs->show(0x514B); } else if (_action.isAction(VERB_LOOK, 0x174) || _action.isAction(VERB_LOOK, 0x175)) { _vm->_dialogs->show(0x514D); - } else if (_action.isAction(VERB_TAKE, 0x1A9)) { + } else if (_action.isAction(VERB_TAKE, NOUN_LEAF_COVERED_PIT)) { _vm->_dialogs->show(0x514E); - } else if (_action.isAction(VERB_LOOK, 0x1A8)) { + } else if (_action.isAction(VERB_LOOK, NOUN_HUGE_LEGS)) { _vm->_dialogs->show(0x514F); - } else if (_action.isAction(VERB_TAKE, 0x1A8) || _action.isAction(0xA, 0x1A8)) { + } else if (_action.isAction(VERB_TAKE, NOUN_HUGE_LEGS) || _action.isAction(0xA, NOUN_HUGE_LEGS)) { _vm->_dialogs->show(0x5150); } else if (_action._savedFields._lookFlag == 0) { return; -- cgit v1.2.3 From 9966afbb8f215b1ba8dfaf752355060b1d7b1092 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 4 May 2014 15:59:00 +0300 Subject: MADS: More naming for scene 208 --- engines/mads/nebular/nebular_scenes.h | 3 +++ engines/mads/nebular/nebular_scenes2.cpp | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index 0c39899e46..85b24050d6 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -39,6 +39,7 @@ enum { }; enum Noun { + NOUN_BIG_LEAVES = 0x23, NOUN_BLOWGUN = 0x29, NOUN_BOMB = 0x2A, NOUN_BOMBS = 0x2B, @@ -87,8 +88,10 @@ enum Noun { NOUN_STUFFED_FISH = 0x157, NOUN_15F = 0x15F, NOUN_TIMEBOMB = 0x171, + NOUN_TWINKIFRUIT = 0x17A, NOUN_VIEW_SCREEN = 0x180, NOUN_WALK_THROUGH = 0x18B, + NOUN_DEEP_PIT = 0x19E, NOUN_HUGE_LEGS = 0x1A8, NOUN_LEAF_COVERED_PIT = 0x1A9, NOUN_PILE_OF_LEAVES = 0x1AA, diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 5f64ebc07f..44fac5a4df 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -1635,21 +1635,21 @@ void Scene208::actions() { subAction(1); if (_game._player._stepEnabled) _vm->_dialogs->showItem(OBJ_BIG_LEAVES, 0x326, 0); - } else if (_action.isAction(VERB_PUT, 0x23, 0x19E) && (_globals[kLeavesStatus] == 1 || _game._trigger)) { + } else if (_action.isAction(VERB_PUT, NOUN_BIG_LEAVES, NOUN_DEEP_PIT) && (_globals[kLeavesStatus] == 1 || _game._trigger)) { subAction(2); - } else if (_action.isAction(VERB_PUT, OBJ_TWINKIFRUIT, NOUN_LEAF_COVERED_PIT)) { + } else if (_action.isAction(VERB_PUT, NOUN_TWINKIFRUIT, NOUN_LEAF_COVERED_PIT)) { subAction(3); if (_game._player._stepEnabled) { _game._player._stepEnabled = false; _rhotundaTurnFl = true; _game._player.walk(Common::Point(20, 148), FACING_EAST); } - } else if (_action.isAction(VERB_PUT, 0x35, NOUN_LEAF_COVERED_PIT)) { + } else if (_action.isAction(VERB_PUT, NOUN_BURGER, NOUN_LEAF_COVERED_PIT)) { subAction(4); if (_game._player._stepEnabled) { _vm->_dialogs->show(0x514C); } - } else if (_action.isAction(VERB_PUT, 0x65, NOUN_LEAF_COVERED_PIT)) { + } else if (_action.isAction(VERB_PUT, NOUN_DEAD_FISH, NOUN_LEAF_COVERED_PIT)) { subAction(5); if (_game._player._stepEnabled) { _vm->_dialogs->show(0x514C); @@ -1668,7 +1668,7 @@ void Scene208::actions() { _vm->_dialogs->show(0x5146); } else if (_action.isAction(VERB_LOOK, 0x9B)) { _vm->_dialogs->show(0x5147); - } else if (_action.isAction(VERB_LOOK, 0x19E)) { + } else if (_action.isAction(VERB_LOOK, NOUN_DEEP_PIT)) { _vm->_dialogs->show(0x5148); } else if (_action.isAction(VERB_LOOK, NOUN_PILE_OF_LEAVES)) { _vm->_dialogs->show(0x5149); @@ -1683,7 +1683,7 @@ void Scene208::actions() { _vm->_dialogs->show(0x514E); } else if (_action.isAction(VERB_LOOK, NOUN_HUGE_LEGS)) { _vm->_dialogs->show(0x514F); - } else if (_action.isAction(VERB_TAKE, NOUN_HUGE_LEGS) || _action.isAction(0xA, NOUN_HUGE_LEGS)) { + } else if (_action.isAction(VERB_TAKE, NOUN_HUGE_LEGS) || _action.isAction(VERB_PULL, NOUN_HUGE_LEGS)) { _vm->_dialogs->show(0x5150); } else if (_action._savedFields._lookFlag == 0) { return; -- cgit v1.2.3 From ea359fe92a0d64ed49910366c3d58dc582d22a71 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 4 May 2014 18:25:36 +0200 Subject: ZVISION: Fix out of bounds access. --- engines/zvision/sound/zork_raw.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/sound/zork_raw.cpp b/engines/zvision/sound/zork_raw.cpp index 55353acbb9..a0441a55f9 100644 --- a/engines/zvision/sound/zork_raw.cpp +++ b/engines/zvision/sound/zork_raw.cpp @@ -192,7 +192,7 @@ Audio::RewindableAudioStream *makeRawZorkStream(const Common::String &filePath, } } } else if (engine->getGameId() == GID_GRANDINQUISITOR) { - for (int i = 0; i < 6; ++i) { + for (uint i = 0; i < ARRAYSIZE(RawZorkStream::_zgiSoundParamLookupTable); ++i) { if (RawZorkStream::_zgiSoundParamLookupTable[i].identifier == fileIdentifier) { soundParams = RawZorkStream::_zgiSoundParamLookupTable[i]; foundParams = true; -- cgit v1.2.3 From 29da6e5b9bf7c1328a6e08f37c8d67228143293a Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 4 May 2014 18:26:31 +0200 Subject: ZVISION: Small cleanup. --- engines/zvision/sound/zork_raw.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/zvision/sound/zork_raw.cpp b/engines/zvision/sound/zork_raw.cpp index a0441a55f9..edee1fd16e 100644 --- a/engines/zvision/sound/zork_raw.cpp +++ b/engines/zvision/sound/zork_raw.cpp @@ -185,7 +185,7 @@ Audio::RewindableAudioStream *makeRawZorkStream(const Common::String &filePath, char fileIdentifier = (engine->getGameId() == GID_NEMESIS) ? fileName[6] : fileName[7]; if (engine->getGameId() == GID_NEMESIS) { - for (int i = 0; i < 6; ++i) { + for (uint i = 0; i < ARRAYSIZE(RawZorkStream::_zNemSoundParamLookupTable); ++i) { if (RawZorkStream::_zNemSoundParamLookupTable[i].identifier == fileIdentifier) { soundParams = RawZorkStream::_zNemSoundParamLookupTable[i]; foundParams = true; -- cgit v1.2.3 From b2be5788cf4305d2d9e47a6bd4f14f1a12140834 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Sun, 4 May 2014 13:12:42 -0400 Subject: MOHAWK: Add missing comma --- engines/mohawk/riven_vars.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mohawk/riven_vars.cpp b/engines/mohawk/riven_vars.cpp index efb9c1c3a2..f09aba7f90 100644 --- a/engines/mohawk/riven_vars.cpp +++ b/engines/mohawk/riven_vars.cpp @@ -117,7 +117,7 @@ static const char *variableNames[] = { "gRViewMPos", "gRViewPos", "gScribe", - "gScribeTime" + "gScribeTime", "gSubElev", "gSubDr", "gUpMoov", -- cgit v1.2.3 From f894b3f1269203793214a750cbd5a9ae022d2d8c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 4 May 2014 19:21:38 +0200 Subject: MADS: Implement scene 409, first try of Teleporter implementation --- engines/mads/nebular/nebular_scenes.cpp | 273 ++++++++++++++++++++++++++++++- engines/mads/nebular/nebular_scenes.h | 30 +++- engines/mads/nebular/nebular_scenes4.cpp | 57 +++++++ engines/mads/nebular/nebular_scenes4.h | 12 ++ 4 files changed, 366 insertions(+), 6 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 0a92cd3bd1..da568ce1f7 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -180,6 +180,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene407(vm); case 408: return new Scene408(vm); + case 409: + return new Scene409(vm); case 410: return new Scene410(vm); case 411: @@ -187,11 +189,6 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 413: return new Scene413(vm); - case 409: - // TODO - // Fall-through for unimplemented scenes in group #4 - error("Invalid scene %d called", scene._nextSceneId); - // Scene group #5 case 501: // TODO @@ -353,6 +350,272 @@ void SceneInfoNebular::loadCodes(MSurface &depthSurface, Common::SeekableReadStr Common::fill(destP, endP, 0); } +/*------------------------------------------------------------------------*/ + +int SceneTeleporter::teleporterAddress(int code, bool working) { + int limit = working ? 6 : 10; + + for (int i = 0; i < limit; i++) { + if (code == _globals[kTeleporterCode + i]) + return _globals[kTeleporterRoom + i]; + } + + return -1; +} + +Common::Point SceneTeleporter::teleporterComputeLocation() { + Common::Point result; + + switch (_buttonTyped) { + case 0: + result = Common::Point(179, 200); + break; + + case 1: + result = Common::Point(166, 170); + break; + + case 2: + result = Common::Point(179, 170); + break; + + case 3: + result = Common::Point(192, 170); + break; + + case 4: + result = Common::Point(166, 180); + break; + + case 5: + result = Common::Point(179, 180); + break; + + case 6: + result = Common::Point(192, 180); + break; + + case 7: + result = Common::Point(166, 190); + break; + + case 8: + result = Common::Point(179, 190); + break; + + case 9: + result = Common::Point(192, 190); + break; + + case 10: + result = Common::Point(194, 200); + break; + + case 11: + result = Common::Point(164, 200); + break; + + default: + error("teleporterComputeLocation() - Unexpected button pressed"); + } + + return result; +} + +void SceneTeleporter::teleporterHandleKey() { + switch (_game._trigger) { + case 0: { + _game._player._stepEnabled = false; + Common::Point msgPos = teleporterComputeLocation(); + _handSequenceId = _scene->_sequences.startReverseCycle(_handSpriteId, false, 4, 2, 0, 0); + _scene->_sequences.setMsgPosition(_handSequenceId, msgPos); + _scene->_sequences.setDepth(_handSequenceId, 2); + _scene->_sequences.addSubEntry(_handSequenceId, SEQUENCE_TRIGGER_LOOP, 0, 1); + _scene->_sequences.addSubEntry(_handSequenceId, SEQUENCE_TRIGGER_EXPIRE, 0, 2); + + if (_globals[kMeteorologistWatch] == 0) + _vm->_events->hideCursor(); + + } + break; + + case 1: + _scene->_sequences.addSubEntry(_handSequenceId, SEQUENCE_TRIGGER_SPRITE, 3, 3); + if (_buttonTyped <= 9) { + if (_digitCount < 4) { + _curCode *= 10; + _curCode += _buttonTyped; + _digitCount++; + _msgText = ""; + _msgText.format("%d", _curCode); + if (_digitCount < 4) + _msgText += "_"; + + if (_scene->_currentSceneId != 711) + _vm->_sound->command(32); + } + } else if (_buttonTyped == 11) { + _digitCount = 0; + _curCode = 0; + _msgText = "_"; + if (_scene->_currentSceneId != 711) + _vm->_sound->command(33); + } else if (_digitCount == 4) { + if (_scene->_currentSceneId != 711) + _finishedCodeCounter = 1; + + if (teleporterAddress(_curCode, true) > 0) { + _vm->_palette->setEntry(252, 0, 63, 0); + if (_scene->_currentSceneId != 711) + _vm->_sound->command(34); + } else { + _vm->_palette->setEntry(252, 63, 0, 0); + if (_scene->_currentSceneId != 711) + _vm->_sound->command(35); + } + } + + if (_scene->_currentSceneId != 711) { + if (_curMessageId >= 0) + _scene->_kernelMessages.remove(_curMessageId); + _curMessageId = _scene->_kernelMessages.add(Common::Point(143, 61), 0xFDFC, 16, 0, 9999999, _msgText); + } + break; + + case 2: + if (_finishedCodeCounter == 1) { + _finishedCodeCounter++; + + if (_globals[kMeteorologistWatch] != 0) + _scene->_nextSceneId = 202; + else { + _vm->_events->showCursor(); + int destination = teleporterAddress(_curCode, true); + + if (destination > 0) { + _globals[kTeleporterCommand] = 2; + _scene->_nextSceneId = _teleporterSceneId; + _globals[kTeleporterDestination] = destination; + } else { + _globals[kTeleporterCommand] = 4; + _scene->_nextSceneId = _teleporterSceneId; + } + } + } else if (_globals[kMeteorologistWatch] != 0) + _scene->_sequences.addTimer(30, 230 + _meteorologistCurPlace); + + break; + + case 3: + if (!_finishedCodeCounter) { + if (_globals[kMeteorologistWatch] == 0) { + _game._player._stepEnabled = true; + _vm->_events->showCursor(); + } + } + break; + + default: + break; + } +} + +void SceneTeleporter::teleporterEnter() { + _game._player._visible = false; + _game._player._stepEnabled = (_globals[kMeteorologistWatch] == 0); + _scene->_kernelMessages._talkFont = _vm->_font->getFont(FONT_TELE); + _scene->_textSpacing = 0; + _curCode = 0; + _digitCount = 0; + _finishedCodeCounter = 0; + _curMessageId = -1; + _msgText = "_"; + + if (_scene->_priorSceneId == -2) + _scene->_priorSceneId = _globals[kTeleporterDestination]; + + if (_scene->_priorSceneId < 101) + _scene->_priorSceneId = 201; + + _globals[kTeleporterDestination] = _scene->_priorSceneId; + _vm->_palette->setEntry(252, 63, 63, 0); + _vm->_palette->setEntry(253, 0, 0, 0); + _teleporterSceneId = _scene->_priorSceneId; + if (_teleporterSceneId == 202) + _teleporterSceneId = 201; + + int tmpVal = 0; + for (int i = 0; i < 10; i++) { + if (_teleporterSceneId == _globals[kTeleporterRoom + i]) + tmpVal = _globals[kTeleporterRoom + i]; + + if (_globals[kTeleporterRoom + i] == 301) + _meteorologistNextPlace = _globals[kTeleporterCode + i]; + } + + Common::String msgText2 = Common::String::format("#%d", tmpVal); + + if (_scene->_currentSceneId != 711) { + _scene->_kernelMessages.add(Common::Point(133, 34), 0, 32, 0, 9999999, msgText2); + _scene->_kernelMessages.add(Common::Point(143, 61), 0xFDFC, 16, 0, 9999999, _msgText); + } + + _meteorologistCurPlace = 0; + + if (_globals[kMeteorologistWatch] != 0) + _scene->_sequences.addTimer(30, 230); + + _vm->_sound->command(36); +} + +bool SceneTeleporter::teleporterActions() { + bool retVal = false; + static int _buttonList[12] = { 0x1D0, 0x1D1, 0x1D2, 0x1D3, 0x1D4, 0x1D5, 0x1D6, 0x1D7, 0x1D8, 0x1D9, 0x1DB, 0x1DA }; + + if (_action.isAction(0x11A) || _action.isAction(VERB_PUSH)) { + for (int i = 0; i < 12; i++) { + if (_action._activeAction._objectNameId == _buttonList[i]) + _buttonTyped = i; + } + teleporterHandleKey(); + retVal = true; + } + + if (_action.isAction(0x1CE, 0x1CF)) { + _globals[kTeleporterCommand] = 3; + _scene->_nextSceneId = _teleporterSceneId; + retVal = true; + } + + return (retVal); +} + +void SceneTeleporter::teleporterStep() { + if ((_globals[kMeteorologistWatch] != 0) && (_game._trigger >= 230)) { + int place = _game._trigger - 230; + int digit; + + if (place < 4) { + digit = _meteorologistNextPlace; + for (int i = 0; i < (3 - place); i++) + digit = digit / 10; + + digit = digit % 10; + } else { + digit = 10; + } + _buttonTyped = digit; + _meteorologistCurPlace = place + 1; + _game._trigger = -1; + } + + if (_game._trigger) { + if (_game._trigger == -1) + _game._trigger = 0; + teleporterHandleKey(); + } +} + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index 85b24050d6..2a47af61d3 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -125,7 +125,7 @@ protected: Common::String formAnimName(char sepChar, int suffixNum); /** - * Plays appropriate sound for entering varous rooms + * Plays appropriate sound for entering various rooms */ void lowRoomsEntrySound(); public: @@ -150,6 +150,34 @@ protected: SceneInfoNebular(MADSEngine *vm) : SceneInfo(vm) {} }; +class SceneTeleporter : public NebularScene { +protected: + int _buttonTyped; + int _curCode; + int _digitCount; + int _curMessageId; + int _handSpriteId; + int _handSequenceId; + int _finishedCodeCounter; + int _meteorologistNextPlace; + int _meteorologistCurPlace; + int _teleporterSceneId; + Common::String _msgText; + + int teleporterAddress(int code, bool working); + + void teleporterHandleKey(); + Common::Point teleporterComputeLocation(); + void teleporterEnter(); + bool teleporterActions(); + void teleporterStep(); + +protected: + /** + * Constructor + */ + SceneTeleporter(MADSEngine *vm) : NebularScene(vm) {} +}; } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes4.cpp b/engines/mads/nebular/nebular_scenes4.cpp index 7b50460b9e..980f77004a 100644 --- a/engines/mads/nebular/nebular_scenes4.cpp +++ b/engines/mads/nebular/nebular_scenes4.cpp @@ -2993,6 +2993,63 @@ void Scene408::actions() { /*------------------------------------------------------------------------*/ +void Scene409::setup() { + _game._player._spritesPrefix = ""; + + // The original is calling Scene4xx::setAAName() + _game._aaName = Resources::formatAAName(4); +} + +void Scene409::enter() { + _handSpriteId = _scene->_sprites.addSprites("*ROXHAND"); + teleporterEnter(); + + // The original is calling Scene4xx::sceneEntrySound() + if (!_vm->_musicFlag) + _vm->_sound->command(2); + else + _vm->_sound->command(10); +} + +void Scene409::step() { + teleporterStep(); +} + +void Scene409::actions() { + if (teleporterActions()) { + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x181)) + _vm->_dialogs->show(40910); + else if (_action.isAction(0x103, 0x181)) + _vm->_dialogs->show(40910); + else if (_action.isAction(VERB_LOOK, 0xC4)) + _vm->_dialogs->show(40911); + else if (_action.isAction(0xB7, 0xC4)) + _vm->_dialogs->show(40911); + else if (_action.isAction(VERB_LOOK, 0x1CC)) + _vm->_dialogs->show(40912); + else if (_action.isAction(VERB_LOOK, 0x1D1) || _action.isAction(VERB_LOOK, 0x1D2) + || _action.isAction(VERB_LOOK, 0x1D3) || _action.isAction(VERB_LOOK, 0x1D4) + || _action.isAction(VERB_LOOK, 0x1D5) || _action.isAction(VERB_LOOK, 0x1D6) + || _action.isAction(VERB_LOOK, 0x1D7) || _action.isAction(VERB_LOOK, 0x1D8) + || _action.isAction(VERB_LOOK, 0x1D9) || _action.isAction(VERB_LOOK, 0x1D0) + || _action.isAction(VERB_LOOK, 0x1DB) || _action.isAction(VERB_LOOK, 0x1DA)) + _vm->_dialogs->show(40913); + else if (_action.isAction(VERB_LOOK, 0x1CF)) + _vm->_dialogs->show(40914); + else if (_action._lookFlag) + _vm->_dialogs->show(40914); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + void Scene410::setup() { setPlayerSpritesPrefix(); setAAName(); diff --git a/engines/mads/nebular/nebular_scenes4.h b/engines/mads/nebular/nebular_scenes4.h index c48d0277ce..1f7b56b5cd 100644 --- a/engines/mads/nebular/nebular_scenes4.h +++ b/engines/mads/nebular/nebular_scenes4.h @@ -185,6 +185,18 @@ public: virtual void postActions() {}; }; +class Scene409: public SceneTeleporter { +public: + Scene409(MADSEngine *vm) : SceneTeleporter(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions(); + virtual void postActions() {}; +}; + class Scene410: public Scene4xx { public: Scene410(MADSEngine *vm) : Scene4xx(vm) {} -- cgit v1.2.3 From ff5b97e75af06e07692eb9ddd9da73055997eefe Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 4 May 2014 14:32:58 -0400 Subject: MADS: In progress greyscale fading for picking up inventory items --- engines/mads/dialogs.h | 6 +- engines/mads/nebular/dialogs_nebular.cpp | 83 ++++++++++++---- engines/mads/nebular/dialogs_nebular.h | 26 ++++- engines/mads/palette.cpp | 159 +++++++++++++++++++++++++++++-- engines/mads/palette.h | 64 ++++++++++++- 5 files changed, 303 insertions(+), 35 deletions(-) diff --git a/engines/mads/dialogs.h b/engines/mads/dialogs.h index e4f9bbb038..884f7e6866 100644 --- a/engines/mads/dialogs.h +++ b/engines/mads/dialogs.h @@ -181,7 +181,7 @@ public: /** * Show the dialog, and wait until a key or mouse press. */ - void show(); + virtual void show(); }; class MessageDialog: public TextDialog { @@ -211,9 +211,9 @@ public: virtual ~Dialogs() {} virtual void showDialog() = 0; - virtual void showItem(int objectId, int messageId, int arg = 0) = 0; + virtual void showItem(int objectId, int messageId, int speech = 0) = 0; - virtual bool show(int msgId) = 0; + virtual bool show(int messageId, int objectId = -1) = 0; }; } // End of namespace MADS diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp index dc7d432cb8..9dd20cafec 100644 --- a/engines/mads/nebular/dialogs_nebular.cpp +++ b/engines/mads/nebular/dialogs_nebular.cpp @@ -33,9 +33,9 @@ namespace MADS { namespace Nebular { -bool DialogsNebular::show(int msgId) { +bool DialogsNebular::show(int messageId, int objectId) { MADSAction &action = _vm->_game->_scene._action; - Common::StringArray msg = _vm->_game->getMessage(msgId); + Common::StringArray msg = _vm->_game->getMessage(messageId); Common::String title; Common::String commandText; Common::String valStr; @@ -76,7 +76,11 @@ bool DialogsNebular::show(int msgId) { if (centerFlag) { crFlag = true; } else { - dialog = new TextDialog(_vm, FONT_INTERFACE, _defaultPosition, _dialogWidth); + if (objectId == -1) { + dialog = new TextDialog(_vm, FONT_INTERFACE, _defaultPosition, _dialogWidth); + } else { + dialog = new PictureDialog(_vm, _defaultPosition, _dialogWidth, objectId); + } dialog->wordWrap(dialogText); dialog->incNumLines(); } @@ -128,7 +132,11 @@ bool DialogsNebular::show(int msgId) { } if (!dialog) { - dialog = new TextDialog(_vm, FONT_INTERFACE, _defaultPosition, _dialogWidth); + if (objectId == -1) { + dialog = new TextDialog(_vm, FONT_INTERFACE, _defaultPosition, _dialogWidth); + } else { + dialog = new PictureDialog(_vm, _defaultPosition, _dialogWidth, objectId); + } } if (centerFlag) { @@ -158,8 +166,11 @@ bool DialogsNebular::show(int msgId) { return result; } -void DialogsNebular::showItem(int objectId, int messageId, int arg) { - show(messageId); +void DialogsNebular::showItem(int objectId, int messageId, int speech) { + // MADS engine doesn't currently support speech + assert(!speech); + + show(messageId, objectId); #if 0 Scene &scene = _vm->_game->_scene; byte highPalette[8 * 3]; @@ -170,15 +181,6 @@ void DialogsNebular::showItem(int objectId, int messageId, int arg) { greyScale[0] = greyScale[1] = greyScale[2] = 0xFFFF; Common::String setName = Common::String::format("*OBJ%.3d.SS", objectId); - // Turn off cycling if active - bool cyclingActive = scene._cyclingActive; - scene._cyclingActive = false; - - // Make a copy of the current screen surface - byte *savedSurface = new byte[MADS_SCREEN_WIDTH * MADS_SCREEN_HEIGHT]; - Common::copy(_vm->_screen.getData(), _vm->_screen.getData() + - MADS_SCREEN_WIDTH * MADS_SCREEN_HEIGHT, savedSurface); - delete[] savedSurface; @@ -287,7 +289,7 @@ TextDialog(vm, FONT_INTERFACE, Common::Point(-1, -1), 32) { wordWrap("\n"); } -bool CopyProtectionDialog::show() { +void CopyProtectionDialog::show() { draw(); _vm->_events->showCursor(); @@ -298,7 +300,6 @@ bool CopyProtectionDialog::show() { } _vm->_events->_pendingKeys.clear(); - return true; } bool CopyProtectionDialog::getHogAnusEntry(HOGANUS &entry) { @@ -331,6 +332,54 @@ bool CopyProtectionDialog::getHogAnusEntry(HOGANUS &entry) { /*------------------------------------------------------------------------*/ +PictureDialog::PictureDialog(MADSEngine *vm, const Common::Point &pos, + int maxChars, int objectId) : + TextDialog(vm, FONT_INTERFACE, pos, maxChars), _objectId(objectId) { + Scene &scene = _vm->_game->_scene; + Palette &palette = *_vm->_palette; + + // Turn off cycling if active + _cyclingActive = scene._cyclingActive; + scene._cyclingActive = false; + + // Save palette information + Common::copy(&palette._mainPalette[0], &palette._mainPalette[PALETTE_SIZE], &_palette[0]); + Common::copy(&palette._palFlags[0], &palette._palFlags[PALETTE_COUNT], &_palFlags[0]); + _rgbList.copy(palette._rgbList); + + // Set up palette allocation + uint32 *palFlagP = &palette._palFlags[0]; + for (int idx = 0; idx < PALETTE_COUNT; ++idx, ++palFlagP) { + *palFlagP = (idx < PALETTE_RESERVED_LOW_COUNT || + idx >= (PALETTE_COUNT - PALETTE_RESERVED_HIGH_COUNT - 10)) ? 1 : 0; + } + + // Reset the flag list + palette._rgbList.reset(); +} + +PictureDialog::~PictureDialog() { + Scene &scene = _vm->_game->_scene; + scene._cyclingActive = _cyclingActive; +} + +void PictureDialog::show() { + setupPalette(); + + TextDialog::show(); +} + +void PictureDialog::setupPalette() { + Palette &palette = *_vm->_palette; + byte map[PALETTE_COUNT]; + + int numColors = PALETTE_COUNT - PALETTE_RESERVED_LOW_COUNT - PALETTE_RESERVED_HIGH_COUNT; + palette.fadeToGrey(palette._mainPalette, &map[PALETTE_RESERVED_LOW_COUNT], + PALETTE_RESERVED_LOW_COUNT, numColors, 248, 8, 1, 16); +} + +/*------------------------------------------------------------------------*/ + ScreenDialog::DialogLine::DialogLine() { _state = 0; _textDisplayIndex = -1; diff --git a/engines/mads/nebular/dialogs_nebular.h b/engines/mads/nebular/dialogs_nebular.h index b5ee090efa..fd4d6e706e 100644 --- a/engines/mads/nebular/dialogs_nebular.h +++ b/engines/mads/nebular/dialogs_nebular.h @@ -49,9 +49,9 @@ private: public: virtual void showDialog(); - virtual void showItem(int objectId, int msgId, int arg); + virtual void showItem(int objectId, int messageId, int speech = -1); - virtual bool show(int id); + virtual bool show(int messageId, int objectId = -1); }; struct HOGANUS { @@ -79,7 +79,27 @@ public: /** * Show the dialog */ - bool show(); + virtual void show(); +}; + +class PictureDialog : public TextDialog { +private: + int _objectId; + bool _cyclingActive; + byte _palette[PALETTE_SIZE]; + uint32 _palFlags[PALETTE_COUNT]; + RGBList _rgbList; + + /** + * Sets up the palette and fades the screen to gray + */ + void setupPalette(); +public: + PictureDialog(MADSEngine *vm, const Common::Point &pos, int maxChars, int objectId); + + virtual ~PictureDialog(); + + virtual void show(); }; enum DialogTextAlign { ALIGN_CENTER = -1, ALIGN_AT_CENTER = -2, ALIGN_RIGHT = -3 }; diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index 51de2768ed..ad45562181 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -69,7 +69,7 @@ static bool sortHelper(const PaletteUsage::UsageEntry &ue1, const PaletteUsage:: void PaletteUsage::prioritize(Common::Array &palette) { for (uint i = 0; i < _data->size(); ++i) { RGB6 &palEntry = palette[(*_data)[i]._palIndex]; - (*_data)[i]._sortValue = rgbMerge(palEntry); + (*_data)[i]._sortValue = _vm->_palette->rgbMerge(palEntry); } Common::sort(_data->begin(), _data->end(), sortHelper); @@ -237,12 +237,6 @@ int PaletteUsage::process(Common::Array &palette, uint flags) { return rgbIndex; } - -int PaletteUsage::rgbMerge(RGB6 &palEntry) { - return ((palEntry.r + 1) / 4 - 1) * 38 + ((palEntry.g + 1) / 4 - 1) * 76 + - ((palEntry.b + 1) / 4 - 1) * 14; -} - void PaletteUsage::transform(Common::Array &palette) { if (!empty()) { for (uint i = 0; i < _data->size(); ++i) { @@ -336,6 +330,157 @@ int RGBList::scan() { error("RGBList was full"); } +void RGBList::copy(RGBList &src) { + Common::copy(&src._data[0], &src._data[32], &_data[0]); +} + +/*------------------------------------------------------------------------*/ + +Fader::Fader() { + _colorFlags[0] = _colorFlags[1] = _colorFlags[2] = true; + _colorFlags[3] = false; + _colorValues[0] = _colorValues[1] = 0; + _colorValues[2] = _colorValues[3] = 0; +} + +void Fader::fadeToGrey(byte palette[PALETTE_SIZE], byte paletteMap[PALETTE_COUNT], + int baseColor, int numColors, int baseGrey, int numGreys, + int tickDelay, int steps) { + GreyEntry map[PALETTE_COUNT]; + int intensity; + byte palIndex[PALETTE_COUNT][3]; + bool signs[PALETTE_COUNT][3]; + + mapToGreyRamp(palette, baseColor, numColors, baseGrey, numGreys, map); + + for (int palCtr = baseColor; palCtr < (baseColor + numColors); ++palCtr) { + int index = palCtr - baseColor; + for (int colorCtr = 0; colorCtr < 3; ++colorCtr) { + if (_colorFlags[colorCtr]) { + int shiftSign = _colorValues[colorCtr]; + if (shiftSign >= 0) { + intensity = map[index]._intensity << shiftSign; + } else { + intensity = map[index]._intensity >> ABS(shiftSign); + } + } else { + intensity = _colorValues[colorCtr]; + } + + int diff = intensity - palette[palCtr * 3 + colorCtr]; + palIndex[palCtr][colorCtr] = (byte)ABS(diff); + signs[palCtr][colorCtr] = diff / ABS(diff); + } + } + + // TODO: More here +} + +static bool greyCompareFunc(const Fader::GreyTableEntry &g1, const Fader::GreyTableEntry &g2) { + return g1._list < g2._list; +} + +void Fader::mapToGreyRamp(byte palette[PALETTE_SIZE], int baseColor, int numColors, + int baseGrey, int numGreys, GreyEntry *map) { + GreyTableEntry greyList[PALETTE_COUNT]; + byte greyTable[64]; + byte greyIntensity[64]; + int intensity, shiftSign; + + getGreyValues(palette, greyList, baseColor, numColors); + greyPopularity(greyList, greyTable, numColors); + + for (int idx = 0; idx < numColors; ++idx) { + greyList[idx]._mapping = idx; + Common::fill(&map[idx]._accum[0], &map[idx]._accum[3], 0); + } + + for (int idx = 0; idx < PALETTE_COUNT; ++idx) { + map[idx]._mapColor = (byte)idx; + } + + // Sort the mapping list + Common::sort(&greyList[0], &greyList[numColors], greyCompareFunc); + + // Initialise state variables + int greySum = 0; + int greyScan = 0; + int greyMark = 0; + int greyColors = 0; + int greyAccum = 0; + int firstColor = 0; + + for (int greyCtr = 0; greyCtr < 64; greyCtr++) { + for (int idx = 0; idx < greyTable[greyCtr]; idx++) { + greySum += greyList[greyScan++]._list; + ++greyColors; + + greyAccum += numGreys; + while (greyAccum >= numColors) { + greyAccum -= numColors; + if (greyColors > 0) { + greyIntensity[greyMark] = (byte)(greySum / greyColors); + } + + for (int rescan = firstColor; rescan < greyScan; ++rescan) { + map[greyList[rescan]._mapping]._intensity = greyIntensity[greyMark]; + map[greyList[rescan]._mapping]._mapColor = (byte)(greyMark + baseGrey); + } + + firstColor = greyScan; + greySum = 0; + greyColors = 0; + ++greyMark; + } + } + } + + // Process palette with intensities + byte *palP = &palette[baseGrey * 3]; + for (int greys = 0; greys < numGreys; ++greys) { + for (int color = 0; color < 3; ++color) { + if (_colorFlags[color]) { + shiftSign = (byte)_colorValues[color]; + if (shiftSign >= 0) { + intensity = greyIntensity[greys] << shiftSign; + } else { + intensity = greyIntensity[greys] >> abs(shiftSign); + } + } else { + intensity = _colorValues[color]; + } + *palP++ = VGA_COLOR_TRANS(intensity); + } + } +} + +void Fader::getGreyValues(const byte palette[PALETTE_SIZE], + GreyTableEntry greyList[PALETTE_COUNT], int baseColor, int numColors) { + const byte *palP = &palette[baseColor * 3]; + GreyTableEntry *destP = greyList; + + for (int i = 0; i < numColors; ++i, palP += 3, ++destP) { + int v = rgbMerge(palP[0], palP[1], palP[2]); + destP->_list = v >> 7; + } +} + +void Fader::greyPopularity(const GreyTableEntry greyList[PALETTE_COUNT], + byte greyTable[64], int numColors) { + Common::fill(&greyTable[0], &greyTable[64], 0); + for (int i = 0; i < 64; ++i) { + ++greyTable[greyList[i]._list]; + } +} + +int Fader::rgbMerge(RGB6 &palEntry) { + return rgbMerge(palEntry.r, palEntry.g, palEntry.b); +} + +int Fader::rgbMerge(byte r, byte g, byte b) { + return ((r + 1) / 4 - 1) * 38 + ((g + 1) / 4 - 1) * 76 + ((b + 1) / 4 - 1) * 14; +} + /*------------------------------------------------------------------------*/ Palette::Palette(MADSEngine *vm) : _vm(vm), _paletteUsage(vm) { diff --git a/engines/mads/palette.h b/engines/mads/palette.h index d1c7c1da7a..883f7d79d9 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -32,6 +32,12 @@ class MADSEngine; #define PALETTE_USAGE_COUNT 4 +#define PALETTE_RESERVED_LOW_COUNT 18 +#define PALETTE_RESERVED_HIGH_COUNT 10 + +#define PALETTE_COUNT 256 +#define PALETTE_SIZE (256 * 3) + /** * Palette mapping options */ @@ -62,6 +68,9 @@ struct RGB6 { byte _u2; byte _flags; + /** + * Load an entry from a stream + */ void load(Common::SeekableReadStream *f); }; @@ -83,8 +92,6 @@ private: MADSEngine *_vm; Common::Array *_data; - int rgbMerge(RGB6 &palEntry); - int getGamePalFreeIndex(int *palIndex); int rgbFactor(byte *palEntry, RGB6 &pal6); @@ -141,6 +148,11 @@ public: void reset(); + /** + * Copies the data from another instance + */ + void copy(RGBList &src); + /** * Scans for a free slot */ @@ -149,10 +161,52 @@ public: bool &operator[](int idx) { return _data[idx]; } }; -#define PALETTE_COUNT 256 -#define PALETTE_SIZE (256 * 3) +class Fader { +public: + struct GreyEntry { + byte _intensity; + byte _mapColor; + uint16 _accum[3]; + }; + + struct GreyTableEntry { + int _list; + int _mapping; + }; +private: + void mapToGreyRamp(byte palette[PALETTE_SIZE], int baseColor, int numColors, + int baseGrey, int numGreys, GreyEntry *map); + + void getGreyValues(const byte palette[PALETTE_SIZE], GreyTableEntry greyList[PALETTE_COUNT], + int baseColor, int numColors); + + /** + * Given a grey value list containing grey shades (0-63), creates a 64 byte + * grey table containing the number of grey values for each intensity + */ + void greyPopularity(const GreyTableEntry greyList[PALETTE_COUNT], byte greyTable[64], int numColors); +public: + bool _colorFlags[4]; + int _colorValues[4]; +public: + /** + * Constructor + */ + Fader(); + + int rgbMerge(byte r, byte g, byte b); + + int rgbMerge(RGB6 &palEntry); + + /** + * Fades the given palette to greyscale + */ + void fadeToGrey(byte palette[PALETTE_SIZE], byte paletteMap[PALETTE_COUNT], + int baseColor, int numColors, int baseGrey, int numGreys, + int tickDelay, int steps); +}; -class Palette { +class Palette: public Fader { private: /** * Initialises the first 16 palette indexes with the equivalent -- cgit v1.2.3 From 36a1b66c71543749cdf9276bb18f2e85b98a46e9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 4 May 2014 15:05:31 -0400 Subject: MADS: Fix for scene loading in teleporter scenes --- engines/mads/assets.cpp | 11 ----------- engines/mads/assets.h | 5 ----- engines/mads/scene_data.cpp | 25 ++++++++++++------------- engines/mads/sprites.cpp | 4 ++-- 4 files changed, 14 insertions(+), 31 deletions(-) diff --git a/engines/mads/assets.cpp b/engines/mads/assets.cpp index 46a6d3c916..bf9647dda4 100644 --- a/engines/mads/assets.cpp +++ b/engines/mads/assets.cpp @@ -205,17 +205,6 @@ MSprite *SpriteAsset::getFrame(int frameIndex) { } } - -void SpriteAsset::drawScaled(int frameNumber, MSurface &depthSurface, MSurface &destSurface, - int scale, int depth, const Common::Point &pos) { - error("TODO: SpriteAsset::drawScaled - map to frame methods"); -} - -void SpriteAsset::depthDraw(MSurface *surface, MSurface *depthSurface, int frameNumber, - const Common::Point &pt, int depth) { - error("TODO: map depthDraw to frame draw methods"); -} - /*------------------------------------------------------------------------*/ SpriteSetCharInfo::SpriteSetCharInfo(Common::SeekableReadStream *s) { diff --git a/engines/mads/assets.h b/engines/mads/assets.h index dfe6db086e..874eee7925 100644 --- a/engines/mads/assets.h +++ b/engines/mads/assets.h @@ -105,11 +105,6 @@ public: byte *getPalette() { return _palette; } int getColorCount() { return _colorCount; } bool isBackground() const { return _isBackground; } - - void drawScaled(int frameNumber, MSurface &depthSurface, MSurface &destSurface, - int scale, int depth, const Common::Point &pos); - void depthDraw(MSurface *surface, MSurface *depthSurface, int frameNumber, - const Common::Point &pt, int depth); }; } // End of namespace MADS diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index 646106ee9a..65220ced35 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -226,17 +226,15 @@ void SceneInfo::load(int sceneId, int variant, const Common::String &resName, Common::Array spriteSets; Common::Array usageList; - if (flags & 1) { - for (uint i = 0; i < setNames.size(); ++i) { - Common::String setResName; - if (sceneFlag || resName.hasPrefix("*")) - setResName += "*"; - setResName += setNames[i]; - - SpriteAsset *sprites = new SpriteAsset(_vm, setResName, flags); - spriteSets.push_back(sprites); - usageList.push_back(sprites->_usageIndex); - } + for (uint i = 0; i < setNames.size(); ++i) { + Common::String setResName; + if (sceneFlag || resName.hasPrefix("*")) + setResName += "*"; + setResName += setNames[i]; + + SpriteAsset *sprites = new SpriteAsset(_vm, setResName, flags); + spriteSets.push_back(sprites); + usageList.push_back(sprites->_usageIndex); } _vm->_palette->_paletteUsage.updateUsage(usageList, _usageIndex); @@ -246,8 +244,9 @@ void SceneInfo::load(int sceneId, int variant, const Common::String &resName, SpriteAsset *asset = spriteSets[si._spriteSetIndex]; assert(asset && _depthStyle != 2); - asset->drawScaled(asset->getCount(), depthSurface, bgSurface, - si._scale, si._depth, si._position); + MSprite *spr = asset->getFrame(asset->getCount() - 1); + bgSurface.copyFrom(spr, si._position, si._depth, &depthSurface, si._scale, + spr->getTransparencyIndex()); } // Free the sprite sets diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp index 7bd8407c41..432a0e17df 100644 --- a/engines/mads/sprites.cpp +++ b/engines/mads/sprites.cpp @@ -258,8 +258,8 @@ void SpriteSlots::drawBackground() { if (spriteSlot._depth <= 1) { frame->copyTo(&scene._backgroundSurface, frame->getTransparencyIndex()); } else if (scene._depthStyle == 0) { - asset->depthDraw(&scene._backgroundSurface, &scene._depthSurface, spriteSlot._frameNumber, - pt, spriteSlot._depth); + scene._backgroundSurface.copyFrom(frame, pt, spriteSlot._depth, &scene._backgroundSurface, + 100, frame->getTransparencyIndex()); } else { error("Unsupported depth style"); } -- cgit v1.2.3 From bc774144aaa170e20dc9e328eff47f719ba05214 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 4 May 2014 21:46:36 +0200 Subject: MADS: Implement scene 213 --- engines/mads/nebular/nebular_scenes.cpp | 3 +- engines/mads/nebular/nebular_scenes2.cpp | 60 ++++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes2.h | 11 ++++++ 3 files changed, 73 insertions(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index da568ce1f7..795477d5e5 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -95,7 +95,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene211(vm); case 212: return new Scene212(vm); - + case 213: + return new Scene213(vm); case 214: return new Scene214(vm); case 215: diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 44fac5a4df..9b36dbb156 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -4588,6 +4588,66 @@ void Scene212::actions() { /*------------------------------------------------------------------------*/ +void Scene213::setup() { + _game._player._spritesPrefix = ""; + + // The original is calling Scene2xx::setAAName() + _game._aaName = Resources::formatAAName(2); +} + +void Scene213::enter() { + if (_globals[kMeteorologistWatch] != 0) + _handSpriteId = _scene->_sprites.addSprites("*METHAND", false); + else if (_globals[kSexOfRex] == REX_MALE) + _handSpriteId = _scene->_sprites.addSprites("*REXHAND", false); + else + _handSpriteId = _scene->_sprites.addSprites("*ROXHAND", false); + + teleporterEnter(); + + // The original is calling Scene2xx::sceneEntrySound() + if (_vm->_musicFlag) { + if (_globals[kMeteorologistWatch] == 0) + _vm->_sound->command(1); + else + _vm->_sound->command(9); + } else + _vm->_sound->command(2); +} + +void Scene213::step() { + teleporterStep(); +} + +void Scene213::actions() { + if (teleporterActions()) { + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x59)) + _vm->_dialogs->show(21301); + else if (_action.isAction(VERB_LOOK, 0xC4) || _action.isAction (0xB7, 0xC4)) + _vm->_dialogs->show(21302); + else if (_action.isAction(VERB_LOOK, 0x1CC)) + _vm->_dialogs->show(21303); + else if (_action.isAction(VERB_LOOK, 0x181) || _action.isAction(0x103, 0x181)) + _vm->_dialogs->show(21304); + else if (_action.isAction(VERB_LOOK, 0x1CF)) + _vm->_dialogs->show(21305); + else if (_action.isAction(VERB_LOOK, 0x1D0) || _action.isAction(VERB_LOOK, 0x1D1) + || _action.isAction(VERB_LOOK, 0x1D2) || _action.isAction(VERB_LOOK, 0x1D3) + || _action.isAction(VERB_LOOK, 0x1D4) || _action.isAction(VERB_LOOK, 0x1D5) + || _action.isAction(VERB_LOOK, 0x1D6) || _action.isAction(VERB_LOOK, 0x1D7) + || _action.isAction(VERB_LOOK, 0x1D8) || _action.isAction(VERB_LOOK, 0x1D9) + || _action.isAction(VERB_LOOK, 0x1DB) || _action.isAction(VERB_LOOK, 0x7A) + || _action.isAction(VERB_LOOK, 0x1DA)) + _vm->_dialogs->show(21306); + else + return; + + _action._inProgress = false; +} /*------------------------------------------------------------------------*/ diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index 886f7cf4ed..2f3512a61e 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -257,6 +257,17 @@ public: virtual void actions(); }; +class Scene213: public SceneTeleporter { +public: + Scene213(MADSEngine *vm) : SceneTeleporter(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions(); +}; + class Scene214: public Scene2xx { private: uint32 _devilTime; -- cgit v1.2.3 From cfa0c839c33698a18e50ee8a3d126cc8ed7f589d Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sun, 4 May 2014 22:16:46 +0200 Subject: NEVERHOOD: Fixed one of the issues in #6513 The getKloggsTextIndex() function would return 40 twice in a row when wrapping around. This caused one of Willie's nonsense letters to appear instead, since they're supposed to trigger when getTextIndex1() returns the same result more than once. The same bug also appeared (and has been fixed) in getTextIndex3(), but there it just caused the same nonsense letter to appear twice. --- engines/neverhood/modules/module1000.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/engines/neverhood/modules/module1000.cpp b/engines/neverhood/modules/module1000.cpp index b19ba05b32..be57502d08 100644 --- a/engines/neverhood/modules/module1000.cpp +++ b/engines/neverhood/modules/module1000.cpp @@ -693,22 +693,18 @@ uint32 Scene1005::getTextIndex1() { uint32 Scene1005::getKloggsTextIndex() { uint32 textIndex = getGlobalVar(V_TEXT_COUNTING_INDEX1); if (textIndex + 1 > 10) { - setGlobalVar(V_TEXT_COUNTING_INDEX1, 0); textIndex = 0; - } else { - setGlobalVar(V_TEXT_COUNTING_INDEX1, textIndex + 1); } + setGlobalVar(V_TEXT_COUNTING_INDEX1, textIndex + 1); return textIndex + 40; } uint32 Scene1005::getTextIndex3() { uint32 textIndex = getGlobalVar(V_TEXT_COUNTING_INDEX2); if (textIndex + 1 >= 10) { - setGlobalVar(V_TEXT_COUNTING_INDEX2, 0); textIndex = 0; - } else { - setGlobalVar(V_TEXT_COUNTING_INDEX2, textIndex + 1); } + setGlobalVar(V_TEXT_COUNTING_INDEX2, textIndex + 1); return textIndex + 30; } -- cgit v1.2.3 From 9f4c221a2222d33323549b137767c0bbd68df29d Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sun, 4 May 2014 22:23:14 +0200 Subject: NEVERHOOD: Fixed off-by-one error in getTextIndex3() This is the same fix that was applied to getKloggsTextIndex() some time ago. It restores a missing Willie nonsense letter. While I haven't actually verified for myself that this letter appears in the original game, it is referenced in Wikipedia's article about Absalom. --- engines/neverhood/modules/module1000.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/neverhood/modules/module1000.cpp b/engines/neverhood/modules/module1000.cpp index be57502d08..5e4d67d2bc 100644 --- a/engines/neverhood/modules/module1000.cpp +++ b/engines/neverhood/modules/module1000.cpp @@ -701,7 +701,7 @@ uint32 Scene1005::getKloggsTextIndex() { uint32 Scene1005::getTextIndex3() { uint32 textIndex = getGlobalVar(V_TEXT_COUNTING_INDEX2); - if (textIndex + 1 >= 10) { + if (textIndex + 1 > 10) { textIndex = 0; } setGlobalVar(V_TEXT_COUNTING_INDEX2, textIndex + 1); -- cgit v1.2.3 From e46e25b1028457f760a0694f937c72135c216a0e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 4 May 2014 22:40:33 +0200 Subject: MADS: Remove optional parameters in scene213 --- engines/mads/nebular/nebular_scenes2.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 9b36dbb156..c4f5fe3c57 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -4597,11 +4597,11 @@ void Scene213::setup() { void Scene213::enter() { if (_globals[kMeteorologistWatch] != 0) - _handSpriteId = _scene->_sprites.addSprites("*METHAND", false); + _handSpriteId = _scene->_sprites.addSprites("*METHAND"); else if (_globals[kSexOfRex] == REX_MALE) - _handSpriteId = _scene->_sprites.addSprites("*REXHAND", false); + _handSpriteId = _scene->_sprites.addSprites("*REXHAND"); else - _handSpriteId = _scene->_sprites.addSprites("*ROXHAND", false); + _handSpriteId = _scene->_sprites.addSprites("*ROXHAND"); teleporterEnter(); -- cgit v1.2.3 From 18ffdf9fd0dd8755b576192d087936512d66f6d1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 4 May 2014 22:41:00 +0200 Subject: MADS: Implement scene 322 --- engines/mads/nebular/nebular_scenes.cpp | 2 + engines/mads/nebular/nebular_scenes3.cpp | 65 +++++++++++++++++++++++++++++++- engines/mads/nebular/nebular_scenes3.h | 10 +++++ 3 files changed, 75 insertions(+), 2 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 795477d5e5..95f7cab99d 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -135,6 +135,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene320(vm); case 321: return new Scene321(vm); + case 322: + return new Scene322(vm); case 351: return new Scene351(vm); case 352: diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index c69990706f..b8d07d9f06 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -3680,6 +3680,67 @@ void Scene321::step() { /*------------------------------------------------------------------------*/ +void Scene322::setup() { + _game._player._spritesPrefix = ""; + // The original is calling scene3xx_setAAName() + _game._aaName = Resources::formatAAName(4); +} + +void Scene322::enter() { + if (_globals[kSexOfRex] == REX_MALE) + _handSpriteId = _scene->_sprites.addSprites("*REXHAND"); + else + _handSpriteId = _scene->_sprites.addSprites("*ROXHAND"); + + teleporterEnter(); + + // The original is using scene3xx_sceneEntrySound() + if (!_vm->_musicFlag) + _vm->_sound->command(2); + else + _vm->_sound->command(10); +} + +void Scene322::step() { + teleporterStep(); +} + +void Scene322::actions() { + if (_action._lookFlag) { + _vm->_dialogs->show(32214); + _action._inProgress = false; + return; + } + + if (teleporterActions()) { + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x181) || _action.isAction(0x103, 0x181)) + _vm->_dialogs->show(32210); + else if (_action.isAction(VERB_LOOK, 0xC4)) + _vm->_dialogs->show(32211); + else if (_action.isAction(VERB_LOOK, 0x1CC)) + _vm->_dialogs->show(32212); + else if (_action.isAction(VERB_LOOK, 0x1D0) || _action.isAction(VERB_LOOK, 0x1D1) + || _action.isAction(VERB_LOOK, 0x1D2) || _action.isAction(VERB_LOOK, 0x1D3) + || _action.isAction(VERB_LOOK, 0x1D4) || _action.isAction(VERB_LOOK, 0x1D5) + || _action.isAction(VERB_LOOK, 0x1D6) || _action.isAction(VERB_LOOK, 0x1D7) + || _action.isAction(VERB_LOOK, 0x1D8) || _action.isAction(VERB_LOOK, 0x1D9) + || _action.isAction(VERB_LOOK, 0x1DB) || _action.isAction(VERB_LOOK, 0x7A) + || _action.isAction(VERB_LOOK, 0x1DA)) + _vm->_dialogs->show(32213); + else if (_action.isAction(VERB_LOOK, 0x1CF)) + _vm->_dialogs->show(32214); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + void Scene351::setup() { if (_scene->_currentSceneId == 391) _globals[kSexOfRex] = REX_MALE; @@ -4626,9 +4687,9 @@ void Scene359::enter() { _globals._spriteIndexes[3] = _scene->_sprites.addSprites(Resources::formatName(307, 'X', 0, EXT_SS, "")); if (_globals[kSexOfRex] == REX_MALE) - _globals._spriteIndexes[2] = _scene->_sprites.addSprites("*RXMBD_2", false); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites("*RXMBD_2"); else - _globals._spriteIndexes[4] = _scene->_sprites.addSprites("*ROXBD_2", false); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites("*ROXBD_2"); _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[3], Common::Point(127, 78)); diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h index f931dae193..d40b363ed5 100644 --- a/engines/mads/nebular/nebular_scenes3.h +++ b/engines/mads/nebular/nebular_scenes3.h @@ -321,6 +321,16 @@ public: virtual void step(); }; +class Scene322: public SceneTeleporter { +public: + Scene322(MADSEngine *vm) : SceneTeleporter(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void actions(); +}; + class Scene351: public Scene3xx { public: Scene351(MADSEngine *vm) : Scene3xx(vm) {} -- cgit v1.2.3 From 5d1c0ef9189575552807d7939d3d39caf00be0d7 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 4 May 2014 23:19:26 +0200 Subject: MADS: Implement scene 5xx ancestor --- engines/mads/module.mk | 1 + engines/mads/nebular/nebular_scenes5.cpp | 96 ++++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes5.h | 56 +++++++++++++++++++ 3 files changed, 153 insertions(+) create mode 100644 engines/mads/nebular/nebular_scenes5.cpp create mode 100644 engines/mads/nebular/nebular_scenes5.h diff --git a/engines/mads/module.mk b/engines/mads/module.mk index 5fe0c90603..04739b0a69 100644 --- a/engines/mads/module.mk +++ b/engines/mads/module.mk @@ -14,6 +14,7 @@ MODULE_OBJS := \ nebular/nebular_scenes2.o \ nebular/nebular_scenes3.o \ nebular/nebular_scenes4.o \ + nebular/nebular_scenes5.o \ nebular/nebular_scenes8.o \ action.o \ animation.o \ diff --git a/engines/mads/nebular/nebular_scenes5.cpp b/engines/mads/nebular/nebular_scenes5.cpp new file mode 100644 index 0000000000..b6684c8bca --- /dev/null +++ b/engines/mads/nebular/nebular_scenes5.cpp @@ -0,0 +1,96 @@ +/* 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 "common/scummsys.h" +#include "mads/mads.h" +#include "mads/scene.h" +#include "mads/nebular/nebular_scenes.h" +#include "mads/nebular/nebular_scenes5.h" + +namespace MADS { + +namespace Nebular { + +void Scene5xx::setAAName() { + _game._aaName = Resources::formatAAName(5); +} + +void Scene5xx::setPlayerSpritesPrefix() { + _vm->_sound->command(5); + + Common::String oldName = _game._player._spritesPrefix; + + if ((_scene->_nextSceneId == 502) || (_scene->_nextSceneId == 504) || (_scene->_nextSceneId == 505) || (_scene->_nextSceneId == 515)) + _game._player._spritesPrefix = ""; + else if (_globals[kSexOfRex] == REX_MALE) + _game._player._spritesPrefix = "RXM"; + else if ((_scene->_nextSceneId == 501) || (_scene->_nextSceneId == 503) || (_scene->_nextSceneId == 551)) + _game._player._spritesPrefix = "ROX"; + + _game._player._scalingVelocity = true; + + if ((_scene->_nextSceneId == 512) || (_scene->_nextSceneId == 507)) + _game._player._scalingVelocity = false; + + if (oldName != _game._player._spritesPrefix) + _game._player._spritesChanged = true; + + _vm->_palette->setEntry(16, 10, 63, 63); + _vm->_palette->setEntry(17, 10, 45, 45); +} + +void Scene5xx::sceneEntrySound() { + if (!_vm->_musicFlag) { + _vm->_sound->command(2); + return; + } + + switch (_scene->_nextSceneId) { + case 501: + case 502: + case 504: + case 505: + case 506: + case 507: + case 508: + case 511: + case 512: + case 513: + case 515: + case 551: + if (_scene->_priorSceneId == 503) + _vm->_sound->command(38); + else + _vm->_sound->command(29); + break; + case 503: + _vm->_sound->command(41); + break; + default: + break; + } +} + +/*------------------------------------------------------------------------*/ + +} // End of namespace Nebular +} // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes5.h b/engines/mads/nebular/nebular_scenes5.h new file mode 100644 index 0000000000..4efbc4a5c1 --- /dev/null +++ b/engines/mads/nebular/nebular_scenes5.h @@ -0,0 +1,56 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_NEBULAR_SCENES5_H +#define MADS_NEBULAR_SCENES5_H + +#include "common/scummsys.h" +#include "mads/game.h" +#include "mads/scene.h" +#include "mads/nebular/nebular_scenes.h" + +namespace MADS { + +namespace Nebular { + +class Scene5xx : public NebularScene { +protected: + /** + * Plays an appropriate sound when entering a scene + */ + void setAAName(); + + /** + * Updates the prefix used for getting player sprites for the scene + */ + void setPlayerSpritesPrefix(); + + void sceneEntrySound(); + +public: + Scene5xx(MADSEngine *vm) : NebularScene(vm) {} +}; + +} // End of namespace Nebular +} // End of namespace MADS + +#endif /* MADS_NEBULAR_SCENES5_H */ -- cgit v1.2.3 From 622f6eb7275912022c161ff22d74a5f4c28b77b3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 4 May 2014 23:43:36 +0200 Subject: MADS: Implement scene 502 --- engines/mads/nebular/nebular_scenes.cpp | 4 +-- engines/mads/nebular/nebular_scenes5.cpp | 57 ++++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes5.h | 12 +++++++ 3 files changed, 71 insertions(+), 2 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 95f7cab99d..0574ba9f29 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -193,9 +193,9 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new Scene413(vm); // Scene group #5 - case 501: - // TODO case 502: + return new Scene502(vm); + case 501: // TODO case 503: // TODO diff --git a/engines/mads/nebular/nebular_scenes5.cpp b/engines/mads/nebular/nebular_scenes5.cpp index b6684c8bca..eb1aa42dd3 100644 --- a/engines/mads/nebular/nebular_scenes5.cpp +++ b/engines/mads/nebular/nebular_scenes5.cpp @@ -92,5 +92,62 @@ void Scene5xx::sceneEntrySound() { /*------------------------------------------------------------------------*/ +void Scene502::setup() { + _game._player._spritesPrefix = ""; + // The original is using Scene5xx_setAAName() + _game._aaName = Resources::formatAAName(5); +} + +void Scene502::enter() { + if (_globals[kSexOfRex] == REX_MALE) + _handSpriteId = _scene->_sprites.addSprites("*REXHAND"); + else + _handSpriteId = _scene->_sprites.addSprites("*ROXHAND"); + + teleporterEnter(); + + // The original uses scene5xx_sceneEntrySound + if (!_vm->_musicFlag) + _vm->_sound->command(2); + else if (_scene->_priorSceneId == 503) + _vm->_sound->command(38); + else + _vm->_sound->command(29); +} + +void Scene502::step() { + teleporterStep(); +} + +void Scene502::actions() { + if (teleporterActions()) { + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x181) || _action.isAction(0x103, 0x181)) + _vm->_dialogs->show(50210); + else if (_action.isAction(VERB_LOOK, 0xC4)) + _vm->_dialogs->show(50211); + else if (_action.isAction(VERB_LOOK, 0x1CC)) + _vm->_dialogs->show(50212); + else if (_action.isAction(VERB_LOOK, 0x1D0) || _action.isAction(VERB_LOOK, 0x1D1) + || _action.isAction(VERB_LOOK, 0x1D2) || _action.isAction(VERB_LOOK, 0x1D3) + || _action.isAction(VERB_LOOK, 0x1D4) || _action.isAction(VERB_LOOK, 0x1D5) + || _action.isAction(VERB_LOOK, 0x1D6) || _action.isAction(VERB_LOOK, 0x1D7) + || _action.isAction(VERB_LOOK, 0x1D8) || _action.isAction(VERB_LOOK, 0x1D9) + || _action.isAction(VERB_LOOK, 0x1DB) || _action.isAction(VERB_LOOK, 0x7A) + || _action.isAction(VERB_LOOK, 0x1DA)) + _vm->_dialogs->show(50213); + else if (_action.isAction(VERB_LOOK, 0x1CF) || _action._lookFlag) + _vm->_dialogs->show(50214); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes5.h b/engines/mads/nebular/nebular_scenes5.h index 4efbc4a5c1..2748f248d2 100644 --- a/engines/mads/nebular/nebular_scenes5.h +++ b/engines/mads/nebular/nebular_scenes5.h @@ -50,6 +50,18 @@ public: Scene5xx(MADSEngine *vm) : NebularScene(vm) {} }; +class Scene502: public SceneTeleporter { +public: + Scene502(MADSEngine *vm) : SceneTeleporter(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions(); + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From c892d8c725ee20fa3aef4aab29cc89da734bee23 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 4 May 2014 18:42:34 -0400 Subject: MADS: Implemented remainder of fadeToGrey --- engines/mads/nebular/dialogs_nebular.cpp | 7 ++++ engines/mads/palette.cpp | 56 ++++++++++++++++++----------- engines/mads/palette.h | 62 ++++++++++++++++---------------- 3 files changed, 73 insertions(+), 52 deletions(-) diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp index 9dd20cafec..8ef64008cc 100644 --- a/engines/mads/nebular/dialogs_nebular.cpp +++ b/engines/mads/nebular/dialogs_nebular.cpp @@ -359,8 +359,15 @@ PictureDialog::PictureDialog(MADSEngine *vm, const Common::Point &pos, } PictureDialog::~PictureDialog() { + // Restore cycling flag Scene &scene = _vm->_game->_scene; + Palette &palette = *_vm->_palette; scene._cyclingActive = _cyclingActive; + + // Restore palette information + Common::copy(&_palette[0], &_palette[PALETTE_SIZE], &palette._mainPalette[0]); + Common::copy(&_palFlags[0], &_palFlags[PALETTE_COUNT], &palette._palFlags[0]); + palette._rgbList.copy(_rgbList); } void PictureDialog::show() { diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index ad45562181..f8430e8836 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -336,14 +336,23 @@ void RGBList::copy(RGBList &src) { /*------------------------------------------------------------------------*/ -Fader::Fader() { +Fader::Fader(MADSEngine *vm): _vm(vm) { _colorFlags[0] = _colorFlags[1] = _colorFlags[2] = true; _colorFlags[3] = false; _colorValues[0] = _colorValues[1] = 0; _colorValues[2] = _colorValues[3] = 0; } -void Fader::fadeToGrey(byte palette[PALETTE_SIZE], byte paletteMap[PALETTE_COUNT], + +void Fader::setPalette(const byte *colors, uint start, uint num) { + g_system->getPaletteManager()->setPalette(colors, start, num); +} + +void Fader::grabPalette(byte *colors, uint start, uint num) { + g_system->getPaletteManager()->grabPalette(colors, start, num); +} + +void Fader::fadeToGrey(byte palette[PALETTE_SIZE], byte *paletteMap, int baseColor, int numColors, int baseGrey, int numGreys, int tickDelay, int steps) { GreyEntry map[PALETTE_COUNT]; @@ -373,7 +382,30 @@ void Fader::fadeToGrey(byte palette[PALETTE_SIZE], byte paletteMap[PALETTE_COUNT } } - // TODO: More here + for (int stepCtr = 0; stepCtr < steps; ++stepCtr) { + for (int palCtr = baseColor; palCtr < (baseColor + numColors); ++palCtr) { + int index = palCtr - baseColor; + for (int colorCtr = 0; colorCtr < 3; ++colorCtr) { + map[index]._accum[colorCtr] += palIndex[palCtr][colorCtr]; + /* map[index].accum[color] += pal_color(temp_pal, palCtr, color); */ + while (map[index]._accum[colorCtr] >= steps) { + map[index]._accum[colorCtr] -= steps; + palette[palCtr * 3 + colorCtr] = signs[palCtr][colorCtr]; + } + } + } + + setFullPalette(palette); + + // TODO: Adjust waiting + _vm->_events->waitForNextFrame(); + } + + if (paletteMap != nullptr) { + for (int palCtr = 0; palCtr < numColors; palCtr++) { + paletteMap[palCtr] = map[palCtr]._mapColor; + } + } } static bool greyCompareFunc(const Fader::GreyTableEntry &g1, const Fader::GreyTableEntry &g2) { @@ -483,9 +515,7 @@ int Fader::rgbMerge(byte r, byte g, byte b) { /*------------------------------------------------------------------------*/ -Palette::Palette(MADSEngine *vm) : _vm(vm), _paletteUsage(vm) { - reset(); - +Palette::Palette(MADSEngine *vm) : Fader(vm), _paletteUsage(vm) { _lockFl = false; _lowRange = 0; _highRange = 0; @@ -493,11 +523,6 @@ Palette::Palette(MADSEngine *vm) : _vm(vm), _paletteUsage(vm) { Common::fill(&_palFlags[0], &_palFlags[PALETTE_COUNT], 0); } -void Palette::setPalette(const byte *colors, uint start, uint num) { - g_system->getPaletteManager()->setPalette(colors, start, num); - reset(); -} - void Palette::setEntry(byte palIndex, byte r, byte g, byte b) { _mainPalette[palIndex * 3] = VGA_COLOR_TRANS(r); _mainPalette[palIndex * 3 + 1] = VGA_COLOR_TRANS(g); @@ -506,12 +531,6 @@ void Palette::setEntry(byte palIndex, byte r, byte g, byte b) { setPalette((const byte *)&_mainPalette[palIndex * 3], palIndex, 1); } - -void Palette::grabPalette(byte *colors, uint start, uint num) { - g_system->getPaletteManager()->grabPalette(colors, start, num); - reset(); -} - uint8 Palette::palIndexFromRgb(byte r, byte g, byte b, byte *paletteData) { byte index = 0; int32 minDist = 0x7fffffff; @@ -537,9 +556,6 @@ uint8 Palette::palIndexFromRgb(byte r, byte g, byte b, byte *paletteData) { return (uint8)index; } -void Palette::reset() { -} - void Palette::setGradient(byte *palette, int start, int count, int rgbValue1, int rgbValue2) { int rgbCtr = 0; int rgbCurrent = rgbValue2; diff --git a/engines/mads/palette.h b/engines/mads/palette.h index 883f7d79d9..1beadd4c16 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -185,6 +185,8 @@ private: * grey table containing the number of grey values for each intensity */ void greyPopularity(const GreyTableEntry greyList[PALETTE_COUNT], byte greyTable[64], int numColors); +protected: + MADSEngine *_vm; public: bool _colorFlags[4]; int _colorValues[4]; @@ -192,7 +194,31 @@ public: /** * Constructor */ - Fader(); + Fader(MADSEngine *vm); + + /** + * Sets a new palette + */ + void setPalette(const byte *colors, uint start, uint num); + + /** + * Returns a subset of the currently loaded palette + */ + void grabPalette(byte *colors, uint start, uint num); + + /** + * Gets the entire palette at once + */ + void getFullPalette(byte palette[PALETTE_SIZE]) { + grabPalette(&palette[0], 0, PALETTE_COUNT); + } + + /** + * Sets the entire palette at once + */ + void setFullPalette(byte palette[PALETTE_SIZE]) { + setPalette(&palette[0], 0, PALETTE_COUNT); + } int rgbMerge(byte r, byte g, byte b); @@ -201,7 +227,7 @@ public: /** * Fades the given palette to greyscale */ - void fadeToGrey(byte palette[PALETTE_SIZE], byte paletteMap[PALETTE_COUNT], + void fadeToGrey(byte palette[PALETTE_SIZE], byte *paletteMap, int baseColor, int numColors, int baseGrey, int numGreys, int tickDelay, int steps); }; @@ -213,10 +239,6 @@ private: * standard VGA palette */ void initVGAPalette(byte *palette); -protected: - MADSEngine *_vm; - - void reset(); public: byte _mainPalette[PALETTE_SIZE]; byte _cyclingPalette[PALETTE_SIZE]; @@ -238,34 +260,10 @@ public: virtual ~Palette() {} /** - * Sets a new palette - */ - void setPalette(const byte *colors, uint start, uint num); - - /** - * Set a palette entry - */ + * Set a palette entry + */ void setEntry(byte palIndex, byte r, byte g, byte b); - /** - * Returns a subset of the currently loaded palette - */ - void grabPalette(byte *colors, uint start, uint num); - - /** - * Gets the entire palette at once - */ - void getFullPalette(byte palette[PALETTE_SIZE]) { - grabPalette(&palette[0], 0, PALETTE_COUNT); - } - - /** - * Sets the entire palette at once - */ - void setFullPalette(byte palette[PALETTE_SIZE]) { - setPalette(&palette[0], 0, PALETTE_COUNT); - } - /** * Returns the palette index in the palette that most closely matches the * specified RGB pair -- cgit v1.2.3 From 24b79dc5f1486e4cb208b95a8bc18f31ab50de4c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 4 May 2014 18:42:45 -0400 Subject: MADS: Fix gcc warnings --- engines/mads/dragonsphere/dragonsphere_scenes.h | 2 +- engines/mads/dragonsphere/game_dragonsphere.h | 1 + engines/mads/globals.h | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/engines/mads/dragonsphere/dragonsphere_scenes.h b/engines/mads/dragonsphere/dragonsphere_scenes.h index 596a59e879..cf42dab0ba 100644 --- a/engines/mads/dragonsphere/dragonsphere_scenes.h +++ b/engines/mads/dragonsphere/dragonsphere_scenes.h @@ -35,7 +35,7 @@ namespace MADS { namespace Dragonsphere { enum Noun { - NOUN_LOOK_AT = 0x0D1, + NOUN_LOOK_AT = 0x0D1 // TODO }; diff --git a/engines/mads/dragonsphere/game_dragonsphere.h b/engines/mads/dragonsphere/game_dragonsphere.h index dd96146285..2bfcde1c63 100644 --- a/engines/mads/dragonsphere/game_dragonsphere.h +++ b/engines/mads/dragonsphere/game_dragonsphere.h @@ -43,6 +43,7 @@ enum InventoryObject { OBJ_NONE = -1 class DragonsphereGlobals: public Globals { public: DragonsphereGlobals() {} + virtual ~DragonsphereGlobals() {} }; class GameDragonsphere: public Game { diff --git a/engines/mads/globals.h b/engines/mads/globals.h index e44e97fd3c..92e9d96f3e 100644 --- a/engines/mads/globals.h +++ b/engines/mads/globals.h @@ -35,6 +35,8 @@ protected: public: Globals() {} + virtual ~Globals() {} + /** * Square brackets operator for accessing flags */ -- cgit v1.2.3 From 8ebb16e98a6bd23849d2f4fe7df57ac89b6b2cb0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 4 May 2014 18:46:18 -0400 Subject: MADS: Further gcc compilation fixes --- engines/mads/nebular/dialogs_nebular.cpp | 2 ++ engines/mads/nebular/nebular_scenes.cpp | 1 + engines/mads/nebular/nebular_scenes5.h | 1 + engines/mads/phantom/phantom_scenes.h | 2 +- 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp index 8ef64008cc..e6e3151472 100644 --- a/engines/mads/nebular/dialogs_nebular.cpp +++ b/engines/mads/nebular/dialogs_nebular.cpp @@ -243,6 +243,8 @@ void DialogsNebular::showDialog() { case DIALOG_GAME_MENU: //GameMenuDialog::show(); break; + default: + break; } } diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 0574ba9f29..a449cb6233 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -32,6 +32,7 @@ #include "mads/nebular/nebular_scenes2.h" #include "mads/nebular/nebular_scenes3.h" #include "mads/nebular/nebular_scenes4.h" +#include "mads/nebular/nebular_scenes5.h" #include "mads/nebular/nebular_scenes8.h" namespace MADS { diff --git a/engines/mads/nebular/nebular_scenes5.h b/engines/mads/nebular/nebular_scenes5.h index 2748f248d2..562cfdfd76 100644 --- a/engines/mads/nebular/nebular_scenes5.h +++ b/engines/mads/nebular/nebular_scenes5.h @@ -63,6 +63,7 @@ public: }; } // End of namespace Nebular + } // End of namespace MADS #endif /* MADS_NEBULAR_SCENES5_H */ diff --git a/engines/mads/phantom/phantom_scenes.h b/engines/mads/phantom/phantom_scenes.h index 647671040c..9df8063cd4 100644 --- a/engines/mads/phantom/phantom_scenes.h +++ b/engines/mads/phantom/phantom_scenes.h @@ -35,7 +35,7 @@ namespace MADS { namespace Phantom { enum Noun { - NOUN_LOOK_AT = 0x0D1, + NOUN_LOOK_AT = 0x0D1 // TODO }; -- cgit v1.2.3 From e9d76d27a00e4b4760f7b8f442ef69650bae8d5a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 4 May 2014 20:30:52 -0400 Subject: MADS: Fix immediate crashes in new fadeToGrey logic --- engines/mads/palette.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index f8430e8836..aa227bf8e8 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -30,6 +30,7 @@ namespace MADS { #define VGA_COLOR_TRANS(x) ((x) * 255 / 63) +#define VGA_COLOR_REV(x) ((x) * 63 / 255) void RGB6::load(Common::SeekableReadStream *f) { r = VGA_COLOR_TRANS(f->readByte()); @@ -378,7 +379,7 @@ void Fader::fadeToGrey(byte palette[PALETTE_SIZE], byte *paletteMap, int diff = intensity - palette[palCtr * 3 + colorCtr]; palIndex[palCtr][colorCtr] = (byte)ABS(diff); - signs[palCtr][colorCtr] = diff / ABS(diff); + signs[palCtr][colorCtr] = (diff == 0) ? 0 : (diff < 0 ? -1 : 1); } } @@ -387,7 +388,6 @@ void Fader::fadeToGrey(byte palette[PALETTE_SIZE], byte *paletteMap, int index = palCtr - baseColor; for (int colorCtr = 0; colorCtr < 3; ++colorCtr) { map[index]._accum[colorCtr] += palIndex[palCtr][colorCtr]; - /* map[index].accum[color] += pal_color(temp_pal, palCtr, color); */ while (map[index]._accum[colorCtr] >= steps) { map[index]._accum[colorCtr] -= steps; palette[palCtr * 3 + colorCtr] = signs[palCtr][colorCtr]; @@ -421,7 +421,7 @@ void Fader::mapToGreyRamp(byte palette[PALETTE_SIZE], int baseColor, int numColo getGreyValues(palette, greyList, baseColor, numColors); greyPopularity(greyList, greyTable, numColors); - + for (int idx = 0; idx < numColors; ++idx) { greyList[idx]._mapping = idx; Common::fill(&map[idx]._accum[0], &map[idx]._accum[3], 0); @@ -489,11 +489,10 @@ void Fader::mapToGreyRamp(byte palette[PALETTE_SIZE], int baseColor, int numColo void Fader::getGreyValues(const byte palette[PALETTE_SIZE], GreyTableEntry greyList[PALETTE_COUNT], int baseColor, int numColors) { const byte *palP = &palette[baseColor * 3]; - GreyTableEntry *destP = greyList; - for (int i = 0; i < numColors; ++i, palP += 3, ++destP) { + for (int i = 0; i < numColors; ++i, palP += 3) { int v = rgbMerge(palP[0], palP[1], palP[2]); - destP->_list = v >> 7; + greyList[i]._list = v >> 7; } } @@ -501,7 +500,9 @@ void Fader::greyPopularity(const GreyTableEntry greyList[PALETTE_COUNT], byte greyTable[64], int numColors) { Common::fill(&greyTable[0], &greyTable[64], 0); for (int i = 0; i < 64; ++i) { - ++greyTable[greyList[i]._list]; + int idx = greyList[i]._list; + assert(idx >= 0 && idx < 64); + ++greyTable[idx]; } } @@ -510,7 +511,7 @@ int Fader::rgbMerge(RGB6 &palEntry) { } int Fader::rgbMerge(byte r, byte g, byte b) { - return ((r + 1) / 4 - 1) * 38 + ((g + 1) / 4 - 1) * 76 + ((b + 1) / 4 - 1) * 14; + return VGA_COLOR_REV(r) * 38 + VGA_COLOR_REV(g) * 76 + VGA_COLOR_REV(b) * 14; } /*------------------------------------------------------------------------*/ -- cgit v1.2.3 From c6d36044c5343b6cbc476d3e06be06963c35a9ba Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 5 May 2014 08:02:26 +0300 Subject: FULLPIPE: Started MovGraph::findClosestLink() implementation --- engines/fullpipe/motion.cpp | 58 +++++++++++++++++++++++++++++++++++++++++++++ engines/fullpipe/motion.h | 1 + 2 files changed, 59 insertions(+) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index df0e8d8e35..00e4d856ba 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -687,6 +687,64 @@ void MovGraph::calcNodeDistancesAndAngles() { } } +bool MovGraph::findClosestLink(int unusedArg, Common::Point *p, MovArr *movarr) { +#if 0 + v4 = (double)p->x; + v5 = (double)(signed int)p->y; + link = 0; + v28 = 1.0e20; + + for (ObList::iterator i = _links.begin(); i != _links.end(); ++i) { + MovGraphLink *lnk = (MovGraphLink *)*i; + + v8 = v6->data; + + if ((lnk->_flags & 0x10000000) && !(lnk->_flags & 0x20000000) ) { + v12 = lnk->_movGraphNode1->_x; + v13 = lnk->_movGraphNode1->_y; + v23 = v12; + v14 = lnk->_movGraphNode2->_x; + v15 = (double)v12; + v27 = v14; + v16 = v14 - v12; + v17 = lnk->_movGraphNode2->_y; + v29 = v15; + v18 = v4 - v15; + v32 = (double)v13 - v5; + v33 = (double)v16; + v19 = sqrt(v32 * v32 + v18 * v18); + v20 = ((double)(v13 - v17) * v32 + v33 * v18) / lnk->_distance / v19; + v21 = v20 * v19; + v26 = sqrt(1.0 - v20 * v20) * v19; + if ( v20 * v19 < 0.0 ) { + v21 = 0.0; + v26 = sqrt((v29 - v4) * (v29 - v4) + v32 * v32); + } + if (v21 > lnk->_distance) { + v21 = lnk->_distance; + v26 = sqrt(((double)v27 - v4) * ((double)v27 - v4) + ((double)lnk->_movGraphNode2->_y - v5) * ((double)lnk->_movGraphNode2->_y - v5)); + } + if ( v21 >= 0.0 && v21 <= lnk->_distance && v26 < v28 ) { + v30 = v23 + (unsigned __int64)(signed __int64)(v33 * v21 / lnk->_distance); + v7 = v13 + (unsigned __int64)(signed __int64)((double)(v17 - v13) * v21 / lnk->_distance); + v28 = v26; + link = lnk; + } + } + } + + if (v28 < 1.0e20) { + if (movarr) + movarr->_link = link; + p->x = v30; + p->y = v7; + + return true; + } +#endif + return false; +} + int MovGraph::getItemIndexByStaticAni(StaticANIObject *ani) { for (uint i = 0; i < _items.size(); i++) if (_items[i]->ani == ani) diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index 396fc6578f..13d96ae551 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -359,6 +359,7 @@ public: double calcDistance(Common::Point *point, MovGraphLink *link, int fuzzyMatch); void calcNodeDistancesAndAngles(); + bool findClosestLink(int unusedArg, Common::Point *p, MovArr *movarr); MovGraphNode *calcOffset(int ox, int oy); int getItemIndexByStaticAni(StaticANIObject *ani); Common::Array *genMovArr(int x, int y, int *arrSize, int flag1, int flag2); -- cgit v1.2.3 From 3519208e4e88e3713d33e76630917c4e7785e66c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 5 May 2014 07:15:47 +0200 Subject: MADS: Add scene 7xx --- engines/mads/module.mk | 1 + engines/mads/nebular/nebular_scenes.cpp | 1 + engines/mads/nebular/nebular_scenes7.cpp | 94 ++++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes7.h | 56 +++++++++++++++++++ 4 files changed, 152 insertions(+) create mode 100644 engines/mads/nebular/nebular_scenes7.cpp create mode 100644 engines/mads/nebular/nebular_scenes7.h diff --git a/engines/mads/module.mk b/engines/mads/module.mk index 04739b0a69..91e8a6bb4b 100644 --- a/engines/mads/module.mk +++ b/engines/mads/module.mk @@ -15,6 +15,7 @@ MODULE_OBJS := \ nebular/nebular_scenes3.o \ nebular/nebular_scenes4.o \ nebular/nebular_scenes5.o \ + nebular/nebular_scenes7.o \ nebular/nebular_scenes8.o \ action.o \ animation.o \ diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index a449cb6233..6ae9fef8ab 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -33,6 +33,7 @@ #include "mads/nebular/nebular_scenes3.h" #include "mads/nebular/nebular_scenes4.h" #include "mads/nebular/nebular_scenes5.h" +#include "mads/nebular/nebular_scenes7.h" #include "mads/nebular/nebular_scenes8.h" namespace MADS { diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp new file mode 100644 index 0000000000..ca9685a1b0 --- /dev/null +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -0,0 +1,94 @@ +/* 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 "common/scummsys.h" +#include "mads/mads.h" +#include "mads/scene.h" +#include "mads/nebular/nebular_scenes.h" +#include "mads/nebular/nebular_scenes7.h" + +namespace MADS { + +namespace Nebular { + +void Scene7xx::setAAName() { + _game._aaName = Resources::formatAAName(5); +} + +void Scene7xx::setPlayerSpritesPrefix() { + _vm->_sound->command(5); + + Common::String oldName = _game._player._spritesPrefix; + + if ((_scene->_nextSceneId == 703) || (_scene->_nextSceneId == 704) || (_scene->_nextSceneId == 705) + || (_scene->_nextSceneId == 707) || (_scene->_nextSceneId == 710) || (_scene->_nextSceneId == 711)) + _game._player._spritesPrefix = ""; + else if (_globals[kSexOfRex] == REX_MALE) + _game._player._spritesPrefix = "RXM"; + else + _game._player._spritesPrefix = "ROX"; + + + _game._player._scalingVelocity = true; + + if (oldName != _game._player._spritesPrefix) + _game._player._spritesChanged = true; + + _vm->_palette->setEntry(16, 10, 63, 63); + _vm->_palette->setEntry(17, 10, 45, 45); +} + +void Scene7xx::sceneEntrySound() { + if (!_vm->_musicFlag) { + _vm->_sound->command(2); + return; + } + + switch (_scene->_nextSceneId) { + case 701: + case 702: + case 704: + case 705: + case 751: + _vm->_sound->command(38); + break; + case 703: + if (_globals[kMonsterAlive] == 0) + _vm->_sound->command(24); + else + _vm->_sound->command(27); + break; + case 706: + case 707: + case 710: + case 711: + _vm->_sound->command(25); + break; + default: + break; + } +} + +/*------------------------------------------------------------------------*/ + +} // End of namespace Nebular +} // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes7.h b/engines/mads/nebular/nebular_scenes7.h new file mode 100644 index 0000000000..2816af35e6 --- /dev/null +++ b/engines/mads/nebular/nebular_scenes7.h @@ -0,0 +1,56 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_NEBULAR_SCENES7_H +#define MADS_NEBULAR_SCENES7_H + +#include "common/scummsys.h" +#include "mads/game.h" +#include "mads/scene.h" +#include "mads/nebular/nebular_scenes.h" + +namespace MADS { + +namespace Nebular { + +class Scene7xx : public NebularScene { +protected: + /** + * Plays an appropriate sound when entering a scene + */ + void setAAName(); + + /** + * Updates the prefix used for getting player sprites for the scene + */ + void setPlayerSpritesPrefix(); + + void sceneEntrySound(); + +public: + Scene7xx(MADSEngine *vm) : NebularScene(vm) {} +}; + +} // End of namespace Nebular +} // End of namespace MADS + +#endif /* MADS_NEBULAR_SCENES7_H */ -- cgit v1.2.3 From b565d0bf24128f18aac3a5daae48415535f97676 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Mon, 5 May 2014 07:20:49 +0200 Subject: NEVERHOOD: Fix memory leak in BaseSurface I hope this will help the memory leak reported as part of bug #6513 but my computer isn't quite up to the task of doing any extensive Valgrind testing. --- engines/neverhood/graphics.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/neverhood/graphics.cpp b/engines/neverhood/graphics.cpp index 3d1724ed8a..939428ed19 100644 --- a/engines/neverhood/graphics.cpp +++ b/engines/neverhood/graphics.cpp @@ -47,6 +47,7 @@ BaseSurface::BaseSurface(NeverhoodEngine *vm, int priority, int16 width, int16 h } BaseSurface::~BaseSurface() { + _surface->free(); delete _surface; } -- cgit v1.2.3 From 0c9bbbcf88c632311f84e34ccf714cc13fde70fd Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 5 May 2014 11:01:05 +0300 Subject: FULLPIPE: Complete MovGraph::findClosestLink() implementation --- engines/fullpipe/motion.cpp | 69 +++++++++++++++++++++------------------------ 1 file changed, 32 insertions(+), 37 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 00e4d856ba..a4c5b0ba64 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -688,60 +688,55 @@ void MovGraph::calcNodeDistancesAndAngles() { } bool MovGraph::findClosestLink(int unusedArg, Common::Point *p, MovArr *movarr) { -#if 0 - v4 = (double)p->x; - v5 = (double)(signed int)p->y; - link = 0; - v28 = 1.0e20; + MovGraphLink *link = 0; + double mindist = 1.0e20; + int resx = 0, resy = 0; for (ObList::iterator i = _links.begin(); i != _links.end(); ++i) { MovGraphLink *lnk = (MovGraphLink *)*i; - v8 = v6->data; - if ((lnk->_flags & 0x10000000) && !(lnk->_flags & 0x20000000) ) { - v12 = lnk->_movGraphNode1->_x; - v13 = lnk->_movGraphNode1->_y; - v23 = v12; - v14 = lnk->_movGraphNode2->_x; - v15 = (double)v12; - v27 = v14; - v16 = v14 - v12; - v17 = lnk->_movGraphNode2->_y; - v29 = v15; - v18 = v4 - v15; - v32 = (double)v13 - v5; - v33 = (double)v16; - v19 = sqrt(v32 * v32 + v18 * v18); - v20 = ((double)(v13 - v17) * v32 + v33 * v18) / lnk->_distance / v19; - v21 = v20 * v19; - v26 = sqrt(1.0 - v20 * v20) * v19; - if ( v20 * v19 < 0.0 ) { - v21 = 0.0; - v26 = sqrt((v29 - v4) * (v29 - v4) + v32 * v32); + double dx1 = lnk->_movGraphNode1->_x - p->x; + double dy1 = lnk->_movGraphNode1->_y - p->y; + double dx2 = lnk->_movGraphNode2->_x - p->x; + double dy2 = lnk->_movGraphNode2->_y - p->y; + double dx3 = lnk->_movGraphNode2->_x - lnk->_movGraphNode1->_x; + double dy3 = lnk->_movGraphNode2->_y - lnk->_movGraphNode1->_y; + double sq1 = sqrt(dy1 * dy1 + dx1 * dx1); + double sdist = (dy3 * dy1 + dx3 * dx1) / lnk->_distance / sq1; + double ldist = sdist * sq1; + double dist = sqrt(1.0 - sdist * sdist) * sq1; + + if (ldist < 0.0) { + ldist = 0.0; + dist = sqrt(dx1 * dx1 + dy1 * dy1); } - if (v21 > lnk->_distance) { - v21 = lnk->_distance; - v26 = sqrt(((double)v27 - v4) * ((double)v27 - v4) + ((double)lnk->_movGraphNode2->_y - v5) * ((double)lnk->_movGraphNode2->_y - v5)); + + if (ldist > lnk->_distance) { + ldist = lnk->_distance; + dist = sqrt(dx2 * dx2 + dy2 * dy2); } - if ( v21 >= 0.0 && v21 <= lnk->_distance && v26 < v28 ) { - v30 = v23 + (unsigned __int64)(signed __int64)(v33 * v21 / lnk->_distance); - v7 = v13 + (unsigned __int64)(signed __int64)((double)(v17 - v13) * v21 / lnk->_distance); - v28 = v26; + + if (ldist >= 0.0 && ldist <= lnk->_distance && dist < mindist) { + resx = lnk->_movGraphNode1->_x + (int)(dx3 * ldist / lnk->_distance); + resy = lnk->_movGraphNode1->_y + (int)(dy3 * ldist / lnk->_distance); + + mindist = dist; link = lnk; } } } - if (v28 < 1.0e20) { + if (mindist < 1.0e20) { if (movarr) movarr->_link = link; - p->x = v30; - p->y = v7; + + p->x = resx; + p->y = resy; return true; } -#endif + return false; } -- cgit v1.2.3 From f0a0537095e0b309f768de0b44cd20d05376c1d9 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Mon, 5 May 2014 11:29:41 +0100 Subject: NEVERHOOD: Fix memory leak from static data loading. This is occurring due to duplicate entry ids, which should probably not be present. --- engines/neverhood/staticdata.cpp | 47 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/engines/neverhood/staticdata.cpp b/engines/neverhood/staticdata.cpp index 552ea92604..03af44b2a5 100644 --- a/engines/neverhood/staticdata.cpp +++ b/engines/neverhood/staticdata.cpp @@ -28,6 +28,18 @@ StaticData::StaticData() { } StaticData::~StaticData() { + for (Common::HashMap::iterator i = _hitRectLists.begin(); i != _hitRectLists.end(); ++i) + delete i->_value; + for (Common::HashMap::iterator i = _rectLists.begin(); i != _rectLists.end(); ++i) + delete i->_value; + for (Common::HashMap::iterator i = _messageLists.begin(); i != _messageLists.end(); ++i) + delete i->_value; + for (Common::HashMap::iterator i = _navigationLists.begin(); i != _navigationLists.end(); ++i) + delete i->_value; + for (Common::HashMap::iterator i = _hallOfRecordsInfoItems.begin(); i != _hallOfRecordsInfoItems.end(); ++i) + delete i->_value; + for (Common::HashMap::iterator i = _trackInfoItems.begin(); i != _trackInfoItems.end(); ++i) + delete i->_value; } void StaticData::load(const char *filename) { @@ -69,6 +81,11 @@ void StaticData::load(const char *filename) { messageList->push_back(messageItem); } + if(_messageLists.contains(id)) { + warning("Duplicate id %d in _messageLists - freeing older entry", id); + delete _messageLists[id]; + } + _messageLists[id] = messageList; } @@ -98,6 +115,12 @@ void StaticData::load(const char *filename) { } rectList->push_back(rectItem); } + + if(_rectLists.contains(id)) { + warning("Duplicate id %d in _rectLists - freeing older entry", id); + delete _rectLists[id]; + } + _rectLists[id] = rectList; } @@ -117,6 +140,12 @@ void StaticData::load(const char *filename) { hitRect.type = fd.readUint16LE(); hitRectList->push_back(hitRect); } + + if(_hitRectLists.contains(id)) { + warning("Duplicate id %d in _hitRectLists - freeing older entry", id); + delete _hitRectLists[id]; + } + _hitRectLists[id] = hitRectList; } @@ -138,6 +167,12 @@ void StaticData::load(const char *filename) { navigationItem.mouseCursorFileHash = fd.readUint32LE(); navigationList->push_back(navigationItem); } + + if(_navigationLists.contains(id)) { + warning("Duplicate id %d in _navigationLists - freeing older entry", id); + delete _navigationLists[id]; + } + _navigationLists[id] = navigationList; } @@ -153,6 +188,12 @@ void StaticData::load(const char *filename) { hallOfRecordsInfo->bgFilename3 = fd.readUint32LE(); hallOfRecordsInfo->xPosIndex = fd.readByte(); hallOfRecordsInfo->count = fd.readByte(); + + if(_hallOfRecordsInfoItems.contains(id)) { + warning("Duplicate id %d in _hallOfRecordsInfoItems - freeing older entry", id); + delete _hallOfRecordsInfoItems[id]; + } + _hallOfRecordsInfoItems[id] = hallOfRecordsInfo; } @@ -172,6 +213,12 @@ void StaticData::load(const char *filename) { trackInfo->mouseCursorFilename = fd.readUint32LE(); trackInfo->which1 = fd.readUint16LE(); trackInfo->which2 = fd.readUint16LE(); + + if(_trackInfoItems.contains(id)) { + warning("Duplicate id %d in _trackInfoItems - freeing older entry", id); + delete _trackInfoItems[id]; + } + _trackInfoItems[id] = trackInfo; } -- cgit v1.2.3 From 6fc91b4369bfc6f6db9db15fafb040e801e14034 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 5 May 2014 18:51:17 +0200 Subject: MADS: Implement scene 707 --- engines/mads/nebular/nebular_scenes.cpp | 4 +-- engines/mads/nebular/nebular_scenes7.cpp | 51 ++++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes7.h | 12 ++++++++ 3 files changed, 65 insertions(+), 2 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 6ae9fef8ab..6ee696bb6f 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -253,6 +253,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { error("Invalid scene %d called", scene._nextSceneId); // Scene group #7 + case 707: + return new Scene707(vm); case 701: // TODO case 702: @@ -265,8 +267,6 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { // TODO case 706: // TODO - case 707: - // TODO case 708: // TODO case 710: diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index ca9685a1b0..6692362ba3 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -90,5 +90,56 @@ void Scene7xx::sceneEntrySound() { /*------------------------------------------------------------------------*/ +void Scene707::setup() { + _game._player._spritesPrefix = ""; + // The original calls Scene7xx::setAAName() + _game._aaName = Resources::formatAAName(5); +} + +void Scene707::enter() { + _handSpriteId = _scene->_sprites.addSprites("*REXHAND"); + teleporterEnter(); + + // The original uses Scene7xx_sceneEntrySound + if (!_vm->_musicFlag) + _vm->_sound->command(2); + else + _vm->_sound->command(25); +} + +void Scene707::step() { + teleporterStep(); +} + +void Scene707::actions() { + if (teleporterActions()) { + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x181) || _action.isAction(0x103, 0x181)) + _vm->_dialogs->show(70710); + else if (_action.isAction(VERB_LOOK, 0xC4)) + _vm->_dialogs->show(70711); + else if (_action.isAction(VERB_LOOK, 0x1CC)) + _vm->_dialogs->show(70712); + else if (_action.isAction(VERB_LOOK, 0x1D0) || _action.isAction(VERB_LOOK, 0x1D1) + || _action.isAction(VERB_LOOK, 0x1D2) || _action.isAction(VERB_LOOK, 0x1D3) + || _action.isAction(VERB_LOOK, 0x1D4) || _action.isAction(VERB_LOOK, 0x1D5) + || _action.isAction(VERB_LOOK, 0x1D6) || _action.isAction(VERB_LOOK, 0x1D7) + || _action.isAction(VERB_LOOK, 0x1D8) || _action.isAction(VERB_LOOK, 0x1D9) + || _action.isAction(VERB_LOOK, 0x1DB) || _action.isAction(VERB_LOOK, 0x7A) + || _action.isAction(VERB_LOOK, 0x1DA)) + _vm->_dialogs->show(70713); + else if (_action.isAction(VERB_LOOK, 0x1CF) || _action._lookFlag) + _vm->_dialogs->show(70714); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes7.h b/engines/mads/nebular/nebular_scenes7.h index 2816af35e6..1d6c26d41e 100644 --- a/engines/mads/nebular/nebular_scenes7.h +++ b/engines/mads/nebular/nebular_scenes7.h @@ -50,6 +50,18 @@ public: Scene7xx(MADSEngine *vm) : NebularScene(vm) {} }; +class Scene707: public SceneTeleporter { +public: + Scene707(MADSEngine *vm) : SceneTeleporter(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions(); + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 2d379e17698dceefcfb96ddfa09b2a2f7ef21161 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 5 May 2014 04:24:36 +0300 Subject: MADS: Add initial files for Rex scene group 6 --- engines/mads/module.mk | 1 + engines/mads/nebular/nebular_scenes.cpp | 1 + engines/mads/nebular/nebular_scenes6.cpp | 69 ++++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes6.h | 57 ++++++++++++++++++++++++++ 4 files changed, 128 insertions(+) create mode 100644 engines/mads/nebular/nebular_scenes6.cpp create mode 100644 engines/mads/nebular/nebular_scenes6.h diff --git a/engines/mads/module.mk b/engines/mads/module.mk index 91e8a6bb4b..61e810e215 100644 --- a/engines/mads/module.mk +++ b/engines/mads/module.mk @@ -15,6 +15,7 @@ MODULE_OBJS := \ nebular/nebular_scenes3.o \ nebular/nebular_scenes4.o \ nebular/nebular_scenes5.o \ + nebular/nebular_scenes6.o \ nebular/nebular_scenes7.o \ nebular/nebular_scenes8.o \ action.o \ diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 6ee696bb6f..56df10b0cc 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -33,6 +33,7 @@ #include "mads/nebular/nebular_scenes3.h" #include "mads/nebular/nebular_scenes4.h" #include "mads/nebular/nebular_scenes5.h" +#include "mads/nebular/nebular_scenes6.h" #include "mads/nebular/nebular_scenes7.h" #include "mads/nebular/nebular_scenes8.h" diff --git a/engines/mads/nebular/nebular_scenes6.cpp b/engines/mads/nebular/nebular_scenes6.cpp new file mode 100644 index 0000000000..44f02ed10f --- /dev/null +++ b/engines/mads/nebular/nebular_scenes6.cpp @@ -0,0 +1,69 @@ +/* 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 "common/scummsys.h" +#include "mads/mads.h" +#include "mads/scene.h" +#include "mads/nebular/nebular_scenes.h" +#include "mads/nebular/nebular_scenes6.h" + +namespace MADS { + +namespace Nebular { + +void Scene6xx::setAAName() { + _game._aaName = Resources::formatAAName(5); +} + +void Scene6xx::setPlayerSpritesPrefix() { + _vm->_sound->command(5); + Common::String oldName = _game._player._spritesPrefix; + + _game._player._spritesPrefix = ""; + // TODO: Scene-specific sprites prefix + + _game._player._scalingVelocity = true; + + if (oldName != _game._player._spritesPrefix) + _game._player._spritesChanged = true; + + _vm->_palette->setEntry(16, 10, 63, 63); + _vm->_palette->setEntry(17, 10, 45, 45); +} + +void Scene6xx::sceneEntrySound() { + if (!_vm->_musicFlag) { + _vm->_sound->command(2); + return; + } + + switch (_scene->_nextSceneId) { + // TODO + default: + break; + } +} + +/*------------------------------------------------------------------------*/ + +} // End of namespace Nebular +} // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes6.h b/engines/mads/nebular/nebular_scenes6.h new file mode 100644 index 0000000000..19eb278375 --- /dev/null +++ b/engines/mads/nebular/nebular_scenes6.h @@ -0,0 +1,57 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef MADS_NEBULAR_SCENES6_H +#define MADS_NEBULAR_SCENES6_H + +#include "common/scummsys.h" +#include "mads/game.h" +#include "mads/scene.h" +#include "mads/nebular/nebular_scenes.h" + +namespace MADS { + +namespace Nebular { + +class Scene6xx : public NebularScene { +protected: + /** + * Plays an appropriate sound when entering a scene + */ + void setAAName(); + + /** + * Updates the prefix used for getting player sprites for the scene + */ + void setPlayerSpritesPrefix(); + + void sceneEntrySound(); + +public: + Scene6xx(MADSEngine *vm) : NebularScene(vm) {} +}; + +} // End of namespace Nebular + +} // End of namespace MADS + +#endif /* MADS_NEBULAR_SCENES6_H */ -- cgit v1.2.3 From 183dd320963607d7ee1037367c1c86d4b7b77983 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 5 May 2014 19:27:16 +0200 Subject: MADS: Implement scene 711 --- engines/mads/nebular/nebular_scenes.cpp | 4 +-- engines/mads/nebular/nebular_scenes7.cpp | 45 ++++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes7.h | 12 +++++++++ 3 files changed, 59 insertions(+), 2 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 56df10b0cc..f192c04842 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -256,6 +256,8 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { // Scene group #7 case 707: return new Scene707(vm); + case 711: + return new Scene711(vm); case 701: // TODO case 702: @@ -272,8 +274,6 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { // TODO case 710: // TODO - case 711: - // TODO case 751: // TODO case 752: diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index 6692362ba3..53b408c46c 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -141,5 +141,50 @@ void Scene707::actions() { /*------------------------------------------------------------------------*/ +void Scene711::setup() { + // The original was calling Scene7xx::setPlayerSpreitesPrefix() + _vm->_sound->command(5); + Common::String oldName = _game._player._spritesPrefix; + _game._player._spritesPrefix = ""; + _game._player._scalingVelocity = true; + + if (oldName != _game._player._spritesPrefix) + _game._player._spritesChanged = true; + + _vm->_palette->setEntry(16, 10, 63, 63); + _vm->_palette->setEntry(17, 10, 45, 45); + + // The original was calling Scene7xx::setAAName() + _game._aaName = Resources::formatAAName(5); + + _game._player._spritesPrefix = ""; +} + +void Scene711::enter() { + if (_globals[kSexOfRex] == REX_FEMALE) + _handSpriteId = _scene->_sprites.addSprites("*ROXHAND"); + else + _handSpriteId = _scene->_sprites.addSprites("*REXHAND"); + + teleporterEnter(); + + // The original was using Scene7xx_SceneEntrySound() + if (!_vm->_musicFlag) + _vm->_sound->command(2); + else + _vm->_sound->command(25); +} + +void Scene711::step() { + teleporterStep(); +} + +void Scene711::actions() { + if (teleporterActions()) + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes7.h b/engines/mads/nebular/nebular_scenes7.h index 1d6c26d41e..080c6396e2 100644 --- a/engines/mads/nebular/nebular_scenes7.h +++ b/engines/mads/nebular/nebular_scenes7.h @@ -62,6 +62,18 @@ public: virtual void postActions() {}; }; +class Scene711: public SceneTeleporter { +public: + Scene711(MADSEngine *vm) : SceneTeleporter(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions(); + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 555f6a3ddac038ae5fa761ad258781340fb6f087 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 5 May 2014 20:56:18 +0200 Subject: MADS: Some renaming in scene8xx and scene804, implement scene 807 --- engines/mads/nebular/nebular_scenes.cpp | 10 ++--- engines/mads/nebular/nebular_scenes8.cpp | 75 ++++++++++++++++++++++++++++---- engines/mads/nebular/nebular_scenes8.h | 19 ++++++-- 3 files changed, 86 insertions(+), 18 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index f192c04842..e2411672dc 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -282,22 +282,20 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { error("Invalid scene %d called", scene._nextSceneId); // Scene group #8 + case 804: + return new Scene804(vm); + case 807: + return new Scene807(vm); case 801: // TODO case 802: // TODO case 803: // TODO - // Fall-through for unimplemented scenes in group #8 - error("Invalid scene %d called", scene._nextSceneId); - case 804: - return new Scene804(vm); case 805: // TODO case 806: // TODO - case 807: - // TODO case 808: // TODO case 810: diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index 145dbdcfb6..1ae10ed72b 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -30,7 +30,7 @@ namespace MADS { namespace Nebular { -void Scene8xx::setup1() { +void Scene8xx::setPlayerSpritesPrefix() { _vm->_sound->command(5); if ((_globals[kFromCockpit] && !_globals[kExitShip]) || _scene->_nextSceneId == 804 || _scene->_nextSceneId == 805 || @@ -44,12 +44,14 @@ void Scene8xx::setup1() { _vm->_palette->setEntry(17, 0x0A, 0x2D, 0x2D); } -void Scene8xx::setup2() { +void Scene8xx::setAAName() { _game._aaName = Resources::formatAAName(5); } -void Scene8xx::enter1() { - if (_vm->_musicFlag) { +void Scene8xx::sceneEntrySound() { + if (!_vm->_musicFlag) + _vm->_sound->command(2); + else { switch (_scene->_nextSceneId) { case 801: case 802: @@ -75,8 +77,8 @@ void Scene8xx::enter1() { /*------------------------------------------------------------------------*/ void Scene804::setup() { - Scene8xx::setup1(); - Scene8xx::setup2(); + Scene8xx::setPlayerSpritesPrefix(); + Scene8xx::setAAName(); } void Scene804::enter() { @@ -130,7 +132,7 @@ void Scene804::enter() { _scene->loadAnimation(Resources::formatName(804, 'r', 1, EXT_AA, "")); - Scene8xx::enter1(); + Scene8xx::sceneEntrySound(); if (_globals[kInSpace] && !_globals[kWindowFixed]) { _scene->_userInterface.setup(kInputLimitedSentences); @@ -306,6 +308,63 @@ void Scene804::step() { } } -} // End of namespace Nebular +/*------------------------------------------------------------------------*/ + +void Scene807::setup() { + _game._player._spritesPrefix = ""; + // The original was calling Scene8xx::setAAName() + _game._aaName = Resources::formatAAName(5); +} + +void Scene807::enter() { + if (_globals[kSexOfRex] == REX_FEMALE) + _handSpriteId = _scene->_sprites.addSprites("*ROXHAND"); + else + _handSpriteId = _scene->_sprites.addSprites("*REXHAND"); + + teleporterEnter(); + + // The original uses Scene8xx::SceneEntrySound() + if (!_vm->_musicFlag) + _vm->_sound->command(2); + else + _vm->_sound->command(20); +} +void Scene807::step() { + teleporterStep(); +} + +void Scene807::actions() { + if (teleporterActions()) { + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_LOOK, 0x181)) + _vm->_dialogs->show(80710); + else if (_action.isAction(0x103, 0x181)) + _vm->_dialogs->show(80710); + else if (_action.isAction(VERB_LOOK, 0xC4) && _action.isAction(0xB7, 0xC4)) + _vm->_dialogs->show(80711); + else if (_action.isAction(VERB_LOOK, 0x1CC)) + _vm->_dialogs->show(80712); + else if (_action.isAction(VERB_LOOK, 0x1D1) || _action.isAction(VERB_LOOK, 0x1D2) + || _action.isAction(VERB_LOOK, 0x1D3) || _action.isAction(VERB_LOOK, 0x1D4) + || _action.isAction(VERB_LOOK, 0x1D5) || _action.isAction(VERB_LOOK, 0x1D6) + || _action.isAction(VERB_LOOK, 0x1D7) || _action.isAction(VERB_LOOK, 0x1D8) + || _action.isAction(VERB_LOOK, 0x1D9) || _action.isAction(VERB_LOOK, 0x1D0) + || _action.isAction(VERB_LOOK, 0x1DB) || _action.isAction(VERB_LOOK, 0x1DA)) + _vm->_dialogs->show(80713); + else if (_action.isAction(VERB_LOOK, 0x1CF) && _action._lookFlag) + _vm->_dialogs->show(80714); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + +} // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes8.h b/engines/mads/nebular/nebular_scenes8.h index 2fb1abfe19..2c777d8699 100644 --- a/engines/mads/nebular/nebular_scenes8.h +++ b/engines/mads/nebular/nebular_scenes8.h @@ -37,17 +37,17 @@ protected: /** * Initial setup code shared by several scenes */ - void setup1(); + void setPlayerSpritesPrefix(); /** * Initial setup code shared by several scenes */ - void setup2(); + void setAAName(); /** * Common scene enter code used by multiple scenes */ - void enter1(); + void sceneEntrySound(); public: Scene8xx(MADSEngine *vm) : NebularScene(vm) {} }; @@ -72,8 +72,19 @@ public: virtual void actions() {}; }; -} // End of namespace Nebular +class Scene807: public SceneTeleporter { +public: + Scene807(MADSEngine *vm) : SceneTeleporter(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions(); + virtual void postActions() {}; +}; +} // End of namespace Nebular } // End of namespace MADS #endif /* MADS_NEBULAR_SCENES8_H */ -- cgit v1.2.3 From 595f5dcb4f72d5273d2f39b2f060aef9689e1e4d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 5 May 2014 21:39:57 +0200 Subject: MADS: Implement scene6XX::setPlayerSpritesPrefix and scene6xx::sceneEntrySound --- engines/mads/nebular/nebular_scenes6.cpp | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes6.cpp b/engines/mads/nebular/nebular_scenes6.cpp index 44f02ed10f..2d4ef9ee7f 100644 --- a/engines/mads/nebular/nebular_scenes6.cpp +++ b/engines/mads/nebular/nebular_scenes6.cpp @@ -38,14 +38,17 @@ void Scene6xx::setPlayerSpritesPrefix() { _vm->_sound->command(5); Common::String oldName = _game._player._spritesPrefix; - _game._player._spritesPrefix = ""; - // TODO: Scene-specific sprites prefix - - _game._player._scalingVelocity = true; + if ((_scene->_nextSceneId == 605) || (_scene->_nextSceneId == 620)) + _game._player._spritesPrefix = ""; + else if (_globals[kSexOfRex] == REX_MALE) + _game._player._spritesPrefix = "RXM"; + else + _game._player._spritesPrefix = "ROX"; if (oldName != _game._player._spritesPrefix) _game._player._spritesChanged = true; + _game._player._scalingVelocity = true; _vm->_palette->setEntry(16, 10, 63, 63); _vm->_palette->setEntry(17, 10, 45, 45); } @@ -57,7 +60,22 @@ void Scene6xx::sceneEntrySound() { } switch (_scene->_nextSceneId) { - // TODO + case 601: + case 602: + case 603: + case 604: + case 605: + case 607: + case 608: + case 609: + case 610: + case 612: + case 620: + _vm->_sound->command(29); + break; + case 611: + _vm->_sound->command(24); + break; default: break; } -- cgit v1.2.3 From 753579172f03c9d6c0a00b6e773d3d6a67514cd1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 5 May 2014 21:48:24 +0200 Subject: MADS: Fix code display in Teleporter room --- engines/mads/nebular/nebular_scenes.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index e2411672dc..b8b0984487 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -450,8 +450,7 @@ void SceneTeleporter::teleporterHandleKey() { _curCode *= 10; _curCode += _buttonTyped; _digitCount++; - _msgText = ""; - _msgText.format("%d", _curCode); + _msgText = Common::String::format("%d", _curCode); if (_digitCount < 4) _msgText += "_"; -- cgit v1.2.3 From f8380e9654f98700691956c784df57b6f4ac618c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 5 May 2014 20:02:37 -0400 Subject: MADS: Fix teleporter booths to show booth code as 4 digits --- engines/mads/nebular/nebular_scenes.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index b8b0984487..1c9cd41973 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -556,7 +556,7 @@ void SceneTeleporter::teleporterEnter() { _meteorologistNextPlace = _globals[kTeleporterCode + i]; } - Common::String msgText2 = Common::String::format("#%d", tmpVal); + Common::String msgText2 = Common::String::format("#%.4d", tmpVal); if (_scene->_currentSceneId != 711) { _scene->_kernelMessages.add(Common::Point(133, 34), 0, 32, 0, 9999999, msgText2); -- cgit v1.2.3 From 13bd409bbff3a88e0bf89e9a069f340aed9f4b44 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 6 May 2014 03:26:44 +0300 Subject: MADS: Add a sanity check for color 255 This is used in scene 752 --- engines/mads/msurface.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp index 2c9d093877..64b3ae1f23 100644 --- a/engines/mads/msurface.cpp +++ b/engines/mads/msurface.cpp @@ -488,7 +488,8 @@ void MSurface::translate(Common::Array &palette) { byte *pDest = getBasePtr(0, y); for (int x = 0; x < this->w; ++x, ++pDest) { - *pDest = palette[*pDest]._palIndex; + if (*pDest < 255) // scene 752 has some palette indices of 255 + *pDest = palette[*pDest]._palIndex; } } } -- cgit v1.2.3 From 3adf1aba77bac2af95d5c7ea414cdcbcbdc35a3c Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 6 May 2014 03:30:18 +0300 Subject: MADS: Add a sanity check to scene 413 --- engines/mads/nebular/nebular_scenes4.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes4.cpp b/engines/mads/nebular/nebular_scenes4.cpp index 980f77004a..1bb53ed857 100644 --- a/engines/mads/nebular/nebular_scenes4.cpp +++ b/engines/mads/nebular/nebular_scenes4.cpp @@ -4027,10 +4027,10 @@ void Scene413::enter() { } void Scene413::step() { - if (_scene->_activeAnimation->getCurrentFrame() == 38) + if (_scene->_activeAnimation && _scene->_activeAnimation->getCurrentFrame() == 38) _scene->_activeAnimation->setCurrentFrame(37); - if ((_scene->_activeAnimation->getCurrentFrame() == 21) && _canMove) { + if (_scene->_activeAnimation && _scene->_activeAnimation->getCurrentFrame() == 21 && _canMove) { _vm->_sound->command(27); _canMove = false; } -- cgit v1.2.3 From 417536d01c4eb0a1b99fb96a49f83c2f45a59c27 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 6 May 2014 03:34:55 +0300 Subject: MADS: Document all game scenes, and allow entering unimplemented scenes This way, it's possible to enter all scenes for debugging purposes. Also, this avoids the scene reordering during development. Scenes 708 and 806 have been removed, as they don't exist --- engines/mads/nebular/nebular_scenes.cpp | 339 +++++++++++++++----------------- engines/mads/nebular/nebular_scenes.h | 16 ++ 2 files changed, 180 insertions(+), 175 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 1c9cd41973..06b0f3b7b9 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -51,257 +51,245 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { scene.addActiveVocab(NOUN_ALCOHOL); switch (scene._nextSceneId) { - // Scene group #1 - case 101: + // Scene group #1 (ship, ocean, cave) + case 101: // Ship, cockpit return new Scene101(vm); - case 102: + case 102: // Ship, dining room return new Scene102(vm); - case 103: + case 103: // Ship, engine room return new Scene103(vm); - case 104: + case 104: // Ocean, northwest cliff return new Scene104(vm); - case 105: + case 105: // Ocean, northeast cliff with mine return new Scene105(vm); - case 106: + case 106: // Ocean, outside ship return new Scene106(vm); - case 107: + case 107: // Ocean, bushes return new Scene107(vm); - case 108: + case 108: // Ocean, southwest cliff return new Scene108(vm); - case 109: + case 109: // Ocean, tunnel return new Scene109(vm); - case 110: + case 110: // Ocean, cave with tunnel return new Scene110(vm); - case 111: + case 111: // Cave with pool and opening return new Scene111(vm); - case 112: + case 112: // cutscene, looking at view screen return new Scene112(vm); - // Scene group #2 - case 201: + // Scene group #2 (island) + case 201: // outside teleporter return new Scene201(vm); - case 202: + case 202: // village return new Scene202(vm); - case 203: + case 203: // tree with Rhotunda (fat woman) return new Scene203(vm); - case 205: + case 205: // village return new Scene205(vm); - case 207: + case 207: // outside witch doctor's hut return new Scene207(vm); - case 208: + case 208: // pit with leaves (trap) return new Scene208(vm); - case 209: + case 209: // palm tree and bamboo plant return new Scene209(vm); - case 210: + case 210: // outside native woman's hut return new Scene210(vm); - case 211: + case 211: // palm tree with monkey return new Scene211(vm); - case 212: + case 212: // outside cave return new Scene212(vm); - case 213: + case 213: // inside teleporter return new Scene213(vm); - case 214: + case 214: // inside witch doctor's hut return new Scene214(vm); - case 215: + case 215: // inside native woman's hut return new Scene215(vm); - case 216: + case 216: // cutscene, monitor showing Rex and native woman return new Scene216(vm); - // Scene group #3 - case 301: + // Scene group #3 (women's base, cell block) + case 301: // outside teleporter (before chaos) return new Scene301(vm); - case 302: + case 302: // room with statue (before chaos) return new Scene302(vm); - case 303: + case 303: // western corridor (before chaos) return new Scene303(vm); - case 304: + case 304: // crossing with traffic light (before chaos) return new Scene304(vm); - case 307: + case 307: // Rex's cell (before chaos) return new Scene307(vm); - case 308: + case 308: // sauropod's cell (before chaos) return new Scene308(vm); - case 309: + case 309: // multihand monster's cell (before chaos) return new Scene309(vm); - case 310: + case 310: // empty cell (before chaos) return new Scene310(vm); - case 311: + case 311: // warden's desk (before chaos) return new Scene311(vm); - case 313: + case 313: // air shaft overview return new Scene313(vm); - case 316: + case 316: // Gender Bender return new Scene316(vm); - case 318: + case 318: // doctor's gurney return new Scene318(vm); - case 319: + case 319: // doctor Slache closeup (lying on the gurney) return new Scene319(vm); - case 320: + case 320: // warden's desk closeup / monitors return new Scene320(vm); - case 321: + case 321: // gender bender sex change sequence return new Scene321(vm); - case 322: + case 322: // inside teleporter return new Scene322(vm); - case 351: + case 351: // outside teleporter (after chaos) return new Scene351(vm); - case 352: + case 352: // room with statue (after chaos) return new Scene352(vm); - case 353: + case 353: // western corridor (after chaos) return new Scene353(vm); - case 354: + case 354: // crossing with traffic light (after chaos) return new Scene354(vm); - case 357: + case 357: // Rex's cell (after chaos) return new Scene357(vm); - case 358: + case 358: // sauropod's cell (after chaos) return new Scene358(vm); - case 359: + case 359: // multihand monster's cell (after chaos) return new Scene359(vm); - case 360: + case 360: // empty cell (after chaos) return new Scene360(vm); - case 361: + case 361: // warden's desk (after chaos) return new Scene361(vm); - case 366: + case 366: // air shaft ending at Gender Bender return new Scene366(vm); - case 387: + case 387: // air shaft ending at cell return new Scene387(vm); - case 388: + case 388: // air shaft ending at sauropod's cell return new Scene388(vm); - case 389: + case 389: // air shaft ending at multihand monster's cell (before chaos) return new Scene389(vm); - case 390: + case 390: // air shaft ending at cell return new Scene390(vm); - case 391: + case 391: // air shaft ending at warden's desk return new Scene391(vm); - case 399: + case 399: // air shaft ending at multihand monster's cell (after chaos) return new Scene399(vm); - // Scene group #4 - case 401: + // Scene group #4 (women's base) + case 401: // outside bar return new Scene401(vm); - case 402: + case 402: // inside bar return new Scene402(vm); - case 405: + case 405: // outside armory return new Scene405(vm); - case 406: + case 406: // outside storage room return new Scene406(vm); - case 407: + case 407: // eastern corridor return new Scene407(vm); - case 408: + case 408: // inside armory return new Scene408(vm); - case 409: + case 409: // inside female only teleporter return new Scene409(vm); - case 410: + case 410: // inside storage room return new Scene410(vm); - case 411: + case 411: // lab return new Scene411(vm); - case 413: + case 413: // outside female only teleporter return new Scene413(vm); - // Scene group #5 - case 502: + // Scene group #5 (men's city, lower floor) + case 501: // outside car + return new DummyScene(vm); // TODO + case 502: // inside male only teleporter return new Scene502(vm); - case 501: - // TODO - case 503: - // TODO - case 504: - // TODO - case 505: - // TODO - case 506: - // TODO - case 507: - // TODO - case 508: - // TODO - case 511: - // TODO - case 512: - // TODO - case 513: - // TODO - case 515: - // TODO - case 551: - // TODO - // Fall-through for unimplemented scenes in group #5 - error("Invalid scene %d called", scene._nextSceneId); - - // Scene group #6 - case 601: - // TODO - case 602: - // TODO - case 603: - // TODO - case 604: - // TODO - case 605: - // TODO - case 607: - // TODO - case 608: - // TODO - case 609: - // TODO - case 610: - // TODO - case 611: - // TODO - case 612: - // TODO - case 620: - // TODO - // Fall-through for unimplemented scenes in group #6 - error("Invalid scene %d called", scene._nextSceneId); - - // Scene group #7 - case 707: + case 503: // guard tower + return new DummyScene(vm); // TODO + case 504: // inside car + return new DummyScene(vm); // TODO + case 505: // car view screen + return new DummyScene(vm); // TODO + case 506: // shopping street + return new DummyScene(vm); // TODO + case 507: // inside software house + return new DummyScene(vm); // TODO + case 508: // laser cannon + return new DummyScene(vm); // TODO + case 511: // outside pleasure dome + return new DummyScene(vm); // TODO + case 512: // inside pleasure dome + return new DummyScene(vm); // TODO + case 513: // outside mall + return new DummyScene(vm); // TODO + case 515: // overview + return new DummyScene(vm); // TODO + case 551: // outside teleporter (with skeleton) + return new DummyScene(vm); // TODO + + // Scene group #6 (men's city, upper floor) + case 601: // outside Bruce's house + return new DummyScene(vm); // TODO + case 602: // Bruce's house, living room + return new DummyScene(vm); // TODO + case 603: // Bruce's house, bedroom + return new DummyScene(vm); // TODO + case 604: // viewport + return new DummyScene(vm); // TODO + case 605: // viewport closeup + return new DummyScene(vm); // TODO + case 607: // outside Abdul's garage + return new DummyScene(vm); // TODO + case 608: // inside Abdul's garage + return new DummyScene(vm); // TODO + case 609: // outside Buckluster video store + return new DummyScene(vm); // TODO + case 610: // inside Buckluster video store + return new DummyScene(vm); // TODO + case 611: // back alley + return new DummyScene(vm); // TODO + case 612: // expressway / maintenance building + return new DummyScene(vm); // TODO + case 620: // cutscene, viewport glass breaking + return new DummyScene(vm); // TODO + + // Scene group #7 (submerged men's city / upper floor) + case 701: // outside elevator (after city is submerged) + return new DummyScene(vm); // TODO + case 702: // outside teleporter (after city is submerged) + return new DummyScene(vm); // TODO + case 703: // water + return new DummyScene(vm); // TODO + case 704: // water, building in the distance + return new DummyScene(vm); // TODO + case 705: // water, outside building + return new DummyScene(vm); // TODO + case 706: // inside building, pedestral room, outside teleporter + return new DummyScene(vm); // TODO + case 707: // teleporter return new Scene707(vm); - case 711: + case 710: // looking at pedestral room through binoculars + return new DummyScene(vm); // TODO + case 711: // inside teleporter return new Scene711(vm); - case 701: - // TODO - case 702: - // TODO - case 703: - // TODO - case 704: - // TODO - case 705: - // TODO - case 706: - // TODO - case 708: - // TODO - case 710: - // TODO - case 751: - // TODO - case 752: - // TODO - // Fall-through for unimplemented scenes in group #7 - error("Invalid scene %d called", scene._nextSceneId); + case 751: // outside elevator (before city is submerged) + return new DummyScene(vm); // TODO + case 752: // outside teleporter (before city is submerged) + return new DummyScene(vm); // TODO // Scene group #8 - case 804: + case 801: // control room, outside teleporter + return new DummyScene(vm); // TODO + case 802: // launch pad with destroyed ship + return new DummyScene(vm); // TODO + case 803: // empty launch pad + return new DummyScene(vm); // TODO + case 804: // ??? (broken animation) return new Scene804(vm); - case 807: - return new Scene807(vm); - case 801: - // TODO - case 802: - // TODO - case 803: - // TODO - case 805: - // TODO - case 806: - // TODO - case 808: - // TODO - case 810: - // TODO - // Fall-through for unimplemented scenes in group #8 - error("Invalid scene %d called", scene._nextSceneId); + case 805: // service panel + return new DummyScene(vm); // TODO + case 807: // teleporter + return new DummyScene(vm); // TODO + case 808: // antigrav control + return new DummyScene(vm); // TODO + case 810: // cutscene: Rex's ship leaving the planet + return new DummyScene(vm); // TODO default: error("Invalid scene %d called", scene._nextSceneId); @@ -450,7 +438,8 @@ void SceneTeleporter::teleporterHandleKey() { _curCode *= 10; _curCode += _buttonTyped; _digitCount++; - _msgText = Common::String::format("%d", _curCode); + _msgText = ""; + _msgText.format("%d", _curCode); if (_digitCount < 4) _msgText += "_"; @@ -556,7 +545,7 @@ void SceneTeleporter::teleporterEnter() { _meteorologistNextPlace = _globals[kTeleporterCode + i]; } - Common::String msgText2 = Common::String::format("#%.4d", tmpVal); + Common::String msgText2 = Common::String::format("#%d", tmpVal); if (_scene->_currentSceneId != 711) { _scene->_kernelMessages.add(Common::Point(133, 34), 0, 32, 0, 9999999, msgText2); diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index 2a47af61d3..e1fcf1e48d 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -178,6 +178,22 @@ protected: */ SceneTeleporter(MADSEngine *vm) : NebularScene(vm) {} }; + +// TODO: Temporary, remove once all scenes are implemented properly +class DummyScene: public NebularScene { +public: + DummyScene(MADSEngine *vm) : NebularScene(vm) { + warning("Unimplemented scene"); + } + + virtual void setup() {} + virtual void enter() {} + virtual void step() {} + virtual void preActions() {} + virtual void actions() {} + virtual void synchronize(Common::Serializer &s) {} +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 2ff16fbc49c0bc44ab06b3a25d7739bf0b394a86 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 6 May 2014 03:38:21 +0300 Subject: MADS: Restore accidentally reverted code --- engines/mads/nebular/nebular_scenes.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 06b0f3b7b9..970acb057a 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -438,8 +438,7 @@ void SceneTeleporter::teleporterHandleKey() { _curCode *= 10; _curCode += _buttonTyped; _digitCount++; - _msgText = ""; - _msgText.format("%d", _curCode); + _msgText = Common::String::format("%d", _curCode); if (_digitCount < 4) _msgText += "_"; @@ -545,7 +544,7 @@ void SceneTeleporter::teleporterEnter() { _meteorologistNextPlace = _globals[kTeleporterCode + i]; } - Common::String msgText2 = Common::String::format("#%d", tmpVal); + Common::String msgText2 = Common::String::format("#%.4d", tmpVal); if (_scene->_currentSceneId != 711) { _scene->_kernelMessages.add(Common::Point(133, 34), 0, 32, 0, 9999999, msgText2); -- cgit v1.2.3 From c5878e401ce54713fb179f24a5744666571d2743 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 6 May 2014 04:38:24 +0300 Subject: MADS: Fix scene loading for V2 games --- engines/mads/scene_data.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index 65220ced35..272c8288f0 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -141,7 +141,7 @@ void SceneInfo::load(int sceneId, int variant, const Common::String &resName, _height = infoStream->readUint16LE(); // HACK for V2 games (for now) - if (_vm->getGameID() != GType_RexNebular && _width == 0) { + if (_vm->getGameID() != GType_RexNebular) { _width = 320; _height = 156; } @@ -226,15 +226,18 @@ void SceneInfo::load(int sceneId, int variant, const Common::String &resName, Common::Array spriteSets; Common::Array usageList; - for (uint i = 0; i < setNames.size(); ++i) { - Common::String setResName; - if (sceneFlag || resName.hasPrefix("*")) - setResName += "*"; - setResName += setNames[i]; - - SpriteAsset *sprites = new SpriteAsset(_vm, setResName, flags); - spriteSets.push_back(sprites); - usageList.push_back(sprites->_usageIndex); + // TODO: The following isn't quite right for V2 games + if (_vm->getGameID() == GType_RexNebular) { + for (uint i = 0; i < setNames.size(); ++i) { + Common::String setResName; + if (sceneFlag || resName.hasPrefix("*")) + setResName += "*"; + setResName += setNames[i]; + + SpriteAsset *sprites = new SpriteAsset(_vm, setResName, flags); + spriteSets.push_back(sprites); + usageList.push_back(sprites->_usageIndex); + } } _vm->_palette->_paletteUsage.updateUsage(usageList, _usageIndex); -- cgit v1.2.3 From d88e165e00cc70540af05c06f4f32b1907bdcc09 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 6 May 2014 04:39:12 +0300 Subject: MADS: Fix loading of V2 hotspots --- engines/mads/hotspots.cpp | 4 ++-- engines/mads/scene.cpp | 19 ++++--------------- engines/mads/screen.cpp | 2 +- engines/mads/user_interface.cpp | 15 ++++++--------- 4 files changed, 13 insertions(+), 27 deletions(-) diff --git a/engines/mads/hotspots.cpp b/engines/mads/hotspots.cpp index ca05ad618c..d3ce0a9263 100644 --- a/engines/mads/hotspots.cpp +++ b/engines/mads/hotspots.cpp @@ -182,13 +182,13 @@ Hotspot::Hotspot(Common::SeekableReadStream &f, bool isV2) { _articleNumber = f.readByte(); _active = f.readByte() != 0; _cursor = (CursorType)f.readByte(); - _vocabId = f.readUint16LE(); - _verbId = f.readUint16LE(); if (isV2) { // This looks to be some sort of bitmask. Perhaps it signifies // the valid verbs for this hotspot f.skip(2); // unknown } + _vocabId = f.readUint16LE(); + _verbId = f.readUint16LE(); } /*------------------------------------------------------------------------*/ diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index e53061c750..62a0e2031c 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -477,26 +477,15 @@ void Scene::drawElements(ScreenTransition transitionType, bool surfaceFlag) { // Copy background for the dirty areas to the screen _dirtyAreas.copy(&_backgroundSurface, &_vm->_screen, _posAdjust); - // TODO: Remove this HACK when sprites are implemented for V2 games - if (_vm->getGameID() != GType_RexNebular) { - if (transitionType) { - // Fading in the screen - _vm->_screen.transition(transitionType, surfaceFlag); - _vm->_sound->startQueuedCommands(); - } else { - // Copy dirty areas to the screen - _dirtyAreas.copyToScreen(_vm->_screen._offset); - } - return; - } - // Handle dirty areas for foreground objects - _spriteSlots.setDirtyAreas(); + if (_vm->getGameID() == GType_RexNebular) // TODO: Implement for V2 games + _spriteSlots.setDirtyAreas(); _textDisplay.setDirtyAreas2(); _dirtyAreas.merge(1, DIRTY_AREAS_SIZE); // Draw sprites that have changed - _spriteSlots.drawSprites(&_vm->_screen); + if (_vm->getGameID() == GType_RexNebular) // TODO: Implement for V2 games + _spriteSlots.drawSprites(&_vm->_screen); // Draw text elements onto the view _textDisplay.draw(&_vm->_screen); diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index 640617e127..f0564c5fbc 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -259,7 +259,7 @@ ScreenObjects::ScreenObjects(MADSEngine *vm) : _vm(vm) { } void ScreenObjects::add(const Common::Rect &bounds, Layer layer, ScrCategory category, int descId) { - assert(size() < 100); + //assert(size() < 100); ScreenObject so; so._bounds = bounds; diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 8208c14f4d..e8eaf3ad44 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -704,15 +704,12 @@ void UserInterface::loadElements() { CAT_INV_ANIM, 0); } - // TODO: Implement for V2 games - if (_vm->getGameID() == GType_RexNebular) { - if (_vm->_game->_screenObjects._inputMode == kInputBuildingSentences || - _vm->_game->_screenObjects._inputMode == kInputLimitedSentences) { - _categoryIndexes[CAT_HOTSPOT - 1] = _vm->_game->_screenObjects.size() + 1; - for (int hotspotIdx = scene._hotspots.size() - 1; hotspotIdx >= 0; --hotspotIdx) { - Hotspot &hs = scene._hotspots[hotspotIdx]; - _vm->_game->_screenObjects.add(hs._bounds, LAYER_GUI, CAT_HOTSPOT, hotspotIdx); - } + if (_vm->_game->_screenObjects._inputMode == kInputBuildingSentences || + _vm->_game->_screenObjects._inputMode == kInputLimitedSentences) { + _categoryIndexes[CAT_HOTSPOT - 1] = _vm->_game->_screenObjects.size() + 1; + for (int hotspotIdx = scene._hotspots.size() - 1; hotspotIdx >= 0; --hotspotIdx) { + Hotspot &hs = scene._hotspots[hotspotIdx]; + _vm->_game->_screenObjects.add(hs._bounds, LAYER_GUI, CAT_HOTSPOT, hotspotIdx); } } -- cgit v1.2.3 From 66593ef302010d5b6e09b17fb2b7a88f2803d455 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 6 May 2014 05:32:21 +0300 Subject: MADS: Index and document all Phantom scenes --- engines/mads/phantom/game_phantom.cpp | 12 ---- engines/mads/phantom/game_phantom.h | 3 - engines/mads/phantom/phantom_scenes.cpp | 122 ++++++++++++++++++++++++++++---- engines/mads/phantom/phantom_scenes.h | 6 +- 4 files changed, 111 insertions(+), 32 deletions(-) diff --git a/engines/mads/phantom/game_phantom.cpp b/engines/mads/phantom/game_phantom.cpp index 43dec7cc02..25da7771c5 100644 --- a/engines/mads/phantom/game_phantom.cpp +++ b/engines/mads/phantom/game_phantom.cpp @@ -80,9 +80,6 @@ void GamePhantom::initialiseGlobals() { /* Section #5 variables */ // TODO - /* Section #6 variables */ - // TODO - /* Section #9 variables */ // TODO @@ -112,15 +109,6 @@ void GamePhantom::setSectionHandler() { case 5: _sectionHandler = new Section5Handler(_vm); break; - case 6: - _sectionHandler = new Section6Handler(_vm); - break; - case 7: - _sectionHandler = new Section7Handler(_vm); - break; - case 8: - _sectionHandler = new Section8Handler(_vm); - break; default: break; } diff --git a/engines/mads/phantom/game_phantom.h b/engines/mads/phantom/game_phantom.h index bb574a98b0..96299fb814 100644 --- a/engines/mads/phantom/game_phantom.h +++ b/engines/mads/phantom/game_phantom.h @@ -88,9 +88,6 @@ typedef Section1Handler Section2Handler; typedef Section1Handler Section3Handler; typedef Section1Handler Section4Handler; typedef Section1Handler Section5Handler; -typedef Section1Handler Section6Handler; -typedef Section1Handler Section7Handler; -typedef Section1Handler Section8Handler; } // End of namespace Nebular diff --git a/engines/mads/phantom/phantom_scenes.cpp b/engines/mads/phantom/phantom_scenes.cpp index 83b664b33a..dbce014525 100644 --- a/engines/mads/phantom/phantom_scenes.cpp +++ b/engines/mads/phantom/phantom_scenes.cpp @@ -39,22 +39,114 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { // TODO //scene.addActiveVocab(NOUN_DROP); - // TODO: Just return a dummy scene for now - return new DummyScene(vm); - switch (scene._nextSceneId) { - // Scene group #1 - case 101: - // TODO - - // Scene group #2 - // TODO - - // Scene group #3 - // TODO - - // Scene group #8 - // TODO + // Scene group #1 (theater, stage and dressing rooms) + case 101: // seats + return new DummyScene(vm); // TODO + case 102: // music stands + return new DummyScene(vm); // TODO + case 103: // below stage + return new DummyScene(vm); // TODO + case 104: // stage + return new DummyScene(vm); // TODO + case 105: // ground floor, storage room + return new DummyScene(vm); // TODO + case 106: // behind stage + return new DummyScene(vm); // TODO + case 107: // stage right wing + return new DummyScene(vm); // TODO + case 108: // stage left wing + return new DummyScene(vm); // TODO + case 109: // upper floor, staircase + return new DummyScene(vm); // TODO + case 110: // outside dressing rooms 1 + return new DummyScene(vm); // TODO + case 111: // outside dressing rooms 2 + return new DummyScene(vm); // TODO + case 112: // inside dressing room 1 + return new DummyScene(vm); // TODO + case 113: // inside dressing room 2 + return new DummyScene(vm); // TODO + case 114: // lower floor, storage room + return new DummyScene(vm); // TODO + case 150: // cutscene + return new DummyScene(vm); // TODO + + // Scene group #2 (theater entrance, offices, balcony) + case 201: // entrance / ticket office + return new DummyScene(vm); // TODO + case 202: // outside offices / paintings room + return new DummyScene(vm); // TODO + case 203: // office + return new DummyScene(vm); // TODO + case 204: // library + return new DummyScene(vm); // TODO + case 205: // upper floor, outside balcony boxes + return new DummyScene(vm); // TODO + case 206: // balcony box #1 + return new DummyScene(vm); // TODO + case 207: // balcony box #2 + return new DummyScene(vm); // TODO + case 208: // stage and balcony view + return new DummyScene(vm); // TODO + case 250: // cutscene + return new DummyScene(vm); // TODO + + // Scene group #3 (catwalks, chandelier, lake / catacombs entrance) + case 301: // catwalk #1 above stage + return new DummyScene(vm); // TODO + case 302: // catwalk #2 above stage + return new DummyScene(vm); // TODO + case 303: // above chandelier + return new DummyScene(vm); // TODO + case 304: // chandelier + return new DummyScene(vm); // TODO + case 305: // chandelier fight, phantom closeup + return new DummyScene(vm); // TODO + case 306: // chandelier #2 + return new DummyScene(vm); // TODO + case 307: // catwalk #3 above stage + return new DummyScene(vm); // TODO + case 308: // hidden staircase behind balcony box + return new DummyScene(vm); // TODO + case 309: // lake and archway + return new DummyScene(vm); // TODO + case 310: // lake + return new DummyScene(vm); // TODO + + // Scene group #4 (labyrinth) + case 401: // labyrinth room, 3 exits + return new DummyScene(vm); // TODO + case 403: // labyrinth room (big), 4 exits + 1 bricked door, left + return new DummyScene(vm); // TODO + case 404: // labyrinth room, 3 exits + return new DummyScene(vm); // TODO + case 406: // labyrinth room, 2 exits + return new DummyScene(vm); // TODO + case 407: // catacomb room / lake + return new DummyScene(vm); // TODO + case 408: // catacomb corridor + return new DummyScene(vm); // TODO + case 409: // catacomb room, door with switch panel + return new DummyScene(vm); // TODO + case 410: // skull switch panel + return new DummyScene(vm); // TODO + case 453: // Labyrinth room (big), 4 exits + 1 bricked door, right + return new DummyScene(vm); // TODO + case 456: // Labyrinth room, 2 exits + return new DummyScene(vm); // TODO + + // Scene group #5 (Phantom's hideout) + case 501: // catacombs, outside phantom's hideout, lake and boat + return new DummyScene(vm); // TODO + case 502: // push panel trap + return new DummyScene(vm); // TODO + case 504: // Phantom's hideout, church organ + return new DummyScene(vm); // TODO + case 505: // Phantom's hideout, sarcophagus + return new DummyScene(vm); // TODO + case 506: // catacomb room with ramp + return new DummyScene(vm); // TODO default: error("Invalid scene %d called", scene._nextSceneId); diff --git a/engines/mads/phantom/phantom_scenes.h b/engines/mads/phantom/phantom_scenes.h index 9df8063cd4..e4b79fef33 100644 --- a/engines/mads/phantom/phantom_scenes.h +++ b/engines/mads/phantom/phantom_scenes.h @@ -106,9 +106,11 @@ public: }; // TODO: Temporary, remove once implemented properly -class DummyScene: public Scene1xx { +class DummyScene: public PhantomScene { public: - DummyScene(MADSEngine *vm) : Scene1xx(vm) {} + DummyScene(MADSEngine *vm) : PhantomScene(vm) { + warning("Unimplemented scene"); + } virtual void setup() {} virtual void enter() {} -- cgit v1.2.3 From add4135d46f48cf3bda3424a11215b893c6b3a33 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 6 May 2014 06:16:25 +0300 Subject: MADS: Index and document all Dragonsphere scenes --- engines/mads/dragonsphere/dragonsphere_scenes.cpp | 151 ++++++++++++++++++++-- engines/mads/dragonsphere/dragonsphere_scenes.h | 6 +- 2 files changed, 143 insertions(+), 14 deletions(-) diff --git a/engines/mads/dragonsphere/dragonsphere_scenes.cpp b/engines/mads/dragonsphere/dragonsphere_scenes.cpp index fd4fcc183c..40c9a89f44 100644 --- a/engines/mads/dragonsphere/dragonsphere_scenes.cpp +++ b/engines/mads/dragonsphere/dragonsphere_scenes.cpp @@ -43,18 +43,145 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new DummyScene(vm); switch (scene._nextSceneId) { - // Scene group #1 - case 101: - // TODO - - // Scene group #2 - // TODO - - // Scene group #3 - // TODO - - // Scene group #8 - // TODO + // Scene group #1 (Castle, river and caves) + case 101: // king's bedroom + return new DummyScene(vm); // TODO + case 102: // queen's bedroom + return new DummyScene(vm); // TODO + case 103: // outside king's bedroom + return new DummyScene(vm); // TODO + case 104: // fireplace / bookshelf + return new DummyScene(vm); // TODO + case 105: // dining room + return new DummyScene(vm); // TODO + case 106: // throne room + return new DummyScene(vm); // TODO + case 107: // council chamber + return new DummyScene(vm); // TODO + case 108: // dungeon, cell entrance + return new DummyScene(vm); // TODO + case 109: // cell + return new DummyScene(vm); // TODO + case 110: // outside castle, merchants and well + return new DummyScene(vm); // TODO + case 111: // Dragonsphere closeup + return new DummyScene(vm); // TODO + case 112: // well descend + return new DummyScene(vm); // TODO + case 113: // bottom of well, river and trap door + return new DummyScene(vm); // TODO + case 114: // cave + return new DummyScene(vm); // TODO + case 115: // cave with passageway to west + return new DummyScene(vm); // TODO + case 116: // cave with pedestral + return new DummyScene(vm); // TODO + case 117: // river + return new DummyScene(vm); // TODO + case 118: // castle courtyard and gate + return new DummyScene(vm); // TODO + case 119: // castle stairs + return new DummyScene(vm); // TODO + case 120: // map + return new DummyScene(vm); // TODO + + // Scene group #2 (Slathan ni Patan, land of shapeshifters) + case 201: // guardhouse, entrance to Slathan ni Patan + return new DummyScene(vm); // TODO + case 203: // forest + return new DummyScene(vm); // TODO + case 204: // cave + return new DummyScene(vm); // TODO + case 205: // outside village + return new DummyScene(vm); // TODO + case 206: // village + return new DummyScene(vm); // TODO + + // Scene group #3 (Brynn-Fann, Land of faeries) + case 301: // maze entrance + return new DummyScene(vm); // TODO + case 302: // maze + return new DummyScene(vm); // TODO + case 303: // toads + return new DummyScene(vm); // TODO + + // Scene group #4 (The Desert) + case 401: // desert + return new DummyScene(vm); // TODO + case 402: // desert + return new DummyScene(vm); // TODO + case 403: // desert + return new DummyScene(vm); // TODO + case 404: // desert with dunes + return new DummyScene(vm); // TODO + case 405: // oasis + return new DummyScene(vm); // TODO + case 406: // inside tent + return new DummyScene(vm); // TODO + case 407: // gem sack closeup + return new DummyScene(vm); // TODO + case 408: // spirit plane + return new DummyScene(vm); // TODO + case 409: // spirit plane top down view, disks + return new DummyScene(vm); // TODO + case 410: // snake pit and spirit tree + return new DummyScene(vm); // TODO + case 411: // nest + return new DummyScene(vm); // TODO + case 412: // desert + return new DummyScene(vm); // TODO + case 454: // cutscene + return new DummyScene(vm); // TODO + + // Scene group #5 (The Mountain) + case 501: // base of mountain / wall + return new DummyScene(vm); // TODO + case 502: // base of mountain + return new DummyScene(vm); // TODO + case 503: // waterfall + return new DummyScene(vm); // TODO + case 504: // hermit's cave + return new DummyScene(vm); // TODO + case 505: // rock trees + return new DummyScene(vm); // TODO + case 506: // nest + return new DummyScene(vm); // TODO + case 507: // above nest + return new DummyScene(vm); // TODO + case 508: // ledge, right + return new DummyScene(vm); // TODO + case 509: // ledge, left + return new DummyScene(vm); // TODO + case 510: // nest top down view and pillars + return new DummyScene(vm); // TODO + case 511: // pillars + return new DummyScene(vm); // TODO + case 512: // nest + return new DummyScene(vm); // TODO + case 557: // cutscene + return new DummyScene(vm); // TODO + + // Scene group #6 (The Tower) + case 601: // ??? (tile count mismatch) + return new DummyScene(vm); // TODO + case 603: // eye chamber + return new DummyScene(vm); // TODO + case 604: // room of magic + return new DummyScene(vm); // TODO + case 605: // science room + return new DummyScene(vm); // TODO + case 606: // doorway + return new DummyScene(vm); // TODO + case 607: // prison + return new DummyScene(vm); // TODO + case 609: // stone pedestral chamber + return new DummyScene(vm); // TODO + case 612: // infernal machine room + return new DummyScene(vm); // TODO + case 613: // room with lava floor + return new DummyScene(vm); // TODO + case 614: // sorcerer's room + return new DummyScene(vm); // TODO default: error("Invalid scene %d called", scene._nextSceneId); diff --git a/engines/mads/dragonsphere/dragonsphere_scenes.h b/engines/mads/dragonsphere/dragonsphere_scenes.h index cf42dab0ba..0c5fea33db 100644 --- a/engines/mads/dragonsphere/dragonsphere_scenes.h +++ b/engines/mads/dragonsphere/dragonsphere_scenes.h @@ -106,9 +106,11 @@ public: }; // TODO: Temporary, remove once implemented properly -class DummyScene: public Scene1xx { +class DummyScene: public DragonsphereScene { public: - DummyScene(MADSEngine *vm) : Scene1xx(vm) {} + DummyScene(MADSEngine *vm) : DragonsphereScene(vm) { + warning("Unimplemented scene"); + } virtual void setup() {} virtual void enter() {} -- cgit v1.2.3 From 7a27be396350309b9a23b587d0a566603370e27a Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 6 May 2014 07:10:50 +0300 Subject: FULLPIPE: Implement MovGraph::shuffleTree() --- engines/fullpipe/motion.cpp | 29 +++++++++++++++++++++++++++++ engines/fullpipe/motion.h | 1 + 2 files changed, 30 insertions(+) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index a4c5b0ba64..91950baa4a 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -818,6 +818,35 @@ Common::Array *MovGraph::genMovArr(int x, int y, int *arrSize, int fla return arr; } +void MovGraph::shuffleTree(MovGraphLink *lnk, MovGraphLink *lnk2, Common::Array &tempObList1, Common::Array &tempObList2) { + if (lnk == lnk2) { + for (uint i = 0; i < tempObList1.size(); i++) + tempObList2.push_back(tempObList1[i]); + + tempObList2.push_back(lnk); + } else { + lnk->_flags |= 0x80000000; + + tempObList1.push_back(lnk); + + for (ObList::iterator i = _links.begin(); i != _links.end(); ++i) { + MovGraphLink *l = (MovGraphLink *)*i; + + if (l->_movGraphNode1 != lnk->_movGraphNode1) { + if (l->_movGraphNode2 != lnk->_movGraphNode1) { + if (l->_movGraphNode1 != lnk->_movGraphNode2 && l->_movGraphNode2 != lnk->_movGraphNode2) + continue; + } + } + + if (!(l->_flags & 0xA0000000)) + shuffleTree(l, lnk2, tempObList1, tempObList2); + } + + lnk->_flags &= 0x7FFFFFFF; + } +} + int MovGraph2::getItemIndexByGameObjectId(int objectId) { for (uint i = 0; i < _items2.size(); i++) if (_items2[i]->_objectId == objectId) diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index 13d96ae551..e00447b335 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -363,6 +363,7 @@ public: MovGraphNode *calcOffset(int ox, int oy); int getItemIndexByStaticAni(StaticANIObject *ani); Common::Array *genMovArr(int x, int y, int *arrSize, int flag1, int flag2); + void shuffleTree(MovGraphLink *lnk, MovGraphLink *lnk2, Common::Array &tempObList1, Common::Array &tempObList2); }; class Movement; -- cgit v1.2.3 From daf4170d74b8dff91818443baa287b5b5176e9b5 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 6 May 2014 07:18:34 +0200 Subject: MADS: Implement scene 501 --- engines/mads/nebular/nebular_scenes.cpp | 4 +- engines/mads/nebular/nebular_scenes5.cpp | 377 ++++++++++++++++++++++++++++++- engines/mads/nebular/nebular_scenes5.h | 20 ++ 3 files changed, 393 insertions(+), 8 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 970acb057a..08b01fe8e2 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -197,7 +197,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { // Scene group #5 (men's city, lower floor) case 501: // outside car - return new DummyScene(vm); // TODO + return new Scene501(vm); case 502: // inside male only teleporter return new Scene502(vm); case 503: // guard tower @@ -285,7 +285,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 805: // service panel return new DummyScene(vm); // TODO case 807: // teleporter - return new DummyScene(vm); // TODO + return new Scene807(vm); case 808: // antigrav control return new DummyScene(vm); // TODO case 810: // cutscene: Rex's ship leaving the planet diff --git a/engines/mads/nebular/nebular_scenes5.cpp b/engines/mads/nebular/nebular_scenes5.cpp index eb1aa42dd3..db6e6dad59 100644 --- a/engines/mads/nebular/nebular_scenes5.cpp +++ b/engines/mads/nebular/nebular_scenes5.cpp @@ -92,6 +92,371 @@ void Scene5xx::sceneEntrySound() { /*------------------------------------------------------------------------*/ +void Scene501::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(0x6E); + _scene->addActiveVocab(0x18B); +} + +void Scene501::handleSlotActions() { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + int numTicks, frameIndex; + if (_globals[kSexOfRex] == REX_MALE) { + _mainSpriteId = _globals._spriteIndexes[4]; + numTicks = 8; + frameIndex = 3; + } else { + _mainSpriteId = _globals._spriteIndexes[5]; + numTicks = 10; + frameIndex = 2; + } + + _mainSequenceId = _scene->_sequences.startReverseCycle(_mainSpriteId, false, numTicks, 1, 0, 0); + _scene->_sequences.setAnimRange(_mainSequenceId, 1, frameIndex); + _scene->_sequences.setMsgLayout(_mainSequenceId); + _vm->_sound->command(10); + _scene->_sequences.addSubEntry(_mainSequenceId, SEQUENCE_TRIGGER_SPRITE, frameIndex, 1); + _scene->_sequences.addSubEntry(_mainSequenceId, SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + + case 1: + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 12, 6, 0, 0); + break; + + case 2: + _scene->_sequences.updateTimeout(-1, _mainSequenceId); + _game._player._visible = true; + _scene->_sequences.addTimer(15, 3); + break; + + case 3: + _game._player.walk(Common::Point(282, 110), FACING_NORTH); + _scene->_sequences.addTimer(60, 4); + break; + + default: + break; + } +} + +void Scene501::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 1)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('c', 0)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 0)); + + if (_globals[kSexOfRex] == REX_MALE) { + _globals._spriteIndexes[4] = _scene->_sprites.addSprites("*RXMRC_9"); + _globals._spriteIndexes[6] = _scene->_sprites.addSprites("*RXCD_7"); + } else { + _globals._spriteIndexes[5] = _scene->_sprites.addSprites("*ROXRC_9"); + _globals._spriteIndexes[7] = _scene->_sprites.addSprites("*ROXCD_7"); + } + + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); + int idx = _scene->_dynamicHotspots.add(0x6E, 0x18B, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); + _doorHotspotid = _scene->_dynamicHotspots.setPosition(idx,Common::Point(282, 110), FACING_NORTH); + _scene->_dynamicHotspots.setCursor(_doorHotspotid, CURSOR_GO_UP); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 7); + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); + _rexPunched = true; + + if (_scene->_priorSceneId == 504) { + _game._player._stepEnabled = false; + _game._player._playerPos = Common::Point(74, 121); + _game._player._facing = FACING_NORTHWEST; + _game._player._visible = false; + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); + if (_globals[kSexOfRex] == REX_MALE) + _scene->loadAnimation(formAnimName('G', 2), 70); + else + _scene->loadAnimation(formAnimName('R', 2), 70); + } else if (_scene->_priorSceneId == 503) { + _game._player._playerPos = Common::Point(317, 102); + _game._player._facing = FACING_SOUTHWEST; + _scene->_sequences.addTimer(15, 80); + } else if (_scene->_priorSceneId != -2) + _game._player._playerPos = Common::Point(299, 131); + + if (_scene->_roomChanged) { + _game._objects.addToInventory(OBJ_FAKE_ID); + _game._objects.addToInventory(OBJ_SECURITY_CARD); + _game._objects.addToInventory(OBJ_ID_CARD); + } + + sceneEntrySound(); + _game.loadQuoteSet(0x275, 0x276, 0x277, 0); + + if (!_game._visitedScenes._sceneRevisited) + _scene->_sequences.addTimer(2, 90); +} + +void Scene501::step() { + if (_game._trigger == 90) + _vm->_dialogs->show(50127); + + if (_game._trigger >= 80) { + switch (_game._trigger) { + case 80: + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 12, 6, 0, 0); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 9, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 7); + _vm->_sound->command(11); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 81); + break; + + case 81: + _scene->_dynamicHotspots.remove(_doorHotspotid); + _game._player.walk(Common::Point(276, 110), FACING_SOUTHWEST); + _scene->_sequences.addTimer(120, 82); + break; + + case 82: + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 9, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 7); + _vm->_sound->command(12); + _doorHotspotid = _scene->_dynamicHotspots.add(0x6E, 0x18B, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(_globals._sequenceIndexes[3], Common::Point(282, 110), FACING_NORTH); + _scene->_dynamicHotspots.setCursor(_doorHotspotid, CURSOR_GO_UP); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 83); + break; + + case 83: + _game._player._stepEnabled = true; + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 7); + break; + + default: + break; + } + } + + if (_game._trigger >= 70 && _game._trigger <= 73) { + switch (_game._trigger) { + case 70: + _game._player._visible = true; + _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; + _scene->_sequences.addTimer(15, 71); + break; + + case 71: + _game._player.walk(Common::Point(92, 130), FACING_SOUTH); + _scene->_sequences.addTimer(30, 72); + break; + + case 72: + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 73); + break; + + case 73: + _game._player._stepEnabled = true; + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); + break; + + default: + break; + } + } +} + +void Scene501::preActions() { + if (_action.isAction(0x1AD) && (_action.isAction(0x321) || _action.isAction(0x322))) + _game._player._walkOffScreenSceneId = 551; +} + +void Scene501::actions() { + if (_action.isAction(0x36A, 0x324)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 1); + break; + + case 1: { + int syncIdx = _globals._sequenceIndexes[2]; + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], syncIdx); + _scene->_sequences.addTimer(15, 2); + } + break; + + case 2: + _game._player._visible = false; + if (_globals[kSexOfRex] == REX_MALE) + _mainSpriteId = _globals._spriteIndexes[6]; + else + _mainSpriteId = _globals._spriteIndexes[7]; + + _mainSequenceId = _scene->_sequences.addSpriteCycle(_mainSpriteId, false, 8, 1, 0, 0); + _scene->_sequences.setMsgLayout(_mainSequenceId); + _scene->_sequences.addSubEntry(_mainSequenceId, SEQUENCE_TRIGGER_EXPIRE, 0, 3); + break; + + case 3: { + int syncIdx = _mainSequenceId; + _mainSequenceId = _scene->_sequences.startCycle(_mainSpriteId, false, -2); + _scene->_sequences.setMsgLayout(_mainSequenceId); + _scene->_sequences.updateTimeout(_mainSequenceId, syncIdx); + _scene->_sequences.addTimer(30, 4); + } + break; + + case 4: + _scene->_nextSceneId = 504; + break; + + default: + break; + } + } else if (_action.isAction(VERB_PUT, 0x131, 0x251)) + _vm->_dialogs->show(50113); + else if (_action.isAction(VERB_PUT, 0x305, 0x251)) { + switch (_game._trigger) { + case 0: + case 1: + case 2: + case 3: + handleSlotActions(); + break; + + case 4: + if (_globals[kSexOfRex] == REX_MALE) { + _game._player._visible = false; + _vm->_sound->command(13); + _scene->loadAnimation(formAnimName('G', 1), 5); + } else { + _rexPunched = false; + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 6, 120, _game.getQuote(0x277)); + } + break; + + case 5: + _game._player._visible = true; + _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; + _scene->_sequences.addTimer(30, 6); + break; + + case 6: + if (_globals[kSexOfRex] == REX_MALE) { + if (_rexPunched) { + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x275)); + _rexPunched = false; + } else { + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x276)); + } + } + _game._player._stepEnabled = true; + break; + + default: + break; + } + } else if (_action.isAction(VERB_PUT, 0xB3, 0x251)) { + switch (_game._trigger) { + case 0: + case 1: + case 2: + case 3: + handleSlotActions(); + + case 4: + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _scene->_dynamicHotspots.remove(_doorHotspotid); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 9, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 7); + _vm->_sound->command(11); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 6); + break; + + case 6: + _game._player.walk(Common::Point(317, 102), FACING_NORTHEAST); + _scene->_sequences.addTimer(120, 7); + break; + + case 7: { + _vm->_sound->command(12); + int syncIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 9, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 7); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], syncIdx); + _vm->_sound->command(12); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 8); + } + break; + + case 8: { + int syncIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 7); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], syncIdx); + _scene->_nextSceneId = 503; + } + break; + + default: + break; + } + } else if ((_action._lookFlag) || _action.isAction(VERB_LOOK, 0x31E)) + _vm->_dialogs->show(50121); + else if (_action.isAction(VERB_LOOK, 0x6E)) + _vm->_dialogs->show(50110); + else if (_action.isAction(VERB_LOOK, 0x251)) + _vm->_dialogs->show(50112); + else if (_action.isAction(VERB_LOOK, 0x244)) + _vm->_dialogs->show(50114); + else if (_action.isAction(VERB_TAKE, 0x244)) + _vm->_dialogs->show(50115); + else if (_action.isAction(VERB_LOOK, 0x322)) + _vm->_dialogs->show(50118); + else if (_action.isAction(VERB_LOOK, 0x361) || _action.isAction(VERB_LOOK, 0x360) + || _action.isAction(0x1AD, 0x361) || _action.isAction(0x1AD, 0x360)) + _vm->_dialogs->show(50119); + else if (_action.isAction(VERB_LOOK, 0x323)) + _vm->_dialogs->show(50120); + else if (_action.isAction(VERB_OPEN, 0x6E)) + _vm->_dialogs->show(50122); + else if (_action.isAction(VERB_LOOK, 0x1E6)) + _vm->_dialogs->show(50123); + else if (_action.isAction(VERB_OPEN, 0x1E6)) + _vm->_dialogs->show(50124); + else if (_action.isAction(VERB_LOOK, 0x369)) + _vm->_dialogs->show(50125); + else if (_action.isAction(VERB_LOOK, 0x1FA) || _action.isAction(VERB_LOOK, 0x10C)) + _vm->_dialogs->show(50126); + else if (_action.isAction(VERB_LOOK, 0x324)) { + if (!_game._visitedScenes.exists(504)) + _vm->_dialogs->show(50116); + else + _vm->_dialogs->show(50117); + } else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + void Scene502::setup() { _game._player._spritesPrefix = ""; // The original is using Scene5xx_setAAName() @@ -132,12 +497,12 @@ void Scene502::actions() { else if (_action.isAction(VERB_LOOK, 0x1CC)) _vm->_dialogs->show(50212); else if (_action.isAction(VERB_LOOK, 0x1D0) || _action.isAction(VERB_LOOK, 0x1D1) - || _action.isAction(VERB_LOOK, 0x1D2) || _action.isAction(VERB_LOOK, 0x1D3) - || _action.isAction(VERB_LOOK, 0x1D4) || _action.isAction(VERB_LOOK, 0x1D5) - || _action.isAction(VERB_LOOK, 0x1D6) || _action.isAction(VERB_LOOK, 0x1D7) - || _action.isAction(VERB_LOOK, 0x1D8) || _action.isAction(VERB_LOOK, 0x1D9) - || _action.isAction(VERB_LOOK, 0x1DB) || _action.isAction(VERB_LOOK, 0x7A) - || _action.isAction(VERB_LOOK, 0x1DA)) + || _action.isAction(VERB_LOOK, 0x1D2) || _action.isAction(VERB_LOOK, 0x1D3) + || _action.isAction(VERB_LOOK, 0x1D4) || _action.isAction(VERB_LOOK, 0x1D5) + || _action.isAction(VERB_LOOK, 0x1D6) || _action.isAction(VERB_LOOK, 0x1D7) + || _action.isAction(VERB_LOOK, 0x1D8) || _action.isAction(VERB_LOOK, 0x1D9) + || _action.isAction(VERB_LOOK, 0x1DB) || _action.isAction(VERB_LOOK, 0x7A) + || _action.isAction(VERB_LOOK, 0x1DA)) _vm->_dialogs->show(50213); else if (_action.isAction(VERB_LOOK, 0x1CF) || _action._lookFlag) _vm->_dialogs->show(50214); diff --git a/engines/mads/nebular/nebular_scenes5.h b/engines/mads/nebular/nebular_scenes5.h index 562cfdfd76..e46207c09a 100644 --- a/engines/mads/nebular/nebular_scenes5.h +++ b/engines/mads/nebular/nebular_scenes5.h @@ -50,6 +50,26 @@ public: Scene5xx(MADSEngine *vm) : NebularScene(vm) {} }; +class Scene501: public Scene5xx{ +private: + int _mainSequenceId; + int _mainSpriteId; + int _doorHotspotid; + bool _rexPunched; + + void handleSlotActions(); + +public: + Scene501(MADSEngine *vm) : Scene5xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; + class Scene502: public SceneTeleporter { public: Scene502(MADSEngine *vm) : SceneTeleporter(vm) {} -- cgit v1.2.3 From 4571f3e3e40ac66070124f3370d50ea1af1da1ce Mon Sep 17 00:00:00 2001 From: anotherguest Date: Tue, 6 May 2014 09:11:41 +0200 Subject: SYMBIAN: Updated Symbian support, help text --- .../symbian/S60v3/ScummVM_A0000658_S60v3.mmp.in | 11 +- .../platform/symbian/S60v3/ScummVM_S60v3.mmp.in | 8 +- .../symbian/S60v3/scummvm-CVS-SymbianS60v3.pkg | 25 --- .../S60v3/scummvm-CVS-SymbianS60v3_split.pkg | 27 +-- backends/platform/symbian/help/ScummVM.rtf | 247 +++++++++++++-------- backends/platform/symbian/mmp/scummvm_agi.mmp.in | 14 +- backends/platform/symbian/mmp/scummvm_agos.mmp.in | 14 +- .../platform/symbian/mmp/scummvm_avalanche.mmp.in | 14 +- backends/platform/symbian/mmp/scummvm_base.mmp.in | 11 +- backends/platform/symbian/mmp/scummvm_cge.mmp.in | 14 +- backends/platform/symbian/mmp/scummvm_cine.mmp.in | 15 +- .../platform/symbian/mmp/scummvm_composer.mmp.in | 14 +- .../platform/symbian/mmp/scummvm_cruise.mmp.in | 15 +- backends/platform/symbian/mmp/scummvm_draci.mmp.in | 14 +- .../platform/symbian/mmp/scummvm_drascula.mmp.in | 15 +- .../platform/symbian/mmp/scummvm_dreamweb.mmp.in | 14 +- .../platform/symbian/mmp/scummvm_fullpipe.mmp.in | 14 +- backends/platform/symbian/mmp/scummvm_gob.mmp.in | 15 +- .../platform/symbian/mmp/scummvm_groovie.mmp.in | 14 +- .../platform/symbian/mmp/scummvm_hopkins.mmp.in | 14 +- backends/platform/symbian/mmp/scummvm_hugo.mmp.in | 14 +- backends/platform/symbian/mmp/scummvm_kyra.mmp.in | 15 +- .../symbian/mmp/scummvm_lastexpress.mmp.in | 14 +- backends/platform/symbian/mmp/scummvm_lure.mmp.in | 15 +- backends/platform/symbian/mmp/scummvm_m4.mmp.in | 14 +- backends/platform/symbian/mmp/scummvm_made.mmp.in | 15 +- .../platform/symbian/mmp/scummvm_mohawk.mmp.in | 14 +- .../symbian/mmp/scummvm_mortevielle.mmp.in | 14 +- .../platform/symbian/mmp/scummvm_neverhood.mmp.in | 14 +- .../symbian/mmp/scummvm_parallaction.mmp.in | 14 +- .../platform/symbian/mmp/scummvm_pegasus.mmp.in | 14 +- backends/platform/symbian/mmp/scummvm_queen.mmp.in | 15 +- backends/platform/symbian/mmp/scummvm_saga.mmp.in | 15 +- backends/platform/symbian/mmp/scummvm_sci.mmp.in | 14 +- backends/platform/symbian/mmp/scummvm_scumm.mmp.in | 9 +- backends/platform/symbian/mmp/scummvm_sky.mmp.in | 15 +- .../platform/symbian/mmp/scummvm_sword1.mmp.in | 15 +- .../platform/symbian/mmp/scummvm_sword2.mmp.in | 15 +- .../platform/symbian/mmp/scummvm_sword25.mmp.in | 14 +- .../platform/symbian/mmp/scummvm_teenagent.mmp.in | 14 +- .../platform/symbian/mmp/scummvm_testbed.mmp.in | 14 +- .../platform/symbian/mmp/scummvm_tinsel.mmp.in | 15 +- .../platform/symbian/mmp/scummvm_toltecs.mmp.in | 14 +- backends/platform/symbian/mmp/scummvm_tony.mmp.in | 14 +- backends/platform/symbian/mmp/scummvm_toon.mmp.in | 14 +- .../platform/symbian/mmp/scummvm_touche.mmp.in | 14 +- backends/platform/symbian/mmp/scummvm_tsage.mmp.in | 14 +- .../platform/symbian/mmp/scummvm_tucker.mmp.in | 14 +- .../platform/symbian/mmp/scummvm_wintermute.mmp.in | 14 +- .../platform/symbian/mmp/scummvm_zvision.mmp.in | 13 +- 50 files changed, 723 insertions(+), 229 deletions(-) diff --git a/backends/platform/symbian/S60v3/ScummVM_A0000658_S60v3.mmp.in b/backends/platform/symbian/S60v3/ScummVM_A0000658_S60v3.mmp.in index 7b9273f2dd..56456f37e4 100644 --- a/backends/platform/symbian/S60v3/ScummVM_A0000658_S60v3.mmp.in +++ b/backends/platform/symbian/S60v3/ScummVM_A0000658_S60v3.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -34,6 +34,9 @@ TARGET ScummVM_A0000658.exe TARGETPATH sys\bin TARGETTYPE exe OPTION GCCE -Wno-multichar -Wno-reorder -Wno-unused -Wno-format -fsigned-char +// fixes error "section .data loaded at [...] overlaps section .text loaded at [...]" +// in future simple add 'a' +LINKEROPTION GCCE -Tdata 0xAA00000 UID 0x100039ce 0xA0000658 @@ -90,9 +93,15 @@ STATICLIBRARY esdl.lib USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\engines USERINCLUDE ..\..\..\..\backends\fs ..\src ..\..\..\..\backends\platform\sdl ..\..\..\..\audio +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png SYSTEMINCLUDE \epoc32\include\ESDL SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor SYSTEMINCLUDE \epoc32\include SYSTEMINCLUDE \epoc32\include\mw SYSTEMINCLUDE \epoc32\include\platform diff --git a/backends/platform/symbian/S60v3/ScummVM_S60v3.mmp.in b/backends/platform/symbian/S60v3/ScummVM_S60v3.mmp.in index 09ff968706..0c0dd9b6b6 100644 --- a/backends/platform/symbian/S60v3/ScummVM_S60v3.mmp.in +++ b/backends/platform/symbian/S60v3/ScummVM_S60v3.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -90,9 +90,15 @@ STATICLIBRARY esdl.lib USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\engines USERINCLUDE ..\..\..\..\backends\fs ..\src ..\..\..\..\backends\platform\sdl ..\..\..\..\audio +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png SYSTEMINCLUDE \epoc32\include\ESDL SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor SYSTEMINCLUDE \epoc32\include SYSTEMINCLUDE \epoc32\include\mw SYSTEMINCLUDE \epoc32\include\platform diff --git a/backends/platform/symbian/S60v3/scummvm-CVS-SymbianS60v3.pkg b/backends/platform/symbian/S60v3/scummvm-CVS-SymbianS60v3.pkg index c04b7f6d51..5f74bee1c7 100644 --- a/backends/platform/symbian/S60v3/scummvm-CVS-SymbianS60v3.pkg +++ b/backends/platform/symbian/S60v3/scummvm-CVS-SymbianS60v3.pkg @@ -76,31 +76,6 @@ "..\..\..\vkeybd\packs\vkeybd_default.zip"-"c:\data\scummvm\vkeybd_default.zip" "..\..\..\..\gui\themes\translations.dat"-"c:\data\scummvm\translations.dat" "..\..\..\..\gui\themes\scummmodern.zip"-"c:\data\scummvm\scummmodern.zip" -"..\..\..\..\gui\themes\fonts\Arial.bdf"-"c:\data\scummvm\Arial.bdf" -"..\..\..\..\gui\themes\fonts\Arial12.bdf"-"c:\data\scummvm\Arial12.bdf" -"..\..\..\..\gui\themes\fonts\ArialBold.bdf"-"c:\data\scummvm\ArialBold.bdf" -"..\..\..\..\gui\themes\fonts\clR6x12-iso-8859-1.bdf"-"c:\data\scummvm\clR6x12-iso-8859-1.bdf" -"..\..\..\..\gui\themes\fonts\clR6x12-iso-8859-2.bdf"-"c:\data\scummvm\clR6x12-iso-8859-2.bdf" -"..\..\..\..\gui\themes\fonts\clR6x12-iso-8859-5.bdf"-"c:\data\scummvm\clR6x12-iso-8859-5.bdf" -"..\..\..\..\gui\themes\fonts\clR6x12-iso-8859-7.bdf"-"c:\data\scummvm\clR6x12-iso-8859-7.bdf" -"..\..\..\..\gui\themes\fonts\clR6x12.bdf"-"c:\data\scummvm\clR6x12.bdf" -"..\..\..\..\gui\themes\fonts\courr12-iso-8859-1.bdf"-"c:\data\scummvm\courr12-iso-8859-1.bdf" -"..\..\..\..\gui\themes\fonts\fixed5x8-iso-8859-1.bdf"-"c:\data\scummvm\fixed5x8-iso-8859-1.bdf" -"..\..\..\..\gui\themes\fonts\fixed5x8-iso-8859-5.bdf"-"c:\data\scummvm\fixed5x8-iso-8859-5.bdf" -"..\..\..\..\gui\themes\fonts\fixed5x8-iso-8859-7.bdf"-"c:\data\scummvm\fixed5x8-iso-8859-7.bdf" -"..\..\..\..\gui\themes\fonts\fixed5x8.bdf"-"c:\data\scummvm\fixed5x8.bdf" -"..\..\..\..\gui\themes\fonts\FreeMonoBold.ttf"-"c:\data\scummvm\FreeMonoBold.ttf" -"..\..\..\..\gui\themes\fonts\FreeSans.ttf"-"c:\data\scummvm\FreeSans.ttf" -"..\..\..\..\gui\themes\fonts\FreeSansBold.ttf"-"c:\data\scummvm\FreeSansBold.ttf" -"..\..\..\..\gui\themes\fonts\helvB12-iso-8859-1.bdf"-"c:\data\scummvm\helvB12-iso-8859-1.bdf" -"..\..\..\..\gui\themes\fonts\helvB12-iso-8859-2.bdf"-"c:\data\scummvm\helvB12-iso-8859-2.bdf" -"..\..\..\..\gui\themes\fonts\helvB12-iso-8859-5.bdf"-"c:\data\scummvm\helvB12-iso-8859-5.bdf" -"..\..\..\..\gui\themes\fonts\helvB12.bdf"-"c:\data\scummvm\helvB12.bdf" -"..\..\..\..\gui\themes\fonts\helvBO12-iso-8859-1.bdf"-"c:\data\scummvm\helvBO12-iso-8859-1.bdf" -"..\..\..\..\gui\themes\fonts\helvBO12.bdf"-"c:\data\scummvm\helvBO12.bdf" -"..\..\..\..\gui\themes\fonts\helvR12-iso-8859-1.bdf"-"c:\data\scummvm\helvR12-iso-8859-1.bdf" -"..\..\..\..\gui\themes\fonts\helvR12.bdf"-"c:\data\scummvm\helvR12.bdf" -;"..\..\..\..\gui\themes\"-"c:\data\scummvm\" ; Config/log files: 'empty' will automagically be removed on uninstall ""-"c:\data\scummvm\scummvm.ini",FILENULL diff --git a/backends/platform/symbian/S60v3/scummvm-CVS-SymbianS60v3_split.pkg b/backends/platform/symbian/S60v3/scummvm-CVS-SymbianS60v3_split.pkg index 250076347a..4ef085d600 100644 --- a/backends/platform/symbian/S60v3/scummvm-CVS-SymbianS60v3_split.pkg +++ b/backends/platform/symbian/S60v3/scummvm-CVS-SymbianS60v3_split.pkg @@ -36,7 +36,7 @@ :"ScummVM" ; UID is the app's UID -#{"ScummVM S60v3"},(0xA0000657),1,70,0 +#{"ScummVM S60v3"},(0xA0000657),1,70,6 ;Supports Series 60 v 3.0 [0x101F7961], 0, 0, 0, {"Series60ProductID"} @@ -84,31 +84,6 @@ "..\..\..\vkeybd\packs\vkeybd_default.zip"-"c:\data\scummvm\vkeybd_default.zip" "..\..\..\..\gui\themes\translations.dat"-"c:\data\scummvm\translations.dat" "..\..\..\..\gui\themes\scummmodern.zip"-"c:\data\scummvm\scummmodern.zip" -"..\..\..\..\gui\themes\fonts\Arial.bdf"-"c:\data\scummvm\Arial.bdf" -"..\..\..\..\gui\themes\fonts\Arial12.bdf"-"c:\data\scummvm\Arial12.bdf" -"..\..\..\..\gui\themes\fonts\ArialBold.bdf"-"c:\data\scummvm\ArialBold.bdf" -"..\..\..\..\gui\themes\fonts\clR6x12-iso-8859-1.bdf"-"c:\data\scummvm\clR6x12-iso-8859-1.bdf" -"..\..\..\..\gui\themes\fonts\clR6x12-iso-8859-2.bdf"-"c:\data\scummvm\clR6x12-iso-8859-2.bdf" -"..\..\..\..\gui\themes\fonts\clR6x12-iso-8859-5.bdf"-"c:\data\scummvm\clR6x12-iso-8859-5.bdf" -"..\..\..\..\gui\themes\fonts\clR6x12-iso-8859-7.bdf"-"c:\data\scummvm\clR6x12-iso-8859-7.bdf" -"..\..\..\..\gui\themes\fonts\clR6x12.bdf"-"c:\data\scummvm\clR6x12.bdf" -"..\..\..\..\gui\themes\fonts\courr12-iso-8859-1.bdf"-"c:\data\scummvm\courr12-iso-8859-1.bdf" -"..\..\..\..\gui\themes\fonts\fixed5x8-iso-8859-1.bdf"-"c:\data\scummvm\fixed5x8-iso-8859-1.bdf" -"..\..\..\..\gui\themes\fonts\fixed5x8-iso-8859-5.bdf"-"c:\data\scummvm\fixed5x8-iso-8859-5.bdf" -"..\..\..\..\gui\themes\fonts\fixed5x8-iso-8859-7.bdf"-"c:\data\scummvm\fixed5x8-iso-8859-7.bdf" -"..\..\..\..\gui\themes\fonts\fixed5x8.bdf"-"c:\data\scummvm\fixed5x8.bdf" -"..\..\..\..\gui\themes\fonts\FreeMonoBold.ttf"-"c:\data\scummvm\FreeMonoBold.ttf" -"..\..\..\..\gui\themes\fonts\FreeSans.ttf"-"c:\data\scummvm\FreeSans.ttf" -"..\..\..\..\gui\themes\fonts\FreeSansBold.ttf"-"c:\data\scummvm\FreeSansBold.ttf" -"..\..\..\..\gui\themes\fonts\helvB12-iso-8859-1.bdf"-"c:\data\scummvm\helvB12-iso-8859-1.bdf" -"..\..\..\..\gui\themes\fonts\helvB12-iso-8859-2.bdf"-"c:\data\scummvm\helvB12-iso-8859-2.bdf" -"..\..\..\..\gui\themes\fonts\helvB12-iso-8859-5.bdf"-"c:\data\scummvm\helvB12-iso-8859-5.bdf" -"..\..\..\..\gui\themes\fonts\helvB12.bdf"-"c:\data\scummvm\helvB12.bdf" -"..\..\..\..\gui\themes\fonts\helvBO12-iso-8859-1.bdf"-"c:\data\scummvm\helvBO12-iso-8859-1.bdf" -"..\..\..\..\gui\themes\fonts\helvBO12.bdf"-"c:\data\scummvm\helvBO12.bdf" -"..\..\..\..\gui\themes\fonts\helvR12-iso-8859-1.bdf"-"c:\data\scummvm\helvR12-iso-8859-1.bdf" -"..\..\..\..\gui\themes\fonts\helvR12.bdf"-"c:\data\scummvm\helvR12.bdf" -;"..\..\..\..\gui\themes\"-"c:\data\scummvm\" ; Config/log files: 'empty' will automagically be removed on uninstall ""-"c:\data\scummvm\scummvm.ini",FILENULL diff --git a/backends/platform/symbian/help/ScummVM.rtf b/backends/platform/symbian/help/ScummVM.rtf index 522fab832c..4b5ae5afe0 100644 --- a/backends/platform/symbian/help/ScummVM.rtf +++ b/backends/platform/symbian/help/ScummVM.rtf @@ -1,16 +1,16 @@ -{\rtf1\ansi\ansicpg1251\uc1 \deff0\deflang1049\deflangfe1049{\fonttbl{\f0\froman\fcharset204\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f1\fswiss\fcharset204\fprq2{\*\panose 020b0604020202020204}Arial;} +{\rtf1\ansi\ansicpg1251\uc1 \deff1\deflang1049\deflangfe1049{\fonttbl{\f0\froman\fcharset204\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f1\fswiss\fcharset204\fprq2{\*\panose 020b0604020202020204}Arial;} {\f2\fmodern\fcharset204\fprq1{\*\panose 02070309020205020404}Courier New;}{\f3\froman\fcharset2\fprq2{\*\panose 05050102010706020507}Symbol;}{\f8\froman\fcharset0\fprq2{\*\panose 00000000000000000000}Tms Rmn;} {\f14\fnil\fcharset2\fprq2{\*\panose 05000000000000000000}Wingdings;}{\f28\fswiss\fcharset204\fprq2{\*\panose 020b0604020202020204}Arial CYR;}{\f29\fmodern\fcharset204\fprq1{\*\panose 02070309020205020404}Courier New CYR;} -{\f43\froman\fcharset2\fprq2{\*\panose 05030102010509060703}Webdings;}{\f97\fswiss\fcharset204\fprq2{\*\panose 020b0506020202030204}Arial Narrow;}{\f109\froman\fcharset0\fprq2 Times New Roman;}{\f107\froman\fcharset238\fprq2 Times New Roman CE;} -{\f110\froman\fcharset161\fprq2 Times New Roman Greek;}{\f111\froman\fcharset162\fprq2 Times New Roman Tur;}{\f112\froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f113\froman\fcharset178\fprq2 Times New Roman (Arabic);} -{\f114\froman\fcharset186\fprq2 Times New Roman Baltic;}{\f117\fswiss\fcharset0\fprq2 Arial;}{\f115\fswiss\fcharset238\fprq2 Arial CE;}{\f118\fswiss\fcharset161\fprq2 Arial Greek;}{\f119\fswiss\fcharset162\fprq2 Arial Tur;} -{\f120\fswiss\fcharset177\fprq2 Arial (Hebrew);}{\f121\fswiss\fcharset178\fprq2 Arial (Arabic);}{\f122\fswiss\fcharset186\fprq2 Arial Baltic;}{\f125\fmodern\fcharset0\fprq1 Courier New;}{\f123\fmodern\fcharset238\fprq1 Courier New CE;} -{\f126\fmodern\fcharset161\fprq1 Courier New Greek;}{\f127\fmodern\fcharset162\fprq1 Courier New Tur;}{\f128\fmodern\fcharset177\fprq1 Courier New (Hebrew);}{\f129\fmodern\fcharset178\fprq1 Courier New (Arabic);} -{\f130\fmodern\fcharset186\fprq1 Courier New Baltic;}{\f333\fswiss\fcharset0\fprq2 Arial CYR;}{\f331\fswiss\fcharset238\fprq2 Arial CYR CE;}{\f334\fswiss\fcharset161\fprq2 Arial CYR Greek;}{\f335\fswiss\fcharset162\fprq2 Arial CYR Tur;} -{\f336\fswiss\fcharset177\fprq2 Arial CYR (Hebrew);}{\f337\fswiss\fcharset178\fprq2 Arial CYR (Arabic);}{\f338\fswiss\fcharset186\fprq2 Arial CYR Baltic;}{\f341\fmodern\fcharset0\fprq1 Courier New CYR;}{\f339\fmodern\fcharset238\fprq1 Courier New CYR CE;} -{\f342\fmodern\fcharset161\fprq1 Courier New CYR Greek;}{\f343\fmodern\fcharset162\fprq1 Courier New CYR Tur;}{\f344\fmodern\fcharset177\fprq1 Courier New CYR (Hebrew);}{\f345\fmodern\fcharset178\fprq1 Courier New CYR (Arabic);} -{\f346\fmodern\fcharset186\fprq1 Courier New CYR Baltic;}{\f885\fswiss\fcharset0\fprq2 Arial Narrow;}{\f883\fswiss\fcharset238\fprq2 Arial Narrow CE;}{\f886\fswiss\fcharset161\fprq2 Arial Narrow Greek;}{\f887\fswiss\fcharset162\fprq2 Arial Narrow Tur;} -{\f890\fswiss\fcharset186\fprq2 Arial Narrow Baltic;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255; +{\f30\froman\fcharset2\fprq2{\*\panose 05030102010509060703}Webdings;}{\f31\fswiss\fcharset204\fprq2{\*\panose 020b0506020202030204}Arial Narrow;}{\f44\froman\fcharset0\fprq2 Times New Roman;}{\f42\froman\fcharset238\fprq2 Times New Roman CE;} +{\f45\froman\fcharset161\fprq2 Times New Roman Greek;}{\f46\froman\fcharset162\fprq2 Times New Roman Tur;}{\f47\froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f48\froman\fcharset178\fprq2 Times New Roman (Arabic);} +{\f49\froman\fcharset186\fprq2 Times New Roman Baltic;}{\f52\fswiss\fcharset0\fprq2 Arial;}{\f50\fswiss\fcharset238\fprq2 Arial CE;}{\f53\fswiss\fcharset161\fprq2 Arial Greek;}{\f54\fswiss\fcharset162\fprq2 Arial Tur;} +{\f55\fswiss\fcharset177\fprq2 Arial (Hebrew);}{\f56\fswiss\fcharset178\fprq2 Arial (Arabic);}{\f57\fswiss\fcharset186\fprq2 Arial Baltic;}{\f60\fmodern\fcharset0\fprq1 Courier New;}{\f58\fmodern\fcharset238\fprq1 Courier New CE;} +{\f61\fmodern\fcharset161\fprq1 Courier New Greek;}{\f62\fmodern\fcharset162\fprq1 Courier New Tur;}{\f63\fmodern\fcharset177\fprq1 Courier New (Hebrew);}{\f64\fmodern\fcharset178\fprq1 Courier New (Arabic);} +{\f65\fmodern\fcharset186\fprq1 Courier New Baltic;}{\f268\fswiss\fcharset0\fprq2 Arial CYR;}{\f266\fswiss\fcharset238\fprq2 Arial CYR CE;}{\f269\fswiss\fcharset161\fprq2 Arial CYR Greek;}{\f270\fswiss\fcharset162\fprq2 Arial CYR Tur;} +{\f271\fswiss\fcharset177\fprq2 Arial CYR (Hebrew);}{\f272\fswiss\fcharset178\fprq2 Arial CYR (Arabic);}{\f273\fswiss\fcharset186\fprq2 Arial CYR Baltic;}{\f276\fmodern\fcharset0\fprq1 Courier New CYR;}{\f274\fmodern\fcharset238\fprq1 Courier New CYR CE;} +{\f277\fmodern\fcharset161\fprq1 Courier New CYR Greek;}{\f278\fmodern\fcharset162\fprq1 Courier New CYR Tur;}{\f279\fmodern\fcharset177\fprq1 Courier New CYR (Hebrew);}{\f280\fmodern\fcharset178\fprq1 Courier New CYR (Arabic);} +{\f281\fmodern\fcharset186\fprq1 Courier New CYR Baltic;}{\f292\fswiss\fcharset0\fprq2 Arial Narrow;}{\f290\fswiss\fcharset238\fprq2 Arial Narrow CE;}{\f293\fswiss\fcharset161\fprq2 Arial Narrow Greek;}{\f294\fswiss\fcharset162\fprq2 Arial Narrow Tur;} +{\f297\fswiss\fcharset186\fprq2 Arial Narrow Baltic;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255; \red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{ \ql \li0\ri0\sa120\widctlpar\nooverflow\faroman\rin0\lin0\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \snext0 Normal;}{\s1\ql \li0\ri0\sb360\sa240\keepn\widctlpar\nooverflow\faroman\rin0\lin0\itap0 \b\f1\fs32\lang2057\langfe1033\kerning28\cgrid\langnp2057\langfenp1033 \sbasedon0 \snext0 heading 1;}{\s2\ql \li0\ri0\sb120\sa120\keepn\widctlpar\brdrt\brdrs\brdrw30\brsp20 \brdrb\brdrs\brdrw30\brsp20 \tqr\tx9072\nooverflow\faroman\rin0\lin0\itap0 @@ -22,14 +22,14 @@ heading 5;}{\s6\ql \li0\ri0\sb240\sa60\widctlpar\nooverflow\faroman\rin0\lin0\it \s9\ql \li0\ri0\sb240\sa60\widctlpar\nooverflow\faroman\rin0\lin0\itap0 \i\f1\fs18\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon0 \snext0 heading 9;}{\*\cs10 \additive Default Paragraph Font;}{\*\cs15 \additive \b\f1\fs20 \sbasedon10 App Text;}{\s16\ql \li0\ri0\sb360\sa240\keepn\widctlpar\nooverflow\faroman\rin0\lin0\itap0 \b\f1\fs32\cf9\lang2057\langfe1033\kerning28\cgrid\langnp2057\langfenp1033 \sbasedon0 \snext16 Category UID;}{ \s17\ql \li0\ri0\sa120\widctlpar\nooverflow\faroman\rin0\lin0\itap0 \i\f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon0 \snext17 Comment;}{\s18\ql \fi-283\li283\ri0\sa120\widctlpar\brdrb\brdrs\brdrw15\brsp20 {\*\pn -\pnlvlblt\ilvl10\ls2047\pnrnot0\pnf43\pnstart1\pnindent283\pnhang{\pntxtb \'a2}}\nooverflow\faroman\ls2047\ilvl10\rin0\lin283\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon0 \snext18 Context;}{\*\cs19 \additive +\pnlvlblt\ilvl10\ls2047\pnrnot0\pnf30\pnstart1\pnindent283\pnhang{\pntxtb \'a2}}\nooverflow\faroman\ls2047\ilvl10\rin0\lin283\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon0 \snext18 Context;}{\*\cs19 \additive \i\f1\fs20\ulnone\cf0\nosupersub \sbasedon10 Context Comment;}{\s20\ql \li0\ri0\sa120\widctlpar\nooverflow\faroman\rin0\lin0\itap0 \f1\fs20\cf11\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon0 \snext20 Definition Term;}{ -\s21\ql \li0\ri0\sa120\widctlpar\nooverflow\faroman\rin0\lin0\itap0 \f1\fs20\cf11\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon20 \snext21 Definition Definition;}{\*\cs22 \additive \scaps\f97\fs20\cf13 \sbasedon10 Graphic Link;}{ +\s21\ql \li0\ri0\sa120\widctlpar\nooverflow\faroman\rin0\lin0\itap0 \f1\fs20\cf11\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon20 \snext21 Definition Definition;}{\*\cs22 \additive \scaps\f31\fs20\cf13 \sbasedon10 Graphic Link;}{ \s23\ql \fi-283\li283\ri0\sa120\widctlpar{\*\pn \pnlvlblt\ilvl10\ls2047\pnrnot0\pnf14\pnstart1\pnindent283\pnhang{\pntxtb F}}\nooverflow\faroman\ls2047\ilvl10\rin0\lin283\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon0 \snext23 Tip;}{\s24\ql \fi-283\li283\ri0\sa120\widctlpar{\*\pn \pnlvlblt\ilvl10\ls2047\pnrnot0\pnf14\pnstart1\pnindent283\pnhang{\pntxtb ?}}\nooverflow\faroman\ls2047\ilvl10\rin0\lin283\itap0 -\f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon23 \snext24 Note;}{\s25\ql \fi-283\li283\ri0\sa120\widctlpar{\*\pn \pnlvlblt\ilvl10\ls2047\pnrnot0\pnf43\pnstart1\pnindent283\pnhang{\pntxtb ~}} +\f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon23 \snext24 Note;}{\s25\ql \fi-283\li283\ri0\sa120\widctlpar{\*\pn \pnlvlblt\ilvl10\ls2047\pnrnot0\pnf30\pnstart1\pnindent283\pnhang{\pntxtb ~}} \nooverflow\faroman\ls2047\ilvl10\rin0\lin283\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon24 \snext25 Important;}{\s26\ql \fi-283\li283\ri0\sa120\widctlpar\brdrb\brdrs\brdrw15\brsp20 {\*\pn \pnlvlblt\ilvl10\ls2047\pnrnot0 -\pnf43\pnstart1\pnindent283\pnhang{\pntxtb i}}\nooverflow\faroman\ls2047\ilvl10\rin0\lin283\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon0 \snext26 Index;}{\*\cs27 \additive \b\f2\fs20 \sbasedon10 Key Name;}{ +\pnf30\pnstart1\pnindent283\pnhang{\pntxtb i}}\nooverflow\faroman\ls2047\ilvl10\rin0\lin283\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon0 \snext26 Index;}{\*\cs27 \additive \b\f2\fs20 \sbasedon10 Key Name;}{ \s28\ql \fi-284\li284\ri0\sa120\widctlpar{\*\pn \pnlvlbody\ilvl11\ls2047\pnrnot0\pndec\pnstart1\pnindent283\pnhang{\pntxta .}}\nooverflow\faroman\ls2047\ilvl11\rin0\lin284\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon0 \snext28 List Number;}{\s29\ql \fi-284\li284\ri0\sa120\widctlpar\tx284{\*\pn \pnlvlbody\ilvl0\ls2047\pnrnot0\pndec\pnf8 }\nooverflow\faroman\ls2047\rin0\lin284\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 \sbasedon28 \snext29 List Manual;}{\s30\ql \fi-284\li568\ri0\sa120\widctlpar{\*\pn \pnlvlbody\ilvl11\ls2047\pnrnot0\pndec\pnstart1\pnindent283\pnhang{\pntxta .}}\nooverflow\faroman\ls2047\ilvl11\rin0\lin568\itap0 @@ -44,34 +44,43 @@ Synonyms;}{\*\cs33 \additive \super \sbasedon10 endnote reference;}{\s34\ql \fi- {\list\listtemplateid1907811784\listsimple{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'01\u-3913 ?;}{\levelnumbers;}\f3\chbrdr\brdrnone\brdrcf1 \chshdng0\chcfpat1\chcbpat1\fbias0 \fi-360\li643\jclisttab\tx643 }{\listname ;}\listid-125}{\list\listtemplateid1912741052\listsimple{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0{\leveltext\'02\'00.;}{\levelnumbers\'01;}\chbrdr \brdrnone\brdrcf1 \chshdng0\chcfpat1\chcbpat1 \fi-360\li360\jclisttab\tx360 }{\listname ;}\listid-120}{\list\listtemplateid-51363132\listsimple{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0 -{\leveltext\'01\u-3913 ?;}{\levelnumbers;}\f3\chbrdr\brdrnone\brdrcf1 \chshdng0\chcfpat1\chcbpat1\fbias0 \fi-360\li360\jclisttab\tx360 }{\listname ;}\listid-119}}{\*\listoverridetable{\listoverride\listid-120\listoverridecount0\ls1} -{\listoverride\listid-129\listoverridecount0\ls2}{\listoverride\listid-119\listoverridecount0\ls3}{\listoverride\listid-125\listoverridecount0\ls4}}{\info{\author Fedor}{\operator Fedor}{\creatim\yr2013\mo11\dy30\hr23\min4} -{\revtim\yr2013\mo11\dy30\hr23\min24}{\version4}{\edmins20}{\nofpages7}{\nofwords1441}{\nofchars8219}{\*\company DEV}{\nofcharsws10093}{\vern8249}}\margl1701\margr850\margt1134\margb1134 -\deftab708\widowctrl\ftnbj\aenddoc\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\hyphcaps0\horzdoc\dghspace120\dgvspace120\dghorigin1701\dgvorigin1984\dghshow0\dgvshow3\jcompress\viewkind4\viewscale100\nolnhtadjtbl \fet0\sectd -\linex0\sectdefaultcl {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang -{\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl8 -\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}\pard\plain \s17\ql \li0\ri0\sa120\widctlpar\nooverflow\faroman\rin0\lin0\itap0 -\i\f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\lang1033\langfe1033\langnp1033 Author: Fedor Strizhniou.}{\f28 +{\leveltext\'01\u-3913 ?;}{\levelnumbers;}\f3\chbrdr\brdrnone\brdrcf1 \chshdng0\chcfpat1\chcbpat1\fbias0 \fi-360\li360\jclisttab\tx360 }{\listname ;}\listid-119}{\list\listtemplateid947971744\listsimple{\listlevel\levelnfc0\levelnfcn0\leveljc0\leveljcn0 +\levelfollow0\levelstartat0\levelspace0\levelindent0{\leveltext\'01*;}{\levelnumbers;}\chbrdr\brdrnone\brdrcf1 \chshdng0\chcfpat1\chcbpat1 }{\listname ;}\listid-2}}{\*\listoverridetable{\listoverride\listid-120\listoverridecount0\ls1} +{\listoverride\listid-129\listoverridecount0\ls2}{\listoverride\listid-119\listoverridecount0\ls3}{\listoverride\listid-125\listoverridecount0\ls4}{\listoverride\listid-120\listoverridecount0\ls5}{\listoverride\listid-129\listoverridecount0\ls6} +{\listoverride\listid-119\listoverridecount0\ls7}{\listoverride\listid-125\listoverridecount0\ls8}{\listoverride\listid-120\listoverridecount0\ls9}{\listoverride\listid-129\listoverridecount0\ls10}{\listoverride\listid-119\listoverridecount0\ls11} +{\listoverride\listid-125\listoverridecount0\ls12}{\listoverride\listid-120\listoverridecount0\ls13}{\listoverride\listid-129\listoverridecount0\ls14}{\listoverride\listid-119\listoverridecount0\ls15}{\listoverride\listid-125\listoverridecount0\ls16} +{\listoverride\listid-2\listoverridecount1{\lfolevel\listoverrideformat{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelold\levelspace0\levelindent283{\leveltext\'01\u-3991 ?;}{\levelnumbers;}\f30\chbrdr +\brdrnone\brdrcf1 \chshdng0\chcfpat1\chcbpat1\fbias0 \fi-283\li283 }}\ls17}{\listoverride\listid-2\listoverridecount1{\lfolevel\listoverrideformat{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelold\levelspace0 +\levelindent283{\leveltext\'01\u-3991 ?;}{\levelnumbers;}\f30\chbrdr\brdrnone\brdrcf1 \chshdng0\chcfpat1\chcbpat1\fbias0 \fi-283\li283 }}\ls18}}{\info{\author Fedor}{\operator Fedor}{\creatim\yr2013\mo11\dy30\hr23\min4} +{\revtim\yr2013\mo12\dy14\hr12\min27}{\version95}{\edmins91}{\nofpages8}{\nofwords1514}{\nofchars8634}{\*\company DEV}{\nofcharsws0}{\vern8249}}\margl1701\margr850\margt1134\margb1134 +\deftab708\widowctrl\ftnbj\aenddoc\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\hyphcaps0\horzdoc\dghspace120\dgvspace120\dghorigin1701\dgvorigin1984\dghshow0\dgvshow3\jcompress\viewkind4\viewscale100\nolnhtadjtbl \fet0{\*\template +E:\\Documents and Settings\\Administrator\\Application Data\\Microsoft\\\'d8\'e0\'e1\'eb\'ee\'ed\'fb\\cshelp2000.dot}\sectd \linex0\sectdefaultcl {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang +{\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang{\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang{\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang +{\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}\pard\plain +\s17\ql \li0\ri0\sa120\widctlpar\nooverflow\faroman\rin0\lin0\itap0 \i\f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\lang1033\langfe1033\langnp1033 Author: Fedor Strizhniou.}{\f28 \par }{\lang1033\langfe1033\langnp1033 Date: November 2013}{\f28 \par }{\lang1033\langfe1033\langnp1033 Version: 1.7.0 \par }\pard\plain \s1\ql \li0\ri0\sb360\sa240\keepn\widctlpar\nooverflow\faroman\outlinelevel0\rin0\lin0\itap0 \b\f1\fs32\lang2057\langfe1033\kerning28\cgrid\langnp2057\langfenp1033 {ScummVM Help \par }\pard\plain \s16\ql \li0\ri0\sb360\sa240\keepn\widctlpar\nooverflow\faroman\rin0\lin0\itap0 \b\f1\fs32\cf9\lang2057\langfe1033\kerning28\cgrid\langnp2057\langfenp1033 {\lang1033\langfe1033\langnp1033 0x100039ce}{\lang1059\langfe1033\langnp1059 \par }\pard\plain \ql \li0\ri0\sa120\widctlpar\nooverflow\faroman\rin0\lin0\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\f28 -\par }\pard\plain \s2\ql \li0\ri0\sb120\sa120\keepn\widctlpar\brdrt\brdrs\brdrw30\brsp20 \brdrb\brdrs\brdrw30\brsp20 \tqr\tx9072\nooverflow\faroman\outlinelevel1\rin0\lin0\itap0 \b\f1\fs24\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\b0\f28 Introduction - -\par }\pard\plain \ql \li0\ri0\sa120\widctlpar\nooverflow\faroman\rin0\lin0\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\f28 +\par }\pard\plain \s2\ql \li0\ri0\sb120\sa120\keepn\widctlpar\brdrt\brdrs\brdrw30\brsp20 \brdrb\brdrs\brdrw30\brsp20 \tqr\tx9072\nooverflow\faroman\outlinelevel1\rin0\lin0\itap0 \b\f1\fs24\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\b0\f28 +About ScummVM Help +\par {\pntext\pard\plain\s26 \f30\fs20\lang2057\langfe1033\langnp2057\langfenp1033 \loch\af30\dbch\af0\hich\f30 \'69\tab}}\pard\plain \s26\ql \fi-283\li283\ri0\sa120\widctlpar\brdrb\brdrs\brdrw15\brsp20 {\*\pn \pnlvlblt\ilvl0\ls17\pnrnot0 +\pnf30\pnstart1\pnindent283\pnhang{\pntxtb i}}\nooverflow\faroman\ls17\rin0\lin283\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {About ScummVM Help +\par }\pard\plain \ql \li0\ri0\sa120\widctlpar{\*\pn \pnlvlcont\ilvl0\ls0\pnrnot0\pndec }\nooverflow\faroman\rin0\lin0\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\f28 +\par }{ +This help file based on ScummVM forum thread with some elaborations(in Anotherguest section) and text correction. If you wish add some text or translate you may download and modify source document from https://sourceforge.net/projects/scummvms60git/ and t +hen send me to fedor_qd@mail.ru +\par Feel free to replace, merge or write you own instead 1st, 2nd and 3rd guides. Other sections require strict translations. And don\rquote t forget add your name :-) +\par First guide contain help by Anotherguest, second - VincentJ, third - murgo. This doc created by Fedor Strizhniou. +\par Enjoys, cheers! Always yours =)}{\lang1059\langfe1033\langnp1059 \par }{\f29 -This help file based on ScummVM forum thread with some elaborations(in Anotherguest section) and text correction. If you wish add some text you may download and modify source document from https://sourceforge.net/projects/scummvms60git/ and then send me t -o fedor_qd@mail.ru -\par First guide contain help by Anotherguest, second - VincentJ, third - murgo. -\par Enjoys, cheers! Always yous, Fedor Strizhniou =)}{\f29\lang1059\langfe1033\langnp1059 -\par }{\f29 -\par }\pard\plain \s2\ql \li0\ri0\sb120\sa120\keepn\widctlpar\brdrt\brdrs\brdrw30\brsp20 \brdrb\brdrs\brdrw30\brsp20 \tqr\tx9072\nooverflow\faroman\outlinelevel1\rin0\lin0\itap0 \b\f1\fs24\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\b0\f28 First guide - -\par }\pard\plain \s32\ql \li0\ri0\sa120\widctlpar\nooverflow\faroman\rin0\lin0\itap0 \f1\fs20\cf13\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {Controls, Virtual keyboard, Shortcuts, ScummVM, Tips, S60, UIQ, UIQ3, S80, s80, S90, s90 -\par }\pard\plain \ql \li0\ri0\sa120\widctlpar\nooverflow\faroman\rin0\lin0\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\f28 -\par -\par }{\f29 UIQ3 devices: To the top right (holding the phone portrait) you four icons, from the top they are +\par }\pard\plain \s2\ql \li0\ri0\sb120\sa120\keepn\widctlpar\brdrt\brdrs\brdrw30\brsp20 \brdrb\brdrs\brdrw30\brsp20 \tqr\tx9072{\*\pn \pnlvlcont\ilvl0\ls0\pnrnot0\pndec }\nooverflow\faroman\outlinelevel1\rin0\lin0\itap0 +\b\f1\fs24\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\b0\f28 1st guide +\par {\pntext\pard\plain\s26 \f30\fs20\lang2057\langfe1033\langnp2057\langfenp1033 \loch\af30\dbch\af0\hich\f30 \'69\tab}}\pard\plain \s26\ql \fi-283\li283\ri0\sa120\widctlpar\brdrb\brdrs\brdrw15\brsp20 {\*\pn \pnlvlblt\ilvl0\ls17\pnrnot0 +\pnf30\pnstart1\pnindent283\pnhang{\pntxtb i}}\nooverflow\faroman\ls17\rin0\lin283\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {Controls, Virtual keyboard, Shortcuts, ScummVM, Tips, S60, UIQ, UIQ3, S80, s80, S90, s90 +\par }\pard\plain \ql \li0\ri0\sa120\widctlpar{\*\pn \pnlvlcont\ilvl0\ls0\pnrnot0\pndec }\nooverflow\faroman\rin0\lin0\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\f28 +\par }{UIQ3 devices: To the top right (holding the phone portrait) you four icons, from the top they are \par \par * Toggle control mode, in control mode you can change text input , screen orientation and screen scaling \par * Mouse button, toggles between left, right and no button when tapping the screen. If no button is selected, 7 & Space works as left mouse button and 9 & Enter works as the right mouse button. @@ -81,11 +90,11 @@ o fedor_qd@mail.ru \par * Enter key \par * Backspace \par * Arrow Up/Down to scroll the keys available -\par * Virtual keyboard, tap letters to simulate keypresses. +\par * Virtual keyboard, tap letters to simulate key presses. \par \par S60 and UIQ3 devices: (Control Key = Green Phone key, to activate/deactivate control mode in SDL) -\par -\par * 1 = change Input Mode: Joystick | Keyboard | Cursor +\par }{\f29 +\par }{* 1 = change Input Mode: Joystick | Keyboard | Cursor \par * 2,'p' = change Video Mode: Landscape | Portrait \par * 3,'f' = change Orientation Mode for Landscape: 90\'b0 Left | 90\'b0 Right \par * 4,'s' = Toggle between stretched and non-stretched modes @@ -95,7 +104,7 @@ o fedor_qd@mail.ru \par * 9,'j' = Joystick input \par * 0,'m' = Mouse input \par * Up/Down = Alter global volume when not in 1-1 VGA mode. Pan around in VGA 1-1 Mode -\par * # = On/Off screen keyboard transparency +\par * # = On/Off screen keyboard transparency in some games \par \par S80 devices: \par @@ -110,65 +119,65 @@ o fedor_qd@mail.ru \par \par What are these Joystick, Keyboard and Cursor modes anyway? \par }{\f28 -\par }{\f29 Joystick mode sends SDL joystick events to ScummVM which acts as a mouse control in ScummVM. Cursor mod -e sends keyboard arrows instead, so for example it can be used to navigate through directorylist (one hand use perhaps!?) or save games etc. Keyboard mode is only available for S60 and enables multi-tap to enter text characters in save dialogs. These mode -s are implemented at the underlying SDL level, so this determines the types of events that ScummVM receives from SDL. +\par }{Joystick mode sends SDL joystick events to ScummVM which acts as a mouse control in ScummVM. Cursor mode sends keyboard arrows instead, so for example it can be used to navigate +through directorylist (one hand use perhaps!?) or save games etc. Keyboard mode is only available for S60 and enables multi-tap to enter text characters in save dialogs. These modes are implemented at the underlying SDL level, so this determines the types + of events that ScummVM receives from SDL. \par What are these Shrinked, Zoomed and Upscaled modes anyway? \par -\par Shrink displays the game on your screen but in a shrinked way, either in Portra -it or Landscape mode, so not all the pixels can be seen. Zoom mode uses the maximum resolution of your phone displaying a smaller part of the game zoomed at 1:1 pixels. For scrolling in S60 Zoom mode: 0+Cursor keys to scroll around, 0+Ok button to center -view. Upscale tries to fill the larger screens on S80/S90 devices in a better way for low resolution games. Currently it uses a pixel interpolation upscaling routine. +\par Shrink displays the game on your screen but in a shrinked way, either in Portrait or Landscape mode, so not all the pixels can be seen. Zoom mode uses the maximum resolution of your phone displaying a smaller part of the game zoomed at 1:1 pixels. For scr +olling in S60 Zoom mode: 0+Cursor keys to scroll around, 0+Ok button to center view. Upscale tries to fill the larger screens on S80/S90 devices in a better way for low resolution games. Currently it uses a pixel interpolation upscaling routine. \par \par You can also use a bluetooth mouse with S60v3 devices to control your game. You need the bluetooth hid library from Hinkka http://koti.mbnet.fi/hinkka/Download.html to get it to work properly. +\par }{\f29 \par +\par }\pard\plain \s2\ql \li0\ri0\sb120\sa120\keepn\widctlpar\brdrt\brdrs\brdrw30\brsp20 \brdrb\brdrs\brdrw30\brsp20 \tqr\tx9072{\*\pn \pnlvlcont\ilvl0\ls0\pnrnot0\pndec }\nooverflow\faroman\outlinelevel1\rin0\lin0\itap0 +\b\f1\fs24\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\b0\f28 2nd guide +\par {\pntext\pard\plain\s26 \f30\fs20\lang2057\langfe1033\langnp2057\langfenp1033 \loch\af30\dbch\af0\hich\f30 \'69\tab}}\pard\plain \s26\ql \fi-283\li283\ri0\sa120\widctlpar\brdrb\brdrs\brdrw15\brsp20 {\*\pn \pnlvlblt\ilvl0\ls17\pnrnot0 +\pnf30\pnstart1\pnindent283\pnhang{\pntxtb i}}\nooverflow\faroman\ls17\rin0\lin283\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {Controls, Virtual keyboard, Shortcuts, ScummVM, Tips, S60, s60 +\par }\pard\plain \ql \li0\ri0\sa120\widctlpar{\*\pn \pnlvlcont\ilvl0\ls0\pnrnot0\pndec }\nooverflow\faroman\rin0\lin0\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\f28 \par -\par }\pard\plain \s2\ql \li0\ri0\sb120\sa120\keepn\widctlpar\brdrt\brdrs\brdrw30\brsp20 \brdrb\brdrs\brdrw30\brsp20 \tqr\tx9072\nooverflow\faroman\outlinelevel1\rin0\lin0\itap0 \b\f1\fs24\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\b0\f28 Second guide - -\par }\pard\plain \s32\ql \li0\ri0\sa120\widctlpar\nooverflow\faroman\rin0\lin0\itap0 \f1\fs20\cf13\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {Controls, Virtual keyboard, Shortcuts, ScummVM, Tips, S60, s60 -\par }\pard\plain \ql \li0\ri0\sa120\widctlpar\nooverflow\faroman\rin0\lin0\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\f28 -\par -\par }{\f29 More user-friendly guide for Nokia phones (based on N96 but should apply to most phones) +\par }{More user-friendly guide for Nokia phones (based on N96 but should apply to most phones) \par \par Left Soft Key - Left Click \par }{\f28 -\par }{\f29 Right Soft Key - Right Click +\par }{Right Soft Key - Right Click \par }{\f28 -\par }{\f29 Navigation buttons - Move pointer on screen +\par }{Navigation buttons - Move pointer on screen \par }{\f28 -\par }{\f29 "C" or "Delete Key" - Space Bar (i.e. skip dialogue/cutscene) +\par }{"C" or "Delete Key" - Space Bar (i.e. skip dialogue/cutscene) \par }{\f28 -\par }{\f29 * - Bring up Menu (to Save, Load and change the game's options e.g. enable subtitles, speech etc. Varies from game to game) +\par }{* - Bring up Menu (to Save, Load and change the game's options e.g. enable subtitles, speech etc. Varies from game to game) \par \par The <> is a toggling left right mode. I.e. first click is left, next is right, next is left etc. \par \par Call Button - Enter/Exit Configuration Mode \par }{\f28 -\par }{\f29 Configuration Mode, when activated, shows the word "CTRL" in green in the upper right corner of the screen. It allows to quickly switch between various functions of ScummVM. The following buttons on your keypad are activated when "CTRL" is disp -layed- -\par -\par 1 - Change Input. +\par }{Configuration Mode, when activated, shows the word "CTRL" in green in the upper right corner of the screen. It allows to quickly switch between various functions of ScummVM. The following buttons on your keypad are activated when "CTRL" is displayed : + +\par }{\f29 +\par }{1 - Change Input. \par This is the option you'll probably use the most. There are three settings; A,C and J. \par -\par A - This is the "Text Input" mode. It allows you to type directly into ScummVM as if you were using a keyboard. Type the same way you would whe -n sending a text message off of your phone. Please note that the pointer is disabled when in this mode. Don't forget to exit Configuration Mode before typing! +\par A - This is the "Text Input" mode. It allows you to type directl +y into ScummVM as if you were using a keyboard. Type the same way you would when sending a text message off of your phone. Please note that the pointer is disabled when in this mode. Don't forget to exit Configuration Mode before typing! \par \par C - This is the "Cursor" mode. This emulates the arrow keys of the keyboard. Some games require using this instead of the mouse (e.g. the destruction derby section towards the end of Full Throttle). \par \par J - This is the "Joystick/Mouse" mode. Simply put, it allows you to use the navigation buttons to move the pointer around the screen. The left and right mouse buttons are used by the left and right Soft keys. \par \par The "C" button emulates the space bar, i.e. skip line of dialogue, skip cutscene or pause game (depending on the game, some games simply use the left mouse button to skip dialogue in which case it will pause the game instead) -\par -\par 2 - Toggle Landscape and Portrait +\par }{\f29 +\par }{2 - Toggle Landscape and Portrait \par Switches the screen output between having the phone held normally (Portrait) or on its side (Landscape). You'll probably never take it off Landscape mode as it offers the better display area. \par \par 3 - Change Landscape Orientation \par Only applies to Landscape mode, simply swaps the screen output between having the phone tilted on its left side or on its right side. \par \par 4 - Toggle Zoom On and Off -\par Zooms in on a portion of the screen. Handy for when you are looking through a screen for items or having trouble reading subtitles. Use the navigation buttons for panning around the play area. Don't forget you'll have to exit out of Configuration Mode bef -ore you can move the pointer again. Exiting Configuration Mode does not reset the zoom level. -\par -\par 5 & 6 - Unused +\par Zooms in on a portion of the screen. Handy for when you are looking through a screen for items or having trouble reading subtitles. Use the navigation buttons for panning around the play area. Don't forget you'll have to exit out of Confi +guration Mode before you can move the pointer again. Exiting Configuration Mode does not reset the zoom level. +\par }{\f29 +\par }{5 & 6 - Unused \par \par 7 - "Text Input" mode. Shortcut for entering "Text Input" mode directly instead of cycling through the other input types using the "1" key. \par @@ -183,16 +192,16 @@ ore you can move the pointer again. Exiting Configuration Mode does not reset th \par Up Navigation Button - Increase ScummVM sound volume. Note that the game itself may have its own independent sound settings (usually found under the * menu) \par \par Down Navigation Button - Decrease ScummVM sound volume. Note that the game itself may have its own independent sound settings (usually found under the * menu) +\par }{\f29 \par +\par }\pard\plain \s2\ql \li0\ri0\sb120\sa120\keepn\widctlpar\brdrt\brdrs\brdrw30\brsp20 \brdrb\brdrs\brdrw30\brsp20 \tqr\tx9072{\*\pn \pnlvlcont\ilvl0\ls0\pnrnot0\pndec }\nooverflow\faroman\outlinelevel1\rin0\lin0\itap0 +\b\f1\fs24\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\b0\f28 3rd guide +\par {\pntext\pard\plain\s26 \f30\fs20\lang2057\langfe1033\langnp2057\langfenp1033 \loch\af30\dbch\af0\hich\f30 \'69\tab}}\pard\plain \s26\ql \fi-283\li283\ri0\sa120\widctlpar\brdrb\brdrs\brdrw15\brsp20 {\*\pn \pnlvlblt\ilvl0\ls17\pnrnot0 +\pnf30\pnstart1\pnindent283\pnhang{\pntxtb i}}\nooverflow\faroman\ls17\rin0\lin283\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {Controls, Virtual keyboard, Shortcuts, ScummVM, Tips, S60, s60 +\par }\pard\plain \ql \li0\ri0\sa120\widctlpar{\*\pn \pnlvlcont\ilvl0\ls0\pnrnot0\pndec }\nooverflow\faroman\rin0\lin0\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\f28 \par -\par }\pard\plain \s2\ql \li0\ri0\sb120\sa120\keepn\widctlpar\brdrt\brdrs\brdrw30\brsp20 \brdrb\brdrs\brdrw30\brsp20 \tqr\tx9072\nooverflow\faroman\outlinelevel1\rin0\lin0\itap0 \b\f1\fs24\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\b0\f28 Third guide - -\par }\pard\plain \s32\ql \li0\ri0\sa120\widctlpar\nooverflow\faroman\rin0\lin0\itap0 \f1\fs20\cf13\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {Controls, Virtual keyboard, Shortcuts, ScummVM, Tips, S60, s60 -\par }\pard\plain \ql \li0\ri0\sa120\widctlpar\nooverflow\faroman\rin0\lin0\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {\f28 -\par -\par }{\f29 ScummVM keys on Nokia e71 -(most likely on any other qwerty-device, too), tested on version 0.14.0svn (Feb. 18 2009 05:56:07). Number keys are inserted by first pressing fn-key (leftmost key at bottom row on E71) and then pressing correct key (e.g. 5 is fn+g). You don't have to pre -ss both keys simultaneously. +\par }{ScummVM keys on Nokia e71 (most likely on any other qwerty-device, too), tested on version 0.14.0svn (Feb. 18 2009 + 05:56:07). Number keys are inserted by first pressing fn-key (leftmost key at bottom row on E71) and then pressing correct key (e.g. 5 is fn+g). You don't have to press both keys simultaneously. \par \par Basic keys: \par @@ -233,8 +242,8 @@ ss both keys simultaneously. \par t -- Talk to \par s -- Push \par y -- Pull -\par -\par and in Full Throttle (from the top of my head): +\par }{\f29 +\par }{and in Full Throttle (from the top of my head): \par \par k -- kick (foot) \par t -- talk (mouth) @@ -242,13 +251,13 @@ ss both keys simultaneously. \par p -- punch (hand) \par \par AGI games (King's Quest, Police Quest etc.): -\par The games work beautifully on the E71, but there's some stupid bugs (in input). I recall fi -nding some debug keys and "last sentence" / "inventory" -keys in earlier version, but I can't find them any more. Also you can't turn on sirens in Police Quest, which kinda makes it unplayable. +\par The games work beautifully on the E71, but there's some stupid bugs (in input). I recall finding some debug keys and "last sentence" / "inventory" -keys in earlier version, but I can't find them any more. Also you can't turn on sirens in Police Quest, whi +ch kinda makes it unplayable. \par \par There's good side and bad side to each input mode: \par Keyboard (I use this primarily) -\par -\par * goes to menu +\par }{\f29 +\par }{* goes to menu \par + you can erase text \par + moving is relatively easy \par - you can't type in UPPER CASE @@ -256,11 +265,75 @@ nding some debug keys and "last sentence" / "inventory" -keys in earlier version \par - worthless 'current key' -display on left top corner \par \par Joystick / Cursor: -\par -\par + you can access menus +\par }{\f29 +\par }{+ you can access menus \par + you can type numbers (just make sure f-letter in left top corner is red before clicking "numbers". It works kinda funnily, but you'll get hang of it.) \par - you move mouse cursor which makes walking harder (joystick mode) \par - you can't erase text -\par -\par There might be some mistakes and some keys missing from the list, feel free to pm me corrections / suggestions.}{\f28 +\par }{\f28 +\par }\pard\plain \s2\ql \li0\ri0\sb120\sa120\keepn\widctlpar\brdrt\brdrs\brdrw30\brsp20 \brdrb\brdrs\brdrw30\brsp20 \tqr\tx9072{\*\pn \pnlvlcont\ilvl0\ls0\pnrnot0\pndec }\nooverflow\faroman\outlinelevel1\rin0\lin0\itap0 +\b\f1\fs24\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {ScummVM1 engines list +\par {\pntext\pard\plain\s26 \f30\fs20\lang2057\langfe1033\langnp2057\langfenp1033 \loch\af30\dbch\af0\hich\f30 \'69\tab}}\pard\plain \s26\ql \fi-283\li283\ri0\sa120\widctlpar\brdrb\brdrs\brdrw15\brsp20 {\*\pn \pnlvlblt\ilvl0\ls18\pnrnot0 +\pnf30\pnstart1\pnindent283\pnhang{\pntxtb i}}\nooverflow\faroman\ls18\rin0\lin283\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {Supported games +\par }\pard\plain \ql \li0\ri0\sa120\widctlpar{\*\pn \pnlvlcont\ilvl0\ls0\pnrnot0\pndec }\nooverflow\faroman\rin0\lin0\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {agi +\par agos +\par \tab AGOS2 +\par cine +\par composer +\par cruise +\par drascula +\par gob +\par groovie +\par \tab GROOVIE2 +\par kyra +\par \tab EOB +\par \tab LOL +\par lastexpress +\par made +\par neverhood +\par parallaction +\par queen +\par saga +\par \tab IHNM +\par \tab SAGA2 +\par scumm +\par \tab HE +\par \tab SCUMM_7_8 +\par touche +\par tucker +\par wintermute +\par +\par }\pard\plain \s2\ql \li0\ri0\sb120\sa120\keepn\widctlpar\brdrt\brdrs\brdrw30\brsp20 \brdrb\brdrs\brdrw30\brsp20 \tqr\tx9072{\*\pn \pnlvlcont\ilvl0\ls0\pnrnot0\pndec }\nooverflow\faroman\outlinelevel1\rin0\lin0\itap0 +\b\f1\fs24\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {ScummVM2 engines list +\par {\pntext\pard\plain\s26 \f30\fs20\lang2057\langfe1033\langnp2057\langfenp1033 \loch\af30\dbch\af0\hich\f30 \'69\tab}}\pard\plain \s26\ql \fi-283\li283\ri0\sa120\widctlpar\brdrb\brdrs\brdrw15\brsp20 {\*\pn \pnlvlblt\ilvl0\ls18\pnrnot0 +\pnf30\pnstart1\pnindent283\pnhang{\pntxtb i}}\nooverflow\faroman\ls18\rin0\lin283\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {Supported games +\par }\pard\plain \ql \li0\ri0\sa120\widctlpar\nooverflow\faroman\rin0\lin0\itap0 \f1\fs20\lang2057\langfe1033\cgrid\langnp2057\langfenp1033 {avalanche +\par cge +\par composer +\par draci +\par dreamweb +\par fullpipe +\par hopkins +\par hugo +\par lure +\par mohawk +\par \tab CSTIME +\par \tab MYST +\par \tab RIVEN +\par mortevielle +\par pegasus +\par sci +\par \tab SCI32 +\par sky +\par sword1 +\par sword2 +\par sword25(Not supported) +\par teenagent +\par testbed +\par tinsel +\par toltecs +\par tony +\par toon +\par tsage +\par zvision \par }} \ No newline at end of file diff --git a/backends/platform/symbian/mmp/scummvm_agi.mmp.in b/backends/platform/symbian/mmp/scummvm_agi.mmp.in index a3eaa71065..d6f9e54b7d 100644 --- a/backends/platform/symbian/mmp/scummvm_agi.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_agi.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -57,5 +57,15 @@ SOURCEPATH ..\..\..\..\engines\agi USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h diff --git a/backends/platform/symbian/mmp/scummvm_agos.mmp.in b/backends/platform/symbian/mmp/scummvm_agos.mmp.in index 92b8862794..d2b1329a24 100644 --- a/backends/platform/symbian/mmp/scummvm_agos.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_agos.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -63,5 +63,15 @@ SOURCEPATH ..\..\..\..\engines\agos USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h diff --git a/backends/platform/symbian/mmp/scummvm_avalanche.mmp.in b/backends/platform/symbian/mmp/scummvm_avalanche.mmp.in index 1093181a4e..5260edc79d 100644 --- a/backends/platform/symbian/mmp/scummvm_avalanche.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_avalanche.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * Copyright (C) 2013 Strizniou Fedor * * ScummVM is the legal property of its developers, whose names @@ -58,5 +58,15 @@ SOURCEPATH ..\..\..\..\engines\avalanche USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h diff --git a/backends/platform/symbian/mmp/scummvm_base.mmp.in b/backends/platform/symbian/mmp/scummvm_base.mmp.in index 358a2ec961..cc65980b71 100644 --- a/backends/platform/symbian/mmp/scummvm_base.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_base.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -34,7 +34,9 @@ TARGET scummvm_base.lib TARGETTYPE lib OPTION MSVC /QIfist /Ob1 /Oy /GF // /QIfist disables use of __ftol2 to avoid linker probs with MS libc: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/vcrefQIfistSuppress_ftol.asp OPTION GCC -Wno-multichar -Wno-reorder // don't optimize for ARM, platform way too sensitive for that :( just turn off some common warnings -OPTION GCCE -Wno-multichar -Wno-reorder -Wno-unused -Wno-format -fsigned-char +// using option -Wno-psabi to supress warning "note: the mangling of 'va_list' has changed in GCC 4.4" +// compiler will use png.h from libpng.lib instead ScummVM's +OPTION GCCE -Wno-multichar -Wno-reorder -Wno-unused -Wno-format -fsigned-char -Wno-psabi -I'/Symbian/S60_5th_Edition_SDK_v1.0/epoc32/include/png' ALWAYS_BUILD_AS_ARM // Note: the LIB:*.lib statements are used by AdaptAllMMPs.pl, so don't remove them! @@ -54,9 +56,12 @@ USERINCLUDE \epoc32\include\mpeg2dec //\epoc32\include\theora SYSTEMINCLUDE \epoc32\include\freetype SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png SYSTEMINCLUDE \epoc32\include\ESDL SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora SYSTEMINCLUDE \epoc32\include\tremor SYSTEMINCLUDE \epoc32\include SYSTEMINCLUDE ..\src // for portdefs.h @@ -115,6 +120,7 @@ SOURCEPATH ..\..\..\..\video //STOP_AUTO_OBJECTS_VIDEO_// // add a few files manually, since they are not parsed from modules.mk files +SOURCE theora_decoder.cpp SOURCE bink_decoder.cpp SOURCE codecs\mpeg.cpp @@ -159,4 +165,5 @@ SOURCE backends\vkeybd\virtual-keyboard.cpp // Downscaler SOURCE graphics\scaler\downscaler.cpp +SOURCE graphics\scaler\downscalerARM.s MACRO SDL_BACKEND diff --git a/backends/platform/symbian/mmp/scummvm_cge.mmp.in b/backends/platform/symbian/mmp/scummvm_cge.mmp.in index 2d93671938..35cb0f2f98 100644 --- a/backends/platform/symbian/mmp/scummvm_cge.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_cge.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -57,5 +57,15 @@ SOURCEPATH ..\..\..\..\engines\cge USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h diff --git a/backends/platform/symbian/mmp/scummvm_cine.mmp.in b/backends/platform/symbian/mmp/scummvm_cine.mmp.in index a308f92813..99b45cddb8 100644 --- a/backends/platform/symbian/mmp/scummvm_cine.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_cine.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -57,4 +57,15 @@ SOURCEPATH ..\..\..\..\engines\cine USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL +SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h diff --git a/backends/platform/symbian/mmp/scummvm_composer.mmp.in b/backends/platform/symbian/mmp/scummvm_composer.mmp.in index cfe43b59a2..5a215f2d8d 100644 --- a/backends/platform/symbian/mmp/scummvm_composer.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_composer.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -57,5 +57,15 @@ SOURCEPATH ..\..\..\..\engines\COMPOSER USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h diff --git a/backends/platform/symbian/mmp/scummvm_cruise.mmp.in b/backends/platform/symbian/mmp/scummvm_cruise.mmp.in index 58aed70f81..21a674dc1f 100644 --- a/backends/platform/symbian/mmp/scummvm_cruise.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_cruise.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -57,4 +57,15 @@ SOURCEPATH ..\..\..\..\engines\cruise USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL +SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h diff --git a/backends/platform/symbian/mmp/scummvm_draci.mmp.in b/backends/platform/symbian/mmp/scummvm_draci.mmp.in index ba1759c00b..fe899a91ff 100644 --- a/backends/platform/symbian/mmp/scummvm_draci.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_draci.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -57,5 +57,15 @@ SOURCEPATH ..\..\..\..\engines\draci USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h diff --git a/backends/platform/symbian/mmp/scummvm_drascula.mmp.in b/backends/platform/symbian/mmp/scummvm_drascula.mmp.in index c4419dd71e..8f532d4498 100644 --- a/backends/platform/symbian/mmp/scummvm_drascula.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_drascula.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -57,4 +57,15 @@ SOURCEPATH ..\..\..\..\engines\drascula USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL +SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h diff --git a/backends/platform/symbian/mmp/scummvm_dreamweb.mmp.in b/backends/platform/symbian/mmp/scummvm_dreamweb.mmp.in index a5cc758ff6..89ffd23ebd 100644 --- a/backends/platform/symbian/mmp/scummvm_dreamweb.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_dreamweb.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * Copyright (C) 2013 Strizniou Fedor * * ScummVM is the legal property of its developers, whose names @@ -58,5 +58,15 @@ SOURCEPATH ..\..\..\..\engines\dreamweb USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h diff --git a/backends/platform/symbian/mmp/scummvm_fullpipe.mmp.in b/backends/platform/symbian/mmp/scummvm_fullpipe.mmp.in index 59666b7b74..7612ad2bae 100644 --- a/backends/platform/symbian/mmp/scummvm_fullpipe.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_fullpipe.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * Copyright (C) 2013 Strizniou Fedor * * ScummVM is the legal property of its developers, whose names @@ -58,5 +58,15 @@ SOURCEPATH ..\..\..\..\engines\fullpipe USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h diff --git a/backends/platform/symbian/mmp/scummvm_gob.mmp.in b/backends/platform/symbian/mmp/scummvm_gob.mmp.in index c2c36626ff..884b06c61a 100644 --- a/backends/platform/symbian/mmp/scummvm_gob.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_gob.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -57,4 +57,15 @@ SOURCEPATH ..\..\..\..\engines\gob USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL +SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h diff --git a/backends/platform/symbian/mmp/scummvm_groovie.mmp.in b/backends/platform/symbian/mmp/scummvm_groovie.mmp.in index 639a794260..de6483bebf 100644 --- a/backends/platform/symbian/mmp/scummvm_groovie.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_groovie.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -57,5 +57,15 @@ SOURCEPATH ..\..\..\..\engines\groovie USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h diff --git a/backends/platform/symbian/mmp/scummvm_hopkins.mmp.in b/backends/platform/symbian/mmp/scummvm_hopkins.mmp.in index cfe47d09ba..bafc11e65f 100644 --- a/backends/platform/symbian/mmp/scummvm_hopkins.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_hopkins.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -57,5 +57,15 @@ SOURCEPATH ..\..\..\..\engines\HOPKINS USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h \ No newline at end of file diff --git a/backends/platform/symbian/mmp/scummvm_hugo.mmp.in b/backends/platform/symbian/mmp/scummvm_hugo.mmp.in index fceeb5e5d1..58622a83fd 100644 --- a/backends/platform/symbian/mmp/scummvm_hugo.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_hugo.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -57,5 +57,15 @@ SOURCEPATH ..\..\..\..\engines\hugo USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h \ No newline at end of file diff --git a/backends/platform/symbian/mmp/scummvm_kyra.mmp.in b/backends/platform/symbian/mmp/scummvm_kyra.mmp.in index 2f8d22595e..3fa05e856d 100644 --- a/backends/platform/symbian/mmp/scummvm_kyra.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_kyra.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -70,4 +70,15 @@ SOURCEPATH ..\..\..\..\engines\kyra USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL +SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h diff --git a/backends/platform/symbian/mmp/scummvm_lastexpress.mmp.in b/backends/platform/symbian/mmp/scummvm_lastexpress.mmp.in index fe2ebdfa1b..8e0b3026c7 100644 --- a/backends/platform/symbian/mmp/scummvm_lastexpress.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_lastexpress.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -57,5 +57,15 @@ SOURCEPATH ..\..\..\..\engines\lastexpress USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h diff --git a/backends/platform/symbian/mmp/scummvm_lure.mmp.in b/backends/platform/symbian/mmp/scummvm_lure.mmp.in index f8b42bf337..89c93d058d 100644 --- a/backends/platform/symbian/mmp/scummvm_lure.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_lure.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -57,4 +57,15 @@ SOURCEPATH ..\..\..\..\engines\lure USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL +SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h diff --git a/backends/platform/symbian/mmp/scummvm_m4.mmp.in b/backends/platform/symbian/mmp/scummvm_m4.mmp.in index 05395c1816..b3024c93c3 100644 --- a/backends/platform/symbian/mmp/scummvm_m4.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_m4.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -57,5 +57,15 @@ SOURCEPATH ..\..\..\..\engines\m4 USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h diff --git a/backends/platform/symbian/mmp/scummvm_made.mmp.in b/backends/platform/symbian/mmp/scummvm_made.mmp.in index b0a0e7d34c..d4a63f8d87 100644 --- a/backends/platform/symbian/mmp/scummvm_made.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_made.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -57,5 +57,16 @@ SOURCEPATH ..\..\..\..\engines\made USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h + diff --git a/backends/platform/symbian/mmp/scummvm_mohawk.mmp.in b/backends/platform/symbian/mmp/scummvm_mohawk.mmp.in index 005b5f873e..e9175593ec 100644 --- a/backends/platform/symbian/mmp/scummvm_mohawk.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_mohawk.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -76,5 +76,15 @@ SOURCEPATH ..\..\..\..\engines\mohawk USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h diff --git a/backends/platform/symbian/mmp/scummvm_mortevielle.mmp.in b/backends/platform/symbian/mmp/scummvm_mortevielle.mmp.in index 90af4cb835..f118ddbef0 100644 --- a/backends/platform/symbian/mmp/scummvm_mortevielle.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_mortevielle.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * Copyright (C) 2013 Strizniou Fedor * * ScummVM is the legal property of its developers, whose names @@ -58,5 +58,15 @@ SOURCEPATH ..\..\..\..\engines\mortevielle USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h diff --git a/backends/platform/symbian/mmp/scummvm_neverhood.mmp.in b/backends/platform/symbian/mmp/scummvm_neverhood.mmp.in index b65f0f6ab6..a57161577f 100644 --- a/backends/platform/symbian/mmp/scummvm_neverhood.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_neverhood.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -57,5 +57,15 @@ SOURCEPATH ..\..\..\..\engines\neverhood USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h diff --git a/backends/platform/symbian/mmp/scummvm_parallaction.mmp.in b/backends/platform/symbian/mmp/scummvm_parallaction.mmp.in index 92d916224e..cefdd1b282 100644 --- a/backends/platform/symbian/mmp/scummvm_parallaction.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_parallaction.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -57,5 +57,15 @@ SOURCEPATH ..\..\..\..\engines\parallaction USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h diff --git a/backends/platform/symbian/mmp/scummvm_pegasus.mmp.in b/backends/platform/symbian/mmp/scummvm_pegasus.mmp.in index 66863f2d74..68b2c12774 100644 --- a/backends/platform/symbian/mmp/scummvm_pegasus.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_pegasus.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -57,5 +57,15 @@ SOURCEPATH ..\..\..\..\engines\PEGASUS USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h \ No newline at end of file diff --git a/backends/platform/symbian/mmp/scummvm_queen.mmp.in b/backends/platform/symbian/mmp/scummvm_queen.mmp.in index 3d8cfc1949..94835aae90 100644 --- a/backends/platform/symbian/mmp/scummvm_queen.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_queen.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -57,4 +57,15 @@ SOURCEPATH ..\..\..\..\engines\queen USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL +SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h diff --git a/backends/platform/symbian/mmp/scummvm_saga.mmp.in b/backends/platform/symbian/mmp/scummvm_saga.mmp.in index 9ca633972b..77bf839efe 100644 --- a/backends/platform/symbian/mmp/scummvm_saga.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_saga.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -69,4 +69,15 @@ SOURCEPATH ..\..\..\..\engines\saga USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL +SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h diff --git a/backends/platform/symbian/mmp/scummvm_sci.mmp.in b/backends/platform/symbian/mmp/scummvm_sci.mmp.in index 109b277667..d08501e471 100644 --- a/backends/platform/symbian/mmp/scummvm_sci.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_sci.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -65,5 +65,15 @@ SOURCEPATH ..\..\..\..\engines\sci USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h diff --git a/backends/platform/symbian/mmp/scummvm_scumm.mmp.in b/backends/platform/symbian/mmp/scummvm_scumm.mmp.in index cc008766a8..a11dd071d3 100644 --- a/backends/platform/symbian/mmp/scummvm_scumm.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_scumm.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -81,7 +81,14 @@ SOURCE smush/codec47ARM.s // ARM version: add ASM routines USERINCLUDE ..\..\..\..\engines ..\..\..\..\engines\scumm\smush ..\..\..\..\engines\scumm\insane USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor SYSTEMINCLUDE \epoc32\include SYSTEMINCLUDE ..\src // for portdefs.h diff --git a/backends/platform/symbian/mmp/scummvm_sky.mmp.in b/backends/platform/symbian/mmp/scummvm_sky.mmp.in index 0ab35dffd7..37fdc89f99 100644 --- a/backends/platform/symbian/mmp/scummvm_sky.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_sky.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -57,4 +57,15 @@ SOURCEPATH ..\..\..\..\engines\sky USERINCLUDE ..\..\..\..\engines ..\..\..\..\engines\sky\music USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL +SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h diff --git a/backends/platform/symbian/mmp/scummvm_sword1.mmp.in b/backends/platform/symbian/mmp/scummvm_sword1.mmp.in index 3b709fe1de..352cbe59f0 100644 --- a/backends/platform/symbian/mmp/scummvm_sword1.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_sword1.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -57,4 +57,15 @@ SOURCEPATH ..\..\..\..\engines\sword1 USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL +SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h diff --git a/backends/platform/symbian/mmp/scummvm_sword2.mmp.in b/backends/platform/symbian/mmp/scummvm_sword2.mmp.in index ec5ccaefc9..7b79bf7f5c 100644 --- a/backends/platform/symbian/mmp/scummvm_sword2.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_sword2.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -57,4 +57,15 @@ SOURCEPATH ..\..\..\..\engines\sword2 USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL +SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h diff --git a/backends/platform/symbian/mmp/scummvm_sword25.mmp.in b/backends/platform/symbian/mmp/scummvm_sword25.mmp.in index 62907f9245..4159350bce 100644 --- a/backends/platform/symbian/mmp/scummvm_sword25.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_sword25.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * Copyright (C) 2013 Strizniou Fedor * * ScummVM is the legal property of its developers, whose names @@ -59,5 +59,15 @@ SOURCEPATH ..\..\..\..\engines\sword25 USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src USERINCLUDE ..\..\..\..\engines\sword25\util\lua ..\..\..\..\engines\sword25\util\pluto + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h diff --git a/backends/platform/symbian/mmp/scummvm_teenagent.mmp.in b/backends/platform/symbian/mmp/scummvm_teenagent.mmp.in index 73a86b9913..332b9f20ac 100644 --- a/backends/platform/symbian/mmp/scummvm_teenagent.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_teenagent.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -57,5 +57,15 @@ SOURCEPATH ..\..\..\..\engines\teenagent USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h diff --git a/backends/platform/symbian/mmp/scummvm_testbed.mmp.in b/backends/platform/symbian/mmp/scummvm_testbed.mmp.in index 07d1df625d..20d3789a31 100644 --- a/backends/platform/symbian/mmp/scummvm_testbed.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_testbed.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * Copyright (C) 2013 Strizniou Fedor * * ScummVM is the legal property of its developers, whose names @@ -58,5 +58,15 @@ SOURCEPATH ..\..\..\..\engines\testbed USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h diff --git a/backends/platform/symbian/mmp/scummvm_tinsel.mmp.in b/backends/platform/symbian/mmp/scummvm_tinsel.mmp.in index 6436aaaa9b..15c5850cee 100644 --- a/backends/platform/symbian/mmp/scummvm_tinsel.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_tinsel.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -57,4 +57,15 @@ SOURCEPATH ..\..\..\..\engines\tinsel USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL +SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h \ No newline at end of file diff --git a/backends/platform/symbian/mmp/scummvm_toltecs.mmp.in b/backends/platform/symbian/mmp/scummvm_toltecs.mmp.in index 8685f80f71..df75290d81 100644 --- a/backends/platform/symbian/mmp/scummvm_toltecs.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_toltecs.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -57,5 +57,15 @@ SOURCEPATH ..\..\..\..\engines\TOLTECS USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h diff --git a/backends/platform/symbian/mmp/scummvm_tony.mmp.in b/backends/platform/symbian/mmp/scummvm_tony.mmp.in index 01d4712cbb..bcdbc1c979 100644 --- a/backends/platform/symbian/mmp/scummvm_tony.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_tony.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -57,5 +57,15 @@ SOURCEPATH ..\..\..\..\engines\TONY USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h diff --git a/backends/platform/symbian/mmp/scummvm_toon.mmp.in b/backends/platform/symbian/mmp/scummvm_toon.mmp.in index 2cddddd777..7bfec38dc5 100644 --- a/backends/platform/symbian/mmp/scummvm_toon.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_toon.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -57,5 +57,15 @@ SOURCEPATH ..\..\..\..\engines\toon USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h diff --git a/backends/platform/symbian/mmp/scummvm_touche.mmp.in b/backends/platform/symbian/mmp/scummvm_touche.mmp.in index 24ca777c70..407e275ae3 100644 --- a/backends/platform/symbian/mmp/scummvm_touche.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_touche.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -57,5 +57,15 @@ SOURCEPATH ..\..\..\..\engines\touche USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h diff --git a/backends/platform/symbian/mmp/scummvm_tsage.mmp.in b/backends/platform/symbian/mmp/scummvm_tsage.mmp.in index d017be593b..cd5c5ec7b9 100644 --- a/backends/platform/symbian/mmp/scummvm_tsage.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_tsage.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -57,5 +57,15 @@ SOURCEPATH ..\..\..\..\engines\tsage USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h diff --git a/backends/platform/symbian/mmp/scummvm_tucker.mmp.in b/backends/platform/symbian/mmp/scummvm_tucker.mmp.in index f30bbfc469..c457dd4083 100644 --- a/backends/platform/symbian/mmp/scummvm_tucker.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_tucker.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -57,5 +57,15 @@ SOURCEPATH ..\..\..\..\engines\tucker USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h diff --git a/backends/platform/symbian/mmp/scummvm_wintermute.mmp.in b/backends/platform/symbian/mmp/scummvm_wintermute.mmp.in index 5d26f36df5..a430f64847 100644 --- a/backends/platform/symbian/mmp/scummvm_wintermute.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_wintermute.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -57,5 +57,15 @@ SOURCEPATH ..\..\..\..\engines\wintermute USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src + +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h diff --git a/backends/platform/symbian/mmp/scummvm_zvision.mmp.in b/backends/platform/symbian/mmp/scummvm_zvision.mmp.in index a007f45f5b..f8448e0423 100644 --- a/backends/platform/symbian/mmp/scummvm_zvision.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_zvision.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2014 The ScummVM Team + * Copyright (C) 2005-2013 The ScummVM project * Copyright (C) 2013 Strizniou Fedor * * ScummVM is the legal property of its developers, whose names @@ -58,5 +58,14 @@ SOURCEPATH ..\..\..\..\engines\zvision USERINCLUDE ..\..\..\..\engines USERINCLUDE ..\..\..\.. ..\..\..\..\gui ..\..\..\..\audio ..\src +SYSTEMINCLUDE \epoc32\include\freetype +SYSTEMINCLUDE \epoc32\include\mpeg2dec +SYSTEMINCLUDE \epoc32\include\jpeg +SYSTEMINCLUDE \epoc32\include\png +SYSTEMINCLUDE \epoc32\include\ESDL SYSTEMINCLUDE \epoc32\include\ZLIB // before \epoc32\include because symbian already has older version -SYSTEMINCLUDE \epoc32\include \epoc32\include\libc ..\src +SYSTEMINCLUDE \epoc32\include\libc +SYSTEMINCLUDE \epoc32\include\theora +SYSTEMINCLUDE \epoc32\include\tremor +SYSTEMINCLUDE \epoc32\include +SYSTEMINCLUDE ..\src // for portdefs.h -- cgit v1.2.3 From da3d8f746ca9bac36b995621c8b7d3be2068eecf Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 6 May 2014 22:12:31 +0200 Subject: MADS: Implement scene 503 --- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes5.cpp | 122 +++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes5.h | 16 +++- 3 files changed, 138 insertions(+), 2 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 08b01fe8e2..6660627038 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -201,7 +201,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 502: // inside male only teleporter return new Scene502(vm); case 503: // guard tower - return new DummyScene(vm); // TODO + return new Scene503(vm); case 504: // inside car return new DummyScene(vm); // TODO case 505: // car view screen diff --git a/engines/mads/nebular/nebular_scenes5.cpp b/engines/mads/nebular/nebular_scenes5.cpp index db6e6dad59..da8faa03d0 100644 --- a/engines/mads/nebular/nebular_scenes5.cpp +++ b/engines/mads/nebular/nebular_scenes5.cpp @@ -514,5 +514,127 @@ void Scene502::actions() { /*------------------------------------------------------------------------*/ +void Scene503::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(0x6A); + _scene->addActiveVocab(0xD); +} + +void Scene503::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('c', -1)); + + if (_globals[kSexOfRex] == REX_MALE) + _globals._spriteIndexes[2] = _scene->_sprites.addSprites("*RXMBD_2"); + else + _globals._spriteIndexes[3] = _scene->_sprites.addSprites("*ROXBD_2"); + + if (_game._objects[OBJ_DETONATORS]._roomNumber == _scene->_currentSceneId) { + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 9, 0, 0, 0); + _detonatorHotspotId = _scene->_dynamicHotspots.add(0x6A, 0xD, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(_detonatorHotspotId, Common::Point(254, 135), FACING_SOUTH); + } + + if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(191, 152); + _game._player._facing = FACING_NORTHWEST; + } + + sceneEntrySound(); +} + +void Scene503::actions() { + if (_action.isAction(0x32F, 0xF9)) + _scene->_nextSceneId = 501; + else if (_action.isAction(VERB_TAKE, 0x6A)) { + if ( _game._trigger || !_game._objects.isInInventory(OBJ_DETONATORS)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + if (_globals[kSexOfRex] == REX_MALE) { + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 3); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[2]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_SPRITE, 3, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + } else { + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], true, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 4); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_SPRITE, 4, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + } + break; + + case 1: + _vm->_sound->command(9); + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _scene->_dynamicHotspots.remove(_detonatorHotspotId); + _game._objects.addToInventory(OBJ_DETONATORS); + _vm->_dialogs->showItem(OBJ_DETONATORS, 50326); + break; + + case 2: + if (_globals[kSexOfRex] == REX_MALE) + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[2]); + else + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[3]); + + _game._player._visible = true; + _game._player._stepEnabled = true; + break; + + default: + break; + } + } + } else if (_action._lookFlag) + _vm->_dialogs->show(50328); + else if (_action.isAction(VERB_LOOK, 0x36F)) + _vm->_dialogs->show(50310); + else if (_action.isAction(VERB_LOOK, 0x36E)) + _vm->_dialogs->show(50311); + else if (_action.isAction(VERB_TAKE, 0x36E) || _action.isAction(VERB_TAKE, 0x36C)) + _vm->_dialogs->show(50312); + else if (_action.isAction(VERB_LOOK, 0x36D)) + _vm->_dialogs->show(50313); + else if (_action.isAction(VERB_LOOK, 0x36C)) + _vm->_dialogs->show(50314); + else if (_action.isAction(VERB_LOOK, 0x331)) + _vm->_dialogs->show(50315); + else if (_action.isAction(VERB_LOOK, 0x330)) + _vm->_dialogs->show(50316); + else if (_action.isAction(VERB_OPEN, 0x330)) + _vm->_dialogs->show(50317); + else if (_action.isAction(VERB_LOOK, 0x36B)) + _vm->_dialogs->show(50318); + else if (_action.isAction(VERB_LOOK, 0x1E4)) + _vm->_dialogs->show(50319); + else if (_action.isAction(VERB_LOOK, 0xE2)) + _vm->_dialogs->show(50320); + else if (_action.isAction(VERB_LOOK, 0x481)) + _vm->_dialogs->show(50322); + else if (_action.isAction(VERB_LOOK, 0x332)) { + if (_game._objects.isInRoom(OBJ_DETONATORS)) + _vm->_dialogs->show(50323); + else + _vm->_dialogs->show(50324); + } else if (_action.isAction(VERB_LOOK, 0x6A) && (_action._savedFields._mainObjectSource == 4)) + _vm->_dialogs->show(50325); + else if (_action.isAction(VERB_LOOK, 0x32E)) + _vm->_dialogs->show(50327); + else if (_action.isAction(VERB_OPEN, 0x36D)) + _vm->_dialogs->show(50329); + else if (_action.isAction(0xC, 0x36D) && _game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId))) + _vm->_dialogs->show(50330); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes5.h b/engines/mads/nebular/nebular_scenes5.h index e46207c09a..0b29c92645 100644 --- a/engines/mads/nebular/nebular_scenes5.h +++ b/engines/mads/nebular/nebular_scenes5.h @@ -82,8 +82,22 @@ public: virtual void postActions() {}; }; -} // End of namespace Nebular +class Scene503: public Scene5xx{ +private: + int _detonatorHotspotId; + +public: + Scene503(MADSEngine *vm) : Scene5xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step() {}; + virtual void preActions() {}; + virtual void actions(); + virtual void postActions() {}; +}; +} // End of namespace Nebular } // End of namespace MADS #endif /* MADS_NEBULAR_SCENES5_H */ -- cgit v1.2.3 From b36b6185bee6c4a33dec43d6eb1e13a8bbfef18b Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 7 May 2014 01:09:19 +0300 Subject: MADS: Implement Rex Nebular scene 710 --- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes7.cpp | 43 ++++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes7.h | 12 +++++++++ 3 files changed, 56 insertions(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 6660627038..7aaaa9ebb3 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -265,7 +265,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 707: // teleporter return new Scene707(vm); case 710: // looking at pedestral room through binoculars - return new DummyScene(vm); // TODO + return new Scene710(vm); case 711: // inside teleporter return new Scene711(vm); case 751: // outside elevator (before city is submerged) diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index 53b408c46c..eb67422278 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -141,6 +141,49 @@ void Scene707::actions() { /*------------------------------------------------------------------------*/ +void Scene710::setup() { + _game._player._spritesPrefix = ""; + setAAName(); +} + +void Scene710::enter() { + _game._scene._userInterface.setup(kInputLimitedSentences); + + if (_game._objects[OBJ_VASE]._roomNumber == 706) { + _game._globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('g', -1)); + _globals._sequenceIndexes[1] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 6, 0, 0, 0); + } + + _game._player._visible = false; + _game._scene._sequences.addTimer(600, 70); + + sceneEntrySound(); +} + +void Scene710::step() { + if (_game._trigger == 70) { + if (_game._globals[kCityFlooded]) + _game._scene._nextSceneId = 701; + else + _game._scene._nextSceneId = 751; + } +} + +void Scene710::actions() { + if (_game._scene._action.isAction(0x46F, 0x27)) { + _game._player._stepEnabled = false; + + if (_game._globals[kCityFlooded]) + _game._scene._nextSceneId = 701; + else + _game._scene._nextSceneId = 751; + + _action._inProgress = false; + } +} + +/*------------------------------------------------------------------------*/ + void Scene711::setup() { // The original was calling Scene7xx::setPlayerSpreitesPrefix() _vm->_sound->command(5); diff --git a/engines/mads/nebular/nebular_scenes7.h b/engines/mads/nebular/nebular_scenes7.h index 080c6396e2..0f4947f38f 100644 --- a/engines/mads/nebular/nebular_scenes7.h +++ b/engines/mads/nebular/nebular_scenes7.h @@ -62,6 +62,18 @@ public: virtual void postActions() {}; }; +class Scene710: public Scene7xx { +public: + Scene710(MADSEngine *vm) : Scene7xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions(); + virtual void postActions() {}; +}; + class Scene711: public SceneTeleporter { public: Scene711(MADSEngine *vm) : SceneTeleporter(vm) {} -- cgit v1.2.3 From bd136a1c87b764de58b2e60dd8f14bb3c33dda40 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 7 May 2014 04:50:17 +0300 Subject: MADS: Implement Rex Nebular scene 752 --- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes7.cpp | 198 +++++++++++++++++++++++++++++-- engines/mads/nebular/nebular_scenes7.h | 15 +++ 3 files changed, 206 insertions(+), 9 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 7aaaa9ebb3..19c98246ac 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -271,7 +271,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 751: // outside elevator (before city is submerged) return new DummyScene(vm); // TODO case 752: // outside teleporter (before city is submerged) - return new DummyScene(vm); // TODO + return new Scene752(vm); // Scene group #8 case 801: // control room, outside teleporter diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index eb67422278..54acabf755 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -147,15 +147,15 @@ void Scene710::setup() { } void Scene710::enter() { - _game._scene._userInterface.setup(kInputLimitedSentences); + _scene->_userInterface.setup(kInputLimitedSentences); if (_game._objects[OBJ_VASE]._roomNumber == 706) { - _game._globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('g', -1)); + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('g', -1)); _globals._sequenceIndexes[1] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 6, 0, 0, 0); } _game._player._visible = false; - _game._scene._sequences.addTimer(600, 70); + _scene->_sequences.addTimer(600, 70); sceneEntrySound(); } @@ -163,20 +163,20 @@ void Scene710::enter() { void Scene710::step() { if (_game._trigger == 70) { if (_game._globals[kCityFlooded]) - _game._scene._nextSceneId = 701; + _scene->_nextSceneId = 701; else - _game._scene._nextSceneId = 751; + _scene->_nextSceneId = 751; } } void Scene710::actions() { - if (_game._scene._action.isAction(0x46F, 0x27)) { + if (_action.isAction(0x46F, 0x27)) { _game._player._stepEnabled = false; if (_game._globals[kCityFlooded]) - _game._scene._nextSceneId = 701; + _scene->_nextSceneId = 701; else - _game._scene._nextSceneId = 751; + _scene->_nextSceneId = 751; _action._inProgress = false; } @@ -229,5 +229,187 @@ void Scene711::actions() { /*------------------------------------------------------------------------*/ +void Scene752::setup() { + setPlayerSpritesPrefix(); + setAAName(); + + _scene->addActiveVocab(0xB3); + _scene->addActiveVocab(VERB_WALKTO); + _scene->addActiveVocab(0xD1); + _scene->addActiveVocab(0x343); +} + +void Scene752::enter() { + _globals._spriteIndexes[14] = _scene->_sprites.addSprites(formAnimName('l', -1)); + _globals._spriteIndexes[12] = _scene->_sprites.addSprites("*RXMBD_8"); + + if (_scene->_priorSceneId == 751) { + _game._player._playerPos = Common::Point(13, 145); + _game._player._facing = FACING_EAST; + } else if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(289, 138); + _game._player.walk(Common::Point(262, 148), FACING_WEST); + _game._player._facing = FACING_WEST; + _game._player._visible = true; + } + + if (_game._objects[OBJ_ID_CARD]._roomNumber == 752) { + _globals._spriteIndexes[13] = _scene->_sprites.addSprites(formAnimName('i', -1)); + _globals._sequenceIndexes[13] = _scene->_sequences.startCycle(_globals._spriteIndexes[13], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 8); + int idx = _scene->_dynamicHotspots.add(0xB3, VERB_WALKTO, _globals._sequenceIndexes[13], Common::Rect(0, 0, 0, 0)); + _cardId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(234, 135), FACING_NORTH); + } + + if (_game._globals[kLaserHoleIsThere]) { + _globals._sequenceIndexes[14] = _scene->_sequences.startCycle(_globals._spriteIndexes[14], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[14], 13); + int idx = _scene->_dynamicHotspots.add(0x343, 0xD1, _globals._sequenceIndexes[14], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(215, 130), FACING_NORTHWEST); + } + + if (_game._globals[kTeleporterCommand]) { + switch(_game._globals[kTeleporterCommand]) { + case TELEPORTER_BEAM_OUT: + case TELEPORTER_WRONG: + case TELEPORTER_STEP_OUT: + _game._player._visible = true; + _game._player._stepEnabled = true; + break; + default: + break; + } + + _game._globals[kTeleporterCommand] = TELEPORTER_NONE; + } + + if (_globals._timebombTimer > 0) + _globals._timebombTimer = 10800 - 600; + + sceneEntrySound(); +} + +void Scene752::step() { + if (_globals._timebombTimer >= 10800 && _game._globals[kTimebombStatus] == TIMEBOMB_ACTIVATED) { + _globals[kTimebombStatus] = TIMEBOMB_DEAD; + _globals._timebombTimer = 0; + _globals[kCheckDaemonTimebomb] = false; + _scene->_nextSceneId = 620; + } +} + +void Scene752::preActions() { + if (_action.isAction(VERB_WALKTO, 0x4A9)) { + _game._player._walkOffScreenSceneId = 751; + } +} + +void Scene752::actions() { + if (_action.isAction(0x312, 0x22C)) { + _action._inProgress = false; + } else if (_action.isAction(0x2F9, 0x16C)) { + _game._player._stepEnabled = false; + _game._player._visible = false; + _scene->_nextSceneId = 711; + _action._inProgress = false; + } else if (_action.isAction(VERB_TAKE, 0xB3)) { + // Take ID card + if (!_game._objects.isInInventory(OBJ_ID_CARD) || _game._trigger) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[12] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[12], false, 5, 2, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[12]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SEQUENCE_TRIGGER_SPRITE, 4, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + case 1: + _vm->_sound->command(0xF); + _scene->_sequences.remove(_globals._sequenceIndexes[13]); + _game._objects.addToInventory(OBJ_ID_CARD); + _scene->_dynamicHotspots.remove(_cardId); + _vm->_dialogs->show(OBJ_ID_CARD, 830); + break; + case 2: + _game._player._visible = true; + _game._player._stepEnabled = true; + break; + default: + break; + } + + _action._inProgress = false; + } + } else if (_action.isAction(VERB_TAKE, 0x2D) && _action._mainObjectSource == 4) { + // Take bones + if (!_game._objects.isInInventory(OBJ_BONES) || _game._trigger) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[12] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[12], false, 5, 2, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[12]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SEQUENCE_TRIGGER_SPRITE, 4, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + case 1: + _vm->_sound->command(0xF); + if (_game._objects.isInInventory(OBJ_BONE)) + _game._objects.setRoom(OBJ_BONE, NOWHERE); + _game._objects.addToInventory(OBJ_BONES); + _vm->_dialogs->show(OBJ_BONES, 75221); + break; + case 2: + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[12]); + _game._player._visible = true; + _game._player._stepEnabled = true; + break; + default: + break; + } + + _action._inProgress = false; + } + } else if (_action.isAction(VERB_LOOK, 0x38F)) { + if (_globals[kLaserHoleIsThere]) + _vm->_dialogs->show(75212); + else + _vm->_dialogs->show(75210); + + _action._inProgress = false; + } else if (_action.isAction(VERB_LOOK, 0x22C)) { + _vm->_dialogs->show(75213); + _action._inProgress = false; + } else if (_action.isAction(VERB_LOOK, 0x38E)) { + _vm->_dialogs->show(75214); + _action._inProgress = false; + } else if (_action.isAction(VERB_LOOK, 0x128)) { + _vm->_dialogs->show(75215); + _action._inProgress = false; + } else if (_action.isAction(VERB_TAKE, 0x128)) { + _vm->_dialogs->show(75216); + _action._inProgress = false; + } else if (_action.isAction(VERB_LOOK, 0x4A9)) { + _vm->_dialogs->show(75217); + _action._inProgress = false; + } else if (_action.isAction(VERB_LOOK, 0x16C)) { + _vm->_dialogs->show(75218); + _action._inProgress = false; + } else if ((_action.isAction(VERB_LOOK, 0x2D) || _action.isAction(VERB_LOOK, 0xB3)) && _action._mainObjectSource == 4) { + if (_game._objects[OBJ_ID_CARD]._roomNumber == 752) + _vm->_dialogs->show(75219); + else + _vm->_dialogs->show(75220); + _action._inProgress = false; + } else if (_action.isAction(VERB_TAKE, 0x2D) && _action._mainObjectSource == 4) { + if (_game._objects.isInInventory(OBJ_BONES)) + _vm->_dialogs->show(75222); + _action._inProgress = false; + } +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes7.h b/engines/mads/nebular/nebular_scenes7.h index 0f4947f38f..546f024deb 100644 --- a/engines/mads/nebular/nebular_scenes7.h +++ b/engines/mads/nebular/nebular_scenes7.h @@ -86,6 +86,21 @@ public: virtual void postActions() {}; }; +class Scene752: public Scene7xx { +private: + int _cardId; + +public: + Scene752(MADSEngine *vm) : Scene7xx(vm), _cardId(-1) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 0c079f4d6958e295a2c4d666d106c66505d55380 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 6 May 2014 22:49:57 -0400 Subject: MADS: Fixes for correctly setting up grey fading palette intensities --- engines/mads/palette.cpp | 17 +++++++++++------ engines/mads/palette.h | 10 ++++++++-- engines/mads/staticres.cpp | 7 ++++++- engines/mads/staticres.h | 3 ++- 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index aa227bf8e8..6beaad9787 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -442,8 +442,8 @@ void Fader::mapToGreyRamp(byte palette[PALETTE_SIZE], int baseColor, int numColo int greyAccum = 0; int firstColor = 0; - for (int greyCtr = 0; greyCtr < 64; greyCtr++) { - for (int idx = 0; idx < greyTable[greyCtr]; idx++) { + for (int greyCtr = 0; greyCtr < 64; ++greyCtr) { + for (int idx = 0; idx < greyTable[greyCtr]; ++idx) { greySum += greyList[greyScan++]._list; ++greyColors; @@ -467,7 +467,7 @@ void Fader::mapToGreyRamp(byte palette[PALETTE_SIZE], int baseColor, int numColo } } - // Process palette with intensities + // Set the palette range of greyscale values to be used byte *palP = &palette[baseGrey * 3]; for (int greys = 0; greys < numGreys; ++greys) { for (int color = 0; color < 3; ++color) { @@ -499,9 +499,8 @@ void Fader::getGreyValues(const byte palette[PALETTE_SIZE], void Fader::greyPopularity(const GreyTableEntry greyList[PALETTE_COUNT], byte greyTable[64], int numColors) { Common::fill(&greyTable[0], &greyTable[64], 0); - for (int i = 0; i < 64; ++i) { + for (int i = 0; i < numColors; ++i) { int idx = greyList[i]._list; - assert(idx >= 0 && idx < 64); ++greyTable[idx]; } } @@ -645,7 +644,13 @@ void Palette::initVGAPalette(byte *palette) { byte *destP = palette; for (int palIndex = 0; palIndex < 16; ++palIndex) { for (int byteCtr = 2; byteCtr >= 0; --byteCtr) - *destP++ = ((DEFAULT_VGA_PALETTE[palIndex] >> (8 * byteCtr)) & 0xff) >> 2; + *destP++ = ((DEFAULT_VGA_LOW_PALETTE[palIndex] >> (8 * byteCtr)) & 0xff) >> 2; + } + + destP = &palette[0xF0 * 3]; + for (int palIndex = 0; palIndex < 16; ++palIndex) { + for (int byteCtr = 2; byteCtr >= 0; --byteCtr) + *destP++ = ((DEFAULT_VGA_HIGH_PALETTE[palIndex] >> (8 * byteCtr)) & 0xff) >> 2; } } diff --git a/engines/mads/palette.h b/engines/mads/palette.h index 1beadd4c16..9bf5bfa830 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -220,9 +220,15 @@ public: setPalette(&palette[0], 0, PALETTE_COUNT); } - int rgbMerge(byte r, byte g, byte b); + /** + * Calculates a merge/hash for a given palette entry + */ + static int rgbMerge(byte r, byte g, byte b); - int rgbMerge(RGB6 &palEntry); + /** + * Calculates a merge/hash for a given palette entry + */ + static int rgbMerge(RGB6 &palEntry); /** * Fades the given palette to greyscale diff --git a/engines/mads/staticres.cpp b/engines/mads/staticres.cpp index 396e5a13d2..189e5f72e7 100644 --- a/engines/mads/staticres.cpp +++ b/engines/mads/staticres.cpp @@ -45,9 +45,14 @@ const char *const kOverStr = "over"; const char *const kGameReleaseInfoStr = "ScummVM rev: 8.43 14-Sept-92"; const char *const kGameReleaseTitleStr = "GAME RELASE VERSION INFO"; -const uint32 DEFAULT_VGA_PALETTE[16] = { +const uint32 DEFAULT_VGA_LOW_PALETTE[16] = { 0x000000, 0x0000a8, 0x00a800, 0x00a8a8, 0xa80000, 0xa800a8, 0xa85400, 0xa8a8a8, 0x545454, 0x5454fc, 0x54fc54, 0x54fcfc, 0xfc5454, 0xfc54fc, 0xfcfc54, 0xfcfcfc }; +const uint32 DEFAULT_VGA_HIGH_PALETTE[16] = { + 0x2c402c, 0x2c4030, 0x2c4034, 0x2c403c, 0x2c4040, 0x2c3c40, 0x2c3440, 0x2c3040, + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000 +}; + } // End of namespace MADS diff --git a/engines/mads/staticres.h b/engines/mads/staticres.h index 0680455028..560fd12e67 100644 --- a/engines/mads/staticres.h +++ b/engines/mads/staticres.h @@ -39,7 +39,8 @@ extern const char *const kOverStr; extern const char *const kGameReleaseInfoStr; extern const char *const kGameReleaseTitleStr; -extern const uint32 DEFAULT_VGA_PALETTE[16]; +extern const uint32 DEFAULT_VGA_LOW_PALETTE[16]; +extern const uint32 DEFAULT_VGA_HIGH_PALETTE[16]; } // End of namespace MADS -- cgit v1.2.3 From b3cc8db37012aaf035a58adf5a3232ea056f5d95 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 7 May 2014 07:03:14 +0200 Subject: MADS: Rename difficulty constants to match IDB, implement scene 504 --- engines/mads/nebular/game_nebular.cpp | 6 +- engines/mads/nebular/game_nebular.h | 2 +- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes1.cpp | 6 +- engines/mads/nebular/nebular_scenes2.cpp | 2 +- engines/mads/nebular/nebular_scenes3.cpp | 2 +- engines/mads/nebular/nebular_scenes5.cpp | 207 ++++++++++++++++++++++++++++++- engines/mads/nebular/nebular_scenes5.h | 15 +++ 8 files changed, 227 insertions(+), 15 deletions(-) diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index 546fdbea7c..9d6bf894cc 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -38,7 +38,7 @@ namespace Nebular { GameNebular::GameNebular(MADSEngine *vm): Game(vm) { _surface = new MSurface(MADS_SCREEN_WIDTH, MADS_SCENE_HEIGHT); _storyMode = STORYMODE_NAUGHTY; - _difficulty = DIFFICULTY_IMPOSSIBLE; + _difficulty = DIFFICULTY_EASY; } ProtectionResult GameNebular::checkCopyProtection() { @@ -212,7 +212,7 @@ void GameNebular::initialiseGlobals() { _globals[kLeavesStatus] = LEAVES_ON_TRAP; break; - case DIFFICULTY_REALLY_HARD: + case DIFFICULTY_MEDIUM: _objects.setRoom(OBJ_PLANT_STALK, NOWHERE); _globals[kLeavesStatus] = LEAVES_ON_GROUND; @@ -220,7 +220,7 @@ void GameNebular::initialiseGlobals() { _globals[kPenlightCellStatus] = FIRST_TIME_CHARGED_DURAFAIL; break; - case DIFFICULTY_IMPOSSIBLE: + case DIFFICULTY_EASY: _objects.setRoom(OBJ_BLOWGUN, NOWHERE); _objects.setRoom(OBJ_NOTE, NOWHERE); diff --git a/engines/mads/nebular/game_nebular.h b/engines/mads/nebular/game_nebular.h index 0c859fadff..e754a11245 100644 --- a/engines/mads/nebular/game_nebular.h +++ b/engines/mads/nebular/game_nebular.h @@ -35,7 +35,7 @@ namespace Nebular { enum StoryMode { STORYMODE_NAUGHTY = 1, STORYMODE_NICE = 2 }; enum Difficulty { - DIFFICULTY_HARD = 1, DIFFICULTY_REALLY_HARD = 2, DIFFICULTY_IMPOSSIBLE = 3 + DIFFICULTY_HARD = 1, DIFFICULTY_MEDIUM = 2, DIFFICULTY_EASY = 3 }; enum InventoryObject { diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 19c98246ac..e7da6cfa4d 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -203,7 +203,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 503: // guard tower return new Scene503(vm); case 504: // inside car - return new DummyScene(vm); // TODO + return new Scene504(vm); case 505: // car view screen return new DummyScene(vm); // TODO case 506: // shopping street diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index f68a613d5b..08c5b08129 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -977,7 +977,7 @@ void Scene102::actions() { _action._inProgress = false; return; } - } else if (_action.isAction(VERB_LOOK) || (_game._difficulty != DIFFICULTY_IMPOSSIBLE)) { + } else if (_action.isAction(VERB_LOOK) || (_game._difficulty != DIFFICULTY_EASY)) { _vm->_dialogs->show(0x27EE); _action._inProgress = false; return; @@ -2519,7 +2519,7 @@ void Scene109::actions() { break; case OBJ_BURGER: - _hoovicDifficultFl = (_game._difficulty == DIFFICULTY_IMPOSSIBLE); + _hoovicDifficultFl = (_game._difficulty == DIFFICULTY_EASY); _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('H', (_hoovicDifficultFl ? 3 : 1))); break; } @@ -2592,7 +2592,7 @@ void Scene109::actions() { case DIFFICULTY_HARD: threshold = 1; break; - case DIFFICULTY_REALLY_HARD: + case DIFFICULTY_MEDIUM: threshold = 3; break; default: diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index c4f5fe3c57..46a2a7875c 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -1673,7 +1673,7 @@ void Scene208::actions() { } else if (_action.isAction(VERB_LOOK, NOUN_PILE_OF_LEAVES)) { _vm->_dialogs->show(0x5149); } else if (_action.isAction(VERB_LOOK, NOUN_LEAF_COVERED_PIT)) { - if (_game._difficulty == DIFFICULTY_IMPOSSIBLE) + if (_game._difficulty == DIFFICULTY_EASY) _vm->_dialogs->show(0x514A); else _vm->_dialogs->show(0x514B); diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index b8d07d9f06..17c310db73 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -2271,7 +2271,7 @@ void Scene316::actions() { _vm->_dialogs->show(0x7B82); else if (_action.isAction(VERB_LOOK, 0x2B9)) { if (!_globals[kAfterHavoc]) { - if (_game._difficulty != DIFFICULTY_IMPOSSIBLE) + if (_game._difficulty != DIFFICULTY_EASY) _vm->_dialogs->show(0x7B84); else _vm->_dialogs->show(0x7B83); diff --git a/engines/mads/nebular/nebular_scenes5.cpp b/engines/mads/nebular/nebular_scenes5.cpp index da8faa03d0..3e888acb7b 100644 --- a/engines/mads/nebular/nebular_scenes5.cpp +++ b/engines/mads/nebular/nebular_scenes5.cpp @@ -550,8 +550,8 @@ void Scene503::actions() { if ( _game._trigger || !_game._objects.isInInventory(OBJ_DETONATORS)) { switch (_game._trigger) { case 0: - _game._player._stepEnabled = false; - _game._player._visible = false; + _game._player._stepEnabled = false; + _game._player._visible = false; if (_globals[kSexOfRex] == REX_MALE) { _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 3); @@ -569,7 +569,7 @@ void Scene503::actions() { case 1: _vm->_sound->command(9); - _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _scene->_sequences.remove(_globals._sequenceIndexes[1]); _scene->_dynamicHotspots.remove(_detonatorHotspotId); _game._objects.addToInventory(OBJ_DETONATORS); _vm->_dialogs->showItem(OBJ_DETONATORS, 50326); @@ -581,13 +581,13 @@ void Scene503::actions() { else _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[3]); - _game._player._visible = true; + _game._player._visible = true; _game._player._stepEnabled = true; break; default: break; - } + } } } else if (_action._lookFlag) _vm->_dialogs->show(50328); @@ -636,5 +636,202 @@ void Scene503::actions() { /*------------------------------------------------------------------------*/ +void Scene504::setup() { + _game._player._spritesPrefix = ""; + setAAName(); +} + +void Scene504::enter() { + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('a', 2)); + + for (int i = 0; i < 4; i++) + _globals._spriteIndexes[5 + i] = _scene->_sprites.addSprites(formAnimName('m', i)); + + if (_globals[kSexOfRex] == REX_MALE) + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('a', 0)); + else { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('a', 1)); + _scene->changeVariant(1); + } + + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 0); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 6, 0, 0, 0); + _carFrame = -1; + + if ((_scene->_priorSceneId == 505) && (_globals[kHoverCarDestination] != _globals[kHoverCarLocation])){ + _carAnimationMode = 1; + _scene->loadAnimation(formAnimName('A', -1)); + _vm->_sound->command(14); + _scene->_sequences.addTimer(1, 70); + _game._player._stepEnabled = false; + } else { + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('a', 3)); + _carAnimationMode = 1; + _scene->loadAnimation(formAnimName('A', -1)); + if ((_scene->_priorSceneId != -2) && (_scene->_priorSceneId != 505)) + _globals[kHoverCarLocation] = _scene->_priorSceneId; + + _globals._sequenceIndexes[7] = _scene->_sequences.startCycle(_globals._spriteIndexes[7], false, 1); + } + + if (_globals[kTimebombTimer] > 10500) + _globals[kTimebombTimer] = 10500; + + sceneEntrySound(); +} + +void Scene504::step() { + if ((_carAnimationMode == 1) && (_scene->_activeAnimation != nullptr)) { + if (_scene->_activeAnimation->getCurrentFrame() != _carFrame) { + _carFrame = _scene->_activeAnimation->getCurrentFrame(); + int nextFrame; + + if (_carFrame == 1) + nextFrame = 0; + else + nextFrame = -1; + + if ((nextFrame >= 0) && (nextFrame != _scene->_activeAnimation->getCurrentFrame())) { + _scene->_activeAnimation->setCurrentFrame(nextFrame); + _carFrame = nextFrame; + } + } + } + + + if (_game._trigger >= 70) { + switch (_game._trigger) { + case 70: + if (_globals[kHoverCarDestination] != -1) { + _game._player._stepEnabled = false; + _scene->freeAnimation(); + _carAnimationMode = 2; + if (((_globals[kHoverCarLocation] >= 500 && _globals[kHoverCarLocation] <= 599) && + (_globals[kHoverCarDestination] >= 500 && _globals[kHoverCarDestination] <= 599)) || + ((_globals[kHoverCarLocation] >= 600 && _globals[kHoverCarLocation] <= 699) && + (_globals[kHoverCarDestination] >= 600 && _globals[kHoverCarDestination] <= 699))) { + _scene->loadAnimation(formAnimName('A', -1), 71); + } else if (_globals[kHoverCarLocation] > _globals[kHoverCarDestination]) + _scene->loadAnimation(formAnimName('C', -1), 71); + else + _scene->loadAnimation(formAnimName('B', -1), 71); + } + break; + + case 71: + _vm->_sound->command(15); + _scene->_nextSceneId = _globals[kHoverCarDestination]; + break; + + default: + break; + } + } + + if ((_globals[kTimebombTimer] >= 10800) && (_globals[kTimebombStatus] == 1) && (_game._difficulty != 3)) { + _globals[kTimebombStatus] = TIMEBOMB_DEAD; + _globals[kTimebombTimer] = 0; + _globals[kCheckDaemonTimebomb] = false; + _scene->_nextSceneId = 620; + } +} + +void Scene504::preActions() { + _game._player._needToWalk = false; +} + +void Scene504::actions() { + if (_action.isAction(0x1CE, 0x324)) { + _vm->_sound->command(15); + _scene->_nextSceneId = _globals[kHoverCarLocation]; + } else if (_action.isAction(0xE, 0x380)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _vm->_sound->command(39); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 13); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 1); + _scene->_sequences.remove(_globals._sequenceIndexes[7]); + _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 18, 0, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 14); + break; + + case 1: { + int syncIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 13); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 6); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], syncIdx); + } + break; + + case 2: + _scene->_sequences.addTimer(10, 3); + break; + + case 3: + _scene->_sequences.remove(_globals._sequenceIndexes[5]); + if (_globals[kSexOfRex] == REX_MALE) { + _vm->_sound->command(34); + _scene->_sequences.addTimer(60, 4); + _globals._sequenceIndexes[6] = _scene->_sequences.startCycle(_globals._spriteIndexes[6], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 14); + } else { + _vm->_sound->command(40); + _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 18, 0, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[8], 14); + _scene->_sequences.addTimer(120, 5); + } + break; + + case 4: + _game._player._stepEnabled = true; + _globals[kHoverCarDestination] = _globals[kHoverCarLocation]; + _scene->_nextSceneId = 505; + break; + + case 5: + _game._player._stepEnabled = true; + _scene->_sequences.remove(_globals._sequenceIndexes[8]); + _globals._sequenceIndexes[7] = _scene->_sequences.startCycle(_globals._spriteIndexes[7], false, 1); + _vm->_dialogs->show(50421); + break; + + default: + break; + } + } else if ((_action._lookFlag) || _action.isAction(VERB_LOOK, 0x388)) + _vm->_dialogs->show(50412); + else if (_action.isAction(VERB_LOOK, 0x383)) + _vm->_dialogs->show(50410); + else if (_action.isAction(VERB_LOOK, 0x380) || _action.isAction(VERB_LOOK, 0x387)) + _vm->_dialogs->show(50411); + else if (_action.isAction(VERB_LOOK, 0x381)) + _vm->_dialogs->show(50413); + else if (_action.isAction(VERB_LOOK, 0x385)) + _vm->_dialogs->show(50414); + else if (_action.isAction(VERB_LOOK, 0x382)) + _vm->_dialogs->show(50415); + else if (_action.isAction(VERB_LOOK, 0x386) || _action.isAction(0xD3, 0x386)) + _vm->_dialogs->show(50416); + else if (_action.isAction(VERB_LOOK, 0x120)) + _vm->_dialogs->show(50417); + else if (_action.isAction(VERB_TAKE, 0x120)) + _vm->_dialogs->show(50418); + else if (_action.isAction(VERB_LOOK, 0x384)) + _vm->_dialogs->show(50419); + else if (_action.isAction(VERB_TAKE, 0x384)) + _vm->_dialogs->show(50420); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes5.h b/engines/mads/nebular/nebular_scenes5.h index 0b29c92645..5336ceee94 100644 --- a/engines/mads/nebular/nebular_scenes5.h +++ b/engines/mads/nebular/nebular_scenes5.h @@ -97,6 +97,21 @@ public: virtual void postActions() {}; }; +class Scene504: public Scene5xx{ +private: + int _carAnimationMode; + int _carFrame; + +public: + Scene504(MADSEngine *vm) : Scene5xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 8dfddac863cb039f405fac6b1236c0c0e0004354 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 7 May 2014 13:25:15 +0300 Subject: MADS: Implement Rex Nebular scene 702 and add some nouns --- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes.h | 20 +++- engines/mads/nebular/nebular_scenes7.cpp | 159 +++++++++++++++++++++++++++---- engines/mads/nebular/nebular_scenes7.h | 12 +++ 4 files changed, 169 insertions(+), 24 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index e7da6cfa4d..5f107881a8 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -253,7 +253,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 701: // outside elevator (after city is submerged) return new DummyScene(vm); // TODO case 702: // outside teleporter (after city is submerged) - return new DummyScene(vm); // TODO + return new Scene702(vm); case 703: // water return new DummyScene(vm); // TODO case 704: // water, building in the distance diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index e1fcf1e48d..0db8b93d8b 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -40,12 +40,13 @@ enum { enum Noun { NOUN_BIG_LEAVES = 0x23, - NOUN_BLOWGUN = 0x29, + NOUN_BLOWGUN = 0x29, NOUN_BOMB = 0x2A, NOUN_BOMBS = 0x2B, NOUN_BONE = 0x2C, - NOUN_BURGER = 0x35, - NOUN_CHAIR = 0x47, + NOUN_BONES = 0x2D, + NOUN_BURGER = 0x35, + NOUN_CHAIR = 0x47, NOUN_CHICKEN = 0x49, NOUN_CHICKEN_BOMB = 0x4A, NOUN_DEAD_FISH = 0x65, @@ -58,6 +59,7 @@ enum Noun { NOUN_HOTPANTS = 0x0A7, NOUN_HULL = 0x0A8, NOUN_HURL = 0x0A9, + NOUN_ID_CARD = 0x0B3, NOUN_IGNITE = 0x0B4, NOUN_INFLATE = 0x0B5, NOUN_INSERT = 0x0B6, @@ -78,11 +80,13 @@ enum Noun { NOUN_READ = 0x11F, NOUN_REFRIDGERATOR = 0x122, NOUN_ROBO_KITCHEN = 0x127, + NOUN_ROCK = 0x128, NOUN_SHIELD_ACCESS_PANEL = 0x135, NOUN_SHIELD_MODULATOR = 0x137, NOUN_SHOOT = 0x13A, NOUN_SIT_IN = 0x13F, NOUN_SKULL = 0x140, + NOUN_TELEPORTER = 0x16C, NOUN_BROKEN_LADDER = 0x1C9, NOUN_SMELL = 0x147, NOUN_STUFFED_FISH = 0x157, @@ -97,12 +101,18 @@ enum Noun { NOUN_PILE_OF_LEAVES = 0x1AA, NOUN_CAPTIVE_CREATURE = 0x1C3, NOUN_NATIVE_WOMAN = 0x1DC, - NOUN_ALCOHOL = 0x310, + NOUN_PLATFORM = 0x22C, + NOUN_ALCOHOL = 0x310, + NOUN_SUBMERGED_CITY = 0x313, + NOUN_LASER_BEAM = 0x343, + NOUN_CEMENT_BLOCK = 0x38E, + NOUN_CITY = 0x38F, NOUN_DOLLOP = 0x3AC, NOUN_DROP = 0x3AD, NOUN_DASH = 0x3AE, NOUN_SPLASH = 0x3AF, - NOUN_BIRDS = 0x487 + NOUN_BIRDS = 0x487, + NOUN_WEST_END_OF_PLATFORM = 0x4A9 }; class SceneFactory { diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index 54acabf755..4ae2925c72 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -30,6 +30,13 @@ namespace MADS { namespace Nebular { +// Scene 7xx verbs +enum { + VERB_LOOK_AT = 0xD1, + VERB_WALK_ALONG = 0x312, + VERB_STEP_INTO = 0x2F9 +}; + void Scene7xx::setAAName() { _game._aaName = Resources::formatAAName(5); } @@ -90,6 +97,122 @@ void Scene7xx::sceneEntrySound() { /*------------------------------------------------------------------------*/ +void Scene702::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene702::enter() { + _globals._spriteIndexes[12] = _scene->_sprites.addSprites("*RXMBD_8"); + + if (_scene->_priorSceneId == 701) { + _game._player._playerPos = Common::Point(13, 145); + _game._player._facing = FACING_EAST; + } else if (_scene->_priorSceneId != -2 && _scene->_priorSceneId != 620) { + _game._player._playerPos = Common::Point(289, 138); + _game._player.walk(Common::Point(262, 148), FACING_WEST); + _game._player._facing = FACING_WEST; + _game._player._visible = true; + } + + if (_game._globals[kTeleporterCommand]) { + switch(_game._globals[kTeleporterCommand]) { + case TELEPORTER_BEAM_OUT: + case TELEPORTER_WRONG: + case TELEPORTER_STEP_OUT: + _game._player._visible = true; + _game._player._stepEnabled = true; + break; + default: + break; + } + + _game._globals[kTeleporterCommand] = TELEPORTER_NONE; + } + + sceneEntrySound(); +} + +void Scene702::preActions() { + if (_action.isAction(VERB_WALKTO, NOUN_WEST_END_OF_PLATFORM)) { + _game._player._walkOffScreenSceneId = 701; + } +} + +void Scene702::actions() { + if (_action.isAction(VERB_WALK_ALONG, NOUN_PLATFORM)) { + _action._inProgress = false; + } else if (_action.isAction(VERB_STEP_INTO, NOUN_TELEPORTER)) { + _game._player._stepEnabled = false; + _game._player._visible = false; + _scene->_nextSceneId = 711; + _action._inProgress = false; + } else if (_action.isAction(VERB_TAKE, NOUN_BONES) && _action._mainObjectSource == 4) { + // Take bones + if (!_game._objects.isInInventory(OBJ_BONES) || _game._trigger) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[12] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[12], false, 5, 2, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[12]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SEQUENCE_TRIGGER_SPRITE, 4, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + case 1: + _vm->_sound->command(0xF); + if (_game._objects.isInInventory(OBJ_BONE)) + _game._objects.setRoom(OBJ_BONE, NOWHERE); + _game._objects.addToInventory(OBJ_BONES); + _vm->_dialogs->show(OBJ_BONES, 70218); + break; + case 2: + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[12]); + _game._player._visible = true; + _game._player._stepEnabled = true; + break; + default: + break; + } + + _action._inProgress = false; + } + } else if (_action._lookFlag) { + _vm->_dialogs->show(70210); + _action._inProgress = false; + } else if (_action.isAction(VERB_LOOK, NOUN_PLATFORM)) { + _vm->_dialogs->show(70211); + _action._inProgress = false; + } else if (_action.isAction(VERB_LOOK, NOUN_CEMENT_BLOCK)) { + _vm->_dialogs->show(70212); + _action._inProgress = false; + } else if (_action.isAction(VERB_LOOK, NOUN_ROCK)) { + _vm->_dialogs->show(70213); + _action._inProgress = false; + } else if (_action.isAction(VERB_TAKE, NOUN_ROCK)) { + _vm->_dialogs->show(70214); + _action._inProgress = false; + } else if (_action.isAction(VERB_LOOK, NOUN_WEST_END_OF_PLATFORM)) { + _vm->_dialogs->show(70215); + _action._inProgress = false; + } else if (_action.isAction(VERB_LOOK, NOUN_TELEPORTER)) { + _vm->_dialogs->show(70216); + _action._inProgress = false; + } else if (_action.isAction(VERB_LOOK, NOUN_BONES) && _action._mainObjectSource == 4) { + _vm->_dialogs->show(70217); + _action._inProgress = false; + } else if (_action.isAction(VERB_TAKE, NOUN_BONES) && _action._mainObjectSource == 4) { + if (_game._objects.isInInventory(OBJ_BONES)) + _vm->_dialogs->show(70219); + _action._inProgress = false; + } else if (_action.isAction(VERB_LOOK, NOUN_SUBMERGED_CITY)) { + _vm->_dialogs->show(70220); + _action._inProgress = false; + } +} + +/*------------------------------------------------------------------------*/ + void Scene707::setup() { _game._player._spritesPrefix = ""; // The original calls Scene7xx::setAAName() @@ -233,10 +356,10 @@ void Scene752::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(0xB3); + _scene->addActiveVocab(NOUN_ID_CARD); _scene->addActiveVocab(VERB_WALKTO); - _scene->addActiveVocab(0xD1); - _scene->addActiveVocab(0x343); + _scene->addActiveVocab(VERB_LOOK_AT); + _scene->addActiveVocab(NOUN_LASER_BEAM); } void Scene752::enter() { @@ -264,7 +387,7 @@ void Scene752::enter() { if (_game._globals[kLaserHoleIsThere]) { _globals._sequenceIndexes[14] = _scene->_sequences.startCycle(_globals._spriteIndexes[14], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[14], 13); - int idx = _scene->_dynamicHotspots.add(0x343, 0xD1, _globals._sequenceIndexes[14], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_LASER_BEAM, VERB_LOOK_AT, _globals._sequenceIndexes[14], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(215, 130), FACING_NORTHWEST); } @@ -299,20 +422,20 @@ void Scene752::step() { } void Scene752::preActions() { - if (_action.isAction(VERB_WALKTO, 0x4A9)) { + if (_action.isAction(VERB_WALKTO, NOUN_WEST_END_OF_PLATFORM)) { _game._player._walkOffScreenSceneId = 751; } } void Scene752::actions() { - if (_action.isAction(0x312, 0x22C)) { + if (_action.isAction(VERB_WALK_ALONG, NOUN_PLATFORM)) { _action._inProgress = false; - } else if (_action.isAction(0x2F9, 0x16C)) { + } else if (_action.isAction(VERB_STEP_INTO, NOUN_TELEPORTER)) { _game._player._stepEnabled = false; _game._player._visible = false; _scene->_nextSceneId = 711; _action._inProgress = false; - } else if (_action.isAction(VERB_TAKE, 0xB3)) { + } else if (_action.isAction(VERB_TAKE, NOUN_ID_CARD)) { // Take ID card if (!_game._objects.isInInventory(OBJ_ID_CARD) || _game._trigger) { switch (_game._trigger) { @@ -341,7 +464,7 @@ void Scene752::actions() { _action._inProgress = false; } - } else if (_action.isAction(VERB_TAKE, 0x2D) && _action._mainObjectSource == 4) { + } else if (_action.isAction(VERB_TAKE, NOUN_BONES) && _action._mainObjectSource == 4) { // Take bones if (!_game._objects.isInInventory(OBJ_BONES) || _game._trigger) { switch (_game._trigger) { @@ -371,38 +494,38 @@ void Scene752::actions() { _action._inProgress = false; } - } else if (_action.isAction(VERB_LOOK, 0x38F)) { + } else if (_action._lookFlag || _action.isAction(VERB_LOOK, NOUN_CITY)) { if (_globals[kLaserHoleIsThere]) _vm->_dialogs->show(75212); else _vm->_dialogs->show(75210); _action._inProgress = false; - } else if (_action.isAction(VERB_LOOK, 0x22C)) { + } else if (_action.isAction(VERB_LOOK, NOUN_PLATFORM)) { _vm->_dialogs->show(75213); _action._inProgress = false; - } else if (_action.isAction(VERB_LOOK, 0x38E)) { + } else if (_action.isAction(VERB_LOOK, NOUN_CEMENT_BLOCK)) { _vm->_dialogs->show(75214); _action._inProgress = false; - } else if (_action.isAction(VERB_LOOK, 0x128)) { + } else if (_action.isAction(VERB_LOOK, NOUN_ROCK)) { _vm->_dialogs->show(75215); _action._inProgress = false; - } else if (_action.isAction(VERB_TAKE, 0x128)) { + } else if (_action.isAction(VERB_TAKE, NOUN_ROCK)) { _vm->_dialogs->show(75216); _action._inProgress = false; - } else if (_action.isAction(VERB_LOOK, 0x4A9)) { + } else if (_action.isAction(VERB_LOOK, NOUN_WEST_END_OF_PLATFORM)) { _vm->_dialogs->show(75217); _action._inProgress = false; - } else if (_action.isAction(VERB_LOOK, 0x16C)) { + } else if (_action.isAction(VERB_LOOK, NOUN_TELEPORTER)) { _vm->_dialogs->show(75218); _action._inProgress = false; - } else if ((_action.isAction(VERB_LOOK, 0x2D) || _action.isAction(VERB_LOOK, 0xB3)) && _action._mainObjectSource == 4) { + } else if ((_action.isAction(VERB_LOOK, NOUN_BONES) || _action.isAction(VERB_LOOK, NOUN_ID_CARD)) && _action._mainObjectSource == 4) { if (_game._objects[OBJ_ID_CARD]._roomNumber == 752) _vm->_dialogs->show(75219); else _vm->_dialogs->show(75220); _action._inProgress = false; - } else if (_action.isAction(VERB_TAKE, 0x2D) && _action._mainObjectSource == 4) { + } else if (_action.isAction(VERB_TAKE, NOUN_BONES) && _action._mainObjectSource == 4) { if (_game._objects.isInInventory(OBJ_BONES)) _vm->_dialogs->show(75222); _action._inProgress = false; diff --git a/engines/mads/nebular/nebular_scenes7.h b/engines/mads/nebular/nebular_scenes7.h index 546f024deb..66a42de87d 100644 --- a/engines/mads/nebular/nebular_scenes7.h +++ b/engines/mads/nebular/nebular_scenes7.h @@ -50,6 +50,18 @@ public: Scene7xx(MADSEngine *vm) : NebularScene(vm) {} }; +class Scene702: public Scene7xx { +public: + Scene702(MADSEngine *vm) : Scene7xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step() {} + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; + class Scene707: public SceneTeleporter { public: Scene707(MADSEngine *vm) : SceneTeleporter(vm) {} -- cgit v1.2.3 From fdc3424eabaad59ec33f747556a11b282d3f8207 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 7 May 2014 21:04:38 +0300 Subject: MADS: Synchronize local scene variables for Rex scene group 1 --- engines/mads/nebular/nebular_scenes1.cpp | 43 ++++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes1.h | 6 +++++ 2 files changed, 49 insertions(+) diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 08c5b08129..8dca4e9c6b 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -1893,6 +1893,11 @@ void Scene105::actions() { _action._inProgress = false; } +void Scene105::synchronize(Common::Serializer &s) { + Scene1xx::synchronize(s); + s.syncAsByte(_explosionFl); +} + /*------------------------------------------------------------------------*/ void Scene106::setup() { @@ -2100,6 +2105,14 @@ void Scene106::actions() { _action._inProgress = false; } +void Scene106::synchronize(Common::Serializer &s) { + Scene1xx::synchronize(s); + s.syncAsByte(_backToShipFl); + s.syncAsByte(_shadowFl); + s.syncAsByte(_firstEmergingFl); + s.syncAsSint32LE(_msgPosY); +} + /*------------------------------------------------------------------------*/ void Scene107::setup() { @@ -2212,6 +2225,12 @@ void Scene107::actions() { _action._inProgress = false; } +void Scene107::synchronize(Common::Serializer &s) { + Scene1xx::synchronize(s); + s.syncAsByte(_shootingFl); +} + + /*------------------------------------------------------------------------*/ void Scene108::setup() { @@ -2701,6 +2720,17 @@ void Scene109::actions() { _action._inProgress = false; } +void Scene109::synchronize(Common::Serializer &s) { + Scene1xx::synchronize(s); + s.syncAsByte(_rexThrowingObject); + s.syncAsByte(_hoovicDifficultFl); + s.syncAsByte(_beforeEatingRex); + s.syncAsByte(_eatingRex); + s.syncAsByte(_hungryFl); + s.syncAsByte(_eatingFirstFish); + s.syncAsSint32LE(_throwingObjectId); + s.syncAsSint32LE(_hoovicTrigger); +} /*------------------------------------------------------------------------*/ @@ -2824,6 +2854,11 @@ void Scene110::actions() { _action._inProgress = false; } +void Scene110::synchronize(Common::Serializer &s) { + Scene1xx::synchronize(s); + s.syncAsByte(_crabsFl); +} + /*------------------------------------------------------------------------*/ void Scene111::setup() { @@ -2966,6 +3001,14 @@ void Scene111::actions() { _action._inProgress = false; } +void Scene111::synchronize(Common::Serializer &s) { + Scene1xx::synchronize(s); + s.syncAsByte(_stampedFl); + s.syncAsByte(_launch1Fl); + s.syncAsByte(_launched2Fl); + s.syncAsByte(_rexDivingFl); +} + /*------------------------------------------------------------------------*/ void Scene112::setup() { diff --git a/engines/mads/nebular/nebular_scenes1.h b/engines/mads/nebular/nebular_scenes1.h index 7a421561e7..38caf1560e 100644 --- a/engines/mads/nebular/nebular_scenes1.h +++ b/engines/mads/nebular/nebular_scenes1.h @@ -146,6 +146,7 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); + virtual void synchronize(Common::Serializer &s); }; class Scene106 : public Scene1xx { @@ -164,6 +165,7 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); + virtual void synchronize(Common::Serializer &s); }; class Scene107 : public Scene1xx { @@ -178,6 +180,7 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); + virtual void synchronize(Common::Serializer &s); }; class Scene108 : public Scene1xx { @@ -210,6 +213,7 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); + virtual void synchronize(Common::Serializer &s); }; class Scene110 : public Scene1xx { @@ -224,6 +228,7 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); + virtual void synchronize(Common::Serializer &s); }; class Scene111 : public Scene1xx { @@ -241,6 +246,7 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); + virtual void synchronize(Common::Serializer &s); }; class Scene112 : public Scene1xx { -- cgit v1.2.3 From 025c13c2408dc6aebf0ecd54268307ad18ed9e05 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 7 May 2014 21:24:01 +0300 Subject: MADS: Synchronize local scene variables for Rex scene group 2 --- engines/mads/nebular/nebular_scenes2.cpp | 131 +++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes2.h | 10 +++ 2 files changed, 141 insertions(+) diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 46a2a7875c..2b6b7eeb74 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -333,6 +333,11 @@ void Scene201::actions() { _action._inProgress = false; } +void Scene201::synchronize(Common::Serializer &s) { + Scene2xx::synchronize(s); + s.syncAsByte(_pterodactylFlag); +} + /*------------------------------------------------------------------------*/ void Scene202::setup() { @@ -987,6 +992,26 @@ void Scene202::actions() { _action._inProgress = false; } +void Scene202::synchronize(Common::Serializer &s) { + Scene2xx::synchronize(s); + s.syncAsByte(_activeMsgFl); + s.syncAsByte(_ladderTopFl); + s.syncAsByte(_waitingMeteoFl); + s.syncAsByte(_toStationFl); + s.syncAsByte(_toTeleportFl); + + s.syncAsSint32LE(_ladderHotspotId); + s.syncAsSint32LE(_lastRoute); + s.syncAsSint32LE(_stationCounter); + s.syncAsSint32LE(_meteoFrame); + + s.syncAsUint32LE(_meteoClock1); + s.syncAsUint32LE(_meteoClock2); + s.syncAsUint32LE(_startTime); + + s.syncAsSint32LE(_meteorologistSpecial); +} + /*****************************************************************************/ void Scene203::setup() { @@ -1099,6 +1124,12 @@ void Scene203::actions() { _action._inProgress = false; } +void Scene203::synchronize(Common::Serializer &s) { + Scene2xx::synchronize(s); + s.syncAsByte(_rhotundaEat2Fl); + s.syncAsByte(_rhotundaEatFl); +} + /*****************************************************************************/ void Scene205::setup() { @@ -1231,6 +1262,13 @@ void Scene205::actions() { warning("TODO: Scene205::actions"); } +void Scene205::synchronize(Common::Serializer &s) { + Scene2xx::synchronize(s); + s.syncAsUint32LE(_lastFishTime); + s.syncAsUint32LE(_chickenTime); + s.syncAsByte(_beingKicked); +} + /*****************************************************************************/ void Scene207::setup() { @@ -1417,6 +1455,18 @@ void Scene207::actions() { _action._inProgress = false; } +void Scene207::synchronize(Common::Serializer &s) { + Scene2xx::synchronize(s); + s.syncAsByte(_vultureFl); + s.syncAsByte(_spiderFl); + s.syncAsByte(_eyeFl); + + s.syncAsSint32LE(_spiderHotspotId); + s.syncAsSint32LE(_vultureHotspotId); + s.syncAsSint32LE(_spiderTime); + s.syncAsSint32LE(_vultureTime); +} + /*****************************************************************************/ void Scene208::setup() { @@ -1698,6 +1748,14 @@ void Scene208::actions() { _action._inProgress = false; } +void Scene208::synchronize(Common::Serializer &s) { + Scene2xx::synchronize(s); + s.syncAsByte(_rhotundaTurnFl); + s.syncAsByte(_boundingFl); + + s.syncAsSint32LE(_rhotundaTime); +} + /*****************************************************************************/ void Scene209::setup() { @@ -3290,6 +3348,35 @@ void Scene209::actions() { } } +void Scene209::synchronize(Common::Serializer &s) { + Scene2xx::synchronize(s); + s.syncAsByte(_dodgeFl); + s.syncAsByte(_forceDodgeFl); + s.syncAsByte(_shouldDodgeFl); + s.syncAsByte(_pitchFl); + s.syncAsByte(_fallFl); + s.syncAsByte(_forceFallFl); + s.syncAsByte(_shouldFallFl); + s.syncAsByte(_playingAnimFl); + s.syncAsByte(_playingDialogFl); + + s.syncAsSint32LE(_pauseMode); + s.syncAsSint32LE(_pauseCounterThreshold); + s.syncAsSint32LE(_pauseCounter); + + s.syncAsByte(_removeMonkeyFl); + + s.syncAsSint32LE(_monkeyPosition); + + s.syncAsByte(_shootReadyFl); + s.syncAsByte(_startShootingInTimerFl); + s.syncAsByte(_shootMissedLastFl); + s.syncAsByte(_binocularsDroppedFl); + + s.syncAsSint32LE(_dialogAbortVal); + s.syncAsSint32LE(_counter); +} + /*****************************************************************************/ void Scene210::setup() { @@ -4262,6 +4349,33 @@ void Scene210::actions() { _action._inProgress = false; } +void Scene210::synchronize(Common::Serializer &s) { + Scene2xx::synchronize(s); + s.syncAsSint32LE(_curDialogNode); + s.syncAsSint32LE(_nextHandsPlace); + s.syncAsSint32LE(_twinkleAnimationType); + s.syncAsSint32LE(_twinklesCurrentFrame); + + s.syncAsByte(_shouldTalk); + s.syncAsByte(_shouldFaceRex); + s.syncAsByte(_shouldMoveHead); + s.syncAsByte(_stopWalking); + s.syncAsByte(_twinklesTalking); + s.syncAsByte(_twinklesTalk2); + + s.syncAsSint32LE(_doorway); + + s.syncString(_subQuote2); + + _conv1.synchronize(s); + _conv2.synchronize(s); + _conv3.synchronize(s); + _conv5.synchronize(s); + _conv6.synchronize(s); + _conv7.synchronize(s); + _conv8.synchronize(s); +} + /*------------------------------------------------------------------------*/ void Scene211::setup() { @@ -4525,6 +4639,16 @@ void Scene211::actions() { _action._inProgress = false; } +void Scene211::synchronize(Common::Serializer &s) { + Scene2xx::synchronize(s); + s.syncAsByte(_ambushFl); + s.syncAsByte(_wakeFl); + + s.syncAsSint32LE(_monkeyFrame); + s.syncAsSint32LE(_scrollY); + s.syncAsUint32LE(_monkeyTime); +} + /*------------------------------------------------------------------------*/ void Scene212::setup() { @@ -4852,6 +4976,13 @@ void Scene214::actions() { _action._inProgress = false; } +void Scene214::synchronize(Common::Serializer &s) { + Scene2xx::synchronize(s); + s.syncAsUint32LE(_devilTime); + + s.syncAsByte(_devilRunningFl); +} + /*------------------------------------------------------------------------*/ void Scene215::setup() { diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index 2f3512a61e..e8883b15e8 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -59,6 +59,7 @@ public: virtual void enter(); virtual void step(); virtual void actions(); + virtual void synchronize(Common::Serializer &s); }; class Scene202: public Scene2xx { @@ -82,6 +83,7 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); + virtual void synchronize(Common::Serializer &s); void setRandomKernelMessage(); }; @@ -97,6 +99,7 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); + virtual void synchronize(Common::Serializer &s); }; class Scene205: public Scene2xx { @@ -110,6 +113,7 @@ public: virtual void enter(); virtual void step(); virtual void actions(); + virtual void synchronize(Common::Serializer &s); }; class Scene207: public Scene2xx { @@ -128,6 +132,7 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); + virtual void synchronize(Common::Serializer &s); }; class Scene208: public Scene2xx { @@ -145,6 +150,7 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); + virtual void synchronize(Common::Serializer &s); }; class Scene209: public Scene2xx { @@ -192,6 +198,7 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); + virtual void synchronize(Common::Serializer &s); }; class Scene210: public Scene2xx { @@ -230,6 +237,7 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); + virtual void synchronize(Common::Serializer &s); }; class Scene211: public Scene2xx { @@ -245,6 +253,7 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); + virtual void synchronize(Common::Serializer &s); }; class Scene212: public Scene2xx { @@ -280,6 +289,7 @@ public: virtual void enter(); virtual void step(); virtual void actions(); + virtual void synchronize(Common::Serializer &s); }; class Scene215: public Scene2xx { -- cgit v1.2.3 From 4d75bebd08c1aeffbb05faa72d628c258d3d2d46 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 7 May 2014 22:08:57 +0300 Subject: FULLPIPE: Implement MovGraph::getBboxes() --- engines/fullpipe/motion.cpp | 32 ++++++++++++++++++++++++++++++++ engines/fullpipe/motion.h | 2 ++ 2 files changed, 34 insertions(+) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 91950baa4a..cdf9bdb1a4 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -847,6 +847,38 @@ void MovGraph::shuffleTree(MovGraphLink *lnk, MovGraphLink *lnk2, Common::Array< } } +Common::Array *MovGraph::getBboxes(MovArr *movarr1, MovArr *movarr2, int *listCount) { + Common::Array tempObList1; + Common::Array tempObList2; + + shuffleTree(movarr1->_link, movarr2->_link, tempObList1, tempObList2); + + *listCount = 0; + + if (!tempObList2.size()) + return 0; + + *listCount = tempObList2.size(); + + Common::Array *res = new Common::Array; + + for (uint i = 0; i < *listCount; i++) { + Common::Rect *r = new Common::Rect; + + calcBbox(r, tempObList2[i], movarr1, movarr2); + + delete tempObList2[i]; + } + + movarr2->_link = movarr1->_link; + + return res; +} + +void MovGraph::calcBbox(Common::Rect *rect, MovGraphLink *grlink, MovArr *movarr1, MovArr *movarr2) { + warning("STUB: MovGraph::calcBbox()"); +} + int MovGraph2::getItemIndexByGameObjectId(int objectId) { for (uint i = 0; i < _items2.size(); i++) if (_items2[i]->_objectId == objectId) diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index e00447b335..2c46c37ee7 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -364,6 +364,8 @@ public: int getItemIndexByStaticAni(StaticANIObject *ani); Common::Array *genMovArr(int x, int y, int *arrSize, int flag1, int flag2); void shuffleTree(MovGraphLink *lnk, MovGraphLink *lnk2, Common::Array &tempObList1, Common::Array &tempObList2); + Common::Array *getBboxes(MovArr *movarr1, MovArr *movarr2, int *listCount); + void calcBbox(Common::Rect *rect, MovGraphLink *grlink, MovArr *movarr1, MovArr *movarr2); }; class Movement; -- cgit v1.2.3 From 07a022888d7e8c467213aaac23352ba48d6a1bd3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 7 May 2014 22:34:28 +0200 Subject: MADS: Implement scene 505 --- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes5.cpp | 255 +++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes5.h | 21 +++ 3 files changed, 277 insertions(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 5f107881a8..a946b2388a 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -205,7 +205,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 504: // inside car return new Scene504(vm); case 505: // car view screen - return new DummyScene(vm); // TODO + return new Scene505(vm); case 506: // shopping street return new DummyScene(vm); // TODO case 507: // inside software house diff --git a/engines/mads/nebular/nebular_scenes5.cpp b/engines/mads/nebular/nebular_scenes5.cpp index 3e888acb7b..41765f256a 100644 --- a/engines/mads/nebular/nebular_scenes5.cpp +++ b/engines/mads/nebular/nebular_scenes5.cpp @@ -833,5 +833,260 @@ void Scene504::actions() { /*------------------------------------------------------------------------*/ +void Scene505::setup() { + _game._player._spritesPrefix = ""; + setAAName(); +} + +void Scene505::enter() { + for (int i = 0; i < 9; i++) + _globals._spriteIndexes[i] = _scene->_sprites.addSprites(formAnimName('a', i + 1)); + + _globals._spriteIndexes[13] = _scene->_sprites.addSprites(formAnimName('b', 1)); + _globals._spriteIndexes[9] = _scene->_sprites.addSprites(formAnimName('g', 1)); + _globals._spriteIndexes[10] = _scene->_sprites.addSprites(formAnimName('g', 0)); + _globals._spriteIndexes[11] = _scene->_sprites.addSprites(formAnimName('t', -1)); + _globals._spriteIndexes[12] = _scene->_sprites.addSprites(formAnimName('e', -1)); + + if (_scene->_priorSceneId != -2) + _globals._sequenceIndexes[12] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[12], false, 6, 1, 0, 0); + + _globals._sequenceIndexes[13] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[13], false, 6, 1, 120, 0); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SEQUENCE_TRIGGER_EXPIRE, 0, 60); + _scene->_sequences.addTimer(30, 62); + + _carLocations[0] = 501; + _carLocations[1] = 506; + _carLocations[2] = 511; + _carLocations[3] = 513; + _carLocations[4] = 601; + _carLocations[5] = 604; + _carLocations[6] = 607; + _carLocations[7] = 609; + _carLocations[8] = 612; + + _activeCars = false; + + for (int i = 0; i < 9; i++) { + if (_globals[kHoverCarLocation] == _carLocations[i]) { + _homeSelectedId = i; + if (_scene->_priorSceneId != -2) + _selectedId = i; + } + } + + _game._player._visible = false; + _game._player._stepEnabled = false; + _frame = -1; + _scene->loadAnimation(formAnimName('a', -1)); + _scene->_activeAnimation->setCurrentFrame(86); + + sceneEntrySound(); + _vm->_sound->command(16); +} + +void Scene505::step() { + int resetFrame; + if (_frame != _scene->_activeAnimation->getCurrentFrame()) { + _frame = _scene->_activeAnimation->getCurrentFrame(); + resetFrame = -1; + + switch (_frame) { + case 4: + case 24: + case 33: + case 53: + case 62: + case 82: + if (_nextButtonId == 0x38A) + resetFrame = 4; + else if (_nextButtonId == 0x38B) + resetFrame = 33; + else if (_nextButtonId == 0x2DE) + resetFrame = 62; + + break; + + case 15: + case 44: + case 73: { + int this_button; + int old_select; + _vm->_sound->command(17); + old_select = _selectedId; + if (_frame == 15) { + this_button = 0x38A; + _selectedId = (_selectedId + 1) % 9; + } else if (_frame == 44) { + this_button = 0x38B; + _selectedId--; + if (_selectedId < 0) + _selectedId = 8; + } else { + this_button = 0x2DE; + if ((_globals[kTimebombStatus] == 1) && (_carLocations[_selectedId] == 501)) + _vm->_dialogs->show(431); + else if (_selectedId != _homeSelectedId) { + _nextButtonId = 0; + _activeCars = true; + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _scene->_sequences.remove(_globals._sequenceIndexes[0]); + _scene->_sequences.remove(_globals._sequenceIndexes[13]); + _globals._sequenceIndexes[13] = _scene->_sequences.startReverseCycle (_globals._spriteIndexes[13], false, 6, 1, 0, 0); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SEQUENCE_TRIGGER_EXPIRE, 0, 63); + _vm->_sound->command(18); + } + } + + if (_nextButtonId == this_button) + _nextButtonId = 0; + + if (old_select != _selectedId) { + _scene->_sequences.remove(_globals._sequenceIndexes[11]); + _globals._sequenceIndexes[11] = _scene->_sequences.startCycle(_globals._spriteIndexes[11], false, _selectedId + 1); + if (old_select != _homeSelectedId) + _scene->_sequences.remove(_globals._sequenceIndexes[0]); + + if (_selectedId != _homeSelectedId) { + _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle (_globals._spriteIndexes[0 + _selectedId], false, 24, 0, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 1); + } + } + break; + } + + case 18: + case 19: + case 20: + case 21: + case 22: + case 23: + if (_nextButtonId == 0x38A) + resetFrame = 29 - _frame; + + break; + + case 26: + case 55: + case 84: + if (_nextButtonId != 0) + resetFrame = 3; + + break; + + case 27: + case 56: + case 85: + if (_nextButtonId != 0) + resetFrame = 2; + + break; + + case 29: + case 58: + case 87: + if (_activeCars) + _globals[kHoverCarDestination] = _carLocations[_selectedId]; + + if (_nextButtonId == 0x38A) + resetFrame = 0; + else if (_nextButtonId == 0x38B) + resetFrame = 29; + else if (_nextButtonId == 0x2DE) + resetFrame = 58; + else + resetFrame = 86; + break; + + case 47: + case 48: + case 49: + case 50: + case 51: + case 52: + if (_nextButtonId == 0x38B) + resetFrame = 87 - _frame; + + break; + + case 76: + case 77: + case 78: + case 79: + case 80: + case 81: + if (_nextButtonId == 0x2DE) + resetFrame = 145 - _frame; + + break; + + default: + break; + } + + if ((resetFrame >= 0) && (resetFrame != _scene->_activeAnimation->getCurrentFrame())) { + _scene->_activeAnimation->setCurrentFrame(resetFrame); + _frame = resetFrame; + } + } + + switch (_game._trigger) { + case 60: { + _game._player._stepEnabled = true; + int syncIdx = _globals._sequenceIndexes[13]; + _globals._sequenceIndexes[13] = _scene->_sequences.startCycle (_globals._spriteIndexes[13], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 8); + _scene->_sequences.updateTimeout (_globals._sequenceIndexes[13], syncIdx); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[_homeSelectedId], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); + _globals._sequenceIndexes[11] = _scene->_sequences.startCycle(_globals._spriteIndexes[11], false, _selectedId + 1); + + if (_selectedId != _homeSelectedId) { + _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle (_globals._spriteIndexes[0 + _selectedId], false, 24, 0, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 1); + } + break; + } + + case 61: + _globals._sequenceIndexes[10] = _scene->_sequences.addSpriteCycle (_globals._spriteIndexes[10], false, 8, 0, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 8); + _scene->_sequences.updateTimeout (_globals._sequenceIndexes[10], _globals._sequenceIndexes[9]); + break; + + case 62: + _globals._sequenceIndexes[9] = _scene->_sequences.addSpriteCycle (_globals._spriteIndexes[9], false, 8, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 8); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SEQUENCE_TRIGGER_EXPIRE, 0, 61); + break; + + case 63: + _globals[kHoverCarDestination] = _carLocations[_selectedId]; + _scene->_nextSceneId = 504; + break; + + default: + break; + } +} + +void Scene505::actions() { + if (_action.isAction(0x11A)) + _nextButtonId = _action._activeAction._objectNameId; + else if (_action.isAction(0x2D5, 0x38C)) + _scene->_nextSceneId = 504; + else if (_action.isAction(VERB_LOOK, 0x180)) + _vm->_dialogs->show(50510); + else if (_action.isAction(VERB_LOOK, 0x59)) + _vm->_dialogs->show(50511); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes5.h b/engines/mads/nebular/nebular_scenes5.h index 5336ceee94..f29a900e7d 100644 --- a/engines/mads/nebular/nebular_scenes5.h +++ b/engines/mads/nebular/nebular_scenes5.h @@ -112,6 +112,27 @@ public: virtual void actions(); virtual void postActions() {}; }; + +class Scene505: public Scene5xx{ +private: + int _frame; + int _nextButtonId; + int _homeSelectedId; + int _selectedId; + int _activeCars; + + int _carLocations[9]; + +public: + Scene505(MADSEngine *vm) : Scene5xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions(); + virtual void postActions() {}; +}; } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 52a8ca23c66b00fd89e49aaca12e1a094f5eff3f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 7 May 2014 23:06:49 +0200 Subject: MADS: Implement Scene205::Actions, some polishing --- engines/mads/nebular/globals_nebular.h | 2 +- engines/mads/nebular/nebular_scenes2.cpp | 223 ++++++++++++++++++++++++++----- engines/mads/nebular/nebular_scenes2.h | 5 + 3 files changed, 192 insertions(+), 38 deletions(-) diff --git a/engines/mads/nebular/globals_nebular.h b/engines/mads/nebular/globals_nebular.h index 9a7873f5b5..921c308346 100644 --- a/engines/mads/nebular/globals_nebular.h +++ b/engines/mads/nebular/globals_nebular.h @@ -70,7 +70,7 @@ enum GlobalId { kTeleporterDestination = 40, kTeleporterUnderstood = 41, kConv205 = 42, - kChickenPpermitted = 43, + kChickenPermitted = 43, kTwinklesStatus = 44, kTwinklesApproached = 45, kConvTwinkles1 = 46, diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 2b6b7eeb74..1794378f60 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -1180,11 +1180,10 @@ void Scene205::enter() { _beingKicked = false; _game.loadQuoteSet(0x6B, 0x70, 0x71, 0x72, 0x5A, 0x74, 0x75, 0x76, 0x77, 0x78, 0x73, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, 0x80, 0xAC, 0xAD, 0xAE, 0x6C, 0x6D, 0x6E, 0x6F, 0x2, 0); - warning("TODO: sub71A50(&dialog1, 0x5A, 0x78, 0x74, 0x75, 0x76, 0x77, 0);"); + _dialog1.setup(0x2A, 0x5A, 0x78, 0x74, 0x75, 0x76, 0x77, 0); if (!_game._visitedScenes._sceneRevisited) - warning("TODO: sub71B18(&dialog1, 0x5A, 0x74, 0x75, 0x77, 0);"); - + _dialog1.set(0x5A, 0x74, 0x75, 0x77, 0); _vm->_palette->setEntry(250, 63, 50, 20); _vm->_palette->setEntry(251, 50, 40, 15); @@ -1220,25 +1219,24 @@ void Scene205::step() { warning("TODO: sub7178C()"); if (_vm->_game->_scene._frameStartTime >= _chickenTime) { - warning("TODO: if (sub717B2(100, 1 + sub7176C()))"); - _vm->_sound->command(28); -// } - _chickenTime = _vm->_game->_scene._frameStartTime + 2; + warning("TODO: if (sub717B2(100, 1 + sub7176C())) {"); + _vm->_sound->command(28); + // } + _chickenTime = _vm->_game->_scene._frameStartTime + 2; } } if (_vm->_game->_scene._frameStartTime - _lastFishTime > 1300) { _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle( _globals._spriteIndexes[6], false, 5, 1, 0, 0); - int idx = _scene->_dynamicHotspots.add(269, 13, _globals._sequenceIndexes[6], + int idx = _scene->_dynamicHotspots.add(269, 13, _globals._sequenceIndexes[6], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(49, 86), FACING_NORTH); _lastFishTime = _vm->_game->_scene._frameStartTime; } - if (_game._trigger == 73) { + if (_game._trigger == 73) _scene->_kernelMessages.add(Common::Point(160, 68), 0xFBFA, 32, 0, 60, _game.getQuote(112)); - } if (_game._trigger == 74) { _vm->_sound->command(26); @@ -1253,13 +1251,164 @@ void Scene205::step() { _scene->_kernelMessages.add(Common::Point(160, 68), 0xFBFA, 32, 72, 180, _game.getQuote(114)); } - if (_game._trigger == 72) { + if (_game._trigger == 72) _scene->_nextSceneId = 211; - } +} + +void Scene205::handleWomanSpeech(int quote) { + _kernelMessage = _scene->_kernelMessages.add(Common::Point(186, 27), 0xFBFA, 0, 0, 9999999, _game.getQuote(quote)); } void Scene205::actions() { - warning("TODO: Scene205::actions"); + if (_game._screenObjects._inputMode == 1) { + if (_kernelMessage >= 0) + _scene->_kernelMessages.remove(_kernelMessage); + _kernelMessage = -1; + + if (_game._trigger == 0) { + _game._player._stepEnabled = false; + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 18, 1, 120, _game.getQuote(_action._activeAction._verbId)); + } else { + if ((_game._trigger > 1) || (_action._activeAction._verbId != 0x76)) + _game._player._stepEnabled = true; + + switch (_action._activeAction._verbId) { + case 0x5A: + handleWomanSpeech(0x7A); + _dialog1.write(0x78, true); + _dialog1.write(0x5A, false); + break; + + case 0x74: + handleWomanSpeech(0x7C); + _dialog1.write(0x74, false); + _dialog1.write(0x76, true); + break; + + case 0x75: + case 0x78: + handleWomanSpeech(0x7B); + _dialog1.write(_action._activeAction._verbId, false); + _vm->_dialogs->show(20501); + break; + + case 0x76: + if (_game._trigger == 1) { + handleWomanSpeech(0x7D); + _scene->_sequences.addTimer(120, 2); + } else if (_game._trigger == 2) { + handleWomanSpeech(0x7E); + _dialog1.write(0x76, false); + _globals[kChickenPermitted] = true; + } + break; + + case 0x77: + _scene->_kernelMessages.add(Common::Point(186, 27), 0xFBFA, 0, 0, 120, _game.getQuote(0x7F)); + _scene->_userInterface.setup(kInputBuildingSentences); + break; + + default: + break; + } + + if (_action._activeAction._verbId != 0x77) + _dialog1.start(); + } + } else if (_action._lookFlag) + _vm->_dialogs->show(20502); + else if (_action.isAction(VERB_LOOK, 0x27, 0x1C8)) + _vm->_dialogs->show(20518); + else if (_action.isAction(VERB_TALKTO, 0x1DC)) { + if (_game._trigger == 0) { + _game._player._stepEnabled = false; + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 18, 1, 120, _game.getQuote(0x73)); + } else if (_game._trigger == 1) { + _game._player._stepEnabled = true; + handleWomanSpeech (0x79); + _dialog1.write(0x5A, true); + _dialog1.write(0x75, true); + _dialog1.start(); + } + } else if (_action.isAction(VERB_GIVE, 0x1DC) && _game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId))) { + if (_game._trigger == 0) { + _game._player._stepEnabled = false; + int rndVal = _vm->getRandomNumber(0xAC, 0xAE); + _scene->_kernelMessages.add(Common::Point(186, 27), 0xFBFA, 32, 1, 120, _game.getQuote(rndVal)); + } else if (_game._trigger == 1) + _game._player._stepEnabled = true; + } else if (_action.isAction(VERB_WALKTO, 0x1C8)) { + if (_game._trigger == 0) { + _game._player._visible = false; + _game._player._stepEnabled = false; + _vm->_palette->lock(); + _scene->_kernelMessages.reset(); + warning("TODO: sub70402();"); + + _globals._spriteIndexes[9] = _scene->_sprites.addSprites(formAnimName('a', 0)); + _vm->_palette->refreshSceneColors(); + _globals._sequenceIndexes[9] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 6, 1, 0, 0); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SEQUENCE_TRIGGER_EXPIRE, 0, 1); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[9], -1); + _vm->_sound->command(27); + } else if (_game._trigger == 1) { + if (_scene->_activeAnimation != nullptr) + warning("scene->_activeAnimation._spriteSetsCount = 0;"); + + _vm->_dialogs->show(20516); + _scene->_reloadSceneFlag = true; + } + } else { + if (_action.isAction(0x1AD, 0x1C7)) + _scene->_nextSceneId = 210; + + if (_action.isAction(VERB_WALKTO, 0x86) || _action.isAction(VERB_WALKTO, 0x1C2)) { + if (_game._objects.isInRoom(OBJ_CHICKEN)) { + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x6B)); + } + } else if (_action.isAction(VERB_TAKE, 0x1C2) && _globals[kChickenPermitted] && _game._objects.isInRoom(OBJ_CHICKEN)) { + _game._objects.addToInventory(OBJ_CHICKEN); + _scene->_sequences.remove(_globals._sequenceIndexes[4]); + _scene->_hotspots.activate(0x1C2, false); + _vm->_dialogs->showItem(OBJ_CHICKEN, 812); + } else if (_action.isAction(VERB_TAKE, 0x1C2) && (!_globals[kChickenPermitted])) + _scene->_kernelMessages.add(Common::Point(186, 27), 0xFBFA, 32, 0, 120, _game.getQuote(0x80)); + else if (_action.isAction(VERB_LOOK, 0x1DC)) + _vm->_dialogs->show(20503); + else if (_action.isAction(VERB_LOOK, 0xAA)) + _vm->_dialogs->show(20504); + else if (_action.isAction(VERB_LOOK, 0x49) && (_action._mainObjectSource == 4)) + _vm->_dialogs->show(20505); + else if (_action.isAction(VERB_TAKE, 0x49) && (_action._mainObjectSource == 4)) + _vm->_dialogs->show(20506); + else if (_action.isAction(VERB_LOOK, 0x1C2)) + _vm->_dialogs->show(20507); + else if (_action.isAction(VERB_LOOK, 0x86)) + _vm->_dialogs->show(20508); + else if (_action.isAction(VERB_TAKE, 0x86)) + _vm->_dialogs->show(20509); + else if (_action.isAction(VERB_LOOK, 0x1C5)) + _vm->_dialogs->show(20510); + else if (_action.isAction(VERB_LOOK, 0x1C8)) + _vm->_dialogs->show(20511); + else if (_game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId)) + && ( _action.isAction(VERB_GIVE, 0x1C5) || _action.isAction(VERB_THROW, 0x1C5) + || _action.isAction(VERB_GIVE, 0x10D) || _action.isAction(VERB_THROW, 0x10D))) + _vm->_dialogs->show(20512); + else if (_action.isAction(VERB_LOOK, 0x10D)) + _vm->_dialogs->show(20513); + else if (_action.isAction(VERB_LOOK, 0x1C4)) + _vm->_dialogs->show(20514); + else if (_action.isAction(VERB_TAKE, 0x1C4)) + _vm->_dialogs->show(20515); + else if (_action.isAction(VERB_TAKE, 0x1DC)) + _vm->_dialogs->show(20517); + else + return; + } + + _action._inProgress = false; } void Scene205::synchronize(Common::Serializer &s) { @@ -2660,7 +2809,7 @@ void Scene209::step() { ++_counter; } break; - + case 2: if ((_monkeyPosition == 1) && (_counter < 2)) { _scene->_sequences.addTimer(1, 140); @@ -2669,7 +2818,7 @@ void Scene209::step() { ++_counter; } break; - + case 3: if (_monkeyPosition == 1) { _scene->_sequences.addTimer(1, 145); @@ -2678,7 +2827,7 @@ void Scene209::step() { _counter = 0; } break; - + case 4: if ((_monkeyPosition == 2) && (_counter < 2)) { _scene->_sequences.addTimer(1, 151); @@ -2687,7 +2836,7 @@ void Scene209::step() { _playingAnimFl = true; } break; - + case 5: if (_monkeyPosition == 2) { _scene->_sequences.addTimer(1, 161); @@ -2696,7 +2845,7 @@ void Scene209::step() { _playingAnimFl = true; } break; - + case 6: if (_monkeyPosition == 2) { _scene->_sequences.addTimer(1, 189); @@ -2712,7 +2861,7 @@ void Scene209::step() { _playingAnimFl = true; } break; - + case 8: if (_monkeyPosition == 3) { _scene->_sequences.addTimer(1, 178); @@ -2721,7 +2870,7 @@ void Scene209::step() { _counter = 0; } break; - + case 9: if ((_monkeyPosition == 3) && (_game._player._playerPos.x<120)) { _scene->_sequences.addTimer(1, 182); @@ -2730,7 +2879,7 @@ void Scene209::step() { _playingAnimFl = true; } break; - + case 10: if (_monkeyPosition == 4) { _scene->_sequences.addTimer(1, 196); @@ -2739,7 +2888,7 @@ void Scene209::step() { _counter = 0; } break; - + case 11: if ((_monkeyPosition == 4) && (_counter < 3)) { _scene->_sequences.addTimer(1, 199); @@ -2748,7 +2897,7 @@ void Scene209::step() { _playingAnimFl = true; } break; - + case 30: if (_monkeyPosition == 4) { _scene->_sequences.addTimer(1, 246); @@ -2757,14 +2906,14 @@ void Scene209::step() { _playingAnimFl = true; } break; - + default: if ((randAction >= 12) && (randAction <= 20) && (_monkeyPosition == 2) && (_counter < 5)) { _scene->_sequences.addTimer(1, 155); ++_counter; _playingAnimFl = true; } - + if ((randAction >= 21) && (randAction <= 29) && (_monkeyPosition == 3) && (_counter < 3)) { _scene->_sequences.addTimer(1, 171); _playingAnimFl = true; @@ -3017,7 +3166,7 @@ void Scene209::preActions() { _game._player._walkOffScreenSceneId = 208; if (_globals[36] == 1) { - if ((_action.isAction(NOUN_SHOOT) || _action.isAction(NOUN_HOSE_DOWN)) && _action.isAction(NOUN_MONKEY) + if ((_action.isAction(NOUN_SHOOT) || _action.isAction(NOUN_HOSE_DOWN)) && _action.isAction(NOUN_MONKEY) && _action.isAction(NOUN_BLOWGUN) && _game._objects.isInInventory(OBJ_BLOWGUN) && _game._objects.isInInventory(OBJ_POISON_DARTS)) { _game._player._prepareWalkPos = Common::Point(111, 129); _game._player._prepareWalkFacing = FACING_NORTHEAST; @@ -3164,8 +3313,8 @@ void Scene209::actions() { _dodgeFl = true; _action._inProgress = false; return; - } - + } + if (_action.isAction(NOUN_HOSE_DOWN, NOUN_BLOWGUN, NOUN_MONKEY) && !_startShootingInTimerFl) { _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _scene->_sequences.addTimer(1, 228); @@ -3925,7 +4074,7 @@ void Scene210::enter() { _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 5); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 5); } else { - int idx = _scene->_dynamicHotspots.add(112, 395, -1, Common::Rect(163, 87, 163 + 19, 87 + 36)); + int idx = _scene->_dynamicHotspots.add(112, 395, -1, Common::Rect(163, 87, 163 + 19, 87 + 36)); _doorway = _scene->_dynamicHotspots.setPosition(idx, Common::Point(168, 127), FACING_NORTH); _scene->_dynamicHotspots.setCursor(_doorway, CURSOR_GO_UP); } @@ -3934,7 +4083,7 @@ void Scene210::enter() { 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0); - + _conv1.setup(0x2E, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0); if (!_game._visitedScenes._sceneRevisited) { @@ -4165,7 +4314,7 @@ void Scene210::step() { _shouldTalk = true; } else if ((_twinklesCurrentFrame == 75) && _shouldTalk) reset_frame = 60; - + if ((reset_frame >= 0) && (reset_frame != _scene->_activeAnimation->getCurrentFrame())) { _scene->_activeAnimation->setCurrentFrame(reset_frame); _twinklesCurrentFrame = reset_frame; @@ -4195,7 +4344,7 @@ void Scene210::actions() { _vm->_dialogs->show(0x5219); } else if (_game._screenObjects._inputMode == 1) { handleConversations(); - } else if (_action.isAction(VERB_TALKTO, 0x1DC) || + } else if (_action.isAction(VERB_TALKTO, 0x1DC) || ((_game._player._playerPos == Common::Point(214, 150)) && (_game._player._facing == FACING_NORTHWEST) && (_twinkleAnimationType == 1) && _stopWalking)) { switch (_game._trigger) { case 0: { @@ -4442,7 +4591,7 @@ void Scene211::step() { _monkeyTime = _vm->_game->_scene._frameStartTime + 2; } - if ((_game._player._playerPos == Common::Point(52, 132)) && (_game._player._facing == FACING_WEST) && !_game._player._moving && + if ((_game._player._playerPos == Common::Point(52, 132)) && (_game._player._facing == FACING_WEST) && !_game._player._moving && (_game._trigger || !_ambushFl)) { switch (_game._trigger) { case 0: @@ -4633,7 +4782,7 @@ void Scene211::actions() { _vm->_dialogs->show(0x527A); else if (_action.isAction(VERB_LOOK, 0x129)) _vm->_dialogs->show(0x527B); - else + else return; _action._inProgress = false; @@ -4704,7 +4853,7 @@ void Scene212::actions() { _vm->_dialogs->show(0x52D7); else if (_action.isAction(VERB_LOOK, 0xE8)) _vm->_dialogs->show(0x52D8); - else + else return; _action._inProgress = false; @@ -4844,7 +4993,7 @@ void Scene214::step() { _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 9, -2); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 2); _devilTime = _game._player._priorTimer; - _devilRunningFl = false; + _devilRunningFl = false; } break; } @@ -4969,7 +5118,7 @@ void Scene214::actions() { _vm->_dialogs->show(0x53B1); } else { _vm->_dialogs->show(0x53B2); - } + } } else return; diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index e8883b15e8..47d5a12824 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -106,6 +106,11 @@ class Scene205: public Scene2xx { private: uint32 _lastFishTime, _chickenTime; bool _beingKicked; + int _kernelMessage; + Conversation _dialog1; + + void handleWomanSpeech(int quoteId); + public: Scene205(MADSEngine *vm) : Scene2xx(vm), _lastFishTime(0), _chickenTime(0) {} -- cgit v1.2.3 From 00dd6a5e2a333e460d39dc429d9b00d04bfe68b1 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 7 May 2014 23:21:30 +0200 Subject: MADS: Add recently added fields in Scene205::synchronize() --- engines/mads/nebular/nebular_scenes2.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 1794378f60..0736b3df35 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -1416,6 +1416,9 @@ void Scene205::synchronize(Common::Serializer &s) { s.syncAsUint32LE(_lastFishTime); s.syncAsUint32LE(_chickenTime); s.syncAsByte(_beingKicked); + s.syncAsSint16LE(_kernelMessage); + + _dialog1.synchronize(s); } /*****************************************************************************/ -- cgit v1.2.3 From 3fc8cd0a031dfb31c5bbb9966e650a5cce27822e Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 8 May 2014 00:52:22 +0300 Subject: MADS: Fix typo in NebularGlobals::synchronize() --- engines/mads/nebular/globals_nebular.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/nebular/globals_nebular.cpp b/engines/mads/nebular/globals_nebular.cpp index d839d29d9a..2e50794b60 100644 --- a/engines/mads/nebular/globals_nebular.cpp +++ b/engines/mads/nebular/globals_nebular.cpp @@ -42,7 +42,7 @@ NebularGlobals::NebularGlobals(): Globals() { void NebularGlobals::synchronize(Common::Serializer &s) { Globals::synchronize(s); - s.syncAsUint32BE(_timebombClock); + s.syncAsUint32LE(_timebombClock); s.syncAsUint32LE(_timebombTimer); _spriteIndexes.synchronize(s); _sequenceIndexes.synchronize(s); -- cgit v1.2.3 From 35a54a057063a3d04ea448670bd77e78f1cc40a5 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 8 May 2014 01:36:35 +0300 Subject: MADS: Synchronize local scene variables for Rex scene group 3 --- engines/mads/nebular/nebular_scenes3.cpp | 256 ++++++++++++++++++++++++------- engines/mads/nebular/nebular_scenes3.h | 26 +++- 2 files changed, 228 insertions(+), 54 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 17c310db73..44deeba77e 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -302,6 +302,11 @@ void Scene302::step() { } } +void Scene302::synchronize(Common::Serializer &s) { + Scene3xx::synchronize(s); + s.syncAsSint32LE(_oldFrame); +} + /*------------------------------------------------------------------------*/ void Scene303::setup() { @@ -455,6 +460,11 @@ void Scene304::step() { } } +void Scene304::synchronize(Common::Serializer &s) { + Scene3xx::synchronize(s); + s.syncAsSint32LE(_explosionSpriteId); +} + /*------------------------------------------------------------------------*/ void Scene307::setup() { @@ -522,13 +532,13 @@ void Scene307::setDialogNode(int node) { case 1: _globals[kMetBuddyBeast] = true; handlePrisonerSpeech(0x10F, 2, 9999999); - dialog1.start(); + _dialog1.start(); break; case 2: _globals[kMetBuddyBeast] = true; handlePrisonerSpeech(0x111, 2, 9999999); - dialog1.start(); + _dialog1.start(); break; case 4: @@ -539,7 +549,7 @@ void Scene307::setDialogNode(int node) { case 5: _globals[kKnowsBuddyBeast] = true; handlePrisonerSpeech(0x117, 2, 9999999); - dialog2.start(); + _dialog2.start(); break; case 6: @@ -550,57 +560,57 @@ void Scene307::setDialogNode(int node) { case 7: _globals[kKnowsBuddyBeast] = true; handlePrisonerSpeech(0x124, 10, 9999999); - dialog2.write(0x11A, false); - dialog2.write(0x11B, true); - dialog2.write(0x120, true); - dialog2.start(); + _dialog2.write(0x11A, false); + _dialog2.write(0x11B, true); + _dialog2.write(0x120, true); + _dialog2.start(); break; case 8: handlePrisonerSpeech(0x12E, 6, 9999999); - dialog2.write(0x11A, false); - dialog2.write(0x11B, false); - dialog2.write(0x11C, true); - dialog2.write(0x11D, true); - dialog2.write(0x11F, true); - dialog2.start(); + _dialog2.write(0x11A, false); + _dialog2.write(0x11B, false); + _dialog2.write(0x11C, true); + _dialog2.write(0x11D, true); + _dialog2.write(0x11F, true); + _dialog2.start(); break; case 9: handlePrisonerSpeech(0x134, 4, 9999999); - dialog2.write(0x11D, false); - dialog2.start(); + _dialog2.write(0x11D, false); + _dialog2.start(); break; case 10: handlePrisonerSpeech(0x138, 6, 9999999); - dialog2.write(0x11E, false); - dialog2.start(); + _dialog2.write(0x11E, false); + _dialog2.start(); break; case 11: handlePrisonerSpeech(0x13E, 6, 9999999); - dialog2.write(0x11F, false); - dialog2.write(0x121, true); - dialog2.start(); + _dialog2.write(0x11F, false); + _dialog2.write(0x121, true); + _dialog2.start(); break; case 12: handlePrisonerSpeech(0x144, 4, 9999999); - dialog2.write(0x11C, false); - dialog2.start(); + _dialog2.write(0x11C, false); + _dialog2.start(); break; case 13: handlePrisonerSpeech(0x148, 7, 9999999); - dialog2.write(0x120, false); - dialog2.start(); + _dialog2.write(0x120, false); + _dialog2.start(); break; case 14: handlePrisonerSpeech(0x14F, 3, 9999999); - dialog2.write(0x121, false); - dialog2.start(); + _dialog2.write(0x121, false); + _dialog2.start(); break; case 15: @@ -611,7 +621,7 @@ void Scene307::setDialogNode(int node) { case 16: _globals[kKnowsBuddyBeast] = true; handlePrisonerSpeech(0x10C, 1, 9999999); - dialog2.start(); + _dialog2.start(); break; default: @@ -700,13 +710,13 @@ void Scene307::enter() { 0x142, 0x143, 0x144, 0x145, 0x146, 0x147, 0x148, 0x149, 0x14A, 0x14B, 0x14C, 0x14D, 0x14E, 0x14F, 0x150, 0x151, 0x152, 0x153, 0); - dialog1.setup(0x3F, 0x113, 0x114, 0x115, -1); - dialog2.setup(0x40, 0x11A, 0x11B, 0x11C, 0x11D, 0x11E, 0x11F, 0x120, 0x121, 0x122, 0); + _dialog1.setup(0x3F, 0x113, 0x114, 0x115, -1); + _dialog2.setup(0x40, 0x11A, 0x11B, 0x11C, 0x11D, 0x11E, 0x11F, 0x120, 0x121, 0x122, 0); if (!_game._visitedScenes._sceneRevisited) - dialog2.set(0x11A, 0x122, 0); + _dialog2.set(0x11A, 0x122, 0); else if (_scene->_priorSceneId == 318) - dialog2.write(0x11E, true); + _dialog2.write(0x11E, true); if (_scene->_priorSceneId == -2) { @@ -826,7 +836,7 @@ void Scene307::step() { _prisonerMessageId++; if (_prisonerMessageId > 0x10A) _prisonerMessageId = 0x104; - } else if (_globals[kKnowsBuddyBeast] && (dialog2.read(0) > 1) && (_vm->getRandomNumber(1, 3) == 1)) { + } else if (_globals[kKnowsBuddyBeast] && (_dialog2.read(0) > 1) && (_vm->getRandomNumber(1, 3) == 1)) { int idx = _scene->_kernelMessages.add(Common::Point(5, 51), 0xFDFC, 0, 81, 120, _game.getQuote(267)); _scene->_kernelMessages.setQuoted(idx, 4, true); } @@ -1127,6 +1137,30 @@ void Scene307::actions() { _action._inProgress = false; } +void Scene307::synchronize(Common::Serializer &s) { + Scene3xx::synchronize(s); + + _forceField.synchronize(s); + + s.syncAsByte(_afterPeeingFl); + s.syncAsByte(_duringPeeingFl); + s.syncAsByte(_grateOpenedFl); + s.syncAsByte(_activePrisonerFl); + + s.syncAsSint32LE(_animationMode); + s.syncAsSint32LE(_prisonerMessageId); + s.syncAsSint32LE(_fieldCollisionCounter); + + s.syncAsUint32LE(_lastFrameTime); + s.syncAsUint32LE(_guardTime); + s.syncAsUint32LE(_prisonerTimer); + + s.syncString(_subQuote2); + + _dialog1.synchronize(s); + _dialog2.synchronize(s); +} + /*------------------------------------------------------------------------*/ void Scene308::setup() { @@ -1250,6 +1284,12 @@ void Scene308::step() { } } +void Scene308::synchronize(Common::Serializer &s) { + Scene3xx::synchronize(s); + + _forceField.synchronize(s); +} + /*------------------------------------------------------------------------*/ void Scene309::setup() { @@ -1435,6 +1475,18 @@ void Scene309::step() { _scene->_nextSceneId = 308; } +void Scene309::synchronize(Common::Serializer &s) { + Scene3xx::synchronize(s); + + _forceField.synchronize(s); + + for (int i = 0; i < 3; ++i) + s.syncAsSint32LE(_characterSpriteIndexes[i]); + for (int i = 0; i < 3; ++i) + s.syncAsSint32LE(_messagesIndexes[i]); + s.syncAsSint32LE(_lastFrame); +} + /*------------------------------------------------------------------------*/ void Scene310::setup() { @@ -1468,6 +1520,12 @@ void Scene310::step() { _scene->_nextSceneId = 309; } +void Scene310::synchronize(Common::Serializer &s) { + Scene3xx::synchronize(s); + + _forceField.synchronize(s); +} + /*------------------------------------------------------------------------*/ void Scene311::setup() { @@ -1757,6 +1815,12 @@ void Scene311::actions() { _action._inProgress = false; } +void Scene311::synchronize(Common::Serializer &s) { + Scene3xx::synchronize(s); + + s.syncAsByte(_checkGuardFl); +} + /*------------------------------------------------------------------------*/ void Scene313::setup() { @@ -2311,41 +2375,41 @@ void Scene318::handleDialog() { _game._player._stepEnabled = true; } else { if (_action._activeAction._verbId < 0x19C) - dialog1.write(_action._activeAction._verbId, false); + _dialog1.write(_action._activeAction._verbId, false); switch (_action._activeAction._verbId) { case 0x191: handleInternDialog(0x19E, 2, 9999999); - dialog1.write(0x192, true); + _dialog1.write(0x192, true); break; case 0x192: handleInternDialog(0x1A0, 5, 9999999); - dialog1.write(0x193, true); + _dialog1.write(0x193, true); break; case 0x193: handleInternDialog(0x1A5, 4, 9999999); - dialog1.write(0x194, true); + _dialog1.write(0x194, true); break; case 0x194: handleInternDialog(0x1A9, 6, 9999999); - dialog1.write(0x195, true); - dialog1.write(0x196, true); - dialog1.write(0x19D, false); + _dialog1.write(0x195, true); + _dialog1.write(0x196, true); + _dialog1.write(0x19D, false); break; case 0x195: handleInternDialog(0x1AF, 7, 9999999); - if (!dialog1.read(0x196)) - dialog1.write(0x197, true); + if (!_dialog1.read(0x196)) + _dialog1.write(0x197, true); break; case 0x196: handleInternDialog(0x1B6, 5, 9999999); - if (!dialog1.read(0x195)) - dialog1.write(0x197, true); + if (!_dialog1.read(0x195)) + _dialog1.write(0x197, true); break; case 0x197: @@ -2354,7 +2418,7 @@ void Scene318::handleDialog() { case 0x198: handleInternDialog(0x1C0, 5, 9999999); - dialog1.write(0x19A, true); + _dialog1.write(0x19A, true); break; case 0x199: @@ -2363,7 +2427,7 @@ void Scene318::handleDialog() { case 0x19A: handleInternDialog(0x1C8, 5, 9999999); - dialog1.write(0x19B, true); + _dialog1.write(0x19B, true); break; case 0x19B: @@ -2381,7 +2445,7 @@ void Scene318::handleDialog() { _dialogFl = false; handleInternDialog(0x1D0, 1, 120); - if (dialog1.read(0) || (_action._activeAction._verbId == 0x19D)) { + if (_dialog1.read(0) || (_action._activeAction._verbId == 0x19D)) { _explosionFl = true; _internCounter = 3420; } @@ -2389,7 +2453,7 @@ void Scene318::handleDialog() { } if (_action._activeAction._verbId < 0x19C) { - dialog1.start(); + _dialog1.start(); _game._player._stepEnabled = true; } @@ -2464,12 +2528,12 @@ void Scene318::enter() { else if (_scene->_priorSceneId != -2) _game._player._playerPos = Common::Point(214, 152); - dialog1.setup(0x47, 0x191, 0x192, 0x193, 0x194, 0x195, 0x196, 0x197, 0x198, 0x199, 0x19A, 0x19B, 0x19C, 0x19D, 0); + _dialog1.setup(0x47, 0x191, 0x192, 0x193, 0x194, 0x195, 0x196, 0x197, 0x198, 0x199, 0x19A, 0x19B, 0x19C, 0x19D, 0); if (!_game._visitedScenes._sceneRevisited) { - dialog1.set(0x191, 0x198, 0x199, 0x19C, 0); + _dialog1.set(0x191, 0x198, 0x199, 0x19C, 0); if (_game._widepipeCtr >= 2) - dialog1.write(0x19D, true); + _dialog1.write(0x19D, true); } if (_scene->_priorSceneId == 307) { @@ -2514,7 +2578,7 @@ void Scene318::enter() { } if (_dialogFl) { - dialog1.start(); + _dialog1.start(); _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 8); } else _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 1); @@ -2709,7 +2773,7 @@ void Scene318::actions() { case 1: _game._player._stepEnabled = true; handleInternDialog(0x18F, 1, 9999999); - dialog1.start(); + _dialog1.start(); break; case 2: { @@ -2873,6 +2937,29 @@ void Scene318::actions() { _action._inProgress = false; } +void Scene318::synchronize(Common::Serializer &s) { + Scene3xx::synchronize(s); + + s.syncAsUint32LE(_dropTimer); + + s.syncAsSint32LE(_lastFrame); + s.syncAsSint32LE(_animMode); + s.syncAsSint32LE(_internCounter); + s.syncAsSint32LE(_counter); + + s.syncAsByte(_dialogFl); + s.syncAsByte(_internTalkingFl); + s.syncAsByte(_internWalkingFl); + s.syncAsByte(_internVisibleFl); + s.syncAsByte(_explosionFl); + + s.syncAsUint32LE(_lastFrameCounter); + + s.syncString(_subQuote2); + + _dialog1.synchronize(s); +} + /*------------------------------------------------------------------------*/ void Scene319::setup() { @@ -3333,6 +3420,29 @@ void Scene319::actions() { _action._inProgress = false; } +void Scene319::synchronize(Common::Serializer &s) { + Scene3xx::synchronize(s); + + _dialog1.synchronize(s); + _dialog2.synchronize(s); + _dialog3.synchronize(s); + + s.syncAsUint32LE(_animMode); + s.syncAsUint32LE(_animFrame); + s.syncAsUint32LE(_nextAction1); + s.syncAsUint32LE(_nextAction2); + s.syncAsUint32LE(_slacheMode); + s.syncAsUint32LE(_slacheTopic); + s.syncAsUint32LE(_slachePosY); + + s.syncAsByte(_slacheTalkingFl); + s.syncAsByte(_slacheReady); + s.syncAsByte(_slacheInitFl); + + s.syncString(_subQuote2); +} + + /*------------------------------------------------------------------------*/ void Scene320::setup() { @@ -3641,6 +3751,19 @@ void Scene320::actions() { _action._inProgress = false; } +void Scene320::synchronize(Common::Serializer &s) { + Scene3xx::synchronize(s); + + s.syncAsByte(_blinkFl); + s.syncAsByte(_flippedFl); + + s.syncAsSint32LE(_buttonId); + s.syncAsSint32LE(_lastFrame); + s.syncAsSint32LE(_leftItemId); + s.syncAsSint32LE(_posX); + s.syncAsSint32LE(_rightItemId); +} + /*------------------------------------------------------------------------*/ void Scene321::setup() { @@ -4439,6 +4562,21 @@ void Scene352::actions() { return; } +void Scene352::synchronize(Common::Serializer &s) { + Scene3xx::synchronize(s); + + s.syncAsByte(_vaultOpenFl); + s.syncAsByte(_mustPutArmDownFl); + s.syncAsByte(_leaveRoomFl); + + s.syncAsSint32LE(_tapePlayerHotspotIdx); + s.syncAsSint32LE(_hotspot1Idx); + s.syncAsSint32LE(_hotspot2Idx); + s.syncAsSint32LE(_lampHostpotIdx); + s.syncAsSint32LE(_commonSequenceIdx); + s.syncAsSint32LE(_commonSpriteIndex); +} + /*------------------------------------------------------------------------*/ void Scene353::setup() { @@ -4811,6 +4949,13 @@ void Scene359::actions() { _action._inProgress = false; } +void Scene359::synchronize(Common::Serializer &s) { + Scene3xx::synchronize(s); + + s.syncAsSint32LE(_cardHotspotId); +} + + /*------------------------------------------------------------------------*/ void Scene360::setup() { @@ -5450,6 +5595,13 @@ void Scene389::actions() { _action._inProgress = false; } +void Scene389::synchronize(Common::Serializer &s) { + Scene3xx::synchronize(s); + + s.syncAsUint32LE(_monsterTime); + s.syncAsSint32LE(_circularQuoteId); +} + /*------------------------------------------------------------------------*/ void Scene390::setup() { diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h index d40b363ed5..f6d1ab5851 100644 --- a/engines/mads/nebular/nebular_scenes3.h +++ b/engines/mads/nebular/nebular_scenes3.h @@ -38,6 +38,15 @@ typedef struct { int _horizontal; int _seqId[40]; uint32 _timer; + + void synchronize(Common::Serializer &s) { + s.syncAsByte(_flag); + s.syncAsSint32LE(_vertical); + s.syncAsSint32LE(_horizontal); + for (int i = 0; i < 40; ++i) + s.syncAsSint32LE(_seqId[i]); + s.syncAsUint32LE(_timer); + }; } ForceField; class Scene3xx : public NebularScene { @@ -90,6 +99,7 @@ public: virtual void setup(); virtual void enter(); virtual void step(); + virtual void synchronize(Common::Serializer &s); }; class Scene303: public Scene3xx { @@ -111,6 +121,7 @@ public: virtual void setup(); virtual void enter(); virtual void step(); + virtual void synchronize(Common::Serializer &s); }; class Scene307: public Scene3xx { @@ -132,7 +143,7 @@ private: Common::String _subQuote2; - Conversation dialog1, dialog2; + Conversation _dialog1, _dialog2; void handleDialog(); void handleRexDialog(int quote); @@ -148,6 +159,7 @@ public: virtual void enter(); virtual void step(); virtual void actions(); + virtual void synchronize(Common::Serializer &s); }; class Scene308: public Scene3xx { @@ -160,6 +172,7 @@ public: virtual void setup(); virtual void enter(); virtual void step(); + virtual void synchronize(Common::Serializer &s); }; class Scene309: public Scene3xx { @@ -175,6 +188,7 @@ public: virtual void setup(); virtual void enter(); virtual void step(); + virtual void synchronize(Common::Serializer &s); }; class Scene310: public Scene3xx { @@ -187,6 +201,7 @@ public: virtual void setup(); virtual void enter(); virtual void step(); + virtual void synchronize(Common::Serializer &s); }; class Scene311: public Scene3xx { @@ -200,6 +215,7 @@ public: virtual void enter(); virtual void step(); virtual void actions(); + virtual void synchronize(Common::Serializer &s); }; class Scene313: public Scene3xx { @@ -245,7 +261,7 @@ private: Common::String _subQuote2; - Conversation dialog1; + Conversation _dialog1; void handleDialog(); void handleRexDialogs(int quote); @@ -259,6 +275,7 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); + virtual void synchronize(Common::Serializer &s); }; class Scene319: public Scene3xx { @@ -286,6 +303,7 @@ public: virtual void enter(); virtual void step(); virtual void actions(); + virtual void synchronize(Common::Serializer &s); }; class Scene320: public Scene300s { @@ -310,6 +328,7 @@ public: virtual void enter(); virtual void step(); virtual void actions(); + virtual void synchronize(Common::Serializer &s); }; class Scene321: public Scene3xx { @@ -363,6 +382,7 @@ public: virtual void enter(); virtual void preActions(); virtual void actions(); + virtual void synchronize(Common::Serializer &s); }; class Scene353: public Scene3xx { @@ -415,6 +435,7 @@ public: virtual void enter(); virtual void preActions(); virtual void actions(); + virtual void synchronize(Common::Serializer &s); }; class Scene360: public Scene3xx { @@ -482,6 +503,7 @@ public: virtual void enter(); virtual void step(); virtual void actions(); + virtual void synchronize(Common::Serializer &s); }; class Scene390: public Scene300s { -- cgit v1.2.3 From 189b629b338cb0658507776a71e9a37376ad15bb Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 8 May 2014 01:51:05 +0300 Subject: MADS: Synchronize the remaining local scene variables for Rex scene group 4 --- engines/mads/nebular/nebular_scenes4.cpp | 47 +++++++++++++++++++++++++++++--- engines/mads/nebular/nebular_scenes4.h | 6 +++- 2 files changed, 48 insertions(+), 5 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes4.cpp b/engines/mads/nebular/nebular_scenes4.cpp index 1bb53ed857..91c522cd25 100644 --- a/engines/mads/nebular/nebular_scenes4.cpp +++ b/engines/mads/nebular/nebular_scenes4.cpp @@ -2729,6 +2729,12 @@ void Scene406::actions() { _action._inProgress = false; } +void Scene406::synchronize(Common::Serializer &s) { + Scene4xx::synchronize(s); + + s.syncAsByte(_hitStorageDoor); +} + /*------------------------------------------------------------------------*/ void Scene407::setup() { @@ -2782,16 +2788,16 @@ void Scene407::preActions() { if (_game._player._needToWalk && _fromNorth) { if (_globals[kSexOfRex] == REX_MALE) - destPos = Common::Point(171, 95); + _destPos = Common::Point(171, 95); else - destPos = Common::Point(173, 96); + _destPos = Common::Point(173, 96); - _game._player.walk(destPos, FACING_SOUTH); + _game._player.walk(_destPos, FACING_SOUTH); } } void Scene407::actions() { - if ((_game._player._playerPos == destPos) && _fromNorth) { + if ((_game._player._playerPos == _destPos) && _fromNorth) { if (_globals[kSexOfRex] == REX_MALE) { _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _game._player._stepEnabled = false; @@ -2837,6 +2843,14 @@ void Scene407::actions() { _action._inProgress = false; } +void Scene407::synchronize(Common::Serializer &s) { + Scene4xx::synchronize(s); + + s.syncAsByte(_fromNorth); + s.syncAsSint16LE(_destPos.x); + s.syncAsSint16LE(_destPos.y); +} + /*------------------------------------------------------------------------*/ void Scene408::setup() { @@ -3957,6 +3971,24 @@ void Scene411::actions() { _action._inProgress = false; } +void Scene411::synchronize(Common::Serializer &s) { + Scene4xx::synchronize(s); + + s.syncAsSint32LE(_curAnimationFrame); + s.syncAsSint32LE(_newIngredient); + s.syncAsSint32LE(_newQuantity); + s.syncAsSint32LE(_resetFrame); + s.syncAsSint32LE(_badThreshold); + + s.syncAsByte(_killRox); + s.syncAsByte(_makeMushroomCloud); + + _dialog1.synchronize(s); + _dialog2.synchronize(s); + _dialog3.synchronize(s); + _dialog4.synchronize(s); +} + /*------------------------------------------------------------------------*/ void Scene413::setup() { @@ -4102,6 +4134,13 @@ void Scene413::actions() { _action._inProgress = false; } +void Scene413::synchronize(Common::Serializer &s) { + Scene4xx::synchronize(s); + + s.syncAsSint32LE(_rexDeath); + s.syncAsSint32LE(_canMove); +} + /*------------------------------------------------------------------------*/ } // End of namespace Nebular diff --git a/engines/mads/nebular/nebular_scenes4.h b/engines/mads/nebular/nebular_scenes4.h index 1f7b56b5cd..f2e8961089 100644 --- a/engines/mads/nebular/nebular_scenes4.h +++ b/engines/mads/nebular/nebular_scenes4.h @@ -148,6 +148,7 @@ private: public: Scene406(MADSEngine *vm) : Scene4xx(vm) {} + void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); @@ -160,10 +161,11 @@ public: class Scene407: public Scene4xx { private: bool _fromNorth; - Common::Point destPos; + Common::Point _destPos; public: Scene407(MADSEngine *vm) : Scene4xx(vm) {} + void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); @@ -236,6 +238,7 @@ private: public: Scene411(MADSEngine *vm) : Scene4xx(vm) {} + void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); @@ -252,6 +255,7 @@ private: public: Scene413(MADSEngine *vm) : Scene4xx(vm) {} + void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); -- cgit v1.2.3 From e89b16a5f2cab78b5031337d9a86a70f2cffdc5b Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 8 May 2014 02:44:31 +0300 Subject: MADS: Reset the font in KernelMessages::reset() Fixes the dialog font with the native woman in scene 210, after it gets set to the interface font in scene 208 --- engines/mads/messages.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/mads/messages.cpp b/engines/mads/messages.cpp index 2f59a67359..08e86e20de 100644 --- a/engines/mads/messages.cpp +++ b/engines/mads/messages.cpp @@ -137,6 +137,7 @@ void KernelMessages::reset() { for (uint i = 0; i < _entries.size(); ++i) remove(i); + _talkFont = _vm->_font->getFont(FONT_CONVERSATION); warning("TODO: KernelMessages::reset - sub_20454"); } -- cgit v1.2.3 From 3600205ba23c813533711e2eeeafd2b4867623bb Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 8 May 2014 02:52:54 +0300 Subject: MADS: Use the font friendly name in Scene::clearMessageList() --- engines/mads/scene.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 62a0e2031c..609e2335e4 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -104,7 +104,7 @@ void Scene::clearSequenceList() { void Scene::clearMessageList() { _kernelMessages.clear(); - _talkFont = "*FONTCONV.FF"; + _talkFont = FONT_CONVERSATION; _textSpacing = -1; } -- cgit v1.2.3 From ff3b6e4f05bf01073e7d0aa423b80340c86f7132 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 8 May 2014 03:05:22 +0300 Subject: MADS: Use friendly name for the deep pit in scene 208 --- engines/mads/nebular/nebular_scenes2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 0736b3df35..26c062cb8a 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -1651,7 +1651,7 @@ void Scene208::updateTrap() { case 2: { _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 15); _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); - _scene->_hotspots.activate(414, false); + _scene->_hotspots.activate(NOUN_DEEP_PIT, false); int idx = _scene->_dynamicHotspots.add(NOUN_LEAF_COVERED_PIT, VERB_WALKTO, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(100, 146), FACING_NORTH); _scene->_dynamicHotspots[idx]._articleNumber = PREP_ON; -- cgit v1.2.3 From 056e9b083f25c8c6dfeaf32af84555c421ee1765 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 8 May 2014 03:06:29 +0300 Subject: MADS: Bugfix for using objects on dynamic hotspots This fixes usage of the twinkifruit on the trap in scene 208 --- engines/mads/action.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index 3367521d88..fd6a90f3d2 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -218,7 +218,7 @@ void MADSAction::set() { } else if (_secondObject < (int)scene._hotspots.size()) { _action._indirectObjectId = scene._hotspots[_secondObject]._vocabId; } else { - _action._indirectObjectId = scene._hotspots[_secondObject - scene._hotspots.size()]._vocabId; + _action._indirectObjectId = scene._dynamicHotspots[_secondObject - scene._hotspots.size()]._descId; } } @@ -230,10 +230,10 @@ void MADSAction::set() { if ((_secondObjectSource == 2) || (_secondObjectSource == 5)) { InventoryObject &invObject = _vm->_game->_objects.getItem(_hotspotId); articleNum = invObject._article; - } else if (_secondObject < (int)scene._hotspots.size()) { + } else if (_hotspotId < (int)scene._hotspots.size()) { articleNum = scene._hotspots[_hotspotId]._articleNumber; } else { - articleNum = scene._hotspots[_hotspotId - scene._hotspots.size()]._articleNumber; + articleNum = scene._dynamicHotspots[_hotspotId - scene._hotspots.size()]._articleNumber; } _statusText += kArticleList[articleNum]; -- cgit v1.2.3 From 99ea49fe6189f3e7d66e28be64eaab23dac9aeb4 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 8 May 2014 03:38:05 +0300 Subject: MADS: Add a FIXME in UserInterface::updateInventoryScroller() --- engines/mads/user_interface.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index e8eaf3ad44..e23ecf4a08 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -499,7 +499,8 @@ void UserInterface::updateInventoryScroller() { if (( (screenObjects._category == CAT_INV_SCROLLER) || - (screenObjects._category != CAT_INV_SCROLLER && _scrollbarOldActive == SCROLLBAR_ELEVATOR) + // FIXME: This scrolls the inventory up when selecting verbs or attempting to combine items + false/*(screenObjects._category != CAT_INV_SCROLLER && _scrollbarOldActive == SCROLLBAR_ELEVATOR)*/ ) && (_vm->_events->_mouseStatusCopy || _vm->_easyMouse)) { if ((_vm->_events->_mouseClicked || (_vm->_easyMouse && !_vm->_events->_mouseStatusCopy)) && (screenObjects._category == CAT_INV_SCROLLER)) -- cgit v1.2.3 From 7cd467dfab498a229da3f83d95111910f33a0cdd Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 8 May 2014 03:47:15 +0300 Subject: MADS: Bugfix for combining the poison darts with the plant stalk --- engines/mads/nebular/game_nebular.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index 9d6bf894cc..b1dcfb09ce 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -358,10 +358,10 @@ void GameNebular::doObjectAction() { dialogs.show(476); } else if (action.isAction(114, 937)) { dialogs.show(477); - } else if (action.isAction(VERB_PUT, 276, NOUN_PLANT_STALK) && _objects.isInRoom(OBJ_POISON_DARTS) - && _objects.isInRoom(OBJ_PLANT_STALK)) { + } else if (action.isAction(VERB_PUT, 276, NOUN_PLANT_STALK) && _objects.isInInventory(OBJ_POISON_DARTS) + && _objects.isInInventory(OBJ_PLANT_STALK)) { _objects.addToInventory(OBJ_BLOWGUN); - _objects.setRoom(OBJ_PLANT_STALK, PLAYER_INVENTORY); + _objects.setRoom(OBJ_PLANT_STALK, NOWHERE); _globals[kBlowgunStatus] = 0; dialogs.showItem(OBJ_BLOWGUN, 809); } else if (action.isAction(VERB_PUT, 276, NOUN_BLOWGUN) && _objects.isInInventory(OBJ_POISON_DARTS) -- cgit v1.2.3 From 4d98dafc5c777501e55d791a80cfcf01b4e1281d Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 8 May 2014 03:51:51 +0300 Subject: MADS: Use friendly name for global 36 (monkey status) --- engines/mads/nebular/nebular_scenes2.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 26c062cb8a..0eada01ebb 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -2773,7 +2773,7 @@ void Scene209::enter() { if (_scene->_roomChanged) { _game._objects.addToInventory(OBJ_POISON_DARTS); _game._objects.addToInventory(OBJ_BLOWGUN); - _globals[36] = 1; + _globals[kMonkeyStatus] = 1; } _pitchFl = false; @@ -2801,7 +2801,7 @@ void Scene209::enter() { } void Scene209::step() { - if (!_playingAnimFl && !_pitchFl && !_fallFl && !_dodgeFl && (_pauseMode == 0) && (_globals[36] == 1)) { + if (!_playingAnimFl && !_pitchFl && !_fallFl && !_dodgeFl && (_pauseMode == 0) && (_globals[kMonkeyStatus] == 1)) { int randAction = _vm->getRandomNumber(1,50); switch (randAction) { case 1: @@ -3138,7 +3138,7 @@ void Scene209::step() { _startShootingInTimerFl = false; if (_fallFl) { - _globals[36] = MONKEY_IS_GONE; + _globals[kMonkeyStatus] = MONKEY_IS_GONE; _game._objects.setRoom(OBJ_POISON_DARTS, NOWHERE); } _dodgeFl = false; @@ -3168,7 +3168,7 @@ void Scene209::preActions() { if (_action.isAction(VERB_WALK_TOWARDS, 0x84)) _game._player._walkOffScreenSceneId = 208; - if (_globals[36] == 1) { + if (_globals[kMonkeyStatus] == 1) { if ((_action.isAction(NOUN_SHOOT) || _action.isAction(NOUN_HOSE_DOWN)) && _action.isAction(NOUN_MONKEY) && _action.isAction(NOUN_BLOWGUN) && _game._objects.isInInventory(OBJ_BLOWGUN) && _game._objects.isInInventory(OBJ_POISON_DARTS)) { _game._player._prepareWalkPos = Common::Point(111, 129); @@ -3305,7 +3305,7 @@ void Scene209::actions() { return; } - if (_globals[36] == 1) { + if (_globals[kMonkeyStatus] == 1) { if ((_action.isAction(NOUN_SHOOT) || _action.isAction(NOUN_HOSE_DOWN)) && _action.isAction(NOUN_MONKEY) && _action.isAction(NOUN_BLOWGUN) && _game._objects.isInInventory(OBJ_BLOWGUN) && _game._objects.isInInventory(OBJ_POISON_DARTS)) { if (_action.isAction(NOUN_SHOOT, NOUN_BLOWGUN, NOUN_MONKEY) && !_startShootingInTimerFl) { @@ -3472,13 +3472,13 @@ void Scene209::actions() { } if (_action.isAction(VERB_LOOK, 0x100)) { - if (_globals[36] == 1) { + if (_globals[kMonkeyStatus] == 1) { if (_monkeyPosition == 1) _vm->_dialogs->show(0x51B5); else _vm->_dialogs->show(0x51B6); } else { - if (_globals[36] == 0) + if (_globals[kMonkeyStatus] == 0) _vm->_dialogs->show(0x51B5); else _vm->_dialogs->show(0x51B7); -- cgit v1.2.3 From 2502bd89966f8b6398be4fc0428aaba1831ad530 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 8 May 2014 10:47:15 +0300 Subject: MADS: Use friendly names in globals --- engines/mads/nebular/game_nebular.cpp | 4 ++-- engines/mads/nebular/nebular_scenes1.cpp | 4 ++-- engines/mads/nebular/nebular_scenes2.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index b1dcfb09ce..9a4fa97a57 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -44,7 +44,7 @@ GameNebular::GameNebular(MADSEngine *vm): Game(vm) { ProtectionResult GameNebular::checkCopyProtection() { /* // DEBUG: Flag copy protection failure - _globals[5] = -1; + _globals[kCopyProtectFailed] = -1; if (!ConfMan.getBool("copy_protection")) return true; @@ -271,7 +271,7 @@ void GameNebular::setSectionHandler() { } void GameNebular::checkShowDialog() { - if (_vm->_dialogs->_pendingDialog && _player._stepEnabled && !_globals[5]) { + if (_vm->_dialogs->_pendingDialog && _player._stepEnabled && !_globals[kCopyProtectFailed]) { _player.releasePlayerSprites(); _vm->_dialogs->showDialog(); _vm->_dialogs->_pendingDialog = DIALOG_NONE; diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 8dca4e9c6b..ecc80c8ce3 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -191,7 +191,7 @@ void Scene101::enter() { _game.loadQuoteSet(0x31, 0x32, 0x39, 0x36, 0x37, 0x38, 0); - if (_globals[10]) { + if (_globals[kNeedToStandUp]) { _scene->loadAnimation(Resources::formatName(101, 'S', -1, EXT_AA, ""), 71); _game._player._visible = false; _game._player._stepEnabled = false; @@ -222,7 +222,7 @@ void Scene101::step() { break; case 71: - _globals[10] = false; + _globals[kNeedToStandUp] = false; _game._player._visible = true; _game._player._stepEnabled = true; _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 0eada01ebb..b86f9dbc75 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -1640,7 +1640,7 @@ void Scene208::updateTrap() { return; } - switch (_globals[35]) { + switch (_globals[kLeavesStatus]) { case 0: { _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 15); -- cgit v1.2.3 From b7dd01fdefd910c3c0f6291145ceab4060ae1a70 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 8 May 2014 11:43:23 +0300 Subject: MADS: Remove trailing whitespace --- engines/mads/action.cpp | 6 +-- engines/mads/action.h | 4 +- engines/mads/animation.cpp | 14 ++--- engines/mads/animation.h | 4 +- engines/mads/assets.cpp | 6 +-- engines/mads/compression.cpp | 10 ++-- engines/mads/compression.h | 6 +-- engines/mads/debugger.cpp | 4 +- engines/mads/dialogs.cpp | 24 ++++----- engines/mads/dialogs.h | 4 +- engines/mads/dragonsphere/game_dragonsphere.cpp | 2 +- engines/mads/events.h | 6 +-- engines/mads/font.cpp | 6 +-- engines/mads/font.h | 4 +- engines/mads/game.cpp | 16 +++--- engines/mads/globals.cpp | 2 +- engines/mads/inventory.cpp | 8 +-- engines/mads/inventory.h | 2 +- engines/mads/mads.cpp | 4 +- engines/mads/mads.h | 2 +- engines/mads/messages.cpp | 16 +++--- engines/mads/messages.h | 10 ++-- engines/mads/msurface.cpp | 12 ++--- engines/mads/msurface.h | 8 +-- engines/mads/nebular/dialogs_nebular.cpp | 14 ++--- engines/mads/nebular/game_nebular.cpp | 4 +- engines/mads/nebular/globals_nebular.h | 2 +- engines/mads/nebular/nebular_scenes1.cpp | 70 ++++++++++++------------- engines/mads/nebular/nebular_scenes1.h | 2 +- engines/mads/nebular/nebular_scenes3.cpp | 14 ++--- engines/mads/nebular/nebular_scenes3.h | 2 +- engines/mads/nebular/nebular_scenes4.h | 4 +- engines/mads/nebular/nebular_scenes7.cpp | 4 +- engines/mads/nebular/nebular_scenes8.cpp | 8 +-- engines/mads/nebular/sound_nebular.cpp | 38 +++++++------- engines/mads/nebular/sound_nebular.h | 6 +-- engines/mads/palette.cpp | 20 +++---- engines/mads/palette.h | 18 +++---- engines/mads/phantom/game_phantom.cpp | 2 +- engines/mads/player.cpp | 14 ++--- engines/mads/rails.cpp | 4 +- engines/mads/rails.h | 2 +- engines/mads/resources.cpp | 8 +-- engines/mads/resources.h | 2 +- engines/mads/scene.cpp | 18 +++---- engines/mads/scene.h | 2 +- engines/mads/scene_data.cpp | 14 ++--- engines/mads/scene_data.h | 6 +-- engines/mads/screen.cpp | 4 +- engines/mads/sequence.cpp | 12 ++--- engines/mads/sequence.h | 10 ++-- engines/mads/sprites.cpp | 10 ++-- engines/mads/sprites.h | 2 +- engines/mads/user_interface.cpp | 22 ++++---- engines/mads/user_interface.h | 2 +- 55 files changed, 260 insertions(+), 260 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index fd6a90f3d2..88a57d6a4e 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -127,7 +127,7 @@ void MADSAction::set() { // Two 'look' actions in succession, so the action becomes 'Look around' _statusText = kLookAroundStr; } else { - if ((_commandSource == CAT_INV_VOCAB) && (_selectedRow >= 0) + if ((_commandSource == CAT_INV_VOCAB) && (_selectedRow >= 0) && (_verbType == VERB_THAT) && (_prepType == PREP_NONE)) { // Use/to action int invIndex = userInterface._selectedInvIndex; @@ -276,7 +276,7 @@ void MADSAction::refresh() { } if (!_statusText.empty()) { - if ((_vm->_game->_screenObjects._inputMode == kInputBuildingSentences) || + if ((_vm->_game->_screenObjects._inputMode == kInputBuildingSentences) || (_vm->_game->_screenObjects._inputMode == kInputLimitedSentences)) { Font *font = _vm->_font->getFont(FONT_MAIN); int textSpacing = -1; @@ -436,7 +436,7 @@ void MADSAction::checkActionAtMousePos() { _hotspotId = userInterface._selectedInvIndex; _articleNumber = _prepType; - if ((_verbType == VERB_THIS && _prepType == PREP_NONE) || + if ((_verbType == VERB_THIS && _prepType == PREP_NONE) || (_verbType == VERB_THAT && _prepType != PREP_NONE)) _interAwaiting = AWAITING_RIGHT_MOUSE; else diff --git a/engines/mads/action.h b/engines/mads/action.h index 24521d074d..af52d2c7a2 100644 --- a/engines/mads/action.h +++ b/engines/mads/action.h @@ -29,7 +29,7 @@ namespace MADS { -enum TriggerMode { +enum TriggerMode { SEQUENCE_TRIGGER_PARSER = 0, // Triggers parser SEQUENCE_TRIGGER_DAEMON = 1, // Triggers step/daemon code SEQUENCE_TRIGGER_PREPARE = 2 // Triggers preparser @@ -61,7 +61,7 @@ enum { enum VerbType { VERB_ONLY, VERB_THIS, VERB_THAT }; enum PrepType { - PREP_NONE, PREP_WITH, PREP_TO, PREP_AT, PREP_FROM, PREP_ON, PREP_IN, + PREP_NONE, PREP_WITH, PREP_TO, PREP_AT, PREP_FROM, PREP_ON, PREP_IN, PREP_UNDER, PREP_BEHIND, PREP_RELATIONAL = 0xff }; diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index 32f432001e..089e21d08e 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -26,7 +26,7 @@ #define FILENAME_SIZE 13 namespace MADS { - + void AAHeader::load(Common::SeekableReadStream *f) { _spriteSetsCount = f->readUint16LE(); _miscEntriesCount = f->readUint16LE(); @@ -232,7 +232,7 @@ void Animation::load(UserInterface &interfaceSurface, MSurface &depthSurface, delete frameStream; } - + _miscEntries.clear(); _uiEntries.clear(); if (_header._miscEntriesCount > 0) { @@ -255,7 +255,7 @@ void Animation::load(UserInterface &interfaceSurface, MSurface &depthSurface, delete miscStream; } - + // If the animation specifies a font, then load it for access delete _font; if (_header._flags & ANIMFLAG_CUSTOM_FONT) { @@ -264,7 +264,7 @@ void Animation::load(UserInterface &interfaceSurface, MSurface &depthSurface, } else { _font = nullptr; } - + // Load all the sprite sets for the animation for (uint i = 0; i < _spriteSets.size(); ++i) delete _spriteSets[i]; @@ -398,7 +398,7 @@ void Animation::loadInterface(UserInterface &interfaceSurface, MSurface &depthSu } } -bool Animation::hasScroll() const { +bool Animation::hasScroll() const { return (_header._scrollPosition.x != 0) || (_header._scrollPosition.x != 0); } @@ -452,7 +452,7 @@ void Animation::update() { scene._backgroundSurface.scrollY(_header._scrollPosition.y); scene._spriteSlots.fullRefresh(); } - + // Handle any offset adjustment for sprites as of this frame bool paChanged = false; if (scene._posAdjust.x != misc._posAdjust.x) { @@ -542,7 +542,7 @@ void Animation::update() { _vm->_palette->setEntry(colIndex + 1, me._rgb2[0], me._rgb2[1], me._rgb2[2]); // Add a kernel message to display the given text - me._kernelMsgIndex = scene._kernelMessages.add(me._pos, colIndex * 0x101 + 0x100, + me._kernelMsgIndex = scene._kernelMessages.add(me._pos, colIndex * 0x101 + 0x100, 0, 0, INDEFINITE_TIMEOUT, me._msg); assert(me._kernelMsgIndex >= 0); ++_messageCtr; diff --git a/engines/mads/animation.h b/engines/mads/animation.h index aab1743b42..3c0c2547d4 100644 --- a/engines/mads/animation.h +++ b/engines/mads/animation.h @@ -33,9 +33,9 @@ namespace MADS { -enum AnimFlag { +enum AnimFlag { ANIMFLAG_DITHER = 0x0001, // Dither to 16 colors - ANIMFLAG_CUSTOM_FONT = 0x0020, // Load ccustom font + ANIMFLAG_CUSTOM_FONT = 0x0020, // Load ccustom font ANIMFLAG_LOAD_BACKGROUND = 0x0100, // Load background ANIMFLAG_LOAD_BACKGROUND_ONLY = 0x0200 // Load background only }; diff --git a/engines/mads/assets.cpp b/engines/mads/assets.cpp index bf9647dda4..1cb174bbed 100644 --- a/engines/mads/assets.cpp +++ b/engines/mads/assets.cpp @@ -40,7 +40,7 @@ SpriteAsset::SpriteAsset(MADSEngine *vm, const Common::String &resourceName, int file.close(); } - + SpriteAsset::SpriteAsset(MADSEngine *vm, Common::SeekableReadStream *stream, int flags) : _vm(vm) { load(stream, flags); @@ -152,8 +152,8 @@ void SpriteAsset::load(Common::SeekableReadStream *stream, int flags) { frame._bounds.setHeight(spriteStream->readUint16LE()); if (curFrame == 0) - debugC(1, kDebugGraphics, "%i frames, x = %i, y = %i, w = %i, h = %i\n", - _frameCount, frame._bounds.left, frame._bounds.top, + debugC(1, kDebugGraphics, "%i frames, x = %i, y = %i, w = %i, h = %i\n", + _frameCount, frame._bounds.left, frame._bounds.top, frame._bounds.width(), frame._bounds.height()); if (_mode == 0) { diff --git a/engines/mads/compression.cpp b/engines/mads/compression.cpp index 2190fc4ac0..6563de51a3 100644 --- a/engines/mads/compression.cpp +++ b/engines/mads/compression.cpp @@ -34,7 +34,7 @@ bool MadsPack::isCompressed(Common::SeekableReadStream *stream) { char tempBuffer[8]; stream->seek(0); if (stream->read(tempBuffer, 8) == 8) { - if (!strncmp(tempBuffer, madsPackString, 8)) + if (!strncmp(tempBuffer, madsPackString, 8)) return true; } @@ -58,7 +58,7 @@ void MadsPack::initialise(Common::SeekableReadStream *stream) { stream->seek(14); _count = stream->readUint16LE(); _items = new MadsPackEntry[_count]; - + byte *headerData = new byte[0xA0]; byte *header = headerData; stream->read(headerData, 0xA0); @@ -77,7 +77,7 @@ void MadsPack::initialise(Common::SeekableReadStream *stream) { // Decompress the entry byte *compressedData = new byte[_items[i].compressedSize]; stream->read(compressedData, _items[i].compressedSize); - + FabDecompressor fab; fab.decompress(compressedData, _items[i].compressedSize, _items[i].data, _items[i].size); delete[] compressedData; @@ -100,7 +100,7 @@ void FabDecompressor::decompress(const byte *srcData, int srcSize, byte *destDat byte copyLen, copyOfsShift, copyOfsMask, copyLenMask; unsigned long copyOfs; byte *destP; - + // Validate that the data starts with the FAB header if (strncmp((const char *)srcData, "FAB", 3) != 0) error("FabDecompressor - Invalid compressed data"); @@ -119,7 +119,7 @@ void FabDecompressor::decompress(const byte *srcData, int srcSize, byte *destDat _srcData = srcData; _srcP = _srcData + 6; _srcSize = srcSize; - _bitsLeft = 16; + _bitsLeft = 16; _bitBuffer = READ_LE_UINT16(srcData + 4); for (;;) { diff --git a/engines/mads/compression.h b/engines/mads/compression.h index aa1f0d9bdc..c752b570a2 100644 --- a/engines/mads/compression.h +++ b/engines/mads/compression.h @@ -54,12 +54,12 @@ public: ~MadsPack(); int getCount() const { return _count; } - MadsPackEntry &getItem(int index) const { + MadsPackEntry &getItem(int index) const { assert(index < _count); return _items[index]; } - MadsPackEntry &operator[](int index) const { + MadsPackEntry &operator[](int index) const { assert(index < _count); - return _items[index]; + return _items[index]; } Common::MemoryReadStream *getItemStream(int index) { assert(index < _count); diff --git a/engines/mads/debugger.cpp b/engines/mads/debugger.cpp index 80a8cb748e..3594c83d36 100644 --- a/engines/mads/debugger.cpp +++ b/engines/mads/debugger.cpp @@ -175,7 +175,7 @@ bool Debugger::Cmd_DumpFile(int argc, const char **argv) { } else { outFile.open(argv[1]); byte *data = new byte[inFile.size()]; - + inFile.read(data, inFile.size()); outFile.write(data, inFile.size()); @@ -186,7 +186,7 @@ bool Debugger::Cmd_DumpFile(int argc, const char **argv) { DebugPrintf("File written successfully.\n"); } } - + return true; } diff --git a/engines/mads/dialogs.cpp b/engines/mads/dialogs.cpp index 519b273efb..e68411a4bb 100644 --- a/engines/mads/dialogs.cpp +++ b/engines/mads/dialogs.cpp @@ -40,7 +40,7 @@ Dialog::~Dialog() { void Dialog::save(MSurface *s) { _savedSurface = new MSurface(_width, _height); - s->copyTo(_savedSurface, + s->copyTo(_savedSurface, Common::Rect(_position.x, _position.y, _position.x + _width, _position.y + _height), Common::Point()); @@ -87,7 +87,7 @@ void Dialog::drawContent(const Common::Rect &r, int seed, byte color1, byte colo for (int yp = 0; yp < r.height(); ++yp) { byte *destP = _vm->_screen.getBasePtr(r.left, r.top + yp); - + for (int xp = 0; xp < r.width(); ++xp) { uint16 seedAdjust = currSeed; currSeed += 0x181D; @@ -103,13 +103,13 @@ void Dialog::drawContent(const Common::Rect &r, int seed, byte color1, byte colo /*------------------------------------------------------------------------*/ -TextDialog::TextDialog(MADSEngine *vm, const Common::String &fontName, +TextDialog::TextDialog(MADSEngine *vm, const Common::String &fontName, const Common::Point &pos, int maxChars): Dialog(vm) { _vm = vm; _font = _vm->_font->getFont(fontName); _position = pos; - + _vm->_font->setColors(TEXTDIALOG_BLACK, TEXTDIALOG_BLACK, TEXTDIALOG_BLACK, TEXTDIALOG_BLACK); _innerWidth = (_font->maxWidth() + 1) * maxChars; @@ -123,8 +123,8 @@ TextDialog::TextDialog(MADSEngine *vm, const Common::String &fontName, _askXp = 0; // Save the high end of the palette, and set up the entries for dialog display - Common::copy(&_vm->_palette->_mainPalette[TEXTDIALOG_CONTENT1 * 3], - &_vm->_palette->_mainPalette[TEXTDIALOG_CONTENT1 * 3 + 8 * 3], + Common::copy(&_vm->_palette->_mainPalette[TEXTDIALOG_CONTENT1 * 3], + &_vm->_palette->_mainPalette[TEXTDIALOG_CONTENT1 * 3 + 8 * 3], &_cyclingPalette[0]); Palette::setGradient(_vm->_palette->_mainPalette, TEXTDIALOG_CONTENT1, 2, 0x90, 0x80); Palette::setGradient(_vm->_palette->_mainPalette, TEXTDIALOG_EDGE, 2, 0x9C, 0x70); @@ -177,7 +177,7 @@ void TextDialog::wordWrap(const Common::String &line) { if (!line.empty()) { const char *srcP = line.c_str(); - + do { tempLine = ""; bool endWord = false; @@ -274,11 +274,11 @@ void TextDialog::draw() { Dialog::draw(); // Draw the text lines - int lineYp = _position.y + 5; + int lineYp = _position.y + 5; for (int lineNum = 0; lineNum <= _numLines; ++lineNum) { if (_lineXp[lineNum] == -1) { // Draw a line across the entire dialog - _vm->_screen.hLine(_position.x + 2, + _vm->_screen.hLine(_position.x + 2, lineYp + (_font->getHeight() + 1) / 2, _position.x + _width - 4, TEXTDIALOG_BLACK); } else { @@ -288,7 +288,7 @@ void TextDialog::draw() { if (_lineXp[lineNum] & 0x40) ++yp; - _font->writeString(&_vm->_screen, _lines[lineNum], + _font->writeString(&_vm->_screen, _lines[lineNum], Common::Point(xp, yp), 1); if (_lineXp[lineNum] & 0x80) { @@ -314,7 +314,7 @@ void TextDialog::drawWithInput() { drawContent(Common::Rect(_position.x + 2, _position.y + 2, _position.x + _width - 2, _position.y + _height - 2), 0, TEXTDIALOG_CONTENT1, TEXTDIALOG_CONTENT2); - + error("TODO: drawWithInput"); } @@ -342,7 +342,7 @@ void TextDialog::show() { /*------------------------------------------------------------------------*/ -MessageDialog::MessageDialog(MADSEngine *vm, int maxChars, ...): +MessageDialog::MessageDialog(MADSEngine *vm, int maxChars, ...): TextDialog(vm, FONT_INTERFACE, Common::Point(-1, -1), maxChars) { // Add in passed line list va_list va; diff --git a/engines/mads/dialogs.h b/engines/mads/dialogs.h index 884f7e6866..d06611b1c4 100644 --- a/engines/mads/dialogs.h +++ b/engines/mads/dialogs.h @@ -123,7 +123,7 @@ public: * @param pos Position for window top-left * @param maxChars Horizontal width of window in characters */ - TextDialog(MADSEngine *vm, const Common::String &fontName, const Common::Point &pos, + TextDialog(MADSEngine *vm, const Common::String &fontName, const Common::Point &pos, int maxChars); /** @@ -162,7 +162,7 @@ public: void addInput(); /** - * Adds a bar line to separate sections of text + * Adds a bar line to separate sections of text */ void addBarLine(); diff --git a/engines/mads/dragonsphere/game_dragonsphere.cpp b/engines/mads/dragonsphere/game_dragonsphere.cpp index 7d3864e680..49c38460e2 100644 --- a/engines/mads/dragonsphere/game_dragonsphere.cpp +++ b/engines/mads/dragonsphere/game_dragonsphere.cpp @@ -44,7 +44,7 @@ ProtectionResult GameDragonsphere::checkCopyProtection() { /* // DEBUG: Flag copy protection failure _globals[5] = -1; - + if (!ConfMan.getBool("copy_protection")) return true; diff --git a/engines/mads/events.h b/engines/mads/events.h index 5f9a899f65..3d7504c0bd 100644 --- a/engines/mads/events.h +++ b/engines/mads/events.h @@ -31,11 +31,11 @@ namespace MADS { -enum CursorType { CURSOR_NONE = 0, CURSOR_ARROW = 1, CURSOR_WAIT = 2, CURSOR_GO_DOWN = 3, +enum CursorType { CURSOR_NONE = 0, CURSOR_ARROW = 1, CURSOR_WAIT = 2, CURSOR_GO_DOWN = 3, CURSOR_GO_UP = 4, CURSOR_GO_LEFT = 5, CURSOR_GO_RIGHT = 6 }; #define GAME_FRAME_RATE 50 -#define GAME_FRAME_TIME (1000 / GAME_FRAME_RATE) +#define GAME_FRAME_TIME (1000 / GAME_FRAME_RATE) class MADSEngine; @@ -154,7 +154,7 @@ public: void initVars(); /** - * Returns true if there's any pending keys to be processed + * Returns true if there's any pending keys to be processed */ bool isKeyPressed() const { return !_pendingKeys.empty(); } }; diff --git a/engines/mads/font.cpp b/engines/mads/font.cpp index ba10099184..6f2d2b8168 100644 --- a/engines/mads/font.cpp +++ b/engines/mads/font.cpp @@ -145,7 +145,7 @@ int Font::writeString(MSurface *surface, const Common::String &msg, const Common int x = pt.x; int y = pt.y; - + int skipY = 0; if (y < 0) { skipY = -y; @@ -173,7 +173,7 @@ int Font::writeString(MSurface *surface, const Common::String &msg, const Common while (*text) { char theChar = (*text++) & 0x7F; int charWidth = _charWidths[(byte)theChar]; - + if (charWidth > 0) { if (xPos + charWidth > xEnd) @@ -212,7 +212,7 @@ int Font::writeString(MSurface *surface, const Common::String &msg, const Common } xPos += charWidth + spaceWidth; - + } return xPos; diff --git a/engines/mads/font.h b/engines/mads/font.h index 1511b60a82..1d733280df 100644 --- a/engines/mads/font.h +++ b/engines/mads/font.h @@ -39,8 +39,8 @@ namespace MADS { #define FONT_TELE "*FONTTELE.FF" // Not in Phantom #define FONT_PHAN "*FONTPHAN.FF" // Phantom only -enum SelectionMode { - SELMODE_UNSELECTED = 0, SELMODE_HIGHLIGHTED = 1, SELMODE_SELECTED = 2 +enum SelectionMode { + SELMODE_UNSELECTED = 0, SELMODE_HIGHLIGHTED = 1, SELMODE_SELECTED = 2 }; class MADSEngine; diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 65790d3c3d..3f6c8e09d5 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -56,7 +56,7 @@ Game *Game::init(MADSEngine *vm) { return nullptr; } -Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm), +Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm), _scene(vm), _screenObjects(vm), _player(vm) { _sectionNumber = _priorSectionNumber = 0; _loadGameSlot = -1; @@ -106,7 +106,7 @@ void Game::run() { _statusFlag = true; int protectionResult = -1; - + if (_loadGameSlot == -1) { protectionResult = checkCopyProtection(); switch (protectionResult) { @@ -203,7 +203,7 @@ void Game::sectionLoop() { _screenObjects._forceRescan = true; _screenObjects._inputMode = kInputBuildingSentences; _scene._userInterface._scrollbarActive = SCROLLBAR_NONE; - + _player._loadsFirst = true; _scene._sceneLogic->setup(); @@ -222,7 +222,7 @@ void Game::sectionLoop() { _scene._scenePaletteUsage.push_back(PaletteUsage::UsageEntry(0xF1)); _scene._scenePaletteUsage.push_back(PaletteUsage::UsageEntry(0xF2)); _vm->_palette->_paletteUsage.load(&_scene._scenePaletteUsage); - + if (!_player._spritesLoaded && _player._loadsFirst) { if (_player.loadSprites("")) _vm->quitGame(); @@ -342,9 +342,9 @@ void Game::initSection(int sectionNumber) { _vm->_palette->setPalette(_vm->_palette->_mainPalette, 0, 4); _vm->_events->loadCursors("*CURSOR.SS"); - + assert(_vm->_events->_cursorSprites); - _vm->_events->setCursor2((_vm->_events->_cursorSprites->getCount() <= 1) ? + _vm->_events->setCursor2((_vm->_events->_cursorSprites->getCount() <= 1) ? CURSOR_ARROW : CURSOR_WAIT); } @@ -474,9 +474,9 @@ void Game::synchronize(Common::Serializer &s, bool phase1) { void Game::loadGame(int slotNumber) { _saveFile = g_system->getSavefileManager()->openForLoading( _vm->generateSaveName(slotNumber)); - + Common::Serializer s(_saveFile, nullptr); - + // Load the savaegame header MADSSavegameHeader header; if (!readSavegameHeader(_saveFile, header)) diff --git a/engines/mads/globals.cpp b/engines/mads/globals.cpp index 2343dd9c68..f46ca1eb65 100644 --- a/engines/mads/globals.cpp +++ b/engines/mads/globals.cpp @@ -39,7 +39,7 @@ void Globals::synchronize(Common::Serializer &s) { for (int idx = 0; idx < count; ++idx) { v = _data[idx]; s.syncAsSint16LE(v); - } + } } else { _data.clear(); for (int idx = 0; idx < count; ++idx) { diff --git a/engines/mads/inventory.cpp b/engines/mads/inventory.cpp index fecb1b34eb..d41a55fe47 100644 --- a/engines/mads/inventory.cpp +++ b/engines/mads/inventory.cpp @@ -31,7 +31,7 @@ void InventoryObject::synchronize(Common::Serializer &s) { s.syncAsUint16LE(_roomNumber); s.syncAsByte(_article); s.syncAsByte(_vocabCount); - + for (int i = 0; i < 3; ++i) { s.syncAsByte(_vocabList[i]._verbType); s.syncAsByte(_vocabList[i]._prepType); @@ -142,7 +142,7 @@ void InventoryObjects::addToInventory(int objectId) { (*this)[objectId]._roomNumber = PLAYER_INVENTORY; - if (_vm->_game->_kernelMode == KERNEL_ACTIVE_CODE && + if (_vm->_game->_kernelMode == KERNEL_ACTIVE_CODE && _vm->_game->_screenObjects._inputMode == kInputBuildingSentences) { userInterface.categoryChanged(); userInterface.selectObject(userInterface._selectedInvIndex); @@ -164,7 +164,7 @@ void InventoryObjects::removeFromInventory(int objectId, int newScene) { int selectedIndex = userInterface._selectedInvIndex; bool noSelection = selectedIndex < 0; - if (_vm->_game->_kernelMode == KERNEL_ACTIVE_CODE && + if (_vm->_game->_kernelMode == KERNEL_ACTIVE_CODE && _vm->_game->_screenObjects._inputMode == kInputBuildingSentences) userInterface.selectObject(-1); @@ -186,7 +186,7 @@ void InventoryObjects::removeFromInventory(int objectId, int newScene) { newIndex = 0; } - if (_vm->_game->_kernelMode == KERNEL_ACTIVE_CODE && + if (_vm->_game->_kernelMode == KERNEL_ACTIVE_CODE && _vm->_game->_screenObjects._inputMode == kInputBuildingSentences) { userInterface.categoryChanged(); userInterface.selectObject(newIndex); diff --git a/engines/mads/inventory.h b/engines/mads/inventory.h index f3c63f8c4b..9d79431050 100644 --- a/engines/mads/inventory.h +++ b/engines/mads/inventory.h @@ -62,7 +62,7 @@ private: public: SynchronizedList _inventoryList; - /** + /** * Constructor */ InventoryObjects(MADSEngine *vm): _vm(vm) {} diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index 9587efa443..193346dcf9 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -37,7 +37,7 @@ namespace MADS { MADSEngine::MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc) : _gameDescription(gameDesc), Engine(syst), _randomSource("MADS") { - + // Initialise fields _easyMouse = true; _invObjectsAnimated = true; @@ -122,7 +122,7 @@ int MADSEngine::hypotenuse(int xv, int yv) { } bool MADSEngine::canLoadGameStateCurrently() { - return !_game->_winStatus && !_game->globals()[5] + return !_game->_winStatus && !_game->globals()[5] && _dialogs->_pendingDialog == DIALOG_NONE && _events->_cursorId != CURSOR_WAIT; } diff --git a/engines/mads/mads.h b/engines/mads/mads.h index 61d61a2564..3f325fd6a1 100644 --- a/engines/mads/mads.h +++ b/engines/mads/mads.h @@ -137,7 +137,7 @@ public: Common::String generateSaveName(int slot); /** - * Handles loading a game via the GMM + * Handles loading a game via the GMM */ virtual Common::Error loadGameState(int slot); diff --git a/engines/mads/messages.cpp b/engines/mads/messages.cpp index 08e86e20de..e498ab9621 100644 --- a/engines/mads/messages.cpp +++ b/engines/mads/messages.cpp @@ -50,9 +50,9 @@ void KernelMessages::clear() { scene._textSpacing = -1; } -int KernelMessages::add(const Common::Point &pt, uint fontColor, uint8 flags, +int KernelMessages::add(const Common::Point &pt, uint fontColor, uint8 flags, uint8 abortTimers, uint32 timeout, const Common::String &msg) { - Scene &scene = _vm->_game->_scene; + Scene &scene = _vm->_game->_scene; // Find a free slot uint idx = 0; @@ -80,7 +80,7 @@ int KernelMessages::add(const Common::Point &pt, uint fontColor, uint8 flags, rec._actionDetails = scene._action._activeAction; if (flags & KMSG_PLAYER_TIMEOUT) - rec._frameTimer = _vm->_game->_player._ticksAmount + + rec._frameTimer = _vm->_game->_player._ticksAmount + _vm->_game->_player._priorTimer; return idx; @@ -88,7 +88,7 @@ int KernelMessages::add(const Common::Point &pt, uint fontColor, uint8 flags, int KernelMessages::addQuote(int quoteId, int abortTimers, uint32 timeout) { Common::String quoteStr = _vm->_game->getQuote(quoteId); - return add(Common::Point(), 0x1110, KMSG_PLAYER_TIMEOUT | KMSG_CENTER_ALIGN, + return add(Common::Point(), 0x1110, KMSG_PLAYER_TIMEOUT | KMSG_CENTER_ALIGN, abortTimers, timeout, quoteStr); } @@ -104,7 +104,7 @@ void KernelMessages::scrollMessage(int msgIndex, int numTicks, bool quoted) { Common::String msg = _entries[msgIndex]._msg; if (_entries[msgIndex]._flags & KMSG_PLAYER_TIMEOUT) - _entries[msgIndex]._frameTimer2 = _vm->_game->_player._ticksAmount + + _entries[msgIndex]._frameTimer2 = _vm->_game->_player._ticksAmount + _vm->_game->_player._priorTimer; _entries[msgIndex]._frameTimer = _entries[msgIndex]._frameTimer2; @@ -269,7 +269,7 @@ void KernelMessages::processText(int msgIndex) { if (msg._textDisplayIndex < 0) { // Need to create a new text display entry for this message - int idx = scene._textDisplay.add(x1, y1, msg._color1 | (msg._color2 << 8), + int idx = scene._textDisplay.add(x1, y1, msg._color1 | (msg._color2 << 8), scene._textSpacing, displayMsg, _talkFont); if (idx >= 0) msg._textDisplayIndex = idx; @@ -330,7 +330,7 @@ void TextDisplayList::reset() { (*this)[i]._active = false; } -int TextDisplayList::add(int xp, int yp, uint fontColor, int charSpacing, +int TextDisplayList::add(int xp, int yp, uint fontColor, int charSpacing, const Common::String &msg, Font *font) { int usedSlot = -1; @@ -387,7 +387,7 @@ void TextDisplayList::draw(MSurface *s) { if (td._active && (td._expire >= 0)) { td._font->setColors(0xFF, td._color1, td._color2, 0); td._font->writeString(s, td._msg, - Common::Point(td._bounds.left, td._bounds.top), + Common::Point(td._bounds.left, td._bounds.top), td._spacing, td._bounds.width()); } } diff --git a/engines/mads/messages.h b/engines/mads/messages.h index a6d39281a6..8aa8cd54da 100644 --- a/engines/mads/messages.h +++ b/engines/mads/messages.h @@ -36,8 +36,8 @@ namespace MADS { #define TEXT_DISPLAY_SIZE 40 enum KernelMessageFlags { - KMSG_QUOTED = 1, KMSG_PLAYER_TIMEOUT = 2, KMSG_SEQ_ENTRY = 4, KMSG_SCROLL = 8, - KMSG_RIGHT_ALIGN = 0x10, KMSG_CENTER_ALIGN = 0x20, KMSG_EXPIRE = 0x40, + KMSG_QUOTED = 1, KMSG_PLAYER_TIMEOUT = 2, KMSG_SEQ_ENTRY = 4, KMSG_SCROLL = 8, + KMSG_RIGHT_ALIGN = 0x10, KMSG_CENTER_ALIGN = 0x20, KMSG_EXPIRE = 0x40, KMSG_ACTIVE = 0x80 }; @@ -74,7 +74,7 @@ public: ~KernelMessages(); void clear(); - int add(const Common::Point &pt, uint fontColor, uint8 flags, uint8 abortTimers, + int add(const Common::Point &pt, uint fontColor, uint8 flags, uint8 abortTimers, uint32 timeout, const Common::String &msg); int addQuote(int quoteId, int abortTimers, uint32 timeout); void scrollMessage(int msgIndex, int numTicks, bool quoted); @@ -115,7 +115,7 @@ public: void expire(int idx); int add(int xp, int yp, uint fontColor, int charSpacing, const Common::String &, Font *font); - + /** * Reset all of the text display entries in the list to inactive */ @@ -126,7 +126,7 @@ public: * @param surface Surface */ void draw(MSurface *s); - + /** * Determine dirty areas for active text areas */ diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp index 64b3ae1f23..5d1e948f77 100644 --- a/engines/mads/msurface.cpp +++ b/engines/mads/msurface.cpp @@ -37,10 +37,10 @@ MSurface::MSurface() { _freeFlag = false; } -MSurface::MSurface(int width, int height) { +MSurface::MSurface(int width, int height) { pixels = nullptr; _freeFlag = false; - setSize(width, height); + setSize(width, height); } MSurface::~MSurface() { @@ -203,7 +203,7 @@ void MSurface::drawSprite(const Common::Point &pt, SpriteInfo &info, const Commo } } - + delete[] scaledLineBuf; } @@ -212,10 +212,10 @@ void MSurface::empty() { Common::fill(getBasePtr(0, 0), getBasePtr(0, h), 0); } -void MSurface::copyFrom(MSurface *src, const Common::Rect &srcBounds, +void MSurface::copyFrom(MSurface *src, const Common::Rect &srcBounds, const Common::Point &destPos, int transparentColor) { - // Validation of the rectangle and position - int destX = destPos.x, destY = destPos.y; + // Validation of the rectangle and position + int destX = destPos.x, destY = destPos.y; if ((destX >= w) || (destY >= h)) return; diff --git a/engines/mads/msurface.h b/engines/mads/msurface.h index 7cf2bbe15b..060a7ab540 100644 --- a/engines/mads/msurface.h +++ b/engines/mads/msurface.h @@ -63,7 +63,7 @@ public: /** * Helper method for calculating new dimensions when scaling a sprite */ - static int scaleValue(int value, int scale, int err); + static int scaleValue(int value, int scale, int err); public: /** * Basic constructor @@ -128,7 +128,7 @@ public: * Returns a pointer to the surface data */ byte *getData() { return (byte *)Graphics::Surface::getPixels(); } - + /** * Returns a pointer to a given position within the surface */ @@ -168,8 +168,8 @@ public: /** * Copies the surface to a given destination surface */ - void copyTo(MSurface *dest, int transparentColor = -1) { - dest->copyFrom(this, Common::Rect(w, h), Common::Point(), transparentColor); + void copyTo(MSurface *dest, int transparentColor = -1) { + dest->copyFrom(this, Common::Rect(w, h), Common::Point(), transparentColor); } /** diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp index e6e3151472..4d34c76986 100644 --- a/engines/mads/nebular/dialogs_nebular.cpp +++ b/engines/mads/nebular/dialogs_nebular.cpp @@ -46,7 +46,7 @@ bool DialogsNebular::show(int messageId, int objectId) { bool commandFlag = false; bool crFlag = false; TextDialog *dialog = nullptr; - _dialogWidth = 17; + _dialogWidth = 17; _capitalizationMode = kUppercase; // Loop through the lines of the returned text @@ -157,7 +157,7 @@ bool DialogsNebular::show(int messageId, int objectId) { if (!centerFlag) dialog->incNumLines(); - + // Show the dialog _vm->_events->setCursor(CURSOR_ARROW); dialog->show(); @@ -218,7 +218,7 @@ bool DialogsNebular::textNoun(Common::String &dialogText, int nounNum, bool DialogsNebular::commandCheck(const char *idStr, Common::String &valStr, const Common::String &command) { uint idLen = strlen(idStr); - + valStr = (command.size() <= idLen) ? "" : Common::String(command.c_str() + idLen); // Check whether the command starts with the given Id @@ -334,8 +334,8 @@ bool CopyProtectionDialog::getHogAnusEntry(HOGANUS &entry) { /*------------------------------------------------------------------------*/ -PictureDialog::PictureDialog(MADSEngine *vm, const Common::Point &pos, - int maxChars, int objectId) : +PictureDialog::PictureDialog(MADSEngine *vm, const Common::Point &pos, + int maxChars, int objectId) : TextDialog(vm, FONT_INTERFACE, pos, maxChars), _objectId(objectId) { Scene &scene = _vm->_game->_scene; Palette &palette = *_vm->_palette; @@ -406,7 +406,7 @@ ScreenDialog::DialogLine::DialogLine(const Common::String &s) { /*------------------------------------------------------------------------*/ -ScreenDialog::ScreenDialog(MADSEngine *vm) : _vm(vm), +ScreenDialog::ScreenDialog(MADSEngine *vm) : _vm(vm), _savedSurface(MADS_SCREEN_WIDTH, MADS_SCREEN_HEIGHT) { Game &game = *_vm->_game; Scene &scene = game._scene; @@ -466,7 +466,7 @@ ScreenDialog::ScreenDialog(MADSEngine *vm) : _vm(vm), MADS_SCREEN_WIDTH, _vm->_screen._offset.y + 157)); */ - game._fx = _vm->_screenFade == SCREEN_FADE_SMOOTH ? + game._fx = _vm->_screenFade == SCREEN_FADE_SMOOTH ? kCenterVertTransition : kTransitionFadeIn; game._trigger = 0; _vm->_events->setCursor(CURSOR_ARROW); diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index 9a4fa97a57..86435c655f 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -45,7 +45,7 @@ ProtectionResult GameNebular::checkCopyProtection() { /* // DEBUG: Flag copy protection failure _globals[kCopyProtectFailed] = -1; - + if (!ConfMan.getBool("copy_protection")) return true; @@ -398,7 +398,7 @@ void GameNebular::doObjectAction() { error("TODO: object_get_folder - loc_29B48"); messageId = 860; } - + if (id == OBJ_TAPE_PLAYER && _objects[OBJ_AUDIO_TAPE]._roomNumber == OBJ_TAPE_PLAYER) messageId = 867; diff --git a/engines/mads/nebular/globals_nebular.h b/engines/mads/nebular/globals_nebular.h index 921c308346..fea90c515e 100644 --- a/engines/mads/nebular/globals_nebular.h +++ b/engines/mads/nebular/globals_nebular.h @@ -284,7 +284,7 @@ class NebularGlobals: public Globals { public: SynchronizedList _spriteIndexes; SynchronizedList _sequenceIndexes; - + int _timebombClock, _timebombTimer; public: /** diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index ecc80c8ce3..c202fe1f80 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -124,7 +124,7 @@ void Scene101::sayDang() { _scene->_sequences.setAnimRange(_globals._sequenceIndexes[11], 17, 17); _scene->_kernelMessages.add(Common::Point(143, 61), 0x1110, 0, 0, 60, _game.getQuote(57)); _scene->_sequences.addTimer(120, 73); - break; + break; case 73: _vm->_dialogs->show(0x2785); @@ -278,7 +278,7 @@ void Scene101::preActions() { if (_game._player._needToWalk) { switch (_game._trigger) { case 0: - _game._player._needToWalk = false; + _game._player._needToWalk = false; _game._player._stepEnabled = false; _scene->_sequences.remove(_globals._sequenceIndexes[11]); _globals._sequenceIndexes[11] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[11], false, 3, 1, 0, 0); @@ -1248,7 +1248,7 @@ void Scene103::enter() { _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 6, 0, 2, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 0); - _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 6, 0, 0, 25); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 6, 0, 0, 25); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_SPRITE, 2, 72); _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 6, 0, 1, 37); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_SPRITE, 2, 73); @@ -1267,7 +1267,7 @@ void Scene103::enter() { _globals._sequenceIndexes[10] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[10], false, 6); else _vm->_game->_scene._hotspots.activate(289, false); - + if (_globals[kTurkeyExploded]) { _globals._sequenceIndexes[9] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 6); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[9], -2, -2); @@ -1325,7 +1325,7 @@ void Scene103::step() { default: break; } - + if (_scene->_frameStartTime >= _updateClock) { pt = _vm->_game->_player._playerPos; dist = _vm->hypotenuse(pt.x - 79, pt.y - 137); @@ -1471,7 +1471,7 @@ void Scene103::actions() { _sayHiToBinky = false; break; } - + case 2: _scene->_kernelMessages.reset(); _scene->_sequences.addTimer(1, 3); @@ -1868,25 +1868,25 @@ void Scene105::actions() { _vm->_dialogs->showItem(OBJ_DEAD_FISH, 802, 0); } } else if (_action.isAction(VERB_LOOK, 0x195)) - _vm->_dialogs->show(0x2905); + _vm->_dialogs->show(0x2905); else if (_action.isAction(VERB_LOOK, 0x4D)) - _vm->_dialogs->show(0x2906); + _vm->_dialogs->show(0x2906); else if (_action.isAction(VERB_LOOK, 0xF0)) - _vm->_dialogs->show(0x2907); + _vm->_dialogs->show(0x2907); else if (_action.isAction(VERB_LOOK, 0xDD)) - _vm->_dialogs->show(0x2908); + _vm->_dialogs->show(0x2908); else if (_action.isAction(VERB_TAKE, 0xDD)) - _vm->_dialogs->show(0x2909); + _vm->_dialogs->show(0x2909); else if (_action.isAction(VERB_LOOK, 0xE0)) - _vm->_dialogs->show(0x290A); + _vm->_dialogs->show(0x290A); else if (_action.isAction(VERB_LOOK, 0x65)) - _vm->_dialogs->show(0x290C); + _vm->_dialogs->show(0x290C); else if (_action.isAction(VERB_LOOK, 0x158)) - _vm->_dialogs->show(0x290D); + _vm->_dialogs->show(0x290D); else if (_action.isAction(VERB_LOOK, 0xF5)) - _vm->_dialogs->show(0x290E); + _vm->_dialogs->show(0x290E); else if (_action.isAction(VERB_LOOK, 0x129)) - _vm->_dialogs->show(0x290F); + _vm->_dialogs->show(0x290F); else return; @@ -2289,7 +2289,7 @@ void Scene108::actions() { _scene->_sequences.remove(_globals._sequenceIndexes[4]); _game._objects.addToInventory(OBJ_DEAD_FISH); _globals[kFishIn108] = false; - _vm->_dialogs->showItem(OBJ_DEAD_FISH, 10808); + _vm->_dialogs->showItem(OBJ_DEAD_FISH, 10808); } } else if (_action.isAction(0x15D, 0xF4)) _scene->_nextSceneId = 107; @@ -2618,7 +2618,7 @@ void Scene109::actions() { threshold = 50; break; } - + if (_globals[kHoovicFishEaten] >= threshold) { int randVal = _vm->getRandomNumber(83, 84); _scene->_kernelMessages.add(Common::Point(230, 24), 0xFDFC, 0, 0, 120, _game.getQuote(randVal)); @@ -2690,28 +2690,28 @@ void Scene109::actions() { _scene->_sequences.remove(_globals._sequenceIndexes[3]); _game._objects.addToInventory(OBJ_BURGER); } else if (_action.isAction(VERB_LOOK, 0xF0)) - _vm->_dialogs->show(0x2A95); + _vm->_dialogs->show(0x2A95); else if (_action.isAction(VERB_LOOK, 0x5A)) - _vm->_dialogs->show(0x2A96); + _vm->_dialogs->show(0x2A96); else if ((_action.isAction(VERB_TAKE) || _action.isAction(VERB_PULL)) && _action.isAction(0x5A)) - _vm->_dialogs->show(0x2A97); + _vm->_dialogs->show(0x2A97); else if (_action.isAction(VERB_LOOK, 0x129)) - _vm->_dialogs->show(0x2A98); + _vm->_dialogs->show(0x2A98); else if (_action.isAction(VERB_TAKE, 0x129)) - _vm->_dialogs->show(0x2A99); + _vm->_dialogs->show(0x2A99); else if (_action.isAction(VERB_LOOK, 0x45)) - _vm->_dialogs->show(0x2A9A); + _vm->_dialogs->show(0x2A9A); else if (_action.isAction(VERB_LOOK, 0x178)) { if (_globals[kHoovicAlive]) - _vm->_dialogs->show(0x2A9B); + _vm->_dialogs->show(0x2A9B); else _vm->_dialogs->show(0x2AA1); } else if (_action.isAction(VERB_LOOK, 0x146)) - _vm->_dialogs->show(0x2A9C); + _vm->_dialogs->show(0x2A9C); else if (_action.isAction(VERB_LOOK, 0xFC)) - _vm->_dialogs->show(0x2A9F); + _vm->_dialogs->show(0x2A9F); else if (_action.isAction(VERB_PUT, 0x146)) - _vm->_dialogs->show(0x2A9E); + _vm->_dialogs->show(0x2A9E); else if (_action.isAction(VERB_LOOK, 0x66)) _vm->_dialogs->show(0x2AA2); else @@ -2835,19 +2835,19 @@ void Scene110::actions() { } else if ((_action._lookFlag) || _action.isAction(VERB_LOOK, 0x3F)) _vm->_dialogs->show(0x2AF9); else if (_action.isAction(VERB_LOOK, 0x40) || _action.isAction(0xD1, 0x40)) - _vm->_dialogs->show(0x2AFA); + _vm->_dialogs->show(0x2AFA); else if (_action.isAction(VERB_LOOK, 0x129)) - _vm->_dialogs->show(0x2AFB); + _vm->_dialogs->show(0x2AFB); else if (_action.isAction(VERB_TAKE, 0x129)) - _vm->_dialogs->show(0x2AFC); + _vm->_dialogs->show(0x2AFC); else if (_action.isAction(VERB_LOOK, 0x178)) - _vm->_dialogs->show(0x2AFD); + _vm->_dialogs->show(0x2AFD); else if (_action.isAction(VERB_LOOK, 0x41)) - _vm->_dialogs->show(0x2AFE); + _vm->_dialogs->show(0x2AFE); else if (_action.isAction(VERB_LOOK, 0x8F)) - _vm->_dialogs->show(0x2AFF); + _vm->_dialogs->show(0x2AFF); else if (_action.isAction(VERB_TAKE, 0x8F)) - _vm->_dialogs->show(0x2B00); + _vm->_dialogs->show(0x2B00); else return; diff --git a/engines/mads/nebular/nebular_scenes1.h b/engines/mads/nebular/nebular_scenes1.h index 38caf1560e..80df7f9e4d 100644 --- a/engines/mads/nebular/nebular_scenes1.h +++ b/engines/mads/nebular/nebular_scenes1.h @@ -66,7 +66,7 @@ private: void sayDang(); public: - Scene101(MADSEngine *vm) : Scene1xx(vm), _sittingFl(false), _panelOpened(false), _messageNum(0), + Scene101(MADSEngine *vm) : Scene1xx(vm), _sittingFl(false), _panelOpened(false), _messageNum(0), _posY(0), _shieldSpriteIdx(0), _chairHotspotId(0), _oldSpecial(0) {} virtual void setup(); diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 44deeba77e..78421e6c04 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -1139,9 +1139,9 @@ void Scene307::actions() { void Scene307::synchronize(Common::Serializer &s) { Scene3xx::synchronize(s); - + _forceField.synchronize(s); - + s.syncAsByte(_afterPeeingFl); s.syncAsByte(_duringPeeingFl); s.syncAsByte(_grateOpenedFl); @@ -1286,7 +1286,7 @@ void Scene308::step() { void Scene308::synchronize(Common::Serializer &s) { Scene3xx::synchronize(s); - + _forceField.synchronize(s); } @@ -1477,7 +1477,7 @@ void Scene309::step() { void Scene309::synchronize(Common::Serializer &s) { Scene3xx::synchronize(s); - + _forceField.synchronize(s); for (int i = 0; i < 3; ++i) @@ -1522,7 +1522,7 @@ void Scene310::step() { void Scene310::synchronize(Common::Serializer &s) { Scene3xx::synchronize(s); - + _forceField.synchronize(s); } @@ -1817,7 +1817,7 @@ void Scene311::actions() { void Scene311::synchronize(Common::Serializer &s) { Scene3xx::synchronize(s); - + s.syncAsByte(_checkGuardFl); } @@ -3438,7 +3438,7 @@ void Scene319::synchronize(Common::Serializer &s) { s.syncAsByte(_slacheTalkingFl); s.syncAsByte(_slacheReady); s.syncAsByte(_slacheInitFl); - + s.syncString(_subQuote2); } diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h index f6d1ab5851..b42238ddb4 100644 --- a/engines/mads/nebular/nebular_scenes3.h +++ b/engines/mads/nebular/nebular_scenes3.h @@ -181,7 +181,7 @@ private: int _characterSpriteIndexes[3]; int _messagesIndexes[3]; int _lastFrame; - + public: Scene309(MADSEngine *vm) : Scene3xx(vm) {} diff --git a/engines/mads/nebular/nebular_scenes4.h b/engines/mads/nebular/nebular_scenes4.h index f2e8961089..8ff2ec59f8 100644 --- a/engines/mads/nebular/nebular_scenes4.h +++ b/engines/mads/nebular/nebular_scenes4.h @@ -110,14 +110,14 @@ private: Conversation _dialog2; Conversation _dialog3; Conversation _dialog4; - + void setDialogNode(int node); void handleConversation1(); void handleConversation2(); void handleConversation3(); void handleConversation4(); void handleDialogs(); - + public: Scene402(MADSEngine *vm) : Scene4xx(vm) {} void synchronize(Common::Serializer &s); diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index 4ae2925c72..42ec3f1b02 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -226,7 +226,7 @@ void Scene707::enter() { // The original uses Scene7xx_sceneEntrySound if (!_vm->_musicFlag) _vm->_sound->command(2); - else + else _vm->_sound->command(25); } @@ -337,7 +337,7 @@ void Scene711::enter() { // The original was using Scene7xx_SceneEntrySound() if (!_vm->_musicFlag) _vm->_sound->command(2); - else + else _vm->_sound->command(25); } diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index 1ae10ed72b..0be53ef41d 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -167,7 +167,7 @@ void Scene804::step() { switch (_game._storyMode) { case STORYMODE_NAUGHTY: if (_scene->_activeAnimation->getCurrentFrame() == 81) { - _resetFrame = 80; + _resetFrame = 80; _globals[kInSpace] = false; _globals[kBeamIsUp] = true; @@ -177,7 +177,7 @@ void Scene804::step() { } break; - case STORYMODE_NICE: + case STORYMODE_NICE: if (_scene->_activeAnimation->getCurrentFrame() == 68) { _resetFrame = 66; _globals[kInSpace] = false; @@ -240,10 +240,10 @@ void Scene804::step() { case 26: case 28: case 31: - _resetFrame = 0; + _resetFrame = 0; break; } - } else { + } else { if ((_scene->_activeAnimation->getCurrentFrame() == 36) && (!_throttleGone)) { _scene->_sequences.remove(_globals._sequenceIndexes[1]); _throttleGone = true; diff --git a/engines/mads/nebular/sound_nebular.cpp b/engines/mads/nebular/sound_nebular.cpp index 5f1d80513e..de6846bb17 100644 --- a/engines/mads/nebular/sound_nebular.cpp +++ b/engines/mads/nebular/sound_nebular.cpp @@ -74,7 +74,7 @@ void AdlibChannel::enable(int flag) { // WORKAROUND: Original set _soundData pointer to flag. Since this seems // just intended to invalidate any prior pointer, I've replaced it with // a simple null pointer - _soundData = nullptr; + _soundData = nullptr; } } @@ -185,7 +185,7 @@ ASound::ASound(Audio::Mixer *mixer, const Common::String &filename, int dataOffs assert(_opl); _opl->init(getRate()); - _mixer->playStream(Audio::Mixer::kPlainSoundType, &_soundHandle, this, -1, + _mixer->playStream(Audio::Mixer::kPlainSoundType, &_soundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true); // Initialise the Adlib @@ -213,7 +213,7 @@ void ASound::adlibInit() { write(4, 0x80); } -int ASound::stop() { +int ASound::stop() { command0(); int result = _pollResult; _pollResult = 0; @@ -238,7 +238,7 @@ void ASound::noise() { } if (_v2) { - setFrequency(_channelNum2, (randomVal & _freqMask2) + _freqBase2); + setFrequency(_channelNum2, (randomVal & _freqMask2) + _freqBase2); } } @@ -278,7 +278,7 @@ void ASound::resultCheck() { } byte *ASound::loadData(int offset, int size) { - // First scan for an existing copy + // First scan for an existing copy Common::List::iterator i; for (i = _dataCache.begin(); i != _dataCache.end(); ++i) { CachedDataEntry &e = *i; @@ -392,7 +392,7 @@ void ASound::checkChannels() { } void ASound::pollActiveChannel() { - AdlibChannel *chan = _activeChannelPtr; + AdlibChannel *chan = _activeChannelPtr; bool updateFlag = true; if (chan->_activeCount) { @@ -572,7 +572,7 @@ void ASound::pollActiveChannel() { chan->_field1F = *++pSrc; chan->_pSrc += 2; break; - + default: break; } @@ -624,7 +624,7 @@ void ASound::updateOctave() { } static int _vList1[] = { - 0x200, 0x21E, 0x23F, 0x261, 0x285, 0x2AB, + 0x200, 0x21E, 0x23F, 0x261, 0x285, 0x2AB, 0x2D4, 0x2FF, 0x32D, 0x35D, 0x390, 0x3C7 }; @@ -688,7 +688,7 @@ static const int volumeList[] = { 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, - 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; @@ -696,7 +696,7 @@ void ASound::updateActiveChannel() { int reg = 0x40 + outputChannels[outputIndexes[_activeChannelNumber * 2]]; int portVal = _ports[reg] & 0xFFC0; int newVolume = CLIP(_activeChannelPtr->_volume + _activeChannelPtr->_field1E, 0, 63); - + // Note: Original had a whole block not seeming to be used, since the initialisation // sets a variable to 5660h, and doesn't change it, so the branch is never taken int val = CLIP(newVolume - volumeList[_activeChannelPtr->_fieldD], 0, 63); @@ -756,7 +756,7 @@ void ASound::processSample() { // Write out waveform select write2(8, 0xE0 + _v11, _samplePtr->_waveformSelect & 3); - + // Write out total level & scaling level val = -((_samplePtr->_totalLevel & 0x3F) - 0x3F) | (_samplePtr->_scalingLevel << 6); write2(8, 0x40 + _v11, val); @@ -813,7 +813,7 @@ int ASound::command0() { _freqMask1 = _freqMask2 = 0; _freqBase1 = _freqBase2 = 0; _v7 = 0; - _v8 = 0; + _v8 = 0; // Reset Adlib port registers for (int reg = 0x4F; reg >= 0x40; --reg) @@ -907,21 +907,21 @@ int ASound::command8() { const ASound1::CommandPtr ASound1::_commandList[42] = { &ASound1::command0, &ASound1::command1, &ASound1::command2, &ASound1::command3, - &ASound1::command4, &ASound1::command5, &ASound1::command6, &ASound1::command7, + &ASound1::command4, &ASound1::command5, &ASound1::command6, &ASound1::command7, &ASound1::command8, &ASound1::command9, &ASound1::command10, &ASound1::command11, &ASound1::command12, &ASound1::command13, &ASound1::command14, &ASound1::command15, - &ASound1::command16, &ASound1::command17, &ASound1::command18, &ASound1::command19, - &ASound1::command20, &ASound1::command21, &ASound1::command22, &ASound1::command23, + &ASound1::command16, &ASound1::command17, &ASound1::command18, &ASound1::command19, + &ASound1::command20, &ASound1::command21, &ASound1::command22, &ASound1::command23, &ASound1::command24, &ASound1::command25, &ASound1::command26, &ASound1::command27, - &ASound1::command28, &ASound1::command29, &ASound1::command30, &ASound1::command31, + &ASound1::command28, &ASound1::command29, &ASound1::command30, &ASound1::command31, &ASound1::command32, &ASound1::command33, &ASound1::command34, &ASound1::command35, - &ASound1::command36, &ASound1::command37, &ASound1::command38, &ASound1::command39, + &ASound1::command36, &ASound1::command37, &ASound1::command38, &ASound1::command39, &ASound1::command40, &ASound1::command41 }; ASound1::ASound1(Audio::Mixer *mixer): ASound(mixer, "asound.001", 0x1520) { _cmd23Toggle = false; - + // Load sound samples _soundFile.seek(_dataOffset + 0x12C); for (int i = 0; i < 98; ++i) @@ -1134,7 +1134,7 @@ int ASound1::command33() { int ASound1::command34() { int v = getRandomNumber() & 0x20; - if (!v) + if (!v) v = 0x60; byte *pData = loadData(0xDD0, 22); diff --git a/engines/mads/nebular/sound_nebular.h b/engines/mads/nebular/sound_nebular.h index caafdcaf77..44e108fd04 100644 --- a/engines/mads/nebular/sound_nebular.h +++ b/engines/mads/nebular/sound_nebular.h @@ -167,7 +167,7 @@ private: void updateChannelState(); void updateActiveChannel(); - + /** * Loads up the specified sample */ @@ -339,12 +339,12 @@ public: * Main buffer read */ virtual int readBuffer(int16 *buffer, const int numSamples); - + /** * Mono sound only */ virtual bool isStereo() const { return false; } - + /** * Data is continuously pushed, so definitive end */ diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index 6beaad9787..6be9d3dc30 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -72,7 +72,7 @@ void PaletteUsage::prioritize(Common::Array &palette) { RGB6 &palEntry = palette[(*_data)[i]._palIndex]; (*_data)[i]._sortValue = _vm->_palette->rgbMerge(palEntry); } - + Common::sort(_data->begin(), _data->end(), sortHelper); } @@ -139,7 +139,7 @@ int PaletteUsage::process(Common::Array &palette, uint flags) { } Common::sort(palRange.begin(), palRange.end(), rangeSorter); - + int var3A = (flags & 0x4000) ? 0xffff : 0xfffe; for (uint palIndex = 0; palIndex < palette.size(); ++palIndex) { @@ -183,7 +183,7 @@ int PaletteUsage::process(Common::Array &palette, uint flags) { (((flags & 0x2000) || (palette[palIndex]._flags & 0x4000)) && ((flags & 0x1000) || (palCount == 0))) ? 0x7fff : 1; int var36 = (palette[palIndex]._flags & 0x80) ? 0 : 2; - + for (int idx = palLow; idx < palIdx; ++idx) { uint32 v = _vm->_palette->_palFlags[idx]; if ((v & var3A) && !(v & var36)) { @@ -225,7 +225,7 @@ int PaletteUsage::process(Common::Array &palette, uint flags) { } } } - + assert(var48); int var52 = (noUsageFlag && palette[palIndex]._u2) ? 2 : 0; @@ -430,7 +430,7 @@ void Fader::mapToGreyRamp(byte palette[PALETTE_SIZE], int baseColor, int numColo for (int idx = 0; idx < PALETTE_COUNT; ++idx) { map[idx]._mapColor = (byte)idx; } - + // Sort the mapping list Common::sort(&greyList[0], &greyList[numColors], greyCompareFunc); @@ -486,7 +486,7 @@ void Fader::mapToGreyRamp(byte palette[PALETTE_SIZE], int baseColor, int numColo } } -void Fader::getGreyValues(const byte palette[PALETTE_SIZE], +void Fader::getGreyValues(const byte palette[PALETTE_SIZE], GreyTableEntry greyList[PALETTE_COUNT], int baseColor, int numColors) { const byte *palP = &palette[baseColor * 3]; @@ -496,7 +496,7 @@ void Fader::getGreyValues(const byte palette[PALETTE_SIZE], } } -void Fader::greyPopularity(const GreyTableEntry greyList[PALETTE_COUNT], +void Fader::greyPopularity(const GreyTableEntry greyList[PALETTE_COUNT], byte greyTable[64], int numColors) { Common::fill(&greyTable[0], &greyTable[64], 0); for (int i = 0; i < numColors; ++i) { @@ -590,7 +590,7 @@ void Palette::setSystemPalette() { palData[1 * 3] = palData[1 * 3 + 1] = palData[1 * 3 + 2] = 0x54; palData[2 * 3] = palData[2 * 3 + 1] = palData[2 * 3 + 2] = 0xb4; palData[3 * 3] = palData[3 * 3 + 1] = palData[3 * 3 + 2] = 0xff; - + setPalette(palData, 0, 4); } @@ -624,11 +624,11 @@ void Palette::initPalette() { for (int idx = 0; idx < _vm->_game->_player._numSprites; ++idx) { SpriteAsset *asset = _vm->_game->_scene._sprites[ _vm->_game->_player._spritesStart + idx]; - + uint32 mask = 1; if (asset->_usageIndex) mask <<= asset->_usageIndex; - + palMask = mask; } } diff --git a/engines/mads/palette.h b/engines/mads/palette.h index 9bf5bfa830..31c3d1a90f 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -42,13 +42,13 @@ class MADSEngine; * Palette mapping options */ enum { - PALFLAG_BACKGROUND = 0x8000, // Loading initial background - PALFLAG_RESERVED = 0x4000, // Enable mapping reserved colors - PALFLAG_ANY_TO_CLOSEST = 0x2000, // Any color can map to closest - PALFLAG_ALL_TO_CLOSEST = 0x1000, // Any colors that can map must map - PALFLAG_TOP_COLORS = 0x0800, // Allow mapping to high four colors - PALFLAG_DEFINE_RESERVED = 0x0400, // Define initial reserved color - PALFLAG_MASK = 0xfc00 // Mask for all the palette flags + PALFLAG_BACKGROUND = 0x8000, // Loading initial background + PALFLAG_RESERVED = 0x4000, // Enable mapping reserved colors + PALFLAG_ANY_TO_CLOSEST = 0x2000, // Any color can map to closest + PALFLAG_ALL_TO_CLOSEST = 0x1000, // Any colors that can map must map + PALFLAG_TOP_COLORS = 0x0800, // Allow mapping to high four colors + PALFLAG_DEFINE_RESERVED = 0x0400, // Define initial reserved color + PALFLAG_MASK = 0xfc00 // Mask for all the palette flags }; struct PaletteCycle { @@ -182,7 +182,7 @@ private: /** * Given a grey value list containing grey shades (0-63), creates a 64 byte - * grey table containing the number of grey values for each intensity + * grey table containing the number of grey values for each intensity */ void greyPopularity(const GreyTableEntry greyList[PALETTE_COUNT], byte greyTable[64], int numColors); protected: @@ -259,7 +259,7 @@ public: * Constructor */ Palette(MADSEngine *vm); - + /** * Destructor */ diff --git a/engines/mads/phantom/game_phantom.cpp b/engines/mads/phantom/game_phantom.cpp index 25da7771c5..5232322c73 100644 --- a/engines/mads/phantom/game_phantom.cpp +++ b/engines/mads/phantom/game_phantom.cpp @@ -44,7 +44,7 @@ ProtectionResult GamePhantom::checkCopyProtection() { /* // DEBUG: Flag copy protection failure _globals[5] = -1; - + if (!ConfMan.getBool("copy_protection")) return true; diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index aea73bbbec..96e2cd6ea1 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -71,7 +71,7 @@ Player::Player(MADSEngine *vm): _vm(vm) { _frameListIndex = 0; _stopWalkerIndex = 0; _totalDistance = 0; - + Common::fill(&_stopWalkerList[0], &_stopWalkerList[12], 0); Common::fill(&_stopWalkerTrigger[0], &_stopWalkerTrigger[12], 0); Common::fill(&_spriteSetsPresent[0], &_spriteSetsPresent[PLAYER_SPRITES_FILE_COUNT], false); @@ -273,7 +273,7 @@ void Player::update() { int newDepth = 1; int yp = MIN(_playerPos.y, (int16)(MADS_SCENE_HEIGHT - 1)); - + for (int idx = 1; idx < 15; ++idx) { if (scene._sceneInfo->_depthList[newDepth] >= yp) newDepth = idx + 1; @@ -299,11 +299,11 @@ void Player::update() { if (slotIndex >= 0) { // Check if the existing player slot has the same details, and can be re-used SpriteSlot &s2 = scene._spriteSlots[slotIndex]; - bool equal = (s2._seqIndex == slot._seqIndex) + bool equal = (s2._seqIndex == slot._seqIndex) && (s2._spritesIndex == slot._spritesIndex) - && (s2._frameNumber == slot._frameNumber) + && (s2._frameNumber == slot._frameNumber) && (s2._position == slot._position) - && (s2._depth == slot._depth) + && (s2._depth == slot._depth) && (s2._scale == slot._scale); if (equal) @@ -319,7 +319,7 @@ void Player::update() { scene._spriteSlots[slotIndex] = slot; } - // If changing a scene, check to change the scene when the player + // If changing a scene, check to change the scene when the player // has moved off-screen if (_walkOffScreen) { SpriteAsset *asset = scene._sprites[slot._spritesIndex]; @@ -545,7 +545,7 @@ int Player::getSpriteSlot() { SpriteSlots &spriteSlots = _vm->_game->_scene._spriteSlots; for (uint idx = 0; idx < spriteSlots.size(); ++idx) { - if (spriteSlots[idx]._seqIndex == PLAYER_SEQ_INDEX && + if (spriteSlots[idx]._seqIndex == PLAYER_SEQ_INDEX && spriteSlots[idx]._flags >= IMG_STATIC) return idx; } diff --git a/engines/mads/rails.cpp b/engines/mads/rails.cpp index 00f7f4cdbc..6beee5a242 100644 --- a/engines/mads/rails.cpp +++ b/engines/mads/rails.cpp @@ -101,7 +101,7 @@ void Rails::setupRouteNode(int *routeIndexP, int nodeIndex, int flags, int route int subIndex = _nodes.size() - 2; int distanceVal = _nodes[nodeIndex]._distances[subIndex]; - if (distanceVal & flags) { + if (distanceVal & flags) { routeLength += distanceVal & 0x3FFF; if (routeLength < _routeLength) { // Found a new shorter route to destination, so set up the route with the found one @@ -266,7 +266,7 @@ int Rails::getRouteFlags(const Common::Point &src, const Common::Point &dest) { void Rails::synchronize(Common::Serializer &s) { s.syncAsSint16LE(_routeLength); s.syncAsSint16LE(_next); - + int count = _routeIndexes.size(); if (s.isSaving()) { for (int i = 0; i < count; ++i) diff --git a/engines/mads/rails.h b/engines/mads/rails.h index 4014491e25..e6cab08f85 100644 --- a/engines/mads/rails.h +++ b/engines/mads/rails.h @@ -51,7 +51,7 @@ public: typedef Common::Array WalkNodeList; /** - * This class handles storing the intermediate walk node points for a + * This class handles storing the intermediate walk node points for a * given scene, and calculating walking routes between any two positions. */ class Rails { diff --git a/engines/mads/resources.cpp b/engines/mads/resources.cpp index f0609448bb..4f5596dea6 100644 --- a/engines/mads/resources.cpp +++ b/engines/mads/resources.cpp @@ -169,10 +169,10 @@ void HagArchive::loadIndex(MADSEngine *vm) { Common::String::format("SECTION%d.HAG", sectionIndex); if (!hagFile.open(filename)) error("Could not locate HAG file - %s", filename.c_str()); - + // Check for header char headerBuffer[16]; - if ((hagFile.read(headerBuffer, 16) != 16) || + if ((hagFile.read(headerBuffer, 16) != 16) || (strncmp(headerBuffer, MADSCONCAT_STRING, 10) != 0)) error("Invalid HAG file opened"); @@ -269,7 +269,7 @@ ResourceType HagArchive::getResourceType(const Common::String &resourceName) con } else if (resourceName.hasPrefix("SPCHC")) { // SPEECH resource return RESTYPE_SPEECH; - } + } // Check for a known extension const char *extPos = strchr(resourceName.c_str(), '.'); @@ -360,7 +360,7 @@ Common::String Resources::formatName(int prefix, char asciiCh, int id, EXTTYPE e return result; } -Common::String Resources::formatResource(const Common::String &resName, +Common::String Resources::formatResource(const Common::String &resName, const Common::String &hagFilename) { // int v1 = 0, v2 = 0; diff --git a/engines/mads/resources.h b/engines/mads/resources.h index 7d56138da5..137eb7a169 100644 --- a/engines/mads/resources.h +++ b/engines/mads/resources.h @@ -37,7 +37,7 @@ enum RESPREFIX { }; enum EXTTYPE { - EXT_NONE = -1, EXT_SS = 1, EXT_AA = 2, EXT_DAT = 3, EXT_HH = 4, + EXT_NONE = -1, EXT_SS = 1, EXT_AA = 2, EXT_DAT = 3, EXT_HH = 4, EXT_ART = 5, EXT_INT = 6 }; diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 609e2335e4..32956e6484 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -32,7 +32,7 @@ namespace MADS { Scene::Scene(MADSEngine *vm): _vm(vm), _action(_vm), _depthSurface(vm), _dirtyAreas(_vm), _dynamicHotspots(vm), _hotspots(vm), - _kernelMessages(vm), _sequences(vm), _sprites(vm), _spriteSlots(vm), + _kernelMessages(vm), _sequences(vm), _sprites(vm), _spriteSlots(vm), _textDisplay(vm), _userInterface(vm) { _priorSceneId = 0; _nextSceneId = 0; @@ -169,11 +169,11 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) { flags |= ANIMFLAG_DITHER; if (_vm->_textWindowStill) flags |= ANIMFLAG_LOAD_BACKGROUND_ONLY; - + _animationData = Animation::init(_vm, this); MSurface depthSurface; _animationData->load(_userInterface, depthSurface, prefix, flags, nullptr, nullptr); - + _vm->_palette->_paletteUsage.load(&_scenePaletteUsage); _bandsRange = _sceneInfo->_yBandsEnd - _sceneInfo->_yBandsStart; @@ -184,7 +184,7 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) { _spritesCount = _sprites.size(); _userInterface.setup(_vm->_game->_screenObjects._inputMode); - + _vm->_game->_screenObjects._category = CAT_NONE; _vm->_events->showCursor(); @@ -386,7 +386,7 @@ void Scene::doFrame() { _frameStartTime = _vm->_events->getFrameCounter(); // Handle parser actions as well as game triggers - if ((_action._inProgress && !player._moving && !player._needToWalk && + if ((_action._inProgress && !player._moving && !player._needToWalk && (player._facing == player._turnToFacing) && !_vm->_game->_trigger) || (_vm->_game->_trigger && (_vm->_game->_triggerMode == SEQUENCE_TRIGGER_PARSER))) { doAction(); @@ -420,7 +420,7 @@ void Scene::doFrame() { if (_vm->_debugger->_showMousePos) { Common::Point pt = _vm->_events->mousePos(); Common::String msg = Common::String::format("(%d,%d)", pt.x, pt.y); - mouseTextIndex = _kernelMessages.add(Common::Point(5, 5), + mouseTextIndex = _kernelMessages.add(Common::Point(5, 5), 0x203, 0, 0, 1, msg); } @@ -504,7 +504,7 @@ void Scene::drawElements(ScreenTransition transitionType, bool surfaceFlag) { } void Scene::doPreactions() { - if (_vm->_game->_screenObjects._inputMode == kInputBuildingSentences || + if (_vm->_game->_screenObjects._inputMode == kInputBuildingSentences || _vm->_game->_screenObjects._inputMode == kInputLimitedSentences) { _vm->_game->_triggerSetupMode = SEQUENCE_TRIGGER_PREPARE; _action.checkAction(); @@ -533,7 +533,7 @@ void Scene::doAction() { flag = !_action._inProgress; } - if ((_action._inProgress || _vm->_game->_trigger) && + if ((_action._inProgress || _vm->_game->_trigger) && (!flag || _action._savedFields._commandError == flag)) { _vm->_game->doObjectAction(); } @@ -589,7 +589,7 @@ void Scene::loadAnimation(const Common::String &resName, int trigger) { UserInterface interfaceSurface(_vm); _activeAnimation = Animation::init(_vm, this); - _activeAnimation->load(interfaceSurface, depthSurface, resName, + _activeAnimation->load(interfaceSurface, depthSurface, resName, _vm->_dithering ? ANIMFLAG_DITHER : 0, nullptr, nullptr); _activeAnimation->startAnimation(trigger); } diff --git a/engines/mads/scene.h b/engines/mads/scene.h index 3661bd6502..69a2c0d78d 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -224,7 +224,7 @@ public: void resetScene(); /** - * Removes all the scene specific sprites fromt the sprites list, + * Removes all the scene specific sprites fromt the sprites list, * leaving any player sprites list in place at the start of the list. */ void removeSprites(); diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index 272c8288f0..256a517540 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -112,7 +112,7 @@ SceneInfo *SceneInfo::init(MADSEngine *vm) { void SceneInfo::load(int sceneId, int variant, const Common::String &resName, int flags, MSurface &depthSurface, MSurface &bgSurface) { bool sceneFlag = sceneId >= 0; - + // Figure out the resource to use Common::String resourceName; if (sceneFlag) { @@ -133,7 +133,7 @@ void SceneInfo::load(int sceneId, int variant, const Common::String &resName, infoStream->skip(6); // actual scene ID (string) _sceneId = sceneId; } - + // TODO: The following isn't quite right for V2 games (it's all 0) _artFileNum = infoStream->readUint16LE(); _depthStyle = infoStream->readUint16LE(); @@ -161,7 +161,7 @@ void SceneInfo::load(int sceneId, int variant, const Common::String &resName, for (int i = 0; i < 20; ++i) { WalkNode node; node.load(infoStream); - + if (i < nodeCount) _nodes.push_back(node); } @@ -169,7 +169,7 @@ void SceneInfo::load(int sceneId, int variant, const Common::String &resName, int spriteSetsCount = infoStream->readUint16LE(); int spriteInfoCount = infoStream->readUint16LE(); - // Load in sprite sets + // Load in sprite sets Common::StringArray setNames; for (int i = 0; i < 10; ++i) { char name[64]; @@ -236,7 +236,7 @@ void SceneInfo::load(int sceneId, int variant, const Common::String &resName, SpriteAsset *sprites = new SpriteAsset(_vm, setResName, flags); spriteSets.push_back(sprites); - usageList.push_back(sprites->_usageIndex); + usageList.push_back(sprites->_usageIndex); } } @@ -248,7 +248,7 @@ void SceneInfo::load(int sceneId, int variant, const Common::String &resName, assert(asset && _depthStyle != 2); MSprite *spr = asset->getFrame(asset->getCount() - 1); - bgSurface.copyFrom(spr, si._position, si._depth, &depthSurface, si._scale, + bgSurface.copyFrom(spr, si._position, si._depth, &depthSurface, si._scale, spr->getTransparencyIndex()); } @@ -292,7 +292,7 @@ void SceneInfo::loadPalette(int sceneId, int artFileNum, const Common::String &r _vm->_palette->_paletteUsage.prioritize(artHeader._palette); } - _usageIndex = _vm->_palette->_paletteUsage.process(artHeader._palette, + _usageIndex = _vm->_palette->_paletteUsage.process(artHeader._palette, (flags & 0xF800) | 0x8000); if (_usageIndex > 0) { _vm->_palette->_paletteUsage.transform(artHeader._palette); diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index c295ae0de8..83caec5682 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -53,7 +53,7 @@ class SpriteSlot; #define TEXT_DISPLAY_MAX_SIZE 40 #define DIRTY_AREAS_SIZE (SPRITE_SLOTS_MAX_SIZE + TEXT_DISPLAY_MAX_SIZE) -enum { +enum { SCENEFLAG_DITHER = 0x01, // Dither to 16 colors SCENEFLAG_LOAD_SHADOW = 0x10 // Load hard shadows }; @@ -65,7 +65,7 @@ public: PrepType _prepType; VerbInit() {} - VerbInit(int id, VerbType verbType, PrepType prepType): _id(id), + VerbInit(int id, VerbType verbType, PrepType prepType): _id(id), _verbType(verbType), _prepType(prepType) {} }; @@ -180,7 +180,7 @@ public: /** * loads the data */ - void load(int sceneId, int variant, const Common::String &resName, int flags, + void load(int sceneId, int variant, const Common::String &resName, int flags, MSurface &depthSurface, MSurface &bgSurface); /** diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index f0564c5fbc..09f87f3f8b 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -278,7 +278,7 @@ void ScreenObjects::check(bool scanFlag) { if (!_vm->_events->_mouseButtons || _inputMode != kInputBuildingSentences) _vm->_events->_rightMousePressed = false; - if ((_vm->_events->_mouseMoved || userInterface._scrollbarActive + if ((_vm->_events->_mouseMoved || userInterface._scrollbarActive || _v8332A || _forceRescan) && scanFlag) { _category = CAT_NONE; _selectedObject = scanBackwards(_vm->_events->currentPos(), LAYER_GUI); @@ -386,7 +386,7 @@ void ScreenObjects::elementHighlighted() { indexEnd = 9; varA = 5; topIndex = 0; - idxP = !_vm->_events->_rightMousePressed ? &userInterface._highlightedCommandIndex : + idxP = !_vm->_events->_rightMousePressed ? &userInterface._highlightedCommandIndex : &userInterface._selectedActionIndex; if (_vm->_events->_rightMousePressed && userInterface._selectedItemVocabIdx >= 0) diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index cbe0471315..a7c6dedb12 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -63,7 +63,7 @@ SequenceEntry::SequenceEntry() { #define SEQUENCE_LIST_SIZE 30 SequenceList::SequenceList(MADSEngine *vm) : _vm(vm) { - // IMPORTANT: Preallocate timer slots. Note that sprite slots refer to entries + // IMPORTANT: Preallocate timer slots. Note that sprite slots refer to entries // in this list by index, so we can't just add or delete entries later for (int i = 0; i < SEQUENCE_LIST_SIZE; ++i) { SequenceEntry rec; @@ -369,7 +369,7 @@ void SequenceList::delay(uint32 priorFrameTime, uint32 currentTime) { } void SequenceList::setAnimRange(int seqIndex, int startVal, int endVal) { - Scene &scene = _vm->_game->_scene; + Scene &scene = _vm->_game->_scene; SequenceEntry &seqEntry = _entries[seqIndex]; SpriteAsset &spriteSet = *scene._sprites[seqEntry._spritesIndex]; int numSprites = spriteSet.getCount(); @@ -433,7 +433,7 @@ int SequenceList::addSpriteCycle(int srcSpriteIdx, bool flipped, int numTicks, i Scene &scene = _vm->_game->_scene; MSprite *spriteFrame = scene._sprites[srcSpriteIdx]->getFrame(0); int depth = scene._depthSurface.getDepth(Common::Point( - spriteFrame->_offset.x + (spriteFrame->w / 2), + spriteFrame->_offset.x + (spriteFrame->w / 2), spriteFrame->_offset.y + (spriteFrame->h / 2))); return add(srcSpriteIdx, flipped, 1, triggerCountdown, timeoutTicks, extraTicks, numTicks, 0, 0, @@ -450,7 +450,7 @@ int SequenceList::addReverseSpriteCycle(int srcSpriteIdx, bool flipped, int numT spriteFrame->_offset.x + (spriteFrame->w / 2), spriteFrame->_offset.y + (spriteFrame->h / 2))); - return add(srcSpriteIdx, flipped, asset->getCount(), triggerCountdown, timeoutTicks, extraTicks, + return add(srcSpriteIdx, flipped, asset->getCount(), triggerCountdown, timeoutTicks, extraTicks, numTicks, 0, 0, true, 100, depth - 1, -1, ANIMTYPE_CYCLED, 0, 0); } @@ -463,7 +463,7 @@ int SequenceList::startCycle(int srcSpriteIndex, bool flipped, int cycleIndex) { return result; } -int SequenceList::startReverseCycle(int srcSpriteIndex, bool flipped, int numTicks, +int SequenceList::startReverseCycle(int srcSpriteIndex, bool flipped, int numTicks, int triggerCountdown, int timeoutTicks, int extraTicks) { SpriteAsset *sprites = _vm->_game->_scene._sprites[srcSpriteIndex]; MSprite *frame = sprites->getFrame(0); @@ -508,4 +508,4 @@ void SequenceList::setDone(int seqIndex) { _entries[seqIndex]._timeout = _vm->_game->_player._priorTimer; } -} // End of namespace +} // End of namespace diff --git a/engines/mads/sequence.h b/engines/mads/sequence.h index 19759001de..8abef5c3e1 100644 --- a/engines/mads/sequence.h +++ b/engines/mads/sequence.h @@ -32,8 +32,8 @@ namespace MADS { class SpriteSlot; -enum SequenceTrigger { - SEQUENCE_TRIGGER_EXPIRE = 0, // Trigger when the sequence finishes +enum SequenceTrigger { + SEQUENCE_TRIGGER_EXPIRE = 0, // Trigger when the sequence finishes SEQUENCE_TRIGGER_LOOP = 1, // Trigger when the sequence loops SEQUENCE_TRIGGER_SPRITE = 2 // Trigger when sequence reaches specific sprite }; @@ -103,7 +103,7 @@ public: int add(int spriteListIndex, bool flipped, int frameIndex, int triggerCountdown, int delayTicks, int extraTicks, int numTicks, int msgX, int msgY, bool nonFixed, int scale, int depth, int frameInc, SpriteAnimType animType, int numSprites, int frameStart); - + int addTimer(int timeout, int abortVal); void remove(int seqIndex); void setSpriteSlot(int seqIndex, SpriteSlot &spriteSlot); @@ -114,13 +114,13 @@ public: void scan(); void setDepth(int seqIndex, int depth); void setMsgPosition(int seqIndex, const Common::Point &pt); - int addSpriteCycle(int srcSpriteIdx, bool flipped, int numTicks, + int addSpriteCycle(int srcSpriteIdx, bool flipped, int numTicks, int triggerCountdown = 0, int timeoutTicks = 0, int extraTicks = 0); int addReverseSpriteCycle(int srcSpriteIdx, bool flipped, int numTicks, int triggerCountdown = 0, int timeoutTicks = 0, int extraTicks = 0); int startCycle(int srcSpriteIdx, bool flipped, int cycleIndex); - int startReverseCycle(int srcSpriteIndex, bool flipped, int numTicks, + int startReverseCycle(int srcSpriteIndex, bool flipped, int numTicks, int triggerCountdown = 0, int timeoutTicks = 0, int extraTicks = 0); void updateTimeout(int spriteIdx, int seqIndex); void setScale(int spriteIdx, int scale); diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp index 432a0e17df..b0506fc40a 100644 --- a/engines/mads/sprites.cpp +++ b/engines/mads/sprites.cpp @@ -58,8 +58,8 @@ MSprite::MSprite(): MSurface() { } MSprite::MSprite(Common::SeekableReadStream *source, const Common::Array &palette, - const Common::Rect &bounds): - MSurface(bounds.width(), bounds.height()), + const Common::Rect &bounds): + MSurface(bounds.width(), bounds.height()), _offset(Common::Point(bounds.left, bounds.top)) { // Load the sprite data loadSprite(source, palette); @@ -158,7 +158,7 @@ SpriteSlot::SpriteSlot(SpriteFlags type, int seqIndex) { bool SpriteSlot::operator==(const SpriteSlotSubset &other) const { return (_spritesIndex == other._spritesIndex) && (_frameNumber == other._frameNumber) && - (_position == other._position) && (_depth == other._depth) && + (_position == other._position) && (_depth == other._depth) && (_scale == other._scale); } @@ -324,7 +324,7 @@ void SpriteSlots::drawSprites(MSurface *s) { if ((slot._scale < 100) && (slot._scale != -1)) { // Minimalised drawing - s->copyFrom(spr, slot._position, slot._depth, &scene._depthSurface, + s->copyFrom(spr, slot._position, slot._depth, &scene._depthSurface, slot._scale, sprite->getTransparencyIndex()); } else { int xp, yp; @@ -339,7 +339,7 @@ void SpriteSlots::drawSprites(MSurface *s) { if (slot._depth > 1) { // Draw the frame with depth processing - s->copyFrom(spr, Common::Point(xp, yp), slot._depth, &scene._depthSurface, + s->copyFrom(spr, Common::Point(xp, yp), slot._depth, &scene._depthSurface, 100, sprite->getTransparencyIndex()); } else { // No depth, so simply draw the image diff --git a/engines/mads/sprites.h b/engines/mads/sprites.h index 745e0700e8..f807e733b7 100644 --- a/engines/mads/sprites.h +++ b/engines/mads/sprites.h @@ -180,7 +180,7 @@ public: void deleteTimer(int seqIndex); /** - * Add a new slot entry and return it's index + * Add a new slot entry and return it's index */ int add(); diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index e23ecf4a08..4d8ed82f98 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -148,14 +148,14 @@ void UISlots::draw(bool updateFlag, bool delFlag) { if (dirtyArea->_textActive) { SpriteAsset *asset = scene._sprites[slot._spritesIndex]; - + // Get the frame details int frameNumber = ABS(slot._frameNumber); bool flipped = slot._frameNumber < 0; if (slot._segmentId == IMG_SPINNING_OBJECT) { MSprite *sprite = asset->getFrame(frameNumber); - sprite->copyTo(&userInterface, slot._position, + sprite->copyTo(&userInterface, slot._position, sprite->getTransparencyIndex()); } else { MSprite *sprite = asset->getFrame(frameNumber - 1); @@ -309,7 +309,7 @@ void Conversation::start() { /*------------------------------------------------------------------------*/ -UserInterface::UserInterface(MADSEngine *vm) : _vm(vm), _dirtyAreas(vm), +UserInterface::UserInterface(MADSEngine *vm) : _vm(vm), _dirtyAreas(vm), _uiSlots(vm) { _invSpritesIndex = -1; _invFrameNumber = 1; @@ -363,7 +363,7 @@ void UserInterface::load(const Common::String &resName) { // Read in the surface data Common::SeekableReadStream *pixelsStream = madsPack.getItemStream(1); pixelsStream->read(_surface.getData(), MADS_SCREEN_WIDTH * MADS_INTERFACE_HEIGHT); - delete pixelsStream; + delete pixelsStream; } void UserInterface::setup(InputMode inputMode) { @@ -418,7 +418,7 @@ void UserInterface::drawTextElements() { void UserInterface::mergeFrom(MSurface *src, const Common::Rect &srcBounds, const Common::Point &destPos, int transparencyIndex) { - // Validation of the rectangle and position + // Validation of the rectangle and position int destX = destPos.x, destY = destPos.y; if ((destX >= w) || (destY >= h)) return; @@ -502,7 +502,7 @@ void UserInterface::updateInventoryScroller() { // FIXME: This scrolls the inventory up when selecting verbs or attempting to combine items false/*(screenObjects._category != CAT_INV_SCROLLER && _scrollbarOldActive == SCROLLBAR_ELEVATOR)*/ ) && (_vm->_events->_mouseStatusCopy || _vm->_easyMouse)) { - if ((_vm->_events->_mouseClicked || (_vm->_easyMouse && !_vm->_events->_mouseStatusCopy)) + if ((_vm->_events->_mouseClicked || (_vm->_easyMouse && !_vm->_events->_mouseStatusCopy)) && (screenObjects._category == CAT_INV_SCROLLER)) _scrollbarStrokeType = (ScrollbarActive)screenObjects._spotId; @@ -637,7 +637,7 @@ void UserInterface::writeVocab(ScrCategory category, int id) { break; } - font->setColorMode((id == 4) || (_scrollbarActive == SCROLLBAR_ELEVATOR) ? + font->setColorMode((id == 4) || (_scrollbarActive == SCROLLBAR_ELEVATOR) ? SELMODE_HIGHLIGHTED : SELMODE_UNSELECTED); font->writeString(this, vocabStr, Common::Point(bounds.left, bounds.top)); break; @@ -705,7 +705,7 @@ void UserInterface::loadElements() { CAT_INV_ANIM, 0); } - if (_vm->_game->_screenObjects._inputMode == kInputBuildingSentences || + if (_vm->_game->_screenObjects._inputMode == kInputBuildingSentences || _vm->_game->_screenObjects._inputMode == kInputLimitedSentences) { _categoryIndexes[CAT_HOTSPOT - 1] = _vm->_game->_screenObjects.size() + 1; for (int hotspotIdx = scene._hotspots.size() - 1; hotspotIdx >= 0; --hotspotIdx) { @@ -878,7 +878,7 @@ void UserInterface::refresh() { void UserInterface::inventoryAnim() { Scene &scene = _vm->_game->_scene; - if (_vm->_game->_screenObjects._inputMode == kInputConversation || + if (_vm->_game->_screenObjects._inputMode == kInputConversation || _vm->_game->_screenObjects._inputMode == kInputLimitedSentences || _invSpritesIndex < 0) return; @@ -984,7 +984,7 @@ void UserInterface::selectObject(int invIndex) { if (maxVocab) { assert(_uiSlots.size() < 50); int vocabHeight = maxVocab * 8; - + Common::Rect bounds(240, 3, 240 + 80, 3 + vocabHeight); _uiSlots.add(bounds); _uiSlots.draw(false, false); @@ -1028,7 +1028,7 @@ void UserInterface::updateSelection(ScrCategory category, int newIndex, int *idx if (oldIndex >= 0) { writeVocab(category, oldIndex); - + if (getBounds(category, oldIndex, bounds)) updateRect(bounds); } diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h index 04a8d090dd..2fdc80bf86 100644 --- a/engines/mads/user_interface.h +++ b/engines/mads/user_interface.h @@ -51,7 +51,7 @@ public: int _spritesIndex; int _frameNumber; Common::Point _position; - + // Only used for IMG_OVERPRINT int _width; int _height; -- cgit v1.2.3 From 0ab1e9d07bdcf012cc0025bb024329698529bf1d Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 8 May 2014 11:44:13 +0300 Subject: MADS: Replace some magic bomb status values with their friendly name --- engines/mads/nebular/nebular_scenes5.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes5.cpp b/engines/mads/nebular/nebular_scenes5.cpp index 41765f256a..9c961e3729 100644 --- a/engines/mads/nebular/nebular_scenes5.cpp +++ b/engines/mads/nebular/nebular_scenes5.cpp @@ -729,7 +729,7 @@ void Scene504::step() { } } - if ((_globals[kTimebombTimer] >= 10800) && (_globals[kTimebombStatus] == 1) && (_game._difficulty != 3)) { + if ((_globals[kTimebombTimer] >= 10800) && (_globals[kTimebombStatus] == TIMEBOMB_ACTIVATED) && (_game._difficulty != 3)) { _globals[kTimebombStatus] = TIMEBOMB_DEAD; _globals[kTimebombTimer] = 0; _globals[kCheckDaemonTimebomb] = false; @@ -924,7 +924,7 @@ void Scene505::step() { _selectedId = 8; } else { this_button = 0x2DE; - if ((_globals[kTimebombStatus] == 1) && (_carLocations[_selectedId] == 501)) + if ((_globals[kTimebombStatus] == TIMEBOMB_ACTIVATED) && (_carLocations[_selectedId] == 501)) _vm->_dialogs->show(431); else if (_selectedId != _homeSelectedId) { _nextButtonId = 0; -- cgit v1.2.3 From 98518ef500bdb81ee7608cdebb16325dabd7bdc3 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 8 May 2014 14:41:45 +0300 Subject: MADS: Bugfix for shooting down the monkey --- engines/mads/nebular/nebular_scenes2.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index b86f9dbc75..2bb24be18b 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -3169,8 +3169,8 @@ void Scene209::preActions() { _game._player._walkOffScreenSceneId = 208; if (_globals[kMonkeyStatus] == 1) { - if ((_action.isAction(NOUN_SHOOT) || _action.isAction(NOUN_HOSE_DOWN)) && _action.isAction(NOUN_MONKEY) - && _action.isAction(NOUN_BLOWGUN) && _game._objects.isInInventory(OBJ_BLOWGUN) && _game._objects.isInInventory(OBJ_POISON_DARTS)) { + if ((_action.isAction(NOUN_SHOOT) || _action.isAction(NOUN_HOSE_DOWN)) && _action.isTarget(NOUN_MONKEY) + && _action.isObject(NOUN_BLOWGUN) && _game._objects.isInInventory(OBJ_BLOWGUN) && _game._objects.isInInventory(OBJ_POISON_DARTS)) { _game._player._prepareWalkPos = Common::Point(111, 129); _game._player._prepareWalkFacing = FACING_NORTHEAST; _game._player._needToWalk = true; -- cgit v1.2.3 From 54549652241aaa3ce2b4b74fad35655c436677ff Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 8 May 2014 19:00:27 +0200 Subject: MADS: Implement scene 506 --- engines/mads/animation.h | 1 + engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes5.cpp | 268 ++++++++++++++++++++++++++++++- engines/mads/nebular/nebular_scenes5.h | 29 ++++ 4 files changed, 296 insertions(+), 4 deletions(-) diff --git a/engines/mads/animation.h b/engines/mads/animation.h index 3c0c2547d4..0556c3aa19 100644 --- a/engines/mads/animation.h +++ b/engines/mads/animation.h @@ -210,6 +210,7 @@ public: void update(); void setNextFrameTimer(int frameNumber); + int getNextFrameTimer() const { return _nextFrameTimer; } void setCurrentFrame(int frameNumber); int getCurrentFrame() const { return _currentFrame; } diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index a946b2388a..71489b4510 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -207,7 +207,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 505: // car view screen return new Scene505(vm); case 506: // shopping street - return new DummyScene(vm); // TODO + return new Scene506(vm); case 507: // inside software house return new DummyScene(vm); // TODO case 508: // laser cannon diff --git a/engines/mads/nebular/nebular_scenes5.cpp b/engines/mads/nebular/nebular_scenes5.cpp index 9c961e3729..b6c6611cc2 100644 --- a/engines/mads/nebular/nebular_scenes5.cpp +++ b/engines/mads/nebular/nebular_scenes5.cpp @@ -417,7 +417,7 @@ void Scene501::actions() { default: break; } - } else if ((_action._lookFlag) || _action.isAction(VERB_LOOK, 0x31E)) + } else if (_action._lookFlag || _action.isAction(VERB_LOOK, 0x31E)) _vm->_dialogs->show(50121); else if (_action.isAction(VERB_LOOK, 0x6E)) _vm->_dialogs->show(50110); @@ -803,7 +803,7 @@ void Scene504::actions() { default: break; } - } else if ((_action._lookFlag) || _action.isAction(VERB_LOOK, 0x388)) + } else if (_action._lookFlag || _action.isAction(VERB_LOOK, 0x388)) _vm->_dialogs->show(50412); else if (_action.isAction(VERB_LOOK, 0x383)) _vm->_dialogs->show(50410); @@ -1035,7 +1035,7 @@ void Scene505::step() { case 60: { _game._player._stepEnabled = true; int syncIdx = _globals._sequenceIndexes[13]; - _globals._sequenceIndexes[13] = _scene->_sequences.startCycle (_globals._spriteIndexes[13], false, -2); + _globals._sequenceIndexes[13] = _scene->_sequences.startCycle(_globals._spriteIndexes[13], false, -2); _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 8); _scene->_sequences.updateTimeout (_globals._sequenceIndexes[13], syncIdx); _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[_homeSelectedId], false, 1); @@ -1088,5 +1088,267 @@ void Scene505::actions() { /*------------------------------------------------------------------------*/ +void Scene506::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(0x242); + _scene->addActiveVocab(0x336); + _scene->addActiveVocab(0x37D); +} + +void Scene506::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('q', 0)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('q', 1)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('c', -1)); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites("*RXCD_3"); + + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); + int idx = _scene->_dynamicHotspots.add(0x37D, 0x242, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + int hotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(65, 125), FACING_NORTHWEST); + _scene->_dynamicHotspots.setCursor(hotspotId, CURSOR_GO_LEFT); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 1); + idx = _scene->_dynamicHotspots.add(0x336, 0x242, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); + hotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(112, 102), FACING_NORTHWEST); + _scene->_dynamicHotspots.setCursor(hotspotId, CURSOR_GO_LEFT); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 13); + + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 5); + _firstDoorFl = true; + _actionFl = false; + + if (_scene->_priorSceneId == 508) { + _game._player._playerPos = Common::Point(16, 111); + _game._player._facing = FACING_SOUTHEAST; + _scene->_sequences.addTimer(15, 80); + _game._player._stepEnabled = false; + } else if (_scene->_priorSceneId == 507) { + _game._player._playerPos = Common::Point(80, 102); + _game._player._facing = FACING_SOUTHEAST; + _scene->_sequences.addTimer(60, 80); + _game._player._stepEnabled = false; + } else if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(138, 116); + _game._player._facing = FACING_NORTHEAST; + _game._player._visible = false; + _game._player._stepEnabled = false; + _scene->_sequences.remove (_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 5); + _scene->loadAnimation(formAnimName('R', 1), 70); + } + sceneEntrySound(); +} + +void Scene506::step() { + if (_game._trigger >= 80) { + if (_firstDoorFl) { + _heroFacing = FACING_SOUTHEAST; + if (_scene->_priorSceneId == 507) { + _doorPos = Common::Point(112, 102); + _doorWord = 0x336; + } else { + _doorPos = Common::Point(65, 125); + _doorWord = 0x37D; + } + } + room_506_door_sequences(); + } + + if (_game._trigger >= 70) { + switch (_game._trigger) { + case 70: + _game._player._visible = true; + _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; + _scene->_sequences.addTimer(6, 71); + break; + + case 71: + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 5); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 72); + break; + + case 72: + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 5); + _game._player._stepEnabled = true; + break; + + default: + break; + } + } +} + +void Scene506::room_506_door_sequences() { + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + + if (_firstDoorFl) { + if (_action.isAction(0x242, 0x336) || ((_scene->_priorSceneId == 507) && !_actionFl)) { + _doorDepth = 13; + _doorSpriteIdx = _globals._spriteIndexes[2]; + _doorSequenceIdx = _globals._sequenceIndexes[2]; + _labDoorFl = false; + } else { + _doorDepth = 10; + _doorSpriteIdx = _globals._spriteIndexes[1]; + _doorSequenceIdx = _globals._sequenceIndexes[1]; + _labDoorFl = true; + } + _firstDoorFl = false; + } + + switch (_game._trigger) { + case 0: + case 80: + _game._player._stepEnabled = false; + _scene->_sequences.remove(_doorSequenceIdx); + _doorSequenceIdx = _scene->_sequences.addSpriteCycle(_doorSpriteIdx, false, 7, 1, 0, 0); + _scene->_sequences.setDepth(_doorSequenceIdx, _doorDepth); + _scene->changeVariant(1); + _scene->_sequences.addSubEntry(_doorSequenceIdx, SEQUENCE_TRIGGER_EXPIRE, 0, 81); + break; + + + case 81: + _doorSequenceIdx = _scene->_sequences.startCycle(_doorSpriteIdx, false, -2); + _scene->_sequences.setDepth(_doorSequenceIdx, _doorDepth); + _game._player._walkAnywhere = true; + _game._player.walk(_doorPos, _heroFacing); + _scene->_sequences.addTimer(120, 82); + break; + + case 82: + _scene->_sequences.remove(_doorSequenceIdx); + _doorSequenceIdx = _scene->_sequences.startReverseCycle(_doorSpriteIdx, false, 7, 1, 0, 0); + _scene->_sequences.setDepth(_doorSequenceIdx, _doorDepth); + if (_actionFl) + _scene->_sequences.addSubEntry(_doorSequenceIdx, SEQUENCE_TRIGGER_EXPIRE, 0, 84); + else + _scene->_sequences.addSubEntry(_doorSequenceIdx, SEQUENCE_TRIGGER_EXPIRE, 0, 83); + + break; + + case 83: { + _doorSequenceIdx = _scene->_sequences.startCycle(_doorSpriteIdx, false, 1); + int idx = _scene->_dynamicHotspots.add(_doorWord, 0x242, _doorSequenceIdx, Common::Rect(0, 0, 0, 0)); + int hotspotId = _scene->_dynamicHotspots.setPosition(idx, _doorPos, FACING_NORTHWEST); + _scene->_dynamicHotspots.setCursor(hotspotId, CURSOR_GO_LEFT); + _scene->_sequences.setDepth(_doorSequenceIdx, _doorDepth); + _firstDoorFl = true; + if (_labDoorFl) { + _globals._spriteIndexes[1] = _doorSpriteIdx; + _globals._sequenceIndexes[1] = _doorSequenceIdx; + } else { + _globals._spriteIndexes[2] = _doorSpriteIdx; + _globals._sequenceIndexes[2] = _doorSequenceIdx; + } + _game._player._stepEnabled = true; + + } + break; + + case 84: + _actionFl = false; + _game._player._stepEnabled = true; + if (_labDoorFl) + _scene->_nextSceneId = 508; + else + _scene->_nextSceneId = 507; + + break; + + default: + break; + } +} + +void Scene506::actions() { + int temp; + + if (_action.isAction(0x242, 0x37D)) { + if (_firstDoorFl) { + _heroFacing = FACING_NORTHWEST; + _doorPos = Common::Point(16, 111); + } + _actionFl = true; + room_506_door_sequences(); + } else if (_action.isAction(0x242, 0x336)) { + if (_firstDoorFl) { + _heroFacing = FACING_NORTHWEST; + _doorPos = Common::Point(80, 102); + } + _actionFl = true; + room_506_door_sequences(); + } else if (_action.isAction(0x36A, 0x324)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 5); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 1); + break; + + case 1: + temp = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -2); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], temp); + _scene->_sequences.addTimer(6, 2); + break; + + case 2: + _game._player._visible = false; + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 10, 1, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 3); + break; + + case 3: + temp = _globals._sequenceIndexes[4]; + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, -2); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], temp); + _scene->_nextSceneId = 504; + break; + + default: + break; + } + } else if (_action._lookFlag || _action.isAction(VERB_LOOK, 0x31E)) + _vm->_dialogs->show(50618); + else if (_action.isAction(VERB_LOOK, 0x372)) + _vm->_dialogs->show(50610); + else if (_action.isAction(VERB_LOOK, 0x371)) + _vm->_dialogs->show(50611); + else if (_action.isAction(VERB_LOOK, 0x482)) + _vm->_dialogs->show(50612); + else if (_action.isAction(VERB_LOOK, 0x483)) + _vm->_dialogs->show(50613); + else if (_action.isAction(VERB_TAKE, 0x483)) + _vm->_dialogs->show(50614); + else if (_action.isAction(VERB_LOOK, 0x336)) + _vm->_dialogs->show(50615); + else if (_action.isAction(VERB_LOOK, 0x37D)) + _vm->_dialogs->show(50616); + else if (_action.isAction(VERB_LOOK, 0x360) || _action.isAction(0x1AD, 0x360)) + _vm->_dialogs->show(50617); + else if (_action.isAction(VERB_LOOK, 0x373)) + _vm->_dialogs->show(50619); + else if (_action.isAction(VERB_LOOK, 0x324)) + _vm->_dialogs->show(50620); + else if (_action.isAction(VERB_LOOK, 0x142)) + _vm->_dialogs->show(50621); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes5.h b/engines/mads/nebular/nebular_scenes5.h index f29a900e7d..94647fb525 100644 --- a/engines/mads/nebular/nebular_scenes5.h +++ b/engines/mads/nebular/nebular_scenes5.h @@ -133,6 +133,35 @@ public: virtual void actions(); virtual void postActions() {}; }; + +class Scene506: public Scene5xx{ +private: + int _actionFl; /* Flag to note daemon is running vs. parser */ + + Common::Point _doorPos; + Facing _heroFacing; + + int _doorDepth; + int _doorSpriteIdx; + int _doorSequenceIdx; + int _doorWord; + + bool _labDoorFl; + bool _firstDoorFl; + + void room_506_door_sequences(); + +public: + Scene506(MADSEngine *vm) : Scene5xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions(); + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From caf920e28a9ab8f9dbc694a6cdbc6a82734faa15 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 8 May 2014 23:00:34 +0300 Subject: FULLPIPE: Started implementing MovGraph::calcChunk() --- engines/fullpipe/motion.cpp | 55 +++++++++++++++++++++++++++++++++++++++++++++ engines/fullpipe/motion.h | 1 + 2 files changed, 56 insertions(+) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index cdf9bdb1a4..96b610cb90 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -879,6 +879,61 @@ void MovGraph::calcBbox(Common::Rect *rect, MovGraphLink *grlink, MovArr *movarr warning("STUB: MovGraph::calcBbox()"); } +bool MovGraph::calcChunk(int idx, int x, int y, MovArr *arr, int a6) { +#if 0 + int staticsId; + + v7 = idx << 6; + + if (_items[idx]->ani->_statics) { + staticsId = _items[idx]->ani->_statics->_staticsId; + } else { + if (!_items[idx]->ani->_movement->_staticsObj2) + return 0; + + staticsId = _items[idx]->ani->_movement->_staticsObj2->_staticsId; + } + + v19 = -1; + v11 = 100; + v12 = genMovArr(x, y, &arrSize, 0, 1); + movarr = v12; + if ( !v12 ) + return findClosestLink(idx, (POINT *)&x, arr); + unusedArg = 0; + if ( arrSize <= 0 ) { + LABEL_16: + CObjectFree(v12); + return 0; + } + v14 = &v12->_link; + do { + v15 = _mgm->refreshOffsets(_items[idx]->ani->_id, staticsId, v12->_link->dwordArray2[_field_44]->sceneId); + if ( v15 < v11 ) { + v11 = v15; + v19 = unusedArg; + } + v16 = _mgm->refreshOffsets(_items[idx]->ani->_id, staticsId, v12->_link->dwordArray2[_field_444]->scene); + if ( v16 < v11 ) { + v11 = v16; + v19 = unusedArg; + } + v14 += 8; + ++unusedArg; + } while ( unusedArg < arrSize ); + if ( v19 == -1 ) { + v12 = movarr; + goto LABEL_16; + } + v17 = movarr; + memcpy(arr, &movarr[v19], 0x20u); + CObjectFree(v17); +#endif + + warning("STUB: MovGraph::calcChunk()"); + return true; +} + int MovGraph2::getItemIndexByGameObjectId(int objectId) { for (uint i = 0; i < _items2.size(); i++) if (_items2[i]->_objectId == objectId) diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index 2c46c37ee7..38632c14b7 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -366,6 +366,7 @@ public: void shuffleTree(MovGraphLink *lnk, MovGraphLink *lnk2, Common::Array &tempObList1, Common::Array &tempObList2); Common::Array *getBboxes(MovArr *movarr1, MovArr *movarr2, int *listCount); void calcBbox(Common::Rect *rect, MovGraphLink *grlink, MovArr *movarr1, MovArr *movarr2); + bool calcChunk(int idx, int x, int y, MovArr *arr, int a6); }; class Movement; -- cgit v1.2.3 From 2cf67c9af2c5378510bb1c203ee2ce8f1ab69898 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 9 May 2014 00:19:00 +0200 Subject: MADS: Implement scene 507 --- engines/mads/nebular/nebular_scenes5.cpp | 111 +++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes5.h | 15 +++++ 2 files changed, 126 insertions(+) diff --git a/engines/mads/nebular/nebular_scenes5.cpp b/engines/mads/nebular/nebular_scenes5.cpp index b6c6611cc2..f832b2e712 100644 --- a/engines/mads/nebular/nebular_scenes5.cpp +++ b/engines/mads/nebular/nebular_scenes5.cpp @@ -1350,5 +1350,116 @@ void Scene506::actions() { /*------------------------------------------------------------------------*/ +void Scene507::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(0x106); + _scene->addActiveVocab(0xD); +} + +void Scene507::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('p', -1)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites("*RXMRD_3"); + + if ((_game._difficulty != DIFFICULTY_EASY) && (_game._objects[OBJ_PENLIGHT]._roomNumber == _scene->_currentSceneId)) { + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 9, 0, 0, 0); + _penlightHotspotId = _scene->_dynamicHotspots.add(0x106, VERB_WALKTO, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(_penlightHotspotId, Common::Point(233, 152), FACING_SOUTHEAST); + } + + if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(121, 147); + _game._player._facing = FACING_NORTH; + } + + sceneEntrySound(); +} +void Scene507::actions() { + if (_action.isAction(0x18B, 0x378)) + _scene->_nextSceneId = 506; + else if (_action.isAction(VERB_TAKE, 0x106)) { + if (_game._trigger || !_game._objects.isInInventory(OBJ_PENLIGHT)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 6, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 5); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[2]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_SPRITE, 5, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + + case 1: + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _scene->_dynamicHotspots.remove(_penlightHotspotId); + _vm->_sound->command(27); + _game._objects.addToInventory(OBJ_PENLIGHT); + _vm->_dialogs->showItem(OBJ_PENLIGHT, 50730); + break; + + case 2: + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[2]); + _game._player._visible = true; + _game._player._stepEnabled = true; + break; + + default: + break; + } + } + } else if (_action._lookFlag) + _vm->_dialogs->show(50722); + else if (_action.isAction(VERB_LOOK, 0x299)) + _vm->_dialogs->show(50710); + else if (_action.isAction(VERB_TAKE, 0x299)) + _vm->_dialogs->show(50711); + else if (_action.isAction(VERB_LOOK, 0x376)) + _vm->_dialogs->show(50712); + else if (_action.isAction(VERB_TAKE, 0x376)) + _vm->_dialogs->show(50713); + else if (_action.isAction(VERB_LOOK, 0x375)) + _vm->_dialogs->show(50714); + else if (_action.isAction(VERB_LOOK, 0x374)) + _vm->_dialogs->show(50715); + else if (_action.isAction(VERB_LOOK, 0x244)) { + if (_scene->_customDest.x < 100) + _vm->_dialogs->show(50726); + else + _vm->_dialogs->show(50716); + } else if (_action.isAction(VERB_LOOK, 0x2A7)) + _vm->_dialogs->show(50717); + else if (_action.isAction(VERB_LOOK, 0x2A6)) + _vm->_dialogs->show(50718); + else if (_action.isAction(VERB_LOOK, 0x2A0)) + _vm->_dialogs->show(50719); + else if (_action.isAction(VERB_LOOK, 0x377)) + _vm->_dialogs->show(50720); + else if (_action.isAction(VERB_LOOK, 0xFE)) + _vm->_dialogs->show(50721); + else if (_action.isAction(VERB_OPEN, 0x377)) + _vm->_dialogs->show(50723); + else if (_action.isAction(VERB_LOOK, 0x28E)) + _vm->_dialogs->show(50724); + else if (_action.isAction(VERB_LOOK, 0x197)) + _vm->_dialogs->show(50725); + else if (_action.isAction(VERB_LOOK, 0x29F)) { + if (_game._objects.isInRoom(OBJ_PENLIGHT)) + _vm->_dialogs->show(50728); + else + _vm->_dialogs->show(50727); + } else if (_action.isAction(VERB_LOOK, 0x106) && !_game._objects.isInInventory(OBJ_PENLIGHT)) { + if (_game._objects.isInRoom(OBJ_PENLIGHT)) + _vm->_dialogs->show(50729); + } else if (_action.isAction(VERB_LOOK, 0x484)) + _vm->_dialogs->show(50731); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes5.h b/engines/mads/nebular/nebular_scenes5.h index 94647fb525..369371daeb 100644 --- a/engines/mads/nebular/nebular_scenes5.h +++ b/engines/mads/nebular/nebular_scenes5.h @@ -162,6 +162,21 @@ public: virtual void postActions() {}; }; +class Scene507: public Scene5xx{ +private: + int _penlightHotspotId; + +public: + Scene507(MADSEngine *vm) : Scene5xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step() {}; + virtual void preActions() {}; + virtual void actions(); + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 214e051c30a6541fbd53af66edd255d304ac149c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 9 May 2014 00:32:18 +0200 Subject: MADS: Implement scene 508 --- engines/mads/nebular/nebular_scenes.cpp | 4 +- engines/mads/nebular/nebular_scenes5.cpp | 259 +++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes5.h | 17 ++ 3 files changed, 278 insertions(+), 2 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 71489b4510..2ae5b073da 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -209,9 +209,9 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 506: // shopping street return new Scene506(vm); case 507: // inside software house - return new DummyScene(vm); // TODO + return new Scene507(vm); case 508: // laser cannon - return new DummyScene(vm); // TODO + return new Scene508(vm); case 511: // outside pleasure dome return new DummyScene(vm); // TODO case 512: // inside pleasure dome diff --git a/engines/mads/nebular/nebular_scenes5.cpp b/engines/mads/nebular/nebular_scenes5.cpp index f832b2e712..65498ec155 100644 --- a/engines/mads/nebular/nebular_scenes5.cpp +++ b/engines/mads/nebular/nebular_scenes5.cpp @@ -1461,5 +1461,264 @@ void Scene507::actions() { /*------------------------------------------------------------------------*/ +void Scene508::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(0x364); + _scene->addActiveVocab(0xD); + _scene->addActiveVocab(0x343); +} + +void Scene508::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('a', 0)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('m', 0)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('h', 0)); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('l', 2)); + _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('t', 0)); + _globals._spriteIndexes[6] = _scene->_sprites.addSprites("*RXMRC_9"); + _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('l', 3)); + + if (!_game._visitedScenes._sceneRevisited) { + _globals[kLaserOn] = false; + _chosenObject = 0; + } + + if (!_globals[kLaserOn]) { + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 8); + _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, -2); + int idx = _scene->_dynamicHotspots.add(0x343, VERB_WALKTO, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(57, 116), FACING_NORTHEAST); + _scene->_hotspots.activate(0x342, false); + _scene->_hotspots.activate(0x343, false); + } else { + _scene->changeVariant(1); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 8); + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 11); + int idx = _scene->_dynamicHotspots.add(0x343, VERB_WALKTO, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(57, 116), FACING_NORTHEAST); + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 15, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 6, 8); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 6); + if (_globals[kLaserHoleIsThere]) { + _globals._sequenceIndexes[7] = _scene->_sequences.startCycle(_globals._spriteIndexes[7], false, -2); + _scene->_hotspots.activate(0x342, true); + _scene->_hotspots.activate(0x343, true); + } + _vm->_sound->command(21); + } + _vm->_sound->command(20); + + if (_scene->_priorSceneId == 515) { + _game._player._playerPos = Common::Point(57, 116); + _game._player._facing = FACING_NORTHEAST; + } else if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(289, 139); + _game._player._facing = FACING_WEST; + } + + sceneEntrySound(); + _game.loadQuoteSet(0x273, 0); + + if (_scene->_roomChanged) { + _game._objects.addToInventory(OBJ_COMPACT_CASE); + _game._objects.addToInventory(OBJ_REARVIEW_MIRROR); + } +} + +void Scene508::preActions() { + if (_action.isAction(0x32F, 0xF9)) + _game._player._walkOffScreenSceneId = 506; +} + +void Scene508::handlePedestral() { + if (!_globals[kLaserOn]) + _vm->_dialogs->show(50835); + + if (_globals[kLaserHoleIsThere]) + _vm->_dialogs->show(50836); + + if (_globals[kLaserOn] && !_globals[kLaserHoleIsThere]) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[6] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[6], false, 9, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[6], 1, 4); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[6]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_SPRITE, 4, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_EXPIRE, 0, 3); + break; + + case 1: + if (_chosenObject == 2) + _game._objects.removeFromInventory(OBJ_COMPACT_CASE, 1); + else + _game._objects.removeFromInventory(OBJ_REARVIEW_MIRROR, 1); + + _globals._sequenceIndexes[7] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 6, 1, 0, 0); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + + case 2: + _globals._sequenceIndexes[7] = _scene->_sequences.startCycle(_globals._spriteIndexes[7], false, -2); + _scene->_hotspots.activate(0x342, true); + _scene->_hotspots.activate(0x343, true); + break; + + case 3: + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[6]); + _game._player._visible = true; + _scene->_sequences.addTimer(120, 4); + break; + + case 4: + _vm->_dialogs->show(50834); + _globals[kLaserHoleIsThere] = true; + _scene->_nextSceneId = 515; + break; + + default: + break; + } + } +} + +void Scene508::actions() { + if (_action.isAction(VERB_PULL, 0x2AC)) { + if (!_globals[kLaserOn]) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 2, 120, _game.getQuote(0x273)); + break; + + case 2: + _game._player._visible = false; + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 10, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 7); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[1], -1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 3); + break; + + case 3: + _vm->_sound->command(19); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 15, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 6); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 4); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 8); + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[1]); + _game._player._visible = true; + _scene->_sequences.addTimer(15, 5); + break; + + case 4: + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 15, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 6, 8); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 6); + break; + + case 5: + _scene->_sequences.remove(_globals._sequenceIndexes[5]); + _scene->loadAnimation(formAnimName('B', 1), 6); + break; + + case 6: { + _vm->_sound->command(22); + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 11); + int idx = _scene->_dynamicHotspots.add(0x343, VERB_WALKTO, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(57, 116), FACING_NORTHEAST); + _scene->_kernelMessages.reset(); + _scene->changeVariant(1); + _scene->_sequences.addTimer(30, 7); + } + break; + + case 7: + _globals[kLaserOn] = true; + _vm->_dialogs->show(50833); + _game._player._stepEnabled = true; + break; + + default: + break; + } + } else { + _vm->_dialogs->show(50837); + } + } else if (_action.isAction(0x365, 0x120, 0x343) || _action.isAction(VERB_PUT, 0x120, 0x344) || _action.isAction(VERB_PUT, 0x120, 0x343)) { + _chosenObject = 1; + handlePedestral(); + } else if (_action.isAction(VERB_PUT, 0x57, 0x344) || _action.isAction(VERB_PUT, 0x57, 0x343) || _action.isAction(0x365, 0x57, 0x343)) { + _chosenObject = 2; + handlePedestral(); + } else if (_action._lookFlag) + _vm->_dialogs->show(50822); + else if (_action.isAction(VERB_LOOK, 0x485)) + _vm->_dialogs->show(50810); + else if (_action.isAction(VERB_LOOK, 0x364)) + _vm->_dialogs->show(50811); + else if (_action.isAction(VERB_TAKE, 0x364)) + _vm->_dialogs->show(50812); + else if (_action.isAction(VERB_LOOK, 0x37A)) + _vm->_dialogs->show(50816); + else if (_action.isAction(VERB_TAKE, 0x37A)) + _vm->_dialogs->show(50817); + else if (_action.isAction(VERB_LOOK, 0x2AF)) + _vm->_dialogs->show(50818); + else if (_action.isAction(VERB_LOOK, 0xE2)) { + if (_globals[kLaserOn]) + _vm->_dialogs->show(50820); + else + _vm->_dialogs->show(50819); + } else if (_action.isAction(VERB_LOOK, 0x379)) { + if (_globals[kLaserOn]) + _vm->_dialogs->show(50822); + else + _vm->_dialogs->show(50821); + } else if (_action.isAction(VERB_TAKE, 0x379)) + _vm->_dialogs->show(50823); + else if (_action.isAction(VERB_LOOK, 0x2AC)) { + if (_globals[kLaserOn]) + _vm->_dialogs->show(50825); + else + _vm->_dialogs->show(50824); + } else if (_action.isAction(VERB_PUSH, 0x2AC)) + _vm->_dialogs->show(50826); + else if (_action.isAction(VERB_LOOK, 0x343)) { + if (_globals[kLaserHoleIsThere]) + _vm->_dialogs->show(50828); + else + _vm->_dialogs->show(50827); + } else if (_action.isAction(VERB_TAKE, 0x343)) + _vm->_dialogs->show(50829); + else if (_action.isAction(VERB_LOOK, 0x46)) { + if (_globals[kLaserHoleIsThere]) + _vm->_dialogs->show(50831); + else + _vm->_dialogs->show(50830); + } else if (_action.isAction(VERB_LOOK, 0x18D)) + _vm->_dialogs->show(50832); + else if (_action.isAction(VERB_LOOK, 0x344)) { + if (!_globals[kLaserOn]) + _vm->_dialogs->show(50813); + else if (!_globals[kLaserHoleIsThere]) + _vm->_dialogs->show(50814); + else + _vm->_dialogs->show(50815); + } else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes5.h b/engines/mads/nebular/nebular_scenes5.h index 369371daeb..29ec69f605 100644 --- a/engines/mads/nebular/nebular_scenes5.h +++ b/engines/mads/nebular/nebular_scenes5.h @@ -177,6 +177,23 @@ public: virtual void postActions() {}; }; +class Scene508: public Scene5xx{ +private: + int _chosenObject; + + void handlePedestral(); + +public: + Scene508(MADSEngine *vm) : Scene5xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step() {}; + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From b42bf6342c05eb1a9d5e453169f3dd2721dc0114 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 9 May 2014 02:34:53 +0300 Subject: MADS: Remove superfluous empty scene methods --- engines/mads/dragonsphere/dragonsphere_scenes.h | 3 --- engines/mads/nebular/nebular_scenes.h | 3 --- engines/mads/nebular/nebular_scenes2.h | 1 - engines/mads/nebular/nebular_scenes4.h | 12 ------------ engines/mads/nebular/nebular_scenes5.h | 16 ---------------- engines/mads/nebular/nebular_scenes7.cpp | 1 - engines/mads/nebular/nebular_scenes7.h | 9 --------- engines/mads/nebular/nebular_scenes8.h | 2 -- engines/mads/phantom/phantom_scenes.h | 3 --- 9 files changed, 50 deletions(-) diff --git a/engines/mads/dragonsphere/dragonsphere_scenes.h b/engines/mads/dragonsphere/dragonsphere_scenes.h index 0c5fea33db..8ce1492208 100644 --- a/engines/mads/dragonsphere/dragonsphere_scenes.h +++ b/engines/mads/dragonsphere/dragonsphere_scenes.h @@ -114,10 +114,7 @@ public: virtual void setup() {} virtual void enter() {} - virtual void step() {} - virtual void preActions() {} virtual void actions() {} - virtual void synchronize(Common::Serializer &s) {} }; } // End of namespace Dragonsphere diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index 0db8b93d8b..2f9dff706d 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -198,10 +198,7 @@ public: virtual void setup() {} virtual void enter() {} - virtual void step() {} - virtual void preActions() {} virtual void actions() {} - virtual void synchronize(Common::Serializer &s) {} }; } // End of namespace Nebular diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index 47d5a12824..14a5d75d34 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -278,7 +278,6 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; virtual void actions(); }; diff --git a/engines/mads/nebular/nebular_scenes4.h b/engines/mads/nebular/nebular_scenes4.h index 8ff2ec59f8..bacab8a156 100644 --- a/engines/mads/nebular/nebular_scenes4.h +++ b/engines/mads/nebular/nebular_scenes4.h @@ -65,7 +65,6 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene402: public Scene4xx { @@ -127,7 +126,6 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene405: public Scene4xx { @@ -139,7 +137,6 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene406: public Scene4xx { @@ -155,7 +152,6 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene407: public Scene4xx { @@ -172,7 +168,6 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene408: public Scene4xx { @@ -181,10 +176,8 @@ public: virtual void setup(); virtual void enter(); - virtual void step() {}; virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene409: public SceneTeleporter { @@ -194,9 +187,7 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; virtual void actions(); - virtual void postActions() {}; }; class Scene410: public Scene4xx { @@ -208,7 +199,6 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene411: public Scene4xx { @@ -245,7 +235,6 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene413: public Scene4xx { @@ -262,7 +251,6 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes5.h b/engines/mads/nebular/nebular_scenes5.h index 29ec69f605..c67ff9a0b9 100644 --- a/engines/mads/nebular/nebular_scenes5.h +++ b/engines/mads/nebular/nebular_scenes5.h @@ -67,7 +67,6 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene502: public SceneTeleporter { @@ -77,9 +76,7 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; virtual void actions(); - virtual void postActions() {}; }; class Scene503: public Scene5xx{ @@ -91,10 +88,7 @@ public: virtual void setup(); virtual void enter(); - virtual void step() {}; - virtual void preActions() {}; virtual void actions(); - virtual void postActions() {}; }; class Scene504: public Scene5xx{ @@ -110,7 +104,6 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene505: public Scene5xx{ @@ -129,9 +122,7 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; virtual void actions(); - virtual void postActions() {}; }; class Scene506: public Scene5xx{ @@ -157,9 +148,7 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; virtual void actions(); - virtual void postActions() {}; }; class Scene507: public Scene5xx{ @@ -171,10 +160,7 @@ public: virtual void setup(); virtual void enter(); - virtual void step() {}; - virtual void preActions() {}; virtual void actions(); - virtual void postActions() {}; }; class Scene508: public Scene5xx{ @@ -188,10 +174,8 @@ public: virtual void setup(); virtual void enter(); - virtual void step() {}; virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; } // End of namespace Nebular diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index 42ec3f1b02..476b13223f 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -54,7 +54,6 @@ void Scene7xx::setPlayerSpritesPrefix() { else _game._player._spritesPrefix = "ROX"; - _game._player._scalingVelocity = true; if (oldName != _game._player._spritesPrefix) diff --git a/engines/mads/nebular/nebular_scenes7.h b/engines/mads/nebular/nebular_scenes7.h index 66a42de87d..ae5b822474 100644 --- a/engines/mads/nebular/nebular_scenes7.h +++ b/engines/mads/nebular/nebular_scenes7.h @@ -56,10 +56,8 @@ public: virtual void setup(); virtual void enter(); - virtual void step() {} virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene707: public SceneTeleporter { @@ -69,9 +67,7 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; virtual void actions(); - virtual void postActions() {}; }; class Scene710: public Scene7xx { @@ -81,9 +77,7 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; virtual void actions(); - virtual void postActions() {}; }; class Scene711: public SceneTeleporter { @@ -93,9 +87,7 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; virtual void actions(); - virtual void postActions() {}; }; class Scene752: public Scene7xx { @@ -110,7 +102,6 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; } // End of namespace Nebular diff --git a/engines/mads/nebular/nebular_scenes8.h b/engines/mads/nebular/nebular_scenes8.h index 2c777d8699..1ea295978d 100644 --- a/engines/mads/nebular/nebular_scenes8.h +++ b/engines/mads/nebular/nebular_scenes8.h @@ -79,9 +79,7 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; virtual void actions(); - virtual void postActions() {}; }; } // End of namespace Nebular diff --git a/engines/mads/phantom/phantom_scenes.h b/engines/mads/phantom/phantom_scenes.h index e4b79fef33..986934fe62 100644 --- a/engines/mads/phantom/phantom_scenes.h +++ b/engines/mads/phantom/phantom_scenes.h @@ -114,10 +114,7 @@ public: virtual void setup() {} virtual void enter() {} - virtual void step() {} - virtual void preActions() {} virtual void actions() {} - virtual void synchronize(Common::Serializer &s) {} }; } // End of namespace Phantom -- cgit v1.2.3 From 9cc67a997eddc87d1fe0cae502c632e748667ee0 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 9 May 2014 12:32:48 +0300 Subject: FULLPIPE: Implement MovGraph::calcChunk() --- engines/fullpipe/motion.cpp | 86 +++++++++++++++++++++++---------------------- 1 file changed, 44 insertions(+), 42 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 96b610cb90..a565eb1146 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -584,7 +584,7 @@ void MovGraph::freeItems() { _items[i]->free(); for (int j = 0; j < _items[i]->movarr->size(); j++) - delete (_items[i]->movarr)->operator[](j); + delete (*_items[i]->movarr)[j]; delete _items[i]->movarr; } @@ -731,8 +731,10 @@ bool MovGraph::findClosestLink(int unusedArg, Common::Point *p, MovArr *movarr) if (movarr) movarr->_link = link; - p->x = resx; - p->y = resy; + if (p) { + p->x = resx; + p->y = resy; + } return true; } @@ -880,11 +882,8 @@ void MovGraph::calcBbox(Common::Rect *rect, MovGraphLink *grlink, MovArr *movarr } bool MovGraph::calcChunk(int idx, int x, int y, MovArr *arr, int a6) { -#if 0 int staticsId; - v7 = idx << 6; - if (_items[idx]->ani->_statics) { staticsId = _items[idx]->ani->_statics->_staticsId; } else { @@ -894,44 +893,47 @@ bool MovGraph::calcChunk(int idx, int x, int y, MovArr *arr, int a6) { staticsId = _items[idx]->ani->_movement->_staticsObj2->_staticsId; } - v19 = -1; - v11 = 100; - v12 = genMovArr(x, y, &arrSize, 0, 1); - movarr = v12; - if ( !v12 ) - return findClosestLink(idx, (POINT *)&x, arr); - unusedArg = 0; - if ( arrSize <= 0 ) { - LABEL_16: - CObjectFree(v12); - return 0; - } - v14 = &v12->_link; - do { - v15 = _mgm->refreshOffsets(_items[idx]->ani->_id, staticsId, v12->_link->dwordArray2[_field_44]->sceneId); - if ( v15 < v11 ) { - v11 = v15; - v19 = unusedArg; + int arrSize; + + Common::Array *movarr = genMovArr(x, y, &arrSize, 0, 1); + + if (!movarr) + return findClosestLink(idx, 0, arr); + + bool res = false; + + int idxmin = -1; + int offmin = 100; + + for (uint i = 0; i < arrSize; i++) { + int off = _mgm.refreshOffsets(_items[idx]->ani->_id, staticsId, (*movarr)[i]->_link->_dwordArray2[_field_44]); + + if (off < offmin) { + offmin = off; + idxmin = i; } - v16 = _mgm->refreshOffsets(_items[idx]->ani->_id, staticsId, v12->_link->dwordArray2[_field_444]->scene); - if ( v16 < v11 ) { - v11 = v16; - v19 = unusedArg; + + off = _mgm.refreshOffsets(_items[idx]->ani->_id, staticsId, (*movarr)[i]->_link->_dwordArray2[_field_44 + 1]); + if (off < offmin) { + offmin = off; + idxmin = i; } - v14 += 8; - ++unusedArg; - } while ( unusedArg < arrSize ); - if ( v19 == -1 ) { - v12 = movarr; - goto LABEL_16; - } - v17 = movarr; - memcpy(arr, &movarr[v19], 0x20u); - CObjectFree(v17); -#endif - - warning("STUB: MovGraph::calcChunk()"); - return true; + } + + if (idxmin != -1) { + arr->_afield_0 = (*movarr)[idxmin]->_afield_0; + arr->_afield_4 = (*movarr)[idxmin]->_afield_4; + arr->_afield_8 = (*movarr)[idxmin]->_afield_8; + arr->_link = (*movarr)[idxmin]->_link; + arr->_dist = (*movarr)[idxmin]->_dist; + arr->_point = (*movarr)[idxmin]->_point; + + res = true; + } + + delete movarr; + + return res; } int MovGraph2::getItemIndexByGameObjectId(int objectId) { -- cgit v1.2.3 From 2ec60606d837bb137f9178b5f3e8517c149fe2b6 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 9 May 2014 23:15:13 +0200 Subject: MADS: Implement scene 511 --- engines/mads/nebular/game_nebular.h | 1 + engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes5.cpp | 343 ++++++++++++++++++++++++++++++- engines/mads/nebular/nebular_scenes5.h | 20 ++ 4 files changed, 354 insertions(+), 12 deletions(-) diff --git a/engines/mads/nebular/game_nebular.h b/engines/mads/nebular/game_nebular.h index e754a11245..82ddfb5972 100644 --- a/engines/mads/nebular/game_nebular.h +++ b/engines/mads/nebular/game_nebular.h @@ -72,6 +72,7 @@ enum InventoryObject { OBJ_FAKE_ID = 29, OBJ_ID_CARD = 30, OBJ_POLYCEMENT = 31, + OBJ_FISHING_ROD = 32, OBJ_FISHING_LINE = 33, OBJ_PADLOCK_KEY = 34, OBJ_DOOR_KEY = 35, diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 2ae5b073da..b406468e35 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -213,7 +213,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 508: // laser cannon return new Scene508(vm); case 511: // outside pleasure dome - return new DummyScene(vm); // TODO + return new Scene511(vm); case 512: // inside pleasure dome return new DummyScene(vm); // TODO case 513: // outside mall diff --git a/engines/mads/nebular/nebular_scenes5.cpp b/engines/mads/nebular/nebular_scenes5.cpp index 65498ec155..109923a1b5 100644 --- a/engines/mads/nebular/nebular_scenes5.cpp +++ b/engines/mads/nebular/nebular_scenes5.cpp @@ -933,7 +933,7 @@ void Scene505::step() { _scene->_sequences.remove(_globals._sequenceIndexes[1]); _scene->_sequences.remove(_globals._sequenceIndexes[0]); _scene->_sequences.remove(_globals._sequenceIndexes[13]); - _globals._sequenceIndexes[13] = _scene->_sequences.startReverseCycle (_globals._spriteIndexes[13], false, 6, 1, 0, 0); + _globals._sequenceIndexes[13] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[13], false, 6, 1, 0, 0); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SEQUENCE_TRIGGER_EXPIRE, 0, 63); _vm->_sound->command(18); } @@ -949,7 +949,7 @@ void Scene505::step() { _scene->_sequences.remove(_globals._sequenceIndexes[0]); if (_selectedId != _homeSelectedId) { - _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle (_globals._spriteIndexes[0 + _selectedId], false, 24, 0, 0, 0); + _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0 + _selectedId], false, 24, 0, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 1); } } @@ -1037,26 +1037,26 @@ void Scene505::step() { int syncIdx = _globals._sequenceIndexes[13]; _globals._sequenceIndexes[13] = _scene->_sequences.startCycle(_globals._spriteIndexes[13], false, -2); _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 8); - _scene->_sequences.updateTimeout (_globals._sequenceIndexes[13], syncIdx); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[13], syncIdx); _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[_homeSelectedId], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); _globals._sequenceIndexes[11] = _scene->_sequences.startCycle(_globals._spriteIndexes[11], false, _selectedId + 1); if (_selectedId != _homeSelectedId) { - _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle (_globals._spriteIndexes[0 + _selectedId], false, 24, 0, 0, 0); + _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0 + _selectedId], false, 24, 0, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 1); } break; } case 61: - _globals._sequenceIndexes[10] = _scene->_sequences.addSpriteCycle (_globals._spriteIndexes[10], false, 8, 0, 0, 0); + _globals._sequenceIndexes[10] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[10], false, 8, 0, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 8); - _scene->_sequences.updateTimeout (_globals._sequenceIndexes[10], _globals._sequenceIndexes[9]); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[10], _globals._sequenceIndexes[9]); break; case 62: - _globals._sequenceIndexes[9] = _scene->_sequences.addSpriteCycle (_globals._spriteIndexes[9], false, 8, 1, 0, 0); + _globals._sequenceIndexes[9] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 8, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 8); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SEQUENCE_TRIGGER_EXPIRE, 0, 61); break; @@ -1102,18 +1102,18 @@ void Scene506::enter() { _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('c', -1)); _globals._spriteIndexes[4] = _scene->_sprites.addSprites("*RXCD_3"); - _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); int idx = _scene->_dynamicHotspots.add(0x37D, 0x242, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); int hotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(65, 125), FACING_NORTHWEST); _scene->_dynamicHotspots.setCursor(hotspotId, CURSOR_GO_LEFT); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); - _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 1); + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 1); idx = _scene->_dynamicHotspots.add(0x336, 0x242, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); hotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(112, 102), FACING_NORTHWEST); _scene->_dynamicHotspots.setCursor(hotspotId, CURSOR_GO_LEFT); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 13); - _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -1); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -1); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 5); _firstDoorFl = true; _actionFl = false; @@ -1133,7 +1133,7 @@ void Scene506::enter() { _game._player._facing = FACING_NORTHEAST; _game._player._visible = false; _game._player._stepEnabled = false; - _scene->_sequences.remove (_globals._sequenceIndexes[3]); + _scene->_sequences.remove(_globals._sequenceIndexes[3]); _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -2); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 5); _scene->loadAnimation(formAnimName('R', 1), 70); @@ -1720,5 +1720,326 @@ void Scene508::actions() { /*------------------------------------------------------------------------*/ +void Scene511::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(0x345); + _scene->addActiveVocab(0x87); + _scene->addActiveVocab(0xD); +} + +void Scene511::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('c', 0)); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites("*RXCD_6"); + + if (_scene->_priorSceneId != -2) + _handingLine = false; + + if (_globals[kBoatRaised]) { + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('b', 0)); + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 3); + _scene->_hotspots.activate(0x345, false); + int idx = _scene->_dynamicHotspots.add(0x345, VERB_WALKTO, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(75, 124), FACING_NORTH); + _scene->_hotspots.activate(0x347, false); + } else { + _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('b', 2)); + _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('b', 3)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('b', 1)); + + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 1, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 5); + + _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 4); + + _globals._sequenceIndexes[6] = _scene->_sequences.startCycle(_globals._spriteIndexes[6], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[6],5); + + _scene->_hotspots.activate(0x347, true); + _scene->_hotspots.activate(0x345, true); + _scene->changeVariant(1); + } + + int frame = 0; + if (_globals[kLineStatus] == 2) + frame = -1; + else if (_globals[kLineStatus] == 3) + frame = -2; + + if (_globals[kLineStatus] == 2 || _globals[kLineStatus] == 3) { + _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('b', 4)); + _globals._sequenceIndexes[7] = _scene->_sequences.startCycle(_globals._spriteIndexes[7], false, frame); + int idx = _scene->_dynamicHotspots.add(0x87, VERB_WALKTO, _globals._sequenceIndexes[7], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(26, 153), FACING_NORTHEAST); + _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 3); + if (_globals[kBoatRaised]) + _scene->changeVariant(2); + } + + _lineFrame = -1; + _lineMoving = false; + + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); + + if (_scene->_priorSceneId == 512) { + _game._player._playerPos = Common::Point(60, 112); + _game._player._facing = FACING_SOUTHEAST; + } else if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(55, 152); + _game._player._facing = FACING_NORTHWEST; + _game._player._visible = false; + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); + _scene->loadAnimation(formAnimName('R', 1), 70); + } else if (_handingLine) { + _game._player._visible = false; + _lineAnimationMode = 1; + _lineAnimationPosition = 1; + _scene->loadAnimation(formAnimName('R', -1)); + _lineFrame = 2; + } + sceneEntrySound(); +} + +void Scene511::step() { + if ((_lineAnimationMode == 1) && _scene->_activeAnimation) { + if (_lineFrame != _scene->_activeAnimation->getCurrentFrame()) { + _lineFrame = _scene->_activeAnimation->getCurrentFrame(); + int resetFrame = -1; + + if ((_lineAnimationPosition == 2) && (_lineFrame == 14)) + _lineMoving = false; + + if (_lineAnimationPosition == 1) { + if (_lineFrame == 3) { + _lineMoving = false; + resetFrame = 2; + } + + if (_handingLine) + resetFrame = 2; + } + + if ((resetFrame >= 0) && (resetFrame != _scene->_activeAnimation->getCurrentFrame())) { + _scene->_activeAnimation->setCurrentFrame(resetFrame); + _lineFrame = resetFrame; + } + } + } + + switch (_game._trigger) { + case 70: + _game._player._visible = true; + _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; + _scene->_sequences.addTimer(6, 71); + break; + + case 71: + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 72); + break; + + case 72: + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); + _game._player._stepEnabled = true; + break; + + default: + break; + } +} + +void Scene511::preActions() { + if (!_handingLine) + return; + + if (_action.isAction(VERB_LOOK) || _action.isAction(0x87) || _action.isAction(VERB_TALKTO)) + _game._player._needToWalk = false; + + if ((!_action.isAction(0x170, 0x87, 0x345) || !_action.isAction(0x19, 0x87, 0x345)) && _game._player._needToWalk) { + if (_game._trigger == 0) { + _game._player._readyToWalk = false; + _game._player._stepEnabled = false; + _scene->freeAnimation (); + _lineAnimationMode = 2; + _scene->loadAnimation(formAnimName('R',2), 1); + } else if (_game._trigger == 1) { + _game._player._visible = true; + _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; + _game._objects.setRoom(OBJ_FISHING_LINE, 1); + _handingLine = false; + _game._player._stepEnabled = true; + _game._player._readyToWalk = true; + } + } +} + +void Scene511::actions() { + if (_action.isAction(0x242, 0x372)) + _scene->_nextSceneId = 512; + else if (_action.isAction(0x36A, 0x324)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 1); + break; + + case 1: { + int syncIdx = _globals._sequenceIndexes[1]; + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[1], syncIdx); + _scene->_sequences.addTimer(6, 2); + } + break; + + case 2: + _game._player._visible = false; + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 8, 1, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 3); + break; + + case 3: { + int syncIdx = _globals._sequenceIndexes[4]; + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, -2); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], syncIdx); + _scene->_nextSceneId = 504; + } + break; + + default: + break; + } + } else if (_action.isAction(VERB_TAKE, 0x87)) { + if (!_globals[kBoatRaised]) { + if (_globals[kLineStatus] == 2) { + if (_globals[kLineStatus] != 3) { + if (_game._trigger == 0) { + _game._player._stepEnabled = false; + _game._player._visible = false; + _lineAnimationMode = 1; + _lineAnimationPosition = 1; + _lineMoving = true; + _scene->loadAnimation(formAnimName('R', -1), 0); + _scene->_sequences.addTimer(1, 1); + } else if (_game._trigger == 1) { + if (_lineMoving) { + _scene->_sequences.addTimer(1, 1); + } else { + _game._objects.addToInventory(OBJ_FISHING_LINE); + _lineMoving = true; + _handingLine = true; + _game._player._stepEnabled = true; + } + } + } else + _vm->_dialogs->show(51129); + } else + return; + } else { + _vm->_dialogs->show(51130); + } + } else if (_action.isAction(0x170, 0x87, 0x345) || _action.isAction(0x19, 0x87, 0x345)) { + if (_globals[kBoatRaised]) + _vm->_dialogs->show(51131); + else if (_globals[kLineStatus] == 1) + _vm->_dialogs->show(51130); + else if (!_globals[kBoatRaised] && _handingLine) { + if (_globals[kLineStatus] != 3) { + if (_game._trigger == 0) { + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._sequenceIndexes[7]); + _lineMoving = true; + _lineAnimationPosition = 2; + _scene->_sequences.addTimer(1, 1); + } else if (_game._trigger == 1) { + if (_lineMoving) + _scene->_sequences.addTimer(1, 1); + else { + _game._player._visible = true; + _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; + _globals._sequenceIndexes[7] = _scene->_sequences.startCycle(_globals._spriteIndexes[7], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 4); + int idx = _scene->_dynamicHotspots.add(0x87, VERB_WALKTO, _globals._sequenceIndexes[7], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(26, 153), FACING_NORTHEAST); + _game._objects.removeFromInventory(OBJ_FISHING_LINE, 1); + _handingLine = false; + _lineMoving = true; + _globals[kLineStatus] = 3; + _game._player._stepEnabled = true; + } + } + } + } + } else if (_action.isAction(VERB_LOOK, 0x31E) || _action._lookFlag) { + if (_globals[kLineStatus] == 2) + _vm->_dialogs->show(51110); + else { + if (_globals[kLineStatus] == 3) + _vm->_dialogs->show(51111); + else + _vm->_dialogs->show(51112); + } + } else if (_action.isAction(VERB_LOOK, 0x324)) + _vm->_dialogs->show(51113); + else if (_action.isAction(VERB_LOOK, 0x31D)) + _vm->_dialogs->show(51114); + else if (_action.isAction(0x1AD, 0x322) || _action.isAction(0x1AD, 0x361) || _action.isAction(0x1AD, 0x321)) + _vm->_dialogs->show(51115); + else if (_action.isAction(VERB_LOOK, 0x37B)) + _vm->_dialogs->show(51116); + else if (_action.isAction(VERB_LOOK, 0x34A)) + _vm->_dialogs->show(51117); + else if (_action.isAction(VERB_LOOK, 0x37C)) + _vm->_dialogs->show(51118); + else if (_action.isAction(0x17B, 0xFF, 0x37C) || _action.isAction(0x17B, 0x6F, 0x37C)) + _vm->_dialogs->show(51119); + else if ( (_action.isAction(VERB_PUT) || _action.isAction(VERB_THROW)) + && (_action.isAction(0x171) || _action.isAction(0x2A) || _action.isAction(0x2B)) + && _action.isAction(0x37C)) + _vm->_dialogs->show(51120); + else if (_action.isAction(VERB_LOOK, 0x372)) { + if (_globals[kBoatRaised]) + _vm->_dialogs->show(51121); + else + _vm->_dialogs->show(51128); + } else if (_action.isAction(VERB_LOOK, 0x349)) + _vm->_dialogs->show(51122); + else if (_action.isAction(VERB_LOOK, 0x87) && (_action._mainObjectSource == 4) && (_globals[kLineStatus] == 2)) + _vm->_dialogs->show(51126); + else if (_action.isAction(VERB_LOOK, 0x87) && (_action._mainObjectSource == 4) && (_globals[kLineStatus] == 3)) + _vm->_dialogs->show(51133); + else if (_action.isAction(VERB_LOOK, 0x2CD)) + _vm->_dialogs->show(51127); + else if (_action.isAction(VERB_LOOK, 0x345)) + if (_globals[kBoatRaised]) + _vm->_dialogs->show(51123); + else if (_globals[kLineStatus] != 3) + _vm->_dialogs->show(51124); + else + _vm->_dialogs->show(51125); + else if (_action.isAction(VERB_LOOK, 0x87) && (_globals[kLineStatus] == 3)) + _vm->_dialogs->show(51125); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes5.h b/engines/mads/nebular/nebular_scenes5.h index c67ff9a0b9..f46e8eeb09 100644 --- a/engines/mads/nebular/nebular_scenes5.h +++ b/engines/mads/nebular/nebular_scenes5.h @@ -178,6 +178,26 @@ public: virtual void actions(); }; +class Scene511: public Scene5xx{ +private: + bool _handingLine; + bool _lineMoving; + + int _lineAnimationMode; + int _lineFrame; + int _lineAnimationPosition; + +public: + Scene511(MADSEngine *vm) : Scene5xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From e2f2e31db37be06538ecea78917c64a0b9c65197 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 9 May 2014 20:06:35 -0400 Subject: MADS: Changed greyList to use original style insertion sort --- engines/mads/palette.cpp | 81 ++++++++++++++++++++++++++++++++++++++---------- engines/mads/palette.h | 14 ++++----- 2 files changed, 72 insertions(+), 23 deletions(-) diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index 6be9d3dc30..1d3072f14b 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -359,7 +359,7 @@ void Fader::fadeToGrey(byte palette[PALETTE_SIZE], byte *paletteMap, GreyEntry map[PALETTE_COUNT]; int intensity; byte palIndex[PALETTE_COUNT][3]; - bool signs[PALETTE_COUNT][3]; + int8 signs[PALETTE_COUNT][3]; mapToGreyRamp(palette, baseColor, numColors, baseGrey, numGreys, map); @@ -408,13 +408,10 @@ void Fader::fadeToGrey(byte palette[PALETTE_SIZE], byte *paletteMap, } } -static bool greyCompareFunc(const Fader::GreyTableEntry &g1, const Fader::GreyTableEntry &g2) { - return g1._list < g2._list; -} - void Fader::mapToGreyRamp(byte palette[PALETTE_SIZE], int baseColor, int numColors, int baseGrey, int numGreys, GreyEntry *map) { - GreyTableEntry greyList[PALETTE_COUNT]; + byte greyList[PALETTE_COUNT]; + byte greyMapping[PALETTE_COUNT]; byte greyTable[64]; byte greyIntensity[64]; int intensity, shiftSign; @@ -423,7 +420,7 @@ void Fader::mapToGreyRamp(byte palette[PALETTE_SIZE], int baseColor, int numColo greyPopularity(greyList, greyTable, numColors); for (int idx = 0; idx < numColors; ++idx) { - greyList[idx]._mapping = idx; + greyMapping[idx] = idx; Common::fill(&map[idx]._accum[0], &map[idx]._accum[3], 0); } @@ -431,8 +428,8 @@ void Fader::mapToGreyRamp(byte palette[PALETTE_SIZE], int baseColor, int numColo map[idx]._mapColor = (byte)idx; } - // Sort the mapping list - Common::sort(&greyList[0], &greyList[numColors], greyCompareFunc); + // Sort the mapping lists + insertionSort(numColors, greyList, greyMapping); // Initialise state variables int greySum = 0; @@ -444,7 +441,7 @@ void Fader::mapToGreyRamp(byte palette[PALETTE_SIZE], int baseColor, int numColo for (int greyCtr = 0; greyCtr < 64; ++greyCtr) { for (int idx = 0; idx < greyTable[greyCtr]; ++idx) { - greySum += greyList[greyScan++]._list; + greySum += greyList[greyScan++]; ++greyColors; greyAccum += numGreys; @@ -455,8 +452,8 @@ void Fader::mapToGreyRamp(byte palette[PALETTE_SIZE], int baseColor, int numColo } for (int rescan = firstColor; rescan < greyScan; ++rescan) { - map[greyList[rescan]._mapping]._intensity = greyIntensity[greyMark]; - map[greyList[rescan]._mapping]._mapColor = (byte)(greyMark + baseGrey); + map[greyMapping[rescan]]._intensity = greyIntensity[greyMark]; + map[greyMapping[rescan]]._mapColor = (byte)(greyMark + baseGrey); } firstColor = greyScan; @@ -487,24 +484,76 @@ void Fader::mapToGreyRamp(byte palette[PALETTE_SIZE], int baseColor, int numColo } void Fader::getGreyValues(const byte palette[PALETTE_SIZE], - GreyTableEntry greyList[PALETTE_COUNT], int baseColor, int numColors) { + byte greyList[PALETTE_COUNT], int baseColor, int numColors) { const byte *palP = &palette[baseColor * 3]; for (int i = 0; i < numColors; ++i, palP += 3) { int v = rgbMerge(palP[0], palP[1], palP[2]); - greyList[i]._list = v >> 7; + greyList[i] = v >> 7; } } -void Fader::greyPopularity(const GreyTableEntry greyList[PALETTE_COUNT], +void Fader::greyPopularity(const byte greyList[PALETTE_COUNT], byte greyTable[64], int numColors) { Common::fill(&greyTable[0], &greyTable[64], 0); for (int i = 0; i < numColors; ++i) { - int idx = greyList[i]._list; + int idx = greyList[i]; ++greyTable[idx]; } } +void Fader::insertionSort(int size, byte *id, byte *value) { + bool restartFlag; + int endIndex = size - 1; + + do { + restartFlag = false; + if (endIndex <= 0) + break; + + for (int arrIndex = 0; arrIndex < endIndex && !restartFlag; ++arrIndex) { + byte *idP = id + arrIndex; + byte *valueP = value + arrIndex; + + // Check whether the next index is out of order with the one following it + if (*idP > *(idP + 1)) { + // Found an incorrect ordering + restartFlag = true; + + // Save id/value at current index + byte savedId = *idP; + byte savedValue = *valueP; + + int moveCount = size - arrIndex - 1; + if (moveCount > 0) { + Common::copy(idP + 1, idP + moveCount + 2, idP); + Common::copy(valueP + 1, valueP + moveCount + 2, valueP); + } + + // Scan for insert spot + int idx = 0; + if (endIndex > 0) { + bool breakFlag = false; + for (; idx <= endIndex && !breakFlag; ++idx) { + breakFlag = savedId < id[idx]; + } + } + + // Set up an insert point for entry + moveCount = size - idx - 1; + if (moveCount > 0) { + Common::copy_backward(id + idx, id + idx + moveCount, id + idx + moveCount + 1); + Common::copy_backward(value + idx, value + idx + moveCount, value + idx + moveCount + 1); + } + + // Set shifted values at the new position + id[idx] = savedId; + value[idx] = savedValue; + } + } + } while (restartFlag); +} + int Fader::rgbMerge(RGB6 &palEntry) { return rgbMerge(palEntry.r, palEntry.g, palEntry.b); } diff --git a/engines/mads/palette.h b/engines/mads/palette.h index 31c3d1a90f..e1f7de838d 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -168,23 +168,23 @@ public: byte _mapColor; uint16 _accum[3]; }; - - struct GreyTableEntry { - int _list; - int _mapping; - }; private: void mapToGreyRamp(byte palette[PALETTE_SIZE], int baseColor, int numColors, int baseGrey, int numGreys, GreyEntry *map); - void getGreyValues(const byte palette[PALETTE_SIZE], GreyTableEntry greyList[PALETTE_COUNT], + void getGreyValues(const byte palette[PALETTE_SIZE], byte greyList[PALETTE_COUNT], int baseColor, int numColors); /** * Given a grey value list containing grey shades (0-63), creates a 64 byte * grey table containing the number of grey values for each intensity */ - void greyPopularity(const GreyTableEntry greyList[PALETTE_COUNT], byte greyTable[64], int numColors); + void greyPopularity(const byte greyList[PALETTE_COUNT], byte greyTable[64], int numColors); + + /** + * Does an insertion sort of a given id/value array pair + */ + void insertionSort(int size, byte *id, byte *value); protected: MADSEngine *_vm; public: -- cgit v1.2.3 From 88ac15d69e550209f1a82d3090e370d2fa7d3153 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 9 May 2014 22:53:37 -0400 Subject: MADS: Greyscale fading now close to the original --- engines/mads/palette.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index 1d3072f14b..e718059b67 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -377,7 +377,7 @@ void Fader::fadeToGrey(byte palette[PALETTE_SIZE], byte *paletteMap, intensity = _colorValues[colorCtr]; } - int diff = intensity - palette[palCtr * 3 + colorCtr]; + int diff = intensity - VGA_COLOR_REV(palette[palCtr * 3 + colorCtr]); palIndex[palCtr][colorCtr] = (byte)ABS(diff); signs[palCtr][colorCtr] = (diff == 0) ? 0 : (diff < 0 ? -1 : 1); } @@ -390,7 +390,10 @@ void Fader::fadeToGrey(byte palette[PALETTE_SIZE], byte *paletteMap, map[index]._accum[colorCtr] += palIndex[palCtr][colorCtr]; while (map[index]._accum[colorCtr] >= steps) { map[index]._accum[colorCtr] -= steps; - palette[palCtr * 3 + colorCtr] = signs[palCtr][colorCtr]; + + byte rgb63 = VGA_COLOR_REV(palette[palCtr * 3 + colorCtr]) + + signs[palCtr][colorCtr]; + palette[palCtr * 3 + colorCtr] = VGA_COLOR_TRANS(rgb63); } } } -- cgit v1.2.3 From 0549ae8259f25a3bd86e6dabfb822d96c5b40416 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 10 May 2014 09:30:09 +0300 Subject: FULLPIPE: Started MovGraph::doWalkTo() implementation --- engines/fullpipe/motion.cpp | 88 +++++++++++++++++++++++++++++++++++++++++++++ engines/fullpipe/motion.h | 9 ++++- 2 files changed, 96 insertions(+), 1 deletion(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index a565eb1146..c9d0130746 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -628,6 +628,94 @@ int MovGraph::method44() { } MessageQueue *MovGraph::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) { +#if 0 + PicAniInfo picAniInfo; + int ss; + + MovItem *v9 = method28(subj, xpos, ypos, fuzzyMatch, &ss); + subj->getPicAniInfo(&picAniInfo); + if ( v9 ) { + v41 = this->_callback1(subj, v9, ss); + v40 = 0; + v10 = MovGraph_getItemIndexByStaticAni(this, subj) << 6; + v42 = v10; + v11 = (MovGraphItem *)((char *)this->_items + v10); + if ( v11->count > 0 ) { + ptr = 0; + do { + if ( *(MovArr **)((char *)&v11->items->movarr + ptr) == v41 ) { + v12 = subj->_movement; + if ( v12 ) { + v13 = v12->_staticsObj1->_staticsId; + v14 = StaticANIObject_calcStepLen(&p, subj); + v15 = MovGraph_sub_451D50(this, subj, subj->_ox - v14->x, subj->._oy - v14->y, v13, (int)xpos, ypos, 0, fuzzyMatch); + v16 = v15; + if ( !v15 || !MessageQueue_getExCommandByIndex(v15, 0) ) + goto return_0; + v17 = MessageQueue_getExCommandByIndex(v16, 0); + v18 = v17->msg._messageKind; + if ( v18 != 1 && v18 != 20 || (v19 = subj->_movement, v17->_messageNum != v19->go._id) || (v20 = v17->msg._field_14, v20 >= 1) && v20 <= v19->_currDynamicPhaseIndex ) + subj->playIdle(); + } + } + v11 = (MovGraphItem *)((char *)this->_items + v42); + ++v40; + v21 = v11->count; + ptr += 16; + } while ( v40 < v21 ); + } + } + v22 = method28(subj, xpos, ypos, fuzzyMatch, &ss); + if ( v22 + && (v23 = this->_callback1(subj, v22, ss), + v24 = MovGraph_getItemIndexByStaticAni(this, subj), + v25 = 0, + v24 <<= 6, + v26 = (MovGraphItem *)((char *)this->_items + v24), + ptr = v24, + v27 = v26->count, + v27 > 0) ) { + v28 = v26->items; + while ( v28->movarr != v23 ) { + ++v25; + ++v28; + if ( v25 >= v27 ) + goto LABEL_20; + } + v30 = v26->items; + v31 = v26->movarr; + v32 = v25; + v33 = v30[v32].movarr; + xpos = v30[v32].movarr; + if ( v31 ) + CObjectFree(v31); + memcpy((char *)&this->_items->movarr + ptr, v33, 0x20u); + v34 = xpos; + v35 = (MovArr *)operator new(8 * xpos->_movStepCount); + v36 = ptr; + *(MovArr **)((char *)&this->_items->movarr + ptr) = v35; + memcpy(*(void **)((char *)&this->_items->movarr + v36), v34->_movSteps, 8 * v34->_movStepCount); + *(int *)((char *)&this->_items->field_10 + v36) = -1; + *(int *)((char *)&this->_items->field_14 + v36) = 0; + MessageQueue *mq = fillMGMinfo(*(StaticANIObject **)((char *)&this->_items->ani + v36), (MovArr *)((char *)&this->_items->movarr + v36), staticsId); + if (mq) { + ExCommand *ex = new ExCommand(); + ex->_messageKind = 17; + ex->_messageNum = 54; + ex->_parentId = subj->_id; + ex->_field_3C = 1; + mq->addExCommandToEnd(ex); + } + subj->setPicAniInfo(&picAniInfo); + result = mq; + } else { + LABEL_20: + subj->setPicAniInfo(&picAniInfo); + return_0: + result = 0; + } + return result; +#endif warning("STUB: MovGraph::doWalkTo()"); return 0; diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index 38632c14b7..94cd274c0d 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -308,6 +308,13 @@ struct MovArr { Common::Point _point; }; +struct MovItem { + MovArr *movarr; + int _mfield_4; + int _mfield_8; + int _mfield_C; +}; + struct MovGraphItem { StaticANIObject *ani; int field_4; @@ -319,7 +326,7 @@ struct MovGraphItem { int field_1C; int field_20; int field_24; - int items; + MovItem *items; int count; int field_30; int field_34; -- cgit v1.2.3 From 57f97bc7f6d5c1230e8fd0978aa4ea5a63942b57 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 10 May 2014 09:47:53 +0300 Subject: FULLPIPE: More work on MovGraph::doWalkTo() --- engines/fullpipe/motion.cpp | 54 ++++++++++++++++++++------------------------- 1 file changed, 24 insertions(+), 30 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index c9d0130746..b97d980d7d 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -635,34 +635,28 @@ MessageQueue *MovGraph::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int MovItem *v9 = method28(subj, xpos, ypos, fuzzyMatch, &ss); subj->getPicAniInfo(&picAniInfo); if ( v9 ) { - v41 = this->_callback1(subj, v9, ss); - v40 = 0; - v10 = MovGraph_getItemIndexByStaticAni(this, subj) << 6; - v42 = v10; - v11 = (MovGraphItem *)((char *)this->_items + v10); - if ( v11->count > 0 ) { - ptr = 0; - do { - if ( *(MovArr **)((char *)&v11->items->movarr + ptr) == v41 ) { - v12 = subj->_movement; - if ( v12 ) { - v13 = v12->_staticsObj1->_staticsId; - v14 = StaticANIObject_calcStepLen(&p, subj); - v15 = MovGraph_sub_451D50(this, subj, subj->_ox - v14->x, subj->._oy - v14->y, v13, (int)xpos, ypos, 0, fuzzyMatch); - v16 = v15; - if ( !v15 || !MessageQueue_getExCommandByIndex(v15, 0) ) - goto return_0; - v17 = MessageQueue_getExCommandByIndex(v16, 0); - v18 = v17->msg._messageKind; - if ( v18 != 1 && v18 != 20 || (v19 = subj->_movement, v17->_messageNum != v19->go._id) || (v20 = v17->msg._field_14, v20 >= 1) && v20 <= v19->_currDynamicPhaseIndex ) - subj->playIdle(); - } + MovArr *goal = _callback1(subj, v9, ss); + int idx = getItemIndexByStaticAni(subj); + + for (uint i = 0; i < _items[idx]->count; i++) { + if (_items[idx]->items[i]->movarr == goal) { + if (subj->_movement) { + Common::Point point; + + subj->calcStepLen(point); + v15 = MovGraph_sub_451D50(this, subj, subj->_ox - point.x, subj->_oy - point.y, subj->_movement->_staticsObj1->_staticsId, xpos, ypos, 0, fuzzyMatch); + v16 = v15; + if ( !v15 || !MessageQueue_getExCommandByIndex(v15, 0) ) + goto return_0; + + ExCommand *ex = MessageQueue_getExCommandByIndex(v16, 0); + + if ((ex->_messageKind != 1 && ex->_messageKind != 20) || + ex->_messageNum != subj->_movement->_id || + (ex->_field_14 >= 1 && ex->_field_14 <= subj->_movement->_currDynamicPhaseIndex)) + subj->playIdle(); } - v11 = (MovGraphItem *)((char *)this->_items + v42); - ++v40; - v21 = v11->count; - ptr += 16; - } while ( v40 < v21 ); + } } } v22 = method28(subj, xpos, ypos, fuzzyMatch, &ss); @@ -686,12 +680,12 @@ MessageQueue *MovGraph::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int v31 = v26->movarr; v32 = v25; v33 = v30[v32].movarr; - xpos = v30[v32].movarr; + vvv = v30[v32].movarr; if ( v31 ) CObjectFree(v31); memcpy((char *)&this->_items->movarr + ptr, v33, 0x20u); - v34 = xpos; - v35 = (MovArr *)operator new(8 * xpos->_movStepCount); + v34 = vvv; + v35 = (MovArr *)operator new(8 * vvv->_movStepCount); v36 = ptr; *(MovArr **)((char *)&this->_items->movarr + ptr) = v35; memcpy(*(void **)((char *)&this->_items->movarr + v36), v34->_movSteps, 8 * v34->_movStepCount); -- cgit v1.2.3 From 5edc13bf78a9bc447c83359bd762b7157f0ca8fa Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 10 May 2014 09:17:58 +0200 Subject: MADS: Implement scene 512 --- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes5.cpp | 294 +++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes5.h | 16 ++ 3 files changed, 311 insertions(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index b406468e35..17debd5bb1 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -215,7 +215,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 511: // outside pleasure dome return new Scene511(vm); case 512: // inside pleasure dome - return new DummyScene(vm); // TODO + return new Scene512(vm); case 513: // outside mall return new DummyScene(vm); // TODO case 515: // overview diff --git a/engines/mads/nebular/nebular_scenes5.cpp b/engines/mads/nebular/nebular_scenes5.cpp index 109923a1b5..9d3bbffa20 100644 --- a/engines/mads/nebular/nebular_scenes5.cpp +++ b/engines/mads/nebular/nebular_scenes5.cpp @@ -2041,5 +2041,299 @@ void Scene511::actions() { /*------------------------------------------------------------------------*/ +void Scene512::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(0x88); + _scene->addActiveVocab(0xD); + _scene->addActiveVocab(0xFF); + _scene->addActiveVocab(0x366); +} + +void Scene512::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('r', -1)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites("*RXMRC_9"); + _globals._spriteIndexes[8] = _scene->_sprites.addSprites("*RXMRC_8"); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 0)); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('x', 1)); + _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('x', 2)); + _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('x', 3)); + + if (_game._objects[OBJ_FISHING_ROD]._roomNumber == _scene->_currentSceneId) { + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 9, 0, 0, 0); + _fishingRodHotspotId = _scene->_dynamicHotspots.add(0x88, VERB_WALKTO, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(_fishingRodHotspotId, Common::Point(199, 101), FACING_NORTHEAST); + } + + if (!_game._visitedScenes._sceneRevisited) + _globals[kRegisterOpen] = false; + + _scene->_hotspots.activate(0xFF, false); + if (_game._difficulty == DIFFICULTY_EASY) { + if (_game._objects[OBJ_PADLOCK_KEY]._roomNumber == _scene->_currentSceneId) { + _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 10, 0, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 3); + _keyHotspotId = _scene->_dynamicHotspots.add(0xFF, VERB_WALKTO, _globals._sequenceIndexes[6], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(_keyHotspotId, Common::Point(218, 152), FACING_NORTHEAST); + } + if (_globals[kRegisterOpen]) { + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 3); + _scene->_hotspots.activate(0xFF, false); + } + } else if (_globals[kRegisterOpen]) { + if (_game._objects[OBJ_PADLOCK_KEY]._roomNumber == _scene->_currentSceneId) { + _scene->_hotspots.activate(0xFF, true); + _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 3); + } else { + _scene->_hotspots.activate(0xFF, false); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 3); + } + } else + _scene->_hotspots.activate(0xFF, false); + + if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(144, 152); + _game._player._facing = FACING_NORTHEAST; + } + + sceneEntrySound(); +} + +void Scene512::actions() { + if (_action.isAction(0x32F, 0xF9)) + _scene->_nextSceneId = 511; + else if (_action.isAction(VERB_TAKE, 0x88)) { + if (_game._trigger || !_game._objects.isInInventory(OBJ_FISHING_ROD)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[2]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_SPRITE, 5, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + + case 1: + _vm->_sound->command(9); + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _scene->_dynamicHotspots.remove(_fishingRodHotspotId); + _game._objects.addToInventory(OBJ_FISHING_ROD); + _vm->_dialogs->showItem(OBJ_FISHING_ROD, 51217); + break; + + case 2: + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[2]); + _game._player._visible = true; + _game._player._stepEnabled = true; + break; + + default: + break; + } + } + } else if (_action.isAction(VERB_OPEN, 0x377)) { + if (!_globals[kRegisterOpen]) { + switch (_game._trigger) { + case 0: + _vm->_dialogs->show(51236); + _game._player._stepEnabled = false; + _game._player._facing = FACING_NORTH; + _scene->_sequences.addTimer(15, 1); + break; + + case 1: + _game._player._visible = false; + _globals._sequenceIndexes[8] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[8], false, 9, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[8], 1, 3); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[8]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + + case 2: + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[8]); + _game._player._visible = true; + _scene->_sequences.addTimer(30, 3); + break; + + case 3: + _game._player._facing = FACING_NORTHEAST; + if (!_game._objects.isInRoom(OBJ_PADLOCK_KEY) || (_game._difficulty == DIFFICULTY_EASY)) { + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 12, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 3); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 4); + } else { + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 12, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 3); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 5); + } + _vm->_sound->command(23); + break; + + case 4: + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 3); + _scene->_sequences.addTimer(60, 6); + break; + + case 5: + _globals._sequenceIndexes[5] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[5], false, 14, 0, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 3); + _scene->_hotspots.activate(0xFF, true); + _scene->_sequences.addTimer(60, 6); + break; + + case 6: + _globals[kRegisterOpen] = true; + _game._player._stepEnabled = true; + break; + + default: + break; + } + } else + _vm->_dialogs->show(51239); + } else if (_action.isAction(VERB_CLOSE, 0x377) && _globals[kRegisterOpen]) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 10, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 2); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[2]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 1); + break; + + case 1: + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[2]); + _game._player._visible = true; + if (!_game._objects.isInRoom(OBJ_PADLOCK_KEY) || _game._difficulty == DIFFICULTY_EASY) { + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 12, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 3); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + } else { + _scene->_sequences.remove(_globals._sequenceIndexes[5]); + _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 12, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 3); + _scene->_hotspots.activate(0xFF, false); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + } + break; + + case 2: + _globals[kRegisterOpen] = false; + _game._player._stepEnabled = true; + break; + + default: + break; + } + } else if (_action.isAction(VERB_TAKE, 0xFF)) { + if (_game._trigger || !_game._objects.isInInventory(OBJ_PADLOCK_KEY)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + + int endVal; + if (_game._player._playerPos == Common::Point(218, 152)) + endVal = 3; + else + endVal = 2; + + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 10, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, endVal); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[2]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_SPRITE, endVal, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + + case 1: + if (_game._player._playerPos == Common::Point(218, 152)) { + _scene->_sequences.remove(_globals._sequenceIndexes[6]); + _scene->_dynamicHotspots.remove(_keyHotspotId); + } else { + _scene->_sequences.remove(_globals._sequenceIndexes[5]); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 3); + _scene->_hotspots.activate(0xFF, false); + } + _vm->_sound->command(9); + _game._objects.addToInventory(OBJ_PADLOCK_KEY); + _vm->_dialogs->showItem(OBJ_PADLOCK_KEY, 51226); + break; + + case 2: + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[2]); + _game._player._visible = true; + _game._player._stepEnabled = true; + break; + + default: + break; + } + } + } else if (_action._lookFlag) + _vm->_dialogs->show(51225); + else if (_action.isAction(VERB_LOOK, 0xFF) && _game._objects.isInRoom(OBJ_PADLOCK_KEY)) + _vm->_dialogs->show(51215); + else if (_action.isAction(VERB_LOOK, 0x88) && (_scene->_activeAnimation->getCurrentFrame() == 4)) + _vm->_dialogs->show(51216); + else if (_action.isAction(VERB_LOOK, 0x354)) + _vm->_dialogs->show(51218); + else if (_action.isAction(VERB_TAKE, 0x354)) + _vm->_dialogs->show(51219); + else if (_action.isAction(VERB_LOOK, 0x349) || _action.isAction(0x103, 0x349)) + _vm->_dialogs->show(51220); + else if (_action.isAction(VERB_LOOK, 0x160)) + _vm->_dialogs->show(51221); + else if (_action.isAction(VERB_LOOK, 0x34E)) + _vm->_dialogs->show(51222); + else if (_action.isAction(VERB_TAKE, 0x34E)) + _vm->_dialogs->show(51223); + else if (_action.isAction(VERB_LOOK, 0xF9)) + _vm->_dialogs->show(51224); + else if (_action.isAction(VERB_LOOK, 0x117)) + _vm->_dialogs->show(51227); + else if (_action.isAction(VERB_TAKE, 0x117)) + _vm->_dialogs->show(51228); + else if (_action.isAction(VERB_LOOK, 0x1BB)) { + if (_game._visitedScenes.exists(604)) + _vm->_dialogs->show(51229); + else + _vm->_dialogs->show(51230); + } if (_action.isAction(VERB_LOOK, 0x47)) + _vm->_dialogs->show(51231); + else if (_action.isAction(VERB_LOOK, 0x347)) + _vm->_dialogs->show(51232); + else if (_action.isAction(VERB_TAKE, 0x347)) + _vm->_dialogs->show(51233); + else if (_action.isAction(VERB_LOOK, 0x2F6)) + _vm->_dialogs->show(51234); + else if (_action.isAction(VERB_LOOK, 0x29F)) + _vm->_dialogs->show(51235); + else if (_action.isAction(VERB_LOOK, 0x486)) + _vm->_dialogs->show(51237); + else if (_action.isAction(VERB_OPEN, 0x486)) + _vm->_dialogs->show(51238); + else if (_action.isAction(VERB_LOOK, 0x377)) { + if (!_globals[kRegisterOpen]) + _vm->_dialogs->show(51212); + else if (_game._objects.isInRoom(OBJ_PADLOCK_KEY)) + _vm->_dialogs->show(51214); + else + _vm->_dialogs->show(51213); + } else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes5.h b/engines/mads/nebular/nebular_scenes5.h index f46e8eeb09..0d1614fccc 100644 --- a/engines/mads/nebular/nebular_scenes5.h +++ b/engines/mads/nebular/nebular_scenes5.h @@ -198,6 +198,22 @@ public: virtual void postActions() {}; }; +class Scene512: public Scene5xx{ +private: + int _fishingRodHotspotId; + int _keyHotspotId; + +public: + Scene512(MADSEngine *vm) : Scene5xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step() {}; + virtual void preActions() {}; + virtual void actions(); + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From be6cedef02abed65fc7e2643d3dc989afee0f488 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 10 May 2014 10:46:48 +0200 Subject: MADS: Implement scene 513 --- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes5.cpp | 223 +++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes5.h | 12 ++ 3 files changed, 236 insertions(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 17debd5bb1..7d91d7f2b4 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -217,7 +217,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 512: // inside pleasure dome return new Scene512(vm); case 513: // outside mall - return new DummyScene(vm); // TODO + return new Scene513(vm); case 515: // overview return new DummyScene(vm); // TODO case 551: // outside teleporter (with skeleton) diff --git a/engines/mads/nebular/nebular_scenes5.cpp b/engines/mads/nebular/nebular_scenes5.cpp index 9d3bbffa20..cd96e82cf5 100644 --- a/engines/mads/nebular/nebular_scenes5.cpp +++ b/engines/mads/nebular/nebular_scenes5.cpp @@ -2335,5 +2335,228 @@ void Scene512::actions() { /*------------------------------------------------------------------------*/ +void Scene513::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(0x367); + _scene->addActiveVocab(0xD); +} + +void Scene513::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('c', 0)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 0)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites("*RXCD_9"); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites("*RXMRC_9"); + + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 2); + + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); + + if ((_scene->_priorSceneId == 751) || (_scene->_priorSceneId == 701)) { + _game._player._playerPos = Common::Point(296, 147); + _game._player._facing = FACING_WEST; + _game._player._stepEnabled = false; + _scene->_sequences.addTimer(15, 80); + } else if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(63, 149); + _game._player._facing = FACING_NORTHEAST; + _game._player._visible = false; + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); + _scene->loadAnimation(formAnimName('R', 1), 70); + } + + sceneEntrySound(); + + if (_scene->_roomChanged) + _game._objects.addToInventory(OBJ_SECURITY_CARD); + + _game.loadQuoteSet(0x278, 0); +} + +void Scene513::step() { + switch (_game._trigger) { + case 80: + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 7, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 2); + _vm->_sound->command(24); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 81); + break; + + case 81: + _game._player.walk(Common::Point(265, 152), FACING_WEST); + _scene->_sequences.addTimer(120, 82); + break; + + case 82: + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 7, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 2); + _vm->_sound->command(25); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 83); + break; + + case 83: + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 2); + _game._player._stepEnabled = true; + break; + + default: + break; + } + + switch (_game._trigger) { + case 70: + _game._player._visible = true; + _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; + _scene->_sequences.addTimer(6, 71); + break; + + case 71: + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 72); + break; + + case 72: + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); + _game._player._stepEnabled = true; + break; + + default: + break; + } +} + +void Scene513::actions() { + if (_action.isAction(0x36A, 0x324)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 1); + break; + + case 1: { + int syncIdx = _globals._sequenceIndexes[1]; + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[1], syncIdx); + _scene->_sequences.addTimer(6, 2); + } + break; + + case 2: + _game._player._visible = false; + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 10, 1, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 3); + break; + + case 3: { + int syncIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -2); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], syncIdx); + _scene->_nextSceneId = 504; + } + break; + + default: + break; + } + } else if (_action.isAction(VERB_PUT, 0xB3, 0x251) || _action.isAction(VERB_PUT, 0x305, 0x251)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 7, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 1, 2); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 1); + break; + + case 1: + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[4]); + _game._player._visible = true; + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 7, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 2); + _vm->_sound->command(24); + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x278)); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + + case 2: + _game._player.walk(Common::Point(296, 147), FACING_WEST); + _scene->_sequences.addTimer(120, 3); + break; + + case 3: + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 7, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 2); + _vm->_sound->command(25); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 4); + break; + + case 4: + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 2); + _game._player._stepEnabled = true; + if (_globals[kCityFlooded]) + _scene->_nextSceneId = 701; + else + _scene->_nextSceneId = 751; + + break; + + default: + break; + } + } else if ((_action._lookFlag) || _action.isAction(VERB_LOOK, 0x31E)) + _vm->_dialogs->show(51318); + else if (_action.isAction(VERB_LOOK, 0x317)) + _vm->_dialogs->show(51310); + else if (_action.isAction(VERB_LOOK, 0x367)) + _vm->_dialogs->show(51311); + else if (_action.isAction(VERB_LOOK, 0x251)) + _vm->_dialogs->show(51312); + else if (_action.isAction(VERB_LOOK, 0x355)) + _vm->_dialogs->show(51313); + else if (_action.isAction(VERB_LOOK, 0x358)) + _vm->_dialogs->show(51314); + else if (_action.isAction(VERB_LOOK, 0x323)) + _vm->_dialogs->show(51315); + else if (_action.isAction(VERB_LOOK, 0x244)) + _vm->_dialogs->show(51316); + else if (_action.isAction(VERB_LOOK, 0x360) || _action.isAction(0x1AD, 0x360)) + _vm->_dialogs->show(51317); + else if (_action.isAction(VERB_OPEN, 0x367) || _action.isAction(VERB_OPEN, 0x317)) + _vm->_dialogs->show(51319); + else if (_action.isAction(VERB_LOOK, 0x324)) + _vm->_dialogs->show(51321); + else if (_action.isAction(VERB_LOOK, 0x357)) + _vm->_dialogs->show(51322); + else if (_action.isAction(VERB_PUT, 0x131, 0x251)) + _vm->_dialogs->show(51320); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes5.h b/engines/mads/nebular/nebular_scenes5.h index 0d1614fccc..3bd8a20df8 100644 --- a/engines/mads/nebular/nebular_scenes5.h +++ b/engines/mads/nebular/nebular_scenes5.h @@ -214,6 +214,18 @@ public: virtual void postActions() {}; }; +class Scene513: public Scene5xx{ +public: + Scene513(MADSEngine *vm) : Scene5xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions(); + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 9b79267bd7adc1eeaec105d378b146a1402c607f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 10 May 2014 10:53:23 +0200 Subject: MADS: Implement scene 515 --- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes5.cpp | 22 ++++++++++++++++++++++ engines/mads/nebular/nebular_scenes5.h | 12 ++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 7d91d7f2b4..dd3410750f 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -219,7 +219,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 513: // outside mall return new Scene513(vm); case 515: // overview - return new DummyScene(vm); // TODO + return new Scene515(vm); case 551: // outside teleporter (with skeleton) return new DummyScene(vm); // TODO diff --git a/engines/mads/nebular/nebular_scenes5.cpp b/engines/mads/nebular/nebular_scenes5.cpp index cd96e82cf5..72f94f3ddd 100644 --- a/engines/mads/nebular/nebular_scenes5.cpp +++ b/engines/mads/nebular/nebular_scenes5.cpp @@ -2558,5 +2558,27 @@ void Scene513::actions() { /*------------------------------------------------------------------------*/ +void Scene515::setup() { + _game._player._spritesPrefix = ""; + setAAName(); +} + +void Scene515::enter() { + _game._player._visible = false; + _game._player._stepEnabled = false; + _scene->_sequences.addTimer(30, 70); + + sceneEntrySound(); +} + +void Scene515::step() { + if (_game._trigger == 70) + _scene->loadAnimation(formAnimName('A', -1), 71); + else if (_game._trigger == 71) + _scene->_nextSceneId = 508; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes5.h b/engines/mads/nebular/nebular_scenes5.h index 3bd8a20df8..0fbc62fa71 100644 --- a/engines/mads/nebular/nebular_scenes5.h +++ b/engines/mads/nebular/nebular_scenes5.h @@ -226,6 +226,18 @@ public: virtual void postActions() {}; }; +class Scene515: public Scene5xx{ +public: + Scene515(MADSEngine *vm) : Scene5xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions() {}; + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 600a715661333565e8546dfcafabf5e1da95d340 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 10 May 2014 13:22:45 +0300 Subject: MADS: Split verbs from nouns --- engines/mads/dragonsphere/dragonsphere_scenes.h | 2 +- engines/mads/nebular/game_nebular.cpp | 30 ++++++++--------- engines/mads/nebular/nebular_scenes.h | 45 +++++++++++++++---------- engines/mads/nebular/nebular_scenes1.cpp | 2 +- engines/mads/nebular/nebular_scenes2.cpp | 21 ++++-------- engines/mads/nebular/nebular_scenes7.cpp | 7 ---- engines/mads/phantom/phantom_scenes.h | 2 +- engines/mads/scene.cpp | 2 +- 8 files changed, 53 insertions(+), 58 deletions(-) diff --git a/engines/mads/dragonsphere/dragonsphere_scenes.h b/engines/mads/dragonsphere/dragonsphere_scenes.h index 8ce1492208..d6af608b19 100644 --- a/engines/mads/dragonsphere/dragonsphere_scenes.h +++ b/engines/mads/dragonsphere/dragonsphere_scenes.h @@ -35,7 +35,7 @@ namespace MADS { namespace Dragonsphere { enum Noun { - NOUN_LOOK_AT = 0x0D1 + VERB_LOOK_AT = 0x0D1 // TODO }; diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index 86435c655f..600c153088 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -284,17 +284,17 @@ void GameNebular::doObjectAction() { Dialogs &dialogs = *_vm->_dialogs; int id; - if (action.isAction(NOUN_SMELL) && scene._currentSceneId > 103 && scene._currentSceneId < 111) { + if (action.isAction(VERB_SMELL) && scene._currentSceneId > 103 && scene._currentSceneId < 111) { dialogs.show(440); - } else if (action.isAction(NOUN_EAT) && scene._currentSceneId > 103 && scene._currentSceneId < 111) { + } else if (action.isAction(VERB_EAT) && scene._currentSceneId > 103 && scene._currentSceneId < 111) { dialogs.show(441); - } else if (action.isAction(NOUN_SMELL, NOUN_BURGER)) { + } else if (action.isAction(VERB_SMELL, NOUN_BURGER)) { dialogs.show(442); - } else if (action.isAction(NOUN_EAT, NOUN_BURGER)) { + } else if (action.isAction(VERB_EAT, NOUN_BURGER)) { dialogs.show(443); - } else if (action.isAction(NOUN_SMELL, NOUN_STUFFED_FISH)) { + } else if (action.isAction(VERB_SMELL, NOUN_STUFFED_FISH)) { dialogs.show(444); - } else if (action.isAction(NOUN_EAT, NOUN_STUFFED_FISH)) { + } else if (action.isAction(VERB_EAT, NOUN_STUFFED_FISH)) { dialogs.show(445); } else if (action.isAction(401, 289)) { dialogs.show(scene._currentSceneId > 103 && scene._currentSceneId < 111 ? 446 : 447); @@ -304,7 +304,7 @@ void GameNebular::doObjectAction() { dialogs.show(449); } else if (action.isAction(203, 276)) { dialogs.show(450); - } else if (action.isAction(NOUN_EAT, 378)) { + } else if (action.isAction(VERB_EAT, 378)) { _objects.setRoom(OBJ_TWINKIFRUIT, PLAYER_INVENTORY); dialogs.show(451); } else if (action.isAction(153, 378)) { @@ -342,13 +342,13 @@ void GameNebular::doObjectAction() { dialogs.show(466); } else if (action.isAction(530, 288)) { dialogs.show(467); - } else if (action.isAction(NOUN_EAT, 74)) { + } else if (action.isAction(VERB_EAT, 74)) { dialogs.show(469); } else if (action.isAction(50, 381)) { dialogs.show(471); } else if (action.isAction(307, 950)) { dialogs.show(472); - } else if (action.isAction(NOUN_READ, NOUN_LOG)) { + } else if (action.isAction(VERB_READ, NOUN_LOG)) { dialogs.show(473); } else if (action.isAction(1189, 43)) { dialogs.show(474); @@ -371,12 +371,12 @@ void GameNebular::doObjectAction() { dialogs.show(434); } else if (action.isAction(1196)) { dialogs.show(479); - } else if ((action.isAction(287) || action.isAction(NOUN_LOOK_AT) || action.isAction(VERB_LOOK)) && + } else if ((action.isAction(287) || action.isAction(VERB_LOOK_AT) || action.isAction(VERB_LOOK)) && action.isAction(936) && _objects.isInInventory(OBJ_NOTE)) { _objects.setRoom(OBJ_NOTE, PLAYER_INVENTORY); _objects.addToInventory(OBJ_COMBINATION); dialogs.showItem(OBJ_COMBINATION, 851); - } else if ((action.isAction(VERB_LOOK) || action.isAction(NOUN_READ)) && + } else if ((action.isAction(VERB_LOOK) || action.isAction(VERB_READ)) && ((id = _objects.getIdFromDesc(action._activeAction._objectNameId)) > 0 || (action._activeAction._indirectObjectId > 0 && (id = _objects.getIdFromDesc(action._activeAction._indirectObjectId))))) { @@ -574,13 +574,13 @@ void GameNebular::unhandledAction() { _vm->_dialogs->show(0x2A); else if (action.isAction(0x6C)) _vm->_dialogs->show(0x1B3); - else if ((action.isAction(NOUN_EAT, NOUN_DEAD_FISH) || action.isAction(NOUN_EAT, NOUN_STUFFED_FISH)) && _vm->_game->_objects.isInInventory(_vm->_game->_objects.getIdFromDesc(action._activeAction._objectNameId))) + else if ((action.isAction(VERB_EAT, NOUN_DEAD_FISH) || action.isAction(VERB_EAT, NOUN_STUFFED_FISH)) && _vm->_game->_objects.isInInventory(_vm->_game->_objects.getIdFromDesc(action._activeAction._objectNameId))) _vm->_dialogs->show(0xC); - else if ((action.isAction(NOUN_SMELL, NOUN_DEAD_FISH) || action.isAction(NOUN_SMELL, NOUN_STUFFED_FISH)) && _vm->_game->_objects.isInInventory(_vm->_game->_objects.getIdFromDesc(action._activeAction._objectNameId))) + else if ((action.isAction(VERB_SMELL, NOUN_DEAD_FISH) || action.isAction(VERB_SMELL, NOUN_STUFFED_FISH)) && _vm->_game->_objects.isInInventory(_vm->_game->_objects.getIdFromDesc(action._activeAction._objectNameId))) _vm->_dialogs->show(0xD); - else if (action.isAction(NOUN_EAT, NOUN_CHICKEN) && _vm->_game->_objects.isInInventory(OBJ_CHICKEN)) + else if (action.isAction(VERB_EAT, NOUN_CHICKEN) && _vm->_game->_objects.isInInventory(OBJ_CHICKEN)) _vm->_dialogs->show(0x390); - else if ((action.isAction(NOUN_SHOOT) || action.isAction(NOUN_HOSE_DOWN)) && action.isAction(NOUN_BLOWGUN)) { + else if ((action.isAction(VERB_SHOOT) || action.isAction(VERB_HOSE_DOWN)) && action.isAction(NOUN_BLOWGUN)) { if ((_scene._currentSceneId >= 104) && (_scene._currentSceneId <= 111)) _vm->_dialogs->show(0x26); else if (action.isAction(0x10D)) diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index 2f9dff706d..3534613431 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -38,6 +38,32 @@ enum { SEX_MALE = 0, SEX_UNKNOWN = 1, SEX_FEMALE = 2 }; +enum Verb { + VERB_CLIMB_DOWN = 0x04E, + VERB_EAT = 0x075, + VERB_EXAMINE = 0x07D, + VERB_HOSE_DOWN = 0x0A6, + VERB_IGNITE = 0x0B4, + VERB_INFLATE = 0x0B5, + VERB_INSERT = 0x0B6, + VERB_INSPECT = 0x0B7, + VERB_HURL = 0x0A9, + VERB_LOOK_AT = 0x0D1, + VERB_LOOK_IN = 0x0D2, + VERB_LOOK_THROUGH = 0x0D3, + VERB_PEER_THROUGH = 0x103, + VERB_READ = 0x11F, + VERB_SHOOT = 0x13A, + VERB_SIT_IN = 0x13F, + VERB_SMELL = 0x147, + VERB_WALK_THROUGH = 0x18B, + VERB_WALK_TOWARDS = 0x18C, + VERB_WALK_DOWN = 0x1AD, + VERB_CLIMB_INTO = 0x2F7, + VERB_STEP_INTO = 0x2F9, + VERB_WALK_ALONG = 0x312, +}; + enum Noun { NOUN_BIG_LEAVES = 0x23, NOUN_BLOWGUN = 0x29, @@ -51,50 +77,34 @@ enum Noun { NOUN_CHICKEN_BOMB = 0x4A, NOUN_DEAD_FISH = 0x65, NOUN_DOOR = 0x6E, - NOUN_EAT = 0x75, - NOUN_EXAMINE = 0x7D, + NOUN_FISHING_LINE = 0x87, NOUN_FRONT_WINDOW = 0x8E, NOUN_FUZZY_DICE = 0x91, - NOUN_HOSE_DOWN = 0x0A6, NOUN_HOTPANTS = 0x0A7, NOUN_HULL = 0x0A8, - NOUN_HURL = 0x0A9, NOUN_ID_CARD = 0x0B3, - NOUN_IGNITE = 0x0B4, - NOUN_INFLATE = 0x0B5, - NOUN_INSERT = 0x0B6, - NOUN_INSPECT = 0x0B7, NOUN_JUNGLE = 0x0B8, NOUN_LADDER = 0x0C7, NOUN_LIFE_SUPPORT_SECTION = 0x0CC, NOUN_LOG = 0x0D0, - NOUN_LOOK_AT = 0x0D1, - NOUN_LOOK_IN = 0x0D2, - NOUN_LOOK_THROUGH = 0x0D3, NOUN_MONKEY = 0x0E3, NOUN_OUTER_HULL = 0x0F8, NOUN_OUTSIDE = 0x0F9, - NOUN_PEER_THROUGH = 0x103, NOUN_PIRANHA = 0x10D, NOUN_PLANT_STALK = 0x10F, - NOUN_READ = 0x11F, NOUN_REFRIDGERATOR = 0x122, NOUN_ROBO_KITCHEN = 0x127, NOUN_ROCK = 0x128, NOUN_SHIELD_ACCESS_PANEL = 0x135, NOUN_SHIELD_MODULATOR = 0x137, - NOUN_SHOOT = 0x13A, - NOUN_SIT_IN = 0x13F, NOUN_SKULL = 0x140, NOUN_TELEPORTER = 0x16C, NOUN_BROKEN_LADDER = 0x1C9, - NOUN_SMELL = 0x147, NOUN_STUFFED_FISH = 0x157, NOUN_15F = 0x15F, NOUN_TIMEBOMB = 0x171, NOUN_TWINKIFRUIT = 0x17A, NOUN_VIEW_SCREEN = 0x180, - NOUN_WALK_THROUGH = 0x18B, NOUN_DEEP_PIT = 0x19E, NOUN_HUGE_LEGS = 0x1A8, NOUN_LEAF_COVERED_PIT = 0x1A9, @@ -105,6 +115,7 @@ enum Noun { NOUN_ALCOHOL = 0x310, NOUN_SUBMERGED_CITY = 0x313, NOUN_LASER_BEAM = 0x343, + NOUN_BOAT = 0x345, NOUN_CEMENT_BLOCK = 0x38E, NOUN_CITY = 0x38F, NOUN_DOLLOP = 0x3AC, diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index c202fe1f80..f317b2832d 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -1346,7 +1346,7 @@ void Scene103::step() { void Scene103::actions() { if (_action._savedFields._lookFlag) { _vm->_dialogs->show(10322); - } else if (_action.isAction(NOUN_WALK_THROUGH, NOUN_DOOR)) { + } else if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOOR)) { switch (_vm->_game->_trigger) { case 0: _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 6, 1); diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 2bb24be18b..e4c09fa72b 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -30,15 +30,6 @@ namespace MADS { namespace Nebular { -// Scene 2xx verbs -enum { - VERB_WALK_THROUGH = 0x18B, - VERB_WALK_TOWARDS = 0x18C, - VERB_WALK_DOWN = 0x1AD, - - VERB_CLIMB_DOWN = 0x4E -}; - void Scene2xx::setAAName() { int idx = (_scene->_nextSceneId == 216) ? 4 : 2; _game._aaName = Resources::formatAAName(idx); @@ -3086,14 +3077,14 @@ void Scene209::step() { case 234: _scene->_sequences.remove(_globals._sequenceIndexes[2]); _scene->_kernelMessages.reset(); - if (_action.isAction(NOUN_HOSE_DOWN, NOUN_BLOWGUN, NOUN_MONKEY)) { + if (_action.isAction(VERB_HOSE_DOWN, NOUN_BLOWGUN, NOUN_MONKEY)) { _globals._sequenceIndexes[2] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[2], false, 7, 16, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 11, 12); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(116, 131)); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_SPRITE, 12, 239); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 235); - } else if (_action.isAction(NOUN_SHOOT, NOUN_BLOWGUN, NOUN_MONKEY)) { + } else if (_action.isAction(VERB_SHOOT, NOUN_BLOWGUN, NOUN_MONKEY)) { _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 11, 12); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(116, 131)); @@ -3169,7 +3160,7 @@ void Scene209::preActions() { _game._player._walkOffScreenSceneId = 208; if (_globals[kMonkeyStatus] == 1) { - if ((_action.isAction(NOUN_SHOOT) || _action.isAction(NOUN_HOSE_DOWN)) && _action.isTarget(NOUN_MONKEY) + if ((_action.isAction(VERB_SHOOT) || _action.isAction(VERB_HOSE_DOWN)) && _action.isTarget(NOUN_MONKEY) && _action.isObject(NOUN_BLOWGUN) && _game._objects.isInInventory(OBJ_BLOWGUN) && _game._objects.isInInventory(OBJ_POISON_DARTS)) { _game._player._prepareWalkPos = Common::Point(111, 129); _game._player._prepareWalkFacing = FACING_NORTHEAST; @@ -3306,9 +3297,9 @@ void Scene209::actions() { } if (_globals[kMonkeyStatus] == 1) { - if ((_action.isAction(NOUN_SHOOT) || _action.isAction(NOUN_HOSE_DOWN)) && _action.isAction(NOUN_MONKEY) + if ((_action.isAction(VERB_SHOOT) || _action.isAction(VERB_HOSE_DOWN)) && _action.isAction(NOUN_MONKEY) && _action.isAction(NOUN_BLOWGUN) && _game._objects.isInInventory(OBJ_BLOWGUN) && _game._objects.isInInventory(OBJ_POISON_DARTS)) { - if (_action.isAction(NOUN_SHOOT, NOUN_BLOWGUN, NOUN_MONKEY) && !_startShootingInTimerFl) { + if (_action.isAction(VERB_SHOOT, NOUN_BLOWGUN, NOUN_MONKEY) && !_startShootingInTimerFl) { _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _scene->_sequences.addTimer(1, 231); _startShootingInTimerFl = true; @@ -3318,7 +3309,7 @@ void Scene209::actions() { return; } - if (_action.isAction(NOUN_HOSE_DOWN, NOUN_BLOWGUN, NOUN_MONKEY) && !_startShootingInTimerFl) { + if (_action.isAction(VERB_HOSE_DOWN, NOUN_BLOWGUN, NOUN_MONKEY) && !_startShootingInTimerFl) { _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _scene->_sequences.addTimer(1, 228); _game._player._stepEnabled = false; diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index 476b13223f..3e6847135c 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -30,13 +30,6 @@ namespace MADS { namespace Nebular { -// Scene 7xx verbs -enum { - VERB_LOOK_AT = 0xD1, - VERB_WALK_ALONG = 0x312, - VERB_STEP_INTO = 0x2F9 -}; - void Scene7xx::setAAName() { _game._aaName = Resources::formatAAName(5); } diff --git a/engines/mads/phantom/phantom_scenes.h b/engines/mads/phantom/phantom_scenes.h index 986934fe62..d93ccfccc5 100644 --- a/engines/mads/phantom/phantom_scenes.h +++ b/engines/mads/phantom/phantom_scenes.h @@ -35,7 +35,7 @@ namespace MADS { namespace Phantom { enum Noun { - NOUN_LOOK_AT = 0x0D1 + VERB_LOOK_AT = 0x0D1 // TODO }; diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 32956e6484..601acc5ec6 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -369,7 +369,7 @@ void Scene::doFrame() { if (_action._selectedAction && player._stepEnabled && !player._needToWalk && !_vm->_game->_trigger && !player._trigger) { _action.startAction(); - if (_action._activeAction._verbId == Nebular::NOUN_LOOK_AT) { + if (_action._activeAction._verbId == Nebular::VERB_LOOK_AT) { _action._activeAction._verbId = VERB_LOOK; _action._savedFields._command = false; } -- cgit v1.2.3 From 5ae5a1aa58987230a75166fdd71ad8cb608ff6b3 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 10 May 2014 13:25:11 +0300 Subject: MADS: Start implementing scene 701 --- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes7.cpp | 87 ++++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes7.h | 10 ++++ 3 files changed, 98 insertions(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index dd3410750f..a77c123793 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -251,7 +251,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { // Scene group #7 (submerged men's city / upper floor) case 701: // outside elevator (after city is submerged) - return new DummyScene(vm); // TODO + return new Scene701(vm); case 702: // outside teleporter (after city is submerged) return new Scene702(vm); case 703: // water diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index 3e6847135c..cb9880e1aa 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -89,6 +89,93 @@ void Scene7xx::sceneEntrySound() { /*------------------------------------------------------------------------*/ +void Scene701::setup() { + setPlayerSpritesPrefix(); + setAAName(); + + _scene->addActiveVocab(NOUN_BOAT); + _scene->addActiveVocab(VERB_CLIMB_INTO); + _scene->addActiveVocab(NOUN_FISHING_LINE); + _scene->addActiveVocab(VERB_WALKTO); +} + +void Scene701::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 0)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('b', 5)); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('b', 0)); + //_globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('b', 1)); // FIXME: Invalid resource? + _globals._spriteIndexes[5] = _scene->_sprites.addSprites("*RM202A1"); + _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('b', 8)); + + if (_scene->_roomChanged) { + _game._objects.addToInventory(OBJ_BINOCULARS); + _game._objects.addToInventory(OBJ_TWINKIFRUIT); + _game._objects.addToInventory(OBJ_BOMB); + _game._objects.addToInventory(OBJ_CHICKEN); + _game._objects.addToInventory(OBJ_BONES); + + _globals[kCityFlooded] = true; + _globals[kLineStatus] = LINE_TIED; + _globals[kBoatRaised] = false; + } + + if (_globals[kBoatStatus] == BOAT_UNFLOODED) { + if (_globals[kBoatRaised]) { + _globals[kBoatStatus] = BOAT_GONE; + } else { + if (_globals[kLineStatus] == LINE_TIED) { + _globals[kBoatStatus] = BOAT_TIED_FLOATING; + } else { + if (_game._difficulty == DIFFICULTY_HARD) { + _globals[kBoatStatus] = BOAT_ADRIFT; + } else { + _globals[kBoatStatus] = BOAT_TIED; + } + } + } + } + + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); + + int boatStatus = (_scene->_priorSceneId == 703) ? BOAT_GONE : _globals[kBoatStatus]; + + switch (boatStatus) { + case BOAT_TIED_FLOATING: + _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 20, 0, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 10); + break; + case BOAT_ADRIFT: + _globals._sequenceIndexes[6] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[6], false, 20, 0, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 10); + break; + case BOAT_TIED: + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 9); + break; + case BOAT_GONE: + _scene->_hotspots.activate(NOUN_BOAT, false); + break; + default: + break; + } + + // TODO: Line status + + // TODO +} + +void Scene701::preActions() { + // TODO +} + +void Scene701::actions() { + // TODO +} + +/*------------------------------------------------------------------------*/ + void Scene702::setup() { setPlayerSpritesPrefix(); setAAName(); diff --git a/engines/mads/nebular/nebular_scenes7.h b/engines/mads/nebular/nebular_scenes7.h index ae5b822474..cc8220624d 100644 --- a/engines/mads/nebular/nebular_scenes7.h +++ b/engines/mads/nebular/nebular_scenes7.h @@ -50,6 +50,16 @@ public: Scene7xx(MADSEngine *vm) : NebularScene(vm) {} }; +class Scene701: public Scene7xx { +public: + Scene701(MADSEngine *vm) : Scene7xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void preActions(); + virtual void actions(); +}; + class Scene702: public Scene7xx { public: Scene702(MADSEngine *vm) : Scene7xx(vm) {} -- cgit v1.2.3 From 4f4106eff4127ee1dd5eb06e514603fe659af143 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 10 May 2014 15:17:38 +0200 Subject: MADS: Implement scene 511 --- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes5.cpp | 296 +++++++++++++++++++++++-------- engines/mads/nebular/nebular_scenes5.h | 11 ++ 3 files changed, 231 insertions(+), 78 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index a77c123793..19ccc627cc 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -221,7 +221,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 515: // overview return new Scene515(vm); case 551: // outside teleporter (with skeleton) - return new DummyScene(vm); // TODO + return new Scene551(vm); // Scene group #6 (men's city, upper floor) case 601: // outside Bruce's house diff --git a/engines/mads/nebular/nebular_scenes5.cpp b/engines/mads/nebular/nebular_scenes5.cpp index 72f94f3ddd..11af55b08f 100644 --- a/engines/mads/nebular/nebular_scenes5.cpp +++ b/engines/mads/nebular/nebular_scenes5.cpp @@ -1116,7 +1116,7 @@ void Scene506::enter() { _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -1); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 5); _firstDoorFl = true; - _actionFl = false; + _actionFl = false; if (_scene->_priorSceneId == 508) { _game._player._playerPos = Common::Point(16, 111); @@ -1131,7 +1131,7 @@ void Scene506::enter() { } else if (_scene->_priorSceneId != -2) { _game._player._playerPos = Common::Point(138, 116); _game._player._facing = FACING_NORTHEAST; - _game._player._visible = false; + _game._player._visible = false; _game._player._stepEnabled = false; _scene->_sequences.remove(_globals._sequenceIndexes[3]); _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -2); @@ -1751,7 +1751,7 @@ void Scene511::enter() { _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 1, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 5); - _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 1); + _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 4); _globals._sequenceIndexes[6] = _scene->_sequences.startCycle(_globals._spriteIndexes[6], false, 1); @@ -1769,7 +1769,7 @@ void Scene511::enter() { frame = -2; if (_globals[kLineStatus] == 2 || _globals[kLineStatus] == 3) { - _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('b', 4)); + _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('b', 4)); _globals._sequenceIndexes[7] = _scene->_sequences.startCycle(_globals._spriteIndexes[7], false, frame); int idx = _scene->_dynamicHotspots.add(0x87, VERB_WALKTO, _globals._sequenceIndexes[7], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(26, 153), FACING_NORTHEAST); @@ -1778,8 +1778,8 @@ void Scene511::enter() { _scene->changeVariant(2); } - _lineFrame = -1; - _lineMoving = false; + _lineFrame = -1; + _lineMoving = false; _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -2); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); @@ -1790,7 +1790,7 @@ void Scene511::enter() { } else if (_scene->_priorSceneId != -2) { _game._player._playerPos = Common::Point(55, 152); _game._player._facing = FACING_NORTHWEST; - _game._player._visible = false; + _game._player._visible = false; _game._player._stepEnabled = false; _scene->_sequences.remove(_globals._sequenceIndexes[1]); _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -1); @@ -1798,8 +1798,8 @@ void Scene511::enter() { _scene->loadAnimation(formAnimName('R', 1), 70); } else if (_handingLine) { _game._player._visible = false; - _lineAnimationMode = 1; - _lineAnimationPosition = 1; + _lineAnimationMode = 1; + _lineAnimationPosition = 1; _scene->loadAnimation(formAnimName('R', -1)); _lineFrame = 2; } @@ -1807,22 +1807,22 @@ void Scene511::enter() { } void Scene511::step() { - if ((_lineAnimationMode == 1) && _scene->_activeAnimation) { + if ((_lineAnimationMode == 1) && _scene->_activeAnimation) { if (_lineFrame != _scene->_activeAnimation->getCurrentFrame()) { - _lineFrame = _scene->_activeAnimation->getCurrentFrame(); - int resetFrame = -1; + _lineFrame = _scene->_activeAnimation->getCurrentFrame(); + int resetFrame = -1; - if ((_lineAnimationPosition == 2) && (_lineFrame == 14)) - _lineMoving = false; + if ((_lineAnimationPosition == 2) && (_lineFrame == 14)) + _lineMoving = false; if (_lineAnimationPosition == 1) { - if (_lineFrame == 3) { - _lineMoving = false; - resetFrame = 2; + if (_lineFrame == 3) { + _lineMoving = false; + resetFrame = 2; } if (_handingLine) - resetFrame = 2; + resetFrame = 2; } if ((resetFrame >= 0) && (resetFrame != _scene->_activeAnimation->getCurrentFrame())) { @@ -1834,7 +1834,7 @@ void Scene511::step() { switch (_game._trigger) { case 70: - _game._player._visible = true; + _game._player._visible = true; _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; _scene->_sequences.addTimer(6, 71); break; @@ -1869,13 +1869,13 @@ void Scene511::preActions() { _game._player._readyToWalk = false; _game._player._stepEnabled = false; _scene->freeAnimation (); - _lineAnimationMode = 2; + _lineAnimationMode = 2; _scene->loadAnimation(formAnimName('R',2), 1); } else if (_game._trigger == 1) { - _game._player._visible = true; + _game._player._visible = true; _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; _game._objects.setRoom(OBJ_FISHING_LINE, 1); - _handingLine = false; + _handingLine = false; _game._player._stepEnabled = true; _game._player._readyToWalk = true; } @@ -1905,7 +1905,7 @@ void Scene511::actions() { break; case 2: - _game._player._visible = false; + _game._player._visible = false; _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 8, 1, 0, 0); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 3); @@ -1929,10 +1929,10 @@ void Scene511::actions() { if (_globals[kLineStatus] != 3) { if (_game._trigger == 0) { _game._player._stepEnabled = false; - _game._player._visible = false; - _lineAnimationMode = 1; - _lineAnimationPosition = 1; - _lineMoving = true; + _game._player._visible = false; + _lineAnimationMode = 1; + _lineAnimationPosition = 1; + _lineMoving = true; _scene->loadAnimation(formAnimName('R', -1), 0); _scene->_sequences.addTimer(1, 1); } else if (_game._trigger == 1) { @@ -1940,8 +1940,8 @@ void Scene511::actions() { _scene->_sequences.addTimer(1, 1); } else { _game._objects.addToInventory(OBJ_FISHING_LINE); - _lineMoving = true; - _handingLine = true; + _lineMoving = true; + _handingLine = true; _game._player._stepEnabled = true; } } @@ -1962,23 +1962,23 @@ void Scene511::actions() { if (_game._trigger == 0) { _game._player._stepEnabled = false; _scene->_sequences.remove(_globals._sequenceIndexes[7]); - _lineMoving = true; - _lineAnimationPosition = 2; + _lineMoving = true; + _lineAnimationPosition = 2; _scene->_sequences.addTimer(1, 1); } else if (_game._trigger == 1) { if (_lineMoving) _scene->_sequences.addTimer(1, 1); else { - _game._player._visible = true; + _game._player._visible = true; _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; _globals._sequenceIndexes[7] = _scene->_sequences.startCycle(_globals._spriteIndexes[7], false, -2); _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 4); int idx = _scene->_dynamicHotspots.add(0x87, VERB_WALKTO, _globals._sequenceIndexes[7], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(26, 153), FACING_NORTHEAST); _game._objects.removeFromInventory(OBJ_FISHING_LINE, 1); - _handingLine = false; - _lineMoving = true; - _globals[kLineStatus] = 3; + _handingLine = false; + _lineMoving = true; + _globals[kLineStatus] = 3; _game._player._stepEnabled = true; } } @@ -2007,7 +2007,7 @@ void Scene511::actions() { _vm->_dialogs->show(51118); else if (_action.isAction(0x17B, 0xFF, 0x37C) || _action.isAction(0x17B, 0x6F, 0x37C)) _vm->_dialogs->show(51119); - else if ( (_action.isAction(VERB_PUT) || _action.isAction(VERB_THROW)) + else if ( (_action.isAction(VERB_PUT) || _action.isAction(VERB_THROW)) && (_action.isAction(0x171) || _action.isAction(0x2A) || _action.isAction(0x2B)) && _action.isAction(0x37C)) _vm->_dialogs->show(51120); @@ -2109,9 +2109,9 @@ void Scene512::actions() { if (_game._trigger || !_game._objects.isInInventory(OBJ_FISHING_ROD)) { switch (_game._trigger) { case 0: - _game._player._stepEnabled = false; - _game._player._visible = false; - _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[2]); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_SPRITE, 5, 1); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 2); @@ -2127,7 +2127,7 @@ void Scene512::actions() { case 2: _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[2]); - _game._player._visible = true; + _game._player._visible = true; _game._player._stepEnabled = true; break; @@ -2140,14 +2140,14 @@ void Scene512::actions() { switch (_game._trigger) { case 0: _vm->_dialogs->show(51236); - _game._player._stepEnabled = false; + _game._player._stepEnabled = false; _game._player._facing = FACING_NORTH; _scene->_sequences.addTimer(15, 1); break; case 1: - _game._player._visible = false; - _globals._sequenceIndexes[8] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[8], false, 9, 1, 0, 0); + _game._player._visible = false; + _globals._sequenceIndexes[8] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[8], false, 9, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[8], 1, 3); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[8]); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_EXPIRE, 0, 2); @@ -2155,18 +2155,18 @@ void Scene512::actions() { case 2: _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[8]); - _game._player._visible = true; + _game._player._visible = true; _scene->_sequences.addTimer(30, 3); break; case 3: _game._player._facing = FACING_NORTHEAST; if (!_game._objects.isInRoom(OBJ_PADLOCK_KEY) || (_game._difficulty == DIFFICULTY_EASY)) { - _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 12, 1, 0, 0); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 12, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 3); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 4); } else { - _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 12, 1, 0, 0); + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 12, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 3); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 5); } @@ -2174,20 +2174,20 @@ void Scene512::actions() { break; case 4: - _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -2); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -2); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 3); _scene->_sequences.addTimer(60, 6); break; case 5: - _globals._sequenceIndexes[5] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[5], false, 14, 0, 0, 0); + _globals._sequenceIndexes[5] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[5], false, 14, 0, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 3); _scene->_hotspots.activate(0xFF, true); _scene->_sequences.addTimer(60, 6); break; case 6: - _globals[kRegisterOpen] = true; + _globals[kRegisterOpen] = true; _game._player._stepEnabled = true; break; @@ -2199,9 +2199,9 @@ void Scene512::actions() { } else if (_action.isAction(VERB_CLOSE, 0x377) && _globals[kRegisterOpen]) { switch (_game._trigger) { case 0: - _game._player._stepEnabled = false; - _game._player._visible = false; - _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 10, 1, 0, 0); + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 10, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 2); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[2]); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 1); @@ -2209,15 +2209,15 @@ void Scene512::actions() { case 1: _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[2]); - _game._player._visible = true; + _game._player._visible = true; if (!_game._objects.isInRoom(OBJ_PADLOCK_KEY) || _game._difficulty == DIFFICULTY_EASY) { _scene->_sequences.remove(_globals._sequenceIndexes[3]); - _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 12, 1, 0, 0); + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 12, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 3); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 2); } else { _scene->_sequences.remove(_globals._sequenceIndexes[5]); - _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 12, 1, 0, 0); + _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 12, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 3); _scene->_hotspots.activate(0xFF, false); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 2); @@ -2225,7 +2225,7 @@ void Scene512::actions() { break; case 2: - _globals[kRegisterOpen] = false; + _globals[kRegisterOpen] = false; _game._player._stepEnabled = true; break; @@ -2236,8 +2236,8 @@ void Scene512::actions() { if (_game._trigger || !_game._objects.isInInventory(OBJ_PADLOCK_KEY)) { switch (_game._trigger) { case 0: - _game._player._stepEnabled = false; - _game._player._visible = false; + _game._player._stepEnabled = false; + _game._player._visible = false; int endVal; if (_game._player._playerPos == Common::Point(218, 152)) @@ -2245,7 +2245,7 @@ void Scene512::actions() { else endVal = 2; - _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 10, 1, 0, 0); + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 10, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, endVal); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[2]); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_SPRITE, endVal, 1); @@ -2258,7 +2258,7 @@ void Scene512::actions() { _scene->_dynamicHotspots.remove(_keyHotspotId); } else { _scene->_sequences.remove(_globals._sequenceIndexes[5]); - _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -2); + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -2); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 3); _scene->_hotspots.activate(0xFF, false); } @@ -2269,7 +2269,7 @@ void Scene512::actions() { case 2: _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[2]); - _game._player._visible = true; + _game._player._visible = true; _game._player._stepEnabled = true; break; @@ -2348,10 +2348,10 @@ void Scene513::enter() { _globals._spriteIndexes[3] = _scene->_sprites.addSprites("*RXCD_9"); _globals._spriteIndexes[4] = _scene->_sprites.addSprites("*RXMRC_9"); - _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -2); + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -2); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 2); - _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -2); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -2); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); if ((_scene->_priorSceneId == 751) || (_scene->_priorSceneId == 701)) { @@ -2360,9 +2360,9 @@ void Scene513::enter() { _game._player._stepEnabled = false; _scene->_sequences.addTimer(15, 80); } else if (_scene->_priorSceneId != -2) { - _game._player._playerPos = Common::Point(63, 149); + _game._player._playerPos = Common::Point(63, 149); _game._player._facing = FACING_NORTHEAST; - _game._player._visible = false; + _game._player._visible = false; _game._player._stepEnabled = false; _scene->_sequences.remove(_globals._sequenceIndexes[1]); _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -1); @@ -2387,7 +2387,7 @@ void Scene513::step() { _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 2); _vm->_sound->command(24); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 81); - break; + break; case 81: _game._player.walk(Common::Point(265, 152), FACING_WEST); @@ -2402,7 +2402,7 @@ void Scene513::step() { break; case 83: - _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -2); + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -2); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 2); _game._player._stepEnabled = true; break; @@ -2413,7 +2413,7 @@ void Scene513::step() { switch (_game._trigger) { case 70: - _game._player._visible = true; + _game._player._visible = true; _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; _scene->_sequences.addTimer(6, 71); break; @@ -2426,7 +2426,7 @@ void Scene513::step() { break; case 72: - _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -2); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -2); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); _game._player._stepEnabled = true; break; @@ -2441,7 +2441,7 @@ void Scene513::actions() { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; - _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _scene->_sequences.remove(_globals._sequenceIndexes[1]); _globals._sequenceIndexes[1] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 6, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 1); @@ -2457,7 +2457,7 @@ void Scene513::actions() { break; case 2: - _game._player._visible = false; + _game._player._visible = false; _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 10, 1, 0, 0); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 3); @@ -2478,9 +2478,9 @@ void Scene513::actions() { } else if (_action.isAction(VERB_PUT, 0xB3, 0x251) || _action.isAction(VERB_PUT, 0x305, 0x251)) { switch (_game._trigger) { case 0: - _game._player._stepEnabled = false; - _game._player._visible = false; - _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 7, 1, 0, 0); + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 7, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 1, 2); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 1); @@ -2488,7 +2488,7 @@ void Scene513::actions() { case 1: _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[4]); - _game._player._visible = true; + _game._player._visible = true; _scene->_sequences.remove(_globals._sequenceIndexes[2]); _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 7, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 2); @@ -2511,7 +2511,7 @@ void Scene513::actions() { break; case 4: - _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -2); + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -2); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 2); _game._player._stepEnabled = true; if (_globals[kCityFlooded]) @@ -2564,7 +2564,7 @@ void Scene515::setup() { } void Scene515::enter() { - _game._player._visible = false; + _game._player._visible = false; _game._player._stepEnabled = false; _scene->_sequences.addTimer(30, 70); @@ -2580,5 +2580,147 @@ void Scene515::step() { /*------------------------------------------------------------------------*/ +void Scene551::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene551::enter() { + if (_globals[kSexOfRex] == REX_MALE) + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('a', 0)); + else + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('a', 1)); + + if (_scene->_priorSceneId == 501) + _game._player._playerPos = Common::Point(18, 130); + else if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(124, 119); + _game._player._facing = FACING_NORTH; + } + + if (_globals[kTeleporterCommand]) { + _game._player._visible = false; + _game._player._stepEnabled = false; + + char sepChar; + if (_globals[kSexOfRex] == REX_MALE) + sepChar = 'e'; + else + sepChar = 'u'; + + int suffixNum; + int trigger; + + switch (_globals[kTeleporterCommand]) { + case 1: + suffixNum = 3; + trigger = 75; + _globals[kTeleporterUnderstood] = true; + break; + + case 2: + suffixNum = 1; + trigger = 80; + break; + + case 4: + suffixNum = 2; + trigger = 90; + break; + + default: + trigger = 0; + suffixNum = 0; + } + + _globals[kTeleporterCommand] = 0; + + if (suffixNum > 0) + _scene->loadAnimation(formAnimName(sepChar, suffixNum), trigger); + else { + _game._player._visible = true; + _game._player._stepEnabled = true; + } + } + + sceneEntrySound(); +} + +void Scene551::step() { + switch (_game._trigger) { + case 75: + _game._player._stepEnabled = true; + _game._player._visible = true; + _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; + break; + + case 80: + _globals[kTeleporterCommand] = 1; + _scene->_nextSceneId = _globals[kTeleporterDestination]; + _scene->_reloadSceneFlag = true; + break; + + case 90: + if (_globals[kSexOfRex] == REX_MALE) { + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 8); + } else { + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 8); + } + _vm->_sound->command(28); + _scene->_sequences.addTimer(60, 91); + break; + + case 91: + _scene->_reloadSceneFlag = true; + break; + + default: + break; + } +} + +void Scene551::preActions() { + if (_action.isAction(0x1AD) && (_action.isAction(0x360) || _action.isAction(0x361))) + _game._player._walkOffScreenSceneId = 501; +} + +void Scene551::actions() { + if (_action.isAction(0x2F9, 0x16C)) + _scene->_nextSceneId = 502; + else if ((_action._lookFlag)) + _vm->_dialogs->show(55117); + else if (_action.isAction(VERB_LOOK, 0x35E)) + _vm->_dialogs->show(55110); + else if (_action.isAction(VERB_LOOK, 0x318)) + _vm->_dialogs->show(55111); + else if (_action.isAction(VERB_WALKTO, 0x318)) + _vm->_dialogs->show(55112); + else if (_action.isAction(VERB_LOOK, 0x323)) + _vm->_dialogs->show(55113); + else if (_action.isAction(VERB_LOOK, 0x16C)) + _vm->_dialogs->show(55114); + else if (_action.isAction(VERB_LOOK, 0x323)) + _vm->_dialogs->show(55115); + else if (_action.isAction(VERB_LOOK, 0x361)) { + if (_game._visitedScenes.exists(505)) + _vm->_dialogs->show(55116); + else + _vm->_dialogs->show(55115); + } else if (_action.isAction(VERB_LOOK, 0x31D)) + _vm->_dialogs->show(55118); + else if (_action.isAction(VERB_LOOK, 0x369)) + _vm->_dialogs->show(55119); + else if (_action.isAction(VERB_LOOK, 0x249)) + _vm->_dialogs->show(55120); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes5.h b/engines/mads/nebular/nebular_scenes5.h index 0fbc62fa71..9d5e76acc9 100644 --- a/engines/mads/nebular/nebular_scenes5.h +++ b/engines/mads/nebular/nebular_scenes5.h @@ -238,6 +238,17 @@ public: virtual void postActions() {}; }; +class Scene551: public Scene5xx{ +public: + Scene551(MADSEngine *vm) : Scene5xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From bc7af1de19e249c2928dd8df9da6250334a9b652 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sat, 10 May 2014 17:08:34 +0100 Subject: GUI: Add "debuglevel" command to Debugger base class. This allows the debug level to be changed at runtime from the debug console. --- gui/debugger.cpp | 17 +++++++++++++++++ gui/debugger.h | 1 + 2 files changed, 18 insertions(+) diff --git a/gui/debugger.cpp b/gui/debugger.cpp index 2ec9937fdb..832f49f0c9 100644 --- a/gui/debugger.cpp +++ b/gui/debugger.cpp @@ -61,6 +61,7 @@ Debugger::Debugger() { DCmd_Register("help", WRAP_METHOD(Debugger, Cmd_Help)); DCmd_Register("openlog", WRAP_METHOD(Debugger, Cmd_OpenLog)); + DCmd_Register("debuglevel", WRAP_METHOD(Debugger, Cmd_DebugLevel)); DCmd_Register("debugflag_list", WRAP_METHOD(Debugger, Cmd_DebugFlagsList)); DCmd_Register("debugflag_enable", WRAP_METHOD(Debugger, Cmd_DebugFlagEnable)); DCmd_Register("debugflag_disable", WRAP_METHOD(Debugger, Cmd_DebugFlagDisable)); @@ -501,6 +502,22 @@ bool Debugger::Cmd_OpenLog(int argc, const char **argv) { } +bool Debugger::Cmd_DebugLevel(int argc, const char **argv) { + if (argc == 1) { + DebugPrintf("Debugging is currently set at level %d\n", gDebugLevel); + } else { // set level + gDebugLevel = atoi(argv[1]); + if (gDebugLevel >= 0 && gDebugLevel < 11) { + DebugPrintf("Debug level set to level %d\n", gDebugLevel); + } else if (gDebugLevel < 0) { + DebugPrintf("Debugging is now disabled\n"); + } else + DebugPrintf("Not a valid debug level (0 - 10)\n"); + } + + return true; +} + bool Debugger::Cmd_DebugFlagsList(int argc, const char **argv) { const Common::DebugManager::DebugChannelList &debugLevels = DebugMan.listDebugChannels(); diff --git a/gui/debugger.h b/gui/debugger.h index 4ce5481fbb..7481f89df2 100644 --- a/gui/debugger.h +++ b/gui/debugger.h @@ -193,6 +193,7 @@ protected: bool Cmd_Exit(int argc, const char **argv); bool Cmd_Help(int argc, const char **argv); bool Cmd_OpenLog(int argc, const char **argv); + bool Cmd_DebugLevel(int argc, const char **argv); bool Cmd_DebugFlagsList(int argc, const char **argv); bool Cmd_DebugFlagEnable(int argc, const char **argv); bool Cmd_DebugFlagDisable(int argc, const char **argv); -- cgit v1.2.3 From 1506b96bd0fd65682a90ed594e838182922055b1 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sat, 10 May 2014 17:25:35 +0100 Subject: AGOS: Remove redundant "level" command from debugger. The base class "debuglevel" command now provides the same functionality. --- engines/agos/agos.cpp | 2 -- engines/agos/debugger.cpp | 23 ----------------------- engines/agos/debugger.h | 1 - 3 files changed, 26 deletions(-) diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp index 7266c75474..2fc89771d3 100644 --- a/engines/agos/agos.cpp +++ b/engines/agos/agos.cpp @@ -243,7 +243,6 @@ AGOSEngine::AGOSEngine(OSystem *system, const AGOSGameDescription *gd) _backFlag = false; - _debugMode = 0; _dumpScripts = false; _dumpOpcodes = false; _dumpVgaScripts = false; @@ -676,7 +675,6 @@ Common::Error AGOSEngine::init() { } // TODO: Use special debug levels instead of the following hack. - _debugMode = (gDebugLevel >= 0); switch (gDebugLevel) { case 2: _dumpOpcodes = true; break; case 3: _dumpVgaOpcodes = true; break; diff --git a/engines/agos/debugger.cpp b/engines/agos/debugger.cpp index 512137b685..b5233bed0c 100644 --- a/engines/agos/debugger.cpp +++ b/engines/agos/debugger.cpp @@ -33,7 +33,6 @@ Debugger::Debugger(AGOSEngine *vm) _vm = vm; DCmd_Register("continue", WRAP_METHOD(Debugger, Cmd_Exit)); - DCmd_Register("level", WRAP_METHOD(Debugger, Cmd_DebugLevel)); DCmd_Register("music", WRAP_METHOD(Debugger, Cmd_PlayMusic)); DCmd_Register("sound", WRAP_METHOD(Debugger, Cmd_PlaySound)); DCmd_Register("voice", WRAP_METHOD(Debugger, Cmd_PlayVoice)); @@ -48,28 +47,6 @@ Debugger::Debugger(AGOSEngine *vm) } - -bool Debugger::Cmd_DebugLevel(int argc, const char **argv) { - if (argc == 1) { - if (_vm->_debugMode == false) - DebugPrintf("Debugging is not enabled at this time\n"); - else - DebugPrintf("Debugging is currently set at level %d\n", gDebugLevel); - } else { // set level - gDebugLevel = atoi(argv[1]); - if (0 <= gDebugLevel && gDebugLevel < 11) { - _vm->_debugMode = true; - DebugPrintf("Debug level set to level %d\n", gDebugLevel); - } else if (gDebugLevel < 0) { - _vm->_debugMode = false; - DebugPrintf("Debugging is now disabled\n"); - } else - DebugPrintf("Not a valid debug level (0 - 10)\n"); - } - - return true; -} - bool Debugger::Cmd_PlayMusic(int argc, const char **argv) { if (argc > 1) { uint music = atoi(argv[1]); diff --git a/engines/agos/debugger.h b/engines/agos/debugger.h index caac6e2caf..026194410f 100644 --- a/engines/agos/debugger.h +++ b/engines/agos/debugger.h @@ -37,7 +37,6 @@ public: private: AGOSEngine *_vm; - bool Cmd_DebugLevel(int argc, const char **argv); bool Cmd_PlayMusic(int argc, const char **argv); bool Cmd_PlaySound(int argc, const char **argv); bool Cmd_PlayVoice(int argc, const char **argv); -- cgit v1.2.3 From 0844ba0ddeb9b3560660d275cc999b14055e285c Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sat, 10 May 2014 19:02:11 +0100 Subject: PARALLACTION: Remove leftover "debugLevel" command prototype. --- engines/parallaction/debug.h | 1 - 1 file changed, 1 deletion(-) diff --git a/engines/parallaction/debug.h b/engines/parallaction/debug.h index 887d08e945..551d746edf 100644 --- a/engines/parallaction/debug.h +++ b/engines/parallaction/debug.h @@ -22,7 +22,6 @@ private: Parallaction *_vm; MouseTriState _mouseState; - bool Cmd_DebugLevel(int argc, const char **argv); bool Cmd_Location(int argc, const char **argv); bool Cmd_Give(int argc, const char **argv); bool Cmd_Zones(int argc, const char **argv); -- cgit v1.2.3 From 2990034571edac22a606003f76d1619f017f1786 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 10 May 2014 20:58:44 +0200 Subject: MADS: Implement scene 601 --- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes6.cpp | 134 +++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes6.h | 13 ++- 3 files changed, 147 insertions(+), 2 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 19ccc627cc..a6ea81db36 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -225,7 +225,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { // Scene group #6 (men's city, upper floor) case 601: // outside Bruce's house - return new DummyScene(vm); // TODO + return new Scene601(vm); case 602: // Bruce's house, living room return new DummyScene(vm); // TODO case 603: // Bruce's house, bedroom diff --git a/engines/mads/nebular/nebular_scenes6.cpp b/engines/mads/nebular/nebular_scenes6.cpp index 2d4ef9ee7f..0b2c939af9 100644 --- a/engines/mads/nebular/nebular_scenes6.cpp +++ b/engines/mads/nebular/nebular_scenes6.cpp @@ -83,5 +83,139 @@ void Scene6xx::sceneEntrySound() { /*------------------------------------------------------------------------*/ +void Scene601::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(0x343); + _scene->addActiveVocab(0xD1); +} + +void Scene601::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 0)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('c', 0)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites("*RXCD_4"); + + if (_globals[kLaserHoleIsThere]) { + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -2); + _scene->_dynamicHotspots.add(0x343, 0xD1, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + } + + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 3); + + if (_scene->_priorSceneId == 504) { + _game._player._playerPos = Common::Point(73, 148); + _game._player._facing = FACING_WEST; + _game._player._visible = false; + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 3); + _scene->loadAnimation(formAnimName('R', 1), 70); + } else if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(229, 129); + _game._player._facing = FACING_SOUTHWEST; + } + + sceneEntrySound(); +} + +void Scene601::step() { + switch (_game._trigger) { + case 70: + _game._player._visible = true; + _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; + _scene->_sequences.addTimer(30, 71); + break; + + case 71: + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 3); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 72); + break; + + case 72: + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 3); + _game._player._stepEnabled = true; + break; + + default: + break; + } +} + +void Scene601::actions() { + if (_action.isAction(0x18B, 0x378)) + _scene->_nextSceneId = 602; + else if (_action.isAction(0x325, 0x324)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 3); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 1); + break; + + case 1: { + int syncIdx = _globals._sequenceIndexes[2]; + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -2); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], syncIdx); + _scene->_sequences.addTimer(6, 2); + } + break; + + case 2: + _game._player._visible = false; + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 10, 1, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 3); + break; + + case 3: { + int syncIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -2); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], syncIdx); + _scene->_nextSceneId = 504; + } + break; + + default: + break; + } + } else if (_action._lookFlag || _action.isAction(VERB_LOOK, 0x31E)) { + if (!_globals[kLaserHoleIsThere]) + _vm->_dialogs->show(60110); + else + _vm->_dialogs->show(60111); + } else if (_action.isAction(VERB_LOOK, 0x324)) + _vm->_dialogs->show(60112); + else if (_action.isAction(VERB_LOOK, 0x32C)) + _vm->_dialogs->show(60113); + else if (_action.isAction(VERB_LOOK, 0x323)) + _vm->_dialogs->show(60114); + else if (_action.isAction(0x1AD, 0x31E)) + _vm->_dialogs->show(60115); + else if (_action.isAction(VERB_LOOK, 0x48E)) + _vm->_dialogs->show(60116); + else if (_action.isAction(VERB_LOOK, 0x378)) + _vm->_dialogs->show(60117); + else if (_action.isAction(VERB_LOOK, 0x18D)) + _vm->_dialogs->show(60118); + else if (_action.isAction(VERB_LOOK, 0x38F)) + _vm->_dialogs->show(60119); + else if (_action.isAction(VERB_LOOK, 0x3C4)) + _vm->_dialogs->show(60120); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes6.h b/engines/mads/nebular/nebular_scenes6.h index 19eb278375..5aecb133f3 100644 --- a/engines/mads/nebular/nebular_scenes6.h +++ b/engines/mads/nebular/nebular_scenes6.h @@ -50,8 +50,19 @@ public: Scene6xx(MADSEngine *vm) : NebularScene(vm) {} }; -} // End of namespace Nebular +class Scene601: public Scene6xx{ +public: + Scene601(MADSEngine *vm) : Scene6xx(vm) {} + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions(); + virtual void postActions() {}; +}; + +} // End of namespace Nebular } // End of namespace MADS #endif /* MADS_NEBULAR_SCENES6_H */ -- cgit v1.2.3 From 38c63c4bc42b75700017aee9a445c036143eb3ce Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sat, 10 May 2014 22:04:20 +0200 Subject: FULLPIPE: Silence GCC warnings --- engines/fullpipe/motion.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index b97d980d7d..96895ca8b3 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -583,7 +583,7 @@ void MovGraph::freeItems() { for (uint i = 0; i < _items.size(); i++) { _items[i]->free(); - for (int j = 0; j < _items[i]->movarr->size(); j++) + for (uint j = 0; j < _items[i]->movarr->size(); j++) delete (*_items[i]->movarr)[j]; delete _items[i]->movarr; @@ -946,7 +946,7 @@ Common::Array *MovGraph::getBboxes(MovArr *movarr1, MovArr *mova Common::Array *res = new Common::Array; - for (uint i = 0; i < *listCount; i++) { + for (int i = 0; i < *listCount; i++) { Common::Rect *r = new Common::Rect; calcBbox(r, tempObList2[i], movarr1, movarr2); @@ -987,7 +987,7 @@ bool MovGraph::calcChunk(int idx, int x, int y, MovArr *arr, int a6) { int idxmin = -1; int offmin = 100; - for (uint i = 0; i < arrSize; i++) { + for (int i = 0; i < arrSize; i++) { int off = _mgm.refreshOffsets(_items[idx]->ani->_id, staticsId, (*movarr)[i]->_link->_dwordArray2[_field_44]); if (off < offmin) { -- cgit v1.2.3 From 434f33561166ed70442db3a55813176dbe0e4757 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 11 May 2014 00:08:34 +0200 Subject: MADS: Implement scene 602 --- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes6.cpp | 313 +++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes6.h | 20 ++ 3 files changed, 334 insertions(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index a6ea81db36..5b1ad6b037 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -227,7 +227,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 601: // outside Bruce's house return new Scene601(vm); case 602: // Bruce's house, living room - return new DummyScene(vm); // TODO + return new Scene602(vm); case 603: // Bruce's house, bedroom return new DummyScene(vm); // TODO case 604: // viewport diff --git a/engines/mads/nebular/nebular_scenes6.cpp b/engines/mads/nebular/nebular_scenes6.cpp index 0b2c939af9..5e78db60ba 100644 --- a/engines/mads/nebular/nebular_scenes6.cpp +++ b/engines/mads/nebular/nebular_scenes6.cpp @@ -217,5 +217,318 @@ void Scene601::actions() { /*------------------------------------------------------------------------*/ +void Scene602::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(0xD); + _scene->addActiveVocab(0x3D3); + _scene->addActiveVocab(0x343); +} + +void Scene602::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('h', -1)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 0)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 1)); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('l', 0)); + _globals._spriteIndexes[5] = _scene->_sprites.addSprites("*RXMRC_9"); + + if (!_game._visitedScenes._sceneRevisited) + _globals[kSafeStatus] = 0; + + if (_globals[kLaserHoleIsThere]) { + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 9); + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 9); + int idx = _scene->_dynamicHotspots.add(0x343, VERB_WALKTO, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(80, 134), FACING_NORTHEAST); + _scene->changeVariant(1); + } else + _scene->_hotspots.activate(0x342, false); + + if (_globals[kSafeStatus] == 0) { + _lastSpriteIdx = _globals._spriteIndexes[2]; + _cycleIndex = -1; + } else if (_globals[kSafeStatus] == 1) { + _lastSpriteIdx = _globals._spriteIndexes[2]; + _cycleIndex = -2; + } else if (_globals[kSafeStatus] == 3) { + _lastSpriteIdx = _globals._spriteIndexes[3]; + _cycleIndex = -2; + } else { + _lastSpriteIdx = _globals._spriteIndexes[3]; + _cycleIndex = -1; + } + + _lastSequenceIdx = _scene->_sequences.startCycle(_lastSpriteIdx, false, _cycleIndex); + _scene->_sequences.setDepth(_lastSequenceIdx, 14); + int idx = _scene->_dynamicHotspots.add(0x3D3, VERB_WALKTO, _lastSequenceIdx, Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(185, 113), FACING_NORTHWEST); + + if (_game._objects.isInRoom(OBJ_DOOR_KEY)) { + _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('k', -1)); + _globals._sequenceIndexes[6] = _scene->_sequences.startCycle(_globals._spriteIndexes[6], false, -1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 15); + if (_globals[kSafeStatus] == 0 || _globals[kSafeStatus] == 2) + _scene->_hotspots.activate(0x6F, false); + } else + _scene->_hotspots.activate(0x6F, false); + + if (_scene->_priorSceneId == 603) { + _game._player._playerPos = Common::Point(228, 126); + _game._player._facing = FACING_WEST; + } else if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(50, 127); + _game._player._facing = FACING_EAST; + } + + sceneEntrySound(); + _game.loadQuoteSet(0x2F1, 0x2F2, 0x2F3, 0); + + if (_scene->_roomChanged) { + _game._objects.addToInventory(OBJ_NOTE); + _game._objects.addToInventory(OBJ_REARVIEW_MIRROR); + _game._objects.addToInventory(OBJ_COMPACT_CASE); + } +} + +void Scene602::handleSafeActions() { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[5] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[5], true, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 1, 3); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_SPRITE, 3, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 3); + break; + + case 1: + if (_safeMode == 1 || _safeMode == 3) { + if (_globals[kSafeStatus] == 0 && _safeMode == 1) { + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x2F1)); + _scene->_sequences.addTimer(120, 4); + } else { + _scene->_sequences.remove(_lastSequenceIdx); + if (_safeMode == 3) + _lastSpriteIdx = _globals._spriteIndexes[2]; + else + _lastSpriteIdx = _globals._spriteIndexes[3]; + + _lastSequenceIdx = _scene->_sequences.addSpriteCycle(_lastSpriteIdx, false, 12, 1, 0, 0); + _scene->_sequences.setDepth(_lastSequenceIdx, 14); + if (_game._objects[OBJ_DOOR_KEY]._roomNumber == _scene->_currentSceneId) + _scene->_hotspots.activate(0x6F, true); + + _scene->_sequences.addSubEntry(_lastSequenceIdx, + SEQUENCE_TRIGGER_EXPIRE, 0, 2); + } + } else { + _scene->_sequences.remove(_lastSequenceIdx); + if (_globals[kSafeStatus] == 1) + _lastSpriteIdx = _globals._spriteIndexes[2]; + else + _lastSpriteIdx = _globals._spriteIndexes[3]; + + _lastSequenceIdx = _scene->_sequences.startReverseCycle(_lastSpriteIdx, false, 12, 1, 0, 0); + _scene->_sequences.setDepth(_lastSequenceIdx, 14); + if (_game._objects[OBJ_DOOR_KEY]._roomNumber == _scene->_currentSceneId) + _scene->_hotspots.activate(0x6F, false); + + _scene->_sequences.addSubEntry(_lastSequenceIdx, SEQUENCE_TRIGGER_EXPIRE, 0, 2); + } + break; + + case 2: { + int synxIdx = _lastSequenceIdx; + _lastSequenceIdx = _scene->_sequences.startCycle(_lastSpriteIdx, false, _cycleIndex); + _scene->_sequences.setDepth(_lastSequenceIdx, 14); + _scene->_sequences.updateTimeout(_lastSequenceIdx, synxIdx); + int idx = _scene->_dynamicHotspots.add(0x3D3, VERB_WALKTO, _lastSequenceIdx, Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(185, 113), FACING_NORTHWEST); + if (_safeMode == 3) { + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x2F3)); + _scene->_sequences.addTimer(120, 4); + } else + _scene->_sequences.addTimer(60, 4); + break; + } + + case 3: + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[5]); + _game._player._visible = true; + break; + + case 4: + if (_safeMode == 1) { + if (_globals[kSafeStatus] == 2) + _globals[kSafeStatus] = 3; + } else if (_safeMode == 2) { + if (_globals[kSafeStatus] == 3) + _globals[kSafeStatus] = 2; + else + _globals[kSafeStatus] = 0; + } else + _globals[kSafeStatus] = 1; + + _game._player._stepEnabled = true; + break; + + default: + break; + } +} + +void Scene602::actions() { + if (_action.isAction(0x18B, 0x1F9)) + _scene->_nextSceneId = 601; + else if (_action.isAction(0x18B, 0x70)) + _scene->_nextSceneId = 603; + else if (_action.isAction(VERB_OPEN, 0x3D3) && ((_globals[kSafeStatus] == 0) || (_globals[kSafeStatus] == 2))) { + _safeMode = 1; + _cycleIndex = -2; + handleSafeActions(); + } else if (_action.isAction(VERB_CLOSE, 0x3D3) && ((_globals[kSafeStatus] == 1) || (_globals[kSafeStatus] == 3))) { + _safeMode = 2; + _cycleIndex = -1; + handleSafeActions(); + } else if (_action.isAction(0x17B, 0x3A7, 0x3D3)) { + if ((_globals[kSafeStatus] == 0) && (_game._difficulty != DIFFICULTY_HARD)) { + _safeMode = 3; + _cycleIndex = -2; + handleSafeActions(); + } + } else if ((_action.isAction(VERB_PUT, 0x120, 0x343) || _action.isAction(VERB_PUT, 0x57, 0x343) + || _action.isAction(0x365, 0x57, 0x343) || _action.isAction(0x365, 0x120, 0x343)) && (_globals[kSafeStatus] == 0)) { + switch (_game._trigger) { + case 0: + _vm->_dialogs->show(60230); + _game._player._stepEnabled = false; + _game._player._visible = false; + _scene->_sequences.remove(_globals._sequenceIndexes[4]); + _scene->_sequences.remove(_lastSequenceIdx); + _scene->loadAnimation(formAnimName('L', 1), 1); + break; + + case 1: { + _game._player._visible = true; + _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; + _lastSpriteIdx = _globals._spriteIndexes[3]; + _lastSequenceIdx = _scene->_sequences.startCycle(_lastSpriteIdx, false, -1); + _scene->_sequences.setDepth(_lastSequenceIdx, 14); + int idx = _scene->_dynamicHotspots.add(0x3D3, VERB_WALKTO, _lastSequenceIdx, Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(185, 113), FACING_NORTHWEST); + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 9); + idx = _scene->_dynamicHotspots.add(0x343, VERB_WALKTO, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(80, 134), FACING_NORTHEAST); + _scene->_sequences.addTimer(60, 2); + } + break; + + case 2: + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x2F2)); + _globals[kSafeStatus] = 2; + _game._player._stepEnabled = true; + break; + + default: + break; + } + } else if (_action.isAction(VERB_TAKE, 0x6F) && (_game._trigger || _game._objects.isInRoom(OBJ_DOOR_KEY))) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[5] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[5], true, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 1, 3); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_SPRITE, 3, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + + case 1: + _scene->_sequences.remove(_globals._sequenceIndexes[6]); + _scene->_hotspots.activate(0x6F, false); + _vm->_sound->command(9); + _game._objects.addToInventory(OBJ_DOOR_KEY); + break; + + case 2: + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[5]); + _game._player._visible = true; + _game._player._stepEnabled = true; + _vm->_dialogs->showItem(OBJ_DOOR_KEY, 835); + break; + + default: + break; + } + } else if (_action._lookFlag) + _vm->_dialogs->show(60210); + else if (_action.isAction(VERB_LOOK, 0x89)) + _vm->_dialogs->show(60211); + else if (_action.isAction(VERB_LOOK, 0x1F9)) + _vm->_dialogs->show(60212); + else if (_action.isAction(VERB_LOOK, 0x160)) + _vm->_dialogs->show(60213); + else if (_action.isAction(VERB_LOOK, 0x47) || _action.isAction(VERB_LOOK, 0x3CA)) + _vm->_dialogs->show(60214); + else if (_action.isAction(VERB_LOOK, 0x492)) + _vm->_dialogs->show(60215); + else if (_action.isAction(VERB_LOOK, 0x3D8)) + _vm->_dialogs->show(60216); + else if (_action.isAction(VERB_LOOK, 0x289)) + _vm->_dialogs->show(60217); + else if (_action.isAction(VERB_LOOK, 0x2F6)) + _vm->_dialogs->show(60218); + else if (_action.isAction(VERB_LOOK, 0x491)) + _vm->_dialogs->show(60219); + else if (_action.isAction(VERB_LOOK, 0x493)) + _vm->_dialogs->show(60220); + else if (_action.isAction(VERB_LOOK, 0x70)) + _vm->_dialogs->show(60221); + else if (_action.isAction(VERB_LOOK, 0x3D3)) { + if (_globals[kSafeStatus] == 0) + _vm->_dialogs->show(60222); + else if (_globals[kSafeStatus] == 1) { + if (!_game._objects.isInRoom(OBJ_DOOR_KEY)) + _vm->_dialogs->show(60223); + else + _vm->_dialogs->show(60224); + } else if (_globals[kSafeStatus] == 2) + _vm->_dialogs->show(60234); + else if (_game._objects.isInRoom(OBJ_DOOR_KEY)) + _vm->_dialogs->show(60235); + else + _vm->_dialogs->show(60236); + } else if (_action.isAction(0x17B, 0x6F, 0x3D3) || _action.isAction(0x17B, 0xFF, 0x3D3)) + _vm->_dialogs->show(60225); + else if (_action.isAction(VERB_PULL, 0x3D3)) + _vm->_dialogs->show(60226); + else if (_action.isAction(VERB_PUT, 0x3D8) && _game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId))) + _vm->_dialogs->show(60227); + else if (_action.isAction(VERB_LOOK, 0x342)) + _vm->_dialogs->show(60228); + else if (_action.isAction(VERB_LOOK, 0x343)) + _vm->_dialogs->show(60229); + else if (_action.isAction(VERB_LOOK, 0x3F5)) + _vm->_dialogs->show(60231); + else if (_action.isAction(VERB_THROW, 0x2A, 0x3D3) || _action.isAction(VERB_THROW, 0x2B, 0x3D3)) + _vm->_dialogs->show(60232); + else if (_action.isAction(VERB_PUT, 0x171)) + _vm->_dialogs->show(60233); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes6.h b/engines/mads/nebular/nebular_scenes6.h index 5aecb133f3..cbf384d2c8 100644 --- a/engines/mads/nebular/nebular_scenes6.h +++ b/engines/mads/nebular/nebular_scenes6.h @@ -62,6 +62,26 @@ public: virtual void postActions() {}; }; +class Scene602: public Scene6xx{ +private: + int _lastSpriteIdx; + int _lastSequenceIdx; + int _cycleIndex; + int _safeMode; + + void handleSafeActions(); + +public: + Scene602(MADSEngine *vm) : Scene6xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step() {}; + virtual void preActions() {}; + virtual void actions(); + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 3f3040063ac0b874a275a3bf44b48a6283b2404b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 10 May 2014 22:28:51 -0400 Subject: MADS: Fix restoring palette after showing picture dialog --- engines/mads/nebular/dialogs_nebular.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp index 4d34c76986..6ddb3230d9 100644 --- a/engines/mads/nebular/dialogs_nebular.cpp +++ b/engines/mads/nebular/dialogs_nebular.cpp @@ -368,6 +368,7 @@ PictureDialog::~PictureDialog() { // Restore palette information Common::copy(&_palette[0], &_palette[PALETTE_SIZE], &palette._mainPalette[0]); + _vm->_palette->setFullPalette(palette._mainPalette); Common::copy(&_palFlags[0], &_palFlags[PALETTE_COUNT], &palette._palFlags[0]); palette._rgbList.copy(_rgbList); } -- cgit v1.2.3 From 81a863be5c2f50430f44ebd5bce2b43632f7515f Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 11 May 2014 08:35:26 +0300 Subject: FULLPIPE: Further work on MovGraph::doWalkTo() --- engines/fullpipe/motion.cpp | 112 ++++++++++++++++++++++---------------------- 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 96895ca8b3..58d5055076 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -632,10 +632,12 @@ MessageQueue *MovGraph::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int PicAniInfo picAniInfo; int ss; - MovItem *v9 = method28(subj, xpos, ypos, fuzzyMatch, &ss); + MovItem *movitem = method28(subj, xpos, ypos, fuzzyMatch, &ss); + subj->getPicAniInfo(&picAniInfo); - if ( v9 ) { - MovArr *goal = _callback1(subj, v9, ss); + + if (movitem) { + MovArr *goal = _callback1(subj, movitem, ss); int idx = getItemIndexByStaticAni(subj); for (uint i = 0; i < _items[idx]->count; i++) { @@ -644,12 +646,13 @@ MessageQueue *MovGraph::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int Common::Point point; subj->calcStepLen(point); - v15 = MovGraph_sub_451D50(this, subj, subj->_ox - point.x, subj->_oy - point.y, subj->_movement->_staticsObj1->_staticsId, xpos, ypos, 0, fuzzyMatch); - v16 = v15; - if ( !v15 || !MessageQueue_getExCommandByIndex(v15, 0) ) - goto return_0; + + MessageQueue *mq = MovGraph_sub_451D50(this, subj, subj->_ox - point.x, subj->_oy - point.y, subj->_movement->_staticsObj1->_staticsId, xpos, ypos, 0, fuzzyMatch); + + if (!mq || !mq->getExCommandByIndex(0)) + return 0; - ExCommand *ex = MessageQueue_getExCommandByIndex(v16, 0); + ExCommand *ex = mq->getExCommandByIndex(0); if ((ex->_messageKind != 1 && ex->_messageKind != 20) || ex->_messageNum != subj->_movement->_id || @@ -659,56 +662,53 @@ MessageQueue *MovGraph::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int } } } - v22 = method28(subj, xpos, ypos, fuzzyMatch, &ss); - if ( v22 - && (v23 = this->_callback1(subj, v22, ss), - v24 = MovGraph_getItemIndexByStaticAni(this, subj), - v25 = 0, - v24 <<= 6, - v26 = (MovGraphItem *)((char *)this->_items + v24), - ptr = v24, - v27 = v26->count, - v27 > 0) ) { - v28 = v26->items; - while ( v28->movarr != v23 ) { - ++v25; - ++v28; - if ( v25 >= v27 ) - goto LABEL_20; - } - v30 = v26->items; - v31 = v26->movarr; - v32 = v25; - v33 = v30[v32].movarr; - vvv = v30[v32].movarr; - if ( v31 ) - CObjectFree(v31); - memcpy((char *)&this->_items->movarr + ptr, v33, 0x20u); - v34 = vvv; - v35 = (MovArr *)operator new(8 * vvv->_movStepCount); - v36 = ptr; - *(MovArr **)((char *)&this->_items->movarr + ptr) = v35; - memcpy(*(void **)((char *)&this->_items->movarr + v36), v34->_movSteps, 8 * v34->_movStepCount); - *(int *)((char *)&this->_items->field_10 + v36) = -1; - *(int *)((char *)&this->_items->field_14 + v36) = 0; - MessageQueue *mq = fillMGMinfo(*(StaticANIObject **)((char *)&this->_items->ani + v36), (MovArr *)((char *)&this->_items->movarr + v36), staticsId); - if (mq) { - ExCommand *ex = new ExCommand(); - ex->_messageKind = 17; - ex->_messageNum = 54; - ex->_parentId = subj->_id; - ex->_field_3C = 1; - mq->addExCommandToEnd(ex); + + movitem = method28(subj, xpos, ypos, fuzzyMatch, &ss); + if (movitem) { + MovArr *goal = _callback1(subj, movitem, ss); + int idx = getItemIndexByStaticAni(subj); + v25 = 0; + idx <<= 6; + + if (_items[idx]->count > 0) { + int arridx = 0; + + while (_items[idx]->items[arridx]->movarr != goal) { + arridx++; + + if (arridx >= _items[idx]->count) { + subj->setPicAniInfo(&picAniInfo); + return 0; + } + } + + _items[idx]->movarr.clear(); + + memcpy(_items[idx]->movarr, _items[idx]->items[arridx].movarr, 0x20u); + _items[idx]->movarr = (MovArr *)operator new(8 * _items[idx]->items[arridx].movarr->_movStepCount); + memcpy(_items[idx]->movarr, _items[idx]->items[arridx].movarr, 8 * _items[idx]->items[arridx].movarr->_movStepCount); + + _items[idx]->field_10 = -1; + _items[idx]->field_14 = 0; + + MessageQueue *mq = fillMGMinfo(_items[idx]->ani, _items[idx]->movarr, staticsId); + if (mq) { + ExCommand *ex = new ExCommand(); + ex->_messageKind = 17; + ex->_messageNum = 54; + ex->_parentId = subj->_id; + ex->_field_3C = 1; + mq->addExCommandToEnd(ex); + } + subj->setPicAniInfo(&picAniInfo); + + return mq; } - subj->setPicAniInfo(&picAniInfo); - result = mq; - } else { - LABEL_20: - subj->setPicAniInfo(&picAniInfo); - return_0: - result = 0; } - return result; + + subj->setPicAniInfo(&picAniInfo); + + return 0; #endif warning("STUB: MovGraph::doWalkTo()"); -- cgit v1.2.3 From 1655a0aa90077296b70d03d61157950bee1cc390 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 11 May 2014 11:06:06 +0200 Subject: MADS: Implement scene 603 --- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes6.cpp | 142 +++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes6.h | 16 ++++ 3 files changed, 159 insertions(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 5b1ad6b037..5d937e9a09 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -229,7 +229,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 602: // Bruce's house, living room return new Scene602(vm); case 603: // Bruce's house, bedroom - return new DummyScene(vm); // TODO + return new Scene603(vm); case 604: // viewport return new DummyScene(vm); // TODO case 605: // viewport closeup diff --git a/engines/mads/nebular/nebular_scenes6.cpp b/engines/mads/nebular/nebular_scenes6.cpp index 5e78db60ba..49246fbf31 100644 --- a/engines/mads/nebular/nebular_scenes6.cpp +++ b/engines/mads/nebular/nebular_scenes6.cpp @@ -530,5 +530,147 @@ void Scene602::actions() { /*------------------------------------------------------------------------*/ +void Scene603::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(0xD); + _scene->addActiveVocab(0x57); + _scene->addActiveVocab(0x3A8); +} + +void Scene603::enter() { + if (_game._objects[OBJ_COMPACT_CASE]._roomNumber == _scene->_currentSceneId) { + _globals._spriteIndexes[4] = _scene->_sprites.addSprites("*RXMRD_3"); + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('c', -1)); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); + _compactCaseHotspotId = _scene->_dynamicHotspots.add(0x57, VERB_WALKTO, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(_compactCaseHotspotId, Common::Point(250, 152), FACING_SOUTHEAST); + } + + if ((_game._difficulty != DIFFICULTY_HARD) && (_game._objects[OBJ_NOTE]._roomNumber == _scene->_currentSceneId)) { + _globals._spriteIndexes[3] = _scene->_sprites.addSprites("*RXMRC_9"); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('p', -1)); + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14); + _noteHotspotId = _scene->_dynamicHotspots.add(0x3A8, VERB_WALKTO, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(_noteHotspotId, Common::Point(242, 118), FACING_NORTHEAST); + } + + if (_scene->_priorSceneId != -2) + _game._player._playerPos = Common::Point(113, 134); + + sceneEntrySound(); +} + +void Scene603::actions() { + if (_action.isAction(0x18C, 0x3F1)) + _scene->_nextSceneId = 602; + else if (_action.isAction(VERB_TAKE, 0x57)) { + if ( _game._trigger || !_game._objects.isInInventory(OBJ_COMPACT_CASE)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 1, 5); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_SPRITE, 5, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + + case 1: + _vm->_sound->command(9); + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _scene->_dynamicHotspots.remove(_compactCaseHotspotId); + _game._objects.addToInventory(OBJ_COMPACT_CASE); + _vm->_dialogs->showItem(OBJ_COMPACT_CASE, 60330); + break; + + case 2: + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[4]); + _game._player._visible = true; + _game._player._stepEnabled = true; + break; + + default: + break; + } + } + } else if (_action.isAction(VERB_TAKE, 0x3A8)) { + if ( _game._trigger || !_game._objects.isInInventory(OBJ_NOTE)) { + if (_game._trigger == 0) { + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.addTimer (15, 1); + } else if (_game._trigger == 1) { + _vm->_sound->command(9); + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _scene->_dynamicHotspots.remove(_noteHotspotId); + _game._objects.addToInventory(OBJ_NOTE); + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; + _game._player._visible = true; + _game._player._stepEnabled = true; + } + } + } else if (_action._lookFlag) + _vm->_dialogs->show(60310); + else if (_action.isAction(VERB_LOOK, 0x1CB)) + _vm->_dialogs->show(60311); + else if (_action.isAction(VERB_LOOK, 0x3E5)) + _vm->_dialogs->show(60312); + else if (_action.isAction(VERB_TAKE, 0x3E5)) + _vm->_dialogs->show(60313); + else if (_action.isAction(VERB_LOOK, 0x3EE)) + _vm->_dialogs->show(60314); + else if (_action.isAction(VERB_LOOK, 0x3ED)) + _vm->_dialogs->show(60315); + else if (_action.isAction(VERB_LOOK, 0x49D)) + _vm->_dialogs->show(60316); + else if (_action.isAction(VERB_LOOK, 0x2F6)) + _vm->_dialogs->show(60317); + else if (_action.isAction(VERB_LOOK, 0x49E) || _action.isAction(VERB_LOOK, 0x49F) || _action.isAction(VERB_LOOK, 0x3E7)) + _vm->_dialogs->show(60318); + else if (_action.isAction(VERB_LOOK, 0x3DE)) + _vm->_dialogs->show(60319); + else if (_action.isAction(VERB_TAKE, 0x3DE)) + _vm->_dialogs->show(60320); + else if (_action.isAction(VERB_LOOK, 0x3DF)) + _vm->_dialogs->show(60321); + else if (_action.isAction(VERB_TAKE, 0x3DF)) + _vm->_dialogs->show(60322); + else if (_action.isAction(VERB_TAKE, 0x3A8)) + _vm->_dialogs->show(60323); + else if (_action.isAction(VERB_LOOK, 0x3A8)) { + if (_game._objects[OBJ_NOTE]._roomNumber == _scene->_currentSceneId) + _vm->_dialogs->show(60324); + } else if (_action.isAction(VERB_LOOK, 0x3E3)) { + if (_game._objects[OBJ_NOTE]._roomNumber == _scene->_currentSceneId) + _vm->_dialogs->show(60326); + else + _vm->_dialogs->show(60325); + } else if (_action.isAction(VERB_LOOK, 0x3EA)) { + if (_game._objects[OBJ_COMPACT_CASE]._roomNumber == _scene->_currentSceneId) + _vm->_dialogs->show(60327); + else + _vm->_dialogs->show(60328); + } else if (_action.isAction(VERB_LOOK, 0x57) && (_action._mainObjectSource == 4)) + _vm->_dialogs->show(60329); + // For the next two checks, the second part of the check wasn't surrounded par parenthesis, which was obviously wrong + else if (_action.isAction(VERB_LOOK) && (_action.isAction(0x31) || _action.isAction(0x3EA) || _action.isAction(0x3E8))) + _vm->_dialogs->show(60331); + else if (_action.isAction(VERB_TAKE) && (_action.isAction(0x31) || _action.isAction(0x3EA) || _action.isAction(0x3E8))) + _vm->_dialogs->show(60332); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes6.h b/engines/mads/nebular/nebular_scenes6.h index cbf384d2c8..cf69f59e6e 100644 --- a/engines/mads/nebular/nebular_scenes6.h +++ b/engines/mads/nebular/nebular_scenes6.h @@ -82,6 +82,22 @@ public: virtual void postActions() {}; }; +class Scene603: public Scene6xx{ +private: + int _compactCaseHotspotId; + int _noteHotspotId; + +public: + Scene603(MADSEngine *vm) : Scene6xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step() {}; + virtual void preActions() {}; + virtual void actions(); + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 6856b09d5a0024397895984aeb8d79d4a77e9111 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sun, 11 May 2014 12:27:38 +0100 Subject: AGOS: Switch opcode debugging to a debug flag, rather than level 2 hack. This is now set by --debugflags=opcode rather than -d 2, though it will still require a debug level greater than 0. --- engines/agos/agos.cpp | 5 +++-- engines/agos/agos.h | 5 ++++- engines/agos/script.cpp | 3 ++- engines/agos/subroutine.cpp | 3 +-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp index 2fc89771d3..8754b11065 100644 --- a/engines/agos/agos.cpp +++ b/engines/agos/agos.cpp @@ -21,6 +21,7 @@ */ #include "common/config-manager.h" +#include "common/debug-channels.h" #include "common/file.h" #include "common/fs.h" #include "common/textconsole.h" @@ -144,6 +145,8 @@ AGOSEngine_Elvira1::AGOSEngine_Elvira1(OSystem *system, const AGOSGameDescriptio AGOSEngine::AGOSEngine(OSystem *system, const AGOSGameDescription *gd) : Engine(system), _rnd("agos"), _gameDescription(gd) { + DebugMan.addDebugChannel(kDebugOpcode, "opcode", "Opcode debug level"); + _vcPtr = 0; _vcGetOutOfCode = 0; _gameOffsetsPtr = 0; @@ -244,7 +247,6 @@ AGOSEngine::AGOSEngine(OSystem *system, const AGOSGameDescription *gd) _backFlag = false; _dumpScripts = false; - _dumpOpcodes = false; _dumpVgaScripts = false; _dumpVgaOpcodes = false; _dumpImages = false; @@ -676,7 +678,6 @@ Common::Error AGOSEngine::init() { // TODO: Use special debug levels instead of the following hack. switch (gDebugLevel) { - case 2: _dumpOpcodes = true; break; case 3: _dumpVgaOpcodes = true; break; case 4: _dumpScripts = true; break; case 5: _dumpVgaScripts = true; break; diff --git a/engines/agos/agos.h b/engines/agos/agos.h index 5e49fce5ff..c23f16b690 100644 --- a/engines/agos/agos.h +++ b/engines/agos/agos.h @@ -61,6 +61,10 @@ struct Surface; namespace AGOS { +enum { + kDebugOpcode = 1 << 0 +}; + uint fileReadItemID(Common::SeekableReadStream *in); #define CHECK_BOUNDS(x, y) assert((uint)(x) < ARRAYSIZE(y)) @@ -329,7 +333,6 @@ protected: bool _copyProtection; bool _pause; bool _dumpScripts; - bool _dumpOpcodes; bool _dumpVgaScripts; bool _dumpVgaOpcodes; bool _dumpImages; diff --git a/engines/agos/script.cpp b/engines/agos/script.cpp index 6f809d9e2d..1dbb9c255a 100644 --- a/engines/agos/script.cpp +++ b/engines/agos/script.cpp @@ -22,6 +22,7 @@ // Item script opcodes for Simon1/Simon2 +#include "common/debug-channels.h" #include "common/endian.h" #include "common/system.h" #include "common/textconsole.h" @@ -987,7 +988,7 @@ int AGOSEngine::runScript() { return 1; do { - if (_dumpOpcodes) + if (DebugMan.isDebugChannelEnabled(kDebugOpcode)) dumpOpcode(_codePtr); if (getGameType() == GType_ELVIRA1) { diff --git a/engines/agos/subroutine.cpp b/engines/agos/subroutine.cpp index 39bc468dea..a54a6c3b49 100644 --- a/engines/agos/subroutine.cpp +++ b/engines/agos/subroutine.cpp @@ -564,8 +564,7 @@ restart: else _codePtr += 8; - if (_dumpOpcodes) - debug("; %d", sub->id); + debugC(kDebugOpcode, "; %d", sub->id); result = runScript(); if (result != 0) { break; -- cgit v1.2.3 From be686829469b1007f3dec00f658431774a734189 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sun, 11 May 2014 12:46:55 +0100 Subject: AGOS: Switch VGA opcode debugging to debug flag, rather than level 3. This is now set by --debugflags=vga_opcode rather than -d 3, though it will still require a debug level greater than 0. --- engines/agos/agos.cpp | 3 +-- engines/agos/agos.h | 4 ++-- engines/agos/vga.cpp | 6 +++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp index 8754b11065..809311219f 100644 --- a/engines/agos/agos.cpp +++ b/engines/agos/agos.cpp @@ -146,6 +146,7 @@ AGOSEngine::AGOSEngine(OSystem *system, const AGOSGameDescription *gd) : Engine(system), _rnd("agos"), _gameDescription(gd) { DebugMan.addDebugChannel(kDebugOpcode, "opcode", "Opcode debug level"); + DebugMan.addDebugChannel(kDebugVGAOpcode, "vga_opcode", "VGA Opcode debug level"); _vcPtr = 0; _vcGetOutOfCode = 0; @@ -248,7 +249,6 @@ AGOSEngine::AGOSEngine(OSystem *system, const AGOSGameDescription *gd) _dumpScripts = false; _dumpVgaScripts = false; - _dumpVgaOpcodes = false; _dumpImages = false; _copyProtection = false; @@ -678,7 +678,6 @@ Common::Error AGOSEngine::init() { // TODO: Use special debug levels instead of the following hack. switch (gDebugLevel) { - case 3: _dumpVgaOpcodes = true; break; case 4: _dumpScripts = true; break; case 5: _dumpVgaScripts = true; break; } diff --git a/engines/agos/agos.h b/engines/agos/agos.h index c23f16b690..cfe84deaeb 100644 --- a/engines/agos/agos.h +++ b/engines/agos/agos.h @@ -62,7 +62,8 @@ struct Surface; namespace AGOS { enum { - kDebugOpcode = 1 << 0 + kDebugOpcode = 1 << 0, + kDebugVGAOpcode = 1 << 1 }; uint fileReadItemID(Common::SeekableReadStream *in); @@ -334,7 +335,6 @@ protected: bool _pause; bool _dumpScripts; bool _dumpVgaScripts; - bool _dumpVgaOpcodes; bool _dumpImages; bool _speech; bool _subtitles; diff --git a/engines/agos/vga.cpp b/engines/agos/vga.cpp index c656c0167a..31191792a1 100644 --- a/engines/agos/vga.cpp +++ b/engines/agos/vga.cpp @@ -27,6 +27,7 @@ #include "agos/intern.h" #include "agos/vga.h" +#include "common/debug-channels.h" #include "common/endian.h" #include "common/system.h" #include "common/textconsole.h" @@ -152,7 +153,7 @@ void AGOSEngine::runVgaScript() { for (;;) { uint opcode; - if (_dumpVgaOpcodes) { + if (DebugMan.isDebugChannelEnabled(kDebugVGAOpcode)) { if (_vcPtr != (const byte *)&_vcGetOutOfCode) { debugN("%.5d %.5X: %5d %4d ", _vgaTickCounter, (unsigned int)(_vcPtr - _curVgaFile1), _vgaCurSpriteId, _vgaCurZoneNum); dumpVideoScript(_vcPtr, true); @@ -381,8 +382,7 @@ void AGOSEngine::vcSkipNextInstruction() { _vcPtr += opcodeParamLenPN[opcode]; } - if (_dumpVgaOpcodes) - debugN("; skipped\n"); + debugCN(kDebugVGAOpcode, "; skipped\n"); } // VGA Script commands -- cgit v1.2.3 From 0c9390fb271bf49377443d9712a270ada4210249 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sun, 11 May 2014 13:15:53 +0100 Subject: AGOS: Remove leftover unused _debugMode variable. --- engines/agos/agos.h | 1 - 1 file changed, 1 deletion(-) diff --git a/engines/agos/agos.h b/engines/agos/agos.h index cfe84deaeb..3eff6a889f 100644 --- a/engines/agos/agos.h +++ b/engines/agos/agos.h @@ -329,7 +329,6 @@ protected: bool _fastMode; bool _backFlag; - uint16 _debugMode; Common::Language _language; bool _copyProtection; bool _pause; -- cgit v1.2.3 From 55d8a461774f24db3f6f9a428469ca11353707e5 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sun, 11 May 2014 13:17:16 +0100 Subject: AGOS: Switch script debugging to debug flag, rather than level 4. This is now set by --debugflags=script rather than -d 4, though it will still require a debug level greater than 0. --- engines/agos/agos.cpp | 3 +-- engines/agos/agos.h | 4 ++-- engines/agos/subroutine.cpp | 5 ++--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp index 809311219f..cf444bc84d 100644 --- a/engines/agos/agos.cpp +++ b/engines/agos/agos.cpp @@ -147,6 +147,7 @@ AGOSEngine::AGOSEngine(OSystem *system, const AGOSGameDescription *gd) DebugMan.addDebugChannel(kDebugOpcode, "opcode", "Opcode debug level"); DebugMan.addDebugChannel(kDebugVGAOpcode, "vga_opcode", "VGA Opcode debug level"); + DebugMan.addDebugChannel(kDebugScript, "script", "Script debug level"); _vcPtr = 0; _vcGetOutOfCode = 0; @@ -247,7 +248,6 @@ AGOSEngine::AGOSEngine(OSystem *system, const AGOSGameDescription *gd) _backFlag = false; - _dumpScripts = false; _dumpVgaScripts = false; _dumpImages = false; @@ -678,7 +678,6 @@ Common::Error AGOSEngine::init() { // TODO: Use special debug levels instead of the following hack. switch (gDebugLevel) { - case 4: _dumpScripts = true; break; case 5: _dumpVgaScripts = true; break; } diff --git a/engines/agos/agos.h b/engines/agos/agos.h index 3eff6a889f..e1d7a54a75 100644 --- a/engines/agos/agos.h +++ b/engines/agos/agos.h @@ -63,7 +63,8 @@ namespace AGOS { enum { kDebugOpcode = 1 << 0, - kDebugVGAOpcode = 1 << 1 + kDebugVGAOpcode = 1 << 1, + kDebugScript = 1 << 2 }; uint fileReadItemID(Common::SeekableReadStream *in); @@ -332,7 +333,6 @@ protected: Common::Language _language; bool _copyProtection; bool _pause; - bool _dumpScripts; bool _dumpVgaScripts; bool _dumpImages; bool _speech; diff --git a/engines/agos/subroutine.cpp b/engines/agos/subroutine.cpp index a54a6c3b49..f7eec9caaa 100644 --- a/engines/agos/subroutine.cpp +++ b/engines/agos/subroutine.cpp @@ -20,8 +20,7 @@ * */ - - +#include "common/debug-channels.h" #include "common/file.h" #include "common/textconsole.h" @@ -531,7 +530,7 @@ int AGOSEngine::startSubroutine(Subroutine *sub) { _classMode1 = 0; _classMode2 = 0; - if (_dumpScripts) + if (DebugMan.isDebugChannelEnabled(kDebugScript)) dumpSubroutine(sub); if (++_recursionDepth > 40) -- cgit v1.2.3 From 41da9a2df798112cc71bae401ed0202e3a605ea7 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sun, 11 May 2014 13:28:33 +0100 Subject: AGOS: Change "script" debugflag to "subroutine" as more accurate. This flag is used to enable dumping of subroutine scripts at start. --- engines/agos/agos.cpp | 2 +- engines/agos/agos.h | 2 +- engines/agos/subroutine.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp index cf444bc84d..8763872c41 100644 --- a/engines/agos/agos.cpp +++ b/engines/agos/agos.cpp @@ -147,7 +147,7 @@ AGOSEngine::AGOSEngine(OSystem *system, const AGOSGameDescription *gd) DebugMan.addDebugChannel(kDebugOpcode, "opcode", "Opcode debug level"); DebugMan.addDebugChannel(kDebugVGAOpcode, "vga_opcode", "VGA Opcode debug level"); - DebugMan.addDebugChannel(kDebugScript, "script", "Script debug level"); + DebugMan.addDebugChannel(kDebugSubroutine, "subroutine", "Subroutine debug level"); _vcPtr = 0; _vcGetOutOfCode = 0; diff --git a/engines/agos/agos.h b/engines/agos/agos.h index e1d7a54a75..43afdb7740 100644 --- a/engines/agos/agos.h +++ b/engines/agos/agos.h @@ -64,7 +64,7 @@ namespace AGOS { enum { kDebugOpcode = 1 << 0, kDebugVGAOpcode = 1 << 1, - kDebugScript = 1 << 2 + kDebugSubroutine = 1 << 2 }; uint fileReadItemID(Common::SeekableReadStream *in); diff --git a/engines/agos/subroutine.cpp b/engines/agos/subroutine.cpp index f7eec9caaa..1e6ecaa829 100644 --- a/engines/agos/subroutine.cpp +++ b/engines/agos/subroutine.cpp @@ -530,7 +530,7 @@ int AGOSEngine::startSubroutine(Subroutine *sub) { _classMode1 = 0; _classMode2 = 0; - if (DebugMan.isDebugChannelEnabled(kDebugScript)) + if (DebugMan.isDebugChannelEnabled(kDebugSubroutine)) dumpSubroutine(sub); if (++_recursionDepth > 40) -- cgit v1.2.3 From 3d3a79108514d1e5b10fc079246501925b1bc813 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sun, 11 May 2014 15:25:58 +0100 Subject: AGOS: Switch VGA script debug output to debug flag, rather than level 5. This is now set by --debugflags=vga_script rather than -d 5, though it will still require a debug level greater than 0. --- engines/agos/agos.cpp | 7 +------ engines/agos/agos.h | 4 ++-- engines/agos/gfx.cpp | 5 +++-- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp index 8763872c41..0ee6bb538f 100644 --- a/engines/agos/agos.cpp +++ b/engines/agos/agos.cpp @@ -148,6 +148,7 @@ AGOSEngine::AGOSEngine(OSystem *system, const AGOSGameDescription *gd) DebugMan.addDebugChannel(kDebugOpcode, "opcode", "Opcode debug level"); DebugMan.addDebugChannel(kDebugVGAOpcode, "vga_opcode", "VGA Opcode debug level"); DebugMan.addDebugChannel(kDebugSubroutine, "subroutine", "Subroutine debug level"); + DebugMan.addDebugChannel(kDebugVGAScript, "vga_script", "VGA Script debug level"); _vcPtr = 0; _vcGetOutOfCode = 0; @@ -248,7 +249,6 @@ AGOSEngine::AGOSEngine(OSystem *system, const AGOSGameDescription *gd) _backFlag = false; - _dumpVgaScripts = false; _dumpImages = false; _copyProtection = false; @@ -676,11 +676,6 @@ Common::Error AGOSEngine::init() { _subtitles = true; } - // TODO: Use special debug levels instead of the following hack. - switch (gDebugLevel) { - case 5: _dumpVgaScripts = true; break; - } - return Common::kNoError; } diff --git a/engines/agos/agos.h b/engines/agos/agos.h index 43afdb7740..e2f5100f65 100644 --- a/engines/agos/agos.h +++ b/engines/agos/agos.h @@ -64,7 +64,8 @@ namespace AGOS { enum { kDebugOpcode = 1 << 0, kDebugVGAOpcode = 1 << 1, - kDebugSubroutine = 1 << 2 + kDebugSubroutine = 1 << 2, + kDebugVGAScript = 1 << 3 }; uint fileReadItemID(Common::SeekableReadStream *in); @@ -333,7 +334,6 @@ protected: Common::Language _language; bool _copyProtection; bool _pause; - bool _dumpVgaScripts; bool _dumpImages; bool _speech; bool _subtitles; diff --git a/engines/agos/gfx.cpp b/engines/agos/gfx.cpp index 6e97084811..33145b7d0d 100644 --- a/engines/agos/gfx.cpp +++ b/engines/agos/gfx.cpp @@ -20,6 +20,7 @@ * */ +#include "common/debug-channels.h" #include "common/endian.h" #include "common/system.h" #include "common/textconsole.h" @@ -1129,7 +1130,7 @@ void AGOSEngine::animate(uint16 windowNum, uint16 zoneNum, uint16 vgaSpriteId, i assert(READ_BE_UINT16(&((AnimationHeader_WW *) p)->id) == vgaSpriteId); } - if (_dumpVgaScripts) { + if (DebugMan.isDebugChannelEnabled(kDebugVGAScript)) { if (getGameType() == GType_FF || getGameType() == GType_PP) { dumpVgaScript(_curVgaFile1 + READ_LE_UINT16(&((AnimationHeader_Feeble*)p)->scriptOffs), zoneNum, vgaSpriteId); } else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) { @@ -1235,7 +1236,7 @@ void AGOSEngine::setImage(uint16 vgaSpriteId, bool vgaScript) { } } - if (_dumpVgaScripts) { + if (DebugMan.isDebugChannelEnabled(kDebugVGAScript)) { if (getGameType() == GType_FF || getGameType() == GType_PP) { dumpVgaScript(_curVgaFile1 + READ_LE_UINT16(&((ImageHeader_Feeble*)b)->scriptOffs), zoneNum, vgaSpriteId); } else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) { -- cgit v1.2.3 From bbeb24aaabbea33c54dc8ff6926fd161740f5c25 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 11 May 2014 18:57:35 +0200 Subject: MADS: Implement scene 604 --- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes6.cpp | 433 +++++++++++++++++++++++++------ engines/mads/nebular/nebular_scenes6.h | 26 +- 3 files changed, 376 insertions(+), 85 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 5d937e9a09..d7292020d0 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -231,7 +231,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 603: // Bruce's house, bedroom return new Scene603(vm); case 604: // viewport - return new DummyScene(vm); // TODO + return new Scene604(vm); case 605: // viewport closeup return new DummyScene(vm); // TODO case 607: // outside Abdul's garage diff --git a/engines/mads/nebular/nebular_scenes6.cpp b/engines/mads/nebular/nebular_scenes6.cpp index 49246fbf31..6482eb15cf 100644 --- a/engines/mads/nebular/nebular_scenes6.cpp +++ b/engines/mads/nebular/nebular_scenes6.cpp @@ -100,18 +100,18 @@ void Scene601::enter() { _scene->_dynamicHotspots.add(0x343, 0xD1, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); } - _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1); + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 3); if (_scene->_priorSceneId == 504) { _game._player._playerPos = Common::Point(73, 148); - _game._player._facing = FACING_WEST; - _game._player._visible = false; + _game._player._facing = FACING_WEST; + _game._player._visible = false; _game._player._stepEnabled = false; - _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _scene->_sequences.remove(_globals._sequenceIndexes[2]); _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -2); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 3); - _scene->loadAnimation(formAnimName('R', 1), 70); + _scene->loadAnimation(formAnimName('R', 1), 70); } else if (_scene->_priorSceneId != -2) { _game._player._playerPos = Common::Point(229, 129); _game._player._facing = FACING_SOUTHWEST; @@ -123,7 +123,7 @@ void Scene601::enter() { void Scene601::step() { switch (_game._trigger) { case 70: - _game._player._visible = true; + _game._player._visible = true; _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; _scene->_sequences.addTimer(30, 71); break; @@ -133,13 +133,13 @@ void Scene601::step() { _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 6, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 3); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 72); - break; + break; case 72: - _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1); + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 3); _game._player._stepEnabled = true; - break; + break; default: break; @@ -153,7 +153,7 @@ void Scene601::actions() { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; - _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _scene->_sequences.remove(_globals._sequenceIndexes[2]); _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 6, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 3); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 1); @@ -161,14 +161,14 @@ void Scene601::actions() { case 1: { int syncIdx = _globals._sequenceIndexes[2]; - _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -2); + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -2); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], syncIdx); _scene->_sequences.addTimer(6, 2); } break; case 2: - _game._player._visible = false; + _game._player._visible = false; _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 10, 1, 0, 0); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 3); @@ -178,7 +178,7 @@ void Scene601::actions() { int syncIdx = _globals._sequenceIndexes[3]; _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -2); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); - _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], syncIdx); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], syncIdx); _scene->_nextSceneId = 504; } break; @@ -237,27 +237,27 @@ void Scene602::enter() { if (_globals[kLaserHoleIsThere]) { _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); - _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 9); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 9); _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); - _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 9); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 9); int idx = _scene->_dynamicHotspots.add(0x343, VERB_WALKTO, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(80, 134), FACING_NORTHEAST); _scene->changeVariant(1); } else - _scene->_hotspots.activate(0x342, false); - - if (_globals[kSafeStatus] == 0) { - _lastSpriteIdx = _globals._spriteIndexes[2]; - _cycleIndex = -1; - } else if (_globals[kSafeStatus] == 1) { - _lastSpriteIdx = _globals._spriteIndexes[2]; - _cycleIndex = -2; - } else if (_globals[kSafeStatus] == 3) { - _lastSpriteIdx = _globals._spriteIndexes[3]; - _cycleIndex = -2; + _scene->_hotspots.activate(0x342, false); + + if (_globals[kSafeStatus] == 0) { + _lastSpriteIdx = _globals._spriteIndexes[2]; + _cycleIndex = -1; + } else if (_globals[kSafeStatus] == 1) { + _lastSpriteIdx = _globals._spriteIndexes[2]; + _cycleIndex = -2; + } else if (_globals[kSafeStatus] == 3) { + _lastSpriteIdx = _globals._spriteIndexes[3]; + _cycleIndex = -2; } else { - _lastSpriteIdx = _globals._spriteIndexes[3]; - _cycleIndex = -1; + _lastSpriteIdx = _globals._spriteIndexes[3]; + _cycleIndex = -1; } _lastSequenceIdx = _scene->_sequences.startCycle(_lastSpriteIdx, false, _cycleIndex); @@ -266,21 +266,21 @@ void Scene602::enter() { _scene->_dynamicHotspots.setPosition(idx, Common::Point(185, 113), FACING_NORTHWEST); if (_game._objects.isInRoom(OBJ_DOOR_KEY)) { - _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('k', -1)); + _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('k', -1)); _globals._sequenceIndexes[6] = _scene->_sequences.startCycle(_globals._spriteIndexes[6], false, -1); _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 15); if (_globals[kSafeStatus] == 0 || _globals[kSafeStatus] == 2) - _scene->_hotspots.activate(0x6F, false); + _scene->_hotspots.activate(0x6F, false); } else _scene->_hotspots.activate(0x6F, false); if (_scene->_priorSceneId == 603) { _game._player._playerPos = Common::Point(228, 126); - _game._player._facing = FACING_WEST; + _game._player._facing = FACING_WEST; } else if (_scene->_priorSceneId != -2) { _game._player._playerPos = Common::Point(50, 127); - _game._player._facing = FACING_EAST; - } + _game._player._facing = FACING_EAST; + } sceneEntrySound(); _game.loadQuoteSet(0x2F1, 0x2F2, 0x2F3, 0); @@ -295,9 +295,9 @@ void Scene602::enter() { void Scene602::handleSafeActions() { switch (_game._trigger) { case 0: - _game._player._stepEnabled = false; - _game._player._visible = false; - _globals._sequenceIndexes[5] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[5], true, 12, 1, 0, 0); + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[5] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[5], true, 12, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 1, 3); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_SPRITE, 3, 1); @@ -313,14 +313,14 @@ void Scene602::handleSafeActions() { } else { _scene->_sequences.remove(_lastSequenceIdx); if (_safeMode == 3) - _lastSpriteIdx = _globals._spriteIndexes[2]; + _lastSpriteIdx = _globals._spriteIndexes[2]; else - _lastSpriteIdx = _globals._spriteIndexes[3]; + _lastSpriteIdx = _globals._spriteIndexes[3]; _lastSequenceIdx = _scene->_sequences.addSpriteCycle(_lastSpriteIdx, false, 12, 1, 0, 0); _scene->_sequences.setDepth(_lastSequenceIdx, 14); if (_game._objects[OBJ_DOOR_KEY]._roomNumber == _scene->_currentSceneId) - _scene->_hotspots.activate(0x6F, true); + _scene->_hotspots.activate(0x6F, true); _scene->_sequences.addSubEntry(_lastSequenceIdx, SEQUENCE_TRIGGER_EXPIRE, 0, 2); @@ -335,52 +335,52 @@ void Scene602::handleSafeActions() { _lastSequenceIdx = _scene->_sequences.startReverseCycle(_lastSpriteIdx, false, 12, 1, 0, 0); _scene->_sequences.setDepth(_lastSequenceIdx, 14); if (_game._objects[OBJ_DOOR_KEY]._roomNumber == _scene->_currentSceneId) - _scene->_hotspots.activate(0x6F, false); + _scene->_hotspots.activate(0x6F, false); _scene->_sequences.addSubEntry(_lastSequenceIdx, SEQUENCE_TRIGGER_EXPIRE, 0, 2); - } - break; + } + break; case 2: { - int synxIdx = _lastSequenceIdx; + int synxIdx = _lastSequenceIdx; _lastSequenceIdx = _scene->_sequences.startCycle(_lastSpriteIdx, false, _cycleIndex); _scene->_sequences.setDepth(_lastSequenceIdx, 14); _scene->_sequences.updateTimeout(_lastSequenceIdx, synxIdx); int idx = _scene->_dynamicHotspots.add(0x3D3, VERB_WALKTO, _lastSequenceIdx, Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(185, 113), FACING_NORTHWEST); - if (_safeMode == 3) { + if (_safeMode == 3) { _scene->_kernelMessages.reset(); _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x2F3)); _scene->_sequences.addTimer(120, 4); } else _scene->_sequences.addTimer(60, 4); - break; + break; } case 3: _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[5]); - _game._player._visible = true; - break; + _game._player._visible = true; + break; case 4: - if (_safeMode == 1) { + if (_safeMode == 1) { if (_globals[kSafeStatus] == 2) _globals[kSafeStatus] = 3; - } else if (_safeMode == 2) { + } else if (_safeMode == 2) { if (_globals[kSafeStatus] == 3) _globals[kSafeStatus] = 2; else _globals[kSafeStatus] = 0; } else - _globals[kSafeStatus] = 1; + _globals[kSafeStatus] = 1; _game._player._stepEnabled = true; break; default: break; - } -} + } +} void Scene602::actions() { if (_action.isAction(0x18B, 0x1F9)) @@ -400,29 +400,29 @@ void Scene602::actions() { _safeMode = 3; _cycleIndex = -2; handleSafeActions(); - } + } } else if ((_action.isAction(VERB_PUT, 0x120, 0x343) || _action.isAction(VERB_PUT, 0x57, 0x343) - || _action.isAction(0x365, 0x57, 0x343) || _action.isAction(0x365, 0x120, 0x343)) && (_globals[kSafeStatus] == 0)) { + || _action.isAction(0x365, 0x57, 0x343) || _action.isAction(0x365, 0x120, 0x343)) && (_globals[kSafeStatus] == 0)) { switch (_game._trigger) { case 0: _vm->_dialogs->show(60230); - _game._player._stepEnabled = false; - _game._player._visible = false; - _scene->_sequences.remove(_globals._sequenceIndexes[4]); + _game._player._stepEnabled = false; + _game._player._visible = false; + _scene->_sequences.remove(_globals._sequenceIndexes[4]); _scene->_sequences.remove(_lastSequenceIdx); _scene->loadAnimation(formAnimName('L', 1), 1); break; case 1: { - _game._player._visible = true; + _game._player._visible = true; _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; - _lastSpriteIdx = _globals._spriteIndexes[3]; + _lastSpriteIdx = _globals._spriteIndexes[3]; _lastSequenceIdx = _scene->_sequences.startCycle(_lastSpriteIdx, false, -1); _scene->_sequences.setDepth(_lastSequenceIdx, 14); int idx = _scene->_dynamicHotspots.add(0x3D3, VERB_WALKTO, _lastSequenceIdx, Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(185, 113), FACING_NORTHWEST); _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); - _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 9); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 9); idx = _scene->_dynamicHotspots.add(0x343, VERB_WALKTO, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(80, 134), FACING_NORTHEAST); _scene->_sequences.addTimer(60, 2); @@ -432,8 +432,8 @@ void Scene602::actions() { case 2: _scene->_kernelMessages.reset(); _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x2F2)); - _globals[kSafeStatus] = 2; - _game._player._stepEnabled = true; + _globals[kSafeStatus] = 2; + _game._player._stepEnabled = true; break; default: @@ -442,9 +442,9 @@ void Scene602::actions() { } else if (_action.isAction(VERB_TAKE, 0x6F) && (_game._trigger || _game._objects.isInRoom(OBJ_DOOR_KEY))) { switch (_game._trigger) { case 0: - _game._player._stepEnabled = false; - _game._player._visible = false; - _globals._sequenceIndexes[5] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[5], true, 8, 1, 0, 0); + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[5] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[5], true, 8, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 1, 3); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_SPRITE, 3, 1); @@ -452,7 +452,7 @@ void Scene602::actions() { break; case 1: - _scene->_sequences.remove(_globals._sequenceIndexes[6]); + _scene->_sequences.remove(_globals._sequenceIndexes[6]); _scene->_hotspots.activate(0x6F, false); _vm->_sound->command(9); _game._objects.addToInventory(OBJ_DOOR_KEY); @@ -460,14 +460,14 @@ void Scene602::actions() { case 2: _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[5]); - _game._player._visible = true; + _game._player._visible = true; _game._player._stepEnabled = true; _vm->_dialogs->showItem(OBJ_DOOR_KEY, 835); break; default: break; - } + } } else if (_action._lookFlag) _vm->_dialogs->show(60210); else if (_action.isAction(VERB_LOOK, 0x89)) @@ -550,7 +550,7 @@ void Scene603::enter() { if ((_game._difficulty != DIFFICULTY_HARD) && (_game._objects[OBJ_NOTE]._roomNumber == _scene->_currentSceneId)) { _globals._spriteIndexes[3] = _scene->_sprites.addSprites("*RXMRC_9"); - _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('p', -1)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('p', -1)); _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14); _noteHotspotId = _scene->_dynamicHotspots.add(0x3A8, VERB_WALKTO, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); @@ -570,9 +570,9 @@ void Scene603::actions() { if ( _game._trigger || !_game._objects.isInInventory(OBJ_COMPACT_CASE)) { switch (_game._trigger) { case 0: - _game._player._stepEnabled = false; - _game._player._visible = false; - _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 8, 1, 0, 0); + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 8, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 1, 5); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_SPRITE, 5, 1); @@ -581,7 +581,7 @@ void Scene603::actions() { case 1: _vm->_sound->command(9); - _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _scene->_sequences.remove(_globals._sequenceIndexes[1]); _scene->_dynamicHotspots.remove(_compactCaseHotspotId); _game._objects.addToInventory(OBJ_COMPACT_CASE); _vm->_dialogs->showItem(OBJ_COMPACT_CASE, 60330); @@ -589,32 +589,32 @@ void Scene603::actions() { case 2: _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[4]); - _game._player._visible = true; + _game._player._visible = true; _game._player._stepEnabled = true; break; default: break; - } + } } } else if (_action.isAction(VERB_TAKE, 0x3A8)) { if ( _game._trigger || !_game._objects.isInInventory(OBJ_NOTE)) { if (_game._trigger == 0) { - _game._player._stepEnabled = false; - _game._player._visible = false; - _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); - _scene->_sequences.addTimer (15, 1); + _scene->_sequences.addTimer(15, 1); } else if (_game._trigger == 1) { _vm->_sound->command(9); - _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _scene->_sequences.remove(_globals._sequenceIndexes[2]); _scene->_dynamicHotspots.remove(_noteHotspotId); _game._objects.addToInventory(OBJ_NOTE); - _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _scene->_sequences.remove(_globals._sequenceIndexes[3]); _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; - _game._player._visible = true; + _game._player._visible = true; _game._player._stepEnabled = true; - } + } } } else if (_action._lookFlag) _vm->_dialogs->show(60310); @@ -672,5 +672,272 @@ void Scene603::actions() { /*------------------------------------------------------------------------*/ +void Scene604::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(0x468); + _scene->addActiveVocab(VERB_WALKTO); + _scene->addActiveVocab(0x171); +} + +void Scene604::enter() { + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('c', 0)); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites("*RXCD_9"); + _globals._spriteIndexes[6] = _scene->_sprites.addSprites(Resources::formatName(620, 'b', 0, EXT_SS, "")); + _globals._spriteIndexes[5] = _scene->_sprites.addSprites("*RXMRC_9"); + + if (_globals[kTimebombStatus] == 1) { + _globals._sequenceIndexes[6] = _scene->_sequences.startCycle(_globals._spriteIndexes[6], false, -1); + _timebombHotspotId = _scene->_dynamicHotspots.add(0x171, VERB_WALKTO, _globals._sequenceIndexes[6], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(_timebombHotspotId, Common::Point(166, 118), FACING_NORTHEAST); + } + + if (_scene->_roomChanged) + _game._objects.addToInventory(OBJ_TIMEBOMB); + + _vm->_palette->setEntry(252, 63, 37, 26); + _vm->_palette->setEntry(253, 45, 24, 17); + _animationActiveFl = false; + + if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(72, 149); + _game._player._facing = FACING_NORTHEAST; + _game._player._visible = false; + _game._player._stepEnabled = false; + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); + _scene->loadAnimation(formAnimName('R', 1), 70); + _animationActiveFl = true; + } else { + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); + } + + _monsterTimer = _scene->_frameStartTime; + _monsterActive = false; + + sceneEntrySound(); + _game.loadQuoteSet(0x2E7, 0x2E8, 0x2E9, 0x2EA, 0x2EB, 0x2EC, 0x2ED, 0x2EE, 0x2EF, 0x2F0, 0); +} + +void Scene604::step() { + switch (_game._trigger) { + case 70: + _game._player._visible = true; + _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; + _scene->_sequences.addTimer(30, 71); + break; + + case 71: + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 72); + break; + + case 72: + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); + _game._player._stepEnabled = true; + _animationActiveFl = false; + break; + + default: + break; + } + + if (_monsterActive && (_scene->_activeAnimation != nullptr)) { + if (_scene->_activeAnimation->getCurrentFrame() != _monsterFrame) { + _monsterFrame = _scene->_activeAnimation->getCurrentFrame(); + int nextMonsterFrame = -1; + + switch (_monsterFrame) { + case 50: + case 137: + case 174: { + int randVal = _vm->getRandomNumber(1, 1000); + if ((randVal <= 450) && (_game._player._special)) { + if (_game._player._special == 1) + nextMonsterFrame = 50; + else if (_game._player._special == 2) + nextMonsterFrame = 84; + else + nextMonsterFrame = 137; + } else if (randVal <= 150) + nextMonsterFrame = 50; + else if (randVal <= 300) + nextMonsterFrame = 84; + else if (randVal <= 450) + nextMonsterFrame = 137; + else if (randVal < 750) + nextMonsterFrame = 13; + else + nextMonsterFrame = 114; + + } + break; + + case 84: + nextMonsterFrame = 14; + break; + + default: + break; + } + + if ((nextMonsterFrame >= 0) && (nextMonsterFrame != _monsterFrame)) { + _scene->_activeAnimation->setCurrentFrame(nextMonsterFrame); + _monsterFrame = nextMonsterFrame; + } + } + } + + if ((!_monsterActive && !_animationActiveFl) && (_scene->_frameStartTime > (_monsterTimer + 4))) { + _monsterTimer = _scene->_frameStartTime; + if ((_vm->getRandomNumber(1, 1000) < 25) || !_game._visitedScenes._sceneRevisited) { + _monsterActive = true; + _scene->freeAnimation(); + _scene->loadAnimation(formAnimName('m', -1)); + } + } +} + +void Scene604::handleBombActions() { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[5] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[5], false, 9, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 1, 3); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); + if (_bombMode == 1) + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_SPRITE, 3, 1); + else + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_SPRITE, 3, 2); + + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 3); + break; + + case 1: + _globals._sequenceIndexes[6] = _scene->_sequences.startCycle(_globals._spriteIndexes[6], false, -1); + _timebombHotspotId = _scene->_dynamicHotspots.add (0x171, VERB_WALKTO, _globals._sequenceIndexes[6], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(_timebombHotspotId, Common::Point(166, 118), FACING_NORTHEAST); + _game._objects.setRoom(OBJ_TIMEBOMB, _scene->_currentSceneId); + break; + + case 2: + _scene->_sequences.remove(_globals._sequenceIndexes[6]); + _scene->_dynamicHotspots.remove(_timebombHotspotId); + _game._objects.addToInventory(OBJ_TIMEBOMB); + break; + + case 3: + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[5]); + _game._player._visible = true; + _game._player._stepEnabled = true; + if (_bombMode == 1) { + _vm->_dialogs->show(60421); + _globals[kTimebombStatus] = TIMEBOMB_ACTIVATED; + _globals[kTimebombTimer] = 0; + } else { + _vm->_dialogs->show(60423); + _globals[kTimebombStatus] = TIMEBOMB_DEACTIVATED; + _globals[kTimebombTimer] = 0; + } + break; + + default: + break; + } +} + +void Scene604::actions() { + if (_action.isAction(0x325, 0x324)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 1); + break; + + case 1: { + int syncIdx = _globals._sequenceIndexes[2]; + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], syncIdx); + _scene->_sequences.addTimer(6, 2); + } + break; + + case 2: + _game._player._visible = false; + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 10, 1, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 3); + break; + + case 3: { + int syncIdx = _globals._sequenceIndexes[4]; + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, -2); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], syncIdx); + _scene->_nextSceneId = 504; + } + break; + + default: + break; + } + } else if ((_action.isAction(VERB_PUT, 0x3F6) || _action.isAction(VERB_PUT, 0x181) || _action.isAction(VERB_THROW, 0x181)) + && (_action.isAction(0x2A) || _action.isAction(0x2B))) + _vm->_dialogs->show(60420); + else if (_action.isAction(VERB_PUT, 0x171, 0x3F6) || _action.isAction(VERB_PUT, 0x171, 0x181)) { + _bombMode = 1; + if ((_game._difficulty == DIFFICULTY_HARD) || _globals[kWarnedFloodCity]) + handleBombActions(); + else if ((_game._objects.isInInventory(OBJ_POLYCEMENT) && _game._objects.isInInventory(OBJ_CHICKEN)) + && ((_globals[kLineStatus] == LINE_TIED) || ((_game._difficulty == DIFFICULTY_EASY) && (!_globals[kBoatRaised])))) + handleBombActions(); + else if (_game._difficulty == DIFFICULTY_EASY) + _vm->_dialogs->show(60424); + else { + _vm->_dialogs->show(60425); + _globals[kWarnedFloodCity] = true; + } + } else if (_action.isAction(VERB_TAKE, 0x171)) { + if (_game._trigger || !_game._objects.isInInventory(OBJ_TIMEBOMB)) { + _bombMode = 2; + handleBombActions(); + } + } else if (_action._lookFlag) + _vm->_dialogs->show(60411); + else if (_action.isAction(VERB_LOOK, 0x181)) { + if (_monsterActive) { + _vm->_dialogs->show(60413); + } else { + _vm->_dialogs->show(60412); + } + } else if (_action.isAction(VERB_LOOK, 0x18D)) + _vm->_dialogs->show(60414); + else if (_action.isAction(VERB_LOOK, 0x3F4)) + _vm->_dialogs->show(60415); + else if (_action.isAction(VERB_LOOK, 0x479)) + _vm->_dialogs->show(60416); + else if (_action.isAction(VERB_LOOK, 0x3F2)) + _vm->_dialogs->show(60417); + else if (_action.isAction(VERB_LOOK, 0x324)) + _vm->_dialogs->show(60418); + else if (_action.isAction(VERB_LOOK, 0x3C4)) + _vm->_dialogs->show(60419); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes6.h b/engines/mads/nebular/nebular_scenes6.h index cf69f59e6e..c32daa47d9 100644 --- a/engines/mads/nebular/nebular_scenes6.h +++ b/engines/mads/nebular/nebular_scenes6.h @@ -11,7 +11,7 @@ * 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 + * 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 @@ -98,6 +98,30 @@ public: virtual void postActions() {}; }; +class Scene604: public Scene6xx{ +private: + int _timebombHotspotId; + int _bombMode; + int _monsterFrame; + + uint32 _monsterTimer; + + bool _monsterActive; + bool _animationActiveFl; + + void handleBombActions(); + +public: + Scene604(MADSEngine *vm) : Scene6xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions(); + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 3b098867961e4d34fc93cac989d3bd5f69f71ed8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 11 May 2014 19:14:11 +0200 Subject: MADS: Implement scene 605 --- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes6.cpp | 46 ++++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes6.h | 11 ++++++++ 3 files changed, 58 insertions(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index d7292020d0..511be8e5ca 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -233,7 +233,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 604: // viewport return new Scene604(vm); case 605: // viewport closeup - return new DummyScene(vm); // TODO + return new Scene605(vm); case 607: // outside Abdul's garage return new DummyScene(vm); // TODO case 608: // inside Abdul's garage diff --git a/engines/mads/nebular/nebular_scenes6.cpp b/engines/mads/nebular/nebular_scenes6.cpp index 6482eb15cf..ebface6e1f 100644 --- a/engines/mads/nebular/nebular_scenes6.cpp +++ b/engines/mads/nebular/nebular_scenes6.cpp @@ -939,5 +939,51 @@ void Scene604::actions() { /*------------------------------------------------------------------------*/ +void Scene605::setup() { + _game._player._spritesPrefix = ""; + setAAName(); +} + +void Scene605::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('r', -1)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('b', -1)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('l', -1)); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('p', -1)); + _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('n', -1)); + _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('f', -1)); + + _globals._sequenceIndexes[1] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 15, 0, 0, 0); + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 17, 0, 0, 0); + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 14, 0, 0, 0); + _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 13, 0, 0, 0); + _globals._sequenceIndexes[5] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[5], false, 17, 0, 0, 0); + _globals._sequenceIndexes[6] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[6], false, 18, 0, 0, 0); + + _game._player._visible = false; + _game._player._stepEnabled = false; + _scene->_sequences.addTimer(600, 70); + _scene->_userInterface.setup(kInputLimitedSentences); + sceneEntrySound(); + _vm->_sound->command(22); +} + +void Scene605::step() { + if (_game._trigger == 70) { + _vm->_sound->command(23); + if (_globals[kResurrectRoom] >= 700) + _vm->_dialogs->show(60598); + else + _vm->_dialogs->show(60599); + + _scene->_nextSceneId = _globals[kResurrectRoom]; + } +} + +void Scene605::actions() { + return; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes6.h b/engines/mads/nebular/nebular_scenes6.h index c32daa47d9..9347b40092 100644 --- a/engines/mads/nebular/nebular_scenes6.h +++ b/engines/mads/nebular/nebular_scenes6.h @@ -122,6 +122,17 @@ public: virtual void postActions() {}; }; +class Scene605: public Scene6xx{ +public: + Scene605(MADSEngine *vm) : Scene6xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions(); + virtual void postActions() {}; +}; } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From e21534ecc2d39864d2cb3ba67248ad0dadecf72e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 11 May 2014 23:50:52 +0200 Subject: MADS: Implement scene 607 --- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes6.cpp | 435 ++++++++++++++++++++++++++++++- engines/mads/nebular/nebular_scenes6.h | 27 ++ 3 files changed, 462 insertions(+), 2 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 511be8e5ca..7c5700ad72 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -235,7 +235,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 605: // viewport closeup return new Scene605(vm); case 607: // outside Abdul's garage - return new DummyScene(vm); // TODO + return new Scene607(vm); case 608: // inside Abdul's garage return new DummyScene(vm); // TODO case 609: // outside Buckluster video store diff --git a/engines/mads/nebular/nebular_scenes6.cpp b/engines/mads/nebular/nebular_scenes6.cpp index ebface6e1f..46ef066c97 100644 --- a/engines/mads/nebular/nebular_scenes6.cpp +++ b/engines/mads/nebular/nebular_scenes6.cpp @@ -820,7 +820,7 @@ void Scene604::handleBombActions() { case 1: _globals._sequenceIndexes[6] = _scene->_sequences.startCycle(_globals._spriteIndexes[6], false, -1); - _timebombHotspotId = _scene->_dynamicHotspots.add (0x171, VERB_WALKTO, _globals._sequenceIndexes[6], Common::Rect(0, 0, 0, 0)); + _timebombHotspotId = _scene->_dynamicHotspots.add(0x171, VERB_WALKTO, _globals._sequenceIndexes[6], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(_timebombHotspotId, Common::Point(166, 118), FACING_NORTHEAST); _game._objects.setRoom(OBJ_TIMEBOMB, _scene->_currentSceneId); break; @@ -985,5 +985,438 @@ void Scene605::actions() { /*------------------------------------------------------------------------*/ +void Scene607::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(0x471); + _scene->addActiveVocab(VERB_WALKTO); +} + +void Scene607::enter() { + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('c', 0)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites("*RXCD_3"); + + if (!_game._visitedScenes._sceneRevisited && (_scene->_priorSceneId != 608)) + _globals[kDogStatus] = 1; + + if ((_scene->_priorSceneId == 608) && (_globals[kDogStatus] < 3)) + _globals[kDogStatus] = 3; + + _animationActive = 0; + + if ((_globals[kDogStatus] == 1) && (_game._difficulty != DIFFICULTY_EASY)) { + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('g', 3)); + _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('g', 7)); + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('g', 0)); + + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 6); + _dogBarking = false; + _dogLoop = false; + _shopAvailable = false; + _dogEatsRex = false; + _dogTimer = 0; + } else + _scene->_hotspots.activate(0x471, false); + + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); + + if (_scene->_priorSceneId == 608) { + _game._player._playerPos = Common::Point(297, 50); + _game._player._facing = FACING_SOUTHEAST; + } else if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(40, 104); + _game._player._facing = FACING_SOUTHEAST; + _game._player._visible = false; + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); + _scene->loadAnimation(formAnimName('R', 1), 80); + } else if (_globals[kDogStatus] == 2) { + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('g', 3)); + _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('g', 7)); + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('g', 0)); + } + + sceneEntrySound(); + + if (_scene->_roomChanged) + _game._objects.addToInventory(OBJ_BONES); + + _vm->_palette->setEntry(252, 63, 44, 30); + _vm->_palette->setEntry(253, 63, 20, 22); + _game.loadQuoteSet(0x2F8, 0x2F7, 0x2F6, 0x2F9, 0x2FA, 0); +} + +void Scene607::step() { + if (_globals[kDogStatus] == 2) { + int32 diff = _scene->_frameStartTime - _lastFrameTime; + if ((diff >= 0) && (diff <= 4)) + _dogTimer += diff; + else + _dogTimer++; + + _lastFrameTime = _scene->_frameStartTime; + } + + if ((_dogTimer >= 480) && !_dogLoop && !_shopAvailable && (_globals[kDogStatus] == 2) && !_game._player._special) { + _vm->_sound->command(14); + _dogLoop = true; + _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 10, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 91); + _dogLoop = false; + _dogTimer = 0; + } + + if (_game._trigger == 91) { + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 6); + _dogBarking = false; + _globals[kDogStatus] = 1; + _scene->_hotspots.activate(0x471, true); + } + + if (!_dogEatsRex && (_game._difficulty != DIFFICULTY_EASY) && !_animationActive && (_globals[kDogStatus] == 1) + && !_dogBarking && (_vm->getRandomNumber(1, 50) == 10)) { + _dogBarking = true; + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 5, 8, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 6); + _scene->_kernelMessages.reset(); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_SPRITE, 2, 100); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 70); + _counter = 0; + } + + if ((_game._trigger == 70) && !_dogEatsRex && (_globals[kDogStatus] == 1) && !_animationActive) { + int syncIdx = _globals._sequenceIndexes[1]; + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 6); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[1], syncIdx); + _scene->_kernelMessages.reset(); + _dogBarking = false; + } + + if (_game._trigger == 100) { + _counter++; + _vm->_sound->command(12); + + if ((_counter >= 1) && (_counter <= 4)) { + Common::Point pos(0, 0); + switch (_counter) { + case 1: + pos = Common::Point(237, 5); + break; + + case 2: + pos = Common::Point(270, 15); + break; + + case 3: + pos = Common::Point(237, 25); + break; + + case 4: + pos = Common::Point(270, 36); + break; + + default: + break; + } + _scene->_kernelMessages.add(pos, 0xFDFC, 0, 0, 120, _game.getQuote(0x2F9)); + } + } + + if (_game._player._moving && (_game._difficulty != DIFFICULTY_EASY) && !_shopAvailable && (_globals[kDogStatus] == 1) && (_scene->_rails.getNext() > 0)) { + _game._player.cancelCommand(); + _game._player.startWalking(Common::Point(268, 72), FACING_NORTHEAST); + _scene->_rails.resetNext(); + } + + if ((_game._player._special > 0) && (_game._difficulty != DIFFICULTY_EASY) && (_globals[kDogStatus] == 1) && _game._player._stepEnabled) + _game._player._stepEnabled = false; + + if ((_game._difficulty != DIFFICULTY_EASY) && (_globals[kDogStatus] == 1) && (_game._player._playerPos == Common::Point(268, 72)) + && (_game._trigger || !_dogEatsRex)) { + _dogEatsRex = true; + switch (_game._trigger) { + case 91: + case 0: + _animationActive = 1; + _game._player._visible = false; + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 10, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], -1, 7); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 1); + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x2FA)); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 60); + _scene->_sequences.addTimer(10, 64); + break; + + case 60: { + int syncIdx = _globals._sequenceIndexes[4]; + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 5, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 8, 45); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 1); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], syncIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 61); + } + break; + + case 61: { + int syncIdx = _globals._sequenceIndexes[4]; + _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 15, 3, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 46, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 1); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], syncIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 62); + } + break; + + case 62: { + int syncIdx = _globals._sequenceIndexes[4]; + _animationActive = 2; + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 1); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], syncIdx); + _scene->_sequences.addTimer(60, 63); + } + break; + + case 63: + _vm->_dialogs->show(60729); + _animationActive = 0; + _dogEatsRex = false; + _scene->_reloadSceneFlag = true; + _game._player._stepEnabled = true; + break; + + case 64: + if (_dogEatsRex && (_animationActive == 1)) { + _vm->_sound->command(12); + _scene->_sequences.addTimer(10, 64); + } + break; + + default: + break; + } + } + + switch (_game._trigger) { + case 80: + _game._player._visible = true; + _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; + _scene->_sequences.addTimer(6, 81); + break; + + case 81: + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 82); + break; + + case 82: + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); + _game._player._stepEnabled = true; + break; + + default: + break; + } +} + +void Scene607::handleThrowingBone() { + _animationActive = -1; + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _game._player._visible = false; + _scene->loadAnimation(formAnimName('D', _animationMode), 1); + break; + + case 1: + _game._player._visible = true; + _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; + + if (_animationMode != 1) + _scene->_hotspots.activate(0x471, false); + else { + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 6); + } + + _dogBarking = false; + if (_game._objects.isInInventory(OBJ_BONE)) { + _game._objects.setRoom(OBJ_BONE, NOWHERE); + if (_animationMode == 1) + _globals[kBone202Status] = 0; + } else { + _game._objects.setRoom(OBJ_BONES, NOWHERE); + _game._objects.addToInventory(OBJ_BONE); + } + + _scene->_sequences.addTimer(60, 2); + break; + + case 2: { + int quoteId = 0x2F8; + if (_animationMode == 1) + quoteId = 0x2F7; + + if (_animationMode == 2) { + _globals[kDogStatus] = 2; + _dogTimer = 0; + } + + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(quoteId)); + _scene->_sequences.addTimer(60, 3); + } + break; + + case 3: + _game._player._stepEnabled = true; + _animationActive = 0; + break; + + default: + break; + } +} + +void Scene607::preActions() { + if (_action.isAction(VERB_TALKTO, 0x471)) + _game._player._needToWalk = false; + + if (_action.isAction(0x18B, 0x478) && (_globals[kDogStatus] == 2) && (_game._difficulty != DIFFICULTY_EASY)) { + _shopAvailable = true; + _dogTimer = 0; + } + + if (_action.isAction(VERB_THROW, 0x2D, 0x471) || _action.isAction(VERB_THROW, 0x2C, 0x471)) + _game._player.walk(Common::Point(193, 100), FACING_NORTHEAST); + + if (_action.isAction(VERB_THROW, 0x2D, 0x2C3) || _action.isAction(VERB_THROW, 0x2C, 0x2C3)) + _game._player.walk(Common::Point(201, 107), FACING_SOUTHEAST); +} + +void Scene607::actions() { + if (_action.isAction(0x18B, 0x478)) + _scene->_nextSceneId = 608; + else if (_action.isAction(0x325, 0x324)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 1); + break; + + case 1: { + int syncIdx = _globals._sequenceIndexes[2]; + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], syncIdx); + _scene->_sequences.addTimer(6, 2); + } + break; + + case 2: + _game._player._visible = false; + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 10, 1, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 3); + break; + + case 3: { + int syncIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -2); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], syncIdx); + _scene->_nextSceneId = 504; + } + break; + + default: + break; + } + } else if (_action.isAction(VERB_THROW, 0x2D, 0x471) || _action.isAction(VERB_THROW, 0x2C, 0x471)) { + if (_game._difficulty != DIFFICULTY_EASY) { + _animationMode = 1; + _scene->_kernelMessages.reset(); + if (_game._trigger == 0) + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x2F6)); + + handleThrowingBone(); + } + } else if ((_action.isAction(VERB_THROW, 0x2D, 0x2C3) || _action.isAction(VERB_THROW, 0x2C, 0x2C3)) && (_game._difficulty != DIFFICULTY_EASY) + && ((_globals[kDogStatus] == 1) || _game._trigger)) { + _animationMode = 2; + if (_game._trigger == 0) { + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x2F6)); + } + handleThrowingBone(); + } else if (_action._lookFlag || _action.isAction(VERB_LOOK, 0x31E)) { + if ((_globals[kDogStatus] == 1) || (_game._difficulty == DIFFICULTY_EASY)) + _vm->_dialogs->show(60710); + else + _vm->_dialogs->show(60711); + } else if (_action.isAction(VERB_LOOK, 0x18D)) + _vm->_dialogs->show(60712); + else if (_action.isAction(VERB_LOOK, 0x2C3)) + _vm->_dialogs->show(60713); + else if (_action.isAction(VERB_LOOK, 0x324)) + _vm->_dialogs->show(60714); + else if (_action.isAction(VERB_LOOK, 0x3FB)) + _vm->_dialogs->show(60715); + else if (_action.isAction(VERB_LOOK, 0x1E6) && (_globals[kDogStatus] == 1)) + _vm->_dialogs->show(60716); + else if (_action.isAction(VERB_LOOK, 0x244)) + _vm->_dialogs->show(60717); + else if (_action.isAction(VERB_LOOK, 0x3FD)) + _vm->_dialogs->show(60718); + else if (_action.isAction(VERB_LOOK, 0x3FF)) + _vm->_dialogs->show(60719); + else if (_action.isAction(VERB_LOOK, 0x31D)) + _vm->_dialogs->show(60720); + else if (_action.isAction(VERB_LOOK, 0x3F9)) + _vm->_dialogs->show(60721); + else if (_action.isAction(VERB_LOOK, 0x3FA)) { + if (_globals[kDogStatus] == 1) + _vm->_dialogs->show(60723); + else + _vm->_dialogs->show(60722); + } else if (_action.isAction(VERB_LOOK, 0x478)) { + if (_globals[kDogStatus] == 1) + _vm->_dialogs->show(60725); + else + _vm->_dialogs->show(60724); + } else if (_action.isAction(VERB_LOOK, 0x471)) + _vm->_dialogs->show(60726); + else if (_action.isAction(VERB_TALKTO, 0x471)) + _vm->_dialogs->show(60727); + else if (_action.isAction(VERB_LOOK, 0x31F)) + _vm->_dialogs->show(60728); + else if (_action.isAction(0x1AD, 0x31E)) + _vm->_dialogs->show(60730); + else if (_action.isAction(0x3FF) && (_action.isAction(VERB_OPEN) || _action.isAction(VERB_PUSH) || _action.isAction(VERB_PULL))) + _vm->_dialogs->show(60731); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes6.h b/engines/mads/nebular/nebular_scenes6.h index 9347b40092..0f7e7763ff 100644 --- a/engines/mads/nebular/nebular_scenes6.h +++ b/engines/mads/nebular/nebular_scenes6.h @@ -133,6 +133,33 @@ public: virtual void actions(); virtual void postActions() {}; }; + +class Scene607: public Scene6xx{ +private: + uint32 _dogTimer; + uint32 _lastFrameTime; + + bool _dogLoop; + bool _dogEatsRex; + bool _dogBarking; + bool _shopAvailable; + + int _animationMode; + int _animationActive; + int _counter; + + void handleThrowingBone(); + +public: + Scene607(MADSEngine *vm) : Scene6xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From 8abcbf3fb08fbca6f0cfdb9eabd22cf56e83b440 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 11 May 2014 18:08:31 -0400 Subject: MADS: Refactoring of dialog classes, more implementation of PictureDialog --- engines/mads/dialogs.cpp | 46 ++++++++++------- engines/mads/dialogs.h | 16 ++++-- engines/mads/msurface.cpp | 10 ++++ engines/mads/msurface.h | 5 ++ engines/mads/nebular/dialogs_nebular.cpp | 86 +++++++++++++++++--------------- engines/mads/nebular/dialogs_nebular.h | 9 ++-- 6 files changed, 106 insertions(+), 66 deletions(-) diff --git a/engines/mads/dialogs.cpp b/engines/mads/dialogs.cpp index e68411a4bb..3ea47c4de6 100644 --- a/engines/mads/dialogs.cpp +++ b/engines/mads/dialogs.cpp @@ -34,22 +34,20 @@ Dialog::Dialog(MADSEngine *vm): _vm(vm), _savedSurface(nullptr), } Dialog::~Dialog() { - restore(&_vm->_screen); } - -void Dialog::save(MSurface *s) { +void Dialog::save() { _savedSurface = new MSurface(_width, _height); - s->copyTo(_savedSurface, + _vm->_screen.copyTo(_savedSurface, Common::Rect(_position.x, _position.y, _position.x + _width, _position.y + _height), Common::Point()); _vm->_screen.copyRectToScreen(getBounds()); } -void Dialog::restore(MSurface *s) { +void Dialog::restore() { if (_savedSurface) { - _savedSurface->copyTo(s, _position); + _savedSurface->copyTo(&_vm->_screen, _position); delete _savedSurface; _savedSurface = nullptr; @@ -58,8 +56,11 @@ void Dialog::restore(MSurface *s) { } void Dialog::draw() { + // Calculate the dialog positioning + calculateBounds(); + // Save the screen portion the dialog will overlap - save(&_vm->_screen); + save(); // Draw the dialog // Fill entire content of dialog @@ -82,6 +83,9 @@ void Dialog::draw() { TEXTDIALOG_CONTENT1, TEXTDIALOG_CONTENT2); } +void Dialog::calculateBounds() { +} + void Dialog::drawContent(const Common::Rect &r, int seed, byte color1, byte color2) { uint16 currSeed = seed ? seed : 0xB78E; @@ -259,16 +263,7 @@ void TextDialog::draw() { --_numLines; // Figure out the size and position for the dialog - _height = (_font->getHeight() + 1) * (_numLines + 1) + 10; - if (_position.x == -1) - _position.x = 160 - (_width / 2); - if (_position.y == -1) - _position.y = 100 - (_height / 2); - - if ((_position.x + _width) > _vm->_screen.getWidth()) - _position.x = _vm->_screen.getWidth() - (_position.x + _width); - if ((_position.y + _height) > _vm->_screen.getHeight()) - _position.y = _vm->_screen.getHeight() - (_position.y + _height); + calculateBounds(); // Draw the underlying dialog Dialog::draw(); @@ -305,6 +300,19 @@ void TextDialog::draw() { _vm->_screen.copyRectToScreen(getBounds()); } +void TextDialog::calculateBounds() { + _height = (_font->getHeight() + 1) * (_numLines + 1) + 10; + if (_position.x == -1) + _position.x = 160 - (_width / 2); + if (_position.y == -1) + _position.y = 100 - (_height / 2); + + if ((_position.x + _width) > _vm->_screen.getWidth()) + _position.x = _vm->_screen.getWidth() - (_position.x + _width); + if ((_position.y + _height) > _vm->_screen.getHeight()) + _position.y = _vm->_screen.getHeight() - (_position.y + _height); +} + void TextDialog::drawWithInput() { //int innerWidth = _innerWidth; //int lineHeight = _font->getHeight() + 1; @@ -325,6 +333,7 @@ void TextDialog::restorePalette() { } void TextDialog::show() { + // Draw the dialog draw(); _vm->_events->showCursor(); @@ -338,6 +347,9 @@ void TextDialog::show() { _vm->_events->waitForNextFrame(); _vm->_events->_pendingKeys.clear(); } + + // Restore the background + restore(); } /*------------------------------------------------------------------------*/ diff --git a/engines/mads/dialogs.h b/engines/mads/dialogs.h index d06611b1c4..aa635768a1 100644 --- a/engines/mads/dialogs.h +++ b/engines/mads/dialogs.h @@ -40,15 +40,13 @@ protected: /** * Save the section of the passed surface the dialog will cover. - * @param s Screen surface to save */ - void save(MSurface *s); + virtual void save(); /** * Restore saved dialog surface - * @param s Screen surface to restore to. */ - void restore(MSurface *s); + virtual void restore(); /** * Draws the content of a dialog with a gravelly alternating color. @@ -59,6 +57,11 @@ protected: * Draw the dialog */ virtual void draw(); + + /** + * Calculate bounds for the dialog + */ + virtual void calculateBounds(); public: /** * Constructor @@ -115,6 +118,11 @@ protected: Common::String _lines[TEXT_DIALOG_MAX_LINES]; int _lineXp[TEXT_DIALOG_MAX_LINES]; byte _cyclingPalette[8 * 3]; + + /** + * Calculate the bounds for the dialog + */ + virtual void calculateBounds(); public: /** * Constructor diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp index 5d1e948f77..4fae799c28 100644 --- a/engines/mads/msurface.cpp +++ b/engines/mads/msurface.cpp @@ -494,6 +494,16 @@ void MSurface::translate(Common::Array &palette) { } } +void MSurface::translate(byte map[PALETTE_COUNT]) { + for (int y = 0; y < this->h; ++y) { + byte *pDest = getBasePtr(0, y); + + for (int x = 0; x < this->w; ++x, ++pDest) { + *pDest = map[*pDest]; + } + } +} + MSurface *MSurface::flipHorizontal() const { MSurface *dest = new MSurface(this->w, this->h); diff --git a/engines/mads/msurface.h b/engines/mads/msurface.h index 060a7ab540..fbd927084a 100644 --- a/engines/mads/msurface.h +++ b/engines/mads/msurface.h @@ -204,6 +204,11 @@ public: */ void translate(Common::Array &palette); + /** + * Translates the pixels of an image used the passed palette with RGB mapping + */ + void translate(byte map[PALETTE_COUNT]); + /** * Create a new surface which is a flipped horizontal copy of the current one */ diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp index 6ddb3230d9..2e020f3677 100644 --- a/engines/mads/nebular/dialogs_nebular.cpp +++ b/engines/mads/nebular/dialogs_nebular.cpp @@ -171,20 +171,6 @@ void DialogsNebular::showItem(int objectId, int messageId, int speech) { assert(!speech); show(messageId, objectId); -#if 0 - Scene &scene = _vm->_game->_scene; - byte highPalette[8 * 3]; - Common::copy(&_vm->_palette->_mainPalette[0x2E8], &_vm->_palette->_mainPalette[PALETTE_SIZE], - &highPalette[0]); - byte *depthP = scene._depthSurface.getData(); - byte greyScale[3]; - greyScale[0] = greyScale[1] = greyScale[2] = 0xFFFF; - Common::String setName = Common::String::format("*OBJ%.3d.SS", objectId); - - - - delete[] savedSurface; -#endif } Common::String DialogsNebular::getVocab(int vocabId) { @@ -211,7 +197,7 @@ Common::String DialogsNebular::getVocab(int vocabId) { bool DialogsNebular::textNoun(Common::String &dialogText, int nounNum, const Common::String &valStr) { - warning("TODO: textNoun"); + error("TODO: textNoun"); return false; } @@ -337,12 +323,25 @@ bool CopyProtectionDialog::getHogAnusEntry(HOGANUS &entry) { PictureDialog::PictureDialog(MADSEngine *vm, const Common::Point &pos, int maxChars, int objectId) : TextDialog(vm, FONT_INTERFACE, pos, maxChars), _objectId(objectId) { - Scene &scene = _vm->_game->_scene; - Palette &palette = *_vm->_palette; - // Turn off cycling if active + Scene &scene = _vm->_game->_scene; _cyclingActive = scene._cyclingActive; scene._cyclingActive = false; +} + +PictureDialog::~PictureDialog() { + // Restore cycling flag + Scene &scene = _vm->_game->_scene; + scene._cyclingActive = _cyclingActive; +} + +void PictureDialog::save() { + Palette &palette = *_vm->_palette; + byte map[PALETTE_COUNT]; + + // Save the entire screen + _savedSurface = new MSurface(MADS_SCREEN_WIDTH, MADS_SCREEN_HEIGHT); + _vm->_screen.copyTo(_savedSurface); // Save palette information Common::copy(&palette._mainPalette[0], &palette._mainPalette[PALETTE_SIZE], &_palette[0]); @@ -358,34 +357,43 @@ PictureDialog::PictureDialog(MADSEngine *vm, const Common::Point &pos, // Reset the flag list palette._rgbList.reset(); -} -PictureDialog::~PictureDialog() { - // Restore cycling flag - Scene &scene = _vm->_game->_scene; - Palette &palette = *_vm->_palette; - scene._cyclingActive = _cyclingActive; + // Fade the screen to grey + int numColors = PALETTE_COUNT - PALETTE_RESERVED_LOW_COUNT - PALETTE_RESERVED_HIGH_COUNT; + palette.fadeToGrey(palette._mainPalette, &map[PALETTE_RESERVED_LOW_COUNT], + PALETTE_RESERVED_LOW_COUNT, numColors, 248, 8, 1, 16); - // Restore palette information - Common::copy(&_palette[0], &_palette[PALETTE_SIZE], &palette._mainPalette[0]); - _vm->_palette->setFullPalette(palette._mainPalette); - Common::copy(&_palFlags[0], &_palFlags[PALETTE_COUNT], &palette._palFlags[0]); - palette._rgbList.copy(_rgbList); -} + // Remap the greyed out screen to use the small greyscale range + // at the top end of the palette + _vm->_screen.translate(map); -void PictureDialog::show() { - setupPalette(); + // Load the inventory picture + Common::String setName = Common::String::format("*OB%.3d.SS", _objectId); + SpriteAsset *asset = new SpriteAsset(_vm, setName, 0x8000); + palette.setFullPalette(palette._mainPalette); - TextDialog::show(); + // Draw the inventory picture + MSprite *frame = asset->getFrame(0); + frame->copyTo(&_vm->_screen, Common::Point(160 - frame->w / 2, 6), + frame->getTransparencyIndex()); + _vm->_screen.copyRectToScreen(_vm->_screen.getBounds()); } -void PictureDialog::setupPalette() { - Palette &palette = *_vm->_palette; - byte map[PALETTE_COUNT]; +void PictureDialog::restore() { + if (_savedSurface) { + _savedSurface->copyTo(&_vm->_screen); + delete _savedSurface; + _savedSurface = nullptr; - int numColors = PALETTE_COUNT - PALETTE_RESERVED_LOW_COUNT - PALETTE_RESERVED_HIGH_COUNT; - palette.fadeToGrey(palette._mainPalette, &map[PALETTE_RESERVED_LOW_COUNT], - PALETTE_RESERVED_LOW_COUNT, numColors, 248, 8, 1, 16); + _vm->_screen.copyRectToScreen(_vm->_screen.getBounds()); + + // Restore palette information + Palette &palette = *_vm->_palette; + Common::copy(&_palette[0], &_palette[PALETTE_SIZE], &palette._mainPalette[0]); + _vm->_palette->setFullPalette(palette._mainPalette); + Common::copy(&_palFlags[0], &_palFlags[PALETTE_COUNT], &palette._palFlags[0]); + palette._rgbList.copy(_rgbList); + } } /*------------------------------------------------------------------------*/ diff --git a/engines/mads/nebular/dialogs_nebular.h b/engines/mads/nebular/dialogs_nebular.h index fd4d6e706e..60a215197f 100644 --- a/engines/mads/nebular/dialogs_nebular.h +++ b/engines/mads/nebular/dialogs_nebular.h @@ -89,17 +89,14 @@ private: byte _palette[PALETTE_SIZE]; uint32 _palFlags[PALETTE_COUNT]; RGBList _rgbList; +protected: + virtual void save(); - /** - * Sets up the palette and fades the screen to gray - */ - void setupPalette(); + virtual void restore(); public: PictureDialog(MADSEngine *vm, const Common::Point &pos, int maxChars, int objectId); virtual ~PictureDialog(); - - virtual void show(); }; enum DialogTextAlign { ALIGN_CENTER = -1, ALIGN_AT_CENTER = -2, ALIGN_RIGHT = -3 }; -- cgit v1.2.3 From 991096d01ed0befa2b56beea4091de9d04aafaac Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 12 May 2014 00:20:54 +0200 Subject: MADS: Implement scene 620 --- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes6.cpp | 52 ++++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes6.h | 12 ++++++++ 3 files changed, 65 insertions(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 7c5700ad72..4cbcb81490 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -247,7 +247,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 612: // expressway / maintenance building return new DummyScene(vm); // TODO case 620: // cutscene, viewport glass breaking - return new DummyScene(vm); // TODO + return new Scene620(vm); // Scene group #7 (submerged men's city / upper floor) case 701: // outside elevator (after city is submerged) diff --git a/engines/mads/nebular/nebular_scenes6.cpp b/engines/mads/nebular/nebular_scenes6.cpp index 46ef066c97..8cda6ed14d 100644 --- a/engines/mads/nebular/nebular_scenes6.cpp +++ b/engines/mads/nebular/nebular_scenes6.cpp @@ -1418,5 +1418,57 @@ void Scene607::actions() { /*------------------------------------------------------------------------*/ +void Scene620::setup() { + _game._player._spritesPrefix = ""; + setAAName(); +} + +void Scene620::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('b', 0)); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -1); + _game._player._stepEnabled = false; + _game._player._visible = false; + _scene->_sequences.addTimer(30, 70); + _scene->_userInterface.setup(kInputLimitedSentences); + sceneEntrySound(); +} + +void Scene620::step() { + switch (_game._trigger) { + case 70: + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _scene->loadAnimation(formAnimName('E', -1), 71); + break; + + case 71: + if (_scene->_priorSceneId == 751) { + _globals[kCityFlooded] = true; + _globals[kTeleporterRoom + 5] = 0; + _scene->_nextSceneId = 701; + } else if (_scene->_priorSceneId == 752) { + _globals[kCityFlooded] = true; + _globals[kTeleporterRoom + 5] = 0; + _scene->_nextSceneId = 702; + } else if (_scene->_priorSceneId < 501 || _scene->_priorSceneId > 752) { + _globals[kCityFlooded] = true; + _globals[kTeleporterRoom + 5] = 0; + _scene->_nextSceneId = _scene->_priorSceneId; + } else if (_scene->_priorSceneId >= 501 && _scene->_priorSceneId <= 612) { + _globals[kResurrectRoom] = _globals[kHoverCarLocation]; + _game._objects.addToInventory(OBJ_TIMEBOMB); + _globals[kTimebombStatus] = 0; + _globals[kTimebombTimer] = 0; + _scene->_nextSceneId = 605; + } + _game._player._stepEnabled = true; + break; + + default: + break; + } +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes6.h b/engines/mads/nebular/nebular_scenes6.h index 0f7e7763ff..69db9eb4f3 100644 --- a/engines/mads/nebular/nebular_scenes6.h +++ b/engines/mads/nebular/nebular_scenes6.h @@ -160,6 +160,18 @@ public: virtual void actions(); virtual void postActions() {}; }; + +class Scene620: public Scene6xx{ +public: + Scene620(MADSEngine *vm) : Scene6xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions() {}; + virtual void postActions() {}; +}; } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From b32ca0aaae88a7dbd3445a5611d4a59f0684a99b Mon Sep 17 00:00:00 2001 From: D G Turner Date: Mon, 12 May 2014 00:44:13 +0100 Subject: AGOS: Add image dumping to file enable by debugflag. This previously required a code change and recompile to enable. It can now be enabled or disabled at runtime using the "image_dump" debug flag. --- engines/agos/agos.cpp | 3 +-- engines/agos/agos.h | 4 ++-- engines/agos/vga.cpp | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp index 0ee6bb538f..dab839b02b 100644 --- a/engines/agos/agos.cpp +++ b/engines/agos/agos.cpp @@ -149,6 +149,7 @@ AGOSEngine::AGOSEngine(OSystem *system, const AGOSGameDescription *gd) DebugMan.addDebugChannel(kDebugVGAOpcode, "vga_opcode", "VGA Opcode debug level"); DebugMan.addDebugChannel(kDebugSubroutine, "subroutine", "Subroutine debug level"); DebugMan.addDebugChannel(kDebugVGAScript, "vga_script", "VGA Script debug level"); + DebugMan.addDebugChannel(kDebugImageDump, "image_dump", "Enable dumping of images to files"); _vcPtr = 0; _vcGetOutOfCode = 0; @@ -249,8 +250,6 @@ AGOSEngine::AGOSEngine(OSystem *system, const AGOSGameDescription *gd) _backFlag = false; - _dumpImages = false; - _copyProtection = false; _pause = false; _speech = false; diff --git a/engines/agos/agos.h b/engines/agos/agos.h index e2f5100f65..b6b5e427e1 100644 --- a/engines/agos/agos.h +++ b/engines/agos/agos.h @@ -65,7 +65,8 @@ enum { kDebugOpcode = 1 << 0, kDebugVGAOpcode = 1 << 1, kDebugSubroutine = 1 << 2, - kDebugVGAScript = 1 << 3 + kDebugVGAScript = 1 << 3, + kDebugImageDump = 1 << 4 }; uint fileReadItemID(Common::SeekableReadStream *in); @@ -334,7 +335,6 @@ protected: Common::Language _language; bool _copyProtection; bool _pause; - bool _dumpImages; bool _speech; bool _subtitles; bool _vgaVar9; diff --git a/engines/agos/vga.cpp b/engines/agos/vga.cpp index 31191792a1..f761c3fc3f 100644 --- a/engines/agos/vga.cpp +++ b/engines/agos/vga.cpp @@ -648,7 +648,7 @@ void AGOSEngine::drawImage_init(int16 image, uint16 palette, int16 x, int16 y, u if (height == 0 || width == 0) return; - if (_dumpImages) + if (DebugMan.isDebugChannelEnabled(kDebugImageDump)) dumpSingleBitmap(_vgaCurZoneNum, state.image, state.srcPtr, width, height, state.palette); state.width = state.draw_width = width; /* cl */ -- cgit v1.2.3 From c81d0b680eb4f65ab23f02799de3b465a5758803 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Mon, 12 May 2014 00:56:20 +0100 Subject: GUI: Minor further fixes to "debuglevel" command in Debugger base class. --- gui/debugger.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gui/debugger.cpp b/gui/debugger.cpp index 832f49f0c9..b2ef193fa7 100644 --- a/gui/debugger.cpp +++ b/gui/debugger.cpp @@ -504,15 +504,20 @@ bool Debugger::Cmd_OpenLog(int argc, const char **argv) { bool Debugger::Cmd_DebugLevel(int argc, const char **argv) { if (argc == 1) { - DebugPrintf("Debugging is currently set at level %d\n", gDebugLevel); + if (gDebugLevel < 0) { + DebugPrintf("Debugging is disabled\n"); + } else { + DebugPrintf("Debugging is currently set at level %d\n", gDebugLevel); + } } else { // set level gDebugLevel = atoi(argv[1]); if (gDebugLevel >= 0 && gDebugLevel < 11) { DebugPrintf("Debug level set to level %d\n", gDebugLevel); } else if (gDebugLevel < 0) { DebugPrintf("Debugging is now disabled\n"); - } else + } else { DebugPrintf("Not a valid debug level (0 - 10)\n"); + } } return true; -- cgit v1.2.3 From 5e13514d28df811dfcd4f1829b327ce8606ed5ee Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 11 May 2014 19:56:31 -0400 Subject: MADS: Fix hiding the status text when doing actions --- engines/mads/action.cpp | 1 + engines/mads/nebular/dialogs_nebular.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index 88a57d6a4e..e9593955c5 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -75,6 +75,7 @@ void MADSAction::clear() { _articleNumber = 0; _lookFlag = false; _pointEstablished = 0; + _statusText.clear(); _selectedRow = -1; _hotspotId = -1; _secondObject = -1; diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp index 2e020f3677..8b6418e928 100644 --- a/engines/mads/nebular/dialogs_nebular.cpp +++ b/engines/mads/nebular/dialogs_nebular.cpp @@ -393,6 +393,8 @@ void PictureDialog::restore() { _vm->_palette->setFullPalette(palette._mainPalette); Common::copy(&_palFlags[0], &_palFlags[PALETTE_COUNT], &palette._palFlags[0]); palette._rgbList.copy(_rgbList); + + _vm->_dialogs->_defaultPosition.y = -1; } } -- cgit v1.2.3 From 3d81dd0a14d16dab0967ca57e8039c5285048518 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 12 May 2014 05:14:39 +0300 Subject: FULLPIPE: More work on MovGraph::doWalkTo() --- engines/fullpipe/motion.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 58d5055076..5137434a06 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -684,9 +684,11 @@ MessageQueue *MovGraph::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int _items[idx]->movarr.clear(); - memcpy(_items[idx]->movarr, _items[idx]->items[arridx].movarr, 0x20u); - _items[idx]->movarr = (MovArr *)operator new(8 * _items[idx]->items[arridx].movarr->_movStepCount); - memcpy(_items[idx]->movarr, _items[idx]->items[arridx].movarr, 8 * _items[idx]->items[arridx].movarr->_movStepCount); + for (uint i = 0; i < _items[idx]->items[arridx].movarr->_movStepCount; i++) { + MovArr *m = new MovArr; + + *m = *_items[idx]->items[arridx].movarr[i]; + } _items[idx]->field_10 = -1; _items[idx]->field_14 = 0; @@ -1003,12 +1005,7 @@ bool MovGraph::calcChunk(int idx, int x, int y, MovArr *arr, int a6) { } if (idxmin != -1) { - arr->_afield_0 = (*movarr)[idxmin]->_afield_0; - arr->_afield_4 = (*movarr)[idxmin]->_afield_4; - arr->_afield_8 = (*movarr)[idxmin]->_afield_8; - arr->_link = (*movarr)[idxmin]->_link; - arr->_dist = (*movarr)[idxmin]->_dist; - arr->_point = (*movarr)[idxmin]->_point; + *arr = *(*movarr)[idxmin]; res = true; } -- cgit v1.2.3 From 604bca43de0c19e64689ce6e12ad3f854549100c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 11 May 2014 22:41:01 -0400 Subject: MADS: Implement the dialog textNoun method --- engines/mads/dialogs.h | 2 +- engines/mads/nebular/dialogs_nebular.cpp | 47 +++++++++++++++++++++++++++++--- engines/mads/nebular/dialogs_nebular.h | 4 +-- 3 files changed, 46 insertions(+), 7 deletions(-) diff --git a/engines/mads/dialogs.h b/engines/mads/dialogs.h index aa635768a1..078415bad9 100644 --- a/engines/mads/dialogs.h +++ b/engines/mads/dialogs.h @@ -220,7 +220,7 @@ public: virtual void showDialog() = 0; virtual void showItem(int objectId, int messageId, int speech = 0) = 0; - + virtual Common::String getVocab(int vocabId) = 0; virtual bool show(int messageId, int objectId = -1) = 0; }; diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp index 8b6418e928..ff2249a3b3 100644 --- a/engines/mads/nebular/dialogs_nebular.cpp +++ b/engines/mads/nebular/dialogs_nebular.cpp @@ -195,10 +195,49 @@ Common::String DialogsNebular::getVocab(int vocabId) { return vocab; } -bool DialogsNebular::textNoun(Common::String &dialogText, int nounNum, - const Common::String &valStr) { - error("TODO: textNoun"); - return false; +bool DialogsNebular::textNoun(Common::String &dest, int nounId, const Common::String &source) { + // Ensure the destination has parameter specifications + if (!source.hasPrefix(":")) + return false; + + // Extract the first (singular) result value + Common::String param1 = Common::String(source.c_str() + 1); + Common::String param2; + const char *sepChar = strchr(source.c_str() + 1, ':'); + if (sepChar) { + param1 = Common::String(source.c_str() + 1, sepChar); + + // Get the second, plural form + param2 = Common::String(sepChar + 1); + } + + // Get the vocab to use + MADSAction &action = _vm->_game->_scene._action; + Common::String vocab = _vm->_dialogs->getVocab(action._activeAction._verbId); + Common::String *str; + + if (vocab.hasSuffix("s") || vocab.hasSuffix("S")) { + str = ¶m2; + } else { + str = ¶m1; + + if (param1 == "a ") { + switch (toupper(vocab[0])) { + case 'A': + case 'E': + case 'I': + case 'O': + case 'U': + param1 = "an "; + break; + default: + break; + } + } + } + + dest += *str; + return true; } bool DialogsNebular::commandCheck(const char *idStr, Common::String &valStr, diff --git a/engines/mads/nebular/dialogs_nebular.h b/engines/mads/nebular/dialogs_nebular.h index 60a215197f..643d440d67 100644 --- a/engines/mads/nebular/dialogs_nebular.h +++ b/engines/mads/nebular/dialogs_nebular.h @@ -41,9 +41,9 @@ private: DialogsNebular(MADSEngine *vm): Dialogs(vm) {} - Common::String getVocab(int vocabId); + virtual Common::String getVocab(int vocabId); - bool textNoun(Common::String &dialogText, int nounNum, const Common::String &valStr); + bool textNoun(Common::String &dest, int nounId, const Common::String &source); bool commandCheck(const char *idStr, Common::String &valStr, const Common::String &command); public: -- cgit v1.2.3 From a0fcbeeb4faa8a12c2b68a6887ebbdae2b356239 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 11 May 2014 23:26:54 -0400 Subject: MADS: Dialog positioning and UI shading fix for picture dialog --- engines/mads/nebular/dialogs_nebular.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp index ff2249a3b3..63b0edf2f1 100644 --- a/engines/mads/nebular/dialogs_nebular.cpp +++ b/engines/mads/nebular/dialogs_nebular.cpp @@ -390,8 +390,13 @@ void PictureDialog::save() { // Set up palette allocation uint32 *palFlagP = &palette._palFlags[0]; for (int idx = 0; idx < PALETTE_COUNT; ++idx, ++palFlagP) { - *palFlagP = (idx < PALETTE_RESERVED_LOW_COUNT || - idx >= (PALETTE_COUNT - PALETTE_RESERVED_HIGH_COUNT - 10)) ? 1 : 0; + if (idx < PALETTE_RESERVED_LOW_COUNT || + idx >= (PALETTE_COUNT - PALETTE_RESERVED_HIGH_COUNT - 10)) { + *palFlagP = 1; + map[idx] = idx; + } else { + *palFlagP = 0; + } } // Reset the flag list @@ -413,6 +418,8 @@ void PictureDialog::save() { // Draw the inventory picture MSprite *frame = asset->getFrame(0); + _position.y = frame->h + 12; + frame->copyTo(&_vm->_screen, Common::Point(160 - frame->w / 2, 6), frame->getTransparencyIndex()); _vm->_screen.copyRectToScreen(_vm->_screen.getBounds()); -- cgit v1.2.3 From 24243d57e6a3b6fc291b754339aa60e98a76592e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 11 May 2014 23:57:01 -0400 Subject: MADS: Fix dialog colors for PictureDialog class --- engines/mads/dialogs.cpp | 47 ++++++++++++++++----------- engines/mads/dialogs.h | 54 ++++++++++++++++---------------- engines/mads/nebular/dialogs_nebular.cpp | 12 ++++++- 3 files changed, 66 insertions(+), 47 deletions(-) diff --git a/engines/mads/dialogs.cpp b/engines/mads/dialogs.cpp index 3ea47c4de6..b1a0b53b5a 100644 --- a/engines/mads/dialogs.cpp +++ b/engines/mads/dialogs.cpp @@ -31,6 +31,14 @@ namespace MADS { Dialog::Dialog(MADSEngine *vm): _vm(vm), _savedSurface(nullptr), _position(Common::Point(-1, -1)), _width(0), _height(0) { + TEXTDIALOG_CONTENT1 = 0XF8; + TEXTDIALOG_CONTENT2 = 0XF9; + TEXTDIALOG_EDGE = 0XFA; + TEXTDIALOG_BACKGROUND = 0XFB; + TEXTDIALOG_FC = 0XFC; + TEXTDIALOG_FD = 0XFD; + TEXTDIALOG_FE = 0XFE; + TEXTDIALOG_BLACK = 0; } Dialog::~Dialog() { @@ -52,6 +60,10 @@ void Dialog::restore() { _savedSurface = nullptr; _vm->_screen.copyRectToScreen(getBounds()); + + Common::copy(&_dialogPalette[0], &_dialogPalette[8 * 3], + &_vm->_palette->_mainPalette[248 * 3]); + _vm->_palette->setPalette(_vm->_palette->_mainPalette, 248, 8); } } @@ -62,6 +74,8 @@ void Dialog::draw() { // Save the screen portion the dialog will overlap save(); + setDialogPalette(); + // Draw the dialog // Fill entire content of dialog Common::Rect bounds = getBounds(); @@ -83,6 +97,20 @@ void Dialog::draw() { TEXTDIALOG_CONTENT1, TEXTDIALOG_CONTENT2); } +void Dialog::setDialogPalette() { + // Save the high end of the palette, and set up the entries for dialog display + Common::copy(&_vm->_palette->_mainPalette[TEXTDIALOG_CONTENT1 * 3], + &_vm->_palette->_mainPalette[TEXTDIALOG_CONTENT1 * 3 + 8 * 3], + &_dialogPalette[0]); + Palette::setGradient(_vm->_palette->_mainPalette, TEXTDIALOG_CONTENT1, 2, 0x90, 0x80); + Palette::setGradient(_vm->_palette->_mainPalette, TEXTDIALOG_EDGE, 2, 0x9C, 0x70); + Palette::setGradient(_vm->_palette->_mainPalette, TEXTDIALOG_FC, 2, 0x90, 0x80); + Palette::setGradient(_vm->_palette->_mainPalette, TEXTDIALOG_FE, 1, 0xDC, 0xDC); + + _vm->_palette->setPalette(_vm->_palette->_mainPalette + (TEXTDIALOG_CONTENT1 * 3), + TEXTDIALOG_CONTENT1, 8); +} + void Dialog::calculateBounds() { } @@ -125,22 +153,9 @@ TextDialog::TextDialog(MADSEngine *vm, const Common::String &fontName, Common::fill(&_lineXp[0], &_lineXp[TEXT_DIALOG_MAX_LINES], 0); _askLineNum = -1; _askXp = 0; - - // Save the high end of the palette, and set up the entries for dialog display - Common::copy(&_vm->_palette->_mainPalette[TEXTDIALOG_CONTENT1 * 3], - &_vm->_palette->_mainPalette[TEXTDIALOG_CONTENT1 * 3 + 8 * 3], - &_cyclingPalette[0]); - Palette::setGradient(_vm->_palette->_mainPalette, TEXTDIALOG_CONTENT1, 2, 0x90, 0x80); - Palette::setGradient(_vm->_palette->_mainPalette, TEXTDIALOG_EDGE, 2, 0x9C, 0x70); - Palette::setGradient(_vm->_palette->_mainPalette, TEXTDIALOG_FC, 2, 0x90, 0x80); - Palette::setGradient(_vm->_palette->_mainPalette, TEXTDIALOG_FE, 1, 0xDC, 0xDC); - - _vm->_palette->setPalette(_vm->_palette->_mainPalette + (TEXTDIALOG_CONTENT1 * 3), - TEXTDIALOG_CONTENT1, 8); } TextDialog::~TextDialog() { - restorePalette(); } void TextDialog::addLine(const Common::String &line, bool underline) { @@ -326,12 +341,6 @@ void TextDialog::drawWithInput() { error("TODO: drawWithInput"); } -void TextDialog::restorePalette() { - Common::copy(&_cyclingPalette[0], &_cyclingPalette[8 * 3], - &_vm->_palette->_mainPalette[248 * 3]); - _vm->_palette->setPalette(_vm->_palette->_mainPalette, 248, 8); -} - void TextDialog::show() { // Draw the dialog draw(); diff --git a/engines/mads/dialogs.h b/engines/mads/dialogs.h index 078415bad9..6de6ea71c1 100644 --- a/engines/mads/dialogs.h +++ b/engines/mads/dialogs.h @@ -31,27 +31,24 @@ namespace MADS { class Dialog { +private: + void setDialogPalette(); protected: MADSEngine *_vm; MSurface *_savedSurface; Common::Point _position; int _width; int _height; - - /** - * Save the section of the passed surface the dialog will cover. - */ - virtual void save(); - - /** - * Restore saved dialog surface - */ - virtual void restore(); - - /** - * Draws the content of a dialog with a gravelly alternating color. - */ - void drawContent(const Common::Rect &r, int seed, byte color1, byte color2); + byte _dialogPalette[8 * 3]; + + int TEXTDIALOG_CONTENT1; + int TEXTDIALOG_CONTENT2; + int TEXTDIALOG_EDGE; + int TEXTDIALOG_BACKGROUND; + int TEXTDIALOG_FC; + int TEXTDIALOG_FD; + int TEXTDIALOG_FE; + int TEXTDIALOG_BLACK; protected: /** * Draw the dialog @@ -62,6 +59,21 @@ protected: * Calculate bounds for the dialog */ virtual void calculateBounds(); + + /** + * Save the section of the passed surface the dialog will cover. + */ + virtual void save(); + + /** + * Restore saved dialog surface + */ + virtual void restore(); + + /** + * Draws the content of a dialog with a gravelly alternating color. + */ + void drawContent(const Common::Rect &r, int seed, byte color1, byte color2); public: /** * Constructor @@ -82,17 +94,6 @@ public: } }; -enum { - TEXTDIALOG_CONTENT1 = 0XF8, - TEXTDIALOG_CONTENT2 = 0XF9, - TEXTDIALOG_EDGE = 0XFA, - TEXTDIALOG_BACKGROUND = 0XFB, - TEXTDIALOG_FC = 0XFC, - TEXTDIALOG_FD = 0XFD, - TEXTDIALOG_FE = 0XFE, - TEXTDIALOG_BLACK = 0 -}; - #define TEXT_DIALOG_MAX_LINES 20 class TextDialog: protected Dialog { @@ -117,7 +118,6 @@ protected: int _askLineNum; Common::String _lines[TEXT_DIALOG_MAX_LINES]; int _lineXp[TEXT_DIALOG_MAX_LINES]; - byte _cyclingPalette[8 * 3]; /** * Calculate the bounds for the dialog diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp index 63b0edf2f1..df423f92a8 100644 --- a/engines/mads/nebular/dialogs_nebular.cpp +++ b/engines/mads/nebular/dialogs_nebular.cpp @@ -416,13 +416,23 @@ void PictureDialog::save() { SpriteAsset *asset = new SpriteAsset(_vm, setName, 0x8000); palette.setFullPalette(palette._mainPalette); - // Draw the inventory picture + // Get the inventory frame, and adjust the dialog position to allow for it MSprite *frame = asset->getFrame(0); _position.y = frame->h + 12; + // Draw the inventory picture frame->copyTo(&_vm->_screen, Common::Point(160 - frame->w / 2, 6), frame->getTransparencyIndex()); _vm->_screen.copyRectToScreen(_vm->_screen.getBounds()); + + // Adjust the dialog colours to use + TEXTDIALOG_CONTENT1 -= 10; + TEXTDIALOG_CONTENT2 -= 10; + TEXTDIALOG_EDGE -= 10; + TEXTDIALOG_BACKGROUND -= 10; + TEXTDIALOG_FC -= 10; + TEXTDIALOG_FD -= 10; + TEXTDIALOG_FE -= 10; } void PictureDialog::restore() { -- cgit v1.2.3 From 8e728a04e893ebb9efe249715506289f2088ab16 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 12 May 2014 18:55:58 +0200 Subject: MADS: Implement scene 608 --- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes6.cpp | 1016 +++++++++++++++++++++++++++++- engines/mads/nebular/nebular_scenes6.h | 48 ++ 3 files changed, 1037 insertions(+), 29 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 4cbcb81490..fa2c4a3d58 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -237,7 +237,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 607: // outside Abdul's garage return new Scene607(vm); case 608: // inside Abdul's garage - return new DummyScene(vm); // TODO + return new Scene608(vm); case 609: // outside Buckluster video store return new DummyScene(vm); // TODO case 610: // inside Buckluster video store diff --git a/engines/mads/nebular/nebular_scenes6.cpp b/engines/mads/nebular/nebular_scenes6.cpp index 8cda6ed14d..6c228c1234 100644 --- a/engines/mads/nebular/nebular_scenes6.cpp +++ b/engines/mads/nebular/nebular_scenes6.cpp @@ -1022,12 +1022,12 @@ void Scene607::enter() { _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -2); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); - if (_scene->_priorSceneId == 608) { - _game._player._playerPos = Common::Point(297, 50); + if (_scene->_priorSceneId == 608) { + _game._player._playerPos = Common::Point(297, 50); _game._player._facing = FACING_SOUTHEAST; } else if (_scene->_priorSceneId != -2) { _game._player._playerPos = Common::Point(40, 104); - _game._player._facing = FACING_SOUTHEAST; + _game._player._facing = FACING_SOUTHEAST; _game._player._visible = false; _game._player._stepEnabled = false; _scene->_sequences.remove(_globals._sequenceIndexes[2]); @@ -1038,12 +1038,12 @@ void Scene607::enter() { _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('g', 3)); _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('g', 7)); _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('g', 0)); - } + } sceneEntrySound(); if (_scene->_roomChanged) - _game._objects.addToInventory(OBJ_BONES); + _game._objects.addToInventory(OBJ_BONES); _vm->_palette->setEntry(252, 63, 44, 30); _vm->_palette->setEntry(253, 63, 20, 22); @@ -1071,18 +1071,18 @@ void Scene607::step() { _dogTimer = 0; } - if (_game._trigger == 91) { + if (_game._trigger == 91) { _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 6); _dogBarking = false; _globals[kDogStatus] = 1; _scene->_hotspots.activate(0x471, true); - } + } if (!_dogEatsRex && (_game._difficulty != DIFFICULTY_EASY) && !_animationActive && (_globals[kDogStatus] == 1) && !_dogBarking && (_vm->getRandomNumber(1, 50) == 10)) { _dogBarking = true; - _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _scene->_sequences.remove(_globals._sequenceIndexes[1]); _globals._sequenceIndexes[1] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 5, 8, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 6); _scene->_kernelMessages.reset(); @@ -1143,13 +1143,13 @@ void Scene607::step() { && (_game._trigger || !_dogEatsRex)) { _dogEatsRex = true; switch (_game._trigger) { - case 91: + case 91: case 0: _animationActive = 1; _game._player._visible = false; _scene->_sequences.remove(_globals._sequenceIndexes[1]); _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 10, 1, 0, 0); - _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], -1, 7); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], -1, 7); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 1); _scene->_kernelMessages.reset(); _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x2FA)); @@ -1160,7 +1160,7 @@ void Scene607::step() { case 60: { int syncIdx = _globals._sequenceIndexes[4]; _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 5, 1, 0, 0); - _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 8, 45); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 8, 45); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 1); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], syncIdx); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 61); @@ -1170,7 +1170,7 @@ void Scene607::step() { case 61: { int syncIdx = _globals._sequenceIndexes[4]; _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 15, 3, 0, 0); - _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 46, -2); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 46, -2); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 1); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], syncIdx); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 62); @@ -1219,13 +1219,13 @@ void Scene607::step() { _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 6, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 82); - break; + break; case 82: - _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -2); + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -2); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); _game._player._stepEnabled = true; - break; + break; default: break; @@ -1238,12 +1238,12 @@ void Scene607::handleThrowingBone() { case 0: _game._player._stepEnabled = false; _scene->_sequences.remove(_globals._sequenceIndexes[1]); - _game._player._visible = false; + _game._player._visible = false; _scene->loadAnimation(formAnimName('D', _animationMode), 1); break; case 1: - _game._player._visible = true; + _game._player._visible = true; _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; if (_animationMode != 1) @@ -1258,7 +1258,7 @@ void Scene607::handleThrowingBone() { _game._objects.setRoom(OBJ_BONE, NOWHERE); if (_animationMode == 1) _globals[kBone202Status] = 0; - } else { + } else { _game._objects.setRoom(OBJ_BONES, NOWHERE); _game._objects.addToInventory(OBJ_BONE); } @@ -1269,7 +1269,7 @@ void Scene607::handleThrowingBone() { case 2: { int quoteId = 0x2F8; if (_animationMode == 1) - quoteId = 0x2F7; + quoteId = 0x2F7; if (_animationMode == 2) { _globals[kDogStatus] = 2; @@ -1299,7 +1299,7 @@ void Scene607::preActions() { if (_action.isAction(0x18B, 0x478) && (_globals[kDogStatus] == 2) && (_game._difficulty != DIFFICULTY_EASY)) { _shopAvailable = true; _dogTimer = 0; - } + } if (_action.isAction(VERB_THROW, 0x2D, 0x471) || _action.isAction(VERB_THROW, 0x2C, 0x471)) _game._player.walk(Common::Point(193, 100), FACING_NORTHEAST); @@ -1323,7 +1323,7 @@ void Scene607::actions() { case 1: { int syncIdx = _globals._sequenceIndexes[2]; - _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1); + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], syncIdx); _scene->_sequences.addTimer(6, 2); } @@ -1340,7 +1340,7 @@ void Scene607::actions() { int syncIdx = _globals._sequenceIndexes[3]; _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -2); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); - _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], syncIdx); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], syncIdx); _scene->_nextSceneId = 504; } break; @@ -1363,7 +1363,7 @@ void Scene607::actions() { if (_game._trigger == 0) { _scene->_kernelMessages.reset(); _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x2F6)); - } + } handleThrowingBone(); } else if (_action._lookFlag || _action.isAction(VERB_LOOK, 0x31E)) { if ((_globals[kDogStatus] == 1) || (_game._difficulty == DIFFICULTY_EASY)) @@ -1418,16 +1418,976 @@ void Scene607::actions() { /*------------------------------------------------------------------------*/ +void Scene608::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(0xD); + _scene->addActiveVocab(0x115); + _scene->addActiveVocab(0x324); + _scene->addActiveVocab(0x471); +} + +void Scene608::resetDogVariables() { + _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 1); + int idx = _scene->_dynamicHotspots.add(0x471, VERB_WALKTO, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(194, 142), FACING_EAST); + _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 4); + _dogBarkingFl = false; + _dogFirstEncounter = false; +} + +void Scene608::restoreAnimations() { + _scene->freeAnimation(); + _carMode = 0; + _game._player._stepEnabled = true; + if (_throwMode == 6) + _dogSquashFl = true; + + if (_globals[kCarStatus] == 0) { + _scene->_sequences.remove(_globals._sequenceIndexes[6]); + _scene->_sequences.remove(_globals._sequenceIndexes[7]); + _scene->loadAnimation(formAnimName('A', -1)); + } else { + _scene->_sequences.remove(_globals._sequenceIndexes[8]); + _scene->_sequences.remove(_globals._sequenceIndexes[6]); + _scene->_sequences.remove(_globals._sequenceIndexes[7]); + _scene->loadAnimation(formAnimName('A', -1)); + _scene->_activeAnimation->setCurrentFrame(6); + } +} + +void Scene608::setCarAnimations() { + _scene->freeAnimation(); + if (_globals[kCarStatus] == 0) { + _globals._sequenceIndexes[6] = _scene->_sequences.startCycle(_globals._spriteIndexes[6], false, 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[6], Common::Point(143, 98)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 6); + _globals._sequenceIndexes[7] = _scene->_sequences.startCycle(_globals._spriteIndexes[7], false, 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[7], Common::Point(141, 67)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 15); + } else { + _globals._sequenceIndexes[6] = _scene->_sequences.startCycle(_globals._spriteIndexes[6], false, 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[6], Common::Point(143, 128)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 6); + _globals._sequenceIndexes[7] = _scene->_sequences.startCycle(_globals._spriteIndexes[7], false, 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[7], Common::Point(141, 97)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 15); + _globals._sequenceIndexes[8] = _scene->_sequences.startCycle(_globals._spriteIndexes[8], false, 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[8], Common::Point(144, 126)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[8], 5); + } +} + +void Scene608::handleThrowingBone() { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + setCarAnimations(); + _scene->_sequences.remove(_globals._sequenceIndexes[5]); + _animationMode = -1; + _game._player._visible = false; + _carMode = _throwMode; + if (_throwMode == 4) + _scene->loadAnimation(formAnimName('X', 2), 1); + else if (_throwMode == 5) + _scene->loadAnimation(formAnimName('X', 1), 1); + else + _scene->loadAnimation(formAnimName('X', 3), 1); + break; + + case 1: + _nextTrigger = 1; + _scene->_sequences.addTimer(1, 2); + break; + + case 2: + if (_nextTrigger != 2) + _scene->_sequences.addTimer(1, 2); + else { + if (_game._objects.isInInventory(OBJ_BONE)) + _game._objects.setRoom(OBJ_BONE, NOWHERE); + else { + _game._objects.setRoom(OBJ_BONES, NOWHERE); + _game._objects.addToInventory(OBJ_BONE); + } + _scene->_sequences.addTimer(60, 3); + } + break; + + case 3: + if (_throwMode != 6) { + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x304)); + _scene->_sequences.addTimer(120, 4); + } else + restoreAnimations(); + break; + + case 4: + restoreAnimations(); + break; + + default: + break; + } +} + +void Scene608::enter() { + _globals._spriteIndexes[2] = _scene->_sprites.addSprites("*RXMRD_7"); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites("*RXMRC_9"); + _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('c', 2)); + _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('c', 0)); + _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('c', 1)); + + if (_game._objects.isInRoom(OBJ_POLYCEMENT)) { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('g', -1)); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); + int idx = _scene->_dynamicHotspots.add(0x115, VERB_WALKTO, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + _polycementHotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(249, 129), FACING_NORTHEAST); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 6); + } + + if (_game._objects.isInRoom(OBJ_REARVIEW_MIRROR)) { + _globals._spriteIndexes[12] = _scene->_sprites.addSprites(formAnimName('m', -1)); + _globals._sequenceIndexes[12] = _scene->_sequences.startCycle(_globals._spriteIndexes[12], false, 1); + int idx = _scene->_dynamicHotspots.add(0x120, VERB_WALKTO, _globals._sequenceIndexes[12], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(71, 113), FACING_NORTHEAST); + _scene->_sequences.setDepth(_globals._sequenceIndexes[12], 15); + } + + if (_game._difficulty == DIFFICULTY_HARD) { + _globals._spriteIndexes[9] = _scene->_sprites.addSprites(formAnimName('g', 0)); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('g', 1)); + _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('g', 2)); + _globals._spriteIndexes[10] = _scene->_sprites.addSprites(formAnimName('h', 2)); + _globals._spriteIndexes[11] = _scene->_sprites.addSprites(formAnimName('h', 3)); + _rexBeingEaten = false; + + if (!_game._visitedScenes._sceneRevisited) { + _globals[kDogStatus] = 3; + _dogActiveFl = true; + } else + _dogActiveFl = (_globals[kDogStatus] != 4); + } else { + _globals[kDogStatus] = 4; + _dogActiveFl = false; + } + + _dogSquashFl = false; + _buttonPressedonTimeFl = false; + _dogWindowTimer = 0; + _dogRunTimer = 0; + _dogHitWindow = false; + _checkFl = false; + _dogUnderCar = false; + _dogYelping = false; + + + if (!_game._visitedScenes._sceneRevisited) + _globals[kCarStatus] = 0; + + _animationMode = 0; + _carMoveMode = 0; + _carFrame = -1; + + if (_globals[kCarStatus] == 0) { + _carMode = 0; + _dogDeathMode = 0; + _resetPositionsFl = false; + int idx = _scene->_dynamicHotspots.add(0x324, VERB_WALKTO, -1, Common::Rect(99, 69, 99 + 82, 69 + 25)); + _carHotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(96, 132), FACING_NORTHEAST); + _scene->loadAnimation(formAnimName('A', -1)); + } else if (_globals[kCarStatus] == 3) { + _carMode = 0; + _dogDeathMode = 0; + _resetPositionsFl = false; + int idx = _scene->_dynamicHotspots.add(0x324, VERB_WALKTO, -1, Common::Rect(100, 100, 100 + 82, 100 + 25)); + _carHotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(96, 132), FACING_NORTHEAST); + _scene->loadAnimation(formAnimName('A', -1)); + _scene->_activeAnimation->setCurrentFrame(6); + } else if (_globals[kCarStatus] == 1) { + _carMode = 2; + _dogDeathMode = 0; + _resetPositionsFl = false; + int idx = _scene->_dynamicHotspots.add(0x324, VERB_WALKTO, -1, Common::Rect(99, 69, 99 + 82, 69 + 25)); + _carHotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(96, 132), FACING_NORTHEAST); + _scene->loadAnimation(formAnimName('C', -1)); + } else if (_globals[kCarStatus] == 2) { + _carMode = 1; + _dogDeathMode = 2; + _resetPositionsFl = true; + int idx = _scene->_dynamicHotspots.add(0x324, VERB_WALKTO, -1, Common::Rect(99, 69, 99 + 82, 69 + 25)); + _carHotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(96, 132), FACING_NORTHEAST); + _scene->loadAnimation(formAnimName('B', -1)); + } else { + _carMode = 3; + _dogDeathMode = 2; + _resetPositionsFl = true; + int idx = _scene->_dynamicHotspots.add(0x324, VERB_WALKTO, -1, Common::Rect(100, 100, 100 + 82, 100 + 25)); + _carHotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(96, 132), FACING_NORTHEAST); + _scene->loadAnimation(formAnimName('D', -1)); + } + + _vm->_palette->setEntry(252, 63, 44, 30); + _vm->_palette->setEntry(253, 63, 20, 22); + + if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(46, 132); + _game._player._facing = FACING_EAST; + if (_game._difficulty == DIFFICULTY_HARD) { + if (!_game._visitedScenes._sceneRevisited) + _dogFirstEncounter = true; + else if (_dogActiveFl) + resetDogVariables(); + } + } else if ((_game._difficulty == DIFFICULTY_HARD) && !_dogFirstEncounter && _dogActiveFl) { + if (!_dogUnderCar) + resetDogVariables(); + else { + _globals._sequenceIndexes[10] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[10], false, 9, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[10], 10, 11); + _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 6); + } + } + + sceneEntrySound(); + + if (_scene->_roomChanged) + _game._objects.addToInventory(OBJ_BONES); + + _game.loadQuoteSet(0x2FB, 0x2FC, 0x2FE, 0x2FD, 0x2FF, 0x300, 0x301, 0x302, 0x303, 0x304, 0); +} + +void Scene608::step() { + if (_dogFirstEncounter) { + long diff = _scene->_frameStartTime - _dogTimer1; + if ((diff >= 0) && (diff <= 1)) + _dogWindowTimer += diff; + else + _dogWindowTimer++; + + _dogTimer1 = _scene->_frameStartTime; + } + + if (_dogActiveFl && (_dogWindowTimer >= 2) && !_dogHitWindow) { + _dogHitWindow = true; + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 11, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 1); + _vm->_sound->command(14); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 70); + _dogWindowTimer = 0; + } + + if (_game._trigger == 70) + resetDogVariables(); + + if ((_game._difficulty == DIFFICULTY_HARD) && !_animationMode && _dogActiveFl && !_dogFirstEncounter && !_dogUnderCar) { + if (!_dogBarkingFl) { + if (_vm->getRandomNumber(1, 50) == 10) { + _dogBarkingFl = true; + _scene->_sequences.remove(_globals._sequenceIndexes[5]); + _globals._sequenceIndexes[5] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[5], false, 5, 8, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 4); + int idx = _scene->_dynamicHotspots.add(0x471, VERB_WALKTO, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(194, 142), FACING_EAST); + _barkCount = 0; + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_SPRITE, 2, 100); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 60); + } + } else if (_game._trigger == 60) { + int syncIdx = _globals._sequenceIndexes[5]; + _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 6); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[5], syncIdx); + _scene->_kernelMessages.reset(); + _dogBarkingFl = false; + } + } + + if ((_game._trigger == 100) && _dogBarkingFl) { + _vm->_sound->command(12); + _barkCount++; + + if ((_barkCount >= 1) && (_barkCount <= 4)) { + Common::Point _barkPos(0, 0); + switch (_barkCount) { + case 1: + _barkPos = Common::Point(197, 66); + break; + + case 2: + _barkPos = Common::Point(230, 76); + break; + + case 3: + _barkPos = Common::Point(197, 86); + break; + + case 4: + _barkPos = Common::Point(230, 97); + break; + + default: + break; + } + _scene->_kernelMessages.add(_barkPos, 0xFDFC, 0, 0, 120, _game.getQuote(0x2FB)); + } + } + + if (_dogSquashFl && !_dogFirstEncounter && _dogUnderCar && _dogActiveFl) { + long diff = _scene->_frameStartTime - _dogTimer2; + if ((diff >= 0) && (diff <= 4)) + _dogRunTimer += diff; + else + _dogRunTimer++; + + _dogTimer2 = _scene->_frameStartTime; + } + + // CHECKME: _checkFl is always false? + if (_dogRunTimer >= 480 && !_checkFl && !_buttonPressedonTimeFl && !_dogFirstEncounter && _dogUnderCar && _dogActiveFl) { + _checkFl = true; + _dogSquashFl = false; + _dogSafeFl = true; + _checkFl = false; + _dogRunTimer = 0; + } else { + _dogSafeFl = false; + if (_game._player._moving && (_game._difficulty == DIFFICULTY_HARD) && _dogActiveFl && (_scene->_rails.getNext() > 0) && _dogUnderCar) + _dogSafeFl = true; + } + + if (_dogActiveFl && _dogSafeFl && !_buttonPressedonTimeFl) { + _dogDeathMode = 0; + _globals[kCarStatus] = 0; + _carMode = 0; + _scene->_sequences.remove(_globals._sequenceIndexes[10]); + _dogUnderCar = false; + _dogYelping = false; + _scene->_kernelMessages.reset(); + _globals._sequenceIndexes[11] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[11], false, 6, 1, 0, 0); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[11], SEQUENCE_TRIGGER_EXPIRE, 0, 92); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x2FF)); + } + + if (_game._trigger == 92) { + resetDogVariables(); + _animationMode = 0; + } + + if ((_carMode == 4) && (_scene->_activeAnimation != nullptr)) { + if (_scene->_activeAnimation->getCurrentFrame() != _carFrame) { + _carFrame = _scene->_activeAnimation->getCurrentFrame(); + int nextFrame = -1; + + if (_carFrame == 10) { + _game._player._visible = true; + _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; + } + + if (_carFrame == 56) { + resetDogVariables(); + _animationMode = 0; + _nextTrigger = 2; + } + + if ((nextFrame >= 0) && (nextFrame != _scene->_activeAnimation->getCurrentFrame())) { + _scene->_activeAnimation->setCurrentFrame(nextFrame); + _carFrame = nextFrame; + } + } + } + + if ((_carMode == 5) && (_scene->_activeAnimation != nullptr)) { + if (_scene->_activeAnimation->getCurrentFrame() != _carFrame) { + _carFrame = _scene->_activeAnimation->getCurrentFrame(); + int nextFrame = -1; + + if (_carFrame == 10) { + _game._player._visible = true; + _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; + } + + if (_carFrame == 52) { + resetDogVariables(); + _animationMode = 0; + _nextTrigger = 2; + } + + if ((nextFrame >= 0) && (nextFrame != _scene->_activeAnimation->getCurrentFrame())) { + _scene->_activeAnimation->setCurrentFrame(nextFrame); + _carFrame = nextFrame; + } + } + } + + + if ((_carMode == 6) && (_scene->_activeAnimation != nullptr)) { + if (_scene->_activeAnimation->getCurrentFrame() != _carFrame) { + _carFrame = _scene->_activeAnimation->getCurrentFrame(); + int nextFrame = -1; + + if (_carFrame == 11) { + _game._player._visible = true; + _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; + } + + if (_carFrame == 41) { + _globals._sequenceIndexes[10] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[10], false, 9, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[10], 10, 11); + _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 6); + _dogUnderCar = true; + _nextTrigger = 2; + } + + + if ((nextFrame >= 0) && (nextFrame != _scene->_activeAnimation->getCurrentFrame())) { + _scene->_activeAnimation->setCurrentFrame(nextFrame); + _carFrame = nextFrame; + } + } + } + + if (_dogUnderCar) { + if (!_dogYelping) { + if (_vm->getRandomNumber(1, 50) == 10) { + _dogYelping = true; + _barkCount = 0; + _scene->_sequences.addTimer(12, 110); + _scene->_sequences.addTimer(22, 111); + _scene->_sequences.addTimer(120, 112); + } + _scene->_kernelMessages.reset(); + } + } else + _dogYelping = false; + + if (_game._trigger == 110) { + _vm->_sound->command(12); + _scene->_kernelMessages.add(Common::Point(150, 97), 0xFDFC, 0, 0, 60, _game.getQuote(0x303)); + } + + if (_game._trigger == 111) { + _vm->_sound->command(12); + _scene->_kernelMessages.add(Common::Point(183, 93), 0xFDFC, 0, 0, 60, _game.getQuote(0x303)); + } + + if (_game._trigger == 112) + _dogYelping = false; + + if ((_carMode == 0) && (_scene->_activeAnimation != nullptr)) { + if (_scene->_activeAnimation->getCurrentFrame() != _carFrame) { + _carFrame = _scene->_activeAnimation->getCurrentFrame(); + int nextFrame = -1; + + if ((_globals[kCarStatus] == 0) || (_globals[kCarStatus] == 3)) { + switch (_carMoveMode) { + case 0: + if (_globals[kCarStatus] == 0) + nextFrame = 0; + else + nextFrame = 6; + break; + + case 1: + if (_scene->_activeAnimation->getCurrentFrame() >= 12) { + nextFrame = 0; + _carMoveMode = 0; + _globals[kCarStatus] = 0; + } + break; + + case 2: + if (_scene->_activeAnimation->getCurrentFrame() >= 6) { + nextFrame = 6; + _carMoveMode = 0; + _globals[kCarStatus] = 3; + } + break; + + default: + break; + } + } + + if ((nextFrame >= 0) && (nextFrame != _scene->_activeAnimation->getCurrentFrame())) { + _scene->_activeAnimation->setCurrentFrame(nextFrame); + _carFrame = nextFrame; + } + } + } + + if ((_carMode == 2) && (_scene->_activeAnimation != nullptr)) { + if (_scene->_activeAnimation->getCurrentFrame() != _carFrame) { + _carFrame = _scene->_activeAnimation->getCurrentFrame(); + int nextFrame = -1; + + if (_carMoveMode == 0) + nextFrame = 28; + else if (_scene->_activeAnimation->getCurrentFrame() >= 28) { + nextFrame = 28; + _carMoveMode = 0; + } + + if ((nextFrame >= 0) && (nextFrame != _scene->_activeAnimation->getCurrentFrame())) { + _scene->_activeAnimation->setCurrentFrame(nextFrame); + _carFrame = nextFrame; + } + } + } + + if ((_carMode == 3) && (_scene->_activeAnimation != nullptr)) { + if (_scene->_activeAnimation->getCurrentFrame() != _carFrame) { + _carFrame = _scene->_activeAnimation->getCurrentFrame(); + int nextFrame = -1; + + if (_resetPositionsFl) { + nextFrame = 0; + _carMoveMode = 0; + } else if (_carMoveMode == 0) + nextFrame = 6; + else if (_scene->_activeAnimation->getCurrentFrame() >= 6) { + nextFrame = 6; + _carMoveMode = 0; + } + + if ((nextFrame >= 0) && (nextFrame != _scene->_activeAnimation->getCurrentFrame())) { + _scene->_activeAnimation->setCurrentFrame(nextFrame); + _carFrame = nextFrame; + } + } + } + + + if ((_carMode == 1) && (_scene->_activeAnimation != nullptr)) { + if (_scene->_activeAnimation->getCurrentFrame() != _carFrame) { + _carFrame = _scene->_activeAnimation->getCurrentFrame(); + int nextFrame = -1; + + if (_resetPositionsFl) { + nextFrame = 0; + _carMoveMode = 0; + } else if (_carMoveMode == 0) + nextFrame = 6; + else if (_scene->_activeAnimation->getCurrentFrame() >= 6) { + nextFrame = 6; + _carMoveMode = 0; + } + + if ((nextFrame >= 0) && (nextFrame != _scene->_activeAnimation->getCurrentFrame())) { + _scene->_activeAnimation->setCurrentFrame(nextFrame); + _carFrame = nextFrame; + } + } + } + + if (_game._player._moving && (_game._difficulty == DIFFICULTY_HARD) && _dogActiveFl && (_scene->_rails.getNext() > 0)) { + _game._player.cancelCommand(); + _game._player.startWalking(Common::Point(194, 142), FACING_EAST); + _scene->_rails.resetNext(); + if (_dogUnderCar) + _dogSafeFl = true; + } + + if (_game._player._special > 0 && (_game._difficulty == DIFFICULTY_HARD) && _dogActiveFl && _game._player._stepEnabled) + _game._player._stepEnabled = false; + + if ((_game._difficulty == DIFFICULTY_HARD) && _dogActiveFl && (_game._player._playerPos == Common::Point(194, 142)) + && (_game._trigger || !_rexBeingEaten)) { + _rexBeingEaten = true; + switch (_game._trigger) { + case 0: + _scene->_sequences.remove(_globals._sequenceIndexes[5]); + _animationMode = 1; + _globals._sequenceIndexes[9] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 10, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[9], 1, 2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 5); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SEQUENCE_TRIGGER_EXPIRE, 0, 80); + _scene->_sequences.addTimer(10, 85); + break; + + case 80: + _game._player._visible = false; + _globals._sequenceIndexes[9] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 10, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[9], 3, 5); + _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 5); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[9], -1); + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x2FC)); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SEQUENCE_TRIGGER_EXPIRE, 0, 81); + break; + + case 81: { + int syncIdx = _globals._sequenceIndexes[9]; + _globals._sequenceIndexes[9] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 5, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[9], 6, 38); + _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 5); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[9], syncIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SEQUENCE_TRIGGER_EXPIRE, 0, 82); + } + break; + + case 82: { + int syncIdx = _globals._sequenceIndexes[9]; + _globals._sequenceIndexes[9] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[9], false, 15, 5, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[9], 39, 40); + _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 5); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[9], syncIdx); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SEQUENCE_TRIGGER_EXPIRE, 0, 83); + } + break; + + case 83: { + _animationMode = 2; + int syncIdx = _globals._sequenceIndexes[9]; + _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 5); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[9], syncIdx); + _scene->_sequences.addTimer(60, 84); + } + break; + + case 84: + _rexBeingEaten = false; + _animationMode = 0; + _scene->_reloadSceneFlag = true; + _game._player._stepEnabled = true; + break; + + case 85: + if (_rexBeingEaten && (_animationMode == 1)) { + _vm->_sound->command(12); + _scene->_sequences.addTimer(10, 85); + } + break; + + default: + break; + } + } +} + +void Scene608::preActions() { + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + + if ((_action.isAction(VERB_THROW, 0x2C, 0x410) || _action.isAction(VERB_THROW, 0x2D, 0x410) + || _action.isAction(VERB_THROW, 0x2C, 0x411) || _action.isAction(VERB_THROW, 0x2D, 0x411) + || _action.isAction(VERB_THROW, 0x2D, 0x471) || _action.isAction(VERB_THROW, 0x2C, 0x471)) && _dogActiveFl) { + _game._player._stepEnabled = false; + _game._player.walk(Common::Point(56, 146), FACING_EAST); + } + + if ((_action.isAction(VERB_THROW, 0x2D, 0x41D) || _action.isAction(VERB_THROW, 0x2C, 0x41D) + || _action.isAction(VERB_THROW, 0x2D, 0x41E) || _action.isAction(VERB_THROW, 0x2C, 0x41E)) && _dogActiveFl) { + _game._player._stepEnabled = false; + _game._player.walk(Common::Point(75, 136), FACING_EAST); + } + + if (_action.isAction(VERB_PUSH, 0x403) && _dogUnderCar) { + _buttonPressedonTimeFl = true; + _dogDeathMode = 1; + } else + _buttonPressedonTimeFl = false; +} + +void Scene608::actions() { + if (_action.isAction(0x18B, 0x70)) + _scene->_nextSceneId = 607; + else if (_action.isAction(VERB_PUSH, 0x403)) { + _game._player._stepEnabled = true; + switch (_game._trigger) { + case 0: + if ((_globals[kCarStatus] == 0) || (_globals[kCarStatus] == 1) || (_globals[kCarStatus] == 2)) { + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], true, 6, 2, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 2); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 1); + } else + _vm->_dialogs->show(60839); + break; + + case 1: + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[3]); + _game._player._visible = true; + if (_dogDeathMode == 0) + _carMode = 0; + else if (_dogDeathMode == 1) { + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x300)); + _globals[kCarStatus] = 1; + _carMode = 2; + _globals[kDogStatus] = 4; + _dogActiveFl = false; + _dogUnderCar = false; + _scene->_sequences.remove(_globals._sequenceIndexes[10]); + _scene->freeAnimation(); + _scene->loadAnimation(formAnimName('C', -1)); + } else { + _resetPositionsFl = false; + _carMode = 1; + _scene->freeAnimation(); + _scene->loadAnimation(formAnimName('B', -1)); + } + + _carMoveMode = 2; + _scene->_sequences.addTimer(1, 2); + break; + + case 2: + if (_carMoveMode != 0) + _scene->_sequences.addTimer(1, 2); + else { + _scene->_dynamicHotspots.remove(_carHotspotId); + int idx = _scene->_dynamicHotspots.add(0x324, VERB_WALKTO, -1, Common::Rect(100, 100, 100 + 82, 100 + 25)); + _carHotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(96, 132), FACING_NORTHEAST); + if (_globals[kCarStatus] == 1) + _scene->_sequences.addTimer(120, 3); + else { + if (_dogDeathMode == 0) + _globals[kCarStatus] = 3; + else { + _globals[kCarStatus] = 4; + _carMode = 3; + _dogDeathMode = 2; + } + _game._player._stepEnabled = true; + } + } + break; + + case 3: + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x302)); + _globals[kCarStatus] = 4; + _carMode = 3; + _dogDeathMode = 2; + _game._player._stepEnabled = true; + break; + + default: + break; + } + } else if (_action.isAction(VERB_PUSH, 0x402)) { + switch (_game._trigger) { + case 0: + if ((_globals[kCarStatus] == 3) || (_globals[kCarStatus] == 4)) { + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], true, 6, 2, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 3); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 1); + } else + _vm->_dialogs->show(60840); + break; + + case 1: + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[3]); + _game._player._visible = true; + if (_dogDeathMode == 0) + _carMode = 0; + else { + _carMode = 3; + _resetPositionsFl = false; + _scene->freeAnimation(); + _scene->loadAnimation(formAnimName('D', -1)); + } + _carMoveMode = 1; + _scene->_sequences.addTimer(1, 2); + break; + + case 2: { + if (_carMoveMode != 0) + _scene->_sequences.addTimer(1, 2); + else if (_dogDeathMode == 0) + _globals[kCarStatus] = 0; + else if (_dogDeathMode == 2) { + _globals[kCarStatus] = 2; + _carMode = 3; + _dogDeathMode = 2; + } + _scene->_dynamicHotspots.remove(_carHotspotId); + int idx = _scene->_dynamicHotspots.add(0x324, VERB_WALKTO, -1, Common::Rect(99, 69, 99 + 82, 69 + 25)); + _carHotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(96, 132), FACING_NORTHEAST); + _game._player._stepEnabled = true; + } + break; + + default: + break; + } + } else if (_action.isAction(VERB_THROW, 0x2C, 0x410) || _action.isAction(VERB_THROW, 0x2D, 0x410) + || _action.isAction(VERB_THROW, 0x2D, 0x471) || _action.isAction(VERB_THROW, 0x2C, 0x471)) { + _game._player._stepEnabled = true; + if (_dogActiveFl) { + if (_game._trigger == 0) { + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x2FE)); + } + _throwMode = 4; + handleThrowingBone(); + } else + _vm->_dialogs->show(60841); + } else if (_action.isAction(VERB_THROW, 0x2C, 0x411) || _action.isAction(VERB_THROW, 0x2D, 0x411)) { + _game._player._stepEnabled = true; + if (_dogActiveFl) { + if (_game._trigger == 0) { + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x2FD)); + } + _throwMode = 5; + handleThrowingBone(); + } else + _vm->_dialogs->show(60841); + } else if (_action.isAction(VERB_THROW, 0x2D, 0x41D) || _action.isAction(VERB_THROW, 0x2C, 0x41D) + || _action.isAction(VERB_THROW, 0x2D, 0x41E) || _action.isAction(VERB_THROW, 0x2C, 0x41E)) { + _game._player._stepEnabled = true; + if ((_globals[kCarStatus] == 0) && _dogActiveFl) { + if (_dogActiveFl) { + if (_game._trigger == 0) { + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0,0), 0x1110, 34, 0, 120, _game.getQuote(0x301)); + } + _throwMode = 6; + handleThrowingBone(); + } else + _vm->_dialogs->show(60841); + } else + _vm->_dialogs->show(60842); + } else if (_action.isAction(VERB_TAKE, 0x115) && (_game._trigger || !_game._objects.isInInventory(OBJ_POLYCEMENT))) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], true, 6, 2, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[2]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_SPRITE, 4, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + + case 1: + _vm->_sound->command(9); + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _scene->_dynamicHotspots.remove(_polycementHotspotId); + break; + + case 2: + _game._objects.addToInventory(OBJ_POLYCEMENT); + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[2]); + _game._player._visible = true; + _game._player._stepEnabled = true; + _vm->_dialogs->showItem(OBJ_POLYCEMENT, 60833); + break; + + default: + break; + } + } else if (_action.isAction(VERB_TAKE, 0x120) && (_game._trigger || !_game._objects.isInInventory(OBJ_REARVIEW_MIRROR))) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], true, 6, 2, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 2); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[2]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_SPRITE, 2, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + + case 1: + _vm->_sound->command(9); + _scene->_sequences.remove(_globals._sequenceIndexes[12]); + _game._objects.addToInventory(OBJ_REARVIEW_MIRROR); + _vm->_dialogs->showItem(OBJ_REARVIEW_MIRROR, 60827); + break; + + case 2: + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[2]); + _game._player._visible = true; + _game._player._stepEnabled = true; + break; + + default: + break; + } + } else if (_action._lookFlag) { + if (_game._difficulty != DIFFICULTY_HARD) + _vm->_dialogs->show(60810); + else if (_globals[kDogStatus] == 4) + _vm->_dialogs->show(60812); + else + _vm->_dialogs->show(60811); + } else if (_action.isAction(VERB_LOOK) && (_action.isAction(0x412) || _action.isAction(0x408) || _action.isAction(0x414) + || _action.isAction(0x40D) || _action.isAction(0x41C))) + _vm->_dialogs->show(60813); + else if (_action.isAction(VERB_TAKE) && (_action.isAction(0x412) || _action.isAction(0x408) || _action.isAction(0x414) + || _action.isAction(0x40D) || _action.isAction(0x41C))) + _vm->_dialogs->show(60814); + else if (_action.isAction(VERB_LOOK, 0x409) || _action.isAction(VERB_LOOK, 0x411) || _action.isAction(VERB_LOOK, 0x410)) { + if (_dogActiveFl) + _vm->_dialogs->show(60815); + else + _vm->_dialogs->show(60816); + } else if (_action.isAction(VERB_LOOK, 0x495)) + _vm->_dialogs->show(60817); + else if (_action.isAction(VERB_TAKE, 0x495)) { + if (_game._difficulty == DIFFICULTY_HARD) + _vm->_dialogs->show(60818); + else + _vm->_dialogs->show(60819); + } else if (_action.isAction(VERB_LOOK, 0x402)) + _vm->_dialogs->show(60820); + else if (_action.isAction(VERB_LOOK, 0x403)) + _vm->_dialogs->show(60821); + else if (_action.isAction(VERB_LOOK, 0x41A)) + _vm->_dialogs->show(60822); + else if (_action.isAction(VERB_LOOK, 0x418)) + _vm->_dialogs->show(60823); + else if (_action.isAction(VERB_LOOK, 0x330)) { + if (_game._objects[OBJ_REARVIEW_MIRROR]._roomNumber == _scene->_currentSceneId) + _vm->_dialogs->show(60825); + else + _vm->_dialogs->show(60824); + } else if (_action.isAction(VERB_OPEN, 0x330)) + _vm->_dialogs->show(60826); + else if (_action.isAction(VERB_LOOK, 0x120) && (_action._mainObjectSource == 4)) + _vm->_dialogs->show(60828); + else if (_action.isAction(VERB_LOOK, 0x406)) { + if (_game._objects[OBJ_POLYCEMENT]._roomNumber == _scene->_currentSceneId) + _vm->_dialogs->show(60829); + else + _vm->_dialogs->show(60830); + } else if (_action.isAction(VERB_OPEN, 0x406)) + _vm->_dialogs->show(60831); + else if ((_action.isAction(VERB_LOOK, 0x115)) && (_game._objects.isInRoom(OBJ_POLYCEMENT))) + _vm->_dialogs->show(60832); + else if (_action.isAction(VERB_LOOK, 0x417) || _action.isAction(VERB_LOOK, 0x40E)) + _vm->_dialogs->show(60834); + else if (_action.isAction(VERB_LOOK, 0x407)) + _vm->_dialogs->show(60835); + else if (_action.isAction(VERB_LOOK, 0x47) || _action.isAction(VERB_LOOK, 0x4A0)) + _vm->_dialogs->show(60836); + else if (_action.isAction(VERB_LOOK, 0x41E)) + _vm->_dialogs->show(60838); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + void Scene620::setup() { _game._player._spritesPrefix = ""; setAAName(); } void Scene620::enter() { - _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('b', 0)); + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('b', 0)); _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -1); _game._player._stepEnabled = false; - _game._player._visible = false; + _game._player._visible = false; _scene->_sequences.addTimer(30, 70); _scene->_userInterface.setup(kInputLimitedSentences); sceneEntrySound(); @@ -1435,7 +2395,7 @@ void Scene620::enter() { void Scene620::step() { switch (_game._trigger) { - case 70: + case 70: _scene->_sequences.remove(_globals._sequenceIndexes[1]); _scene->loadAnimation(formAnimName('E', -1), 71); break; @@ -1445,7 +2405,7 @@ void Scene620::step() { _globals[kCityFlooded] = true; _globals[kTeleporterRoom + 5] = 0; _scene->_nextSceneId = 701; - } else if (_scene->_priorSceneId == 752) { + } else if (_scene->_priorSceneId == 752) { _globals[kCityFlooded] = true; _globals[kTeleporterRoom + 5] = 0; _scene->_nextSceneId = 702; @@ -1455,7 +2415,7 @@ void Scene620::step() { _scene->_nextSceneId = _scene->_priorSceneId; } else if (_scene->_priorSceneId >= 501 && _scene->_priorSceneId <= 612) { _globals[kResurrectRoom] = _globals[kHoverCarLocation]; - _game._objects.addToInventory(OBJ_TIMEBOMB); + _game._objects.addToInventory(OBJ_TIMEBOMB); _globals[kTimebombStatus] = 0; _globals[kTimebombTimer] = 0; _scene->_nextSceneId = 605; diff --git a/engines/mads/nebular/nebular_scenes6.h b/engines/mads/nebular/nebular_scenes6.h index 69db9eb4f3..d259eab61e 100644 --- a/engines/mads/nebular/nebular_scenes6.h +++ b/engines/mads/nebular/nebular_scenes6.h @@ -161,6 +161,54 @@ public: virtual void postActions() {}; }; +class Scene608: public Scene6xx{ +private: + int _carMode; + int _carFrame; + int _carMoveMode; + int _dogDeathMode; + int _carHotspotId; + int _barkCount; + int _polycementHotspotId; + int _animationMode; + int _nextTrigger; + int _throwMode; + + bool _resetPositionsFl; + bool _dogActiveFl; + bool _dogBarkingFl; + bool _dogFirstEncounter; + bool _rexBeingEaten; + bool _dogHitWindow; + bool _checkFl; + bool _dogSquashFl; + bool _dogSafeFl; + bool _buttonPressedonTimeFl; + bool _dogUnderCar; + bool _dogYelping; + + long _dogWindowTimer; + long _dogRunTimer; + + uint32 _dogTimer1; + uint32 _dogTimer2; + + void resetDogVariables(); + void restoreAnimations(); + void setCarAnimations(); + void handleThrowingBone(); + +public: + Scene608(MADSEngine *vm) : Scene6xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; + class Scene620: public Scene6xx{ public: Scene620(MADSEngine *vm) : Scene6xx(vm) {} -- cgit v1.2.3 From 85c311059c3fe562b688765820066825a47d2f10 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 13 May 2014 00:15:48 +0200 Subject: MADS: Implement scene 609 --- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes6.cpp | 333 ++++++++++++++++++++++++++++++- engines/mads/nebular/nebular_scenes6.h | 17 ++ 3 files changed, 346 insertions(+), 6 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index fa2c4a3d58..debc1df78d 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -239,7 +239,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 608: // inside Abdul's garage return new Scene608(vm); case 609: // outside Buckluster video store - return new DummyScene(vm); // TODO + return new Scene609(vm); case 610: // inside Buckluster video store return new DummyScene(vm); // TODO case 611: // back alley diff --git a/engines/mads/nebular/nebular_scenes6.cpp b/engines/mads/nebular/nebular_scenes6.cpp index 6c228c1234..f934c42750 100644 --- a/engines/mads/nebular/nebular_scenes6.cpp +++ b/engines/mads/nebular/nebular_scenes6.cpp @@ -1255,11 +1255,11 @@ void Scene607::handleThrowingBone() { _dogBarking = false; if (_game._objects.isInInventory(OBJ_BONE)) { - _game._objects.setRoom(OBJ_BONE, NOWHERE); + _game._objects.setRoom(OBJ_BONE, 1); if (_animationMode == 1) _globals[kBone202Status] = 0; } else { - _game._objects.setRoom(OBJ_BONES, NOWHERE); + _game._objects.setRoom(OBJ_BONES, 1); _game._objects.addToInventory(OBJ_BONE); } @@ -1505,9 +1505,9 @@ void Scene608::handleThrowingBone() { _scene->_sequences.addTimer(1, 2); else { if (_game._objects.isInInventory(OBJ_BONE)) - _game._objects.setRoom(OBJ_BONE, NOWHERE); + _game._objects.setRoom(OBJ_BONE, 1); else { - _game._objects.setRoom(OBJ_BONES, NOWHERE); + _game._objects.setRoom(OBJ_BONES, 1); _game._objects.addToInventory(OBJ_BONE); } _scene->_sequences.addTimer(60, 3); @@ -2247,7 +2247,7 @@ void Scene608::actions() { if (_dogActiveFl) { if (_game._trigger == 0) { _scene->_kernelMessages.reset(); - _scene->_kernelMessages.add(Common::Point(0,0), 0x1110, 34, 0, 120, _game.getQuote(0x301)); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x301)); } _throwMode = 6; handleThrowingBone(); @@ -2378,6 +2378,329 @@ void Scene608::actions() { /*------------------------------------------------------------------------*/ +void Scene609::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene609::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('c', 0)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 0)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('h', 0)); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites("*RXCD_9"); + _globals._spriteIndexes[5] = _scene->_sprites.addSprites("*RXMRC_9"); + + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 5); + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 9); + + if (!_game._visitedScenes._sceneRevisited) + _globals[kBeenInVideoStore] = false; + + if (_scene->_priorSceneId == 611) { + _game._player._playerPos = Common::Point(264, 69); + _game._player._facing = FACING_SOUTHWEST; + } else if (_scene->_priorSceneId == 610) { + _game._player._playerPos = Common::Point(23, 90); + _game._player._facing = FACING_EAST; + _scene->_sequences.addTimer(60, 60); + _game._player._stepEnabled = false; + } else if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(86, 136); + _game._player._facing = FACING_NORTHEAST; + _game._player._visible = false; + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 5); + _scene->loadAnimation(formAnimName('R', 1), 70); + } + + if (_scene->_roomChanged) { + _game._objects.addToInventory(OBJ_DOOR_KEY); + if (_game._difficulty != DIFFICULTY_EASY) + _game._objects.addToInventory(OBJ_PENLIGHT); + } + + sceneEntrySound(); + _game.loadQuoteSet(0x305, 0x306, 0x307, 0x308, 0x309, 0); +} + +void Scene609::step() { + switch (_game._trigger) { + case 60: + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 7, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 9); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 61); + break; + + case 61: + _scene->_hotspots.activate(0x425, false); + _game._player.walk(Common::Point(101, 100), FACING_EAST); + _scene->_sequences.addTimer(180, 62); + break; + + case 62: + _scene->_sequences.remove( _globals._sequenceIndexes[2]); + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 7, 1, 0, 0); + _scene->_hotspots.activate(0x425, true); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 9); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 63); + break; + + case 63: + if (!_globals[kHasTalkedToHermit] && (_game._difficulty != DIFFICULTY_HARD)) { + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 26, 2, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 7); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[3], Common::Point(287, 73)); + _scene->_sequences.setScale(_globals._sequenceIndexes[3], 47); + } + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 9); + _game._player._stepEnabled = true; + break; + + default: + break; + } + + switch (_game._trigger) { + case 70: + _game._player._visible = true; + _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; + _scene->_sequences.addTimer(6, 71); + break; + + case 71: + if (!_globals[kHasTalkedToHermit]) { + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 26, 2, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 7); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[3], Common::Point(287, 73)); + _scene->_sequences.setScale(_globals._sequenceIndexes[3], 47); + } + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 5); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 72); + break; + + case 72: + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 5); + _game._player._stepEnabled = true; + break; + + default: + break; + } +} + +void Scene609::enterStore() { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + if (_videoDoorMode == 2) + _scene->_sequences.addTimer(1, 4); + else { + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x305)); + _scene->_sequences.addTimer(120, 1); + } + break; + + case 1: + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x306)); + _scene->_sequences.addTimer(60, 2); + break; + + case 2: + _game._player._visible = false; + _globals._sequenceIndexes[5] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[5], true, 11, 2, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 1, 2); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 3); + break; + + case 3: + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[5]); + _game._player._visible = true; + _game._objects.setRoom(OBJ_DOOR_KEY, 1); + _scene->_sequences.addTimer(15, 4); + break; + + case 4: + _game._player._visible = false; + _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], true, 1); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); + _scene->_sequences.addTimer(15, 5); + break; + + case 5: + _scene->_sequences.remove(_globals._sequenceIndexes[5]); + _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; + _game._player._visible = true; + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 7, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 9); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 6); + break; + + case 6: + _scene->_hotspots.activate(0x425, false); + if (_videoDoorMode == 1) { + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 180, _game.getQuote(0x307)); + } + _game._player.walk(Common::Point(23, 90), FACING_WEST); + _scene->_sequences.addTimer(180, 7); + break; + + case 7: + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 7, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 9); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 8); + break; + + case 8: + _scene->_hotspots.activate(0x425, true); + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 9); + _globals[kBeenInVideoStore] = true; + _game._player._stepEnabled = true; + _scene->_nextSceneId = 610; + break; + + default: + break; + } +} + +void Scene609::preActions() { + if (_action.isAction(0x17B, 0x6F, 0x425)) + _game._player.walk(Common::Point(78, 99), FACING_NORTHWEST); +} + +void Scene609::actions() { + if (_action.isAction(0x18C, 0x423)) + _scene->_nextSceneId = 611; + else if (_action.isAction(0x18B, 0x425)) { + if (!_globals[kBeenInVideoStore]) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x308)); + _scene->_sequences.addTimer(120, 1); + break; + + case 1: + _game._player._visible = false; + _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], true, 1); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); + _scene->_sequences.addTimer(30, 2); + break; + + case 2: + _scene->_sequences.remove(_globals._sequenceIndexes[5]); + _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; + _game._player._visible = true; + _scene->_sequences.addTimer(60, 3); + break; + + case 3: + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x309)); + _scene->_sequences.addTimer(120, 4); + break; + + case 4: + _game._player._stepEnabled = true; + break; + + default: + break; + } + } else { + _videoDoorMode = 2; + enterStore(); + } + } else if (_action.isAction(0x17B, 0x6F, 0x425)) { + _videoDoorMode = 1; + enterStore(); + } else if (_action.isAction(0x325, 0x324)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.startReverseCycle (_globals._spriteIndexes[1], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 5); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 1); + break; + + case 1: { + int syncIdx = _globals._sequenceIndexes[1]; + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 5); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[1], syncIdx); + _scene->_sequences.addTimer(6, 2); + } + break; + + case 2: + _game._player._visible = false; + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 10, 1, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 3); + break; + + case 3: { + int syncIdx = _globals._sequenceIndexes[4]; + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, -2); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], syncIdx); + _scene->_nextSceneId = 504; + } + break; + + default: + break; + } + } else if (_action._lookFlag) + _vm->_dialogs->show(60910); + else if (_action.isAction(VERB_LOOK, 0x31E)) + _vm->_dialogs->show(60911); + else if (_action.isAction(VERB_LOOK, 0x421)) + _vm->_dialogs->show(60912); + else if (_action.isAction(VERB_LOOK, 0x427)) + _vm->_dialogs->show(60913); + else if (_action.isAction(VERB_LOOK, 0x33A)) + _vm->_dialogs->show(60914); + else if (_action.isAction(VERB_LOOK, 0x2CD)) + _vm->_dialogs->show(60915); + else if (_action.isAction(VERB_LOOK, 0x324)) + _vm->_dialogs->show(60916); + else if (_action.isAction(VERB_LOOK, 0x41F)) + _vm->_dialogs->show(60917); + else if (_action.isAction(VERB_LOOK, 0x425)) { + if (!_globals[kBeenInVideoStore]) + _vm->_dialogs->show(60918); + else + _vm->_dialogs->show(60919); + } else if (_action.isAction(0x1AD, 0x31E)) + _vm->_dialogs->show(60730); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + void Scene620::setup() { _game._player._spritesPrefix = ""; setAAName(); diff --git a/engines/mads/nebular/nebular_scenes6.h b/engines/mads/nebular/nebular_scenes6.h index d259eab61e..a5fa754a85 100644 --- a/engines/mads/nebular/nebular_scenes6.h +++ b/engines/mads/nebular/nebular_scenes6.h @@ -209,6 +209,23 @@ public: virtual void postActions() {}; }; +class Scene609: public Scene6xx{ +private: + int _videoDoorMode; + + void enterStore(); + +public: + Scene609(MADSEngine *vm) : Scene6xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; + class Scene620: public Scene6xx{ public: Scene620(MADSEngine *vm) : Scene6xx(vm) {} -- cgit v1.2.3 From 59da02fa9a1922d6c7b47ba128c86a37ada66e48 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 12 May 2014 20:21:33 -0400 Subject: MADS: Hook in the section 1 sound player --- engines/mads/game.cpp | 1 + engines/mads/sound.cpp | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 3f6c8e09d5..34b229f157 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -161,6 +161,7 @@ void Game::gameLoop() { setSectionHandler(); _sectionHandler->preLoadSection(); initSection(_sectionNumber); + _vm->_sound->init(_sectionNumber); _sectionHandler->postLoadSection(); _scene._spriteSlots.reset(); diff --git a/engines/mads/sound.cpp b/engines/mads/sound.cpp index eaac70c670..d46516d10e 100644 --- a/engines/mads/sound.cpp +++ b/engines/mads/sound.cpp @@ -48,8 +48,14 @@ void SoundManager::init(int sectionNumber) { switch (_vm->getGameID()) { case GType_RexNebular: // TODO: Other Rex Adlib section drivers - assert(sectionNumber == 1); - _driver = new Nebular::ASound1(_mixer); + switch (sectionNumber) { + case 1: + _driver = new Nebular::ASound1(_mixer); + break; + default: + _driver = nullptr; + break; + } break; default: -- cgit v1.2.3 From 670bf9a1afeb6ff433365fd43afe39da71bca64c Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 13 May 2014 09:32:02 +0200 Subject: FULLPIPE: Fixes to MovGraph::doWalkTo() --- engines/fullpipe/motion.cpp | 28 +++++++++++++++++++--------- engines/fullpipe/motion.h | 18 +++++++++++++----- 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 5137434a06..9fcb01296a 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -529,7 +529,7 @@ void MovGraphItem::free() { int MovGraph_messageHandler(ExCommand *cmd); -int MovGraphCallback(int a1, int a2, int a3) { +MovArr *MovGraphCallback(StaticANIObject *ani, MovItem *item, signed int counter) { warning("STUB: MovgraphCallback"); return 0; @@ -592,7 +592,7 @@ void MovGraph::freeItems() { _items.clear(); } -int MovGraph::method28() { +MovItem *MovGraph::method28(StaticANIObject *ani, int x, int y, int flag1, int *rescount) { warning("STUB: MovGraph::method28()"); return 0; @@ -641,13 +641,13 @@ MessageQueue *MovGraph::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int int idx = getItemIndexByStaticAni(subj); for (uint i = 0; i < _items[idx]->count; i++) { - if (_items[idx]->items[i]->movarr == goal) { + if (_items[idx]->items[i].movarr == goal) { if (subj->_movement) { Common::Point point; - subj->calcStepLen(point); + subj->calcStepLen(&point); - MessageQueue *mq = MovGraph_sub_451D50(this, subj, subj->_ox - point.x, subj->_oy - point.y, subj->_movement->_staticsObj1->_staticsId, xpos, ypos, 0, fuzzyMatch); + MessageQueue *mq = sub1(subj, subj->_ox - point.x, subj->_oy - point.y, subj->_movement->_staticsObj1->_staticsId, xpos, ypos, 0, fuzzyMatch); if (!mq || !mq->getExCommandByIndex(0)) return 0; @@ -667,13 +667,11 @@ MessageQueue *MovGraph::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int if (movitem) { MovArr *goal = _callback1(subj, movitem, ss); int idx = getItemIndexByStaticAni(subj); - v25 = 0; - idx <<= 6; if (_items[idx]->count > 0) { int arridx = 0; - while (_items[idx]->items[arridx]->movarr != goal) { + while (_items[idx]->items[arridx].movarr != goal) { arridx++; if (arridx >= _items[idx]->count) { @@ -682,7 +680,7 @@ MessageQueue *MovGraph::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int } } - _items[idx]->movarr.clear(); + _items[idx]->movarr->clear(); for (uint i = 0; i < _items[idx]->items[arridx].movarr->_movStepCount; i++) { MovArr *m = new MovArr; @@ -717,6 +715,18 @@ MessageQueue *MovGraph::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int return 0; } +MessageQueue *MovGraph::sub1(StaticANIObject *ani, int x, int y, int a5, int x1, int y1, int a8, int a9) { + warning("STUB: *MovGraph::sub1()"); + + return 0; +} + +MessageQueue *MovGraph::fillMGMinfo(StaticANIObject *ani, MovArr *movarr, int staticsId) { + warning("STUB: *MovGraph::fillMGMinfo()"); + + return 0; +} + int MovGraph::method50() { warning("STUB: MovGraph::method50()"); diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index 94cd274c0d..3ef62a75b3 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -31,6 +31,7 @@ class MctlConnectionPoint; class MovGraphLink; class MessageQueue; class ExCommand2; +struct MovItem; int startWalkTo(int objId, int objKey, int x, int y, int a5); int doSomeAnimation(int objId, int objKey, int a3); @@ -52,7 +53,7 @@ public: virtual void addObject(StaticANIObject *obj) {} virtual int removeObject(StaticANIObject *obj) { return 0; } virtual void freeItems() {} - virtual int method28() { return 0; } + virtual MovItem *method28(StaticANIObject *ani, int x, int y, int flag1, int *rescount) { return 0; } virtual int method2C(StaticANIObject *obj, int x, int y) { return 0; } virtual int method30() { return 0; } virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) { return 0; } @@ -299,9 +300,14 @@ class MovGraphLink : public CObject { void calcNodeDistanceAndAngle(); }; +struct MovStep { + int sfield_0; + MovGraphLink *link; +}; + struct MovArr { - int _afield_0; - int _afield_4; + MovStep *_movSteps; + int _movStepCount; int _afield_8; MovGraphLink *_link; double _dist; @@ -343,7 +349,7 @@ public: ObList _links; int _field_44; Common::Array _items; - int (*_callback1)(int, int, int); + MovArr *(*_callback1)(StaticANIObject *ani, MovItem *item, int counter); MGM _mgm; public: @@ -355,7 +361,7 @@ public: virtual void addObject(StaticANIObject *obj); virtual int removeObject(StaticANIObject *obj); virtual void freeItems(); - virtual int method28(); + virtual MovItem *method28(StaticANIObject *ani, int x, int y, int flag1, int *rescount); virtual int method2C(StaticANIObject *obj, int x, int y); virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId); virtual int changeCallback(); @@ -374,6 +380,8 @@ public: Common::Array *getBboxes(MovArr *movarr1, MovArr *movarr2, int *listCount); void calcBbox(Common::Rect *rect, MovGraphLink *grlink, MovArr *movarr1, MovArr *movarr2); bool calcChunk(int idx, int x, int y, MovArr *arr, int a6); + MessageQueue *sub1(StaticANIObject *ani, int x, int y, int a5, int x1, int y1, int a8, int a9); + MessageQueue *fillMGMinfo(StaticANIObject *ani, MovArr *movarr, int staticsId); }; class Movement; -- cgit v1.2.3 From e065b24d56bac1e6c929c8b9b03553055a285878 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Tue, 13 May 2014 15:14:54 +0100 Subject: SCUMM: Remove "level" command from debugger. Replaced by "debuglevel". This required a small amount of extra code changes to ensure that _debugMode is kept in sync when the debugger is used to change the level. --- engines/scumm/debugger.cpp | 34 ++++++++++++---------------------- engines/scumm/debugger.h | 4 +++- engines/scumm/scumm.cpp | 4 ++-- engines/scumm/scumm.h | 2 +- engines/scumm/vars.cpp | 2 +- 5 files changed, 19 insertions(+), 27 deletions(-) diff --git a/engines/scumm/debugger.cpp b/engines/scumm/debugger.cpp index a792d63149..3dd7b4caf5 100644 --- a/engines/scumm/debugger.cpp +++ b/engines/scumm/debugger.cpp @@ -89,7 +89,6 @@ ScummDebugger::ScummDebugger(ScummEngine *s) DCmd_Register("loadgame", WRAP_METHOD(ScummDebugger, Cmd_LoadGame)); DCmd_Register("savegame", WRAP_METHOD(ScummDebugger, Cmd_SaveGame)); - DCmd_Register("level", WRAP_METHOD(ScummDebugger, Cmd_DebugLevel)); DCmd_Register("debug", WRAP_METHOD(ScummDebugger, Cmd_Debug)); DCmd_Register("show", WRAP_METHOD(ScummDebugger, Cmd_Show)); @@ -104,6 +103,18 @@ ScummDebugger::~ScummDebugger() { // we need this destructor, even if it is empty, for __SYMBIAN32__ } +void ScummDebugger::preEnter() { +} + +void ScummDebugger::postEnter() { + // Runtime debug level change is dealt with by the base class "debuglevel" command + // but need to ensure that the _debugMode parameter is updated in sync. + _vm->_debugMode = (gDebugLevel >= 0); + // Boot params often need debugging switched on to work + if (_vm->_bootParam) + _vm->_debugMode = true; +} + /////////////////////////////////////////////////// // Now the fun stuff: @@ -523,27 +534,6 @@ bool ScummDebugger::Cmd_Debug(int argc, const char **argv) { return true; } -bool ScummDebugger::Cmd_DebugLevel(int argc, const char **argv) { - if (argc == 1) { - if (_vm->_debugMode == false) - DebugPrintf("Debugging is not enabled at this time\n"); - else - DebugPrintf("Debugging is currently set at level %d\n", gDebugLevel); - } else { // set level - gDebugLevel = atoi(argv[1]); - if (gDebugLevel >= 0) { - _vm->_debugMode = true; - DebugPrintf("Debug level set to level %d\n", gDebugLevel); - } else if (gDebugLevel < 0) { - _vm->_debugMode = false; - DebugPrintf("Debugging is now disabled\n"); - } else - DebugPrintf("Not a valid debug level\n"); - } - - return true; -} - bool ScummDebugger::Cmd_Camera(int argc, const char **argv) { DebugPrintf("Camera: cur (%d,%d) - dest (%d,%d) - accel (%d,%d) -- last (%d,%d)\n", _vm->camera._cur.x, _vm->camera._cur.y, _vm->camera._dest.x, _vm->camera._dest.y, diff --git a/engines/scumm/debugger.h b/engines/scumm/debugger.h index 43bf9d6fd4..657f6be286 100644 --- a/engines/scumm/debugger.h +++ b/engines/scumm/debugger.h @@ -37,6 +37,9 @@ public: private: ScummEngine *_vm; + virtual void preEnter(); + virtual void postEnter(); + // Commands bool Cmd_Room(int argc, const char **argv); bool Cmd_LoadGame(int argc, const char **argv); @@ -58,7 +61,6 @@ private: bool Cmd_Passcode(int argc, const char **argv); bool Cmd_Debug(int argc, const char **argv); - bool Cmd_DebugLevel(int argc, const char **argv); bool Cmd_Show(int argc, const char **argv); bool Cmd_Hide(int argc, const char **argv); diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 54f22ecad3..34c231e5d4 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -205,7 +205,7 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) _lastInputScriptTime = 0; _bootParam = 0; _dumpScripts = false; - _debugMode = 0; + _debugMode = false; _objectOwnerTable = NULL; _objectRoomTable = NULL; _objectStateTable = NULL; @@ -2281,7 +2281,7 @@ void ScummEngine::scummLoop_updateScummVars() { VAR(VAR_MOUSE_Y) = _mouse.y; if (VAR_DEBUGMODE != 0xFF) { // This is NOT for the Mac version of Indy3/Loom - VAR(VAR_DEBUGMODE) = _debugMode; + VAR(VAR_DEBUGMODE) = (_debugMode ? 1 : 0); } } else if (_game.version >= 1) { // We use shifts below instead of dividing by V12_X_MULTIPLIER resp. diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index b4afa09bb2..be5a83d8c9 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -586,7 +586,7 @@ protected: bool _dumpScripts; bool _hexdumpScripts; bool _showStack; - uint16 _debugMode; + bool _debugMode; // Save/Load class - some of this may be GUI byte _saveLoadFlag, _saveLoadSlot; diff --git a/engines/scumm/vars.cpp b/engines/scumm/vars.cpp index 73028c8513..79d7ed03da 100644 --- a/engines/scumm/vars.cpp +++ b/engines/scumm/vars.cpp @@ -805,7 +805,7 @@ void ScummEngine::resetScummVars() { } if (VAR_DEBUGMODE != 0xFF) { - VAR(VAR_DEBUGMODE) = _debugMode; + VAR(VAR_DEBUGMODE) = (_debugMode ? 1 : 0); if (_game.heversion >= 80 && _debugMode) VAR(85) = 1; } -- cgit v1.2.3 From c19cfb5b641e7a4ac92d766a832bb0f98f6db705 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 13 May 2014 17:33:38 +0200 Subject: MADS: Implement scene 610 --- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes6.cpp | 269 ++++++++++++++++++++++++++----- engines/mads/nebular/nebular_scenes6.h | 21 +++ 3 files changed, 248 insertions(+), 44 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index debc1df78d..da9a9174c6 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -241,7 +241,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 609: // outside Buckluster video store return new Scene609(vm); case 610: // inside Buckluster video store - return new DummyScene(vm); // TODO + return new Scene610(vm); case 611: // back alley return new DummyScene(vm); // TODO case 612: // expressway / maintenance building diff --git a/engines/mads/nebular/nebular_scenes6.cpp b/engines/mads/nebular/nebular_scenes6.cpp index f934c42750..8ebbd0b52a 100644 --- a/engines/mads/nebular/nebular_scenes6.cpp +++ b/engines/mads/nebular/nebular_scenes6.cpp @@ -2181,7 +2181,7 @@ void Scene608::actions() { } else _vm->_dialogs->show(60840); break; - + case 1: _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[3]); _game._player._visible = true; @@ -2196,7 +2196,7 @@ void Scene608::actions() { _carMoveMode = 1; _scene->_sequences.addTimer(1, 2); break; - + case 2: { if (_carMoveMode != 0) _scene->_sequences.addTimer(1, 2); @@ -2213,7 +2213,7 @@ void Scene608::actions() { _game._player._stepEnabled = true; } break; - + default: break; } @@ -2265,13 +2265,13 @@ void Scene608::actions() { _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_SPRITE, 4, 1); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 2); break; - + case 1: _vm->_sound->command(9); _scene->_sequences.remove(_globals._sequenceIndexes[1]); _scene->_dynamicHotspots.remove(_polycementHotspotId); break; - + case 2: _game._objects.addToInventory(OBJ_POLYCEMENT); _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[2]); @@ -2279,7 +2279,7 @@ void Scene608::actions() { _game._player._stepEnabled = true; _vm->_dialogs->showItem(OBJ_POLYCEMENT, 60833); break; - + default: break; } @@ -2294,20 +2294,20 @@ void Scene608::actions() { _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_SPRITE, 2, 1); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 2); break; - + case 1: _vm->_sound->command(9); _scene->_sequences.remove(_globals._sequenceIndexes[12]); _game._objects.addToInventory(OBJ_REARVIEW_MIRROR); _vm->_dialogs->showItem(OBJ_REARVIEW_MIRROR, 60827); break; - + case 2: _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[2]); _game._player._visible = true; _game._player._stepEnabled = true; break; - + default: break; } @@ -2390,9 +2390,9 @@ void Scene609::enter() { _globals._spriteIndexes[4] = _scene->_sprites.addSprites("*RXCD_9"); _globals._spriteIndexes[5] = _scene->_sprites.addSprites("*RXMRC_9"); - _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -2); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -2); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 5); - _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1); + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 9); if (!_game._visitedScenes._sceneRevisited) @@ -2400,7 +2400,7 @@ void Scene609::enter() { if (_scene->_priorSceneId == 611) { _game._player._playerPos = Common::Point(264, 69); - _game._player._facing = FACING_SOUTHWEST; + _game._player._facing = FACING_SOUTHWEST; } else if (_scene->_priorSceneId == 610) { _game._player._playerPos = Common::Point(23, 90); _game._player._facing = FACING_EAST; @@ -2409,13 +2409,13 @@ void Scene609::enter() { } else if (_scene->_priorSceneId != -2) { _game._player._playerPos = Common::Point(86, 136); _game._player._facing = FACING_NORTHEAST; - _game._player._visible = false; + _game._player._visible = false; _game._player._stepEnabled = false; _scene->_sequences.remove(_globals._sequenceIndexes[1]); _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -1); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 5); _scene->loadAnimation(formAnimName('R', 1), 70); - } + } if (_scene->_roomChanged) { _game._objects.addToInventory(OBJ_DOOR_KEY); @@ -2435,7 +2435,7 @@ void Scene609::step() { _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 7, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 9); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 61); - break; + break; case 61: _scene->_hotspots.activate(0x425, false); @@ -2449,7 +2449,7 @@ void Scene609::step() { _scene->_hotspots.activate(0x425, true); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 9); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 63); - break; + break; case 63: if (!_globals[kHasTalkedToHermit] && (_game._difficulty != DIFFICULTY_HARD)) { @@ -2458,7 +2458,7 @@ void Scene609::step() { _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[3], Common::Point(287, 73)); _scene->_sequences.setScale(_globals._sequenceIndexes[3], 47); } - _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1); + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 9); _game._player._stepEnabled = true; break; @@ -2469,7 +2469,7 @@ void Scene609::step() { switch (_game._trigger) { case 70: - _game._player._visible = true; + _game._player._visible = true; _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; _scene->_sequences.addTimer(6, 71); break; @@ -2485,13 +2485,13 @@ void Scene609::step() { _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 6, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 5); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 72); - break; + break; case 72: - _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -2); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -2); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 5); _game._player._stepEnabled = true; - break; + break; default: break; @@ -2518,23 +2518,23 @@ void Scene609::enterStore() { break; case 2: - _game._player._visible = false; + _game._player._visible = false; _globals._sequenceIndexes[5] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[5], true, 11, 2, 0, 0); - _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 1, 2); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 1, 2); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 3); break; case 3: - _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[5]); - _game._player._visible = true; - _game._objects.setRoom(OBJ_DOOR_KEY, 1); + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[5]); + _game._player._visible = true; + _game._objects.setRoom(OBJ_DOOR_KEY, 1); _scene->_sequences.addTimer(15, 4); - break; + break; case 4: - _game._player._visible = false; - _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], true, 1); + _game._player._visible = false; + _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], true, 1); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); _scene->_sequences.addTimer(15, 5); break; @@ -2542,7 +2542,7 @@ void Scene609::enterStore() { case 5: _scene->_sequences.remove(_globals._sequenceIndexes[5]); _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; - _game._player._visible = true; + _game._player._visible = true; _scene->_sequences.remove(_globals._sequenceIndexes[2]); _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 7, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 9); @@ -2555,12 +2555,12 @@ void Scene609::enterStore() { _scene->_kernelMessages.reset(); _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 180, _game.getQuote(0x307)); } - _game._player.walk(Common::Point(23, 90), FACING_WEST); + _game._player.walk(Common::Point(23, 90), FACING_WEST); _scene->_sequences.addTimer(180, 7); break; case 7: - _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _scene->_sequences.remove(_globals._sequenceIndexes[2]); _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 7, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 9); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 8); @@ -2568,10 +2568,10 @@ void Scene609::enterStore() { case 8: _scene->_hotspots.activate(0x425, true); - _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1); + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 9); _globals[kBeenInVideoStore] = true; - _game._player._stepEnabled = true; + _game._player._stepEnabled = true; _scene->_nextSceneId = 610; break; @@ -2586,7 +2586,7 @@ void Scene609::preActions() { } void Scene609::actions() { - if (_action.isAction(0x18C, 0x423)) + if (_action.isAction(0x18C, 0x423)) _scene->_nextSceneId = 611; else if (_action.isAction(0x18B, 0x425)) { if (!_globals[kBeenInVideoStore]) { @@ -2599,16 +2599,16 @@ void Scene609::actions() { break; case 1: - _game._player._visible = false; - _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], true, 1); + _game._player._visible = false; + _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], true, 1); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); _scene->_sequences.addTimer(30, 2); break; case 2: _scene->_sequences.remove(_globals._sequenceIndexes[5]); - _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; - _game._player._visible = true; + _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; + _game._player._visible = true; _scene->_sequences.addTimer(60, 3); break; @@ -2636,8 +2636,8 @@ void Scene609::actions() { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; - _scene->_sequences.remove(_globals._sequenceIndexes[1]); - _globals._sequenceIndexes[1] = _scene->_sequences.startReverseCycle (_globals._spriteIndexes[1], false, 6, 1, 0, 0); + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 6, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 5); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 1); break; @@ -2652,7 +2652,7 @@ void Scene609::actions() { break; case 2: - _game._player._visible = false; + _game._player._visible = false; _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 10, 1, 0, 0); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 3); @@ -2662,7 +2662,7 @@ void Scene609::actions() { int syncIdx = _globals._sequenceIndexes[4]; _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, -2); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); - _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], syncIdx); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], syncIdx); _scene->_nextSceneId = 504; } break; @@ -2701,6 +2701,189 @@ void Scene609::actions() { /*------------------------------------------------------------------------*/ +void Scene610::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(0x108); + _scene->addActiveVocab(0xD); +} + +void Scene610::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('p', -1)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites("*RXMRC_9"); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 0)); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('x', 1)); + + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 60, 0, 0, 0); + _scene->_sequences.setDepth (_globals._sequenceIndexes[4], 13); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 30, 0, 0, 0); + _scene->_sequences.setDepth (_globals._sequenceIndexes[3], 9); + + if (!_game._visitedScenes._sceneRevisited) + _cellCharging = false; + + if (_game._objects[OBJ_PHONE_HANDSET]._roomNumber == _scene->_currentSceneId) { + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 9, 0, 0, 0); + _handsetHotspotId = _scene->_dynamicHotspots.add(0x108, VERB_WALKTO, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(_handsetHotspotId, Common::Point(132, 121), FACING_NORTHWEST); + if ((_globals[kHandsetCellStatus] == 2) && (_game._difficulty == DIFFICULTY_HARD) && !_globals[kDurafailRecharged]) + _globals[kHandsetCellStatus] = 1; + } + + if (_scene->_roomChanged && _game._difficulty != DIFFICULTY_EASY) + _game._objects.addToInventory(OBJ_PENLIGHT); + + if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(175, 152); + _game._player._facing = FACING_NORTHWEST; + } + + sceneEntrySound(); +} + +void Scene610::step() { + if (_cellCharging) { + long diff = _scene->_frameStartTime - _lastFrameTimer; + if ((diff >= 0) && (diff <= 60)) + _cellChargingTimer += diff; + else + _cellChargingTimer++; + + _lastFrameTimer = _scene->_frameStartTime; + } + + // CHECKME: _checkVal is always false, could be removed + if ((_cellChargingTimer >= 60) && !_checkVal) { + _checkVal = true; + _globals[kHandsetCellStatus] = 1; + _cellCharging = false; + _checkVal = false; + _cellChargingTimer = 0; + } +} + +void Scene610::actions() { + if (_action.isAction(0x1CE, 0x427)) + _scene->_nextSceneId = 609; + else if (_action.isAction(VERB_TAKE, 0x108)) { + if ( _game._trigger || !_game._objects.isInInventory(OBJ_PHONE_HANDSET)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], true, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 2); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[2]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_SPRITE, 2, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + + case 1: + _vm->_sound->command(9); + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _scene->_dynamicHotspots.remove(_handsetHotspotId); + _game._objects.addToInventory(OBJ_PHONE_HANDSET); + _vm->_dialogs->showItem(OBJ_PHONE_HANDSET, 61017); + break; + + case 2: + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[2]); + _game._player._visible = true; + _game._player._stepEnabled = true; + break; + + default: + break; + } + } + } else if (_action.isAction(VERB_PUT, 0x108, 0x42F)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], true, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 2); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[2]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_SPRITE, 2, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + + case 1: + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 9, 0, 0, 0); + _handsetHotspotId = _scene->_dynamicHotspots.add(0x108, VERB_WALKTO, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(_handsetHotspotId, Common::Point(132, 121), FACING_NORTHWEST); + _game._objects.setRoom(OBJ_PHONE_HANDSET, _scene->_currentSceneId); + break; + + case 2: + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[2]); + _game._player._visible = true; + _game._player._stepEnabled = true; + if ((_globals[kHandsetCellStatus] == 2) && (_game._difficulty == DIFFICULTY_HARD) && !_globals[kDurafailRecharged]) + _cellCharging = true; + + _vm->_dialogs->show(61032); + break; + + default: + break; + } + } else if (_action.isAction(VERB_LOOK, 0x442)) + _vm->_dialogs->show(61010); + else if (_action.isAction(VERB_LOOK, 0x44B)) + _vm->_dialogs->show(61011); + else if (_action.isAction(VERB_LOOK, 0x441)) + _vm->_dialogs->show(61012); + else if (_action.isAction(VERB_LOOK, 0x43C)) + _vm->_dialogs->show(61013); + else if (_action.isAction(VERB_LOOK, 0x427)) + _vm->_dialogs->show(61014); + else if (_action._lookFlag) + _vm->_dialogs->show(61015); + else if (_action.isAction(VERB_LOOK, 0x4A1)) + _vm->_dialogs->show(61018); + else if (_action.isAction(VERB_LOOK, 0x498)) { + if (_game._visitedScenes.exists(601)) + _vm->_dialogs->show(61020); + else + _vm->_dialogs->show(61019); + } else if (_action.isAction(VERB_LOOK, 0x29F)) + _vm->_dialogs->show(61021); + else if (_action.isAction(VERB_LOOK, 0x429)) + _vm->_dialogs->show(61022); + else if (_action.isAction(VERB_LOOK, 0x42D)) + _vm->_dialogs->show(61023); + else if (_action.isAction(VERB_TAKE, 0x42D)) + _vm->_dialogs->show(61024); + else if (_action.isAction(VERB_LOOK, 0x431)) + _vm->_dialogs->show(61025); + else if (_action.isAction(VERB_LOOK, 0x108) && (_action._mainObjectSource == 4)) + _vm->_dialogs->show(61026); + else if (_action.isAction(VERB_LOOK, 0x42F)) + _vm->_dialogs->show(61027); + else if (_action.isAction(VERB_LOOK, 0x42A)) + _vm->_dialogs->show(61028); + else if (_action.isAction(VERB_PUT, 0x42A) + && _game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId))) + _vm->_dialogs->show(61029); + else if ( _action.isAction(0x44F) || _action.isAction(0x444) || _action.isAction(0x430) + || _action.isAction(0x44C) || _action.isAction(0x44D) || _action.isAction(0x446) + || _action.isAction(0x497) || _action.isAction(0x449) || _action.isAction(0x44E) + || _action.isAction(0x450) || _action.isAction(0x42C)) { + if (_action.isAction(VERB_LOOK)) + _vm->_dialogs->show(61030); + else if (_action.isAction(VERB_TAKE)) + _vm->_dialogs->show(61031); + else + return; + } else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + void Scene620::setup() { _game._player._spritesPrefix = ""; setAAName(); diff --git a/engines/mads/nebular/nebular_scenes6.h b/engines/mads/nebular/nebular_scenes6.h index a5fa754a85..10bf2e8c86 100644 --- a/engines/mads/nebular/nebular_scenes6.h +++ b/engines/mads/nebular/nebular_scenes6.h @@ -226,6 +226,27 @@ public: virtual void postActions() {}; }; +class Scene610: public Scene6xx{ +private: + int _handsetHotspotId; + int _checkVal; + + bool _cellCharging; + + long _cellChargingTimer; + uint32 _lastFrameTimer; + +public: + Scene610(MADSEngine *vm) : Scene6xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions(); + virtual void postActions() {}; +}; + class Scene620: public Scene6xx{ public: Scene620(MADSEngine *vm) : Scene6xx(vm) {} -- cgit v1.2.3 From bac58f3e1878bed442766bc03c4f43adb1cb05de Mon Sep 17 00:00:00 2001 From: D G Turner Date: Tue, 13 May 2014 19:39:47 +0100 Subject: GUI: Clarify "debuglevel" command output in Debugger base class. This should make it clear that -1 is used for disable. --- gui/debugger.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/gui/debugger.cpp b/gui/debugger.cpp index b2ef193fa7..da342e26e9 100644 --- a/gui/debugger.cpp +++ b/gui/debugger.cpp @@ -503,12 +503,8 @@ bool Debugger::Cmd_OpenLog(int argc, const char **argv) { bool Debugger::Cmd_DebugLevel(int argc, const char **argv) { - if (argc == 1) { - if (gDebugLevel < 0) { - DebugPrintf("Debugging is disabled\n"); - } else { - DebugPrintf("Debugging is currently set at level %d\n", gDebugLevel); - } + if (argc == 1) { // print level + DebugPrintf("Debugging is currently %s (set at level %d)\n", (gDebugLevel >= 0) ? "enabled" : "disabled", gDebugLevel); } else { // set level gDebugLevel = atoi(argv[1]); if (gDebugLevel >= 0 && gDebugLevel < 11) { @@ -516,7 +512,7 @@ bool Debugger::Cmd_DebugLevel(int argc, const char **argv) { } else if (gDebugLevel < 0) { DebugPrintf("Debugging is now disabled\n"); } else { - DebugPrintf("Not a valid debug level (0 - 10)\n"); + DebugPrintf("Invalid debug level value (0 to 10 or -1 to disable)\n"); } } -- cgit v1.2.3 From 8bf202fe66ab9f5cdbb0e5b6ec43ea6481dbf036 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 14 May 2014 11:32:55 +0200 Subject: FULLPIPE: Fix crash in Movement destructor --- engines/fullpipe/statics.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp index d15da94ab1..a796665522 100644 --- a/engines/fullpipe/statics.cpp +++ b/engines/fullpipe/statics.cpp @@ -1522,9 +1522,6 @@ Movement::~Movement() { if (_updateFlag1) _dynamicPhases.remove_at(0); - for (uint i = 0; i < _dynamicPhases.size(); i++) - delete _dynamicPhases[i]; - _dynamicPhases.clear(); } -- cgit v1.2.3 From b07a833b639fa90c1306bcf1674f3f244ceba043 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 14 May 2014 11:33:19 +0200 Subject: FULLPIPE: Fix mistypo in FullpipeEngine::stopAllSounds() which lead to crash --- engines/fullpipe/sound.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp index 3578e2a1df..ced5c75850 100644 --- a/engines/fullpipe/sound.cpp +++ b/engines/fullpipe/sound.cpp @@ -301,7 +301,7 @@ void FullpipeEngine::stopAllSounds() { // _mixer->stopAll(); for (int i = 0; i < _currSoundListCount; i++) - for (int j = 0; i < _currSoundList1[i]->getCount(); j++) { + for (int j = 0; j < _currSoundList1[i]->getCount(); j++) { _currSoundList1[i]->getSoundByIndex(j)->stop(); } } -- cgit v1.2.3 From a59a4b86563609c5b1a52d98ce5bbc939bc094b8 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 14 May 2014 12:11:58 +0200 Subject: FULLPIPE: Fix indent --- engines/fullpipe/fullpipe.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp index 539781679d..78815297ac 100644 --- a/engines/fullpipe/fullpipe.cpp +++ b/engines/fullpipe/fullpipe.cpp @@ -380,7 +380,7 @@ void FullpipeEngine::updateEvents() { case Common::EVENT_QUIT: _gameContinue = false; break; - case Common::EVENT_RBUTTONDOWN: + case Common::EVENT_RBUTTONDOWN: if (!_inputArFlag && (_updateTicks - _lastInputTicks) >= 2) { ex = new ExCommand(0, 17, 107, event.mouse.x, event.mouse.y, 0, 1, 0, 0, 0); ex->_excFlags |= 3; -- cgit v1.2.3 From cbe41c94f7cdeb76d40dbef4f5e293f32866d433 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 14 May 2014 12:12:44 +0200 Subject: FULLPIPE: Fix bug in Scene::getPictureObjectById() --- engines/fullpipe/scene.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp index 5dde566192..2a78454156 100644 --- a/engines/fullpipe/scene.cpp +++ b/engines/fullpipe/scene.cpp @@ -358,7 +358,7 @@ void Scene::stopAllSounds() { } PictureObject *Scene::getPictureObjectById(int objId, int flags) { - for (uint i = 0; i < _picObjList.size(); i++) { + for (uint i = 1; i < _picObjList.size(); i++) { if (((PictureObject *)_picObjList[i])->_id == objId && ((PictureObject *)_picObjList[i])->_okeyCode == flags) return (PictureObject *)_picObjList[i]; } -- cgit v1.2.3 From de1df05b1f47abe4c7091c14bbd4d46ef542c9bb Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 14 May 2014 12:15:37 +0200 Subject: FULLPIPE: Fix bug in global_messageHandler3() which prevented mouse handling --- engines/fullpipe/messagehandlers.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/engines/fullpipe/messagehandlers.cpp b/engines/fullpipe/messagehandlers.cpp index 15aa78d342..d4f79d1dd8 100644 --- a/engines/fullpipe/messagehandlers.cpp +++ b/engines/fullpipe/messagehandlers.cpp @@ -392,12 +392,10 @@ int global_messageHandler3(ExCommand *cmd) { } return result; case 29: - if (!g_fp->_currentScene) - return result; - - if (g_fp->_gameLoader->_interactionController->_flag24) { + if (g_fp->_gameLoader->_interactionController->_flag24 && g_fp->_currentScene) { ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY); ani2 = g_fp->_currentScene->getStaticANIObject1ById(g_fp->_gameLoader->_field_FA, -1); + if (ani) { if (g_fp->_msgObjectId2 == ani->_id && g_fp->_msgId == ani->_okeyCode) { cmd->_messageKind = 0; -- cgit v1.2.3 From a8effe2a6e0b08e4e4e5f2d0e36b58663a908cf7 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 14 May 2014 12:17:20 +0200 Subject: FULLPIPE: Added more debug output --- engines/fullpipe/motion.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 9fcb01296a..b9fdc43286 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -1500,6 +1500,8 @@ MessageQueue *MovGraph2::doWalkTo(StaticANIObject *obj, int xpos, int ypos, int PicAniInfo picAniInfo; Common::Point point; + debug(0, "MovGraph2::doWalkTo(%d, %d, %d, %d, %d)", obj->_id, xpos, ypos, fuzzyMatch, staticsId); + int idx = getItemIndexByGameObjectId(obj->_id); if (idx < 0) @@ -3127,11 +3129,11 @@ bool MovGraphReact::pointInRegion(int x, int y) { } } -int startWalkTo(int objId, int objKey, int x, int y, int a5) { - MctlCompound *mc = getSc2MctlCompoundBySceneId(g_fp->_currentScene->_sceneId); +int startWalkTo(int objId, int objKey, int x, int y, int fuzzyMatch) { + MctlCompound *mc = getCurrSceneSc2MotionController(); if (mc) - return (mc->method34(g_fp->_currentScene->getStaticANIObject1ById(objId, objKey), x, y, a5, 0) != 0); + return (mc->method34(g_fp->_currentScene->getStaticANIObject1ById(objId, objKey), x, y, fuzzyMatch, 0) != 0); return 0; } -- cgit v1.2.3 From df0d8bf8746436dcc3ca79829e77aa8e08205884 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 14 May 2014 12:34:46 +0200 Subject: FULLPIPE: Pushed noisy debug message deeper --- engines/fullpipe/statics.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp index a796665522..b6b312ab85 100644 --- a/engines/fullpipe/statics.cpp +++ b/engines/fullpipe/statics.cpp @@ -1276,7 +1276,7 @@ bool StaticANIObject::startAnim(int movementId, int messageQueueId, int dynPhase if (_flags & 0x80) return false; - debug(0, "StaticANIObject::startAnim(%d, %d, %d) (%s [%d]) [%d, %d]", movementId, messageQueueId, dynPhaseIdx, transCyrillic((byte *)_objectName), _id, _ox, _oy); + debug(4, "StaticANIObject::startAnim(%d, %d, %d) (%s [%d]) [%d, %d]", movementId, messageQueueId, dynPhaseIdx, transCyrillic((byte *)_objectName), _id, _ox, _oy); if (_messageQueueId) { updateGlobalMessageQueue(messageQueueId, _id); -- cgit v1.2.3 From 4033dc5dac2662498defa0ac108625471b3b27ed Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 14 May 2014 09:19:54 -0400 Subject: MADS: Implemented sound player for scene group 2 --- engines/mads/mads.cpp | 2 +- engines/mads/nebular/sound_nebular.cpp | 362 +++++++++++++++++++++++++++++++++ engines/mads/nebular/sound_nebular.h | 51 +++++ engines/mads/sound.cpp | 3 + 4 files changed, 417 insertions(+), 1 deletion(-) diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index 193346dcf9..bcd8fdba8f 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -43,7 +43,7 @@ MADSEngine::MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc) : _invObjectsAnimated = true; _textWindowStill = false; _screenFade = SCREEN_FADE_SMOOTH; - _musicFlag = false; + _musicFlag = true; _dithering = false; _debugger = nullptr; diff --git a/engines/mads/nebular/sound_nebular.cpp b/engines/mads/nebular/sound_nebular.cpp index de6846bb17..56365987dc 100644 --- a/engines/mads/nebular/sound_nebular.cpp +++ b/engines/mads/nebular/sound_nebular.cpp @@ -1202,6 +1202,368 @@ int ASound1::command2627293032() { return (_commandParam > 0x40) ? _commandParam - 0x40 : _commandParam & 0xff00; } + +/*-----------------------------------------------------------------------*/ + +const ASound2::CommandPtr ASound2::_commandList[44] = { + &ASound2::command0, &ASound2::command1, &ASound2::command2, &ASound2::command3, + &ASound2::command4, &ASound2::command5, &ASound2::command6, &ASound2::command7, + &ASound2::command8, &ASound2::command9, &ASound2::command10, &ASound2::command11, + &ASound2::command12, &ASound2::command13, &ASound2::command14, &ASound2::command15, + &ASound2::command16, &ASound2::command17, &ASound2::command18, &ASound2::command19, + &ASound2::command20, &ASound2::command21, &ASound2::command22, &ASound2::command23, + &ASound2::command24, &ASound2::command25, &ASound2::command26, &ASound2::command27, + &ASound2::command28, &ASound2::command29, &ASound2::command30, &ASound2::command31, + &ASound2::command32, &ASound2::command33, &ASound2::command34, &ASound2::command35, + &ASound2::command36, &ASound2::command37, &ASound2::command38, &ASound2::command39, + &ASound2::command40, &ASound2::command41, &ASound2::command42, &ASound2::command43 +}; + +ASound2::ASound2(Audio::Mixer *mixer) : ASound(mixer, "asound.002", 0x15E0) { + _command12Param = 0xFD; + + // Load sound samples + _soundFile.seek(_dataOffset + 0x144); + for (int i = 0; i < 164; ++i) + _samples.push_back(AdlibSample(_soundFile)); +} + +int ASound2::command(int commandId, int param) { + if (commandId > 43) + return 0; + + _frameCounter = 0; + return (this->*_commandList[commandId])(); +} + +int ASound2::command9() { + byte *pData1 = loadData(0x1094, 376); + if (!isSoundActive(pData1)) { + command1(); + _channels[0].load(pData1); + _channels[2].load(loadData(0x123E, 130)); + + command9Randomize(); + _channels[1].load(loadData(0x120C, 50)); + } + return 0; +} + +void ASound2::command9Randomize() { + // Randomization + int v; + while (((v = getRandomNumber()) & 0x3F) > 36) + ; + + byte *pData = loadData(0x120C, 50); + command9Apply(pData, v + 20, -1); + command9Apply(pData + 1, 10 - ((v + 1) / 6), 1); +} + +void ASound2::command9Apply(byte *data, int val, int incr) { + data += 8; + for (int ctr = 0; ctr < 10; ++ctr, data += 4, val += incr) { + *data = val; + } +} + +int ASound2::command10() { + byte *pData1 = loadData(0x12C0, 60); + if (!isSoundActive(pData1)) { + command1(); + _channels[0].load(pData1); + _channels[1].load(loadData(0x12FC, 318)); + _channels[2].load(loadData(0x143A, 110)); + } + + return 0; +} + +int ASound2::command11() { + byte *pData = loadData(0x14A8, 170); + if (!isSoundActive(pData)) { + playSoundData(pData); + playSoundData(loadData(0x1552, 1802)); + playSoundData(loadData(0x1C5C, 716)); + playSoundData(loadData(0x1F28, 106)); + } + + return 0; +} + +int ASound2::command12() { + _command12Param += 26; + byte v = _command12Param & 0x7f; + + byte *pData = loadData(0x4A5E, 38); + pData[5] = pData[20] = v; + playSoundData(pData); + + pData = loadData(0x4A84, 30); + pData[5] = pData[18] = v; + playSoundData(pData); + + return 0; +} + +int ASound2::command13() { + playSoundData(loadData(0x4AA2, 20)); + playSoundData(loadData(0x4AB6, 20)); + + return 0; +} + +int ASound2::command14() { + playSound(0x4ACA, 40); + playSound(0x4AF2, 42); + + return 0; +} + +int ASound2::command15() { + byte *pData1 = loadData(0x1F92, 1074); + if (!isSoundActive(pData1)) { + command1(); + playSoundData(pData1); + playSound(0x23C4, 1050); + playSound(0x27DE, 58); + playSound(0x2818, 712); + playSound(0x2AE0, 256); + } + + return 0; +} + +int ASound2::command16() { + byte *pData1 = loadData(0x3960, 280); + if (!isSoundActive(pData1)) { + command1(); + playSoundData(pData1); + playSound(0x3A78, 266); + playSound(0x3B72, 322); + playSound(0x3CC4, 488); + playSound(0x3EAC, 104); + playSound(0x3F14, 104); + } + + return 0; +} + +int ASound2::command17() { + byte *pData1 = loadData(0x3F7C, 432); + if (!isSoundActive(pData1)) { + command1(); + playSoundData(pData1); + playSound(0x412C, 422); + playSound(0x42D2, 424); + playSound(0x447A, 418); + } + + return 0; +} + +static const int command18_list[16][2] = { + { 0x337C, 28 }, { 0x3398, 26 }, { 0x33B2, 26 }, { 0x33CC, 26 }, + { 0x33E6, 56 }, { 0x341E, 46 }, { 0x344C, 56 }, { 0x3484, 22 }, + { 0x349A, 38 }, { 0x34C0, 62 }, { 0x34FE, 26 }, { 0x3518, 26 }, + { 0x3532, 26 }, { 0x354C, 26 }, { 0x3566, 32 }, { 0x3586, 24 } +}; + +int ASound2::command18() { + if (_channels[3]._activeCount == 0) { + int idx = (getRandomNumber() & 0x1E) >> 1; + byte *pData = loadData(command18_list[idx][0], command18_list[idx][1]); + _channels[3].load(pData); + } + + return 0; +} + +int ASound2::command19() { + byte *pData1 = loadData(0x2BE0, 366); + if (!isSoundActive(pData1)) { + command1(); + playSoundData(pData1); + playSound(0x2D4E, 460); + playSound(0x2F1A, 266); + playSound(0x3024, 328); + playSound(0x316C, 162); + playSound(0x320E, 366); + } + + return 0; +} + +int ASound2::command20() { + playSound(0x4A36, 40); + + return 0; +} + +int ASound2::command21() { + playSound(0x49DE, 16); + playSound(0x49EE, 16); + playSound(0x49FF, 16); + + return 0; +} + +int ASound2::command22() { + playSound(0x4A0E, 24); + playSound(0x4A26, 16); + + return 0; +} + +int ASound2::command23() { + playSound(0x49B6, 16); + + return 0; +} + +int ASound2::command24() { + playSound(0x49C6, 24); + + return 0; +} + +int ASound2::command25() { + playSound(0x49AC, 10); + + return 0; +} + +int ASound2::command26() { + playSound(0x498A, 14); + playSound(0x4998, 20); + + return 0; +} + +int ASound2::command27() { + playSound(0x4912, 80); + playSound(0x4962, 40); + + return 0; +} + +int ASound2::command28() { + playSound(0x48E8, 28); + playSound(0x4904, 14); + + return 0; +} + +int ASound2::command29() { + playSound(0x48B2, 22); + + return 0; +} + +int ASound2::command30() { + playSound(0x4870, 22); + playSound(0x4886, 22); + playSound(0x489C, 22); + + return 0; +} + +int ASound2::command31() { + playSound(0x482E, 22); + playSound(0x4844, 22); + playSound(0x489C, 22); + + return 0; +} + +int ASound2::command32() { + playSound(0x46E8, 10); + + return 0; +} + +int ASound2::command33() { + playSound(0x46D8, 16); + + return 0; +} + +int ASound2::command34() { + playSound(0x46C8, 16); + + return 0; +} + +int ASound2::command35() { + playSound(0x46B2, 22); + + return 0; +} + +int ASound2::command36() { + playSound(0x4624, 16); + + return 0; +} + +int ASound2::command37() { + playSound(0x4674, 20); + playSound(0x4688, 32); + playSound(0x46A8, 10); + + return 0; +} + +int ASound2::command38() { + byte *pData1 = loadData(0x359E, 202); + if (!isSoundActive(pData1)) { + command1(); + playSoundData(pData1); + playSound(0x3668, 220); + playSound(0x3744, 124); + playSound(0x37C0, 162); + playSound(0x3862, 78); + playSound(0x38B0, 176); + } + + return 0; +} + +int ASound2::command39() { + byte *pData = loadData(0x466A, 10); + pData[6] = (getRandomNumber() & 7) + 85; + playSoundData(pData); + + return 0; +} + +int ASound2::command40() { + playSound(0x4634, 34); + playSound(0x4656, 20); + + return 0; +} + +int ASound2::command41() { + playSound(0x48C8, 32); + + return 0; +} + +int ASound2::command42() { + playSound(0x46F2, 156); + playSound(0x478E, 160); + + return 0; +} + +int ASound2::command43() { + playSound(0x4B1C, 40); + playSound(0x4B44, 41); + + return 0; +} + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/sound_nebular.h b/engines/mads/nebular/sound_nebular.h index 44e108fd04..3c69c0c852 100644 --- a/engines/mads/nebular/sound_nebular.h +++ b/engines/mads/nebular/sound_nebular.h @@ -405,6 +405,57 @@ public: virtual int command(int commandId, int param); }; +class ASound2 : public ASound { +private: + byte _command12Param; +private: + typedef int (ASound2::*CommandPtr)(); + static const CommandPtr _commandList[44]; + + int command9(); + int command10(); + int command11(); + int command12(); + int command13(); + int command14(); + int command15(); + int command16(); + int command17(); + int command18(); + int command19(); + int command20(); + int command21(); + int command22(); + int command23(); + int command24(); + int command25(); + int command26(); + int command27(); + int command28(); + int command29(); + int command30(); + int command31(); + int command32(); + int command33(); + int command34(); + int command35(); + int command36(); + int command37(); + int command38(); + int command39(); + int command40(); + int command41(); + int command42(); + int command43(); + + void command9Randomize(); + void command9Apply(byte *data, int val, int incr); +public: + ASound2(Audio::Mixer *mixer); + + virtual int command(int commandId, int param); +}; + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/sound.cpp b/engines/mads/sound.cpp index d46516d10e..3dc53be124 100644 --- a/engines/mads/sound.cpp +++ b/engines/mads/sound.cpp @@ -52,6 +52,9 @@ void SoundManager::init(int sectionNumber) { case 1: _driver = new Nebular::ASound1(_mixer); break; + case 2: + _driver = new Nebular::ASound2(_mixer); + break; default: _driver = nullptr; break; -- cgit v1.2.3 From 2e221fe34fec279e088f703a925144ea2152a18f Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 14 May 2014 22:21:54 +0300 Subject: MADS: Replace some magic values of the monkey status --- engines/mads/nebular/nebular_scenes2.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index e4c09fa72b..39437045f7 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -1681,7 +1681,7 @@ void Scene208::enter() { _game.loadQuoteSet(0x81, 0x46, 0); - if ((_scene->_priorSceneId == 207) && (_globals[kMonkeyStatus] == 1)) { + if ((_scene->_priorSceneId == 207) && (_globals[kMonkeyStatus] == MONKEY_HAS_BINOCULARS)) { int msgIndex = _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(129)); _scene->_kernelMessages.setQuoted(msgIndex, 4, true); } @@ -2764,7 +2764,7 @@ void Scene209::enter() { if (_scene->_roomChanged) { _game._objects.addToInventory(OBJ_POISON_DARTS); _game._objects.addToInventory(OBJ_BLOWGUN); - _globals[kMonkeyStatus] = 1; + _globals[kMonkeyStatus] = MONKEY_HAS_BINOCULARS; } _pitchFl = false; @@ -2792,7 +2792,7 @@ void Scene209::enter() { } void Scene209::step() { - if (!_playingAnimFl && !_pitchFl && !_fallFl && !_dodgeFl && (_pauseMode == 0) && (_globals[kMonkeyStatus] == 1)) { + if (!_playingAnimFl && !_pitchFl && !_fallFl && !_dodgeFl && (_pauseMode == 0) && (_globals[kMonkeyStatus] == MONKEY_HAS_BINOCULARS)) { int randAction = _vm->getRandomNumber(1,50); switch (randAction) { case 1: @@ -3159,7 +3159,7 @@ void Scene209::preActions() { if (_action.isAction(VERB_WALK_TOWARDS, 0x84)) _game._player._walkOffScreenSceneId = 208; - if (_globals[kMonkeyStatus] == 1) { + if (_globals[kMonkeyStatus] == MONKEY_HAS_BINOCULARS) { if ((_action.isAction(VERB_SHOOT) || _action.isAction(VERB_HOSE_DOWN)) && _action.isTarget(NOUN_MONKEY) && _action.isObject(NOUN_BLOWGUN) && _game._objects.isInInventory(OBJ_BLOWGUN) && _game._objects.isInInventory(OBJ_POISON_DARTS)) { _game._player._prepareWalkPos = Common::Point(111, 129); @@ -3296,7 +3296,7 @@ void Scene209::actions() { return; } - if (_globals[kMonkeyStatus] == 1) { + if (_globals[kMonkeyStatus] == MONKEY_HAS_BINOCULARS) { if ((_action.isAction(VERB_SHOOT) || _action.isAction(VERB_HOSE_DOWN)) && _action.isAction(NOUN_MONKEY) && _action.isAction(NOUN_BLOWGUN) && _game._objects.isInInventory(OBJ_BLOWGUN) && _game._objects.isInInventory(OBJ_POISON_DARTS)) { if (_action.isAction(VERB_SHOOT, NOUN_BLOWGUN, NOUN_MONKEY) && !_startShootingInTimerFl) { @@ -3463,13 +3463,13 @@ void Scene209::actions() { } if (_action.isAction(VERB_LOOK, 0x100)) { - if (_globals[kMonkeyStatus] == 1) { + if (_globals[kMonkeyStatus] == MONKEY_HAS_BINOCULARS) { if (_monkeyPosition == 1) _vm->_dialogs->show(0x51B5); else _vm->_dialogs->show(0x51B6); } else { - if (_globals[kMonkeyStatus] == 0) + if (_globals[kMonkeyStatus] == MONKEY_AMBUSH_READY) _vm->_dialogs->show(0x51B5); else _vm->_dialogs->show(0x51B7); -- cgit v1.2.3 From 2c9568c9213aedb064e251c90e0ed8c6d04fce49 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 14 May 2014 21:43:32 +0200 Subject: MADS: Implement scene 611 --- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes6.cpp | 1383 +++++++++++++++++++++++++++++- engines/mads/nebular/nebular_scenes6.h | 53 ++ 3 files changed, 1433 insertions(+), 5 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index da9a9174c6..a4ec04c317 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -243,7 +243,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 610: // inside Buckluster video store return new Scene610(vm); case 611: // back alley - return new DummyScene(vm); // TODO + return new Scene611(vm); case 612: // expressway / maintenance building return new DummyScene(vm); // TODO case 620: // cutscene, viewport glass breaking diff --git a/engines/mads/nebular/nebular_scenes6.cpp b/engines/mads/nebular/nebular_scenes6.cpp index 8ebbd0b52a..7006acc924 100644 --- a/engines/mads/nebular/nebular_scenes6.cpp +++ b/engines/mads/nebular/nebular_scenes6.cpp @@ -2715,9 +2715,9 @@ void Scene610::enter() { _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('x', 1)); _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 60, 0, 0, 0); - _scene->_sequences.setDepth (_globals._sequenceIndexes[4], 13); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 13); _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 30, 0, 0, 0); - _scene->_sequences.setDepth (_globals._sequenceIndexes[3], 9); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 9); if (!_game._visitedScenes._sceneRevisited) _cellCharging = false; @@ -2791,7 +2791,7 @@ void Scene610::actions() { _game._player._visible = true; _game._player._stepEnabled = true; break; - + default: break; } @@ -2824,7 +2824,7 @@ void Scene610::actions() { _vm->_dialogs->show(61032); break; - + default: break; } @@ -2884,6 +2884,1381 @@ void Scene610::actions() { /*------------------------------------------------------------------------*/ +void Scene611::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(0x275); + _scene->addActiveVocab(0xD); +} + +void Scene611::handleRatMoves() { + _ratPresentFl = false; + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 11, -2); + _ratTimer = _game._player._priorTimer; + _scene->_dynamicHotspots.remove(_ratHotspotId); +} + +void Scene611::handleTrading() { + if (_game._objects.isInInventory(OBJ_DURAFAIL_CELLS)) + _game._objects.setRoom(OBJ_DURAFAIL_CELLS, 1); + + if (_game._objects.isInInventory(OBJ_PHONE_CELLS)) + _game._objects.setRoom(OBJ_PHONE_CELLS, 1); + + _game._objects.addToInventory(OBJ_FAKE_ID); +} + +void Scene611::setDialogNode(int node) { + if (node > 0) + _hermitDialogNode = node; + + _game._player._stepEnabled = true; + + switch (node) { + case 0: + _scene->_userInterface.setup(kInputBuildingSentences); + _duringDialogFl = false; + _hermitDialogNode = 0; + break; + + case 1: + _dialog1.start(); + _duringDialogFl = true; + _hermitDialogNode = 1; + break; + + case 2: + _dialog2.start(); + _duringDialogFl = true; + _hermitDialogNode = 2; + break; + + default: + break; + } +} + +bool Scene611::check2ChargedBatteries() { + if ((_game._objects.isInInventory(OBJ_DURAFAIL_CELLS) && !_game._objects.isInInventory(OBJ_PHONE_CELLS)) + || (!_game._objects.isInInventory(OBJ_DURAFAIL_CELLS) && _game._objects.isInInventory(OBJ_PHONE_CELLS))) + return true; + + return false; +} + +bool Scene611::check4ChargedBatteries() { + if (_game._objects.isInInventory(OBJ_DURAFAIL_CELLS) && _game._objects.isInInventory(OBJ_PHONE_CELLS) && _globals[136]) + return true; + + return false; +} + +void Scene611::handleTalking(int delay) { + if (_hermitTalkingFl) + _alreadyTalkingFl = true; + + _hermitTalkingFl = true; + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addTimer(delay, 100); +} + +void Scene611::handleSubDialog1() { + switch (_action._activeAction._verbId) { + case 0x287: + _stickFingerFl = true; + _nextFrame = 34; + _hermitMovingFl = false; + _hermitMode = 5; + displayHermitQuestions(5); + _dialog1.write(0x287, false); + if (!_dialog1.read(0x288)) + _dialog1.write(0x28E, true); + + _dialog2.write(0x29C, true); + _dialog2.write(0x29D, true); + _dialog2.write(0x29E, true); + setDialogNode(2); + break; + + case 0x288: + handleTalking(500); + displayHermitQuestions(6); + _dialog1.write(0x288, false); + _dialog1.write(0x289, true); + if (!_dialog1.read(0x287)) + _dialog1.write(0x28E, true); + + setDialogNode(1); + break; + + case 0x289: + handleTalking(500); + displayHermitQuestions(10); + _dialog1.write(0x289, false); + _dialog1.write(0x28A, true); + _dialog1.write(0x28B, true); + setDialogNode(1); + break; + + case 0x28A: + handleTalking(500); + displayHermitQuestions(11); + _dialog1.write(0x28A, false); + setDialogNode(1); + break; + + case 0x28B: + handleTalking(500); + displayHermitQuestions(12); + _dialog1.write(0x28C, true); + _dialog1.write(0x28D, true); + _dialog1.write(0x28B, false); + setDialogNode(1); + break; + + case 0x28C: + handleTalking(500); + displayHermitQuestions(13); + _dialog1.write(0x28C, false); + setDialogNode(1); + break; + + case 0x28D: + handleTalking(500); + displayHermitQuestions(14); + _dialog1.write(0x290, true); + _dialog1.write(0x28D, false); + _dialog1.write(0x28F, true); + setDialogNode(1); + break; + + case 0x28E: + handleTalking(500); + displayHermitQuestions(15); + _dialog1.write(0x295, true); + _dialog1.write(0x28E, false); + setDialogNode(1); + break; + + case 0x290: + handleTalking(500); + displayHermitQuestions(17); + _dialog1.write(0x290, false); + _dialog1.write(0x28E, false); + if (!_dialog1.read(0x28F)) + _dialog1.write(0x291, true); + + setDialogNode(1); + break; + + case 0x291: + handleTalking(500); + displayHermitQuestions(18); + _dialog1.write(0x291, false); + if ((!_game._objects.isInInventory(OBJ_DURAFAIL_CELLS)) && (!_game._objects.isInInventory(OBJ_PHONE_CELLS))) { + _dialog1.write(0x292, true); + _dialog1.write(0x293, true); + } + + if ((_game._objects.isInInventory(OBJ_DURAFAIL_CELLS)) || (_game._objects.isInInventory(OBJ_PHONE_CELLS))) + _dialog1.write(0x294, true); + + if (!_game._objects.isInInventory(OBJ_DURAFAIL_CELLS) && !_game._objects.isInInventory(OBJ_PHONE_CELLS)) + _globals[kExecuted_1_11] = true; + + setDialogNode(1); + break; + + case 0x28F: + handleTalking(500); + displayHermitQuestions(16); + _dialog1.write(0x28F, false); + if (!_dialog1.read(0x290)) + _dialog1.write(0x291, true); + + setDialogNode(1); + break; + + case 0x295: + handleTalking(500); + displayHermitQuestions(20); + _dialog1.write(0x295, false); + setDialogNode(1); + break; + + case 0x292: + handleTalking(500); + displayHermitQuestions(19); + _dialog1.write(0x292, false); + _dialog1.write(0x293, false); + setDialogNode(1); + break; + + case 0x293: { + handleTalking(200); + _scene->_kernelMessages.reset(); + + Common::String curQuote = _game.getQuote(0x2D1); + int width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + int quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y), 0xFDFC, 0, 0, 120, curQuote); + + curQuote = _game.getQuote(0x2D2); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 14), 0xFDFC, 0, 0, 120, curQuote); + + _dialog1.write(0x293, false); + setDialogNode(0); + } + break; + + case 0x294: { + bool hermitPleasedFl = false; + + switch (_game._difficulty) { + case DIFFICULTY_EASY: + hermitPleasedFl = _game._objects.isInInventory(OBJ_DURAFAIL_CELLS) || _game._objects.isInInventory(OBJ_PHONE_CELLS); + break; + + case DIFFICULTY_MEDIUM: + hermitPleasedFl = _game._objects.isInInventory(OBJ_DURAFAIL_CELLS) && _game._objects.isInInventory(OBJ_PHONE_CELLS); + break; + + default: // HARD + hermitPleasedFl = check4ChargedBatteries(); + break; + } + + if (hermitPleasedFl) { + _hermitDisplayedQuestion = 21; + if (!_giveBatteriesFl) + setDialogNode(0); + else + _giveBatteriesFl = false; + } else if (((_game._difficulty == DIFFICULTY_MEDIUM) || (_game._difficulty == DIFFICULTY_HARD)) && check2ChargedBatteries()) { + _hermitDisplayedQuestion = 22; + if (!_giveBatteriesFl) + setDialogNode(0); + else + _giveBatteriesFl = false; + } else { + _hermitDisplayedQuestion = 23; + if (!_giveBatteriesFl) + setDialogNode(0); + else + _giveBatteriesFl = false; + } + _startTradingFl = true; + } + break; + + case 0x296: { + _scene->_kernelMessages.reset(); + + Common::String curQuote = _game.getQuote(0x2E6); + int width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + int quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 14), 0xFDFC, 0, 0, 120, curQuote); + + setDialogNode(0); + handleTalking(200); + } + break; + + default: + break; + } +} + +void Scene611::handleSubDialog2() { + switch (_action._activeAction._verbId) { + case 0x29C: + displayHermitQuestions(7); + setDialogNode(1); + handleTalking(500); + break; + + case 0x29D: + displayHermitQuestions(8); + setDialogNode(1); + handleTalking(500); + break; + + case 0x29E: + displayHermitQuestions(9); + setDialogNode(1); + handleTalking(500); + break; + + case 0x29F: { + _scene->_kernelMessages.reset(); + Common::String curQuote = _game.getQuote(0x2A7); + int width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + int quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 14), 0xFDFC, 0, 0, 120, curQuote); + setDialogNode(0); + _dialog2.write(0x29F, false); + } + break; + + default: + break; + } +} + +void Scene611::handleDialog() { + if (_game._trigger == 0) { + _scene->_kernelMessages.reset(); + _game._player._stepEnabled = false; + + Common::String curQuote = _game.getQuote(_action._activeAction._verbId); + int width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + + if (width > 200) { + Common::String subQuote1, subQuote2; + _game.splitQuote(curQuote, subQuote1, subQuote2); + _scene->_kernelMessages.add(Common::Point(0, -14), 0x1110, 34, 0, 150, subQuote1); + + if (_action._activeAction._verbId == 0x29D) + _scene->_kernelMessages.add(Common::Point(-18, 0), 0x1110, 34, 1, 150, subQuote2); + else if (_action._activeAction._verbId == 0x28A) + _scene->_kernelMessages.add(Common::Point(-10, 0), 0x1110, 34, 1, 150, subQuote2); + else + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 1, 150, subQuote2); + + _scene->_sequences.addTimer(170, 50); + } else { + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 1, 120, curQuote); + _scene->_sequences.addTimer(140, 50); + } + } else if (_game._trigger == 50) { + if (_hermitDialogNode == 1) + handleSubDialog1(); + else if (_hermitDialogNode == 2) + handleSubDialog2(); + } +} + +void Scene611::displayHermitQuestions(int question) { + _scene->_kernelMessages.reset(); + _hermitDisplayedQuestion = question; + + switch (question) { + case 1: { + Common::String curQuote = _game.getQuote(0x281); + int width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + int quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x282); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 14), 0xFDFC, 0, 0, 9999999, curQuote); + } + break; + + case 2: { + Common::String curQuote = _game.getQuote(0x283); + int width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + int quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x284); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 14), 0xFDFC, 0, 0, 9999999, curQuote); + } + break; + + case 3: { + Common::String curQuote = _game.getQuote(0x285); + int width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + int quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 14), 0xFDFC, 0, 0, 9999999, curQuote); + } + break; + + case 4: { + Common::String curQuote = _game.getQuote(0x286); + int width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + int quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 14), 0xFDFC, 0, 0, 9999999, curQuote); + } + break; + + case 5: { + Common::String curQuote = _game.getQuote(0x297); + int width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + int quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y - 14), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x298); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x299); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 14), 0xFDFC, 0, 0, 9999999, curQuote); + } + break; + + case 6: { + Common::String curQuote = _game.getQuote(0x29A); + int width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + int quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x29B); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 14), 0xFDFC, 0, 0, 9999999, curQuote); + } + break; + + case 7: { + Common::String curQuote = _game.getQuote(0x2A0); + int width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + int quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 45), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x2A1); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 59), 0xFDFC, 0, 0, 9999999, curQuote); + } + break; + + case 8: { + Common::String curQuote = _game.getQuote(0x2A2); + int width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + int quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 31), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x2A3); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 45), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x2A4); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 59), 0xFDFC, 0, 0, 9999999, curQuote); + } + break; + + case 9: { + Common::String curQuote = _game.getQuote(0x2A5); + int width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + int quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 45), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x2A6); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 59), 0xFDFC, 0, 0, 9999999, curQuote); + } + break; + + case 10: { + Common::String curQuote = _game.getQuote(0x2A8); + int width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + int quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 31), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x2A9); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 45), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x2AA); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 59), 0xFDFC, 0, 0, 9999999, curQuote); + } + break; + + case 11: { + Common::String curQuote = _game.getQuote(0x2AB); + int width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + int quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 17), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x2AC); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 31), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x2AD); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 45), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x2AE); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 59), 0xFDFC, 0, 0, 9999999, curQuote); + } + break; + + case 12: { + Common::String curQuote = _game.getQuote(0x2AF); + int width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + int quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 17), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x2B0); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 31), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x2B1); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 45), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x2B2); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 59), 0xFDFC, 0, 0, 9999999, curQuote); + } + break; + + case 13: { + Common::String curQuote = _game.getQuote(0x2B3); + int width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + int quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 3), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x2B4); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 17), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x2B5); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 31), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x2B6); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 45), 0xFDFC, 0, 0, 9999999, curQuote); + + _scene->_kernelMessages.add(Common::Point(11, _defaultDialogPos.y + 59), 0xFDFC, 0, 0, 9999999, _game.getQuote(0x2B7)); + _scene->_kernelMessages.add(Common::Point(11, _defaultDialogPos.y + 73), 0xFDFC, 0, 0, 9999999, _game.getQuote(0x2B8)); + _scene->_kernelMessages.add(Common::Point(11, _defaultDialogPos.y + 87), 0xFDFC, 0, 0, 9999999, _game.getQuote(0x2B9)); + } + break; + + case 14: { + Common::String curQuote = _game.getQuote(0x2BA); + int width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + int quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 17), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x2BB); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 31), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x2BC); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 45), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x2BD); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 59), 0xFDFC, 0, 0, 9999999, curQuote); + } + break; + + case 15: { + Common::String curQuote = _game.getQuote(0x2BE); + int width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + int quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 17), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x2BF); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 31), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x2C0); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 45), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x2C1); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 59), 0xFDFC, 0, 0, 9999999, curQuote); + } + break; + + case 16: { + Common::String curQuote = _game.getQuote(0x2C2); + int width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + int quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 3), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x2C3); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 17), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x2C4); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 31), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x2C5); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 45), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x2C6); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 59), 0xFDFC, 0, 0, 9999999, curQuote); + } + break; + + case 17: { + Common::String curQuote = _game.getQuote(0x2C7); + int width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + int quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 17), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x2C8); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 31), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x2C0); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 45), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x2CA); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 59), 0xFDFC, 0, 0, 9999999, curQuote); + } + break; + + case 18: { + Common::String curQuote = _game.getQuote(0x2CB); + int width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + int quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 31), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x2CC); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 45), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x2CD); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 59), 0xFDFC, 0, 0, 9999999, curQuote); + } + break; + + case 19: { + Common::String curQuote = _game.getQuote(0x2CE); + int width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + int quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 31), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x2CF); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 45), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x2D0); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 59), 0xFDFC, 0, 0, 9999999, curQuote); + } + break; + + case 20: { + Common::String curQuote = _game.getQuote(0x2E1); + int width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + int quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 3), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x2E2); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 17), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x2E3); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 31), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x2E4); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 45), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x2E5); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 59), 0xFDFC, 0, 0, 9999999, curQuote); + } + break; + + case 21: { + Common::String curQuote = _game.getQuote(0x2D3); + int width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + int quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 3), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x2D4); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 17), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x2D5); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 31), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x2D6); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 45), 0xFDFC, 0, 0, 9999999, curQuote); + + curQuote = _game.getQuote(0x2D7); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 59), 0xFDFC, 0, 0, 9999999, curQuote); + } + break; + + case 22: { + Common::String curQuote = _game.getQuote(0x2D8); + int width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + int quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 17), 0xFDFC, 0, 0, 700, curQuote); + + curQuote = _game.getQuote(0x2D9); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 31), 0xFDFC, 0, 0, 700, curQuote); + + curQuote = _game.getQuote(0x2DA); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 45), 0xFDFC, 0, 0, 700, curQuote); + + curQuote = _game.getQuote(0x2DB); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 59), 0xFDFC, 0, 0, 700, curQuote); + } + break; + + case 23: { + Common::String curQuote = _game.getQuote(0x2DC); + int width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + int quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 3), 0xFDFC, 0, 0, 700, curQuote); + + curQuote = _game.getQuote(0x2DD); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 17), 0xFDFC, 0, 0, 700, curQuote); + + curQuote = _game.getQuote(0x2DE); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 31), 0xFDFC, 0, 0, 700, curQuote); + + curQuote = _game.getQuote(0x2DF); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 45), 0xFDFC, 0, 0, 700, curQuote); + + curQuote = _game.getQuote(0x2E0); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 59), 0xFDFC, 0, 0, 700, curQuote); + } + break; + + default: + break; + } +} + +void Scene611::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 0)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 1)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites("*RXMRC_9"); + + _game.loadQuoteSet(0x279, 0x27A, 0x27B, 0x27C, 0x27D, 0x27E, 0x27F, 0x280, 0x281, 0x282, 0x283, 0x284, + 0x285, 0x286, 0x287, 0x288, 0x289, 0x28A, 0x28B, 0x28C, 0x28D, 0x28E, 0x28F, 0x290, 0x291, 0x292, + 0x293, 0x294, 0x295, 0x296, 0x297, 0x298, 0x299, 0x29A, 0x29B, 0x29C, 0x29D, 0x29E, 0x29F, 0x2A0, + 0x2A1, 0x2A2, 0x2A3, 0x2A4, 0x2A5, 0x2A6, 0x2A7, 0x2A8, 0x2A9, 0x2AA, 0x2AB, 0x2AC, 0x2AD, 0x2AE, + 0x2AF, 0x2B0, 0x2B1, 0x2B2, 0x2B3, 0x2B4, 0x2B5, 0x2B6, 0x2B7, 0x2B8, 0x2B9, 0x2BA, 0x2BB, 0x2BC, + 0x2BD, 0x2BE, 0x2BF, 0x2C0, 0x2C1, 0x2C2, 0x2C3, 0x2C4, 0x2C5, 0x2C6, 0x2C7, 0x2C8, 0x2C9, 0x2CA, + 0x2CB, 0x2CC, 0x2CD, 0x2CE, 0x2CF, 0x2D0, 0x2D1, 0x2D2, 0x2D3, 0x2D4, 0x2D5, 0x2D6, 0x2D7, 0x2D8, + 0x2D9, 0x2DA, 0x2DB, 0x2DC, 0x2DD, 0x2DE, 0x2DF, 0x2E0, 0x2E1, 0x2E2, 0x2E3, 0x2E4, 0x2E5, 0x2E6, + 0x323, 0x324, 0); + + _dialog1.setup(0x82, 0x287, 0x288, 0x289, 0x28A, 0x28B, 0x28C, 0x28D, 0x28E, 0x28F, 0x290, + 0x291, 0x292, 0x293, 0x294, 0x295, 0x296, 0); + + _dialog2.setup(0x83, 0x29C, 0x29D, 0x29E, 0x29F, 0); + + if (!_game._visitedScenes._sceneRevisited) { + _dialog1.set(0x82, 0x287, 0x288, 0x296, 0); + _dialog2.set(0x83, 0x29F, 0); + } + + _vm->_palette->setEntry(252, 51, 51, 47); + _vm->_palette->setEntry(253, 37, 37, 37); + + _ratPresentFl = false; + _seenRatFl = true; + _eyesRunningFl = false; + _shouldRemoveEyes = false; + _randVal = 0; + _defaultDialogPos = Common::Point(264, 43); + _giveBatteriesFl = false; + _resetBatterieText = false; + _alreadyTalkingFl = false; + _startTradingFl = false; + + if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(22, 132); + _game._player._facing = FACING_EAST; + _duringDialogFl = false; + } + + if (!_globals[kHasTalkedToHermit]) { + _scene->loadAnimation(Resources::formatName(611, 'h', -1, EXT_AA, ""), 0); + _scene->loadAnimation(Resources::formatName(203, 'a', -1, EXT_AA, ""), 81); + _nextFrame = 47; + _hermitMode = 1; + _hermitTalkingFl = false; + _hermitMovingFl = true; + _check1Fl = true; + _stickFingerFl = false; + } else { + _hermitMode = 0; + _scene->_hotspots.activate(0x45A, false); + } + + // CHECKME: The last line of the block looks extremely useless + if (_globals[kExecuted_1_11]) { + _dialog1.write(0x294, true); + _dialog1.write(0x292, false); + _globals[kExecuted_1_11] = true; + } + + if (_duringDialogFl) { + _game._player._playerPos = Common::Point(237, 129); + _game._player._facing = FACING_NORTHEAST; + + switch (_hermitDialogNode) { + case 0: + _scene->_userInterface.setup(kInputBuildingSentences); + _hermitDialogNode = 1; + break; + + case 1: + _dialog1.start(); + break; + + case 2: + _dialog2.start(); + break; + + default: + break; + } + displayHermitQuestions(_hermitDisplayedQuestion); + } + + sceneEntrySound(); +} + +void Scene611::step() { + if (_seenRatFl && (_vm->getRandomNumber(1, 100) == 10)) { + _seenRatFl = false; + _scene->_sequences.addTimer(1, 80); + } + + if (_game._trigger == 80) { + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 1, 8); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); + _ratPresentFl = true; + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 81); + } else if (_game._trigger == 81) { + int syncId = _globals._sequenceIndexes[1]; + _globals._sequenceIndexes[1] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 20, 0, 0, 0); + int idx = _scene->_dynamicHotspots.add(0x275, VERB_WALKTO, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + _ratHotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(272, 154), FACING_SOUTHEAST); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 9, 10); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[1], syncId); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); + _ratTimer = _game._player._priorTimer; + } + + if (_ratPresentFl && ((_game._player._priorTimer - _ratTimer) > 1200)) + handleRatMoves(); + + if (!_eyesRunningFl) { + _randVal = _vm->getRandomNumber(1, 30); + _eyesRunningFl = true; + _scene->_sequences.addTimer(1, 70); + } + + if (_game._trigger == 70) { + switch (_randVal) { + case 2: + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); + _shouldRemoveEyes = true; + _scene->_sequences.addTimer(60, 71); + break; + + case 6: + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 12, 3, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 2, 4); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 71); + break; + + case 7: + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 5); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); + _shouldRemoveEyes = true; + _scene->_sequences.addTimer(60, 71); + break; + + case 9: + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 6); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); + _shouldRemoveEyes = true; + _scene->_sequences.addTimer(60, 71); + break; + + case 13: + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 7); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); + _shouldRemoveEyes = true; + _scene->_sequences.addTimer(60, 71); + break; + + case 14: + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 8); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); + _shouldRemoveEyes = true; + _scene->_sequences.addTimer(60, 71); + break; + + case 15: + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 24, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 5, 8); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 71); + break; + + case 17: + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 20, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 9, 11); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 71); + break; + + case 21: + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 9); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); + _shouldRemoveEyes = true; + _scene->_sequences.addTimer(60, 71); + break; + + case 25: + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 10); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); + _shouldRemoveEyes = true; + _scene->_sequences.addTimer(60, 71); + break; + + case 27: + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 11); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); + _shouldRemoveEyes = true; + _scene->_sequences.addTimer(60, 71); + break; + + case 29: + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 20, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 71); + break; + + default: + _scene->_sequences.addTimer(1, 71); + break; + } + } + + if (_game._trigger == 71) { + if (_shouldRemoveEyes) { + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _shouldRemoveEyes = false; + } + _eyesRunningFl = false; + _randVal = 0; + } + + if (_game._trigger == 100) { + if (_alreadyTalkingFl) + _alreadyTalkingFl = false; + else + _hermitMovingFl = true; + } + + if (_stickFingerFl && (_scene->_activeAnimation->getCurrentFrame() == 47)) { + _stickFingerFl = false; + _hermitMovingFl = true; + _hermitMode = 1; + } + + if ((_scene->_activeAnimation->getCurrentFrame() == 240) && _check1Fl) { + _check1Fl = false; + _scene->_kernelMessages.add(Common::Point(33, 88), 0xFDFC, 0, 0, 90, _game.getQuote(0x27E)); + _scene->_sequences.addTimer(120, 120); + } + + if (_game._trigger == 120) { + int msgIdx = _scene->_kernelMessages.add(Common::Point(28, 102), 0xFDFC, 0, 0, 90, _game.getQuote(0x27F)); + _scene->_kernelMessages.setQuoted(msgIdx, 4, true); + _scene->_sequences.addTimer(100, 121); + } + + if (_game._trigger == 121) { + int msgIdx = _scene->_kernelMessages.add(Common::Point(23, 116), 0xFDFC, 0, 0, 90, _game.getQuote(0x280)); + _scene->_kernelMessages.setQuoted(msgIdx, 4, true); + } + + if (_hermitMode == 1) { + if (_startTradingFl) { + _hermitMode = 6; + _hermitMovingFl = false; + _hermitTalkingFl = false; + _scene->_sequences.addTimer(1, 110); + } else if (_hermitTalkingFl) { + _hermitMode = 2; + _nextFrame = 18; + _hermitMovingFl = false; + } else { + switch (_vm->getRandomNumber(1, 5)) { + case 1: + _nextFrame = 46; + break; + + case 2: + _nextFrame = 47; + break; + + case 3: + _nextFrame = 48; + break; + + case 4: + _nextFrame = 49; + break; + + case 5: + _nextFrame = 50; + break; + + default: + break; + } + } + } + + if (_hermitMode == 2) { + if (_startTradingFl) { + _hermitMode = 6; + _hermitMovingFl = false; + _hermitTalkingFl = false; + _scene->_sequences.addTimer(1, 110); + } else if (_hermitMovingFl) { + _hermitMode = 1; + _nextFrame = 47; + _hermitTalkingFl = false; + } else { + switch (_vm->getRandomNumber(1, 4)) { + case 1: + _nextFrame = 18; + break; + + case 2: + _nextFrame = 20; + break; + + case 3: + _nextFrame = 22; + break; + + case 4: + _nextFrame = 24; + break; + + default: + break; + } + } + } + + if (_scene->_activeAnimation->getCurrentFrame() == 254) + _game._player._stepEnabled = true; + + if (_game._trigger == 110) { + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 7, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 2); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 111); + } + + if (_game._trigger == 111) { + int syncIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 2); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], syncIdx); + _nextFrame = 1; + } + + if (_game._trigger == 112) { + _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; + _game._player._visible = true; + } + + if (_hermitMode == 6) { + if ((_scene->_activeAnimation->getCurrentFrame() == 9) && _check1Fl) { + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 7, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 2); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 112); + _check1Fl = false; + } + + if ((_scene->_activeAnimation->getCurrentFrame() == 17) && !_check1Fl) { + _nextFrame = 26; + _hermitMode = 4; + _check1Fl = true; + } + } + + if (_hermitMode == 4) { + if ((_scene->_activeAnimation->getCurrentFrame() == 33) && _check1Fl) { + displayHermitQuestions(_hermitDisplayedQuestion); + _nextFrame = 1; + _check1Fl = false; + } + + if ((_scene->_activeAnimation->getCurrentFrame() == 9) && !_check1Fl) { + _nextFrame = 8; + _scene->_sequences.addTimer(1, 113); + _check1Fl = true; + } + } + + if (_game._trigger == 113) { + _game._player._visible = false; + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 7, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 2); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 114); + } + + if (_game._trigger == 114) { + _resetBatterieText = true; + int syncIdx = _globals._sequenceIndexes[3]; + _nextFrame = 10; + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 7, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 2); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], syncIdx); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 115); + } + + if ((_nextFrame >= 0) && (_nextFrame != _scene->_activeAnimation->getCurrentFrame())) { + _scene->_activeAnimation->setCurrentFrame(_nextFrame); + _nextFrame = -1; + } + + if (_game._trigger == 115) { + _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; + _game._player._visible = true; + if (_hermitDisplayedQuestion == 21) { + _game._player._stepEnabled = false; + handleTrading(); + _hermitMode = 0; + _startTradingFl = false; + _nextFrame = 52; + _globals[kHasTalkedToHermit] = true; + _scene->_hotspots.activate(0x45A, false); + } else { + _game._player._stepEnabled = true; + _hermitMode = 1; + _nextFrame = 47; + _hermitTalkingFl = false; + _startTradingFl = false; + _check1Fl = true; + } + } +} + +void Scene611::preActions() { + if (_action.isAction(0x1AD, 0x423)) + _game._player._walkOffScreenSceneId = 609; + + if (_resetBatterieText) + _scene->_kernelMessages.reset(); +} + +void Scene611::actions() { + if (_game._screenObjects._inputMode == 1) + handleDialog(); + else if ((_action.isAction(VERB_GIVE, 0x107, 0x45A)) || (_action.isAction(VERB_GIVE, 0x73, 0x45A))) { + _action._activeAction._verbId = 0x294; + _giveBatteriesFl = true; + handleSubDialog1(); + } else if (_action.isAction(VERB_GIVE, 0x45A)) { + _scene->_kernelMessages.reset(); + + Common::String curQuote = _game.getQuote(0x323); + int width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + int quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y), 0xFDFC, 0, 0, 120, curQuote); + + curQuote = _game.getQuote(0x324); + width = _vm->_font->getWidth(curQuote, _scene->_textSpacing); + quotePosX = _defaultDialogPos.x - (width / 2); + _scene->_kernelMessages.add(Common::Point(quotePosX, _defaultDialogPos.y + 14), 0xFDFC, 0, 0, 120, curQuote); + } else if (_game._trigger == 90) { + if (_dialog2.read(0x29C) && _dialog2.read(0x29D) && _dialog2.read(0x29E)) { + handleTalking(180); + if (_vm->getRandomNumber(1, 2) == 1) + displayHermitQuestions(1); + else + displayHermitQuestions(2); + } else { + handleTalking(180); + if (_vm->getRandomNumber(1, 2) == 1) + displayHermitQuestions(3); + else + displayHermitQuestions(4); + } + + _duringDialogFl = true; + if (_dialog2.read(0x29F)) { + _hermitDialogNode = 1; + _dialog1.start(); + _duringDialogFl = true; + } else { + _hermitDialogNode = 2; + _dialog2.write(0x29F, true); + _dialog2.start(); + _duringDialogFl = true; + } + } else if (_action.isAction(VERB_TALKTO, 0x45A)) { + if (!_dialog1.read(0x287)) { + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x27A)); + _scene->_sequences.addTimer(120, 90); + } else { + int nextQuote = 0; + switch (_vm->getRandomNumber(1, 3)) { + case 1: + nextQuote = 0x27B; + break; + + case 2: + nextQuote = 0x27C; + break; + + case 3: + nextQuote = 0x27D; + break; + } + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(nextQuote)); + _scene->_sequences.addTimer(120, 90); + } + } else if ((_action.isAction(VERB_WALKTO) || _action.isAction(VERB_LOOK)) && _action.isAction(0x275)) { + switch (_game._trigger) { + case 0: + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x279)); + _scene->_sequences.addTimer(60, 1); + break; + + case 1: + handleRatMoves(); + _game._player._stepEnabled = true; + break; + + default: + break; + } + } else if (_action._lookFlag) { + if (_globals[kHasTalkedToHermit]) + _vm->_dialogs->show(61111); + else + _vm->_dialogs->show(61110); + } else if (_action.isAction(VERB_LOOK, 0x45A)) + _vm->_dialogs->show(61112); + else if (_action.isAction(VERB_LOOK, 0x25C)) + _vm->_dialogs->show(61113); + else if (_action.isAction(VERB_TAKE, 0x25C)) + _vm->_dialogs->show(61114); + else if (_action.isAction(VERB_LOOK, 0x49A)) + _vm->_dialogs->show(61115); + else if (_action.isAction(VERB_TAKE, 0x49A)) + _vm->_dialogs->show(61116); + else if (_action.isAction(VERB_OPEN, 0x49A)) + _vm->_dialogs->show(61117); + else if (_action.isAction(VERB_LOOK, 0x122)) + _vm->_dialogs->show(61118); + else if (_action.isAction(VERB_OPEN, 0x122)) + _vm->_dialogs->show(61119); + else if (_action.isAction(VERB_TAKE, 0x122)) + _vm->_dialogs->show(61120); + else if (_action.isAction(VERB_LOOK, 0x323)) + _vm->_dialogs->show(61121); + else if (_action.isAction(VERB_LOOK, 0x49C)) + _vm->_dialogs->show(61122); + else if (_action.isAction(VERB_LOOK, 0x45B)) + _vm->_dialogs->show(61123); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + void Scene620::setup() { _game._player._spritesPrefix = ""; setAAName(); diff --git a/engines/mads/nebular/nebular_scenes6.h b/engines/mads/nebular/nebular_scenes6.h index 10bf2e8c86..4c465bf79f 100644 --- a/engines/mads/nebular/nebular_scenes6.h +++ b/engines/mads/nebular/nebular_scenes6.h @@ -247,6 +247,59 @@ public: virtual void postActions() {}; }; +class Scene611: public Scene6xx{ +private: + bool _seenRatFl; + bool _eyesRunningFl; + bool _shouldRemoveEyes; + bool _ratPresentFl; + bool _duringDialogFl; + bool _resetBatterieText; + bool _hermitTalkingFl; + bool _hermitMovingFl; + bool _alreadyTalkingFl; + bool _giveBatteriesFl; + bool _startTradingFl; + bool _check1Fl; + bool _stickFingerFl; + + int _randVal; + int _ratHotspotId; + int _hermitDialogNode; + int _hermitDisplayedQuestion; + int _nextFrame; + int _hermitMode; + + uint32 _ratTimer; + + Conversation _dialog1; + Conversation _dialog2; + + Common::Point _defaultDialogPos; + + void handleTrading(); + void handleRatMoves(); + void handleDialog(); + void handleSubDialog1(); + void handleSubDialog2(); + void handleTalking(int delay); + void setDialogNode(int node); + void displayHermitQuestions(int question); + + bool check2ChargedBatteries(); + bool check4ChargedBatteries(); + +public: + Scene611(MADSEngine *vm) : Scene6xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; + class Scene620: public Scene6xx{ public: Scene620(MADSEngine *vm) : Scene6xx(vm) {} -- cgit v1.2.3 From 2db45fac8c8808cb887e435db051e39c575d7667 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 15 May 2014 00:51:10 +0200 Subject: MADS: Implement Scene 612 --- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes6.cpp | 209 +++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes6.h | 18 +++ 3 files changed, 228 insertions(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index a4ec04c317..64511a39d9 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -245,7 +245,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 611: // back alley return new Scene611(vm); case 612: // expressway / maintenance building - return new DummyScene(vm); // TODO + return new Scene612(vm); case 620: // cutscene, viewport glass breaking return new Scene620(vm); diff --git a/engines/mads/nebular/nebular_scenes6.cpp b/engines/mads/nebular/nebular_scenes6.cpp index 7006acc924..4cacfacbc8 100644 --- a/engines/mads/nebular/nebular_scenes6.cpp +++ b/engines/mads/nebular/nebular_scenes6.cpp @@ -4259,6 +4259,215 @@ void Scene611::actions() { /*------------------------------------------------------------------------*/ +void Scene612::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(0x87); + _scene->addActiveVocab(0xD); +} + +void Scene612::handleWinchMovement() { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 10, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 1, 5); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_SPRITE, 5, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + + case 1: + // CHECKME: Is the "else" block useful as action is always equal to 1 at this point? + // Or is it a missing bit of code we could fix? + if (action == 1) { + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 17, 7, 0, 0); + _vm->_sound->command(19); + _game._objects.setRoom(OBJ_PADLOCK_KEY, 1); + _globals[kBoatRaised] = false; + } else { + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 17, 9, 0, 0); + _vm->_sound->command(18); + } + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 3); + break; + + case 2: + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[4]); + _game._player._visible = true; + break; + + case 3: { + int syncIdx = _globals._sequenceIndexes[2]; + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, _cycleIndex); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], syncIdx); + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x2F4)); + _game._player._stepEnabled = true; + + _vm->_dialogs->show(61217); + } + break; + + default: + break; + } +} + +void Scene612::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('c', -1)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('p', -1)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites("*RXCD_3"); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites("*RXRC_6"); + + if ((_globals[kLineStatus] == 2) || (_globals[kLineStatus] == 3)) { + _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('f', -1)); + _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, -1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 1); + int idx = _scene->_dynamicHotspots.add(0x87, VERB_WALKTO, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(34, 117), FACING_SOUTHEAST); + } + + if (_globals[kBoatRaised]) + _cycleIndex = -2; + else + _cycleIndex = -1; + + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, _cycleIndex); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); + + if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(280, 75); + _game._player._facing = FACING_SOUTHWEST; + _game._player._visible = false; + _game._player._stepEnabled = false; + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 3); + _scene->loadAnimation(formAnimName('R', 1), 70); + } + + sceneEntrySound(); + + if (_scene->_roomChanged) + _game._objects.addToInventory(OBJ_PADLOCK_KEY); + + _game.loadQuoteSet(0x2F5, 0x2F4, 0); +} + +void Scene612::step() { + switch (_game._trigger) { + case 70: + _game._player._visible = true; + _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; + _scene->_sequences.addTimer(6, 71); + break; + + case 71: + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 72); + break; + + case 72: + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 2); + _game._player._stepEnabled = true; + break; + + default: + break; + } +} + +void Scene612::actions() { + if (_action.isAction(0x325, 0x324)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 1); + break; + + case 1: { + int syncIdx = _globals._sequenceIndexes[1]; + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 3); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[1], syncIdx); + _scene->_sequences.addTimer(6, 2); + } + break; + + case 2: + _game._player._visible = false; + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], true, 10, 1, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 3); + break; + + case 3: { + int syncIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], true, -2); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], syncIdx); + _scene->_nextSceneId = 504; + } + break; + + default: + break; + } + } else if (_action.isAction(0x17B, 0xFF, 0x45F)) { + _cycleIndex = -2; + action = 1; + handleWinchMovement(); + } else if (_action._lookFlag || _action.isAction(VERB_LOOK, 0x466)) + _vm->_dialogs->show(61210); + else if (_action.isAction(VERB_LOOK, 0x347) || _action.isAction(VERB_LOOK, 0x45E)) { + if (_globals[kBoatRaised]) + _vm->_dialogs->show(61211); + else + _vm->_dialogs->show(61212); + } else if (_action.isAction(VERB_TAKE, 0x347)) + _vm->_dialogs->show(61213); + else if (_action.isAction(VERB_LOOK, 0x45F)) { + if (_globals[kBoatRaised]) + _vm->_dialogs->show(61214); + else + _vm->_dialogs->show(61216); + } else if (_action.isAction(VERB_OPEN, 0x45F)) + _vm->_dialogs->show(61215); + else if (_action.isAction(VERB_LOOK, 0x33D)) + _vm->_dialogs->show(61218); + else if (_action.isAction(VERB_LOOK, 0x464)) + _vm->_dialogs->show(61219); + else if (_action.isAction(VERB_LOOK, 0x2CD)) + _vm->_dialogs->show(61220); + else if (_action.isAction(VERB_LOOK, 0x4A2)) + _vm->_dialogs->show(61221); + else if (_action.isAction(VERB_OPEN, 0x4A2)) + _vm->_dialogs->show(61222); + else if (_action.isAction(VERB_LOOK, 0x18D)) + _vm->_dialogs->show(61223); + else if (_action.isAction(VERB_LOOK, 0x257)) + _vm->_dialogs->show(61224); + else if (_action.isAction(0x1AD, 0x461) || _action.isAction(0x1AD, 0x463)) + _vm->_dialogs->show(61225); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + void Scene620::setup() { _game._player._spritesPrefix = ""; setAAName(); diff --git a/engines/mads/nebular/nebular_scenes6.h b/engines/mads/nebular/nebular_scenes6.h index 4c465bf79f..294cf3560d 100644 --- a/engines/mads/nebular/nebular_scenes6.h +++ b/engines/mads/nebular/nebular_scenes6.h @@ -300,6 +300,24 @@ public: virtual void postActions() {}; }; +class Scene612: public Scene6xx{ +private: + int action; + int _cycleIndex; + + void handleWinchMovement(); + +public: + Scene612(MADSEngine *vm) : Scene6xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions(); + virtual void postActions() {}; +}; + class Scene620: public Scene6xx{ public: Scene620(MADSEngine *vm) : Scene6xx(vm) {} -- cgit v1.2.3 From fbb923daee62567aa8d9a6a5b02faf647e6233fa Mon Sep 17 00:00:00 2001 From: D G Turner Date: Thu, 15 May 2014 01:35:48 +0100 Subject: GUI: Add usage for "debuglevel" command output in Debugger base class. --- gui/debugger.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gui/debugger.cpp b/gui/debugger.cpp index da342e26e9..3cfa9f9803 100644 --- a/gui/debugger.cpp +++ b/gui/debugger.cpp @@ -505,6 +505,7 @@ bool Debugger::Cmd_OpenLog(int argc, const char **argv) { bool Debugger::Cmd_DebugLevel(int argc, const char **argv) { if (argc == 1) { // print level DebugPrintf("Debugging is currently %s (set at level %d)\n", (gDebugLevel >= 0) ? "enabled" : "disabled", gDebugLevel); + DebugPrintf("Usage: %s where n is 0 to 10 or -1 to disable debugging\n", argv[0]); } else { // set level gDebugLevel = atoi(argv[1]); if (gDebugLevel >= 0 && gDebugLevel < 11) { @@ -512,7 +513,8 @@ bool Debugger::Cmd_DebugLevel(int argc, const char **argv) { } else if (gDebugLevel < 0) { DebugPrintf("Debugging is now disabled\n"); } else { - DebugPrintf("Invalid debug level value (0 to 10 or -1 to disable)\n"); + DebugPrintf("Invalid debug level value\n"); + DebugPrintf("Usage: %s where n is 0 to 10 or -1 to disable debugging\n", argv[0]); } } -- cgit v1.2.3 From 95e144a3142fcab0c11b5e0d2452a899a06750c9 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 15 May 2014 07:14:13 +0200 Subject: MADS: Some refactoring in scene group 7 --- engines/mads/nebular/nebular_scenes7.cpp | 257 +++++++++++++------------------ 1 file changed, 110 insertions(+), 147 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index cb9880e1aa..46eb86c66c 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -120,19 +120,14 @@ void Scene701::enter() { } if (_globals[kBoatStatus] == BOAT_UNFLOODED) { - if (_globals[kBoatRaised]) { + if (_globals[kBoatRaised]) _globals[kBoatStatus] = BOAT_GONE; - } else { - if (_globals[kLineStatus] == LINE_TIED) { - _globals[kBoatStatus] = BOAT_TIED_FLOATING; - } else { - if (_game._difficulty == DIFFICULTY_HARD) { - _globals[kBoatStatus] = BOAT_ADRIFT; - } else { - _globals[kBoatStatus] = BOAT_TIED; - } - } - } + else if (_globals[kLineStatus] == LINE_TIED) + _globals[kBoatStatus] = BOAT_TIED_FLOATING; + else if (_game._difficulty == DIFFICULTY_HARD) + _globals[kBoatStatus] = BOAT_ADRIFT; + else + _globals[kBoatStatus] = BOAT_TIED; } _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); @@ -213,81 +208,67 @@ void Scene702::enter() { } void Scene702::preActions() { - if (_action.isAction(VERB_WALKTO, NOUN_WEST_END_OF_PLATFORM)) { + if (_action.isAction(VERB_WALKTO, NOUN_WEST_END_OF_PLATFORM)) _game._player._walkOffScreenSceneId = 701; - } } void Scene702::actions() { - if (_action.isAction(VERB_WALK_ALONG, NOUN_PLATFORM)) { - _action._inProgress = false; - } else if (_action.isAction(VERB_STEP_INTO, NOUN_TELEPORTER)) { + if (_action.isAction(VERB_WALK_ALONG, NOUN_PLATFORM)) + ; // Only set the action as finished + else if (_action.isAction(VERB_STEP_INTO, NOUN_TELEPORTER)) { _game._player._stepEnabled = false; _game._player._visible = false; _scene->_nextSceneId = 711; - _action._inProgress = false; - } else if (_action.isAction(VERB_TAKE, NOUN_BONES) && _action._mainObjectSource == 4) { - // Take bones - if (!_game._objects.isInInventory(OBJ_BONES) || _game._trigger) { - switch (_game._trigger) { - case 0: - _game._player._stepEnabled = false; - _game._player._visible = false; - _globals._sequenceIndexes[12] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[12], false, 5, 2, 0, 0); - _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[12]); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SEQUENCE_TRIGGER_SPRITE, 4, 1); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SEQUENCE_TRIGGER_EXPIRE, 0, 2); - break; - case 1: - _vm->_sound->command(0xF); - if (_game._objects.isInInventory(OBJ_BONE)) - _game._objects.setRoom(OBJ_BONE, NOWHERE); - _game._objects.addToInventory(OBJ_BONES); - _vm->_dialogs->show(OBJ_BONES, 70218); - break; - case 2: - _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[12]); - _game._player._visible = true; - _game._player._stepEnabled = true; - break; - default: - break; - } - - _action._inProgress = false; + } else if (_action.isAction(VERB_TAKE, NOUN_BONES) && _action._mainObjectSource == 4 && (!_game._objects.isInInventory(OBJ_BONES) || _game._trigger)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[12] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[12], false, 5, 2, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[12]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SEQUENCE_TRIGGER_SPRITE, 4, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + case 1: + _vm->_sound->command(0xF); + if (_game._objects.isInInventory(OBJ_BONE)) + _game._objects.setRoom(OBJ_BONE, NOWHERE); + _game._objects.addToInventory(OBJ_BONES); + _vm->_dialogs->show(OBJ_BONES, 70218); + break; + case 2: + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[12]); + _game._player._visible = true; + _game._player._stepEnabled = true; + break; + default: + break; } - } else if (_action._lookFlag) { + } else if (_action._lookFlag) _vm->_dialogs->show(70210); - _action._inProgress = false; - } else if (_action.isAction(VERB_LOOK, NOUN_PLATFORM)) { + else if (_action.isAction(VERB_LOOK, NOUN_PLATFORM)) _vm->_dialogs->show(70211); - _action._inProgress = false; - } else if (_action.isAction(VERB_LOOK, NOUN_CEMENT_BLOCK)) { + else if (_action.isAction(VERB_LOOK, NOUN_CEMENT_BLOCK)) _vm->_dialogs->show(70212); - _action._inProgress = false; - } else if (_action.isAction(VERB_LOOK, NOUN_ROCK)) { + else if (_action.isAction(VERB_LOOK, NOUN_ROCK)) _vm->_dialogs->show(70213); - _action._inProgress = false; - } else if (_action.isAction(VERB_TAKE, NOUN_ROCK)) { + else if (_action.isAction(VERB_TAKE, NOUN_ROCK)) _vm->_dialogs->show(70214); - _action._inProgress = false; - } else if (_action.isAction(VERB_LOOK, NOUN_WEST_END_OF_PLATFORM)) { + else if (_action.isAction(VERB_LOOK, NOUN_WEST_END_OF_PLATFORM)) _vm->_dialogs->show(70215); - _action._inProgress = false; - } else if (_action.isAction(VERB_LOOK, NOUN_TELEPORTER)) { + else if (_action.isAction(VERB_LOOK, NOUN_TELEPORTER)) _vm->_dialogs->show(70216); - _action._inProgress = false; - } else if (_action.isAction(VERB_LOOK, NOUN_BONES) && _action._mainObjectSource == 4) { + else if (_action.isAction(VERB_LOOK, NOUN_BONES) && _action._mainObjectSource == 4) _vm->_dialogs->show(70217); - _action._inProgress = false; - } else if (_action.isAction(VERB_TAKE, NOUN_BONES) && _action._mainObjectSource == 4) { + else if (_action.isAction(VERB_TAKE, NOUN_BONES) && _action._mainObjectSource == 4) { if (_game._objects.isInInventory(OBJ_BONES)) _vm->_dialogs->show(70219); - _action._inProgress = false; - } else if (_action.isAction(VERB_LOOK, NOUN_SUBMERGED_CITY)) { + } else if (_action.isAction(VERB_LOOK, NOUN_SUBMERGED_CITY)) _vm->_dialogs->show(70220); - _action._inProgress = false; - } + else + return; + + _action._inProgress = false; } /*------------------------------------------------------------------------*/ @@ -507,108 +488,90 @@ void Scene752::preActions() { } void Scene752::actions() { - if (_action.isAction(VERB_WALK_ALONG, NOUN_PLATFORM)) { - _action._inProgress = false; - } else if (_action.isAction(VERB_STEP_INTO, NOUN_TELEPORTER)) { + if (_action.isAction(VERB_WALK_ALONG, NOUN_PLATFORM)) + ; + else if (_action.isAction(VERB_STEP_INTO, NOUN_TELEPORTER)) { _game._player._stepEnabled = false; _game._player._visible = false; _scene->_nextSceneId = 711; - _action._inProgress = false; - } else if (_action.isAction(VERB_TAKE, NOUN_ID_CARD)) { - // Take ID card - if (!_game._objects.isInInventory(OBJ_ID_CARD) || _game._trigger) { - switch (_game._trigger) { - case 0: - _game._player._stepEnabled = false; - _game._player._visible = false; - _globals._sequenceIndexes[12] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[12], false, 5, 2, 0, 0); - _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[12]); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SEQUENCE_TRIGGER_SPRITE, 4, 1); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SEQUENCE_TRIGGER_EXPIRE, 0, 2); - break; - case 1: - _vm->_sound->command(0xF); - _scene->_sequences.remove(_globals._sequenceIndexes[13]); - _game._objects.addToInventory(OBJ_ID_CARD); - _scene->_dynamicHotspots.remove(_cardId); - _vm->_dialogs->show(OBJ_ID_CARD, 830); - break; - case 2: - _game._player._visible = true; - _game._player._stepEnabled = true; - break; - default: - break; - } - - _action._inProgress = false; + } else if (_action.isAction(VERB_TAKE, NOUN_ID_CARD) && (!_game._objects.isInInventory(OBJ_ID_CARD) || _game._trigger)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[12] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[12], false, 5, 2, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[12]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SEQUENCE_TRIGGER_SPRITE, 4, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + case 1: + _vm->_sound->command(0xF); + _scene->_sequences.remove(_globals._sequenceIndexes[13]); + _game._objects.addToInventory(OBJ_ID_CARD); + _scene->_dynamicHotspots.remove(_cardId); + _vm->_dialogs->show(OBJ_ID_CARD, 830); + break; + case 2: + _game._player._visible = true; + _game._player._stepEnabled = true; + break; + default: + break; } - } else if (_action.isAction(VERB_TAKE, NOUN_BONES) && _action._mainObjectSource == 4) { - // Take bones - if (!_game._objects.isInInventory(OBJ_BONES) || _game._trigger) { - switch (_game._trigger) { - case 0: - _game._player._stepEnabled = false; - _game._player._visible = false; - _globals._sequenceIndexes[12] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[12], false, 5, 2, 0, 0); - _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[12]); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SEQUENCE_TRIGGER_SPRITE, 4, 1); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SEQUENCE_TRIGGER_EXPIRE, 0, 2); - break; - case 1: - _vm->_sound->command(0xF); - if (_game._objects.isInInventory(OBJ_BONE)) - _game._objects.setRoom(OBJ_BONE, NOWHERE); - _game._objects.addToInventory(OBJ_BONES); - _vm->_dialogs->show(OBJ_BONES, 75221); - break; - case 2: - _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[12]); - _game._player._visible = true; - _game._player._stepEnabled = true; - break; - default: - break; - } - - _action._inProgress = false; + } else if (_action.isAction(VERB_TAKE, NOUN_BONES) && _action._mainObjectSource == 4 && (!_game._objects.isInInventory(OBJ_BONES) || _game._trigger)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[12] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[12], false, 5, 2, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[12]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SEQUENCE_TRIGGER_SPRITE, 4, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + case 1: + _vm->_sound->command(0xF); + if (_game._objects.isInInventory(OBJ_BONE)) + _game._objects.setRoom(OBJ_BONE, NOWHERE); + _game._objects.addToInventory(OBJ_BONES); + _vm->_dialogs->show(OBJ_BONES, 75221); + break; + case 2: + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[12]); + _game._player._visible = true; + _game._player._stepEnabled = true; + break; + default: + break; } } else if (_action._lookFlag || _action.isAction(VERB_LOOK, NOUN_CITY)) { if (_globals[kLaserHoleIsThere]) _vm->_dialogs->show(75212); else _vm->_dialogs->show(75210); - - _action._inProgress = false; - } else if (_action.isAction(VERB_LOOK, NOUN_PLATFORM)) { + } else if (_action.isAction(VERB_LOOK, NOUN_PLATFORM)) _vm->_dialogs->show(75213); - _action._inProgress = false; - } else if (_action.isAction(VERB_LOOK, NOUN_CEMENT_BLOCK)) { + else if (_action.isAction(VERB_LOOK, NOUN_CEMENT_BLOCK)) _vm->_dialogs->show(75214); - _action._inProgress = false; - } else if (_action.isAction(VERB_LOOK, NOUN_ROCK)) { + else if (_action.isAction(VERB_LOOK, NOUN_ROCK)) _vm->_dialogs->show(75215); - _action._inProgress = false; - } else if (_action.isAction(VERB_TAKE, NOUN_ROCK)) { + else if (_action.isAction(VERB_TAKE, NOUN_ROCK)) _vm->_dialogs->show(75216); - _action._inProgress = false; - } else if (_action.isAction(VERB_LOOK, NOUN_WEST_END_OF_PLATFORM)) { + else if (_action.isAction(VERB_LOOK, NOUN_WEST_END_OF_PLATFORM)) _vm->_dialogs->show(75217); - _action._inProgress = false; - } else if (_action.isAction(VERB_LOOK, NOUN_TELEPORTER)) { + else if (_action.isAction(VERB_LOOK, NOUN_TELEPORTER)) _vm->_dialogs->show(75218); - _action._inProgress = false; - } else if ((_action.isAction(VERB_LOOK, NOUN_BONES) || _action.isAction(VERB_LOOK, NOUN_ID_CARD)) && _action._mainObjectSource == 4) { + else if ((_action.isAction(VERB_LOOK, NOUN_BONES) || _action.isAction(VERB_LOOK, NOUN_ID_CARD)) && _action._mainObjectSource == 4) { if (_game._objects[OBJ_ID_CARD]._roomNumber == 752) _vm->_dialogs->show(75219); else _vm->_dialogs->show(75220); - _action._inProgress = false; } else if (_action.isAction(VERB_TAKE, NOUN_BONES) && _action._mainObjectSource == 4) { if (_game._objects.isInInventory(OBJ_BONES)) _vm->_dialogs->show(75222); - _action._inProgress = false; - } + } else + return; + + _action._inProgress = false; } /*------------------------------------------------------------------------*/ -- cgit v1.2.3 From 9fcebd296a1828831e052fbd55181363e252bbaa Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 15 May 2014 09:46:29 +0300 Subject: MADS: Some bugfixes to the debug console --- engines/mads/debugger.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/engines/mads/debugger.cpp b/engines/mads/debugger.cpp index 3594c83d36..e3ddf02a5a 100644 --- a/engines/mads/debugger.cpp +++ b/engines/mads/debugger.cpp @@ -30,7 +30,7 @@ Debugger::Debugger(MADSEngine *vm) : GUI::Debugger(), _vm(vm) { _showMousePos = false; DCmd_Register("continue", WRAP_METHOD(Debugger, Cmd_Exit)); - DCmd_Register("scene", WRAP_METHOD(Debugger, Cmd_Mouse)); + DCmd_Register("mouse", WRAP_METHOD(Debugger, Cmd_Mouse)); DCmd_Register("scene", WRAP_METHOD(Debugger, Cmd_LoadScene)); DCmd_Register("show_hotspots", WRAP_METHOD(Debugger, Cmd_ShowHotSpots)); DCmd_Register("list_hotspots", WRAP_METHOD(Debugger, Cmd_ListHotSpots)); @@ -60,7 +60,7 @@ static int strToInt(const char *s) { bool Debugger::Cmd_Mouse(int argc, const char **argv) { if (argc < 2) { - DebugPrintf("Format: mouse [ on | off ]\n"); + DebugPrintf("Usage: %s [ on | off ]\n", argv[0]); } else { _showMousePos = strcmp(argv[1], "on") == 0; } @@ -178,6 +178,7 @@ bool Debugger::Cmd_DumpFile(int argc, const char **argv) { inFile.read(data, inFile.size()); outFile.write(data, inFile.size()); + outFile.flush(); delete[] data; inFile.close(); -- cgit v1.2.3 From f46dc0a44ebcd3dd48154fd09b468e7d01b7e4c8 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 15 May 2014 10:16:02 +0300 Subject: MADS: Add a dummy implementation of setMotion() This resolves the FIXME in scene 109 --- engines/mads/nebular/nebular_scenes1.cpp | 3 +-- engines/mads/sequence.h | 7 ++++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index f317b2832d..b2e07dc0e6 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -2455,8 +2455,7 @@ void Scene109::step() { _hungryFl = true; } - // FIXME: The fish animation never moves, so x is never updated and the scene freezes - if (_eatingFirstFish /*&& (_scene->_sequences[_globals._sequenceIndexes[10]]._msgPos.x >= 178)*/) { + if (_eatingFirstFish && (_scene->_sequences[_globals._sequenceIndexes[10]]._msgPos.x >= 178)) { _globals._sequenceIndexes[9] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 4, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 4); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SEQUENCE_TRIGGER_SPRITE, 29, 72); diff --git a/engines/mads/sequence.h b/engines/mads/sequence.h index 8abef5c3e1..bb084cc0f1 100644 --- a/engines/mads/sequence.h +++ b/engines/mads/sequence.h @@ -126,7 +126,12 @@ public: void setScale(int spriteIdx, int scale); void setMsgLayout(int seqIndex); void setDone(int seqIndex); - void setMotion(int seqIndex, int flags, int deltaX, int deltaY) { warning("TODO: setMotion()"); } + void setMotion(int seqIndex, int flags, int deltaX, int deltaY) { + warning("TODO: setMotion()"); + // HACK: Just offset by the delta for now + _entries[seqIndex]._msgPos.x += deltaX; + _entries[seqIndex]._msgPos.y += deltaY; + } }; } // End of namespace MADS -- cgit v1.2.3 From 02df998be90158d6d603f0cf3d337787f1014b1c Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 15 May 2014 11:13:46 +0300 Subject: MADS: Bugfixes and cleanup for scene 202 --- engines/mads/nebular/nebular_scenes.cpp | 14 ++-- engines/mads/nebular/nebular_scenes.h | 2 + engines/mads/nebular/nebular_scenes2.cpp | 122 +++++++++++++++---------------- engines/mads/nebular/nebular_scenes2.h | 2 +- 4 files changed, 70 insertions(+), 70 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 64511a39d9..df193262e0 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -425,7 +425,7 @@ void SceneTeleporter::teleporterHandleKey() { _scene->_sequences.addSubEntry(_handSequenceId, SEQUENCE_TRIGGER_LOOP, 0, 1); _scene->_sequences.addSubEntry(_handSequenceId, SEQUENCE_TRIGGER_EXPIRE, 0, 2); - if (_globals[kMeteorologistWatch] == 0) + if (_globals[kMeteorologistWatch] == METEOROLOGIST_NORMAL) _vm->_events->hideCursor(); } @@ -477,7 +477,7 @@ void SceneTeleporter::teleporterHandleKey() { if (_finishedCodeCounter == 1) { _finishedCodeCounter++; - if (_globals[kMeteorologistWatch] != 0) + if (_globals[kMeteorologistWatch] != METEOROLOGIST_NORMAL) _scene->_nextSceneId = 202; else { _vm->_events->showCursor(); @@ -492,14 +492,14 @@ void SceneTeleporter::teleporterHandleKey() { _scene->_nextSceneId = _teleporterSceneId; } } - } else if (_globals[kMeteorologistWatch] != 0) + } else if (_globals[kMeteorologistWatch] != METEOROLOGIST_NORMAL) _scene->_sequences.addTimer(30, 230 + _meteorologistCurPlace); break; case 3: if (!_finishedCodeCounter) { - if (_globals[kMeteorologistWatch] == 0) { + if (_globals[kMeteorologistWatch] == METEOROLOGIST_NORMAL) { _game._player._stepEnabled = true; _vm->_events->showCursor(); } @@ -513,7 +513,7 @@ void SceneTeleporter::teleporterHandleKey() { void SceneTeleporter::teleporterEnter() { _game._player._visible = false; - _game._player._stepEnabled = (_globals[kMeteorologistWatch] == 0); + _game._player._stepEnabled = (_globals[kMeteorologistWatch] == METEOROLOGIST_NORMAL); _scene->_kernelMessages._talkFont = _vm->_font->getFont(FONT_TELE); _scene->_textSpacing = 0; _curCode = 0; @@ -553,7 +553,7 @@ void SceneTeleporter::teleporterEnter() { _meteorologistCurPlace = 0; - if (_globals[kMeteorologistWatch] != 0) + if (_globals[kMeteorologistWatch] != METEOROLOGIST_NORMAL) _scene->_sequences.addTimer(30, 230); _vm->_sound->command(36); @@ -582,7 +582,7 @@ bool SceneTeleporter::teleporterActions() { } void SceneTeleporter::teleporterStep() { - if ((_globals[kMeteorologistWatch] != 0) && (_game._trigger >= 230)) { + if ((_globals[kMeteorologistWatch] != METEOROLOGIST_NORMAL) && (_game._trigger >= 230)) { int place = _game._trigger - 230; int digit; diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index 3534613431..60526f7115 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -66,6 +66,7 @@ enum Verb { enum Noun { NOUN_BIG_LEAVES = 0x23, + NOUN_BINOCULARS = 0x27, NOUN_BLOWGUN = 0x29, NOUN_BOMB = 0x2A, NOUN_BOMBS = 0x2B, @@ -109,6 +110,7 @@ enum Noun { NOUN_HUGE_LEGS = 0x1A8, NOUN_LEAF_COVERED_PIT = 0x1A9, NOUN_PILE_OF_LEAVES = 0x1AA, + NOUN_STRANGE_DEVICE = 0x1B6, NOUN_CAPTIVE_CREATURE = 0x1C3, NOUN_NATIVE_WOMAN = 0x1DC, NOUN_PLATFORM = 0x22C, diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 39437045f7..b38aaceec1 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -99,7 +99,7 @@ void Scene2xx::sceneEntrySound() { _vm->_sound->command(10); break; case 213: - if (_globals[kMeteorologistWatch] == 0) + if (_globals[kMeteorologistWatch] == METEOROLOGIST_NORMAL) _vm->_sound->command(1); else _vm->_sound->command(9); @@ -419,26 +419,23 @@ void Scene202::enter() { if (_scene->_roomChanged) _game._objects.addToInventory(OBJ_BINOCULARS); - if (_globals[kMeteorologistWatch]) { + if (_globals[kMeteorologistWatch] != METEOROLOGIST_NORMAL) { _game._player._visible = false; _game._player._stepEnabled = false; - if (_globals[kMeteorologistWatch] == 2) - _ladderTopFl = true; - else - _ladderTopFl = false; - - if (_globals[kMeteorologistWatch] < 1) - _globals._sequenceIndexes[10] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 6); - else - _globals._sequenceIndexes[10] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 8); - _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 1); + _ladderTopFl = (_globals[kMeteorologistWatch] == METEOROLOGIST_TOWER); if (_ladderTopFl) { + _globals._sequenceIndexes[10] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, 8); + _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[10], Common::Point(247, 82)); _game._player._playerPos = Common::Point(246, 124); _game._player._facing = FACING_NORTH; _globals[kTeleporterUnderstood] = true; } else { + _globals._sequenceIndexes[10] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 6); + _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[10], Common::Point(172, 123)); _game._player._playerPos = Common::Point(171, 122); _game._player._facing = FACING_NORTH; @@ -447,15 +444,17 @@ void Scene202::enter() { _scene->loadAnimation(formAnimName('M', -1), 71); _scene->_activeAnimation->setCurrentFrame(200); } else { - _game._player._visible = false; - _scene->_sequences.startCycle(_globals._sequenceIndexes[9], true, 1); - _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[9], Common::Point(247, 82)); - _game._player._playerPos = Common::Point(246, 124); - _game._player._facing = FACING_NORTH; + if (_ladderTopFl) { + _game._player._visible = false; + _scene->_sequences.startCycle(_globals._sequenceIndexes[9], true, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[9], Common::Point(247, 82)); + _game._player._playerPos = Common::Point(246, 124); + _game._player._facing = FACING_NORTH; + } } - _meteorologistSpecial = 0; + _meteorologistSpecial = false; } void Scene202::setRandomKernelMessage() { @@ -480,30 +479,35 @@ void Scene202::step() { if (_game._trigger == 71) { _vm->_sound->command(3); _vm->_sound->command(9); - _meteoClock1 = 900 + _scene->_frameStartTime; - Common::Point msgPos; - int msgFlag; - if (!_ladderTopFl) { - msgPos = Common::Point(0, 0); - msgFlag = 2; - } else { - msgPos = Common::Point(248, 15); - msgFlag = 0; - } - int msgIndex = _scene->_kernelMessages.add(msgPos, 0x1110, msgFlag | 32, 0, 120, _game.getQuote(102)); - _scene->_kernelMessages.setQuoted(msgIndex, 4, true); - if (_globals[kMeteorologistWatch] == 1) { - _action._activeAction._verbId = VERB_LOOK; - _action._activeAction._objectNameId = 39; - _action._activeAction._indirectObjectId = 438; - _game._triggerSetupMode = SEQUENCE_TRIGGER_PARSER; - _scene->_sequences.addTimer(120, 2); - _meteorologistSpecial = -1; - } else if (_globals[kMeteorologistWatch] == 2) { - _scene->_sequences.addTimer(120, 90); + _meteoClock1 = _scene->_frameStartTime + 15 * 60; + + if (_globals[kMeteorologistWatch] != METEOROLOGIST_NORMAL) { + Common::Point msgPos; + int msgFlag; + if (!_ladderTopFl) { + msgPos = Common::Point(0, 0); + msgFlag = 2; + } else { + msgPos = Common::Point(248, 15); + msgFlag = 0; + } + int msgIndex = _scene->_kernelMessages.add(msgPos, 0x1110, msgFlag | 32, 0, 120, _game.getQuote(102)); + _scene->_kernelMessages.setQuoted(msgIndex, 4, true); + + if (_globals[kMeteorologistWatch] == METEOROLOGIST_GROUND) { + _action._activeAction._verbId = VERB_LOOK; + _action._activeAction._objectNameId = NOUN_BINOCULARS; + _action._activeAction._indirectObjectId = NOUN_STRANGE_DEVICE; + _game._triggerSetupMode = SEQUENCE_TRIGGER_PARSER; + _scene->_sequences.addTimer(2 * 60, 2); + _meteorologistSpecial = true; + } else if (_globals[kMeteorologistWatch] == METEOROLOGIST_TOWER) { + _scene->_sequences.addTimer(2 * 60, 90); + } } - _globals[kMeteorologistWatch] = 0; + + _globals[kMeteorologistWatch] = METEOROLOGIST_NORMAL; } switch (_game._trigger) { @@ -550,7 +554,7 @@ void Scene202::step() { break; } - if (!_scene->_activeAnimation && (_globals[kMeteorologistStatus] != 2) && (_meteoClock2 <= _scene->_frameStartTime) && (_meteoClock1 <= _scene->_frameStartTime)) { + if (!_scene->_activeAnimation && (_globals[kMeteorologistStatus] != METEOROLOGIST_GONE) && (_meteoClock2 <= _scene->_frameStartTime) && (_meteoClock1 <= _scene->_frameStartTime)) { int randVal = _vm->getRandomNumber(1, 500); int threshold = 1; if (_ladderTopFl) @@ -574,10 +578,10 @@ void Scene202::step() { if (_waitingMeteoFl) { if (_scene->_activeAnimation->getCurrentFrame() >= 200) { - if ((_globals[kMeteorologistWatch] == 2) || _globals[kLadderBroken]) { + if ((_globals[kMeteorologistWatch] == METEOROLOGIST_TOWER) || _globals[kLadderBroken]) { _scene->_nextSceneId = 213; } else { - _vm->_dialogs->show(0x4EE9); + _vm->_dialogs->show(20201); _scene->_reloadSceneFlag = true; } } @@ -597,7 +601,7 @@ void Scene202::step() { } } - if (_meteoClock2 + 7200 <= _scene->_frameStartTime) { + if (_meteoClock2 + 120 * 60 <= _scene->_frameStartTime) { _toTeleportFl = true; } @@ -613,10 +617,12 @@ void Scene202::step() { case 42: case 77: case 96: + _stationCounter = 0; frameStep = subStep1(randVal); break; case 51: case 74: + _toStationFl = false; frameStep = subStep2(randVal); break; case 27: @@ -645,19 +651,13 @@ void Scene202::step() { break; } - if (frameStep < 0) - return; - - int nextFrame = 1 + _scene->_activeAnimation->getCurrentFrame() - frameStep; - if (nextFrame) { - _scene->_activeAnimation->setCurrentFrame(nextFrame); - _meteoFrame = nextFrame; + if (frameStep >= 0 && frameStep != _scene->_activeAnimation->getCurrentFrame() + 1) { + _scene->_activeAnimation->setCurrentFrame(frameStep); + _meteoFrame = frameStep; } } int Scene202::subStep1(int randVal) { - _stationCounter = 0; - if ((randVal <= 100) || _toStationFl) return 42; @@ -671,8 +671,6 @@ int Scene202::subStep1(int randVal) { } int Scene202::subStep2(int randVal) { - _toStationFl = false; - if ((randVal <= 150) && (_stationCounter < 5)) return 51; @@ -849,7 +847,7 @@ void Scene202::actions() { _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[10], Common::Point(172, 123)); if (_scene->_activeAnimation) { _waitingMeteoFl = true; - _globals[kMeteorologistWatch] = 1; + _globals[kMeteorologistWatch] = METEOROLOGIST_GROUND; } else { _scene->_sequences.addTimer(120, 2); } @@ -894,7 +892,7 @@ void Scene202::actions() { _scene->_sequences.addTimer(120, 2); } else { _waitingMeteoFl = true; - _globals[kMeteorologistWatch] = 2; + _globals[kMeteorologistWatch] = METEOROLOGIST_GONE; if ((_scene->_activeAnimation->getCurrentFrame() >= 44) && (_scene->_activeAnimation->getCurrentFrame() <= 75)) { _scene->_kernelMessages.reset(); int msgIndex = _scene->_kernelMessages.add(Common::Point(248, 15), 0x1110, 32, 0, 60, _game.getQuote(100)); @@ -911,7 +909,7 @@ void Scene202::actions() { case 2: if (!_scene->_activeAnimation) _vm->_dialogs->show(0x4EFE); - _meteorologistSpecial = 0; + _meteorologistSpecial = false; _scene->_sequences.remove(_globals._sequenceIndexes[10]); _globals._sequenceIndexes[9] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[9], false, 6, 1, 0, 0); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[9], Common::Point(247, 82)); @@ -1000,7 +998,7 @@ void Scene202::synchronize(Common::Serializer &s) { s.syncAsUint32LE(_meteoClock2); s.syncAsUint32LE(_startTime); - s.syncAsSint32LE(_meteorologistSpecial); + s.syncAsByte(_meteorologistSpecial); } /*****************************************************************************/ @@ -4863,7 +4861,7 @@ void Scene213::setup() { } void Scene213::enter() { - if (_globals[kMeteorologistWatch] != 0) + if (_globals[kMeteorologistWatch] != METEOROLOGIST_ABSENT) _handSpriteId = _scene->_sprites.addSprites("*METHAND"); else if (_globals[kSexOfRex] == REX_MALE) _handSpriteId = _scene->_sprites.addSprites("*REXHAND"); @@ -4874,7 +4872,7 @@ void Scene213::enter() { // The original is calling Scene2xx::sceneEntrySound() if (_vm->_musicFlag) { - if (_globals[kMeteorologistWatch] == 0) + if (_globals[kMeteorologistWatch] == METEOROLOGIST_ABSENT) _vm->_sound->command(1); else _vm->_sound->command(9); diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index 14a5d75d34..b4f4866b6b 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -67,7 +67,7 @@ private: bool _activeMsgFl, _ladderTopFl, _waitingMeteoFl, _toStationFl, _toTeleportFl; int _ladderHotspotId, _lastRoute, _stationCounter, _meteoFrame; uint32 _meteoClock1, _meteoClock2, _startTime; - int _meteorologistSpecial; + bool _meteorologistSpecial; int subStep1(int randVal); int subStep2(int randVal); -- cgit v1.2.3 From 1a7e586a6737474875e3f8dfc7bb20938f05fbe3 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 15 May 2014 12:40:42 +0300 Subject: MADS: Further work on scene 701 --- engines/mads/nebular/nebular_scenes.h | 6 +- engines/mads/nebular/nebular_scenes7.cpp | 160 ++++++++++++++++++++++++++++++- engines/mads/nebular/nebular_scenes7.h | 6 +- 3 files changed, 165 insertions(+), 7 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index 60526f7115..d02f6cbd51 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -116,6 +116,9 @@ enum Noun { NOUN_PLATFORM = 0x22C, NOUN_ALCOHOL = 0x310, NOUN_SUBMERGED_CITY = 0x313, + NOUN_CEMENT_PYLON = 0x316, + NOUN_ELEVATOR = 0x317, + NOUN_BUILDING = 0x323, NOUN_LASER_BEAM = 0x343, NOUN_BOAT = 0x345, NOUN_CEMENT_BLOCK = 0x38E, @@ -125,7 +128,8 @@ enum Noun { NOUN_DASH = 0x3AE, NOUN_SPLASH = 0x3AF, NOUN_BIRDS = 0x487, - NOUN_WEST_END_OF_PLATFORM = 0x4A9 + NOUN_WEST_END_OF_PLATFORM = 0x4A9, + NOUN_EAST_END_OF_PLATFORM = 0x4AA }; class SceneFactory { diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index 46eb86c66c..302c8ba28a 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -103,7 +103,7 @@ void Scene701::enter() { _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 0)); _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('b', 5)); _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('b', 0)); - //_globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('b', 1)); // FIXME: Invalid resource? + //_globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('b', 1)); // FIXME: Broken sprite? _globals._spriteIndexes[5] = _scene->_sprites.addSprites("*RM202A1"); _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('b', 8)); @@ -156,17 +156,167 @@ void Scene701::enter() { break; } - // TODO: Line status + // TODO: Enable once sprite 3 can be loaded properly + /* + if (_globals[kLineStatus] == LINE_DROPPED || _globals[kLineStatus] == LINE_TIED) { + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 8); + int idx = _scene->_dynamicHotspots.add(NOUN_FISHING_LINE, VERB_WALKTO, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); + _fishingLineId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(234, 129), FACING_NORTHEAST); + } + */ + + if (_scene->_priorSceneId == 702) { + _game._player._playerPos = Common::Point(309, 138); + _game._player._facing = FACING_WEST; + } else if (_scene->_priorSceneId == 710) { + _game._player._playerPos = Common::Point(154, 129); + _game._player._facing = FACING_NORTH; + _game._player._visible = false; + _game._player._stepEnabled = false; + _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[5], Common::Point(155, 129)); + _scene->_sequences.addTimer(15, 60); + } else if (_scene->_priorSceneId == 703) { + _game._player._playerPos = Common::Point(231, 127); + _game._player._facing = FACING_SOUTH; + _game._player._visible = false; + _game._player._stepEnabled = false; + _scene->loadAnimation(formAnimName('B', 1), 80); + _vm->_sound->command(28); + } else if (_scene->_priorSceneId != -2 && _scene->_priorSceneId != -620) { + _game._player._playerPos = Common::Point(22, 131); + _game._player._facing = FACING_EAST; + // TODO: Enable once step() is implemented + //_game._player._stepEnabled = false; + //_scene->_sequences.addTimer(1 * 60, 70); + } - // TODO + _game.loadQuoteSet(0x310, 0x30F, 0); + sceneEntrySound(); +} + +void Scene701::step() { + switch(_game._trigger) { + case 60: + // TODO + break; + case 61: + // TODO + break; + case 70: + // TODO + break; + case 71: + _game._player.walk(Common::Point(61, 131), FACING_EAST); + _scene->_sequences.addTimer(2 * 60, 72); + break; + case 72: + // TODO + break; + case 73: + // TODO + break; + case 80: + _game._player._visible = true; + // TODO + _globals[kBoatStatus] = BOAT_TIED; + _game._player._stepEnabled = true; + break; + } } void Scene701::preActions() { - // TODO + if (_action.isAction(VERB_WALKTO, NOUN_EAST_END_OF_PLATFORM)) { + _game._player._walkOffScreenSceneId = 702; + } + + if (_action.isAction(VERB_LOOK, NOUN_BUILDING)) { + _game._player.walk(Common::Point(154, 129), FACING_NORTHEAST); + } + + if (_action.isAction(VERB_LOOK, NOUN_BINOCULARS, NOUN_BUILDING)) { + _game._player.walk(Common::Point(154, 129), FACING_NORTH); + } } void Scene701::actions() { - // TODO + if (_action.isAction(VERB_WALK_ALONG, NOUN_PLATFORM)) + return; + + if (_action.isAction(VERB_LOOK, NOUN_BINOCULARS, NOUN_BUILDING) && _game._objects[OBJ_VASE]._roomNumber == 706) { + switch (_game._trigger) { + case 0: + // TODO + break; + case 1: + // TODO + break; + case 2: + _scene->_nextSceneId = 710; + break; + } + } else if (_action.isAction(VERB_STEP_INTO, NOUN_ELEVATOR)) { + switch (_game._trigger) { + case 0: + // TODO + break; + case 1: + // TODO + break; + case 3: + // TODO + break; + case 4: + // TODO + break; + } + } else if (false) { + // TODO: boat + fishing line action + } else if (_action.isAction(VERB_CLIMB_INTO, NOUN_BOAT) && _globals[kBoatStatus] == BOAT_TIED) { + switch (_game._trigger) { + case 0: + // TODO + break; + case 1: + _scene->_nextSceneId = 703; + break; + } + } else if (_action._lookFlag) { + if (_globals[kBoatStatus] != BOAT_GONE) { + if (_globals[kBoatStatus] == BOAT_TIED) + _vm->_dialogs->show(70128); + else + _vm->_dialogs->show(70110); + } else { + _vm->_dialogs->show(70111); + } + } else if (_action.isAction(VERB_LOOK, NOUN_SUBMERGED_CITY)) { + _vm->_dialogs->show(70112); + } else if (_action.isAction(VERB_LOOK, 0)) { + _vm->_dialogs->show(70113); + } else if (_action.isAction(VERB_LOOK, NOUN_PLATFORM)) { + _vm->_dialogs->show(70114); + } else if (_action.isAction(VERB_LOOK, NOUN_CEMENT_PYLON)) { + _vm->_dialogs->show(70115); + } else if (false) { + // TODO: hook + } else if (_action.isAction(VERB_LOOK, NOUN_ROCK)) { + _vm->_dialogs->show(70118); + } else if (_action.isAction(VERB_TAKE, NOUN_ROCK)) { + _vm->_dialogs->show(70119); + } else if (_action.isAction(VERB_LOOK, NOUN_EAST_END_OF_PLATFORM)) { + _vm->_dialogs->show(70120); + } else if (_action.isAction(VERB_LOOK, NOUN_BUILDING)) { + _vm->_dialogs->show(70121); + } else if (_action.isAction(VERB_LOOK, NOUN_BOAT)) { + if (_globals[kBoatStatus] == BOAT_ADRIFT || _globals[kBoatStatus] == BOAT_TIED_FLOATING) + _vm->_dialogs->show(70122); + else + _vm->_dialogs->show(70123); + } else if (false) { + // TODO: fishing rod + boat + } } /*------------------------------------------------------------------------*/ diff --git a/engines/mads/nebular/nebular_scenes7.h b/engines/mads/nebular/nebular_scenes7.h index cc8220624d..c878149bfd 100644 --- a/engines/mads/nebular/nebular_scenes7.h +++ b/engines/mads/nebular/nebular_scenes7.h @@ -51,13 +51,17 @@ public: }; class Scene701: public Scene7xx { +private: + int _fishingLineId; + public: - Scene701(MADSEngine *vm) : Scene7xx(vm) {} + Scene701(MADSEngine *vm) : Scene7xx(vm), _fishingLineId(-1) {} virtual void setup(); virtual void enter(); virtual void preActions(); virtual void actions(); + virtual void step(); }; class Scene702: public Scene7xx { -- cgit v1.2.3 From f7b5c500649f531de66abf7a9700254fe5527511 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Thu, 15 May 2014 11:34:26 +0100 Subject: AGOS: Disable image_dump debug command. --- engines/agos/agos.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp index dab839b02b..6eda2eb9aa 100644 --- a/engines/agos/agos.cpp +++ b/engines/agos/agos.cpp @@ -149,8 +149,10 @@ AGOSEngine::AGOSEngine(OSystem *system, const AGOSGameDescription *gd) DebugMan.addDebugChannel(kDebugVGAOpcode, "vga_opcode", "VGA Opcode debug level"); DebugMan.addDebugChannel(kDebugSubroutine, "subroutine", "Subroutine debug level"); DebugMan.addDebugChannel(kDebugVGAScript, "vga_script", "VGA Script debug level"); + //Image dumping command disabled as it doesn't work well +#if 0 DebugMan.addDebugChannel(kDebugImageDump, "image_dump", "Enable dumping of images to files"); - +#endif _vcPtr = 0; _vcGetOutOfCode = 0; _gameOffsetsPtr = 0; -- cgit v1.2.3 From 230e7713217603de711cf098977daba108cb3087 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 15 May 2014 12:34:55 +0200 Subject: FULLPIPE: Implement MovGraph::doWalkTo() --- engines/fullpipe/gfx.cpp | 1 + engines/fullpipe/motion.cpp | 17 +++++++---------- engines/fullpipe/motion.h | 2 +- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp index b4eba44a64..520e81835b 100644 --- a/engines/fullpipe/gfx.cpp +++ b/engines/fullpipe/gfx.cpp @@ -398,6 +398,7 @@ bool GameObject::getPicAniInfo(PicAniInfo *info) { info->ox = _ox; info->oy = _oy; info->priority = _priority; + warning("Yep %d", _id); return true; } diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index b9fdc43286..b5e0f67a58 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -628,7 +628,6 @@ int MovGraph::method44() { } MessageQueue *MovGraph::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) { -#if 0 PicAniInfo picAniInfo; int ss; @@ -641,7 +640,7 @@ MessageQueue *MovGraph::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int int idx = getItemIndexByStaticAni(subj); for (uint i = 0; i < _items[idx]->count; i++) { - if (_items[idx]->items[i].movarr == goal) { + if ((*_items[idx]->items[i].movarr)[0] == goal) { if (subj->_movement) { Common::Point point; @@ -671,7 +670,7 @@ MessageQueue *MovGraph::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int if (_items[idx]->count > 0) { int arridx = 0; - while (_items[idx]->items[arridx].movarr != goal) { + while ((*_items[idx]->items[arridx].movarr)[0] != goal) { arridx++; if (arridx >= _items[idx]->count) { @@ -682,16 +681,16 @@ MessageQueue *MovGraph::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int _items[idx]->movarr->clear(); - for (uint i = 0; i < _items[idx]->items[arridx].movarr->_movStepCount; i++) { + for (uint i = 0; i < (*_items[idx]->items[arridx].movarr)[i]->_movStepCount; i++) { MovArr *m = new MovArr; - *m = *_items[idx]->items[arridx].movarr[i]; + *m = *(*_items[idx]->items[arridx].movarr)[i]; } _items[idx]->field_10 = -1; _items[idx]->field_14 = 0; - MessageQueue *mq = fillMGMinfo(_items[idx]->ani, _items[idx]->movarr, staticsId); + MessageQueue *mq = fillMGMinfo(_items[idx]->ani, (*_items[idx]->movarr)[0], staticsId); if (mq) { ExCommand *ex = new ExCommand(); ex->_messageKind = 17; @@ -708,10 +707,6 @@ MessageQueue *MovGraph::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int subj->setPicAniInfo(&picAniInfo); - return 0; -#endif - warning("STUB: MovGraph::doWalkTo()"); - return 0; } @@ -1517,6 +1512,8 @@ MessageQueue *MovGraph2::doWalkTo(StaticANIObject *obj, int xpos, int ypos, int obj->getPicAniInfo(&picAniInfo); + warning("p: %d %d", picAniInfo.movementId, picAniInfo.objectId); + int idxsub; if (obj->_movement) diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index 3ef62a75b3..1b49839e0d 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -315,7 +315,7 @@ struct MovArr { }; struct MovItem { - MovArr *movarr; + Common::Array *movarr; int _mfield_4; int _mfield_8; int _mfield_C; -- cgit v1.2.3 From c1663ab6cc6c0b898c8de6b2c30dee1ec596ad56 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 15 May 2014 12:35:08 -0400 Subject: MADS: Implemented sound player for scene group 3 --- engines/mads/nebular/sound_nebular.cpp | 424 ++++++++++++++++++++++++++++++++- engines/mads/nebular/sound_nebular.h | 72 +++++- engines/mads/sound.cpp | 3 + 3 files changed, 495 insertions(+), 4 deletions(-) diff --git a/engines/mads/nebular/sound_nebular.cpp b/engines/mads/nebular/sound_nebular.cpp index 56365987dc..53b6042124 100644 --- a/engines/mads/nebular/sound_nebular.cpp +++ b/engines/mads/nebular/sound_nebular.cpp @@ -32,6 +32,8 @@ namespace MADS { namespace Nebular { +bool AdlibChannel::_channelsEnabled; + AdlibChannel::AdlibChannel() { _activeCount = 0; _field1 = 0; @@ -58,6 +60,8 @@ AdlibChannel::AdlibChannel() { _field1D = 0; _field1E = 0; _field1F = 0; + + _field20 = 0; } void AdlibChannel::reset() { @@ -76,6 +80,8 @@ void AdlibChannel::enable(int flag) { // a simple null pointer _soundData = nullptr; } + + _channelsEnabled = true; } void AdlibChannel::setPtr2(byte *pData) { @@ -149,6 +155,7 @@ ASound::ASound(Audio::Mixer *mixer, const Common::String &filename, int dataOffs error("Could not open file - %s", filename.c_str()); // Initialise fields + _commandParam = 0; _activeChannelPtr = nullptr; _samplePtr = nullptr; _frameCounter = 0; @@ -178,6 +185,8 @@ ASound::ASound(Audio::Mixer *mixer, const Common::String &filename, int dataOffs _samplesPerCallback = getRate() / CALLBACKS_PER_SECOND; _samplesPerCallbackRemainder = getRate() % CALLBACKS_PER_SECOND; + AdlibChannel::_channelsEnabled = false; + // Store passed parameters, and setup OPL _dataOffset = dataOffset; _mixer = mixer; @@ -387,8 +396,10 @@ void ASound::pollChannels() { } void ASound::checkChannels() { - for (int i = 0; i < ADLIB_CHANNEL_COUNT; ++i) - _channels[i].check(_nullData); + if (AdlibChannel::_channelsEnabled) { + for (int i = 0; i < ADLIB_CHANNEL_COUNT; ++i) + _channels[i].check(_nullData); + } } void ASound::pollActiveChannel() { @@ -1236,6 +1247,11 @@ int ASound2::command(int commandId, int param) { return (this->*_commandList[commandId])(); } +int ASound2::command0() { + _command12Param = 0xFD; + return ASound::command0(); +} + int ASound2::command9() { byte *pData1 = loadData(0x1094, 376); if (!isSoundActive(pData1)) { @@ -1564,6 +1580,410 @@ int ASound2::command43() { return 0; } +/*-----------------------------------------------------------------------*/ + +const ASound3::CommandPtr ASound3::_commandList[61] = { + &ASound3::command0, &ASound3::command1, &ASound3::command2, &ASound3::command3, + &ASound3::command4, &ASound3::command5, &ASound3::command6, &ASound3::command7, + &ASound3::command8, &ASound3::command9, &ASound3::command10, &ASound3::command11, + &ASound3::nullCommand, &ASound3::command13, &ASound3::command14, &ASound3::command15, + &ASound3::command16, &ASound3::command17, &ASound3::command18, &ASound3::command19, + &ASound3::command20, &ASound3::command21, &ASound3::command22, &ASound3::command23, + &ASound3::command24, &ASound3::command25, &ASound3::command26, &ASound3::command27, + &ASound3::command28, &ASound3::command29, &ASound3::command30, &ASound3::command31, + &ASound3::command32, &ASound3::command33, &ASound3::command34, &ASound3::command35, + &ASound3::command36, &ASound3::command37, &ASound3::command38, &ASound3::command39, + &ASound3::command40, &ASound3::command41, &ASound3::command42, &ASound3::command43, + &ASound3::command44, &ASound3::command45, &ASound3::command46, &ASound3::command47, + &ASound3::nullCommand, &ASound3::command49, &ASound3::command50, &ASound3::command51, + &ASound3::nullCommand, &ASound3::nullCommand, &ASound3::nullCommand, &ASound3::nullCommand, + &ASound3::nullCommand, &ASound3::command57, &ASound3::nullCommand, &ASound3::command59, + &ASound3::command60 +}; + +ASound3::ASound3(Audio::Mixer *mixer) : ASound(mixer, "asound.003", 0x15B0) { + _command39Flag = false; + + // Load sound samples + _soundFile.seek(_dataOffset + 0x122); + for (int i = 0; i < 192; ++i) + _samples.push_back(AdlibSample(_soundFile)); +} + +int ASound3::command(int commandId, int param) { + if (commandId > 60) + return 0; + + _commandParam = param; + _frameCounter = 0; + return (this->*_commandList[commandId])(); +} + +int ASound3::command9() { + AdlibChannel::_channelsEnabled = _commandParam != 0; + + return 0; +} + +int ASound3::command10() { + byte *pData1 = loadData(0x13EA, 254); + if (!isSoundActive(pData1)) { + command1(); + _channels[0].load(pData1); + _channels[1].load(loadData(0X14E8, 452)); + _channels[2].load(loadData(0x16AC, 396)); + _channels[3].load(loadData(0x1838, 118)); + _channels[4].load(loadData(0x18AE, 74)); + } + + return 0; +} + +int ASound3::command11() { + byte *pData1 = loadData(0x2B84, 596); + if (!isSoundActive(pData1)) { + command1(); + _channels[0].load(pData1); + _channels[1].load(loadData(0x2DD8, 562)); + _channels[2].load(loadData(0x300A, 1694)); + _channels[3].load(loadData(0x36A8, 1100)); + _channels[4].load(loadData(0x3AF4, 420)); + _channels[5].load(loadData(0x3C98, 1516)); + } + + return 0; +} + +int ASound3::command13() { + byte *pData1 = loadData(0x4470, 64); + if (!isSoundActive(pData1)) { + command1(); + playSoundData(pData1); + playSound(0x44B0, 64); + playSound(0x44F0, 64); + playSound(0x4530, 64); + playSound(0x4570, 64); + playSound(0X45b0, 64); + } + + return 0; +} + +int ASound3::command14() { + byte *pData1 = loadData(0X45F0, 36); + if (!isSoundActive(pData1)) { + command1(); + playSoundData(pData1); + playSound(0x4614, 36); + playSound(0x4638, 36); + playSound(0x465C, 32); + playSound(0x467C, 76); + playSound(0x46C8, 74); + } + + return 0; +} + +int ASound3::command15() { + _channels[3].load(loadData(0x36A8, 1100)); + _channels[4].load(loadData(0x3AF4, 420)); + _channels[5].load(loadData(0x3C98, 1516)); + + _channels[3]._field20 = 0xDD; + _channels[4]._field20 = 0xDD; + _channels[5]._field20 = 0xDD; + + return 0; +} + +int ASound3::command16() { + byte *pData1 = loadData(0x4712, 398); + if (!isSoundActive(pData1)) { + command1(); + _channels[0].load(pData1); + _channels[1].load(loadData(0x48A0, 354)); + _channels[2].load(loadData(0x4A02, 410)); + _channels[3].load(loadData(0x4B9C, 392)); + } + + return 0; +} + +int ASound3::command17() { + byte *pData1 = loadData(0x18F8, 400); + if (!isSoundActive(pData1)) { + command1(); + _channels[0].load(pData1); + _channels[1].load(loadData(0x1A88, 680)); + _channels[2].load(loadData(0x1D30, 478)); + _channels[3].load(loadData(0x1F0E, 1146)); + _channels[4].load(loadData(0x2388, 1006)); + _channels[5].load(loadData(0x2776, 1038)); + } + + return 0; +} + +int ASound3::command18() { + byte *pData1 = loadData(0x4284, 142); + if (!isSoundActive(pData1)) { + command1(); + playSoundData(pData1); + playSound(0x4312, 172); + playSound(0x43BE, 88); + playSound(0x4416, 90); + } + + return 0; +} + +int ASound3::command19() { + playSound(0x4F6, 8); + + return 0; +} + +int ASound3::command20() { + playSound(0x4F1C, 10); + + return 0; +} + +int ASound3::command21() { + playSound(0x4F2E, 8); + + return 0; +} + +int ASound3::command22() { + playSound(0x4F36, 16); + + return 0; +} + +int ASound3::command23() { + playSound(0x4F50, 10); + playSound(0x4F46, 10); + + return 0; +} + +int ASound3::command24() { + // WORKAROUND: Original calls isSoundActive without loading data pointer + byte *pData = loadData(0x4EFC, 12); + if (!isSoundActive(pData)) { + int v; + while ((v = (getRandomNumber() & 0x3F)) > 45) + ; + + pData[6] = v + 19; + playSoundData(pData); + } + + return 0; +} + +int ASound3::command25() { + playSound(0x4EE6, 22); + + return 0; +} + +int ASound3::command26() { + playSound(0x4F5A, 8); + + return 0; +} + +int ASound3::command27() { + playSound(0x4DA2, 34); + playSound(0x4DC4, 20); + + return 0; +} + +int ASound3::command28() { + playSound(0x4F72, 10); + playSound(0x4F72, 10); + + return 0; +} + +int ASound3::command29() { + playSound(0x4F72, 10); + playSound(0x4F72, 10); + + return 0; +} + +int ASound3::command30() { + playSound(0x4E5A, 22); + playSound(0x4E70, 22); + playSound(0x4E86, 22); + + return 0; +} + +int ASound3::command31() { + playSound(0x4F7C, 40); + + return 0; +} + +int ASound3::command32() { + playSound(0x4ED2, 10); + + return 0; +} + +int ASound3::command33() { + playSound(0x4EC2, 16); + + return 0; +} + +int ASound3::command34() { + playSound(0x4EB2, 16); + + return 0; +} + +int ASound3::command35() { + playSound(0x4E9C, 22); + + return 0; +} + +int ASound3::command36() { + playSound(0x4D2C, 16); + + return 0; +} + +int ASound3::command37() { + playSound(0x4E1E, 20); + playSound(0x4E32, 30); + playSound(0x4E50, 10); + + return 0; +} + +int ASound3::command38() { + playSound(0x4FAC, 10); + + return 0; +} + +int ASound3::command39() { + _command39Flag = !_command39Flag; + if (_command39Flag) { + playSound(0x4FD0, 8); + } else { + playSound(0x4FD8, 8); + } + + return 0; +} + +int ASound3::command40() { + _command39Flag = !_command39Flag; + if (_command39Flag) { + playSound(0x4EE0, 8); + } else { + playSound(0x4EE8, 8); + } + + return 0; +} + +int ASound3::command41() { + playSound(0x4F08, 20); + + return 0; +} + +int ASound3::command42() { + playSound(0x4DD8, 28); + playSound(0x4DF4, 42); + + return 0; +} + +int ASound3::command43() { + playSound(0x4FB6, 12); + playSound(0x4FC2, 14); + + return 0; +} + +int ASound3::command44() { + playSound(0x4FFE, 14); + + return 0; +} + +int ASound3::command45() { + playSound(0x500C, 14); + + return 0; +} + +int ASound3::command46() { + playSound(0x4D78, 14); + playSound(0x4D86, 14); + playSound(0x4D94, 14); + + return 0; +} + +int ASound3::command47() { + playSound(0x4D62, 8); + playSound(0x4D6A, 14); + + return 0; +} + +int ASound3::command49() { + playSound(0x4D62, 8); + playSound(0x4D6A, 14); + + return 0; +} + +int ASound3::command50() { + playSound(0x4D3C, 14); + playSound(0x4D4A, 14); + playSound(0x4D58, 10); + + return 0; +} + +int ASound3::command51() { + playSound(0x4FF0, 14); + + return 0; +} + +int ASound3::command57() { + byte *pData = loadData(0x4EDC, 10); + pData[6] = (getRandomNumber() & 7) + 85; + playSoundData(pData); + + return 0; +} + +int ASound3::command59() { + playSound(0x4F62, 16); + + return 0; +} + +int ASound3::command60() { + playSound(0x4FA4, 8); + + return 0; +} + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/sound_nebular.h b/engines/mads/nebular/sound_nebular.h index 3c69c0c852..289c3b910c 100644 --- a/engines/mads/nebular/sound_nebular.h +++ b/engines/mads/nebular/sound_nebular.h @@ -67,6 +67,11 @@ public: int _field1D; int _field1E; int _field1F; + + // TODO: Only used by asound.003. Figure out usage + byte _field20; +public: + static bool _channelsEnabled; public: AdlibChannel(); @@ -180,6 +185,8 @@ private: void updateFNumber(); protected: + int _commandParam; + /** * Queue a byte for an Adlib register */ @@ -245,7 +252,7 @@ protected: */ int getRandomNumber(); - int command0(); + virtual int command0(); int command1(); int command2(); int command3(); @@ -361,7 +368,6 @@ private: typedef int (ASound1::*CommandPtr)(); static const CommandPtr _commandList[42]; bool _cmd23Toggle; - int _commandParam; int command9(); int command10(); @@ -412,6 +418,7 @@ private: typedef int (ASound2::*CommandPtr)(); static const CommandPtr _commandList[44]; + virtual int command0(); int command9(); int command10(); int command11(); @@ -456,6 +463,67 @@ public: virtual int command(int commandId, int param); }; +class ASound3 : public ASound { +private: + bool _command39Flag; + + typedef int (ASound3::*CommandPtr)(); + static const CommandPtr _commandList[61]; + + int command9(); + int command10(); + int command11(); + int command13(); + int command14(); + int command15(); + int command16(); + int command17(); + int command18(); + int command19(); + int command20(); + int command21(); + int command22(); + int command23(); + int command24(); + int command25(); + int command26(); + int command27(); + int command28(); + int command29(); + int command30(); + int command31(); + int command32(); + int command33(); + int command34(); + int command35(); + int command36(); + int command37(); + int command38(); + int command39(); + int command40(); + int command41(); + int command42(); + int command43(); + int command44(); + int command45(); + int command46(); + int command47(); + int command49(); + int command50(); + int command51(); + int command57(); + int command59(); + int command60(); + int nullCommand() { return 0; } + + void command9Randomize(); + void command9Apply(byte *data, int val, int incr); +public: + ASound3(Audio::Mixer *mixer); + + virtual int command(int commandId, int param); +}; + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/sound.cpp b/engines/mads/sound.cpp index 3dc53be124..72826ef3ac 100644 --- a/engines/mads/sound.cpp +++ b/engines/mads/sound.cpp @@ -55,6 +55,9 @@ void SoundManager::init(int sectionNumber) { case 2: _driver = new Nebular::ASound2(_mixer); break; + case 3: + _driver = new Nebular::ASound3(_mixer); + break; default: _driver = nullptr; break; -- cgit v1.2.3 From c05aaa029be1f396201cdcb2a999af3976ebd11a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 15 May 2014 15:06:35 -0400 Subject: MADS: Implemented sound player for scene group 4 --- engines/mads/nebular/sound_nebular.cpp | 260 +++++++++++++++++++++++++++++++++ engines/mads/nebular/sound_nebular.h | 40 +++++ engines/mads/sound.cpp | 3 + 3 files changed, 303 insertions(+) diff --git a/engines/mads/nebular/sound_nebular.cpp b/engines/mads/nebular/sound_nebular.cpp index 53b6042124..8b1a02e0b6 100644 --- a/engines/mads/nebular/sound_nebular.cpp +++ b/engines/mads/nebular/sound_nebular.cpp @@ -1984,6 +1984,266 @@ int ASound3::command60() { return 0; } +/*-----------------------------------------------------------------------*/ + +const ASound4::CommandPtr ASound4::_commandList[61] = { + &ASound4::command0, &ASound4::command1, &ASound4::command2, &ASound4::command3, + &ASound4::command4, &ASound4::command5, &ASound4::command6, &ASound4::command7, + &ASound4::command8, &ASound4::nullCommand, &ASound4::command10, &ASound4::nullCommand, + &ASound4::command12, &ASound4::nullCommand, &ASound4::nullCommand, &ASound4::nullCommand, + &ASound4::nullCommand, &ASound4::nullCommand, &ASound4::nullCommand, &ASound4::command19, + &ASound4::command20, &ASound4::command21, &ASound4::nullCommand, &ASound4::nullCommand, + &ASound4::command24, &ASound4::nullCommand, &ASound4::nullCommand, &ASound4::command27, + &ASound4::nullCommand, &ASound4::nullCommand, &ASound4::command30, &ASound4::nullCommand, + &ASound4::command32, &ASound4::command33, &ASound4::command34, &ASound4::command35, + &ASound4::command36, &ASound4::command37, &ASound4::command38, &ASound4::nullCommand, + &ASound4::nullCommand, &ASound4::nullCommand, &ASound4::nullCommand, &ASound4::command43, + &ASound4::nullCommand, &ASound4::nullCommand, &ASound4::nullCommand, &ASound4::nullCommand, + &ASound4::nullCommand, &ASound4::nullCommand, &ASound4::nullCommand, &ASound4::nullCommand, + &ASound4::nullCommand, &ASound4::nullCommand, &ASound4::nullCommand, &ASound4::nullCommand, + &ASound4::nullCommand, &ASound4::command57, &ASound4::nullCommand, &ASound4::command59, + &ASound4::command60 +}; + +ASound4::ASound4(Audio::Mixer *mixer) : ASound(mixer, "asound.004", 0x14F0) { + // Load sound samples + _soundFile.seek(_dataOffset + 0x122); + for (int i = 0; i < 210; ++i) + _samples.push_back(AdlibSample(_soundFile)); +} + +int ASound4::command(int commandId, int param) { + if (commandId > 60) + return 0; + + _commandParam = param; + _frameCounter = 0; + return (this->*_commandList[commandId])(); +} + +int ASound4::command10() { + byte *pData = loadData(0x22AA, 254); + if (!isSoundActive(pData)) { + command1(); + _channels[0].load(pData); + _channels[1].load(loadData(0x23A8, 452)); + _channels[2].load(loadData(0x256C, 396)); + _channels[3].load(loadData(0x26F8, 118)); + _channels[4].load(loadData(0x276E, 74)); + } + + return 0; +} + +int ASound4::command12() { + byte *pData = loadData(0x16A8, 550); + if (!isSoundActive(pData)) { + command1(); + _channels[0].load(pData); + _channels[1].load(loadData(0x18CE, 442)); + _channels[2].load(loadData(0x1A88, 298)); + _channels[3].load(loadData(0x1BB2, 354)); + _channels[4].load(loadData(0x1D14, 572)); + _channels[4].load(loadData(0x1F50, 560)); + } + + int v = (_commandParam > 0x40) ? _commandParam - 0x40 : 0; + v += 0xB5; + for (int channelNum = 0; channelNum < 6; ++channelNum) + _channels[channelNum]._field20 = v; + + return 0; +} + +int ASound4::command19() { + playSound(0x28EC, 8); + + return 0; +} + +int ASound4::command20() { + playSound(0x28E2, 10); + + return 0; +} + +int ASound4::command21() { + playSound(0x27C0, 8); + + return 0; +} + +int ASound4::command24() { + int v; + while ((v = (getRandomNumber() & 0x3F)) > 45) + ; + + byte *pData = loadData(0x28D6, 12); + pData[6] = v + 19; + playSoundData(pData); + + return 0; +} + +int ASound4::command27() { + playSound(0x27D8, 34); + playSound(0x27FA, 20); + + return 0; +} + +int ASound4::command30() { + playSound(0x284A, 22); + playSound(0x2860, 22); + playSound(0x2876, 22); + + return 0; +} + +int ASound4::command32() { + playSound(0x28C2, 10); + + return 0; +} + +int ASound4::command33() { + playSound(0x28B2, 16); + + return 0; +} + +int ASound4::command34() { + playSound(0x28A2, 16); + + return 0; +} + +int ASound4::command35() { + playSound(0x288C, 22); + + return 0; +} + +int ASound4::command36() { + playSound(0x27C8, 16); + + return 0; +} + +int ASound4::command37() { + playSound(0x280E, 20); + playSound(0x2822, 30); + playSound(0x2840, 10); + + return 0; +} + +int ASound4::command38() { + playSound(0x2904, 10); + + return 0; +} + +int ASound4::command43() { + playSound(0x290E, 12); + playSound(0x291A, 14); + + return 0; +} + +int ASound4::command52() { + byte *pData = loadData(0x23A8, 452); + if (_channels[1]._ptr1 == pData) { + pData = loadData(0x146E, 570); + if (!isSoundActive(pData)) { + _channels[0].load(pData); + _channels[1]._field20 = 0xD8; + _channels[2]._field20 = 0xD8; + } + } + + return 0; +} + +int ASound4::command53() { + method1(); + _channels[0]._field20 = 0; + + return 0; +} + +int ASound4::command54() { + method1(); + _channels[1]._field20 = 0; + _channels[2]._field20 = 0; + + return 0; +} + +int ASound4::command55() { + method1(); + _channels[3]._field20 = 0; + _channels[4]._field20 = 0; + + return 0; +} + +int ASound4::command56() { + method1(); + _channels[5]._field20 = 0; + + return 0; +} + +int ASound4::command57() { + int v = (getRandomNumber() & 7) + 85; + byte *pData = loadData(0x28CC, 10); + pData[6] = v; + playSoundData(pData); + + return 0; +} + +int ASound4::command58() { + byte *pData = loadData(0x146E, 570); + if (_channels[1]._ptr1 == pData) { + _channels[0].load(loadData(0x22AA, 254)); + _channels[1]._field20 = 0; + _channels[2]._field20 = 0; + } + + return 0; +} + +int ASound4::command59() { + playSound(0x28F4, 8); + + return 0; +} + +int ASound4::command60() { + playSound(0x28FC, 8); + + return 0; +} + +void ASound4::method1() { + byte *pData = loadData(0x2180, 58); + if (!isSoundActive(pData)) { + command1(); + + _channels[0].load(pData); + _channels[1].load(loadData(0x21BA, 48)); + _channels[2].load(loadData(0x21EA, 50)); + _channels[3].load(loadData(0x221C, 40)); + _channels[4].load(loadData(0x2244, 28)); + _channels[5].load(loadData(0x2260, 74)); + + for (int channel = 0; channel < 6; ++channel) + _channels[channel]._field20 = 0xB5; + } +} + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/sound_nebular.h b/engines/mads/nebular/sound_nebular.h index 289c3b910c..68c9fdf5b2 100644 --- a/engines/mads/nebular/sound_nebular.h +++ b/engines/mads/nebular/sound_nebular.h @@ -524,6 +524,46 @@ public: virtual int command(int commandId, int param); }; +class ASound4 : public ASound { +private: + typedef int (ASound4::*CommandPtr)(); + static const CommandPtr _commandList[61]; + + int command10(); + int command12(); + int command19(); + int command20(); + int command21(); + int command24(); + int command27(); + int command30(); + int command32(); + int command33(); + int command34(); + int command35(); + int command36(); + int command37(); + int command38(); + int command43(); + int command52(); + int command53(); + int command54(); + int command55(); + int command56(); + int command57(); + int command58(); + int command59(); + int command60(); + int nullCommand() { return 0; } + + void method1(); +public: + ASound4(Audio::Mixer *mixer); + + virtual int command(int commandId, int param); +}; + + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/sound.cpp b/engines/mads/sound.cpp index 72826ef3ac..adab5f7178 100644 --- a/engines/mads/sound.cpp +++ b/engines/mads/sound.cpp @@ -58,6 +58,9 @@ void SoundManager::init(int sectionNumber) { case 3: _driver = new Nebular::ASound3(_mixer); break; + case 4: + _driver = new Nebular::ASound4(_mixer); + break; default: _driver = nullptr; break; -- cgit v1.2.3 From 690efa51f53c74e3f3cfc402829a2714024a141e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 15 May 2014 22:12:50 +0200 Subject: MADS: Implement scene 703 --- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes7.cpp | 536 ++++++++++++++++++++++++++++++- engines/mads/nebular/nebular_scenes7.h | 32 ++ 3 files changed, 564 insertions(+), 6 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index df193262e0..fb7bb057c9 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -255,7 +255,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 702: // outside teleporter (after city is submerged) return new Scene702(vm); case 703: // water - return new DummyScene(vm); // TODO + return new Scene703(vm); case 704: // water, building in the distance return new DummyScene(vm); // TODO case 705: // water, outside building diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index 302c8ba28a..ec99f14413 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -126,7 +126,7 @@ void Scene701::enter() { _globals[kBoatStatus] = BOAT_TIED_FLOATING; else if (_game._difficulty == DIFFICULTY_HARD) _globals[kBoatStatus] = BOAT_ADRIFT; - else + else _globals[kBoatStatus] = BOAT_TIED; } @@ -382,7 +382,7 @@ void Scene702::actions() { case 1: _vm->_sound->command(0xF); if (_game._objects.isInInventory(OBJ_BONE)) - _game._objects.setRoom(OBJ_BONE, NOWHERE); + _game._objects.setRoom(OBJ_BONE, 1); _game._objects.addToInventory(OBJ_BONES); _vm->_dialogs->show(OBJ_BONES, 70218); break; @@ -423,6 +423,532 @@ void Scene702::actions() { /*------------------------------------------------------------------------*/ +void Scene703::setup() { + _game._player._spritesPrefix = ""; + setAAName(); +} + +void Scene703::handleBottleInterface() { + switch (_globals[kBottleStatus]) { + case 0: + _dialog1.write(0x311, true); + _dialog1.write(0x312, true); + _dialog1.write(0x313, true); + _dialog1.write(0x314, true); + _dialog1.write(0x315, true); + break; + + case 1: + _dialog1.write(0x311, false); + _dialog1.write(0x312, true); + _dialog1.write(0x313, true); + _dialog1.write(0x314, true); + _dialog1.write(0x315, true); + break; + + case 2: + _dialog1.write(0x311, false); + _dialog1.write(0x312, false); + _dialog1.write(0x313, true); + _dialog1.write(0x314, true); + _dialog1.write(0x315, true); + break; + + case 3: + _dialog1.write(0x311, false); + _dialog1.write(0x312, false); + _dialog1.write(0x313, false); + _dialog1.write(0x314, true); + _dialog1.write(0x315, true); + break; + + default: + break; + } +} + +void Scene703::setBottleSequence() { + _scene->_userInterface.setup(kInputBuildingSentences); + _game._player._stepEnabled = false; + if (_boatDir == 2) + _curSequence = 6; + else + _curSequence = 7; +} + +void Scene703::handleFillBottle(int quote) { + switch (quote) { + case 0x311: + _globals[kBottleStatus] = 1; + setBottleSequence(); + break; + + case 0x312: + _globals[kBottleStatus] = 2; + setBottleSequence(); + break; + + case 0x313: + _globals[kBottleStatus] = 3; + setBottleSequence(); + break; + + case 0x314: + _globals[kBottleStatus] = 4; + setBottleSequence(); + break; + + case 0x315: + _scene->_userInterface.setup(kInputBuildingSentences); + break; + + default: + break; + } +} + +void Scene703::enter() { + _game._player._visible = false; + + if (!_game._visitedScenes._sceneRevisited) { + if (_scene->_priorSceneId == 704) + _globals[kMonsterAlive] = false; + else + _globals[kMonsterAlive] = true; + } + + _startMonsterTimer = true; + _rexDeathFl = true; + _monsterTime = 0; + _restartTrigger70Fl = true; + _useBomb = false; + _boatFrame = -1; + + if (!_globals[kMonsterAlive]) + _scene->_hotspots.activate(0x468, false); + + if (_scene->_priorSceneId == 704) { + _game._player._stepEnabled = false; + _curSequence = 2; + _boatDir = 2; + _monsterMode = 0; + _scene->loadAnimation(formAnimName('A', -1), 0); + _scene->_activeAnimation->setCurrentFrame(34); + } else if (_scene->_priorSceneId != -2) { + _game._player._stepEnabled = false; + _boatDir = 1; + if (_globals[kMonsterAlive]) { + _monsterMode = 1; + _curSequence = 0; + _scene->loadAnimation(formAnimName('B', -1), 0); + } else { + _curSequence = 0; + _monsterMode = 0; + _scene->loadAnimation(formAnimName('A', -1), 0); + } + } else if (_globals[kMonsterAlive]) { + _curSequence = 0; + _boatDir = 1; + _monsterMode = 1; + _scene->loadAnimation(formAnimName('B', -1), 0); + _scene->_activeAnimation->setCurrentFrame(39); + } else if (_boatDir == 1) { + _curSequence = 0; + _monsterMode = 0; + _scene->loadAnimation(formAnimName('A', -1), 0); + _scene->_activeAnimation->setCurrentFrame(9); + } else if (_boatDir == 2) { + _curSequence = 0; + _monsterMode = 0; + _scene->loadAnimation(formAnimName('A', -1), 0); + _scene->_activeAnimation->setCurrentFrame(56); + } + + if (_scene->_roomChanged) { + _game._objects.addToInventory(OBJ_TWINKIFRUIT); + _game._objects.addToInventory(OBJ_BOMB); + _game._objects.addToInventory(OBJ_CHICKEN); + _game._objects.addToInventory(OBJ_BONES); + } + + _game.loadQuoteSet(0x311, 0x312, 0x313, 0x314, 0x315, 0); + _dialog1.setup(0x98, 0x311, 0x312, 0x313, 0x314, 0x315, 0); + sceneEntrySound(); + _vm->_sound->command(28); +} + +void Scene703::step() { + if (_startMonsterTimer) { + long diff = _scene->_frameStartTime - _lastFrameTime; + if ((diff >= 0) && (diff <= 12)) + _monsterTime += diff; + else + _monsterTime++; + + _lastFrameTime = _scene->_frameStartTime; + } + + if ((_monsterTime >= 2400) && !_rexDeathFl && !_useBomb) { + _startMonsterTimer = false; + _rexDeathFl = true; + _game._player._stepEnabled = false; + _scene->freeAnimation(); + _monsterMode = 3; + _scene->loadAnimation(formAnimName('D', -1), 0); + _rexDeathFl = false; + _monsterTime = 0; + } + + + if (_game._trigger == 70) + _scene->_reloadSceneFlag = true; + + if ((_monsterMode == 3) && (_scene->_activeAnimation != nullptr)) { + if (_scene->_activeAnimation->getCurrentFrame() != _boatFrame) { + _boatFrame = _scene->_activeAnimation->getCurrentFrame(); + int nextBoatFrame = -1; + + if (_boatFrame == 62) { + nextBoatFrame = 61; + if (_restartTrigger70Fl) { + _restartTrigger70Fl = false; + _scene->_sequences.addTimer(15, 70); + } + } + + if ((nextBoatFrame >= 0) && (nextBoatFrame != _scene->_activeAnimation->getCurrentFrame())) { + _scene->_activeAnimation->setCurrentFrame(nextBoatFrame); + _boatFrame = nextBoatFrame; + } + } + } + + if (_game._trigger == 70) + _scene->_reloadSceneFlag = true; + + if ((_monsterMode == 0) && (_scene->_activeAnimation != nullptr)) { + if (_scene->_activeAnimation->getCurrentFrame() != _boatFrame) { + _boatFrame = _scene->_activeAnimation->getCurrentFrame(); + int nextBoatFrame = -1; + + switch (_boatFrame) { + case 11: + if (_curSequence == 7) { + _curSequence = 0; + nextBoatFrame = 100; + } else if (_curSequence == 5) + nextBoatFrame = 82; + else if (_curSequence == 1) + nextBoatFrame = 11; + else { + nextBoatFrame = 9; + if (!_game._player._stepEnabled) + _game._player._stepEnabled = true; + } + break; + + case 34: + if (_curSequence != 2) + _scene->_nextSceneId = 704; + break; + + case 57: + if (_curSequence == 6) { + _curSequence = 0; + nextBoatFrame = 91; + } else if (_curSequence == 4) + nextBoatFrame = 73; + else if (_curSequence == 3) + nextBoatFrame = 57; + else { + nextBoatFrame = 56; + if (!_game._player._stepEnabled) + _game._player._stepEnabled = true; + } + break; + + case 73: + _scene->_nextSceneId = 701; + break; + + case 82: + nextBoatFrame = 11; + break; + + case 91: + nextBoatFrame = 57; + break; + + case 100: + nextBoatFrame = 56; + if (!_game._player._stepEnabled) { + _scene->_sequences.addTimer(30, 80); + _game._player._stepEnabled = true; + } + break; + + case 110: + nextBoatFrame = 9; + if (!_game._player._stepEnabled) { + _scene->_sequences.addTimer(30, 80); + _game._player._stepEnabled = true; + } + break; + + default: + break; + } + + if ((nextBoatFrame >= 0) && (nextBoatFrame != _scene->_activeAnimation->getCurrentFrame())) { + _scene->_activeAnimation->setCurrentFrame(nextBoatFrame); + _boatFrame = nextBoatFrame; + } + } + } + + if (_game._trigger == 80) { + switch (_globals[kBottleStatus]) { + case 0: + _vm->_dialogs->show(432); + break; + + case 1: + _vm->_dialogs->show(70324); + break; + + case 2: + _vm->_dialogs->show(70325); + break; + + case 3: + _vm->_dialogs->show(70326); + break; + + case 4: + _vm->_dialogs->show(70327); + break; + + default: + break; + } + } + + + if ((_monsterMode == 1) && (_scene->_activeAnimation != nullptr)) { + if (_scene->_activeAnimation->getCurrentFrame() != _boatFrame) { + _boatFrame = _scene->_activeAnimation->getCurrentFrame(); + int nextBoatFrame = -1; + + switch (_boatFrame) { + case 39: + _game._player._stepEnabled = true; + _startMonsterTimer = true; + _rexDeathFl = false; + break; + + case 40: + case 49: + case 54: + case 67: + case 78: + case 87: + case 96: + case 105: + case 114: + case 123: + if (_curSequence == 8) + nextBoatFrame = 129; + + break; + + case 129: + nextBoatFrame = 39; + break; + + case 151: + _scene->_nextSceneId = 701; + break; + + default: + break; + } + + if ((nextBoatFrame >= 0) && (nextBoatFrame != _scene->_activeAnimation->getCurrentFrame())) { + _scene->_activeAnimation->setCurrentFrame(nextBoatFrame); + _boatFrame = nextBoatFrame; + } + } + } + + if ((_monsterMode == 2) && (_scene->_activeAnimation != nullptr)) { + if (_scene->_activeAnimation->getCurrentFrame() != _boatFrame) { + _boatFrame = _scene->_activeAnimation->getCurrentFrame(); + int nextBoatFrame = -1; + + switch (_boatFrame) { + case 14: + if (!_useBomb) { + if (_game._difficulty == DIFFICULTY_HARD) + _game._objects.setRoom(OBJ_CHICKEN, 1); + else + _vm->_dialogs->show(70319); + } + nextBoatFrame = 80; + break; + + case 33: + if (_game._objects.isInInventory(OBJ_BONES)) { + _game._objects.setRoom(OBJ_BONES, 1); + _game._objects.addToInventory(OBJ_BONE); + } else + _game._objects.setRoom(OBJ_BONE, 1); + + nextBoatFrame = 80; + break; + + case 53: + _game._objects.setRoom(OBJ_TWINKIFRUIT, 1); + nextBoatFrame = 80; + _curSequence = 9; + break; + + case 80: + if (_game._difficulty == DIFFICULTY_HARD) { + _game._objects.setRoom(OBJ_BOMB, 1); + _vm->_dialogs->show(70318); + } else + _vm->_dialogs->show(70317); + + _scene->freeAnimation(); + _monsterMode = 1; + _scene->loadAnimation(formAnimName('B', -1)); + _scene->_activeAnimation->setCurrentFrame(39); + _game._player._stepEnabled = true; + break; + + case 91: + if (!_useBomb) { + _scene->freeAnimation(); + _monsterMode = 1; + _scene->loadAnimation(formAnimName('B', -1)); + _scene->_activeAnimation->setCurrentFrame(39); + _game._player._stepEnabled = true; + } else + _game._objects.setRoom(OBJ_CHICKEN_BOMB, 1); + + break; + + case 126: + _scene->_hotspots.activate(0x468, false); + _globals[kMonsterAlive] = false; + _scene->freeAnimation(); + _monsterMode = 0; + _scene->loadAnimation(formAnimName('A', -1)); + _scene->_activeAnimation->setCurrentFrame(9); + _game._player._stepEnabled = true; + if (_game._storyMode == STORYMODE_NAUGHTY) + _vm->_dialogs->show(70321); + else + _vm->_dialogs->show(70322); + + break; + + default: + break; + } + + if ((nextBoatFrame >= 0) && (nextBoatFrame != _scene->_activeAnimation->getCurrentFrame())) { + _scene->_activeAnimation->setCurrentFrame(nextBoatFrame); + _boatFrame = nextBoatFrame; + } + } + } +} + +void Scene703::actions() { + if (_game._screenObjects._inputMode == 1) + handleFillBottle(_action._activeAction._verbId); + else if (_action.isAction(0x3B1, 0x3B0)) { + _game._player._stepEnabled = false; + if (_globals[kMonsterAlive]) + _curSequence = 8; + else if (_boatDir == 1) + _curSequence = 5; + else + _curSequence = 3; + } else if (_action.isAction(0x3B1, 0x3B2)) { + _game._player._stepEnabled = false; + if (_globals[kMonsterAlive]) { + _startMonsterTimer = false; + _rexDeathFl = true; + _monsterTime = 0; + _scene->freeAnimation(); + _monsterMode = 3; + _scene->loadAnimation(formAnimName('D', -1)); + } else if (_boatDir == 2) + _curSequence = 4; + else + _curSequence = 1; + } else if (_action.isAction(VERB_THROW, 0x2C, 0x468) || _action.isAction(VERB_THROW, 0x2D, 0x468)) { + _game._player._stepEnabled = false; + _scene->freeAnimation(); + _monsterMode = 2; + _scene->loadAnimation(formAnimName('C', -1)); + _scene->_activeAnimation->setCurrentFrame(19); + } else if (_action.isAction(VERB_THROW, 0x49, 0x468)) { + _game._player._stepEnabled = false; + _scene->freeAnimation(); + _monsterMode = 2; + _scene->loadAnimation(formAnimName('C', -1)); + } else if (_action.isAction(VERB_THROW, 0x17A, 0x468)) { + _game._player._stepEnabled = false; + _scene->freeAnimation(); + _monsterMode = 2; + _scene->loadAnimation(formAnimName('C', -1)); + _scene->_activeAnimation->setCurrentFrame(39); + } else if (_action.isAction(VERB_THROW, 0x2A, 0x468)) { + _game._player._stepEnabled = false; + _scene->freeAnimation(); + _monsterMode = 2; + _scene->loadAnimation(formAnimName('C', -1)); + _scene->_activeAnimation->setCurrentFrame(59); + } else if (_action.isAction(VERB_THROW, 0x4A, 0x468)) { + _useBomb = true; + _game._player._stepEnabled = false; + _scene->freeAnimation(); + _monsterMode = 2; + _scene->loadAnimation(formAnimName('C', -1)); + } else if (_action.isAction(VERB_PUT, 0x2E, 0x18F) || _action.isAction(0x85, 0x2E, 0x18F)) { + if (_globals[kBottleStatus] != 4) { + handleBottleInterface(); + _dialog1.start(); + } else + _vm->_dialogs->show(70323); + } else if (_action._lookFlag || _action.isAction(VERB_LOOK, 0x468)) { + if (_globals[kMonsterAlive]) + _vm->_dialogs->show(70310); + } else if (_action.isAction(VERB_LOOK, 0x18F)) { + if (!_globals[kMonsterAlive]) + _vm->_dialogs->show(70311); + else + _vm->_dialogs->show(70312); + } else if (_action.isAction(VERB_LOOK, 0x3B2)) { + if (_globals[kMonsterAlive]) + _vm->_dialogs->show(70313); + else if (_game._visitedScenes.exists(710)) + _vm->_dialogs->show(70314); + else + _vm->_dialogs->show(70315); + } else if (_action.isAction(VERB_LOOK, 0x3B3)) + _vm->_dialogs->show(70316); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + void Scene707::setup() { _game._player._spritesPrefix = ""; // The original calls Scene7xx::setAAName() @@ -588,14 +1114,14 @@ void Scene752::enter() { if (_game._objects[OBJ_ID_CARD]._roomNumber == 752) { _globals._spriteIndexes[13] = _scene->_sprites.addSprites(formAnimName('i', -1)); - _globals._sequenceIndexes[13] = _scene->_sequences.startCycle(_globals._spriteIndexes[13], false, 1); + _globals._sequenceIndexes[13] = _scene->_sequences.startCycle(_globals._spriteIndexes[13], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 8); int idx = _scene->_dynamicHotspots.add(0xB3, VERB_WALKTO, _globals._sequenceIndexes[13], Common::Rect(0, 0, 0, 0)); _cardId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(234, 135), FACING_NORTH); } if (_game._globals[kLaserHoleIsThere]) { - _globals._sequenceIndexes[14] = _scene->_sequences.startCycle(_globals._spriteIndexes[14], false, 1); + _globals._sequenceIndexes[14] = _scene->_sequences.startCycle(_globals._spriteIndexes[14], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[14], 13); int idx = _scene->_dynamicHotspots.add(NOUN_LASER_BEAM, VERB_LOOK_AT, _globals._sequenceIndexes[14], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(215, 130), FACING_NORTHWEST); @@ -681,7 +1207,7 @@ void Scene752::actions() { case 1: _vm->_sound->command(0xF); if (_game._objects.isInInventory(OBJ_BONE)) - _game._objects.setRoom(OBJ_BONE, NOWHERE); + _game._objects.setRoom(OBJ_BONE, 1); _game._objects.addToInventory(OBJ_BONES); _vm->_dialogs->show(OBJ_BONES, 75221); break; diff --git a/engines/mads/nebular/nebular_scenes7.h b/engines/mads/nebular/nebular_scenes7.h index c878149bfd..049cc54bf4 100644 --- a/engines/mads/nebular/nebular_scenes7.h +++ b/engines/mads/nebular/nebular_scenes7.h @@ -74,6 +74,38 @@ public: virtual void actions(); }; +class Scene703: public Scene7xx{ +private: + int _monsterMode; + int _boatFrame; + int _curSequence; + int _boatDir; + + bool _useBomb; + bool _startMonsterTimer; + bool _rexDeathFl; + bool _restartTrigger70Fl; + + uint32 _lastFrameTime; + uint32 _monsterTime; + + Conversation _dialog1; + + void handleBottleInterface(); + void setBottleSequence(); + void handleFillBottle(int quote); + +public: + Scene703(MADSEngine *vm) : Scene7xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions(); + virtual void postActions() {}; +}; + class Scene707: public SceneTeleporter { public: Scene707(MADSEngine *vm) : SceneTeleporter(vm) {} -- cgit v1.2.3 From 84b38d8b390745da15bb0b9526209b60492df723 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 15 May 2014 19:53:12 -0400 Subject: MADS: Fix incorrect array indexes referencing outputIndexes --- engines/mads/nebular/sound_nebular.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/mads/nebular/sound_nebular.cpp b/engines/mads/nebular/sound_nebular.cpp index 8b1a02e0b6..a2a66a32ee 100644 --- a/engines/mads/nebular/sound_nebular.cpp +++ b/engines/mads/nebular/sound_nebular.cpp @@ -686,7 +686,7 @@ void ASound::updateChannelState() { } static const int outputIndexes[] = { - 3, 1, 4, 2, 5, 6, 9, 7, 10, 8, 11, 12, 15, 13, 16, 14, 17 + 0, 3, 1, 4, 2, 5, 6, 9, 7, 10, 8, 11, 12, 15, 13, 16, 14, 17 }; static const int outputChannels[] = { 0, 1, 2, 3, 4, 5, 8, 9, 10, 11, 12, 13, 16, 17, 18, 19, 20, 21, 0 @@ -704,7 +704,7 @@ static const int volumeList[] = { }; void ASound::updateActiveChannel() { - int reg = 0x40 + outputChannels[outputIndexes[_activeChannelNumber * 2]]; + int reg = 0x40 + outputChannels[outputIndexes[_activeChannelNumber * 2 + 1]]; int portVal = _ports[reg] & 0xFFC0; int newVolume = CLIP(_activeChannelPtr->_volume + _activeChannelPtr->_field1E, 0, 63); @@ -725,7 +725,7 @@ void ASound::loadSample(int sampleIndex) { _activeChannelReg = _activeChannelNumber; _samplePtr = &_samples[sampleIndex * 2]; - _v11 = outputChannels[outputIndexes[_activeChannelReg * 2 - 1]]; + _v11 = outputChannels[outputIndexes[_activeChannelReg * 2]]; processSample(); AdlibChannelData &cd = _channelData[_activeChannelNumber]; @@ -735,7 +735,7 @@ void ASound::loadSample(int sampleIndex) { cd._field0 = _samplePtr->_fieldE; _samplePtr = &_samples[sampleIndex * 2 + 1]; - _v11 = outputChannels[outputIndexes[_activeChannelReg * 2]]; + _v11 = outputChannels[outputIndexes[_activeChannelReg * 2 + 1]]; processSample(); } -- cgit v1.2.3 From d7086fc3a5a93c2162511ac25a4f3c46f8b041a4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 15 May 2014 19:54:51 -0400 Subject: MADS: Implemented sound player for scene group 5 --- engines/mads/nebular/sound_nebular.cpp | 245 +++++++++++++++++++++++++++++++++ engines/mads/nebular/sound_nebular.h | 46 +++++++ engines/mads/sound.cpp | 3 + 3 files changed, 294 insertions(+) diff --git a/engines/mads/nebular/sound_nebular.cpp b/engines/mads/nebular/sound_nebular.cpp index a2a66a32ee..13696d8994 100644 --- a/engines/mads/nebular/sound_nebular.cpp +++ b/engines/mads/nebular/sound_nebular.cpp @@ -2244,6 +2244,251 @@ void ASound4::method1() { } } + +/*-----------------------------------------------------------------------*/ + +const ASound5::CommandPtr ASound5::_commandList[42] = { + &ASound5::command0, &ASound5::command1, &ASound5::command2, &ASound5::command3, + &ASound5::command4, &ASound5::command5, &ASound5::command6, &ASound5::command7, + &ASound5::command8, &ASound5::command9, &ASound5::command10, &ASound5::command11, + &ASound5::command11, &ASound5::command13, &ASound5::command14, &ASound5::command15, + &ASound5::command16, &ASound5::command17, &ASound5::command18, &ASound5::command19, + &ASound5::command20, &ASound5::command21, &ASound5::command22, &ASound5::command23, + &ASound5::command11, &ASound5::command11, &ASound5::command26, &ASound5::command27, + &ASound5::command28, &ASound5::command29, &ASound5::command30, &ASound5::command31, + &ASound5::command32, &ASound5::command33, &ASound5::command34, &ASound5::command35, + &ASound5::command36, &ASound5::command37, &ASound5::command38, &ASound5::command39, + &ASound5::command40, &ASound5::command41 +}; + +ASound5::ASound5(Audio::Mixer *mixer) : ASound(mixer, "asound.002", 0x15E0) { + // Load sound samples + _soundFile.seek(_dataOffset + 0x144); + for (int i = 0; i < 164; ++i) + _samples.push_back(AdlibSample(_soundFile)); +} + +int ASound5::command(int commandId, int param) { + if (commandId > 41) + return 0; + + _frameCounter = 0; + return (this->*_commandList[commandId])(); +} + +int ASound5::command9() { + byte *pData = loadData(0x2114, 10); + pData[6] = (getRandomNumber() & 7) + 85; + playSoundData(pData); + + return 0; +} + +int ASound5::command10() { + playSound(0x211E, 10); + + return 0; +} + +int ASound5::command11() { + playSound(0x2016, 10); + + return 0; +} + +int ASound5::command13() { + playSound(0x2154, 10); + + return 0; +} + +int ASound5::command14() { + playSound(0x21DC, 22); + + return 0; +} + +int ASound5::command15() { + byte *pData = loadData(0x21DC, 22); + if (_channels[0]._ptr1 == pData) { + pData = loadData(0x1F2, 12); + _channels[0]._soundData = pData; + _channels[0]._field17 = 1; + _channels[0]._field19 = 1; + } + + return 0; +} + +int ASound5::command16() { + playSound(0x214C, 8); + + return 0; +} + +int ASound5::command17() { + playSound(0x2142, 10); + + return 0; +} + +int ASound5::command18() { + playSound(0x21A2, 22); + + return 0; +} + +int ASound5::command19() { + playSound(0x2190, 18); + + return 0; +} + +int ASound5::command20() { + playSound(0x2170, 16); + + return 0; +} + +int ASound5::command21() { + playSound(0x2180, 16); + + return 0; +} + +int ASound5::command22() { + playSound(0x2168, 8); + + return 0; +} + +int ASound5::command23() { + playSound(0x215E, 10); + + return 0; +} + +int ASound5::command26() { + playSound(0x21B8, 12); + + return 0; +} + +int ASound5::command27() { + playSound(0x21C4, 24); + + return 0; +} + +int ASound5::command28() { + playSound(0x2020, 34); + playSound(0x4904, 20); + + return 0; +} + +int ASound5::command29() { + byte *pData = loadData(0x17C, 312); + if (!isSoundActive(pData)) { + command1(); + _channels[0].load(pData); + _channels[1].load(loadData(0x1864, 304)); + _channels[2].load(loadData(0x1994, 222)); + _channels[3].load(loadData(0x1864, 304)); + _channels[4].load(loadData(0x1994, 222)); + } + + return 0; +} + +int ASound5::command30() { + playSound(0x2092, 22); + playSound(0x20A8, 22); + playSound(0x20BE, 22); + + return 0; +} + +int ASound5::command31() { + playSound(0x2128, 22); + playSound(0x2134, 14); + + return 0; +} + +int ASound5::command32() { + playSound(0x210A, 10); + + return 0; +} + +int ASound5::command33() { + playSound(0x20FA, 16); + + return 0; +} + +int ASound5::command34() { + playSound(0x20EA, 16); + + return 0; +} + +int ASound5::command35() { + playSound(0x20D4, 22); + + return 0; +} + +int ASound5::command36() { + playSound(0x2006, 16); + + return 0; +} + +int ASound5::command37() { + playSound(0x2056, 20); + playSound(0x206A, 30); + playSound(0x2088, 10); + + return 0; +} + +int ASound5::command38() { + byte *pData1 = loadData(0x14F2, 570); + if (_channels[3]._ptr1 == pData1) { + _channels[3].load(loadData(0x1A72, 522)); + _channels[3].load(loadData(0x1C7C, 874)); + } + + return 0; +} + +int ASound5::command39() { + playSound(0x1FEE, 8); + + return 0; +} + +int ASound5::command40() { + playSound(0x1FF6, 16); + + return 0; +} + +int ASound5::command41() { + byte *pData1 = loadData(0x14F2, 570); + if (!isSoundActive(pData1)) { + byte *pData2 = loadData(0x1A72, 522); + if (_channels[3]._ptr1 == pData2) { + _channels[3].load(pData1); + _channels[4].load(loadData(0x1FE6, 8)); + } + } + + return 0; +} + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/sound_nebular.h b/engines/mads/nebular/sound_nebular.h index 68c9fdf5b2..db6ca972d6 100644 --- a/engines/mads/nebular/sound_nebular.h +++ b/engines/mads/nebular/sound_nebular.h @@ -563,6 +563,52 @@ public: virtual int command(int commandId, int param); }; +class ASound5 : public ASound { +private: + typedef int (ASound5::*CommandPtr)(); + static const CommandPtr _commandList[42]; + + int command9(); + int command10(); + int command11(); + int command12(); + int command13(); + int command14(); + int command15(); + int command16(); + int command17(); + int command18(); + int command19(); + int command20(); + int command21(); + int command22(); + int command23(); + int command24(); + int command25(); + int command26(); + int command27(); + int command28(); + int command29(); + int command30(); + int command31(); + int command32(); + int command33(); + int command34(); + int command35(); + int command36(); + int command37(); + int command38(); + int command39(); + int command40(); + int command41(); + int command42(); + int command43(); +public: + ASound5(Audio::Mixer *mixer); + + virtual int command(int commandId, int param); +}; + } // End of namespace Nebular diff --git a/engines/mads/sound.cpp b/engines/mads/sound.cpp index adab5f7178..deaaba161f 100644 --- a/engines/mads/sound.cpp +++ b/engines/mads/sound.cpp @@ -61,6 +61,9 @@ void SoundManager::init(int sectionNumber) { case 4: _driver = new Nebular::ASound4(_mixer); break; + case 5: + _driver = new Nebular::ASound5(_mixer); + break; default: _driver = nullptr; break; -- cgit v1.2.3 From 80bac656ab0173c4f644a7ff961e8611a31e8430 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 16 May 2014 03:37:33 +0300 Subject: MADS: Add some nouns for the teleporter --- engines/mads/nebular/nebular_scenes.cpp | 8 ++++---- engines/mads/nebular/nebular_scenes.h | 20 ++++++++++++++++++++ engines/mads/nebular/nebular_scenes2.cpp | 28 ++++++++++++++-------------- 3 files changed, 38 insertions(+), 18 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index fb7bb057c9..3d26a41497 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -561,9 +561,9 @@ void SceneTeleporter::teleporterEnter() { bool SceneTeleporter::teleporterActions() { bool retVal = false; - static int _buttonList[12] = { 0x1D0, 0x1D1, 0x1D2, 0x1D3, 0x1D4, 0x1D5, 0x1D6, 0x1D7, 0x1D8, 0x1D9, 0x1DB, 0x1DA }; + static int _buttonList[12] = { NOUN_0_KEY, NOUN_1_KEY, NOUN_2_KEY, NOUN_3_KEY, NOUN_4_KEY, NOUN_5_KEY, NOUN_6_KEY, NOUN_7_KEY, NOUN_8_KEY, NOUN_9_KEY, NOUN_SMILE_KEY, NOUN_FROWN_KEY }; - if (_action.isAction(0x11A) || _action.isAction(VERB_PUSH)) { + if (_action.isAction(VERB_PRESS) || _action.isAction(VERB_PUSH)) { for (int i = 0; i < 12; i++) { if (_action._activeAction._objectNameId == _buttonList[i]) _buttonTyped = i; @@ -572,7 +572,7 @@ bool SceneTeleporter::teleporterActions() { retVal = true; } - if (_action.isAction(0x1CE, 0x1CF)) { + if (_action.isAction(VERB_EXIT_FROM, NOUN_DEVICE)) { _globals[kTeleporterCommand] = 3; _scene->_nextSceneId = _teleporterSceneId; retVal = true; @@ -595,7 +595,7 @@ void SceneTeleporter::teleporterStep() { } else { digit = 10; } - _buttonTyped = digit; + _buttonTyped = digit; _meteorologistCurPlace = place + 1; _game._trigger = -1; } diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index d02f6cbd51..dc35b11b80 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -52,6 +52,7 @@ enum Verb { VERB_LOOK_IN = 0x0D2, VERB_LOOK_THROUGH = 0x0D3, VERB_PEER_THROUGH = 0x103, + VERB_PRESS = 0x11A, VERB_READ = 0x11F, VERB_SHOOT = 0x13A, VERB_SIT_IN = 0x13F, @@ -59,6 +60,7 @@ enum Verb { VERB_WALK_THROUGH = 0x18B, VERB_WALK_TOWARDS = 0x18C, VERB_WALK_DOWN = 0x1AD, + VERB_EXIT_FROM = 0x1CE, VERB_CLIMB_INTO = 0x2F7, VERB_STEP_INTO = 0x2F9, VERB_WALK_ALONG = 0x312, @@ -76,8 +78,10 @@ enum Noun { NOUN_CHAIR = 0x47, NOUN_CHICKEN = 0x49, NOUN_CHICKEN_BOMB = 0x4A, + NOUN_CONTROL_PANEL = 0x59, NOUN_DEAD_FISH = 0x65, NOUN_DOOR = 0x6E, + NOUN_ENTER_KEY = 0x7A, NOUN_FISHING_LINE = 0x87, NOUN_FRONT_WINDOW = 0x8E, NOUN_FUZZY_DICE = 0x91, @@ -85,6 +89,7 @@ enum Noun { NOUN_HULL = 0x0A8, NOUN_ID_CARD = 0x0B3, NOUN_JUNGLE = 0x0B8, + NOUN_KEYPAD = 0x0C4, NOUN_LADDER = 0x0C7, NOUN_LIFE_SUPPORT_SECTION = 0x0CC, NOUN_LOG = 0x0D0, @@ -106,12 +111,27 @@ enum Noun { NOUN_TIMEBOMB = 0x171, NOUN_TWINKIFRUIT = 0x17A, NOUN_VIEW_SCREEN = 0x180, + NOUN_VIEWPORT = 0x181, NOUN_DEEP_PIT = 0x19E, NOUN_HUGE_LEGS = 0x1A8, NOUN_LEAF_COVERED_PIT = 0x1A9, NOUN_PILE_OF_LEAVES = 0x1AA, NOUN_STRANGE_DEVICE = 0x1B6, NOUN_CAPTIVE_CREATURE = 0x1C3, + NOUN_DISPLAY = 0x1CC, + NOUN_DEVICE = 0x1CF, + NOUN_0_KEY = 0x1D0, + NOUN_1_KEY = 0x1D1, + NOUN_2_KEY = 0x1D2, + NOUN_3_KEY = 0x1D3, + NOUN_4_KEY = 0x1D4, + NOUN_5_KEY = 0x1D5, + NOUN_6_KEY = 0x1D6, + NOUN_7_KEY = 0x1D7, + NOUN_8_KEY = 0x1D8, + NOUN_9_KEY = 0x1D9, + NOUN_FROWN_KEY = 0x1DA, + NOUN_SMILE_KEY = 0x1DB, NOUN_NATIVE_WOMAN = 0x1DC, NOUN_PLATFORM = 0x22C, NOUN_ALCOHOL = 0x310, diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index b38aaceec1..256bdad4b5 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -4861,7 +4861,7 @@ void Scene213::setup() { } void Scene213::enter() { - if (_globals[kMeteorologistWatch] != METEOROLOGIST_ABSENT) + if (_globals[kMeteorologistWatch] != METEOROLOGIST_NORMAL) _handSpriteId = _scene->_sprites.addSprites("*METHAND"); else if (_globals[kSexOfRex] == REX_MALE) _handSpriteId = _scene->_sprites.addSprites("*REXHAND"); @@ -4872,7 +4872,7 @@ void Scene213::enter() { // The original is calling Scene2xx::sceneEntrySound() if (_vm->_musicFlag) { - if (_globals[kMeteorologistWatch] == METEOROLOGIST_ABSENT) + if (_globals[kMeteorologistWatch] == METEOROLOGIST_NORMAL) _vm->_sound->command(1); else _vm->_sound->command(9); @@ -4890,23 +4890,23 @@ void Scene213::actions() { return; } - if (_action.isAction(VERB_LOOK, 0x59)) + if (_action.isAction(VERB_LOOK, NOUN_CONTROL_PANEL)) _vm->_dialogs->show(21301); - else if (_action.isAction(VERB_LOOK, 0xC4) || _action.isAction (0xB7, 0xC4)) + else if (_action.isAction(VERB_LOOK, NOUN_KEYPAD) || _action.isAction (VERB_INSPECT, NOUN_KEYPAD)) _vm->_dialogs->show(21302); - else if (_action.isAction(VERB_LOOK, 0x1CC)) + else if (_action.isAction(VERB_LOOK, NOUN_DISPLAY)) _vm->_dialogs->show(21303); - else if (_action.isAction(VERB_LOOK, 0x181) || _action.isAction(0x103, 0x181)) + else if (_action.isAction(VERB_LOOK, NOUN_VIEWPORT) || _action.isAction(VERB_PEER_THROUGH, NOUN_VIEWPORT)) _vm->_dialogs->show(21304); - else if (_action.isAction(VERB_LOOK, 0x1CF)) + else if (_action.isAction(VERB_LOOK, NOUN_DEVICE)) _vm->_dialogs->show(21305); - else if (_action.isAction(VERB_LOOK, 0x1D0) || _action.isAction(VERB_LOOK, 0x1D1) - || _action.isAction(VERB_LOOK, 0x1D2) || _action.isAction(VERB_LOOK, 0x1D3) - || _action.isAction(VERB_LOOK, 0x1D4) || _action.isAction(VERB_LOOK, 0x1D5) - || _action.isAction(VERB_LOOK, 0x1D6) || _action.isAction(VERB_LOOK, 0x1D7) - || _action.isAction(VERB_LOOK, 0x1D8) || _action.isAction(VERB_LOOK, 0x1D9) - || _action.isAction(VERB_LOOK, 0x1DB) || _action.isAction(VERB_LOOK, 0x7A) - || _action.isAction(VERB_LOOK, 0x1DA)) + else if (_action.isAction(VERB_LOOK, NOUN_0_KEY) || _action.isAction(VERB_LOOK, NOUN_1_KEY) + || _action.isAction(VERB_LOOK, NOUN_2_KEY) || _action.isAction(VERB_LOOK, NOUN_3_KEY) + || _action.isAction(VERB_LOOK, NOUN_4_KEY) || _action.isAction(VERB_LOOK, NOUN_5_KEY) + || _action.isAction(VERB_LOOK, NOUN_6_KEY) || _action.isAction(VERB_LOOK, NOUN_7_KEY) + || _action.isAction(VERB_LOOK, NOUN_8_KEY) || _action.isAction(VERB_LOOK, NOUN_9_KEY) + || _action.isAction(VERB_LOOK, NOUN_SMILE_KEY) || _action.isAction(VERB_LOOK, NOUN_FROWN_KEY) + || _action.isAction(VERB_LOOK, NOUN_ENTER_KEY)) _vm->_dialogs->show(21306); else return; -- cgit v1.2.3 From 655233bdfbb7412aa2070d3d9bd76b28e395c38e Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 16 May 2014 03:40:43 +0300 Subject: MADS: Fix bug when watching the meteorologist through the binoculars --- engines/mads/nebular/nebular_scenes.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 3d26a41497..8053818d4e 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -582,7 +582,10 @@ bool SceneTeleporter::teleporterActions() { } void SceneTeleporter::teleporterStep() { - if ((_globals[kMeteorologistWatch] != METEOROLOGIST_NORMAL) && (_game._trigger >= 230)) { + if (_globals[kMeteorologistWatch] == METEOROLOGIST_NORMAL) + return; + + if (_game._trigger >= 230) { int place = _game._trigger - 230; int digit; -- cgit v1.2.3 From 7028bc3b712ae5b198dd6d495cf2c90dd49eae43 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 15 May 2014 21:06:26 -0400 Subject: MADS: Implement sound player for scene group 6 --- engines/mads/nebular/sound_nebular.cpp | 154 +++++++++++++++++++++++++++++++++ engines/mads/nebular/sound_nebular.h | 32 ++++++- engines/mads/sound.cpp | 3 + 3 files changed, 187 insertions(+), 2 deletions(-) diff --git a/engines/mads/nebular/sound_nebular.cpp b/engines/mads/nebular/sound_nebular.cpp index 13696d8994..b839caddf5 100644 --- a/engines/mads/nebular/sound_nebular.cpp +++ b/engines/mads/nebular/sound_nebular.cpp @@ -2489,6 +2489,160 @@ int ASound5::command41() { return 0; } +/*-----------------------------------------------------------------------*/ + +const ASound6::CommandPtr ASound6::_commandList[30] = { + &ASound6::command0, &ASound6::command1, &ASound6::command2, &ASound6::command3, + &ASound6::command4, &ASound6::command5, &ASound6::command6, &ASound6::command7, + &ASound6::command8, &ASound6::command9, &ASound6::command10, &ASound6::command11, + &ASound6::command11, &ASound6::command13, &ASound6::command14, &ASound6::command15, + &ASound6::command16, &ASound6::command17, &ASound6::command18, &ASound6::command19, + &ASound6::command20, &ASound6::command21, &ASound6::command22, &ASound6::command23, + &ASound6::command11, &ASound6::command11, &ASound6::nullCommand, &ASound6::nullCommand, + &ASound6::nullCommand, &ASound6::command29 +}; + +ASound6::ASound6(Audio::Mixer *mixer) : ASound(mixer, "asound.006", 0x1390) { + // Load sound samples + _soundFile.seek(_dataOffset + 0x122); + for (int i = 0; i < 200; ++i) + _samples.push_back(AdlibSample(_soundFile)); +} + +int ASound6::command(int commandId, int param) { + if (commandId > 29) + return 0; + + _frameCounter = 0; + return (this->*_commandList[commandId])(); +} + +int ASound6::command9() { + byte *pData = loadData(0x2194, 10); + pData[6] = (getRandomNumber() & 7) + 85; + playSoundData(pData); + + return 0; +} + +int ASound6::command10() { + playSound(0x2224, 24); + + return 0; +} + +int ASound6::command11() { + playSound(0x2202, 34); + + return 0; +} + +int ASound6::command12() { + playSound(0x2246, 8); + + return 0; +} + +int ASound6::command13() { + playSound(0x2298, 28); + + return 0; +} + +int ASound6::command14() { + playSound(0x22B4, 27); + + return 0; +} + +int ASound6::command15() { + playSound(0x219E, 12); + + return 0; +} + +int ASound6::command16() { + playSound(0x21AA, 22); + playSound(0x21C0, 12); + + return 0; +} + +int ASound6::command17() { + playSound(0x21CC, 54); + + return 0; +} + +int ASound6::command18() { + playSound(0x2270, 16); + + return 0; +} + +int ASound6::command19() { + playSound(0x2280, 16); + + return 0; +} + +int ASound6::command20() { + playSound(0x223C, 10); + + return 0; +} + +int ASound6::command21() { + playSound(0x224E, 34); + + return 0; +} + +int ASound6::command22() { + playSound(0x2290, 8); + + return 0; +} + +int ASound6::command23() { + playSound(0x215E, 34); + playSound(0x2180, 20); + + return 0; +} + +int ASound6::command24() { + byte *pData1 = loadData(0x1D54, 540); + if (!isSoundActive(pData1)) { + command1(); + _channels[0].load(pData1); + _channels[1].load(loadData(0x1F70, 52)); + _channels[2].load(loadData(0x1FA4, 430)); + } + + return 0; +} + +int ASound6::command25() { + playSound(0x2152, 12); + + return 0; +} + +int ASound6::command29() { + byte *pData1 = loadData(0x149A, 312); + if (!isSoundActive(pData1)) { + command1(); + _channels[0].load(pData1); + _channels[1].load(loadData(0x15D2, 304)); + _channels[2].load(loadData(0x1702, 222)); + _channels[3].load(loadData(0x17E0, 522)); + _channels[4].load(loadData(0x19EA, 874)); + } + + return 0; +} + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/sound_nebular.h b/engines/mads/nebular/sound_nebular.h index db6ca972d6..771aac4b0e 100644 --- a/engines/mads/nebular/sound_nebular.h +++ b/engines/mads/nebular/sound_nebular.h @@ -261,6 +261,8 @@ protected: int command6(); int command7(); int command8(); + + int nullCommand() { return 0; } public: Audio::Mixer *_mixer; FM_OPL *_opl; @@ -514,7 +516,6 @@ private: int command57(); int command59(); int command60(); - int nullCommand() { return 0; } void command9Randomize(); void command9Apply(byte *data, int val, int incr); @@ -554,7 +555,6 @@ private: int command58(); int command59(); int command60(); - int nullCommand() { return 0; } void method1(); public: @@ -609,6 +609,34 @@ public: virtual int command(int commandId, int param); }; +class ASound6 : public ASound { +private: + typedef int (ASound6::*CommandPtr)(); + static const CommandPtr _commandList[30]; + + int command9(); + int command10(); + int command11(); + int command12(); + int command13(); + int command14(); + int command15(); + int command16(); + int command17(); + int command18(); + int command19(); + int command20(); + int command21(); + int command22(); + int command23(); + int command24(); + int command25(); + int command29(); +public: + ASound6(Audio::Mixer *mixer); + + virtual int command(int commandId, int param); +}; } // End of namespace Nebular diff --git a/engines/mads/sound.cpp b/engines/mads/sound.cpp index deaaba161f..79a2b4ee5f 100644 --- a/engines/mads/sound.cpp +++ b/engines/mads/sound.cpp @@ -64,6 +64,9 @@ void SoundManager::init(int sectionNumber) { case 5: _driver = new Nebular::ASound5(_mixer); break; + case 6: + _driver = new Nebular::ASound6(_mixer); + break; default: _driver = nullptr; break; -- cgit v1.2.3 From 82064df60a730f792e978db7c29e7280d1604cff Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 16 May 2014 05:03:30 +0300 Subject: MADS: Bugfix for sequence triggers Fixes a lot of broken sequences --- engines/mads/sequence.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/sequence.h b/engines/mads/sequence.h index bb084cc0f1..b23f595e74 100644 --- a/engines/mads/sequence.h +++ b/engines/mads/sequence.h @@ -46,7 +46,7 @@ struct SequenceSubEntries { int _count; SequenceTrigger _mode[SEQUENCE_ENTRY_SUBSET_MAX]; int _frameIndex[SEQUENCE_ENTRY_SUBSET_MAX]; - int8 _trigger[SEQUENCE_ENTRY_SUBSET_MAX]; + int _trigger[SEQUENCE_ENTRY_SUBSET_MAX]; }; struct SequenceEntry { -- cgit v1.2.3 From 41c93dc0b5861df729b7da7ea41225e51811a0a5 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 16 May 2014 05:03:56 +0300 Subject: MADS: Check if a rect is sane before attempting to create it --- engines/mads/screen.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index 09f87f3f8b..6a70bfb5d9 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -206,6 +206,10 @@ void DirtyAreas::copy(MSurface *srcSurface, MSurface *destSurface, const Common: for (uint i = 0; i < size(); ++i) { const Common::Rect &srcBounds = (*this)[i]._bounds; + // Check if this is a sane rectangle before attempting to create it + if (srcBounds.left >= srcBounds.right || srcBounds.top >= srcBounds.bottom) + continue; + Common::Rect bounds(srcBounds.left + posAdjust.x, srcBounds.top + posAdjust.y, srcBounds.right + posAdjust.x, srcBounds.bottom + posAdjust.y); @@ -219,6 +223,10 @@ void DirtyAreas::copyToScreen(const Common::Point &posAdjust) { for (uint i = 0; i < size(); ++i) { const Common::Rect &srcBounds = (*this)[i]._bounds; + // Check if this is a sane rectangle before attempting to create it + if (srcBounds.left >= srcBounds.right || srcBounds.top >= srcBounds.bottom) + continue; + Common::Rect bounds(srcBounds.left + posAdjust.x, srcBounds.top + posAdjust.y, srcBounds.right + posAdjust.x, srcBounds.bottom + posAdjust.y); -- cgit v1.2.3 From e776a76241b9c0ba46c268cccf1b04610f86a715 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 15 May 2014 22:13:02 -0400 Subject: MADS: Implemented sound player for scene group 7 --- engines/mads/nebular/sound_nebular.cpp | 206 +++++++++++++++++++++++++++++++++ engines/mads/nebular/sound_nebular.h | 32 +++++ engines/mads/sound.cpp | 3 + 3 files changed, 241 insertions(+) diff --git a/engines/mads/nebular/sound_nebular.cpp b/engines/mads/nebular/sound_nebular.cpp index b839caddf5..997ea18405 100644 --- a/engines/mads/nebular/sound_nebular.cpp +++ b/engines/mads/nebular/sound_nebular.cpp @@ -2643,6 +2643,212 @@ int ASound6::command29() { return 0; } +/*-----------------------------------------------------------------------*/ + +const ASound7::CommandPtr ASound7::_commandList[38] = { + &ASound7::command0, &ASound7::command1, &ASound7::command2, &ASound7::command3, + &ASound7::command4, &ASound7::command5, &ASound7::command6, &ASound7::command7, + &ASound7::command8, &ASound7::command9, &ASound7::nullCommand, &ASound7::nullCommand, + &ASound7::nullCommand, &ASound7::nullCommand, &ASound7::nullCommand, &ASound7::command15, + &ASound7::command16, &ASound7::command16, &ASound7::command18, &ASound7::command19, + &ASound7::command20, &ASound7::command21, &ASound7::command22, &ASound7::command23, + &ASound7::command24, &ASound7::command25, &ASound7::command26, &ASound7::command27, + &ASound7::command28, &ASound7::nullCommand, &ASound7::command30, &ASound7::nullCommand, + &ASound7::command32, &ASound7::command33, &ASound7::command34, &ASound7::command35, + &ASound7::command36, &ASound7::command37 +}; + +ASound7::ASound7(Audio::Mixer *mixer) : ASound(mixer, "asound.007", 0x1460) { + // Load sound samples + _soundFile.seek(_dataOffset + 0x122); + for (int i = 0; i < 214; ++i) + _samples.push_back(AdlibSample(_soundFile)); +} + +int ASound7::command(int commandId, int param) { + if (commandId > 38) + return 0; + + _frameCounter = 0; + return (this->*_commandList[commandId])(); +} + +int ASound7::command9() { + byte *pData1 = loadData(0x2992, 122); + if (!isSoundActive(pData1)) { + _channels[0].load(pData1); + _channels[1].load(loadData(0x2A0C, 76)); + _channels[2].load(loadData(0x2A58, 122)); + _channels[3].load(loadData(0x2AD2, 38)); + } + + return 0; +} + +int ASound7::command15() { + byte *pData = loadData(0x2B3E, 10); + pData[6] = (getRandomNumber() & 7) + 85; + + return 0; +} + +int ASound7::command16() { + playSound(0x2CE2, 8); + + return 0; +} + +int ASound7::command18() { + playSound(0x2C94, 22); + + return 0; +} + +int ASound7::command19() { + byte *pData1 = loadData(0x2C94, 22); + byte *pData2 = loadData(0x2CAA, 16); + if (_channels[8]._ptr1 == pData1 || _channels[8]._ptr1 == pData2) { + _channels[8]._soundData = loadData(0x2CBA, 12); + _channels[8]._field17 = 1; + _channels[8]._field19 = 1; + } + + return 0; +} + +int ASound7::command20() { + playSound(0x2CD0, 18); + + return 0; +} + +int ASound7::command21() { + playSound(0x2CC6, 10); + + return 0; +} + +int ASound7::command22() { + playSound(0x2C08, 140); + + return 0; +} + +int ASound7::command23() { + playSound(0x2B08, 34); + playSound(0x2B2A, 20); + + return 0; +} + +int ASound7::command24() { + byte *pData1 = loadData(0x14C6, 144); + if (!isSoundActive(pData1)) { + command1(); + _channels[0].load(pData1); + _channels[1].load(loadData(0x1556, 146)); + _channels[2].load(loadData(0x15E8, 138)); + _channels[3].load(loadData(0x1672, 122)); + _channels[4].load(loadData(0x16EC, 74)); + } + + return 0; +} + +int ASound7::command25() { + byte *pData1 = loadData(0x1DBE, 182); + if (!isSoundActive(pData1)) { + command1(); + _channels[0].load(pData1); + _channels[1].load(loadData(0x1E74, 182)); + _channels[2].load(loadData(0x1F2A, 186)); + _channels[3].load(loadData(0x1FE4, 244)); + } + + return 0; +} + +int ASound7::command26() { + byte *pData1 = loadData(0x20D8, 312); + if (!isSoundActive(pData1)) { + command1(); + _channels[0].load(pData1); + _channels[1].load(loadData(0x2210, 304)); + _channels[2].load(loadData(0x2340, 222)); + _channels[3].load(loadData(0x241E, 522)); + _channels[4].load(loadData(0x2628, 874)); + } + + return 0; +} + +int ASound7::command27() { + byte *pData1 = loadData(0x1736, 158); + if (!isSoundActive(pData1)) { + command1(); + _channels[0].load(pData1); + _channels[1].load(loadData(0x17D4, 288)); + _channels[2].load(loadData(0x18F4, 290)); + _channels[3].load(loadData(0x1A16, 396)); + _channels[4].load(loadData(0x1BA2, 380)); + _channels[5].load(loadData(0x1D1E, 160)); + } + + return 0; +} + +int ASound7::command28() { + playSound(0x2CAA, 16); + + return 0; +} + +int ASound7::command30() { + playSound(0x2B86, 22); + playSound(0x2B9C, 22); + playSound(0x2BB2, 22); + + return 0; +} + +int ASound7::command32() { + playSound(0x2BFE, 10); + + return 0; +} + +int ASound7::command33() { + playSound(0x2BEE, 16); + + return 0; +} + +int ASound7::command34() { + playSound(0x2BDE, 16); + + return 0; +} + +int ASound7::command35() { + playSound(0x2BC8, 22); + + return 0; +} + +int ASound7::command36() { + playSound(0x2AF8, 16); + + return 0; +} + +int ASound7::command37() { + playSound(0x2B48, 20); + playSound(0x2B5C, 32); + playSound(0x2B7C, 10); + + return 0; +} + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/sound_nebular.h b/engines/mads/nebular/sound_nebular.h index 771aac4b0e..997f6bbffb 100644 --- a/engines/mads/nebular/sound_nebular.h +++ b/engines/mads/nebular/sound_nebular.h @@ -638,6 +638,38 @@ public: virtual int command(int commandId, int param); }; +class ASound7 : public ASound { +private: + typedef int (ASound7::*CommandPtr)(); + static const CommandPtr _commandList[38]; + + int command9(); + int command15(); + int command16(); + int command18(); + int command19(); + int command20(); + int command21(); + int command22(); + int command23(); + int command24(); + int command25(); + int command26(); + int command27(); + int command28(); + int command30(); + int command32(); + int command33(); + int command34(); + int command35(); + int command36(); + int command37(); +public: + ASound7(Audio::Mixer *mixer); + + virtual int command(int commandId, int param); +}; + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/sound.cpp b/engines/mads/sound.cpp index 79a2b4ee5f..b6563ce792 100644 --- a/engines/mads/sound.cpp +++ b/engines/mads/sound.cpp @@ -67,6 +67,9 @@ void SoundManager::init(int sectionNumber) { case 6: _driver = new Nebular::ASound6(_mixer); break; + case 7: + _driver = new Nebular::ASound1(_mixer); + break; default: _driver = nullptr; break; -- cgit v1.2.3 From c151132b121787083faf234469716772008b36ff Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 16 May 2014 05:27:34 +0300 Subject: MADS: Bugfixes for shooting down the monkey --- engines/mads/nebular/nebular_scenes2.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 256bdad4b5..fedbff3198 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -3017,7 +3017,7 @@ void Scene209::step() { _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 7); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(116, 131)); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 228); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 229); break; case 229: { @@ -3295,8 +3295,8 @@ void Scene209::actions() { } if (_globals[kMonkeyStatus] == MONKEY_HAS_BINOCULARS) { - if ((_action.isAction(VERB_SHOOT) || _action.isAction(VERB_HOSE_DOWN)) && _action.isAction(NOUN_MONKEY) - && _action.isAction(NOUN_BLOWGUN) && _game._objects.isInInventory(OBJ_BLOWGUN) && _game._objects.isInInventory(OBJ_POISON_DARTS)) { + if ((_action.isAction(VERB_SHOOT) || _action.isAction(VERB_HOSE_DOWN)) && _action.isTarget(NOUN_MONKEY) + && _action.isObject(NOUN_BLOWGUN) && _game._objects.isInInventory(OBJ_BLOWGUN) && _game._objects.isInInventory(OBJ_POISON_DARTS)) { if (_action.isAction(VERB_SHOOT, NOUN_BLOWGUN, NOUN_MONKEY) && !_startShootingInTimerFl) { _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _scene->_sequences.addTimer(1, 231); -- cgit v1.2.3 From f9fe18c5063611f6e7ec727157efb5a34e69bd56 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 16 May 2014 06:25:00 +0300 Subject: MADS: Bugfixes and cleanup for scene 202 --- engines/mads/nebular/nebular_scenes.h | 3 + engines/mads/nebular/nebular_scenes2.cpp | 430 +++++++++++++++---------------- 2 files changed, 214 insertions(+), 219 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index dc35b11b80..61cbd44e78 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -40,6 +40,7 @@ enum { enum Verb { VERB_CLIMB_DOWN = 0x04E, + VERB_CLIMB_UP = 0x050, VERB_EAT = 0x075, VERB_EXAMINE = 0x07D, VERB_HOSE_DOWN = 0x0A6, @@ -57,6 +58,7 @@ enum Verb { VERB_SHOOT = 0x13A, VERB_SIT_IN = 0x13F, VERB_SMELL = 0x147, + VERB_WALK_INSIDE = 0x188, VERB_WALK_THROUGH = 0x18B, VERB_WALK_TOWARDS = 0x18C, VERB_WALK_DOWN = 0x1AD, @@ -101,6 +103,7 @@ enum Noun { NOUN_REFRIDGERATOR = 0x122, NOUN_ROBO_KITCHEN = 0x127, NOUN_ROCK = 0x128, + NOUN_ROCKS = 0x129, NOUN_SHIELD_ACCESS_PANEL = 0x135, NOUN_SHIELD_MODULATOR = 0x137, NOUN_SKULL = 0x140, diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index fedbff3198..8830a1b507 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -181,7 +181,7 @@ void Scene201::enter() { _scene->loadAnimation(formAnimName(sepChar, suffixNum), abortTimers); } - if ((_scene->_priorSceneId == 202) && (_globals[kMeteorologistStatus] == 1) && !_scene->_roomChanged) { + if ((_scene->_priorSceneId == 202) && (_globals[kMeteorologistStatus] == METEOROLOGIST_PRESENT) && !_scene->_roomChanged) { _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('a', 0)); _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('a', 1)); _game.loadQuoteSet(90, 91, 0); @@ -199,7 +199,7 @@ void Scene201::enter() { _pterodactylFlag = true; if (_globals[kTeleporterUnderstood]) - _scene->_hotspots.activate(438, false); + _scene->_hotspots.activate(NOUN_STRANGE_DEVICE, false); sceneEntrySound(); } @@ -282,11 +282,11 @@ void Scene201::actions() { if (_action._lookFlag == false) { if (_action.isAction(VERB_WALK_TOWARDS, 0x83)) _scene->_nextSceneId = 202; - else if ((_action.isAction(0x50, 0x156)) || (_action.isAction(0x188, 0x16C)) || (_action.isAction(0x188, 0x1B6))) { + else if ((_action.isAction(VERB_CLIMB_UP, 0x156)) || (_action.isAction(VERB_WALK_INSIDE, NOUN_TELEPORTER)) || (_action.isAction(VERB_WALK_INSIDE, NOUN_STRANGE_DEVICE))) { if (_game._trigger == 0) { _game._player._stepEnabled = false; _game._player._visible = false; - int sepChar = (_globals[kSexOfRex] == SEX_UNKNOWN) ? 't' : 'u'; + int sepChar = (_globals[kSexOfRex] == SEX_MALE) ? 't' : 'u'; _scene->loadAnimation(formAnimName(sepChar, 0), 1); } else if (_game._trigger == 1) { _scene->_nextSceneId = 213; @@ -319,7 +319,7 @@ void Scene201::actions() { } else return; } else { - _vm->_dialogs->show(0x4E8F); + _vm->_dialogs->show(20111); } _action._inProgress = false; } @@ -536,7 +536,7 @@ void Scene202::step() { } break; case 93: { - _globals[kLadderBroken] = -1; + _globals[kLadderBroken] = false; _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 6, 0, 0, 0); _scene->_hotspots.activate(NOUN_LADDER, false); int idx = _scene->_dynamicHotspots.add(NOUN_BROKEN_LADDER, VERB_WALKTO, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); @@ -743,241 +743,233 @@ void Scene202::preActions() { } void Scene202::actions() { - if (_action._lookFlag == false) { - if (_action.isAction(0x4E, NOUN_LADDER)) { - _action._inProgress = false; - return; - } else if (_action.isAction(VERB_WALK_TOWARDS, 0x83)) { - _scene->_nextSceneId = 203; - } else if (_action.isAction(VERB_WALK_TOWARDS, 0x82)) { - if (_globals[kMeteorologistStatus] != 2) { - if (_scene->_activeAnimation) - _globals[kMeteorologistStatus] = 1; - else - _globals[kMeteorologistStatus] = 0; + if (_action._lookFlag) { + _vm->_dialogs->show(20219); + return; + } + + if (_action.isAction(VERB_CLIMB_DOWN, NOUN_LADDER)) { + _action._inProgress = false; + return; + } else if (_action.isAction(VERB_WALK_TOWARDS, 0x83)) { + _scene->_nextSceneId = 203; + } else if (_action.isAction(VERB_WALK_TOWARDS, 0x82)) { + if (_globals[kMeteorologistStatus] != METEOROLOGIST_GONE) { + if (_scene->_activeAnimation) + _globals[kMeteorologistStatus] = METEOROLOGIST_PRESENT; + else + _globals[kMeteorologistStatus] = METEOROLOGIST_ABSENT; + } + _scene->_nextSceneId = 201; + } else if (_action.isAction(VERB_TAKE, NOUN_BONE) && _action._mainObjectSource == 4) { + switch (_game._trigger) { + case 0: + if (_game._objects.isInInventory(OBJ_BONES)) { + _vm->_dialogs->show(20221); + } else { + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[7] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[7], false, 3, 2, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[7]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SEQUENCE_TRIGGER_SPRITE, 6, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SEQUENCE_TRIGGER_EXPIRE, 0, 2); } - _scene->_nextSceneId = 201; - } else if (_action.isAction(VERB_TAKE, 0x2C)) { - if (_action._mainObjectSource == 4) { - switch (_game._trigger) { - case 0: - if (_game._objects.isInInventory(OBJ_BONES)) { - _vm->_dialogs->show(0x4EFB); - } else { - _game._player._stepEnabled = false; - _game._player._visible = false; - _globals._sequenceIndexes[7] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[6], false, 3, 2, 0, 0); - _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[7]); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SEQUENCE_TRIGGER_SPRITE, 6, 1); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[7], SEQUENCE_TRIGGER_EXPIRE, 0, 2); - } - break; - case 1: - if (_game._player._playerPos == Common::Point(132,97)) { - _scene->_sequences.remove(_globals._sequenceIndexes[1]); - _globals[kBone202Status] |= 1; - } else { - _scene->_sequences.remove(_globals._sequenceIndexes[6]); - _globals[kBone202Status] |= 2; - } - break; - case 2: - if (_game._objects.isInInventory(OBJ_BONE)) { - _game._objects.removeFromInventory(OBJ_BONE, 1); - _game._objects.addToInventory(OBJ_BONES); - _vm->_dialogs->showItem(OBJ_BONES, 0x4EFA, 0); - } else { - _game._objects.addToInventory(OBJ_BONE); - _vm->_dialogs->showItem(OBJ_BONE, 0x4EFA, 0); - } - _scene->changeVariant(_globals[kBone202Status]); - _game._player._stepEnabled = true; - _game._player._visible = true; - break; - default: - _action._inProgress = false; - return; - } + break; + case 1: + if (_game._player._playerPos == Common::Point(132, 97)) { + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals[kBone202Status] |= BONE_202_LEFT_GONE; + } else { + _scene->_sequences.remove(_globals._sequenceIndexes[6]); + _globals[kBone202Status] |= BONE_202_RIGHT_GONE; + } + break; + case 2: + if (_game._objects.isInInventory(OBJ_BONE)) { + _game._objects.removeFromInventory(OBJ_BONE, NOWHERE); + _game._objects.addToInventory(OBJ_BONES); + _vm->_dialogs->showItem(OBJ_BONES, 20218); + } else { + _game._objects.addToInventory(OBJ_BONE); + _vm->_dialogs->showItem(OBJ_BONE, 20218); + } + _scene->changeVariant(_globals[kBone202Status]); + _game._player._stepEnabled = true; + _game._player._visible = true; + break; + default: + break; + } + + _action._inProgress = false; + } else if ((_action.isAction(VERB_CLIMB_UP, NOUN_LADDER)) && !_globals[kLadderBroken]) { + switch (_game._trigger) { + case 0: + _vm->_sound->command(29); + _meteoClock1 = _scene->_frameStartTime; + _game._player._visible = false; + _game._player._stepEnabled = false; + + _ladderHotspotId = _scene->_dynamicHotspots.add(NOUN_LADDER, 79, -1, Common::Rect(241, 68, 241 + 12, 68 + 54)); + _scene->_dynamicHotspots.setPosition(_ladderHotspotId, Common::Point(246, 124), FACING_NORTH); + _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[8], 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_EXPIRE, 0, 1); + break; + case 1: { + _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[9], Common::Point(247, 82)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 1); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[8], _globals._sequenceIndexes[9]); + _ladderTopFl = true; + _game._player._stepEnabled = true; + int msgIndex = _scene->_kernelMessages.add(Common::Point(248, 15), 0x1110, 32, 0, 60, _game.getQuote(97)); + _scene->_kernelMessages.setQuoted(msgIndex, 4, true); } - } else if ((_action.isAction(0x50, NOUN_LADDER)) && (_globals[kLadderBroken] == 0)) { + break; + default: + _action._inProgress = false; + return; + } + } else if (((_action.isAction(VERB_LOOK, NOUN_BINOCULARS, 0x82)) || (_action.isAction(VERB_LOOK, NOUN_BINOCULARS, 0x1B6))) && (_globals[kSexOfRex] == SEX_MALE)) { + if (!_ladderTopFl) { switch (_game._trigger) { case 0: - _vm->_sound->command(29); - _meteoClock1 = _scene->_frameStartTime; - _game._player._visible = false; _game._player._stepEnabled = false; - - _ladderHotspotId = _scene->_dynamicHotspots.add(NOUN_LADDER, 79, -1, Common::Rect(241, 68, 241 + 12, 68 + 54)); - _scene->_dynamicHotspots.setPosition(_ladderHotspotId, Common::Point(246, 124), FACING_NORTH); - _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 6, 1, 0, 0); - _scene->_sequences.setDepth(_globals._sequenceIndexes[8], 1); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_EXPIRE, 0, 1); + _game._player._visible= false; + _globals._sequenceIndexes[10] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 6, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[10], 1, 6); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[10], Common::Point(172, 123)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 1); + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[10]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[10], SEQUENCE_TRIGGER_EXPIRE, 0, 1); break; - case 1: { - _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[9], Common::Point(247, 82)); - _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 1); - _scene->_sequences.updateTimeout(_globals._sequenceIndexes[8], _globals._sequenceIndexes[9]); - _ladderTopFl = true; - _game._player._stepEnabled = true; - int msgIndex = _scene->_kernelMessages.add(Common::Point(248, 15), 0x1110, 32, 0, 60, _game.getQuote(97)); - _scene->_kernelMessages.setQuoted(msgIndex, 4, true); + case 1: + _globals._sequenceIndexes[10] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 6); + _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[10], Common::Point(172, 123)); + if (_scene->_activeAnimation) { + _waitingMeteoFl = true; + _globals[kMeteorologistWatch] = METEOROLOGIST_GROUND; + } else { + _scene->_sequences.addTimer(120, 2); + } + break; + case 2: + if (!_scene->_activeAnimation && !_meteorologistSpecial) { + _vm->_dialogs->show(0x4EFE); } + _scene->_sequences.remove(_globals._sequenceIndexes[10]); + _globals._sequenceIndexes[10] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[9], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 1); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[10], 1, 6); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[10], Common::Point(172, 123)); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[10], SEQUENCE_TRIGGER_EXPIRE, 0, 3); + break; + case 3: + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[10]); + _game._player._stepEnabled = true; + _game._player._visible = true; break; default: _action._inProgress = false; return; } - } else if (((_action.isAction(VERB_LOOK, 0x27, 0x82)) || (_action.isAction(VERB_LOOK, 0x27, 0x1B6))) && (_globals[kSexOfRex] == SEX_MALE)) { - if (!_ladderTopFl) { - switch (_game._trigger) { - case 0: - _game._player._stepEnabled = false; - _game._player._visible= false; - _globals._sequenceIndexes[10] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 6, 1, 0, 0); - _scene->_sequences.setAnimRange(_globals._sequenceIndexes[10], 1, 6); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[10], Common::Point(172, 123)); - _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 1); - _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[10]); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[10], SEQUENCE_TRIGGER_EXPIRE, 0, 1); - break; - case 1: - _globals._sequenceIndexes[10] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 6); - _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[10], Common::Point(172, 123)); - if (_scene->_activeAnimation) { - _waitingMeteoFl = true; - _globals[kMeteorologistWatch] = METEOROLOGIST_GROUND; - } else { + } else { + switch (_game._trigger) { + case 0: + _toTeleportFl = true; + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._sequenceIndexes[9]); + _globals._sequenceIndexes[9] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], true, 6, 1, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[9], Common::Point(247, 82)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SEQUENCE_TRIGGER_EXPIRE, 0, 1); + break; + case 1: + _globals._sequenceIndexes[10] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, -2); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[10], Common::Point(247, 82)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 1); + if (_scene->_activeAnimation) { + if (_scene->_activeAnimation->getCurrentFrame() > 200) { _scene->_sequences.addTimer(120, 2); - } - break; - case 2: - if (!_scene->_activeAnimation && !_meteorologistSpecial) { - _vm->_dialogs->show(0x4EFE); - } - _scene->_sequences.remove(_globals._sequenceIndexes[10]); - _globals._sequenceIndexes[10] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[9], false, 6, 1, 0, 0); - _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 1); - _scene->_sequences.setAnimRange(_globals._sequenceIndexes[10], 1, 6); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[10], Common::Point(172, 123)); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[10], SEQUENCE_TRIGGER_EXPIRE, 0, 3); - break; - case 3: - _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[10]); - _game._player._stepEnabled = true; - _game._player._visible = true; - break; - default: - _action._inProgress = false; - return; - } - } else { - switch (_game._trigger) { - case 0: - _toTeleportFl = true; - _game._player._stepEnabled = false; - _scene->_sequences.remove(_globals._sequenceIndexes[9]); - _globals._sequenceIndexes[9] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], true, 6, 1, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[9], Common::Point(247, 82)); - _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 1); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SEQUENCE_TRIGGER_EXPIRE, 0, 1); - break; - case 1: - _globals._sequenceIndexes[10] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, -2); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[10], Common::Point(247, 82)); - _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 1); - if (_scene->_activeAnimation) { - if (_scene->_activeAnimation->getCurrentFrame() > 200) { - _scene->_sequences.addTimer(120, 2); + } else { + _waitingMeteoFl = true; + _globals[kMeteorologistWatch] = METEOROLOGIST_GONE; + if ((_scene->_activeAnimation->getCurrentFrame() >= 44) && (_scene->_activeAnimation->getCurrentFrame() <= 75)) { + _scene->_kernelMessages.reset(); + int msgIndex = _scene->_kernelMessages.add(Common::Point(248, 15), 0x1110, 32, 0, 60, _game.getQuote(100)); + _scene->_kernelMessages.setQuoted(msgIndex, 4, false); } else { - _waitingMeteoFl = true; - _globals[kMeteorologistWatch] = METEOROLOGIST_GONE; - if ((_scene->_activeAnimation->getCurrentFrame() >= 44) && (_scene->_activeAnimation->getCurrentFrame() <= 75)) { - _scene->_kernelMessages.reset(); - int msgIndex = _scene->_kernelMessages.add(Common::Point(248, 15), 0x1110, 32, 0, 60, _game.getQuote(100)); - _scene->_kernelMessages.setQuoted(msgIndex, 4, false); - } else { - _action._inProgress = false; - return; - } + _action._inProgress = false; + return; } - } else { - _scene->_sequences.addTimer(120, 2); } - break; - case 2: - if (!_scene->_activeAnimation) - _vm->_dialogs->show(0x4EFE); - _meteorologistSpecial = false; - _scene->_sequences.remove(_globals._sequenceIndexes[10]); - _globals._sequenceIndexes[9] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[9], false, 6, 1, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[9], Common::Point(247, 82)); - _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 1); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SEQUENCE_TRIGGER_EXPIRE, 0, 3); - break; - case 3: - _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[9], Common::Point(247, 82)); - _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 1); - _game._player._stepEnabled = true; - break; - default: - _action._inProgress = false; - return; + } else { + _scene->_sequences.addTimer(120, 2); } - } - } else if (_action.isAction(0x188, 0xAA)) { - setRandomKernelMessage(); - } else if (_action.isAction(VERB_LOOK, 0x129)) { - _vm->_dialogs->show(0x4EEA); - } else if (_action.isAction(VERB_LOOK, 0x86)) { - _vm->_dialogs->show(0x4EEB); - } else if (_action.isAction(VERB_LOOK, 0x19C)) { - _vm->_dialogs->show(0x4EEC); - } else if (_action.isAction(VERB_LOOK, 0x82)) { - if ((_globals[kMeteorologistStatus] == 0) || (_globals[kMeteorologistStatus] == 2)) { - _vm->_dialogs->show(0x4EED); - } else if (_globals[kMeteorologistStatus] == 1) { - _vm->_dialogs->show(0x4EFC); - } else { + break; + case 2: + if (!_scene->_activeAnimation) + _vm->_dialogs->show(0x4EFE); + _meteorologistSpecial = false; + _scene->_sequences.remove(_globals._sequenceIndexes[10]); + _globals._sequenceIndexes[9] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[9], false, 6, 1, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[9], Common::Point(247, 82)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SEQUENCE_TRIGGER_EXPIRE, 0, 3); + break; + case 3: + _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[9], Common::Point(247, 82)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 1); + _game._player._stepEnabled = true; + break; + default: _action._inProgress = false; return; } - } else if (_action.isAction(VERB_LOOK, 0x18E)) { - _vm->_dialogs->show(0x4EEE); - } else if (_action.isAction(VERB_LOOK, 0x164)) { - _vm->_dialogs->show(0x4EEF); - } else if (_action.isAction(VERB_LOOK, 0x175)) { - _vm->_dialogs->show(0x4EF0); - } else if (_action.isAction(VERB_LOOK, 0x174)) { - _vm->_dialogs->show(0x4EF1); - } else if (_action.isAction(VERB_LOOK, 0x142)) { - _vm->_dialogs->show(0x4EF2); - } else if (_action.isAction(VERB_LOOK, 0xAA)) { - if ((_game._player._playerPos == Common::Point(77, 105)) && (_game._player._facing == FACING_NORTH)) - _vm->_dialogs->show(0x4EF4); - else - _vm->_dialogs->show(0x4EF3); - } else if (_action.isAction(VERB_LOOK, 0x186)) { - _vm->_dialogs->show(0x4EF5); - } else if (_action.isAction(VERB_LOOK, 0x1B5)) { - _vm->_dialogs->show(0x4EF6); - } else if (_action.isAction(VERB_LOOK, 0x140)) { - _vm->_dialogs->show(0x4EF7); - } else if (_action.isAction(VERB_TAKE, 0x140)) { - _vm->_dialogs->show(0x4EF8); - } else if (_action.isAction(VERB_LOOK, 0x2D)) { - if (_action._commandSource == 4) - _vm->_dialogs->show(0x4EF9); - else - return; - } else { - return; } - } else { - _vm->_dialogs->show(0x4EFB); + } else if (_action.isAction(0x188, 0xAA)) { + setRandomKernelMessage(); + } else if (_action.isAction(VERB_LOOK, NOUN_ROCKS)) { + _vm->_dialogs->show(20202); + } else if (_action.isAction(VERB_LOOK, 0x86)) { + _vm->_dialogs->show(20203); + } else if (_action.isAction(VERB_LOOK, 0x19C)) { + _vm->_dialogs->show(20204); + } else if (_action.isAction(VERB_LOOK, 0x82)) { + if ((_globals[kMeteorologistStatus] == METEOROLOGIST_ABSENT) || (_globals[kMeteorologistStatus] == METEOROLOGIST_GONE)) + _vm->_dialogs->show(20205); + else if (_globals[kMeteorologistStatus] == METEOROLOGIST_PRESENT) + _vm->_dialogs->show(20220); + } else if (_action.isAction(VERB_LOOK, 0x18E)) { + _vm->_dialogs->show(0x4EEE); + } else if (_action.isAction(VERB_LOOK, 0x164)) { + _vm->_dialogs->show(0x4EEF); + } else if (_action.isAction(VERB_LOOK, 0x175)) { + _vm->_dialogs->show(0x4EF0); + } else if (_action.isAction(VERB_LOOK, 0x174)) { + _vm->_dialogs->show(0x4EF1); + } else if (_action.isAction(VERB_LOOK, 0x142)) { + _vm->_dialogs->show(0x4EF2); + } else if (_action.isAction(VERB_LOOK, 0xAA)) { + if ((_game._player._playerPos == Common::Point(77, 105)) && (_game._player._facing == FACING_NORTH)) + _vm->_dialogs->show(20212); + else + _vm->_dialogs->show(20211); + } else if (_action.isAction(VERB_LOOK, NOUN_STRANGE_DEVICE)) { + _vm->_dialogs->show(20213); + } else if (_action.isAction(VERB_LOOK, 0x1B5)) { + _vm->_dialogs->show(0x4EF6); + } else if (_action.isAction(VERB_LOOK, NOUN_SKULL)) { + _vm->_dialogs->show(0x4EF7); + } else if (_action.isAction(VERB_TAKE, NOUN_SKULL)) { + _vm->_dialogs->show(0x4EF8); + } else if (_action.isAction(VERB_LOOK, NOUN_BONES) && _action._commandSource == 4) { + _vm->_dialogs->show(0x4EF9); } + _action._inProgress = false; } -- cgit v1.2.3 From 4cf895ad062a5ded60ea5dc57991d6ba6941e46e Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 16 May 2014 06:26:11 +0300 Subject: MADS: Do not attempt to remove objects that aren't in the inventory Fixes a crash when the guards take Rex's stuff --- engines/mads/inventory.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/engines/mads/inventory.cpp b/engines/mads/inventory.cpp index d41a55fe47..79a8e87b2a 100644 --- a/engines/mads/inventory.cpp +++ b/engines/mads/inventory.cpp @@ -161,6 +161,10 @@ void InventoryObjects::removeFromInventory(int objectId, int newScene) { invIndex = idx; } + // If the object isn't in the player's inventory, stop here + if (invIndex < 0) + return; + int selectedIndex = userInterface._selectedInvIndex; bool noSelection = selectedIndex < 0; -- cgit v1.2.3 From 8a30fe7d5d2490fdd169208291c6f1148c1f7d8a Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 16 May 2014 06:27:29 +0300 Subject: MADS: Add a FIXME for scene 307 --- engines/mads/nebular/nebular_scenes3.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 78421e6c04..81ee04ac2a 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -819,7 +819,8 @@ void Scene307::step() { } _lastFrameTime = _scene->_frameStartTime; - if ((_guardTime > 3000) && !_duringPeeingFl && (_scene->_activeAnimation == nullptr) + // FIXME: The active animation is never a zero pointer, so the guards never show up + if ((_guardTime > 3000) && !_duringPeeingFl /*&& (_scene->_activeAnimation == nullptr)*/ && (_game._screenObjects._inputMode != 1) && _globals[kMetBuddyBeast] && !_activePrisonerFl) { if (!_game._objects.isInInventory(OBJ_SCALPEL) && !_grateOpenedFl) { _game._player._stepEnabled = false; -- cgit v1.2.3 From 514f122847c1e6be7b9901800bd3298d47ae72bb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 16 May 2014 09:05:05 -0400 Subject: MADS: Implemented sound player for scene group 8 --- engines/mads/nebular/sound_nebular.cpp | 253 +++++++++++++++++++++++++++++++++ engines/mads/nebular/sound_nebular.h | 43 ++++++ engines/mads/sound.cpp | 5 +- 3 files changed, 300 insertions(+), 1 deletion(-) diff --git a/engines/mads/nebular/sound_nebular.cpp b/engines/mads/nebular/sound_nebular.cpp index 997ea18405..5ee34b416f 100644 --- a/engines/mads/nebular/sound_nebular.cpp +++ b/engines/mads/nebular/sound_nebular.cpp @@ -2849,6 +2849,259 @@ int ASound7::command37() { return 0; } +/*-----------------------------------------------------------------------*/ + +const ASound8::CommandPtr ASound8::_commandList[38] = { + &ASound8::command0, &ASound8::command1, &ASound8::command2, &ASound8::command3, + &ASound8::command4, &ASound8::command5, &ASound8::command6, &ASound8::command7, + &ASound8::command8, &ASound8::command9, &ASound8::command10, &ASound8::command11, + &ASound8::command12, &ASound8::command13, &ASound8::command14, &ASound8::command15, + &ASound8::command16, &ASound8::command16, &ASound8::command18, &ASound8::command19, + &ASound8::command20, &ASound8::command21, &ASound8::command22, &ASound8::command23, + &ASound8::command24, &ASound8::command25, &ASound8::command26, &ASound8::command27, + &ASound8::command28, &ASound8::command29, &ASound8::command30, &ASound8::command31, + &ASound8::command32, &ASound8::command33, &ASound8::command34, &ASound8::command35, + &ASound8::command36, &ASound8::command37 +}; + +ASound8::ASound8(Audio::Mixer *mixer) : ASound(mixer, "asound.008", 0x1490) { + // Load sound samples + _soundFile.seek(_dataOffset + 0x122); + for (int i = 0; i < 174; ++i) + _samples.push_back(AdlibSample(_soundFile)); +} + +int ASound8::command(int commandId, int param) { + if (commandId > 38) + return 0; + + _frameCounter = 0; + return (this->*_commandList[commandId])(); +} + +int ASound8::command9() { + byte *pData = loadData(0x15BE, 10); + pData[6] = (getRandomNumber() & 7) + 85; + playSoundData(pData); + + return 0; +} + +int ASound8::command10() { + byte *pData = loadData(0x2B3E, 10); + pData[6] = (getRandomNumber() & 7) + 85; + playSoundData(pData); + + return 0; +} + +int ASound8::command11() { + playSound(0x17CA, 12); + + return 0; +} + +int ASound8::command12() { + playSound(0x17D6, 12); + + return 0; +} + +int ASound8::command13() { + playSound(0x1694, 10); + + return 0; +} + +int ASound8::command14() { + playSound(0x169E, 24); + + return 0; +} + +int ASound8::command15() { + byte *pData = loadData(0x169E, 24); + if (_channels[8]._ptr1 == pData) { + _channels[8]._soundData = loadData(0x16B6, 12); + _channels[8]._field17 = 1; + _channels[8]._field19 = 1; + } + + return 0; +} + +int ASound8::command16() { + playSound(0x1686, 14); + + return 0; +} + +int ASound8::command17() { + playSound(0x17EC, 12); + + return 0; +} + +int ASound8::command18() { + playSound(0x17F8, 12); + + return 0; +} + +int ASound8::command19() { + playSound(0x16D8, 8); + + return 0; +} + +int ASound8::command20() { + playSound(0x16E0, 8); + + return 0; +} + +int ASound8::command21() { + playSound(0x17E2, 10); + + return 0; +} + +int ASound8::command22() { + playSound(0x178C, 14); + playSound(0x179A, 14); + playSound(0x17A8, 14); + + return 0; +} + +int ASound8::command23() { + playSound(0x2B08, 34); + playSound(0x2B2A, 20); + + return 0; +} + +int ASound8::command24() { + playSound(0x17B6, 8); + + return 0; +} + +int ASound8::command25() { + playSound(0x17BE, 12); + + return 0; +} + +int ASound8::command26() { + playSound(0x16C2, 22); + + return 0; +} + +int ASound8::command27() { + playSound(0x1588, 34); + playSound(0x15AA, 20); + + return 0; +} + +int ASound8::command28() { + byte *pData1 = loadData(0x114E, 376); + if (!isSoundActive(pData1)) { + command1(); + _channels[0].load(pData1); + _channels[2].load(loadData(0x12F8, 130)); + + byte *pData = loadData(0x12C6, 50); + method1(pData); + _channels[1].load(pData); + } + + return 0; +} + +void ASound8::method1(byte *pData) { + int v; + while ((v = (getRandomNumber() & 0x3F)) > 36) + ; + + adjustRange(pData, v + 20, -1); + adjustRange(pData + 1, 10 - ((v + 1) / 6), 1); +} + +void ASound8::adjustRange(byte *pData, byte v, int incr) { + pData += 8; + + for (int i = 0; i < 10; ++i, pData += 4, v += incr) { + *pData = v; + } +} + +int ASound8::command29() { + byte *pData1 = loadData(0x137A, 60); + if (!isSoundActive(pData1)) { + command1(); + _channels[0].load(pData1); + _channels[1].load(loadData(0x13B6, 318)); + _channels[2].load(loadData(0x14F4, 118)); + } + + return 0; +} + +int ASound8::command30() { + playSound(0x1644, 22); + playSound(0x165A, 22); + playSound(0x1670, 22); + + return 0; +} + +int ASound8::command31() { + playSound(0x156A, 14); + + return 0; +} + +int ASound8::command32() { + playSound(0x163A, 10); + + return 0; +} + +int ASound8::command33() { + playSound(0x162A, 16); + + return 0; +} + +int ASound8::command34() { + playSound(0x161A, 16); + + return 0; +} + +int ASound8::command35() { + playSound(0x1604, 22); + + return 0; +} + +int ASound8::command36() { + playSound(0x1578, 16); + + return 0; +} + +int ASound8::command37() { + playSound(0x15C8, 20); + playSound(0x15DC, 30); + playSound(0X15FA, 10); + + return 0; +} + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/sound_nebular.h b/engines/mads/nebular/sound_nebular.h index 997f6bbffb..b5dee5b3ed 100644 --- a/engines/mads/nebular/sound_nebular.h +++ b/engines/mads/nebular/sound_nebular.h @@ -670,6 +670,49 @@ public: virtual int command(int commandId, int param); }; +class ASound8 : public ASound { +private: + typedef int (ASound8::*CommandPtr)(); + static const CommandPtr _commandList[38]; + + int command9(); + int command10(); + int command11(); + int command12(); + int command13(); + int command14(); + int command15(); + int command16(); + int command17(); + int command18(); + int command19(); + int command20(); + int command21(); + int command22(); + int command23(); + int command24(); + int command25(); + int command26(); + int command27(); + int command28(); + int command29(); + int command30(); + int command31(); + int command32(); + int command33(); + int command34(); + int command35(); + int command36(); + int command37(); + + void method1(byte *pData); + void adjustRange(byte *pData, byte v, int incr); +public: + ASound8(Audio::Mixer *mixer); + + virtual int command(int commandId, int param); +}; + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/sound.cpp b/engines/mads/sound.cpp index b6563ce792..2b8bb1e08a 100644 --- a/engines/mads/sound.cpp +++ b/engines/mads/sound.cpp @@ -68,7 +68,10 @@ void SoundManager::init(int sectionNumber) { _driver = new Nebular::ASound6(_mixer); break; case 7: - _driver = new Nebular::ASound1(_mixer); + _driver = new Nebular::ASound7(_mixer); + break; + case 8: + _driver = new Nebular::ASound8(_mixer); break; default: _driver = nullptr; -- cgit v1.2.3 From dbf2cfef5754aaf3b5fbe47860106cf5386525f8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 16 May 2014 07:24:56 +0200 Subject: MADS: Remove some optional parameters --- engines/mads/nebular/nebular_scenes2.cpp | 4 ++-- engines/mads/nebular/nebular_scenes3.cpp | 2 +- engines/mads/nebular/nebular_scenes5.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 8830a1b507..c602427b45 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -1180,7 +1180,7 @@ void Scene205::enter() { _game._player._playerPos = Common::Point(99, 152); if (_globals[kSexOfRex] != SEX_MALE) { - _scene->loadAnimation(formAnimName('a', -1), 0); + _scene->loadAnimation(formAnimName('a', -1)); _scene->_activeAnimation->_resetFlag = false; } else { _beingKicked = true; @@ -4100,7 +4100,7 @@ void Scene210::enter() { } if (_globals[kTwinklesStatus] == 0) { - _scene->loadAnimation(formAnimName('A', -1), 0); + _scene->loadAnimation(formAnimName('A', -1)); _twinkleAnimationType = 1; } else _scene->_hotspots.activate(476, false); diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 81ee04ac2a..03026c17a7 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -3215,7 +3215,7 @@ void Scene319::step() { _nextAction1 = _nextAction2; _animFrame = 0; _scene->freeAnimation(); - _scene->loadAnimation(formAnimName('b', 0), false); + _scene->loadAnimation(formAnimName('b', 0)); if (_nextAction1 == 3) _scene->_activeAnimation->setCurrentFrame(85); else if (_nextAction1 == 1) diff --git a/engines/mads/nebular/nebular_scenes5.cpp b/engines/mads/nebular/nebular_scenes5.cpp index 11af55b08f..168daea9a3 100644 --- a/engines/mads/nebular/nebular_scenes5.cpp +++ b/engines/mads/nebular/nebular_scenes5.cpp @@ -1933,7 +1933,7 @@ void Scene511::actions() { _lineAnimationMode = 1; _lineAnimationPosition = 1; _lineMoving = true; - _scene->loadAnimation(formAnimName('R', -1), 0); + _scene->loadAnimation(formAnimName('R', -1)); _scene->_sequences.addTimer(1, 1); } else if (_game._trigger == 1) { if (_lineMoving) { -- cgit v1.2.3 From 54d8f17686d7fc7c4a9269c983e10ad4073c71f0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 16 May 2014 18:55:53 +0200 Subject: MADS: Implement scene 704 --- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes2.cpp | 2 +- engines/mads/nebular/nebular_scenes7.cpp | 353 ++++++++++++++++++++++++++++++- engines/mads/nebular/nebular_scenes7.h | 26 +++ 4 files changed, 374 insertions(+), 9 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 8053818d4e..b9cf62bff3 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -257,7 +257,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 703: // water return new Scene703(vm); case 704: // water, building in the distance - return new DummyScene(vm); // TODO + return new Scene704(vm); case 705: // water, outside building return new DummyScene(vm); // TODO case 706: // inside building, pedestral room, outside teleporter diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index c602427b45..a86b78f90a 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -761,7 +761,7 @@ void Scene202::actions() { _globals[kMeteorologistStatus] = METEOROLOGIST_ABSENT; } _scene->_nextSceneId = 201; - } else if (_action.isAction(VERB_TAKE, NOUN_BONE) && _action._mainObjectSource == 4) { + } else if (_action.isAction(VERB_TAKE, NOUN_BONE) && (_action._mainObjectSource == 4)) { switch (_game._trigger) { case 0: if (_game._objects.isInInventory(OBJ_BONES)) { diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index ec99f14413..d28843257c 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -532,7 +532,7 @@ void Scene703::enter() { _curSequence = 2; _boatDir = 2; _monsterMode = 0; - _scene->loadAnimation(formAnimName('A', -1), 0); + _scene->loadAnimation(formAnimName('A', -1)); _scene->_activeAnimation->setCurrentFrame(34); } else if (_scene->_priorSceneId != -2) { _game._player._stepEnabled = false; @@ -540,27 +540,27 @@ void Scene703::enter() { if (_globals[kMonsterAlive]) { _monsterMode = 1; _curSequence = 0; - _scene->loadAnimation(formAnimName('B', -1), 0); + _scene->loadAnimation(formAnimName('B', -1)); } else { _curSequence = 0; _monsterMode = 0; - _scene->loadAnimation(formAnimName('A', -1), 0); + _scene->loadAnimation(formAnimName('A', -1)); } } else if (_globals[kMonsterAlive]) { _curSequence = 0; _boatDir = 1; _monsterMode = 1; - _scene->loadAnimation(formAnimName('B', -1), 0); + _scene->loadAnimation(formAnimName('B', -1)); _scene->_activeAnimation->setCurrentFrame(39); } else if (_boatDir == 1) { _curSequence = 0; _monsterMode = 0; - _scene->loadAnimation(formAnimName('A', -1), 0); + _scene->loadAnimation(formAnimName('A', -1)); _scene->_activeAnimation->setCurrentFrame(9); } else if (_boatDir == 2) { _curSequence = 0; _monsterMode = 0; - _scene->loadAnimation(formAnimName('A', -1), 0); + _scene->loadAnimation(formAnimName('A', -1)); _scene->_activeAnimation->setCurrentFrame(56); } @@ -594,7 +594,7 @@ void Scene703::step() { _game._player._stepEnabled = false; _scene->freeAnimation(); _monsterMode = 3; - _scene->loadAnimation(formAnimName('D', -1), 0); + _scene->loadAnimation(formAnimName('D', -1)); _rexDeathFl = false; _monsterTime = 0; } @@ -949,6 +949,345 @@ void Scene703::actions() { /*------------------------------------------------------------------------*/ +void Scene704::setup() { + _game._player._spritesPrefix = ""; + setAAName(); + _scene->addActiveVocab(0x2E); + _scene->addActiveVocab(0xD1); +} + +void Scene704::handleBottleInterface() { + switch (_globals[kBottleStatus]) { + case 0: + _dialog1.write(0x311, true); + _dialog1.write(0x312, true); + _dialog1.write(0x313, true); + _dialog1.write(0x314, true); + _dialog1.write(0x315, true); + break; + + case 1: + _dialog1.write(0x311, false); + _dialog1.write(0x312, true); + _dialog1.write(0x313, true); + _dialog1.write(0x314, true); + _dialog1.write(0x315, true); + break; + + case 2: + _dialog1.write(0x311, false); + _dialog1.write(0x312, false); + _dialog1.write(0x313, true); + _dialog1.write(0x314, true); + _dialog1.write(0x315, true); + break; + + case 3: + _dialog1.write(0x311, false); + _dialog1.write(0x312, false); + _dialog1.write(0x313, false); + _dialog1.write(0x314, true); + _dialog1.write(0x315, true); + break; + + default: + break; + } +} + +void Scene704::setBottleSequence() { + _scene->_userInterface.setup(kInputBuildingSentences); + _game._player._stepEnabled = false; + if (_boatDirection == 2) + _animationMode = 6; + else + _animationMode = 7; +} + +void Scene704::handleFillBottle(int quote) { + switch (quote) { + case 0x311: + _globals[kBottleStatus] = 1; + setBottleSequence(); + break; + + case 0x312: + _globals[kBottleStatus] = 2; + setBottleSequence(); + break; + + case 0x313: + _globals[kBottleStatus] = 3; + setBottleSequence(); + break; + + case 0x314: + _globals[kBottleStatus] = 4; + setBottleSequence(); + break; + + case 0x315: + _scene->_userInterface.setup(kInputBuildingSentences); + break; + + default: + break; + } +} + +void Scene704::enter() { + if (_game._objects[OBJ_BOTTLE]._roomNumber == _scene->_currentSceneId) { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('b', 0)); + _globals._sequenceIndexes[1] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 6, 0, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); + if (_scene->_priorSceneId == 705) { + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(123, 125)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); + } else { + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(190, 122)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 2); + } + int idx = _scene->_dynamicHotspots.add(0x2D, 0xD1, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + _bottleHotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(-2, 0), FACING_NONE); + } + + _game._player._visible = false; + _takeBottleFl = false; + _boatCurrentFrame = -1; + + if (_scene->_priorSceneId == 705) { + _game._player._stepEnabled = false; + _animationMode = 2; + _boatDirection = 2; + _scene->loadAnimation(formAnimName('A', -1)); + _scene->_activeAnimation->setCurrentFrame(36); + } else if (_scene->_priorSceneId != -2) { + _game._player._stepEnabled = false; + _boatDirection = 1; + _scene->loadAnimation(formAnimName('A', -1)); + } else if (_boatDirection == 1) { + _scene->loadAnimation(formAnimName('A', -1)); + _scene->_activeAnimation->setCurrentFrame(8); + } else if (_boatDirection == 2) { + if (_game._objects[OBJ_BOTTLE]._roomNumber == _scene->_currentSceneId) { + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(123, 125)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); + } + _scene->loadAnimation(formAnimName('A', -1)); + _scene->_activeAnimation->setCurrentFrame(57); + } + + if (_scene->_roomChanged) + _globals[kMonsterAlive] = false; + + _game.loadQuoteSet(0x311, 0x312, 0x313, 0x314, 0x315, 0); + _dialog1.setup(0x98, 0x311, 0x312, 0x313, 0x314, 0x315, 0); + + sceneEntrySound(); + _vm->_sound->command(28); +} + +void Scene704::step() { + if (_scene->_activeAnimation != nullptr) { + if (_scene->_activeAnimation->getCurrentFrame() != _boatCurrentFrame) { + _boatCurrentFrame = _scene->_activeAnimation->getCurrentFrame(); + int nextFrame = -1; + + switch (_boatCurrentFrame) { + case 10: + switch (_animationMode) { + case 1: + nextFrame = 10; + break; + case 5: + nextFrame = 74; + break; + case 7: + _animationMode = 0; + nextFrame = 92; + break; + default: + if (!_game._player._stepEnabled) + _game._player._stepEnabled = true; + + nextFrame = 8; + break; + } + break; + + case 36: + if (_animationMode != 2) + _scene->_nextSceneId = 705; + break; + + case 59: + switch (_animationMode) { + case 3: + nextFrame = 59; + break; + + case 4: + nextFrame = 65; + break; + + case 6: + _animationMode = 0; + nextFrame = 83; + break; + + default: + if (!_game._player._stepEnabled) { + _game._player._stepEnabled = true; + } + nextFrame = 57; + break; + } + break; + + case 65: + _scene->_nextSceneId = 703; + break; + + case 74: + nextFrame = 10; + break; + + case 83: + nextFrame = 59; + break; + + case 90: + if (_takeBottleFl) { + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _scene->_dynamicHotspots.remove(_bottleHotspotId); + _game._objects.addToInventory(OBJ_BOTTLE); + _vm->_sound->command(15); + _vm->_dialogs->showItem(OBJ_BOTTLE, 70415); + } + break; + + case 92: + nextFrame = 57; + if (!_game._player._stepEnabled && !_takeBottleFl) { + _scene->_sequences.addTimer(30, 70); + _game._player._stepEnabled = true; + } + break; + + case 98: + if (_takeBottleFl) { + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _scene->_dynamicHotspots.remove(_bottleHotspotId); + _game._objects.addToInventory(OBJ_BOTTLE); + _vm->_sound->command(15); + _vm->_dialogs->showItem(OBJ_BOTTLE, 70415); + } + break; + + case 101: + nextFrame = 8; + if (!_game._player._stepEnabled && !_takeBottleFl) { + _scene->_sequences.addTimer(30, 70); + _game._player._stepEnabled = true; + } + break; + + default: + break; + } + + if ((nextFrame >= 0) && (nextFrame != _scene->_activeAnimation->getCurrentFrame())) { + _scene->_activeAnimation->setCurrentFrame(nextFrame); + _boatCurrentFrame = nextFrame; + } + } + } + + if (_game._trigger == 70) { + switch (_globals[kBottleStatus]) { + case 0: + _vm->_dialogs->show(432); + break; + + case 1: + _vm->_dialogs->show(70324); + break; + + case 2: + _vm->_dialogs->show(70325); + break; + + case 3: + _vm->_dialogs->show(70326); + break; + + case 4: + _vm->_dialogs->show(70327); + break; + + default: + break; + } + } +} + +void Scene704::actions() { + if (_game._screenObjects._inputMode == 1) + handleFillBottle(_action._activeAction._verbId); + else if (_action.isAction(0x3B1, 0x3B4)) { + _game._player._stepEnabled = false; + if (_boatDirection == 1) + _animationMode = 5; + else + _animationMode = 3; + } else if (_action.isAction(0x3B1, 0x3B2)) { + _game._player._stepEnabled = false; + if (_boatDirection == 2) + _animationMode = 4; + else + _animationMode = 1; + } else if (_action.isAction(VERB_TAKE, 0x2E)) { + if (!_game._objects.isInInventory(OBJ_BOTTLE)) { + _game._player._stepEnabled = false; + _takeBottleFl = true; + if (_boatDirection == 2) { + _animationMode = 6; + } else { + _animationMode = 7; + } + } + } else if (_action.isAction(VERB_PUT, 0x2E, 0x18F) || _action.isAction(0x85, 0x2E, 0x18F)) { + if (_game._objects.isInInventory(OBJ_BOTTLE)) { + if (_globals[kBottleStatus] != 4) { + _takeBottleFl = false; + handleBottleInterface(); + _dialog1.start(); + } else + _vm->_dialogs->show(70323); + } + } else if (_action._lookFlag || _action.isAction(VERB_LOOK, 0x18F)) + _vm->_dialogs->show(70410); + else if (_action.isAction(VERB_LOOK, 0x3B2)) { + if (_game._visitedScenes.exists(710)) + _vm->_dialogs->show(70411); + else + _vm->_dialogs->show(70412); + } else if (_action.isAction(VERB_LOOK, 0x3B3)) + _vm->_dialogs->show(70413); + else if (_action.isAction(VERB_LOOK, 0x2E) && (_action._mainObjectSource == 4)) + _vm->_dialogs->show(70414); + else if (_action.isAction(VERB_LOOK, 0x3B4)) + _vm->_dialogs->show(70416); + else if (_action.isAction(VERB_LOOK, 0x142)) + _vm->_dialogs->show(70417); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + void Scene707::setup() { _game._player._spritesPrefix = ""; // The original calls Scene7xx::setAAName() diff --git a/engines/mads/nebular/nebular_scenes7.h b/engines/mads/nebular/nebular_scenes7.h index 049cc54bf4..34695dd402 100644 --- a/engines/mads/nebular/nebular_scenes7.h +++ b/engines/mads/nebular/nebular_scenes7.h @@ -106,6 +106,32 @@ public: virtual void postActions() {}; }; +class Scene704: public Scene7xx{ +private: + int _bottleHotspotId; + int _boatCurrentFrame; + int _animationMode; + int _boatDirection; + + bool _takeBottleFl; + + Conversation _dialog1; + + void handleFillBottle(int quote); + void setBottleSequence(); + void handleBottleInterface(); + +public: + Scene704(MADSEngine *vm) : Scene7xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions(); + virtual void postActions() {}; +}; + class Scene707: public SceneTeleporter { public: Scene707(MADSEngine *vm) : SceneTeleporter(vm) {} -- cgit v1.2.3 From ede08b748a7af7912ed3dde37eea22a1fb2bb684 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 16 May 2014 20:26:09 +0300 Subject: MADS: Spacing --- engines/mads/nebular/nebular_scenes3.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 03026c17a7..aca9b8b18e 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -2678,7 +2678,7 @@ void Scene318::step() { case 60: _vm->_sound->command(3); _animMode = 2; - _scene->_reloadSceneFlag= true; + _scene->_reloadSceneFlag = true; break; case 61: -- cgit v1.2.3 From a197d91df64cb625c6640fdd9fe0a5f74d61a208 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 16 May 2014 20:26:49 +0300 Subject: MADS: Add a sanity check in pollActiveChannel() This avoids a crash when Rex is knocked unconscious in scene 318 --- engines/mads/nebular/sound_nebular.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/engines/mads/nebular/sound_nebular.cpp b/engines/mads/nebular/sound_nebular.cpp index 5ee34b416f..666b686267 100644 --- a/engines/mads/nebular/sound_nebular.cpp +++ b/engines/mads/nebular/sound_nebular.cpp @@ -413,6 +413,10 @@ void ASound::pollActiveChannel() { if (--_activeChannelPtr->_activeCount <= 0) { for (;;) { byte *pSrc = chan->_pSrc; + if (!chan->_ptr1) { + warning("pollActiveChannel(): No data found for sound channel"); + break; + } if (!(*pSrc & 0x80) || (*pSrc <= 0xF0)) { if (updateFlag) updateActiveChannel(); -- cgit v1.2.3 From 73dbec2011d9f678df1c25aa8f91d98623f94701 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 16 May 2014 13:52:43 -0400 Subject: MADS: Clean up sound driver creation switch block --- engines/mads/sound.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engines/mads/sound.cpp b/engines/mads/sound.cpp index 2b8bb1e08a..64144bb3f0 100644 --- a/engines/mads/sound.cpp +++ b/engines/mads/sound.cpp @@ -47,7 +47,6 @@ void SoundManager::init(int sectionNumber) { switch (_vm->getGameID()) { case GType_RexNebular: - // TODO: Other Rex Adlib section drivers switch (sectionNumber) { case 1: _driver = new Nebular::ASound1(_mixer); @@ -73,6 +72,8 @@ void SoundManager::init(int sectionNumber) { case 8: _driver = new Nebular::ASound8(_mixer); break; + case 9: + error("Sound driver 9 not implemented"); default: _driver = nullptr; break; -- cgit v1.2.3 From 17b29e109d229f75069f9898b954fad493199496 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 16 May 2014 20:57:03 +0300 Subject: FULLPIPE: Implement MovGraph::method44() --- engines/fullpipe/motion.cpp | 29 ++++++++++++++++++++++++----- engines/fullpipe/motion.h | 4 ++-- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index b5e0f67a58..1712c88684 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -621,10 +621,31 @@ int MovGraph::method3C(StaticANIObject *ani, int flag) { return 0; } -int MovGraph::method44() { - warning("STUB: MovGraph::method44()"); +bool MovGraph::method44(StaticANIObject *ani, int x, int y) { + int idx = getItemIndexByStaticAni(ani); + MovArr m; - return 0; + if (idx != -1) { + if (x != -1 || y != -1) { + int counter; + + MovItem *movitem = method28(ani, x, y, 0, &counter); + + if (movitem) { + MovArr *movarr = _callback1(ani, movitem, counter); + int cnt = movarr->_movStepCount; + + if (cnt > 0) { + if (movarr->_movSteps[cnt - 1].link->_flags & 0x4000000) + return true; + } + } + } else if (calcChunk(idx, ani->_ox, ani->_oy, &m, 0) && m._link && (m._link->_flags & 0x4000000)) { + return true; + } + } + + return false; } MessageQueue *MovGraph::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) { @@ -1512,8 +1533,6 @@ MessageQueue *MovGraph2::doWalkTo(StaticANIObject *obj, int xpos, int ypos, int obj->getPicAniInfo(&picAniInfo); - warning("p: %d %d", picAniInfo.movementId, picAniInfo.objectId); - int idxsub; if (obj->_movement) diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index 1b49839e0d..febcf17574 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -60,7 +60,7 @@ public: virtual int changeCallback() { return 0; } virtual int method3C(StaticANIObject *ani, int flag) { return 0; } virtual int method40() { return 0; } - virtual int method44() { return 0; } + virtual bool method44(StaticANIObject *ani, int x, int y) { return false; } virtual int method48() { return -1; } virtual MessageQueue *doWalkTo(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) { return 0; } @@ -366,7 +366,7 @@ public: virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId); virtual int changeCallback(); virtual int method3C(StaticANIObject *ani, int flag); - virtual int method44(); + virtual bool method44(StaticANIObject *ani, int x, int y); virtual MessageQueue *doWalkTo(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId); virtual int method50(); -- cgit v1.2.3 From 7010bc6be492e62f3a2cdd8e6801fc6c44343486 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 16 May 2014 20:56:49 +0300 Subject: MADS: Some more work on scene 701 --- engines/mads/nebular/nebular_scenes7.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index d28843257c..9e639786ae 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -247,10 +247,19 @@ void Scene701::actions() { if (_action.isAction(VERB_LOOK, NOUN_BINOCULARS, NOUN_BUILDING) && _game._objects[OBJ_VASE]._roomNumber == 706) { switch (_game._trigger) { case 0: - // TODO + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 6, 1, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[5], Common::Point(155, 129)); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 1); break; - case 1: - // TODO + case 1: { + int temp = _globals._sequenceIndexes[5]; + _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, -2); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[5], Common::Point(155, 129)); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[5], temp); + _scene->_sequences.addTimer(15, 2); + } break; case 2: _scene->_nextSceneId = 710; @@ -259,10 +268,13 @@ void Scene701::actions() { } else if (_action.isAction(VERB_STEP_INTO, NOUN_ELEVATOR)) { switch (_game._trigger) { case 0: - // TODO + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + // TODO: finish this break; case 1: - // TODO + _game._player.walk(Common::Point(22, 131), FACING_EAST); + _scene->_sequences.addTimer(2 * 60, 3); break; case 3: // TODO -- cgit v1.2.3 From 3f4e4c50b9ce807aec62406c8bfeeff4ed68cb3b Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 16 May 2014 21:10:04 +0300 Subject: MADS: Bugfix for scene 804 --- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes8.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index b9cf62bff3..fe336a63d4 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -280,7 +280,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { return new DummyScene(vm); // TODO case 803: // empty launch pad return new DummyScene(vm); // TODO - case 804: // ??? (broken animation) + case 804: // inside Rex's ship - cockpit return new Scene804(vm); case 805: // service panel return new DummyScene(vm); // TODO diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index 0be53ef41d..296fd74c34 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -123,7 +123,7 @@ void Scene804::enter() { _globals._sequenceIndexes[8] = _scene->_sequences.startCycle(_globals._spriteIndexes[8], false, 1); if (_globals[kWindowFixed] == 0) - _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 1); + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(133, 139)); -- cgit v1.2.3 From 1c54f97916ebcd8ae9921827d39cfa95a840c26e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 16 May 2014 20:38:26 +0200 Subject: MADS: Implement scene 705 --- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes7.cpp | 264 +++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes7.h | 19 +++ 3 files changed, 284 insertions(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index fe336a63d4..04c4c6e3e0 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -259,7 +259,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 704: // water, building in the distance return new Scene704(vm); case 705: // water, outside building - return new DummyScene(vm); // TODO + return new Scene705(vm); case 706: // inside building, pedestral room, outside teleporter return new DummyScene(vm); // TODO case 707: // teleporter diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index 9e639786ae..6470624304 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -1300,6 +1300,270 @@ void Scene704::actions() { /*------------------------------------------------------------------------*/ +void Scene705::setup() { + _game._player._spritesPrefix = ""; + setAAName(); +} + +void Scene705::handleBottleInterface() { + switch (_globals[kBottleStatus]) { + case 0: + _dialog1.write(0x311, true); + _dialog1.write(0x312, true); + _dialog1.write(0x313, true); + _dialog1.write(0x314, true); + _dialog1.write(0x315, true); + break; + + case 1: + _dialog1.write(0x311, false); + _dialog1.write(0x312, true); + _dialog1.write(0x313, true); + _dialog1.write(0x314, true); + _dialog1.write(0x315, true); + break; + + case 2: + _dialog1.write(0x311, false); + _dialog1.write(0x312, false); + _dialog1.write(0x313, true); + _dialog1.write(0x314, true); + _dialog1.write(0x315, true); + break; + + case 3: + _dialog1.write(0x311, false); + _dialog1.write(0x312, false); + _dialog1.write(0x313, false); + _dialog1.write(0x314, true); + _dialog1.write(0x315, true); + break; + + default: + break; + } +} + +void Scene705::setBottleSequence() { + _scene->_userInterface.setup(kInputBuildingSentences); + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->loadAnimation(formAnimName('F', -1), 90); +} + +void Scene705::handleFillBottle(int quote) { + switch (quote) { + case 0x311: + _globals[kBottleStatus] = 1; + setBottleSequence(); + break; + + case 0x312: + _globals[kBottleStatus] = 2; + setBottleSequence(); + break; + + case 0x313: + _globals[kBottleStatus] = 3; + setBottleSequence(); + break; + + case 0x314: + _globals[kBottleStatus] = 4; + setBottleSequence(); + break; + + case 0x315: + _scene->_userInterface.setup(kInputBuildingSentences); + break; + + default: + break; + } +} + +void Scene705::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('b', 0)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('b', 1)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('a', 0)); + + _game._player._visible = false; + + if (_scene->_priorSceneId == 706) { + _game._player._stepEnabled = false; + _globals._sequenceIndexes[3] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[3], false, 9, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 4); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 71); + } else if (_scene->_priorSceneId != -2) { + _game._player._stepEnabled = false; + _scene->_sequences.addTimer(1, 80); + _vm->_sound->command(28); + } else + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); + + if (_scene->_roomChanged) + _game._objects.addToInventory(OBJ_BOTTLE); + + _game.loadQuoteSet(0x311, 0x312, 0x313, 0x314, 0x315, 0); + _dialog1.setup(0x98, 0x311, 0x312, 0x313, 0x314, 0x315, 0); + sceneEntrySound(); +} + +void Scene705::step() { + switch (_game._trigger) { + case 70: + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle (_globals._spriteIndexes[3], false, 9, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 4); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 71); + break; + + case 71: { + int syncIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], syncIdx); + _game._player._stepEnabled = true; + } + break; + + default: + break; + } + + switch (_game._trigger) { + case 80: + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle (_globals._spriteIndexes[1], false, 9, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 81); + break; + + case 81: { + _vm->_sound->command(19); + int syncIdx = _globals._sequenceIndexes[1]; + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], syncIdx); + _game._player._stepEnabled = true; + } + break; + + default: + break; + } + + switch (_game._trigger) { + case 90: + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); + _scene->_sequences.addTimer(30, 91); + break; + + case 91: + switch (_globals[kBottleStatus]) { + case 0: + _vm->_dialogs->show(432); + break; + + case 1: + _vm->_dialogs->show(70324); + break; + + case 2: + _vm->_dialogs->show(70325); + break; + + case 3: + _vm->_dialogs->show(70326); + break; + + case 4: + _vm->_dialogs->show(70327); + break; + + default: + break; + } + _game._player._stepEnabled = true; + break; + + default: + break; + } +} + +void Scene705::actions() { + if (_game._screenObjects._inputMode == 1) + handleFillBottle(_action._activeAction._verbId); + else if (_action.isAction(0x3B1, 0x3B4)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle (_globals._spriteIndexes[2], false, 6, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 1); + _vm->_sound->command(18); + break; + + case 1: { + int syncIdx = _globals._sequenceIndexes[2]; + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 2); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], syncIdx); + _scene->_nextSceneId = 704; + _game._player._stepEnabled = true; + } + break; + + default: + break; + } + } else if (_action.isAction(0x4F, 0x197)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle (_globals._spriteIndexes[3], false, 6, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 16); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 1); + break; + + case 1: { + int syncIdx = _globals._sequenceIndexes[3]; + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 16); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], syncIdx); + _scene->_nextSceneId = 706; + _game._player._stepEnabled = true; + } + break; + + default: + break; + } + } else if (_action.isAction(0x85, 0x2E, 0x18F) || _action.isAction(VERB_PUT, 0x2E, 0x18F)) { + if (_globals[kBottleStatus] != 4) { + handleBottleInterface(); + _dialog1.start(); + } else + _vm->_dialogs->show(70323); + } if (_action._lookFlag || _action.isAction(VERB_LOOK, 0x18F)) + _vm->_dialogs->show(70511); + else if (_action.isAction(VERB_LOOK, 0x3B3)) + _vm->_dialogs->show(70512); + else if (_action.isAction(VERB_LOOK, 0x3B4)) + _vm->_dialogs->show(70513); + else if (_action.isAction(VERB_LOOK, 0x142)) + _vm->_dialogs->show(70514); + else if (_action.isAction(VERB_LOOK, 0x323)) + _vm->_dialogs->show(70515); + else if (_action.isAction(VERB_LOOK, 0x197)) + _vm->_dialogs->show(70516); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + void Scene707::setup() { _game._player._spritesPrefix = ""; // The original calls Scene7xx::setAAName() diff --git a/engines/mads/nebular/nebular_scenes7.h b/engines/mads/nebular/nebular_scenes7.h index 34695dd402..06d5d04b1f 100644 --- a/engines/mads/nebular/nebular_scenes7.h +++ b/engines/mads/nebular/nebular_scenes7.h @@ -132,6 +132,25 @@ public: virtual void postActions() {}; }; +class Scene705: public Scene7xx{ +private: + Conversation _dialog1; + + void handleFillBottle(int quote); + void setBottleSequence(); + void handleBottleInterface(); + +public: + Scene705(MADSEngine *vm) : Scene7xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions(); + virtual void postActions() {}; +}; + class Scene707: public SceneTeleporter { public: Scene707(MADSEngine *vm) : SceneTeleporter(vm) {} -- cgit v1.2.3 From 3af6bbb397ae94bfbfceeaeab9979613d1047cbb Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 16 May 2014 22:00:29 +0200 Subject: MADS: Implement scene 706 --- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes7.cpp | 283 ++++++++++++++++++++++++++++++- engines/mads/nebular/nebular_scenes7.h | 23 +++ 3 files changed, 301 insertions(+), 7 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 04c4c6e3e0..a626bdf05f 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -261,7 +261,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 705: // water, outside building return new Scene705(vm); case 706: // inside building, pedestral room, outside teleporter - return new DummyScene(vm); // TODO + return new Scene706(vm); case 707: // teleporter return new Scene707(vm); case 710: // looking at pedestral room through binoculars diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index 6470624304..94bb7b66b2 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -381,7 +381,7 @@ void Scene702::actions() { _game._player._stepEnabled = false; _game._player._visible = false; _scene->_nextSceneId = 711; - } else if (_action.isAction(VERB_TAKE, NOUN_BONES) && _action._mainObjectSource == 4 && (!_game._objects.isInInventory(OBJ_BONES) || _game._trigger)) { + } else if (_action.isAction(VERB_TAKE, NOUN_BONES) && (_action._mainObjectSource == 4) && (!_game._objects.isInInventory(OBJ_BONES) || _game._trigger)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -420,9 +420,9 @@ void Scene702::actions() { _vm->_dialogs->show(70215); else if (_action.isAction(VERB_LOOK, NOUN_TELEPORTER)) _vm->_dialogs->show(70216); - else if (_action.isAction(VERB_LOOK, NOUN_BONES) && _action._mainObjectSource == 4) + else if (_action.isAction(VERB_LOOK, NOUN_BONES) && (_action._mainObjectSource == 4)) _vm->_dialogs->show(70217); - else if (_action.isAction(VERB_TAKE, NOUN_BONES) && _action._mainObjectSource == 4) { + else if (_action.isAction(VERB_TAKE, NOUN_BONES) && (_action._mainObjectSource == 4)) { if (_game._objects.isInInventory(OBJ_BONES)) _vm->_dialogs->show(70219); } else if (_action.isAction(VERB_LOOK, NOUN_SUBMERGED_CITY)) @@ -1564,6 +1564,277 @@ void Scene705::actions() { /*------------------------------------------------------------------------*/ +void Scene706::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(0x2E); + _scene->addActiveVocab(0x17D); + _scene->addActiveVocab(0xD); +} + +void Scene706::handleRexDeath() { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + _scene->loadAnimation(formAnimName('a', -1), 2); + break; + + case 2: + if (_animationMode == 1) + _vm->_dialogs->show(70625); + else if (_globals[kBottleStatus] < 2) + _vm->_dialogs->show(70628); + else + _vm->_dialogs->show(70629); + + _game._objects.setRoom(OBJ_VASE, _scene->_currentSceneId); + if (_animationMode == 2) + _game._objects.setRoom(OBJ_BOTTLE, 2); + + _animationMode = 0; + _scene->_reloadSceneFlag = true; + break; + + default: + break; + } +} + +void Scene706::handleTakeVase() { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 4, 2, 0, 0); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[3]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_SPRITE, 7, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + + case 1: + _vm->_sound->command(9); + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _scene->_dynamicHotspots.remove(_vaseHotspotId); + _game._objects.addToInventory(OBJ_VASE); + if (_vaseMode == 1) { + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 4); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(195, 99)); + int idx = _scene->_dynamicHotspots.add(0x2E, VERB_WALKTO, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(175, 124), FACING_SOUTHEAST); + _game._objects.setRoom(OBJ_BOTTLE, _scene->_currentSceneId); + } + break; + + case 2: + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[3]); + _game._player._visible = true; + _vm->_dialogs->showItem(OBJ_VASE, 70630); + _game._player._stepEnabled = true; + break; + } +} + +void Scene706::enter() { + _globals._spriteIndexes[3] = _scene->_sprites.addSprites("*RXMRC_3"); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('b', -1)); + + if (!_game._visitedScenes._sceneRevisited) + _emptyPedestral = false; + + if (_game._objects[OBJ_VASE]._roomNumber == _scene->_currentSceneId) { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('v', -1)); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 4); + int idx = _scene->_dynamicHotspots.add(0x17D, VERB_WALKTO, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + _vaseHotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(175, 124), FACING_SOUTHEAST); + } else if (_game._objects.isInRoom(OBJ_BOTTLE)) { + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 4); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(195, 99)); + int idx = _scene->_dynamicHotspots.add(0x2E, VERB_WALKTO, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(175, 124), FACING_SOUTHEAST); + } + + _game._player._visible = true; + + if (_scene->_priorSceneId == 707) { + _game._player._playerPos = Common::Point(277, 103); + _game._player._facing = FACING_SOUTHWEST; + } else if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(167, 152); + _game._player._facing = FACING_NORTH; + } + + if (_globals[kTeleporterCommand]) { + _game._player._visible = false; + _game._player._stepEnabled = false; + + switch (_globals[kTeleporterCommand]) { + case 1: + _scene->loadAnimation(formAnimName('E', 1), 75); + break; + + case 2: + _scene->loadAnimation(formAnimName('E', -1), 80); + break; + + default: + _game._player.walk(Common::Point(264, 116), FACING_SOUTHWEST); + _game._player._visible = true; + _game._player._stepEnabled = true; + break; + } + _globals[kTeleporterCommand] = 0; + } + + _animationMode = 0; + + if (_scene->_roomChanged) { + _game._objects.addToInventory(OBJ_BOTTLE); + _globals[kBottleStatus] = 2; + } + + sceneEntrySound(); +} + +void Scene706::step() { + if (_game._trigger == 75) { + _game._player._stepEnabled = true; + _game._player._visible = true; + _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; + _game._player.walk(Common::Point(264, 116), FACING_SOUTHWEST); + } + + if (_game._trigger == 80) { + _globals[kTeleporterCommand] = 1; + _scene->_nextSceneId = _globals[kTeleporterDestination]; + _scene->_reloadSceneFlag = true; + } + + if (_scene->_activeAnimation != nullptr) { + if ((_animationMode != 0) && (_scene->_activeAnimation->getCurrentFrame() != _animationFrame)) { + _animationFrame = _scene->_activeAnimation->getCurrentFrame(); + + if (_animationFrame == 6) { + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _game._objects.setRoom(OBJ_VASE, 2); + + if (_animationMode == 2) { + _game._objects.setRoom(OBJ_BOTTLE, 1); + + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 4); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(195, 99)); + int idx = _scene->_dynamicHotspots.add(0x2E, VERB_WALKTO, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(175, 124), FACING_SOUTHEAST); + } + } + } + } +} + +void Scene706::preActions() { + if (_action.isAction(VERB_LOOK, 0x46E)) + _game._player._needToWalk = true; +} + +void Scene706::actions() { + if (_action.isAction(0x188, 0x16C)) { + _game._player._stepEnabled = false; + _game._player._visible = false; + _scene->_nextSceneId = 707; + _action._inProgress = false; + return; + } + + if (_action.isAction(0x298, 0x2FA)) { + _scene->_nextSceneId = 705; + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_TAKE, 0x17D)) { + if (_game._difficulty != DIFFICULTY_EASY) { + _animationMode = 1; + handleRexDeath(); + } else if (_game._trigger || !_game._objects.isInInventory(OBJ_VASE)) { + handleTakeVase(); + _emptyPedestral = true; + } + _action._inProgress = false; + return; + } + + if (_action.isAction(VERB_PUT, 0x2E, 0x344)) { + if ((_globals[kBottleStatus] == 2 && _game._difficulty == DIFFICULTY_HARD) || + (_globals[kBottleStatus] != 0 && _game._difficulty != DIFFICULTY_HARD)) { + if (!_game._objects.isInInventory(OBJ_VASE) || _game._trigger) { + _vaseMode = 1; + handleTakeVase(); + _action._inProgress = false; + return; + } + } else if (_game._objects.isInRoom(OBJ_VASE) || _game._trigger) { + _animationMode = 2; + handleRexDeath(); + _action._inProgress = false; + return; + } + } + + if (_action.isAction(VERB_PUT, 0x344) && _game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId))) { + warning("Replace the next if when the function is implemented"); + warning("if (sub_13D46(_game._objects.getIdFromDesc(_action._activeAction._objectNameId), 0xA))"); + if (true) + _vm->_dialogs->show(70626); + else + _vm->_dialogs->show(70627); + } else if (_action.isAction(VERB_TAKE, 0x2E) && _game._objects.isInInventory(OBJ_VASE)) + _vm->_dialogs->show(70631); + else if (_action._lookFlag) { + if (_game._objects[OBJ_VASE]._roomNumber == _scene->_currentSceneId) + _vm->_dialogs->show(70610); + else + _vm->_dialogs->show(70611); + } else if (_action.isAction(VERB_LOOK, 0x89)) + _vm->_dialogs->show(70612); + else if (_action.isAction(VERB_LOOK, 0x32B)) + _vm->_dialogs->show(70613); + else if (_action.isAction(VERB_LOOK, 0x46B)) + _vm->_dialogs->show(70614); + else if (_action.isAction(VERB_TAKE, 0x46B)) + _vm->_dialogs->show(70615); + else if (_action.isAction(VERB_LOOK, 0x46D)) + _vm->_dialogs->show(70616); + else if (_action.isAction(VERB_LOOK, 0x46E)) + _vm->_dialogs->show(70617); + else if (_action.isAction(VERB_LOOK, 0x46C)) + _vm->_dialogs->show(70618); + else if (_action.isAction(VERB_LOOK, 0x18D)) + _vm->_dialogs->show(70619); + else if (_action.isAction(VERB_LOOK, 0x344)) { + if (_game._objects[OBJ_VASE]._roomNumber == _scene->_currentSceneId) + _vm->_dialogs->show(70620); + else if (_game._objects[OBJ_BOTTLE]._roomNumber == _scene->_currentSceneId) + _vm->_dialogs->show(70622); + else + _vm->_dialogs->show(70621); + } else if (_action.isAction(VERB_LOOK, 0x16C)) + _vm->_dialogs->show(70623); + else if (_action.isAction(VERB_LOOK, 0x17D) && (_game._objects[OBJ_VASE]._roomNumber == _scene->_currentSceneId)) + _vm->_dialogs->show(70624); + else if (_action.isAction(VERB_LOOK, 0x2E) && (_action._mainObjectSource == 4)) + _vm->_dialogs->show(70632); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + void Scene707::setup() { _game._player._spritesPrefix = ""; // The original calls Scene7xx::setAAName() @@ -1809,7 +2080,7 @@ void Scene752::actions() { default: break; } - } else if (_action.isAction(VERB_TAKE, NOUN_BONES) && _action._mainObjectSource == 4 && (!_game._objects.isInInventory(OBJ_BONES) || _game._trigger)) { + } else if (_action.isAction(VERB_TAKE, NOUN_BONES) && (_action._mainObjectSource == 4) && (!_game._objects.isInInventory(OBJ_BONES) || _game._trigger)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -1851,12 +2122,12 @@ void Scene752::actions() { _vm->_dialogs->show(75217); else if (_action.isAction(VERB_LOOK, NOUN_TELEPORTER)) _vm->_dialogs->show(75218); - else if ((_action.isAction(VERB_LOOK, NOUN_BONES) || _action.isAction(VERB_LOOK, NOUN_ID_CARD)) && _action._mainObjectSource == 4) { + else if ((_action.isAction(VERB_LOOK, NOUN_BONES) || _action.isAction(VERB_LOOK, NOUN_ID_CARD)) && (_action._mainObjectSource == 4)) { if (_game._objects[OBJ_ID_CARD]._roomNumber == 752) _vm->_dialogs->show(75219); else _vm->_dialogs->show(75220); - } else if (_action.isAction(VERB_TAKE, NOUN_BONES) && _action._mainObjectSource == 4) { + } else if (_action.isAction(VERB_TAKE, NOUN_BONES) && (_action._mainObjectSource == 4)) { if (_game._objects.isInInventory(OBJ_BONES)) _vm->_dialogs->show(75222); } else diff --git a/engines/mads/nebular/nebular_scenes7.h b/engines/mads/nebular/nebular_scenes7.h index 06d5d04b1f..f5f9867fab 100644 --- a/engines/mads/nebular/nebular_scenes7.h +++ b/engines/mads/nebular/nebular_scenes7.h @@ -151,6 +151,29 @@ public: virtual void postActions() {}; }; +class Scene706: public Scene7xx{ +private: + int _vaseHotspotId; + int _vaseMode; // CHECKME: Use? + int _animationMode; + int _animationFrame; + + bool _emptyPedestral; + + void handleTakeVase(); + void handleRexDeath(); + +public: + Scene706(MADSEngine *vm) : Scene7xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; + class Scene707: public SceneTeleporter { public: Scene707(MADSEngine *vm) : SceneTeleporter(vm) {} -- cgit v1.2.3 From d590ca39d139136cf616d80beb525ff3a07acca2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 16 May 2014 18:30:41 -0400 Subject: MADS: Properly implemented object quality code --- engines/mads/inventory.cpp | 54 +++++++++++++++++++++----------- engines/mads/inventory.h | 35 +++++++++++++++------ engines/mads/nebular/game_nebular.cpp | 14 ++++++--- engines/mads/nebular/nebular_scenes4.cpp | 29 +++++++---------- engines/mads/nebular/nebular_scenes7.cpp | 5 ++- 5 files changed, 84 insertions(+), 53 deletions(-) diff --git a/engines/mads/inventory.cpp b/engines/mads/inventory.cpp index 79a8e87b2a..434d284244 100644 --- a/engines/mads/inventory.cpp +++ b/engines/mads/inventory.cpp @@ -31,16 +31,46 @@ void InventoryObject::synchronize(Common::Serializer &s) { s.syncAsUint16LE(_roomNumber); s.syncAsByte(_article); s.syncAsByte(_vocabCount); + s.syncAsByte(_qualitiesCount); + s.skip(1); - for (int i = 0; i < 3; ++i) { + for (int i = 0; i < MAX_VOCAB; ++i) { + s.syncAsUint16LE(_vocabList[i]._vocabId); s.syncAsByte(_vocabList[i]._verbType); s.syncAsByte(_vocabList[i]._prepType); - s.syncAsUint16LE( _vocabList[i]._vocabId); } - s.skip(4); // field12 - s.syncBytes((byte *)&_mutilateString[0], 10); - s.skip(16); + for (int i = 0; i < MAX_QUALITIES; ++i) + s.syncAsByte(_qualityId[i]); + for (int i = 0; i < MAX_QUALITIES; ++i) + s.syncAsSint32LE(_qualityValue[i]); +} + +bool InventoryObject::hasQuality(int qualityId) const { + for (int i = 0; i < _qualitiesCount; ++i) { + if (_qualityId[i] == qualityId) + return true; + } + + return false; +} + +void InventoryObject::setQuality(int qualityId, int qualityValue) { + for (int i = 0; i < _qualitiesCount; ++i) { + if (_qualityId[i] == qualityId) { + _qualityValue[i] = qualityValue; + } + } +} + +int InventoryObject::getQuality(int qualityId) const { + for (int i = 0; i < _qualitiesCount; ++i) { + if (_qualityId[i] == qualityId) { + return _qualityValue[i]; + } + } + + return 0; } /*------------------------------------------------------------------------*/ @@ -92,20 +122,6 @@ void InventoryObjects::synchronize(Common::Serializer &s) { } } -void InventoryObjects::setQuality(int objIndex, int id, const byte *p) { - // TODO: This whole method seems weird. Check it out more thoroughly once - // more of the engine is implemented - for (int i = 0; i < (int)size(); ++i) { - InventoryObject &obj = (*this)[i]; - if (obj._vocabList[0]._verbType <= i) - break; - - if (obj._mutilateString[6 + i] == id) { - (*this)[objIndex]._objFolder = p; - } - } -} - void InventoryObjects::setRoom(int objectId, int sceneNumber) { InventoryObject &obj = (*this)[objectId]; diff --git a/engines/mads/inventory.h b/engines/mads/inventory.h index 9d79431050..7fb123e047 100644 --- a/engines/mads/inventory.h +++ b/engines/mads/inventory.h @@ -35,24 +35,46 @@ enum { class MADSEngine; +#define MAX_VOCAB 5 +#define MAX_QUALITIES 4 + class InventoryObject { public: int _descId; int _roomNumber; int _article; int _vocabCount; + int _qualitiesCount; + int syntax; + struct { + int _vocabId; VerbType _verbType; PrepType _prepType; - int _vocabId; - } _vocabList[3]; - char _mutilateString[10]; // ??? - const byte *_objFolder; // ??? + } _vocabList[MAX_VOCAB]; + + int _qualityId[MAX_QUALITIES]; + int _qualityValue[MAX_QUALITIES]; /** * Synchronizes the data for a given object */ void synchronize(Common::Serializer &s); + + /** + * Returns true if the given object has the specified quality + */ + bool hasQuality(int qualityId) const; + + /** + * Sets the quality value for a given quality Id + */ + void setQuality(int qualityId, int qualityValue); + + /** + * Gets the quality value for a given quality Id + */ + int getQuality(int qualityId) const; }; class InventoryObjects: public Common::Array { @@ -84,11 +106,6 @@ public: return (*this)[_inventoryList[itemIndex]]; } - /** - * Set the associated quality data for an inventory object - */ - void setQuality(int objIndex, int id, const byte *p); - /** * Sets an item's scene number */ diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index 600c153088..1ec025c8e1 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -98,7 +98,7 @@ void GameNebular::initialiseGlobals() { /* Section #4 variables */ _globals[kBadFirstIngredient] = -1; - _objects.setQuality(OBJ_CHARGE_CASES, EXPLOSIVES_INSIDE, nullptr); + _objects[OBJ_CHARGE_CASES].setQuality(EXPLOSIVES_INSIDE, 0); _globals[kHasPurchased] = false; _globals[kBeenThruHelgaScene] = false; _globals[kNextIngredient] = 0; @@ -394,8 +394,7 @@ void GameNebular::doObjectAction() { dialogs.showItem(id, 402); } else { int messageId = 800 + id; - if (id == OBJ_CHARGE_CASES) { - error("TODO: object_get_folder - loc_29B48"); + if ((id == OBJ_CHARGE_CASES) && _objects[OBJ_CHARGE_CASES].getQuality(3) != 0) { messageId = 860; } @@ -435,7 +434,14 @@ void GameNebular::doObjectAction() { dialogs.show(_globals[kTopButtonPushed] ? 502 : 501); } else if ((action.isAction(25, 106, 72) || action.isAction(VERB_PUT, 106, 72)) && _objects.isInInventory(OBJ_DETONATORS) && _objects.isInInventory(OBJ_CHARGE_CASES)) { - error("TODO: loc_29DBA"); + if (_objects[OBJ_CHARGE_CASES].getQuality(3)) { + _objects.setRoom(OBJ_CHARGE_CASES, 1); + _objects.setRoom(OBJ_DETONATORS, 1); + _objects.addToInventory(OBJ_BOMBS); + dialogs.showItem(OBJ_BOMBS, 403); + } else { + dialogs.show(405); + } } else if (action.isAction(25, 106)) { dialogs.show(470); } else if ((action.isAction(25, 371, 43) || action.isAction(7, 371, 43) || action.isAction(25, 371, 42) diff --git a/engines/mads/nebular/nebular_scenes4.cpp b/engines/mads/nebular/nebular_scenes4.cpp index 91c522cd25..e8e9596e9d 100644 --- a/engines/mads/nebular/nebular_scenes4.cpp +++ b/engines/mads/nebular/nebular_scenes4.cpp @@ -3513,8 +3513,7 @@ void Scene411::enter() { _dialog3.setup(0x5D, 0x254, 0x260, 0x25C, 0x258, 0x262, -1); _dialog4.setup(0x5E, 0x255, 0x261, 0x25D, 0x259, 0x262, -1); - warning("TODO: Replace the next line by: if ((_globals[kNextIngredient] >= 4) && (!object_get_folder(OBJ_CHARGE_CASES, 3))) {"); - if (_globals[kNextIngredient] >= 4) { + if (_globals[kNextIngredient] >= 4 && _game._objects[OBJ_CHARGE_CASES].getQuality(3)) { _scene->_hotspots.activate(0x3AB, false); _scene->_hotspots.activate(0x30D, true); } else { @@ -3522,11 +3521,9 @@ void Scene411::enter() { _scene->_hotspots.activate(0x3AB, true); } - warning("TODO: Replace the next line by: if ((!_globals[kNextIngredient] >= 4) && (object_get_folder(OBJ_CHARGE_CASES, 3))) {"); - if (!(_globals[kNextIngredient] >= 4)) + if (_globals[kNextIngredient] >= 4 && _game._objects[OBJ_CHARGE_CASES].getQuality(3)) { _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], true, 6); - else if (true) { - warning("TODO: The previous if was: else if (!object_get_folder(OBJ_CHARGE_CASES, 3)) {"); + } else if (!_game._objects[OBJ_CHARGE_CASES].getQuality(3)) { switch (_globals[kNextIngredient]) { case 1: _vm->_sound->command(53); @@ -3559,8 +3556,7 @@ void Scene411::enter() { } } - warning("TODO: Replace the next if by: if ((_globals[kNextIngredient] >= 4) && (object_get_folder(OBJ_CHARGE_CASES, 3))) {"); - if (_globals[kNextIngredient] >= 4) { + if (_globals[kNextIngredient] >= 4 && _game._objects[OBJ_CHARGE_CASES].getQuality(3)) { _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], true, 6); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 1); } @@ -3722,9 +3718,9 @@ void Scene411::actions() { return; } - warning("TODO: add the following condition to the if statement: (!object_get_folder(OBJ_CHARGE_CASES, 3)) &&"); - if ((_globals[kNextIngredient] >= 4) && (_action.isAction(VERB_TAKE, 0x3AB) || _action.isAction(VERB_PUT, 0x48, 0x3AB)) && - (_game._objects.isInInventory(OBJ_CHARGE_CASES))) { + if ((_globals[kNextIngredient] >= 4) && (_action.isAction(VERB_TAKE, 0x3AB) || _action.isAction(VERB_PUT, 0x48, 0x3AB)) + && !_game._objects[OBJ_CHARGE_CASES].getQuality(3) + && _game._objects.isInInventory(OBJ_CHARGE_CASES)) { switch (_game._trigger) { case 0: _vm->_sound->command(10); @@ -3764,7 +3760,7 @@ void Scene411::actions() { _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; _game._player._visible = true; _game._player._stepEnabled = true; - warning("TODO: InventoryObjects_setData(OBJ_CHARGE_CASES, 3, true);"); + _game._objects[OBJ_CHARGE_CASES].setQuality(3, 1); _vm->_dialogs->showItem(OBJ_CHARGE_CASES, 41142); break; } @@ -3927,15 +3923,12 @@ void Scene411::actions() { else if ((_action.isAction(VERB_LOOK, 0x3A9)) && (_game._objects.isInRoom(OBJ_LECITHIN))) _vm->_dialogs->show(41123); else if (_action.isAction(VERB_LOOK, 0x30D)) { - if (_globals[kNextIngredient] > 0) { - warning("TODO: the if statement should be: if ((_globals[kNextIngredient] > 0) && !object_get_folder(OBJ_CHARGE_CASES, 3))"); + if (_globals[kNextIngredient] > 0 && !_game._objects[OBJ_CHARGE_CASES].getQuality(3)) { _vm->_dialogs->show(41126); - } else if (_globals[kNextIngredient] == 0) { - warning("TODO: the if statement should be: else if ((_globals[kNextIngredient] == 0) || object_get_folder(OBJ_CHARGE_CASES, 3)) {"); + } else if (_globals[kNextIngredient] == 0 || _game._objects[OBJ_CHARGE_CASES].getQuality(3)) { _vm->_dialogs->show(41125); } - } else if (_action.isAction(VERB_LOOK, 0x3AB)) { - warning("TODO: The if statement should be if (_action.isAction(VERB_LOOK, 0x3AB) && !object_get_folder(OBJ_CHARGE_CASES, 3)) {"); + } else if (_action.isAction(VERB_LOOK, 0x3AB) && _game._objects[OBJ_CHARGE_CASES].getQuality(3) == 0) { _vm->_dialogs->show(41127); } else if (_action.isAction(VERB_TAKE, 0x30D)) _vm->_dialogs->show(41128); diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index 94bb7b66b2..385141d318 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -1785,9 +1785,8 @@ void Scene706::actions() { } if (_action.isAction(VERB_PUT, 0x344) && _game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId))) { - warning("Replace the next if when the function is implemented"); - warning("if (sub_13D46(_game._objects.getIdFromDesc(_action._activeAction._objectNameId), 0xA))"); - if (true) + int objectId = _game._objects.getIdFromDesc(_action._activeAction._objectNameId); + if (_game._objects[objectId].hasQuality(10)) _vm->_dialogs->show(70626); else _vm->_dialogs->show(70627); -- cgit v1.2.3 From 5d62f6bb296ffd7dd62b0e75ccaa5df776bdc13b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 17 May 2014 00:37:04 +0200 Subject: MADS: Implement scene 751 --- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes7.cpp | 333 ++++++++++++++++++++++++++++++- engines/mads/nebular/nebular_scenes7.h | 15 ++ 3 files changed, 345 insertions(+), 5 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index a626bdf05f..958c3dd1b8 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -269,7 +269,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 711: // inside teleporter return new Scene711(vm); case 751: // outside elevator (before city is submerged) - return new DummyScene(vm); // TODO + return new Scene751(vm); case 752: // outside teleporter (before city is submerged) return new Scene752(vm); diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index 385141d318..1ce95667e4 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -1413,7 +1413,7 @@ void Scene705::enter() { void Scene705::step() { switch (_game._trigger) { case 70: - _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle (_globals._spriteIndexes[3], false, 9, 1, 0, 0); + _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 9, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 4); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 71); break; @@ -1432,7 +1432,7 @@ void Scene705::step() { switch (_game._trigger) { case 80: - _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle (_globals._spriteIndexes[1], false, 9, 1, 0, 0); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 9, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 2); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 81); break; @@ -1497,7 +1497,7 @@ void Scene705::actions() { case 0: _game._player._stepEnabled = false; _scene->_sequences.remove(_globals._sequenceIndexes[3]); - _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle (_globals._spriteIndexes[2], false, 6, 1, 0, 0); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 6, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 2); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 1); _vm->_sound->command(18); @@ -1521,7 +1521,7 @@ void Scene705::actions() { case 0: _game._player._stepEnabled = false; _scene->_sequences.remove(_globals._sequenceIndexes[3]); - _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle (_globals._spriteIndexes[3], false, 6, 1, 0, 0); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 6, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 16); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 1); break; @@ -1973,6 +1973,331 @@ void Scene711::actions() { /*------------------------------------------------------------------------*/ +void Scene751::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(0x87); + _scene->addActiveVocab(0xD); +} + +void Scene751::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites("*RM701X0"); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('a', 0)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('f', 0)); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites("*RM202A1"); + + if (!_game._visitedScenes._sceneRevisited) + _rexHandingLine = false; + + if (_globals[kLineStatus] == 2 || _globals[kLineStatus] == 3) { + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 7); + int idx = _scene->_dynamicHotspots.add(0x87, 0xD, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(268, 140), FACING_NORTHWEST); + } + + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); + + if (_scene->_priorSceneId == 752) { + _game._player._playerPos = Common::Point(309, 138); + _game._player._facing = FACING_WEST; + } else if (_scene->_priorSceneId == 710) { + _game._player._playerPos = Common::Point(154, 129); + _game._player._facing = FACING_NORTH; + _game._player._visible = false; + _game._player._stepEnabled = false; + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, -2); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(155, 129)); + _scene->_sequences.addTimer(15, 70); + } else if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(22, 131); + _game._player._facing = FACING_EAST; + _game._player._stepEnabled = false; + _scene->_sequences.addTimer(60, 60); + } else if (_rexHandingLine) { + _game._player._visible = false; + _game._player._playerPos = Common::Point(268, 140); + _game._player._facing = FACING_NORTHWEST; + _game._player._visible = false; + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 7); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[2]); + } else if (_globals[kLineStatus] == 2) { + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 7); + int idx = _scene->_dynamicHotspots.add(0x87, 0xD, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(268, 140), FACING_NORTHWEST); + } + + if (_scene->_roomChanged) { + _game._objects.addToInventory(OBJ_FISHING_LINE); + _game._objects.addToInventory(OBJ_BINOCULARS); + } + + sceneEntrySound(); + _game.loadQuoteSet(0x30A, 0x30B, 0x30C, 0x30D, 0x30E, 0); + + if (_globals[kTimebombTimer] > 0) + _globals[kTimebombTimer] = 10200; +} + +void Scene751::step() { + switch (_game._trigger) { + case 70: + _scene->_sequences.remove(_globals._sequenceIndexes[4]); + _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 6, 1, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(155, 129)); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 71); + break; + + case 71: + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[4]); + _game._player._visible = true; + _game._player._stepEnabled = true; + break; + + default: + break; + } + + if ((_globals[kTimebombTimer] >= 10800) && (_globals[kTimebombStatus] == 1)) { + _globals[kTimebombStatus] = 3; + _globals[kTimebombTimer] = 0; + _globals[kCheckDaemonTimebomb] = false; + _scene->_nextSceneId = 620; + } + + switch (_game._trigger) { + case 60: + _vm->_sound->command(16); + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 5, 1, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 61); + break; + + case 61: + _game._player.walk(Common::Point(61, 131), FACING_EAST); + _scene->_sequences.addTimer(120, 62); + break; + + case 62: + _vm->_sound->command(17); + _globals._sequenceIndexes[1] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 5, 1, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 63); + break; + + case 63: + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); + _game._player._stepEnabled = true; + _scene->_kernelMessages.reset(); + break; + + default: + break; + } +} + +void Scene751::preActions() { + if (_action.isAction(VERB_LOOK, 0x470)) + _game._player.walk(Common::Point(154, 129), FACING_NORTHEAST); + + if (_action.isAction(VERB_LOOK, 0x27, 0x470)) + _game._player.walk(Common::Point(154, 129), FACING_NORTH); + + if (_action.isAction(VERB_WALKTO, 0x4AA)) + _game._player._walkOffScreenSceneId = 752; + + if (!_rexHandingLine) + return; + + if (_action.isAction(VERB_LOOK) || _action.isAction(0x87) || _action.isAction(VERB_TALKTO)) + _game._player._needToWalk = false; + + if ((!_action.isAction(VERB_PUT, 0x87, 0x467) || !_action.isAction(0x170, 0x87, 0x467) || !_action.isAction(0x19, 0x87, 0x467)) + && (_game._player._needToWalk)) { + switch (_game._trigger) { + case 0: + _game._player._readyToWalk = false; + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 11, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], -1, 7); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 1); + break; + + case 1: + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[2]); + _game._player._visible = true; + _rexHandingLine = false; + _game._player._stepEnabled = true; + _game._player._readyToWalk = true; + break; + + default: + break; + } + } +} + +void Scene751::actions() { + if (_action.isAction(0x312, 0x22C)) + ; // Nothing + else if (_action.isAction(VERB_LOOK, 0x27, 0x470)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 6, 1, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(155, 129)); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 1); + break; + + case 1: { + int syncIdx = _globals._sequenceIndexes[4]; + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, -2); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(155, 129)); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], syncIdx); + _scene->_sequences.addTimer(15, 2); + } + break; + + case 2: + _scene->_nextSceneId = 710; + break; + + default: + break; + } + } else if (_action.isAction(0x2F9, 0x317)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _vm->_sound->command(16); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 5, 1, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x30D)); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 1); + break; + + case 1: + _game._player.walk(Common::Point(22, 131), FACING_EAST); + _scene->_sequences.addTimer(120, 3); + break; + + case 3: + _vm->_sound->command(17); + _globals._sequenceIndexes[1] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 5, 1, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 4); + break; + + case 4: + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); + _scene->_sequences.addTimer(60, 5); + break; + + case 5: + _game._player._stepEnabled = true; + _scene->_nextSceneId = 513; + break; + + default: + break; + } + } else if (_action.isAction(VERB_PUT, 0x87, 0x467) || _action.isAction(0x170, 0x87, 0x467) || _action.isAction(0x19, 0x87, 0x467)) { + if (_globals[kLineStatus] == 1) { + switch (_game._trigger) { + case 0: + _game._player._visible = false; + _game._player._stepEnabled = false; + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], -1, 6); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], -1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 1); + break; + + case 1: { + int syncIdx = _globals._sequenceIndexes[2]; + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 7); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], syncIdx); + _scene->_sequences.addTimer(30, 2); + } + break; + + case 2: + _rexHandingLine = true; + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 8, -2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 3); + break; + + case 3: { + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[2]); + _game._player._visible = true; + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 7); + int idx = _scene->_dynamicHotspots.add(0x87, 0xD, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(268, 140), FACING_NORTHWEST); + _scene->_kernelMessages.reset(); + _game._objects.setRoom(OBJ_FISHING_LINE, _scene->_currentSceneId); + _rexHandingLine = false; + _globals[kLineStatus] = 2; + _game._player._stepEnabled = true; + _vm->_dialogs->show(75120); + } + break; + + default: + break; + } + } + } else if (_action._lookFlag || _action.isAction(VERB_LOOK, 0x38F)) + _vm->_dialogs->show(75110); + else if (_action.isAction(VERB_LOOK, 0x317)) + _vm->_dialogs->show(75112); + else if (_action.isAction(VERB_LOOK, 0x22C)) + _vm->_dialogs->show(75113); + else if (_action.isAction(VERB_LOOK, 0x316)) + _vm->_dialogs->show(75114); + else if ((_action.isAction(VERB_LOOK, 0x467) || _action.isAction(VERB_LOOK, 0x87)) + && (_globals[kLineStatus] == 2 || _globals[kLineStatus] == 3)) + _vm->_dialogs->show(75116); + else if (_action.isAction(VERB_LOOK, 0x467)) + _vm->_dialogs->show(75115); + else if (_action.isAction(VERB_LOOK, 0x128)) + _vm->_dialogs->show(75117); + else if (_action.isAction(VERB_TAKE, 0x128)) + _vm->_dialogs->show(75118); + else if (_action.isAction(VERB_LOOK, 0x4AA)) + _vm->_dialogs->show(75119); + else if (_action.isAction(VERB_TAKE, 0x87) && (_globals[kLineStatus] == 3 || _globals[kLineStatus] == 2)) + _vm->_dialogs->show(75121); + else if (_action.isAction(VERB_LOOK, 0x470)) + _vm->_dialogs->show(75122); + else if (_action.isAction(0x170, 0x87, 0x316) || _action.isAction(0x19, 0x87, 0x316)) + _vm->_dialogs->show(75123); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + void Scene752::setup() { setPlayerSpritesPrefix(); setAAName(); diff --git a/engines/mads/nebular/nebular_scenes7.h b/engines/mads/nebular/nebular_scenes7.h index f5f9867fab..6b128dbe6a 100644 --- a/engines/mads/nebular/nebular_scenes7.h +++ b/engines/mads/nebular/nebular_scenes7.h @@ -204,6 +204,21 @@ public: virtual void actions(); }; +class Scene751: public Scene7xx{ +private: + bool _rexHandingLine; + +public: + Scene751(MADSEngine *vm) : Scene7xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; + class Scene752: public Scene7xx { private: int _cardId; -- cgit v1.2.3 From 622f97244df3f6bf80c86c4452f064bee8871e3d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 16 May 2014 23:02:35 -0400 Subject: MADS: In progress framework for on-screen random messages --- engines/mads/messages.cpp | 45 +++++++++++++++++++++++++++++++- engines/mads/messages.h | 30 +++++++++++++++++++++ engines/mads/nebular/nebular_scenes2.cpp | 32 ++++++++++++++++------- engines/mads/nebular/nebular_scenes3.cpp | 13 ++++++--- 4 files changed, 106 insertions(+), 14 deletions(-) diff --git a/engines/mads/messages.cpp b/engines/mads/messages.cpp index e498ab9621..8ec6350236 100644 --- a/engines/mads/messages.cpp +++ b/engines/mads/messages.cpp @@ -36,6 +36,9 @@ KernelMessages::KernelMessages(MADSEngine *vm): _vm(vm) { } _talkFont = _vm->_font->getFont(FONT_CONVERSATION); + + _randomMaxMessages = 0; + resetRandomMessages(); } KernelMessages::~KernelMessages() { @@ -138,7 +141,7 @@ void KernelMessages::reset() { remove(i); _talkFont = _vm->_font->getFont(FONT_CONVERSATION); - warning("TODO: KernelMessages::reset - sub_20454"); + resetRandomMessages(); } void KernelMessages::update() { @@ -303,6 +306,46 @@ void KernelMessages::setQuoted(int msgIndex, int numTicks, bool quoted) { } } +void KernelMessages::resetRandomMessages() { + for (int i = 0; i < RANDOM_MESSAGE_SIZE; ++i) { + _randomMessages[i]._handle = -1; + _randomMessages[i]._quote = -1; + } +} + +#define RANDOM_MESSAGE_TRIGGER 240 + +void KernelMessages::randomServer() { + if ((_vm->_game->_trigger >= RANDOM_MESSAGE_TRIGGER) && + (_vm->_game->_trigger < (RANDOM_MESSAGE_TRIGGER + _randomMaxMessages))) { + _randomMessages[_vm->_game->_trigger - RANDOM_MESSAGE_TRIGGER]._handle = -1; + _randomMessages[_vm->_game->_trigger - RANDOM_MESSAGE_TRIGGER]._quote = -1; + } +} + +int KernelMessages::checkRandom() { + int total = 0; + + for (int i = 0; i < _randomMaxMessages; ++i) { + if (_randomMessages[i]._handle >= 0) + ++total; + } + + return total; +} + +bool KernelMessages::generateRandom(int major, int minor) { + // TODO + return false; +} + +void KernelMessages::initRandomMessages(int maxSimultaneousMessages, + const Common::Rect &bounds, int minYSpacing, int scrollRate, + int color, int duration, int quoteId, ...) { + // TODO +} + + /*------------------------------------------------------------------------*/ TextDisplay::TextDisplay() { diff --git a/engines/mads/messages.h b/engines/mads/messages.h index 8aa8cd54da..7211598dff 100644 --- a/engines/mads/messages.h +++ b/engines/mads/messages.h @@ -34,6 +34,7 @@ namespace MADS { #define KERNEL_MESSAGES_SIZE 10 #define INDEFINITE_TIMEOUT 9999999 #define TEXT_DISPLAY_SIZE 40 +#define RANDOM_MESSAGE_SIZE 4 enum KernelMessageFlags { KMSG_QUOTED = 1, KMSG_PLAYER_TIMEOUT = 2, KMSG_SEQ_ENTRY = 4, KMSG_SCROLL = 8, @@ -67,9 +68,19 @@ public: class KernelMessages { private: MADSEngine *_vm; + + struct RandomEntry { + int _handle; + int _quote; + }; + RandomEntry _randomMessages[RANDOM_MESSAGE_SIZE]; + int _randomMaxMessages; + + void resetRandomMessages(); public: Common::Array _entries; Font *_talkFont; +public: KernelMessages(MADSEngine *vm); ~KernelMessages(); @@ -85,6 +96,25 @@ public: void processText(int msgIndex); void delay(uint32 priorFrameTime, uint32 currentTime); void setQuoted(int msgIndex, int numTicks, bool quoted); + + void initRandomMessages(int maxSimultaneousMessages, + const Common::Rect &bounds, int minYSpacing, int scrollRate, + int color, int duration, int quoteId, ...); + + /** + * Handles expiring any active random messages as necessary + */ + void randomServer(); + + /** + * Return the number of currently active random messages + */ + int checkRandom(); + + /** + * Handles generating new random messages + */ + bool generateRandom(int major, int minor); }; class TextDisplay { diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index a86b78f90a..1f5200ab92 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -1174,7 +1174,9 @@ void Scene205::enter() { _chickenTime = _vm->_game->_scene._frameStartTime; if (_globals[kSexOfRex] == SEX_FEMALE) - warning("sub71704(0x3, 0xC3, 0x108, 0x63, 0x86, 0xD, 2, 0xFDFC, 0x3C, 0x6C, 0x6C, 0x6D, 0x6D, 0x6E, 0x6E, 0x6F, 0x6C, 0);"); + _scene->_kernelMessages.initRandomMessages(3, + Common::Rect(195, 99, 264, 134), 13, 2, 0xFDFC, 60, + 108, 108, 109, 109, 110, 110, 111, 108, 0); if (_scene->_priorSceneId != -2) _game._player._playerPos = Common::Point(99, 152); @@ -1196,13 +1198,18 @@ void Scene205::enter() { } void Scene205::step() { + int chanceMajor, chanceMinor; + if (_globals[kSexOfRex] == SEX_FEMALE) { - warning("TODO: sub7178C()"); + _scene->_kernelMessages.randomServer(); if (_vm->_game->_scene._frameStartTime >= _chickenTime) { - warning("TODO: if (sub717B2(100, 1 + sub7176C())) {"); - _vm->_sound->command(28); - // } + chanceMajor = 100; + chanceMinor = _scene->_kernelMessages.checkRandom() + 1; + + if (_scene->_kernelMessages.generateRandom(chanceMajor, chanceMinor)) + _vm->_sound->command(28); + _chickenTime = _vm->_game->_scene._frameStartTime + 2; } } @@ -4553,7 +4560,9 @@ void Scene211::enter() { _game.loadQuoteSet(0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 1, 0); if (_globals[kMonkeyStatus] == MONKEY_AMBUSH_READY) - warning("sub71704(0x2, 0x0, 0x36, 0x0, 0x1E, 0xD, 2, 0xFDFC, 0x3C, 0x97, 0x98, 0x99, 0x9A, 0);"); + _scene->_kernelMessages.initRandomMessages(2, + Common::Rect(0, 0, 54, 30), 13, 2, 0xFDFC, 60, + 151, 152, 153, 154, 0); _monkeyTime = _vm->_game->_scene._frameStartTime; _scrollY = 30; @@ -4565,13 +4574,18 @@ void Scene211::enter() { } void Scene211::step() { + int chanceMajor, chanceMinor; + if (_globals[kMonkeyStatus] == MONKEY_AMBUSH_READY) { - warning("TODO: sub7178C()"); + _scene->_kernelMessages.randomServer(); if (!_ambushFl && !_wakeFl && (_vm->_game->_scene._frameStartTime >= _monkeyTime)) { - warning("if (sub717B2(80, 1 + sub7176C())) {"); + chanceMajor = 80; + chanceMinor = _scene->_kernelMessages.checkRandom() * 4 + 1; + + if (_scene->_kernelMessages.generateRandom(chanceMajor, chanceMinor)) _vm->_sound->command(18); - // } + _monkeyTime = _vm->_game->_scene._frameStartTime + 2; } diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index aca9b8b18e..4652c51d13 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -5536,7 +5536,9 @@ void Scene389::enter() { else { _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('m', -1)); _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 6, 0, 0, 0); - warning("TODO: sub71704(1, 88, 177, 19, 17, 0xD, 2, 0xFDFC, 0x3C, 0xF7, 0xF8, 0xF9, 0);"); + _scene->_kernelMessages.initRandomMessages(1, + Common::Rect(88, 19, 177, 77), 13, 2, 0xFDFC, 60, + 247, 248, 249, 0); } _vm->_palette->setEntry(252, 63, 37, 26); @@ -5548,10 +5550,13 @@ void Scene389::enter() { } void Scene389::step() { - warning("TODO: sub7178C()"); - + int chanceMajor, chanceMinor; + + _scene->_kernelMessages.randomServer(); if (_scene->_frameStartTime >= _monsterTime) { - warning("sub717B2(20, (sub7176C() << 2) + 1);"); + chanceMajor = 20; + chanceMinor = _scene->_kernelMessages.checkRandom() * 4 + 1; + _scene->_kernelMessages.generateRandom(chanceMajor, chanceMinor); _monsterTime = _scene->_frameStartTime + 2; } } -- cgit v1.2.3 From 3ceaafd1f9f52d0156beeb579564071071d8e2a3 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 17 May 2014 08:02:37 +0300 Subject: FULLPIPE: Started implementation of movGraphCallback() --- engines/fullpipe/motion.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 1712c88684..ccf5fa1483 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -529,14 +529,27 @@ void MovGraphItem::free() { int MovGraph_messageHandler(ExCommand *cmd); -MovArr *MovGraphCallback(StaticANIObject *ani, MovItem *item, signed int counter) { - warning("STUB: MovgraphCallback"); +MovArr *movGraphCallback(StaticANIObject *ani, MovItem *item, signed int counter) { +#if 0 +MovArr *movGraphCallback(StaticANIObject *ani, Common:Array items, int itemidx, signed int counter) { + int residx = itemidx; + + while (counter > 1) { + if (items[itemidx]._mfield_4 > items[itemidx + 1]._mfield_4) + residx = itemidx; + + counter--; + itemidx++; + } + + return items[residx].movarr; +#endif return 0; } MovGraph::MovGraph() { - _callback1 = MovGraphCallback; + _callback1 = movGraphCallback; _field_44 = 0; insertMessageHandler(MovGraph_messageHandler, getMessageHandlersCount() - 1, 129); -- cgit v1.2.3 From dc1d78e8ad86bc608064cc4c3daf54247a1ccee2 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 17 May 2014 09:52:21 +0200 Subject: MADS: Implement scene 801 --- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes8.cpp | 228 ++++++++++++++++++++++++++++++- engines/mads/nebular/nebular_scenes8.h | 15 ++ 3 files changed, 242 insertions(+), 3 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 958c3dd1b8..d8eadc1860 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -275,7 +275,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { // Scene group #8 case 801: // control room, outside teleporter - return new DummyScene(vm); // TODO + return new Scene801(vm); case 802: // launch pad with destroyed ship return new DummyScene(vm); // TODO case 803: // empty launch pad diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index 296fd74c34..13ab001bae 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -11,7 +11,7 @@ * 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 + * 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 @@ -76,6 +76,230 @@ void Scene8xx::sceneEntrySound() { /*------------------------------------------------------------------------*/ +void Scene801::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene801::enter() { + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 1)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 0)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 2)); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('x', 3)); + _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('a', -1)); + + if (_scene->_priorSceneId != 802) { + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 5); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 13); + } + + if ((_globals[kCameFromCut]) && (_globals[kCutX] != 0)) { + _game._player._playerPos = Common::Point(_globals[kCutX], _globals[kCutY]); + _game._player._facing = (Facing)_globals[kCutFacing]; + _globals[kCutX] = 0; + _globals[kCameFromCut] = false; + _globals[kReturnFromCut] = false; + _globals[kBeamIsUp] = false; + _globals[kForceBeamDown] = false; + _globals[kDontRepeat] = false; + } else if (_scene->_priorSceneId == 808) { + _game._player._playerPos = Common::Point(148, 110); + _game._player._facing = FACING_NORTH; + } else if (_scene->_priorSceneId == 802) { + _game._player._playerPos = Common::Point(307, 111); + _game._player.walk(Common::Point(270, 118), FACING_WEST); + _game._player._visible = true; + } else if ((_scene->_priorSceneId != -2) && !_globals[kTeleporterCommand]) { + _game._player._playerPos = Common::Point(8, 117); + _game._player.walk(Common::Point(41, 115), FACING_EAST); + _game._player._visible = true; + } + + _globals[kBetweenRooms] = false; + + if (_globals[kTeleporterCommand]) { + _game._player._stepEnabled = false; + switch (_globals[kTeleporterCommand]) { + case 1: + _game._player._playerPos = Common::Point(8, 117); + _globals[kTeleporterUnderstood] = true; + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 1, 13); + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 75); + _vm->_sound->command(30); + break; + + case 2: + _game._player._playerPos = Common::Point(8, 117); + _globals[kTeleporterUnderstood] = true; + _globals._sequenceIndexes[1] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 1, 13); + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 8090); + _vm->_sound->command(30); + break; + + case 3: + case 4: + _game._player._playerPos = Common::Point(8, 117); + _game._player.walk(Common::Point(41, 115), FACING_EAST); + _game._player._visible = true; + _game._player._stepEnabled = true; + break; + + default: + break; + } + _globals[kTeleporterCommand] = 0; + } + + _walkThroughDoor = false; + if (_scene->_priorSceneId == 802) { + _game._player._stepEnabled = false; + _walkThroughDoor = true; + } + + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 11, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], -1, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 14); + + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 9, 0, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], -1, -2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 14); + + sceneEntrySound(); +} + +void Scene801::step() { + if (_game._trigger == 75) { + if (_globals[kSexOfRex] == REX_FEMALE) { + _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 1, 8); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 140); + } else { + _game._player._stepEnabled = true; + _game._player._visible = true; + _game._player._playerPos = Common::Point(8, 117); + _game._player.walk(Common::Point(41, 115), FACING_EAST); + } + } + + if (_game._trigger == 140) { + _vm->_sound->command(27); + _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 8); + _scene->_sequences.addTimer(100, 141); + } + + if (_game._trigger == 141) { + _scene->_reloadSceneFlag = true; + _scene->_nextSceneId = _scene->_priorSceneId; + _globals[kTeleporterCommand] = 0; + } + + if (_game._trigger == 80) { + _globals[kTeleporterCommand] = 1; + _scene->_nextSceneId = _globals[kTeleporterDestination]; + _scene->_reloadSceneFlag = true; + } + + if (_walkThroughDoor && (_game._player._playerPos == Common::Point(270, 118))) { + _game._player._stepEnabled = false; + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 4, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 5); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 10); + _walkThroughDoor = false; + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 120); + } + + if (_game._trigger == 120) { + _vm->_sound->command(12); + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 5); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 10); + _game._player._stepEnabled = true; + } + + if (_game._trigger == 90) { + _game._player.walk(Common::Point(307, 111), FACING_EAST); + _scene->_sequences.addTimer(80, 130); + } + + if (_game._trigger == 130) { + _vm->_sound->command(12); + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 4, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 5); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 10); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 110); + } + + if (_game._trigger == 110) { + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 5); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 10); + _scene->_nextSceneId = 802; + } +} + +void Scene801::preActions() { + if (_action.isAction(VERB_LOOK, 0x59)) { + _game._player.walk(Common::Point(148, 110), FACING_NORTH); + _game._player._needToWalk = true; + _game._player._readyToWalk = true; + } + + if (_action.isAction(0x188, 0x16C) && _globals[kBeamIsUp]) { + _globals[kCutX] = _game._player._playerPos.x; + _globals[kCutY] = _game._player._playerPos.y; + _globals[kCutFacing] = _game._player._facing; + _globals[kForceBeamDown] = true; + _globals[kDontRepeat] = true; + _scene->_nextSceneId = 803; + } +} + +void Scene801::actions() { + if (_action.isAction(VERB_LOOK, 0x59)) + _scene->_nextSceneId = 808; + else if (_action.isAction(0x188, 0x16C)) { + _game._player._stepEnabled = false; + _game._player._visible = false; + _scene->_nextSceneId = 807; + } else if (_action.isAction(0x18B, 0x6E) && (_game._player._playerPos == Common::Point(270, 118))) { + _game._player._stepEnabled = false; + _game._player._facing = FACING_EAST; + _game._player.selectSeries(); + _globals[kBetweenRooms] = true; + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 4, 1, 0, 0); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 90); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 5); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 13); + _vm->_sound->command(11); + } else if (_action.isAction(VERB_LOOK, 0x46)) + _vm->_dialogs->show(80110); + else if (_action.isAction(VERB_LOOK, 0xE2)) + _vm->_dialogs->show(80111); + else if (_action.isAction(VERB_LOOK, 0x16C)) + _vm->_dialogs->show(80112); + else if (_action.isAction(VERB_LOOK, 0x2C7) || _action._lookFlag) + _vm->_dialogs->show(80113); + else if (_action.isAction(VERB_LOOK, 0x390)) + _vm->_dialogs->show(80114); + else if (_action.isAction(VERB_LOOK, 0x391)) + _vm->_dialogs->show(80115); + else if (_action.isAction(VERB_LOOK, 0x18D)) + _vm->_dialogs->show(80116); + else if (_action.isAction(VERB_LOOK, 0x6E)) + _vm->_dialogs->show(80117); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + void Scene804::setup() { Scene8xx::setPlayerSpritesPrefix(); Scene8xx::setAAName(); @@ -297,7 +521,7 @@ void Scene804::step() { _scene->_nextSceneId = 803; } - if ((_scene->_activeAnimation->getCurrentFrame() == 72) && !_alreadyPop) { + if ((_scene->_activeAnimation->getCurrentFrame() == 72) && !_alreadyPop) { _vm->_sound->command(21); _alreadyPop = true; } diff --git a/engines/mads/nebular/nebular_scenes8.h b/engines/mads/nebular/nebular_scenes8.h index 1ea295978d..8ba55d619b 100644 --- a/engines/mads/nebular/nebular_scenes8.h +++ b/engines/mads/nebular/nebular_scenes8.h @@ -52,6 +52,21 @@ public: Scene8xx(MADSEngine *vm) : NebularScene(vm) {} }; +class Scene801: public Scene8xx{ +private: + bool _walkThroughDoor; + +public: + Scene801(MADSEngine *vm) : Scene8xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; + class Scene804: public Scene8xx { private: bool _messWithThrottle; -- cgit v1.2.3 From 73945d55320bd5cee6cebe06bb62607be4217af7 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 17 May 2014 12:50:47 +0300 Subject: MADS: Further work on scene 701 --- engines/mads/nebular/nebular_scenes.h | 5 +- engines/mads/nebular/nebular_scenes7.cpp | 102 +++++++++++++++++++++++++------ 2 files changed, 87 insertions(+), 20 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index 61cbd44e78..2c38dd0689 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -39,6 +39,7 @@ enum { }; enum Verb { + VERB_CAST = 0x03D, VERB_CLIMB_DOWN = 0x04E, VERB_CLIMB_UP = 0x050, VERB_EAT = 0x075, @@ -65,7 +66,7 @@ enum Verb { VERB_EXIT_FROM = 0x1CE, VERB_CLIMB_INTO = 0x2F7, VERB_STEP_INTO = 0x2F9, - VERB_WALK_ALONG = 0x312, + VERB_WALK_ALONG = 0x312 }; enum Noun { @@ -85,6 +86,7 @@ enum Noun { NOUN_DOOR = 0x6E, NOUN_ENTER_KEY = 0x7A, NOUN_FISHING_LINE = 0x87, + NOUN_FISHING_ROD = 0x88, NOUN_FRONT_WINDOW = 0x8E, NOUN_FUZZY_DICE = 0x91, NOUN_HOTPANTS = 0x0A7, @@ -150,6 +152,7 @@ enum Noun { NOUN_DROP = 0x3AD, NOUN_DASH = 0x3AE, NOUN_SPLASH = 0x3AF, + NOUN_HOOK = 0x467, NOUN_BIRDS = 0x487, NOUN_WEST_END_OF_PLATFORM = 0x4A9, NOUN_EAST_END_OF_PLATFORM = 0x4AA diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index 1ce95667e4..cc24070169 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -187,9 +187,8 @@ void Scene701::enter() { } else if (_scene->_priorSceneId != -2 && _scene->_priorSceneId != -620) { _game._player._playerPos = Common::Point(22, 131); _game._player._facing = FACING_EAST; - // TODO: Enable once step() is implemented - //_game._player._stepEnabled = false; - //_scene->_sequences.addTimer(1 * 60, 70); + _game._player._stepEnabled = false; + _scene->_sequences.addTimer(1 * 60, 70); } _game.loadQuoteSet(0x310, 0x30F, 0); @@ -199,27 +198,49 @@ void Scene701::enter() { void Scene701::step() { switch(_game._trigger) { case 60: - // TODO + _scene->_sequences.remove(_globals._sequenceIndexes[5]); + _globals._sequenceIndexes[5] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[5], false, 6, 1, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[5], Common::Point(155, 129)); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 61); break; case 61: - // TODO + _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[5]); + _game._player._visible = true; + _game._player._stepEnabled = true; break; case 70: - // TODO + _vm->_sound->command(16); + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 5, 1, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 71); break; case 71: _game._player.walk(Common::Point(61, 131), FACING_EAST); _scene->_sequences.addTimer(2 * 60, 72); break; case 72: - // TODO + _vm->_sound->command(17); + _globals._sequenceIndexes[1] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 5, 1, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 73); break; case 73: - // TODO + _game._player._stepEnabled = true; + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); + _scene->_kernelMessages.reset(); break; case 80: _game._player._visible = true; - // TODO + _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 9); + int idx = _scene->_dynamicHotspots.add(NOUN_BOAT, VERB_CLIMB_INTO, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(234, 129), FACING_NORTH); _globals[kBoatStatus] = BOAT_TIED; _game._player._stepEnabled = true; break; @@ -270,25 +291,64 @@ void Scene701::actions() { case 0: _game._player._stepEnabled = false; _scene->_sequences.remove(_globals._sequenceIndexes[1]); - // TODO: finish this + _vm->_sound->command(16); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 5, 1, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); + _scene->_kernelMessages.reset(); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x310, 34, 0, 120, _game.getQuote(0x30D)); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 1); break; case 1: _game._player.walk(Common::Point(22, 131), FACING_EAST); _scene->_sequences.addTimer(2 * 60, 3); break; case 3: - // TODO + _vm->_sound->command(17); + _globals._sequenceIndexes[1] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 5, 1, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 4); break; case 4: - // TODO + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -1); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); + _globals[kResurrectRoom] = 701; + _scene->_nextSceneId = 605; break; } - } else if (false) { - // TODO: boat + fishing line action + } else if ((_action.isAction(VERB_PULL, NOUN_BOAT) || _action.isAction(VERB_TAKE, NOUN_BOAT) || + _action.isAction(VERB_PULL, NOUN_FISHING_LINE) || _action.isAction(VERB_TAKE, NOUN_FISHING_LINE)) && + !_game._objects.isInInventory(OBJ_FISHING_LINE)) { + if (_globals[kBoatStatus] == BOAT_TIED_FLOATING) { + switch (_game._trigger) { + case 0: + // TODO + break; + case 1: + // TODO + break; + case 2: + _globals[kBoatStatus] = BOAT_TIED; + _globals[kLineStatus] = LINE_NOW_UNTIED; + _game._player._stepEnabled = true; + break; + } + } else if (_globals[kBoatStatus] == BOAT_TIED) { + _vm->_dialogs->show(70125); + } else if (_globals[kLineStatus] == LINE_DROPPED) { + // TODO + } else { + _vm->_dialogs->show(70127); + } } else if (_action.isAction(VERB_CLIMB_INTO, NOUN_BOAT) && _globals[kBoatStatus] == BOAT_TIED) { switch (_game._trigger) { case 0: - // TODO + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _game._player._visible = false; + _scene->loadAnimation(formAnimName('B', 0), 1); break; case 1: _scene->_nextSceneId = 703; @@ -311,8 +371,11 @@ void Scene701::actions() { _vm->_dialogs->show(70114); } else if (_action.isAction(VERB_LOOK, NOUN_CEMENT_PYLON)) { _vm->_dialogs->show(70115); - } else if (false) { - // TODO: hook + } else if (_action.isAction(VERB_LOOK, NOUN_HOOK)) { + if (_globals[kLineStatus] == LINE_NOT_DROPPED || _globals[kLineStatus] == LINE_NOW_UNTIED) + _vm->_dialogs->show(70116); + else + _vm->_dialogs->show(70117); } else if (_action.isAction(VERB_LOOK, NOUN_ROCK)) { _vm->_dialogs->show(70118); } else if (_action.isAction(VERB_TAKE, NOUN_ROCK)) { @@ -326,8 +389,9 @@ void Scene701::actions() { _vm->_dialogs->show(70122); else _vm->_dialogs->show(70123); - } else if (false) { - // TODO: fishing rod + boat + } else if (_action.isAction(VERB_CAST, NOUN_FISHING_ROD, NOUN_BOAT)) { + if (_game._objects.isInInventory(OBJ_FISHING_LINE)) + _vm->_dialogs->show(70124); } } -- cgit v1.2.3 From 71aab5ab1df735bdcd776b05a5a180a3482a1345 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sat, 17 May 2014 12:12:19 +0100 Subject: HOPKINS: Add null termination to byte buffer returned by loadFile(). This shouldn't be a problem, as current client code either must find a terminator when parsing the byte buffer or have preknowledge of the buffer size from a file size or fixed call, so the appended null termination will not cause issues. This change thus allows client code to add sanity checks to prevent reading off the end of the buffer. --- engines/hopkins/files.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index 75f429f860..6620f2878c 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -51,12 +51,13 @@ byte *FileManager::loadFile(const Common::String &file) { // Allocate space for the file contents size_t filesize = f.size(); - byte *data = _vm->_globals->allocMemory(filesize); + byte *data = _vm->_globals->allocMemory(filesize+1); if (!data) error("Error allocating space for file being loaded - %s", file.c_str()); readStream(f, data, filesize); f.close(); + data[filesize] = '\0'; return data; } -- cgit v1.2.3 From 16152cf1ea7807546cc40c8ba094ce874e2f877a Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sat, 17 May 2014 12:16:19 +0100 Subject: HOPKINS: Add sanity check to parsing of COMPUTAN.TXT file. This previously crashed on the Polish version due to a variant file format causing the parsing to make several invalid memory accesses. This prevents this crash and any other in future, though it does not fix the parsing of the variant file format. --- engines/hopkins/computer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 1307cd5796..4f8e373899 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -392,7 +392,7 @@ void ComputerManager::loadMenu() { ++lineNum; } ++tmpPtr; - } while (!loopCond); + } while (!loopCond && tmpPtr[0] != '\0' && lineNum < 50); _vm->_globals->freeMemory((byte *)ptr); } -- cgit v1.2.3 From 2126bef17a174a1544225be89c9d56053622a107 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sat, 17 May 2014 15:07:51 +0100 Subject: HOPKINS: Further cleanup in ComputerManager class. Have simplified the parsing of the COMPUTAN.TXT file prior to looking at supporting the Polish file format variant. These change should have no functional difference, but improve the code by removing a set-but-unused bool in the MenuItem structure, fixing a number of repeated "magic" values to be explicit as various buffer sizes and replacing usage of strcpy with the safer version from our Common code etc. --- engines/hopkins/computer.cpp | 38 +++++++++++++++++++------------------- engines/hopkins/computer.h | 26 +++++++++++++------------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 4f8e373899..dafff15d74 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -38,10 +38,9 @@ namespace Hopkins { ComputerManager::ComputerManager(HopkinsEngine *vm) { _vm = vm; - for (int i = 0; i < 50; i++) { - _menuText[i]._actvFl = false; + for (int i = 0; i < ARRAYSIZE(_menuText); i++) { _menuText[i]._lineSize = 0; - memset(_menuText[i]._line, 0, 90); + memset(_menuText[i]._line, 0, ARRAYSIZE(_menuText[0]._line)); } Common::fill(&_inputBuf[0], &_inputBuf[200], '\0'); _breakoutSpr = NULL; @@ -353,46 +352,47 @@ void ComputerManager::loadMenu() { switch (_vm->_globals->_language) { case LANG_FR: ptr = (char *)_vm->_globals->allocMemory(sizeof(_frenchText)); - strcpy(ptr, _frenchText); + Common::strlcpy(ptr, _frenchText, sizeof(_frenchText)); break; case LANG_SP: ptr = (char *)_vm->_globals->allocMemory(sizeof(_spanishText)); - strcpy(ptr, _spanishText); + Common::strlcpy(ptr, _spanishText, sizeof(_spanishText)); break; default: ptr = (char *)_vm->_globals->allocMemory(sizeof(_englishText)); - strcpy(ptr, _englishText); + Common::strlcpy(ptr, _englishText, sizeof(_englishText)); break; } } char *tmpPtr = ptr; int lineNum = 0; - int strPos; - bool loopCond = false; - do { + while (tmpPtr[0] != '\0' && lineNum < ARRAYSIZE(_menuText)) { + if (tmpPtr[0] == '%' && tmpPtr[1] == '%') { + // End of file marker found - Break out of parse loop + break; + } + if (tmpPtr[0] == '%') { - if (tmpPtr[1] == '%') { - loopCond = true; - break; - } - _menuText[lineNum]._actvFl = 1; - strPos = 0; - while (strPos <= 89) { + int strPos = 0; + while (strPos < ARRAYSIZE(_menuText[0]._line)) { char curChar = tmpPtr[strPos + 2]; - if (curChar == '%' || curChar == 10) + if (curChar == '\0' || curChar == '%' || curChar == 0x0a) // Line Feed break; _menuText[lineNum]._line[strPos++] = curChar; } - if (strPos <= 89) { + + if (strPos < ARRAYSIZE(_menuText[0]._line)) { _menuText[lineNum]._line[strPos] = 0; _menuText[lineNum]._lineSize = strPos - 1; } + ++lineNum; } ++tmpPtr; - } while (!loopCond && tmpPtr[0] != '\0' && lineNum < 50); + } + _vm->_globals->freeMemory((byte *)ptr); } diff --git a/engines/hopkins/computer.h b/engines/hopkins/computer.h index e8857a234b..ba50dca4cf 100644 --- a/engines/hopkins/computer.h +++ b/engines/hopkins/computer.h @@ -31,22 +31,22 @@ namespace Hopkins { class HopkinsEngine; -struct MenuItem { - bool _actvFl; - int _lineSize; - char _line[90]; -}; - -struct ScoreItem { - Common::String _name; - Common::String _score; -}; - enum ComputerEnum { COMPUTER_HOPKINS = 1, COMPUTER_SAMANTHA = 2, COMPUTER_PUBLIC = 3 }; class ComputerManager { private: HopkinsEngine *_vm; + + struct MenuItem { + int _lineSize; + char _line[90]; + }; + + struct ScoreItem { + Common::String _name; + Common::String _score; + }; + MenuItem _menuText[50]; char _inputBuf[200]; ScoreItem _score[6]; @@ -84,14 +84,14 @@ private: void displayLives(); void displayBricks(); void displayGamesSubMenu(); - int displayHiscores(); + int displayHiscores(); void displayHiscoreLine(const byte *objectData, int x, int y, int curChar); void displayMessage(int xp, int yp, int textIdx); void displayScore(); void displayScoreChar(int charPos, int charDisp); void getScoreName(); void playBreakout(); - int moveBall(); + int moveBall(); void saveScore(); void checkBallCollisions(); -- cgit v1.2.3 From 15dfef0796b8cc1288370758d593d443f8e7270c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 17 May 2014 17:42:04 +0200 Subject: MADS: Implement scene 802 --- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes8.cpp | 208 +++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes8.h | 12 ++ 3 files changed, 221 insertions(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index d8eadc1860..206b4762aa 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -277,7 +277,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 801: // control room, outside teleporter return new Scene801(vm); case 802: // launch pad with destroyed ship - return new DummyScene(vm); // TODO + return new Scene802(vm); case 803: // empty launch pad return new DummyScene(vm); // TODO case 804: // inside Rex's ship - cockpit diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index 13ab001bae..2d05ff9a9c 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -300,6 +300,214 @@ void Scene801::actions() { /*------------------------------------------------------------------------*/ +void Scene802::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(0x137); + _scene->addActiveVocab(0xD); + _scene->addActiveVocab(0x123); +} + +void Scene802::enter() { + _globals._spriteIndexes[2] = _scene->_sprites.addSprites("*RXMRC_8"); + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('f', 2)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('f', 0)); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('f', 1)); + _globals._spriteIndexes[5] = _scene->_sprites.addSprites("*RXMBD_8"); + _globals[kBetweenRooms] = false; + + if ((_globals[kCameFromCut]) && (_globals[kCutX] != 0)) { + _game._player._playerPos.x = _globals[kCutX]; + _game._player._playerPos.y = _globals[kCutY]; + _game._player._facing = (Facing)_globals[kCutFacing]; + _globals[kCutX] = 0; + _globals[kCameFromCut] = false; + _globals[kReturnFromCut] = false; + _globals[kBeamIsUp] = false; + _globals[kForceBeamDown] = false; + _globals[kDontRepeat] = false; + _globals[kAntigravClock] = _scene->_frameStartTime; + } else if (_scene->_priorSceneId == 801) { + _game._player._playerPos = Common::Point(15, 129); + _game._player._facing = FACING_EAST; + } else if (_scene->_priorSceneId == 803) { + _game._player._playerPos = Common::Point(303, 119); + _game._player._facing = FACING_WEST; + + } else if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(15, 129); + _game._player._facing = FACING_EAST; + } + + _game._player._visible = true; + + + + if (_globals[kHasWatchedAntigrav] && !_globals[kRemoteSequenceRan]) { + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _scene->_sequences.addTimer(200, 70); + } + + if ((_globals[kRemoteOnGround]) && (!_game._objects.isInInventory(OBJ_REMOTE))) { + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 8); + int idx = _scene->_dynamicHotspots.add(0x123, 0xD,_globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(107, 99), FACING_NORTH); + } + + if (!_game._objects.isInInventory(OBJ_SHIELD_MODULATOR) && !_globals[kShieldModInstalled]) { + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 8); + int idx = _scene->_dynamicHotspots.add(0x137, 0xD, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(93, 97), FACING_NORTH); + } + sceneEntrySound(); +} + +void Scene802::step() { + if (_game._trigger == 70) { + _game._player._stepEnabled = false; + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 19); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 71); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_SPRITE, 4, 72); + } + + if (_game._trigger == 71) { + _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 8); + int idx = _scene->_dynamicHotspots.add(0x123, 0xD, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(107, 99), FACING_NORTH); + + _globals[kRemoteSequenceRan] = true; + _globals[kRemoteOnGround] = true; + _game._player._stepEnabled = true; + } + + if (_game._trigger == 72) + _vm->_sound->command(13); +} + +void Scene802::preActions() { + if (_action.isAction(0x18C, 0x393)) + _game._player._walkOffScreenSceneId = 801; + + if (_action.isAction(0x1AD, 0x1C1)) { + _game._player._walkOffScreenSceneId = 803; + _globals[kForceBeamDown] = false; + } + + if (_action.isAction(VERB_TAKE, 0x139)) + _game._player._needToWalk = false; +} + +void Scene802::actions() { + if (_action.isAction(VERB_TAKE, 0x137) && !_game._objects.isInInventory(OBJ_SHIELD_MODULATOR)) { + switch (_game._trigger) { + case (0): + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], true, 7, 2, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 2); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[2]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_SPRITE, 2, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + + case 1: + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _vm->_sound->command(9); + break; + + case 2: + _game._player._priorTimer = _scene->_frameStartTime + _game._player._ticksAmount; + _game._player._visible = true; + _scene->_sequences.addTimer(20, 3); + break; + + case 3: + _game._player._stepEnabled = true; + _game._objects.addToInventory(OBJ_SHIELD_MODULATOR); + _vm->_dialogs->showItem(OBJ_SHIELD_MODULATOR, 80215); + break; + + default: + break; + } + } else if ((_action.isAction(VERB_TAKE, 0x123)) && (!_game._objects.isInInventory(OBJ_REMOTE))) { + switch (_game._trigger) { + case (0): + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[5] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[5], true, 7, 2, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 1, 4); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_SPRITE, 4, 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 2); + break; + + case 1: + _scene->_sequences.remove(_globals._sequenceIndexes[4]); + _vm->_sound->command(9); + _globals[kRemoteOnGround] = false; + break; + + case 2: + _game._player._priorTimer = _scene->_frameStartTime + _game._player._ticksAmount; + _game._player._visible = true; + _scene->_sequences.addTimer(20, 3); + break; + + case 3: + _game._player._stepEnabled = true; + _game._objects.addToInventory(OBJ_REMOTE); + _vm->_dialogs->showItem(OBJ_REMOTE, 80223); + break; + + default: + break; + } + } else if (!_globals[kRemoteOnGround] && (_game._objects.isInInventory(OBJ_SHIELD_MODULATOR) || _globals[kShieldModInstalled]) + && (_action.isAction(VERB_LOOK, 0x392) || _action._lookFlag)) + _vm->_dialogs->show(80210); + else if (!_globals[kRemoteOnGround]&& !_game._objects.isInInventory(OBJ_SHIELD_MODULATOR) && !_globals[kShieldModInstalled] + && (_action.isAction(VERB_LOOK, 0x392) || _action._lookFlag)) + _vm->_dialogs->show(80211); + else if (_globals[kRemoteOnGround] && !_game._objects.isInInventory(OBJ_SHIELD_MODULATOR) && !_globals[kShieldModInstalled] + && (_action.isAction(VERB_LOOK, 0x392) || _action._lookFlag)) + _vm->_dialogs->show(80213); + else if (_globals[kRemoteOnGround] && (_game._objects.isInInventory(OBJ_SHIELD_MODULATOR) || _globals[kShieldModInstalled]) + && (_action.isAction(VERB_LOOK, 0x392) || _action._lookFlag)) + _vm->_dialogs->show(80212); + else if (!_game._objects.isInInventory(OBJ_SHIELD_MODULATOR) && !_globals[kShieldModInstalled] && _action.isAction(VERB_LOOK, 0x137)) + _vm->_dialogs->show(80214); + else if (_globals[kRemoteOnGround] && _action.isAction(VERB_LOOK, 0x123)) + _vm->_dialogs->show(80216); + else if (_action.isAction(VERB_LOOK, 0x139)) { + if ((!_game._objects.isInInventory(OBJ_SHIELD_MODULATOR)) && (!_globals[kShieldModInstalled])) + _vm->_dialogs->show(80218); + else + _vm->_dialogs->show(80217); + } else if (_action.isAction(VERB_LOOK, 0x39)) + _vm->_dialogs->show(80219); + else if (_action.isAction(VERB_LOOK, 0x1C1)) + _vm->_dialogs->show(80220); + else if (_action.isAction(VERB_LOOK, 0x142)) + _vm->_dialogs->show(80221); + else if (_action.isAction(VERB_TAKE, 0x139)) + _vm->_dialogs->show(80222); + else if (_action.isAction(VERB_LOOK, 0x174) || _action.isAction(VERB_LOOK, 0x175)) + _vm->_dialogs->show(80224); + else if (_action.isAction(VERB_LOOK, 0x393)) + _vm->_dialogs->show(80225); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + void Scene804::setup() { Scene8xx::setPlayerSpritesPrefix(); Scene8xx::setAAName(); diff --git a/engines/mads/nebular/nebular_scenes8.h b/engines/mads/nebular/nebular_scenes8.h index 8ba55d619b..1e31b897bb 100644 --- a/engines/mads/nebular/nebular_scenes8.h +++ b/engines/mads/nebular/nebular_scenes8.h @@ -67,6 +67,18 @@ public: virtual void postActions() {}; }; +class Scene802: public Scene8xx{ +public: + Scene802(MADSEngine *vm) : Scene8xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; + class Scene804: public Scene8xx { private: bool _messWithThrottle; -- cgit v1.2.3 From 11f784713e302c38aab0dbdc779632136096bb2a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 17 May 2014 12:04:39 -0400 Subject: MADS: Completed random message generation method --- engines/mads/messages.cpp | 124 ++++++++++++++++++++++++++++++++++++++++------ engines/mads/messages.h | 30 ++++++++--- 2 files changed, 130 insertions(+), 24 deletions(-) diff --git a/engines/mads/messages.cpp b/engines/mads/messages.cpp index 8ec6350236..23fdbb2785 100644 --- a/engines/mads/messages.cpp +++ b/engines/mads/messages.cpp @@ -29,6 +29,19 @@ namespace MADS { +RandomMessages::RandomMessages() { + reserve(RANDOM_MESSAGE_SIZE); + _randomSpacing = 0; +} + +void RandomMessages::reset() { + for (uint i = 0; i < size(); ++i) { + (*this)[i]._handle = -1; + (*this)[i]._quoteId = -1; + } +} + + KernelMessages::KernelMessages(MADSEngine *vm): _vm(vm) { for (int i = 0; i < KERNEL_MESSAGES_SIZE; ++i) { KernelMessage rec; @@ -36,9 +49,6 @@ KernelMessages::KernelMessages(MADSEngine *vm): _vm(vm) { } _talkFont = _vm->_font->getFont(FONT_CONVERSATION); - - _randomMaxMessages = 0; - resetRandomMessages(); } KernelMessages::~KernelMessages() { @@ -141,7 +151,7 @@ void KernelMessages::reset() { remove(i); _talkFont = _vm->_font->getFont(FONT_CONVERSATION); - resetRandomMessages(); + _randomMessages.clear(); } void KernelMessages::update() { @@ -306,27 +316,20 @@ void KernelMessages::setQuoted(int msgIndex, int numTicks, bool quoted) { } } -void KernelMessages::resetRandomMessages() { - for (int i = 0; i < RANDOM_MESSAGE_SIZE; ++i) { - _randomMessages[i]._handle = -1; - _randomMessages[i]._quote = -1; - } -} - #define RANDOM_MESSAGE_TRIGGER 240 void KernelMessages::randomServer() { if ((_vm->_game->_trigger >= RANDOM_MESSAGE_TRIGGER) && - (_vm->_game->_trigger < (RANDOM_MESSAGE_TRIGGER + _randomMaxMessages))) { + (_vm->_game->_trigger < (RANDOM_MESSAGE_TRIGGER + (int)_randomMessages.size()))) { _randomMessages[_vm->_game->_trigger - RANDOM_MESSAGE_TRIGGER]._handle = -1; - _randomMessages[_vm->_game->_trigger - RANDOM_MESSAGE_TRIGGER]._quote = -1; + _randomMessages[_vm->_game->_trigger - RANDOM_MESSAGE_TRIGGER]._quoteId = -1; } } int KernelMessages::checkRandom() { int total = 0; - for (int i = 0; i < _randomMaxMessages; ++i) { + for (uint i = 0; i < _randomMessages.size(); ++i) { if (_randomMessages[i]._handle >= 0) ++total; } @@ -335,8 +338,97 @@ int KernelMessages::checkRandom() { } bool KernelMessages::generateRandom(int major, int minor) { - // TODO - return false; + bool generatedMessage = false; + + // Scan through the random messages array + for (uint msgCtr = 0; msgCtr < _randomMessages.size(); msgCtr++) { + // Find currently active random messages + if (_randomMessages[msgCtr]._handle < 0) { + // Check whether there's any existing 'scrolling in' message + bool bad = false; + for (uint scanCtr = 0; scanCtr < _randomMessages.size(); ++scanCtr) { + if (_randomMessages[scanCtr]._handle >= 0) { + if (_entries[_randomMessages[scanCtr]._handle]._flags & KMSG_SCROLL) { + bad = true; + break; + } + } + } + + // Do a random check for a new message to appear + if (_vm->getRandomNumber(major) <= minor && !bad) { + int quoteId; + + // Pick a random quote to display from the available list + do { + int quoteIdx = _vm->getRandomNumber(_randomQuotes.size() - 1); + quoteId = _randomQuotes[quoteIdx]; + + // Ensure the quote isn't already in use + bad = false; + for (uint scanCtr = 0; scanCtr < _randomMessages.size(); ++scanCtr) { + if (quoteId == _randomMessages[scanCtr]._quoteId) { + bad = true; + break; + } + } + } while (bad); + + // Store the quote Id to be used + _randomMessages[msgCtr]._quoteId = quoteId; + + // Position the message at a random position + Common::Point textPos; + textPos.x = _vm->getRandomNumber(_randomMessages._bounds.left, + _randomMessages._bounds.right); + + // Figure out Y position, making sure not to be overlapping with + // any other on-screen message + int abortCounter = 0; + + do { + // Ensure we don't get stuck in an infinite loop if too many messages + // are alrady on-screen + if (abortCounter++ > 100) goto done; + bad = false; + + // Set potential new Y position + textPos.y = _vm->getRandomNumber(_randomMessages._bounds.top, + _randomMessages._bounds.bottom); + + // Ensure it doesn't overlap an existing on-screen message + for (uint msgCtr2 = 0; msgCtr2 < _randomMessages.size(); ++msgCtr2) { + if (_randomMessages[msgCtr2]._handle >= 0) { + int lastY = _entries[_randomMessages[msgCtr2]._handle]._position.y; + + if ((textPos.y >= (lastY - _randomMessages._randomSpacing)) && + (textPos.y <= (lastY + _randomMessages._randomSpacing))) { + bad = true; + } + } + } + } while (bad); + + // Add the message + _randomMessages[msgCtr]._handle = add(textPos, _randomMessages._color, 0, + RANDOM_MESSAGE_TRIGGER + msgCtr, _randomMessages._duration, + _vm->_game->getQuote(_randomMessages[msgCtr]._quoteId)); + + if (_randomMessages._scrollRate > 0) { + if (_randomMessages[msgCtr]._handle >= 0) { + setQuoted(_randomMessages[msgCtr]._handle, + _randomMessages._scrollRate, true); + } + } + + generatedMessage = true; + break; + } + } + } + +done: + return generatedMessage; } void KernelMessages::initRandomMessages(int maxSimultaneousMessages, diff --git a/engines/mads/messages.h b/engines/mads/messages.h index 7211598dff..241f493434 100644 --- a/engines/mads/messages.h +++ b/engines/mads/messages.h @@ -65,18 +65,32 @@ public: KernelMessage(); }; +struct RandomEntry { + int _handle; + int _quoteId; + + RandomEntry() { _handle = _quoteId = -1; } +}; + +class RandomMessages: public Common::Array { +public: + Common::Rect _bounds; + int _randomSpacing; + int _color; + int _duration; + int _scrollRate; +public: + RandomMessages(); + + void reset(); +}; + class KernelMessages { private: MADSEngine *_vm; - struct RandomEntry { - int _handle; - int _quote; - }; - RandomEntry _randomMessages[RANDOM_MESSAGE_SIZE]; - int _randomMaxMessages; - - void resetRandomMessages(); + Common::Array _randomQuotes; + RandomMessages _randomMessages; public: Common::Array _entries; Font *_talkFont; -- cgit v1.2.3 From 3244db7ff45bcee9190abe9e209a66eb2464b653 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 17 May 2014 12:30:17 -0400 Subject: MADS: Added initialisation method for random messages display --- engines/mads/messages.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/engines/mads/messages.cpp b/engines/mads/messages.cpp index 23fdbb2785..4fd02cc814 100644 --- a/engines/mads/messages.cpp +++ b/engines/mads/messages.cpp @@ -434,7 +434,29 @@ done: void KernelMessages::initRandomMessages(int maxSimultaneousMessages, const Common::Rect &bounds, int minYSpacing, int scrollRate, int color, int duration, int quoteId, ...) { - // TODO + // Reset the random messages list + _randomMessages.clear(); + _randomMessages.resize(maxSimultaneousMessages); + + // Store passed parameters + _randomMessages._bounds = bounds; + _randomMessages._randomSpacing = minYSpacing; + _randomMessages._scrollRate = scrollRate; + _randomMessages._color = color; + _randomMessages._duration = duration; + + // Store the variable length random quote list + va_list va; + va_start(va, quoteId); + _randomQuotes.clear(); + + while (quoteId > 0) { + _randomQuotes.push_back(quoteId); + assert(_randomQuotes.size() < 100); + quoteId = va_arg(va, int); + } + + va_end(va); } -- cgit v1.2.3 From bc639c25c8f8e8f6a86235f59352851313753830 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 17 May 2014 14:35:48 -0400 Subject: MADS: Fix for using inventory actions --- engines/mads/action.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index e9593955c5..5d63c3a268 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -472,8 +472,8 @@ void MADSAction::checkActionAtMousePos() { _mainObjectSource = CAT_NONE; } else { InventoryObject &invObject = _vm->_game->_objects.getItem(userInterface._selectedInvIndex); - _verbType = invObject._vocabList[_selectedRow + 1]._verbType; - _prepType = invObject._vocabList[_selectedRow + 1]._prepType; + _verbType = invObject._vocabList[_selectedRow]._verbType; + _prepType = invObject._vocabList[_selectedRow]._prepType; _hotspotId = userInterface._selectedInvIndex; _mainObjectSource = CAT_INV_LIST; -- cgit v1.2.3 From bee54dc048512904941487d6f1f7664b690d666c Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sat, 17 May 2014 20:22:19 +0100 Subject: HOPKINS: Fix loading of variant COMPUTAN.TXT used by Polish version. This is the final fix for bug #6590 - "HOPKINS-PL: Crash using computer in office". --- engines/hopkins/computer.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index dafff15d74..84d5c631c7 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -345,6 +345,7 @@ static const char _spanishText[] = * Load Menu data */ void ComputerManager::loadMenu() { + debug(9, "ComputerManager::loadMenu()"); char *ptr; if (_vm->_fileIO->fileExists("COMPUTAN.TXT")) { ptr = (char *)_vm->_fileIO->loadFile("COMPUTAN.TXT"); @@ -368,17 +369,19 @@ void ComputerManager::loadMenu() { char *tmpPtr = ptr; int lineNum = 0; + const char lineSep = tmpPtr[0]; + while (tmpPtr[0] != '\0' && lineNum < ARRAYSIZE(_menuText)) { if (tmpPtr[0] == '%' && tmpPtr[1] == '%') { // End of file marker found - Break out of parse loop break; } - if (tmpPtr[0] == '%') { + if (tmpPtr[0] == lineSep) { int strPos = 0; while (strPos < ARRAYSIZE(_menuText[0]._line)) { char curChar = tmpPtr[strPos + 2]; - if (curChar == '\0' || curChar == '%' || curChar == 0x0a) // Line Feed + if (curChar == '\0' || curChar == lineSep || curChar == 0x0a) // Line Feed break; _menuText[lineNum]._line[strPos++] = curChar; } @@ -388,7 +391,10 @@ void ComputerManager::loadMenu() { _menuText[lineNum]._lineSize = strPos - 1; } - ++lineNum; + if (strPos != 0) { + debug(9, "_menuText[%d]._line (size: %d): \"%s\"", lineNum, _menuText[lineNum]._lineSize, _menuText[lineNum]._line); + ++lineNum; + } } ++tmpPtr; } -- cgit v1.2.3 From 54c957913a0345709b04c2d78c73238ddfb7d1f1 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sat, 17 May 2014 23:28:00 +0100 Subject: CONFIGURE: Add support for host-alias prefixed strings binary. This is the last outstanding change of patch #1359 - "Update wii/gamecube configure" submitted on 2010-11-15. --- configure | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 4e4e9d1456..122b1ed3c1 100755 --- a/configure +++ b/configure @@ -1843,6 +1843,12 @@ if test "$_global_constructors" = yes; then fi echo $_global_constructors +if test ! "x$(which $_host_alias-strings)" = "x"; then +_strings=$_host_alias-strings +else +_strings=strings +fi + # # Check for endianness # @@ -1857,7 +1863,7 @@ void _ebcdic() { char* s = (char*) ebcdic_mm; s = (char*) ebcdic_ii; } int main() { _ascii (); _ebcdic (); return 0; } EOF $CXX $CXXFLAGS -c -o $TMPO.o tmp_endianness_check.cpp -if strings $TMPO.o | grep BIGenDianSyS >/dev/null; then +if $_strings $TMPO.o | grep BIGenDianSyS >/dev/null; then _endian=big elif strings $TMPO.o | grep LiTTleEnDian >/dev/null; then _endian=little -- cgit v1.2.3 From e89b0fd4393be93e79095f87d6ce3a1ca2c8d849 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sun, 18 May 2014 00:30:12 +0100 Subject: CONFIGURE: Add support for host-alias prefixed strings binary on LE. This was missed from the Wii patch as the Wii is Big Endian. --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 122b1ed3c1..411403408b 100755 --- a/configure +++ b/configure @@ -1865,7 +1865,7 @@ EOF $CXX $CXXFLAGS -c -o $TMPO.o tmp_endianness_check.cpp if $_strings $TMPO.o | grep BIGenDianSyS >/dev/null; then _endian=big -elif strings $TMPO.o | grep LiTTleEnDian >/dev/null; then +elif $_strings $TMPO.o | grep LiTTleEnDian >/dev/null; then _endian=little fi echo $_endian; -- cgit v1.2.3 From 77b244e5dfbb13965ae0c1ac2f1c9fa9b522c3c1 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 18 May 2014 09:44:08 +0300 Subject: FULLPIPE: Finish implementation of movGraphCallback() --- engines/fullpipe/motion.cpp | 41 ++++++++++++++++++----------------------- engines/fullpipe/motion.h | 8 ++++---- 2 files changed, 22 insertions(+), 27 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index ccf5fa1483..81bfb7d167 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -515,7 +515,7 @@ MovGraphItem::MovGraphItem() { field_1C = 0; field_20 = 0; field_24 = 0; - items = 0; + movitems = 0; count = 0; field_30 = 0; field_34 = 0; @@ -529,23 +529,19 @@ void MovGraphItem::free() { int MovGraph_messageHandler(ExCommand *cmd); -MovArr *movGraphCallback(StaticANIObject *ani, MovItem *item, signed int counter) { -#if 0 -MovArr *movGraphCallback(StaticANIObject *ani, Common:Array items, int itemidx, signed int counter) { - - int residx = itemidx; +Common::Array *movGraphCallback(StaticANIObject *ani, Common::Array *items, signed int counter) { + int residx = 0; + int itemidx = 0; while (counter > 1) { - if (items[itemidx]._mfield_4 > items[itemidx + 1]._mfield_4) + if ((*items)[itemidx]->_mfield_4 > (*items)[itemidx + 1]->_mfield_4) residx = itemidx; counter--; itemidx++; } - return items[residx].movarr; -#endif - return 0; + return (*items)[residx]->movarr; } MovGraph::MovGraph() { @@ -604,8 +600,7 @@ void MovGraph::freeItems() { _items.clear(); } - -MovItem *MovGraph::method28(StaticANIObject *ani, int x, int y, int flag1, int *rescount) { +Common::Array *MovGraph::method28(StaticANIObject *ani, int x, int y, int flag1, int *rescount) { warning("STUB: MovGraph::method28()"); return 0; @@ -642,14 +637,14 @@ bool MovGraph::method44(StaticANIObject *ani, int x, int y) { if (x != -1 || y != -1) { int counter; - MovItem *movitem = method28(ani, x, y, 0, &counter); + Common::Array *movitem = method28(ani, x, y, 0, &counter); if (movitem) { - MovArr *movarr = _callback1(ani, movitem, counter); - int cnt = movarr->_movStepCount; + Common::Array *movarr = _callback1(ani, movitem, counter); + int cnt = (*movarr)[0]->_movStepCount; if (cnt > 0) { - if (movarr->_movSteps[cnt - 1].link->_flags & 0x4000000) + if ((*movarr)[0]->_movSteps[cnt - 1].link->_flags & 0x4000000) return true; } } @@ -665,16 +660,16 @@ MessageQueue *MovGraph::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int PicAniInfo picAniInfo; int ss; - MovItem *movitem = method28(subj, xpos, ypos, fuzzyMatch, &ss); + Common::Array *movitem = method28(subj, xpos, ypos, fuzzyMatch, &ss); subj->getPicAniInfo(&picAniInfo); if (movitem) { - MovArr *goal = _callback1(subj, movitem, ss); + Common::Array *goal = _callback1(subj, movitem, ss); int idx = getItemIndexByStaticAni(subj); for (uint i = 0; i < _items[idx]->count; i++) { - if ((*_items[idx]->items[i].movarr)[0] == goal) { + if (_items[idx]->movitems->operator[](i)->movarr == goal) { if (subj->_movement) { Common::Point point; @@ -698,13 +693,13 @@ MessageQueue *MovGraph::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int movitem = method28(subj, xpos, ypos, fuzzyMatch, &ss); if (movitem) { - MovArr *goal = _callback1(subj, movitem, ss); + Common::Array *goal = _callback1(subj, movitem, ss); int idx = getItemIndexByStaticAni(subj); if (_items[idx]->count > 0) { int arridx = 0; - while ((*_items[idx]->items[arridx].movarr)[0] != goal) { + while (_items[idx]->movitems->operator[](arridx)->movarr != goal) { arridx++; if (arridx >= _items[idx]->count) { @@ -715,10 +710,10 @@ MessageQueue *MovGraph::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int _items[idx]->movarr->clear(); - for (uint i = 0; i < (*_items[idx]->items[arridx].movarr)[i]->_movStepCount; i++) { + for (uint i = 0; i < (*_items[idx]->movitems->operator[](arridx)->movarr)[i]->_movStepCount; i++) { MovArr *m = new MovArr; - *m = *(*_items[idx]->items[arridx].movarr)[i]; + *m = *(*_items[idx]->movitems->operator[](arridx)->movarr)[i]; } _items[idx]->field_10 = -1; diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index febcf17574..cfbca1d8a4 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -53,7 +53,7 @@ public: virtual void addObject(StaticANIObject *obj) {} virtual int removeObject(StaticANIObject *obj) { return 0; } virtual void freeItems() {} - virtual MovItem *method28(StaticANIObject *ani, int x, int y, int flag1, int *rescount) { return 0; } + virtual Common::Array *method28(StaticANIObject *ani, int x, int y, int flag1, int *rescount) { return 0; } virtual int method2C(StaticANIObject *obj, int x, int y) { return 0; } virtual int method30() { return 0; } virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) { return 0; } @@ -332,7 +332,7 @@ struct MovGraphItem { int field_1C; int field_20; int field_24; - MovItem *items; + Common::Array *movitems; int count; int field_30; int field_34; @@ -349,7 +349,7 @@ public: ObList _links; int _field_44; Common::Array _items; - MovArr *(*_callback1)(StaticANIObject *ani, MovItem *item, int counter); + Common::Array *(*_callback1)(StaticANIObject *ani, Common::Array *items, signed int counter); MGM _mgm; public: @@ -361,7 +361,7 @@ public: virtual void addObject(StaticANIObject *obj); virtual int removeObject(StaticANIObject *obj); virtual void freeItems(); - virtual MovItem *method28(StaticANIObject *ani, int x, int y, int flag1, int *rescount); + virtual Common::Array *method28(StaticANIObject *ani, int x, int y, int flag1, int *rescount); virtual int method2C(StaticANIObject *obj, int x, int y); virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId); virtual int changeCallback(); -- cgit v1.2.3 From e7bef9019a71105a19c9f4eff567b8df47387a8b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 18 May 2014 12:29:48 +0200 Subject: MADS: Implement scene 803, add an ongoingGame global flag to exit the multiple game loops --- engines/mads/game.cpp | 10 +- engines/mads/game.h | 2 + engines/mads/nebular/nebular_scenes8.cpp | 320 ++++++++++++++++++++++++++++++- engines/mads/nebular/nebular_scenes8.h | 12 ++ engines/mads/scene.cpp | 4 +- 5 files changed, 340 insertions(+), 8 deletions(-) diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 34b229f157..3b00116d25 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -77,6 +77,8 @@ Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm), _triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _winStatus = 0; _widepipeCtr = 0; + _ongoingGame = true; + // Load the inventory object list _objects.load(); @@ -152,7 +154,7 @@ void Game::run() { } void Game::gameLoop() { - while (!_vm->shouldQuit() && _statusFlag) { + while (!_vm->shouldQuit() && _statusFlag && _ongoingGame) { if (_loadGameSlot != -1) { loadGame(_loadGameSlot); _loadGameSlot = -1; @@ -166,9 +168,8 @@ void Game::gameLoop() { _scene._spriteSlots.reset(); - if (_sectionNumber == _currentSectionNumber) { + if (_sectionNumber == _currentSectionNumber) sectionLoop(); - } _player.releasePlayerSprites(); assert(_scene._sprites.size() == 0); @@ -183,7 +184,7 @@ void Game::gameLoop() { } void Game::sectionLoop() { - while (!_vm->shouldQuit() && _statusFlag && _sectionNumber == _currentSectionNumber) { + while (!_vm->shouldQuit() && _statusFlag && (_sectionNumber == _currentSectionNumber) && _ongoingGame) { _kernelMode = KERNEL_ROOM_PRELOAD; _player._spritesChanged = true; _quoteEmergency = false; @@ -460,6 +461,7 @@ void Game::synchronize(Common::Serializer &s, bool phase1) { s.syncAsUint16LE(_triggerMode); synchronizeString(s, _aaName); s.syncAsSint16LE(_lastSave); + s.syncAsByte(_ongoingGame); _scene.synchronize(s); _objects.synchronize(s); diff --git a/engines/mads/game.h b/engines/mads/game.h index 358a266e09..0e9640594c 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -149,6 +149,8 @@ public: int _winStatus; int _widepipeCtr; int _loadGameSlot; + bool _ongoingGame; + public: virtual ~Game(); diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index 2d05ff9a9c..1c7cd7539c 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -36,9 +36,8 @@ void Scene8xx::setPlayerSpritesPrefix() { _scene->_nextSceneId == 804 || _scene->_nextSceneId == 805 || _scene->_nextSceneId == 808 || _scene->_nextSceneId == 810) { _game._player._spritesPrefix = ""; - } else { + } else _game._player._spritesPrefix = _globals[kSexOfRex] == SEX_FEMALE ? "ROX" : "RXM"; - } _vm->_palette->setEntry(16, 0x0A, 0x3F, 0x3F); _vm->_palette->setEntry(17, 0x0A, 0x2D, 0x2D); @@ -62,12 +61,15 @@ void Scene8xx::sceneEntrySound() { case 808: _vm->_sound->command(20); break; + case 805: _vm->_sound->command(23); break; + case 810: _vm->_sound->command(10); break; + default: break; } @@ -508,6 +510,320 @@ void Scene802::actions() { /*------------------------------------------------------------------------*/ +void Scene803::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(0x472); + _scene->addActiveVocab(0xD); + + if ((!_globals[kFromCockpit] && _globals[kReturnFromCut] && !_globals[kBeamIsUp]) + || (_globals[kFromCockpit] && !_globals[kExitShip])) { + _game._player._spritesPrefix = ""; + _game._player._spritesChanged = true; + } +} + +void Scene803::enter() { + _globals[kBetweenRooms] = false; + _game._player._visible = false; + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('f', 1)); + _globals._spriteIndexes[9] = _scene->_sprites.addSprites("*RXMBD_2"); + _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('d', 1)); + + _game.loadQuoteSet(0x31B, 0x31C, 0x31D, 0x31E, 0x31F, 0x320, 0x321, 0x322, 0); + + if (_globals[kHoppyDead]) { + _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('e', 1)); + _globals._sequenceIndexes[7] = _scene->_sequences.startCycle(_globals._spriteIndexes[7], false, 1); + int idx = _scene->_dynamicHotspots.add(0x472, 0xD, _globals._sequenceIndexes[7], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(66, 123), FACING_SOUTH); + } + + if (!_globals[kBeamIsUp] && !_globals[kReturnFromCut] && (!_globals[kFromCockpit] || _globals[kExitShip])) { + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 2, 2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); + } + + if (!_globals[kFromCockpit]) { + if (!_globals[kReturnFromCut]) { + if (_scene->_priorSceneId != -2) { + _game._player._playerPos = Common::Point(15, 130); + _game._player._facing = FACING_EAST; + } + _game._player._visible = true; + } else if (!_globals[kBeamIsUp]){ + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('a', 1)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('a', 3)); + _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('a', 2)); + _game._player._visible = false; + _game._player._stepEnabled = false; + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 15); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 80); + _vm->_sound->command(14); + } + + if (_globals[kBeamIsUp] && !_globals[kReturnFromCut]){ + if (_globals[kForceBeamDown]) + _game._player._visible = false; + else + _game._player._visible = true; + + _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('b', 1)); + _vm->_sound->command(15); + _game._player._stepEnabled = false; + _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 1, 6); + _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 100); + } + } else if (!_globals[kExitShip]) { + if (!_globals[kBeamIsUp]) { + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('a', 1)); + _game._player._visible = false; + _game._player._stepEnabled = false; + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 130); + _vm->_sound->command(14); + } else { + _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('c', 1)); + _game._player._visible = false; + _game._player._stepEnabled = false; + _globals._sequenceIndexes[8] = _scene->_sequences.startCycle(_globals._spriteIndexes[8], false, 1); + _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8, 1, 0, 0); + _scene->_sequences.setDepth(_globals._sequenceIndexes[8], 1); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_EXPIRE, 0, 140); + } + } else { + _game._player._stepEnabled = false; + _game._player._playerPos = Common::Point(197, 96); + _game._player._facing = FACING_SOUTHWEST; + _game._player._visible = true; + _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('d', 1)); + _globals._sequenceIndexes[6] = _scene->_sequences.startCycle(_globals._spriteIndexes[6], false, 19); + _scene->_sequences.addTimer(1, 150); + } + + sceneEntrySound(); +} + +void Scene803::step() { + if (_game._trigger == 120) { + _globals._sequenceIndexes[6] = _scene->_sequences.startCycle(_globals._spriteIndexes[6], false, 19); + _scene->_nextSceneId = 804; + } + + if (_game._trigger == 100) { + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 2, 2); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); + if (!_globals[kHoppyDead]) { + _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 7, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 7, 12); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5],SEQUENCE_TRIGGER_EXPIRE, 0, 101); + } else { + _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, -2); + int idx = _scene->_dynamicHotspots.add(0x472, 0xD, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(66, 123), FACING_SOUTH); + _vm->_sound->command(16); + _globals[kCameFromCut] = true; + _globals[kBeamIsUp] = false; + _globals[kReturnFromCut] = false; + _globals[kDontRepeat] = false; + _globals[kHoppyDead] = true; + _globals[kHasWatchedAntigrav] = true; + + if (_globals[kForceBeamDown]) + _scene->_nextSceneId = _scene->_priorSceneId; + else + _game._player._stepEnabled = true; + } + } + + if (_game._trigger == 101) { + _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, -2); + int idx = _scene->_dynamicHotspots.add(0x472, 0xD, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(66, 123), FACING_SOUTH); + _vm->_sound->command(16); + _globals[kCameFromCut] = true; + _globals[kBeamIsUp] = false; + _globals[kReturnFromCut] = false; + _globals[kDontRepeat] = false; + _globals[kHoppyDead] = true; + _globals[kHasWatchedAntigrav] = true; + + if (_globals[kForceBeamDown]) + _scene->_nextSceneId = _scene->_priorSceneId; + else + _game._player._stepEnabled = true; + } + + if (_game._trigger == 80) { + if (!_globals[kHoppyDead]) + _scene->_sequences.addTimer(350, 70); + + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 12, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 1, 3); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 90); + } + + if (_game._trigger == 70) { + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 71); + _vm->_sound->command(31); + } + + if (_game._trigger == 71) + _scene->_sequences.addTimer(200, 110); + + if (_game._trigger == 90) { + int syncIdx = _globals._sequenceIndexes[4]; + _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 15, 0, 0, 0); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], syncIdx); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 4, 9); + if (_globals[kHoppyDead]) + _scene->_sequences.addTimer(200, 110); + } + + if (_game._trigger == 110) + _scene->_nextSceneId = 808; + + if (_game._trigger == 130) { + _globals[kBeamIsUp] = true; + _scene->_nextSceneId = 804; + } + + if (_game._trigger == 140) { + if (!_globals[kWindowFixed]) { + _scene->_nextSceneId = 810; + _globals[kInSpace] = true; + } else { + if (!_globals[kShieldModInstalled]) + _game._winStatus = 1; + else if (!_globals[kTargetModInstalled]) + _game._winStatus = 2; + else + _game._winStatus = 3; + + _game._ongoingGame = false; + } + } + + if (_game._trigger == 150) { + _scene->_sequences.remove(_globals._sequenceIndexes[6]); + _vm->_sound->command(18); + _globals._sequenceIndexes[6] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[6], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[6], 1, 19); + _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 4); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_EXPIRE, 0, 151); + } + + if (_game._trigger == 151) { + _globals[kBeamIsUp] = false; + _globals[kFromCockpit] = false; + _globals[kExitShip] = false; + _game._player._stepEnabled = true; + } +} + +void Scene803::preActions() { + if (_action.isAction(0x1AD, 0x1AE)) + _game._player._walkOffScreenSceneId = 802; + + if (_action.isAction(VERB_TAKE, 0x139)) + _game._player._needToWalk = false; +} + +void Scene803::actions() { + if (_action.isAction(VERB_TAKE, 0x472)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _game._player._visible = false; + _globals._sequenceIndexes[9] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], true, 6, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[9], 1, 4); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[9]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SEQUENCE_TRIGGER_EXPIRE, 0, 160); + break; + + case 160: { + int syncIdx = _globals._sequenceIndexes[9]; + _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 4); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[9], syncIdx); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[9]); + _scene->_sequences.addTimer(60, 161); + } + break; + + case 161: { + int quoteId = 0x31A + _vm->getRandomNumber(1, 8); + _scene->_kernelMessages.add(Common::Point(64, 67), 0x1110, 32, 0, 80, _game.getQuote(quoteId)); + _scene->_sequences.addTimer(60, 162); + } + break; + + case 162: + _scene->_sequences.remove(_globals._sequenceIndexes[9]); + _globals._sequenceIndexes[9] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[9], true, 6, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[9], 1, 4); + _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[9]); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SEQUENCE_TRIGGER_EXPIRE, 0, 163); + break; + + case 163: + _game._player._priorTimer = _scene->_frameStartTime + _game._player._ticksAmount; + _game._player._visible = true; + _game._player._stepEnabled = true; + break; + + default: + break; + } + } else if (_action.isAction(0x3B8, 0x139)) { + _vm->_sound->command(17); + _game._player._stepEnabled = false; + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[6], 1, 19); + _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 4); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_EXPIRE, 0, 120); + _globals[kBeamIsUp] = false; + } else if (_action.isAction(VERB_LOOK, 0x392)) + _vm->_dialogs->show(80310); + else if (_action._lookFlag) + _vm->_dialogs->show(80310); + else if (_action.isAction(VERB_LOOK, 0x395)) + _vm->_dialogs->show(80311); + else if (_action.isAction(VERB_LOOK, 0x472)) { + if (_game._storyMode == STORYMODE_NICE) + _vm->_dialogs->show(80312); + else + _vm->_dialogs->show(80313); + } else if (_action.isAction(VERB_LOOK, 0x39)) + _vm->_dialogs->show(80315); + else if (_action.isAction(VERB_LOOK, 0x139)) + _vm->_dialogs->show(80317); + else if (_action.isAction(VERB_LOOK, 0x396)) + _vm->_dialogs->show(80318); + else if (_action.isAction(VERB_LOOK, 0x174) || _action.isAction(VERB_LOOK, 0x175)) + _vm->_dialogs->show(80319); + else if (_action.isAction(VERB_LOOK, 0x142)) + _vm->_dialogs->show(80320); + else if (_action.isAction(VERB_TAKE, 0x139)) + _vm->_dialogs->show(80321); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + + void Scene804::setup() { Scene8xx::setPlayerSpritesPrefix(); Scene8xx::setAAName(); diff --git a/engines/mads/nebular/nebular_scenes8.h b/engines/mads/nebular/nebular_scenes8.h index 1e31b897bb..3af0a1cc22 100644 --- a/engines/mads/nebular/nebular_scenes8.h +++ b/engines/mads/nebular/nebular_scenes8.h @@ -79,6 +79,18 @@ public: virtual void postActions() {}; }; +class Scene803: public Scene8xx{ +public: + Scene803(MADSEngine *vm) : Scene8xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; + class Scene804: public Scene8xx { private: bool _messWithThrottle; diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 601acc5ec6..3ef88fa630 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -255,7 +255,7 @@ void Scene::loadVocabStrings() { } void Scene::initPaletteAnimation(Common::Array &palCycles, bool animFlag) { - // Initialise the animation palette and ticks list + // Initialize the animation palette and ticks list _cycleTicks.clear(); _paletteCycles.clear(); @@ -334,7 +334,7 @@ bool Scene::getDepthHighBits(const Common::Point &pt) { } void Scene::loop() { - while (!_vm->shouldQuit() && !_reloadSceneFlag && _nextSceneId == _currentSceneId) { + while (!_vm->shouldQuit() && !_reloadSceneFlag && (_nextSceneId == _currentSceneId) && _vm->_game->_ongoingGame) { // Handle drawing a game frame doFrame(); -- cgit v1.2.3 From e1a06ae543f0926118d2b82aa5344752e11ead1d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 18 May 2014 12:34:15 +0200 Subject: MADS: Replace _ongoingGame by the use of quitGame() --- engines/mads/game.cpp | 7 ++----- engines/mads/game.h | 1 - engines/mads/nebular/nebular_scenes8.cpp | 2 +- engines/mads/scene.cpp | 2 +- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 3b00116d25..3c69f452b4 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -77,8 +77,6 @@ Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm), _triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _winStatus = 0; _widepipeCtr = 0; - _ongoingGame = true; - // Load the inventory object list _objects.load(); @@ -154,7 +152,7 @@ void Game::run() { } void Game::gameLoop() { - while (!_vm->shouldQuit() && _statusFlag && _ongoingGame) { + while (!_vm->shouldQuit() && _statusFlag) { if (_loadGameSlot != -1) { loadGame(_loadGameSlot); _loadGameSlot = -1; @@ -184,7 +182,7 @@ void Game::gameLoop() { } void Game::sectionLoop() { - while (!_vm->shouldQuit() && _statusFlag && (_sectionNumber == _currentSectionNumber) && _ongoingGame) { + while (!_vm->shouldQuit() && _statusFlag && (_sectionNumber == _currentSectionNumber)) { _kernelMode = KERNEL_ROOM_PRELOAD; _player._spritesChanged = true; _quoteEmergency = false; @@ -461,7 +459,6 @@ void Game::synchronize(Common::Serializer &s, bool phase1) { s.syncAsUint16LE(_triggerMode); synchronizeString(s, _aaName); s.syncAsSint16LE(_lastSave); - s.syncAsByte(_ongoingGame); _scene.synchronize(s); _objects.synchronize(s); diff --git a/engines/mads/game.h b/engines/mads/game.h index 0e9640594c..d171638b66 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -149,7 +149,6 @@ public: int _winStatus; int _widepipeCtr; int _loadGameSlot; - bool _ongoingGame; public: virtual ~Game(); diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index 1c7cd7539c..de89402083 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -709,7 +709,7 @@ void Scene803::step() { else _game._winStatus = 3; - _game._ongoingGame = false; + _vm->quitGame(); } } diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 3ef88fa630..84e4edc08d 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -334,7 +334,7 @@ bool Scene::getDepthHighBits(const Common::Point &pt) { } void Scene::loop() { - while (!_vm->shouldQuit() && !_reloadSceneFlag && (_nextSceneId == _currentSceneId) && _vm->_game->_ongoingGame) { + while (!_vm->shouldQuit() && !_reloadSceneFlag && (_nextSceneId == _currentSceneId)) { // Handle drawing a game frame doFrame(); -- cgit v1.2.3 From 9f081b0a8b6d9e2f3a5e1477a994e5295ef5beb8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 18 May 2014 13:12:04 +0200 Subject: MADS: Implement scene 805 --- engines/mads/nebular/nebular_scenes.cpp | 4 +- engines/mads/nebular/nebular_scenes8.cpp | 206 ++++++++++++++++++++++++------- engines/mads/nebular/nebular_scenes8.h | 12 ++ engines/mads/player.h | 2 +- 4 files changed, 176 insertions(+), 48 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 206b4762aa..8b3456cff0 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -279,11 +279,11 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 802: // launch pad with destroyed ship return new Scene802(vm); case 803: // empty launch pad - return new DummyScene(vm); // TODO + return new Scene803(vm); case 804: // inside Rex's ship - cockpit return new Scene804(vm); case 805: // service panel - return new DummyScene(vm); // TODO + return new Scene805(vm); case 807: // teleporter return new Scene807(vm); case 808: // antigrav control diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index de89402083..ab3b67eefb 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -533,14 +533,14 @@ void Scene803::enter() { _game.loadQuoteSet(0x31B, 0x31C, 0x31D, 0x31E, 0x31F, 0x320, 0x321, 0x322, 0); if (_globals[kHoppyDead]) { - _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('e', 1)); + _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('e', 1)); _globals._sequenceIndexes[7] = _scene->_sequences.startCycle(_globals._spriteIndexes[7], false, 1); int idx = _scene->_dynamicHotspots.add(0x472, 0xD, _globals._sequenceIndexes[7], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(66, 123), FACING_SOUTH); } if (!_globals[kBeamIsUp] && !_globals[kReturnFromCut] && (!_globals[kFromCockpit] || _globals[kExitShip])) { - _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 8, 1, 0, 0); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 8, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 2, 2); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); } @@ -548,19 +548,19 @@ void Scene803::enter() { if (!_globals[kFromCockpit]) { if (!_globals[kReturnFromCut]) { if (_scene->_priorSceneId != -2) { - _game._player._playerPos = Common::Point(15, 130); - _game._player._facing = FACING_EAST; + _game._player._playerPos = Common::Point(15, 130); + _game._player._facing = FACING_EAST; } - _game._player._visible = true; + _game._player._visible = true; } else if (!_globals[kBeamIsUp]){ _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('a', 1)); _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('a', 3)); _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('a', 2)); - _game._player._visible = false; + _game._player._visible = false; _game._player._stepEnabled = false; _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 15); - _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 1); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 80); _vm->_sound->command(14); @@ -568,13 +568,13 @@ void Scene803::enter() { if (_globals[kBeamIsUp] && !_globals[kReturnFromCut]){ if (_globals[kForceBeamDown]) - _game._player._visible = false; + _game._player._visible = false; else - _game._player._visible = true; + _game._player._visible = true; - _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('b', 1)); + _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('b', 1)); _vm->_sound->command(15); - _game._player._stepEnabled = false; + _game._player._stepEnabled = false; _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 12, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 1, 6); _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 1); @@ -582,19 +582,19 @@ void Scene803::enter() { } } else if (!_globals[kExitShip]) { if (!_globals[kBeamIsUp]) { - _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('a', 1)); - _game._player._visible = false; + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('a', 1)); + _game._player._visible = false; _game._player._stepEnabled = false; - _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 8, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 1); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 130); _vm->_sound->command(14); } else { - _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('c', 1)); - _game._player._visible = false; - _game._player._stepEnabled = false; - _globals._sequenceIndexes[8] = _scene->_sequences.startCycle(_globals._spriteIndexes[8], false, 1); - _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8, 1, 0, 0); + _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('c', 1)); + _game._player._visible = false; + _game._player._stepEnabled = false; + _globals._sequenceIndexes[8] = _scene->_sequences.startCycle(_globals._spriteIndexes[8], false, 1); + _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[8], 1); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[8], SEQUENCE_TRIGGER_EXPIRE, 0, 140); } @@ -603,7 +603,7 @@ void Scene803::enter() { _game._player._playerPos = Common::Point(197, 96); _game._player._facing = FACING_SOUTHWEST; _game._player._visible = true; - _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('d', 1)); + _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('d', 1)); _globals._sequenceIndexes[6] = _scene->_sequences.startCycle(_globals._spriteIndexes[6], false, 19); _scene->_sequences.addTimer(1, 150); } @@ -618,7 +618,7 @@ void Scene803::step() { } if (_game._trigger == 100) { - _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 8, 1, 0, 0); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 8, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 2, 2); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); if (!_globals[kHoppyDead]) { @@ -630,17 +630,17 @@ void Scene803::step() { int idx = _scene->_dynamicHotspots.add(0x472, 0xD, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(66, 123), FACING_SOUTH); _vm->_sound->command(16); - _globals[kCameFromCut] = true; - _globals[kBeamIsUp] = false; - _globals[kReturnFromCut] = false; - _globals[kDontRepeat] = false; - _globals[kHoppyDead] = true; - _globals[kHasWatchedAntigrav] = true; + _globals[kCameFromCut] = true; + _globals[kBeamIsUp] = false; + _globals[kReturnFromCut] = false; + _globals[kDontRepeat] = false; + _globals[kHoppyDead] = true; + _globals[kHasWatchedAntigrav] = true; if (_globals[kForceBeamDown]) _scene->_nextSceneId = _scene->_priorSceneId; else - _game._player._stepEnabled = true; + _game._player._stepEnabled = true; } } @@ -649,17 +649,17 @@ void Scene803::step() { int idx = _scene->_dynamicHotspots.add(0x472, 0xD, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(66, 123), FACING_SOUTH); _vm->_sound->command(16); - _globals[kCameFromCut] = true; - _globals[kBeamIsUp] = false; - _globals[kReturnFromCut] = false; - _globals[kDontRepeat] = false; - _globals[kHoppyDead] = true; - _globals[kHasWatchedAntigrav] = true; + _globals[kCameFromCut] = true; + _globals[kBeamIsUp] = false; + _globals[kReturnFromCut] = false; + _globals[kDontRepeat] = false; + _globals[kHoppyDead] = true; + _globals[kHasWatchedAntigrav] = true; if (_globals[kForceBeamDown]) _scene->_nextSceneId = _scene->_priorSceneId; else - _game._player._stepEnabled = true; + _game._player._stepEnabled = true; } if (_game._trigger == 80) { @@ -690,7 +690,7 @@ void Scene803::step() { } if (_game._trigger == 110) - _scene->_nextSceneId = 808; + _scene->_nextSceneId = 808; if (_game._trigger == 130) { _globals[kBeamIsUp] = true; @@ -699,7 +699,7 @@ void Scene803::step() { if (_game._trigger == 140) { if (!_globals[kWindowFixed]) { - _scene->_nextSceneId = 810; + _scene->_nextSceneId = 810; _globals[kInSpace] = true; } else { if (!_globals[kShieldModInstalled]) @@ -723,9 +723,9 @@ void Scene803::step() { } if (_game._trigger == 151) { - _globals[kBeamIsUp] = false; - _globals[kFromCockpit] = false; - _globals[kExitShip] = false; + _globals[kBeamIsUp] = false; + _globals[kFromCockpit] = false; + _globals[kExitShip] = false; _game._player._stepEnabled = true; } } @@ -742,8 +742,8 @@ void Scene803::actions() { if (_action.isAction(VERB_TAKE, 0x472)) { switch (_game._trigger) { case 0: - _game._player._stepEnabled = false; - _game._player._visible = false; + _game._player._stepEnabled = false; + _game._player._visible = false; _globals._sequenceIndexes[9] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], true, 6, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[9], 1, 4); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[9]); @@ -776,7 +776,7 @@ void Scene803::actions() { case 163: _game._player._priorTimer = _scene->_frameStartTime + _game._player._ticksAmount; - _game._player._visible = true; + _game._player._visible = true; _game._player._stepEnabled = true; break; @@ -908,9 +908,8 @@ void Scene804::step() { _resetFrame = 42; } - if (_scene->_activeAnimation->getCurrentFrame() == 65) { + if (_scene->_activeAnimation->getCurrentFrame() == 65) _scene->_sequences.remove(_globals._sequenceIndexes[7]); - } switch (_game._storyMode) { case STORYMODE_NAUGHTY: @@ -1058,6 +1057,123 @@ void Scene804::step() { /*------------------------------------------------------------------------*/ +void Scene805::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(0x476); + _scene->addActiveVocab(0x167); + _scene->addActiveVocab(0x137); +} + +void Scene805::enter() { + _game._player._visible = false; + _scene->_userInterface.setup(kInputLimitedSentences); + + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('a', 1)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('a', 2)); + + if (_globals[kShieldModInstalled]) { + _scene->_hotspots.activate(OBJ_SHIELD_MODULATOR, false); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 25); + int idx = _scene->_dynamicHotspots.add(0x137, 0x476, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(0, 0), FACING_DUMMY); + } + + if (_globals[kTargetModInstalled]) { + _scene->_hotspots.activate(OBJ_TARGET_MODULE, false); + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 12); + int idx = _scene->_dynamicHotspots.add(0x167, 0x476, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(0, 0), FACING_DUMMY); + } + + sceneEntrySound(); +} + +void Scene805::step() { + if (_game._trigger == 70) { + _scene->_hotspots.activate(OBJ_SHIELD_MODULATOR, false); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 25); + int idx = _scene->_dynamicHotspots.add(0x137, 0x476, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(0, 0), FACING_DUMMY); + _globals[kShieldModInstalled] = true; + _game._objects.setRoom(OBJ_SHIELD_MODULATOR, NOWHERE); + _game._player._stepEnabled = true; + _vm->_sound->command(24); + } + + if (_game._trigger == 80) { + _scene->_hotspots.activate(OBJ_TARGET_MODULE, false); + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 12); + int idx = _scene->_dynamicHotspots.add(0x167, 0x476, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(0, 0), FACING_DUMMY); + _globals[kTargetModInstalled] = true; + _game._objects.setRoom(OBJ_TARGET_MODULE, NOWHERE); + _game._player._stepEnabled = true; + _vm->_sound->command(24); + } + + if (_game._trigger == 71) { + _scene->_hotspots.activate(OBJ_SHIELD_MODULATOR, true); + _globals[kShieldModInstalled] = false; + _game._objects.addToInventory(OBJ_SHIELD_MODULATOR); + _game._player._stepEnabled = true; + } + + if (_game._trigger == 81) { + _scene->_hotspots.activate(OBJ_TARGET_MODULE, true); + _globals[kTargetModInstalled] = false; + _game._objects.addToInventory(OBJ_TARGET_MODULE); + _game._player._stepEnabled = true; + } +} + +void Scene805::preActions() { + _game._player._needToWalk = false; +} + +void Scene805::actions() { + if (_action.isAction(0x298, 0x398)) + _scene->_nextSceneId = 804; + else if (_action.isAction(0x474, 0x137) && _game._objects.isInInventory(OBJ_SHIELD_MODULATOR)) { + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 7, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], -1, -2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 70); + _game._player._stepEnabled = false; + } else if (_action.isAction(0x474, 0x167) && _game._objects.isInInventory(OBJ_TARGET_MODULE)) { + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 7, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], -1, -2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 80); + _game._player._stepEnabled = false; + } else if (_action.isAction(0x476, 0x137) && _globals[kShieldModInstalled]) { + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _globals._sequenceIndexes[1] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 7, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], -1, -2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 71); + _game._player._stepEnabled = false; + } else if (_action.isAction(0x476, 0x167) && _globals[kTargetModInstalled]) { + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; + _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 7, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], -1, -2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 81); + _game._player._stepEnabled = false; + } else if (_action.isAction(0x474, 0x137) && !_game._objects.isInInventory(OBJ_SHIELD_MODULATOR)) + _vm->_dialogs->show(80511); + else if (_action.isAction(0x474, 0x167) && !_game._objects.isInInventory(OBJ_TARGET_MODULE)) + _vm->_dialogs->show(80510); + else if (_action.isAction(0x476, 0x475)) + _vm->_dialogs->show(80512); + else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + void Scene807::setup() { _game._player._spritesPrefix = ""; // The original was calling Scene8xx::setAAName() diff --git a/engines/mads/nebular/nebular_scenes8.h b/engines/mads/nebular/nebular_scenes8.h index 3af0a1cc22..00dcb7e2d3 100644 --- a/engines/mads/nebular/nebular_scenes8.h +++ b/engines/mads/nebular/nebular_scenes8.h @@ -111,6 +111,18 @@ public: virtual void actions() {}; }; +class Scene805: public Scene8xx{ +public: + Scene805(MADSEngine *vm) : Scene8xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions(); + virtual void actions(); + virtual void postActions() {}; +}; + class Scene807: public SceneTeleporter { public: Scene807(MADSEngine *vm) : SceneTeleporter(vm) {} diff --git a/engines/mads/player.h b/engines/mads/player.h index 97fc3e75cd..8127ee293c 100644 --- a/engines/mads/player.h +++ b/engines/mads/player.h @@ -42,7 +42,7 @@ enum Facing { FACING_NORTH = 8, FACING_SOUTH = 2, FACING_EAST = 6, FACING_WEST = 4, FACING_NORTHEAST = 9, FACING_SOUTHEAST = 3, FACING_SOUTHWEST = 1, FACING_NORTHWEST = 7, - FACING_NONE = 5 + FACING_NONE = 5, FACING_DUMMY = 0 }; class Player { -- cgit v1.2.3 From ba4122cca206268f93b248b83c3975d948204e08 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 18 May 2014 14:42:19 +0200 Subject: MADS: Implement scene 808 --- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes8.cpp | 244 ++++++++++++++++++++++++++++--- engines/mads/nebular/nebular_scenes8.h | 15 ++ 3 files changed, 241 insertions(+), 20 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 8b3456cff0..4b59d2453b 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -287,7 +287,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 807: // teleporter return new Scene807(vm); case 808: // antigrav control - return new DummyScene(vm); // TODO + return new Scene808(vm); case 810: // cutscene: Rex's ship leaving the planet return new DummyScene(vm); // TODO diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index ab3b67eefb..b2b2895cfd 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -322,7 +322,7 @@ void Scene802::enter() { _game._player._playerPos.x = _globals[kCutX]; _game._player._playerPos.y = _globals[kCutY]; _game._player._facing = (Facing)_globals[kCutFacing]; - _globals[kCutX] = 0; + _globals[kCutX] = 0; _globals[kCameFromCut] = false; _globals[kReturnFromCut] = false; _globals[kBeamIsUp] = false; @@ -337,8 +337,8 @@ void Scene802::enter() { _game._player._facing = FACING_WEST; } else if (_scene->_priorSceneId != -2) { - _game._player._playerPos = Common::Point(15, 129); - _game._player._facing = FACING_EAST; + _game._player._playerPos = Common::Point(15, 129); + _game._player._facing = FACING_EAST; } _game._player._visible = true; @@ -408,7 +408,7 @@ void Scene802::actions() { switch (_game._trigger) { case (0): _game._player._stepEnabled = false; - _game._player._visible = false; + _game._player._visible = false; _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], true, 7, 2, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 2); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[2]); @@ -425,7 +425,7 @@ void Scene802::actions() { _game._player._priorTimer = _scene->_frameStartTime + _game._player._ticksAmount; _game._player._visible = true; _scene->_sequences.addTimer(20, 3); - break; + break; case 3: _game._player._stepEnabled = true; @@ -440,7 +440,7 @@ void Scene802::actions() { switch (_game._trigger) { case (0): _game._player._stepEnabled = false; - _game._player._visible = false; + _game._player._visible = false; _globals._sequenceIndexes[5] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[5], true, 7, 2, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 1, 4); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); @@ -458,7 +458,7 @@ void Scene802::actions() { _game._player._priorTimer = _scene->_frameStartTime + _game._player._ticksAmount; _game._player._visible = true; _scene->_sequences.addTimer(20, 3); - break; + break; case 3: _game._player._stepEnabled = true; @@ -478,7 +478,7 @@ void Scene802::actions() { else if (_globals[kRemoteOnGround] && !_game._objects.isInInventory(OBJ_SHIELD_MODULATOR) && !_globals[kShieldModInstalled] && (_action.isAction(VERB_LOOK, 0x392) || _action._lookFlag)) _vm->_dialogs->show(80213); - else if (_globals[kRemoteOnGround] && (_game._objects.isInInventory(OBJ_SHIELD_MODULATOR) || _globals[kShieldModInstalled]) + else if (_globals[kRemoteOnGround] && (_game._objects.isInInventory(OBJ_SHIELD_MODULATOR) || _globals[kShieldModInstalled]) && (_action.isAction(VERB_LOOK, 0x392) || _action._lookFlag)) _vm->_dialogs->show(80212); else if (!_game._objects.isInInventory(OBJ_SHIELD_MODULATOR) && !_globals[kShieldModInstalled] && _action.isAction(VERB_LOOK, 0x137)) @@ -537,7 +537,7 @@ void Scene803::enter() { _globals._sequenceIndexes[7] = _scene->_sequences.startCycle(_globals._spriteIndexes[7], false, 1); int idx = _scene->_dynamicHotspots.add(0x472, 0xD, _globals._sequenceIndexes[7], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(66, 123), FACING_SOUTH); - } + } if (!_globals[kBeamIsUp] && !_globals[kReturnFromCut] && (!_globals[kFromCockpit] || _globals[kExitShip])) { _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 8, 1, 0, 0); @@ -548,8 +548,8 @@ void Scene803::enter() { if (!_globals[kFromCockpit]) { if (!_globals[kReturnFromCut]) { if (_scene->_priorSceneId != -2) { - _game._player._playerPos = Common::Point(15, 130); - _game._player._facing = FACING_EAST; + _game._player._playerPos = Common::Point(15, 130); + _game._player._facing = FACING_EAST; } _game._player._visible = true; } else if (!_globals[kBeamIsUp]){ @@ -564,13 +564,13 @@ void Scene803::enter() { _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 1); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 80); _vm->_sound->command(14); - } + } if (_globals[kBeamIsUp] && !_globals[kReturnFromCut]){ if (_globals[kForceBeamDown]) _game._player._visible = false; else - _game._player._visible = true; + _game._player._visible = true; _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('b', 1)); _vm->_sound->command(15); @@ -621,7 +621,7 @@ void Scene803::step() { _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 8, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 2, 2); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); - if (!_globals[kHoppyDead]) { + if (!_globals[kHoppyDead]) { _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 7, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 7, 12); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5],SEQUENCE_TRIGGER_EXPIRE, 0, 101); @@ -642,7 +642,7 @@ void Scene803::step() { else _game._player._stepEnabled = true; } - } + } if (_game._trigger == 101) { _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, -2); @@ -714,7 +714,7 @@ void Scene803::step() { } if (_game._trigger == 150) { - _scene->_sequences.remove(_globals._sequenceIndexes[6]); + _scene->_sequences.remove(_globals._sequenceIndexes[6]); _vm->_sound->command(18); _globals._sequenceIndexes[6] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[6], false, 8, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[6], 1, 19); @@ -743,7 +743,7 @@ void Scene803::actions() { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; - _game._player._visible = false; + _game._player._visible = false; _globals._sequenceIndexes[9] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], true, 6, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[9], 1, 4); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[9]); @@ -1147,14 +1147,14 @@ void Scene805::actions() { _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 80); _game._player._stepEnabled = false; } else if (_action.isAction(0x476, 0x137) && _globals[kShieldModInstalled]) { - _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _scene->_sequences.remove(_globals._sequenceIndexes[1]); _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _globals._sequenceIndexes[1] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 7, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], -1, -2); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 71); _game._player._stepEnabled = false; } else if (_action.isAction(0x476, 0x167) && _globals[kTargetModInstalled]) { - _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _scene->_sequences.remove(_globals._sequenceIndexes[2]); _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 7, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], -1, -2); @@ -1230,5 +1230,211 @@ void Scene807::actions() { /*------------------------------------------------------------------------*/ +void Scene808::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene808::enter() { + _scene->_userInterface.setup(kInputLimitedSentences); + + _globals._spriteIndexes[4] = _scene->_sprites.addSprites ("*REXHAND"); + _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('b', 0)); + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('b', 1)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('b', 2)); + + if (_globals[kTopButtonPushed]) + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); + else + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 1); + + _goingTo803 = false; + + if (_globals[kCameFromCut] && _globals[kCutX] != 0) { + _globals[kCutX] = 0; + _globals[kCameFromCut] = false; + _globals[kReturnFromCut] = false; + _globals[kBeamIsUp] = false; + _globals[kForceBeamDown] = false; + _globals[kDontRepeat] = false; + } else if ((_scene->_priorSceneId == 803) && _globals[kReturnFromCut]){ + _globals[kDontRepeat] = false; + _globals[kBeamIsUp] = true; + _globals[kAntigravClock] = _scene->_frameStartTime; + _globals[kAntigravTiming] = _scene->_frameStartTime; + _globals[kForceBeamDown] = false; + _globals[kReturnFromCut] = false; + } + + _globals[kBetweenRooms] = false; + + if (_globals[kBeamIsUp]) { + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 8); + } + + sceneEntrySound(); +} + +void Scene808::actions() { + if (_action.isAction(0x11A, 0x3BC)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 4, 1, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(248, 211)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 70); + break; + + case 70: + if (!_globals[kBeamIsUp] && !_globals[kTopButtonPushed]) { + _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 8); + _goingTo803 = true; + _vm->_sound->command(20); + _vm->_sound->command(25); + } + _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 4, 1, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(248, 211)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 71); + break; + + case 71: + _game._player._stepEnabled = true; + if (_goingTo803 && !_globals[kTopButtonPushed]) { + _goingTo803 = false; + _globals[kReturnFromCut] = true; + _scene->_nextSceneId = 803; + } + break; + + default: + break; + } + } else if (_action.isAction(0x11A, 0x3BE)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 4, 1, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(248, 186)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 90); + break; + case 90: + if (_globals[kTopButtonPushed]) { + _scene->_sequences.remove(_globals._sequenceIndexes[1]); + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 8); + _vm->_sound->command(20); + } + _globals[kTopButtonPushed] = false; + _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 4, 1, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(248, 186)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 91); + break; + + case 91: + _game._player._stepEnabled = true; + break; + + default: + break; + } + } else if (_action.isAction(0x11A, 0x3BD)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 4, 1, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(248, 163)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 80); + break; + + case 80: + if (!_globals[kTopButtonPushed]) { + _scene->_sequences.remove(_globals._sequenceIndexes[2]); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 8); + _vm->_sound->command(20); + } + _globals[kTopButtonPushed] = true; + _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 4, 1, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(248, 163)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 81); + break; + + case 81: + _game._player._stepEnabled = true; + break; + + default: + break; + } + } else if (_action.isAction(0x11A, 0x3BF)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 4, 2, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(168, 211)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 70); + break; + + case 70: + _game._player._stepEnabled = true; + break; + + default: + break; + } + } else if (_action.isAction(0x11A, 0x3BB)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 4, 2, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(172, 163)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 80); + break; + + case 80: + _game._player._stepEnabled = true; + break; + + default: + break; + } + } else if (_action.isAction(0x11A, 0x3BA)) { + switch (_game._trigger) { + case 0: + _game._player._stepEnabled = false; + _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 4, 2, 0, 0); + _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(172, 186)); + _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 2); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 90); + break; + + case 90: + _game._player._stepEnabled = true; + break; + + default: + break; + } + } else if (_action.isAction(0x298, 0x1E0)) { + _scene->_nextSceneId = 801; + _globals[kBetweenRooms] = true; + } else + return; + + _action._inProgress = false; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes8.h b/engines/mads/nebular/nebular_scenes8.h index 00dcb7e2d3..7c228538b9 100644 --- a/engines/mads/nebular/nebular_scenes8.h +++ b/engines/mads/nebular/nebular_scenes8.h @@ -133,6 +133,21 @@ public: virtual void actions(); }; +class Scene808: public Scene8xx{ +private: + bool _goingTo803; + +public: + Scene808(MADSEngine *vm) : Scene8xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step() {}; + virtual void preActions() {}; + virtual void actions(); + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From d3b136993f6a47ce5701462b641598bc7180142c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 18 May 2014 14:52:19 +0200 Subject: MADS: Implement scene 810 --- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes8.cpp | 27 +++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes8.h | 15 +++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index 4b59d2453b..f8c113e8c5 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -289,7 +289,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { case 808: // antigrav control return new Scene808(vm); case 810: // cutscene: Rex's ship leaving the planet - return new DummyScene(vm); // TODO + return new Scene810(vm); default: error("Invalid scene %d called", scene._nextSceneId); diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index b2b2895cfd..fee39a776e 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -1436,5 +1436,32 @@ void Scene808::actions() { /*------------------------------------------------------------------------*/ +void Scene810::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene810::enter() { + _scene->_userInterface.setup(kInputLimitedSentences); + _game._player._visible = false; + _game._player._stepEnabled = false; + _scene->loadAnimation(Resources::formatName(810, 'a', -1, EXT_AA, "")); + _moveAllowed = true; + + sceneEntrySound(); +} + +void Scene810::step() { + if ((_scene->_activeAnimation->getCurrentFrame() == 200) && _moveAllowed) { + _scene->_sequences.addTimer(100, 70); + _moveAllowed = false; + } + + if (_game._trigger == 70) + _scene->_nextSceneId = 804; +} + +/*------------------------------------------------------------------------*/ + } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes8.h b/engines/mads/nebular/nebular_scenes8.h index 7c228538b9..5193c4f401 100644 --- a/engines/mads/nebular/nebular_scenes8.h +++ b/engines/mads/nebular/nebular_scenes8.h @@ -148,6 +148,21 @@ public: virtual void postActions() {}; }; +class Scene810: public Scene8xx{ +private: + bool _moveAllowed; + +public: + Scene810(MADSEngine *vm) : Scene8xx(vm) {} + + virtual void setup(); + virtual void enter(); + virtual void step(); + virtual void preActions() {}; + virtual void actions() {}; + virtual void postActions() {}; +}; + } // End of namespace Nebular } // End of namespace MADS -- cgit v1.2.3 From e59d2ace2db3a9c52195332655798e93f19a54d9 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 18 May 2014 18:15:51 +0200 Subject: MADS: Some work and bugfixing in scene 701 --- engines/mads/nebular/nebular_scenes7.cpp | 141 ++++++++++++++++++++----------- 1 file changed, 93 insertions(+), 48 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index cc24070169..85c79e4877 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -103,7 +103,7 @@ void Scene701::enter() { _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 0)); _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('b', 5)); _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('b', 0)); - //_globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('b', 1)); // FIXME: Broken sprite? +// _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('b', 1)); // TODO: FIXME: Broken sprite? _globals._spriteIndexes[5] = _scene->_sprites.addSprites("*RM202A1"); _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('b', 8)); @@ -156,15 +156,15 @@ void Scene701::enter() { break; } - // TODO: Enable once sprite 3 can be loaded properly - /* +// TODO: Enable once sprite 3 can be loaded properly +/* if (_globals[kLineStatus] == LINE_DROPPED || _globals[kLineStatus] == LINE_TIED) { _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -1); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 8); int idx = _scene->_dynamicHotspots.add(NOUN_FISHING_LINE, VERB_WALKTO, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); _fishingLineId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(234, 129), FACING_NORTHEAST); } - */ +*/ if (_scene->_priorSceneId == 702) { _game._player._playerPos = Common::Point(309, 138); @@ -203,11 +203,13 @@ void Scene701::step() { _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[5], Common::Point(155, 129)); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 61); break; + case 61: _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[5]); _game._player._visible = true; _game._player._stepEnabled = true; break; + case 70: _vm->_sound->command(16); _scene->_sequences.remove(_globals._sequenceIndexes[1]); @@ -216,10 +218,12 @@ void Scene701::step() { _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 71); break; + case 71: _game._player.walk(Common::Point(61, 131), FACING_EAST); _scene->_sequences.addTimer(2 * 60, 72); break; + case 72: _vm->_sound->command(17); _globals._sequenceIndexes[1] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 5, 1, 0, 0); @@ -227,14 +231,16 @@ void Scene701::step() { _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 73); break; + case 73: _game._player._stepEnabled = true; - _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -1); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -1); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); _scene->_kernelMessages.reset(); break; - case 80: + + case 80: { _game._player._visible = true; _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1); @@ -243,28 +249,29 @@ void Scene701::step() { _scene->_dynamicHotspots.setPosition(idx, Common::Point(234, 129), FACING_NORTH); _globals[kBoatStatus] = BOAT_TIED; _game._player._stepEnabled = true; + } + break; + + default: break; } } void Scene701::preActions() { - if (_action.isAction(VERB_WALKTO, NOUN_EAST_END_OF_PLATFORM)) { + if (_action.isAction(VERB_WALKTO, NOUN_EAST_END_OF_PLATFORM)) _game._player._walkOffScreenSceneId = 702; - } - if (_action.isAction(VERB_LOOK, NOUN_BUILDING)) { + if (_action.isAction(VERB_LOOK, NOUN_BUILDING)) _game._player.walk(Common::Point(154, 129), FACING_NORTHEAST); - } - if (_action.isAction(VERB_LOOK, NOUN_BINOCULARS, NOUN_BUILDING)) { + if (_action.isAction(VERB_LOOK, NOUN_BINOCULARS, NOUN_BUILDING)) _game._player.walk(Common::Point(154, 129), FACING_NORTH); - } } void Scene701::actions() { if (_action.isAction(VERB_WALK_ALONG, NOUN_PLATFORM)) return; - + if (_action.isAction(VERB_LOOK, NOUN_BINOCULARS, NOUN_BUILDING) && _game._objects[OBJ_VASE]._roomNumber == 706) { switch (_game._trigger) { case 0: @@ -274,6 +281,7 @@ void Scene701::actions() { _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[5], Common::Point(155, 129)); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 1); break; + case 1: { int temp = _globals._sequenceIndexes[5]; _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, -2); @@ -282,9 +290,13 @@ void Scene701::actions() { _scene->_sequences.addTimer(15, 2); } break; + case 2: _scene->_nextSceneId = 710; break; + + default: + break; } } else if (_action.isAction(VERB_STEP_INTO, NOUN_ELEVATOR)) { switch (_game._trigger) { @@ -299,10 +311,12 @@ void Scene701::actions() { _scene->_kernelMessages.add(Common::Point(0, 0), 0x310, 34, 0, 120, _game.getQuote(0x30D)); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 1); break; + case 1: _game._player.walk(Common::Point(22, 131), FACING_EAST); _scene->_sequences.addTimer(2 * 60, 3); break; + case 3: _vm->_sound->command(17); _globals._sequenceIndexes[1] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 5, 1, 0, 0); @@ -310,13 +324,17 @@ void Scene701::actions() { _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 4); break; + case 4: - _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -1); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -1); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); _globals[kResurrectRoom] = 701; _scene->_nextSceneId = 605; break; + + default: + break; } } else if ((_action.isAction(VERB_PULL, NOUN_BOAT) || _action.isAction(VERB_TAKE, NOUN_BOAT) || _action.isAction(VERB_PULL, NOUN_FISHING_LINE) || _action.isAction(VERB_TAKE, NOUN_FISHING_LINE)) && @@ -324,21 +342,43 @@ void Scene701::actions() { if (_globals[kBoatStatus] == BOAT_TIED_FLOATING) { switch (_game._trigger) { case 0: - // TODO + _game._player._stepEnabled = false; + _scene->_sequences.remove(_globals._sequenceIndexes[4]); + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _scene->_dynamicHotspots.remove(_fishingLineId); + _scene->_hotspots.activate(NOUN_BOAT, false); + _game._player._visible = false; + _scene->loadAnimation(formAnimName('E', -1), 1); break; - case 1: - // TODO + + case 1: { + _game._player._visible = true; + _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; + _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1); + _scene->_sequences.setDepth (_globals._sequenceIndexes[2], 9); + int idx = _scene->_dynamicHotspots.add(NOUN_BOAT, VERB_CLIMB_INTO, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.setPosition(idx, Common::Point(231, 127), FACING_NORTH); + _scene->_sequences.addTimer(15, 2); + } break; + case 2: _globals[kBoatStatus] = BOAT_TIED; _globals[kLineStatus] = LINE_NOW_UNTIED; _game._player._stepEnabled = true; break; + + default: + break; } } else if (_globals[kBoatStatus] == BOAT_TIED) { _vm->_dialogs->show(70125); } else if (_globals[kLineStatus] == LINE_DROPPED) { - // TODO + _globals[kLineStatus] = LINE_NOW_UNTIED; + _game._objects.addToInventory(OBJ_FISHING_LINE); + _vm->_sound->command(15); + _scene->_sequences.remove(_globals._sequenceIndexes[3]); + _vm->_dialogs->showItem(OBJ_FISHING_LINE, 70126); } else { _vm->_dialogs->show(70127); } @@ -350,9 +390,13 @@ void Scene701::actions() { _game._player._visible = false; _scene->loadAnimation(formAnimName('B', 0), 1); break; + case 1: _scene->_nextSceneId = 703; break; + + default: + break; } } else if (_action._lookFlag) { if (_globals[kBoatStatus] != BOAT_GONE) { @@ -360,39 +404,40 @@ void Scene701::actions() { _vm->_dialogs->show(70128); else _vm->_dialogs->show(70110); - } else { + } else _vm->_dialogs->show(70111); - } - } else if (_action.isAction(VERB_LOOK, NOUN_SUBMERGED_CITY)) { + } else if (_action.isAction(VERB_LOOK, NOUN_SUBMERGED_CITY)) _vm->_dialogs->show(70112); - } else if (_action.isAction(VERB_LOOK, 0)) { + else if (_action.isAction(VERB_LOOK, 0)) _vm->_dialogs->show(70113); - } else if (_action.isAction(VERB_LOOK, NOUN_PLATFORM)) { + else if (_action.isAction(VERB_LOOK, NOUN_PLATFORM)) _vm->_dialogs->show(70114); - } else if (_action.isAction(VERB_LOOK, NOUN_CEMENT_PYLON)) { + else if (_action.isAction(VERB_LOOK, NOUN_CEMENT_PYLON)) _vm->_dialogs->show(70115); - } else if (_action.isAction(VERB_LOOK, NOUN_HOOK)) { + else if (_action.isAction(VERB_LOOK, NOUN_HOOK)) { if (_globals[kLineStatus] == LINE_NOT_DROPPED || _globals[kLineStatus] == LINE_NOW_UNTIED) _vm->_dialogs->show(70116); else _vm->_dialogs->show(70117); - } else if (_action.isAction(VERB_LOOK, NOUN_ROCK)) { + } else if (_action.isAction(VERB_LOOK, NOUN_ROCK)) _vm->_dialogs->show(70118); - } else if (_action.isAction(VERB_TAKE, NOUN_ROCK)) { + else if (_action.isAction(VERB_TAKE, NOUN_ROCK)) _vm->_dialogs->show(70119); - } else if (_action.isAction(VERB_LOOK, NOUN_EAST_END_OF_PLATFORM)) { + else if (_action.isAction(VERB_LOOK, NOUN_EAST_END_OF_PLATFORM)) _vm->_dialogs->show(70120); - } else if (_action.isAction(VERB_LOOK, NOUN_BUILDING)) { + else if (_action.isAction(VERB_LOOK, NOUN_BUILDING)) _vm->_dialogs->show(70121); - } else if (_action.isAction(VERB_LOOK, NOUN_BOAT)) { + else if (_action.isAction(VERB_LOOK, NOUN_BOAT)) { if (_globals[kBoatStatus] == BOAT_ADRIFT || _globals[kBoatStatus] == BOAT_TIED_FLOATING) _vm->_dialogs->show(70122); else _vm->_dialogs->show(70123); - } else if (_action.isAction(VERB_CAST, NOUN_FISHING_ROD, NOUN_BOAT)) { - if (_game._objects.isInInventory(OBJ_FISHING_LINE)) - _vm->_dialogs->show(70124); - } + } else if (_action.isAction(VERB_CAST, NOUN_FISHING_ROD, NOUN_BOAT) && _game._objects.isInInventory(OBJ_FISHING_LINE)) + _vm->_dialogs->show(70124); + else + return; + + _action._inProgress = false; } /*------------------------------------------------------------------------*/ @@ -1812,13 +1857,13 @@ void Scene706::actions() { _action._inProgress = false; return; } - + if (_action.isAction(0x298, 0x2FA)) { _scene->_nextSceneId = 705; _action._inProgress = false; return; } - + if (_action.isAction(VERB_TAKE, 0x17D)) { if (_game._difficulty != DIFFICULTY_EASY) { _animationMode = 1; @@ -1830,7 +1875,7 @@ void Scene706::actions() { _action._inProgress = false; return; } - + if (_action.isAction(VERB_PUT, 0x2E, 0x344)) { if ((_globals[kBottleStatus] == 2 && _game._difficulty == DIFFICULTY_HARD) || (_globals[kBottleStatus] != 0 && _game._difficulty != DIFFICULTY_HARD)) { @@ -1847,7 +1892,7 @@ void Scene706::actions() { return; } } - + if (_action.isAction(VERB_PUT, 0x344) && _game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId))) { int objectId = _game._objects.getIdFromDesc(_action._activeAction._objectNameId); if (_game._objects[objectId].hasQuality(10)) @@ -2083,7 +2128,7 @@ void Scene751::enter() { } else if (_rexHandingLine) { _game._player._visible = false; _game._player._playerPos = Common::Point(268, 140); - _game._player._facing = FACING_NORTHWEST; + _game._player._facing = FACING_NORTHWEST; _game._player._visible = false; _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 7); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[2]); @@ -2140,7 +2185,7 @@ void Scene751::step() { _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 61); - break; + break; case 61: _game._player.walk(Common::Point(61, 131), FACING_EAST); @@ -2153,10 +2198,10 @@ void Scene751::step() { _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 63); - break; + break; case 63: - _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -1); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -1); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); _game._player._stepEnabled = true; @@ -2201,12 +2246,12 @@ void Scene751::preActions() { _game._player._visible = true; _rexHandingLine = false; _game._player._stepEnabled = true; - _game._player._readyToWalk = true; + _game._player._readyToWalk = true; break; default: break; - } + } } } @@ -2239,7 +2284,7 @@ void Scene751::actions() { default: break; } - } else if (_action.isAction(0x2F9, 0x317)) { + } else if (_action.isAction(0x2F9, 0x317)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -2254,7 +2299,7 @@ void Scene751::actions() { break; case 1: - _game._player.walk(Common::Point(22, 131), FACING_EAST); + _game._player.walk(Common::Point(22, 131), FACING_EAST); _scene->_sequences.addTimer(120, 3); break; @@ -2267,7 +2312,7 @@ void Scene751::actions() { break; case 4: - _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -1); + _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -1); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); _scene->_sequences.addTimer(60, 5); @@ -2337,7 +2382,7 @@ void Scene751::actions() { _vm->_dialogs->show(75113); else if (_action.isAction(VERB_LOOK, 0x316)) _vm->_dialogs->show(75114); - else if ((_action.isAction(VERB_LOOK, 0x467) || _action.isAction(VERB_LOOK, 0x87)) + else if ((_action.isAction(VERB_LOOK, 0x467) || _action.isAction(VERB_LOOK, 0x87)) && (_globals[kLineStatus] == 2 || _globals[kLineStatus] == 3)) _vm->_dialogs->show(75116); else if (_action.isAction(VERB_LOOK, 0x467)) -- cgit v1.2.3 From cacd7c51ed9e06abc8a5c9e301054a585b7aab45 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 18 May 2014 19:14:41 +0200 Subject: MADS: Remove temporary DummyScene --- engines/mads/nebular/nebular_scenes.h | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index 2c38dd0689..ac983633cc 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -232,20 +232,7 @@ protected: SceneTeleporter(MADSEngine *vm) : NebularScene(vm) {} }; -// TODO: Temporary, remove once all scenes are implemented properly -class DummyScene: public NebularScene { -public: - DummyScene(MADSEngine *vm) : NebularScene(vm) { - warning("Unimplemented scene"); - } - - virtual void setup() {} - virtual void enter() {} - virtual void actions() {} -}; - } // End of namespace Nebular - } // End of namespace MADS #endif /* MADS_NEBULAR_SCENES_H */ -- cgit v1.2.3 From 96aaf48f44c9c832e5b0daa66a57726ca732b9d9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 18 May 2014 16:12:40 -0400 Subject: MADS: Changed 16-bit globals over to be 32-bits --- engines/mads/globals.cpp | 24 ++---------------------- engines/mads/globals.h | 15 ++------------- engines/mads/nebular/globals_nebular.cpp | 2 +- engines/mads/nebular/globals_nebular.h | 10 +++++----- 4 files changed, 10 insertions(+), 41 deletions(-) diff --git a/engines/mads/globals.cpp b/engines/mads/globals.cpp index f46ca1eb65..1d088992ea 100644 --- a/engines/mads/globals.cpp +++ b/engines/mads/globals.cpp @@ -26,28 +26,8 @@ namespace MADS { void Globals::reset() { - for (uint i = 0; i < _data.size(); ++i) - _data[i] = 0; + for (uint i = 0; i < size(); ++i) + (*this)[i] = 0; } -void Globals::synchronize(Common::Serializer &s) { - int count = _data.size(); - s.syncAsUint16LE(count); - int16 v; - - if (s.isSaving()) { - for (int idx = 0; idx < count; ++idx) { - v = _data[idx]; - s.syncAsSint16LE(v); - } - } else { - _data.clear(); - for (int idx = 0; idx < count; ++idx) { - s.syncAsSint16LE(v); - _data.push_back(v); - } - } -} - - } // End of namespace MADS diff --git a/engines/mads/globals.h b/engines/mads/globals.h index 92e9d96f3e..92cd0bb403 100644 --- a/engines/mads/globals.h +++ b/engines/mads/globals.h @@ -26,31 +26,20 @@ #include "common/scummsys.h" #include "common/array.h" #include "common/serializer.h" +#include "mads/resources.h" namespace MADS { -class Globals { -protected: - Common::Array _data; +class Globals: public SynchronizedList { public: Globals() {} virtual ~Globals() {} - /** - * Square brackets operator for accessing flags - */ - int16 &operator[](int idx) { return _data[idx]; } - /* * Resets all the globals to empty */ void reset(); - - /** - * Synchronize the globals data - */ - virtual void synchronize(Common::Serializer &s); }; } // End of namespace MADS diff --git a/engines/mads/nebular/globals_nebular.cpp b/engines/mads/nebular/globals_nebular.cpp index 2e50794b60..7bb89a570c 100644 --- a/engines/mads/nebular/globals_nebular.cpp +++ b/engines/mads/nebular/globals_nebular.cpp @@ -30,7 +30,7 @@ namespace Nebular { NebularGlobals::NebularGlobals(): Globals() { // Initialize lists - _data.resize(210); + resize(210); _spriteIndexes.resize(30); _sequenceIndexes.resize(30); diff --git a/engines/mads/nebular/globals_nebular.h b/engines/mads/nebular/globals_nebular.h index fea90c515e..980e6ea1eb 100644 --- a/engines/mads/nebular/globals_nebular.h +++ b/engines/mads/nebular/globals_nebular.h @@ -36,7 +36,7 @@ enum GlobalId { kSexOfRex = 0, kOldSexOfRex = 1, kWalkerTiming = 2, - kWalkerTiming0 = 3, +// kWalkerTiming0 = 3, kTalkInanimateCount = 4, kCopyProtectFailed = 5, @@ -162,9 +162,9 @@ enum GlobalId { /* Section #6 Time-Bomb Variables */ kTimebombClock = 142, - kTimebombClock0 = 143, +// kTimebombClock0 = 143, kTimebombTimer = 144, - kTimebombTimer0 = 145, +// kTimebombTimer0 = 145, kWarnedFloodCity = 146, /* Section #7 Variables */ @@ -175,9 +175,9 @@ enum GlobalId { /* Section #8 Variables */ kAntigravClock = 160, - kAntigravClock0 = 161, +// kAntigravClock0 = 161, kAntigravTiming = 162, - kAntigravTiming0 = 163, +// kAntigravTiming0 = 163, kWindowFixed = 164, kInSpace = 165, kReturnFromCut = 166, -- cgit v1.2.3 From edb5db36b525526eea3622c38ec1057e103e76a2 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 18 May 2014 22:29:46 +0200 Subject: MADS: Add removePlayerSprites(), remove a TODO --- engines/mads/nebular/nebular_scenes2.cpp | 3 +-- engines/mads/player.cpp | 14 ++++++++++++++ engines/mads/player.h | 2 ++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 1f5200ab92..b423b9f9ef 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -1331,8 +1331,7 @@ void Scene205::actions() { _game._player._stepEnabled = false; _vm->_palette->lock(); _scene->_kernelMessages.reset(); - warning("TODO: sub70402();"); - + _game._player.removePlayerSprites(); _globals._spriteIndexes[9] = _scene->_sprites.addSprites(formAnimName('a', 0)); _vm->_palette->refreshSceneColors(); _globals._sequenceIndexes[9] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 6, 1, 0, 0); diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index 96e2cd6ea1..edec92ad74 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -766,4 +766,18 @@ void Player::synchronize(Common::Serializer &s) { s.syncAsByte(_mirror); } +void Player::removePlayerSprites() { + int heroSpriteId = _spritesStart; + for (int i = 0; i < 8; i++) { + if (_spriteSetsPresent[i]) { + _vm->_game->_scene._sprites.remove(heroSpriteId++); + _spriteSetsPresent[i] = false; + } + } + + _vm->_game->_scene._spriteSlots.clear(); + _vm->_game->_scene._spriteSlots.fullRefresh(); + _vm->_game->_player._visible = false; +} + } // End of namespace MADS diff --git a/engines/mads/player.h b/engines/mads/player.h index 8127ee293c..671ac9d16e 100644 --- a/engines/mads/player.h +++ b/engines/mads/player.h @@ -219,6 +219,8 @@ public: static void preloadSequences(const Common::String &prefix, int level) { // No implementation in ScummVM } + + void removePlayerSprites(); }; } // End of namespace MADS -- cgit v1.2.3 From 7f82b0eafa1663c6f8a46ba62f267cfef85dd2c5 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 18 May 2014 23:00:04 +0200 Subject: MADS: Rework removePlayerSprites(), get rid of another TODO --- engines/mads/animation.h | 2 ++ engines/mads/nebular/nebular_scenes2.cpp | 2 +- engines/mads/player.cpp | 11 +++++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/engines/mads/animation.h b/engines/mads/animation.h index 0556c3aa19..a1d957ee45 100644 --- a/engines/mads/animation.h +++ b/engines/mads/animation.h @@ -217,6 +217,8 @@ public: bool freeFlag() const { return _freeFlag; } bool getAnimMode() const { return _header._animMode; } int roomNumber() const { return _header._roomNumber; } + + void resetSpriteSetsCount() { _header._spriteSetsCount = 0; } // CHECKME: See if it doesn't leak the memory when the destructor is called }; } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index b423b9f9ef..0f8af57651 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -1340,7 +1340,7 @@ void Scene205::actions() { _vm->_sound->command(27); } else if (_game._trigger == 1) { if (_scene->_activeAnimation != nullptr) - warning("scene->_activeAnimation._spriteSetsCount = 0;"); + _scene->_activeAnimation->resetSpriteSetsCount(); _vm->_dialogs->show(20516); _scene->_reloadSceneFlag = true; diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index edec92ad74..3672c80f32 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -767,17 +767,20 @@ void Player::synchronize(Common::Serializer &s) { } void Player::removePlayerSprites() { + Scene &scene = _vm->_game->_scene; int heroSpriteId = _spritesStart; for (int i = 0; i < 8; i++) { if (_spriteSetsPresent[i]) { - _vm->_game->_scene._sprites.remove(heroSpriteId++); + scene._sprites.remove(heroSpriteId++); _spriteSetsPresent[i] = false; } } - _vm->_game->_scene._spriteSlots.clear(); - _vm->_game->_scene._spriteSlots.fullRefresh(); - _vm->_game->_player._visible = false; + if (scene._activeAnimation != nullptr) + scene._activeAnimation->resetSpriteSetsCount(); + + scene._spriteSlots.fullRefresh(); + _visible = false; } } // End of namespace MADS -- cgit v1.2.3 From 78bd805047f634f3174fa77ab6d6082ad725eaf5 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 19 May 2014 07:42:25 +0300 Subject: FULLPIPE: Started implementation of MovGraph::method34() --- engines/fullpipe/motion.cpp | 76 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 75 insertions(+), 1 deletion(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 81bfb7d167..eda29aad03 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -611,7 +611,81 @@ int MovGraph::method2C(StaticANIObject *obj, int x, int y) { return method3C(obj, 1); } -MessageQueue *MovGraph::method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) { +MessageQueue *MovGraph::method34(StaticANIObject *ani, int xpos, int ypos, int fuzzyMatch, int staticsId) { +#if 0 + if (!ani) { + if (_itemsCount < 1) + return 0; + + ani = _items->ani; + } + if (ABS(ani->_ox - x) < 50 && ABS(ani->_oy - y) < 50) + return 0; + + if (!ani->isIdle()) + return 0; + + if (ani->_flags & 0x100) + return 0; + + v10 = method28(ani, x, y, fuzzyMatch, (int *)&ani); + + if (!v10) + return 0; + + if (!ani->_movement) { + v20 = v10; + v33 = (int)ani; + goto LABEL_34; + } + + Common::Point point; + + ani->calcStepLen(&point); + + MessageQueue *mq = sub1(ani, ani->_ox - point.x, ani->_oy - point.y, ani->_movement->_staticsObj1->_staticsId, x, y, 0, fuzzyMatch); + + if (!mq || !mq->getExCommandByIndex(0)) + return 0; + + ExCommand *ex = mq->getExCommandByIndex(0); + + if ((ex->_messageKind != 1 && ex->_messageKind != 20) || ex->_messageNum != ani->_movement->_id || + (ex->_field_14 >= 1 && ex->_field_14 <= ani->_movement->_currDynamicPhaseIndex)) { + v22 = GlobalMessageQueueList_compact(&g_globalMessageQueueList); + v23 = MessageQueue_ctor1(v21, v22); + a2 = (int)v23; + v25 = ExCommand_ctor(v24, ani->_id, 21, 0, 0, 0, 0, 1, 0, 0, 0); + v23 = (MessageQueue *)a2; + v26 = (int)&v23->exCommands.obj.vmt; + v27 = ani->go._okeyCode; + v25->msg._keyCode = (unsigned __int16)v27; + v25->_field_3C = 1; + v25->msg._field_24 = 0; + CPtrList::AddTail(&v23->exCommands, v25); + v29 = ExCommand_ctor(v28, ani->go._id, 51, 0, x, y, 0, 1, 0, 0, 0); + v23 = (MessageQueue *)a2; + v30 = fuzzyMatch; + v29->_keyCode = ani->_okeyCode; + v29->_field_3C = 1; + v29->_field_24 = 0; + v29->_field_20 = v30; + CPtrList::AddTail(v26, v29); + if (MessageQueue_chain(v23, 0)) + return v23; + if (v23) + delete v23; + return 0; + } + + ani->setSomeDynamicPhaseIndex(ex->_field_14); + method28(ani, x, y, fuzzyMatch, (int *)&ani); + v33 = this->_items[getItemIndexByStaticAni(ani)].count; + v20 = this->_items[getItemIndexByStaticAni(ani)].movitems; + LABEL_34: + v32 = this->_callback1(ani, v20, v33); + return method50(ani, v32, a2); +#endif warning("STUB: MovGraph::method34()"); return 0; -- cgit v1.2.3 From 46cedfc90384708bfddcd1bbc6d9468ca3014f31 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 19 May 2014 07:04:26 +0200 Subject: MADS: Implement two palette functions --- engines/mads/nebular/nebular_scenes3.cpp | 4 ++-- engines/mads/palette.cpp | 12 ++++++++++++ engines/mads/palette.h | 2 ++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 4652c51d13..4358aa45b8 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -3236,8 +3236,8 @@ void Scene319::step() { break; case 72: - warning("TODO: sub7CBD8(-1, 0, 0);"); - warning("TODO: sub7CBE4(0, 0, 0);"); + _vm->_palette->setColorFlags(0xFF, 0, 0); + _vm->_palette->setColorValues(0, 0, 0); _vm->_palette->fadeOut(_vm->_palette->_mainPalette, 18, 228, 16, 1, 8, 248, 0, 0); warning("TODO: shake_countdown = 1;"); _scene->_reloadSceneFlag = true; diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index e718059b67..a4608a6c1a 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -714,6 +714,18 @@ void Palette::setLowRange() { _vm->_palette->setPalette(_mainPalette, 0, 4); } +void Palette::setColorFlags(byte r, byte g, byte b) { + _colorFlags[0] = r; + _colorFlags[1] = g; + _colorFlags[2] = b; +} + +void Palette::setColorValues(byte r, byte g, byte b) { + _colorValues[0] = r; + _colorValues[1] = g; + _colorValues[2] = b; +} + void Palette::fadeOut(byte palette[PALETTE_SIZE], int start, int count, int v1, int v2, int v3, int v4, int v5, int v6) { warning("TODO: Palette::fadeOut()"); } diff --git a/engines/mads/palette.h b/engines/mads/palette.h index e1f7de838d..3af0c2805b 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -308,6 +308,8 @@ public: warning("TODO: Palette::close"); } + void setColorFlags(byte r, byte g, byte b); + void setColorValues(byte r, byte g, byte b); void fadeOut(byte palette[PALETTE_SIZE], int start, int count, int v1, int v2, int v3, int v4, int v5, int v6); void lock(); -- cgit v1.2.3 From 0508e395ff4b29ae9a2d837702eaf1bf79bcbb95 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Mon, 19 May 2014 12:57:25 +0100 Subject: TONY: Add missing Russian detection entry. This should fix bug #6589 "TONY: Russian version not detected". --- engines/tony/detection_tables.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/engines/tony/detection_tables.h b/engines/tony/detection_tables.h index ce4651f0ab..28dcaac752 100644 --- a/engines/tony/detection_tables.h +++ b/engines/tony/detection_tables.h @@ -217,7 +217,7 @@ static const TonyGameDescription gameDescriptions[] = { // Tony Tough German "Shoe Box", reported in bug #3582420 { "tony", - 0, + 0, { {"roasted.mpr", 0, "06203dbbc85fdd1e6dc8fc211c1a6207", 135911071}, {"roasted.mpc", 0, "bc3471f098e591dc509dcad401a8d8a5", 389554}, @@ -230,6 +230,23 @@ static const TonyGameDescription gameDescriptions[] = { }, }, + { + // Tony Tough Russian, reported in bug #6589 + { + "tony", + 0, + { + {"roasted.mpr", 0, "06203dbbc85fdd1e6dc8fc211c1a6207", 135911071}, + {"roasted.mpc", 0, "377d6e24adeedc6c5c09c31b92231218", 391536}, + AD_LISTEND + }, + Common::RU_RUS, + Common::kPlatformWindows, + ADGF_NO_FLAGS, + GUIO1(GUIO_NONE) + }, + }, + { AD_TABLE_END_MARKER } }; -- cgit v1.2.3 From d9112a586303d3093c852855ea59b841024bbd9b Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 19 May 2014 17:37:01 +0300 Subject: FULLPIPE: More work on MovGraph::method34() --- engines/fullpipe/motion.cpp | 82 ++++++++++++++++++++++----------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index eda29aad03..21df1c3aae 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -636,55 +636,55 @@ MessageQueue *MovGraph::method34(StaticANIObject *ani, int xpos, int ypos, int f if (!ani->_movement) { v20 = v10; v33 = (int)ani; - goto LABEL_34; - } + } else { + Common::Point point; - Common::Point point; + ani->calcStepLen(&point); + + MessageQueue *mq = sub1(ani, ani->_ox - point.x, ani->_oy - point.y, ani->_movement->_staticsObj1->_staticsId, x, y, 0, fuzzyMatch); - ani->calcStepLen(&point); + if (!mq || !mq->getExCommandByIndex(0)) + return 0; - MessageQueue *mq = sub1(ani, ani->_ox - point.x, ani->_oy - point.y, ani->_movement->_staticsObj1->_staticsId, x, y, 0, fuzzyMatch); + ExCommand *ex = mq->getExCommandByIndex(0); - if (!mq || !mq->getExCommandByIndex(0)) - return 0; + if ((ex->_messageKind != 1 && ex->_messageKind != 20) || ex->_messageNum != ani->_movement->_id || + (ex->_field_14 >= 1 && ex->_field_14 <= ani->_movement->_currDynamicPhaseIndex)) { + mq = new MessageQueue(g_fp->_globalMessageQueueList->compact()); - ExCommand *ex = mq->getExCommandByIndex(0); - - if ((ex->_messageKind != 1 && ex->_messageKind != 20) || ex->_messageNum != ani->_movement->_id || - (ex->_field_14 >= 1 && ex->_field_14 <= ani->_movement->_currDynamicPhaseIndex)) { - v22 = GlobalMessageQueueList_compact(&g_globalMessageQueueList); - v23 = MessageQueue_ctor1(v21, v22); - a2 = (int)v23; - v25 = ExCommand_ctor(v24, ani->_id, 21, 0, 0, 0, 0, 1, 0, 0, 0); - v23 = (MessageQueue *)a2; - v26 = (int)&v23->exCommands.obj.vmt; - v27 = ani->go._okeyCode; - v25->msg._keyCode = (unsigned __int16)v27; - v25->_field_3C = 1; - v25->msg._field_24 = 0; - CPtrList::AddTail(&v23->exCommands, v25); - v29 = ExCommand_ctor(v28, ani->go._id, 51, 0, x, y, 0, 1, 0, 0, 0); - v23 = (MessageQueue *)a2; - v30 = fuzzyMatch; - v29->_keyCode = ani->_okeyCode; - v29->_field_3C = 1; - v29->_field_24 = 0; - v29->_field_20 = v30; - CPtrList::AddTail(v26, v29); - if (MessageQueue_chain(v23, 0)) - return v23; - if (v23) - delete v23; - return 0; + ex = new ExCommand(ani->_id, 21, 0, 0, 0, 0, 1, 0, 0, 0); + ex->_keyCode = ani->_okeyCode; + ex->_field_3C = 1; + ex->msg._field_24 = 0; + mq->addExCommandToEnd(ex); + + ex = new ExCommand(ani->_id, 51, 0, x, y, 0, 1, 0, 0, 0); + ex->_keyCode = ani->_okeyCode; + ex->_field_3C = 1; + ex->_field_24 = 0; + ex->_field_20 = fuzzyMatch; + mq->addExCommandToEnd(ex); + + if (mq->chain(0)) + return mq; + + delete mq; + + return 0; + } + + StaticANIObject *ani2; + + ani->setSomeDynamicPhaseIndex(ex->_field_14); + method28(ani, x, y, fuzzyMatch, ani2); + + int idx = getItemIndexByStaticAni(ani2); + v33 = this->_items[idx].count; + v20 = this->_items[idx].movitems; } - ani->setSomeDynamicPhaseIndex(ex->_field_14); - method28(ani, x, y, fuzzyMatch, (int *)&ani); - v33 = this->_items[getItemIndexByStaticAni(ani)].count; - v20 = this->_items[getItemIndexByStaticAni(ani)].movitems; - LABEL_34: v32 = this->_callback1(ani, v20, v33); - return method50(ani, v32, a2); + return method50(ani, v32, mq); #endif warning("STUB: MovGraph::method34()"); -- cgit v1.2.3 From e016e65767598d5aeb172f3cce8bcb106df25ddc Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 19 May 2014 20:53:40 +0200 Subject: MADS: Reduce the scope of a variable in Action, rename some British variable names --- engines/mads/action.cpp | 8 ++++---- engines/mads/action.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index 5d63c3a268..f26a999ff7 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -87,9 +87,9 @@ void MADSAction::clear() { _pickedWord = 0; } -void MADSAction::appendVocab(int vocabId, bool capitalise) { +void MADSAction::appendVocab(int vocabId, bool capitalize) { Common::String vocabStr = _vm->_game->_scene.getVocab(vocabId); - if (capitalise) + if (capitalize) vocabStr.setChar(toupper(vocabStr[0]), 0); _statusText += vocabStr; @@ -109,7 +109,6 @@ void MADSAction::startWalkingDirectly(int walkType) { void MADSAction::set() { Scene &scene = _vm->_game->_scene; UserInterface &userInterface = scene._userInterface; - bool flag = false; _statusText = ""; _action._verbId = VERB_NONE; @@ -128,6 +127,7 @@ void MADSAction::set() { // Two 'look' actions in succession, so the action becomes 'Look around' _statusText = kLookAroundStr; } else { + bool flag = false; if ((_commandSource == CAT_INV_VOCAB) && (_selectedRow >= 0) && (_verbType == VERB_THAT) && (_prepType == PREP_NONE)) { // Use/to action @@ -137,7 +137,7 @@ void MADSAction::set() { _action._objectNameId = objEntry._descId; _action._verbId = objEntry._vocabList[_selectedRow]._vocabId; - // Set up the status text stirng + // Set up the status text string _statusText = kUseStr; appendVocab(_action._objectNameId); _statusText += kToStr; diff --git a/engines/mads/action.h b/engines/mads/action.h index af52d2c7a2..3010226787 100644 --- a/engines/mads/action.h +++ b/engines/mads/action.h @@ -106,7 +106,7 @@ private: MADSEngine *_vm; Common::String _statusText; - void appendVocab(int vocabId, bool capitalise = false); + void appendVocab(int vocabId, bool capitalize = false); void startWalkingDirectly(int walkType); public: -- cgit v1.2.3 From 6d1fc8256f19e0b320b9b160b198f17af1cd14ff Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 19 May 2014 20:56:03 +0200 Subject: MADS: Some more British -> American English modifications --- engines/mads/dragonsphere/game_dragonsphere.cpp | 2 +- engines/mads/dragonsphere/game_dragonsphere.h | 2 +- engines/mads/game.cpp | 4 ++-- engines/mads/game.h | 2 +- engines/mads/nebular/dialogs_nebular.cpp | 2 +- engines/mads/nebular/game_nebular.cpp | 2 +- engines/mads/nebular/game_nebular.h | 2 +- engines/mads/nebular/sound_nebular.cpp | 2 +- engines/mads/phantom/game_phantom.cpp | 2 +- engines/mads/phantom/game_phantom.h | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/engines/mads/dragonsphere/game_dragonsphere.cpp b/engines/mads/dragonsphere/game_dragonsphere.cpp index 49c38460e2..bee5312660 100644 --- a/engines/mads/dragonsphere/game_dragonsphere.cpp +++ b/engines/mads/dragonsphere/game_dragonsphere.cpp @@ -58,7 +58,7 @@ ProtectionResult GameDragonsphere::checkCopyProtection() { return PROTECTION_SUCCEED; } -void GameDragonsphere::initialiseGlobals() { +void GameDragonsphere::initializeGlobals() { //int count, count2; //int bad; diff --git a/engines/mads/dragonsphere/game_dragonsphere.h b/engines/mads/dragonsphere/game_dragonsphere.h index 2bfcde1c63..cd7ac577fc 100644 --- a/engines/mads/dragonsphere/game_dragonsphere.h +++ b/engines/mads/dragonsphere/game_dragonsphere.h @@ -53,7 +53,7 @@ protected: virtual ProtectionResult checkCopyProtection(); - virtual void initialiseGlobals(); + virtual void initializeGlobals(); virtual void setSectionHandler(); diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 3c69f452b4..118dc829c3 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -95,7 +95,7 @@ Game::~Game() { } void Game::run() { - initialiseGlobals(); + initializeGlobals(); // If requested, load a savegame instead of showing the intro if (ConfMan.hasKey("save_slot")) { @@ -144,7 +144,7 @@ void Game::run() { } if (protectionResult != 1 && protectionResult != 2) { - initialiseGlobals(); + initializeGlobals(); } if (_statusFlag) diff --git a/engines/mads/game.h b/engines/mads/game.h index d171638b66..a55de617fd 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -112,7 +112,7 @@ protected: /** * Initialises global variables for a new game */ - virtual void initialiseGlobals() = 0; + virtual void initializeGlobals() = 0; /** * Set up the section handler specific to each section diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp index df423f92a8..f22ec1ad90 100644 --- a/engines/mads/nebular/dialogs_nebular.cpp +++ b/engines/mads/nebular/dialogs_nebular.cpp @@ -425,7 +425,7 @@ void PictureDialog::save() { frame->getTransparencyIndex()); _vm->_screen.copyRectToScreen(_vm->_screen.getBounds()); - // Adjust the dialog colours to use + // Adjust the dialog colors to use TEXTDIALOG_CONTENT1 -= 10; TEXTDIALOG_CONTENT2 -= 10; TEXTDIALOG_EDGE -= 10; diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index 1ec025c8e1..8be6068006 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -59,7 +59,7 @@ ProtectionResult GameNebular::checkCopyProtection() { return PROTECTION_SUCCEED; } -void GameNebular::initialiseGlobals() { +void GameNebular::initializeGlobals() { int count, count2; int bad; diff --git a/engines/mads/nebular/game_nebular.h b/engines/mads/nebular/game_nebular.h index 82ddfb5972..da252219f4 100644 --- a/engines/mads/nebular/game_nebular.h +++ b/engines/mads/nebular/game_nebular.h @@ -103,7 +103,7 @@ protected: virtual ProtectionResult checkCopyProtection(); - virtual void initialiseGlobals(); + virtual void initializeGlobals(); virtual void setSectionHandler(); diff --git a/engines/mads/nebular/sound_nebular.cpp b/engines/mads/nebular/sound_nebular.cpp index 666b686267..b20b0d2b96 100644 --- a/engines/mads/nebular/sound_nebular.cpp +++ b/engines/mads/nebular/sound_nebular.cpp @@ -154,7 +154,7 @@ ASound::ASound(Audio::Mixer *mixer, const Common::String &filename, int dataOffs if (!_soundFile.open(filename)) error("Could not open file - %s", filename.c_str()); - // Initialise fields + // Initialize fields _commandParam = 0; _activeChannelPtr = nullptr; _samplePtr = nullptr; diff --git a/engines/mads/phantom/game_phantom.cpp b/engines/mads/phantom/game_phantom.cpp index 5232322c73..bcaec8e648 100644 --- a/engines/mads/phantom/game_phantom.cpp +++ b/engines/mads/phantom/game_phantom.cpp @@ -58,7 +58,7 @@ ProtectionResult GamePhantom::checkCopyProtection() { return PROTECTION_SUCCEED; } -void GamePhantom::initialiseGlobals() { +void GamePhantom::initializeGlobals() { //int count, count2; //int bad; diff --git a/engines/mads/phantom/game_phantom.h b/engines/mads/phantom/game_phantom.h index 96299fb814..3043e538a5 100644 --- a/engines/mads/phantom/game_phantom.h +++ b/engines/mads/phantom/game_phantom.h @@ -52,7 +52,7 @@ protected: virtual ProtectionResult checkCopyProtection(); - virtual void initialiseGlobals(); + virtual void initializeGlobals(); virtual void setSectionHandler(); -- cgit v1.2.3 From 20c26931269871f599897d01cb93502bd58b1412 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 19 May 2014 21:40:12 +0200 Subject: MADS: Fix scrolling check --- engines/mads/animation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index 089e21d08e..3e10fe9667 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -399,7 +399,7 @@ void Animation::loadInterface(UserInterface &interfaceSurface, MSurface &depthSu } bool Animation::hasScroll() const { - return (_header._scrollPosition.x != 0) || (_header._scrollPosition.x != 0); + return (_header._scrollPosition.x != 0) || (_header._scrollPosition.y != 0); } void Animation::update() { -- cgit v1.2.3 From 9544db6510a9290559e0e1ece86aad7f97989341 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 19 May 2014 21:43:18 +0200 Subject: MADS: Reduce the scope of a variable in ASound --- engines/mads/nebular/sound_nebular.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/nebular/sound_nebular.cpp b/engines/mads/nebular/sound_nebular.cpp index b20b0d2b96..6bc697459a 100644 --- a/engines/mads/nebular/sound_nebular.cpp +++ b/engines/mads/nebular/sound_nebular.cpp @@ -404,12 +404,12 @@ void ASound::checkChannels() { void ASound::pollActiveChannel() { AdlibChannel *chan = _activeChannelPtr; - bool updateFlag = true; if (chan->_activeCount) { if (chan->_field8 > 0 && --chan->_field8 == 0) updateOctave(); + bool updateFlag = true; if (--_activeChannelPtr->_activeCount <= 0) { for (;;) { byte *pSrc = chan->_pSrc; -- cgit v1.2.3 From 83f82104d0a49ba9eff521426b58831ac3b21a86 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 19 May 2014 21:46:15 +0200 Subject: MADS: Reduce the scope of another variable in Animation --- engines/mads/animation.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index 3e10fe9667..f006d1fe61 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -464,9 +464,8 @@ void Animation::update() { paChanged = true; } - int newIndex = -1; if (paChanged) { - newIndex = scene._spriteSlots.add(); + int newIndex = scene._spriteSlots.add(); scene._spriteSlots[newIndex]._seqIndex = -1; scene._spriteSlots[newIndex]._flags = IMG_REFRESH; } -- cgit v1.2.3 From b384447e71af3b10a152f7a3d863e65db525476c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 19 May 2014 21:54:25 +0200 Subject: MADS: Reduce the scope of some variables in Palette --- engines/mads/palette.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index a4608a6c1a..23e889566e 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -587,7 +587,6 @@ uint8 Palette::palIndexFromRgb(byte r, byte g, byte b, byte *paletteData) { byte index = 0; int32 minDist = 0x7fffffff; byte palData[PALETTE_SIZE]; - int Rdiff, Gdiff, Bdiff; if (paletteData == NULL) { g_system->getPaletteManager()->grabPalette(palData, 0, PALETTE_COUNT); @@ -595,9 +594,9 @@ uint8 Palette::palIndexFromRgb(byte r, byte g, byte b, byte *paletteData) { } for (int palIndex = 0; palIndex < PALETTE_COUNT; ++palIndex) { - Rdiff = r - paletteData[palIndex * 3]; - Gdiff = g - paletteData[palIndex * 3 + 1]; - Bdiff = b - paletteData[palIndex * 3 + 2]; + int Rdiff = r - paletteData[palIndex * 3]; + int Gdiff = g - paletteData[palIndex * 3 + 1]; + int Bdiff = b - paletteData[palIndex * 3 + 2]; if (Rdiff * Rdiff + Gdiff * Gdiff + Bdiff * Bdiff < minDist) { minDist = Rdiff * Rdiff + Gdiff * Gdiff + Bdiff * Bdiff; @@ -609,7 +608,6 @@ uint8 Palette::palIndexFromRgb(byte r, byte g, byte b, byte *paletteData) { } void Palette::setGradient(byte *palette, int start, int count, int rgbValue1, int rgbValue2) { - int rgbCtr = 0; int rgbCurrent = rgbValue2; int rgbDiff = -(rgbValue2 - rgbValue1); @@ -618,6 +616,7 @@ void Palette::setGradient(byte *palette, int start, int count, int rgbValue1, in int endVal = count - 1; int numLeft = count; + int rgbCtr = 0; do { pDest[0] = pDest[1] = pDest[2] = rgbCurrent; -- cgit v1.2.3 From 081a7ee30cfdf8a29f0cd896eef18b838dd154f8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 19 May 2014 22:21:27 +0200 Subject: MADS: Refactor a bit the calls of generateRandom() --- engines/mads/nebular/nebular_scenes2.cpp | 16 ++++------------ engines/mads/nebular/nebular_scenes3.cpp | 7 ++----- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 0f8af57651..0685cf64f6 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -1198,16 +1198,12 @@ void Scene205::enter() { } void Scene205::step() { - int chanceMajor, chanceMinor; - if (_globals[kSexOfRex] == SEX_FEMALE) { _scene->_kernelMessages.randomServer(); if (_vm->_game->_scene._frameStartTime >= _chickenTime) { - chanceMajor = 100; - chanceMinor = _scene->_kernelMessages.checkRandom() + 1; - - if (_scene->_kernelMessages.generateRandom(chanceMajor, chanceMinor)) + int chanceMinor = _scene->_kernelMessages.checkRandom() + 1; + if (_scene->_kernelMessages.generateRandom(100, chanceMinor)) _vm->_sound->command(28); _chickenTime = _vm->_game->_scene._frameStartTime + 2; @@ -4573,16 +4569,12 @@ void Scene211::enter() { } void Scene211::step() { - int chanceMajor, chanceMinor; - if (_globals[kMonkeyStatus] == MONKEY_AMBUSH_READY) { _scene->_kernelMessages.randomServer(); if (!_ambushFl && !_wakeFl && (_vm->_game->_scene._frameStartTime >= _monkeyTime)) { - chanceMajor = 80; - chanceMinor = _scene->_kernelMessages.checkRandom() * 4 + 1; - - if (_scene->_kernelMessages.generateRandom(chanceMajor, chanceMinor)) + int chanceMinor = _scene->_kernelMessages.checkRandom() * 4 + 1; + if (_scene->_kernelMessages.generateRandom(80, chanceMinor)) _vm->_sound->command(18); _monkeyTime = _vm->_game->_scene._frameStartTime + 2; diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 4358aa45b8..f7283c8859 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -5550,13 +5550,10 @@ void Scene389::enter() { } void Scene389::step() { - int chanceMajor, chanceMinor; - _scene->_kernelMessages.randomServer(); if (_scene->_frameStartTime >= _monsterTime) { - chanceMajor = 20; - chanceMinor = _scene->_kernelMessages.checkRandom() * 4 + 1; - _scene->_kernelMessages.generateRandom(chanceMajor, chanceMinor); + int chanceMinor = _scene->_kernelMessages.checkRandom() * 4 + 1; + _scene->_kernelMessages.generateRandom(20, chanceMinor); _monsterTime = _scene->_frameStartTime + 2; } } -- cgit v1.2.3 From 9613db3edf71787eb211076081281a9bc5c2f6ba Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 19 May 2014 22:21:58 +0200 Subject: MADS: Reduce the scope of a variable in Resource --- engines/mads/resources.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/resources.cpp b/engines/mads/resources.cpp index 4f5596dea6..83077b602f 100644 --- a/engines/mads/resources.cpp +++ b/engines/mads/resources.cpp @@ -410,13 +410,13 @@ void SynchronizedList::synchronize(Common::Serializer &s) { void synchronizeString(Common::Serializer &s, Common::String &str) { int len = str.size(); - char c; s.syncAsUint16LE(len); if (s.isSaving()) { s.syncBytes((byte *)str.c_str(), len); } else { str.clear(); + char c; for (int i = 0; i < len; ++i) { s.syncAsByte(c); str += c; -- cgit v1.2.3 From 373b67e5be7688f5dd904c81a4a9702bf131c032 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 19 May 2014 22:41:27 +0200 Subject: MADS: Some refactoring in scene 402 --- engines/mads/nebular/nebular_scenes4.cpp | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes4.cpp b/engines/mads/nebular/nebular_scenes4.cpp index e8e9596e9d..79352fbb00 100644 --- a/engines/mads/nebular/nebular_scenes4.cpp +++ b/engines/mads/nebular/nebular_scenes4.cpp @@ -1232,13 +1232,8 @@ void Scene402::step() { break; case 53: - if (_bigBeatFl) { - _scene->_sequences.remove(_globals._sequenceIndexes[5]); - _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 1); - } else { - _scene->_sequences.remove(_globals._sequenceIndexes[5]); - _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 1); - } + _scene->_sequences.remove(_globals._sequenceIndexes[5]); + _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 1); _waitingGinnyMove = false; break; @@ -1378,14 +1373,12 @@ void Scene402::step() { } } - if (!_blowingSmoke) { - if (_vm->getRandomNumber(1, 300) == 1) { - _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 8, 1, 0, 0); - _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 1, 14); - _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14); - _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 30); - _blowingSmoke = true; - } + if (!_blowingSmoke && (_vm->getRandomNumber(1, 300) == 1)) { + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 8, 1, 0, 0); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 1, 14); + _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 14); + _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 30); + _blowingSmoke = true; } switch (_game._trigger) { -- cgit v1.2.3 From 499f09a1c0ffccca52a8bc13401a6724af2b9b9b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 19 May 2014 22:46:09 +0200 Subject: MADS: Reduce variable scope in scene group 5, rename one variable --- engines/mads/nebular/nebular_scenes5.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes5.cpp b/engines/mads/nebular/nebular_scenes5.cpp index 168daea9a3..c884170946 100644 --- a/engines/mads/nebular/nebular_scenes5.cpp +++ b/engines/mads/nebular/nebular_scenes5.cpp @@ -886,10 +886,9 @@ void Scene505::enter() { } void Scene505::step() { - int resetFrame; if (_frame != _scene->_activeAnimation->getCurrentFrame()) { _frame = _scene->_activeAnimation->getCurrentFrame(); - resetFrame = -1; + int resetFrame = -1; switch (_frame) { case 4: @@ -1267,8 +1266,6 @@ void Scene506::room_506_door_sequences() { } void Scene506::actions() { - int temp; - if (_action.isAction(0x242, 0x37D)) { if (_firstDoorFl) { _heroFacing = FACING_NORTHWEST; @@ -1293,11 +1290,12 @@ void Scene506::actions() { _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 1); break; - case 1: - temp = _globals._sequenceIndexes[3]; + case 1: { + int syncIdx = _globals._sequenceIndexes[3]; _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -2); - _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], temp); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], syncIdx); _scene->_sequences.addTimer(6, 2); + } break; case 2: @@ -1307,12 +1305,13 @@ void Scene506::actions() { _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 3); break; - case 3: - temp = _globals._sequenceIndexes[4]; + case 3: { + int syncIdx = _globals._sequenceIndexes[4]; _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, -2); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); - _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], temp); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], syncIdx); _scene->_nextSceneId = 504; + } break; default: -- cgit v1.2.3 From 410ba93433e0a8c055bad7f7241db4868007a0bb Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 19 May 2014 22:50:30 +0200 Subject: MADS: Some refactoring in scene group 3 --- engines/mads/nebular/nebular_scenes3.cpp | 35 +++++++++++++++----------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index f7283c8859..40f2533f4b 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -2138,8 +2138,6 @@ void Scene316::handleRoxInGrate() { } void Scene316::enter() { - int series; - if (_globals[kSexOfRex] == REX_MALE) { _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('g', -1)); _globals._spriteIndexes[4] = _scene->_sprites.addSprites("*RXCL_8"); @@ -2165,8 +2163,8 @@ void Scene316::enter() { _game._player._stepEnabled = false; _game._player._visible = false; _vm->_sound->command(44); - series = (_globals[kSexOfRex] == REX_MALE) ? 1 : 2; - _globals._sequenceIndexes[1] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[series], false, 6, 1, 0, 0); + int spriteIdx = (_globals[kSexOfRex] == REX_MALE) ? 1 : 2; + _globals._sequenceIndexes[1] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[spriteIdx], false, 6, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 2); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 60); } else if (_scene->_priorSceneId != -2) @@ -2177,8 +2175,6 @@ void Scene316::enter() { } void Scene316::step() { - int temp; - if (_game._trigger == 60) { _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[1]); _game._player._visible = true; @@ -2200,20 +2196,22 @@ void Scene316::step() { _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_EXPIRE, 0, 72); break; - case 71: - temp = _globals._sequenceIndexes[3]; + case 71: { + int synxIdx = _globals._sequenceIndexes[3]; _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -2); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 3); - _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], temp); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], synxIdx); + } break; - case 72: - temp = _globals._sequenceIndexes[6]; + case 72: { + int synxIdx = _globals._sequenceIndexes[6]; _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 12, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[6], 6, 9); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[6]); - _scene->_sequences.updateTimeout(_globals._sequenceIndexes[6], temp); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[6], synxIdx); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_EXPIRE, 0, 73); + } break; case 73: @@ -2230,11 +2228,12 @@ void Scene316::step() { _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_EXPIRE, 0, 75); break; - case 74: - temp = _globals._sequenceIndexes[3]; + case 74: { + int synxIdx = _globals._sequenceIndexes[3]; _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 12); - _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], temp); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[3], synxIdx); + } break; case 75: @@ -2360,17 +2359,15 @@ void Scene318::setup() { } void Scene318::handleDialog() { - int temp; - if (!_game._trigger) { _game._player._stepEnabled = false; handleRexDialogs(_action._activeAction._verbId); } else if (_game._trigger == 2) { - temp = _globals._sequenceIndexes[2]; + int synxIdx = _globals._sequenceIndexes[2]; _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(142, 121)); - _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], temp); + _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], synxIdx); _vm->_sound->command(3); _scene->_userInterface.setup(kInputLimitedSentences); _game._player._stepEnabled = true; -- cgit v1.2.3 From 2c5ef8021875c088d7fe409ba5a09bea9decdbba Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 19 May 2014 22:56:34 +0200 Subject: MADS: Fix bug in scene 207 --- engines/mads/nebular/nebular_scenes2.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 0685cf64f6..e853c0a06b 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -1542,8 +1542,8 @@ void Scene207::actions() { } else { if ((_game._player._playerPos.x > 150) && (_game._player._playerPos.x < 189) && (_game._player._playerPos.y > 111) && (_game._player._playerPos.y < 130)) { - if ((_game._player._playerPos.x <= 162) && (_game._player._playerPos.x >= 181) && - (_game._player._playerPos.y <= 115) && (_game._player._playerPos.y >= 126)) { + if ((_game._player._playerPos.x <= 162) || (_game._player._playerPos.x >= 181) || + (_game._player._playerPos.y <= 115) || (_game._player._playerPos.y >= 126)) { _globals._sequenceIndexes[7] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 10, 2, 0, 0); _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8, 2, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 6); -- cgit v1.2.3 From 33fb64a1bdf6e470ca63e03a4199e28cb8b6172b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 19 May 2014 23:57:51 +0200 Subject: MADS: Remove some useless empty functions --- engines/mads/nebular/nebular_scenes5.h | 9 --------- engines/mads/nebular/nebular_scenes6.h | 22 ---------------------- engines/mads/nebular/nebular_scenes7.h | 8 -------- engines/mads/nebular/nebular_scenes8.h | 9 --------- 4 files changed, 48 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes5.h b/engines/mads/nebular/nebular_scenes5.h index 9d5e76acc9..bc22a62132 100644 --- a/engines/mads/nebular/nebular_scenes5.h +++ b/engines/mads/nebular/nebular_scenes5.h @@ -195,7 +195,6 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene512: public Scene5xx{ @@ -208,10 +207,7 @@ public: virtual void setup(); virtual void enter(); - virtual void step() {}; - virtual void preActions() {}; virtual void actions(); - virtual void postActions() {}; }; class Scene513: public Scene5xx{ @@ -221,9 +217,7 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; virtual void actions(); - virtual void postActions() {}; }; class Scene515: public Scene5xx{ @@ -233,9 +227,7 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; virtual void actions() {}; - virtual void postActions() {}; }; class Scene551: public Scene5xx{ @@ -247,7 +239,6 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes6.h b/engines/mads/nebular/nebular_scenes6.h index 294cf3560d..731b220cd1 100644 --- a/engines/mads/nebular/nebular_scenes6.h +++ b/engines/mads/nebular/nebular_scenes6.h @@ -57,9 +57,7 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; virtual void actions(); - virtual void postActions() {}; }; class Scene602: public Scene6xx{ @@ -76,10 +74,7 @@ public: virtual void setup(); virtual void enter(); - virtual void step() {}; - virtual void preActions() {}; virtual void actions(); - virtual void postActions() {}; }; class Scene603: public Scene6xx{ @@ -92,10 +87,7 @@ public: virtual void setup(); virtual void enter(); - virtual void step() {}; - virtual void preActions() {}; virtual void actions(); - virtual void postActions() {}; }; class Scene604: public Scene6xx{ @@ -117,9 +109,7 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; virtual void actions(); - virtual void postActions() {}; }; class Scene605: public Scene6xx{ @@ -129,9 +119,7 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; virtual void actions(); - virtual void postActions() {}; }; class Scene607: public Scene6xx{ @@ -158,7 +146,6 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene608: public Scene6xx{ @@ -206,7 +193,6 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene609: public Scene6xx{ @@ -223,7 +209,6 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene610: public Scene6xx{ @@ -242,9 +227,7 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; virtual void actions(); - virtual void postActions() {}; }; class Scene611: public Scene6xx{ @@ -297,7 +280,6 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene612: public Scene6xx{ @@ -313,9 +295,7 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; virtual void actions(); - virtual void postActions() {}; }; class Scene620: public Scene6xx{ @@ -325,9 +305,7 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; virtual void actions() {}; - virtual void postActions() {}; }; } // End of namespace Nebular } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes7.h b/engines/mads/nebular/nebular_scenes7.h index 6b128dbe6a..0223fe2447 100644 --- a/engines/mads/nebular/nebular_scenes7.h +++ b/engines/mads/nebular/nebular_scenes7.h @@ -101,9 +101,7 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; virtual void actions(); - virtual void postActions() {}; }; class Scene704: public Scene7xx{ @@ -127,9 +125,7 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; virtual void actions(); - virtual void postActions() {}; }; class Scene705: public Scene7xx{ @@ -146,9 +142,7 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; virtual void actions(); - virtual void postActions() {}; }; class Scene706: public Scene7xx{ @@ -171,7 +165,6 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene707: public SceneTeleporter { @@ -216,7 +209,6 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene752: public Scene7xx { diff --git a/engines/mads/nebular/nebular_scenes8.h b/engines/mads/nebular/nebular_scenes8.h index 5193c4f401..590f31ca71 100644 --- a/engines/mads/nebular/nebular_scenes8.h +++ b/engines/mads/nebular/nebular_scenes8.h @@ -64,7 +64,6 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene802: public Scene8xx{ @@ -76,7 +75,6 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene803: public Scene8xx{ @@ -88,7 +86,6 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene804: public Scene8xx { @@ -120,7 +117,6 @@ public: virtual void step(); virtual void preActions(); virtual void actions(); - virtual void postActions() {}; }; class Scene807: public SceneTeleporter { @@ -142,10 +138,7 @@ public: virtual void setup(); virtual void enter(); - virtual void step() {}; - virtual void preActions() {}; virtual void actions(); - virtual void postActions() {}; }; class Scene810: public Scene8xx{ @@ -158,9 +151,7 @@ public: virtual void setup(); virtual void enter(); virtual void step(); - virtual void preActions() {}; virtual void actions() {}; - virtual void postActions() {}; }; } // End of namespace Nebular -- cgit v1.2.3 From 42e8daf49d67e839c695b12518369faf58ce9ddd Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 20 May 2014 01:16:15 +0300 Subject: MADS: Replace hex values in dialogs with their decimal values The decimal values make much more sense than their hex counterparts in dialogs. Only scene groups 1 - 3 are affected, since the others have decimal values already --- engines/mads/nebular/nebular_scenes1.cpp | 304 ++++++++++----------- engines/mads/nebular/nebular_scenes2.cpp | 334 +++++++++++------------ engines/mads/nebular/nebular_scenes3.cpp | 452 +++++++++++++++---------------- 3 files changed, 545 insertions(+), 545 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index b2e07dc0e6..875c58ce42 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -127,7 +127,7 @@ void Scene101::sayDang() { break; case 73: - _vm->_dialogs->show(0x2785); + _vm->_dialogs->show(10117); _game._player._stepEnabled = true; break; } @@ -325,7 +325,7 @@ void Scene101::preActions() { void Scene101::actions() { if (_action._lookFlag) { - _vm->_dialogs->show(0x278D); + _vm->_dialogs->show(10125); _action._inProgress = false; return; } @@ -369,7 +369,7 @@ void Scene101::actions() { break; } } else { - _vm->_dialogs->show(0x2793); + _vm->_dialogs->show(10131); _action._inProgress = false; return; } @@ -414,18 +414,18 @@ void Scene101::actions() { if (_action.isAction(VERB_LOOK, 0x135) || (_action.isAction(VERB_LOOK, 0x137) && !_game._objects.isInInventory(OBJ_SHIELD_MODULATOR)) ) { if (_panelOpened) { if (_game._objects.isInRoom(OBJ_SHIELD_MODULATOR)) - _vm->_dialogs->show(0x2790); + _vm->_dialogs->show(10128); else - _vm->_dialogs->show(0x2791); + _vm->_dialogs->show(10129); } else { - _vm->_dialogs->show(0x278F); + _vm->_dialogs->show(10127); } _action._inProgress = false; return; } if (_action.isAction(VERB_OPEN, 0x135) && _panelOpened) { - _vm->_dialogs->show(0x2792); + _vm->_dialogs->show(10130); _action._inProgress = false; return; } @@ -470,133 +470,133 @@ void Scene101::actions() { } if (_action.isAction(VERB_LOOK, 0x47)) { - _vm->_dialogs->show(0x2775); + _vm->_dialogs->show(10101); _action._inProgress = false; return; } if ((_action.isAction(VERB_LOOK) || _action.isAction(0x103)) && (_action.isAction(0x8E) || _action.isAction(0xF9))) { - _vm->_dialogs->show(0x2776); + _vm->_dialogs->show(10102); _action._inProgress = false; return; } if (_action.isAction(VERB_LOOK, 0xA8) || _action.isAction(VERB_LOOK, 0xF8) || _action.isAction(0x7D, 0xA8) || _action.isAction(0x7D, 0xF8)) { - _vm->_dialogs->show(0x2777); + _vm->_dialogs->show(10103); _action._inProgress = false; return; } if (_action.isAction(VERB_LOOK, 0x91)) { - _vm->_dialogs->show(0x2778); + _vm->_dialogs->show(10104); _action._inProgress = false; return; } if (_action.isAction(VERB_LOOK, 0xE1) || _action.isAction(0xD2, 0xE1)) { - _vm->_dialogs->show(0x2779); + _vm->_dialogs->show(10105); _action._inProgress = false; return; } if (_action.isAction(VERB_LOOK, 0x60)) { - _vm->_dialogs->show(0x277A); + _vm->_dialogs->show(10106); _action._inProgress = false; return; } if (_action.isAction(VERB_LOOK, 0x111)) { - _vm->_dialogs->show(0x277B); + _vm->_dialogs->show(10107); _action._inProgress = false; return; } if (_action.isAction(VERB_LOOK, 0x7B) || (_action.isAction(VERB_OPEN, 0x7B) && !_game._objects.isInInventory(OBJ_REBREATHER))) { - _vm->_dialogs->show(0x277D); + _vm->_dialogs->show(10109); _action._inProgress = false; return; } if (_action.isAction(VERB_OPEN, 0x7B)) { - _vm->_dialogs->show(0x277E); + _vm->_dialogs->show(10110); _action._inProgress = false; return; } if (_action.isAction(VERB_LOOK, 0x166)) { - _vm->_dialogs->show(0x277F); + _vm->_dialogs->show(10111); _action._inProgress = false; return; } if (_action.isAction(VERB_LOOK, 0xCA)) { - _vm->_dialogs->show(0x278E); + _vm->_dialogs->show(10126); _action._inProgress = false; return; } if (_action.isAction(VERB_LOOK, 0x63)) { - _vm->_dialogs->show(0x2780); + _vm->_dialogs->show(10112); _action._inProgress = false; return; } if (_action.isAction(VERB_LOOK, 0xEB)) { - _vm->_dialogs->show(0x2781); + _vm->_dialogs->show(10113); _action._inProgress = false; return; } if (_action.isAction(VERB_LOOK, 0x78)) { - _vm->_dialogs->show(0x2782); + _vm->_dialogs->show(10114); _action._inProgress = false; return; } if (_action.isAction(VERB_LOOK, 0x190)) { - _vm->_dialogs->show(0x2783); + _vm->_dialogs->show(10115); _action._inProgress = false; return; } if (_action.isAction(VERB_LOOK, 0x138)) { - _vm->_dialogs->show(0x2784); + _vm->_dialogs->show(10116); _action._inProgress = false; return; } if (_action.isAction(VERB_TAKE, 0x111)) { - _vm->_dialogs->show(0x2786); + _vm->_dialogs->show(10118); _action._inProgress = false; return; } if (_action.isAction(VERB_TAKE, 0x91)) { - _vm->_dialogs->show(0x2787); + _vm->_dialogs->show(10119); _action._inProgress = false; return; } if (_action.isAction(VERB_OPEN, 0x63)) { - _vm->_dialogs->show(0x2789); + _vm->_dialogs->show(10121); _action._inProgress = false; return; } if (_action.isAction(VERB_OPEN, 0x60)) { - _vm->_dialogs->show(0x278A); + _vm->_dialogs->show(10122); _action._inProgress = false; return; } if (_action.isAction(VERB_CLOSE, 0x60)) { - _vm->_dialogs->show(0x278B); + _vm->_dialogs->show(10123); _action._inProgress = false; return; } if ((_action.isAction(VERB_LOOK) || _action.isAction(0x112)) && _action.isAction(0x17E)) { - _vm->_dialogs->show(0x278C); + _vm->_dialogs->show(10124); _action._inProgress = false; return; } @@ -742,7 +742,7 @@ void Scene102::step() { _fridgeCommentCount++; if (_fridgeCommentCount > 16384) { _fridgeOpenedDescr = true; - _vm->_dialogs->show(0x27E5); + _vm->_dialogs->show(10213); } } @@ -793,7 +793,7 @@ void Scene102::actions() { bool justOpenedFl = false; if (_action._lookFlag) { - _vm->_dialogs->show(0x27FA); + _vm->_dialogs->show(10234); _action._inProgress = false; return; } @@ -840,9 +840,9 @@ void Scene102::actions() { if (_action.isAction(VERB_LOOK, 0x122) || _action.isAction(VERB_OPEN, 0x122)) { if (_game._objects.isInRoom(OBJ_BURGER)) - _vm->_dialogs->show(0x27F6); + _vm->_dialogs->show(10230); else - _vm->_dialogs->show(0x27F5); + _vm->_dialogs->show(10229); _fridgeFirstOpenFl = false; _action._inProgress = false; @@ -864,13 +864,13 @@ void Scene102::actions() { } if (_action.isAction(VERB_CLOSE, 0x122)) { - _vm->_dialogs->show(0x27E5); + _vm->_dialogs->show(10213); _action._inProgress = false; return; } if (_action.isAction(VERB_TAKE, 0x122)) { - _vm->_dialogs->show(0x8); + _vm->_dialogs->show(8); _action._inProgress = false; return; } @@ -905,67 +905,67 @@ void Scene102::actions() { } if (_action.isAction(VERB_LOOK, 0x194)) { - _vm->_dialogs->show(0x27E4); + _vm->_dialogs->show(10212); _action._inProgress = false; return; } if (_action.isAction(VERB_LOOK, 0x79)) { - _vm->_dialogs->show(0x27DD); + _vm->_dialogs->show(10205); _action._inProgress = false; return; } if (_action.isAction(VERB_LOOK, 0x6E)) { - _vm->_dialogs->show(0x27DC); + _vm->_dialogs->show(10204); _action._inProgress = false; return; } if (_action.isAction(0x155, 0x46) || _action.isAction(VERB_LOOK, 0x46)) { - _vm->_dialogs->show(0x27DB); + _vm->_dialogs->show(10203); _action._inProgress = false; return; } if (_action.isAction(0x155, 0xFD) || _action.isAction(VERB_LOOK, 0xFD)) { - _vm->_dialogs->show(0x27DA); + _vm->_dialogs->show(10202); _action._inProgress = false; return; } if (_action.isAction(VERB_LOOK, 0x127)) { - _vm->_dialogs->show(0x27E7); + _vm->_dialogs->show(10215); _action._inProgress = false; return; } if (_action.isAction(VERB_PUT, 0x35, 0x127) && _game._objects.isInInventory(OBJ_BURGER)) { - _vm->_dialogs->show(0x27E8); + _vm->_dialogs->show(10216); _action._inProgress = false; return; } if (_action.isAction(VERB_PUT, 0x122) && _game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId))) { - _vm->_dialogs->show(0x27E9); + _vm->_dialogs->show(10217); _action._inProgress = false; return; } if (_action.isAction(VERB_PUT, 0x127) && (_action.isAction(0x65) || _action.isAction(0x157))) { - _vm->_dialogs->show(0x27F6); + _vm->_dialogs->show(10230); _action._inProgress = false; return; } if (_action.isAction(VERB_OPEN, 0x127)) { - _vm->_dialogs->show(0x27EA); + _vm->_dialogs->show(10218); _action._inProgress = false; return; } if (_action.isAction(VERB_LOOK, 0x52)) { - _vm->_dialogs->show(0x27EB); + _vm->_dialogs->show(10219); _action._inProgress = false; return; } @@ -973,12 +973,12 @@ void Scene102::actions() { if ((_action.isObject(0xC7) || _action.isObject(0xA3)) && (_action.isAction(VERB_LOOK) || _action.isAction(0x50) || _action.isAction(0x4F))) { if (_game._objects.isInInventory(OBJ_REBREATHER)) { if (!_action.isAction(0x50) && !_action.isAction(0x4F)) { - _vm->_dialogs->show(0x27F7); + _vm->_dialogs->show(10231); _action._inProgress = false; return; } } else if (_action.isAction(VERB_LOOK) || (_game._difficulty != DIFFICULTY_EASY)) { - _vm->_dialogs->show(0x27EE); + _vm->_dialogs->show(10222); _action._inProgress = false; return; } @@ -1011,7 +1011,7 @@ void Scene102::actions() { case 6: if (_game._objects.isInInventory(OBJ_REBREATHER) && !_game._visitedScenes.exists(106)) - _vm->_dialogs->show(0x27FD); + _vm->_dialogs->show(10237); _scene->_nextSceneId = 106; break; } @@ -1020,60 +1020,60 @@ void Scene102::actions() { } if (_action.isAction(VERB_LOOK, 0x118)) { - _vm->_dialogs->show(0x27F2); + _vm->_dialogs->show(10226); _action._inProgress = false; return; } if (_action.isAction(VERB_LOOK, 0x197) || _action.isAction(0xD3, 0x197)) { - _vm->_dialogs->show(0x27F3); + _vm->_dialogs->show(10227); _action._inProgress = false; return; } if (_action.isAction(VERB_LOOK, 0x70) || _action.isAction(VERB_WALKTO, 0x70)) { - _vm->_dialogs->show(0x27F4); + _vm->_dialogs->show(10228); _action._inProgress = false; return; } if (_action.isAction(VERB_LOOK, 0x71) || ((_action.isAction(VERB_CLOSE, 0x71) || _action.isAction(VERB_PUSH, 0x71)) && !_drawerDescrFl)) { - _vm->_dialogs->show(0x27EC); + _vm->_dialogs->show(10220); _drawerDescrFl = true; _action._inProgress = false; return; } if (_action.isAction(VERB_CLOSE, 0x71) || _action.isAction(VERB_PUSH, 0x71)) { - _vm->_dialogs->show(0x27ED); + _vm->_dialogs->show(10221); _action._inProgress = false; return; } if (_action.isAction(VERB_OPEN, 0x71)) { - _vm->_dialogs->show(0x27FC); + _vm->_dialogs->show(10236); _action._inProgress = false; return; } if (_action.isAction(VERB_LOOK, 0x47) || (_action.isAction(0x13F, 0x47) && !_chairDescrFl)) { _chairDescrFl = true; - _vm->_dialogs->show(0x27E2); + _vm->_dialogs->show(10210); _action._inProgress = false; return; } if (_action.isAction(0x13F, 0x47)) { - _vm->_dialogs->show(0x27E3); + _vm->_dialogs->show(10211); _action._inProgress = false; return; } if (_action.isAction(VERB_LOOK, 0xDE)) { if (_globals[kMedicineCabinetOpen]) - _vm->_dialogs->show(0x27DF); + _vm->_dialogs->show(10207); else - _vm->_dialogs->show(0x27DE); + _vm->_dialogs->show(10206); _action._inProgress = false; return; @@ -1096,7 +1096,7 @@ void Scene102::actions() { case 2: _game._player._stepEnabled = true; _globals[kMedicineCabinetOpen] = false; - _vm->_dialogs->show(0x27E1); + _vm->_dialogs->show(10209); break; } _action._inProgress = false; @@ -1122,9 +1122,9 @@ void Scene102::actions() { _game._player._stepEnabled = true; _globals[kMedicineCabinetOpen] = true; if (_globals[kMedicineCabinetVirgin]) { - _vm->_dialogs->show(0x27E0); + _vm->_dialogs->show(10208); } else { - _vm->_dialogs->show(0x27DF); + _vm->_dialogs->show(10207); } _globals[kMedicineCabinetVirgin] = false; break; @@ -1172,38 +1172,38 @@ void Scene102::actions() { } if (_action.isAction(VERB_TAKE, 0x117)) { - _vm->_dialogs->show(0x27F0); + _vm->_dialogs->show(10224); _action._inProgress = false; return; } if ((_action.isAction(VERB_PUSH) || _action.isAction(VERB_PULL)) && _action.isAction(0x194)) { - _vm->_dialogs->show(0x27F1); + _vm->_dialogs->show(10225); _action._inProgress = false; return; } if (_action.isAction(VERB_LOOK, 0x89)) { - _vm->_dialogs->show(0x27F8); + _vm->_dialogs->show(10232); _action._inProgress = false; return; } if (_action.isAction(VERB_LOOK, 0x27) && !_game._objects.isInInventory(OBJ_BINOCULARS)) { - _vm->_dialogs->show(0x27F9); + _vm->_dialogs->show(10233); _action._inProgress = false; return; } if (_action.isAction(VERB_LOOK, 0x35) && (_action._mainObjectSource == 4)) { - _vm->_dialogs->show(0x321); + _vm->_dialogs->show(801); _action._inProgress = false; } } void Scene102::postActions() { if (_action.isAction(VERB_PUT, 0x127) && _game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId))) { - _vm->_dialogs->show(0x27E9); + _vm->_dialogs->show(10217); _action._inProgress = false; } } @@ -1528,7 +1528,7 @@ void Scene103::actions() { void Scene103::postActions() { if (_action.isAction(27) && !_action.isAction(VERB_WALKTO)) { - _vm->_dialogs->show(0x2841); + _vm->_dialogs->show(10305); _action._inProgress = false; } else { if (_action.isAction(VERB_PUT, 85, 144)) { @@ -1616,7 +1616,7 @@ void Scene104::step() { break; case 2: - _vm->_dialogs->show(0x28A6); + _vm->_dialogs->show(10406); _scene->_reloadSceneFlag = true; break; } @@ -1655,7 +1655,7 @@ void Scene104::step() { break; case 3: - _vm->_dialogs->show(0x28A6); + _vm->_dialogs->show(10406); _scene->_reloadSceneFlag = true; break; } @@ -1687,7 +1687,7 @@ void Scene104::step() { break; case 2: - _vm->_dialogs->show(0x28A6); + _vm->_dialogs->show(10406); _scene->_reloadSceneFlag = true; break; } @@ -1725,15 +1725,15 @@ void Scene104::preActions() { void Scene104::actions() { if (_action._lookFlag) - _vm->_dialogs->show(0x28A5); + _vm->_dialogs->show(10405); else if (_action.isAction(VERB_LOOK, 0x5E)) - _vm->_dialogs->show(0x28A4); + _vm->_dialogs->show(10404); else if (_action.isAction(VERB_LOOK, 0x158)) - _vm->_dialogs->show(0x28A3); + _vm->_dialogs->show(10403); else if (_action.isAction(VERB_LOOK, 0x4D)) - _vm->_dialogs->show(0x28A1); + _vm->_dialogs->show(10401); else if (_action.isAction(VERB_LOOK, 0xF0)) - _vm->_dialogs->show(0x28A2); + _vm->_dialogs->show(10402); else return; @@ -1825,7 +1825,7 @@ void Scene105::step() { break; case 3: - _vm->_dialogs->show(0x290B); + _vm->_dialogs->show(10507); _scene->_reloadSceneFlag = true; _scene->_sequences.addTimer(90, 4); break; @@ -1855,7 +1855,7 @@ void Scene105::preActions() { void Scene105::actions() { if (_action._lookFlag) - _vm->_dialogs->show(0x2910); + _vm->_dialogs->show(10512); else if (_action.isAction(VERB_TAKE, 0x65) && _globals[kFishIn105]) { if (_game._objects.isInInventory(OBJ_DEAD_FISH)) { int randVal = _vm->getRandomNumber(74, 76); @@ -1868,25 +1868,25 @@ void Scene105::actions() { _vm->_dialogs->showItem(OBJ_DEAD_FISH, 802, 0); } } else if (_action.isAction(VERB_LOOK, 0x195)) - _vm->_dialogs->show(0x2905); + _vm->_dialogs->show(10501); else if (_action.isAction(VERB_LOOK, 0x4D)) - _vm->_dialogs->show(0x2906); + _vm->_dialogs->show(10502); else if (_action.isAction(VERB_LOOK, 0xF0)) - _vm->_dialogs->show(0x2907); + _vm->_dialogs->show(10503); else if (_action.isAction(VERB_LOOK, 0xDD)) - _vm->_dialogs->show(0x2908); + _vm->_dialogs->show(10504); else if (_action.isAction(VERB_TAKE, 0xDD)) - _vm->_dialogs->show(0x2909); + _vm->_dialogs->show(10505); else if (_action.isAction(VERB_LOOK, 0xE0)) - _vm->_dialogs->show(0x290A); + _vm->_dialogs->show(10506); else if (_action.isAction(VERB_LOOK, 0x65)) - _vm->_dialogs->show(0x290C); + _vm->_dialogs->show(10508); else if (_action.isAction(VERB_LOOK, 0x158)) - _vm->_dialogs->show(0x290D); + _vm->_dialogs->show(10509); else if (_action.isAction(VERB_LOOK, 0xF5)) - _vm->_dialogs->show(0x290E); + _vm->_dialogs->show(10510); else if (_action.isAction(VERB_LOOK, 0x129)) - _vm->_dialogs->show(0x290F); + _vm->_dialogs->show(10511); else return; @@ -2064,7 +2064,7 @@ void Scene106::preActions() { void Scene106::actions() { if (_action._lookFlag) - _vm->_dialogs->show(0x2976); + _vm->_dialogs->show(10614); else if (_action.isAction(0x15C, 0xD9)) { _game._player._stepEnabled = false; _game._player._prepareWalkPos = Common::Point(95, 72); @@ -2074,31 +2074,31 @@ void Scene106::actions() { _game._player._frameNumber = 9; _backToShipFl = true; } else if (_action.isAction(VERB_LOOK, 0x13) || _action.isAction(0xD1, 0x13)) - _vm->_dialogs->show(0x2969); + _vm->_dialogs->show(10601); else if (_action.isAction(VERB_TAKE, 0x13)) - _vm->_dialogs->show(0x296A); + _vm->_dialogs->show(10602); else if (_action.isAction(VERB_LOOK, 0x12F) || _action.isAction(VERB_LOOK, 0x130)) - _vm->_dialogs->show(0x296B); + _vm->_dialogs->show(10603); else if (_action.isAction(VERB_TAKE, 0x12F) || _action.isAction(VERB_TAKE, 0x130)) - _vm->_dialogs->show(0x296C); + _vm->_dialogs->show(10604); else if (_action.isAction(VERB_LOOK, 0xF3)) - _vm->_dialogs->show(0x296D); + _vm->_dialogs->show(10605); else if (_action.isAction(VERB_LOOK, 0x109) || _action.isAction(0xD1, 0x109)) - _vm->_dialogs->show(0x296E); + _vm->_dialogs->show(10606); else if (_action.isAction(0x109) && (_action.isAction(VERB_PUSH) || _action.isAction(VERB_PULL) || _action.isAction(VERB_TAKE))) - _vm->_dialogs->show(0x296F); + _vm->_dialogs->show(10607); else if (_action.isAction(VERB_LOOK, 0x139) || _action.isAction(0xD1, 0x139)) - _vm->_dialogs->show(0x2970); + _vm->_dialogs->show(10608); else if (_action.isAction(VERB_LOOK, 0xD9)) - _vm->_dialogs->show(0x2971); + _vm->_dialogs->show(10609); else if (_action.isAction(VERB_OPEN, 0xD9)) - _vm->_dialogs->show(0x2972); + _vm->_dialogs->show(10610); else if (_action.isAction(VERB_CLOSE, 0xD9)) - _vm->_dialogs->show(0x2973); + _vm->_dialogs->show(10611); else if (_action.isAction(VERB_LOOK, 0x12E)) - _vm->_dialogs->show(0x2974); + _vm->_dialogs->show(10612); else if (_action.isAction(VERB_LOOK, 0xF0)) - _vm->_dialogs->show(0x2975); + _vm->_dialogs->show(10613); else return; @@ -2187,7 +2187,7 @@ void Scene107::preActions() { void Scene107::actions() { if (_action._lookFlag) - _vm->_dialogs->show(0x29D4); + _vm->_dialogs->show(10708); else if (_action.isAction(VERB_TAKE, 0x65) && _globals[kFishIn107]) { if (_game._objects.isInInventory(OBJ_DEAD_FISH)) { int randVal = _vm->getRandomNumber(74, 76); @@ -2202,23 +2202,23 @@ void Scene107::actions() { } else if (_action.isAction(0x15D, 0xEE)) _scene->_nextSceneId = 105; else if (_action.isAction(VERB_LOOK, 0xEE)) - _vm->_dialogs->show(0x29CD); + _vm->_dialogs->show(10701); else if (_action.isAction(VERB_LOOK, 0x65) && (_action._mainObjectSource == 4)) - _vm->_dialogs->show(0x29CE); + _vm->_dialogs->show(10702); else if (_action.isAction(VERB_LOOK, 0x38)) - _vm->_dialogs->show(0x29CF); + _vm->_dialogs->show(10703); else if (_action.isAction(VERB_LOOK, 0x128)) - _vm->_dialogs->show(0x29D0); + _vm->_dialogs->show(10704); else if (_action.isAction(VERB_LOOK, 0x12F)) - _vm->_dialogs->show(0x29D1); + _vm->_dialogs->show(10705); else if (_action.isAction(VERB_LOOK, 0xF5)) - _vm->_dialogs->show(0x29D2); + _vm->_dialogs->show(10706); else if (_action.isAction(VERB_LOOK, 0x4D)) - _vm->_dialogs->show(0x29D3); + _vm->_dialogs->show(10707); else if (_action.isAction(VERB_LOOK, 0xDA)) - _vm->_dialogs->show(0x29D5); + _vm->_dialogs->show(10709); else if (_action.isAction(VERB_TAKE, 0xDA)) - _vm->_dialogs->show(0x29D6); + _vm->_dialogs->show(10710); else return; @@ -2279,7 +2279,7 @@ void Scene108::preActions() { void Scene108::actions() { if (_action._lookFlag) - _vm->_dialogs->show(0x2A3C); + _vm->_dialogs->show(10812); else if (_action.isAction(VERB_TAKE, 0x65) && _globals[kFishIn108]) { if (_game._objects.isInInventory(OBJ_DEAD_FISH)) { int randVal = _vm->getRandomNumber(74, 76); @@ -2294,25 +2294,25 @@ void Scene108::actions() { } else if (_action.isAction(0x15D, 0xF4)) _scene->_nextSceneId = 107; else if (_action.isAction(VERB_LOOK, 0x4D)) - _vm->_dialogs->show(0x2A31); + _vm->_dialogs->show(10801); else if (_action.isAction(VERB_LOOK, 0xF0)) - _vm->_dialogs->show(0x2A32); + _vm->_dialogs->show(10802); else if (_action.isAction(VERB_LOOK, 0xF1)) - _vm->_dialogs->show(0x2A33); + _vm->_dialogs->show(10803); else if (_action.isAction(VERB_TAKE, 0xF1)) - _vm->_dialogs->show(0x2A34); + _vm->_dialogs->show(10804); else if (_action.isAction(VERB_LOOK, 0x129)) - _vm->_dialogs->show(0x2A35); + _vm->_dialogs->show(10805); else if (_action.isAction(VERB_TAKE, 0x129)) - _vm->_dialogs->show(0x2A36); + _vm->_dialogs->show(10806); else if (_action.isAction(VERB_LOOK, 0x65)) - _vm->_dialogs->show(0x2A37); + _vm->_dialogs->show(10807); else if (_action.isAction(VERB_LOOK, 0xFB)) - _vm->_dialogs->show(0x2A39); + _vm->_dialogs->show(10809); else if (_action.isAction(VERB_LOOK, 0xF4)) - _vm->_dialogs->show(0x2A3A); + _vm->_dialogs->show(10810); else if (_action.isAction(VERB_LOOK, 0x158)) - _vm->_dialogs->show(0x2A3B); + _vm->_dialogs->show(10811); else return; @@ -2509,7 +2509,7 @@ void Scene109::preActions() { void Scene109::actions() { if (_action._lookFlag) { - _vm->_dialogs->show(0x2AA0); + _vm->_dialogs->show(10912); _action._inProgress = false; return; } @@ -2667,7 +2667,7 @@ void Scene109::actions() { _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -2); int idx = _scene->_dynamicHotspots.add(53, 348, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(-3, 0), FACING_NORTHEAST); - _vm->_dialogs->show(0x2AA3); + _vm->_dialogs->show(10915); } break; @@ -2689,30 +2689,30 @@ void Scene109::actions() { _scene->_sequences.remove(_globals._sequenceIndexes[3]); _game._objects.addToInventory(OBJ_BURGER); } else if (_action.isAction(VERB_LOOK, 0xF0)) - _vm->_dialogs->show(0x2A95); + _vm->_dialogs->show(10901); else if (_action.isAction(VERB_LOOK, 0x5A)) - _vm->_dialogs->show(0x2A96); + _vm->_dialogs->show(10902); else if ((_action.isAction(VERB_TAKE) || _action.isAction(VERB_PULL)) && _action.isAction(0x5A)) - _vm->_dialogs->show(0x2A97); + _vm->_dialogs->show(10903); else if (_action.isAction(VERB_LOOK, 0x129)) - _vm->_dialogs->show(0x2A98); + _vm->_dialogs->show(10904); else if (_action.isAction(VERB_TAKE, 0x129)) - _vm->_dialogs->show(0x2A99); + _vm->_dialogs->show(10905); else if (_action.isAction(VERB_LOOK, 0x45)) - _vm->_dialogs->show(0x2A9A); + _vm->_dialogs->show(10906); else if (_action.isAction(VERB_LOOK, 0x178)) { if (_globals[kHoovicAlive]) - _vm->_dialogs->show(0x2A9B); + _vm->_dialogs->show(10907); else - _vm->_dialogs->show(0x2AA1); + _vm->_dialogs->show(10913); } else if (_action.isAction(VERB_LOOK, 0x146)) - _vm->_dialogs->show(0x2A9C); + _vm->_dialogs->show(10908); else if (_action.isAction(VERB_LOOK, 0xFC)) - _vm->_dialogs->show(0x2A9F); + _vm->_dialogs->show(10911); else if (_action.isAction(VERB_PUT, 0x146)) - _vm->_dialogs->show(0x2A9E); + _vm->_dialogs->show(10910); else if (_action.isAction(VERB_LOOK, 0x66)) - _vm->_dialogs->show(0x2AA2); + _vm->_dialogs->show(10914); else return; @@ -2832,21 +2832,21 @@ void Scene110::actions() { break; } } else if ((_action._lookFlag) || _action.isAction(VERB_LOOK, 0x3F)) - _vm->_dialogs->show(0x2AF9); + _vm->_dialogs->show(11001); else if (_action.isAction(VERB_LOOK, 0x40) || _action.isAction(0xD1, 0x40)) - _vm->_dialogs->show(0x2AFA); + _vm->_dialogs->show(11002); else if (_action.isAction(VERB_LOOK, 0x129)) - _vm->_dialogs->show(0x2AFB); + _vm->_dialogs->show(11003); else if (_action.isAction(VERB_TAKE, 0x129)) - _vm->_dialogs->show(0x2AFC); + _vm->_dialogs->show(11004); else if (_action.isAction(VERB_LOOK, 0x178)) - _vm->_dialogs->show(0x2AFD); + _vm->_dialogs->show(11005); else if (_action.isAction(VERB_LOOK, 0x41)) - _vm->_dialogs->show(0x2AFE); + _vm->_dialogs->show(11006); else if (_action.isAction(VERB_LOOK, 0x8F)) - _vm->_dialogs->show(0x2AFF); + _vm->_dialogs->show(11007); else if (_action.isAction(VERB_TAKE, 0x8F)) - _vm->_dialogs->show(0x2B00); + _vm->_dialogs->show(11008); else return; @@ -2983,17 +2983,17 @@ void Scene111::actions() { break; } } else if (_action.isAction(VERB_LOOK, 0x43)) - _vm->_dialogs->show(0x2B5D); + _vm->_dialogs->show(11101); else if (_action.isAction(VERB_LOOK, 0x116)) - _vm->_dialogs->show(0x2B5E); + _vm->_dialogs->show(11102); else if (_action.isAction(VERB_LOOK, 0x41)) - _vm->_dialogs->show(0x2B5F); + _vm->_dialogs->show(11103); else if (_action.isAction(VERB_LOOK, 0x153)) - _vm->_dialogs->show(0x2B60); + _vm->_dialogs->show(11104); else if (_action.isAction(VERB_LOOK, 0xC8)) - _vm->_dialogs->show(0x2B61); + _vm->_dialogs->show(11105); else if ((_action.isAction(VERB_PULL) || _action.isAction(VERB_TAKE)) && (_action.isAction(0x153) || _action.isAction(0xC8))) - _vm->_dialogs->show(0x2B62); + _vm->_dialogs->show(11106); else return; diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index e853c0a06b..47582cd8b6 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -273,7 +273,7 @@ void Scene201::step() { if (_game._trigger == 78) { _vm->_sound->command(40); - _vm->_dialogs->show(0x4E92); + _vm->_dialogs->show(20114); _scene->_reloadSceneFlag = true; } } @@ -292,30 +292,30 @@ void Scene201::actions() { _scene->_nextSceneId = 213; } } else if (_action.isAction(VERB_LOOK, 0x1A6)) { - _vm->_dialogs->show(0x4E85); + _vm->_dialogs->show(20101); } else if (_action.isAction(VERB_LOOK, 0x129)) { - _vm->_dialogs->show(0x4E86); + _vm->_dialogs->show(20102); } else if (_action.isAction(VERB_LOOK, 0x16F)) { - _vm->_dialogs->show(0x4E87); + _vm->_dialogs->show(20103); } else if (_action.isAction(VERB_LOOK, 0x142)) { - _vm->_dialogs->show(0x4E88); + _vm->_dialogs->show(20104); } else if (_action.isAction(VERB_LOOK, 0x18F)) { - _vm->_dialogs->show(0x4E89); + _vm->_dialogs->show(20105); } else if (_action.isAction(VERB_LOOK, 0x1B9)) { - _vm->_dialogs->show(0x4E8A); + _vm->_dialogs->show(20106); } else if (_action.isAction(VERB_LOOK, 0x192)) { - _vm->_dialogs->show(0x4E8B); + _vm->_dialogs->show(20107); } else if (_action.isAction(VERB_LOOK, 0x1BA)) { - _vm->_dialogs->show(0x4E8C); + _vm->_dialogs->show(20108); } else if (_action.isAction(VERB_LOOK, 0x83)) { - _vm->_dialogs->show(0x4E8E); + _vm->_dialogs->show(20110); } else if (_action.isAction(VERB_LOOK, 0x1B6)) { if (_globals[kMeteorologistEverSeen]) - _vm->_dialogs->show(0x4E90); + _vm->_dialogs->show(20112); else - _vm->_dialogs->show(0x4E8D); + _vm->_dialogs->show(20109); } else if (_action.isAction(VERB_LOOK, 0x16C)) { - _vm->_dialogs->show(0x4E91); + _vm->_dialogs->show(20113); } else return; } else { @@ -857,7 +857,7 @@ void Scene202::actions() { break; case 2: if (!_scene->_activeAnimation && !_meteorologistSpecial) { - _vm->_dialogs->show(0x4EFE); + _vm->_dialogs->show(20222); } _scene->_sequences.remove(_globals._sequenceIndexes[10]); _globals._sequenceIndexes[10] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[9], false, 6, 1, 0, 0); @@ -911,7 +911,7 @@ void Scene202::actions() { break; case 2: if (!_scene->_activeAnimation) - _vm->_dialogs->show(0x4EFE); + _vm->_dialogs->show(20222); _meteorologistSpecial = false; _scene->_sequences.remove(_globals._sequenceIndexes[10]); _globals._sequenceIndexes[9] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[9], false, 6, 1, 0, 0); @@ -944,15 +944,15 @@ void Scene202::actions() { else if (_globals[kMeteorologistStatus] == METEOROLOGIST_PRESENT) _vm->_dialogs->show(20220); } else if (_action.isAction(VERB_LOOK, 0x18E)) { - _vm->_dialogs->show(0x4EEE); + _vm->_dialogs->show(20206); } else if (_action.isAction(VERB_LOOK, 0x164)) { - _vm->_dialogs->show(0x4EEF); + _vm->_dialogs->show(20207); } else if (_action.isAction(VERB_LOOK, 0x175)) { - _vm->_dialogs->show(0x4EF0); + _vm->_dialogs->show(20208); } else if (_action.isAction(VERB_LOOK, 0x174)) { - _vm->_dialogs->show(0x4EF1); + _vm->_dialogs->show(20209); } else if (_action.isAction(VERB_LOOK, 0x142)) { - _vm->_dialogs->show(0x4EF2); + _vm->_dialogs->show(20210); } else if (_action.isAction(VERB_LOOK, 0xAA)) { if ((_game._player._playerPos == Common::Point(77, 105)) && (_game._player._facing == FACING_NORTH)) _vm->_dialogs->show(20212); @@ -961,13 +961,13 @@ void Scene202::actions() { } else if (_action.isAction(VERB_LOOK, NOUN_STRANGE_DEVICE)) { _vm->_dialogs->show(20213); } else if (_action.isAction(VERB_LOOK, 0x1B5)) { - _vm->_dialogs->show(0x4EF6); + _vm->_dialogs->show(20214); } else if (_action.isAction(VERB_LOOK, NOUN_SKULL)) { - _vm->_dialogs->show(0x4EF7); + _vm->_dialogs->show(20215); } else if (_action.isAction(VERB_TAKE, NOUN_SKULL)) { - _vm->_dialogs->show(0x4EF8); + _vm->_dialogs->show(20216); } else if (_action.isAction(VERB_LOOK, NOUN_BONES) && _action._commandSource == 4) { - _vm->_dialogs->show(0x4EF9); + _vm->_dialogs->show(20217); } _action._inProgress = false; @@ -1082,23 +1082,23 @@ void Scene203::preActions() { void Scene203::actions() { if (_action._savedFields._lookFlag) { - _vm->_dialogs->show(0x4F53); + _vm->_dialogs->show(20307); } else if (_action.isAction(VERB_WALK_TOWARDS, 0x83)) { _scene->_nextSceneId = 208; } else if (_action.isAction(VERB_WALK_TOWARDS, 0x82)) { _scene->_nextSceneId = 202; } else if (_action.isAction(VERB_LOOK, 0x142)) { - _vm->_dialogs->show(0x4F4D); + _vm->_dialogs->show(20301); } else if (_action.isAction(VERB_LOOK, 0x4D)) { - _vm->_dialogs->show(0x4F4E); + _vm->_dialogs->show(20302); } else if (_action.isAction(VERB_LOOK, 0x100)) { - _vm->_dialogs->show(0x4F4F); + _vm->_dialogs->show(20303); } else if (_action.isAction(VERB_LOOK, 0x82)) { - _vm->_dialogs->show(0x4F50); + _vm->_dialogs->show(20304); } else if (_action.isAction(VERB_LOOK, 0x1A6)) { - _vm->_dialogs->show(0x4F51); + _vm->_dialogs->show(20305); } else if (_action.isAction(VERB_LOOK, 0x30)) { - _vm->_dialogs->show(0x4F51); + _vm->_dialogs->show(20305); } else return; @@ -1536,7 +1536,7 @@ void Scene207::preActions() { void Scene207::actions() { if (_action._savedFields._lookFlag) { - _vm->_dialogs->show(0x50E7); + _vm->_dialogs->show(20711); } else if (_action.isAction(VERB_WALK_THROUGH, 0x70)) { _scene->_nextSceneId = 214; } else { @@ -1556,33 +1556,33 @@ void Scene207::actions() { } if (_action.isAction(VERB_LOOK, 0x69)) { - _vm->_dialogs->show(0x50DD); + _vm->_dialogs->show(20701); } else if (_action.isAction(VERB_LOOK, 0x1AF)) { - _vm->_dialogs->show(0x50DE); + _vm->_dialogs->show(20702); } else if (_action.isAction(VERB_LOOK, 0x141)) { - _vm->_dialogs->show(0x50DF); + _vm->_dialogs->show(20703); } else if (_action.isAction(VERB_LOOK, 0x3E)) { - _vm->_dialogs->show(0x50E0); + _vm->_dialogs->show(20704); } else if (_action.isAction(VERB_LOOK, 0x198)) { - _vm->_dialogs->show(0x50E1); + _vm->_dialogs->show(20705); } else if (_action.isAction(VERB_LOOK, 0x1AE)) { - _vm->_dialogs->show(0x50E2); + _vm->_dialogs->show(20706); } else if (_action.isAction(VERB_LOOK, 0xE8)) { - _vm->_dialogs->show(0x50E3); + _vm->_dialogs->show(20707); } else if (_action.isAction(VERB_LOOK, 0x12)) { - _vm->_dialogs->show(0x50E4); + _vm->_dialogs->show(20708); } else if (_action.isAction(VERB_LOOK, 0x1AC)) { - _vm->_dialogs->show(0x50E5); + _vm->_dialogs->show(20709); } else if (_action.isAction(VERB_LOOK, 0x185)) { - _vm->_dialogs->show(0x50E6); + _vm->_dialogs->show(20710); } else if (_action.isAction(VERB_TAKE, 0x141)) { - _vm->_dialogs->show(0x50E8); + _vm->_dialogs->show(20712); } else if (_action.isAction(VERB_TAKE, 0x12)) { - _vm->_dialogs->show(0x50E9); + _vm->_dialogs->show(20713); } else if (_action.isAction(VERB_LOOK, 0x14D)) { - _vm->_dialogs->show(0x50EA); + _vm->_dialogs->show(20714); } else if (_action.isAction(VERB_TAKE, 0x14D)) { - _vm->_dialogs->show(0x50EB); + _vm->_dialogs->show(20715); } else return; } @@ -1832,52 +1832,52 @@ void Scene208::actions() { } else if (_action.isAction(VERB_PUT, NOUN_BURGER, NOUN_LEAF_COVERED_PIT)) { subAction(4); if (_game._player._stepEnabled) { - _vm->_dialogs->show(0x514C); + _vm->_dialogs->show(20812); } } else if (_action.isAction(VERB_PUT, NOUN_DEAD_FISH, NOUN_LEAF_COVERED_PIT)) { subAction(5); if (_game._player._stepEnabled) { - _vm->_dialogs->show(0x514C); + _vm->_dialogs->show(20812); } } else if (_action.isAction(VERB_LOOK, 0x5D)) { - _vm->_dialogs->show(0x5141); + _vm->_dialogs->show(20801); } else if (_action.isAction(VERB_LOOK, 0xF6)) { - _vm->_dialogs->show(0x5142); + _vm->_dialogs->show(20802); } else if (_action.isAction(VERB_LOOK, 0x16F)) { - _vm->_dialogs->show(0x5143); + _vm->_dialogs->show(20803); } else if (_action.isAction(VERB_LOOK, 0x129)) { - _vm->_dialogs->show(0x5144); + _vm->_dialogs->show(20804); } else if (_action.isAction(VERB_LOOK, 0x1A1)) { - _vm->_dialogs->show(0x5145); + _vm->_dialogs->show(20805); } else if (_action.isAction(VERB_TAKE, 0x1A1)) { - _vm->_dialogs->show(0x5146); + _vm->_dialogs->show(20806); } else if (_action.isAction(VERB_LOOK, 0x9B)) { - _vm->_dialogs->show(0x5147); + _vm->_dialogs->show(20807); } else if (_action.isAction(VERB_LOOK, NOUN_DEEP_PIT)) { - _vm->_dialogs->show(0x5148); + _vm->_dialogs->show(20808); } else if (_action.isAction(VERB_LOOK, NOUN_PILE_OF_LEAVES)) { - _vm->_dialogs->show(0x5149); + _vm->_dialogs->show(20809); } else if (_action.isAction(VERB_LOOK, NOUN_LEAF_COVERED_PIT)) { if (_game._difficulty == DIFFICULTY_EASY) - _vm->_dialogs->show(0x514A); + _vm->_dialogs->show(20810); else - _vm->_dialogs->show(0x514B); + _vm->_dialogs->show(20811); } else if (_action.isAction(VERB_LOOK, 0x174) || _action.isAction(VERB_LOOK, 0x175)) { - _vm->_dialogs->show(0x514D); + _vm->_dialogs->show(20813); } else if (_action.isAction(VERB_TAKE, NOUN_LEAF_COVERED_PIT)) { - _vm->_dialogs->show(0x514E); + _vm->_dialogs->show(20814); } else if (_action.isAction(VERB_LOOK, NOUN_HUGE_LEGS)) { - _vm->_dialogs->show(0x514F); + _vm->_dialogs->show(20815); } else if (_action.isAction(VERB_TAKE, NOUN_HUGE_LEGS) || _action.isAction(VERB_PULL, NOUN_HUGE_LEGS)) { - _vm->_dialogs->show(0x5150); + _vm->_dialogs->show(20816); } else if (_action._savedFields._lookFlag == 0) { return; } else if (_globals[kRhotundaStatus] == 1) { - _vm->_dialogs->show(0x5153); + _vm->_dialogs->show(20819); } else if (_globals[kLeavesStatus] == 2) { - _vm->_dialogs->show(0x5152); + _vm->_dialogs->show(20818); } else { - _vm->_dialogs->show(0x5151); + _vm->_dialogs->show(20817); } _action._inProgress = false; @@ -2581,7 +2581,7 @@ void Scene209::handleMonkeyFall() { _fallFl = false; _counter = 0; _pauseMode = 0; - _vm->_dialogs->show(0x51AE); + _vm->_dialogs->show(20910); _game._player._stepEnabled = true; break; } @@ -3171,7 +3171,7 @@ void Scene209::preActions() { void Scene209::actions() { if (_action._lookFlag) { - _vm->_dialogs->show(0x51B0); + _vm->_dialogs->show(20912); _action._inProgress = false; return; } @@ -3315,7 +3315,7 @@ void Scene209::actions() { if (_action.isAction(VERB_LOOK, NOUN_MONKEY)) { _pitchFl = true; _game._player._stepEnabled = false; - _vm->_dialogs->show(0x51B2); + _vm->_dialogs->show(20914); _action._inProgress = false; return; } @@ -3387,69 +3387,69 @@ void Scene209::actions() { } if (_action.isAction(VERB_LOOK, 0x142)) { - _vm->_dialogs->show(0x51A5); + _vm->_dialogs->show(20901); _action._inProgress = false; return; } if (_action.isAction(VERB_LOOK, 0x1A3)) { - _vm->_dialogs->show(0x51A6); + _vm->_dialogs->show(20902); _action._inProgress = false; return; } if (_action.isAction(VERB_LOOK, 0x1A4)) { - _vm->_dialogs->show(0x51A7); + _vm->_dialogs->show(20903); _action._inProgress = false; return; } if (_action.isAction(VERB_LOOK, 0x1A6)) { - _vm->_dialogs->show(0x51A8); + _vm->_dialogs->show(20904); _action._inProgress = false; return; } if (_action.isAction(VERB_LOOK, 0x84)) { - _vm->_dialogs->show(0x51A9); + _vm->_dialogs->show(20905); _action._inProgress = false; return; } if (_action.isAction(VERB_LOOK, 0x1A2)) { - _vm->_dialogs->show(0x51AA); + _vm->_dialogs->show(20906); _action._inProgress = false; return; } if (_action.isAction(VERB_LOOK, 0x10F) && (_action._savedFields._mainObjectSource == 4)) { - _vm->_dialogs->show(0x51AB); + _vm->_dialogs->show(20907); _action._inProgress = false; return; } if (_action.isAction(VERB_GIVE, 0x17A, 0xE3) || _action.isAction(VERB_THROW, 0x17A, 0xE3)) { - _vm->_dialogs->show(0x51AD); + _vm->_dialogs->show(20909); _action._inProgress = false; return; } if (_action.isAction(VERB_LOOK, 0x175)) { - _vm->_dialogs->show(0x51B1); + _vm->_dialogs->show(20913); _action._inProgress = false; return; } if (_action.isAction(VERB_THROW, 0xE3) && _game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId))) { if (!_action.isAction(0x114)) { - _vm->_dialogs->show(0x51B3); + _vm->_dialogs->show(20915); } _action._inProgress = false; return; } if (_action.isAction(VERB_THROW, 0x114, 0xE3)) { - _vm->_dialogs->show(0x51B4); + _vm->_dialogs->show(20916); _action._inProgress = false; return; } @@ -3457,27 +3457,27 @@ void Scene209::actions() { if (_action.isAction(VERB_LOOK, 0x100)) { if (_globals[kMonkeyStatus] == MONKEY_HAS_BINOCULARS) { if (_monkeyPosition == 1) - _vm->_dialogs->show(0x51B5); + _vm->_dialogs->show(20917); else - _vm->_dialogs->show(0x51B6); + _vm->_dialogs->show(20918); } else { if (_globals[kMonkeyStatus] == MONKEY_AMBUSH_READY) - _vm->_dialogs->show(0x51B5); + _vm->_dialogs->show(20917); else - _vm->_dialogs->show(0x51B7); + _vm->_dialogs->show(20919); } _action._inProgress = false; return; } if (_action.isAction(VERB_LOOK, 0x3A4)) { - _vm->_dialogs->show(0x51B8); + _vm->_dialogs->show(20920); _action._inProgress = false; return; } if (_action.isAction(VERB_TAKE, 0x3A4)) { - _vm->_dialogs->show(0x51B9); + _vm->_dialogs->show(20921); _action._inProgress = false; return; } @@ -4327,7 +4327,7 @@ void Scene210::preActions() { void Scene210::actions() { if (_action.isAction(VERB_LOOK, 0x27, 0x1C0)) { - _vm->_dialogs->show(0x5219); + _vm->_dialogs->show(21017); } else if (_game._screenObjects._inputMode == 1) { handleConversations(); } else if (_action.isAction(VERB_TALKTO, 0x1DC) || @@ -4444,38 +4444,38 @@ void Scene210::actions() { } else if (_action.isAction(VERB_LOOK, 0xAA)) { if (_globals[kTwinklesStatus] == TWINKLES_GONE) { if (_game._storyMode == STORYMODE_NAUGHTY) - _vm->_dialogs->show(0x520B); + _vm->_dialogs->show(21003); else - _vm->_dialogs->show(0x520A); + _vm->_dialogs->show(21002); } else { - _vm->_dialogs->show(0x5209); + _vm->_dialogs->show(21001); } } else if (_action.isAction(VERB_LOOK, 0x31)) { - _vm->_dialogs->show(0x520C); + _vm->_dialogs->show(21004); } else if (_action.isAction(VERB_LOOK, 0xA7)) { - _vm->_dialogs->show(0x520D); + _vm->_dialogs->show(21005); } else if (_action.isAction(VERB_TAKE, 0xA7) || _action.isAction(VERB_TAKE, 0x31)) { - _vm->_dialogs->show(0x520E); + _vm->_dialogs->show(21006); } else if (_action.isAction(VERB_LOOK, 0x1C5)) { - _vm->_dialogs->show(0x520F); + _vm->_dialogs->show(21007); } else if (_action.isAction(VERB_LOOK, 0x3A)) { - _vm->_dialogs->show(0x5210); + _vm->_dialogs->show(21008); } else if (_action.isAction(VERB_LOOK, 0x1B0)) { - _vm->_dialogs->show(0x5211); + _vm->_dialogs->show(21009); } else if (_action.isAction(VERB_LOOK, 0x1DC)) { - _vm->_dialogs->show(0x5212); + _vm->_dialogs->show(21010); } else if (_action.isAction(0x13A, 0x1DC) || _action.isAction(0xA6, 0x1DC)) { - _vm->_dialogs->show(0x5213); + _vm->_dialogs->show(21011); } else if (_action.isAction(VERB_LOOK, 0x1BF)) { - _vm->_dialogs->show(0x5214); + _vm->_dialogs->show(21012); } else if (_action.isAction(VERB_LOOK, 0x5F)) { - _vm->_dialogs->show(0x5215); + _vm->_dialogs->show(21013); } else if (_action.isAction(VERB_LOOK, 0x53)) { - _vm->_dialogs->show(0x5216); + _vm->_dialogs->show(21014); } else if (_action.isAction(VERB_TAKE, 0x53)) { - _vm->_dialogs->show(0x5217); + _vm->_dialogs->show(21015); } else if (_action.isAction(VERB_LOOK, 0x1C0)) { - _vm->_dialogs->show(0x5218); + _vm->_dialogs->show(21016); } else { // Not handled return; @@ -4738,39 +4738,39 @@ void Scene211::preActions() { void Scene211::actions() { if (_action._lookFlag && (_globals[kMonkeyStatus] == MONKEY_AMBUSH_READY)) - _vm->_dialogs->show(0x5277); + _vm->_dialogs->show(21111); else if (_action.isAction(VERB_LOOK, 0x27, 0x100)) - _vm->_dialogs->show(0x527C); + _vm->_dialogs->show(21116); else if (_action.isAction(VERB_LOOK, 0x3A)) - _vm->_dialogs->show(0x526D); + _vm->_dialogs->show(21101); else if (_action.isAction(VERB_LOOK, 0x1B2)) - _vm->_dialogs->show(0x526E); + _vm->_dialogs->show(21102); else if (_action.isAction(VERB_LOOK, 0x100)) { if (_globals[kMonkeyStatus] == MONKEY_AMBUSH_READY) { if (_game._storyMode == STORYMODE_NAUGHTY) - _vm->_dialogs->show(0x526F); + _vm->_dialogs->show(21103); else - _vm->_dialogs->show(0x5270); + _vm->_dialogs->show(21104); } else { - _vm->_dialogs->show(0x5271); + _vm->_dialogs->show(21105); } } else if (_action.isAction(VERB_LOOK, 0x1B3)) { if (_game._storyMode == STORYMODE_NAUGHTY) - _vm->_dialogs->show(0x5272); + _vm->_dialogs->show(21106); else - _vm->_dialogs->show(0x5273); + _vm->_dialogs->show(21107); } else if (_action.isAction(VERB_LOOK, 0xB8)) - _vm->_dialogs->show(0x5274); + _vm->_dialogs->show(21108); else if (_action.isAction(VERB_LOOK, 0x1B1)) - _vm->_dialogs->show(0x5275); + _vm->_dialogs->show(21109); else if (_action.isAction(VERB_LOOK, 0x1AE)) - _vm->_dialogs->show(0x5276); + _vm->_dialogs->show(21110); else if (_action.isAction(VERB_LOOK, 0x144)) - _vm->_dialogs->show(0x5279); + _vm->_dialogs->show(21113); else if (_action.isAction(VERB_TAKE, 0x144)) - _vm->_dialogs->show(0x527A); + _vm->_dialogs->show(21114); else if (_action.isAction(VERB_LOOK, 0x129)) - _vm->_dialogs->show(0x527B); + _vm->_dialogs->show(21115); else return; @@ -4821,27 +4821,27 @@ void Scene212::preActions() { void Scene212::actions() { if (_action._lookFlag) - _vm->_dialogs->show(0x52D9); + _vm->_dialogs->show(21209); else if (_action.isAction(VERB_WALK_TOWARDS) && (_action.isObject(0x82) || _action.isObject(0xE8))) _scene->_nextSceneId = 208; else if (_action.isAction(VERB_WALK_TOWARDS, 0x3F)) _scene->_nextSceneId = 111; else if (_action.isAction(VERB_LOOK, 0x19C)) - _vm->_dialogs->show(0x52D1); + _vm->_dialogs->show(21201); else if (_action.isAction(VERB_LOOK, 0x129)) - _vm->_dialogs->show(0x52D2); + _vm->_dialogs->show(21202); else if (_action.isAction(VERB_LOOK, 0x41)) - _vm->_dialogs->show(0x52D3); + _vm->_dialogs->show(21203); else if (_action.isAction(VERB_LOOK, 0x142)) - _vm->_dialogs->show(0x52D4); + _vm->_dialogs->show(21204); else if (_action.isAction(VERB_LOOK, 0x82)) - _vm->_dialogs->show(0x52D5); + _vm->_dialogs->show(21205); else if (_action.isAction(VERB_LOOK, 0x175)) - _vm->_dialogs->show(0x52D6); + _vm->_dialogs->show(21206); else if (_action.isAction(VERB_LOOK, 0x110)) - _vm->_dialogs->show(0x52D7); + _vm->_dialogs->show(21207); else if (_action.isAction(VERB_LOOK, 0xE8)) - _vm->_dialogs->show(0x52D8); + _vm->_dialogs->show(21208); else return; @@ -4991,7 +4991,7 @@ void Scene214::step() { void Scene214::actions() { if (_action._lookFlag) - _vm->_dialogs->show(0x53B3); + _vm->_dialogs->show(21427); else if (_action.isAction(0x18A, 0xAA)) _scene->_nextSceneId = 207; else if (_action.isAction(VERB_TAKE, 0x114) && (_game._trigger || _game._objects.isInRoom(OBJ_POISON_DARTS))) { @@ -5053,60 +5053,60 @@ void Scene214::actions() { break; } } else if (_action.isAction(VERB_LOOK, 0x197)) - _vm->_dialogs->show(0x5399); + _vm->_dialogs->show(21401); else if (_action.isAction(VERB_LOOK, 0x7E)) - _vm->_dialogs->show(0x539A); + _vm->_dialogs->show(21402); else if (_action.isAction(VERB_LOOK, 0x1C3)) - _vm->_dialogs->show(0x539B); + _vm->_dialogs->show(21403); else if (_action.isAction(VERB_LOOK, 0x21)) - _vm->_dialogs->show(0x539C); + _vm->_dialogs->show(21404); else if (_action.isAction(VERB_LOOK, 0x1BB)) - _vm->_dialogs->show(0x539D); + _vm->_dialogs->show(21405); else if (_action.isAction(VERB_LOOK, 0x1BE)) { if (_game._storyMode == STORYMODE_NAUGHTY) { - _vm->_dialogs->show(0x539E); + _vm->_dialogs->show(21406); } else { - _vm->_dialogs->show(0x539F); + _vm->_dialogs->show(21407); } } else if (_action.isAction(VERB_LOOK, 0x1BC)) - _vm->_dialogs->show(0x53A0); + _vm->_dialogs->show(21408); else if (_action.isAction(VERB_TAKE, 0x1BE) || _action.isAction(VERB_TAKE, 0x1BC)) - _vm->_dialogs->show(0x53A1); + _vm->_dialogs->show(21409); else if (_action.isAction(VERB_LOOK, 0x13D)) - _vm->_dialogs->show(0x53A2); + _vm->_dialogs->show(21410); else if (_action.isAction(VERB_TAKE, 0x13D) || _action.isAction(VERB_TAKE, 0x48A)) - _vm->_dialogs->show(0x53A3); + _vm->_dialogs->show(21411); else if (_action.isAction(VERB_LOOK, 0x48A)) - _vm->_dialogs->show(0x53B4); + _vm->_dialogs->show(21428); else if (_action.isAction(VERB_LOOK, 0x114) && (_action._savedFields._mainObjectSource == 4)) - _vm->_dialogs->show(0x53A4); + _vm->_dialogs->show(21412); else if (_action.isAction(VERB_OPEN, 0x7E)) - _vm->_dialogs->show(0x53A6); + _vm->_dialogs->show(21414); else if (_action.isAction(VERB_TALKTO, 0x1C3)) - _vm->_dialogs->show(0x53A7); + _vm->_dialogs->show(21415); else if (_action.isAction(VERB_GIVE, 0x17A, 0x1C3)) - _vm->_dialogs->show(0x53A8); + _vm->_dialogs->show(21416); else if (_action.isAction(0x13A, 0x29, 0x1C3) || _action.isAction(0xA6, 0x29, 0x1C3)) - _vm->_dialogs->show(0x53A9); + _vm->_dialogs->show(21417); else if (_action.isAction(VERB_LOOK, 0x473)) - _vm->_dialogs->show(0x53AA); + _vm->_dialogs->show(21418); else if (_action.isAction(VERB_TAKE, 0x473)) - _vm->_dialogs->show(0x53AB); + _vm->_dialogs->show(21419); else if (_action.isAction(VERB_TAKE, 0x21)) - _vm->_dialogs->show(0x53AC); + _vm->_dialogs->show(21420); else if (_action.isAction(VERB_LOOK, 0x8A)) - _vm->_dialogs->show(0x53AD); + _vm->_dialogs->show(21421); else if (_action.isAction(VERB_LOOK, 0x29)) - _vm->_dialogs->show(0x53AE); + _vm->_dialogs->show(21422); else if (_action.isAction(VERB_LOOK, 0x160)) { if (_game._objects.isInRoom(OBJ_POISON_DARTS) && _game._objects.isInRoom(OBJ_BLOWGUN)) { - _vm->_dialogs->show(0x53AF); + _vm->_dialogs->show(21423); } else if (_game._objects.isInRoom(OBJ_POISON_DARTS) && !_game._objects.isInRoom(OBJ_BLOWGUN)) { - _vm->_dialogs->show(0x53B0); + _vm->_dialogs->show(21424); } else if (!_game._objects.isInRoom(OBJ_POISON_DARTS) && _game._objects.isInRoom(OBJ_BLOWGUN)) { - _vm->_dialogs->show(0x53B1); + _vm->_dialogs->show(21425); } else { - _vm->_dialogs->show(0x53B2); + _vm->_dialogs->show(21426); } } else return; @@ -5173,7 +5173,7 @@ void Scene215::step() { void Scene215::actions() { if (_action._lookFlag) - _vm->_dialogs->show(0x5405); + _vm->_dialogs->show(21509); else if (_action.isAction(VERB_TAKE, 0x17A)) { if (!_game._objects.isInInventory(OBJ_TWINKIFRUIT) || _game._trigger) { switch (_game._trigger) { @@ -5213,29 +5213,29 @@ void Scene215::actions() { } else if (_action.isAction(0x18A, 0xAA)) _scene->_nextSceneId = 210; else if (_action.isAction(VERB_LOOK, 0x21)) - _vm->_dialogs->show(0x53FD); + _vm->_dialogs->show(21501); else if (_action.isAction(VERB_LOOK, 0x1CB)) - _vm->_dialogs->show(0x53FE); + _vm->_dialogs->show(21502); else if (_action.isAction(VERB_LOOK, 0x3A3)) - _vm->_dialogs->show(0x53FF); + _vm->_dialogs->show(21503); else if (_action.isAction(VERB_LOOK, 0xD5)) - _vm->_dialogs->show(0x5400); + _vm->_dialogs->show(21504); else if (_action.isAction(VERB_LOOK, 0x197)) - _vm->_dialogs->show(0x5401); + _vm->_dialogs->show(21505); else if (_action.isAction(VERB_LOOK, 0x289)) - _vm->_dialogs->show(0x5402); + _vm->_dialogs->show(21506); else if (_action.isAction(VERB_LOOK, 0x17A) && (_action._savedFields._mainObjectSource == 4)) - _vm->_dialogs->show(0x5403); + _vm->_dialogs->show(21507); else if (_action.isAction(VERB_TAKE, 0x21)) - _vm->_dialogs->show(0x5406); + _vm->_dialogs->show(21510); else if (_action.isAction(VERB_TAKE, 0xD5)) - _vm->_dialogs->show(0x5407); + _vm->_dialogs->show(21511); else if (_action.isAction(VERB_LOOK, 0x1CA)) - _vm->_dialogs->show(0x5408); + _vm->_dialogs->show(21512); else if (_action.isAction(VERB_TAKE, 0x1CA)) - _vm->_dialogs->show(0x5409); + _vm->_dialogs->show(21513); else if (_action.isAction(VERB_TAKE, 0x3A3)) - _vm->_dialogs->show(0x540A); + _vm->_dialogs->show(21514); else return; diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 40f2533f4b..5337c99cb7 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -859,7 +859,7 @@ void Scene307::step() { void Scene307::actions() { if (_action._lookFlag) - _vm->_dialogs->show(0x77FB); + _vm->_dialogs->show(30715); else if (_game._screenObjects._inputMode == 1) handleDialog(); else if (_action.isAction(VERB_TALKTO, 0x207) || _action.isAction(VERB_TALKTO, 0x18D) || _action.isAction(VERB_TALKTO, 0x21B)) { @@ -1043,7 +1043,7 @@ void Scene307::actions() { } } } else if (_action.isAction(0x20C, 0x21B) && (_game._storyMode != STORYMODE_NAUGHTY)) - _vm->_dialogs->show(0x7803); + _vm->_dialogs->show(30723); else if (_action.isAction(0x20C, 0x21B)) { if (!_afterPeeingFl) { switch (_game._trigger) { @@ -1096,40 +1096,40 @@ void Scene307::actions() { } } else if (_action.isAction(VERB_LOOK, 0x11)) { if (!_grateOpenedFl) - _vm->_dialogs->show(0x77F6); + _vm->_dialogs->show(30710); else - _vm->_dialogs->show(0x77F7); + _vm->_dialogs->show(30711); } else if (_action.isAction(VERB_LOOK, 0x1CB)) - _vm->_dialogs->show(0x77F8); + _vm->_dialogs->show(30712); else if (_action.isAction(VERB_LOOK, 0x216)) - _vm->_dialogs->show(0x77F9); + _vm->_dialogs->show(30713); else if (_action.isAction(VERB_LOOK, 0x21B)) - _vm->_dialogs->show(0x77FA); + _vm->_dialogs->show(30714); else if (_action.isAction(0x134, 0x12C)) - _vm->_dialogs->show(0x77FC); + _vm->_dialogs->show(30716); else if (_action.isAction(VERB_LOOK, 0x207)) - _vm->_dialogs->show(0x77FD); + _vm->_dialogs->show(30717); else if (_action.isAction(VERB_LOOK, 0xCD)) - _vm->_dialogs->show(0x77FE); + _vm->_dialogs->show(30718); else if (_action.isAction(0x242, 0x204)) { switch (_fieldCollisionCounter) { case 0: - _vm->_dialogs->show(0x77FF); + _vm->_dialogs->show(30719); _fieldCollisionCounter = 1; break; case 1: - _vm->_dialogs->show(0x7800); + _vm->_dialogs->show(30720); _fieldCollisionCounter = 2; break; case 2: - _vm->_dialogs->show(0x7801); + _vm->_dialogs->show(30721); _fieldCollisionCounter = 3; break; case 3: - _vm->_dialogs->show(0x7802); + _vm->_dialogs->show(30722); break; } } else @@ -1691,7 +1691,7 @@ void Scene311::step() { void Scene311::actions() { if (_action._lookFlag) - _vm->_dialogs->show(0x798F); + _vm->_dialogs->show(31119); else if (_checkGuardFl) { _checkGuardFl = false; _scene->_kernelMessages.reset(); @@ -1791,25 +1791,25 @@ void Scene311::actions() { break; } } else if (_action.isAction(VERB_LOOK, 0x1E4)) - _vm->_dialogs->show(0x7986); + _vm->_dialogs->show(31110); else if (_action.isAction(VERB_LOOK, 0x18D)) - _vm->_dialogs->show(0x7987); + _vm->_dialogs->show(31111); else if (_action.isAction(VERB_LOOK, 0x220) || _action.isAction(0x155, 0x220)) - _vm->_dialogs->show(0x7988); + _vm->_dialogs->show(31112); else if (_action.isAction(VERB_LOOK, 0x208) || _action.isAction(0x155, 0x208)) - _vm->_dialogs->show(0x7989); + _vm->_dialogs->show(31113); else if (_action.isAction(VERB_TAKE, 0x208)) - _vm->_dialogs->show(0x798A); + _vm->_dialogs->show(31114); else if (_action.isAction(VERB_LOOK, 0xCD) || _action.isAction(0x155, 0xCD)) - _vm->_dialogs->show(0x798B); + _vm->_dialogs->show(31115); else if (_action.isAction(VERB_TAKE, 0xCD)) - _vm->_dialogs->show(0x798C); + _vm->_dialogs->show(31116); else if (_action.isAction(VERB_LOOK, 0x2BA)) - _vm->_dialogs->show(0x798D); + _vm->_dialogs->show(31117); else if (_action.isAction(VERB_LOOK, 0x2B9)) - _vm->_dialogs->show(0x798E); + _vm->_dialogs->show(31118); else if (_action.isAction(VERB_LOOK, 0x11)) - _vm->_dialogs->show(0x7990); + _vm->_dialogs->show(31120); else return; @@ -1880,13 +1880,13 @@ void Scene313::actions() { else if (_action.isAction(0x2FB, 0x2EF)) { if (_globals[kSexOfRex] == REX_FEMALE) { _globals[kSexOfRex] = REX_MALE; - _vm->_dialogs->show(0x7A45); + _vm->_dialogs->show(31301); } _scene->_nextSceneId = 391; } else if (_action.isAction(0x2FB, 0x300)) { if (_globals[kSexOfRex] == REX_FEMALE) { _globals[kSexOfRex] = REX_MALE; - _vm->_dialogs->show(0x7A45); + _vm->_dialogs->show(31301); } _scene->_nextSceneId = 366; } else if (!_action.isAction(0x301, 0x2D4)) @@ -2267,7 +2267,7 @@ void Scene316::actions() { switch (_game._trigger) { case 0: if (_globals[kCityFlooded]) { - _vm->_dialogs->show(0x7B87); + _vm->_dialogs->show(31623); } else { _vm->_sound->command(45); _game._player._stepEnabled = false; @@ -2315,35 +2315,35 @@ void Scene316::actions() { break; } } else if (_action.isAction(VERB_LOOK, 0x22C)) - _vm->_dialogs->show(0x7B7A); + _vm->_dialogs->show(31610); else if (_action.isAction(VERB_LOOK, 0x1B6)) { if (_game._visitedScenes.exists(321)) - _vm->_dialogs->show(0x7B7C); + _vm->_dialogs->show(31612); else - _vm->_dialogs->show(0x7B7B); + _vm->_dialogs->show(31611); } else if (_action.isAction(VERB_LOOK, 0x2C6)) - _vm->_dialogs->show(0x7B7D); + _vm->_dialogs->show(31613); else if (_action.isAction(VERB_LOOK, 0x2C7)) - _vm->_dialogs->show(0x7B7E); + _vm->_dialogs->show(31614); else if (_action.isAction(VERB_LOOK, 0x1E0)) - _vm->_dialogs->show(0x7B7F); + _vm->_dialogs->show(31615); else if (_action.isAction(VERB_LOOK, 0xE2)) - _vm->_dialogs->show(0x7B80); + _vm->_dialogs->show(31616); else if (_action.isAction(VERB_LOOK, 0x226)) - _vm->_dialogs->show(0x7B81); + _vm->_dialogs->show(31617); else if (_action.isAction(VERB_LOOK, 0x11)) - _vm->_dialogs->show(0x7B82); + _vm->_dialogs->show(31618); else if (_action.isAction(VERB_LOOK, 0x2B9)) { if (!_globals[kAfterHavoc]) { if (_game._difficulty != DIFFICULTY_EASY) - _vm->_dialogs->show(0x7B84); + _vm->_dialogs->show(31620); else - _vm->_dialogs->show(0x7B83); + _vm->_dialogs->show(31619); } } else if (_action.isAction(VERB_LOOK, 0x89)) - _vm->_dialogs->show(0x7B85); + _vm->_dialogs->show(31621); else if (_action.isAction(VERB_LOOK, 0x257)) - _vm->_dialogs->show(0x7B86); + _vm->_dialogs->show(31622); else return; @@ -2843,7 +2843,7 @@ void Scene318::actions() { _vm->_dialogs->showItem(OBJ_AUDIO_TAPE, 0x7C5B); _game._objects.addToInventory(OBJ_AUDIO_TAPE); } else - _vm->_dialogs->show(0x7C5A); + _vm->_dialogs->show(31834); _action._inProgress = false; return; @@ -2851,84 +2851,84 @@ void Scene318::actions() { if (_action.isAction(VERB_LOOK, 0x165)) { if (_game._objects.isInRoom(OBJ_AUDIO_TAPE)) - _vm->_dialogs->show(0x7C59); + _vm->_dialogs->show(31833); else - _vm->_dialogs->show(0x7C5A); + _vm->_dialogs->show(31834); _action._inProgress = false; return; } if (_action.isAction(0x242, 0x488)) { - _vm->_dialogs->show(0x7C57); + _vm->_dialogs->show(31831); _action._inProgress = false; return; } if (_action.isAction(VERB_LOOK, 0x2D9)) { - _vm->_dialogs->show(0x7C4F); + _vm->_dialogs->show(31823); _action._inProgress = false; return; } if (_action.isAction(VERB_LOOK, 0x308)) { - _vm->_dialogs->show(0x7C51); + _vm->_dialogs->show(31825); _action._inProgress = false; return; } } else { // Not visible if (_action.isAction(VERB_LOOK, 0x2D9)) { - _vm->_dialogs->show(0x7C4E); + _vm->_dialogs->show(31822); _action._inProgress = false; return; } if (_action.isAction(VERB_LOOK, 0x308)) { - _vm->_dialogs->show(0x7C50); + _vm->_dialogs->show(31824); _action._inProgress = false; return; } } if (_action.isAction(VERB_LOOK, 0x18D)) - _vm->_dialogs->show(0x7C42); + _vm->_dialogs->show(31810); else if (_action.isAction(VERB_LOOK, 0x89)) - _vm->_dialogs->show(0x7C43); + _vm->_dialogs->show(31811); else if (_action.isAction(VERB_LOOK, 0x2BA)) - _vm->_dialogs->show(0x7C44); + _vm->_dialogs->show(31812); else if (_action.isAction(VERB_LOOK, 0x2B3)) - _vm->_dialogs->show(0x7C45); + _vm->_dialogs->show(31813); else if (_action.isAction(VERB_LOOK, 0x2CB)) - _vm->_dialogs->show(0x7C46); + _vm->_dialogs->show(31814); else if (_action.isAction(VERB_LOOK, 0x216)) - _vm->_dialogs->show(0x7C47); + _vm->_dialogs->show(31815); else if (_action.isAction(VERB_LOOK, 0x319)) - _vm->_dialogs->show(0x7C48); + _vm->_dialogs->show(31816); else if (_action.isAction(VERB_LOOK, 0x477)) - _vm->_dialogs->show(0x7C49); + _vm->_dialogs->show(31817); else if (_action.isAction(VERB_LOOK, 0xE2)) - _vm->_dialogs->show(0x7C4A); + _vm->_dialogs->show(31818); else if (_action.isAction(VERB_LOOK, 0x2C9)) - _vm->_dialogs->show(0x7C4B); + _vm->_dialogs->show(31819); else if (_action.isAction(VERB_LOOK, 0x2C7)) - _vm->_dialogs->show(0x7C4C); + _vm->_dialogs->show(31820); else if (_action.isAction(VERB_LOOK, 0x2C8)) - _vm->_dialogs->show(0x7C4D); + _vm->_dialogs->show(31821); else if (_action.isAction(VERB_OPEN, 0x2C9)) - _vm->_dialogs->show(0x7C55); + _vm->_dialogs->show(31829); else if (_action.isAction(VERB_LOOK, 0x307)) - _vm->_dialogs->show(0x7C56); + _vm->_dialogs->show(31830); else if (_action.isAction(VERB_LOOK, 0x3A1)) - _vm->_dialogs->show(0x7C58); + _vm->_dialogs->show(31832); else if (_action.isAction(VERB_LOOK, 0x3A2)) - _vm->_dialogs->show(0x7C5C); + _vm->_dialogs->show(31836); else if (_action._lookFlag) { if (_game._player._visible || _game._objects.isInInventory(OBJ_SCALPEL)) - _vm->_dialogs->show(0x7C54); + _vm->_dialogs->show(31828); else if (_internVisibleFl) - _vm->_dialogs->show(0x7C52); + _vm->_dialogs->show(31826); else - _vm->_dialogs->show(0x7C53); + _vm->_dialogs->show(31827); } else return; @@ -3640,7 +3640,7 @@ void Scene320::step() { void Scene320::actions() { if (_action._lookFlag) - _vm->_dialogs->show(0x7D0B); + _vm->_dialogs->show(32011); else if ((_action.isAction(0x11A) || _action.isAction(VERB_PUSH)) && (_action.isAction(0x2E8) || _action.isAction(0x2E9) || _action.isAction(0x2EA) || _action.isAction(0x2EB) || _action.isAction(0x2DE) || _action.isAction(0x2DD) || _action.isAction(0x2E0) || _action.isAction(0x2E1) || @@ -3712,37 +3712,37 @@ void Scene320::actions() { } else if (_action.isAction(0x1CD, 0x2EF)) _scene->_nextSceneId = 311; else if (_action.isAction(VERB_LOOK, 0x2DC)) - _vm->_dialogs->show(0x7D01); + _vm->_dialogs->show(32001); else if (_action.isAction(VERB_LOOK, 0x2DB)) - _vm->_dialogs->show(0x7D02); + _vm->_dialogs->show(32002); else if (_action.isAction(VERB_LOOK, 0x1E4)) - _vm->_dialogs->show(0x7D03); + _vm->_dialogs->show(32003); else if (_action.isAction(VERB_LOOK, 0x2EF)) - _vm->_dialogs->show(0x7D04); + _vm->_dialogs->show(32004); else if (_action.isAction(VERB_LOOK, 0x2ED)) - _vm->_dialogs->show(0x7D05); + _vm->_dialogs->show(32005); else if (_action.isAction(VERB_LOOK, 0x2EE)) - _vm->_dialogs->show(0x7D06); + _vm->_dialogs->show(32006); else if (_action.isAction(VERB_LOOK, 0x2F1)) - _vm->_dialogs->show(0x7D06); + _vm->_dialogs->show(32006); else if (_action.isAction(VERB_LOOK, 0x2F3)) - _vm->_dialogs->show(0x7D08); + _vm->_dialogs->show(32008); else if (_action.isAction(VERB_LOOK, 0x2F0)) - _vm->_dialogs->show(0x7D09); + _vm->_dialogs->show(32009); else if (_action.isAction(VERB_LOOK, 0x2F2)) - _vm->_dialogs->show(0x7D0A); + _vm->_dialogs->show(32010); else if (_action.isAction(VERB_TAKE, 0x2ED)) - _vm->_dialogs->show(0x7D0C); + _vm->_dialogs->show(32012); else if (_action.isAction(VERB_TAKE, 0x2F2)) - _vm->_dialogs->show(0x7D0D); + _vm->_dialogs->show(32013); else if (_action.isAction(VERB_TAKE, 0x2EE) || _action.isAction(0x75, 0x2EE)) - _vm->_dialogs->show(0x7D0E); + _vm->_dialogs->show(32014); else if (_action.isAction(VERB_TAKE, 0x2F3)) - _vm->_dialogs->show(0x7D0F); + _vm->_dialogs->show(32015); else if (_action.isAction(VERB_TAKE, 0x2F1)) - _vm->_dialogs->show(0x7D10); + _vm->_dialogs->show(32016); else if (_action.isAction(VERB_TAKE, 0x2F0)) - _vm->_dialogs->show(0x7D11); + _vm->_dialogs->show(32017); else return; @@ -3953,7 +3953,7 @@ void Scene351::step() { void Scene351::actions() { if (_action._lookFlag) - _vm->_dialogs->show(0x8931); + _vm->_dialogs->show(35121); else if (_action.isAction(0x2F9, 0x16C)) _scene->_nextSceneId = 322; else if (_action.isAction(0x1AD, 0x2B3)) @@ -3991,30 +3991,30 @@ void Scene351::actions() { } } } else if (_action.isAction(VERB_LOOK, 0x180)) - _vm->_dialogs->show(0x8926); + _vm->_dialogs->show(35110); else if (_action.isAction(VERB_LOOK, 0x23A)) - _vm->_dialogs->show(0x8927); + _vm->_dialogs->show(35111); else if (_action.isAction(VERB_LOOK, 0x1E6)) - _vm->_dialogs->show(0x8928); + _vm->_dialogs->show(35112); else if (_action.isAction(VERB_LOOK, 0x239)) { if (_game._objects[0xF]._roomNumber == 351) - _vm->_dialogs->show(0x892A); + _vm->_dialogs->show(35114); else - _vm->_dialogs->show(0x8929); + _vm->_dialogs->show(35113); } else if (_action.isAction(VERB_LOOK, 0x2C7)) - _vm->_dialogs->show(0x892B); + _vm->_dialogs->show(35115); else if (_action.isAction(VERB_LOOK, 0x1E4)) - _vm->_dialogs->show(0x892C); + _vm->_dialogs->show(35116); else if (_action.isAction(VERB_LOOK, 0xD7)) - _vm->_dialogs->show(0x892D); + _vm->_dialogs->show(35117); else if (_action.isAction(VERB_LOOK, 0x16C)) - _vm->_dialogs->show(0x892E); + _vm->_dialogs->show(35118); else if (_action.isAction(VERB_LOOK, 0x59)) - _vm->_dialogs->show(0x892F); + _vm->_dialogs->show(35119); else if (_action.isAction(VERB_LOOK, 0x2B3)) - _vm->_dialogs->show(0x8930); + _vm->_dialogs->show(35120); else if (_action.isAction(VERB_LOOK, 0x1EB)) - _vm->_dialogs->show(0x8932); + _vm->_dialogs->show(35122); else return; @@ -4225,7 +4225,7 @@ void Scene352::preActions() { void Scene352::actions() { if (_action._lookFlag) { - _vm->_dialogs->show(0x8999); + _vm->_dialogs->show(35225); _action._inProgress = false; return; } @@ -4509,53 +4509,53 @@ void Scene352::actions() { break; } } else if (_action.isAction(VERB_LOOK, 0x1F3)) - _vm->_dialogs->show(0x898A); + _vm->_dialogs->show(35210); else if (_action.isAction(VERB_LOOK, 0xE2)) { if (_game._storyMode == STORYMODE_NAUGHTY) - _vm->_dialogs->show(0x898B); + _vm->_dialogs->show(35211); else - _vm->_dialogs->show(0x898C); + _vm->_dialogs->show(35212); } else if (_action.isAction(VERB_LOOK, 0x1CC)) - _vm->_dialogs->show(0x898D); + _vm->_dialogs->show(35213); else if (_action.isAction(VERB_LOOK, 0x2CD)) - _vm->_dialogs->show(0x898E); + _vm->_dialogs->show(35214); else if (_action.isAction(VERB_LOOK, 0x165) && (_action._savedFields._mainObjectSource == 4)) - _vm->_dialogs->show(0x898F); + _vm->_dialogs->show(35215); else if (_action.isAction(VERB_LOOK, 0x11)) - _vm->_dialogs->show(0x8990); + _vm->_dialogs->show(35216); else if (_action.isAction(VERB_LOOK, 0x3B6) && (_action._savedFields._mainObjectSource == 4)) - _vm->_dialogs->show(0x8991); + _vm->_dialogs->show(35217); else if (_action.isAction(VERB_LOOK, 0x2DA)) - _vm->_dialogs->show(0x8992); + _vm->_dialogs->show(35218); else if (_action.isAction(VERB_LOOK, 0x51)) - _vm->_dialogs->show(0x8993); + _vm->_dialogs->show(35219); else if (_action.isAction(VERB_LOOK, 0x2CE)) - _vm->_dialogs->show(0x8994); + _vm->_dialogs->show(35220); else if (_action.isAction(VERB_LOOK, 0x1F8)) { if (!_vaultOpenFl) - _vm->_dialogs->show(0x8995); + _vm->_dialogs->show(35221); } else if (_action.isAction(VERB_LOOK, 0x2F4)) - _vm->_dialogs->show(0x8996); + _vm->_dialogs->show(35222); else if (_action.isAction(VERB_LOOK, 0x2F5)) - _vm->_dialogs->show(0x8997); + _vm->_dialogs->show(35223); else if (_action.isAction(VERB_LOOK, 0x2B3)) - _vm->_dialogs->show(0x8998); + _vm->_dialogs->show(35224); else if (_action.isAction(VERB_TAKE, 0x2F5)) - _vm->_dialogs->show(0x899A); + _vm->_dialogs->show(35226); else if (_action.isAction(VERB_LOOK, 0x1E4)) - _vm->_dialogs->show(0x899D); + _vm->_dialogs->show(35229); else if (_action.isAction(VERB_LOOK, 0x239)) - _vm->_dialogs->show(0x899E); + _vm->_dialogs->show(35230); else if (_action.isAction(VERB_LOOK, 0x70)) - _vm->_dialogs->show(0x899F); + _vm->_dialogs->show(35231); else if (_action.isAction(VERB_LOOK, 0x160)) - _vm->_dialogs->show(0x89A0); + _vm->_dialogs->show(35232); else if (_action.isAction(VERB_LOOK, 0x3B5)) - _vm->_dialogs->show(0x89A1); + _vm->_dialogs->show(35233); else if (_action.isAction(VERB_LOOK, 0x257)) - _vm->_dialogs->show(0x89A2); + _vm->_dialogs->show(35234); else if (_action.isAction(VERB_LOOK, 0x1F5)) - _vm->_dialogs->show(0x89A3); + _vm->_dialogs->show(35235); else return; } @@ -4597,27 +4597,27 @@ void Scene353::enter() { void Scene353::actions() { if (_action._lookFlag) - _vm->_dialogs->show(0x89F3); + _vm->_dialogs->show(35315); else if (_action.isAction(0x18B, 0x70)) _scene->_nextSceneId = 352; else if (_action.isAction(0x1AD, 0x2B3)) _scene->_nextSceneId = 354; else if (_action.isAction(VERB_LOOK, 0x23D)) - _vm->_dialogs->show(0x89EE); + _vm->_dialogs->show(35310); else if (_action.isAction(VERB_LOOK, 0x1FA) || _action.isAction(VERB_LOOK, 0x10C)) - _vm->_dialogs->show(0x89EF); + _vm->_dialogs->show(35311); else if (_action.isAction(VERB_LOOK, 0x23C)) - _vm->_dialogs->show(0x89F0); + _vm->_dialogs->show(35312); else if (_action.isAction(VERB_LOOK, 0x70)) - _vm->_dialogs->show(0x89F1); + _vm->_dialogs->show(35313); else if (_action.isAction(VERB_LOOK, 0x2B3)) - _vm->_dialogs->show(0x89F2); + _vm->_dialogs->show(35314); else if (_action.isAction(VERB_LOOK, 0x89)) - _vm->_dialogs->show(0x89F4); + _vm->_dialogs->show(35316); else if (_action.isAction(VERB_LOOK, 0x46)) - _vm->_dialogs->show(0x89F5); + _vm->_dialogs->show(35317); else if (_action.isAction(VERB_LOOK, 0x18D)) - _vm->_dialogs->show(0x89F6); + _vm->_dialogs->show(35318); else return; @@ -4655,7 +4655,7 @@ void Scene354::preActions() { void Scene354::actions() { if (_action._lookFlag) - _vm->_dialogs->show(0x8A56); + _vm->_dialogs->show(35414); else if (_action.isAction(0x1AD, 0x2B4)) { _game._player.startWalking(Common::Point(208, 0), FACING_NORTHEAST); _game._player._walkOffScreenSceneId = 353; @@ -4666,25 +4666,25 @@ void Scene354::actions() { else if (_action.isAction(0x1AD, 0x2B3)) _scene->_nextSceneId = 401; else if (_action.isAction(VERB_LOOK, 0x2C6)) - _vm->_dialogs->show(0x8A52); + _vm->_dialogs->show(35410); else if (_action.isAction(VERB_LOOK, 0x1FD)) - _vm->_dialogs->show(0x8A53); + _vm->_dialogs->show(35411); else if (_action.isAction(VERB_LOOK, 0x2D0)) - _vm->_dialogs->show(0x8A54); + _vm->_dialogs->show(35412); else if (_action.isAction(VERB_LOOK, 0x206)) - _vm->_dialogs->show(0x8A55); + _vm->_dialogs->show(35413); else if (_action.isAction(VERB_LOOK, 0x2B4)) - _vm->_dialogs->show(0x8A57); + _vm->_dialogs->show(35415); else if (_action.isAction(VERB_LOOK, 0x2B3)) - _vm->_dialogs->show(0x8A58); + _vm->_dialogs->show(35416); else if (_action.isAction(VERB_LOOK, 0x2B9)) - _vm->_dialogs->show(0x8A59); + _vm->_dialogs->show(35417); else if (_action.isAction(VERB_LOOK, 0x2BA)) - _vm->_dialogs->show(0x8A5A); + _vm->_dialogs->show(35418); else if (_action.isAction(VERB_LOOK, 0x218)) - _vm->_dialogs->show(0x8A5B); + _vm->_dialogs->show(35419); else if (_action.isAction(VERB_LOOK, 0x239)) - _vm->_dialogs->show(0x8A5C); + _vm->_dialogs->show(35420); else return; @@ -4725,33 +4725,33 @@ void Scene357::preActions() { void Scene357::actions() { if (_action._lookFlag) - _vm->_dialogs->show(0x8B83); + _vm->_dialogs->show(35715); else if (_action.isAction(VERB_LOOK, 0x11)) - _vm->_dialogs->show(0x8B7E); + _vm->_dialogs->show(35710); else if (_action.isAction(0x2F7, 0x11)) - _vm->_dialogs->show(0x8B7F); + _vm->_dialogs->show(35711); else if (_action.isAction(VERB_LOOK, 0x1CB)) - _vm->_dialogs->show(0x8B80); + _vm->_dialogs->show(35712); else if (_action.isAction(VERB_LOOK, 0x216)) - _vm->_dialogs->show(0x8B81); + _vm->_dialogs->show(35713); else if (_action.isAction(VERB_LOOK, 0x21B)) - _vm->_dialogs->show(0x8B82); + _vm->_dialogs->show(35714); else if (_action.isAction(VERB_LOOK, 0x207)) - _vm->_dialogs->show(0x8B84); + _vm->_dialogs->show(35716); else if (_action.isAction(VERB_LOOK, 0xCD)) - _vm->_dialogs->show(0x8B85); + _vm->_dialogs->show(35717); else if (_action.isAction(VERB_LOOK, 0x23A)) - _vm->_dialogs->show(0x8B86); + _vm->_dialogs->show(35718); else if (_action.isAction(VERB_LOOK, 0x218)) - _vm->_dialogs->show(0x8B87); + _vm->_dialogs->show(35719); else if (_action.isAction(VERB_TAKE, 0x218)) - _vm->_dialogs->show(0x8B88); + _vm->_dialogs->show(35720); else if (_action.isAction(VERB_LOOK, 0x18D)) - _vm->_dialogs->show(0x8B89); + _vm->_dialogs->show(35721); else if (_action.isAction(VERB_LOOK, 0x2B9)) - _vm->_dialogs->show(0x8B8A); + _vm->_dialogs->show(35722); else if (_action.isAction(VERB_LOOK, 0x2BA)) - _vm->_dialogs->show(0x8B8B); + _vm->_dialogs->show(35723); else return; @@ -4789,21 +4789,21 @@ void Scene358::preActions() { void Scene358::actions() { if (_action._lookFlag) - _vm->_dialogs->show(0x8BE7); + _vm->_dialogs->show(35815); else if (_action.isAction(VERB_LOOK, 0x2BA)) - _vm->_dialogs->show(0x8BE2); + _vm->_dialogs->show(35810); else if (_action.isAction(VERB_LOOK, 0x2B9)) - _vm->_dialogs->show(0x8BE3); + _vm->_dialogs->show(35811); else if (_action.isAction(VERB_LOOK, 0x1CB)) - _vm->_dialogs->show(0x8BE4); + _vm->_dialogs->show(35812); else if (_action.isAction(VERB_LOOK, 0x216)) - _vm->_dialogs->show(0x8BE5); + _vm->_dialogs->show(35813); else if (_action.isAction(VERB_LOOK, 0x21B)) - _vm->_dialogs->show(0x8BE6); + _vm->_dialogs->show(35814); else if (_action.isAction(VERB_LOOK, 0x204) || _action.isAction(VERB_LOOK, 0x18D)) - _vm->_dialogs->show(0x8BE8); + _vm->_dialogs->show(35816); else if (_action.isAction(VERB_LOOK, 0x11)) - _vm->_dialogs->show(0x8BE9); + _vm->_dialogs->show(35817); else return; @@ -4856,16 +4856,16 @@ void Scene359::preActions() { void Scene359::actions() { if (_action._lookFlag) { if ((_game._difficulty != DIFFICULTY_HARD) && (_game._objects[OBJ_SECURITY_CARD]._roomNumber == 359)) - _vm->_dialogs->show(0x8C4A); + _vm->_dialogs->show(35914); else - _vm->_dialogs->show(0x8C4B); + _vm->_dialogs->show(35915); } else if (_action.isAction(VERB_TAKE, 0x131)) { if (_game._trigger || !_game._objects.isInInventory(OBJ_SECURITY_CARD)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; _game._player._visible = false; - _vm->_dialogs->show(0x8C50); + _vm->_dialogs->show(35920); if (_globals[kSexOfRex] == REX_MALE) { _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 4, 2, 0, 0); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[2]); @@ -4904,43 +4904,43 @@ void Scene359::actions() { } } } else if (_action.isAction(VERB_LOOK, 0x23E)) - _vm->_dialogs->show(0x8C46); + _vm->_dialogs->show(35910); else if (_action.isAction(VERB_LOOK, 0x1CB)) - _vm->_dialogs->show(0x8C47); + _vm->_dialogs->show(35911); else if (_action.isAction(VERB_LOOK, 0x216)) - _vm->_dialogs->show(0x8C48); + _vm->_dialogs->show(35912); else if (_action.isAction(VERB_LOOK, 0x21B)) - _vm->_dialogs->show(0x8C49); + _vm->_dialogs->show(35913); else if (_action.isAction(VERB_LOOK, 0x2B9)) - _vm->_dialogs->show(0x8C4C); + _vm->_dialogs->show(35916); else if (_action.isAction(VERB_LOOK, 0x2BA)) - _vm->_dialogs->show(0x8C4D); + _vm->_dialogs->show(35917); else if (_action.isAction(VERB_LOOK, 0x215)) - _vm->_dialogs->show(0x8C4E); + _vm->_dialogs->show(35918); else if (_action.isAction(VERB_TAKE, 0x215)) - _vm->_dialogs->show(0x8C4F); + _vm->_dialogs->show(35919); else if (_action.isAction(VERB_LOOK, 0x131) && (_action._mainObjectSource == 4)) - _vm->_dialogs->show(0x8C51); + _vm->_dialogs->show(35921); else if (_action.isAction(VERB_LOOK, 0x2D2)) { if ((_game._difficulty != DIFFICULTY_HARD) && (_game._objects[OBJ_SECURITY_CARD]._roomNumber == 359)) - _vm->_dialogs->show(0x8C52); + _vm->_dialogs->show(35922); else - _vm->_dialogs->show(0x8C53); + _vm->_dialogs->show(35923); } else if (_action.isAction(VERB_LOOK, 0x23F)) - _vm->_dialogs->show(0x8C54); + _vm->_dialogs->show(35924); else if (_action.isAction(VERB_TAKE, 0x23F)) - _vm->_dialogs->show(0x8C55); + _vm->_dialogs->show(35925); else if (_action.isAction(VERB_LOOK, 0x23A)) - _vm->_dialogs->show(0x8C56); + _vm->_dialogs->show(35926); else if (_action.isAction(VERB_LOOK, 0x204)) - _vm->_dialogs->show(0x8C57); + _vm->_dialogs->show(35927); else if (_action.isAction(VERB_LOOK, 0x89)) { if ((_game._difficulty != DIFFICULTY_HARD) && (_game._objects[OBJ_SECURITY_CARD]._roomNumber == 359)) - _vm->_dialogs->show(0x8C58); + _vm->_dialogs->show(35928); else - _vm->_dialogs->show(0x8C59); + _vm->_dialogs->show(35929); } else if (_action.isAction(VERB_OPEN, 0x11) || _action.isAction(VERB_LOOK, 0x11)) - _vm->_dialogs->show(0x8CB0); + _vm->_dialogs->show(36016); else return; @@ -4985,23 +4985,23 @@ void Scene360::preActions() { void Scene360::actions() { if (_action._lookFlag) - _vm->_dialogs->show(0x8CAF); + _vm->_dialogs->show(36015); else if (_action.isAction(VERB_LOOK, 0x2BA)) - _vm->_dialogs->show(0x8CAA); + _vm->_dialogs->show(36010); else if (_action.isAction(VERB_LOOK, 0x2B9)) - _vm->_dialogs->show(0x8CAB); + _vm->_dialogs->show(36011); else if (_action.isAction(VERB_LOOK, 0x1CB)) - _vm->_dialogs->show(0x8CAC); + _vm->_dialogs->show(36012); else if (_action.isAction(VERB_LOOK, 0x216)) - _vm->_dialogs->show(0x8CAD); + _vm->_dialogs->show(36013); else if (_action.isAction(VERB_LOOK, 0x21B)) - _vm->_dialogs->show(0x8CAE); + _vm->_dialogs->show(36014); else if (_action.isAction(VERB_LOOK, 0x11)) - _vm->_dialogs->show(0x8CB0); + _vm->_dialogs->show(36016); else if (_action.isAction(VERB_LOOK, 0x204)) - _vm->_dialogs->show(0x8CB1); + _vm->_dialogs->show(36017); else if (_action.isAction(VERB_LOOK, 0x18D)) - _vm->_dialogs->show(0x8CB2); + _vm->_dialogs->show(36018); else return; @@ -5357,7 +5357,7 @@ void Scene361::preActions() { void Scene361::actions() { if (_action._lookFlag) - _vm->_dialogs->show(0x8D17); + _vm->_dialogs->show(36119); else if (_action.isAction(0x21F, 0x1E4)) { _scene->_kernelMessages.reset(); _scene->_kernelMessages.addQuote(0xFC, 120, 0); @@ -5367,25 +5367,25 @@ void Scene361::actions() { else handleRexAction(); } else if (_action.isAction(VERB_LOOK, 0x1E4)) - _vm->_dialogs->show(0x8D0E); + _vm->_dialogs->show(36110); else if (_action.isAction(VERB_LOOK, 0x18D)) - _vm->_dialogs->show(0x8D0F); + _vm->_dialogs->show(36111); else if (_action.isAction(VERB_LOOK, 0x220) || _action.isAction(0x155, 0x220)) - _vm->_dialogs->show(0x8D10); + _vm->_dialogs->show(36112); else if (_action.isAction(VERB_LOOK, 0x208) || _action.isAction(0x155, 0x208)) - _vm->_dialogs->show(0x8D11); + _vm->_dialogs->show(36113); else if (_action.isAction(VERB_TAKE, 0x208)) - _vm->_dialogs->show(0x8D12); + _vm->_dialogs->show(36114); else if (_action.isAction(VERB_LOOK, 0x2F8) || _action.isAction(0x155, 0x2F8)) - _vm->_dialogs->show(0x8D13); + _vm->_dialogs->show(36115); else if (_action.isAction(VERB_TAKE, 0x2F8)) - _vm->_dialogs->show(0x8D14); + _vm->_dialogs->show(36116); else if (_action.isAction(VERB_LOOK, 0x2BA)) - _vm->_dialogs->show(0x8D15); + _vm->_dialogs->show(36117); else if (_action.isAction(VERB_LOOK, 0x2B9)) - _vm->_dialogs->show(0x8D16); + _vm->_dialogs->show(36118); else if (_action.isAction(VERB_LOOK, 0x11)) - _vm->_dialogs->show(0x8D18); + _vm->_dialogs->show(36120); else return; @@ -5444,9 +5444,9 @@ void Scene387::actions() { if (_action.isAction(0x2D5, 0x2D4)) _scene->_nextSceneId = 313; else if (_action.isAction(0xD3, 0x2D3)) - _vm->_dialogs->show(0x9736); + _vm->_dialogs->show(38710); else if (_action.isAction(VERB_OPEN, 0x2D3)) - _vm->_dialogs->show(0x9737); + _vm->_dialogs->show(38711); else return; @@ -5505,11 +5505,11 @@ void Scene388::actions() { } } else if (_action.isAction(0xD3, 0x2D3)) { if (_globals[kAfterHavoc]) - _vm->_dialogs->show(0x979B); + _vm->_dialogs->show(38811); else - _vm->_dialogs->show(0x979A); + _vm->_dialogs->show(38810); } else if (_action.isAction(VERB_OPEN, 0x2D3)) - _vm->_dialogs->show(0x979C); + _vm->_dialogs->show(38812); else return; @@ -5579,16 +5579,16 @@ void Scene389::actions() { } else if (_action.isAction(0xD3, 0x2D3)) { if (_globals[kAfterHavoc]) { if ((_game._difficulty != DIFFICULTY_HARD) && (_game._objects[OBJ_SECURITY_CARD]._roomNumber == 359)) - _vm->_dialogs->show(0x97FF); + _vm->_dialogs->show(38911); else - _vm->_dialogs->show(0x9800); + _vm->_dialogs->show(38912); } else - _vm->_dialogs->show(0x97FE); + _vm->_dialogs->show(38910); } else if (_action.isAction(VERB_OPEN, 0x2D3)) { if (_globals[kAfterHavoc]) - _vm->_dialogs->show(0x9802); + _vm->_dialogs->show(38914); else - _vm->_dialogs->show(0x9801); + _vm->_dialogs->show(38913); } else return; @@ -5620,9 +5620,9 @@ void Scene390::actions() { if (_action.isAction(0x2D5, 0x2D4)) _scene->_nextSceneId = 313; else if (_action.isAction(0xD3, 0x2D3)) - _vm->_dialogs->show(0x9862); + _vm->_dialogs->show(39010); else if (_action.isAction(VERB_OPEN, 0x2D3)) - _vm->_dialogs->show(0x9863); + _vm->_dialogs->show(39011); else return; @@ -5647,9 +5647,9 @@ void Scene391::actions() { _scene->_nextSceneId = 313; else if (_action.isAction(VERB_OPEN, 0x2D3)) { if (_globals[kKickedIn391Grate]) - _vm->_dialogs->show(0x98C9); + _vm->_dialogs->show(39113); else { - _vm->_dialogs->show(0x98C8); + _vm->_dialogs->show(39112); _globals[kKickedIn391Grate] = true; } @@ -5659,9 +5659,9 @@ void Scene391::actions() { _scene->_nextSceneId = 311; } else if (_action.isAction(0xD3, 0x2D3)) { if (_globals[kAfterHavoc]) - _vm->_dialogs->show(0x98C7); + _vm->_dialogs->show(39111); else - _vm->_dialogs->show(0x98C6); + _vm->_dialogs->show(39110); } else return; @@ -5687,16 +5687,16 @@ void Scene399::actions() { else if (_action.isAction(0xD3, 0x2D3)) { if (_globals[kAfterHavoc]) { if ((_game._difficulty != DIFFICULTY_HARD) && (_game._objects[OBJ_SECURITY_CARD]._roomNumber == 359)) - _vm->_dialogs->show(0x97FF); + _vm->_dialogs->show(38911); else - _vm->_dialogs->show(0x9800); + _vm->_dialogs->show(38912); } else - _vm->_dialogs->show(0x97FE); + _vm->_dialogs->show(38910); } else if (_action.isAction(VERB_OPEN, 0x2D3)) { if (_globals[kAfterHavoc]) - _vm->_dialogs->show(0x9802); + _vm->_dialogs->show(38914); else - _vm->_dialogs->show(0x9801); + _vm->_dialogs->show(38913); } else return; -- cgit v1.2.3 From 8619f856742a5ad1df3822d3881b5cddffb322c1 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 20 May 2014 01:43:26 +0300 Subject: MADS: Bugfixes and cleanup in scene 101 --- engines/mads/nebular/nebular_scenes1.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 875c58ce42..025d5510bf 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -272,7 +272,7 @@ void Scene101::preActions() { _game._player._needToWalk = true; if (_sittingFl) { - if (_action.isAction(VERB_LOOK) || _action.isAction(0x47) || _action.isAction(VERB_TALKTO) || _action.isAction(0x103) || _action.isAction(0x7D)) + if (_action.isAction(VERB_LOOK) || _action.isObject(NOUN_CHAIR) || _action.isAction(VERB_TALKTO) || _action.isAction(VERB_PEER_THROUGH) || _action.isAction(VERB_EXAMINE)) _game._player._needToWalk = false; if (_game._player._needToWalk) { @@ -301,12 +301,12 @@ void Scene101::preActions() { } } - if (_panelOpened && !(_action.isAction(0x135) || _action.isAction(0x137))) { + if (_panelOpened && !(_action.isObject(NOUN_SHIELD_ACCESS_PANEL) || _action.isObject(NOUN_SHIELD_MODULATOR))) { switch (_game._trigger) { case 0: if (_game._player._needToWalk) { _scene->_sequences.remove(_globals._sequenceIndexes[13]); - _shieldSpriteIdx = _game._objects.isInRoom(0x18) ? 13 : 14; + _shieldSpriteIdx = _game._objects.isInRoom(OBJ_SHIELD_MODULATOR) ? 13 : 14; _globals._sequenceIndexes[13] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[_shieldSpriteIdx], false, 6, 1, 0, 0); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SEQUENCE_TRIGGER_EXPIRE, 0, 1); _game._player._stepEnabled = false; @@ -330,13 +330,13 @@ void Scene101::actions() { return; } - if (_action.isAction(VERB_WALKTO, 0xCC)) { + if (_action.isAction(VERB_WALKTO, NOUN_LIFE_SUPPORT_SECTION)) { _scene->_nextSceneId = 102; _action._inProgress = false; return; } - if (_action.isAction(0x13F, 0x47) || (_action.isAction(VERB_LOOK, 0x180) && !_sittingFl)) { + if (_action.isAction(VERB_SIT_IN, NOUN_CHAIR) || (_action.isAction(VERB_LOOK, NOUN_VIEW_SCREEN) && !_sittingFl)) { if (!_sittingFl) { switch (_game._trigger) { case 0: @@ -361,7 +361,7 @@ void Scene101::actions() { _sittingFl = true; _scene->_hotspots.activate(71, false); _chairHotspotId = _scene->_dynamicHotspots.add(71, 0x13F, -1, Common::Rect(159, 84, 159 + 33, 84 + 36)); - if (!_action.isAction(VERB_LOOK, 0x180)) { + if (!_action.isAction(VERB_LOOK, NOUN_VIEW_SCREEN)) { _action._inProgress = false; return; } @@ -375,7 +375,7 @@ void Scene101::actions() { } } - if (((_action.isAction(VERB_WALKTO, 0x135) || _action.isAction(VERB_OPEN, 0x135))) && !_panelOpened) { + if (((_action.isAction(VERB_WALKTO, NOUN_SHIELD_ACCESS_PANEL) || _action.isAction(VERB_OPEN, NOUN_SHIELD_ACCESS_PANEL))) && !_panelOpened) { switch (_game._trigger) { case 0: _shieldSpriteIdx = _game._objects.isInRoom(0x18) ? 13 : 14; @@ -399,19 +399,19 @@ void Scene101::actions() { return; } - if ((_action.isAction(VERB_TAKE, 0x137) || _action.isAction(VERB_PULL, 0x137)) && _game._objects.isInRoom(0x18)) { + if ((_action.isAction(VERB_TAKE, NOUN_SHIELD_MODULATOR) || _action.isAction(VERB_PULL, NOUN_SHIELD_MODULATOR)) && _game._objects.isInRoom(OBJ_SHIELD_MODULATOR)) { _game._objects.addToInventory(OBJ_SHIELD_MODULATOR); _scene->_sequences.remove(_globals._sequenceIndexes[13]); _globals._sequenceIndexes[13] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[14], false, 6, 0, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[13], -2, -2); - _scene->_hotspots.activate(0x137, false); + _scene->_hotspots.activate(NOUN_SHIELD_MODULATOR, false); _vm->_dialogs->showItem(OBJ_SHIELD_MODULATOR, 10120); _vm->_sound->command(22); _action._inProgress = false; return; } - if (_action.isAction(VERB_LOOK, 0x135) || (_action.isAction(VERB_LOOK, 0x137) && !_game._objects.isInInventory(OBJ_SHIELD_MODULATOR)) ) { + if (_action.isAction(VERB_LOOK, NOUN_SHIELD_ACCESS_PANEL) || (_action.isAction(VERB_LOOK, NOUN_SHIELD_MODULATOR) && !_game._objects.isInInventory(OBJ_SHIELD_MODULATOR)) ) { if (_panelOpened) { if (_game._objects.isInRoom(OBJ_SHIELD_MODULATOR)) _vm->_dialogs->show(10128); @@ -475,7 +475,7 @@ void Scene101::actions() { return; } - if ((_action.isAction(VERB_LOOK) || _action.isAction(0x103)) && (_action.isAction(0x8E) || _action.isAction(0xF9))) { + if ((_action.isAction(VERB_LOOK) || _action.isAction(VERB_PEER_THROUGH)) && (_action.isAction(0x8E) || _action.isAction(0xF9))) { _vm->_dialogs->show(10102); _action._inProgress = false; return; -- cgit v1.2.3 From 87418b66a007baf454d37d97857d13b186b6bb0a Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 20 May 2014 02:29:41 +0300 Subject: MADS: Replace several verbs with their friendly names --- engines/mads/nebular/nebular_scenes.h | 43 ++++++++++----- engines/mads/nebular/nebular_scenes1.cpp | 68 +++++++++++------------ engines/mads/nebular/nebular_scenes2.cpp | 10 ++-- engines/mads/nebular/nebular_scenes3.cpp | 94 ++++++++++++++++---------------- engines/mads/nebular/nebular_scenes4.cpp | 46 ++++++++-------- engines/mads/nebular/nebular_scenes5.cpp | 26 ++++----- engines/mads/nebular/nebular_scenes6.cpp | 30 +++++----- engines/mads/nebular/nebular_scenes7.cpp | 10 ++-- engines/mads/nebular/nebular_scenes8.cpp | 48 ++++++++-------- 9 files changed, 194 insertions(+), 181 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index ac983633cc..674e785a50 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -42,31 +42,44 @@ enum Verb { VERB_CAST = 0x03D, VERB_CLIMB_DOWN = 0x04E, VERB_CLIMB_UP = 0x050, - VERB_EAT = 0x075, - VERB_EXAMINE = 0x07D, - VERB_HOSE_DOWN = 0x0A6, - VERB_IGNITE = 0x0B4, - VERB_INFLATE = 0x0B5, - VERB_INSERT = 0x0B6, - VERB_INSPECT = 0x0B7, - VERB_HURL = 0x0A9, - VERB_LOOK_AT = 0x0D1, - VERB_LOOK_IN = 0x0D2, - VERB_LOOK_THROUGH = 0x0D3, - VERB_PEER_THROUGH = 0x103, + VERB_DIVE_INTO = 0x06D, + VERB_EAT = 0x075, + VERB_EXAMINE = 0x07D, + VERB_HOSE_DOWN = 0x0A6, + VERB_IGNITE = 0x0B4, + VERB_INFLATE = 0x0B5, + VERB_INSERT = 0x0B6, + VERB_INSPECT = 0x0B7, + VERB_HURL = 0x0A9, + VERB_LOOK_AT = 0x0D1, + VERB_LOOK_IN = 0x0D2, + VERB_LOOK_THROUGH = 0x0D3, + VERB_PEER_THROUGH = 0x103, + VERB_PLAY = 0x112, VERB_PRESS = 0x11A, - VERB_READ = 0x11F, + VERB_READ = 0x11F, VERB_SHOOT = 0x13A, VERB_SIT_IN = 0x13F, - VERB_SMELL = 0x147, + VERB_SMELL = 0x147, + VERB_STARE_AT = 0x155, + VERB_SWIM_INTO = 0x15A, + VERB_SWIM_THROUGH = 0x15B, + VERB_SWIM_TO = 0x15C, + VERB_SWIM_TOWARDS = 0x15D, + VERB_SWIM_UNDER = 0x15E, VERB_WALK_INSIDE = 0x188, VERB_WALK_THROUGH = 0x18B, VERB_WALK_TOWARDS = 0x18C, VERB_WALK_DOWN = 0x1AD, VERB_EXIT_FROM = 0x1CE, + VERB_EXIT = 0x298, VERB_CLIMB_INTO = 0x2F7, VERB_STEP_INTO = 0x2F9, - VERB_WALK_ALONG = 0x312 + VERB_SIT_ON = 0x30B, + VERB_WALK_ALONG = 0x312, + VERB_ENTER = 0x3B8, + VERB_INSTALL = 0x474, + VERB_REMOVE = 0x476 }; enum Noun { diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 025d5510bf..c2765ea4d2 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -481,7 +481,7 @@ void Scene101::actions() { return; } - if (_action.isAction(VERB_LOOK, 0xA8) || _action.isAction(VERB_LOOK, 0xF8) || _action.isAction(0x7D, 0xA8) || _action.isAction(0x7D, 0xF8)) { + if (_action.isAction(VERB_LOOK, 0xA8) || _action.isAction(VERB_LOOK, 0xF8) || _action.isAction(VERB_EXAMINE, 0xA8) || _action.isAction(VERB_EXAMINE, 0xF8)) { _vm->_dialogs->show(10103); _action._inProgress = false; return; @@ -493,7 +493,7 @@ void Scene101::actions() { return; } - if (_action.isAction(VERB_LOOK, 0xE1) || _action.isAction(0xD2, 0xE1)) { + if (_action.isAction(VERB_LOOK, 0xE1) || _action.isAction(VERB_LOOK_IN, 0xE1)) { _vm->_dialogs->show(10105); _action._inProgress = false; return; @@ -595,7 +595,7 @@ void Scene101::actions() { return; } - if ((_action.isAction(VERB_LOOK) || _action.isAction(0x112)) && _action.isAction(0x17E)) { + if ((_action.isAction(VERB_LOOK) || _action.isAction(VERB_PLAY)) && _action.isAction(0x17E)) { _vm->_dialogs->show(10124); _action._inProgress = false; return; @@ -875,7 +875,7 @@ void Scene102::actions() { return; } - if (_action.isAction(0x18B, 0x6E)) { + if (_action.isAction(VERB_WALK_THROUGH, 0x6E)) { switch (_game._trigger) { case 0: _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 6, 1, 0, 0); @@ -922,13 +922,13 @@ void Scene102::actions() { return; } - if (_action.isAction(0x155, 0x46) || _action.isAction(VERB_LOOK, 0x46)) { + if (_action.isAction(VERB_STARE_AT, 0x46) || _action.isAction(VERB_LOOK, 0x46)) { _vm->_dialogs->show(10203); _action._inProgress = false; return; } - if (_action.isAction(0x155, 0xFD) || _action.isAction(VERB_LOOK, 0xFD)) { + if (_action.isAction(VERB_STARE_AT, 0xFD) || _action.isAction(VERB_LOOK, 0xFD)) { _vm->_dialogs->show(10202); _action._inProgress = false; return; @@ -970,9 +970,9 @@ void Scene102::actions() { return; } - if ((_action.isObject(0xC7) || _action.isObject(0xA3)) && (_action.isAction(VERB_LOOK) || _action.isAction(0x50) || _action.isAction(0x4F))) { + if ((_action.isObject(0xC7) || _action.isObject(0xA3)) && (_action.isAction(VERB_LOOK) || _action.isAction(VERB_CLIMB_UP) || _action.isAction(0x4F))) { if (_game._objects.isInInventory(OBJ_REBREATHER)) { - if (!_action.isAction(0x50) && !_action.isAction(0x4F)) { + if (!_action.isAction(VERB_CLIMB_UP) && !_action.isAction(0x4F)) { _vm->_dialogs->show(10231); _action._inProgress = false; return; @@ -984,7 +984,7 @@ void Scene102::actions() { } } - if ((_action.isObject(0xC7) || _action.isObject(0xA3)) && (_action.isAction(0x50) || _action.isAction(0x4F)) ) { + if ((_action.isObject(0xC7) || _action.isObject(0xA3)) && (_action.isAction(VERB_CLIMB_UP) || _action.isAction(0x4F)) ) { switch (_game._trigger) { case 0: _scene->loadAnimation(formAnimName('A', -1), 1); @@ -1025,7 +1025,7 @@ void Scene102::actions() { return; } - if (_action.isAction(VERB_LOOK, 0x197) || _action.isAction(0xD3, 0x197)) { + if (_action.isAction(VERB_LOOK, 0x197) || _action.isAction(VERB_LOOK_THROUGH, 0x197)) { _vm->_dialogs->show(10227); _action._inProgress = false; return; @@ -1056,14 +1056,14 @@ void Scene102::actions() { return; } - if (_action.isAction(VERB_LOOK, 0x47) || (_action.isAction(0x13F, 0x47) && !_chairDescrFl)) { + if (_action.isAction(VERB_LOOK, 0x47) || (_action.isAction(VERB_SIT_IN, 0x47) && !_chairDescrFl)) { _chairDescrFl = true; _vm->_dialogs->show(10210); _action._inProgress = false; return; } - if (_action.isAction(0x13F, 0x47)) { + if (_action.isAction(VERB_SIT_IN, 0x47)) { _vm->_dialogs->show(10211); _action._inProgress = false; return; @@ -1716,10 +1716,10 @@ void Scene104::step() { } void Scene104::preActions() { - if (_action.isAction(0x15D, 0x74)) + if (_action.isAction(VERB_SWIM_TOWARDS, 0x74)) _game._player._walkOffScreenSceneId = 105; - if (_action.isAction(0x15D, 0x75)) + if (_action.isAction(VERB_SWIM_TOWARDS, 0x75)) _game._player._walkOffScreenSceneId = 106; } @@ -1843,10 +1843,10 @@ void Scene105::step() { } void Scene105::preActions() { - if (_action.isAction(0x15D, 0x195)) + if (_action.isAction(VERB_SWIM_TOWARDS, 0x195)) _game._player._walkOffScreenSceneId = 104; - if (_action.isAction(0x15D, 0xF5)) + if (_action.isAction(VERB_SWIM_TOWARDS, 0xF5)) _game._player._walkOffScreenSceneId = 107; if (_action.isAction(0xE0) && (_action.isAction(VERB_TALKTO) || _action.isAction(VERB_LOOK))) @@ -2052,20 +2052,20 @@ void Scene106::step() { } void Scene106::preActions() { - if (_action.isAction(0x15D, 0x12E) || _action.isAction(0x15D, 0x130)) { + if (_action.isAction(VERB_SWIM_TOWARDS, 0x12E) || _action.isAction(VERB_SWIM_TOWARDS, 0x130)) { _game._player._stepEnabled = false; _scene->_sprites[_game._player._spritesStart + 1]->_charInfo->_velocity = 24; _game._player._walkOffScreenSceneId = 104; } - if (_action.isAction(0x15D, 0xF3)) + if (_action.isAction(VERB_SWIM_TOWARDS, 0xF3)) _game._player._walkOffScreenSceneId = 107; } void Scene106::actions() { if (_action._lookFlag) _vm->_dialogs->show(10614); - else if (_action.isAction(0x15C, 0xD9)) { + else if (_action.isAction(VERB_SWIM_TO, 0xD9)) { _game._player._stepEnabled = false; _game._player._prepareWalkPos = Common::Point(95, 72); _game._player._prepareWalkFacing = FACING_WEST; @@ -2073,7 +2073,7 @@ void Scene106::actions() { _game._player._readyToWalk = true; _game._player._frameNumber = 9; _backToShipFl = true; - } else if (_action.isAction(VERB_LOOK, 0x13) || _action.isAction(0xD1, 0x13)) + } else if (_action.isAction(VERB_LOOK, 0x13) || _action.isAction(VERB_LOOK_AT, 0x13)) _vm->_dialogs->show(10601); else if (_action.isAction(VERB_TAKE, 0x13)) _vm->_dialogs->show(10602); @@ -2083,11 +2083,11 @@ void Scene106::actions() { _vm->_dialogs->show(10604); else if (_action.isAction(VERB_LOOK, 0xF3)) _vm->_dialogs->show(10605); - else if (_action.isAction(VERB_LOOK, 0x109) || _action.isAction(0xD1, 0x109)) + else if (_action.isAction(VERB_LOOK, 0x109) || _action.isAction(VERB_LOOK_AT, 0x109)) _vm->_dialogs->show(10606); else if (_action.isAction(0x109) && (_action.isAction(VERB_PUSH) || _action.isAction(VERB_PULL) || _action.isAction(VERB_TAKE))) _vm->_dialogs->show(10607); - else if (_action.isAction(VERB_LOOK, 0x139) || _action.isAction(0xD1, 0x139)) + else if (_action.isAction(VERB_LOOK, 0x139) || _action.isAction(VERB_LOOK_AT, 0x139)) _vm->_dialogs->show(10608); else if (_action.isAction(VERB_LOOK, 0xD9)) _vm->_dialogs->show(10609); @@ -2178,10 +2178,10 @@ void Scene107::step() { } void Scene107::preActions() { - if (_action.isAction(0x15D, 0xF6)) + if (_action.isAction(VERB_SWIM_TOWARDS, 0xF6)) _game._player._walkOffScreenSceneId = 106; - if (_action.isAction(0x15D, 0xF5)) + if (_action.isAction(VERB_SWIM_TOWARDS, 0xF5)) _game._player._walkOffScreenSceneId = 108; } @@ -2199,7 +2199,7 @@ void Scene107::actions() { _globals[kFishIn107] = false; _vm->_dialogs->showItem(OBJ_DEAD_FISH, 802); } - } else if (_action.isAction(0x15D, 0xEE)) + } else if (_action.isAction(VERB_SWIM_TOWARDS, 0xEE)) _scene->_nextSceneId = 105; else if (_action.isAction(VERB_LOOK, 0xEE)) _vm->_dialogs->show(10701); @@ -2273,7 +2273,7 @@ void Scene108::enter() { } void Scene108::preActions() { - if (_action.isAction(0x15E, 0xFB)) + if (_action.isAction(VERB_SWIM_UNDER, 0xFB)) _game._player._walkOffScreenSceneId = 109; } @@ -2291,7 +2291,7 @@ void Scene108::actions() { _globals[kFishIn108] = false; _vm->_dialogs->showItem(OBJ_DEAD_FISH, 10808); } - } else if (_action.isAction(0x15D, 0xF4)) + } else if (_action.isAction(VERB_SWIM_TOWARDS, 0xF4)) _scene->_nextSceneId = 107; else if (_action.isAction(VERB_LOOK, 0x4D)) _vm->_dialogs->show(10801); @@ -2485,7 +2485,7 @@ void Scene109::step() { } void Scene109::preActions() { - if (_action.isAction(0x15E, 0xFC)) + if (_action.isAction(VERB_SWIM_UNDER, 0xFC)) _game._player._walkOffScreenSceneId = 108; if ((_action.isAction(VERB_THROW) || _action.isAction(VERB_GIVE) || _action.isAction(VERB_PUT)) @@ -2500,7 +2500,7 @@ void Scene109::preActions() { } } - if ((_action.isAction(0x15A, 0x178) || _action.isAction(0x15C, 0x146)) + if ((_action.isAction(VERB_SWIM_INTO, 0x178) || _action.isAction(VERB_SWIM_TO, 0x146)) && (!_globals[kHoovicAlive] || _globals[kHoovicSated]) && (_action.isObject(0x178))) _game._player._walkOffScreenSceneId = 110; @@ -2789,7 +2789,7 @@ void Scene110::step() { } void Scene110::preActions() { - if (_action.isAction(0x15B, 0x41)) + if (_action.isAction(VERB_SWIM_THROUGH, 0x41)) _game._player._walkOffScreenSceneId = 109; if (_crabsFl) { @@ -2817,7 +2817,7 @@ void Scene110::preActions() { } void Scene110::actions() { - if (_action.isAction(0x15B, 0x178)) { + if (_action.isAction(VERB_SWIM_THROUGH, 0x178)) { switch (_game._trigger) { case 0: _scene->loadAnimation(Resources::formatName(110, 'T', 0, EXT_AA, ""), 1); @@ -2833,7 +2833,7 @@ void Scene110::actions() { } } else if ((_action._lookFlag) || _action.isAction(VERB_LOOK, 0x3F)) _vm->_dialogs->show(11001); - else if (_action.isAction(VERB_LOOK, 0x40) || _action.isAction(0xD1, 0x40)) + else if (_action.isAction(VERB_LOOK, 0x40) || _action.isAction(VERB_LOOK_AT, 0x40)) _vm->_dialogs->show(11002); else if (_action.isAction(VERB_LOOK, 0x129)) _vm->_dialogs->show(11003); @@ -2964,12 +2964,12 @@ void Scene111::step() { } void Scene111::preActions() { - if (_action.isAction(0x18B, 0x41)) + if (_action.isAction(VERB_WALK_THROUGH, 0x41)) _game._player._walkOffScreenSceneId = 212; } void Scene111::actions() { - if (_action.isAction(0x6D, 0x116) && _game._objects.isInInventory(OBJ_REBREATHER)) { + if (_action.isAction(VERB_DIVE_INTO, 0x116) && _game._objects.isInInventory(OBJ_REBREATHER)) { switch (_game._trigger) { case 0: _scene->loadAnimation(Resources::formatName(111, 'A', 1, EXT_AA, ""), 1); diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 47582cd8b6..cfb261c72b 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -712,7 +712,7 @@ void Scene202::preActions() { if (player._readyToWalk) _scene->_kernelMessages.reset(); - if (!_ladderTopFl && (_action.isAction(0x4E, NOUN_LADDER) || !player._readyToWalk)) { + if (!_ladderTopFl && (_action.isAction(VERB_CLIMB_DOWN, NOUN_LADDER) || !player._readyToWalk)) { if (_game._trigger == 0) { _vm->_sound->command(29); player._readyToWalk = false; @@ -930,7 +930,7 @@ void Scene202::actions() { return; } } - } else if (_action.isAction(0x188, 0xAA)) { + } else if (_action.isAction(VERB_WALK_INSIDE, 0xAA)) { setRandomKernelMessage(); } else if (_action.isAction(VERB_LOOK, NOUN_ROCKS)) { _vm->_dialogs->show(20202); @@ -1342,7 +1342,7 @@ void Scene205::actions() { _scene->_reloadSceneFlag = true; } } else { - if (_action.isAction(0x1AD, 0x1C7)) + if (_action.isAction(VERB_WALK_DOWN, 0x1C7)) _scene->_nextSceneId = 210; if (_action.isAction(VERB_WALKTO, 0x86) || _action.isAction(VERB_WALKTO, 0x1C2)) { @@ -4464,7 +4464,7 @@ void Scene210::actions() { _vm->_dialogs->show(21009); } else if (_action.isAction(VERB_LOOK, 0x1DC)) { _vm->_dialogs->show(21010); - } else if (_action.isAction(0x13A, 0x1DC) || _action.isAction(0xA6, 0x1DC)) { + } else if (_action.isAction(VERB_SHOOT, 0x1DC) || _action.isAction(VERB_HOSE_DOWN, 0x1DC)) { _vm->_dialogs->show(21011); } else if (_action.isAction(VERB_LOOK, 0x1BF)) { _vm->_dialogs->show(21012); @@ -5086,7 +5086,7 @@ void Scene214::actions() { _vm->_dialogs->show(21415); else if (_action.isAction(VERB_GIVE, 0x17A, 0x1C3)) _vm->_dialogs->show(21416); - else if (_action.isAction(0x13A, 0x29, 0x1C3) || _action.isAction(0xA6, 0x29, 0x1C3)) + else if (_action.isAction(VERB_SHOOT, 0x29, 0x1C3) || _action.isAction(VERB_HOSE_DOWN, 0x29, 0x1C3)) _vm->_dialogs->show(21417); else if (_action.isAction(VERB_LOOK, 0x473)) _vm->_dialogs->show(21418); diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 5337c99cb7..d0dd47759c 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -959,7 +959,7 @@ void Scene307::actions() { default: break; } - }else if (_action.isAction(0x2F7, 0x11)) { + }else if (_action.isAction(VERB_CLIMB_INTO, 0x11)) { if (_grateOpenedFl) { switch (_game._trigger) { case 0: @@ -1698,7 +1698,7 @@ void Scene311::actions() { _scene->_kernelMessages.addQuote(0xFA, 120, 0); } else if (_action.isAction(0x21F, 0x1E4)) _scene->_nextSceneId = 320; - else if (_action.isAction(0x2F7, 0x11)) { + else if (_action.isAction(VERB_CLIMB_INTO, 0x11)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -1794,13 +1794,13 @@ void Scene311::actions() { _vm->_dialogs->show(31110); else if (_action.isAction(VERB_LOOK, 0x18D)) _vm->_dialogs->show(31111); - else if (_action.isAction(VERB_LOOK, 0x220) || _action.isAction(0x155, 0x220)) + else if (_action.isAction(VERB_LOOK, 0x220) || _action.isAction(VERB_STARE_AT, 0x220)) _vm->_dialogs->show(31112); - else if (_action.isAction(VERB_LOOK, 0x208) || _action.isAction(0x155, 0x208)) + else if (_action.isAction(VERB_LOOK, 0x208) || _action.isAction(VERB_STARE_AT, 0x208)) _vm->_dialogs->show(31113); else if (_action.isAction(VERB_TAKE, 0x208)) _vm->_dialogs->show(31114); - else if (_action.isAction(VERB_LOOK, 0xCD) || _action.isAction(0x155, 0xCD)) + else if (_action.isAction(VERB_LOOK, 0xCD) || _action.isAction(VERB_STARE_AT, 0xCD)) _vm->_dialogs->show(31115); else if (_action.isAction(VERB_TAKE, 0xCD)) _vm->_dialogs->show(31116); @@ -2249,7 +2249,7 @@ void Scene316::step() { } void Scene316::preActions() { - if (_action.isAction(0x1AD, 0x2B9)) { + if (_action.isAction(VERB_WALK_DOWN, 0x2B9)) { if (_globals[kAfterHavoc]) _game._player._walkOffScreenSceneId = 354; else @@ -2258,7 +2258,7 @@ void Scene316::preActions() { } void Scene316::actions() { - if (_action.isAction(0x2F7, 0x11)) { + if (_action.isAction(VERB_CLIMB_INTO, 0x11)) { if (_globals[kSexOfRex] == REX_FEMALE) handleRoxInGrate(); else @@ -2740,7 +2740,7 @@ void Scene318::preActions() { if (_game._player._needToWalk) _game._player._needToWalk = _game._player._visible; - if (_action.isAction(0x1AD, 0x2BA)) + if (_action.isAction(VERB_WALK_DOWN, 0x2BA)) _game._player._walkOffScreenSceneId = 357; } @@ -2832,7 +2832,7 @@ void Scene318::actions() { } if (_game._player._visible) { - if (_action.isAction(0x1AD, 0x2B3)) { + if (_action.isAction(VERB_WALK_DOWN, 0x2B3)) { _scene->_nextSceneId = 407; _action._inProgress = false; return; @@ -3641,7 +3641,7 @@ void Scene320::step() { void Scene320::actions() { if (_action._lookFlag) _vm->_dialogs->show(32011); - else if ((_action.isAction(0x11A) || _action.isAction(VERB_PUSH)) && + else if ((_action.isAction(VERB_PRESS) || _action.isAction(VERB_PUSH)) && (_action.isAction(0x2E8) || _action.isAction(0x2E9) || _action.isAction(0x2EA) || _action.isAction(0x2EB) || _action.isAction(0x2DE) || _action.isAction(0x2DD) || _action.isAction(0x2E0) || _action.isAction(0x2E1) || _action.isAction(0x2E2) || _action.isAction(0x2E3) || _action.isAction(0x2E4) || _action.isAction(0x2E5) || @@ -3735,7 +3735,7 @@ void Scene320::actions() { _vm->_dialogs->show(32012); else if (_action.isAction(VERB_TAKE, 0x2F2)) _vm->_dialogs->show(32013); - else if (_action.isAction(VERB_TAKE, 0x2EE) || _action.isAction(0x75, 0x2EE)) + else if (_action.isAction(VERB_TAKE, 0x2EE) || _action.isAction(VERB_EAT, 0x2EE)) _vm->_dialogs->show(32014); else if (_action.isAction(VERB_TAKE, 0x2F3)) _vm->_dialogs->show(32015); @@ -3838,7 +3838,7 @@ void Scene322::actions() { return; } - if (_action.isAction(VERB_LOOK, 0x181) || _action.isAction(0x103, 0x181)) + if (_action.isAction(VERB_LOOK, 0x181) || _action.isAction(VERB_PEER_THROUGH, 0x181)) _vm->_dialogs->show(32210); else if (_action.isAction(VERB_LOOK, 0xC4)) _vm->_dialogs->show(32211); @@ -3954,9 +3954,9 @@ void Scene351::step() { void Scene351::actions() { if (_action._lookFlag) _vm->_dialogs->show(35121); - else if (_action.isAction(0x2F9, 0x16C)) + else if (_action.isAction(VERB_STEP_INTO, 0x16C)) _scene->_nextSceneId = 322; - else if (_action.isAction(0x1AD, 0x2B3)) + else if (_action.isAction(VERB_WALK_DOWN, 0x2B3)) _scene->_nextSceneId = 352; else if (_action.isAction(VERB_TAKE, 0x5C)) { if (_game._trigger || !_game._objects.isInInventory(0xF)) { @@ -4217,7 +4217,7 @@ void Scene352::preActions() { _game._player.walk(Common::Point(271, 111), FACING_NORTHEAST); } - if (_action.isAction(0x18B, 0x70) || _action.isAction(0x1AD, 0x2B3) || _action.isAction(VERB_PUT, 0x3B6, 0x89)) { + if (_action.isAction(VERB_WALK_THROUGH, 0x70) || _action.isAction(VERB_WALK_DOWN, 0x2B3) || _action.isAction(VERB_PUT, 0x3B6, 0x89)) { if (_game._objects.isInInventory(OBJ_GUARDS_ARM)) _game._player.walk(Common::Point(230, 117), FACING_NORTHWEST); } @@ -4288,15 +4288,15 @@ void Scene352::actions() { bool exit_corridor = false; bool exit_doorway = false; - if (_action.isAction(0x1AD, 0x2B3)) { + if (_action.isAction(VERB_WALK_DOWN, 0x2B3)) { exit_corridor = true; } - if (_action.isAction(0x18B, 0x70)) { + if (_action.isAction(VERB_WALK_THROUGH, 0x70)) { exit_doorway = true; } - if (_action.isAction(0x1AD, 0x2B3) || _action.isAction(0x18B, 0x70) || _action.isAction(VERB_PUT, 0x3B6, 0x89)) { + if (_action.isAction(VERB_WALK_DOWN, 0x2B3) || _action.isAction(VERB_WALK_THROUGH, 0x70) || _action.isAction(VERB_PUT, 0x3B6, 0x89)) { if (_mustPutArmDownFl) putArmDown(exit_corridor, exit_doorway); else if (exit_corridor) @@ -4598,9 +4598,9 @@ void Scene353::enter() { void Scene353::actions() { if (_action._lookFlag) _vm->_dialogs->show(35315); - else if (_action.isAction(0x18B, 0x70)) + else if (_action.isAction(VERB_WALK_THROUGH, 0x70)) _scene->_nextSceneId = 352; - else if (_action.isAction(0x1AD, 0x2B3)) + else if (_action.isAction(VERB_WALK_DOWN, 0x2B3)) _scene->_nextSceneId = 354; else if (_action.isAction(VERB_LOOK, 0x23D)) _vm->_dialogs->show(35310); @@ -4649,21 +4649,21 @@ void Scene354::enter() { } void Scene354::preActions() { - if (_action.isAction(0x1AD, 0x2B3)) + if (_action.isAction(VERB_WALK_DOWN, 0x2B3)) _game._player._walkOffScreenSceneId = 401; } void Scene354::actions() { if (_action._lookFlag) _vm->_dialogs->show(35414); - else if (_action.isAction(0x1AD, 0x2B4)) { + else if (_action.isAction(VERB_WALK_DOWN, 0x2B4)) { _game._player.startWalking(Common::Point(208, 0), FACING_NORTHEAST); _game._player._walkOffScreenSceneId = 353; - } else if (_action.isAction(0x1AD, 0x2B9)) + } else if (_action.isAction(VERB_WALK_DOWN, 0x2B9)) _scene->_nextSceneId = 361; - else if (_action.isAction(0x1AD, 0x2BA)) + else if (_action.isAction(VERB_WALK_DOWN, 0x2BA)) _scene->_nextSceneId = 316; - else if (_action.isAction(0x1AD, 0x2B3)) + else if (_action.isAction(VERB_WALK_DOWN, 0x2B3)) _scene->_nextSceneId = 401; else if (_action.isAction(VERB_LOOK, 0x2C6)) _vm->_dialogs->show(35410); @@ -4716,10 +4716,10 @@ void Scene357::enter() { } void Scene357::preActions() { - if (_action.isAction(0x1AD, 0x2B9)) + if (_action.isAction(VERB_WALK_DOWN, 0x2B9)) _game._player._walkOffScreenSceneId = 318; - if (_action.isAction(0x1AD, 0x2BA)) + if (_action.isAction(VERB_WALK_DOWN, 0x2BA)) _game._player._walkOffScreenSceneId = 358; } @@ -4728,7 +4728,7 @@ void Scene357::actions() { _vm->_dialogs->show(35715); else if (_action.isAction(VERB_LOOK, 0x11)) _vm->_dialogs->show(35710); - else if (_action.isAction(0x2F7, 0x11)) + else if (_action.isAction(VERB_CLIMB_INTO, 0x11)) _vm->_dialogs->show(35711); else if (_action.isAction(VERB_LOOK, 0x1CB)) _vm->_dialogs->show(35712); @@ -4780,10 +4780,10 @@ void Scene358::enter() { } void Scene358::preActions() { - if (_action.isAction(0x1AD, 0x2B9)) + if (_action.isAction(VERB_WALK_DOWN, 0x2B9)) _game._player._walkOffScreenSceneId = 357; - if (_action.isAction(0x1AD, 0x2BA)) + if (_action.isAction(VERB_WALK_DOWN, 0x2BA)) _game._player._walkOffScreenSceneId = 359; } @@ -4846,10 +4846,10 @@ void Scene359::enter() { } void Scene359::preActions() { - if (_action.isAction(0x1AD, 0x2B9)) + if (_action.isAction(VERB_WALK_DOWN, 0x2B9)) _game._player._walkOffScreenSceneId = 358; - if (_action.isAction(0x1AD, 0x2BA)) + if (_action.isAction(VERB_WALK_DOWN, 0x2BA)) _game._player._walkOffScreenSceneId = 360; } @@ -4976,10 +4976,10 @@ void Scene360::enter() { } void Scene360::preActions() { - if (_action.isAction(0x1AD, 0x2B9)) + if (_action.isAction(VERB_WALK_DOWN, 0x2B9)) _game._player._walkOffScreenSceneId = 359; - if (_action.isAction(0x1AD, 0x2BA)) + if (_action.isAction(VERB_WALK_DOWN, 0x2BA)) _game._player._walkOffScreenSceneId = 361; } @@ -5348,10 +5348,10 @@ void Scene361::step() { } void Scene361::preActions() { - if (_action.isAction(0x1AD, 0x2B9)) + if (_action.isAction(VERB_WALK_DOWN, 0x2B9)) _game._player._walkOffScreenSceneId = 360; - if (_action.isAction(0x1AD, 0x2BA)) + if (_action.isAction(VERB_WALK_DOWN, 0x2BA)) _game._player._walkOffScreenSceneId = 354; } @@ -5361,7 +5361,7 @@ void Scene361::actions() { else if (_action.isAction(0x21F, 0x1E4)) { _scene->_kernelMessages.reset(); _scene->_kernelMessages.addQuote(0xFC, 120, 0); - } else if (_action.isAction(0x2F7, 0x11)) { + } else if (_action.isAction(VERB_CLIMB_INTO, 0x11)) { if (_globals[kSexOfRex] == REX_FEMALE) handleRoxAction(); else @@ -5370,13 +5370,13 @@ void Scene361::actions() { _vm->_dialogs->show(36110); else if (_action.isAction(VERB_LOOK, 0x18D)) _vm->_dialogs->show(36111); - else if (_action.isAction(VERB_LOOK, 0x220) || _action.isAction(0x155, 0x220)) + else if (_action.isAction(VERB_LOOK, 0x220) || _action.isAction(VERB_STARE_AT, 0x220)) _vm->_dialogs->show(36112); - else if (_action.isAction(VERB_LOOK, 0x208) || _action.isAction(0x155, 0x208)) + else if (_action.isAction(VERB_LOOK, 0x208) || _action.isAction(VERB_STARE_AT, 0x208)) _vm->_dialogs->show(36113); else if (_action.isAction(VERB_TAKE, 0x208)) _vm->_dialogs->show(36114); - else if (_action.isAction(VERB_LOOK, 0x2F8) || _action.isAction(0x155, 0x2F8)) + else if (_action.isAction(VERB_LOOK, 0x2F8) || _action.isAction(VERB_STARE_AT, 0x2F8)) _vm->_dialogs->show(36115); else if (_action.isAction(VERB_TAKE, 0x2F8)) _vm->_dialogs->show(36116); @@ -5414,7 +5414,7 @@ void Scene366::actions() { else _vm->_dialogs->show(36613); _scene->_nextSceneId = 316; - } else if (_action.isAction(0xD3, 0x2D3)) { + } else if (_action.isAction(VERB_LOOK_THROUGH, 0x2D3)) { if (_game._visitedScenes.exists(321)) _vm->_dialogs->show(36611); else @@ -5443,7 +5443,7 @@ void Scene387::enter() { void Scene387::actions() { if (_action.isAction(0x2D5, 0x2D4)) _scene->_nextSceneId = 313; - else if (_action.isAction(0xD3, 0x2D3)) + else if (_action.isAction(VERB_LOOK_THROUGH, 0x2D3)) _vm->_dialogs->show(38710); else if (_action.isAction(VERB_OPEN, 0x2D3)) _vm->_dialogs->show(38711); @@ -5503,7 +5503,7 @@ void Scene388::actions() { default: break; } - } else if (_action.isAction(0xD3, 0x2D3)) { + } else if (_action.isAction(VERB_LOOK_THROUGH, 0x2D3)) { if (_globals[kAfterHavoc]) _vm->_dialogs->show(38811); else @@ -5576,7 +5576,7 @@ void Scene389::actions() { default: break; } - } else if (_action.isAction(0xD3, 0x2D3)) { + } else if (_action.isAction(VERB_LOOK_THROUGH, 0x2D3)) { if (_globals[kAfterHavoc]) { if ((_game._difficulty != DIFFICULTY_HARD) && (_game._objects[OBJ_SECURITY_CARD]._roomNumber == 359)) _vm->_dialogs->show(38911); @@ -5619,7 +5619,7 @@ void Scene390::enter() { void Scene390::actions() { if (_action.isAction(0x2D5, 0x2D4)) _scene->_nextSceneId = 313; - else if (_action.isAction(0xD3, 0x2D3)) + else if (_action.isAction(VERB_LOOK_THROUGH, 0x2D3)) _vm->_dialogs->show(39010); else if (_action.isAction(VERB_OPEN, 0x2D3)) _vm->_dialogs->show(39011); @@ -5657,7 +5657,7 @@ void Scene391::actions() { _scene->_nextSceneId = 361; else _scene->_nextSceneId = 311; - } else if (_action.isAction(0xD3, 0x2D3)) { + } else if (_action.isAction(VERB_LOOK_THROUGH, 0x2D3)) { if (_globals[kAfterHavoc]) _vm->_dialogs->show(39111); else @@ -5684,7 +5684,7 @@ void Scene399::enter() { void Scene399::actions() { if (_action.isAction(0x2D5, 0x2D4)) _scene->_nextSceneId = 313; - else if (_action.isAction(0xD3, 0x2D3)) { + else if (_action.isAction(VERB_LOOK_THROUGH, 0x2D3)) { if (_globals[kAfterHavoc]) { if ((_game._difficulty != DIFFICULTY_HARD) && (_game._objects[OBJ_SECURITY_CARD]._roomNumber == 359)) _vm->_dialogs->show(38911); diff --git a/engines/mads/nebular/nebular_scenes4.cpp b/engines/mads/nebular/nebular_scenes4.cpp index 79352fbb00..2053c47cf1 100644 --- a/engines/mads/nebular/nebular_scenes4.cpp +++ b/engines/mads/nebular/nebular_scenes4.cpp @@ -158,12 +158,12 @@ void Scene401::step() { } void Scene401::preActions() { - if (_action.isAction(0x1AD, 0x2B4)) { + if (_action.isAction(VERB_WALK_DOWN, 0x2B4)) { _game._player.walk(Common::Point(149, 89), FACING_NORTH); _northFl = false; } - if (_action.isAction(0x1AD, 0x2B3) && !_northFl) + if (_action.isAction(VERB_WALK_DOWN, 0x2B3) && !_northFl) _game._player._walkOffScreenSceneId = 405; if (_action.isAction(VERB_TAKE)) @@ -207,7 +207,7 @@ void Scene401::actions() { if (_action.isAction(0x242, 0x241)) { if (!_northFl) _scene->_nextSceneId = 402; - } else if (_action.isAction(0x1AD, 0x2B4)) + } else if (_action.isAction(VERB_WALK_DOWN, 0x2B4)) _scene->_nextSceneId = 354; else if (_action.isAction(VERB_LOOK, 0x1F3)) { if (_globals[kHasBeenScanned]) @@ -1977,7 +1977,7 @@ void Scene402::step() { } void Scene402::preActions() { - if (_action.isAction(0x30B, 0x24A) && (_game._player._prepareWalkPos.x != 248)) + if (_action.isAction(VERB_SIT_ON, 0x24A) && (_game._player._prepareWalkPos.x != 248)) _game._player.walk(Common::Point(232, 112), FACING_EAST); if (_action.isAction(VERB_WALKTO, 0x309)) @@ -2144,10 +2144,10 @@ void Scene402::actions() { _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _scene->_sequences.addTimer(120, 44); _game._player._stepEnabled = false; - } else if (_action.isAction(0x30B, 0x24A) && (_game._player._targetPos.x == 248)){ + } else if (_action.isAction(VERB_WALK_ALONG, 0x24A) && (_game._player._targetPos.x == 248)){ _scene->_kernelMessages.add(Common::Point(0, -14), 0x1110, 34, 0, 120, _game.getQuote(0x20D)); _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x20E)); - } else if (_action.isAction(0x30B, 0x24A) && !_roxOnStool && (_game._player._targetPos.x != 248)) { + } else if (_action.isAction(VERB_WALK_ALONG, 0x24A) && !_roxOnStool && (_game._player._targetPos.x != 248)) { _game._player._visible = false; _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 7, 1, 0, 0); @@ -2435,10 +2435,10 @@ void Scene405::preActions() { if (_action.isAction(VERB_TAKE)) _game._player._needToWalk = false; - if (_action.isAction(0x1AD, 0x2BA)) + if (_action.isAction(VERB_WALK_DOWN, 0x2BA)) _game._player._walkOffScreenSceneId = 401; - if (_action.isAction(0x1AD, 0x2B9)) + if (_action.isAction(VERB_WALK_DOWN, 0x2B9)) _game._player._walkOffScreenSceneId = 406; if (_action.isAction(VERB_CLOSE, 0x259) && _globals[kArmoryDoorOpen]) @@ -2446,11 +2446,11 @@ void Scene405::preActions() { } void Scene405::actions() { - if (_action.isAction(0x18B, 0x6E)) + if (_action.isAction(VERB_WALK_THROUGH, 0x6E)) _scene->_nextSceneId = 413; - else if (_action.isAction(0x18B, 0x259) && _globals[kArmoryDoorOpen]) + else if (_action.isAction(VERB_WALK_THROUGH, 0x259) && _globals[kArmoryDoorOpen]) _scene->_nextSceneId = 408; - else if (_action.isAction(0x18B, 0x259) && !_globals[kArmoryDoorOpen]) + else if (_action.isAction(VERB_WALK_THROUGH, 0x259) && !_globals[kArmoryDoorOpen]) _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 60, _game.getQuote(0x24F)); else if (_action.isAction(VERB_PUT, 0x131, 0x251) && !_globals[kArmoryDoorOpen]) { _game._player._stepEnabled = false; @@ -2621,10 +2621,10 @@ void Scene406::step() { } void Scene406::preActions() { - if (_action.isAction(0x1AD, 0x2BA)) + if (_action.isAction(VERB_WALK_DOWN, 0x2BA)) _game._player._walkOffScreenSceneId = 405; - if (_action.isAction(0x1AD, 0x2B9)) + if (_action.isAction(VERB_WALK_DOWN, 0x2B9)) _game._player._walkOffScreenSceneId = 407; if (_action.isAction(VERB_TAKE)) @@ -2635,16 +2635,16 @@ void Scene406::preActions() { } void Scene406::actions() { - if (_action.isAction(0x18B, 0x6E) && (_game._player._targetPos.x> 100)) { + if (_action.isAction(VERB_WALK_THROUGH, 0x6E) && (_game._player._targetPos.x> 100)) { _game._player._stepEnabled = false; _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _scene->_sequences.remove(_globals._sequenceIndexes[3]); _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 3, 1, 0, 0); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 80); _vm->_sound->command(19); - } else if (_action.isAction(0x18B, 0x6E) && _globals[kStorageDoorOpen] && (_game._player._targetPos.x < 100)) + } else if (_action.isAction(VERB_WALK_THROUGH, 0x6E) && _globals[kStorageDoorOpen] && (_game._player._targetPos.x < 100)) _scene->_nextSceneId = 410; - else if (_action.isAction(0x18B, 0x6E) && !_globals[kStorageDoorOpen] && (_game._player._targetPos.x < 100)) { + else if (_action.isAction(VERB_WALK_THROUGH, 0x6E) && !_globals[kStorageDoorOpen] && (_game._player._targetPos.x < 100)) { _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 60, _game.getQuote(0x24F)); if (!_hitStorageDoor) { _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; @@ -2774,7 +2774,7 @@ void Scene407::preActions() { if (_action.isAction(VERB_LOOK, 0x6E)) _game._player._needToWalk = true; - if (_action.isAction(0x1AD, 0x2B4)) { + if (_action.isAction(VERB_WALK_DOWN, 0x2B4)) { _game._player.walk(Common::Point(172, 91), FACING_NORTH); _fromNorth = false; } @@ -2813,9 +2813,9 @@ void Scene407::actions() { } } - if (_action.isAction(0x1AD, 0x2B3) && !_fromNorth) + if (_action.isAction(VERB_WALK_DOWN, 0x2B3) && !_fromNorth) _scene->_nextSceneId = 406; - else if (_action.isAction(0x1AD, 0x2B4)) + else if (_action.isAction(VERB_WALK_DOWN, 0x2B4)) _scene->_nextSceneId = 318; else if (_action.isAction(VERB_LOOK, 0x1F3)) { if (_globals[kHasBeenScanned]) @@ -3030,11 +3030,11 @@ void Scene409::actions() { if (_action.isAction(VERB_LOOK, 0x181)) _vm->_dialogs->show(40910); - else if (_action.isAction(0x103, 0x181)) + else if (_action.isAction(VERB_PEER_THROUGH, 0x181)) _vm->_dialogs->show(40910); else if (_action.isAction(VERB_LOOK, 0xC4)) _vm->_dialogs->show(40911); - else if (_action.isAction(0xB7, 0xC4)) + else if (_action.isAction(VERB_INSPECT, 0xC4)) _vm->_dialogs->show(40911); else if (_action.isAction(VERB_LOOK, 0x1CC)) _vm->_dialogs->show(40912); @@ -4086,11 +4086,11 @@ void Scene413::preActions() { } void Scene413::actions() { - if (_action.isAction(0x188, 0x16C)) { + if (_action.isAction(VERB_WALK_INSIDE, 0x16C)) { _game._player._stepEnabled = false; _game._player._visible = false; _scene->_nextSceneId = 409; - } else if (_action.isAction(0x188, 0x2B3)) + } else if (_action.isAction(VERB_WALK_INSIDE, 0x2B3)) _scene->_nextSceneId = 405; else if (_action.isAction(VERB_LOOK, 0x2C4)) _vm->_dialogs->show(41310); diff --git a/engines/mads/nebular/nebular_scenes5.cpp b/engines/mads/nebular/nebular_scenes5.cpp index c884170946..44363ec2ae 100644 --- a/engines/mads/nebular/nebular_scenes5.cpp +++ b/engines/mads/nebular/nebular_scenes5.cpp @@ -274,7 +274,7 @@ void Scene501::step() { } void Scene501::preActions() { - if (_action.isAction(0x1AD) && (_action.isAction(0x321) || _action.isAction(0x322))) + if (_action.isAction(VERB_WALK_DOWN) && (_action.isAction(0x321) || _action.isAction(0x322))) _game._player._walkOffScreenSceneId = 551; } @@ -430,7 +430,7 @@ void Scene501::actions() { else if (_action.isAction(VERB_LOOK, 0x322)) _vm->_dialogs->show(50118); else if (_action.isAction(VERB_LOOK, 0x361) || _action.isAction(VERB_LOOK, 0x360) - || _action.isAction(0x1AD, 0x361) || _action.isAction(0x1AD, 0x360)) + || _action.isAction(VERB_WALK_DOWN, 0x361) || _action.isAction(VERB_WALK_DOWN, 0x360)) _vm->_dialogs->show(50119); else if (_action.isAction(VERB_LOOK, 0x323)) _vm->_dialogs->show(50120); @@ -490,7 +490,7 @@ void Scene502::actions() { return; } - if (_action.isAction(VERB_LOOK, 0x181) || _action.isAction(0x103, 0x181)) + if (_action.isAction(VERB_LOOK, 0x181) || _action.isAction(VERB_PEER_THROUGH, 0x181)) _vm->_dialogs->show(50210); else if (_action.isAction(VERB_LOOK, 0xC4)) _vm->_dialogs->show(50211); @@ -742,7 +742,7 @@ void Scene504::preActions() { } void Scene504::actions() { - if (_action.isAction(0x1CE, 0x324)) { + if (_action.isAction(VERB_EXIT_FROM, 0x324)) { _vm->_sound->command(15); _scene->_nextSceneId = _globals[kHoverCarLocation]; } else if (_action.isAction(0xE, 0x380)) { @@ -815,7 +815,7 @@ void Scene504::actions() { _vm->_dialogs->show(50414); else if (_action.isAction(VERB_LOOK, 0x382)) _vm->_dialogs->show(50415); - else if (_action.isAction(VERB_LOOK, 0x386) || _action.isAction(0xD3, 0x386)) + else if (_action.isAction(VERB_LOOK, 0x386) || _action.isAction(VERB_LOOK_THROUGH, 0x386)) _vm->_dialogs->show(50416); else if (_action.isAction(VERB_LOOK, 0x120)) _vm->_dialogs->show(50417); @@ -1071,7 +1071,7 @@ void Scene505::step() { } void Scene505::actions() { - if (_action.isAction(0x11A)) + if (_action.isAction(VERB_PRESS)) _nextButtonId = _action._activeAction._objectNameId; else if (_action.isAction(0x2D5, 0x38C)) _scene->_nextSceneId = 504; @@ -1333,7 +1333,7 @@ void Scene506::actions() { _vm->_dialogs->show(50615); else if (_action.isAction(VERB_LOOK, 0x37D)) _vm->_dialogs->show(50616); - else if (_action.isAction(VERB_LOOK, 0x360) || _action.isAction(0x1AD, 0x360)) + else if (_action.isAction(VERB_LOOK, 0x360) || _action.isAction(VERB_WALK_DOWN, 0x360)) _vm->_dialogs->show(50617); else if (_action.isAction(VERB_LOOK, 0x373)) _vm->_dialogs->show(50619); @@ -1374,7 +1374,7 @@ void Scene507::enter() { sceneEntrySound(); } void Scene507::actions() { - if (_action.isAction(0x18B, 0x378)) + if (_action.isAction(VERB_WALK_THROUGH, 0x378)) _scene->_nextSceneId = 506; else if (_action.isAction(VERB_TAKE, 0x106)) { if (_game._trigger || !_game._objects.isInInventory(OBJ_PENLIGHT)) { @@ -1996,7 +1996,7 @@ void Scene511::actions() { _vm->_dialogs->show(51113); else if (_action.isAction(VERB_LOOK, 0x31D)) _vm->_dialogs->show(51114); - else if (_action.isAction(0x1AD, 0x322) || _action.isAction(0x1AD, 0x361) || _action.isAction(0x1AD, 0x321)) + else if (_action.isAction(VERB_WALK_DOWN, 0x322) || _action.isAction(VERB_WALK_DOWN, 0x361) || _action.isAction(VERB_WALK_DOWN, 0x321)) _vm->_dialogs->show(51115); else if (_action.isAction(VERB_LOOK, 0x37B)) _vm->_dialogs->show(51116); @@ -2286,7 +2286,7 @@ void Scene512::actions() { _vm->_dialogs->show(51218); else if (_action.isAction(VERB_TAKE, 0x354)) _vm->_dialogs->show(51219); - else if (_action.isAction(VERB_LOOK, 0x349) || _action.isAction(0x103, 0x349)) + else if (_action.isAction(VERB_LOOK, 0x349) || _action.isAction(VERB_PEER_THROUGH, 0x349)) _vm->_dialogs->show(51220); else if (_action.isAction(VERB_LOOK, 0x160)) _vm->_dialogs->show(51221); @@ -2539,7 +2539,7 @@ void Scene513::actions() { _vm->_dialogs->show(51315); else if (_action.isAction(VERB_LOOK, 0x244)) _vm->_dialogs->show(51316); - else if (_action.isAction(VERB_LOOK, 0x360) || _action.isAction(0x1AD, 0x360)) + else if (_action.isAction(VERB_LOOK, 0x360) || _action.isAction(VERB_WALK_DOWN, 0x360)) _vm->_dialogs->show(51317); else if (_action.isAction(VERB_OPEN, 0x367) || _action.isAction(VERB_OPEN, 0x317)) _vm->_dialogs->show(51319); @@ -2681,12 +2681,12 @@ void Scene551::step() { } void Scene551::preActions() { - if (_action.isAction(0x1AD) && (_action.isAction(0x360) || _action.isAction(0x361))) + if (_action.isAction(VERB_WALK_DOWN) && (_action.isAction(0x360) || _action.isAction(0x361))) _game._player._walkOffScreenSceneId = 501; } void Scene551::actions() { - if (_action.isAction(0x2F9, 0x16C)) + if (_action.isAction(VERB_STEP_INTO, 0x16C)) _scene->_nextSceneId = 502; else if ((_action._lookFlag)) _vm->_dialogs->show(55117); diff --git a/engines/mads/nebular/nebular_scenes6.cpp b/engines/mads/nebular/nebular_scenes6.cpp index 4cacfacbc8..0921cebe50 100644 --- a/engines/mads/nebular/nebular_scenes6.cpp +++ b/engines/mads/nebular/nebular_scenes6.cpp @@ -147,7 +147,7 @@ void Scene601::step() { } void Scene601::actions() { - if (_action.isAction(0x18B, 0x378)) + if (_action.isAction(VERB_WALK_THROUGH, 0x378)) _scene->_nextSceneId = 602; else if (_action.isAction(0x325, 0x324)) { switch (_game._trigger) { @@ -197,7 +197,7 @@ void Scene601::actions() { _vm->_dialogs->show(60113); else if (_action.isAction(VERB_LOOK, 0x323)) _vm->_dialogs->show(60114); - else if (_action.isAction(0x1AD, 0x31E)) + else if (_action.isAction(VERB_WALK_DOWN, 0x31E)) _vm->_dialogs->show(60115); else if (_action.isAction(VERB_LOOK, 0x48E)) _vm->_dialogs->show(60116); @@ -383,9 +383,9 @@ void Scene602::handleSafeActions() { } void Scene602::actions() { - if (_action.isAction(0x18B, 0x1F9)) + if (_action.isAction(VERB_WALK_THROUGH, 0x1F9)) _scene->_nextSceneId = 601; - else if (_action.isAction(0x18B, 0x70)) + else if (_action.isAction(VERB_WALK_THROUGH, 0x70)) _scene->_nextSceneId = 603; else if (_action.isAction(VERB_OPEN, 0x3D3) && ((_globals[kSafeStatus] == 0) || (_globals[kSafeStatus] == 2))) { _safeMode = 1; @@ -564,7 +564,7 @@ void Scene603::enter() { } void Scene603::actions() { - if (_action.isAction(0x18C, 0x3F1)) + if (_action.isAction(VERB_WALK_TOWARDS, 0x3F1)) _scene->_nextSceneId = 602; else if (_action.isAction(VERB_TAKE, 0x57)) { if ( _game._trigger || !_game._objects.isInInventory(OBJ_COMPACT_CASE)) { @@ -1296,7 +1296,7 @@ void Scene607::preActions() { if (_action.isAction(VERB_TALKTO, 0x471)) _game._player._needToWalk = false; - if (_action.isAction(0x18B, 0x478) && (_globals[kDogStatus] == 2) && (_game._difficulty != DIFFICULTY_EASY)) { + if (_action.isAction(VERB_WALK_THROUGH, 0x478) && (_globals[kDogStatus] == 2) && (_game._difficulty != DIFFICULTY_EASY)) { _shopAvailable = true; _dogTimer = 0; } @@ -1309,7 +1309,7 @@ void Scene607::preActions() { } void Scene607::actions() { - if (_action.isAction(0x18B, 0x478)) + if (_action.isAction(VERB_WALK_THROUGH, 0x478)) _scene->_nextSceneId = 608; else if (_action.isAction(0x325, 0x324)) { switch (_game._trigger) { @@ -1406,7 +1406,7 @@ void Scene607::actions() { _vm->_dialogs->show(60727); else if (_action.isAction(VERB_LOOK, 0x31F)) _vm->_dialogs->show(60728); - else if (_action.isAction(0x1AD, 0x31E)) + else if (_action.isAction(VERB_WALK_DOWN, 0x31E)) _vm->_dialogs->show(60730); else if (_action.isAction(0x3FF) && (_action.isAction(VERB_OPEN) || _action.isAction(VERB_PUSH) || _action.isAction(VERB_PULL))) _vm->_dialogs->show(60731); @@ -2091,7 +2091,7 @@ void Scene608::preActions() { } void Scene608::actions() { - if (_action.isAction(0x18B, 0x70)) + if (_action.isAction(VERB_WALK_THROUGH, 0x70)) _scene->_nextSceneId = 607; else if (_action.isAction(VERB_PUSH, 0x403)) { _game._player._stepEnabled = true; @@ -2586,9 +2586,9 @@ void Scene609::preActions() { } void Scene609::actions() { - if (_action.isAction(0x18C, 0x423)) + if (_action.isAction(VERB_WALK_TOWARDS, 0x423)) _scene->_nextSceneId = 611; - else if (_action.isAction(0x18B, 0x425)) { + else if (_action.isAction(VERB_WALK_THROUGH, 0x425)) { if (!_globals[kBeenInVideoStore]) { switch (_game._trigger) { case 0: @@ -2691,7 +2691,7 @@ void Scene609::actions() { _vm->_dialogs->show(60918); else _vm->_dialogs->show(60919); - } else if (_action.isAction(0x1AD, 0x31E)) + } else if (_action.isAction(VERB_WALK_DOWN, 0x31E)) _vm->_dialogs->show(60730); else return; @@ -2763,7 +2763,7 @@ void Scene610::step() { } void Scene610::actions() { - if (_action.isAction(0x1CE, 0x427)) + if (_action.isAction(VERB_EXIT_FROM, 0x427)) _scene->_nextSceneId = 609; else if (_action.isAction(VERB_TAKE, 0x108)) { if ( _game._trigger || !_game._objects.isInInventory(OBJ_PHONE_HANDSET)) { @@ -4130,7 +4130,7 @@ void Scene611::step() { } void Scene611::preActions() { - if (_action.isAction(0x1AD, 0x423)) + if (_action.isAction(VERB_WALK_DOWN, 0x423)) _game._player._walkOffScreenSceneId = 609; if (_resetBatterieText) @@ -4458,7 +4458,7 @@ void Scene612::actions() { _vm->_dialogs->show(61223); else if (_action.isAction(VERB_LOOK, 0x257)) _vm->_dialogs->show(61224); - else if (_action.isAction(0x1AD, 0x461) || _action.isAction(0x1AD, 0x463)) + else if (_action.isAction(VERB_WALK_DOWN, 0x461) || _action.isAction(VERB_WALK_DOWN, 0x463)) _vm->_dialogs->show(61225); else return; diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index 85c79e4877..07230ea33a 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -1850,7 +1850,7 @@ void Scene706::preActions() { } void Scene706::actions() { - if (_action.isAction(0x188, 0x16C)) { + if (_action.isAction(VERB_WALK_INSIDE, 0x16C)) { _game._player._stepEnabled = false; _game._player._visible = false; _scene->_nextSceneId = 707; @@ -1858,7 +1858,7 @@ void Scene706::actions() { return; } - if (_action.isAction(0x298, 0x2FA)) { + if (_action.isAction(VERB_EXIT, 0x2FA)) { _scene->_nextSceneId = 705; _action._inProgress = false; return; @@ -1970,7 +1970,7 @@ void Scene707::actions() { return; } - if (_action.isAction(VERB_LOOK, 0x181) || _action.isAction(0x103, 0x181)) + if (_action.isAction(VERB_LOOK, 0x181) || _action.isAction(VERB_PEER_THROUGH, 0x181)) _vm->_dialogs->show(70710); else if (_action.isAction(VERB_LOOK, 0xC4)) _vm->_dialogs->show(70711); @@ -2256,7 +2256,7 @@ void Scene751::preActions() { } void Scene751::actions() { - if (_action.isAction(0x312, 0x22C)) + if (_action.isAction(VERB_WALK_ALONG, 0x22C)) ; // Nothing else if (_action.isAction(VERB_LOOK, 0x27, 0x470)) { switch (_game._trigger) { @@ -2284,7 +2284,7 @@ void Scene751::actions() { default: break; } - } else if (_action.isAction(0x2F9, 0x317)) { + } else if (_action.isAction(VERB_STEP_INTO, 0x317)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index fee39a776e..6ecde8ae3d 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -249,7 +249,7 @@ void Scene801::preActions() { _game._player._readyToWalk = true; } - if (_action.isAction(0x188, 0x16C) && _globals[kBeamIsUp]) { + if (_action.isAction(VERB_WALK_INSIDE, 0x16C) && _globals[kBeamIsUp]) { _globals[kCutX] = _game._player._playerPos.x; _globals[kCutY] = _game._player._playerPos.y; _globals[kCutFacing] = _game._player._facing; @@ -262,11 +262,11 @@ void Scene801::preActions() { void Scene801::actions() { if (_action.isAction(VERB_LOOK, 0x59)) _scene->_nextSceneId = 808; - else if (_action.isAction(0x188, 0x16C)) { + else if (_action.isAction(VERB_WALK_INSIDE, 0x16C)) { _game._player._stepEnabled = false; _game._player._visible = false; _scene->_nextSceneId = 807; - } else if (_action.isAction(0x18B, 0x6E) && (_game._player._playerPos == Common::Point(270, 118))) { + } else if (_action.isAction(VERB_WALK_THROUGH, 0x6E) && (_game._player._playerPos == Common::Point(270, 118))) { _game._player._stepEnabled = false; _game._player._facing = FACING_EAST; _game._player.selectSeries(); @@ -391,10 +391,10 @@ void Scene802::step() { } void Scene802::preActions() { - if (_action.isAction(0x18C, 0x393)) + if (_action.isAction(VERB_WALK_TOWARDS, 0x393)) _game._player._walkOffScreenSceneId = 801; - if (_action.isAction(0x1AD, 0x1C1)) { + if (_action.isAction(VERB_WALK_DOWN, 0x1C1)) { _game._player._walkOffScreenSceneId = 803; _globals[kForceBeamDown] = false; } @@ -731,7 +731,7 @@ void Scene803::step() { } void Scene803::preActions() { - if (_action.isAction(0x1AD, 0x1AE)) + if (_action.isAction(VERB_WALK_DOWN, 0x1AE)) _game._player._walkOffScreenSceneId = 802; if (_action.isAction(VERB_TAKE, 0x139)) @@ -783,7 +783,7 @@ void Scene803::actions() { default: break; } - } else if (_action.isAction(0x3B8, 0x139)) { + } else if (_action.isAction(VERB_ENTER, 0x139)) { _vm->_sound->command(17); _game._player._stepEnabled = false; _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; @@ -1132,39 +1132,39 @@ void Scene805::preActions() { } void Scene805::actions() { - if (_action.isAction(0x298, 0x398)) + if (_action.isAction(VERB_EXIT, 0x398)) _scene->_nextSceneId = 804; - else if (_action.isAction(0x474, 0x137) && _game._objects.isInInventory(OBJ_SHIELD_MODULATOR)) { + else if (_action.isAction(VERB_INSTALL, 0x137) && _game._objects.isInInventory(OBJ_SHIELD_MODULATOR)) { _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 7, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], -1, -2); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 70); _game._player._stepEnabled = false; - } else if (_action.isAction(0x474, 0x167) && _game._objects.isInInventory(OBJ_TARGET_MODULE)) { + } else if (_action.isAction(VERB_INSTALL, 0x167) && _game._objects.isInInventory(OBJ_TARGET_MODULE)) { _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 7, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], -1, -2); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 80); _game._player._stepEnabled = false; - } else if (_action.isAction(0x476, 0x137) && _globals[kShieldModInstalled]) { + } else if (_action.isAction(VERB_REMOVE, 0x137) && _globals[kShieldModInstalled]) { _scene->_sequences.remove(_globals._sequenceIndexes[1]); _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _globals._sequenceIndexes[1] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 7, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], -1, -2); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 71); _game._player._stepEnabled = false; - } else if (_action.isAction(0x476, 0x167) && _globals[kTargetModInstalled]) { + } else if (_action.isAction(VERB_REMOVE, 0x167) && _globals[kTargetModInstalled]) { _scene->_sequences.remove(_globals._sequenceIndexes[2]); _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 7, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], -1, -2); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 81); _game._player._stepEnabled = false; - } else if (_action.isAction(0x474, 0x137) && !_game._objects.isInInventory(OBJ_SHIELD_MODULATOR)) + } else if (_action.isAction(VERB_INSTALL, 0x137) && !_game._objects.isInInventory(OBJ_SHIELD_MODULATOR)) _vm->_dialogs->show(80511); - else if (_action.isAction(0x474, 0x167) && !_game._objects.isInInventory(OBJ_TARGET_MODULE)) + else if (_action.isAction(VERB_INSTALL, 0x167) && !_game._objects.isInInventory(OBJ_TARGET_MODULE)) _vm->_dialogs->show(80510); - else if (_action.isAction(0x476, 0x475)) + else if (_action.isAction(VERB_REMOVE, 0x475)) _vm->_dialogs->show(80512); else return; @@ -1207,9 +1207,9 @@ void Scene807::actions() { if (_action.isAction(VERB_LOOK, 0x181)) _vm->_dialogs->show(80710); - else if (_action.isAction(0x103, 0x181)) + else if (_action.isAction(VERB_PEER_THROUGH, 0x181)) _vm->_dialogs->show(80710); - else if (_action.isAction(VERB_LOOK, 0xC4) && _action.isAction(0xB7, 0xC4)) + else if (_action.isAction(VERB_LOOK, 0xC4) && _action.isAction(VERB_INSPECT, 0xC4)) _vm->_dialogs->show(80711); else if (_action.isAction(VERB_LOOK, 0x1CC)) _vm->_dialogs->show(80712); @@ -1277,7 +1277,7 @@ void Scene808::enter() { } void Scene808::actions() { - if (_action.isAction(0x11A, 0x3BC)) { + if (_action.isAction(VERB_PRESS, 0x3BC)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -1313,7 +1313,7 @@ void Scene808::actions() { default: break; } - } else if (_action.isAction(0x11A, 0x3BE)) { + } else if (_action.isAction(VERB_PRESS, 0x3BE)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -1343,7 +1343,7 @@ void Scene808::actions() { default: break; } - } else if (_action.isAction(0x11A, 0x3BD)) { + } else if (_action.isAction(VERB_PRESS, 0x3BD)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -1374,7 +1374,7 @@ void Scene808::actions() { default: break; } - } else if (_action.isAction(0x11A, 0x3BF)) { + } else if (_action.isAction(VERB_PRESS, 0x3BF)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -1391,7 +1391,7 @@ void Scene808::actions() { default: break; } - } else if (_action.isAction(0x11A, 0x3BB)) { + } else if (_action.isAction(VERB_PRESS, 0x3BB)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -1408,7 +1408,7 @@ void Scene808::actions() { default: break; } - } else if (_action.isAction(0x11A, 0x3BA)) { + } else if (_action.isAction(VERB_PRESS, 0x3BA)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -1425,7 +1425,7 @@ void Scene808::actions() { default: break; } - } else if (_action.isAction(0x298, 0x1E0)) { + } else if (_action.isAction(VERB_EXIT, 0x1E0)) { _scene->_nextSceneId = 801; _globals[kBetweenRooms] = true; } else -- cgit v1.2.3 From 03add3cdd7e737d28596a96cdc7bf7857cc2ee77 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 20 May 2014 02:33:09 +0300 Subject: MADS: Replace more dialog IDs with their decimal values --- engines/mads/nebular/game_nebular.cpp | 78 +++++++++++++++++------------------ 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index 8be6068006..1afee51c66 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -577,29 +577,29 @@ void GameNebular::unhandledAction() { if (action.isAction(VERB_THROW, NOUN_BOMB) || action.isAction(VERB_THROW, NOUN_BOMBS) || action.isAction(VERB_THROW, NOUN_TIMEBOMB) || action.isAction(VERB_THROW, NOUN_CHICKEN_BOMB)) - _vm->_dialogs->show(0x2A); + _vm->_dialogs->show(42); else if (action.isAction(0x6C)) - _vm->_dialogs->show(0x1B3); + _vm->_dialogs->show(435); else if ((action.isAction(VERB_EAT, NOUN_DEAD_FISH) || action.isAction(VERB_EAT, NOUN_STUFFED_FISH)) && _vm->_game->_objects.isInInventory(_vm->_game->_objects.getIdFromDesc(action._activeAction._objectNameId))) - _vm->_dialogs->show(0xC); + _vm->_dialogs->show(12); else if ((action.isAction(VERB_SMELL, NOUN_DEAD_FISH) || action.isAction(VERB_SMELL, NOUN_STUFFED_FISH)) && _vm->_game->_objects.isInInventory(_vm->_game->_objects.getIdFromDesc(action._activeAction._objectNameId))) - _vm->_dialogs->show(0xD); + _vm->_dialogs->show(13); else if (action.isAction(VERB_EAT, NOUN_CHICKEN) && _vm->_game->_objects.isInInventory(OBJ_CHICKEN)) - _vm->_dialogs->show(0x390); + _vm->_dialogs->show(912); else if ((action.isAction(VERB_SHOOT) || action.isAction(VERB_HOSE_DOWN)) && action.isAction(NOUN_BLOWGUN)) { if ((_scene._currentSceneId >= 104) && (_scene._currentSceneId <= 111)) - _vm->_dialogs->show(0x26); + _vm->_dialogs->show(38); else if (action.isAction(0x10D)) - _vm->_dialogs->show(0x29); + _vm->_dialogs->show(41); else if (action.isAction(NOUN_CHICKEN) || action.isAction(0x185) || action.isAction(0x14D) || action.isAction(0x1DD) || action.isAction(0x15F) || action.isAction(NOUN_CAPTIVE_CREATURE)) { - _vm->_dialogs->show(0x28); + _vm->_dialogs->show(40); } else - _vm->_dialogs->show(0x27); + _vm->_dialogs->show(39); } else if (action.isAction(VERB_TALKTO)) { _globals[kTalkInanimateCount] = (_globals[kTalkInanimateCount] + 1) % 16; if (!_globals[kTalkInanimateCount]) { - _vm->_dialogs->show(0x2); + _vm->_dialogs->show(2); } else { Common::String tmpMsg = "\"Greetings, "; tmpMsg += _vm->_game->_scene.getVocab(action._activeAction._objectNameId); @@ -608,78 +608,78 @@ void GameNebular::unhandledAction() { _scene._kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, tmpMsg); } } else if (action.isAction(VERB_GIVE, NOUN_DOOR, 0x46) || action.isAction(VERB_CLOSE, NOUN_CHAIR)) - _vm->_dialogs->show(0x3); + _vm->_dialogs->show(3); else if (action.isAction(VERB_THROW)) { int objId = _vm->_game->_objects.getIdFromDesc(action._activeAction._objectNameId); if (objId < 0) - _vm->_dialogs->show(0x4); + _vm->_dialogs->show(4); else if (_vm->_game->_objects[objId]._roomNumber != 2) - _vm->_dialogs->show(0x5); + _vm->_dialogs->show(5); else - _vm->_dialogs->show(0x6); + _vm->_dialogs->show(6); } else if (action.isAction(VERB_LOOK)) { if (action.isAction(0x27) && (action._activeAction._indirectObjectId > 0)) - _vm->_dialogs->show(0xA); + _vm->_dialogs->show(10); else if (randVal < 600) - _vm->_dialogs->show(0x7); + _vm->_dialogs->show(7); else - _vm->_dialogs->show(0x15); + _vm->_dialogs->show(21); } else if (action.isAction(VERB_TAKE)) { int objId = _vm->_game->_objects.getIdFromDesc(action._activeAction._objectNameId); if (_vm->_game->_objects.isInInventory(objId)) - _vm->_dialogs->show(0x10); + _vm->_dialogs->show(16); else if (randVal <= 333) - _vm->_dialogs->show(0x8); + _vm->_dialogs->show(8); else if (randVal <= 666) - _vm->_dialogs->show(0x16); + _vm->_dialogs->show(22); else - _vm->_dialogs->show(0x17); + _vm->_dialogs->show(23); } else if (action.isAction(VERB_CLOSE)) { if (randVal <= 333) - _vm->_dialogs->show(0x9); + _vm->_dialogs->show(9); else - _vm->_dialogs->show(0x21); + _vm->_dialogs->show(33); } else if (action.isAction(VERB_OPEN)) { if (randVal <= 500) - _vm->_dialogs->show(0x1E); + _vm->_dialogs->show(30); else if (randVal <= 750) - _vm->_dialogs->show(0x1F); + _vm->_dialogs->show(31); else - _vm->_dialogs->show(0x20); + _vm->_dialogs->show(32); } else if (action.isAction(VERB_PULL)) - _vm->_dialogs->show(0x12); + _vm->_dialogs->show(18); else if (action.isAction(VERB_PUSH)) { if (randVal < 750) - _vm->_dialogs->show(0x13); + _vm->_dialogs->show(19); else - _vm->_dialogs->show(0x14); + _vm->_dialogs->show(20); } else if (action.isAction(VERB_PUT)) { int objId = _vm->_game->_objects.getIdFromDesc(action._activeAction._objectNameId); if (_vm->_game->_objects.isInInventory(objId)) - _vm->_dialogs->show(0x19); + _vm->_dialogs->show(25); else - _vm->_dialogs->show(0x18); + _vm->_dialogs->show(24); } else if (action.isAction(VERB_GIVE)) { int objId = _vm->_game->_objects.getIdFromDesc(action._activeAction._objectNameId); if (!_vm->_game->_objects.isInInventory(objId)) - _vm->_dialogs->show(0x1A); + _vm->_dialogs->show(26); else if (randVal <= 500) - _vm->_dialogs->show(0x1C); + _vm->_dialogs->show(28); else - _vm->_dialogs->show(0x1D); + _vm->_dialogs->show(29); } else if (!action.isAction(VERB_WALKTO) && !action.isAction(0x187) && !action.isAction(0x18C) && !action.isAction(0x1AD) && !action.isAction(0x15C) && !action.isAction(0x159) && !action.isAction(0x15A) && !action.isAction(0x15B) && !action.isAction(0x15E)) { if (randVal <= 100) - _vm->_dialogs->show(0x24); + _vm->_dialogs->show(36); else if (randVal <= 200) - _vm->_dialogs->show(0x1); + _vm->_dialogs->show(1); else if (randVal <= 475) - _vm->_dialogs->show(0x22); + _vm->_dialogs->show(34); else if (randVal <= 750) - _vm->_dialogs->show(0x23); + _vm->_dialogs->show(35); else - _vm->_dialogs->show(0x25); + _vm->_dialogs->show(37); } } -- cgit v1.2.3 From d3c5a88bfca98d4664dbbd7729811a94819169bc Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 20 May 2014 02:34:32 +0300 Subject: MADS: Fix some usages of isAction() with nouns --- engines/mads/nebular/game_nebular.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index 1afee51c66..51e06d092c 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -586,13 +586,13 @@ void GameNebular::unhandledAction() { _vm->_dialogs->show(13); else if (action.isAction(VERB_EAT, NOUN_CHICKEN) && _vm->_game->_objects.isInInventory(OBJ_CHICKEN)) _vm->_dialogs->show(912); - else if ((action.isAction(VERB_SHOOT) || action.isAction(VERB_HOSE_DOWN)) && action.isAction(NOUN_BLOWGUN)) { + else if ((action.isAction(VERB_SHOOT) || action.isAction(VERB_HOSE_DOWN)) && action.isObject(NOUN_BLOWGUN)) { if ((_scene._currentSceneId >= 104) && (_scene._currentSceneId <= 111)) _vm->_dialogs->show(38); else if (action.isAction(0x10D)) _vm->_dialogs->show(41); - else if (action.isAction(NOUN_CHICKEN) || action.isAction(0x185) || action.isAction(0x14D) - || action.isAction(0x1DD) || action.isAction(0x15F) || action.isAction(NOUN_CAPTIVE_CREATURE)) { + else if (action.isObject(NOUN_CHICKEN) || action.isAction(0x185) || action.isAction(0x14D) + || action.isAction(0x1DD) || action.isAction(0x15F) || action.isObject(NOUN_CAPTIVE_CREATURE)) { _vm->_dialogs->show(40); } else _vm->_dialogs->show(39); -- cgit v1.2.3 From 7f8c1e9a4855a812348807cd6b33412e4d93f138 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 20 May 2014 04:05:32 +0300 Subject: MADS: Replace more verbs with their friendly names --- engines/mads/nebular/nebular_scenes.h | 6 ++++++ engines/mads/nebular/nebular_scenes3.cpp | 6 +++--- engines/mads/nebular/nebular_scenes4.cpp | 12 ++++++------ engines/mads/nebular/nebular_scenes5.cpp | 26 +++++++++++++------------- engines/mads/nebular/nebular_scenes6.cpp | 10 +++++----- 5 files changed, 33 insertions(+), 27 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index 674e785a50..e385c6a54b 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -67,16 +67,22 @@ enum Verb { VERB_SWIM_TO = 0x15C, VERB_SWIM_TOWARDS = 0x15D, VERB_SWIM_UNDER = 0x15E, + VERB_UNLOCK = 0x17B, VERB_WALK_INSIDE = 0x188, VERB_WALK_THROUGH = 0x18B, VERB_WALK_TOWARDS = 0x18C, VERB_WALK_DOWN = 0x1AD, VERB_EXIT_FROM = 0x1CE, + VERB_WALK_UP = 0x227, + VERB_WALK_INTO = 0x242, VERB_EXIT = 0x298, + VERB_WALK_ONTO = 0x2B5, VERB_CLIMB_INTO = 0x2F7, VERB_STEP_INTO = 0x2F9, VERB_SIT_ON = 0x30B, VERB_WALK_ALONG = 0x312, + VERB_WALK = 0x32F, + VERB_GET_INTO = 0x36A, VERB_ENTER = 0x3B8, VERB_INSTALL = 0x474, VERB_REMOVE = 0x476 diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index d0dd47759c..b0085d572f 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -1111,7 +1111,7 @@ void Scene307::actions() { _vm->_dialogs->show(30717); else if (_action.isAction(VERB_LOOK, 0xCD)) _vm->_dialogs->show(30718); - else if (_action.isAction(0x242, 0x204)) { + else if (_action.isAction(VERB_WALK_INTO, 0x204)) { switch (_fieldCollisionCounter) { case 0: _vm->_dialogs->show(30719); @@ -2263,7 +2263,7 @@ void Scene316::actions() { handleRoxInGrate(); else handleRexInGrate(); - } else if (_action.isAction(0x227, 0x226) || _action.isAction(0x2B5, 0x22C)) { + } else if (_action.isAction(VERB_WALK_UP, 0x226) || _action.isAction(VERB_WALK_ONTO, 0x22C)) { switch (_game._trigger) { case 0: if (_globals[kCityFlooded]) { @@ -2859,7 +2859,7 @@ void Scene318::actions() { return; } - if (_action.isAction(0x242, 0x488)) { + if (_action.isAction(VERB_WALK_INTO, 0x488)) { _vm->_dialogs->show(31831); _action._inProgress = false; return; diff --git a/engines/mads/nebular/nebular_scenes4.cpp b/engines/mads/nebular/nebular_scenes4.cpp index 2053c47cf1..d8f3607f38 100644 --- a/engines/mads/nebular/nebular_scenes4.cpp +++ b/engines/mads/nebular/nebular_scenes4.cpp @@ -204,7 +204,7 @@ void Scene401::actions() { } } - if (_action.isAction(0x242, 0x241)) { + if (_action.isAction(VERB_WALK_INTO, 0x241)) { if (!_northFl) _scene->_nextSceneId = 402; } else if (_action.isAction(VERB_WALK_DOWN, 0x2B4)) @@ -2048,9 +2048,9 @@ void Scene402::actions() { _game._player._stepEnabled = true; } else if (_game._screenObjects._inputMode == 1) handleDialogs(); - else if (_action.isAction(0x242, 0x2B3)) + else if (_action.isAction(VERB_WALK_INTO, 0x2B3)) _scene->_nextSceneId = 401; - else if (_action.isAction(0x2B5, 0x248)) + else if (_action.isAction(VERB_WALK_ONTO, 0x248)) ; // just... nothing else if (_action.isAction(VERB_TALKTO, 0x3AA)) { switch (_game._trigger) { @@ -2878,7 +2878,7 @@ void Scene408::preActions() { } void Scene408::actions() { - if (_action.isAction(0x242, 0x2B3)) { + if (_action.isAction(VERB_WALK_INTO, 0x2B3)) { _scene->_nextSceneId = 405; _vm->_sound->command(58); } else if (_action.isAction(VERB_TAKE, 0x167) && (_game._objects.isInRoom(OBJ_TARGET_MODULE) || _game._trigger)) { @@ -3127,7 +3127,7 @@ void Scene410::preActions() { } void Scene410::actions() { - if (_action.isAction(0x242, 0x2B3)) + if (_action.isAction(VERB_WALK_INTO, 0x2B3)) _scene->_nextSceneId = 406; else if (_action.isAction(VERB_TAKE, 0x48) && (_game._objects.isInRoom(OBJ_CHARGE_CASES) || _game._trigger)) { switch (_game._trigger) { @@ -3704,7 +3704,7 @@ void Scene411::actions() { return; } - if (_action.isAction(0x242, 0x2B3)) { + if (_action.isAction(VERB_WALK_INTO, 0x2B3)) { _scene->_nextSceneId = 406; _vm->_sound->command(10); _action._inProgress = false; diff --git a/engines/mads/nebular/nebular_scenes5.cpp b/engines/mads/nebular/nebular_scenes5.cpp index 44363ec2ae..ef7ef89240 100644 --- a/engines/mads/nebular/nebular_scenes5.cpp +++ b/engines/mads/nebular/nebular_scenes5.cpp @@ -279,7 +279,7 @@ void Scene501::preActions() { } void Scene501::actions() { - if (_action.isAction(0x36A, 0x324)) { + if (_action.isAction(VERB_GET_INTO, 0x324)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -544,7 +544,7 @@ void Scene503::enter() { } void Scene503::actions() { - if (_action.isAction(0x32F, 0xF9)) + if (_action.isAction(VERB_WALK, 0xF9)) _scene->_nextSceneId = 501; else if (_action.isAction(VERB_TAKE, 0x6A)) { if ( _game._trigger || !_game._objects.isInInventory(OBJ_DETONATORS)) { @@ -626,7 +626,7 @@ void Scene503::actions() { _vm->_dialogs->show(50327); else if (_action.isAction(VERB_OPEN, 0x36D)) _vm->_dialogs->show(50329); - else if (_action.isAction(0xC, 0x36D) && _game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId))) + else if (_action.isAction(VERB_THROW, 0x36D) && _game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId))) _vm->_dialogs->show(50330); else return; @@ -1186,7 +1186,7 @@ void Scene506::room_506_door_sequences() { _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; if (_firstDoorFl) { - if (_action.isAction(0x242, 0x336) || ((_scene->_priorSceneId == 507) && !_actionFl)) { + if (_action.isAction(VERB_WALK_INTO, 0x336) || ((_scene->_priorSceneId == 507) && !_actionFl)) { _doorDepth = 13; _doorSpriteIdx = _globals._spriteIndexes[2]; _doorSequenceIdx = _globals._sequenceIndexes[2]; @@ -1266,21 +1266,21 @@ void Scene506::room_506_door_sequences() { } void Scene506::actions() { - if (_action.isAction(0x242, 0x37D)) { + if (_action.isAction(VERB_WALK_INTO, 0x37D)) { if (_firstDoorFl) { _heroFacing = FACING_NORTHWEST; _doorPos = Common::Point(16, 111); } _actionFl = true; room_506_door_sequences(); - } else if (_action.isAction(0x242, 0x336)) { + } else if (_action.isAction(VERB_WALK_INTO, 0x336)) { if (_firstDoorFl) { _heroFacing = FACING_NORTHWEST; _doorPos = Common::Point(80, 102); } _actionFl = true; room_506_door_sequences(); - } else if (_action.isAction(0x36A, 0x324)) { + } else if (_action.isAction(VERB_GET_INTO, 0x324)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -1528,7 +1528,7 @@ void Scene508::enter() { } void Scene508::preActions() { - if (_action.isAction(0x32F, 0xF9)) + if (_action.isAction(VERB_WALK, 0xF9)) _game._player._walkOffScreenSceneId = 506; } @@ -1882,9 +1882,9 @@ void Scene511::preActions() { } void Scene511::actions() { - if (_action.isAction(0x242, 0x372)) + if (_action.isAction(VERB_WALK_INTO, 0x372)) _scene->_nextSceneId = 512; - else if (_action.isAction(0x36A, 0x324)) { + else if (_action.isAction(VERB_GET_INTO, 0x324)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -2004,7 +2004,7 @@ void Scene511::actions() { _vm->_dialogs->show(51117); else if (_action.isAction(VERB_LOOK, 0x37C)) _vm->_dialogs->show(51118); - else if (_action.isAction(0x17B, 0xFF, 0x37C) || _action.isAction(0x17B, 0x6F, 0x37C)) + else if (_action.isAction(VERB_UNLOCK, 0xFF, 0x37C) || _action.isAction(VERB_UNLOCK, 0x6F, 0x37C)) _vm->_dialogs->show(51119); else if ( (_action.isAction(VERB_PUT) || _action.isAction(VERB_THROW)) && (_action.isAction(0x171) || _action.isAction(0x2A) || _action.isAction(0x2B)) @@ -2102,7 +2102,7 @@ void Scene512::enter() { } void Scene512::actions() { - if (_action.isAction(0x32F, 0xF9)) + if (_action.isAction(VERB_WALK, 0xF9)) _scene->_nextSceneId = 511; else if (_action.isAction(VERB_TAKE, 0x88)) { if (_game._trigger || !_game._objects.isInInventory(OBJ_FISHING_ROD)) { @@ -2436,7 +2436,7 @@ void Scene513::step() { } void Scene513::actions() { - if (_action.isAction(0x36A, 0x324)) { + if (_action.isAction(VERB_GET_INTO, 0x324)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; diff --git a/engines/mads/nebular/nebular_scenes6.cpp b/engines/mads/nebular/nebular_scenes6.cpp index 0921cebe50..519898472f 100644 --- a/engines/mads/nebular/nebular_scenes6.cpp +++ b/engines/mads/nebular/nebular_scenes6.cpp @@ -395,7 +395,7 @@ void Scene602::actions() { _safeMode = 2; _cycleIndex = -1; handleSafeActions(); - } else if (_action.isAction(0x17B, 0x3A7, 0x3D3)) { + } else if (_action.isAction(VERB_UNLOCK, 0x3A7, 0x3D3)) { if ((_globals[kSafeStatus] == 0) && (_game._difficulty != DIFFICULTY_HARD)) { _safeMode = 3; _cycleIndex = -2; @@ -506,7 +506,7 @@ void Scene602::actions() { _vm->_dialogs->show(60235); else _vm->_dialogs->show(60236); - } else if (_action.isAction(0x17B, 0x6F, 0x3D3) || _action.isAction(0x17B, 0xFF, 0x3D3)) + } else if (_action.isAction(VERB_UNLOCK, 0x6F, 0x3D3) || _action.isAction(VERB_UNLOCK, 0xFF, 0x3D3)) _vm->_dialogs->show(60225); else if (_action.isAction(VERB_PULL, 0x3D3)) _vm->_dialogs->show(60226); @@ -2581,7 +2581,7 @@ void Scene609::enterStore() { } void Scene609::preActions() { - if (_action.isAction(0x17B, 0x6F, 0x425)) + if (_action.isAction(VERB_UNLOCK, 0x6F, 0x425)) _game._player.walk(Common::Point(78, 99), FACING_NORTHWEST); } @@ -2629,7 +2629,7 @@ void Scene609::actions() { _videoDoorMode = 2; enterStore(); } - } else if (_action.isAction(0x17B, 0x6F, 0x425)) { + } else if (_action.isAction(VERB_UNLOCK, 0x6F, 0x425)) { _videoDoorMode = 1; enterStore(); } else if (_action.isAction(0x325, 0x324)) { @@ -4424,7 +4424,7 @@ void Scene612::actions() { default: break; } - } else if (_action.isAction(0x17B, 0xFF, 0x45F)) { + } else if (_action.isAction(VERB_UNLOCK, 0xFF, 0x45F)) { _cycleIndex = -2; action = 1; handleWinchMovement(); -- cgit v1.2.3 From 0d09060fa8a08000116fb3defb0c930eb30c6526 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 20 May 2014 04:50:35 +0300 Subject: MADS: Replace more verbs with friendly names and fix usages of isAction --- engines/mads/nebular/nebular_scenes.h | 12 +++++++- engines/mads/nebular/nebular_scenes1.cpp | 50 ++++++++++++++++---------------- engines/mads/nebular/nebular_scenes3.cpp | 46 ++++++++++++++--------------- engines/mads/nebular/nebular_scenes5.cpp | 12 ++++---- engines/mads/nebular/nebular_scenes6.cpp | 2 +- engines/mads/nebular/nebular_scenes7.cpp | 2 +- 6 files changed, 67 insertions(+), 57 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index e385c6a54b..75e00773cb 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -39,8 +39,10 @@ enum { }; enum Verb { + VERB_ACTIVATE = 0x00E, VERB_CAST = 0x03D, VERB_CLIMB_DOWN = 0x04E, + VERB_CLIMB_THROUGH = 0x04F, VERB_CLIMB_UP = 0x050, VERB_DIVE_INTO = 0x06D, VERB_EAT = 0x075, @@ -57,6 +59,7 @@ enum Verb { VERB_PEER_THROUGH = 0x103, VERB_PLAY = 0x112, VERB_PRESS = 0x11A, + VERB_PRY = 0x11C, VERB_READ = 0x11F, VERB_SHOOT = 0x13A, VERB_SIT_IN = 0x13F, @@ -72,16 +75,22 @@ enum Verb { VERB_WALK_THROUGH = 0x18B, VERB_WALK_TOWARDS = 0x18C, VERB_WALK_DOWN = 0x1AD, + VERB_LEAVE = 0x1CD, VERB_EXIT_FROM = 0x1CE, + VERB_USE = 0x20C, + VERB_SIT_AT = 0x21F, VERB_WALK_UP = 0x227, VERB_WALK_INTO = 0x242, VERB_EXIT = 0x298, VERB_WALK_ONTO = 0x2B5, + VERB_RETURN_TO = 0x2D5, VERB_CLIMB_INTO = 0x2F7, VERB_STEP_INTO = 0x2F9, + VERB_CRAWL_TO = 0x2FB, VERB_SIT_ON = 0x30B, VERB_WALK_ALONG = 0x312, VERB_WALK = 0x32F, + VERB_REFLECT = 0x365, VERB_GET_INTO = 0x36A, VERB_ENTER = 0x3B8, VERB_INSTALL = 0x474, @@ -103,6 +112,7 @@ enum Noun { NOUN_CONTROL_PANEL = 0x59, NOUN_DEAD_FISH = 0x65, NOUN_DOOR = 0x6E, + NOUN_DRAWER = 0x71, NOUN_ENTER_KEY = 0x7A, NOUN_FISHING_LINE = 0x87, NOUN_FISHING_ROD = 0x88, @@ -121,7 +131,7 @@ enum Noun { NOUN_OUTSIDE = 0x0F9, NOUN_PIRANHA = 0x10D, NOUN_PLANT_STALK = 0x10F, - NOUN_REFRIDGERATOR = 0x122, + NOUN_REFRIGERATOR = 0x122, NOUN_ROBO_KITCHEN = 0x127, NOUN_ROCK = 0x128, NOUN_ROCKS = 0x129, diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index c2765ea4d2..7c4af52760 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -475,7 +475,7 @@ void Scene101::actions() { return; } - if ((_action.isAction(VERB_LOOK) || _action.isAction(VERB_PEER_THROUGH)) && (_action.isAction(0x8E) || _action.isAction(0xF9))) { + if ((_action.isAction(VERB_LOOK) || _action.isAction(VERB_PEER_THROUGH)) && (_action.isObject(NOUN_FRONT_WINDOW) || _action.isObject(NOUN_OUTSIDE))) { _vm->_dialogs->show(10102); _action._inProgress = false; return; @@ -595,7 +595,7 @@ void Scene101::actions() { return; } - if ((_action.isAction(VERB_LOOK) || _action.isAction(VERB_PLAY)) && _action.isAction(0x17E)) { + if ((_action.isAction(VERB_LOOK) || _action.isAction(VERB_PLAY)) && _action.isObject(0x17E)) { _vm->_dialogs->show(10124); _action._inProgress = false; return; @@ -758,10 +758,10 @@ void Scene102::step() { } void Scene102::preActions() { - if (_action.isAction(0x122) || _action.isAction(0x117)) + if (_action.isObject(0x122) || _action.isObject(0x117)) _game._player._needToWalk = _game._player._readyToWalk; - if (_fridgeOpenedFl && !_action.isAction(0x122)) { + if (_fridgeOpenedFl && !_action.isObject(0x122)) { switch (_game._trigger) { case 0: if (_game._player._needToWalk) { @@ -798,7 +798,7 @@ void Scene102::actions() { return; } - if (_action.isObject(0x122) && !_fridgeOpenedFl) { + if (_action.isObject(NOUN_REFRIGERATOR) && !_fridgeOpenedFl) { switch (_game._trigger) { case 0: _globals._sequenceIndexes[7] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[7], false, 6, 1, 0, 0); @@ -838,7 +838,7 @@ void Scene102::actions() { } } - if (_action.isAction(VERB_LOOK, 0x122) || _action.isAction(VERB_OPEN, 0x122)) { + if (_action.isAction(VERB_LOOK, NOUN_REFRIGERATOR) || _action.isAction(VERB_OPEN, NOUN_REFRIGERATOR)) { if (_game._objects.isInRoom(OBJ_BURGER)) _vm->_dialogs->show(10230); else @@ -849,7 +849,7 @@ void Scene102::actions() { return; } - if (_action.isAction(VERB_WALKTO, 0x122) && justOpenedFl) { + if (_action.isAction(VERB_WALKTO, NOUN_REFRIGERATOR) && justOpenedFl) { _fridgeFirstOpenFl = false; int quoteId = _vm->getRandomNumber(59, 63); Common::String curQuote = _game.getQuote(quoteId); @@ -863,13 +863,13 @@ void Scene102::actions() { return; } - if (_action.isAction(VERB_CLOSE, 0x122)) { + if (_action.isAction(VERB_CLOSE, NOUN_REFRIGERATOR)) { _vm->_dialogs->show(10213); _action._inProgress = false; return; } - if (_action.isAction(VERB_TAKE, 0x122)) { + if (_action.isAction(VERB_TAKE, NOUN_REFRIGERATOR)) { _vm->_dialogs->show(8); _action._inProgress = false; return; @@ -934,31 +934,31 @@ void Scene102::actions() { return; } - if (_action.isAction(VERB_LOOK, 0x127)) { + if (_action.isAction(VERB_LOOK, NOUN_ROBO_KITCHEN)) { _vm->_dialogs->show(10215); _action._inProgress = false; return; } - if (_action.isAction(VERB_PUT, 0x35, 0x127) && _game._objects.isInInventory(OBJ_BURGER)) { + if (_action.isAction(VERB_PUT, NOUN_BURGER, NOUN_ROBO_KITCHEN) && _game._objects.isInInventory(OBJ_BURGER)) { _vm->_dialogs->show(10216); _action._inProgress = false; return; } - if (_action.isAction(VERB_PUT, 0x122) && _game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId))) { + if (_action.isAction(VERB_PUT, NOUN_REFRIGERATOR) && _game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId))) { _vm->_dialogs->show(10217); _action._inProgress = false; return; } - if (_action.isAction(VERB_PUT, 0x127) && (_action.isAction(0x65) || _action.isAction(0x157))) { + if (_action.isAction(VERB_PUT, NOUN_DEAD_FISH, NOUN_ROBO_KITCHEN) || _action.isAction(VERB_PUT, NOUN_STUFFED_FISH, NOUN_ROBO_KITCHEN)) { _vm->_dialogs->show(10230); _action._inProgress = false; return; } - if (_action.isAction(VERB_OPEN, 0x127)) { + if (_action.isAction(VERB_OPEN, NOUN_ROBO_KITCHEN)) { _vm->_dialogs->show(10218); _action._inProgress = false; return; @@ -970,9 +970,9 @@ void Scene102::actions() { return; } - if ((_action.isObject(0xC7) || _action.isObject(0xA3)) && (_action.isAction(VERB_LOOK) || _action.isAction(VERB_CLIMB_UP) || _action.isAction(0x4F))) { + if ((_action.isObject(NOUN_LADDER) || _action.isObject(0xA3)) && (_action.isAction(VERB_LOOK) || _action.isAction(VERB_CLIMB_UP) || _action.isAction(VERB_CLIMB_THROUGH))) { if (_game._objects.isInInventory(OBJ_REBREATHER)) { - if (!_action.isAction(VERB_CLIMB_UP) && !_action.isAction(0x4F)) { + if (!_action.isAction(VERB_CLIMB_UP) && !_action.isAction(VERB_CLIMB_THROUGH)) { _vm->_dialogs->show(10231); _action._inProgress = false; return; @@ -984,7 +984,7 @@ void Scene102::actions() { } } - if ((_action.isObject(0xC7) || _action.isObject(0xA3)) && (_action.isAction(VERB_CLIMB_UP) || _action.isAction(0x4F)) ) { + if ((_action.isObject(NOUN_LADDER) || _action.isObject(0xA3)) && (_action.isAction(VERB_CLIMB_UP) || _action.isAction(VERB_CLIMB_THROUGH)) ) { switch (_game._trigger) { case 0: _scene->loadAnimation(formAnimName('A', -1), 1); @@ -1037,20 +1037,20 @@ void Scene102::actions() { return; } - if (_action.isAction(VERB_LOOK, 0x71) || ((_action.isAction(VERB_CLOSE, 0x71) || _action.isAction(VERB_PUSH, 0x71)) && !_drawerDescrFl)) { + if (_action.isAction(VERB_LOOK, NOUN_DRAWER) || ((_action.isAction(VERB_CLOSE, NOUN_DRAWER) || _action.isAction(VERB_PUSH, NOUN_DRAWER)) && !_drawerDescrFl)) { _vm->_dialogs->show(10220); _drawerDescrFl = true; _action._inProgress = false; return; } - if (_action.isAction(VERB_CLOSE, 0x71) || _action.isAction(VERB_PUSH, 0x71)) { + if (_action.isAction(VERB_CLOSE, NOUN_DRAWER) || _action.isAction(VERB_PUSH, NOUN_DRAWER)) { _vm->_dialogs->show(10221); _action._inProgress = false; return; } - if (_action.isAction(VERB_OPEN, 0x71)) { + if (_action.isAction(VERB_OPEN, NOUN_DRAWER)) { _vm->_dialogs->show(10236); _action._inProgress = false; return; @@ -1177,7 +1177,7 @@ void Scene102::actions() { return; } - if ((_action.isAction(VERB_PUSH) || _action.isAction(VERB_PULL)) && _action.isAction(0x194)) { + if ((_action.isAction(VERB_PUSH) || _action.isAction(VERB_PULL)) && _action.isObject(0x194)) { _vm->_dialogs->show(10225); _action._inProgress = false; return; @@ -1849,7 +1849,7 @@ void Scene105::preActions() { if (_action.isAction(VERB_SWIM_TOWARDS, 0xF5)) _game._player._walkOffScreenSceneId = 107; - if (_action.isAction(0xE0) && (_action.isAction(VERB_TALKTO) || _action.isAction(VERB_LOOK))) + if (_action.isObject(0xE0) && (_action.isAction(VERB_TALKTO) || _action.isAction(VERB_LOOK))) _game._player._needToWalk = false; } @@ -2085,7 +2085,7 @@ void Scene106::actions() { _vm->_dialogs->show(10605); else if (_action.isAction(VERB_LOOK, 0x109) || _action.isAction(VERB_LOOK_AT, 0x109)) _vm->_dialogs->show(10606); - else if (_action.isAction(0x109) && (_action.isAction(VERB_PUSH) || _action.isAction(VERB_PULL) || _action.isAction(VERB_TAKE))) + else if (_action.isObject(0x109) && (_action.isAction(VERB_PUSH) || _action.isAction(VERB_PULL) || _action.isAction(VERB_TAKE))) _vm->_dialogs->show(10607); else if (_action.isAction(VERB_LOOK, 0x139) || _action.isAction(VERB_LOOK_AT, 0x139)) _vm->_dialogs->show(10608); @@ -2692,7 +2692,7 @@ void Scene109::actions() { _vm->_dialogs->show(10901); else if (_action.isAction(VERB_LOOK, 0x5A)) _vm->_dialogs->show(10902); - else if ((_action.isAction(VERB_TAKE) || _action.isAction(VERB_PULL)) && _action.isAction(0x5A)) + else if ((_action.isAction(VERB_TAKE) || _action.isAction(VERB_PULL)) && _action.isObject(0x5A)) _vm->_dialogs->show(10903); else if (_action.isAction(VERB_LOOK, 0x129)) _vm->_dialogs->show(10904); @@ -2992,7 +2992,7 @@ void Scene111::actions() { _vm->_dialogs->show(11104); else if (_action.isAction(VERB_LOOK, 0xC8)) _vm->_dialogs->show(11105); - else if ((_action.isAction(VERB_PULL) || _action.isAction(VERB_TAKE)) && (_action.isAction(0x153) || _action.isAction(0xC8))) + else if ((_action.isAction(VERB_PULL) || _action.isAction(VERB_TAKE)) && (_action.isObject(0x153) || _action.isObject(0xC8))) _vm->_dialogs->show(11106); else return; diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index b0085d572f..00de84eea8 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -884,7 +884,7 @@ void Scene307::actions() { setDialogNode(node); break; } - } else if (_action.isAction(0x11C, 0x12C, 0x11)) { + } else if (_action.isAction(VERB_PRY, 0x12C, 0x11)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -1042,9 +1042,9 @@ void Scene307::actions() { break; } } - } else if (_action.isAction(0x20C, 0x21B) && (_game._storyMode != STORYMODE_NAUGHTY)) + } else if (_action.isAction(VERB_USE, 0x21B) && (_game._storyMode != STORYMODE_NAUGHTY)) _vm->_dialogs->show(30723); - else if (_action.isAction(0x20C, 0x21B)) { + else if (_action.isAction(VERB_USE, 0x21B)) { if (!_afterPeeingFl) { switch (_game._trigger) { case 0: @@ -1696,7 +1696,7 @@ void Scene311::actions() { _checkGuardFl = false; _scene->_kernelMessages.reset(); _scene->_kernelMessages.addQuote(0xFA, 120, 0); - } else if (_action.isAction(0x21F, 0x1E4)) + } else if (_action.isAction(VERB_SIT_AT, 0x1E4)) _scene->_nextSceneId = 320; else if (_action.isAction(VERB_CLIMB_INTO, 0x11)) { switch (_game._trigger) { @@ -1866,24 +1866,24 @@ void Scene313::enter() { } void Scene313::actions() { - if (_action.isAction(0x2FB, 0x2FC)) + if (_action.isAction(VERB_CRAWL_TO, 0x2FC)) _scene->_nextSceneId = 387; - else if (_action.isAction(0x2FB, 0x2FD)) + else if (_action.isAction(VERB_CRAWL_TO, 0x2FD)) _scene->_nextSceneId = 388; - else if (_action.isAction(0x2FB, 0x2FE)) { + else if (_action.isAction(VERB_CRAWL_TO, 0x2FE)) { if (_globals[kAfterHavoc]) _scene->_nextSceneId = 399; else _scene->_nextSceneId = 389; - } else if (_action.isAction(0x2FB, 0x2FF)) + } else if (_action.isAction(VERB_CRAWL_TO, 0x2FF)) _scene->_nextSceneId = 390; - else if (_action.isAction(0x2FB, 0x2EF)) { + else if (_action.isAction(VERB_CRAWL_TO, 0x2EF)) { if (_globals[kSexOfRex] == REX_FEMALE) { _globals[kSexOfRex] = REX_MALE; _vm->_dialogs->show(31301); } _scene->_nextSceneId = 391; - } else if (_action.isAction(0x2FB, 0x300)) { + } else if (_action.isAction(VERB_CRAWL_TO, 0x300)) { if (_globals[kSexOfRex] == REX_FEMALE) { _globals[kSexOfRex] = REX_MALE; _vm->_dialogs->show(31301); @@ -3642,10 +3642,10 @@ void Scene320::actions() { if (_action._lookFlag) _vm->_dialogs->show(32011); else if ((_action.isAction(VERB_PRESS) || _action.isAction(VERB_PUSH)) && - (_action.isAction(0x2E8) || _action.isAction(0x2E9) || _action.isAction(0x2EA) || _action.isAction(0x2EB) || - _action.isAction(0x2DE) || _action.isAction(0x2DD) || _action.isAction(0x2E0) || _action.isAction(0x2E1) || - _action.isAction(0x2E2) || _action.isAction(0x2E3) || _action.isAction(0x2E4) || _action.isAction(0x2E5) || - _action.isAction(0x2E6) || _action.isAction(0x2E7) + (_action.isObject(0x2E8) || _action.isObject(0x2E9) || _action.isObject(0x2EA) || _action.isObject(0x2EB) || + _action.isObject(0x2DE) || _action.isObject(0x2DD) || _action.isObject(0x2E0) || _action.isObject(0x2E1) || + _action.isObject(0x2E2) || _action.isObject(0x2E3) || _action.isObject(0x2E4) || _action.isObject(0x2E5) || + _action.isObject(0x2E6) || _action.isObject(0x2E7) )) { switch (_game._trigger) { case 0: @@ -3709,7 +3709,7 @@ void Scene320::actions() { default: break; } - } else if (_action.isAction(0x1CD, 0x2EF)) + } else if (_action.isAction(VERB_LEAVE, 0x2EF)) _scene->_nextSceneId = 311; else if (_action.isAction(VERB_LOOK, 0x2DC)) _vm->_dialogs->show(32001); @@ -5358,7 +5358,7 @@ void Scene361::preActions() { void Scene361::actions() { if (_action._lookFlag) _vm->_dialogs->show(36119); - else if (_action.isAction(0x21F, 0x1E4)) { + else if (_action.isAction(VERB_SIT_AT, 0x1E4)) { _scene->_kernelMessages.reset(); _scene->_kernelMessages.addQuote(0xFC, 120, 0); } else if (_action.isAction(VERB_CLIMB_INTO, 0x11)) { @@ -5406,7 +5406,7 @@ void Scene366::enter() { } void Scene366::actions() { - if (_action.isAction(0x2D5, 0x2D4)) + if (_action.isAction(VERB_RETURN_TO, 0x2D4)) _scene->_nextSceneId = 302; else if (_action.isAction(VERB_OPEN, 0x2D3)) { if (_game._visitedScenes.exists(316)) @@ -5441,7 +5441,7 @@ void Scene387::enter() { } void Scene387::actions() { - if (_action.isAction(0x2D5, 0x2D4)) + if (_action.isAction(VERB_RETURN_TO, 0x2D4)) _scene->_nextSceneId = 313; else if (_action.isAction(VERB_LOOK_THROUGH, 0x2D3)) _vm->_dialogs->show(38710); @@ -5479,7 +5479,7 @@ void Scene388::enter() { } void Scene388::actions() { - if (_action.isAction(0x2D5, 0x2D4)) + if (_action.isAction(VERB_RETURN_TO, 0x2D4)) _scene->_nextSceneId = 313; else if (_action.isAction(VERB_TALKTO, 0x303)) { switch (_game._trigger) { @@ -5556,7 +5556,7 @@ void Scene389::step() { } void Scene389::actions() { - if (_action.isAction(0x2D5, 0x2D4)) + if (_action.isAction(VERB_RETURN_TO, 0x2D4)) _scene->_nextSceneId = 313; else if (_action.isAction(VERB_TALKTO, 0x304)) { switch (_game._trigger) { @@ -5617,7 +5617,7 @@ void Scene390::enter() { } void Scene390::actions() { - if (_action.isAction(0x2D5, 0x2D4)) + if (_action.isAction(VERB_RETURN_TO, 0x2D4)) _scene->_nextSceneId = 313; else if (_action.isAction(VERB_LOOK_THROUGH, 0x2D3)) _vm->_dialogs->show(39010); @@ -5643,7 +5643,7 @@ void Scene391::enter() { } void Scene391::actions() { - if (_action.isAction(0x2D5, 0x2D4)) + if (_action.isAction(VERB_RETURN_TO, 0x2D4)) _scene->_nextSceneId = 313; else if (_action.isAction(VERB_OPEN, 0x2D3)) { if (_globals[kKickedIn391Grate]) @@ -5682,7 +5682,7 @@ void Scene399::enter() { } void Scene399::actions() { - if (_action.isAction(0x2D5, 0x2D4)) + if (_action.isAction(VERB_RETURN_TO, 0x2D4)) _scene->_nextSceneId = 313; else if (_action.isAction(VERB_LOOK_THROUGH, 0x2D3)) { if (_globals[kAfterHavoc]) { diff --git a/engines/mads/nebular/nebular_scenes5.cpp b/engines/mads/nebular/nebular_scenes5.cpp index ef7ef89240..ef50e1289e 100644 --- a/engines/mads/nebular/nebular_scenes5.cpp +++ b/engines/mads/nebular/nebular_scenes5.cpp @@ -274,7 +274,7 @@ void Scene501::step() { } void Scene501::preActions() { - if (_action.isAction(VERB_WALK_DOWN) && (_action.isAction(0x321) || _action.isAction(0x322))) + if (_action.isAction(VERB_WALK_DOWN) && (_action.isObject(0x321) || _action.isObject(0x322))) _game._player._walkOffScreenSceneId = 551; } @@ -745,7 +745,7 @@ void Scene504::actions() { if (_action.isAction(VERB_EXIT_FROM, 0x324)) { _vm->_sound->command(15); _scene->_nextSceneId = _globals[kHoverCarLocation]; - } else if (_action.isAction(0xE, 0x380)) { + } else if (_action.isAction(VERB_ACTIVATE, 0x380)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -1073,7 +1073,7 @@ void Scene505::step() { void Scene505::actions() { if (_action.isAction(VERB_PRESS)) _nextButtonId = _action._activeAction._objectNameId; - else if (_action.isAction(0x2D5, 0x38C)) + else if (_action.isAction(VERB_RETURN_TO, 0x38C)) _scene->_nextSceneId = 504; else if (_action.isAction(VERB_LOOK, 0x180)) _vm->_dialogs->show(50510); @@ -1651,10 +1651,10 @@ void Scene508::actions() { } else { _vm->_dialogs->show(50837); } - } else if (_action.isAction(0x365, 0x120, 0x343) || _action.isAction(VERB_PUT, 0x120, 0x344) || _action.isAction(VERB_PUT, 0x120, 0x343)) { + } else if (_action.isAction(VERB_REFLECT, 0x120, 0x343) || _action.isAction(VERB_PUT, 0x120, 0x344) || _action.isAction(VERB_PUT, 0x120, 0x343)) { _chosenObject = 1; handlePedestral(); - } else if (_action.isAction(VERB_PUT, 0x57, 0x344) || _action.isAction(VERB_PUT, 0x57, 0x343) || _action.isAction(0x365, 0x57, 0x343)) { + } else if (_action.isAction(VERB_PUT, 0x57, 0x344) || _action.isAction(VERB_PUT, 0x57, 0x343) || _action.isAction(VERB_REFLECT, 0x57, 0x343)) { _chosenObject = 2; handlePedestral(); } else if (_action._lookFlag) @@ -2681,7 +2681,7 @@ void Scene551::step() { } void Scene551::preActions() { - if (_action.isAction(VERB_WALK_DOWN) && (_action.isAction(0x360) || _action.isAction(0x361))) + if (_action.isAction(VERB_WALK_DOWN) && (_action.isObject(0x360) || _action.isObject(0x361))) _game._player._walkOffScreenSceneId = 501; } diff --git a/engines/mads/nebular/nebular_scenes6.cpp b/engines/mads/nebular/nebular_scenes6.cpp index 519898472f..a8f9ac159c 100644 --- a/engines/mads/nebular/nebular_scenes6.cpp +++ b/engines/mads/nebular/nebular_scenes6.cpp @@ -402,7 +402,7 @@ void Scene602::actions() { handleSafeActions(); } } else if ((_action.isAction(VERB_PUT, 0x120, 0x343) || _action.isAction(VERB_PUT, 0x57, 0x343) - || _action.isAction(0x365, 0x57, 0x343) || _action.isAction(0x365, 0x120, 0x343)) && (_globals[kSafeStatus] == 0)) { + || _action.isAction(VERB_REFLECT, 0x57, 0x343) || _action.isAction(VERB_REFLECT, 0x120, 0x343)) && (_globals[kSafeStatus] == 0)) { switch (_game._trigger) { case 0: _vm->_dialogs->show(60230); diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index 07230ea33a..2d85b2e784 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -1625,7 +1625,7 @@ void Scene705::actions() { default: break; } - } else if (_action.isAction(0x4F, 0x197)) { + } else if (_action.isAction(VERB_CLIMB_THROUGH, 0x197)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; -- cgit v1.2.3 From e409f4dedd989b49184a865f59dc152e85303489 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 20 May 2014 05:43:49 +0300 Subject: MADS: Add debugger commands for the game vocab --- engines/mads/debugger.cpp | 42 ++++++++++++++++++++++++++++++++++++++++++ engines/mads/debugger.h | 2 ++ engines/mads/scene.cpp | 4 ++++ engines/mads/scene.h | 5 +++++ 4 files changed, 53 insertions(+) diff --git a/engines/mads/debugger.cpp b/engines/mads/debugger.cpp index e3ddf02a5a..8baafddc69 100644 --- a/engines/mads/debugger.cpp +++ b/engines/mads/debugger.cpp @@ -39,6 +39,8 @@ Debugger::Debugger(MADSEngine *vm) : GUI::Debugger(), _vm(vm) { DCmd_Register("show_codes", WRAP_METHOD(Debugger, Cmd_ShowCodes)); DCmd_Register("dump_file", WRAP_METHOD(Debugger, Cmd_DumpFile)); DCmd_Register("show_quote", WRAP_METHOD(Debugger, Cmd_ShowQuote)); + DCmd_Register("show_vocab", WRAP_METHOD(Debugger, Cmd_ShowVocab)); + DCmd_Register("dump_vocab", WRAP_METHOD(Debugger, Cmd_DumpVocab)); DCmd_Register("item", WRAP_METHOD(Debugger, Cmd_Item)); } @@ -200,6 +202,46 @@ bool Debugger::Cmd_ShowQuote(int argc, const char **argv) { return true; } +bool Debugger::Cmd_ShowVocab(int argc, const char **argv) { + if (argc != 2) { + for (uint32 i = 0; i < _vm->_game->_scene.getVocabStringsCount(); i++) { + DebugPrintf("%03d: '%s'\n", i, _vm->_game->_scene.getVocab(i + 1).c_str()); + } + } else { + int vocabId = strToInt(argv[1]); + DebugPrintf("%03d: '%s'\n", vocabId, _vm->_game->_scene.getVocab(vocabId + 1).c_str()); + } + + return true; +} + +bool Debugger::Cmd_DumpVocab(int argc, const char **argv) { + Common::DumpFile outFile; + outFile.open("vocab.txt"); + + for (uint32 i = 0; i < _vm->_game->_scene.getVocabStringsCount(); i++) { + Common::String curId = Common::String::format("%x", i + 1); + Common::String curVocab = _vm->_game->_scene.getVocab(i + 1); + curVocab.toUppercase(); + + for (uint j = 0; j < curVocab.size(); j++) { + if (curVocab[j] == ' ' || curVocab[j] == '-') + curVocab.setChar('_', j); + } + + Common::String cur = "\tNOUN_" + curVocab + " = 0x" + curId + ",\n"; + + outFile.writeString(cur.c_str()); + } + + outFile.flush(); + outFile.close(); + + DebugPrintf("Game vocab dumped\n"); + + return true; +} + bool Debugger::Cmd_Item(int argc, const char **argv) { InventoryObjects &objects = _vm->_game->_objects; diff --git a/engines/mads/debugger.h b/engines/mads/debugger.h index 19827495d4..0c048f2368 100644 --- a/engines/mads/debugger.h +++ b/engines/mads/debugger.h @@ -43,6 +43,8 @@ protected: bool Cmd_ShowCodes(int argc, const char **argv); bool Cmd_DumpFile(int argc, const char **argv); bool Cmd_ShowQuote(int argc, const char **argv); + bool Cmd_ShowVocab(int argc, const char **argv); + bool Cmd_DumpVocab(int argc, const char **argv); bool Cmd_Item(int argc, const char **argv); public: bool _showMousePos; diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 84e4edc08d..0c241eb9ab 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -254,6 +254,10 @@ void Scene::loadVocabStrings() { f.close(); } +uint32 Scene::getVocabStringsCount() const { + return _vocabStrings.size(); +} + void Scene::initPaletteAnimation(Common::Array &palCycles, bool animFlag) { // Initialize the animation palette and ticks list _cycleTicks.clear(); diff --git a/engines/mads/scene.h b/engines/mads/scene.h index 69a2c0d78d..27fb901a25 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -151,6 +151,11 @@ public: */ void addActiveVocab(int vocabId); + /** + * Get the number of entries in the game's vocabulary + */ + uint32 getVocabStringsCount() const; + /** * Clear the sequence list */ -- cgit v1.2.3 From 59d7f8bfc00456eb34357d2eba12223f80c0f0f9 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 20 May 2014 06:47:18 +0300 Subject: MADS: Replace most of the action nouns with their friendly names --- engines/mads/nebular/nebular_scenes.h | 1274 ++++++++++++++++++++++++++++-- engines/mads/nebular/nebular_scenes1.cpp | 274 +++---- engines/mads/nebular/nebular_scenes2.cpp | 378 ++++----- engines/mads/nebular/nebular_scenes3.cpp | 520 ++++++------ engines/mads/nebular/nebular_scenes4.cpp | 506 ++++++------ engines/mads/nebular/nebular_scenes5.cpp | 378 ++++----- engines/mads/nebular/nebular_scenes6.cpp | 364 ++++----- engines/mads/nebular/nebular_scenes7.cpp | 150 ++-- engines/mads/nebular/nebular_scenes8.cpp | 140 ++-- 9 files changed, 2547 insertions(+), 1437 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index 75e00773cb..d97fa4b284 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -98,93 +98,1203 @@ enum Verb { }; enum Noun { - NOUN_BIG_LEAVES = 0x23, - NOUN_BINOCULARS = 0x27, - NOUN_BLOWGUN = 0x29, - NOUN_BOMB = 0x2A, - NOUN_BOMBS = 0x2B, - NOUN_BONE = 0x2C, - NOUN_BONES = 0x2D, - NOUN_BURGER = 0x35, - NOUN_CHAIR = 0x47, - NOUN_CHICKEN = 0x49, - NOUN_CHICKEN_BOMB = 0x4A, - NOUN_CONTROL_PANEL = 0x59, - NOUN_DEAD_FISH = 0x65, - NOUN_DOOR = 0x6E, - NOUN_DRAWER = 0x71, - NOUN_ENTER_KEY = 0x7A, - NOUN_FISHING_LINE = 0x87, - NOUN_FISHING_ROD = 0x88, - NOUN_FRONT_WINDOW = 0x8E, - NOUN_FUZZY_DICE = 0x91, - NOUN_HOTPANTS = 0x0A7, - NOUN_HULL = 0x0A8, - NOUN_ID_CARD = 0x0B3, - NOUN_JUNGLE = 0x0B8, - NOUN_KEYPAD = 0x0C4, - NOUN_LADDER = 0x0C7, - NOUN_LIFE_SUPPORT_SECTION = 0x0CC, - NOUN_LOG = 0x0D0, - NOUN_MONKEY = 0x0E3, - NOUN_OUTER_HULL = 0x0F8, - NOUN_OUTSIDE = 0x0F9, - NOUN_PIRANHA = 0x10D, - NOUN_PLANT_STALK = 0x10F, - NOUN_REFRIGERATOR = 0x122, - NOUN_ROBO_KITCHEN = 0x127, - NOUN_ROCK = 0x128, - NOUN_ROCKS = 0x129, - NOUN_SHIELD_ACCESS_PANEL = 0x135, - NOUN_SHIELD_MODULATOR = 0x137, - NOUN_SKULL = 0x140, - NOUN_TELEPORTER = 0x16C, - NOUN_BROKEN_LADDER = 0x1C9, - NOUN_STUFFED_FISH = 0x157, - NOUN_15F = 0x15F, - NOUN_TIMEBOMB = 0x171, - NOUN_TWINKIFRUIT = 0x17A, - NOUN_VIEW_SCREEN = 0x180, - NOUN_VIEWPORT = 0x181, - NOUN_DEEP_PIT = 0x19E, - NOUN_HUGE_LEGS = 0x1A8, - NOUN_LEAF_COVERED_PIT = 0x1A9, + NOUN_GAME = 0x1, + NOUN_QSAVE = 0x2, + NOUN_LOOK = 0x3, + NOUN_TAKE = 0x4, + NOUN_PUSH = 0x5, + NOUN_OPEN = 0x6, + NOUN_PUT = 0x7, + NOUN_TALK_TO = 0x8, + NOUN_GIVE = 0x9, + NOUN_PULL = 0xA, + NOUN_CLOSE = 0xB, + NOUN_THROW = 0xC, + NOUN_WALK_TO = 0xD, + NOUN_ACTIVATE = 0xE, + NOUN_ADMIRE = 0xF, + NOUN_ADSM = 0x10, + NOUN_AIR_VENT = 0x11, + NOUN_ALOE_PLANT = 0x12, + NOUN_ANEMONE = 0x13, + NOUN_ANOMOMETER = 0x14, + NOUN_AREA_AROUND_HUT = 0x15, + NOUN_AREA_TO_SOUTH = 0x16, + NOUN_AREA_TO_WEST = 0x17, + NOUN_AROMATIC_MEAT = 0x18, + NOUN_ATTACH = 0x19, + NOUN_AUDIO_TAPE = 0x1A, + NOUN_AUXILIARY_POWER = 0x1B, + NOUN_BADMITTON_BRAT = 0x1C, + NOUN_BAG = 0x1D, + NOUN_BAMBOO_TREE = 0x1E, + NOUN_BATS = 0x1F, + NOUN_BAWLEMER_ORIOLE_HUN = 0x20, + NOUN_BEAR_RUG = 0x21, + NOUN_BEASTLY_TROPHY = 0x22, + NOUN_BIG_LEAVES = 0x23, + NOUN_BIG_PIPES = 0x24, + NOUN_BIG_SKY = 0x25, + NOUN_BIG_STONE = 0x26, + NOUN_BINOCULARS = 0x27, + NOUN_BIRDIES = 0x28, + NOUN_BLOWGUN = 0x29, + NOUN_BOMB = 0x2A, + NOUN_BOMBS = 0x2B, + NOUN_BONE = 0x2C, + NOUN_BONES = 0x2D, + NOUN_BOTTLE = 0x2E, + NOUN_BOULDER = 0x2F, + NOUN_BOULDERS = 0x30, + NOUN_BRA = 0x31, + NOUN_BREAK = 0x32, + NOUN_BREATHE_AIR = 0x33, + NOUN_BULKHEAD = 0x34, + NOUN_BURGER = 0x35, + NOUN_BURN = 0x36, + NOUN_BURNT_OUT_WARP_COIL = 0x37, + NOUN_BUSH_LIKE_FORMATION = 0x38, + NOUN_BUSHES = 0x39, + NOUN_BUSHY_FERN = 0x3A, + NOUN_CACTUS = 0x3B, + NOUN_CARD = 0x3C, + NOUN_CAST = 0x3D, + NOUN_CAULDRON = 0x3E, + NOUN_CAVE = 0x3F, + NOUN_CAVE_CEILING = 0x40, + NOUN_CAVE_ENTRANCE = 0x41, + NOUN_CAVE_EXIT = 0x42, + NOUN_CAVE_FLOOR = 0x43, + NOUN_CAVE_TO_EAST = 0x44, + NOUN_CAVE_WALL = 0x45, + NOUN_CEILING = 0x46, + NOUN_CHAIR = 0x47, + NOUN_CHARGE_CASES = 0x48, + NOUN_CHICKEN = 0x49, + NOUN_CHICKEN_BOMB = 0x4A, + NOUN_CLEARING_TO_EAST = 0x4B, + NOUN_CLEARING_TO_SOUTH = 0x4C, + NOUN_CLIFF_FACE = 0x4D, + NOUN_CLIMB_DOWN = 0x4E, + NOUN_CLIMB_THROUGH = 0x4F, + NOUN_CLIMB_UP = 0x50, + NOUN_CLOCK = 0x51, + NOUN_CLOSET = 0x52, + NOUN_CLOTHESLINE = 0x53, + NOUN_CLUMP_OF_TREES = 0x54, + NOUN_COAL = 0x55, + NOUN_COCOANUT = 0x56, + NOUN_COMPACT_CASE = 0x57, + NOUN_COMPUTER_GAME = 0x58, + NOUN_CONTROL_PANEL = 0x59, + NOUN_CORAL = 0x5A, + NOUN_CRAB = 0x5B, + NOUN_CREDIT_CHIP = 0x5C, + NOUN_CUMULOUS_CLOUD = 0x5D, + NOUN_CURIOUS_WEED_PATCH = 0x5E, + NOUN_CURTAIN = 0x5F, + NOUN_CURTAINS = 0x60, + NOUN_CUT = 0x61, + NOUN_DAMAGE_CONTROL = 0x62, + NOUN_DAMAGE_CONTROL_PANEL = 0x63, + NOUN_DAMPEN = 0x64, + NOUN_DEAD_FISH = 0x65, + NOUN_DEAD_PURPLE_MONSTER = 0x66, + NOUN_DECLIVITOUS_CHASM = 0x67, + NOUN_DEEP_DARK_FOREST = 0x68, + NOUN_DENSE_FOREST = 0x69, + NOUN_DETONATORS = 0x6A, + NOUN_DINO_MITE = 0x6B, + NOUN_DISASSEMBLE = 0x6C, + NOUN_DIVE_INTO = 0x6D, + NOUN_DOOR = 0x6E, + NOUN_DOOR_KEY = 0x6F, + NOUN_DOORWAY = 0x70, + NOUN_DRAWER = 0x71, + NOUN_DRINK = 0x72, + NOUN_DURAFAIL_CELLS = 0x73, + NOUN_EASTERN_CLIFF_FACE = 0x74, + NOUN_EAT = 0x75, + NOUN_EJECT = 0x76, + NOUN_EMPTY = 0x77, + NOUN_ENGINEERING_CONTROLS = 0x78, + NOUN_ENGINEERING_SECTION = 0x79, + NOUN_ENTER_KEY = 0x7A, + NOUN_ESCAPE_HATCH = 0x7B, + NOUN_ESTROTOXIN = 0x7C, + NOUN_EXAMINE = 0x7D, + NOUN_EXPERIMENT_CAGE = 0x7E, + NOUN_EXTINGUISH = 0x7F, + NOUN_FACE_ID = 0x80, + NOUN_FERN = 0x81, + NOUN_FIELD_TO_NORTH = 0x82, + NOUN_FIELD_TO_SOUTH = 0x83, + NOUN_FIELD_TO_WEST = 0x84, + NOUN_FILL = 0x85, + NOUN_FIRE_PIT = 0x86, + NOUN_FISHING_LINE = 0x87, + NOUN_FISHING_ROD = 0x88, + NOUN_FLOOR = 0x89, + NOUN_FLOOR_OF_HUT = 0x8A, + NOUN_FLOOR_TILE = 0x8B, + NOUN_FONDLE = 0x8C, + NOUN_FOREST_TO_EAST = 0x8D, + NOUN_FRONT_WINDOW = 0x8E, + NOUN_FUNGOIDS = 0x8F, + NOUN_FURNACE = 0x90, + NOUN_FUZZY_DICE = 0x91, + NOUN_GAZE = 0x92, + NOUN_GAZE_AT = 0x93, + NOUN_GAZE_IN = 0x94, + NOUN_GLANCE_AT = 0x95, + NOUN_GLOVE = 0x96, + NOUN_GNARLY_SHRUB = 0x97, + NOUN_GNAW_ON = 0x98, + NOUN_GORGE_ON = 0x99, + NOUN_GRAIN_ALCHOHOL = 0x9A, + NOUN_GRASSLAND_TO_EAST = 0x9B, + NOUN_GRASSLAND_TO_SOUTH = 0x9C, + NOUN_GRASSY_AREA = 0x9D, + NOUN_GRASSY_AREA_TO_NORTH = 0x9E, + NOUN_GRASSY_KNOLL = 0x9F, + NOUN_GRIND = 0xA0, + NOUN_GROOVILACTIC_TREE = 0xA1, + NOUN_GUARDS_ARM = 0xA2, + NOUN_HATCHWAY = 0xA3, + NOUN_HOOK_UP = 0xA4, + NOUN_HORIZON = 0xA5, + NOUN_HOSE_DOWN = 0xA6, + NOUN_HOTPANTS = 0xA7, + NOUN_HULL = 0xA8, + NOUN_HURL = 0xA9, + NOUN_HUT = 0xAA, + NOUN_HUT_AREA = 0xAB, + NOUN_HUT_TO_EAST = 0xAC, + NOUN_HUT_TO_SOUTH = 0xAD, + NOUN_HUT_TO_THE_SOUTH = 0xAE, + NOUN_HUT_TO_WEST = 0xAF, + NOUN_HUTS_TO_NORTH = 0xB0, + NOUN_HYDROSPANNER = 0xB1, + NOUN_HYPERDRIVE_JUMP_UNIT = 0xB2, + NOUN_ID_CARD = 0xB3, + NOUN_IGNITE = 0xB4, + NOUN_INFLATE = 0xB5, + NOUN_INSERT = 0xB6, + NOUN_INSPECT = 0xB7, + NOUN_JUNGLE = 0xB8, + NOUN_JUNGLE_TO_EAST = 0xB9, + NOUN_JUNGLE_TO_WEST = 0xBA, + NOUN_KEY_1 = 0xBB, + NOUN_KEY_2 = 0xBC, + NOUN_KEY_3 = 0xBD, + NOUN_KEY_4 = 0xBE, + NOUN_KEY_5 = 0xBF, + NOUN_KEY_6 = 0xC0, + NOUN_KEY_7 = 0xC1, + NOUN_KEY_8 = 0xC2, + NOUN_KEY_9 = 0xC3, + NOUN_KEYPAD = 0xC4, + NOUN_KNEELING_WOMAN = 0xC5, + NOUN_KNIFE = 0xC6, + NOUN_LADDER = 0xC7, + NOUN_LARGE_STALAGMITE = 0xC8, + NOUN_LEER_AT = 0xC9, + NOUN_LIBRARY_COMPUTER = 0xCA, + NOUN_LICK = 0xCB, + NOUN_LIFE_SUPPORT_SECTION = 0xCC, + NOUN_LIGHT = 0xCD, + NOUN_LOAD = 0xCE, + NOUN_LOCK = 0xCF, + NOUN_LOG = 0xD0, + NOUN_LOOK_AT = 0xD1, + NOUN_LOOK_IN = 0xD2, + NOUN_LOOK_THROUGH = 0xD3, + NOUN_LOUNGE_AREA = 0xD4, + NOUN_LOVE_ALTAR = 0xD5, + NOUN_LOWLANDS = 0xD6, + NOUN_MACHINE = 0xD7, + NOUN_MAGNET = 0xD8, + NOUN_MAIN_AIRLOCK = 0xD9, + NOUN_MANTA_RAY = 0xDA, + NOUN_MARSHY_WETLANDS = 0xDB, + NOUN_MATCH = 0xDC, + NOUN_MEDICAL_WASTE = 0xDD, + NOUN_MEDICINE_CABINET = 0xDE, + NOUN_MEN_WHO_CAME_BEFORE = 0xDF, + NOUN_MINE = 0xE0, + NOUN_MIRROR = 0xE1, + NOUN_MONITOR = 0xE2, + NOUN_MONKEY = 0xE3, + NOUN_MONKEY_LIVER_JUICE = 0xE4, + NOUN_MONSTER_SLUDGE = 0xE5, + NOUN_MOUNTAIN = 0xE6, + NOUN_MOUNTAIN_RANGE = 0xE7, + NOUN_MOUNTAINS = 0xE8, + NOUN_MTAM = 0xE9, + NOUN_MUSHROOMS = 0xEA, + NOUN_NAVIGATION_CONTROLS = 0xEB, + NOUN_NORTH_PATH = 0xEC, + NOUN_NORTHERN_EXPOSURE = 0xED, + NOUN_NORTHERN_SEA_CLIFF = 0xEE, + NOUN_OBSTACLE = 0xEF, + NOUN_OCEAN_FLOOR = 0xF0, + NOUN_ODD_ROCK_FORMATION = 0xF1, + NOUN_OOGLY_BOOGLY_JUICE = 0xF2, + NOUN_OPEN_AREA_TO_EAST = 0xF3, + NOUN_OPEN_AREA_TO_NORTH = 0xF4, + NOUN_OPEN_AREA_TO_SOUTH = 0xF5, + NOUN_OPEN_AREA_TO_WEST = 0xF6, + NOUN_OPEN_FIELD = 0xF7, + NOUN_OUTER_HULL = 0xF8, + NOUN_OUTSIDE = 0xF9, + NOUN_OVEN = 0xFA, + NOUN_OVERHANG_TO_EAST = 0xFB, + NOUN_OVERHANG_TO_WEST = 0xFC, + NOUN_OVERHEAD_LAMP = 0xFD, + NOUN_PAD_OF_PAPER = 0xFE, + NOUN_PADLOCK_KEY = 0xFF, + NOUN_PALM_TREE = 0x100, + NOUN_PASSAGE_WAY_TO_SOUTH = 0x101, + NOUN_PASSION_PUSS = 0x102, + NOUN_PEER_THROUGH = 0x103, + NOUN_PENCIL = 0x104, + NOUN_PENDULOUS_CRAG = 0x105, + NOUN_PENLIGHT = 0x106, + NOUN_PHONE_CELLS = 0x107, + NOUN_PHONE_HANDSET = 0x108, + NOUN_PILE_OF_ROCKS = 0x109, + NOUN_PILLOW = 0x10A, + NOUN_PILOTS_CHAIR = 0x10B, + NOUN_PIPE = 0x10C, + NOUN_PIRANHA = 0x10D, + NOUN_PLANT = 0x10E, + NOUN_PLANT_STALK = 0x10F, + NOUN_PLANTS = 0x110, + NOUN_PLASTIC_JESUS = 0x111, + NOUN_PLAY = 0x112, + NOUN_PLUNGER = 0x113, + NOUN_POISON_DARTS = 0x114, + NOUN_POLYCEMENT = 0x115, + NOUN_POOL = 0x116, + NOUN_POSTER = 0x117, + NOUN_POWER_STATUS_PANEL = 0x118, + NOUN_PRECIPICE = 0x119, + NOUN_PRESS = 0x11A, + NOUN_PRESSURE_GAUGE = 0x11B, + NOUN_PRY = 0x11C, + NOUN_RAGING_RIVER = 0x11D, + NOUN_RAMOLYAN_RUGBY_RATS = 0x11E, + NOUN_READ = 0x11F, + NOUN_REARVIEW_MIRROR = 0x120, + NOUN_REBREATHER = 0x121, + NOUN_REFRIGERATOR = 0x122, + NOUN_REMOTE = 0x123, + NOUN_REPAIR_LIST = 0x124, + NOUN_RIVER = 0x125, + NOUN_RIVER_TO_WEST = 0x126, + NOUN_ROBO_KITCHEN = 0x127, + NOUN_ROCK = 0x128, + NOUN_ROCKS = 0x129, + NOUN_ROCKY_AREA = 0x12A, + NOUN_ROLLING_HILL = 0x12B, + NOUN_SCALPEL = 0x12C, + NOUN_SCENIC_MOUNTAINS = 0x12D, + NOUN_SEA_CLIFF = 0x12E, + NOUN_SEAWEED = 0x12F, + NOUN_SEAWEED_BANK = 0x130, + NOUN_SECURITY_CARD = 0x131, + NOUN_SET = 0x132, + NOUN_SHAKE_HANDS = 0x133, + NOUN_SHARPEN = 0x134, + NOUN_SHIELD_ACCESS_PANEL = 0x135, + NOUN_SHIELD_GENERATOR = 0x136, + NOUN_SHIELD_MODULATOR = 0x137, + NOUN_SHIELD_STATUS_PANEL = 0x138, + NOUN_SHIP = 0x139, + NOUN_SHOOT = 0x13A, + NOUN_SHOVEL = 0x13B, + NOUN_SHRED = 0x13C, + NOUN_SHRUNKEN_HEADS = 0x13D, + NOUN_SINGED_MEAT = 0x13E, + NOUN_SIT_IN = 0x13F, + NOUN_SKULL = 0x140, + NOUN_SKULL_AND_CROSSBONES = 0x141, + NOUN_SKY = 0x142, + NOUN_SLEEP_ON = 0x143, + NOUN_SLITHERING_SNAKE = 0x144, + NOUN_SLUG_SECRETION = 0x145, + NOUN_SMALL_HOLE = 0x146, + NOUN_SMELL = 0x147, + NOUN_SNAKE = 0x148, + NOUN_SNIFF = 0x149, + NOUN_SOAK = 0x14A, + NOUN_SPECIAL_KEY_1 = 0x14B, + NOUN_SPECIAL_KEY_2 = 0x14C, + NOUN_SPIDER = 0x14D, + NOUN_SPILT_MILK = 0x14E, + NOUN_SPIT_FIRE = 0x14F, + NOUN_SPRAY = 0x150, + NOUN_STAB = 0x151, + NOUN_STAIRS = 0x152, + NOUN_STALAGMITES = 0x153, + NOUN_STAND_INSIDE = 0x154, + NOUN_STARE_AT = 0x155, + NOUN_STEPS = 0x156, + NOUN_STUFFED_FISH = 0x157, + NOUN_SURFACE = 0x158, + NOUN_SWIM_ACROSS = 0x159, + NOUN_SWIM_INTO = 0x15A, + NOUN_SWIM_THROUGH = 0x15B, + NOUN_SWIM_TO = 0x15C, + NOUN_SWIM_TOWARDS = 0x15D, + NOUN_SWIM_UNDER = 0x15E, + NOUN_SWOOPING_CREATURE = 0x15F, + NOUN_TABLE = 0x160, + NOUN_TAKE_LIVER = 0x161, + NOUN_TAKE_OFF = 0x162, + NOUN_TAKE_PAGE = 0x163, + NOUN_TALL_GRASS = 0x164, + NOUN_TAPE_PLAYER = 0x165, + NOUN_TARGET_COMPUTER = 0x166, + NOUN_TARGET_MODULE = 0x167, + NOUN_TARGETTING_COMPUTER = 0x168, + NOUN_TASMANIAN_DEVIL = 0x169, + NOUN_TASTY_TURKEY = 0x16A, + NOUN_TELEPORT_DEVICE = 0x16B, + NOUN_TELEPORTER = 0x16C, + NOUN_THATCHED_ROOF = 0x16D, + NOUN_THORNS = 0x16E, + NOUN_THORNY_BUSH = 0x16F, + NOUN_TIE = 0x170, + NOUN_TIMEBOMB = 0x171, + NOUN_TIMER = 0x172, + NOUN_TIMER_MODULE = 0x173, + NOUN_TREE = 0x174, + NOUN_TREES = 0x175, + NOUN_TRODDEN_PATH = 0x176, + NOUN_TUBE = 0x177, + NOUN_TUNNEL = 0x178, + NOUN_TWINKIE_BUSH = 0x179, + NOUN_TWINKIFRUIT = 0x17A, + NOUN_UNLOCK = 0x17B, + NOUN_UZI = 0x17C, + NOUN_VASE = 0x17D, + NOUN_VIDEO_GAME = 0x17E, + NOUN_VIEW = 0x17F, + NOUN_VIEW_SCREEN = 0x180, + NOUN_VIEWPORT = 0x181, + NOUN_VILLAGE_AREA = 0x182, + NOUN_VILLAGE_TO_WEST = 0x183, + NOUN_VOLCANO = 0x184, + NOUN_VULTURE = 0x185, + NOUN_WAD_OF_CATTLE_PARTS = 0x186, + NOUN_WALK_ACROSS = 0x187, + NOUN_WALK_INSIDE = 0x188, + NOUN_WALK_ON = 0x189, + NOUN_WALK_OUTSIDE = 0x18A, + NOUN_WALK_THROUGH = 0x18B, + NOUN_WALK_TOWARDS = 0x18C, + NOUN_WALL = 0x18D, + NOUN_WATCH_TOWER = 0x18E, + NOUN_WATER = 0x18F, + NOUN_WEAPONS_DISPLAY = 0x190, + NOUN_WEAR = 0x191, + NOUN_WEATHER_STATION = 0x192, + NOUN_WEATHER_VANE = 0x193, + NOUN_WEIGHT_MACHINE = 0x194, + NOUN_WESTERN_CLIFF_FACE = 0x195, + NOUN_WHEEL = 0x196, + NOUN_WINDOW = 0x197, + NOUN_WITCHDOCTOR_HUT = 0x198, + NOUN_WORKBENCH = 0x199, + NOUN_WRITE_ON = 0x19A, + NOUN_YELLOW_BIRDY = 0x19B, + NOUN_GRASS = 0x19C, + NOUN_BOUNCING_REPTILE = 0x19D, + NOUN_DEEP_PIT = 0x19E, + NOUN_LOWLANDS_TO_NORTH = 0x19F, + NOUN_SMALL_BUSH = 0x1A0, + NOUN_SMALL_CACTUS = 0x1A1, + NOUN_ROCKY_AREA_TO_NORTH = 0x1A2, + NOUN_BAMBOO_LIKE_PLANT = 0x1A3, + NOUN_MOUNTAINSIDE = 0x1A4, + NOUN_FIELD = 0x1A5, + NOUN_GRASSY_FIELD = 0x1A6, + NOUN_CRAG = 0x1A7, + NOUN_HUGE_LEGS = 0x1A8, + NOUN_LEAF_COVERED_PIT = 0x1A9, NOUN_PILE_OF_LEAVES = 0x1AA, + NOUN_OPEN_FIELD_TO_EAST = 0x1AB, + NOUN_LAWN = 0x1AC, + NOUN_WALK_DOWN = 0x1AD, + NOUN_PATH_TO_WEST = 0x1AE, + NOUN_HEDGE = 0x1AF, + NOUN_VILLAGE_PATH = 0x1B0, + NOUN_PATH_TO_NORTHEAST = 0x1B1, + NOUN_JUNGLE_PATH = 0x1B2, + NOUN_THICK_UNDERGROWTH = 0x1B3, + NOUN_OCEAN = 0x1B4, + NOUN_OCEAN_IN_DISTANCE = 0x1B5, NOUN_STRANGE_DEVICE = 0x1B6, + NOUN_BUSH = 0x1B7, + NOUN_ANEMOMETER = 0x1B8, + NOUN_ISLAND_IN_DISTANCE = 0x1B9, + NOUN_PATH = 0x1BA, + NOUN_TROPHY = 0x1BB, + NOUN_SPECIMEN_JARS = 0x1BC, + NOUN_BOWL = 0x1BD, + NOUN_LARGE_BOWL = 0x1BE, + NOUN_PATH_TO_NORTH = 0x1BF, + NOUN_HUT_TO_NORTH = 0x1C0, + NOUN_PATH_TO_EAST = 0x1C1, + NOUN_CHICKEN_ON_SPIT = 0x1C2, NOUN_CAPTIVE_CREATURE = 0x1C3, - NOUN_DISPLAY = 0x1CC, - NOUN_DEVICE = 0x1CF, - NOUN_0_KEY = 0x1D0, - NOUN_1_KEY = 0x1D1, - NOUN_2_KEY = 0x1D2, - NOUN_3_KEY = 0x1D3, - NOUN_4_KEY = 0x1D4, - NOUN_5_KEY = 0x1D5, - NOUN_6_KEY = 0x1D6, - NOUN_7_KEY = 0x1D7, - NOUN_8_KEY = 0x1D8, - NOUN_9_KEY = 0x1D9, - NOUN_FROWN_KEY = 0x1DA, - NOUN_SMILE_KEY = 0x1DB, - NOUN_NATIVE_WOMAN = 0x1DC, - NOUN_PLATFORM = 0x22C, - NOUN_ALCOHOL = 0x310, + NOUN_TWINKIFRUIT_BUSH = 0x1C4, + NOUN_STREAM = 0x1C5, + NOUN_OPPOSITE_SHORE = 0x1C6, + NOUN_PATH_TO_SOUTH = 0x1C7, + NOUN_OPPOSITE_BANK = 0x1C8, + NOUN_BROKEN_LADDER = 0x1C9, + NOUN_BAG_OF_TWINKIFRUITS = 0x1CA, + NOUN_BED = 0x1CB, + NOUN_DISPLAY = 0x1CC, + NOUN_LEAVE = 0x1CD, + NOUN_EXIT_FROM = 0x1CE, + NOUN_DEVICE = 0x1CF, + NOUN_0_KEY = 0x1D0, + NOUN_1_KEY = 0x1D1, + NOUN_2_KEY = 0x1D2, + NOUN_3_KEY = 0x1D3, + NOUN_4_KEY = 0x1D4, + NOUN_5_KEY = 0x1D5, + NOUN_6_KEY = 0x1D6, + NOUN_7_KEY = 0x1D7, + NOUN_8_KEY = 0x1D8, + NOUN_9_KEY = 0x1D9, + NOUN_FROWN_KEY = 0x1DA, + NOUN_SMILE_KEY = 0x1DB, + NOUN_NATIVE_WOMAN = 0x1DC, + NOUN_YELLOW_BIRD = 0x1DD, + NOUN_BLEEPER = 0x1DE, + NOUN_SIZEMOMETER = 0x1DF, + NOUN_PANEL = 0x1E0, + NOUN_PRINTER = 0x1E1, + NOUN_HARD_DRIVE = 0x1E2, + NOUN_BATHROOM = 0x1E3, + NOUN_DESK = 0x1E4, + NOUN_PASSAGEWAY = 0x1E5, + NOUN_FIRE_HYDRANT = 0x1E6, + NOUN_FREEZER = 0x1E7, + NOUN_EQUIDIGITIZER = 0x1E8, + NOUN_VISION_VIEW = 0x1E9, + NOUN_TELEDETECTOR = 0x1EA, + NOUN_POLE = 0x1EB, + NOUN_TRANSPOSITION_DEVICE = 0x1EC, + NOUN_STATUESQUE = 0x1ED, + NOUN_TEMPERATURE_GAUGE = 0x1EE, + NOUN_CHECK = 0x1EF, + NOUN_WATCH = 0x1F0, + NOUN_ELECTRO_SCANNER = 0x1F1, + NOUN_HALL = 0x1F2, + NOUN_SCANNER = 0x1F3, + NOUN_PLACE_HAND_ON = 0x1F4, + NOUN_SECURITY_MONITOR = 0x1F5, + NOUN_DIGITORAMA = 0x1F6, + NOUN_RAIL_BEAM = 0x1F7, + NOUN_VAULT = 0x1F8, + NOUN_HALLWAY = 0x1F9, + NOUN_PIPES = 0x1FA, + NOUN_AIR_VENT_GRATE = 0x1FB, + NOUN_SECURITY_OFFICE = 0x1FC, + NOUN_SIGNAL = 0x1FD, + NOUN_BLEEP = 0x1FE, + NOUN_BLIP = 0x1FF, + NOUN_LOFT = 0x200, + NOUN_ELECTRONIC_ANT_FARM = 0x201, + NOUN_ELECTRIC_WIRING = 0x202, + NOUN_SECURITY_PANEL = 0x203, + NOUN_CORRIDOR = 0x204, + NOUN_CIRCUIT_CONTROLS = 0x205, + NOUN_AIR_DUCT = 0x206, + NOUN_CELL_WALL = 0x207, + NOUN_LIGHTS = 0x208, + NOUN_STARE_INTO = 0x209, + NOUN_CELL_CONTROLS = 0x20A, + NOUN_COMMODE = 0x20B, + NOUN_USE = 0x20C, + NOUN_BASIN = 0x20D, + NOUN_JUMP_INSIDE = 0x20E, + NOUN_PREVIOUS_CELL = 0x20F, + NOUN_NEXT_ROOM = 0x210, + NOUN_ZINK = 0x211, + NOUN_GAZE_INTO = 0x212, + NOUN_THRONE = 0x213, + NOUN_SACK = 0x214, + NOUN_LIMB = 0x215, + NOUN_SINK = 0x216, + NOUN_JOHNNY_ON_THE_SPOT = 0x217, + NOUN_DEBRIS = 0x218, + NOUN_BUNK = 0x219, + NOUN_NEXT_CELL = 0x21A, + NOUN_TOILET = 0x21B, + NOUN_MONITOR_AREA = 0x21C, + NOUN_SIDEWALL = 0x21D, + NOUN_COFFEE_MUG = 0x21E, + NOUN_SIT_AT = 0x21F, + NOUN_LIGHTING_FIXTURE = 0x220, + NOUN_MONITORS = 0x221, + NOUN_GENDER_CONTROLS = 0x222, + NOUN_NEURO_ANALYZER = 0x223, + NOUN_MOLECULAR_RECORDER = 0x224, + NOUN_MAINTENANCE_PANEL = 0x225, + NOUN_RAMP = 0x226, + NOUN_WALK_UP = 0x227, + NOUN_SUBSONIC_ATOMIZER = 0x228, + NOUN_EIGHT_BALL = 0x229, + NOUN_DNA_INVERTER = 0x22A, + NOUN_DNA_CONVERTER = 0x22B, + NOUN_PLATFORM = 0x22C, + NOUN_GUINEA_PIG_TEST_BOX = 0x22D, + NOUN_GASEOUS_PROBE_WARPER = 0x22E, + NOUN_TOOL_CABINET = 0x22F, + NOUN_SURGICAL_BOXES = 0x230, + NOUN_FETAL_HEART_MONITOR = 0x231, + NOUN_XRAY_CABINET = 0x232, + NOUN_STERILIZATION_SINK = 0x233, + NOUN_DRIPOLATOR = 0x234, + NOUN_SHOCK_MACHINE = 0x235, + NOUN_INTERROGATION_TABLE = 0x236, + NOUN_LIE_DOWN_ON = 0x237, + NOUN_DECIPHER = 0x238, + NOUN_GUARD = 0x239, + NOUN_RIP_IN_FLOOR = 0x23A, + NOUN_TELEPORT_AREA = 0x23B, + NOUN_BROKEN_BEAM = 0x23C, + NOUN_ROCK_CHUNK = 0x23D, + NOUN_BLOODY_CELL_WALL = 0x23E, + NOUN_WALL_BOARD = 0x23F, + NOUN_GENDER_SCANNER = 0x240, + NOUN_BAR = 0x241, + NOUN_WALK_INTO = 0x242, + NOUN_HALLWAY_TO_SOUTH = 0x243, + NOUN_SIGN = 0x244, + NOUN_HALLWAY_TO_NORTH = 0x245, + NOUN_BOTTLES = 0x246, + NOUN_UPPER_DANCE_FLOOR = 0x247, + NOUN_DANCE_FLOOR = 0x248, + NOUN_RAILING = 0x249, + NOUN_BAR_STOOL = 0x24A, + NOUN_LADY = 0x24B, + NOUN_UPPER_LEVEL = 0x24C, + NOUN_ALCOVE = 0x24D, + NOUN_DISCO_BALL = 0x24E, + NOUN_LADIES = 0x24F, + NOUN_COACH_LAMP = 0x250, + NOUN_CARD_SLOT = 0x251, + NOUN_HOOP = 0x252, + NOUN_CANNONBALLS = 0x253, + NOUN_WATER_FOUNTAIN = 0x254, + NOUN_HALLWAY_TO_EAST = 0x255, + NOUN_HALLWAY_TO_WEST = 0x256, + NOUN_SUPPORT = 0x257, + NOUN_BACKBOARD = 0x258, + NOUN_WIDE_DOOR = 0x259, + NOUN_SIGN_POST = 0x25A, + NOUN_FIRE_EXTINGUISHER = 0x25B, + NOUN_TRASH = 0x25C, + NOUN_MISSILES = 0x25D, + NOUN_TANK = 0x25E, + NOUN_TWO_TON_WEIGHT = 0x25F, + NOUN_ONE_TON_TOMATO = 0x260, + NOUN_ANVIL = 0x261, + NOUN_MINUTEMAN_IV_ICBM = 0x262, + NOUN_CHEST = 0x263, + NOUN_ARMOR = 0x264, + NOUN_CARTON = 0x265, + NOUN_POWDER = 0x266, + NOUN_RAFT = 0x267, + NOUN_WHATZIT = 0x268, + NOUN_CATAPULT = 0x269, + NOUN_HAND_GRENADE = 0x26A, + NOUN_BARRELS = 0x26B, + NOUN_LOADING_RAMP = 0x26C, + NOUN_BLIMP = 0x26D, + NOUN_FLOUR = 0x26E, + NOUN_FLY_PAPER = 0x26F, + NOUN_RUG = 0x270, + NOUN_CARPET = 0x271, + NOUN_CAN = 0x272, + NOUN_RUBBER_DUCKIE = 0x273, + NOUN_GOLF_CLUBS = 0x274, + NOUN_RAT = 0x275, + NOUN_BARREL = 0x276, + NOUN_BUCKET_OF_TAR = 0x277, + NOUN_SACKS = 0x278, + NOUN_STORAGE = 0x279, + NOUN_120V_3_PHASE_400HZ = 0x27A, + NOUN_LAB_EQUIPMENT = 0x27B, + NOUN_AIR_HORN = 0x27C, + NOUN_JAR = 0x27D, + NOUN_SEVERED_CABLE = 0x27E, + NOUN_PROBE_ASSEMBLY = 0x27F, + NOUN_KNIFE_SWITCH = 0x280, + NOUN_WORK_BENCH = 0x281, + NOUN_HEATER = 0x282, + NOUN_TOXIC_WASTE = 0x283, + NOUN_EXPERIMENT = 0x284, + NOUN_DRAWING_BOARD = 0x285, + NOUN_MISHAP = 0x286, + NOUN_AIR_PURIFIER = 0x287, + NOUN_DUMMY = 0x288, + NOUN_PICTURE = 0x289, + NOUN_BAGGAGE_CHECK = 0x28A, + NOUN_DEPARTURE_SCHEDULE = 0x28B, + NOUN_SHADE_OF_PALE = 0x28C, + NOUN_ITINERARY = 0x28D, + NOUN_BARGAIN_VAT = 0x28E, + NOUN_PENCILS = 0x28F, + NOUN_PAD_IF_PAPER = 0x290, + NOUN_DEEPEST_DEPTHS = 0x291, + NOUN_ROLODEX = 0x292, + NOUN_MONA_TISA = 0x293, + NOUN_ABSTRACT_ART = 0x294, + NOUN_SPACE_QUESTING_VIII = 0x295, + NOUN_THEATRICAL_ART = 0x296, + NOUN_METAL_POLE = 0x297, + NOUN_EXIT = 0x298, + NOUN_SWIRLING_LIGHT = 0x299, + NOUN_REGISTER = 0x29A, + NOUN_PEACHY_BUNS = 0x29B, + NOUN_OUR_TOWN = 0x29C, + NOUN_EMBROIDERED_ART = 0x29D, + NOUN_GEORGE_BUSH_ALIKE = 0x29E, + NOUN_COUNTER = 0x29F, + NOUN_SENSOR = 0x2A0, + NOUN_SOFTWARE_INFORMATION = 0x2A1, + NOUN_WALK_BEHIND = 0x2A2, + NOUN_BARGAINS = 0x2A3, + NOUN_SCAN_LIGHT = 0x2A4, + NOUN_OLD_SOFTWARE_STAND = 0x2A5, + NOUN_SOFTWARE_SHELF = 0x2A6, + NOUN_HOTTEST_SOFTWARE = 0x2A7, + NOUN_GREAT_PAINTBALL_ART = 0x2A8, + NOUN_SCENIC_VISTA = 0x2A9, + NOUN_LASER = 0x2AA, + NOUN_LASER_JET = 0x2AB, + NOUN_LEVER = 0x2AC, + NOUN_BULLSEYE = 0x2AD, + NOUN_STAND = 0x2AE, + NOUN_CONTROL_STATION = 0x2AF, + NOUN_STRANGE_MONSTER = 0x2B0, + NOUN_GHASTLY_BEAST = 0x2B1, + NOUN_GAWK_AT = 0x2B2, + NOUN_CORRIDOR_TO_SOUTH = 0x2B3, + NOUN_CORRIDOR_TO_NORTH = 0x2B4, + NOUN_WALK_ONTO = 0x2B5, + NOUN_ROCK_WALL = 0x2B6, + NOUN_WOMAN = 0x2B7, + NOUN_WOMEN = 0x2B8, + NOUN_CORRIDOR_TO_EAST = 0x2B9, + NOUN_CORRIDOR_TO_WEST = 0x2BA, + NOUN_AMMUNITION = 0x2BB, + NOUN_ARMORED_VEHICLE = 0x2BC, + NOUN_TOMATO = 0x2BD, + NOUN_MISSILE = 0x2BE, + NOUN_SUIT_OF_ARMOR = 0x2BF, + NOUN_POWDER_CONTAINER = 0x2C0, + NOUN_INFLATABLE_RAFT = 0x2C1, + NOUN_GRENADE = 0x2C2, + NOUN_FENCE = 0x2C3, + NOUN_WOODEN_STATUE = 0x2C4, + NOUN_CONVEYER_BELT = 0x2C5, + NOUN_CONTROLS = 0x2C6, + NOUN_EQUIPMENT = 0x2C7, + NOUN_SHELF = 0x2C8, + NOUN_CABINETS = 0x2C9, + NOUN_CONTROL_CONSOLE = 0x2CA, + NOUN_FAUCET = 0x2CB, + NOUN_PANEL_BOX = 0x2CC, + NOUN_STATUE = 0x2CD, + NOUN_GAUGE = 0x2CE, + NOUN_CIRCUIT_PANEL = 0x2CF, + NOUN_CATWALK = 0x2D0, + NOUN_CIRCUITS = 0x2D1, + NOUN_BLOOD_STAIN = 0x2D2, + NOUN_GRATE = 0x2D3, + NOUN_AIR_SHAFT = 0x2D4, + NOUN_RETURN_TO = 0x2D5, + NOUN_FORMALDEHYDE = 0x2D6, + NOUN_PETROX = 0x2D7, + NOUN_SODIUM_BENZOATE = 0x2D8, + NOUN_GURNEY = 0x2D9, + NOUN_IRONING_BOARD = 0x2DA, + NOUN_LEFT_MONITOR = 0x2DB, + NOUN_RIGHT_MONITOR = 0x2DC, + NOUN_RED_BUTTON = 0x2DD, + NOUN_GREEN_BUTTON = 0x2DE, + NOUN_RIGHT_ONE_KEY = 0x2DF, + NOUN_RIGHT_1_KEY = 0x2E0, + NOUN_RIGHT_2_KEY = 0x2E1, + NOUN_RIGHT_3_KEY = 0x2E2, + NOUN_RIGHT_4_KEY = 0x2E3, + NOUN_RIGHT_5_KEY = 0x2E4, + NOUN_RIGHT_6_KEY = 0x2E5, + NOUN_RIGHT_7_KEY = 0x2E6, + NOUN_RIGHT_8_KEY = 0x2E7, + NOUN_LEFT_1_KEY = 0x2E8, + NOUN_LEFT_2_KEY = 0x2E9, + NOUN_LEFT_3_KEY = 0x2EA, + NOUN_LEFT_4_KEY = 0x2EB, + NOUN_CORRIDOR_WALL = 0x2EC, + NOUN_MUG = 0x2ED, + NOUN_DOUGHNUT = 0x2EE, + NOUN_SECURITY_STATION = 0x2EF, + NOUN_NEWSPAPER = 0x2F0, + NOUN_MAGAZINE = 0x2F1, + NOUN_CLIPBOARD = 0x2F2, + NOUN_PAPER_FOOTBALL = 0x2F3, + NOUN_YOUR_STUFF = 0x2F4, + NOUN_OTHER_STUFF = 0x2F5, + NOUN_LAMP = 0x2F6, + NOUN_CLIMB_INTO = 0x2F7, + NOUN_LIGHT_BULB = 0x2F8, + NOUN_STEP_INTO = 0x2F9, + NOUN_ROOM = 0x2FA, + NOUN_CRAWL_TO = 0x2FB, + NOUN_FOURTH_CELL = 0x2FC, + NOUN_THIRD_CELL = 0x2FD, + NOUN_SECOND_CELL = 0x2FE, + NOUN_FIRST_CELL = 0x2FF, + NOUN_EQUIPMENT_ROOM = 0x300, + NOUN_CRAWL_DOWN = 0x301, + NOUN_DESCENDING_SHAFT = 0x302, + NOUN_SAUROPOD = 0x303, + NOUN_MONSTER = 0x304, + NOUN_FAKE_ID = 0x305, + NOUN_ALIEN_LIQUOR = 0x306, + NOUN_INTERN = 0x307, + NOUN_INSTRUMENT_TABLE = 0x308, + NOUN_WOMAN_ON_BALCONY = 0x309, + NOUN_WOMAN_IN_CHAIR = 0x30A, + NOUN_SIT_ON = 0x30B, + NOUN_WOMAN_IN_ALCOVE = 0x30C, + NOUN_KETTLE = 0x30D, + NOUN_BARTENDER = 0x30E, + NOUN_WHISKEY = 0x30F, + NOUN_ALCOHOL = 0x310, + NOUN_RIM = 0x311, + NOUN_WALK_ALONG = 0x312, NOUN_SUBMERGED_CITY = 0x313, - NOUN_CEMENT_PYLON = 0x316, - NOUN_ELEVATOR = 0x317, - NOUN_BUILDING = 0x323, - NOUN_LASER_BEAM = 0x343, - NOUN_BOAT = 0x345, - NOUN_CEMENT_BLOCK = 0x38E, - NOUN_CITY = 0x38F, - NOUN_DOLLOP = 0x3AC, - NOUN_DROP = 0x3AD, - NOUN_DASH = 0x3AE, - NOUN_SPLASH = 0x3AF, - NOUN_HOOK = 0x467, - NOUN_BIRDS = 0x487, + NOUN_GOVERNORS_HOUSE = 0x314, + NOUN_RIM_TOWARDS_EAST = 0x315, + NOUN_CEMENT_PYLON = 0x316, + NOUN_ELEVATOR = 0x317, + NOUN_ELEVATOR_SHAFT = 0x318, + NOUN_CONVEYOR_BELT = 0x319, + NOUN_CANNON_BALLS = 0x31A, + NOUN_ELECTRICAL_OVERHANG = 0x31B, + NOUN_GUTTER_PIPE = 0x31C, + NOUN_SIDEWALK = 0x31D, + NOUN_STREET = 0x31E, + NOUN_BARRICADE = 0x31F, + NOUN_DOOR_CONTROL_SLOT = 0x320, + NOUN_STREET_TO_EAST = 0x321, + NOUN_SIDEWALK_TO_EAST = 0x322, + NOUN_BUILDING = 0x323, + NOUN_CAR = 0x324, + NOUN_GET_INSIDE = 0x325, + NOUN_MARQUEE = 0x326, + NOUN_BUILDING_ENTRANCE = 0x327, + NOUN_GUARD_STATION = 0x328, + NOUN_TECHNICAL_EQUIPMENT = 0x329, + NOUN_GUARD_TURRET = 0x32A, + NOUN_PILLAR = 0x32B, + NOUN_PAPERS = 0x32C, + NOUN_FILE_CABINET = 0x32D, + NOUN_WINDOWS = 0x32E, + NOUN_WALK = 0x32F, + NOUN_STORAGE_BOX = 0x330, + NOUN_WATER_COOLER = 0x331, + NOUN_BOX = 0x332, + NOUN_RIFLES = 0x333, + NOUN_SLINGSHOT = 0x334, + NOUN_MAUSOLEUM = 0x335, + NOUN_SOFTWARE_STORE = 0x336, + NOUN_CONCRETE_BUILDING = 0x337, + NOUN_HUMONGOUS_MONITOR = 0x338, + NOUN_SPACE_BIKE = 0x339, + NOUN_BILLBOARD = 0x33A, + NOUN_LACK_OF_NOOKIE_MOTEL = 0x33B, + NOUN_BIDETS_XCREETZA_HUT = 0x33C, + NOUN_BUILDINGS = 0x33D, + NOUN_SKYSCRAPER = 0x33E, + NOUN_SOFTWARE_LOGO = 0x33F, + NOUN_GIANT_TELESCOPE = 0x340, + NOUN_HANDLE = 0x341, + NOUN_HOLE = 0x342, + NOUN_LASER_BEAM = 0x343, + NOUN_PEDESTAL = 0x344, + NOUN_BOAT = 0x345, + NOUN_GIANT_MONUMENT = 0x346, + NOUN_ROPE = 0x347, + NOUN_SAND_BAR_RESTAURANT = 0x348, + NOUN_PORTHOLE = 0x349, + NOUN_TICKET_BOOTH = 0x34A, + NOUN_POLLYS_ENTRANCE = 0x34B, + NOUN_RESTAURANT_ENTRANCE = 0x34C, + NOUN_THE_PLEASURE_DOME = 0x34D, + NOUN_STARFISH = 0x34E, + NOUN_FLIPPER = 0x34F, + NOUN_SAND_DOLLAR = 0x350, + NOUN_SHELL = 0x351, + NOUN_GUEST_LIST = 0x352, + NOUN_WEIRD_ANIMAL_HEAD = 0x353, + NOUN_SHIPS_WHEEL = 0x354, + NOUN_HANDICAP_SIGN = 0x355, + NOUN_ELEVATOR_CONTROLS = 0x356, + NOUN_BRICK_WALL = 0x357, + NOUN_BIKE_RACK = 0x358, + NOUN_ODONALDS_SIGN = 0x359, + NOUN_ELEVATOR_ENTRANCE = 0x35A, + NOUN_SPECIAL_SALE_SIGN = 0x35B, + NOUN_ATTORNEYS_AT_LAW = 0x35C, + NOUN_SLEDGE_MALL = 0x35D, + NOUN_SKELETON = 0x35E, + NOUN_STRANGE_EQUIPMENT = 0x35F, + NOUN_STREET_TO_WEST = 0x360, + NOUN_SIDEWALK_TO_WEST = 0x361, + NOUN_TELEPORTER_ENTRANCE = 0x362, + NOUN_SOFTWARE_DOOR = 0x363, + NOUN_SPINACH_PATCH_DOLL = 0x364, + NOUN_REFLECT = 0x365, + NOUN_REGISTER_DRAWER = 0x366, + NOUN_ELEVATOR_DOOR = 0x367, + NOUN_HYDRAULIC_SUPPORT = 0x368, + NOUN_EQUIPMENT_OVERHEAD = 0x369, + NOUN_GET_INTO = 0x36A, + NOUN_WARNING_LABEL = 0x36B, + NOUN_NUCLEAR_SLINGSHOT = 0x36C, + NOUN_DISPLAY_CASE = 0x36D, + NOUN_PHOTON_RIFLES = 0x36E, + NOUN_MONITORING_EQUIPMENT = 0x36F, + NOUN_TELESCOPE = 0x370, + NOUN_MOTEL = 0x371, + NOUN_RESTAURANT = 0x372, + NOUN_SOFTWARE_STORE_SIGN = 0x373, + NOUN_ADVERTISING_POSTER = 0x374, + NOUN_ADVERTISEMENT = 0x375, + NOUN_OLD_SOFTWARE = 0x376, + NOUN_CASH_REGISTER = 0x377, + NOUN_ENTRANCE = 0x378, + NOUN_LASER_CANNON = 0x379, + NOUN_SAND_BAGS = 0x37A, + NOUN_PLEASURE_DOME = 0x37B, + NOUN_DOME_ENTRANCE = 0x37C, + NOUN_LABORATORY = 0x37D, + NOUN_STREET_TO_SOUTH = 0x37E, + NOUN_ELEVATOR_ACCESS_SLOT = 0x37F, + NOUN_CAR_CONTROLS = 0x380, + NOUN_SCENT_PACKET = 0x381, + NOUN_KITTY = 0x382, + NOUN_GLOVE_COMPARTMENT = 0x383, + NOUN_MOLDY_SOCK = 0x384, + NOUN_SODA_CANS = 0x385, + NOUN_WINDSHIELD = 0x386, + NOUN_DASHBOARD = 0x387, + NOUN_INTERIOR_OF_CAR = 0x388, + NOUN_VIEW_RIGHT_BUTTON = 0x389, + NOUN_BLACK_BUTTON = 0x38A, + NOUN_WHITE_BUTTON = 0x38B, + NOUN_INSIDE_OF_CAR = 0x38C, + NOUN_RIM_TOWARDS_WEST = 0x38D, + NOUN_CEMENT_BLOCK = 0x38E, + NOUN_CITY = 0x38F, + NOUN_SPEAKER = 0x390, + NOUN_EYE_CHART = 0x391, + NOUN_LAUNCH_PAD = 0x392, + NOUN_BUILDING_TO_WEST = 0x393, + NOUN_PAD_TO_EAST = 0x394, + NOUN_PAD_TO_WEST = 0x395, + NOUN_TOWER = 0x396, + NOUN_LOOK_OUT = 0x397, + NOUN_SERVICE_PANEL = 0x398, + NOUN_CRACK = 0x399, + NOUN_THROTTLE = 0x39A, + NOUN_GRAB = 0x39B, + NOUN_INSTRUMENTATION = 0x39C, + NOUN_TP = 0x39D, + NOUN_SEAT = 0x39E, + NOUN_STATUS_PANEL = 0x39F, + NOUN_SHIPS_CONTROLS = 0x3A0, + NOUN_PROFESSOR = 0x3A1, + NOUN_PROFESSORS_GURNEY = 0x3A2, + NOUN_WELCOME_MAT = 0x3A3, + NOUN_MELON_MUSH = 0x3A4, + NOUN_BADMINTON_BRAT = 0x3A5, + NOUN_APPLY = 0x3A6, + NOUN_COMBINATION = 0x3A7, + NOUN_NOTE = 0x3A8, + NOUN_LECITHIN = 0x3A9, + NOUN_REPAIR_WOMAN = 0x3AA, + NOUN_EXPLOSIVES = 0x3AB, + NOUN_DOLLOP = 0x3AC, + NOUN_DROP = 0x3AD, + NOUN_DASH = 0x3AE, + NOUN_SPLASH = 0x3AF, + NOUN_DOCK_TO_SOUTH = 0x3B0, + NOUN_STEER_TOWARDS = 0x3B1, + NOUN_BUILDING_TO_NORTH = 0x3B2, + NOUN_VOLCANO_RIM = 0x3B3, + NOUN_OPEN_WATER_TO_SOUTH = 0x3B4, + NOUN_PROJECTOR = 0x3B5, + NOUN_GUARDS_ARM2 = 0x3B6, + NOUN_NIBBLE_ON = 0x3B7, + NOUN_ENTER = 0x3B8, + NOUN_ = 0x3B9, + NOUN_TIMER_BUTTON_1 = 0x3BA, + NOUN_REMOTE_BUTTON_1 = 0x3BB, + NOUN_START_BUTTON_2 = 0x3BC, + NOUN_REMOTE_BUTTON_2 = 0x3BD, + NOUN_TIMER_BUTTON_2 = 0x3BE, + NOUN_START_BUTTON_1 = 0x3BF, + NOUN_ANTIGRAV_CONTROLS = 0x3C0, + NOUN_BRUCES_TREE = 0x3C1, + NOUN_COLISEUM = 0x3C2, + NOUN_BRUCES_GARDEN_ROOM = 0x3C3, + NOUN_FOUNTAIN = 0x3C4, + NOUN_HOUSE_OF_BRUCE = 0x3C5, + NOUN_CITY_BACKDROP = 0x3C6, + NOUN_BRUCES_BALCONY = 0x3C7, + NOUN_BRUCES_ENTRANCE = 0x3C8, + NOUN_BRUCES_LOGO = 0x3C9, + NOUN_LOUNGE_CHAIR = 0x3CA, + NOUN_LIVING_ROOM_FLOOR = 0x3CB, + NOUN_LIVINGROOM_FLOOR = 0x3CC, + NOUN_PERFUME_BOTTLE = 0x3CD, + NOUN_COOL_NEON_LIGHT = 0x3CE, + NOUN_FLOWER_POT = 0x3CF, + NOUN_COFFEE_TABLE = 0x3D0, + NOUN_FLOWERS = 0x3D1, + NOUN_ART_DECO_CHAIR = 0x3D2, + NOUN_SAFE = 0x3D3, + NOUN_SPLASHY_DECOR = 0x3D4, + NOUN_THEATRICAL_FACES = 0x3D5, + NOUN_ART_DECO_PIECE = 0x3D6, + NOUN_END_OF_ROOM = 0x3D7, + NOUN_FIREPLACE = 0x3D8, + NOUN_ARTWORK = 0x3D9, + NOUN_COOL_NEON_LIGHTS = 0x3DA, + NOUN_GLASS_PLATED_WINDOW = 0x3DB, + NOUN_BEDROOM_FLOOR = 0x3DC, + NOUN_BAUBLE = 0x3DD, + NOUN_SNAPSHOT = 0x3DE, + NOUN_PERFUME = 0x3DF, + NOUN_CLAPBOARD = 0x3E0, + NOUN_BERET = 0x3E1, + NOUN_HORSE_WHIP = 0x3E2, + NOUN_CORNER_TABLE = 0x3E3, + NOUN_BOA = 0x3E4, + NOUN_WIG_STAND = 0x3E5, + NOUN_PARTITION = 0x3E6, + NOUN_MEGAPHONE = 0x3E7, + NOUN_SLIP = 0x3E8, + NOUN_SCONCE = 0x3E9, + NOUN_VANITY = 0x3EA, + NOUN_BEDBOARD = 0x3EB, + NOUN_LOVE_SEAT = 0x3EC, + NOUN_SOUVENIR_TICKETS = 0x3ED, + NOUN_REVIEW = 0x3EE, + NOUN_BRUCE_AT_THE_GALA = 0x3EF, + NOUN_ART_DECO_RUG = 0x3F0, + NOUN_LIVINGROOM = 0x3F1, + NOUN_SCULPTURE = 0x3F2, + NOUN_SPECIMEN_EPITHET = 0x3F3, + NOUN_VENT = 0x3F4, + NOUN_FLOWER_BOX = 0x3F5, + NOUN_LEDGE = 0x3F6, + NOUN_BOLT = 0x3F7, + NOUN_OBSERVATION_WINDOW = 0x3F8, + NOUN_AIR_HOSE = 0x3F9, + NOUN_AUTO_SHOP = 0x3FA, + NOUN_MANHOLE = 0x3FB, + NOUN_AUTO_SHOP_ENTRANCE = 0x3FC, + NOUN_BROKEN_WINDOW = 0x3FD, + NOUN_WOMANHOLE = 0x3FE, + NOUN_GARAGE_DOOR = 0x3FF, + NOUN_SCRATCH_PAD = 0x400, + NOUN_GAS_PRICES = 0x401, + NOUN_UP_BUTTON = 0x402, + NOUN_DOWN_BUTTON = 0x403, + NOUN_SPARE_PARTS_LIST = 0x404, + NOUN_SKYLIGHT = 0x405, + NOUN_TOOL_BOX = 0x406, + NOUN_CAR_LIFT = 0x407, + NOUN_CAR_SEAT = 0x408, + NOUN_GARAGE_FLOOR = 0x409, + NOUN_GARAGE_DOOR_CONTROLS = 0x40A, + NOUN_AMISH_HAT = 0x40B, + NOUN_JACK = 0x40C, + NOUN_COILS = 0x40D, + NOUN_OIL_CAN = 0x40E, + NOUN_FAN_BELTS = 0x40F, + NOUN_REAR_OF_GARAGE = 0x410, + NOUN_FRONT_OF_GARAGE = 0x411, + NOUN_MUFFLER = 0x412, + NOUN_SPARE_PART = 0x413, + NOUN_HUBCAP = 0x414, + NOUN_CANDLE = 0x415, + NOUN_RATES = 0x416, + NOUN_GREASE_CAN = 0x417, + NOUN_CALENDAR = 0x418, + NOUN_FORK_LIFT = 0x419, + NOUN_TRASH_CAN = 0x41A, + NOUN_SHAKER_CHAIR = 0x41B, + NOUN_QUARTER_PANEL = 0x41C, + NOUN_AREA_BEHIND_CAR = 0x41D, + NOUN_DANGER_ZONE = 0x41E, + NOUN_NEWSSTAND = 0x41F, + NOUN_LADY_GODIVA_MONUMENT = 0x420, + NOUN_SPOT_A_POT = 0x421, + NOUN_GUARD_RAIL = 0x422, + NOUN_ALLEY = 0x423, + NOUN_DITCH = 0x424, + NOUN_VIDEO_STORE_DOOR = 0x425, + NOUN_BUCKLUSTER_MARQUEE = 0x426, + NOUN_VIDEO_STORE = 0x427, + NOUN_HORMONE_BILLBOARD = 0x428, + NOUN_PHONE_ANTENNA = 0x429, + NOUN_RETURN_SLOT = 0x42A, + NOUN_NOOSE = 0x42B, + NOUN_COMEDY_VIDEOS = 0x42C, + NOUN_SMELLY_SNEAKER = 0x42D, + NOUN_PIPPYS_STOCKING = 0x42E, + NOUN_PHONE_CRADLE = 0x42F, + NOUN_DRAMA_VIDEOS = 0x430, + NOUN_SPOTLIGHT = 0x431, + NOUN_STOREROOM_FLOOR = 0x432, + NOUN_ALL_SALES_FINAL = 0x433, + NOUN_MACHOPROSE_TEE_SHIRT = 0x434, + NOUN_UNKNOWN_COMIC_HANDS = 0x435, + NOUN_WET_CEMENT = 0x436, + NOUN_PIPPYS_TINY_IMPRINT = 0x437, + NOUN_OBNOXIOUS_DOG_PAWS = 0x438, + NOUN_LEG_AND_A_LEG_JEANS = 0x439, + NOUN_VIDEO_STORE_EXIT = 0x43A, + NOUN_AISLE = 0x43B, + NOUN_VIDEO_MONITOR = 0x43C, + NOUN_POLLY_PIGS_IMPRINT = 0x43D, + NOUN_JOHN_WYNNS_IMPRINT = 0x43E, + NOUN_MR_NEDS_IMPRINT = 0x43F, + NOUN_PEG_LEG_PETE_IMPRINT = 0x440, + NOUN_MARX_BROS_POSTER = 0x441, + NOUN_PIPPY_BILLBOARD = 0x442, + NOUN_VIDEOS_NOONE_WANTS = 0x443, + NOUN_MORE_CLASSIC_VIDEOS = 0x444, + NOUN_JOIN_OUR_PRICE_CLUB = 0x445, + NOUN_EDUCATIONAL_VIDEOS = 0x446, + NOUN_DEEP_DISCOUNT_TITLES = 0x447, + NOUN_WORLD_CHAMPS_POSTER = 0x448, + NOUN_WORKOUT_VIDEOS = 0x449, + NOUN_20_PERCENT_OFF_SIGN = 0x44A, + NOUN_CIVILIZATION_AD = 0x44B, + NOUN_NEW_RELEASE_VIDEOS = 0x44C, + NOUN_PORNO_VIDEOS = 0x44D, + NOUN_FOREIGN_VIDEOS = 0x44E, + NOUN_CLASSIC_VIDEOS = 0x44F, + NOUN_ADVENTURE_VIDEOS = 0x450, + NOUN_BUCKLUSTER_LOGO = 0x451, + NOUN_WINE_BOTTLE = 0x452, + NOUN_DIRT_PILE = 0x453, + NOUN_MAMMOTH_PENCIL_HEAD = 0x454, + NOUN_WREAKY_PUMPKIN = 0x455, + NOUN_MILK_CARTON = 0x456, + NOUN_BUCKET = 0x457, + NOUN_EMPTY_BOX = 0x458, + NOUN_DIAPER_BOX = 0x459, + NOUN_HERMIT = 0x45A, + NOUN_METAL_PIPE = 0x45B, + NOUN_CONCRETE_SUPPORT = 0x45C, + NOUN_VARIOUS_TRASH = 0x45D, + NOUN_ARMATURE = 0x45E, + NOUN_CONTROL_BOX = 0x45F, + NOUN_TOP_OF_DOME = 0x460, + NOUN_EXPRESSWAY_TO_EAST = 0x461, + NOUN_GO_TOWARDS = 0x462, + NOUN_EXPRESSWAY_TO_WEST = 0x463, + NOUN_DOME = 0x464, + NOUN_VIEW_OF_CITY = 0x465, + NOUN_EXPRESSWAY = 0x466, + NOUN_HOOK = 0x467, + NOUN_SEA_MONSTER = 0x468, + NOUN_EDGE_OF_VOLCANO = 0x469, + NOUN_JUMP_THROUGH = 0x46A, + NOUN_OLD_TEA_CUP = 0x46B, + NOUN_NAME_PLATE = 0x46C, + NOUN_OLD_VASE = 0x46D, + NOUN_PORTRAIT = 0x46E, + NOUN_PUT_DOWN = 0x46F, + NOUN_TALL_BUILDING = 0x470, + NOUN_OBNOXIOUS_DOG = 0x471, + NOUN_GUTS = 0x472, + NOUN_BIG_HEADS = 0x473, + NOUN_INSTALL = 0x474, + NOUN_LIFE_SUPPORT_MODULE = 0x475, + NOUN_REMOVE = 0x476, + NOUN_LARGE_BLADE = 0x477, + NOUN_SIDE_ENTRANCE = 0x478, + NOUN_INDICATOR = 0x479, + NOUN_SIGNPOST = 0x47A, + NOUN_PIN = 0x47B, + NOUN_POWDER_PUFF = 0x47C, + NOUN_SHELVES = 0x47D, + NOUN_ELECTRODES = 0x47E, + NOUN_MISHAP2 = 0x47F, + NOUN_ISLD_SUPERSTRUCTURE = 0x480, + NOUN_FILE_CABINETS = 0x481, + NOUN_CYCLE_SHOP = 0x482, + NOUN_AIR_BIKE = 0x483, + NOUN_EMERGENCY_LIGHT = 0x484, + NOUN_TARGET_AREA = 0x485, + NOUN_ICE_CHESTS = 0x486, + NOUN_BIRDS = 0x487, + NOUN_DOCTORS_OFFICE = 0x488, + NOUN_DEFACE = 0x489, + NOUN_LARGE_HEADS = 0x48A, + NOUN_SMALL_TABLE = 0x48B, + NOUN_COLLOSSEUM = 0x48C, + NOUN_HOUSE = 0x48D, + NOUN_BALCONY = 0x48E, + NOUN_GARDEN_ROOM = 0x48F, + NOUN_COVE_LIGHTS = 0x490, + NOUN_MASKS = 0x491, + NOUN_NEON_LIGHTS = 0x492, + NOUN_GLASS_BLOCK_WALL = 0x493, + NOUN_SCREEN = 0x494, + NOUN_SPARE_RIBS = 0x495, + NOUN_BANNER = 0x496, + NOUN_INSTRUCTIONAL_VIDEOS = 0x497, + NOUN_CEMENT = 0x498, + NOUN_STORE = 0x499, + NOUN_CARDBOARD_BOX = 0x49A, + NOUN_GRAFFITTI = 0x49B, + NOUN_GRAFFITI = 0x49C, + NOUN_PHOTOGRAPH = 0x49D, + NOUN_DIRECTORS_SLATE = 0x49E, + NOUN_CROP = 0x49F, + NOUN_HAT = 0x4A0, + NOUN_LOGO = 0x4A1, + NOUN_MAINTENANCE_BUILDING = 0x4A2, + NOUN_MASSAGE = 0x4A3, + NOUN_MANGLE = 0x4A4, + NOUN_RUB = 0x4A5, + NOUN_JUGGLE = 0x4A6, + NOUN_SMASH = 0x4A7, + NOUN_GUZZLE = 0x4A8, NOUN_WEST_END_OF_PLATFORM = 0x4A9, - NOUN_EAST_END_OF_PLATFORM = 0x4AA + NOUN_EAST_END_OF_PLATFORM = 0x4AA, + NOUN_FOLD = 0x4AB, + NOUN_SPINDLE = 0x4AC, + NOUN_MUTILATE = 0x4AD }; class SceneFactory { diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 7c4af52760..04c646f2cf 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -268,7 +268,7 @@ void Scene101::step() { } void Scene101::preActions() { - if (_action.isAction(VERB_LOOK, 0x180)) + if (_action.isAction(VERB_LOOK, NOUN_VIEW_SCREEN)) _game._player._needToWalk = true; if (_sittingFl) { @@ -424,13 +424,13 @@ void Scene101::actions() { return; } - if (_action.isAction(VERB_OPEN, 0x135) && _panelOpened) { + if (_action.isAction(VERB_OPEN, NOUN_SHIELD_ACCESS_PANEL) && _panelOpened) { _vm->_dialogs->show(10130); _action._inProgress = false; return; } - if (_action.isAction(VERB_LOOK, 0x180) && _sittingFl) { + if (_action.isAction(VERB_LOOK, NOUN_VIEW_SCREEN) && _sittingFl) { if (_globals[kWatchedViewScreen]) { sayDang(); } else { @@ -469,7 +469,7 @@ void Scene101::actions() { return; } - if (_action.isAction(VERB_LOOK, 0x47)) { + if (_action.isAction(VERB_LOOK, NOUN_CHAIR)) { _vm->_dialogs->show(10101); _action._inProgress = false; return; @@ -481,115 +481,115 @@ void Scene101::actions() { return; } - if (_action.isAction(VERB_LOOK, 0xA8) || _action.isAction(VERB_LOOK, 0xF8) || _action.isAction(VERB_EXAMINE, 0xA8) || _action.isAction(VERB_EXAMINE, 0xF8)) { + if (_action.isAction(VERB_LOOK, NOUN_HULL) || _action.isAction(VERB_LOOK, NOUN_OUTER_HULL) || _action.isAction(VERB_EXAMINE, NOUN_HULL) || _action.isAction(VERB_EXAMINE, NOUN_OUTER_HULL)) { _vm->_dialogs->show(10103); _action._inProgress = false; return; } - if (_action.isAction(VERB_LOOK, 0x91)) { + if (_action.isAction(VERB_LOOK, NOUN_FUZZY_DICE)) { _vm->_dialogs->show(10104); _action._inProgress = false; return; } - if (_action.isAction(VERB_LOOK, 0xE1) || _action.isAction(VERB_LOOK_IN, 0xE1)) { + if (_action.isAction(VERB_LOOK, NOUN_MIRROR) || _action.isAction(VERB_LOOK_IN, NOUN_MIRROR)) { _vm->_dialogs->show(10105); _action._inProgress = false; return; } - if (_action.isAction(VERB_LOOK, 0x60)) { + if (_action.isAction(VERB_LOOK, NOUN_CURTAINS)) { _vm->_dialogs->show(10106); _action._inProgress = false; return; } - if (_action.isAction(VERB_LOOK, 0x111)) { + if (_action.isAction(VERB_LOOK, NOUN_PLASTIC_JESUS)) { _vm->_dialogs->show(10107); _action._inProgress = false; return; } - if (_action.isAction(VERB_LOOK, 0x7B) || (_action.isAction(VERB_OPEN, 0x7B) && !_game._objects.isInInventory(OBJ_REBREATHER))) { + if (_action.isAction(VERB_LOOK, NOUN_ESCAPE_HATCH) || (_action.isAction(VERB_OPEN, NOUN_ESCAPE_HATCH) && !_game._objects.isInInventory(OBJ_REBREATHER))) { _vm->_dialogs->show(10109); _action._inProgress = false; return; } - if (_action.isAction(VERB_OPEN, 0x7B)) { + if (_action.isAction(VERB_OPEN, NOUN_ESCAPE_HATCH)) { _vm->_dialogs->show(10110); _action._inProgress = false; return; } - if (_action.isAction(VERB_LOOK, 0x166)) { + if (_action.isAction(VERB_LOOK, NOUN_TARGET_COMPUTER)) { _vm->_dialogs->show(10111); _action._inProgress = false; return; } - if (_action.isAction(VERB_LOOK, 0xCA)) { + if (_action.isAction(VERB_LOOK, NOUN_LIBRARY_COMPUTER)) { _vm->_dialogs->show(10126); _action._inProgress = false; return; } - if (_action.isAction(VERB_LOOK, 0x63)) { + if (_action.isAction(VERB_LOOK, NOUN_DAMAGE_CONTROL_PANEL)) { _vm->_dialogs->show(10112); _action._inProgress = false; return; } - if (_action.isAction(VERB_LOOK, 0xEB)) { + if (_action.isAction(VERB_LOOK, NOUN_NAVIGATION_CONTROLS)) { _vm->_dialogs->show(10113); _action._inProgress = false; return; } - if (_action.isAction(VERB_LOOK, 0x78)) { + if (_action.isAction(VERB_LOOK, NOUN_ENGINEERING_CONTROLS)) { _vm->_dialogs->show(10114); _action._inProgress = false; return; } - if (_action.isAction(VERB_LOOK, 0x190)) { + if (_action.isAction(VERB_LOOK, NOUN_WEAPONS_DISPLAY)) { _vm->_dialogs->show(10115); _action._inProgress = false; return; } - if (_action.isAction(VERB_LOOK, 0x138)) { + if (_action.isAction(VERB_LOOK, NOUN_SHIELD_STATUS_PANEL)) { _vm->_dialogs->show(10116); _action._inProgress = false; return; } - if (_action.isAction(VERB_TAKE, 0x111)) { + if (_action.isAction(VERB_TAKE, NOUN_PLASTIC_JESUS)) { _vm->_dialogs->show(10118); _action._inProgress = false; return; } - if (_action.isAction(VERB_TAKE, 0x91)) { + if (_action.isAction(VERB_TAKE, NOUN_FUZZY_DICE)) { _vm->_dialogs->show(10119); _action._inProgress = false; return; } - if (_action.isAction(VERB_OPEN, 0x63)) { + if (_action.isAction(VERB_OPEN, NOUN_DAMAGE_CONTROL_PANEL)) { _vm->_dialogs->show(10121); _action._inProgress = false; return; } - if (_action.isAction(VERB_OPEN, 0x60)) { + if (_action.isAction(VERB_OPEN, NOUN_CURTAINS)) { _vm->_dialogs->show(10122); _action._inProgress = false; return; } - if (_action.isAction(VERB_CLOSE, 0x60)) { + if (_action.isAction(VERB_CLOSE, NOUN_CURTAINS)) { _vm->_dialogs->show(10123); _action._inProgress = false; return; @@ -875,7 +875,7 @@ void Scene102::actions() { return; } - if (_action.isAction(VERB_WALK_THROUGH, 0x6E)) { + if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOOR)) { switch (_game._trigger) { case 0: _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 6, 1, 0, 0); @@ -892,43 +892,43 @@ void Scene102::actions() { return; } - if (_action.isAction(VERB_WALKTO, 0x79)) { + if (_action.isAction(VERB_WALKTO, NOUN_ENGINEERING_SECTION)) { _scene->_nextSceneId = 103; _action._inProgress = false; return; } - if (_action.isAction(VERB_WALKTO, 0x117) || _action.isAction(VERB_LOOK, 0x117) || _action.isAction(VERB_WALKTO, 0x27)) { + if (_action.isAction(VERB_WALKTO, NOUN_POSTER) || _action.isAction(VERB_LOOK, NOUN_POSTER) || _action.isAction(VERB_WALKTO, NOUN_BINOCULARS)) { addRandomMessage(); _action._inProgress = false; return; } - if (_action.isAction(VERB_LOOK, 0x194)) { + if (_action.isAction(VERB_LOOK, NOUN_WEIGHT_MACHINE)) { _vm->_dialogs->show(10212); _action._inProgress = false; return; } - if (_action.isAction(VERB_LOOK, 0x79)) { + if (_action.isAction(VERB_LOOK, NOUN_ENGINEERING_SECTION)) { _vm->_dialogs->show(10205); _action._inProgress = false; return; } - if (_action.isAction(VERB_LOOK, 0x6E)) { + if (_action.isAction(VERB_LOOK, NOUN_DOOR)) { _vm->_dialogs->show(10204); _action._inProgress = false; return; } - if (_action.isAction(VERB_STARE_AT, 0x46) || _action.isAction(VERB_LOOK, 0x46)) { + if (_action.isAction(VERB_STARE_AT, NOUN_CEILING) || _action.isAction(VERB_LOOK, NOUN_CEILING)) { _vm->_dialogs->show(10203); _action._inProgress = false; return; } - if (_action.isAction(VERB_STARE_AT, 0xFD) || _action.isAction(VERB_LOOK, 0xFD)) { + if (_action.isAction(VERB_STARE_AT, NOUN_OVERHEAD_LAMP) || _action.isAction(VERB_LOOK, NOUN_OVERHEAD_LAMP)) { _vm->_dialogs->show(10202); _action._inProgress = false; return; @@ -964,7 +964,7 @@ void Scene102::actions() { return; } - if (_action.isAction(VERB_LOOK, 0x52)) { + if (_action.isAction(VERB_LOOK, NOUN_CLOSET)) { _vm->_dialogs->show(10219); _action._inProgress = false; return; @@ -1019,19 +1019,19 @@ void Scene102::actions() { return; } - if (_action.isAction(VERB_LOOK, 0x118)) { + if (_action.isAction(VERB_LOOK, NOUN_POWER_STATUS_PANEL)) { _vm->_dialogs->show(10226); _action._inProgress = false; return; } - if (_action.isAction(VERB_LOOK, 0x197) || _action.isAction(VERB_LOOK_THROUGH, 0x197)) { + if (_action.isAction(VERB_LOOK, NOUN_WINDOW) || _action.isAction(VERB_LOOK_THROUGH, NOUN_WINDOW)) { _vm->_dialogs->show(10227); _action._inProgress = false; return; } - if (_action.isAction(VERB_LOOK, 0x70) || _action.isAction(VERB_WALKTO, 0x70)) { + if (_action.isAction(VERB_LOOK, NOUN_DOORWAY) || _action.isAction(VERB_WALKTO, NOUN_DOORWAY)) { _vm->_dialogs->show(10228); _action._inProgress = false; return; @@ -1056,20 +1056,20 @@ void Scene102::actions() { return; } - if (_action.isAction(VERB_LOOK, 0x47) || (_action.isAction(VERB_SIT_IN, 0x47) && !_chairDescrFl)) { + if (_action.isAction(VERB_LOOK, NOUN_CHAIR) || (_action.isAction(VERB_SIT_IN, NOUN_CHAIR) && !_chairDescrFl)) { _chairDescrFl = true; _vm->_dialogs->show(10210); _action._inProgress = false; return; } - if (_action.isAction(VERB_SIT_IN, 0x47)) { + if (_action.isAction(VERB_SIT_IN, NOUN_CHAIR)) { _vm->_dialogs->show(10211); _action._inProgress = false; return; } - if (_action.isAction(VERB_LOOK, 0xDE)) { + if (_action.isAction(VERB_LOOK, NOUN_MEDICINE_CABINET)) { if (_globals[kMedicineCabinetOpen]) _vm->_dialogs->show(10207); else @@ -1079,7 +1079,7 @@ void Scene102::actions() { return; } - if (_action.isAction(VERB_CLOSE, 0xDE) && _globals[kMedicineCabinetOpen]) { + if (_action.isAction(VERB_CLOSE, NOUN_MEDICINE_CABINET) && _globals[kMedicineCabinetOpen]) { switch (_game._trigger) { case 0: _scene->_sequences.remove(_globals._sequenceIndexes[8]); @@ -1103,7 +1103,7 @@ void Scene102::actions() { return; } - if (_action.isAction(VERB_OPEN, 0xDE) && !_globals[kMedicineCabinetOpen]) { + if (_action.isAction(VERB_OPEN, NOUN_MEDICINE_CABINET) && !_globals[kMedicineCabinetOpen]) { switch (_game._trigger) { case 0: _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 6, 1, 0, 0); @@ -1133,7 +1133,7 @@ void Scene102::actions() { return; } - if (_action.isAction(VERB_TAKE, 0x27) && _game._objects.isInRoom(OBJ_BINOCULARS)) { + if (_action.isAction(VERB_TAKE, NOUN_BINOCULARS) && _game._objects.isInRoom(OBJ_BINOCULARS)) { switch (_game._trigger) { case 0: _globals._sequenceIndexes[11] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[11], false, 3, 1, 0, 0); @@ -1157,7 +1157,7 @@ void Scene102::actions() { return; } - if (_action.isAction(VERB_TAKE, 0x35) && _game._objects.isInRoom(OBJ_BURGER)) { + if (_action.isAction(VERB_TAKE, NOUN_BURGER) && _game._objects.isInRoom(OBJ_BURGER)) { if (_game._trigger == 0) { _vm->_dialogs->showItem(OBJ_BURGER, 10235); _scene->_sequences.remove(_globals._sequenceIndexes[10]); @@ -1171,7 +1171,7 @@ void Scene102::actions() { return; } - if (_action.isAction(VERB_TAKE, 0x117)) { + if (_action.isAction(VERB_TAKE, NOUN_POSTER)) { _vm->_dialogs->show(10224); _action._inProgress = false; return; @@ -1183,26 +1183,26 @@ void Scene102::actions() { return; } - if (_action.isAction(VERB_LOOK, 0x89)) { + if (_action.isAction(VERB_LOOK, NOUN_FLOOR)) { _vm->_dialogs->show(10232); _action._inProgress = false; return; } - if (_action.isAction(VERB_LOOK, 0x27) && !_game._objects.isInInventory(OBJ_BINOCULARS)) { + if (_action.isAction(VERB_LOOK, NOUN_BINOCULARS) && !_game._objects.isInInventory(OBJ_BINOCULARS)) { _vm->_dialogs->show(10233); _action._inProgress = false; return; } - if (_action.isAction(VERB_LOOK, 0x35) && (_action._mainObjectSource == 4)) { + if (_action.isAction(VERB_LOOK, NOUN_BURGER) && (_action._mainObjectSource == 4)) { _vm->_dialogs->show(801); _action._inProgress = false; } } void Scene102::postActions() { - if (_action.isAction(VERB_PUT, 0x127) && _game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId))) { + if (_action.isAction(VERB_PUT, NOUN_ROBO_KITCHEN) && _game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId))) { _vm->_dialogs->show(10217); _action._inProgress = false; } @@ -1716,23 +1716,23 @@ void Scene104::step() { } void Scene104::preActions() { - if (_action.isAction(VERB_SWIM_TOWARDS, 0x74)) + if (_action.isAction(VERB_SWIM_TOWARDS, NOUN_EASTERN_CLIFF_FACE)) _game._player._walkOffScreenSceneId = 105; - if (_action.isAction(VERB_SWIM_TOWARDS, 0x75)) + if (_action.isAction(VERB_SWIM_TOWARDS, NOUN_EAT)) _game._player._walkOffScreenSceneId = 106; } void Scene104::actions() { if (_action._lookFlag) _vm->_dialogs->show(10405); - else if (_action.isAction(VERB_LOOK, 0x5E)) + else if (_action.isAction(VERB_LOOK, NOUN_CURIOUS_WEED_PATCH)) _vm->_dialogs->show(10404); - else if (_action.isAction(VERB_LOOK, 0x158)) + else if (_action.isAction(VERB_LOOK, NOUN_SURFACE)) _vm->_dialogs->show(10403); - else if (_action.isAction(VERB_LOOK, 0x4D)) + else if (_action.isAction(VERB_LOOK, NOUN_CLIFF_FACE)) _vm->_dialogs->show(10401); - else if (_action.isAction(VERB_LOOK, 0xF0)) + else if (_action.isAction(VERB_LOOK, NOUN_OCEAN_FLOOR)) _vm->_dialogs->show(10402); else return; @@ -1843,10 +1843,10 @@ void Scene105::step() { } void Scene105::preActions() { - if (_action.isAction(VERB_SWIM_TOWARDS, 0x195)) + if (_action.isAction(VERB_SWIM_TOWARDS, NOUN_WESTERN_CLIFF_FACE)) _game._player._walkOffScreenSceneId = 104; - if (_action.isAction(VERB_SWIM_TOWARDS, 0xF5)) + if (_action.isAction(VERB_SWIM_TOWARDS, NOUN_OPEN_AREA_TO_SOUTH)) _game._player._walkOffScreenSceneId = 107; if (_action.isObject(0xE0) && (_action.isAction(VERB_TALKTO) || _action.isAction(VERB_LOOK))) @@ -1856,7 +1856,7 @@ void Scene105::preActions() { void Scene105::actions() { if (_action._lookFlag) _vm->_dialogs->show(10512); - else if (_action.isAction(VERB_TAKE, 0x65) && _globals[kFishIn105]) { + else if (_action.isAction(VERB_TAKE, NOUN_DEAD_FISH) && _globals[kFishIn105]) { if (_game._objects.isInInventory(OBJ_DEAD_FISH)) { int randVal = _vm->getRandomNumber(74, 76); _scene->_kernelMessages.reset(); @@ -1867,25 +1867,25 @@ void Scene105::actions() { _globals[kFishIn105] = false; _vm->_dialogs->showItem(OBJ_DEAD_FISH, 802, 0); } - } else if (_action.isAction(VERB_LOOK, 0x195)) + } else if (_action.isAction(VERB_LOOK, NOUN_WESTERN_CLIFF_FACE)) _vm->_dialogs->show(10501); - else if (_action.isAction(VERB_LOOK, 0x4D)) + else if (_action.isAction(VERB_LOOK, NOUN_CLIFF_FACE)) _vm->_dialogs->show(10502); - else if (_action.isAction(VERB_LOOK, 0xF0)) + else if (_action.isAction(VERB_LOOK, NOUN_OCEAN_FLOOR)) _vm->_dialogs->show(10503); - else if (_action.isAction(VERB_LOOK, 0xDD)) + else if (_action.isAction(VERB_LOOK, NOUN_MEDICAL_WASTE)) _vm->_dialogs->show(10504); - else if (_action.isAction(VERB_TAKE, 0xDD)) + else if (_action.isAction(VERB_TAKE, NOUN_MEDICAL_WASTE)) _vm->_dialogs->show(10505); - else if (_action.isAction(VERB_LOOK, 0xE0)) + else if (_action.isAction(VERB_LOOK, NOUN_MINE)) _vm->_dialogs->show(10506); - else if (_action.isAction(VERB_LOOK, 0x65)) + else if (_action.isAction(VERB_LOOK, NOUN_DEAD_FISH)) _vm->_dialogs->show(10508); - else if (_action.isAction(VERB_LOOK, 0x158)) + else if (_action.isAction(VERB_LOOK, NOUN_SURFACE)) _vm->_dialogs->show(10509); - else if (_action.isAction(VERB_LOOK, 0xF5)) + else if (_action.isAction(VERB_LOOK, NOUN_OPEN_AREA_TO_SOUTH)) _vm->_dialogs->show(10510); - else if (_action.isAction(VERB_LOOK, 0x129)) + else if (_action.isAction(VERB_LOOK, NOUN_ROCKS)) _vm->_dialogs->show(10511); else return; @@ -2052,20 +2052,20 @@ void Scene106::step() { } void Scene106::preActions() { - if (_action.isAction(VERB_SWIM_TOWARDS, 0x12E) || _action.isAction(VERB_SWIM_TOWARDS, 0x130)) { + if (_action.isAction(VERB_SWIM_TOWARDS, NOUN_SEA_CLIFF) || _action.isAction(VERB_SWIM_TOWARDS, NOUN_SEAWEED_BANK)) { _game._player._stepEnabled = false; _scene->_sprites[_game._player._spritesStart + 1]->_charInfo->_velocity = 24; _game._player._walkOffScreenSceneId = 104; } - if (_action.isAction(VERB_SWIM_TOWARDS, 0xF3)) + if (_action.isAction(VERB_SWIM_TOWARDS, NOUN_OPEN_AREA_TO_EAST)) _game._player._walkOffScreenSceneId = 107; } void Scene106::actions() { if (_action._lookFlag) _vm->_dialogs->show(10614); - else if (_action.isAction(VERB_SWIM_TO, 0xD9)) { + else if (_action.isAction(VERB_SWIM_TO, NOUN_MAIN_AIRLOCK)) { _game._player._stepEnabled = false; _game._player._prepareWalkPos = Common::Point(95, 72); _game._player._prepareWalkFacing = FACING_WEST; @@ -2073,31 +2073,31 @@ void Scene106::actions() { _game._player._readyToWalk = true; _game._player._frameNumber = 9; _backToShipFl = true; - } else if (_action.isAction(VERB_LOOK, 0x13) || _action.isAction(VERB_LOOK_AT, 0x13)) + } else if (_action.isAction(VERB_LOOK, NOUN_ANEMONE) || _action.isAction(VERB_LOOK_AT, NOUN_ANEMONE)) _vm->_dialogs->show(10601); - else if (_action.isAction(VERB_TAKE, 0x13)) + else if (_action.isAction(VERB_TAKE, NOUN_ANEMONE)) _vm->_dialogs->show(10602); - else if (_action.isAction(VERB_LOOK, 0x12F) || _action.isAction(VERB_LOOK, 0x130)) + else if (_action.isAction(VERB_LOOK, NOUN_SEAWEED) || _action.isAction(VERB_LOOK, NOUN_SEAWEED_BANK)) _vm->_dialogs->show(10603); - else if (_action.isAction(VERB_TAKE, 0x12F) || _action.isAction(VERB_TAKE, 0x130)) + else if (_action.isAction(VERB_TAKE, NOUN_SEAWEED) || _action.isAction(VERB_TAKE, NOUN_SEAWEED_BANK)) _vm->_dialogs->show(10604); - else if (_action.isAction(VERB_LOOK, 0xF3)) + else if (_action.isAction(VERB_LOOK, NOUN_OPEN_AREA_TO_EAST)) _vm->_dialogs->show(10605); - else if (_action.isAction(VERB_LOOK, 0x109) || _action.isAction(VERB_LOOK_AT, 0x109)) + else if (_action.isAction(VERB_LOOK, NOUN_PILE_OF_ROCKS) || _action.isAction(VERB_LOOK_AT, NOUN_PILE_OF_ROCKS)) _vm->_dialogs->show(10606); else if (_action.isObject(0x109) && (_action.isAction(VERB_PUSH) || _action.isAction(VERB_PULL) || _action.isAction(VERB_TAKE))) _vm->_dialogs->show(10607); - else if (_action.isAction(VERB_LOOK, 0x139) || _action.isAction(VERB_LOOK_AT, 0x139)) + else if (_action.isAction(VERB_LOOK, NOUN_SHIP) || _action.isAction(VERB_LOOK_AT, NOUN_SHIP)) _vm->_dialogs->show(10608); - else if (_action.isAction(VERB_LOOK, 0xD9)) + else if (_action.isAction(VERB_LOOK, NOUN_MAIN_AIRLOCK)) _vm->_dialogs->show(10609); - else if (_action.isAction(VERB_OPEN, 0xD9)) + else if (_action.isAction(VERB_OPEN, NOUN_MAIN_AIRLOCK)) _vm->_dialogs->show(10610); - else if (_action.isAction(VERB_CLOSE, 0xD9)) + else if (_action.isAction(VERB_CLOSE, NOUN_MAIN_AIRLOCK)) _vm->_dialogs->show(10611); - else if (_action.isAction(VERB_LOOK, 0x12E)) + else if (_action.isAction(VERB_LOOK, NOUN_SEA_CLIFF)) _vm->_dialogs->show(10612); - else if (_action.isAction(VERB_LOOK, 0xF0)) + else if (_action.isAction(VERB_LOOK, NOUN_OCEAN_FLOOR)) _vm->_dialogs->show(10613); else return; @@ -2178,17 +2178,17 @@ void Scene107::step() { } void Scene107::preActions() { - if (_action.isAction(VERB_SWIM_TOWARDS, 0xF6)) + if (_action.isAction(VERB_SWIM_TOWARDS, NOUN_OPEN_AREA_TO_WEST)) _game._player._walkOffScreenSceneId = 106; - if (_action.isAction(VERB_SWIM_TOWARDS, 0xF5)) + if (_action.isAction(VERB_SWIM_TOWARDS, NOUN_OPEN_AREA_TO_SOUTH)) _game._player._walkOffScreenSceneId = 108; } void Scene107::actions() { if (_action._lookFlag) _vm->_dialogs->show(10708); - else if (_action.isAction(VERB_TAKE, 0x65) && _globals[kFishIn107]) { + else if (_action.isAction(VERB_TAKE, NOUN_DEAD_FISH) && _globals[kFishIn107]) { if (_game._objects.isInInventory(OBJ_DEAD_FISH)) { int randVal = _vm->getRandomNumber(74, 76); _scene->_kernelMessages.reset(); @@ -2199,25 +2199,25 @@ void Scene107::actions() { _globals[kFishIn107] = false; _vm->_dialogs->showItem(OBJ_DEAD_FISH, 802); } - } else if (_action.isAction(VERB_SWIM_TOWARDS, 0xEE)) + } else if (_action.isAction(VERB_SWIM_TOWARDS, NOUN_NORTHERN_SEA_CLIFF)) _scene->_nextSceneId = 105; - else if (_action.isAction(VERB_LOOK, 0xEE)) + else if (_action.isAction(VERB_LOOK, NOUN_NORTHERN_SEA_CLIFF)) _vm->_dialogs->show(10701); - else if (_action.isAction(VERB_LOOK, 0x65) && (_action._mainObjectSource == 4)) + else if (_action.isAction(VERB_LOOK, NOUN_DEAD_FISH) && (_action._mainObjectSource == 4)) _vm->_dialogs->show(10702); - else if (_action.isAction(VERB_LOOK, 0x38)) + else if (_action.isAction(VERB_LOOK, NOUN_BUSH_LIKE_FORMATION)) _vm->_dialogs->show(10703); - else if (_action.isAction(VERB_LOOK, 0x128)) + else if (_action.isAction(VERB_LOOK, NOUN_ROCK)) _vm->_dialogs->show(10704); - else if (_action.isAction(VERB_LOOK, 0x12F)) + else if (_action.isAction(VERB_LOOK, NOUN_SEAWEED)) _vm->_dialogs->show(10705); - else if (_action.isAction(VERB_LOOK, 0xF5)) + else if (_action.isAction(VERB_LOOK, NOUN_OPEN_AREA_TO_SOUTH)) _vm->_dialogs->show(10706); - else if (_action.isAction(VERB_LOOK, 0x4D)) + else if (_action.isAction(VERB_LOOK, NOUN_CLIFF_FACE)) _vm->_dialogs->show(10707); - else if (_action.isAction(VERB_LOOK, 0xDA)) + else if (_action.isAction(VERB_LOOK, NOUN_MANTA_RAY)) _vm->_dialogs->show(10709); - else if (_action.isAction(VERB_TAKE, 0xDA)) + else if (_action.isAction(VERB_TAKE, NOUN_MANTA_RAY)) _vm->_dialogs->show(10710); else return; @@ -2273,14 +2273,14 @@ void Scene108::enter() { } void Scene108::preActions() { - if (_action.isAction(VERB_SWIM_UNDER, 0xFB)) + if (_action.isAction(VERB_SWIM_UNDER, NOUN_OVERHANG_TO_EAST)) _game._player._walkOffScreenSceneId = 109; } void Scene108::actions() { if (_action._lookFlag) _vm->_dialogs->show(10812); - else if (_action.isAction(VERB_TAKE, 0x65) && _globals[kFishIn108]) { + else if (_action.isAction(VERB_TAKE, NOUN_DEAD_FISH) && _globals[kFishIn108]) { if (_game._objects.isInInventory(OBJ_DEAD_FISH)) { int randVal = _vm->getRandomNumber(74, 76); _scene->_kernelMessages.reset(); @@ -2291,27 +2291,27 @@ void Scene108::actions() { _globals[kFishIn108] = false; _vm->_dialogs->showItem(OBJ_DEAD_FISH, 10808); } - } else if (_action.isAction(VERB_SWIM_TOWARDS, 0xF4)) + } else if (_action.isAction(VERB_SWIM_TOWARDS, NOUN_OPEN_AREA_TO_NORTH)) _scene->_nextSceneId = 107; - else if (_action.isAction(VERB_LOOK, 0x4D)) + else if (_action.isAction(VERB_LOOK, NOUN_CLIFF_FACE)) _vm->_dialogs->show(10801); - else if (_action.isAction(VERB_LOOK, 0xF0)) + else if (_action.isAction(VERB_LOOK, NOUN_OCEAN_FLOOR)) _vm->_dialogs->show(10802); - else if (_action.isAction(VERB_LOOK, 0xF1)) + else if (_action.isAction(VERB_LOOK, NOUN_ODD_ROCK_FORMATION)) _vm->_dialogs->show(10803); - else if (_action.isAction(VERB_TAKE, 0xF1)) + else if (_action.isAction(VERB_TAKE, NOUN_ODD_ROCK_FORMATION)) _vm->_dialogs->show(10804); - else if (_action.isAction(VERB_LOOK, 0x129)) + else if (_action.isAction(VERB_LOOK, NOUN_ROCKS)) _vm->_dialogs->show(10805); - else if (_action.isAction(VERB_TAKE, 0x129)) + else if (_action.isAction(VERB_TAKE, NOUN_ROCKS)) _vm->_dialogs->show(10806); - else if (_action.isAction(VERB_LOOK, 0x65)) + else if (_action.isAction(VERB_LOOK, NOUN_DEAD_FISH)) _vm->_dialogs->show(10807); - else if (_action.isAction(VERB_LOOK, 0xFB)) + else if (_action.isAction(VERB_LOOK, NOUN_OVERHANG_TO_EAST)) _vm->_dialogs->show(10809); - else if (_action.isAction(VERB_LOOK, 0xF4)) + else if (_action.isAction(VERB_LOOK, NOUN_OPEN_AREA_TO_NORTH)) _vm->_dialogs->show(10810); - else if (_action.isAction(VERB_LOOK, 0x158)) + else if (_action.isAction(VERB_LOOK, NOUN_SURFACE)) _vm->_dialogs->show(10811); else return; @@ -2485,7 +2485,7 @@ void Scene109::step() { } void Scene109::preActions() { - if (_action.isAction(VERB_SWIM_UNDER, 0xFC)) + if (_action.isAction(VERB_SWIM_UNDER, NOUN_OVERHANG_TO_WEST)) _game._player._walkOffScreenSceneId = 108; if ((_action.isAction(VERB_THROW) || _action.isAction(VERB_GIVE) || _action.isAction(VERB_PUT)) @@ -2500,7 +2500,7 @@ void Scene109::preActions() { } } - if ((_action.isAction(VERB_SWIM_INTO, 0x178) || _action.isAction(VERB_SWIM_TO, 0x146)) + if ((_action.isAction(VERB_SWIM_INTO, NOUN_TUNNEL) || _action.isAction(VERB_SWIM_TO, NOUN_SMALL_HOLE)) && (!_globals[kHoovicAlive] || _globals[kHoovicSated]) && (_action.isObject(0x178))) _game._player._walkOffScreenSceneId = 110; @@ -2685,33 +2685,33 @@ void Scene109::actions() { } } - if (_action.isAction(VERB_TAKE, 0x35) && _game._objects.isInRoom(OBJ_BURGER)) { + if (_action.isAction(VERB_TAKE, NOUN_BURGER) && _game._objects.isInRoom(OBJ_BURGER)) { _scene->_sequences.remove(_globals._sequenceIndexes[3]); _game._objects.addToInventory(OBJ_BURGER); - } else if (_action.isAction(VERB_LOOK, 0xF0)) + } else if (_action.isAction(VERB_LOOK, NOUN_OCEAN_FLOOR)) _vm->_dialogs->show(10901); - else if (_action.isAction(VERB_LOOK, 0x5A)) + else if (_action.isAction(VERB_LOOK, NOUN_CORAL)) _vm->_dialogs->show(10902); else if ((_action.isAction(VERB_TAKE) || _action.isAction(VERB_PULL)) && _action.isObject(0x5A)) _vm->_dialogs->show(10903); - else if (_action.isAction(VERB_LOOK, 0x129)) + else if (_action.isAction(VERB_LOOK, NOUN_ROCKS)) _vm->_dialogs->show(10904); - else if (_action.isAction(VERB_TAKE, 0x129)) + else if (_action.isAction(VERB_TAKE, NOUN_ROCKS)) _vm->_dialogs->show(10905); - else if (_action.isAction(VERB_LOOK, 0x45)) + else if (_action.isAction(VERB_LOOK, NOUN_CAVE_WALL)) _vm->_dialogs->show(10906); - else if (_action.isAction(VERB_LOOK, 0x178)) { + else if (_action.isAction(VERB_LOOK, NOUN_TUNNEL)) { if (_globals[kHoovicAlive]) _vm->_dialogs->show(10907); else _vm->_dialogs->show(10913); - } else if (_action.isAction(VERB_LOOK, 0x146)) + } else if (_action.isAction(VERB_LOOK, NOUN_SMALL_HOLE)) _vm->_dialogs->show(10908); - else if (_action.isAction(VERB_LOOK, 0xFC)) + else if (_action.isAction(VERB_LOOK, NOUN_OVERHANG_TO_WEST)) _vm->_dialogs->show(10911); - else if (_action.isAction(VERB_PUT, 0x146)) + else if (_action.isAction(VERB_PUT, NOUN_SMALL_HOLE)) _vm->_dialogs->show(10910); - else if (_action.isAction(VERB_LOOK, 0x66)) + else if (_action.isAction(VERB_LOOK, NOUN_DEAD_PURPLE_MONSTER)) _vm->_dialogs->show(10914); else return; @@ -2789,7 +2789,7 @@ void Scene110::step() { } void Scene110::preActions() { - if (_action.isAction(VERB_SWIM_THROUGH, 0x41)) + if (_action.isAction(VERB_SWIM_THROUGH, NOUN_CAVE_ENTRANCE)) _game._player._walkOffScreenSceneId = 109; if (_crabsFl) { @@ -2817,7 +2817,7 @@ void Scene110::preActions() { } void Scene110::actions() { - if (_action.isAction(VERB_SWIM_THROUGH, 0x178)) { + if (_action.isAction(VERB_SWIM_THROUGH, NOUN_TUNNEL)) { switch (_game._trigger) { case 0: _scene->loadAnimation(Resources::formatName(110, 'T', 0, EXT_AA, ""), 1); @@ -2831,21 +2831,21 @@ void Scene110::actions() { _scene->_nextSceneId = 111; break; } - } else if ((_action._lookFlag) || _action.isAction(VERB_LOOK, 0x3F)) + } else if ((_action._lookFlag) || _action.isAction(VERB_LOOK, NOUN_CAVE)) _vm->_dialogs->show(11001); - else if (_action.isAction(VERB_LOOK, 0x40) || _action.isAction(VERB_LOOK_AT, 0x40)) + else if (_action.isAction(VERB_LOOK, NOUN_CAVE_CEILING) || _action.isAction(VERB_LOOK_AT, NOUN_CAVE_CEILING)) _vm->_dialogs->show(11002); - else if (_action.isAction(VERB_LOOK, 0x129)) + else if (_action.isAction(VERB_LOOK, NOUN_ROCKS)) _vm->_dialogs->show(11003); - else if (_action.isAction(VERB_TAKE, 0x129)) + else if (_action.isAction(VERB_TAKE, NOUN_ROCKS)) _vm->_dialogs->show(11004); - else if (_action.isAction(VERB_LOOK, 0x178)) + else if (_action.isAction(VERB_LOOK, NOUN_TUNNEL)) _vm->_dialogs->show(11005); - else if (_action.isAction(VERB_LOOK, 0x41)) + else if (_action.isAction(VERB_LOOK, NOUN_CAVE_ENTRANCE)) _vm->_dialogs->show(11006); - else if (_action.isAction(VERB_LOOK, 0x8F)) + else if (_action.isAction(VERB_LOOK, NOUN_FUNGOIDS)) _vm->_dialogs->show(11007); - else if (_action.isAction(VERB_TAKE, 0x8F)) + else if (_action.isAction(VERB_TAKE, NOUN_FUNGOIDS)) _vm->_dialogs->show(11008); else return; @@ -2964,12 +2964,12 @@ void Scene111::step() { } void Scene111::preActions() { - if (_action.isAction(VERB_WALK_THROUGH, 0x41)) + if (_action.isAction(VERB_WALK_THROUGH, NOUN_CAVE_ENTRANCE)) _game._player._walkOffScreenSceneId = 212; } void Scene111::actions() { - if (_action.isAction(VERB_DIVE_INTO, 0x116) && _game._objects.isInInventory(OBJ_REBREATHER)) { + if (_action.isAction(VERB_DIVE_INTO, NOUN_POOL) && _game._objects.isInInventory(OBJ_REBREATHER)) { switch (_game._trigger) { case 0: _scene->loadAnimation(Resources::formatName(111, 'A', 1, EXT_AA, ""), 1); @@ -2982,15 +2982,15 @@ void Scene111::actions() { _scene->_nextSceneId = 110; break; } - } else if (_action.isAction(VERB_LOOK, 0x43)) + } else if (_action.isAction(VERB_LOOK, NOUN_CAVE_FLOOR)) _vm->_dialogs->show(11101); - else if (_action.isAction(VERB_LOOK, 0x116)) + else if (_action.isAction(VERB_LOOK, NOUN_POOL)) _vm->_dialogs->show(11102); - else if (_action.isAction(VERB_LOOK, 0x41)) + else if (_action.isAction(VERB_LOOK, NOUN_CAVE_ENTRANCE)) _vm->_dialogs->show(11103); - else if (_action.isAction(VERB_LOOK, 0x153)) + else if (_action.isAction(VERB_LOOK, NOUN_STALAGMITES)) _vm->_dialogs->show(11104); - else if (_action.isAction(VERB_LOOK, 0xC8)) + else if (_action.isAction(VERB_LOOK, NOUN_LARGE_STALAGMITE)) _vm->_dialogs->show(11105); else if ((_action.isAction(VERB_PULL) || _action.isAction(VERB_TAKE)) && (_action.isObject(0x153) || _action.isObject(0xC8))) _vm->_dialogs->show(11106); diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index cfb261c72b..173c641240 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -121,7 +121,7 @@ void Scene201::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(NOUN_15F); + _scene->addActiveVocab(NOUN_SWOOPING_CREATURE); _scene->addActiveVocab(NOUN_BIRDS); _scene->addActiveVocab(VERB_WALKTO); } @@ -280,9 +280,9 @@ void Scene201::step() { void Scene201::actions() { if (_action._lookFlag == false) { - if (_action.isAction(VERB_WALK_TOWARDS, 0x83)) + if (_action.isAction(VERB_WALK_TOWARDS, NOUN_FIELD_TO_SOUTH)) _scene->_nextSceneId = 202; - else if ((_action.isAction(VERB_CLIMB_UP, 0x156)) || (_action.isAction(VERB_WALK_INSIDE, NOUN_TELEPORTER)) || (_action.isAction(VERB_WALK_INSIDE, NOUN_STRANGE_DEVICE))) { + else if ((_action.isAction(VERB_CLIMB_UP, NOUN_STEPS)) || (_action.isAction(VERB_WALK_INSIDE, NOUN_TELEPORTER)) || (_action.isAction(VERB_WALK_INSIDE, NOUN_STRANGE_DEVICE))) { if (_game._trigger == 0) { _game._player._stepEnabled = false; _game._player._visible = false; @@ -291,30 +291,30 @@ void Scene201::actions() { } else if (_game._trigger == 1) { _scene->_nextSceneId = 213; } - } else if (_action.isAction(VERB_LOOK, 0x1A6)) { + } else if (_action.isAction(VERB_LOOK, NOUN_GRASSY_FIELD)) { _vm->_dialogs->show(20101); - } else if (_action.isAction(VERB_LOOK, 0x129)) { + } else if (_action.isAction(VERB_LOOK, NOUN_ROCKS)) { _vm->_dialogs->show(20102); - } else if (_action.isAction(VERB_LOOK, 0x16F)) { + } else if (_action.isAction(VERB_LOOK, NOUN_THORNY_BUSH)) { _vm->_dialogs->show(20103); - } else if (_action.isAction(VERB_LOOK, 0x142)) { + } else if (_action.isAction(VERB_LOOK, NOUN_SKY)) { _vm->_dialogs->show(20104); - } else if (_action.isAction(VERB_LOOK, 0x18F)) { + } else if (_action.isAction(VERB_LOOK, NOUN_WATER)) { _vm->_dialogs->show(20105); - } else if (_action.isAction(VERB_LOOK, 0x1B9)) { + } else if (_action.isAction(VERB_LOOK, NOUN_ISLAND_IN_DISTANCE)) { _vm->_dialogs->show(20106); - } else if (_action.isAction(VERB_LOOK, 0x192)) { + } else if (_action.isAction(VERB_LOOK, NOUN_WEATHER_STATION)) { _vm->_dialogs->show(20107); - } else if (_action.isAction(VERB_LOOK, 0x1BA)) { + } else if (_action.isAction(VERB_LOOK, NOUN_PATH)) { _vm->_dialogs->show(20108); - } else if (_action.isAction(VERB_LOOK, 0x83)) { + } else if (_action.isAction(VERB_LOOK, NOUN_FIELD_TO_SOUTH)) { _vm->_dialogs->show(20110); - } else if (_action.isAction(VERB_LOOK, 0x1B6)) { + } else if (_action.isAction(VERB_LOOK, NOUN_STRANGE_DEVICE)) { if (_globals[kMeteorologistEverSeen]) _vm->_dialogs->show(20112); else _vm->_dialogs->show(20109); - } else if (_action.isAction(VERB_LOOK, 0x16C)) { + } else if (_action.isAction(VERB_LOOK, NOUN_TELEPORTER)) { _vm->_dialogs->show(20113); } else return; @@ -731,7 +731,7 @@ void Scene202::preActions() { } } - if (_action.isAction(VERB_LOOK, 0x27) && (_action._activeAction._indirectObjectId > 0)) { + if (_action.isAction(VERB_LOOK, NOUN_BINOCULARS) && (_action._activeAction._indirectObjectId > 0)) { if (!player._readyToWalk || _ladderTopFl) _game._player._needToWalk = false; else @@ -751,9 +751,9 @@ void Scene202::actions() { if (_action.isAction(VERB_CLIMB_DOWN, NOUN_LADDER)) { _action._inProgress = false; return; - } else if (_action.isAction(VERB_WALK_TOWARDS, 0x83)) { + } else if (_action.isAction(VERB_WALK_TOWARDS, NOUN_FIELD_TO_SOUTH)) { _scene->_nextSceneId = 203; - } else if (_action.isAction(VERB_WALK_TOWARDS, 0x82)) { + } else if (_action.isAction(VERB_WALK_TOWARDS, NOUN_FIELD_TO_NORTH)) { if (_globals[kMeteorologistStatus] != METEOROLOGIST_GONE) { if (_scene->_activeAnimation) _globals[kMeteorologistStatus] = METEOROLOGIST_PRESENT; @@ -930,37 +930,37 @@ void Scene202::actions() { return; } } - } else if (_action.isAction(VERB_WALK_INSIDE, 0xAA)) { + } else if (_action.isAction(VERB_WALK_INSIDE, NOUN_HUT)) { setRandomKernelMessage(); } else if (_action.isAction(VERB_LOOK, NOUN_ROCKS)) { _vm->_dialogs->show(20202); - } else if (_action.isAction(VERB_LOOK, 0x86)) { + } else if (_action.isAction(VERB_LOOK, NOUN_FIRE_PIT)) { _vm->_dialogs->show(20203); - } else if (_action.isAction(VERB_LOOK, 0x19C)) { + } else if (_action.isAction(VERB_LOOK, NOUN_GRASS)) { _vm->_dialogs->show(20204); - } else if (_action.isAction(VERB_LOOK, 0x82)) { + } else if (_action.isAction(VERB_LOOK, NOUN_FIELD_TO_NORTH)) { if ((_globals[kMeteorologistStatus] == METEOROLOGIST_ABSENT) || (_globals[kMeteorologistStatus] == METEOROLOGIST_GONE)) _vm->_dialogs->show(20205); else if (_globals[kMeteorologistStatus] == METEOROLOGIST_PRESENT) _vm->_dialogs->show(20220); - } else if (_action.isAction(VERB_LOOK, 0x18E)) { + } else if (_action.isAction(VERB_LOOK, NOUN_WATCH_TOWER)) { _vm->_dialogs->show(20206); - } else if (_action.isAction(VERB_LOOK, 0x164)) { + } else if (_action.isAction(VERB_LOOK, NOUN_TALL_GRASS)) { _vm->_dialogs->show(20207); - } else if (_action.isAction(VERB_LOOK, 0x175)) { + } else if (_action.isAction(VERB_LOOK, NOUN_TREES)) { _vm->_dialogs->show(20208); - } else if (_action.isAction(VERB_LOOK, 0x174)) { + } else if (_action.isAction(VERB_LOOK, NOUN_TREE)) { _vm->_dialogs->show(20209); - } else if (_action.isAction(VERB_LOOK, 0x142)) { + } else if (_action.isAction(VERB_LOOK, NOUN_SKY)) { _vm->_dialogs->show(20210); - } else if (_action.isAction(VERB_LOOK, 0xAA)) { + } else if (_action.isAction(VERB_LOOK, NOUN_HUT)) { if ((_game._player._playerPos == Common::Point(77, 105)) && (_game._player._facing == FACING_NORTH)) _vm->_dialogs->show(20212); else _vm->_dialogs->show(20211); } else if (_action.isAction(VERB_LOOK, NOUN_STRANGE_DEVICE)) { _vm->_dialogs->show(20213); - } else if (_action.isAction(VERB_LOOK, 0x1B5)) { + } else if (_action.isAction(VERB_LOOK, NOUN_OCEAN_IN_DISTANCE)) { _vm->_dialogs->show(20214); } else if (_action.isAction(VERB_LOOK, NOUN_SKULL)) { _vm->_dialogs->show(20215); @@ -1070,34 +1070,34 @@ void Scene203::step() { } void Scene203::preActions() { - if (_rhotundaEatFl && !_action.isAction(VERB_WALK_TOWARDS, 0x83)) { + if (_rhotundaEatFl && !_action.isAction(VERB_WALK_TOWARDS, NOUN_FIELD_TO_SOUTH)) { _game._player.walk(Common::Point(158, 136), FACING_SOUTH); _action._inProgress = false; return; } - if (_action.isAction(VERB_WALKTO, 0xF3)) + if (_action.isAction(VERB_WALKTO, NOUN_OPEN_AREA_TO_EAST)) _game._player._walkOffScreenSceneId = 209; } void Scene203::actions() { if (_action._savedFields._lookFlag) { _vm->_dialogs->show(20307); - } else if (_action.isAction(VERB_WALK_TOWARDS, 0x83)) { + } else if (_action.isAction(VERB_WALK_TOWARDS, NOUN_FIELD_TO_SOUTH)) { _scene->_nextSceneId = 208; - } else if (_action.isAction(VERB_WALK_TOWARDS, 0x82)) { + } else if (_action.isAction(VERB_WALK_TOWARDS, NOUN_FIELD_TO_NORTH)) { _scene->_nextSceneId = 202; - } else if (_action.isAction(VERB_LOOK, 0x142)) { + } else if (_action.isAction(VERB_LOOK, NOUN_SKY)) { _vm->_dialogs->show(20301); - } else if (_action.isAction(VERB_LOOK, 0x4D)) { + } else if (_action.isAction(VERB_LOOK, NOUN_CLIFF_FACE)) { _vm->_dialogs->show(20302); - } else if (_action.isAction(VERB_LOOK, 0x100)) { + } else if (_action.isAction(VERB_LOOK, NOUN_PALM_TREE)) { _vm->_dialogs->show(20303); - } else if (_action.isAction(VERB_LOOK, 0x82)) { + } else if (_action.isAction(VERB_LOOK, NOUN_FIELD_TO_NORTH)) { _vm->_dialogs->show(20304); - } else if (_action.isAction(VERB_LOOK, 0x1A6)) { + } else if (_action.isAction(VERB_LOOK, NOUN_GRASSY_FIELD)) { _vm->_dialogs->show(20305); - } else if (_action.isAction(VERB_LOOK, 0x30)) { + } else if (_action.isAction(VERB_LOOK, NOUN_BOULDERS)) { _vm->_dialogs->show(20305); } else return; @@ -1301,9 +1301,9 @@ void Scene205::actions() { } } else if (_action._lookFlag) _vm->_dialogs->show(20502); - else if (_action.isAction(VERB_LOOK, 0x27, 0x1C8)) + else if (_action.isAction(VERB_LOOK, NOUN_BINOCULARS, 0x1C8)) _vm->_dialogs->show(20518); - else if (_action.isAction(VERB_TALKTO, 0x1DC)) { + else if (_action.isAction(VERB_TALKTO, NOUN_NATIVE_WOMAN)) { if (_game._trigger == 0) { _game._player._stepEnabled = false; _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 18, 1, 120, _game.getQuote(0x73)); @@ -1314,14 +1314,14 @@ void Scene205::actions() { _dialog1.write(0x75, true); _dialog1.start(); } - } else if (_action.isAction(VERB_GIVE, 0x1DC) && _game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId))) { + } else if (_action.isAction(VERB_GIVE, NOUN_NATIVE_WOMAN) && _game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId))) { if (_game._trigger == 0) { _game._player._stepEnabled = false; int rndVal = _vm->getRandomNumber(0xAC, 0xAE); _scene->_kernelMessages.add(Common::Point(186, 27), 0xFBFA, 32, 1, 120, _game.getQuote(rndVal)); } else if (_game._trigger == 1) _game._player._stepEnabled = true; - } else if (_action.isAction(VERB_WALKTO, 0x1C8)) { + } else if (_action.isAction(VERB_WALKTO, NOUN_OPPOSITE_BANK)) { if (_game._trigger == 0) { _game._player._visible = false; _game._player._stepEnabled = false; @@ -1342,50 +1342,50 @@ void Scene205::actions() { _scene->_reloadSceneFlag = true; } } else { - if (_action.isAction(VERB_WALK_DOWN, 0x1C7)) + if (_action.isAction(VERB_WALK_DOWN, NOUN_PATH_TO_SOUTH)) _scene->_nextSceneId = 210; - if (_action.isAction(VERB_WALKTO, 0x86) || _action.isAction(VERB_WALKTO, 0x1C2)) { + if (_action.isAction(VERB_WALKTO, NOUN_FIRE_PIT) || _action.isAction(VERB_WALKTO, NOUN_CHICKEN_ON_SPIT)) { if (_game._objects.isInRoom(OBJ_CHICKEN)) { _scene->_kernelMessages.reset(); _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x6B)); } - } else if (_action.isAction(VERB_TAKE, 0x1C2) && _globals[kChickenPermitted] && _game._objects.isInRoom(OBJ_CHICKEN)) { + } else if (_action.isAction(VERB_TAKE, NOUN_CHICKEN_ON_SPIT) && _globals[kChickenPermitted] && _game._objects.isInRoom(OBJ_CHICKEN)) { _game._objects.addToInventory(OBJ_CHICKEN); _scene->_sequences.remove(_globals._sequenceIndexes[4]); _scene->_hotspots.activate(0x1C2, false); _vm->_dialogs->showItem(OBJ_CHICKEN, 812); - } else if (_action.isAction(VERB_TAKE, 0x1C2) && (!_globals[kChickenPermitted])) + } else if (_action.isAction(VERB_TAKE, NOUN_CHICKEN_ON_SPIT) && (!_globals[kChickenPermitted])) _scene->_kernelMessages.add(Common::Point(186, 27), 0xFBFA, 32, 0, 120, _game.getQuote(0x80)); - else if (_action.isAction(VERB_LOOK, 0x1DC)) + else if (_action.isAction(VERB_LOOK, NOUN_NATIVE_WOMAN)) _vm->_dialogs->show(20503); - else if (_action.isAction(VERB_LOOK, 0xAA)) + else if (_action.isAction(VERB_LOOK, NOUN_HUT)) _vm->_dialogs->show(20504); - else if (_action.isAction(VERB_LOOK, 0x49) && (_action._mainObjectSource == 4)) + else if (_action.isAction(VERB_LOOK, NOUN_CHICKEN) && (_action._mainObjectSource == 4)) _vm->_dialogs->show(20505); - else if (_action.isAction(VERB_TAKE, 0x49) && (_action._mainObjectSource == 4)) + else if (_action.isAction(VERB_TAKE, NOUN_CHICKEN) && (_action._mainObjectSource == 4)) _vm->_dialogs->show(20506); - else if (_action.isAction(VERB_LOOK, 0x1C2)) + else if (_action.isAction(VERB_LOOK, NOUN_CHICKEN_ON_SPIT)) _vm->_dialogs->show(20507); - else if (_action.isAction(VERB_LOOK, 0x86)) + else if (_action.isAction(VERB_LOOK, NOUN_FIRE_PIT)) _vm->_dialogs->show(20508); - else if (_action.isAction(VERB_TAKE, 0x86)) + else if (_action.isAction(VERB_TAKE, NOUN_FIRE_PIT)) _vm->_dialogs->show(20509); - else if (_action.isAction(VERB_LOOK, 0x1C5)) + else if (_action.isAction(VERB_LOOK, NOUN_STREAM)) _vm->_dialogs->show(20510); - else if (_action.isAction(VERB_LOOK, 0x1C8)) + else if (_action.isAction(VERB_LOOK, NOUN_OPPOSITE_BANK)) _vm->_dialogs->show(20511); else if (_game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId)) - && ( _action.isAction(VERB_GIVE, 0x1C5) || _action.isAction(VERB_THROW, 0x1C5) - || _action.isAction(VERB_GIVE, 0x10D) || _action.isAction(VERB_THROW, 0x10D))) + && ( _action.isAction(VERB_GIVE, NOUN_STREAM) || _action.isAction(VERB_THROW, NOUN_STREAM) + || _action.isAction(VERB_GIVE, NOUN_PIRANHA) || _action.isAction(VERB_THROW, NOUN_PIRANHA))) _vm->_dialogs->show(20512); - else if (_action.isAction(VERB_LOOK, 0x10D)) + else if (_action.isAction(VERB_LOOK, NOUN_PIRANHA)) _vm->_dialogs->show(20513); - else if (_action.isAction(VERB_LOOK, 0x1C4)) + else if (_action.isAction(VERB_LOOK, NOUN_TWINKIFRUIT_BUSH)) _vm->_dialogs->show(20514); - else if (_action.isAction(VERB_TAKE, 0x1C4)) + else if (_action.isAction(VERB_TAKE, NOUN_TWINKIFRUIT_BUSH)) _vm->_dialogs->show(20515); - else if (_action.isAction(VERB_TAKE, 0x1DC)) + else if (_action.isAction(VERB_TAKE, NOUN_NATIVE_WOMAN)) _vm->_dialogs->show(20517); else return; @@ -1519,10 +1519,10 @@ void Scene207::step() { } void Scene207::preActions() { - if (_action.isAction(VERB_WALK_DOWN, 0x1AE)) + if (_action.isAction(VERB_WALK_DOWN, NOUN_PATH_TO_WEST)) _game._player._walkOffScreenSceneId = 211; - if (_action.isAction(VERB_WALK_TOWARDS, 0x1AB)) + if (_action.isAction(VERB_WALK_TOWARDS, NOUN_OPEN_FIELD_TO_EAST)) _game._player._walkOffScreenSceneId = 208; if ((_action.isAction(VERB_WALKTO)) || (_action.isAction(VERB_LOOK))) { @@ -1537,7 +1537,7 @@ void Scene207::preActions() { void Scene207::actions() { if (_action._savedFields._lookFlag) { _vm->_dialogs->show(20711); - } else if (_action.isAction(VERB_WALK_THROUGH, 0x70)) { + } else if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOORWAY)) { _scene->_nextSceneId = 214; } else { if ((_game._player._playerPos.x > 150) && (_game._player._playerPos.x < 189) && @@ -1555,33 +1555,33 @@ void Scene207::actions() { _eyeFl = false; } - if (_action.isAction(VERB_LOOK, 0x69)) { + if (_action.isAction(VERB_LOOK, NOUN_DENSE_FOREST)) { _vm->_dialogs->show(20701); - } else if (_action.isAction(VERB_LOOK, 0x1AF)) { + } else if (_action.isAction(VERB_LOOK, NOUN_HEDGE)) { _vm->_dialogs->show(20702); - } else if (_action.isAction(VERB_LOOK, 0x141)) { + } else if (_action.isAction(VERB_LOOK, NOUN_SKULL_AND_CROSSBONES)) { _vm->_dialogs->show(20703); - } else if (_action.isAction(VERB_LOOK, 0x3E)) { + } else if (_action.isAction(VERB_LOOK, NOUN_CAULDRON)) { _vm->_dialogs->show(20704); - } else if (_action.isAction(VERB_LOOK, 0x198)) { + } else if (_action.isAction(VERB_LOOK, NOUN_WITCHDOCTOR_HUT)) { _vm->_dialogs->show(20705); - } else if (_action.isAction(VERB_LOOK, 0x1AE)) { + } else if (_action.isAction(VERB_LOOK, NOUN_PATH_TO_WEST)) { _vm->_dialogs->show(20706); - } else if (_action.isAction(VERB_LOOK, 0xE8)) { + } else if (_action.isAction(VERB_LOOK, NOUN_MOUNTAINS)) { _vm->_dialogs->show(20707); - } else if (_action.isAction(VERB_LOOK, 0x12)) { + } else if (_action.isAction(VERB_LOOK, NOUN_ALOE_PLANT)) { _vm->_dialogs->show(20708); - } else if (_action.isAction(VERB_LOOK, 0x1AC)) { + } else if (_action.isAction(VERB_LOOK, NOUN_LAWN)) { _vm->_dialogs->show(20709); - } else if (_action.isAction(VERB_LOOK, 0x185)) { + } else if (_action.isAction(VERB_LOOK, NOUN_VULTURE)) { _vm->_dialogs->show(20710); - } else if (_action.isAction(VERB_TAKE, 0x141)) { + } else if (_action.isAction(VERB_TAKE, NOUN_SKULL_AND_CROSSBONES)) { _vm->_dialogs->show(20712); - } else if (_action.isAction(VERB_TAKE, 0x12)) { + } else if (_action.isAction(VERB_TAKE, NOUN_ALOE_PLANT)) { _vm->_dialogs->show(20713); - } else if (_action.isAction(VERB_LOOK, 0x14D)) { + } else if (_action.isAction(VERB_LOOK, NOUN_SPIDER)) { _vm->_dialogs->show(20714); - } else if (_action.isAction(VERB_TAKE, 0x14D)) { + } else if (_action.isAction(VERB_TAKE, NOUN_SPIDER)) { _vm->_dialogs->show(20715); } else return; @@ -1725,10 +1725,10 @@ void Scene208::preActions() { if (_action.isAction(VERB_LOOK) && player._readyToWalk) player._needToWalk = true; - if (_action.isAction(VERB_WALK_TOWARDS, 0x9B)) + if (_action.isAction(VERB_WALK_TOWARDS, NOUN_GRASSLAND_TO_EAST)) player._walkOffScreenSceneId = 209; - if (_action.isAction(VERB_WALK_TOWARDS, 0xF6)) + if (_action.isAction(VERB_WALK_TOWARDS, NOUN_OPEN_AREA_TO_WEST)) player._walkOffScreenSceneId = 207; } @@ -1804,7 +1804,7 @@ void Scene208::subAction(int mode) { } void Scene208::actions() { - if (_action.isAction(VERB_WALK_TOWARDS, 0x19F)) { + if (_action.isAction(VERB_WALK_TOWARDS, NOUN_LOWLANDS_TO_NORTH)) { if (_globals[kRhotundaStatus]) _scene->_nextSceneId = 203; else if (_game._trigger == 0) { @@ -1814,7 +1814,7 @@ void Scene208::actions() { } else if (_game._trigger == 1) { _scene->_nextSceneId = 203; } - } else if (_action.isAction(VERB_WALK_TOWARDS, 0x83)) { + } else if (_action.isAction(VERB_WALK_TOWARDS, NOUN_FIELD_TO_SOUTH)) { _scene->_nextSceneId = 212; } else if (_action.isAction(VERB_TAKE, NOUN_PILE_OF_LEAVES) && (!_globals[kLeavesStatus] || _game._trigger)) { subAction(1); @@ -1839,19 +1839,19 @@ void Scene208::actions() { if (_game._player._stepEnabled) { _vm->_dialogs->show(20812); } - } else if (_action.isAction(VERB_LOOK, 0x5D)) { + } else if (_action.isAction(VERB_LOOK, NOUN_CUMULOUS_CLOUD)) { _vm->_dialogs->show(20801); - } else if (_action.isAction(VERB_LOOK, 0xF6)) { + } else if (_action.isAction(VERB_LOOK, NOUN_OPEN_AREA_TO_WEST)) { _vm->_dialogs->show(20802); - } else if (_action.isAction(VERB_LOOK, 0x16F)) { + } else if (_action.isAction(VERB_LOOK, NOUN_THORNY_BUSH)) { _vm->_dialogs->show(20803); - } else if (_action.isAction(VERB_LOOK, 0x129)) { + } else if (_action.isAction(VERB_LOOK, NOUN_ROCKS)) { _vm->_dialogs->show(20804); - } else if (_action.isAction(VERB_LOOK, 0x1A1)) { + } else if (_action.isAction(VERB_LOOK, NOUN_SMALL_CACTUS)) { _vm->_dialogs->show(20805); - } else if (_action.isAction(VERB_TAKE, 0x1A1)) { + } else if (_action.isAction(VERB_TAKE, NOUN_SMALL_CACTUS)) { _vm->_dialogs->show(20806); - } else if (_action.isAction(VERB_LOOK, 0x9B)) { + } else if (_action.isAction(VERB_LOOK, NOUN_GRASSLAND_TO_EAST)) { _vm->_dialogs->show(20807); } else if (_action.isAction(VERB_LOOK, NOUN_DEEP_PIT)) { _vm->_dialogs->show(20808); @@ -1862,7 +1862,7 @@ void Scene208::actions() { _vm->_dialogs->show(20810); else _vm->_dialogs->show(20811); - } else if (_action.isAction(VERB_LOOK, 0x174) || _action.isAction(VERB_LOOK, 0x175)) { + } else if (_action.isAction(VERB_LOOK, NOUN_TREE) || _action.isAction(VERB_LOOK, NOUN_TREES)) { _vm->_dialogs->show(20813); } else if (_action.isAction(VERB_TAKE, NOUN_LEAF_COVERED_PIT)) { _vm->_dialogs->show(20814); @@ -3148,7 +3148,7 @@ void Scene209::step() { } void Scene209::preActions() { - if (_action.isAction(VERB_WALK_TOWARDS, 0x84)) + if (_action.isAction(VERB_WALK_TOWARDS, NOUN_FIELD_TO_WEST)) _game._player._walkOffScreenSceneId = 208; if (_globals[kMonkeyStatus] == MONKEY_HAS_BINOCULARS) { @@ -3176,7 +3176,7 @@ void Scene209::actions() { return; } - if (_action.isAction(VERB_WALK_TOWARDS, 0x1A2)) { + if (_action.isAction(VERB_WALK_TOWARDS, NOUN_ROCKY_AREA_TO_NORTH)) { _scene->_nextSceneId = 203; _action._inProgress = false; return; @@ -3353,7 +3353,7 @@ void Scene209::actions() { return; } - if (_action.isAction(VERB_TAKE, 0x27) && (_game._trigger || _game._objects.isInRoom(OBJ_BINOCULARS))) { + if (_action.isAction(VERB_TAKE, NOUN_BINOCULARS) && (_game._trigger || _game._objects.isInRoom(OBJ_BINOCULARS))) { switch (_game._trigger) { case 0: _globals._spriteIndexes[10] = _scene->_sprites.addSprites("*RXMBD_8"); @@ -3386,61 +3386,61 @@ void Scene209::actions() { return; } - if (_action.isAction(VERB_LOOK, 0x142)) { + if (_action.isAction(VERB_LOOK, NOUN_SKY)) { _vm->_dialogs->show(20901); _action._inProgress = false; return; } - if (_action.isAction(VERB_LOOK, 0x1A3)) { + if (_action.isAction(VERB_LOOK, NOUN_BAMBOO_LIKE_PLANT)) { _vm->_dialogs->show(20902); _action._inProgress = false; return; } - if (_action.isAction(VERB_LOOK, 0x1A4)) { + if (_action.isAction(VERB_LOOK, NOUN_MOUNTAINSIDE)) { _vm->_dialogs->show(20903); _action._inProgress = false; return; } - if (_action.isAction(VERB_LOOK, 0x1A6)) { + if (_action.isAction(VERB_LOOK, NOUN_GRASSY_FIELD)) { _vm->_dialogs->show(20904); _action._inProgress = false; return; } - if (_action.isAction(VERB_LOOK, 0x84)) { + if (_action.isAction(VERB_LOOK, NOUN_FIELD_TO_WEST)) { _vm->_dialogs->show(20905); _action._inProgress = false; return; } - if (_action.isAction(VERB_LOOK, 0x1A2)) { + if (_action.isAction(VERB_LOOK, NOUN_ROCKY_AREA_TO_NORTH)) { _vm->_dialogs->show(20906); _action._inProgress = false; return; } - if (_action.isAction(VERB_LOOK, 0x10F) && (_action._savedFields._mainObjectSource == 4)) { + if (_action.isAction(VERB_LOOK, NOUN_PLANT_STALK) && (_action._savedFields._mainObjectSource == 4)) { _vm->_dialogs->show(20907); _action._inProgress = false; return; } - if (_action.isAction(VERB_GIVE, 0x17A, 0xE3) || _action.isAction(VERB_THROW, 0x17A, 0xE3)) { + if (_action.isAction(VERB_GIVE, NOUN_TWINKIFRUIT, 0xE3) || _action.isAction(VERB_THROW, NOUN_TWINKIFRUIT, 0xE3)) { _vm->_dialogs->show(20909); _action._inProgress = false; return; } - if (_action.isAction(VERB_LOOK, 0x175)) { + if (_action.isAction(VERB_LOOK, NOUN_TREES)) { _vm->_dialogs->show(20913); _action._inProgress = false; return; } - if (_action.isAction(VERB_THROW, 0xE3) && _game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId))) { + if (_action.isAction(VERB_THROW, NOUN_MONKEY) && _game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId))) { if (!_action.isAction(0x114)) { _vm->_dialogs->show(20915); } @@ -3448,13 +3448,13 @@ void Scene209::actions() { return; } - if (_action.isAction(VERB_THROW, 0x114, 0xE3)) { + if (_action.isAction(VERB_THROW, NOUN_POISON_DARTS, 0xE3)) { _vm->_dialogs->show(20916); _action._inProgress = false; return; } - if (_action.isAction(VERB_LOOK, 0x100)) { + if (_action.isAction(VERB_LOOK, NOUN_PALM_TREE)) { if (_globals[kMonkeyStatus] == MONKEY_HAS_BINOCULARS) { if (_monkeyPosition == 1) _vm->_dialogs->show(20917); @@ -3470,13 +3470,13 @@ void Scene209::actions() { return; } - if (_action.isAction(VERB_LOOK, 0x3A4)) { + if (_action.isAction(VERB_LOOK, NOUN_MELON_MUSH)) { _vm->_dialogs->show(20920); _action._inProgress = false; return; } - if (_action.isAction(VERB_TAKE, 0x3A4)) { + if (_action.isAction(VERB_TAKE, NOUN_MELON_MUSH)) { _vm->_dialogs->show(20921); _action._inProgress = false; return; @@ -4321,16 +4321,16 @@ void Scene210::step() { void Scene210::preActions() { _stopWalking = false; - if (_action.isAction(VERB_WALK_DOWN, 0x1C1)) + if (_action.isAction(VERB_WALK_DOWN, NOUN_PATH_TO_EAST)) _game._player._walkOffScreenSceneId = 211; } void Scene210::actions() { - if (_action.isAction(VERB_LOOK, 0x27, 0x1C0)) { + if (_action.isAction(VERB_LOOK, NOUN_BINOCULARS, 0x1C0)) { _vm->_dialogs->show(21017); } else if (_game._screenObjects._inputMode == 1) { handleConversations(); - } else if (_action.isAction(VERB_TALKTO, 0x1DC) || + } else if (_action.isAction(VERB_TALKTO, NOUN_NATIVE_WOMAN) || ((_game._player._playerPos == Common::Point(214, 150)) && (_game._player._facing == FACING_NORTHWEST) && (_twinkleAnimationType == 1) && _stopWalking)) { switch (_game._trigger) { case 0: { @@ -4381,7 +4381,7 @@ void Scene210::actions() { _curDialogNode = 1; break; } - } else if (_action.isAction(VERB_GIVE, 0x1DC) && _game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId))) { + } else if (_action.isAction(VERB_GIVE, NOUN_NATIVE_WOMAN) && _game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId))) { switch (_game._trigger) { case 0: { int quote = _vm->getRandomNumber(172, 174); @@ -4397,11 +4397,11 @@ void Scene210::actions() { _shouldMoveHead = false; break; } - } else if (_action.isAction(VERB_WALK_DOWN, 0x1BF) || _action.isAction(VERB_WALK_TOWARDS, 0x1C0)) { + } else if (_action.isAction(VERB_WALK_DOWN, NOUN_PATH_TO_NORTH) || _action.isAction(VERB_WALK_TOWARDS, NOUN_HUT_TO_NORTH)) { _scene->_nextSceneId = 205; - } else if (_action.isAction(VERB_WALK_THROUGH, 0x70)) { + } else if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOORWAY)) { _scene->_nextSceneId = 215; - } else if ((_action.isAction(VERB_PULL, 0x5F) || _action.isAction(VERB_OPEN, 0x5F)) && !_globals[kCurtainOpen]) { + } else if ((_action.isAction(VERB_PULL, NOUN_CURTAIN) || _action.isAction(VERB_OPEN, NOUN_CURTAIN)) && !_globals[kCurtainOpen]) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -4419,7 +4419,7 @@ void Scene210::actions() { _scene->_dynamicHotspots.setCursor(_doorway, CURSOR_GO_UP); break; } - } else if ((_action.isAction(VERB_PULL, 0x5F) || _action.isAction(VERB_CLOSE, 0x5F)) && _globals[kCurtainOpen]) { + } else if ((_action.isAction(VERB_PULL, NOUN_CURTAIN) || _action.isAction(VERB_CLOSE, NOUN_CURTAIN)) && _globals[kCurtainOpen]) { switch (_game._trigger) { case 0: _scene->_sequences.remove(_globals._sequenceIndexes[1]); @@ -4441,7 +4441,7 @@ void Scene210::actions() { _globals[kCurtainOpen] = false; break; } - } else if (_action.isAction(VERB_LOOK, 0xAA)) { + } else if (_action.isAction(VERB_LOOK, NOUN_HUT)) { if (_globals[kTwinklesStatus] == TWINKLES_GONE) { if (_game._storyMode == STORYMODE_NAUGHTY) _vm->_dialogs->show(21003); @@ -4450,31 +4450,31 @@ void Scene210::actions() { } else { _vm->_dialogs->show(21001); } - } else if (_action.isAction(VERB_LOOK, 0x31)) { + } else if (_action.isAction(VERB_LOOK, NOUN_BRA)) { _vm->_dialogs->show(21004); - } else if (_action.isAction(VERB_LOOK, 0xA7)) { + } else if (_action.isAction(VERB_LOOK, NOUN_HOTPANTS)) { _vm->_dialogs->show(21005); - } else if (_action.isAction(VERB_TAKE, 0xA7) || _action.isAction(VERB_TAKE, 0x31)) { + } else if (_action.isAction(VERB_TAKE, NOUN_HOTPANTS) || _action.isAction(VERB_TAKE, NOUN_BRA)) { _vm->_dialogs->show(21006); - } else if (_action.isAction(VERB_LOOK, 0x1C5)) { + } else if (_action.isAction(VERB_LOOK, NOUN_STREAM)) { _vm->_dialogs->show(21007); - } else if (_action.isAction(VERB_LOOK, 0x3A)) { + } else if (_action.isAction(VERB_LOOK, NOUN_BUSHY_FERN)) { _vm->_dialogs->show(21008); - } else if (_action.isAction(VERB_LOOK, 0x1B0)) { + } else if (_action.isAction(VERB_LOOK, NOUN_VILLAGE_PATH)) { _vm->_dialogs->show(21009); - } else if (_action.isAction(VERB_LOOK, 0x1DC)) { + } else if (_action.isAction(VERB_LOOK, NOUN_NATIVE_WOMAN)) { _vm->_dialogs->show(21010); - } else if (_action.isAction(VERB_SHOOT, 0x1DC) || _action.isAction(VERB_HOSE_DOWN, 0x1DC)) { + } else if (_action.isAction(VERB_SHOOT, NOUN_NATIVE_WOMAN) || _action.isAction(VERB_HOSE_DOWN, NOUN_NATIVE_WOMAN)) { _vm->_dialogs->show(21011); - } else if (_action.isAction(VERB_LOOK, 0x1BF)) { + } else if (_action.isAction(VERB_LOOK, NOUN_PATH_TO_NORTH)) { _vm->_dialogs->show(21012); - } else if (_action.isAction(VERB_LOOK, 0x5F)) { + } else if (_action.isAction(VERB_LOOK, NOUN_CURTAIN)) { _vm->_dialogs->show(21013); - } else if (_action.isAction(VERB_LOOK, 0x53)) { + } else if (_action.isAction(VERB_LOOK, NOUN_CLOTHESLINE)) { _vm->_dialogs->show(21014); - } else if (_action.isAction(VERB_TAKE, 0x53)) { + } else if (_action.isAction(VERB_TAKE, NOUN_CLOTHESLINE)) { _vm->_dialogs->show(21015); - } else if (_action.isAction(VERB_LOOK, 0x1C0)) { + } else if (_action.isAction(VERB_LOOK, NOUN_HUT_TO_NORTH)) { _vm->_dialogs->show(21016); } else { // Not handled @@ -4721,31 +4721,31 @@ void Scene211::step() { } void Scene211::preActions() { - if (_action.isAction(VERB_WALK_DOWN, 0x1B2) && _game._objects.isInInventory(OBJ_BINOCULARS) && (_globals[kMonkeyStatus] == MONKEY_AMBUSH_READY) + if (_action.isAction(VERB_WALK_DOWN, NOUN_JUNGLE_PATH) && _game._objects.isInInventory(OBJ_BINOCULARS) && (_globals[kMonkeyStatus] == MONKEY_AMBUSH_READY) && (_scene->_customDest.x <= 52) && (_scene->_customDest.y >= 132)) _game._player.walk(Common::Point(52, 132), FACING_WEST); - if (_action.isAction(VERB_WALK_DOWN, 0x1AE)) { + if (_action.isAction(VERB_WALK_DOWN, NOUN_PATH_TO_WEST)) { if (_game._objects.isInInventory(OBJ_BINOCULARS) && (_globals[kMonkeyStatus] == MONKEY_AMBUSH_READY)) _game._player.walk(Common::Point(52, 132), FACING_WEST); else _game._player._walkOffScreenSceneId = 210; } - if (_action.isAction(VERB_WALK_DOWN, 0x1B1)) + if (_action.isAction(VERB_WALK_DOWN, NOUN_PATH_TO_NORTHEAST)) _game._player._walkOffScreenSceneId = 207; } void Scene211::actions() { if (_action._lookFlag && (_globals[kMonkeyStatus] == MONKEY_AMBUSH_READY)) _vm->_dialogs->show(21111); - else if (_action.isAction(VERB_LOOK, 0x27, 0x100)) + else if (_action.isAction(VERB_LOOK, NOUN_BINOCULARS, 0x100)) _vm->_dialogs->show(21116); - else if (_action.isAction(VERB_LOOK, 0x3A)) + else if (_action.isAction(VERB_LOOK, NOUN_BUSHY_FERN)) _vm->_dialogs->show(21101); - else if (_action.isAction(VERB_LOOK, 0x1B2)) + else if (_action.isAction(VERB_LOOK, NOUN_JUNGLE_PATH)) _vm->_dialogs->show(21102); - else if (_action.isAction(VERB_LOOK, 0x100)) { + else if (_action.isAction(VERB_LOOK, NOUN_PALM_TREE)) { if (_globals[kMonkeyStatus] == MONKEY_AMBUSH_READY) { if (_game._storyMode == STORYMODE_NAUGHTY) _vm->_dialogs->show(21103); @@ -4754,22 +4754,22 @@ void Scene211::actions() { } else { _vm->_dialogs->show(21105); } - } else if (_action.isAction(VERB_LOOK, 0x1B3)) { + } else if (_action.isAction(VERB_LOOK, NOUN_THICK_UNDERGROWTH)) { if (_game._storyMode == STORYMODE_NAUGHTY) _vm->_dialogs->show(21106); else _vm->_dialogs->show(21107); - } else if (_action.isAction(VERB_LOOK, 0xB8)) + } else if (_action.isAction(VERB_LOOK, NOUN_JUNGLE)) _vm->_dialogs->show(21108); - else if (_action.isAction(VERB_LOOK, 0x1B1)) + else if (_action.isAction(VERB_LOOK, NOUN_PATH_TO_NORTHEAST)) _vm->_dialogs->show(21109); - else if (_action.isAction(VERB_LOOK, 0x1AE)) + else if (_action.isAction(VERB_LOOK, NOUN_PATH_TO_WEST)) _vm->_dialogs->show(21110); - else if (_action.isAction(VERB_LOOK, 0x144)) + else if (_action.isAction(VERB_LOOK, NOUN_SLITHERING_SNAKE)) _vm->_dialogs->show(21113); - else if (_action.isAction(VERB_TAKE, 0x144)) + else if (_action.isAction(VERB_TAKE, NOUN_SLITHERING_SNAKE)) _vm->_dialogs->show(21114); - else if (_action.isAction(VERB_LOOK, 0x129)) + else if (_action.isAction(VERB_LOOK, NOUN_ROCKS)) _vm->_dialogs->show(21115); else return; @@ -4815,7 +4815,7 @@ void Scene212::step() { } void Scene212::preActions() { - if (_action.isAction(VERB_WALK_THROUGH, 0x41)) + if (_action.isAction(VERB_WALK_THROUGH, NOUN_CAVE_ENTRANCE)) _game._player._walkOffScreenSceneId = 111; } @@ -4824,23 +4824,23 @@ void Scene212::actions() { _vm->_dialogs->show(21209); else if (_action.isAction(VERB_WALK_TOWARDS) && (_action.isObject(0x82) || _action.isObject(0xE8))) _scene->_nextSceneId = 208; - else if (_action.isAction(VERB_WALK_TOWARDS, 0x3F)) + else if (_action.isAction(VERB_WALK_TOWARDS, NOUN_CAVE)) _scene->_nextSceneId = 111; - else if (_action.isAction(VERB_LOOK, 0x19C)) + else if (_action.isAction(VERB_LOOK, NOUN_GRASS)) _vm->_dialogs->show(21201); - else if (_action.isAction(VERB_LOOK, 0x129)) + else if (_action.isAction(VERB_LOOK, NOUN_ROCKS)) _vm->_dialogs->show(21202); - else if (_action.isAction(VERB_LOOK, 0x41)) + else if (_action.isAction(VERB_LOOK, NOUN_CAVE_ENTRANCE)) _vm->_dialogs->show(21203); - else if (_action.isAction(VERB_LOOK, 0x142)) + else if (_action.isAction(VERB_LOOK, NOUN_SKY)) _vm->_dialogs->show(21204); - else if (_action.isAction(VERB_LOOK, 0x82)) + else if (_action.isAction(VERB_LOOK, NOUN_FIELD_TO_NORTH)) _vm->_dialogs->show(21205); - else if (_action.isAction(VERB_LOOK, 0x175)) + else if (_action.isAction(VERB_LOOK, NOUN_TREES)) _vm->_dialogs->show(21206); - else if (_action.isAction(VERB_LOOK, 0x110)) + else if (_action.isAction(VERB_LOOK, NOUN_PLANTS)) _vm->_dialogs->show(21207); - else if (_action.isAction(VERB_LOOK, 0xE8)) + else if (_action.isAction(VERB_LOOK, NOUN_MOUNTAINS)) _vm->_dialogs->show(21208); else return; @@ -4994,7 +4994,7 @@ void Scene214::actions() { _vm->_dialogs->show(21427); else if (_action.isAction(0x18A, 0xAA)) _scene->_nextSceneId = 207; - else if (_action.isAction(VERB_TAKE, 0x114) && (_game._trigger || _game._objects.isInRoom(OBJ_POISON_DARTS))) { + else if (_action.isAction(VERB_TAKE, NOUN_POISON_DARTS) && (_game._trigger || _game._objects.isInRoom(OBJ_POISON_DARTS))) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -5023,7 +5023,7 @@ void Scene214::actions() { _vm->_dialogs->showItem(OBJ_POISON_DARTS, 0x53A5); break; } - } else if (_action.isAction(VERB_TAKE, 0x29) && (_game._trigger || _game._objects.isInRoom(OBJ_BLOWGUN))) { + } else if (_action.isAction(VERB_TAKE, NOUN_BLOWGUN) && (_game._trigger || _game._objects.isInRoom(OBJ_BLOWGUN))) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -5052,53 +5052,53 @@ void Scene214::actions() { _vm->_dialogs->showItem(OBJ_BLOWGUN, 0x329); break; } - } else if (_action.isAction(VERB_LOOK, 0x197)) + } else if (_action.isAction(VERB_LOOK, NOUN_WINDOW)) _vm->_dialogs->show(21401); - else if (_action.isAction(VERB_LOOK, 0x7E)) + else if (_action.isAction(VERB_LOOK, NOUN_EXPERIMENT_CAGE)) _vm->_dialogs->show(21402); - else if (_action.isAction(VERB_LOOK, 0x1C3)) + else if (_action.isAction(VERB_LOOK, NOUN_CAPTIVE_CREATURE)) _vm->_dialogs->show(21403); - else if (_action.isAction(VERB_LOOK, 0x21)) + else if (_action.isAction(VERB_LOOK, NOUN_BEAR_RUG)) _vm->_dialogs->show(21404); - else if (_action.isAction(VERB_LOOK, 0x1BB)) + else if (_action.isAction(VERB_LOOK, NOUN_TROPHY)) _vm->_dialogs->show(21405); - else if (_action.isAction(VERB_LOOK, 0x1BE)) { + else if (_action.isAction(VERB_LOOK, NOUN_LARGE_BOWL)) { if (_game._storyMode == STORYMODE_NAUGHTY) { _vm->_dialogs->show(21406); } else { _vm->_dialogs->show(21407); } - } else if (_action.isAction(VERB_LOOK, 0x1BC)) + } else if (_action.isAction(VERB_LOOK, NOUN_SPECIMEN_JARS)) _vm->_dialogs->show(21408); - else if (_action.isAction(VERB_TAKE, 0x1BE) || _action.isAction(VERB_TAKE, 0x1BC)) + else if (_action.isAction(VERB_TAKE, NOUN_LARGE_BOWL) || _action.isAction(VERB_TAKE, NOUN_SPECIMEN_JARS)) _vm->_dialogs->show(21409); - else if (_action.isAction(VERB_LOOK, 0x13D)) + else if (_action.isAction(VERB_LOOK, NOUN_SHRUNKEN_HEADS)) _vm->_dialogs->show(21410); - else if (_action.isAction(VERB_TAKE, 0x13D) || _action.isAction(VERB_TAKE, 0x48A)) + else if (_action.isAction(VERB_TAKE, NOUN_SHRUNKEN_HEADS) || _action.isAction(VERB_TAKE, NOUN_LARGE_HEADS)) _vm->_dialogs->show(21411); - else if (_action.isAction(VERB_LOOK, 0x48A)) + else if (_action.isAction(VERB_LOOK, NOUN_LARGE_HEADS)) _vm->_dialogs->show(21428); - else if (_action.isAction(VERB_LOOK, 0x114) && (_action._savedFields._mainObjectSource == 4)) + else if (_action.isAction(VERB_LOOK, NOUN_POISON_DARTS) && (_action._savedFields._mainObjectSource == 4)) _vm->_dialogs->show(21412); - else if (_action.isAction(VERB_OPEN, 0x7E)) + else if (_action.isAction(VERB_OPEN, NOUN_EXPERIMENT_CAGE)) _vm->_dialogs->show(21414); - else if (_action.isAction(VERB_TALKTO, 0x1C3)) + else if (_action.isAction(VERB_TALKTO, NOUN_CAPTIVE_CREATURE)) _vm->_dialogs->show(21415); - else if (_action.isAction(VERB_GIVE, 0x17A, 0x1C3)) + else if (_action.isAction(VERB_GIVE, NOUN_TWINKIFRUIT, 0x1C3)) _vm->_dialogs->show(21416); else if (_action.isAction(VERB_SHOOT, 0x29, 0x1C3) || _action.isAction(VERB_HOSE_DOWN, 0x29, 0x1C3)) _vm->_dialogs->show(21417); - else if (_action.isAction(VERB_LOOK, 0x473)) + else if (_action.isAction(VERB_LOOK, NOUN_BIG_HEADS)) _vm->_dialogs->show(21418); - else if (_action.isAction(VERB_TAKE, 0x473)) + else if (_action.isAction(VERB_TAKE, NOUN_BIG_HEADS)) _vm->_dialogs->show(21419); - else if (_action.isAction(VERB_TAKE, 0x21)) + else if (_action.isAction(VERB_TAKE, NOUN_BEAR_RUG)) _vm->_dialogs->show(21420); - else if (_action.isAction(VERB_LOOK, 0x8A)) + else if (_action.isAction(VERB_LOOK, NOUN_FLOOR_OF_HUT)) _vm->_dialogs->show(21421); - else if (_action.isAction(VERB_LOOK, 0x29)) + else if (_action.isAction(VERB_LOOK, NOUN_BLOWGUN)) _vm->_dialogs->show(21422); - else if (_action.isAction(VERB_LOOK, 0x160)) { + else if (_action.isAction(VERB_LOOK, NOUN_TABLE)) { if (_game._objects.isInRoom(OBJ_POISON_DARTS) && _game._objects.isInRoom(OBJ_BLOWGUN)) { _vm->_dialogs->show(21423); } else if (_game._objects.isInRoom(OBJ_POISON_DARTS) && !_game._objects.isInRoom(OBJ_BLOWGUN)) { @@ -5174,7 +5174,7 @@ void Scene215::step() { void Scene215::actions() { if (_action._lookFlag) _vm->_dialogs->show(21509); - else if (_action.isAction(VERB_TAKE, 0x17A)) { + else if (_action.isAction(VERB_TAKE, NOUN_TWINKIFRUIT)) { if (!_game._objects.isInInventory(OBJ_TWINKIFRUIT) || _game._trigger) { switch (_game._trigger) { case 0: @@ -5212,29 +5212,29 @@ void Scene215::actions() { } } else if (_action.isAction(0x18A, 0xAA)) _scene->_nextSceneId = 210; - else if (_action.isAction(VERB_LOOK, 0x21)) + else if (_action.isAction(VERB_LOOK, NOUN_BEAR_RUG)) _vm->_dialogs->show(21501); - else if (_action.isAction(VERB_LOOK, 0x1CB)) + else if (_action.isAction(VERB_LOOK, NOUN_BED)) _vm->_dialogs->show(21502); - else if (_action.isAction(VERB_LOOK, 0x3A3)) + else if (_action.isAction(VERB_LOOK, NOUN_WELCOME_MAT)) _vm->_dialogs->show(21503); - else if (_action.isAction(VERB_LOOK, 0xD5)) + else if (_action.isAction(VERB_LOOK, NOUN_LOVE_ALTAR)) _vm->_dialogs->show(21504); - else if (_action.isAction(VERB_LOOK, 0x197)) + else if (_action.isAction(VERB_LOOK, NOUN_WINDOW)) _vm->_dialogs->show(21505); - else if (_action.isAction(VERB_LOOK, 0x289)) + else if (_action.isAction(VERB_LOOK, NOUN_PICTURE)) _vm->_dialogs->show(21506); - else if (_action.isAction(VERB_LOOK, 0x17A) && (_action._savedFields._mainObjectSource == 4)) + else if (_action.isAction(VERB_LOOK, NOUN_TWINKIFRUIT) && (_action._savedFields._mainObjectSource == 4)) _vm->_dialogs->show(21507); - else if (_action.isAction(VERB_TAKE, 0x21)) + else if (_action.isAction(VERB_TAKE, NOUN_BEAR_RUG)) _vm->_dialogs->show(21510); - else if (_action.isAction(VERB_TAKE, 0xD5)) + else if (_action.isAction(VERB_TAKE, NOUN_LOVE_ALTAR)) _vm->_dialogs->show(21511); - else if (_action.isAction(VERB_LOOK, 0x1CA)) + else if (_action.isAction(VERB_LOOK, NOUN_BAG_OF_TWINKIFRUITS)) _vm->_dialogs->show(21512); - else if (_action.isAction(VERB_TAKE, 0x1CA)) + else if (_action.isAction(VERB_TAKE, NOUN_BAG_OF_TWINKIFRUITS)) _vm->_dialogs->show(21513); - else if (_action.isAction(VERB_TAKE, 0x3A3)) + else if (_action.isAction(VERB_TAKE, NOUN_WELCOME_MAT)) _vm->_dialogs->show(21514); else return; diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 00de84eea8..74bc582249 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -862,7 +862,7 @@ void Scene307::actions() { _vm->_dialogs->show(30715); else if (_game._screenObjects._inputMode == 1) handleDialog(); - else if (_action.isAction(VERB_TALKTO, 0x207) || _action.isAction(VERB_TALKTO, 0x18D) || _action.isAction(VERB_TALKTO, 0x21B)) { + else if (_action.isAction(VERB_TALKTO, NOUN_CELL_WALL) || _action.isAction(VERB_TALKTO, NOUN_WALL) || _action.isAction(VERB_TALKTO, NOUN_TOILET)) { int node, say; if (_globals[kKnowsBuddyBeast]) { say = 0x10E; @@ -959,7 +959,7 @@ void Scene307::actions() { default: break; } - }else if (_action.isAction(VERB_CLIMB_INTO, 0x11)) { + }else if (_action.isAction(VERB_CLIMB_INTO, NOUN_AIR_VENT)) { if (_grateOpenedFl) { switch (_game._trigger) { case 0: @@ -1042,9 +1042,9 @@ void Scene307::actions() { break; } } - } else if (_action.isAction(VERB_USE, 0x21B) && (_game._storyMode != STORYMODE_NAUGHTY)) + } else if (_action.isAction(VERB_USE, NOUN_TOILET) && (_game._storyMode != STORYMODE_NAUGHTY)) _vm->_dialogs->show(30723); - else if (_action.isAction(VERB_USE, 0x21B)) { + else if (_action.isAction(VERB_USE, NOUN_TOILET)) { if (!_afterPeeingFl) { switch (_game._trigger) { case 0: @@ -1094,24 +1094,24 @@ void Scene307::actions() { int idx = _scene->_kernelMessages.add(Common::Point(85, 39), 0x1110, 0, 0, 180, _game.getQuote(238)); _scene->_kernelMessages.setQuoted(idx, 4, true); } - } else if (_action.isAction(VERB_LOOK, 0x11)) { + } else if (_action.isAction(VERB_LOOK, NOUN_AIR_VENT)) { if (!_grateOpenedFl) _vm->_dialogs->show(30710); else _vm->_dialogs->show(30711); - } else if (_action.isAction(VERB_LOOK, 0x1CB)) + } else if (_action.isAction(VERB_LOOK, NOUN_BED)) _vm->_dialogs->show(30712); - else if (_action.isAction(VERB_LOOK, 0x216)) + else if (_action.isAction(VERB_LOOK, NOUN_SINK)) _vm->_dialogs->show(30713); - else if (_action.isAction(VERB_LOOK, 0x21B)) + else if (_action.isAction(VERB_LOOK, NOUN_TOILET)) _vm->_dialogs->show(30714); else if (_action.isAction(0x134, 0x12C)) _vm->_dialogs->show(30716); - else if (_action.isAction(VERB_LOOK, 0x207)) + else if (_action.isAction(VERB_LOOK, NOUN_CELL_WALL)) _vm->_dialogs->show(30717); - else if (_action.isAction(VERB_LOOK, 0xCD)) + else if (_action.isAction(VERB_LOOK, NOUN_LIGHT)) _vm->_dialogs->show(30718); - else if (_action.isAction(VERB_WALK_INTO, 0x204)) { + else if (_action.isAction(VERB_WALK_INTO, NOUN_CORRIDOR)) { switch (_fieldCollisionCounter) { case 0: _vm->_dialogs->show(30719); @@ -1696,9 +1696,9 @@ void Scene311::actions() { _checkGuardFl = false; _scene->_kernelMessages.reset(); _scene->_kernelMessages.addQuote(0xFA, 120, 0); - } else if (_action.isAction(VERB_SIT_AT, 0x1E4)) + } else if (_action.isAction(VERB_SIT_AT, NOUN_DESK)) _scene->_nextSceneId = 320; - else if (_action.isAction(VERB_CLIMB_INTO, 0x11)) { + else if (_action.isAction(VERB_CLIMB_INTO, NOUN_AIR_VENT)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -1790,25 +1790,25 @@ void Scene311::actions() { default: break; } - } else if (_action.isAction(VERB_LOOK, 0x1E4)) + } else if (_action.isAction(VERB_LOOK, NOUN_DESK)) _vm->_dialogs->show(31110); - else if (_action.isAction(VERB_LOOK, 0x18D)) + else if (_action.isAction(VERB_LOOK, NOUN_WALL)) _vm->_dialogs->show(31111); - else if (_action.isAction(VERB_LOOK, 0x220) || _action.isAction(VERB_STARE_AT, 0x220)) + else if (_action.isAction(VERB_LOOK, NOUN_LIGHTING_FIXTURE) || _action.isAction(VERB_STARE_AT, NOUN_LIGHTING_FIXTURE)) _vm->_dialogs->show(31112); - else if (_action.isAction(VERB_LOOK, 0x208) || _action.isAction(VERB_STARE_AT, 0x208)) + else if (_action.isAction(VERB_LOOK, NOUN_LIGHTS) || _action.isAction(VERB_STARE_AT, NOUN_LIGHTS)) _vm->_dialogs->show(31113); - else if (_action.isAction(VERB_TAKE, 0x208)) + else if (_action.isAction(VERB_TAKE, NOUN_LIGHTS)) _vm->_dialogs->show(31114); - else if (_action.isAction(VERB_LOOK, 0xCD) || _action.isAction(VERB_STARE_AT, 0xCD)) + else if (_action.isAction(VERB_LOOK, NOUN_LIGHT) || _action.isAction(VERB_STARE_AT, NOUN_LIGHT)) _vm->_dialogs->show(31115); - else if (_action.isAction(VERB_TAKE, 0xCD)) + else if (_action.isAction(VERB_TAKE, NOUN_LIGHT)) _vm->_dialogs->show(31116); - else if (_action.isAction(VERB_LOOK, 0x2BA)) + else if (_action.isAction(VERB_LOOK, NOUN_CORRIDOR_TO_WEST)) _vm->_dialogs->show(31117); - else if (_action.isAction(VERB_LOOK, 0x2B9)) + else if (_action.isAction(VERB_LOOK, NOUN_CORRIDOR_TO_EAST)) _vm->_dialogs->show(31118); - else if (_action.isAction(VERB_LOOK, 0x11)) + else if (_action.isAction(VERB_LOOK, NOUN_AIR_VENT)) _vm->_dialogs->show(31120); else return; @@ -1866,24 +1866,24 @@ void Scene313::enter() { } void Scene313::actions() { - if (_action.isAction(VERB_CRAWL_TO, 0x2FC)) + if (_action.isAction(VERB_CRAWL_TO, NOUN_FOURTH_CELL)) _scene->_nextSceneId = 387; - else if (_action.isAction(VERB_CRAWL_TO, 0x2FD)) + else if (_action.isAction(VERB_CRAWL_TO, NOUN_THIRD_CELL)) _scene->_nextSceneId = 388; - else if (_action.isAction(VERB_CRAWL_TO, 0x2FE)) { + else if (_action.isAction(VERB_CRAWL_TO, NOUN_SECOND_CELL)) { if (_globals[kAfterHavoc]) _scene->_nextSceneId = 399; else _scene->_nextSceneId = 389; - } else if (_action.isAction(VERB_CRAWL_TO, 0x2FF)) + } else if (_action.isAction(VERB_CRAWL_TO, NOUN_FIRST_CELL)) _scene->_nextSceneId = 390; - else if (_action.isAction(VERB_CRAWL_TO, 0x2EF)) { + else if (_action.isAction(VERB_CRAWL_TO, NOUN_SECURITY_STATION)) { if (_globals[kSexOfRex] == REX_FEMALE) { _globals[kSexOfRex] = REX_MALE; _vm->_dialogs->show(31301); } _scene->_nextSceneId = 391; - } else if (_action.isAction(VERB_CRAWL_TO, 0x300)) { + } else if (_action.isAction(VERB_CRAWL_TO, NOUN_EQUIPMENT_ROOM)) { if (_globals[kSexOfRex] == REX_FEMALE) { _globals[kSexOfRex] = REX_MALE; _vm->_dialogs->show(31301); @@ -2249,7 +2249,7 @@ void Scene316::step() { } void Scene316::preActions() { - if (_action.isAction(VERB_WALK_DOWN, 0x2B9)) { + if (_action.isAction(VERB_WALK_DOWN, NOUN_CORRIDOR_TO_EAST)) { if (_globals[kAfterHavoc]) _game._player._walkOffScreenSceneId = 354; else @@ -2258,12 +2258,12 @@ void Scene316::preActions() { } void Scene316::actions() { - if (_action.isAction(VERB_CLIMB_INTO, 0x11)) { + if (_action.isAction(VERB_CLIMB_INTO, NOUN_AIR_VENT)) { if (_globals[kSexOfRex] == REX_FEMALE) handleRoxInGrate(); else handleRexInGrate(); - } else if (_action.isAction(VERB_WALK_UP, 0x226) || _action.isAction(VERB_WALK_ONTO, 0x22C)) { + } else if (_action.isAction(VERB_WALK_UP, NOUN_RAMP) || _action.isAction(VERB_WALK_ONTO, NOUN_PLATFORM)) { switch (_game._trigger) { case 0: if (_globals[kCityFlooded]) { @@ -2314,35 +2314,35 @@ void Scene316::actions() { _scene->_nextSceneId = 321; break; } - } else if (_action.isAction(VERB_LOOK, 0x22C)) + } else if (_action.isAction(VERB_LOOK, NOUN_PLATFORM)) _vm->_dialogs->show(31610); - else if (_action.isAction(VERB_LOOK, 0x1B6)) { + else if (_action.isAction(VERB_LOOK, NOUN_STRANGE_DEVICE)) { if (_game._visitedScenes.exists(321)) _vm->_dialogs->show(31612); else _vm->_dialogs->show(31611); - } else if (_action.isAction(VERB_LOOK, 0x2C6)) + } else if (_action.isAction(VERB_LOOK, NOUN_CONTROLS)) _vm->_dialogs->show(31613); - else if (_action.isAction(VERB_LOOK, 0x2C7)) + else if (_action.isAction(VERB_LOOK, NOUN_EQUIPMENT)) _vm->_dialogs->show(31614); - else if (_action.isAction(VERB_LOOK, 0x1E0)) + else if (_action.isAction(VERB_LOOK, NOUN_PANEL)) _vm->_dialogs->show(31615); - else if (_action.isAction(VERB_LOOK, 0xE2)) + else if (_action.isAction(VERB_LOOK, NOUN_MONITOR)) _vm->_dialogs->show(31616); - else if (_action.isAction(VERB_LOOK, 0x226)) + else if (_action.isAction(VERB_LOOK, NOUN_RAMP)) _vm->_dialogs->show(31617); - else if (_action.isAction(VERB_LOOK, 0x11)) + else if (_action.isAction(VERB_LOOK, NOUN_AIR_VENT)) _vm->_dialogs->show(31618); - else if (_action.isAction(VERB_LOOK, 0x2B9)) { + else if (_action.isAction(VERB_LOOK, NOUN_CORRIDOR_TO_EAST)) { if (!_globals[kAfterHavoc]) { if (_game._difficulty != DIFFICULTY_EASY) _vm->_dialogs->show(31620); else _vm->_dialogs->show(31619); } - } else if (_action.isAction(VERB_LOOK, 0x89)) + } else if (_action.isAction(VERB_LOOK, NOUN_FLOOR)) _vm->_dialogs->show(31621); - else if (_action.isAction(VERB_LOOK, 0x257)) + else if (_action.isAction(VERB_LOOK, NOUN_SUPPORT)) _vm->_dialogs->show(31622); else return; @@ -2740,7 +2740,7 @@ void Scene318::preActions() { if (_game._player._needToWalk) _game._player._needToWalk = _game._player._visible; - if (_action.isAction(VERB_WALK_DOWN, 0x2BA)) + if (_action.isAction(VERB_WALK_DOWN, NOUN_CORRIDOR_TO_WEST)) _game._player._walkOffScreenSceneId = 357; } @@ -2751,7 +2751,7 @@ void Scene318::actions() { return; } - if (_action.isAction(VERB_TALKTO, 0x307)) { + if (_action.isAction(VERB_TALKTO, NOUN_INTERN)) { switch (_game._trigger) { case 0: { _dialogFl = true; @@ -2790,7 +2790,7 @@ void Scene318::actions() { return; } - if (_action.isAction(VERB_TAKE, 0x12C) && (_game._objects.isInRoom(OBJ_SCALPEL) || _game._trigger)) { + if (_action.isAction(VERB_TAKE, NOUN_SCALPEL) && (_game._objects.isInRoom(OBJ_SCALPEL) || _game._trigger)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -2832,13 +2832,13 @@ void Scene318::actions() { } if (_game._player._visible) { - if (_action.isAction(VERB_WALK_DOWN, 0x2B3)) { + if (_action.isAction(VERB_WALK_DOWN, NOUN_CORRIDOR_TO_SOUTH)) { _scene->_nextSceneId = 407; _action._inProgress = false; return; } - if (_action.isAction(VERB_TAKE, 0x165)) { + if (_action.isAction(VERB_TAKE, NOUN_TAPE_PLAYER)) { if (_game._objects.isInRoom(OBJ_AUDIO_TAPE)) { _vm->_dialogs->showItem(OBJ_AUDIO_TAPE, 0x7C5B); _game._objects.addToInventory(OBJ_AUDIO_TAPE); @@ -2849,7 +2849,7 @@ void Scene318::actions() { return; } - if (_action.isAction(VERB_LOOK, 0x165)) { + if (_action.isAction(VERB_LOOK, NOUN_TAPE_PLAYER)) { if (_game._objects.isInRoom(OBJ_AUDIO_TAPE)) _vm->_dialogs->show(31833); else @@ -2859,68 +2859,68 @@ void Scene318::actions() { return; } - if (_action.isAction(VERB_WALK_INTO, 0x488)) { + if (_action.isAction(VERB_WALK_INTO, NOUN_DOCTORS_OFFICE)) { _vm->_dialogs->show(31831); _action._inProgress = false; return; } - if (_action.isAction(VERB_LOOK, 0x2D9)) { + if (_action.isAction(VERB_LOOK, NOUN_GURNEY)) { _vm->_dialogs->show(31823); _action._inProgress = false; return; } - if (_action.isAction(VERB_LOOK, 0x308)) { + if (_action.isAction(VERB_LOOK, NOUN_INSTRUMENT_TABLE)) { _vm->_dialogs->show(31825); _action._inProgress = false; return; } } else { // Not visible - if (_action.isAction(VERB_LOOK, 0x2D9)) { + if (_action.isAction(VERB_LOOK, NOUN_GURNEY)) { _vm->_dialogs->show(31822); _action._inProgress = false; return; } - if (_action.isAction(VERB_LOOK, 0x308)) { + if (_action.isAction(VERB_LOOK, NOUN_INSTRUMENT_TABLE)) { _vm->_dialogs->show(31824); _action._inProgress = false; return; } } - if (_action.isAction(VERB_LOOK, 0x18D)) + if (_action.isAction(VERB_LOOK, NOUN_WALL)) _vm->_dialogs->show(31810); - else if (_action.isAction(VERB_LOOK, 0x89)) + else if (_action.isAction(VERB_LOOK, NOUN_FLOOR)) _vm->_dialogs->show(31811); - else if (_action.isAction(VERB_LOOK, 0x2BA)) + else if (_action.isAction(VERB_LOOK, NOUN_CORRIDOR_TO_WEST)) _vm->_dialogs->show(31812); - else if (_action.isAction(VERB_LOOK, 0x2B3)) + else if (_action.isAction(VERB_LOOK, NOUN_CORRIDOR_TO_SOUTH)) _vm->_dialogs->show(31813); - else if (_action.isAction(VERB_LOOK, 0x2CB)) + else if (_action.isAction(VERB_LOOK, NOUN_FAUCET)) _vm->_dialogs->show(31814); - else if (_action.isAction(VERB_LOOK, 0x216)) + else if (_action.isAction(VERB_LOOK, NOUN_SINK)) _vm->_dialogs->show(31815); - else if (_action.isAction(VERB_LOOK, 0x319)) + else if (_action.isAction(VERB_LOOK, NOUN_CONVEYOR_BELT)) _vm->_dialogs->show(31816); - else if (_action.isAction(VERB_LOOK, 0x477)) + else if (_action.isAction(VERB_LOOK, NOUN_LARGE_BLADE)) _vm->_dialogs->show(31817); - else if (_action.isAction(VERB_LOOK, 0xE2)) + else if (_action.isAction(VERB_LOOK, NOUN_MONITOR)) _vm->_dialogs->show(31818); - else if (_action.isAction(VERB_LOOK, 0x2C9)) + else if (_action.isAction(VERB_LOOK, NOUN_CABINETS)) _vm->_dialogs->show(31819); - else if (_action.isAction(VERB_LOOK, 0x2C7)) + else if (_action.isAction(VERB_LOOK, NOUN_EQUIPMENT)) _vm->_dialogs->show(31820); - else if (_action.isAction(VERB_LOOK, 0x2C8)) + else if (_action.isAction(VERB_LOOK, NOUN_SHELF)) _vm->_dialogs->show(31821); - else if (_action.isAction(VERB_OPEN, 0x2C9)) + else if (_action.isAction(VERB_OPEN, NOUN_CABINETS)) _vm->_dialogs->show(31829); - else if (_action.isAction(VERB_LOOK, 0x307)) + else if (_action.isAction(VERB_LOOK, NOUN_INTERN)) _vm->_dialogs->show(31830); - else if (_action.isAction(VERB_LOOK, 0x3A1)) + else if (_action.isAction(VERB_LOOK, NOUN_PROFESSOR)) _vm->_dialogs->show(31832); - else if (_action.isAction(VERB_LOOK, 0x3A2)) + else if (_action.isAction(VERB_LOOK, NOUN_PROFESSORS_GURNEY)) _vm->_dialogs->show(31836); else if (_action._lookFlag) { if (_game._player._visible || _game._objects.isInInventory(OBJ_SCALPEL)) @@ -3709,39 +3709,39 @@ void Scene320::actions() { default: break; } - } else if (_action.isAction(VERB_LEAVE, 0x2EF)) + } else if (_action.isAction(VERB_LEAVE, NOUN_SECURITY_STATION)) _scene->_nextSceneId = 311; - else if (_action.isAction(VERB_LOOK, 0x2DC)) + else if (_action.isAction(VERB_LOOK, NOUN_RIGHT_MONITOR)) _vm->_dialogs->show(32001); - else if (_action.isAction(VERB_LOOK, 0x2DB)) + else if (_action.isAction(VERB_LOOK, NOUN_LEFT_MONITOR)) _vm->_dialogs->show(32002); - else if (_action.isAction(VERB_LOOK, 0x1E4)) + else if (_action.isAction(VERB_LOOK, NOUN_DESK)) _vm->_dialogs->show(32003); - else if (_action.isAction(VERB_LOOK, 0x2EF)) + else if (_action.isAction(VERB_LOOK, NOUN_SECURITY_STATION)) _vm->_dialogs->show(32004); - else if (_action.isAction(VERB_LOOK, 0x2ED)) + else if (_action.isAction(VERB_LOOK, NOUN_MUG)) _vm->_dialogs->show(32005); - else if (_action.isAction(VERB_LOOK, 0x2EE)) + else if (_action.isAction(VERB_LOOK, NOUN_DOUGHNUT)) _vm->_dialogs->show(32006); - else if (_action.isAction(VERB_LOOK, 0x2F1)) + else if (_action.isAction(VERB_LOOK, NOUN_MAGAZINE)) _vm->_dialogs->show(32006); - else if (_action.isAction(VERB_LOOK, 0x2F3)) + else if (_action.isAction(VERB_LOOK, NOUN_PAPER_FOOTBALL)) _vm->_dialogs->show(32008); - else if (_action.isAction(VERB_LOOK, 0x2F0)) + else if (_action.isAction(VERB_LOOK, NOUN_NEWSPAPER)) _vm->_dialogs->show(32009); - else if (_action.isAction(VERB_LOOK, 0x2F2)) + else if (_action.isAction(VERB_LOOK, NOUN_CLIPBOARD)) _vm->_dialogs->show(32010); - else if (_action.isAction(VERB_TAKE, 0x2ED)) + else if (_action.isAction(VERB_TAKE, NOUN_MUG)) _vm->_dialogs->show(32012); - else if (_action.isAction(VERB_TAKE, 0x2F2)) + else if (_action.isAction(VERB_TAKE, NOUN_CLIPBOARD)) _vm->_dialogs->show(32013); - else if (_action.isAction(VERB_TAKE, 0x2EE) || _action.isAction(VERB_EAT, 0x2EE)) + else if (_action.isAction(VERB_TAKE, NOUN_DOUGHNUT) || _action.isAction(VERB_EAT, NOUN_DOUGHNUT)) _vm->_dialogs->show(32014); - else if (_action.isAction(VERB_TAKE, 0x2F3)) + else if (_action.isAction(VERB_TAKE, NOUN_PAPER_FOOTBALL)) _vm->_dialogs->show(32015); - else if (_action.isAction(VERB_TAKE, 0x2F1)) + else if (_action.isAction(VERB_TAKE, NOUN_MAGAZINE)) _vm->_dialogs->show(32016); - else if (_action.isAction(VERB_TAKE, 0x2F0)) + else if (_action.isAction(VERB_TAKE, NOUN_NEWSPAPER)) _vm->_dialogs->show(32017); else return; @@ -3838,21 +3838,21 @@ void Scene322::actions() { return; } - if (_action.isAction(VERB_LOOK, 0x181) || _action.isAction(VERB_PEER_THROUGH, 0x181)) + if (_action.isAction(VERB_LOOK, NOUN_VIEWPORT) || _action.isAction(VERB_PEER_THROUGH, NOUN_VIEWPORT)) _vm->_dialogs->show(32210); - else if (_action.isAction(VERB_LOOK, 0xC4)) + else if (_action.isAction(VERB_LOOK, NOUN_KEYPAD)) _vm->_dialogs->show(32211); - else if (_action.isAction(VERB_LOOK, 0x1CC)) + else if (_action.isAction(VERB_LOOK, NOUN_DISPLAY)) _vm->_dialogs->show(32212); - else if (_action.isAction(VERB_LOOK, 0x1D0) || _action.isAction(VERB_LOOK, 0x1D1) - || _action.isAction(VERB_LOOK, 0x1D2) || _action.isAction(VERB_LOOK, 0x1D3) - || _action.isAction(VERB_LOOK, 0x1D4) || _action.isAction(VERB_LOOK, 0x1D5) - || _action.isAction(VERB_LOOK, 0x1D6) || _action.isAction(VERB_LOOK, 0x1D7) - || _action.isAction(VERB_LOOK, 0x1D8) || _action.isAction(VERB_LOOK, 0x1D9) - || _action.isAction(VERB_LOOK, 0x1DB) || _action.isAction(VERB_LOOK, 0x7A) - || _action.isAction(VERB_LOOK, 0x1DA)) + else if (_action.isAction(VERB_LOOK, NOUN_0_KEY) || _action.isAction(VERB_LOOK, NOUN_1_KEY) + || _action.isAction(VERB_LOOK, NOUN_2_KEY) || _action.isAction(VERB_LOOK, NOUN_3_KEY) + || _action.isAction(VERB_LOOK, NOUN_4_KEY) || _action.isAction(VERB_LOOK, NOUN_5_KEY) + || _action.isAction(VERB_LOOK, NOUN_6_KEY) || _action.isAction(VERB_LOOK, NOUN_7_KEY) + || _action.isAction(VERB_LOOK, NOUN_8_KEY) || _action.isAction(VERB_LOOK, NOUN_9_KEY) + || _action.isAction(VERB_LOOK, NOUN_SMILE_KEY) || _action.isAction(VERB_LOOK, NOUN_ENTER_KEY) + || _action.isAction(VERB_LOOK, NOUN_FROWN_KEY)) _vm->_dialogs->show(32213); - else if (_action.isAction(VERB_LOOK, 0x1CF)) + else if (_action.isAction(VERB_LOOK, NOUN_DEVICE)) _vm->_dialogs->show(32214); else return; @@ -3954,11 +3954,11 @@ void Scene351::step() { void Scene351::actions() { if (_action._lookFlag) _vm->_dialogs->show(35121); - else if (_action.isAction(VERB_STEP_INTO, 0x16C)) + else if (_action.isAction(VERB_STEP_INTO, NOUN_TELEPORTER)) _scene->_nextSceneId = 322; - else if (_action.isAction(VERB_WALK_DOWN, 0x2B3)) + else if (_action.isAction(VERB_WALK_DOWN, NOUN_CORRIDOR_TO_SOUTH)) _scene->_nextSceneId = 352; - else if (_action.isAction(VERB_TAKE, 0x5C)) { + else if (_action.isAction(VERB_TAKE, NOUN_CREDIT_CHIP)) { if (_game._trigger || !_game._objects.isInInventory(0xF)) { switch (_game._trigger) { case 0: @@ -3990,30 +3990,30 @@ void Scene351::actions() { break; } } - } else if (_action.isAction(VERB_LOOK, 0x180)) + } else if (_action.isAction(VERB_LOOK, NOUN_VIEW_SCREEN)) _vm->_dialogs->show(35110); - else if (_action.isAction(VERB_LOOK, 0x23A)) + else if (_action.isAction(VERB_LOOK, NOUN_RIP_IN_FLOOR)) _vm->_dialogs->show(35111); - else if (_action.isAction(VERB_LOOK, 0x1E6)) + else if (_action.isAction(VERB_LOOK, NOUN_FIRE_HYDRANT)) _vm->_dialogs->show(35112); - else if (_action.isAction(VERB_LOOK, 0x239)) { + else if (_action.isAction(VERB_LOOK, NOUN_GUARD)) { if (_game._objects[0xF]._roomNumber == 351) _vm->_dialogs->show(35114); else _vm->_dialogs->show(35113); - } else if (_action.isAction(VERB_LOOK, 0x2C7)) + } else if (_action.isAction(VERB_LOOK, NOUN_EQUIPMENT)) _vm->_dialogs->show(35115); - else if (_action.isAction(VERB_LOOK, 0x1E4)) + else if (_action.isAction(VERB_LOOK, NOUN_DESK)) _vm->_dialogs->show(35116); - else if (_action.isAction(VERB_LOOK, 0xD7)) + else if (_action.isAction(VERB_LOOK, NOUN_MACHINE)) _vm->_dialogs->show(35117); - else if (_action.isAction(VERB_LOOK, 0x16C)) + else if (_action.isAction(VERB_LOOK, NOUN_TELEPORTER)) _vm->_dialogs->show(35118); - else if (_action.isAction(VERB_LOOK, 0x59)) + else if (_action.isAction(VERB_LOOK, NOUN_CONTROL_PANEL)) _vm->_dialogs->show(35119); - else if (_action.isAction(VERB_LOOK, 0x2B3)) + else if (_action.isAction(VERB_LOOK, NOUN_CORRIDOR_TO_SOUTH)) _vm->_dialogs->show(35120); - else if (_action.isAction(VERB_LOOK, 0x1EB)) + else if (_action.isAction(VERB_LOOK, NOUN_POLE)) _vm->_dialogs->show(35122); else return; @@ -4171,7 +4171,7 @@ void Scene352::enter() { void Scene352::preActions() { _leaveRoomFl = false; - if (_action.isAction(VERB_OPEN, 0x1F8)) + if (_action.isAction(VERB_OPEN, NOUN_VAULT)) _game._player.walk(Common::Point(266, 111), FACING_NORTHEAST); if (_vaultOpenFl && !_action.isAction(0x1F8) && !_action.isAction(0x2F6) && !_action.isAction(0x2F5) && !_action.isAction(0x2F4)) { @@ -4210,14 +4210,14 @@ void Scene352::preActions() { } } - if (_action.isAction(VERB_PUT, 0x3B6, 0x1F3)) { + if (_action.isAction(VERB_PUT, NOUN_GUARDS_ARM, 0x1F3)) { if (_globals[kSexOfRex] == REX_MALE) _game._player.walk(Common::Point(269, 111), FACING_NORTHEAST); else _game._player.walk(Common::Point(271, 111), FACING_NORTHEAST); } - if (_action.isAction(VERB_WALK_THROUGH, 0x70) || _action.isAction(VERB_WALK_DOWN, 0x2B3) || _action.isAction(VERB_PUT, 0x3B6, 0x89)) { + if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOORWAY) || _action.isAction(VERB_WALK_DOWN, NOUN_CORRIDOR_TO_SOUTH) || _action.isAction(VERB_PUT, NOUN_GUARDS_ARM, 0x89)) { if (_game._objects.isInInventory(OBJ_GUARDS_ARM)) _game._player.walk(Common::Point(230, 117), FACING_NORTHWEST); } @@ -4230,7 +4230,7 @@ void Scene352::actions() { return; } - if (_action.isAction(VERB_OPEN, 0x1F8)) { + if (_action.isAction(VERB_OPEN, NOUN_VAULT)) { if (!_vaultOpenFl) { switch (_game._trigger) { case 0: @@ -4288,15 +4288,15 @@ void Scene352::actions() { bool exit_corridor = false; bool exit_doorway = false; - if (_action.isAction(VERB_WALK_DOWN, 0x2B3)) { + if (_action.isAction(VERB_WALK_DOWN, NOUN_CORRIDOR_TO_SOUTH)) { exit_corridor = true; } - if (_action.isAction(VERB_WALK_THROUGH, 0x70)) { + if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOORWAY)) { exit_doorway = true; } - if (_action.isAction(VERB_WALK_DOWN, 0x2B3) || _action.isAction(VERB_WALK_THROUGH, 0x70) || _action.isAction(VERB_PUT, 0x3B6, 0x89)) { + if (_action.isAction(VERB_WALK_DOWN, NOUN_CORRIDOR_TO_SOUTH) || _action.isAction(VERB_WALK_THROUGH, NOUN_DOORWAY) || _action.isAction(VERB_PUT, NOUN_GUARDS_ARM, 0x89)) { if (_mustPutArmDownFl) putArmDown(exit_corridor, exit_doorway); else if (exit_corridor) @@ -4308,7 +4308,7 @@ void Scene352::actions() { return; } - if (_action.isAction(VERB_TAKE, 0x3B6)) { + if (_action.isAction(VERB_TAKE, NOUN_GUARDS_ARM)) { if (_game._trigger || !_game._objects.isInInventory(OBJ_GUARDS_ARM)) { switch (_game._trigger) { case 0: @@ -4344,7 +4344,7 @@ void Scene352::actions() { } } - if (_action.isAction(VERB_PUT, 0x3B6, 0x1F3)) { + if (_action.isAction(VERB_PUT, NOUN_GUARDS_ARM, 0x1F3)) { if (!_vaultOpenFl) { switch (_game._trigger) { case 0: @@ -4423,7 +4423,7 @@ void Scene352::actions() { break; } } - } else if (_action.isAction(VERB_TAKE, 0x2F4)) { + } else if (_action.isAction(VERB_TAKE, NOUN_YOUR_STUFF)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -4470,7 +4470,7 @@ void Scene352::actions() { default: break; } - } else if (_action.isAction(VERB_TAKE, 0x165) && !_game._objects.isInInventory(OBJ_TAPE_PLAYER)) { + } else if (_action.isAction(VERB_TAKE, NOUN_TAPE_PLAYER) && !_game._objects.isInInventory(OBJ_TAPE_PLAYER)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -4508,53 +4508,53 @@ void Scene352::actions() { default: break; } - } else if (_action.isAction(VERB_LOOK, 0x1F3)) + } else if (_action.isAction(VERB_LOOK, NOUN_SCANNER)) _vm->_dialogs->show(35210); - else if (_action.isAction(VERB_LOOK, 0xE2)) { + else if (_action.isAction(VERB_LOOK, NOUN_MONITOR)) { if (_game._storyMode == STORYMODE_NAUGHTY) _vm->_dialogs->show(35211); else _vm->_dialogs->show(35212); - } else if (_action.isAction(VERB_LOOK, 0x1CC)) + } else if (_action.isAction(VERB_LOOK, NOUN_DISPLAY)) _vm->_dialogs->show(35213); - else if (_action.isAction(VERB_LOOK, 0x2CD)) + else if (_action.isAction(VERB_LOOK, NOUN_STATUE)) _vm->_dialogs->show(35214); - else if (_action.isAction(VERB_LOOK, 0x165) && (_action._savedFields._mainObjectSource == 4)) + else if (_action.isAction(VERB_LOOK, NOUN_TAPE_PLAYER) && (_action._savedFields._mainObjectSource == 4)) _vm->_dialogs->show(35215); - else if (_action.isAction(VERB_LOOK, 0x11)) + else if (_action.isAction(VERB_LOOK, NOUN_AIR_VENT)) _vm->_dialogs->show(35216); - else if (_action.isAction(VERB_LOOK, 0x3B6) && (_action._savedFields._mainObjectSource == 4)) + else if (_action.isAction(VERB_LOOK, NOUN_GUARDS_ARM) && (_action._savedFields._mainObjectSource == 4)) _vm->_dialogs->show(35217); - else if (_action.isAction(VERB_LOOK, 0x2DA)) + else if (_action.isAction(VERB_LOOK, NOUN_IRONING_BOARD)) _vm->_dialogs->show(35218); - else if (_action.isAction(VERB_LOOK, 0x51)) + else if (_action.isAction(VERB_LOOK, NOUN_CLOCK)) _vm->_dialogs->show(35219); - else if (_action.isAction(VERB_LOOK, 0x2CE)) + else if (_action.isAction(VERB_LOOK, NOUN_GAUGE)) _vm->_dialogs->show(35220); - else if (_action.isAction(VERB_LOOK, 0x1F8)) { + else if (_action.isAction(VERB_LOOK, NOUN_VAULT)) { if (!_vaultOpenFl) _vm->_dialogs->show(35221); - } else if (_action.isAction(VERB_LOOK, 0x2F4)) + } else if (_action.isAction(VERB_LOOK, NOUN_YOUR_STUFF)) _vm->_dialogs->show(35222); - else if (_action.isAction(VERB_LOOK, 0x2F5)) + else if (_action.isAction(VERB_LOOK, NOUN_OTHER_STUFF)) _vm->_dialogs->show(35223); - else if (_action.isAction(VERB_LOOK, 0x2B3)) + else if (_action.isAction(VERB_LOOK, NOUN_CORRIDOR_TO_SOUTH)) _vm->_dialogs->show(35224); - else if (_action.isAction(VERB_TAKE, 0x2F5)) + else if (_action.isAction(VERB_TAKE, NOUN_OTHER_STUFF)) _vm->_dialogs->show(35226); - else if (_action.isAction(VERB_LOOK, 0x1E4)) + else if (_action.isAction(VERB_LOOK, NOUN_DESK)) _vm->_dialogs->show(35229); - else if (_action.isAction(VERB_LOOK, 0x239)) + else if (_action.isAction(VERB_LOOK, NOUN_GUARD)) _vm->_dialogs->show(35230); - else if (_action.isAction(VERB_LOOK, 0x70)) + else if (_action.isAction(VERB_LOOK, NOUN_DOORWAY)) _vm->_dialogs->show(35231); - else if (_action.isAction(VERB_LOOK, 0x160)) + else if (_action.isAction(VERB_LOOK, NOUN_TABLE)) _vm->_dialogs->show(35232); - else if (_action.isAction(VERB_LOOK, 0x3B5)) + else if (_action.isAction(VERB_LOOK, NOUN_PROJECTOR)) _vm->_dialogs->show(35233); - else if (_action.isAction(VERB_LOOK, 0x257)) + else if (_action.isAction(VERB_LOOK, NOUN_SUPPORT)) _vm->_dialogs->show(35234); - else if (_action.isAction(VERB_LOOK, 0x1F5)) + else if (_action.isAction(VERB_LOOK, NOUN_SECURITY_MONITOR)) _vm->_dialogs->show(35235); else return; @@ -4598,25 +4598,25 @@ void Scene353::enter() { void Scene353::actions() { if (_action._lookFlag) _vm->_dialogs->show(35315); - else if (_action.isAction(VERB_WALK_THROUGH, 0x70)) + else if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOORWAY)) _scene->_nextSceneId = 352; - else if (_action.isAction(VERB_WALK_DOWN, 0x2B3)) + else if (_action.isAction(VERB_WALK_DOWN, NOUN_CORRIDOR_TO_SOUTH)) _scene->_nextSceneId = 354; - else if (_action.isAction(VERB_LOOK, 0x23D)) + else if (_action.isAction(VERB_LOOK, NOUN_ROCK_CHUNK)) _vm->_dialogs->show(35310); - else if (_action.isAction(VERB_LOOK, 0x1FA) || _action.isAction(VERB_LOOK, 0x10C)) + else if (_action.isAction(VERB_LOOK, NOUN_PIPES) || _action.isAction(VERB_LOOK, NOUN_PIPE)) _vm->_dialogs->show(35311); - else if (_action.isAction(VERB_LOOK, 0x23C)) + else if (_action.isAction(VERB_LOOK, NOUN_BROKEN_BEAM)) _vm->_dialogs->show(35312); - else if (_action.isAction(VERB_LOOK, 0x70)) + else if (_action.isAction(VERB_LOOK, NOUN_DOORWAY)) _vm->_dialogs->show(35313); - else if (_action.isAction(VERB_LOOK, 0x2B3)) + else if (_action.isAction(VERB_LOOK, NOUN_CORRIDOR_TO_SOUTH)) _vm->_dialogs->show(35314); - else if (_action.isAction(VERB_LOOK, 0x89)) + else if (_action.isAction(VERB_LOOK, NOUN_FLOOR)) _vm->_dialogs->show(35316); - else if (_action.isAction(VERB_LOOK, 0x46)) + else if (_action.isAction(VERB_LOOK, NOUN_CEILING)) _vm->_dialogs->show(35317); - else if (_action.isAction(VERB_LOOK, 0x18D)) + else if (_action.isAction(VERB_LOOK, NOUN_WALL)) _vm->_dialogs->show(35318); else return; @@ -4649,41 +4649,41 @@ void Scene354::enter() { } void Scene354::preActions() { - if (_action.isAction(VERB_WALK_DOWN, 0x2B3)) + if (_action.isAction(VERB_WALK_DOWN, NOUN_CORRIDOR_TO_SOUTH)) _game._player._walkOffScreenSceneId = 401; } void Scene354::actions() { if (_action._lookFlag) _vm->_dialogs->show(35414); - else if (_action.isAction(VERB_WALK_DOWN, 0x2B4)) { + else if (_action.isAction(VERB_WALK_DOWN, NOUN_CORRIDOR_TO_NORTH)) { _game._player.startWalking(Common::Point(208, 0), FACING_NORTHEAST); _game._player._walkOffScreenSceneId = 353; - } else if (_action.isAction(VERB_WALK_DOWN, 0x2B9)) + } else if (_action.isAction(VERB_WALK_DOWN, NOUN_CORRIDOR_TO_EAST)) _scene->_nextSceneId = 361; - else if (_action.isAction(VERB_WALK_DOWN, 0x2BA)) + else if (_action.isAction(VERB_WALK_DOWN, NOUN_CORRIDOR_TO_WEST)) _scene->_nextSceneId = 316; - else if (_action.isAction(VERB_WALK_DOWN, 0x2B3)) + else if (_action.isAction(VERB_WALK_DOWN, NOUN_CORRIDOR_TO_SOUTH)) _scene->_nextSceneId = 401; - else if (_action.isAction(VERB_LOOK, 0x2C6)) + else if (_action.isAction(VERB_LOOK, NOUN_CONTROLS)) _vm->_dialogs->show(35410); - else if (_action.isAction(VERB_LOOK, 0x1FD)) + else if (_action.isAction(VERB_LOOK, NOUN_SIGNAL)) _vm->_dialogs->show(35411); - else if (_action.isAction(VERB_LOOK, 0x2D0)) + else if (_action.isAction(VERB_LOOK, NOUN_CATWALK)) _vm->_dialogs->show(35412); - else if (_action.isAction(VERB_LOOK, 0x206)) + else if (_action.isAction(VERB_LOOK, NOUN_AIR_DUCT)) _vm->_dialogs->show(35413); - else if (_action.isAction(VERB_LOOK, 0x2B4)) + else if (_action.isAction(VERB_LOOK, NOUN_CORRIDOR_TO_NORTH)) _vm->_dialogs->show(35415); - else if (_action.isAction(VERB_LOOK, 0x2B3)) + else if (_action.isAction(VERB_LOOK, NOUN_CORRIDOR_TO_SOUTH)) _vm->_dialogs->show(35416); - else if (_action.isAction(VERB_LOOK, 0x2B9)) + else if (_action.isAction(VERB_LOOK, NOUN_CORRIDOR_TO_EAST)) _vm->_dialogs->show(35417); - else if (_action.isAction(VERB_LOOK, 0x2BA)) + else if (_action.isAction(VERB_LOOK, NOUN_CORRIDOR_TO_WEST)) _vm->_dialogs->show(35418); - else if (_action.isAction(VERB_LOOK, 0x218)) + else if (_action.isAction(VERB_LOOK, NOUN_DEBRIS)) _vm->_dialogs->show(35419); - else if (_action.isAction(VERB_LOOK, 0x239)) + else if (_action.isAction(VERB_LOOK, NOUN_GUARD)) _vm->_dialogs->show(35420); else return; @@ -4716,41 +4716,41 @@ void Scene357::enter() { } void Scene357::preActions() { - if (_action.isAction(VERB_WALK_DOWN, 0x2B9)) + if (_action.isAction(VERB_WALK_DOWN, NOUN_CORRIDOR_TO_EAST)) _game._player._walkOffScreenSceneId = 318; - if (_action.isAction(VERB_WALK_DOWN, 0x2BA)) + if (_action.isAction(VERB_WALK_DOWN, NOUN_CORRIDOR_TO_WEST)) _game._player._walkOffScreenSceneId = 358; } void Scene357::actions() { if (_action._lookFlag) _vm->_dialogs->show(35715); - else if (_action.isAction(VERB_LOOK, 0x11)) + else if (_action.isAction(VERB_LOOK, NOUN_AIR_VENT)) _vm->_dialogs->show(35710); - else if (_action.isAction(VERB_CLIMB_INTO, 0x11)) + else if (_action.isAction(VERB_CLIMB_INTO, NOUN_AIR_VENT)) _vm->_dialogs->show(35711); - else if (_action.isAction(VERB_LOOK, 0x1CB)) + else if (_action.isAction(VERB_LOOK, NOUN_BED)) _vm->_dialogs->show(35712); - else if (_action.isAction(VERB_LOOK, 0x216)) + else if (_action.isAction(VERB_LOOK, NOUN_SINK)) _vm->_dialogs->show(35713); - else if (_action.isAction(VERB_LOOK, 0x21B)) + else if (_action.isAction(VERB_LOOK, NOUN_TOILET)) _vm->_dialogs->show(35714); - else if (_action.isAction(VERB_LOOK, 0x207)) + else if (_action.isAction(VERB_LOOK, NOUN_CELL_WALL)) _vm->_dialogs->show(35716); - else if (_action.isAction(VERB_LOOK, 0xCD)) + else if (_action.isAction(VERB_LOOK, NOUN_LIGHT)) _vm->_dialogs->show(35717); - else if (_action.isAction(VERB_LOOK, 0x23A)) + else if (_action.isAction(VERB_LOOK, NOUN_RIP_IN_FLOOR)) _vm->_dialogs->show(35718); - else if (_action.isAction(VERB_LOOK, 0x218)) + else if (_action.isAction(VERB_LOOK, NOUN_DEBRIS)) _vm->_dialogs->show(35719); - else if (_action.isAction(VERB_TAKE, 0x218)) + else if (_action.isAction(VERB_TAKE, NOUN_DEBRIS)) _vm->_dialogs->show(35720); - else if (_action.isAction(VERB_LOOK, 0x18D)) + else if (_action.isAction(VERB_LOOK, NOUN_WALL)) _vm->_dialogs->show(35721); - else if (_action.isAction(VERB_LOOK, 0x2B9)) + else if (_action.isAction(VERB_LOOK, NOUN_CORRIDOR_TO_EAST)) _vm->_dialogs->show(35722); - else if (_action.isAction(VERB_LOOK, 0x2BA)) + else if (_action.isAction(VERB_LOOK, NOUN_CORRIDOR_TO_WEST)) _vm->_dialogs->show(35723); else return; @@ -4780,29 +4780,29 @@ void Scene358::enter() { } void Scene358::preActions() { - if (_action.isAction(VERB_WALK_DOWN, 0x2B9)) + if (_action.isAction(VERB_WALK_DOWN, NOUN_CORRIDOR_TO_EAST)) _game._player._walkOffScreenSceneId = 357; - if (_action.isAction(VERB_WALK_DOWN, 0x2BA)) + if (_action.isAction(VERB_WALK_DOWN, NOUN_CORRIDOR_TO_WEST)) _game._player._walkOffScreenSceneId = 359; } void Scene358::actions() { if (_action._lookFlag) _vm->_dialogs->show(35815); - else if (_action.isAction(VERB_LOOK, 0x2BA)) + else if (_action.isAction(VERB_LOOK, NOUN_CORRIDOR_TO_WEST)) _vm->_dialogs->show(35810); - else if (_action.isAction(VERB_LOOK, 0x2B9)) + else if (_action.isAction(VERB_LOOK, NOUN_CORRIDOR_TO_EAST)) _vm->_dialogs->show(35811); - else if (_action.isAction(VERB_LOOK, 0x1CB)) + else if (_action.isAction(VERB_LOOK, NOUN_BED)) _vm->_dialogs->show(35812); - else if (_action.isAction(VERB_LOOK, 0x216)) + else if (_action.isAction(VERB_LOOK, NOUN_SINK)) _vm->_dialogs->show(35813); - else if (_action.isAction(VERB_LOOK, 0x21B)) + else if (_action.isAction(VERB_LOOK, NOUN_TOILET)) _vm->_dialogs->show(35814); - else if (_action.isAction(VERB_LOOK, 0x204) || _action.isAction(VERB_LOOK, 0x18D)) + else if (_action.isAction(VERB_LOOK, NOUN_CORRIDOR) || _action.isAction(VERB_LOOK, NOUN_WALL)) _vm->_dialogs->show(35816); - else if (_action.isAction(VERB_LOOK, 0x11)) + else if (_action.isAction(VERB_LOOK, NOUN_AIR_VENT)) _vm->_dialogs->show(35817); else return; @@ -4846,10 +4846,10 @@ void Scene359::enter() { } void Scene359::preActions() { - if (_action.isAction(VERB_WALK_DOWN, 0x2B9)) + if (_action.isAction(VERB_WALK_DOWN, NOUN_CORRIDOR_TO_EAST)) _game._player._walkOffScreenSceneId = 358; - if (_action.isAction(VERB_WALK_DOWN, 0x2BA)) + if (_action.isAction(VERB_WALK_DOWN, NOUN_CORRIDOR_TO_WEST)) _game._player._walkOffScreenSceneId = 360; } @@ -4859,7 +4859,7 @@ void Scene359::actions() { _vm->_dialogs->show(35914); else _vm->_dialogs->show(35915); - } else if (_action.isAction(VERB_TAKE, 0x131)) { + } else if (_action.isAction(VERB_TAKE, NOUN_SECURITY_CARD)) { if (_game._trigger || !_game._objects.isInInventory(OBJ_SECURITY_CARD)) { switch (_game._trigger) { case 0: @@ -4903,43 +4903,43 @@ void Scene359::actions() { break; } } - } else if (_action.isAction(VERB_LOOK, 0x23E)) + } else if (_action.isAction(VERB_LOOK, NOUN_BLOODY_CELL_WALL)) _vm->_dialogs->show(35910); - else if (_action.isAction(VERB_LOOK, 0x1CB)) + else if (_action.isAction(VERB_LOOK, NOUN_BED)) _vm->_dialogs->show(35911); - else if (_action.isAction(VERB_LOOK, 0x216)) + else if (_action.isAction(VERB_LOOK, NOUN_SINK)) _vm->_dialogs->show(35912); - else if (_action.isAction(VERB_LOOK, 0x21B)) + else if (_action.isAction(VERB_LOOK, NOUN_TOILET)) _vm->_dialogs->show(35913); - else if (_action.isAction(VERB_LOOK, 0x2B9)) + else if (_action.isAction(VERB_LOOK, NOUN_CORRIDOR_TO_EAST)) _vm->_dialogs->show(35916); - else if (_action.isAction(VERB_LOOK, 0x2BA)) + else if (_action.isAction(VERB_LOOK, NOUN_CORRIDOR_TO_WEST)) _vm->_dialogs->show(35917); - else if (_action.isAction(VERB_LOOK, 0x215)) + else if (_action.isAction(VERB_LOOK, NOUN_LIMB)) _vm->_dialogs->show(35918); - else if (_action.isAction(VERB_TAKE, 0x215)) + else if (_action.isAction(VERB_TAKE, NOUN_LIMB)) _vm->_dialogs->show(35919); - else if (_action.isAction(VERB_LOOK, 0x131) && (_action._mainObjectSource == 4)) + else if (_action.isAction(VERB_LOOK, NOUN_SECURITY_CARD) && (_action._mainObjectSource == 4)) _vm->_dialogs->show(35921); - else if (_action.isAction(VERB_LOOK, 0x2D2)) { + else if (_action.isAction(VERB_LOOK, NOUN_BLOOD_STAIN)) { if ((_game._difficulty != DIFFICULTY_HARD) && (_game._objects[OBJ_SECURITY_CARD]._roomNumber == 359)) _vm->_dialogs->show(35922); else _vm->_dialogs->show(35923); - } else if (_action.isAction(VERB_LOOK, 0x23F)) + } else if (_action.isAction(VERB_LOOK, NOUN_WALL_BOARD)) _vm->_dialogs->show(35924); - else if (_action.isAction(VERB_TAKE, 0x23F)) + else if (_action.isAction(VERB_TAKE, NOUN_WALL_BOARD)) _vm->_dialogs->show(35925); - else if (_action.isAction(VERB_LOOK, 0x23A)) + else if (_action.isAction(VERB_LOOK, NOUN_RIP_IN_FLOOR)) _vm->_dialogs->show(35926); - else if (_action.isAction(VERB_LOOK, 0x204)) + else if (_action.isAction(VERB_LOOK, NOUN_CORRIDOR)) _vm->_dialogs->show(35927); - else if (_action.isAction(VERB_LOOK, 0x89)) { + else if (_action.isAction(VERB_LOOK, NOUN_FLOOR)) { if ((_game._difficulty != DIFFICULTY_HARD) && (_game._objects[OBJ_SECURITY_CARD]._roomNumber == 359)) _vm->_dialogs->show(35928); else _vm->_dialogs->show(35929); - } else if (_action.isAction(VERB_OPEN, 0x11) || _action.isAction(VERB_LOOK, 0x11)) + } else if (_action.isAction(VERB_OPEN, NOUN_AIR_VENT) || _action.isAction(VERB_LOOK, NOUN_AIR_VENT)) _vm->_dialogs->show(36016); else return; @@ -4976,31 +4976,31 @@ void Scene360::enter() { } void Scene360::preActions() { - if (_action.isAction(VERB_WALK_DOWN, 0x2B9)) + if (_action.isAction(VERB_WALK_DOWN, NOUN_CORRIDOR_TO_EAST)) _game._player._walkOffScreenSceneId = 359; - if (_action.isAction(VERB_WALK_DOWN, 0x2BA)) + if (_action.isAction(VERB_WALK_DOWN, NOUN_CORRIDOR_TO_WEST)) _game._player._walkOffScreenSceneId = 361; } void Scene360::actions() { if (_action._lookFlag) _vm->_dialogs->show(36015); - else if (_action.isAction(VERB_LOOK, 0x2BA)) + else if (_action.isAction(VERB_LOOK, NOUN_CORRIDOR_TO_WEST)) _vm->_dialogs->show(36010); - else if (_action.isAction(VERB_LOOK, 0x2B9)) + else if (_action.isAction(VERB_LOOK, NOUN_CORRIDOR_TO_EAST)) _vm->_dialogs->show(36011); - else if (_action.isAction(VERB_LOOK, 0x1CB)) + else if (_action.isAction(VERB_LOOK, NOUN_BED)) _vm->_dialogs->show(36012); - else if (_action.isAction(VERB_LOOK, 0x216)) + else if (_action.isAction(VERB_LOOK, NOUN_SINK)) _vm->_dialogs->show(36013); - else if (_action.isAction(VERB_LOOK, 0x21B)) + else if (_action.isAction(VERB_LOOK, NOUN_TOILET)) _vm->_dialogs->show(36014); - else if (_action.isAction(VERB_LOOK, 0x11)) + else if (_action.isAction(VERB_LOOK, NOUN_AIR_VENT)) _vm->_dialogs->show(36016); - else if (_action.isAction(VERB_LOOK, 0x204)) + else if (_action.isAction(VERB_LOOK, NOUN_CORRIDOR)) _vm->_dialogs->show(36017); - else if (_action.isAction(VERB_LOOK, 0x18D)) + else if (_action.isAction(VERB_LOOK, NOUN_WALL)) _vm->_dialogs->show(36018); else return; @@ -5348,43 +5348,43 @@ void Scene361::step() { } void Scene361::preActions() { - if (_action.isAction(VERB_WALK_DOWN, 0x2B9)) + if (_action.isAction(VERB_WALK_DOWN, NOUN_CORRIDOR_TO_EAST)) _game._player._walkOffScreenSceneId = 360; - if (_action.isAction(VERB_WALK_DOWN, 0x2BA)) + if (_action.isAction(VERB_WALK_DOWN, NOUN_CORRIDOR_TO_WEST)) _game._player._walkOffScreenSceneId = 354; } void Scene361::actions() { if (_action._lookFlag) _vm->_dialogs->show(36119); - else if (_action.isAction(VERB_SIT_AT, 0x1E4)) { + else if (_action.isAction(VERB_SIT_AT, NOUN_DESK)) { _scene->_kernelMessages.reset(); _scene->_kernelMessages.addQuote(0xFC, 120, 0); - } else if (_action.isAction(VERB_CLIMB_INTO, 0x11)) { + } else if (_action.isAction(VERB_CLIMB_INTO, NOUN_AIR_VENT)) { if (_globals[kSexOfRex] == REX_FEMALE) handleRoxAction(); else handleRexAction(); - } else if (_action.isAction(VERB_LOOK, 0x1E4)) + } else if (_action.isAction(VERB_LOOK, NOUN_DESK)) _vm->_dialogs->show(36110); - else if (_action.isAction(VERB_LOOK, 0x18D)) + else if (_action.isAction(VERB_LOOK, NOUN_WALL)) _vm->_dialogs->show(36111); - else if (_action.isAction(VERB_LOOK, 0x220) || _action.isAction(VERB_STARE_AT, 0x220)) + else if (_action.isAction(VERB_LOOK, NOUN_LIGHTING_FIXTURE) || _action.isAction(VERB_STARE_AT, NOUN_LIGHTING_FIXTURE)) _vm->_dialogs->show(36112); - else if (_action.isAction(VERB_LOOK, 0x208) || _action.isAction(VERB_STARE_AT, 0x208)) + else if (_action.isAction(VERB_LOOK, NOUN_LIGHTS) || _action.isAction(VERB_STARE_AT, NOUN_LIGHTS)) _vm->_dialogs->show(36113); - else if (_action.isAction(VERB_TAKE, 0x208)) + else if (_action.isAction(VERB_TAKE, NOUN_LIGHTS)) _vm->_dialogs->show(36114); - else if (_action.isAction(VERB_LOOK, 0x2F8) || _action.isAction(VERB_STARE_AT, 0x2F8)) + else if (_action.isAction(VERB_LOOK, NOUN_LIGHT_BULB) || _action.isAction(VERB_STARE_AT, NOUN_LIGHT_BULB)) _vm->_dialogs->show(36115); - else if (_action.isAction(VERB_TAKE, 0x2F8)) + else if (_action.isAction(VERB_TAKE, NOUN_LIGHT_BULB)) _vm->_dialogs->show(36116); - else if (_action.isAction(VERB_LOOK, 0x2BA)) + else if (_action.isAction(VERB_LOOK, NOUN_CORRIDOR_TO_WEST)) _vm->_dialogs->show(36117); - else if (_action.isAction(VERB_LOOK, 0x2B9)) + else if (_action.isAction(VERB_LOOK, NOUN_CORRIDOR_TO_EAST)) _vm->_dialogs->show(36118); - else if (_action.isAction(VERB_LOOK, 0x11)) + else if (_action.isAction(VERB_LOOK, NOUN_AIR_VENT)) _vm->_dialogs->show(36120); else return; @@ -5406,15 +5406,15 @@ void Scene366::enter() { } void Scene366::actions() { - if (_action.isAction(VERB_RETURN_TO, 0x2D4)) + if (_action.isAction(VERB_RETURN_TO, NOUN_AIR_SHAFT)) _scene->_nextSceneId = 302; - else if (_action.isAction(VERB_OPEN, 0x2D3)) { + else if (_action.isAction(VERB_OPEN, NOUN_GRATE)) { if (_game._visitedScenes.exists(316)) _vm->_dialogs->show(36612); else _vm->_dialogs->show(36613); _scene->_nextSceneId = 316; - } else if (_action.isAction(VERB_LOOK_THROUGH, 0x2D3)) { + } else if (_action.isAction(VERB_LOOK_THROUGH, NOUN_GRATE)) { if (_game._visitedScenes.exists(321)) _vm->_dialogs->show(36611); else @@ -5441,11 +5441,11 @@ void Scene387::enter() { } void Scene387::actions() { - if (_action.isAction(VERB_RETURN_TO, 0x2D4)) + if (_action.isAction(VERB_RETURN_TO, NOUN_AIR_SHAFT)) _scene->_nextSceneId = 313; - else if (_action.isAction(VERB_LOOK_THROUGH, 0x2D3)) + else if (_action.isAction(VERB_LOOK_THROUGH, NOUN_GRATE)) _vm->_dialogs->show(38710); - else if (_action.isAction(VERB_OPEN, 0x2D3)) + else if (_action.isAction(VERB_OPEN, NOUN_GRATE)) _vm->_dialogs->show(38711); else return; @@ -5479,9 +5479,9 @@ void Scene388::enter() { } void Scene388::actions() { - if (_action.isAction(VERB_RETURN_TO, 0x2D4)) + if (_action.isAction(VERB_RETURN_TO, NOUN_AIR_SHAFT)) _scene->_nextSceneId = 313; - else if (_action.isAction(VERB_TALKTO, 0x303)) { + else if (_action.isAction(VERB_TALKTO, NOUN_SAUROPOD)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -5503,12 +5503,12 @@ void Scene388::actions() { default: break; } - } else if (_action.isAction(VERB_LOOK_THROUGH, 0x2D3)) { + } else if (_action.isAction(VERB_LOOK_THROUGH, NOUN_GRATE)) { if (_globals[kAfterHavoc]) _vm->_dialogs->show(38811); else _vm->_dialogs->show(38810); - } else if (_action.isAction(VERB_OPEN, 0x2D3)) + } else if (_action.isAction(VERB_OPEN, NOUN_GRATE)) _vm->_dialogs->show(38812); else return; @@ -5556,9 +5556,9 @@ void Scene389::step() { } void Scene389::actions() { - if (_action.isAction(VERB_RETURN_TO, 0x2D4)) + if (_action.isAction(VERB_RETURN_TO, NOUN_AIR_SHAFT)) _scene->_nextSceneId = 313; - else if (_action.isAction(VERB_TALKTO, 0x304)) { + else if (_action.isAction(VERB_TALKTO, NOUN_MONSTER)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -5576,7 +5576,7 @@ void Scene389::actions() { default: break; } - } else if (_action.isAction(VERB_LOOK_THROUGH, 0x2D3)) { + } else if (_action.isAction(VERB_LOOK_THROUGH, NOUN_GRATE)) { if (_globals[kAfterHavoc]) { if ((_game._difficulty != DIFFICULTY_HARD) && (_game._objects[OBJ_SECURITY_CARD]._roomNumber == 359)) _vm->_dialogs->show(38911); @@ -5584,7 +5584,7 @@ void Scene389::actions() { _vm->_dialogs->show(38912); } else _vm->_dialogs->show(38910); - } else if (_action.isAction(VERB_OPEN, 0x2D3)) { + } else if (_action.isAction(VERB_OPEN, NOUN_GRATE)) { if (_globals[kAfterHavoc]) _vm->_dialogs->show(38914); else @@ -5617,11 +5617,11 @@ void Scene390::enter() { } void Scene390::actions() { - if (_action.isAction(VERB_RETURN_TO, 0x2D4)) + if (_action.isAction(VERB_RETURN_TO, NOUN_AIR_SHAFT)) _scene->_nextSceneId = 313; - else if (_action.isAction(VERB_LOOK_THROUGH, 0x2D3)) + else if (_action.isAction(VERB_LOOK_THROUGH, NOUN_GRATE)) _vm->_dialogs->show(39010); - else if (_action.isAction(VERB_OPEN, 0x2D3)) + else if (_action.isAction(VERB_OPEN, NOUN_GRATE)) _vm->_dialogs->show(39011); else return; @@ -5643,9 +5643,9 @@ void Scene391::enter() { } void Scene391::actions() { - if (_action.isAction(VERB_RETURN_TO, 0x2D4)) + if (_action.isAction(VERB_RETURN_TO, NOUN_AIR_SHAFT)) _scene->_nextSceneId = 313; - else if (_action.isAction(VERB_OPEN, 0x2D3)) { + else if (_action.isAction(VERB_OPEN, NOUN_GRATE)) { if (_globals[kKickedIn391Grate]) _vm->_dialogs->show(39113); else { @@ -5657,7 +5657,7 @@ void Scene391::actions() { _scene->_nextSceneId = 361; else _scene->_nextSceneId = 311; - } else if (_action.isAction(VERB_LOOK_THROUGH, 0x2D3)) { + } else if (_action.isAction(VERB_LOOK_THROUGH, NOUN_GRATE)) { if (_globals[kAfterHavoc]) _vm->_dialogs->show(39111); else @@ -5682,9 +5682,9 @@ void Scene399::enter() { } void Scene399::actions() { - if (_action.isAction(VERB_RETURN_TO, 0x2D4)) + if (_action.isAction(VERB_RETURN_TO, NOUN_AIR_SHAFT)) _scene->_nextSceneId = 313; - else if (_action.isAction(VERB_LOOK_THROUGH, 0x2D3)) { + else if (_action.isAction(VERB_LOOK_THROUGH, NOUN_GRATE)) { if (_globals[kAfterHavoc]) { if ((_game._difficulty != DIFFICULTY_HARD) && (_game._objects[OBJ_SECURITY_CARD]._roomNumber == 359)) _vm->_dialogs->show(38911); @@ -5692,7 +5692,7 @@ void Scene399::actions() { _vm->_dialogs->show(38912); } else _vm->_dialogs->show(38910); - } else if (_action.isAction(VERB_OPEN, 0x2D3)) { + } else if (_action.isAction(VERB_OPEN, NOUN_GRATE)) { if (_globals[kAfterHavoc]) _vm->_dialogs->show(38914); else diff --git a/engines/mads/nebular/nebular_scenes4.cpp b/engines/mads/nebular/nebular_scenes4.cpp index d8f3607f38..dd196b4059 100644 --- a/engines/mads/nebular/nebular_scenes4.cpp +++ b/engines/mads/nebular/nebular_scenes4.cpp @@ -158,12 +158,12 @@ void Scene401::step() { } void Scene401::preActions() { - if (_action.isAction(VERB_WALK_DOWN, 0x2B4)) { + if (_action.isAction(VERB_WALK_DOWN, NOUN_CORRIDOR_TO_NORTH)) { _game._player.walk(Common::Point(149, 89), FACING_NORTH); _northFl = false; } - if (_action.isAction(VERB_WALK_DOWN, 0x2B3) && !_northFl) + if (_action.isAction(VERB_WALK_DOWN, NOUN_CORRIDOR_TO_SOUTH) && !_northFl) _game._player._walkOffScreenSceneId = 405; if (_action.isAction(VERB_TAKE)) @@ -204,23 +204,23 @@ void Scene401::actions() { } } - if (_action.isAction(VERB_WALK_INTO, 0x241)) { + if (_action.isAction(VERB_WALK_INTO, NOUN_BAR)) { if (!_northFl) _scene->_nextSceneId = 402; - } else if (_action.isAction(VERB_WALK_DOWN, 0x2B4)) + } else if (_action.isAction(VERB_WALK_DOWN, NOUN_CORRIDOR_TO_NORTH)) _scene->_nextSceneId = 354; - else if (_action.isAction(VERB_LOOK, 0x1F3)) { + else if (_action.isAction(VERB_LOOK, NOUN_SCANNER)) { if (_globals[kHasBeenScanned]) _vm->_dialogs->show(40111); else _vm->_dialogs->show(40110); - } else if (_action.isAction(VERB_LOOK, 0x241)) + } else if (_action.isAction(VERB_LOOK, NOUN_BAR)) _vm->_dialogs->show(40112); - else if (_action.isAction(VERB_LOOK, 0x244)) + else if (_action.isAction(VERB_LOOK, NOUN_SIGN)) _vm->_dialogs->show(40113); - else if (_action.isAction(VERB_LOOK, 0x2B3)) + else if (_action.isAction(VERB_LOOK, NOUN_CORRIDOR_TO_SOUTH)) _vm->_dialogs->show(40114); - else if (_action.isAction(VERB_LOOK, 0x2B4)) + else if (_action.isAction(VERB_LOOK, NOUN_CORRIDOR_TO_NORTH)) _vm->_dialogs->show(40115); else if (_action._lookFlag) _vm->_dialogs->show(40116); @@ -1977,29 +1977,29 @@ void Scene402::step() { } void Scene402::preActions() { - if (_action.isAction(VERB_SIT_ON, 0x24A) && (_game._player._prepareWalkPos.x != 248)) + if (_action.isAction(VERB_SIT_ON, NOUN_BAR_STOOL) && (_game._player._prepareWalkPos.x != 248)) _game._player.walk(Common::Point(232, 112), FACING_EAST); - if (_action.isAction(VERB_WALKTO, 0x309)) + if (_action.isAction(VERB_WALKTO, NOUN_WOMAN_ON_BALCONY)) _game._player._needToWalk = _game._player._readyToWalk; - if (!_roxOnStool && _action.isAction(VERB_TAKE, 0x5C) && !_game._objects.isInInventory(OBJ_CREDIT_CHIP)) + if (!_roxOnStool && _action.isAction(VERB_TAKE, NOUN_CREDIT_CHIP) && !_game._objects.isInInventory(OBJ_CREDIT_CHIP)) _game._player.walk(Common::Point(246, 108), FACING_NORTH); if (_action.isAction(VERB_TAKE)) _game._player._needToWalk = false; - if (_action.isAction(VERB_TAKE, 0x5C) && !_roxOnStool) + if (_action.isAction(VERB_TAKE, NOUN_CREDIT_CHIP) && !_roxOnStool) _game._player._needToWalk = true; if (_roxOnStool) { if (_action.isAction(VERB_LOOK) || _action.isAction(0x24A) || _action.isAction(VERB_TALKTO)) _game._player._needToWalk = false; - if (_action.isAction(VERB_TAKE, 0x124) || _action.isAction(VERB_TAKE, 0x5C)) + if (_action.isAction(VERB_TAKE, NOUN_REPAIR_LIST) || _action.isAction(VERB_TAKE, NOUN_CREDIT_CHIP)) _game._player._needToWalk = false; - if (_action.isAction(VERB_TALKTO, 0x30A) || _action.isAction(VERB_TALKTO, 0x30C)) + if (_action.isAction(VERB_TALKTO, NOUN_WOMAN_IN_CHAIR) || _action.isAction(VERB_TALKTO, NOUN_WOMAN_IN_ALCOVE)) _game._player._needToWalk = _game._player._readyToWalk; if (_game._player._needToWalk) { @@ -2011,22 +2011,22 @@ void Scene402::preActions() { } } - if (_action.isAction(VERB_TAKE, 0x124) && !_roxOnStool && !_game._objects.isInInventory(OBJ_REPAIR_LIST)) + if (_action.isAction(VERB_TAKE, NOUN_REPAIR_LIST) && !_roxOnStool && !_game._objects.isInInventory(OBJ_REPAIR_LIST)) _game._player.walk(Common::Point(191, 99), FACING_NORTHEAST); - if (_action.isAction(VERB_TALKTO, 0x30E) && !_roxOnStool) + if (_action.isAction(VERB_TALKTO, NOUN_BARTENDER) && !_roxOnStool) _game._player.walk(Common::Point(228, 83), FACING_SOUTH); - if (_action.isAction(VERB_TALKTO, 0x3AA) && !_roxOnStool) + if (_action.isAction(VERB_TALKTO, NOUN_REPAIR_WOMAN) && !_roxOnStool) _game._player.walk(Common::Point(208, 102), FACING_NORTHEAST); } void Scene402::actions() { - if (_action.isAction(VERB_TAKE, 0x124) && _game._objects.isInRoom(OBJ_REPAIR_LIST) && _roxOnStool) { + if (_action.isAction(VERB_TAKE, NOUN_REPAIR_LIST) && _game._objects.isInRoom(OBJ_REPAIR_LIST) && _roxOnStool) { _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _scene->_sequences.addTimer(1, 77); _game._player._needToWalk = false; - } else if (_action.isAction(VERB_TAKE, 0x124) && _game._objects.isInRoom(OBJ_REPAIR_LIST) && !_roxOnStool) { + } else if (_action.isAction(VERB_TAKE, NOUN_REPAIR_LIST) && _game._objects.isInRoom(OBJ_REPAIR_LIST) && !_roxOnStool) { if (_game._trigger == 0) { _game._player._stepEnabled = false; _game._player._visible = false; @@ -2048,11 +2048,11 @@ void Scene402::actions() { _game._player._stepEnabled = true; } else if (_game._screenObjects._inputMode == 1) handleDialogs(); - else if (_action.isAction(VERB_WALK_INTO, 0x2B3)) + else if (_action.isAction(VERB_WALK_INTO, NOUN_CORRIDOR_TO_SOUTH)) _scene->_nextSceneId = 401; - else if (_action.isAction(VERB_WALK_ONTO, 0x248)) + else if (_action.isAction(VERB_WALK_ONTO, NOUN_DANCE_FLOOR)) ; // just... nothing - else if (_action.isAction(VERB_TALKTO, 0x3AA)) { + else if (_action.isAction(VERB_TALKTO, NOUN_REPAIR_WOMAN)) { switch (_game._trigger) { case 0: { _game._player._stepEnabled = false; @@ -2128,26 +2128,26 @@ void Scene402::actions() { } break; } - } else if (_action.isAction(VERB_TALKTO, 0x30A) && !_firstTalkToGirlInChair) { + } else if (_action.isAction(VERB_TALKTO, NOUN_WOMAN_IN_CHAIR) && !_firstTalkToGirlInChair) { _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x1D7)); _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _scene->_sequences.addTimer(150, 39); _game._player._stepEnabled = false; _firstTalkToGirlInChair = true; - } else if (_action.isAction(VERB_TALKTO, 0x30A) && _firstTalkToGirlInChair) { + } else if (_action.isAction(VERB_TALKTO, NOUN_WOMAN_IN_CHAIR) && _firstTalkToGirlInChair) { _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x1DB)); _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _scene->_sequences.addTimer(150, 42); _game._player._stepEnabled = false; - } else if (_action.isAction(VERB_TALKTO, 0x30C) || _action.isAction(VERB_WALKTO, 0x30C)) { + } else if (_action.isAction(VERB_TALKTO, NOUN_WOMAN_IN_ALCOVE) || _action.isAction(VERB_WALKTO, NOUN_WOMAN_IN_ALCOVE)) { _scene->_kernelMessages.add(Common::Point(102, 48), 0xFBFA, 0, 0, 120, _game.getQuote(0x1DE)); _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _scene->_sequences.addTimer(120, 44); _game._player._stepEnabled = false; - } else if (_action.isAction(VERB_WALK_ALONG, 0x24A) && (_game._player._targetPos.x == 248)){ + } else if (_action.isAction(VERB_WALK_ALONG, NOUN_BAR_STOOL) && (_game._player._targetPos.x == 248)){ _scene->_kernelMessages.add(Common::Point(0, -14), 0x1110, 34, 0, 120, _game.getQuote(0x20D)); _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x20E)); - } else if (_action.isAction(VERB_WALK_ALONG, 0x24A) && !_roxOnStool && (_game._player._targetPos.x != 248)) { + } else if (_action.isAction(VERB_WALK_ALONG, NOUN_BAR_STOOL) && !_roxOnStool && (_game._player._targetPos.x != 248)) { _game._player._visible = false; _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 7, 1, 0, 0); @@ -2155,11 +2155,11 @@ void Scene402::actions() { _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 5); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_EXPIRE, 0, 76); _game._player._stepEnabled = false; - } else if (_action.isAction(VERB_TAKE, 0x5C) && !_game._objects.isInInventory(OBJ_CREDIT_CHIP) && _roxOnStool) { + } else if (_action.isAction(VERB_TAKE, NOUN_CREDIT_CHIP) && !_game._objects.isInInventory(OBJ_CREDIT_CHIP) && _roxOnStool) { _roxMode = 20; _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _scene->_sequences.addTimer(1, 92); - } else if (_action.isAction(VERB_TAKE, 0x5C) && !_game._objects.isInInventory(OBJ_CREDIT_CHIP) && !_roxOnStool) { + } else if (_action.isAction(VERB_TAKE, NOUN_CREDIT_CHIP) && !_game._objects.isInInventory(OBJ_CREDIT_CHIP) && !_roxOnStool) { _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _game._player._stepEnabled = false; _game._player._visible = false; @@ -2170,7 +2170,7 @@ void Scene402::actions() { _scene->_sequences.setScale(_globals._sequenceIndexes[22], 88); _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _scene->_sequences.addSubEntry(_globals._sequenceIndexes[22], SEQUENCE_TRIGGER_EXPIRE, 0, 104); - } else if (_action.isAction(VERB_TALKTO, 0x30E)) { + } else if (_action.isAction(VERB_TALKTO, NOUN_BARTENDER)) { switch (_game._trigger) { case 0: { int centerFlag; @@ -2281,66 +2281,66 @@ void Scene402::actions() { default: break; } - } else if (_action.isAction(VERB_LOOK, 0x248)) + } else if (_action.isAction(VERB_LOOK, NOUN_DANCE_FLOOR)) _vm->_dialogs->show(40210); - else if (_action.isAction(VERB_LOOK, 0x16C)) { + else if (_action.isAction(VERB_LOOK, NOUN_TELEPORTER)) { if (_globals[kSomeoneHasExploded]) _vm->_dialogs->show(40212); else _vm->_dialogs->show(40211); - } else if (_action.isAction(VERB_LOOK, 0x241)) + } else if (_action.isAction(VERB_LOOK, NOUN_BAR)) _vm->_dialogs->show(40213); - else if (_action.isAction(VERB_LOOK, 0x30E)) + else if (_action.isAction(VERB_LOOK, NOUN_BARTENDER)) _vm->_dialogs->show(40214); - else if (_action.isAction(VERB_LOOK, 0x30C)) + else if (_action.isAction(VERB_LOOK, NOUN_WOMAN_IN_ALCOVE)) _vm->_dialogs->show(40215); - else if (_action.isAction(VERB_LOOK, 0x309)) + else if (_action.isAction(VERB_LOOK, NOUN_WOMAN_ON_BALCONY)) _vm->_dialogs->show(40216); - else if (_action.isAction(VERB_LOOK, 0x30A)) + else if (_action.isAction(VERB_LOOK, NOUN_WOMAN_IN_CHAIR)) _vm->_dialogs->show(40217); - else if (_action.isAction(VERB_LOOK, 0x3AA)) + else if (_action.isAction(VERB_LOOK, NOUN_REPAIR_WOMAN)) _vm->_dialogs->show(40218); - else if (_action.isAction(VERB_LOOK, 0x2B3)) + else if (_action.isAction(VERB_LOOK, NOUN_CORRIDOR_TO_SOUTH)) _vm->_dialogs->show(40219); else if (_action._lookFlag) _vm->_dialogs->show(40220); - else if (_action.isAction(VERB_LOOK, 0x2B8)) + else if (_action.isAction(VERB_LOOK, NOUN_WOMEN)) _vm->_dialogs->show(40221); - else if (_action.isAction(VERB_PUSH, 0x3AA) || _action.isAction(VERB_PULL, 0x3AA)) + else if (_action.isAction(VERB_PUSH, NOUN_REPAIR_WOMAN) || _action.isAction(VERB_PULL, NOUN_REPAIR_WOMAN)) _vm->_dialogs->show(40222); - else if (_action.isAction(VERB_TALKTO, 0x2B8)) + else if (_action.isAction(VERB_TALKTO, NOUN_WOMEN)) _vm->_dialogs->show(40223); - else if (_action.isAction(VERB_TALKTO, 0x309)) + else if (_action.isAction(VERB_TALKTO, NOUN_WOMAN_ON_BALCONY)) _vm->_dialogs->show(40224); - else if (_action.isAction(VERB_LOOK, 0x249)) + else if (_action.isAction(VERB_LOOK, NOUN_RAILING)) _vm->_dialogs->show(40225); - else if (_action.isAction(VERB_LOOK, 0x160)) + else if (_action.isAction(VERB_LOOK, NOUN_TABLE)) _vm->_dialogs->show(40226); - else if (_action.isAction(VERB_TAKE, 0x160)) + else if (_action.isAction(VERB_TAKE, NOUN_TABLE)) _vm->_dialogs->show(40227); - else if (_action.isAction(VERB_LOOK, 0x244)) + else if (_action.isAction(VERB_LOOK, NOUN_SIGN)) _vm->_dialogs->show(40228); - else if (_action.isAction(VERB_TAKE, 0x244)) + else if (_action.isAction(VERB_TAKE, NOUN_SIGN)) _vm->_dialogs->show(40229); - else if (_action.isAction(VERB_LOOK, 0x24A)) + else if (_action.isAction(VERB_LOOK, NOUN_BAR_STOOL)) _vm->_dialogs->show(40230); - else if (_action.isAction(VERB_TAKE, 0x24A)) + else if (_action.isAction(VERB_TAKE, NOUN_BAR_STOOL)) _vm->_dialogs->show(40231); - else if (_action.isAction(VERB_LOOK, 0x3B)) + else if (_action.isAction(VERB_LOOK, NOUN_CACTUS)) _vm->_dialogs->show(40232); - else if (_action.isAction(VERB_TAKE, 0x3B)) + else if (_action.isAction(VERB_TAKE, NOUN_CACTUS)) _vm->_dialogs->show(40233); - else if (_action.isAction(VERB_LOOK, 0x24E)) + else if (_action.isAction(VERB_LOOK, NOUN_DISCO_BALL)) _vm->_dialogs->show(40234); - else if (_action.isAction(VERB_LOOK, 0x247)) + else if (_action.isAction(VERB_LOOK, NOUN_UPPER_DANCE_FLOOR)) _vm->_dialogs->show(40235); - else if (_action.isAction(VERB_LOOK, 0x174)) + else if (_action.isAction(VERB_LOOK, NOUN_TREE)) _vm->_dialogs->show(40236); - else if (_action.isAction(VERB_LOOK, 0x10E)) + else if (_action.isAction(VERB_LOOK, NOUN_PLANT)) _vm->_dialogs->show(40237); - else if (_action.isAction(VERB_TAKE, 0x10E)) + else if (_action.isAction(VERB_TAKE, NOUN_PLANT)) _vm->_dialogs->show(40238); - else if (_action.isAction(VERB_LOOK, 0x124) && _game._objects.isInRoom(OBJ_REPAIR_LIST)) + else if (_action.isAction(VERB_LOOK, NOUN_REPAIR_LIST) && _game._objects.isInRoom(OBJ_REPAIR_LIST)) _vm->_dialogs->show(40239); else return; @@ -2435,24 +2435,24 @@ void Scene405::preActions() { if (_action.isAction(VERB_TAKE)) _game._player._needToWalk = false; - if (_action.isAction(VERB_WALK_DOWN, 0x2BA)) + if (_action.isAction(VERB_WALK_DOWN, NOUN_CORRIDOR_TO_WEST)) _game._player._walkOffScreenSceneId = 401; - if (_action.isAction(VERB_WALK_DOWN, 0x2B9)) + if (_action.isAction(VERB_WALK_DOWN, NOUN_CORRIDOR_TO_EAST)) _game._player._walkOffScreenSceneId = 406; - if (_action.isAction(VERB_CLOSE, 0x259) && _globals[kArmoryDoorOpen]) + if (_action.isAction(VERB_CLOSE, NOUN_WIDE_DOOR) && _globals[kArmoryDoorOpen]) _game._player.walk(Common::Point(212, 113), FACING_NORTH); } void Scene405::actions() { - if (_action.isAction(VERB_WALK_THROUGH, 0x6E)) + if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOOR)) _scene->_nextSceneId = 413; - else if (_action.isAction(VERB_WALK_THROUGH, 0x259) && _globals[kArmoryDoorOpen]) + else if (_action.isAction(VERB_WALK_THROUGH, NOUN_WIDE_DOOR) && _globals[kArmoryDoorOpen]) _scene->_nextSceneId = 408; - else if (_action.isAction(VERB_WALK_THROUGH, 0x259) && !_globals[kArmoryDoorOpen]) + else if (_action.isAction(VERB_WALK_THROUGH, NOUN_WIDE_DOOR) && !_globals[kArmoryDoorOpen]) _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 60, _game.getQuote(0x24F)); - else if (_action.isAction(VERB_PUT, 0x131, 0x251) && !_globals[kArmoryDoorOpen]) { + else if (_action.isAction(VERB_PUT, NOUN_SECURITY_CARD, 0x251) && !_globals[kArmoryDoorOpen]) { _game._player._stepEnabled = false; _game._player._visible = false; _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; @@ -2462,7 +2462,7 @@ void Scene405::actions() { Common::Point msgPos = Common::Point(_game._player._playerPos.x, _game._player._playerPos.y + 1); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[3], msgPos); _scene->_sequences.setScale(_globals._sequenceIndexes[3], 87); - } else if ((_action.isAction(VERB_PUT, 0x131, 0x251) || _action.isAction(VERB_CLOSE, 0x259)) && _globals[kArmoryDoorOpen]) { + } else if ((_action.isAction(VERB_PUT, NOUN_SECURITY_CARD, 0x251) || _action.isAction(VERB_CLOSE, NOUN_WIDE_DOOR)) && _globals[kArmoryDoorOpen]) { _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _game._player._stepEnabled = false; _game._player._visible = false; @@ -2471,7 +2471,7 @@ void Scene405::actions() { _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 70); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[3], _game._player._playerPos); _scene->_sequences.setScale(_globals._sequenceIndexes[3], 87); - } else if (_action.isAction(VERB_PUT, 0x251)) { + } else if (_action.isAction(VERB_PUT, NOUN_CARD_SLOT)) { _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _game._player._stepEnabled = false; _game._player._visible = false; @@ -2480,36 +2480,36 @@ void Scene405::actions() { _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 80); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[3], _game._player._playerPos); _scene->_sequences.setScale(_globals._sequenceIndexes[3], 87); - } else if (_action.isAction(VERB_LOOK, 0x31A)) + } else if (_action.isAction(VERB_LOOK, NOUN_CANNON_BALLS)) _vm->_dialogs->show(40510); - else if (_action.isAction(VERB_TAKE, 0x31A)) + else if (_action.isAction(VERB_TAKE, NOUN_CANNON_BALLS)) _vm->_dialogs->show(40511); - else if (_action.isAction(VERB_LOOK, 0x254)) + else if (_action.isAction(VERB_LOOK, NOUN_WATER_FOUNTAIN)) _vm->_dialogs->show(40512); - else if (_action.isAction(VERB_LOOK, 0x258) || _action.isAction(VERB_LOOK, 0x252)) + else if (_action.isAction(VERB_LOOK, NOUN_BACKBOARD) || _action.isAction(VERB_LOOK, NOUN_HOOP)) _vm->_dialogs->show(40513); - else if (_action.isAction(VERB_LOOK, 0xCD)) + else if (_action.isAction(VERB_LOOK, NOUN_LIGHT)) _vm->_dialogs->show(40514); - else if (_action.isAction(VERB_LOOK, 0x251)) + else if (_action.isAction(VERB_LOOK, NOUN_CARD_SLOT)) _vm->_dialogs->show(40515); - else if (_action.isAction(VERB_LOOK, 0x2B9)) + else if (_action.isAction(VERB_LOOK, NOUN_CORRIDOR_TO_EAST)) _vm->_dialogs->show(40516); - else if (_action.isAction(VERB_LOOK, 0x2BA)) + else if (_action.isAction(VERB_LOOK, NOUN_CORRIDOR_TO_WEST)) _vm->_dialogs->show(40517); - else if (_action.isAction(VERB_LOOK, 0xE2)) + else if (_action.isAction(VERB_LOOK, NOUN_MONITOR)) _vm->_dialogs->show(40518); - else if (_action.isAction(VERB_LOOK, 0x204) || _action._lookFlag) + else if (_action.isAction(VERB_LOOK, NOUN_CORRIDOR) || _action._lookFlag) _vm->_dialogs->show(40519); - else if (_action.isAction(VERB_LOOK, 0x259)) { + else if (_action.isAction(VERB_LOOK, NOUN_WIDE_DOOR)) { if (_globals[kArmoryDoorOpen]) _vm->_dialogs->show(40521); else _vm->_dialogs->show(40520); - } else if (_action.isAction(VERB_LOOK, 0x6E)) + } else if (_action.isAction(VERB_LOOK, NOUN_DOOR)) _vm->_dialogs->show(40522); - else if (_action.isAction(VERB_LOOK, 0x250)) + else if (_action.isAction(VERB_LOOK, NOUN_COACH_LAMP)) _vm->_dialogs->show(40523); - else if (_action.isAction(VERB_LOOK, 0x257)) + else if (_action.isAction(VERB_LOOK, NOUN_SUPPORT)) _vm->_dialogs->show(40524); else return; @@ -2621,36 +2621,36 @@ void Scene406::step() { } void Scene406::preActions() { - if (_action.isAction(VERB_WALK_DOWN, 0x2BA)) + if (_action.isAction(VERB_WALK_DOWN, NOUN_CORRIDOR_TO_WEST)) _game._player._walkOffScreenSceneId = 405; - if (_action.isAction(VERB_WALK_DOWN, 0x2B9)) + if (_action.isAction(VERB_WALK_DOWN, NOUN_CORRIDOR_TO_EAST)) _game._player._walkOffScreenSceneId = 407; if (_action.isAction(VERB_TAKE)) _game._player._needToWalk = false; - if (_action.isAction(VERB_LOOK, 0x244) || _action.isAction(VERB_LOOK, 0x25C)) + if (_action.isAction(VERB_LOOK, NOUN_SIGN) || _action.isAction(VERB_LOOK, NOUN_TRASH)) _game._player._needToWalk = true; } void Scene406::actions() { - if (_action.isAction(VERB_WALK_THROUGH, 0x6E) && (_game._player._targetPos.x> 100)) { + if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOOR) && (_game._player._targetPos.x> 100)) { _game._player._stepEnabled = false; _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _scene->_sequences.remove(_globals._sequenceIndexes[3]); _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 3, 1, 0, 0); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 80); _vm->_sound->command(19); - } else if (_action.isAction(VERB_WALK_THROUGH, 0x6E) && _globals[kStorageDoorOpen] && (_game._player._targetPos.x < 100)) + } else if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOOR) && _globals[kStorageDoorOpen] && (_game._player._targetPos.x < 100)) _scene->_nextSceneId = 410; - else if (_action.isAction(VERB_WALK_THROUGH, 0x6E) && !_globals[kStorageDoorOpen] && (_game._player._targetPos.x < 100)) { + else if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOOR) && !_globals[kStorageDoorOpen] && (_game._player._targetPos.x < 100)) { _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 60, _game.getQuote(0x24F)); if (!_hitStorageDoor) { _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _scene->_sequences.addTimer(80, 100); } - } else if (_action.isAction(VERB_PUT, 0x131, 0x251) && !_globals[kStorageDoorOpen]) { + } else if (_action.isAction(VERB_PUT, NOUN_SECURITY_CARD, 0x251) && !_globals[kStorageDoorOpen]) { _game._player._stepEnabled = false; _game._player._visible = false; _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; @@ -2660,7 +2660,7 @@ void Scene406::actions() { Common::Point msgPos = Common::Point(_game._player._playerPos.x, _game._player._playerPos.y + 1); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], msgPos); _scene->_sequences.setScale(_globals._sequenceIndexes[2], 87); - } else if (_action.isAction(VERB_PUT, 0x131, 0x251) && _globals[kStorageDoorOpen]) { + } else if (_action.isAction(VERB_PUT, NOUN_SECURITY_CARD, 0x251) && _globals[kStorageDoorOpen]) { _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _game._player._stepEnabled = false; _game._player._visible = false; @@ -2670,7 +2670,7 @@ void Scene406::actions() { Common::Point msgPos = Common::Point(_game._player._playerPos.x, _game._player._playerPos.y + 1); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], msgPos); _scene->_sequences.setScale(_globals._sequenceIndexes[2], 87); - } else if (_action.isAction(VERB_PUT, 0x251)) { + } else if (_action.isAction(VERB_PUT, NOUN_CARD_SLOT)) { _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _game._player._stepEnabled = false; _game._player._visible = false; @@ -2679,42 +2679,42 @@ void Scene406::actions() { _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 110); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], _game._player._playerPos); _scene->_sequences.setScale(_globals._sequenceIndexes[2], 87); - } else if (_action.isAction(VERB_LOOK, 0x25C)) + } else if (_action.isAction(VERB_LOOK, NOUN_TRASH)) _vm->_dialogs->show(40610); - else if (_action.isAction(VERB_TAKE, 0x25C)) + else if (_action.isAction(VERB_TAKE, NOUN_TRASH)) _vm->_dialogs->show(40611); - else if (_action.isAction(VERB_LOOK, 0x251)) + else if (_action.isAction(VERB_LOOK, NOUN_CARD_SLOT)) _vm->_dialogs->show(40612); - else if (_action.isAction(VERB_LOOK, 0x25B)) + else if (_action.isAction(VERB_LOOK, NOUN_FIRE_EXTINGUISHER)) _vm->_dialogs->show(40614); - else if (_action.isAction(VERB_TAKE, 0x25B)) + else if (_action.isAction(VERB_TAKE, NOUN_FIRE_EXTINGUISHER)) _vm->_dialogs->show(40615); - else if (_action.isAction(VERB_LOOK, 0x2B9)) + else if (_action.isAction(VERB_LOOK, NOUN_CORRIDOR_TO_EAST)) _vm->_dialogs->show(40616); - else if (_action.isAction(VERB_LOOK, 0x2BA)) + else if (_action.isAction(VERB_LOOK, NOUN_CORRIDOR_TO_WEST)) _vm->_dialogs->show(40617); - else if (_action.isAction(VERB_LOOK, 0x204) || _action._lookFlag) + else if (_action.isAction(VERB_LOOK, NOUN_CORRIDOR) || _action._lookFlag) _vm->_dialogs->show(40618); - else if (_action.isAction(VERB_LOOK, 0x18D)) + else if (_action.isAction(VERB_LOOK, NOUN_WALL)) _vm->_dialogs->show(40619); - else if (_action.isAction(VERB_LOOK, 0x6E)) { + else if (_action.isAction(VERB_LOOK, NOUN_DOOR)) { if (_globals[kStorageDoorOpen]) _vm->_dialogs->show(40621); else _vm->_dialogs->show(40620); - } else if (_action.isAction(VERB_LOOK, 0xE2)) + } else if (_action.isAction(VERB_LOOK, NOUN_MONITOR)) _vm->_dialogs->show(40623); - else if (_action.isAction(VERB_LOOK, 0x47A)) + else if (_action.isAction(VERB_LOOK, NOUN_SIGNPOST)) _vm->_dialogs->show(40624); - else if (_action.isAction(VERB_TAKE, 0x47A)) + else if (_action.isAction(VERB_TAKE, NOUN_SIGNPOST)) _vm->_dialogs->show(40625); - else if (_action.isAction(VERB_LOOK, 0x2F)) + else if (_action.isAction(VERB_LOOK, NOUN_BOULDER)) _vm->_dialogs->show(40626); - else if (_action.isAction(VERB_TAKE, 0x2F)) + else if (_action.isAction(VERB_TAKE, NOUN_BOULDER)) _vm->_dialogs->show(40627); - else if (_action.isAction(VERB_LOOK, 0x244)) + else if (_action.isAction(VERB_LOOK, NOUN_SIGN)) _vm->_dialogs->show(40628); - else if (_action.isAction(VERB_TAKE, 0x244)) + else if (_action.isAction(VERB_TAKE, NOUN_SIGN)) _vm->_dialogs->show(40629); else return; @@ -2771,10 +2771,10 @@ void Scene407::preActions() { if (_action.isAction(VERB_TAKE)) _game._player._needToWalk = false; - if (_action.isAction(VERB_LOOK, 0x6E)) + if (_action.isAction(VERB_LOOK, NOUN_DOOR)) _game._player._needToWalk = true; - if (_action.isAction(VERB_WALK_DOWN, 0x2B4)) { + if (_action.isAction(VERB_WALK_DOWN, NOUN_CORRIDOR_TO_NORTH)) { _game._player.walk(Common::Point(172, 91), FACING_NORTH); _fromNorth = false; } @@ -2813,20 +2813,20 @@ void Scene407::actions() { } } - if (_action.isAction(VERB_WALK_DOWN, 0x2B3) && !_fromNorth) + if (_action.isAction(VERB_WALK_DOWN, NOUN_CORRIDOR_TO_SOUTH) && !_fromNorth) _scene->_nextSceneId = 406; - else if (_action.isAction(VERB_WALK_DOWN, 0x2B4)) + else if (_action.isAction(VERB_WALK_DOWN, NOUN_CORRIDOR_TO_NORTH)) _scene->_nextSceneId = 318; - else if (_action.isAction(VERB_LOOK, 0x1F3)) { + else if (_action.isAction(VERB_LOOK, NOUN_SCANNER)) { if (_globals[kHasBeenScanned]) _vm->_dialogs->show(40711); else _vm->_dialogs->show(40710); - } else if (_action.isAction(VERB_LOOK, 0x6E)) + } else if (_action.isAction(VERB_LOOK, NOUN_DOOR)) _vm->_dialogs->show(40712); - else if (_action.isAction(VERB_LOOK, 0x2B3)) + else if (_action.isAction(VERB_LOOK, NOUN_CORRIDOR_TO_SOUTH)) _vm->_dialogs->show(40713); - else if (_action.isAction(VERB_LOOK, 0x2B4)) + else if (_action.isAction(VERB_LOOK, NOUN_CORRIDOR_TO_NORTH)) _vm->_dialogs->show(40714); else if (_action._lookFlag) _vm->_dialogs->show(40715); @@ -2870,18 +2870,18 @@ void Scene408::enter() { } void Scene408::preActions() { - if ((_action.isAction(VERB_TAKE) && !_action.isAction(0x167)) || _action.isAction(VERB_PULL, 0x47B) || _action.isAction(VERB_OPEN, 0x265)) + if ((_action.isAction(VERB_TAKE) && !_action.isAction(0x167)) || _action.isAction(VERB_PULL, NOUN_PIN) || _action.isAction(VERB_OPEN, NOUN_CARTON)) _game._player._needToWalk = false; - if ((_action.isAction(VERB_LOOK, 0x167) && _game._objects.isInRoom(0x17)) || _action.isAction(VERB_LOOK, 0x263)) + if ((_action.isAction(VERB_LOOK, NOUN_TARGET_MODULE) && _game._objects.isInRoom(0x17)) || _action.isAction(VERB_LOOK, NOUN_CHEST)) _game._player._needToWalk = true; } void Scene408::actions() { - if (_action.isAction(VERB_WALK_INTO, 0x2B3)) { + if (_action.isAction(VERB_WALK_INTO, NOUN_CORRIDOR_TO_SOUTH)) { _scene->_nextSceneId = 405; _vm->_sound->command(58); - } else if (_action.isAction(VERB_TAKE, 0x167) && (_game._objects.isInRoom(OBJ_TARGET_MODULE) || _game._trigger)) { + } else if (_action.isAction(VERB_TAKE, NOUN_TARGET_MODULE) && (_game._objects.isInRoom(OBJ_TARGET_MODULE) || _game._trigger)) { switch (_game._trigger) { case (0): _vm->_sound->command(57); @@ -2913,84 +2913,84 @@ void Scene408::actions() { default: break; } - } else if (_action.isAction(VERB_LOOK, 0x2BC)) + } else if (_action.isAction(VERB_LOOK, NOUN_ARMORED_VEHICLE)) _vm->_dialogs->show(40810); - else if (_action.isAction(VERB_TAKE, 0x2BC) || _action.isAction(VERB_TAKE, 0x261) || _action.isAction(VERB_TAKE, 0x25F)) + else if (_action.isAction(VERB_TAKE, NOUN_ARMORED_VEHICLE) || _action.isAction(VERB_TAKE, NOUN_ANVIL) || _action.isAction(VERB_TAKE, NOUN_TWO_TON_WEIGHT)) _vm->_dialogs->show(40811); - else if (_action.isAction(VERB_LOOK, 0x2BE)) + else if (_action.isAction(VERB_LOOK, NOUN_MISSILE)) _vm->_dialogs->show(40812); - else if (_action.isAction(VERB_TAKE, 0x2BE)) + else if (_action.isAction(VERB_TAKE, NOUN_MISSILE)) _vm->_dialogs->show(40813); - else if (_action.isAction(VERB_LOOK, 0x2C2)) + else if (_action.isAction(VERB_LOOK, NOUN_GRENADE)) _vm->_dialogs->show(40814); - else if (_action.isAction(VERB_TAKE, 0x2C2)) + else if (_action.isAction(VERB_TAKE, NOUN_GRENADE)) _vm->_dialogs->show(40815); - else if (_action.isAction(VERB_TAKE, 0x47B) || _action.isAction(VERB_PULL, 0x47B)) + else if (_action.isAction(VERB_TAKE, NOUN_PIN) || _action.isAction(VERB_PULL, NOUN_PIN)) _vm->_dialogs->show(40816); - else if (_action.isAction(VERB_LOOK, 0x26D)) + else if (_action.isAction(VERB_LOOK, NOUN_BLIMP)) _vm->_dialogs->show(40817); - else if (_action.isAction(VERB_TAKE, 0x26D)) + else if (_action.isAction(VERB_TAKE, NOUN_BLIMP)) _vm->_dialogs->show(40818); - else if (_action.isAction(VERB_LOOK, 0x2BB)) + else if (_action.isAction(VERB_LOOK, NOUN_AMMUNITION)) _vm->_dialogs->show(40819); - else if (_action.isAction(VERB_TAKE, 0x2BB)) + else if (_action.isAction(VERB_TAKE, NOUN_AMMUNITION)) _vm->_dialogs->show(40820); - else if (_action.isAction(VERB_LOOK, 0x269)) + else if (_action.isAction(VERB_LOOK, NOUN_CATAPULT)) _vm->_dialogs->show(40821); - else if (_action.isAction(VERB_TAKE, 0x269)) + else if (_action.isAction(VERB_TAKE, NOUN_CATAPULT)) _vm->_dialogs->show(40822); - else if (_action.isAction(VERB_LOOK, 0x263)) { + else if (_action.isAction(VERB_LOOK, NOUN_CHEST)) { if (_game._objects.isInRoom(OBJ_TARGET_MODULE)) _vm->_dialogs->show(40823); else _vm->_dialogs->show(40824); - } else if (_action.isAction(VERB_TAKE, 0x263)) + } else if (_action.isAction(VERB_TAKE, NOUN_CHEST)) _vm->_dialogs->show(40825); - else if (_action.isAction(VERB_LOOK, 0x2BF)) + else if (_action.isAction(VERB_LOOK, NOUN_SUIT_OF_ARMOR)) _vm->_dialogs->show(40826); - else if (_action.isAction(VERB_TAKE, 0x2BF)) + else if (_action.isAction(VERB_TAKE, NOUN_SUIT_OF_ARMOR)) _vm->_dialogs->show(40827); - else if (_action.isAction(VERB_LOOK, 0x7B)) + else if (_action.isAction(VERB_LOOK, NOUN_ESCAPE_HATCH)) _vm->_dialogs->show(40828); - else if (_action.isAction(VERB_OPEN, 0x7B) || _action.isAction(VERB_PULL, 0x7B)) + else if (_action.isAction(VERB_OPEN, NOUN_ESCAPE_HATCH) || _action.isAction(VERB_PULL, NOUN_ESCAPE_HATCH)) _vm->_dialogs->show(40829); - else if (_action.isAction(VERB_LOOK, 0x26B)) + else if (_action.isAction(VERB_LOOK, NOUN_BARRELS)) _vm->_dialogs->show(40830); - else if (_action.isAction(VERB_TAKE, 0x26B)) + else if (_action.isAction(VERB_TAKE, NOUN_BARRELS)) _vm->_dialogs->show(40831); - else if (_action.isAction(VERB_LOOK, 0x2C1)) + else if (_action.isAction(VERB_LOOK, NOUN_INFLATABLE_RAFT)) _vm->_dialogs->show(40832); - else if (_action.isAction(VERB_TAKE, 0x2C1)) + else if (_action.isAction(VERB_TAKE, NOUN_INFLATABLE_RAFT)) _vm->_dialogs->show(40833); - else if (_action.isAction(VERB_LOOK, 0x2BD)) + else if (_action.isAction(VERB_LOOK, NOUN_TOMATO)) _vm->_dialogs->show(40834); - else if (_action.isAction(VERB_TAKE, 0x2BD)) + else if (_action.isAction(VERB_TAKE, NOUN_TOMATO)) _vm->_dialogs->show(40835); - else if (_action.isAction(VERB_LOOK, 0x261)) + else if (_action.isAction(VERB_LOOK, NOUN_ANVIL)) _vm->_dialogs->show(40836); - else if (_action.isAction(VERB_LOOK, 0x25F)) + else if (_action.isAction(VERB_LOOK, NOUN_TWO_TON_WEIGHT)) _vm->_dialogs->show(40837); - else if (_action.isAction(VERB_LOOK, 0x2C0)) + else if (_action.isAction(VERB_LOOK, NOUN_POWDER_CONTAINER)) _vm->_dialogs->show(40838); - else if (_action.isAction(VERB_LOOK, 0x47C)) + else if (_action.isAction(VERB_LOOK, NOUN_POWDER_PUFF)) _vm->_dialogs->show(40839); - else if (_action.isAction(VERB_TAKE, 0x47C)) + else if (_action.isAction(VERB_TAKE, NOUN_POWDER_PUFF)) _vm->_dialogs->show(40840); - else if (_action.isAction(VERB_LOOK, 0x265)) + else if (_action.isAction(VERB_LOOK, NOUN_CARTON)) _vm->_dialogs->show(40841); - else if (_action.isAction(VERB_TAKE, 0x265)) + else if (_action.isAction(VERB_TAKE, NOUN_CARTON)) _vm->_dialogs->show(40842); - else if (_action.isAction(VERB_OPEN, 0x265)) + else if (_action.isAction(VERB_OPEN, NOUN_CARTON)) _vm->_dialogs->show(40843); - else if (_action.isAction(VERB_LOOK, 0x2B3)) + else if (_action.isAction(VERB_LOOK, NOUN_CORRIDOR_TO_SOUTH)) _vm->_dialogs->show(40844); else if (_action._lookFlag) _vm->_dialogs->show(40845); - else if (_action.isAction(VERB_LOOK, 0x167) && _game._objects.isInRoom(OBJ_TARGET_MODULE)) + else if (_action.isAction(VERB_LOOK, NOUN_TARGET_MODULE) && _game._objects.isInRoom(OBJ_TARGET_MODULE)) _vm->_dialogs->show(40846); - else if (_action.isAction(VERB_LOOK, 0x26C)) + else if (_action.isAction(VERB_LOOK, NOUN_LOADING_RAMP)) _vm->_dialogs->show(40848); - else if (_action.isAction(VERB_OPEN, 0x263)) + else if (_action.isAction(VERB_OPEN, NOUN_CHEST)) _vm->_dialogs->show(40849); else return; @@ -3028,24 +3028,24 @@ void Scene409::actions() { return; } - if (_action.isAction(VERB_LOOK, 0x181)) + if (_action.isAction(VERB_LOOK, NOUN_VIEWPORT)) _vm->_dialogs->show(40910); - else if (_action.isAction(VERB_PEER_THROUGH, 0x181)) + else if (_action.isAction(VERB_PEER_THROUGH, NOUN_VIEWPORT)) _vm->_dialogs->show(40910); - else if (_action.isAction(VERB_LOOK, 0xC4)) + else if (_action.isAction(VERB_LOOK, NOUN_KEYPAD)) _vm->_dialogs->show(40911); - else if (_action.isAction(VERB_INSPECT, 0xC4)) + else if (_action.isAction(VERB_INSPECT, NOUN_KEYPAD)) _vm->_dialogs->show(40911); - else if (_action.isAction(VERB_LOOK, 0x1CC)) + else if (_action.isAction(VERB_LOOK, NOUN_DISPLAY)) _vm->_dialogs->show(40912); - else if (_action.isAction(VERB_LOOK, 0x1D1) || _action.isAction(VERB_LOOK, 0x1D2) - || _action.isAction(VERB_LOOK, 0x1D3) || _action.isAction(VERB_LOOK, 0x1D4) - || _action.isAction(VERB_LOOK, 0x1D5) || _action.isAction(VERB_LOOK, 0x1D6) - || _action.isAction(VERB_LOOK, 0x1D7) || _action.isAction(VERB_LOOK, 0x1D8) - || _action.isAction(VERB_LOOK, 0x1D9) || _action.isAction(VERB_LOOK, 0x1D0) - || _action.isAction(VERB_LOOK, 0x1DB) || _action.isAction(VERB_LOOK, 0x1DA)) + else if (_action.isAction(VERB_LOOK, NOUN_1_KEY) || _action.isAction(VERB_LOOK, NOUN_2_KEY) + || _action.isAction(VERB_LOOK, NOUN_3_KEY) || _action.isAction(VERB_LOOK, NOUN_4_KEY) + || _action.isAction(VERB_LOOK, NOUN_5_KEY) || _action.isAction(VERB_LOOK, NOUN_6_KEY) + || _action.isAction(VERB_LOOK, NOUN_7_KEY) || _action.isAction(VERB_LOOK, NOUN_8_KEY) + || _action.isAction(VERB_LOOK, NOUN_9_KEY) || _action.isAction(VERB_LOOK, NOUN_0_KEY) + || _action.isAction(VERB_LOOK, NOUN_SMILE_KEY) || _action.isAction(VERB_LOOK, NOUN_FROWN_KEY)) _vm->_dialogs->show(40913); - else if (_action.isAction(VERB_LOOK, 0x1CF)) + else if (_action.isAction(VERB_LOOK, NOUN_DEVICE)) _vm->_dialogs->show(40914); else if (_action._lookFlag) _vm->_dialogs->show(40914); @@ -3116,20 +3116,20 @@ void Scene410::preActions() { if (_action.isAction(VERB_TAKE) && !_action.isAction(0x48)) _game._player._needToWalk = false; - if (_action.isAction(VERB_LOOK, 0x48) && _game._objects.isInRoom(OBJ_CHARGE_CASES)) + if (_action.isAction(VERB_LOOK, NOUN_CHARGE_CASES) && _game._objects.isInRoom(OBJ_CHARGE_CASES)) _game._player._needToWalk = true; - if (_action.isAction(VERB_OPEN, 0x278) || _action.isAction(VERB_OPEN, 0x214)) + if (_action.isAction(VERB_OPEN, NOUN_SACKS) || _action.isAction(VERB_OPEN, NOUN_SACK)) _game._player._needToWalk = false; - if (_action.isAction(VERB_LOOK, 0x272)) + if (_action.isAction(VERB_LOOK, NOUN_CAN)) _game._player._needToWalk = true; } void Scene410::actions() { - if (_action.isAction(VERB_WALK_INTO, 0x2B3)) + if (_action.isAction(VERB_WALK_INTO, NOUN_CORRIDOR_TO_SOUTH)) _scene->_nextSceneId = 406; - else if (_action.isAction(VERB_TAKE, 0x48) && (_game._objects.isInRoom(OBJ_CHARGE_CASES) || _game._trigger)) { + else if (_action.isAction(VERB_TAKE, NOUN_CHARGE_CASES) && (_game._objects.isInRoom(OBJ_CHARGE_CASES) || _game._trigger)) { switch (_game._trigger) { case (0): _vm->_sound->command(57); @@ -3162,52 +3162,52 @@ void Scene410::actions() { default: break; } - } else if (_action.isAction(VERB_LOOK, 0x276)) + } else if (_action.isAction(VERB_LOOK, NOUN_BARREL)) _vm->_dialogs->show(41010); - else if (_action.isAction(VERB_TAKE, 0x276)) + else if (_action.isAction(VERB_TAKE, NOUN_BARREL)) _vm->_dialogs->show(41011); - else if (_action.isAction(VERB_OPEN, 0x276)) + else if (_action.isAction(VERB_OPEN, NOUN_BARREL)) _vm->_dialogs->show(41012); - else if (_action.isAction(VERB_LOOK, 0x270)) + else if (_action.isAction(VERB_LOOK, NOUN_RUG)) _vm->_dialogs->show(41013); - else if (_action.isAction(VERB_TAKE, 0x270)) + else if (_action.isAction(VERB_TAKE, NOUN_RUG)) _vm->_dialogs->show(41014); - else if (_action.isAction(VERB_LOOK, 0x265) || _action.isAction(VERB_OPEN, 0x265)) { + else if (_action.isAction(VERB_LOOK, NOUN_CARTON) || _action.isAction(VERB_OPEN, NOUN_CARTON)) { if (_game._objects.isInRoom(OBJ_CHARGE_CASES)) _vm->_dialogs->show(41015); else _vm->_dialogs->show(41016); - } else if (_action.isAction(VERB_LOOK, 0x26E)) + } else if (_action.isAction(VERB_LOOK, NOUN_FLOUR)) _vm->_dialogs->show(41017); - else if (_action.isAction(VERB_TAKE, 0x26E)) + else if (_action.isAction(VERB_TAKE, NOUN_FLOUR)) _vm->_dialogs->show(41018); - else if (_action.isAction(VERB_LOOK, 0x278)) + else if (_action.isAction(VERB_LOOK, NOUN_SACKS)) _vm->_dialogs->show(41019); - else if (_action.isAction(VERB_LOOK, 0x214)) + else if (_action.isAction(VERB_LOOK, NOUN_SACK)) _vm->_dialogs->show(41019); - else if (_action.isAction(VERB_OPEN, 0x278)) + else if (_action.isAction(VERB_OPEN, NOUN_SACKS)) _vm->_dialogs->show(41020); - else if (_action.isAction(VERB_OPEN, 0x214)) + else if (_action.isAction(VERB_OPEN, NOUN_SACK)) _vm->_dialogs->show(41020); - else if (_action.isAction(VERB_LOOK, 0x277)) + else if (_action.isAction(VERB_LOOK, NOUN_BUCKET_OF_TAR)) _vm->_dialogs->show(41021); - else if (_action.isAction(VERB_TAKE, 0x277)) + else if (_action.isAction(VERB_TAKE, NOUN_BUCKET_OF_TAR)) _vm->_dialogs->show(41022); - else if (_action.isAction(VERB_LOOK, 0x272)) + else if (_action.isAction(VERB_LOOK, NOUN_CAN)) _vm->_dialogs->show(41023); - else if (_action.isAction(VERB_TAKE, 0x272)) + else if (_action.isAction(VERB_TAKE, NOUN_CAN)) _vm->_dialogs->show(41024); - else if (_action.isAction(VERB_LOOK, 0x48) && _game._objects.isInRoom(OBJ_CHARGE_CASES)) + else if (_action.isAction(VERB_LOOK, NOUN_CHARGE_CASES) && _game._objects.isInRoom(OBJ_CHARGE_CASES)) _vm->_dialogs->show(41025); - else if (_action.isAction(VERB_LOOK, 0x2C3)) + else if (_action.isAction(VERB_LOOK, NOUN_FENCE)) _vm->_dialogs->show(41027); - else if (_action.isAction(VERB_LOOK, 0x47D)) + else if (_action.isAction(VERB_LOOK, NOUN_SHELVES)) _vm->_dialogs->show(41028); - else if (_action.isAction(VERB_LOOK, 0x275)) + else if (_action.isAction(VERB_LOOK, NOUN_RAT)) _vm->_dialogs->show(41029); - else if (_action.isAction(VERB_TAKE, 0x275)) + else if (_action.isAction(VERB_TAKE, NOUN_RAT)) _vm->_dialogs->show(41030); - else if (_action.isAction(VERB_THROW, 0x275)) + else if (_action.isAction(VERB_THROW, NOUN_RAT)) _vm->_dialogs->show(41031); else if (_action._lookFlag) _vm->_dialogs->show(41033); @@ -3679,21 +3679,21 @@ void Scene411::step() { } void Scene411::preActions() { - if (_action.isAction(VERB_LOOK, 0x2D7) && (_game._objects.isInRoom(OBJ_PETROX))) + if (_action.isAction(VERB_LOOK, NOUN_PETROX) && (_game._objects.isInRoom(OBJ_PETROX))) _game._player._needToWalk = true; - if (_action.isAction(VERB_LOOK, 0x3A9) && (_game._objects.isInRoom(OBJ_LECITHIN))) + if (_action.isAction(VERB_LOOK, NOUN_LECITHIN) && (_game._objects.isInRoom(OBJ_LECITHIN))) _game._player._needToWalk = true; - if (_action.isAction(VERB_LOOK, 0x2D6) && (_game._objects.isInRoom(OBJ_FORMALDEHYDE))) + if (_action.isAction(VERB_LOOK, NOUN_FORMALDEHYDE) && (_game._objects.isInRoom(OBJ_FORMALDEHYDE))) _game._player._needToWalk = true; - if (_action.isAction(VERB_LOOK, 0x3AB) || _action.isAction(VERB_LOOK, 0x30D) || _action.isAction(VERB_LOOK, 0x47F) || - _action.isAction(VERB_LOOK, 0x24D) || _action.isAction(VERB_LOOK, 0x216) || _action.isAction(VERB_PUT, 0x216) || - _action.isAction(VERB_LOOK, 0x284) || _action.isAction(VERB_LOOK, 0x285)) + if (_action.isAction(VERB_LOOK, NOUN_EXPLOSIVES) || _action.isAction(VERB_LOOK, NOUN_KETTLE) || _action.isAction(VERB_LOOK, NOUN_MISHAP) || + _action.isAction(VERB_LOOK, NOUN_ALCOVE) || _action.isAction(VERB_LOOK, NOUN_SINK) || _action.isAction(VERB_PUT, NOUN_SINK) || + _action.isAction(VERB_LOOK, NOUN_EXPERIMENT) || _action.isAction(VERB_LOOK, NOUN_DRAWING_BOARD)) _game._player._needToWalk = true; - if (_action.isAction(VERB_PULL, 0x280) || _action.isAction(VERB_PUSH, 0x280)) + if (_action.isAction(VERB_PULL, NOUN_KNIFE_SWITCH) || _action.isAction(VERB_PUSH, NOUN_KNIFE_SWITCH)) _game._player._needToWalk = false; } @@ -3704,14 +3704,14 @@ void Scene411::actions() { return; } - if (_action.isAction(VERB_WALK_INTO, 0x2B3)) { + if (_action.isAction(VERB_WALK_INTO, NOUN_CORRIDOR_TO_SOUTH)) { _scene->_nextSceneId = 406; _vm->_sound->command(10); _action._inProgress = false; return; } - if ((_globals[kNextIngredient] >= 4) && (_action.isAction(VERB_TAKE, 0x3AB) || _action.isAction(VERB_PUT, 0x48, 0x3AB)) + if ((_globals[kNextIngredient] >= 4) && (_action.isAction(VERB_TAKE, NOUN_EXPLOSIVES) || _action.isAction(VERB_PUT, NOUN_CHARGE_CASES, 0x3AB)) && !_game._objects[OBJ_CHARGE_CASES].getQuality(3) && _game._objects.isInInventory(OBJ_CHARGE_CASES)) { switch (_game._trigger) { @@ -3759,13 +3759,13 @@ void Scene411::actions() { } _action._inProgress = false; return; - } else if (!_game._objects.isInInventory(OBJ_CHARGE_CASES) && _action.isAction(VERB_TAKE, 0x3AB)) { + } else if (!_game._objects.isInInventory(OBJ_CHARGE_CASES) && _action.isAction(VERB_TAKE, NOUN_EXPLOSIVES)) { _vm->_dialogs->show(41143); _action._inProgress = false; return; } - if (_action.isAction(VERB_TAKE, 0x2D7) && (_game._objects.isInRoom(OBJ_PETROX) || _game._trigger)) { + if (_action.isAction(VERB_TAKE, NOUN_PETROX) && (_game._objects.isInRoom(OBJ_PETROX) || _game._trigger)) { switch (_game._trigger) { case (0): _vm->_sound->command(57); @@ -3802,7 +3802,7 @@ void Scene411::actions() { return; } - if (_action.isAction(VERB_TAKE, 0x3A9) && (_game._objects.isInRoom(OBJ_LECITHIN) || _game._trigger)) { + if (_action.isAction(VERB_TAKE, NOUN_LECITHIN) && (_game._objects.isInRoom(OBJ_LECITHIN) || _game._trigger)) { switch (_game._trigger) { case (0): _vm->_sound->command(57); @@ -3838,7 +3838,7 @@ void Scene411::actions() { return; } - if (_action.isAction(VERB_TAKE, 0x2D6) && _game._objects.isInRoom(OBJ_FORMALDEHYDE) && (_game._trigger == 0)) { + if (_action.isAction(VERB_TAKE, NOUN_FORMALDEHYDE) && _game._objects.isInRoom(OBJ_FORMALDEHYDE) && (_game._trigger == 0)) { _vm->_sound->command(57); _game._player._stepEnabled = false; _game._player._visible = false; @@ -3862,7 +3862,7 @@ void Scene411::actions() { if (_game._trigger == 10) _vm->_dialogs->showItem(OBJ_FORMALDEHYDE, 41124); - if (_action.isAction(VERB_PUT, 0x30D)) { + if (_action.isAction(VERB_PUT, NOUN_KETTLE)) { if (_action.isAction(0x2D7) || _action.isAction(0x2D6) || _action.isAction(0x3A9) || _action.isAction(0x306)) { _newIngredient = _game._objects.getIdFromDesc(_action._activeAction._objectNameId); switch (_newIngredient) { @@ -3889,67 +3889,67 @@ void Scene411::actions() { } - if (_action.isAction(VERB_LOOK, 0xE2)) + if (_action.isAction(VERB_LOOK, NOUN_MONITOR)) _vm->_dialogs->show(41110); - else if (_action.isAction(VERB_LOOK, 0x287)) + else if (_action.isAction(VERB_LOOK, NOUN_AIR_PURIFIER)) _vm->_dialogs->show(41111); - else if (_action.isAction(VERB_LOOK, 0x27B)) + else if (_action.isAction(VERB_LOOK, NOUN_LAB_EQUIPMENT)) _vm->_dialogs->show(41112); - else if (_action.isAction(VERB_LOOK, 0x280)) + else if (_action.isAction(VERB_LOOK, NOUN_KNIFE_SWITCH)) _vm->_dialogs->show(41113); - else if (_action.isAction(VERB_PUSH, 0x280) || _action.isAction(VERB_PULL, 0x280)) + else if (_action.isAction(VERB_PUSH, NOUN_KNIFE_SWITCH) || _action.isAction(VERB_PULL, NOUN_KNIFE_SWITCH)) _vm->_dialogs->show(41114); - else if (_action.isAction(VERB_LOOK, 0x283)) + else if (_action.isAction(VERB_LOOK, NOUN_TOXIC_WASTE)) _vm->_dialogs->show(41115); - else if (_action.isAction(VERB_TAKE, 0x283)) + else if (_action.isAction(VERB_TAKE, NOUN_TOXIC_WASTE)) _vm->_dialogs->show(41116); - else if (_action.isAction(VERB_LOOK, 0x285)) + else if (_action.isAction(VERB_LOOK, NOUN_DRAWING_BOARD)) _vm->_dialogs->show(41117); - else if (_action.isAction(VERB_LOOK, 0x284)) + else if (_action.isAction(VERB_LOOK, NOUN_EXPERIMENT)) _vm->_dialogs->show(41118); - else if (_action.isAction(VERB_LOOK, 0x2D7) && _game._objects.isInRoom(OBJ_PETROX)) + else if (_action.isAction(VERB_LOOK, NOUN_PETROX) && _game._objects.isInRoom(OBJ_PETROX)) _vm->_dialogs->show(41119); - else if (_action.isAction(VERB_LOOK, 0x24D)) + else if (_action.isAction(VERB_LOOK, NOUN_ALCOVE)) _vm->_dialogs->show(41121); - else if ((_action.isAction(VERB_LOOK, 0x2D6)) && (_game._objects.isInRoom(OBJ_FORMALDEHYDE))) + else if ((_action.isAction(VERB_LOOK, NOUN_FORMALDEHYDE)) && (_game._objects.isInRoom(OBJ_FORMALDEHYDE))) _vm->_dialogs->show(41122); - else if ((_action.isAction(VERB_LOOK, 0x3A9)) && (_game._objects.isInRoom(OBJ_LECITHIN))) + else if ((_action.isAction(VERB_LOOK, NOUN_LECITHIN)) && (_game._objects.isInRoom(OBJ_LECITHIN))) _vm->_dialogs->show(41123); - else if (_action.isAction(VERB_LOOK, 0x30D)) { + else if (_action.isAction(VERB_LOOK, NOUN_KETTLE)) { if (_globals[kNextIngredient] > 0 && !_game._objects[OBJ_CHARGE_CASES].getQuality(3)) { _vm->_dialogs->show(41126); } else if (_globals[kNextIngredient] == 0 || _game._objects[OBJ_CHARGE_CASES].getQuality(3)) { _vm->_dialogs->show(41125); } - } else if (_action.isAction(VERB_LOOK, 0x3AB) && _game._objects[OBJ_CHARGE_CASES].getQuality(3) == 0) { + } else if (_action.isAction(VERB_LOOK, NOUN_EXPLOSIVES) && _game._objects[OBJ_CHARGE_CASES].getQuality(3) == 0) { _vm->_dialogs->show(41127); - } else if (_action.isAction(VERB_TAKE, 0x30D)) + } else if (_action.isAction(VERB_TAKE, NOUN_KETTLE)) _vm->_dialogs->show(41128); - else if (_action.isAction(VERB_LOOK, 0x59)) + else if (_action.isAction(VERB_LOOK, NOUN_CONTROL_PANEL)) _vm->_dialogs->show(41129); - else if (_action.isAction(VERB_LOOK, 0x47F)) + else if (_action.isAction(VERB_LOOK, NOUN_MISHAP)) _vm->_dialogs->show(41130); - else if (_action.isAction(VERB_LOOK, 0x2B3)) + else if (_action.isAction(VERB_LOOK, NOUN_CORRIDOR_TO_SOUTH)) _vm->_dialogs->show(41131); else if (_action._lookFlag) _vm->_dialogs->show(41132); - else if (_action.isAction(VERB_LOOK, 0x27C)) + else if (_action.isAction(VERB_LOOK, NOUN_AIR_HORN)) _vm->_dialogs->show(41133); - else if (_action.isAction(VERB_LOOK, 0x218)) + else if (_action.isAction(VERB_LOOK, NOUN_DEBRIS)) _vm->_dialogs->show(41134); - else if (_action.isAction(VERB_LOOK, 0x282)) + else if (_action.isAction(VERB_LOOK, NOUN_HEATER)) _vm->_dialogs->show(41135); - else if (_action.isAction(VERB_LOOK, 0x10C)) + else if (_action.isAction(VERB_LOOK, NOUN_PIPE)) _vm->_dialogs->show(41136); - else if (_action.isAction(VERB_LOOK, 0x216)) + else if (_action.isAction(VERB_LOOK, NOUN_SINK)) _vm->_dialogs->show(41137); - else if (_action.isAction(VERB_PUT, 0x216)) + else if (_action.isAction(VERB_PUT, NOUN_SINK)) _vm->_dialogs->show(41138); - else if (_action.isAction(VERB_TAKE, 0x284)) + else if (_action.isAction(VERB_TAKE, NOUN_EXPERIMENT)) _vm->_dialogs->show(41139); - else if (_action.isAction(VERB_LOOK, 0x47E)) + else if (_action.isAction(VERB_LOOK, NOUN_ELECTRODES)) _vm->_dialogs->show(41140); - else if (_action.isAction(VERB_TAKE, 0x47E)) + else if (_action.isAction(VERB_TAKE, NOUN_ELECTRODES)) _vm->_dialogs->show(41141); else return; @@ -4076,41 +4076,41 @@ void Scene413::step() { } void Scene413::preActions() { - if (_action.isAction(VERB_TAKE) || _action.isAction(VERB_PUT, 0x319)) + if (_action.isAction(VERB_TAKE) || _action.isAction(VERB_PUT, NOUN_CONVEYOR_BELT)) _game._player._needToWalk = false; - if (_action.isAction(VERB_LOOK, 0x2C4) || _action.isAction(VERB_LOOK, 0x1CC) - || _action.isAction(VERB_LOOK, 0x289) || _action.isAction(VERB_LOOK, 0x10E)) { + if (_action.isAction(VERB_LOOK, NOUN_WOODEN_STATUE) || _action.isAction(VERB_LOOK, NOUN_DISPLAY) + || _action.isAction(VERB_LOOK, NOUN_PICTURE) || _action.isAction(VERB_LOOK, NOUN_PLANT)) { _game._player._needToWalk = true; } } void Scene413::actions() { - if (_action.isAction(VERB_WALK_INSIDE, 0x16C)) { + if (_action.isAction(VERB_WALK_INSIDE, NOUN_TELEPORTER)) { _game._player._stepEnabled = false; _game._player._visible = false; _scene->_nextSceneId = 409; - } else if (_action.isAction(VERB_WALK_INSIDE, 0x2B3)) + } else if (_action.isAction(VERB_WALK_INSIDE, NOUN_CORRIDOR_TO_SOUTH)) _scene->_nextSceneId = 405; - else if (_action.isAction(VERB_LOOK, 0x2C4)) + else if (_action.isAction(VERB_LOOK, NOUN_WOODEN_STATUE)) _vm->_dialogs->show(41310); - else if (_action.isAction(VERB_TAKE, 0x2C4)) + else if (_action.isAction(VERB_TAKE, NOUN_WOODEN_STATUE)) _vm->_dialogs->show(41311); - else if (_action.isAction(VERB_LOOK, 0x319)) + else if (_action.isAction(VERB_LOOK, NOUN_CONVEYOR_BELT)) _vm->_dialogs->show(41312); - else if (_action.isAction(VERB_PUT, 0x319)) + else if (_action.isAction(VERB_PUT, NOUN_CONVEYOR_BELT)) _vm->_dialogs->show(41313); - else if (_action.isAction(VERB_LOOK, 0x16C)) + else if (_action.isAction(VERB_LOOK, NOUN_TELEPORTER)) _vm->_dialogs->show(41314); - else if (_action.isAction(VERB_LOOK, 0x1CC)) + else if (_action.isAction(VERB_LOOK, NOUN_DISPLAY)) _vm->_dialogs->show(41315); - else if (_action.isAction(VERB_LOOK, 0x2B3)) + else if (_action.isAction(VERB_LOOK, NOUN_CORRIDOR_TO_SOUTH)) _vm->_dialogs->show(41316); - else if (_action.isAction(VERB_LOOK, 0x289)) + else if (_action.isAction(VERB_LOOK, NOUN_PICTURE)) _vm->_dialogs->show(41317); - else if (_action.isAction(VERB_LOOK, 0x10E)) + else if (_action.isAction(VERB_LOOK, NOUN_PLANT)) _vm->_dialogs->show(41318); - else if (_action.isAction(VERB_TAKE, 0x10E)) + else if (_action.isAction(VERB_TAKE, NOUN_PLANT)) _vm->_dialogs->show(41319); else if (_action._lookFlag) _vm->_dialogs->show(41320); diff --git a/engines/mads/nebular/nebular_scenes5.cpp b/engines/mads/nebular/nebular_scenes5.cpp index ef50e1289e..02dc90dbc3 100644 --- a/engines/mads/nebular/nebular_scenes5.cpp +++ b/engines/mads/nebular/nebular_scenes5.cpp @@ -279,7 +279,7 @@ void Scene501::preActions() { } void Scene501::actions() { - if (_action.isAction(VERB_GET_INTO, 0x324)) { + if (_action.isAction(VERB_GET_INTO, NOUN_CAR)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -326,9 +326,9 @@ void Scene501::actions() { default: break; } - } else if (_action.isAction(VERB_PUT, 0x131, 0x251)) + } else if (_action.isAction(VERB_PUT, NOUN_SECURITY_CARD, 0x251)) _vm->_dialogs->show(50113); - else if (_action.isAction(VERB_PUT, 0x305, 0x251)) { + else if (_action.isAction(VERB_PUT, NOUN_FAKE_ID, 0x251)) { switch (_game._trigger) { case 0: case 1: @@ -372,7 +372,7 @@ void Scene501::actions() { default: break; } - } else if (_action.isAction(VERB_PUT, 0xB3, 0x251)) { + } else if (_action.isAction(VERB_PUT, NOUN_ID_CARD, 0x251)) { switch (_game._trigger) { case 0: case 1: @@ -417,34 +417,34 @@ void Scene501::actions() { default: break; } - } else if (_action._lookFlag || _action.isAction(VERB_LOOK, 0x31E)) + } else if (_action._lookFlag || _action.isAction(VERB_LOOK, NOUN_STREET)) _vm->_dialogs->show(50121); - else if (_action.isAction(VERB_LOOK, 0x6E)) + else if (_action.isAction(VERB_LOOK, NOUN_DOOR)) _vm->_dialogs->show(50110); - else if (_action.isAction(VERB_LOOK, 0x251)) + else if (_action.isAction(VERB_LOOK, NOUN_CARD_SLOT)) _vm->_dialogs->show(50112); - else if (_action.isAction(VERB_LOOK, 0x244)) + else if (_action.isAction(VERB_LOOK, NOUN_SIGN)) _vm->_dialogs->show(50114); - else if (_action.isAction(VERB_TAKE, 0x244)) + else if (_action.isAction(VERB_TAKE, NOUN_SIGN)) _vm->_dialogs->show(50115); - else if (_action.isAction(VERB_LOOK, 0x322)) + else if (_action.isAction(VERB_LOOK, NOUN_SIDEWALK_TO_EAST)) _vm->_dialogs->show(50118); - else if (_action.isAction(VERB_LOOK, 0x361) || _action.isAction(VERB_LOOK, 0x360) - || _action.isAction(VERB_WALK_DOWN, 0x361) || _action.isAction(VERB_WALK_DOWN, 0x360)) + else if (_action.isAction(VERB_LOOK, NOUN_SIDEWALK_TO_WEST) || _action.isAction(VERB_LOOK, NOUN_STREET_TO_WEST) + || _action.isAction(VERB_WALK_DOWN, NOUN_SIDEWALK_TO_WEST) || _action.isAction(VERB_WALK_DOWN, NOUN_STREET_TO_WEST)) _vm->_dialogs->show(50119); - else if (_action.isAction(VERB_LOOK, 0x323)) + else if (_action.isAction(VERB_LOOK, NOUN_BUILDING)) _vm->_dialogs->show(50120); - else if (_action.isAction(VERB_OPEN, 0x6E)) + else if (_action.isAction(VERB_OPEN, NOUN_DOOR)) _vm->_dialogs->show(50122); - else if (_action.isAction(VERB_LOOK, 0x1E6)) + else if (_action.isAction(VERB_LOOK, NOUN_FIRE_HYDRANT)) _vm->_dialogs->show(50123); - else if (_action.isAction(VERB_OPEN, 0x1E6)) + else if (_action.isAction(VERB_OPEN, NOUN_FIRE_HYDRANT)) _vm->_dialogs->show(50124); - else if (_action.isAction(VERB_LOOK, 0x369)) + else if (_action.isAction(VERB_LOOK, NOUN_EQUIPMENT_OVERHEAD)) _vm->_dialogs->show(50125); - else if (_action.isAction(VERB_LOOK, 0x1FA) || _action.isAction(VERB_LOOK, 0x10C)) + else if (_action.isAction(VERB_LOOK, NOUN_PIPES) || _action.isAction(VERB_LOOK, NOUN_PIPE)) _vm->_dialogs->show(50126); - else if (_action.isAction(VERB_LOOK, 0x324)) { + else if (_action.isAction(VERB_LOOK, NOUN_CAR)) { if (!_game._visitedScenes.exists(504)) _vm->_dialogs->show(50116); else @@ -490,21 +490,21 @@ void Scene502::actions() { return; } - if (_action.isAction(VERB_LOOK, 0x181) || _action.isAction(VERB_PEER_THROUGH, 0x181)) + if (_action.isAction(VERB_LOOK, NOUN_VIEWPORT) || _action.isAction(VERB_PEER_THROUGH, NOUN_VIEWPORT)) _vm->_dialogs->show(50210); - else if (_action.isAction(VERB_LOOK, 0xC4)) + else if (_action.isAction(VERB_LOOK, NOUN_KEYPAD)) _vm->_dialogs->show(50211); - else if (_action.isAction(VERB_LOOK, 0x1CC)) + else if (_action.isAction(VERB_LOOK, NOUN_DISPLAY)) _vm->_dialogs->show(50212); - else if (_action.isAction(VERB_LOOK, 0x1D0) || _action.isAction(VERB_LOOK, 0x1D1) - || _action.isAction(VERB_LOOK, 0x1D2) || _action.isAction(VERB_LOOK, 0x1D3) - || _action.isAction(VERB_LOOK, 0x1D4) || _action.isAction(VERB_LOOK, 0x1D5) - || _action.isAction(VERB_LOOK, 0x1D6) || _action.isAction(VERB_LOOK, 0x1D7) - || _action.isAction(VERB_LOOK, 0x1D8) || _action.isAction(VERB_LOOK, 0x1D9) - || _action.isAction(VERB_LOOK, 0x1DB) || _action.isAction(VERB_LOOK, 0x7A) - || _action.isAction(VERB_LOOK, 0x1DA)) + else if (_action.isAction(VERB_LOOK, NOUN_0_KEY) || _action.isAction(VERB_LOOK, NOUN_1_KEY) + || _action.isAction(VERB_LOOK, NOUN_2_KEY) || _action.isAction(VERB_LOOK, NOUN_3_KEY) + || _action.isAction(VERB_LOOK, NOUN_4_KEY) || _action.isAction(VERB_LOOK, NOUN_5_KEY) + || _action.isAction(VERB_LOOK, NOUN_6_KEY) || _action.isAction(VERB_LOOK, NOUN_7_KEY) + || _action.isAction(VERB_LOOK, NOUN_8_KEY) || _action.isAction(VERB_LOOK, NOUN_9_KEY) + || _action.isAction(VERB_LOOK, NOUN_SMILE_KEY) || _action.isAction(VERB_LOOK, NOUN_ENTER_KEY) + || _action.isAction(VERB_LOOK, NOUN_FROWN_KEY)) _vm->_dialogs->show(50213); - else if (_action.isAction(VERB_LOOK, 0x1CF) || _action._lookFlag) + else if (_action.isAction(VERB_LOOK, NOUN_DEVICE) || _action._lookFlag) _vm->_dialogs->show(50214); else return; @@ -544,9 +544,9 @@ void Scene503::enter() { } void Scene503::actions() { - if (_action.isAction(VERB_WALK, 0xF9)) + if (_action.isAction(VERB_WALK, NOUN_OUTSIDE)) _scene->_nextSceneId = 501; - else if (_action.isAction(VERB_TAKE, 0x6A)) { + else if (_action.isAction(VERB_TAKE, NOUN_DETONATORS)) { if ( _game._trigger || !_game._objects.isInInventory(OBJ_DETONATORS)) { switch (_game._trigger) { case 0: @@ -591,42 +591,42 @@ void Scene503::actions() { } } else if (_action._lookFlag) _vm->_dialogs->show(50328); - else if (_action.isAction(VERB_LOOK, 0x36F)) + else if (_action.isAction(VERB_LOOK, NOUN_MONITORING_EQUIPMENT)) _vm->_dialogs->show(50310); - else if (_action.isAction(VERB_LOOK, 0x36E)) + else if (_action.isAction(VERB_LOOK, NOUN_PHOTON_RIFLES)) _vm->_dialogs->show(50311); - else if (_action.isAction(VERB_TAKE, 0x36E) || _action.isAction(VERB_TAKE, 0x36C)) + else if (_action.isAction(VERB_TAKE, NOUN_PHOTON_RIFLES) || _action.isAction(VERB_TAKE, NOUN_NUCLEAR_SLINGSHOT)) _vm->_dialogs->show(50312); - else if (_action.isAction(VERB_LOOK, 0x36D)) + else if (_action.isAction(VERB_LOOK, NOUN_DISPLAY_CASE)) _vm->_dialogs->show(50313); - else if (_action.isAction(VERB_LOOK, 0x36C)) + else if (_action.isAction(VERB_LOOK, NOUN_NUCLEAR_SLINGSHOT)) _vm->_dialogs->show(50314); - else if (_action.isAction(VERB_LOOK, 0x331)) + else if (_action.isAction(VERB_LOOK, NOUN_WATER_COOLER)) _vm->_dialogs->show(50315); - else if (_action.isAction(VERB_LOOK, 0x330)) + else if (_action.isAction(VERB_LOOK, NOUN_STORAGE_BOX)) _vm->_dialogs->show(50316); - else if (_action.isAction(VERB_OPEN, 0x330)) + else if (_action.isAction(VERB_OPEN, NOUN_STORAGE_BOX)) _vm->_dialogs->show(50317); - else if (_action.isAction(VERB_LOOK, 0x36B)) + else if (_action.isAction(VERB_LOOK, NOUN_WARNING_LABEL)) _vm->_dialogs->show(50318); - else if (_action.isAction(VERB_LOOK, 0x1E4)) + else if (_action.isAction(VERB_LOOK, NOUN_DESK)) _vm->_dialogs->show(50319); - else if (_action.isAction(VERB_LOOK, 0xE2)) + else if (_action.isAction(VERB_LOOK, NOUN_MONITOR)) _vm->_dialogs->show(50320); - else if (_action.isAction(VERB_LOOK, 0x481)) + else if (_action.isAction(VERB_LOOK, NOUN_FILE_CABINETS)) _vm->_dialogs->show(50322); - else if (_action.isAction(VERB_LOOK, 0x332)) { + else if (_action.isAction(VERB_LOOK, NOUN_BOX)) { if (_game._objects.isInRoom(OBJ_DETONATORS)) _vm->_dialogs->show(50323); else _vm->_dialogs->show(50324); - } else if (_action.isAction(VERB_LOOK, 0x6A) && (_action._savedFields._mainObjectSource == 4)) + } else if (_action.isAction(VERB_LOOK, NOUN_DETONATORS) && (_action._savedFields._mainObjectSource == 4)) _vm->_dialogs->show(50325); - else if (_action.isAction(VERB_LOOK, 0x32E)) + else if (_action.isAction(VERB_LOOK, NOUN_WINDOWS)) _vm->_dialogs->show(50327); - else if (_action.isAction(VERB_OPEN, 0x36D)) + else if (_action.isAction(VERB_OPEN, NOUN_DISPLAY_CASE)) _vm->_dialogs->show(50329); - else if (_action.isAction(VERB_THROW, 0x36D) && _game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId))) + else if (_action.isAction(VERB_THROW, NOUN_DISPLAY_CASE) && _game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId))) _vm->_dialogs->show(50330); else return; @@ -742,10 +742,10 @@ void Scene504::preActions() { } void Scene504::actions() { - if (_action.isAction(VERB_EXIT_FROM, 0x324)) { + if (_action.isAction(VERB_EXIT_FROM, NOUN_CAR)) { _vm->_sound->command(15); _scene->_nextSceneId = _globals[kHoverCarLocation]; - } else if (_action.isAction(VERB_ACTIVATE, 0x380)) { + } else if (_action.isAction(VERB_ACTIVATE, NOUN_CAR_CONTROLS)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -803,27 +803,27 @@ void Scene504::actions() { default: break; } - } else if (_action._lookFlag || _action.isAction(VERB_LOOK, 0x388)) + } else if (_action._lookFlag || _action.isAction(VERB_LOOK, NOUN_INTERIOR_OF_CAR)) _vm->_dialogs->show(50412); - else if (_action.isAction(VERB_LOOK, 0x383)) + else if (_action.isAction(VERB_LOOK, NOUN_GLOVE_COMPARTMENT)) _vm->_dialogs->show(50410); - else if (_action.isAction(VERB_LOOK, 0x380) || _action.isAction(VERB_LOOK, 0x387)) + else if (_action.isAction(VERB_LOOK, NOUN_CAR_CONTROLS) || _action.isAction(VERB_LOOK, NOUN_DASHBOARD)) _vm->_dialogs->show(50411); - else if (_action.isAction(VERB_LOOK, 0x381)) + else if (_action.isAction(VERB_LOOK, NOUN_SCENT_PACKET)) _vm->_dialogs->show(50413); - else if (_action.isAction(VERB_LOOK, 0x385)) + else if (_action.isAction(VERB_LOOK, NOUN_SODA_CANS)) _vm->_dialogs->show(50414); - else if (_action.isAction(VERB_LOOK, 0x382)) + else if (_action.isAction(VERB_LOOK, NOUN_KITTY)) _vm->_dialogs->show(50415); - else if (_action.isAction(VERB_LOOK, 0x386) || _action.isAction(VERB_LOOK_THROUGH, 0x386)) + else if (_action.isAction(VERB_LOOK, NOUN_WINDSHIELD) || _action.isAction(VERB_LOOK_THROUGH, NOUN_WINDSHIELD)) _vm->_dialogs->show(50416); - else if (_action.isAction(VERB_LOOK, 0x120)) + else if (_action.isAction(VERB_LOOK, NOUN_REARVIEW_MIRROR)) _vm->_dialogs->show(50417); - else if (_action.isAction(VERB_TAKE, 0x120)) + else if (_action.isAction(VERB_TAKE, NOUN_REARVIEW_MIRROR)) _vm->_dialogs->show(50418); - else if (_action.isAction(VERB_LOOK, 0x384)) + else if (_action.isAction(VERB_LOOK, NOUN_MOLDY_SOCK)) _vm->_dialogs->show(50419); - else if (_action.isAction(VERB_TAKE, 0x384)) + else if (_action.isAction(VERB_TAKE, NOUN_MOLDY_SOCK)) _vm->_dialogs->show(50420); else return; @@ -1073,11 +1073,11 @@ void Scene505::step() { void Scene505::actions() { if (_action.isAction(VERB_PRESS)) _nextButtonId = _action._activeAction._objectNameId; - else if (_action.isAction(VERB_RETURN_TO, 0x38C)) + else if (_action.isAction(VERB_RETURN_TO, NOUN_INSIDE_OF_CAR)) _scene->_nextSceneId = 504; - else if (_action.isAction(VERB_LOOK, 0x180)) + else if (_action.isAction(VERB_LOOK, NOUN_VIEW_SCREEN)) _vm->_dialogs->show(50510); - else if (_action.isAction(VERB_LOOK, 0x59)) + else if (_action.isAction(VERB_LOOK, NOUN_CONTROL_PANEL)) _vm->_dialogs->show(50511); else return; @@ -1186,7 +1186,7 @@ void Scene506::room_506_door_sequences() { _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; if (_firstDoorFl) { - if (_action.isAction(VERB_WALK_INTO, 0x336) || ((_scene->_priorSceneId == 507) && !_actionFl)) { + if (_action.isAction(VERB_WALK_INTO, NOUN_SOFTWARE_STORE) || ((_scene->_priorSceneId == 507) && !_actionFl)) { _doorDepth = 13; _doorSpriteIdx = _globals._spriteIndexes[2]; _doorSequenceIdx = _globals._sequenceIndexes[2]; @@ -1266,21 +1266,21 @@ void Scene506::room_506_door_sequences() { } void Scene506::actions() { - if (_action.isAction(VERB_WALK_INTO, 0x37D)) { + if (_action.isAction(VERB_WALK_INTO, NOUN_LABORATORY)) { if (_firstDoorFl) { _heroFacing = FACING_NORTHWEST; _doorPos = Common::Point(16, 111); } _actionFl = true; room_506_door_sequences(); - } else if (_action.isAction(VERB_WALK_INTO, 0x336)) { + } else if (_action.isAction(VERB_WALK_INTO, NOUN_SOFTWARE_STORE)) { if (_firstDoorFl) { _heroFacing = FACING_NORTHWEST; _doorPos = Common::Point(80, 102); } _actionFl = true; room_506_door_sequences(); - } else if (_action.isAction(VERB_GET_INTO, 0x324)) { + } else if (_action.isAction(VERB_GET_INTO, NOUN_CAR)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -1317,29 +1317,29 @@ void Scene506::actions() { default: break; } - } else if (_action._lookFlag || _action.isAction(VERB_LOOK, 0x31E)) + } else if (_action._lookFlag || _action.isAction(VERB_LOOK, NOUN_STREET)) _vm->_dialogs->show(50618); - else if (_action.isAction(VERB_LOOK, 0x372)) + else if (_action.isAction(VERB_LOOK, NOUN_RESTAURANT)) _vm->_dialogs->show(50610); - else if (_action.isAction(VERB_LOOK, 0x371)) + else if (_action.isAction(VERB_LOOK, NOUN_MOTEL)) _vm->_dialogs->show(50611); - else if (_action.isAction(VERB_LOOK, 0x482)) + else if (_action.isAction(VERB_LOOK, NOUN_CYCLE_SHOP)) _vm->_dialogs->show(50612); - else if (_action.isAction(VERB_LOOK, 0x483)) + else if (_action.isAction(VERB_LOOK, NOUN_AIR_BIKE)) _vm->_dialogs->show(50613); - else if (_action.isAction(VERB_TAKE, 0x483)) + else if (_action.isAction(VERB_TAKE, NOUN_AIR_BIKE)) _vm->_dialogs->show(50614); - else if (_action.isAction(VERB_LOOK, 0x336)) + else if (_action.isAction(VERB_LOOK, NOUN_SOFTWARE_STORE)) _vm->_dialogs->show(50615); - else if (_action.isAction(VERB_LOOK, 0x37D)) + else if (_action.isAction(VERB_LOOK, NOUN_LABORATORY)) _vm->_dialogs->show(50616); - else if (_action.isAction(VERB_LOOK, 0x360) || _action.isAction(VERB_WALK_DOWN, 0x360)) + else if (_action.isAction(VERB_LOOK, NOUN_STREET_TO_WEST) || _action.isAction(VERB_WALK_DOWN, NOUN_STREET_TO_WEST)) _vm->_dialogs->show(50617); - else if (_action.isAction(VERB_LOOK, 0x373)) + else if (_action.isAction(VERB_LOOK, NOUN_SOFTWARE_STORE_SIGN)) _vm->_dialogs->show(50619); - else if (_action.isAction(VERB_LOOK, 0x324)) + else if (_action.isAction(VERB_LOOK, NOUN_CAR)) _vm->_dialogs->show(50620); - else if (_action.isAction(VERB_LOOK, 0x142)) + else if (_action.isAction(VERB_LOOK, NOUN_SKY)) _vm->_dialogs->show(50621); else return; @@ -1374,9 +1374,9 @@ void Scene507::enter() { sceneEntrySound(); } void Scene507::actions() { - if (_action.isAction(VERB_WALK_THROUGH, 0x378)) + if (_action.isAction(VERB_WALK_THROUGH, NOUN_ENTRANCE)) _scene->_nextSceneId = 506; - else if (_action.isAction(VERB_TAKE, 0x106)) { + else if (_action.isAction(VERB_TAKE, NOUN_PENLIGHT)) { if (_game._trigger || !_game._objects.isInInventory(OBJ_PENLIGHT)) { switch (_game._trigger) { case 0: @@ -1409,48 +1409,48 @@ void Scene507::actions() { } } else if (_action._lookFlag) _vm->_dialogs->show(50722); - else if (_action.isAction(VERB_LOOK, 0x299)) + else if (_action.isAction(VERB_LOOK, NOUN_SWIRLING_LIGHT)) _vm->_dialogs->show(50710); - else if (_action.isAction(VERB_TAKE, 0x299)) + else if (_action.isAction(VERB_TAKE, NOUN_SWIRLING_LIGHT)) _vm->_dialogs->show(50711); - else if (_action.isAction(VERB_LOOK, 0x376)) + else if (_action.isAction(VERB_LOOK, NOUN_OLD_SOFTWARE)) _vm->_dialogs->show(50712); - else if (_action.isAction(VERB_TAKE, 0x376)) + else if (_action.isAction(VERB_TAKE, NOUN_OLD_SOFTWARE)) _vm->_dialogs->show(50713); - else if (_action.isAction(VERB_LOOK, 0x375)) + else if (_action.isAction(VERB_LOOK, NOUN_ADVERTISEMENT)) _vm->_dialogs->show(50714); - else if (_action.isAction(VERB_LOOK, 0x374)) + else if (_action.isAction(VERB_LOOK, NOUN_ADVERTISING_POSTER)) _vm->_dialogs->show(50715); - else if (_action.isAction(VERB_LOOK, 0x244)) { + else if (_action.isAction(VERB_LOOK, NOUN_SIGN)) { if (_scene->_customDest.x < 100) _vm->_dialogs->show(50726); else _vm->_dialogs->show(50716); - } else if (_action.isAction(VERB_LOOK, 0x2A7)) + } else if (_action.isAction(VERB_LOOK, NOUN_HOTTEST_SOFTWARE)) _vm->_dialogs->show(50717); - else if (_action.isAction(VERB_LOOK, 0x2A6)) + else if (_action.isAction(VERB_LOOK, NOUN_SOFTWARE_SHELF)) _vm->_dialogs->show(50718); - else if (_action.isAction(VERB_LOOK, 0x2A0)) + else if (_action.isAction(VERB_LOOK, NOUN_SENSOR)) _vm->_dialogs->show(50719); - else if (_action.isAction(VERB_LOOK, 0x377)) + else if (_action.isAction(VERB_LOOK, NOUN_CASH_REGISTER)) _vm->_dialogs->show(50720); - else if (_action.isAction(VERB_LOOK, 0xFE)) + else if (_action.isAction(VERB_LOOK, NOUN_PAD_OF_PAPER)) _vm->_dialogs->show(50721); - else if (_action.isAction(VERB_OPEN, 0x377)) + else if (_action.isAction(VERB_OPEN, NOUN_CASH_REGISTER)) _vm->_dialogs->show(50723); - else if (_action.isAction(VERB_LOOK, 0x28E)) + else if (_action.isAction(VERB_LOOK, NOUN_BARGAIN_VAT)) _vm->_dialogs->show(50724); - else if (_action.isAction(VERB_LOOK, 0x197)) + else if (_action.isAction(VERB_LOOK, NOUN_WINDOW)) _vm->_dialogs->show(50725); - else if (_action.isAction(VERB_LOOK, 0x29F)) { + else if (_action.isAction(VERB_LOOK, NOUN_COUNTER)) { if (_game._objects.isInRoom(OBJ_PENLIGHT)) _vm->_dialogs->show(50728); else _vm->_dialogs->show(50727); - } else if (_action.isAction(VERB_LOOK, 0x106) && !_game._objects.isInInventory(OBJ_PENLIGHT)) { + } else if (_action.isAction(VERB_LOOK, NOUN_PENLIGHT) && !_game._objects.isInInventory(OBJ_PENLIGHT)) { if (_game._objects.isInRoom(OBJ_PENLIGHT)) _vm->_dialogs->show(50729); - } else if (_action.isAction(VERB_LOOK, 0x484)) + } else if (_action.isAction(VERB_LOOK, NOUN_EMERGENCY_LIGHT)) _vm->_dialogs->show(50731); else return; @@ -1528,7 +1528,7 @@ void Scene508::enter() { } void Scene508::preActions() { - if (_action.isAction(VERB_WALK, 0xF9)) + if (_action.isAction(VERB_WALK, NOUN_OUTSIDE)) _game._player._walkOffScreenSceneId = 506; } @@ -1586,7 +1586,7 @@ void Scene508::handlePedestral() { } void Scene508::actions() { - if (_action.isAction(VERB_PULL, 0x2AC)) { + if (_action.isAction(VERB_PULL, NOUN_LEVER)) { if (!_globals[kLaserOn]) { switch (_game._trigger) { case 0: @@ -1651,60 +1651,60 @@ void Scene508::actions() { } else { _vm->_dialogs->show(50837); } - } else if (_action.isAction(VERB_REFLECT, 0x120, 0x343) || _action.isAction(VERB_PUT, 0x120, 0x344) || _action.isAction(VERB_PUT, 0x120, 0x343)) { + } else if (_action.isAction(VERB_REFLECT, 0x120, 0x343) || _action.isAction(VERB_PUT, NOUN_REARVIEW_MIRROR, 0x344) || _action.isAction(VERB_PUT, NOUN_REARVIEW_MIRROR, 0x343)) { _chosenObject = 1; handlePedestral(); - } else if (_action.isAction(VERB_PUT, 0x57, 0x344) || _action.isAction(VERB_PUT, 0x57, 0x343) || _action.isAction(VERB_REFLECT, 0x57, 0x343)) { + } else if (_action.isAction(VERB_PUT, NOUN_COMPACT_CASE, 0x344) || _action.isAction(VERB_PUT, NOUN_COMPACT_CASE, 0x343) || _action.isAction(VERB_REFLECT, 0x57, 0x343)) { _chosenObject = 2; handlePedestral(); } else if (_action._lookFlag) _vm->_dialogs->show(50822); - else if (_action.isAction(VERB_LOOK, 0x485)) + else if (_action.isAction(VERB_LOOK, NOUN_TARGET_AREA)) _vm->_dialogs->show(50810); - else if (_action.isAction(VERB_LOOK, 0x364)) + else if (_action.isAction(VERB_LOOK, NOUN_SPINACH_PATCH_DOLL)) _vm->_dialogs->show(50811); - else if (_action.isAction(VERB_TAKE, 0x364)) + else if (_action.isAction(VERB_TAKE, NOUN_SPINACH_PATCH_DOLL)) _vm->_dialogs->show(50812); - else if (_action.isAction(VERB_LOOK, 0x37A)) + else if (_action.isAction(VERB_LOOK, NOUN_SAND_BAGS)) _vm->_dialogs->show(50816); - else if (_action.isAction(VERB_TAKE, 0x37A)) + else if (_action.isAction(VERB_TAKE, NOUN_SAND_BAGS)) _vm->_dialogs->show(50817); - else if (_action.isAction(VERB_LOOK, 0x2AF)) + else if (_action.isAction(VERB_LOOK, NOUN_CONTROL_STATION)) _vm->_dialogs->show(50818); - else if (_action.isAction(VERB_LOOK, 0xE2)) { + else if (_action.isAction(VERB_LOOK, NOUN_MONITOR)) { if (_globals[kLaserOn]) _vm->_dialogs->show(50820); else _vm->_dialogs->show(50819); - } else if (_action.isAction(VERB_LOOK, 0x379)) { + } else if (_action.isAction(VERB_LOOK, NOUN_LASER_CANNON)) { if (_globals[kLaserOn]) _vm->_dialogs->show(50822); else _vm->_dialogs->show(50821); - } else if (_action.isAction(VERB_TAKE, 0x379)) + } else if (_action.isAction(VERB_TAKE, NOUN_LASER_CANNON)) _vm->_dialogs->show(50823); - else if (_action.isAction(VERB_LOOK, 0x2AC)) { + else if (_action.isAction(VERB_LOOK, NOUN_LEVER)) { if (_globals[kLaserOn]) _vm->_dialogs->show(50825); else _vm->_dialogs->show(50824); - } else if (_action.isAction(VERB_PUSH, 0x2AC)) + } else if (_action.isAction(VERB_PUSH, NOUN_LEVER)) _vm->_dialogs->show(50826); - else if (_action.isAction(VERB_LOOK, 0x343)) { + else if (_action.isAction(VERB_LOOK, NOUN_LASER_BEAM)) { if (_globals[kLaserHoleIsThere]) _vm->_dialogs->show(50828); else _vm->_dialogs->show(50827); - } else if (_action.isAction(VERB_TAKE, 0x343)) + } else if (_action.isAction(VERB_TAKE, NOUN_LASER_BEAM)) _vm->_dialogs->show(50829); - else if (_action.isAction(VERB_LOOK, 0x46)) { + else if (_action.isAction(VERB_LOOK, NOUN_CEILING)) { if (_globals[kLaserHoleIsThere]) _vm->_dialogs->show(50831); else _vm->_dialogs->show(50830); - } else if (_action.isAction(VERB_LOOK, 0x18D)) + } else if (_action.isAction(VERB_LOOK, NOUN_WALL)) _vm->_dialogs->show(50832); - else if (_action.isAction(VERB_LOOK, 0x344)) { + else if (_action.isAction(VERB_LOOK, NOUN_PEDESTAL)) { if (!_globals[kLaserOn]) _vm->_dialogs->show(50813); else if (!_globals[kLaserHoleIsThere]) @@ -1882,9 +1882,9 @@ void Scene511::preActions() { } void Scene511::actions() { - if (_action.isAction(VERB_WALK_INTO, 0x372)) + if (_action.isAction(VERB_WALK_INTO, NOUN_RESTAURANT)) _scene->_nextSceneId = 512; - else if (_action.isAction(VERB_GET_INTO, 0x324)) { + else if (_action.isAction(VERB_GET_INTO, NOUN_CAR)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -1922,7 +1922,7 @@ void Scene511::actions() { default: break; } - } else if (_action.isAction(VERB_TAKE, 0x87)) { + } else if (_action.isAction(VERB_TAKE, NOUN_FISHING_LINE)) { if (!_globals[kBoatRaised]) { if (_globals[kLineStatus] == 2) { if (_globals[kLineStatus] != 3) { @@ -1983,7 +1983,7 @@ void Scene511::actions() { } } } - } else if (_action.isAction(VERB_LOOK, 0x31E) || _action._lookFlag) { + } else if (_action.isAction(VERB_LOOK, NOUN_STREET) || _action._lookFlag) { if (_globals[kLineStatus] == 2) _vm->_dialogs->show(51110); else { @@ -1992,17 +1992,17 @@ void Scene511::actions() { else _vm->_dialogs->show(51112); } - } else if (_action.isAction(VERB_LOOK, 0x324)) + } else if (_action.isAction(VERB_LOOK, NOUN_CAR)) _vm->_dialogs->show(51113); - else if (_action.isAction(VERB_LOOK, 0x31D)) + else if (_action.isAction(VERB_LOOK, NOUN_SIDEWALK)) _vm->_dialogs->show(51114); - else if (_action.isAction(VERB_WALK_DOWN, 0x322) || _action.isAction(VERB_WALK_DOWN, 0x361) || _action.isAction(VERB_WALK_DOWN, 0x321)) + else if (_action.isAction(VERB_WALK_DOWN, NOUN_SIDEWALK_TO_EAST) || _action.isAction(VERB_WALK_DOWN, NOUN_SIDEWALK_TO_WEST) || _action.isAction(VERB_WALK_DOWN, NOUN_STREET_TO_EAST)) _vm->_dialogs->show(51115); - else if (_action.isAction(VERB_LOOK, 0x37B)) + else if (_action.isAction(VERB_LOOK, NOUN_PLEASURE_DOME)) _vm->_dialogs->show(51116); - else if (_action.isAction(VERB_LOOK, 0x34A)) + else if (_action.isAction(VERB_LOOK, NOUN_TICKET_BOOTH)) _vm->_dialogs->show(51117); - else if (_action.isAction(VERB_LOOK, 0x37C)) + else if (_action.isAction(VERB_LOOK, NOUN_DOME_ENTRANCE)) _vm->_dialogs->show(51118); else if (_action.isAction(VERB_UNLOCK, 0xFF, 0x37C) || _action.isAction(VERB_UNLOCK, 0x6F, 0x37C)) _vm->_dialogs->show(51119); @@ -2010,27 +2010,27 @@ void Scene511::actions() { && (_action.isAction(0x171) || _action.isAction(0x2A) || _action.isAction(0x2B)) && _action.isAction(0x37C)) _vm->_dialogs->show(51120); - else if (_action.isAction(VERB_LOOK, 0x372)) { + else if (_action.isAction(VERB_LOOK, NOUN_RESTAURANT)) { if (_globals[kBoatRaised]) _vm->_dialogs->show(51121); else _vm->_dialogs->show(51128); - } else if (_action.isAction(VERB_LOOK, 0x349)) + } else if (_action.isAction(VERB_LOOK, NOUN_PORTHOLE)) _vm->_dialogs->show(51122); - else if (_action.isAction(VERB_LOOK, 0x87) && (_action._mainObjectSource == 4) && (_globals[kLineStatus] == 2)) + else if (_action.isAction(VERB_LOOK, NOUN_FISHING_LINE) && (_action._mainObjectSource == 4) && (_globals[kLineStatus] == 2)) _vm->_dialogs->show(51126); - else if (_action.isAction(VERB_LOOK, 0x87) && (_action._mainObjectSource == 4) && (_globals[kLineStatus] == 3)) + else if (_action.isAction(VERB_LOOK, NOUN_FISHING_LINE) && (_action._mainObjectSource == 4) && (_globals[kLineStatus] == 3)) _vm->_dialogs->show(51133); - else if (_action.isAction(VERB_LOOK, 0x2CD)) + else if (_action.isAction(VERB_LOOK, NOUN_STATUE)) _vm->_dialogs->show(51127); - else if (_action.isAction(VERB_LOOK, 0x345)) + else if (_action.isAction(VERB_LOOK, NOUN_BOAT)) if (_globals[kBoatRaised]) _vm->_dialogs->show(51123); else if (_globals[kLineStatus] != 3) _vm->_dialogs->show(51124); else _vm->_dialogs->show(51125); - else if (_action.isAction(VERB_LOOK, 0x87) && (_globals[kLineStatus] == 3)) + else if (_action.isAction(VERB_LOOK, NOUN_FISHING_LINE) && (_globals[kLineStatus] == 3)) _vm->_dialogs->show(51125); else return; @@ -2102,9 +2102,9 @@ void Scene512::enter() { } void Scene512::actions() { - if (_action.isAction(VERB_WALK, 0xF9)) + if (_action.isAction(VERB_WALK, NOUN_OUTSIDE)) _scene->_nextSceneId = 511; - else if (_action.isAction(VERB_TAKE, 0x88)) { + else if (_action.isAction(VERB_TAKE, NOUN_FISHING_ROD)) { if (_game._trigger || !_game._objects.isInInventory(OBJ_FISHING_ROD)) { switch (_game._trigger) { case 0: @@ -2134,7 +2134,7 @@ void Scene512::actions() { break; } } - } else if (_action.isAction(VERB_OPEN, 0x377)) { + } else if (_action.isAction(VERB_OPEN, NOUN_CASH_REGISTER)) { if (!_globals[kRegisterOpen]) { switch (_game._trigger) { case 0: @@ -2195,7 +2195,7 @@ void Scene512::actions() { } } else _vm->_dialogs->show(51239); - } else if (_action.isAction(VERB_CLOSE, 0x377) && _globals[kRegisterOpen]) { + } else if (_action.isAction(VERB_CLOSE, NOUN_CASH_REGISTER) && _globals[kRegisterOpen]) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -2231,7 +2231,7 @@ void Scene512::actions() { default: break; } - } else if (_action.isAction(VERB_TAKE, 0xFF)) { + } else if (_action.isAction(VERB_TAKE, NOUN_PADLOCK_KEY)) { if (_game._trigger || !_game._objects.isInInventory(OBJ_PADLOCK_KEY)) { switch (_game._trigger) { case 0: @@ -2278,48 +2278,48 @@ void Scene512::actions() { } } else if (_action._lookFlag) _vm->_dialogs->show(51225); - else if (_action.isAction(VERB_LOOK, 0xFF) && _game._objects.isInRoom(OBJ_PADLOCK_KEY)) + else if (_action.isAction(VERB_LOOK, NOUN_PADLOCK_KEY) && _game._objects.isInRoom(OBJ_PADLOCK_KEY)) _vm->_dialogs->show(51215); - else if (_action.isAction(VERB_LOOK, 0x88) && (_scene->_activeAnimation->getCurrentFrame() == 4)) + else if (_action.isAction(VERB_LOOK, NOUN_FISHING_ROD) && (_scene->_activeAnimation->getCurrentFrame() == 4)) _vm->_dialogs->show(51216); - else if (_action.isAction(VERB_LOOK, 0x354)) + else if (_action.isAction(VERB_LOOK, NOUN_SHIPS_WHEEL)) _vm->_dialogs->show(51218); - else if (_action.isAction(VERB_TAKE, 0x354)) + else if (_action.isAction(VERB_TAKE, NOUN_SHIPS_WHEEL)) _vm->_dialogs->show(51219); - else if (_action.isAction(VERB_LOOK, 0x349) || _action.isAction(VERB_PEER_THROUGH, 0x349)) + else if (_action.isAction(VERB_LOOK, NOUN_PORTHOLE) || _action.isAction(VERB_PEER_THROUGH, NOUN_PORTHOLE)) _vm->_dialogs->show(51220); - else if (_action.isAction(VERB_LOOK, 0x160)) + else if (_action.isAction(VERB_LOOK, NOUN_TABLE)) _vm->_dialogs->show(51221); - else if (_action.isAction(VERB_LOOK, 0x34E)) + else if (_action.isAction(VERB_LOOK, NOUN_STARFISH)) _vm->_dialogs->show(51222); - else if (_action.isAction(VERB_TAKE, 0x34E)) + else if (_action.isAction(VERB_TAKE, NOUN_STARFISH)) _vm->_dialogs->show(51223); - else if (_action.isAction(VERB_LOOK, 0xF9)) + else if (_action.isAction(VERB_LOOK, NOUN_OUTSIDE)) _vm->_dialogs->show(51224); - else if (_action.isAction(VERB_LOOK, 0x117)) + else if (_action.isAction(VERB_LOOK, NOUN_POSTER)) _vm->_dialogs->show(51227); - else if (_action.isAction(VERB_TAKE, 0x117)) + else if (_action.isAction(VERB_TAKE, NOUN_POSTER)) _vm->_dialogs->show(51228); - else if (_action.isAction(VERB_LOOK, 0x1BB)) { + else if (_action.isAction(VERB_LOOK, NOUN_TROPHY)) { if (_game._visitedScenes.exists(604)) _vm->_dialogs->show(51229); else _vm->_dialogs->show(51230); - } if (_action.isAction(VERB_LOOK, 0x47)) + } if (_action.isAction(VERB_LOOK, NOUN_CHAIR)) _vm->_dialogs->show(51231); - else if (_action.isAction(VERB_LOOK, 0x347)) + else if (_action.isAction(VERB_LOOK, NOUN_ROPE)) _vm->_dialogs->show(51232); - else if (_action.isAction(VERB_TAKE, 0x347)) + else if (_action.isAction(VERB_TAKE, NOUN_ROPE)) _vm->_dialogs->show(51233); - else if (_action.isAction(VERB_LOOK, 0x2F6)) + else if (_action.isAction(VERB_LOOK, NOUN_LAMP)) _vm->_dialogs->show(51234); - else if (_action.isAction(VERB_LOOK, 0x29F)) + else if (_action.isAction(VERB_LOOK, NOUN_COUNTER)) _vm->_dialogs->show(51235); - else if (_action.isAction(VERB_LOOK, 0x486)) + else if (_action.isAction(VERB_LOOK, NOUN_ICE_CHESTS)) _vm->_dialogs->show(51237); - else if (_action.isAction(VERB_OPEN, 0x486)) + else if (_action.isAction(VERB_OPEN, NOUN_ICE_CHESTS)) _vm->_dialogs->show(51238); - else if (_action.isAction(VERB_LOOK, 0x377)) { + else if (_action.isAction(VERB_LOOK, NOUN_CASH_REGISTER)) { if (!_globals[kRegisterOpen]) _vm->_dialogs->show(51212); else if (_game._objects.isInRoom(OBJ_PADLOCK_KEY)) @@ -2436,7 +2436,7 @@ void Scene513::step() { } void Scene513::actions() { - if (_action.isAction(VERB_GET_INTO, 0x324)) { + if (_action.isAction(VERB_GET_INTO, NOUN_CAR)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -2474,7 +2474,7 @@ void Scene513::actions() { default: break; } - } else if (_action.isAction(VERB_PUT, 0xB3, 0x251) || _action.isAction(VERB_PUT, 0x305, 0x251)) { + } else if (_action.isAction(VERB_PUT, NOUN_ID_CARD, 0x251) || _action.isAction(VERB_PUT, NOUN_FAKE_ID, 0x251)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -2523,31 +2523,31 @@ void Scene513::actions() { default: break; } - } else if ((_action._lookFlag) || _action.isAction(VERB_LOOK, 0x31E)) + } else if ((_action._lookFlag) || _action.isAction(VERB_LOOK, NOUN_STREET)) _vm->_dialogs->show(51318); - else if (_action.isAction(VERB_LOOK, 0x317)) + else if (_action.isAction(VERB_LOOK, NOUN_ELEVATOR)) _vm->_dialogs->show(51310); - else if (_action.isAction(VERB_LOOK, 0x367)) + else if (_action.isAction(VERB_LOOK, NOUN_ELEVATOR_DOOR)) _vm->_dialogs->show(51311); - else if (_action.isAction(VERB_LOOK, 0x251)) + else if (_action.isAction(VERB_LOOK, NOUN_CARD_SLOT)) _vm->_dialogs->show(51312); - else if (_action.isAction(VERB_LOOK, 0x355)) + else if (_action.isAction(VERB_LOOK, NOUN_HANDICAP_SIGN)) _vm->_dialogs->show(51313); - else if (_action.isAction(VERB_LOOK, 0x358)) + else if (_action.isAction(VERB_LOOK, NOUN_BIKE_RACK)) _vm->_dialogs->show(51314); - else if (_action.isAction(VERB_LOOK, 0x323)) + else if (_action.isAction(VERB_LOOK, NOUN_BUILDING)) _vm->_dialogs->show(51315); - else if (_action.isAction(VERB_LOOK, 0x244)) + else if (_action.isAction(VERB_LOOK, NOUN_SIGN)) _vm->_dialogs->show(51316); - else if (_action.isAction(VERB_LOOK, 0x360) || _action.isAction(VERB_WALK_DOWN, 0x360)) + else if (_action.isAction(VERB_LOOK, NOUN_STREET_TO_WEST) || _action.isAction(VERB_WALK_DOWN, NOUN_STREET_TO_WEST)) _vm->_dialogs->show(51317); - else if (_action.isAction(VERB_OPEN, 0x367) || _action.isAction(VERB_OPEN, 0x317)) + else if (_action.isAction(VERB_OPEN, NOUN_ELEVATOR_DOOR) || _action.isAction(VERB_OPEN, NOUN_ELEVATOR)) _vm->_dialogs->show(51319); - else if (_action.isAction(VERB_LOOK, 0x324)) + else if (_action.isAction(VERB_LOOK, NOUN_CAR)) _vm->_dialogs->show(51321); - else if (_action.isAction(VERB_LOOK, 0x357)) + else if (_action.isAction(VERB_LOOK, NOUN_BRICK_WALL)) _vm->_dialogs->show(51322); - else if (_action.isAction(VERB_PUT, 0x131, 0x251)) + else if (_action.isAction(VERB_PUT, NOUN_SECURITY_CARD, 0x251)) _vm->_dialogs->show(51320); else return; @@ -2686,32 +2686,32 @@ void Scene551::preActions() { } void Scene551::actions() { - if (_action.isAction(VERB_STEP_INTO, 0x16C)) + if (_action.isAction(VERB_STEP_INTO, NOUN_TELEPORTER)) _scene->_nextSceneId = 502; else if ((_action._lookFlag)) _vm->_dialogs->show(55117); - else if (_action.isAction(VERB_LOOK, 0x35E)) + else if (_action.isAction(VERB_LOOK, NOUN_SKELETON)) _vm->_dialogs->show(55110); - else if (_action.isAction(VERB_LOOK, 0x318)) + else if (_action.isAction(VERB_LOOK, NOUN_ELEVATOR_SHAFT)) _vm->_dialogs->show(55111); - else if (_action.isAction(VERB_WALKTO, 0x318)) + else if (_action.isAction(VERB_WALKTO, NOUN_ELEVATOR_SHAFT)) _vm->_dialogs->show(55112); - else if (_action.isAction(VERB_LOOK, 0x323)) + else if (_action.isAction(VERB_LOOK, NOUN_BUILDING)) _vm->_dialogs->show(55113); - else if (_action.isAction(VERB_LOOK, 0x16C)) + else if (_action.isAction(VERB_LOOK, NOUN_TELEPORTER)) _vm->_dialogs->show(55114); - else if (_action.isAction(VERB_LOOK, 0x323)) + else if (_action.isAction(VERB_LOOK, NOUN_BUILDING)) _vm->_dialogs->show(55115); - else if (_action.isAction(VERB_LOOK, 0x361)) { + else if (_action.isAction(VERB_LOOK, NOUN_SIDEWALK_TO_WEST)) { if (_game._visitedScenes.exists(505)) _vm->_dialogs->show(55116); else _vm->_dialogs->show(55115); - } else if (_action.isAction(VERB_LOOK, 0x31D)) + } else if (_action.isAction(VERB_LOOK, NOUN_SIDEWALK)) _vm->_dialogs->show(55118); - else if (_action.isAction(VERB_LOOK, 0x369)) + else if (_action.isAction(VERB_LOOK, NOUN_EQUIPMENT_OVERHEAD)) _vm->_dialogs->show(55119); - else if (_action.isAction(VERB_LOOK, 0x249)) + else if (_action.isAction(VERB_LOOK, NOUN_RAILING)) _vm->_dialogs->show(55120); else return; diff --git a/engines/mads/nebular/nebular_scenes6.cpp b/engines/mads/nebular/nebular_scenes6.cpp index a8f9ac159c..acadb820b4 100644 --- a/engines/mads/nebular/nebular_scenes6.cpp +++ b/engines/mads/nebular/nebular_scenes6.cpp @@ -147,7 +147,7 @@ void Scene601::step() { } void Scene601::actions() { - if (_action.isAction(VERB_WALK_THROUGH, 0x378)) + if (_action.isAction(VERB_WALK_THROUGH, NOUN_ENTRANCE)) _scene->_nextSceneId = 602; else if (_action.isAction(0x325, 0x324)) { switch (_game._trigger) { @@ -186,28 +186,28 @@ void Scene601::actions() { default: break; } - } else if (_action._lookFlag || _action.isAction(VERB_LOOK, 0x31E)) { + } else if (_action._lookFlag || _action.isAction(VERB_LOOK, NOUN_STREET)) { if (!_globals[kLaserHoleIsThere]) _vm->_dialogs->show(60110); else _vm->_dialogs->show(60111); - } else if (_action.isAction(VERB_LOOK, 0x324)) + } else if (_action.isAction(VERB_LOOK, NOUN_CAR)) _vm->_dialogs->show(60112); - else if (_action.isAction(VERB_LOOK, 0x32C)) + else if (_action.isAction(VERB_LOOK, NOUN_PAPERS)) _vm->_dialogs->show(60113); - else if (_action.isAction(VERB_LOOK, 0x323)) + else if (_action.isAction(VERB_LOOK, NOUN_BUILDING)) _vm->_dialogs->show(60114); - else if (_action.isAction(VERB_WALK_DOWN, 0x31E)) + else if (_action.isAction(VERB_WALK_DOWN, NOUN_STREET)) _vm->_dialogs->show(60115); - else if (_action.isAction(VERB_LOOK, 0x48E)) + else if (_action.isAction(VERB_LOOK, NOUN_BALCONY)) _vm->_dialogs->show(60116); - else if (_action.isAction(VERB_LOOK, 0x378)) + else if (_action.isAction(VERB_LOOK, NOUN_ENTRANCE)) _vm->_dialogs->show(60117); - else if (_action.isAction(VERB_LOOK, 0x18D)) + else if (_action.isAction(VERB_LOOK, NOUN_WALL)) _vm->_dialogs->show(60118); - else if (_action.isAction(VERB_LOOK, 0x38F)) + else if (_action.isAction(VERB_LOOK, NOUN_CITY)) _vm->_dialogs->show(60119); - else if (_action.isAction(VERB_LOOK, 0x3C4)) + else if (_action.isAction(VERB_LOOK, NOUN_FOUNTAIN)) _vm->_dialogs->show(60120); else return; @@ -383,15 +383,15 @@ void Scene602::handleSafeActions() { } void Scene602::actions() { - if (_action.isAction(VERB_WALK_THROUGH, 0x1F9)) + if (_action.isAction(VERB_WALK_THROUGH, NOUN_HALLWAY)) _scene->_nextSceneId = 601; - else if (_action.isAction(VERB_WALK_THROUGH, 0x70)) + else if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOORWAY)) _scene->_nextSceneId = 603; - else if (_action.isAction(VERB_OPEN, 0x3D3) && ((_globals[kSafeStatus] == 0) || (_globals[kSafeStatus] == 2))) { + else if (_action.isAction(VERB_OPEN, NOUN_SAFE) && ((_globals[kSafeStatus] == 0) || (_globals[kSafeStatus] == 2))) { _safeMode = 1; _cycleIndex = -2; handleSafeActions(); - } else if (_action.isAction(VERB_CLOSE, 0x3D3) && ((_globals[kSafeStatus] == 1) || (_globals[kSafeStatus] == 3))) { + } else if (_action.isAction(VERB_CLOSE, NOUN_SAFE) && ((_globals[kSafeStatus] == 1) || (_globals[kSafeStatus] == 3))) { _safeMode = 2; _cycleIndex = -1; handleSafeActions(); @@ -401,7 +401,7 @@ void Scene602::actions() { _cycleIndex = -2; handleSafeActions(); } - } else if ((_action.isAction(VERB_PUT, 0x120, 0x343) || _action.isAction(VERB_PUT, 0x57, 0x343) + } else if ((_action.isAction(VERB_PUT, NOUN_REARVIEW_MIRROR, 0x343) || _action.isAction(VERB_PUT, NOUN_COMPACT_CASE, 0x343) || _action.isAction(VERB_REFLECT, 0x57, 0x343) || _action.isAction(VERB_REFLECT, 0x120, 0x343)) && (_globals[kSafeStatus] == 0)) { switch (_game._trigger) { case 0: @@ -439,7 +439,7 @@ void Scene602::actions() { default: break; } - } else if (_action.isAction(VERB_TAKE, 0x6F) && (_game._trigger || _game._objects.isInRoom(OBJ_DOOR_KEY))) { + } else if (_action.isAction(VERB_TAKE, NOUN_DOOR_KEY) && (_game._trigger || _game._objects.isInRoom(OBJ_DOOR_KEY))) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -470,29 +470,29 @@ void Scene602::actions() { } } else if (_action._lookFlag) _vm->_dialogs->show(60210); - else if (_action.isAction(VERB_LOOK, 0x89)) + else if (_action.isAction(VERB_LOOK, NOUN_FLOOR)) _vm->_dialogs->show(60211); - else if (_action.isAction(VERB_LOOK, 0x1F9)) + else if (_action.isAction(VERB_LOOK, NOUN_HALLWAY)) _vm->_dialogs->show(60212); - else if (_action.isAction(VERB_LOOK, 0x160)) + else if (_action.isAction(VERB_LOOK, NOUN_TABLE)) _vm->_dialogs->show(60213); - else if (_action.isAction(VERB_LOOK, 0x47) || _action.isAction(VERB_LOOK, 0x3CA)) + else if (_action.isAction(VERB_LOOK, NOUN_CHAIR) || _action.isAction(VERB_LOOK, NOUN_LOUNGE_CHAIR)) _vm->_dialogs->show(60214); - else if (_action.isAction(VERB_LOOK, 0x492)) + else if (_action.isAction(VERB_LOOK, NOUN_NEON_LIGHTS)) _vm->_dialogs->show(60215); - else if (_action.isAction(VERB_LOOK, 0x3D8)) + else if (_action.isAction(VERB_LOOK, NOUN_FIREPLACE)) _vm->_dialogs->show(60216); - else if (_action.isAction(VERB_LOOK, 0x289)) + else if (_action.isAction(VERB_LOOK, NOUN_PICTURE)) _vm->_dialogs->show(60217); - else if (_action.isAction(VERB_LOOK, 0x2F6)) + else if (_action.isAction(VERB_LOOK, NOUN_LAMP)) _vm->_dialogs->show(60218); - else if (_action.isAction(VERB_LOOK, 0x491)) + else if (_action.isAction(VERB_LOOK, NOUN_MASKS)) _vm->_dialogs->show(60219); - else if (_action.isAction(VERB_LOOK, 0x493)) + else if (_action.isAction(VERB_LOOK, NOUN_GLASS_BLOCK_WALL)) _vm->_dialogs->show(60220); - else if (_action.isAction(VERB_LOOK, 0x70)) + else if (_action.isAction(VERB_LOOK, NOUN_DOORWAY)) _vm->_dialogs->show(60221); - else if (_action.isAction(VERB_LOOK, 0x3D3)) { + else if (_action.isAction(VERB_LOOK, NOUN_SAFE)) { if (_globals[kSafeStatus] == 0) _vm->_dialogs->show(60222); else if (_globals[kSafeStatus] == 1) { @@ -508,19 +508,19 @@ void Scene602::actions() { _vm->_dialogs->show(60236); } else if (_action.isAction(VERB_UNLOCK, 0x6F, 0x3D3) || _action.isAction(VERB_UNLOCK, 0xFF, 0x3D3)) _vm->_dialogs->show(60225); - else if (_action.isAction(VERB_PULL, 0x3D3)) + else if (_action.isAction(VERB_PULL, NOUN_SAFE)) _vm->_dialogs->show(60226); - else if (_action.isAction(VERB_PUT, 0x3D8) && _game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId))) + else if (_action.isAction(VERB_PUT, NOUN_FIREPLACE) && _game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId))) _vm->_dialogs->show(60227); - else if (_action.isAction(VERB_LOOK, 0x342)) + else if (_action.isAction(VERB_LOOK, NOUN_HOLE)) _vm->_dialogs->show(60228); - else if (_action.isAction(VERB_LOOK, 0x343)) + else if (_action.isAction(VERB_LOOK, NOUN_LASER_BEAM)) _vm->_dialogs->show(60229); - else if (_action.isAction(VERB_LOOK, 0x3F5)) + else if (_action.isAction(VERB_LOOK, NOUN_FLOWER_BOX)) _vm->_dialogs->show(60231); - else if (_action.isAction(VERB_THROW, 0x2A, 0x3D3) || _action.isAction(VERB_THROW, 0x2B, 0x3D3)) + else if (_action.isAction(VERB_THROW, NOUN_BOMB, 0x3D3) || _action.isAction(VERB_THROW, NOUN_BOMBS, 0x3D3)) _vm->_dialogs->show(60232); - else if (_action.isAction(VERB_PUT, 0x171)) + else if (_action.isAction(VERB_PUT, NOUN_TIMEBOMB)) _vm->_dialogs->show(60233); else return; @@ -564,9 +564,9 @@ void Scene603::enter() { } void Scene603::actions() { - if (_action.isAction(VERB_WALK_TOWARDS, 0x3F1)) + if (_action.isAction(VERB_WALK_TOWARDS, NOUN_LIVINGROOM)) _scene->_nextSceneId = 602; - else if (_action.isAction(VERB_TAKE, 0x57)) { + else if (_action.isAction(VERB_TAKE, NOUN_COMPACT_CASE)) { if ( _game._trigger || !_game._objects.isInInventory(OBJ_COMPACT_CASE)) { switch (_game._trigger) { case 0: @@ -597,7 +597,7 @@ void Scene603::actions() { break; } } - } else if (_action.isAction(VERB_TAKE, 0x3A8)) { + } else if (_action.isAction(VERB_TAKE, NOUN_NOTE)) { if ( _game._trigger || !_game._objects.isInInventory(OBJ_NOTE)) { if (_game._trigger == 0) { _game._player._stepEnabled = false; @@ -618,46 +618,46 @@ void Scene603::actions() { } } else if (_action._lookFlag) _vm->_dialogs->show(60310); - else if (_action.isAction(VERB_LOOK, 0x1CB)) + else if (_action.isAction(VERB_LOOK, NOUN_BED)) _vm->_dialogs->show(60311); - else if (_action.isAction(VERB_LOOK, 0x3E5)) + else if (_action.isAction(VERB_LOOK, NOUN_WIG_STAND)) _vm->_dialogs->show(60312); - else if (_action.isAction(VERB_TAKE, 0x3E5)) + else if (_action.isAction(VERB_TAKE, NOUN_WIG_STAND)) _vm->_dialogs->show(60313); - else if (_action.isAction(VERB_LOOK, 0x3EE)) + else if (_action.isAction(VERB_LOOK, NOUN_REVIEW)) _vm->_dialogs->show(60314); - else if (_action.isAction(VERB_LOOK, 0x3ED)) + else if (_action.isAction(VERB_LOOK, NOUN_SOUVENIR_TICKETS)) _vm->_dialogs->show(60315); - else if (_action.isAction(VERB_LOOK, 0x49D)) + else if (_action.isAction(VERB_LOOK, NOUN_PHOTOGRAPH)) _vm->_dialogs->show(60316); - else if (_action.isAction(VERB_LOOK, 0x2F6)) + else if (_action.isAction(VERB_LOOK, NOUN_LAMP)) _vm->_dialogs->show(60317); - else if (_action.isAction(VERB_LOOK, 0x49E) || _action.isAction(VERB_LOOK, 0x49F) || _action.isAction(VERB_LOOK, 0x3E7)) + else if (_action.isAction(VERB_LOOK, NOUN_DIRECTORS_SLATE) || _action.isAction(VERB_LOOK, NOUN_CROP) || _action.isAction(VERB_LOOK, NOUN_MEGAPHONE)) _vm->_dialogs->show(60318); - else if (_action.isAction(VERB_LOOK, 0x3DE)) + else if (_action.isAction(VERB_LOOK, NOUN_SNAPSHOT)) _vm->_dialogs->show(60319); - else if (_action.isAction(VERB_TAKE, 0x3DE)) + else if (_action.isAction(VERB_TAKE, NOUN_SNAPSHOT)) _vm->_dialogs->show(60320); - else if (_action.isAction(VERB_LOOK, 0x3DF)) + else if (_action.isAction(VERB_LOOK, NOUN_PERFUME)) _vm->_dialogs->show(60321); - else if (_action.isAction(VERB_TAKE, 0x3DF)) + else if (_action.isAction(VERB_TAKE, NOUN_PERFUME)) _vm->_dialogs->show(60322); - else if (_action.isAction(VERB_TAKE, 0x3A8)) + else if (_action.isAction(VERB_TAKE, NOUN_NOTE)) _vm->_dialogs->show(60323); - else if (_action.isAction(VERB_LOOK, 0x3A8)) { + else if (_action.isAction(VERB_LOOK, NOUN_NOTE)) { if (_game._objects[OBJ_NOTE]._roomNumber == _scene->_currentSceneId) _vm->_dialogs->show(60324); - } else if (_action.isAction(VERB_LOOK, 0x3E3)) { + } else if (_action.isAction(VERB_LOOK, NOUN_CORNER_TABLE)) { if (_game._objects[OBJ_NOTE]._roomNumber == _scene->_currentSceneId) _vm->_dialogs->show(60326); else _vm->_dialogs->show(60325); - } else if (_action.isAction(VERB_LOOK, 0x3EA)) { + } else if (_action.isAction(VERB_LOOK, NOUN_VANITY)) { if (_game._objects[OBJ_COMPACT_CASE]._roomNumber == _scene->_currentSceneId) _vm->_dialogs->show(60327); else _vm->_dialogs->show(60328); - } else if (_action.isAction(VERB_LOOK, 0x57) && (_action._mainObjectSource == 4)) + } else if (_action.isAction(VERB_LOOK, NOUN_COMPACT_CASE) && (_action._mainObjectSource == 4)) _vm->_dialogs->show(60329); // For the next two checks, the second part of the check wasn't surrounded par parenthesis, which was obviously wrong else if (_action.isAction(VERB_LOOK) && (_action.isAction(0x31) || _action.isAction(0x3EA) || _action.isAction(0x3E8))) @@ -890,10 +890,10 @@ void Scene604::actions() { default: break; } - } else if ((_action.isAction(VERB_PUT, 0x3F6) || _action.isAction(VERB_PUT, 0x181) || _action.isAction(VERB_THROW, 0x181)) + } else if ((_action.isAction(VERB_PUT, NOUN_LEDGE) || _action.isAction(VERB_PUT, NOUN_VIEWPORT) || _action.isAction(VERB_THROW, NOUN_VIEWPORT)) && (_action.isAction(0x2A) || _action.isAction(0x2B))) _vm->_dialogs->show(60420); - else if (_action.isAction(VERB_PUT, 0x171, 0x3F6) || _action.isAction(VERB_PUT, 0x171, 0x181)) { + else if (_action.isAction(VERB_PUT, NOUN_TIMEBOMB, 0x3F6) || _action.isAction(VERB_PUT, NOUN_TIMEBOMB, 0x181)) { _bombMode = 1; if ((_game._difficulty == DIFFICULTY_HARD) || _globals[kWarnedFloodCity]) handleBombActions(); @@ -906,30 +906,30 @@ void Scene604::actions() { _vm->_dialogs->show(60425); _globals[kWarnedFloodCity] = true; } - } else if (_action.isAction(VERB_TAKE, 0x171)) { + } else if (_action.isAction(VERB_TAKE, NOUN_TIMEBOMB)) { if (_game._trigger || !_game._objects.isInInventory(OBJ_TIMEBOMB)) { _bombMode = 2; handleBombActions(); } } else if (_action._lookFlag) _vm->_dialogs->show(60411); - else if (_action.isAction(VERB_LOOK, 0x181)) { + else if (_action.isAction(VERB_LOOK, NOUN_VIEWPORT)) { if (_monsterActive) { _vm->_dialogs->show(60413); } else { _vm->_dialogs->show(60412); } - } else if (_action.isAction(VERB_LOOK, 0x18D)) + } else if (_action.isAction(VERB_LOOK, NOUN_WALL)) _vm->_dialogs->show(60414); - else if (_action.isAction(VERB_LOOK, 0x3F4)) + else if (_action.isAction(VERB_LOOK, NOUN_VENT)) _vm->_dialogs->show(60415); - else if (_action.isAction(VERB_LOOK, 0x479)) + else if (_action.isAction(VERB_LOOK, NOUN_INDICATOR)) _vm->_dialogs->show(60416); - else if (_action.isAction(VERB_LOOK, 0x3F2)) + else if (_action.isAction(VERB_LOOK, NOUN_SCULPTURE)) _vm->_dialogs->show(60417); - else if (_action.isAction(VERB_LOOK, 0x324)) + else if (_action.isAction(VERB_LOOK, NOUN_CAR)) _vm->_dialogs->show(60418); - else if (_action.isAction(VERB_LOOK, 0x3C4)) + else if (_action.isAction(VERB_LOOK, NOUN_FOUNTAIN)) _vm->_dialogs->show(60419); else return; @@ -1293,23 +1293,23 @@ void Scene607::handleThrowingBone() { } void Scene607::preActions() { - if (_action.isAction(VERB_TALKTO, 0x471)) + if (_action.isAction(VERB_TALKTO, NOUN_OBNOXIOUS_DOG)) _game._player._needToWalk = false; - if (_action.isAction(VERB_WALK_THROUGH, 0x478) && (_globals[kDogStatus] == 2) && (_game._difficulty != DIFFICULTY_EASY)) { + if (_action.isAction(VERB_WALK_THROUGH, NOUN_SIDE_ENTRANCE) && (_globals[kDogStatus] == 2) && (_game._difficulty != DIFFICULTY_EASY)) { _shopAvailable = true; _dogTimer = 0; } - if (_action.isAction(VERB_THROW, 0x2D, 0x471) || _action.isAction(VERB_THROW, 0x2C, 0x471)) + if (_action.isAction(VERB_THROW, NOUN_BONES, 0x471) || _action.isAction(VERB_THROW, NOUN_BONE, 0x471)) _game._player.walk(Common::Point(193, 100), FACING_NORTHEAST); - if (_action.isAction(VERB_THROW, 0x2D, 0x2C3) || _action.isAction(VERB_THROW, 0x2C, 0x2C3)) + if (_action.isAction(VERB_THROW, NOUN_BONES, 0x2C3) || _action.isAction(VERB_THROW, NOUN_BONE, 0x2C3)) _game._player.walk(Common::Point(201, 107), FACING_SOUTHEAST); } void Scene607::actions() { - if (_action.isAction(VERB_WALK_THROUGH, 0x478)) + if (_action.isAction(VERB_WALK_THROUGH, NOUN_SIDE_ENTRANCE)) _scene->_nextSceneId = 608; else if (_action.isAction(0x325, 0x324)) { switch (_game._trigger) { @@ -1348,7 +1348,7 @@ void Scene607::actions() { default: break; } - } else if (_action.isAction(VERB_THROW, 0x2D, 0x471) || _action.isAction(VERB_THROW, 0x2C, 0x471)) { + } else if (_action.isAction(VERB_THROW, NOUN_BONES, 0x471) || _action.isAction(VERB_THROW, NOUN_BONE, 0x471)) { if (_game._difficulty != DIFFICULTY_EASY) { _animationMode = 1; _scene->_kernelMessages.reset(); @@ -1357,7 +1357,7 @@ void Scene607::actions() { handleThrowingBone(); } - } else if ((_action.isAction(VERB_THROW, 0x2D, 0x2C3) || _action.isAction(VERB_THROW, 0x2C, 0x2C3)) && (_game._difficulty != DIFFICULTY_EASY) + } else if ((_action.isAction(VERB_THROW, NOUN_BONES, 0x2C3) || _action.isAction(VERB_THROW, NOUN_BONE, 0x2C3)) && (_game._difficulty != DIFFICULTY_EASY) && ((_globals[kDogStatus] == 1) || _game._trigger)) { _animationMode = 2; if (_game._trigger == 0) { @@ -1365,48 +1365,48 @@ void Scene607::actions() { _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x2F6)); } handleThrowingBone(); - } else if (_action._lookFlag || _action.isAction(VERB_LOOK, 0x31E)) { + } else if (_action._lookFlag || _action.isAction(VERB_LOOK, NOUN_STREET)) { if ((_globals[kDogStatus] == 1) || (_game._difficulty == DIFFICULTY_EASY)) _vm->_dialogs->show(60710); else _vm->_dialogs->show(60711); - } else if (_action.isAction(VERB_LOOK, 0x18D)) + } else if (_action.isAction(VERB_LOOK, NOUN_WALL)) _vm->_dialogs->show(60712); - else if (_action.isAction(VERB_LOOK, 0x2C3)) + else if (_action.isAction(VERB_LOOK, NOUN_FENCE)) _vm->_dialogs->show(60713); - else if (_action.isAction(VERB_LOOK, 0x324)) + else if (_action.isAction(VERB_LOOK, NOUN_CAR)) _vm->_dialogs->show(60714); - else if (_action.isAction(VERB_LOOK, 0x3FB)) + else if (_action.isAction(VERB_LOOK, NOUN_MANHOLE)) _vm->_dialogs->show(60715); - else if (_action.isAction(VERB_LOOK, 0x1E6) && (_globals[kDogStatus] == 1)) + else if (_action.isAction(VERB_LOOK, NOUN_FIRE_HYDRANT) && (_globals[kDogStatus] == 1)) _vm->_dialogs->show(60716); - else if (_action.isAction(VERB_LOOK, 0x244)) + else if (_action.isAction(VERB_LOOK, NOUN_SIGN)) _vm->_dialogs->show(60717); - else if (_action.isAction(VERB_LOOK, 0x3FD)) + else if (_action.isAction(VERB_LOOK, NOUN_BROKEN_WINDOW)) _vm->_dialogs->show(60718); - else if (_action.isAction(VERB_LOOK, 0x3FF)) + else if (_action.isAction(VERB_LOOK, NOUN_GARAGE_DOOR)) _vm->_dialogs->show(60719); - else if (_action.isAction(VERB_LOOK, 0x31D)) + else if (_action.isAction(VERB_LOOK, NOUN_SIDEWALK)) _vm->_dialogs->show(60720); - else if (_action.isAction(VERB_LOOK, 0x3F9)) + else if (_action.isAction(VERB_LOOK, NOUN_AIR_HOSE)) _vm->_dialogs->show(60721); - else if (_action.isAction(VERB_LOOK, 0x3FA)) { + else if (_action.isAction(VERB_LOOK, NOUN_AUTO_SHOP)) { if (_globals[kDogStatus] == 1) _vm->_dialogs->show(60723); else _vm->_dialogs->show(60722); - } else if (_action.isAction(VERB_LOOK, 0x478)) { + } else if (_action.isAction(VERB_LOOK, NOUN_SIDE_ENTRANCE)) { if (_globals[kDogStatus] == 1) _vm->_dialogs->show(60725); else _vm->_dialogs->show(60724); - } else if (_action.isAction(VERB_LOOK, 0x471)) + } else if (_action.isAction(VERB_LOOK, NOUN_OBNOXIOUS_DOG)) _vm->_dialogs->show(60726); - else if (_action.isAction(VERB_TALKTO, 0x471)) + else if (_action.isAction(VERB_TALKTO, NOUN_OBNOXIOUS_DOG)) _vm->_dialogs->show(60727); - else if (_action.isAction(VERB_LOOK, 0x31F)) + else if (_action.isAction(VERB_LOOK, NOUN_BARRICADE)) _vm->_dialogs->show(60728); - else if (_action.isAction(VERB_WALK_DOWN, 0x31E)) + else if (_action.isAction(VERB_WALK_DOWN, NOUN_STREET)) _vm->_dialogs->show(60730); else if (_action.isAction(0x3FF) && (_action.isAction(VERB_OPEN) || _action.isAction(VERB_PUSH) || _action.isAction(VERB_PULL))) _vm->_dialogs->show(60731); @@ -2070,20 +2070,20 @@ void Scene608::step() { void Scene608::preActions() { _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; - if ((_action.isAction(VERB_THROW, 0x2C, 0x410) || _action.isAction(VERB_THROW, 0x2D, 0x410) - || _action.isAction(VERB_THROW, 0x2C, 0x411) || _action.isAction(VERB_THROW, 0x2D, 0x411) - || _action.isAction(VERB_THROW, 0x2D, 0x471) || _action.isAction(VERB_THROW, 0x2C, 0x471)) && _dogActiveFl) { + if ((_action.isAction(VERB_THROW, NOUN_BONE, 0x410) || _action.isAction(VERB_THROW, NOUN_BONES, 0x410) + || _action.isAction(VERB_THROW, NOUN_BONE, 0x411) || _action.isAction(VERB_THROW, NOUN_BONES, 0x411) + || _action.isAction(VERB_THROW, NOUN_BONES, 0x471) || _action.isAction(VERB_THROW, NOUN_BONE, 0x471)) && _dogActiveFl) { _game._player._stepEnabled = false; _game._player.walk(Common::Point(56, 146), FACING_EAST); } - if ((_action.isAction(VERB_THROW, 0x2D, 0x41D) || _action.isAction(VERB_THROW, 0x2C, 0x41D) - || _action.isAction(VERB_THROW, 0x2D, 0x41E) || _action.isAction(VERB_THROW, 0x2C, 0x41E)) && _dogActiveFl) { + if ((_action.isAction(VERB_THROW, NOUN_BONES, 0x41D) || _action.isAction(VERB_THROW, NOUN_BONE, 0x41D) + || _action.isAction(VERB_THROW, NOUN_BONES, 0x41E) || _action.isAction(VERB_THROW, NOUN_BONE, 0x41E)) && _dogActiveFl) { _game._player._stepEnabled = false; _game._player.walk(Common::Point(75, 136), FACING_EAST); } - if (_action.isAction(VERB_PUSH, 0x403) && _dogUnderCar) { + if (_action.isAction(VERB_PUSH, NOUN_DOWN_BUTTON) && _dogUnderCar) { _buttonPressedonTimeFl = true; _dogDeathMode = 1; } else @@ -2091,9 +2091,9 @@ void Scene608::preActions() { } void Scene608::actions() { - if (_action.isAction(VERB_WALK_THROUGH, 0x70)) + if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOORWAY)) _scene->_nextSceneId = 607; - else if (_action.isAction(VERB_PUSH, 0x403)) { + else if (_action.isAction(VERB_PUSH, NOUN_DOWN_BUTTON)) { _game._player._stepEnabled = true; switch (_game._trigger) { case 0: @@ -2168,7 +2168,7 @@ void Scene608::actions() { default: break; } - } else if (_action.isAction(VERB_PUSH, 0x402)) { + } else if (_action.isAction(VERB_PUSH, NOUN_UP_BUTTON)) { switch (_game._trigger) { case 0: if ((_globals[kCarStatus] == 3) || (_globals[kCarStatus] == 4)) { @@ -2217,8 +2217,8 @@ void Scene608::actions() { default: break; } - } else if (_action.isAction(VERB_THROW, 0x2C, 0x410) || _action.isAction(VERB_THROW, 0x2D, 0x410) - || _action.isAction(VERB_THROW, 0x2D, 0x471) || _action.isAction(VERB_THROW, 0x2C, 0x471)) { + } else if (_action.isAction(VERB_THROW, NOUN_BONE, 0x410) || _action.isAction(VERB_THROW, NOUN_BONES, 0x410) + || _action.isAction(VERB_THROW, NOUN_BONES, 0x471) || _action.isAction(VERB_THROW, NOUN_BONE, 0x471)) { _game._player._stepEnabled = true; if (_dogActiveFl) { if (_game._trigger == 0) { @@ -2229,7 +2229,7 @@ void Scene608::actions() { handleThrowingBone(); } else _vm->_dialogs->show(60841); - } else if (_action.isAction(VERB_THROW, 0x2C, 0x411) || _action.isAction(VERB_THROW, 0x2D, 0x411)) { + } else if (_action.isAction(VERB_THROW, NOUN_BONE, 0x411) || _action.isAction(VERB_THROW, NOUN_BONES, 0x411)) { _game._player._stepEnabled = true; if (_dogActiveFl) { if (_game._trigger == 0) { @@ -2240,8 +2240,8 @@ void Scene608::actions() { handleThrowingBone(); } else _vm->_dialogs->show(60841); - } else if (_action.isAction(VERB_THROW, 0x2D, 0x41D) || _action.isAction(VERB_THROW, 0x2C, 0x41D) - || _action.isAction(VERB_THROW, 0x2D, 0x41E) || _action.isAction(VERB_THROW, 0x2C, 0x41E)) { + } else if (_action.isAction(VERB_THROW, NOUN_BONES, 0x41D) || _action.isAction(VERB_THROW, NOUN_BONE, 0x41D) + || _action.isAction(VERB_THROW, NOUN_BONES, 0x41E) || _action.isAction(VERB_THROW, NOUN_BONE, 0x41E)) { _game._player._stepEnabled = true; if ((_globals[kCarStatus] == 0) && _dogActiveFl) { if (_dogActiveFl) { @@ -2255,7 +2255,7 @@ void Scene608::actions() { _vm->_dialogs->show(60841); } else _vm->_dialogs->show(60842); - } else if (_action.isAction(VERB_TAKE, 0x115) && (_game._trigger || !_game._objects.isInInventory(OBJ_POLYCEMENT))) { + } else if (_action.isAction(VERB_TAKE, NOUN_POLYCEMENT) && (_game._trigger || !_game._objects.isInInventory(OBJ_POLYCEMENT))) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -2283,7 +2283,7 @@ void Scene608::actions() { default: break; } - } else if (_action.isAction(VERB_TAKE, 0x120) && (_game._trigger || !_game._objects.isInInventory(OBJ_REARVIEW_MIRROR))) { + } else if (_action.isAction(VERB_TAKE, NOUN_REARVIEW_MIRROR) && (_game._trigger || !_game._objects.isInInventory(OBJ_REARVIEW_MIRROR))) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -2324,51 +2324,51 @@ void Scene608::actions() { else if (_action.isAction(VERB_TAKE) && (_action.isAction(0x412) || _action.isAction(0x408) || _action.isAction(0x414) || _action.isAction(0x40D) || _action.isAction(0x41C))) _vm->_dialogs->show(60814); - else if (_action.isAction(VERB_LOOK, 0x409) || _action.isAction(VERB_LOOK, 0x411) || _action.isAction(VERB_LOOK, 0x410)) { + else if (_action.isAction(VERB_LOOK, NOUN_GARAGE_FLOOR) || _action.isAction(VERB_LOOK, NOUN_FRONT_OF_GARAGE) || _action.isAction(VERB_LOOK, NOUN_REAR_OF_GARAGE)) { if (_dogActiveFl) _vm->_dialogs->show(60815); else _vm->_dialogs->show(60816); - } else if (_action.isAction(VERB_LOOK, 0x495)) + } else if (_action.isAction(VERB_LOOK, NOUN_SPARE_RIBS)) _vm->_dialogs->show(60817); - else if (_action.isAction(VERB_TAKE, 0x495)) { + else if (_action.isAction(VERB_TAKE, NOUN_SPARE_RIBS)) { if (_game._difficulty == DIFFICULTY_HARD) _vm->_dialogs->show(60818); else _vm->_dialogs->show(60819); - } else if (_action.isAction(VERB_LOOK, 0x402)) + } else if (_action.isAction(VERB_LOOK, NOUN_UP_BUTTON)) _vm->_dialogs->show(60820); - else if (_action.isAction(VERB_LOOK, 0x403)) + else if (_action.isAction(VERB_LOOK, NOUN_DOWN_BUTTON)) _vm->_dialogs->show(60821); - else if (_action.isAction(VERB_LOOK, 0x41A)) + else if (_action.isAction(VERB_LOOK, NOUN_TRASH_CAN)) _vm->_dialogs->show(60822); - else if (_action.isAction(VERB_LOOK, 0x418)) + else if (_action.isAction(VERB_LOOK, NOUN_CALENDAR)) _vm->_dialogs->show(60823); - else if (_action.isAction(VERB_LOOK, 0x330)) { + else if (_action.isAction(VERB_LOOK, NOUN_STORAGE_BOX)) { if (_game._objects[OBJ_REARVIEW_MIRROR]._roomNumber == _scene->_currentSceneId) _vm->_dialogs->show(60825); else _vm->_dialogs->show(60824); - } else if (_action.isAction(VERB_OPEN, 0x330)) + } else if (_action.isAction(VERB_OPEN, NOUN_STORAGE_BOX)) _vm->_dialogs->show(60826); - else if (_action.isAction(VERB_LOOK, 0x120) && (_action._mainObjectSource == 4)) + else if (_action.isAction(VERB_LOOK, NOUN_REARVIEW_MIRROR) && (_action._mainObjectSource == 4)) _vm->_dialogs->show(60828); - else if (_action.isAction(VERB_LOOK, 0x406)) { + else if (_action.isAction(VERB_LOOK, NOUN_TOOL_BOX)) { if (_game._objects[OBJ_POLYCEMENT]._roomNumber == _scene->_currentSceneId) _vm->_dialogs->show(60829); else _vm->_dialogs->show(60830); - } else if (_action.isAction(VERB_OPEN, 0x406)) + } else if (_action.isAction(VERB_OPEN, NOUN_TOOL_BOX)) _vm->_dialogs->show(60831); - else if ((_action.isAction(VERB_LOOK, 0x115)) && (_game._objects.isInRoom(OBJ_POLYCEMENT))) + else if ((_action.isAction(VERB_LOOK, NOUN_POLYCEMENT)) && (_game._objects.isInRoom(OBJ_POLYCEMENT))) _vm->_dialogs->show(60832); - else if (_action.isAction(VERB_LOOK, 0x417) || _action.isAction(VERB_LOOK, 0x40E)) + else if (_action.isAction(VERB_LOOK, NOUN_GREASE_CAN) || _action.isAction(VERB_LOOK, NOUN_OIL_CAN)) _vm->_dialogs->show(60834); - else if (_action.isAction(VERB_LOOK, 0x407)) + else if (_action.isAction(VERB_LOOK, NOUN_CAR_LIFT)) _vm->_dialogs->show(60835); - else if (_action.isAction(VERB_LOOK, 0x47) || _action.isAction(VERB_LOOK, 0x4A0)) + else if (_action.isAction(VERB_LOOK, NOUN_CHAIR) || _action.isAction(VERB_LOOK, NOUN_HAT)) _vm->_dialogs->show(60836); - else if (_action.isAction(VERB_LOOK, 0x41E)) + else if (_action.isAction(VERB_LOOK, NOUN_DANGER_ZONE)) _vm->_dialogs->show(60838); else return; @@ -2586,9 +2586,9 @@ void Scene609::preActions() { } void Scene609::actions() { - if (_action.isAction(VERB_WALK_TOWARDS, 0x423)) + if (_action.isAction(VERB_WALK_TOWARDS, NOUN_ALLEY)) _scene->_nextSceneId = 611; - else if (_action.isAction(VERB_WALK_THROUGH, 0x425)) { + else if (_action.isAction(VERB_WALK_THROUGH, NOUN_VIDEO_STORE_DOOR)) { if (!_globals[kBeenInVideoStore]) { switch (_game._trigger) { case 0: @@ -2672,26 +2672,26 @@ void Scene609::actions() { } } else if (_action._lookFlag) _vm->_dialogs->show(60910); - else if (_action.isAction(VERB_LOOK, 0x31E)) + else if (_action.isAction(VERB_LOOK, NOUN_STREET)) _vm->_dialogs->show(60911); - else if (_action.isAction(VERB_LOOK, 0x421)) + else if (_action.isAction(VERB_LOOK, NOUN_SPOT_A_POT)) _vm->_dialogs->show(60912); - else if (_action.isAction(VERB_LOOK, 0x427)) + else if (_action.isAction(VERB_LOOK, NOUN_VIDEO_STORE)) _vm->_dialogs->show(60913); - else if (_action.isAction(VERB_LOOK, 0x33A)) + else if (_action.isAction(VERB_LOOK, NOUN_BILLBOARD)) _vm->_dialogs->show(60914); - else if (_action.isAction(VERB_LOOK, 0x2CD)) + else if (_action.isAction(VERB_LOOK, NOUN_STATUE)) _vm->_dialogs->show(60915); - else if (_action.isAction(VERB_LOOK, 0x324)) + else if (_action.isAction(VERB_LOOK, NOUN_CAR)) _vm->_dialogs->show(60916); - else if (_action.isAction(VERB_LOOK, 0x41F)) + else if (_action.isAction(VERB_LOOK, NOUN_NEWSSTAND)) _vm->_dialogs->show(60917); - else if (_action.isAction(VERB_LOOK, 0x425)) { + else if (_action.isAction(VERB_LOOK, NOUN_VIDEO_STORE_DOOR)) { if (!_globals[kBeenInVideoStore]) _vm->_dialogs->show(60918); else _vm->_dialogs->show(60919); - } else if (_action.isAction(VERB_WALK_DOWN, 0x31E)) + } else if (_action.isAction(VERB_WALK_DOWN, NOUN_STREET)) _vm->_dialogs->show(60730); else return; @@ -2763,9 +2763,9 @@ void Scene610::step() { } void Scene610::actions() { - if (_action.isAction(VERB_EXIT_FROM, 0x427)) + if (_action.isAction(VERB_EXIT_FROM, NOUN_VIDEO_STORE)) _scene->_nextSceneId = 609; - else if (_action.isAction(VERB_TAKE, 0x108)) { + else if (_action.isAction(VERB_TAKE, NOUN_PHONE_HANDSET)) { if ( _game._trigger || !_game._objects.isInInventory(OBJ_PHONE_HANDSET)) { switch (_game._trigger) { case 0: @@ -2796,7 +2796,7 @@ void Scene610::actions() { break; } } - } else if (_action.isAction(VERB_PUT, 0x108, 0x42F)) { + } else if (_action.isAction(VERB_PUT, NOUN_PHONE_HANDSET, 0x42F)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -2828,42 +2828,42 @@ void Scene610::actions() { default: break; } - } else if (_action.isAction(VERB_LOOK, 0x442)) + } else if (_action.isAction(VERB_LOOK, NOUN_PIPPY_BILLBOARD)) _vm->_dialogs->show(61010); - else if (_action.isAction(VERB_LOOK, 0x44B)) + else if (_action.isAction(VERB_LOOK, NOUN_CIVILIZATION_AD)) _vm->_dialogs->show(61011); - else if (_action.isAction(VERB_LOOK, 0x441)) + else if (_action.isAction(VERB_LOOK, NOUN_MARX_BROS_POSTER)) _vm->_dialogs->show(61012); - else if (_action.isAction(VERB_LOOK, 0x43C)) + else if (_action.isAction(VERB_LOOK, NOUN_VIDEO_MONITOR)) _vm->_dialogs->show(61013); - else if (_action.isAction(VERB_LOOK, 0x427)) + else if (_action.isAction(VERB_LOOK, NOUN_VIDEO_STORE)) _vm->_dialogs->show(61014); else if (_action._lookFlag) _vm->_dialogs->show(61015); - else if (_action.isAction(VERB_LOOK, 0x4A1)) + else if (_action.isAction(VERB_LOOK, NOUN_LOGO)) _vm->_dialogs->show(61018); - else if (_action.isAction(VERB_LOOK, 0x498)) { + else if (_action.isAction(VERB_LOOK, NOUN_CEMENT)) { if (_game._visitedScenes.exists(601)) _vm->_dialogs->show(61020); else _vm->_dialogs->show(61019); - } else if (_action.isAction(VERB_LOOK, 0x29F)) + } else if (_action.isAction(VERB_LOOK, NOUN_COUNTER)) _vm->_dialogs->show(61021); - else if (_action.isAction(VERB_LOOK, 0x429)) + else if (_action.isAction(VERB_LOOK, NOUN_PHONE_ANTENNA)) _vm->_dialogs->show(61022); - else if (_action.isAction(VERB_LOOK, 0x42D)) + else if (_action.isAction(VERB_LOOK, NOUN_SMELLY_SNEAKER)) _vm->_dialogs->show(61023); - else if (_action.isAction(VERB_TAKE, 0x42D)) + else if (_action.isAction(VERB_TAKE, NOUN_SMELLY_SNEAKER)) _vm->_dialogs->show(61024); - else if (_action.isAction(VERB_LOOK, 0x431)) + else if (_action.isAction(VERB_LOOK, NOUN_SPOTLIGHT)) _vm->_dialogs->show(61025); - else if (_action.isAction(VERB_LOOK, 0x108) && (_action._mainObjectSource == 4)) + else if (_action.isAction(VERB_LOOK, NOUN_PHONE_HANDSET) && (_action._mainObjectSource == 4)) _vm->_dialogs->show(61026); - else if (_action.isAction(VERB_LOOK, 0x42F)) + else if (_action.isAction(VERB_LOOK, NOUN_PHONE_CRADLE)) _vm->_dialogs->show(61027); - else if (_action.isAction(VERB_LOOK, 0x42A)) + else if (_action.isAction(VERB_LOOK, NOUN_RETURN_SLOT)) _vm->_dialogs->show(61028); - else if (_action.isAction(VERB_PUT, 0x42A) + else if (_action.isAction(VERB_PUT, NOUN_RETURN_SLOT) && _game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId))) _vm->_dialogs->show(61029); else if ( _action.isAction(0x44F) || _action.isAction(0x444) || _action.isAction(0x430) @@ -4130,7 +4130,7 @@ void Scene611::step() { } void Scene611::preActions() { - if (_action.isAction(VERB_WALK_DOWN, 0x423)) + if (_action.isAction(VERB_WALK_DOWN, NOUN_ALLEY)) _game._player._walkOffScreenSceneId = 609; if (_resetBatterieText) @@ -4140,11 +4140,11 @@ void Scene611::preActions() { void Scene611::actions() { if (_game._screenObjects._inputMode == 1) handleDialog(); - else if ((_action.isAction(VERB_GIVE, 0x107, 0x45A)) || (_action.isAction(VERB_GIVE, 0x73, 0x45A))) { + else if ((_action.isAction(VERB_GIVE, NOUN_PHONE_CELLS, 0x45A)) || (_action.isAction(VERB_GIVE, NOUN_DURAFAIL_CELLS, 0x45A))) { _action._activeAction._verbId = 0x294; _giveBatteriesFl = true; handleSubDialog1(); - } else if (_action.isAction(VERB_GIVE, 0x45A)) { + } else if (_action.isAction(VERB_GIVE, NOUN_HERMIT)) { _scene->_kernelMessages.reset(); Common::String curQuote = _game.getQuote(0x323); @@ -4182,7 +4182,7 @@ void Scene611::actions() { _dialog2.start(); _duringDialogFl = true; } - } else if (_action.isAction(VERB_TALKTO, 0x45A)) { + } else if (_action.isAction(VERB_TALKTO, NOUN_HERMIT)) { if (!_dialog1.read(0x287)) { _scene->_kernelMessages.reset(); _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x27A)); @@ -4227,29 +4227,29 @@ void Scene611::actions() { _vm->_dialogs->show(61111); else _vm->_dialogs->show(61110); - } else if (_action.isAction(VERB_LOOK, 0x45A)) + } else if (_action.isAction(VERB_LOOK, NOUN_HERMIT)) _vm->_dialogs->show(61112); - else if (_action.isAction(VERB_LOOK, 0x25C)) + else if (_action.isAction(VERB_LOOK, NOUN_TRASH)) _vm->_dialogs->show(61113); - else if (_action.isAction(VERB_TAKE, 0x25C)) + else if (_action.isAction(VERB_TAKE, NOUN_TRASH)) _vm->_dialogs->show(61114); - else if (_action.isAction(VERB_LOOK, 0x49A)) + else if (_action.isAction(VERB_LOOK, NOUN_CARDBOARD_BOX)) _vm->_dialogs->show(61115); - else if (_action.isAction(VERB_TAKE, 0x49A)) + else if (_action.isAction(VERB_TAKE, NOUN_CARDBOARD_BOX)) _vm->_dialogs->show(61116); - else if (_action.isAction(VERB_OPEN, 0x49A)) + else if (_action.isAction(VERB_OPEN, NOUN_CARDBOARD_BOX)) _vm->_dialogs->show(61117); - else if (_action.isAction(VERB_LOOK, 0x122)) + else if (_action.isAction(VERB_LOOK, NOUN_REFRIGERATOR)) _vm->_dialogs->show(61118); - else if (_action.isAction(VERB_OPEN, 0x122)) + else if (_action.isAction(VERB_OPEN, NOUN_REFRIGERATOR)) _vm->_dialogs->show(61119); - else if (_action.isAction(VERB_TAKE, 0x122)) + else if (_action.isAction(VERB_TAKE, NOUN_REFRIGERATOR)) _vm->_dialogs->show(61120); - else if (_action.isAction(VERB_LOOK, 0x323)) + else if (_action.isAction(VERB_LOOK, NOUN_BUILDING)) _vm->_dialogs->show(61121); - else if (_action.isAction(VERB_LOOK, 0x49C)) + else if (_action.isAction(VERB_LOOK, NOUN_GRAFFITI)) _vm->_dialogs->show(61122); - else if (_action.isAction(VERB_LOOK, 0x45B)) + else if (_action.isAction(VERB_LOOK, NOUN_METAL_PIPE)) _vm->_dialogs->show(61123); else return; @@ -4428,37 +4428,37 @@ void Scene612::actions() { _cycleIndex = -2; action = 1; handleWinchMovement(); - } else if (_action._lookFlag || _action.isAction(VERB_LOOK, 0x466)) + } else if (_action._lookFlag || _action.isAction(VERB_LOOK, NOUN_EXPRESSWAY)) _vm->_dialogs->show(61210); - else if (_action.isAction(VERB_LOOK, 0x347) || _action.isAction(VERB_LOOK, 0x45E)) { + else if (_action.isAction(VERB_LOOK, NOUN_ROPE) || _action.isAction(VERB_LOOK, NOUN_ARMATURE)) { if (_globals[kBoatRaised]) _vm->_dialogs->show(61211); else _vm->_dialogs->show(61212); - } else if (_action.isAction(VERB_TAKE, 0x347)) + } else if (_action.isAction(VERB_TAKE, NOUN_ROPE)) _vm->_dialogs->show(61213); - else if (_action.isAction(VERB_LOOK, 0x45F)) { + else if (_action.isAction(VERB_LOOK, NOUN_CONTROL_BOX)) { if (_globals[kBoatRaised]) _vm->_dialogs->show(61214); else _vm->_dialogs->show(61216); - } else if (_action.isAction(VERB_OPEN, 0x45F)) + } else if (_action.isAction(VERB_OPEN, NOUN_CONTROL_BOX)) _vm->_dialogs->show(61215); - else if (_action.isAction(VERB_LOOK, 0x33D)) + else if (_action.isAction(VERB_LOOK, NOUN_BUILDINGS)) _vm->_dialogs->show(61218); - else if (_action.isAction(VERB_LOOK, 0x464)) + else if (_action.isAction(VERB_LOOK, NOUN_DOME)) _vm->_dialogs->show(61219); - else if (_action.isAction(VERB_LOOK, 0x2CD)) + else if (_action.isAction(VERB_LOOK, NOUN_STATUE)) _vm->_dialogs->show(61220); - else if (_action.isAction(VERB_LOOK, 0x4A2)) + else if (_action.isAction(VERB_LOOK, NOUN_MAINTENANCE_BUILDING)) _vm->_dialogs->show(61221); - else if (_action.isAction(VERB_OPEN, 0x4A2)) + else if (_action.isAction(VERB_OPEN, NOUN_MAINTENANCE_BUILDING)) _vm->_dialogs->show(61222); - else if (_action.isAction(VERB_LOOK, 0x18D)) + else if (_action.isAction(VERB_LOOK, NOUN_WALL)) _vm->_dialogs->show(61223); - else if (_action.isAction(VERB_LOOK, 0x257)) + else if (_action.isAction(VERB_LOOK, NOUN_SUPPORT)) _vm->_dialogs->show(61224); - else if (_action.isAction(VERB_WALK_DOWN, 0x461) || _action.isAction(VERB_WALK_DOWN, 0x463)) + else if (_action.isAction(VERB_WALK_DOWN, NOUN_EXPRESSWAY_TO_EAST) || _action.isAction(VERB_WALK_DOWN, NOUN_EXPRESSWAY_TO_WEST)) _vm->_dialogs->show(61225); else return; diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index 2d85b2e784..a4dd432f11 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -1010,57 +1010,57 @@ void Scene703::actions() { _curSequence = 4; else _curSequence = 1; - } else if (_action.isAction(VERB_THROW, 0x2C, 0x468) || _action.isAction(VERB_THROW, 0x2D, 0x468)) { + } else if (_action.isAction(VERB_THROW, NOUN_BONE, 0x468) || _action.isAction(VERB_THROW, NOUN_BONES, 0x468)) { _game._player._stepEnabled = false; _scene->freeAnimation(); _monsterMode = 2; _scene->loadAnimation(formAnimName('C', -1)); _scene->_activeAnimation->setCurrentFrame(19); - } else if (_action.isAction(VERB_THROW, 0x49, 0x468)) { + } else if (_action.isAction(VERB_THROW, NOUN_CHICKEN, 0x468)) { _game._player._stepEnabled = false; _scene->freeAnimation(); _monsterMode = 2; _scene->loadAnimation(formAnimName('C', -1)); - } else if (_action.isAction(VERB_THROW, 0x17A, 0x468)) { + } else if (_action.isAction(VERB_THROW, NOUN_TWINKIFRUIT, 0x468)) { _game._player._stepEnabled = false; _scene->freeAnimation(); _monsterMode = 2; _scene->loadAnimation(formAnimName('C', -1)); _scene->_activeAnimation->setCurrentFrame(39); - } else if (_action.isAction(VERB_THROW, 0x2A, 0x468)) { + } else if (_action.isAction(VERB_THROW, NOUN_BOMB, 0x468)) { _game._player._stepEnabled = false; _scene->freeAnimation(); _monsterMode = 2; _scene->loadAnimation(formAnimName('C', -1)); _scene->_activeAnimation->setCurrentFrame(59); - } else if (_action.isAction(VERB_THROW, 0x4A, 0x468)) { + } else if (_action.isAction(VERB_THROW, NOUN_CHICKEN_BOMB, 0x468)) { _useBomb = true; _game._player._stepEnabled = false; _scene->freeAnimation(); _monsterMode = 2; _scene->loadAnimation(formAnimName('C', -1)); - } else if (_action.isAction(VERB_PUT, 0x2E, 0x18F) || _action.isAction(0x85, 0x2E, 0x18F)) { + } else if (_action.isAction(VERB_PUT, NOUN_BOTTLE, 0x18F) || _action.isAction(0x85, 0x2E, 0x18F)) { if (_globals[kBottleStatus] != 4) { handleBottleInterface(); _dialog1.start(); } else _vm->_dialogs->show(70323); - } else if (_action._lookFlag || _action.isAction(VERB_LOOK, 0x468)) { + } else if (_action._lookFlag || _action.isAction(VERB_LOOK, NOUN_SEA_MONSTER)) { if (_globals[kMonsterAlive]) _vm->_dialogs->show(70310); - } else if (_action.isAction(VERB_LOOK, 0x18F)) { + } else if (_action.isAction(VERB_LOOK, NOUN_WATER)) { if (!_globals[kMonsterAlive]) _vm->_dialogs->show(70311); else _vm->_dialogs->show(70312); - } else if (_action.isAction(VERB_LOOK, 0x3B2)) { + } else if (_action.isAction(VERB_LOOK, NOUN_BUILDING_TO_NORTH)) { if (_globals[kMonsterAlive]) _vm->_dialogs->show(70313); else if (_game._visitedScenes.exists(710)) _vm->_dialogs->show(70314); else _vm->_dialogs->show(70315); - } else if (_action.isAction(VERB_LOOK, 0x3B3)) + } else if (_action.isAction(VERB_LOOK, NOUN_VOLCANO_RIM)) _vm->_dialogs->show(70316); else return; @@ -1367,7 +1367,7 @@ void Scene704::actions() { _animationMode = 4; else _animationMode = 1; - } else if (_action.isAction(VERB_TAKE, 0x2E)) { + } else if (_action.isAction(VERB_TAKE, NOUN_BOTTLE)) { if (!_game._objects.isInInventory(OBJ_BOTTLE)) { _game._player._stepEnabled = false; _takeBottleFl = true; @@ -1377,7 +1377,7 @@ void Scene704::actions() { _animationMode = 7; } } - } else if (_action.isAction(VERB_PUT, 0x2E, 0x18F) || _action.isAction(0x85, 0x2E, 0x18F)) { + } else if (_action.isAction(VERB_PUT, NOUN_BOTTLE, 0x18F) || _action.isAction(0x85, 0x2E, 0x18F)) { if (_game._objects.isInInventory(OBJ_BOTTLE)) { if (_globals[kBottleStatus] != 4) { _takeBottleFl = false; @@ -1386,20 +1386,20 @@ void Scene704::actions() { } else _vm->_dialogs->show(70323); } - } else if (_action._lookFlag || _action.isAction(VERB_LOOK, 0x18F)) + } else if (_action._lookFlag || _action.isAction(VERB_LOOK, NOUN_WATER)) _vm->_dialogs->show(70410); - else if (_action.isAction(VERB_LOOK, 0x3B2)) { + else if (_action.isAction(VERB_LOOK, NOUN_BUILDING_TO_NORTH)) { if (_game._visitedScenes.exists(710)) _vm->_dialogs->show(70411); else _vm->_dialogs->show(70412); - } else if (_action.isAction(VERB_LOOK, 0x3B3)) + } else if (_action.isAction(VERB_LOOK, NOUN_VOLCANO_RIM)) _vm->_dialogs->show(70413); - else if (_action.isAction(VERB_LOOK, 0x2E) && (_action._mainObjectSource == 4)) + else if (_action.isAction(VERB_LOOK, NOUN_BOTTLE) && (_action._mainObjectSource == 4)) _vm->_dialogs->show(70414); - else if (_action.isAction(VERB_LOOK, 0x3B4)) + else if (_action.isAction(VERB_LOOK, NOUN_OPEN_WATER_TO_SOUTH)) _vm->_dialogs->show(70416); - else if (_action.isAction(VERB_LOOK, 0x142)) + else if (_action.isAction(VERB_LOOK, NOUN_SKY)) _vm->_dialogs->show(70417); else return; @@ -1625,7 +1625,7 @@ void Scene705::actions() { default: break; } - } else if (_action.isAction(VERB_CLIMB_THROUGH, 0x197)) { + } else if (_action.isAction(VERB_CLIMB_THROUGH, NOUN_WINDOW)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -1647,23 +1647,23 @@ void Scene705::actions() { default: break; } - } else if (_action.isAction(0x85, 0x2E, 0x18F) || _action.isAction(VERB_PUT, 0x2E, 0x18F)) { + } else if (_action.isAction(0x85, 0x2E, 0x18F) || _action.isAction(VERB_PUT, NOUN_BOTTLE, 0x18F)) { if (_globals[kBottleStatus] != 4) { handleBottleInterface(); _dialog1.start(); } else _vm->_dialogs->show(70323); - } if (_action._lookFlag || _action.isAction(VERB_LOOK, 0x18F)) + } if (_action._lookFlag || _action.isAction(VERB_LOOK, NOUN_WATER)) _vm->_dialogs->show(70511); - else if (_action.isAction(VERB_LOOK, 0x3B3)) + else if (_action.isAction(VERB_LOOK, NOUN_VOLCANO_RIM)) _vm->_dialogs->show(70512); - else if (_action.isAction(VERB_LOOK, 0x3B4)) + else if (_action.isAction(VERB_LOOK, NOUN_OPEN_WATER_TO_SOUTH)) _vm->_dialogs->show(70513); - else if (_action.isAction(VERB_LOOK, 0x142)) + else if (_action.isAction(VERB_LOOK, NOUN_SKY)) _vm->_dialogs->show(70514); - else if (_action.isAction(VERB_LOOK, 0x323)) + else if (_action.isAction(VERB_LOOK, NOUN_BUILDING)) _vm->_dialogs->show(70515); - else if (_action.isAction(VERB_LOOK, 0x197)) + else if (_action.isAction(VERB_LOOK, NOUN_WINDOW)) _vm->_dialogs->show(70516); else return; @@ -1845,12 +1845,12 @@ void Scene706::step() { } void Scene706::preActions() { - if (_action.isAction(VERB_LOOK, 0x46E)) + if (_action.isAction(VERB_LOOK, NOUN_PORTRAIT)) _game._player._needToWalk = true; } void Scene706::actions() { - if (_action.isAction(VERB_WALK_INSIDE, 0x16C)) { + if (_action.isAction(VERB_WALK_INSIDE, NOUN_TELEPORTER)) { _game._player._stepEnabled = false; _game._player._visible = false; _scene->_nextSceneId = 707; @@ -1858,13 +1858,13 @@ void Scene706::actions() { return; } - if (_action.isAction(VERB_EXIT, 0x2FA)) { + if (_action.isAction(VERB_EXIT, NOUN_ROOM)) { _scene->_nextSceneId = 705; _action._inProgress = false; return; } - if (_action.isAction(VERB_TAKE, 0x17D)) { + if (_action.isAction(VERB_TAKE, NOUN_VASE)) { if (_game._difficulty != DIFFICULTY_EASY) { _animationMode = 1; handleRexDeath(); @@ -1876,7 +1876,7 @@ void Scene706::actions() { return; } - if (_action.isAction(VERB_PUT, 0x2E, 0x344)) { + if (_action.isAction(VERB_PUT, NOUN_BOTTLE, 0x344)) { if ((_globals[kBottleStatus] == 2 && _game._difficulty == DIFFICULTY_HARD) || (_globals[kBottleStatus] != 0 && _game._difficulty != DIFFICULTY_HARD)) { if (!_game._objects.isInInventory(OBJ_VASE) || _game._trigger) { @@ -1893,47 +1893,47 @@ void Scene706::actions() { } } - if (_action.isAction(VERB_PUT, 0x344) && _game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId))) { + if (_action.isAction(VERB_PUT, NOUN_PEDESTAL) && _game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId))) { int objectId = _game._objects.getIdFromDesc(_action._activeAction._objectNameId); if (_game._objects[objectId].hasQuality(10)) _vm->_dialogs->show(70626); else _vm->_dialogs->show(70627); - } else if (_action.isAction(VERB_TAKE, 0x2E) && _game._objects.isInInventory(OBJ_VASE)) + } else if (_action.isAction(VERB_TAKE, NOUN_BOTTLE) && _game._objects.isInInventory(OBJ_VASE)) _vm->_dialogs->show(70631); else if (_action._lookFlag) { if (_game._objects[OBJ_VASE]._roomNumber == _scene->_currentSceneId) _vm->_dialogs->show(70610); else _vm->_dialogs->show(70611); - } else if (_action.isAction(VERB_LOOK, 0x89)) + } else if (_action.isAction(VERB_LOOK, NOUN_FLOOR)) _vm->_dialogs->show(70612); - else if (_action.isAction(VERB_LOOK, 0x32B)) + else if (_action.isAction(VERB_LOOK, NOUN_PILLAR)) _vm->_dialogs->show(70613); - else if (_action.isAction(VERB_LOOK, 0x46B)) + else if (_action.isAction(VERB_LOOK, NOUN_OLD_TEA_CUP)) _vm->_dialogs->show(70614); - else if (_action.isAction(VERB_TAKE, 0x46B)) + else if (_action.isAction(VERB_TAKE, NOUN_OLD_TEA_CUP)) _vm->_dialogs->show(70615); - else if (_action.isAction(VERB_LOOK, 0x46D)) + else if (_action.isAction(VERB_LOOK, NOUN_OLD_VASE)) _vm->_dialogs->show(70616); - else if (_action.isAction(VERB_LOOK, 0x46E)) + else if (_action.isAction(VERB_LOOK, NOUN_PORTRAIT)) _vm->_dialogs->show(70617); - else if (_action.isAction(VERB_LOOK, 0x46C)) + else if (_action.isAction(VERB_LOOK, NOUN_NAME_PLATE)) _vm->_dialogs->show(70618); - else if (_action.isAction(VERB_LOOK, 0x18D)) + else if (_action.isAction(VERB_LOOK, NOUN_WALL)) _vm->_dialogs->show(70619); - else if (_action.isAction(VERB_LOOK, 0x344)) { + else if (_action.isAction(VERB_LOOK, NOUN_PEDESTAL)) { if (_game._objects[OBJ_VASE]._roomNumber == _scene->_currentSceneId) _vm->_dialogs->show(70620); else if (_game._objects[OBJ_BOTTLE]._roomNumber == _scene->_currentSceneId) _vm->_dialogs->show(70622); else _vm->_dialogs->show(70621); - } else if (_action.isAction(VERB_LOOK, 0x16C)) + } else if (_action.isAction(VERB_LOOK, NOUN_TELEPORTER)) _vm->_dialogs->show(70623); - else if (_action.isAction(VERB_LOOK, 0x17D) && (_game._objects[OBJ_VASE]._roomNumber == _scene->_currentSceneId)) + else if (_action.isAction(VERB_LOOK, NOUN_VASE) && (_game._objects[OBJ_VASE]._roomNumber == _scene->_currentSceneId)) _vm->_dialogs->show(70624); - else if (_action.isAction(VERB_LOOK, 0x2E) && (_action._mainObjectSource == 4)) + else if (_action.isAction(VERB_LOOK, NOUN_BOTTLE) && (_action._mainObjectSource == 4)) _vm->_dialogs->show(70632); else return; @@ -1970,21 +1970,21 @@ void Scene707::actions() { return; } - if (_action.isAction(VERB_LOOK, 0x181) || _action.isAction(VERB_PEER_THROUGH, 0x181)) + if (_action.isAction(VERB_LOOK, NOUN_VIEWPORT) || _action.isAction(VERB_PEER_THROUGH, NOUN_VIEWPORT)) _vm->_dialogs->show(70710); - else if (_action.isAction(VERB_LOOK, 0xC4)) + else if (_action.isAction(VERB_LOOK, NOUN_KEYPAD)) _vm->_dialogs->show(70711); - else if (_action.isAction(VERB_LOOK, 0x1CC)) + else if (_action.isAction(VERB_LOOK, NOUN_DISPLAY)) _vm->_dialogs->show(70712); - else if (_action.isAction(VERB_LOOK, 0x1D0) || _action.isAction(VERB_LOOK, 0x1D1) - || _action.isAction(VERB_LOOK, 0x1D2) || _action.isAction(VERB_LOOK, 0x1D3) - || _action.isAction(VERB_LOOK, 0x1D4) || _action.isAction(VERB_LOOK, 0x1D5) - || _action.isAction(VERB_LOOK, 0x1D6) || _action.isAction(VERB_LOOK, 0x1D7) - || _action.isAction(VERB_LOOK, 0x1D8) || _action.isAction(VERB_LOOK, 0x1D9) - || _action.isAction(VERB_LOOK, 0x1DB) || _action.isAction(VERB_LOOK, 0x7A) - || _action.isAction(VERB_LOOK, 0x1DA)) + else if (_action.isAction(VERB_LOOK, NOUN_0_KEY) || _action.isAction(VERB_LOOK, NOUN_1_KEY) + || _action.isAction(VERB_LOOK, NOUN_2_KEY) || _action.isAction(VERB_LOOK, NOUN_3_KEY) + || _action.isAction(VERB_LOOK, NOUN_4_KEY) || _action.isAction(VERB_LOOK, NOUN_5_KEY) + || _action.isAction(VERB_LOOK, NOUN_6_KEY) || _action.isAction(VERB_LOOK, NOUN_7_KEY) + || _action.isAction(VERB_LOOK, NOUN_8_KEY) || _action.isAction(VERB_LOOK, NOUN_9_KEY) + || _action.isAction(VERB_LOOK, NOUN_SMILE_KEY) || _action.isAction(VERB_LOOK, NOUN_ENTER_KEY) + || _action.isAction(VERB_LOOK, NOUN_FROWN_KEY)) _vm->_dialogs->show(70713); - else if (_action.isAction(VERB_LOOK, 0x1CF) || _action._lookFlag) + else if (_action.isAction(VERB_LOOK, NOUN_DEVICE) || _action._lookFlag) _vm->_dialogs->show(70714); else return; @@ -2214,13 +2214,13 @@ void Scene751::step() { } void Scene751::preActions() { - if (_action.isAction(VERB_LOOK, 0x470)) + if (_action.isAction(VERB_LOOK, NOUN_TALL_BUILDING)) _game._player.walk(Common::Point(154, 129), FACING_NORTHEAST); - if (_action.isAction(VERB_LOOK, 0x27, 0x470)) + if (_action.isAction(VERB_LOOK, NOUN_BINOCULARS, 0x470)) _game._player.walk(Common::Point(154, 129), FACING_NORTH); - if (_action.isAction(VERB_WALKTO, 0x4AA)) + if (_action.isAction(VERB_WALKTO, NOUN_EAST_END_OF_PLATFORM)) _game._player._walkOffScreenSceneId = 752; if (!_rexHandingLine) @@ -2229,7 +2229,7 @@ void Scene751::preActions() { if (_action.isAction(VERB_LOOK) || _action.isAction(0x87) || _action.isAction(VERB_TALKTO)) _game._player._needToWalk = false; - if ((!_action.isAction(VERB_PUT, 0x87, 0x467) || !_action.isAction(0x170, 0x87, 0x467) || !_action.isAction(0x19, 0x87, 0x467)) + if ((!_action.isAction(VERB_PUT, NOUN_FISHING_LINE, 0x467) || !_action.isAction(0x170, 0x87, 0x467) || !_action.isAction(0x19, 0x87, 0x467)) && (_game._player._needToWalk)) { switch (_game._trigger) { case 0: @@ -2256,9 +2256,9 @@ void Scene751::preActions() { } void Scene751::actions() { - if (_action.isAction(VERB_WALK_ALONG, 0x22C)) + if (_action.isAction(VERB_WALK_ALONG, NOUN_PLATFORM)) ; // Nothing - else if (_action.isAction(VERB_LOOK, 0x27, 0x470)) { + else if (_action.isAction(VERB_LOOK, NOUN_BINOCULARS, 0x470)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -2284,7 +2284,7 @@ void Scene751::actions() { default: break; } - } else if (_action.isAction(VERB_STEP_INTO, 0x317)) { + } else if (_action.isAction(VERB_STEP_INTO, NOUN_ELEVATOR)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -2326,7 +2326,7 @@ void Scene751::actions() { default: break; } - } else if (_action.isAction(VERB_PUT, 0x87, 0x467) || _action.isAction(0x170, 0x87, 0x467) || _action.isAction(0x19, 0x87, 0x467)) { + } else if (_action.isAction(VERB_PUT, NOUN_FISHING_LINE, 0x467) || _action.isAction(0x170, 0x87, 0x467) || _action.isAction(0x19, 0x87, 0x467)) { if (_globals[kLineStatus] == 1) { switch (_game._trigger) { case 0: @@ -2374,28 +2374,28 @@ void Scene751::actions() { break; } } - } else if (_action._lookFlag || _action.isAction(VERB_LOOK, 0x38F)) + } else if (_action._lookFlag || _action.isAction(VERB_LOOK, NOUN_CITY)) _vm->_dialogs->show(75110); - else if (_action.isAction(VERB_LOOK, 0x317)) + else if (_action.isAction(VERB_LOOK, NOUN_ELEVATOR)) _vm->_dialogs->show(75112); - else if (_action.isAction(VERB_LOOK, 0x22C)) + else if (_action.isAction(VERB_LOOK, NOUN_PLATFORM)) _vm->_dialogs->show(75113); - else if (_action.isAction(VERB_LOOK, 0x316)) + else if (_action.isAction(VERB_LOOK, NOUN_CEMENT_PYLON)) _vm->_dialogs->show(75114); - else if ((_action.isAction(VERB_LOOK, 0x467) || _action.isAction(VERB_LOOK, 0x87)) + else if ((_action.isAction(VERB_LOOK, NOUN_HOOK) || _action.isAction(VERB_LOOK, NOUN_FISHING_LINE)) && (_globals[kLineStatus] == 2 || _globals[kLineStatus] == 3)) _vm->_dialogs->show(75116); - else if (_action.isAction(VERB_LOOK, 0x467)) + else if (_action.isAction(VERB_LOOK, NOUN_HOOK)) _vm->_dialogs->show(75115); - else if (_action.isAction(VERB_LOOK, 0x128)) + else if (_action.isAction(VERB_LOOK, NOUN_ROCK)) _vm->_dialogs->show(75117); - else if (_action.isAction(VERB_TAKE, 0x128)) + else if (_action.isAction(VERB_TAKE, NOUN_ROCK)) _vm->_dialogs->show(75118); - else if (_action.isAction(VERB_LOOK, 0x4AA)) + else if (_action.isAction(VERB_LOOK, NOUN_EAST_END_OF_PLATFORM)) _vm->_dialogs->show(75119); - else if (_action.isAction(VERB_TAKE, 0x87) && (_globals[kLineStatus] == 3 || _globals[kLineStatus] == 2)) + else if (_action.isAction(VERB_TAKE, NOUN_FISHING_LINE) && (_globals[kLineStatus] == 3 || _globals[kLineStatus] == 2)) _vm->_dialogs->show(75121); - else if (_action.isAction(VERB_LOOK, 0x470)) + else if (_action.isAction(VERB_LOOK, NOUN_TALL_BUILDING)) _vm->_dialogs->show(75122); else if (_action.isAction(0x170, 0x87, 0x316) || _action.isAction(0x19, 0x87, 0x316)) _vm->_dialogs->show(75123); diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index 6ecde8ae3d..3604c8bde1 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -243,13 +243,13 @@ void Scene801::step() { } void Scene801::preActions() { - if (_action.isAction(VERB_LOOK, 0x59)) { + if (_action.isAction(VERB_LOOK, NOUN_CONTROL_PANEL)) { _game._player.walk(Common::Point(148, 110), FACING_NORTH); _game._player._needToWalk = true; _game._player._readyToWalk = true; } - if (_action.isAction(VERB_WALK_INSIDE, 0x16C) && _globals[kBeamIsUp]) { + if (_action.isAction(VERB_WALK_INSIDE, NOUN_TELEPORTER) && _globals[kBeamIsUp]) { _globals[kCutX] = _game._player._playerPos.x; _globals[kCutY] = _game._player._playerPos.y; _globals[kCutFacing] = _game._player._facing; @@ -260,13 +260,13 @@ void Scene801::preActions() { } void Scene801::actions() { - if (_action.isAction(VERB_LOOK, 0x59)) + if (_action.isAction(VERB_LOOK, NOUN_CONTROL_PANEL)) _scene->_nextSceneId = 808; - else if (_action.isAction(VERB_WALK_INSIDE, 0x16C)) { + else if (_action.isAction(VERB_WALK_INSIDE, NOUN_TELEPORTER)) { _game._player._stepEnabled = false; _game._player._visible = false; _scene->_nextSceneId = 807; - } else if (_action.isAction(VERB_WALK_THROUGH, 0x6E) && (_game._player._playerPos == Common::Point(270, 118))) { + } else if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOOR) && (_game._player._playerPos == Common::Point(270, 118))) { _game._player._stepEnabled = false; _game._player._facing = FACING_EAST; _game._player.selectSeries(); @@ -278,21 +278,21 @@ void Scene801::actions() { _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 5); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 13); _vm->_sound->command(11); - } else if (_action.isAction(VERB_LOOK, 0x46)) + } else if (_action.isAction(VERB_LOOK, NOUN_CEILING)) _vm->_dialogs->show(80110); - else if (_action.isAction(VERB_LOOK, 0xE2)) + else if (_action.isAction(VERB_LOOK, NOUN_MONITOR)) _vm->_dialogs->show(80111); - else if (_action.isAction(VERB_LOOK, 0x16C)) + else if (_action.isAction(VERB_LOOK, NOUN_TELEPORTER)) _vm->_dialogs->show(80112); - else if (_action.isAction(VERB_LOOK, 0x2C7) || _action._lookFlag) + else if (_action.isAction(VERB_LOOK, NOUN_EQUIPMENT) || _action._lookFlag) _vm->_dialogs->show(80113); - else if (_action.isAction(VERB_LOOK, 0x390)) + else if (_action.isAction(VERB_LOOK, NOUN_SPEAKER)) _vm->_dialogs->show(80114); - else if (_action.isAction(VERB_LOOK, 0x391)) + else if (_action.isAction(VERB_LOOK, NOUN_EYE_CHART)) _vm->_dialogs->show(80115); - else if (_action.isAction(VERB_LOOK, 0x18D)) + else if (_action.isAction(VERB_LOOK, NOUN_WALL)) _vm->_dialogs->show(80116); - else if (_action.isAction(VERB_LOOK, 0x6E)) + else if (_action.isAction(VERB_LOOK, NOUN_DOOR)) _vm->_dialogs->show(80117); else return; @@ -391,20 +391,20 @@ void Scene802::step() { } void Scene802::preActions() { - if (_action.isAction(VERB_WALK_TOWARDS, 0x393)) + if (_action.isAction(VERB_WALK_TOWARDS, NOUN_BUILDING_TO_WEST)) _game._player._walkOffScreenSceneId = 801; - if (_action.isAction(VERB_WALK_DOWN, 0x1C1)) { + if (_action.isAction(VERB_WALK_DOWN, NOUN_PATH_TO_EAST)) { _game._player._walkOffScreenSceneId = 803; _globals[kForceBeamDown] = false; } - if (_action.isAction(VERB_TAKE, 0x139)) + if (_action.isAction(VERB_TAKE, NOUN_SHIP)) _game._player._needToWalk = false; } void Scene802::actions() { - if (_action.isAction(VERB_TAKE, 0x137) && !_game._objects.isInInventory(OBJ_SHIELD_MODULATOR)) { + if (_action.isAction(VERB_TAKE, NOUN_SHIELD_MODULATOR) && !_game._objects.isInInventory(OBJ_SHIELD_MODULATOR)) { switch (_game._trigger) { case (0): _game._player._stepEnabled = false; @@ -436,7 +436,7 @@ void Scene802::actions() { default: break; } - } else if ((_action.isAction(VERB_TAKE, 0x123)) && (!_game._objects.isInInventory(OBJ_REMOTE))) { + } else if ((_action.isAction(VERB_TAKE, NOUN_REMOTE)) && (!_game._objects.isInInventory(OBJ_REMOTE))) { switch (_game._trigger) { case (0): _game._player._stepEnabled = false; @@ -470,37 +470,37 @@ void Scene802::actions() { break; } } else if (!_globals[kRemoteOnGround] && (_game._objects.isInInventory(OBJ_SHIELD_MODULATOR) || _globals[kShieldModInstalled]) - && (_action.isAction(VERB_LOOK, 0x392) || _action._lookFlag)) + && (_action.isAction(VERB_LOOK, NOUN_LAUNCH_PAD) || _action._lookFlag)) _vm->_dialogs->show(80210); else if (!_globals[kRemoteOnGround]&& !_game._objects.isInInventory(OBJ_SHIELD_MODULATOR) && !_globals[kShieldModInstalled] - && (_action.isAction(VERB_LOOK, 0x392) || _action._lookFlag)) + && (_action.isAction(VERB_LOOK, NOUN_LAUNCH_PAD) || _action._lookFlag)) _vm->_dialogs->show(80211); else if (_globals[kRemoteOnGround] && !_game._objects.isInInventory(OBJ_SHIELD_MODULATOR) && !_globals[kShieldModInstalled] - && (_action.isAction(VERB_LOOK, 0x392) || _action._lookFlag)) + && (_action.isAction(VERB_LOOK, NOUN_LAUNCH_PAD) || _action._lookFlag)) _vm->_dialogs->show(80213); else if (_globals[kRemoteOnGround] && (_game._objects.isInInventory(OBJ_SHIELD_MODULATOR) || _globals[kShieldModInstalled]) - && (_action.isAction(VERB_LOOK, 0x392) || _action._lookFlag)) + && (_action.isAction(VERB_LOOK, NOUN_LAUNCH_PAD) || _action._lookFlag)) _vm->_dialogs->show(80212); - else if (!_game._objects.isInInventory(OBJ_SHIELD_MODULATOR) && !_globals[kShieldModInstalled] && _action.isAction(VERB_LOOK, 0x137)) + else if (!_game._objects.isInInventory(OBJ_SHIELD_MODULATOR) && !_globals[kShieldModInstalled] && _action.isAction(VERB_LOOK, NOUN_SHIELD_MODULATOR)) _vm->_dialogs->show(80214); - else if (_globals[kRemoteOnGround] && _action.isAction(VERB_LOOK, 0x123)) + else if (_globals[kRemoteOnGround] && _action.isAction(VERB_LOOK, NOUN_REMOTE)) _vm->_dialogs->show(80216); - else if (_action.isAction(VERB_LOOK, 0x139)) { + else if (_action.isAction(VERB_LOOK, NOUN_SHIP)) { if ((!_game._objects.isInInventory(OBJ_SHIELD_MODULATOR)) && (!_globals[kShieldModInstalled])) _vm->_dialogs->show(80218); else _vm->_dialogs->show(80217); - } else if (_action.isAction(VERB_LOOK, 0x39)) + } else if (_action.isAction(VERB_LOOK, NOUN_BUSHES)) _vm->_dialogs->show(80219); - else if (_action.isAction(VERB_LOOK, 0x1C1)) + else if (_action.isAction(VERB_LOOK, NOUN_PATH_TO_EAST)) _vm->_dialogs->show(80220); - else if (_action.isAction(VERB_LOOK, 0x142)) + else if (_action.isAction(VERB_LOOK, NOUN_SKY)) _vm->_dialogs->show(80221); - else if (_action.isAction(VERB_TAKE, 0x139)) + else if (_action.isAction(VERB_TAKE, NOUN_SHIP)) _vm->_dialogs->show(80222); - else if (_action.isAction(VERB_LOOK, 0x174) || _action.isAction(VERB_LOOK, 0x175)) + else if (_action.isAction(VERB_LOOK, NOUN_TREE) || _action.isAction(VERB_LOOK, NOUN_TREES)) _vm->_dialogs->show(80224); - else if (_action.isAction(VERB_LOOK, 0x393)) + else if (_action.isAction(VERB_LOOK, NOUN_BUILDING_TO_WEST)) _vm->_dialogs->show(80225); else return; @@ -731,15 +731,15 @@ void Scene803::step() { } void Scene803::preActions() { - if (_action.isAction(VERB_WALK_DOWN, 0x1AE)) + if (_action.isAction(VERB_WALK_DOWN, NOUN_PATH_TO_WEST)) _game._player._walkOffScreenSceneId = 802; - if (_action.isAction(VERB_TAKE, 0x139)) + if (_action.isAction(VERB_TAKE, NOUN_SHIP)) _game._player._needToWalk = false; } void Scene803::actions() { - if (_action.isAction(VERB_TAKE, 0x472)) { + if (_action.isAction(VERB_TAKE, NOUN_GUTS)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -783,7 +783,7 @@ void Scene803::actions() { default: break; } - } else if (_action.isAction(VERB_ENTER, 0x139)) { + } else if (_action.isAction(VERB_ENTER, NOUN_SHIP)) { _vm->_sound->command(17); _game._player._stepEnabled = false; _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; @@ -792,28 +792,28 @@ void Scene803::actions() { _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 4); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_EXPIRE, 0, 120); _globals[kBeamIsUp] = false; - } else if (_action.isAction(VERB_LOOK, 0x392)) + } else if (_action.isAction(VERB_LOOK, NOUN_LAUNCH_PAD)) _vm->_dialogs->show(80310); else if (_action._lookFlag) _vm->_dialogs->show(80310); - else if (_action.isAction(VERB_LOOK, 0x395)) + else if (_action.isAction(VERB_LOOK, NOUN_PAD_TO_WEST)) _vm->_dialogs->show(80311); - else if (_action.isAction(VERB_LOOK, 0x472)) { + else if (_action.isAction(VERB_LOOK, NOUN_GUTS)) { if (_game._storyMode == STORYMODE_NICE) _vm->_dialogs->show(80312); else _vm->_dialogs->show(80313); - } else if (_action.isAction(VERB_LOOK, 0x39)) + } else if (_action.isAction(VERB_LOOK, NOUN_BUSHES)) _vm->_dialogs->show(80315); - else if (_action.isAction(VERB_LOOK, 0x139)) + else if (_action.isAction(VERB_LOOK, NOUN_SHIP)) _vm->_dialogs->show(80317); - else if (_action.isAction(VERB_LOOK, 0x396)) + else if (_action.isAction(VERB_LOOK, NOUN_TOWER)) _vm->_dialogs->show(80318); - else if (_action.isAction(VERB_LOOK, 0x174) || _action.isAction(VERB_LOOK, 0x175)) + else if (_action.isAction(VERB_LOOK, NOUN_TREE) || _action.isAction(VERB_LOOK, NOUN_TREES)) _vm->_dialogs->show(80319); - else if (_action.isAction(VERB_LOOK, 0x142)) + else if (_action.isAction(VERB_LOOK, NOUN_SKY)) _vm->_dialogs->show(80320); - else if (_action.isAction(VERB_TAKE, 0x139)) + else if (_action.isAction(VERB_TAKE, NOUN_SHIP)) _vm->_dialogs->show(80321); else return; @@ -1132,39 +1132,39 @@ void Scene805::preActions() { } void Scene805::actions() { - if (_action.isAction(VERB_EXIT, 0x398)) + if (_action.isAction(VERB_EXIT, NOUN_SERVICE_PANEL)) _scene->_nextSceneId = 804; - else if (_action.isAction(VERB_INSTALL, 0x137) && _game._objects.isInInventory(OBJ_SHIELD_MODULATOR)) { + else if (_action.isAction(VERB_INSTALL, NOUN_SHIELD_MODULATOR) && _game._objects.isInInventory(OBJ_SHIELD_MODULATOR)) { _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 7, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], -1, -2); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 70); _game._player._stepEnabled = false; - } else if (_action.isAction(VERB_INSTALL, 0x167) && _game._objects.isInInventory(OBJ_TARGET_MODULE)) { + } else if (_action.isAction(VERB_INSTALL, NOUN_TARGET_MODULE) && _game._objects.isInInventory(OBJ_TARGET_MODULE)) { _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 7, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], -1, -2); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 80); _game._player._stepEnabled = false; - } else if (_action.isAction(VERB_REMOVE, 0x137) && _globals[kShieldModInstalled]) { + } else if (_action.isAction(VERB_REMOVE, NOUN_SHIELD_MODULATOR) && _globals[kShieldModInstalled]) { _scene->_sequences.remove(_globals._sequenceIndexes[1]); _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _globals._sequenceIndexes[1] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 7, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], -1, -2); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 71); _game._player._stepEnabled = false; - } else if (_action.isAction(VERB_REMOVE, 0x167) && _globals[kTargetModInstalled]) { + } else if (_action.isAction(VERB_REMOVE, NOUN_TARGET_MODULE) && _globals[kTargetModInstalled]) { _scene->_sequences.remove(_globals._sequenceIndexes[2]); _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 7, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], -1, -2); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 81); _game._player._stepEnabled = false; - } else if (_action.isAction(VERB_INSTALL, 0x137) && !_game._objects.isInInventory(OBJ_SHIELD_MODULATOR)) + } else if (_action.isAction(VERB_INSTALL, NOUN_SHIELD_MODULATOR) && !_game._objects.isInInventory(OBJ_SHIELD_MODULATOR)) _vm->_dialogs->show(80511); - else if (_action.isAction(VERB_INSTALL, 0x167) && !_game._objects.isInInventory(OBJ_TARGET_MODULE)) + else if (_action.isAction(VERB_INSTALL, NOUN_TARGET_MODULE) && !_game._objects.isInInventory(OBJ_TARGET_MODULE)) _vm->_dialogs->show(80510); - else if (_action.isAction(VERB_REMOVE, 0x475)) + else if (_action.isAction(VERB_REMOVE, NOUN_LIFE_SUPPORT_MODULE)) _vm->_dialogs->show(80512); else return; @@ -1205,22 +1205,22 @@ void Scene807::actions() { return; } - if (_action.isAction(VERB_LOOK, 0x181)) + if (_action.isAction(VERB_LOOK, NOUN_VIEWPORT)) _vm->_dialogs->show(80710); - else if (_action.isAction(VERB_PEER_THROUGH, 0x181)) + else if (_action.isAction(VERB_PEER_THROUGH, NOUN_VIEWPORT)) _vm->_dialogs->show(80710); - else if (_action.isAction(VERB_LOOK, 0xC4) && _action.isAction(VERB_INSPECT, 0xC4)) + else if (_action.isAction(VERB_LOOK, NOUN_KEYPAD) && _action.isAction(VERB_INSPECT, NOUN_KEYPAD)) _vm->_dialogs->show(80711); - else if (_action.isAction(VERB_LOOK, 0x1CC)) + else if (_action.isAction(VERB_LOOK, NOUN_DISPLAY)) _vm->_dialogs->show(80712); - else if (_action.isAction(VERB_LOOK, 0x1D1) || _action.isAction(VERB_LOOK, 0x1D2) - || _action.isAction(VERB_LOOK, 0x1D3) || _action.isAction(VERB_LOOK, 0x1D4) - || _action.isAction(VERB_LOOK, 0x1D5) || _action.isAction(VERB_LOOK, 0x1D6) - || _action.isAction(VERB_LOOK, 0x1D7) || _action.isAction(VERB_LOOK, 0x1D8) - || _action.isAction(VERB_LOOK, 0x1D9) || _action.isAction(VERB_LOOK, 0x1D0) - || _action.isAction(VERB_LOOK, 0x1DB) || _action.isAction(VERB_LOOK, 0x1DA)) + else if (_action.isAction(VERB_LOOK, NOUN_1_KEY) || _action.isAction(VERB_LOOK, NOUN_2_KEY) + || _action.isAction(VERB_LOOK, NOUN_3_KEY) || _action.isAction(VERB_LOOK, NOUN_4_KEY) + || _action.isAction(VERB_LOOK, NOUN_5_KEY) || _action.isAction(VERB_LOOK, NOUN_6_KEY) + || _action.isAction(VERB_LOOK, NOUN_7_KEY) || _action.isAction(VERB_LOOK, NOUN_8_KEY) + || _action.isAction(VERB_LOOK, NOUN_9_KEY) || _action.isAction(VERB_LOOK, NOUN_0_KEY) + || _action.isAction(VERB_LOOK, NOUN_SMILE_KEY) || _action.isAction(VERB_LOOK, NOUN_FROWN_KEY)) _vm->_dialogs->show(80713); - else if (_action.isAction(VERB_LOOK, 0x1CF) && _action._lookFlag) + else if (_action.isAction(VERB_LOOK, NOUN_DEVICE) && _action._lookFlag) _vm->_dialogs->show(80714); else return; @@ -1277,7 +1277,7 @@ void Scene808::enter() { } void Scene808::actions() { - if (_action.isAction(VERB_PRESS, 0x3BC)) { + if (_action.isAction(VERB_PRESS, NOUN_START_BUTTON_2)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -1313,7 +1313,7 @@ void Scene808::actions() { default: break; } - } else if (_action.isAction(VERB_PRESS, 0x3BE)) { + } else if (_action.isAction(VERB_PRESS, NOUN_TIMER_BUTTON_2)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -1343,7 +1343,7 @@ void Scene808::actions() { default: break; } - } else if (_action.isAction(VERB_PRESS, 0x3BD)) { + } else if (_action.isAction(VERB_PRESS, NOUN_REMOTE_BUTTON_2)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -1374,7 +1374,7 @@ void Scene808::actions() { default: break; } - } else if (_action.isAction(VERB_PRESS, 0x3BF)) { + } else if (_action.isAction(VERB_PRESS, NOUN_START_BUTTON_1)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -1391,7 +1391,7 @@ void Scene808::actions() { default: break; } - } else if (_action.isAction(VERB_PRESS, 0x3BB)) { + } else if (_action.isAction(VERB_PRESS, NOUN_REMOTE_BUTTON_1)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -1408,7 +1408,7 @@ void Scene808::actions() { default: break; } - } else if (_action.isAction(VERB_PRESS, 0x3BA)) { + } else if (_action.isAction(VERB_PRESS, NOUN_TIMER_BUTTON_1)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -1425,7 +1425,7 @@ void Scene808::actions() { default: break; } - } else if (_action.isAction(VERB_EXIT, 0x1E0)) { + } else if (_action.isAction(VERB_EXIT, NOUN_PANEL)) { _scene->_nextSceneId = 801; _globals[kBetweenRooms] = true; } else -- cgit v1.2.3 From 5a87fd42f06eae1f19671ea6e32b9f5bd6b1f60d Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 20 May 2014 07:31:56 +0300 Subject: MADS: Add more debugger commands for items --- engines/mads/debugger.cpp | 48 +++++++++++++++++++++++++++++++++++++++++++++++ engines/mads/debugger.h | 2 ++ 2 files changed, 50 insertions(+) diff --git a/engines/mads/debugger.cpp b/engines/mads/debugger.cpp index 8baafddc69..0b69ee81fb 100644 --- a/engines/mads/debugger.cpp +++ b/engines/mads/debugger.cpp @@ -41,6 +41,8 @@ Debugger::Debugger(MADSEngine *vm) : GUI::Debugger(), _vm(vm) { DCmd_Register("show_quote", WRAP_METHOD(Debugger, Cmd_ShowQuote)); DCmd_Register("show_vocab", WRAP_METHOD(Debugger, Cmd_ShowVocab)); DCmd_Register("dump_vocab", WRAP_METHOD(Debugger, Cmd_DumpVocab)); + DCmd_Register("show_item", WRAP_METHOD(Debugger, Cmd_ShowItem)); + DCmd_Register("dump_items", WRAP_METHOD(Debugger, Cmd_DumpItems)); DCmd_Register("item", WRAP_METHOD(Debugger, Cmd_Item)); } @@ -242,6 +244,52 @@ bool Debugger::Cmd_DumpVocab(int argc, const char **argv) { return true; } +bool Debugger::Cmd_ShowItem(int argc, const char **argv) { + InventoryObjects &objects = _vm->_game->_objects; + + if (argc != 2) { + for (uint32 i = 0; i < objects.size(); i++) { + Common::String desc = _vm->_game->_scene.getVocab(objects[i]._descId); + DebugPrintf("%03d: '%s'\n", i, desc.c_str()); + } + } else { + int vocabId = strToInt(argv[1]); + Common::String desc = _vm->_game->_scene.getVocab(objects[vocabId]._descId); + DebugPrintf("%03d: '%s'\n", vocabId, desc.c_str()); + } + + return true; +} + +bool Debugger::Cmd_DumpItems(int argc, const char **argv) { + InventoryObjects &objects = _vm->_game->_objects; + + Common::DumpFile outFile; + outFile.open("items.txt"); + + for (uint32 i = 0; i < objects.size(); i++) { + Common::String curId = Common::String::format("%d", i); + Common::String desc = _vm->_game->_scene.getVocab(objects[i]._descId); + desc.toUppercase(); + + for (uint j = 0; j < desc.size(); j++) { + if (desc[j] == ' ' || desc[j] == '-') + desc.setChar('_', j); + } + + Common::String cur = "\tOBJ_" + desc + " = " + curId + ",\n"; + + outFile.writeString(cur.c_str()); + } + + outFile.flush(); + outFile.close(); + + DebugPrintf("Game items dumped\n"); + + return true; +} + bool Debugger::Cmd_Item(int argc, const char **argv) { InventoryObjects &objects = _vm->_game->_objects; diff --git a/engines/mads/debugger.h b/engines/mads/debugger.h index 0c048f2368..9059f3fc39 100644 --- a/engines/mads/debugger.h +++ b/engines/mads/debugger.h @@ -45,6 +45,8 @@ protected: bool Cmd_ShowQuote(int argc, const char **argv); bool Cmd_ShowVocab(int argc, const char **argv); bool Cmd_DumpVocab(int argc, const char **argv); + bool Cmd_ShowItem(int argc, const char **argv); + bool Cmd_DumpItems(int argc, const char **argv); bool Cmd_Item(int argc, const char **argv); public: bool _showMousePos; -- cgit v1.2.3 From 4f4be954ed1a096540ec708b3b626ca1a0a3e53d Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 20 May 2014 07:32:39 +0300 Subject: MADS: Don't error out in the SoundManager in MADS v2 games --- engines/mads/sound.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/mads/sound.cpp b/engines/mads/sound.cpp index 64144bb3f0..bd99aed2f4 100644 --- a/engines/mads/sound.cpp +++ b/engines/mads/sound.cpp @@ -81,7 +81,9 @@ void SoundManager::init(int sectionNumber) { break; default: - error("Unknown game"); + warning("SoundManager: Unknown game"); + _driver = nullptr; + break; } } -- cgit v1.2.3 From 3aaf4e48c23a5ad90e341939823345d0f66c5192 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 20 May 2014 07:33:07 +0300 Subject: MADS: Add the inventory item names for Dragonsphere --- engines/mads/dragonsphere/game_dragonsphere.h | 53 ++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 2 deletions(-) diff --git a/engines/mads/dragonsphere/game_dragonsphere.h b/engines/mads/dragonsphere/game_dragonsphere.h index cd7ac577fc..c5d6c0dd70 100644 --- a/engines/mads/dragonsphere/game_dragonsphere.h +++ b/engines/mads/dragonsphere/game_dragonsphere.h @@ -35,8 +35,57 @@ namespace Dragonsphere { // TODO: Adapt for Dragonsphere's difficulty setting enum StoryMode { STORYMODE_NAUGHTY = 1, STORYMODE_NICE = 2 }; -enum InventoryObject { OBJ_NONE = -1 - // TODO +enum InventoryObject { + OBJ_NONE = -1, + OBJ_SIGNET_RING = 0, + OBJ_BIRD_FIGURINE = 1, + OBJ_BIRDCALL = 2, + OBJ_SHIELDSTONE = 3, + OBJ_SWORD = 4, + OBJ_GOBLET = 5, + OBJ_BONE = 6, + OBJ_FRUIT = 7, + OBJ_DOLL = 8, + OBJ_POLYSTONE = 9, + OBJ_RED_STONE = 10, + OBJ_YELLOW_STONE = 11, + OBJ_BLUE_STONE = 12, + OBJ_KEY_CROWN = 13, + OBJ_DATES = 14, + OBJ_STATUE = 15, + OBJ_FLIES = 16, + OBJ_SOUL_EGG = 17, + OBJ_MAGIC_BELT = 18, + OBJ_AMULET = 19, + OBJ_MUD = 20, + OBJ_FEATHERS = 21, + OBJ_TORCH = 22, + OBJ_FLASK = 23, + OBJ_FLASK_OF_ACID = 24, + OBJ_ROPE = 25, + OBJ_VORTEX_STONE = 26, + OBJ_DEAD_RAT = 27, + OBJ_MAP = 28, + OBJ_CRYSTAL_BALL = 29, + OBJ_BLACK_SPHERE = 30, + OBJ_SOPORIFIC = 31, + OBJ_SHIFTER_RING = 32, + OBJ_SPIRIT_BUNDLE = 33, + OBJ_PARTIAL_BUNDLE = 34, + OBJ_RATSICLE = 35, + OBJ_TENTACLE_PARTS = 36, + OBJ_TELEPORT_DOOR = 37, + OBJ_RARE_COIN = 38, + OBJ_CRYSTAL_FLOWER = 39, + OBJ_DIAMOND_DUST = 40, + OBJ_RUBY_RING = 41, + OBJ_GOLD_NUGGET = 42, + OBJ_MUSIC_BOX = 43, + OBJ_EMERALD = 44, + OBJ_PARCHMENT = 45, + OBJ_GAME = 46, + OBJ_GAME2 = 47, + OBJ_NEW_BUNDLE = 48 }; // HACK: A stub for now, remove from here once it's implemented properly -- cgit v1.2.3 From facbe1b177a4dc9cbf2ca26ff8c8f070aac5f066 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 20 May 2014 07:33:18 +0300 Subject: MADS: Add the inventory item names for Phantom --- engines/mads/phantom/game_phantom.h | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/engines/mads/phantom/game_phantom.h b/engines/mads/phantom/game_phantom.h index 3043e538a5..600c5842a6 100644 --- a/engines/mads/phantom/game_phantom.h +++ b/engines/mads/phantom/game_phantom.h @@ -35,8 +35,33 @@ namespace Phantom { // TODO: Adapt for Phantom's difficulty setting enum StoryMode { STORYMODE_NAUGHTY = 1, STORYMODE_NICE = 2 }; -enum InventoryObject { OBJ_NONE = -1 - // TODO +enum InventoryObject { + OBJ_NONE = -1, + OBJ_KEY = 0, + OBJ_LANTERN = 1, + OBJ_RED_FRAME = 2, + OBJ_SANDBAG = 3, + OBJ_YELLOW_FRAME = 4, + OBJ_FIRE_AXE = 5, + OBJ_SMALL_NOTE = 6, + OBJ_ROPE = 7, + OBJ_SWORD = 8, + OBJ_ENVELOPE = 9, + OBJ_TICKET = 10, + OBJ_PIECE_OF_PAPER = 11, + OBJ_PARCHMENT = 12, + OBJ_LETTER = 13, + OBJ_NOTICE = 14, + OBJ_BOOK = 15, + OBJ_CRUMPLED_NOTE = 16, + OBJ_BLUE_FRAME = 17, + OBJ_LARGE_NOTE = 18, + OBJ_GREEN_FRAME = 19, + OBJ_MUSIC_SCORE = 20, + OBJ_WEDDING_RING = 21, + OBJ_CABLE_HOOK = 22, + OBJ_ROPE_WITH_HOOK = 23, + OBJ_OAR = 24 }; // HACK: A stub for now, remove from here once it's implemented properly -- cgit v1.2.3 From 510ed39c5a56566e6c86bd3c936c6b1adb4df080 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 20 May 2014 08:10:04 +0300 Subject: FULLPIPE: Implement MovGraph::method34() --- engines/fullpipe/motion.cpp | 43 ++++++++++++++++++------------------------- engines/fullpipe/motion.h | 2 +- 2 files changed, 19 insertions(+), 26 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 21df1c3aae..be27b7cd67 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -612,14 +612,14 @@ int MovGraph::method2C(StaticANIObject *obj, int x, int y) { } MessageQueue *MovGraph::method34(StaticANIObject *ani, int xpos, int ypos, int fuzzyMatch, int staticsId) { -#if 0 if (!ani) { - if (_itemsCount < 1) + if (!_items.size()) return 0; - ani = _items->ani; + ani = _items[0]->ani; } - if (ABS(ani->_ox - x) < 50 && ABS(ani->_oy - y) < 50) + + if (ABS(ani->_ox - xpos) < 50 && ABS(ani->_oy - ypos) < 50) return 0; if (!ani->isIdle()) @@ -628,20 +628,18 @@ MessageQueue *MovGraph::method34(StaticANIObject *ani, int xpos, int ypos, int f if (ani->_flags & 0x100) return 0; - v10 = method28(ani, x, y, fuzzyMatch, (int *)&ani); + int count; + Common::Array *movitems = method28(ani, xpos, ypos, fuzzyMatch, &count); - if (!v10) + if (!movitems) return 0; - if (!ani->_movement) { - v20 = v10; - v33 = (int)ani; - } else { + if (ani->_movement) { Common::Point point; ani->calcStepLen(&point); - MessageQueue *mq = sub1(ani, ani->_ox - point.x, ani->_oy - point.y, ani->_movement->_staticsObj1->_staticsId, x, y, 0, fuzzyMatch); + MessageQueue *mq = sub1(ani, ani->_ox - point.x, ani->_oy - point.y, ani->_movement->_staticsObj1->_staticsId, xpos, ypos, 0, fuzzyMatch); if (!mq || !mq->getExCommandByIndex(0)) return 0; @@ -655,10 +653,10 @@ MessageQueue *MovGraph::method34(StaticANIObject *ani, int xpos, int ypos, int f ex = new ExCommand(ani->_id, 21, 0, 0, 0, 0, 1, 0, 0, 0); ex->_keyCode = ani->_okeyCode; ex->_field_3C = 1; - ex->msg._field_24 = 0; + ex->_field_24 = 0; mq->addExCommandToEnd(ex); - ex = new ExCommand(ani->_id, 51, 0, x, y, 0, 1, 0, 0, 0); + ex = new ExCommand(ani->_id, 51, 0, xpos, ypos, 0, 1, 0, 0, 0); ex->_keyCode = ani->_okeyCode; ex->_field_3C = 1; ex->_field_24 = 0; @@ -673,22 +671,17 @@ MessageQueue *MovGraph::method34(StaticANIObject *ani, int xpos, int ypos, int f return 0; } - StaticANIObject *ani2; + int count2; ani->setSomeDynamicPhaseIndex(ex->_field_14); - method28(ani, x, y, fuzzyMatch, ani2); + method28(ani, xpos, ypos, fuzzyMatch, &count2); - int idx = getItemIndexByStaticAni(ani2); - v33 = this->_items[idx].count; - v20 = this->_items[idx].movitems; + int idx = getItemIndexByStaticAni(ani); + count = _items[idx]->count; + movitems = _items[idx]->movitems; } - v32 = this->_callback1(ani, v20, v33); - return method50(ani, v32, mq); -#endif - warning("STUB: MovGraph::method34()"); - - return 0; + return method50(ani, _callback1(ani, movitems, count), staticsId); } int MovGraph::changeCallback() { @@ -825,7 +818,7 @@ MessageQueue *MovGraph::fillMGMinfo(StaticANIObject *ani, MovArr *movarr, int st return 0; } -int MovGraph::method50() { +MessageQueue *MovGraph::method50(StaticANIObject *ani, Common::Array *movarr, int staticsId) { warning("STUB: MovGraph::method50()"); return 0; diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index cfbca1d8a4..fc199e305b 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -368,7 +368,7 @@ public: virtual int method3C(StaticANIObject *ani, int flag); virtual bool method44(StaticANIObject *ani, int x, int y); virtual MessageQueue *doWalkTo(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId); - virtual int method50(); + virtual MessageQueue *method50(StaticANIObject *ani, Common::Array *movarr, int staticsId); double calcDistance(Common::Point *point, MovGraphLink *link, int fuzzyMatch); void calcNodeDistancesAndAngles(); -- cgit v1.2.3 From 9f31278d187d7f3e92fe596c64fcf8cf15292342 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 20 May 2014 08:14:27 +0300 Subject: FULLPIPE: Fix warnings --- engines/fullpipe/motion.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index be27b7cd67..0b1c159337 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -735,7 +735,7 @@ MessageQueue *MovGraph::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int Common::Array *goal = _callback1(subj, movitem, ss); int idx = getItemIndexByStaticAni(subj); - for (uint i = 0; i < _items[idx]->count; i++) { + for (int i = 0; i < _items[idx]->count; i++) { if (_items[idx]->movitems->operator[](i)->movarr == goal) { if (subj->_movement) { Common::Point point; @@ -777,7 +777,7 @@ MessageQueue *MovGraph::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int _items[idx]->movarr->clear(); - for (uint i = 0; i < (*_items[idx]->movitems->operator[](arridx)->movarr)[i]->_movStepCount; i++) { + for (int i = 0; i < (*_items[idx]->movitems->operator[](arridx)->movarr)[i]->_movStepCount; i++) { MovArr *m = new MovArr; *m = *(*_items[idx]->movitems->operator[](arridx)->movarr)[i]; -- cgit v1.2.3 From c1890cc739d94c4310ec8933b8fca3f43b8df294 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 20 May 2014 08:15:30 +0300 Subject: FULLPIPE: Fix warnings --- engines/fullpipe/scene.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp index 2a78454156..1247d9380e 100644 --- a/engines/fullpipe/scene.cpp +++ b/engines/fullpipe/scene.cpp @@ -139,12 +139,12 @@ Scene::~Scene() { // _faObjlist is not used - for (int i = 0; i < _messageQueueList.size(); i++) + for (uint i = 0; i < _messageQueueList.size(); i++) delete _messageQueueList[i]; _messageQueueList.clear(); - for (int i = 0; i < _staticANIObjectList1.size(); i++) + for (uint i = 0; i < _staticANIObjectList1.size(); i++) delete _staticANIObjectList1[i]; _staticANIObjectList1.clear(); @@ -287,7 +287,7 @@ void Scene::init() { if (_staticANIObjectList2.size() != _staticANIObjectList1.size()) { _staticANIObjectList2.clear(); - for (int i = 0; i < _staticANIObjectList1.size(); i++) + for (uint i = 0; i < _staticANIObjectList1.size(); i++) _staticANIObjectList2.push_back(_staticANIObjectList1[i]); } } @@ -353,7 +353,7 @@ void Scene::setPictureObjectsFlag4() { } void Scene::stopAllSounds() { - for (uint i = 0; i < _soundList->getCount(); i++) + for (int i = 0; i < _soundList->getCount(); i++) _soundList->getSoundByIndex(i)->stop(); } @@ -507,11 +507,11 @@ void Scene::draw() { objectList_sortByPriority(_staticANIObjectList2); - for (int i = 0; i < _staticANIObjectList2.size(); i++) + for (uint i = 0; i < _staticANIObjectList2.size(); i++) _staticANIObjectList2[i]->draw2(); int priority = -1; - for (int i = 0; i < _staticANIObjectList2.size(); i++) { + for (uint i = 0; i < _staticANIObjectList2.size(); i++) { drawContent(_staticANIObjectList2[i]->_priority, priority, false); _staticANIObjectList2[i]->draw(); @@ -642,7 +642,7 @@ int Scene::getPictureObjectIdAtPos(int x, int y) { void Scene::update(int counterdiff) { debug(6, "Scene::update(%d)", counterdiff); - for (int i = 0; i < _staticANIObjectList2.size(); i++) + for (uint i = 0; i < _staticANIObjectList2.size(); i++) _staticANIObjectList2[i]->update(counterdiff); } -- cgit v1.2.3 From 3aa9dc3947900799bf69d5918eb36cc5d855506f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 20 May 2014 07:20:31 +0200 Subject: MADS: Add synchronize in scene 501 --- engines/mads/nebular/nebular_scenes5.cpp | 9 +++++++++ engines/mads/nebular/nebular_scenes5.h | 1 + 2 files changed, 10 insertions(+) diff --git a/engines/mads/nebular/nebular_scenes5.cpp b/engines/mads/nebular/nebular_scenes5.cpp index 02dc90dbc3..b218784275 100644 --- a/engines/mads/nebular/nebular_scenes5.cpp +++ b/engines/mads/nebular/nebular_scenes5.cpp @@ -99,6 +99,15 @@ void Scene501::setup() { _scene->addActiveVocab(0x18B); } +void Scene501::synchronize(Common::Serializer &s) { + Scene5xx::synchronize(s); + + s.syncAsSint16LE(_mainSequenceId); + s.syncAsSint16LE(_mainSpriteId); + s.syncAsSint16LE(_doorHotspotid); + s.syncAsByte(_rexPunched); +} + void Scene501::handleSlotActions() { switch (_game._trigger) { case 0: diff --git a/engines/mads/nebular/nebular_scenes5.h b/engines/mads/nebular/nebular_scenes5.h index bc22a62132..c49532dc8c 100644 --- a/engines/mads/nebular/nebular_scenes5.h +++ b/engines/mads/nebular/nebular_scenes5.h @@ -61,6 +61,7 @@ private: public: Scene501(MADSEngine *vm) : Scene5xx(vm) {} + void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); -- cgit v1.2.3 From c548b70e914acee473bd1ec427cabddcc0258e7d Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 20 May 2014 12:31:10 +0300 Subject: MADS: Add more friendly names for nouns --- engines/mads/nebular/nebular_scenes1.cpp | 62 ++++++++++++------------ engines/mads/nebular/nebular_scenes2.cpp | 28 +++++------ engines/mads/nebular/nebular_scenes3.cpp | 46 +++++++++--------- engines/mads/nebular/nebular_scenes4.cpp | 54 ++++++++++----------- engines/mads/nebular/nebular_scenes5.cpp | 82 ++++++++++++++++---------------- engines/mads/nebular/nebular_scenes6.cpp | 72 ++++++++++++++-------------- engines/mads/nebular/nebular_scenes7.cpp | 18 +++---- engines/mads/nebular/nebular_scenes8.cpp | 16 +++---- 8 files changed, 189 insertions(+), 189 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 04c646f2cf..5187b78f53 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -160,7 +160,7 @@ void Scene101::enter() { _globals._sequenceIndexes[9] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 6, 0, 10, 4); _globals._sequenceIndexes[10] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[10], false, 6, 0, 32, 47); - _scene->_hotspots.activate(0x137, false); + _scene->_hotspots.activate(NOUN_SHIELD_MODULATOR, false); _panelOpened = false; // HACK: set the prior scene to 102 for now when the game starts, to avoid Rex's getting up animation @@ -180,7 +180,7 @@ void Scene101::enter() { _game._player._facing = FACING_NORTHEAST; _globals._sequenceIndexes[11] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[11], false, 3, 0, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[11], 17, 17); - _scene->_hotspots.activate(0x47, false); + _scene->_hotspots.activate(NOUN_CHAIR, false); _chairHotspotId = _scene->_dynamicHotspots.add(0x47, 0x13F, -1, Common::Rect(159, 84, 159 + 33, 84 + 36)); if (_scene->_priorSceneId == 112) sayDang(); @@ -317,7 +317,7 @@ void Scene101::preActions() { case 1: _game._player._stepEnabled = true; _panelOpened = false; - _scene->_hotspots.activate(0x137, false); + _scene->_hotspots.activate(NOUN_SHIELD_MODULATOR, false); break; } } @@ -378,7 +378,7 @@ void Scene101::actions() { if (((_action.isAction(VERB_WALKTO, NOUN_SHIELD_ACCESS_PANEL) || _action.isAction(VERB_OPEN, NOUN_SHIELD_ACCESS_PANEL))) && !_panelOpened) { switch (_game._trigger) { case 0: - _shieldSpriteIdx = _game._objects.isInRoom(0x18) ? 13 : 14; + _shieldSpriteIdx = _game._objects.isInRoom(OBJ_SHIELD_MODULATOR) ? 13 : 14; _globals._sequenceIndexes[13] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[_shieldSpriteIdx], false, 6, 1, 0, 0); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SEQUENCE_TRIGGER_EXPIRE, 0, 1); _game._player._stepEnabled = false; @@ -391,8 +391,8 @@ void Scene101::actions() { _scene->_sequences.setAnimRange(_globals._sequenceIndexes[13], -2, -2); _game._player._stepEnabled = true; _panelOpened = true; - if (_game._objects.isInRoom(0x18)) - _scene->_hotspots.activate(0x137, true); + if (_game._objects.isInRoom(OBJ_SHIELD_MODULATOR)) + _scene->_hotspots.activate(NOUN_SHIELD_MODULATOR, true); break; } _action._inProgress = false; @@ -595,7 +595,7 @@ void Scene101::actions() { return; } - if ((_action.isAction(VERB_LOOK) || _action.isAction(VERB_PLAY)) && _action.isObject(0x17E)) { + if ((_action.isAction(VERB_LOOK) || _action.isAction(VERB_PLAY)) && _action.isObject(NOUN_VIDEO_GAME)) { _vm->_dialogs->show(10124); _action._inProgress = false; return; @@ -657,9 +657,9 @@ void Scene102::enter() { if (_game._objects.isInRoom(OBJ_BINOCULARS)) _globals._sequenceIndexes[9] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 24, 0, 0, 24); else - _scene->_hotspots.activate(0x27, false); + _scene->_hotspots.activate(NOUN_BINOCULARS, false); - _scene->_hotspots.activate(0x35, false); + _scene->_hotspots.activate(NOUN_BURGER, false); if (_globals[kMedicineCabinetOpen]) { _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 6, 0, 0); @@ -758,10 +758,10 @@ void Scene102::step() { } void Scene102::preActions() { - if (_action.isObject(0x122) || _action.isObject(0x117)) + if (_action.isObject(NOUN_REFRIGERATOR) || _action.isObject(NOUN_POSTER)) _game._player._needToWalk = _game._player._readyToWalk; - if (_fridgeOpenedFl && !_action.isObject(0x122)) { + if (_fridgeOpenedFl && !_action.isObject(NOUN_REFRIGERATOR)) { switch (_game._trigger) { case 0: if (_game._player._needToWalk) { @@ -777,7 +777,7 @@ void Scene102::preActions() { case 1: if (_game._objects.isInRoom(OBJ_BURGER)) { _scene->_sequences.remove(_globals._sequenceIndexes[10]); - _scene->_hotspots.activate(0x35, false); + _scene->_hotspots.activate(NOUN_BURGER, false); } _fridgeOpenedFl = false; _game._player._stepEnabled = true; @@ -833,7 +833,7 @@ void Scene102::actions() { _game._player._stepEnabled = true; justOpenedFl = true; if (_game._objects.isInRoom(OBJ_BURGER)) - _scene->_hotspots.activate(0x35, true); + _scene->_hotspots.activate(NOUN_BURGER, true); break; } } @@ -970,7 +970,7 @@ void Scene102::actions() { return; } - if ((_action.isObject(NOUN_LADDER) || _action.isObject(0xA3)) && (_action.isAction(VERB_LOOK) || _action.isAction(VERB_CLIMB_UP) || _action.isAction(VERB_CLIMB_THROUGH))) { + if ((_action.isObject(NOUN_LADDER) || _action.isObject(NOUN_HATCHWAY)) && (_action.isAction(VERB_LOOK) || _action.isAction(VERB_CLIMB_UP) || _action.isAction(VERB_CLIMB_THROUGH))) { if (_game._objects.isInInventory(OBJ_REBREATHER)) { if (!_action.isAction(VERB_CLIMB_UP) && !_action.isAction(VERB_CLIMB_THROUGH)) { _vm->_dialogs->show(10231); @@ -984,7 +984,7 @@ void Scene102::actions() { } } - if ((_action.isObject(NOUN_LADDER) || _action.isObject(0xA3)) && (_action.isAction(VERB_CLIMB_UP) || _action.isAction(VERB_CLIMB_THROUGH)) ) { + if ((_action.isObject(NOUN_LADDER) || _action.isObject(NOUN_HATCHWAY)) && (_action.isAction(VERB_CLIMB_UP) || _action.isAction(VERB_CLIMB_THROUGH)) ) { switch (_game._trigger) { case 0: _scene->loadAnimation(formAnimName('A', -1), 1); @@ -1146,7 +1146,7 @@ void Scene102::actions() { case 1: _game._objects.addToInventory(OBJ_BINOCULARS); _scene->_sequences.remove(_globals._sequenceIndexes[9]); - _scene->_hotspots.activate(0x27, false); + _scene->_hotspots.activate(NOUN_BINOCULARS, false); _game._player._visible = true; _game._player._stepEnabled = true; _vm->_sound->command(22); @@ -1162,7 +1162,7 @@ void Scene102::actions() { _vm->_dialogs->showItem(OBJ_BURGER, 10235); _scene->_sequences.remove(_globals._sequenceIndexes[10]); _game._objects.addToInventory(OBJ_BURGER); - _scene->_hotspots.activate(0x35, false); + _scene->_hotspots.activate(NOUN_BURGER, false); _vm->_sound->command(22); _game._player._visible = true; _game._player._stepEnabled = true; @@ -1177,7 +1177,7 @@ void Scene102::actions() { return; } - if ((_action.isAction(VERB_PUSH) || _action.isAction(VERB_PULL)) && _action.isObject(0x194)) { + if ((_action.isAction(VERB_PUSH) || _action.isAction(VERB_PULL)) && _action.isObject(NOUN_WEIGHT_MACHINE)) { _vm->_dialogs->show(10225); _action._inProgress = false; return; @@ -1849,7 +1849,7 @@ void Scene105::preActions() { if (_action.isAction(VERB_SWIM_TOWARDS, NOUN_OPEN_AREA_TO_SOUTH)) _game._player._walkOffScreenSceneId = 107; - if (_action.isObject(0xE0) && (_action.isAction(VERB_TALKTO) || _action.isAction(VERB_LOOK))) + if (_action.isObject(NOUN_MINE) && (_action.isAction(VERB_TALKTO) || _action.isAction(VERB_LOOK))) _game._player._needToWalk = false; } @@ -2085,7 +2085,7 @@ void Scene106::actions() { _vm->_dialogs->show(10605); else if (_action.isAction(VERB_LOOK, NOUN_PILE_OF_ROCKS) || _action.isAction(VERB_LOOK_AT, NOUN_PILE_OF_ROCKS)) _vm->_dialogs->show(10606); - else if (_action.isObject(0x109) && (_action.isAction(VERB_PUSH) || _action.isAction(VERB_PULL) || _action.isAction(VERB_TAKE))) + else if (_action.isObject(NOUN_PILE_OF_ROCKS) && (_action.isAction(VERB_PUSH) || _action.isAction(VERB_PULL) || _action.isAction(VERB_TAKE))) _vm->_dialogs->show(10607); else if (_action.isAction(VERB_LOOK, NOUN_SHIP) || _action.isAction(VERB_LOOK_AT, NOUN_SHIP)) _vm->_dialogs->show(10608); @@ -2119,7 +2119,7 @@ void Scene107::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(0xDA); + _scene->addActiveVocab(NOUN_MANTA_RAY); } void Scene107::enter() { @@ -2333,8 +2333,8 @@ Scene109::Scene109(MADSEngine *vm) : Scene1xx(vm) { } void Scene109::setup() { - _scene->addActiveVocab(0x66); - _scene->addActiveVocab(0xE5); + _scene->addActiveVocab(NOUN_DEAD_PURPLE_MONSTER); + _scene->addActiveVocab(NOUN_MONSTER_SLUDGE); setPlayerSpritesPrefix(); setAAName(); @@ -2489,8 +2489,8 @@ void Scene109::preActions() { _game._player._walkOffScreenSceneId = 108; if ((_action.isAction(VERB_THROW) || _action.isAction(VERB_GIVE) || _action.isAction(VERB_PUT)) - && (_action.isObject(0x146) || _action.isObject(0x178)) - && (_action.isObject(0x65) || _action.isObject(0x157) || _action.isObject(0x35))) { + && (_action.isObject(NOUN_SMALL_HOLE) || _action.isObject(NOUN_TUNNEL)) + && (_action.isObject(NOUN_DEAD_FISH) || _action.isObject(NOUN_STUFFED_FISH) || _action.isObject(NOUN_BURGER))) { int idx = _game._objects.getIdFromDesc(_action._activeAction._objectNameId); if ((idx >= 0) && _game._objects.isInInventory(idx)) { _game._player._prepareWalkPos = Common::Point(106, 38); @@ -2501,7 +2501,7 @@ void Scene109::preActions() { } if ((_action.isAction(VERB_SWIM_INTO, NOUN_TUNNEL) || _action.isAction(VERB_SWIM_TO, NOUN_SMALL_HOLE)) - && (!_globals[kHoovicAlive] || _globals[kHoovicSated]) && (_action.isObject(0x178))) + && (!_globals[kHoovicAlive] || _globals[kHoovicSated]) && (_action.isObject(NOUN_TUNNEL))) _game._player._walkOffScreenSceneId = 110; _hungryFl = false; @@ -2515,7 +2515,7 @@ void Scene109::actions() { } if ((_action.isAction(VERB_THROW) || _action.isAction(VERB_GIVE)) && (_action.isTarget(0x146) || _action.isTarget(0x178))) { - if (_action.isObject(0x65) || _action.isObject(0x157) || _action.isObject(0x35)) { + if (_action.isObject(NOUN_DEAD_FISH) || _action.isObject(NOUN_STUFFED_FISH) || _action.isObject(NOUN_BURGER)) { _throwingObjectId = _game._objects.getIdFromDesc(_action._activeAction._objectNameId); if (_throwingObjectId >= 0) { if ((_game._objects.isInInventory(_throwingObjectId) && _globals[kHoovicAlive]) || _rexThrowingObject) { @@ -2692,7 +2692,7 @@ void Scene109::actions() { _vm->_dialogs->show(10901); else if (_action.isAction(VERB_LOOK, NOUN_CORAL)) _vm->_dialogs->show(10902); - else if ((_action.isAction(VERB_TAKE) || _action.isAction(VERB_PULL)) && _action.isObject(0x5A)) + else if ((_action.isAction(VERB_TAKE) || _action.isAction(VERB_PULL)) && _action.isObject(NOUN_CORAL)) _vm->_dialogs->show(10903); else if (_action.isAction(VERB_LOOK, NOUN_ROCKS)) _vm->_dialogs->show(10904); @@ -2737,7 +2737,7 @@ void Scene110::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(0x5B); + _scene->addActiveVocab(NOUN_CRAB); } void Scene110::enter() { @@ -2861,7 +2861,7 @@ void Scene110::synchronize(Common::Serializer &s) { /*------------------------------------------------------------------------*/ void Scene111::setup() { - _scene->addActiveVocab(0x1F); + _scene->addActiveVocab(NOUN_BATS); setPlayerSpritesPrefix(); setAAName(); @@ -2992,7 +2992,7 @@ void Scene111::actions() { _vm->_dialogs->show(11104); else if (_action.isAction(VERB_LOOK, NOUN_LARGE_STALAGMITE)) _vm->_dialogs->show(11105); - else if ((_action.isAction(VERB_PULL) || _action.isAction(VERB_TAKE)) && (_action.isObject(0x153) || _action.isObject(0xC8))) + else if ((_action.isAction(VERB_PULL) || _action.isAction(VERB_TAKE)) && (_action.isObject(NOUN_STALAGMITES) || _action.isObject(NOUN_LARGE_STALAGMITE))) _vm->_dialogs->show(11106); else return; diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 173c641240..083b649a1a 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -1353,7 +1353,7 @@ void Scene205::actions() { } else if (_action.isAction(VERB_TAKE, NOUN_CHICKEN_ON_SPIT) && _globals[kChickenPermitted] && _game._objects.isInRoom(OBJ_CHICKEN)) { _game._objects.addToInventory(OBJ_CHICKEN); _scene->_sequences.remove(_globals._sequenceIndexes[4]); - _scene->_hotspots.activate(0x1C2, false); + _scene->_hotspots.activate(NOUN_CHICKEN_ON_SPIT, false); _vm->_dialogs->showItem(OBJ_CHICKEN, 812); } else if (_action.isAction(VERB_TAKE, NOUN_CHICKEN_ON_SPIT) && (!_globals[kChickenPermitted])) _scene->_kernelMessages.add(Common::Point(186, 27), 0xFBFA, 32, 0, 120, _game.getQuote(0x80)); @@ -1409,9 +1409,9 @@ void Scene205::synchronize(Common::Serializer &s) { void Scene207::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(0x185); + _scene->addActiveVocab(NOUN_VULTURE); _scene->addActiveVocab(VERB_WALKTO); - _scene->addActiveVocab(0x14D); + _scene->addActiveVocab(NOUN_SPIDER); _scene->addActiveVocab(VERB_WALKTO); } @@ -1896,7 +1896,7 @@ void Scene208::synchronize(Common::Serializer &s) { void Scene209::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(0x10F); + _scene->addActiveVocab(NOUN_PLANT_STALK); } void Scene209::handlePause() { @@ -3517,7 +3517,7 @@ void Scene209::synchronize(Common::Serializer &s) { void Scene210::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(0x70); + _scene->addActiveVocab(NOUN_DOORWAY); _scene->addActiveVocab(VERB_WALK_THROUGH); } @@ -4517,7 +4517,7 @@ void Scene211::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(0x144); + _scene->addActiveVocab(NOUN_SLITHERING_SNAKE); } void Scene211::enter() { @@ -4793,7 +4793,7 @@ void Scene212::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(0x19D); + _scene->addActiveVocab(NOUN_BOUNCING_REPTILE); } void Scene212::enter() { @@ -4822,7 +4822,7 @@ void Scene212::preActions() { void Scene212::actions() { if (_action._lookFlag) _vm->_dialogs->show(21209); - else if (_action.isAction(VERB_WALK_TOWARDS) && (_action.isObject(0x82) || _action.isObject(0xE8))) + else if (_action.isAction(VERB_WALK_TOWARDS) && (_action.isObject(NOUN_FIELD_TO_NORTH) || _action.isObject(NOUN_MOUNTAINS))) _scene->_nextSceneId = 208; else if (_action.isAction(VERB_WALK_TOWARDS, NOUN_CAVE)) _scene->_nextSceneId = 111; @@ -4916,8 +4916,8 @@ void Scene213::actions() { void Scene214::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(0x1C3); - _scene->addActiveVocab(0xD); + _scene->addActiveVocab(NOUN_CAPTIVE_CREATURE); + _scene->addActiveVocab(NOUN_WALK_TO); } void Scene214::enter() { @@ -4934,7 +4934,7 @@ void Scene214::enter() { _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(103, 86)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 11); } else { - _scene->_hotspots.activate(0x114, false); + _scene->_hotspots.activate(NOUN_POISON_DARTS, false); } if (_game._objects.isInRoom(OBJ_BLOWGUN)) { @@ -4942,7 +4942,7 @@ void Scene214::enter() { _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(90, 87)); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 13); } else { - _scene->_hotspots.activate(0x29, false); + _scene->_hotspots.activate(NOUN_BLOWGUN, false); } if (_scene->_priorSceneId != -2) @@ -5010,7 +5010,7 @@ void Scene214::actions() { _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 2); _scene->_sequences.remove(_globals._sequenceIndexes[1]); _game._objects.addToInventory(OBJ_POISON_DARTS); - _scene->_hotspots.activate(0x114, false); + _scene->_hotspots.activate(NOUN_POISON_DARTS, false); break; case 2: @@ -5039,7 +5039,7 @@ void Scene214::actions() { _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 2); _scene->_sequences.remove(_globals._sequenceIndexes[2]); _game._objects.addToInventory(OBJ_BLOWGUN); - _scene->_hotspots.activate(0x29, false); + _scene->_hotspots.activate(NOUN_BLOWGUN, false); break; case 2: diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 74bc582249..95fdd0031a 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -470,8 +470,8 @@ void Scene304::synchronize(Common::Serializer &s) { void Scene307::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(0x11); - _scene->addActiveVocab(0x2F7); + _scene->addActiveVocab(NOUN_AIR_VENT); + _scene->addActiveVocab(NOUN_CLIMB_INTO); } void Scene307::handleRexDialog(int quote) { @@ -2510,9 +2510,9 @@ void Scene318::enter() { _scene->loadAnimation(formAnimName('f', -1)); _scene->_activeAnimation->_resetFlag = true; } else if (!_globals[kHasSeenProfPyro]) { - _scene->_hotspots.activate(0x3A2, false); - _scene->_hotspots.activate(0x3A1, false); - _scene->_hotspots.activate(0x165, false); + _scene->_hotspots.activate(NOUN_PROFESSORS_GURNEY, false); + _scene->_hotspots.activate(NOUN_PROFESSOR, false); + _scene->_hotspots.activate(NOUN_TAPE_PLAYER, false); } if (_game._objects.isInRoom(OBJ_SCALPEL)) { @@ -2542,7 +2542,7 @@ void Scene318::enter() { } _lastFrame = 0; - _scene->_hotspots.activate(0x307, false); + _scene->_hotspots.activate(NOUN_INTERN, false); if (_scene->_priorSceneId != -2) { _dialogFl = false; @@ -2572,7 +2572,7 @@ void Scene318::enter() { _dialogFl = false; } else { _scene->loadAnimation(formAnimName('b', -1), 61); - _scene->_hotspots.activate(0x307, true); + _scene->_hotspots.activate(NOUN_INTERN, true); } if (_dialogFl) { @@ -2658,7 +2658,7 @@ void Scene318::step() { if (nextFrame == 184) { handleInternDialog(0x1D1, 3, 240); - _scene->_hotspots.activate(0x307, false); + _scene->_hotspots.activate(NOUN_INTERN, false); _internVisibleFl = false; } break; @@ -3642,10 +3642,10 @@ void Scene320::actions() { if (_action._lookFlag) _vm->_dialogs->show(32011); else if ((_action.isAction(VERB_PRESS) || _action.isAction(VERB_PUSH)) && - (_action.isObject(0x2E8) || _action.isObject(0x2E9) || _action.isObject(0x2EA) || _action.isObject(0x2EB) || - _action.isObject(0x2DE) || _action.isObject(0x2DD) || _action.isObject(0x2E0) || _action.isObject(0x2E1) || - _action.isObject(0x2E2) || _action.isObject(0x2E3) || _action.isObject(0x2E4) || _action.isObject(0x2E5) || - _action.isObject(0x2E6) || _action.isObject(0x2E7) + (_action.isObject(NOUN_LEFT_1_KEY) || _action.isObject(NOUN_LEFT_2_KEY) || _action.isObject(NOUN_LEFT_3_KEY) || _action.isObject(NOUN_LEFT_4_KEY) || + _action.isObject(NOUN_GREEN_BUTTON) || _action.isObject(NOUN_RED_BUTTON) || _action.isObject(NOUN_RIGHT_1_KEY) || _action.isObject(NOUN_RIGHT_2_KEY) || + _action.isObject(NOUN_RIGHT_3_KEY) || _action.isObject(NOUN_RIGHT_4_KEY) || _action.isObject(NOUN_RIGHT_5_KEY) || _action.isObject(NOUN_RIGHT_6_KEY) || + _action.isObject(NOUN_RIGHT_7_KEY) || _action.isObject(NOUN_RIGHT_8_KEY) )) { switch (_game._trigger) { case 0: @@ -3868,7 +3868,7 @@ void Scene351::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(0xD); + _scene->addActiveVocab(NOUN_WALK_TO); } void Scene351::enter() { @@ -3879,11 +3879,11 @@ void Scene351::enter() { _globals._spriteIndexes[2] = _scene->_sprites.addSprites("*ROXRC_7"); _globals._spriteIndexes[3] = _scene->_sprites.addSprites("*RXRD_7"); - if (_game._objects.isInRoom(0xF)) { + if (_game._objects.isInRoom(OBJ_CREDIT_CHIP)) { _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 6, 0, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 4); } else - _scene->_hotspots.activate(0x5C, false); + _scene->_hotspots.activate(NOUN_CREDIT_CHIP, false); if (_scene->_priorSceneId == 352) _game._player._playerPos = Common::Point(148, 152); @@ -3978,7 +3978,7 @@ void Scene351::actions() { break; case 1: - _scene->_hotspots.activate(0x5C, false); + _scene->_hotspots.activate(NOUN_CREDIT_CHIP, false); _scene->_sequences.remove(_globals._sequenceIndexes[1]); _game._objects.addToInventory(OBJ_CREDIT_CHIP); break; @@ -4027,10 +4027,10 @@ void Scene352::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(0xD); - _scene->addActiveVocab(0x2F4); - _scene->addActiveVocab(0x2F5); - _scene->addActiveVocab(0x2F6); + _scene->addActiveVocab(NOUN_WALK_TO); + _scene->addActiveVocab(NOUN_YOUR_STUFF); + _scene->addActiveVocab(NOUN_OTHER_STUFF); + _scene->addActiveVocab(NOUN_LAMP); } void Scene352::putArmDown(bool corridorExit, bool doorwayExit) { @@ -4815,7 +4815,7 @@ void Scene358::actions() { void Scene359::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(0xD); + _scene->addActiveVocab(NOUN_WALK_TO); } void Scene359::enter() { @@ -5464,7 +5464,7 @@ void Scene388::enter() { _scene->_userInterface.setup(kInputLimitedSentences); if (_globals[kAfterHavoc]) - _scene->_hotspots.activate(0x303, false); + _scene->_hotspots.activate(NOUN_SAUROPOD, false); else { _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('b', 0)); _globals._sequenceIndexes[0] = _scene->_sequences.startCycle(_globals._spriteIndexes[0], false, 1); @@ -5529,7 +5529,7 @@ void Scene389::enter() { _circularQuoteId = 0x159; if (_globals[kAfterHavoc]) - _scene->_hotspots.activate(0x304, false); + _scene->_hotspots.activate(NOUN_MONSTER, false); else { _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('m', -1)); _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 6, 0, 0, 0); diff --git a/engines/mads/nebular/nebular_scenes4.cpp b/engines/mads/nebular/nebular_scenes4.cpp index dd196b4059..5a68887b8d 100644 --- a/engines/mads/nebular/nebular_scenes4.cpp +++ b/engines/mads/nebular/nebular_scenes4.cpp @@ -235,15 +235,15 @@ void Scene402::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(0x30E); - _scene->addActiveVocab(0x306); - _scene->addActiveVocab(0x72); - _scene->addActiveVocab(0x27); - _scene->addActiveVocab(0xD); - _scene->addActiveVocab(0x5C); - _scene->addActiveVocab(0x4); - _scene->addActiveVocab(0x124); - _scene->addActiveVocab(0xD1); + _scene->addActiveVocab(NOUN_BARTENDER); + _scene->addActiveVocab(NOUN_ALIEN_LIQUOR); + _scene->addActiveVocab(NOUN_DRINK); + _scene->addActiveVocab(NOUN_BINOCULARS); + _scene->addActiveVocab(NOUN_WALK_TO); + _scene->addActiveVocab(NOUN_CREDIT_CHIP); + _scene->addActiveVocab(NOUN_TAKE); + _scene->addActiveVocab(NOUN_REPAIR_LIST); + _scene->addActiveVocab(NOUN_LOOK_AT); } void Scene402::synchronize(Common::Serializer &s) { @@ -2849,8 +2849,8 @@ void Scene407::synchronize(Common::Serializer &s) { void Scene408::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(0x167); - _scene->addActiveVocab(0xD); + _scene->addActiveVocab(NOUN_TARGET_MODULE); + _scene->addActiveVocab(NOUN_WALK_TO); } void Scene408::enter() { @@ -2873,7 +2873,7 @@ void Scene408::preActions() { if ((_action.isAction(VERB_TAKE) && !_action.isAction(0x167)) || _action.isAction(VERB_PULL, NOUN_PIN) || _action.isAction(VERB_OPEN, NOUN_CARTON)) _game._player._needToWalk = false; - if ((_action.isAction(VERB_LOOK, NOUN_TARGET_MODULE) && _game._objects.isInRoom(0x17)) || _action.isAction(VERB_LOOK, NOUN_CHEST)) + if ((_action.isAction(VERB_LOOK, NOUN_TARGET_MODULE) && _game._objects.isInRoom(OBJ_TARGET_MODULE)) || _action.isAction(VERB_LOOK, NOUN_CHEST)) _game._player._needToWalk = true; } @@ -3069,7 +3069,7 @@ void Scene410::enter() { if (_game._objects.isInRoom(OBJ_CHARGE_CASES)) _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); else - _scene->_hotspots.activate(0x48, false); + _scene->_hotspots.activate(NOUN_CHARGE_CASES, false); if (_scene->_priorSceneId != -2) { _game._player._playerPos = Common::Point(155, 150); @@ -3144,7 +3144,7 @@ void Scene410::actions() { case 1: _scene->_sequences.remove(_globals._sequenceIndexes[1]); - _scene->_hotspots.activate(0x48, false); + _scene->_hotspots.activate(NOUN_CHARGE_CASES, false); _game._objects.addToInventory(OBJ_CHARGE_CASES); _vm->_dialogs->showItem(OBJ_CHARGE_CASES, 41032); break; @@ -3464,11 +3464,11 @@ void Scene411::giveToRex(int object) { void Scene411::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(0xD); - _scene->addActiveVocab(0x306); - _scene->addActiveVocab(0x2D6); - _scene->addActiveVocab(0x2D7); - _scene->addActiveVocab(0x3A9); + _scene->addActiveVocab(NOUN_WALK_TO); + _scene->addActiveVocab(NOUN_ALIEN_LIQUOR); + _scene->addActiveVocab(NOUN_FORMALDEHYDE); + _scene->addActiveVocab(NOUN_PETROX); + _scene->addActiveVocab(NOUN_LECITHIN); } void Scene411::enter() { @@ -3507,11 +3507,11 @@ void Scene411::enter() { _dialog4.setup(0x5E, 0x255, 0x261, 0x25D, 0x259, 0x262, -1); if (_globals[kNextIngredient] >= 4 && _game._objects[OBJ_CHARGE_CASES].getQuality(3)) { - _scene->_hotspots.activate(0x3AB, false); - _scene->_hotspots.activate(0x30D, true); + _scene->_hotspots.activate(NOUN_EXPLOSIVES, false); + _scene->_hotspots.activate(NOUN_KETTLE, true); } else { - _scene->_hotspots.activate(0x30D, false); - _scene->_hotspots.activate(0x3AB, true); + _scene->_hotspots.activate(NOUN_KETTLE, false); + _scene->_hotspots.activate(NOUN_EXPLOSIVES, true); } if (_globals[kNextIngredient] >= 4 && _game._objects[OBJ_CHARGE_CASES].getQuality(3)) { @@ -3649,8 +3649,8 @@ void Scene411::step() { if (_makeMushroomCloud) { _globals._sequenceIndexes[9] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 5, 1, 0, 0); _makeMushroomCloud = false; - _scene->_hotspots.activate(0x3AB, false); - _scene->_hotspots.activate(0x30D, true); + _scene->_hotspots.activate(NOUN_EXPLOSIVES, false); + _scene->_hotspots.activate(NOUN_KETTLE, true); } break; @@ -3736,8 +3736,8 @@ void Scene411::actions() { break; case 111: - _scene->_hotspots.activate(0x30D, true); - _scene->_hotspots.activate(0x3AB, false); + _scene->_hotspots.activate(NOUN_KETTLE, true); + _scene->_hotspots.activate(NOUN_EXPLOSIVES, false); _scene->_sequences.remove(_globals._sequenceIndexes[4]); _scene->_sequences.remove(_globals._sequenceIndexes[10]); diff --git a/engines/mads/nebular/nebular_scenes5.cpp b/engines/mads/nebular/nebular_scenes5.cpp index b218784275..b55262c135 100644 --- a/engines/mads/nebular/nebular_scenes5.cpp +++ b/engines/mads/nebular/nebular_scenes5.cpp @@ -95,8 +95,8 @@ void Scene5xx::sceneEntrySound() { void Scene501::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(0x6E); - _scene->addActiveVocab(0x18B); + _scene->addActiveVocab(NOUN_DOOR); + _scene->addActiveVocab(NOUN_WALK_THROUGH); } void Scene501::synchronize(Common::Serializer &s) { @@ -283,7 +283,7 @@ void Scene501::step() { } void Scene501::preActions() { - if (_action.isAction(VERB_WALK_DOWN) && (_action.isObject(0x321) || _action.isObject(0x322))) + if (_action.isAction(VERB_WALK_DOWN) && (_action.isObject(NOUN_STREET_TO_EAST) || _action.isObject(NOUN_SIDEWALK_TO_EAST))) _game._player._walkOffScreenSceneId = 551; } @@ -526,8 +526,8 @@ void Scene502::actions() { void Scene503::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(0x6A); - _scene->addActiveVocab(0xD); + _scene->addActiveVocab(NOUN_DETONATORS); + _scene->addActiveVocab(NOUN_WALK_TO); } void Scene503::enter() { @@ -1099,9 +1099,9 @@ void Scene505::actions() { void Scene506::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(0x242); - _scene->addActiveVocab(0x336); - _scene->addActiveVocab(0x37D); + _scene->addActiveVocab(NOUN_WALK_INTO); + _scene->addActiveVocab(NOUN_SOFTWARE_STORE); + _scene->addActiveVocab(NOUN_LABORATORY); } void Scene506::enter() { @@ -1361,8 +1361,8 @@ void Scene506::actions() { void Scene507::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(0x106); - _scene->addActiveVocab(0xD); + _scene->addActiveVocab(NOUN_PENLIGHT); + _scene->addActiveVocab(NOUN_WALK_TO); } void Scene507::enter() { @@ -1472,9 +1472,9 @@ void Scene507::actions() { void Scene508::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(0x364); - _scene->addActiveVocab(0xD); - _scene->addActiveVocab(0x343); + _scene->addActiveVocab(NOUN_SPINACH_PATCH_DOLL); + _scene->addActiveVocab(NOUN_WALK_TO); + _scene->addActiveVocab(NOUN_LASER_BEAM); } void Scene508::enter() { @@ -1497,8 +1497,8 @@ void Scene508::enter() { _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, -2); int idx = _scene->_dynamicHotspots.add(0x343, VERB_WALKTO, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(57, 116), FACING_NORTHEAST); - _scene->_hotspots.activate(0x342, false); - _scene->_hotspots.activate(0x343, false); + _scene->_hotspots.activate(NOUN_HOLE, false); + _scene->_hotspots.activate(NOUN_LASER_BEAM, false); } else { _scene->changeVariant(1); _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -2); @@ -1512,8 +1512,8 @@ void Scene508::enter() { _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 6); if (_globals[kLaserHoleIsThere]) { _globals._sequenceIndexes[7] = _scene->_sequences.startCycle(_globals._spriteIndexes[7], false, -2); - _scene->_hotspots.activate(0x342, true); - _scene->_hotspots.activate(0x343, true); + _scene->_hotspots.activate(NOUN_HOLE, true); + _scene->_hotspots.activate(NOUN_LASER_BEAM, true); } _vm->_sound->command(21); } @@ -1572,8 +1572,8 @@ void Scene508::handlePedestral() { case 2: _globals._sequenceIndexes[7] = _scene->_sequences.startCycle(_globals._spriteIndexes[7], false, -2); - _scene->_hotspots.activate(0x342, true); - _scene->_hotspots.activate(0x343, true); + _scene->_hotspots.activate(NOUN_HOLE, true); + _scene->_hotspots.activate(NOUN_LASER_BEAM, true); break; case 3: @@ -1731,9 +1731,9 @@ void Scene508::actions() { void Scene511::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(0x345); - _scene->addActiveVocab(0x87); - _scene->addActiveVocab(0xD); + _scene->addActiveVocab(NOUN_BOAT); + _scene->addActiveVocab(NOUN_FISHING_LINE); + _scene->addActiveVocab(NOUN_WALK_TO); } void Scene511::enter() { @@ -1747,10 +1747,10 @@ void Scene511::enter() { _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('b', 0)); _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 3); - _scene->_hotspots.activate(0x345, false); + _scene->_hotspots.activate(NOUN_BOAT, false); int idx = _scene->_dynamicHotspots.add(0x345, VERB_WALKTO, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(75, 124), FACING_NORTH); - _scene->_hotspots.activate(0x347, false); + _scene->_hotspots.activate(NOUN_ROPE, false); } else { _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('b', 2)); _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('b', 3)); @@ -1765,8 +1765,8 @@ void Scene511::enter() { _globals._sequenceIndexes[6] = _scene->_sequences.startCycle(_globals._spriteIndexes[6], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[6],5); - _scene->_hotspots.activate(0x347, true); - _scene->_hotspots.activate(0x345, true); + _scene->_hotspots.activate(NOUN_ROPE, true); + _scene->_hotspots.activate(NOUN_BOAT, true); _scene->changeVariant(1); } @@ -2052,10 +2052,10 @@ void Scene511::actions() { void Scene512::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(0x88); - _scene->addActiveVocab(0xD); - _scene->addActiveVocab(0xFF); - _scene->addActiveVocab(0x366); + _scene->addActiveVocab(NOUN_FISHING_ROD); + _scene->addActiveVocab(NOUN_WALK_TO); + _scene->addActiveVocab(NOUN_PADLOCK_KEY); + _scene->addActiveVocab(NOUN_REGISTER_DRAWER); } void Scene512::enter() { @@ -2076,7 +2076,7 @@ void Scene512::enter() { if (!_game._visitedScenes._sceneRevisited) _globals[kRegisterOpen] = false; - _scene->_hotspots.activate(0xFF, false); + _scene->_hotspots.activate(NOUN_PADLOCK_KEY, false); if (_game._difficulty == DIFFICULTY_EASY) { if (_game._objects[OBJ_PADLOCK_KEY]._roomNumber == _scene->_currentSceneId) { _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 10, 0, 0, 0); @@ -2087,20 +2087,20 @@ void Scene512::enter() { if (_globals[kRegisterOpen]) { _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -2); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 3); - _scene->_hotspots.activate(0xFF, false); + _scene->_hotspots.activate(NOUN_PADLOCK_KEY, false); } } else if (_globals[kRegisterOpen]) { if (_game._objects[OBJ_PADLOCK_KEY]._roomNumber == _scene->_currentSceneId) { - _scene->_hotspots.activate(0xFF, true); + _scene->_hotspots.activate(NOUN_PADLOCK_KEY, true); _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, -2); _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 3); } else { - _scene->_hotspots.activate(0xFF, false); + _scene->_hotspots.activate(NOUN_PADLOCK_KEY, false); _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -2); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 3); } } else - _scene->_hotspots.activate(0xFF, false); + _scene->_hotspots.activate(NOUN_PADLOCK_KEY, false); if (_scene->_priorSceneId != -2) { _game._player._playerPos = Common::Point(144, 152); @@ -2190,7 +2190,7 @@ void Scene512::actions() { case 5: _globals._sequenceIndexes[5] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[5], false, 14, 0, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 3); - _scene->_hotspots.activate(0xFF, true); + _scene->_hotspots.activate(NOUN_PADLOCK_KEY, true); _scene->_sequences.addTimer(60, 6); break; @@ -2227,7 +2227,7 @@ void Scene512::actions() { _scene->_sequences.remove(_globals._sequenceIndexes[5]); _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 12, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 3); - _scene->_hotspots.activate(0xFF, false); + _scene->_hotspots.activate(NOUN_PADLOCK_KEY, false); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 2); } break; @@ -2268,7 +2268,7 @@ void Scene512::actions() { _scene->_sequences.remove(_globals._sequenceIndexes[5]); _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -2); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 3); - _scene->_hotspots.activate(0xFF, false); + _scene->_hotspots.activate(NOUN_PADLOCK_KEY, false); } _vm->_sound->command(9); _game._objects.addToInventory(OBJ_PADLOCK_KEY); @@ -2346,8 +2346,8 @@ void Scene512::actions() { void Scene513::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(0x367); - _scene->addActiveVocab(0xD); + _scene->addActiveVocab(NOUN_ELEVATOR_DOOR); + _scene->addActiveVocab(NOUN_WALK_TO); } void Scene513::enter() { @@ -2690,7 +2690,7 @@ void Scene551::step() { } void Scene551::preActions() { - if (_action.isAction(VERB_WALK_DOWN) && (_action.isObject(0x360) || _action.isObject(0x361))) + if (_action.isAction(VERB_WALK_DOWN) && (_action.isObject(NOUN_STREET_TO_WEST) || _action.isObject(NOUN_SIDEWALK_TO_WEST))) _game._player._walkOffScreenSceneId = 501; } diff --git a/engines/mads/nebular/nebular_scenes6.cpp b/engines/mads/nebular/nebular_scenes6.cpp index acadb820b4..6cea5cb63a 100644 --- a/engines/mads/nebular/nebular_scenes6.cpp +++ b/engines/mads/nebular/nebular_scenes6.cpp @@ -86,8 +86,8 @@ void Scene6xx::sceneEntrySound() { void Scene601::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(0x343); - _scene->addActiveVocab(0xD1); + _scene->addActiveVocab(NOUN_LASER_BEAM); + _scene->addActiveVocab(NOUN_LOOK_AT); } void Scene601::enter() { @@ -220,9 +220,9 @@ void Scene601::actions() { void Scene602::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(0xD); - _scene->addActiveVocab(0x3D3); - _scene->addActiveVocab(0x343); + _scene->addActiveVocab(NOUN_WALK_TO); + _scene->addActiveVocab(NOUN_SAFE); + _scene->addActiveVocab(NOUN_LASER_BEAM); } void Scene602::enter() { @@ -244,7 +244,7 @@ void Scene602::enter() { _scene->_dynamicHotspots.setPosition(idx, Common::Point(80, 134), FACING_NORTHEAST); _scene->changeVariant(1); } else - _scene->_hotspots.activate(0x342, false); + _scene->_hotspots.activate(NOUN_HOLE, false); if (_globals[kSafeStatus] == 0) { _lastSpriteIdx = _globals._spriteIndexes[2]; @@ -270,9 +270,9 @@ void Scene602::enter() { _globals._sequenceIndexes[6] = _scene->_sequences.startCycle(_globals._spriteIndexes[6], false, -1); _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 15); if (_globals[kSafeStatus] == 0 || _globals[kSafeStatus] == 2) - _scene->_hotspots.activate(0x6F, false); + _scene->_hotspots.activate(NOUN_DOOR_KEY, false); } else - _scene->_hotspots.activate(0x6F, false); + _scene->_hotspots.activate(NOUN_DOOR_KEY, false); if (_scene->_priorSceneId == 603) { _game._player._playerPos = Common::Point(228, 126); @@ -320,7 +320,7 @@ void Scene602::handleSafeActions() { _lastSequenceIdx = _scene->_sequences.addSpriteCycle(_lastSpriteIdx, false, 12, 1, 0, 0); _scene->_sequences.setDepth(_lastSequenceIdx, 14); if (_game._objects[OBJ_DOOR_KEY]._roomNumber == _scene->_currentSceneId) - _scene->_hotspots.activate(0x6F, true); + _scene->_hotspots.activate(NOUN_DOOR_KEY, true); _scene->_sequences.addSubEntry(_lastSequenceIdx, SEQUENCE_TRIGGER_EXPIRE, 0, 2); @@ -335,7 +335,7 @@ void Scene602::handleSafeActions() { _lastSequenceIdx = _scene->_sequences.startReverseCycle(_lastSpriteIdx, false, 12, 1, 0, 0); _scene->_sequences.setDepth(_lastSequenceIdx, 14); if (_game._objects[OBJ_DOOR_KEY]._roomNumber == _scene->_currentSceneId) - _scene->_hotspots.activate(0x6F, false); + _scene->_hotspots.activate(NOUN_DOOR_KEY, false); _scene->_sequences.addSubEntry(_lastSequenceIdx, SEQUENCE_TRIGGER_EXPIRE, 0, 2); } @@ -453,7 +453,7 @@ void Scene602::actions() { case 1: _scene->_sequences.remove(_globals._sequenceIndexes[6]); - _scene->_hotspots.activate(0x6F, false); + _scene->_hotspots.activate(NOUN_DOOR_KEY, false); _vm->_sound->command(9); _game._objects.addToInventory(OBJ_DOOR_KEY); break; @@ -533,9 +533,9 @@ void Scene602::actions() { void Scene603::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(0xD); - _scene->addActiveVocab(0x57); - _scene->addActiveVocab(0x3A8); + _scene->addActiveVocab(NOUN_WALK_TO); + _scene->addActiveVocab(NOUN_COMPACT_CASE); + _scene->addActiveVocab(NOUN_NOTE); } void Scene603::enter() { @@ -675,9 +675,9 @@ void Scene603::actions() { void Scene604::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(0x468); + _scene->addActiveVocab(NOUN_SEA_MONSTER); _scene->addActiveVocab(VERB_WALKTO); - _scene->addActiveVocab(0x171); + _scene->addActiveVocab(NOUN_TIMEBOMB); } void Scene604::enter() { @@ -988,7 +988,7 @@ void Scene605::actions() { void Scene607::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(0x471); + _scene->addActiveVocab(NOUN_OBNOXIOUS_DOG); _scene->addActiveVocab(VERB_WALKTO); } @@ -1017,7 +1017,7 @@ void Scene607::enter() { _dogEatsRex = false; _dogTimer = 0; } else - _scene->_hotspots.activate(0x471, false); + _scene->_hotspots.activate(NOUN_OBNOXIOUS_DOG, false); _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -2); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); @@ -1076,7 +1076,7 @@ void Scene607::step() { _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 6); _dogBarking = false; _globals[kDogStatus] = 1; - _scene->_hotspots.activate(0x471, true); + _scene->_hotspots.activate(NOUN_OBNOXIOUS_DOG, true); } if (!_dogEatsRex && (_game._difficulty != DIFFICULTY_EASY) && !_animationActive && (_globals[kDogStatus] == 1) @@ -1247,7 +1247,7 @@ void Scene607::handleThrowingBone() { _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; if (_animationMode != 1) - _scene->_hotspots.activate(0x471, false); + _scene->_hotspots.activate(NOUN_OBNOXIOUS_DOG, false); else { _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 6); @@ -1421,10 +1421,10 @@ void Scene607::actions() { void Scene608::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(0xD); - _scene->addActiveVocab(0x115); - _scene->addActiveVocab(0x324); - _scene->addActiveVocab(0x471); + _scene->addActiveVocab(NOUN_WALK_TO); + _scene->addActiveVocab(NOUN_POLYCEMENT); + _scene->addActiveVocab(NOUN_CAR); + _scene->addActiveVocab(NOUN_OBNOXIOUS_DOG); } void Scene608::resetDogVariables() { @@ -2438,7 +2438,7 @@ void Scene609::step() { break; case 61: - _scene->_hotspots.activate(0x425, false); + _scene->_hotspots.activate(NOUN_VIDEO_STORE_DOOR, false); _game._player.walk(Common::Point(101, 100), FACING_EAST); _scene->_sequences.addTimer(180, 62); break; @@ -2446,7 +2446,7 @@ void Scene609::step() { case 62: _scene->_sequences.remove( _globals._sequenceIndexes[2]); _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 7, 1, 0, 0); - _scene->_hotspots.activate(0x425, true); + _scene->_hotspots.activate(NOUN_VIDEO_STORE_DOOR, true); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 9); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 63); break; @@ -2550,7 +2550,7 @@ void Scene609::enterStore() { break; case 6: - _scene->_hotspots.activate(0x425, false); + _scene->_hotspots.activate(NOUN_VIDEO_STORE_DOOR, false); if (_videoDoorMode == 1) { _scene->_kernelMessages.reset(); _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 180, _game.getQuote(0x307)); @@ -2567,7 +2567,7 @@ void Scene609::enterStore() { break; case 8: - _scene->_hotspots.activate(0x425, true); + _scene->_hotspots.activate(NOUN_VIDEO_STORE_DOOR, true); _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 9); _globals[kBeenInVideoStore] = true; @@ -2704,8 +2704,8 @@ void Scene609::actions() { void Scene610::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(0x108); - _scene->addActiveVocab(0xD); + _scene->addActiveVocab(NOUN_PHONE_HANDSET); + _scene->addActiveVocab(NOUN_WALK_TO); } void Scene610::enter() { @@ -2887,8 +2887,8 @@ void Scene610::actions() { void Scene611::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(0x275); - _scene->addActiveVocab(0xD); + _scene->addActiveVocab(NOUN_RAT); + _scene->addActiveVocab(NOUN_WALK_TO); } void Scene611::handleRatMoves() { @@ -3756,7 +3756,7 @@ void Scene611::enter() { _stickFingerFl = false; } else { _hermitMode = 0; - _scene->_hotspots.activate(0x45A, false); + _scene->_hotspots.activate(NOUN_HERMIT, false); } // CHECKME: The last line of the block looks extremely useless @@ -4117,7 +4117,7 @@ void Scene611::step() { _startTradingFl = false; _nextFrame = 52; _globals[kHasTalkedToHermit] = true; - _scene->_hotspots.activate(0x45A, false); + _scene->_hotspots.activate(NOUN_HERMIT, false); } else { _game._player._stepEnabled = true; _hermitMode = 1; @@ -4262,8 +4262,8 @@ void Scene611::actions() { void Scene612::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(0x87); - _scene->addActiveVocab(0xD); + _scene->addActiveVocab(NOUN_FISHING_LINE); + _scene->addActiveVocab(NOUN_WALK_TO); } void Scene612::handleWinchMovement() { diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index a4dd432f11..c0755e83aa 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -646,7 +646,7 @@ void Scene703::enter() { _boatFrame = -1; if (!_globals[kMonsterAlive]) - _scene->_hotspots.activate(0x468, false); + _scene->_hotspots.activate(NOUN_SEA_MONSTER, false); if (_scene->_priorSceneId == 704) { _game._player._stepEnabled = false; @@ -960,7 +960,7 @@ void Scene703::step() { break; case 126: - _scene->_hotspots.activate(0x468, false); + _scene->_hotspots.activate(NOUN_SEA_MONSTER, false); _globals[kMonsterAlive] = false; _scene->freeAnimation(); _monsterMode = 0; @@ -1073,8 +1073,8 @@ void Scene703::actions() { void Scene704::setup() { _game._player._spritesPrefix = ""; setAAName(); - _scene->addActiveVocab(0x2E); - _scene->addActiveVocab(0xD1); + _scene->addActiveVocab(NOUN_BOTTLE); + _scene->addActiveVocab(NOUN_LOOK_AT); } void Scene704::handleBottleInterface() { @@ -1676,9 +1676,9 @@ void Scene705::actions() { void Scene706::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(0x2E); - _scene->addActiveVocab(0x17D); - _scene->addActiveVocab(0xD); + _scene->addActiveVocab(NOUN_BOTTLE); + _scene->addActiveVocab(NOUN_VASE); + _scene->addActiveVocab(NOUN_WALK_TO); } void Scene706::handleRexDeath() { @@ -2085,8 +2085,8 @@ void Scene711::actions() { void Scene751::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(0x87); - _scene->addActiveVocab(0xD); + _scene->addActiveVocab(NOUN_FISHING_LINE); + _scene->addActiveVocab(NOUN_WALK_TO); } void Scene751::enter() { diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index 3604c8bde1..9c53855878 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -305,9 +305,9 @@ void Scene801::actions() { void Scene802::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(0x137); - _scene->addActiveVocab(0xD); - _scene->addActiveVocab(0x123); + _scene->addActiveVocab(NOUN_SHIELD_MODULATOR); + _scene->addActiveVocab(NOUN_WALK_TO); + _scene->addActiveVocab(NOUN_REMOTE); } void Scene802::enter() { @@ -513,8 +513,8 @@ void Scene802::actions() { void Scene803::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(0x472); - _scene->addActiveVocab(0xD); + _scene->addActiveVocab(NOUN_GUTS); + _scene->addActiveVocab(NOUN_WALK_TO); if ((!_globals[kFromCockpit] && _globals[kReturnFromCut] && !_globals[kBeamIsUp]) || (_globals[kFromCockpit] && !_globals[kExitShip])) { @@ -1060,9 +1060,9 @@ void Scene804::step() { void Scene805::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(0x476); - _scene->addActiveVocab(0x167); - _scene->addActiveVocab(0x137); + _scene->addActiveVocab(NOUN_REMOVE); + _scene->addActiveVocab(NOUN_TARGET_MODULE); + _scene->addActiveVocab(NOUN_SHIELD_MODULATOR); } void Scene805::enter() { -- cgit v1.2.3 From e2a67595338edc7ae11257099fb8140599d2f471 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 20 May 2014 12:56:05 +0300 Subject: MADS: Fix a bug in scene 104 --- engines/mads/nebular/nebular_scenes1.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 5187b78f53..6492006d1e 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -1719,7 +1719,7 @@ void Scene104::preActions() { if (_action.isAction(VERB_SWIM_TOWARDS, NOUN_EASTERN_CLIFF_FACE)) _game._player._walkOffScreenSceneId = 105; - if (_action.isAction(VERB_SWIM_TOWARDS, NOUN_EAT)) + if (_action.isAction(VERB_SWIM_TOWARDS, NOUN_OPEN_AREA_TO_SOUTH)) _game._player._walkOffScreenSceneId = 106; } -- cgit v1.2.3 From 5aa63bc71a2e559fea6ce62e4b995a6ece47e495 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 20 May 2014 12:56:21 +0300 Subject: MADS: Rename several nouns to verbs --- engines/mads/nebular/nebular_scenes.h | 234 ++++++++++++++++--------------- engines/mads/nebular/nebular_scenes2.cpp | 2 +- engines/mads/nebular/nebular_scenes3.cpp | 6 +- engines/mads/nebular/nebular_scenes4.cpp | 12 +- engines/mads/nebular/nebular_scenes5.cpp | 16 +-- engines/mads/nebular/nebular_scenes6.cpp | 14 +- engines/mads/nebular/nebular_scenes7.cpp | 6 +- engines/mads/nebular/nebular_scenes8.cpp | 4 +- 8 files changed, 150 insertions(+), 144 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index d97fa4b284..ec06a1bf59 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -40,11 +40,17 @@ enum { enum Verb { VERB_ACTIVATE = 0x00E, + VERB_ATTACH = 0x019, + VERB_BREAK = 0x032, + VERB_BREATHE_AIR = 0x033, VERB_CAST = 0x03D, VERB_CLIMB_DOWN = 0x04E, VERB_CLIMB_THROUGH = 0x04F, VERB_CLIMB_UP = 0x050, + VERB_CUT = 0x061, + VERB_DAMPEN = 0x064, VERB_DIVE_INTO = 0x06D, + NOUN_DRINK = 0x072, VERB_EAT = 0x075, VERB_EXAMINE = 0x07D, VERB_HOSE_DOWN = 0x0A6, @@ -98,21 +104,21 @@ enum Verb { }; enum Noun { - NOUN_GAME = 0x1, - NOUN_QSAVE = 0x2, - NOUN_LOOK = 0x3, - NOUN_TAKE = 0x4, - NOUN_PUSH = 0x5, - NOUN_OPEN = 0x6, - NOUN_PUT = 0x7, - NOUN_TALK_TO = 0x8, - NOUN_GIVE = 0x9, - NOUN_PULL = 0xA, - NOUN_CLOSE = 0xB, - NOUN_THROW = 0xC, - NOUN_WALK_TO = 0xD, - NOUN_ACTIVATE = 0xE, - NOUN_ADMIRE = 0xF, + //NOUN_GAME = 0x1, + //NOUN_QSAVE = 0x2, + //NOUN_LOOK = 0x3, + //NOUN_TAKE = 0x4, + //NOUN_PUSH = 0x5, + //NOUN_OPEN = 0x6, + //NOUN_PUT = 0x7, + //NOUN_TALK_TO = 0x8, + //NOUN_GIVE = 0x9, + //NOUN_PULL = 0xA, + //NOUN_CLOSE = 0xB, + //NOUN_THROW = 0xC, + //NOUN_WALK_TO = 0xD, + //NOUN_ACTIVATE = 0xE, + //NOUN_ADMIRE = 0xF, NOUN_ADSM = 0x10, NOUN_AIR_VENT = 0x11, NOUN_ALOE_PLANT = 0x12, @@ -122,7 +128,7 @@ enum Noun { NOUN_AREA_TO_SOUTH = 0x16, NOUN_AREA_TO_WEST = 0x17, NOUN_AROMATIC_MEAT = 0x18, - NOUN_ATTACH = 0x19, + //NOUN_ATTACH = 0x19, NOUN_AUDIO_TAPE = 0x1A, NOUN_AUXILIARY_POWER = 0x1B, NOUN_BADMITTON_BRAT = 0x1C, @@ -147,8 +153,8 @@ enum Noun { NOUN_BOULDER = 0x2F, NOUN_BOULDERS = 0x30, NOUN_BRA = 0x31, - NOUN_BREAK = 0x32, - NOUN_BREATHE_AIR = 0x33, + //NOUN_BREAK = 0x32, + //NOUN_BREATHE_AIR = 0x33, NOUN_BULKHEAD = 0x34, NOUN_BURGER = 0x35, NOUN_BURN = 0x36, @@ -158,7 +164,7 @@ enum Noun { NOUN_BUSHY_FERN = 0x3A, NOUN_CACTUS = 0x3B, NOUN_CARD = 0x3C, - NOUN_CAST = 0x3D, + //NOUN_CAST = 0x3D, NOUN_CAULDRON = 0x3E, NOUN_CAVE = 0x3F, NOUN_CAVE_CEILING = 0x40, @@ -194,10 +200,10 @@ enum Noun { NOUN_CURIOUS_WEED_PATCH = 0x5E, NOUN_CURTAIN = 0x5F, NOUN_CURTAINS = 0x60, - NOUN_CUT = 0x61, + //NOUN_CUT = 0x61, NOUN_DAMAGE_CONTROL = 0x62, NOUN_DAMAGE_CONTROL_PANEL = 0x63, - NOUN_DAMPEN = 0x64, + //NOUN_DAMPEN = 0x64, NOUN_DEAD_FISH = 0x65, NOUN_DEAD_PURPLE_MONSTER = 0x66, NOUN_DECLIVITOUS_CHASM = 0x67, @@ -205,24 +211,24 @@ enum Noun { NOUN_DENSE_FOREST = 0x69, NOUN_DETONATORS = 0x6A, NOUN_DINO_MITE = 0x6B, - NOUN_DISASSEMBLE = 0x6C, - NOUN_DIVE_INTO = 0x6D, + //NOUN_DISASSEMBLE = 0x6C, + //NOUN_DIVE_INTO = 0x6D, NOUN_DOOR = 0x6E, NOUN_DOOR_KEY = 0x6F, NOUN_DOORWAY = 0x70, NOUN_DRAWER = 0x71, - NOUN_DRINK = 0x72, + //NOUN_DRINK = 0x72, NOUN_DURAFAIL_CELLS = 0x73, NOUN_EASTERN_CLIFF_FACE = 0x74, - NOUN_EAT = 0x75, - NOUN_EJECT = 0x76, - NOUN_EMPTY = 0x77, + //NOUN_EAT = 0x75, + //NOUN_EJECT = 0x76, + //NOUN_EMPTY = 0x77, NOUN_ENGINEERING_CONTROLS = 0x78, NOUN_ENGINEERING_SECTION = 0x79, NOUN_ENTER_KEY = 0x7A, NOUN_ESCAPE_HATCH = 0x7B, NOUN_ESTROTOXIN = 0x7C, - NOUN_EXAMINE = 0x7D, + //NOUN_EXAMINE = 0x7D, NOUN_EXPERIMENT_CAGE = 0x7E, NOUN_EXTINGUISH = 0x7F, NOUN_FACE_ID = 0x80, @@ -237,36 +243,36 @@ enum Noun { NOUN_FLOOR = 0x89, NOUN_FLOOR_OF_HUT = 0x8A, NOUN_FLOOR_TILE = 0x8B, - NOUN_FONDLE = 0x8C, + //NOUN_FONDLE = 0x8C, NOUN_FOREST_TO_EAST = 0x8D, NOUN_FRONT_WINDOW = 0x8E, NOUN_FUNGOIDS = 0x8F, NOUN_FURNACE = 0x90, NOUN_FUZZY_DICE = 0x91, - NOUN_GAZE = 0x92, - NOUN_GAZE_AT = 0x93, - NOUN_GAZE_IN = 0x94, - NOUN_GLANCE_AT = 0x95, + //NOUN_GAZE = 0x92, + //NOUN_GAZE_AT = 0x93, + //NOUN_GAZE_IN = 0x94, + //NOUN_GLANCE_AT = 0x95, NOUN_GLOVE = 0x96, NOUN_GNARLY_SHRUB = 0x97, - NOUN_GNAW_ON = 0x98, - NOUN_GORGE_ON = 0x99, + //NOUN_GNAW_ON = 0x98, + //NOUN_GORGE_ON = 0x99, NOUN_GRAIN_ALCHOHOL = 0x9A, NOUN_GRASSLAND_TO_EAST = 0x9B, NOUN_GRASSLAND_TO_SOUTH = 0x9C, NOUN_GRASSY_AREA = 0x9D, NOUN_GRASSY_AREA_TO_NORTH = 0x9E, NOUN_GRASSY_KNOLL = 0x9F, - NOUN_GRIND = 0xA0, + //NOUN_GRIND = 0xA0, NOUN_GROOVILACTIC_TREE = 0xA1, NOUN_GUARDS_ARM = 0xA2, NOUN_HATCHWAY = 0xA3, - NOUN_HOOK_UP = 0xA4, + //NOUN_HOOK_UP = 0xA4, NOUN_HORIZON = 0xA5, - NOUN_HOSE_DOWN = 0xA6, + //NOUN_HOSE_DOWN = 0xA6, NOUN_HOTPANTS = 0xA7, NOUN_HULL = 0xA8, - NOUN_HURL = 0xA9, + //NOUN_HURL = 0xA9, NOUN_HUT = 0xAA, NOUN_HUT_AREA = 0xAB, NOUN_HUT_TO_EAST = 0xAC, @@ -277,10 +283,10 @@ enum Noun { NOUN_HYDROSPANNER = 0xB1, NOUN_HYPERDRIVE_JUMP_UNIT = 0xB2, NOUN_ID_CARD = 0xB3, - NOUN_IGNITE = 0xB4, - NOUN_INFLATE = 0xB5, - NOUN_INSERT = 0xB6, - NOUN_INSPECT = 0xB7, + //NOUN_IGNITE = 0xB4, + //NOUN_INFLATE = 0xB5, + //NOUN_INSERT = 0xB6, + //NOUN_INSPECT = 0xB7, NOUN_JUNGLE = 0xB8, NOUN_JUNGLE_TO_EAST = 0xB9, NOUN_JUNGLE_TO_WEST = 0xBA, @@ -298,17 +304,17 @@ enum Noun { NOUN_KNIFE = 0xC6, NOUN_LADDER = 0xC7, NOUN_LARGE_STALAGMITE = 0xC8, - NOUN_LEER_AT = 0xC9, + //NOUN_LEER_AT = 0xC9, NOUN_LIBRARY_COMPUTER = 0xCA, - NOUN_LICK = 0xCB, + //NOUN_LICK = 0xCB, NOUN_LIFE_SUPPORT_SECTION = 0xCC, NOUN_LIGHT = 0xCD, - NOUN_LOAD = 0xCE, - NOUN_LOCK = 0xCF, + //NOUN_LOAD = 0xCE, + //NOUN_LOCK = 0xCF, NOUN_LOG = 0xD0, - NOUN_LOOK_AT = 0xD1, - NOUN_LOOK_IN = 0xD2, - NOUN_LOOK_THROUGH = 0xD3, + //NOUN_LOOK_AT = 0xD1, + //NOUN_LOOK_IN = 0xD2, + //NOUN_LOOK_THROUGH = 0xD3, NOUN_LOUNGE_AREA = 0xD4, NOUN_LOVE_ALTAR = 0xD5, NOUN_LOWLANDS = 0xD6, @@ -371,7 +377,7 @@ enum Noun { NOUN_PLANT_STALK = 0x10F, NOUN_PLANTS = 0x110, NOUN_PLASTIC_JESUS = 0x111, - NOUN_PLAY = 0x112, + //NOUN_PLAY = 0x112, NOUN_PLUNGER = 0x113, NOUN_POISON_DARTS = 0x114, NOUN_POLYCEMENT = 0x115, @@ -379,12 +385,12 @@ enum Noun { NOUN_POSTER = 0x117, NOUN_POWER_STATUS_PANEL = 0x118, NOUN_PRECIPICE = 0x119, - NOUN_PRESS = 0x11A, + //NOUN_PRESS = 0x11A, NOUN_PRESSURE_GAUGE = 0x11B, - NOUN_PRY = 0x11C, + //NOUN_PRY = 0x11C, NOUN_RAGING_RIVER = 0x11D, NOUN_RAMOLYAN_RUGBY_RATS = 0x11E, - NOUN_READ = 0x11F, + //NOUN_READ = 0x11F, NOUN_REARVIEW_MIRROR = 0x120, NOUN_REBREATHER = 0x121, NOUN_REFRIGERATOR = 0x122, @@ -403,7 +409,7 @@ enum Noun { NOUN_SEAWEED = 0x12F, NOUN_SEAWEED_BANK = 0x130, NOUN_SECURITY_CARD = 0x131, - NOUN_SET = 0x132, + //NOUN_SET = 0x132, NOUN_SHAKE_HANDS = 0x133, NOUN_SHARPEN = 0x134, NOUN_SHIELD_ACCESS_PANEL = 0x135, @@ -411,48 +417,48 @@ enum Noun { NOUN_SHIELD_MODULATOR = 0x137, NOUN_SHIELD_STATUS_PANEL = 0x138, NOUN_SHIP = 0x139, - NOUN_SHOOT = 0x13A, + //NOUN_SHOOT = 0x13A, NOUN_SHOVEL = 0x13B, - NOUN_SHRED = 0x13C, + //NOUN_SHRED = 0x13C, NOUN_SHRUNKEN_HEADS = 0x13D, NOUN_SINGED_MEAT = 0x13E, - NOUN_SIT_IN = 0x13F, + //NOUN_SIT_IN = 0x13F, NOUN_SKULL = 0x140, NOUN_SKULL_AND_CROSSBONES = 0x141, NOUN_SKY = 0x142, - NOUN_SLEEP_ON = 0x143, + //NOUN_SLEEP_ON = 0x143, NOUN_SLITHERING_SNAKE = 0x144, NOUN_SLUG_SECRETION = 0x145, NOUN_SMALL_HOLE = 0x146, - NOUN_SMELL = 0x147, + //NOUN_SMELL = 0x147, NOUN_SNAKE = 0x148, - NOUN_SNIFF = 0x149, - NOUN_SOAK = 0x14A, + //NOUN_SNIFF = 0x149, + //NOUN_SOAK = 0x14A, NOUN_SPECIAL_KEY_1 = 0x14B, NOUN_SPECIAL_KEY_2 = 0x14C, NOUN_SPIDER = 0x14D, NOUN_SPILT_MILK = 0x14E, NOUN_SPIT_FIRE = 0x14F, - NOUN_SPRAY = 0x150, - NOUN_STAB = 0x151, + //NOUN_SPRAY = 0x150, + //NOUN_STAB = 0x151, NOUN_STAIRS = 0x152, NOUN_STALAGMITES = 0x153, - NOUN_STAND_INSIDE = 0x154, - NOUN_STARE_AT = 0x155, + //NOUN_STAND_INSIDE = 0x154, + //NOUN_STARE_AT = 0x155, NOUN_STEPS = 0x156, NOUN_STUFFED_FISH = 0x157, NOUN_SURFACE = 0x158, - NOUN_SWIM_ACROSS = 0x159, - NOUN_SWIM_INTO = 0x15A, - NOUN_SWIM_THROUGH = 0x15B, - NOUN_SWIM_TO = 0x15C, - NOUN_SWIM_TOWARDS = 0x15D, - NOUN_SWIM_UNDER = 0x15E, + //NOUN_SWIM_ACROSS = 0x159, + //NOUN_SWIM_INTO = 0x15A, + //NOUN_SWIM_THROUGH = 0x15B, + //NOUN_SWIM_TO = 0x15C, + //NOUN_SWIM_TOWARDS = 0x15D, + //NOUN_SWIM_UNDER = 0x15E, NOUN_SWOOPING_CREATURE = 0x15F, NOUN_TABLE = 0x160, - NOUN_TAKE_LIVER = 0x161, - NOUN_TAKE_OFF = 0x162, - NOUN_TAKE_PAGE = 0x163, + //NOUN_TAKE_LIVER = 0x161, + //NOUN_TAKE_OFF = 0x162, + //NOUN_TAKE_PAGE = 0x163, NOUN_TALL_GRASS = 0x164, NOUN_TAPE_PLAYER = 0x165, NOUN_TARGET_COMPUTER = 0x166, @@ -465,7 +471,7 @@ enum Noun { NOUN_THATCHED_ROOF = 0x16D, NOUN_THORNS = 0x16E, NOUN_THORNY_BUSH = 0x16F, - NOUN_TIE = 0x170, + //NOUN_TIE = 0x170, NOUN_TIMEBOMB = 0x171, NOUN_TIMER = 0x172, NOUN_TIMER_MODULE = 0x173, @@ -476,11 +482,11 @@ enum Noun { NOUN_TUNNEL = 0x178, NOUN_TWINKIE_BUSH = 0x179, NOUN_TWINKIFRUIT = 0x17A, - NOUN_UNLOCK = 0x17B, + //NOUN_UNLOCK = 0x17B, NOUN_UZI = 0x17C, NOUN_VASE = 0x17D, NOUN_VIDEO_GAME = 0x17E, - NOUN_VIEW = 0x17F, + //NOUN_VIEW = 0x17F, NOUN_VIEW_SCREEN = 0x180, NOUN_VIEWPORT = 0x181, NOUN_VILLAGE_AREA = 0x182, @@ -488,17 +494,17 @@ enum Noun { NOUN_VOLCANO = 0x184, NOUN_VULTURE = 0x185, NOUN_WAD_OF_CATTLE_PARTS = 0x186, - NOUN_WALK_ACROSS = 0x187, - NOUN_WALK_INSIDE = 0x188, - NOUN_WALK_ON = 0x189, - NOUN_WALK_OUTSIDE = 0x18A, - NOUN_WALK_THROUGH = 0x18B, - NOUN_WALK_TOWARDS = 0x18C, + //NOUN_WALK_ACROSS = 0x187, + //NOUN_WALK_INSIDE = 0x188, + //NOUN_WALK_ON = 0x189, + //NOUN_WALK_OUTSIDE = 0x18A, + //NOUN_WALK_THROUGH = 0x18B, + //NOUN_WALK_TOWARDS = 0x18C, NOUN_WALL = 0x18D, NOUN_WATCH_TOWER = 0x18E, NOUN_WATER = 0x18F, NOUN_WEAPONS_DISPLAY = 0x190, - NOUN_WEAR = 0x191, + //NOUN_WEAR = 0x191, NOUN_WEATHER_STATION = 0x192, NOUN_WEATHER_VANE = 0x193, NOUN_WEIGHT_MACHINE = 0x194, @@ -507,7 +513,7 @@ enum Noun { NOUN_WINDOW = 0x197, NOUN_WITCHDOCTOR_HUT = 0x198, NOUN_WORKBENCH = 0x199, - NOUN_WRITE_ON = 0x19A, + //NOUN_WRITE_ON = 0x19A, NOUN_YELLOW_BIRDY = 0x19B, NOUN_GRASS = 0x19C, NOUN_BOUNCING_REPTILE = 0x19D, @@ -526,7 +532,7 @@ enum Noun { NOUN_PILE_OF_LEAVES = 0x1AA, NOUN_OPEN_FIELD_TO_EAST = 0x1AB, NOUN_LAWN = 0x1AC, - NOUN_WALK_DOWN = 0x1AD, + //NOUN_WALK_DOWN = 0x1AD, NOUN_PATH_TO_WEST = 0x1AE, NOUN_HEDGE = 0x1AF, NOUN_VILLAGE_PATH = 0x1B0, @@ -558,8 +564,8 @@ enum Noun { NOUN_BAG_OF_TWINKIFRUITS = 0x1CA, NOUN_BED = 0x1CB, NOUN_DISPLAY = 0x1CC, - NOUN_LEAVE = 0x1CD, - NOUN_EXIT_FROM = 0x1CE, + //NOUN_LEAVE = 0x1CD, + //NOUN_EXIT_FROM = 0x1CE, NOUN_DEVICE = 0x1CF, NOUN_0_KEY = 0x1D0, NOUN_1_KEY = 0x1D1, @@ -597,7 +603,7 @@ enum Noun { NOUN_ELECTRO_SCANNER = 0x1F1, NOUN_HALL = 0x1F2, NOUN_SCANNER = 0x1F3, - NOUN_PLACE_HAND_ON = 0x1F4, + //NOUN_PLACE_HAND_ON = 0x1F4, NOUN_SECURITY_MONITOR = 0x1F5, NOUN_DIGITORAMA = 0x1F6, NOUN_RAIL_BEAM = 0x1F7, @@ -618,16 +624,16 @@ enum Noun { NOUN_AIR_DUCT = 0x206, NOUN_CELL_WALL = 0x207, NOUN_LIGHTS = 0x208, - NOUN_STARE_INTO = 0x209, + //NOUN_STARE_INTO = 0x209, NOUN_CELL_CONTROLS = 0x20A, NOUN_COMMODE = 0x20B, - NOUN_USE = 0x20C, + //NOUN_USE = 0x20C, NOUN_BASIN = 0x20D, - NOUN_JUMP_INSIDE = 0x20E, + //NOUN_JUMP_INSIDE = 0x20E, NOUN_PREVIOUS_CELL = 0x20F, NOUN_NEXT_ROOM = 0x210, NOUN_ZINK = 0x211, - NOUN_GAZE_INTO = 0x212, + //NOUN_GAZE_INTO = 0x212, NOUN_THRONE = 0x213, NOUN_SACK = 0x214, NOUN_LIMB = 0x215, @@ -640,7 +646,7 @@ enum Noun { NOUN_MONITOR_AREA = 0x21C, NOUN_SIDEWALL = 0x21D, NOUN_COFFEE_MUG = 0x21E, - NOUN_SIT_AT = 0x21F, + //NOUN_SIT_AT = 0x21F, NOUN_LIGHTING_FIXTURE = 0x220, NOUN_MONITORS = 0x221, NOUN_GENDER_CONTROLS = 0x222, @@ -648,7 +654,7 @@ enum Noun { NOUN_MOLECULAR_RECORDER = 0x224, NOUN_MAINTENANCE_PANEL = 0x225, NOUN_RAMP = 0x226, - NOUN_WALK_UP = 0x227, + //NOUN_WALK_UP = 0x227, NOUN_SUBSONIC_ATOMIZER = 0x228, NOUN_EIGHT_BALL = 0x229, NOUN_DNA_INVERTER = 0x22A, @@ -665,7 +671,7 @@ enum Noun { NOUN_SHOCK_MACHINE = 0x235, NOUN_INTERROGATION_TABLE = 0x236, NOUN_LIE_DOWN_ON = 0x237, - NOUN_DECIPHER = 0x238, + //NOUN_DECIPHER = 0x238, NOUN_GUARD = 0x239, NOUN_RIP_IN_FLOOR = 0x23A, NOUN_TELEPORT_AREA = 0x23B, @@ -675,7 +681,7 @@ enum Noun { NOUN_WALL_BOARD = 0x23F, NOUN_GENDER_SCANNER = 0x240, NOUN_BAR = 0x241, - NOUN_WALK_INTO = 0x242, + //NOUN_WALK_INTO = 0x242, NOUN_HALLWAY_TO_SOUTH = 0x243, NOUN_SIGN = 0x244, NOUN_HALLWAY_TO_NORTH = 0x245, @@ -787,7 +793,7 @@ enum Noun { NOUN_CONTROL_STATION = 0x2AF, NOUN_STRANGE_MONSTER = 0x2B0, NOUN_GHASTLY_BEAST = 0x2B1, - NOUN_GAWK_AT = 0x2B2, + //NOUN_GAWK_AT = 0x2B2, NOUN_CORRIDOR_TO_SOUTH = 0x2B3, NOUN_CORRIDOR_TO_NORTH = 0x2B4, NOUN_WALK_ONTO = 0x2B5, @@ -822,7 +828,7 @@ enum Noun { NOUN_BLOOD_STAIN = 0x2D2, NOUN_GRATE = 0x2D3, NOUN_AIR_SHAFT = 0x2D4, - NOUN_RETURN_TO = 0x2D5, + //NOUN_RETURN_TO = 0x2D5, NOUN_FORMALDEHYDE = 0x2D6, NOUN_PETROX = 0x2D7, NOUN_SODIUM_BENZOATE = 0x2D8, @@ -858,15 +864,15 @@ enum Noun { NOUN_LAMP = 0x2F6, NOUN_CLIMB_INTO = 0x2F7, NOUN_LIGHT_BULB = 0x2F8, - NOUN_STEP_INTO = 0x2F9, + //NOUN_STEP_INTO = 0x2F9, NOUN_ROOM = 0x2FA, - NOUN_CRAWL_TO = 0x2FB, + //NOUN_CRAWL_TO = 0x2FB, NOUN_FOURTH_CELL = 0x2FC, NOUN_THIRD_CELL = 0x2FD, NOUN_SECOND_CELL = 0x2FE, NOUN_FIRST_CELL = 0x2FF, NOUN_EQUIPMENT_ROOM = 0x300, - NOUN_CRAWL_DOWN = 0x301, + //NOUN_CRAWL_DOWN = 0x301, NOUN_DESCENDING_SHAFT = 0x302, NOUN_SAUROPOD = 0x303, NOUN_MONSTER = 0x304, @@ -876,14 +882,14 @@ enum Noun { NOUN_INSTRUMENT_TABLE = 0x308, NOUN_WOMAN_ON_BALCONY = 0x309, NOUN_WOMAN_IN_CHAIR = 0x30A, - NOUN_SIT_ON = 0x30B, + //NOUN_SIT_ON = 0x30B, NOUN_WOMAN_IN_ALCOVE = 0x30C, NOUN_KETTLE = 0x30D, NOUN_BARTENDER = 0x30E, NOUN_WHISKEY = 0x30F, NOUN_ALCOHOL = 0x310, NOUN_RIM = 0x311, - NOUN_WALK_ALONG = 0x312, + //NOUN_WALK_ALONG = 0x312, NOUN_SUBMERGED_CITY = 0x313, NOUN_GOVERNORS_HOUSE = 0x314, NOUN_RIM_TOWARDS_EAST = 0x315, @@ -902,7 +908,7 @@ enum Noun { NOUN_SIDEWALK_TO_EAST = 0x322, NOUN_BUILDING = 0x323, NOUN_CAR = 0x324, - NOUN_GET_INSIDE = 0x325, + //NOUN_GET_INSIDE = 0x325, NOUN_MARQUEE = 0x326, NOUN_BUILDING_ENTRANCE = 0x327, NOUN_GUARD_STATION = 0x328, @@ -912,7 +918,7 @@ enum Noun { NOUN_PAPERS = 0x32C, NOUN_FILE_CABINET = 0x32D, NOUN_WINDOWS = 0x32E, - NOUN_WALK = 0x32F, + //NOUN_WALK = 0x32F, NOUN_STORAGE_BOX = 0x330, NOUN_WATER_COOLER = 0x331, NOUN_BOX = 0x332, @@ -966,12 +972,12 @@ enum Noun { NOUN_TELEPORTER_ENTRANCE = 0x362, NOUN_SOFTWARE_DOOR = 0x363, NOUN_SPINACH_PATCH_DOLL = 0x364, - NOUN_REFLECT = 0x365, + //NOUN_REFLECT = 0x365, NOUN_REGISTER_DRAWER = 0x366, NOUN_ELEVATOR_DOOR = 0x367, NOUN_HYDRAULIC_SUPPORT = 0x368, NOUN_EQUIPMENT_OVERHEAD = 0x369, - NOUN_GET_INTO = 0x36A, + //NOUN_GET_INTO = 0x36A, NOUN_WARNING_LABEL = 0x36B, NOUN_NUCLEAR_SLINGSHOT = 0x36C, NOUN_DISPLAY_CASE = 0x36D, @@ -1031,7 +1037,7 @@ enum Noun { NOUN_WELCOME_MAT = 0x3A3, NOUN_MELON_MUSH = 0x3A4, NOUN_BADMINTON_BRAT = 0x3A5, - NOUN_APPLY = 0x3A6, + //NOUN_APPLY = 0x3A6, NOUN_COMBINATION = 0x3A7, NOUN_NOTE = 0x3A8, NOUN_LECITHIN = 0x3A9, @@ -1048,8 +1054,8 @@ enum Noun { NOUN_OPEN_WATER_TO_SOUTH = 0x3B4, NOUN_PROJECTOR = 0x3B5, NOUN_GUARDS_ARM2 = 0x3B6, - NOUN_NIBBLE_ON = 0x3B7, - NOUN_ENTER = 0x3B8, + //NOUN_NIBBLE_ON = 0x3B7, + //NOUN_ENTER = 0x3B8, NOUN_ = 0x3B9, NOUN_TIMER_BUTTON_1 = 0x3BA, NOUN_REMOTE_BUTTON_1 = 0x3BB, @@ -1293,8 +1299,8 @@ enum Noun { NOUN_WEST_END_OF_PLATFORM = 0x4A9, NOUN_EAST_END_OF_PLATFORM = 0x4AA, NOUN_FOLD = 0x4AB, - NOUN_SPINDLE = 0x4AC, - NOUN_MUTILATE = 0x4AD + NOUN_SPINDLE = 0x4AC + //NOUN_MUTILATE = 0x4AD }; class SceneFactory { diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 083b649a1a..b2076a2b7c 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -4917,7 +4917,7 @@ void Scene214::setup() { setPlayerSpritesPrefix(); setAAName(); _scene->addActiveVocab(NOUN_CAPTIVE_CREATURE); - _scene->addActiveVocab(NOUN_WALK_TO); + _scene->addActiveVocab(VERB_WALKTO); } void Scene214::enter() { diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 95fdd0031a..8209f0c1da 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -3868,7 +3868,7 @@ void Scene351::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(NOUN_WALK_TO); + _scene->addActiveVocab(VERB_WALKTO); } void Scene351::enter() { @@ -4027,7 +4027,7 @@ void Scene352::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(NOUN_WALK_TO); + _scene->addActiveVocab(VERB_WALKTO); _scene->addActiveVocab(NOUN_YOUR_STUFF); _scene->addActiveVocab(NOUN_OTHER_STUFF); _scene->addActiveVocab(NOUN_LAMP); @@ -4815,7 +4815,7 @@ void Scene358::actions() { void Scene359::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(NOUN_WALK_TO); + _scene->addActiveVocab(VERB_WALKTO); } void Scene359::enter() { diff --git a/engines/mads/nebular/nebular_scenes4.cpp b/engines/mads/nebular/nebular_scenes4.cpp index 5a68887b8d..195bba577d 100644 --- a/engines/mads/nebular/nebular_scenes4.cpp +++ b/engines/mads/nebular/nebular_scenes4.cpp @@ -237,13 +237,13 @@ void Scene402::setup() { _scene->addActiveVocab(NOUN_BARTENDER); _scene->addActiveVocab(NOUN_ALIEN_LIQUOR); - _scene->addActiveVocab(NOUN_DRINK); + _scene->addActiveVocab(VERB_DRINK); _scene->addActiveVocab(NOUN_BINOCULARS); - _scene->addActiveVocab(NOUN_WALK_TO); + _scene->addActiveVocab(VERB_WALKTO); _scene->addActiveVocab(NOUN_CREDIT_CHIP); - _scene->addActiveVocab(NOUN_TAKE); + _scene->addActiveVocab(VERB_TAKE); _scene->addActiveVocab(NOUN_REPAIR_LIST); - _scene->addActiveVocab(NOUN_LOOK_AT); + _scene->addActiveVocab(VERB_LOOK_AT); } void Scene402::synchronize(Common::Serializer &s) { @@ -2850,7 +2850,7 @@ void Scene408::setup() { setPlayerSpritesPrefix(); setAAName(); _scene->addActiveVocab(NOUN_TARGET_MODULE); - _scene->addActiveVocab(NOUN_WALK_TO); + _scene->addActiveVocab(VERB_WALKTO); } void Scene408::enter() { @@ -3464,7 +3464,7 @@ void Scene411::giveToRex(int object) { void Scene411::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(NOUN_WALK_TO); + _scene->addActiveVocab(VERB_WALKTO); _scene->addActiveVocab(NOUN_ALIEN_LIQUOR); _scene->addActiveVocab(NOUN_FORMALDEHYDE); _scene->addActiveVocab(NOUN_PETROX); diff --git a/engines/mads/nebular/nebular_scenes5.cpp b/engines/mads/nebular/nebular_scenes5.cpp index b55262c135..fb79492b1c 100644 --- a/engines/mads/nebular/nebular_scenes5.cpp +++ b/engines/mads/nebular/nebular_scenes5.cpp @@ -96,7 +96,7 @@ void Scene501::setup() { setPlayerSpritesPrefix(); setAAName(); _scene->addActiveVocab(NOUN_DOOR); - _scene->addActiveVocab(NOUN_WALK_THROUGH); + _scene->addActiveVocab(VERB_WALK_THROUGH); } void Scene501::synchronize(Common::Serializer &s) { @@ -527,7 +527,7 @@ void Scene503::setup() { setPlayerSpritesPrefix(); setAAName(); _scene->addActiveVocab(NOUN_DETONATORS); - _scene->addActiveVocab(NOUN_WALK_TO); + _scene->addActiveVocab(VERB_WALKTO); } void Scene503::enter() { @@ -1099,7 +1099,7 @@ void Scene505::actions() { void Scene506::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(NOUN_WALK_INTO); + _scene->addActiveVocab(VERB_WALK_INTO); _scene->addActiveVocab(NOUN_SOFTWARE_STORE); _scene->addActiveVocab(NOUN_LABORATORY); } @@ -1362,7 +1362,7 @@ void Scene507::setup() { setPlayerSpritesPrefix(); setAAName(); _scene->addActiveVocab(NOUN_PENLIGHT); - _scene->addActiveVocab(NOUN_WALK_TO); + _scene->addActiveVocab(VERB_WALKTO); } void Scene507::enter() { @@ -1473,7 +1473,7 @@ void Scene508::setup() { setPlayerSpritesPrefix(); setAAName(); _scene->addActiveVocab(NOUN_SPINACH_PATCH_DOLL); - _scene->addActiveVocab(NOUN_WALK_TO); + _scene->addActiveVocab(VERB_WALKTO); _scene->addActiveVocab(NOUN_LASER_BEAM); } @@ -1733,7 +1733,7 @@ void Scene511::setup() { setAAName(); _scene->addActiveVocab(NOUN_BOAT); _scene->addActiveVocab(NOUN_FISHING_LINE); - _scene->addActiveVocab(NOUN_WALK_TO); + _scene->addActiveVocab(VERB_WALKTO); } void Scene511::enter() { @@ -2053,7 +2053,7 @@ void Scene512::setup() { setPlayerSpritesPrefix(); setAAName(); _scene->addActiveVocab(NOUN_FISHING_ROD); - _scene->addActiveVocab(NOUN_WALK_TO); + _scene->addActiveVocab(VERB_WALKTO); _scene->addActiveVocab(NOUN_PADLOCK_KEY); _scene->addActiveVocab(NOUN_REGISTER_DRAWER); } @@ -2347,7 +2347,7 @@ void Scene513::setup() { setPlayerSpritesPrefix(); setAAName(); _scene->addActiveVocab(NOUN_ELEVATOR_DOOR); - _scene->addActiveVocab(NOUN_WALK_TO); + _scene->addActiveVocab(VERB_WALKTO); } void Scene513::enter() { diff --git a/engines/mads/nebular/nebular_scenes6.cpp b/engines/mads/nebular/nebular_scenes6.cpp index 6cea5cb63a..e9c4473f9e 100644 --- a/engines/mads/nebular/nebular_scenes6.cpp +++ b/engines/mads/nebular/nebular_scenes6.cpp @@ -87,7 +87,7 @@ void Scene601::setup() { setPlayerSpritesPrefix(); setAAName(); _scene->addActiveVocab(NOUN_LASER_BEAM); - _scene->addActiveVocab(NOUN_LOOK_AT); + _scene->addActiveVocab(VERB_LOOK_AT); } void Scene601::enter() { @@ -220,7 +220,7 @@ void Scene601::actions() { void Scene602::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(NOUN_WALK_TO); + _scene->addActiveVocab(VERB_WALKTO); _scene->addActiveVocab(NOUN_SAFE); _scene->addActiveVocab(NOUN_LASER_BEAM); } @@ -533,7 +533,7 @@ void Scene602::actions() { void Scene603::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(NOUN_WALK_TO); + _scene->addActiveVocab(VERB_WALKTO); _scene->addActiveVocab(NOUN_COMPACT_CASE); _scene->addActiveVocab(NOUN_NOTE); } @@ -1421,7 +1421,7 @@ void Scene607::actions() { void Scene608::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(NOUN_WALK_TO); + _scene->addActiveVocab(VERB_WALKTO); _scene->addActiveVocab(NOUN_POLYCEMENT); _scene->addActiveVocab(NOUN_CAR); _scene->addActiveVocab(NOUN_OBNOXIOUS_DOG); @@ -2705,7 +2705,7 @@ void Scene610::setup() { setPlayerSpritesPrefix(); setAAName(); _scene->addActiveVocab(NOUN_PHONE_HANDSET); - _scene->addActiveVocab(NOUN_WALK_TO); + _scene->addActiveVocab(VERB_WALKTO); } void Scene610::enter() { @@ -2888,7 +2888,7 @@ void Scene611::setup() { setPlayerSpritesPrefix(); setAAName(); _scene->addActiveVocab(NOUN_RAT); - _scene->addActiveVocab(NOUN_WALK_TO); + _scene->addActiveVocab(VERB_WALKTO); } void Scene611::handleRatMoves() { @@ -4263,7 +4263,7 @@ void Scene612::setup() { setPlayerSpritesPrefix(); setAAName(); _scene->addActiveVocab(NOUN_FISHING_LINE); - _scene->addActiveVocab(NOUN_WALK_TO); + _scene->addActiveVocab(VERB_WALKTO); } void Scene612::handleWinchMovement() { diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index c0755e83aa..5c1f7bfef7 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -1074,7 +1074,7 @@ void Scene704::setup() { _game._player._spritesPrefix = ""; setAAName(); _scene->addActiveVocab(NOUN_BOTTLE); - _scene->addActiveVocab(NOUN_LOOK_AT); + _scene->addActiveVocab(VERB_LOOK_AT); } void Scene704::handleBottleInterface() { @@ -1678,7 +1678,7 @@ void Scene706::setup() { setAAName(); _scene->addActiveVocab(NOUN_BOTTLE); _scene->addActiveVocab(NOUN_VASE); - _scene->addActiveVocab(NOUN_WALK_TO); + _scene->addActiveVocab(VERB_WALKTO); } void Scene706::handleRexDeath() { @@ -2086,7 +2086,7 @@ void Scene751::setup() { setPlayerSpritesPrefix(); setAAName(); _scene->addActiveVocab(NOUN_FISHING_LINE); - _scene->addActiveVocab(NOUN_WALK_TO); + _scene->addActiveVocab(VERB_WALKTO); } void Scene751::enter() { diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index 9c53855878..e6f8701623 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -306,7 +306,7 @@ void Scene802::setup() { setPlayerSpritesPrefix(); setAAName(); _scene->addActiveVocab(NOUN_SHIELD_MODULATOR); - _scene->addActiveVocab(NOUN_WALK_TO); + _scene->addActiveVocab(VERB_WALKTO); _scene->addActiveVocab(NOUN_REMOTE); } @@ -514,7 +514,7 @@ void Scene803::setup() { setPlayerSpritesPrefix(); setAAName(); _scene->addActiveVocab(NOUN_GUTS); - _scene->addActiveVocab(NOUN_WALK_TO); + _scene->addActiveVocab(VERB_WALKTO); if ((!_globals[kFromCockpit] && _globals[kReturnFromCut] && !_globals[kBeamIsUp]) || (_globals[kFromCockpit] && !_globals[kExitShip])) { -- cgit v1.2.3 From cca6d19b2af3ab9161cdfa05b984b4e7fdab954b Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 20 May 2014 12:58:18 +0300 Subject: MADS: Fix typo --- engines/mads/nebular/nebular_scenes.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index ec06a1bf59..8df43e92e9 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -50,7 +50,7 @@ enum Verb { VERB_CUT = 0x061, VERB_DAMPEN = 0x064, VERB_DIVE_INTO = 0x06D, - NOUN_DRINK = 0x072, + VERB_DRINK = 0x072, VERB_EAT = 0x075, VERB_EXAMINE = 0x07D, VERB_HOSE_DOWN = 0x0A6, -- cgit v1.2.3 From 645d0d92adee850830cb3233acda631a9b128654 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 20 May 2014 13:09:56 +0300 Subject: MADS: Add nouns for Phantom --- engines/mads/phantom/phantom_scenes.h | 401 +++++++++++++++++++++++++++++++++- 1 file changed, 399 insertions(+), 2 deletions(-) diff --git a/engines/mads/phantom/phantom_scenes.h b/engines/mads/phantom/phantom_scenes.h index d93ccfccc5..e585ead542 100644 --- a/engines/mads/phantom/phantom_scenes.h +++ b/engines/mads/phantom/phantom_scenes.h @@ -35,8 +35,405 @@ namespace MADS { namespace Phantom { enum Noun { - VERB_LOOK_AT = 0x0D1 - // TODO + NOUN_GAME = 0x1, + NOUN_QSAVE = 0x2, + NOUN_LOOK = 0x3, + NOUN_TAKE = 0x4, + NOUN_PUSH = 0x5, + NOUN_OPEN = 0x6, + NOUN_PUT = 0x7, + NOUN_TALK_TO = 0x8, + NOUN_GIVE = 0x9, + NOUN_PULL = 0xA, + NOUN_CLOSE = 0xB, + NOUN_THROW = 0xC, + NOUN_WALK_TO = 0xD, + NOUN_ = 0xE, + NOUN_IN_ONE = 0xF, + NOUN_IN_TWO = 0x10, + NOUN_ACT_CURTAIN = 0x11, + NOUN_AISLE = 0x12, + NOUN_APRON = 0x13, + NOUN_ATTACK = 0x14, + NOUN_BACKSTAGE = 0x15, + NOUN_BEAR_PROP = 0x16, + NOUN_BLUE_FRAME = 0x17, + NOUN_BOOK = 0x18, + NOUN_BUST = 0x19, + NOUN_CABLE = 0x1A, + NOUN_CARPET = 0x1B, + NOUN_CARTON = 0x1C, + NOUN_CARTONS = 0x1D, + NOUN_CEILING = 0x1E, + NOUN_CHAIR = 0x1F, + NOUN_CIRCULAR_STAIRCASE = 0x20, + NOUN_CLIMB_DOWN = 0x21, + NOUN_CLIMB_INTO = 0x22, + NOUN_CLIMB_THROUGH = 0x23, + NOUN_COLUMN_PROP = 0x24, + NOUN_CONDUCTORS_STAND = 0x25, + NOUN_CORRIDOR = 0x26, + NOUN_COUCH = 0x27, + NOUN_COUNTERWEIGHT_SYSTEM = 0x28, + NOUN_CRATE = 0x29, + NOUN_CRATES = 0x2A, + NOUN_CRUMPLED_NOTE = 0x2B, + NOUN_CYCLORAMA = 0x2C, + NOUN_CYLINDER = 0x2D, + NOUN_DOOR = 0x2E, + NOUN_DRESSING_ROOM_DOOR = 0x2F, + NOUN_DRESSING_SCREEN = 0x30, + NOUN_DRESSING_TABLE = 0x31, + NOUN_ELEPHANT_PROP = 0x32, + NOUN_ENVELOPE = 0x33, + NOUN_EXIT = 0x34, + NOUN_EXIT_DOWN = 0x35, + NOUN_EXIT_SIGN = 0x36, + NOUN_EXIT_TO = 0x37, + NOUN_EXIT_TO_BACKSTAGE = 0x38, + NOUN_EXIT_TO_CELLAR = 0x39, + NOUN_EXIT_TO_CORRIDOR = 0x3A, + NOUN_EXIT_TO_DRESSING_RMS = 0x3B, + NOUN_EXIT_TO_LEFT_WING = 0x3C, + NOUN_EXIT_TO_PIT = 0x3D, + NOUN_EXIT_TO_RIGHT_WING = 0x3E, + NOUN_EXIT_TO_STAGE = 0x3F, + NOUN_EXIT_TO_STAIRWELL = 0x40, + NOUN_EXIT_TO_TRAP_ROOM = 0x41, + NOUN_EXIT_UP = 0x42, + NOUN_EXPOSED_BRICK = 0x43, + NOUN_FAN = 0x44, + NOUN_FIRE_AXE = 0x45, + NOUN_FL = 0x46, + NOUN_FLAT = 0x47, + NOUN_FLATS = 0x48, + NOUN_FLOOR = 0x49, + NOUN_FOLDING_CHAIRS = 0x4A, + NOUN_GARBAGE_CAN = 0x4B, + NOUN_GRAFFITI = 0x4C, + NOUN_GREEN_FRAME = 0x4D, + NOUN_HEMP = 0x4E, + NOUN_HOLE = 0x4F, + NOUN_HOUSE = 0x50, + NOUN_IN_ONE2 = 0x51, + NOUN_IN_TWO2 = 0x52, + NOUN_JUMP_INTO = 0x53, + NOUN_JUNK = 0x54, + NOUN_KEY = 0x55, + NOUN_LAMP = 0x56, + NOUN_LANTERN = 0x57, + NOUN_LARGE_NOTE = 0x58, + NOUN_LASSO = 0x59, + NOUN_LEG = 0x5A, + NOUN_LETTER = 0x5B, + NOUN_LIGHT_FIXTURE = 0x5C, + NOUN_LOCK = 0x5D, + NOUN_LOCKING_RAIL = 0x5E, + NOUN_LOCKRAIL = 0x5F, + NOUN_LOOK_AT = 0x60, + NOUN_LOOK_THROUGH = 0x61, + NOUN_MANNEQUINS = 0x62, + NOUN_MIRROR = 0x63, + NOUN_MUMMY_PROP = 0x64, + NOUN_MURAL = 0x65, + NOUN_MUSIC_SCORE = 0x66, + NOUN_MUSIC_STAND = 0x67, + NOUN_MUSIC_STANDS = 0x68, + NOUN_NOTHING = 0x69, + NOUN_NOTICE = 0x6A, + NOUN_ORCHESTRA_DOOR = 0x6B, + NOUN_ORCHESTRA_PIT = 0x6C, + NOUN_PAINTING = 0x6D, + NOUN_PARCHMENT = 0x6E, + NOUN_PIECE_OF_PAPER = 0x6F, + NOUN_PIPE = 0x70, + NOUN_PIT = 0x71, + NOUN_PLANT = 0x72, + NOUN_POSTER = 0x73, + NOUN_PROMPTERS_BOX = 0x74, + NOUN_PROP_TABLE = 0x75, + NOUN_PROPS = 0x76, + NOUN_PROSCENIUM_ARCH = 0x77, + NOUN_PURCHASE_LINES = 0x78, + NOUN_RAILING = 0x79, + NOUN_READ = 0x7A, + NOUN_RED_FRAME = 0x7B, + NOUN_REMOVE = 0x7C, + NOUN_ROPE = 0x7D, + NOUN_RUG = 0x7E, + NOUN_SANDBAG = 0x7F, + NOUN_SCAFFOLDING = 0x80, + NOUN_SEATS = 0x81, + NOUN_SIDE_WALL = 0x82, + NOUN_SMALL_NOTE = 0x83, + NOUN_STAGE = 0x84, + NOUN_STAGE_EXIT = 0x85, + NOUN_STAGE_LEFT = 0x86, + NOUN_STAGE_RIGHT = 0x87, + NOUN_STAGEMANAGERS_POST = 0x88, + NOUN_STAIR_UNIT = 0x89, + NOUN_STAIRCASE = 0x8A, + NOUN_STAIRWELL = 0x8B, + NOUN_STOOL = 0x8C, + NOUN_STRIKE = 0x8D, + NOUN_SWORD = 0x8E, + NOUN_TABLE = 0x8F, + NOUN_THE_HOUSE = 0x90, + NOUN_THUNDER_MACHINE = 0x91, + NOUN_TICKET = 0x92, + NOUN_TRAP_CEILING = 0x93, + NOUN_TRAP_DOOR = 0x94, + NOUN_TURN_OFF = 0x95, + NOUN_TURN_ON = 0x96, + NOUN_UNLOCK = 0x97, + NOUN_URN = 0x98, + NOUN_WALK_ACROSS = 0x99, + NOUN_WALK_DOWN = 0x9A, + NOUN_WALK_THROUGH = 0x9B, + NOUN_WALK_UP = 0x9C, + NOUN_WALL = 0x9D, + NOUN_WARDROBE = 0x9E, + NOUN_WASTE_BASKET = 0x9F, + NOUN_WATER_PIPE = 0xA0, + NOUN_WEAR = 0xA1, + NOUN_WEDDING_RING = 0xA2, + NOUN_YELLOW_FRAME = 0xA3, + NOUN_PROP = 0xA4, + NOUN_CLIMB_UP = 0xA5, + NOUN_WALK_ONTO = 0xA6, + NOUN_WALK = 0xA7, + NOUN_LEFT_DOOR = 0xA8, + NOUN_RIGHT_DOOR = 0xA9, + NOUN_DOOR_TO_PIT = 0xAA, + NOUN_HEADPHONES = 0xAB, + NOUN_BOXES = 0xAC, + NOUN_MUG = 0xAD, + NOUN_DINETTE_SET = 0xAE, + NOUN_BOX = 0xAF, + NOUN_CASES = 0xB0, + NOUN_TRASH_BUCKET = 0xB1, + NOUN_CORK_BOARD = 0xB2, + NOUN_HEADSET = 0xB3, + NOUN_GRAND_FOYER = 0xB4, + NOUN_BACK_WALL = 0xB5, + NOUN_BALLET_BAR = 0xB6, + NOUN_THROW_RUGS = 0xB7, + NOUN_COSTUME_RACK = 0xB8, + NOUN_COAT_RACK = 0xB9, + NOUN_PAINTINGS = 0xBA, + NOUN_UMBRELLA = 0xBB, + NOUN_SHELF = 0xBC, + NOUN_CONTAINER = 0xBD, + NOUN_TORN_POSTER = 0xBE, + NOUN_REVIEW = 0xBF, + NOUN_REVIEWS = 0xC0, + NOUN_STAGE_RIGHT_WING = 0xC1, + NOUN_STAGE_LEFT_WING = 0xC2, + NOUN_PEDESTAL = 0xC3, + NOUN_PLANT_PROP = 0xC4, + NOUN_STATUE = 0xC5, + NOUN_BATTEN = 0xC6, + NOUN_BIG_PROP = 0xC7, + NOUN_VENTILATION_DUCT = 0xC8, + NOUN_CHANDELIER = 0xC9, + NOUN_BARRIER = 0xCA, + NOUN_PLACARD = 0xCB, + NOUN_TICKET_WINDOW = 0xCC, + NOUN_ARCHWAY = 0xCD, + NOUN_COLUMN = 0xCE, + NOUN_RAIL = 0xCF, + NOUN_SEAT = 0xD0, + NOUN_LOGE_CORRIDOR = 0xD1, + NOUN_HOUSE_LIGHT = 0xD2, + NOUN_FLOV = 0xD3, + NOUN_LEFT_COLUMN = 0xD4, + NOUN_RIGHT_COLUMN = 0xD5, + NOUN_BOOKCASE = 0xD6, + NOUN_DOORWAY = 0xD7, + NOUN_COMFY_CHAIR = 0xD8, + NOUN_DESK = 0xD9, + NOUN_MANAGERS_CHAIR = 0xDA, + NOUN_DESK_LAMP = 0xDB, + NOUN_WINDOW = 0xDC, + NOUN_SHEERS = 0xDD, + NOUN_TAPESTRY = 0xDE, + NOUN_OVERDOOR_MEDALLION = 0xDF, + NOUN_LATTICEWORK = 0xE0, + NOUN_DECORATIVE_MOLDING = 0xE1, + NOUN_LEFT_DOORWAY = 0xE2, + NOUN_LEFT_ARCHWAY = 0xE3, + NOUN_RIGHT_DOORWAY = 0xE4, + NOUN_RIGHT_ARCHWAY = 0xE5, + NOUN_SOFA = 0xE6, + NOUN_END_TABLE = 0xE7, + NOUN_COFFEE_TABLE = 0xE8, + NOUN_DECORATIVE_VASE = 0xE9, + NOUN_MARBLE_COLUMN = 0xEA, + NOUN_BOX_FIVE = 0xEB, + NOUN_ENTER = 0xEC, + NOUN_BOX_SIX = 0xED, + NOUN_BOX_SEVEN = 0xEE, + NOUN_BOX_EIGHT = 0xEF, + NOUN_BOX_NINE = 0xF0, + NOUN_STEP = 0xF1, + NOUN_PANEL = 0xF2, + NOUN_WALK_BEHIND = 0xF3, + NOUN_MIDDLE_DOORWAY = 0xF4, + NOUN_LIGHT = 0xF5, + NOUN_CANDLE = 0xF6, + NOUN_CASE = 0xF7, + NOUN_HANDLE = 0xF8, + NOUN_AXE = 0xF9, + NOUN_DOOR_CHUNKS = 0xFA, + NOUN_FLO = 0xFB, + NOUN_BULLETIN_BOARD = 0xFC, + NOUN_JULIE = 0xFD, + NOUN_GLASS_CASE = 0xFE, + NOUN_KEYHOLE = 0xFF, + NOUN_MIDDLE_DOOR = 0x100, + NOUN_DRESSING_GOWN = 0x101, + NOUN_MONSIEUR_BRIE = 0x102, + NOUN_CATWALK = 0x103, + NOUN_GRID = 0x104, + NOUN_GIRDER = 0x105, + NOUN_GRIDWORK = 0x106, + NOUN_DUCTWORK = 0x107, + NOUN_OPENING = 0x108, + NOUN_DOME = 0x109, + NOUN_ALCOVE = 0x10A, + NOUN_CHRISTINE_DAAE = 0x10B, + NOUN_CHRISTINE = 0x10C, + NOUN_WOMAN = 0x10D, + NOUN_PROMPTERS_STAND = 0x10E, + NOUN_SUPPORT = 0x10F, + NOUN_OTHER_CATWALK = 0x110, + NOUN_SLOT = 0x111, + NOUN_BEAM_POSITION = 0x112, + NOUN_LIGHTING_INSTRUMENT = 0x113, + NOUN_TARP = 0x114, + NOUN_FACE = 0x115, + NOUN_CATWALK_OVER_HOUSE = 0x116, + NOUN_STAIRCASE_POST = 0x117, + NOUN_JACQUES = 0x118, + NOUN_GENTLEMAN = 0x119, + NOUN_BODY = 0x11A, + NOUN_HOLLOW_COLUMN = 0x11B, + NOUN_UPPER_LEVEL = 0x11C, + NOUN_MIDDLE_LEVEL = 0x11D, + NOUN_LOWER_LEVEL = 0x11E, + NOUN_LADDER = 0x11F, + NOUN_CLIMB = 0x120, + NOUN_CHANDELIER_TRAP = 0x121, + NOUN_PIECE_OF_WOOD = 0x122, + NOUN_CUT_HEMP = 0x123, + NOUN_STONE_WALL = 0x124, + NOUN_LAKE = 0x125, + NOUN_STONE_COLUMN = 0x126, + NOUN_EXIT_THROUGH = 0x127, + NOUN_STONE_FLOOR = 0x128, + NOUN_STONE_ARCHWAY = 0x129, + NOUN_CHARLES = 0x12A, + NOUN_SWITCH = 0x12B, + NOUN_PROMPTERS_SEAT = 0x12C, + NOUN_LEVER = 0x12D, + NOUN_MONSIEUR_RICHARD = 0x12E, + NOUN_JULIE2 = 0x12F, + NOUN_CABLE_HOOK = 0x130, + NOUN_ATTACH = 0x131, + NOUN_ROPE_WITH_HOOK = 0x132, + NOUN_GRAPPLE = 0x133, + NOUN_OAR = 0x134, + NOUN_ORGAN = 0x135, + NOUN_SIT_AT = 0x136, + NOUN_ORGAN_BENCH = 0x137, + NOUN_SIT_ON = 0x138, + NOUN_LARGE_CHAIR = 0x139, + NOUN_SIT_IN = 0x13A, + NOUN_SARCOPHAGUS = 0x13B, + NOUN_SKULL = 0x13C, + NOUN_SKULLS = 0x13D, + NOUN_TOTEM = 0x13E, + NOUN_POLE = 0x13F, + NOUN_CURTAIN = 0x140, + NOUN_TORCH = 0x141, + NOUN_RAMP = 0x142, + NOUN_MADAME_GIRY = 0x143, + NOUN_PANELS = 0x144, + NOUN_MORE_CATACOMBS = 0x145, + NOUN_BLOCKED_ARCHWAY = 0x146, + NOUN_GRATE = 0x147, + NOUN_CATACOMBS = 0x148, + NOUN_TICKET_SELLER = 0x149, + NOUN_USHER = 0x14A, + NOUN_UNLUCKY_ADVENTURER = 0x14B, + NOUN_SWITCH_PANEL = 0x14C, + NOUN_SKULL_SWITCH = 0x14D, + NOUN_TOGGLE = 0x14E, + NOUN_CATACOMB_ROOM = 0x14F, + NOUN_BOX_TEN = 0x150, + NOUN_FOYER = 0x151, + NOUN_WALK_DOWN_STAIRCASE = 0x152, + NOUN_WALK_DOWN_STAIRS_TO = 0x153, + NOUN_HAT_RACK = 0x154, + NOUN_VASE = 0x155, + NOUN_CLOTHES_DUMMY = 0x156, + NOUN_NOTICES = 0x157, + NOUN_ARCHWAY_TO_NORTH = 0x158, + NOUN_ARCHWAY_TO_WEST = 0x159, + NOUN_ARCHWAY_TO_EAST = 0x15A, + NOUN_GATE = 0x15B, + NOUN_NEST = 0x15C, + NOUN_POT = 0x15D, + NOUN_PUDDLE = 0x15E, + NOUN_WEB = 0x15F, + NOUN_PLANK = 0x160, + NOUN_BLOCK = 0x161, + NOUN_RATS_NEST = 0x162, + NOUN_BROKEN_POT = 0x163, + NOUN_STONE = 0x164, + NOUN_DRAIN = 0x165, + NOUN_FATE = 0x166, + NOUN_SKULL_SWITCH_1 = 0x167, + NOUN_SKULL_SWITCH_2 = 0x168, + NOUN_SKULL_SWITCH_3 = 0x169, + NOUN_SKULL_SWITCH_4 = 0x16A, + NOUN_SKULL_SWITCH_5 = 0x16B, + NOUN_SKULL_SWITCH_6 = 0x16C, + NOUN_SKULL_SWITCH_7 = 0x16D, + NOUN_SKULL_SWITCH_8 = 0x16E, + NOUN_SKULL_SWITCH_9 = 0x16F, + NOUN_SKULL_SWITCH_10 = 0x170, + NOUN_SKULL_SWITCH_11 = 0x171, + NOUN_SKULL_SWITCH_12 = 0x172, + NOUN_SKULL_SWITCH_13 = 0x173, + NOUN_SKULL_SWITCH_14 = 0x174, + NOUN_SKULL_SWITCH_15 = 0x175, + NOUN_SKULL_SWITCH_16 = 0x176, + NOUN_SKULL_SWITCH_17 = 0x177, + NOUN_SKULL_SWITCH_18 = 0x178, + NOUN_SKULL_SWITCH_19 = 0x179, + NOUN_SKULL_SWITCH_20 = 0x17A, + NOUN_SKULL_SWITCH_21 = 0x17B, + NOUN_SKULL_SWITCH_22 = 0x17C, + NOUN_SKULL_SWITCH_23 = 0x17D, + NOUN_SKULL_SWITCH_24 = 0x17E, + NOUN_SKULL_SWITCH_25 = 0x17F, + NOUN_SKULL_SWITCH_26 = 0x180, + NOUN_EDGAR_DEGAS = 0x181, + NOUN_CHANDELIER_CABLE = 0x182, + NOUN_COB_WEB = 0x183, + NOUN_SKULL_FACE = 0x184, + NOUN_BOAT = 0x185, + NOUN_HOOK = 0x186, + NOUN_AROUND = 0x187, + NOUN_CANE = 0x188, + NOUN_MASK = 0x189, + NOUN_COVER = 0x18A, + NOUN_PADLOCK = 0x18B, + NOUN_LID = 0x18C, + NOUN_COBWEB = 0x18D, + NOUN_PHANTOM = 0x18E, + NOUN_PAPER = 0x18F }; class SceneFactory { -- cgit v1.2.3 From 5e1eaaa6f3aac17348d640666c4d0757714e9460 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 20 May 2014 13:10:12 +0300 Subject: MADS: Add nouns for Dragonsphere --- engines/mads/dragonsphere/dragonsphere_scenes.h | 575 +++++++++++++++++++++++- 1 file changed, 573 insertions(+), 2 deletions(-) diff --git a/engines/mads/dragonsphere/dragonsphere_scenes.h b/engines/mads/dragonsphere/dragonsphere_scenes.h index d6af608b19..2d23381d25 100644 --- a/engines/mads/dragonsphere/dragonsphere_scenes.h +++ b/engines/mads/dragonsphere/dragonsphere_scenes.h @@ -35,8 +35,579 @@ namespace MADS { namespace Dragonsphere { enum Noun { - VERB_LOOK_AT = 0x0D1 - // TODO + NOUN_GAME = 0x1, + NOUN_QSAVE = 0x2, + NOUN_LOOK = 0x3, + NOUN_TAKE = 0x4, + NOUN_PUSH = 0x5, + NOUN_OPEN = 0x6, + NOUN_PUT = 0x7, + NOUN_TALK_TO = 0x8, + NOUN_GIVE = 0x9, + NOUN_PULL = 0xA, + NOUN_CLOSE = 0xB, + NOUN_THROW = 0xC, + NOUN_WALK_TO = 0xD, + NOUN_NOTHING = 0xE, + NOUN_ = 0xF, + NOUN_FLOOR = 0x10, + NOUN_WALK_ACROSS = 0x11, + NOUN_RUG = 0x12, + NOUN_CARPET = 0x13, + NOUN_WALL = 0x14, + NOUN_BED = 0x15, + NOUN_PILLOW = 0x16, + NOUN_CHEST = 0x17, + NOUN_WINDOW = 0x18, + NOUN_NIGHTSTAND = 0x19, + NOUN_TAPESTRY = 0x1A, + NOUN_DRESSING_SCREEN = 0x1B, + NOUN_WALK_BEHIND = 0x1C, + NOUN_ROYAL_CREST = 0x1D, + NOUN_LOOK_AT = 0x1E, + NOUN_WASHBASIN = 0x1F, + NOUN_WASH_AT = 0x20, + NOUN_BOOK = 0x21, + NOUN_FIREPLACE = 0x22, + NOUN_FIREPLACE_SCREEN = 0x23, + NOUN_DOOR_TO_QUEENS_ROOM = 0x24, + NOUN_WALK_THROUGH = 0x25, + NOUN_HALL_TO_SOUTH = 0x26, + NOUN_WALK_INTO = 0x27, + NOUN_WALL_PLAQUE = 0x28, + NOUN_DECORATION = 0x29, + NOUN_SWORDS = 0x2A, + NOUN_WALL_SCONCE = 0x2B, + NOUN_BUST_ON_WALL = 0x2C, + NOUN_WALL_ARCH = 0x2D, + NOUN_SIGNET_RING = 0x2E, + NOUN_INVOKE = 0x2F, + NOUN_POLISH = 0x30, + NOUN_GANGBANG = 0x31, + NOUN_BIRD_FIGURINE = 0x32, + NOUN_RUB = 0x33, + NOUN_BIRDCALL = 0x34, + NOUN_USE = 0x35, + NOUN_MAKE_NOISE = 0x36, + NOUN_SHIELDSTONE = 0x37, + NOUN_SWORD = 0x38, + NOUN_ATTACK = 0x39, + NOUN_CARVE_UP = 0x3A, + NOUN_GOBLET = 0x3B, + NOUN_FILL = 0x3C, + NOUN_DRINK_FROM = 0x3D, + NOUN_BONE = 0x3E, + NOUN_GNAW = 0x3F, + NOUN_FRUIT = 0x40, + NOUN_EAT = 0x41, + NOUN_DOLL = 0x42, + NOUN_PLAY_WITH = 0x43, + NOUN_HEAL = 0x44, + NOUN_HEAL_THYSELF = 0x45, + NOUN_HEAL_SELF = 0x46, + NOUN_POLYSTONE = 0x47, + NOUN_MIMIC = 0x48, + NOUN_RED_POWERSTONE = 0x49, + NOUN_YELLOW_POWERSTONE = 0x4A, + NOUN_BLUE_POWERSTONE = 0x4B, + NOUN_KEY_CROWN = 0x4C, + NOUN_WEAR = 0x4D, + NOUN_DATES = 0x4E, + NOUN_STATUE = 0x4F, + NOUN_BOTTLE_OF_FLIES = 0x50, + NOUN_LISTEN_TO = 0x51, + NOUN_SOUL_EGG = 0x52, + NOUN_BREAK = 0x53, + NOUN_MAGIC_BELT = 0x54, + NOUN_ADJUST = 0x55, + NOUN_AMULET = 0x56, + NOUN_THRUST = 0x57, + NOUN_MUD = 0x58, + NOUN_FEEL = 0x59, + NOUN_TASTE = 0x5A, + NOUN_FEATHERS = 0x5B, + NOUN_TICKLE = 0x5C, + NOUN_TORCH = 0x5D, + NOUN_WAVE = 0x5E, + NOUN_FLASK = 0x5F, + NOUN_FLASK_FULL_OF_ACID = 0x60, + NOUN_POUR_CONTENTS = 0x61, + NOUN_POUR = 0x62, + NOUN_POUR_CONTENTS_OF = 0x63, + NOUN_DRINK = 0x64, + NOUN_ROPE = 0x65, + NOUN_TIE = 0x66, + NOUN_POWER_VACUUM_STONE = 0x67, + NOUN_TAKE_MAGIC_FROM = 0x68, + NOUN_DEAD_RAT = 0x69, + NOUN_PET = 0x6A, + NOUN_MAP = 0x6B, + NOUN_FOLD = 0x6C, + NOUN_CRYSTAL_BALL = 0x6D, + NOUN_GAZE_INTO = 0x6E, + NOUN_INVOKE_POWER_OF = 0x6F, + NOUN_BLACK_SPHERE = 0x70, + NOUN_SOPTUS_SOPORIFIC = 0x71, + NOUN_SHIFTER_RING = 0x72, + NOUN_SHIFT_SELF = 0x73, + NOUN_SHIFT_INTO_BEAR = 0x74, + NOUN_SHIFT_INTO_SEAL = 0x75, + NOUN_SHIFT_INTO_SNAKE = 0x76, + NOUN_REVERT = 0x77, + NOUN_MEDICINE_BUNDLE = 0x78, + NOUN_SHAKE = 0x79, + NOUN_PARTLY_BUILT_BUNDLE = 0x7A, + NOUN_RATSICLE = 0x7B, + NOUN_LICK = 0x7C, + NOUN_TENTACLE_PARTS = 0x7D, + NOUN_CHEW = 0x7E, + NOUN_TELEPORT_DOOR = 0x7F, + NOUN_UNROLL = 0x80, + NOUN_RARE_COIN = 0x81, + NOUN_ADMIRE = 0x82, + NOUN_CRYSTAL_FLOWER = 0x83, + NOUN_DIAMOND_DUST = 0x84, + NOUN_RUBY_RING = 0x85, + NOUN_GOLD_NUGGET = 0x86, + NOUN_MAGIC_MUSIC_BOX = 0x87, + NOUN_EMERALD = 0x88, + NOUN_PIECE_OF_PAPER = 0x89, + NOUN_SPEAK_WORDS_ON = 0x8A, + NOUN_VORTEX_STONE = 0x8B, + NOUN_RUG2 = 0x8C, + NOUN_FIREPLACE_SCREEN2 = 0x8D, + NOUN_BUST_ON_WALL2 = 0x8E, + NOUN_LOOK_AT2 = 0x8F, + NOUN_DRAGON = 0x90, + NOUN_DRAGONSPHERE = 0x91, + NOUN_TOUCH = 0x92, + NOUN_THRONE_ROOM = 0x93, + NOUN_RETURN_TO = 0x94, + NOUN_CAVE = 0x95, + NOUN_PASSAGEWAY_TO_WEST = 0x96, + NOUN_PASSAGEWAY_TO_EAST = 0x97, + NOUN_CAVE_FLOOR = 0x98, + NOUN_STONE_COLUMN = 0x99, + NOUN_ABYSS = 0x9A, + NOUN_LOOK_INTO = 0x9B, + NOUN_CASTLE = 0x9C, + NOUN_CASTLE_GATE = 0x9D, + NOUN_GROUND = 0x9E, + NOUN_BARREL = 0x9F, + NOUN_BARRELS = 0xA0, + NOUN_HAYSTACK = 0xA1, + NOUN_ROOT_THROUGH = 0xA2, + NOUN_BATTLEMENTS = 0xA3, + NOUN_GATE_TO_THRONE_ROOM = 0xA4, + NOUN_CASTLE_WALL = 0xA5, + NOUN_DOOR = 0xA6, + NOUN_WALL_SWITCH = 0xA7, + NOUN_STAIRS = 0xA8, + NOUN_WALK_DOWN = 0xA9, + NOUN_EDGE_OF_ABYSS = 0xAA, + NOUN_COURTYARD = 0xAB, + NOUN_ROCK = 0xAC, + NOUN_CAVE_CEILING = 0xAD, + NOUN_CAVE_WALL = 0xAE, + NOUN_BRAZIER = 0xAF, + NOUN_DOOR_TO_THRONE_ROOM = 0xB0, + NOUN_GO_THROUGH = 0xB1, + NOUN_DINING_TABLE = 0xB2, + NOUN_ACTIVATE = 0xB3, + NOUN_BATTLEMENT = 0xB4, + NOUN_DOOR_TO_GAURDROOM = 0xB5, + NOUN_DUNGEON_FLOOR = 0xB6, + NOUN_DUNGEON_WALLS = 0xB7, + NOUN_DUNGEON_CEILING = 0xB8, + NOUN_BEDDING = 0xB9, + NOUN_FLOOR_GRATE = 0xBA, + NOUN_MANACLES = 0xBB, + NOUN_CALENDAR = 0xBC, + NOUN_DOOR_TO_GUARDROOM = 0xBD, + NOUN_DOOR_TO_COUNCIL_ROOM = 0xBE, + NOUN_GUARD_STATION = 0xBF, + NOUN_DOOR_TO_DUNGEON_CELL = 0xC0, + NOUN_DOORWAY_TO_CELL = 0xC1, + NOUN_DUNGEON_DOOR = 0xC2, + NOUN_DUNGEON_WALL = 0xC3, + NOUN_CEILING = 0xC4, + NOUN_DOOR_TO_HALLWAY = 0xC5, + NOUN_TABLE = 0xC6, + NOUN_BOOKSHELF = 0xC7, + NOUN_TROPHY = 0xC8, + NOUN_READING_BENCH = 0xC9, + NOUN_CHAIR = 0xCA, + NOUN_LOVESEAT = 0xCB, + NOUN_WOOD_BASKET = 0xCC, + NOUN_STOOL = 0xCD, + NOUN_GUARD_STOOL = 0xCE, + NOUN_ROCKS = 0xCF, + NOUN_DIVIDING_WALL = 0xD0, + NOUN_ARCHWAY = 0xD1, + NOUN_MARKET_GROUNDS = 0xD2, + NOUN_HEDGE = 0xD3, + NOUN_SKY = 0xD4, + NOUN_PLAINS = 0xD5, + NOUN_FIELDS = 0xD6, + NOUN_GATE_TO_COURTYARD = 0xD7, + NOUN_ROAD_TO_EAST = 0xD8, + NOUN_TREES = 0xD9, + NOUN_CLOUDS = 0xDA, + NOUN_MERCHANTS_STALL = 0xDB, + NOUN_WELL = 0xDC, + NOUN_DOWN_WELL = 0xDD, + NOUN_GO = 0xDE, + NOUN_GO_DOWN = 0xDF, + NOUN_CRANK = 0xE0, + NOUN_BUCKET = 0xE1, + NOUN_JUMP_DOWN = 0xE2, + NOUN_WALLS = 0xE3, + NOUN_DOORWAY_TO_SOUTH = 0xE4, + NOUN_PEDESTAL = 0xE5, + NOUN_DOOR_TO_NORTH = 0xE6, + NOUN_PAINTING = 0xE7, + NOUN_DOCUMENT = 0xE8, + NOUN_INK_BOTTLE = 0xE9, + NOUN_QUILL_PEN = 0xEA, + NOUN_CHANDELIER = 0xEB, + NOUN_COUNCIL_TABLE = 0xEC, + NOUN_CANDLESTICK = 0xED, + NOUN_DESK = 0xEE, + NOUN_TURN = 0xEF, + NOUN_POLE = 0xF0, + NOUN_THE_SCENE = 0xF1, + NOUN_LEAVE = 0xF2, + NOUN_END_TABLE = 0xF3, + NOUN_BATTLE_AXES = 0xF4, + NOUN_DOOR_TO_KINGS_ROOM = 0xF5, + NOUN_COAT_OF_ARMS = 0xF6, + NOUN_LARGE_WINDOW = 0xF7, + NOUN_SMALL_WINDOW = 0xF8, + NOUN_DOOR_TO_MEETING_ROOM = 0xF9, + NOUN_DOOR_TO_BALLROOM = 0xFA, + NOUN_FLOWERS = 0xFB, + NOUN_SHUTTERS = 0xFC, + NOUN_BOOKCASE = 0xFD, + NOUN_DOOR_TO_COURTYARD = 0xFE, + NOUN_PLATFORM = 0xFF, + NOUN_STEP = 0x100, + NOUN_RED_CARPET = 0x101, + NOUN_KINGS_THRONE = 0x102, + NOUN_SIT_IN = 0x103, + NOUN_QUEENS_THRONE = 0x104, + NOUN_TRAPDOOR = 0x105, + NOUN_GRATE = 0x106, + NOUN_RIVER = 0x107, + NOUN_DIARIES = 0x108, + NOUN_SWIM_DOWN = 0x109, + NOUN_SCULLERY_MAID = 0x10A, + NOUN_DOORWAY_TO_DUNGEON = 0x10B, + NOUN_WARD = 0x10C, + NOUN_DARKNESS_BEAST = 0x10D, + NOUN_BEAST = 0x10E, + NOUN_PUT_MAGIC_INTO = 0x10F, + NOUN_GUARD = 0x110, + NOUN_CROWN = 0x111, + NOUN_BOOKS = 0x112, + NOUN_SECRET_DOOR = 0x113, + NOUN_WALL_PANEL = 0x114, + NOUN_DOORWAY = 0x115, + NOUN_FAERIE = 0x116, + NOUN_SOPTUS_ECLIPTUS = 0x117, + NOUN_GUARD_CAPTAIN = 0x118, + NOUN_MERCHANT = 0x119, + NOUN_SHAPECHANGER = 0x11A, + NOUN_RED_STONE = 0x11B, + NOUN_YELLOW_STONE = 0x11C, + NOUN_BLUE_STONE = 0x11D, + NOUN_FLIES = 0x11E, + NOUN_FLASK_OF_ACID = 0x11F, + NOUN_PARTIAL_BUNDLE = 0x120, + NOUN_SOPORIFIC = 0x121, + NOUN_PARCHMENT = 0x122, + NOUN_KING = 0x123, + NOUN_MACMORN = 0x124, + NOUN_MOUNTAINSIDE = 0x125, + NOUN_PATH_TO_SOUTH = 0x126, + NOUN_ROUGH_STONE = 0x127, + NOUN_CLIMB_UP = 0x128, + NOUN_LARGE_ROCK = 0x129, + NOUN_SMALL_ROCK = 0x12A, + NOUN_PATH_TO_WEST = 0x12B, + NOUN_CAVE_ENTRANCE = 0x12C, + NOUN_PALLET = 0x12D, + NOUN_BLANKET = 0x12E, + NOUN_FIREPIT = 0x12F, + NOUN_FLAT_STONE = 0x130, + NOUN_MOVE = 0x131, + NOUN_SPIRIT_BUNDLE = 0x132, + NOUN_TRAIL_LEADING_UP = 0x133, + NOUN_FOLLOW = 0x134, + NOUN_TRAIL_LEADING_DOWN = 0x135, + NOUN_NEST = 0x136, + NOUN_REACH_IN = 0x137, + NOUN_TRAIL_LEADING_WEST = 0x138, + NOUN_PATH_TO_EAST = 0x139, + NOUN_WATERFALL = 0x13A, + NOUN_PUDDLE = 0x13B, + NOUN_EDGE_OF_CLIFF = 0x13C, + NOUN_LEDGE = 0x13D, + NOUN_CLIMB_DOWN = 0x13E, + NOUN_LANDING = 0x13F, + NOUN_BOULDERS = 0x140, + NOUN_ROCK_TUMBLE = 0x141, + NOUN_ROCK_TREE = 0x142, + NOUN_PILLAR = 0x143, + NOUN_JUMP_TO = 0x144, + NOUN_CLIFF = 0x145, + NOUN_PILLARS = 0x146, + NOUN_SPECIAL_ROCK = 0x147, + NOUN_GAZE_UPON = 0x148, + NOUN_SCONCE = 0x149, + NOUN_LADDER = 0x14A, + NOUN_STAIRWAY = 0x14B, + NOUN_MECHANISM = 0x14C, + NOUN_SPEARHEADS = 0x14D, + NOUN_TRAP_DOOR = 0x14E, + NOUN_SWIM = 0x14F, + NOUN_DOWN_RIVER = 0x150, + NOUN_SWIM_UP = 0x151, + NOUN_UP_RIVER = 0x152, + NOUN_SHORE = 0x153, + NOUN_SWIM_TO = 0x154, + NOUN_SWIM_TOWARDS = 0x155, + NOUN_KING_CALLASH = 0x156, + NOUN_KINGS_THRONE2 = 0x157, + NOUN_KING2 = 0x158, + NOUN_GROTTO = 0x159, + NOUN_CLIMB_THROUGH = 0x15A, + NOUN_QUEEN_MOTHER = 0x15B, + NOUN_MACMORN2 = 0x15C, + NOUN_SMALL_LEDGE = 0x15D, + NOUN_MACMORN3 = 0x15E, + NOUN_TO_110 = 0x15F, + NOUN_TO_KITTY_HEAVEN = 0x160, + NOUN_KITTY_HEAVEN = 0x161, + NOUN_ROOM_110 = 0x162, + NOUN_LLANIE = 0x163, + NOUN_CW = 0x164, + NOUN_HERMIT = 0x165, + NOUN_TROU = 0x166, + NOUN_SHAK = 0x167, + NOUN_ROOM_501 = 0x168, + NOUN_MOON = 0x169, + NOUN_UFO = 0x16A, + NOUN_SIT_ON = 0x16B, + NOUN_STRANGER = 0x16C, + NOUN_TOWER_DOOR = 0x16D, + NOUN_DOOR_TO_EAST = 0x16E, + NOUN_DOOR_TO_WEST = 0x16F, + NOUN_EYE = 0x170, + NOUN_DOORWAY_TO_EAST = 0x171, + NOUN_DOORWAY_TO_WEST = 0x172, + NOUN_SKULL = 0x173, + NOUN_DOOR_TO_MAGIC_ROOM = 0x174, + NOUN_ANCIENT_BARREL = 0x175, + NOUN_COBWEBS = 0x176, + NOUN_SHELF = 0x177, + NOUN_MUSTY_CHART = 0x178, + NOUN_LAB_TABLE = 0x179, + NOUN_PETCOCK = 0x17A, + NOUN_NOZZLE = 0x17B, + NOUN_TUBING = 0x17C, + NOUN_BEAKER = 0x17D, + NOUN_FLAME = 0x17E, + NOUN_METAL_PLATE = 0x17F, + NOUN_SHAFT_OF_LIGHT = 0x180, + NOUN_CABINET = 0x181, + NOUN_BALANCE = 0x182, + NOUN_CAGE = 0x183, + NOUN_FREEZER = 0x184, + NOUN_CONTENTS_OF_FREEZER = 0x185, + NOUN_CAGE_WITH_RATS = 0x186, + NOUN_DOOR_TO_SOUTH = 0x187, + NOUN_TRAIL_OF_GREEN_SLIME = 0x188, + NOUN_NECK_LOCK = 0x189, + NOUN_BENCH = 0x18A, + NOUN_SKELETON = 0x18B, + NOUN_LEG_CLAMPS = 0x18C, + NOUN_LEG_LOCK = 0x18D, + NOUN_WAIST_LOCK = 0x18E, + NOUN_NER_TOM = 0x18F, + NOUN_BELT = 0x190, + NOUN_JUMP_INTO = 0x191, + NOUN_CLOSET = 0x192, + NOUN_DOOR_TO_EYE_CHAMBER = 0x193, + NOUN_DRESSER = 0x194, + NOUN_SCROLL = 0x195, + NOUN_WITCH_PARAPHERNALIA = 0x196, + NOUN_SHELVES = 0x197, + NOUN_MAGIC_TOMES = 0x198, + NOUN_MAGIC_PARAPHERNALIA = 0x199, + NOUN_BOOK_OF_MAGIC = 0x19A, + NOUN_HOURGLASS = 0x19B, + NOUN_STONE_SPHERE = 0x19C, + NOUN_SHADOW_OF_WINDOW = 0x19D, + NOUN_MUSIC_BOX = 0x19E, + NOUN_LARGE_SPIDER_WEB = 0x19F, + NOUN_INFERNAL_MACHINE = 0x1A0, + NOUN_WATER_SOURCE = 0x1A1, + NOUN_FLOW_OF_WATER = 0x1A2, + NOUN_RETORT = 0x1A3, + NOUN_DOORWAY_TO_CORRIDOR = 0x1A4, + NOUN_TELESCOPE = 0x1A5, + NOUN_STRANGE_MAP = 0x1A6, + NOUN_CIRCLE_OF_SPHERES = 0x1A7, + NOUN_STONE_BED = 0x1A8, + NOUN_DRAGON_SCULPTURE = 0x1A9, + NOUN_RAT = 0x1AA, + NOUN_RAT_CAGE = 0x1AB, + NOUN_DOWN_BUTTON = 0x1AC, + NOUN_DOOR_TO_MACHINE_ROOM = 0x1AD, + NOUN_STRANGE_PORTAL = 0x1AE, + NOUN_DOOR_FRAME = 0x1AF, + NOUN_ELEVATOR_HOLE = 0x1B0, + NOUN_UP_BUTTON = 0x1B1, + NOUN_DOORWAY_TO_DARK_ROOM = 0x1B2, + NOUN_BIG_SKULL = 0x1B3, + NOUN_ELEVATOR_PLATFORM = 0x1B4, + NOUN_BUTTON = 0x1B5, + NOUN_TOP_BUTTON = 0x1B6, + NOUN_BOTTOM_BUTTON = 0x1B7, + NOUN_TELEPORTAL = 0x1B8, + NOUN_EYE_CHAMBER_DOORWAY = 0x1B9, + NOUN_MACHINE_ROOM_DOORWAY = 0x1BA, + NOUN_GLOWING_FLOOR = 0x1BB, + NOUN_BRYNN_FANN = 0x1BC, + NOUN_GRAN_CALLAHACH = 0x1BD, + NOUN_SLATHAN_NI_PATAN = 0x1BE, + NOUN_HIGHTOWER = 0x1BF, + NOUN_SOPTUS_ECLIPTUS2 = 0x1C0, + NOUN_TOWER = 0x1C1, + NOUN_MOUNTAIN_PATH = 0x1C2, + NOUN_PATH_BEHIND_TOWER = 0x1C3, + NOUN_VINES = 0x1C4, + NOUN_SLATHAN_NI_PATAN2 = 0x1C5, + NOUN_SICK = 0x1C6, + NOUN_PATH_AROUND_TOWER = 0x1C7, + NOUN_PATH_TO_HIGHTOWER = 0x1C8, + NOUN_SPIRIT_PLANE = 0x1C9, + NOUN_SPIRIT_TREE = 0x1CA, + NOUN_WALK = 0x1CB, + NOUN_REMAINS = 0x1CC, + NOUN_DOORWAY_TO_ELEVATOR = 0x1CD, + NOUN_DRAGON_DOOR = 0x1CE, + NOUN_DRAGON_BONES = 0x1CF, + NOUN_IRON_FLOOR = 0x1D0, + NOUN_HOLE = 0x1D1, + NOUN_STONE = 0x1D2, + NOUN_HOMEMADE_BUNDLE = 0x1D3, + NOUN_LEFT = 0x1D4, + NOUN_RIGHT = 0x1D5, + NOUN_UP = 0x1D6, + NOUN_DOWN = 0x1D7, + NOUN_WEST = 0x1D8, + NOUN_DESERT_TO_WEST = 0x1D9, + NOUN_CROSS = 0x1DA, + NOUN_DESERT_TO_EAST = 0x1DB, + NOUN_DESERT_TO_SOUTH = 0x1DC, + NOUN_DESERT_TO_NORTH = 0x1DD, + NOUN_DESERT = 0x1DE, + NOUN_POWERSTONE = 0x1DF, + NOUN_BONES = 0x1E0, + NOUN_TENT = 0x1E1, + NOUN_BUSH = 0x1E2, + NOUN_SANWE = 0x1E3, + NOUN_TANGLE = 0x1E4, + NOUN_SAND = 0x1E5, + NOUN_MAGIC_GRAPES = 0x1E6, + NOUN_ROCS_NEST = 0x1E7, + NOUN_GRAPE_VINE = 0x1E8, + NOUN_STRANGE_SQUARE = 0x1E9, + NOUN_WATER_SPHERE = 0x1EA, + NOUN_EAST_END_OF_ISLAND = 0x1EB, + NOUN_ISLAND = 0x1EC, + NOUN_SECRET_MESSAGE = 0x1ED, + NOUN_FIND = 0x1EE, + NOUN_SAND_NEAR_STONES = 0x1EF, + NOUN_DESERT_SKY = 0x1F0, + NOUN_POOL = 0x1F1, + NOUN_PALM_TREE = 0x1F2, + NOUN_OASIS = 0x1F3, + NOUN_LEAN_TO = 0x1F4, + NOUN_TRADER = 0x1F5, + NOUN_SIGN = 0x1F6, + NOUN_WATER_FLOW = 0x1F7, + NOUN_FLOATING_DISK = 0x1F8, + NOUN_GNARLED_ROOT = 0x1F9, + NOUN_SNAKE_PIT = 0x1FA, + NOUN_MARKER = 0x1FB, + NOUN_SHAMAN = 0x1FC, + NOUN_GUARDHOUSE = 0x1FD, + NOUN_BONE_TREE = 0x1FE, + NOUN_EAR_ROCK = 0x1FF, + NOUN_MOUTH_ROCK = 0x200, + NOUN_NOSE_ROCK = 0x201, + NOUN_NEW_BUNDLE = 0x202, + NOUN_LIZARD = 0x203, + NOUN_ROC = 0x204, + NOUN_ROCS_NEST2 = 0x205, + NOUN_SELECT = 0x206, + NOUN_PURPLE_GEM = 0x207, + NOUN_PURPLE_STONE = 0x208, + NOUN_GREEN_STONE = 0x209, + NOUN_PATH = 0x20A, + NOUN_GUARDS = 0x20B, + NOUN_LAMP = 0x20C, + NOUN_SCIMITAR = 0x20D, + NOUN_SITTING_PILLOW = 0x20E, + NOUN_WATER_GOURD = 0x20F, + NOUN_JAR = 0x210, + NOUN_TENT_POLE = 0x211, + NOUN_EXIT = 0x212, + NOUN_PARAPHERNALIA = 0x213, + NOUN_SLATHAN_NI_PATAN3 = 0x214, + NOUN_EYE_ROCK = 0x215, + NOUN_BODY_TREE = 0x216, + NOUN_CLEARING = 0x217, + NOUN_TENTACLES = 0x218, + NOUN_SPELL_SHIELD = 0x219, + NOUN_POOL_MONSTER = 0x21A, + NOUN_SHIFTER_BOULDER = 0x21B, + NOUN_DEAD_TREE = 0x21C, + NOUN_PIT = 0x21D, + NOUN_SHIFTER_VILLAGE = 0x21E, + NOUN_SLATHAN_SKY = 0x21F, + NOUN_SHIFTER = 0x220, + NOUN_WALK_AROUND = 0x221, + NOUN_WRECKED_BRIDGE = 0x222, + NOUN_SHACK = 0x223, + NOUN_WRECKED_SHACK = 0x224, + NOUN_WISE_SHIFTER = 0x225, + NOUN_GRASS = 0x226, + NOUN_ENTRANCE_TO_MAZE = 0x227, + NOUN_TOPIARY_TOAD = 0x228, + NOUN_BOULDER = 0x229, + NOUN_MUSHROOM = 0x22A, + NOUN_SLATHAN_SKY2 = 0x22B, + NOUN_GRETA = 0x22C, + NOUN_TREE_STUMP = 0x22D, + NOUN_SANCTUARY_WOODS = 0x22E, + NOUN_TOADS = 0x22F, + NOUN_DOOFUS = 0x230, + NOUN_SHIFTING_MONSTER = 0x231, + NOUN_SPRITE = 0x232, + NOUN_MAZE = 0x233, + NOUN_TOPIARY_TOADSTOOL = 0x234, + NOUN_TOPIARY_GARGOYLE = 0x235, + NOUN_TOPIARY_DRAGON = 0x236, + NOUN_GUARDIAN = 0x237, + NOUN_BUTTERFLY_KING = 0x238, + NOUN_ROBE = 0x239, + NOUN_CEDAR_CHEST = 0x23A, + NOUN_DRAGONSPHERE2 = 0x23B, + NOUN_PATH_TO_HIGHTOWER2 = 0x23C, + NOUN_CALIPH = 0x23D }; class SceneFactory { -- cgit v1.2.3 From 60b9876d8187d735ac933f5be2de61a9142115e2 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 20 May 2014 13:19:43 +0300 Subject: MADS: Add more friendly names for nouns --- engines/mads/nebular/nebular_scenes1.cpp | 12 ++++---- engines/mads/nebular/nebular_scenes3.cpp | 16 +++++----- engines/mads/nebular/nebular_scenes4.cpp | 34 +++++++++++----------- engines/mads/nebular/nebular_scenes5.cpp | 28 +++++++++--------- engines/mads/nebular/nebular_scenes6.cpp | 50 ++++++++++++++++---------------- engines/mads/nebular/nebular_scenes7.cpp | 18 ++++++------ engines/mads/nebular/nebular_scenes8.cpp | 20 ++++++------- 7 files changed, 89 insertions(+), 89 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 6492006d1e..ab7339851e 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -181,7 +181,7 @@ void Scene101::enter() { _globals._sequenceIndexes[11] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[11], false, 3, 0, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[11], 17, 17); _scene->_hotspots.activate(NOUN_CHAIR, false); - _chairHotspotId = _scene->_dynamicHotspots.add(0x47, 0x13F, -1, Common::Rect(159, 84, 159 + 33, 84 + 36)); + _chairHotspotId = _scene->_dynamicHotspots.add(NOUN_CHAIR, 0x13F, -1, Common::Rect(159, 84, 159 + 33, 84 + 36)); if (_scene->_priorSceneId == 112) sayDang(); } else { @@ -2887,11 +2887,11 @@ void Scene111::enter() { _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 1); - int idx = _scene->_dynamicHotspots.add(0x1F, 0xD1, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_BATS, 0xD1, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(-2, 0), FACING_NONE); - idx = _scene->_dynamicHotspots.add(0x1F, 0xD1, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); + idx = _scene->_dynamicHotspots.add(NOUN_BATS, 0xD1, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(-2, 0), FACING_NONE); - idx = _scene->_dynamicHotspots.add(0x1F, 0xD1, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); + idx = _scene->_dynamicHotspots.add(NOUN_BATS, 0xD1, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(-2, 0), FACING_NONE); _launch1Fl = false; @@ -2942,14 +2942,14 @@ void Scene111::step() { _scene->_sequences.remove(_globals._sequenceIndexes[4]); _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 5, 1, 0, 0); _launch1Fl = true; - int idx = _scene->_dynamicHotspots.add(0x1F, 0xD1, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_BATS, 0xD1, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(-2, 0), FACING_NONE); } if (!_launched2Fl && (_vm->getRandomNumber(1, 30000) == 1)) { _scene->_sequences.remove(_globals._sequenceIndexes[5]); _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 5, 1, 0, 0); - int idx = _scene->_dynamicHotspots.add(0x1F, 0xD1, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_BATS, 0xD1, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(-2, 0), FACING_NONE); _launched2Fl = true; } diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 8209f0c1da..4cf1a2da50 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -2518,7 +2518,7 @@ void Scene318::enter() { if (_game._objects.isInRoom(OBJ_SCALPEL)) { _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 6, 0, 0, 120); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 4); - _scene->_dynamicHotspots.add(0x12C, VERB_TAKE, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.add(NOUN_SCALPEL, VERB_TAKE, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); } if (_scene->_priorSceneId == 357) @@ -4058,7 +4058,7 @@ void Scene352::putArmDown(bool corridorExit, bool doorwayExit) { case 2: { _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 6, 0, 0, 0); - int idx = _scene->_dynamicHotspots.add(0x3B6, 0xD, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_GUARDS_ARM, 0xD, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(230, 117), FACING_NORTHWEST); _scene->changeVariant(0); } @@ -4139,7 +4139,7 @@ void Scene352::enter() { if (_game._objects.isInRoom(OBJ_TAPE_PLAYER)) { _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 12, 0, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 5); - int idx = _scene->_dynamicHotspots.add(0x165, 0xD, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_TAPE_PLAYER, 0xD, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); _tapePlayerHotspotIdx = _scene->_dynamicHotspots.setPosition(idx, Common::Point(84, 145), FACING_WEST); } @@ -4153,7 +4153,7 @@ void Scene352::enter() { if (_game._objects.isInRoom(OBJ_GUARDS_ARM)) { _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 6, 0, 0, 0); - int idx = _scene->_dynamicHotspots.add(0x3B6, 0xD, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_GUARDS_ARM, 0xD, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(230, 117), FACING_NORTHWEST); } else _mustPutArmDownFl = true; @@ -4405,7 +4405,7 @@ void Scene352::actions() { _vaultOpenFl = true; int idx; if (!_globals[kHaveYourStuff]) { - idx = _scene->_dynamicHotspots.add(0x2F4, 0xD, -1, Common::Rect(282, 87, 282 + 13, 87 + 7)); + idx = _scene->_dynamicHotspots.add(NOUN_YOUR_STUFF, 0xD, -1, Common::Rect(282, 87, 282 + 13, 87 + 7)); _hotspot2Idx = _scene->_dynamicHotspots.setPosition(idx, Common::Point(280, 111), FACING_NORTHEAST); _globals._sequenceIndexes[1] = _commonSequenceIdx; _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x102)); @@ -4414,9 +4414,9 @@ void Scene352::actions() { _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x103)); } - idx = _scene->_dynamicHotspots.add(0x2F5, 0xD, -1, Common::Rect(282, 48, 282 + 36, 48 + 27)); + idx = _scene->_dynamicHotspots.add(NOUN_OTHER_STUFF, 0xD, -1, Common::Rect(282, 48, 282 + 36, 48 + 27)); _hotspot1Idx = _scene->_dynamicHotspots.setPosition(idx, Common::Point(287, 115), FACING_NORTHEAST); - idx = _scene->_dynamicHotspots.add(0x2F6, 0xD, -1, Common::Rect(296, 76, 296 + 11, 76 + 17)); + idx = _scene->_dynamicHotspots.add(NOUN_LAMP, 0xD, -1, Common::Rect(296, 76, 296 + 11, 76 + 17)); _lampHostpotIdx = _scene->_dynamicHotspots.setPosition(idx, Common::Point(287, 115), FACING_NORTHEAST); _game._player._stepEnabled = true; } @@ -4833,7 +4833,7 @@ void Scene359::enter() { if (_game._objects.isInRoom(OBJ_SECURITY_CARD)) { _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 9, 0, 0, 0); - _cardHotspotId = _scene->_dynamicHotspots.add(0x131, 0xD, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + _cardHotspotId = _scene->_dynamicHotspots.add(NOUN_SECURITY_CARD, 0xD, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(_cardHotspotId, Common::Point(107, 107), FACING_SOUTH); } diff --git a/engines/mads/nebular/nebular_scenes4.cpp b/engines/mads/nebular/nebular_scenes4.cpp index 195bba577d..586d59d2b5 100644 --- a/engines/mads/nebular/nebular_scenes4.cpp +++ b/engines/mads/nebular/nebular_scenes4.cpp @@ -849,14 +849,14 @@ void Scene402::enter() { _globals._sequenceIndexes[14] = _scene->_sequences.startCycle(_globals._spriteIndexes[14], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[14], 7); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[14], Common::Point(210, 80)); - int idx = _scene->_dynamicHotspots.add(0x124, 0xD1, _globals._sequenceIndexes[14], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_REPAIR_LIST, 0xD1, _globals._sequenceIndexes[14], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(0, 0), FACING_NONE); } { _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 8); - int idx = _scene->_dynamicHotspots.add(0x30E, 0xD, _globals._sequenceIndexes[9], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_BARTENDER, 0xD, _globals._sequenceIndexes[9], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(228, 83), FACING_SOUTH); } @@ -864,7 +864,7 @@ void Scene402::enter() { _globals._sequenceIndexes[15] = _scene->_sequences.startCycle(_globals._spriteIndexes[15], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[15], 8); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[15], Common::Point(250, 80)); - int idx = _scene->_dynamicHotspots.add(0x5C, 0x4, _globals._sequenceIndexes[15], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_CREDIT_CHIP, 0x4, _globals._sequenceIndexes[15], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(0, 0), FACING_NONE); } @@ -926,7 +926,7 @@ void Scene402::step() { _globals._sequenceIndexes[10] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[10], false, 7, 0, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[10], 3, 4); _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 8); - int idx = _scene->_dynamicHotspots.add(0x30E, 0xD, _globals._sequenceIndexes[10], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_BARTENDER, 0xD, _globals._sequenceIndexes[10], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(228, 83), FACING_SOUTH); _bartenderTalking = true; if (_talkTimer > 1000) @@ -939,7 +939,7 @@ void Scene402::step() { if ((_game._trigger == 101) && _bartenderTalking) { _scene->_sequences.remove(_globals._sequenceIndexes[10]); _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 1); - int idx = _scene->_dynamicHotspots.add(0x30E, 0xD, _globals._sequenceIndexes[9], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_BARTENDER, 0xD, _globals._sequenceIndexes[9], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(228, 83), FACING_SOUTH); _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 8); _bartenderSteady = true; @@ -1068,7 +1068,7 @@ void Scene402::step() { _globals._sequenceIndexes[15] = _scene->_sequences.startCycle(_globals._spriteIndexes[15], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[15], 8); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[15], Common::Point(250, 80)); - int idx = _scene->_dynamicHotspots.add(0x5C, 0x4, _globals._sequenceIndexes[15], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_CREDIT_CHIP, 0x4, _globals._sequenceIndexes[15], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(0, 0), FACING_NONE); } break; @@ -1101,7 +1101,7 @@ void Scene402::step() { int seqIdx = _globals._sequenceIndexes[12]; _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 1); _bartenderSteady = true; - int idx = _scene->_dynamicHotspots.add(0x30E, 0xD, _globals._sequenceIndexes[9], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_BARTENDER, 0xD, _globals._sequenceIndexes[9], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(228, 83), FACING_SOUTH); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[9], seqIdx); _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 8); @@ -1179,7 +1179,7 @@ void Scene402::step() { case 91: { _scene->_sequences.remove(_globals._sequenceIndexes[9]); _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 1); - int idx = _scene->_dynamicHotspots.add(0x30E, 0xD, _globals._sequenceIndexes[9], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_BARTENDER, 0xD, _globals._sequenceIndexes[9], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(228, 83), FACING_SOUTH); _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 8); _bartenderSteady = true; @@ -1271,7 +1271,7 @@ void Scene402::step() { case 1: { _globals._sequenceIndexes[10] = _scene->_sequences.startCycle(_globals._spriteIndexes[10], false, 4); _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 8); - int idx = _scene->_dynamicHotspots.add(0x30E, 0xD, _globals._sequenceIndexes[10], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_BARTENDER, 0xD, _globals._sequenceIndexes[10], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(228, 83), FACING_SOUTH); _bartenderHandsHips = true; } @@ -1280,7 +1280,7 @@ void Scene402::step() { case 2: { _globals._sequenceIndexes[11] = _scene->_sequences.startCycle(_globals._spriteIndexes[11], false, 2); _scene->_sequences.setDepth(_globals._sequenceIndexes[11], 8); - int idx = _scene->_dynamicHotspots.add(0x30E, 0xD, _globals._sequenceIndexes[11], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_BARTENDER, 0xD, _globals._sequenceIndexes[11], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(228, 83), FACING_SOUTH); _bartenderLooksLeft = true; } @@ -1289,7 +1289,7 @@ void Scene402::step() { case 3: { _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 8); - int idx = _scene->_dynamicHotspots.add(0x30E, 0xD, _globals._sequenceIndexes[9], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_BARTENDER, 0xD, _globals._sequenceIndexes[9], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(228, 83), FACING_SOUTH); _bartenderSteady = true; } @@ -1582,7 +1582,7 @@ void Scene402::step() { _scene->_sequences.remove(_globals._sequenceIndexes[10]); _bartenderHandsHips = false; _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 1); - int idx = _scene->_dynamicHotspots.add(0x30E, 0xD, _globals._sequenceIndexes[9], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_BARTENDER, 0xD, _globals._sequenceIndexes[9], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(228, 83), FACING_SOUTH); _bartenderSteady = true; _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 8); @@ -1590,7 +1590,7 @@ void Scene402::step() { _scene->_sequences.remove(_globals._sequenceIndexes[11]); _bartenderLooksLeft = false; _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 1); - int idx = _scene->_dynamicHotspots.add(0x30E, 0xD, _globals._sequenceIndexes[9], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_BARTENDER, 0xD, _globals._sequenceIndexes[9], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(228, 83), FACING_SOUTH); _bartenderSteady = true; _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 8); @@ -2863,7 +2863,7 @@ void Scene408::enter() { if (_game._objects.isInRoom(OBJ_TARGET_MODULE)) { _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 3); - int idx = _scene->_dynamicHotspots.add(0x167, 0xD, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_TARGET_MODULE, 0xD, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(283, 128), FACING_NORTHEAST); } sceneEntrySound(); @@ -3557,21 +3557,21 @@ void Scene411::enter() { if (_game._objects.isInRoom(OBJ_FORMALDEHYDE)) { _globals._sequenceIndexes[7] = _scene->_sequences.startCycle(_globals._spriteIndexes[7], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 1); - int idx = _scene->_dynamicHotspots.add(0x2D6, VERB_WALKTO, _globals._sequenceIndexes[7], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_FORMALDEHYDE, VERB_WALKTO, _globals._sequenceIndexes[7], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(206, 145), FACING_SOUTHEAST); } if (_game._objects.isInRoom(OBJ_PETROX)) { _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 8); - int idx = _scene->_dynamicHotspots.add(0x2D7, VERB_WALKTO, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_PETROX, VERB_WALKTO, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(186, 112), FACING_NORTHEAST); } if (_game._objects.isInRoom(OBJ_LECITHIN)) { _globals._sequenceIndexes[6] = _scene->_sequences.startCycle(_globals._spriteIndexes[6], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 8); - int idx = _scene->_dynamicHotspots.add(0x3A9, VERB_WALKTO, _globals._sequenceIndexes[6], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_LECITHIN, VERB_WALKTO, _globals._sequenceIndexes[6], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(220, 121), FACING_NORTHEAST); } diff --git a/engines/mads/nebular/nebular_scenes5.cpp b/engines/mads/nebular/nebular_scenes5.cpp index fb79492b1c..1ad29a39a4 100644 --- a/engines/mads/nebular/nebular_scenes5.cpp +++ b/engines/mads/nebular/nebular_scenes5.cpp @@ -166,7 +166,7 @@ void Scene501::enter() { } _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); - int idx = _scene->_dynamicHotspots.add(0x6E, 0x18B, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_DOOR, 0x18B, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); _doorHotspotid = _scene->_dynamicHotspots.setPosition(idx,Common::Point(282, 110), FACING_NORTH); _scene->_dynamicHotspots.setCursor(_doorHotspotid, CURSOR_GO_UP); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 7); @@ -233,7 +233,7 @@ void Scene501::step() { _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 9, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 7); _vm->_sound->command(12); - _doorHotspotid = _scene->_dynamicHotspots.add(0x6E, 0x18B, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); + _doorHotspotid = _scene->_dynamicHotspots.add(NOUN_DOOR, 0x18B, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(_globals._sequenceIndexes[3], Common::Point(282, 110), FACING_NORTH); _scene->_dynamicHotspots.setCursor(_doorHotspotid, CURSOR_GO_UP); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 83); @@ -540,7 +540,7 @@ void Scene503::enter() { if (_game._objects[OBJ_DETONATORS]._roomNumber == _scene->_currentSceneId) { _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 9, 0, 0, 0); - _detonatorHotspotId = _scene->_dynamicHotspots.add(0x6A, 0xD, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + _detonatorHotspotId = _scene->_dynamicHotspots.add(NOUN_DETONATORS, 0xD, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(_detonatorHotspotId, Common::Point(254, 135), FACING_SOUTH); } @@ -1111,12 +1111,12 @@ void Scene506::enter() { _globals._spriteIndexes[4] = _scene->_sprites.addSprites("*RXCD_3"); _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); - int idx = _scene->_dynamicHotspots.add(0x37D, 0x242, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_LABORATORY, 0x242, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); int hotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(65, 125), FACING_NORTHWEST); _scene->_dynamicHotspots.setCursor(hotspotId, CURSOR_GO_LEFT); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 1); - idx = _scene->_dynamicHotspots.add(0x336, 0x242, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); + idx = _scene->_dynamicHotspots.add(NOUN_SOFTWARE_STORE, 0x242, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); hotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(112, 102), FACING_NORTHWEST); _scene->_dynamicHotspots.setCursor(hotspotId, CURSOR_GO_LEFT); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 13); @@ -1371,7 +1371,7 @@ void Scene507::enter() { if ((_game._difficulty != DIFFICULTY_EASY) && (_game._objects[OBJ_PENLIGHT]._roomNumber == _scene->_currentSceneId)) { _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 9, 0, 0, 0); - _penlightHotspotId = _scene->_dynamicHotspots.add(0x106, VERB_WALKTO, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + _penlightHotspotId = _scene->_dynamicHotspots.add(NOUN_PENLIGHT, VERB_WALKTO, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(_penlightHotspotId, Common::Point(233, 152), FACING_SOUTHEAST); } @@ -1495,7 +1495,7 @@ void Scene508::enter() { _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -2); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 8); _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, -2); - int idx = _scene->_dynamicHotspots.add(0x343, VERB_WALKTO, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_LASER_BEAM, VERB_WALKTO, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(57, 116), FACING_NORTHEAST); _scene->_hotspots.activate(NOUN_HOLE, false); _scene->_hotspots.activate(NOUN_LASER_BEAM, false); @@ -1505,7 +1505,7 @@ void Scene508::enter() { _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 8); _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, -2); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 11); - int idx = _scene->_dynamicHotspots.add(0x343, VERB_WALKTO, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_LASER_BEAM, VERB_WALKTO, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(57, 116), FACING_NORTHEAST); _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 15, 0, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 6, 8); @@ -1640,7 +1640,7 @@ void Scene508::actions() { _vm->_sound->command(22); _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, -2); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 11); - int idx = _scene->_dynamicHotspots.add(0x343, VERB_WALKTO, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_LASER_BEAM, VERB_WALKTO, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(57, 116), FACING_NORTHEAST); _scene->_kernelMessages.reset(); _scene->changeVariant(1); @@ -1748,7 +1748,7 @@ void Scene511::enter() { _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 3); _scene->_hotspots.activate(NOUN_BOAT, false); - int idx = _scene->_dynamicHotspots.add(0x345, VERB_WALKTO, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_BOAT, VERB_WALKTO, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(75, 124), FACING_NORTH); _scene->_hotspots.activate(NOUN_ROPE, false); } else { @@ -1779,7 +1779,7 @@ void Scene511::enter() { if (_globals[kLineStatus] == 2 || _globals[kLineStatus] == 3) { _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('b', 4)); _globals._sequenceIndexes[7] = _scene->_sequences.startCycle(_globals._spriteIndexes[7], false, frame); - int idx = _scene->_dynamicHotspots.add(0x87, VERB_WALKTO, _globals._sequenceIndexes[7], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_FISHING_LINE, VERB_WALKTO, _globals._sequenceIndexes[7], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(26, 153), FACING_NORTHEAST); _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 3); if (_globals[kBoatRaised]) @@ -1981,7 +1981,7 @@ void Scene511::actions() { _game._player._priorTimer = _scene->_frameStartTime - _game._player._ticksAmount; _globals._sequenceIndexes[7] = _scene->_sequences.startCycle(_globals._spriteIndexes[7], false, -2); _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 4); - int idx = _scene->_dynamicHotspots.add(0x87, VERB_WALKTO, _globals._sequenceIndexes[7], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_FISHING_LINE, VERB_WALKTO, _globals._sequenceIndexes[7], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(26, 153), FACING_NORTHEAST); _game._objects.removeFromInventory(OBJ_FISHING_LINE, 1); _handingLine = false; @@ -2069,7 +2069,7 @@ void Scene512::enter() { if (_game._objects[OBJ_FISHING_ROD]._roomNumber == _scene->_currentSceneId) { _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 9, 0, 0, 0); - _fishingRodHotspotId = _scene->_dynamicHotspots.add(0x88, VERB_WALKTO, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + _fishingRodHotspotId = _scene->_dynamicHotspots.add(NOUN_FISHING_ROD, VERB_WALKTO, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(_fishingRodHotspotId, Common::Point(199, 101), FACING_NORTHEAST); } @@ -2081,7 +2081,7 @@ void Scene512::enter() { if (_game._objects[OBJ_PADLOCK_KEY]._roomNumber == _scene->_currentSceneId) { _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 10, 0, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 3); - _keyHotspotId = _scene->_dynamicHotspots.add(0xFF, VERB_WALKTO, _globals._sequenceIndexes[6], Common::Rect(0, 0, 0, 0)); + _keyHotspotId = _scene->_dynamicHotspots.add(NOUN_PADLOCK_KEY, VERB_WALKTO, _globals._sequenceIndexes[6], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(_keyHotspotId, Common::Point(218, 152), FACING_NORTHEAST); } if (_globals[kRegisterOpen]) { diff --git a/engines/mads/nebular/nebular_scenes6.cpp b/engines/mads/nebular/nebular_scenes6.cpp index e9c4473f9e..53e187ab80 100644 --- a/engines/mads/nebular/nebular_scenes6.cpp +++ b/engines/mads/nebular/nebular_scenes6.cpp @@ -97,7 +97,7 @@ void Scene601::enter() { if (_globals[kLaserHoleIsThere]) { _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -2); - _scene->_dynamicHotspots.add(0x343, 0xD1, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.add(NOUN_LASER_BEAM, 0xD1, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); } _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1); @@ -240,7 +240,7 @@ void Scene602::enter() { _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 9); _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 9); - int idx = _scene->_dynamicHotspots.add(0x343, VERB_WALKTO, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_LASER_BEAM, VERB_WALKTO, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(80, 134), FACING_NORTHEAST); _scene->changeVariant(1); } else @@ -262,7 +262,7 @@ void Scene602::enter() { _lastSequenceIdx = _scene->_sequences.startCycle(_lastSpriteIdx, false, _cycleIndex); _scene->_sequences.setDepth(_lastSequenceIdx, 14); - int idx = _scene->_dynamicHotspots.add(0x3D3, VERB_WALKTO, _lastSequenceIdx, Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_SAFE, VERB_WALKTO, _lastSequenceIdx, Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(185, 113), FACING_NORTHWEST); if (_game._objects.isInRoom(OBJ_DOOR_KEY)) { @@ -346,7 +346,7 @@ void Scene602::handleSafeActions() { _lastSequenceIdx = _scene->_sequences.startCycle(_lastSpriteIdx, false, _cycleIndex); _scene->_sequences.setDepth(_lastSequenceIdx, 14); _scene->_sequences.updateTimeout(_lastSequenceIdx, synxIdx); - int idx = _scene->_dynamicHotspots.add(0x3D3, VERB_WALKTO, _lastSequenceIdx, Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_SAFE, VERB_WALKTO, _lastSequenceIdx, Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(185, 113), FACING_NORTHWEST); if (_safeMode == 3) { _scene->_kernelMessages.reset(); @@ -419,11 +419,11 @@ void Scene602::actions() { _lastSpriteIdx = _globals._spriteIndexes[3]; _lastSequenceIdx = _scene->_sequences.startCycle(_lastSpriteIdx, false, -1); _scene->_sequences.setDepth(_lastSequenceIdx, 14); - int idx = _scene->_dynamicHotspots.add(0x3D3, VERB_WALKTO, _lastSequenceIdx, Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_SAFE, VERB_WALKTO, _lastSequenceIdx, Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(185, 113), FACING_NORTHWEST); _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 9); - idx = _scene->_dynamicHotspots.add(0x343, VERB_WALKTO, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); + idx = _scene->_dynamicHotspots.add(NOUN_LASER_BEAM, VERB_WALKTO, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(80, 134), FACING_NORTHEAST); _scene->_sequences.addTimer(60, 2); } @@ -544,7 +544,7 @@ void Scene603::enter() { _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('c', -1)); _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -1); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); - _compactCaseHotspotId = _scene->_dynamicHotspots.add(0x57, VERB_WALKTO, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + _compactCaseHotspotId = _scene->_dynamicHotspots.add(NOUN_COMPACT_CASE, VERB_WALKTO, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(_compactCaseHotspotId, Common::Point(250, 152), FACING_SOUTHEAST); } @@ -553,7 +553,7 @@ void Scene603::enter() { _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('p', -1)); _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14); - _noteHotspotId = _scene->_dynamicHotspots.add(0x3A8, VERB_WALKTO, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); + _noteHotspotId = _scene->_dynamicHotspots.add(NOUN_NOTE, VERB_WALKTO, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(_noteHotspotId, Common::Point(242, 118), FACING_NORTHEAST); } @@ -688,7 +688,7 @@ void Scene604::enter() { if (_globals[kTimebombStatus] == 1) { _globals._sequenceIndexes[6] = _scene->_sequences.startCycle(_globals._spriteIndexes[6], false, -1); - _timebombHotspotId = _scene->_dynamicHotspots.add(0x171, VERB_WALKTO, _globals._sequenceIndexes[6], Common::Rect(0, 0, 0, 0)); + _timebombHotspotId = _scene->_dynamicHotspots.add(NOUN_TIMEBOMB, VERB_WALKTO, _globals._sequenceIndexes[6], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(_timebombHotspotId, Common::Point(166, 118), FACING_NORTHEAST); } @@ -820,7 +820,7 @@ void Scene604::handleBombActions() { case 1: _globals._sequenceIndexes[6] = _scene->_sequences.startCycle(_globals._spriteIndexes[6], false, -1); - _timebombHotspotId = _scene->_dynamicHotspots.add(0x171, VERB_WALKTO, _globals._sequenceIndexes[6], Common::Rect(0, 0, 0, 0)); + _timebombHotspotId = _scene->_dynamicHotspots.add(NOUN_TIMEBOMB, VERB_WALKTO, _globals._sequenceIndexes[6], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(_timebombHotspotId, Common::Point(166, 118), FACING_NORTHEAST); _game._objects.setRoom(OBJ_TIMEBOMB, _scene->_currentSceneId); break; @@ -1429,7 +1429,7 @@ void Scene608::setup() { void Scene608::resetDogVariables() { _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 1); - int idx = _scene->_dynamicHotspots.add(0x471, VERB_WALKTO, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_OBNOXIOUS_DOG, VERB_WALKTO, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(194, 142), FACING_EAST); _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 4); _dogBarkingFl = false; @@ -1542,7 +1542,7 @@ void Scene608::enter() { if (_game._objects.isInRoom(OBJ_POLYCEMENT)) { _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('g', -1)); _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); - int idx = _scene->_dynamicHotspots.add(0x115, VERB_WALKTO, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_POLYCEMENT, VERB_WALKTO, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); _polycementHotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(249, 129), FACING_NORTHEAST); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 6); } @@ -1550,7 +1550,7 @@ void Scene608::enter() { if (_game._objects.isInRoom(OBJ_REARVIEW_MIRROR)) { _globals._spriteIndexes[12] = _scene->_sprites.addSprites(formAnimName('m', -1)); _globals._sequenceIndexes[12] = _scene->_sequences.startCycle(_globals._spriteIndexes[12], false, 1); - int idx = _scene->_dynamicHotspots.add(0x120, VERB_WALKTO, _globals._sequenceIndexes[12], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_REARVIEW_MIRROR, VERB_WALKTO, _globals._sequenceIndexes[12], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(71, 113), FACING_NORTHEAST); _scene->_sequences.setDepth(_globals._sequenceIndexes[12], 15); } @@ -1594,14 +1594,14 @@ void Scene608::enter() { _carMode = 0; _dogDeathMode = 0; _resetPositionsFl = false; - int idx = _scene->_dynamicHotspots.add(0x324, VERB_WALKTO, -1, Common::Rect(99, 69, 99 + 82, 69 + 25)); + int idx = _scene->_dynamicHotspots.add(NOUN_CAR, VERB_WALKTO, -1, Common::Rect(99, 69, 99 + 82, 69 + 25)); _carHotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(96, 132), FACING_NORTHEAST); _scene->loadAnimation(formAnimName('A', -1)); } else if (_globals[kCarStatus] == 3) { _carMode = 0; _dogDeathMode = 0; _resetPositionsFl = false; - int idx = _scene->_dynamicHotspots.add(0x324, VERB_WALKTO, -1, Common::Rect(100, 100, 100 + 82, 100 + 25)); + int idx = _scene->_dynamicHotspots.add(NOUN_CAR, VERB_WALKTO, -1, Common::Rect(100, 100, 100 + 82, 100 + 25)); _carHotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(96, 132), FACING_NORTHEAST); _scene->loadAnimation(formAnimName('A', -1)); _scene->_activeAnimation->setCurrentFrame(6); @@ -1609,21 +1609,21 @@ void Scene608::enter() { _carMode = 2; _dogDeathMode = 0; _resetPositionsFl = false; - int idx = _scene->_dynamicHotspots.add(0x324, VERB_WALKTO, -1, Common::Rect(99, 69, 99 + 82, 69 + 25)); + int idx = _scene->_dynamicHotspots.add(NOUN_CAR, VERB_WALKTO, -1, Common::Rect(99, 69, 99 + 82, 69 + 25)); _carHotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(96, 132), FACING_NORTHEAST); _scene->loadAnimation(formAnimName('C', -1)); } else if (_globals[kCarStatus] == 2) { _carMode = 1; _dogDeathMode = 2; _resetPositionsFl = true; - int idx = _scene->_dynamicHotspots.add(0x324, VERB_WALKTO, -1, Common::Rect(99, 69, 99 + 82, 69 + 25)); + int idx = _scene->_dynamicHotspots.add(NOUN_CAR, VERB_WALKTO, -1, Common::Rect(99, 69, 99 + 82, 69 + 25)); _carHotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(96, 132), FACING_NORTHEAST); _scene->loadAnimation(formAnimName('B', -1)); } else { _carMode = 3; _dogDeathMode = 2; _resetPositionsFl = true; - int idx = _scene->_dynamicHotspots.add(0x324, VERB_WALKTO, -1, Common::Rect(100, 100, 100 + 82, 100 + 25)); + int idx = _scene->_dynamicHotspots.add(NOUN_CAR, VERB_WALKTO, -1, Common::Rect(100, 100, 100 + 82, 100 + 25)); _carHotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(96, 132), FACING_NORTHEAST); _scene->loadAnimation(formAnimName('D', -1)); } @@ -1688,7 +1688,7 @@ void Scene608::step() { _scene->_sequences.remove(_globals._sequenceIndexes[5]); _globals._sequenceIndexes[5] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[5], false, 5, 8, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 4); - int idx = _scene->_dynamicHotspots.add(0x471, VERB_WALKTO, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_OBNOXIOUS_DOG, VERB_WALKTO, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(194, 142), FACING_EAST); _barkCount = 0; _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_SPRITE, 2, 100); @@ -2140,7 +2140,7 @@ void Scene608::actions() { _scene->_sequences.addTimer(1, 2); else { _scene->_dynamicHotspots.remove(_carHotspotId); - int idx = _scene->_dynamicHotspots.add(0x324, VERB_WALKTO, -1, Common::Rect(100, 100, 100 + 82, 100 + 25)); + int idx = _scene->_dynamicHotspots.add(NOUN_CAR, VERB_WALKTO, -1, Common::Rect(100, 100, 100 + 82, 100 + 25)); _carHotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(96, 132), FACING_NORTHEAST); if (_globals[kCarStatus] == 1) _scene->_sequences.addTimer(120, 3); @@ -2208,7 +2208,7 @@ void Scene608::actions() { _dogDeathMode = 2; } _scene->_dynamicHotspots.remove(_carHotspotId); - int idx = _scene->_dynamicHotspots.add(0x324, VERB_WALKTO, -1, Common::Rect(99, 69, 99 + 82, 69 + 25)); + int idx = _scene->_dynamicHotspots.add(NOUN_CAR, VERB_WALKTO, -1, Common::Rect(99, 69, 99 + 82, 69 + 25)); _carHotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(96, 132), FACING_NORTHEAST); _game._player._stepEnabled = true; } @@ -2724,7 +2724,7 @@ void Scene610::enter() { if (_game._objects[OBJ_PHONE_HANDSET]._roomNumber == _scene->_currentSceneId) { _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 9, 0, 0, 0); - _handsetHotspotId = _scene->_dynamicHotspots.add(0x108, VERB_WALKTO, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + _handsetHotspotId = _scene->_dynamicHotspots.add(NOUN_PHONE_HANDSET, VERB_WALKTO, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(_handsetHotspotId, Common::Point(132, 121), FACING_NORTHWEST); if ((_globals[kHandsetCellStatus] == 2) && (_game._difficulty == DIFFICULTY_HARD) && !_globals[kDurafailRecharged]) _globals[kHandsetCellStatus] = 1; @@ -2810,7 +2810,7 @@ void Scene610::actions() { case 1: _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 9, 0, 0, 0); - _handsetHotspotId = _scene->_dynamicHotspots.add(0x108, VERB_WALKTO, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + _handsetHotspotId = _scene->_dynamicHotspots.add(NOUN_PHONE_HANDSET, VERB_WALKTO, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(_handsetHotspotId, Common::Point(132, 121), FACING_NORTHWEST); _game._objects.setRoom(OBJ_PHONE_HANDSET, _scene->_currentSceneId); break; @@ -3808,7 +3808,7 @@ void Scene611::step() { } else if (_game._trigger == 81) { int syncId = _globals._sequenceIndexes[1]; _globals._sequenceIndexes[1] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 20, 0, 0, 0); - int idx = _scene->_dynamicHotspots.add(0x275, VERB_WALKTO, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_RAT, VERB_WALKTO, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); _ratHotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(272, 154), FACING_SOUTHEAST); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 9, 10); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[1], syncId); @@ -4329,7 +4329,7 @@ void Scene612::enter() { _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('f', -1)); _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, -1); _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 1); - int idx = _scene->_dynamicHotspots.add(0x87, VERB_WALKTO, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_FISHING_LINE, VERB_WALKTO, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(34, 117), FACING_SOUTHEAST); } diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index 5c1f7bfef7..541e22e99f 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -1168,7 +1168,7 @@ void Scene704::enter() { _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(190, 122)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 2); } - int idx = _scene->_dynamicHotspots.add(0x2D, 0xD1, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_BONES, 0xD1, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); _bottleHotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(-2, 0), FACING_NONE); } @@ -1730,7 +1730,7 @@ void Scene706::handleTakeVase() { _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 4); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(195, 99)); - int idx = _scene->_dynamicHotspots.add(0x2E, VERB_WALKTO, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_BOTTLE, VERB_WALKTO, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(175, 124), FACING_SOUTHEAST); _game._objects.setRoom(OBJ_BOTTLE, _scene->_currentSceneId); } @@ -1756,13 +1756,13 @@ void Scene706::enter() { _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('v', -1)); _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 4); - int idx = _scene->_dynamicHotspots.add(0x17D, VERB_WALKTO, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_VASE, VERB_WALKTO, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); _vaseHotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(175, 124), FACING_SOUTHEAST); } else if (_game._objects.isInRoom(OBJ_BOTTLE)) { _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 4); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(195, 99)); - int idx = _scene->_dynamicHotspots.add(0x2E, VERB_WALKTO, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_BOTTLE, VERB_WALKTO, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(175, 124), FACING_SOUTHEAST); } @@ -1836,7 +1836,7 @@ void Scene706::step() { _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 4); _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(195, 99)); - int idx = _scene->_dynamicHotspots.add(0x2E, VERB_WALKTO, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_BOTTLE, VERB_WALKTO, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(175, 124), FACING_SOUTHEAST); } } @@ -2101,7 +2101,7 @@ void Scene751::enter() { if (_globals[kLineStatus] == 2 || _globals[kLineStatus] == 3) { _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -1); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 7); - int idx = _scene->_dynamicHotspots.add(0x87, 0xD, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_FISHING_LINE, 0xD, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(268, 140), FACING_NORTHWEST); } @@ -2135,7 +2135,7 @@ void Scene751::enter() { } else if (_globals[kLineStatus] == 2) { _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -1); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 7); - int idx = _scene->_dynamicHotspots.add(0x87, 0xD, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_FISHING_LINE, 0xD, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(268, 140), FACING_NORTHWEST); } @@ -2359,7 +2359,7 @@ void Scene751::actions() { _game._player._visible = true; _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -1); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 7); - int idx = _scene->_dynamicHotspots.add(0x87, 0xD, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_FISHING_LINE, 0xD, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(268, 140), FACING_NORTHWEST); _scene->_kernelMessages.reset(); _game._objects.setRoom(OBJ_FISHING_LINE, _scene->_currentSceneId); @@ -2435,7 +2435,7 @@ void Scene752::enter() { _globals._spriteIndexes[13] = _scene->_sprites.addSprites(formAnimName('i', -1)); _globals._sequenceIndexes[13] = _scene->_sequences.startCycle(_globals._spriteIndexes[13], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[13], 8); - int idx = _scene->_dynamicHotspots.add(0xB3, VERB_WALKTO, _globals._sequenceIndexes[13], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_ID_CARD, VERB_WALKTO, _globals._sequenceIndexes[13], Common::Rect(0, 0, 0, 0)); _cardId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(234, 135), FACING_NORTH); } diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index e6f8701623..dc5a4cdd1d 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -353,14 +353,14 @@ void Scene802::enter() { if ((_globals[kRemoteOnGround]) && (!_game._objects.isInInventory(OBJ_REMOTE))) { _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 8); - int idx = _scene->_dynamicHotspots.add(0x123, 0xD,_globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_REMOTE, 0xD,_globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(107, 99), FACING_NORTH); } if (!_game._objects.isInInventory(OBJ_SHIELD_MODULATOR) && !_globals[kShieldModInstalled]) { _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 8); - int idx = _scene->_dynamicHotspots.add(0x137, 0xD, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_SHIELD_MODULATOR, 0xD, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(93, 97), FACING_NORTH); } sceneEntrySound(); @@ -378,7 +378,7 @@ void Scene802::step() { if (_game._trigger == 71) { _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 8); - int idx = _scene->_dynamicHotspots.add(0x123, 0xD, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_REMOTE, 0xD, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(107, 99), FACING_NORTH); _globals[kRemoteSequenceRan] = true; @@ -535,7 +535,7 @@ void Scene803::enter() { if (_globals[kHoppyDead]) { _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('e', 1)); _globals._sequenceIndexes[7] = _scene->_sequences.startCycle(_globals._spriteIndexes[7], false, 1); - int idx = _scene->_dynamicHotspots.add(0x472, 0xD, _globals._sequenceIndexes[7], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_GUTS, 0xD, _globals._sequenceIndexes[7], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(66, 123), FACING_SOUTH); } @@ -627,7 +627,7 @@ void Scene803::step() { _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5],SEQUENCE_TRIGGER_EXPIRE, 0, 101); } else { _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, -2); - int idx = _scene->_dynamicHotspots.add(0x472, 0xD, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_GUTS, 0xD, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(66, 123), FACING_SOUTH); _vm->_sound->command(16); _globals[kCameFromCut] = true; @@ -646,7 +646,7 @@ void Scene803::step() { if (_game._trigger == 101) { _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, -2); - int idx = _scene->_dynamicHotspots.add(0x472, 0xD, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_GUTS, 0xD, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(66, 123), FACING_SOUTH); _vm->_sound->command(16); _globals[kCameFromCut] = true; @@ -1075,14 +1075,14 @@ void Scene805::enter() { if (_globals[kShieldModInstalled]) { _scene->_hotspots.activate(OBJ_SHIELD_MODULATOR, false); _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 25); - int idx = _scene->_dynamicHotspots.add(0x137, 0x476, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_SHIELD_MODULATOR, 0x476, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(0, 0), FACING_DUMMY); } if (_globals[kTargetModInstalled]) { _scene->_hotspots.activate(OBJ_TARGET_MODULE, false); _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 12); - int idx = _scene->_dynamicHotspots.add(0x167, 0x476, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_TARGET_MODULE, 0x476, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(0, 0), FACING_DUMMY); } @@ -1093,7 +1093,7 @@ void Scene805::step() { if (_game._trigger == 70) { _scene->_hotspots.activate(OBJ_SHIELD_MODULATOR, false); _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 25); - int idx = _scene->_dynamicHotspots.add(0x137, 0x476, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_SHIELD_MODULATOR, 0x476, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(0, 0), FACING_DUMMY); _globals[kShieldModInstalled] = true; _game._objects.setRoom(OBJ_SHIELD_MODULATOR, NOWHERE); @@ -1104,7 +1104,7 @@ void Scene805::step() { if (_game._trigger == 80) { _scene->_hotspots.activate(OBJ_TARGET_MODULE, false); _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 12); - int idx = _scene->_dynamicHotspots.add(0x167, 0x476, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_TARGET_MODULE, 0x476, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(0, 0), FACING_DUMMY); _globals[kTargetModInstalled] = true; _game._objects.setRoom(OBJ_TARGET_MODULE, NOWHERE); -- cgit v1.2.3 From 1b34888b26d460cd7f36b6a5b280f931f97e6464 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 20 May 2014 13:52:23 +0300 Subject: MADS: Fix the GMM menu for V2 games --- engines/mads/dragonsphere/game_dragonsphere.h | 4 +++- engines/mads/phantom/game_phantom.h | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/engines/mads/dragonsphere/game_dragonsphere.h b/engines/mads/dragonsphere/game_dragonsphere.h index c5d6c0dd70..259c4168c1 100644 --- a/engines/mads/dragonsphere/game_dragonsphere.h +++ b/engines/mads/dragonsphere/game_dragonsphere.h @@ -91,7 +91,9 @@ enum InventoryObject { // HACK: A stub for now, remove from here once it's implemented properly class DragonsphereGlobals: public Globals { public: - DragonsphereGlobals() {} + DragonsphereGlobals() { + resize(210); // Rex has 210 globals + } virtual ~DragonsphereGlobals() {} }; diff --git a/engines/mads/phantom/game_phantom.h b/engines/mads/phantom/game_phantom.h index 600c5842a6..c99e81ee70 100644 --- a/engines/mads/phantom/game_phantom.h +++ b/engines/mads/phantom/game_phantom.h @@ -67,7 +67,10 @@ enum InventoryObject { // HACK: A stub for now, remove from here once it's implemented properly class PhantomGlobals: public Globals { public: - PhantomGlobals() {} + PhantomGlobals() { + resize(210); // Rex has 210 globals + } + virtual ~PhantomGlobals() {} }; class GamePhantom: public Game { -- cgit v1.2.3 From eb7d018b4acc4c0d0614ed185b632c618636d727 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 20 May 2014 14:31:10 +0300 Subject: MADS: Add a debug command to show messages --- engines/mads/debugger.cpp | 16 ++++++++++++++++ engines/mads/debugger.h | 1 + 2 files changed, 17 insertions(+) diff --git a/engines/mads/debugger.cpp b/engines/mads/debugger.cpp index 0b69ee81fb..9f5735f318 100644 --- a/engines/mads/debugger.cpp +++ b/engines/mads/debugger.cpp @@ -41,6 +41,7 @@ Debugger::Debugger(MADSEngine *vm) : GUI::Debugger(), _vm(vm) { DCmd_Register("show_quote", WRAP_METHOD(Debugger, Cmd_ShowQuote)); DCmd_Register("show_vocab", WRAP_METHOD(Debugger, Cmd_ShowVocab)); DCmd_Register("dump_vocab", WRAP_METHOD(Debugger, Cmd_DumpVocab)); + DCmd_Register("show_message", WRAP_METHOD(Debugger, Cmd_ShowMessage)); DCmd_Register("show_item", WRAP_METHOD(Debugger, Cmd_ShowItem)); DCmd_Register("dump_items", WRAP_METHOD(Debugger, Cmd_DumpItems)); DCmd_Register("item", WRAP_METHOD(Debugger, Cmd_Item)); @@ -244,6 +245,21 @@ bool Debugger::Cmd_DumpVocab(int argc, const char **argv) { return true; } +bool Debugger::Cmd_ShowMessage(int argc, const char **argv) { + if (argc != 2) { + DebugPrintf("Usage: %s \n", argv[0]); + } else { + int messageId = strToInt(argv[1]); + Common::StringArray msg = _vm->_game->getMessage(messageId); + for (uint idx = 0; idx < msg.size(); ++idx) { + Common::String srcLine = msg[idx]; + DebugPrintf("%s\n", srcLine.c_str()); + } + } + + return true; +} + bool Debugger::Cmd_ShowItem(int argc, const char **argv) { InventoryObjects &objects = _vm->_game->_objects; diff --git a/engines/mads/debugger.h b/engines/mads/debugger.h index 9059f3fc39..351eb13615 100644 --- a/engines/mads/debugger.h +++ b/engines/mads/debugger.h @@ -45,6 +45,7 @@ protected: bool Cmd_ShowQuote(int argc, const char **argv); bool Cmd_ShowVocab(int argc, const char **argv); bool Cmd_DumpVocab(int argc, const char **argv); + bool Cmd_ShowMessage(int argc, const char **argv); bool Cmd_ShowItem(int argc, const char **argv); bool Cmd_DumpItems(int argc, const char **argv); bool Cmd_Item(int argc, const char **argv); -- cgit v1.2.3 From 555b4dfd6e076dd5ef5cfc982fb5dbf3e211d198 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 20 May 2014 15:07:45 +0300 Subject: MADS: Load scene speech resources for V2 CD games --- engines/mads/resources.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/engines/mads/resources.cpp b/engines/mads/resources.cpp index 83077b602f..0d5aee1526 100644 --- a/engines/mads/resources.cpp +++ b/engines/mads/resources.cpp @@ -149,7 +149,7 @@ Common::SeekableReadStream *HagArchive::createReadStreamForMember(const Common:: void HagArchive::loadIndex(MADSEngine *vm) { Common::File hagFile; - for (int sectionIndex = -1; sectionIndex < 10; ++sectionIndex) { + for (int sectionIndex = -1; sectionIndex < 11; ++sectionIndex) { if (sectionIndex == 0) continue; @@ -167,6 +167,13 @@ void HagArchive::loadIndex(MADSEngine *vm) { Common::String filename = (sectionIndex == -1) ? "GLOBAL.HAG" : Common::String::format("SECTION%d.HAG", sectionIndex); + if (sectionIndex == 10) { + // Speech + if (!Common::File::exists("SPEECH.HAG")) + break; + else + filename = "SPEECH.HAG"; + } if (!hagFile.open(filename)) error("Could not locate HAG file - %s", filename.c_str()); -- cgit v1.2.3 From fc8e00b17a31b9013fc3509abf343e0ec614b0a2 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Tue, 20 May 2014 16:17:25 +0100 Subject: DRACI: Add missing _isPositionLoaded initialization. Fixes CID 1003405. --- engines/draci/game.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp index 4893b0fe34..e14ec4c986 100644 --- a/engines/draci/game.cpp +++ b/engines/draci/game.cpp @@ -63,6 +63,7 @@ Game::Game(DraciEngine *vm) : _vm(vm), _walkingState(vm) { _shouldQuit = 0; _shouldExitLoop = 0; _isReloaded = 0; + _isPositionLoaded = 0; _speechTick = 0; _speechDuration = 0; _objUnderCursor = 0; -- cgit v1.2.3 From 6804c085461fdaddf58e7885ed83b70662afbfae Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 20 May 2014 17:30:41 +0200 Subject: MADS: Fix compilation warning reported by digitall --- engines/mads/nebular/nebular_scenes3.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 4cf1a2da50..9237c62f48 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -2697,7 +2697,7 @@ void Scene318::step() { } uint32 tmpFrame = _vm->_events->getFrameCounter(); - uint32 diffFrame = tmpFrame - _lastFrameCounter; + long diffFrame = tmpFrame - _lastFrameCounter; _lastFrameCounter = tmpFrame; if ((_animMode == 2) && !_internVisibleFl && _game._player._stepEnabled) { -- cgit v1.2.3 From c494781645bcdadce84052798f6194eaaefc728c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 20 May 2014 19:48:08 +0200 Subject: MADS: Add synchronize where useful in scene group 5 --- engines/mads/nebular/nebular_scenes5.cpp | 82 ++++++++++++++++++++++++++++++-- engines/mads/nebular/nebular_scenes5.h | 13 +++-- 2 files changed, 88 insertions(+), 7 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes5.cpp b/engines/mads/nebular/nebular_scenes5.cpp index 1ad29a39a4..cc8cdbd9e0 100644 --- a/engines/mads/nebular/nebular_scenes5.cpp +++ b/engines/mads/nebular/nebular_scenes5.cpp @@ -530,6 +530,12 @@ void Scene503::setup() { _scene->addActiveVocab(VERB_WALKTO); } +void Scene503::synchronize(Common::Serializer &s) { + Scene5xx::synchronize(s); + + s.syncAsSint16LE(_detonatorHotspotId); +} + void Scene503::enter() { _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('c', -1)); @@ -650,6 +656,13 @@ void Scene504::setup() { setAAName(); } +void Scene504::synchronize(Common::Serializer &s) { + Scene5xx::synchronize(s); + + s.syncAsSint16LE(_carAnimationMode); + s.syncAsSint16LE(_carFrame); +} + void Scene504::enter() { _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('a', 2)); @@ -847,6 +860,19 @@ void Scene505::setup() { setAAName(); } +void Scene505::synchronize(Common::Serializer &s) { + Scene5xx::synchronize(s); + + s.syncAsSint16LE(_frame); + s.syncAsSint16LE(_nextButtonId); + s.syncAsSint16LE(_homeSelectedId); + s.syncAsSint16LE(_selectedId); + s.syncAsSint16LE(_activeCars); + + for (int i = 0; i < 9; i++) + s.syncAsSint16LE(_carLocations[i]); +} + void Scene505::enter() { for (int i = 0; i < 9; i++) _globals._spriteIndexes[i] = _scene->_sprites.addSprites(formAnimName('a', i + 1)); @@ -1104,6 +1130,24 @@ void Scene506::setup() { _scene->addActiveVocab(NOUN_LABORATORY); } +void Scene506::synchronize(Common::Serializer &s) { + Scene5xx::synchronize(s); + + s.syncAsSint16LE(_doorPos.x); + s.syncAsSint16LE(_doorPos.y); + + s.syncAsByte(_heroFacing); + + s.syncAsSint16LE(_doorDepth); + s.syncAsSint16LE(_doorSpriteIdx); + s.syncAsSint16LE(_doorSequenceIdx); + s.syncAsSint16LE(_doorWord); + + s.syncAsByte(_labDoorFl); + s.syncAsByte(_firstDoorFl); + s.syncAsByte(_actionFl); +} + void Scene506::enter() { _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('q', 0)); _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('q', 1)); @@ -1161,7 +1205,7 @@ void Scene506::step() { _doorWord = 0x37D; } } - room_506_door_sequences(); + handleDoorSequences(); } if (_game._trigger >= 70) { @@ -1191,7 +1235,7 @@ void Scene506::step() { } } -void Scene506::room_506_door_sequences() { +void Scene506::handleDoorSequences() { _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; if (_firstDoorFl) { @@ -1281,14 +1325,14 @@ void Scene506::actions() { _doorPos = Common::Point(16, 111); } _actionFl = true; - room_506_door_sequences(); + handleDoorSequences(); } else if (_action.isAction(VERB_WALK_INTO, NOUN_SOFTWARE_STORE)) { if (_firstDoorFl) { _heroFacing = FACING_NORTHWEST; _doorPos = Common::Point(80, 102); } _actionFl = true; - room_506_door_sequences(); + handleDoorSequences(); } else if (_action.isAction(VERB_GET_INTO, NOUN_CAR)) { switch (_game._trigger) { case 0: @@ -1365,6 +1409,12 @@ void Scene507::setup() { _scene->addActiveVocab(VERB_WALKTO); } +void Scene507::synchronize(Common::Serializer &s) { + Scene5xx::synchronize(s); + + s.syncAsSint16LE(_penlightHotspotId); +} + void Scene507::enter() { _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('p', -1)); _globals._spriteIndexes[2] = _scene->_sprites.addSprites("*RXMRD_3"); @@ -1477,6 +1527,12 @@ void Scene508::setup() { _scene->addActiveVocab(NOUN_LASER_BEAM); } +void Scene508::synchronize(Common::Serializer &s) { + Scene5xx::synchronize(s); + + s.syncAsSint16LE(_chosenObject); +} + void Scene508::enter() { _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('a', 0)); _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('m', 0)); @@ -1736,6 +1792,17 @@ void Scene511::setup() { _scene->addActiveVocab(VERB_WALKTO); } +void Scene511::synchronize(Common::Serializer &s) { + Scene5xx::synchronize(s); + + s.syncAsByte(_handingLine); + s.syncAsByte(_lineMoving); + + s.syncAsSint16LE(_lineAnimationMode); + s.syncAsSint16LE(_lineFrame); + s.syncAsSint16LE(_lineAnimationPosition); +} + void Scene511::enter() { _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('c', 0)); _globals._spriteIndexes[4] = _scene->_sprites.addSprites("*RXCD_6"); @@ -2058,6 +2125,13 @@ void Scene512::setup() { _scene->addActiveVocab(NOUN_REGISTER_DRAWER); } +void Scene512::synchronize(Common::Serializer &s) { + Scene5xx::synchronize(s); + + s.syncAsSint16LE(_fishingRodHotspotId); + s.syncAsSint16LE(_keyHotspotId); +} + void Scene512::enter() { _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('r', -1)); _globals._spriteIndexes[2] = _scene->_sprites.addSprites("*RXMRC_9"); diff --git a/engines/mads/nebular/nebular_scenes5.h b/engines/mads/nebular/nebular_scenes5.h index c49532dc8c..7c21fbaae1 100644 --- a/engines/mads/nebular/nebular_scenes5.h +++ b/engines/mads/nebular/nebular_scenes5.h @@ -86,6 +86,7 @@ private: public: Scene503(MADSEngine *vm) : Scene5xx(vm) {} + void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); @@ -99,6 +100,7 @@ private: public: Scene504(MADSEngine *vm) : Scene5xx(vm) {} + void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); @@ -119,6 +121,7 @@ private: public: Scene505(MADSEngine *vm) : Scene5xx(vm) {} + void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); @@ -128,8 +131,6 @@ public: class Scene506: public Scene5xx{ private: - int _actionFl; /* Flag to note daemon is running vs. parser */ - Common::Point _doorPos; Facing _heroFacing; @@ -140,11 +141,13 @@ private: bool _labDoorFl; bool _firstDoorFl; + bool _actionFl; - void room_506_door_sequences(); + void handleDoorSequences(); public: Scene506(MADSEngine *vm) : Scene5xx(vm) {} + void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); @@ -158,6 +161,7 @@ private: public: Scene507(MADSEngine *vm) : Scene5xx(vm) {} + void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); @@ -172,6 +176,7 @@ private: public: Scene508(MADSEngine *vm) : Scene5xx(vm) {} + void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); @@ -190,6 +195,7 @@ private: public: Scene511(MADSEngine *vm) : Scene5xx(vm) {} + void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); @@ -205,6 +211,7 @@ private: public: Scene512(MADSEngine *vm) : Scene5xx(vm) {} + void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); -- cgit v1.2.3 From d0c363524451fbdeee7459ca544eb26f20b4d789 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Tue, 20 May 2014 19:29:55 +0100 Subject: CONFIGURE: Fix information output for host-alias-strings test. Thanks to LordHoto for the amendment to surpress error output. --- configure | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 411403408b..ee97e17786 100755 --- a/configure +++ b/configure @@ -1843,10 +1843,13 @@ if test "$_global_constructors" = yes; then fi echo $_global_constructors -if test ! "x$(which $_host_alias-strings)" = "x"; then +echo_n "Checking for $_host_alias-strings... " +if test ! "x$(which $_host_alias-strings 2>/dev/null)" = "x"; then _strings=$_host_alias-strings +echo yes else _strings=strings +echo no fi # -- cgit v1.2.3 From 39068bb1eded8e4933701534eb19d559d45c63fd Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 20 May 2014 22:46:09 +0200 Subject: MADS: Add synchronize where useful in scene group 6 --- engines/mads/nebular/nebular_scenes6.cpp | 141 ++++++++++++++++++++++++++++++- engines/mads/nebular/nebular_scenes6.h | 11 ++- 2 files changed, 149 insertions(+), 3 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes6.cpp b/engines/mads/nebular/nebular_scenes6.cpp index 53e187ab80..6f802b22dc 100644 --- a/engines/mads/nebular/nebular_scenes6.cpp +++ b/engines/mads/nebular/nebular_scenes6.cpp @@ -225,6 +225,15 @@ void Scene602::setup() { _scene->addActiveVocab(NOUN_LASER_BEAM); } +void Scene602::synchronize(Common::Serializer &s) { + Scene6xx::synchronize(s); + + s.syncAsSint16LE(_lastSpriteIdx); + s.syncAsSint16LE(_lastSequenceIdx); + s.syncAsSint16LE(_cycleIndex); + s.syncAsSint16LE(_safeMode); +} + void Scene602::enter() { _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('h', -1)); _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 0)); @@ -538,6 +547,13 @@ void Scene603::setup() { _scene->addActiveVocab(NOUN_NOTE); } +void Scene603::synchronize(Common::Serializer &s) { + Scene6xx::synchronize(s); + + s.syncAsSint16LE(_compactCaseHotspotId); + s.syncAsSint16LE(_noteHotspotId); +} + void Scene603::enter() { if (_game._objects[OBJ_COMPACT_CASE]._roomNumber == _scene->_currentSceneId) { _globals._spriteIndexes[4] = _scene->_sprites.addSprites("*RXMRD_3"); @@ -680,6 +696,19 @@ void Scene604::setup() { _scene->addActiveVocab(NOUN_TIMEBOMB); } +void Scene604::synchronize(Common::Serializer &s) { + Scene6xx::synchronize(s); + + s.syncAsSint16LE(_timebombHotspotId); + s.syncAsSint16LE(_bombMode); + s.syncAsSint16LE(_monsterFrame); + + s.syncAsUint32LE(_monsterTimer); + + s.syncAsByte(_monsterActive); + s.syncAsByte(_animationActiveFl); +} + void Scene604::enter() { _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('c', 0)); _globals._spriteIndexes[4] = _scene->_sprites.addSprites("*RXCD_9"); @@ -992,6 +1021,22 @@ void Scene607::setup() { _scene->addActiveVocab(VERB_WALKTO); } +void Scene607::synchronize(Common::Serializer &s) { + Scene6xx::synchronize(s); + + s.syncAsUint32LE(_dogTimer); + s.syncAsUint32LE(_lastFrameTime); + + s.syncAsByte(_dogLoop); + s.syncAsByte(_dogEatsRex); + s.syncAsByte(_dogBarking); + s.syncAsByte(_shopAvailable); + + s.syncAsSint16LE(_animationMode); + s.syncAsSint16LE(_animationActive); + s.syncAsSint16LE(_counter); +} + void Scene607::enter() { _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('c', 0)); _globals._spriteIndexes[3] = _scene->_sprites.addSprites("*RXCD_3"); @@ -1427,6 +1472,40 @@ void Scene608::setup() { _scene->addActiveVocab(NOUN_OBNOXIOUS_DOG); } +void Scene608::synchronize(Common::Serializer &s) { + Scene6xx::synchronize(s); + + s.syncAsSint16LE(_carMode); + s.syncAsSint16LE(_carFrame); + s.syncAsSint16LE(_carMoveMode); + s.syncAsSint16LE(_dogDeathMode); + s.syncAsSint16LE(_carHotspotId); + s.syncAsSint16LE(_barkCount); + s.syncAsSint16LE(_polycementHotspotId); + s.syncAsSint16LE(_animationMode); + s.syncAsSint16LE(_nextTrigger); + s.syncAsSint16LE(_throwMode); + + s.syncAsByte(_resetPositionsFl); + s.syncAsByte(_dogActiveFl); + s.syncAsByte(_dogBarkingFl); + s.syncAsByte(_dogFirstEncounter); + s.syncAsByte(_rexBeingEaten); + s.syncAsByte(_dogHitWindow); + s.syncAsByte(_checkFl); + s.syncAsByte(_dogSquashFl); + s.syncAsByte(_dogSafeFl); + s.syncAsByte(_buttonPressedonTimeFl); + s.syncAsByte(_dogUnderCar); + s.syncAsByte(_dogYelping); + + s.syncAsSint32LE(_dogWindowTimer); + s.syncAsSint32LE(_dogRunTimer); + + s.syncAsUint32LE(_dogTimer1); + s.syncAsUint32LE(_dogTimer2); +} + void Scene608::resetDogVariables() { _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 1); int idx = _scene->_dynamicHotspots.add(NOUN_OBNOXIOUS_DOG, VERB_WALKTO, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); @@ -2383,6 +2462,12 @@ void Scene609::setup() { setAAName(); } +void Scene609::synchronize(Common::Serializer &s) { + Scene6xx::synchronize(s); + + s.syncAsSint16LE(_videoDoorMode); +} + void Scene609::enter() { _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('c', 0)); _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 0)); @@ -2708,6 +2793,18 @@ void Scene610::setup() { _scene->addActiveVocab(VERB_WALKTO); } +void Scene610::synchronize(Common::Serializer &s) { + Scene6xx::synchronize(s); + + s.syncAsSint16LE(_handsetHotspotId); + s.syncAsSint16LE(_checkVal); + + s.syncAsByte(_cellCharging); + + s.syncAsSint32LE(_cellChargingTimer); + s.syncAsUint32LE(_lastFrameTimer); +} + void Scene610::enter() { _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('p', -1)); _globals._spriteIndexes[2] = _scene->_sprites.addSprites("*RXMRC_9"); @@ -2891,6 +2988,39 @@ void Scene611::setup() { _scene->addActiveVocab(VERB_WALKTO); } +void Scene611::synchronize(Common::Serializer &s) { + Scene6xx::synchronize(s); + + s.syncAsByte(_seenRatFl); + s.syncAsByte(_eyesRunningFl); + s.syncAsByte(_shouldRemoveEyes); + s.syncAsByte(_ratPresentFl); + s.syncAsByte(_duringDialogFl); + s.syncAsByte(_resetBatterieText); + s.syncAsByte(_hermitTalkingFl); + s.syncAsByte(_hermitMovingFl); + s.syncAsByte(_alreadyTalkingFl); + s.syncAsByte(_giveBatteriesFl); + s.syncAsByte(_startTradingFl); + s.syncAsByte(_check1Fl); + s.syncAsByte(_stickFingerFl); + + s.syncAsSint16LE(_randVal); + s.syncAsSint16LE(_ratHotspotId); + s.syncAsSint16LE(_hermitDialogNode); + s.syncAsSint16LE(_hermitDisplayedQuestion); + s.syncAsSint16LE(_nextFrame); + s.syncAsSint16LE(_hermitMode); + + s.syncAsUint32LE(_ratTimer); + + s.syncAsSint16LE(_defaultDialogPos.x); + s.syncAsSint16LE(_defaultDialogPos.y); + + _dialog1.synchronize(s); + _dialog2.synchronize(s); +} + void Scene611::handleRatMoves() { _ratPresentFl = false; _scene->_sequences.remove(_globals._sequenceIndexes[1]); @@ -4266,6 +4396,13 @@ void Scene612::setup() { _scene->addActiveVocab(VERB_WALKTO); } +void Scene612::synchronize(Common::Serializer &s) { + Scene6xx::synchronize(s); + + s.syncAsSint16LE(_actionMode); + s.syncAsSint16LE(_cycleIndex); +} + void Scene612::handleWinchMovement() { switch (_game._trigger) { case 0: @@ -4281,7 +4418,7 @@ void Scene612::handleWinchMovement() { case 1: // CHECKME: Is the "else" block useful as action is always equal to 1 at this point? // Or is it a missing bit of code we could fix? - if (action == 1) { + if (_actionMode == 1) { _scene->_sequences.remove(_globals._sequenceIndexes[2]); _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 17, 7, 0, 0); _vm->_sound->command(19); @@ -4426,7 +4563,7 @@ void Scene612::actions() { } } else if (_action.isAction(VERB_UNLOCK, 0xFF, 0x45F)) { _cycleIndex = -2; - action = 1; + _actionMode = 1; handleWinchMovement(); } else if (_action._lookFlag || _action.isAction(VERB_LOOK, NOUN_EXPRESSWAY)) _vm->_dialogs->show(61210); diff --git a/engines/mads/nebular/nebular_scenes6.h b/engines/mads/nebular/nebular_scenes6.h index 731b220cd1..680d006f66 100644 --- a/engines/mads/nebular/nebular_scenes6.h +++ b/engines/mads/nebular/nebular_scenes6.h @@ -71,6 +71,7 @@ private: public: Scene602(MADSEngine *vm) : Scene6xx(vm) {} + void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); @@ -84,6 +85,7 @@ private: public: Scene603(MADSEngine *vm) : Scene6xx(vm) {} + void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); @@ -105,6 +107,7 @@ private: public: Scene604(MADSEngine *vm) : Scene6xx(vm) {} + void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); @@ -140,6 +143,7 @@ private: public: Scene607(MADSEngine *vm) : Scene6xx(vm) {} + void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); @@ -187,6 +191,7 @@ private: public: Scene608(MADSEngine *vm) : Scene6xx(vm) {} + void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); @@ -203,6 +208,7 @@ private: public: Scene609(MADSEngine *vm) : Scene6xx(vm) {} + void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); @@ -223,6 +229,7 @@ private: public: Scene610(MADSEngine *vm) : Scene6xx(vm) {} + void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); @@ -274,6 +281,7 @@ private: public: Scene611(MADSEngine *vm) : Scene6xx(vm) {} + void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); @@ -284,13 +292,14 @@ public: class Scene612: public Scene6xx{ private: - int action; + int _actionMode; int _cycleIndex; void handleWinchMovement(); public: Scene612(MADSEngine *vm) : Scene6xx(vm) {} + void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); -- cgit v1.2.3 From 6f66459f4ab89aeb152d7b13b4289ab7ba8cfca4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 21 May 2014 00:04:38 +0200 Subject: MADS: Add synchronize where useful in scene group 7 --- engines/mads/nebular/nebular_scenes7.cpp | 67 ++++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes7.h | 7 ++++ 2 files changed, 74 insertions(+) diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index 541e22e99f..b7699392f1 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -99,6 +99,12 @@ void Scene701::setup() { _scene->addActiveVocab(VERB_WALKTO); } +void Scene701::synchronize(Common::Serializer &s) { + Scene7xx::synchronize(s); + + s.syncAsSint16LE(_fishingLineId); +} + void Scene701::enter() { _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 0)); _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('b', 5)); @@ -549,6 +555,25 @@ void Scene703::setup() { setAAName(); } +void Scene703::synchronize(Common::Serializer &s) { + Scene7xx::synchronize(s); + + s.syncAsSint16LE(_monsterMode); + s.syncAsSint16LE(_boatFrame); + s.syncAsSint16LE(_curSequence); + s.syncAsSint16LE(_boatDir); + + s.syncAsByte(_useBomb); + s.syncAsByte(_startMonsterTimer); + s.syncAsByte(_rexDeathFl); + s.syncAsByte(_restartTrigger70Fl); + + s.syncAsUint32LE(_lastFrameTime); + s.syncAsUint32LE(_monsterTime); + + _dialog1.synchronize(s); +} + void Scene703::handleBottleInterface() { switch (_globals[kBottleStatus]) { case 0: @@ -1077,6 +1102,19 @@ void Scene704::setup() { _scene->addActiveVocab(VERB_LOOK_AT); } +void Scene704::synchronize(Common::Serializer &s) { + Scene7xx::synchronize(s); + + s.syncAsSint16LE(_bottleHotspotId); + s.syncAsSint16LE(_boatCurrentFrame); + s.syncAsSint16LE(_animationMode); + s.syncAsSint16LE(_boatDirection); + + s.syncAsByte(_takeBottleFl); + + _dialog1.synchronize(s); +} + void Scene704::handleBottleInterface() { switch (_globals[kBottleStatus]) { case 0: @@ -1414,6 +1452,12 @@ void Scene705::setup() { setAAName(); } +void Scene705::synchronize(Common::Serializer &s) { + Scene7xx::synchronize(s); + + _dialog1.synchronize(s); +} + void Scene705::handleBottleInterface() { switch (_globals[kBottleStatus]) { case 0: @@ -1681,6 +1725,17 @@ void Scene706::setup() { _scene->addActiveVocab(VERB_WALKTO); } +void Scene706::synchronize(Common::Serializer &s) { + Scene7xx::synchronize(s); + + s.syncAsSint16LE(_vaseHotspotId); + s.syncAsSint16LE(_vaseMode); + s.syncAsSint16LE(_animationMode); + s.syncAsSint16LE(_animationFrame); + + s.syncAsByte(_emptyPedestral); +} + void Scene706::handleRexDeath() { switch (_game._trigger) { case 0: @@ -2089,6 +2144,12 @@ void Scene751::setup() { _scene->addActiveVocab(VERB_WALKTO); } +void Scene751::synchronize(Common::Serializer &s) { + Scene7xx::synchronize(s); + + s.syncAsByte(_rexHandingLine); +} + void Scene751::enter() { _globals._spriteIndexes[1] = _scene->_sprites.addSprites("*RM701X0"); _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('a', 0)); @@ -2417,6 +2478,12 @@ void Scene752::setup() { _scene->addActiveVocab(NOUN_LASER_BEAM); } +void Scene752::synchronize(Common::Serializer &s) { + Scene7xx::synchronize(s); + + s.syncAsByte(_cardId); +} + void Scene752::enter() { _globals._spriteIndexes[14] = _scene->_sprites.addSprites(formAnimName('l', -1)); _globals._spriteIndexes[12] = _scene->_sprites.addSprites("*RXMBD_8"); diff --git a/engines/mads/nebular/nebular_scenes7.h b/engines/mads/nebular/nebular_scenes7.h index 0223fe2447..150c598b9b 100644 --- a/engines/mads/nebular/nebular_scenes7.h +++ b/engines/mads/nebular/nebular_scenes7.h @@ -56,6 +56,7 @@ private: public: Scene701(MADSEngine *vm) : Scene7xx(vm), _fishingLineId(-1) {} + void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); @@ -97,6 +98,7 @@ private: public: Scene703(MADSEngine *vm) : Scene7xx(vm) {} + void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); @@ -121,6 +123,7 @@ private: public: Scene704(MADSEngine *vm) : Scene7xx(vm) {} + void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); @@ -138,6 +141,7 @@ private: public: Scene705(MADSEngine *vm) : Scene7xx(vm) {} + void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); @@ -159,6 +163,7 @@ private: public: Scene706(MADSEngine *vm) : Scene7xx(vm) {} + void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); @@ -203,6 +208,7 @@ private: public: Scene751(MADSEngine *vm) : Scene7xx(vm) {} + void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); @@ -217,6 +223,7 @@ private: public: Scene752(MADSEngine *vm) : Scene7xx(vm), _cardId(-1) {} + void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); -- cgit v1.2.3 From df23dff5177ece670f2fd8222337faa80baf12bd Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 20 May 2014 21:11:53 -0400 Subject: MADS: Change the animation _animMode to an enum'ed _bgType --- engines/mads/animation.cpp | 10 +++++----- engines/mads/animation.h | 8 ++++++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index f006d1fe61..f55e485c20 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -36,7 +36,7 @@ void AAHeader::load(Common::SeekableReadStream *f) { _flags = f->readByte(); f->skip(2); - _animMode = f->readUint16LE(); + _bgType = (AnimBgType)f->readUint16LE(); _roomNumber = f->readUint16LE(); f->skip(2); _manualFlag = f->readUint16LE() != 0; @@ -186,7 +186,7 @@ void Animation::load(UserInterface &interfaceSurface, MSurface &depthSurface, _header.load(stream); delete stream; - if (_header._animMode == 4) + if (_header._bgType == ANIMBG_INTERFACE) flags |= PALFLAG_RESERVED; if (flags & ANIMFLAG_LOAD_BACKGROUND) { @@ -296,7 +296,7 @@ void Animation::load(UserInterface &interfaceSurface, MSurface &depthSurface, if (usageList.size() > 0) _vm->_palette->_paletteUsage.updateUsage(usageList, _header._messagesCount); - if (_header._animMode == 4) { + if (_header._bgType == ANIMBG_INTERFACE) { // Remaps the sprite list indexes for frames to the loaded sprite list indexes for (uint i = 0; i < _frameEntries.size(); ++i) { int spriteListIndex = _frameEntries[i]._spriteSlot._spritesIndex; @@ -377,7 +377,7 @@ bool Animation::drawFrame(SpriteAsset &spriteSet, const Common::Point &pt, int f void Animation::loadInterface(UserInterface &interfaceSurface, MSurface &depthSurface, AAHeader &header, int flags, Common::Array *palCycles, SceneInfo *sceneInfo) { _scene->_depthStyle = 0; - if (header._animMode <= 2) { + if (header._bgType <= ANIMBG_FULL_SIZE) { _vm->_palette->_paletteUsage.setEmpty(); sceneInfo->load(header._roomNumber, flags, header._interfaceFile, 0, depthSurface, interfaceSurface); _scene->_depthStyle = sceneInfo->_depthStyle == 2 ? 1 : 0; @@ -386,7 +386,7 @@ void Animation::loadInterface(UserInterface &interfaceSurface, MSurface &depthSu for (uint i = 0; i < sceneInfo->_paletteCycles.size(); ++i) palCycles->push_back(sceneInfo->_paletteCycles[i]); } - } else if (header._animMode == 4) { + } else if (header._bgType == ANIMBG_INTERFACE) { // Load a scene interface Common::String resourceName = "*" + header._interfaceFile; interfaceSurface.load(resourceName); diff --git a/engines/mads/animation.h b/engines/mads/animation.h index a1d957ee45..715f6e49a5 100644 --- a/engines/mads/animation.h +++ b/engines/mads/animation.h @@ -40,6 +40,11 @@ enum AnimFlag { ANIMFLAG_LOAD_BACKGROUND_ONLY = 0x0200 // Load background only }; +enum AnimBgType { + ANIMBG_ROOM = 1, ANIMBG_FULL_SIZE = 2, ANIMBG_BLACK_SCREEN = 3, + ANIMBG_INTERFACE = 4 +}; + class MADSEngine; class Scene; @@ -112,7 +117,7 @@ public: int _frameEntriesCount; int _messagesCount; byte _flags; - int _animMode; + AnimBgType _bgType; int _roomNumber; bool _manualFlag; int _spritesIndex; @@ -215,7 +220,6 @@ public: int getCurrentFrame() const { return _currentFrame; } bool freeFlag() const { return _freeFlag; } - bool getAnimMode() const { return _header._animMode; } int roomNumber() const { return _header._roomNumber; } void resetSpriteSetsCount() { _header._spriteSetsCount = 0; } // CHECKME: See if it doesn't leak the memory when the destructor is called -- cgit v1.2.3 From 6bfc9ce8f25d5d08e3a0aa1d5fa55e3dfe93b97f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 20 May 2014 21:22:01 -0400 Subject: MADS: Completely remove synchronizeString in favour of syncString --- engines/mads/action.cpp | 2 +- engines/mads/game.cpp | 2 +- engines/mads/player.cpp | 2 +- engines/mads/resources.cpp | 19 ------------------- engines/mads/resources.h | 5 ----- 5 files changed, 3 insertions(+), 27 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index f26a999ff7..df9da126e8 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -678,7 +678,7 @@ void MADSAction::synchronize(Common::Serializer &s) { s.syncAsSint16LE(_statusTextIndex); s.syncAsSint16LE(_hotspotId); _savedFields.synchronize(s); - synchronizeString(s, _sentence); + s.syncString(_sentence); s.syncAsSint16LE(_verbType); s.syncAsSint16LE(_prepType); diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 118dc829c3..f8d6c36ebf 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -457,7 +457,7 @@ void Game::synchronize(Common::Serializer &s, bool phase1) { s.syncAsSint16LE(_trigger); s.syncAsUint16LE(_triggerSetupMode); s.syncAsUint16LE(_triggerMode); - synchronizeString(s, _aaName); + s.syncString(_aaName); s.syncAsSint16LE(_lastSave); _scene.synchronize(s); diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index 3672c80f32..a9c9f113ff 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -755,7 +755,7 @@ void Player::synchronize(Common::Serializer &s) { s.syncAsSint16LE(_totalDistance); s.syncAsSint16LE(_velocity); s.syncAsUint16LE(_frameCount); - synchronizeString(s, _spritesPrefix); + s.syncString(_spritesPrefix); s.syncAsUint32LE(_priorTimer); s.syncAsByte(_loadsFirst); s.syncAsByte(_loadedFirst); diff --git a/engines/mads/resources.cpp b/engines/mads/resources.cpp index 0d5aee1526..745583b516 100644 --- a/engines/mads/resources.cpp +++ b/engines/mads/resources.cpp @@ -413,23 +413,4 @@ void SynchronizedList::synchronize(Common::Serializer &s) { } } -/*------------------------------------------------------------------------*/ - -void synchronizeString(Common::Serializer &s, Common::String &str) { - int len = str.size(); - s.syncAsUint16LE(len); - - if (s.isSaving()) { - s.syncBytes((byte *)str.c_str(), len); - } else { - str.clear(); - char c; - for (int i = 0; i < len; ++i) { - s.syncAsByte(c); - str += c; - } - } -} - - } // End of namespace MADS diff --git a/engines/mads/resources.h b/engines/mads/resources.h index 137eb7a169..003684ef84 100644 --- a/engines/mads/resources.h +++ b/engines/mads/resources.h @@ -84,11 +84,6 @@ public: void synchronize(Common::Serializer &s); }; -/** -* Synchronize string support method -*/ -void synchronizeString(Common::Serializer &s, Common::String &str); - } // End of namespace MADS #endif /* MADS_RESOURCES_H */ -- cgit v1.2.3 From 876ef49a3a7596ff2d26195923d43b1a886ca065 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 20 May 2014 22:07:53 -0400 Subject: MADS: Fix loading sprite in scene 701 --- engines/mads/compression.cpp | 20 +++++++++++++------- engines/mads/compression.h | 2 ++ engines/mads/nebular/nebular_scenes7.cpp | 5 +---- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/engines/mads/compression.cpp b/engines/mads/compression.cpp index 6563de51a3..de893e7b1a 100644 --- a/engines/mads/compression.cpp +++ b/engines/mads/compression.cpp @@ -69,18 +69,20 @@ void MadsPack::initialise(Common::SeekableReadStream *stream) { _items[i].size = READ_LE_UINT32(header + 2); _items[i].compressedSize = READ_LE_UINT32(header + 6); - _items[i].data = new byte[_items[i].size]; - if (_items[i].size == _items[i].compressedSize) { + byte *sourceData = new byte[_items[i].compressedSize]; + stream->read(sourceData, _items[i].compressedSize); + + if (_items[i].size == _items[i].compressedSize && + !FabDecompressor::isCompressed(sourceData)) { // Entry isn't compressed - stream->read(_items[i].data, _items[i].size); + _items[i].data = sourceData; } else { // Decompress the entry - byte *compressedData = new byte[_items[i].compressedSize]; - stream->read(compressedData, _items[i].compressedSize); + _items[i].data = new byte[_items[i].size]; FabDecompressor fab; - fab.decompress(compressedData, _items[i].compressedSize, _items[i].data, _items[i].size); - delete[] compressedData; + fab.decompress(sourceData, _items[i].compressedSize, _items[i].data, _items[i].size); + delete[] sourceData; } } @@ -96,6 +98,10 @@ MadsPack::~MadsPack() { //-------------------------------------------------------------------------- +bool FabDecompressor::isCompressed(const byte *srcData) { + return strncmp((const char *)srcData, "FAB", 3) == 0; +} + void FabDecompressor::decompress(const byte *srcData, int srcSize, byte *destData, int destSize) { byte copyLen, copyOfsShift, copyOfsMask, copyLenMask; unsigned long copyOfs; diff --git a/engines/mads/compression.h b/engines/mads/compression.h index c752b570a2..43a966f48c 100644 --- a/engines/mads/compression.h +++ b/engines/mads/compression.h @@ -79,6 +79,8 @@ private: int getBit(); public: void decompress(const byte *srcData, int srcSize, byte *destData, int destSize); + + static bool isCompressed(const byte *srcData); }; } // End of namespace MADS diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index b7699392f1..8e04c452f3 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -109,7 +109,7 @@ void Scene701::enter() { _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 0)); _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('b', 5)); _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('b', 0)); -// _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('b', 1)); // TODO: FIXME: Broken sprite? + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('b', 1)); // TODO: FIXME: Broken sprite? _globals._spriteIndexes[5] = _scene->_sprites.addSprites("*RM202A1"); _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('b', 8)); @@ -162,15 +162,12 @@ void Scene701::enter() { break; } -// TODO: Enable once sprite 3 can be loaded properly -/* if (_globals[kLineStatus] == LINE_DROPPED || _globals[kLineStatus] == LINE_TIED) { _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -1); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 8); int idx = _scene->_dynamicHotspots.add(NOUN_FISHING_LINE, VERB_WALKTO, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); _fishingLineId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(234, 129), FACING_NORTHEAST); } -*/ if (_scene->_priorSceneId == 702) { _game._player._playerPos = Common::Point(309, 138); -- cgit v1.2.3 From 17012de54b900400548d598fe051343924838565 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 20 May 2014 22:34:26 -0400 Subject: MADS: Remove redundant frame entry remap block in animation loading --- engines/mads/animation.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index f55e485c20..25fa4a8e06 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -296,18 +296,10 @@ void Animation::load(UserInterface &interfaceSurface, MSurface &depthSurface, if (usageList.size() > 0) _vm->_palette->_paletteUsage.updateUsage(usageList, _header._messagesCount); - if (_header._bgType == ANIMBG_INTERFACE) { - // Remaps the sprite list indexes for frames to the loaded sprite list indexes - for (uint i = 0; i < _frameEntries.size(); ++i) { - int spriteListIndex = _frameEntries[i]._spriteSlot._spritesIndex; - _frameEntries[i]._spriteSlot._spritesIndex = _spriteListIndexes[spriteListIndex]; - } - } else { - // Remaps the sprite list indexes for frames to the loaded sprite list indexes - for (uint i = 0; i < _frameEntries.size(); ++i) { - int spriteListIndex = _frameEntries[i]._spriteSlot._spritesIndex; - _frameEntries[i]._spriteSlot._spritesIndex = _spriteListIndexes[spriteListIndex]; - } + // Remaps the sprite list indexes for frames to the loaded sprite list indexes + for (uint i = 0; i < _frameEntries.size(); ++i) { + int spriteListIndex = _frameEntries[i]._spriteSlot._spritesIndex; + _frameEntries[i]._spriteSlot._spritesIndex = _spriteListIndexes[spriteListIndex]; } f.close(); -- cgit v1.2.3 From 29eda4c02e52279c9be4edf5764a41c8d2a9e88a Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 21 May 2014 08:04:44 +0300 Subject: FULLPIPE: Implement MovGraph::method3C() --- engines/fullpipe/motion.cpp | 35 ++++++++++++++++++++++++++++++++--- engines/fullpipe/motion.h | 4 ++-- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 0b1c159337..0e60847bc9 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -690,10 +690,39 @@ int MovGraph::changeCallback() { return 0; } -int MovGraph::method3C(StaticANIObject *ani, int flag) { - warning("STUB: MovGraph::method3C()"); +bool MovGraph::method3C(StaticANIObject *ani, int flag) { + int idx = getItemIndexByStaticAni(ani); - return 0; + if (idx == -1) + return false; + + Common::Point point; + MovArr movarr; + + point.x = ani->_ox; + point.y = ani->_oy; + + findClosestLink(idx, &point, &movarr); + ani->setOXY(point.x, point.y); + + if (flag) { + Statics *st; + + if (ani->_statics) { + int t = _mgm.refreshOffsets(ani->_id, ani->_statics->_staticsId, movarr._link->_dwordArray2[_field_44]); + if (t > _mgm.refreshOffsets(ani->_id, ani->_statics->_staticsId, movarr._link->_dwordArray2[_field_44 + 1])) + st = ani->getStaticsById(movarr._link->_dwordArray2[_field_44 + 1]); + else + st = ani->getStaticsById(movarr._link->_dwordArray2[_field_44]); + } else { + ani->stopAnim_maybe(); + st = ani->getStaticsById(movarr._link->_dwordArray2[_field_44]); + } + + ani->_statics = st; + } + + return true; } bool MovGraph::method44(StaticANIObject *ani, int x, int y) { diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index fc199e305b..aa40379717 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -58,7 +58,7 @@ public: virtual int method30() { return 0; } virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) { return 0; } virtual int changeCallback() { return 0; } - virtual int method3C(StaticANIObject *ani, int flag) { return 0; } + virtual bool method3C(StaticANIObject *ani, int flag) { return 0; } virtual int method40() { return 0; } virtual bool method44(StaticANIObject *ani, int x, int y) { return false; } virtual int method48() { return -1; } @@ -365,7 +365,7 @@ public: virtual int method2C(StaticANIObject *obj, int x, int y); virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId); virtual int changeCallback(); - virtual int method3C(StaticANIObject *ani, int flag); + virtual bool method3C(StaticANIObject *ani, int flag); virtual bool method44(StaticANIObject *ani, int x, int y); virtual MessageQueue *doWalkTo(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId); virtual MessageQueue *method50(StaticANIObject *ani, Common::Array *movarr, int staticsId); -- cgit v1.2.3 From 347c03d8b7c8768dc58f5f42ff013c426f7acebb Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 21 May 2014 08:07:21 +0300 Subject: FULLPIPE: Fix method return types --- engines/fullpipe/motion.cpp | 8 ++++---- engines/fullpipe/motion.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 0e60847bc9..6162537dba 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -606,7 +606,7 @@ Common::Array *MovGraph::method28(StaticANIObject *ani, int x, int y, return 0; } -int MovGraph::method2C(StaticANIObject *obj, int x, int y) { +bool MovGraph::method2C(StaticANIObject *obj, int x, int y) { obj->setOXY(x, y); return method3C(obj, 1); } @@ -3258,17 +3258,17 @@ int startWalkTo(int objId, int objKey, int x, int y, int fuzzyMatch) { return 0; } -int doSomeAnimation(int objId, int objKey, int a3) { +bool doSomeAnimation(int objId, int objKey, int a3) { StaticANIObject *ani = g_fp->_currentScene->getStaticANIObject1ById(objId, objKey); MctlCompound *cmp = getCurrSceneSc2MotionController(); if (ani && cmp) return cmp->method3C(ani, a3); - return 0; + return false; } -int doSomeAnimation2(int objId, int objKey) { +bool doSomeAnimation2(int objId, int objKey) { return doSomeAnimation(objId, objKey, 0); } diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index aa40379717..76eb567cfe 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -34,8 +34,8 @@ class ExCommand2; struct MovItem; int startWalkTo(int objId, int objKey, int x, int y, int a5); -int doSomeAnimation(int objId, int objKey, int a3); -int doSomeAnimation2(int objId, int objKey); +bool doSomeAnimation(int objId, int objKey, int a3); +bool doSomeAnimation2(int objId, int objKey); class MotionController : public CObject { public: @@ -54,7 +54,7 @@ public: virtual int removeObject(StaticANIObject *obj) { return 0; } virtual void freeItems() {} virtual Common::Array *method28(StaticANIObject *ani, int x, int y, int flag1, int *rescount) { return 0; } - virtual int method2C(StaticANIObject *obj, int x, int y) { return 0; } + virtual bool method2C(StaticANIObject *obj, int x, int y) { return false; } virtual int method30() { return 0; } virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) { return 0; } virtual int changeCallback() { return 0; } @@ -362,7 +362,7 @@ public: virtual int removeObject(StaticANIObject *obj); virtual void freeItems(); virtual Common::Array *method28(StaticANIObject *ani, int x, int y, int flag1, int *rescount); - virtual int method2C(StaticANIObject *obj, int x, int y); + virtual bool method2C(StaticANIObject *obj, int x, int y); virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId); virtual int changeCallback(); virtual bool method3C(StaticANIObject *ani, int flag); -- cgit v1.2.3 From 6a468994fa8243b235cfef16357a970a3c486653 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 21 May 2014 07:19:42 +0200 Subject: MADS: Fix synchronize in scene 752 --- engines/mads/nebular/nebular_scenes7.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index 8e04c452f3..7f35117c3b 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -2478,7 +2478,7 @@ void Scene752::setup() { void Scene752::synchronize(Common::Serializer &s) { Scene7xx::synchronize(s); - s.syncAsByte(_cardId); + s.syncAsSint16LE(_cardId); } void Scene752::enter() { -- cgit v1.2.3 From c0b9a5a58f5c8468cdd9cc360bc8699173f0f902 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 21 May 2014 07:21:18 +0200 Subject: MADS: Remove obsolete comment --- engines/mads/nebular/nebular_scenes7.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index 7f35117c3b..895c4ec78e 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -109,7 +109,7 @@ void Scene701::enter() { _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 0)); _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('b', 5)); _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('b', 0)); - _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('b', 1)); // TODO: FIXME: Broken sprite? + _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('b', 1)); _globals._spriteIndexes[5] = _scene->_sprites.addSprites("*RM202A1"); _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('b', 8)); -- cgit v1.2.3 From 057f239ed6f701da4e4a1c6a6624bc41e4d8c93c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 21 May 2014 08:32:39 -0400 Subject: MADS: Remove some redundant TODOs --- engines/mads/msurface.cpp | 2 +- engines/mads/nebular/nebular_scenes2.cpp | 10 ---------- engines/mads/nebular/nebular_scenes3.cpp | 9 --------- engines/mads/nebular/nebular_scenes4.cpp | 10 ---------- engines/mads/nebular/nebular_scenes6.cpp | 3 --- engines/mads/nebular/nebular_scenes7.cpp | 6 ------ engines/mads/palette.cpp | 1 - engines/mads/scene.cpp | 2 -- engines/mads/user_interface.cpp | 6 ------ engines/mads/user_interface.h | 6 ------ 10 files changed, 1 insertion(+), 54 deletions(-) diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp index 4fae799c28..3ebbc6b79d 100644 --- a/engines/mads/msurface.cpp +++ b/engines/mads/msurface.cpp @@ -310,7 +310,7 @@ void MSurface::copyFrom(MSurface *src, const Common::Point &destPos, int depth, int destRight = this->getWidth() - 1; int destBottom = this->getHeight() - 1; - bool normalFrame = true; // TODO: false for negative frame numbers + bool normalFrame = true; int frameWidth = src->getWidth(); int frameHeight = src->getHeight(); diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index b2076a2b7c..950552148f 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -1400,8 +1400,6 @@ void Scene205::synchronize(Common::Serializer &s) { s.syncAsUint32LE(_chickenTime); s.syncAsByte(_beingKicked); s.syncAsSint16LE(_kernelMessage); - - _dialog1.synchronize(s); } /*****************************************************************************/ @@ -4501,14 +4499,6 @@ void Scene210::synchronize(Common::Serializer &s) { s.syncAsSint32LE(_doorway); s.syncString(_subQuote2); - - _conv1.synchronize(s); - _conv2.synchronize(s); - _conv3.synchronize(s); - _conv5.synchronize(s); - _conv6.synchronize(s); - _conv7.synchronize(s); - _conv8.synchronize(s); } /*------------------------------------------------------------------------*/ diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 9237c62f48..5391b5f93d 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -1157,9 +1157,6 @@ void Scene307::synchronize(Common::Serializer &s) { s.syncAsUint32LE(_prisonerTimer); s.syncString(_subQuote2); - - _dialog1.synchronize(s); - _dialog2.synchronize(s); } /*------------------------------------------------------------------------*/ @@ -2954,8 +2951,6 @@ void Scene318::synchronize(Common::Serializer &s) { s.syncAsUint32LE(_lastFrameCounter); s.syncString(_subQuote2); - - _dialog1.synchronize(s); } /*------------------------------------------------------------------------*/ @@ -3421,10 +3416,6 @@ void Scene319::actions() { void Scene319::synchronize(Common::Serializer &s) { Scene3xx::synchronize(s); - _dialog1.synchronize(s); - _dialog2.synchronize(s); - _dialog3.synchronize(s); - s.syncAsUint32LE(_animMode); s.syncAsUint32LE(_animFrame); s.syncAsUint32LE(_nextAction1); diff --git a/engines/mads/nebular/nebular_scenes4.cpp b/engines/mads/nebular/nebular_scenes4.cpp index 586d59d2b5..4156842c0e 100644 --- a/engines/mads/nebular/nebular_scenes4.cpp +++ b/engines/mads/nebular/nebular_scenes4.cpp @@ -284,11 +284,6 @@ void Scene402::synchronize(Common::Serializer &s) { s.syncAsSint16LE(_roxMode); s.syncAsSint16LE(_rexMode); s.syncAsSint16LE(_talkTimer); - - _dialog1.synchronize(s); - _dialog2.synchronize(s); - _dialog3.synchronize(s); - _dialog4.synchronize(s); } void Scene402::setDialogNode(int node) { @@ -3968,11 +3963,6 @@ void Scene411::synchronize(Common::Serializer &s) { s.syncAsByte(_killRox); s.syncAsByte(_makeMushroomCloud); - - _dialog1.synchronize(s); - _dialog2.synchronize(s); - _dialog3.synchronize(s); - _dialog4.synchronize(s); } /*------------------------------------------------------------------------*/ diff --git a/engines/mads/nebular/nebular_scenes6.cpp b/engines/mads/nebular/nebular_scenes6.cpp index 6f802b22dc..4313366e08 100644 --- a/engines/mads/nebular/nebular_scenes6.cpp +++ b/engines/mads/nebular/nebular_scenes6.cpp @@ -3016,9 +3016,6 @@ void Scene611::synchronize(Common::Serializer &s) { s.syncAsSint16LE(_defaultDialogPos.x); s.syncAsSint16LE(_defaultDialogPos.y); - - _dialog1.synchronize(s); - _dialog2.synchronize(s); } void Scene611::handleRatMoves() { diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index 895c4ec78e..e9d8f7f4cb 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -567,8 +567,6 @@ void Scene703::synchronize(Common::Serializer &s) { s.syncAsUint32LE(_lastFrameTime); s.syncAsUint32LE(_monsterTime); - - _dialog1.synchronize(s); } void Scene703::handleBottleInterface() { @@ -1108,8 +1106,6 @@ void Scene704::synchronize(Common::Serializer &s) { s.syncAsSint16LE(_boatDirection); s.syncAsByte(_takeBottleFl); - - _dialog1.synchronize(s); } void Scene704::handleBottleInterface() { @@ -1451,8 +1447,6 @@ void Scene705::setup() { void Scene705::synchronize(Common::Serializer &s) { Scene7xx::synchronize(s); - - _dialog1.synchronize(s); } void Scene705::handleBottleInterface() { diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index 23e889566e..c34f2c63d7 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -400,7 +400,6 @@ void Fader::fadeToGrey(byte palette[PALETTE_SIZE], byte *paletteMap, setFullPalette(palette); - // TODO: Adjust waiting _vm->_events->waitForNextFrame(); } diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 0c241eb9ab..0e3960c0f8 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -187,8 +187,6 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) { _vm->_game->_screenObjects._category = CAT_NONE; _vm->_events->showCursor(); - - warning("TODO: inventory_anim_allocate"); } void Scene::loadHotspots() { diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 4d8ed82f98..3fab30a0ab 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -838,7 +838,6 @@ void UserInterface::addConversationMessage(int vocabId, const Common::String &ms void UserInterface::loadInventoryAnim(int objectId) { Scene &scene = _vm->_game->_scene; noInventoryAnim(); - bool flag = true; if (_vm->_invObjectsAnimated) { Common::String resName = Common::String::format("*OB%.3dI", objectId); @@ -846,13 +845,8 @@ void UserInterface::loadInventoryAnim(int objectId) { _invSpritesIndex = scene._sprites.add(asset, 1); if (_invSpritesIndex >= 0) { _invFrameNumber = 1; - flag = false; } } - - if (flag) { - // TODO: Use of inv_object_data? - } } void UserInterface::noInventoryAnim() { diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h index 2fdc80bf86..827fa3041f 100644 --- a/engines/mads/user_interface.h +++ b/engines/mads/user_interface.h @@ -128,12 +128,6 @@ public: * Starts the conversation */ void start(); - - /** - * Synchronize the conversation - */ - void synchronize(Common::Serializer &s) { warning("TODO: Synchronize Conversation"); }; - }; class UserInterface : public MSurface { -- cgit v1.2.3 From 4804be16c222e847b0f5a37d0c58cbbcede94a3f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 21 May 2014 17:27:28 +0200 Subject: MADS: Add synchronize functions in scene group 8 --- engines/mads/nebular/nebular_scenes8.cpp | 34 ++++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes8.h | 4 ++++ 2 files changed, 38 insertions(+) diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index dc5a4cdd1d..1fef2709b4 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -83,6 +83,13 @@ void Scene801::setup() { setAAName(); } +void Scene801::synchronize(Common::Serializer &s) { + Scene8xx::synchronize(s); + + s.syncAsByte(_walkThroughDoor); +} + + void Scene801::enter() { _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 1)); _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 0)); @@ -829,6 +836,21 @@ void Scene804::setup() { Scene8xx::setAAName(); } +void Scene804::synchronize(Common::Serializer &s) { + Scene8xx::synchronize(s); + + s.syncAsByte(_messWithThrottle); + s.syncAsByte(_movingThrottle); + s.syncAsByte(_throttleGone); + s.syncAsByte(_dontPullThrottleAgain); + s.syncAsByte(_pullThrottleReally); + s.syncAsByte(_alreadyOrgan); + s.syncAsByte(_alreadyPop); + + s.syncAsSint16LE(_resetFrame); + s.syncAsUint32LE(_throttleCounter); +} + void Scene804::enter() { _messWithThrottle = false; _throttleCounter = 0; @@ -1235,6 +1257,12 @@ void Scene808::setup() { setAAName(); } +void Scene808::synchronize(Common::Serializer &s) { + Scene8xx::synchronize(s); + + s.syncAsByte(_goingTo803); +} + void Scene808::enter() { _scene->_userInterface.setup(kInputLimitedSentences); @@ -1441,6 +1469,12 @@ void Scene810::setup() { setAAName(); } +void Scene810::synchronize(Common::Serializer &s) { + Scene8xx::synchronize(s); + + s.syncAsByte(_moveAllowed); +} + void Scene810::enter() { _scene->_userInterface.setup(kInputLimitedSentences); _game._player._visible = false; diff --git a/engines/mads/nebular/nebular_scenes8.h b/engines/mads/nebular/nebular_scenes8.h index 590f31ca71..f926d1ec97 100644 --- a/engines/mads/nebular/nebular_scenes8.h +++ b/engines/mads/nebular/nebular_scenes8.h @@ -58,6 +58,7 @@ private: public: Scene801(MADSEngine *vm) : Scene8xx(vm) {} + void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); @@ -101,6 +102,7 @@ private: bool _alreadyPop; public: Scene804(MADSEngine *vm) : Scene8xx(vm), _throttleCounter(0) {} + void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); @@ -135,6 +137,7 @@ private: public: Scene808(MADSEngine *vm) : Scene8xx(vm) {} + void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); @@ -147,6 +150,7 @@ private: public: Scene810(MADSEngine *vm) : Scene8xx(vm) {} + void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); -- cgit v1.2.3 From 39f5f0a093c8bbf7b6962d2c58b7ef9062687d58 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 21 May 2014 19:43:28 +0200 Subject: MADS: Move some contructors from .h to .cpp in scene group 1 --- engines/mads/nebular/nebular_scenes1.cpp | 30 ++++++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes1.h | 10 ++++------ 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index ab7339851e..0277af2878 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -99,6 +99,16 @@ void Scene1xx::setPlayerSpritesPrefix() { /*------------------------------------------------------------------------*/ +Scene101::Scene101(MADSEngine *vm) : Scene1xx(vm) { + _sittingFl = false; + _panelOpened = false; + _messageNum = 0; + _posY = 0; + _shieldSpriteIdx = 0; + _chairHotspotId = 0; + _oldSpecial = 0; +} + void Scene101::setup() { _scene->_animationData->preLoad(formAnimName('A', -1), 3); setPlayerSpritesPrefix(); @@ -617,6 +627,16 @@ void Scene101::synchronize(Common::Serializer &s) { /*------------------------------------------------------------------------*/ +Scene102::Scene102(MADSEngine *vm) : Scene1xx(vm) { + _fridgeOpenedFl = false; + _fridgeOpenedDescr = false; + _fridgeFirstOpenFl = false; + _chairDescrFl = false; + _drawerDescrFl = false; + _activeMsgFl = false; + _fridgeCommentCount = 0; +} + void Scene102::setup() { _scene->_animationData->preLoad(formAnimName('A', -1), 3); setPlayerSpritesPrefix(); @@ -1223,6 +1243,11 @@ void Scene102::synchronize(Common::Serializer &s) { /*------------------------------------------------------------------------*/ +Scene103::Scene103(MADSEngine *vm) : Scene1xx(vm) { + _sayHiToBinky = false; + _updateClock = 0; +} + void Scene103::setup() { setPlayerSpritesPrefix(); setAAName(); @@ -1548,6 +1573,11 @@ void Scene103::synchronize(Common::Serializer &s) { /*------------------------------------------------------------------------*/ +Scene104::Scene104(MADSEngine *vm) : Scene1xx(vm) { + _kargShootingFl = false; + _loseFl = false; +} + void Scene104::setup() { // Preloading has been skipped setPlayerSpritesPrefix(); diff --git a/engines/mads/nebular/nebular_scenes1.h b/engines/mads/nebular/nebular_scenes1.h index 80df7f9e4d..15357728f0 100644 --- a/engines/mads/nebular/nebular_scenes1.h +++ b/engines/mads/nebular/nebular_scenes1.h @@ -66,8 +66,7 @@ private: void sayDang(); public: - Scene101(MADSEngine *vm) : Scene1xx(vm), _sittingFl(false), _panelOpened(false), _messageNum(0), - _posY(0), _shieldSpriteIdx(0), _chairHotspotId(0), _oldSpecial(0) {} + Scene101(MADSEngine *vm); virtual void setup(); virtual void enter(); @@ -91,8 +90,7 @@ private: void addRandomMessage(); public: - Scene102(MADSEngine *vm) : Scene1xx(vm), _fridgeOpenedFl(false), _fridgeOpenedDescr(false), _fridgeFirstOpenFl(false), - _chairDescrFl(false), _drawerDescrFl(false), _activeMsgFl(false), _fridgeCommentCount(0) {} + Scene102(MADSEngine *vm); virtual void setup(); virtual void enter(); @@ -108,7 +106,7 @@ private: bool _sayHiToBinky; uint32 _updateClock; public: - Scene103(MADSEngine *vm) : Scene1xx(vm) {} + Scene103(MADSEngine *vm); virtual void setup(); virtual void enter(); @@ -124,7 +122,7 @@ private: bool _loseFl; public: - Scene104(MADSEngine *vm) : Scene1xx(vm), _kargShootingFl(false), _loseFl(false) {} + Scene104(MADSEngine *vm); virtual void setup(); virtual void enter(); -- cgit v1.2.3 From b9ccb8a1ec871c86407642aa8b290db06089abff Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 21 May 2014 19:45:30 +0200 Subject: MADS: Remove useless variable in scene 103 --- engines/mads/nebular/nebular_scenes1.cpp | 6 ++---- engines/mads/nebular/nebular_scenes1.h | 1 - 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 0277af2878..e6f8d4fb8a 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -1244,7 +1244,6 @@ void Scene102::synchronize(Common::Serializer &s) { /*------------------------------------------------------------------------*/ Scene103::Scene103(MADSEngine *vm) : Scene1xx(vm) { - _sayHiToBinky = false; _updateClock = 0; } @@ -1322,7 +1321,6 @@ void Scene103::enter() { _vm->_palette->setEntry(252, 63, 63, 10); _vm->_palette->setEntry(253, 45, 45, 10); - _sayHiToBinky = false; _updateClock = _scene->_frameStartTime; } @@ -1493,7 +1491,6 @@ void Scene103::actions() { case 1: { Common::String msg = _game.getQuote(72); _scene->_kernelMessages.add(Common::Point(310, 132), 0xFDFC, 16, 2, 120, msg); - _sayHiToBinky = false; break; } @@ -1567,7 +1564,8 @@ void Scene103::postActions() { void Scene103::synchronize(Common::Serializer &s) { Scene1xx::synchronize(s); - s.syncAsByte(_sayHiToBinky); + byte dummy = 0; + s.syncAsByte(dummy); // In order to avoid to break savegame compatibility s.syncAsUint32LE(_updateClock); } diff --git a/engines/mads/nebular/nebular_scenes1.h b/engines/mads/nebular/nebular_scenes1.h index 15357728f0..318773e41b 100644 --- a/engines/mads/nebular/nebular_scenes1.h +++ b/engines/mads/nebular/nebular_scenes1.h @@ -103,7 +103,6 @@ public: class Scene103 : public Scene1xx { private: - bool _sayHiToBinky; uint32 _updateClock; public: Scene103(MADSEngine *vm); -- cgit v1.2.3 From 7260ad19d57db2f6f93c1313a0b69d7e61096c0d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 21 May 2014 21:12:19 +0200 Subject: MADS: Move the remaining contructors out of the header in scene group 1 --- engines/mads/nebular/nebular_scenes1.cpp | 27 +++++++++++++++++++++++++++ engines/mads/nebular/nebular_scenes1.h | 10 +++++----- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index e6f8d4fb8a..66da49cc51 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -1777,6 +1777,10 @@ void Scene104::synchronize(Common::Serializer &s) { /*------------------------------------------------------------------------*/ +Scene105::Scene105(MADSEngine *vm) : Scene1xx(vm) { + _explosionFl = false; +} + void Scene105::setup() { // Preloading has been skipped setPlayerSpritesPrefix(); @@ -1928,6 +1932,13 @@ void Scene105::synchronize(Common::Serializer &s) { /*------------------------------------------------------------------------*/ +Scene106::Scene106(MADSEngine *vm) : Scene1xx(vm) { + _backToShipFl = false; + _shadowFl = false; + _firstEmergingFl = false; + _msgPosY = 0; +} + void Scene106::setup() { setPlayerSpritesPrefix(); setAAName(); @@ -2143,6 +2154,10 @@ void Scene106::synchronize(Common::Serializer &s) { /*------------------------------------------------------------------------*/ +Scene107::Scene107(MADSEngine *vm) : Scene1xx(vm) { + _shootingFl = false; +} + void Scene107::setup() { setPlayerSpritesPrefix(); setAAName(); @@ -2348,6 +2363,7 @@ void Scene108::actions() { } /*------------------------------------------------------------------------*/ + Scene109::Scene109(MADSEngine *vm) : Scene1xx(vm) { _rexThrowingObject = false; _hoovicDifficultFl = false; @@ -2761,6 +2777,10 @@ void Scene109::synchronize(Common::Serializer &s) { /*------------------------------------------------------------------------*/ +Scene110::Scene110(MADSEngine *vm) : Scene1xx(vm) { + _crabsFl = false; +} + void Scene110::setup() { setPlayerSpritesPrefix(); setAAName(); @@ -2888,6 +2908,13 @@ void Scene110::synchronize(Common::Serializer &s) { /*------------------------------------------------------------------------*/ +Scene111::Scene111(MADSEngine *vm) : Scene1xx(vm) { + _stampedFl = false; + _launch1Fl = false; + _launched2Fl = false; + _rexDivingFl = false; +} + void Scene111::setup() { _scene->addActiveVocab(NOUN_BATS); diff --git a/engines/mads/nebular/nebular_scenes1.h b/engines/mads/nebular/nebular_scenes1.h index 318773e41b..3cb4d431a8 100644 --- a/engines/mads/nebular/nebular_scenes1.h +++ b/engines/mads/nebular/nebular_scenes1.h @@ -136,7 +136,7 @@ private: bool _explosionFl; public: - Scene105(MADSEngine *vm) : Scene1xx(vm), _explosionFl(false) {} + Scene105(MADSEngine *vm); virtual void setup(); virtual void enter(); @@ -155,7 +155,7 @@ private: int _msgPosY; public: - Scene106(MADSEngine *vm) : Scene1xx(vm), _backToShipFl(false), _shadowFl(false), _firstEmergingFl(false), _msgPosY(0) {} + Scene106(MADSEngine *vm); virtual void setup(); virtual void enter(); @@ -170,7 +170,7 @@ private: bool _shootingFl; public: - Scene107(MADSEngine *vm) : Scene1xx(vm), _shootingFl(false) {} + Scene107(MADSEngine *vm); virtual void setup(); virtual void enter(); @@ -218,7 +218,7 @@ private: bool _crabsFl; public: - Scene110(MADSEngine *vm) : Scene1xx(vm), _crabsFl(false) {} + Scene110(MADSEngine *vm); virtual void setup(); virtual void enter(); @@ -236,7 +236,7 @@ private: bool _rexDivingFl; public: - Scene111(MADSEngine *vm) : Scene1xx(vm), _stampedFl(false), _launch1Fl(false), _launched2Fl(false), _rexDivingFl(false) {} + Scene111(MADSEngine *vm); virtual void setup(); virtual void enter(); -- cgit v1.2.3 From 69acf34cba882ba3be28b780a871c055c7ca45a2 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 21 May 2014 21:48:21 +0200 Subject: MADS: Some refactoring in group scene 1 --- engines/mads/nebular/nebular_scenes1.cpp | 332 +++++++++++++++++-------------- 1 file changed, 188 insertions(+), 144 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 66da49cc51..131ee6ebe8 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -72,21 +72,21 @@ void Scene1xx::setPlayerSpritesPrefix() { _vm->_sound->command(5); Common::String oldName = _game._player._spritesPrefix; if (_scene->_nextSceneId <= 103 || _scene->_nextSceneId == 111) { - if (_globals[kSexOfRex] == SEX_FEMALE) { + if (_globals[kSexOfRex] == SEX_FEMALE) _game._player._spritesPrefix = "ROX"; - } else { + else { _game._player._spritesPrefix = "RXM"; _globals[kSexOfRex] = SEX_MALE; } } else if (_scene->_nextSceneId <= 110) { _game._player._spritesPrefix = "RXSW"; _globals[kSexOfRex] = SEX_UNKNOWN; - } else if (_scene->_nextSceneId == 112) { + } else if (_scene->_nextSceneId == 112) _game._player._spritesPrefix = ""; - } if (oldName == _game._player._spritesPrefix) _game._player._spritesChanged = true; + if (_scene->_nextSceneId == 105 || (_scene->_nextSceneId == 109 && _globals[kHoovicAlive])) { _game._player._spritesChanged = true; _game._player._loadsFirst = false; @@ -109,6 +109,19 @@ Scene101::Scene101(MADSEngine *vm) : Scene1xx(vm) { _oldSpecial = 0; } +void Scene101::synchronize(Common::Serializer &s) { + Scene1xx::synchronize(s); + + s.syncAsByte(_sittingFl); + s.syncAsByte(_panelOpened); + + s.syncAsSint16LE(_messageNum); + s.syncAsSint16LE(_posY); + s.syncAsSint16LE(_shieldSpriteIdx); + s.syncAsSint16LE(_chairHotspotId); + s.syncAsSint16LE(_oldSpecial); +} + void Scene101::setup() { _scene->_animationData->preLoad(formAnimName('A', -1), 3); setPlayerSpritesPrefix(); @@ -140,6 +153,9 @@ void Scene101::sayDang() { _vm->_dialogs->show(10117); _game._player._stepEnabled = true; break; + + default: + break; } } @@ -242,6 +258,9 @@ void Scene101::step() { case 73: sayDang(); break; + + default: + break; } if (_scene->_activeAnimation != nullptr) { @@ -307,6 +326,9 @@ void Scene101::preActions() { _globals._sequenceIndexes[12] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[12], false, 6, 0, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[12], 4); break; + + default: + break; } } } @@ -329,6 +351,9 @@ void Scene101::preActions() { _panelOpened = false; _scene->_hotspots.activate(NOUN_SHIELD_MODULATOR, false); break; + + default: + break; } } } @@ -377,6 +402,9 @@ void Scene101::actions() { } _game._trigger = 0; break; + + default: + break; } } else { _vm->_dialogs->show(10131); @@ -385,7 +413,7 @@ void Scene101::actions() { } } - if (((_action.isAction(VERB_WALKTO, NOUN_SHIELD_ACCESS_PANEL) || _action.isAction(VERB_OPEN, NOUN_SHIELD_ACCESS_PANEL))) && !_panelOpened) { + if ((_action.isAction(VERB_WALKTO, NOUN_SHIELD_ACCESS_PANEL) || _action.isAction(VERB_OPEN, NOUN_SHIELD_ACCESS_PANEL)) && !_panelOpened) { switch (_game._trigger) { case 0: _shieldSpriteIdx = _game._objects.isInRoom(OBJ_SHIELD_MODULATOR) ? 13 : 14; @@ -404,6 +432,9 @@ void Scene101::actions() { if (_game._objects.isInRoom(OBJ_SHIELD_MODULATOR)) _scene->_hotspots.activate(NOUN_SHIELD_MODULATOR, true); break; + + default: + break; } _action._inProgress = false; return; @@ -427,9 +458,9 @@ void Scene101::actions() { _vm->_dialogs->show(10128); else _vm->_dialogs->show(10129); - } else { + } else _vm->_dialogs->show(10127); - } + _action._inProgress = false; return; } @@ -441,9 +472,9 @@ void Scene101::actions() { } if (_action.isAction(VERB_LOOK, NOUN_VIEW_SCREEN) && _sittingFl) { - if (_globals[kWatchedViewScreen]) { + if (_globals[kWatchedViewScreen]) sayDang(); - } else { + else { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -473,6 +504,9 @@ void Scene101::actions() { _sittingFl = true; _scene->_nextSceneId = 112; break; + + default: + break; } } _action._inProgress = false; @@ -612,19 +646,6 @@ void Scene101::actions() { } } -void Scene101::synchronize(Common::Serializer &s) { - Scene1xx::synchronize(s); - - s.syncAsByte(_sittingFl); - s.syncAsByte(_panelOpened); - - s.syncAsSint16LE(_messageNum); - s.syncAsSint16LE(_posY); - s.syncAsSint16LE(_shieldSpriteIdx); - s.syncAsSint16LE(_chairHotspotId); - s.syncAsSint16LE(_oldSpecial); -} - /*------------------------------------------------------------------------*/ Scene102::Scene102(MADSEngine *vm) : Scene1xx(vm) { @@ -637,6 +658,19 @@ Scene102::Scene102(MADSEngine *vm) : Scene1xx(vm) { _fridgeCommentCount = 0; } +void Scene102::synchronize(Common::Serializer &s) { + Scene1xx::synchronize(s); + + s.syncAsByte(_fridgeOpenedFl); + s.syncAsByte(_fridgeOpenedDescr); + s.syncAsByte(_fridgeFirstOpenFl); + s.syncAsByte(_chairDescrFl); + s.syncAsByte(_drawerDescrFl); + s.syncAsByte(_activeMsgFl); + + s.syncAsSint16LE(_fridgeCommentCount); +} + void Scene102::setup() { _scene->_animationData->preLoad(formAnimName('A', -1), 3); setPlayerSpritesPrefix(); @@ -659,7 +693,6 @@ void Scene102::enter() { _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('x', 3)); _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('x', 4)); _globals._spriteIndexes[5] = _scene->_sprites.addSprites(formAnimName('x', 5)); - _globals._spriteIndexes[6] = _scene->_sprites.addSprites(formAnimName('b', -1)); _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('c', -1)); _globals._spriteIndexes[8] = _scene->_sprites.addSprites(formAnimName('e', -1)); @@ -691,9 +724,9 @@ void Scene102::enter() { _game._player._stepEnabled = false; _globals._sequenceIndexes[6] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[6], false, 6, 1, 2, 0); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_EXPIRE, 0, 70); - } else if (_scene->_priorSceneId == 103) { + } else if (_scene->_priorSceneId == 103) _game._player._playerPos = Common::Point(47, 152); - } else if (_scene->_priorSceneId != -2) { + else if (_scene->_priorSceneId != -2) { _game._player._facing = FACING_NORTHWEST; _game._player._playerPos = Common::Point(32, 129); } @@ -802,6 +835,9 @@ void Scene102::preActions() { _fridgeOpenedFl = false; _game._player._stepEnabled = true; break; + + default: + break; } } @@ -810,14 +846,13 @@ void Scene102::preActions() { } void Scene102::actions() { - bool justOpenedFl = false; - if (_action._lookFlag) { _vm->_dialogs->show(10234); _action._inProgress = false; return; } + bool justOpenedFl = false; if (_action.isObject(NOUN_REFRIGERATOR) && !_fridgeOpenedFl) { switch (_game._trigger) { case 0: @@ -855,6 +890,9 @@ void Scene102::actions() { if (_game._objects.isInRoom(OBJ_BURGER)) _scene->_hotspots.activate(NOUN_BURGER, true); break; + + default: + break; } } @@ -907,6 +945,9 @@ void Scene102::actions() { case 1: _scene->_nextSceneId = 101; break; + + default: + break; } _action._inProgress = false; return; @@ -1034,6 +1075,9 @@ void Scene102::actions() { _vm->_dialogs->show(10237); _scene->_nextSceneId = 106; break; + + default: + break; } _action._inProgress = false; return; @@ -1118,6 +1162,9 @@ void Scene102::actions() { _globals[kMedicineCabinetOpen] = false; _vm->_dialogs->show(10209); break; + + default: + break; } _action._inProgress = false; return; @@ -1148,6 +1195,9 @@ void Scene102::actions() { } _globals[kMedicineCabinetVirgin] = false; break; + + default: + break; } _action._inProgress = false; return; @@ -1172,6 +1222,9 @@ void Scene102::actions() { _vm->_sound->command(22); _vm->_dialogs->showItem(OBJ_BINOCULARS, 10201); break; + + default: + break; } _action._inProgress = false; return; @@ -1228,25 +1281,19 @@ void Scene102::postActions() { } } -void Scene102::synchronize(Common::Serializer &s) { - Scene1xx::synchronize(s); - - s.syncAsByte(_fridgeOpenedFl); - s.syncAsByte(_fridgeOpenedDescr); - s.syncAsByte(_fridgeFirstOpenFl); - s.syncAsByte(_chairDescrFl); - s.syncAsByte(_drawerDescrFl); - s.syncAsByte(_activeMsgFl); - - s.syncAsSint16LE(_fridgeCommentCount); -} - /*------------------------------------------------------------------------*/ Scene103::Scene103(MADSEngine *vm) : Scene1xx(vm) { _updateClock = 0; } +void Scene103::synchronize(Common::Serializer &s) { + Scene1xx::synchronize(s); + byte dummy = 0; + s.syncAsByte(dummy); // In order to avoid to break savegame compatibility + s.syncAsUint32LE(_updateClock); +} + void Scene103::setup() { setPlayerSpritesPrefix(); setAAName(); @@ -1265,15 +1312,16 @@ void Scene103::enter() { _globals._spriteIndexes[9] = _scene->_sprites.addSprites(formAnimName('t', -1)); _globals._spriteIndexes[10] = _scene->_sprites.addSprites(formAnimName('r', -1)); _globals._spriteIndexes[11] = _scene->_sprites.addSprites(formAnimName('c', -1)); - _globals._spriteIndexes[12] = _scene->_sprites.addSprites("*RXMBD_2"); _globals._spriteIndexes[13] = _scene->_sprites.addSprites("*RXMRD_3"); _globals._spriteIndexes[15] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], false, 7, 0, 1, 0); + _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 6, 0, 2, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 0); _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 6, 0, 0, 25); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_SPRITE, 2, 72); + _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 6, 0, 1, 37); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_SPRITE, 2, 73); @@ -1303,7 +1351,6 @@ void Scene103::enter() { if (_scene->_priorSceneId == 102) { _game._player._stepEnabled = false; - _globals._sequenceIndexes[6] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[6], false, 6, 1, 0, 0); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[6], SEQUENCE_TRIGGER_EXPIRE, 0, 70); } @@ -1325,24 +1372,23 @@ void Scene103::enter() { } void Scene103::step() { - Common::Point pt; - int dist; - switch (_vm->_game->_trigger) { case 70: _vm->_game->_player._stepEnabled = true; break; - case 72: - pt = _vm->_game->_player._playerPos; - dist = _vm->hypotenuse(pt.x - 58, pt.y - 93); + case 72: { + Common::Point pt = _vm->_game->_player._playerPos; + int dist = _vm->hypotenuse(pt.x - 58, pt.y - 93); _vm->_sound->command(27, (dist * -128 / 378) + 127); + } break; - case 73: - pt = _vm->_game->_player._playerPos; - dist = _vm->hypotenuse(pt.x - 266, pt.y - 81); + case 73: { + Common::Point pt = _vm->_game->_player._playerPos; + int dist = _vm->hypotenuse(pt.x - 266, pt.y - 81); _vm->_sound->command(27, (dist * -127 / 378) + 127); + } break; default: @@ -1350,8 +1396,8 @@ void Scene103::step() { } if (_scene->_frameStartTime >= _updateClock) { - pt = _vm->_game->_player._playerPos; - dist = _vm->hypotenuse(pt.x - 79, pt.y - 137); + Common::Point pt = _vm->_game->_player._playerPos; + int dist = _vm->hypotenuse(pt.x - 79, pt.y - 137); _vm->_sound->command(29, (dist * -127 / 378) + 127); pt = _vm->_game->_player._playerPos; @@ -1367,9 +1413,9 @@ void Scene103::step() { } void Scene103::actions() { - if (_action._savedFields._lookFlag) { + if (_action._savedFields._lookFlag) _vm->_dialogs->show(10322); - } else if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOOR)) { + else if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOOR)) { switch (_vm->_game->_trigger) { case 0: _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 6, 1); @@ -1445,9 +1491,9 @@ void Scene103::actions() { default: break; } - } else if (_action.isAction(VERB_LOOK, 362)) { + } else if (_action.isAction(VERB_LOOK, 362)) _vm->_dialogs->show(10301); - } else if (_action.isAction(VERB_TAKE, 362)) { + else if (_action.isAction(VERB_TAKE, 362)) { // Take Turkey if (!_vm->_game->_trigger) _vm->_sound->command(31); @@ -1477,9 +1523,9 @@ void Scene103::actions() { _vm->_dialogs->show(10302); _scene->_hotspots.activate(362, false); } - } else if (_action.isAction(VERB_LOOK, 250)) { + } else if (_action.isAction(VERB_LOOK, 250)) _vm->_dialogs->show(!_globals[kTurkeyExploded] ? 10323 : 10303); - } else if (_action.isAction(VERB_TALKTO, 27)) { + else if (_action.isAction(VERB_TALKTO, 27)) { switch (_vm->_game->_trigger) { case 0: { _game._player._stepEnabled = false; @@ -1507,43 +1553,40 @@ void Scene103::actions() { default: break; } - } else if (_action.isAction(VERB_LOOK, 27)) { + } else if (_action.isAction(VERB_LOOK, 27)) _vm->_dialogs->show(10304); - } else if (_action.isAction(VERB_LOOK, 36)) { + else if (_action.isAction(VERB_LOOK, 36)) _vm->_dialogs->show(10307); - } else if (_action.isAction(VERB_LOOK, 55)) { + else if (_action.isAction(VERB_LOOK, 55)) _vm->_dialogs->show(10308); - } else if (_action.isAction(VERB_TAKE, 315)) { + else if (_action.isAction(VERB_TAKE, 315)) _vm->_dialogs->show(10309); - } else if (_action.isAction(VERB_TAKE, 85)) { + else if (_action.isAction(VERB_TAKE, 85)) _vm->_dialogs->show(10310); - } else if (_action.isAction(VERB_LOOK, 144)) { + else if (_action.isAction(VERB_LOOK, 144)) _vm->_dialogs->show(10312); - } else if (_action.isAction(VERB_OPEN, 144)) { + else if (_action.isAction(VERB_OPEN, 144)) _vm->_dialogs->show(10313); - } else if (_action.isAction(VERB_CLOSE, 27)) { + else if (_action.isAction(VERB_CLOSE, 27)) _vm->_dialogs->show(10314); - } else if (_action.isAction(VERB_LOOK, 310)) { + else if (_action.isAction(VERB_LOOK, 310)) _vm->_dialogs->show(10315); - } else if (_action.isAction(VERB_LOOK, 178)) { + else if (_action.isAction(VERB_LOOK, 178)) _vm->_dialogs->show(10316); - } else if (_action.isAction(VERB_LOOK, 283)) { + else if (_action.isAction(VERB_LOOK, 283)) _vm->_dialogs->show(10317); - } else if (_action.isAction(VERB_LOOK, 120)) { + else if (_action.isAction(VERB_LOOK, 120)) _vm->_dialogs->show(10318); - } else if (_action.isAction(VERB_LOOK, 289) && - _game._objects.isInInventory(OBJ_REBREATHER)) { + else if (_action.isAction(VERB_LOOK, 289) && _game._objects.isInInventory(OBJ_REBREATHER)) _vm->_dialogs->show(10319); - } else if (_action.isAction(VERB_LOOK, 371) && - _game._objects.isInInventory(OBJ_TIMER_MODULE)) { + else if (_action.isAction(VERB_LOOK, 371) && _game._objects.isInInventory(OBJ_TIMER_MODULE)) _vm->_dialogs->show(10320); - } else if (_action.isAction(VERB_LOOK, 137)) { + else if (_action.isAction(VERB_LOOK, 137)) _vm->_dialogs->show(10321); - } else if (_action.isAction(VERB_LOOK, 409)) { + else if (_action.isAction(VERB_LOOK, 409)) _vm->_dialogs->show(_game._objects.isInInventory(OBJ_TIMER_MODULE) ? 10324 : 10325); - } else { + else return; - } _action._inProgress = false; } @@ -1552,23 +1595,13 @@ void Scene103::postActions() { if (_action.isAction(27) && !_action.isAction(VERB_WALKTO)) { _vm->_dialogs->show(10305); _action._inProgress = false; - } else { - if (_action.isAction(VERB_PUT, 85, 144)) { - Common::String msg = _game.getQuote(73); - _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, - 34, 0, 120, msg); - _action._inProgress = false; - } + } else if (_action.isAction(VERB_PUT, 85, 144)) { + Common::String msg = _game.getQuote(73); + _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, msg); + _action._inProgress = false; } } -void Scene103::synchronize(Common::Serializer &s) { - Scene1xx::synchronize(s); - byte dummy = 0; - s.syncAsByte(dummy); // In order to avoid to break savegame compatibility - s.syncAsUint32LE(_updateClock); -} - /*------------------------------------------------------------------------*/ Scene104::Scene104(MADSEngine *vm) : Scene1xx(vm) { @@ -1576,6 +1609,13 @@ Scene104::Scene104(MADSEngine *vm) : Scene1xx(vm) { _loseFl = false; } +void Scene104::synchronize(Common::Serializer &s) { + Scene1xx::synchronize(s); + + s.syncAsByte(_kargShootingFl); + s.syncAsByte(_loseFl); +} + void Scene104::setup() { // Preloading has been skipped setPlayerSpritesPrefix(); @@ -1647,6 +1687,9 @@ void Scene104::step() { _vm->_dialogs->show(10406); _scene->_reloadSceneFlag = true; break; + + default: + break; } break; @@ -1686,6 +1729,9 @@ void Scene104::step() { _vm->_dialogs->show(10406); _scene->_reloadSceneFlag = true; break; + + default: + break; } break; @@ -1718,6 +1764,9 @@ void Scene104::step() { _vm->_dialogs->show(10406); _scene->_reloadSceneFlag = true; break; + + default: + break; } break; default: @@ -1768,19 +1817,17 @@ void Scene104::actions() { _action._inProgress = false; } -void Scene104::synchronize(Common::Serializer &s) { - Scene1xx::synchronize(s); - - s.syncAsByte(_kargShootingFl); - s.syncAsByte(_loseFl); -} - /*------------------------------------------------------------------------*/ Scene105::Scene105(MADSEngine *vm) : Scene1xx(vm) { _explosionFl = false; } +void Scene105::synchronize(Common::Serializer &s) { + Scene1xx::synchronize(s); + s.syncAsByte(_explosionFl); +} + void Scene105::setup() { // Preloading has been skipped setPlayerSpritesPrefix(); @@ -1861,6 +1908,9 @@ void Scene105::step() { _scene->_reloadSceneFlag = true; _scene->_sequences.addTimer(90, 4); break; + + default: + break; } } @@ -1925,11 +1975,6 @@ void Scene105::actions() { _action._inProgress = false; } -void Scene105::synchronize(Common::Serializer &s) { - Scene1xx::synchronize(s); - s.syncAsByte(_explosionFl); -} - /*------------------------------------------------------------------------*/ Scene106::Scene106(MADSEngine *vm) : Scene1xx(vm) { @@ -1939,6 +1984,14 @@ Scene106::Scene106(MADSEngine *vm) : Scene1xx(vm) { _msgPosY = 0; } +void Scene106::synchronize(Common::Serializer &s) { + Scene1xx::synchronize(s); + s.syncAsByte(_backToShipFl); + s.syncAsByte(_shadowFl); + s.syncAsByte(_firstEmergingFl); + s.syncAsSint32LE(_msgPosY); +} + void Scene106::setup() { setPlayerSpritesPrefix(); setAAName(); @@ -2144,20 +2197,17 @@ void Scene106::actions() { _action._inProgress = false; } -void Scene106::synchronize(Common::Serializer &s) { - Scene1xx::synchronize(s); - s.syncAsByte(_backToShipFl); - s.syncAsByte(_shadowFl); - s.syncAsByte(_firstEmergingFl); - s.syncAsSint32LE(_msgPosY); -} - /*------------------------------------------------------------------------*/ Scene107::Scene107(MADSEngine *vm) : Scene1xx(vm) { _shootingFl = false; } +void Scene107::synchronize(Common::Serializer &s) { + Scene1xx::synchronize(s); + s.syncAsByte(_shootingFl); +} + void Scene107::setup() { setPlayerSpritesPrefix(); setAAName(); @@ -2268,12 +2318,6 @@ void Scene107::actions() { _action._inProgress = false; } -void Scene107::synchronize(Common::Serializer &s) { - Scene1xx::synchronize(s); - s.syncAsByte(_shootingFl); -} - - /*------------------------------------------------------------------------*/ void Scene108::setup() { @@ -2376,6 +2420,18 @@ Scene109::Scene109(MADSEngine *vm) : Scene1xx(vm) { _hoovicTrigger = 0; } +void Scene109::synchronize(Common::Serializer &s) { + Scene1xx::synchronize(s); + s.syncAsByte(_rexThrowingObject); + s.syncAsByte(_hoovicDifficultFl); + s.syncAsByte(_beforeEatingRex); + s.syncAsByte(_eatingRex); + s.syncAsByte(_hungryFl); + s.syncAsByte(_eatingFirstFish); + s.syncAsSint32LE(_throwingObjectId); + s.syncAsSint32LE(_hoovicTrigger); +} + void Scene109::setup() { _scene->addActiveVocab(NOUN_DEAD_PURPLE_MONSTER); _scene->addActiveVocab(NOUN_MONSTER_SLUDGE); @@ -2763,24 +2819,17 @@ void Scene109::actions() { _action._inProgress = false; } -void Scene109::synchronize(Common::Serializer &s) { - Scene1xx::synchronize(s); - s.syncAsByte(_rexThrowingObject); - s.syncAsByte(_hoovicDifficultFl); - s.syncAsByte(_beforeEatingRex); - s.syncAsByte(_eatingRex); - s.syncAsByte(_hungryFl); - s.syncAsByte(_eatingFirstFish); - s.syncAsSint32LE(_throwingObjectId); - s.syncAsSint32LE(_hoovicTrigger); -} - /*------------------------------------------------------------------------*/ Scene110::Scene110(MADSEngine *vm) : Scene1xx(vm) { _crabsFl = false; } +void Scene110::synchronize(Common::Serializer &s) { + Scene1xx::synchronize(s); + s.syncAsByte(_crabsFl); +} + void Scene110::setup() { setPlayerSpritesPrefix(); setAAName(); @@ -2901,11 +2950,6 @@ void Scene110::actions() { _action._inProgress = false; } -void Scene110::synchronize(Common::Serializer &s) { - Scene1xx::synchronize(s); - s.syncAsByte(_crabsFl); -} - /*------------------------------------------------------------------------*/ Scene111::Scene111(MADSEngine *vm) : Scene1xx(vm) { @@ -2915,6 +2959,14 @@ Scene111::Scene111(MADSEngine *vm) : Scene1xx(vm) { _rexDivingFl = false; } +void Scene111::synchronize(Common::Serializer &s) { + Scene1xx::synchronize(s); + s.syncAsByte(_stampedFl); + s.syncAsByte(_launch1Fl); + s.syncAsByte(_launched2Fl); + s.syncAsByte(_rexDivingFl); +} + void Scene111::setup() { _scene->addActiveVocab(NOUN_BATS); @@ -3055,14 +3107,6 @@ void Scene111::actions() { _action._inProgress = false; } -void Scene111::synchronize(Common::Serializer &s) { - Scene1xx::synchronize(s); - s.syncAsByte(_stampedFl); - s.syncAsByte(_launch1Fl); - s.syncAsByte(_launched2Fl); - s.syncAsByte(_rexDivingFl); -} - /*------------------------------------------------------------------------*/ void Scene112::setup() { -- cgit v1.2.3 From 2ff0a553c303569412030a55d61802f7006727f1 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Wed, 21 May 2014 22:26:22 +0100 Subject: CONFIGURE: Send output for host-alias-strings test to config.log This is not critical to build configuration and any problems would be visible by an incorrect endian test result. --- configure | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure b/configure index ee97e17786..c2020ab89e 100755 --- a/configure +++ b/configure @@ -1843,13 +1843,13 @@ if test "$_global_constructors" = yes; then fi echo $_global_constructors -echo_n "Checking for $_host_alias-strings... " +echo_n "Checking for $_host_alias-strings... " >> "$TMPLOG" if test ! "x$(which $_host_alias-strings 2>/dev/null)" = "x"; then _strings=$_host_alias-strings -echo yes +echo yes >> "$TMPLOG" else _strings=strings -echo no +echo no >> "$TMPLOG" fi # -- cgit v1.2.3 From 12a70d2ce14531ba983fa39f3831317eb7e17e7d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 21 May 2014 22:16:21 -0400 Subject: MADS: Fix issues with inventory list scrolling when it shouldn't --- engines/mads/user_interface.cpp | 103 ++++++++++++++++++++-------------------- 1 file changed, 51 insertions(+), 52 deletions(-) diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 3fab30a0ab..68f578489e 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -497,62 +497,61 @@ void UserInterface::updateInventoryScroller() { _scrollbarActive = SCROLLBAR_NONE; - if (( - (screenObjects._category == CAT_INV_SCROLLER) || - // FIXME: This scrolls the inventory up when selecting verbs or attempting to combine items - false/*(screenObjects._category != CAT_INV_SCROLLER && _scrollbarOldActive == SCROLLBAR_ELEVATOR)*/ - ) && (_vm->_events->_mouseStatusCopy || _vm->_easyMouse)) { - if ((_vm->_events->_mouseClicked || (_vm->_easyMouse && !_vm->_events->_mouseStatusCopy)) - && (screenObjects._category == CAT_INV_SCROLLER)) - _scrollbarStrokeType = (ScrollbarActive)screenObjects._spotId; - - if (screenObjects._spotId == _scrollbarStrokeType || _scrollbarOldActive == SCROLLBAR_ELEVATOR) { - _scrollbarActive = _scrollbarStrokeType; - uint32 currentMilli = g_system->getMillis(); - uint32 timeInc = _scrollbarQuickly ? 100 : 380; - - if (_vm->_events->_mouseStatus && (_scrollbarMilliTime + timeInc) <= currentMilli) { - _scrollbarQuickly = _vm->_events->_vD2 < 1; - _scrollbarMilliTime = currentMilli; - - switch (_scrollbarStrokeType) { - case SCROLLBAR_UP: - // Scroll up - if (_inventoryTopIndex > 0 && inventoryList.size() > 0) { - --_inventoryTopIndex; - _inventoryChanged = true; + if ((screenObjects._category == CAT_INV_SCROLLER) || (screenObjects._category != CAT_INV_SCROLLER + && _scrollbarOldActive == SCROLLBAR_ELEVATOR && _vm->_events->_mouseStatusCopy)) { + if (_vm->_events->_mouseStatusCopy || _vm->_easyMouse) { + if ((_vm->_events->_mouseClicked || (_vm->_easyMouse && !_vm->_events->_mouseStatusCopy)) + && (screenObjects._category == CAT_INV_SCROLLER)) + _scrollbarStrokeType = (ScrollbarActive)screenObjects._spotId; + + if (screenObjects._spotId == _scrollbarStrokeType || _scrollbarOldActive == SCROLLBAR_ELEVATOR) { + _scrollbarActive = _scrollbarStrokeType; + uint32 currentMilli = g_system->getMillis(); + uint32 timeInc = _scrollbarQuickly ? 100 : 380; + + if (_vm->_events->_mouseStatus && (_scrollbarMilliTime + timeInc) <= currentMilli) { + _scrollbarQuickly = _vm->_events->_vD2 < 1; + _scrollbarMilliTime = currentMilli; + + switch (_scrollbarStrokeType) { + case SCROLLBAR_UP: + // Scroll up + if (_inventoryTopIndex > 0 && inventoryList.size() > 0) { + --_inventoryTopIndex; + _inventoryChanged = true; + } + break; + + case SCROLLBAR_DOWN: + // Scroll down + if (_inventoryTopIndex < ((int)inventoryList.size() - 1) && inventoryList.size() > 1) { + ++_inventoryTopIndex; + _inventoryChanged = true; + } + break; + + case SCROLLBAR_ELEVATOR: { + // Inventory slider + int newIndex = CLIP((int)_vm->_events->currentPos().y - 170, 0, 17) + * inventoryList.size() / 10; + if (newIndex >= (int)inventoryList.size()) + newIndex = inventoryList.size() - 1; + + if (inventoryList.size() > 0) { + _inventoryChanged = newIndex != _inventoryTopIndex; + _inventoryTopIndex = newIndex; + } + break; } - break; - case SCROLLBAR_DOWN: - // Scroll down - if (_inventoryTopIndex < ((int)inventoryList.size() - 1) && inventoryList.size() > 1) { - ++_inventoryTopIndex; - _inventoryChanged = true; - } - break; - - case SCROLLBAR_ELEVATOR: { - // Inventory slider - int newIndex = CLIP((int)_vm->_events->currentPos().y - 170, 0, 17) - * inventoryList.size() / 10; - if (newIndex >= (int)inventoryList.size()) - newIndex = inventoryList.size() - 1; - - if (inventoryList.size() > 0) { - _inventoryChanged = newIndex != _inventoryTopIndex; - _inventoryTopIndex = newIndex; + default: + break; } - break; - } - default: - break; - } - - if (_inventoryChanged) { - int dummy; - updateSelection(CAT_INV_LIST, 0, &dummy); + if (_inventoryChanged) { + int dummy; + updateSelection(CAT_INV_LIST, 0, &dummy); + } } } } -- cgit v1.2.3 From 15ffe359a80d6343247e141f0bd69ecae52fc9e4 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 22 May 2014 08:02:09 +0300 Subject: FULLPIPE: Started work on MovGraph::fillMGMinfo() --- engines/fullpipe/motion.cpp | 99 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 6162537dba..7e86de7ba9 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -842,6 +842,105 @@ MessageQueue *MovGraph::sub1(StaticANIObject *ani, int x, int y, int a5, int x1, } MessageQueue *MovGraph::fillMGMinfo(StaticANIObject *ani, MovArr *movarr, int staticsId) { +#if 0 + v27 = ani->_ox; + v8 = movarr->_movStepCount; + v9 = 0; + MessageQueue *mq = 0; + v28 = ani->_oy; + v26 = 0; + if (v8 > 0) { + while (1) { + if (v9 < v8 - 1) { + v10 = (MovStepShifted *)&movarr->_movSteps[v9 + 1].link; + movarra = (MovStepShifted *)&movarr->_movSteps[v9 + 1].link; + do { + if ( *(_DWORD *)(*(_DWORD *)(v10[-1].link + 16) + 4 * (unsigned int)((char *)v10[-2]._sfield_0 + _field_44)) != + *(_DWORD *)(*(_DWORD *)(movarra->link + 16) + 4 * (unsigned int)((char *)v10[-1]._sfield_0 + _field_44)) ) + break; + ++v9; + v10 = movarra + 1; + ++movarra; + } while (v9 < v8 - 1); + } + + ani->getMovementById(movarr->_movSteps[v9].link->dwordArray1[_field_44 + movarr->_movSteps[v9]._sfield_0]); + v11 = movarr->_movStepCount - 1; + v13 = __OFSUB__(v9, v11); + v12 = v9 - v11 < 0; + if (v9 == v11) { + if (staticsId) { + id2 = staticsId; + goto LABEL_13; + } + v13 = __OFSUB__(v9, v11); + v12 = v9 - v11 < 0; + } + if (v12 ^ v13) + id2 = ani->getMovementById(movarr->_movSteps[v9 + 1].link->dwordArray1[_field_44 + movarr->_movSteps[v9]._sfield_0])->_staticsObj1->_staticsId; + else + id2 = movarr->_movSteps[v9].link->_dwordArray2[_field_44 + movarr->_movSteps[v9]._sfield_0]; + LABEL_13: + v14 = movarr->_movSteps; + v15 = movarr->_movStepCount - 1; + + if (v9 == v15) { + v16 = v14[v9].link->_movGraphNode1->_distance; + v17 = movarr->_point.x; + v33 = movarr->_point.y; + ny = v33; + v32 = v17; + v34 = v16; + nx = v17; + nd = v16; + } else { + v18 = v14[v9]._sfield_0; + v19 = &v14[v9]; + if (v18) { + v21 = (MovGraphNodeShifted *)&v19->link->_movGraphNode1->_x; + nx = v21->_x; + ny = v21->_y; + nd = v21->_distance; + } else { + v20 = (MovGraphNodeShifted *)&v19->link->_movGraphNode2->_x; + nx = v20->_x; + ny = v20->_y; + nd = v20->_distance; + } + } + memset(&mgminfo, 0, sizeof(mgminfo)); + mgminfo.ani = ani; + mgminfo.staticsId2 = id2; + mgminfo.staticsId1 = v26; + mgminfo.x1 = nx; + mgminfo.x2 = v27; + mgminfo.y2 = v28; + mgminfo.y1 = ny; + mgminfo.field_1C = nd; + mgminfo.movementId = movarr->_movSteps[v9].link->dwordArray1[_field_44 + movarr->_movSteps[v9]._sfield_0]; + mgminfo.flags = (mq != 0) | 48 * (mq != 0) | 0xE; + v23 = _mgm->genMovement(&mgminfo); + + if (mq) { + if (v23) { + mq->transferExCommands(v23); + delete v23; + } + } else { + mq = v23; + } + v27 = nx; + v28 = ny; + v26 = id2; + + v8 = movarr->_movStepCount; + ++v9; + if (v9 >= v8) + return mq; + } + } + return 0; +#endif warning("STUB: *MovGraph::fillMGMinfo()"); return 0; -- cgit v1.2.3 From e8cbe9e7dea0a9ccf4982c8c6b045f2cd6c8a92c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 22 May 2014 17:06:59 +0200 Subject: MADS: Move contructors out of the header in scene group 2 --- engines/mads/nebular/nebular_scenes2.cpp | 418 +++++++++++++++++++------------ engines/mads/nebular/nebular_scenes2.h | 35 +-- 2 files changed, 280 insertions(+), 173 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 950552148f..2c26e88fe9 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -117,6 +117,15 @@ void Scene2xx::sceneEntrySound() { /*------------------------------------------------------------------------*/ +Scene201::Scene201(MADSEngine *vm) : Scene2xx(vm) { + _pterodactylFlag = false; +} + +void Scene201::synchronize(Common::Serializer &s) { + Scene2xx::synchronize(s); + s.syncAsByte(_pterodactylFlag); +} + void Scene201::setup() { setPlayerSpritesPrefix(); setAAName(); @@ -324,12 +333,41 @@ void Scene201::actions() { _action._inProgress = false; } -void Scene201::synchronize(Common::Serializer &s) { - Scene2xx::synchronize(s); - s.syncAsByte(_pterodactylFlag); +/*------------------------------------------------------------------------*/ + +Scene202::Scene202(MADSEngine *vm) : Scene2xx(vm) { + _activeMsgFl = false; + _ladderTopFl = false; + _waitingMeteoFl = false; + _ladderHotspotId = -1; + _meteoClock1 = 0; + _meteoClock2 = 0; + _toStationFl = false; + _toTeleportFl = false; + _lastRoute = 0; + _stationCounter = 0; + _meteoFrame = 0; } -/*------------------------------------------------------------------------*/ +void Scene202::synchronize(Common::Serializer &s) { + Scene2xx::synchronize(s); + s.syncAsByte(_activeMsgFl); + s.syncAsByte(_ladderTopFl); + s.syncAsByte(_waitingMeteoFl); + s.syncAsByte(_toStationFl); + s.syncAsByte(_toTeleportFl); + + s.syncAsSint32LE(_ladderHotspotId); + s.syncAsSint32LE(_lastRoute); + s.syncAsSint32LE(_stationCounter); + s.syncAsSint32LE(_meteoFrame); + + s.syncAsUint32LE(_meteoClock1); + s.syncAsUint32LE(_meteoClock2); + s.syncAsUint32LE(_startTime); + + s.syncAsByte(_meteorologistSpecial); +} void Scene202::setup() { setPlayerSpritesPrefix(); @@ -973,27 +1011,18 @@ void Scene202::actions() { _action._inProgress = false; } -void Scene202::synchronize(Common::Serializer &s) { - Scene2xx::synchronize(s); - s.syncAsByte(_activeMsgFl); - s.syncAsByte(_ladderTopFl); - s.syncAsByte(_waitingMeteoFl); - s.syncAsByte(_toStationFl); - s.syncAsByte(_toTeleportFl); - - s.syncAsSint32LE(_ladderHotspotId); - s.syncAsSint32LE(_lastRoute); - s.syncAsSint32LE(_stationCounter); - s.syncAsSint32LE(_meteoFrame); - - s.syncAsUint32LE(_meteoClock1); - s.syncAsUint32LE(_meteoClock2); - s.syncAsUint32LE(_startTime); +/*****************************************************************************/ - s.syncAsByte(_meteorologistSpecial); +Scene203::Scene203(MADSEngine *vm) : Scene2xx(vm) { + _rhotundaEat2Fl = false; + _rhotundaEatFl = false; } -/*****************************************************************************/ +void Scene203::synchronize(Common::Serializer &s) { + Scene2xx::synchronize(s); + s.syncAsByte(_rhotundaEat2Fl); + s.syncAsByte(_rhotundaEatFl); +} void Scene203::setup() { setPlayerSpritesPrefix(); @@ -1105,12 +1134,6 @@ void Scene203::actions() { _action._inProgress = false; } -void Scene203::synchronize(Common::Serializer &s) { - Scene2xx::synchronize(s); - s.syncAsByte(_rhotundaEat2Fl); - s.syncAsByte(_rhotundaEatFl); -} - /*****************************************************************************/ void Scene205::setup() { @@ -1121,6 +1144,22 @@ void Scene205::setup() { _scene->addActiveVocab(NOUN_PIRANHA); } +Scene205::Scene205(MADSEngine *vm) : Scene2xx(vm) { + _lastFishTime = 0; + _chickenTime = 0; + _beingKicked = false; + _kernelMessage = -1; +} + +void Scene205::synchronize(Common::Serializer &s) { + Scene2xx::synchronize(s); + + s.syncAsUint32LE(_lastFishTime); + s.syncAsUint32LE(_chickenTime); + s.syncAsByte(_beingKicked); + s.syncAsSint16LE(_kernelMessage); +} + void Scene205::enter() { _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 0)); _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 1)); @@ -1394,15 +1433,30 @@ void Scene205::actions() { _action._inProgress = false; } -void Scene205::synchronize(Common::Serializer &s) { - Scene2xx::synchronize(s); - s.syncAsUint32LE(_lastFishTime); - s.syncAsUint32LE(_chickenTime); - s.syncAsByte(_beingKicked); - s.syncAsSint16LE(_kernelMessage); +/*****************************************************************************/ + +Scene207::Scene207(MADSEngine *vm) : Scene2xx(vm) { + _vultureFl = false; + _spiderFl = false; + _eyeFl = false; + _spiderHotspotId = -1; + _vultureHotspotId = -1; + _spiderTime = 0; + _vultureTime = 0; } -/*****************************************************************************/ +void Scene207::synchronize(Common::Serializer &s) { + Scene2xx::synchronize(s); + + s.syncAsByte(_vultureFl); + s.syncAsByte(_spiderFl); + s.syncAsByte(_eyeFl); + + s.syncAsSint32LE(_spiderHotspotId); + s.syncAsSint32LE(_vultureHotspotId); + s.syncAsSint32LE(_spiderTime); + s.syncAsSint32LE(_vultureTime); +} void Scene207::setup() { setPlayerSpritesPrefix(); @@ -1533,11 +1587,11 @@ void Scene207::preActions() { } void Scene207::actions() { - if (_action._savedFields._lookFlag) { + if (_action._savedFields._lookFlag) _vm->_dialogs->show(20711); - } else if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOORWAY)) { + else if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOORWAY)) _scene->_nextSceneId = 214; - } else { + else { if ((_game._player._playerPos.x > 150) && (_game._player._playerPos.x < 189) && (_game._player._playerPos.y > 111) && (_game._player._playerPos.y < 130)) { if ((_game._player._playerPos.x <= 162) || (_game._player._playerPos.x >= 181) || @@ -1553,54 +1607,55 @@ void Scene207::actions() { _eyeFl = false; } - if (_action.isAction(VERB_LOOK, NOUN_DENSE_FOREST)) { + if (_action.isAction(VERB_LOOK, NOUN_DENSE_FOREST)) _vm->_dialogs->show(20701); - } else if (_action.isAction(VERB_LOOK, NOUN_HEDGE)) { + else if (_action.isAction(VERB_LOOK, NOUN_HEDGE)) _vm->_dialogs->show(20702); - } else if (_action.isAction(VERB_LOOK, NOUN_SKULL_AND_CROSSBONES)) { + else if (_action.isAction(VERB_LOOK, NOUN_SKULL_AND_CROSSBONES)) _vm->_dialogs->show(20703); - } else if (_action.isAction(VERB_LOOK, NOUN_CAULDRON)) { + else if (_action.isAction(VERB_LOOK, NOUN_CAULDRON)) _vm->_dialogs->show(20704); - } else if (_action.isAction(VERB_LOOK, NOUN_WITCHDOCTOR_HUT)) { + else if (_action.isAction(VERB_LOOK, NOUN_WITCHDOCTOR_HUT)) _vm->_dialogs->show(20705); - } else if (_action.isAction(VERB_LOOK, NOUN_PATH_TO_WEST)) { + else if (_action.isAction(VERB_LOOK, NOUN_PATH_TO_WEST)) _vm->_dialogs->show(20706); - } else if (_action.isAction(VERB_LOOK, NOUN_MOUNTAINS)) { + else if (_action.isAction(VERB_LOOK, NOUN_MOUNTAINS)) _vm->_dialogs->show(20707); - } else if (_action.isAction(VERB_LOOK, NOUN_ALOE_PLANT)) { + else if (_action.isAction(VERB_LOOK, NOUN_ALOE_PLANT)) _vm->_dialogs->show(20708); - } else if (_action.isAction(VERB_LOOK, NOUN_LAWN)) { + else if (_action.isAction(VERB_LOOK, NOUN_LAWN)) _vm->_dialogs->show(20709); - } else if (_action.isAction(VERB_LOOK, NOUN_VULTURE)) { + else if (_action.isAction(VERB_LOOK, NOUN_VULTURE)) _vm->_dialogs->show(20710); - } else if (_action.isAction(VERB_TAKE, NOUN_SKULL_AND_CROSSBONES)) { + else if (_action.isAction(VERB_TAKE, NOUN_SKULL_AND_CROSSBONES)) _vm->_dialogs->show(20712); - } else if (_action.isAction(VERB_TAKE, NOUN_ALOE_PLANT)) { + else if (_action.isAction(VERB_TAKE, NOUN_ALOE_PLANT)) _vm->_dialogs->show(20713); - } else if (_action.isAction(VERB_LOOK, NOUN_SPIDER)) { + else if (_action.isAction(VERB_LOOK, NOUN_SPIDER)) _vm->_dialogs->show(20714); - } else if (_action.isAction(VERB_TAKE, NOUN_SPIDER)) { + else if (_action.isAction(VERB_TAKE, NOUN_SPIDER)) _vm->_dialogs->show(20715); - } else + else return; } _action._inProgress = false; } -void Scene207::synchronize(Common::Serializer &s) { - Scene2xx::synchronize(s); - s.syncAsByte(_vultureFl); - s.syncAsByte(_spiderFl); - s.syncAsByte(_eyeFl); +/*****************************************************************************/ - s.syncAsSint32LE(_spiderHotspotId); - s.syncAsSint32LE(_vultureHotspotId); - s.syncAsSint32LE(_spiderTime); - s.syncAsSint32LE(_vultureTime); +Scene208::Scene208(MADSEngine *vm) : Scene2xx(vm) { + _rhotundaTurnFl = false; + _boundingFl = false; + _rhotundaTime = 0; } -/*****************************************************************************/ +void Scene208::synchronize(Common::Serializer &s) { + Scene2xx::synchronize(s); + s.syncAsByte(_rhotundaTurnFl); + s.syncAsByte(_boundingFl); + s.syncAsSint32LE(_rhotundaTime); +} void Scene208::setup() { setPlayerSpritesPrefix(); @@ -1758,6 +1813,7 @@ void Scene208::subAction(int mode) { _vm->_sound->command(20); } break; + case 2: { switch (mode) { case 1: @@ -1765,25 +1821,32 @@ void Scene208::subAction(int mode) { _scene->_sequences.remove(_globals._sequenceIndexes[2]); _globals[kLeavesStatus] = 1; break; + case 2: _game._objects.setRoom(OBJ_BIG_LEAVES, 1); _globals[kLeavesStatus] = 2; updateTrap(); break; + case 3: _scene->_sequences.remove(_globals._sequenceIndexes[3]); _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); _game._objects.removeFromInventory(OBJ_TWINKIFRUIT, 1); _vm->_sound->command(34); break; + case 4: _game._objects.removeFromInventory(OBJ_BURGER, 1); _vm->_sound->command(33); break; + case 5: _game._objects.removeFromInventory(OBJ_DEAD_FISH, 1); _vm->_sound->command(33); break; + + default: + break; } int oldVal = _globals._sequenceIndexes[5]; @@ -1794,10 +1857,14 @@ void Scene208::subAction(int mode) { _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 3); } break; + case 3: _game._player._visible = true; _game._player._stepEnabled = true; break; + + default: + break; } } @@ -1809,18 +1876,17 @@ void Scene208::actions() { _game._player._stepEnabled = false; int msgIndex = _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 1, 120, _game.getQuote(70)); _scene->_kernelMessages.setQuoted(msgIndex, 4, true); - } else if (_game._trigger == 1) { + } else if (_game._trigger == 1) _scene->_nextSceneId = 203; - } - } else if (_action.isAction(VERB_WALK_TOWARDS, NOUN_FIELD_TO_SOUTH)) { + } else if (_action.isAction(VERB_WALK_TOWARDS, NOUN_FIELD_TO_SOUTH)) _scene->_nextSceneId = 212; - } else if (_action.isAction(VERB_TAKE, NOUN_PILE_OF_LEAVES) && (!_globals[kLeavesStatus] || _game._trigger)) { + else if (_action.isAction(VERB_TAKE, NOUN_PILE_OF_LEAVES) && (!_globals[kLeavesStatus] || _game._trigger)) { subAction(1); if (_game._player._stepEnabled) _vm->_dialogs->showItem(OBJ_BIG_LEAVES, 0x326, 0); - } else if (_action.isAction(VERB_PUT, NOUN_BIG_LEAVES, NOUN_DEEP_PIT) && (_globals[kLeavesStatus] == 1 || _game._trigger)) { + } else if (_action.isAction(VERB_PUT, NOUN_BIG_LEAVES, NOUN_DEEP_PIT) && (_globals[kLeavesStatus] == 1 || _game._trigger)) subAction(2); - } else if (_action.isAction(VERB_PUT, NOUN_TWINKIFRUIT, NOUN_LEAF_COVERED_PIT)) { + else if (_action.isAction(VERB_PUT, NOUN_TWINKIFRUIT, NOUN_LEAF_COVERED_PIT)) { subAction(3); if (_game._player._stepEnabled) { _game._player._stepEnabled = false; @@ -1829,67 +1895,108 @@ void Scene208::actions() { } } else if (_action.isAction(VERB_PUT, NOUN_BURGER, NOUN_LEAF_COVERED_PIT)) { subAction(4); - if (_game._player._stepEnabled) { + if (_game._player._stepEnabled) _vm->_dialogs->show(20812); - } } else if (_action.isAction(VERB_PUT, NOUN_DEAD_FISH, NOUN_LEAF_COVERED_PIT)) { subAction(5); - if (_game._player._stepEnabled) { + if (_game._player._stepEnabled) _vm->_dialogs->show(20812); - } - } else if (_action.isAction(VERB_LOOK, NOUN_CUMULOUS_CLOUD)) { + } else if (_action.isAction(VERB_LOOK, NOUN_CUMULOUS_CLOUD)) _vm->_dialogs->show(20801); - } else if (_action.isAction(VERB_LOOK, NOUN_OPEN_AREA_TO_WEST)) { + else if (_action.isAction(VERB_LOOK, NOUN_OPEN_AREA_TO_WEST)) _vm->_dialogs->show(20802); - } else if (_action.isAction(VERB_LOOK, NOUN_THORNY_BUSH)) { + else if (_action.isAction(VERB_LOOK, NOUN_THORNY_BUSH)) _vm->_dialogs->show(20803); - } else if (_action.isAction(VERB_LOOK, NOUN_ROCKS)) { + else if (_action.isAction(VERB_LOOK, NOUN_ROCKS)) _vm->_dialogs->show(20804); - } else if (_action.isAction(VERB_LOOK, NOUN_SMALL_CACTUS)) { + else if (_action.isAction(VERB_LOOK, NOUN_SMALL_CACTUS)) _vm->_dialogs->show(20805); - } else if (_action.isAction(VERB_TAKE, NOUN_SMALL_CACTUS)) { + else if (_action.isAction(VERB_TAKE, NOUN_SMALL_CACTUS)) _vm->_dialogs->show(20806); - } else if (_action.isAction(VERB_LOOK, NOUN_GRASSLAND_TO_EAST)) { + else if (_action.isAction(VERB_LOOK, NOUN_GRASSLAND_TO_EAST)) _vm->_dialogs->show(20807); - } else if (_action.isAction(VERB_LOOK, NOUN_DEEP_PIT)) { + else if (_action.isAction(VERB_LOOK, NOUN_DEEP_PIT)) _vm->_dialogs->show(20808); - } else if (_action.isAction(VERB_LOOK, NOUN_PILE_OF_LEAVES)) { + else if (_action.isAction(VERB_LOOK, NOUN_PILE_OF_LEAVES)) _vm->_dialogs->show(20809); - } else if (_action.isAction(VERB_LOOK, NOUN_LEAF_COVERED_PIT)) { + else if (_action.isAction(VERB_LOOK, NOUN_LEAF_COVERED_PIT)) { if (_game._difficulty == DIFFICULTY_EASY) _vm->_dialogs->show(20810); else _vm->_dialogs->show(20811); - } else if (_action.isAction(VERB_LOOK, NOUN_TREE) || _action.isAction(VERB_LOOK, NOUN_TREES)) { + } else if (_action.isAction(VERB_LOOK, NOUN_TREE) || _action.isAction(VERB_LOOK, NOUN_TREES)) _vm->_dialogs->show(20813); - } else if (_action.isAction(VERB_TAKE, NOUN_LEAF_COVERED_PIT)) { + else if (_action.isAction(VERB_TAKE, NOUN_LEAF_COVERED_PIT)) _vm->_dialogs->show(20814); - } else if (_action.isAction(VERB_LOOK, NOUN_HUGE_LEGS)) { + else if (_action.isAction(VERB_LOOK, NOUN_HUGE_LEGS)) _vm->_dialogs->show(20815); - } else if (_action.isAction(VERB_TAKE, NOUN_HUGE_LEGS) || _action.isAction(VERB_PULL, NOUN_HUGE_LEGS)) { + else if (_action.isAction(VERB_TAKE, NOUN_HUGE_LEGS) || _action.isAction(VERB_PULL, NOUN_HUGE_LEGS)) _vm->_dialogs->show(20816); - } else if (_action._savedFields._lookFlag == 0) { - return; - } else if (_globals[kRhotundaStatus] == 1) { + else if (_action._savedFields._lookFlag && (_globals[kRhotundaStatus] == 1)) _vm->_dialogs->show(20819); - } else if (_globals[kLeavesStatus] == 2) { + else if (_action._savedFields._lookFlag && (_globals[kLeavesStatus] == 2)) _vm->_dialogs->show(20818); - } else { + else if (_action._savedFields._lookFlag) _vm->_dialogs->show(20817); - } + else + return; _action._inProgress = false; } -void Scene208::synchronize(Common::Serializer &s) { - Scene2xx::synchronize(s); - s.syncAsByte(_rhotundaTurnFl); - s.syncAsByte(_boundingFl); +/*****************************************************************************/ - s.syncAsSint32LE(_rhotundaTime); +Scene209::Scene209(MADSEngine *vm) : Scene2xx(vm) { + _dodgeFl = false; + _forceDodgeFl = false; + _pitchFl = false; + _fallFl = false; + _forceFallFl = false; + _playingAnimFl = false; + _shouldFallFl = false; + _shouldDodgeFl = false; + _monkeyPosition = 0; + _counter = 0; + _pauseMode = 0; + _binocularsDroppedFl = false; + _startShootingInTimerFl = false; + _dialogAbortVal = 0; + _playingDialogFl = false; + _shootMissedLastFl = false; + _removeMonkeyFl = false; + _shootReadyFl = false; + _pauseCounterThreshold = 0; + _pauseCounter = 0; } -/*****************************************************************************/ +void Scene209::synchronize(Common::Serializer &s) { + Scene2xx::synchronize(s); + s.syncAsByte(_dodgeFl); + s.syncAsByte(_forceDodgeFl); + s.syncAsByte(_shouldDodgeFl); + s.syncAsByte(_pitchFl); + s.syncAsByte(_fallFl); + s.syncAsByte(_forceFallFl); + s.syncAsByte(_shouldFallFl); + s.syncAsByte(_playingAnimFl); + s.syncAsByte(_playingDialogFl); + + s.syncAsSint32LE(_pauseMode); + s.syncAsSint32LE(_pauseCounterThreshold); + s.syncAsSint32LE(_pauseCounter); + + s.syncAsByte(_removeMonkeyFl); + + s.syncAsSint32LE(_monkeyPosition); + + s.syncAsByte(_shootReadyFl); + s.syncAsByte(_startShootingInTimerFl); + s.syncAsByte(_shootMissedLastFl); + s.syncAsByte(_binocularsDroppedFl); + + s.syncAsSint32LE(_dialogAbortVal); + s.syncAsSint32LE(_counter); +} void Scene209::setup() { setPlayerSpritesPrefix(); @@ -3481,37 +3588,42 @@ void Scene209::actions() { } } -void Scene209::synchronize(Common::Serializer &s) { - Scene2xx::synchronize(s); - s.syncAsByte(_dodgeFl); - s.syncAsByte(_forceDodgeFl); - s.syncAsByte(_shouldDodgeFl); - s.syncAsByte(_pitchFl); - s.syncAsByte(_fallFl); - s.syncAsByte(_forceFallFl); - s.syncAsByte(_shouldFallFl); - s.syncAsByte(_playingAnimFl); - s.syncAsByte(_playingDialogFl); +/*****************************************************************************/ - s.syncAsSint32LE(_pauseMode); - s.syncAsSint32LE(_pauseCounterThreshold); - s.syncAsSint32LE(_pauseCounter); +Scene210::Scene210(MADSEngine *vm) : Scene2xx(vm) { + _curDialogNode = -1; + _nextHandsPlace = 0; + _twinkleAnimationType = 0; + _twinklesCurrentFrame = 0; + _shouldTalk = false; + _shouldFaceRex = false; + _shouldMoveHead = false; + _stopWalking = false; + _twinklesTalking = false; + _twinklesTalk2 = false; + _doorway = 0; + _subQuote2 = ""; +} - s.syncAsByte(_removeMonkeyFl); +void Scene210::synchronize(Common::Serializer &s) { + Scene2xx::synchronize(s); + s.syncAsSint32LE(_curDialogNode); + s.syncAsSint32LE(_nextHandsPlace); + s.syncAsSint32LE(_twinkleAnimationType); + s.syncAsSint32LE(_twinklesCurrentFrame); - s.syncAsSint32LE(_monkeyPosition); + s.syncAsByte(_shouldTalk); + s.syncAsByte(_shouldFaceRex); + s.syncAsByte(_shouldMoveHead); + s.syncAsByte(_stopWalking); + s.syncAsByte(_twinklesTalking); + s.syncAsByte(_twinklesTalk2); - s.syncAsByte(_shootReadyFl); - s.syncAsByte(_startShootingInTimerFl); - s.syncAsByte(_shootMissedLastFl); - s.syncAsByte(_binocularsDroppedFl); + s.syncAsSint32LE(_doorway); - s.syncAsSint32LE(_dialogAbortVal); - s.syncAsSint32LE(_counter); + s.syncString(_subQuote2); } -/*****************************************************************************/ - void Scene210::setup() { setPlayerSpritesPrefix(); setAAName(); @@ -4482,27 +4594,26 @@ void Scene210::actions() { _action._inProgress = false; } -void Scene210::synchronize(Common::Serializer &s) { - Scene2xx::synchronize(s); - s.syncAsSint32LE(_curDialogNode); - s.syncAsSint32LE(_nextHandsPlace); - s.syncAsSint32LE(_twinkleAnimationType); - s.syncAsSint32LE(_twinklesCurrentFrame); +/*------------------------------------------------------------------------*/ - s.syncAsByte(_shouldTalk); - s.syncAsByte(_shouldFaceRex); - s.syncAsByte(_shouldMoveHead); - s.syncAsByte(_stopWalking); - s.syncAsByte(_twinklesTalking); - s.syncAsByte(_twinklesTalk2); +Scene211::Scene211(MADSEngine *vm) : Scene2xx(vm) { + _ambushFl = false; + _wakeFl = false; + _monkeyFrame = 0; + _scrollY = 0; + _monkeyTime = 0; +} - s.syncAsSint32LE(_doorway); +void Scene211::synchronize(Common::Serializer &s) { + Scene2xx::synchronize(s); + s.syncAsByte(_ambushFl); + s.syncAsByte(_wakeFl); - s.syncString(_subQuote2); + s.syncAsSint32LE(_monkeyFrame); + s.syncAsSint32LE(_scrollY); + s.syncAsUint32LE(_monkeyTime); } -/*------------------------------------------------------------------------*/ - void Scene211::setup() { setPlayerSpritesPrefix(); setAAName(); @@ -4767,16 +4878,6 @@ void Scene211::actions() { _action._inProgress = false; } -void Scene211::synchronize(Common::Serializer &s) { - Scene2xx::synchronize(s); - s.syncAsByte(_ambushFl); - s.syncAsByte(_wakeFl); - - s.syncAsSint32LE(_monkeyFrame); - s.syncAsSint32LE(_scrollY); - s.syncAsUint32LE(_monkeyTime); -} - /*------------------------------------------------------------------------*/ void Scene212::setup() { @@ -4903,6 +5004,18 @@ void Scene213::actions() { /*------------------------------------------------------------------------*/ +Scene214::Scene214(MADSEngine *vm) : Scene2xx(vm) { + _devilTime = 0; + _devilRunningFl = false; +} + +void Scene214::synchronize(Common::Serializer &s) { + Scene2xx::synchronize(s); + + s.syncAsUint32LE(_devilTime); + s.syncAsByte(_devilRunningFl); +} + void Scene214::setup() { setPlayerSpritesPrefix(); setAAName(); @@ -5104,13 +5217,6 @@ void Scene214::actions() { _action._inProgress = false; } -void Scene214::synchronize(Common::Serializer &s) { - Scene2xx::synchronize(s); - s.syncAsUint32LE(_devilTime); - - s.syncAsByte(_devilRunningFl); -} - /*------------------------------------------------------------------------*/ void Scene215::setup() { diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index b4f4866b6b..750d45e808 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -54,7 +54,8 @@ private: bool _pterodactylFlag; public: - Scene201(MADSEngine *vm) : Scene2xx(vm), _pterodactylFlag(false) {} + Scene201(MADSEngine *vm); + virtual void setup(); virtual void enter(); virtual void step(); @@ -75,9 +76,8 @@ private: int subStep4(int randVal); public: - Scene202(MADSEngine *vm) : Scene2xx(vm), _activeMsgFl(false), _ladderTopFl(false), _waitingMeteoFl(false), - _ladderHotspotId(-1), _meteoClock1(0), _meteoClock2(0), _toStationFl(false), _toTeleportFl(false), - _lastRoute(0), _stationCounter(0), _meteoFrame(0) {} + Scene202(MADSEngine *vm); + virtual void setup(); virtual void enter(); virtual void step(); @@ -93,7 +93,8 @@ private: bool _rhotundaEat2Fl, _rhotundaEatFl; public: - Scene203(MADSEngine *vm) : Scene2xx(vm), _rhotundaEat2Fl(false), _rhotundaEatFl(false) {} + Scene203(MADSEngine *vm); + virtual void setup(); virtual void enter(); virtual void step(); @@ -112,7 +113,7 @@ private: void handleWomanSpeech(int quoteId); public: - Scene205(MADSEngine *vm) : Scene2xx(vm), _lastFishTime(0), _chickenTime(0) {} + Scene205(MADSEngine *vm); virtual void setup(); virtual void enter(); @@ -131,7 +132,8 @@ private: void moveSpider(); public: - Scene207(MADSEngine *vm) : Scene2xx(vm), _vultureFl(false), _spiderFl(false), _spiderHotspotId(-1), _vultureHotspotId(-1), _spiderTime(0), _vultureTime(0) {} + Scene207(MADSEngine *vm); + virtual void setup(); virtual void enter(); virtual void step(); @@ -149,7 +151,8 @@ private: void subAction(int mode); public: - Scene208(MADSEngine *vm) : Scene2xx(vm), _rhotundaTurnFl(false), _boundingFl(false), _rhotundaTime(0) {} + Scene208(MADSEngine *vm); + virtual void setup(); virtual void enter(); virtual void step(); @@ -194,10 +197,8 @@ private: void handleMonkey2(); public: - Scene209(MADSEngine *vm) : Scene2xx(vm), _dodgeFl(false), _forceDodgeFl(false), _pitchFl(false), _fallFl(false), _forceFallFl(false), - _playingAnimFl(false), _shouldFallFl(false), _shouldDodgeFl(false), _monkeyPosition(0), _counter(0), _pauseMode(0), - _binocularsDroppedFl(false), _startShootingInTimerFl(false), _dialogAbortVal(0), _playingDialogFl(false),_shootMissedLastFl(false), - _removeMonkeyFl(false), _shootReadyFl(false), _pauseCounterThreshold(0), _pauseCounter(0) {} + Scene209(MADSEngine *vm); + virtual void setup(); virtual void enter(); virtual void step(); @@ -234,9 +235,8 @@ private: void newNode(int node); void restoreDialogNode(int node, int msgId, int posY); public: - Scene210(MADSEngine *vm) : Scene2xx(vm), _curDialogNode(-1), _nextHandsPlace(0), _twinkleAnimationType(0), _twinklesCurrentFrame(0), - _shouldTalk(false), _shouldFaceRex(false), _shouldMoveHead(false), _stopWalking(false), _twinklesTalking(false), - _twinklesTalk2(false), _doorway(0), _subQuote2("") {} + Scene210(MADSEngine *vm); + virtual void setup(); virtual void enter(); virtual void step(); @@ -252,7 +252,8 @@ private: uint32 _monkeyTime; public: - Scene211(MADSEngine *vm) : Scene2xx(vm), _ambushFl(false), _wakeFl(false), _monkeyFrame(0), _scrollY(0), _monkeyTime(0) {} + Scene211(MADSEngine *vm); + virtual void setup(); virtual void enter(); virtual void step(); @@ -287,7 +288,7 @@ private: bool _devilRunningFl; public: - Scene214(MADSEngine *vm) : Scene2xx(vm), _devilTime(0), _devilRunningFl(false) {} + Scene214(MADSEngine *vm); virtual void setup(); virtual void enter(); -- cgit v1.2.3 From 904796f3a5dfb965995082614d69542452387bbc Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 22 May 2014 18:08:56 +0200 Subject: MADS: Move contructors out of the header in scene group 3 --- engines/mads/nebular/nebular_scenes3.cpp | 346 ++++++++++++++++++++----------- engines/mads/nebular/nebular_scenes3.h | 22 +- 2 files changed, 237 insertions(+), 131 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 5391b5f93d..06c4eb6d4c 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -266,6 +266,16 @@ void Scene301::step() { /*------------------------------------------------------------------------*/ +Scene302::Scene302(MADSEngine *vm) : Scene3xx(vm) { + _oldFrame = 0; +} + +void Scene302::synchronize(Common::Serializer &s) { + Scene3xx::synchronize(s); + + s.syncAsSint32LE(_oldFrame); +} + void Scene302::setup() { setPlayerSpritesPrefix(); setAAName(); @@ -302,11 +312,6 @@ void Scene302::step() { } } -void Scene302::synchronize(Common::Serializer &s) { - Scene3xx::synchronize(s); - s.syncAsSint32LE(_oldFrame); -} - /*------------------------------------------------------------------------*/ void Scene303::setup() { @@ -336,6 +341,16 @@ void Scene303::step() { /*------------------------------------------------------------------------*/ +Scene304::Scene304(MADSEngine *vm) : Scene3xx(vm) { + _explosionSpriteId = -1; +} + +void Scene304::synchronize(Common::Serializer &s) { + Scene3xx::synchronize(s); + + s.syncAsSint32LE(_explosionSpriteId); +} + void Scene304::setup() { setPlayerSpritesPrefix(); setAAName(); @@ -460,12 +475,45 @@ void Scene304::step() { } } -void Scene304::synchronize(Common::Serializer &s) { - Scene3xx::synchronize(s); - s.syncAsSint32LE(_explosionSpriteId); +/*------------------------------------------------------------------------*/ + +Scene307::Scene307(MADSEngine *vm) : Scene3xx(vm) { + _afterPeeingFl = false; + _duringPeeingFl = false; + _grateOpenedFl = false; + _activePrisonerFl = false; + + _animationMode = -1; + _prisonerMessageId = -1; + _fieldCollisionCounter = -1; + + _lastFrameTime = 0; + _guardTime = 0; + _prisonerTimer = 0; + + _subQuote2 = ""; } -/*------------------------------------------------------------------------*/ +void Scene307::synchronize(Common::Serializer &s) { + Scene3xx::synchronize(s); + + _forceField.synchronize(s); + + s.syncAsByte(_afterPeeingFl); + s.syncAsByte(_duringPeeingFl); + s.syncAsByte(_grateOpenedFl); + s.syncAsByte(_activePrisonerFl); + + s.syncAsSint32LE(_animationMode); + s.syncAsSint32LE(_prisonerMessageId); + s.syncAsSint32LE(_fieldCollisionCounter); + + s.syncAsUint32LE(_lastFrameTime); + s.syncAsUint32LE(_guardTime); + s.syncAsUint32LE(_prisonerTimer); + + s.syncString(_subQuote2); +} void Scene307::setup() { setPlayerSpritesPrefix(); @@ -1138,27 +1186,6 @@ void Scene307::actions() { _action._inProgress = false; } -void Scene307::synchronize(Common::Serializer &s) { - Scene3xx::synchronize(s); - - _forceField.synchronize(s); - - s.syncAsByte(_afterPeeingFl); - s.syncAsByte(_duringPeeingFl); - s.syncAsByte(_grateOpenedFl); - s.syncAsByte(_activePrisonerFl); - - s.syncAsSint32LE(_animationMode); - s.syncAsSint32LE(_prisonerMessageId); - s.syncAsSint32LE(_fieldCollisionCounter); - - s.syncAsUint32LE(_lastFrameTime); - s.syncAsUint32LE(_guardTime); - s.syncAsUint32LE(_prisonerTimer); - - s.syncString(_subQuote2); -} - /*------------------------------------------------------------------------*/ void Scene308::setup() { @@ -1290,6 +1317,27 @@ void Scene308::synchronize(Common::Serializer &s) { /*------------------------------------------------------------------------*/ +Scene309::Scene309(MADSEngine *vm) : Scene3xx(vm) { + for (int i = 0; i < 3; i++) { + _characterSpriteIndexes[i] = -1; + _messagesIndexes[i] = -1; + } + + _lastFrame = -1; +} + +void Scene309::synchronize(Common::Serializer &s) { + Scene3xx::synchronize(s); + + _forceField.synchronize(s); + + for (int i = 0; i < 3; ++i) + s.syncAsSint32LE(_characterSpriteIndexes[i]); + for (int i = 0; i < 3; ++i) + s.syncAsSint32LE(_messagesIndexes[i]); + s.syncAsSint32LE(_lastFrame); +} + void Scene309::setup() { setPlayerSpritesPrefix(); setAAName(); @@ -1473,18 +1521,6 @@ void Scene309::step() { _scene->_nextSceneId = 308; } -void Scene309::synchronize(Common::Serializer &s) { - Scene3xx::synchronize(s); - - _forceField.synchronize(s); - - for (int i = 0; i < 3; ++i) - s.syncAsSint32LE(_characterSpriteIndexes[i]); - for (int i = 0; i < 3; ++i) - s.syncAsSint32LE(_messagesIndexes[i]); - s.syncAsSint32LE(_lastFrame); -} - /*------------------------------------------------------------------------*/ void Scene310::setup() { @@ -1526,6 +1562,16 @@ void Scene310::synchronize(Common::Serializer &s) { /*------------------------------------------------------------------------*/ +Scene311::Scene311(MADSEngine *vm) : Scene3xx(vm) { + _checkGuardFl = false; +} + +void Scene311::synchronize(Common::Serializer &s) { + Scene3xx::synchronize(s); + + s.syncAsByte(_checkGuardFl); +} + void Scene311::setup() { if (_scene->_currentSceneId == 391) _globals[kSexOfRex] = REX_MALE; @@ -1813,12 +1859,6 @@ void Scene311::actions() { _action._inProgress = false; } -void Scene311::synchronize(Common::Serializer &s) { - Scene3xx::synchronize(s); - - s.syncAsByte(_checkGuardFl); -} - /*------------------------------------------------------------------------*/ void Scene313::setup() { @@ -2350,6 +2390,46 @@ void Scene316::actions() { /*------------------------------------------------------------------------*/ +Scene318::Scene318(MADSEngine *vm) : Scene3xx(vm) { + _dropTimer = 0; + + _lastFrame = -1; + _animMode = -1; + _internCounter = -1; + _counter = -1; + + _dialogFl = false; + _internTalkingFl = false; + _internWalkingFl = false; + _internVisibleFl = false; + _explosionFl = false; + + _lastFrameCounter = 0; + + _subQuote2 = ""; +} + +void Scene318::synchronize(Common::Serializer &s) { + Scene3xx::synchronize(s); + + s.syncAsUint32LE(_dropTimer); + + s.syncAsSint32LE(_lastFrame); + s.syncAsSint32LE(_animMode); + s.syncAsSint32LE(_internCounter); + s.syncAsSint32LE(_counter); + + s.syncAsByte(_dialogFl); + s.syncAsByte(_internTalkingFl); + s.syncAsByte(_internWalkingFl); + s.syncAsByte(_internVisibleFl); + s.syncAsByte(_explosionFl); + + s.syncAsUint32LE(_lastFrameCounter); + + s.syncString(_subQuote2); +} + void Scene318::setup() { setPlayerSpritesPrefix(); setAAName(); @@ -2932,29 +3012,42 @@ void Scene318::actions() { _action._inProgress = false; } -void Scene318::synchronize(Common::Serializer &s) { - Scene3xx::synchronize(s); +/*------------------------------------------------------------------------*/ - s.syncAsUint32LE(_dropTimer); +Scene319::Scene319(MADSEngine *vm) : Scene3xx(vm) { + _animMode = -1; + _animFrame = -1; + _nextAction1 = -1; + _nextAction2 = -1; + _slacheMode = -1; + _slacheTopic = -1; + _slachePosY = -1; - s.syncAsSint32LE(_lastFrame); - s.syncAsSint32LE(_animMode); - s.syncAsSint32LE(_internCounter); - s.syncAsSint32LE(_counter); + _slacheTalkingFl = false; + _slacheReady = false; + _slacheInitFl = false; - s.syncAsByte(_dialogFl); - s.syncAsByte(_internTalkingFl); - s.syncAsByte(_internWalkingFl); - s.syncAsByte(_internVisibleFl); - s.syncAsByte(_explosionFl); + _subQuote2 = ""; +} - s.syncAsUint32LE(_lastFrameCounter); +void Scene319::synchronize(Common::Serializer &s) { + Scene3xx::synchronize(s); + + s.syncAsUint32LE(_animMode); + s.syncAsUint32LE(_animFrame); + s.syncAsUint32LE(_nextAction1); + s.syncAsUint32LE(_nextAction2); + s.syncAsUint32LE(_slacheMode); + s.syncAsUint32LE(_slacheTopic); + s.syncAsUint32LE(_slachePosY); + + s.syncAsByte(_slacheTalkingFl); + s.syncAsByte(_slacheReady); + s.syncAsByte(_slacheInitFl); s.syncString(_subQuote2); } -/*------------------------------------------------------------------------*/ - void Scene319::setup() { setPlayerSpritesPrefix(); setAAName(); @@ -3413,26 +3506,31 @@ void Scene319::actions() { _action._inProgress = false; } -void Scene319::synchronize(Common::Serializer &s) { - Scene3xx::synchronize(s); - - s.syncAsUint32LE(_animMode); - s.syncAsUint32LE(_animFrame); - s.syncAsUint32LE(_nextAction1); - s.syncAsUint32LE(_nextAction2); - s.syncAsUint32LE(_slacheMode); - s.syncAsUint32LE(_slacheTopic); - s.syncAsUint32LE(_slachePosY); +/*------------------------------------------------------------------------*/ - s.syncAsByte(_slacheTalkingFl); - s.syncAsByte(_slacheReady); - s.syncAsByte(_slacheInitFl); +Scene320::Scene320(MADSEngine *vm) : Scene300s(vm) { + _blinkFl = false; + _flippedFl = false; - s.syncString(_subQuote2); + _buttonId = -1; + _lastFrame = -1; + _leftItemId = -1; + _posX = -1; + _rightItemId = -1; } +void Scene320::synchronize(Common::Serializer &s) { + Scene3xx::synchronize(s); -/*------------------------------------------------------------------------*/ + s.syncAsByte(_blinkFl); + s.syncAsByte(_flippedFl); + + s.syncAsSint32LE(_buttonId); + s.syncAsSint32LE(_lastFrame); + s.syncAsSint32LE(_leftItemId); + s.syncAsSint32LE(_posX); + s.syncAsSint32LE(_rightItemId); +} void Scene320::setup() { setPlayerSpritesPrefix(); @@ -3740,19 +3838,6 @@ void Scene320::actions() { _action._inProgress = false; } -void Scene320::synchronize(Common::Serializer &s) { - Scene3xx::synchronize(s); - - s.syncAsByte(_blinkFl); - s.syncAsByte(_flippedFl); - - s.syncAsSint32LE(_buttonId); - s.syncAsSint32LE(_lastFrame); - s.syncAsSint32LE(_leftItemId); - s.syncAsSint32LE(_posX); - s.syncAsSint32LE(_rightItemId); -} - /*------------------------------------------------------------------------*/ void Scene321::setup() { @@ -4014,6 +4099,34 @@ void Scene351::actions() { /*------------------------------------------------------------------------*/ +Scene352::Scene352(MADSEngine *vm) : Scene3xx(vm) { + _vaultOpenFl = false; + _mustPutArmDownFl = false; + _leaveRoomFl = false; + + _tapePlayerHotspotIdx = -1; + _hotspot1Idx = -1; + _hotspot2Idx = -1; + _lampHostpotIdx = -1; + _commonSequenceIdx = -1; + _commonSpriteIndex = -1; +} + +void Scene352::synchronize(Common::Serializer &s) { + Scene3xx::synchronize(s); + + s.syncAsByte(_vaultOpenFl); + s.syncAsByte(_mustPutArmDownFl); + s.syncAsByte(_leaveRoomFl); + + s.syncAsSint32LE(_tapePlayerHotspotIdx); + s.syncAsSint32LE(_hotspot1Idx); + s.syncAsSint32LE(_hotspot2Idx); + s.syncAsSint32LE(_lampHostpotIdx); + s.syncAsSint32LE(_commonSequenceIdx); + s.syncAsSint32LE(_commonSpriteIndex); +} + void Scene352::setup() { setPlayerSpritesPrefix(); setAAName(); @@ -4551,21 +4664,6 @@ void Scene352::actions() { return; } -void Scene352::synchronize(Common::Serializer &s) { - Scene3xx::synchronize(s); - - s.syncAsByte(_vaultOpenFl); - s.syncAsByte(_mustPutArmDownFl); - s.syncAsByte(_leaveRoomFl); - - s.syncAsSint32LE(_tapePlayerHotspotIdx); - s.syncAsSint32LE(_hotspot1Idx); - s.syncAsSint32LE(_hotspot2Idx); - s.syncAsSint32LE(_lampHostpotIdx); - s.syncAsSint32LE(_commonSequenceIdx); - s.syncAsSint32LE(_commonSpriteIndex); -} - /*------------------------------------------------------------------------*/ void Scene353::setup() { @@ -4803,6 +4901,16 @@ void Scene358::actions() { /*------------------------------------------------------------------------*/ +Scene359::Scene359(MADSEngine *vm) : Scene3xx(vm) { + _cardHotspotId = -1; +} + +void Scene359::synchronize(Common::Serializer &s) { + Scene3xx::synchronize(s); + + s.syncAsSint32LE(_cardHotspotId); +} + void Scene359::setup() { setPlayerSpritesPrefix(); setAAName(); @@ -4938,13 +5046,6 @@ void Scene359::actions() { _action._inProgress = false; } -void Scene359::synchronize(Common::Serializer &s) { - Scene3xx::synchronize(s); - - s.syncAsSint32LE(_cardHotspotId); -} - - /*------------------------------------------------------------------------*/ void Scene360::setup() { @@ -5509,6 +5610,18 @@ void Scene388::actions() { /*------------------------------------------------------------------------*/ +Scene389::Scene389(MADSEngine *vm) : Scene300s(vm) { + _monsterTime = 0; + _circularQuoteId = -1; +} + +void Scene389::synchronize(Common::Serializer &s) { + Scene3xx::synchronize(s); + + s.syncAsUint32LE(_monsterTime); + s.syncAsSint32LE(_circularQuoteId); +} + void Scene389::setup() { setPlayerSpritesPrefix(); setAAName(); @@ -5586,13 +5699,6 @@ void Scene389::actions() { _action._inProgress = false; } -void Scene389::synchronize(Common::Serializer &s) { - Scene3xx::synchronize(s); - - s.syncAsUint32LE(_monsterTime); - s.syncAsSint32LE(_circularQuoteId); -} - /*------------------------------------------------------------------------*/ void Scene390::setup() { diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h index b42238ddb4..84c8fe7453 100644 --- a/engines/mads/nebular/nebular_scenes3.h +++ b/engines/mads/nebular/nebular_scenes3.h @@ -94,7 +94,7 @@ private: int _oldFrame; public: - Scene302(MADSEngine *vm) : Scene3xx(vm), _oldFrame(0) {} + Scene302(MADSEngine *vm); virtual void setup(); virtual void enter(); @@ -116,7 +116,7 @@ private: int _explosionSpriteId; public: - Scene304(MADSEngine *vm) : Scene3xx(vm), _explosionSpriteId(-1) {} + Scene304(MADSEngine *vm); virtual void setup(); virtual void enter(); @@ -153,7 +153,7 @@ private: void handlePrisonerSpeech(int firstQuoteId, int number, long timeout); public: - Scene307(MADSEngine *vm) : Scene3xx(vm) {} + Scene307(MADSEngine *vm); virtual void setup(); virtual void enter(); @@ -183,7 +183,7 @@ private: int _lastFrame; public: - Scene309(MADSEngine *vm) : Scene3xx(vm) {} + Scene309(MADSEngine *vm); virtual void setup(); virtual void enter(); @@ -209,7 +209,7 @@ private: bool _checkGuardFl; public: - Scene311(MADSEngine *vm) : Scene3xx(vm) {} + Scene311(MADSEngine *vm); virtual void setup(); virtual void enter(); @@ -268,7 +268,7 @@ private: void handleInternDialog(int quoteId, int quoteNum, uint32 timeout); public: - Scene318(MADSEngine *vm) : Scene3xx(vm) {} + Scene318(MADSEngine *vm); virtual void setup(); virtual void enter(); @@ -297,7 +297,7 @@ private: void handleRexDialogues(int quote); void handleSlacheDialogs(int quoteId, int counter, uint32 timer); public: - Scene319(MADSEngine *vm) : Scene3xx(vm) {} + Scene319(MADSEngine *vm); virtual void setup(); virtual void enter(); @@ -322,7 +322,7 @@ private: int _rightItemId; public: - Scene320(MADSEngine *vm) : Scene300s(vm) {} + Scene320(MADSEngine *vm); virtual void setup(); virtual void enter(); @@ -376,7 +376,7 @@ private: void putArmDown(bool corridorExit, bool doorwayExit); public: - Scene352(MADSEngine *vm) : Scene3xx(vm) {} + Scene352(MADSEngine *vm); virtual void setup(); virtual void enter(); @@ -429,7 +429,7 @@ private: int _cardHotspotId; public: - Scene359(MADSEngine *vm) : Scene3xx(vm) {} + Scene359(MADSEngine *vm); virtual void setup(); virtual void enter(); @@ -497,7 +497,7 @@ private: int _circularQuoteId; public: - Scene389(MADSEngine *vm) : Scene300s(vm) {} + Scene389(MADSEngine *vm); virtual void setup(); virtual void enter(); -- cgit v1.2.3 From 542adf8ba441ccfbff621b303e2d4916f487d8af Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 22 May 2014 18:39:59 +0200 Subject: MADS: Move contructors out of the header in scene group 4 --- engines/mads/nebular/nebular_scenes4.cpp | 158 ++++++++++++++++++++++--------- engines/mads/nebular/nebular_scenes4.h | 12 +-- 2 files changed, 119 insertions(+), 51 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes4.cpp b/engines/mads/nebular/nebular_scenes4.cpp index 4156842c0e..cb5363bd65 100644 --- a/engines/mads/nebular/nebular_scenes4.cpp +++ b/engines/mads/nebular/nebular_scenes4.cpp @@ -93,9 +93,9 @@ void Scene4xx::sceneEntrySound() { /*------------------------------------------------------------------------*/ -void Scene401::setup() { - setPlayerSpritesPrefix(); - setAAName(); +Scene401::Scene401(MADSEngine *vm) : Scene4xx(vm), _destPos(0, 0) { + _northFl = false; + _timer = 0; } void Scene401::synchronize(Common::Serializer &s) { @@ -107,6 +107,11 @@ void Scene401::synchronize(Common::Serializer &s) { s.syncAsUint32LE(_timer); } +void Scene401::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + void Scene401::enter() { if (_scene->_priorSceneId != -2) _northFl = false; @@ -231,19 +236,43 @@ void Scene401::actions() { } /*------------------------------------------------------------------------*/ -void Scene402::setup() { - setPlayerSpritesPrefix(); - setAAName(); - _scene->addActiveVocab(NOUN_BARTENDER); - _scene->addActiveVocab(NOUN_ALIEN_LIQUOR); - _scene->addActiveVocab(VERB_DRINK); - _scene->addActiveVocab(NOUN_BINOCULARS); - _scene->addActiveVocab(VERB_WALKTO); - _scene->addActiveVocab(NOUN_CREDIT_CHIP); - _scene->addActiveVocab(VERB_TAKE); - _scene->addActiveVocab(NOUN_REPAIR_LIST); - _scene->addActiveVocab(VERB_LOOK_AT); +Scene402::Scene402(MADSEngine *vm) : Scene4xx(vm) { + _lightOn = false; + _blowingSmoke = false; + _leftWomanMoving = false; + _rightWomanMoving = false; + _firstTalkToGirlInChair = false; + _waitingGinnyMove = false; + _ginnyLooking = false; + _bigBeatFl = false; + _roxOnStool = false; + _bartenderSteady = false; + _bartenderHandsHips = false; + _bartenderLooksLeft = false; + _bartenderReady = false; + _bartenderTalking = false; + _bartenderCalled = false; + _conversationFl = false; + _activeTeleporter = false; + _activeArrows = false; + _activeArrow1 = false; + _activeArrow2 = false; + _activeArrow3 = false; + _cutSceneReady = false; + _cutSceneNeeded = false; + _helgaReady = false; + _refuseAlienLiquor = false; + + _drinkTimer = -1; + _beatCounter = -1; + _bartenderMode = -1; + _bartenderDialogNode = -1; + _bartenderCurrentQuestion = -1; + _helgaTalkMode = -1; + _roxMode = -1; + _rexMode = -1; + _talkTimer = -1; } void Scene402::synchronize(Common::Serializer &s) { @@ -286,6 +315,21 @@ void Scene402::synchronize(Common::Serializer &s) { s.syncAsSint16LE(_talkTimer); } +void Scene402::setup() { + setPlayerSpritesPrefix(); + setAAName(); + + _scene->addActiveVocab(NOUN_BARTENDER); + _scene->addActiveVocab(NOUN_ALIEN_LIQUOR); + _scene->addActiveVocab(VERB_DRINK); + _scene->addActiveVocab(NOUN_BINOCULARS); + _scene->addActiveVocab(VERB_WALKTO); + _scene->addActiveVocab(NOUN_CREDIT_CHIP); + _scene->addActiveVocab(VERB_TAKE); + _scene->addActiveVocab(NOUN_REPAIR_LIST); + _scene->addActiveVocab(VERB_LOOK_AT); +} + void Scene402::setDialogNode(int node) { if (node > 0) _bartenderDialogNode = node; @@ -2514,6 +2558,16 @@ void Scene405::actions() { /*------------------------------------------------------------------------*/ +Scene406::Scene406(MADSEngine *vm) : Scene4xx(vm) { + _hitStorageDoor = false; +} + +void Scene406::synchronize(Common::Serializer &s) { + Scene4xx::synchronize(s); + + s.syncAsByte(_hitStorageDoor); +} + void Scene406::setup() { setPlayerSpritesPrefix(); setAAName(); @@ -2717,13 +2771,19 @@ void Scene406::actions() { _action._inProgress = false; } -void Scene406::synchronize(Common::Serializer &s) { - Scene4xx::synchronize(s); +/*------------------------------------------------------------------------*/ - s.syncAsByte(_hitStorageDoor); +Scene407::Scene407(MADSEngine *vm) : Scene4xx(vm), _destPos(0, 0) { + _fromNorth = false; } -/*------------------------------------------------------------------------*/ +void Scene407::synchronize(Common::Serializer &s) { + Scene4xx::synchronize(s); + + s.syncAsByte(_fromNorth); + s.syncAsSint16LE(_destPos.x); + s.syncAsSint16LE(_destPos.y); +} void Scene407::setup() { setPlayerSpritesPrefix(); @@ -2831,14 +2891,6 @@ void Scene407::actions() { _action._inProgress = false; } -void Scene407::synchronize(Common::Serializer &s) { - Scene4xx::synchronize(s); - - s.syncAsByte(_fromNorth); - s.syncAsSint16LE(_destPos.x); - s.syncAsSint16LE(_destPos.y); -} - /*------------------------------------------------------------------------*/ void Scene408::setup() { @@ -3214,6 +3266,30 @@ void Scene410::actions() { /*------------------------------------------------------------------------*/ +Scene411::Scene411(MADSEngine *vm) : Scene4xx(vm) { + _curAnimationFrame = -1; + _newIngredient = -1; + _newQuantity = -1; + _resetFrame = -1; + _badThreshold = -1; + + _killRox = false; + _makeMushroomCloud = false; +} + +void Scene411::synchronize(Common::Serializer &s) { + Scene4xx::synchronize(s); + + s.syncAsSint32LE(_curAnimationFrame); + s.syncAsSint32LE(_newIngredient); + s.syncAsSint32LE(_newQuantity); + s.syncAsSint32LE(_resetFrame); + s.syncAsSint32LE(_badThreshold); + + s.syncAsByte(_killRox); + s.syncAsByte(_makeMushroomCloud); +} + bool Scene411::addIngredient() { bool retVal = false; @@ -3952,20 +4028,19 @@ void Scene411::actions() { _action._inProgress = false; } -void Scene411::synchronize(Common::Serializer &s) { - Scene4xx::synchronize(s); - - s.syncAsSint32LE(_curAnimationFrame); - s.syncAsSint32LE(_newIngredient); - s.syncAsSint32LE(_newQuantity); - s.syncAsSint32LE(_resetFrame); - s.syncAsSint32LE(_badThreshold); +/*------------------------------------------------------------------------*/ - s.syncAsByte(_killRox); - s.syncAsByte(_makeMushroomCloud); +Scene413::Scene413(MADSEngine *vm) : Scene4xx(vm) { + _rexDeath = -1; + _canMove = -1; } -/*------------------------------------------------------------------------*/ +void Scene413::synchronize(Common::Serializer &s) { + Scene4xx::synchronize(s); + + s.syncAsSint32LE(_rexDeath); + s.syncAsSint32LE(_canMove); +} void Scene413::setup() { setPlayerSpritesPrefix(); @@ -4110,13 +4185,6 @@ void Scene413::actions() { _action._inProgress = false; } -void Scene413::synchronize(Common::Serializer &s) { - Scene4xx::synchronize(s); - - s.syncAsSint32LE(_rexDeath); - s.syncAsSint32LE(_canMove); -} - /*------------------------------------------------------------------------*/ } // End of namespace Nebular diff --git a/engines/mads/nebular/nebular_scenes4.h b/engines/mads/nebular/nebular_scenes4.h index bacab8a156..4544e0887f 100644 --- a/engines/mads/nebular/nebular_scenes4.h +++ b/engines/mads/nebular/nebular_scenes4.h @@ -57,7 +57,7 @@ private: uint32 _timer; public: - Scene401(MADSEngine *vm) : Scene4xx(vm) {} + Scene401(MADSEngine *vm); void synchronize(Common::Serializer &s); virtual void setup(); @@ -118,7 +118,7 @@ private: void handleDialogs(); public: - Scene402(MADSEngine *vm) : Scene4xx(vm) {} + Scene402(MADSEngine *vm); void synchronize(Common::Serializer &s); virtual void setup(); @@ -144,7 +144,7 @@ private: bool _hitStorageDoor; public: - Scene406(MADSEngine *vm) : Scene4xx(vm) {} + Scene406(MADSEngine *vm); void synchronize(Common::Serializer &s); virtual void setup(); @@ -160,7 +160,7 @@ private: Common::Point _destPos; public: - Scene407(MADSEngine *vm) : Scene4xx(vm) {} + Scene407(MADSEngine *vm); void synchronize(Common::Serializer &s); virtual void setup(); @@ -227,7 +227,7 @@ private: bool addIngredient(); public: - Scene411(MADSEngine *vm) : Scene4xx(vm) {} + Scene411(MADSEngine *vm); void synchronize(Common::Serializer &s); virtual void setup(); @@ -243,7 +243,7 @@ private: int _canMove; public: - Scene413(MADSEngine *vm) : Scene4xx(vm) {} + Scene413(MADSEngine *vm); void synchronize(Common::Serializer &s); virtual void setup(); -- cgit v1.2.3 From 77d85a63f1a96bdf5611595166b02ec3713c853d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 22 May 2014 21:03:08 -0400 Subject: MADS: Fix ending of turkey explosion sequence in scene 103 --- engines/mads/nebular/nebular_scenes1.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 131ee6ebe8..ff75f704f9 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -1502,7 +1502,7 @@ void Scene103::actions() { _globals._sequenceIndexes[9] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 6, _vm->_game->_trigger < 1 ? 1 : 0); if (_vm->_game->_trigger) { // Lock the turkey into a permanent "exploded" frame - _scene->_sequences.setAnimRange(_globals._sequenceIndexes[9], -1, -1); + _scene->_sequences.setAnimRange(_globals._sequenceIndexes[9], -2, -2); // Rex says "Gads.." Common::String msg = _game.getQuote(51); -- cgit v1.2.3 From 2ac8dfeeedc7a6860fa7c3491c50d1cec1ac653a Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 23 May 2014 08:06:38 +0300 Subject: FULLPIPE: Implement MovGraph::fillMGMinfo() --- engines/fullpipe/motion.cpp | 165 ++++++++++++++++++++------------------------ 1 file changed, 73 insertions(+), 92 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 7e86de7ba9..3f17c638f4 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -842,108 +842,89 @@ MessageQueue *MovGraph::sub1(StaticANIObject *ani, int x, int y, int a5, int x1, } MessageQueue *MovGraph::fillMGMinfo(StaticANIObject *ani, MovArr *movarr, int staticsId) { -#if 0 - v27 = ani->_ox; - v8 = movarr->_movStepCount; - v9 = 0; + if (!movarr->_movStepCount) + return 0; + MessageQueue *mq = 0; - v28 = ani->_oy; - v26 = 0; - if (v8 > 0) { - while (1) { - if (v9 < v8 - 1) { - v10 = (MovStepShifted *)&movarr->_movSteps[v9 + 1].link; - movarra = (MovStepShifted *)&movarr->_movSteps[v9 + 1].link; - do { - if ( *(_DWORD *)(*(_DWORD *)(v10[-1].link + 16) + 4 * (unsigned int)((char *)v10[-2]._sfield_0 + _field_44)) != - *(_DWORD *)(*(_DWORD *)(movarra->link + 16) + 4 * (unsigned int)((char *)v10[-1]._sfield_0 + _field_44)) ) - break; - ++v9; - v10 = movarra + 1; - ++movarra; - } while (v9 < v8 - 1); - } + int ox = ani->_ox; + int oy = ani->_oy; + int id1 = 0; + int id2; + + for (int i = 0; i < movarr->_movStepCount; i++) { + while (i < movarr->_movStepCount - 1) { + if (movarr->_movSteps[i ].link->_dwordArray1[movarr->_movSteps[i - 1].sfield_0 + _field_44] != + movarr->_movSteps[i + 1].link->_dwordArray1[movarr->_movSteps[i ].sfield_0 + _field_44]) + break; + i++; + } - ani->getMovementById(movarr->_movSteps[v9].link->dwordArray1[_field_44 + movarr->_movSteps[v9]._sfield_0]); - v11 = movarr->_movStepCount - 1; - v13 = __OFSUB__(v9, v11); - v12 = v9 - v11 < 0; - if (v9 == v11) { - if (staticsId) { - id2 = staticsId; - goto LABEL_13; - } - v13 = __OFSUB__(v9, v11); - v12 = v9 - v11 < 0; - } - if (v12 ^ v13) - id2 = ani->getMovementById(movarr->_movSteps[v9 + 1].link->dwordArray1[_field_44 + movarr->_movSteps[v9]._sfield_0])->_staticsObj1->_staticsId; + MovStep *st = &movarr->_movSteps[i]; + + ani->getMovementById(st->link->_dwordArray1[_field_44 + st->sfield_0]); + + if (i == movarr->_movStepCount - 1 && staticsId) { + id2 = staticsId; + } else { + if (i < movarr->_movStepCount - 1) + id2 = ani->getMovementById(movarr->_movSteps[i + 1].link->_dwordArray1[_field_44 + st->sfield_0])->_staticsObj1->_staticsId; else - id2 = movarr->_movSteps[v9].link->_dwordArray2[_field_44 + movarr->_movSteps[v9]._sfield_0]; - LABEL_13: - v14 = movarr->_movSteps; - v15 = movarr->_movStepCount - 1; - - if (v9 == v15) { - v16 = v14[v9].link->_movGraphNode1->_distance; - v17 = movarr->_point.x; - v33 = movarr->_point.y; - ny = v33; - v32 = v17; - v34 = v16; - nx = v17; - nd = v16; - } else { - v18 = v14[v9]._sfield_0; - v19 = &v14[v9]; - if (v18) { - v21 = (MovGraphNodeShifted *)&v19->link->_movGraphNode1->_x; - nx = v21->_x; - ny = v21->_y; - nd = v21->_distance; - } else { - v20 = (MovGraphNodeShifted *)&v19->link->_movGraphNode2->_x; - nx = v20->_x; - ny = v20->_y; - nd = v20->_distance; - } - } - memset(&mgminfo, 0, sizeof(mgminfo)); - mgminfo.ani = ani; - mgminfo.staticsId2 = id2; - mgminfo.staticsId1 = v26; - mgminfo.x1 = nx; - mgminfo.x2 = v27; - mgminfo.y2 = v28; - mgminfo.y1 = ny; - mgminfo.field_1C = nd; - mgminfo.movementId = movarr->_movSteps[v9].link->dwordArray1[_field_44 + movarr->_movSteps[v9]._sfield_0]; - mgminfo.flags = (mq != 0) | 48 * (mq != 0) | 0xE; - v23 = _mgm->genMovement(&mgminfo); + id2 = st->link->_dwordArray2[_field_44 + st->sfield_0]; + } - if (mq) { - if (v23) { - mq->transferExCommands(v23); - delete v23; - } + int nx, ny, nd; + + if (i == movarr->_movStepCount - 1) { + nx = movarr->_point.x; + ny = movarr->_point.y; + nd = st->link->_movGraphNode1->_distance; + } else { + if (st->sfield_0) { + nx = st->link->_movGraphNode1->_x; + ny = st->link->_movGraphNode1->_y; + nd = st->link->_movGraphNode1->_distance; } else { - mq = v23; + nx = st->link->_movGraphNode2->_x; + ny = st->link->_movGraphNode2->_y; + nd = st->link->_movGraphNode2->_distance; } - v27 = nx; - v28 = ny; - v26 = id2; + } - v8 = movarr->_movStepCount; - ++v9; - if (v9 >= v8) - return mq; + MGMInfo mgminfo; + + memset(&mgminfo, 0, sizeof(mgminfo)); + mgminfo.ani = ani; + mgminfo.staticsId2 = id2; + mgminfo.staticsId1 = id1; + mgminfo.x1 = nx; + mgminfo.x2 = ox; + mgminfo.y2 = oy; + mgminfo.y1 = ny; + mgminfo.field_1C = nd; + mgminfo.movementId = st->link->_dwordArray1[_field_44 + st->sfield_0]; + + mgminfo.flags = 0xe; + if (mq) + mgminfo.flags |= 0x31; + + MessageQueue *newmq = _mgm.genMovement(&mgminfo); + + if (mq) { + if (newmq) { + mq->transferExCommands(newmq); + + delete newmq; + } + } else { + mq = newmq; } + + ox = nx; + oy = ny; + id1 = id2; } - return 0; -#endif - warning("STUB: *MovGraph::fillMGMinfo()"); - return 0; + return mq; } MessageQueue *MovGraph::method50(StaticANIObject *ani, Common::Array *movarr, int staticsId) { -- cgit v1.2.3 From 27d4573edf104911758f235e8a4cf85795cd66dd Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 23 May 2014 07:15:15 +0200 Subject: MADS: Move contructors out of the header in scene group 5 --- engines/mads/nebular/nebular_scenes5.cpp | 155 ++++++++++++++++++++++--------- engines/mads/nebular/nebular_scenes5.h | 18 ++-- 2 files changed, 118 insertions(+), 55 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes5.cpp b/engines/mads/nebular/nebular_scenes5.cpp index cc8cdbd9e0..a8c6b22591 100644 --- a/engines/mads/nebular/nebular_scenes5.cpp +++ b/engines/mads/nebular/nebular_scenes5.cpp @@ -92,11 +92,12 @@ void Scene5xx::sceneEntrySound() { /*------------------------------------------------------------------------*/ -void Scene501::setup() { - setPlayerSpritesPrefix(); - setAAName(); - _scene->addActiveVocab(NOUN_DOOR); - _scene->addActiveVocab(VERB_WALK_THROUGH); +Scene501::Scene501(MADSEngine *vm) : Scene5xx(vm) { + _mainSequenceId = -1; + _mainSpriteId = -1; + _doorHotspotid = -1; + + _rexPunched = false; } void Scene501::synchronize(Common::Serializer &s) { @@ -108,6 +109,13 @@ void Scene501::synchronize(Common::Serializer &s) { s.syncAsByte(_rexPunched); } +void Scene501::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(NOUN_DOOR); + _scene->addActiveVocab(VERB_WALK_THROUGH); +} + void Scene501::handleSlotActions() { switch (_game._trigger) { case 0: @@ -523,11 +531,8 @@ void Scene502::actions() { /*------------------------------------------------------------------------*/ -void Scene503::setup() { - setPlayerSpritesPrefix(); - setAAName(); - _scene->addActiveVocab(NOUN_DETONATORS); - _scene->addActiveVocab(VERB_WALKTO); +Scene503::Scene503(MADSEngine *vm) : Scene5xx(vm) { + _detonatorHotspotId = -1; } void Scene503::synchronize(Common::Serializer &s) { @@ -536,6 +541,13 @@ void Scene503::synchronize(Common::Serializer &s) { s.syncAsSint16LE(_detonatorHotspotId); } +void Scene503::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(NOUN_DETONATORS); + _scene->addActiveVocab(VERB_WALKTO); +} + void Scene503::enter() { _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('c', -1)); @@ -651,9 +663,9 @@ void Scene503::actions() { /*------------------------------------------------------------------------*/ -void Scene504::setup() { - _game._player._spritesPrefix = ""; - setAAName(); +Scene504::Scene504(MADSEngine *vm) : Scene5xx(vm) { + _carAnimationMode = -1; + _carFrame = -1; } void Scene504::synchronize(Common::Serializer &s) { @@ -663,6 +675,11 @@ void Scene504::synchronize(Common::Serializer &s) { s.syncAsSint16LE(_carFrame); } +void Scene504::setup() { + _game._player._spritesPrefix = ""; + setAAName(); +} + void Scene504::enter() { _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('a', 2)); @@ -855,9 +872,15 @@ void Scene504::actions() { /*------------------------------------------------------------------------*/ -void Scene505::setup() { - _game._player._spritesPrefix = ""; - setAAName(); +Scene505::Scene505(MADSEngine *vm) : Scene5xx(vm) { + _frame = -1; + _nextButtonId = -1; + _homeSelectedId = -1; + _selectedId = -1; + _activeCars = -1; + + for (int i = 0; i < 9; i++) + _carLocations[i] = -1; } void Scene505::synchronize(Common::Serializer &s) { @@ -873,6 +896,11 @@ void Scene505::synchronize(Common::Serializer &s) { s.syncAsSint16LE(_carLocations[i]); } +void Scene505::setup() { + _game._player._spritesPrefix = ""; + setAAName(); +} + void Scene505::enter() { for (int i = 0; i < 9; i++) _globals._spriteIndexes[i] = _scene->_sprites.addSprites(formAnimName('a', i + 1)); @@ -1122,12 +1150,17 @@ void Scene505::actions() { /*------------------------------------------------------------------------*/ -void Scene506::setup() { - setPlayerSpritesPrefix(); - setAAName(); - _scene->addActiveVocab(VERB_WALK_INTO); - _scene->addActiveVocab(NOUN_SOFTWARE_STORE); - _scene->addActiveVocab(NOUN_LABORATORY); +Scene506::Scene506(MADSEngine *vm) : Scene5xx(vm), _doorPos(0, 0) { + _heroFacing = FACING_DUMMY; + + _doorDepth = -1; + _doorSpriteIdx = -1; + _doorSequenceIdx = -1; + _doorWord = -1; + + _labDoorFl = false; + _firstDoorFl = false; + _actionFl = false; } void Scene506::synchronize(Common::Serializer &s) { @@ -1148,6 +1181,14 @@ void Scene506::synchronize(Common::Serializer &s) { s.syncAsByte(_actionFl); } +void Scene506::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(VERB_WALK_INTO); + _scene->addActiveVocab(NOUN_SOFTWARE_STORE); + _scene->addActiveVocab(NOUN_LABORATORY); +} + void Scene506::enter() { _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('q', 0)); _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('q', 1)); @@ -1402,11 +1443,8 @@ void Scene506::actions() { /*------------------------------------------------------------------------*/ -void Scene507::setup() { - setPlayerSpritesPrefix(); - setAAName(); - _scene->addActiveVocab(NOUN_PENLIGHT); - _scene->addActiveVocab(VERB_WALKTO); +Scene507::Scene507(MADSEngine *vm) : Scene5xx(vm) { + _penlightHotspotId = -1; } void Scene507::synchronize(Common::Serializer &s) { @@ -1415,6 +1453,13 @@ void Scene507::synchronize(Common::Serializer &s) { s.syncAsSint16LE(_penlightHotspotId); } +void Scene507::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(NOUN_PENLIGHT); + _scene->addActiveVocab(VERB_WALKTO); +} + void Scene507::enter() { _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('p', -1)); _globals._spriteIndexes[2] = _scene->_sprites.addSprites("*RXMRD_3"); @@ -1519,12 +1564,8 @@ void Scene507::actions() { /*------------------------------------------------------------------------*/ -void Scene508::setup() { - setPlayerSpritesPrefix(); - setAAName(); - _scene->addActiveVocab(NOUN_SPINACH_PATCH_DOLL); - _scene->addActiveVocab(VERB_WALKTO); - _scene->addActiveVocab(NOUN_LASER_BEAM); +Scene508::Scene508(MADSEngine *vm) : Scene5xx(vm) { + _chosenObject = -1; } void Scene508::synchronize(Common::Serializer &s) { @@ -1533,6 +1574,14 @@ void Scene508::synchronize(Common::Serializer &s) { s.syncAsSint16LE(_chosenObject); } +void Scene508::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(NOUN_SPINACH_PATCH_DOLL); + _scene->addActiveVocab(VERB_WALKTO); + _scene->addActiveVocab(NOUN_LASER_BEAM); +} + void Scene508::enter() { _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('a', 0)); _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('m', 0)); @@ -1784,12 +1833,13 @@ void Scene508::actions() { /*------------------------------------------------------------------------*/ -void Scene511::setup() { - setPlayerSpritesPrefix(); - setAAName(); - _scene->addActiveVocab(NOUN_BOAT); - _scene->addActiveVocab(NOUN_FISHING_LINE); - _scene->addActiveVocab(VERB_WALKTO); +Scene511::Scene511(MADSEngine *vm) : Scene5xx(vm) { + _handingLine = false; + _lineMoving = false; + + _lineAnimationMode = -1; + _lineFrame = -1; + _lineAnimationPosition = -1; } void Scene511::synchronize(Common::Serializer &s) { @@ -1803,6 +1853,14 @@ void Scene511::synchronize(Common::Serializer &s) { s.syncAsSint16LE(_lineAnimationPosition); } +void Scene511::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(NOUN_BOAT); + _scene->addActiveVocab(NOUN_FISHING_LINE); + _scene->addActiveVocab(VERB_WALKTO); +} + void Scene511::enter() { _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('c', 0)); _globals._spriteIndexes[4] = _scene->_sprites.addSprites("*RXCD_6"); @@ -2116,13 +2174,9 @@ void Scene511::actions() { /*------------------------------------------------------------------------*/ -void Scene512::setup() { - setPlayerSpritesPrefix(); - setAAName(); - _scene->addActiveVocab(NOUN_FISHING_ROD); - _scene->addActiveVocab(VERB_WALKTO); - _scene->addActiveVocab(NOUN_PADLOCK_KEY); - _scene->addActiveVocab(NOUN_REGISTER_DRAWER); +Scene512::Scene512(MADSEngine *vm) : Scene5xx(vm) { + _fishingRodHotspotId = -1; + _keyHotspotId = -1; } void Scene512::synchronize(Common::Serializer &s) { @@ -2132,6 +2186,15 @@ void Scene512::synchronize(Common::Serializer &s) { s.syncAsSint16LE(_keyHotspotId); } +void Scene512::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(NOUN_FISHING_ROD); + _scene->addActiveVocab(VERB_WALKTO); + _scene->addActiveVocab(NOUN_PADLOCK_KEY); + _scene->addActiveVocab(NOUN_REGISTER_DRAWER); +} + void Scene512::enter() { _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('r', -1)); _globals._spriteIndexes[2] = _scene->_sprites.addSprites("*RXMRC_9"); diff --git a/engines/mads/nebular/nebular_scenes5.h b/engines/mads/nebular/nebular_scenes5.h index 7c21fbaae1..4022f1c85b 100644 --- a/engines/mads/nebular/nebular_scenes5.h +++ b/engines/mads/nebular/nebular_scenes5.h @@ -60,7 +60,7 @@ private: void handleSlotActions(); public: - Scene501(MADSEngine *vm) : Scene5xx(vm) {} + Scene501(MADSEngine *vm); void synchronize(Common::Serializer &s); virtual void setup(); @@ -85,7 +85,7 @@ private: int _detonatorHotspotId; public: - Scene503(MADSEngine *vm) : Scene5xx(vm) {} + Scene503(MADSEngine *vm); void synchronize(Common::Serializer &s); virtual void setup(); @@ -99,7 +99,7 @@ private: int _carFrame; public: - Scene504(MADSEngine *vm) : Scene5xx(vm) {} + Scene504(MADSEngine *vm); void synchronize(Common::Serializer &s); virtual void setup(); @@ -120,7 +120,7 @@ private: int _carLocations[9]; public: - Scene505(MADSEngine *vm) : Scene5xx(vm) {} + Scene505(MADSEngine *vm); void synchronize(Common::Serializer &s); virtual void setup(); @@ -146,7 +146,7 @@ private: void handleDoorSequences(); public: - Scene506(MADSEngine *vm) : Scene5xx(vm) {} + Scene506(MADSEngine *vm); void synchronize(Common::Serializer &s); virtual void setup(); @@ -160,7 +160,7 @@ private: int _penlightHotspotId; public: - Scene507(MADSEngine *vm) : Scene5xx(vm) {} + Scene507(MADSEngine *vm); void synchronize(Common::Serializer &s); virtual void setup(); @@ -175,7 +175,7 @@ private: void handlePedestral(); public: - Scene508(MADSEngine *vm) : Scene5xx(vm) {} + Scene508(MADSEngine *vm); void synchronize(Common::Serializer &s); virtual void setup(); @@ -194,7 +194,7 @@ private: int _lineAnimationPosition; public: - Scene511(MADSEngine *vm) : Scene5xx(vm) {} + Scene511(MADSEngine *vm); void synchronize(Common::Serializer &s); virtual void setup(); @@ -210,7 +210,7 @@ private: int _keyHotspotId; public: - Scene512(MADSEngine *vm) : Scene5xx(vm) {} + Scene512(MADSEngine *vm); void synchronize(Common::Serializer &s); virtual void setup(); -- cgit v1.2.3 From 1d46172008ce117f078e271054753d7d6be67cba Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 23 May 2014 09:41:54 +0300 Subject: FULLPIPE: Implement MovGraph::changeCallback() --- engines/fullpipe/motion.cpp | 6 ++---- engines/fullpipe/motion.h | 5 +++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 3f17c638f4..2ee3d706bb 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -684,10 +684,8 @@ MessageQueue *MovGraph::method34(StaticANIObject *ani, int xpos, int ypos, int f return method50(ani, _callback1(ani, movitems, count), staticsId); } -int MovGraph::changeCallback() { - warning("STUB: MovGraph::changeCallback()"); - - return 0; +void MovGraph::changeCallback(Common::Array *(*callback1)(StaticANIObject *ani, Common::Array *items, signed int counter)) { + _callback1 = callback1; } bool MovGraph::method3C(StaticANIObject *ani, int flag) { diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index 76eb567cfe..6233174e67 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -31,6 +31,7 @@ class MctlConnectionPoint; class MovGraphLink; class MessageQueue; class ExCommand2; +struct MovArr; struct MovItem; int startWalkTo(int objId, int objKey, int x, int y, int a5); @@ -57,7 +58,7 @@ public: virtual bool method2C(StaticANIObject *obj, int x, int y) { return false; } virtual int method30() { return 0; } virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) { return 0; } - virtual int changeCallback() { return 0; } + virtual void changeCallback(Common::Array *(*_callback1)(StaticANIObject *ani, Common::Array *items, signed int counter)) {} virtual bool method3C(StaticANIObject *ani, int flag) { return 0; } virtual int method40() { return 0; } virtual bool method44(StaticANIObject *ani, int x, int y) { return false; } @@ -364,7 +365,7 @@ public: virtual Common::Array *method28(StaticANIObject *ani, int x, int y, int flag1, int *rescount); virtual bool method2C(StaticANIObject *obj, int x, int y); virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId); - virtual int changeCallback(); + virtual void changeCallback(Common::Array *(*_callback1)(StaticANIObject *ani, Common::Array *items, signed int counter)); virtual bool method3C(StaticANIObject *ani, int flag); virtual bool method44(StaticANIObject *ani, int x, int y); virtual MessageQueue *doWalkTo(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId); -- cgit v1.2.3 From 6b435616132fc438919549d529aefbccf90819af Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 23 May 2014 09:43:03 +0300 Subject: FULLPIPE: Started implementation of MovGraph::method50() --- engines/fullpipe/motion.cpp | 61 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 2ee3d706bb..ccd246ff8b 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -926,6 +926,67 @@ MessageQueue *MovGraph::fillMGMinfo(StaticANIObject *ani, MovArr *movarr, int st } MessageQueue *MovGraph::method50(StaticANIObject *ani, Common::Array *movarr, int staticsId) { +#if 0 + if (_itemsCount <= 0) + return 0; + + int idx; + int movidx; + bool done = false; + + for (idx = 0; idx <= _itemsCount && !done; idx++) { + if (idx == _itemsCount) + return 0; + + if (_items[idx]->ani == ani) { + if (!_items[idx]->movitems) + return 0; + + if (_items[idx]->count < 1) + return 0; + + for (movidx = 0; movidx < _items[idx]->count; movidx++) + if (_items[idx]->movitems[movidx]->movarr == movarr) { + done = true; + + break; + } + } + } + } + + v11 = this->_items; + v12 = idx << 6; + v13 = (*(MovItem **)((char *)&v11->movitems + v12))[movidx].movarr; + if ( *(MovArr **)((char *)&v11->movarr + v12) ) + CObjectFree(*(void **)((char *)&v11->movarr + v12)); + memcpy((char *)&this->_items->movarr + v12, v13, 0x20u); + *(MovArr **)((char *)&this->_items->movarr + v12) = (MovArr *)operator new(8 * v13->_movStepCount); + memcpy(*(void **)((char *)&this->_items->movarr + v12), v13->_movSteps, 8 * v13->_movStepCount); + *(int *)((char *)&this->_items->field_10 + v12) = -1; + *(int *)((char *)&this->_items->field_14 + v12) = 0; + + MessageQueue *mq = fillMGMinfo(*(StaticANIObject **)((char *)&this->_items->ani + v12), (MovArr *)((char *)&this->_items->movarr + v12), 0); + if (!mq) + return 0; + + ExCommand *ex = new ExCommand(); + + ex->_messageKind = 17; + ex->_messageNum = 54; + ex->_parentId = ani->_id; + ex->_field_3C = 1; + mq->addExCommandToEnd(ex); + + if (!mq->chain(ani)) { + delete mq; + + return 0; + } + + return mq; +#endif + warning("STUB: MovGraph::method50()"); return 0; -- cgit v1.2.3 From cdbf1349275637b1d022ffe2ae83f37a2cd83e21 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 23 May 2014 17:13:12 +0200 Subject: MADS: Move contructors out of the header in scene group 6 --- engines/mads/nebular/nebular_scenes6.cpp | 209 ++++++++++++++++++++++++------- engines/mads/nebular/nebular_scenes6.h | 18 +-- 2 files changed, 170 insertions(+), 57 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes6.cpp b/engines/mads/nebular/nebular_scenes6.cpp index 4313366e08..9413350c27 100644 --- a/engines/mads/nebular/nebular_scenes6.cpp +++ b/engines/mads/nebular/nebular_scenes6.cpp @@ -217,12 +217,11 @@ void Scene601::actions() { /*------------------------------------------------------------------------*/ -void Scene602::setup() { - setPlayerSpritesPrefix(); - setAAName(); - _scene->addActiveVocab(VERB_WALKTO); - _scene->addActiveVocab(NOUN_SAFE); - _scene->addActiveVocab(NOUN_LASER_BEAM); +Scene602::Scene602(MADSEngine *vm) : Scene6xx(vm) { + _lastSpriteIdx = -1; + _lastSequenceIdx = -1; + _cycleIndex = -1; + _safeMode = -1; } void Scene602::synchronize(Common::Serializer &s) { @@ -234,6 +233,14 @@ void Scene602::synchronize(Common::Serializer &s) { s.syncAsSint16LE(_safeMode); } +void Scene602::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(VERB_WALKTO); + _scene->addActiveVocab(NOUN_SAFE); + _scene->addActiveVocab(NOUN_LASER_BEAM); +} + void Scene602::enter() { _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('h', -1)); _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 0)); @@ -539,12 +546,9 @@ void Scene602::actions() { /*------------------------------------------------------------------------*/ -void Scene603::setup() { - setPlayerSpritesPrefix(); - setAAName(); - _scene->addActiveVocab(VERB_WALKTO); - _scene->addActiveVocab(NOUN_COMPACT_CASE); - _scene->addActiveVocab(NOUN_NOTE); +Scene603::Scene603(MADSEngine *vm) : Scene6xx(vm) { + _compactCaseHotspotId = -1; + _noteHotspotId = -1; } void Scene603::synchronize(Common::Serializer &s) { @@ -554,6 +558,14 @@ void Scene603::synchronize(Common::Serializer &s) { s.syncAsSint16LE(_noteHotspotId); } +void Scene603::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(VERB_WALKTO); + _scene->addActiveVocab(NOUN_COMPACT_CASE); + _scene->addActiveVocab(NOUN_NOTE); +} + void Scene603::enter() { if (_game._objects[OBJ_COMPACT_CASE]._roomNumber == _scene->_currentSceneId) { _globals._spriteIndexes[4] = _scene->_sprites.addSprites("*RXMRD_3"); @@ -688,12 +700,15 @@ void Scene603::actions() { /*------------------------------------------------------------------------*/ -void Scene604::setup() { - setPlayerSpritesPrefix(); - setAAName(); - _scene->addActiveVocab(NOUN_SEA_MONSTER); - _scene->addActiveVocab(VERB_WALKTO); - _scene->addActiveVocab(NOUN_TIMEBOMB); +Scene604::Scene604(MADSEngine *vm) : Scene6xx(vm) { + _timebombHotspotId = -1; + _bombMode = -1; + _monsterFrame = -1; + + _monsterTimer = 0; + + _monsterActive = false; + _animationActiveFl = false; } void Scene604::synchronize(Common::Serializer &s) { @@ -709,6 +724,14 @@ void Scene604::synchronize(Common::Serializer &s) { s.syncAsByte(_animationActiveFl); } +void Scene604::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(NOUN_SEA_MONSTER); + _scene->addActiveVocab(VERB_WALKTO); + _scene->addActiveVocab(NOUN_TIMEBOMB); +} + void Scene604::enter() { _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('c', 0)); _globals._spriteIndexes[4] = _scene->_sprites.addSprites("*RXCD_9"); @@ -1014,11 +1037,18 @@ void Scene605::actions() { /*------------------------------------------------------------------------*/ -void Scene607::setup() { - setPlayerSpritesPrefix(); - setAAName(); - _scene->addActiveVocab(NOUN_OBNOXIOUS_DOG); - _scene->addActiveVocab(VERB_WALKTO); +Scene607::Scene607(MADSEngine *vm) : Scene6xx(vm) { + _dogTimer = 0; + _lastFrameTime = 0; + + _dogLoop = false; + _dogEatsRex = false; + _dogBarking = false; + _shopAvailable = false; + + _animationMode = -1; + _animationActive = -1; + _counter = -1; } void Scene607::synchronize(Common::Serializer &s) { @@ -1037,6 +1067,13 @@ void Scene607::synchronize(Common::Serializer &s) { s.syncAsSint16LE(_counter); } +void Scene607::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(NOUN_OBNOXIOUS_DOG); + _scene->addActiveVocab(VERB_WALKTO); +} + void Scene607::enter() { _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('c', 0)); _globals._spriteIndexes[3] = _scene->_sprites.addSprites("*RXCD_3"); @@ -1463,13 +1500,36 @@ void Scene607::actions() { /*------------------------------------------------------------------------*/ -void Scene608::setup() { - setPlayerSpritesPrefix(); - setAAName(); - _scene->addActiveVocab(VERB_WALKTO); - _scene->addActiveVocab(NOUN_POLYCEMENT); - _scene->addActiveVocab(NOUN_CAR); - _scene->addActiveVocab(NOUN_OBNOXIOUS_DOG); +Scene608::Scene608(MADSEngine *vm) : Scene6xx(vm) { + _carMode = -1; + _carFrame = -1; + _carMoveMode = -1; + _dogDeathMode = -1; + _carHotspotId = -1; + _barkCount = -1; + _polycementHotspotId = -1; + _animationMode = -1; + _nextTrigger = -1; + _throwMode = -1; + + _resetPositionsFl = false; + _dogActiveFl = false; + _dogBarkingFl = false; + _dogFirstEncounter = false; + _rexBeingEaten = false; + _dogHitWindow = false; + _checkFl = false; + _dogSquashFl = false; + _dogSafeFl = false; + _buttonPressedonTimeFl = false; + _dogUnderCar = false; + _dogYelping = false; + + _dogWindowTimer = -1; + _dogRunTimer = -1; + + _dogTimer1 = 0; + _dogTimer2 = 0; } void Scene608::synchronize(Common::Serializer &s) { @@ -1506,6 +1566,15 @@ void Scene608::synchronize(Common::Serializer &s) { s.syncAsUint32LE(_dogTimer2); } +void Scene608::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(VERB_WALKTO); + _scene->addActiveVocab(NOUN_POLYCEMENT); + _scene->addActiveVocab(NOUN_CAR); + _scene->addActiveVocab(NOUN_OBNOXIOUS_DOG); +} + void Scene608::resetDogVariables() { _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 1); int idx = _scene->_dynamicHotspots.add(NOUN_OBNOXIOUS_DOG, VERB_WALKTO, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); @@ -2457,9 +2526,8 @@ void Scene608::actions() { /*------------------------------------------------------------------------*/ -void Scene609::setup() { - setPlayerSpritesPrefix(); - setAAName(); +Scene609::Scene609(MADSEngine *vm) : Scene6xx(vm) { + _videoDoorMode = -1; } void Scene609::synchronize(Common::Serializer &s) { @@ -2468,6 +2536,11 @@ void Scene609::synchronize(Common::Serializer &s) { s.syncAsSint16LE(_videoDoorMode); } +void Scene609::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + void Scene609::enter() { _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('c', 0)); _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 0)); @@ -2786,11 +2859,14 @@ void Scene609::actions() { /*------------------------------------------------------------------------*/ -void Scene610::setup() { - setPlayerSpritesPrefix(); - setAAName(); - _scene->addActiveVocab(NOUN_PHONE_HANDSET); - _scene->addActiveVocab(VERB_WALKTO); +Scene610::Scene610(MADSEngine *vm) : Scene6xx(vm) { + _handsetHotspotId = -1; + _checkVal = -1; + + _cellCharging = false; + + _cellChargingTimer = -1; + _lastFrameTimer = 0; } void Scene610::synchronize(Common::Serializer &s) { @@ -2805,6 +2881,13 @@ void Scene610::synchronize(Common::Serializer &s) { s.syncAsUint32LE(_lastFrameTimer); } +void Scene610::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(NOUN_PHONE_HANDSET); + _scene->addActiveVocab(VERB_WALKTO); +} + void Scene610::enter() { _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('p', -1)); _globals._spriteIndexes[2] = _scene->_sprites.addSprites("*RXMRC_9"); @@ -2981,11 +3064,29 @@ void Scene610::actions() { /*------------------------------------------------------------------------*/ -void Scene611::setup() { - setPlayerSpritesPrefix(); - setAAName(); - _scene->addActiveVocab(NOUN_RAT); - _scene->addActiveVocab(VERB_WALKTO); +Scene611::Scene611(MADSEngine *vm) : Scene6xx(vm), _defaultDialogPos(0, 0) { + _seenRatFl = false; + _eyesRunningFl = false; + _shouldRemoveEyes = false; + _ratPresentFl = false; + _duringDialogFl = false; + _resetBatterieText = false; + _hermitTalkingFl = false; + _hermitMovingFl = false; + _alreadyTalkingFl = false; + _giveBatteriesFl = false; + _startTradingFl = false; + _check1Fl = false; + _stickFingerFl = false; + + _randVal = -1; + _ratHotspotId = -1; + _hermitDialogNode = -1; + _hermitDisplayedQuestion = -1; + _nextFrame = -1; + _hermitMode = -1; + + _ratTimer = 0; } void Scene611::synchronize(Common::Serializer &s) { @@ -3018,6 +3119,13 @@ void Scene611::synchronize(Common::Serializer &s) { s.syncAsSint16LE(_defaultDialogPos.y); } +void Scene611::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(NOUN_RAT); + _scene->addActiveVocab(VERB_WALKTO); +} + void Scene611::handleRatMoves() { _ratPresentFl = false; _scene->_sequences.remove(_globals._sequenceIndexes[1]); @@ -4386,11 +4494,9 @@ void Scene611::actions() { /*------------------------------------------------------------------------*/ -void Scene612::setup() { - setPlayerSpritesPrefix(); - setAAName(); - _scene->addActiveVocab(NOUN_FISHING_LINE); - _scene->addActiveVocab(VERB_WALKTO); +Scene612::Scene612(MADSEngine *vm) : Scene6xx(vm) { + _actionMode = -1; + _cycleIndex = -1; } void Scene612::synchronize(Common::Serializer &s) { @@ -4400,6 +4506,13 @@ void Scene612::synchronize(Common::Serializer &s) { s.syncAsSint16LE(_cycleIndex); } +void Scene612::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(NOUN_FISHING_LINE); + _scene->addActiveVocab(VERB_WALKTO); +} + void Scene612::handleWinchMovement() { switch (_game._trigger) { case 0: diff --git a/engines/mads/nebular/nebular_scenes6.h b/engines/mads/nebular/nebular_scenes6.h index 680d006f66..74467858bd 100644 --- a/engines/mads/nebular/nebular_scenes6.h +++ b/engines/mads/nebular/nebular_scenes6.h @@ -70,7 +70,7 @@ private: void handleSafeActions(); public: - Scene602(MADSEngine *vm) : Scene6xx(vm) {} + Scene602(MADSEngine *vm); void synchronize(Common::Serializer &s); virtual void setup(); @@ -84,7 +84,7 @@ private: int _noteHotspotId; public: - Scene603(MADSEngine *vm) : Scene6xx(vm) {} + Scene603(MADSEngine *vm); void synchronize(Common::Serializer &s); virtual void setup(); @@ -106,7 +106,7 @@ private: void handleBombActions(); public: - Scene604(MADSEngine *vm) : Scene6xx(vm) {} + Scene604(MADSEngine *vm); void synchronize(Common::Serializer &s); virtual void setup(); @@ -142,7 +142,7 @@ private: void handleThrowingBone(); public: - Scene607(MADSEngine *vm) : Scene6xx(vm) {} + Scene607(MADSEngine *vm); void synchronize(Common::Serializer &s); virtual void setup(); @@ -190,7 +190,7 @@ private: void handleThrowingBone(); public: - Scene608(MADSEngine *vm) : Scene6xx(vm) {} + Scene608(MADSEngine *vm); void synchronize(Common::Serializer &s); virtual void setup(); @@ -207,7 +207,7 @@ private: void enterStore(); public: - Scene609(MADSEngine *vm) : Scene6xx(vm) {} + Scene609(MADSEngine *vm); void synchronize(Common::Serializer &s); virtual void setup(); @@ -228,7 +228,7 @@ private: uint32 _lastFrameTimer; public: - Scene610(MADSEngine *vm) : Scene6xx(vm) {} + Scene610(MADSEngine *vm); void synchronize(Common::Serializer &s); virtual void setup(); @@ -280,7 +280,7 @@ private: bool check4ChargedBatteries(); public: - Scene611(MADSEngine *vm) : Scene6xx(vm) {} + Scene611(MADSEngine *vm); void synchronize(Common::Serializer &s); virtual void setup(); @@ -298,7 +298,7 @@ private: void handleWinchMovement(); public: - Scene612(MADSEngine *vm) : Scene6xx(vm) {} + Scene612(MADSEngine *vm); void synchronize(Common::Serializer &s); virtual void setup(); -- cgit v1.2.3 From cc65a8d015288e2e79960a659843bc0eb3136c30 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 23 May 2014 20:16:07 +0200 Subject: MADS: Move contructors out of the header in scene group 7 --- engines/mads/nebular/nebular_scenes7.cpp | 107 ++++++++++++++++++++++--------- engines/mads/nebular/nebular_scenes7.h | 14 ++-- 2 files changed, 83 insertions(+), 38 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index e9d8f7f4cb..585271cfda 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -89,6 +89,16 @@ void Scene7xx::sceneEntrySound() { /*------------------------------------------------------------------------*/ +Scene701::Scene701(MADSEngine *vm) : Scene7xx(vm) { + _fishingLineId = -1; +} + +void Scene701::synchronize(Common::Serializer &s) { + Scene7xx::synchronize(s); + + s.syncAsSint16LE(_fishingLineId); +} + void Scene701::setup() { setPlayerSpritesPrefix(); setAAName(); @@ -99,12 +109,6 @@ void Scene701::setup() { _scene->addActiveVocab(VERB_WALKTO); } -void Scene701::synchronize(Common::Serializer &s) { - Scene7xx::synchronize(s); - - s.syncAsSint16LE(_fishingLineId); -} - void Scene701::enter() { _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 0)); _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('b', 5)); @@ -547,9 +551,19 @@ void Scene702::actions() { /*------------------------------------------------------------------------*/ -void Scene703::setup() { - _game._player._spritesPrefix = ""; - setAAName(); +Scene703::Scene703(MADSEngine *vm) : Scene7xx(vm) { + _monsterMode = -1; + _boatFrame = -1; + _curSequence = -1; + _boatDir = -1; + + _useBomb = false; + _startMonsterTimer = false; + _rexDeathFl = false; + _restartTrigger70Fl = false; + + _lastFrameTime = 0; + _monsterTime = 0; } void Scene703::synchronize(Common::Serializer &s) { @@ -569,6 +583,11 @@ void Scene703::synchronize(Common::Serializer &s) { s.syncAsUint32LE(_monsterTime); } +void Scene703::setup() { + _game._player._spritesPrefix = ""; + setAAName(); +} + void Scene703::handleBottleInterface() { switch (_globals[kBottleStatus]) { case 0: @@ -1090,11 +1109,13 @@ void Scene703::actions() { /*------------------------------------------------------------------------*/ -void Scene704::setup() { - _game._player._spritesPrefix = ""; - setAAName(); - _scene->addActiveVocab(NOUN_BOTTLE); - _scene->addActiveVocab(VERB_LOOK_AT); +Scene704::Scene704(MADSEngine *vm) : Scene7xx(vm) { + _bottleHotspotId = -1; + _boatCurrentFrame = -1; + _animationMode = -1; + _boatDirection = -1; + + _takeBottleFl = false; } void Scene704::synchronize(Common::Serializer &s) { @@ -1108,6 +1129,13 @@ void Scene704::synchronize(Common::Serializer &s) { s.syncAsByte(_takeBottleFl); } +void Scene704::setup() { + _game._player._spritesPrefix = ""; + setAAName(); + _scene->addActiveVocab(NOUN_BOTTLE); + _scene->addActiveVocab(VERB_LOOK_AT); +} + void Scene704::handleBottleInterface() { switch (_globals[kBottleStatus]) { case 0: @@ -1708,12 +1736,13 @@ void Scene705::actions() { /*------------------------------------------------------------------------*/ -void Scene706::setup() { - setPlayerSpritesPrefix(); - setAAName(); - _scene->addActiveVocab(NOUN_BOTTLE); - _scene->addActiveVocab(NOUN_VASE); - _scene->addActiveVocab(VERB_WALKTO); +Scene706::Scene706(MADSEngine *vm) : Scene7xx(vm) { + _vaseHotspotId = -1; + _vaseMode = -1; + _animationMode = -1; + _animationFrame = -1; + + _emptyPedestral = false; } void Scene706::synchronize(Common::Serializer &s) { @@ -1727,6 +1756,14 @@ void Scene706::synchronize(Common::Serializer &s) { s.syncAsByte(_emptyPedestral); } +void Scene706::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(NOUN_BOTTLE); + _scene->addActiveVocab(NOUN_VASE); + _scene->addActiveVocab(VERB_WALKTO); +} + void Scene706::handleRexDeath() { switch (_game._trigger) { case 0: @@ -2128,11 +2165,8 @@ void Scene711::actions() { /*------------------------------------------------------------------------*/ -void Scene751::setup() { - setPlayerSpritesPrefix(); - setAAName(); - _scene->addActiveVocab(NOUN_FISHING_LINE); - _scene->addActiveVocab(VERB_WALKTO); +Scene751::Scene751(MADSEngine *vm) : Scene7xx(vm) { + _rexHandingLine = false; } void Scene751::synchronize(Common::Serializer &s) { @@ -2141,6 +2175,13 @@ void Scene751::synchronize(Common::Serializer &s) { s.syncAsByte(_rexHandingLine); } +void Scene751::setup() { + setPlayerSpritesPrefix(); + setAAName(); + _scene->addActiveVocab(NOUN_FISHING_LINE); + _scene->addActiveVocab(VERB_WALKTO); +} + void Scene751::enter() { _globals._spriteIndexes[1] = _scene->_sprites.addSprites("*RM701X0"); _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('a', 0)); @@ -2459,6 +2500,16 @@ void Scene751::actions() { /*------------------------------------------------------------------------*/ +Scene752::Scene752(MADSEngine *vm) : Scene7xx(vm) { + _cardId = -1; +} + +void Scene752::synchronize(Common::Serializer &s) { + Scene7xx::synchronize(s); + + s.syncAsSint16LE(_cardId); +} + void Scene752::setup() { setPlayerSpritesPrefix(); setAAName(); @@ -2469,12 +2520,6 @@ void Scene752::setup() { _scene->addActiveVocab(NOUN_LASER_BEAM); } -void Scene752::synchronize(Common::Serializer &s) { - Scene7xx::synchronize(s); - - s.syncAsSint16LE(_cardId); -} - void Scene752::enter() { _globals._spriteIndexes[14] = _scene->_sprites.addSprites(formAnimName('l', -1)); _globals._spriteIndexes[12] = _scene->_sprites.addSprites("*RXMBD_8"); diff --git a/engines/mads/nebular/nebular_scenes7.h b/engines/mads/nebular/nebular_scenes7.h index 150c598b9b..454c76ebe9 100644 --- a/engines/mads/nebular/nebular_scenes7.h +++ b/engines/mads/nebular/nebular_scenes7.h @@ -55,7 +55,7 @@ private: int _fishingLineId; public: - Scene701(MADSEngine *vm) : Scene7xx(vm), _fishingLineId(-1) {} + Scene701(MADSEngine *vm); void synchronize(Common::Serializer &s); virtual void setup(); @@ -97,7 +97,7 @@ private: void handleFillBottle(int quote); public: - Scene703(MADSEngine *vm) : Scene7xx(vm) {} + Scene703(MADSEngine *vm); void synchronize(Common::Serializer &s); virtual void setup(); @@ -122,7 +122,7 @@ private: void handleBottleInterface(); public: - Scene704(MADSEngine *vm) : Scene7xx(vm) {} + Scene704(MADSEngine *vm); void synchronize(Common::Serializer &s); virtual void setup(); @@ -152,7 +152,7 @@ public: class Scene706: public Scene7xx{ private: int _vaseHotspotId; - int _vaseMode; // CHECKME: Use? + int _vaseMode; int _animationMode; int _animationFrame; @@ -162,7 +162,7 @@ private: void handleRexDeath(); public: - Scene706(MADSEngine *vm) : Scene7xx(vm) {} + Scene706(MADSEngine *vm); void synchronize(Common::Serializer &s); virtual void setup(); @@ -207,7 +207,7 @@ private: bool _rexHandingLine; public: - Scene751(MADSEngine *vm) : Scene7xx(vm) {} + Scene751(MADSEngine *vm); void synchronize(Common::Serializer &s); virtual void setup(); @@ -222,7 +222,7 @@ private: int _cardId; public: - Scene752(MADSEngine *vm) : Scene7xx(vm), _cardId(-1) {} + Scene752(MADSEngine *vm); void synchronize(Common::Serializer &s); virtual void setup(); -- cgit v1.2.3 From 2a73b6c08e98c07e63ef669487aad934da89feb7 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 23 May 2014 21:43:00 +0200 Subject: MADS: Move contructors out of the header in scene group 8 --- engines/mads/nebular/nebular_scenes8.cpp | 47 ++++++++++++++++++++++++-------- engines/mads/nebular/nebular_scenes8.h | 13 +++++---- 2 files changed, 42 insertions(+), 18 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index 1fef2709b4..6f9a46d655 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -78,9 +78,8 @@ void Scene8xx::sceneEntrySound() { /*------------------------------------------------------------------------*/ -void Scene801::setup() { - setPlayerSpritesPrefix(); - setAAName(); +Scene801::Scene801(MADSEngine *vm) : Scene8xx(vm) { + _walkThroughDoor = false; } void Scene801::synchronize(Common::Serializer &s) { @@ -89,6 +88,10 @@ void Scene801::synchronize(Common::Serializer &s) { s.syncAsByte(_walkThroughDoor); } +void Scene801::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} void Scene801::enter() { _globals._spriteIndexes[1] = _scene->_sprites.addSprites(formAnimName('x', 1)); @@ -830,10 +833,17 @@ void Scene803::actions() { /*------------------------------------------------------------------------*/ +Scene804::Scene804(MADSEngine *vm) : Scene8xx(vm) { + _messWithThrottle = false; + _movingThrottle = false; + _throttleGone = false; + _dontPullThrottleAgain = false; + _pullThrottleReally = false; + _alreadyOrgan = false; + _alreadyPop = false; -void Scene804::setup() { - Scene8xx::setPlayerSpritesPrefix(); - Scene8xx::setAAName(); + _throttleCounter = 0; + _resetFrame = -1; } void Scene804::synchronize(Common::Serializer &s) { @@ -851,6 +861,11 @@ void Scene804::synchronize(Common::Serializer &s) { s.syncAsUint32LE(_throttleCounter); } +void Scene804::setup() { + Scene8xx::setPlayerSpritesPrefix(); + Scene8xx::setAAName(); +} + void Scene804::enter() { _messWithThrottle = false; _throttleCounter = 0; @@ -1252,9 +1267,8 @@ void Scene807::actions() { /*------------------------------------------------------------------------*/ -void Scene808::setup() { - setPlayerSpritesPrefix(); - setAAName(); +Scene808::Scene808(MADSEngine *vm) : Scene8xx(vm) { + _goingTo803 = false; } void Scene808::synchronize(Common::Serializer &s) { @@ -1263,6 +1277,11 @@ void Scene808::synchronize(Common::Serializer &s) { s.syncAsByte(_goingTo803); } +void Scene808::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + void Scene808::enter() { _scene->_userInterface.setup(kInputLimitedSentences); @@ -1464,9 +1483,8 @@ void Scene808::actions() { /*------------------------------------------------------------------------*/ -void Scene810::setup() { - setPlayerSpritesPrefix(); - setAAName(); +Scene810::Scene810(MADSEngine *vm) : Scene8xx(vm) { + _moveAllowed = false; } void Scene810::synchronize(Common::Serializer &s) { @@ -1475,6 +1493,11 @@ void Scene810::synchronize(Common::Serializer &s) { s.syncAsByte(_moveAllowed); } +void Scene810::setup() { + setPlayerSpritesPrefix(); + setAAName(); +} + void Scene810::enter() { _scene->_userInterface.setup(kInputLimitedSentences); _game._player._visible = false; diff --git a/engines/mads/nebular/nebular_scenes8.h b/engines/mads/nebular/nebular_scenes8.h index f926d1ec97..150951dcaf 100644 --- a/engines/mads/nebular/nebular_scenes8.h +++ b/engines/mads/nebular/nebular_scenes8.h @@ -57,7 +57,7 @@ private: bool _walkThroughDoor; public: - Scene801(MADSEngine *vm) : Scene8xx(vm) {} + Scene801(MADSEngine *vm); void synchronize(Common::Serializer &s); virtual void setup(); @@ -92,16 +92,17 @@ public: class Scene804: public Scene8xx { private: bool _messWithThrottle; - uint32 _throttleCounter; bool _movingThrottle; bool _throttleGone; bool _dontPullThrottleAgain; - int _resetFrame; bool _pullThrottleReally; bool _alreadyOrgan; bool _alreadyPop; + uint32 _throttleCounter; + int _resetFrame; + public: - Scene804(MADSEngine *vm) : Scene8xx(vm), _throttleCounter(0) {} + Scene804(MADSEngine *vm); void synchronize(Common::Serializer &s); virtual void setup(); @@ -136,7 +137,7 @@ private: bool _goingTo803; public: - Scene808(MADSEngine *vm) : Scene8xx(vm) {} + Scene808(MADSEngine *vm); void synchronize(Common::Serializer &s); virtual void setup(); @@ -149,7 +150,7 @@ private: bool _moveAllowed; public: - Scene810(MADSEngine *vm) : Scene8xx(vm) {} + Scene810(MADSEngine *vm); void synchronize(Common::Serializer &s); virtual void setup(); -- cgit v1.2.3 From 55e6e2bdb491edc33c41e219ee227dfd05c8460c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 23 May 2014 23:54:58 +0200 Subject: MADS: Reorder some Synchronize functions for consistency across scene groups --- engines/mads/nebular/nebular_scenes1.cpp | 8 +++++++- engines/mads/nebular/nebular_scenes1.h | 23 ++++++++++++----------- engines/mads/nebular/nebular_scenes2.cpp | 7 +++++++ engines/mads/nebular/nebular_scenes2.h | 21 +++++++++++---------- engines/mads/nebular/nebular_scenes3.cpp | 24 ++++++++++++------------ engines/mads/nebular/nebular_scenes3.h | 26 +++++++++++++------------- 6 files changed, 62 insertions(+), 47 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index ff75f704f9..59432c1ac0 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -114,7 +114,6 @@ void Scene101::synchronize(Common::Serializer &s) { s.syncAsByte(_sittingFl); s.syncAsByte(_panelOpened); - s.syncAsSint16LE(_messageNum); s.syncAsSint16LE(_posY); s.syncAsSint16LE(_shieldSpriteIdx); @@ -1289,6 +1288,7 @@ Scene103::Scene103(MADSEngine *vm) : Scene1xx(vm) { void Scene103::synchronize(Common::Serializer &s) { Scene1xx::synchronize(s); + byte dummy = 0; s.syncAsByte(dummy); // In order to avoid to break savegame compatibility s.syncAsUint32LE(_updateClock); @@ -1825,6 +1825,7 @@ Scene105::Scene105(MADSEngine *vm) : Scene1xx(vm) { void Scene105::synchronize(Common::Serializer &s) { Scene1xx::synchronize(s); + s.syncAsByte(_explosionFl); } @@ -1986,6 +1987,7 @@ Scene106::Scene106(MADSEngine *vm) : Scene1xx(vm) { void Scene106::synchronize(Common::Serializer &s) { Scene1xx::synchronize(s); + s.syncAsByte(_backToShipFl); s.syncAsByte(_shadowFl); s.syncAsByte(_firstEmergingFl); @@ -2205,6 +2207,7 @@ Scene107::Scene107(MADSEngine *vm) : Scene1xx(vm) { void Scene107::synchronize(Common::Serializer &s) { Scene1xx::synchronize(s); + s.syncAsByte(_shootingFl); } @@ -2422,6 +2425,7 @@ Scene109::Scene109(MADSEngine *vm) : Scene1xx(vm) { void Scene109::synchronize(Common::Serializer &s) { Scene1xx::synchronize(s); + s.syncAsByte(_rexThrowingObject); s.syncAsByte(_hoovicDifficultFl); s.syncAsByte(_beforeEatingRex); @@ -2827,6 +2831,7 @@ Scene110::Scene110(MADSEngine *vm) : Scene1xx(vm) { void Scene110::synchronize(Common::Serializer &s) { Scene1xx::synchronize(s); + s.syncAsByte(_crabsFl); } @@ -2961,6 +2966,7 @@ Scene111::Scene111(MADSEngine *vm) : Scene1xx(vm) { void Scene111::synchronize(Common::Serializer &s) { Scene1xx::synchronize(s); + s.syncAsByte(_stampedFl); s.syncAsByte(_launch1Fl); s.syncAsByte(_launched2Fl); diff --git a/engines/mads/nebular/nebular_scenes1.h b/engines/mads/nebular/nebular_scenes1.h index 3cb4d431a8..9eb21349e4 100644 --- a/engines/mads/nebular/nebular_scenes1.h +++ b/engines/mads/nebular/nebular_scenes1.h @@ -65,15 +65,16 @@ private: int _oldSpecial; void sayDang(); + public: Scene101(MADSEngine *vm); + virtual void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); virtual void step(); virtual void preActions(); virtual void actions(); - virtual void synchronize(Common::Serializer &s); }; class Scene102 : public Scene1xx { @@ -91,6 +92,7 @@ private: public: Scene102(MADSEngine *vm); + virtual void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); @@ -98,21 +100,21 @@ public: virtual void preActions(); virtual void actions(); virtual void postActions(); - virtual void synchronize(Common::Serializer &s); }; class Scene103 : public Scene1xx { private: uint32 _updateClock; + public: Scene103(MADSEngine *vm); + virtual void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); virtual void step(); virtual void actions(); virtual void postActions(); - virtual void synchronize(Common::Serializer &s); }; class Scene104 : public Scene1xx { @@ -122,13 +124,13 @@ private: public: Scene104(MADSEngine *vm); + virtual void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); virtual void step(); virtual void preActions(); virtual void actions(); - virtual void synchronize(Common::Serializer &s); }; class Scene105 : public Scene1xx { @@ -137,13 +139,13 @@ private: public: Scene105(MADSEngine *vm); + virtual void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); virtual void step(); virtual void preActions(); virtual void actions(); - virtual void synchronize(Common::Serializer &s); }; class Scene106 : public Scene1xx { @@ -156,13 +158,13 @@ private: public: Scene106(MADSEngine *vm); + virtual void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); virtual void step(); virtual void preActions(); virtual void actions(); - virtual void synchronize(Common::Serializer &s); }; class Scene107 : public Scene1xx { @@ -171,13 +173,13 @@ private: public: Scene107(MADSEngine *vm); + virtual void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); virtual void step(); virtual void preActions(); virtual void actions(); - virtual void synchronize(Common::Serializer &s); }; class Scene108 : public Scene1xx { @@ -204,13 +206,13 @@ private: public: Scene109(MADSEngine *vm); + virtual void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); virtual void step(); virtual void preActions(); virtual void actions(); - virtual void synchronize(Common::Serializer &s); }; class Scene110 : public Scene1xx { @@ -219,13 +221,13 @@ private: public: Scene110(MADSEngine *vm); + virtual void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); virtual void step(); virtual void preActions(); virtual void actions(); - virtual void synchronize(Common::Serializer &s); }; class Scene111 : public Scene1xx { @@ -237,13 +239,13 @@ private: public: Scene111(MADSEngine *vm); + virtual void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); virtual void step(); virtual void preActions(); virtual void actions(); - virtual void synchronize(Common::Serializer &s); }; class Scene112 : public Scene1xx { @@ -257,7 +259,6 @@ public: }; } // End of namespace Nebular - } // End of namespace MADS #endif /* MADS_NEBULAR_SCENES1_H */ diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 2c26e88fe9..adb174c8ca 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -123,6 +123,7 @@ Scene201::Scene201(MADSEngine *vm) : Scene2xx(vm) { void Scene201::synchronize(Common::Serializer &s) { Scene2xx::synchronize(s); + s.syncAsByte(_pterodactylFlag); } @@ -351,6 +352,7 @@ Scene202::Scene202(MADSEngine *vm) : Scene2xx(vm) { void Scene202::synchronize(Common::Serializer &s) { Scene2xx::synchronize(s); + s.syncAsByte(_activeMsgFl); s.syncAsByte(_ladderTopFl); s.syncAsByte(_waitingMeteoFl); @@ -1020,6 +1022,7 @@ Scene203::Scene203(MADSEngine *vm) : Scene2xx(vm) { void Scene203::synchronize(Common::Serializer &s) { Scene2xx::synchronize(s); + s.syncAsByte(_rhotundaEat2Fl); s.syncAsByte(_rhotundaEatFl); } @@ -1652,6 +1655,7 @@ Scene208::Scene208(MADSEngine *vm) : Scene2xx(vm) { void Scene208::synchronize(Common::Serializer &s) { Scene2xx::synchronize(s); + s.syncAsByte(_rhotundaTurnFl); s.syncAsByte(_boundingFl); s.syncAsSint32LE(_rhotundaTime); @@ -1971,6 +1975,7 @@ Scene209::Scene209(MADSEngine *vm) : Scene2xx(vm) { void Scene209::synchronize(Common::Serializer &s) { Scene2xx::synchronize(s); + s.syncAsByte(_dodgeFl); s.syncAsByte(_forceDodgeFl); s.syncAsByte(_shouldDodgeFl); @@ -3607,6 +3612,7 @@ Scene210::Scene210(MADSEngine *vm) : Scene2xx(vm) { void Scene210::synchronize(Common::Serializer &s) { Scene2xx::synchronize(s); + s.syncAsSint32LE(_curDialogNode); s.syncAsSint32LE(_nextHandsPlace); s.syncAsSint32LE(_twinkleAnimationType); @@ -4606,6 +4612,7 @@ Scene211::Scene211(MADSEngine *vm) : Scene2xx(vm) { void Scene211::synchronize(Common::Serializer &s) { Scene2xx::synchronize(s); + s.syncAsByte(_ambushFl); s.syncAsByte(_wakeFl); diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index 750d45e808..e70444a256 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -55,12 +55,12 @@ private: public: Scene201(MADSEngine *vm); + virtual void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); virtual void step(); virtual void actions(); - virtual void synchronize(Common::Serializer &s); }; class Scene202: public Scene2xx { @@ -77,13 +77,13 @@ private: public: Scene202(MADSEngine *vm); + virtual void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); virtual void step(); virtual void preActions(); virtual void actions(); - virtual void synchronize(Common::Serializer &s); void setRandomKernelMessage(); }; @@ -94,13 +94,13 @@ private: public: Scene203(MADSEngine *vm); + virtual void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); virtual void step(); virtual void preActions(); virtual void actions(); - virtual void synchronize(Common::Serializer &s); }; class Scene205: public Scene2xx { @@ -114,12 +114,12 @@ private: public: Scene205(MADSEngine *vm); + virtual void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); virtual void step(); virtual void actions(); - virtual void synchronize(Common::Serializer &s); }; class Scene207: public Scene2xx { @@ -133,13 +133,13 @@ private: public: Scene207(MADSEngine *vm); + virtual void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); virtual void step(); virtual void preActions(); virtual void actions(); - virtual void synchronize(Common::Serializer &s); }; class Scene208: public Scene2xx { @@ -152,13 +152,13 @@ private: public: Scene208(MADSEngine *vm); + virtual void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); virtual void step(); virtual void preActions(); virtual void actions(); - virtual void synchronize(Common::Serializer &s); }; class Scene209: public Scene2xx { @@ -198,13 +198,13 @@ private: public: Scene209(MADSEngine *vm); + virtual void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); virtual void step(); virtual void preActions(); virtual void actions(); - virtual void synchronize(Common::Serializer &s); }; class Scene210: public Scene2xx { @@ -234,15 +234,16 @@ private: void handleTwinklesSpeech(int quoteId, int shiftX, uint32 delay); void newNode(int node); void restoreDialogNode(int node, int msgId, int posY); + public: Scene210(MADSEngine *vm); + virtual void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); virtual void step(); virtual void preActions(); virtual void actions(); - virtual void synchronize(Common::Serializer &s); }; class Scene211: public Scene2xx { @@ -253,13 +254,13 @@ private: public: Scene211(MADSEngine *vm); + virtual void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); virtual void step(); virtual void preActions(); virtual void actions(); - virtual void synchronize(Common::Serializer &s); }; class Scene212: public Scene2xx { @@ -289,12 +290,12 @@ private: public: Scene214(MADSEngine *vm); + virtual void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); virtual void step(); virtual void actions(); - virtual void synchronize(Common::Serializer &s); }; class Scene215: public Scene2xx { diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 06c4eb6d4c..5d7ee40207 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -1193,6 +1193,12 @@ void Scene308::setup() { setAAName(); } +void Scene308::synchronize(Common::Serializer &s) { + Scene3xx::synchronize(s); + + _forceField.synchronize(s); +} + void Scene308::enter() { _globals._spriteIndexes[1] = _scene->_sprites.addSprites("*SC003x0"); _globals._spriteIndexes[0] = _scene->_sprites.addSprites("*SC003x1"); @@ -1309,12 +1315,6 @@ void Scene308::step() { } } -void Scene308::synchronize(Common::Serializer &s) { - Scene3xx::synchronize(s); - - _forceField.synchronize(s); -} - /*------------------------------------------------------------------------*/ Scene309::Scene309(MADSEngine *vm) : Scene3xx(vm) { @@ -1528,6 +1528,12 @@ void Scene310::setup() { setAAName(); } +void Scene310::synchronize(Common::Serializer &s) { + Scene3xx::synchronize(s); + + _forceField.synchronize(s); +} + void Scene310::enter() { _globals._spriteIndexes[1] = _scene->_sprites.addSprites("*SC003x0"); _globals._spriteIndexes[0] = _scene->_sprites.addSprites("*SC003x1"); @@ -1554,12 +1560,6 @@ void Scene310::step() { _scene->_nextSceneId = 309; } -void Scene310::synchronize(Common::Serializer &s) { - Scene3xx::synchronize(s); - - _forceField.synchronize(s); -} - /*------------------------------------------------------------------------*/ Scene311::Scene311(MADSEngine *vm) : Scene3xx(vm) { diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h index 84c8fe7453..30ab333e53 100644 --- a/engines/mads/nebular/nebular_scenes3.h +++ b/engines/mads/nebular/nebular_scenes3.h @@ -95,11 +95,11 @@ private: public: Scene302(MADSEngine *vm); + virtual void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); virtual void step(); - virtual void synchronize(Common::Serializer &s); }; class Scene303: public Scene3xx { @@ -117,11 +117,11 @@ private: public: Scene304(MADSEngine *vm); + virtual void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); virtual void step(); - virtual void synchronize(Common::Serializer &s); }; class Scene307: public Scene3xx { @@ -154,12 +154,12 @@ private: public: Scene307(MADSEngine *vm); + virtual void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); virtual void step(); virtual void actions(); - virtual void synchronize(Common::Serializer &s); }; class Scene308: public Scene3xx { @@ -168,11 +168,11 @@ private: public: Scene308(MADSEngine *vm) : Scene3xx(vm) {} + virtual void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); virtual void step(); - virtual void synchronize(Common::Serializer &s); }; class Scene309: public Scene3xx { @@ -184,11 +184,11 @@ private: public: Scene309(MADSEngine *vm); + virtual void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); virtual void step(); - virtual void synchronize(Common::Serializer &s); }; class Scene310: public Scene3xx { @@ -197,11 +197,11 @@ private: public: Scene310(MADSEngine *vm) : Scene3xx(vm) {} + virtual void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); virtual void step(); - virtual void synchronize(Common::Serializer &s); }; class Scene311: public Scene3xx { @@ -210,12 +210,12 @@ private: public: Scene311(MADSEngine *vm); + virtual void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); virtual void step(); virtual void actions(); - virtual void synchronize(Common::Serializer &s); }; class Scene313: public Scene3xx { @@ -269,13 +269,13 @@ private: public: Scene318(MADSEngine *vm); + virtual void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); virtual void step(); virtual void preActions(); virtual void actions(); - virtual void synchronize(Common::Serializer &s); }; class Scene319: public Scene3xx { @@ -298,12 +298,12 @@ private: void handleSlacheDialogs(int quoteId, int counter, uint32 timer); public: Scene319(MADSEngine *vm); + virtual void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); virtual void step(); virtual void actions(); - virtual void synchronize(Common::Serializer &s); }; class Scene320: public Scene300s { @@ -323,12 +323,12 @@ private: public: Scene320(MADSEngine *vm); + virtual void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); virtual void step(); virtual void actions(); - virtual void synchronize(Common::Serializer &s); }; class Scene321: public Scene3xx { @@ -377,12 +377,12 @@ private: public: Scene352(MADSEngine *vm); + virtual void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); virtual void preActions(); virtual void actions(); - virtual void synchronize(Common::Serializer &s); }; class Scene353: public Scene3xx { @@ -430,12 +430,12 @@ private: public: Scene359(MADSEngine *vm); + virtual void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); virtual void preActions(); virtual void actions(); - virtual void synchronize(Common::Serializer &s); }; class Scene360: public Scene3xx { @@ -498,12 +498,12 @@ private: public: Scene389(MADSEngine *vm); + virtual void synchronize(Common::Serializer &s); virtual void setup(); virtual void enter(); virtual void step(); virtual void actions(); - virtual void synchronize(Common::Serializer &s); }; class Scene390: public Scene300s { -- cgit v1.2.3 From 2e02e1c9387a62d2be0ffbce2bdb03bde01b9697 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 24 May 2014 01:15:47 +0200 Subject: AVALANCHE: Initialize two variables in GhostRoom() --- engines/avalanche/ghostroom.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engines/avalanche/ghostroom.cpp b/engines/avalanche/ghostroom.cpp index 16c79fdee0..047a3670c2 100644 --- a/engines/avalanche/ghostroom.cpp +++ b/engines/avalanche/ghostroom.cpp @@ -49,6 +49,9 @@ GhostRoom::GhostRoom(AvalancheEngine *vm) { _greldetCount = 0; _redGreldet = false; _wasLoaded = false; + + _ghost = nullptr; + _glerk = nullptr; } GhostRoom::~GhostRoom() { -- cgit v1.2.3 From c4f3f77d74adb7a513819c7542dd1eed67badb95 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 24 May 2014 10:11:08 +0300 Subject: FULLPIPE: Further work on MovGraph::method50() --- engines/fullpipe/motion.cpp | 33 +++++++++++++++++---------------- engines/fullpipe/motion.h | 2 +- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index ccd246ff8b..cc248e131e 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -738,7 +738,7 @@ bool MovGraph::method44(StaticANIObject *ani, int x, int y) { int cnt = (*movarr)[0]->_movStepCount; if (cnt > 0) { - if ((*movarr)[0]->_movSteps[cnt - 1].link->_flags & 0x4000000) + if ((*movarr)[0]->_movSteps[cnt - 1]->link->_flags & 0x4000000) return true; } } @@ -851,13 +851,13 @@ MessageQueue *MovGraph::fillMGMinfo(StaticANIObject *ani, MovArr *movarr, int st for (int i = 0; i < movarr->_movStepCount; i++) { while (i < movarr->_movStepCount - 1) { - if (movarr->_movSteps[i ].link->_dwordArray1[movarr->_movSteps[i - 1].sfield_0 + _field_44] != - movarr->_movSteps[i + 1].link->_dwordArray1[movarr->_movSteps[i ].sfield_0 + _field_44]) + if (movarr->_movSteps[i ]->link->_dwordArray1[movarr->_movSteps[i - 1]->sfield_0 + _field_44] != + movarr->_movSteps[i + 1]->link->_dwordArray1[movarr->_movSteps[i ]->sfield_0 + _field_44]) break; i++; } - MovStep *st = &movarr->_movSteps[i]; + MovStep *st = movarr->_movSteps[i]; ani->getMovementById(st->link->_dwordArray1[_field_44 + st->sfield_0]); @@ -865,7 +865,7 @@ MessageQueue *MovGraph::fillMGMinfo(StaticANIObject *ani, MovArr *movarr, int st id2 = staticsId; } else { if (i < movarr->_movStepCount - 1) - id2 = ani->getMovementById(movarr->_movSteps[i + 1].link->_dwordArray1[_field_44 + st->sfield_0])->_staticsObj1->_staticsId; + id2 = ani->getMovementById(movarr->_movSteps[i + 1]->link->_dwordArray1[_field_44 + st->sfield_0])->_staticsObj1->_staticsId; else id2 = st->link->_dwordArray2[_field_44 + st->sfield_0]; } @@ -955,18 +955,19 @@ MessageQueue *MovGraph::method50(StaticANIObject *ani, Common::Array * } } - v11 = this->_items; - v12 = idx << 6; - v13 = (*(MovItem **)((char *)&v11->movitems + v12))[movidx].movarr; - if ( *(MovArr **)((char *)&v11->movarr + v12) ) - CObjectFree(*(void **)((char *)&v11->movarr + v12)); - memcpy((char *)&this->_items->movarr + v12, v13, 0x20u); - *(MovArr **)((char *)&this->_items->movarr + v12) = (MovArr *)operator new(8 * v13->_movStepCount); - memcpy(*(void **)((char *)&this->_items->movarr + v12), v13->_movSteps, 8 * v13->_movStepCount); - *(int *)((char *)&this->_items->field_10 + v12) = -1; - *(int *)((char *)&this->_items->field_14 + v12) = 0; + if (_items[idx]->movarr) + delete _items[idx]->movarr; + + _items[idx]->movarr = _items[idx]->movitems[movidx].movarr; + + _items[idx]->movarr->_movSteps.clear(); + _items[idx]->movarr->_movSteps = _items[idx]->movitems[movidx].movarr->_movSteps; + + _items[idx]->field_10 = -1; + _items[idx]->field_14 = 0; + + MessageQueue *mq = fillMGMinfo(_items[idx]->ani, _items[idx]->movarr, 0); - MessageQueue *mq = fillMGMinfo(*(StaticANIObject **)((char *)&this->_items->ani + v12), (MovArr *)((char *)&this->_items->movarr + v12), 0); if (!mq) return 0; diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index 6233174e67..dbd41b8f9e 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -307,7 +307,7 @@ struct MovStep { }; struct MovArr { - MovStep *_movSteps; + Common::Array _movSteps; int _movStepCount; int _afield_8; MovGraphLink *_link; -- cgit v1.2.3 From 9f447e0ff4b5fa9ec407cf7fc4e1a55fc7837d26 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 24 May 2014 11:05:07 +0300 Subject: FULLPIPE: Fix MovGraphItem structure --- engines/fullpipe/motion.cpp | 50 +++++++++++++++------------------------------ engines/fullpipe/motion.h | 19 ++++++----------- 2 files changed, 22 insertions(+), 47 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index cc248e131e..20ae2dfa61 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -507,14 +507,6 @@ bool MctlCompoundArray::load(MfcArchive &file) { MovGraphItem::MovGraphItem() { ani = 0; field_4 = 0; - movarr = 0; - field_C = 0; - field_10 = 0; - field_14 = 0; - field_18 = 0; - field_1C = 0; - field_20 = 0; - field_24 = 0; movitems = 0; count = 0; field_30 = 0; @@ -529,7 +521,7 @@ void MovGraphItem::free() { int MovGraph_messageHandler(ExCommand *cmd); -Common::Array *movGraphCallback(StaticANIObject *ani, Common::Array *items, signed int counter) { +MovArr *movGraphCallback(StaticANIObject *ani, Common::Array *items, signed int counter) { int residx = 0; int itemidx = 0; @@ -592,10 +584,7 @@ void MovGraph::freeItems() { for (uint i = 0; i < _items.size(); i++) { _items[i]->free(); - for (uint j = 0; j < _items[i]->movarr->size(); j++) - delete (*_items[i]->movarr)[j]; - - delete _items[i]->movarr; + _items[i]->movarr._movSteps.clear(); } _items.clear(); @@ -684,7 +673,7 @@ MessageQueue *MovGraph::method34(StaticANIObject *ani, int xpos, int ypos, int f return method50(ani, _callback1(ani, movitems, count), staticsId); } -void MovGraph::changeCallback(Common::Array *(*callback1)(StaticANIObject *ani, Common::Array *items, signed int counter)) { +void MovGraph::changeCallback(MovArr *(*callback1)(StaticANIObject *ani, Common::Array *items, signed int counter)) { _callback1 = callback1; } @@ -734,11 +723,11 @@ bool MovGraph::method44(StaticANIObject *ani, int x, int y) { Common::Array *movitem = method28(ani, x, y, 0, &counter); if (movitem) { - Common::Array *movarr = _callback1(ani, movitem, counter); - int cnt = (*movarr)[0]->_movStepCount; + MovArr *movarr = _callback1(ani, movitem, counter); + int cnt = movarr->_movStepCount; if (cnt > 0) { - if ((*movarr)[0]->_movSteps[cnt - 1]->link->_flags & 0x4000000) + if (movarr->_movSteps[cnt - 1]->link->_flags & 0x4000000) return true; } } @@ -759,7 +748,7 @@ MessageQueue *MovGraph::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int subj->getPicAniInfo(&picAniInfo); if (movitem) { - Common::Array *goal = _callback1(subj, movitem, ss); + MovArr *goal = _callback1(subj, movitem, ss); int idx = getItemIndexByStaticAni(subj); for (int i = 0; i < _items[idx]->count; i++) { @@ -787,7 +776,7 @@ MessageQueue *MovGraph::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int movitem = method28(subj, xpos, ypos, fuzzyMatch, &ss); if (movitem) { - Common::Array *goal = _callback1(subj, movitem, ss); + MovArr *goal = _callback1(subj, movitem, ss); int idx = getItemIndexByStaticAni(subj); if (_items[idx]->count > 0) { @@ -802,18 +791,13 @@ MessageQueue *MovGraph::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int } } - _items[idx]->movarr->clear(); - - for (int i = 0; i < (*_items[idx]->movitems->operator[](arridx)->movarr)[i]->_movStepCount; i++) { - MovArr *m = new MovArr; - - *m = *(*_items[idx]->movitems->operator[](arridx)->movarr)[i]; - } - - _items[idx]->field_10 = -1; - _items[idx]->field_14 = 0; + _items[idx]->movarr._movSteps.clear(); + _items[idx]->movarr = *_items[idx]->movitems->operator[](arridx)->movarr; + _items[idx]->movarr._movSteps = _items[idx]->movitems->operator[](arridx)->movarr->_movSteps; + _items[idx]->movarr._afield_8 = -1; + _items[idx]->movarr._link = 0; - MessageQueue *mq = fillMGMinfo(_items[idx]->ani, (*_items[idx]->movarr)[0], staticsId); + MessageQueue *mq = fillMGMinfo(_items[idx]->ani, &_items[idx]->movarr, staticsId); if (mq) { ExCommand *ex = new ExCommand(); ex->_messageKind = 17; @@ -925,7 +909,7 @@ MessageQueue *MovGraph::fillMGMinfo(StaticANIObject *ani, MovArr *movarr, int st return mq; } -MessageQueue *MovGraph::method50(StaticANIObject *ani, Common::Array *movarr, int staticsId) { +MessageQueue *MovGraph::method50(StaticANIObject *ani, MovArr *movarr, int staticsId) { #if 0 if (_itemsCount <= 0) return 0; @@ -958,11 +942,9 @@ MessageQueue *MovGraph::method50(StaticANIObject *ani, Common::Array * if (_items[idx]->movarr) delete _items[idx]->movarr; - _items[idx]->movarr = _items[idx]->movitems[movidx].movarr; - + _items[idx]->copyPart(_items[idx]->movitems[movidx]); _items[idx]->movarr->_movSteps.clear(); _items[idx]->movarr->_movSteps = _items[idx]->movitems[movidx].movarr->_movSteps; - _items[idx]->field_10 = -1; _items[idx]->field_14 = 0; diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index dbd41b8f9e..3aa07c143e 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -58,7 +58,7 @@ public: virtual bool method2C(StaticANIObject *obj, int x, int y) { return false; } virtual int method30() { return 0; } virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) { return 0; } - virtual void changeCallback(Common::Array *(*_callback1)(StaticANIObject *ani, Common::Array *items, signed int counter)) {} + virtual void changeCallback(MovArr *(*_callback1)(StaticANIObject *ani, Common::Array *items, signed int counter)) {} virtual bool method3C(StaticANIObject *ani, int flag) { return 0; } virtual int method40() { return 0; } virtual bool method44(StaticANIObject *ani, int x, int y) { return false; } @@ -316,7 +316,7 @@ struct MovArr { }; struct MovItem { - Common::Array *movarr; + MovArr *movarr; int _mfield_4; int _mfield_8; int _mfield_C; @@ -325,14 +325,7 @@ struct MovItem { struct MovGraphItem { StaticANIObject *ani; int field_4; - Common::Array *movarr; - int field_C; - int field_10; - int field_14; - int field_18; - int field_1C; - int field_20; - int field_24; + MovArr movarr; Common::Array *movitems; int count; int field_30; @@ -350,7 +343,7 @@ public: ObList _links; int _field_44; Common::Array _items; - Common::Array *(*_callback1)(StaticANIObject *ani, Common::Array *items, signed int counter); + MovArr *(*_callback1)(StaticANIObject *ani, Common::Array *items, signed int counter); MGM _mgm; public: @@ -365,11 +358,11 @@ public: virtual Common::Array *method28(StaticANIObject *ani, int x, int y, int flag1, int *rescount); virtual bool method2C(StaticANIObject *obj, int x, int y); virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId); - virtual void changeCallback(Common::Array *(*_callback1)(StaticANIObject *ani, Common::Array *items, signed int counter)); + virtual void changeCallback(MovArr *(*_callback1)(StaticANIObject *ani, Common::Array *items, signed int counter)); virtual bool method3C(StaticANIObject *ani, int flag); virtual bool method44(StaticANIObject *ani, int x, int y); virtual MessageQueue *doWalkTo(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId); - virtual MessageQueue *method50(StaticANIObject *ani, Common::Array *movarr, int staticsId); + virtual MessageQueue *method50(StaticANIObject *ani, MovArr *movarr, int staticsId); double calcDistance(Common::Point *point, MovGraphLink *link, int fuzzyMatch); void calcNodeDistancesAndAngles(); -- cgit v1.2.3 From 46d0e8b76cb0130c01dcddf4dd3483c1099b5a7c Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 24 May 2014 11:11:31 +0300 Subject: FULLPIPE: Finish MovGraph::method50() implementation --- engines/fullpipe/motion.cpp | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 20ae2dfa61..69dd64886a 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -910,16 +910,15 @@ MessageQueue *MovGraph::fillMGMinfo(StaticANIObject *ani, MovArr *movarr, int st } MessageQueue *MovGraph::method50(StaticANIObject *ani, MovArr *movarr, int staticsId) { -#if 0 - if (_itemsCount <= 0) + if (_items.size() == 0) return 0; int idx; int movidx; bool done = false; - for (idx = 0; idx <= _itemsCount && !done; idx++) { - if (idx == _itemsCount) + for (idx = 0; idx <= _items.size() && !done; idx++) { + if (idx == _items.size()) return 0; if (_items[idx]->ani == ani) { @@ -929,8 +928,8 @@ MessageQueue *MovGraph::method50(StaticANIObject *ani, MovArr *movarr, int stati if (_items[idx]->count < 1) return 0; - for (movidx = 0; movidx < _items[idx]->count; movidx++) - if (_items[idx]->movitems[movidx]->movarr == movarr) { + for (movidx = 0; movidx < _items[idx]->count; movidx++) { + if (_items[idx]->movitems->operator[](movidx)->movarr == movarr) { done = true; break; @@ -939,16 +938,13 @@ MessageQueue *MovGraph::method50(StaticANIObject *ani, MovArr *movarr, int stati } } - if (_items[idx]->movarr) - delete _items[idx]->movarr; + _items[idx]->movarr._movSteps.clear(); + _items[idx]->movarr = *_items[idx]->movitems->operator[](movidx)->movarr; + _items[idx]->movarr._movSteps = _items[idx]->movitems->operator[](movidx)->movarr->_movSteps; + _items[idx]->movarr._afield_8 = -1; + _items[idx]->movarr._link = 0; - _items[idx]->copyPart(_items[idx]->movitems[movidx]); - _items[idx]->movarr->_movSteps.clear(); - _items[idx]->movarr->_movSteps = _items[idx]->movitems[movidx].movarr->_movSteps; - _items[idx]->field_10 = -1; - _items[idx]->field_14 = 0; - - MessageQueue *mq = fillMGMinfo(_items[idx]->ani, _items[idx]->movarr, 0); + MessageQueue *mq = fillMGMinfo(_items[idx]->ani, &_items[idx]->movarr, 0); if (!mq) return 0; @@ -968,11 +964,6 @@ MessageQueue *MovGraph::method50(StaticANIObject *ani, MovArr *movarr, int stati } return mq; -#endif - - warning("STUB: MovGraph::method50()"); - - return 0; } double MovGraph::calcDistance(Common::Point *point, MovGraphLink *link, int fuzzyMatch) { -- cgit v1.2.3 From d197bb04afa9be420d92b5d927d496ddc881d642 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 24 May 2014 11:16:42 +0300 Subject: FULLPIPE: Simplify syntax --- engines/fullpipe/motion.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 69dd64886a..af615cd95a 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -752,7 +752,7 @@ MessageQueue *MovGraph::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int int idx = getItemIndexByStaticAni(subj); for (int i = 0; i < _items[idx]->count; i++) { - if (_items[idx]->movitems->operator[](i)->movarr == goal) { + if ((*_items[idx]->movitems)[i]->movarr == goal) { if (subj->_movement) { Common::Point point; @@ -782,7 +782,7 @@ MessageQueue *MovGraph::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int if (_items[idx]->count > 0) { int arridx = 0; - while (_items[idx]->movitems->operator[](arridx)->movarr != goal) { + while ((*_items[idx]->movitems)[arridx]->movarr != goal) { arridx++; if (arridx >= _items[idx]->count) { @@ -792,8 +792,8 @@ MessageQueue *MovGraph::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int } _items[idx]->movarr._movSteps.clear(); - _items[idx]->movarr = *_items[idx]->movitems->operator[](arridx)->movarr; - _items[idx]->movarr._movSteps = _items[idx]->movitems->operator[](arridx)->movarr->_movSteps; + _items[idx]->movarr = *(*_items[idx]->movitems)[arridx]->movarr; + _items[idx]->movarr._movSteps = (*_items[idx]->movitems)[arridx]->movarr->_movSteps; _items[idx]->movarr._afield_8 = -1; _items[idx]->movarr._link = 0; @@ -929,7 +929,7 @@ MessageQueue *MovGraph::method50(StaticANIObject *ani, MovArr *movarr, int stati return 0; for (movidx = 0; movidx < _items[idx]->count; movidx++) { - if (_items[idx]->movitems->operator[](movidx)->movarr == movarr) { + if ((*_items[idx]->movitems)[movidx]->movarr == movarr) { done = true; break; @@ -939,8 +939,8 @@ MessageQueue *MovGraph::method50(StaticANIObject *ani, MovArr *movarr, int stati } _items[idx]->movarr._movSteps.clear(); - _items[idx]->movarr = *_items[idx]->movitems->operator[](movidx)->movarr; - _items[idx]->movarr._movSteps = _items[idx]->movitems->operator[](movidx)->movarr->_movSteps; + _items[idx]->movarr = *(*_items[idx]->movitems)[movidx]->movarr; + _items[idx]->movarr._movSteps = (*_items[idx]->movitems)[movidx]->movarr->_movSteps; _items[idx]->movarr._afield_8 = -1; _items[idx]->movarr._link = 0; -- cgit v1.2.3 From e53743ddf9a770e998f348c72ceb4ef6c39fa34b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 24 May 2014 10:51:23 +0200 Subject: TUCKER: Add a safeguard to avoid a potential out of bound access --- engines/tucker/tucker.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/tucker/tucker.cpp b/engines/tucker/tucker.cpp index adf4be6b65..03019bfec5 100644 --- a/engines/tucker/tucker.cpp +++ b/engines/tucker/tucker.cpp @@ -890,9 +890,8 @@ void TuckerEngine::updateCharPosition() { if (action->_testFlag1Num < 500) { if (action->_testFlag1Num >= 300) error("updateCharPosition() - Unexpected value for _testFlag1Num : %d", action->_testFlag1Num); - if (_flagsTable[action->_testFlag1Num] != action->_testFlag1Value) { + if (_flagsTable[action->_testFlag1Num] != action->_testFlag1Value) skip = false; - } } else if (_inventoryItemsState[action->_testFlag1Num - 500] != action->_testFlag1Value) { skip = false; } @@ -900,9 +899,10 @@ void TuckerEngine::updateCharPosition() { } if (action->_testFlag2Num != 0) { if (action->_testFlag2Num < 500) { - if (_flagsTable[action->_testFlag2Num] != action->_testFlag2Value) { + if (action->_testFlag2Num >= 300) + error("updateCharPosition() - Unexpected value for _testFlag1Num : %d", action->_testFlag1Num); + if (_flagsTable[action->_testFlag2Num] != action->_testFlag2Value) skip = false; - } } else if (_inventoryItemsState[action->_testFlag2Num - 500] != action->_testFlag2Value) { skip = false; } -- cgit v1.2.3 From 2dc70a9e8bd549a44a7263a5cbbf3adf753b9746 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 24 May 2014 12:55:25 +0200 Subject: TUCKER: Add a couple of safeguards to avoid out of bound access during the display of credits --- engines/tucker/sequences.cpp | 7 +++++-- engines/tucker/tucker.cpp | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/engines/tucker/sequences.cpp b/engines/tucker/sequences.cpp index 2fb881f77e..4a68c14eea 100644 --- a/engines/tucker/sequences.cpp +++ b/engines/tucker/sequences.cpp @@ -115,7 +115,8 @@ void TuckerEngine::handleCreditsSequence() { if (counter4 == _creditsSequenceTimecounts[num]) { _fadePaletteCounter = 0; clearSprites(); - ++num; + if (num < 6) + ++num; Common::String filename; if (num == 6) { for (int i = 0; i < 16; ++i) { @@ -123,6 +124,7 @@ void TuckerEngine::handleCreditsSequence() { loadImage(filename.c_str(), imgBuf + i * 64000, 2); } } else { + filename = ""; switch (num) { case 1: filename = "loc75.pcx"; @@ -140,7 +142,8 @@ void TuckerEngine::handleCreditsSequence() { filename = "loc78.pcx"; break; } - loadImage(filename.c_str(), _quadBackgroundGfxBuf, 2); + if (filename != "") + loadImage(filename.c_str(), _quadBackgroundGfxBuf, 2); } _spritesCount = _creditsSequenceSpriteCounts[num]; ++_flagsTable[236]; diff --git a/engines/tucker/tucker.cpp b/engines/tucker/tucker.cpp index 03019bfec5..3b35fc65be 100644 --- a/engines/tucker/tucker.cpp +++ b/engines/tucker/tucker.cpp @@ -604,6 +604,7 @@ void TuckerEngine::mainLoop() { _flagsTable[236] = 74; } } + if (_flagsTable[236] > 70) { handleCreditsSequence(); _quitGame = true; -- cgit v1.2.3 From 006690789af69432fd9bec6cee8b76dbf62cb3f7 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 24 May 2014 13:53:42 +0200 Subject: TUCKER: Add a check to error out when the index isn't found for a given location number --- engines/tucker/resource.cpp | 109 ++++++++++++++++++++++---------------------- 1 file changed, 55 insertions(+), 54 deletions(-) diff --git a/engines/tucker/resource.cpp b/engines/tucker/resource.cpp index 5f06334720..dd9d426cde 100644 --- a/engines/tucker/resource.cpp +++ b/engines/tucker/resource.cpp @@ -662,15 +662,13 @@ void TuckerEngine::loadData4() { t.findNextToken(kDataTokenDw); _gameDebug = t.getNextInteger() != 0; _displayGameHints = t.getNextInteger() != 0; - // forces game hints feature -// _displayGameHints = true; _locationObjectsCount = 0; if (t.findIndex(_locationNum)) { while (t.findNextToken(kDataTokenDw)) { int i = t.getNextInteger(); - if (i < 0) { + if (i < 0) break; - } + assert(_locationObjectsCount < kLocationObjectsTableSize); LocationObject *d = &_locationObjectsTable[_locationObjectsCount++]; d->_xPos = i; @@ -851,60 +849,63 @@ void TuckerEngine::unloadSprC02_01() { void TuckerEngine::loadFx() { loadFile("fx.c", _loadTempBuf); DataTokenizer t(_loadTempBuf, _fileLoadSize); - t.findIndex(_locationNum); - t.findNextToken(kDataTokenDw); - _locationSoundsCount = t.getNextInteger(); - _currentFxSet = 0; - for (int i = 0; i < _locationSoundsCount; ++i) { - LocationSound *s = &_locationSoundsTable[i]; - s->_offset = 0; - s->_num = t.getNextInteger(); - s->_volume = t.getNextInteger(); - s->_type = t.getNextInteger(); - switch (s->_type) { - case 5: - _currentFxSet = 1; - _currentFxIndex = i; - _currentFxVolume = s->_volume; - _currentFxDist = t.getNextInteger(); - _currentFxScale = t.getNextInteger(); - break; - case 6: - case 7: - case 8: - s->_startFxSpriteState = t.getNextInteger(); - s->_startFxSpriteNum = t.getNextInteger(); - s->_updateType = t.getNextInteger(); - if (s->_type == 7) { - s->_flagNum = t.getNextInteger(); - s->_flagValueStartFx = t.getNextInteger(); - s->_stopFxSpriteState = t.getNextInteger(); - s->_stopFxSpriteNum = t.getNextInteger(); - s->_flagValueStopFx = t.getNextInteger(); + if (t.findIndex(_locationNum)) { + t.findNextToken(kDataTokenDw); + _locationSoundsCount = t.getNextInteger(); + _currentFxSet = 0; + for (int i = 0; i < _locationSoundsCount; ++i) { + LocationSound *s = &_locationSoundsTable[i]; + s->_offset = 0; + s->_num = t.getNextInteger(); + s->_volume = t.getNextInteger(); + s->_type = t.getNextInteger(); + switch (s->_type) { + case 5: + _currentFxSet = 1; + _currentFxIndex = i; + _currentFxVolume = s->_volume; + _currentFxDist = t.getNextInteger(); + _currentFxScale = t.getNextInteger(); + break; + case 6: + case 7: + case 8: + s->_startFxSpriteState = t.getNextInteger(); + s->_startFxSpriteNum = t.getNextInteger(); + s->_updateType = t.getNextInteger(); + if (s->_type == 7) { + s->_flagNum = t.getNextInteger(); + s->_flagValueStartFx = t.getNextInteger(); + s->_stopFxSpriteState = t.getNextInteger(); + s->_stopFxSpriteNum = t.getNextInteger(); + s->_flagValueStopFx = t.getNextInteger(); + } + break; + } + if (s->_type == 8) { + s->_type = 6; } - break; - } - if (s->_type == 8) { - s->_type = 6; } - } - t.findNextToken(kDataTokenDw); - int count = t.getNextInteger(); - _locationMusicsCount = 0; - for (int i = 0; i < count; ++i) { - int flagNum = t.getNextInteger(); - int flagValue = t.getNextInteger(); - if (flagValue == _flagsTable[flagNum]) { - LocationMusic *m = &_locationMusicsTable[_locationMusicsCount++]; - m->_offset = 0; - m->_num = t.getNextInteger(); - m->_volume = t.getNextInteger(); - m->_flag = t.getNextInteger(); - } else { - for (int j = 0; j < 3; ++j) { - t.getNextInteger(); + t.findNextToken(kDataTokenDw); + int count = t.getNextInteger(); + _locationMusicsCount = 0; + for (int i = 0; i < count; ++i) { + int flagNum = t.getNextInteger(); + int flagValue = t.getNextInteger(); + if (flagValue == _flagsTable[flagNum]) { + LocationMusic *m = &_locationMusicsTable[_locationMusicsCount++]; + m->_offset = 0; + m->_num = t.getNextInteger(); + m->_volume = t.getNextInteger(); + m->_flag = t.getNextInteger(); + } else { + for (int j = 0; j < 3; ++j) { + t.getNextInteger(); + } } } + } else { + error("loadFx() - Index not found for location %d", _locationNum); } } -- cgit v1.2.3 From 1bcd02177424aa2dd10dfe9788f1c0c75bc0c662 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 24 May 2014 13:32:58 -0400 Subject: MADS: Refactored VGA_COLOR_REV, which wasn't correct --- engines/mads/palette.cpp | 20 ++++++++++++++++---- engines/mads/palette.h | 5 +++-- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index c34f2c63d7..fd39492d0e 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -30,7 +30,6 @@ namespace MADS { #define VGA_COLOR_TRANS(x) ((x) * 255 / 63) -#define VGA_COLOR_REV(x) ((x) * 63 / 255) void RGB6::load(Common::SeekableReadStream *f) { r = VGA_COLOR_TRANS(f->readByte()); @@ -342,6 +341,19 @@ Fader::Fader(MADSEngine *vm): _vm(vm) { _colorFlags[3] = false; _colorValues[0] = _colorValues[1] = 0; _colorValues[2] = _colorValues[3] = 0; + + // TODO: It would be better if the fader routines could be refactored + // to work directly with 8-bit RGB values rather than 6-bit RGB values + Common::fill(&_rgb64Map[0], &_rgb64Map[PALETTE_COUNT], 0); + for (int i = 0; i < 64; ++i) + _rgb64Map[VGA_COLOR_TRANS(i)] = i; + byte v = 0; + for (int i = 0; i < PALETTE_COUNT; ++i) { + if (_rgb64Map[i]) + v = _rgb64Map[i]; + else + _rgb64Map[i] = v; + } } @@ -377,7 +389,7 @@ void Fader::fadeToGrey(byte palette[PALETTE_SIZE], byte *paletteMap, intensity = _colorValues[colorCtr]; } - int diff = intensity - VGA_COLOR_REV(palette[palCtr * 3 + colorCtr]); + int diff = intensity - _rgb64Map[palette[palCtr * 3 + colorCtr]]; palIndex[palCtr][colorCtr] = (byte)ABS(diff); signs[palCtr][colorCtr] = (diff == 0) ? 0 : (diff < 0 ? -1 : 1); } @@ -391,7 +403,7 @@ void Fader::fadeToGrey(byte palette[PALETTE_SIZE], byte *paletteMap, while (map[index]._accum[colorCtr] >= steps) { map[index]._accum[colorCtr] -= steps; - byte rgb63 = VGA_COLOR_REV(palette[palCtr * 3 + colorCtr]) + + byte rgb63 = _rgb64Map[palette[palCtr * 3 + colorCtr]] + signs[palCtr][colorCtr]; palette[palCtr * 3 + colorCtr] = VGA_COLOR_TRANS(rgb63); } @@ -561,7 +573,7 @@ int Fader::rgbMerge(RGB6 &palEntry) { } int Fader::rgbMerge(byte r, byte g, byte b) { - return VGA_COLOR_REV(r) * 38 + VGA_COLOR_REV(g) * 76 + VGA_COLOR_REV(b) * 14; + return _rgb64Map[r] * 38 + _rgb64Map[g] * 76 + _rgb64Map[b] * 14; } /*------------------------------------------------------------------------*/ diff --git a/engines/mads/palette.h b/engines/mads/palette.h index 3af0c2805b..92d23d65d9 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -187,6 +187,7 @@ private: void insertionSort(int size, byte *id, byte *value); protected: MADSEngine *_vm; + byte _rgb64Map[PALETTE_COUNT]; public: bool _colorFlags[4]; int _colorValues[4]; @@ -223,12 +224,12 @@ public: /** * Calculates a merge/hash for a given palette entry */ - static int rgbMerge(byte r, byte g, byte b); + int rgbMerge(byte r, byte g, byte b); /** * Calculates a merge/hash for a given palette entry */ - static int rgbMerge(RGB6 &palEntry); + int rgbMerge(RGB6 &palEntry); /** * Fades the given palette to greyscale -- cgit v1.2.3 From 3202abaa8922bc741b3f28e1a2c1a86d8639a5f4 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 24 May 2014 13:41:22 -0400 Subject: MADS: Standardized fading out methods as fadeOut --- engines/mads/nebular/dialogs_nebular.cpp | 4 ++-- engines/mads/nebular/nebular_scenes3.cpp | 3 ++- engines/mads/palette.cpp | 6 +----- engines/mads/palette.h | 5 ++--- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp index f22ec1ad90..2a421d1639 100644 --- a/engines/mads/nebular/dialogs_nebular.cpp +++ b/engines/mads/nebular/dialogs_nebular.cpp @@ -404,7 +404,7 @@ void PictureDialog::save() { // Fade the screen to grey int numColors = PALETTE_COUNT - PALETTE_RESERVED_LOW_COUNT - PALETTE_RESERVED_HIGH_COUNT; - palette.fadeToGrey(palette._mainPalette, &map[PALETTE_RESERVED_LOW_COUNT], + palette.fadeOut(palette._mainPalette, &map[PALETTE_RESERVED_LOW_COUNT], PALETTE_RESERVED_LOW_COUNT, numColors, 248, 8, 1, 16); // Remap the greyed out screen to use the small greyscale range @@ -521,7 +521,7 @@ ScreenDialog::ScreenDialog(MADSEngine *vm) : _vm(vm), _vm->_palette->setFullPalette(pal); } else { _vm->_palette->getFullPalette(pal); - _vm->_palette->fadeOut(pal, 0, PALETTE_COUNT, 16, 1, 1, 0, 0, 0); + _vm->_palette->fadeOut(pal, nullptr, 0, PALETTE_COUNT, 0, 1, 1, 16); } _vm->_screen.copyTo(&_savedSurface); diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 5d7ee40207..ddff434ca0 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -3323,7 +3323,8 @@ void Scene319::step() { case 72: _vm->_palette->setColorFlags(0xFF, 0, 0); _vm->_palette->setColorValues(0, 0, 0); - _vm->_palette->fadeOut(_vm->_palette->_mainPalette, 18, 228, 16, 1, 8, 248, 0, 0); + _vm->_palette->fadeOut(_vm->_palette->_mainPalette, nullptr, 18, 228, + 248, 0, 1, 16); warning("TODO: shake_countdown = 1;"); _scene->_reloadSceneFlag = true; break; diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index fd39492d0e..29045bc34c 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -365,7 +365,7 @@ void Fader::grabPalette(byte *colors, uint start, uint num) { g_system->getPaletteManager()->grabPalette(colors, start, num); } -void Fader::fadeToGrey(byte palette[PALETTE_SIZE], byte *paletteMap, +void Fader::fadeOut(byte palette[PALETTE_SIZE], byte *paletteMap, int baseColor, int numColors, int baseGrey, int numGreys, int tickDelay, int steps) { GreyEntry map[PALETTE_COUNT]; @@ -736,10 +736,6 @@ void Palette::setColorValues(byte r, byte g, byte b) { _colorValues[2] = b; } -void Palette::fadeOut(byte palette[PALETTE_SIZE], int start, int count, int v1, int v2, int v3, int v4, int v5, int v6) { - warning("TODO: Palette::fadeOut()"); -} - void Palette::lock() { if (_rgbList[31] && !_lockFl) error("Palette Lock - Unexpected values"); diff --git a/engines/mads/palette.h b/engines/mads/palette.h index 92d23d65d9..6d9498dd5f 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -232,9 +232,9 @@ public: int rgbMerge(RGB6 &palEntry); /** - * Fades the given palette to greyscale + * Fades the given palette out to black or grey */ - void fadeToGrey(byte palette[PALETTE_SIZE], byte *paletteMap, + void fadeOut(byte palette[PALETTE_SIZE], byte *paletteMap, int baseColor, int numColors, int baseGrey, int numGreys, int tickDelay, int steps); }; @@ -311,7 +311,6 @@ public: void setColorFlags(byte r, byte g, byte b); void setColorValues(byte r, byte g, byte b); - void fadeOut(byte palette[PALETTE_SIZE], int start, int count, int v1, int v2, int v3, int v4, int v5, int v6); void lock(); void unlock(); -- cgit v1.2.3 From b2860fc675db9958c994778a12947880812d4690 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 24 May 2014 14:21:03 -0400 Subject: MADS: Implemented scene fading --- engines/mads/nebular/dialogs_nebular.cpp | 2 ++ engines/mads/palette.cpp | 58 ++++++++++++++++++++++++++++++++ engines/mads/palette.h | 7 ++++ engines/mads/screen.cpp | 33 +++++++++--------- engines/mads/screen.h | 10 ------ 5 files changed, 85 insertions(+), 25 deletions(-) diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp index 2a421d1639..a4a7694d2c 100644 --- a/engines/mads/nebular/dialogs_nebular.cpp +++ b/engines/mads/nebular/dialogs_nebular.cpp @@ -388,6 +388,8 @@ void PictureDialog::save() { _rgbList.copy(palette._rgbList); // Set up palette allocation + Common::fill(&palette._colorFlags[0], &palette._colorFlags[3], true); + uint32 *palFlagP = &palette._palFlags[0]; for (int idx = 0; idx < PALETTE_COUNT; ++idx, ++palFlagP) { if (idx < PALETTE_RESERVED_LOW_COUNT || diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index 29045bc34c..9f56223aa6 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -422,6 +422,64 @@ void Fader::fadeOut(byte palette[PALETTE_SIZE], byte *paletteMap, } } +void Fader::fadeIn(byte palette[PALETTE_SIZE], byte destPalette[PALETTE_SIZE], + int baseColor, int numColors, int baseGrey, int numGreys, + int tickDelay, int steps) { + GreyEntry map[PALETTE_COUNT]; + byte tempPal[PALETTE_SIZE];; + int8 signs[PALETTE_COUNT][3]; + byte palIndex[PALETTE_COUNT][3]; + int intensity; + + Common::copy(destPalette, destPalette + PALETTE_SIZE, tempPal); + + mapToGreyRamp(tempPal, baseColor, numColors, baseGrey, numGreys, map); + + for (int palCtr = baseColor; palCtr < (baseColor + numColors); ++palCtr) { + int index = palCtr - baseColor; + for (int colorCtr = 0; colorCtr < 3; ++colorCtr) { + if (_colorFlags[colorCtr]) { + int shiftSign = _colorValues[colorCtr]; + if (shiftSign >= 0) { + intensity = map[index]._intensity << shiftSign; + } + else { + intensity = map[index]._intensity >> abs(shiftSign); + } + } + else { + intensity = _colorValues[colorCtr]; + } + + int diff = _rgb64Map[destPalette[palCtr * 3 + colorCtr]] - intensity; + palIndex[palCtr][colorCtr] = (byte)ABS(diff); + signs[palCtr][colorCtr] = (diff == 0) ? 0 : (diff < 0 ? -1 : 1); + + map[index]._accum[colorCtr] = 0; + } + } + + for (int stepCtr = 0; stepCtr < steps; ++stepCtr) { + for (int palCtr = baseColor; palCtr < (baseColor + numColors); ++palCtr) { + int index = palCtr - baseColor; + for (int colorCtr = 0; colorCtr < 3; ++colorCtr) { + map[index]._accum[colorCtr] += palIndex[palCtr][colorCtr]; + while (map[index]._accum[colorCtr] >= steps) { + map[index]._accum[colorCtr] -= steps; + + byte rgb63 = _rgb64Map[palette[palCtr * 3 + colorCtr]] + + signs[palCtr][colorCtr]; + palette[palCtr * 3 + colorCtr] = VGA_COLOR_TRANS(rgb63); + } + } + } + + setFullPalette(palette); + + _vm->_events->waitForNextFrame(); + } +} + void Fader::mapToGreyRamp(byte palette[PALETTE_SIZE], int baseColor, int numColors, int baseGrey, int numGreys, GreyEntry *map) { byte greyList[PALETTE_COUNT]; diff --git a/engines/mads/palette.h b/engines/mads/palette.h index 6d9498dd5f..0698e21a5f 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -237,6 +237,13 @@ public: void fadeOut(byte palette[PALETTE_SIZE], byte *paletteMap, int baseColor, int numColors, int baseGrey, int numGreys, int tickDelay, int steps); + + /** + * Fade into the given palette + */ + void fadeIn(byte palette[PALETTE_SIZE], byte destPalette[PALETTE_SIZE], + int baseColor, int numColors, int baseGrey, int numGreys, + int tickDelay, int steps); }; class Palette: public Fader { diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index 6a70bfb5d9..ae129995ac 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -570,14 +570,27 @@ void ScreenSurface::updateScreen() { } void ScreenSurface::transition(ScreenTransition transitionType, bool surfaceFlag) { + Palette &pal = *_vm->_palette; + byte palData[PALETTE_SIZE]; + switch (transitionType) { + case kTransitionFadeIn: case kTransitionFadeOutIn: - fadeOut(); - fadeIn(); - break; + Common::fill(&pal._colorValues[0], &pal._colorValues[3], 0); + Common::fill(&pal._colorFlags[0], &pal._colorFlags[3], false); - case kTransitionFadeIn: - fadeIn(); + if (transitionType == kTransitionFadeOutIn) { + // Fade out + pal.getFullPalette(palData); + pal.fadeOut(palData, nullptr, 0, PALETTE_COUNT, 0, 0, 1, 16); + } + + // Reset palette to black + Common::fill(&palData[0], &palData[PALETTE_SIZE], 0); + pal.setFullPalette(palData); + + copyRectToScreen(getBounds()); + pal.fadeIn(palData, pal._mainPalette, 0, 256, 0, 1, 1, 16); break; case kTransitionBoxInBottomLeft: @@ -606,14 +619,4 @@ void ScreenSurface::transition(ScreenTransition transitionType, bool surfaceFlag } } -void ScreenSurface::fadeOut() { - warning("TODO: Proper fade out"); -} - -void ScreenSurface::fadeIn() { - warning("TODO: Proper fade in"); - _vm->_palette->setFullPalette(_vm->_palette->_mainPalette); - _vm->_screen.copyRectToScreen(Common::Rect(0, 0, 320, 200)); -} - } // End of namespace MADS diff --git a/engines/mads/screen.h b/engines/mads/screen.h index 4ad5820d14..0e678d87a0 100644 --- a/engines/mads/screen.h +++ b/engines/mads/screen.h @@ -197,16 +197,6 @@ public: }; class ScreenSurface : public MSurface { -private: - /** - * Handles screen fade out - */ - void fadeOut(); - - /** - * Handles screen fade in - */ - void fadeIn(); public: Common::Point _offset; public: -- cgit v1.2.3 From 722b32506e5d28a5037b1bb1bef6f8759af13423 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 24 May 2014 14:44:12 -0400 Subject: MADS: Replaced a TODO with a stubbed method --- engines/mads/scene.cpp | 2 +- engines/mads/scene_data.h | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 0e3960c0f8..d589010194 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -548,7 +548,7 @@ void Scene::doAction() { if (_action._inProgress) { _action._savedFields._commandError = true; - warning("TODO: PtrUnk4"); + _sceneLogic->unhandledAction(); } if (_action._inProgress) diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index 83caec5682..db25298e91 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -114,6 +114,11 @@ public: */ virtual void postActions() {} + /** + * Unhandled action handling + */ + virtual void unhandledAction() {} + /** * Synchronize any local data for the scene */ -- cgit v1.2.3 From 0d54216beb634ee3c8ef1be12b5935d63f040746 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 24 May 2014 15:05:23 -0400 Subject: MADS: Fix checks for assets count when calling releasePlayerSprites --- engines/mads/game.cpp | 2 +- engines/mads/player.cpp | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index f8d6c36ebf..ac77aec4ae 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -170,7 +170,7 @@ void Game::gameLoop() { sectionLoop(); _player.releasePlayerSprites(); - assert(_scene._sprites.size() == 0); + assert(_scene._sprites._assetCount == 0); _vm->_palette->unlock(); _vm->_events->waitCursor(); diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index a9c9f113ff..a9bc0cd485 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -694,8 +694,7 @@ void Player::releasePlayerSprites() { _spritesLoaded = false; _spritesChanged = true; - // FIXME: Find out why this occurs - if (scene._sprites.size() > 0) { + if (scene._sprites._assetCount > 0) { warning("Player::releasePlayerSprites(): leftover sprites remain, clearing list"); scene._sprites.clear(); } -- cgit v1.2.3 From 786c771bb89648b74825a92f983563ad1b94083a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 24 May 2014 16:36:34 -0400 Subject: MADS: Implement screen shaking --- engines/mads/game.cpp | 1 + engines/mads/nebular/nebular_scenes3.cpp | 18 +++++++++--------- engines/mads/screen.cpp | 23 +++++++++++++++++++++-- engines/mads/screen.h | 3 +++ 4 files changed, 34 insertions(+), 11 deletions(-) diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index ac77aec4ae..3f424711f7 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -495,6 +495,7 @@ void Game::loadGame(int slotNumber) { _scene._currentSceneId = -2; _sectionNumber = _scene._nextSceneId / 100; _scene._frameStartTime = _vm->_events->getFrameCounter(); + _vm->_screen._shakeCountdown = -1; // Default the selected inventory item to the first one, if the player has any _scene._userInterface._selectedInvIndex = _objects._inventoryList.size() > 0 ? 0 : -1; diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index ddff434ca0..11eb2f85e0 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -2800,7 +2800,7 @@ void Scene318::step() { if (_internCounter >= 3600) { _vm->_sound->command(59); - warning("TODO: shake_countdown = 20;"); + _vm->_screen._shakeCountdown = 20; _internWalkingFl = true; } } @@ -3270,22 +3270,22 @@ void Scene319::step() { if (_animMode == 2) { if (_animFrame == 13) - warning("TODO: shake_countdown = 40;"); + _vm->_screen._shakeCountdown = 40; if (_animFrame == 16) - warning("TODO: shake_countdown = 1;"); + _vm->_screen._shakeCountdown = 1; } if (_animMode == 3) { if (_animFrame == 11) - warning("TODO: shake_countdown = 60;"); + _vm->_screen._shakeCountdown = 60; if (_animFrame == 18) - warning("TODO: shake_countdown = 1;"); + _vm->_screen._shakeCountdown = 1; } if ((_animMode == 4) && (_animFrame == 16)) - warning("TODO: shake_countdown = 80;"); + _vm->_screen._shakeCountdown = 80; if ((nextFrame >= 0) && (nextFrame != _scene->_activeAnimation->getCurrentFrame())) { _scene->_activeAnimation->setCurrentFrame(nextFrame); @@ -3308,7 +3308,7 @@ void Scene319::step() { _animFrame = _scene->_activeAnimation->getCurrentFrame(); _slacheTalkingFl = true; - warning("TODO: shake_countdown = 1;"); + _vm->_screen._shakeCountdown = 1; for (int i = 0; i <= 1; i++) { int oldIdx = _globals._sequenceIndexes[i]; @@ -3325,7 +3325,7 @@ void Scene319::step() { _vm->_palette->setColorValues(0, 0, 0); _vm->_palette->fadeOut(_vm->_palette->_mainPalette, nullptr, 18, 228, 248, 0, 1, 16); - warning("TODO: shake_countdown = 1;"); + _vm->_screen._shakeCountdown = 1; _scene->_reloadSceneFlag = true; break; @@ -3706,7 +3706,7 @@ void Scene320::step() { case 417: case 457: - warning("TODO: shake_countdown = 40;"); + _vm->_screen._shakeCountdown = 40; _vm->_sound->command(59); break; diff --git a/engines/mads/screen.cpp b/engines/mads/screen.cpp index ae129995ac..dacd20a348 100644 --- a/engines/mads/screen.cpp +++ b/engines/mads/screen.cpp @@ -545,6 +545,8 @@ void ScreenObjects::synchronize(Common::Serializer &s) { /*------------------------------------------------------------------------*/ ScreenSurface::ScreenSurface() { + _shakeCountdown = -1; + _random = 0x4D2; } void ScreenSurface::init() { @@ -553,7 +555,7 @@ void ScreenSurface::init() { void ScreenSurface::copyRectToScreen(const Common::Point &destPos, const Common::Rect &bounds) { - byte *buf = getBasePtr(destPos.x, destPos.y); + const byte *buf = getBasePtr(destPos.x, destPos.y); if (bounds.width() != 0 && bounds.height() != 0) g_system->copyRectToScreen(buf, this->pitch, bounds.left, bounds.top, @@ -564,8 +566,25 @@ void ScreenSurface::copyRectToScreen(const Common::Rect &bounds) { copyRectToScreen(Common::Point(bounds.left, bounds.top), bounds); } - void ScreenSurface::updateScreen() { + if (_shakeCountdown >= 0) { + _random = _random * 5 + 1; + int offset = (_random >> 8) & 3; + if (_shakeCountdown-- <= 0) + offset = 0; + + // Copy the screen with the left hand hide side of the screen of a given + // offset width shown at the very right. The offset changes to give + // an effect of shaking the screen + offset *= 4; + const byte *buf = getBasePtr(offset, 0); + g_system->copyRectToScreen(buf, this->pitch, 0, 0, + this->pitch - offset, this->h); + if (offset > 0) + g_system->copyRectToScreen(this->pixels, this->pitch, + this->pitch - offset, 0, offset, this->h); + } + g_system->updateScreen(); } diff --git a/engines/mads/screen.h b/engines/mads/screen.h index 0e678d87a0..b81fddd87a 100644 --- a/engines/mads/screen.h +++ b/engines/mads/screen.h @@ -197,8 +197,11 @@ public: }; class ScreenSurface : public MSurface { +private: + uint16 _random; public: Common::Point _offset; + int _shakeCountdown; public: /** * Constructor -- cgit v1.2.3 From ef22702ac4f01ab79248dd41b49b37fb119f68e9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 24 May 2014 17:25:33 -0400 Subject: MADS: Fix for standing up from chair in scene 101 --- engines/mads/nebular/nebular_scenes1.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 59432c1ac0..9fb3808c58 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -306,7 +306,7 @@ void Scene101::preActions() { if (_game._player._needToWalk) { switch (_game._trigger) { case 0: - _game._player._needToWalk = false; + _game._player._readyToWalk = false; _game._player._stepEnabled = false; _scene->_sequences.remove(_globals._sequenceIndexes[11]); _globals._sequenceIndexes[11] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[11], false, 3, 1, 0, 0); @@ -319,7 +319,7 @@ void Scene101::preActions() { _sittingFl = false; _game._player._visible = true; _game._player._stepEnabled = true; - _game._player._needToWalk = true; + _game._player._readyToWalk = true; _scene->_hotspots.activate(71, true); _scene->_dynamicHotspots.remove(_chairHotspotId); _globals._sequenceIndexes[12] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[12], false, 6, 0, 0, 0); -- cgit v1.2.3 From 8f9a75a9255fbccb8be3bbe6fc35aafec00a4260 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 24 May 2014 18:19:54 -0400 Subject: MADS: Add _sceneSurface subsurface, so sprite drawing is cropped correctly --- engines/mads/scene.cpp | 7 ++++++- engines/mads/scene.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index d589010194..944c082817 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -61,6 +61,11 @@ Scene::Scene(MADSEngine *vm): _vm(vm), _action(_vm), _depthSurface(vm), _paletteUsageF.push_back(PaletteUsage::UsageEntry(0xF)); + // Set up a scene surface that maps to our physical screen drawing surface + _sceneSurface.init(MADS_SCREEN_WIDTH, MADS_SCENE_HEIGHT, MADS_SCREEN_WIDTH, + _vm->_screen.getPixels(), Graphics::PixelFormat::createFormatCLUT8()); + + // Set up the verb list _verbList.push_back(VerbInit(VERB_LOOK, VERB_THAT, PREP_NONE)); _verbList.push_back(VerbInit(VERB_TAKE, VERB_THAT, PREP_NONE)); _verbList.push_back(VerbInit(VERB_PUSH, VERB_THAT, PREP_NONE)); @@ -487,7 +492,7 @@ void Scene::drawElements(ScreenTransition transitionType, bool surfaceFlag) { // Draw sprites that have changed if (_vm->getGameID() == GType_RexNebular) // TODO: Implement for V2 games - _spriteSlots.drawSprites(&_vm->_screen); + _spriteSlots.drawSprites(&_sceneSurface); // Draw text elements onto the view _textDisplay.draw(&_vm->_screen); diff --git a/engines/mads/scene.h b/engines/mads/scene.h index 27fb901a25..7a01d7360a 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -84,6 +84,7 @@ protected: MADSEngine *_vm; public: SceneLogic *_sceneLogic; + MSurface _sceneSurface; int _priorSceneId; int _nextSceneId; int _currentSceneId; -- cgit v1.2.3 From 87f7c0cda3a7d3ce46d8ad0cb39ce33a0f40d557 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 24 May 2014 18:56:44 -0400 Subject: MADS: Generalize sequence record _msgPos as _position --- engines/mads/messages.cpp | 4 +- engines/mads/nebular/nebular_scenes.cpp | 2 +- engines/mads/nebular/nebular_scenes1.cpp | 36 ++++----- engines/mads/nebular/nebular_scenes1.h | 2 +- engines/mads/nebular/nebular_scenes2.cpp | 68 ++++++++--------- engines/mads/nebular/nebular_scenes3.cpp | 124 +++++++++++++++---------------- engines/mads/nebular/nebular_scenes4.cpp | 28 +++---- engines/mads/nebular/nebular_scenes6.cpp | 14 ++-- engines/mads/nebular/nebular_scenes7.cpp | 56 +++++++------- engines/mads/nebular/nebular_scenes8.cpp | 22 +++--- engines/mads/sequence.cpp | 23 ++++-- engines/mads/sequence.h | 11 +-- 12 files changed, 196 insertions(+), 194 deletions(-) diff --git a/engines/mads/messages.cpp b/engines/mads/messages.cpp index 4fd02cc814..263d8fa661 100644 --- a/engines/mads/messages.cpp +++ b/engines/mads/messages.cpp @@ -210,8 +210,8 @@ void KernelMessages::processText(int msgIndex) { x1 = frame->getBounds().left; y1 = frame->getBounds().top; } else { - x1 = seqEntry._msgPos.x; - y1 = seqEntry._msgPos.y; + x1 = seqEntry._position.x; + y1 = seqEntry._position.y; } } diff --git a/engines/mads/nebular/nebular_scenes.cpp b/engines/mads/nebular/nebular_scenes.cpp index f8c113e8c5..cbfc055b6f 100644 --- a/engines/mads/nebular/nebular_scenes.cpp +++ b/engines/mads/nebular/nebular_scenes.cpp @@ -420,7 +420,7 @@ void SceneTeleporter::teleporterHandleKey() { _game._player._stepEnabled = false; Common::Point msgPos = teleporterComputeLocation(); _handSequenceId = _scene->_sequences.startReverseCycle(_handSpriteId, false, 4, 2, 0, 0); - _scene->_sequences.setMsgPosition(_handSequenceId, msgPos); + _scene->_sequences.setPosition(_handSequenceId, msgPos); _scene->_sequences.setDepth(_handSequenceId, 2); _scene->_sequences.addSubEntry(_handSequenceId, SEQUENCE_TRIGGER_LOOP, 0, 1); _scene->_sequences.addSubEntry(_handSequenceId, SEQUENCE_TRIGGER_EXPIRE, 0, 2); diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 9fb3808c58..1b875ae9fe 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -1671,14 +1671,14 @@ void Scene104::step() { _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('a', 0)); _vm->_palette->refreshSceneColors(); _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], mirrorFl, 7, 1, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(198, 143)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[2], Common::Point(198, 143)); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 1); break; case 1: _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], mirrorFl, 7, 0, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(198, 143)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[2], Common::Point(198, 143)); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], -2, -2); _scene->_sequences.addTimer(90, 2); break; @@ -1704,7 +1704,7 @@ void Scene104::step() { _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('a', 1)); _vm->_palette->refreshSceneColors(); _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 6, 1, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[3], Common::Point(198, 143)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[3], Common::Point(198, 143)); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 4); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 14); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 1); @@ -1712,7 +1712,7 @@ void Scene104::step() { case 1: _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 5, 1, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[3], Common::Point(198, 143)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[3], Common::Point(198, 143)); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 4); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 15, 32); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 2); @@ -1720,7 +1720,7 @@ void Scene104::step() { case 2: _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 3, 0, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[3], Common::Point(198, 143)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[3], Common::Point(198, 143)); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], -2, -2); _scene->_sequences.addTimer(90, 3); break; @@ -1746,7 +1746,7 @@ void Scene104::step() { _globals._spriteIndexes[4] = _scene->_sprites.addSprites(formAnimName('a', 2)); _vm->_palette->refreshSceneColors(); _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 8, 1, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(198, 143)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(198, 143)); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 4); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 1); if (_game._storyMode >= STORYMODE_NICE) @@ -1755,7 +1755,7 @@ void Scene104::step() { case 1: _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 8, 0, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(198, 143)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(198, 143)); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], -2, -2); _scene->_sequences.addTimer(90, 2); break; @@ -1842,7 +1842,7 @@ void Scene105::enter() { if (_globals[kFishIn105]) { _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 6, 0, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(48, 144)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(48, 144)); int idx = _scene->_dynamicHotspots.add(101, 348, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(56, 141), FACING_NORTHWEST); @@ -1982,7 +1982,7 @@ Scene106::Scene106(MADSEngine *vm) : Scene1xx(vm) { _backToShipFl = false; _shadowFl = false; _firstEmergingFl = false; - _msgPosY = 0; + _positionY = 0; } void Scene106::synchronize(Common::Serializer &s) { @@ -1991,7 +1991,7 @@ void Scene106::synchronize(Common::Serializer &s) { s.syncAsByte(_backToShipFl); s.syncAsByte(_shadowFl); s.syncAsByte(_firstEmergingFl); - s.syncAsSint32LE(_msgPosY); + s.syncAsSint32LE(_positionY); } void Scene106::setup() { @@ -2093,7 +2093,7 @@ void Scene106::step() { int msgId = -1; switch (tmpVal) { case 0: - _msgPosY = 26; + _positionY = 26; msgId = 49; break; @@ -2117,9 +2117,9 @@ void Scene106::step() { if (msgId >= 0) { int nextAbortVal = _game._trigger + 1; - _scene->_kernelMessages.add(Common::Point(15, _msgPosY), 0x1110, 0, 0, 360, _game.getQuote(msgId)); + _scene->_kernelMessages.add(Common::Point(15, _positionY), 0x1110, 0, 0, 360, _game.getQuote(msgId)); _scene->_sequences.addTimer(150, nextAbortVal); - _msgPosY += 14; + _positionY += 14; } } @@ -2233,7 +2233,7 @@ void Scene107::enter() { if (_globals[kFishIn107]) { _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 6, 0, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(68, 151)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(68, 151)); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 1); int idx = _scene->_dynamicHotspots.add(101, 348, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(78, 135), FACING_SOUTHWEST); @@ -2249,7 +2249,7 @@ void Scene107::enter() { if (((_scene->_priorSceneId == 105) || (_scene->_priorSceneId == 106)) && (_vm->getRandomNumber(1, 3) == 1)) { _globals._spriteIndexes[0] = _scene->_sprites.addSprites(Resources::formatName(105, 'R', 1, EXT_SS, "")); _globals._sequenceIndexes[0] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[0], true, 4, 0, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[0], Common::Point(270, 150)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[0], Common::Point(270, 150)); _scene->_sequences.setMotion(_globals._sequenceIndexes[0], SEQUENCE_TRIGGER_SPRITE, -200, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[0], 2); _scene->_dynamicHotspots.add(218, 348, _globals._sequenceIndexes[0], Common::Rect(0, 0, 0, 0)); @@ -2348,7 +2348,7 @@ void Scene108::enter() { if (_globals[kFishIn108]) { _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 6, 0, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(41, 109)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(41, 109)); int idx = _scene->_dynamicHotspots.add(101, 348, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(41, 109), FACING_NORTHWEST); } @@ -2508,7 +2508,7 @@ void Scene109::enter() { _globals._sequenceIndexes[10] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[10], true, 4, 0, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 5); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[10], Common::Point(126, 39)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[10], Common::Point(126, 39)); _scene->_sequences.setMotion(_globals._sequenceIndexes[10], 0, 200, 0); _scene->_sequences.setScale(_globals._sequenceIndexes[10], 80); _game._player._stepEnabled = false; @@ -2559,7 +2559,7 @@ void Scene109::step() { _hungryFl = true; } - if (_eatingFirstFish && (_scene->_sequences[_globals._sequenceIndexes[10]]._msgPos.x >= 178)) { + if (_eatingFirstFish && (_scene->_sequences[_globals._sequenceIndexes[10]]._position.x >= 178)) { _globals._sequenceIndexes[9] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 4, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 4); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SEQUENCE_TRIGGER_SPRITE, 29, 72); diff --git a/engines/mads/nebular/nebular_scenes1.h b/engines/mads/nebular/nebular_scenes1.h index 9eb21349e4..96d2bb95eb 100644 --- a/engines/mads/nebular/nebular_scenes1.h +++ b/engines/mads/nebular/nebular_scenes1.h @@ -154,7 +154,7 @@ private: bool _shadowFl; bool _firstEmergingFl; - int _msgPosY; + int _positionY; public: Scene106(MADSEngine *vm); diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index adb174c8ca..f93ea3931d 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -147,7 +147,7 @@ void Scene201::enter() { _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 4, 0, 0, 0); _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 6, 0, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 8); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(185, 46)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(185, 46)); int idx = _scene->_dynamicHotspots.add(NOUN_BIRDS, 209, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(186, 81), FACING_NORTH); @@ -401,14 +401,14 @@ void Scene202::enter() { _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 6, 0, 0, 0); _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 6, 0, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(149, 113)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[2], Common::Point(149, 113)); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 10); int idx = _scene->_dynamicHotspots.add(NOUN_BONE, VERB_WALKTO, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(153, 97), FACING_SOUTH); if (!(_globals[kBone202Status] & 1)) { _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 6, 0, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(130, 108)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(130, 108)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); idx = _scene->_dynamicHotspots.add(NOUN_BONE, VERB_WALKTO, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(132, 97), FACING_SOUTH); @@ -416,7 +416,7 @@ void Scene202::enter() { if (!(_globals[kBone202Status] & 2)) { _globals._sequenceIndexes[6] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[6], false, 6, 0, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[6], Common::Point(166, 110)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[6], Common::Point(166, 110)); _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 10); idx = _scene->_dynamicHotspots.add(NOUN_BONE, VERB_WALKTO, _globals._sequenceIndexes[6], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(165, 99), FACING_SOUTH); @@ -468,7 +468,7 @@ void Scene202::enter() { _globals._sequenceIndexes[10] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, 8); _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[10], Common::Point(247, 82)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[10], Common::Point(247, 82)); _game._player._playerPos = Common::Point(246, 124); _game._player._facing = FACING_NORTH; _globals[kTeleporterUnderstood] = true; @@ -476,7 +476,7 @@ void Scene202::enter() { _globals._sequenceIndexes[10] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 6); _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[10], Common::Point(172, 123)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[10], Common::Point(172, 123)); _game._player._playerPos = Common::Point(171, 122); _game._player._facing = FACING_NORTH; } @@ -488,7 +488,7 @@ void Scene202::enter() { _game._player._visible = false; _scene->_sequences.startCycle(_globals._sequenceIndexes[9], true, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[9], Common::Point(247, 82)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[9], Common::Point(247, 82)); _game._player._playerPos = Common::Point(246, 124); _game._player._facing = FACING_NORTH; } @@ -555,13 +555,13 @@ void Scene202::step() { _vm->_sound->command(41); _scene->_sequences.remove(_globals._sequenceIndexes[10]); _globals._sequenceIndexes[9] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[9], true, 6, 1, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[9], Common::Point(247, 82)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[9], Common::Point(247, 82)); _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 1); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SEQUENCE_TRIGGER_EXPIRE, 0, 91); break; case 91: _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[9], Common::Point(247, 82)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[9], Common::Point(247, 82)); _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 1); _scene->_sequences.addTimer(60, 92); break; @@ -858,7 +858,7 @@ void Scene202::actions() { break; case 1: { _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[9], Common::Point(247, 82)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[9], Common::Point(247, 82)); _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 1); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[8], _globals._sequenceIndexes[9]); _ladderTopFl = true; @@ -879,7 +879,7 @@ void Scene202::actions() { _game._player._visible= false; _globals._sequenceIndexes[10] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 6, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[10], 1, 6); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[10], Common::Point(172, 123)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[10], Common::Point(172, 123)); _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 1); _scene->_sequences.updateTimeout(-1, _globals._sequenceIndexes[10]); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[10], SEQUENCE_TRIGGER_EXPIRE, 0, 1); @@ -887,7 +887,7 @@ void Scene202::actions() { case 1: _globals._sequenceIndexes[10] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 6); _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[10], Common::Point(172, 123)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[10], Common::Point(172, 123)); if (_scene->_activeAnimation) { _waitingMeteoFl = true; _globals[kMeteorologistWatch] = METEOROLOGIST_GROUND; @@ -903,7 +903,7 @@ void Scene202::actions() { _globals._sequenceIndexes[10] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[9], false, 6, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 1); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[10], 1, 6); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[10], Common::Point(172, 123)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[10], Common::Point(172, 123)); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[10], SEQUENCE_TRIGGER_EXPIRE, 0, 3); break; case 3: @@ -922,13 +922,13 @@ void Scene202::actions() { _game._player._stepEnabled = false; _scene->_sequences.remove(_globals._sequenceIndexes[9]); _globals._sequenceIndexes[9] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], true, 6, 1, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[9], Common::Point(247, 82)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[9], Common::Point(247, 82)); _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 1); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SEQUENCE_TRIGGER_EXPIRE, 0, 1); break; case 1: _globals._sequenceIndexes[10] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, -2); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[10], Common::Point(247, 82)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[10], Common::Point(247, 82)); _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 1); if (_scene->_activeAnimation) { if (_scene->_activeAnimation->getCurrentFrame() > 200) { @@ -955,13 +955,13 @@ void Scene202::actions() { _meteorologistSpecial = false; _scene->_sequences.remove(_globals._sequenceIndexes[10]); _globals._sequenceIndexes[9] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[9], false, 6, 1, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[9], Common::Point(247, 82)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[9], Common::Point(247, 82)); _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 1); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[9], SEQUENCE_TRIGGER_EXPIRE, 0, 3); break; case 3: _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], true, 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[9], Common::Point(247, 82)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[9], Common::Point(247, 82)); _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 1); _game._player._stepEnabled = true; break; @@ -2661,7 +2661,7 @@ void Scene209::handleMonkeyFall() { _globals._sequenceIndexes[8] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[8], false, 8, 1, 0, 0); _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 1); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[9], oldIdx); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[9], Common::Point(201, 131)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[9], Common::Point(201, 131)); _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 8); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[8], oldIdx); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[8], 43, 72); @@ -2760,7 +2760,7 @@ void Scene209::handleMonkey2() { _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 60, _game.getQuote(137)); _vm->_sound->command(22); _globals._sequenceIndexes[12] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[12], false, 11, 1, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[12], Common::Point(111, 133)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[12], Common::Point(111, 133)); _scene->_sequences.setScale(_globals._sequenceIndexes[12], 79); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[12], 1, 6); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[12], SEQUENCE_TRIGGER_EXPIRE, 0, 252); @@ -2773,7 +2773,7 @@ void Scene209::handleMonkey2() { _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(132)); int oldIdx = _globals._sequenceIndexes[12]; _globals._sequenceIndexes[12] = _scene->_sequences.startCycle(_globals._spriteIndexes[12], false, 7); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[12], Common::Point(111, 133)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[12], Common::Point(111, 133)); _scene->_sequences.setScale(_globals._sequenceIndexes[12], 79); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[12], oldIdx); _scene->_sequences.addTimer(120, 253); @@ -2857,7 +2857,7 @@ void Scene209::enter() { if (_game._objects.isInRoom(OBJ_BINOCULARS)) { _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[9], Common::Point(201, 131)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[9], Common::Point(201, 131)); _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 8); int idx = _scene->_dynamicHotspots.add(39, 13, _globals._sequenceIndexes[9], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(200, 133), FACING_NORTH); @@ -3119,7 +3119,7 @@ void Scene209::step() { _game._player._visible = false; _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 7); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(116, 131)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[2], Common::Point(116, 131)); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 229); break; @@ -3127,7 +3127,7 @@ void Scene209::step() { case 229: { int oldIdx = _globals._sequenceIndexes[2]; _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 7); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(116, 131)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[2], Common::Point(116, 131)); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], oldIdx); _scene->_sequences.addTimer(35, 230); @@ -3138,7 +3138,7 @@ void Scene209::step() { _scene->_sequences.remove(_globals._sequenceIndexes[2]); _globals._sequenceIndexes[2] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 7); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(116, 131)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[2], Common::Point(116, 131)); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 231); break; @@ -3147,7 +3147,7 @@ void Scene209::step() { int oldIdx = _globals._sequenceIndexes[2]; _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 8, 10); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(116, 131)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[2], Common::Point(116, 131)); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], oldIdx); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 232); @@ -3160,7 +3160,7 @@ void Scene209::step() { case 232: { int oldIdx = _globals._sequenceIndexes[2]; _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 10); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(116, 131)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[2], Common::Point(116, 131)); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], oldIdx); _scene->_sequences.addTimer(2, 233); @@ -3182,14 +3182,14 @@ void Scene209::step() { if (_action.isAction(VERB_HOSE_DOWN, NOUN_BLOWGUN, NOUN_MONKEY)) { _globals._sequenceIndexes[2] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[2], false, 7, 16, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 11, 12); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(116, 131)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[2], Common::Point(116, 131)); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_SPRITE, 12, 239); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 235); } else if (_action.isAction(VERB_SHOOT, NOUN_BLOWGUN, NOUN_MONKEY)) { _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 11, 12); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(116, 131)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[2], Common::Point(116, 131)); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 235); _vm->_sound->command(23); @@ -3199,7 +3199,7 @@ void Scene209::step() { case 235: { int oldIdx = _globals._sequenceIndexes[2]; _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 13); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(116, 131)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[2], Common::Point(116, 131)); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], oldIdx); _scene->_sequences.addTimer(12, 236); @@ -3212,7 +3212,7 @@ void Scene209::step() { _scene->_sequences.remove(_globals._sequenceIndexes[2]); _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 14, 16); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(116, 131)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[2], Common::Point(116, 131)); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 4); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 237); break; @@ -4649,7 +4649,7 @@ void Scene211::enter() { if (_vm->getRandomNumber(1, 8) == 1) { _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 6, 0, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(202, 126)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[2], Common::Point(202, 126)); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 8); _scene->_sequences.setMotion(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_SPRITE, -200, 0); _scene->_dynamicHotspots.add(324, 13, _globals._sequenceIndexes[2], Common::Rect(1, 1, 1 + 41, 1 + 10)); @@ -5041,7 +5041,7 @@ void Scene214::enter() { if (_game._objects.isInRoom(OBJ_POISON_DARTS)) { _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 6, 0, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(103, 86)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(103, 86)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 11); } else { _scene->_hotspots.activate(NOUN_POISON_DARTS, false); @@ -5049,7 +5049,7 @@ void Scene214::enter() { if (_game._objects.isInRoom(OBJ_BLOWGUN)) { _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 6, 0, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(90, 87)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[2], Common::Point(90, 87)); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 13); } else { _scene->_hotspots.activate(NOUN_BLOWGUN, false); @@ -5236,7 +5236,7 @@ void Scene215::enter() { _globals._spriteIndexes[3] = _scene->_sprites.addSprites(formAnimName('a', 0)); _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle (_globals._spriteIndexes[1], false, 7, 0, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(235, 83)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(235, 83)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 15); if (_globals[kSexOfRex] == REX_MALE) diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index 11eb2f85e0..d54ffbdb2b 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -219,7 +219,7 @@ void Scene3xx::handleForceField(ForceField *force, int *sprites) { if (id >= 0) { force->_seqId[id] = _scene->_sequences.addSpriteCycle(sprites[spriteId], mirror, 2, 0, 0, 0); _scene->_sequences.setDepth(force->_seqId[id], 8); - _scene->_sequences.setMsgPosition(force->_seqId[id], Common::Point(posX, posY)); + _scene->_sequences.setPosition(force->_seqId[id], Common::Point(posX, posY)); _scene->_sequences.setMotion(force->_seqId[id], 2, speedX, speedY); _scene->_sequences.addSubEntry(force->_seqId[id], SEQUENCE_TRIGGER_EXPIRE, 0, 150 + id); if (spriteId == 2) @@ -742,7 +742,7 @@ void Scene307::enter() { initForceField(&_forceField, true); _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(127, 78)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(127, 78)); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 15); _animationMode = 0; @@ -810,7 +810,7 @@ void Scene307::enter() { _scene->_sequences.remove(_globals._sequenceIndexes[4]); _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 2); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(127, 78)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(127, 78)); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 15); } @@ -973,7 +973,7 @@ void Scene307::actions() { _vm->_sound->command(26); _scene->_sequences.remove(_globals._sequenceIndexes[4]); _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 2); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(127, 78)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(127, 78)); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 15); _scene->_sequences.addTimer(90, 5); break; @@ -1017,7 +1017,7 @@ void Scene307::actions() { _scene->_sequences.remove(_globals._sequenceIndexes[4]); _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 60, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 3, -2); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(127, 78)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(127, 78)); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 15); _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 18, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], -1, 4); @@ -1028,7 +1028,7 @@ void Scene307::actions() { case 1: _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, -2); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(127, 78)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(127, 78)); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 15); break; @@ -1045,31 +1045,31 @@ void Scene307::actions() { case 3: _scene->_sequences.remove(_globals._sequenceIndexes[4]); _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 3); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(127, 78)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(127, 78)); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 1); _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 11); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[5], Common::Point(129, 102)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[5], Common::Point(129, 102)); _scene->_sequences.addTimer(48, 4); break; case 4: _scene->_sequences.remove(_globals._sequenceIndexes[4]); _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 2); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(127, 78)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(127, 78)); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 1); _scene->_sequences.remove(_globals._sequenceIndexes[5]); _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 12, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[5], 12, 14); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[5], Common::Point(129, 102)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[5], Common::Point(129, 102)); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 5); break; case 5: _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 15); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[5]); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[5], Common::Point(129, 102)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[5], Common::Point(129, 102)); _scene->_sequences.addTimer(48, 6); break; @@ -1077,7 +1077,7 @@ void Scene307::actions() { _scene->_sequences.remove(_globals._sequenceIndexes[5]); _scene->_sequences.remove(_globals._sequenceIndexes[4]); _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(127, 78)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(127, 78)); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 1); _scene->_sequences.addTimer(48, 7); break; @@ -1213,7 +1213,7 @@ void Scene308::enter() { _vm->_palette->setEntry(253, 45, 15, 12); _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(127, 78)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(127, 78)); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 15); _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 9); @@ -1354,7 +1354,7 @@ void Scene309::enter() { _globals._spriteIndexes[4] = _scene->_sprites.addSprites(Resources::formatName(307, 'X', 0, EXT_SS, "")); _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(127, 78)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(127, 78)); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 15); _globals._sequenceIndexes[3] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[3], false, 7, 1, 0, 0); @@ -1543,7 +1543,7 @@ void Scene310::enter() { _globals._spriteIndexes[3] = _scene->_sprites.addSprites(Resources::formatName(307, 'X', 0, EXT_SS, "")); _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[3], Common::Point(127, 78)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[3], Common::Point(127, 78)); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 15); _game._player._visible = false; @@ -1589,7 +1589,7 @@ void Scene311::enter() { _globals._spriteIndexes[3] = _scene->_sprites.addSprites("*RXCL_2"); _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 15); _checkGuardFl = false; @@ -1625,7 +1625,7 @@ void Scene311::step() { case 71: _scene->_sequences.remove(_globals._sequenceIndexes[1]); _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 2); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); @@ -1643,7 +1643,7 @@ void Scene311::step() { case 73: _scene->_sequences.remove(_globals._sequenceIndexes[1]); _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 3); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); _scene->_sequences.setDone(_globals._sequenceIndexes[3]); @@ -1679,7 +1679,7 @@ void Scene311::step() { case 77: _scene->_sequences.remove(_globals._sequenceIndexes[1]); _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 2); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); _scene->_sequences.setDone(_globals._sequenceIndexes[3]); @@ -1691,7 +1691,7 @@ void Scene311::step() { case 78: _scene->_sequences.remove(_globals._sequenceIndexes[1]); _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 15); _scene->_sequences.setDone(_globals._sequenceIndexes[3]); @@ -1749,7 +1749,7 @@ void Scene311::actions() { _scene->_sequences.remove(_globals._sequenceIndexes[1]); _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 50, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 3, -2); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 15); _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 15, 1, 0, 0); @@ -1762,7 +1762,7 @@ void Scene311::actions() { case 1: { int oldIdx = _globals._sequenceIndexes[1]; _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -2); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 15); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[1], oldIdx); } @@ -1781,13 +1781,13 @@ void Scene311::actions() { case 3: { _scene->_sequences.remove(_globals._sequenceIndexes[1]); _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 3); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); int oldIdx = _globals._sequenceIndexes[2]; _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 11); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[2]); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(167, 100)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[2], Common::Point(167, 100)); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], oldIdx); _scene->_sequences.addTimer(15, 4); } @@ -1796,14 +1796,14 @@ void Scene311::actions() { case 4: _scene->_sequences.remove(_globals._sequenceIndexes[1]); _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 2); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); _scene->_sequences.remove(_globals._sequenceIndexes[2]); _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 12, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 12, 14); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[2]); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(167, 100)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[2], Common::Point(167, 100)); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 5); break; @@ -1811,7 +1811,7 @@ void Scene311::actions() { int oldIdx = _globals._sequenceIndexes[2]; _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 15); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[2]); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(167, 100)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[2], Common::Point(167, 100)); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], oldIdx); _scene->_sequences.addTimer(15, 6); } @@ -1821,7 +1821,7 @@ void Scene311::actions() { _scene->_sequences.remove(_globals._sequenceIndexes[2]); _scene->_sequences.remove(_globals._sequenceIndexes[1]); _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); _scene->_sequences.addTimer(15, 7); break; @@ -2443,7 +2443,7 @@ void Scene318::handleDialog() { int synxIdx = _globals._sequenceIndexes[2]; _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(142, 121)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[2], Common::Point(142, 121)); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], synxIdx); _vm->_sound->command(3); _scene->_userInterface.setup(kInputLimitedSentences); @@ -2514,7 +2514,7 @@ void Scene318::handleDialog() { _scene->_sequences.remove(_globals._sequenceIndexes[2]); _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(142, 121)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[2], Common::Point(142, 121)); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 6, 8); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 2); @@ -2658,7 +2658,7 @@ void Scene318::enter() { } else _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(142, 121)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[2], Common::Point(142, 121)); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); } } @@ -2839,7 +2839,7 @@ void Scene318::actions() { _scene->_sequences.remove(_globals._sequenceIndexes[2]); _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 8, 1, 0, 80); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(142, 121)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[2], Common::Point(142, 121)); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 6, 8); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 2); } @@ -2855,7 +2855,7 @@ void Scene318::actions() { int oldIdx = _globals._sequenceIndexes[2]; _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 8); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(142, 121)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[2], Common::Point(142, 121)); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], oldIdx); } break; @@ -2874,7 +2874,7 @@ void Scene318::actions() { _scene->_sequences.remove(_globals._sequenceIndexes[2]); _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 8, 2, 0, 80); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(142, 121)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[2], Common::Point(142, 121)); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 2, 5); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_SPRITE, 5, 1); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 2); @@ -2894,7 +2894,7 @@ void Scene318::actions() { int oldIdx = _globals._sequenceIndexes[2]; _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(142, 121)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[2], Common::Point(142, 121)); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], oldIdx); _scene->_sequences.addTimer(60, 3); } @@ -3743,7 +3743,7 @@ void Scene320::actions() { handleButtons(); _globals._sequenceIndexes[18] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[18], _flippedFl, 4, 2, 0, 0); _scene->_sequences.setScale(_globals._sequenceIndexes[18], 60); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[18], Common::Point(_posX, 170)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[18], Common::Point(_posX, 170)); _scene->_sequences.setDepth(_globals._sequenceIndexes[18], 0); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[18], SEQUENCE_TRIGGER_LOOP, 0, 1); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[18], SEQUENCE_TRIGGER_EXPIRE, 0, 2); @@ -4792,7 +4792,7 @@ void Scene357::enter() { _globals[kAfterHavoc] = true; _globals._spriteIndexes[1] = _scene->_sprites.addSprites(Resources::formatName(307, 'X', 0, EXT_SS, "")); _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(127, 78)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(127, 78)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 15); if (_scene->_priorSceneId == 318) @@ -4858,7 +4858,7 @@ void Scene358::setup() { void Scene358::enter() { _globals._spriteIndexes[1] = _scene->_sprites.addSprites(Resources::formatName(307, 'X', 0, EXT_SS, "")); _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(127, 78)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(127, 78)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 15); if (_scene->_priorSceneId == 357) @@ -4928,7 +4928,7 @@ void Scene359::enter() { _globals._spriteIndexes[4] = _scene->_sprites.addSprites("*ROXBD_2"); _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[3], Common::Point(127, 78)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[3], Common::Point(127, 78)); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 15); if (_game._objects.isInRoom(OBJ_SECURITY_CARD)) { @@ -4974,7 +4974,7 @@ void Scene359::actions() { } else { _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], true, 7, 2, 0, 0); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(106, 110)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(106, 110)); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_SPRITE, 6, 1); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 2); } @@ -5057,7 +5057,7 @@ void Scene360::setup() { void Scene360::enter() { _globals._spriteIndexes[1] = _scene->_sprites.addSprites(Resources::formatName(307, 'X', 0, EXT_SS, "")); _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(127, 78)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(127, 78)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 15); if (_scene->_priorSceneId == 359) @@ -5119,7 +5119,7 @@ void Scene361::handleRexAction() { _scene->_sequences.remove(_globals._sequenceIndexes[1]); _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 50, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 3, -2); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 15); _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 15, 1, 0, 0); @@ -5132,7 +5132,7 @@ void Scene361::handleRexAction() { case 1: { int seqIdx = _globals._sequenceIndexes[1]; _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 4); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 15); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[1], seqIdx); } @@ -5151,13 +5151,13 @@ void Scene361::handleRexAction() { case 3: { _scene->_sequences.remove(_globals._sequenceIndexes[1]); _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 3); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); int seqIdx = _globals._sequenceIndexes[2]; _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 11); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[2]); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(167, 100)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[2], Common::Point(167, 100)); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], seqIdx); _scene->_sequences.addTimer(15, 4); } @@ -5166,14 +5166,14 @@ void Scene361::handleRexAction() { case 4: _scene->_sequences.remove(_globals._sequenceIndexes[1]); _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 2); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); _scene->_sequences.setDone(_globals._sequenceIndexes[2]); _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 12, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 12, 14); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[2]); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(167, 100)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[2], Common::Point(167, 100)); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 5); break; @@ -5181,7 +5181,7 @@ void Scene361::handleRexAction() { int seqIdx = _globals._sequenceIndexes[2]; _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 15); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[2]); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], Common::Point(167, 100)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[2], Common::Point(167, 100)); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[2], seqIdx); _scene->_sequences.addTimer(15, 6); } @@ -5191,7 +5191,7 @@ void Scene361::handleRexAction() { _scene->_sequences.setDone(_globals._sequenceIndexes[2]); _scene->_sequences.remove(_globals._sequenceIndexes[1]); _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); _scene->_sequences.addTimer(48, 7); break; @@ -5213,7 +5213,7 @@ void Scene361::handleRoxAction() { _scene->_sequences.remove(_globals._sequenceIndexes[1]); _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 18, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[1], 2, 4); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 15); _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 18, 1, 0, 0); @@ -5226,7 +5226,7 @@ void Scene361::handleRoxAction() { case 1: { int tmpIdx = _globals._sequenceIndexes[1]; _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 4); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 15); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[1], tmpIdx); } @@ -5245,14 +5245,14 @@ void Scene361::handleRoxAction() { case 3: { _scene->_sequences.remove(_globals._sequenceIndexes[1]); _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 3); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); int tmpIdx = _globals._sequenceIndexes[4]; _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 12, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 9, 10); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(167, 100)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(167, 100)); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], tmpIdx); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 4); } @@ -5261,14 +5261,14 @@ void Scene361::handleRoxAction() { case 4: { _scene->_sequences.remove(_globals._sequenceIndexes[1]); _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 2); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); int tmpIdx = _globals._sequenceIndexes[4]; _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 12, 1, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[4], 11, 15); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(167, 100)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(167, 100)); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], tmpIdx); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 5); } @@ -5278,7 +5278,7 @@ void Scene361::handleRoxAction() { int tmpIdx = _globals._sequenceIndexes[4]; _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 16); _scene->_sequences.setMsgLayout(_globals._sequenceIndexes[4]); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(167, 100)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(167, 100)); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], tmpIdx); _scene->_sequences.addTimer(48, 6); } @@ -5289,7 +5289,7 @@ void Scene361::handleRoxAction() { _scene->_sequences.remove(_globals._sequenceIndexes[1]); _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); _scene->_sequences.addTimer(48, 7); break; @@ -5313,7 +5313,7 @@ void Scene361::enter() { _globals._spriteIndexes[4] = _scene->_sprites.addSprites("*ROXCL_8"); _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 15); if (_scene->_priorSceneId == 391) { @@ -5345,7 +5345,7 @@ void Scene361::step() { case 70: _scene->_sequences.remove(_globals._sequenceIndexes[1]); _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 2); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); @@ -5363,7 +5363,7 @@ void Scene361::step() { case 72: _scene->_sequences.remove(_globals._sequenceIndexes[1]); _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 3); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); _scene->_sequences.setDone(_globals._sequenceIndexes[3]); @@ -5399,7 +5399,7 @@ void Scene361::step() { case 76: _scene->_sequences.remove(_globals._sequenceIndexes[1]); _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 2); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); _scene->_sequences.setDone(_globals._sequenceIndexes[3]); @@ -5411,7 +5411,7 @@ void Scene361::step() { case 77: _scene->_sequences.remove(_globals._sequenceIndexes[1]); _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(165, 76)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 15); _scene->_sequences.setDone(_globals._sequenceIndexes[3]); diff --git a/engines/mads/nebular/nebular_scenes4.cpp b/engines/mads/nebular/nebular_scenes4.cpp index cb5363bd65..b1b2b098af 100644 --- a/engines/mads/nebular/nebular_scenes4.cpp +++ b/engines/mads/nebular/nebular_scenes4.cpp @@ -887,7 +887,7 @@ void Scene402::enter() { if (!_game._objects.isInInventory(OBJ_REPAIR_LIST)) { _globals._sequenceIndexes[14] = _scene->_sequences.startCycle(_globals._spriteIndexes[14], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[14], 7); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[14], Common::Point(210, 80)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[14], Common::Point(210, 80)); int idx = _scene->_dynamicHotspots.add(NOUN_REPAIR_LIST, 0xD1, _globals._sequenceIndexes[14], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(0, 0), FACING_NONE); } @@ -902,14 +902,14 @@ void Scene402::enter() { if (!_game._objects.isInRoom(OBJ_ALIEN_LIQUOR) && !_game._objects.isInInventory(OBJ_CREDIT_CHIP)) { _globals._sequenceIndexes[15] = _scene->_sequences.startCycle(_globals._spriteIndexes[15], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[15], 8); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[15], Common::Point(250, 80)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[15], Common::Point(250, 80)); int idx = _scene->_dynamicHotspots.add(NOUN_CREDIT_CHIP, 0x4, _globals._sequenceIndexes[15], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(0, 0), FACING_NONE); } _globals._sequenceIndexes[20] = _scene->_sequences.startCycle(_globals._spriteIndexes[20], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[20], 7); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[20], Common::Point(234, 72)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[20], Common::Point(234, 72)); if (_globals[kBottleDisplayed]) { _globals._sequenceIndexes[8] = _scene->_sequences.startCycle(_globals._spriteIndexes[8], false, 4); @@ -1021,7 +1021,7 @@ void Scene402::step() { case 21: _globals._sequenceIndexes[15] = _scene->_sequences.startCycle(_globals._spriteIndexes[15], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[15], 8); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[15], Common::Point(250, 80)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[15], Common::Point(250, 80)); break; default: @@ -1106,7 +1106,7 @@ void Scene402::step() { case 21: { _globals._sequenceIndexes[15] = _scene->_sequences.startCycle(_globals._spriteIndexes[15], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[15], 8); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[15], Common::Point(250, 80)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[15], Common::Point(250, 80)); int idx = _scene->_dynamicHotspots.add(NOUN_CREDIT_CHIP, 0x4, _globals._sequenceIndexes[15], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(0, 0), FACING_NONE); } @@ -1678,7 +1678,7 @@ void Scene402::step() { _scene->_sequences.addSubEntry(_globals._sequenceIndexes[13], SEQUENCE_TRIGGER_EXPIRE, 0, 60); _globals._sequenceIndexes[20] = _scene->_sequences.startCycle(_globals._spriteIndexes[20], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[20], 8); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[20], Common::Point(234, 72)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[20], Common::Point(234, 72)); } break; @@ -1937,7 +1937,7 @@ void Scene402::step() { _globals._sequenceIndexes[20] = _scene->_sequences.startCycle(_globals._spriteIndexes[20], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[20], 8); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[20], Common::Point(234, 72)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[20], Common::Point(234, 72)); } if (_game._trigger == 85) { @@ -2204,7 +2204,7 @@ void Scene402::actions() { _game._player._visible = false; _globals._sequenceIndexes[22] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[22], false, 7, 2, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[22], 1, 2); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[22], Common::Point(_game._player._playerPos.x, _game._player._playerPos.y + 1)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[22], Common::Point(_game._player._playerPos.x, _game._player._playerPos.y + 1)); _scene->_sequences.setDepth(_globals._sequenceIndexes[22], 5); _scene->_sequences.setScale(_globals._sequenceIndexes[22], 88); _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; @@ -2499,7 +2499,7 @@ void Scene405::actions() { _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 2); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 75); Common::Point msgPos = Common::Point(_game._player._playerPos.x, _game._player._playerPos.y + 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[3], msgPos); + _scene->_sequences.setPosition(_globals._sequenceIndexes[3], msgPos); _scene->_sequences.setScale(_globals._sequenceIndexes[3], 87); } else if ((_action.isAction(VERB_PUT, NOUN_SECURITY_CARD, 0x251) || _action.isAction(VERB_CLOSE, NOUN_WIDE_DOOR)) && _globals[kArmoryDoorOpen]) { _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; @@ -2508,7 +2508,7 @@ void Scene405::actions() { _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 7, 2, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 2); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 70); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[3], _game._player._playerPos); + _scene->_sequences.setPosition(_globals._sequenceIndexes[3], _game._player._playerPos); _scene->_sequences.setScale(_globals._sequenceIndexes[3], 87); } else if (_action.isAction(VERB_PUT, NOUN_CARD_SLOT)) { _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; @@ -2517,7 +2517,7 @@ void Scene405::actions() { _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 7, 2, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[3], 1, 2); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 80); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[3], _game._player._playerPos); + _scene->_sequences.setPosition(_globals._sequenceIndexes[3], _game._player._playerPos); _scene->_sequences.setScale(_globals._sequenceIndexes[3], 87); } else if (_action.isAction(VERB_LOOK, NOUN_CANNON_BALLS)) _vm->_dialogs->show(40510); @@ -2707,7 +2707,7 @@ void Scene406::actions() { _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 2); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 75); Common::Point msgPos = Common::Point(_game._player._playerPos.x, _game._player._playerPos.y + 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], msgPos); + _scene->_sequences.setPosition(_globals._sequenceIndexes[2], msgPos); _scene->_sequences.setScale(_globals._sequenceIndexes[2], 87); } else if (_action.isAction(VERB_PUT, NOUN_SECURITY_CARD, 0x251) && _globals[kStorageDoorOpen]) { _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; @@ -2717,7 +2717,7 @@ void Scene406::actions() { _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 2); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 70); Common::Point msgPos = Common::Point(_game._player._playerPos.x, _game._player._playerPos.y + 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], msgPos); + _scene->_sequences.setPosition(_globals._sequenceIndexes[2], msgPos); _scene->_sequences.setScale(_globals._sequenceIndexes[2], 87); } else if (_action.isAction(VERB_PUT, NOUN_CARD_SLOT)) { _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; @@ -2726,7 +2726,7 @@ void Scene406::actions() { _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], false, 7, 2, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[2], 1, 2); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[2], SEQUENCE_TRIGGER_EXPIRE, 0, 110); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[2], _game._player._playerPos); + _scene->_sequences.setPosition(_globals._sequenceIndexes[2], _game._player._playerPos); _scene->_sequences.setScale(_globals._sequenceIndexes[2], 87); } else if (_action.isAction(VERB_LOOK, NOUN_TRASH)) _vm->_dialogs->show(40610); diff --git a/engines/mads/nebular/nebular_scenes6.cpp b/engines/mads/nebular/nebular_scenes6.cpp index 9413350c27..1821a72c16 100644 --- a/engines/mads/nebular/nebular_scenes6.cpp +++ b/engines/mads/nebular/nebular_scenes6.cpp @@ -1608,20 +1608,20 @@ void Scene608::setCarAnimations() { _scene->freeAnimation(); if (_globals[kCarStatus] == 0) { _globals._sequenceIndexes[6] = _scene->_sequences.startCycle(_globals._spriteIndexes[6], false, 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[6], Common::Point(143, 98)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[6], Common::Point(143, 98)); _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 6); _globals._sequenceIndexes[7] = _scene->_sequences.startCycle(_globals._spriteIndexes[7], false, 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[7], Common::Point(141, 67)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[7], Common::Point(141, 67)); _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 15); } else { _globals._sequenceIndexes[6] = _scene->_sequences.startCycle(_globals._spriteIndexes[6], false, 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[6], Common::Point(143, 128)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[6], Common::Point(143, 128)); _scene->_sequences.setDepth(_globals._sequenceIndexes[6], 6); _globals._sequenceIndexes[7] = _scene->_sequences.startCycle(_globals._spriteIndexes[7], false, 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[7], Common::Point(141, 97)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[7], Common::Point(141, 97)); _scene->_sequences.setDepth(_globals._sequenceIndexes[7], 15); _globals._sequenceIndexes[8] = _scene->_sequences.startCycle(_globals._spriteIndexes[8], false, 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[8], Common::Point(144, 126)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[8], Common::Point(144, 126)); _scene->_sequences.setDepth(_globals._sequenceIndexes[8], 5); } } @@ -2613,7 +2613,7 @@ void Scene609::step() { if (!_globals[kHasTalkedToHermit] && (_game._difficulty != DIFFICULTY_HARD)) { _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 26, 2, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 7); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[3], Common::Point(287, 73)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[3], Common::Point(287, 73)); _scene->_sequences.setScale(_globals._sequenceIndexes[3], 47); } _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1); @@ -2636,7 +2636,7 @@ void Scene609::step() { if (!_globals[kHasTalkedToHermit]) { _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 26, 2, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 7); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[3], Common::Point(287, 73)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[3], Common::Point(287, 73)); _scene->_sequences.setScale(_globals._sequenceIndexes[3], 47); } _scene->_sequences.remove(_globals._sequenceIndexes[1]); diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index 585271cfda..9383492391 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -141,7 +141,7 @@ void Scene701::enter() { } _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); int boatStatus = (_scene->_priorSceneId == 703) ? BOAT_GONE : _globals[kBoatStatus]; @@ -182,7 +182,7 @@ void Scene701::enter() { _game._player._visible = false; _game._player._stepEnabled = false; _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[5], Common::Point(155, 129)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[5], Common::Point(155, 129)); _scene->_sequences.addTimer(15, 60); } else if (_scene->_priorSceneId == 703) { _game._player._playerPos = Common::Point(231, 127); @@ -207,7 +207,7 @@ void Scene701::step() { case 60: _scene->_sequences.remove(_globals._sequenceIndexes[5]); _globals._sequenceIndexes[5] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[5], false, 6, 1, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[5], Common::Point(155, 129)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[5], Common::Point(155, 129)); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 61); break; @@ -221,7 +221,7 @@ void Scene701::step() { _vm->_sound->command(16); _scene->_sequences.remove(_globals._sequenceIndexes[1]); _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 5, 1, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 71); break; @@ -234,7 +234,7 @@ void Scene701::step() { case 72: _vm->_sound->command(17); _globals._sequenceIndexes[1] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 5, 1, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 73); break; @@ -242,7 +242,7 @@ void Scene701::step() { case 73: _game._player._stepEnabled = true; _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); _scene->_kernelMessages.reset(); break; @@ -285,14 +285,14 @@ void Scene701::actions() { _game._player._stepEnabled = false; _game._player._visible = false; _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 6, 1, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[5], Common::Point(155, 129)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[5], Common::Point(155, 129)); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5], SEQUENCE_TRIGGER_EXPIRE, 0, 1); break; case 1: { int temp = _globals._sequenceIndexes[5]; _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, -2); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[5], Common::Point(155, 129)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[5], Common::Point(155, 129)); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[5], temp); _scene->_sequences.addTimer(15, 2); } @@ -312,7 +312,7 @@ void Scene701::actions() { _scene->_sequences.remove(_globals._sequenceIndexes[1]); _vm->_sound->command(16); _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 5, 1, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); _scene->_kernelMessages.reset(); _scene->_kernelMessages.add(Common::Point(0, 0), 0x310, 34, 0, 120, _game.getQuote(0x30D)); @@ -327,14 +327,14 @@ void Scene701::actions() { case 3: _vm->_sound->command(17); _globals._sequenceIndexes[1] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 5, 1, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 4); break; case 4: _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); _globals[kResurrectRoom] = 701; _scene->_nextSceneId = 605; @@ -1221,10 +1221,10 @@ void Scene704::enter() { _globals._sequenceIndexes[1] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 6, 0, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); if (_scene->_priorSceneId == 705) { - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(123, 125)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(123, 125)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); } else { - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(190, 122)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(190, 122)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 2); } int idx = _scene->_dynamicHotspots.add(NOUN_BONES, 0xD1, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); @@ -1250,7 +1250,7 @@ void Scene704::enter() { _scene->_activeAnimation->setCurrentFrame(8); } else if (_boatDirection == 2) { if (_game._objects[OBJ_BOTTLE]._roomNumber == _scene->_currentSceneId) { - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(123, 125)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(123, 125)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 1); } _scene->loadAnimation(formAnimName('A', -1)); @@ -1812,7 +1812,7 @@ void Scene706::handleTakeVase() { if (_vaseMode == 1) { _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 4); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(195, 99)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(195, 99)); int idx = _scene->_dynamicHotspots.add(NOUN_BOTTLE, VERB_WALKTO, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(175, 124), FACING_SOUTHEAST); _game._objects.setRoom(OBJ_BOTTLE, _scene->_currentSceneId); @@ -1844,7 +1844,7 @@ void Scene706::enter() { } else if (_game._objects.isInRoom(OBJ_BOTTLE)) { _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 4); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(195, 99)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(195, 99)); int idx = _scene->_dynamicHotspots.add(NOUN_BOTTLE, VERB_WALKTO, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(175, 124), FACING_SOUTHEAST); } @@ -1918,7 +1918,7 @@ void Scene706::step() { _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 4); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(195, 99)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(195, 99)); int idx = _scene->_dynamicHotspots.add(NOUN_BOTTLE, VERB_WALKTO, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(175, 124), FACING_SOUTHEAST); } @@ -2199,7 +2199,7 @@ void Scene751::enter() { } _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); if (_scene->_priorSceneId == 752) { @@ -2211,7 +2211,7 @@ void Scene751::enter() { _game._player._visible = false; _game._player._stepEnabled = false; _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, -2); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(155, 129)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(155, 129)); _scene->_sequences.addTimer(15, 70); } else if (_scene->_priorSceneId != -2) { _game._player._playerPos = Common::Point(22, 131); @@ -2249,7 +2249,7 @@ void Scene751::step() { case 70: _scene->_sequences.remove(_globals._sequenceIndexes[4]); _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 6, 1, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(155, 129)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(155, 129)); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 71); break; @@ -2275,7 +2275,7 @@ void Scene751::step() { _vm->_sound->command(16); _scene->_sequences.remove(_globals._sequenceIndexes[1]); _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 5, 1, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 61); break; @@ -2288,14 +2288,14 @@ void Scene751::step() { case 62: _vm->_sound->command(17); _globals._sequenceIndexes[1] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 5, 1, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 63); break; case 63: _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); _game._player._stepEnabled = true; _scene->_kernelMessages.reset(); @@ -2357,14 +2357,14 @@ void Scene751::actions() { _game._player._stepEnabled = false; _game._player._visible = false; _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 6, 1, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(155, 129)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(155, 129)); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 1); break; case 1: { int syncIdx = _globals._sequenceIndexes[4]; _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, -2); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(155, 129)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(155, 129)); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[4], syncIdx); _scene->_sequences.addTimer(15, 2); } @@ -2384,7 +2384,7 @@ void Scene751::actions() { _scene->_sequences.remove(_globals._sequenceIndexes[1]); _vm->_sound->command(16); _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 5, 1, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); _scene->_kernelMessages.reset(); _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x30D)); @@ -2399,14 +2399,14 @@ void Scene751::actions() { case 3: _vm->_sound->command(17); _globals._sequenceIndexes[1] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 5, 1, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 4); break; case 4: _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); _scene->_sequences.addTimer(60, 5); break; diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index 6f9a46d655..c0f24a78fc 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -911,7 +911,7 @@ void Scene804::enter() { _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(133, 139)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(133, 139)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 8); } @@ -931,7 +931,7 @@ void Scene804::step() { if ((_throttleGone) && (_movingThrottle) && (_scene->_activeAnimation->getCurrentFrame() == 39)) { _globals._sequenceIndexes[1] = _scene->_sequences.startCycle (_globals._spriteIndexes[1], false, 1); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[1], Common::Point(133, 139)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(133, 139)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 8); _throttleGone = false; } @@ -1329,7 +1329,7 @@ void Scene808::actions() { case 0: _game._player._stepEnabled = false; _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 4, 1, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(248, 211)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(248, 211)); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 2); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 70); break; @@ -1343,7 +1343,7 @@ void Scene808::actions() { _vm->_sound->command(25); } _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 4, 1, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(248, 211)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(248, 211)); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 2); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 71); break; @@ -1365,7 +1365,7 @@ void Scene808::actions() { case 0: _game._player._stepEnabled = false; _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 4, 1, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(248, 186)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(248, 186)); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 2); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 90); break; @@ -1378,7 +1378,7 @@ void Scene808::actions() { } _globals[kTopButtonPushed] = false; _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 4, 1, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(248, 186)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(248, 186)); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 2); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 91); break; @@ -1395,7 +1395,7 @@ void Scene808::actions() { case 0: _game._player._stepEnabled = false; _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 4, 1, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(248, 163)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(248, 163)); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 2); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 80); break; @@ -1409,7 +1409,7 @@ void Scene808::actions() { } _globals[kTopButtonPushed] = true; _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 4, 1, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(248, 163)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(248, 163)); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 2); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 81); break; @@ -1426,7 +1426,7 @@ void Scene808::actions() { case 0: _game._player._stepEnabled = false; _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 4, 2, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(168, 211)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(168, 211)); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 2); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 70); break; @@ -1443,7 +1443,7 @@ void Scene808::actions() { case 0: _game._player._stepEnabled = false; _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 4, 2, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(172, 163)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(172, 163)); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 2); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 80); break; @@ -1460,7 +1460,7 @@ void Scene808::actions() { case 0: _game._player._stepEnabled = false; _globals._sequenceIndexes[4] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[4], false, 4, 2, 0, 0); - _scene->_sequences.setMsgPosition(_globals._sequenceIndexes[4], Common::Point(172, 186)); + _scene->_sequences.setPosition(_globals._sequenceIndexes[4], Common::Point(172, 186)); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 2); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[4], SEQUENCE_TRIGGER_EXPIRE, 0, 90); break; diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index a7c6dedb12..e0efc7cf03 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -123,8 +123,8 @@ int SequenceList::add(int spriteListIndex, bool flipped, int frameIndex, int tri _entries[seqIndex]._depth = depth; _entries[seqIndex]._scale = scale; _entries[seqIndex]._nonFixed = nonFixed; - _entries[seqIndex]._msgPos.x = msgX; - _entries[seqIndex]._msgPos.y = msgY; + _entries[seqIndex]._position.x = msgX; + _entries[seqIndex]._position.y = msgY; _entries[seqIndex]._numTicks = numTicks; _entries[seqIndex]._extraTicks = extraTicks; @@ -192,7 +192,7 @@ void SequenceList::setSpriteSlot(int seqIndex, SpriteSlot &spriteSlot) { spriteSlot._scale = timerEntry._scale; if (!timerEntry._nonFixed) { - spriteSlot._position = timerEntry._msgPos; + spriteSlot._position = timerEntry._position; } else { MSprite *sprite = spriteSet.getFrame(timerEntry._frameIndex - 1); spriteSlot._position = sprite->_offset; @@ -231,14 +231,14 @@ bool SequenceList::loadSprites(int seqIndex) { seqEntry._field20 += seqEntry._field18; if (seqEntry._field20 >= 100) { int v = seqEntry._field20 / 100; - seqEntry._msgPos.x += v * seqEntry._field1C; + seqEntry._position.x += v * seqEntry._field1C; seqEntry._field20 -= v * 100; } seqEntry._field22 += seqEntry._field1A; if (seqEntry._field22 >= 100) { int v = seqEntry._field22 / 100; - seqEntry._msgPos.y += v * seqEntry._field1E; + seqEntry._position.y += v * seqEntry._field1E; seqEntry._field22 -= v * 100; } } @@ -424,8 +424,8 @@ void SequenceList::setDepth(int seqIndex, int depth) { _entries[seqIndex]._depth = depth; } -void SequenceList::setMsgPosition(int seqIndex, const Common::Point &pt) { - _entries[seqIndex]._msgPos = pt; +void SequenceList::setPosition(int seqIndex, const Common::Point &pt) { + _entries[seqIndex]._position = pt; _entries[seqIndex]._nonFixed = false; } @@ -497,7 +497,7 @@ void SequenceList::setScale(int spriteIdx, int scale) { void SequenceList::setMsgLayout(int seqIndex) { Player &player = _vm->_game->_player; int yp = player._playerPos.y + (player._centerOfGravity * player._currentScale) / 100; - setMsgPosition(seqIndex, Common::Point(player._playerPos.x, yp)); + setPosition(seqIndex, Common::Point(player._playerPos.x, yp)); setDepth(seqIndex, player._currentDepth); setScale(seqIndex, player._currentScale); updateTimeout(-1, seqIndex); @@ -508,4 +508,11 @@ void SequenceList::setDone(int seqIndex) { _entries[seqIndex]._timeout = _vm->_game->_player._priorTimer; } +void SequenceList::setMotion(int seqIndex, int flags, int deltaX, int deltaY) { + warning("TODO: setMotion()"); + // HACK: Just offset by the delta for now + _entries[seqIndex]._position.x += deltaX; + _entries[seqIndex]._position.y += deltaY; +} + } // End of namespace diff --git a/engines/mads/sequence.h b/engines/mads/sequence.h index b23f595e74..71460ea4f6 100644 --- a/engines/mads/sequence.h +++ b/engines/mads/sequence.h @@ -68,7 +68,7 @@ struct SequenceEntry { bool _nonFixed; uint32 _flags; - Common::Point _msgPos; + Common::Point _position; int _field18; int _field1A; int _field1C; @@ -113,7 +113,7 @@ public: void setAnimRange(int seqIndex, int startVal, int endVal); void scan(); void setDepth(int seqIndex, int depth); - void setMsgPosition(int seqIndex, const Common::Point &pt); + void setPosition(int seqIndex, const Common::Point &pt); int addSpriteCycle(int srcSpriteIdx, bool flipped, int numTicks, int triggerCountdown = 0, int timeoutTicks = 0, int extraTicks = 0); int addReverseSpriteCycle(int srcSpriteIdx, bool flipped, int numTicks, @@ -126,12 +126,7 @@ public: void setScale(int spriteIdx, int scale); void setMsgLayout(int seqIndex); void setDone(int seqIndex); - void setMotion(int seqIndex, int flags, int deltaX, int deltaY) { - warning("TODO: setMotion()"); - // HACK: Just offset by the delta for now - _entries[seqIndex]._msgPos.x += deltaX; - _entries[seqIndex]._msgPos.y += deltaY; - } + void setMotion(int seqIndex, int flags, int deltaX, int deltaY); }; } // End of namespace MADS -- cgit v1.2.3 From 690d95640386e927a8767823edb2d1a594f26104 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 24 May 2014 19:25:31 -0400 Subject: MADS: Properly implement sequence entry object movement --- engines/mads/sequence.cpp | 59 +++++++++++++++++++++++++++++------------------ engines/mads/sequence.h | 9 +++----- 2 files changed, 40 insertions(+), 28 deletions(-) diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp index e0efc7cf03..6461102a5e 100644 --- a/engines/mads/sequence.cpp +++ b/engines/mads/sequence.cpp @@ -39,12 +39,6 @@ SequenceEntry::SequenceEntry() { _depth = 0; _scale = 0; _dynamicHotspotIndex = -1; - _field18 = 0; - _field1A = 0; - _field1C = 0; - _field1E = 0; - _field20 = 0; - _field22 = 0; _triggerCountdown = 0; _doneFlag = 0; _triggerMode = SEQUENCE_TRIGGER_DAEMON; @@ -226,26 +220,27 @@ bool SequenceList::loadSprites(int seqIndex) { int height = frame->getHeight() * seqEntry._scale / 100; Common::Point pt = spriteSlot._position; - // ToDO: Find out the proper meanings of the following fields + // Handle sprite movement, if present if (seqEntry._flags & 1) { - seqEntry._field20 += seqEntry._field18; - if (seqEntry._field20 >= 100) { - int v = seqEntry._field20 / 100; - seqEntry._position.x += v * seqEntry._field1C; - seqEntry._field20 -= v * 100; + seqEntry._posAccum.x += seqEntry._posDiff.x; + if (seqEntry._posAccum.x >= 100) { + int v = seqEntry._posAccum.x / 100; + seqEntry._position.x += v * seqEntry._posSign.x; + seqEntry._posAccum.x -= v * 100; } - seqEntry._field22 += seqEntry._field1A; - if (seqEntry._field22 >= 100) { - int v = seqEntry._field22 / 100; - seqEntry._position.y += v * seqEntry._field1E; - seqEntry._field22 -= v * 100; + seqEntry._posAccum.y += seqEntry._posDiff.y; + if (seqEntry._posAccum.y >= 100) { + int v = seqEntry._posAccum.y / 100; + seqEntry._position.y += v * seqEntry._posSign.y; + seqEntry._posAccum.y -= v * 100; } } if (seqEntry._flags & 2) { + // Check for object having moved off-scren if ((pt.x + width) < 0 || (pt.x + width) >= MADS_SCREEN_WIDTH || - pt.y < 0 || (pt.y + height) >= MADS_SCENE_HEIGHT) { + pt.y < 0 || (pt.y - height) >= MADS_SCENE_HEIGHT) { result = true; seqEntry._doneFlag = true; } @@ -509,10 +504,30 @@ void SequenceList::setDone(int seqIndex) { } void SequenceList::setMotion(int seqIndex, int flags, int deltaX, int deltaY) { - warning("TODO: setMotion()"); - // HACK: Just offset by the delta for now - _entries[seqIndex]._position.x += deltaX; - _entries[seqIndex]._position.y += deltaY; + SequenceEntry &se = _entries[seqIndex]; + se._flags = flags | 1; + + // Set the direction sign for movement + if (deltaX > 0) { + se._posSign.x = 1; + } else if (deltaX < 0) { + se._posSign.x = -1; + } else { + se._posSign.x = 0; + } + + if (deltaY > 0) { + se._posSign.y = 1; + } + else if (deltaY < 0) { + se._posSign.y = -1; + } else { + se._posSign.y = 0; + } + + se._posDiff.x = ABS(deltaX); + se._posDiff.y = ABS(deltaY); + se._posAccum.x = se._posAccum.y = 0; } } // End of namespace diff --git a/engines/mads/sequence.h b/engines/mads/sequence.h index 71460ea4f6..ee587ff02d 100644 --- a/engines/mads/sequence.h +++ b/engines/mads/sequence.h @@ -69,12 +69,9 @@ struct SequenceEntry { uint32 _flags; Common::Point _position; - int _field18; - int _field1A; - int _field1C; - int _field1E; - int _field20; - int _field22; + Common::Point _posDiff; + Common::Point _posSign; + Common::Point _posAccum; int _triggerCountdown; bool _doneFlag; SequenceSubEntries _entries; -- cgit v1.2.3 From f7443424981a78280dab9b2e3a0cb47790078f71 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 24 May 2014 21:19:48 -0400 Subject: MADS: Fix showing wait cursor when scene changes --- engines/mads/player.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index a9bc0cd485..077771306e 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -414,7 +414,7 @@ void Player::move() { _walkOffScreen = _walkOffScreenSceneId; _walkAnywhere = true; _walkOffScreenSceneId = 0; - _stepEnabled = true; + _stepEnabled = false; newFacing = false; } -- cgit v1.2.3 From 3ca0f88e1f1539251cb2955cdb9eb532d105829f Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 25 May 2014 09:00:44 +0300 Subject: FULLPIPE: Fix MovGraph::calcMovItems() --- engines/fullpipe/motion.cpp | 12 ++++++------ engines/fullpipe/motion.h | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index af615cd95a..b4abe60a36 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -1176,7 +1176,7 @@ void MovGraph::shuffleTree(MovGraphLink *lnk, MovGraphLink *lnk2, Common::Array< } } -Common::Array *MovGraph::getBboxes(MovArr *movarr1, MovArr *movarr2, int *listCount) { +Common::Array *MovGraph::calcMovItems(MovArr *movarr1, MovArr *movarr2, int *listCount) { Common::Array tempObList1; Common::Array tempObList2; @@ -1189,12 +1189,12 @@ Common::Array *MovGraph::getBboxes(MovArr *movarr1, MovArr *mova *listCount = tempObList2.size(); - Common::Array *res = new Common::Array; + Common::Array *res = new Common::Array; for (int i = 0; i < *listCount; i++) { - Common::Rect *r = new Common::Rect; + MovItem *r = new MovItem; - calcBbox(r, tempObList2[i], movarr1, movarr2); + genMovItem(r, tempObList2[i], movarr1, movarr2); delete tempObList2[i]; } @@ -1204,8 +1204,8 @@ Common::Array *MovGraph::getBboxes(MovArr *movarr1, MovArr *mova return res; } -void MovGraph::calcBbox(Common::Rect *rect, MovGraphLink *grlink, MovArr *movarr1, MovArr *movarr2) { - warning("STUB: MovGraph::calcBbox()"); +void MovGraph::genMovItem(MovItem *movitem, MovGraphLink *grlink, MovArr *movarr1, MovArr *movarr2) { + warning("STUB: MovGraph::genMovItem()"); } bool MovGraph::calcChunk(int idx, int x, int y, MovArr *arr, int a6) { diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index 3aa07c143e..2765cc3118 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -371,8 +371,8 @@ public: int getItemIndexByStaticAni(StaticANIObject *ani); Common::Array *genMovArr(int x, int y, int *arrSize, int flag1, int flag2); void shuffleTree(MovGraphLink *lnk, MovGraphLink *lnk2, Common::Array &tempObList1, Common::Array &tempObList2); - Common::Array *getBboxes(MovArr *movarr1, MovArr *movarr2, int *listCount); - void calcBbox(Common::Rect *rect, MovGraphLink *grlink, MovArr *movarr1, MovArr *movarr2); + Common::Array *calcMovItems(MovArr *movarr1, MovArr *movarr2, int *listCount); + void genMovItem(MovItem *movitem, MovGraphLink *grlink, MovArr *movarr1, MovArr *movarr2); bool calcChunk(int idx, int x, int y, MovArr *arr, int a6); MessageQueue *sub1(StaticANIObject *ani, int x, int y, int a5, int x1, int y1, int a8, int a9); MessageQueue *fillMGMinfo(StaticANIObject *ani, MovArr *movarr, int staticsId); -- cgit v1.2.3 From 99b376afe73ed84d9229265bb8924d89fb993b5e Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 25 May 2014 09:32:28 +0300 Subject: FULLPIPE: Start MovGraph::sub1() implementation --- engines/fullpipe/motion.cpp | 62 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index b4abe60a36..ad86805bba 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -817,7 +817,67 @@ MessageQueue *MovGraph::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int return 0; } -MessageQueue *MovGraph::sub1(StaticANIObject *ani, int x, int y, int a5, int x1, int y1, int a8, int a9) { +MessageQueue *MovGraph::sub1(StaticANIObject *ani, int x, int y, int stid, int x1, int y1, int a8, int flag1) { +#if 0 + PicAniInfo picinfo; + + ani->getPicAniInfo(&picinfo); + + ani->_statics = ani->getStaticsById(stid); + ani->_movement = 0; + ani->setOXY(x, y); + + int rescount; + + MovItem *movitem = method28(ani, x1, y1, flag1, &rescount); + + if (!movitem) { + ani->setPicAniInfo(&picinfo); + + return 0; + } + + v13 = _callback1(ani, movitem, rescount); + v14 = MovGraph_getItemIndexByStaticAni(this, ani); + v15 = v14 << 6; + v16 = 0; + + movgitem = _items[v14]; + v18 = movgitem->count; + + if (v18 > 0) { + v19 = movgitem->movitems; + while (v19->movarr != v13) { + ++v16; + ++v19; + if (v16 >= v18) + goto LABEL_6; + } + v21 = v16; + v22 = movgitem->movitems[v21].movarr; + v23 = movgitem->movarr._movSteps; + movarr = movgitem->movitems[v21].movarr; + + if (v23) + CObjectFree(v23); + + memcpy((char *)&this->_items->movarr + v15, v22, 0x20u); + *(MovStep **)((char *)&this->_items->movarr._movSteps + v15) = (MovStep *)operator new(8 * movarr->_movStepCount); + memcpy(*(void **)((char *)&this->_items->movarr._movSteps + v15), movarr->_movSteps, 8 * movarr->_movStepCount); + *(int *)((char *)&this->_items->movarr._afield_8 + v15) = -1; + *(MovGraphLink **)((char *)&this->_items->movarr._link + v15) = 0; + v24 = fillMGMinfo(*(StaticANIObject **)((char *)&this->_items->ani + v15), (MovArr *)((char *)&this->_items->movarr + v15), a8); + + result = v24; + } else { + LABEL_6: + result = 0; + } + + ani->setPicAniInfo(&picinfo); + + return result; +#endif warning("STUB: *MovGraph::sub1()"); return 0; -- cgit v1.2.3 From 6cf5cb939b8452bb924946529d955469e73a7a0c Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sun, 25 May 2014 12:29:13 +0200 Subject: GUI: Fix compilation This adds a missing header in the case #ifndef USE_TEXT_CONSOLE_FOR_DEBUGGER --- gui/debugger.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/gui/debugger.cpp b/gui/debugger.cpp index 3cfa9f9803..d14b786e33 100644 --- a/gui/debugger.cpp +++ b/gui/debugger.cpp @@ -23,6 +23,7 @@ // NB: This is really only necessary if USE_READLINE is defined #define FORBIDDEN_SYMBOL_ALLOW_ALL +#include "common/debug.h" #include "common/debug-channels.h" #include "common/system.h" -- cgit v1.2.3 From b0f1c28c7913198a1a3685498512c066b57a3b44 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sun, 25 May 2014 12:52:42 +0200 Subject: SCI: Fix voice mapping during midi channel remapping This fixes the first Patti dream sequence piano song in LSL5 room 320. --- engines/sci/sound/music.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/engines/sci/sound/music.cpp b/engines/sci/sound/music.cpp index 97675a140e..606d81357c 100644 --- a/engines/sci/sound/music.cpp +++ b/engines/sci/sound/music.cpp @@ -1169,8 +1169,12 @@ ChannelRemapping *SciMusic::determineChannelMap() { int neededVoices = channel._voices; // do we have enough free voices? - // We only care for essential channels - if (map->_freeVoices < neededVoices && prio > 0) { + if (map->_freeVoices < neededVoices) { + // We only care for essential channels + if (prio > 0) { + debug(" not enough voices; need %d, have %d. Skipping this channel.", neededVoices, map->_freeVoices); + continue; + } do { int j = map->lowestPrio(); if (j == -1) { -- cgit v1.2.3 From 0ba17d909a0f816e1d48d0aa4972a719329d748d Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Sun, 25 May 2014 12:59:39 +0200 Subject: SCI: Make debugging output conditional --- engines/sci/sound/music.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/sci/sound/music.cpp b/engines/sci/sound/music.cpp index 606d81357c..933dc0635c 100644 --- a/engines/sci/sound/music.cpp +++ b/engines/sci/sound/music.cpp @@ -1172,7 +1172,9 @@ ChannelRemapping *SciMusic::determineChannelMap() { if (map->_freeVoices < neededVoices) { // We only care for essential channels if (prio > 0) { +#ifdef DEBUG_REMAP debug(" not enough voices; need %d, have %d. Skipping this channel.", neededVoices, map->_freeVoices); +#endif continue; } do { -- cgit v1.2.3 From de4060d4a170e2e60dabebcd485172f0b194b0a8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 25 May 2014 14:05:14 +0200 Subject: TUCKER: Skip the display of the intro and of the chapter number when a game is loaded from launcher --- engines/tucker/resource.cpp | 5 ++++- engines/tucker/sequences.cpp | 2 +- engines/tucker/tucker.cpp | 4 +++- engines/tucker/tucker.h | 1 + 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/engines/tucker/resource.cpp b/engines/tucker/resource.cpp index dd9d426cde..9cba7b523d 100644 --- a/engines/tucker/resource.cpp +++ b/engines/tucker/resource.cpp @@ -535,7 +535,10 @@ void TuckerEngine::loadObj() { return; } debug(2, "loadObj() partNum %d locationNum %d", _partNum, _locationNum); - if ((_gameFlags & kGameFlagDemo) == 0) { + // If a savegame is loaded from the launcher, skip the display chapter + if (_startSlot != -1) + _startSlot = -1; + else if ((_gameFlags & kGameFlagDemo) == 0) { handleNewPartSequence(); } _currentPartNum = _partNum; diff --git a/engines/tucker/sequences.cpp b/engines/tucker/sequences.cpp index 4a68c14eea..d9f284e443 100644 --- a/engines/tucker/sequences.cpp +++ b/engines/tucker/sequences.cpp @@ -40,7 +40,7 @@ void TuckerEngine::handleIntroSequence() { _player = new AnimationSequencePlayer(_system, _mixer, _eventMan, &_compressedSound, firstSequence); _player->mainLoop(); delete _player; - _player = 0; + _player = nullptr; } void TuckerEngine::handleCreditsSequence() { diff --git a/engines/tucker/tucker.cpp b/engines/tucker/tucker.cpp index 3b35fc65be..de555cd7b6 100644 --- a/engines/tucker/tucker.cpp +++ b/engines/tucker/tucker.cpp @@ -50,6 +50,7 @@ TuckerEngine::TuckerEngine(OSystem *system, Common::Language language, uint32 fl _currentSaveLoadGameState = 1; _fileLoadSize = 0; _csDataSize = 0; + _startSlot = ConfMan.hasKey("save_slot") ? ConfMan.getInt("save_slot") : -1; _player = nullptr; _loadTempBuf = nullptr; @@ -91,7 +92,8 @@ Common::Error TuckerEngine::run() { initGraphics(kScreenWidth, kScreenHeight, false); syncSoundSettings(); _compressedSound.openFile(); - handleIntroSequence(); + if (_startSlot == -1) + handleIntroSequence(); if ((_gameFlags & kGameFlagIntroOnly) == 0 && !shouldQuit()) { mainLoop(); } diff --git a/engines/tucker/tucker.h b/engines/tucker/tucker.h index adcd02b2fe..a423915a5f 100644 --- a/engines/tucker/tucker.h +++ b/engines/tucker/tucker.h @@ -613,6 +613,7 @@ protected: CompressedSound _compressedSound; Common::Language _gameLang; uint32 _gameFlags; + int _startSlot; bool _quitGame; bool _fastMode; -- cgit v1.2.3 From 4cc0add4a9a96cda367bdf5075af841a8cd2533c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 25 May 2014 10:35:05 -0400 Subject: MADS: Fix for multiple selection of actions not working --- engines/mads/action.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index df9da126e8..1db143aaad 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -84,7 +84,6 @@ void MADSAction::clear() { _action._objectNameId = -1; _action._indirectObjectId = -1; _textChanged = true; - _pickedWord = 0; } void MADSAction::appendVocab(int vocabId, bool capitalize) { -- cgit v1.2.3 From ce5c2f3e28cf7f7be5d2aa477d9610df04a126eb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 25 May 2014 10:58:51 -0400 Subject: MADS: Fix for player disappearing after throwing fish or burger --- engines/mads/nebular/nebular_scenes1.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index 1b875ae9fe..cd3b90089e 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -2738,7 +2738,7 @@ void Scene109::actions() { _scene->_spriteSlots.fullRefresh(); _scene->_sequences.scan(); if (_game._player._visible) { - _game._player._spritesChanged = true; + _game._player._forceRefresh = true; _game._player.update(); } -- cgit v1.2.3 From 26d5c3507a1c646965555e82364ab0618f5744da Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 25 May 2014 17:18:35 +0200 Subject: DRACI: Initialize a variable, some rework on the initialization of pointers and booleans --- engines/draci/game.cpp | 85 +++++++++++++++++++++++++------------------------- 1 file changed, 43 insertions(+), 42 deletions(-) diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp index e14ec4c986..4fbf2d31ea 100644 --- a/engines/draci/game.cpp +++ b/engines/draci/game.cpp @@ -50,45 +50,46 @@ enum { }; Game::Game(DraciEngine *vm) : _vm(vm), _walkingState(vm) { - uint i; - _dialogueLinesNum = 0; _blockNum = 0; - for (i = 0; i < kDialogueLines; i++) - _dialogueAnims[0] = 0; + for (uint i = 0; i < kDialogueLines; i++) + _dialogueAnims[0] = nullptr; _loopStatus = kStatusOrdinary; _loopSubstatus = kOuterLoop; - _shouldQuit = 0; - _shouldExitLoop = 0; - _isReloaded = 0; - _isPositionLoaded = 0; _speechTick = 0; _speechDuration = 0; - _objUnderCursor = 0; - _animUnderCursor = 0; _markedAnimationIndex = 0; _scheduledPalette = 0; _fadePhases = 0; _fadePhase = 0; _fadeTick = 0; - _isFadeOut = 1; _mouseChangeTick = 0; - _enableQuickHero = 0; - _wantQuickHero = 0; - _enableSpeedText = 0; - _titleAnim = 0; - _inventoryAnim = 0; - _walkingMapOverlay = 0; - _walkingShortestPathOverlay = 0; - _walkingObliquePathOverlay = 0; - _currentItem = 0; - _itemUnderCursor = 0; _previousItemPosition = 0; - for (i = 0; i < kInventorySlots; i++) - _inventory[i] = 0; + _shouldQuit = false; + _shouldExitLoop = false; + _isReloaded = false; + _isPositionLoaded = false; + _isFadeOut = true; + _enableQuickHero = false; + _wantQuickHero = false; + _enableSpeedText = false; + _isPositionLoaded = false; + + _objUnderCursor = nullptr; + _animUnderCursor = nullptr; + _titleAnim = nullptr; + _inventoryAnim = nullptr; + _walkingMapOverlay = nullptr; + _walkingShortestPathOverlay = nullptr; + _walkingObliquePathOverlay = nullptr; + _currentItem = nullptr; + _itemUnderCursor = nullptr; + + for (int i = 0; i < kInventorySlots; i++) + _inventory[i] = nullptr; _newRoom = 0; _newGate = 0; @@ -96,10 +97,10 @@ Game::Game(DraciEngine *vm) : _vm(vm), _walkingState(vm) { _pushedNewRoom = 0; _pushedNewGate = 0; _currentDialogue = 0; - _dialogueArchive = 0; - _dialogueBlocks = 0; - _dialogueBegin = 0; - _dialogueExit = 0; + _dialogueArchive = nullptr; + _dialogueBlocks = nullptr; + _dialogueBegin = false; + _dialogueExit = false; _currentBlock = 0; _lastBlock = 0; @@ -114,7 +115,7 @@ Game::Game(DraciEngine *vm) : _vm(vm), _walkingState(vm) { uint numPersons = file->_length / personSize; _persons = new Person[numPersons]; - for (i = 0; i < numPersons; ++i) { + for (uint i = 0; i < numPersons; ++i) { _persons[i]._x = personData.readUint16LE(); _persons[i]._y = personData.readUint16LE(); _persons[i]._fontColor = personData.readByte(); @@ -127,9 +128,9 @@ Game::Game(DraciEngine *vm) : _vm(vm), _walkingState(vm) { uint numDialogues = file->_length / sizeof(uint16); _dialogueOffsets = new uint[numDialogues]; - uint curOffset; - for (i = 0, curOffset = 0; i < numDialogues; ++i) { - _dialogueOffsets[i] = curOffset; + uint curOffset, idx; + for (idx = 0, curOffset = 0; idx < numDialogues; ++idx) { + _dialogueOffsets[idx] = curOffset; curOffset += dialogueData.readUint16LE(); } @@ -164,7 +165,7 @@ Game::Game(DraciEngine *vm) : _vm(vm), _walkingState(vm) { _variables = new int[numVariables]; Common::MemoryReadStream variableData(file->_data, file->_length); - for (i = 0; i < numVariables; ++i) { + for (uint i = 0; i < numVariables; ++i) { _variables[i] = variableData.readUint16LE(); } @@ -182,7 +183,7 @@ Game::Game(DraciEngine *vm) : _vm(vm), _walkingState(vm) { _objects = new GameObject[numObjects]; Common::MemoryReadStream objStatus(file->_data, file->_length); - for (i = 0; i < numObjects; ++i) { + for (uint i = 0; i < numObjects; ++i) { byte tmp = objStatus.readByte(); // Set object visibility @@ -252,14 +253,14 @@ void Game::init() { setLoopStatus(kStatusGate); setLoopSubstatus(kOuterLoop); - _animUnderCursor = NULL; + _animUnderCursor = nullptr; - _currentItem = _itemUnderCursor = NULL; + _currentItem = _itemUnderCursor = nullptr; _previousItemPosition = -1; _vm->_mouse->setCursorType(kHighlightedCursor); // anything different from kNormalCursor - _objUnderCursor = NULL; + _objUnderCursor = nullptr; // Set the inventory to empty initially memset(_inventory, 0, kInventorySlots * sizeof(GameItem *)); @@ -403,12 +404,12 @@ void Game::handleInventoryLoop() { // an overlay, for which we check. Item animations have their IDs // calculated by offseting their itemID from the ID of the last "special" // animation ID. In this way, we obtain its itemID. - if (_animUnderCursor != NULL && _animUnderCursor != _inventoryAnim && _animUnderCursor->getID() != kOverlayImage) { + if (_animUnderCursor != nullptr && _animUnderCursor != _inventoryAnim && _animUnderCursor->getID() != kOverlayImage) { _itemUnderCursor = getItem(kInventoryItemsID - _animUnderCursor->getID()); - assert(_itemUnderCursor != NULL); + assert(_itemUnderCursor != nullptr); assert(_itemUnderCursor->_anim == _animUnderCursor); } else { - _itemUnderCursor = NULL; + _itemUnderCursor = nullptr; } // If the user pressed the left mouse button @@ -825,7 +826,7 @@ void Game::removeItem(GameItem *item) { return; for (uint i = 0; i < kInventorySlots; ++i) { if (_inventory[i] == item) { - _inventory[i] = NULL; + _inventory[i] = nullptr; item->_anim->stop(); break; } @@ -932,7 +933,7 @@ void Game::inventoryDone() { _walkingState.callbackLast(); // Reset item under cursor - _itemUnderCursor = NULL; + _itemUnderCursor = nullptr; // Don't start the inventory mode again if the mouse is on the top. _mouseChangeTick = kMouseDoNotSwitch; @@ -1641,7 +1642,7 @@ void Game::DoSync(Common::Serializer &s, uint8 saveVersion) { _currentItem = getItem(handItemID); } } else { - _currentItem = 0; + _currentItem = nullptr; } } -- cgit v1.2.3 From 58fcb43c192eb424897a89dd18ea4788e83deb3f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 25 May 2014 17:38:28 +0200 Subject: CINE: Add a safeguard to avoid incrementing a null pointer --- engines/cine/gfx.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engines/cine/gfx.cpp b/engines/cine/gfx.cpp index f6419ecafc..b9175cac72 100644 --- a/engines/cine/gfx.cpp +++ b/engines/cine/gfx.cpp @@ -1902,7 +1902,9 @@ void maskBgOverlay(const byte *bgPtr, const byte *maskPtr, int16 width, int16 he destPtr++; srcPtr++; - maskPtr++; + + if (maskPtr) + maskPtr++; } } -- cgit v1.2.3 From ff569b0d2e6f4cbc33e1a9109b7198745d85bd10 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 25 May 2014 18:11:14 +0200 Subject: CINE: Add a safeguard to avoid a divide by zero in Palette::save() --- engines/cine/pal.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/cine/pal.cpp b/engines/cine/pal.cpp index f3985c691e..18f260cab7 100644 --- a/engines/cine/pal.cpp +++ b/engines/cine/pal.cpp @@ -332,9 +332,9 @@ byte *Palette::save(byte *buf, const uint size, const Graphics::PixelFormat form // Save the palette to the output in the specified format for (uint i = firstIndex; i < firstIndex + numColors; i++) { - const uint r = (_colors[i].r * rNewMax) / rOrigMax; - const uint g = (_colors[i].g * gNewMax) / gOrigMax; - const uint b = (_colors[i].b * bNewMax) / bOrigMax; + const uint r = (_colors[i].r * rNewMax) / (rOrigMax == 0 ? 1 : rOrigMax); + const uint g = (_colors[i].g * gNewMax) / (gOrigMax == 0 ? 1 : gOrigMax); + const uint b = (_colors[i].b * bNewMax) / (bOrigMax == 0 ? 1 : bOrigMax); buf[i * format.bytesPerPixel + rBytePos] |= r << (format.rShift % 8); buf[i * format.bytesPerPixel + gBytePos] |= g << (format.gShift % 8); -- cgit v1.2.3 From ac0a1b9357dc68479fdc477f00192e68a2396bd5 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 25 May 2014 18:24:08 +0200 Subject: TOON: Add a safeguard to avoid dereferencing a null pointer in playAnim() --- engines/toon/character.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/engines/toon/character.cpp b/engines/toon/character.cpp index cab31795f7..51e8dee19f 100644 --- a/engines/toon/character.cpp +++ b/engines/toon/character.cpp @@ -1059,12 +1059,14 @@ void Character::playAnim(int32 animId, int32 unused, int32 flags) { _specialAnim->loadAnimation(animName); _animSpecialId = animId; - - _animationInstance->setAnimation(_specialAnim); - _animationInstance->setAnimationRange(0, _specialAnim->_numFrames - 1); - _animationInstance->reset(); - _animationInstance->stopAnimation(); - _animationInstance->setLooping(false); + + if (_animationInstance) { + _animationInstance->setAnimation(_specialAnim); + _animationInstance->setAnimationRange(0, _specialAnim->_numFrames - 1); + _animationInstance->reset(); + _animationInstance->stopAnimation(); + _animationInstance->setLooping(false); + } } int32 Character::getAnimFlag() { -- cgit v1.2.3 From ea19581ae30bed434da8c9426c7b6defd702fc88 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 25 May 2014 13:23:05 -0400 Subject: MADS: Standardised on passing depth surfaces as DepthSurface --- engines/mads/animation.cpp | 4 ++-- engines/mads/animation.h | 4 ++-- engines/mads/msurface.cpp | 2 +- engines/mads/msurface.h | 3 ++- engines/mads/scene.cpp | 4 ++-- engines/mads/scene_data.cpp | 2 +- engines/mads/scene_data.h | 2 +- engines/mads/sprites.cpp | 2 +- 8 files changed, 12 insertions(+), 11 deletions(-) diff --git a/engines/mads/animation.cpp b/engines/mads/animation.cpp index 25fa4a8e06..ac8c9969b7 100644 --- a/engines/mads/animation.cpp +++ b/engines/mads/animation.cpp @@ -172,7 +172,7 @@ Animation::~Animation() { } } -void Animation::load(UserInterface &interfaceSurface, MSurface &depthSurface, +void Animation::load(UserInterface &interfaceSurface, DepthSurface &depthSurface, const Common::String &resName, int flags, Common::Array *palCycles, SceneInfo *sceneInfo) { Common::String resourceName = resName; @@ -366,7 +366,7 @@ bool Animation::drawFrame(SpriteAsset &spriteSet, const Common::Point &pt, int f return 0; } -void Animation::loadInterface(UserInterface &interfaceSurface, MSurface &depthSurface, +void Animation::loadInterface(UserInterface &interfaceSurface, DepthSurface &depthSurface, AAHeader &header, int flags, Common::Array *palCycles, SceneInfo *sceneInfo) { _scene->_depthStyle = 0; if (header._bgType <= ANIMBG_FULL_SIZE) { diff --git a/engines/mads/animation.h b/engines/mads/animation.h index 715f6e49a5..15086d3e41 100644 --- a/engines/mads/animation.h +++ b/engines/mads/animation.h @@ -168,7 +168,7 @@ private: /** * Load the user interface display for an animation */ - void loadInterface(UserInterface &interfaceSurface, MSurface &depthSurface, + void loadInterface(UserInterface &interfaceSurface, DepthSurface &depthSurface, AAHeader &header, int flags, Common::Array *palCycles, SceneInfo *sceneInfo); /** @@ -196,7 +196,7 @@ public: /** * Loads animation data */ - void load(UserInterface &interfaceSurface, MSurface &depthSurface, const Common::String &resName, + void load(UserInterface &interfaceSurface, DepthSurface &depthSurface, const Common::String &resName, int flags, Common::Array *palCycles, SceneInfo *sceneInfo); /** diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp index 3ebbc6b79d..a7249cd69c 100644 --- a/engines/mads/msurface.cpp +++ b/engines/mads/msurface.cpp @@ -258,7 +258,7 @@ void MSurface::copyFrom(MSurface *src, const Common::Rect &srcBounds, } void MSurface::copyFrom(MSurface *src, const Common::Point &destPos, int depth, - MSurface *depthsSurface, int scale, int transparentColor) { + DepthSurface *depthsSurface, int scale, int transparentColor) { int destX = destPos.x, destY = destPos.y; if (scale == 100) { diff --git a/engines/mads/msurface.h b/engines/mads/msurface.h index fbd927084a..e3cf89d649 100644 --- a/engines/mads/msurface.h +++ b/engines/mads/msurface.h @@ -32,6 +32,7 @@ namespace MADS { class MADSEngine; class MSprite; +class DepthSurface; /** * Basic sprite information @@ -162,7 +163,7 @@ public: * @param depthSurface Depth surface to use with sprite depth * @param transparentColor Transparency palette index */ - void copyFrom(MSurface *src, const Common::Point &destPos, int depth, MSurface *depthSurface, + void copyFrom(MSurface *src, const Common::Point &destPos, int depth, DepthSurface *depthSurface, int scale, int transparentColor = -1); /** diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 944c082817..13913030df 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -176,7 +176,7 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) { flags |= ANIMFLAG_LOAD_BACKGROUND_ONLY; _animationData = Animation::init(_vm, this); - MSurface depthSurface; + DepthSurface depthSurface(_vm); _animationData->load(_userInterface, depthSurface, prefix, flags, nullptr, nullptr); _vm->_palette->_paletteUsage.load(&_scenePaletteUsage); @@ -592,7 +592,7 @@ void Scene::checkKeyboard() { void Scene::loadAnimation(const Common::String &resName, int trigger) { assert(_activeAnimation == nullptr); - MSurface depthSurface; + DepthSurface depthSurface(_vm); UserInterface interfaceSurface(_vm); _activeAnimation = Animation::init(_vm, this); diff --git a/engines/mads/scene_data.cpp b/engines/mads/scene_data.cpp index 256a517540..5656ac4069 100644 --- a/engines/mads/scene_data.cpp +++ b/engines/mads/scene_data.cpp @@ -110,7 +110,7 @@ SceneInfo *SceneInfo::init(MADSEngine *vm) { } void SceneInfo::load(int sceneId, int variant, const Common::String &resName, - int flags, MSurface &depthSurface, MSurface &bgSurface) { + int flags, DepthSurface &depthSurface, MSurface &bgSurface) { bool sceneFlag = sceneId >= 0; // Figure out the resource to use diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index db25298e91..392383af2f 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -186,7 +186,7 @@ public: * loads the data */ void load(int sceneId, int variant, const Common::String &resName, int flags, - MSurface &depthSurface, MSurface &bgSurface); + DepthSurface &depthSurface, MSurface &bgSurface); /** * Loads the palette for a scene diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp index b0506fc40a..e4e57bd07b 100644 --- a/engines/mads/sprites.cpp +++ b/engines/mads/sprites.cpp @@ -258,7 +258,7 @@ void SpriteSlots::drawBackground() { if (spriteSlot._depth <= 1) { frame->copyTo(&scene._backgroundSurface, frame->getTransparencyIndex()); } else if (scene._depthStyle == 0) { - scene._backgroundSurface.copyFrom(frame, pt, spriteSlot._depth, &scene._backgroundSurface, + scene._backgroundSurface.copyFrom(frame, pt, spriteSlot._depth, &scene._depthSurface, 100, frame->getTransparencyIndex()); } else { error("Unsupported depth style"); -- cgit v1.2.3 From 142f2ad208d0dc76d36986c642bbd0f94bde30b9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 25 May 2014 14:17:38 -0400 Subject: MADS: Change sprite drawing to use DepthSurface getDepth method --- engines/mads/msurface.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/engines/mads/msurface.cpp b/engines/mads/msurface.cpp index a7249cd69c..6d74fefaab 100644 --- a/engines/mads/msurface.cpp +++ b/engines/mads/msurface.cpp @@ -258,7 +258,7 @@ void MSurface::copyFrom(MSurface *src, const Common::Rect &srcBounds, } void MSurface::copyFrom(MSurface *src, const Common::Point &destPos, int depth, - DepthSurface *depthsSurface, int scale, int transparentColor) { + DepthSurface *depthSurface, int scale, int transparentColor) { int destX = destPos.x, destY = destPos.y; if (scale == 100) { @@ -285,20 +285,19 @@ void MSurface::copyFrom(MSurface *src, const Common::Point &destPos, int depth, byte *data = src->getData(); byte *srcPtr = data + (src->getWidth() * copyRect.top + copyRect.left); - byte *depthsData = depthsSurface->getData(); - byte *depthsPtr = depthsData + (depthsSurface->pitch * destY) + destX; byte *destPtr = (byte *)pixels + (destY * pitch) + destX; // 100% scaling variation for (int rowCtr = 0; rowCtr < copyRect.height(); ++rowCtr) { // Copy each byte one at a time checking against the depth for (int xCtr = 0; xCtr < copyRect.width(); ++xCtr) { - if ((depth <= (depthsPtr[xCtr] & 0x7f)) && (srcPtr[xCtr] != transparentColor)) + int pixelDepth = depthSurface == nullptr ? 15 : + depthSurface->getDepth(Common::Point(destX + xCtr, destY + rowCtr)); + if ((depth <= pixelDepth) && (srcPtr[xCtr] != transparentColor)) destPtr[xCtr] = srcPtr[xCtr]; } srcPtr += src->getWidth(); - depthsPtr += depthsSurface->getWidth(); destPtr += getWidth(); } @@ -379,7 +378,6 @@ void MSurface::copyFrom(MSurface *src, const Common::Point &destPos, int depth, return; byte *destPixelsP = this->getBasePtr(destX + spriteLeft, destY + spriteTop); - const byte *depthPixelsP = depthsSurface->getBasePtr(destX + spriteLeft, destY + spriteTop); spriteLeft = (spriteLeft * (normalFrame ? 1 : -1)); @@ -395,8 +393,8 @@ void MSurface::copyFrom(MSurface *src, const Common::Point &destPos, int depth, // Found a line to display. Loop through the pixels const byte *srcP = srcPixelsP; - const byte *depthP = depthPixelsP; byte *destP = destPixelsP; + for (int xp = 0, sprX = 0; xp < frameWidth; ++xp, ++srcP) { if (xp < spriteLeft) // Not yet reached start of display area @@ -405,16 +403,19 @@ void MSurface::copyFrom(MSurface *src, const Common::Point &destPos, int depth, // Not a display pixel continue; - if ((*srcP != transparentColor) && (depth <= (*depthP & 0x7f))) + // Get depth of current output pixel in depth surface + Common::Point pt((destP - (byte *)this->pixels) % this->pitch, + (destP - (byte *)this->pixels) / this->pitch); + int pixelDepth = (depthSurface == nullptr) ? 15 : depthSurface->getDepth(pt); + + if ((*srcP != transparentColor) && (depth <= pixelDepth)) *destP = *srcP; ++destP; - ++depthP; } // Move to the next destination line destPixelsP += this->pitch; - depthPixelsP += depthsSurface->pitch; } } -- cgit v1.2.3 From 6f046eafded01e00beddc7533989a06c50b05624 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 25 May 2014 14:39:15 -0400 Subject: MADS: Fix for assert when a scene uses more than one animation --- engines/mads/scene.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 13913030df..4af956a9f6 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -591,7 +591,11 @@ void Scene::checkKeyboard() { } void Scene::loadAnimation(const Common::String &resName, int trigger) { - assert(_activeAnimation == nullptr); + // WORKAROUND: If there's already a previous active animation used by the + // scene, then free it before we create the new one + if (_activeAnimation) + freeAnimation(); + DepthSurface depthSurface(_vm); UserInterface interfaceSurface(_vm); -- cgit v1.2.3 From 2eee236c8dc4f4209d4bf21aa8cab3355f25b5da Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 25 May 2014 22:04:03 +0200 Subject: TOUCHE: Initialize some uninitialized variables, fix a lot of pointers and booleans default values --- engines/touche/resource.cpp | 20 +++++++------- engines/touche/touche.cpp | 66 +++++++++++++++++++++++++++++---------------- engines/touche/touche.h | 3 ++- 3 files changed, 55 insertions(+), 34 deletions(-) diff --git a/engines/touche/resource.cpp b/engines/touche/resource.cpp index 16a95d307f..467d2bed90 100644 --- a/engines/touche/resource.cpp +++ b/engines/touche/resource.cpp @@ -150,38 +150,38 @@ void ToucheEngine::res_allocateTables() { void ToucheEngine::res_deallocateTables() { free(_textData); - _textData = 0; + _textData = nullptr; free(_backdropBuffer); - _backdropBuffer = 0; + _backdropBuffer = nullptr; free(_menuKitData); - _menuKitData = 0; + _menuKitData = nullptr; free(_convKitData); - _convKitData = 0; + _convKitData = nullptr; for (int i = 0; i < NUM_SEQUENCES; ++i) { free(_sequenceDataTable[i]); - _sequenceDataTable[i] = 0; + _sequenceDataTable[i] = nullptr; } free(_programData); - _programData = 0; + _programData = nullptr; free(_mouseData); - _mouseData = 0; + _mouseData = nullptr; free(_iconData); - _iconData = 0; + _iconData = nullptr; for (int i = 0; i < NUM_SPRITES; ++i) { free(_spritesTable[i].ptr); - _spritesTable[i].ptr = 0; + _spritesTable[i].ptr = nullptr; } free(_offscreenBuffer); - _offscreenBuffer = 0; + _offscreenBuffer = nullptr; } uint32 ToucheEngine::res_getDataOffset(ResourceType type, int num, uint32 *size) { diff --git a/engines/touche/touche.cpp b/engines/touche/touche.cpp index 09697d0e4a..7b70b4a9ee 100644 --- a/engines/touche/touche.cpp +++ b/engines/touche/touche.cpp @@ -46,32 +46,32 @@ namespace Touche { ToucheEngine::ToucheEngine(OSystem *system, Common::Language language) - : Engine(system), _midiPlayer(0), _language(language), _rnd("touche") { + : Engine(system), _midiPlayer(nullptr), _language(language), _rnd("touche") { _saveLoadCurrentPage = 0; _saveLoadCurrentSlot = 0; _hideInventoryTexts = false; _numOpcodes = 0; _compressedSpeechData = 0; - _textData = 0; - _backdropBuffer = 0; - _menuKitData = 0; - _convKitData = 0; + _textData = nullptr; + _backdropBuffer = nullptr; + _menuKitData = nullptr; + _convKitData = nullptr; for (int i = 0; i < NUM_SEQUENCES; i++) - _sequenceDataTable[i] = 0; + _sequenceDataTable[i] = nullptr; - _programData = 0; + _programData = nullptr; _programDataSize = 0; - _mouseData = 0; - _iconData = 0; + _mouseData = nullptr; + _iconData = nullptr; _currentBitmapWidth = 0; _currentBitmapHeight = 0; _currentImageWidth = 0; _currentImageHeight = 0; _roomWidth = 0; - _programTextDataPtr = 0; - _offscreenBuffer = 0; + _programTextDataPtr = nullptr; + _offscreenBuffer = nullptr; _screenRect = Common::Rect(kScreenWidth, kScreenHeight); _roomAreaRect = Common::Rect(kScreenWidth, kRoomHeight); @@ -124,11 +124,11 @@ ToucheEngine::ToucheEngine(OSystem *system, Common::Language language) _script.opcodeNum = 0; _script.dataOffset = 0; _script.keyCharNum = 0; - _script.dataPtr = 0; - _script.stackDataPtr = 0; - _script.stackDataBasePtr = 0; + _script.dataPtr = nullptr; + _script.stackDataPtr = nullptr; + _script.stackDataBasePtr = nullptr; _script.quitFlag = 0; - _opcodesTable = 0; + _opcodesTable = nullptr; for (uint i = 0; i < NUM_SPRITES; i++) memset(&_spritesTable[i], 0, sizeof(SpriteData)); @@ -138,10 +138,10 @@ ToucheEngine::ToucheEngine(OSystem *system, Common::Language language) _talkListEnd = 0; _talkListCurrent = 0; - _talkTextRectDefined = 0; - _talkTextDisplayed = 0; - _talkTextInitialized = 0; - _skipTalkText = 0; + _talkTextRectDefined = false; + _talkTextDisplayed = false; + _talkTextInitialized = false; + _skipTalkText = false; _talkTextSpeed = 0; _keyCharTalkCounter = 0; _talkTableLastTalkingKeyChar = 0; @@ -151,14 +151,14 @@ ToucheEngine::ToucheEngine(OSystem *system, Common::Language language) for (uint i = 0; i < NUM_TALK_ENTRIES; i++) memset(&_talkTable[i], 0, sizeof(TalkEntry)); - _conversationChoicesUpdated = 0; + _conversationChoicesUpdated = false; _conversationReplyNum = 0; - _conversationEnded = 0; + _conversationEnded = false; _conversationNum = 0; _scrollConversationChoiceOffset = 0; _currentConversation = 0; - _disableConversationScript = 0; - _conversationAreaCleared = 0; + _disableConversationScript = false; + _conversationAreaCleared = false; for (uint i = 0; i < NUM_CONVERSATION_CHOICES; i++) memset(&_conversationChoicesTable[i], 0, sizeof(ConversationChoice)); @@ -167,6 +167,26 @@ ToucheEngine::ToucheEngine(OSystem *system, Common::Language language) _sortedKeyCharsTable[i] = 0; _currentKeyCharNum = 0; + _inp_leftMouseButtonPressed = false; + _inp_rightMouseButtonPressed = false; + _disabledInputCounter = 0; + _gameState = kGameStateNone; + _displayQuitDialog = false; + _newMusicNum = 0; + _currentMusicNum = 0; + _newSoundNum = 0; + _newSoundDelay = 0; + _newSoundPriority = 0; + for (int i = 0; i < 3; ++i) { + _inventoryStateTable[i].displayOffset = 0; + _inventoryStateTable[i].lastItem = 0; + _inventoryStateTable[i].itemsPerLine = 0; + _inventoryStateTable[i].itemsList = nullptr; + } + _inventoryVar1 = nullptr; + _inventoryVar2 = nullptr; + _currentCursorObject = 0; + _talkTextMode = 0; } ToucheEngine::~ToucheEngine() { diff --git a/engines/touche/touche.h b/engines/touche/touche.h index 3da33f593b..ee6dffefdc 100644 --- a/engines/touche/touche.h +++ b/engines/touche/touche.h @@ -353,7 +353,8 @@ int getGameStateFileSlot(const char *filename); enum GameState { kGameStateGameLoop, kGameStateOptionsDialog, - kGameStateQuitDialog + kGameStateQuitDialog, + kGameStateNone }; class MidiPlayer; -- cgit v1.2.3 From f01a402694dcd6934b4dee3b936f1b9dd1d2978b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 25 May 2014 23:29:03 +0200 Subject: TOUCHE: Reduce the scope of a variable --- engines/touche/touche.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/touche/touche.cpp b/engines/touche/touche.cpp index 7b70b4a9ee..ff4f41f44d 100644 --- a/engines/touche/touche.cpp +++ b/engines/touche/touche.cpp @@ -3114,12 +3114,12 @@ void ToucheEngine::buildWalkPath(int dstPosX, int dstPosY, int keyChar) { for (uint i = 0; i < _programWalkTable.size(); ++i) { const ProgramWalkData *pwd = &_programWalkTable[i]; if ((pwd->point1 & 0x4000) == 0) { - int distance = 32000; ProgramPointData *pts1 = &_programPointsTable[pwd->point1]; ProgramPointData *pts2 = &_programPointsTable[pwd->point2]; if (pts1->order != 0) { int dx = pts2->x - pts1->x; int dy = pts2->y - pts1->y; + int distance = 32000; if (dx == 0) { if (dstPosY > MIN(pts2->y, pts1->y) && dstPosY < MAX(pts2->y, pts1->y)) { int d = ABS(dstPosX - pts1->x); -- cgit v1.2.3 From e37affcf4a571e68dd5930ee59e13def23e76760 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 25 May 2014 23:30:22 +0200 Subject: TOUCHE: Move some enums and struct definition to header file, get rid of some void* parameters --- engines/touche/menu.cpp | 161 ++++++++++-------------------------------------- engines/touche/touche.h | 105 ++++++++++++++++++++++++++++--- 2 files changed, 132 insertions(+), 134 deletions(-) diff --git a/engines/touche/menu.cpp b/engines/touche/menu.cpp index 19c10af8de..b94776eee5 100644 --- a/engines/touche/menu.cpp +++ b/engines/touche/menu.cpp @@ -31,96 +31,6 @@ namespace Touche { -enum ActionId { - kActionNone, - - // settings menu - kActionLoadMenu, - kActionSaveMenu, - kActionRestartGame, - kActionPlayGame, - kActionQuitGame, - kActionTextOnly, - kActionVoiceOnly, - kActionTextAndVoice, - kActionLowerVolume, - kActionUpperVolume, - - // saveLoad menu - kActionGameState1, - kActionGameState2, - kActionGameState3, - kActionGameState4, - kActionGameState5, - kActionGameState6, - kActionGameState7, - kActionGameState8, - kActionGameState9, - kActionGameState10, - kActionScrollUpSaves, - kActionScrollDownSaves, - kActionPerformSaveLoad, - kActionCancelSaveLoad -}; - -enum MenuMode { - kMenuSettingsMode = 0, - kMenuLoadStateMode, - kMenuSaveStateMode -}; - -enum ButtonFlags { - kButtonBorder = 1 << 0, - kButtonText = 1 << 1, - kButtonArrow = 1 << 2 -}; - -struct Button { - int x, y; - int w, h; - ActionId action; - int data; - uint8 flags; -}; - -struct MenuData { - MenuMode mode; - Button *buttonsTable; - uint buttonsCount; - bool quit; - bool exit; - char saveLoadDescriptionsTable[kMaxSaveStates][33]; - - void removeLastCharFromDescription(int slot) { - char *description = saveLoadDescriptionsTable[slot]; - int descriptionLen = strlen(description); - if (descriptionLen > 0) { - --descriptionLen; - description[descriptionLen] = 0; - } - } - - void addCharToDescription(int slot, char chr) { - char *description = saveLoadDescriptionsTable[slot]; - int descriptionLen = strlen(description); - if (descriptionLen < 32 && Common::isPrint(chr)) { - description[descriptionLen] = chr; - description[descriptionLen + 1] = 0; - } - } - - const Button *findButtonUnderCursor(int cursorX, int cursorY) const { - for (uint i = 0; i < buttonsCount; ++i) { - const Button *button = &buttonsTable[i]; - if (cursorX >= button->x && cursorX < button->x + button->w && - cursorY >= button->y && cursorY < button->y + button->h) { - return button; - } - } - return 0; - } -}; - static void drawArrow(uint8 *dst, int dstPitch, int x, int y, int delta, uint8 color) { static const int8 arrowCoordsTable[7][4] = { { 5, 0, 9, 0 }, @@ -140,25 +50,24 @@ static void drawArrow(uint8 *dst, int dstPitch, int x, int y, int delta, uint8 c } } -void ToucheEngine::drawButton(void *button) { - Button *b = (Button *)button; - if (b->flags & kButtonBorder) { - Graphics::drawRect(_offscreenBuffer, kScreenWidth, b->x, b->y, b->w, b->h, 0xF7, 0xF9); +void ToucheEngine::drawButton(Button *button) { + if (button->flags & kButtonBorder) { + Graphics::drawRect(_offscreenBuffer, kScreenWidth, button->x, button->y, button->w, button->h, 0xF7, 0xF9); } - if (b->flags & kButtonText) { - if (b->data != 0) { - const char *str = getString(b->data); - const int w = getStringWidth(b->data); + if (button->flags & kButtonText) { + if (button->data != 0) { + const char *str = getString(button->data); + const int w = getStringWidth(button->data); const int h = kTextHeight; - const int x = b->x + (b->w - w) / 2; - const int y = b->y + (b->h - h) / 2; + const int x = button->x + (button->w - w) / 2; + const int y = button->y + (button->h - h) / 2; Graphics::drawString16(_offscreenBuffer, kScreenWidth, 0xFF, x, y, str); } } - if (b->flags & kButtonArrow) { + if (button->flags & kButtonArrow) { int dx = 0; int dy = 0; - switch (b->data) { + switch (button->data) { case 2000: // up arrow dx = 1; dy = 2; @@ -168,8 +77,8 @@ void ToucheEngine::drawButton(void *button) { dy = -2; break; } - const int x = b->x + b->w / 2; - const int y = b->y + b->h / 2; + const int x = button->x + button->w / 2; + const int y = button->y + button->h / 2; drawArrow(_offscreenBuffer, kScreenWidth, x, y + dy + 1, dx, 0xD2); drawArrow(_offscreenBuffer, kScreenWidth, x, y + dy, dx, 0xFF); } @@ -253,49 +162,47 @@ static void setupMenu(MenuMode mode, MenuData *menuData) { } } -void ToucheEngine::redrawMenu(void *menu) { - MenuData *menuData = (MenuData *)menu; +void ToucheEngine::redrawMenu(MenuData *menu) { Graphics::fillRect(_offscreenBuffer, kScreenWidth, 90, 102, 460, 196, 0xF8); Graphics::drawRect(_offscreenBuffer, kScreenWidth, 90, 102, 460, 196, 0xF7, 0xF9); Graphics::drawRect(_offscreenBuffer, kScreenWidth, 106, 118, 340, 164, 0xF9, 0xF7); - switch (menuData->mode) { + switch (menu->mode) { case kMenuSettingsMode: drawVolumeSlideBar(_offscreenBuffer, kScreenWidth, getMusicVolume()); - menuData->buttonsTable[5].data = 0; - menuData->buttonsTable[6].data = 0; - menuData->buttonsTable[7].data = 0; - menuData->buttonsTable[5 + _talkTextMode].data = -86; + menu->buttonsTable[5].data = 0; + menu->buttonsTable[6].data = 0; + menu->buttonsTable[7].data = 0; + menu->buttonsTable[5 + _talkTextMode].data = -86; break; case kMenuLoadStateMode: case kMenuSaveStateMode: - drawSaveGameStateDescriptions(_offscreenBuffer, kScreenWidth, menuData, _saveLoadCurrentPage, _saveLoadCurrentSlot); + drawSaveGameStateDescriptions(_offscreenBuffer, kScreenWidth, menu, _saveLoadCurrentPage, _saveLoadCurrentSlot); break; } - for (uint i = 0; i < menuData->buttonsCount; ++i) { - drawButton(&menuData->buttonsTable[i]); + for (uint i = 0; i < menu->buttonsCount; ++i) { + drawButton(&menu->buttonsTable[i]); } } -void ToucheEngine::handleMenuAction(void *menu, int actionId) { - MenuData *menuData = (MenuData *)menu; +void ToucheEngine::handleMenuAction(MenuData *menu, int actionId) { switch (actionId) { case kActionLoadMenu: - menuData->mode = kMenuLoadStateMode; + menu->mode = kMenuLoadStateMode; break; case kActionSaveMenu: _system->setFeatureState(OSystem::kFeatureVirtualKeyboard, true); - menuData->mode = kMenuSaveStateMode; + menu->mode = kMenuSaveStateMode; break; case kActionRestartGame: restart(); - menuData->quit = true; + menu->quit = true; break; case kActionPlayGame: - menuData->quit = true; + menu->quit = true; break; case kActionQuitGame: quitGame(); - menuData->quit = true; + menu->quit = true; break; case kActionTextOnly: _talkTextMode = kTalkModeTextOnly; @@ -327,23 +234,23 @@ void ToucheEngine::handleMenuAction(void *menu, int actionId) { _saveLoadCurrentSlot = _saveLoadCurrentPage * 10 + (_saveLoadCurrentSlot % 10); break; case kActionPerformSaveLoad: - if (menuData->mode == kMenuLoadStateMode) { + if (menu->mode == kMenuLoadStateMode) { if (loadGameState(_saveLoadCurrentSlot).getCode() == Common::kNoError) { - menuData->quit = true; + menu->quit = true; } - } else if (menuData->mode == kMenuSaveStateMode) { + } else if (menu->mode == kMenuSaveStateMode) { _system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false); - const char *description = menuData->saveLoadDescriptionsTable[_saveLoadCurrentSlot]; + const char *description = menu->saveLoadDescriptionsTable[_saveLoadCurrentSlot]; if (strlen(description) > 0) { if (saveGameState(_saveLoadCurrentSlot, description).getCode() == Common::kNoError) { - menuData->quit = true; + menu->quit = true; } } } break; case kActionCancelSaveLoad: _system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false); - menuData->mode = kMenuSettingsMode; + menu->mode = kMenuSettingsMode; break; default: if (actionId >= kActionGameState1 && actionId <= kActionGameState10) { diff --git a/engines/touche/touche.h b/engines/touche/touche.h index ee6dffefdc..20bf723553 100644 --- a/engines/touche/touche.h +++ b/engines/touche/touche.h @@ -346,10 +346,6 @@ enum StringType { kStringTypeConversation }; -void readGameStateDescription(Common::ReadStream *f, char *description, int len); -Common::String generateGameStateFileName(const char *target, int slot, bool prefixOnly = false); -int getGameStateFileSlot(const char *filename); - enum GameState { kGameStateGameLoop, kGameStateOptionsDialog, @@ -357,6 +353,101 @@ enum GameState { kGameStateNone }; +enum ActionId { + kActionNone, + + // settings menu + kActionLoadMenu, + kActionSaveMenu, + kActionRestartGame, + kActionPlayGame, + kActionQuitGame, + kActionTextOnly, + kActionVoiceOnly, + kActionTextAndVoice, + kActionLowerVolume, + kActionUpperVolume, + + // saveLoad menu + kActionGameState1, + kActionGameState2, + kActionGameState3, + kActionGameState4, + kActionGameState5, + kActionGameState6, + kActionGameState7, + kActionGameState8, + kActionGameState9, + kActionGameState10, + kActionScrollUpSaves, + kActionScrollDownSaves, + kActionPerformSaveLoad, + kActionCancelSaveLoad +}; + +enum MenuMode { + kMenuSettingsMode = 0, + kMenuLoadStateMode, + kMenuSaveStateMode +}; + +enum ButtonFlags { + kButtonBorder = 1 << 0, + kButtonText = 1 << 1, + kButtonArrow = 1 << 2 +}; + +struct Button { + int x, y; + int w, h; + ActionId action; + int data; + uint8 flags; +}; + +struct MenuData { + MenuMode mode; + Button *buttonsTable; + uint buttonsCount; + bool quit; + bool exit; + char saveLoadDescriptionsTable[kMaxSaveStates][33]; + + void removeLastCharFromDescription(int slot) { + char *description = saveLoadDescriptionsTable[slot]; + int descriptionLen = strlen(description); + if (descriptionLen > 0) { + --descriptionLen; + description[descriptionLen] = 0; + } + } + + void addCharToDescription(int slot, char chr) { + char *description = saveLoadDescriptionsTable[slot]; + int descriptionLen = strlen(description); + if (descriptionLen < 32 && Common::isPrint(chr)) { + description[descriptionLen] = chr; + description[descriptionLen + 1] = 0; + } + } + + const Button *findButtonUnderCursor(int cursorX, int cursorY) const { + for (uint i = 0; i < buttonsCount; ++i) { + const Button *button = &buttonsTable[i]; + if (cursorX >= button->x && cursorX < button->x + button->w && + cursorY >= button->y && cursorY < button->y + button->h) { + return button; + } + } + return 0; + } +}; + + +void readGameStateDescription(Common::ReadStream *f, char *description, int len); +Common::String generateGameStateFileName(const char *target, int slot, bool prefixOnly = false); +int getGameStateFileSlot(const char *filename); + class MidiPlayer; class ToucheEngine: public Engine { @@ -632,9 +723,9 @@ protected: void res_loadSpeechSegment(int num); void res_stopSpeech(); - void drawButton(void *button); - void redrawMenu(void *menu); - void handleMenuAction(void *menu, int actionId); + void drawButton(Button *button); + void redrawMenu(MenuData *menu); + void handleMenuAction(MenuData *menu, int actionId); void handleOptions(int forceDisplay); void drawActionsPanel(int dstX, int dstY, int deltaX, int deltaY); void drawConversationPanelBorder(int dstY, int srcX, int srcY); -- cgit v1.2.3 From a01d502d2015b916b61a99ac0dcc0fcf1a289b78 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 25 May 2014 17:42:19 -0400 Subject: MADS: Fix drawing of background elements --- engines/mads/sprites.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp index e4e57bd07b..c98a0963f6 100644 --- a/engines/mads/sprites.cpp +++ b/engines/mads/sprites.cpp @@ -256,7 +256,7 @@ void SpriteSlots::drawBackground() { if (spriteSlot._depth <= 1) { - frame->copyTo(&scene._backgroundSurface, frame->getTransparencyIndex()); + frame->copyTo(&scene._backgroundSurface, pt, frame->getTransparencyIndex()); } else if (scene._depthStyle == 0) { scene._backgroundSurface.copyFrom(frame, pt, spriteSlot._depth, &scene._depthSurface, 100, frame->getTransparencyIndex()); -- cgit v1.2.3 From 49866d442fdd816a89a5c1bd4ddb1e68013c8d9e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 25 May 2014 18:32:54 -0400 Subject: MADS: Properly implement cursor hotspot handling --- engines/mads/events.cpp | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp index 5d6a16ff1f..870a902866 100644 --- a/engines/mads/events.cpp +++ b/engines/mads/events.cpp @@ -90,9 +90,38 @@ void EventsManager::waitCursor() { void EventsManager::changeCursor() { if (_cursorSprites) { MSprite *cursor = _cursorSprites->getFrame(_cursorId - 1); - CursorMan.replaceCursor(cursor->getData(), cursor->w, cursor->h, 0, 0, - cursor->getTransparencyIndex()); + assert(cursor->w == cursor->h); + byte transIndex = cursor->getTransparencyIndex(); + + // Check for hotspot indication pixels along the right-hand and bottom + // row. Put together, these give the cursor's hotspot x,y + int hotspotX = 0, hotspotY = 0; + byte *cursorData = cursor->getData(); + for (int idx = 0; idx < cursor->w; ++idx) { + if (cursorData[(cursor->h - 1) * cursor->w + idx] != transIndex) + hotspotX = idx; + + if (cursorData[(cursor->h + 1) * cursor->w - 1] != transIndex) + hotspotY = idx; + } + + // Reduce the cursor data to remove the last column from each row, since + // the cursor routines don't have a pitch option + byte *destCursor = new byte[(cursor->w - 1) * (cursor->h - 1)]; + byte *srcP = cursorData; + byte *destP = destCursor; + + for (int idx = 0; idx < (cursor->h - 1); ++idx) { + Common::copy(srcP, srcP + cursor->w - 1, destP); + srcP += cursor->w; + destP += cursor->w - 1; + } + + // Set the raw cursor data to use + CursorMan.replaceCursor(destCursor, cursor->w - 1, cursor->h - 1, + hotspotX, hotspotY, transIndex); showCursor(); + delete[] destCursor; } } -- cgit v1.2.3 From 7a92556aed52aa9e49725a72cffd580745d691d6 Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Mon, 26 May 2014 00:53:24 +0200 Subject: SCI: SQ1VGA patch for spider droid timing issue makes spider droid speed relative to movement speed setting --- engines/sci/engine/script_patches.cpp | 80 +++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp index b4d245197b..1004811745 100644 --- a/engines/sci/engine/script_patches.cpp +++ b/engines/sci/engine/script_patches.cpp @@ -2373,11 +2373,91 @@ static const uint16 sq1vgaPatchEgoShowsCard[] = { PATCH_END }; +// The spider droid on planet Korona has a fixed movement speed, +// which is way faster than the default movement speed of ego. +// This means that the player would have to turn up movement speed, +// otherwise it will be impossible to escape it. +// We fix this issue by making the droid move a bit slower than ego +// does (relative to movement speed setting). +// +// Applies to at least: English PC floppy +// Responsible method: spider::doit +static const uint16 sq1vgaSignatureSpiderDroidTiming[] = { + SIG_MAGICDWORD, + 0x63, 0x4e, // pToa script + 0x30, SIG_UINT16(0x0005), // bnt [further method code] + 0x35, 0x00, // ldi 00 + 0x32, SIG_UINT16(0x0062), // jmp [super-call] + 0x38, SIG_UINT16(0x0088), // pushi 0088h (script) + 0x76, // push0 + 0x81, 0x02, // lag global[2] (current room) + 0x4a, 0x04, // send 04 (get [current room].script) + 0x30, SIG_UINT16(0x0005), // bnt [further method code] + 0x35, 0x00, // ldi 00 + 0x32, SIG_UINT16(0x0052), // jmp [super-call] + 0x89, 0xa6, // lsg global[a6] + 0x35, 0x01, // ldi 01 + 0x1a, // eq? + 0x30, SIG_UINT16(0x0012), // bnt [2nd code], in case global A6 <> 1 + 0x81, 0xb5, // lag global[b5] + 0x30, SIG_UINT16(0x000d), // bnt [2nd code], in case global B5 == 0 + 0x38, SIG_UINT16(0x008c), // pushi 008c + 0x78, // push1 + 0x72, SIG_UINT16(0x1cb6), // lofsa 1CB6 (moveToPath) + 0x36, // push + 0x54, 0x06, // self 06 + 0x32, SIG_UINT16(0x0038), // jmp [super-call] + 0x81, 0xb5, // lag global[B5] + 0x18, // not + 0x30, SIG_UINT16(0x0032), // bnt [super-call], in case global B5 <> 0 + SIG_END +}; // 58 bytes) + +static const uint16 sq1vgaPatchSpiderDroidTiming[] = { + 0x63, 0x4e, // pToa script + 0x2f, 0x68, // bt [super-call] + 0x38, PATCH_UINT16(0x0088), // pushi 0088 (script) + 0x76, // push0 + 0x81, 0x02, // lag global[2] (current room) + 0x4a, 0x04, // send 04 + 0x2f, 0x5e, // bt [super-call] + // --> 12 bytes saved + // new code + 0x38, PATCH_UINT16(0x0176), // pushi 0176 (egoMoveSpeed) + 0x76, // push0 + 0x81, 0x01, // lag global[1] + 0x4a, 0x04, // send 04 - sq1::egoMoveSpeed + 0x36, // push + 0x36, // push + 0x35, 0x03, // ldi 03 + 0x0c, // shr + 0x02, // add --> egoMoveSpeed + (egoMoveSpeed >> 3) + 0x39, 0x01, // push 01 (waste 1 byte) + 0x02, // add --> egoMoveSpeed++ + 0x65, 0x4c, // aTop cycleSpeed + 0x65, 0x5e, // aTop moveSpeed + // new code end + 0x89, 0xb5, // lsg global[B5] + 0x31, 0x13, // bnt [2nd code chunk] + 0x89, 0xa6, // lsg global[A6] + 0x35, 0x01, // ldi 01 + 0x1a, // eq? + 0x31, 0x3e, // bnt [super-call] + 0x38, PATCH_UINT16(0x008c), // pushi 008c + 0x78, // push1 + 0x72, PATCH_UINT16(0x1cb6), // lofsa moveToPath + 0x36, // push + 0x54, 0x06, // self 06 - spider::setScript(movePath) + 0x33, 0x32, // jmp [super-call] + // --> 9 bytes saved + PATCH_END +}; // script, description, signature patch static const SciScriptPatcherEntry sq1vgaSignatures[] = { { true, 45, "Ulence Flats: timepod graphic glitch", 1, sq1vgaSignatureUlenceFlatsTimepodGfxGlitch, sq1vgaPatchUlenceFlatsTimepodGfxGlitch }, { true, 58, "Sarien armory droid zapping ego first time", 1, sq1vgaSignatureEgoShowsCard, sq1vgaPatchEgoShowsCard }, + { true, 704, "spider droid timing issue", 1, sq1vgaSignatureSpiderDroidTiming, sq1vgaPatchSpiderDroidTiming }, SCI_SIGNATUREENTRY_TERMINATOR }; -- cgit v1.2.3 From feb02eaea93a3bbbc4b2c651285c99a184cbc086 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 25 May 2014 20:15:10 -0400 Subject: MADS: Further fix for setting cursor hotspot position --- engines/mads/events.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp index 870a902866..3f2a7390fb 100644 --- a/engines/mads/events.cpp +++ b/engines/mads/events.cpp @@ -101,7 +101,7 @@ void EventsManager::changeCursor() { if (cursorData[(cursor->h - 1) * cursor->w + idx] != transIndex) hotspotX = idx; - if (cursorData[(cursor->h + 1) * cursor->w - 1] != transIndex) + if (cursorData[(idx + 1) * cursor->w - 1] != transIndex) hotspotY = idx; } -- cgit v1.2.3 From c5ced2347c07e1e4f1d2b2c1a3da1c4d4463773f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 25 May 2014 22:31:37 -0400 Subject: MADS: Improve user interface animations --- engines/mads/user_interface.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 68f578489e..e21a0f6243 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -104,7 +104,7 @@ void UISlots::draw(bool updateFlag, bool delFlag) { UISlot &slot = (*this)[idx]; if (dirtyArea._active && dirtyArea._bounds.width() > 0 - && dirtyArea._bounds.height() > 0 && slot._flags >= -20) { + && dirtyArea._bounds.height() > 0 && slot._flags > -20) { if (slot._flags >= IMG_ERASE) { // Merge area @@ -449,7 +449,8 @@ void UserInterface::mergeFrom(MSurface *src, const Common::Rect &srcBounds, for (int rowCtr = 0; rowCtr < copyRect.height(); ++rowCtr) { // Process each line of the area for (int xCtr = 0; xCtr < copyRect.width(); ++xCtr) { - // Check for the range used for on-screen text, which should be kept intact + // Check for the range used for the user interface background, + // which are the only pixels that can be replaced if ((destPtr[xCtr] >= 8 && destPtr[xCtr] <= 15) && (int)srcPtr[xCtr] != transparencyIndex) destPtr[xCtr] = srcPtr[xCtr]; } @@ -884,7 +885,7 @@ void UserInterface::inventoryAnim() { // Loop through the slots list for inventory animation entry for (uint i = 0; i < _uiSlots.size(); ++i) { if (_uiSlots[i]._segmentId == IMG_SPINNING_OBJECT) - _uiSlots[i]._flags = IMG_UPDATE_ONLY; + _uiSlots[i]._flags = IMG_FULL_UPDATE; } // Add a new slot entry for the inventory animation -- cgit v1.2.3 From dfe6ae9d593a17acfe5bd9bb68d44ce497eeea20 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 26 May 2014 07:20:59 +0200 Subject: MADS: Fix a bug in scene 701 logic, rework some timer calls --- engines/mads/nebular/nebular_scenes7.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index 9383492391..08b85bfbd4 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -191,11 +191,11 @@ void Scene701::enter() { _game._player._stepEnabled = false; _scene->loadAnimation(formAnimName('B', 1), 80); _vm->_sound->command(28); - } else if (_scene->_priorSceneId != -2 && _scene->_priorSceneId != -620) { + } else if (_scene->_priorSceneId != -2 && _scene->_priorSceneId != 620) { _game._player._playerPos = Common::Point(22, 131); _game._player._facing = FACING_EAST; _game._player._stepEnabled = false; - _scene->_sequences.addTimer(1 * 60, 70); + _scene->_sequences.addTimer(60, 70); } _game.loadQuoteSet(0x310, 0x30F, 0); @@ -228,7 +228,7 @@ void Scene701::step() { case 71: _game._player.walk(Common::Point(61, 131), FACING_EAST); - _scene->_sequences.addTimer(2 * 60, 72); + _scene->_sequences.addTimer(120, 72); break; case 72: @@ -321,7 +321,7 @@ void Scene701::actions() { case 1: _game._player.walk(Common::Point(22, 131), FACING_EAST); - _scene->_sequences.addTimer(2 * 60, 3); + _scene->_sequences.addTimer(120, 3); break; case 3: -- cgit v1.2.3 From 09163f58780ea233321e9ed06bade7ebc63bf33b Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 25 May 2014 09:47:18 +0300 Subject: FULLPIPE: More work on MovGraph::sub1() --- engines/fullpipe/motion.cpp | 42 +++++++++++++++++------------------------- 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index ad86805bba..06c37f4d20 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -817,7 +817,7 @@ MessageQueue *MovGraph::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int return 0; } -MessageQueue *MovGraph::sub1(StaticANIObject *ani, int x, int y, int stid, int x1, int y1, int a8, int flag1) { +MessageQueue *MovGraph::sub1(StaticANIObject *ani, int x, int y, int stid, int x1, int y1, int stid2, int flag1) { #if 0 PicAniInfo picinfo; @@ -837,46 +837,38 @@ MessageQueue *MovGraph::sub1(StaticANIObject *ani, int x, int y, int stid, int x return 0; } - v13 = _callback1(ani, movitem, rescount); - v14 = MovGraph_getItemIndexByStaticAni(this, ani); - v15 = v14 << 6; + MessageQueue *res = 0; + + MovArr *goal = _callback1(ani, movitem, rescount); + int idx = getItemIndexByStaticAni(ani); v16 = 0; - movgitem = _items[v14]; + movgitem = _items[idx]; v18 = movgitem->count; if (v18 > 0) { v19 = movgitem->movitems; - while (v19->movarr != v13) { + while (v19->movarr != goal) { ++v16; ++v19; if (v16 >= v18) - goto LABEL_6; + break; } - v21 = v16; - v22 = movgitem->movitems[v21].movarr; - v23 = movgitem->movarr._movSteps; - movarr = movgitem->movitems[v21].movarr; - if (v23) - CObjectFree(v23); - - memcpy((char *)&this->_items->movarr + v15, v22, 0x20u); - *(MovStep **)((char *)&this->_items->movarr._movSteps + v15) = (MovStep *)operator new(8 * movarr->_movStepCount); - memcpy(*(void **)((char *)&this->_items->movarr._movSteps + v15), movarr->_movSteps, 8 * movarr->_movStepCount); - *(int *)((char *)&this->_items->movarr._afield_8 + v15) = -1; - *(MovGraphLink **)((char *)&this->_items->movarr._link + v15) = 0; - v24 = fillMGMinfo(*(StaticANIObject **)((char *)&this->_items->ani + v15), (MovArr *)((char *)&this->_items->movarr + v15), a8); + if (v16 < v18) { + movgitem->movarr._movSteps.clear(); + _items[idx]->movarr = movgitem->movitems[v16].movarr; + _items[idx]->movarr._movSteps = movgitem->movitems[v16].movarr->_movSteps; + _items[idx]->movarr._afield_8 = -1; + _items[idx]->movarr._link = 0; - result = v24; - } else { - LABEL_6: - result = 0; + res = fillMGMinfo(_items[idx]->ani, _items[idx]->movarr, stid2); + } } ani->setPicAniInfo(&picinfo); - return result; + return res; #endif warning("STUB: *MovGraph::sub1()"); -- cgit v1.2.3 From 120edd94349b4a9f7a5a294b37504edee4a39c41 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 25 May 2014 12:41:02 +0300 Subject: FULLPIPE: Finish MovGraph::sub1() implementation --- engines/fullpipe/motion.cpp | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 06c37f4d20..2564096c04 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -818,7 +818,6 @@ MessageQueue *MovGraph::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int } MessageQueue *MovGraph::sub1(StaticANIObject *ani, int x, int y, int stid, int x1, int y1, int stid2, int flag1) { -#if 0 PicAniInfo picinfo; ani->getPicAniInfo(&picinfo); @@ -829,9 +828,9 @@ MessageQueue *MovGraph::sub1(StaticANIObject *ani, int x, int y, int stid, int x int rescount; - MovItem *movitem = method28(ani, x1, y1, flag1, &rescount); + Common::Array *movitems = method28(ani, x1, y1, flag1, &rescount); - if (!movitem) { + if (!movitems) { ani->setPicAniInfo(&picinfo); return 0; @@ -839,40 +838,27 @@ MessageQueue *MovGraph::sub1(StaticANIObject *ani, int x, int y, int stid, int x MessageQueue *res = 0; - MovArr *goal = _callback1(ani, movitem, rescount); + MovArr *goal = _callback1(ani, movitems, rescount); int idx = getItemIndexByStaticAni(ani); - v16 = 0; - movgitem = _items[idx]; - v18 = movgitem->count; + MovGraphItem *movgitem = _items[idx]; + int cnt = movgitem->count; - if (v18 > 0) { - v19 = movgitem->movitems; - while (v19->movarr != goal) { - ++v16; - ++v19; - if (v16 >= v18) - break; - } - - if (v16 < v18) { + for (int nidx = 0; nidx < cnt; nidx++) { + if ((*movgitem->movitems)[nidx]->movarr == goal) { movgitem->movarr._movSteps.clear(); - _items[idx]->movarr = movgitem->movitems[v16].movarr; - _items[idx]->movarr._movSteps = movgitem->movitems[v16].movarr->_movSteps; + _items[idx]->movarr = *(*movgitem->movitems)[nidx]->movarr; + _items[idx]->movarr._movSteps = (*movgitem->movitems)[nidx]->movarr->_movSteps; _items[idx]->movarr._afield_8 = -1; _items[idx]->movarr._link = 0; - res = fillMGMinfo(_items[idx]->ani, _items[idx]->movarr, stid2); + res = fillMGMinfo(_items[idx]->ani, &_items[idx]->movarr, stid2); } } ani->setPicAniInfo(&picinfo); return res; -#endif - warning("STUB: *MovGraph::sub1()"); - - return 0; } MessageQueue *MovGraph::fillMGMinfo(StaticANIObject *ani, MovArr *movarr, int staticsId) { -- cgit v1.2.3 From 82f4e71d5604202ef364fb225f0dc7b527bd39c2 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 25 May 2014 12:50:09 +0300 Subject: FULLPIPE: Implement MovGraph::setEnds() --- engines/fullpipe/motion.cpp | 22 ++++++++++++++++++++++ engines/fullpipe/motion.h | 1 + 2 files changed, 23 insertions(+) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 2564096c04..9f34c8fab8 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -1296,6 +1296,28 @@ bool MovGraph::calcChunk(int idx, int x, int y, MovArr *arr, int a6) { return res; } +void MovGraph::setEnds(MovStep *step1, MovStep *step2) { + if (step1->link->_movGraphNode1 == step2->link->_movGraphNode2) { + step1->sfield_0 = 1; + step2->sfield_0 = 1; + + return; + } + + if (step1->link->_movGraphNode1 == step2->link->_movGraphNode1) { + step1->sfield_0 = 1; + step2->sfield_0 = 0; + } else { + step1->sfield_0 = 0; + + if (step1->link->_movGraphNode2 != step2->link->_movGraphNode1) { + step2->sfield_0 = 1; + } else { + step2->sfield_0 = 0; + } + } +} + int MovGraph2::getItemIndexByGameObjectId(int objectId) { for (uint i = 0; i < _items2.size(); i++) if (_items2[i]->_objectId == objectId) diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index 2765cc3118..b72883174f 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -376,6 +376,7 @@ public: bool calcChunk(int idx, int x, int y, MovArr *arr, int a6); MessageQueue *sub1(StaticANIObject *ani, int x, int y, int a5, int x1, int y1, int a8, int a9); MessageQueue *fillMGMinfo(StaticANIObject *ani, MovArr *movarr, int staticsId); + void setEnds(MovStep *step1, MovStep *step2); }; class Movement; -- cgit v1.2.3 From 2cc7a8184627415129f37eba02ad66f04cc4b20e Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 26 May 2014 08:53:03 +0300 Subject: FULLPIPE: Implement MovGraphItem::free() --- engines/fullpipe/motion.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 9f34c8fab8..79bb02638c 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -516,7 +516,14 @@ MovGraphItem::MovGraphItem() { } void MovGraphItem::free() { - warning("STUB: MovGraphItem::free()"); + for (uint i = 0; i < movitems->size(); i++) { + (*movitems)[i]->movarr->_movSteps.clear(); + delete (*movitems)[i]->movarr; + } + + delete movitems; + + movitems = 0; } int MovGraph_messageHandler(ExCommand *cmd); -- cgit v1.2.3 From 403b68e84d673705c179f3cb616bd0c45dab8508 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 26 May 2014 09:06:44 +0300 Subject: FULLPIPE: Started MovGraph::method28() implementation --- engines/fullpipe/motion.cpp | 68 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 79bb02638c..3a7551fe88 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -597,6 +597,74 @@ void MovGraph::freeItems() { _items.clear(); } Common::Array *MovGraph::method28(StaticANIObject *ani, int x, int y, int flag1, int *rescount) { +#if 0 + *rescount = 0; + + if (_itemsCount <= 0) + return 0; + + int idx = 0; + + while (_items[idx]->ani != ani) { + idx++; + + if (idx >= _itemsCount) + return 0; + } + _items[idx]->free(); + + calcNodeDistancesAndAngles(); + + _items[idx].movarr._movSteps.clear(); + + v15 = ani->_oy; + point1.x = ani->_ox; + point1.y = v15; + + if (!MovGraph_calcChunk(this, idx, ani->_ox, v15, &_items[idx]->movarr, 0)) + MovGraph_findClosestLink(this, idx, &point1, &_items[idx]->movarr); + + _items[idx]->count = 0; + + delete _items[idx]->movitems; + _items[idx]->movitems = 0; + + v18 = (int)MovGraph_genMovArr(this, x, y, &arrSize, flag1, 0); + v26 = v18; + if (v18) { + flag1 = 0; + if (arrSize > 0) { + v19 = v18; + x = v18; + do { + int sz; + v20 = MovGraph_calcMovItems(this, _items[idx]->movarr, (MovArr *)v19, &sz); + Memory = v20; + if (sz > 0) { + _items[idx]->movitems = MovGraph_arr16_realloc(_items[idx]->movitems, _items[idx]->count, sz + _items[idx]->count); + memcpy(_items[idx]->movitems[_items[idx]->count], v20, 16 * sz); + _items[idx]->count += sz; + CObjectFree(Memory); + v19 = x; + } + v19 += 32; + v22 = __OFSUB__(flag1 + 1, arrSize); + v21 = flag1++ + 1 - arrSize < 0; + x = v19; + } while ( v21 ^ v22 ); + v18 = v26; + } + CObjectFree((void *)v18); + } + + if (_items[idx]->count) { + *rescount = _items[idx]->count; + + return _items[idx]->movitems; + } + + return 0; +#endif warning("STUB: MovGraph::method28()"); return 0; -- cgit v1.2.3 From f7269dd7dc8418b014670c71681899db33c8bbcc Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 26 May 2014 15:36:27 +0300 Subject: FULLPIPE: More work on MovGraph::method28() --- engines/fullpipe/motion.cpp | 54 +++++++++++++++++++-------------------------- 1 file changed, 23 insertions(+), 31 deletions(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 3a7551fe88..ad024ca16f 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -617,44 +617,36 @@ Common::Array *MovGraph::method28(StaticANIObject *ani, int x, int y, _items[idx].movarr._movSteps.clear(); - v15 = ani->_oy; - point1.x = ani->_ox; - point1.y = v15; + Common::Point point; + + point.x = ani->_ox; + point.y = ani->_oy; - if (!MovGraph_calcChunk(this, idx, ani->_ox, v15, &_items[idx]->movarr, 0)) - MovGraph_findClosestLink(this, idx, &point1, &_items[idx]->movarr); + if (!MovGraph_calcChunk(this, idx, ani->_ox, ani->_oy, &_items[idx]->movarr, 0)) + MovGraph_findClosestLink(this, idx, &point, &_items[idx]->movarr); _items[idx]->count = 0; delete _items[idx]->movitems; _items[idx]->movitems = 0; - v18 = (int)MovGraph_genMovArr(this, x, y, &arrSize, flag1, 0); - v26 = v18; - if (v18) { - flag1 = 0; - if (arrSize > 0) { - v19 = v18; - x = v18; - do { - int sz; - v20 = MovGraph_calcMovItems(this, _items[idx]->movarr, (MovArr *)v19, &sz); - Memory = v20; - if (sz > 0) { - _items[idx]->movitems = MovGraph_arr16_realloc(_items[idx]->movitems, _items[idx]->count, sz + _items[idx]->count); - memcpy(_items[idx]->movitems[_items[idx]->count], v20, 16 * sz); - _items[idx]->count += sz; - CObjectFree(Memory); - v19 = x; - } - v19 += 32; - v22 = __OFSUB__(flag1 + 1, arrSize); - v21 = flag1++ + 1 - arrSize < 0; - x = v19; - } while ( v21 ^ v22 ); - v18 = v26; - } - CObjectFree((void *)v18); + Common::Array *movarr = genMovArr(x, y, &arrSize, flag1, 0); + + if (movarr) { + for (int i = 0; i < arrSize; i++) { + int sz; + Common::Array *movitems = calcMovItems(_items[idx]->movarr, movarr[i], &sz); + + if (sz > 0) { + _items[idx]->movitems = MovGraph_arr16_realloc(_items[idx]->movitems, _items[idx]->count, sz + _items[idx]->count); + memcpy(_items[idx]->movitems[_items[idx]->count], *movitems, 16 * sz); + _items[idx]->count += sz; + + delete movitems; + } + } + + delete movarr; } if (_items[idx]->count) { -- cgit v1.2.3 From ec38016044e674fadc0e8b370afd5cd25110b392 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Mon, 26 May 2014 11:01:11 -0400 Subject: IMAGE: Fix compiling in truemotion --- image/codecs/codec.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/image/codecs/codec.cpp b/image/codecs/codec.cpp index 530fb3b836..64acf3f169 100644 --- a/image/codecs/codec.cpp +++ b/image/codecs/codec.cpp @@ -58,7 +58,7 @@ Codec *createBitmapCodec(uint32 tag, int width, int height, int bitsPerPixel) { return new CinepakDecoder(bitsPerPixel); case MKTAG('I','V','3','2'): return new Indeo3Decoder(width, height); -#ifdef VIDEO_CODECS_TRUEMOTION1_H +#ifdef IMAGE_CODECS_TRUEMOTION1_H case MKTAG('D','U','C','K'): case MKTAG('d','u','c','k'): return new TrueMotion1Decoder(width, height); -- cgit v1.2.3 From d42d523ca2971f3f370476c210edf74ce2b48c5c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 26 May 2014 11:29:03 -0400 Subject: MADS: Fix walking to dynamic hotspots --- engines/mads/action.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index 1db143aaad..0b853e1182 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -341,7 +341,7 @@ void MADSAction::startAction() { startWalkingDirectly(hs._feetPos.x); } else if (hs._feetPos.x == 0) { player._prepareWalkFacing = hs._facing; - } else if (_savedFields._commandSource == CAT_NONE || hs._cursor >= CURSOR_WAIT) { + } else if (_savedFields._commandSource == CAT_NONE || hs._cursor < CURSOR_WAIT) { player._needToWalk = true; player._prepareWalkPos = hs._feetPos; } @@ -351,7 +351,7 @@ void MADSAction::startAction() { } } - if (hotspotId >= 0 && hotspotId < (int)hotspots.size()) { + if (hotspotId >= 0) { Hotspot &hs = hotspots[hotspotId]; if (hs._feetPos.x == -1 || hs._feetPos.x == -3) { -- cgit v1.2.3 From c7efc76af65434d171caa94f6eca550cc484289b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 26 May 2014 12:12:01 -0400 Subject: MADS: Fix inventory scrolling when picking up items --- engines/mads/inventory.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/mads/inventory.cpp b/engines/mads/inventory.cpp index 434d284244..b7864bc6a7 100644 --- a/engines/mads/inventory.cpp +++ b/engines/mads/inventory.cpp @@ -150,10 +150,10 @@ void InventoryObjects::addToInventory(int objectId) { _inventoryList.push_back(objectId); userInterface._selectedInvIndex = _inventoryList.size() - 1; userInterface._inventoryTopIndex = CLIP(userInterface._inventoryTopIndex, - 0, (int)_inventoryList.size() - 1); + 0, userInterface._selectedInvIndex); if ((userInterface._inventoryTopIndex + 5) <= (int)_inventoryList.size()) - userInterface._inventoryTopIndex = size() - 4; + userInterface._inventoryTopIndex = _inventoryList.size() - 5; userInterface._inventoryChanged = true; (*this)[objectId]._roomNumber = PLAYER_INVENTORY; -- cgit v1.2.3 From 6f8517a2770b6c20496cb70460a8ddfc9964b8f3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 26 May 2014 12:33:24 -0400 Subject: MADS: Fix compiler warning --- engines/mads/resources.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/resources.cpp b/engines/mads/resources.cpp index 745583b516..0bb95debdf 100644 --- a/engines/mads/resources.cpp +++ b/engines/mads/resources.cpp @@ -394,7 +394,7 @@ void File::openFile(const Common::String &filename) { /*------------------------------------------------------------------------*/ void SynchronizedList::synchronize(Common::Serializer &s) { - int v; + int v = 0; int count = size(); s.syncAsUint16LE(count); -- cgit v1.2.3 From 5cc424fe778a6c677c5b816a8517fb8817a97b62 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 26 May 2014 20:10:45 +0300 Subject: FULLPIPE: Fix warning --- engines/fullpipe/motion.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index ad024ca16f..8ddd3f778a 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -1018,7 +1018,7 @@ MessageQueue *MovGraph::method50(StaticANIObject *ani, MovArr *movarr, int stati if (_items.size() == 0) return 0; - int idx; + uint idx; int movidx; bool done = false; -- cgit v1.2.3 From d951cb9bda5e4b37653feb581f26024a76885b58 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 26 May 2014 13:28:40 -0400 Subject: MADS: Add detection for alternate Rex 8.49 English --- engines/mads/detection_tables.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/engines/mads/detection_tables.h b/engines/mads/detection_tables.h index a5a9c33456..9995ccc66d 100644 --- a/engines/mads/detection_tables.h +++ b/engines/mads/detection_tables.h @@ -62,6 +62,24 @@ static const MADSGameDescription gameDescriptions[] = { 0 }, + { + // Rex Nebular and the Cosmic Gender Bender DOS English 8.49 Atlernate + { + "nebular", + 0, + { + { "section1.hag", 0, "d583576923e3437937fb7f46f4b6274f", 927222 }, + AD_LISTEND + }, + Common::EN_ANY, + Common::kPlatformDOS, + ADGF_NO_FLAGS, + GUIO1(GUIO_NONE) + }, + GType_RexNebular, + 0 + }, + { // Return of the Phantom DOS English { -- cgit v1.2.3 From 2878863fa486fdbf2cc2593a8c1ce633434e375e Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 26 May 2014 21:22:51 +0300 Subject: MADS: Add more friendly names for action verbs and nouns --- engines/mads/nebular/game_nebular.cpp | 24 ++++++++++---------- engines/mads/nebular/nebular_scenes.h | 21 ++++++++++++++---- engines/mads/nebular/nebular_scenes2.cpp | 10 ++++----- engines/mads/nebular/nebular_scenes3.cpp | 8 +++---- engines/mads/nebular/nebular_scenes4.cpp | 8 +++---- engines/mads/nebular/nebular_scenes5.cpp | 10 ++++----- engines/mads/nebular/nebular_scenes6.cpp | 38 ++++++++++++++++---------------- engines/mads/nebular/nebular_scenes7.cpp | 26 +++++++++++----------- 8 files changed, 79 insertions(+), 66 deletions(-) diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index 51e06d092c..f3b085606a 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -296,9 +296,9 @@ void GameNebular::doObjectAction() { dialogs.show(444); } else if (action.isAction(VERB_EAT, NOUN_STUFFED_FISH)) { dialogs.show(445); - } else if (action.isAction(401, 289)) { + } else if (action.isAction(VERB_WEAR, NOUN_REBREATHER)) { dialogs.show(scene._currentSceneId > 103 && scene._currentSceneId < 111 ? 446 : 447); - } else if (action.isAction(306, 371)) { + } else if (action.isAction(VERB_SET, 371)) { dialogs.show(448); } else if (action.isAction(951, 35)) { dialogs.show(449); @@ -320,7 +320,7 @@ void GameNebular::doObjectAction() { dialogs.show(456); } else if (action.isAction(1189, OBJ_VASE)) { dialogs.show(457); - } else if (action.isAction(306, 369)) { + } else if (action.isAction(VERB_SET, 369)) { dialogs.show(458); } else if (action.isAction(1192, 774)) { dialogs.show(459); @@ -551,7 +551,7 @@ void GameNebular::doObjectAction() { _globals[kDurafailRecharged] = _difficulty != 1 || _globals[kHandsetCellStatus] ? 1 : 2; dialogs.show(425); } - } else if (action.isAction(306, 369)) { + } else if (action.isAction(VERB_SET, 369)) { dialogs.show(427); } else if (action.isAction(VERB_PUT, 42, 73) || action.isAction(VERB_PUT, 43, 73)) { _objects.setRoom(OBJ_CHICKEN, PLAYER_INVENTORY); @@ -578,7 +578,7 @@ void GameNebular::unhandledAction() { if (action.isAction(VERB_THROW, NOUN_BOMB) || action.isAction(VERB_THROW, NOUN_BOMBS) || action.isAction(VERB_THROW, NOUN_TIMEBOMB) || action.isAction(VERB_THROW, NOUN_CHICKEN_BOMB)) _vm->_dialogs->show(42); - else if (action.isAction(0x6C)) + else if (action.isAction(VERB_DISASSEMBLE)) _vm->_dialogs->show(435); else if ((action.isAction(VERB_EAT, NOUN_DEAD_FISH) || action.isAction(VERB_EAT, NOUN_STUFFED_FISH)) && _vm->_game->_objects.isInInventory(_vm->_game->_objects.getIdFromDesc(action._activeAction._objectNameId))) _vm->_dialogs->show(12); @@ -589,10 +589,10 @@ void GameNebular::unhandledAction() { else if ((action.isAction(VERB_SHOOT) || action.isAction(VERB_HOSE_DOWN)) && action.isObject(NOUN_BLOWGUN)) { if ((_scene._currentSceneId >= 104) && (_scene._currentSceneId <= 111)) _vm->_dialogs->show(38); - else if (action.isAction(0x10D)) + else if (action.isObject(NOUN_PIRANHA)) _vm->_dialogs->show(41); - else if (action.isObject(NOUN_CHICKEN) || action.isAction(0x185) || action.isAction(0x14D) - || action.isAction(0x1DD) || action.isAction(0x15F) || action.isObject(NOUN_CAPTIVE_CREATURE)) { + else if (action.isObject(NOUN_CHICKEN) || action.isObject(NOUN_VULTURE) || action.isObject(NOUN_SPIDER) + || action.isObject(NOUN_YELLOW_BIRD) || action.isObject(NOUN_SWOOPING_CREATURE) || action.isObject(NOUN_CAPTIVE_CREATURE)) { _vm->_dialogs->show(40); } else _vm->_dialogs->show(39); @@ -618,7 +618,7 @@ void GameNebular::unhandledAction() { else _vm->_dialogs->show(6); } else if (action.isAction(VERB_LOOK)) { - if (action.isAction(0x27) && (action._activeAction._indirectObjectId > 0)) + if (action.isObject(NOUN_BINOCULARS) && (action._activeAction._indirectObjectId > 0)) _vm->_dialogs->show(10); else if (randVal < 600) _vm->_dialogs->show(7); @@ -667,9 +667,9 @@ void GameNebular::unhandledAction() { _vm->_dialogs->show(28); else _vm->_dialogs->show(29); - } else if (!action.isAction(VERB_WALKTO) && !action.isAction(0x187) && !action.isAction(0x18C) && !action.isAction(0x1AD) - && !action.isAction(0x15C) && !action.isAction(0x159) && !action.isAction(0x15A) && !action.isAction(0x15B) - && !action.isAction(0x15E)) { + } else if (!action.isAction(VERB_WALKTO) && !action.isAction(VERB_WALK_ACROSS) && !action.isAction(VERB_WALK_TOWARDS) && !action.isAction(VERB_WALK_DOWN) + && !action.isAction(VERB_SWIM_TO) && !action.isAction(VERB_SWIM_ACROSS) && !action.isAction(VERB_SWIM_INTO) && !action.isAction(VERB_SWIM_THROUGH) + && !action.isAction(VERB_SWIM_UNDER)) { if (randVal <= 100) _vm->_dialogs->show(36); else if (randVal <= 200) diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index 8df43e92e9..822aa5689c 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -49,10 +49,12 @@ enum Verb { VERB_CLIMB_UP = 0x050, VERB_CUT = 0x061, VERB_DAMPEN = 0x064, + VERB_DISASSEMBLE = 0x06C, VERB_DIVE_INTO = 0x06D, VERB_DRINK = 0x072, VERB_EAT = 0x075, VERB_EXAMINE = 0x07D, + VERB_FILL = 0x085, VERB_HOSE_DOWN = 0x0A6, VERB_IGNITE = 0x0B4, VERB_INFLATE = 0x0B5, @@ -67,19 +69,26 @@ enum Verb { VERB_PRESS = 0x11A, VERB_PRY = 0x11C, VERB_READ = 0x11F, + VERB_SET = 0x132, + VERB_SHARPEN = 0x134, VERB_SHOOT = 0x13A, VERB_SIT_IN = 0x13F, VERB_SMELL = 0x147, VERB_STARE_AT = 0x155, + VERB_SWIM_ACROSS = 0x159, VERB_SWIM_INTO = 0x15A, VERB_SWIM_THROUGH = 0x15B, VERB_SWIM_TO = 0x15C, VERB_SWIM_TOWARDS = 0x15D, VERB_SWIM_UNDER = 0x15E, + VERB_TIE = 0x170, VERB_UNLOCK = 0x17B, + VERB_WALK_ACROSS = 0x187, VERB_WALK_INSIDE = 0x188, + VERB_WALK_OUTSIDE = 0x18A, VERB_WALK_THROUGH = 0x18B, VERB_WALK_TOWARDS = 0x18C, + VERB_WEAR = 0x191, VERB_WALK_DOWN = 0x1AD, VERB_LEAVE = 0x1CD, VERB_EXIT_FROM = 0x1CE, @@ -93,12 +102,16 @@ enum Verb { VERB_CLIMB_INTO = 0x2F7, VERB_STEP_INTO = 0x2F9, VERB_CRAWL_TO = 0x2FB, + VERB_CRAWL_DOWN = 0x301, VERB_SIT_ON = 0x30B, VERB_WALK_ALONG = 0x312, + VERB_GET_INSIDE = 0x325, VERB_WALK = 0x32F, VERB_REFLECT = 0x365, VERB_GET_INTO = 0x36A, + VERB_STEER_TOWARDS = 0x3B1, VERB_ENTER = 0x3B8, + VERB_PUT_DOWN = 0x46F, VERB_INSTALL = 0x474, VERB_REMOVE = 0x476 }; @@ -236,7 +249,7 @@ enum Noun { NOUN_FIELD_TO_NORTH = 0x82, NOUN_FIELD_TO_SOUTH = 0x83, NOUN_FIELD_TO_WEST = 0x84, - NOUN_FILL = 0x85, + //NOUN_FILL = 0x85, NOUN_FIRE_PIT = 0x86, NOUN_FISHING_LINE = 0x87, NOUN_FISHING_ROD = 0x88, @@ -411,7 +424,7 @@ enum Noun { NOUN_SECURITY_CARD = 0x131, //NOUN_SET = 0x132, NOUN_SHAKE_HANDS = 0x133, - NOUN_SHARPEN = 0x134, + //NOUN_SHARPEN = 0x134, NOUN_SHIELD_ACCESS_PANEL = 0x135, NOUN_SHIELD_GENERATOR = 0x136, NOUN_SHIELD_MODULATOR = 0x137, @@ -1048,7 +1061,7 @@ enum Noun { NOUN_DASH = 0x3AE, NOUN_SPLASH = 0x3AF, NOUN_DOCK_TO_SOUTH = 0x3B0, - NOUN_STEER_TOWARDS = 0x3B1, + //NOUN_STEER_TOWARDS = 0x3B1, NOUN_BUILDING_TO_NORTH = 0x3B2, NOUN_VOLCANO_RIM = 0x3B3, NOUN_OPEN_WATER_TO_SOUTH = 0x3B4, @@ -1238,7 +1251,7 @@ enum Noun { NOUN_NAME_PLATE = 0x46C, NOUN_OLD_VASE = 0x46D, NOUN_PORTRAIT = 0x46E, - NOUN_PUT_DOWN = 0x46F, + //NOUN_PUT_DOWN = 0x46F, NOUN_TALL_BUILDING = 0x470, NOUN_OBNOXIOUS_DOG = 0x471, NOUN_GUTS = 0x472, diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index f93ea3931d..3562a62994 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -1581,9 +1581,9 @@ void Scene207::preActions() { _game._player._walkOffScreenSceneId = 208; if ((_action.isAction(VERB_WALKTO)) || (_action.isAction(VERB_LOOK))) { - if (_action.isAction(0x185)) { + if (_action.isObject(NOUN_VULTURE)) { _vultureTime = -9999; - } else if (_action.isAction(0x14D)) { + } else if (_action.isObject(NOUN_SPIDER)) { _spiderTime = -9999; } } @@ -3551,7 +3551,7 @@ void Scene209::actions() { } if (_action.isAction(VERB_THROW, NOUN_MONKEY) && _game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId))) { - if (!_action.isAction(0x114)) { + if (!_action.isObject(NOUN_POISON_DARTS)) { _vm->_dialogs->show(20915); } _action._inProgress = false; @@ -5102,7 +5102,7 @@ void Scene214::step() { void Scene214::actions() { if (_action._lookFlag) _vm->_dialogs->show(21427); - else if (_action.isAction(0x18A, 0xAA)) + else if (_action.isAction(VERB_WALK_OUTSIDE, 0xAA)) _scene->_nextSceneId = 207; else if (_action.isAction(VERB_TAKE, NOUN_POISON_DARTS) && (_game._trigger || _game._objects.isInRoom(OBJ_POISON_DARTS))) { switch (_game._trigger) { @@ -5313,7 +5313,7 @@ void Scene215::actions() { _scene->_kernelMessages.reset(); _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(idx)); } - } else if (_action.isAction(0x18A, 0xAA)) + } else if (_action.isAction(VERB_WALK_OUTSIDE, 0xAA)) _scene->_nextSceneId = 210; else if (_action.isAction(VERB_LOOK, NOUN_BEAR_RUG)) _vm->_dialogs->show(21501); diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index d54ffbdb2b..a5bf1872a4 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -1153,7 +1153,7 @@ void Scene307::actions() { _vm->_dialogs->show(30713); else if (_action.isAction(VERB_LOOK, NOUN_TOILET)) _vm->_dialogs->show(30714); - else if (_action.isAction(0x134, 0x12C)) + else if (_action.isAction(VERB_SHARPEN, NOUN_SCALPEL)) _vm->_dialogs->show(30716); else if (_action.isAction(VERB_LOOK, NOUN_CELL_WALL)) _vm->_dialogs->show(30717); @@ -1926,7 +1926,7 @@ void Scene313::actions() { _vm->_dialogs->show(31301); } _scene->_nextSceneId = 366; - } else if (!_action.isAction(0x301, 0x2D4)) + } else if (!_action.isAction(VERB_CRAWL_DOWN, NOUN_AIR_SHAFT)) return; _action._inProgress = false; @@ -3134,7 +3134,7 @@ void Scene319::enter() { _slacheInitFl = true; if (_globals[kRexHasMetSlache]) { - handleSlacheDialogs(0x18A, 2, 9999999); + handleSlacheDialogs(VERB_WALK_OUTSIDE, 2, 9999999); _slachePosY = 3; } else { handleSlacheDialogs(0x186, 4, 9999999); @@ -4279,7 +4279,7 @@ void Scene352::preActions() { if (_action.isAction(VERB_OPEN, NOUN_VAULT)) _game._player.walk(Common::Point(266, 111), FACING_NORTHEAST); - if (_vaultOpenFl && !_action.isAction(0x1F8) && !_action.isAction(0x2F6) && !_action.isAction(0x2F5) && !_action.isAction(0x2F4)) { + if (_vaultOpenFl && !_action.isObject(NOUN_VAULT) && !_action.isObject(NOUN_LAMP) && !_action.isObject(NOUN_OTHER_STUFF) && !_action.isObject(NOUN_YOUR_STUFF)) { if (_globals[kHaveYourStuff]) { _commonSpriteIndex = _globals._spriteIndexes[13]; _commonSequenceIdx = _globals._sequenceIndexes[13]; diff --git a/engines/mads/nebular/nebular_scenes4.cpp b/engines/mads/nebular/nebular_scenes4.cpp index b1b2b098af..d803b62ecd 100644 --- a/engines/mads/nebular/nebular_scenes4.cpp +++ b/engines/mads/nebular/nebular_scenes4.cpp @@ -2032,7 +2032,7 @@ void Scene402::preActions() { _game._player._needToWalk = true; if (_roxOnStool) { - if (_action.isAction(VERB_LOOK) || _action.isAction(0x24A) || _action.isAction(VERB_TALKTO)) + if (_action.isAction(VERB_LOOK) || _action.isObject(NOUN_BAR_STOOL) || _action.isAction(VERB_TALKTO)) _game._player._needToWalk = false; if (_action.isAction(VERB_TAKE, NOUN_REPAIR_LIST) || _action.isAction(VERB_TAKE, NOUN_CREDIT_CHIP)) @@ -2917,7 +2917,7 @@ void Scene408::enter() { } void Scene408::preActions() { - if ((_action.isAction(VERB_TAKE) && !_action.isAction(0x167)) || _action.isAction(VERB_PULL, NOUN_PIN) || _action.isAction(VERB_OPEN, NOUN_CARTON)) + if ((_action.isAction(VERB_TAKE) && !_action.isObject(NOUN_TARGET_MODULE)) || _action.isAction(VERB_PULL, NOUN_PIN) || _action.isAction(VERB_OPEN, NOUN_CARTON)) _game._player._needToWalk = false; if ((_action.isAction(VERB_LOOK, NOUN_TARGET_MODULE) && _game._objects.isInRoom(OBJ_TARGET_MODULE)) || _action.isAction(VERB_LOOK, NOUN_CHEST)) @@ -3160,7 +3160,7 @@ void Scene410::step() { } void Scene410::preActions() { - if (_action.isAction(VERB_TAKE) && !_action.isAction(0x48)) + if (_action.isAction(VERB_TAKE) && !_action.isObject(NOUN_CHARGE_CASES)) _game._player._needToWalk = false; if (_action.isAction(VERB_LOOK, NOUN_CHARGE_CASES) && _game._objects.isInRoom(OBJ_CHARGE_CASES)) @@ -3934,7 +3934,7 @@ void Scene411::actions() { _vm->_dialogs->showItem(OBJ_FORMALDEHYDE, 41124); if (_action.isAction(VERB_PUT, NOUN_KETTLE)) { - if (_action.isAction(0x2D7) || _action.isAction(0x2D6) || _action.isAction(0x3A9) || _action.isAction(0x306)) { + if (_action.isObject(NOUN_PETROX) || _action.isObject(NOUN_FORMALDEHYDE) || _action.isObject(NOUN_LECITHIN) || _action.isObject(NOUN_ALIEN_LIQUOR)) { _newIngredient = _game._objects.getIdFromDesc(_action._activeAction._objectNameId); switch (_newIngredient) { case (OBJ_ALIEN_LIQUOR): diff --git a/engines/mads/nebular/nebular_scenes5.cpp b/engines/mads/nebular/nebular_scenes5.cpp index a8c6b22591..822fbdf6ba 100644 --- a/engines/mads/nebular/nebular_scenes5.cpp +++ b/engines/mads/nebular/nebular_scenes5.cpp @@ -1994,10 +1994,10 @@ void Scene511::preActions() { if (!_handingLine) return; - if (_action.isAction(VERB_LOOK) || _action.isAction(0x87) || _action.isAction(VERB_TALKTO)) + if (_action.isAction(VERB_LOOK) || _action.isObject(NOUN_FISHING_LINE) || _action.isAction(VERB_TALKTO)) _game._player._needToWalk = false; - if ((!_action.isAction(0x170, 0x87, 0x345) || !_action.isAction(0x19, 0x87, 0x345)) && _game._player._needToWalk) { + if ((!_action.isAction(VERB_TIE, NOUN_FISHING_LINE, NOUN_BOAT) || !_action.isAction(VERB_ATTACH, NOUN_FISHING_LINE, NOUN_BOAT)) && _game._player._needToWalk) { if (_game._trigger == 0) { _game._player._readyToWalk = false; _game._player._stepEnabled = false; @@ -2085,7 +2085,7 @@ void Scene511::actions() { } else { _vm->_dialogs->show(51130); } - } else if (_action.isAction(0x170, 0x87, 0x345) || _action.isAction(0x19, 0x87, 0x345)) { + } else if (_action.isAction(VERB_TIE, NOUN_FISHING_LINE, NOUN_BOAT) || _action.isAction(VERB_ATTACH, NOUN_FISHING_LINE, NOUN_BOAT)) { if (_globals[kBoatRaised]) _vm->_dialogs->show(51131); else if (_globals[kLineStatus] == 1) @@ -2141,8 +2141,8 @@ void Scene511::actions() { else if (_action.isAction(VERB_UNLOCK, 0xFF, 0x37C) || _action.isAction(VERB_UNLOCK, 0x6F, 0x37C)) _vm->_dialogs->show(51119); else if ( (_action.isAction(VERB_PUT) || _action.isAction(VERB_THROW)) - && (_action.isAction(0x171) || _action.isAction(0x2A) || _action.isAction(0x2B)) - && _action.isAction(0x37C)) + && (_action.isObject(NOUN_TIMEBOMB) || _action.isObject(NOUN_BOMB) || _action.isObject(NOUN_BOMBS)) + && _action.isObject(NOUN_DOME_ENTRANCE)) _vm->_dialogs->show(51120); else if (_action.isAction(VERB_LOOK, NOUN_RESTAURANT)) { if (_globals[kBoatRaised]) diff --git a/engines/mads/nebular/nebular_scenes6.cpp b/engines/mads/nebular/nebular_scenes6.cpp index 1821a72c16..62315503de 100644 --- a/engines/mads/nebular/nebular_scenes6.cpp +++ b/engines/mads/nebular/nebular_scenes6.cpp @@ -149,7 +149,7 @@ void Scene601::step() { void Scene601::actions() { if (_action.isAction(VERB_WALK_THROUGH, NOUN_ENTRANCE)) _scene->_nextSceneId = 602; - else if (_action.isAction(0x325, 0x324)) { + else if (_action.isAction(VERB_GET_INSIDE, NOUN_CAR)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -688,9 +688,9 @@ void Scene603::actions() { } else if (_action.isAction(VERB_LOOK, NOUN_COMPACT_CASE) && (_action._mainObjectSource == 4)) _vm->_dialogs->show(60329); // For the next two checks, the second part of the check wasn't surrounded par parenthesis, which was obviously wrong - else if (_action.isAction(VERB_LOOK) && (_action.isAction(0x31) || _action.isAction(0x3EA) || _action.isAction(0x3E8))) + else if (_action.isAction(VERB_LOOK) && (_action.isObject(NOUN_BRA) || _action.isObject(NOUN_BOA) || _action.isObject(NOUN_SLIP))) _vm->_dialogs->show(60331); - else if (_action.isAction(VERB_TAKE) && (_action.isAction(0x31) || _action.isAction(0x3EA) || _action.isAction(0x3E8))) + else if (_action.isAction(VERB_TAKE) && (_action.isObject(NOUN_BRA) || _action.isObject(NOUN_BOA) || _action.isObject(NOUN_SLIP))) _vm->_dialogs->show(60332); else return; @@ -904,7 +904,7 @@ void Scene604::handleBombActions() { } void Scene604::actions() { - if (_action.isAction(0x325, 0x324)) { + if (_action.isAction(VERB_GET_INSIDE, NOUN_CAR)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -943,9 +943,9 @@ void Scene604::actions() { break; } } else if ((_action.isAction(VERB_PUT, NOUN_LEDGE) || _action.isAction(VERB_PUT, NOUN_VIEWPORT) || _action.isAction(VERB_THROW, NOUN_VIEWPORT)) - && (_action.isAction(0x2A) || _action.isAction(0x2B))) + && (_action.isObject(NOUN_BOMB) || _action.isObject(NOUN_BOMBS))) _vm->_dialogs->show(60420); - else if (_action.isAction(VERB_PUT, NOUN_TIMEBOMB, 0x3F6) || _action.isAction(VERB_PUT, NOUN_TIMEBOMB, 0x181)) { + else if (_action.isAction(VERB_PUT, NOUN_TIMEBOMB, NOUN_LEDGE) || _action.isAction(VERB_PUT, NOUN_TIMEBOMB, NOUN_VIEWPORT)) { _bombMode = 1; if ((_game._difficulty == DIFFICULTY_HARD) || _globals[kWarnedFloodCity]) handleBombActions(); @@ -1393,7 +1393,7 @@ void Scene607::preActions() { void Scene607::actions() { if (_action.isAction(VERB_WALK_THROUGH, NOUN_SIDE_ENTRANCE)) _scene->_nextSceneId = 608; - else if (_action.isAction(0x325, 0x324)) { + else if (_action.isAction(VERB_GET_INSIDE, NOUN_CAR)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -1490,7 +1490,7 @@ void Scene607::actions() { _vm->_dialogs->show(60728); else if (_action.isAction(VERB_WALK_DOWN, NOUN_STREET)) _vm->_dialogs->show(60730); - else if (_action.isAction(0x3FF) && (_action.isAction(VERB_OPEN) || _action.isAction(VERB_PUSH) || _action.isAction(VERB_PULL))) + else if (_action.isObject(NOUN_GARAGE_DOOR) && (_action.isAction(VERB_OPEN) || _action.isAction(VERB_PUSH) || _action.isAction(VERB_PULL))) _vm->_dialogs->show(60731); else return; @@ -2466,11 +2466,11 @@ void Scene608::actions() { _vm->_dialogs->show(60812); else _vm->_dialogs->show(60811); - } else if (_action.isAction(VERB_LOOK) && (_action.isAction(0x412) || _action.isAction(0x408) || _action.isAction(0x414) - || _action.isAction(0x40D) || _action.isAction(0x41C))) + } else if (_action.isAction(VERB_LOOK) && (_action.isObject(NOUN_MUFFLER) || _action.isObject(NOUN_CAR_SEAT) || _action.isObject(NOUN_HUBCAP) + || _action.isObject(NOUN_COILS) || _action.isObject(NOUN_QUARTER_PANEL))) _vm->_dialogs->show(60813); - else if (_action.isAction(VERB_TAKE) && (_action.isAction(0x412) || _action.isAction(0x408) || _action.isAction(0x414) - || _action.isAction(0x40D) || _action.isAction(0x41C))) + else if (_action.isAction(VERB_TAKE) && (_action.isObject(NOUN_MUFFLER) || _action.isObject(NOUN_CAR_SEAT) || _action.isObject(NOUN_HUBCAP) + || _action.isObject(NOUN_COILS) || _action.isObject(NOUN_QUARTER_PANEL))) _vm->_dialogs->show(60814); else if (_action.isAction(VERB_LOOK, NOUN_GARAGE_FLOOR) || _action.isAction(VERB_LOOK, NOUN_FRONT_OF_GARAGE) || _action.isAction(VERB_LOOK, NOUN_REAR_OF_GARAGE)) { if (_dogActiveFl) @@ -2790,7 +2790,7 @@ void Scene609::actions() { } else if (_action.isAction(VERB_UNLOCK, 0x6F, 0x425)) { _videoDoorMode = 1; enterStore(); - } else if (_action.isAction(0x325, 0x324)) { + } else if (_action.isAction(VERB_GET_INSIDE, NOUN_CAR)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -3046,10 +3046,10 @@ void Scene610::actions() { else if (_action.isAction(VERB_PUT, NOUN_RETURN_SLOT) && _game._objects.isInInventory(_game._objects.getIdFromDesc(_action._activeAction._objectNameId))) _vm->_dialogs->show(61029); - else if ( _action.isAction(0x44F) || _action.isAction(0x444) || _action.isAction(0x430) - || _action.isAction(0x44C) || _action.isAction(0x44D) || _action.isAction(0x446) - || _action.isAction(0x497) || _action.isAction(0x449) || _action.isAction(0x44E) - || _action.isAction(0x450) || _action.isAction(0x42C)) { + else if ( _action.isObject(NOUN_CLASSIC_VIDEOS) || _action.isObject(NOUN_MORE_CLASSIC_VIDEOS) || _action.isObject(NOUN_DRAMA_VIDEOS) + || _action.isObject(NOUN_NEW_RELEASE_VIDEOS) || _action.isObject(NOUN_PORNO_VIDEOS) || _action.isObject(NOUN_EDUCATIONAL_VIDEOS) + || _action.isObject(NOUN_INSTRUCTIONAL_VIDEOS) || _action.isObject(NOUN_WORKOUT_VIDEOS) || _action.isObject(NOUN_FOREIGN_VIDEOS) + || _action.isObject(NOUN_ADVENTURE_VIDEOS) || _action.isObject(NOUN_COMEDY_VIDEOS)) { if (_action.isAction(VERB_LOOK)) _vm->_dialogs->show(61030); else if (_action.isAction(VERB_TAKE)) @@ -4441,7 +4441,7 @@ void Scene611::actions() { _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(nextQuote)); _scene->_sequences.addTimer(120, 90); } - } else if ((_action.isAction(VERB_WALKTO) || _action.isAction(VERB_LOOK)) && _action.isAction(0x275)) { + } else if ((_action.isAction(VERB_WALKTO) || _action.isAction(VERB_LOOK)) && _action.isObject(NOUN_RAT)) { switch (_game._trigger) { case 0: _scene->_kernelMessages.reset(); @@ -4633,7 +4633,7 @@ void Scene612::step() { } void Scene612::actions() { - if (_action.isAction(0x325, 0x324)) { + if (_action.isAction(VERB_GET_INSIDE, NOUN_CAR)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index 08b85bfbd4..605484707f 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -1028,7 +1028,7 @@ void Scene703::step() { void Scene703::actions() { if (_game._screenObjects._inputMode == 1) handleFillBottle(_action._activeAction._verbId); - else if (_action.isAction(0x3B1, 0x3B0)) { + else if (_action.isAction(VERB_STEER_TOWARDS, 0x3B0)) { _game._player._stepEnabled = false; if (_globals[kMonsterAlive]) _curSequence = 8; @@ -1036,7 +1036,7 @@ void Scene703::actions() { _curSequence = 5; else _curSequence = 3; - } else if (_action.isAction(0x3B1, 0x3B2)) { + } else if (_action.isAction(VERB_STEER_TOWARDS, 0x3B2)) { _game._player._stepEnabled = false; if (_globals[kMonsterAlive]) { _startMonsterTimer = false; @@ -1078,7 +1078,7 @@ void Scene703::actions() { _scene->freeAnimation(); _monsterMode = 2; _scene->loadAnimation(formAnimName('C', -1)); - } else if (_action.isAction(VERB_PUT, NOUN_BOTTLE, 0x18F) || _action.isAction(0x85, 0x2E, 0x18F)) { + } else if (_action.isAction(VERB_PUT, NOUN_BOTTLE, NOUN_WATER) || _action.isAction(VERB_FILL, NOUN_BOTTLE, NOUN_WATER)) { if (_globals[kBottleStatus] != 4) { handleBottleInterface(); _dialog1.start(); @@ -1414,13 +1414,13 @@ void Scene704::step() { void Scene704::actions() { if (_game._screenObjects._inputMode == 1) handleFillBottle(_action._activeAction._verbId); - else if (_action.isAction(0x3B1, 0x3B4)) { + else if (_action.isAction(VERB_STEER_TOWARDS, 0x3B4)) { _game._player._stepEnabled = false; if (_boatDirection == 1) _animationMode = 5; else _animationMode = 3; - } else if (_action.isAction(0x3B1, 0x3B2)) { + } else if (_action.isAction(VERB_STEER_TOWARDS, 0x3B2)) { _game._player._stepEnabled = false; if (_boatDirection == 2) _animationMode = 4; @@ -1436,7 +1436,7 @@ void Scene704::actions() { _animationMode = 7; } } - } else if (_action.isAction(VERB_PUT, NOUN_BOTTLE, 0x18F) || _action.isAction(0x85, 0x2E, 0x18F)) { + } else if (_action.isAction(VERB_PUT, NOUN_BOTTLE, NOUN_WATER) || _action.isAction(VERB_FILL, NOUN_BOTTLE, NOUN_WATER)) { if (_game._objects.isInInventory(OBJ_BOTTLE)) { if (_globals[kBottleStatus] != 4) { _takeBottleFl = false; @@ -1664,7 +1664,7 @@ void Scene705::step() { void Scene705::actions() { if (_game._screenObjects._inputMode == 1) handleFillBottle(_action._activeAction._verbId); - else if (_action.isAction(0x3B1, 0x3B4)) { + else if (_action.isAction(VERB_STEER_TOWARDS, 0x3B4)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -1710,7 +1710,7 @@ void Scene705::actions() { default: break; } - } else if (_action.isAction(0x85, 0x2E, 0x18F) || _action.isAction(VERB_PUT, NOUN_BOTTLE, 0x18F)) { + } else if (_action.isAction(VERB_FILL, NOUN_BOTTLE, NOUN_WATER) || _action.isAction(VERB_PUT, NOUN_BOTTLE, NOUN_WATER)) { if (_globals[kBottleStatus] != 4) { handleBottleInterface(); _dialog1.start(); @@ -2106,7 +2106,7 @@ void Scene710::step() { } void Scene710::actions() { - if (_action.isAction(0x46F, 0x27)) { + if (_action.isAction(VERB_PUT_DOWN, 0x27)) { _game._player._stepEnabled = false; if (_game._globals[kCityFlooded]) @@ -2319,10 +2319,10 @@ void Scene751::preActions() { if (!_rexHandingLine) return; - if (_action.isAction(VERB_LOOK) || _action.isAction(0x87) || _action.isAction(VERB_TALKTO)) + if (_action.isAction(VERB_LOOK) || _action.isObject(NOUN_FISHING_LINE) || _action.isAction(VERB_TALKTO)) _game._player._needToWalk = false; - if ((!_action.isAction(VERB_PUT, NOUN_FISHING_LINE, 0x467) || !_action.isAction(0x170, 0x87, 0x467) || !_action.isAction(0x19, 0x87, 0x467)) + if ((!_action.isAction(VERB_PUT, NOUN_FISHING_LINE, 0x467) || !_action.isAction(VERB_TIE, NOUN_FISHING_LINE, 0x467) || !_action.isAction(VERB_ATTACH, NOUN_FISHING_LINE, 0x467)) && (_game._player._needToWalk)) { switch (_game._trigger) { case 0: @@ -2419,7 +2419,7 @@ void Scene751::actions() { default: break; } - } else if (_action.isAction(VERB_PUT, NOUN_FISHING_LINE, 0x467) || _action.isAction(0x170, 0x87, 0x467) || _action.isAction(0x19, 0x87, 0x467)) { + } else if (_action.isAction(VERB_PUT, NOUN_FISHING_LINE, 0x467) || _action.isAction(VERB_TIE, NOUN_FISHING_LINE, 0x467) || _action.isAction(VERB_ATTACH, NOUN_FISHING_LINE, 0x467)) { if (_globals[kLineStatus] == 1) { switch (_game._trigger) { case 0: @@ -2490,7 +2490,7 @@ void Scene751::actions() { _vm->_dialogs->show(75121); else if (_action.isAction(VERB_LOOK, NOUN_TALL_BUILDING)) _vm->_dialogs->show(75122); - else if (_action.isAction(0x170, 0x87, 0x316) || _action.isAction(0x19, 0x87, 0x316)) + else if (_action.isAction(VERB_TIE, NOUN_FISHING_LINE, 0x316) || _action.isAction(VERB_ATTACH, NOUN_FISHING_LINE, 0x316)) _vm->_dialogs->show(75123); else return; -- cgit v1.2.3 From 40fe6193b168ebb4b5dfa9ebc489e791559afc13 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 26 May 2014 20:42:16 +0200 Subject: MADS: Fix a bug in scene 701 (door sprite playing in weird orders) --- engines/mads/nebular/nebular_scenes7.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index 605484707f..b31a35913b 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -233,7 +233,7 @@ void Scene701::step() { case 72: _vm->_sound->command(17); - _globals._sequenceIndexes[1] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[1], false, 5, 1, 0, 0); + _globals._sequenceIndexes[1] = _scene->_sequences.addReverseSpriteCycle(_globals._spriteIndexes[1], false, 5, 1, 0, 0); _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(48, 136)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[1], SEQUENCE_TRIGGER_EXPIRE, 0, 73); -- cgit v1.2.3 From 0f57a33fb97146bca2e18de8619824e00d6325a8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 26 May 2014 15:10:25 -0400 Subject: MADS: Fix spelling of Rex Alternate detection entry --- engines/mads/detection_tables.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/detection_tables.h b/engines/mads/detection_tables.h index 9995ccc66d..e68ae380d0 100644 --- a/engines/mads/detection_tables.h +++ b/engines/mads/detection_tables.h @@ -63,7 +63,7 @@ static const MADSGameDescription gameDescriptions[] = { }, { - // Rex Nebular and the Cosmic Gender Bender DOS English 8.49 Atlernate + // Rex Nebular and the Cosmic Gender Bender DOS English 8.49 Alternate { "nebular", 0, -- cgit v1.2.3 From 8d31150c09ff87ad5d4aced74e4f0d53c633466a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 26 May 2014 15:12:11 -0400 Subject: VOYEUR: Fix showing credits in the introduction --- engines/voyeur/voyeur.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp index 9843930bd3..9be1dad831 100644 --- a/engines/voyeur/voyeur.cpp +++ b/engines/voyeur/voyeur.cpp @@ -500,8 +500,9 @@ void VoyeurEngine::doOpening() { if (textPic) { _graphicsManager->sDrawPic(textPic, _graphicsManager->_vPort, textPos); - flipPageAndWait(); } + + flipPageAndWait(); } _eventsManager->getMouseInfo(); -- cgit v1.2.3 From 76ea8c5a20cd8ef77ce5706a9c972a65a941db26 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 26 May 2014 22:37:41 +0300 Subject: MADS: Add more friendly names for action verbs and nouns Also, add a TODO in doObjectAction() --- engines/mads/nebular/game_nebular.cpp | 116 ++++++++++++++++--------------- engines/mads/nebular/nebular_scenes.h | 45 ++++++++---- engines/mads/nebular/nebular_scenes1.cpp | 4 +- 3 files changed, 96 insertions(+), 69 deletions(-) diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index f3b085606a..c6fa60b19a 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -298,81 +298,81 @@ void GameNebular::doObjectAction() { dialogs.show(445); } else if (action.isAction(VERB_WEAR, NOUN_REBREATHER)) { dialogs.show(scene._currentSceneId > 103 && scene._currentSceneId < 111 ? 446 : 447); - } else if (action.isAction(VERB_SET, 371)) { + } else if (action.isAction(VERB_SET, NOUN_TIMER_MODULE)) { dialogs.show(448); - } else if (action.isAction(951, 35)) { + } else if (action.isAction(VERB_NIBBLE_ON, NOUN_BIG_LEAVES)) { dialogs.show(449); - } else if (action.isAction(203, 276)) { + } else if (action.isAction(VERB_LICK, NOUN_POISON_DARTS)) { dialogs.show(450); - } else if (action.isAction(VERB_EAT, 378)) { + } else if (action.isAction(VERB_EAT, NOUN_TWINKIFRUIT)) { _objects.setRoom(OBJ_TWINKIFRUIT, PLAYER_INVENTORY); dialogs.show(451); - } else if (action.isAction(153, 378)) { + } else if (action.isAction(VERB_GORGE_ON, NOUN_TWINKIFRUIT)) { _objects.setRoom(OBJ_TWINKIFRUIT, PLAYER_INVENTORY); dialogs.show(452); - } else if (action.isAction(152)) { + } else if (action.isAction(VERB_GNAW_ON)) { dialogs.show(453); - } else if (action.isAction(1187, OBJ_PHONE_CELLS)) { + } else if (action.isAction(VERB_MASSAGE, NOUN_AUDIO_TAPE)) { dialogs.show(454); - } else if (action.isAction(1188, 92)) { + } else if (action.isAction(VERB_MANGLE, NOUN_CREDIT_CHIP)) { dialogs.show(455); - } else if (action.isAction(140, 72)) { + } else if (action.isAction(VERB_FONDLE, NOUN_CHARGE_CASES)) { dialogs.show(456); - } else if (action.isAction(1189, OBJ_VASE)) { + } else if (action.isAction(VERB_RUB, NOUN_BOMB)) { dialogs.show(457); - } else if (action.isAction(VERB_SET, 369)) { + } else if (action.isAction(VERB_SET, NOUN_TIMEBOMB)) { dialogs.show(458); - } else if (action.isAction(1192, 774)) { + } else if (action.isAction(VERB_GUZZLE, NOUN_ALIEN_LIQUOR)) { dialogs.show(459); - } else if (action.isAction(1191, 359)) { + } else if (action.isAction(VERB_SMASH, NOUN_TARGET_MODULE)) { dialogs.show(460); - } else if (action.isAction(1190)) { + } else if (action.isAction(VERB_JUGGLE)) { dialogs.show(461); - } else if (action.isAction(934, 277)) { + } else if (action.isAction(VERB_APPLY, NOUN_POLYCEMENT)) { dialogs.show(462); - } else if (action.isAction(329, 277)) { + } else if (action.isAction(VERB_SNIFF, NOUN_POLYCEMENT)) { dialogs.show(465); - } else if (action.isAction(368, 135)) { + } else if (action.isAction(VERB_TIE, NOUN_FISHING_LINE)) { dialogs.show(463); - } else if (action.isAction(25, 135)) { + } else if (action.isAction(VERB_ATTACH, NOUN_FISHING_LINE)) { dialogs.show(463); - } else if (action.isAction(379)) { + } else if (action.isAction(VERB_UNLOCK)) { dialogs.show(464); - } else if (action.isAction(869)) { + } else if (action.isAction(VERB_REFLECT)) { dialogs.show(466); - } else if (action.isAction(530, 288)) { + } else if (action.isAction(VERB_GAZE_INTO, NOUN_REARVIEW_MIRROR)) { dialogs.show(467); - } else if (action.isAction(VERB_EAT, 74)) { + } else if (action.isAction(VERB_EAT, NOUN_CHICKEN_BOMB)) { dialogs.show(469); - } else if (action.isAction(50, 381)) { + } else if (action.isAction(VERB_BREAK, NOUN_VASE)) { dialogs.show(471); - } else if (action.isAction(307, 950)) { + } else if (action.isAction(VERB_SHAKE_HANDS, NOUN_GUARDS_ARM2)) { dialogs.show(472); } else if (action.isAction(VERB_READ, NOUN_LOG)) { dialogs.show(473); - } else if (action.isAction(1189, 43)) { + } else if (action.isAction(VERB_RUB, NOUN_BOMBS)) { dialogs.show(474); - } else if (action.isAction(114, 726)) { + } else if (action.isAction(VERB_DRINK, NOUN_FORMALDEHYDE)) { dialogs.show(475); - } else if (action.isAction(114, 727)) { + } else if (action.isAction(VERB_DRINK, NOUN_PETROX)) { dialogs.show(476); - } else if (action.isAction(114, 937)) { + } else if (action.isAction(VERB_DRINK, NOUN_LECITHIN)) { dialogs.show(477); - } else if (action.isAction(VERB_PUT, 276, NOUN_PLANT_STALK) && _objects.isInInventory(OBJ_POISON_DARTS) + } else if (action.isAction(VERB_PUT, NOUN_POISON_DARTS, NOUN_PLANT_STALK) && _objects.isInInventory(OBJ_POISON_DARTS) && _objects.isInInventory(OBJ_PLANT_STALK)) { _objects.addToInventory(OBJ_BLOWGUN); _objects.setRoom(OBJ_PLANT_STALK, NOWHERE); _globals[kBlowgunStatus] = 0; dialogs.showItem(OBJ_BLOWGUN, 809); - } else if (action.isAction(VERB_PUT, 276, NOUN_BLOWGUN) && _objects.isInInventory(OBJ_POISON_DARTS) + } else if (action.isAction(VERB_PUT, NOUN_POISON_DARTS, NOUN_BLOWGUN) && _objects.isInInventory(OBJ_POISON_DARTS) && _objects.isInInventory(OBJ_BLOWGUN)) { dialogs.show(433); - } else if (action.isAction(1161) && action.isAction(1195) && action.isAction(1197)) { + } else if (action.isAction(VERB_DEFACE) && action.isAction(VERB_FOLD) && action.isAction(VERB_MUTILATE)) { dialogs.show(434); - } else if (action.isAction(1196)) { + } else if (action.isAction(VERB_SPINDLE)) { dialogs.show(479); - } else if ((action.isAction(287) || action.isAction(VERB_LOOK_AT) || action.isAction(VERB_LOOK)) && - action.isAction(936) && _objects.isInInventory(OBJ_NOTE)) { + } else if ((action.isAction(VERB_READ) || action.isAction(VERB_LOOK_AT) || action.isAction(VERB_LOOK)) && + action.isObject(NOUN_NOTE) && _objects.isInInventory(OBJ_NOTE)) { _objects.setRoom(OBJ_NOTE, PLAYER_INVENTORY); _objects.addToInventory(OBJ_COMBINATION); dialogs.showItem(OBJ_COMBINATION, 851); @@ -419,20 +419,26 @@ void GameNebular::doObjectAction() { _objects.addToInventory(OBJ_STUFFED_FISH); dialogs.showItem(OBJ_STUFFED_FISH, 803); } - } else if (action.isAction(VERB_PUT, 26, 357) && _objects.isInInventory(OBJ_AUDIO_TAPE) && + } else if (action.isAction(VERB_PUT, NOUN_AUDIO_TAPE, NOUN_TAPE_PLAYER) && _objects.isInInventory(OBJ_AUDIO_TAPE) && _objects.isInInventory(OBJ_TAPE_PLAYER)) { - _objects.setRoom(OBJ_AUDIO_TAPE, 25); - } else if (action.isAction(118, 357) && _objects.isInInventory(OBJ_TAPE_PLAYER)) { - if (_objects[OBJ_AUDIO_TAPE]._roomNumber == 25) { + _objects.setRoom(OBJ_AUDIO_TAPE, OBJ_TAPE_PLAYER); + } else if (action.isAction(VERB_ACTIVATE, NOUN_TAPE_PLAYER) && _objects.isInInventory(OBJ_TAPE_PLAYER)) { + if (_objects[OBJ_AUDIO_TAPE]._roomNumber == OBJ_TAPE_PLAYER) { + warning("TODO: Show the recipe"); + } else { + dialogs.show(406); + } + } else if (action.isAction(VERB_EJECT, NOUN_TAPE_PLAYER) && _objects.isInInventory(OBJ_TAPE_PLAYER)) { + if (_objects[OBJ_AUDIO_TAPE]._roomNumber == OBJ_TAPE_PLAYER) { _objects.addToInventory(OBJ_AUDIO_TAPE); } else { dialogs.show(407); } - } else if (action.isAction(108, 357)) { + } else if (action.isAction(VERB_DISASSEMBLE, NOUN_TAPE_PLAYER)) { dialogs.show(408); - } else if (action.isAction(14, 291)) { + } else if (action.isAction(VERB_ACTIVATE, NOUN_REMOTE)) { dialogs.show(_globals[kTopButtonPushed] ? 502 : 501); - } else if ((action.isAction(25, 106, 72) || action.isAction(VERB_PUT, 106, 72)) && + } else if ((action.isAction(VERB_ATTACH, NOUN_DETONATORS, NOUN_CHARGE_CASES) || action.isAction(VERB_PUT, NOUN_DETONATORS, NOUN_CHARGE_CASES)) && _objects.isInInventory(OBJ_DETONATORS) && _objects.isInInventory(OBJ_CHARGE_CASES)) { if (_objects[OBJ_CHARGE_CASES].getQuality(3)) { _objects.setRoom(OBJ_CHARGE_CASES, 1); @@ -442,10 +448,10 @@ void GameNebular::doObjectAction() { } else { dialogs.show(405); } - } else if (action.isAction(25, 106)) { + } else if (action.isAction(VERB_ATTACH, NOUN_DETONATORS)) { dialogs.show(470); - } else if ((action.isAction(25, 371, 43) || action.isAction(7, 371, 43) || action.isAction(25, 371, 42) - || action.isAction(VERB_PUT, 371, 42)) && _objects.isInInventory(OBJ_TIMER_MODULE) && ( + } else if ((action.isAction(VERB_ATTACH, NOUN_TIMER_MODULE, NOUN_BOMBS) || action.isAction(VERB_PUT, NOUN_TIMER_MODULE, NOUN_BOMBS) || action.isAction(VERB_ATTACH, NOUN_TIMER_MODULE, NOUN_BOMB) + || action.isAction(VERB_PUT, NOUN_TIMER_MODULE, NOUN_BOMB)) && _objects.isInInventory(OBJ_TIMER_MODULE) && ( _objects.isInInventory(OBJ_BOMBS) || _objects.isInInventory(OBJ_BOMB))) { if (_objects.isInInventory(OBJ_BOMBS)) { _objects.setRoom(OBJ_BOMBS, PLAYER_INVENTORY); @@ -457,19 +463,19 @@ void GameNebular::doObjectAction() { _objects.setRoom(OBJ_TIMER_MODULE, PLAYER_INVENTORY); _objects.addToInventory(OBJ_TIMEBOMB); dialogs.showItem(OBJ_TIMEBOMB, 404); - } else if (action.isAction(140, 271)) { + } else if (action.isAction(VERB_FONDLE, NOUN_PLANT_STALK)) { dialogs.show(410); - } else if (action.isAction(119, 46)) { + } else if (action.isAction(VERB_EMPTY, NOUN_BOTTLE)) { _globals[kBottleStatus] = 0; dialogs.show(432); - } else if (action.isAction(108, 136)) { + } else if (action.isAction(VERB_DISASSEMBLE, NOUN_FISHING_ROD)) { if (_objects[OBJ_FISHING_LINE]._roomNumber == 3) { _objects.addToInventory(OBJ_FISHING_LINE); dialogs.showItem(OBJ_FISHING_LINE, 409); } else { dialogs.show(428); } - } else if (action.isAction(108, 262)) { + } else if (action.isAction(VERB_DISASSEMBLE, NOUN_PENLIGHT)) { switch (_globals[kPenlightCellStatus]) { case 1: case 2: @@ -492,7 +498,7 @@ void GameNebular::doObjectAction() { dialogs.show(478); break; } - } else if (action.isAction(108, 264)) { + } else if (action.isAction(VERB_DISASSEMBLE, NOUN_PHONE_HANDSET)) { switch (_globals[kHandsetCellStatus]) { case 1: _objects.addToInventory(OBJ_DURAFAIL_CELLS); @@ -519,7 +525,7 @@ void GameNebular::doObjectAction() { dialogs.show(478); break; } - } else if (action.isAction(VERB_PUT, 263, 262)) { + } else if (action.isAction(VERB_PUT, NOUN_PHONE_CELLS, NOUN_PENLIGHT)) { if (_globals[kPenlightCellStatus] == 0) { _globals[kPenlightCellStatus] = 3; _objects.setRoom(OBJ_PHONE_CELLS, PLAYER_INVENTORY); @@ -527,7 +533,7 @@ void GameNebular::doObjectAction() { } else { dialogs.show(420); } - } else if (action.isAction(VERB_PUT, 263, 264)) { + } else if (action.isAction(VERB_PUT, NOUN_PHONE_CELLS, NOUN_PHONE_HANDSET)) { if (_globals[kHandsetCellStatus] == 0) { _globals[kHandsetCellStatus] = 3; _objects.setRoom(OBJ_PHONE_CELLS, PLAYER_INVENTORY); @@ -535,7 +541,7 @@ void GameNebular::doObjectAction() { } else { dialogs.show(422); } - } else if (action.isAction(VERB_PUT, 115, 262)) { + } else if (action.isAction(VERB_PUT, NOUN_DURAFAIL_CELLS, NOUN_PENLIGHT)) { if (_globals[kPenlightCellStatus]) { dialogs.show(424); } else { @@ -543,7 +549,7 @@ void GameNebular::doObjectAction() { _globals[kPenlightCellStatus] = _difficulty != 1 || _globals[kDurafailRecharged] ? 1 : 2; dialogs.show(423); } - } else if (action.isAction(VERB_PUT, 115, 264)) { + } else if (action.isAction(VERB_PUT, NOUN_DURAFAIL_CELLS, NOUN_PHONE_HANDSET)) { if (_globals[kHandsetCellStatus]) { dialogs.show(424); } else { @@ -551,9 +557,9 @@ void GameNebular::doObjectAction() { _globals[kDurafailRecharged] = _difficulty != 1 || _globals[kHandsetCellStatus] ? 1 : 2; dialogs.show(425); } - } else if (action.isAction(VERB_SET, 369)) { + } else if (action.isAction(VERB_SET, NOUN_TIMEBOMB)) { dialogs.show(427); - } else if (action.isAction(VERB_PUT, 42, 73) || action.isAction(VERB_PUT, 43, 73)) { + } else if (action.isAction(VERB_PUT, NOUN_BOMB, NOUN_CHICKEN) || action.isAction(VERB_PUT, NOUN_BOMBS, NOUN_CHICKEN)) { _objects.setRoom(OBJ_CHICKEN, PLAYER_INVENTORY); if (_objects.isInInventory(OBJ_BOMBS)) { _objects.setRoom(OBJ_BOMBS, PLAYER_INVENTORY); diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index 822aa5689c..516d58d30e 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -53,14 +53,20 @@ enum Verb { VERB_DIVE_INTO = 0x06D, VERB_DRINK = 0x072, VERB_EAT = 0x075, + VERB_EJECT = 0x076, + VERB_EMPTY = 0x077, VERB_EXAMINE = 0x07D, VERB_FILL = 0x085, + VERB_FONDLE = 0x08C, VERB_HOSE_DOWN = 0x0A6, VERB_IGNITE = 0x0B4, VERB_INFLATE = 0x0B5, VERB_INSERT = 0x0B6, VERB_INSPECT = 0x0B7, + VERB_GNAW_ON = 0x098, + VERB_GORGE_ON = 0x099, VERB_HURL = 0x0A9, + VERB_LICK = 0x0CB, VERB_LOOK_AT = 0x0D1, VERB_LOOK_IN = 0x0D2, VERB_LOOK_THROUGH = 0x0D3, @@ -70,10 +76,12 @@ enum Verb { VERB_PRY = 0x11C, VERB_READ = 0x11F, VERB_SET = 0x132, + VERB_SHAKE_HANDS = 0x133, VERB_SHARPEN = 0x134, VERB_SHOOT = 0x13A, VERB_SIT_IN = 0x13F, VERB_SMELL = 0x147, + VERB_SNIFF = 0x149, VERB_STARE_AT = 0x155, VERB_SWIM_ACROSS = 0x159, VERB_SWIM_INTO = 0x15A, @@ -93,6 +101,7 @@ enum Verb { VERB_LEAVE = 0x1CD, VERB_EXIT_FROM = 0x1CE, VERB_USE = 0x20C, + VERB_GAZE_INTO = 0x212, VERB_SIT_AT = 0x21F, VERB_WALK_UP = 0x227, VERB_WALK_INTO = 0x242, @@ -109,11 +118,23 @@ enum Verb { VERB_WALK = 0x32F, VERB_REFLECT = 0x365, VERB_GET_INTO = 0x36A, + VERB_APPLY = 0x3A6, VERB_STEER_TOWARDS = 0x3B1, + VERB_NIBBLE_ON = 0x3B7, VERB_ENTER = 0x3B8, VERB_PUT_DOWN = 0x46F, VERB_INSTALL = 0x474, - VERB_REMOVE = 0x476 + VERB_REMOVE = 0x476, + VERB_DEFACE = 0x489, + VERB_MASSAGE = 0x4A3, + VERB_MANGLE = 0x4A4, + VERB_RUB = 0x4A5, + VERB_JUGGLE = 0x4A6, + VERB_SMASH = 0x4A7, + VERB_GUZZLE = 0x4A8, + VERB_FOLD = 0x4AB, + VERB_SPINDLE = 0x4AC, + VERB_MUTILATE = 0x4AD }; enum Noun { @@ -423,7 +444,7 @@ enum Noun { NOUN_SEAWEED_BANK = 0x130, NOUN_SECURITY_CARD = 0x131, //NOUN_SET = 0x132, - NOUN_SHAKE_HANDS = 0x133, + //NOUN_SHAKE_HANDS = 0x133, //NOUN_SHARPEN = 0x134, NOUN_SHIELD_ACCESS_PANEL = 0x135, NOUN_SHIELD_GENERATOR = 0x136, @@ -1277,7 +1298,7 @@ enum Noun { NOUN_ICE_CHESTS = 0x486, NOUN_BIRDS = 0x487, NOUN_DOCTORS_OFFICE = 0x488, - NOUN_DEFACE = 0x489, + //NOUN_DEFACE = 0x489, NOUN_LARGE_HEADS = 0x48A, NOUN_SMALL_TABLE = 0x48B, NOUN_COLLOSSEUM = 0x48C, @@ -1303,16 +1324,16 @@ enum Noun { NOUN_HAT = 0x4A0, NOUN_LOGO = 0x4A1, NOUN_MAINTENANCE_BUILDING = 0x4A2, - NOUN_MASSAGE = 0x4A3, - NOUN_MANGLE = 0x4A4, - NOUN_RUB = 0x4A5, - NOUN_JUGGLE = 0x4A6, - NOUN_SMASH = 0x4A7, - NOUN_GUZZLE = 0x4A8, + //NOUN_MASSAGE = 0x4A3, + //NOUN_MANGLE = 0x4A4, + //NOUN_RUB = 0x4A5, + //NOUN_JUGGLE = 0x4A6, + //NOUN_SMASH = 0x4A7, + //NOUN_GUZZLE = 0x4A8, NOUN_WEST_END_OF_PLATFORM = 0x4A9, - NOUN_EAST_END_OF_PLATFORM = 0x4AA, - NOUN_FOLD = 0x4AB, - NOUN_SPINDLE = 0x4AC + NOUN_EAST_END_OF_PLATFORM = 0x4AA + //NOUN_FOLD = 0x4AB, + //NOUN_SPINDLE = 0x4AC, //NOUN_MUTILATE = 0x4AD }; diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index cd3b90089e..bd99888ed2 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -1592,10 +1592,10 @@ void Scene103::actions() { } void Scene103::postActions() { - if (_action.isAction(27) && !_action.isAction(VERB_WALKTO)) { + if (_action.isObject(NOUN_AUXILIARY_POWER) && !_action.isAction(VERB_WALKTO)) { _vm->_dialogs->show(10305); _action._inProgress = false; - } else if (_action.isAction(VERB_PUT, 85, 144)) { + } else if (_action.isAction(VERB_PUT, NOUN_COAL, NOUN_FURNACE)) { Common::String msg = _game.getQuote(73); _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, msg); _action._inProgress = false; -- cgit v1.2.3 From 4e47f42853d69ee6bb3ccf7bfa3d073c598d451e Mon Sep 17 00:00:00 2001 From: D G Turner Date: Mon, 26 May 2014 20:45:47 +0100 Subject: VOYEUR: Make engine pointer in graphics class private. --- engines/voyeur/graphics.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engines/voyeur/graphics.h b/engines/voyeur/graphics.h index 221d31061d..41a1bafaca 100644 --- a/engines/voyeur/graphics.h +++ b/engines/voyeur/graphics.h @@ -61,7 +61,6 @@ typedef void (GraphicsManager::*ViewPortRestorePtr)(ViewPortResource *); class GraphicsManager { public: - VoyeurEngine *_vm; byte _VGAColors[PALETTE_SIZE]; PictureResource *_backgroundPage; int _SVGAMode; @@ -77,6 +76,8 @@ public: DrawInfo *_drawPtr; DrawInfo _defaultDrawInfo; private: + VoyeurEngine *_vm; + void restoreBack(Common::Array &rectList, int rectListCount, PictureResource *srcPic, PictureResource *destPic); public: -- cgit v1.2.3 From f0cdc47226db90ce99f2e83f0a2643e49d71d3ed Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 26 May 2014 21:46:37 +0200 Subject: MADS: Fix issue in KernelMessages::processText() --- engines/mads/messages.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/messages.cpp b/engines/mads/messages.cpp index 263d8fa661..e85a582cda 100644 --- a/engines/mads/messages.cpp +++ b/engines/mads/messages.cpp @@ -173,7 +173,7 @@ void KernelMessages::processText(int msgIndex) { if ((msg._flags & KMSG_EXPIRE) != 0) { scene._textDisplay.expire(msg._textDisplayIndex); - msg._flags &= !KMSG_ACTIVE; + msg._flags &= ~KMSG_ACTIVE; return; } -- cgit v1.2.3 From 7579005ff1153d4eefe2914d0210a46ee3d88719 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 26 May 2014 22:52:18 +0300 Subject: MADS: Implement the recipe showing functionality --- engines/mads/nebular/game_nebular.cpp | 47 ++++++++++++++++++++++++++++++++++- engines/mads/nebular/game_nebular.h | 2 ++ 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index c6fa60b19a..75d1ff169e 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -278,6 +278,51 @@ void GameNebular::checkShowDialog() { } } +void GameNebular::showRecipe() { + Dialogs &dialogs = *_vm->_dialogs; + int count; + + for (count = 0; count < 4; count++) { + switch(_globals[kIngredientQuantity + count]) { + case 0: + dialogs._indexList[count] = NOUN_DROP; + break; + case 1: + dialogs._indexList[count] = NOUN_DOLLOP; + break; + case 2: + dialogs._indexList[count] = NOUN_DASH; + break; + case 3: + dialogs._indexList[count] = NOUN_SPLASH; + break; + default: + break; + } + } + + for (count = 0; count < 4; count++) { + switch(_globals[kIngredientList + count]) { + case 0: + dialogs._indexList[count + 4] = NOUN_ALCOHOL; + break; + case 1: + dialogs._indexList[count + 4] = NOUN_LECITHIN; + break; + case 2: + dialogs._indexList[count + 4] = NOUN_PETROX; + break; + case 3: + dialogs._indexList[count + 4] = NOUN_FORMALDEHYDE; + break; + default: + break; + } + } + + _vm->_dialogs->show(401); +} + void GameNebular::doObjectAction() { Scene &scene = _scene; MADSAction &action = _scene._action; @@ -424,7 +469,7 @@ void GameNebular::doObjectAction() { _objects.setRoom(OBJ_AUDIO_TAPE, OBJ_TAPE_PLAYER); } else if (action.isAction(VERB_ACTIVATE, NOUN_TAPE_PLAYER) && _objects.isInInventory(OBJ_TAPE_PLAYER)) { if (_objects[OBJ_AUDIO_TAPE]._roomNumber == OBJ_TAPE_PLAYER) { - warning("TODO: Show the recipe"); + showRecipe(); } else { dialogs.show(406); } diff --git a/engines/mads/nebular/game_nebular.h b/engines/mads/nebular/game_nebular.h index da252219f4..56bcf44a3f 100644 --- a/engines/mads/nebular/game_nebular.h +++ b/engines/mads/nebular/game_nebular.h @@ -117,6 +117,8 @@ public: virtual void doObjectAction(); + void showRecipe(); + virtual void unhandledAction(); virtual void step(); -- cgit v1.2.3 From b22fc841cef5aa5ad182ac0c0a3d1c373013478c Mon Sep 17 00:00:00 2001 From: D G Turner Date: Mon, 26 May 2014 21:05:49 +0100 Subject: MADS: Fix missing initialization in Nebular dialogs class. Fixes CID #1216229. --- engines/mads/nebular/dialogs_nebular.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/nebular/dialogs_nebular.h b/engines/mads/nebular/dialogs_nebular.h index 643d440d67..99a93f81cc 100644 --- a/engines/mads/nebular/dialogs_nebular.h +++ b/engines/mads/nebular/dialogs_nebular.h @@ -39,7 +39,7 @@ private: int _dialogWidth; CapitalizationMode _capitalizationMode; - DialogsNebular(MADSEngine *vm): Dialogs(vm) {} + DialogsNebular(MADSEngine *vm): Dialogs(vm), _capitalizationMode(kUppercase) {} virtual Common::String getVocab(int vocabId); -- cgit v1.2.3 From 9d1fb0871cb7bbac150478531b2704d608f0c8d9 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 26 May 2014 23:05:01 +0300 Subject: MADS: Add more friendly names for action verbs and nouns --- engines/mads/nebular/game_nebular.cpp | 2 +- engines/mads/nebular/nebular_scenes6.cpp | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index 75d1ff169e..28daf74488 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -658,7 +658,7 @@ void GameNebular::unhandledAction() { _scene._kernelMessages.reset(); _scene._kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, tmpMsg); } - } else if (action.isAction(VERB_GIVE, NOUN_DOOR, 0x46) || action.isAction(VERB_CLOSE, NOUN_CHAIR)) + } else if (action.isAction(VERB_GIVE, NOUN_DOOR, NOUN_CEILING) || action.isAction(VERB_CLOSE, NOUN_CHAIR)) _vm->_dialogs->show(3); else if (action.isAction(VERB_THROW)) { int objId = _vm->_game->_objects.getIdFromDesc(action._activeAction._objectNameId); diff --git a/engines/mads/nebular/nebular_scenes6.cpp b/engines/mads/nebular/nebular_scenes6.cpp index 62315503de..fb1fcf5361 100644 --- a/engines/mads/nebular/nebular_scenes6.cpp +++ b/engines/mads/nebular/nebular_scenes6.cpp @@ -97,7 +97,7 @@ void Scene601::enter() { if (_globals[kLaserHoleIsThere]) { _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, -2); - _scene->_dynamicHotspots.add(NOUN_LASER_BEAM, 0xD1, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + _scene->_dynamicHotspots.add(NOUN_LASER_BEAM, VERB_LOOK_AT, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); } _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, -1); @@ -411,14 +411,14 @@ void Scene602::actions() { _safeMode = 2; _cycleIndex = -1; handleSafeActions(); - } else if (_action.isAction(VERB_UNLOCK, 0x3A7, 0x3D3)) { + } else if (_action.isAction(VERB_UNLOCK, NOUN_COMBINATION, NOUN_SAFE)) { if ((_globals[kSafeStatus] == 0) && (_game._difficulty != DIFFICULTY_HARD)) { _safeMode = 3; _cycleIndex = -2; handleSafeActions(); } - } else if ((_action.isAction(VERB_PUT, NOUN_REARVIEW_MIRROR, 0x343) || _action.isAction(VERB_PUT, NOUN_COMPACT_CASE, 0x343) - || _action.isAction(VERB_REFLECT, 0x57, 0x343) || _action.isAction(VERB_REFLECT, 0x120, 0x343)) && (_globals[kSafeStatus] == 0)) { + } else if ((_action.isAction(VERB_PUT, NOUN_REARVIEW_MIRROR, NOUN_LASER_BEAM) || _action.isAction(VERB_PUT, NOUN_COMPACT_CASE, NOUN_LASER_BEAM) + || _action.isAction(VERB_REFLECT, NOUN_COMPACT_CASE, NOUN_LASER_BEAM) || _action.isAction(VERB_REFLECT, NOUN_REARVIEW_MIRROR, NOUN_LASER_BEAM)) && (_globals[kSafeStatus] == 0)) { switch (_game._trigger) { case 0: _vm->_dialogs->show(60230); @@ -522,7 +522,7 @@ void Scene602::actions() { _vm->_dialogs->show(60235); else _vm->_dialogs->show(60236); - } else if (_action.isAction(VERB_UNLOCK, 0x6F, 0x3D3) || _action.isAction(VERB_UNLOCK, 0xFF, 0x3D3)) + } else if (_action.isAction(VERB_UNLOCK, NOUN_DOOR_KEY, NOUN_SAFE) || _action.isAction(VERB_UNLOCK, NOUN_PADLOCK_KEY, NOUN_SAFE)) _vm->_dialogs->show(60225); else if (_action.isAction(VERB_PULL, NOUN_SAFE)) _vm->_dialogs->show(60226); @@ -534,7 +534,7 @@ void Scene602::actions() { _vm->_dialogs->show(60229); else if (_action.isAction(VERB_LOOK, NOUN_FLOWER_BOX)) _vm->_dialogs->show(60231); - else if (_action.isAction(VERB_THROW, NOUN_BOMB, 0x3D3) || _action.isAction(VERB_THROW, NOUN_BOMBS, 0x3D3)) + else if (_action.isAction(VERB_THROW, NOUN_BOMB, NOUN_SAFE) || _action.isAction(VERB_THROW, NOUN_BOMBS, NOUN_SAFE)) _vm->_dialogs->show(60232); else if (_action.isAction(VERB_PUT, NOUN_TIMEBOMB)) _vm->_dialogs->show(60233); @@ -1383,10 +1383,10 @@ void Scene607::preActions() { _dogTimer = 0; } - if (_action.isAction(VERB_THROW, NOUN_BONES, 0x471) || _action.isAction(VERB_THROW, NOUN_BONE, 0x471)) + if (_action.isAction(VERB_THROW, NOUN_BONES, NOUN_OBNOXIOUS_DOG) || _action.isAction(VERB_THROW, NOUN_BONE, NOUN_OBNOXIOUS_DOG)) _game._player.walk(Common::Point(193, 100), FACING_NORTHEAST); - if (_action.isAction(VERB_THROW, NOUN_BONES, 0x2C3) || _action.isAction(VERB_THROW, NOUN_BONE, 0x2C3)) + if (_action.isAction(VERB_THROW, NOUN_BONES, NOUN_FENCE) || _action.isAction(VERB_THROW, NOUN_BONE, NOUN_FENCE)) _game._player.walk(Common::Point(201, 107), FACING_SOUTHEAST); } @@ -1430,7 +1430,7 @@ void Scene607::actions() { default: break; } - } else if (_action.isAction(VERB_THROW, NOUN_BONES, 0x471) || _action.isAction(VERB_THROW, NOUN_BONE, 0x471)) { + } else if (_action.isAction(VERB_THROW, NOUN_BONES, NOUN_OBNOXIOUS_DOG) || _action.isAction(VERB_THROW, NOUN_BONE, NOUN_OBNOXIOUS_DOG)) { if (_game._difficulty != DIFFICULTY_EASY) { _animationMode = 1; _scene->_kernelMessages.reset(); @@ -1439,7 +1439,7 @@ void Scene607::actions() { handleThrowingBone(); } - } else if ((_action.isAction(VERB_THROW, NOUN_BONES, 0x2C3) || _action.isAction(VERB_THROW, NOUN_BONE, 0x2C3)) && (_game._difficulty != DIFFICULTY_EASY) + } else if ((_action.isAction(VERB_THROW, NOUN_BONES, NOUN_FENCE) || _action.isAction(VERB_THROW, NOUN_BONE, NOUN_FENCE)) && (_game._difficulty != DIFFICULTY_EASY) && ((_globals[kDogStatus] == 1) || _game._trigger)) { _animationMode = 2; if (_game._trigger == 0) { @@ -4671,7 +4671,7 @@ void Scene612::actions() { default: break; } - } else if (_action.isAction(VERB_UNLOCK, 0xFF, 0x45F)) { + } else if (_action.isAction(VERB_UNLOCK, NOUN_PADLOCK_KEY, NOUN_CONTROL_BOX)) { _cycleIndex = -2; _actionMode = 1; handleWinchMovement(); -- cgit v1.2.3 From 8661afeaebb7c26857f1f78d54f35c01dd5258e6 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Mon, 26 May 2014 21:13:01 +0100 Subject: MADS: Remove unused field from SpriteAsset class. Fixes CID #1216230 and 1216231. --- engines/mads/assets.h | 1 - 1 file changed, 1 deletion(-) diff --git a/engines/mads/assets.h b/engines/mads/assets.h index 874eee7925..9242802187 100644 --- a/engines/mads/assets.h +++ b/engines/mads/assets.h @@ -67,7 +67,6 @@ private: int _frameCount; Common::Array _frameOffsets; Common::Array _frames; - uint32 _frameStartOffset; uint8 _mode; bool _isBackground; -- cgit v1.2.3 From c20fabb98082fe9237504b80e4f4049bd0fc687c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 26 May 2014 22:01:22 +0200 Subject: MADS: Remove obsolete comment in scene 608 --- engines/mads/nebular/nebular_scenes6.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes6.cpp b/engines/mads/nebular/nebular_scenes6.cpp index fb1fcf5361..feb2725b1f 100644 --- a/engines/mads/nebular/nebular_scenes6.cpp +++ b/engines/mads/nebular/nebular_scenes6.cpp @@ -1892,7 +1892,6 @@ void Scene608::step() { _dogTimer2 = _scene->_frameStartTime; } - // CHECKME: _checkFl is always false? if (_dogRunTimer >= 480 && !_checkFl && !_buttonPressedonTimeFl && !_dogFirstEncounter && _dogUnderCar && _dogActiveFl) { _checkFl = true; _dogSquashFl = false; @@ -1988,7 +1987,6 @@ void Scene608::step() { _nextTrigger = 2; } - if ((nextFrame >= 0) && (nextFrame != _scene->_activeAnimation->getCurrentFrame())) { _scene->_activeAnimation->setCurrentFrame(nextFrame); _carFrame = nextFrame; -- cgit v1.2.3 From b035333dfd67a4d14b6ae73d3bd293a751e5df97 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 26 May 2014 22:13:19 +0200 Subject: MADS: Remove dead code in scene 608, some rework --- engines/mads/nebular/nebular_scenes6.cpp | 32 +++----------------------------- 1 file changed, 3 insertions(+), 29 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes6.cpp b/engines/mads/nebular/nebular_scenes6.cpp index feb2725b1f..8101428aab 100644 --- a/engines/mads/nebular/nebular_scenes6.cpp +++ b/engines/mads/nebular/nebular_scenes6.cpp @@ -1925,72 +1925,46 @@ void Scene608::step() { if ((_carMode == 4) && (_scene->_activeAnimation != nullptr)) { if (_scene->_activeAnimation->getCurrentFrame() != _carFrame) { _carFrame = _scene->_activeAnimation->getCurrentFrame(); - int nextFrame = -1; if (_carFrame == 10) { _game._player._visible = true; _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; - } - - if (_carFrame == 56) { + } else if (_carFrame == 56) { resetDogVariables(); _animationMode = 0; _nextTrigger = 2; } - - if ((nextFrame >= 0) && (nextFrame != _scene->_activeAnimation->getCurrentFrame())) { - _scene->_activeAnimation->setCurrentFrame(nextFrame); - _carFrame = nextFrame; - } } } if ((_carMode == 5) && (_scene->_activeAnimation != nullptr)) { if (_scene->_activeAnimation->getCurrentFrame() != _carFrame) { _carFrame = _scene->_activeAnimation->getCurrentFrame(); - int nextFrame = -1; - if (_carFrame == 10) { _game._player._visible = true; _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; - } - - if (_carFrame == 52) { + } else if (_carFrame == 52) { resetDogVariables(); _animationMode = 0; _nextTrigger = 2; } - - if ((nextFrame >= 0) && (nextFrame != _scene->_activeAnimation->getCurrentFrame())) { - _scene->_activeAnimation->setCurrentFrame(nextFrame); - _carFrame = nextFrame; - } } } - if ((_carMode == 6) && (_scene->_activeAnimation != nullptr)) { if (_scene->_activeAnimation->getCurrentFrame() != _carFrame) { _carFrame = _scene->_activeAnimation->getCurrentFrame(); - int nextFrame = -1; if (_carFrame == 11) { _game._player._visible = true; _game._player._priorTimer = _scene->_activeAnimation->getNextFrameTimer() - _game._player._ticksAmount; - } - - if (_carFrame == 41) { + } else if (_carFrame == 41) { _globals._sequenceIndexes[10] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[10], false, 9, 0, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[10], 10, 11); _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 6); _dogUnderCar = true; _nextTrigger = 2; } - - if ((nextFrame >= 0) && (nextFrame != _scene->_activeAnimation->getCurrentFrame())) { - _scene->_activeAnimation->setCurrentFrame(nextFrame); - _carFrame = nextFrame; - } } } -- cgit v1.2.3 From f00b9c563fe53a87fd70c91419a4da4c3b7b044a Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 26 May 2014 22:19:13 +0200 Subject: MADS: Fix stupid bug in scene 501 --- engines/mads/nebular/nebular_scenes5.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/mads/nebular/nebular_scenes5.cpp b/engines/mads/nebular/nebular_scenes5.cpp index 822fbdf6ba..d4b67da190 100644 --- a/engines/mads/nebular/nebular_scenes5.cpp +++ b/engines/mads/nebular/nebular_scenes5.cpp @@ -396,6 +396,7 @@ void Scene501::actions() { case 2: case 3: handleSlotActions(); + break; case 4: _scene->_sequences.remove(_globals._sequenceIndexes[3]); -- cgit v1.2.3 From 5d4647bb4c198071be209a6ad7c8a53462deaa5d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 26 May 2014 23:04:35 +0200 Subject: MADS: Fix a couple of out of bound access in ASound7 and ASound8 --- engines/mads/nebular/sound_nebular.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/mads/nebular/sound_nebular.cpp b/engines/mads/nebular/sound_nebular.cpp index 6bc697459a..5d1daf1b3c 100644 --- a/engines/mads/nebular/sound_nebular.cpp +++ b/engines/mads/nebular/sound_nebular.cpp @@ -2670,7 +2670,7 @@ ASound7::ASound7(Audio::Mixer *mixer) : ASound(mixer, "asound.007", 0x1460) { } int ASound7::command(int commandId, int param) { - if (commandId > 38) + if (commandId > 37) return 0; _frameCounter = 0; @@ -2876,7 +2876,7 @@ ASound8::ASound8(Audio::Mixer *mixer) : ASound(mixer, "asound.008", 0x1490) { } int ASound8::command(int commandId, int param) { - if (commandId > 38) + if (commandId > 37) return 0; _frameCounter = 0; -- cgit v1.2.3 From cda1a9402ac9d993cf58373d43af5a78981166fb Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 26 May 2014 23:29:42 +0200 Subject: MADS: Initialize a variable in ScreenDialog --- engines/mads/nebular/dialogs_nebular.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp index a4a7694d2c..337cac865c 100644 --- a/engines/mads/nebular/dialogs_nebular.cpp +++ b/engines/mads/nebular/dialogs_nebular.cpp @@ -484,6 +484,7 @@ ScreenDialog::ScreenDialog(MADSEngine *vm) : _vm(vm), _selectedLine = 0; _dirFlag = false; _textLineCount = 0; + _screenId = 920; game.loadQuoteSet(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, -- cgit v1.2.3 From 8061a415c9f7db906d0b4fdcef13e6bf136dde19 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 27 May 2014 00:31:54 +0300 Subject: MADS: Add more friendly names for action verbs and nouns --- engines/mads/nebular/nebular_scenes.h | 2 +- engines/mads/nebular/nebular_scenes1.cpp | 16 ++++++------ engines/mads/nebular/nebular_scenes2.cpp | 20 +++++++-------- engines/mads/nebular/nebular_scenes3.cpp | 34 +++++++++++++------------- engines/mads/nebular/nebular_scenes4.cpp | 38 ++++++++++++++--------------- engines/mads/nebular/nebular_scenes5.cpp | 28 ++++++++++----------- engines/mads/nebular/nebular_scenes6.cpp | 28 ++++++++++----------- engines/mads/nebular/nebular_scenes7.cpp | 42 ++++++++++++++++---------------- engines/mads/nebular/nebular_scenes8.cpp | 22 ++++++++--------- 9 files changed, 115 insertions(+), 115 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes.h b/engines/mads/nebular/nebular_scenes.h index 516d58d30e..9f11291d37 100644 --- a/engines/mads/nebular/nebular_scenes.h +++ b/engines/mads/nebular/nebular_scenes.h @@ -1279,7 +1279,7 @@ enum Noun { NOUN_BIG_HEADS = 0x473, NOUN_INSTALL = 0x474, NOUN_LIFE_SUPPORT_MODULE = 0x475, - NOUN_REMOVE = 0x476, + //NOUN_REMOVE = 0x476, NOUN_LARGE_BLADE = 0x477, NOUN_SIDE_ENTRANCE = 0x478, NOUN_INDICATOR = 0x479, diff --git a/engines/mads/nebular/nebular_scenes1.cpp b/engines/mads/nebular/nebular_scenes1.cpp index bd99888ed2..b34fae42b0 100644 --- a/engines/mads/nebular/nebular_scenes1.cpp +++ b/engines/mads/nebular/nebular_scenes1.cpp @@ -206,7 +206,7 @@ void Scene101::enter() { _globals._sequenceIndexes[11] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[11], false, 3, 0, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[11], 17, 17); _scene->_hotspots.activate(NOUN_CHAIR, false); - _chairHotspotId = _scene->_dynamicHotspots.add(NOUN_CHAIR, 0x13F, -1, Common::Rect(159, 84, 159 + 33, 84 + 36)); + _chairHotspotId = _scene->_dynamicHotspots.add(NOUN_CHAIR, VERB_SIT_IN, -1, Common::Rect(159, 84, 159 + 33, 84 + 36)); if (_scene->_priorSceneId == 112) sayDang(); } else { @@ -394,7 +394,7 @@ void Scene101::actions() { _game._player._stepEnabled = true; _sittingFl = true; _scene->_hotspots.activate(71, false); - _chairHotspotId = _scene->_dynamicHotspots.add(71, 0x13F, -1, Common::Rect(159, 84, 159 + 33, 84 + 36)); + _chairHotspotId = _scene->_dynamicHotspots.add(NOUN_CHAIR, VERB_SIT_IN, -1, Common::Rect(159, 84, 159 + 33, 84 + 36)); if (!_action.isAction(VERB_LOOK, NOUN_VIEW_SCREEN)) { _action._inProgress = false; return; @@ -2618,7 +2618,7 @@ void Scene109::actions() { return; } - if ((_action.isAction(VERB_THROW) || _action.isAction(VERB_GIVE)) && (_action.isTarget(0x146) || _action.isTarget(0x178))) { + if ((_action.isAction(VERB_THROW) || _action.isAction(VERB_GIVE)) && (_action.isTarget(NOUN_SMALL_HOLE) || _action.isTarget(NOUN_TUNNEL))) { if (_action.isObject(NOUN_DEAD_FISH) || _action.isObject(NOUN_STUFFED_FISH) || _action.isObject(NOUN_BURGER)) { _throwingObjectId = _game._objects.getIdFromDesc(_action._activeAction._objectNameId); if (_throwingObjectId >= 0) { @@ -3000,11 +3000,11 @@ void Scene111::enter() { _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, 1); - int idx = _scene->_dynamicHotspots.add(NOUN_BATS, 0xD1, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_BATS, VERB_LOOK_AT, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(-2, 0), FACING_NONE); - idx = _scene->_dynamicHotspots.add(NOUN_BATS, 0xD1, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); + idx = _scene->_dynamicHotspots.add(NOUN_BATS, VERB_LOOK_AT, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(-2, 0), FACING_NONE); - idx = _scene->_dynamicHotspots.add(NOUN_BATS, 0xD1, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); + idx = _scene->_dynamicHotspots.add(NOUN_BATS, VERB_LOOK_AT, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(-2, 0), FACING_NONE); _launch1Fl = false; @@ -3055,14 +3055,14 @@ void Scene111::step() { _scene->_sequences.remove(_globals._sequenceIndexes[4]); _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 5, 1, 0, 0); _launch1Fl = true; - int idx = _scene->_dynamicHotspots.add(NOUN_BATS, 0xD1, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_BATS, VERB_LOOK_AT, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(-2, 0), FACING_NONE); } if (!_launched2Fl && (_vm->getRandomNumber(1, 30000) == 1)) { _scene->_sequences.remove(_globals._sequenceIndexes[5]); _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 5, 1, 0, 0); - int idx = _scene->_dynamicHotspots.add(NOUN_BATS, 0xD1, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_BATS, VERB_LOOK_AT, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(-2, 0), FACING_NONE); _launched2Fl = true; } diff --git a/engines/mads/nebular/nebular_scenes2.cpp b/engines/mads/nebular/nebular_scenes2.cpp index 3562a62994..5768275d29 100644 --- a/engines/mads/nebular/nebular_scenes2.cpp +++ b/engines/mads/nebular/nebular_scenes2.cpp @@ -871,7 +871,7 @@ void Scene202::actions() { _action._inProgress = false; return; } - } else if (((_action.isAction(VERB_LOOK, NOUN_BINOCULARS, 0x82)) || (_action.isAction(VERB_LOOK, NOUN_BINOCULARS, 0x1B6))) && (_globals[kSexOfRex] == SEX_MALE)) { + } else if (((_action.isAction(VERB_LOOK, NOUN_BINOCULARS, NOUN_FIELD_TO_NORTH)) || (_action.isAction(VERB_LOOK, NOUN_BINOCULARS, NOUN_STRANGE_DEVICE))) && (_globals[kSexOfRex] == SEX_MALE)) { if (!_ladderTopFl) { switch (_game._trigger) { case 0: @@ -1343,7 +1343,7 @@ void Scene205::actions() { } } else if (_action._lookFlag) _vm->_dialogs->show(20502); - else if (_action.isAction(VERB_LOOK, NOUN_BINOCULARS, 0x1C8)) + else if (_action.isAction(VERB_LOOK, NOUN_BINOCULARS, NOUN_OPPOSITE_BANK)) _vm->_dialogs->show(20518); else if (_action.isAction(VERB_TALKTO, NOUN_NATIVE_WOMAN)) { if (_game._trigger == 0) { @@ -3538,7 +3538,7 @@ void Scene209::actions() { return; } - if (_action.isAction(VERB_GIVE, NOUN_TWINKIFRUIT, 0xE3) || _action.isAction(VERB_THROW, NOUN_TWINKIFRUIT, 0xE3)) { + if (_action.isAction(VERB_GIVE, NOUN_TWINKIFRUIT, NOUN_MONKEY) || _action.isAction(VERB_THROW, NOUN_TWINKIFRUIT, NOUN_MONKEY)) { _vm->_dialogs->show(20909); _action._inProgress = false; return; @@ -3558,7 +3558,7 @@ void Scene209::actions() { return; } - if (_action.isAction(VERB_THROW, NOUN_POISON_DARTS, 0xE3)) { + if (_action.isAction(VERB_THROW, NOUN_POISON_DARTS, NOUN_MONKEY)) { _vm->_dialogs->show(20916); _action._inProgress = false; return; @@ -4442,7 +4442,7 @@ void Scene210::preActions() { } void Scene210::actions() { - if (_action.isAction(VERB_LOOK, NOUN_BINOCULARS, 0x1C0)) { + if (_action.isAction(VERB_LOOK, NOUN_BINOCULARS, NOUN_HUT_TO_NORTH)) { _vm->_dialogs->show(21017); } else if (_game._screenObjects._inputMode == 1) { handleConversations(); @@ -4847,7 +4847,7 @@ void Scene211::preActions() { void Scene211::actions() { if (_action._lookFlag && (_globals[kMonkeyStatus] == MONKEY_AMBUSH_READY)) _vm->_dialogs->show(21111); - else if (_action.isAction(VERB_LOOK, NOUN_BINOCULARS, 0x100)) + else if (_action.isAction(VERB_LOOK, NOUN_BINOCULARS, NOUN_PALM_TREE)) _vm->_dialogs->show(21116); else if (_action.isAction(VERB_LOOK, NOUN_BUSHY_FERN)) _vm->_dialogs->show(21101); @@ -5102,7 +5102,7 @@ void Scene214::step() { void Scene214::actions() { if (_action._lookFlag) _vm->_dialogs->show(21427); - else if (_action.isAction(VERB_WALK_OUTSIDE, 0xAA)) + else if (_action.isAction(VERB_WALK_OUTSIDE, NOUN_HUT)) _scene->_nextSceneId = 207; else if (_action.isAction(VERB_TAKE, NOUN_POISON_DARTS) && (_game._trigger || _game._objects.isInRoom(OBJ_POISON_DARTS))) { switch (_game._trigger) { @@ -5194,9 +5194,9 @@ void Scene214::actions() { _vm->_dialogs->show(21414); else if (_action.isAction(VERB_TALKTO, NOUN_CAPTIVE_CREATURE)) _vm->_dialogs->show(21415); - else if (_action.isAction(VERB_GIVE, NOUN_TWINKIFRUIT, 0x1C3)) + else if (_action.isAction(VERB_GIVE, NOUN_TWINKIFRUIT, NOUN_CAPTIVE_CREATURE)) _vm->_dialogs->show(21416); - else if (_action.isAction(VERB_SHOOT, 0x29, 0x1C3) || _action.isAction(VERB_HOSE_DOWN, 0x29, 0x1C3)) + else if (_action.isAction(VERB_SHOOT, NOUN_BLOWGUN, NOUN_CAPTIVE_CREATURE) || _action.isAction(VERB_HOSE_DOWN, NOUN_BLOWGUN, NOUN_CAPTIVE_CREATURE)) _vm->_dialogs->show(21417); else if (_action.isAction(VERB_LOOK, NOUN_BIG_HEADS)) _vm->_dialogs->show(21418); @@ -5313,7 +5313,7 @@ void Scene215::actions() { _scene->_kernelMessages.reset(); _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(idx)); } - } else if (_action.isAction(VERB_WALK_OUTSIDE, 0xAA)) + } else if (_action.isAction(VERB_WALK_OUTSIDE, NOUN_HUT)) _scene->_nextSceneId = 210; else if (_action.isAction(VERB_LOOK, NOUN_BEAR_RUG)) _vm->_dialogs->show(21501); diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp index a5bf1872a4..ff965ed5cb 100644 --- a/engines/mads/nebular/nebular_scenes3.cpp +++ b/engines/mads/nebular/nebular_scenes3.cpp @@ -804,7 +804,7 @@ void Scene307::enter() { if (_grateOpenedFl) { _scene->_hotspots.activate(17, false); - int idx = _scene->_dynamicHotspots.add(17, 0x2F7, -1, Common::Rect(117, 67, 117 + 19, 67 + 13)); + int idx = _scene->_dynamicHotspots.add(17, VERB_CLIMB_INTO, -1, Common::Rect(117, 67, 117 + 19, 67 + 13)); int hotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(129, 104), FACING_NORTH); _scene->_dynamicHotspots.setCursor(hotspotId, CURSOR_GO_UP); @@ -932,7 +932,7 @@ void Scene307::actions() { setDialogNode(node); break; } - } else if (_action.isAction(VERB_PRY, 0x12C, 0x11)) { + } else if (_action.isAction(VERB_PRY, NOUN_SCALPEL, NOUN_AIR_VENT)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -991,7 +991,7 @@ void Scene307::actions() { _scene->_sequences.remove(_globals._sequenceIndexes[5]); _grateOpenedFl = true; _scene->_hotspots.activate(17, false); - int idx = _scene->_dynamicHotspots.add(17, 0x2F7, -1, Common::Rect(117, 67, 117 + 19, 67 + 13)); + int idx = _scene->_dynamicHotspots.add(17, NOUN_CLIMB_INTO, -1, Common::Rect(117, 67, 117 + 19, 67 + 13)); int hotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(129, 104), FACING_NORTH); _scene->_dynamicHotspots.setCursor(hotspotId, CURSOR_GO_UP); _game._objects.removeFromInventory(OBJ_SCALPEL, NOWHERE); @@ -4036,7 +4036,7 @@ void Scene351::actions() { else if (_action.isAction(VERB_WALK_DOWN, NOUN_CORRIDOR_TO_SOUTH)) _scene->_nextSceneId = 352; else if (_action.isAction(VERB_TAKE, NOUN_CREDIT_CHIP)) { - if (_game._trigger || !_game._objects.isInInventory(0xF)) { + if (_game._trigger || !_game._objects.isInInventory(OBJ_CREDIT_CHIP)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -4163,7 +4163,7 @@ void Scene352::putArmDown(bool corridorExit, bool doorwayExit) { case 2: { _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 6, 0, 0, 0); - int idx = _scene->_dynamicHotspots.add(NOUN_GUARDS_ARM, 0xD, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_GUARDS_ARM, VERB_WALKTO, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(230, 117), FACING_NORTHWEST); _scene->changeVariant(0); } @@ -4172,7 +4172,7 @@ void Scene352::putArmDown(bool corridorExit, bool doorwayExit) { case 3: _scene->_kernelMessages.reset(); _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x100)); - _game._objects.setRoom(0x2F, _scene->_currentSceneId); + _game._objects.setRoom(OBJ_GUARDS_ARM, _scene->_currentSceneId); _game._player._visible = true; if (corridorExit) _scene->_sequences.addTimer(48, 6); @@ -4244,7 +4244,7 @@ void Scene352::enter() { if (_game._objects.isInRoom(OBJ_TAPE_PLAYER)) { _globals._sequenceIndexes[5] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[5], false, 12, 0, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[5], 5); - int idx = _scene->_dynamicHotspots.add(NOUN_TAPE_PLAYER, 0xD, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_TAPE_PLAYER, VERB_WALKTO, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); _tapePlayerHotspotIdx = _scene->_dynamicHotspots.setPosition(idx, Common::Point(84, 145), FACING_WEST); } @@ -4258,7 +4258,7 @@ void Scene352::enter() { if (_game._objects.isInRoom(OBJ_GUARDS_ARM)) { _globals._sequenceIndexes[2] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[2], false, 6, 0, 0, 0); - int idx = _scene->_dynamicHotspots.add(NOUN_GUARDS_ARM, 0xD, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_GUARDS_ARM, VERB_WALKTO, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(230, 117), FACING_NORTHWEST); } else _mustPutArmDownFl = true; @@ -4315,14 +4315,14 @@ void Scene352::preActions() { } } - if (_action.isAction(VERB_PUT, NOUN_GUARDS_ARM, 0x1F3)) { + if (_action.isAction(VERB_PUT, NOUN_GUARDS_ARM, NOUN_SCANNER)) { if (_globals[kSexOfRex] == REX_MALE) _game._player.walk(Common::Point(269, 111), FACING_NORTHEAST); else _game._player.walk(Common::Point(271, 111), FACING_NORTHEAST); } - if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOORWAY) || _action.isAction(VERB_WALK_DOWN, NOUN_CORRIDOR_TO_SOUTH) || _action.isAction(VERB_PUT, NOUN_GUARDS_ARM, 0x89)) { + if (_action.isAction(VERB_WALK_THROUGH, NOUN_DOORWAY) || _action.isAction(VERB_WALK_DOWN, NOUN_CORRIDOR_TO_SOUTH) || _action.isAction(VERB_PUT, NOUN_GUARDS_ARM, NOUN_FLOOR)) { if (_game._objects.isInInventory(OBJ_GUARDS_ARM)) _game._player.walk(Common::Point(230, 117), FACING_NORTHWEST); } @@ -4401,7 +4401,7 @@ void Scene352::actions() { exit_doorway = true; } - if (_action.isAction(VERB_WALK_DOWN, NOUN_CORRIDOR_TO_SOUTH) || _action.isAction(VERB_WALK_THROUGH, NOUN_DOORWAY) || _action.isAction(VERB_PUT, NOUN_GUARDS_ARM, 0x89)) { + if (_action.isAction(VERB_WALK_DOWN, NOUN_CORRIDOR_TO_SOUTH) || _action.isAction(VERB_WALK_THROUGH, NOUN_DOORWAY) || _action.isAction(VERB_PUT, NOUN_GUARDS_ARM, NOUN_FLOOR)) { if (_mustPutArmDownFl) putArmDown(exit_corridor, exit_doorway); else if (exit_corridor) @@ -4441,7 +4441,7 @@ void Scene352::actions() { case 2: _game._player._visible = true; _game._player._stepEnabled = true; - _vm->_dialogs->showItem(0x2F, 0x899C); + _vm->_dialogs->showItem(OBJ_GUARDS_ARM, 0x899C); break; } _action._inProgress = false; @@ -4449,7 +4449,7 @@ void Scene352::actions() { } } - if (_action.isAction(VERB_PUT, NOUN_GUARDS_ARM, 0x1F3)) { + if (_action.isAction(VERB_PUT, NOUN_GUARDS_ARM, NOUN_SCANNER)) { if (!_vaultOpenFl) { switch (_game._trigger) { case 0: @@ -4510,7 +4510,7 @@ void Scene352::actions() { _vaultOpenFl = true; int idx; if (!_globals[kHaveYourStuff]) { - idx = _scene->_dynamicHotspots.add(NOUN_YOUR_STUFF, 0xD, -1, Common::Rect(282, 87, 282 + 13, 87 + 7)); + idx = _scene->_dynamicHotspots.add(NOUN_YOUR_STUFF, VERB_WALKTO, -1, Common::Rect(282, 87, 282 + 13, 87 + 7)); _hotspot2Idx = _scene->_dynamicHotspots.setPosition(idx, Common::Point(280, 111), FACING_NORTHEAST); _globals._sequenceIndexes[1] = _commonSequenceIdx; _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x102)); @@ -4519,9 +4519,9 @@ void Scene352::actions() { _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 120, _game.getQuote(0x103)); } - idx = _scene->_dynamicHotspots.add(NOUN_OTHER_STUFF, 0xD, -1, Common::Rect(282, 48, 282 + 36, 48 + 27)); + idx = _scene->_dynamicHotspots.add(NOUN_OTHER_STUFF, VERB_WALKTO, -1, Common::Rect(282, 48, 282 + 36, 48 + 27)); _hotspot1Idx = _scene->_dynamicHotspots.setPosition(idx, Common::Point(287, 115), FACING_NORTHEAST); - idx = _scene->_dynamicHotspots.add(NOUN_LAMP, 0xD, -1, Common::Rect(296, 76, 296 + 11, 76 + 17)); + idx = _scene->_dynamicHotspots.add(NOUN_LAMP, VERB_WALKTO, -1, Common::Rect(296, 76, 296 + 11, 76 + 17)); _lampHostpotIdx = _scene->_dynamicHotspots.setPosition(idx, Common::Point(287, 115), FACING_NORTHEAST); _game._player._stepEnabled = true; } @@ -4933,7 +4933,7 @@ void Scene359::enter() { if (_game._objects.isInRoom(OBJ_SECURITY_CARD)) { _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 9, 0, 0, 0); - _cardHotspotId = _scene->_dynamicHotspots.add(NOUN_SECURITY_CARD, 0xD, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + _cardHotspotId = _scene->_dynamicHotspots.add(NOUN_SECURITY_CARD, VERB_WALKTO, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(_cardHotspotId, Common::Point(107, 107), FACING_SOUTH); } diff --git a/engines/mads/nebular/nebular_scenes4.cpp b/engines/mads/nebular/nebular_scenes4.cpp index d803b62ecd..017319b675 100644 --- a/engines/mads/nebular/nebular_scenes4.cpp +++ b/engines/mads/nebular/nebular_scenes4.cpp @@ -888,14 +888,14 @@ void Scene402::enter() { _globals._sequenceIndexes[14] = _scene->_sequences.startCycle(_globals._spriteIndexes[14], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[14], 7); _scene->_sequences.setPosition(_globals._sequenceIndexes[14], Common::Point(210, 80)); - int idx = _scene->_dynamicHotspots.add(NOUN_REPAIR_LIST, 0xD1, _globals._sequenceIndexes[14], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_REPAIR_LIST, VERB_LOOK_AT, _globals._sequenceIndexes[14], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(0, 0), FACING_NONE); } { _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 8); - int idx = _scene->_dynamicHotspots.add(NOUN_BARTENDER, 0xD, _globals._sequenceIndexes[9], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_BARTENDER, VERB_WALKTO, _globals._sequenceIndexes[9], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(228, 83), FACING_SOUTH); } @@ -903,7 +903,7 @@ void Scene402::enter() { _globals._sequenceIndexes[15] = _scene->_sequences.startCycle(_globals._spriteIndexes[15], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[15], 8); _scene->_sequences.setPosition(_globals._sequenceIndexes[15], Common::Point(250, 80)); - int idx = _scene->_dynamicHotspots.add(NOUN_CREDIT_CHIP, 0x4, _globals._sequenceIndexes[15], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_CREDIT_CHIP, VERB_TAKE, _globals._sequenceIndexes[15], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(0, 0), FACING_NONE); } @@ -965,7 +965,7 @@ void Scene402::step() { _globals._sequenceIndexes[10] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[10], false, 7, 0, 0, 0); _scene->_sequences.setAnimRange(_globals._sequenceIndexes[10], 3, 4); _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 8); - int idx = _scene->_dynamicHotspots.add(NOUN_BARTENDER, 0xD, _globals._sequenceIndexes[10], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_BARTENDER, VERB_WALKTO, _globals._sequenceIndexes[10], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(228, 83), FACING_SOUTH); _bartenderTalking = true; if (_talkTimer > 1000) @@ -978,7 +978,7 @@ void Scene402::step() { if ((_game._trigger == 101) && _bartenderTalking) { _scene->_sequences.remove(_globals._sequenceIndexes[10]); _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 1); - int idx = _scene->_dynamicHotspots.add(NOUN_BARTENDER, 0xD, _globals._sequenceIndexes[9], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_BARTENDER, VERB_WALKTO, _globals._sequenceIndexes[9], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(228, 83), FACING_SOUTH); _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 8); _bartenderSteady = true; @@ -1107,7 +1107,7 @@ void Scene402::step() { _globals._sequenceIndexes[15] = _scene->_sequences.startCycle(_globals._spriteIndexes[15], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[15], 8); _scene->_sequences.setPosition(_globals._sequenceIndexes[15], Common::Point(250, 80)); - int idx = _scene->_dynamicHotspots.add(NOUN_CREDIT_CHIP, 0x4, _globals._sequenceIndexes[15], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_CREDIT_CHIP, VERB_TAKE, _globals._sequenceIndexes[15], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(0, 0), FACING_NONE); } break; @@ -1140,7 +1140,7 @@ void Scene402::step() { int seqIdx = _globals._sequenceIndexes[12]; _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 1); _bartenderSteady = true; - int idx = _scene->_dynamicHotspots.add(NOUN_BARTENDER, 0xD, _globals._sequenceIndexes[9], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_BARTENDER, VERB_WALKTO, _globals._sequenceIndexes[9], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(228, 83), FACING_SOUTH); _scene->_sequences.updateTimeout(_globals._sequenceIndexes[9], seqIdx); _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 8); @@ -1218,7 +1218,7 @@ void Scene402::step() { case 91: { _scene->_sequences.remove(_globals._sequenceIndexes[9]); _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 1); - int idx = _scene->_dynamicHotspots.add(NOUN_BARTENDER, 0xD, _globals._sequenceIndexes[9], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_BARTENDER, VERB_WALKTO, _globals._sequenceIndexes[9], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(228, 83), FACING_SOUTH); _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 8); _bartenderSteady = true; @@ -1310,7 +1310,7 @@ void Scene402::step() { case 1: { _globals._sequenceIndexes[10] = _scene->_sequences.startCycle(_globals._spriteIndexes[10], false, 4); _scene->_sequences.setDepth(_globals._sequenceIndexes[10], 8); - int idx = _scene->_dynamicHotspots.add(NOUN_BARTENDER, 0xD, _globals._sequenceIndexes[10], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_BARTENDER, VERB_WALKTO, _globals._sequenceIndexes[10], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(228, 83), FACING_SOUTH); _bartenderHandsHips = true; } @@ -1319,7 +1319,7 @@ void Scene402::step() { case 2: { _globals._sequenceIndexes[11] = _scene->_sequences.startCycle(_globals._spriteIndexes[11], false, 2); _scene->_sequences.setDepth(_globals._sequenceIndexes[11], 8); - int idx = _scene->_dynamicHotspots.add(NOUN_BARTENDER, 0xD, _globals._sequenceIndexes[11], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_BARTENDER, VERB_WALKTO, _globals._sequenceIndexes[11], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(228, 83), FACING_SOUTH); _bartenderLooksLeft = true; } @@ -1328,7 +1328,7 @@ void Scene402::step() { case 3: { _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 8); - int idx = _scene->_dynamicHotspots.add(NOUN_BARTENDER, 0xD, _globals._sequenceIndexes[9], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_BARTENDER, VERB_WALKTO, _globals._sequenceIndexes[9], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(228, 83), FACING_SOUTH); _bartenderSteady = true; } @@ -1621,7 +1621,7 @@ void Scene402::step() { _scene->_sequences.remove(_globals._sequenceIndexes[10]); _bartenderHandsHips = false; _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 1); - int idx = _scene->_dynamicHotspots.add(NOUN_BARTENDER, 0xD, _globals._sequenceIndexes[9], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_BARTENDER, VERB_WALKTO, _globals._sequenceIndexes[9], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(228, 83), FACING_SOUTH); _bartenderSteady = true; _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 8); @@ -1629,7 +1629,7 @@ void Scene402::step() { _scene->_sequences.remove(_globals._sequenceIndexes[11]); _bartenderLooksLeft = false; _globals._sequenceIndexes[9] = _scene->_sequences.startCycle(_globals._spriteIndexes[9], false, 1); - int idx = _scene->_dynamicHotspots.add(NOUN_BARTENDER, 0xD, _globals._sequenceIndexes[9], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_BARTENDER, VERB_WALKTO, _globals._sequenceIndexes[9], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(228, 83), FACING_SOUTH); _bartenderSteady = true; _scene->_sequences.setDepth(_globals._sequenceIndexes[9], 8); @@ -2491,7 +2491,7 @@ void Scene405::actions() { _scene->_nextSceneId = 408; else if (_action.isAction(VERB_WALK_THROUGH, NOUN_WIDE_DOOR) && !_globals[kArmoryDoorOpen]) _scene->_kernelMessages.add(Common::Point(0, 0), 0x1110, 34, 0, 60, _game.getQuote(0x24F)); - else if (_action.isAction(VERB_PUT, NOUN_SECURITY_CARD, 0x251) && !_globals[kArmoryDoorOpen]) { + else if (_action.isAction(VERB_PUT, NOUN_SECURITY_CARD, NOUN_CARD_SLOT) && !_globals[kArmoryDoorOpen]) { _game._player._stepEnabled = false; _game._player._visible = false; _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; @@ -2501,7 +2501,7 @@ void Scene405::actions() { Common::Point msgPos = Common::Point(_game._player._playerPos.x, _game._player._playerPos.y + 1); _scene->_sequences.setPosition(_globals._sequenceIndexes[3], msgPos); _scene->_sequences.setScale(_globals._sequenceIndexes[3], 87); - } else if ((_action.isAction(VERB_PUT, NOUN_SECURITY_CARD, 0x251) || _action.isAction(VERB_CLOSE, NOUN_WIDE_DOOR)) && _globals[kArmoryDoorOpen]) { + } else if ((_action.isAction(VERB_PUT, NOUN_SECURITY_CARD, NOUN_CARD_SLOT) || _action.isAction(VERB_CLOSE, NOUN_WIDE_DOOR)) && _globals[kArmoryDoorOpen]) { _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _game._player._stepEnabled = false; _game._player._visible = false; @@ -2699,7 +2699,7 @@ void Scene406::actions() { _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _scene->_sequences.addTimer(80, 100); } - } else if (_action.isAction(VERB_PUT, NOUN_SECURITY_CARD, 0x251) && !_globals[kStorageDoorOpen]) { + } else if (_action.isAction(VERB_PUT, NOUN_SECURITY_CARD, NOUN_CARD_SLOT) && !_globals[kStorageDoorOpen]) { _game._player._stepEnabled = false; _game._player._visible = false; _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; @@ -2709,7 +2709,7 @@ void Scene406::actions() { Common::Point msgPos = Common::Point(_game._player._playerPos.x, _game._player._playerPos.y + 1); _scene->_sequences.setPosition(_globals._sequenceIndexes[2], msgPos); _scene->_sequences.setScale(_globals._sequenceIndexes[2], 87); - } else if (_action.isAction(VERB_PUT, NOUN_SECURITY_CARD, 0x251) && _globals[kStorageDoorOpen]) { + } else if (_action.isAction(VERB_PUT, NOUN_SECURITY_CARD, NOUN_CARD_SLOT) && _globals[kStorageDoorOpen]) { _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; _game._player._stepEnabled = false; _game._player._visible = false; @@ -2910,7 +2910,7 @@ void Scene408::enter() { if (_game._objects.isInRoom(OBJ_TARGET_MODULE)) { _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 3); - int idx = _scene->_dynamicHotspots.add(NOUN_TARGET_MODULE, 0xD, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_TARGET_MODULE, VERB_WALKTO, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(283, 128), FACING_NORTHEAST); } sceneEntrySound(); @@ -3782,7 +3782,7 @@ void Scene411::actions() { return; } - if ((_globals[kNextIngredient] >= 4) && (_action.isAction(VERB_TAKE, NOUN_EXPLOSIVES) || _action.isAction(VERB_PUT, NOUN_CHARGE_CASES, 0x3AB)) + if ((_globals[kNextIngredient] >= 4) && (_action.isAction(VERB_TAKE, NOUN_EXPLOSIVES) || _action.isAction(VERB_PUT, NOUN_CHARGE_CASES, NOUN_EXPLOSIVES)) && !_game._objects[OBJ_CHARGE_CASES].getQuality(3) && _game._objects.isInInventory(OBJ_CHARGE_CASES)) { switch (_game._trigger) { diff --git a/engines/mads/nebular/nebular_scenes5.cpp b/engines/mads/nebular/nebular_scenes5.cpp index d4b67da190..832c99a5f5 100644 --- a/engines/mads/nebular/nebular_scenes5.cpp +++ b/engines/mads/nebular/nebular_scenes5.cpp @@ -174,7 +174,7 @@ void Scene501::enter() { } _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, 1); - int idx = _scene->_dynamicHotspots.add(NOUN_DOOR, 0x18B, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_DOOR, VERB_WALK_THROUGH, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); _doorHotspotid = _scene->_dynamicHotspots.setPosition(idx,Common::Point(282, 110), FACING_NORTH); _scene->_dynamicHotspots.setCursor(_doorHotspotid, CURSOR_GO_UP); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 7); @@ -241,7 +241,7 @@ void Scene501::step() { _globals._sequenceIndexes[3] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[3], false, 9, 1, 0, 0); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 7); _vm->_sound->command(12); - _doorHotspotid = _scene->_dynamicHotspots.add(NOUN_DOOR, 0x18B, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); + _doorHotspotid = _scene->_dynamicHotspots.add(NOUN_DOOR, VERB_WALK_THROUGH, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(_globals._sequenceIndexes[3], Common::Point(282, 110), FACING_NORTH); _scene->_dynamicHotspots.setCursor(_doorHotspotid, CURSOR_GO_UP); _scene->_sequences.addSubEntry(_globals._sequenceIndexes[3], SEQUENCE_TRIGGER_EXPIRE, 0, 83); @@ -343,9 +343,9 @@ void Scene501::actions() { default: break; } - } else if (_action.isAction(VERB_PUT, NOUN_SECURITY_CARD, 0x251)) + } else if (_action.isAction(VERB_PUT, NOUN_SECURITY_CARD, NOUN_CARD_SLOT)) _vm->_dialogs->show(50113); - else if (_action.isAction(VERB_PUT, NOUN_FAKE_ID, 0x251)) { + else if (_action.isAction(VERB_PUT, NOUN_FAKE_ID, NOUN_CARD_SLOT)) { switch (_game._trigger) { case 0: case 1: @@ -389,7 +389,7 @@ void Scene501::actions() { default: break; } - } else if (_action.isAction(VERB_PUT, NOUN_ID_CARD, 0x251)) { + } else if (_action.isAction(VERB_PUT, NOUN_ID_CARD, NOUN_CARD_SLOT)) { switch (_game._trigger) { case 0: case 1: @@ -559,7 +559,7 @@ void Scene503::enter() { if (_game._objects[OBJ_DETONATORS]._roomNumber == _scene->_currentSceneId) { _globals._sequenceIndexes[1] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[1], false, 9, 0, 0, 0); - _detonatorHotspotId = _scene->_dynamicHotspots.add(NOUN_DETONATORS, 0xD, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + _detonatorHotspotId = _scene->_dynamicHotspots.add(NOUN_DETONATORS, VERB_WALKTO, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(_detonatorHotspotId, Common::Point(254, 135), FACING_SOUTH); } @@ -1197,12 +1197,12 @@ void Scene506::enter() { _globals._spriteIndexes[4] = _scene->_sprites.addSprites("*RXCD_3"); _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); - int idx = _scene->_dynamicHotspots.add(NOUN_LABORATORY, 0x242, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_LABORATORY, VERB_WALK_INTO, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); int hotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(65, 125), FACING_NORTHWEST); _scene->_dynamicHotspots.setCursor(hotspotId, CURSOR_GO_LEFT); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 10); _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 1); - idx = _scene->_dynamicHotspots.add(NOUN_SOFTWARE_STORE, 0x242, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); + idx = _scene->_dynamicHotspots.add(NOUN_SOFTWARE_STORE, VERB_WALK_INTO, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); hotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(112, 102), FACING_NORTHWEST); _scene->_dynamicHotspots.setCursor(hotspotId, CURSOR_GO_LEFT); _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 13); @@ -1328,7 +1328,7 @@ void Scene506::handleDoorSequences() { case 83: { _doorSequenceIdx = _scene->_sequences.startCycle(_doorSpriteIdx, false, 1); - int idx = _scene->_dynamicHotspots.add(_doorWord, 0x242, _doorSequenceIdx, Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(_doorWord, VERB_WALK_INTO, _doorSequenceIdx, Common::Rect(0, 0, 0, 0)); int hotspotId = _scene->_dynamicHotspots.setPosition(idx, _doorPos, FACING_NORTHWEST); _scene->_dynamicHotspots.setCursor(hotspotId, CURSOR_GO_LEFT); _scene->_sequences.setDepth(_doorSequenceIdx, _doorDepth); @@ -1766,10 +1766,10 @@ void Scene508::actions() { } else { _vm->_dialogs->show(50837); } - } else if (_action.isAction(VERB_REFLECT, 0x120, 0x343) || _action.isAction(VERB_PUT, NOUN_REARVIEW_MIRROR, 0x344) || _action.isAction(VERB_PUT, NOUN_REARVIEW_MIRROR, 0x343)) { + } else if (_action.isAction(VERB_REFLECT, NOUN_REARVIEW_MIRROR, NOUN_LASER_BEAM) || _action.isAction(VERB_PUT, NOUN_REARVIEW_MIRROR, NOUN_PEDESTAL) || _action.isAction(VERB_PUT, NOUN_REARVIEW_MIRROR, NOUN_LASER_BEAM)) { _chosenObject = 1; handlePedestral(); - } else if (_action.isAction(VERB_PUT, NOUN_COMPACT_CASE, 0x344) || _action.isAction(VERB_PUT, NOUN_COMPACT_CASE, 0x343) || _action.isAction(VERB_REFLECT, 0x57, 0x343)) { + } else if (_action.isAction(VERB_PUT, NOUN_COMPACT_CASE, NOUN_PEDESTAL) || _action.isAction(VERB_PUT, NOUN_COMPACT_CASE, NOUN_LASER_BEAM) || _action.isAction(VERB_REFLECT, NOUN_COMPACT_CASE, NOUN_LASER_BEAM)) { _chosenObject = 2; handlePedestral(); } else if (_action._lookFlag) @@ -2139,7 +2139,7 @@ void Scene511::actions() { _vm->_dialogs->show(51117); else if (_action.isAction(VERB_LOOK, NOUN_DOME_ENTRANCE)) _vm->_dialogs->show(51118); - else if (_action.isAction(VERB_UNLOCK, 0xFF, 0x37C) || _action.isAction(VERB_UNLOCK, 0x6F, 0x37C)) + else if (_action.isAction(VERB_UNLOCK, NOUN_PADLOCK_KEY, NOUN_DOME_ENTRANCE) || _action.isAction(VERB_UNLOCK, NOUN_DOOR_KEY, NOUN_DOME_ENTRANCE)) _vm->_dialogs->show(51119); else if ( (_action.isAction(VERB_PUT) || _action.isAction(VERB_THROW)) && (_action.isObject(NOUN_TIMEBOMB) || _action.isObject(NOUN_BOMB) || _action.isObject(NOUN_BOMBS)) @@ -2621,7 +2621,7 @@ void Scene513::actions() { default: break; } - } else if (_action.isAction(VERB_PUT, NOUN_ID_CARD, 0x251) || _action.isAction(VERB_PUT, NOUN_FAKE_ID, 0x251)) { + } else if (_action.isAction(VERB_PUT, NOUN_ID_CARD, NOUN_CARD_SLOT) || _action.isAction(VERB_PUT, NOUN_FAKE_ID, NOUN_CARD_SLOT)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -2694,7 +2694,7 @@ void Scene513::actions() { _vm->_dialogs->show(51321); else if (_action.isAction(VERB_LOOK, NOUN_BRICK_WALL)) _vm->_dialogs->show(51322); - else if (_action.isAction(VERB_PUT, NOUN_SECURITY_CARD, 0x251)) + else if (_action.isAction(VERB_PUT, NOUN_SECURITY_CARD, NOUN_CARD_SLOT)) _vm->_dialogs->show(51320); else return; diff --git a/engines/mads/nebular/nebular_scenes6.cpp b/engines/mads/nebular/nebular_scenes6.cpp index 8101428aab..eb85fa86e1 100644 --- a/engines/mads/nebular/nebular_scenes6.cpp +++ b/engines/mads/nebular/nebular_scenes6.cpp @@ -2190,15 +2190,15 @@ void Scene608::step() { void Scene608::preActions() { _game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON; - if ((_action.isAction(VERB_THROW, NOUN_BONE, 0x410) || _action.isAction(VERB_THROW, NOUN_BONES, 0x410) - || _action.isAction(VERB_THROW, NOUN_BONE, 0x411) || _action.isAction(VERB_THROW, NOUN_BONES, 0x411) - || _action.isAction(VERB_THROW, NOUN_BONES, 0x471) || _action.isAction(VERB_THROW, NOUN_BONE, 0x471)) && _dogActiveFl) { + if ((_action.isAction(VERB_THROW, NOUN_BONE, NOUN_REAR_OF_GARAGE) || _action.isAction(VERB_THROW, NOUN_BONES, NOUN_REAR_OF_GARAGE) + || _action.isAction(VERB_THROW, NOUN_BONE, NOUN_FRONT_OF_GARAGE) || _action.isAction(VERB_THROW, NOUN_BONES, NOUN_FRONT_OF_GARAGE) + || _action.isAction(VERB_THROW, NOUN_BONES, NOUN_OBNOXIOUS_DOG) || _action.isAction(VERB_THROW, NOUN_BONE, NOUN_OBNOXIOUS_DOG)) && _dogActiveFl) { _game._player._stepEnabled = false; _game._player.walk(Common::Point(56, 146), FACING_EAST); } - if ((_action.isAction(VERB_THROW, NOUN_BONES, 0x41D) || _action.isAction(VERB_THROW, NOUN_BONE, 0x41D) - || _action.isAction(VERB_THROW, NOUN_BONES, 0x41E) || _action.isAction(VERB_THROW, NOUN_BONE, 0x41E)) && _dogActiveFl) { + if ((_action.isAction(VERB_THROW, NOUN_BONES, NOUN_AREA_BEHIND_CAR) || _action.isAction(VERB_THROW, NOUN_BONE, NOUN_AREA_BEHIND_CAR) + || _action.isAction(VERB_THROW, NOUN_BONES, NOUN_DANGER_ZONE) || _action.isAction(VERB_THROW, NOUN_BONE, NOUN_DANGER_ZONE)) && _dogActiveFl) { _game._player._stepEnabled = false; _game._player.walk(Common::Point(75, 136), FACING_EAST); } @@ -2337,8 +2337,8 @@ void Scene608::actions() { default: break; } - } else if (_action.isAction(VERB_THROW, NOUN_BONE, 0x410) || _action.isAction(VERB_THROW, NOUN_BONES, 0x410) - || _action.isAction(VERB_THROW, NOUN_BONES, 0x471) || _action.isAction(VERB_THROW, NOUN_BONE, 0x471)) { + } else if (_action.isAction(VERB_THROW, NOUN_BONE, NOUN_REAR_OF_GARAGE) || _action.isAction(VERB_THROW, NOUN_BONES, NOUN_REAR_OF_GARAGE) + || _action.isAction(VERB_THROW, NOUN_BONES, NOUN_OBNOXIOUS_DOG) || _action.isAction(VERB_THROW, NOUN_BONE, NOUN_OBNOXIOUS_DOG)) { _game._player._stepEnabled = true; if (_dogActiveFl) { if (_game._trigger == 0) { @@ -2349,7 +2349,7 @@ void Scene608::actions() { handleThrowingBone(); } else _vm->_dialogs->show(60841); - } else if (_action.isAction(VERB_THROW, NOUN_BONE, 0x411) || _action.isAction(VERB_THROW, NOUN_BONES, 0x411)) { + } else if (_action.isAction(VERB_THROW, NOUN_BONE, NOUN_FRONT_OF_GARAGE) || _action.isAction(VERB_THROW, NOUN_BONES, NOUN_FRONT_OF_GARAGE)) { _game._player._stepEnabled = true; if (_dogActiveFl) { if (_game._trigger == 0) { @@ -2360,8 +2360,8 @@ void Scene608::actions() { handleThrowingBone(); } else _vm->_dialogs->show(60841); - } else if (_action.isAction(VERB_THROW, NOUN_BONES, 0x41D) || _action.isAction(VERB_THROW, NOUN_BONE, 0x41D) - || _action.isAction(VERB_THROW, NOUN_BONES, 0x41E) || _action.isAction(VERB_THROW, NOUN_BONE, 0x41E)) { + } else if (_action.isAction(VERB_THROW, NOUN_BONES, NOUN_AREA_BEHIND_CAR) || _action.isAction(VERB_THROW, NOUN_BONE, NOUN_AREA_BEHIND_CAR) + || _action.isAction(VERB_THROW, NOUN_BONES, NOUN_DANGER_ZONE) || _action.isAction(VERB_THROW, NOUN_BONE, NOUN_DANGER_ZONE)) { _game._player._stepEnabled = true; if ((_globals[kCarStatus] == 0) && _dogActiveFl) { if (_dogActiveFl) { @@ -2711,7 +2711,7 @@ void Scene609::enterStore() { } void Scene609::preActions() { - if (_action.isAction(VERB_UNLOCK, 0x6F, 0x425)) + if (_action.isAction(VERB_UNLOCK, NOUN_DOOR_KEY, NOUN_VIDEO_STORE_DOOR)) _game._player.walk(Common::Point(78, 99), FACING_NORTHWEST); } @@ -2759,7 +2759,7 @@ void Scene609::actions() { _videoDoorMode = 2; enterStore(); } - } else if (_action.isAction(VERB_UNLOCK, 0x6F, 0x425)) { + } else if (_action.isAction(VERB_UNLOCK, NOUN_DOOR_KEY, NOUN_VIDEO_STORE_DOOR)) { _videoDoorMode = 1; enterStore(); } else if (_action.isAction(VERB_GET_INSIDE, NOUN_CAR)) { @@ -2948,7 +2948,7 @@ void Scene610::actions() { break; } } - } else if (_action.isAction(VERB_PUT, NOUN_PHONE_HANDSET, 0x42F)) { + } else if (_action.isAction(VERB_PUT, NOUN_PHONE_HANDSET, NOUN_PHONE_CRADLE)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -4347,7 +4347,7 @@ void Scene611::preActions() { void Scene611::actions() { if (_game._screenObjects._inputMode == 1) handleDialog(); - else if ((_action.isAction(VERB_GIVE, NOUN_PHONE_CELLS, 0x45A)) || (_action.isAction(VERB_GIVE, NOUN_DURAFAIL_CELLS, 0x45A))) { + else if ((_action.isAction(VERB_GIVE, NOUN_PHONE_CELLS, NOUN_HERMIT)) || (_action.isAction(VERB_GIVE, NOUN_DURAFAIL_CELLS, NOUN_HERMIT))) { _action._activeAction._verbId = 0x294; _giveBatteriesFl = true; handleSubDialog1(); diff --git a/engines/mads/nebular/nebular_scenes7.cpp b/engines/mads/nebular/nebular_scenes7.cpp index b31a35913b..d59f7ff5f3 100644 --- a/engines/mads/nebular/nebular_scenes7.cpp +++ b/engines/mads/nebular/nebular_scenes7.cpp @@ -1028,7 +1028,7 @@ void Scene703::step() { void Scene703::actions() { if (_game._screenObjects._inputMode == 1) handleFillBottle(_action._activeAction._verbId); - else if (_action.isAction(VERB_STEER_TOWARDS, 0x3B0)) { + else if (_action.isAction(VERB_STEER_TOWARDS, NOUN_DOCK_TO_SOUTH)) { _game._player._stepEnabled = false; if (_globals[kMonsterAlive]) _curSequence = 8; @@ -1036,7 +1036,7 @@ void Scene703::actions() { _curSequence = 5; else _curSequence = 3; - } else if (_action.isAction(VERB_STEER_TOWARDS, 0x3B2)) { + } else if (_action.isAction(VERB_STEER_TOWARDS, NOUN_BUILDING_TO_NORTH)) { _game._player._stepEnabled = false; if (_globals[kMonsterAlive]) { _startMonsterTimer = false; @@ -1049,30 +1049,30 @@ void Scene703::actions() { _curSequence = 4; else _curSequence = 1; - } else if (_action.isAction(VERB_THROW, NOUN_BONE, 0x468) || _action.isAction(VERB_THROW, NOUN_BONES, 0x468)) { + } else if (_action.isAction(VERB_THROW, NOUN_BONE, NOUN_SEA_MONSTER) || _action.isAction(VERB_THROW, NOUN_BONES, NOUN_SEA_MONSTER)) { _game._player._stepEnabled = false; _scene->freeAnimation(); _monsterMode = 2; _scene->loadAnimation(formAnimName('C', -1)); _scene->_activeAnimation->setCurrentFrame(19); - } else if (_action.isAction(VERB_THROW, NOUN_CHICKEN, 0x468)) { + } else if (_action.isAction(VERB_THROW, NOUN_CHICKEN, NOUN_SEA_MONSTER)) { _game._player._stepEnabled = false; _scene->freeAnimation(); _monsterMode = 2; _scene->loadAnimation(formAnimName('C', -1)); - } else if (_action.isAction(VERB_THROW, NOUN_TWINKIFRUIT, 0x468)) { + } else if (_action.isAction(VERB_THROW, NOUN_TWINKIFRUIT, NOUN_SEA_MONSTER)) { _game._player._stepEnabled = false; _scene->freeAnimation(); _monsterMode = 2; _scene->loadAnimation(formAnimName('C', -1)); _scene->_activeAnimation->setCurrentFrame(39); - } else if (_action.isAction(VERB_THROW, NOUN_BOMB, 0x468)) { + } else if (_action.isAction(VERB_THROW, NOUN_BOMB, NOUN_SEA_MONSTER)) { _game._player._stepEnabled = false; _scene->freeAnimation(); _monsterMode = 2; _scene->loadAnimation(formAnimName('C', -1)); _scene->_activeAnimation->setCurrentFrame(59); - } else if (_action.isAction(VERB_THROW, NOUN_CHICKEN_BOMB, 0x468)) { + } else if (_action.isAction(VERB_THROW, NOUN_CHICKEN_BOMB, NOUN_SEA_MONSTER)) { _useBomb = true; _game._player._stepEnabled = false; _scene->freeAnimation(); @@ -1227,7 +1227,7 @@ void Scene704::enter() { _scene->_sequences.setPosition(_globals._sequenceIndexes[1], Common::Point(190, 122)); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 2); } - int idx = _scene->_dynamicHotspots.add(NOUN_BONES, 0xD1, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_BONES, VERB_LOOK_AT, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); _bottleHotspotId = _scene->_dynamicHotspots.setPosition(idx, Common::Point(-2, 0), FACING_NONE); } @@ -1414,13 +1414,13 @@ void Scene704::step() { void Scene704::actions() { if (_game._screenObjects._inputMode == 1) handleFillBottle(_action._activeAction._verbId); - else if (_action.isAction(VERB_STEER_TOWARDS, 0x3B4)) { + else if (_action.isAction(VERB_STEER_TOWARDS, NOUN_OPEN_WATER_TO_SOUTH)) { _game._player._stepEnabled = false; if (_boatDirection == 1) _animationMode = 5; else _animationMode = 3; - } else if (_action.isAction(VERB_STEER_TOWARDS, 0x3B2)) { + } else if (_action.isAction(VERB_STEER_TOWARDS, NOUN_BUILDING_TO_NORTH)) { _game._player._stepEnabled = false; if (_boatDirection == 2) _animationMode = 4; @@ -1664,7 +1664,7 @@ void Scene705::step() { void Scene705::actions() { if (_game._screenObjects._inputMode == 1) handleFillBottle(_action._activeAction._verbId); - else if (_action.isAction(VERB_STEER_TOWARDS, 0x3B4)) { + else if (_action.isAction(VERB_STEER_TOWARDS, NOUN_OPEN_WATER_TO_SOUTH)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -1959,7 +1959,7 @@ void Scene706::actions() { return; } - if (_action.isAction(VERB_PUT, NOUN_BOTTLE, 0x344)) { + if (_action.isAction(VERB_PUT, NOUN_BOTTLE, NOUN_PEDESTAL)) { if ((_globals[kBottleStatus] == 2 && _game._difficulty == DIFFICULTY_HARD) || (_globals[kBottleStatus] != 0 && _game._difficulty != DIFFICULTY_HARD)) { if (!_game._objects.isInInventory(OBJ_VASE) || _game._trigger) { @@ -2106,7 +2106,7 @@ void Scene710::step() { } void Scene710::actions() { - if (_action.isAction(VERB_PUT_DOWN, 0x27)) { + if (_action.isAction(VERB_PUT_DOWN, NOUN_BINOCULARS)) { _game._player._stepEnabled = false; if (_game._globals[kCityFlooded]) @@ -2194,7 +2194,7 @@ void Scene751::enter() { if (_globals[kLineStatus] == 2 || _globals[kLineStatus] == 3) { _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -1); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 7); - int idx = _scene->_dynamicHotspots.add(NOUN_FISHING_LINE, 0xD, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_FISHING_LINE, VERB_WALKTO, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(268, 140), FACING_NORTHWEST); } @@ -2228,7 +2228,7 @@ void Scene751::enter() { } else if (_globals[kLineStatus] == 2) { _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -1); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 7); - int idx = _scene->_dynamicHotspots.add(NOUN_FISHING_LINE, 0xD, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_FISHING_LINE, VERB_WALKTO, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(268, 140), FACING_NORTHWEST); } @@ -2310,7 +2310,7 @@ void Scene751::preActions() { if (_action.isAction(VERB_LOOK, NOUN_TALL_BUILDING)) _game._player.walk(Common::Point(154, 129), FACING_NORTHEAST); - if (_action.isAction(VERB_LOOK, NOUN_BINOCULARS, 0x470)) + if (_action.isAction(VERB_LOOK, NOUN_BINOCULARS, NOUN_TALL_BUILDING)) _game._player.walk(Common::Point(154, 129), FACING_NORTH); if (_action.isAction(VERB_WALKTO, NOUN_EAST_END_OF_PLATFORM)) @@ -2322,7 +2322,7 @@ void Scene751::preActions() { if (_action.isAction(VERB_LOOK) || _action.isObject(NOUN_FISHING_LINE) || _action.isAction(VERB_TALKTO)) _game._player._needToWalk = false; - if ((!_action.isAction(VERB_PUT, NOUN_FISHING_LINE, 0x467) || !_action.isAction(VERB_TIE, NOUN_FISHING_LINE, 0x467) || !_action.isAction(VERB_ATTACH, NOUN_FISHING_LINE, 0x467)) + if ((!_action.isAction(VERB_PUT, NOUN_FISHING_LINE, NOUN_HOOK) || !_action.isAction(VERB_TIE, NOUN_FISHING_LINE, NOUN_HOOK) || !_action.isAction(VERB_ATTACH, NOUN_FISHING_LINE, NOUN_HOOK)) && (_game._player._needToWalk)) { switch (_game._trigger) { case 0: @@ -2351,7 +2351,7 @@ void Scene751::preActions() { void Scene751::actions() { if (_action.isAction(VERB_WALK_ALONG, NOUN_PLATFORM)) ; // Nothing - else if (_action.isAction(VERB_LOOK, NOUN_BINOCULARS, 0x470)) { + else if (_action.isAction(VERB_LOOK, NOUN_BINOCULARS, NOUN_TALL_BUILDING)) { switch (_game._trigger) { case 0: _game._player._stepEnabled = false; @@ -2419,7 +2419,7 @@ void Scene751::actions() { default: break; } - } else if (_action.isAction(VERB_PUT, NOUN_FISHING_LINE, 0x467) || _action.isAction(VERB_TIE, NOUN_FISHING_LINE, 0x467) || _action.isAction(VERB_ATTACH, NOUN_FISHING_LINE, 0x467)) { + } else if (_action.isAction(VERB_PUT, NOUN_FISHING_LINE, NOUN_HOOK) || _action.isAction(VERB_TIE, NOUN_FISHING_LINE, NOUN_HOOK) || _action.isAction(VERB_ATTACH, NOUN_FISHING_LINE, NOUN_HOOK)) { if (_globals[kLineStatus] == 1) { switch (_game._trigger) { case 0: @@ -2452,7 +2452,7 @@ void Scene751::actions() { _game._player._visible = true; _globals._sequenceIndexes[3] = _scene->_sequences.startCycle(_globals._spriteIndexes[3], false, -1); _scene->_sequences.setDepth(_globals._sequenceIndexes[3], 7); - int idx = _scene->_dynamicHotspots.add(NOUN_FISHING_LINE, 0xD, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_FISHING_LINE, VERB_WALKTO, _globals._sequenceIndexes[3], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(268, 140), FACING_NORTHWEST); _scene->_kernelMessages.reset(); _game._objects.setRoom(OBJ_FISHING_LINE, _scene->_currentSceneId); @@ -2490,7 +2490,7 @@ void Scene751::actions() { _vm->_dialogs->show(75121); else if (_action.isAction(VERB_LOOK, NOUN_TALL_BUILDING)) _vm->_dialogs->show(75122); - else if (_action.isAction(VERB_TIE, NOUN_FISHING_LINE, 0x316) || _action.isAction(VERB_ATTACH, NOUN_FISHING_LINE, 0x316)) + else if (_action.isAction(VERB_TIE, NOUN_FISHING_LINE, NOUN_CEMENT_PYLON) || _action.isAction(VERB_ATTACH, NOUN_FISHING_LINE, NOUN_CEMENT_PYLON)) _vm->_dialogs->show(75123); else return; diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index c0f24a78fc..db9024b3bb 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -363,14 +363,14 @@ void Scene802::enter() { if ((_globals[kRemoteOnGround]) && (!_game._objects.isInInventory(OBJ_REMOTE))) { _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 8); - int idx = _scene->_dynamicHotspots.add(NOUN_REMOTE, 0xD,_globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_REMOTE, VERB_WALKTO,_globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(107, 99), FACING_NORTH); } if (!_game._objects.isInInventory(OBJ_SHIELD_MODULATOR) && !_globals[kShieldModInstalled]) { _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[1], 8); - int idx = _scene->_dynamicHotspots.add(NOUN_SHIELD_MODULATOR, 0xD, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_SHIELD_MODULATOR, VERB_WALKTO, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(93, 97), FACING_NORTH); } sceneEntrySound(); @@ -388,7 +388,7 @@ void Scene802::step() { if (_game._trigger == 71) { _globals._sequenceIndexes[4] = _scene->_sequences.startCycle(_globals._spriteIndexes[4], false, 1); _scene->_sequences.setDepth(_globals._sequenceIndexes[4], 8); - int idx = _scene->_dynamicHotspots.add(NOUN_REMOTE, 0xD, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_REMOTE, VERB_WALKTO, _globals._sequenceIndexes[4], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(107, 99), FACING_NORTH); _globals[kRemoteSequenceRan] = true; @@ -545,7 +545,7 @@ void Scene803::enter() { if (_globals[kHoppyDead]) { _globals._spriteIndexes[7] = _scene->_sprites.addSprites(formAnimName('e', 1)); _globals._sequenceIndexes[7] = _scene->_sequences.startCycle(_globals._spriteIndexes[7], false, 1); - int idx = _scene->_dynamicHotspots.add(NOUN_GUTS, 0xD, _globals._sequenceIndexes[7], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_GUTS, VERB_WALKTO, _globals._sequenceIndexes[7], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(66, 123), FACING_SOUTH); } @@ -637,7 +637,7 @@ void Scene803::step() { _scene->_sequences.addSubEntry(_globals._sequenceIndexes[5],SEQUENCE_TRIGGER_EXPIRE, 0, 101); } else { _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, -2); - int idx = _scene->_dynamicHotspots.add(NOUN_GUTS, 0xD, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_GUTS, VERB_WALKTO, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(66, 123), FACING_SOUTH); _vm->_sound->command(16); _globals[kCameFromCut] = true; @@ -656,7 +656,7 @@ void Scene803::step() { if (_game._trigger == 101) { _globals._sequenceIndexes[5] = _scene->_sequences.startCycle(_globals._spriteIndexes[5], false, -2); - int idx = _scene->_dynamicHotspots.add(NOUN_GUTS, 0xD, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_GUTS, VERB_WALKTO, _globals._sequenceIndexes[5], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(66, 123), FACING_SOUTH); _vm->_sound->command(16); _globals[kCameFromCut] = true; @@ -1097,7 +1097,7 @@ void Scene804::step() { void Scene805::setup() { setPlayerSpritesPrefix(); setAAName(); - _scene->addActiveVocab(NOUN_REMOVE); + _scene->addActiveVocab(VERB_REMOVE); _scene->addActiveVocab(NOUN_TARGET_MODULE); _scene->addActiveVocab(NOUN_SHIELD_MODULATOR); } @@ -1112,14 +1112,14 @@ void Scene805::enter() { if (_globals[kShieldModInstalled]) { _scene->_hotspots.activate(OBJ_SHIELD_MODULATOR, false); _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 25); - int idx = _scene->_dynamicHotspots.add(NOUN_SHIELD_MODULATOR, 0x476, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_SHIELD_MODULATOR, VERB_REMOVE, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(0, 0), FACING_DUMMY); } if (_globals[kTargetModInstalled]) { _scene->_hotspots.activate(OBJ_TARGET_MODULE, false); _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 12); - int idx = _scene->_dynamicHotspots.add(NOUN_TARGET_MODULE, 0x476, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_TARGET_MODULE, VERB_REMOVE, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(0, 0), FACING_DUMMY); } @@ -1130,7 +1130,7 @@ void Scene805::step() { if (_game._trigger == 70) { _scene->_hotspots.activate(OBJ_SHIELD_MODULATOR, false); _globals._sequenceIndexes[1] = _scene->_sequences.startCycle(_globals._spriteIndexes[1], false, 25); - int idx = _scene->_dynamicHotspots.add(NOUN_SHIELD_MODULATOR, 0x476, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_SHIELD_MODULATOR, VERB_REMOVE, _globals._sequenceIndexes[1], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(0, 0), FACING_DUMMY); _globals[kShieldModInstalled] = true; _game._objects.setRoom(OBJ_SHIELD_MODULATOR, NOWHERE); @@ -1141,7 +1141,7 @@ void Scene805::step() { if (_game._trigger == 80) { _scene->_hotspots.activate(OBJ_TARGET_MODULE, false); _globals._sequenceIndexes[2] = _scene->_sequences.startCycle(_globals._spriteIndexes[2], false, 12); - int idx = _scene->_dynamicHotspots.add(NOUN_TARGET_MODULE, 0x476, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); + int idx = _scene->_dynamicHotspots.add(NOUN_TARGET_MODULE, VERB_REMOVE, _globals._sequenceIndexes[2], Common::Rect(0, 0, 0, 0)); _scene->_dynamicHotspots.setPosition(idx, Common::Point(0, 0), FACING_DUMMY); _globals[kTargetModInstalled] = true; _game._objects.setRoom(OBJ_TARGET_MODULE, NOWHERE); -- cgit v1.2.3 From 2400c77d9153e9746f6b4070154e3d571a98e11a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 26 May 2014 17:44:00 -0400 Subject: MADS: Better handle resource index decompression flags like original --- engines/mads/compression.cpp | 35 +++++++++++++++++++---------------- engines/mads/compression.h | 15 ++++++++------- 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/engines/mads/compression.cpp b/engines/mads/compression.cpp index de893e7b1a..2284f17321 100644 --- a/engines/mads/compression.cpp +++ b/engines/mads/compression.cpp @@ -65,24 +65,31 @@ void MadsPack::initialise(Common::SeekableReadStream *stream) { for (int i = 0; i < _count; ++i, header += 10) { // Get header data - _items[i].hash = READ_LE_UINT16(header); - _items[i].size = READ_LE_UINT32(header + 2); - _items[i].compressedSize = READ_LE_UINT32(header + 6); + _items[i]._type = (CompressionType)*header; + _items[i]._priority = *(header + 1); + _items[i]._size = READ_LE_UINT32(header + 2); + _items[i]._compressedSize = READ_LE_UINT32(header + 6); - byte *sourceData = new byte[_items[i].compressedSize]; - stream->read(sourceData, _items[i].compressedSize); + byte *sourceData = new byte[_items[i]._compressedSize]; + stream->read(sourceData, _items[i]._compressedSize); - if (_items[i].size == _items[i].compressedSize && - !FabDecompressor::isCompressed(sourceData)) { + switch (_items[i]._type) { + case COMPRESS_NONE: // Entry isn't compressed - _items[i].data = sourceData; - } else { + _items[i]._data = sourceData; + break; + + case COMPRESS_FAB: // Decompress the entry - _items[i].data = new byte[_items[i].size]; + _items[i]._data = new byte[_items[i]._size]; FabDecompressor fab; - fab.decompress(sourceData, _items[i].compressedSize, _items[i].data, _items[i].size); + fab.decompress(sourceData, _items[i]._compressedSize, _items[i]._data, _items[i]._size); delete[] sourceData; + break; + + default: + error("Unknown compression type encountered"); } } @@ -92,16 +99,12 @@ void MadsPack::initialise(Common::SeekableReadStream *stream) { MadsPack::~MadsPack() { for (int i = 0; i < _count; ++i) - delete[] _items[i].data; + delete[] _items[i]._data; delete[] _items; } //-------------------------------------------------------------------------- -bool FabDecompressor::isCompressed(const byte *srcData) { - return strncmp((const char *)srcData, "FAB", 3) == 0; -} - void FabDecompressor::decompress(const byte *srcData, int srcSize, byte *destData, int destSize) { byte copyLen, copyOfsShift, copyOfsMask, copyLenMask; unsigned long copyOfs; diff --git a/engines/mads/compression.h b/engines/mads/compression.h index 43a966f48c..e6eca420b5 100644 --- a/engines/mads/compression.h +++ b/engines/mads/compression.h @@ -32,12 +32,15 @@ namespace MADS { +enum CompressionType { COMPRESS_NONE = 0, COMPRESS_FAB = 1 }; + struct MadsPackEntry { public: - uint16 hash; - uint32 size; - uint32 compressedSize; - byte *data; + CompressionType _type; + byte _priority; + uint32 _size; + uint32 _compressedSize; + byte *_data; }; class MadsPack { @@ -63,7 +66,7 @@ public: } Common::MemoryReadStream *getItemStream(int index) { assert(index < _count); - return new Common::MemoryReadStream(_items[index].data, _items[index].size, + return new Common::MemoryReadStream(_items[index]._data, _items[index]._size, DisposeAfterUse::NO); } int getDataOffset() const { return _dataOffset; } @@ -79,8 +82,6 @@ private: int getBit(); public: void decompress(const byte *srcData, int srcSize, byte *destData, int destSize); - - static bool isCompressed(const byte *srcData); }; } // End of namespace MADS -- cgit v1.2.3 From 9fc10d9739217024e2435bcf1466b101163a2e56 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Mon, 26 May 2014 17:49:53 -0400 Subject: IMAGE: Limit truemotion to decoding within its boundaries, not AVI's --- image/codecs/truemotion1.cpp | 31 ++++++++++++++++--------------- image/codecs/truemotion1.h | 1 - 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/image/codecs/truemotion1.cpp b/image/codecs/truemotion1.cpp index 1302d72e2f..b5f7c76f6b 100644 --- a/image/codecs/truemotion1.cpp +++ b/image/codecs/truemotion1.cpp @@ -90,14 +90,9 @@ static const CompressionType compressionTypes[17] = { TrueMotion1Decoder::TrueMotion1Decoder(uint16 width, uint16 height) { _surface = new Graphics::Surface(); - _width = width; - _height = height; - _surface->create(width, height, getPixelFormat()); - // there is a vertical predictor for each pixel in a line; each vertical - // predictor is 0 to start with - _vertPred = new uint32[_width]; + _vertPred = 0; _buf = _mbChangeBits = _indexStream = 0; _lastDeltaset = _lastVectable = -1; @@ -170,11 +165,6 @@ void TrueMotion1Decoder::decodeHeader(Common::SeekableReadStream &stream) { byte headerBuffer[128]; // logical maximum size of the header const byte *selVectorTable; - // There is 1 change bit per 4 pixels, so each change byte represents - // 32 pixels; divide width by 4 to obtain the number of change bits and - // then round up to the nearest byte. - _mbChangeBitsRowSize = ((_width >> 2) + 7) >> 3; - _header.headerSize = ((_buf[0] >> 5) | (_buf[0] << 3)) & 0x7f; if (_buf[0] < 0x10) @@ -196,6 +186,17 @@ void TrueMotion1Decoder::decodeHeader(Common::SeekableReadStream &stream) { _header.flags = headerBuffer[11]; _header.control = headerBuffer[12]; + if (!_vertPred) { + // there is a vertical predictor for each pixel in a line; each vertical + // predictor is 0 to start with + _vertPred = new uint32[_header.xsize]; + } + + // There is 1 change bit per 4 pixels, so each change byte represents + // 32 pixels; divide width by 4 to obtain the number of change bits and + // then round up to the nearest byte. + _mbChangeBitsRowSize = ((_header.xsize >> 2) + 7) >> 3; + // Version 2 if (_header.version >= 2) { if (_header.headerType > 3) { @@ -240,7 +241,7 @@ void TrueMotion1Decoder::decodeHeader(Common::SeekableReadStream &stream) { _indexStream = _mbChangeBits; } else { // one change bit per 4x4 block - _indexStream = _mbChangeBits + _mbChangeBitsRowSize * (_height >> 2); + _indexStream = _mbChangeBits + _mbChangeBitsRowSize * (_header.ysize >> 2); } _indexStreamSize = stream.size() - (_indexStream - _buf); @@ -306,11 +307,11 @@ void TrueMotion1Decoder::decode16() { int index; // clean out the line buffer - memset(_vertPred, 0, _width * 4); + memset(_vertPred, 0, _header.xsize * 4); GET_NEXT_INDEX(); - for (int y = 0; y < _height; y++) { + for (int y = 0; y < _header.ysize; y++) { // re-init variables for the next line iteration uint32 horizPred = 0; uint32 *currentPixelPair = (uint32 *)_surface->getBasePtr(0, y); @@ -319,7 +320,7 @@ void TrueMotion1Decoder::decode16() { byte mbChangeByte = _mbChangeBits[mbChangeIndex++]; byte mbChangeByteMask = 1; - for (int pixelsLeft = _width; pixelsLeft > 0; pixelsLeft -= 4) { + for (int pixelsLeft = _header.xsize; pixelsLeft > 0; pixelsLeft -= 4) { if (keyframe || (mbChangeByte & mbChangeByteMask) == 0) { switch (y & 3) { case 0: diff --git a/image/codecs/truemotion1.h b/image/codecs/truemotion1.h index 12570f066c..bbbcd6d6be 100644 --- a/image/codecs/truemotion1.h +++ b/image/codecs/truemotion1.h @@ -54,7 +54,6 @@ private: byte *_buf, *_mbChangeBits, *_indexStream; int _indexStreamSize; - uint16 _width, _height; int _flags; struct PredictorTableEntry { -- cgit v1.2.3 From 8c3e8624f04621d947f94bad6f19b55ad961530a Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Mon, 26 May 2014 17:55:39 -0400 Subject: IMAGE: Ensure the truemotion surface is cleared to black before decoding --- image/codecs/truemotion1.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/image/codecs/truemotion1.cpp b/image/codecs/truemotion1.cpp index b5f7c76f6b..741b9d51eb 100644 --- a/image/codecs/truemotion1.cpp +++ b/image/codecs/truemotion1.cpp @@ -30,6 +30,7 @@ #include "image/codecs/truemotion1data.h" #include "common/stream.h" #include "common/textconsole.h" +#include "common/rect.h" #include "common/util.h" namespace Image { @@ -91,6 +92,7 @@ static const CompressionType compressionTypes[17] = { TrueMotion1Decoder::TrueMotion1Decoder(uint16 width, uint16 height) { _surface = new Graphics::Surface(); _surface->create(width, height, getPixelFormat()); + _surface->fillRect(Common::Rect(width, height), getPixelFormat().RGBToColor(0, 0, 0)); _vertPred = 0; -- cgit v1.2.3 From e80f960559f96ae6106edbde5bd317f60bc05014 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Mon, 26 May 2014 23:06:51 +0100 Subject: MADS: Fix missing initialization in MADSAction class. Fixes CID #1216232. --- engines/mads/action.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index 0b853e1182..4672ffa54c 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -55,6 +55,7 @@ MADSAction::MADSAction(MADSEngine *vm) : _vm(vm) { _statusTextIndex = -1; _selectedAction = 0; _inProgress = false; + _pickedWord = -1; _savedFields._commandSource = 0; _savedFields._mainObjectSource = 0; -- cgit v1.2.3 From 8f4859df33f06bbfc16792bcac95f77d6a6d8fe9 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Mon, 26 May 2014 23:08:07 +0100 Subject: MADS: Fix missing initialization in EventsManager class. Fixes CID #1216233. --- engines/mads/events.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp index 3f2a7390fb..e1240da030 100644 --- a/engines/mads/events.cpp +++ b/engines/mads/events.cpp @@ -33,6 +33,8 @@ namespace MADS { EventsManager::EventsManager(MADSEngine *vm) { _vm = vm; _cursorSprites = nullptr; + _cursorId = CURSOR_NONE; + _newCursorId = CURSOR_NONE; _frameCounter = 10; _priorFrameTime = 0; _mouseClicked = false; -- cgit v1.2.3 From 13b8e1b0ded6717ba59f836606164258a8d1bb86 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 26 May 2014 23:51:37 +0200 Subject: MADS: Initialize _srcSize in SpriteAsset --- engines/mads/assets.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/engines/mads/assets.cpp b/engines/mads/assets.cpp index 1cb174bbed..0bbf6177eb 100644 --- a/engines/mads/assets.cpp +++ b/engines/mads/assets.cpp @@ -29,11 +29,11 @@ namespace MADS { -SpriteAsset::SpriteAsset(MADSEngine *vm, const Common::String &resourceName, int flags) : - _vm(vm) { +SpriteAsset::SpriteAsset(MADSEngine *vm, const Common::String &resourceName, int flags) : _vm(vm) { Common::String resName = resourceName; if (!resName.hasSuffix(".SS") && !resName.hasSuffix(".ss")) resName += ".SS"; + _srcSize = 0; File file(resName); load(&file, flags); @@ -41,8 +41,9 @@ SpriteAsset::SpriteAsset(MADSEngine *vm, const Common::String &resourceName, int file.close(); } -SpriteAsset::SpriteAsset(MADSEngine *vm, Common::SeekableReadStream *stream, int flags) : - _vm(vm) { +SpriteAsset::SpriteAsset(MADSEngine *vm, Common::SeekableReadStream *stream, int flags) : _vm(vm) { + _srcSize = 0; + load(stream, flags); } -- cgit v1.2.3 From d3860c573e1bea5825b9481e29570690895255ea Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 27 May 2014 00:01:59 +0200 Subject: MADS: Initialize some variables in MADSAction --- engines/mads/action.cpp | 8 ++++++++ engines/mads/action.h | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index 4672ffa54c..1e09ce7421 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -65,6 +65,14 @@ MADSAction::MADSAction(MADSEngine *vm) : _vm(vm) { _savedFields._secondObjectSource = 0; _savedFields._articleNumber = PREP_NONE; _savedFields._lookFlag = false; + + _activeAction._verbId = VERB_NONE; + _activeAction._objectNameId = -1; + _activeAction._indirectObjectId = -1; + _savedFields._commandError = false; + _verbType = VERB_INIT; + _prepType = PREP_NONE; + _pickedWord = -1; } void MADSAction::clear() { diff --git a/engines/mads/action.h b/engines/mads/action.h index 3010226787..cfd5a3be3f 100644 --- a/engines/mads/action.h +++ b/engines/mads/action.h @@ -58,7 +58,7 @@ enum { VERB_WALKTO = 13 }; -enum VerbType { VERB_ONLY, VERB_THIS, VERB_THAT }; +enum VerbType { VERB_ONLY, VERB_THIS, VERB_THAT, VERB_INIT }; enum PrepType { PREP_NONE, PREP_WITH, PREP_TO, PREP_AT, PREP_FROM, PREP_ON, PREP_IN, -- cgit v1.2.3 From e7f467c41f96d2eaf7ffb017e635815105417bea Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 27 May 2014 00:05:07 +0200 Subject: MADS: Initialize some variables in EventsManager --- engines/mads/events.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp index e1240da030..b72d3f42e7 100644 --- a/engines/mads/events.cpp +++ b/engines/mads/events.cpp @@ -46,6 +46,7 @@ EventsManager::EventsManager(MADSEngine *vm) { _mouseMoved = false; _vD8 = 0; _rightMousePressed = false; + _cursorId = _newCursorId = CURSOR_NONE; } EventsManager::~EventsManager() { -- cgit v1.2.3 From c2ece0c82e57e29da2695b6915df6e3aecd9a608 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 27 May 2014 00:09:16 +0200 Subject: MADS: Avoid double-initialization in EventsManager --- engines/mads/events.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/engines/mads/events.cpp b/engines/mads/events.cpp index b72d3f42e7..e1240da030 100644 --- a/engines/mads/events.cpp +++ b/engines/mads/events.cpp @@ -46,7 +46,6 @@ EventsManager::EventsManager(MADSEngine *vm) { _mouseMoved = false; _vD8 = 0; _rightMousePressed = false; - _cursorId = _newCursorId = CURSOR_NONE; } EventsManager::~EventsManager() { -- cgit v1.2.3 From 7caf5fba4b748b0dc1cbe381b100e4a6682279b6 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 27 May 2014 00:13:05 +0200 Subject: MADS: Remove another double-init in MADSAction --- engines/mads/action.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/engines/mads/action.cpp b/engines/mads/action.cpp index 1e09ce7421..edb5f0f8f2 100644 --- a/engines/mads/action.cpp +++ b/engines/mads/action.cpp @@ -72,7 +72,6 @@ MADSAction::MADSAction(MADSEngine *vm) : _vm(vm) { _savedFields._commandError = false; _verbType = VERB_INIT; _prepType = PREP_NONE; - _pickedWord = -1; } void MADSAction::clear() { -- cgit v1.2.3 From 57c5656169d4736e2867aad60983b9a9ad9400a3 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 27 May 2014 00:40:07 +0200 Subject: MADS: Initialize some variables in FontManager --- engines/mads/font.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/engines/mads/font.cpp b/engines/mads/font.cpp index 6f2d2b8168..6af1346f01 100644 --- a/engines/mads/font.cpp +++ b/engines/mads/font.cpp @@ -63,10 +63,16 @@ Font *Font::getFont(const Common::String &fontName) { } Font::Font() { + _charWidths = nullptr; + _charOffs = nullptr; + _charData = nullptr; setFont(FONT_INTERFACE); } Font::Font(const Common::String &filename) { + _charWidths = nullptr; + _charOffs = nullptr; + _charData = nullptr; setFont(filename); } -- cgit v1.2.3 From 9866aba2e43da914a17d17b695456ca25a875469 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 27 May 2014 00:58:25 +0200 Subject: MADS: Slight formatting fixes. --- engines/mads/dialogs.cpp | 16 +++++++++------- engines/mads/dragonsphere/game_dragonsphere.cpp | 3 ++- engines/mads/dragonsphere/game_dragonsphere.h | 2 +- engines/mads/game.cpp | 5 +++-- engines/mads/game_data.h | 2 +- engines/mads/inventory.h | 2 +- engines/mads/messages.cpp | 3 ++- engines/mads/nebular/game_nebular.cpp | 3 ++- engines/mads/nebular/game_nebular.h | 2 +- engines/mads/nebular/globals_nebular.cpp | 3 ++- engines/mads/nebular/sound_nebular.cpp | 3 ++- engines/mads/palette.cpp | 3 ++- engines/mads/phantom/game_phantom.cpp | 3 ++- engines/mads/phantom/game_phantom.h | 2 +- engines/mads/player.cpp | 3 ++- engines/mads/resources.cpp | 7 ++++--- engines/mads/resources.h | 4 ++-- engines/mads/scene.cpp | 9 +++++---- engines/mads/scene_data.h | 5 +++-- engines/mads/sprites.cpp | 9 +++++---- 20 files changed, 52 insertions(+), 37 deletions(-) diff --git a/engines/mads/dialogs.cpp b/engines/mads/dialogs.cpp index b1a0b53b5a..dc8c846beb 100644 --- a/engines/mads/dialogs.cpp +++ b/engines/mads/dialogs.cpp @@ -29,8 +29,9 @@ namespace MADS { -Dialog::Dialog(MADSEngine *vm): _vm(vm), _savedSurface(nullptr), - _position(Common::Point(-1, -1)), _width(0), _height(0) { +Dialog::Dialog(MADSEngine *vm) + : _vm(vm), _savedSurface(nullptr), _position(Common::Point(-1, -1)), + _width(0), _height(0) { TEXTDIALOG_CONTENT1 = 0XF8; TEXTDIALOG_CONTENT2 = 0XF9; TEXTDIALOG_EDGE = 0XFA; @@ -136,8 +137,8 @@ void Dialog::drawContent(const Common::Rect &r, int seed, byte color1, byte colo /*------------------------------------------------------------------------*/ TextDialog::TextDialog(MADSEngine *vm, const Common::String &fontName, - const Common::Point &pos, int maxChars): - Dialog(vm) { + const Common::Point &pos, int maxChars) + : Dialog(vm) { _vm = vm; _font = _vm->_font->getFont(fontName); _position = pos; @@ -363,8 +364,8 @@ void TextDialog::show() { /*------------------------------------------------------------------------*/ -MessageDialog::MessageDialog(MADSEngine *vm, int maxChars, ...): - TextDialog(vm, FONT_INTERFACE, Common::Point(-1, -1), maxChars) { +MessageDialog::MessageDialog(MADSEngine *vm, int maxChars, ...) + : TextDialog(vm, FONT_INTERFACE, Common::Point(-1, -1), maxChars) { // Add in passed line list va_list va; va_start(va, maxChars); @@ -389,7 +390,8 @@ Dialogs *Dialogs::init(MADSEngine *vm) { return new Nebular::DialogsNebular(vm); } -Dialogs::Dialogs(MADSEngine *vm): _vm(vm) { +Dialogs::Dialogs(MADSEngine *vm) + : _vm(vm) { _pendingDialog = DIALOG_NONE; } diff --git a/engines/mads/dragonsphere/game_dragonsphere.cpp b/engines/mads/dragonsphere/game_dragonsphere.cpp index bee5312660..c6097125b1 100644 --- a/engines/mads/dragonsphere/game_dragonsphere.cpp +++ b/engines/mads/dragonsphere/game_dragonsphere.cpp @@ -35,7 +35,8 @@ namespace MADS { namespace Dragonsphere { -GameDragonsphere::GameDragonsphere(MADSEngine *vm): Game(vm) { +GameDragonsphere::GameDragonsphere(MADSEngine *vm) + : Game(vm) { _surface = new MSurface(MADS_SCREEN_WIDTH, MADS_SCENE_HEIGHT); _storyMode = STORYMODE_NAUGHTY; } diff --git a/engines/mads/dragonsphere/game_dragonsphere.h b/engines/mads/dragonsphere/game_dragonsphere.h index 259c4168c1..b4c4c41d20 100644 --- a/engines/mads/dragonsphere/game_dragonsphere.h +++ b/engines/mads/dragonsphere/game_dragonsphere.h @@ -127,7 +127,7 @@ public: class Section1Handler: public SectionHandler { public: - Section1Handler(MADSEngine *vm): SectionHandler(vm) {} + Section1Handler(MADSEngine *vm) : SectionHandler(vm) {} // TODO: Properly implement handler methods virtual void preLoadSection() {} diff --git a/engines/mads/game.cpp b/engines/mads/game.cpp index 3f424711f7..f1744d8407 100644 --- a/engines/mads/game.cpp +++ b/engines/mads/game.cpp @@ -56,8 +56,9 @@ Game *Game::init(MADSEngine *vm) { return nullptr; } -Game::Game(MADSEngine *vm): _vm(vm), _surface(nullptr), _objects(vm), - _scene(vm), _screenObjects(vm), _player(vm) { +Game::Game(MADSEngine *vm) + : _vm(vm), _surface(nullptr), _objects(vm), _scene(vm), + _screenObjects(vm), _player(vm) { _sectionNumber = _priorSectionNumber = 0; _loadGameSlot = -1; _lastSave = -1; diff --git a/engines/mads/game_data.h b/engines/mads/game_data.h index 6ea59d6d2b..cf2d0bdf60 100644 --- a/engines/mads/game_data.h +++ b/engines/mads/game_data.h @@ -59,7 +59,7 @@ class SectionHandler { protected: MADSEngine *_vm; public: - SectionHandler(MADSEngine *vm): _vm(vm) {} + SectionHandler(MADSEngine *vm) : _vm(vm) {} virtual ~SectionHandler() {} virtual void preLoadSection() = 0; diff --git a/engines/mads/inventory.h b/engines/mads/inventory.h index 7fb123e047..a2f35c333d 100644 --- a/engines/mads/inventory.h +++ b/engines/mads/inventory.h @@ -87,7 +87,7 @@ public: /** * Constructor */ - InventoryObjects(MADSEngine *vm): _vm(vm) {} + InventoryObjects(MADSEngine *vm) : _vm(vm) {} /** * Loads the game's object list diff --git a/engines/mads/messages.cpp b/engines/mads/messages.cpp index e85a582cda..f5d1047a86 100644 --- a/engines/mads/messages.cpp +++ b/engines/mads/messages.cpp @@ -42,7 +42,8 @@ void RandomMessages::reset() { } -KernelMessages::KernelMessages(MADSEngine *vm): _vm(vm) { +KernelMessages::KernelMessages(MADSEngine *vm) + : _vm(vm) { for (int i = 0; i < KERNEL_MESSAGES_SIZE; ++i) { KernelMessage rec; _entries.push_back(rec); diff --git a/engines/mads/nebular/game_nebular.cpp b/engines/mads/nebular/game_nebular.cpp index 28daf74488..db9ea2c7d1 100644 --- a/engines/mads/nebular/game_nebular.cpp +++ b/engines/mads/nebular/game_nebular.cpp @@ -35,7 +35,8 @@ namespace MADS { namespace Nebular { -GameNebular::GameNebular(MADSEngine *vm): Game(vm) { +GameNebular::GameNebular(MADSEngine *vm) + : Game(vm) { _surface = new MSurface(MADS_SCREEN_WIDTH, MADS_SCENE_HEIGHT); _storyMode = STORYMODE_NAUGHTY; _difficulty = DIFFICULTY_EASY; diff --git a/engines/mads/nebular/game_nebular.h b/engines/mads/nebular/game_nebular.h index 56bcf44a3f..ee30492792 100644 --- a/engines/mads/nebular/game_nebular.h +++ b/engines/mads/nebular/game_nebular.h @@ -129,7 +129,7 @@ public: class Section1Handler: public SectionHandler { public: - Section1Handler(MADSEngine *vm): SectionHandler(vm) {} + Section1Handler(MADSEngine *vm) : SectionHandler(vm) {} // TODO: Properly implement handler methods virtual void preLoadSection() {} diff --git a/engines/mads/nebular/globals_nebular.cpp b/engines/mads/nebular/globals_nebular.cpp index 7bb89a570c..9f8b8a7888 100644 --- a/engines/mads/nebular/globals_nebular.cpp +++ b/engines/mads/nebular/globals_nebular.cpp @@ -28,7 +28,8 @@ namespace MADS { namespace Nebular { -NebularGlobals::NebularGlobals(): Globals() { +NebularGlobals::NebularGlobals() + : Globals() { // Initialize lists resize(210); _spriteIndexes.resize(30); diff --git a/engines/mads/nebular/sound_nebular.cpp b/engines/mads/nebular/sound_nebular.cpp index 5d1daf1b3c..608a31cb25 100644 --- a/engines/mads/nebular/sound_nebular.cpp +++ b/engines/mads/nebular/sound_nebular.cpp @@ -934,7 +934,8 @@ const ASound1::CommandPtr ASound1::_commandList[42] = { &ASound1::command40, &ASound1::command41 }; -ASound1::ASound1(Audio::Mixer *mixer): ASound(mixer, "asound.001", 0x1520) { +ASound1::ASound1(Audio::Mixer *mixer) + : ASound(mixer, "asound.001", 0x1520) { _cmd23Toggle = false; // Load sound samples diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index 9f56223aa6..b5a379dfde 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -336,7 +336,8 @@ void RGBList::copy(RGBList &src) { /*------------------------------------------------------------------------*/ -Fader::Fader(MADSEngine *vm): _vm(vm) { +Fader::Fader(MADSEngine *vm) + : _vm(vm) { _colorFlags[0] = _colorFlags[1] = _colorFlags[2] = true; _colorFlags[3] = false; _colorValues[0] = _colorValues[1] = 0; diff --git a/engines/mads/phantom/game_phantom.cpp b/engines/mads/phantom/game_phantom.cpp index bcaec8e648..15ac241d8c 100644 --- a/engines/mads/phantom/game_phantom.cpp +++ b/engines/mads/phantom/game_phantom.cpp @@ -35,7 +35,8 @@ namespace MADS { namespace Phantom { -GamePhantom::GamePhantom(MADSEngine *vm): Game(vm) { +GamePhantom::GamePhantom(MADSEngine *vm) + : Game(vm) { _surface = new MSurface(MADS_SCREEN_WIDTH, MADS_SCENE_HEIGHT); _storyMode = STORYMODE_NAUGHTY; } diff --git a/engines/mads/phantom/game_phantom.h b/engines/mads/phantom/game_phantom.h index c99e81ee70..326a1dc077 100644 --- a/engines/mads/phantom/game_phantom.h +++ b/engines/mads/phantom/game_phantom.h @@ -103,7 +103,7 @@ public: class Section1Handler: public SectionHandler { public: - Section1Handler(MADSEngine *vm): SectionHandler(vm) {} + Section1Handler(MADSEngine *vm) : SectionHandler(vm) {} // TODO: Properly implement handler methods virtual void preLoadSection() {} diff --git a/engines/mads/player.cpp b/engines/mads/player.cpp index 077771306e..aaef9dffdf 100644 --- a/engines/mads/player.cpp +++ b/engines/mads/player.cpp @@ -32,7 +32,8 @@ const int Player::_directionListIndexes[32] = { 0, 7, 4, 3, 6, 0, 2, 5, 0, 1, 9, 4, 1, 2, 7, 9, 3, 8, 9, 6, 7, 2, 3, 6, 1, 7, 9, 4, 7, 8, 0, 0 }; -Player::Player(MADSEngine *vm): _vm(vm) { +Player::Player(MADSEngine *vm) + : _vm(vm) { _action = nullptr; _facing = FACING_NORTH; _turnToFacing = FACING_NORTH; diff --git a/engines/mads/resources.cpp b/engines/mads/resources.cpp index 0bb95debdf..1fb75e6ba2 100644 --- a/engines/mads/resources.cpp +++ b/engines/mads/resources.cpp @@ -44,9 +44,10 @@ private: uint32 _offset; uint32 _size; - HagEntry(): _offset(0), _size(0) {} - HagEntry(Common::String resourceName, uint32 offset, uint32 size): - _resourceName(resourceName), _offset(offset), _size(size) {} + HagEntry() : _offset(0), _size(0) {} + HagEntry(Common::String resourceName, uint32 offset, uint32 size) + : _resourceName(resourceName), _offset(offset), _size(size) { + } }; class HagIndex { diff --git a/engines/mads/resources.h b/engines/mads/resources.h index 003684ef84..8d9ab1e39f 100644 --- a/engines/mads/resources.h +++ b/engines/mads/resources.h @@ -58,12 +58,12 @@ public: /** * Derived file class */ -class File: public Common::File { +class File : public Common::File { public: /** * Constructor */ - File(): Common::File() {} + File() : Common::File() {} /** * Constructor diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 4af956a9f6..7b54034753 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -30,10 +30,11 @@ namespace MADS { -Scene::Scene(MADSEngine *vm): _vm(vm), _action(_vm), _depthSurface(vm), - _dirtyAreas(_vm), _dynamicHotspots(vm), _hotspots(vm), - _kernelMessages(vm), _sequences(vm), _sprites(vm), _spriteSlots(vm), - _textDisplay(vm), _userInterface(vm) { +Scene::Scene(MADSEngine *vm) + : _vm(vm), _action(_vm), _depthSurface(vm), + _dirtyAreas(_vm), _dynamicHotspots(vm), _hotspots(vm), + _kernelMessages(vm), _sequences(vm), _sprites(vm), _spriteSlots(vm), + _textDisplay(vm), _userInterface(vm) { _priorSceneId = 0; _nextSceneId = 0; _currentSceneId = 0; diff --git a/engines/mads/scene_data.h b/engines/mads/scene_data.h index 392383af2f..78b43fb03b 100644 --- a/engines/mads/scene_data.h +++ b/engines/mads/scene_data.h @@ -65,8 +65,9 @@ public: PrepType _prepType; VerbInit() {} - VerbInit(int id, VerbType verbType, PrepType prepType): _id(id), - _verbType(verbType), _prepType(prepType) {} + VerbInit(int id, VerbType verbType, PrepType prepType) + : _id(id), _verbType(verbType), _prepType(prepType) { + } }; class SceneLogic { diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp index c98a0963f6..89d610f2f1 100644 --- a/engines/mads/sprites.cpp +++ b/engines/mads/sprites.cpp @@ -54,13 +54,14 @@ typedef Common::List DepthList; /*------------------------------------------------------------------------*/ -MSprite::MSprite(): MSurface() { +MSprite::MSprite() + : MSurface() { } MSprite::MSprite(Common::SeekableReadStream *source, const Common::Array &palette, - const Common::Rect &bounds): - MSurface(bounds.width(), bounds.height()), - _offset(Common::Point(bounds.left, bounds.top)) { + const Common::Rect &bounds) + : MSurface(bounds.width(), bounds.height()), + _offset(Common::Point(bounds.left, bounds.top)) { // Load the sprite data loadSprite(source, palette); } -- cgit v1.2.3 From db3ca8255fd0f237e2b180a94e3124e0caf00e45 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 27 May 2014 00:58:25 +0200 Subject: MADS: More formatting fixes. Add space before : in inheritance. --- engines/mads/dialogs.h | 4 +- engines/mads/dragonsphere/dragonsphere_scenes.h | 2 +- engines/mads/dragonsphere/game_dragonsphere.h | 6 +-- engines/mads/game_data.h | 2 +- engines/mads/globals.h | 2 +- engines/mads/inventory.h | 2 +- engines/mads/messages.h | 4 +- engines/mads/nebular/dialogs_nebular.h | 4 +- engines/mads/nebular/game_nebular.h | 4 +- engines/mads/nebular/globals_nebular.h | 2 +- engines/mads/nebular/nebular_scenes1.h | 2 +- engines/mads/nebular/nebular_scenes2.h | 28 +++++------ engines/mads/nebular/nebular_scenes3.h | 64 ++++++++++++------------- engines/mads/nebular/nebular_scenes4.h | 20 ++++---- engines/mads/nebular/nebular_scenes5.h | 26 +++++----- engines/mads/nebular/nebular_scenes6.h | 24 +++++----- engines/mads/nebular/nebular_scenes7.h | 22 ++++----- engines/mads/nebular/nebular_scenes8.h | 16 +++---- engines/mads/nebular/sound_nebular.h | 4 +- engines/mads/palette.h | 2 +- engines/mads/phantom/game_phantom.h | 6 +-- engines/mads/phantom/phantom_scenes.h | 2 +- engines/mads/sprites.h | 2 +- 23 files changed, 125 insertions(+), 125 deletions(-) diff --git a/engines/mads/dialogs.h b/engines/mads/dialogs.h index 6de6ea71c1..aad29f6551 100644 --- a/engines/mads/dialogs.h +++ b/engines/mads/dialogs.h @@ -96,7 +96,7 @@ public: #define TEXT_DIALOG_MAX_LINES 20 -class TextDialog: protected Dialog { +class TextDialog : protected Dialog { private: /** * Append text to the currently end line. @@ -192,7 +192,7 @@ public: virtual void show(); }; -class MessageDialog: public TextDialog { +class MessageDialog : public TextDialog { public: MessageDialog(MADSEngine *vm, int lines, ...); diff --git a/engines/mads/dragonsphere/dragonsphere_scenes.h b/engines/mads/dragonsphere/dragonsphere_scenes.h index 2d23381d25..a6c778eca7 100644 --- a/engines/mads/dragonsphere/dragonsphere_scenes.h +++ b/engines/mads/dragonsphere/dragonsphere_scenes.h @@ -677,7 +677,7 @@ public: }; // TODO: Temporary, remove once implemented properly -class DummyScene: public DragonsphereScene { +class DummyScene : public DragonsphereScene { public: DummyScene(MADSEngine *vm) : DragonsphereScene(vm) { warning("Unimplemented scene"); diff --git a/engines/mads/dragonsphere/game_dragonsphere.h b/engines/mads/dragonsphere/game_dragonsphere.h index b4c4c41d20..5147f75178 100644 --- a/engines/mads/dragonsphere/game_dragonsphere.h +++ b/engines/mads/dragonsphere/game_dragonsphere.h @@ -89,7 +89,7 @@ enum InventoryObject { }; // HACK: A stub for now, remove from here once it's implemented properly -class DragonsphereGlobals: public Globals { +class DragonsphereGlobals : public Globals { public: DragonsphereGlobals() { resize(210); // Rex has 210 globals @@ -97,7 +97,7 @@ public: virtual ~DragonsphereGlobals() {} }; -class GameDragonsphere: public Game { +class GameDragonsphere : public Game { friend class Game; protected: GameDragonsphere(MADSEngine *vm); @@ -125,7 +125,7 @@ public: }; -class Section1Handler: public SectionHandler { +class Section1Handler : public SectionHandler { public: Section1Handler(MADSEngine *vm) : SectionHandler(vm) {} diff --git a/engines/mads/game_data.h b/engines/mads/game_data.h index cf2d0bdf60..f15cd1a8f0 100644 --- a/engines/mads/game_data.h +++ b/engines/mads/game_data.h @@ -32,7 +32,7 @@ namespace MADS { class MADSEngine; class Game; -class VisitedScenes: public SynchronizedList { +class VisitedScenes : public SynchronizedList { public: /** * Stores true when a previously visited scene is revisited diff --git a/engines/mads/globals.h b/engines/mads/globals.h index 92cd0bb403..a6c9b628dd 100644 --- a/engines/mads/globals.h +++ b/engines/mads/globals.h @@ -30,7 +30,7 @@ namespace MADS { -class Globals: public SynchronizedList { +class Globals : public SynchronizedList { public: Globals() {} diff --git a/engines/mads/inventory.h b/engines/mads/inventory.h index a2f35c333d..09ed67a826 100644 --- a/engines/mads/inventory.h +++ b/engines/mads/inventory.h @@ -77,7 +77,7 @@ public: int getQuality(int qualityId) const; }; -class InventoryObjects: public Common::Array { +class InventoryObjects : public Common::Array { private: MADSEngine *_vm; diff --git a/engines/mads/messages.h b/engines/mads/messages.h index 241f493434..1eff14bfa5 100644 --- a/engines/mads/messages.h +++ b/engines/mads/messages.h @@ -72,7 +72,7 @@ struct RandomEntry { RandomEntry() { _handle = _quoteId = -1; } }; -class RandomMessages: public Common::Array { +class RandomMessages : public Common::Array { public: Common::Rect _bounds; int _randomSpacing; @@ -147,7 +147,7 @@ public: #define TEXT_DISPLAY_SIZE 40 -class TextDisplayList: public Common::Array { +class TextDisplayList : public Common::Array { private: MADSEngine *_vm; public: diff --git a/engines/mads/nebular/dialogs_nebular.h b/engines/mads/nebular/dialogs_nebular.h index 99a93f81cc..cb1ecfba28 100644 --- a/engines/mads/nebular/dialogs_nebular.h +++ b/engines/mads/nebular/dialogs_nebular.h @@ -33,7 +33,7 @@ namespace Nebular { enum CapitalizationMode { kUppercase = 0, kLowercase = 1, kUpperAndLower = 2 }; -class DialogsNebular: public Dialogs { +class DialogsNebular : public Dialogs { friend class Dialogs; private: int _dialogWidth; @@ -62,7 +62,7 @@ struct HOGANUS { Common::String _word; }; -class CopyProtectionDialog: public TextDialog { +class CopyProtectionDialog : public TextDialog { private: HOGANUS _hogEntry; diff --git a/engines/mads/nebular/game_nebular.h b/engines/mads/nebular/game_nebular.h index ee30492792..6620deaea6 100644 --- a/engines/mads/nebular/game_nebular.h +++ b/engines/mads/nebular/game_nebular.h @@ -96,7 +96,7 @@ enum InventoryObject { OBJ_LECITHIN = 54 }; -class GameNebular: public Game { +class GameNebular : public Game { friend class Game; protected: GameNebular(MADSEngine *vm); @@ -127,7 +127,7 @@ public: }; -class Section1Handler: public SectionHandler { +class Section1Handler : public SectionHandler { public: Section1Handler(MADSEngine *vm) : SectionHandler(vm) {} diff --git a/engines/mads/nebular/globals_nebular.h b/engines/mads/nebular/globals_nebular.h index 980e6ea1eb..88605a290e 100644 --- a/engines/mads/nebular/globals_nebular.h +++ b/engines/mads/nebular/globals_nebular.h @@ -280,7 +280,7 @@ enum { #define TELEPORTER_WORK_COUNT 6 // Total number that actually work -class NebularGlobals: public Globals { +class NebularGlobals : public Globals { public: SynchronizedList _spriteIndexes; SynchronizedList _sequenceIndexes; diff --git a/engines/mads/nebular/nebular_scenes1.h b/engines/mads/nebular/nebular_scenes1.h index 96d2bb95eb..1afa7fccc1 100644 --- a/engines/mads/nebular/nebular_scenes1.h +++ b/engines/mads/nebular/nebular_scenes1.h @@ -53,7 +53,7 @@ public: Scene1xx(MADSEngine *vm) : NebularScene(vm) {} }; -class Scene101: public Scene1xx { +class Scene101 : public Scene1xx { private: bool _sittingFl; bool _panelOpened; diff --git a/engines/mads/nebular/nebular_scenes2.h b/engines/mads/nebular/nebular_scenes2.h index e70444a256..c860db9470 100644 --- a/engines/mads/nebular/nebular_scenes2.h +++ b/engines/mads/nebular/nebular_scenes2.h @@ -49,7 +49,7 @@ public: Scene2xx(MADSEngine *vm) : NebularScene(vm) {} }; -class Scene201: public Scene2xx { +class Scene201 : public Scene2xx { private: bool _pterodactylFlag; @@ -63,7 +63,7 @@ public: virtual void actions(); }; -class Scene202: public Scene2xx { +class Scene202 : public Scene2xx { private: bool _activeMsgFl, _ladderTopFl, _waitingMeteoFl, _toStationFl, _toTeleportFl; int _ladderHotspotId, _lastRoute, _stationCounter, _meteoFrame; @@ -88,7 +88,7 @@ public: void setRandomKernelMessage(); }; -class Scene203: public Scene2xx { +class Scene203 : public Scene2xx { private: bool _rhotundaEat2Fl, _rhotundaEatFl; @@ -103,7 +103,7 @@ public: virtual void actions(); }; -class Scene205: public Scene2xx { +class Scene205 : public Scene2xx { private: uint32 _lastFishTime, _chickenTime; bool _beingKicked; @@ -122,7 +122,7 @@ public: virtual void actions(); }; -class Scene207: public Scene2xx { +class Scene207 : public Scene2xx { private: bool _vultureFl, _spiderFl, _eyeFl; int _spiderHotspotId, _vultureHotspotId; @@ -142,7 +142,7 @@ public: virtual void actions(); }; -class Scene208: public Scene2xx { +class Scene208 : public Scene2xx { private: bool _rhotundaTurnFl, _boundingFl; int32 _rhotundaTime; @@ -161,7 +161,7 @@ public: virtual void actions(); }; -class Scene209: public Scene2xx { +class Scene209 : public Scene2xx { private: bool _dodgeFl, _forceDodgeFl, _shouldDodgeFl; bool _pitchFl; @@ -207,7 +207,7 @@ public: virtual void actions(); }; -class Scene210: public Scene2xx { +class Scene210 : public Scene2xx { private: int _curDialogNode; int _nextHandsPlace; @@ -246,7 +246,7 @@ public: virtual void actions(); }; -class Scene211: public Scene2xx { +class Scene211 : public Scene2xx { private: bool _ambushFl, _wakeFl; int _monkeyFrame, _scrollY; @@ -263,7 +263,7 @@ public: virtual void actions(); }; -class Scene212: public Scene2xx { +class Scene212 : public Scene2xx { public: Scene212(MADSEngine *vm) : Scene2xx(vm) {} virtual void setup(); @@ -273,7 +273,7 @@ public: virtual void actions(); }; -class Scene213: public SceneTeleporter { +class Scene213 : public SceneTeleporter { public: Scene213(MADSEngine *vm) : SceneTeleporter(vm) {} @@ -283,7 +283,7 @@ public: virtual void actions(); }; -class Scene214: public Scene2xx { +class Scene214 : public Scene2xx { private: uint32 _devilTime; bool _devilRunningFl; @@ -298,7 +298,7 @@ public: virtual void actions(); }; -class Scene215: public Scene2xx { +class Scene215 : public Scene2xx { public: Scene215(MADSEngine *vm) : Scene2xx(vm) {} @@ -308,7 +308,7 @@ public: virtual void actions(); }; -class Scene216: public Scene2xx { +class Scene216 : public Scene2xx { public: Scene216(MADSEngine *vm) : Scene2xx(vm) {} diff --git a/engines/mads/nebular/nebular_scenes3.h b/engines/mads/nebular/nebular_scenes3.h index 30ab333e53..d44a81520a 100644 --- a/engines/mads/nebular/nebular_scenes3.h +++ b/engines/mads/nebular/nebular_scenes3.h @@ -80,7 +80,7 @@ public: virtual void preActions(); }; -class Scene301: public Scene3xx { +class Scene301 : public Scene3xx { public: Scene301(MADSEngine *vm) : Scene3xx(vm) {} @@ -89,7 +89,7 @@ public: virtual void step(); }; -class Scene302: public Scene3xx { +class Scene302 : public Scene3xx { private: int _oldFrame; @@ -102,7 +102,7 @@ public: virtual void step(); }; -class Scene303: public Scene3xx { +class Scene303 : public Scene3xx { public: Scene303(MADSEngine *vm) : Scene3xx(vm) {} @@ -111,7 +111,7 @@ public: virtual void step(); }; -class Scene304: public Scene3xx { +class Scene304 : public Scene3xx { private: int _explosionSpriteId; @@ -124,7 +124,7 @@ public: virtual void step(); }; -class Scene307: public Scene3xx { +class Scene307 : public Scene3xx { private: ForceField _forceField; @@ -162,7 +162,7 @@ public: virtual void actions(); }; -class Scene308: public Scene3xx { +class Scene308 : public Scene3xx { private: ForceField _forceField; @@ -175,7 +175,7 @@ public: virtual void step(); }; -class Scene309: public Scene3xx { +class Scene309 : public Scene3xx { private: ForceField _forceField; int _characterSpriteIndexes[3]; @@ -191,7 +191,7 @@ public: virtual void step(); }; -class Scene310: public Scene3xx { +class Scene310 : public Scene3xx { private: ForceField _forceField; @@ -204,7 +204,7 @@ public: virtual void step(); }; -class Scene311: public Scene3xx { +class Scene311 : public Scene3xx { private: bool _checkGuardFl; @@ -218,7 +218,7 @@ public: virtual void actions(); }; -class Scene313: public Scene3xx { +class Scene313 : public Scene3xx { public: Scene313(MADSEngine *vm) : Scene3xx(vm) {} @@ -227,7 +227,7 @@ public: virtual void actions(); }; -class Scene316: public Scene3xx { +class Scene316 : public Scene3xx { private: void handleRexInGrate(); void handleRoxInGrate(); @@ -242,7 +242,7 @@ public: virtual void actions(); }; -class Scene318: public Scene3xx { +class Scene318 : public Scene3xx { private: uint32 _dropTimer; @@ -278,7 +278,7 @@ public: virtual void actions(); }; -class Scene319: public Scene3xx { +class Scene319 : public Scene3xx { private: Conversation _dialog1, _dialog2, _dialog3; @@ -306,7 +306,7 @@ public: virtual void actions(); }; -class Scene320: public Scene300s { +class Scene320 : public Scene300s { private: void setRightView(int view); void setLeftView(int view); @@ -331,7 +331,7 @@ public: virtual void actions(); }; -class Scene321: public Scene3xx { +class Scene321 : public Scene3xx { public: Scene321(MADSEngine *vm) : Scene3xx(vm) {} @@ -340,7 +340,7 @@ public: virtual void step(); }; -class Scene322: public SceneTeleporter { +class Scene322 : public SceneTeleporter { public: Scene322(MADSEngine *vm) : SceneTeleporter(vm) {} @@ -350,7 +350,7 @@ public: virtual void actions(); }; -class Scene351: public Scene3xx { +class Scene351 : public Scene3xx { public: Scene351(MADSEngine *vm) : Scene3xx(vm) {} @@ -360,7 +360,7 @@ public: virtual void actions(); }; -class Scene352: public Scene3xx { +class Scene352 : public Scene3xx { private: bool _vaultOpenFl; bool _mustPutArmDownFl; @@ -385,7 +385,7 @@ public: virtual void actions(); }; -class Scene353: public Scene3xx { +class Scene353 : public Scene3xx { public: Scene353(MADSEngine *vm) : Scene3xx(vm) {} @@ -394,7 +394,7 @@ public: virtual void actions(); }; -class Scene354: public Scene3xx { +class Scene354 : public Scene3xx { public: Scene354(MADSEngine *vm) : Scene3xx(vm) {} @@ -404,7 +404,7 @@ public: virtual void actions(); }; -class Scene357: public Scene3xx { +class Scene357 : public Scene3xx { public: Scene357(MADSEngine *vm) : Scene3xx(vm) {} @@ -414,7 +414,7 @@ public: virtual void actions(); }; -class Scene358: public Scene3xx { +class Scene358 : public Scene3xx { public: Scene358(MADSEngine *vm) : Scene3xx(vm) {} @@ -424,7 +424,7 @@ public: virtual void actions(); }; -class Scene359: public Scene3xx { +class Scene359 : public Scene3xx { private: int _cardHotspotId; @@ -438,7 +438,7 @@ public: virtual void actions(); }; -class Scene360: public Scene3xx { +class Scene360 : public Scene3xx { public: Scene360(MADSEngine *vm) : Scene3xx(vm) {} @@ -448,7 +448,7 @@ public: virtual void actions(); }; -class Scene361: public Scene3xx { +class Scene361 : public Scene3xx { private: void handleRexAction(); void handleRoxAction(); @@ -463,7 +463,7 @@ public: virtual void actions(); }; -class Scene366: public Scene300s { +class Scene366 : public Scene300s { public: Scene366(MADSEngine *vm) : Scene300s(vm) {} @@ -472,7 +472,7 @@ public: virtual void actions(); }; -class Scene387: public Scene300s { +class Scene387 : public Scene300s { public: Scene387(MADSEngine *vm) : Scene300s(vm) {} @@ -481,7 +481,7 @@ public: virtual void actions(); }; -class Scene388: public Scene300s { +class Scene388 : public Scene300s { public: Scene388(MADSEngine *vm) : Scene300s(vm) {} @@ -490,7 +490,7 @@ public: virtual void actions(); }; -class Scene389: public Scene300s { +class Scene389 : public Scene300s { private: uint32 _monsterTime; @@ -506,7 +506,7 @@ public: virtual void actions(); }; -class Scene390: public Scene300s { +class Scene390 : public Scene300s { public: Scene390(MADSEngine *vm) : Scene300s(vm) {} @@ -515,7 +515,7 @@ public: virtual void actions(); }; -class Scene391: public Scene300s { +class Scene391 : public Scene300s { public: Scene391(MADSEngine *vm) : Scene300s(vm) {} @@ -524,7 +524,7 @@ public: virtual void actions(); }; -class Scene399: public Scene300s { +class Scene399 : public Scene300s { public: Scene399(MADSEngine *vm) : Scene300s(vm) {} diff --git a/engines/mads/nebular/nebular_scenes4.h b/engines/mads/nebular/nebular_scenes4.h index 4544e0887f..fbd5ce81f0 100644 --- a/engines/mads/nebular/nebular_scenes4.h +++ b/engines/mads/nebular/nebular_scenes4.h @@ -50,7 +50,7 @@ public: Scene4xx(MADSEngine *vm) : NebularScene(vm) {} }; -class Scene401: public Scene4xx { +class Scene401 : public Scene4xx { private: bool _northFl; Common::Point _destPos; @@ -67,7 +67,7 @@ public: virtual void actions(); }; -class Scene402: public Scene4xx { +class Scene402 : public Scene4xx { private: bool _lightOn; bool _blowingSmoke; @@ -128,7 +128,7 @@ public: virtual void actions(); }; -class Scene405: public Scene4xx { +class Scene405 : public Scene4xx { public: Scene405(MADSEngine *vm) : Scene4xx(vm) {} @@ -139,7 +139,7 @@ public: virtual void actions(); }; -class Scene406: public Scene4xx { +class Scene406 : public Scene4xx { private: bool _hitStorageDoor; @@ -154,7 +154,7 @@ public: virtual void actions(); }; -class Scene407: public Scene4xx { +class Scene407 : public Scene4xx { private: bool _fromNorth; Common::Point _destPos; @@ -170,7 +170,7 @@ public: virtual void actions(); }; -class Scene408: public Scene4xx { +class Scene408 : public Scene4xx { public: Scene408(MADSEngine *vm) : Scene4xx(vm) {} @@ -180,7 +180,7 @@ public: virtual void actions(); }; -class Scene409: public SceneTeleporter { +class Scene409 : public SceneTeleporter { public: Scene409(MADSEngine *vm) : SceneTeleporter(vm) {} @@ -190,7 +190,7 @@ public: virtual void actions(); }; -class Scene410: public Scene4xx { +class Scene410 : public Scene4xx { public: Scene410(MADSEngine *vm) : Scene4xx(vm) {} @@ -201,7 +201,7 @@ public: virtual void actions(); }; -class Scene411: public Scene4xx { +class Scene411 : public Scene4xx { private: int _curAnimationFrame; int _newIngredient; @@ -237,7 +237,7 @@ public: virtual void actions(); }; -class Scene413: public Scene4xx { +class Scene413 : public Scene4xx { private: int _rexDeath; int _canMove; diff --git a/engines/mads/nebular/nebular_scenes5.h b/engines/mads/nebular/nebular_scenes5.h index 4022f1c85b..2face26508 100644 --- a/engines/mads/nebular/nebular_scenes5.h +++ b/engines/mads/nebular/nebular_scenes5.h @@ -50,7 +50,7 @@ public: Scene5xx(MADSEngine *vm) : NebularScene(vm) {} }; -class Scene501: public Scene5xx{ +class Scene501 : public Scene5xx{ private: int _mainSequenceId; int _mainSpriteId; @@ -70,7 +70,7 @@ public: virtual void actions(); }; -class Scene502: public SceneTeleporter { +class Scene502 : public SceneTeleporter { public: Scene502(MADSEngine *vm) : SceneTeleporter(vm) {} @@ -80,7 +80,7 @@ public: virtual void actions(); }; -class Scene503: public Scene5xx{ +class Scene503 : public Scene5xx{ private: int _detonatorHotspotId; @@ -93,7 +93,7 @@ public: virtual void actions(); }; -class Scene504: public Scene5xx{ +class Scene504 : public Scene5xx{ private: int _carAnimationMode; int _carFrame; @@ -109,7 +109,7 @@ public: virtual void actions(); }; -class Scene505: public Scene5xx{ +class Scene505 : public Scene5xx{ private: int _frame; int _nextButtonId; @@ -129,7 +129,7 @@ public: virtual void actions(); }; -class Scene506: public Scene5xx{ +class Scene506 : public Scene5xx{ private: Common::Point _doorPos; Facing _heroFacing; @@ -155,7 +155,7 @@ public: virtual void actions(); }; -class Scene507: public Scene5xx{ +class Scene507 : public Scene5xx{ private: int _penlightHotspotId; @@ -168,7 +168,7 @@ public: virtual void actions(); }; -class Scene508: public Scene5xx{ +class Scene508 : public Scene5xx{ private: int _chosenObject; @@ -184,7 +184,7 @@ public: virtual void actions(); }; -class Scene511: public Scene5xx{ +class Scene511 : public Scene5xx{ private: bool _handingLine; bool _lineMoving; @@ -204,7 +204,7 @@ public: virtual void actions(); }; -class Scene512: public Scene5xx{ +class Scene512 : public Scene5xx{ private: int _fishingRodHotspotId; int _keyHotspotId; @@ -218,7 +218,7 @@ public: virtual void actions(); }; -class Scene513: public Scene5xx{ +class Scene513 : public Scene5xx{ public: Scene513(MADSEngine *vm) : Scene5xx(vm) {} @@ -228,7 +228,7 @@ public: virtual void actions(); }; -class Scene515: public Scene5xx{ +class Scene515 : public Scene5xx{ public: Scene515(MADSEngine *vm) : Scene5xx(vm) {} @@ -238,7 +238,7 @@ public: virtual void actions() {}; }; -class Scene551: public Scene5xx{ +class Scene551 : public Scene5xx{ public: Scene551(MADSEngine *vm) : Scene5xx(vm) {} diff --git a/engines/mads/nebular/nebular_scenes6.h b/engines/mads/nebular/nebular_scenes6.h index 74467858bd..c5cac56626 100644 --- a/engines/mads/nebular/nebular_scenes6.h +++ b/engines/mads/nebular/nebular_scenes6.h @@ -50,7 +50,7 @@ public: Scene6xx(MADSEngine *vm) : NebularScene(vm) {} }; -class Scene601: public Scene6xx{ +class Scene601 : public Scene6xx{ public: Scene601(MADSEngine *vm) : Scene6xx(vm) {} @@ -60,7 +60,7 @@ public: virtual void actions(); }; -class Scene602: public Scene6xx{ +class Scene602 : public Scene6xx{ private: int _lastSpriteIdx; int _lastSequenceIdx; @@ -78,7 +78,7 @@ public: virtual void actions(); }; -class Scene603: public Scene6xx{ +class Scene603 : public Scene6xx{ private: int _compactCaseHotspotId; int _noteHotspotId; @@ -92,7 +92,7 @@ public: virtual void actions(); }; -class Scene604: public Scene6xx{ +class Scene604 : public Scene6xx{ private: int _timebombHotspotId; int _bombMode; @@ -115,7 +115,7 @@ public: virtual void actions(); }; -class Scene605: public Scene6xx{ +class Scene605 : public Scene6xx{ public: Scene605(MADSEngine *vm) : Scene6xx(vm) {} @@ -125,7 +125,7 @@ public: virtual void actions(); }; -class Scene607: public Scene6xx{ +class Scene607 : public Scene6xx{ private: uint32 _dogTimer; uint32 _lastFrameTime; @@ -152,7 +152,7 @@ public: virtual void actions(); }; -class Scene608: public Scene6xx{ +class Scene608 : public Scene6xx{ private: int _carMode; int _carFrame; @@ -200,7 +200,7 @@ public: virtual void actions(); }; -class Scene609: public Scene6xx{ +class Scene609 : public Scene6xx{ private: int _videoDoorMode; @@ -217,7 +217,7 @@ public: virtual void actions(); }; -class Scene610: public Scene6xx{ +class Scene610 : public Scene6xx{ private: int _handsetHotspotId; int _checkVal; @@ -237,7 +237,7 @@ public: virtual void actions(); }; -class Scene611: public Scene6xx{ +class Scene611 : public Scene6xx{ private: bool _seenRatFl; bool _eyesRunningFl; @@ -290,7 +290,7 @@ public: virtual void actions(); }; -class Scene612: public Scene6xx{ +class Scene612 : public Scene6xx{ private: int _actionMode; int _cycleIndex; @@ -307,7 +307,7 @@ public: virtual void actions(); }; -class Scene620: public Scene6xx{ +class Scene620 : public Scene6xx{ public: Scene620(MADSEngine *vm) : Scene6xx(vm) {} diff --git a/engines/mads/nebular/nebular_scenes7.h b/engines/mads/nebular/nebular_scenes7.h index 454c76ebe9..dfb3c0f16e 100644 --- a/engines/mads/nebular/nebular_scenes7.h +++ b/engines/mads/nebular/nebular_scenes7.h @@ -50,7 +50,7 @@ public: Scene7xx(MADSEngine *vm) : NebularScene(vm) {} }; -class Scene701: public Scene7xx { +class Scene701 : public Scene7xx { private: int _fishingLineId; @@ -65,7 +65,7 @@ public: virtual void step(); }; -class Scene702: public Scene7xx { +class Scene702 : public Scene7xx { public: Scene702(MADSEngine *vm) : Scene7xx(vm) {} @@ -75,7 +75,7 @@ public: virtual void actions(); }; -class Scene703: public Scene7xx{ +class Scene703 : public Scene7xx{ private: int _monsterMode; int _boatFrame; @@ -106,7 +106,7 @@ public: virtual void actions(); }; -class Scene704: public Scene7xx{ +class Scene704 : public Scene7xx{ private: int _bottleHotspotId; int _boatCurrentFrame; @@ -131,7 +131,7 @@ public: virtual void actions(); }; -class Scene705: public Scene7xx{ +class Scene705 : public Scene7xx{ private: Conversation _dialog1; @@ -149,7 +149,7 @@ public: virtual void actions(); }; -class Scene706: public Scene7xx{ +class Scene706 : public Scene7xx{ private: int _vaseHotspotId; int _vaseMode; @@ -172,7 +172,7 @@ public: virtual void actions(); }; -class Scene707: public SceneTeleporter { +class Scene707 : public SceneTeleporter { public: Scene707(MADSEngine *vm) : SceneTeleporter(vm) {} @@ -182,7 +182,7 @@ public: virtual void actions(); }; -class Scene710: public Scene7xx { +class Scene710 : public Scene7xx { public: Scene710(MADSEngine *vm) : Scene7xx(vm) {} @@ -192,7 +192,7 @@ public: virtual void actions(); }; -class Scene711: public SceneTeleporter { +class Scene711 : public SceneTeleporter { public: Scene711(MADSEngine *vm) : SceneTeleporter(vm) {} @@ -202,7 +202,7 @@ public: virtual void actions(); }; -class Scene751: public Scene7xx{ +class Scene751 : public Scene7xx{ private: bool _rexHandingLine; @@ -217,7 +217,7 @@ public: virtual void actions(); }; -class Scene752: public Scene7xx { +class Scene752 : public Scene7xx { private: int _cardId; diff --git a/engines/mads/nebular/nebular_scenes8.h b/engines/mads/nebular/nebular_scenes8.h index 150951dcaf..39e022e31f 100644 --- a/engines/mads/nebular/nebular_scenes8.h +++ b/engines/mads/nebular/nebular_scenes8.h @@ -52,7 +52,7 @@ public: Scene8xx(MADSEngine *vm) : NebularScene(vm) {} }; -class Scene801: public Scene8xx{ +class Scene801 : public Scene8xx{ private: bool _walkThroughDoor; @@ -67,7 +67,7 @@ public: virtual void actions(); }; -class Scene802: public Scene8xx{ +class Scene802 : public Scene8xx{ public: Scene802(MADSEngine *vm) : Scene8xx(vm) {} @@ -78,7 +78,7 @@ public: virtual void actions(); }; -class Scene803: public Scene8xx{ +class Scene803 : public Scene8xx{ public: Scene803(MADSEngine *vm) : Scene8xx(vm) {} @@ -89,7 +89,7 @@ public: virtual void actions(); }; -class Scene804: public Scene8xx { +class Scene804 : public Scene8xx { private: bool _messWithThrottle; bool _movingThrottle; @@ -111,7 +111,7 @@ public: virtual void actions() {}; }; -class Scene805: public Scene8xx{ +class Scene805 : public Scene8xx{ public: Scene805(MADSEngine *vm) : Scene8xx(vm) {} @@ -122,7 +122,7 @@ public: virtual void actions(); }; -class Scene807: public SceneTeleporter { +class Scene807 : public SceneTeleporter { public: Scene807(MADSEngine *vm) : SceneTeleporter(vm) {} @@ -132,7 +132,7 @@ public: virtual void actions(); }; -class Scene808: public Scene8xx{ +class Scene808 : public Scene8xx{ private: bool _goingTo803; @@ -145,7 +145,7 @@ public: virtual void actions(); }; -class Scene810: public Scene8xx{ +class Scene810 : public Scene8xx{ private: bool _moveAllowed; diff --git a/engines/mads/nebular/sound_nebular.h b/engines/mads/nebular/sound_nebular.h index b5dee5b3ed..2113b103fb 100644 --- a/engines/mads/nebular/sound_nebular.h +++ b/engines/mads/nebular/sound_nebular.h @@ -131,7 +131,7 @@ struct RegisterValue { /** * Base class for the sound player resource files */ -class ASound: public Audio::AudioStream { +class ASound : public Audio::AudioStream { private: struct CachedDataEntry { int _offset; @@ -365,7 +365,7 @@ public: virtual int getRate() const { return 11025; } }; -class ASound1: public ASound { +class ASound1 : public ASound { private: typedef int (ASound1::*CommandPtr)(); static const CommandPtr _commandList[42]; diff --git a/engines/mads/palette.h b/engines/mads/palette.h index 0698e21a5f..8b40124f4e 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -246,7 +246,7 @@ public: int tickDelay, int steps); }; -class Palette: public Fader { +class Palette : public Fader { private: /** * Initialises the first 16 palette indexes with the equivalent diff --git a/engines/mads/phantom/game_phantom.h b/engines/mads/phantom/game_phantom.h index 326a1dc077..7a84ee1c72 100644 --- a/engines/mads/phantom/game_phantom.h +++ b/engines/mads/phantom/game_phantom.h @@ -65,7 +65,7 @@ enum InventoryObject { }; // HACK: A stub for now, remove from here once it's implemented properly -class PhantomGlobals: public Globals { +class PhantomGlobals : public Globals { public: PhantomGlobals() { resize(210); // Rex has 210 globals @@ -73,7 +73,7 @@ public: virtual ~PhantomGlobals() {} }; -class GamePhantom: public Game { +class GamePhantom : public Game { friend class Game; protected: GamePhantom(MADSEngine *vm); @@ -101,7 +101,7 @@ public: }; -class Section1Handler: public SectionHandler { +class Section1Handler : public SectionHandler { public: Section1Handler(MADSEngine *vm) : SectionHandler(vm) {} diff --git a/engines/mads/phantom/phantom_scenes.h b/engines/mads/phantom/phantom_scenes.h index e585ead542..cd295a28b6 100644 --- a/engines/mads/phantom/phantom_scenes.h +++ b/engines/mads/phantom/phantom_scenes.h @@ -503,7 +503,7 @@ public: }; // TODO: Temporary, remove once implemented properly -class DummyScene: public PhantomScene { +class DummyScene : public PhantomScene { public: DummyScene(MADSEngine *vm) : PhantomScene(vm) { warning("Unimplemented scene"); diff --git a/engines/mads/sprites.h b/engines/mads/sprites.h index f807e733b7..324122e348 100644 --- a/engines/mads/sprites.h +++ b/engines/mads/sprites.h @@ -107,7 +107,7 @@ struct SpriteFrameHeader { uint32 reserved8; }; -class MSprite: public MSurface { +class MSprite : public MSurface { private: void loadSprite(Common::SeekableReadStream *source, const Common::Array &palette); public: -- cgit v1.2.3 From 9099b36caa88d7675a03fb0bd283acf4e1122474 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 27 May 2014 00:58:25 +0200 Subject: MADS: initialise -> initialize. --- engines/mads/compression.cpp | 8 ++++---- engines/mads/compression.h | 2 +- engines/mads/font.h | 2 +- engines/mads/game.h | 4 ++-- engines/mads/mads.cpp | 6 +++--- engines/mads/mads.h | 2 +- engines/mads/msurface.h | 2 +- engines/mads/nebular/sound_nebular.cpp | 2 +- engines/mads/palette.cpp | 2 +- engines/mads/palette.h | 4 ++-- engines/mads/scene.cpp | 2 +- engines/mads/scene.h | 2 +- engines/mads/screen.h | 2 +- engines/mads/sound.h | 2 +- 14 files changed, 21 insertions(+), 21 deletions(-) diff --git a/engines/mads/compression.cpp b/engines/mads/compression.cpp index 2284f17321..5f78357378 100644 --- a/engines/mads/compression.cpp +++ b/engines/mads/compression.cpp @@ -42,16 +42,16 @@ bool MadsPack::isCompressed(Common::SeekableReadStream *stream) { } MadsPack::MadsPack(Common::SeekableReadStream *stream) { - initialise(stream); + initialize(stream); } MadsPack::MadsPack(const Common::String &resourceName, MADSEngine *vm) { File file(resourceName); - initialise(&file); + initialize(&file); file.close(); } -void MadsPack::initialise(Common::SeekableReadStream *stream) { +void MadsPack::initialize(Common::SeekableReadStream *stream) { if (!MadsPack::isCompressed(stream)) error("Attempted to decompress a resource that was not MadsPacked"); @@ -124,7 +124,7 @@ void FabDecompressor::decompress(const byte *srcData, int srcSize, byte *destDat copyOfs = 0xFFFF0000; destP = destData; - // Initialise data fields + // Initialize data fields _srcData = srcData; _srcP = _srcData + 6; _srcSize = srcSize; diff --git a/engines/mads/compression.h b/engines/mads/compression.h index e6eca420b5..f7381e4af3 100644 --- a/engines/mads/compression.h +++ b/engines/mads/compression.h @@ -49,7 +49,7 @@ private: int _count; int _dataOffset; - void initialise(Common::SeekableReadStream *stream); + void initialize(Common::SeekableReadStream *stream); public: static bool isCompressed(Common::SeekableReadStream *stream); MadsPack(Common::SeekableReadStream *stream); diff --git a/engines/mads/font.h b/engines/mads/font.h index 1d733280df..47df647637 100644 --- a/engines/mads/font.h +++ b/engines/mads/font.h @@ -52,7 +52,7 @@ private: static Common::HashMap *_fonts; public: /** - * Initialise the font system + * Initialize the font system */ static void init(MADSEngine *vm); diff --git a/engines/mads/game.h b/engines/mads/game.h index a55de617fd..6ec053e068 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -97,7 +97,7 @@ protected: Game(MADSEngine *vm); /** - * Initialises the current section number of the game + * Initializes the current section number of the game */ void initSection(int sectionNumber); @@ -110,7 +110,7 @@ protected: virtual ProtectionResult checkCopyProtection() = 0; /** - * Initialises global variables for a new game + * Initializes global variables for a new game */ virtual void initializeGlobals() = 0; diff --git a/engines/mads/mads.cpp b/engines/mads/mads.cpp index bcd8fdba8f..871d1b5033 100644 --- a/engines/mads/mads.cpp +++ b/engines/mads/mads.cpp @@ -38,7 +38,7 @@ namespace MADS { MADSEngine::MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc) : _gameDescription(gameDesc), Engine(syst), _randomSource("MADS") { - // Initialise fields + // Initialize fields _easyMouse = true; _invObjectsAnimated = true; _textWindowStill = false; @@ -68,7 +68,7 @@ MADSEngine::~MADSEngine() { delete _sound; } -void MADSEngine::initialise() { +void MADSEngine::initialize() { // Set up debug channels DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level"); DebugMan.addDebugChannel(kDebugScripts, "scripts", "Game scripts"); @@ -96,7 +96,7 @@ void MADSEngine::initialise() { Common::Error MADSEngine::run() { initGraphics(MADS_SCREEN_WIDTH, MADS_SCREEN_HEIGHT, false); - initialise(); + initialize(); // Run the game _game->run(); diff --git a/engines/mads/mads.h b/engines/mads/mads.h index 3f325fd6a1..9a8f2152a1 100644 --- a/engines/mads/mads.h +++ b/engines/mads/mads.h @@ -83,7 +83,7 @@ private: /** * Handles basic initialisation */ - void initialise(); + void initialize(); protected: // Engine APIs virtual Common::Error run(); diff --git a/engines/mads/msurface.h b/engines/mads/msurface.h index e3cf89d649..8ad0b1cda4 100644 --- a/engines/mads/msurface.h +++ b/engines/mads/msurface.h @@ -82,7 +82,7 @@ public: virtual ~MSurface(); /** - * Reinitialises a surface to have a given set of dimensions + * Reinitializes a surface to have a given set of dimensions */ void setSize(int width, int height); diff --git a/engines/mads/nebular/sound_nebular.cpp b/engines/mads/nebular/sound_nebular.cpp index 608a31cb25..577ed26d13 100644 --- a/engines/mads/nebular/sound_nebular.cpp +++ b/engines/mads/nebular/sound_nebular.cpp @@ -197,7 +197,7 @@ ASound::ASound(Audio::Mixer *mixer, const Common::String &filename, int dataOffs _mixer->playStream(Audio::Mixer::kPlainSoundType, &_soundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true); - // Initialise the Adlib + // Initialize the Adlib adlibInit(); // Reset the adlib diff --git a/engines/mads/palette.cpp b/engines/mads/palette.cpp index b5a379dfde..755f7bcf5c 100644 --- a/engines/mads/palette.cpp +++ b/engines/mads/palette.cpp @@ -504,7 +504,7 @@ void Fader::mapToGreyRamp(byte palette[PALETTE_SIZE], int baseColor, int numColo // Sort the mapping lists insertionSort(numColors, greyList, greyMapping); - // Initialise state variables + // Initialize state variables int greySum = 0; int greyScan = 0; int greyMark = 0; diff --git a/engines/mads/palette.h b/engines/mads/palette.h index 8b40124f4e..ff93b2f2fe 100644 --- a/engines/mads/palette.h +++ b/engines/mads/palette.h @@ -249,7 +249,7 @@ public: class Palette : public Fader { private: /** - * Initialises the first 16 palette indexes with the equivalent + * Initializes the first 16 palette indexes with the equivalent * standard VGA palette */ void initVGAPalette(byte *palette); @@ -300,7 +300,7 @@ public: void resetGamePalette(int v1, int v2); /** - * Initialises the main palette + * Initializes the main palette */ void initPalette(); diff --git a/engines/mads/scene.cpp b/engines/mads/scene.cpp index 7b54034753..d2d4bd818a 100644 --- a/engines/mads/scene.cpp +++ b/engines/mads/scene.cpp @@ -154,7 +154,7 @@ void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) { _sceneInfo->load(_currentSceneId, _variant, Common::String(), flags, _depthSurface, _backgroundSurface); - // Initialise palette animation for the scene + // Initialize palette animation for the scene initPaletteAnimation(_sceneInfo->_paletteCycles, false); // Copy over nodes diff --git a/engines/mads/scene.h b/engines/mads/scene.h index 7a01d7360a..c53c4d64ab 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -53,7 +53,7 @@ private: void loadVocabStrings(); /* - * Initialises the data for palette animation within the scene + * Initializes the data for palette animation within the scene */ void initPaletteAnimation(Common::Array &palCycles, bool animFlag); diff --git a/engines/mads/screen.h b/engines/mads/screen.h index b81fddd87a..a3653d6d62 100644 --- a/engines/mads/screen.h +++ b/engines/mads/screen.h @@ -209,7 +209,7 @@ public: ScreenSurface(); /** - * Initialise the surface + * Initialize the surface */ void init(); diff --git a/engines/mads/sound.h b/engines/mads/sound.h index 0fd9ac1095..9a251f9dd0 100644 --- a/engines/mads/sound.h +++ b/engines/mads/sound.h @@ -47,7 +47,7 @@ public: ~SoundManager(); /** - * Initialises the sound driver for a given game section + * Initializes the sound driver for a given game section */ void init(int sectionNumber); -- cgit v1.2.3 From b88e2d27a90d8493395684f2b72cba4d2f02c54d Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 27 May 2014 00:58:25 +0200 Subject: MADS: Get rid of some superfluous parentheses. --- engines/mads/nebular/nebular_scenes4.cpp | 40 ++++++++++++++++---------------- engines/mads/nebular/nebular_scenes8.cpp | 4 ++-- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/engines/mads/nebular/nebular_scenes4.cpp b/engines/mads/nebular/nebular_scenes4.cpp index 017319b675..d369947bf2 100644 --- a/engines/mads/nebular/nebular_scenes4.cpp +++ b/engines/mads/nebular/nebular_scenes4.cpp @@ -2930,7 +2930,7 @@ void Scene408::actions() { _vm->_sound->command(58); } else if (_action.isAction(VERB_TAKE, NOUN_TARGET_MODULE) && (_game._objects.isInRoom(OBJ_TARGET_MODULE) || _game._trigger)) { switch (_game._trigger) { - case (0): + case 0: _vm->_sound->command(57); _game._player._stepEnabled = false; _game._player._visible = false; @@ -3178,7 +3178,7 @@ void Scene410::actions() { _scene->_nextSceneId = 406; else if (_action.isAction(VERB_TAKE, NOUN_CHARGE_CASES) && (_game._objects.isInRoom(OBJ_CHARGE_CASES) || _game._trigger)) { switch (_game._trigger) { - case (0): + case 0: _vm->_sound->command(57); _game._player._stepEnabled = false; _game._player._visible = false; @@ -3447,18 +3447,18 @@ int Scene411::computeQuoteAndQuantity() { void Scene411::handleKettleAction() { switch (_globals[kNextIngredient]) { - case (1): + case 1: _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 15, 0, 0, 0); break; - case (2): + case 2: _scene->_sequences.remove(_globals._sequenceIndexes[4]); _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 6, 0, 0, 0); break; - case (3): + case 3: _makeMushroomCloud = true; break; @@ -3511,19 +3511,19 @@ void Scene411::handleDialog() { void Scene411::giveToRex(int object) { switch (object) { - case (0): + case 0: _game._objects.addToInventory(OBJ_ALIEN_LIQUOR); break; - case (1): + case 1: _game._objects.addToInventory(OBJ_LECITHIN); break; - case (2): + case 2: _game._objects.addToInventory(OBJ_PETROX); break; - case (3): + case 3: _game._objects.addToInventory(OBJ_FORMALDEHYDE); break; @@ -3606,7 +3606,7 @@ void Scene411::enter() { _globals._sequenceIndexes[4] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[4], false, 6, 0, 0, 0); break; - case (4): + case 4: _vm->_sound->command(53); _vm->_sound->command(54); _vm->_sound->command(55); @@ -3713,10 +3713,10 @@ void Scene411::step() { } break; - case (22): - case (41): - case (59): - case (115): + case 22: + case 41: + case 59: + case 115: if (_makeMushroomCloud) { _globals._sequenceIndexes[9] = _scene->_sequences.addSpriteCycle(_globals._spriteIndexes[9], false, 5, 1, 0, 0); _makeMushroomCloud = false; @@ -3838,7 +3838,7 @@ void Scene411::actions() { if (_action.isAction(VERB_TAKE, NOUN_PETROX) && (_game._objects.isInRoom(OBJ_PETROX) || _game._trigger)) { switch (_game._trigger) { - case (0): + case 0: _vm->_sound->command(57); _game._player._stepEnabled = false; _game._player._visible = false; @@ -3875,7 +3875,7 @@ void Scene411::actions() { if (_action.isAction(VERB_TAKE, NOUN_LECITHIN) && (_game._objects.isInRoom(OBJ_LECITHIN) || _game._trigger)) { switch (_game._trigger) { - case (0): + case 0: _vm->_sound->command(57); _game._player._stepEnabled = false; _game._player._visible = false; @@ -3937,19 +3937,19 @@ void Scene411::actions() { if (_action.isObject(NOUN_PETROX) || _action.isObject(NOUN_FORMALDEHYDE) || _action.isObject(NOUN_LECITHIN) || _action.isObject(NOUN_ALIEN_LIQUOR)) { _newIngredient = _game._objects.getIdFromDesc(_action._activeAction._objectNameId); switch (_newIngredient) { - case (OBJ_ALIEN_LIQUOR): + case OBJ_ALIEN_LIQUOR: _dialog1.start(); break; - case (OBJ_FORMALDEHYDE): + case OBJ_FORMALDEHYDE: _dialog3.start(); break; - case (OBJ_PETROX): + case OBJ_PETROX: _dialog4.start(); break; - case (OBJ_LECITHIN): + case OBJ_LECITHIN: _dialog2.start(); break; diff --git a/engines/mads/nebular/nebular_scenes8.cpp b/engines/mads/nebular/nebular_scenes8.cpp index db9024b3bb..66502831cc 100644 --- a/engines/mads/nebular/nebular_scenes8.cpp +++ b/engines/mads/nebular/nebular_scenes8.cpp @@ -416,7 +416,7 @@ void Scene802::preActions() { void Scene802::actions() { if (_action.isAction(VERB_TAKE, NOUN_SHIELD_MODULATOR) && !_game._objects.isInInventory(OBJ_SHIELD_MODULATOR)) { switch (_game._trigger) { - case (0): + case 0: _game._player._stepEnabled = false; _game._player._visible = false; _globals._sequenceIndexes[2] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[2], true, 7, 2, 0, 0); @@ -448,7 +448,7 @@ void Scene802::actions() { } } else if ((_action.isAction(VERB_TAKE, NOUN_REMOTE)) && (!_game._objects.isInInventory(OBJ_REMOTE))) { switch (_game._trigger) { - case (0): + case 0: _game._player._stepEnabled = false; _game._player._visible = false; _globals._sequenceIndexes[5] = _scene->_sequences.startReverseCycle(_globals._spriteIndexes[5], true, 7, 2, 0, 0); -- cgit v1.2.3 From 6a7cc38c89305cecdcb6414fe438615beb931eca Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 27 May 2014 00:58:25 +0200 Subject: MADS: synchronise -> synchronize --- engines/mads/game.h | 4 ++-- engines/mads/scene.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/engines/mads/game.h b/engines/mads/game.h index 6ec053e068..3a84a720f7 100644 --- a/engines/mads/game.h +++ b/engines/mads/game.h @@ -184,9 +184,9 @@ public: virtual void step() = 0; /** - * Synchronise the game data + * Synchronize the game data * @param s Serializer - * @param phase1 If true, it's synchronising the basic scene information + * @param phase1 If true, it's synchronizing the basic scene information */ virtual void synchronize(Common::Serializer &s, bool phase1); diff --git a/engines/mads/scene.h b/engines/mads/scene.h index c53c4d64ab..407d70dc85 100644 --- a/engines/mads/scene.h +++ b/engines/mads/scene.h @@ -241,7 +241,7 @@ public: void freeAnimation(); /** - * Synchronise the game + * Synchronize the game */ void synchronize(Common::Serializer &s); }; -- cgit v1.2.3 From d0f5184edd101e76dd9ad96a2e68c5cc69a662a7 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 27 May 2014 00:58:25 +0200 Subject: MADS: minimise -> minimize --- engines/mads/sprites.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engines/mads/sprites.cpp b/engines/mads/sprites.cpp index 89d610f2f1..0dc83d1abc 100644 --- a/engines/mads/sprites.cpp +++ b/engines/mads/sprites.cpp @@ -324,7 +324,7 @@ void SpriteSlots::drawSprites(MSurface *s) { } if ((slot._scale < 100) && (slot._scale != -1)) { - // Minimalised drawing + // Minimalized drawing s->copyFrom(spr, slot._position, slot._depth, &scene._depthSurface, slot._scale, sprite->getTransparencyIndex()); } else { -- cgit v1.2.3 From daa8d57a866e2866369e432cf1d624179edc8875 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 27 May 2014 02:04:07 +0200 Subject: ALL: Rename Debugger::DebugPrintf to Debugger::debugPrintf. --- engines/agi/console.cpp | 52 +- engines/agi/preagi_mickey.cpp | 4 +- engines/agi/preagi_winnie.cpp | 2 +- engines/agos/debugger.cpp | 70 +- engines/avalanche/console.cpp | 2 +- engines/cge/console.cpp | 2 +- engines/cruise/debugger.cpp | 4 +- engines/drascula/console.cpp | 2 +- engines/fullpipe/console.cpp | 4 +- engines/gob/cheater_geisha.cpp | 2 +- engines/gob/console.cpp | 32 +- engines/groovie/debug.cpp | 14 +- engines/hopkins/debugger.cpp | 10 +- engines/hugo/console.cpp | 22 +- engines/kyra/debugger.cpp | 204 ++--- engines/lastexpress/debug.cpp | 162 ++-- engines/lure/debugger.cpp | 176 ++--- engines/mads/debugger.cpp | 46 +- engines/mohawk/console.cpp | 156 ++-- engines/neverhood/console.cpp | 72 +- engines/neverhood/gamevars.cpp | 2 +- engines/neverhood/scene.cpp | 2 +- engines/parallaction/debug.cpp | 52 +- engines/pegasus/console.cpp | 12 +- engines/queen/debug.cpp | 54 +- engines/saga/actor_walk.cpp | 2 +- engines/saga/animation.cpp | 8 +- engines/saga/console.cpp | 40 +- engines/saga/objectmap.cpp | 2 +- engines/saga/scene.cpp | 2 +- engines/saga/sfuncs.cpp | 2 +- engines/sci/console.cpp | 1434 ++++++++++++++++++------------------ engines/sci/engine/kevent.cpp | 12 +- engines/sci/engine/scriptdebug.cpp | 16 +- engines/sci/graphics/animate.cpp | 2 +- engines/sci/graphics/frameout.cpp | 10 +- engines/sci/graphics/ports.cpp | 2 +- engines/sci/parser/grammar.cpp | 22 +- engines/sci/parser/vocabulary.cpp | 20 +- engines/sci/sound/music.cpp | 22 +- engines/scumm/debugger.cpp | 168 ++--- engines/sky/debug.cpp | 90 +-- engines/sword2/console.cpp | 186 ++--- engines/sword2/resman.cpp | 2 +- engines/sword2/sound.cpp | 2 +- engines/teenagent/console.cpp | 32 +- engines/tinsel/debugger.cpp | 32 +- engines/toltecs/console.cpp | 10 +- engines/tony/debugger.cpp | 6 +- engines/touche/console.cpp | 2 +- engines/tsage/debugger.cpp | 362 ++++----- engines/voyeur/debugger.cpp | 36 +- engines/wintermute/debugger.cpp | 6 +- engines/zvision/core/console.cpp | 24 +- gui/debugger.cpp | 96 +-- gui/debugger.h | 2 +- 56 files changed, 1906 insertions(+), 1906 deletions(-) diff --git a/engines/agi/console.cpp b/engines/agi/console.cpp index 5f222adf89..dce85b931c 100644 --- a/engines/agi/console.cpp +++ b/engines/agi/console.cpp @@ -52,7 +52,7 @@ Console::Console(AgiEngine *vm) : GUI::Debugger() { bool Console::Cmd_SetVar(int argc, const char **argv) { if (argc != 3) { - DebugPrintf("Usage: setvar \n"); + debugPrintf("Usage: setvar \n"); return true; } int p1 = (int)atoi(argv[1]); @@ -64,7 +64,7 @@ bool Console::Cmd_SetVar(int argc, const char **argv) { bool Console::Cmd_SetFlag(int argc, const char **argv) { if (argc != 3) { - DebugPrintf("Usage: setvar \n"); + debugPrintf("Usage: setvar \n"); return true; } int p1 = (int)atoi(argv[1]); @@ -76,7 +76,7 @@ bool Console::Cmd_SetFlag(int argc, const char **argv) { bool Console::Cmd_SetObj(int argc, const char **argv) { if (argc != 3) { - DebugPrintf("Usage: setvar \n"); + debugPrintf("Usage: setvar \n"); return true; } int p1 = (int)atoi(argv[1]); @@ -88,7 +88,7 @@ bool Console::Cmd_SetObj(int argc, const char **argv) { bool Console::Cmd_RunOpcode(int argc, const char **argv) { if (argc < 2) { - DebugPrintf("Usage: runopcode ....\n"); + debugPrintf("Usage: runopcode ....\n"); return true; } @@ -96,7 +96,7 @@ bool Console::Cmd_RunOpcode(int argc, const char **argv) { if (!strcmp(argv[1], logicNamesCmd[i].name)) { uint8 p[16]; if ((argc - 2) != logicNamesCmd[i].argumentsLength()) { - DebugPrintf("AGI command wants %d arguments\n", logicNamesCmd[i].argumentsLength()); + debugPrintf("AGI command wants %d arguments\n", logicNamesCmd[i].argumentsLength()); return 0; } p[0] = argv[2] ? (char)strtoul(argv[2], NULL, 0) : 0; @@ -113,7 +113,7 @@ bool Console::Cmd_RunOpcode(int argc, const char **argv) { } } - DebugPrintf("Unknown opcode\n"); + debugPrintf("Unknown opcode\n"); return true; } @@ -125,7 +125,7 @@ bool Console::Cmd_Agiver(int argc, const char **argv) { maj = (ver >> 12) & 0xf; min = ver & 0xfff; - DebugPrintf(maj <= 2 ? "%x.%03x\n" : "%x.002.%03x\n", maj, min); + debugPrintf(maj <= 2 ? "%x.%03x\n" : "%x.002.%03x\n", maj, min); return true; } @@ -133,17 +133,17 @@ bool Console::Cmd_Agiver(int argc, const char **argv) { bool Console::Cmd_Flags(int argc, const char **argv) { int i, j; - DebugPrintf(" "); + debugPrintf(" "); for (j = 0; j < 10; j++) - DebugPrintf("%d ", j); - DebugPrintf("\n"); + debugPrintf("%d ", j); + debugPrintf("\n"); for (i = 0; i < 255;) { - DebugPrintf("%3d ", i); + debugPrintf("%3d ", i); for (j = 0; j < 10; j++, i++) { - DebugPrintf("%c ", _vm->getflag(i) ? 'T' : 'F'); + debugPrintf("%c ", _vm->getflag(i) ? 'T' : 'F'); } - DebugPrintf("\n"); + debugPrintf("\n"); } return true; @@ -154,9 +154,9 @@ bool Console::Cmd_Vars(int argc, const char **argv) { for (i = 0; i < 255;) { for (j = 0; j < 5; j++, i++) { - DebugPrintf("%03d:%3d ", i, _vm->getvar(i)); + debugPrintf("%03d:%3d ", i, _vm->getvar(i)); } - DebugPrintf("\n"); + debugPrintf("\n"); } return true; @@ -166,7 +166,7 @@ bool Console::Cmd_Objs(int argc, const char **argv) { unsigned int i; for (i = 0; i < _vm->_game.numObjects; i++) { - DebugPrintf("%3d]%-24s(%3d)\n", i, _vm->objectName(i), _vm->objectGetLocation(i)); + debugPrintf("%3d]%-24s(%3d)\n", i, _vm->objectName(i), _vm->objectGetLocation(i)); } return true; @@ -174,7 +174,7 @@ bool Console::Cmd_Objs(int argc, const char **argv) { bool Console::Cmd_Opcode(int argc, const char **argv) { if (argc != 2 || (strcmp(argv[1], "on") && strcmp(argv[1], "off"))) { - DebugPrintf("Usage: opcode on|off\n"); + debugPrintf("Usage: opcode on|off\n"); return true; } @@ -185,7 +185,7 @@ bool Console::Cmd_Opcode(int argc, const char **argv) { bool Console::Cmd_Logic0(int argc, const char **argv) { if (argc != 2 || (strcmp(argv[1], "on") && strcmp(argv[1], "off"))) { - DebugPrintf("Usage: logic0 on|off\n"); + debugPrintf("Usage: logic0 on|off\n"); return true; } @@ -196,7 +196,7 @@ bool Console::Cmd_Logic0(int argc, const char **argv) { bool Console::Cmd_Trigger(int argc, const char **argv) { if (argc != 2 || (strcmp(argv[1], "on") && strcmp(argv[1], "off"))) { - DebugPrintf("Usage: trigger on|off\n"); + debugPrintf("Usage: trigger on|off\n"); return true; } _vm->_debug.ignoretriggers = strcmp (argv[1], "on"); @@ -236,13 +236,13 @@ bool Console::Cmd_Room(int argc, const char **argv) { _vm->newRoom(strtoul(argv[1], NULL, 0)); } - DebugPrintf("Current room: %d\n", _vm->getvar(0)); + debugPrintf("Current room: %d\n", _vm->getvar(0)); return true; } bool Console::Cmd_BT(int argc, const char **argv) { - DebugPrintf("Current script: %d\nStack depth: %d\n", _vm->_game.lognum, _vm->_game.execStack.size()); + debugPrintf("Current script: %d\nStack depth: %d\n", _vm->_game.lognum, _vm->_game.execStack.size()); uint8 *code = NULL; uint8 op = 0; @@ -257,12 +257,12 @@ bool Console::Cmd_BT(int argc, const char **argv) { memmove(p, &code[it->curIP], num); memset(p + num, 0, CMD_BSIZE - num); - DebugPrintf("%d(%d): %s(", it->script, it->curIP, logicNamesCmd[op].name); + debugPrintf("%d(%d): %s(", it->script, it->curIP, logicNamesCmd[op].name); for (int i = 0; i < num; i++) - DebugPrintf("%d, ", p[i]); + debugPrintf("%d, ", p[i]); - DebugPrintf(")\n"); + debugPrintf(")\n"); } return true; @@ -287,7 +287,7 @@ bool MickeyConsole::Cmd_Room(int argc, const char **argv) { bool MickeyConsole::Cmd_DrawPic(int argc, const char **argv) { if (argc != 2) - DebugPrintf("Usage: %s \n", argv[0]); + debugPrintf("Usage: %s \n", argv[0]); else _mickey->drawPic(atoi(argv[1])); return true; @@ -295,7 +295,7 @@ bool MickeyConsole::Cmd_DrawPic(int argc, const char **argv) { bool MickeyConsole::Cmd_DrawObj(int argc, const char **argv) { if (argc != 2) - DebugPrintf("Usage: %s \n", argv[0]); + debugPrintf("Usage: %s \n", argv[0]); else _mickey->drawObj((ENUM_MSA_OBJECT)atoi(argv[1]), 0, 0); return true; diff --git a/engines/agi/preagi_mickey.cpp b/engines/agi/preagi_mickey.cpp index 561b56d199..4ca8d00824 100644 --- a/engines/agi/preagi_mickey.cpp +++ b/engines/agi/preagi_mickey.cpp @@ -2228,10 +2228,10 @@ void MickeyEngine::waitAnyKey(bool anim) { // Console-related functions void MickeyEngine::debugCurRoom() { - _console->DebugPrintf("Current Room = %d\n", _gameStateMickey.iRoom); + _console->debugPrintf("Current Room = %d\n", _gameStateMickey.iRoom); if (_gameStateMickey.iRmObj[_gameStateMickey.iRoom] != IDI_MSA_OBJECT_NONE) { - _console->DebugPrintf("Object %d is in the room\n", _gameStateMickey.iRmObj[_gameStateMickey.iRoom]); + _console->debugPrintf("Object %d is in the room\n", _gameStateMickey.iRmObj[_gameStateMickey.iRoom]); } } diff --git a/engines/agi/preagi_winnie.cpp b/engines/agi/preagi_winnie.cpp index d5ae0b59a0..a91ad24fc6 100644 --- a/engines/agi/preagi_winnie.cpp +++ b/engines/agi/preagi_winnie.cpp @@ -1308,7 +1308,7 @@ void WinnieEngine::printStrWinnie(char *szMsg) { // Console-related functions void WinnieEngine::debugCurRoom() { - _console->DebugPrintf("Current Room = %d\n", _room); + _console->debugPrintf("Current Room = %d\n", _room); } WinnieEngine::WinnieEngine(OSystem *syst, const AGIGameDescription *gameDesc) : PreAgiEngine(syst, gameDesc) { diff --git a/engines/agos/debugger.cpp b/engines/agos/debugger.cpp index b5233bed0c..99ea8a15b7 100644 --- a/engines/agos/debugger.cpp +++ b/engines/agos/debugger.cpp @@ -60,9 +60,9 @@ bool Debugger::Cmd_PlayMusic(int argc, const char **argv) { _vm->playMusic(music, 0); } } else - DebugPrintf("Music out of range (0 - %d)\n", _vm->_numMusic); + debugPrintf("Music out of range (0 - %d)\n", _vm->_numMusic); } else - DebugPrintf("Syntax: music \n"); + debugPrintf("Syntax: music \n"); return true; } @@ -73,9 +73,9 @@ bool Debugger::Cmd_PlaySound(int argc, const char **argv) { if (sound <= _vm->_numSFX) _vm->_sound->playEffects(sound); else - DebugPrintf("Sound out of range (0 - %d)\n", _vm->_numSFX); + debugPrintf("Sound out of range (0 - %d)\n", _vm->_numSFX); } else - DebugPrintf("Syntax: sound \n"); + debugPrintf("Syntax: sound \n"); return true; } @@ -86,9 +86,9 @@ bool Debugger::Cmd_PlayVoice(int argc, const char **argv) { if (voice <= _vm->_numSpeech) _vm->_sound->playVoice(voice); else - DebugPrintf("Voice out of range (0 - %d)\n", _vm->_numSpeech); + debugPrintf("Voice out of range (0 - %d)\n", _vm->_numSpeech); } else - DebugPrintf("Syntax: voice \n"); + debugPrintf("Syntax: voice \n"); return true; } @@ -100,15 +100,15 @@ bool Debugger::Cmd_SetBit(int argc, const char **argv) { value = atoi(argv[2]); if (value <= 1) { _vm->setBitFlag(bit, value != 0); - DebugPrintf("Set bit %d to %d\n", bit, value); + debugPrintf("Set bit %d to %d\n", bit, value); } else - DebugPrintf("Bit value out of range (0 - 1)\n"); + debugPrintf("Bit value out of range (0 - 1)\n"); } else if (argc > 1) { bit = atoi(argv[1]); value = _vm->getBitFlag(bit); - DebugPrintf("Bit %d is %d\n", bit, value); + debugPrintf("Bit %d is %d\n", bit, value); } else - DebugPrintf("Syntax: bit \n"); + debugPrintf("Syntax: bit \n"); return true; } @@ -120,18 +120,18 @@ bool Debugger::Cmd_SetBit2(int argc, const char **argv) { value = atoi(argv[2]); if (value == 0) { _vm->_bitArrayTwo[bit / 16] &= ~(1 << (bit & 15)); - DebugPrintf("Set bit2 %d to %d\n", bit, value); + debugPrintf("Set bit2 %d to %d\n", bit, value); } else if (value == 1) { _vm->_bitArrayTwo[bit / 16] |= (1 << (bit & 15)); - DebugPrintf("Set bit2 %d to %d\n", bit, value); + debugPrintf("Set bit2 %d to %d\n", bit, value); } else - DebugPrintf("Bit2 value out of range (0 - 1)\n"); + debugPrintf("Bit2 value out of range (0 - 1)\n"); } else if (argc > 1) { bit = atoi(argv[1]); value = (_vm->_bitArrayTwo[bit / 16] & (1 << (bit & 15))) != 0; - DebugPrintf("Bit2 %d is %d\n", bit, value); + debugPrintf("Bit2 %d is %d\n", bit, value); } else - DebugPrintf("Syntax: bit2 \n"); + debugPrintf("Syntax: bit2 \n"); return true; } @@ -143,18 +143,18 @@ bool Debugger::Cmd_SetBit3(int argc, const char **argv) { value = atoi(argv[2]); if (value == 0) { _vm->_bitArrayThree[bit / 16] &= ~(1 << (bit & 15)); - DebugPrintf("Set bit3 %d to %d\n", bit, value); + debugPrintf("Set bit3 %d to %d\n", bit, value); } else if (value == 1) { _vm->_bitArrayThree[bit / 16] |= (1 << (bit & 15)); - DebugPrintf("Set bit3 %d to %d\n", bit, value); + debugPrintf("Set bit3 %d to %d\n", bit, value); } else - DebugPrintf("Bit3 value out of range (0 - 1)\n"); + debugPrintf("Bit3 value out of range (0 - 1)\n"); } else if (argc > 1) { bit = atoi(argv[1]); value = (_vm->_bitArrayThree[bit / 16] & (1 << (bit & 15))) != 0; - DebugPrintf("Bit3 %d is %d\n", bit, value); + debugPrintf("Bit3 %d is %d\n", bit, value); } else - DebugPrintf("Syntax: bit3 \n"); + debugPrintf("Syntax: bit3 \n"); return true; } @@ -167,15 +167,15 @@ bool Debugger::Cmd_SetVar(int argc, const char **argv) { if (argc > 2) { value = atoi(argv[2]); _vm->writeVariable(var, value); - DebugPrintf("Set var %d to %d\n", var, value); + debugPrintf("Set var %d to %d\n", var, value); } else { value = _vm->readVariable(var); - DebugPrintf("Var %d is %d\n", var, value); + debugPrintf("Var %d is %d\n", var, value); } } else - DebugPrintf("Var out of range (0 - %d)\n", _vm->_numVars - 1); + debugPrintf("Var out of range (0 - %d)\n", _vm->_numVars - 1); } else - DebugPrintf("Syntax: var \n"); + debugPrintf("Syntax: var \n"); return true; } @@ -194,22 +194,22 @@ bool Debugger::Cmd_SetObjectFlag(int argc, const char **argv) { if (argc > 3) { value = atoi(argv[3]); o->objectFlagValue[offs] = value; - DebugPrintf("Object %d Flag %d set to %d\n", obj, prop, value); + debugPrintf("Object %d Flag %d set to %d\n", obj, prop, value); } else { value = o->objectFlagValue[offs]; - DebugPrintf("Object %d Flag %d is %d\n", obj, prop, value); + debugPrintf("Object %d Flag %d is %d\n", obj, prop, value); } } else { - DebugPrintf("Object flag out of range\n"); + debugPrintf("Object flag out of range\n"); } } else { - DebugPrintf("Item isn't an object\n"); + debugPrintf("Item isn't an object\n"); } } else { - DebugPrintf("Item out of range (1 - %d)\n", _vm->_itemArraySize - 1); + debugPrintf("Item out of range (1 - %d)\n", _vm->_itemArraySize - 1); } } else { - DebugPrintf("Syntax: obj \n"); + debugPrintf("Syntax: obj \n"); } return true; @@ -223,7 +223,7 @@ bool Debugger::Cmd_StartSubroutine(int argc, const char **argv) { if (sub != NULL) _vm->startSubroutine(sub); } else - DebugPrintf("Subroutine %d\n", _vm->_currentTable->id); + debugPrintf("Subroutine %d\n", _vm->_currentTable->id); return true; } @@ -236,11 +236,11 @@ bool Debugger::Cmd_dumpImage(int argc, const char **argv) { if (vpe->vgaFile2 != NULL) { _vm->dumpVgaBitmaps(zoneNum); } else { - DebugPrintf("Invalid Zone Number %d\n", zoneNum); + debugPrintf("Invalid Zone Number %d\n", zoneNum); } } else - DebugPrintf("Syntax: dumpimage \n"); + debugPrintf("Syntax: dumpimage \n"); return true; } @@ -253,11 +253,11 @@ bool Debugger::Cmd_dumpScript(int argc, const char **argv) { if (vpe->vgaFile1 != NULL) { _vm->dumpVgaFile(vpe->vgaFile1); } else { - DebugPrintf("Invalid Zone Number %d\n", zoneNum); + debugPrintf("Invalid Zone Number %d\n", zoneNum); } } else - DebugPrintf("Syntax: dumpscript \n"); + debugPrintf("Syntax: dumpscript \n"); return true; } diff --git a/engines/avalanche/console.cpp b/engines/avalanche/console.cpp index 29ae5cf9c3..639ad63491 100644 --- a/engines/avalanche/console.cpp +++ b/engines/avalanche/console.cpp @@ -42,7 +42,7 @@ AvalancheConsole::~AvalancheConsole() { */ bool AvalancheConsole::Cmd_MagicLines(int argc, const char **argv) { if (argc != 1) { - DebugPrintf("Usage: %s\n", argv[0]); + debugPrintf("Usage: %s\n", argv[0]); return true; } diff --git a/engines/cge/console.cpp b/engines/cge/console.cpp index 447875c06f..3d281df3ef 100644 --- a/engines/cge/console.cpp +++ b/engines/cge/console.cpp @@ -37,7 +37,7 @@ CGEConsole::~CGEConsole() { */ bool CGEConsole::Cmd_boundaries(int argc, const char **argv) { if (argc != 1) { - DebugPrintf("Usage: %s\n", argv[0]); + debugPrintf("Usage: %s\n", argv[0]); return true; } diff --git a/engines/cruise/debugger.cpp b/engines/cruise/debugger.cpp index 4ef66ee11e..0bda44d0df 100644 --- a/engines/cruise/debugger.cpp +++ b/engines/cruise/debugger.cpp @@ -70,7 +70,7 @@ bool Debugger::cmd_hotspots(int argc, const char **argv) { if (*pObjectName) { getMultipleObjectParam(currentObject->overlay, currentObject->idx, ¶ms); - DebugPrintf("%s %s - %d,%d\n", pObjectName, pObjType, params.X, params.Y); + debugPrintf("%s %s - %d,%d\n", pObjectName, pObjType, params.X, params.Y); } } @@ -96,7 +96,7 @@ bool Debugger::cmd_items(int argc, const char **argv) { getSingleObjectParam(i, j, 5, &returnVar); if (returnVar < -1) - DebugPrintf("%s\n", getObjectName(j, pOvlData->arrayNameObj)); + debugPrintf("%s\n", getObjectName(j, pOvlData->arrayNameObj)); } } } diff --git a/engines/drascula/console.cpp b/engines/drascula/console.cpp index 50e96c8757..4c14fb74fb 100644 --- a/engines/drascula/console.cpp +++ b/engines/drascula/console.cpp @@ -35,7 +35,7 @@ Console::~Console() { bool Console::Cmd_Room(int argc, const char **argv) { if (argc < 2) { - DebugPrintf("Usage: room \n"); + debugPrintf("Usage: room \n"); return true; } diff --git a/engines/fullpipe/console.cpp b/engines/fullpipe/console.cpp index cb76345d66..3ff84dae5f 100644 --- a/engines/fullpipe/console.cpp +++ b/engines/fullpipe/console.cpp @@ -34,8 +34,8 @@ Console::Console(FullpipeEngine *vm) : GUI::Debugger(), _vm(vm) { bool Console::Cmd_Scene(int argc, const char **argv) { if (argc != 2) { int sceneTag = _vm->_currentScene->_sceneId; - DebugPrintf("Current scene: %d (scene tag: %d)\n", _vm->getSceneFromTag(sceneTag), sceneTag); - DebugPrintf("Use %s to change the current scene\n", argv[0]); + debugPrintf("Current scene: %d (scene tag: %d)\n", _vm->getSceneFromTag(sceneTag), sceneTag); + debugPrintf("Use %s to change the current scene\n", argv[0]); return true; } else { int scene = _vm->convertScene(atoi(argv[1])); diff --git a/engines/gob/cheater_geisha.cpp b/engines/gob/cheater_geisha.cpp index 8c4deec370..ec6fe09d59 100644 --- a/engines/gob/cheater_geisha.cpp +++ b/engines/gob/cheater_geisha.cpp @@ -61,7 +61,7 @@ bool Cheater_Geisha::cheat(GUI::Debugger &console) { uint32 digit5 = READ_VARO_UINT32(0x778); if (digit1 && digit2 && digit3 && digit4 && digit5) - console.DebugPrintf("Mastermind solution: %d %d %d %d %d\n", + console.debugPrintf("Mastermind solution: %d %d %d %d %d\n", digit1, digit2, digit3, digit4, digit5); return true; diff --git a/engines/gob/console.cpp b/engines/gob/console.cpp index b0f6006284..303c59c4da 100644 --- a/engines/gob/console.cpp +++ b/engines/gob/console.cpp @@ -51,7 +51,7 @@ void GobConsole::unregisterCheater() { } bool GobConsole::cmd_varSize(int argc, const char **argv) { - DebugPrintf("Size of the variable space: %d bytes\n", _vm->_inter->_variables->getSize()); + debugPrintf("Size of the variable space: %d bytes\n", _vm->_inter->_variables->getSize()); return true; } @@ -74,14 +74,14 @@ bool GobConsole::cmd_dumpVars(int argc, const char **argv) { bool GobConsole::cmd_var8(int argc, const char **argv) { if (argc == 1) { - DebugPrintf("Usage: var8 ()\n"); + debugPrintf("Usage: var8 ()\n"); return true; } uint32 varNum = atoi(argv[1]); if (varNum >= _vm->_inter->_variables->getSize()) { - DebugPrintf("Variable offset out of range\n"); + debugPrintf("Variable offset out of range\n"); return true; } @@ -90,21 +90,21 @@ bool GobConsole::cmd_var8(int argc, const char **argv) { _vm->_inter->_variables->writeOff8(varNum, varVal); } - DebugPrintf("var8_%d = %d\n", varNum, _vm->_inter->_variables->readOff8(varNum)); + debugPrintf("var8_%d = %d\n", varNum, _vm->_inter->_variables->readOff8(varNum)); return true; } bool GobConsole::cmd_var16(int argc, const char **argv) { if (argc == 1) { - DebugPrintf("Usage: var16 ()\n"); + debugPrintf("Usage: var16 ()\n"); return true; } uint32 varNum = atoi(argv[1]); if ((varNum + 1) >= _vm->_inter->_variables->getSize()) { - DebugPrintf("Variable offset out of range\n"); + debugPrintf("Variable offset out of range\n"); return true; } @@ -113,21 +113,21 @@ bool GobConsole::cmd_var16(int argc, const char **argv) { _vm->_inter->_variables->writeOff16(varNum, varVal); } - DebugPrintf("var16_%d = %d\n", varNum, _vm->_inter->_variables->readOff16(varNum)); + debugPrintf("var16_%d = %d\n", varNum, _vm->_inter->_variables->readOff16(varNum)); return true; } bool GobConsole::cmd_var32(int argc, const char **argv) { if (argc == 1) { - DebugPrintf("Usage: var32 ()\n"); + debugPrintf("Usage: var32 ()\n"); return true; } uint32 varNum = atoi(argv[1]); if ((varNum + 3) >= _vm->_inter->_variables->getSize()) { - DebugPrintf("Variable offset out of range\n"); + debugPrintf("Variable offset out of range\n"); return true; } @@ -136,21 +136,21 @@ bool GobConsole::cmd_var32(int argc, const char **argv) { _vm->_inter->_variables->writeOff32(varNum, varVal); } - DebugPrintf("var8_%d = %d\n", varNum, _vm->_inter->_variables->readOff32(varNum)); + debugPrintf("var8_%d = %d\n", varNum, _vm->_inter->_variables->readOff32(varNum)); return true; } bool GobConsole::cmd_varString(int argc, const char **argv) { if (argc == 1) { - DebugPrintf("Usage: varString ()\n"); + debugPrintf("Usage: varString ()\n"); return true; } uint32 varNum = atoi(argv[1]); if (varNum >= _vm->_inter->_variables->getSize()) { - DebugPrintf("Variable offset out of range\n"); + debugPrintf("Variable offset out of range\n"); return true; } @@ -160,7 +160,7 @@ bool GobConsole::cmd_varString(int argc, const char **argv) { Common::strlcpy(_vm->_inter->_variables->getAddressOffString(varNum), argv[2], maxLength); } - DebugPrintf("varString_%d = \"%s\"\n", varNum, _vm->_inter->_variables->getAddressOffString(varNum)); + debugPrintf("varString_%d = \"%s\"\n", varNum, _vm->_inter->_variables->getAddressOffString(varNum)); return true; } @@ -177,11 +177,11 @@ bool GobConsole::cmd_listArchives(int argc, const char **argv) { _vm->_dataIO->getArchiveInfo(info); - DebugPrintf(" Archive | Base | FileCount\n"); - DebugPrintf("--------------------------------\n"); + debugPrintf(" Archive | Base | FileCount\n"); + debugPrintf("--------------------------------\n"); for (Common::Array::const_iterator it = info.begin(); it != info.end(); ++it) if (!it->name.empty()) - DebugPrintf("%13s | %d | %d\n", it->name.c_str(), it->base, it->fileCount); + debugPrintf("%13s | %d | %d\n", it->name.c_str(), it->base, it->fileCount); return true; } diff --git a/engines/groovie/debug.cpp b/engines/groovie/debug.cpp index 8103e4f4c6..85b9b87652 100644 --- a/engines/groovie/debug.cpp +++ b/engines/groovie/debug.cpp @@ -81,7 +81,7 @@ bool Debugger::cmd_pc(int argc, const char **argv) { int val = getNumber(argv[1]); _script->_currentInstruction = val; } - DebugPrintf("pc = 0x%04X (%d)\n", _script->_currentInstruction, _script->_currentInstruction); + debugPrintf("pc = 0x%04X (%d)\n", _script->_currentInstruction, _script->_currentInstruction); return true; } @@ -97,9 +97,9 @@ bool Debugger::cmd_mem(int argc, const char **argv) { // Get val = _script->_variables[pos]; } - DebugPrintf("mem[0x%04X] = 0x%02X\n", pos, val); + debugPrintf("mem[0x%04X] = 0x%02X\n", pos, val); } else { - DebugPrintf("Syntax: mem []\n"); + debugPrintf("Syntax: mem []\n"); } return true; } @@ -109,7 +109,7 @@ bool Debugger::cmd_loadgame(int argc, const char **argv) { int slot = getNumber(argv[1]); _script->loadgame(slot); } else { - DebugPrintf("Syntax: load \n"); + debugPrintf("Syntax: load \n"); } return true; } @@ -119,7 +119,7 @@ bool Debugger::cmd_savegame(int argc, const char **argv) { int slot = getNumber(argv[1]); _script->savegame(slot); } else { - DebugPrintf("Syntax: save \n"); + debugPrintf("Syntax: save \n"); } return true; } @@ -129,7 +129,7 @@ bool Debugger::cmd_playref(int argc, const char **argv) { int ref = getNumber(argv[1]); _script->playvideofromref(ref); } else { - DebugPrintf("Syntax: playref \n"); + debugPrintf("Syntax: playref \n"); } return true; } @@ -140,7 +140,7 @@ bool Debugger::cmd_dumppal(int argc, const char **argv) { _vm->_system->getPaletteManager()->grabPalette(palettedump, 0, 256); for (i = 0; i < 256; i++) { - DebugPrintf("%3d: %3d,%3d,%3d\n", i, palettedump[(i * 3)], palettedump[(i * 3) + 1], palettedump[(i * 3) + 2]); + debugPrintf("%3d: %3d,%3d,%3d\n", i, palettedump[(i * 3)], palettedump[(i * 3) + 1], palettedump[(i * 3) + 2]); } return true; } diff --git a/engines/hopkins/debugger.cpp b/engines/hopkins/debugger.cpp index 14b1c183a8..e5c19847fb 100644 --- a/engines/hopkins/debugger.cpp +++ b/engines/hopkins/debugger.cpp @@ -41,7 +41,7 @@ Debugger::Debugger(HopkinsEngine *vm) : GUI::Debugger() { // Turns dirty rects on or off bool Debugger::cmd_DirtyRects(int argc, const char **argv) { if (argc != 2) { - DebugPrintf("%s: [on | off]\n", argv[0]); + debugPrintf("%s: [on | off]\n", argv[0]); return true; } else { _vm->_graphicsMan->_showDirtyRects = !strcmp(argv[1], "on"); @@ -52,7 +52,7 @@ bool Debugger::cmd_DirtyRects(int argc, const char **argv) { // Change room number bool Debugger::cmd_Teleport(int argc, const char **argv) { if (argc != 2) { - DebugPrintf("%s: [Room number]\n", argv[0]); + debugPrintf("%s: [Room number]\n", argv[0]); return true; } else { _vm->_globals->_exitId = atoi(argv[1]); @@ -62,13 +62,13 @@ bool Debugger::cmd_Teleport(int argc, const char **argv) { // Display room number bool Debugger::cmd_ShowCurrentRoom(int argc, const char **argv) { - DebugPrintf("Current room: %d\n", _vm->_globals->_curRoomNum); + debugPrintf("Current room: %d\n", _vm->_globals->_curRoomNum); return true; } bool Debugger::cmd_Zones(int argc, const char **argv) { if (argc != 2) { - DebugPrintf("%s: [on | off]\n", argv[0]); + debugPrintf("%s: [on | off]\n", argv[0]); return true; } else { _vm->_graphicsMan->_showZones = !strcmp(argv[1], "on"); @@ -78,7 +78,7 @@ if (argc != 2) { bool Debugger::cmd_Lines(int argc, const char **argv) { if (argc != 2) { - DebugPrintf("%s: [on | off]\n", argv[0]); + debugPrintf("%s: [on | off]\n", argv[0]); return true; } else { _vm->_graphicsMan->_showLines = !strcmp(argv[1], "on"); diff --git a/engines/hugo/console.cpp b/engines/hugo/console.cpp index 56025bfbfd..529fa4f7bd 100644 --- a/engines/hugo/console.cpp +++ b/engines/hugo/console.cpp @@ -62,7 +62,7 @@ static int strToInt(const char *s) { */ bool HugoConsole::Cmd_gotoScreen(int argc, const char **argv) { if ((argc != 2) || (strToInt(argv[1]) > _vm->_numScreens)){ - DebugPrintf("Usage: %s \n", argv[0]); + debugPrintf("Usage: %s \n", argv[0]); return true; } @@ -75,13 +75,13 @@ bool HugoConsole::Cmd_gotoScreen(int argc, const char **argv) { */ bool HugoConsole::Cmd_listScreens(int argc, const char **argv) { if (argc != 1) { - DebugPrintf("Usage: %s\n", argv[0]); + debugPrintf("Usage: %s\n", argv[0]); return true; } - DebugPrintf("Available screens for this game are:\n"); + debugPrintf("Available screens for this game are:\n"); for (int i = 0; i < _vm->_numScreens; i++) - DebugPrintf("%2d - %s\n", i, _vm->_text->getScreenNames(i)); + debugPrintf("%2d - %s\n", i, _vm->_text->getScreenNames(i)); return true; } @@ -90,14 +90,14 @@ bool HugoConsole::Cmd_listScreens(int argc, const char **argv) { */ bool HugoConsole::Cmd_listObjects(int argc, const char **argv) { if (argc != 1) { - DebugPrintf("Usage: %s\n", argv[0]); + debugPrintf("Usage: %s\n", argv[0]); return true; } - DebugPrintf("Available objects for this game are:\n"); + debugPrintf("Available objects for this game are:\n"); for (int i = 0; i < _vm->_object->_numObj; i++) { if (_vm->_object->_objects[i]._genericCmd & TAKE) - DebugPrintf("%2d - %s\n", i, _vm->_text->getNoun(_vm->_object->_objects[i]._nounIndex, 2)); + debugPrintf("%2d - %s\n", i, _vm->_text->getNoun(_vm->_object->_objects[i]._nounIndex, 2)); } return true; } @@ -107,14 +107,14 @@ bool HugoConsole::Cmd_listObjects(int argc, const char **argv) { */ bool HugoConsole::Cmd_getObject(int argc, const char **argv) { if ((argc != 2) || (strToInt(argv[1]) > _vm->_object->_numObj)) { - DebugPrintf("Usage: %s \n", argv[0]); + debugPrintf("Usage: %s \n", argv[0]); return true; } if (_vm->_object->_objects[strToInt(argv[1])]._genericCmd & TAKE) _vm->_parser->takeObject(&_vm->_object->_objects[strToInt(argv[1])]); else - DebugPrintf("Object not available\n"); + debugPrintf("Object not available\n"); return true; } @@ -124,7 +124,7 @@ bool HugoConsole::Cmd_getObject(int argc, const char **argv) { */ bool HugoConsole::Cmd_getAllObjects(int argc, const char **argv) { if (argc != 1) { - DebugPrintf("Usage: %s\n", argv[0]); + debugPrintf("Usage: %s\n", argv[0]); return true; } @@ -141,7 +141,7 @@ bool HugoConsole::Cmd_getAllObjects(int argc, const char **argv) { */ bool HugoConsole::Cmd_boundaries(int argc, const char **argv) { if (argc != 1) { - DebugPrintf("Usage: %s\n", argv[0]); + debugPrintf("Usage: %s\n", argv[0]); return true; } diff --git a/engines/kyra/debugger.cpp b/engines/kyra/debugger.cpp index e4806afb70..598eb1c1b0 100644 --- a/engines/kyra/debugger.cpp +++ b/engines/kyra/debugger.cpp @@ -59,10 +59,10 @@ bool Debugger::cmd_setScreenDebug(int argc, const char **argv) { else if (scumm_stricmp(argv[1], "disable") == 0) _vm->screen()->enableScreenDebug(false); else - DebugPrintf("Use screen_debug_mode to enable or disable it.\n"); + debugPrintf("Use screen_debug_mode to enable or disable it.\n"); } else { - DebugPrintf("Screen debug mode is %s.\n", (_vm->screen()->queryScreenDebug() ? "enabled" : "disabled")); - DebugPrintf("Use screen_debug_mode to enable or disable it.\n"); + debugPrintf("Screen debug mode is %s.\n", (_vm->screen()->queryScreenDebug() ? "enabled" : "disabled")); + debugPrintf("Use screen_debug_mode to enable or disable it.\n"); } return true; } @@ -71,14 +71,14 @@ bool Debugger::cmd_loadPalette(int argc, const char **argv) { Palette palette(_vm->screen()->getPalette(0).getNumColors()); if (argc <= 1) { - DebugPrintf("Use load_palette [start_col] [end_col]\n"); + debugPrintf("Use load_palette [start_col] [end_col]\n"); return true; } if (_vm->game() != GI_KYRA1 && _vm->resource()->getFileSize(argv[1]) != 768) { uint8 *buffer = new uint8[320 * 200 * sizeof(uint8)]; if (!buffer) { - DebugPrintf("ERROR: Cannot allocate buffer for screen region!\n"); + debugPrintf("ERROR: Cannot allocate buffer for screen region!\n"); return true; } @@ -89,7 +89,7 @@ bool Debugger::cmd_loadPalette(int argc, const char **argv) { delete[] buffer; } else if (!_vm->screen()->loadPalette(argv[1], palette)) { - DebugPrintf("ERROR: Palette '%s' not found!\n", argv[1]); + debugPrintf("ERROR: Palette '%s' not found!\n", argv[1]); return true; } @@ -112,12 +112,12 @@ bool Debugger::cmd_loadPalette(int argc, const char **argv) { } bool Debugger::cmd_showFacings(int argc, const char **argv) { - DebugPrintf("Facing directions:\n"); - DebugPrintf("7 0 1\n"); - DebugPrintf(" \\ | / \n"); - DebugPrintf("6--*--2\n"); - DebugPrintf(" / | \\\n"); - DebugPrintf("5 4 3\n"); + debugPrintf("Facing directions:\n"); + debugPrintf("7 0 1\n"); + debugPrintf(" \\ | / \n"); + debugPrintf("6--*--2\n"); + debugPrintf(" / | \\\n"); + debugPrintf("5 4 3\n"); return true; } @@ -126,13 +126,13 @@ bool Debugger::cmd_gameSpeed(int argc, const char **argv) { int val = atoi(argv[1]); if (val < 1 || val > 1000) { - DebugPrintf("speed must lie between 1 and 1000 (default: 60)\n"); + debugPrintf("speed must lie between 1 and 1000 (default: 60)\n"); return true; } _vm->_tickLength = (uint8)(1000.0 / val); } else { - DebugPrintf("Syntax: gamespeed \n"); + debugPrintf("Syntax: gamespeed \n"); } return true; @@ -140,13 +140,13 @@ bool Debugger::cmd_gameSpeed(int argc, const char **argv) { bool Debugger::cmd_listFlags(int argc, const char **argv) { for (int i = 0, p = 0; i < (int)sizeof(_vm->_flagsTable) * 8; i++, ++p) { - DebugPrintf("(%-3i): %-2i", i, _vm->queryGameFlag(i)); + debugPrintf("(%-3i): %-2i", i, _vm->queryGameFlag(i)); if (p == 5) { - DebugPrintf("\n"); + debugPrintf("\n"); p -= 6; } } - DebugPrintf("\n"); + debugPrintf("\n"); return true; } @@ -157,9 +157,9 @@ bool Debugger::cmd_toggleFlag(int argc, const char **argv) { _vm->resetGameFlag(flag); else _vm->setGameFlag(flag); - DebugPrintf("Flag %i is now %i\n", flag, _vm->queryGameFlag(flag)); + debugPrintf("Flag %i is now %i\n", flag, _vm->queryGameFlag(flag)); } else { - DebugPrintf("Syntax: toggleflag \n"); + debugPrintf("Syntax: toggleflag \n"); } return true; @@ -168,18 +168,18 @@ bool Debugger::cmd_toggleFlag(int argc, const char **argv) { bool Debugger::cmd_queryFlag(int argc, const char **argv) { if (argc > 1) { uint flag = atoi(argv[1]); - DebugPrintf("Flag %i is %i\n", flag, _vm->queryGameFlag(flag)); + debugPrintf("Flag %i is %i\n", flag, _vm->queryGameFlag(flag)); } else { - DebugPrintf("Syntax: queryflag \n"); + debugPrintf("Syntax: queryflag \n"); } return true; } bool Debugger::cmd_listTimers(int argc, const char **argv) { - DebugPrintf("Current time: %-8u\n", g_system->getMillis()); + debugPrintf("Current time: %-8u\n", g_system->getMillis()); for (int i = 0; i < _vm->timer()->count(); i++) - DebugPrintf("Timer %-2i: Active: %-3s Countdown: %-6i %-8u\n", i, _vm->timer()->isEnabled(i) ? "Yes" : "No", _vm->timer()->getDelay(i), _vm->timer()->getNextRun(i)); + debugPrintf("Timer %-2i: Active: %-3s Countdown: %-6i %-8u\n", i, _vm->timer()->isEnabled(i) ? "Yes" : "No", _vm->timer()->getDelay(i), _vm->timer()->getNextRun(i)); return true; } @@ -189,9 +189,9 @@ bool Debugger::cmd_setTimerCountdown(int argc, const char **argv) { uint timer = atoi(argv[1]); uint countdown = atoi(argv[2]); _vm->timer()->setCountdown(timer, countdown); - DebugPrintf("Timer %i now has countdown %i\n", timer, _vm->timer()->getDelay(timer)); + debugPrintf("Timer %i now has countdown %i\n", timer, _vm->timer()->getDelay(timer)); } else { - DebugPrintf("Syntax: settimercountdown \n"); + debugPrintf("Syntax: settimercountdown \n"); } return true; @@ -218,7 +218,7 @@ bool Debugger_LoK::cmd_enterRoom(int argc, const char **argv) { // game will crash if entering a non-existent room if (room >= _vm->_roomTableSize) { - DebugPrintf("room number must be any value between (including) 0 and %d\n", _vm->_roomTableSize - 1); + debugPrintf("room number must be any value between (including) 0 and %d\n", _vm->_roomTableSize - 1); return true; } @@ -246,18 +246,18 @@ bool Debugger_LoK::cmd_enterRoom(int argc, const char **argv) { return false; } - DebugPrintf("Syntax: room \n"); + debugPrintf("Syntax: room \n"); return true; } bool Debugger_LoK::cmd_listScenes(int argc, const char **argv) { for (int i = 0; i < _vm->_roomTableSize; i++) { - DebugPrintf("%-3i: %-10s", i, _vm->_roomFilenameTable[_vm->_roomTable[i].nameIndex]); + debugPrintf("%-3i: %-10s", i, _vm->_roomFilenameTable[_vm->_roomTable[i].nameIndex]); if (!(i % 8)) - DebugPrintf("\n"); + debugPrintf("\n"); } - DebugPrintf("\n"); - DebugPrintf("Current room: %i\n", _vm->_currentRoom); + debugPrintf("\n"); + debugPrintf("Current room: %i\n", _vm->_currentRoom); return true; } @@ -267,23 +267,23 @@ bool Debugger_LoK::cmd_giveItem(int argc, const char **argv) { // Kyrandia 1 has only 108 items (-1 to 106), otherwise it will crash if (item < -1 || item > 106) { - DebugPrintf("'itemid' must be any value between (including) -1 and 106\n"); + debugPrintf("'itemid' must be any value between (including) -1 and 106\n"); return true; } _vm->setMouseItem(item); _vm->_itemInHand = item; } else { - DebugPrintf("Syntax: give \n"); + debugPrintf("Syntax: give \n"); } return true; } bool Debugger_LoK::cmd_listBirthstones(int argc, const char **argv) { - DebugPrintf("Needed birthstone gems:\n"); + debugPrintf("Needed birthstone gems:\n"); for (int i = 0; i < ARRAYSIZE(_vm->_birthstoneGemTable); ++i) - DebugPrintf("%-3d '%s'\n", _vm->_birthstoneGemTable[i], _vm->_itemList[_vm->_birthstoneGemTable[i]]); + debugPrintf("%-3d '%s'\n", _vm->_birthstoneGemTable[i], _vm->_itemList[_vm->_birthstoneGemTable[i]]); return true; } @@ -309,7 +309,7 @@ bool Debugger_v2::cmd_enterScene(int argc, const char **argv) { // game will crash if entering a non-existent scene if (scene >= _vm->_sceneListSize) { - DebugPrintf("scene number must be any value between (including) 0 and %d\n", _vm->_sceneListSize - 1); + debugPrintf("scene number must be any value between (including) 0 and %d\n", _vm->_sceneListSize - 1); return true; } @@ -337,7 +337,7 @@ bool Debugger_v2::cmd_enterScene(int argc, const char **argv) { return false; } - DebugPrintf("Syntax: %s \n", argv[0]); + debugPrintf("Syntax: %s \n", argv[0]); return true; } @@ -345,32 +345,32 @@ bool Debugger_v2::cmd_listScenes(int argc, const char **argv) { int shown = 1; for (int i = 0; i < _vm->_sceneListSize; ++i) { if (_vm->_sceneList[i].filename1[0]) { - DebugPrintf("%-2i: %-10s", i, _vm->_sceneList[i].filename1); + debugPrintf("%-2i: %-10s", i, _vm->_sceneList[i].filename1); if (!(shown % 5)) - DebugPrintf("\n"); + debugPrintf("\n"); ++shown; } } - DebugPrintf("\n"); - DebugPrintf("Current scene: %i\n", _vm->_currentScene); + debugPrintf("\n"); + debugPrintf("Current scene: %i\n", _vm->_currentScene); return true; } bool Debugger_v2::cmd_sceneInfo(int argc, const char **argv) { - DebugPrintf("Current scene: %d '%s'\n", _vm->_currentScene, _vm->_sceneList[_vm->_currentScene].filename1); - DebugPrintf("\n"); - DebugPrintf("Exit information:\n"); - DebugPrintf("Exit1: leads to %d, position %dx%d\n", int16(_vm->_sceneExit1), _vm->_sceneEnterX1, _vm->_sceneEnterY1); - DebugPrintf("Exit2: leads to %d, position %dx%d\n", int16(_vm->_sceneExit2), _vm->_sceneEnterX2, _vm->_sceneEnterY2); - DebugPrintf("Exit3: leads to %d, position %dx%d\n", int16(_vm->_sceneExit3), _vm->_sceneEnterX3, _vm->_sceneEnterY3); - DebugPrintf("Exit4: leads to %d, position %dx%d\n", int16(_vm->_sceneExit4), _vm->_sceneEnterX4, _vm->_sceneEnterY4); - DebugPrintf("Special exit information:\n"); + debugPrintf("Current scene: %d '%s'\n", _vm->_currentScene, _vm->_sceneList[_vm->_currentScene].filename1); + debugPrintf("\n"); + debugPrintf("Exit information:\n"); + debugPrintf("Exit1: leads to %d, position %dx%d\n", int16(_vm->_sceneExit1), _vm->_sceneEnterX1, _vm->_sceneEnterY1); + debugPrintf("Exit2: leads to %d, position %dx%d\n", int16(_vm->_sceneExit2), _vm->_sceneEnterX2, _vm->_sceneEnterY2); + debugPrintf("Exit3: leads to %d, position %dx%d\n", int16(_vm->_sceneExit3), _vm->_sceneEnterX3, _vm->_sceneEnterY3); + debugPrintf("Exit4: leads to %d, position %dx%d\n", int16(_vm->_sceneExit4), _vm->_sceneEnterX4, _vm->_sceneEnterY4); + debugPrintf("Special exit information:\n"); if (!_vm->_specialExitCount) { - DebugPrintf("No special exits.\n"); + debugPrintf("No special exits.\n"); } else { - DebugPrintf("This scene has %d special exits.\n", _vm->_specialExitCount); + debugPrintf("This scene has %d special exits.\n", _vm->_specialExitCount); for (int i = 0; i < _vm->_specialExitCount; ++i) { - DebugPrintf("SpecialExit%d: facing %d, position (x1/y1/x2/y2): %d/%d/%d/%d\n", i, + debugPrintf("SpecialExit%d: facing %d, position (x1/y1/x2/y2): %d/%d/%d/%d\n", i, _vm->_specialExitTable[20 + i], _vm->_specialExitTable[0 + i], _vm->_specialExitTable[5 + i], _vm->_specialExitTable[10 + i], _vm->_specialExitTable[15 + i]); } @@ -380,14 +380,14 @@ bool Debugger_v2::cmd_sceneInfo(int argc, const char **argv) { } bool Debugger_v2::cmd_characterInfo(int argc, const char **argv) { - DebugPrintf("Main character is in scene: %d '%s'\n", _vm->_mainCharacter.sceneId, _vm->_sceneList[_vm->_mainCharacter.sceneId].filename1); - DebugPrintf("Position: %dx%d\n", _vm->_mainCharacter.x1, _vm->_mainCharacter.y1); - DebugPrintf("Facing: %d\n", _vm->_mainCharacter.facing); - DebugPrintf("Inventory:\n"); + debugPrintf("Main character is in scene: %d '%s'\n", _vm->_mainCharacter.sceneId, _vm->_sceneList[_vm->_mainCharacter.sceneId].filename1); + debugPrintf("Position: %dx%d\n", _vm->_mainCharacter.x1, _vm->_mainCharacter.y1); + debugPrintf("Facing: %d\n", _vm->_mainCharacter.facing); + debugPrintf("Inventory:\n"); for (int i = 0; i < 20; ++i) { - DebugPrintf("%-2d ", int8(_vm->_mainCharacter.inventory[i])); + debugPrintf("%-2d ", int8(_vm->_mainCharacter.inventory[i])); if (i == 9 || i == 19) - DebugPrintf("\n"); + debugPrintf("\n"); } return true; } @@ -418,9 +418,9 @@ bool Debugger_v2::cmd_sceneToFacing(int argc, const char **argv) { break; } - DebugPrintf("Exit to facing %d leads to room %d.\n", facing, exit); + debugPrintf("Exit to facing %d leads to room %d.\n", facing, exit); } else { - DebugPrintf("Usage: %s \n", argv[0]); + debugPrintf("Usage: %s \n", argv[0]); } return true; @@ -431,13 +431,13 @@ bool Debugger_v2::cmd_giveItem(int argc, const char **argv) { int item = atoi(argv[1]); if (item < -1 || item > _vm->engineDesc().maxItemId) { - DebugPrintf("itemid must be any value between (including) -1 and %d\n", _vm->engineDesc().maxItemId); + debugPrintf("itemid must be any value between (including) -1 and %d\n", _vm->engineDesc().maxItemId); return true; } _vm->setHandItem(item); } else { - DebugPrintf("Syntax: give \n"); + debugPrintf("Syntax: give \n"); } return true; @@ -458,13 +458,13 @@ bool Debugger_HoF::cmd_passcodes(int argc, const char **argv) { int val = atoi(argv[1]); if (val < 0 || val > 1) { - DebugPrintf("value must be either 1 (on) or 0 (off)\n"); + debugPrintf("value must be either 1 (on) or 0 (off)\n"); return true; } _vm->_dbgPass = val; } else { - DebugPrintf("Syntax: pass_codes <0/1>\n"); + debugPrintf("Syntax: pass_codes <0/1>\n"); } return true; @@ -496,21 +496,21 @@ void Debugger_EoB::initialize() { bool Debugger_EoB::cmd_importSaveFile(int argc, const char **argv) { if (!_vm->_allowImport) { - DebugPrintf("This command only works from the main menu.\n"); + debugPrintf("This command only works from the main menu.\n"); return true; } if (argc == 3) { int slot = atoi(argv[1]); if (slot < -1 || slot > 989) { - DebugPrintf("slot must be between (including) -1 and 989 \n"); + debugPrintf("slot must be between (including) -1 and 989 \n"); return true; } - DebugPrintf(_vm->importOriginalSaveFile(slot, argv[2]) ? "Success.\n" : "Failure.\n"); + debugPrintf(_vm->importOriginalSaveFile(slot, argv[2]) ? "Success.\n" : "Failure.\n"); _vm->loadItemDefs(); } else { - DebugPrintf("Syntax: import_savefile \n (Imports source save game file to dest slot.)\n import_savefile -1\n (Imports all original save game files found and puts them into the first available slots.)\n\n"); + debugPrintf("Syntax: import_savefile \n (Imports source save game file to dest slot.)\n import_savefile -1\n (Imports all original save game files found and puts them into the first available slots.)\n\n"); } return true; @@ -518,7 +518,7 @@ bool Debugger_EoB::cmd_importSaveFile(int argc, const char **argv) { bool Debugger_EoB::cmd_saveOriginal(int argc, const char **argv) { if (!_vm->_runFlag) { - DebugPrintf("This command doesn't work during intro or outro sequences,\nfrom the main menu or from the character generation.\n"); + debugPrintf("This command doesn't work during intro or outro sequences,\nfrom the main menu or from the character generation.\n"); return true; } @@ -535,53 +535,53 @@ bool Debugger_EoB::cmd_saveOriginal(int argc, const char **argv) { if (_vm->saveAsOriginalSaveFile()) { Common::FSNode nf = nd.getChild(Common::String::format("EOBDATA.SAV")); if (nf.isReadable()) - DebugPrintf("Saved to file: %s\n\n", nf.getPath().c_str()); + debugPrintf("Saved to file: %s\n\n", nf.getPath().c_str()); else - DebugPrintf("Failure.\n"); + debugPrintf("Failure.\n"); } else { - DebugPrintf("Failure.\n"); + debugPrintf("Failure.\n"); } } else { - DebugPrintf("Syntax: save_original\n (Saves game in original file format to a file which can be used with the orginal game executable.)\n\n"); + debugPrintf("Syntax: save_original\n (Saves game in original file format to a file which can be used with the orginal game executable.)\n\n"); } return true; } else if (argc == 2) { int slot = atoi(argv[1]); if (slot < 0 || slot > 5) { - DebugPrintf("Slot must be between (including) 0 and 5.\n"); + debugPrintf("Slot must be between (including) 0 and 5.\n"); } else if (_vm->saveAsOriginalSaveFile(slot)) { Common::FSNode nf = nd.getChild(Common::String::format("EOBDATA%d.SAV", slot)); if (nf.isReadable()) - DebugPrintf("Saved to file: %s\n\n", nf.getPath().c_str()); + debugPrintf("Saved to file: %s\n\n", nf.getPath().c_str()); else - DebugPrintf("Failure.\n"); + debugPrintf("Failure.\n"); } else { - DebugPrintf("Failure.\n"); + debugPrintf("Failure.\n"); } return true; } - DebugPrintf("Syntax: save_original \n (Saves game in original file format to a file which can be used with the orginal game executable.\n A save slot between 0 and 5 must be specified.)\n\n"); + debugPrintf("Syntax: save_original \n (Saves game in original file format to a file which can be used with the orginal game executable.\n A save slot between 0 and 5 must be specified.)\n\n"); return true; } bool Debugger_EoB::cmd_listMonsters(int, const char **) { - DebugPrintf("\nCurrent level: %d\n----------------------\n\n", _vm->_currentLevel); - DebugPrintf("Id Type Unit Block Position Direction Sub Level Mode Dst.block HP Flags\n--------------------------------------------------------------------------------------------------------------\n"); + debugPrintf("\nCurrent level: %d\n----------------------\n\n", _vm->_currentLevel); + debugPrintf("Id Type Unit Block Position Direction Sub Level Mode Dst.block HP Flags\n--------------------------------------------------------------------------------------------------------------\n"); for (int i = 0; i < 30; i++) { EoBMonsterInPlay *m = &_vm->_monsters[i]; - DebugPrintf("%.02d %.02d %.02d 0x%.04x %d %d %d %.02d 0x%.04x %.03d/%.03d 0x%.02x\n", i, m->type, m->unit, m->block, m->pos, m->dir, m->sub, m->mode, m->dest, m->hitPointsCur, m->hitPointsMax, m->flags); + debugPrintf("%.02d %.02d %.02d 0x%.04x %d %d %d %.02d 0x%.04x %.03d/%.03d 0x%.02x\n", i, m->type, m->unit, m->block, m->pos, m->dir, m->sub, m->mode, m->dest, m->hitPointsCur, m->hitPointsMax, m->flags); } - DebugPrintf("\n"); + debugPrintf("\n"); return true; } bool Debugger_EoB::cmd_showPosition(int, const char **) { - DebugPrintf("\nCurrent level: %d\nCurrent Sub Level: %d\nCurrent block: %d (0x%.04x)\nNext block: %d (0x%.04x)\nCurrent direction: %d\n\n", _vm->_currentLevel, _vm->_currentSub, _vm->_currentBlock, _vm->_currentBlock, _vm->calcNewBlockPosition(_vm->_currentBlock, _vm->_currentDirection), _vm->calcNewBlockPosition(_vm->_currentBlock, _vm->_currentDirection), _vm->_currentDirection); + debugPrintf("\nCurrent level: %d\nCurrent Sub Level: %d\nCurrent block: %d (0x%.04x)\nNext block: %d (0x%.04x)\nCurrent direction: %d\n\n", _vm->_currentLevel, _vm->_currentSub, _vm->_currentBlock, _vm->_currentBlock, _vm->calcNewBlockPosition(_vm->_currentBlock, _vm->_currentDirection), _vm->calcNewBlockPosition(_vm->_currentBlock, _vm->_currentDirection), _vm->_currentDirection); return true; } @@ -593,7 +593,7 @@ bool Debugger_EoB::cmd_setPosition(int argc, const char **argv) { int maxLevel = (_vm->game() == GI_EOB1) ? 12 : 16; if (level < 1 || level > maxLevel) { - DebugPrintf(" must be a value from 1 to %d.\n\n", maxLevel); + debugPrintf(" must be a value from 1 to %d.\n\n", maxLevel); return true; } @@ -613,66 +613,66 @@ bool Debugger_EoB::cmd_setPosition(int argc, const char **argv) { _vm->_sceneUpdateRequired = true; _vm->gui_drawAllCharPortraitsWithStats(); - DebugPrintf("Success.\n\n"); + debugPrintf("Success.\n\n"); } else { - DebugPrintf("Syntax: set_position , , \n"); - DebugPrintf(" (Warning: The sub level and block position parameters will not be checked. Invalid parameters may cause problems.)\n\n"); + debugPrintf("Syntax: set_position , , \n"); + debugPrintf(" (Warning: The sub level and block position parameters will not be checked. Invalid parameters may cause problems.)\n\n"); } return true; } bool Debugger_EoB::cmd_openDoor(int, const char **) { - DebugPrintf("Warning: Using this command may cause glitches.\n"); + debugPrintf("Warning: Using this command may cause glitches.\n"); uint16 block = _vm->calcNewBlockPosition(_vm->_currentBlock, _vm->_currentDirection); int c = (_vm->_wllWallFlags[_vm->_levelBlockProperties[block].walls[0]] & 8) ? 0 : 1; int v = _vm->_levelBlockProperties[block].walls[c]; int flg = (_vm->_flags.gameID == GI_EOB1) ? 1 : 0x10; if (_vm->_wllWallFlags[v] & flg) { - DebugPrintf("Couldn't open any door. Make sure you're facing the door you wish to open and standing right in front of it.\n\n"); + debugPrintf("Couldn't open any door. Make sure you're facing the door you wish to open and standing right in front of it.\n\n"); } else { _vm->openDoor(block); - DebugPrintf("Trying to open door at block %d.\n\n", block); + debugPrintf("Trying to open door at block %d.\n\n", block); } return true; } bool Debugger_EoB::cmd_closeDoor(int, const char **) { - DebugPrintf("Warning: Using this command may cause glitches.\n"); + debugPrintf("Warning: Using this command may cause glitches.\n"); uint16 block = _vm->calcNewBlockPosition(_vm->_currentBlock, _vm->_currentDirection); int c = (_vm->_wllWallFlags[_vm->_levelBlockProperties[block].walls[0]] & 8) ? 0 : 1; int v = _vm->_levelBlockProperties[block].walls[c]; if ((_vm->_flags.gameID == GI_EOB1 && !(_vm->_wllWallFlags[v] & 1)) || (_vm->_flags.gameID == GI_EOB2 && (_vm->_wllWallFlags[v] & 0x20))) { - DebugPrintf("Couldn't close any door. Make sure you're facing the door you wish to close and standing right in front of it.\n\n"); + debugPrintf("Couldn't close any door. Make sure you're facing the door you wish to close and standing right in front of it.\n\n"); } else { _vm->closeDoor(block); - DebugPrintf("Trying to close door at block %d.\n\n", block); + debugPrintf("Trying to close door at block %d.\n\n", block); } return true; } bool Debugger_EoB::cmd_listFlags(int, const char **) { - DebugPrintf("Flag Status\n----------------------\n\n"); + debugPrintf("Flag Status\n----------------------\n\n"); for (int i = 0; i < 32; i++) { uint32 flag = 1 << i; - DebugPrintf("%.2d %s\n", i, _vm->checkScriptFlags(flag) ? "TRUE" : "FALSE"); + debugPrintf("%.2d %s\n", i, _vm->checkScriptFlags(flag) ? "TRUE" : "FALSE"); } - DebugPrintf("\n"); + debugPrintf("\n"); return true; } bool Debugger_EoB::cmd_setFlag(int argc, const char **argv) { if (argc != 2) { - DebugPrintf("Syntax: set_flag \n\n"); + debugPrintf("Syntax: set_flag \n\n"); return true; } int flag = atoi(argv[1]); if (flag < 0 || flag > 31) { - DebugPrintf(" must be a value from 0 to 31.\n\n"); + debugPrintf(" must be a value from 0 to 31.\n\n"); } else { _vm->setScriptFlags(1 << flag); - DebugPrintf("Flag '%.2d' has been set.\n\n", flag); + debugPrintf("Flag '%.2d' has been set.\n\n", flag); } return true; @@ -680,16 +680,16 @@ bool Debugger_EoB::cmd_setFlag(int argc, const char **argv) { bool Debugger_EoB::cmd_clearFlag(int argc, const char **argv) { if (argc != 2) { - DebugPrintf("Syntax: clear_flag \n\n"); + debugPrintf("Syntax: clear_flag \n\n"); return true; } int flag = atoi(argv[1]); if (flag < 0 || flag > 31) { - DebugPrintf(" must be a value from 0 to 31.\n\n"); + debugPrintf(" must be a value from 0 to 31.\n\n"); } else { _vm->clearScriptFlags(1 << flag); - DebugPrintf("Flag '%.2d' has been cleared.\n\n", flag); + debugPrintf("Flag '%.2d' has been cleared.\n\n", flag); } return true; diff --git a/engines/lastexpress/debug.cpp b/engines/lastexpress/debug.cpp index 6c2d833271..e13a2f6194 100644 --- a/engines/lastexpress/debug.cpp +++ b/engines/lastexpress/debug.cpp @@ -156,7 +156,7 @@ void Debugger::callCommand() { bool Debugger::loadArchive(int index) { if (index < 1 || index > 3) { - DebugPrintf("Invalid cd number (was: %d, valid: [1-3])\n", index); + debugPrintf("Invalid cd number (was: %d, valid: [1-3])\n", index); return false; } @@ -198,36 +198,36 @@ void Debugger::restoreArchive() const { // Debugger commands ////////////////////////////////////////////////////////////////////////// bool Debugger::cmdHelp(int, const char **) { - DebugPrintf("Debug flags\n"); - DebugPrintf("-----------\n"); - DebugPrintf(" debugflag_list - Lists the available debug flags and their status\n"); - DebugPrintf(" debugflag_enable - Enables a debug flag\n"); - DebugPrintf(" debugflag_disable - Disables a debug flag\n"); - DebugPrintf("\n"); - DebugPrintf("Commands\n"); - DebugPrintf("--------\n"); - DebugPrintf(" ls - list files in the archive\n"); - DebugPrintf(" dump - dump a list of files in all archives\n"); - DebugPrintf("\n"); - DebugPrintf(" showframe - show a frame from a sequence\n"); - DebugPrintf(" showbg - show a background\n"); - DebugPrintf(" playseq - play a sequence\n"); - DebugPrintf(" playsnd - play a sound\n"); - DebugPrintf(" playsbe - play a subtitle\n"); - DebugPrintf(" playnis - play an animation\n"); - DebugPrintf("\n"); - DebugPrintf(" loadscene - load a scene\n"); - DebugPrintf(" fight - start a fight\n"); - DebugPrintf(" beetle - start the beetle game\n"); - DebugPrintf("\n"); - DebugPrintf(" delta - Adjust the time delta\n"); - DebugPrintf(" show - show game data\n"); - DebugPrintf(" entity - show entity data\n"); - DebugPrintf("\n"); - DebugPrintf(" loadgame - load a saved game\n"); - DebugPrintf(" chapter - switch to a specific chapter\n"); - DebugPrintf(" clear - clear the screen\n"); - DebugPrintf("\n"); + debugPrintf("Debug flags\n"); + debugPrintf("-----------\n"); + debugPrintf(" debugflag_list - Lists the available debug flags and their status\n"); + debugPrintf(" debugflag_enable - Enables a debug flag\n"); + debugPrintf(" debugflag_disable - Disables a debug flag\n"); + debugPrintf("\n"); + debugPrintf("Commands\n"); + debugPrintf("--------\n"); + debugPrintf(" ls - list files in the archive\n"); + debugPrintf(" dump - dump a list of files in all archives\n"); + debugPrintf("\n"); + debugPrintf(" showframe - show a frame from a sequence\n"); + debugPrintf(" showbg - show a background\n"); + debugPrintf(" playseq - play a sequence\n"); + debugPrintf(" playsnd - play a sound\n"); + debugPrintf(" playsbe - play a subtitle\n"); + debugPrintf(" playnis - play an animation\n"); + debugPrintf("\n"); + debugPrintf(" loadscene - load a scene\n"); + debugPrintf(" fight - start a fight\n"); + debugPrintf(" beetle - start the beetle game\n"); + debugPrintf("\n"); + debugPrintf(" delta - Adjust the time delta\n"); + debugPrintf(" show - show game data\n"); + debugPrintf(" entity - show entity data\n"); + debugPrintf("\n"); + debugPrintf(" loadgame - load a saved game\n"); + debugPrintf(" chapter - switch to a specific chapter\n"); + debugPrintf(" clear - clear the screen\n"); + debugPrintf("\n"); return true; } @@ -252,15 +252,15 @@ bool Debugger::cmdListFiles(int argc, const char **argv) { Common::ArchiveMemberList list; int count = _engine->getResourceManager()->listMatchingMembers(list, filter); - DebugPrintf("Number of matches: %d\n", count); + debugPrintf("Number of matches: %d\n", count); for (Common::ArchiveMemberList::iterator it = list.begin(); it != list.end(); ++it) - DebugPrintf(" %s\n", (*it)->getName().c_str()); + debugPrintf(" %s\n", (*it)->getName().c_str()); // Restore archive if (argc == 3) restoreArchive(); } else { - DebugPrintf("Syntax: ls (use * for all) ()\n"); + debugPrintf("Syntax: ls (use * for all) ()\n"); } return true; @@ -287,7 +287,7 @@ bool Debugger::cmdDumpFiles(int argc, const char **) { for (Common::ArchiveMemberList::iterator it = list.begin(); it != list.end(); ++it) { \ Common::SeekableReadStream *stream = getArchive((*it)->getName()); \ if (!stream) { \ - DebugPrintf("ERROR: Cannot create stream for file: %s\n", (*it)->getName().c_str()); \ + debugPrintf("ERROR: Cannot create stream for file: %s\n", (*it)->getName().c_str()); \ restoreArchive(); \ return true; \ } \ @@ -311,7 +311,7 @@ bool Debugger::cmdDumpFiles(int argc, const char **) { // Restore current loaded archive restoreArchive(); } else { - DebugPrintf("Syntax: dump"); + debugPrintf("Syntax: dump"); } return true; @@ -336,7 +336,7 @@ bool Debugger::cmdShowFrame(int argc, const char **argv) { } if (!_engine->getResourceManager()->hasFile(filename)) { - DebugPrintf("Cannot find file: %s\n", filename.c_str()); + debugPrintf("Cannot find file: %s\n", filename.c_str()); return true; } @@ -354,7 +354,7 @@ bool Debugger::cmdShowFrame(int argc, const char **argv) { AnimFrame *frame = sequence.getFrame((uint16)getNumber(argv[2])); if (!frame) { - DebugPrintf("Invalid frame index '%s'\n", argv[2]); + debugPrintf("Invalid frame index '%s'\n", argv[2]); resetCommand(); return true; } @@ -375,7 +375,7 @@ bool Debugger::cmdShowFrame(int argc, const char **argv) { restoreArchive(); } } else { - DebugPrintf("Syntax: cmd_showframe ()\n"); + debugPrintf("Syntax: cmd_showframe ()\n"); } return true; } @@ -398,7 +398,7 @@ bool Debugger::cmdShowBg(int argc, const char **argv) { } if (!_engine->getResourceManager()->hasFile(filename + ".BG")) { - DebugPrintf("Cannot find file: %s\n", (filename + ".BG").c_str()); + debugPrintf("Cannot find file: %s\n", (filename + ".BG").c_str()); return true; } @@ -429,7 +429,7 @@ bool Debugger::cmdShowBg(int argc, const char **argv) { resetCommand(); } } else { - DebugPrintf("Syntax: showbg ()\n"); + debugPrintf("Syntax: showbg ()\n"); } return true; } @@ -453,7 +453,7 @@ bool Debugger::cmdPlaySeq(int argc, const char **argv) { } if (!_engine->getResourceManager()->hasFile(filename)) { - DebugPrintf("Cannot find file: %s\n", filename.c_str()); + debugPrintf("Cannot find file: %s\n", filename.c_str()); return true; } @@ -510,7 +510,7 @@ bool Debugger::cmdPlaySeq(int argc, const char **argv) { restoreArchive(); } } else { - DebugPrintf("Syntax: playseq ()\n"); + debugPrintf("Syntax: playseq ()\n"); } return true; } @@ -537,7 +537,7 @@ bool Debugger::cmdPlaySnd(int argc, const char **argv) { name += ".SND"; if (!_engine->getResourceManager()->hasFile(name)) { - DebugPrintf("Cannot find file: %s\n", name.c_str()); + debugPrintf("Cannot find file: %s\n", name.c_str()); return true; } @@ -548,7 +548,7 @@ bool Debugger::cmdPlaySnd(int argc, const char **argv) { if (argc == 3) restoreArchive(); } else { - DebugPrintf("Syntax: playsnd ()\n"); + debugPrintf("Syntax: playsnd ()\n"); } return true; } @@ -573,7 +573,7 @@ bool Debugger::cmdPlaySbe(int argc, const char **argv) { filename += ".sbe"; if (!_engine->getResourceManager()->hasFile(filename)) { - DebugPrintf("Cannot find file: %s\n", filename.c_str()); + debugPrintf("Cannot find file: %s\n", filename.c_str()); return true; } @@ -615,7 +615,7 @@ bool Debugger::cmdPlaySbe(int argc, const char **argv) { resetCommand(); } } else { - DebugPrintf("Syntax: playsbe ()\n"); + debugPrintf("Syntax: playsbe ()\n"); } return true; } @@ -639,7 +639,7 @@ bool Debugger::cmdPlayNis(int argc, const char **argv) { // If we got a nis filename, check that the file exists if (name.contains('.') && !_engine->getResourceManager()->hasFile(name)) { - DebugPrintf("Cannot find file: %s\n", name.c_str()); + debugPrintf("Cannot find file: %s\n", name.c_str()); return true; } @@ -672,7 +672,7 @@ bool Debugger::cmdPlayNis(int argc, const char **argv) { resetCommand(); } } else { - DebugPrintf("Syntax: playnis ()\n"); + debugPrintf("Syntax: playnis ()\n"); } return true; } @@ -697,7 +697,7 @@ bool Debugger::cmdLoadScene(int argc, const char **argv) { } if (index > 2500) { - DebugPrintf("Error: invalid index value (0-2500)"); + debugPrintf("Error: invalid index value (0-2500)"); return true; } @@ -718,7 +718,7 @@ bool Debugger::cmdLoadScene(int argc, const char **argv) { // loadSceneObject(scene, i); // if (scene.getHeader() && scene.getHeader()->car == 5 && scene.getHeader()->position == 81) { - // DebugPrintf("Found scene: %d", i); + // debugPrintf("Found scene: %d", i); // // Draw scene found // _engine->getGraphicsManager()->draw(&scene, GraphicsManager::kBackgroundC); @@ -738,7 +738,7 @@ bool Debugger::cmdLoadScene(int argc, const char **argv) { /*********************************************/ Scene *scene = getScenes()->get(index); if (!scene) { - DebugPrintf("Cannot load scene %i from CD %i", index, cd); + debugPrintf("Cannot load scene %i from CD %i", index, cd); resetCommand(); return true; @@ -758,7 +758,7 @@ bool Debugger::cmdLoadScene(int argc, const char **argv) { resetCommand(); } } else { - DebugPrintf("Syntax: loadscene ()\n"); + debugPrintf("Syntax: loadscene ()\n"); } return true; } @@ -814,7 +814,7 @@ bool Debugger::cmdFight(int argc, const char **argv) { SceneIndex lastScene = getState()->scene; - getFight()->setup(type) ? DebugPrintf("Lost fight!\n") : DebugPrintf("Won fight!\n"); + getFight()->setup(type) ? debugPrintf("Lost fight!\n") : debugPrintf("Won fight!\n"); // Pause for a second to be able to see the final scene _engine->_system->delayMillis(1000); @@ -837,7 +837,7 @@ bool Debugger::cmdFight(int argc, const char **argv) { } } else { error: - DebugPrintf("Syntax: fight (id=2001-2005)\n"); + debugPrintf("Syntax: fight (id=2001-2005)\n"); } return true; @@ -968,7 +968,7 @@ bool Debugger::cmdBeetle(int argc, const char **argv) { resetCommand(); } } else { - DebugPrintf("Syntax: beetle\n"); + debugPrintf("Syntax: beetle\n"); } return true; @@ -992,7 +992,7 @@ bool Debugger::cmdTimeDelta(int argc, const char **argv) { getState()->timeDelta = (uint)delta; } else { label_error: - DebugPrintf("Syntax: delta