diff options
| author | Eugene Sandulenko | 2004-11-14 20:11:22 +0000 |
|---|---|---|
| committer | Eugene Sandulenko | 2004-11-14 20:11:22 +0000 |
| commit | ddda67753e012a2946403933f57115b37e796bf8 (patch) | |
| tree | bab4ebf24cb0e9cb03082658e5986e32a5fc0d79 /kyra/script_v1.cpp | |
| parent | 0cfd573951c2cdd886cea650c43f0c4406e7fa94 (diff) | |
| download | scummvm-rg350-ddda67753e012a2946403933f57115b37e796bf8.tar.gz scummvm-rg350-ddda67753e012a2946403933f57115b37e796bf8.tar.bz2 scummvm-rg350-ddda67753e012a2946403933f57115b37e796bf8.zip | |
Patch #1066256. Mostly indentation fixes and some debug messages removed.
svn-id: r15811
Diffstat (limited to 'kyra/script_v1.cpp')
| -rw-r--r-- | kyra/script_v1.cpp | 384 |
1 files changed, 192 insertions, 192 deletions
diff --git a/kyra/script_v1.cpp b/kyra/script_v1.cpp index c69c58c514..bab2442ff5 100644 --- a/kyra/script_v1.cpp +++ b/kyra/script_v1.cpp @@ -25,219 +25,219 @@ #include "script.h" namespace Kyra { - // Command procs +// Command procs + +void VMContext::c1_unknownCommand(void) { + debug("unknown command '0x%x'.", _currentCommand); + debug("\targument: '0x%x'", _argument); - void VMContext::c1_unknownCommand(void) { - debug("unknown command '0x%x'.", _currentCommand); - debug("\targument: '0x%x'", _argument); + _error = true; +} + +void VMContext::c1_goToLine(void) { + _instructionPos = _argument << 1; +} + +void VMContext::c1_setReturn(void) { + _returnValue = _argument; +} + +void VMContext::c1_pushRetRec(void) { + if (!_argument) { + pushStack(_returnValue); + } else { + int32 rec = ((int16)_tempPos << 16) | ((_instructionPos >> 1) + 1); + pushStack(rec); + _tempPos = _instructionPos; + } +} + +void VMContext::c1_push(void) { + pushStack(_argument); +} + +void VMContext::c1_pushVar(void) { + pushStack(_registers[_argument]); +} + +void VMContext::c1_pushFrameNeg(void) { + pushStack(_stack[_tempPos + _argument]); +} + +void VMContext::c1_pushFramePos(void) { + pushStack(_stack[_tempPos - _argument]); +} + +void VMContext::c1_popRetRec(void) { + if (!_argument) { + _returnValue = popStack(); + } else { + if (_stackPos <= 0) { + _scriptState = kScriptStopped; + } + int32 rec = popStack(); - _error = true; + _tempPos = (int16)((rec & 0xFFFF0000) >> 16); + _instructionPos = (rec & 0x0000FFFF) * 2; } - - void VMContext::c1_goToLine(void) { +} + +void VMContext::c1_popVar(void) { + _registers[_argument] = popStack(); +} + +void VMContext::c1_popFrameNeg(void) { + _stack[_tempPos + _argument] = popStack(); +} + +void VMContext::c1_popFramePos(void) { + _stack[_tempPos - _argument] = popStack(); +} + +void VMContext::c1_addToSP(void) { + _stackPos -= _argument; +} + +void VMContext::c1_subFromSP(void) { + _stackPos += _argument; +} + +void VMContext::c1_execOpcode(void) { + if (_argument < _numOpcodes) { + OpcodeProc proc = _opcodes[_argument].proc; + (this->*proc)(); + } else { + error("Invalid opcode 0x%X", _argument); + } +} + +void VMContext::c1_ifNotGoTo(void) { + if (!popStack()) { _instructionPos = _argument << 1; } +} + +void VMContext::c1_negate(void) { + switch(_argument) { + case 0: + topStack() = !topStack(); + break; + + case 1: + topStack() = -topStack(); + break; + + case 2: + topStack() = ~topStack(); + break; + + default: + debug("unkown negate instruction %d", _argument); + _error = true; + break; + }; +} + +void VMContext::c1_evaluate(void) { + int32 x, y; + int32 res = false; - void VMContext::c1_setReturn(void) { - _returnValue = _argument; - } + x = popStack(); + y = popStack(); - void VMContext::c1_pushRetRec(void) { - if (!_argument) { - pushStack(_returnValue); - } else { - int32 rec = ((int16)_tempPos << 16) | ((_instructionPos >> 1) + 1); - pushStack(rec); - _tempPos = _instructionPos; - } - } + switch(_argument) { + case 0: + res = x && y; + break; - void VMContext::c1_push(void) { - pushStack(_argument); - } + case 1: + res = x || y; + break; - void VMContext::c1_pushVar(void) { - pushStack(_registers[_argument]); - } + case 3: + res = x != y; + break; - void VMContext::c1_pushFrameNeg(void) { - pushStack(_stack[_tempPos + _argument]); - } + case 4: + res = x < y; + break; - void VMContext::c1_pushFramePos(void) { - pushStack(_stack[_tempPos - _argument]); - } + case 5: + res = x <= y; + break; + + case 6: + res = x > y; + break; - void VMContext::c1_popRetRec(void) { - if (!_argument) { - _returnValue = popStack(); - } else { - if (_stackPos <= 0) { - _scriptState = kScriptStopped; - } - int32 rec = popStack(); - - _tempPos = (int16)((rec & 0xFFFF0000) >> 16); - _instructionPos = (rec & 0x0000FFFF) * 2; - } - } + case 7: + res = x >= y; + break; - void VMContext::c1_popVar(void) { - _registers[_argument] = popStack(); - } + case 8: + res = x + y; + break; + + case 9: + res = x - y; + break; - void VMContext::c1_popFrameNeg(void) { - _stack[_tempPos + _argument] = popStack(); - } + case 10: + res = x * y; + break; + + case 11: + res = x / y; + break; - void VMContext::c1_popFramePos(void) { - _stack[_tempPos - _argument] = popStack(); - } + case 12: + res = x >> y; + break; - void VMContext::c1_addToSP(void) { - _stackPos -= _argument; - } + case 13: + res = x << y; + break; - void VMContext::c1_subFromSP(void) { - _stackPos += _argument; - } + case 14: + res = x & y; + break; - void VMContext::c1_execOpcode(void) { - if (_argument < _numOpcodes) { - OpcodeProc proc = _opcodes[_argument].proc; - (this->*proc)(); - } else { - error("Invalid opcode 0x%X", _argument); - } - } + case 15: + res = x | y; + break; - void VMContext::c1_ifNotGoTo(void) { - if (!popStack()) { - _instructionPos = _argument << 1; - } - } + case 16: + res = x % y; + break; - void VMContext::c1_negate(void) { - switch(_argument) { - case 0: - topStack() = !topStack(); - break; - - case 1: - topStack() = -topStack(); - break; - - case 2: - topStack() = ~topStack(); - break; - - default: - debug("unkown negate instruction %d", _argument); - _error = true; - break; - }; - } + case 17: + res = x ^ y; + break; - void VMContext::c1_evaluate(void) { - int32 x, y; - int32 res = false; - - x = popStack(); - y = popStack(); - - switch(_argument) { - case 0: - res = x && y; - break; - - case 1: - res = x || y; - break; - - case 3: - res = x != y; - break; - - case 4: - res = x < y; - break; - - case 5: - res = x <= y; - break; - - case 6: - res = x > y; - break; - - case 7: - res = x >= y; - break; - - case 8: - res = x + y; - break; - - case 9: - res = x - y; - break; - - case 10: - res = x * y; - break; - - case 11: - res = x / y; - break; - - case 12: - res = x >> y; - break; - - case 13: - res = x << y; - break; - - case 14: - res = x & y; - break; - - case 15: - res = x | y; - break; - - case 16: - res = x % y; - break; - - case 17: - res = x ^ y; - break; - - default: - debug("unknown evaluate command"); - break; - }; - - pushStack(res); - } - - // opcode procs - void VMContext::o1_unknownOpcode(void) { - _error = true; + default: + debug("unknown evaluate command"); + break; + }; + + pushStack(res); +} - debug("unknown opcode '0x%x'.", _argument); - debug("parameters:\n" - "Param0: %d\nParam1: %d\nParam2: %d\nParam3: %d\nParam4: %d\nParam5: %d\n" - "Param0 as a string: %s\nParam1 as a string: %s\nParam2 as a string: %s\n" - "Param3 as a string: %s\nParam4 as a string: %s\nParam5 as a string: %s\n", - param(0), param(1), param(2), param(3), param(5), param(5), - paramString(0), paramString(1), paramString(2), paramString(3), - paramString(4), paramString(5)); - } +// opcode procs +void VMContext::o1_unknownOpcode(void) { + _error = true; + + debug("unknown opcode '0x%x'.", _argument); + debug("parameters:\n" + "Param0: %d\nParam1: %d\nParam2: %d\nParam3: %d\nParam4: %d\nParam5: %d\n" + "Param0 as a string: %s\nParam1 as a string: %s\nParam2 as a string: %s\n" + "Param3 as a string: %s\nParam4 as a string: %s\nParam5 as a string: %s\n", + param(0), param(1), param(2), param(3), param(5), param(5), + paramString(0), paramString(1), paramString(2), paramString(3), + paramString(4), paramString(5)); +} - void VMContext::o1_0x68(void) { - debug("o1_0x68 was called with param0: '%d'", param(0)); - _error = true; - } +void VMContext::o1_0x68(void) { + debug("o1_0x68 was called with param0: '0x%x'", param(0)); + _error = true; +} } // end of namespace Kyra |
