[Scummvm-cvs-logs] SF.net SVN: scummvm:[41797] scummvm/trunk/engines/gob
drmccoy at users.sourceforge.net
drmccoy at users.sourceforge.net
Tue Jun 23 03:23:14 CEST 2009
Revision: 41797
http://scummvm.svn.sourceforge.net/scummvm/?rev=41797&view=rev
Author: drmccoy
Date: 2009-06-23 01:23:14 +0000 (Tue, 23 Jun 2009)
Log Message:
-----------
Replacing the 2 offset functions by a generic Script::getFunctionOffset()
Modified Paths:
--------------
scummvm/trunk/engines/gob/draw.cpp
scummvm/trunk/engines/gob/game_v1.cpp
scummvm/trunk/engines/gob/game_v2.cpp
scummvm/trunk/engines/gob/script.cpp
scummvm/trunk/engines/gob/script.h
Modified: scummvm/trunk/engines/gob/draw.cpp
===================================================================
--- scummvm/trunk/engines/gob/draw.cpp 2009-06-23 01:22:51 UTC (rev 41796)
+++ scummvm/trunk/engines/gob/draw.cpp 2009-06-23 01:23:14 UTC (rev 41797)
@@ -390,8 +390,9 @@
adjustCoords(1, &left, &top);
adjustCoords(1, &right, &bottom);
- if (_vm->_game->_script->getCenterOffset() != 0) {
- _vm->_game->_script->call(_vm->_game->_script->getCenterOffset());
+ uint16 centerOffset = _vm->_game->_script->getFunctionOffset(Script::kFunctionCenter);
+ if (centerOffset != 0) {
+ _vm->_game->_script->call(centerOffset);
WRITE_VAR(17, (uint32) id);
WRITE_VAR(18, (uint32) left);
Modified: scummvm/trunk/engines/gob/game_v1.cpp
===================================================================
--- scummvm/trunk/engines/gob/game_v1.cpp 2009-06-23 01:22:51 UTC (rev 41796)
+++ scummvm/trunk/engines/gob/game_v1.cpp 2009-06-23 01:23:14 UTC (rev 41797)
@@ -164,7 +164,7 @@
if (!_vm->_inter->_variables)
_vm->_inter->allocateVars(_script->getVariablesCount() & 0xFFFF);
- _script->seek(_script->getStartOffset());
+ _script->seek(_script->getFunctionOffset(Script::kFunctionStart));
_vm->_inter->renewTimeInVars();
Modified: scummvm/trunk/engines/gob/game_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/game_v2.cpp 2009-06-23 01:22:51 UTC (rev 41796)
+++ scummvm/trunk/engines/gob/game_v2.cpp 2009-06-23 01:23:14 UTC (rev 41797)
@@ -199,7 +199,7 @@
if (!_vm->_inter->_variables)
_vm->_inter->allocateVars(_script->getVariablesCount() & 0xFFFF);
- _script->seek(_script->getStartOffset());
+ _script->seek(_script->getFunctionOffset(Script::kFunctionStart));
_vm->_inter->renewTimeInVars();
@@ -269,7 +269,7 @@
} else {
_vm->_inter->initControlVars(0);
_vm->_scenery->_pCaptureCounter = oldCaptureCounter;
- _script->seek(READ_LE_UINT16(_script->getData() + (skipPlay << 1) + 0x66));
+ _script->seek(_script->getFunctionOffset(skipPlay + 1));
_menuLevel++;
_vm->_inter->callSub(2);
Modified: scummvm/trunk/engines/gob/script.cpp
===================================================================
--- scummvm/trunk/engines/gob/script.cpp 2009-06-23 01:22:51 UTC (rev 41796)
+++ scummvm/trunk/engines/gob/script.cpp 2009-06-23 01:23:14 UTC (rev 41797)
@@ -422,10 +422,6 @@
_exFileNumber = _totData[60];
_communHandling = _totData[61];
- _startOffset = READ_LE_UINT32(_totData + 100);
-
- _centerOffset = READ_LE_UINT16(_totData + 126);
-
return true;
}
@@ -538,12 +534,14 @@
return _communHandling;
}
-uint32 Script::getStartOffset() const {
- return _startOffset;
-}
+uint16 Script::getFunctionOffset(uint8 function) const {
+ if (!_totData)
+ return 0;
-uint32 Script::getCenterOffset() const {
- return _centerOffset;
+ // Offsets 100-128, 2 bytes per function
+ assert(function <= 13);
+
+ return READ_LE_UINT16(_totData + 100 + function * 2);
}
uint32 Script::getVariablesCount(const char *fileName, GobEngine *vm) {
Modified: scummvm/trunk/engines/gob/script.h
===================================================================
--- scummvm/trunk/engines/gob/script.h 2009-06-23 01:22:51 UTC (rev 41796)
+++ scummvm/trunk/engines/gob/script.h 2009-06-23 01:23:14 UTC (rev 41797)
@@ -36,6 +36,11 @@
class Script {
public:
+ enum Function {
+ kFunctionStart = 0,
+ kFunctionCenter = 13
+ };
+
Script(GobEngine *vm);
~Script();
@@ -126,9 +131,9 @@
uint8 getImFileNumber () const;
uint8 getExFileNumber () const;
uint8 getCommunHandling () const;
- uint32 getStartOffset () const;
- uint32 getCenterOffset () const;
+ uint16 getFunctionOffset (uint8 function) const;
+
static uint32 getVariablesCount(const char *fileName, GobEngine *vm);
private:
@@ -158,8 +163,6 @@
uint8 _imFileNumber;
uint8 _exFileNumber;
uint8 _communHandling;
- uint32 _startOffset;
- uint16 _centerOffset;
Common::Stack<CallEntry> _callStack;
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