From cdfac3cadc6222f2e518f85a495996c49629d152 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 19 May 2012 14:25:30 +0200 Subject: LILLIPUT: Some more code validation and renaming --- engines/lilliput/lilliput.cpp | 10 +++++----- engines/lilliput/lilliput.h | 2 +- engines/lilliput/script.cpp | 32 +++++++++++++++++--------------- engines/lilliput/script.h | 2 +- 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/engines/lilliput/lilliput.cpp b/engines/lilliput/lilliput.cpp index 3e6b2109f0..21b18f9133 100644 --- a/engines/lilliput/lilliput.cpp +++ b/engines/lilliput/lilliput.cpp @@ -153,7 +153,7 @@ LilliputEngine::LilliputEngine(OSystem *syst, const LilliputGameDescription *gd) _currentScriptCharacter = 0; _currentScriptCharacterPos = Common::Point(0, 0); _word10804 = 0; - _word17081_nextIndex = 0; + _nextCharacterIndex = 0; _word16EFE = 0xFFFF; _word1817B = 0; _savedSurfaceUnderMousePos = Common::Point(0, 0); @@ -2629,7 +2629,7 @@ void LilliputEngine::sub130DD() { } void LilliputEngine::handleMenu() { - debugC(1, kDebugEngineTBC, "handleMenu()"); + debugC(1, kDebugEngine, "handleMenu()"); if (_byte16F07_menuId == 0) return; @@ -2651,9 +2651,9 @@ void LilliputEngine::handleMenu() { } void LilliputEngine::handleGameScripts() { - debugC(1, kDebugEngineTBC, "handleGameScripts()"); + debugC(1, kDebugEngine, "handleGameScripts()"); - int index = _word17081_nextIndex; + int index = _nextCharacterIndex; int i; for (i = 0; (_scriptHandler->_characterScriptEnabled[index] == 0) && (i < _numCharacters); i++) { ++index; @@ -2664,7 +2664,7 @@ void LilliputEngine::handleGameScripts() { if (i > _numCharacters) return; - _word17081_nextIndex = (index + 1) % _numCharacters; + _nextCharacterIndex = (index + 1) % _numCharacters; _scriptHandler->_characterScriptEnabled[index] = 0; diff --git a/engines/lilliput/lilliput.h b/engines/lilliput/lilliput.h index f37c8961ae..322e34a969 100644 --- a/engines/lilliput/lilliput.h +++ b/engines/lilliput/lilliput.h @@ -138,7 +138,7 @@ public: int _word10800_ERULES; int _numCharacters; Common::Point _currentScriptCharacterPos; - int _word17081_nextIndex; + int _nextCharacterIndex; int _word16EFE; int _word1817B; Common::Point _savedSurfaceUnderMousePos; diff --git a/engines/lilliput/script.cpp b/engines/lilliput/script.cpp index 390ef70ab2..6cc9fd5380 100644 --- a/engines/lilliput/script.cpp +++ b/engines/lilliput/script.cpp @@ -334,7 +334,7 @@ void LilliputScript::handleOpcodeType2(int curWord) { OC_sub17C76(); break; case 0x1E: - OC_sub17AFC(); + OC_setCurrentCharacter(); break; case 0x1F: OC_sub17C8B(); @@ -640,7 +640,7 @@ static const OpCode opCodes2[] = { /* 0x1b */ { "OC_sub17C0E", 0, kNone, kNone, kNone, kNone, kNone }, /* 0x1c */ { "OC_sub17C55", 4, kGetValue1, kGetValue1, kImmediateValue, kImmediateValue, kNone }, /* 0x1d */ { "OC_sub17C76", 1, kGetValue1, kNone, kNone, kNone, kNone }, -/* 0x1e */ { "OC_sub17AFC", 1, kGetValue1, kNone, kNone, kNone, kNone }, +/* 0x1e */ { "OC_setCurrentCharacter", 1, kGetValue1, kNone, kNone, kNone, kNone }, /* 0x1f */ { "OC_sub17C8B", 2, kImmediateValue, kImmediateValue, kNone, kNone, kNone }, /* 0x20 */ { "OC_sub17CA2", 2, kImmediateValue, kImmediateValue, kNone, kNone, kNone }, /* 0x21 */ { "OC_sub17CB9", 3, kImmediateValue, kGetValue1, kImmediateValue, kNone, kNone }, @@ -975,7 +975,7 @@ byte LilliputScript::compareValues(int var1, int oper, int var2) { } void LilliputScript::computeOperation(byte *bufPtr, int oper, int var3) { - debugC(1, kDebugScriptTBC, "computeOperation(bufPtr, %c, %d)", oper & 0xFF, var3 & 0xFF); + debugC(1, kDebugScript, "computeOperation(bufPtr, %c, %d)", oper & 0xFF, var3 & 0xFF); switch (oper & 0xFF) { case '=': @@ -1515,7 +1515,7 @@ byte LilliputScript::OC_sub174D8() { } byte LilliputScript::OC_CompareCharacterVariables() { - debugC(1, kDebugScriptTBC, "OC_CompareCharacterVariables()"); + debugC(1, kDebugScript, "OC_CompareCharacterVariables()"); byte* buf1 = getCharacterVariablePtr(); int var1 = *buf1; @@ -1786,7 +1786,7 @@ byte LilliputScript::OC_CompareMapValueWith() { } byte LilliputScript::OC_IsCharacterValid() { - debugC(1, kDebugScriptTBC, "OC_IsCharacterValid()"); + debugC(1, kDebugScript, "OC_IsCharacterValid()"); int index = getValue1(); if (_vm->_characterPositionX[index] == -1) @@ -2240,26 +2240,26 @@ void LilliputScript::OC_sub17E15_speech2param() { } void LilliputScript::OC_ComputeCharacterVariable() { - debugC(1, kDebugScriptTBC, "OC_ComputeCharacterVariable()"); + debugC(1, kDebugScript, "OC_ComputeCharacterVariable()"); byte *bufPtr = getCharacterVariablePtr(); - int oper = _currScript->readUint16LE(); - int var3 = _currScript->readUint16LE(); + int16 oper = _currScript->readUint16LE(); + int16 var3 = _currScript->readSint16LE(); computeOperation(bufPtr, oper, var3); } void LilliputScript::OC_getRandom_type2() { - debugC(1, kDebugScriptTBC, "OC_getRandom_type2()"); + debugC(1, kDebugScript, "OC_getRandom_type2()"); - byte* bufPtr = getCharacterVariablePtr(); + byte *bufPtr = getCharacterVariablePtr(); int maxVal = _currScript->readUint16LE(); int randomVal = _vm->_rnd->getRandomNumber(maxVal); *bufPtr = randomVal; } void LilliputScript::OC_setCharacterPosition() { - debugC(1, kDebugScriptTBC, "OC_setCharacterPosition()"); + debugC(1, kDebugScript, "OC_setCharacterPosition()"); int index = getValue1(); Common::Point tmpVal = getPosFromScript(); @@ -2441,6 +2441,7 @@ void LilliputScript::OC_sub17C55() { _vm->_rulesBuffer2_6[var2] = var3 & 0xFF; _vm->_rulesBuffer2_7[var2] = var4 & 0xFF; } + void LilliputScript::OC_sub17C76() { debugC(1, kDebugScriptTBC, "OC_sub17C76()"); @@ -2450,8 +2451,9 @@ void LilliputScript::OC_sub17C76() { _characterScriptEnabled[var1] = 1; } -void LilliputScript::OC_sub17AFC() { - debugC(1, kDebugScriptTBC, "OC_sub17AFC()"); + +void LilliputScript::OC_setCurrentCharacter() { + debugC(1, kDebugScript, "OC_setCurrentCharacter()"); int var1 = getValue1(); _vm->setCurrentCharacter(var1); } @@ -2715,7 +2717,7 @@ void LilliputScript::OC_setByte10B29() { } void LilliputScript::OC_setCurrentCharacterVar2() { - debugC(1, kDebugScriptTBC, "OC_setCurrentCharacterVar2()"); + debugC(1, kDebugScript, "OC_setCurrentCharacterVar2()"); int curWord = _currScript->readUint16LE(); assert(_vm->_currentCharacterVariables != NULL); @@ -3210,7 +3212,7 @@ void LilliputScript::OC_sub18690() { } void LilliputScript::OC_setViewPortCharacterTarget() { - debugC(1, kDebugScriptTBC, "OC_setViewPortCharacterTarget()"); + debugC(1, kDebugScript, "OC_setViewPortCharacterTarget()"); _viewportCharacterTarget = getValue1(); } diff --git a/engines/lilliput/script.h b/engines/lilliput/script.h index 82b2be4479..87db1e7151 100644 --- a/engines/lilliput/script.h +++ b/engines/lilliput/script.h @@ -225,7 +225,7 @@ private: void OC_sub17C0E(); void OC_sub17C55(); void OC_sub17C76(); - void OC_sub17AFC(); + void OC_setCurrentCharacter(); void OC_sub17C8B(); void OC_sub17CA2(); void OC_sub17CB9(); -- cgit v1.2.3