mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 12:39:56 +00:00
Replacing the 2 offset functions by a generic Script::getFunctionOffset()
svn-id: r41797
This commit is contained in:
parent
c967db5fa0
commit
fcddd5c69a
@ -390,8 +390,9 @@ void Draw::printTextCentered(int16 id, int16 left, int16 top, int16 right,
|
||||
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);
|
||||
|
@ -164,7 +164,7 @@ void Game_v1::playTot(int16 skipPlay) {
|
||||
if (!_vm->_inter->_variables)
|
||||
_vm->_inter->allocateVars(_script->getVariablesCount() & 0xFFFF);
|
||||
|
||||
_script->seek(_script->getStartOffset());
|
||||
_script->seek(_script->getFunctionOffset(Script::kFunctionStart));
|
||||
|
||||
_vm->_inter->renewTimeInVars();
|
||||
|
||||
|
@ -199,7 +199,7 @@ void Game_v2::playTot(int16 skipPlay) {
|
||||
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 @@ void Game_v2::playTot(int16 skipPlay) {
|
||||
} 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);
|
||||
|
@ -422,10 +422,6 @@ bool Script::getTOTProperties() {
|
||||
_exFileNumber = _totData[60];
|
||||
_communHandling = _totData[61];
|
||||
|
||||
_startOffset = READ_LE_UINT32(_totData + 100);
|
||||
|
||||
_centerOffset = READ_LE_UINT16(_totData + 126);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -538,12 +534,14 @@ uint8 Script::getCommunHandling() const {
|
||||
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) {
|
||||
|
@ -36,6 +36,11 @@ class Expression;
|
||||
|
||||
class Script {
|
||||
public:
|
||||
enum Function {
|
||||
kFunctionStart = 0,
|
||||
kFunctionCenter = 13
|
||||
};
|
||||
|
||||
Script(GobEngine *vm);
|
||||
~Script();
|
||||
|
||||
@ -126,8 +131,8 @@ public:
|
||||
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);
|
||||
|
||||
@ -158,8 +163,6 @@ private:
|
||||
uint8 _imFileNumber;
|
||||
uint8 _exFileNumber;
|
||||
uint8 _communHandling;
|
||||
uint32 _startOffset;
|
||||
uint16 _centerOffset;
|
||||
|
||||
Common::Stack<CallEntry> _callStack;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user