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

jvprat at users.sourceforge.net jvprat at users.sourceforge.net
Tue Mar 10 01:19:45 CET 2009


Revision: 39282
          http://scummvm.svn.sourceforge.net/scummvm/?rev=39282&view=rev
Author:   jvprat
Date:     2009-03-10 00:19:44 +0000 (Tue, 10 Mar 2009)

Log Message:
-----------
Groovie: Initial support for different opcode sets

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

Modified: scummvm/trunk/engines/groovie/groovie.cpp
===================================================================
--- scummvm/trunk/engines/groovie/groovie.cpp	2009-03-09 23:08:44 UTC (rev 39281)
+++ scummvm/trunk/engines/groovie/groovie.cpp	2009-03-10 00:19:44 UTC (rev 39282)
@@ -35,7 +35,7 @@
 namespace Groovie {
 
 GroovieEngine::GroovieEngine(OSystem *syst, const GroovieGameDescription *gd) :
-	Engine(syst), _gameDescription(gd), _debugger(NULL), _script(this),
+	Engine(syst), _gameDescription(gd), _debugger(NULL), _script(this, gd->version),
 	_resMan(NULL), _grvCursorMan(NULL), _videoPlayer(NULL), _musicPlayer(NULL),
 	_graphicsMan(NULL), _waitingForInput(false) {
 

Modified: scummvm/trunk/engines/groovie/groovie.h
===================================================================
--- scummvm/trunk/engines/groovie/groovie.h	2009-03-09 23:08:44 UTC (rev 39281)
+++ scummvm/trunk/engines/groovie/groovie.h	2009-03-10 00:19:44 UTC (rev 39282)
@@ -41,7 +41,7 @@
 
 class MusicPlayer;
 
-enum kDebugLevels {
+enum DebugLevels {
 	kGroovieDebugAll = 1 << 0,
 	kGroovieDebugVideo = 1 << 1,
 	kGroovieDebugResource = 1 << 2,
@@ -56,15 +56,10 @@
 		// the current limitation is 32 debug levels (1 << 31 is the last one)
 };
 
-enum kEngineVersion {
-	kGroovieT7G,
-	kGroovieV2
-};
-
 struct GroovieGameDescription {
 	ADGameDescription desc;
 
-	kEngineVersion version; // Version of the engine
+	EngineVersion version; // Version of the engine
 	int indexEntry; // The index of the entry in disk.1 for V2 games
 };
 

Modified: scummvm/trunk/engines/groovie/script.cpp
===================================================================
--- scummvm/trunk/engines/groovie/script.cpp	2009-03-09 23:08:44 UTC (rev 39281)
+++ scummvm/trunk/engines/groovie/script.cpp	2009-03-10 00:19:44 UTC (rev 39282)
@@ -56,10 +56,20 @@
 		debugN(level, "%s", buf);
 }
 
-Script::Script(GroovieEngine *vm) :
+Script::Script(GroovieEngine *vm, EngineVersion version) :
 	_code(NULL), _savedCode(NULL), _stacktop(0),
 	_debugger(NULL), _vm(vm),
 	_videoFile(NULL), _videoRef(0), _font(NULL) {
+	// Initialize the opcode set depending on the engine version
+	switch (version) {
+	case kGroovieT7G:
+		_opcodes = _opcodesT7G;
+		break;
+	case kGroovieV2:
+		_opcodes = _opcodesV2;
+		break;
+	}
+
 	// Initialize the random source
 	_vm->_system->getEventManager()->registerRandomSource(_random, "GroovieScripts");
 
@@ -1515,7 +1525,7 @@
 	debugScript(1, true, "STUB59: 0x%04X 0x%02X", val1, val2);
 }
 
-Script::OpcodeFunc Script::_opcodes[NUM_OPCODES] = {
+Script::OpcodeFunc Script::_opcodesT7G[NUM_OPCODES] = {
 	&Script::o_nop, // 0x00
 	&Script::o_nop,
 	&Script::o_playsong,
@@ -1611,4 +1621,97 @@
 	&Script::o_stub59
 };
 
+Script::OpcodeFunc Script::_opcodesV2[NUM_OPCODES] = {
+	&Script::o_nop, // 0x00
+	&Script::o_nop,
+	&Script::o_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::o_bf5on,
+	&Script::o_inputloopstart,
+	&Script::o_keyboardaction, // 0x0C
+	&Script::o_hotspot_rect,
+	&Script::o_hotspot_left,
+	&Script::o_hotspot_right,
+	&Script::o_hotspot_center, // 0x10
+	&Script::o_hotspot_center,
+	&Script::o_hotspot_current,
+	&Script::o_inputloopend,
+	&Script::o_random, // 0x14
+	&Script::o_jmp,
+	&Script::o_loadstring,
+	&Script::o_ret,
+	&Script::o_call, // 0x18
+	&Script::o_sleep,
+	&Script::o_strcmpnejmp,
+	&Script::o_xor_obfuscate,
+	&Script::o_vdxtransition, // 0x1C
+	&Script::o_swap,
+	&Script::o_nop8,
+	&Script::o_inc,
+	&Script::o_dec, // 0x20
+	&Script::o_strcmpnejmp_var,
+	&Script::o_copybgtofg,
+	&Script::o_strcmpeqjmp,
+	&Script::o_mov, // 0x24
+	&Script::o_add,
+	&Script::o_videofromstring1,
+	&Script::o_videofromstring2,
+	&Script::o_nop16, // 0x28
+	&Script::o_stopmidi,
+	&Script::o_endscript,
+	&Script::o_nop,
+	&Script::o_sethotspottop, // 0x2C
+	&Script::o_sethotspotbottom,
+	&Script::o_loadgame,
+	&Script::o_savegame,
+	&Script::o_hotspotbottom_4, // 0x30
+	&Script::o_midivolume,
+	&Script::o_jne,
+	&Script::o_loadstringvar,
+	&Script::o_chargreatjmp, // 0x34
+	&Script::o_bf7off,
+	&Script::o_charlessjmp,
+	&Script::o_copyrecttobg,
+	&Script::o_restorestkpnt, // 0x38
+	&Script::o_obscureswap,
+	&Script::o_printstring,
+	&Script::o_hotspot_slot,
+	&Script::o_checkvalidsaves, // 0x3C
+	&Script::o_resetvars,
+	&Script::o_mod,
+	&Script::o_loadscript,
+	&Script::o_setvideoorigin, // 0x40
+	&Script::o_sub,
+	&Script::o_cellmove,
+	&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_nop16,
+	&Script::o_nop8,
+	&Script::o_getcd, // 0x4C
+	&Script::o_playcd,
+	&Script::o_nop16,
+	&Script::o_nop16,
+	&Script::o_nop16, // 0x50
+	&Script::o_nop16,
+	&Script::o_invalid,
+	&Script::o_hotspot_outrect,
+	&Script::o_nop, // 0x54
+	&Script::o_nop16,
+	&Script::o_stub56,
+	&Script::o_invalid,
+	&Script::o_invalid, // 0x58
+	&Script::o_stub59
+};
+
 } // End of Groovie namespace

Modified: scummvm/trunk/engines/groovie/script.h
===================================================================
--- scummvm/trunk/engines/groovie/script.h	2009-03-09 23:08:44 UTC (rev 39281)
+++ scummvm/trunk/engines/groovie/script.h	2009-03-10 00:19:44 UTC (rev 39282)
@@ -34,13 +34,18 @@
 
 namespace Groovie {
 
+enum EngineVersion {
+	kGroovieT7G,
+	kGroovieV2
+};
+
 class GroovieEngine;
 
 class Script {
 	friend class Debugger;
 
 public:
-	Script(GroovieEngine *vm);
+	Script(GroovieEngine *vm, EngineVersion version);
 	~Script();
 
 	void setDebugger(Debugger *debugger);
@@ -132,7 +137,9 @@
 
 	// Opcodes
 	typedef void (Script::*OpcodeFunc)();
-	static OpcodeFunc _opcodes[];
+	OpcodeFunc *_opcodes;
+	static OpcodeFunc _opcodesT7G[];
+	static OpcodeFunc _opcodesV2[];
 
 	void o_invalid();
 


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