[Scummvm-cvs-logs] SF.net SVN: scummvm:[41791] scummvm/trunk/engines/gob
drmccoy at users.sourceforge.net
drmccoy at users.sourceforge.net
Tue Jun 23 03:20:05 CEST 2009
Revision: 41791
http://scummvm.svn.sourceforge.net/scummvm/?rev=41791&view=rev
Author: drmccoy
Date: 2009-06-23 01:20:05 +0000 (Tue, 23 Jun 2009)
Log Message:
-----------
Added a method to query the number of variables needed by a Script
Modified Paths:
--------------
scummvm/trunk/engines/gob/game_v1.cpp
scummvm/trunk/engines/gob/game_v2.cpp
scummvm/trunk/engines/gob/init.cpp
scummvm/trunk/engines/gob/inter_v2.cpp
scummvm/trunk/engines/gob/script.cpp
scummvm/trunk/engines/gob/script.h
Modified: scummvm/trunk/engines/gob/game_v1.cpp
===================================================================
--- scummvm/trunk/engines/gob/game_v1.cpp 2009-06-23 01:19:37 UTC (rev 41790)
+++ scummvm/trunk/engines/gob/game_v1.cpp 2009-06-23 01:20:05 UTC (rev 41791)
@@ -49,7 +49,6 @@
int16 _captureCounter;
int16 breakFrom;
int16 nestLevel;
- int32 variablesCount;
int16 *oldNestLevel = _vm->_inter->_nestLevel;
int16 *oldBreakFrom = _vm->_inter->_breakFromLevel;
@@ -169,7 +168,7 @@
_vm->_global->_inter_animDataSize =
READ_LE_UINT16(_script->getData() + 0x38);
if (!_vm->_inter->_variables)
- _vm->_inter->allocateVars(READ_LE_UINT16(_script->getData() + 0x2C));
+ _vm->_inter->allocateVars(_script->getVariablesCount() & 0xFFFF);
_script->seek(READ_LE_UINT32(_script->getData() + 0x64));
@@ -186,7 +185,6 @@
if (_totToLoad[0] != 0)
_vm->_inter->_terminate = 0;
- variablesCount = READ_LE_UINT32(_script->getData() + 0x2C);
_vm->_draw->blitInvalidated();
_script->unload();
Modified: scummvm/trunk/engines/gob/game_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/game_v2.cpp 2009-06-23 01:19:37 UTC (rev 41790)
+++ scummvm/trunk/engines/gob/game_v2.cpp 2009-06-23 01:20:05 UTC (rev 41791)
@@ -205,7 +205,7 @@
_vm->_global->_inter_animDataSize =
READ_LE_UINT16(_script->getData() + 0x38);
if (!_vm->_inter->_variables)
- _vm->_inter->allocateVars(READ_LE_UINT16(_script->getData() + 0x2C));
+ _vm->_inter->allocateVars(_script->getVariablesCount() & 0xFFFF);
_script->seek(READ_LE_UINT16(_script->getData() + 0x64));
Modified: scummvm/trunk/engines/gob/init.cpp
===================================================================
--- scummvm/trunk/engines/gob/init.cpp 2009-06-23 01:19:37 UTC (rev 41790)
+++ scummvm/trunk/engines/gob/init.cpp 2009-06-23 01:20:05 UTC (rev 41791)
@@ -32,6 +32,7 @@
#include "gob/dataio.h"
#include "gob/draw.h"
#include "gob/game.h"
+#include "gob/script.h"
#include "gob/palanim.h"
#include "gob/inter.h"
#include "gob/video.h"
@@ -152,13 +153,8 @@
}
if (_vm->_dataIO->existData(_vm->_startTot.c_str())) {
- DataStream *stream = _vm->_dataIO->getDataStream(_vm->_startTot.c_str());
+ _vm->_inter->allocateVars(Script::getVariablesCount(_vm->_startTot.c_str(), _vm));
- stream->seek(0x2C);
- _vm->_inter->allocateVars(stream->readUint16LE());
-
- delete stream;
-
strcpy(_vm->_game->_curTotFile, _vm->_startTot.c_str());
_vm->_sound->cdTest(1, "GOB");
@@ -181,7 +177,7 @@
_vm->_draw->initScreen();
_vm->_util->clearPalette();
- stream = _vm->_dataIO->getDataStream("coktel.clt");
+ DataStream *stream = _vm->_dataIO->getDataStream("coktel.clt");
stream->read((byte *) _vm->_draw->_vgaPalette, 768);
delete stream;
Modified: scummvm/trunk/engines/gob/inter_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v2.cpp 2009-06-23 01:19:37 UTC (rev 41790)
+++ scummvm/trunk/engines/gob/inter_v2.cpp 2009-06-23 01:20:05 UTC (rev 41791)
@@ -1295,7 +1295,7 @@
// HACK
WRITE_VAR_OFFSET(freeVar, 1000000);
WRITE_VAR_OFFSET(maxFreeVar, 1000000);
- WRITE_VAR(16, READ_LE_UINT32(_vm->_game->_script->getData() + 0x2C) * 4);
+ WRITE_VAR(16, _vm->_game->_script->getVariablesCount() * 4);
return false;
}
@@ -1370,7 +1370,7 @@
return false ;
} else if (size == 0) {
dataVar = 0;
- size = READ_LE_UINT32(_vm->_game->_script->getData() + 0x2C) * 4;
+ size = _vm->_game->_script->getVariablesCount() * 4;
}
buf = _variables->getAddressOff8(dataVar);
Modified: scummvm/trunk/engines/gob/script.cpp
===================================================================
--- scummvm/trunk/engines/gob/script.cpp 2009-06-23 01:19:37 UTC (rev 41790)
+++ scummvm/trunk/engines/gob/script.cpp 2009-06-23 01:20:05 UTC (rev 41791)
@@ -411,6 +411,8 @@
_versionMajor = _totData[39] - '0';
_versionMinor = _totData[41] - '0';
+ _variablesCount = READ_LE_UINT32(_totData + 44);
+
_imFileNumber = _totData[59];
_exFileNumber = _totData[60];
_communHandling = _totData[61];
@@ -499,6 +501,10 @@
return _versionMinor;
}
+uint32 Script::getVariablesCount() const {
+ return _variablesCount;
+}
+
uint8 Script::getImFileNumber() const {
return _imFileNumber;
}
@@ -511,4 +517,17 @@
return _communHandling;
}
+uint32 Script::getVariablesCount(const char *fileName, GobEngine *vm) {
+ if (!vm->_dataIO->existData(fileName))
+ return 0;
+
+ DataStream *stream = vm->_dataIO->getDataStream(fileName);
+
+ stream->seek(0x2C);
+ uint32 variablesCount = stream->readUint32LE();
+ delete stream;
+
+ return variablesCount;
+}
+
} // End of namespace Gob
Modified: scummvm/trunk/engines/gob/script.h
===================================================================
--- scummvm/trunk/engines/gob/script.h 2009-06-23 01:19:37 UTC (rev 41790)
+++ scummvm/trunk/engines/gob/script.h 2009-06-23 01:20:05 UTC (rev 41791)
@@ -119,10 +119,13 @@
// Fixed properties
uint8 getVersionMajor() const;
uint8 getVersionMinor() const;
+ uint32 getVariablesCount() const;
uint8 getImFileNumber() const;
uint8 getExFileNumber() const;
uint8 getCommunHandling() const;
+ static uint32 getVariablesCount(const char *fileName, GobEngine *vm);
+
private:
struct CallEntry {
byte *totPtr;
@@ -143,6 +146,7 @@
uint8 _versionMajor;
uint8 _versionMinor;
+ uint32 _variablesCount;
uint8 _imFileNumber;
uint8 _exFileNumber;
uint8 _communHandling;
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