[Scummvm-cvs-logs] SF.net SVN: scummvm:[41928] scummvm/branches/gsoc2009-draci/engines/draci
dkasak13 at users.sourceforge.net
dkasak13 at users.sourceforge.net
Sun Jun 28 18:28:16 CEST 2009
Revision: 41928
http://scummvm.svn.sourceforge.net/scummvm/?rev=41928&view=rev
Author: dkasak13
Date: 2009-06-28 16:28:16 +0000 (Sun, 28 Jun 2009)
Log Message:
-----------
Added an offset parameter to Script::run() so we can specify where to start the GPL program execution. Also, the init script for the dragon object is now run inside Game::Game().
Modified Paths:
--------------
scummvm/branches/gsoc2009-draci/engines/draci/game.cpp
scummvm/branches/gsoc2009-draci/engines/draci/script.cpp
scummvm/branches/gsoc2009-draci/engines/draci/script.h
Modified: scummvm/branches/gsoc2009-draci/engines/draci/game.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/game.cpp 2009-06-28 16:19:10 UTC (rev 41927)
+++ scummvm/branches/gsoc2009-draci/engines/draci/game.cpp 2009-06-28 16:28:16 UTC (rev 41928)
@@ -123,6 +123,7 @@
// assert(curOffset == _info->_numDialogBlocks);
loadObject(0, &_heroObj);
+ _vm->_script->run(_heroObj._program, _heroObj._init);
}
void Game::loadObject(uint16 objNum, GameObject *obj) {
Modified: scummvm/branches/gsoc2009-draci/engines/draci/script.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/script.cpp 2009-06-28 16:19:10 UTC (rev 41927)
+++ scummvm/branches/gsoc2009-draci/engines/draci/script.cpp 2009-06-28 16:28:16 UTC (rev 41928)
@@ -247,6 +247,7 @@
/**
* @brief GPL2 bytecode disassembler
* @param program GPL program in the form of a GPL2Program struct
+ * offset Offset into the program where execution should begin
*
* GPL2 is short for Game Programming Language 2 which is the script language
* used by Draci Historie. This is a simple disassembler for the language.
@@ -274,9 +275,17 @@
* value comes from.
*/
-int Script::run(GPL2Program program) {
+int Script::run(GPL2Program program, uint16 offset) {
Common::MemoryReadStream reader(program._bytecode, program._length);
+ // Offset is given as number of 16-bit integers so we need to convert
+ // it to a number of bytes
+ offset -= 1;
+ offset *= 2;
+
+ // Seek to the requested part of the program
+ reader.seek(offset);
+
GPL2Command *cmd;
do {
// read in command pair
Modified: scummvm/branches/gsoc2009-draci/engines/draci/script.h
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/script.h 2009-06-28 16:19:10 UTC (rev 41927)
+++ scummvm/branches/gsoc2009-draci/engines/draci/script.h 2009-06-28 16:28:16 UTC (rev 41928)
@@ -65,7 +65,7 @@
class Script {
public:
- int run(GPL2Program program);
+ int run(GPL2Program program, uint16 offset);
private:
GPL2Command *findCommand(byte num, byte subnum);
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