[Scummvm-cvs-logs] SF.net SVN: scummvm:[42213] scummvm/branches/gsoc2009-16bit/engines/groovie

jvprat at users.sourceforge.net jvprat at users.sourceforge.net
Tue Jul 7 13:18:40 CEST 2009


Revision: 42213
          http://scummvm.svn.sourceforge.net/scummvm/?rev=42213&view=rev
Author:   jvprat
Date:     2009-07-07 11:18:40 +0000 (Tue, 07 Jul 2009)

Log Message:
-----------
Groovie: Added video skipping functionality in 11h, verified some opcode usage in v2 and some bits of formatting

Modified Paths:
--------------
    scummvm/branches/gsoc2009-16bit/engines/groovie/groovie.cpp
    scummvm/branches/gsoc2009-16bit/engines/groovie/script.cpp
    scummvm/branches/gsoc2009-16bit/engines/groovie/script.h

Modified: scummvm/branches/gsoc2009-16bit/engines/groovie/groovie.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/groovie/groovie.cpp	2009-07-07 11:14:18 UTC (rev 42212)
+++ scummvm/branches/gsoc2009-16bit/engines/groovie/groovie.cpp	2009-07-07 11:18:40 UTC (rev 42213)
@@ -218,13 +218,18 @@
 
 			case Common::EVENT_LBUTTONDOWN:
 				// Send the event to the scripts
-				_script.setMouseClick();
+				_script.setMouseClick(1);
 
 				// Continue the script execution to handle
 				// the click
 				_waitingForInput = false;
 				break;
 
+			case Common::EVENT_RBUTTONDOWN:
+				// Send the event to the scripts (to skip the video)
+				_script.setMouseClick(2);
+				break;
+
 			case Common::EVENT_QUIT:
 				quitGame();
 				break;

Modified: scummvm/branches/gsoc2009-16bit/engines/groovie/script.cpp
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/groovie/script.cpp	2009-07-07 11:14:18 UTC (rev 42212)
+++ scummvm/branches/gsoc2009-16bit/engines/groovie/script.cpp	2009-07-07 11:18:40 UTC (rev 42213)
@@ -101,6 +101,7 @@
 	_hotspotSlot = (uint16)-1;
 
 	_oldInstruction = (uint16)-1;
+	_videoSkipAddress = 0;
 }
 
 Script::~Script() {
@@ -230,8 +231,8 @@
 	(this->*op)();
 }
 
