svn-id: r21640
This commit is contained in:
Travis Howell 2006-04-06 10:47:37 +00:00
parent dd9f4d9f99
commit 87de34a8d5
7 changed files with 182 additions and 204 deletions

View file

@ -37,7 +37,7 @@ void SimonEngine::print_char_helper_1(const byte *src, uint len) {
if (getBitFlag(93)) { if (getBitFlag(93)) {
if (_curWindow == 3) { if (_curWindow == 3) {
if ((_newLines >= _textWindow->scrollY) && (_newLines < (_textWindow->scrollY + 3))) if ((_newLines >= _textWindow->scrollY) && (_newLines < (_textWindow->scrollY + 3)))
fcs_putchar(*src); windowPutChar(*src);
if (*src == '\n') // Do two top lines of text only if (*src == '\n') // Do two top lines of text only
_newLines++; _newLines++;
src++; src++;
@ -46,7 +46,7 @@ void SimonEngine::print_char_helper_1(const byte *src, uint len) {
if (getBitFlag(94)) { if (getBitFlag(94)) {
if (_curWindow == 3) { if (_curWindow == 3) {
if (_newLines == (_textWindow->scrollY + 7)) if (_newLines == (_textWindow->scrollY + 7))
fcs_putchar(*src); windowPutChar(*src);
if (*src == '\n') // Do two top lines of text only if (*src == '\n') // Do two top lines of text only
_newLines++; _newLines++;
src++; src++;
@ -54,7 +54,7 @@ void SimonEngine::print_char_helper_1(const byte *src, uint len) {
} else { } else {
//if (getBitFlag(92)) //if (getBitFlag(92))
// while(!_nextCharacter); // while(!_nextCharacter);
fcs_putchar(*src++); windowPutChar(*src++);
//_nextCharacter = false; //_nextCharacter = false;
} }
} }
@ -66,7 +66,7 @@ void SimonEngine::print_char_helper_1(const byte *src, uint len) {
_fcsData2[ind] = 1; _fcsData2[ind] = 1;
} }
fcs_putchar(*src++); windowPutChar(*src++);
} }
} }
} }
@ -346,7 +346,7 @@ void SimonEngine::showmessage_helper_3(uint a, uint b) {
_newLines = 0; _newLines = 0;
} }
void SimonEngine::video_putchar(WindowBlock *window, byte c, byte b) { void SimonEngine::videoPutchar(WindowBlock *window, byte c, byte b) {
byte width = 6; byte width = 6;
if (c == 12) { if (c == 12) {

View file

@ -553,7 +553,7 @@ void SimonEngine::removeIconArray(uint num) {
if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) { if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
changeWindow(num); changeWindow(num);
fcs_putchar(12); windowPutChar(12);
changeWindow(curWindow); changeWindow(curWindow);
} }

View file

@ -1533,93 +1533,6 @@ void SimonEngine::o_unlockZone() {
_vgaBufStart = _vgaFileBufOrg; _vgaBufStart = _vgaFileBufOrg;
} }
int SimonEngine::o_unk_132_helper(bool *b, char *buf) {
HitArea *ha;
*b = true;
if (!_saveLoadFlag) {
strange_jump:;
_saveLoadFlag = false;
saveGameDialog(buf);
}
start_over:;
_keyPressed = 0;
start_over_2:;
_lastHitArea = _lastHitArea3 = 0;
do {
if (_keyPressed != 0) {
if (_saveLoadFlag) {
*b = false;
return _keyPressed;
}
goto start_over;
}
delay(100);
} while (_lastHitArea3 == 0);
ha = _lastHitArea;
if (ha == NULL || ha->id < 205)
goto start_over_2;
if (ha->id == 205)
return ha->id;
if (ha->id == 206) {
if (_saveLoadRowCurPos == 1)
goto start_over_2;
if (_saveLoadRowCurPos < 7)
_saveLoadRowCurPos = 1;
else
_saveLoadRowCurPos -= 6;
goto strange_jump;
}
if (ha->id == 207) {
if (!_saveDialogFlag)
goto start_over_2;
_saveLoadRowCurPos += 6;
if (_saveLoadRowCurPos >= _numSaveGameRows)
_saveLoadRowCurPos = _numSaveGameRows;
goto strange_jump;
}
if (ha->id >= 214)
goto start_over_2;
return ha->id - 208;
}
void SimonEngine::o_unk_132_helper_3() {
for (int i = 208; i != 208 + 6; i++)
set_hitarea_bit_0x40(i);
}
void SimonEngine::o_clearCharacter(WindowBlock *window, int x, byte b) {
byte old_text;
video_putchar(window, x, b);
old_text = window->text_color;
window->text_color = window->fill_color;
if (_language == Common::HB_ISR) { //Hebrew
x = 128;
} else {
x += 120;
if (x != 128)
x = 129;
}
video_putchar(window, x);
window->text_color = old_text;
video_putchar(window, 8);
}
void SimonEngine::o_playMusic() { void SimonEngine::o_playMusic() {
int music = getVarOrWord(); int music = getVarOrWord();
int track = getVarOrWord(); int track = getVarOrWord();

View file

@ -180,7 +180,7 @@ void SimonEngine::saveOrLoadDialog(bool load) {
int number_of_savegames; int number_of_savegames;
int i; int i;
int unk132_result; int unk132_result;
WindowBlock *fcs; WindowBlock *window;
char *name; char *name;
int name_len; int name_len;
bool b; bool b;
@ -224,20 +224,20 @@ restart:;
// some code here // some code here
fcs = _windowArray[5]; window = _windowArray[5];
fcs->textRow = unk132_result; window->textRow = unk132_result;
if (_language == Common::HB_ISR) { //Hebrew if (_language == Common::HB_ISR) { //Hebrew
// init x offset with a 2 character savegame number + a period (18 pix) // init x offset with a 2 character savegame number + a period (18 pix)
fcs->textColumn = 3; window->textColumn = 3;
fcs->textColumnOffset = 6; window->textColumnOffset = 6;
fcs->textLength = 3; window->textLength = 3;
} else { } else {
// init x offset with a 2 character savegame number + a period (18 pix) // init x offset with a 2 character savegame number + a period (18 pix)
fcs->textColumn = 2; window->textColumn = 2;
fcs->textColumnOffset = 2; window->textColumnOffset = 2;
fcs->textLength = 3; window->textLength = 3;
} }
name = buf + i * 18; name = buf + i * 18;
@ -249,20 +249,20 @@ restart:;
byte width = 6; byte width = 6;
if (name[name_len] >= 64 && name[name_len] < 91) if (name[name_len] >= 64 && name[name_len] < 91)
width = _hebrew_char_widths [name[name_len] - 64]; width = _hebrew_char_widths [name[name_len] - 64];
fcs->textLength++; window->textLength++;
fcs->textColumnOffset -= width; window->textColumnOffset -= width;
if (fcs->textColumnOffset < width) { if (window->textColumnOffset < width) {
fcs->textColumnOffset += 8; window->textColumnOffset += 8;
fcs->textColumn++; window->textColumn++;
} }
} else { } else {
fcs->textLength++; window->textLength++;
fcs->textColumnOffset += 6; window->textColumnOffset += 6;
if (name[name_len] == 'i' || name[name_len] == 'l') if (name[name_len] == 'i' || name[name_len] == 'l')
fcs->textColumnOffset -= 2; window->textColumnOffset -= 2;
if (fcs->textColumnOffset >= 8) { if (window->textColumnOffset >= 8) {
fcs->textColumnOffset -= 8; window->textColumnOffset -= 8;
fcs->textColumn++; window->textColumn++;
} }
} }
name_len++; name_len++;
@ -271,7 +271,7 @@ restart:;
// do_3_start // do_3_start
for (;;) { for (;;) {
video_putchar(fcs, 0x7f); videoPutchar(window, 0x7f);
_saveLoadFlag = true; _saveLoadFlag = true;
@ -322,7 +322,7 @@ restart:;
} else if (i >= 32 && name_len != 17) { } else if (i >= 32 && name_len != 17) {
name[name_len++] = i; name[name_len++] = i;
video_putchar(_windowArray[5], i); videoPutchar(_windowArray[5], i);
} }
} }
@ -350,7 +350,94 @@ get_out:;
g_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false); g_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false);
} }
void SimonEngine::o_fileError(WindowBlock *fcs, bool save_error) { int SimonEngine::o_unk_132_helper(bool *b, char *buf) {
HitArea *ha;
*b = true;
if (!_saveLoadFlag) {
strange_jump:;
_saveLoadFlag = false;
saveGameDialog(buf);
}
start_over:;
_keyPressed = 0;
start_over_2:;
_lastHitArea = _lastHitArea3 = 0;
do {
if (_keyPressed != 0) {
if (_saveLoadFlag) {
*b = false;
return _keyPressed;
}
goto start_over;
}
delay(100);
} while (_lastHitArea3 == 0);
ha = _lastHitArea;
if (ha == NULL || ha->id < 205)
goto start_over_2;
if (ha->id == 205)
return ha->id;
if (ha->id == 206) {
if (_saveLoadRowCurPos == 1)
goto start_over_2;
if (_saveLoadRowCurPos < 7)
_saveLoadRowCurPos = 1;
else
_saveLoadRowCurPos -= 6;
goto strange_jump;
}
if (ha->id == 207) {
if (!_saveDialogFlag)
goto start_over_2;
_saveLoadRowCurPos += 6;
if (_saveLoadRowCurPos >= _numSaveGameRows)
_saveLoadRowCurPos = _numSaveGameRows;
goto strange_jump;
}
if (ha->id >= 214)
goto start_over_2;
return ha->id - 208;
}
void SimonEngine::o_unk_132_helper_3() {
for (int i = 208; i != 208 + 6; i++)
set_hitarea_bit_0x40(i);
}
void SimonEngine::o_clearCharacter(WindowBlock *window, int x, byte b) {
byte old_text;
videoPutchar(window, x, b);
old_text = window->text_color;
window->text_color = window->fill_color;
if (_language == Common::HB_ISR) { //Hebrew
x = 128;
} else {
x += 120;
if (x != 128)
x = 129;
}
videoPutchar(window, x);
window->text_color = old_text;
videoPutchar(window, 8);
}
void SimonEngine::o_fileError(WindowBlock *window, bool save_error) {
HitArea *ha; HitArea *ha;
const char *string, *string2; const char *string, *string2;
@ -362,23 +449,23 @@ void SimonEngine::o_fileError(WindowBlock *fcs, bool save_error) {
string2 = "\r File not found."; string2 = "\r File not found.";
} }
video_putchar(fcs, 0xC); videoPutchar(window, 0xC);
for (; *string; string++) for (; *string; string++)
video_putchar(fcs, *string); videoPutchar(window, *string);
for (; *string2; string2++) for (; *string2; string2++)
video_putchar(fcs, *string2); videoPutchar(window, *string2);
fcs->textColumn = (fcs->width >> 1) - 3; window->textColumn = (window->width / 2) - 3;
fcs->textRow = fcs->height - 1; window->textRow = window->height - 1;
fcs->textLength = 0; window->textLength = 0;
string = "[ OK ]"; string = "[ OK ]";
for (; *string; string++) for (; *string; string++)
video_putchar(fcs, *string); videoPutchar(window, *string);
ha = findEmptyHitArea(); ha = findEmptyHitArea();
ha->x = ((fcs->width >> 1) + (fcs->x - 3)) << 3; ha->x = ((window->width >> 1) + (window->x - 3)) * 8;
ha->y = (fcs->height << 3) + fcs->y - 8; ha->y = (window->height << 3) + window->y - 8;
ha->width = 48; ha->width = 48;
ha->height = 8; ha->height = 8;
ha->flags = 0x20; ha->flags = 0x20;

View file

@ -291,7 +291,7 @@ SimonEngine::SimonEngine(OSystem *syst)
_leftButtonDown = 0; _leftButtonDown = 0;
_hitAreaSubjectItem = 0; _hitAreaSubjectItem = 0;
_currentVerbBox = 0; _currentVerbBox = 0;
_hitAreaPtr7 = 0; _lastVerbOn = 0;
_needHitAreaRecalc = 0; _needHitAreaRecalc = 0;
_verbHitArea = 0; _verbHitArea = 0;
_defaultVerb = 0; _defaultVerb = 0;
@ -418,7 +418,7 @@ SimonEngine::SimonEngine(OSystem *syst)
memset(_videoBuf1, 0, sizeof(_videoBuf1)); memset(_videoBuf1, 0, sizeof(_videoBuf1));
_fcs_list = new WindowBlock[16]; _windowList = new WindowBlock[16];
memset(_lettersToPrintBuf, 0, sizeof(_lettersToPrintBuf)); memset(_lettersToPrintBuf, 0, sizeof(_lettersToPrintBuf));
@ -658,7 +658,7 @@ SimonEngine::~SimonEngine() {
delete _dummyItem2; delete _dummyItem2;
delete _dummyItem3; delete _dummyItem3;
delete [] _fcs_list; delete [] _windowList;
delete _sound; delete _sound;
delete _debugger; delete _debugger;
@ -1687,7 +1687,7 @@ void SimonEngine::mouseOn() {
_lockWord &= ~1; _lockWord &= ~1;
} }
void SimonEngine::handle_mouse_moved() { void SimonEngine::handleMouseMoved() {
uint x; uint x;
if (_mouseHideCount) { if (_mouseHideCount) {
@ -1740,16 +1740,15 @@ void SimonEngine::handle_mouse_moved() {
setVerb(NULL); setVerb(NULL);
} }
} }
if (getGameType() == GType_SIMON2) { if (getGameType() == GType_SIMON2) {
if (getBitFlag(79)) { if (getBitFlag(79)) {
if (!_vgaVar9) { if (!_vgaVar9) {
if (_mouseX >= 630 / 2 || _mouseX < 9) if (_mouseX >= 315 || _mouseX < 9)
goto get_out2; goto get_out2;
_vgaVar9 = 1; _vgaVar9 = 1;
} }
if (_scrollCount == 0) { if (_scrollCount == 0) {
if (_mouseX >= 631 / 2) { if (_mouseX >= 315) {
if (_scrollX != _scrollXMax) if (_scrollX != _scrollXMax)
_scrollFlag = 1; _scrollFlag = 1;
} else if (_mouseX < 8) { } else if (_mouseX < 8) {
@ -1801,7 +1800,7 @@ uint SimonEngine::itemGetIconNumber(Item *item) {
return child->array[offs]; return child->array[offs];
} }
void SimonEngine::f10_key() { void SimonEngine::displayBoxStars() {
HitArea *ha, *dha; HitArea *ha, *dha;
uint count; uint count;
uint y_, x_; uint y_, x_;
@ -1918,7 +1917,7 @@ startOver:
for (;;) { for (;;) {
if (_keyPressed == 35) if (_keyPressed == 35)
f10_key(); displayBoxStars();
processSpecialKeys(); processSpecialKeys();
if (_lastHitArea3 == (HitArea *) -1) if (_lastHitArea3 == (HitArea *) -1)
goto startOver; goto startOver;
@ -1981,7 +1980,7 @@ void SimonEngine::hitarea_stuff_helper() {
Subroutine *sub = getSubroutineByID(subr_id); Subroutine *sub = getSubroutineByID(subr_id);
if (sub != NULL) { if (sub != NULL) {
startSubroutineEx(sub); startSubroutineEx(sub);
startUp_helper_2(); permitInput();
} }
_variableArray[254] = 0; _variableArray[254] = 0;
_runScriptReturn1 = false; _runScriptReturn1 = false;
@ -1996,7 +1995,7 @@ void SimonEngine::hitarea_stuff_helper() {
if ((uint) cur_time != _lastTime) { if ((uint) cur_time != _lastTime) {
_lastTime = cur_time; _lastTime = cur_time;
if (kickoffTimeEvents()) if (kickoffTimeEvents())
startUp_helper_2(); permitInput();
} }
} }
@ -2011,7 +2010,7 @@ void SimonEngine::hitarea_stuff_helper_2() {
if (sub != NULL) { if (sub != NULL) {
_variableArray[249] = 0; _variableArray[249] = 0;
startSubroutineEx(sub); startSubroutineEx(sub);
startUp_helper_2(); permitInput();
} }
_variableArray[249] = 0; _variableArray[249] = 0;
} }
@ -2022,7 +2021,7 @@ void SimonEngine::hitarea_stuff_helper_2() {
if (sub != NULL) { if (sub != NULL) {
_variableArray[254] = 0; _variableArray[254] = 0;
startSubroutineEx(sub); startSubroutineEx(sub);
startUp_helper_2(); permitInput();
} }
_variableArray[254] = 0; _variableArray[254] = 0;
} }
@ -2030,7 +2029,7 @@ void SimonEngine::hitarea_stuff_helper_2() {
_runScriptReturn1 = false; _runScriptReturn1 = false;
} }
void SimonEngine::startUp_helper_2() { void SimonEngine::permitInput() {
if (!_mortalFlag) { if (!_mortalFlag) {
_mortalFlag = true; _mortalFlag = true;
showmessage_print_char(0); showmessage_print_char(0);
@ -2051,7 +2050,7 @@ void SimonEngine::pollMouseXY() {
_mouseY = _sdlMouseY; _mouseY = _sdlMouseY;
} }
void SimonEngine::handle_verb_clicked(uint verb) { void SimonEngine::handleVerbClicked(uint verb) {
Subroutine *sub; Subroutine *sub;
int result; int result;
@ -2106,7 +2105,7 @@ void SimonEngine::handle_verb_clicked(uint verb) {
if (getGameType() == GType_SIMON2 || getGameType() == GType_FF) if (getGameType() == GType_SIMON2 || getGameType() == GType_FF)
_runScriptReturn1 = false; _runScriptReturn1 = false;
startUp_helper_2(); permitInput();
} }
TextLocation *SimonEngine::getTextLocation(uint a) { TextLocation *SimonEngine::getTextLocation(uint a) {
@ -2786,7 +2785,7 @@ void SimonEngine::timer_proc1() {
swapCharacterLogo(); swapCharacterLogo();
} }
} }
handle_mouse_moved(); handleMouseMoved();
dx_update_screen_and_palette(); dx_update_screen_and_palette();
_updateScreen = false; _updateScreen = false;
} }
@ -2847,7 +2846,6 @@ bool SimonEngine::vc_maybe_skip_proc_1(uint16 a, int16 b) {
return item->state == b; return item->state == b;
} }
// OK
void SimonEngine::closeWindow(uint a) { void SimonEngine::closeWindow(uint a) {
if (_windowArray[a] == NULL) if (_windowArray[a] == NULL)
return; return;
@ -2860,7 +2858,6 @@ void SimonEngine::closeWindow(uint a) {
} }
} }
// OK
void SimonEngine::changeWindow(uint a) { void SimonEngine::changeWindow(uint a) {
a &= 7; a &= 7;
@ -2877,11 +2874,10 @@ void SimonEngine::changeWindow(uint a) {
showmessage_helper_3(_textWindow->textLength, _textWindow->textMaxLength); showmessage_helper_3(_textWindow->textLength, _textWindow->textMaxLength);
} }
// OK
WindowBlock *SimonEngine::openWindow(uint x, uint y, uint w, uint h, uint flags, uint fill_color, uint text_color) { WindowBlock *SimonEngine::openWindow(uint x, uint y, uint w, uint h, uint flags, uint fill_color, uint text_color) {
WindowBlock *window; WindowBlock *window;
window = _fcs_list; window = _windowList;
while (window->mode != 0) while (window->mode != 0)
window++; window++;
@ -2965,19 +2961,16 @@ void SimonEngine::o_pathfind(int x, int y, uint var_1, uint var_2) {
} }
} }
// ok
void SimonEngine::delete_hitarea_by_index(uint index) { void SimonEngine::delete_hitarea_by_index(uint index) {
CHECK_BOUNDS(index, _hitAreas); CHECK_BOUNDS(index, _hitAreas);
_hitAreas[index].flags = 0; _hitAreas[index].flags = 0;
} }
// ok void SimonEngine::windowPutChar(uint a) {
void SimonEngine::fcs_putchar(uint a) {
if (_textWindow != _windowArray[0]) if (_textWindow != _windowArray[0])
video_putchar(_textWindow, a); videoPutchar(_textWindow, a);
} }
// ok
void SimonEngine::clearWindow(WindowBlock *window) { void SimonEngine::clearWindow(WindowBlock *window) {
if (window->flags & 0x10) if (window->flags & 0x10)
restoreWindow(window); restoreWindow(window);
@ -2990,7 +2983,6 @@ void SimonEngine::clearWindow(WindowBlock *window) {
window->textLength = 0; window->textLength = 0;
} }
// ok
void SimonEngine::restoreWindow(WindowBlock *window) { void SimonEngine::restoreWindow(WindowBlock *window) {
_lockWord |= 0x8000; _lockWord |= 0x8000;
@ -3738,7 +3730,7 @@ void SimonEngine::openGameFile() {
vc34_setMouseOff(); vc34_setMouseOff();
runSubroutine101(); runSubroutine101();
startUp_helper_2(); permitInput();
} }
void SimonEngine::runSubroutine101() { void SimonEngine::runSubroutine101() {
@ -3748,7 +3740,7 @@ void SimonEngine::runSubroutine101() {
if (sub != NULL) if (sub != NULL)
startSubroutineEx(sub); startSubroutineEx(sub);
startUp_helper_2(); permitInput();
} }
void SimonEngine::restoreBlock(uint b, uint r, uint y, uint x) { void SimonEngine::restoreBlock(uint b, uint r, uint y, uint x) {
@ -3940,7 +3932,7 @@ int SimonEngine::go() {
while (1) { while (1) {
hitarea_stuff(); hitarea_stuff();
handle_verb_clicked(_verbHitArea); handleVerbClicked(_verbHitArea);
delay(100); delay(100);
} }

View file

@ -285,7 +285,7 @@ protected:
byte _leftButtonDown; byte _leftButtonDown;
byte _rightButtonDown; byte _rightButtonDown;
Item *_hitAreaSubjectItem; Item *_hitAreaSubjectItem;
HitArea *_currentVerbBox, *_hitAreaPtr7; HitArea *_currentVerbBox, *_lastVerbOn;
uint _needHitAreaRecalc; uint _needHitAreaRecalc;
uint _verbHitArea; uint _verbHitArea;
uint16 _defaultVerb; uint16 _defaultVerb;
@ -407,7 +407,7 @@ protected:
VgaTimerEntry _vgaTimerList[95]; VgaTimerEntry _vgaTimerList[95];
WindowBlock *_fcs_list; WindowBlock *_windowList;
byte _lettersToPrintBuf[80]; byte _lettersToPrintBuf[80];
@ -639,12 +639,12 @@ protected:
void checkDown(WindowBlock *window); void checkDown(WindowBlock *window);
void inventoryUp(WindowBlock *window); void inventoryUp(WindowBlock *window);
void inventoryDown(WindowBlock *window); void inventoryDown(WindowBlock *window);
void hitareaChangedHelper(); void resetNameWindow();
void focusVerb(uint hitarea_id); void printVerbOf(uint hitarea_id);
HitArea *findHitAreaByID(uint hitarea_id); HitArea *findHitAreaByID(uint hitarea_id);
void showActionString(uint x, const byte *string); void showActionString(const byte *string);
void video_putchar(WindowBlock *window, byte c, byte b = 0); void videoPutchar(WindowBlock *window, byte c, byte b = 0);
void clearWindow(WindowBlock *window); void clearWindow(WindowBlock *window);
void video_toggle_colors(HitArea * ha, byte a, byte b, byte c, byte d); void video_toggle_colors(HitArea * ha, byte a, byte b, byte c, byte d);
@ -656,10 +656,10 @@ protected:
void displayName(HitArea * ha); void displayName(HitArea * ha);
bool printTextOf(uint a); bool printTextOf(uint a);
bool printNameOf(Item *item); bool printNameOf(Item *item);
void f10_key(); void displayBoxStars();
void hitarea_stuff(); void hitarea_stuff();
void handle_mouse_moved(); void handleMouseMoved();
void pollMouseXY(); void pollMouseXY();
void drawMousePointer(); void drawMousePointer();
@ -675,11 +675,11 @@ protected:
void processSpecialKeys(); void processSpecialKeys();
void hitarea_stuff_helper(); void hitarea_stuff_helper();
void startUp_helper_2(); void permitInput();
void showmessage_helper_3(uint a, uint b); void showmessage_helper_3(uint a, uint b);
void showmessage_print_char(byte chr); void showmessage_print_char(byte chr);
void handle_verb_clicked(uint verb); void handleVerbClicked(uint verb);
void o_set_video_mode(uint mode, uint vga_res); void o_set_video_mode(uint mode, uint vga_res);
void set_video_mode_internal(uint mode, uint vga_res_id); void set_video_mode_internal(uint mode, uint vga_res_id);
@ -836,7 +836,7 @@ protected:
void delete_hitarea_by_index(uint index); void delete_hitarea_by_index(uint index);
void removeArrows(WindowBlock *window, uint num); void removeArrows(WindowBlock *window, uint num);
void fcs_putchar(uint a); void windowPutChar(uint a);
void restoreWindow(WindowBlock *window); void restoreWindow(WindowBlock *window);
void colorWindow(WindowBlock *window); void colorWindow(WindowBlock *window);

View file

@ -210,18 +210,17 @@ void SimonEngine::clearName() {
last = _currentVerbBox; last = _currentVerbBox;
if (last == _hitAreaPtr7) if (last == _lastVerbOn)
return; return;
hitareaChangedHelper(); resetNameWindow();
_hitAreaPtr7 = last; _lastVerbOn = last;
if (last != NULL && (ha = findHitAreaByID(200)) && (ha->flags & 0x40) && !(last->flags & 0x40)) if (last != NULL && (ha = findHitAreaByID(200)) && (ha->flags & 0x40) && !(last->flags & 0x40))
focusVerb(last->id); printVerbOf(last->id);
} }
void SimonEngine::focusVerb(uint hitarea_id) { void SimonEngine::printVerbOf(uint hitarea_id) {
uint x;
const char *txt; const char *txt;
const char * const *verb_names; const char * const *verb_names;
const char * const *verb_prep_names; const char * const *verb_prep_names;
@ -281,38 +280,42 @@ void SimonEngine::focusVerb(uint hitarea_id) {
CHECK_BOUNDS(hitarea_id, english_verb_names); CHECK_BOUNDS(hitarea_id, english_verb_names);
txt = verb_names[hitarea_id]; txt = verb_names[hitarea_id];
} }
x = (53 - strlen(txt)) * 3; showActionString((const byte *)txt);
showActionString(x, (const byte *)txt);
} }
void SimonEngine::showActionString(uint x, const byte *string) { void SimonEngine::showActionString(const byte *string) {
WindowBlock *window; WindowBlock *window;
uint x;
window = _windowArray[1]; window = _windowArray[1];
if (window == NULL || window->text_color == 0) if (window == NULL || window->text_color == 0)
return; return;
window->textColumn = x >> 3; // Arisme : hack for long strings in the French version
if ((strlen((const char*)string) - 1) <= 53)
x = (53 - (strlen((const char *)string) - 1)) * 3;
else
x = 0;
window->textColumn = x / 8;
window->textColumnOffset = x & 7; window->textColumnOffset = x & 7;
for (; *string; string++) for (; *string; string++)
video_putchar(window, *string); videoPutchar(window, *string);
} }
void SimonEngine::hitareaChangedHelper() { void SimonEngine::resetNameWindow() {
WindowBlock *window; WindowBlock *window;
if (getGameType() == GType_SIMON2) { if (getGameType() == GType_SIMON2 && getBitFlag(79))
if (getBitFlag(79)) return;
return;
}
window = _windowArray[1]; window = _windowArray[1];
if (window != NULL && window->text_color != 0) if (window != NULL && window->text_color != 0)
clearWindow(window); clearWindow(window);
_lastNameOn = NULL; _lastNameOn = NULL;
_hitAreaPtr7 = NULL; _lastVerbOn = NULL;
} }
HitArea *SimonEngine::findHitAreaByID(uint hitarea_id) { HitArea *SimonEngine::findHitAreaByID(uint hitarea_id) {
@ -574,7 +577,7 @@ void SimonEngine::inventoryUp(WindowBlock *window) {
if (getGameType() == GType_FF) { if (getGameType() == GType_FF) {
_marks = 0; _marks = 0;
checkUp(window); checkUp(window);
loadSprite(4, 9 ,21 ,0 ,0, 0); loadSprite(4, 9, 21, 0 ,0, 0);
while(1) { while(1) {
if (_currentBoxNumber != 0x7FFB || !_leftButtonDown) if (_currentBoxNumber != 0x7FFB || !_leftButtonDown)
break; break;
@ -690,7 +693,7 @@ void SimonEngine::setup_hitarea_from_pos(uint x, uint y, uint mode) {
void SimonEngine::displayName(HitArea *ha) { void SimonEngine::displayName(HitArea *ha) {
bool result; bool result;
hitareaChangedHelper(); resetNameWindow();
if (ha->flags & 1) { if (ha->flags & 1) {
result = printTextOf(ha->flags >> 8); result = printTextOf(ha->flags >> 8);
} else { } else {
@ -702,9 +705,6 @@ void SimonEngine::displayName(HitArea *ha) {
} }
bool SimonEngine::printTextOf(uint a) { bool SimonEngine::printTextOf(uint a) {
uint x;
const byte *string_ptr;
if (getGameType() == GType_SIMON2) { if (getGameType() == GType_SIMON2) {
if (getBitFlag(79)) { if (getBitFlag(79)) {
Subroutine *sub; Subroutine *sub;
@ -719,21 +719,13 @@ bool SimonEngine::printTextOf(uint a) {
if (a >= 20) if (a >= 20)
return false; return false;
string_ptr = getStringPtrByID(_stringIdArray2[a]); showActionString(getStringPtrByID(_stringIdArray2[a]));
// Arisme : hack for long strings in the French version
if ((strlen((const char*)string_ptr) - 1) <= 53)
x = (53 - (strlen((const char *)string_ptr) - 1)) * 3;
else
x = 0;
showActionString(x, string_ptr);
return true; return true;
} }
bool SimonEngine::printNameOf(Item *item) { bool SimonEngine::printNameOf(Item *item) {
Child2 *child2; Child2 *child2;
uint x;
const byte *string_ptr;
if (item == 0 || item == _dummyItem2 || item == _dummyItem3) if (item == 0 || item == _dummyItem2 || item == _dummyItem3)
return false; return false;
@ -742,13 +734,7 @@ bool SimonEngine::printNameOf(Item *item) {
if (child2 == NULL) if (child2 == NULL)
return false; return false;
string_ptr = getStringPtrByID(child2->string_id); showActionString(getStringPtrByID(child2->string_id));
// Arisme : hack for long strings in the French version
if ((strlen((const char*)string_ptr) - 1) <= 53)
x = (53 - (strlen((const char *)string_ptr) - 1)) * 3;
else
x = 0;
showActionString(x, string_ptr);
return true; return true;
} }