Fixes for oracle in FF and cleanup

svn-id: r21680
This commit is contained in:
Travis Howell 2006-04-08 07:13:07 +00:00
parent fce6bf5142
commit b596065122
8 changed files with 84 additions and 65 deletions

View File

@ -27,7 +27,7 @@
namespace Simon {
void SimonEngine::print_char_helper_1(const byte *src, uint len) {
uint ind;
uint idx;
if (_textWindow == NULL)
return;
@ -52,18 +52,17 @@ void SimonEngine::print_char_helper_1(const byte *src, uint len) {
src++;
}
} else {
//if (getBitFlag(92))
// while(!_nextCharacter);
if (getBitFlag(92))
delay(50);
windowPutChar(*src++);
//_nextCharacter = false;
}
}
} else {
if (*src != 12 && _textWindow->iconPtr != NULL &&
_fcsData1[ind = get_fcs_ptr_3_index(_textWindow)] != 2) {
_fcsData1[idx = getWindowNum(_textWindow)] != 2) {
_fcsData1[ind] = 2;
_fcsData2[ind] = 1;
_fcsData1[idx] = 2;
_fcsData2[idx] = 1;
}
windowPutChar(*src++);
@ -72,12 +71,12 @@ void SimonEngine::print_char_helper_1(const byte *src, uint len) {
}
void SimonEngine::print_char_helper_5(WindowBlock *window) {
uint index = get_fcs_ptr_3_index(window);
print_char_helper_6(index);
uint index = getWindowNum(window);
tidyIconArray(index);
_fcsData1[index] = 0;
}
void SimonEngine::print_char_helper_6(uint i) {
void SimonEngine::tidyIconArray(uint i) {
WindowBlock *window;
if (_fcsData2[i]) {
@ -287,7 +286,7 @@ void SimonEngine::showMessageFormat(const char *s, ...) {
va_end(va);
if (!_fcsData1[_curWindow]) {
showmessage_helper_2();
openTextWindow();
if (!_showMessageFlag) {
_windowArray[0] = _textWindow;
if (getGameType() == GType_FF)
@ -307,11 +306,14 @@ void SimonEngine::showmessage_print_char(byte chr) {
if (chr == 12) {
_numLettersToPrint = 0;
_printCharCurPos = 0;
_printCharPixelCount = 0;
print_char_helper_1(&chr, 1);
print_char_helper_5(_textWindow);
} else if (chr == 0 || chr == ' ' || chr == 10) {
if (_printCharMaxPos - _printCharCurPos >= _numLettersToPrint) {
_printCharCurPos += _numLettersToPrint;
uint count = (getGameType() == GType_FF) ? _printCharPixelCount : _numLettersToPrint;
if (_printCharMaxPos - _printCharCurPos >= count) {
_printCharCurPos += count;
print_char_helper_1(_lettersToPrintBuf, _numLettersToPrint);
if (_printCharCurPos == _printCharMaxPos) {
@ -326,7 +328,7 @@ void SimonEngine::showmessage_print_char(byte chr) {
}
} else {
const byte newline_character = 10;
_printCharCurPos = _numLettersToPrint;
_printCharCurPos = count;
print_char_helper_1(&newline_character, 1);
print_char_helper_1(_lettersToPrintBuf, _numLettersToPrint);
if (chr == ' ') {
@ -338,14 +340,15 @@ void SimonEngine::showmessage_print_char(byte chr) {
}
}
_numLettersToPrint = 0;
_printCharPixelCount = 0;
} else {
if (getGameType() == GType_FF)
_printCharCurPos += feebleFontSize[chr - 32];
_lettersToPrintBuf[_numLettersToPrint++] = chr;
if (getGameType() == GType_FF)
_printCharPixelCount += feebleFontSize[chr - 32];
}
}
void SimonEngine::showmessage_helper_2() {
void SimonEngine::openTextWindow() {
if (_textWindow)
return;
@ -358,6 +361,7 @@ void SimonEngine::showmessage_helper_2() {
void SimonEngine::showmessage_helper_3(uint a, uint b) {
_printCharCurPos = a;
_printCharMaxPos = b;
_printCharPixelCount = 0;
_numLettersToPrint = 0;
_newLines = 0;
}
@ -437,10 +441,10 @@ void SimonEngine::videoPutchar(WindowBlock *window, byte c, byte b) {
void SimonEngine::video_putchar_newline(WindowBlock *window) {
if (getGameType() == GType_FF) {
if (_noOracleScroll == 0) {
if (window->textRow + 30 > window->height) {
if (getBitFlag(94) == false) {
if (window->height < window->textRow + 30) {
if (!getBitFlag(94)) {
_noOracleScroll = 1;
if (getBitFlag(92) == true) {
if (getBitFlag(92)) {
_noOracleScroll = 0;
checkLinkBox();
scrollOracle();
@ -465,9 +469,9 @@ void SimonEngine::video_putchar_newline(WindowBlock *window) {
window->textRow++;
}
window->textColumn = 0;
window->textColumnOffset = 0;
window->textLength = 0;
window->textColumn = 0;
}
#ifdef PALMOS_68K
@ -1294,6 +1298,10 @@ void SimonEngine::video_putchar_drawchar(WindowBlock *window, uint x, uint y, by
byte color, *dst;
uint h, i;
// FIXME
//if (_noOracleScroll)
// return;
_lockWord |= 0x8000;
dst = getFrontBuf();

View File

@ -224,7 +224,7 @@ static const byte _simon2_cursors[10][256] = {
};
void SimonEngine::drawMousePointer() {
debug(0, "Mouse %d Anim %d Max %d", _mouseCursor, _mouseAnim, _mouseAnimMax);
//debug(0, "Mouse %d Anim %d Max %d", _mouseCursor, _mouseAnim, _mouseAnimMax);
if (getGameType() == GType_SIMON2)
_system->setMouseCursor(_simon2_cursors[_mouseCursor], 16, 16, 7, 7);

View File

@ -224,7 +224,7 @@ static const char *const simon1dos_opcode_name_table[256] = {
"IBW|SET_ITEM_PROP",
NULL,
/* 160 */
"B|UNK_160",
"B|SET_INK",
"BWBW|SETUP_TEXT",
"BBT|PRINT_STR",
"W|SOUND_1",
@ -462,7 +462,7 @@ static const char *const simon1talkie_opcode_name_table[256] = {
"IBW|SET_ITEM_PROP",
NULL,
/* 160 */
"B|UNK_160",
"B|SET_INK",
"BWBW|SETUP_TEXT",
"BBTW|PRINT_STR",
"W|SOUND_1",
@ -700,7 +700,7 @@ static const char *const simon2dos_opcode_name_table[256] = {
"IBW|SET_ITEM_PROP",
NULL,
/* 160 */
"B|UNK_160",
"B|SET_INK",
"BWBW|SETUP_TEXT",
"BBT|PRINT_STR",
"W|SOUND_1",
@ -942,7 +942,7 @@ static const char *const simon2talkie_opcode_name_table[256] = {
"IBW|SET_ITEM_PROP",
NULL,
/* 160 */
"B|UNK_160",
"B|SET_INK",
"BWBW|SETUP_TEXT",
"BBTW|PRINT_STR",
"W|SOUND_1",
@ -1184,7 +1184,7 @@ static const char *const feeblefiles_opcode_name_table[256] = {
"IBW|SET_ITEM_PROP",
NULL,
/* 160 */
"B|UNK_160",
"B|SET_INK",
"BWWW|SETUP_TEXT",
"BBTW|PRINT_STR",
"W|SOUND_1",

View File

@ -1936,6 +1936,8 @@ void SimonEngine::o_unk_103() {
showMessageFormat("\x0E");
else
showMessageFormat("\x0C");
_oracleMaxScrollY = 0;
_noOracleScroll = 0;
mouseOn();
}

View File

@ -47,8 +47,8 @@ void SimonEngine::hyperLinkOn(uint16 x) {
return;
_hyperLink = x;
_variableArray[50] = _textWindow->textColumn+_textWindow->x;
_variableArray[51] = _textWindow->textRow+_textWindow->y + (_oracleMaxScrollY - _textWindow->scrollY) * 15;
_variableArray[50] = _textWindow->textColumn + _textWindow->x;
_variableArray[51] = _textWindow->textRow + _textWindow->y + (_oracleMaxScrollY - _textWindow->scrollY) * 15;
}

View File

@ -268,7 +268,7 @@ SimonEngine::SimonEngine(OSystem *syst)
_scrollHeight = 0;
_scrollWidth = 0;
_scrollImage = 0;
_vgaVar8 = 0;
_boxStarHeight = 0;
_scriptVerb = 0;
_scriptNoun1 = 0;
@ -289,7 +289,6 @@ SimonEngine::SimonEngine(OSystem *syst)
_lastHitArea = 0;
_lastNameOn = 0;
_lastHitArea3 = 0;
_leftButtonDown = 0;
_hitAreaSubjectItem = 0;
_currentVerbBox = 0;
_lastVerbOn = 0;
@ -302,6 +301,7 @@ SimonEngine::SimonEngine(OSystem *syst)
_printCharCurPos = 0;
_printCharMaxPos = 0;
_printCharPixelCount = 0;
_numLettersToPrint = 0;
_lastTime = 0;
@ -316,6 +316,8 @@ SimonEngine::SimonEngine(OSystem *syst)
_mouseXOld = 0;
_mouseYOld = 0;
_leftButtonDown = 0;
_rightButtonDown = 0;
_noRightClick = false;
_dummyItem1 = new Item();
@ -1667,14 +1669,14 @@ void SimonEngine::endCutscene() {
_runScriptReturn1 = true;
}
uint SimonEngine::get_fcs_ptr_3_index(WindowBlock *window) {
uint SimonEngine::getWindowNum(WindowBlock *window) {
uint i;
for (i = 0; i != ARRAYSIZE(_windowArray); i++)
if (_windowArray[i] == window)
return i;
error("get_fcs_ptr_3_index: not found");
error("getWindowNum: not found");
return 0;
}
@ -1843,7 +1845,7 @@ void SimonEngine::displayBoxStars() {
continue;
}
if (ha->y >= limit || ((getGameType() == GType_SIMON2) && ha->y >= _vgaVar8))
if (ha->y >= limit || ((getGameType() == GType_SIMON2) && ha->y >= _boxStarHeight))
continue;
y_ = (ha->height / 2) - 4 + ha->y;
@ -2405,7 +2407,7 @@ void SimonEngine::set_video_mode_internal(uint mode, uint vga_res_id) {
else
num_lines = _windowNum == 4 ? 134 : 200;
_vgaVar8 = num_lines;
_boxStarHeight = num_lines;
dx_copy_from_attached_to_2(0, 0, _screenWidth, num_lines);
dx_copy_from_attached_to_3(num_lines);
_syncFlag2 = 1;
@ -3021,23 +3023,23 @@ void SimonEngine::clearWindow(WindowBlock *window) {
window->textRow = 0;
window->textColumnOffset = 0;
window->textLength = 0;
window->scrollY = 0;
}
void SimonEngine::restoreWindow(WindowBlock *window) {
_lockWord |= 0x8000;
if (getGameType() == GType_SIMON1) {
restoreBlock(window->y + window->height * 8 + ((window == _windowArray[2]) ? 1 : 0), (window->x + window->width) * 8, window->y, window->x * 8);
} else {
if (getGameType() == GType_FF) {
restoreBlock(window->y + window->height, window->x + window->width, window->y, window->x);
} else if (getGameType() == GType_SIMON2) {
if (_restoreWindow6 && _windowArray[2] == window) {
window = _windowArray[6];
_restoreWindow6 = 0;
}
if (getGameType() == GType_FF)
restoreBlock(window->y + window->height, window->x + window->width, window->y, window->x);
else
restoreBlock(window->y + window->height * 8, (window->x + window->width) * 8, window->y, window->x * 8);
restoreBlock(window->y + window->height * 8, (window->x + window->width) * 8, window->y, window->x * 8);
} else {
restoreBlock(window->y + window->height * 8 + ((window == _windowArray[2]) ? 1 : 0), (window->x + window->width) * 8, window->y, window->x * 8);
}
_lockWord &= ~0x8000;
@ -3053,18 +3055,24 @@ void SimonEngine::colorWindow(WindowBlock *window) {
if (getGameType() == GType_FF) {
dst += _dxSurfacePitch * window->y + window->x;
h = window->height;
w = window->width;
for (h = 0; h < window->height; h++) {
for (w = 0; w < window->width; w++) {
if (dst[w] == 113 || dst[w] == 116 || dst[w] == 252)
dst[w] = window->fill_color;
}
dst += _screenWidth;
}
} else {
dst += _dxSurfacePitch * window->y + window->x * 8;
h = window->height * 8;
w = window->width * 8;
}
do {
memset(dst, window->fill_color, w);
dst += _dxSurfacePitch;
} while (--h);
do {
memset(dst, window->fill_color, w);
dst += _dxSurfacePitch;
} while (--h);
}
_lockWord &= ~0x8000;
}
@ -3695,7 +3703,7 @@ void SimonEngine::runSubroutine101() {
permitInput();
}
void SimonEngine::restoreBlock(uint b, uint r, uint y, uint x) {
void SimonEngine::restoreBlock(uint h, uint w, uint y, uint x) {
byte *dst, *src;
uint i;
@ -3705,8 +3713,8 @@ void SimonEngine::restoreBlock(uint b, uint r, uint y, uint x) {
dst += y * _dxSurfacePitch;
src += y * _dxSurfacePitch;
while (y < b) {
for (i = x; i < r; i++)
while (y < h) {
for (i = x; i < w; i++)
dst[i] = src[i];
y++;
dst += _dxSurfacePitch;

View File

@ -272,7 +272,7 @@ protected:
int _scrollY, _scrollYMax, _scrollHeight;
int _scrollCount, _scrollFlag;
const byte *_scrollImage;
byte _vgaVar8;
byte _boxStarHeight;
uint16 _hyperLink, _newLines;
uint16 _oracleMaxScrollY, _noOracleScroll;
@ -291,8 +291,6 @@ protected:
HitArea *_lastHitArea;
HitArea *_lastNameOn;
HitArea *_lastHitArea3;
byte _leftButtonDown;
byte _rightButtonDown;
Item *_hitAreaSubjectItem;
HitArea *_currentVerbBox, *_lastVerbOn;
uint _needHitAreaRecalc;
@ -304,7 +302,7 @@ protected:
uint16 _windowNum;
uint _printCharCurPos, _printCharMaxPos;
uint _printCharCurPos, _printCharMaxPos, _printCharPixelCount;
uint _numLettersToPrint;
uint _lastTime;
@ -316,6 +314,10 @@ protected:
int _mouseX, _mouseY;
int _mouseXOld, _mouseYOld;
byte _leftButtonDown;
byte _rightButtonDown;
bool _noRightClick;
Item *_dummyItem1;
Item *_dummyItem2;
Item *_dummyItem3;
@ -334,7 +336,6 @@ protected:
bool _fastFadeOutFlag;
bool _unkPalFlag;
bool _exitCutscene;
bool _noRightClick;
byte _paletteFlag;
uint _soundFileId;
@ -660,7 +661,7 @@ protected:
void read_vga_from_datfile_1(uint vga_id);
uint get_fcs_ptr_3_index(WindowBlock *window);
uint getWindowNum(WindowBlock *window);
void setup_hitarea_from_pos(uint x, uint y, uint mode);
void displayName(HitArea * ha);
@ -1037,7 +1038,7 @@ protected:
void restoreWindow(WindowBlock *window);
void colorWindow(WindowBlock *window);
void restoreBlock(uint b, uint r, uint y, uint x);
void restoreBlock(uint h, uint w, uint y, uint x);
byte *getFrontBuf();
byte *getBackBuf();
@ -1087,8 +1088,8 @@ protected:
bool saveGame(uint slot, char *caption);
bool loadGame(uint slot);
void showmessage_helper_2();
void print_char_helper_6(uint i);
void openTextWindow();
void tidyIconArray(uint i);
void video_putchar_newline(WindowBlock *window);
void video_putchar_drawchar(WindowBlock *window, uint x, uint y, byte chr);

View File

@ -526,7 +526,7 @@ void SimonEngine::checkUp(WindowBlock *window) {
k = (((_variableArray[31] / 52) - 2) % 3);
j = k * 6;
if (!is_hitarea_0x40_clear(j + 201)) {
uint index = get_fcs_ptr_3_index(window);
uint index = getWindowNum(window);
drawIconArray(index, window->iconPtr->itemRef, 0, window->iconPtr->classMask);
loadSprite(4, 9, k + 34, 0, 0, 0);
}
@ -552,7 +552,7 @@ void SimonEngine::checkDown(WindowBlock *window) {
uint16 j, k;
if (((_variableArray[31] - _variableArray[30]) == 24) && (_iOverflow == 1)) {
uint index = get_fcs_ptr_3_index(window);
uint index = getWindowNum(window);
drawIconArray(index, window->iconPtr->itemRef, 0, window->iconPtr->classMask);
k = ((_variableArray[31] / 52) % 3);
loadSprite(4, 9, k + 25, 0, 0, 0);
@ -593,7 +593,7 @@ void SimonEngine::inventoryUp(WindowBlock *window) {
return;
mouseOff();
uint index = get_fcs_ptr_3_index(window);
uint index = getWindowNum(window);
drawIconArray(index, window->iconPtr->itemRef, window->iconPtr->line - 1, window->iconPtr->classMask);
mouseOn();
}
@ -616,7 +616,7 @@ void SimonEngine::inventoryDown(WindowBlock *window) {
checkDown(window);
} else {
mouseOff();
uint index = get_fcs_ptr_3_index(window);
uint index = getWindowNum(window);
drawIconArray(index, window->iconPtr->itemRef, window->iconPtr->line + 1, window->iconPtr->classMask);
mouseOn();
}