From 81a16b0c8eeac517d3c74b360096dd829c080e54 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 22 Mar 2018 23:30:37 +0100 Subject: LILLIPUT: Some more renaming --- engines/lilliput/lilliput.cpp | 28 ++++++++++++++-------------- engines/lilliput/lilliput.h | 4 ++-- engines/lilliput/script.cpp | 43 +++++++++++++++++++++++-------------------- engines/lilliput/script.h | 6 +++--- 4 files changed, 42 insertions(+), 39 deletions(-) (limited to 'engines/lilliput') diff --git a/engines/lilliput/lilliput.cpp b/engines/lilliput/lilliput.cpp index eaca15d4b3..ae6b298afe 100644 --- a/engines/lilliput/lilliput.cpp +++ b/engines/lilliput/lilliput.cpp @@ -179,8 +179,8 @@ LilliputEngine::LilliputEngine(OSystem *syst, const LilliputGameDescription *gd) _array1692B[i] = 0; for (int i = 0; i < 40; i++) { - _array10999PosX[i] = 0; - _array109C1PosY[i] = 0; + _characterTargetPosX[i] = 0; + _characterTargetPosY[i] = 0; _charactersToDisplay[i] = 0; _characterRelativePositionX[i] = -1; _characterRelativePositionY[i] = -1; @@ -1359,7 +1359,7 @@ byte LilliputEngine::sub16799(int index, Common::Point param1) { return 3; } - if ((var3.x == _array10999PosX[index]) && (var3.y == _array109C1PosY[index])) + if ((var3.x == _characterTargetPosX[index]) && (var3.y == _characterTargetPosY[index])) return 2; } @@ -1380,26 +1380,26 @@ void LilliputEngine::sub167EF(int index) { debugC(2, kDebugEngine, "sub167EF(%d)", index); int16 word167EB = findHotspot(Common::Point(_scriptHandler->_characterTilePosX[index], _scriptHandler->_characterTilePosY[index])); - int16 word167ED = findHotspot(Common::Point(_array10999PosX[index], _array109C1PosY[index])); + int16 word167ED = findHotspot(Common::Point(_characterTargetPosX[index], _characterTargetPosY[index])); if (word167EB == word167ED) { - _array109E9PosX[index] = _array10999PosX[index]; - _array10A11PosY[index] = _array109C1PosY[index]; + _array109E9PosX[index] = _characterTargetPosX[index]; + _array10A11PosY[index] = _characterTargetPosY[index]; return; } if (word167EB == -1) { - int tmpVal = reverseFindHotspot(Common::Point(_array10999PosX[index], _array109C1PosY[index])); + int tmpVal = reverseFindHotspot(Common::Point(_characterTargetPosX[index], _characterTargetPosY[index])); _array109E9PosX[index] = _rulesBuffer12Pos4[tmpVal].x; _array10A11PosY[index] = _rulesBuffer12Pos4[tmpVal].y; return; } if ((word167ED != -1) && - (_array10999PosX[index] >= _rectXMinMax[word167EB].min) && - (_array10999PosX[index] <= _rectXMinMax[word167EB].max) && - (_array109C1PosY[index] >= _rectYMinMax[word167EB].min) && - (_array109C1PosY[index] <= _rectYMinMax[word167EB].max)) { + (_characterTargetPosX[index] >= _rectXMinMax[word167EB].min) && + (_characterTargetPosX[index] <= _rectXMinMax[word167EB].max) && + (_characterTargetPosY[index] >= _rectYMinMax[word167EB].min) && + (_characterTargetPosY[index] <= _rectYMinMax[word167EB].max)) { _array109E9PosX[index] = _rulesBuffer12Pos4[word167ED].x; _array10A11PosY[index] = _rulesBuffer12Pos4[word167ED].y; return; @@ -1749,13 +1749,13 @@ byte LilliputEngine::sub1675D(int index, Common::Point var1) { int charIndex = _scriptHandler->_array10A39[index]; Common::Point charPos = Common::Point(_scriptHandler->_characterTilePosX[charIndex], _scriptHandler->_characterTilePosY[charIndex]); - if ((_array109E9PosX[index] != -1) && (_array109E9PosX[index] == _array10999PosX[index]) && (_array10A11PosY[index] == _array109C1PosY[index])) { + if ((_array109E9PosX[index] != -1) && (_array109E9PosX[index] == _characterTargetPosX[index]) && (_array10A11PosY[index] == _characterTargetPosY[index])) { _array109E9PosX[index] = charPos.x; _array10A11PosY[index] = charPos.y; } - _array10999PosX[index] = charPos.x; - _array109C1PosY[index] = charPos.y; + _characterTargetPosX[index] = charPos.x; + _characterTargetPosY[index] = charPos.y; return sub16799(index, var1); } diff --git a/engines/lilliput/lilliput.h b/engines/lilliput/lilliput.h index 278c9733aa..024994d9cc 100644 --- a/engines/lilliput/lilliput.h +++ b/engines/lilliput/lilliput.h @@ -208,8 +208,8 @@ public: int16 _interfaceHotspotsX[20]; int16 _interfaceHotspotsY[20]; Common::KeyCode _keyboardMapping[20]; - int16 _array10999PosX[40]; - int16 _array109C1PosY[40]; + int16 _characterTargetPosX[40]; + int16 _characterTargetPosY[40]; byte _savedSurfaceUnderMouse[16 * 16]; byte _charactersToDisplay[40]; int16 _characterRelativePositionX[40]; diff --git a/engines/lilliput/script.cpp b/engines/lilliput/script.cpp index 24572e9bcf..32de831a31 100644 --- a/engines/lilliput/script.cpp +++ b/engines/lilliput/script.cpp @@ -224,7 +224,7 @@ byte LilliputScript::handleOpcodeType1(int curWord) { return OC_checkDelayedReactivation(); break; case 0x2E: - return OC_sub179C2(); + return OC_checkTargetReached(); break; case 0x2F: return OC_checkFunctionKeyPressed(); @@ -284,7 +284,7 @@ void LilliputScript::handleOpcodeType2(int curWord) { OC_saveAndQuit(); break; case 0xD: - OC_sub17B93(); + OC_nSkipOpcodes(); break; case 0xE: OC_startSpeech5(); @@ -603,7 +603,7 @@ static const OpCode opCodes1[] = { { "OC_checkLastInterfaceHotspotIndex", 2, kImmediateValue, kImmediateValue, kNone, kNone, kNone }, { "OC_checkSelectedCharacter", 0, kNone, kNone, kNone, kNone, kNone }, { "OC_checkDelayedReactivation", 0, kNone, kNone, kNone, kNone, kNone }, - { "OC_sub179C2", 1, kgetPosFromScript, kNone, kNone, kNone, kNone }, + { "OC_checkTargetReached", 1, kgetPosFromScript, kNone, kNone, kNone, kNone }, { "OC_checkFunctionKeyPressed", 1, kImmediateValue, kNone, kNone, kNone, kNone }, { "OC_checkCodeEntered", 3, kImmediateValue, kImmediateValue, kImmediateValue, kNone, kNone }, { "OC_checkViewPortCharacterTarget", 1, kGetValue1, kNone, kNone, kNone, kNone }, @@ -624,7 +624,7 @@ static const OpCode opCodes2[] = { /* 0x0a */ { "OC_setCharacterPosition", 2, kGetValue1, kgetPosFromScript, kNone, kNone, kNone }, /* 0x0b */ { "OC_disableCharacter", 1, kGetValue1, kNone, kNone, kNone, kNone }, /* 0x0c */ { "OC_saveAndQuit", 0, kNone, kNone, kNone, kNone, kNone }, -/* 0x0d */ { "OC_sub17B93", 1, kImmediateValue, kNone, kNone, kNone, kNone }, // todo : jump to other opcode +/* 0x0d */ { "OC_nSkipOpcodes", 1, kImmediateValue, kNone, kNone, kNone, kNone }, // todo : jump to other opcode /* 0x0e */ { "OC_startSpeech5", 0, kNone, kNone, kNone, kNone, kNone }, // todo /* 0x0f */ { "OC_resetByte1714E", 0, kNone, kNone, kNone, kNone, kNone }, /* 0x10 */ { "OC_deleteSavegameAndQuit", 0, kNone, kNone, kNone, kNone, kNone }, @@ -764,7 +764,7 @@ Common::String LilliputScript::getArgumentString(kValueType type, ScriptStream& break; } case 0xFA: - str = Common::String::format("(_array10999PosX[currentCharacter], _array109C1PosY[currentCharacter])"); + str = Common::String::format("(_characterTargetPosX[currentCharacter], _characterTargetPosY[currentCharacter])"); break; case 0xF9: str = Common::String::format("(_currentCharacterVariables[4], _currentCharacterVariables[5])"); @@ -1018,8 +1018,8 @@ void LilliputScript::enableCharacterScript(byte index, byte var1, byte *curBufPt curBufPtr[3] = 0; } -void LilliputScript::sub17B6C(int var1) { - debugC(1, kDebugScript, "sub17B6C(%d)", var1); +void LilliputScript::skipOpcodes(int var1) { + debugC(1, kDebugScript, "skipOpcodes(%d)", var1); if (var1 == 0) { int curWord = 0; @@ -1323,7 +1323,7 @@ Common::Point LilliputScript::getPosFromScript() { return Common::Point(x, y); } case 0xFA: - return Common::Point(_vm->_array10999PosX[_vm->_currentScriptCharacter], _vm->_array109C1PosY[_vm->_currentScriptCharacter]); + return Common::Point(_vm->_characterTargetPosX[_vm->_currentScriptCharacter], _vm->_characterTargetPosY[_vm->_currentScriptCharacter]); case 0xF9: return Common::Point(_vm->_currentCharacterAttributes[4], _vm->_currentCharacterAttributes[5]); case 0xF8: { @@ -2035,16 +2035,17 @@ byte LilliputScript::OC_checkDelayedReactivation() { return 1; } -byte LilliputScript::OC_sub179C2() { - debugC(1, kDebugScriptTBC, "OC_sub179C2()"); +byte LilliputScript::OC_checkTargetReached() { + debugC(1, kDebugScriptTBC, "OC_checkTargetReached()"); Common::Point var1 = getPosFromScript(); - if ((_vm->_array10999PosX[_vm->_currentScriptCharacter] == var1.x) - && (_vm->_array109C1PosY[_vm->_currentScriptCharacter] == var1.y)) + if ((_vm->_characterTargetPosX[_vm->_currentScriptCharacter] == var1.x) + && (_vm->_characterTargetPosY[_vm->_currentScriptCharacter] == var1.y)) return 1; return 0; } + byte LilliputScript::OC_checkFunctionKeyPressed() { debugC(1, kDebugScript, "OC_checkFunctionKeyPressed()"); @@ -2294,15 +2295,17 @@ void LilliputScript::OC_DisableCharacter() { } void LilliputScript::OC_saveAndQuit() { - warning("OC_saveAndQuit"); + warning("TODO: OC_saveAndQuit"); + _vm->_soundHandler.contentFct6(); // Kill music + // TODO: Save game _vm->_shouldQuit = true; } -void LilliputScript::OC_sub17B93() { - debugC(1, kDebugScript, "OC_sub17B93()"); +void LilliputScript::OC_nSkipOpcodes() { + debugC(1, kDebugScript, "OC_nSkipOpcodes()"); int var1 = _currScript->readUint16LE(); - sub17B6C(var1); + skipOpcodes(var1); } void LilliputScript::OC_startSpeech5() { @@ -2383,15 +2386,15 @@ void LilliputScript::OC_callScriptAndReturn() { debugC(1, kDebugScript, "OC_callScriptAndReturn()"); OC_callScript(); - sub17B6C(0); + skipOpcodes(0); } void LilliputScript::OC_setCurrentScriptCharacterPos() { debugC(1, kDebugScript, "OC_setCurrentScriptCharacterPos()"); Common::Point pos = getPosFromScript(); - _vm->_array10999PosX[_vm->_currentScriptCharacter] = pos.x; - _vm->_array109C1PosY[_vm->_currentScriptCharacter] = pos.y; + _vm->_characterTargetPosX[_vm->_currentScriptCharacter] = pos.x; + _vm->_characterTargetPosY[_vm->_currentScriptCharacter] = pos.y; _vm->_array109E9PosX[_vm->_currentScriptCharacter] = -1; } @@ -2539,7 +2542,7 @@ void LilliputScript::OC_enableCurrentCharacterScript() { uint8 var1 = (_currScript->readUint16LE() & 0xFF); enableCharacterScript(_vm->_currentScriptCharacter , var1, _vm->_currentCharacterAttributes); - sub17B6C(0); + skipOpcodes(0); } void LilliputScript::OC_IncCurrentCharacterVar1() { diff --git a/engines/lilliput/script.h b/engines/lilliput/script.h index d3fb240b1e..c292e12a85 100644 --- a/engines/lilliput/script.h +++ b/engines/lilliput/script.h @@ -128,7 +128,7 @@ private: void handleOpcodeType2(int curWord); void enableCharacterScript(byte index, byte var1, byte *curBufPtr); - void sub17B6C(int var1); + void skipOpcodes(int var1); void sub16C86(int index, byte *buf); void sub16C5C(int index, int8 var3); void checkSpeechAllowed(bool &forceReturnFl); @@ -198,7 +198,7 @@ private: byte OC_checkLastInterfaceHotspotIndex(); byte OC_checkSelectedCharacter(); byte OC_checkDelayedReactivation(); - byte OC_sub179C2(); + byte OC_checkTargetReached(); byte OC_checkFunctionKeyPressed(); byte OC_checkCodeEntered(); byte OC_checkViewPortCharacterTarget(); @@ -217,7 +217,7 @@ private: void OC_setCharacterPosition(); void OC_DisableCharacter(); void OC_saveAndQuit(); - void OC_sub17B93(); + void OC_nSkipOpcodes(); void OC_startSpeech5(); void OC_resetByte1714E(); void OC_deleteSavegameAndQuit(); -- cgit v1.2.3