diff options
Diffstat (limited to 'engines/mads')
-rw-r--r-- | engines/mads/hotspots.cpp | 5 | ||||
-rw-r--r-- | engines/mads/nebular/sound_nebular.cpp | 62 | ||||
-rw-r--r-- | engines/mads/nebular/sound_nebular.h | 60 | ||||
-rw-r--r-- | engines/mads/phantom/game_phantom.cpp | 90 | ||||
-rw-r--r-- | engines/mads/phantom/globals_phantom.h | 96 | ||||
-rw-r--r-- | engines/mads/phantom/phantom_scenes.cpp | 2 | ||||
-rw-r--r-- | engines/mads/phantom/phantom_scenes.h | 40 | ||||
-rw-r--r-- | engines/mads/phantom/phantom_scenes1.cpp | 104 | ||||
-rw-r--r-- | engines/mads/phantom/phantom_scenes1.h | 15 | ||||
-rw-r--r-- | engines/mads/sound.cpp | 3 | ||||
-rw-r--r-- | engines/mads/sound.h | 2 |
11 files changed, 331 insertions, 148 deletions
diff --git a/engines/mads/hotspots.cpp b/engines/mads/hotspots.cpp index bd28645504..8afef2e524 100644 --- a/engines/mads/hotspots.cpp +++ b/engines/mads/hotspots.cpp @@ -193,9 +193,8 @@ Hotspot::Hotspot(Common::SeekableReadStream &f, bool isV2) { _active = f.readByte() != 0; _cursor = (CursorType)f.readByte(); if (isV2) { - // This looks to be some sort of bitmask. Perhaps it signifies - // the valid verbs for this hotspot - f.skip(2); // unknown + f.skip(1); // cursor + f.skip(1); // syntax } _vocabId = f.readUint16LE(); _verbId = f.readUint16LE(); diff --git a/engines/mads/nebular/sound_nebular.cpp b/engines/mads/nebular/sound_nebular.cpp index 240c18f6dc..711f82a05b 100644 --- a/engines/mads/nebular/sound_nebular.cpp +++ b/engines/mads/nebular/sound_nebular.cpp @@ -21,6 +21,7 @@ */ #include "audio/audiostream.h" +#include "audio/fmopl.h" #include "audio/decoders/raw.h" #include "common/algorithm.h" #include "common/debug.h" @@ -156,7 +157,7 @@ AdlibSample::AdlibSample(Common::SeekableReadStream &s) { /*-----------------------------------------------------------------------*/ -ASound::ASound(Audio::Mixer *mixer, FM_OPL *opl, const Common::String &filename, int dataOffset) { +ASound::ASound(Audio::Mixer *mixer, OPL::OPL *opl, 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()); @@ -188,11 +189,6 @@ ASound::ASound(Audio::Mixer *mixer, FM_OPL *opl, const Common::String &filename, _randomSeed = 1234; _amDep = _vibDep = _splitPoint = true; - _samplesTillCallback = 0; - _samplesTillCallbackRemainder = 0; - _samplesPerCallback = getRate() / CALLBACKS_PER_SECOND; - _samplesPerCallbackRemainder = getRate() % CALLBACKS_PER_SECOND; - for (int i = 0; i < 11; ++i) { _channelData[i]._field0 = 0; _channelData[i]._freqMask = 0; @@ -210,23 +206,19 @@ ASound::ASound(Audio::Mixer *mixer, FM_OPL *opl, const Common::String &filename, _mixer = mixer; _opl = opl; - _opl->init(getRate()); - _mixer->playStream(Audio::Mixer::kPlainSoundType, &_soundHandle, this, -1, - Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true); - // Initialize the Adlib adlibInit(); // Reset the adlib command0(); + + _opl->start(new Common::Functor0Mem<void, ASound>(this, &ASound::onTimer), CALLBACKS_PER_SECOND); } ASound::~ASound() { Common::List<CachedDataEntry>::iterator i; for (i = _dataCache.begin(); i != _dataCache.end(); ++i) delete[] (*i)._data; - - _mixer->stopHandle(_soundHandle); } void ASound::validate() { @@ -832,32 +824,10 @@ void ASound::updateFNumber() { write2(8, hiReg, val2); } -int ASound::readBuffer(int16 *buffer, const int numSamples) { +void ASound::onTimer() { 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<int>(samplesLeft, _samplesTillCallback); - samplesLeft -= render; - _samplesTillCallback -= render; - - _opl->readBuffer(buffer, render); - buffer += render; - } - return numSamples; + poll(); + flush(); } void ASound::setVolume(int volume) { @@ -984,7 +954,7 @@ const ASound1::CommandPtr ASound1::_commandList[42] = { &ASound1::command40, &ASound1::command41 }; -ASound1::ASound1(Audio::Mixer *mixer, FM_OPL *opl) +ASound1::ASound1(Audio::Mixer *mixer, OPL::OPL *opl) : ASound(mixer, opl, "asound.001", 0x1520) { _cmd23Toggle = false; @@ -1285,7 +1255,7 @@ const ASound2::CommandPtr ASound2::_commandList[44] = { &ASound2::command40, &ASound2::command41, &ASound2::command42, &ASound2::command43 }; -ASound2::ASound2(Audio::Mixer *mixer, FM_OPL *opl) : ASound(mixer, opl, "asound.002", 0x15E0) { +ASound2::ASound2(Audio::Mixer *mixer, OPL::OPL *opl) : ASound(mixer, opl, "asound.002", 0x15E0) { _command12Param = 0xFD; // Load sound samples @@ -1656,7 +1626,7 @@ const ASound3::CommandPtr ASound3::_commandList[61] = { &ASound3::command60 }; -ASound3::ASound3(Audio::Mixer *mixer, FM_OPL *opl) : ASound(mixer, opl, "asound.003", 0x15B0) { +ASound3::ASound3(Audio::Mixer *mixer, OPL::OPL *opl) : ASound(mixer, opl, "asound.003", 0x15B0) { _command39Flag = false; // Load sound samples @@ -2060,7 +2030,7 @@ const ASound4::CommandPtr ASound4::_commandList[61] = { &ASound4::command60 }; -ASound4::ASound4(Audio::Mixer *mixer, FM_OPL *opl) : ASound(mixer, opl, "asound.004", 0x14F0) { +ASound4::ASound4(Audio::Mixer *mixer, OPL::OPL *opl) : ASound(mixer, opl, "asound.004", 0x14F0) { // Load sound samples _soundFile.seek(_dataOffset + 0x122); for (int i = 0; i < 210; ++i) @@ -2316,7 +2286,7 @@ const ASound5::CommandPtr ASound5::_commandList[42] = { &ASound5::command40, &ASound5::command41 }; -ASound5::ASound5(Audio::Mixer *mixer, FM_OPL *opl) : ASound(mixer, opl, "asound.002", 0x15E0) { +ASound5::ASound5(Audio::Mixer *mixer, OPL::OPL *opl) : ASound(mixer, opl, "asound.002", 0x15E0) { // Load sound samples _soundFile.seek(_dataOffset + 0x144); for (int i = 0; i < 164; ++i) @@ -2557,7 +2527,7 @@ const ASound6::CommandPtr ASound6::_commandList[30] = { &ASound6::nullCommand, &ASound6::command29 }; -ASound6::ASound6(Audio::Mixer *mixer, FM_OPL *opl) : ASound(mixer, opl, "asound.006", 0x1390) { +ASound6::ASound6(Audio::Mixer *mixer, OPL::OPL *opl) : ASound(mixer, opl, "asound.006", 0x1390) { // Load sound samples _soundFile.seek(_dataOffset + 0x122); for (int i = 0; i < 200; ++i) @@ -2713,7 +2683,7 @@ const ASound7::CommandPtr ASound7::_commandList[38] = { &ASound7::command36, &ASound7::command37 }; -ASound7::ASound7(Audio::Mixer *mixer, FM_OPL *opl) : ASound(mixer, opl, "asound.007", 0x1460) { +ASound7::ASound7(Audio::Mixer *mixer, OPL::OPL *opl) : ASound(mixer, opl, "asound.007", 0x1460) { // Load sound samples _soundFile.seek(_dataOffset + 0x122); for (int i = 0; i < 214; ++i) @@ -2919,7 +2889,7 @@ const ASound8::CommandPtr ASound8::_commandList[38] = { &ASound8::command36, &ASound8::command37 }; -ASound8::ASound8(Audio::Mixer *mixer, FM_OPL *opl) : ASound(mixer, opl, "asound.008", 0x1490) { +ASound8::ASound8(Audio::Mixer *mixer, OPL::OPL *opl) : ASound(mixer, opl, "asound.008", 0x1490) { // Load sound samples _soundFile.seek(_dataOffset + 0x122); for (int i = 0; i < 174; ++i) @@ -3175,7 +3145,7 @@ const ASound9::CommandPtr ASound9::_commandList[52] = { &ASound9::command48, &ASound9::command49, &ASound9::command50, &ASound9::command51 }; -ASound9::ASound9(Audio::Mixer *mixer, FM_OPL *opl) : ASound(mixer, opl, "asound.009", 0x16F0) { +ASound9::ASound9(Audio::Mixer *mixer, OPL::OPL *opl) : ASound(mixer, opl, "asound.009", 0x16F0) { _v1 = _v2 = 0; _soundPtr = nullptr; diff --git a/engines/mads/nebular/sound_nebular.h b/engines/mads/nebular/sound_nebular.h index 9bc1a49458..2b80b08d89 100644 --- a/engines/mads/nebular/sound_nebular.h +++ b/engines/mads/nebular/sound_nebular.h @@ -28,9 +28,12 @@ #include "common/mutex.h" #include "common/queue.h" #include "audio/audiostream.h" -#include "audio/fmopl.h" #include "audio/mixer.h" +namespace OPL { +class OPL; +} + namespace MADS { class SoundManager; @@ -142,7 +145,7 @@ struct CachedDataEntry { /** * Base class for the sound player resource files */ -class ASound : public Audio::AudioStream { +class ASound { private: Common::List<CachedDataEntry> _dataCache; uint16 _randomSeed; @@ -192,6 +195,11 @@ private: void processSample(); void updateFNumber(); + + /** + * Timer function for OPL + */ + void onTimer(); protected: int _commandParam; @@ -273,8 +281,7 @@ protected: int nullCommand() { return 0; } public: Audio::Mixer *_mixer; - FM_OPL *_opl; - Audio::SoundHandle _soundHandle; + OPL::OPL *_opl; AdlibChannel _channels[ADLIB_CHANNEL_COUNT]; AdlibChannel *_activeChannelPtr; AdlibChannelData _channelData[11]; @@ -306,10 +313,6 @@ public: int _activeChannelReg; int _v11; bool _amDep, _vibDep, _splitPoint; - int _samplesPerCallback; - int _samplesPerCallbackRemainder; - int _samplesTillCallback; - int _samplesTillCallbackRemainder; public: /** * Constructor @@ -318,7 +321,7 @@ public: * @param filename Specifies the adlib sound player file to use * @param dataOffset Offset in the file of the data segment */ - ASound(Audio::Mixer *mixer, FM_OPL *opl, const Common::String &filename, int dataOffset); + ASound(Audio::Mixer *mixer, OPL::OPL *opl, const Common::String &filename, int dataOffset); /** * Destructor @@ -363,27 +366,6 @@ public: */ CachedDataEntry &getCachedData(byte *pData); - // 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; } - /** * Set the volume */ @@ -433,7 +415,7 @@ private: void command111213(); int command2627293032(); public: - ASound1(Audio::Mixer *mixer, FM_OPL *opl); + ASound1(Audio::Mixer *mixer, OPL::OPL *opl); virtual int command(int commandId, int param); }; @@ -485,7 +467,7 @@ private: void command9Randomize(); void command9Apply(byte *data, int val, int incr); public: - ASound2(Audio::Mixer *mixer, FM_OPL *opl); + ASound2(Audio::Mixer *mixer, OPL::OPL *opl); virtual int command(int commandId, int param); }; @@ -545,7 +527,7 @@ private: void command9Randomize(); void command9Apply(byte *data, int val, int incr); public: - ASound3(Audio::Mixer *mixer, FM_OPL *opl); + ASound3(Audio::Mixer *mixer, OPL::OPL *opl); virtual int command(int commandId, int param); }; @@ -583,7 +565,7 @@ private: void method1(); public: - ASound4(Audio::Mixer *mixer, FM_OPL *opl); + ASound4(Audio::Mixer *mixer, OPL::OPL *opl); virtual int command(int commandId, int param); }; @@ -629,7 +611,7 @@ private: int command42(); int command43(); public: - ASound5(Audio::Mixer *mixer, FM_OPL *opl); + ASound5(Audio::Mixer *mixer, OPL::OPL *opl); virtual int command(int commandId, int param); }; @@ -658,7 +640,7 @@ private: int command25(); int command29(); public: - ASound6(Audio::Mixer *mixer, FM_OPL *opl); + ASound6(Audio::Mixer *mixer, OPL::OPL *opl); virtual int command(int commandId, int param); }; @@ -690,7 +672,7 @@ private: int command36(); int command37(); public: - ASound7(Audio::Mixer *mixer, FM_OPL *opl); + ASound7(Audio::Mixer *mixer, OPL::OPL *opl); virtual int command(int commandId, int param); }; @@ -733,7 +715,7 @@ private: void method1(byte *pData); void adjustRange(byte *pData, byte v, int incr); public: - ASound8(Audio::Mixer *mixer, FM_OPL *opl); + ASound8(Audio::Mixer *mixer, OPL::OPL *opl); virtual int command(int commandId, int param); }; @@ -792,7 +774,7 @@ private: int command59(); int command60(); public: - ASound9(Audio::Mixer *mixer, FM_OPL *opl); + ASound9(Audio::Mixer *mixer, OPL::OPL *opl); virtual int command(int commandId, int param); }; diff --git a/engines/mads/phantom/game_phantom.cpp b/engines/mads/phantom/game_phantom.cpp index 959a726edf..592a108aea 100644 --- a/engines/mads/phantom/game_phantom.cpp +++ b/engines/mads/phantom/game_phantom.cpp @@ -52,31 +52,74 @@ void GamePhantom::startGame() { void GamePhantom::initializeGlobals() { _globals.reset(); - warning("TODO: sub_316DA()"); + // TODO: Catacombs setup _player._facing = FACING_NORTH; _player._turnToFacing = FACING_NORTH; - _globals[kCurrentYear] = 1993; - - /* Section #1 variables */ - // TODO - - /* Section #2 variables */ - // TODO - - /* Section #3 variables */ - // TODO - - /* Section #4 variables */ - // TODO - - /* Section #5 variables */ - // TODO - - /* Section #9 variables */ - // TODO - + _globals[kTempVar] = false; + _globals[kRoom103104Transition] = 1; // new room + _globals[kCurrentYear] = 1993; + _globals[kTrapDoorStatus] = 0; // open + _globals[kChristineDoorStatus] = 0; // Christine is in her room + _globals[kSandbagStatus] = 0; // sandbag is secure + _globals[kJacquesStatus] = 0; // alive + _globals[kChrisFStatus] = 1; // Christine F. is alive in 1993 + _globals[kBrieTalkStatus] = 0; // before Brie motions + _globals[kPanelIn206] = 0; // not discovered + _globals[kFightStatus] = 0; + _globals[kJuliesDoor] = 1; // cracked open + _globals[kPrompterStandStatus] = 0; + _globals[kChrisDStatus] = 0; // before love + _globals[kJulieNameIsKnown] = 0; + _globals[kDoorsIn205] = 0; // both locked + _globals[kMadameGiryLocation] = 1; // middle + _globals[kTicketPeoplePresent] = 0; + _globals[kCoffinStatus] = 0; // closed and locked + _globals[kDoneBrieConv203] = 0; + _globals[kFlorentNameIsKnown] = 0; + _globals[kDegasNameIsKnown] = 0; + _globals[kMadameGiryShowsUp] = false; + _globals[kJacquesNameIsKnown] = 0; + _globals[kCharlesNameIsKnown] = false; + _globals[kTopFloorLocked] = true; + _globals[kMadameNameIsKnown] = 0; + _globals[kChrisKickedRaoulOut] = false; + _globals[kLookedAtCase] = false; + _globals[kRingIsOnFinger] = false; + _globals[kHeListened] = false; + _globals[kKnockedOverHead] = false; + _globals[kObservedPhan104] = false; + _globals[kReadBook] = false; + _globals[kCanFindBookInLibrary] = false; + _globals[kLookedAtSkullFace] = false; + _globals[kScannedBookcase] = false; + _globals[kRanConvIn205] = false; + _globals[kDoneRichConv203] = false; + _globals[kHintThatDaaeIsHome1] = false; + _globals[kHintThatDaaeIsHome2] = false; + _globals[kMakeBrieLeave203] = false; + _globals[kMakeRichLeave203] = false; + _globals[kCameFromFade] = false; + _globals[kChristineToldEnvelope] = false; + _globals[kLeaveAngelMusicOn] = false; + _globals[kDoorIn409IsOpen] = false; + _globals[kUnknown] = false; + _globals[kCobwebIsCut] = false; + _globals[kChristineIsInBoat] = false; + _globals[kRightDoorIsOpen504] = false; + _globals[kChrisLeft505] = false; + _globals[kChrisWillTakeSeat] = true; + _globals[kFlickedLever1] = 0; + _globals[kFlickedLever2] = 0; + _globals[kFlickedLever3] = 0; + _globals[kFlickedLever4] = 0; + _globals[kPlayerScore] = 0; + _globals[kPlayerScoreFlags] = 0; + + _globals[kMusicSelected] = _vm->getRandomNumber(1, 4); + + _player._spritesPrefix = "RAL"; // Fixed prefix Player::preloadSequences("RAL", 1); } @@ -108,6 +151,11 @@ void GamePhantom::checkShowDialog() { // TODO: Copied from Nebular if (_vm->_dialogs->_pendingDialog && _player._stepEnabled && !_globals[5]) { _player.releasePlayerSprites(); + + // HACK: Skip the main menu (since it'll then try to show Rex's main menu) + if (_vm->_dialogs->_pendingDialog == DIALOG_MAIN_MENU) + _vm->_dialogs->_pendingDialog = DIALOG_NONE; + _vm->_dialogs->showDialog(); _vm->_dialogs->_pendingDialog = DIALOG_NONE; } diff --git a/engines/mads/phantom/globals_phantom.h b/engines/mads/phantom/globals_phantom.h index 44d8c9e4bc..c23b53cdf5 100644 --- a/engines/mads/phantom/globals_phantom.h +++ b/engines/mads/phantom/globals_phantom.h @@ -33,23 +33,91 @@ namespace MADS { namespace Phantom { enum GlobalId { + // Global variables + kWalkerTiming = 0, -// kWalkerTiming0 = 1, + kWalkerTiming2 = 1, + kStopWalkerDisabled = 2, // disable walker idle animations + kTempInterface = 3, + kWalkerConverse = 4, // conversation started with an NPC + kWalkerConverseState = 5, + kWalkerConverseNow = 6, kCurrentYear = 10, // current year (1881 or 1993) - - //kTalkInanimateCount = 4, - - /* Section #1 variables */ - - /* Section #2 variables */ - - /* Section #3 Variables */ - - /* Section #4 Variables */ - - /* Section #5 Variables */ - + kMusicSelected = 11, + kPlayerScore = 12, + kPlayerScoreFlags = 13, + kDoneBrieConv203 = 14, + kLanternStatus = 15, + + // Section #1 variables + kLeaveAngelMusicOn = 19, + kTrapDoorStatus = 20, + kChristineDoorStatus = 21, + kSandbagStatus = 22, + kChrisFStatus = 23, + kBrieTalkStatus = 24, + kJuliesDoor = 25, + kPrompterStandStatus = 26, + kChrisDStatus = 27, + kJulieNameIsKnown = 28, + kChrisKickedRaoulOut = 29, + kJacquesNameIsKnown = 30, + kJacquesStatus = 31, + kFlorentNameIsKnown = 32, + kCharlesNameIsKnown = 33, + kRoom103104Transition = 34, + kObservedPhan104 = 35, + kDeathLocation = 36, + kMakeBrieLeave203 = 37, + kHintThatDaaeIsHome1 = 38, + kHintThatDaaeIsHome2 = 39, + + // Section #2 variables + kChristineToldEnvelope = 40, + kReadBook = 41, + kScannedBookcase = 42, + kRanConvIn205 = 43, + kDoorsIn205 = 44, + kPanelIn206 = 45, + kMadameNameIsKnown = 46, + kMadameGiryLocation = 47, + kLookedAtCase = 48, + kMadameGiryShowsUp = 49, + kDoneRichConv203 = 50, + kCameFromFade = 51, + kTicketPeoplePresent = 52, + kDegasNameIsKnown = 53, + kTempVar = 54, + kFlickedLever1 = 55, + kFlickedLever2 = 56, + kFlickedLever3 = 57, + kFlickedLever4 = 58, + + // Section #3 Variables + kTopFloorLocked = 60, + + // Section #4 Variables + kCatacombsRoom = 80, + // TODO + kDoorIn409IsOpen = 93, + kUnknown = 94, // TODO + kCobwebIsCut = 95, + + // Section #5 Variables + kChristineIsInBoat = 100, + kChrisWillTakeSeat = 101, + kRightDoorIsOpen504 = 102, + kCoffinStatus = 103, + kChrisLeft505 = 104, + kKnockedOverHead = 105, + kFightStatus = 106, + kHeListened = 107, + kCanFindBookInLibrary = 108, + kRingIsOnFinger = 109, + kLookedAtSkullFace = 110, + kCableHookWasSeparate = 111, + kMakeRichLeave203 = 112 }; class PhantomGlobals : public Globals { diff --git a/engines/mads/phantom/phantom_scenes.cpp b/engines/mads/phantom/phantom_scenes.cpp index 57c2bb2c9b..f7f4d154df 100644 --- a/engines/mads/phantom/phantom_scenes.cpp +++ b/engines/mads/phantom/phantom_scenes.cpp @@ -43,7 +43,7 @@ SceneLogic *SceneFactory::createScene(MADSEngine *vm) { switch (scene._nextSceneId) { // Scene group #1 (theater, stage and dressing rooms) case 101: // seats - return new DummyScene(vm); // TODO + return new Scene101(vm); case 102: // music stands return new Scene102(vm); case 103: // below stage diff --git a/engines/mads/phantom/phantom_scenes.h b/engines/mads/phantom/phantom_scenes.h index 55218f219a..c0a823ae06 100644 --- a/engines/mads/phantom/phantom_scenes.h +++ b/engines/mads/phantom/phantom_scenes.h @@ -35,7 +35,24 @@ namespace MADS { namespace Phantom { enum Verb { + VERB_LOOK = 0x3, + VERB_TAKE = 0x4, + VERB_PUSH = 0x5, + VERB_OPEN = 0x6, + VERB_PUT = 0x7, + VERB_TALK_TO = 0x8, + VERB_GIVE = 0x9, + VERB_PULL = 0xA, + VERB_CLOSE = 0xB, + VERB_THROW = 0xC, + VERB_WALK_TO = 0xD, + VERB_CLIMB_DOWN = 0x21, + VERB_CLIMB_INTO = 0x22, + VERB_CLIMB_THROUGH = 0x23, + VERB_EXIT_TO = 0x37, + VERB_JUMP_INTO = 0x53, VERB_LOOK_AT = 0x60, + VERB_LOOK_THROUGH = 0x61, VERB_TURN_OFF = 0x95, VERB_TURN_ON = 0x96, VERB_UNLOCK = 0x97, @@ -43,22 +60,14 @@ enum Verb { VERB_WALK_DOWN = 0x9A, VERB_WALK_THROUGH = 0x9B, VERB_WALK_UP = 0x9C, + VERB_CLIMB_UP = 0xA5, + VERB_WALK_ONTO = 0xA6, + VERB_WALK = 0xA7 }; 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_ = 0xE, NOUN_IN_ONE = 0xF, NOUN_IN_TWO = 0x10, @@ -78,9 +87,6 @@ enum Noun { 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, @@ -100,7 +106,6 @@ enum Noun { 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, @@ -128,7 +133,6 @@ enum Noun { NOUN_HOUSE = 0x50, NOUN_IN_ONE2 = 0x51, NOUN_IN_TWO2 = 0x52, - NOUN_JUMP_INTO = 0x53, NOUN_JUNK = 0x54, NOUN_KEY = 0x55, NOUN_LAMP = 0x56, @@ -141,7 +145,6 @@ enum Noun { NOUN_LOCK = 0x5D, NOUN_LOCKING_RAIL = 0x5E, NOUN_LOCKRAIL = 0x5F, - NOUN_LOOK_THROUGH = 0x61, NOUN_MANNEQUINS = 0x62, NOUN_MIRROR = 0x63, NOUN_MUMMY_PROP = 0x64, @@ -202,9 +205,6 @@ enum Noun { 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, diff --git a/engines/mads/phantom/phantom_scenes1.cpp b/engines/mads/phantom/phantom_scenes1.cpp index b4035dc68b..2d991fd3bc 100644 --- a/engines/mads/phantom/phantom_scenes1.cpp +++ b/engines/mads/phantom/phantom_scenes1.cpp @@ -42,6 +42,92 @@ void Scene1xx::sceneEntrySound() { /*------------------------------------------------------------------------*/ +Scene101::Scene101(MADSEngine *vm) : Scene1xx(vm) { + +} + +void Scene101::synchronize(Common::Serializer &s) { + Scene1xx::synchronize(s); + +} + +void Scene101::setup() { + //setPlayerSpritesPrefix(); + setAAName(); +} + +void Scene101::enter() { + // TODO + + if (_globals[kCurrentYear] == 1993) { + _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('z', -1)); + // TODO + //_scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14); + } else { + // TODO + } + + // TODO +} + +void Scene101::step() { + // TODO +} + +void Scene101::preActions() { + if (_action.isAction(VERB_EXIT_TO, NOUN_ORCHESTRA_PIT)) { + // TODO: Handle Brie + _game._player._walkOffScreenSceneId = 102; + } else if (_action.isAction(VERB_EXIT_TO, NOUN_GRAND_FOYER)) { + // TODO: Handle Brie + _game._player._walkOffScreenSceneId = 202; + } else if (_action.isAction(VERB_TAKE, NOUN_MONSIEUR_BRIE)) { + _vm->_dialogs->show(10121); + } else if (_action.isAction(VERB_TALK_TO, NOUN_MONSIEUR_BRIE)) { + if (_globals[kBrieTalkStatus] == 2) + _game._player._needToWalk = false; + } + + // TODO +} + +void Scene101::actions() { + // TODO: Brie conversation + + // TODO: Look around + + if (_action.isAction(VERB_LOOK) || _action.isAction(VERB_LOOK_AT)) { + if (_action.isObject(NOUN_AISLE)) { + _vm->_dialogs->show(10112); + } else if (_action.isObject(NOUN_CHANDELIER)) { + _vm->_dialogs->show(10113); + } else if (_action.isObject(NOUN_BACK_WALL)) { + _vm->_dialogs->show(10114); + } else if (_action.isObject(NOUN_SIDE_WALL)) { + _vm->_dialogs->show(10115); + } else if (_action.isObject(NOUN_SEATS)) { + // TODO: Finish this + _vm->_dialogs->show(10116); + } else if (_action.isObject(NOUN_GRAND_FOYER)) { + _vm->_dialogs->show(10117); + } else if (_action.isObject(NOUN_ORCHESTRA_PIT)) { + _vm->_dialogs->show(10118); + } else if (_action.isObject(NOUN_MONSIEUR_BRIE)) { + _vm->_dialogs->show(10120); + } + + _game._player._stepEnabled = true; + } else if (_action.isAction(VERB_TALK_TO, NOUN_MONSIEUR_BRIE)) { + if (_globals[kBrieTalkStatus] == 2) + _vm->_dialogs->show(10122); + _game._player._stepEnabled = true; + } else if (_action.isAction(VERB_TAKE, NOUN_MONSIEUR_BRIE)) { + _game._player._stepEnabled = true; + } +} + +/*------------------------------------------------------------------------*/ + Scene102::Scene102(MADSEngine *vm) : Scene1xx(vm) { _animRunningFl = false; } @@ -60,22 +146,34 @@ void Scene102::setup() { void Scene102::enter() { _animRunningFl = false; - // TODO: Load sprite series + _globals._spriteIndexes[2] = _scene->_sprites.addSprites(formAnimName('x', 0)); + _globals._spriteIndexes[3] = _scene->_sprites.addSprites("*RAL86"); + + if (_globals[kCurrentYear] == 1993) { + _globals._spriteIndexes[0] = _scene->_sprites.addSprites(formAnimName('z', -1)); + // TODO + //_scene->_sequences.setDepth(_globals._sequenceIndexes[0], 14); + } else { + // TODO + } if (_scene->_priorSceneId == 101) { _game._player._playerPos = Common::Point(97, 79); _game._player._facing = FACING_SOUTHEAST; // TODO + _game._player.walk(Common::Point(83, 87), FACING_SOUTHEAST); + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14); } else if (_scene->_priorSceneId == 104) { // Player fell from pit -> death // TODO } else if (_scene->_priorSceneId == 103 || _scene->_priorSceneId != -1) { _game._player._playerPos = Common::Point(282, 145); _game._player._facing = FACING_WEST; - // TODO: Door closing animation _animRunningFl = true; + // TODO: Door closing animation } else if (_scene->_priorSceneId == -1) { // TODO + _scene->_sequences.setDepth(_globals._sequenceIndexes[2], 14); } sceneEntrySound(); @@ -109,6 +207,8 @@ void Scene102::actions() { if (_animRunningFl) { // TODO } else { + _scene->_nextSceneId = 103; // FIXME: temporary HACK - remove! + switch (_game._trigger) { case 70: // try again case 0: diff --git a/engines/mads/phantom/phantom_scenes1.h b/engines/mads/phantom/phantom_scenes1.h index ef2cdb7aa0..0f5f56a4cf 100644 --- a/engines/mads/phantom/phantom_scenes1.h +++ b/engines/mads/phantom/phantom_scenes1.h @@ -53,6 +53,21 @@ public: Scene1xx(MADSEngine *vm) : PhantomScene(vm) {} }; +class Scene101 : public Scene1xx { +private: + // TODO + +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(); +}; + class Scene102 : public Scene1xx { private: bool _animRunningFl; diff --git a/engines/mads/sound.cpp b/engines/mads/sound.cpp index 7b9388eee3..4a35edb80f 100644 --- a/engines/mads/sound.cpp +++ b/engines/mads/sound.cpp @@ -21,6 +21,7 @@ */ #include "audio/audiostream.h" +#include "audio/fmopl.h" #include "audio/decoders/raw.h" #include "common/memstream.h" #include "mads/sound.h" @@ -39,7 +40,7 @@ SoundManager::SoundManager(MADSEngine *vm, Audio::Mixer *mixer) { _masterVolume = 255; _opl = OPL::Config::create(); - _opl->init(11025); + _opl->init(); // Validate sound files switch (_vm->getGameID()) { diff --git a/engines/mads/sound.h b/engines/mads/sound.h index 16128f8284..9882f65e5a 100644 --- a/engines/mads/sound.h +++ b/engines/mads/sound.h @@ -37,7 +37,7 @@ class SoundManager { private: MADSEngine *_vm; Audio::Mixer *_mixer; - FM_OPL *_opl; + OPL::OPL *_opl; Nebular::ASound *_driver; bool _pollSoundEnabled; bool _soundPollFlag; |