diff options
author | Strangerke | 2012-05-11 17:01:00 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2018-03-28 17:36:57 +0200 |
commit | d32887f36715c953d45db6f6b4a5695ceef04926 (patch) | |
tree | f0baae60d436c3f4532cd3372459035ab92e61ff /engines/lilliput | |
parent | f4732601ec7f7aeae40d76a89401ebd6f7348d46 (diff) | |
download | scummvm-rg350-d32887f36715c953d45db6f6b4a5695ceef04926.tar.gz scummvm-rg350-d32887f36715c953d45db6f6b4a5695ceef04926.tar.bz2 scummvm-rg350-d32887f36715c953d45db6f6b4a5695ceef04926.zip |
LILLIPUT: More renaming
Diffstat (limited to 'engines/lilliput')
-rw-r--r-- | engines/lilliput/lilliput.cpp | 68 | ||||
-rw-r--r-- | engines/lilliput/lilliput.h | 21 | ||||
-rw-r--r-- | engines/lilliput/script.cpp | 51 | ||||
-rw-r--r-- | engines/lilliput/script.h | 7 |
4 files changed, 73 insertions, 74 deletions
diff --git a/engines/lilliput/lilliput.cpp b/engines/lilliput/lilliput.cpp index 09721b6d06..ab41b983ba 100644 --- a/engines/lilliput/lilliput.cpp +++ b/engines/lilliput/lilliput.cpp @@ -138,7 +138,7 @@ LilliputEngine::LilliputEngine(OSystem *syst, const LilliputGameDescription *gd) _byte129A0 = 0xFF; _numCharactersToDisplay = 0; _nextDisplayCharacterPos = Common::Point(0, 0); - _byte12A04 = 0; + _animationTick = 0; _byte12A05 = 10; _byte12A06 = 2; _byte12A07 = 0; @@ -150,6 +150,7 @@ LilliputEngine::LilliputEngine(OSystem *syst, const LilliputGameDescription *gd) _byte12FE3 = 0; _byte16F08 = 0; _byte16C9F = 0; + _lastAnimationTick = 0; _currentScriptCharacter = 0; _currentScriptCharacterPos = Common::Point(0, 0); @@ -277,7 +278,7 @@ void LilliputEngine::newInt8() { if (_sound_byte16F06 != 0) --_sound_byte16F06; - _byte12A04 ^= 1; + _animationTick ^= 1; if (_byte12A09 != 1 && _int8installed) // hack for the title stars because _int8installed is not set at the good place for the moment displayFunction16(); } @@ -779,7 +780,7 @@ void LilliputEngine::displayFunction15() { if (map[1] != 0xFF) { int var1 = map[1]; if (_rulesChunk9[var1] != 128) - var1 += _scriptHandler->_byte12A04; + var1 += _animationTick; displayIsometricBlock(_savedSurfaceGameArea1, var1, tmpVal, 1 << 8); } renderCharacters(map, Common::Point(j, i)); @@ -787,7 +788,7 @@ void LilliputEngine::displayFunction15() { if (map[2] != 0xFF) { int var1 = map[2]; if (_rulesChunk9[var1] != 128) - var1 += _scriptHandler->_byte12A04; + var1 += _animationTick; displayIsometricBlock(_savedSurfaceGameArea1, var1, tmpVal, 2 << 8); } map += 4; @@ -828,20 +829,51 @@ void LilliputEngine::displayFunction16() { } } -void LilliputEngine::sub1863B() { - debugC(2, kDebugEngineTBC, "sub1863B()"); +void LilliputEngine::resetSmallAnims() { + debugC(2, kDebugEngine, "resetSmallAnims()"); - _arr18560[0]._field0 = 0; - _arr18560[1]._field0 = 0; - _arr18560[2]._field0 = 0; - _arr18560[3]._field0 = 0; - _scriptHandler->_word1855E = 0; + _smallAnims[0]._active = false; + _smallAnims[1]._active = false; + _smallAnims[2]._active = false; + _smallAnims[3]._active = false; + _smallAnimsFrameIndex = 0; +} + +void LilliputEngine::displaySmallIndexedAnim(byte index, byte subIndex) { + debugC(2, kDebugEngine, "displaySmallIndexedAnim(%d, %d)", index, subIndex); + + if (!_smallAnims[index]._active) + return; + + display16x16IndexedBuf(_bufferIdeogram, _smallAnims[index]._frameIndex[subIndex], _smallAnims[index]._pos); +} + +void LilliputEngine::displaySmallAnims() { + debugC(2, kDebugEngineTBC, "displaySmallAnims()"); + + if (_animationTick == _lastAnimationTick) + return; + + _lastAnimationTick = _animationTick; + + assert(_smallAnimsFrameIndex < 8); + int subIndex = _smallAnimsFrameIndex; + displaySmallIndexedAnim(0, subIndex); + displaySmallIndexedAnim(1, subIndex); + displaySmallIndexedAnim(2, subIndex); + displaySmallIndexedAnim(3, subIndex); + + ++subIndex; + if (subIndex == 8) + subIndex = 0; + + _smallAnimsFrameIndex = subIndex; } void LilliputEngine::paletteFadeOut() { debugC(2, kDebugEngine, "paletteFadeOut()"); - sub1863B(); + resetSmallAnims(); byte palette[768]; for (int fade = 256; fade >= 0; fade -= 8) { for (int i = 0; i < 768; i++) { @@ -1805,7 +1837,7 @@ void LilliputEngine::sub16EBC() { void LilliputEngine::sub12F37() { debugC(2, kDebugEngineTBC, "sub12F37()"); - int index1 = _byte12A04 + 2; + int index1 = _animationTick + 2; int index2 = 0; for (int i = 0; i < _numCharacters; i++) { @@ -2196,7 +2228,7 @@ void LilliputEngine::sub171CF() { void LilliputEngine::sub12FE5() { debugC(2, kDebugEngineTBC, "sub12FE5()"); - if (_byte12A04 != 1) + if (_animationTick != 1) return; int index = 0; @@ -2587,7 +2619,7 @@ void LilliputEngine::sub170EE(int index) { int var2 = _characterPositionX[index]; int var4 = _characterPositionY[index]; - _currentScriptCharacterPos = Common::Point((var2 >> 3) & 0xFF, (var4 >> 3) & 0xFF); + _currentScriptCharacterPos = Common::Point(var2 >> 3, var4 >> 3); _currentCharacterVariables = getCharacterVariablesPtr(_currentScriptCharacter * 32); } @@ -2719,10 +2751,10 @@ void LilliputEngine::initialize() { _shouldQuit = false; for (int i = 0; i < 4; i++) { - _arr18560[i]._field0 = 0; - _arr18560[i]._field1 = Common::Point(0, 0); + _smallAnims[i]._active = false; + _smallAnims[i]._pos = Common::Point(0, 0); for (int j = 0; j < 8; j ++) - _arr18560[i]._field5[j] = 0; + _smallAnims[i]._frameIndex[j] = 0; } } diff --git a/engines/lilliput/lilliput.h b/engines/lilliput/lilliput.h index c70bab0a9d..c107965422 100644 --- a/engines/lilliput/lilliput.h +++ b/engines/lilliput/lilliput.h @@ -68,10 +68,10 @@ enum LilliputDebugChannels { struct LilliputGameDescription; -struct struct18560 { - byte _field0; - Common::Point _field1; - int16 _field5[8]; +struct SmallAnim { + bool _active; + Common::Point _pos; + int16 _frameIndex[8]; }; class LilliputEngine : public Engine { @@ -88,15 +88,18 @@ public: LilliputSound *_soundHandler; Graphics::Surface *_mainSurface; - struct18560 _arr18560[4]; + SmallAnim _smallAnims[4]; + int _smallAnimsFrameIndex; + byte _byte1714E; byte _byte184F4; + byte _lastAnimationTick; + byte _animationTick; Common::Point _nextDisplayCharacterPos; byte _sound_byte16F06; byte _byte16F09; byte _keyboard_nextIndex; byte _keyboard_oldIndex; - byte _byte12A04; byte _byte12A05; byte _byte12A06; byte _byte12A07; @@ -234,13 +237,15 @@ public: void displayFunction16(); void restoreSurfaceSpeech(); void displayFunction18(int var1, int var2, int var3, int var4); - void displayCharacter(int index, Common::Point pos, int flags); void displayString(byte *buf, int var2, int var4); void displayChar(int index, int var1); + void displaySmallAnims(); + void displaySmallIndexedAnim(byte index, byte subIndex); + void sub130B6(); void sub15F75(); - void sub1863B(); + void resetSmallAnims(); void paletteFadeOut(); void paletteFadeIn(); diff --git a/engines/lilliput/script.cpp b/engines/lilliput/script.cpp index fe09fac553..471484ef1f 100644 --- a/engines/lilliput/script.cpp +++ b/engines/lilliput/script.cpp @@ -30,8 +30,6 @@ namespace Lilliput { LilliputScript::LilliputScript(LilliputEngine *vm) : _vm(vm), _currScript(NULL) { _byte129A0 = 0xFF; - _byte1855D = 0; - _byte12A04 = 0; _byte10806 = 0; _byte12FE4 = 0xFF; _byte16F02 = 0; @@ -40,7 +38,6 @@ LilliputScript::LilliputScript(LilliputEngine *vm) : _vm(vm), _currScript(NULL) _byte18823 = 0; _byte1881E = 3; _byte1881D = 0; - _word1855E = 0; _word16F00 = -1; _word129A3 = 0; _viewportCharacterTarget = -1; @@ -512,7 +509,7 @@ void LilliputScript::handleOpcodeType2(int curWord) { OC_sub1864D(); break; case 0x58: - OC_initArr18560(); + OC_initSmallAnim(); break; case 0x59: OC_sub18678(); @@ -702,7 +699,7 @@ static const OpCode opCodes2[] = { /* 0x55 */ { "OC_displayTitleScreen", 1, kImmediateValue, kNone, kNone, kNone, kNone }, /* 0x56 */ { "OC_sub1853B", 0, kNone, kNone, kNone, kNone, kNone }, /* 0x57 */ { "OC_sub1864D", 4, kImmediateValue, kImmediateValue, kImmediateValue, kImmediateValue, kNone }, // TODO -/* 0x58 */ { "OC_initArr18560", 11, kImmediateValue, kImmediateValue, kImmediateValue, kImmediateValue, kImmediateValue }, +/* 0x58 */ { "OC_initSmallAnim", 11, kImmediateValue, kImmediateValue, kImmediateValue, kImmediateValue, kImmediateValue }, /* 0x59 */ { "OC_sub18678", 4, kGetValue1, kImmediateValue, kImmediateValue, kImmediateValue, kNone }, /* 0x5a */ { "OC_sub18690", 2, kGetValue1, kgetPosFromScript, kNone, kNone, kNone }, //TODO /* 0x5b */ { "OC_setViewPortCharacterTarget", 1, kGetValue1, kNone, kNone, kNone, kNone }, @@ -956,15 +953,6 @@ void LilliputScript::runMenuScript(ScriptStream script) { _vm->update(); } -void LilliputScript::sub185ED(byte index, byte subIndex) { - debugC(2, kDebugScript, "sub185ED(%d, %d)", index, subIndex); - - if (_vm->_arr18560[index]._field0 != 1) - return; - - _vm->display16x16IndexedBuf(_vm->_bufferIdeogram, _vm->_arr18560[index]._field5[subIndex], _vm->_arr18560[index]._field1); -} - byte LilliputScript::compareValues(int var1, int oper, int var2) { debugC(2, kDebugScript, "compareValues(%d, %c, %d)", var1, oper & 0xFF, var2); @@ -1033,27 +1021,6 @@ void LilliputScript::computeOperation(byte *bufPtr, int oper, int var3) { } } -void LilliputScript::sub185B4_display() { - if (_vm->_byte12A04 == _byte1855D) - return; - - _byte1855D = _vm->_byte12A04; - - assert(_word1855E < 8); - int subIndex = _word1855E; - sub185ED(0, subIndex); - sub185ED(1, subIndex); - sub185ED(2, subIndex); - sub185ED(3, subIndex); - - // In the original, increment by 2 as it's an array of words - ++subIndex; - if (subIndex == 8) - subIndex = 0; - - _word1855E = subIndex; -} - void LilliputScript::sub1823E(byte index, byte var1, byte *curBufPtr) { debugC(1, kDebugScriptTBC, "sub1823E(%d, %d, curBufPtr)", index, var1); @@ -3104,7 +3071,7 @@ void LilliputScript::OC_displayTitleScreen() { _vm->_byte16F09 = 0; while(!_vm->_shouldQuit) { - sub185B4_display(); + _vm->displaySmallAnims(); _vm->update(); if (_vm->_keyboard_nextIndex != _vm->_keyboard_oldIndex) { _vm->_byte16F09 = _vm->_keyboard_getch(); @@ -3150,17 +3117,17 @@ void LilliputScript::OC_sub1864D() { _vm->displayFunction18(var1, var2, var3, var4); } -void LilliputScript::OC_initArr18560() { - debugC(1, kDebugScript, "OC_initArr18560()"); +void LilliputScript::OC_initSmallAnim() { + debugC(1, kDebugScript, "OC_initSmallAnim()"); int index = _currScript->readUint16LE(); assert (index < 4); - _vm->_arr18560[index]._field0 = 1; - _vm->_arr18560[index]._field1.x = _currScript->readSint16LE(); - _vm->_arr18560[index]._field1.y = _currScript->readSint16LE(); + _vm->_smallAnims[index]._active = true; + _vm->_smallAnims[index]._pos.x = _currScript->readSint16LE(); + _vm->_smallAnims[index]._pos.y = _currScript->readSint16LE(); for (int i = 0; i < 8; i++) - _vm->_arr18560[index]._field5[i] = _currScript->readSint16LE(); + _vm->_smallAnims[index]._frameIndex[i] = _currScript->readUint16LE(); } void LilliputScript::OC_sub18678() { diff --git a/engines/lilliput/script.h b/engines/lilliput/script.h index 92e092aa7e..a8875f4e4e 100644 --- a/engines/lilliput/script.h +++ b/engines/lilliput/script.h @@ -56,7 +56,6 @@ struct OpCode { class LilliputScript { public: - byte _byte12A04; byte _heroismLevel; byte _characterScriptEnabled[40]; @@ -77,7 +76,6 @@ public: int _word1881B; int _heroismBarX; int _heroismBarBottomY; - int _word1855E; Common::Point _array12311[640]; byte _array128EF[40]; @@ -102,7 +100,6 @@ private: byte _byte16F05_ScriptHandler; byte _byte12A09; byte _byte129A0; - byte _byte1855D; byte _byte10806; byte _byte12FE4; byte _byte16F02; @@ -123,8 +120,6 @@ private: byte handleOpcodeType1(int curWord); void handleOpcodeType2(int curWord); - void sub185ED(byte index, byte subIndex); - void sub185B4_display(); void sub1823E(byte index, byte var1, byte *curBufPtr); void sub17B6C(int var1); void sub16C86(int index, byte *buf); @@ -291,7 +286,7 @@ private: void OC_displayTitleScreen(); void OC_sub1853B(); void OC_sub1864D(); - void OC_initArr18560(); + void OC_initSmallAnim(); void OC_sub18678(); void OC_sub18690(); void OC_setViewPortCharacterTarget(); |