svn-id: r19759
This commit is contained in:
Travis Howell 2005-12-08 06:12:04 +00:00
parent 0db98bd46d
commit eaf4f2f6f4
8 changed files with 92 additions and 42 deletions

View file

@ -53,11 +53,11 @@ void SimonEngine::print_char_helper_6(uint i) {
FillOrCopyStruct *fcs; FillOrCopyStruct *fcs;
if (_fcsData2[i]) { if (_fcsData2[i]) {
lock(); mouseOff();
fcs = _windowArray[i]; fcs = _windowArray[i];
drawIconArray(i, fcs->fcs_data->item_ptr, fcs->fcs_data->unk1, fcs->fcs_data->unk2); drawIconArray(i, fcs->fcs_data->item_ptr, fcs->fcs_data->unk1, fcs->fcs_data->unk2);
_fcsData2[i] = 0; _fcsData2[i] = 0;
unlock(); mouseOn();
} }
} }

View file

@ -1136,10 +1136,10 @@ static const char *const feeblefiles_opcode_name_table[256] = {
/* 120 */ /* 120 */
"W|UNK_120", "W|UNK_120",
"BI|SET_VGA_ITEM", "BI|SET_VGA_ITEM",
NULL, "ORACLE_TEXT_DOWN",
NULL, "ORACLE_TEXT_UP",
/* 124 */ /* 124 */
NULL, "WJ|IF_TIME",
"IJ|IS_SIBLING_WITH_A", "IJ|IS_SIBLING_WITH_A",
"IBB|UNK_126", "IBB|UNK_126",
"WW|PLAY_MUSIC_RESOURCE", "WW|PLAY_MUSIC_RESOURCE",
@ -1151,7 +1151,7 @@ static const char *const feeblefiles_opcode_name_table[256] = {
/* 132 */ /* 132 */
"|SAVE_GAME", "|SAVE_GAME",
"|LOAD_GAME", "|LOAD_GAME",
"|DUMMYPROC_134", "|LIST_SAVED_GAMES",
"|SWITCH_CD", "|SWITCH_CD",
/* 136 */ /* 136 */
"IV|GET_ITEM_UNK3", "IV|GET_ITEM_UNK3",

View file

@ -645,9 +645,9 @@ int SimonEngine::runScript() {
case 114:{ case 114:{
Item *item = getNextItemPtr(); Item *item = getNextItemPtr();
uint fcs_index = getVarOrByte(); uint fcs_index = getVarOrByte();
lock(); mouseOff();
drawIconArray(fcs_index, item, 0, 0); drawIconArray(fcs_index, item, 0, 0);
unlock(); mouseOn();
} }
break; break;
@ -690,6 +690,32 @@ int SimonEngine::runScript() {
} }
break; break;
case 122:{ /* oracle text down */
if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2)
goto invalid_opcode;
warning("STUB: script opcode 122");
}
break;
case 123:{ /* oracle text down */
if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2)
goto invalid_opcode;
warning("STUB: script opcode 123");
}
break;
case 124:{ /* if time */
if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2)
goto invalid_opcode;
uint time = getVarOrWord();
condition = 1;
warning("STUB: script opcode 124 (%d)", time);
}
break;
case 125:{ /* item is sibling with item 1 */ case 125:{ /* item is sibling with item 1 */
Item *item = getNextItemPtr(); Item *item = getNextItemPtr();
condition = (getItem1Ptr()->parent == item->parent); condition = (getItem1Ptr()->parent == item->parent);
@ -700,9 +726,9 @@ int SimonEngine::runScript() {
Item *item = getNextItemPtr(); Item *item = getNextItemPtr();
uint fcs_index = getVarOrByte(); uint fcs_index = getVarOrByte();
uint a = 1 << getVarOrByte(); uint a = 1 << getVarOrByte();
lock(); mouseOff();
drawIconArray(fcs_index, item, 1, a); drawIconArray(fcs_index, item, 1, a);
unlock(); mouseOn();
} }
break; break;
@ -753,8 +779,12 @@ int SimonEngine::runScript() {
break; break;
case 134:{ /* dummy opcode? */ case 134:{ /* dummy opcode? */
midi.stop(); if (getGameType() == GType_FF) {
_lastMusicPlayed = -1; warning("STUB: script opcode 134");
} else {
midi.stop();
_lastMusicPlayed = -1;
}
} }
break; break;
@ -998,12 +1028,12 @@ int SimonEngine::runScript() {
} }
break; break;
case 180:{ /* force unlock */ case 180:{ /* force mouseOn */
o_mouseOn(); o_mouseOn();
} }
break; break;
case 181:{ /* force lock */ case 181:{ /* force mouseOff */
o_mouseOff(); o_mouseOff();
if (getGameType() == GType_SIMON2) { if (getGameType() == GType_SIMON2) {
changeWindow(1); changeWindow(1);
@ -1652,10 +1682,10 @@ void SimonEngine::o_unk_160(uint a) {
} }
void SimonEngine::o_unk_103() { void SimonEngine::o_unk_103() {
lock(); mouseOff();
removeIconArray(_curWindow); removeIconArray(_curWindow);
showMessageFormat("\x0C"); showMessageFormat("\x0C");
unlock(); mouseOn();
} }
void SimonEngine::o_kill_sprite_simon1(uint a) { void SimonEngine::o_kill_sprite_simon1(uint a) {

View file

@ -122,9 +122,9 @@ void SimonEngine::quick_load_or_save() {
sprintf(buf, "Failed to load game state to file:\n\n%s", filename); sprintf(buf, "Failed to load game state to file:\n\n%s", filename);
} else { } else {
// Redraw Inventory // Redraw Inventory
lock(); mouseOff();
drawIconArray(2, getItem1Ptr(), 0, 0); drawIconArray(2, getItem1Ptr(), 0, 0);
unlock(); mouseOn();
// Reset engine? // Reset engine?
vc_set_bit_to(97, true); vc_set_bit_to(97, true);
sub = getSubroutineByID(100); sub = getSubroutineByID(100);

View file

@ -376,7 +376,7 @@ SimonEngine::SimonEngine(GameDetector *detector, OSystem *syst)
_needHitAreaRecalc = 0; _needHitAreaRecalc = 0;
_verbHitArea = 0; _verbHitArea = 0;
_hitAreaUnk4 = 0; _hitAreaUnk4 = 0;
_lockCounter = 0; _mouseHideCount = 0;
_windowNum = 0; _windowNum = 0;
@ -1140,7 +1140,7 @@ void SimonEngine::itemChildrenChanged(Item *item) {
if (_noParentNotify) if (_noParentNotify)
return; return;
lock(); mouseOff();
for (i = 0; i != 8; i++) { for (i = 0; i != 8; i++) {
fcs = _windowArray[i]; fcs = _windowArray[i];
@ -1154,7 +1154,7 @@ void SimonEngine::itemChildrenChanged(Item *item) {
} }
} }
unlock(); mouseOn();
} }
void SimonEngine::unlinkItem(Item *item) { void SimonEngine::unlinkItem(Item *item) {
@ -1663,15 +1663,15 @@ uint SimonEngine::get_fcs_ptr_3_index(FillOrCopyStruct *fcs) {
return 0; return 0;
} }
void SimonEngine::lock() { void SimonEngine::mouseOff() {
_lockCounter++; _mouseHideCount++;
} }
void SimonEngine::unlock() { void SimonEngine::mouseOn() {
_lockWord |= 1; _lockWord |= 1;
if (_lockCounter != 0) if (_mouseHideCount != 0)
_lockCounter--; _mouseHideCount--;
_lockWord &= ~1; _lockWord &= ~1;
} }
@ -1679,7 +1679,7 @@ void SimonEngine::unlock() {
void SimonEngine::handle_mouse_moved() { void SimonEngine::handle_mouse_moved() {
uint x; uint x;
if (_lockCounter) { if (_mouseHideCount) {
_system->showMouse(false); _system->showMouse(false);
return; return;
} }
@ -1705,6 +1705,26 @@ void SimonEngine::handle_mouse_moved() {
hitarea_proc_1(); hitarea_proc_1();
} }
if (getGameType() == GType_FF) {
if (_bitArray[6] & 0x8) { // Oracle
if (_mouseX >= 10 && _mouseX <= 635 && _mouseY >= 5 && _mouseX <= 475) {
_bitArray[6] |= 0x4;
} else {
if (_bitArray[6] & 0x4) {
_variableArray[254] = 63;
}
}
} else if (_bitArray[5] & 0x0100) { // Close Up
if (_mouseX >= 10 && _mouseX <= 635 && _mouseY >= 5 && _mouseX <= 475) {
_bitArray[5] |= 0x80;
} else {
if (_bitArray[5] & 0x80) {
_variableArray[254] = 75;
}
}
}
}
if (getGameType() == GType_SIMON2) { if (getGameType() == GType_SIMON2) {
if (_bitArray[4] & 0x8000) { if (_bitArray[4] & 0x8000) {
if (!_vgaVar9) { if (!_vgaVar9) {
@ -2672,7 +2692,7 @@ void SimonEngine::add_vga_timer(uint num, const byte *code_ptr, uint cur_sprite,
void SimonEngine::o_mouseOn() { void SimonEngine::o_mouseOn() {
if (getGameType() == GType_SIMON2 && _bitArray[4] & 0x8000) if (getGameType() == GType_SIMON2 && _bitArray[4] & 0x8000)
_mouseCursor = 0; _mouseCursor = 0;
_lockCounter = 0; _mouseHideCount = 0;
} }
void SimonEngine::o_mouseOff() { void SimonEngine::o_mouseOff() {
@ -2867,7 +2887,7 @@ void SimonEngine::timer_proc1() {
if (!_cepeFlag) if (!_cepeFlag)
expire_vga_timers(); expire_vga_timers();
if (_lockCounter != 0 && _syncFlag2) { if (_mouseHideCount != 0 && _syncFlag2) {
_lockWord &= ~2; _lockWord &= ~2;
return; return;
} }
@ -4086,7 +4106,7 @@ void SimonEngine::delay(uint amount) {
// We should only allow a load or save when it was possible in original // We should only allow a load or save when it was possible in original
// This stops load/save during copy protection, conversations and cut scenes // This stops load/save during copy protection, conversations and cut scenes
if (!_lockCounter && !_showPreposition) if (!_mouseHideCount && !_showPreposition)
quick_load_or_save(); quick_load_or_save();
} else if (event.kbd.flags == OSystem::KBD_CTRL) { } else if (event.kbd.flags == OSystem::KBD_CTRL) {
if (event.kbd.keycode == 'a') { if (event.kbd.keycode == 'a') {

View file

@ -284,7 +284,7 @@ protected:
uint _needHitAreaRecalc; uint _needHitAreaRecalc;
uint _verbHitArea; uint _verbHitArea;
uint16 _hitAreaUnk4; uint16 _hitAreaUnk4;
uint _lockCounter; uint _mouseHideCount;
uint16 _windowNum; uint16 _windowNum;
@ -583,8 +583,8 @@ protected:
void o_inventory_descriptions(); void o_inventory_descriptions();
void lock(); void mouseOff();
void unlock(); void mouseOn();
void drawIconArray(uint i, Item *item_ptr, int unk1, int unk2); void drawIconArray(uint i, Item *item_ptr, int unk1, int unk2);

View file

@ -463,9 +463,9 @@ void SimonEngine::handle_uparrow_hitarea(FillOrCopyStruct *fcs) {
if (fcs->fcs_data->unk1 == 0) if (fcs->fcs_data->unk1 == 0)
return; return;
lock(); mouseOff();
drawIconArray(index, fcs->fcs_data->item_ptr, fcs->fcs_data->unk1 - 1, fcs->fcs_data->unk2); drawIconArray(index, fcs->fcs_data->item_ptr, fcs->fcs_data->unk1 - 1, fcs->fcs_data->unk2);
unlock(); mouseOn();
} }
void SimonEngine::handle_downarrow_hitarea(FillOrCopyStruct *fcs) { void SimonEngine::handle_downarrow_hitarea(FillOrCopyStruct *fcs) {
@ -473,9 +473,9 @@ void SimonEngine::handle_downarrow_hitarea(FillOrCopyStruct *fcs) {
index = get_fcs_ptr_3_index(fcs); index = get_fcs_ptr_3_index(fcs);
lock(); mouseOff();
drawIconArray(index, fcs->fcs_data->item_ptr, fcs->fcs_data->unk1 + 1, fcs->fcs_data->unk2); drawIconArray(index, fcs->fcs_data->item_ptr, fcs->fcs_data->unk1 + 1, fcs->fcs_data->unk2);
unlock(); mouseOn();
} }
void SimonEngine::setup_hitarea_from_pos(uint x, uint y, uint mode) { void SimonEngine::setup_hitarea_from_pos(uint x, uint y, uint mode) {

View file

@ -1528,15 +1528,15 @@ void SimonEngine::vc32_copyVar() {
} }
void SimonEngine::vc33_setMouseOn() { void SimonEngine::vc33_setMouseOn() {
if (_lockCounter != 0) { if (_mouseHideCount != 0) {
_lockCounter = 1; _mouseHideCount = 1;
unlock(); mouseOn();
} }
} }
void SimonEngine::vc34_setMouseOff() { void SimonEngine::vc34_setMouseOff() {
lock(); mouseOff();
_lockCounter = 200; _mouseHideCount = 200;
_leftButtonDown = 0; _leftButtonDown = 0;
} }