More work on oracle in FF

svn-id: r21583
This commit is contained in:
Travis Howell 2006-04-04 01:38:53 +00:00
parent ebeded36a1
commit 0ac5739ae2
5 changed files with 187 additions and 10 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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) {

View File

@ -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();

View File

@ -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;