aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Howell2006-04-04 07:34:48 +0000
committerTravis Howell2006-04-04 07:34:48 +0000
commitc21b81f5e5d7f5c75e0d4d70e85ab7920f5ff39c (patch)
treecae94ac759d28a2c1f0be73808edaf2bce227d0b
parentad5cac9eb454cebc606005567178aaf11bf04cf0 (diff)
downloadscummvm-rg350-c21b81f5e5d7f5c75e0d4d70e85ab7920f5ff39c.tar.gz
scummvm-rg350-c21b81f5e5d7f5c75e0d4d70e85ab7920f5ff39c.tar.bz2
scummvm-rg350-c21b81f5e5d7f5c75e0d4d70e85ab7920f5ff39c.zip
More work on oracle in FF
svn-id: r21586
-rw-r--r--engines/simon/charset.cpp116
-rw-r--r--engines/simon/intern.h1
-rw-r--r--engines/simon/items.cpp35
-rw-r--r--engines/simon/oracle.cpp112
-rw-r--r--engines/simon/simon.cpp11
-rw-r--r--engines/simon/simon.h2
6 files changed, 196 insertions, 81 deletions
diff --git a/engines/simon/charset.cpp b/engines/simon/charset.cpp
index efbba9eb0a..b5c14e584d 100644
--- a/engines/simon/charset.cpp
+++ b/engines/simon/charset.cpp
@@ -33,14 +33,41 @@ void SimonEngine::print_char_helper_1(const byte *src, uint len) {
return;
while (len-- != 0) {
- if (*src != 12 && _textWindow->fcs_data != NULL &&
- _fcsData1[ind = get_fcs_ptr_3_index(_textWindow)] != 2) {
+ if (getGameType() == GType_FF) {
+ if ((_bitArray[5] & (1 << 13)) != 0) {
+ if (_curWindow == 3) {
+ if ((_newLines >= _textWindow->scrollY) && (_newLines < (_textWindow->scrollY + 3)))
+ fcs_putchar(*src);
+ if (*src == '\n') // Do two top lines of text only
+ _newLines++;
+ src++;
+ }
+ } else {
+ if ((_bitArray[5] & (1 << 14)) != 0) {
+ if (_curWindow == 3) {
+ if (_newLines == (_textWindow->scrollY + 7))
+ fcs_putchar(*src);
+ if (*src == '\n') // Do two top lines of text only
+ _newLines++;
+ src++;
+ }
+ } else {
+ //if ((_bitArray[5] & (1 << 12)) != 0)
+ // while(!_nextCharacter);
+ fcs_putchar(*src++);
+ //_nextCharacter = false;
+ }
+ }
+ } else {
+ if (*src != 12 && _textWindow->fcs_data != NULL &&
+ _fcsData1[ind = get_fcs_ptr_3_index(_textWindow)] != 2) {
+
+ _fcsData1[ind] = 2;
+ _fcsData2[ind] = 1;
+ }
- _fcsData1[ind] = 2;
- _fcsData2[ind] = 1;
+ fcs_putchar(*src++);
}
-
- fcs_putchar(*src++);
}
}
@@ -218,6 +245,22 @@ void SimonEngine::render_string(uint vga_sprite_id, uint color, uint width, uint
}
}
+static const byte fontSize[208] = {
+ 8, 2, 5, 7, 8, 8, 8, 2, 4, 4, 8, 8, 3, 8, 2, 9,
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 2, 3, 5, 8, 5, 8,
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 4, 8, 8, 8, 8, 8, 8,
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 4, 9, 4, 4, 9,
+ 4, 8, 8, 8, 8, 8, 7, 8, 8, 4, 5, 7, 3, 8, 8, 8,
+ 8, 8, 8, 7, 7, 8, 8, 8, 8, 8, 8, 5, 2, 5, 8, 8,
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 4, 4, 4, 8, 8,
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+ 8, 4, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 2, 8, 8,
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+};
+
void SimonEngine::showMessageFormat(const char *s, ...) {
char buf[STRINGBUFLEN];
char *str;
@@ -231,8 +274,10 @@ void SimonEngine::showMessageFormat(const char *s, ...) {
showmessage_helper_2();
if (!_showMessageFlag) {
_windowArray[0] = _textWindow;
- showmessage_helper_3(_textWindow->textLength,
- _textWindow->textMaxLength);
+ if (getGameType() == GType_FF)
+ showmessage_helper_3(_textWindow->textColumn, _textWindow->width);
+ else
+ showmessage_helper_3(_textWindow->textLength, _textWindow->textMaxLength);
}
_showMessageFlag = true;
_fcsData1[_curWindow] = 1;
@@ -286,21 +331,25 @@ void SimonEngine::showmessage_helper_2() {
if (_textWindow)
return;
- _textWindow = openWindow(8, 0x90, 0x18, 6, 1, 0, 0xF);
+ if (getGameType() == GType_FF)
+ _textWindow = openWindow(64, 96, 384, 172, 1, 0, 15);
+ else
+ _textWindow = openWindow(8, 144, 24, 6, 1, 0, 15);
}
void SimonEngine::showmessage_helper_3(uint a, uint b) {
_printCharCurPos = a;
_printCharMaxPos = b;
_numLettersToPrint = 0;
+ _newLines = 0;
}
void SimonEngine::video_putchar(FillOrCopyStruct *fcs, byte c, byte b) {
byte width = 6;
- if (c == 0xC) {
+ if (c == 12) {
clearWindow(fcs);
- } else if (c == 0xD || c == 0xA) {
+ } else if (c == 13 || c == 10) {
video_putchar_newline(fcs);
} else if ((c == 1 && _language != Common::HB_ISR) || (c == 8)) {
if (_language == Common::HB_ISR) { //Hebrew
@@ -328,6 +377,12 @@ void SimonEngine::video_putchar(FillOrCopyStruct *fcs, byte c, byte b) {
}
}
} else if (c >= 0x20) {
+ if (getGameType() == GType_FF) {
+ video_putchar_drawchar(fcs, fcs->textColumn + fcs->x, fcs->textRow + fcs->y, c);
+ fcs->textColumn += fontSize[c - 0x20];
+ return;
+ }
+
if (fcs->textLength == fcs->textMaxLength) {
video_putchar_newline(fcs);
} else if (fcs->textRow == fcs->height) {
@@ -343,10 +398,10 @@ void SimonEngine::video_putchar(FillOrCopyStruct *fcs, byte c, byte b) {
fcs->textColumn++;
fcs->textColumnOffset += 8;
}
- video_putchar_drawchar(fcs, fcs->width + fcs->x - fcs->textColumn, fcs->textRow * 8 + fcs->y, c);
+ video_putchar_drawchar(fcs, (fcs->width + fcs->x - fcs->textColumn) * 8, fcs->textRow * 8 + fcs->y, c);
fcs->textLength++;
} else {
- video_putchar_drawchar(fcs, fcs->textColumn + fcs->x, fcs->textRow * 8 + fcs->y, c);
+ video_putchar_drawchar(fcs, (fcs->textColumn + fcs->x) * 8, fcs->textRow * 8 + fcs->y, c);
fcs->textLength++;
fcs->textColumnOffset += 6;
@@ -362,12 +417,39 @@ void SimonEngine::video_putchar(FillOrCopyStruct *fcs, byte c, byte b) {
}
void SimonEngine::video_putchar_newline(FillOrCopyStruct *fcs) {
+ if (getGameType() == GType_FF) {
+ if (_noOracleScroll == 0) {
+ if (fcs->textRow + 30 > fcs->height) {
+ if (vcGetBit(94) == false) {
+ _noOracleScroll = 1;
+ if (vcGetBit(92) == true) {
+ _noOracleScroll = 0;
+ checkLinkBox();
+ scrollOracle();
+ linksUp();
+ fcs->scrollY++;
+ _oracleMaxScrollY++;
+ } else {
+ _oracleMaxScrollY++;
+ checkLinkBox();
+ }
+ }
+ } else {
+ fcs->textRow += 15;
+ checkLinkBox();
+ }
+ } else {
+ _oracleMaxScrollY++;
+ checkLinkBox();
+ }
+ } else {
+ if (fcs->textRow != fcs->height)
+ fcs->textRow++;
+ }
+
fcs->textColumnOffset = 0;
fcs->textLength = 0;
fcs->textColumn = 0;
-
- if (fcs->textRow != fcs->height)
- fcs->textRow++;
}
#ifdef PALMOS_68K
@@ -1197,7 +1279,7 @@ void SimonEngine::video_putchar_drawchar(FillOrCopyStruct *fcs, uint x, uint y,
_lockWord |= 0x8000;
dst = getFrontBuf();
- dst += y * _dxSurfacePitch + x * 8 + fcs->textColumnOffset;
+ dst += y * _dxSurfacePitch + x + fcs->textColumnOffset;
switch(_language) {
case Common::RU_RUS:
diff --git a/engines/simon/intern.h b/engines/simon/intern.h
index 8f54e56762..da8215cf73 100644
--- a/engines/simon/intern.h
+++ b/engines/simon/intern.h
@@ -91,6 +91,7 @@ struct FillOrCopyStruct {
uint16 width, height;
uint16 textColumn, textRow;
uint16 textColumnOffset, textLength, textMaxLength;
+ uint16 scrollY;
uint8 fill_color, text_color, unk5;
FillOrCopyData *fcs_data;
FillOrCopyStruct() { memset(this, 0, sizeof(*this)); }
diff --git a/engines/simon/items.cpp b/engines/simon/items.cpp
index 3acd833fcd..39930ff614 100644
--- a/engines/simon/items.cpp
+++ b/engines/simon/items.cpp
@@ -569,14 +569,14 @@ int SimonEngine::runScript() {
break;
case 101:{
- uint a = getVarOrByte();
- uint b = getVarOrWord();
- uint c = getVarOrWord();
- uint d = getVarOrWord();
- uint e = getVarOrWord();
- uint f = getVarOrWord();
- uint g = getVarOrWord();
- o_defineWindow(a, b, c, d, e, f, g, 0);
+ uint num = getVarOrByte();
+ uint x = getVarOrWord();
+ uint y = getVarOrWord();
+ uint w = getVarOrWord();
+ uint h = getVarOrWord();
+ uint flags = getVarOrWord();
+ uint fill_color = getVarOrWord();
+ o_defineWindow(num, x, y, w, h, flags, fill_color, 0);
}
break;
@@ -1713,17 +1713,20 @@ void SimonEngine::o_kill_sprite_simon2(uint a, uint b) {
}
/* OK */
-void SimonEngine::o_defineWindow(uint a, uint b, uint c, uint d, uint e, uint f, uint g, uint h) {
- a &= 7;
+void SimonEngine::o_defineWindow(uint num, uint x, uint y, uint w, uint h, uint flags, uint fill_color, uint text_color) {
+ num &= 7;
- if (_windowArray[a])
- closeWindow(a);
+ if (_windowArray[num])
+ closeWindow(num);
- _windowArray[a] = openWindow(b, c, d, e, f, g, h);
+ _windowArray[num] = openWindow(x, y, w, h, flags, fill_color, text_color);
- if (a == _curWindow) {
- _textWindow = _windowArray[a];
- showmessage_helper_3(_textWindow->textLength, _textWindow->textMaxLength);
+ if (num == _curWindow) {
+ _textWindow = _windowArray[num];
+ if (getGameType() == GType_FF)
+ showmessage_helper_3(_textWindow->textColumn, _textWindow->width);
+ else
+ showmessage_helper_3(_textWindow->textLength, _textWindow->textMaxLength);
}
}
diff --git a/engines/simon/oracle.cpp b/engines/simon/oracle.cpp
index a2d5e19385..8214563513 100644
--- a/engines/simon/oracle.cpp
+++ b/engines/simon/oracle.cpp
@@ -32,14 +32,25 @@
namespace Simon {
+void SimonEngine::checkLinkBox() { // Check for boxes spilling over to next row of text
+ if (_hyperLink != 0) {
+ _variableArray[52] = _textWindow->x + _textWindow->textColumn - _variableArray[50];
+ if (_variableArray[52] != 0) {
+ addNewHitArea(_variableArray[53], _variableArray[50], _variableArray[51], _variableArray[52], 15, 145, 208, _dummyItem1);
+ _variableArray[53]++;
+ }
+ _variableArray[50] = _textWindow->x;
+ _variableArray[51] = _textWindow->textRow + _textWindow->y + (_oracleMaxScrollY-_textWindow->scrollY) * 15;
+ }
+}
+
void SimonEngine::hyperLinkOn(uint16 x) {
if ((_bitArray[3] & (1 << 3)) == 0)
return;
_hyperLink = x;
_variableArray[50] = _textWindow->textColumn+_textWindow->x;
- _variableArray[51] = _textWindow->textRow+_textWindow->y+
- (_oracleMaxScrollY - _textWindow->textColumnOffset) * 15;
+ _variableArray[51] = _textWindow->textRow+_textWindow->y + (_oracleMaxScrollY - _textWindow->scrollY) * 15;
}
@@ -53,33 +64,57 @@ void SimonEngine::hyperLinkOff() {
_hyperLink = 0;
}
-void SimonEngine::oracleTextDown() {
+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::scrollOracle() {
+ int i;
+
+ for (i = 0; i < 5; i++) {
+ scrollOracleUp();
+ bltOracleText();
+ }
+}
+
+void SimonEngine::oracleTextUp() {
Subroutine *sub;
int i = 0;
changeWindow(3);
_noOracleScroll = 0;
- if(_textWindow->textColumnOffset > _oracleMaxScrollY) // For scroll up
- _oracleMaxScrollY = _textWindow->textColumnOffset;
+ if(_textWindow->scrollY > _oracleMaxScrollY) // For scroll up
+ _oracleMaxScrollY = _textWindow->scrollY;
while(1) {
- if(_textWindow->textColumnOffset == 0)
+ if(_textWindow->scrollY == _oracleMaxScrollY)
break;
+ _textWindow->textRow = 105;
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();
+ _textWindow->textRow -= 3;
+ if(i == 2) {
+ _textWindow->scrollY += 1;
+ _textWindow->textRow += 15;
+ linksUp();
}
- scrollOracleDown();
- _bitArray[5] |= (1 << 13);
+ scrollOracleUp();
+ _bitArray[5] |= (1 << 14);
sub = getSubroutineByID(_variableArray[104]);
- if (sub)
+ if(sub)
startSubroutineEx(sub);
- _bitArray[5] &= ~(1 << 13);
+ _bitArray[5] &= ~(1 << 14);
bltOracleText();
}
if (_currentBoxNumber != 600 || _leftButtonDown)
@@ -87,34 +122,33 @@ void SimonEngine::oracleTextDown() {
}
}
-void SimonEngine::oracleTextUp() {
+void SimonEngine::oracleTextDown() {
Subroutine *sub;
int i = 0;
changeWindow(3);
_noOracleScroll = 0;
- if(_textWindow->textColumnOffset > _oracleMaxScrollY) // For scroll up
- _oracleMaxScrollY = _textWindow->textColumnOffset;
+ if(_textWindow->scrollY > _oracleMaxScrollY) // For scroll up
+ _oracleMaxScrollY = _textWindow->scrollY;
while(1) {
- if(_textWindow->textColumnOffset == _oracleMaxScrollY)
+ if(_textWindow->scrollY == 0)
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();
+ _textWindow->textRow = (i + 1) * 3;
+ if(i == 4) {
+ _textWindow->scrollY -= 1;
+ _textWindow->textRow = 0;
+ linksDown();
}
- scrollOracleUp();
- _bitArray[5] |= (1 << 14);
+ scrollOracleDown();
+ _bitArray[5] |= (1 << 13);
sub = getSubroutineByID(_variableArray[104]);
- if(sub)
+ if (sub)
startSubroutineEx(sub);
- _bitArray[5] &= ~(1 << 14);
+ _bitArray[5] &= ~(1 << 13);
bltOracleText();
}
if (_currentBoxNumber != 600 || _leftButtonDown)
@@ -122,20 +156,6 @@ void SimonEngine::oracleTextUp() {
}
}
-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;
@@ -161,13 +181,13 @@ void SimonEngine::listSaveGames(int n) {
}
if ((_bitArray[5] & (1 << 13)) != 0) {
- if (((_newLines + 1) >= _textWindow->textColumnOffset) && (
- (_newLines + 1) < (_textWindow->textColumnOffset + 3)))
+ if (((_newLines + 1) >= _textWindow->scrollY) && (
+ (_newLines + 1) < (_textWindow->scrollY + 3)))
OK = 1;
}
if ((_bitArray[5] & (1 << 14)) != 0) {
- if ((_newLines + 1) == (_textWindow->textColumnOffset + 7))
+ if ((_newLines + 1) == (_textWindow->scrollY + 7))
OK = 1;
}
diff --git a/engines/simon/simon.cpp b/engines/simon/simon.cpp
index 107fcdd988..c170caa9f8 100644
--- a/engines/simon/simon.cpp
+++ b/engines/simon/simon.cpp
@@ -2138,7 +2138,10 @@ void SimonEngine::startUp_helper_2() {
_curWindow = 0;
if (_windowArray[0] != 0) {
_textWindow = _windowArray[0];
- showmessage_helper_3(_textWindow->textLength, _textWindow->textMaxLength);
+ if (getGameType() == GType_FF)
+ showmessage_helper_3(_textWindow->textColumn, _textWindow->width);
+ else
+ showmessage_helper_3(_textWindow->textLength, _textWindow->textMaxLength);
}
_mortalFlag = false;
}
@@ -2950,7 +2953,10 @@ void SimonEngine::changeWindow(uint a) {
showmessage_print_char(0);
_textWindow = _windowArray[a];
- showmessage_helper_3(_textWindow->textLength, _textWindow->textMaxLength);
+ if (getGameType() == GType_FF)
+ showmessage_helper_3(_textWindow->textColumn, _textWindow->width);
+ else
+ showmessage_helper_3(_textWindow->textLength, _textWindow->textMaxLength);
}
// OK
@@ -2973,6 +2979,7 @@ FillOrCopyStruct *SimonEngine::openWindow(uint x, uint y, uint w, uint h, uint f
fcs->textRow = 0;
fcs->textColumnOffset = 0;
fcs->textMaxLength = fcs->width * 8 / 6; // characters are 6 pixels
+ fcs->scrollY = 0;
return fcs;
}
diff --git a/engines/simon/simon.h b/engines/simon/simon.h
index c0c1116b06..ca7620fa13 100644
--- a/engines/simon/simon.h
+++ b/engines/simon/simon.h
@@ -588,6 +588,7 @@ protected:
void o_inventory_descriptions();
+ void checkLinkBox();
void hyperLinkOn(uint16 x);
void hyperLinkOff();
void linksUp();
@@ -598,6 +599,7 @@ protected:
void bltOracleText();
void oracleLogo();
+ void scrollOracle();
void scrollOracleUp();
void scrollOracleDown();
void swapCharacterLogo();