diff options
author | Max Horn | 2004-04-05 22:02:58 +0000 |
---|---|---|
committer | Max Horn | 2004-04-05 22:02:58 +0000 |
commit | ce8099c89f474600c28649727f7434b8a2625580 (patch) | |
tree | 4e98a32e37dfc7060d3c7dd68a051be4e7767a5c /scumm | |
parent | f31f91b09a589c7e8350d87ad534df6448325c3a (diff) | |
download | scummvm-rg350-ce8099c89f474600c28649727f7434b8a2625580.tar.gz scummvm-rg350-ce8099c89f474600c28649727f7434b8a2625580.tar.bz2 scummvm-rg350-ce8099c89f474600c28649727f7434b8a2625580.zip |
Paranoid fix for potential 64bit issue; some possibly useful debug output added
svn-id: r13474
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/script.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/scumm/script.cpp b/scumm/script.cpp index 2db41d7a9c..2a93b3bbe7 100644 --- a/scumm/script.cpp +++ b/scumm/script.cpp @@ -429,7 +429,7 @@ void ScummEngine::executeScript() { byte ScummEngine::fetchScriptByte() { if (*_lastCodePtr + sizeof(MemBlkHeader) != _scriptOrgPointer) { - uint32 oldoffs = _scriptPointer - _scriptOrgPointer; + long oldoffs = _scriptPointer - _scriptOrgPointer; getScriptBaseAddress(); _scriptPointer = _scriptOrgPointer + oldoffs; } @@ -439,7 +439,7 @@ byte ScummEngine::fetchScriptByte() { uint ScummEngine::fetchScriptWord() { int a; if (*_lastCodePtr + sizeof(MemBlkHeader) != _scriptOrgPointer) { - uint32 oldoffs = _scriptPointer - _scriptOrgPointer; + long oldoffs = _scriptPointer - _scriptOrgPointer; getScriptBaseAddress(); _scriptPointer = _scriptOrgPointer + oldoffs; } @@ -540,6 +540,8 @@ int ScummEngine::readVar(uint var) { } void ScummEngine::writeVar(uint var, int value) { + debugC(DEBUG_VARS, "writeVar(%d, %d)", var, value); + if (!(var & 0xF000)) { checkRange(_numVariables - 1, 0, var, "Variable %d out of range(w)"); @@ -630,6 +632,7 @@ void ScummEngine::setResult(int value) { void ScummEngine::push(int a) { assert(_scummStackPos >= 0 && _scummStackPos < ARRAYSIZE(_vmStack)); + //debug(9, "push %d", a); _vmStack[_scummStackPos++] = a; } @@ -637,8 +640,9 @@ int ScummEngine::pop() { if (_scummStackPos < 1 || _scummStackPos > ARRAYSIZE(_vmStack)) { error("No items on stack to pop() for %s (0x%X) at [%d-%d]", getOpcodeDesc(_opcode), _opcode, _roomResource, vm.slot[_currentScript].number); } - - return _vmStack[--_scummStackPos]; + --_scummStackPos; + //debug(9, "pop %d", _vmStack[_scummStackPos]); + return _vmStack[_scummStackPos]; } void ScummEngine::stopObjectCode() { |