diff options
author | Travis Howell | 2006-04-04 01:38:53 +0000 |
---|---|---|
committer | Travis Howell | 2006-04-04 01:38:53 +0000 |
commit | 0ac5739ae290716158f947b65f42e19005eab67e (patch) | |
tree | 9f01d38c110cbb4342e08e4e8fa365729cc52c37 | |
parent | ebeded36a198fea5d86721be859e4540f64624d3 (diff) | |
download | scummvm-rg350-0ac5739ae290716158f947b65f42e19005eab67e.tar.gz scummvm-rg350-0ac5739ae290716158f947b65f42e19005eab67e.tar.bz2 scummvm-rg350-0ac5739ae290716158f947b65f42e19005eab67e.zip |
More work on oracle in FF
svn-id: r21583
-rw-r--r-- | engines/simon/items.cpp | 6 | ||||
-rw-r--r-- | engines/simon/oracle.cpp | 172 | ||||
-rw-r--r-- | engines/simon/simon.cpp | 5 | ||||
-rw-r--r-- | engines/simon/simon.h | 12 | ||||
-rw-r--r-- | engines/simon/verb.cpp | 2 |
5 files changed, 187 insertions, 10 deletions
diff --git a/engines/simon/items.cpp b/engines/simon/items.cpp index 26bf967300..3acd833fcd 100644 --- a/engines/simon/items.cpp +++ b/engines/simon/items.cpp @@ -704,7 +704,7 @@ int SimonEngine::runScript() { if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) goto invalid_opcode; - warning("STUB: script opcode 122"); + oracleTextDown(); } break; @@ -712,7 +712,7 @@ int SimonEngine::runScript() { if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) goto invalid_opcode; - warning("STUB: script opcode 123"); + oracleTextUp(); } break; @@ -795,7 +795,7 @@ int SimonEngine::runScript() { case 134:{ /* dummy opcode? */ if (getGameType() == GType_FF) { - warning("STUB: script opcode 134"); + listSaveGames(1); } else { midi.stop(); _lastMusicPlayed = -1; diff --git a/engines/simon/oracle.cpp b/engines/simon/oracle.cpp index 716aa16fd6..a2d5e19385 100644 --- a/engines/simon/oracle.cpp +++ b/engines/simon/oracle.cpp @@ -21,6 +21,9 @@ */ #include "common/stdafx.h" + +#include "common/savefile.h" + #include "simon/simon.h" #include "simon/intern.h" #include "simon/vga.h" @@ -29,8 +32,7 @@ namespace Simon { -void SimonEngine::hyperLinkOn(uint16 x) -{ +void SimonEngine::hyperLinkOn(uint16 x) { if ((_bitArray[3] & (1 << 3)) == 0) return; @@ -41,8 +43,7 @@ void SimonEngine::hyperLinkOn(uint16 x) } -void SimonEngine::hyperLinkOff() -{ +void SimonEngine::hyperLinkOff() { if ((_bitArray[3] & (1 << 3)) == 0) return; @@ -52,6 +53,169 @@ void SimonEngine::hyperLinkOff() _hyperLink = 0; } +void SimonEngine::oracleTextDown() { + Subroutine *sub; + int i = 0; + changeWindow(3); + _noOracleScroll = 0; + + if(_textWindow->textColumnOffset > _oracleMaxScrollY) // For scroll up + _oracleMaxScrollY = _textWindow->textColumnOffset; + + while(1) { + if(_textWindow->textColumnOffset == 0) + break; + for (i = 0; i < 5; i++) { + _newLines = 0; + _textWindow->textColumn = 0; + _textWindow->textRow = (i + 1) * 3; + if(i == 4) { + _textWindow->textColumnOffset -= 1; + _textWindow->textRow = 0; + linksDown(); + } + scrollOracleDown(); + _bitArray[5] |= (1 << 13); + sub = getSubroutineByID(_variableArray[104]); + if (sub) + startSubroutineEx(sub); + _bitArray[5] &= ~(1 << 13); + bltOracleText(); + } + if (_currentBoxNumber != 600 || _leftButtonDown) + break; + } +} + +void SimonEngine::oracleTextUp() { + Subroutine *sub; + int i = 0; + changeWindow(3); + _noOracleScroll = 0; + + if(_textWindow->textColumnOffset > _oracleMaxScrollY) // For scroll up + _oracleMaxScrollY = _textWindow->textColumnOffset; + + while(1) { + if(_textWindow->textColumnOffset == _oracleMaxScrollY) + break; + _textWindow->textRow = 105; + for (i = 0; i < 5; i++) { + _newLines = 0; + _textWindow->textColumn = 0; + _textWindow->textRow -= 3; + if(i == 2) { + _textWindow->textColumnOffset += 1; + _textWindow->textRow += 15; + linksUp(); + } + scrollOracleUp(); + _bitArray[5] |= (1 << 14); + sub = getSubroutineByID(_variableArray[104]); + if(sub) + startSubroutineEx(sub); + _bitArray[5] &= ~(1 << 14); + bltOracleText(); + } + if (_currentBoxNumber != 600 || _leftButtonDown) + break; + } +} + +void SimonEngine::linksUp() { // Scroll Oracle Links + uint16 j; + for (j = 700; j < _variableArray[53]; j++) { + moveBox(j, 0, -15); + } +} + +void SimonEngine::linksDown() { + uint16 i; + for (i = 700; i < _variableArray[53]; i++) { + moveBox(i,0, 15); + } +} + +void SimonEngine::listSaveGames(int n) { + char b[108]; + Common::InSaveFile *in; + uint16 j, k, z, maxFiles; + int OK; + memset(b, 0, 108); + + maxFiles = countSaveGames(); + j = maxFiles - n + 1; + k = maxFiles - j + 1; + z = maxFiles; + if ((_bitArray[5] & (1 << 15)) != 0) { + j++; + z++; + } + + while(1) { + OK=1; + if ((_bitArray[5] & (3 << 13)) != 0) { + OK = 0; + if(j > z) + break; + } + + if ((_bitArray[5] & (1 << 13)) != 0) { + if (((_newLines + 1) >= _textWindow->textColumnOffset) && ( + (_newLines + 1) < (_textWindow->textColumnOffset + 3))) + OK = 1; + } + + if ((_bitArray[5] & (1 << 14)) != 0) { + if ((_newLines + 1) == (_textWindow->textColumnOffset + 7)) + OK = 1; + } + + + if (OK == 1) { + if (j == maxFiles + 1) { + showMessageFormat("\n"); + hyperLinkOn(j + 400); + o_setTextColor(116); + showMessageFormat(" %d. ",1); + hyperLinkOff(); + o_setTextColor(113); + k++; + j--; + } + + if (!(in = _saveFileMan->openForLoading(gen_savename(j)))) + break; + in->read(b, 100); + delete in; + } + + showMessageFormat("\n"); + hyperLinkOn(j + 400); + o_setTextColor(116); + if (k < 10) + showMessageFormat(" "); + showMessageFormat("%d. ",k); + o_setTextColor(113); + showMessageFormat("%s ",b); + hyperLinkOff(); + j--; + k++; + } +} + +void SimonEngine::scrollOracleUp() { + // TODO +} + +void SimonEngine::scrollOracleDown() { + // TODO +} + +void SimonEngine::bltOracleText() { + // TODO +} + void SimonEngine::oracleLogo() { Common::Rect srcRect, dstRect; byte *src, *dst; diff --git a/engines/simon/simon.cpp b/engines/simon/simon.cpp index 1d4ab3f5d6..107fcdd988 100644 --- a/engines/simon/simon.cpp +++ b/engines/simon/simon.cpp @@ -280,6 +280,7 @@ SimonEngine::SimonEngine(OSystem *syst) _objectItem = 0; _item1 = 0; + _currentBoxNumber = 0; _hitAreaObjectItem = 0; _lastHitArea = 0; _lastHitArea2Ptr = 0; @@ -1660,7 +1661,7 @@ void SimonEngine::handle_mouse_moved() { if (getGameType() == GType_FF) { if (_bitArray[6] & 0x8) { // Oracle - if (_mouseX >= 10 && _mouseX <= 635 && _mouseY >= 5 && _mouseX <= 475) { + if (_mouseX >= 10 && _mouseX <= 635 && _mouseY >= 5 && _mouseY <= 475) { _bitArray[6] |= 0x4; } else { if (_bitArray[6] & 0x4) { @@ -1668,7 +1669,7 @@ void SimonEngine::handle_mouse_moved() { } } } else if (_bitArray[5] & 0x0100) { // Close Up - if (_mouseX >= 10 && _mouseX <= 635 && _mouseY >= 5 && _mouseX <= 475) { + if (_mouseX >= 10 && _mouseX <= 635 && _mouseY >= 5 && _mouseY <= 475) { _bitArray[5] |= 0x80; } else { if (_bitArray[5] & 0x80) { diff --git a/engines/simon/simon.h b/engines/simon/simon.h index a7d1b17bca..c0c1116b06 100644 --- a/engines/simon/simon.h +++ b/engines/simon/simon.h @@ -264,7 +264,7 @@ protected: const byte *_scrollImage; byte _vgaVar8; - uint16 _hyperLink; + uint16 _hyperLink, _newLines; uint16 _oracleMaxScrollY, _noOracleScroll; int16 _scriptVerb, _scriptNoun1, _scriptNoun2; @@ -287,6 +287,7 @@ protected: uint _verbHitArea; uint16 _defaultVerb; uint _mouseHideCount; + uint _currentBoxNumber; uint16 _windowNum; @@ -589,7 +590,16 @@ protected: void hyperLinkOn(uint16 x); void hyperLinkOff(); + void linksUp(); + void linksDown(); + void listSaveGames(int n); + void oracleTextUp(); + void oracleTextDown(); + + void bltOracleText(); void oracleLogo(); + void scrollOracleUp(); + void scrollOracleDown(); void swapCharacterLogo(); void mouseOff(); diff --git a/engines/simon/verb.cpp b/engines/simon/verb.cpp index 72467d8d1e..e6cc9924d8 100644 --- a/engines/simon/verb.cpp +++ b/engines/simon/verb.cpp @@ -519,6 +519,8 @@ void SimonEngine::setup_hitarea_from_pos(uint x, uint y, uint mode) { return; } + _currentBoxNumber = best_ha->id; + if (mode != 0 && mode != 3) { _lastHitArea = best_ha; _variableArray[1] = x; |