-void Script::setMouseClick() {
-	_eventMouseClicked = true;
+void Script::setMouseClick(uint8 button) {
+	_eventMouseClicked = button;
 }
 
 void Script::setKbdChar(uint8 c) {
@@ -525,7 +526,6 @@
 bool Script::playvideofromref(uint32 fileref) {
 	// It isn't the current video, open it
 	if (fileref != _videoRef) {
-
 		// Debug bitflags
 		debugScript(1, false, "Play video 0x%04X (bitflags:", fileref);
 		for (int i = 15; i >= 0; i--) {
@@ -554,8 +554,23 @@
 		}
 
 		_bitflags = 0;
+
+		// Reset the clicked mouse events
+		_eventMouseClicked = 0;
 	}
 
+	// Check if the user wants to skip the video
+	if ((_eventMouseClicked == 2) && (_videoSkipAddress != 0)) {
+		// Jump to the given address
+		_currentInstruction = _videoSkipAddress;
+
+		// Reset the skip address
+		_videoSkipAddress = 0;
+
+		// End the playback
+		return true;
+	}
+
 	// Video available, play one frame
 	if (_videoFile) {
 		bool endVideo = _vm->_videoPlayer->playFrame();
@@ -567,7 +582,7 @@
 			_videoRef = 0;
 
 			// Clear the input events while playing the video
-			_eventMouseClicked = false;
+			_eventMouseClicked = 0;
 			_eventKbdChar = 0;
 
 			// Newline
@@ -598,8 +613,8 @@
 	_inputLoopAddress = _currentInstruction - 1;
 
 	// Save the current mouse state for the whole loop
-	_mouseClicked = _eventMouseClicked;
-	_eventMouseClicked = false;
+	_mouseClicked = (_eventMouseClicked == 1);
+	_eventMouseClicked = 0;
 
 	// Save the current pressed character for the whole loop
 	_kbdChar = _eventKbdChar;
@@ -1378,7 +1393,7 @@
 void Script::o_cellmove() {
 	uint16 arg = readScript8bits();
 	byte *scriptBoard = &_variables[0x19];
-	byte *board = (byte*) malloc (BOARDSIZE * BOARDSIZE * sizeof(byte));
+	byte *board = (byte *) malloc (BOARDSIZE * BOARDSIZE * sizeof(byte));
 	byte startX, startY, endX, endY;
 
 	debugScript(1, true, "CELL MOVE var[0x%02X]", arg);
@@ -1396,14 +1411,13 @@
 		debugScript(1, false, "\n");
 	}
 
-	CellGame staufsMove((byte*) board);
-	staufsMove.calcMove((byte*) board, CELL_GREEN, 2);
+	CellGame staufsMove((byte *) board);
+	staufsMove.calcMove((byte *) board, CELL_GREEN, 2);
 	startX = staufsMove.getStartX();
 	startY = staufsMove.getStartY();
 	endX = staufsMove.getEndX();
 	endY = staufsMove.getEndY();
 
-
 	// Set the movement origin
 	setVariable(0, startY); // y
 	setVariable(1, startX); // x
@@ -1411,7 +1425,7 @@
 	setVariable(2, endY);
 	setVariable(3, endX);
 
-	free (board);
+	free(board);
 }
 
 void Script::o_returnscript() {
@@ -1535,20 +1549,19 @@
 	debugScript(1, true, "STUB59: 0x%04X 0x%02X", val1, val2);
 }
 
-void Script::o2_playsong(){
+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(){
+void Script::o2_setbackgroundsong() {
 	uint32 fileref = readScript32bits();
 	debugScript(1, true, "SetBackgroundSong(0x%08X)", fileref);
 	_vm->_musicPlayer->setBackgroundSong(fileref);
 }
 
-void Script::o2_videofromref(){
+void Script::o2_videofromref() {
 	uint32 fileref = readScript32bits();
 
 	// Show the debug information just when starting the playback
@@ -1556,6 +1569,7 @@
 		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
@@ -1563,7 +1577,7 @@
 	}
 }
 
-void Script::o2_vdxtransition(){
+void Script::o2_vdxtransition() {
 	uint32 fileref = readScript32bits();
 
 	// Show the debug information just when starting the playback
@@ -1587,11 +1601,21 @@
 	}
 }
 
-void Script::o2_stub52(){
+void Script::o2_setvideoskip() {
+	_videoSkipAddress = readScript16bits();
+	debugScript(1, true, "SetVideoSkip (0x%04X)", _videoSkipAddress);
+}
+
+void Script::o2_stub52() {
 	uint8 arg = readScript8bits();
 	debugScript(1, true, "STUB52 (0x%02X)", arg);
 }
 
+void Script::o2_setscriptend() {
+	uint16 arg = readScript16bits();
+	debugScript(1, true, "SetScriptEnd (0x%04X)", arg);
+}
+
 Script::OpcodeFunc Script::_opcodesT7G[NUM_OPCODES] = {
 	&Script::o_nop, // 0x00
 	&Script::o_nop,
@@ -1692,11 +1716,11 @@
 	&Script::o_invalid, // 0x00
 	&Script::o_nop,
 	&Script::o2_playsong,
-	&Script::o_bf9on,
-	&Script::o_palfadeout, // 0x04
-	&Script::o_bf8on,
-	&Script::o_bf6on,
-	&Script::o_bf7on,
+	&Script::o_nop,
+	&Script::o_nop, // 0x04
+	&Script::o_nop,
+	&Script::o_nop,
+	&Script::o_nop,
 	&Script::o2_setbackgroundsong, // 0x08
 	&Script::o2_videofromref,
 	&Script::o_bf5on,
@@ -1719,7 +1743,7 @@
 	&Script::o_xor_obfuscate,
 	&Script::o2_vdxtransition, // 0x1C
 	&Script::o_swap,
-	&Script::o_nop8,
+	&Script::o_invalid,
 	&Script::o_inc,
 	&Script::o_dec, // 0x20
 	&Script::o_strcmpnejmp_var,
@@ -1729,10 +1753,10 @@
 	&Script::o_add,
 	&Script::o_videofromstring1,
 	&Script::o_videofromstring2,
-	&Script::o_nop16, // 0x28
-	&Script::o_stopmidi,
+	&Script::o_invalid, // 0x28
+	&Script::o_nop,
 	&Script::o_endscript,
-	&Script::o_nop,
+	&Script::o_invalid,
 	&Script::o_sethotspottop, // 0x2C
 	&Script::o_sethotspotbottom,
 	&Script::o_loadgame,
@@ -1759,22 +1783,22 @@
 	&Script::o_returnscript,
 	&Script::o_sethotspotright, // 0x44
 	&Script::o_sethotspotleft,
-	&Script::o_nop,
-	&Script::o_nop,
-	&Script::o_nop8, // 0x48
-	&Script::o_nop,
+	&Script::o_invalid,
+	&Script::o_invalid,
+	&Script::o_invalid, // 0x48
+	&Script::o_invalid,
 	&Script::o_nop16,
-	&Script::o_nop8,
-	&Script::o_getcd, // 0x4C
-	&Script::o_playcd,
+	&Script::o_invalid,
+	&Script::o_invalid, // 0x4C
+	&Script::o_invalid,
+	&Script::o_invalid,
 	&Script::o_nop16,
-	&Script::o_nop16,
 	&Script::o_nop16, // 0x50
-	&Script::o_nop16,
+	&Script::o2_setvideoskip,
 	&Script::o2_stub52,
 	&Script::o_hotspot_outrect,
-	&Script::o_nop, // 0x54
-	&Script::o_nop16,
+	&Script::o_invalid, // 0x54
+	&Script::o2_setscriptend,
 	&Script::o_stub56,
 	&Script::o_invalid,
 	&Script::o_invalid, // 0x58

Modified: scummvm/branches/gsoc2009-16bit/engines/groovie/script.h
===================================================================
--- scummvm/branches/gsoc2009-16bit/engines/groovie/script.h	2009-07-07 11:14:18 UTC (rev 42212)
+++ scummvm/branches/gsoc2009-16bit/engines/groovie/script.h	2009-07-07 11:18:40 UTC (rev 42213)
@@ -57,7 +57,7 @@
 	void directGameLoad(int slot);
 	void step();
 
-	void setMouseClick();
+	void setMouseClick(uint8 button);
 	void setKbdChar(uint8 c);
 
 	Common::String &getContext();
@@ -95,7 +95,7 @@
 
 	// Input
 	bool _mouseClicked;
-	bool _eventMouseClicked;
+	uint8 _eventMouseClicked;
 	uint8 _kbdChar;
 	uint8 _eventKbdChar;
 	uint16 _inputLoopAddress;
@@ -114,6 +114,7 @@
 	Common::SeekableReadStream *_videoFile;
 	uint32 _videoRef;
 	uint16 _bitflags;
+	uint16 _videoSkipAddress;
 
 	// Debugging
 	Debugger *_debugger;
@@ -224,7 +225,9 @@
 	void o2_setbackgroundsong();
 	void o2_videofromref();
 	void o2_vdxtransition();
+	void o2_setvideoskip();
 	void o2_stub52();
+	void o2_setscriptend();
 };
 
 } // 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