Added Script methods to get the TOT major and minor version
svn-id: r41788
This commit is contained in:
parent
510700b086
commit
f6118f7a85
4 changed files with 35 additions and 4 deletions
|
@ -329,7 +329,7 @@ void Draw_v2::printTotText(int16 id) {
|
|||
ptrEnd = ptr;
|
||||
while (((ptrEnd - dataPtr) < size) && (*ptrEnd != 1)) {
|
||||
// Converting to unknown commands/characters to spaces
|
||||
if ((_vm->_game->_script->getData()[0x29] < 0x32) && (*ptrEnd > 3) && (*ptrEnd < 32))
|
||||
if ((_vm->_game->_script->getVersionMinor() < 2) && (*ptrEnd > 3) && (*ptrEnd < 32))
|
||||
*ptrEnd = 32;
|
||||
|
||||
switch (*ptrEnd) {
|
||||
|
|
|
@ -253,7 +253,7 @@ void Mult_v2::loadImds(Common::SeekableReadStream &data) {
|
|||
_multData->execPtr = _vm->_game->_script->getData() + _vm->_game->_script->pos();
|
||||
_vm->_game->_script->skip(size * 2);
|
||||
|
||||
if (_vm->_game->_script->getData()[0x29] < 51)
|
||||
if (_vm->_game->_script->getVersionMinor() < 3)
|
||||
return;
|
||||
|
||||
size = data.readSint16LE();
|
||||
|
@ -871,7 +871,7 @@ void Mult_v2::animate() {
|
|||
animObj.newBottom =
|
||||
MAX(animObj.lastBottom, _vm->_scenery->_toRedrawBottom);
|
||||
|
||||
if ((_vm->_game->_script->getData()[0x29] > 50) &&
|
||||
if ((_vm->_game->_script->getVersionMinor() > 2) &&
|
||||
(animObj.newLeft == animObj.lastLeft) &&
|
||||
(animObj.newTop == animObj.lastTop) &&
|
||||
(animObj.newRight == animObj.lastRight) &&
|
||||
|
|
|
@ -376,7 +376,10 @@ bool Script::loadTOT(const Common::String &fileName) {
|
|||
}
|
||||
}
|
||||
|
||||
return (_totData != 0);
|
||||
if (_totData == 0)
|
||||
return false;
|
||||
|
||||
return getTOTProperties();
|
||||
}
|
||||
|
||||
bool Script::loadLOM(const Common::String &fileName) {
|
||||
|
@ -400,6 +403,17 @@ bool Script::loadLOM(const Common::String &fileName) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Script::getTOTProperties() {
|
||||
// Offset 39-41: Version in "Major.Minor" string form
|
||||
if (_totData[40] != '.')
|
||||
return false;
|
||||
|
||||
_versionMajor = _totData[39] - '0';
|
||||
_versionMinor = _totData[41] - '0';
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Script::unload() {
|
||||
unloadTOT();
|
||||
}
|
||||
|
@ -473,4 +487,12 @@ void Script::call(uint32 offset) {
|
|||
seek(offset);
|
||||
}
|
||||
|
||||
uint8 Script::getVersionMajor() const {
|
||||
return _versionMajor;
|
||||
}
|
||||
|
||||
uint8 Script::getVersionMinor() const {
|
||||
return _versionMinor;
|
||||
}
|
||||
|
||||
} // End of namespace Gob
|
||||
|
|
|
@ -116,6 +116,10 @@ public:
|
|||
/** Push the current script position and branch to the specified offset. */
|
||||
void call(uint32 offset);
|
||||
|
||||
// Fixed properties
|
||||
uint8 getVersionMajor() const;
|
||||
uint8 getVersionMinor() const;
|
||||
|
||||
private:
|
||||
struct CallEntry {
|
||||
byte *totPtr;
|
||||
|
@ -134,6 +138,9 @@ private:
|
|||
|
||||
int16 _lomHandle;
|
||||
|
||||
uint8 _versionMajor;
|
||||
uint8 _versionMinor;
|
||||
|
||||
Common::Stack<CallEntry> _callStack;
|
||||
|
||||
/** Loading a TOT file. */
|
||||
|
@ -141,6 +148,8 @@ private:
|
|||
/** Loading a LOM file. */
|
||||
bool loadLOM(const Common::String &fileName);
|
||||
|
||||
bool getTOTProperties();
|
||||
|
||||
/** Unloading a TOT file. */
|
||||
void unloadTOT();
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue