[Scummvm-cvs-logs] SF.net SVN: scummvm:[39313] scummvm/trunk/engines/groovie

scott_t at users.sourceforge.net scott_t at users.sourceforge.net
Tue Mar 10 22:54:45 CET 2009


Revision: 39313
          http://scummvm.svn.sourceforge.net/scummvm/?rev=39313&view=rev
Author:   scott_t
Date:     2009-03-10 21:54:45 +0000 (Tue, 10 Mar 2009)

Log Message:
-----------
- Convert some file references from uint16 to uint32 to suit 11H
- Add some 11H opcodes

Modified Paths:
--------------
    scummvm/trunk/engines/groovie/music.cpp
    scummvm/trunk/engines/groovie/music.h
    scummvm/trunk/engines/groovie/resource.cpp
    scummvm/trunk/engines/groovie/resource.h
    scummvm/trunk/engines/groovie/script.cpp
    scummvm/trunk/engines/groovie/script.h

Modified: scummvm/trunk/engines/groovie/music.cpp
===================================================================
--- scummvm/trunk/engines/groovie/music.cpp	2009-03-10 21:47:53 UTC (rev 39312)
+++ scummvm/trunk/engines/groovie/music.cpp	2009-03-10 21:54:45 UTC (rev 39313)
@@ -92,7 +92,7 @@
 	clearTimbres();
 }
 
-void MusicPlayer::playSong(uint16 fileref) {
+void MusicPlayer::playSong(uint32 fileref) {
 	Common::StackLock lock(_mutex);
 
 	_fadingEndVolume = 100;
@@ -101,7 +101,7 @@
 	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 @@
 	_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 @@
 	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

Modified: scummvm/trunk/engines/groovie/music.h
===================================================================
--- scummvm/trunk/engines/groovie/music.h	2009-03-10 21:47:53 UTC (rev 39312)
+++ scummvm/trunk/engines/groovie/music.h	2009-03-10 21:54:45 UTC (rev 39313)
@@ -38,8 +38,8 @@
 public:
 	MusicPlayer(GroovieEngine *vm, const Common::String &gtlName);
 	~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 @@
 	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();
 };
 

Modified: scummvm/trunk/engines/groovie/resource.cpp
===================================================================
--- scummvm/trunk/engines/groovie/resource.cpp	2009-03-10 21:47:53 UTC (rev 39312)
+++ scummvm/trunk/engines/groovie/resource.cpp	2009-03-10 21:54:45 UTC (rev 39313)
@@ -30,7 +30,7 @@
 
 // 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 @@
 	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 @@
 	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")) {

Modified: scummvm/trunk/engines/groovie/resource.h
===================================================================
--- scummvm/trunk/engines/groovie/resource.h	2009-03-10 21:47:53 UTC (rev 39312)
+++ scummvm/trunk/engines/groovie/resource.h	2009-03-10 21:54:45 UTC (rev 39313)
@@ -38,12 +38,12 @@
 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 @@
 	~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 @@
 	~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

Modified: scummvm/trunk/engines/groovie/script.cpp
===================================================================
--- scummvm/trunk/engines/groovie/script.cpp	2009-03-10 21:47:53 UTC (rev 39312)
+++ scummvm/trunk/engines/groovie/script.cpp	2009-03-10 21:54:45 UTC (rev 39313)
@@ -97,6 +97,8 @@
 	_hotspotRightAction = 0;
 	_hotspotLeftAction = 0;
 	_hotspotSlot = (uint16)-1;
+
+	_oldInstruction = (uint16)-1;
 }
 
 Script::~Script() {
@@ -207,8 +209,14 @@
 	// 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) {
 		o_invalid();
@@ -512,7 +520,7 @@
 	}
 }
 
-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 @@
 	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::_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::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::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,

Modified: scummvm/trunk/engines/groovie/script.h
===================================================================
--- scummvm/trunk/engines/groovie/script.h	2009-03-10 21:47:53 UTC (rev 39312)
+++ scummvm/trunk/engines/groovie/script.h	2009-03-10 21:54:45 UTC (rev 39313)
@@ -112,12 +112,13 @@
 	// 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 @@
 
 	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 @@
 	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


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list