diff options
author | Scott Thomas | 2009-03-10 21:54:45 +0000 |
---|---|---|
committer | Scott Thomas | 2009-03-10 21:54:45 +0000 |
commit | 2f61d7d77b1b1784fc4d10ff148fd2fed68ac0b3 (patch) | |
tree | 45406ac2df22bc792ede461dca612d718c7094e3 /engines/groovie | |
parent | e6d0a83bb1544b582ee17bb59fa402bee80c66dd (diff) | |
download | scummvm-rg350-2f61d7d77b1b1784fc4d10ff148fd2fed68ac0b3.tar.gz scummvm-rg350-2f61d7d77b1b1784fc4d10ff148fd2fed68ac0b3.tar.bz2 scummvm-rg350-2f61d7d77b1b1784fc4d10ff148fd2fed68ac0b3.zip |
- Convert some file references from uint16 to uint32 to suit 11H
- Add some 11H opcodes
svn-id: r39313
Diffstat (limited to 'engines/groovie')
-rw-r--r-- | engines/groovie/music.cpp | 8 | ||||
-rw-r--r-- | engines/groovie/music.h | 10 | ||||
-rw-r--r-- | engines/groovie/resource.cpp | 6 | ||||
-rw-r--r-- | engines/groovie/resource.h | 8 | ||||
-rw-r--r-- | engines/groovie/script.cpp | 81 | ||||
-rw-r--r-- | engines/groovie/script.h | 11 |
6 files changed, 98 insertions, 26 deletions
diff --git a/engines/groovie/music.cpp b/engines/groovie/music.cpp index 8ae97b175c..30889deb44 100644 --- a/engines/groovie/music.cpp +++ b/engines/groovie/music.cpp @@ -92,7 +92,7 @@ MusicPlayer::~MusicPlayer() { clearTimbres(); } -void MusicPlayer::playSong(uint16 fileref) { +void MusicPlayer::playSong(uint32 fileref) { Common::StackLock lock(_mutex); _fadingEndVolume = 100; @@ -101,7 +101,7 @@ void MusicPlayer::playSong(uint16 fileref) { play(fileref, false); } -void MusicPlayer::setBackgroundSong(uint16 fileref) { +void MusicPlayer::setBackgroundSong(uint32 fileref) { Common::StackLock lock(_mutex); debugC(1, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: Changing the background song: %04X", fileref); @@ -233,7 +233,7 @@ void MusicPlayer::updateChanVolume(byte channel) { _driver->send(b | (val << 16)); } -bool MusicPlayer::play(uint16 fileref, bool loop) { +bool MusicPlayer::play(uint32 fileref, bool loop) { // Unload the previous song unload(); @@ -245,7 +245,7 @@ bool MusicPlayer::play(uint16 fileref, bool loop) { return load(fileref); } -bool MusicPlayer::load(uint16 fileref) { +bool MusicPlayer::load(uint32 fileref) { debugC(1, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: Starting the playback of song: %04X", fileref); // Open the song resource diff --git a/engines/groovie/music.h b/engines/groovie/music.h index 3315ce1886..92c7afde70 100644 --- a/engines/groovie/music.h +++ b/engines/groovie/music.h @@ -38,8 +38,8 @@ class MusicPlayer : public MidiDriver { public: MusicPlayer(GroovieEngine *vm, const Common::String >lName); ~MusicPlayer(); - void playSong(uint16 fileref); - void setBackgroundSong(uint16 fileref); + void playSong(uint32 fileref); + void setBackgroundSong(uint32 fileref); void playCD(uint8 track); void startBackground(); @@ -102,13 +102,13 @@ private: uint8 _musicType; bool _isPlaying; - uint16 _backgroundFileRef; + uint32 _backgroundFileRef; uint8 _prevCDtrack; static void onTimer(void *data); - bool play(uint16 fileref, bool loop); - bool load(uint16 fileref); + bool play(uint32 fileref, bool loop); + bool load(uint32 fileref); void unload(); }; diff --git a/engines/groovie/resource.cpp b/engines/groovie/resource.cpp index b4ae3ea90c..eda3f0bec0 100644 --- a/engines/groovie/resource.cpp +++ b/engines/groovie/resource.cpp @@ -30,7 +30,7 @@ namespace Groovie { // ResMan -Common::SeekableReadStream *ResMan::open(uint16 fileRef) { +Common::SeekableReadStream *ResMan::open(uint32 fileRef) { // Get the information about the resource ResInfo resInfo; if (!getResInfo(fileRef, resInfo)) { @@ -126,7 +126,7 @@ uint16 ResMan_t7g::getRef(Common::String name, Common::String scriptname) { return (_lastGjd << 10) | (resNum - 1); } -bool ResMan_t7g::getResInfo(uint16 fileRef, ResInfo &resInfo) { +bool ResMan_t7g::getResInfo(uint32 fileRef, ResInfo &resInfo) { // Calculate the GJD and the resource number resInfo.gjd = fileRef >> 10; uint16 resNum = fileRef & 0x3FF; @@ -202,7 +202,7 @@ uint16 ResMan_v2::getRef(Common::String name, Common::String scriptname) { return 0; } -bool ResMan_v2::getResInfo(uint16 fileRef, ResInfo &resInfo) { +bool ResMan_v2::getResInfo(uint32 fileRef, ResInfo &resInfo) { // Open the RL file Common::File rlFile; if (!rlFile.open("dir.rl")) { diff --git a/engines/groovie/resource.h b/engines/groovie/resource.h index 09032a9c50..0cbcd43a89 100644 --- a/engines/groovie/resource.h +++ b/engines/groovie/resource.h @@ -38,12 +38,12 @@ class ResMan { public: virtual ~ResMan() {}; - Common::SeekableReadStream *open(uint16 fileRef); + Common::SeekableReadStream *open(uint32 fileRef); virtual uint16 getRef(Common::String name, Common::String scriptname = "") = 0; protected: Common::Array<Common::String> _gjds; - virtual bool getResInfo(uint16 fileRef, ResInfo &resInfo) = 0; + virtual bool getResInfo(uint32 fileRef, ResInfo &resInfo) = 0; uint16 _lastGjd; }; @@ -54,7 +54,7 @@ public: ~ResMan_t7g() {}; uint16 getRef(Common::String name, Common::String scriptname); - bool getResInfo(uint16 fileRef, ResInfo &resInfo); + bool getResInfo(uint32 fileRef, ResInfo &resInfo); }; class ResMan_v2 : public ResMan { @@ -63,7 +63,7 @@ public: ~ResMan_v2() {}; uint16 getRef(Common::String name, Common::String scriptname); - bool getResInfo(uint16 fileRef, ResInfo &resInfo); + bool getResInfo(uint32 fileRef, ResInfo &resInfo); }; } // End of Groovie namespace diff --git a/engines/groovie/script.cpp b/engines/groovie/script.cpp index 14fcfdb786..fe322c6470 100644 --- a/engines/groovie/script.cpp +++ b/engines/groovie/script.cpp @@ -97,6 +97,8 @@ Script::Script(GroovieEngine *vm, EngineVersion version) : _hotspotRightAction = 0; _hotspotLeftAction = 0; _hotspotSlot = (uint16)-1; + + _oldInstruction = (uint16)-1; } Script::~Script() { @@ -207,7 +209,13 @@ void Script::step() { // Show the opcode debug string sprintf(debugstring, "op 0x%02X: ", opcode); _debugString += debugstring; - debugScript(1, false, _debugString.c_str()); + + // Only output if we're not re-doing the previous instruction + if (_currentInstruction != _oldInstruction) { + debugScript(1, false, _debugString.c_str()); + + _oldInstruction = _currentInstruction; + } // Detect invalid opcodes if (opcode >= NUM_OPCODES) { @@ -512,7 +520,7 @@ void Script::o_videofromref() { // 0x09 } } -bool Script::playvideofromref(uint16 fileref) { +bool Script::playvideofromref(uint32 fileref) { // It isn't the current video, open it if (fileref != _videoRef) { @@ -1525,6 +1533,63 @@ void Script::o_stub59() { debugScript(1, true, "STUB59: 0x%04X 0x%02X", val1, val2); } +void Script::o2_playsong(){ + uint32 fileref = readScript32bits(); + debugScript(1, true, "PlaySong(0x%08X): Play xmidi file", fileref); + _vm->_musicPlayer->playSong(fileref); + +} + +void Script::o2_setbackgroundsong(){ + uint32 fileref = readScript32bits(); + debugScript(1, true, "SetBackgroundSong(0x%08X)", fileref); + _vm->_musicPlayer->setBackgroundSong(fileref); +} + +void Script::o2_videofromref(){ + uint32 fileref = readScript32bits(); + + // Show the debug information just when starting the playback + if (fileref != _videoRef) { + debugScript(1, true, "VIDEOFROMREF(0x%08X) (Not fully imp): Play video file from ref", fileref); + debugC(5, kGroovieDebugVideo | kGroovieDebugAll, "Playing video 0x%08X via 0x09", fileref); + } + // Play the video + if (!playvideofromref(fileref)) { + // Move _currentInstruction back + _currentInstruction -= 5; + } +} + +void Script::o2_vdxtransition(){ + uint32 fileref = readScript32bits(); + + // Show the debug information just when starting the playback + if (fileref != _videoRef) { + debugScript(1, true, "VDX transition fileref = 0x%08X", fileref); + debugC(1, kGroovieDebugVideo | kGroovieDebugAll, "Playing video 0x%08X with transition", fileref); + } + + // Set bit 1 + _bitflags |= 1 << 1; + + // Set bit 2 if _firstbit + if (_firstbit) { + _bitflags |= 1 << 2; + } + + // Play the video + if (!playvideofromref(fileref)) { + // Move _currentInstruction back + _currentInstruction -= 5; + } +} + +void Script::o2_stub52(){ + uint8 arg = readScript8bits(); + debugScript(1, true, "STUB52 (0x%02X)", arg); +} + Script::OpcodeFunc Script::_opcodesT7G[NUM_OPCODES] = { &Script::o_nop, // 0x00 &Script::o_nop, @@ -1622,16 +1687,16 @@ Script::OpcodeFunc Script::_opcodesT7G[NUM_OPCODES] = { }; Script::OpcodeFunc Script::_opcodesV2[NUM_OPCODES] = { - &Script::o_nop, // 0x00 + &Script::o_invalid, // 0x00 &Script::o_nop, - &Script::o_playsong, + &Script::o2_playsong, &Script::o_bf9on, &Script::o_palfadeout, // 0x04 &Script::o_bf8on, &Script::o_bf6on, &Script::o_bf7on, - &Script::o_setbackgroundsong, // 0x08 - &Script::o_videofromref, + &Script::o2_setbackgroundsong, // 0x08 + &Script::o2_videofromref, &Script::o_bf5on, &Script::o_inputloopstart, &Script::o_keyboardaction, // 0x0C @@ -1650,7 +1715,7 @@ Script::OpcodeFunc Script::_opcodesV2[NUM_OPCODES] = { &Script::o_sleep, &Script::o_strcmpnejmp, &Script::o_xor_obfuscate, - &Script::o_vdxtransition, // 0x1C + &Script::o2_vdxtransition, // 0x1C &Script::o_swap, &Script::o_nop8, &Script::o_inc, @@ -1704,7 +1769,7 @@ Script::OpcodeFunc Script::_opcodesV2[NUM_OPCODES] = { &Script::o_nop16, &Script::o_nop16, // 0x50 &Script::o_nop16, - &Script::o_invalid, + &Script::o2_stub52, &Script::o_hotspot_outrect, &Script::o_nop, // 0x54 &Script::o_nop16, diff --git a/engines/groovie/script.h b/engines/groovie/script.h index 14b0ef88fd..664cac82d8 100644 --- a/engines/groovie/script.h +++ b/engines/groovie/script.h @@ -112,12 +112,13 @@ private: // Video Font *_font; Common::SeekableReadStream *_videoFile; - uint16 _videoRef; + uint32 _videoRef; uint16 _bitflags; // Debugging Debugger *_debugger; Common::String _debugString; + uint16 _oldInstruction; // Helper functions uint8 getCodeByte(uint16 address); @@ -133,7 +134,7 @@ private: void loadgame(uint slot); void savegame(uint slot); - bool playvideofromref(uint16 fileref); + bool playvideofromref(uint32 fileref); // Opcodes typedef void (Script::*OpcodeFunc)(); @@ -218,6 +219,12 @@ private: void o_hotspot_outrect(); void o_stub56(); void o_stub59(); + + void o2_playsong(); + void o2_setbackgroundsong(); + void o2_videofromref(); + void o2_vdxtransition(); + void o2_stub52(); }; } // End of Groovie namespace |