diff options
-rw-r--r-- | simon/charset.cpp | 4 | ||||
-rw-r--r-- | simon/debug.h | 8 | ||||
-rw-r--r-- | simon/items.cpp | 50 | ||||
-rw-r--r-- | simon/saveload.cpp | 4 | ||||
-rw-r--r-- | simon/simon.cpp | 44 | ||||
-rw-r--r-- | simon/simon.h | 6 | ||||
-rw-r--r-- | simon/verb.cpp | 8 | ||||
-rw-r--r-- | simon/vga.cpp | 10 |
8 files changed, 92 insertions, 42 deletions
diff --git a/simon/charset.cpp b/simon/charset.cpp index 1aab21a79f..c958d00fd8 100644 --- a/simon/charset.cpp +++ b/simon/charset.cpp @@ -53,11 +53,11 @@ void SimonEngine::print_char_helper_6(uint i) { FillOrCopyStruct *fcs; if (_fcsData2[i]) { - lock(); + mouseOff(); fcs = _windowArray[i]; drawIconArray(i, fcs->fcs_data->item_ptr, fcs->fcs_data->unk1, fcs->fcs_data->unk2); _fcsData2[i] = 0; - unlock(); + mouseOn(); } } diff --git a/simon/debug.h b/simon/debug.h index 086bfd96c6..b45b1c0856 100644 --- a/simon/debug.h +++ b/simon/debug.h @@ -1136,10 +1136,10 @@ static const char *const feeblefiles_opcode_name_table[256] = { /* 120 */ "W|UNK_120", "BI|SET_VGA_ITEM", - NULL, - NULL, + "ORACLE_TEXT_DOWN", + "ORACLE_TEXT_UP", /* 124 */ - NULL, + "WJ|IF_TIME", "IJ|IS_SIBLING_WITH_A", "IBB|UNK_126", "WW|PLAY_MUSIC_RESOURCE", @@ -1151,7 +1151,7 @@ static const char *const feeblefiles_opcode_name_table[256] = { /* 132 */ "|SAVE_GAME", "|LOAD_GAME", - "|DUMMYPROC_134", + "|LIST_SAVED_GAMES", "|SWITCH_CD", /* 136 */ "IV|GET_ITEM_UNK3", diff --git a/simon/items.cpp b/simon/items.cpp index fb793c482c..faaebb2a0f 100644 --- a/simon/items.cpp +++ b/simon/items.cpp @@ -645,9 +645,9 @@ int SimonEngine::runScript() { case 114:{ Item *item = getNextItemPtr(); uint fcs_index = getVarOrByte(); - lock(); + mouseOff(); drawIconArray(fcs_index, item, 0, 0); - unlock(); + mouseOn(); } break; @@ -690,6 +690,32 @@ int SimonEngine::runScript() { } 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 */ Item *item = getNextItemPtr(); condition = (getItem1Ptr()->parent == item->parent); @@ -700,9 +726,9 @@ int SimonEngine::runScript() { Item *item = getNextItemPtr(); uint fcs_index = getVarOrByte(); uint a = 1 << getVarOrByte(); - lock(); + mouseOff(); drawIconArray(fcs_index, item, 1, a); - unlock(); + mouseOn(); } break; @@ -753,8 +779,12 @@ int SimonEngine::runScript() { break; case 134:{ /* dummy opcode? */ - midi.stop(); - _lastMusicPlayed = -1; + if (getGameType() == GType_FF) { + warning("STUB: script opcode 134"); + } else { + midi.stop(); + _lastMusicPlayed = -1; + } } break; @@ -998,12 +1028,12 @@ int SimonEngine::runScript() { } break; - case 180:{ /* force unlock */ + case 180:{ /* force mouseOn */ o_mouseOn(); } break; - case 181:{ /* force lock */ + case 181:{ /* force mouseOff */ o_mouseOff(); if (getGameType() == GType_SIMON2) { changeWindow(1); @@ -1652,10 +1682,10 @@ void SimonEngine::o_unk_160(uint a) { } void SimonEngine::o_unk_103() { - lock(); + mouseOff(); removeIconArray(_curWindow); showMessageFormat("\x0C"); - unlock(); + mouseOn(); } void SimonEngine::o_kill_sprite_simon1(uint a) { diff --git a/simon/saveload.cpp b/simon/saveload.cpp index 87fd99d937..cabf464b1b 100644 --- a/simon/saveload.cpp +++ b/simon/saveload.cpp @@ -122,9 +122,9 @@ void SimonEngine::quick_load_or_save() { sprintf(buf, "Failed to load game state to file:\n\n%s", filename); } else { // Redraw Inventory - lock(); + mouseOff(); drawIconArray(2, getItem1Ptr(), 0, 0); - unlock(); + mouseOn(); // Reset engine? vc_set_bit_to(97, true); sub = getSubroutineByID(100); diff --git a/simon/simon.cpp b/simon/simon.cpp index 0f58f057cb..3b27a35f97 100644 --- a/simon/simon.cpp +++ b/simon/simon.cpp @@ -376,7 +376,7 @@ SimonEngine::SimonEngine(GameDetector *detector, OSystem *syst) _needHitAreaRecalc = 0; _verbHitArea = 0; _hitAreaUnk4 = 0; - _lockCounter = 0; + _mouseHideCount = 0; _windowNum = 0; @@ -1140,7 +1140,7 @@ void SimonEngine::itemChildrenChanged(Item *item) { if (_noParentNotify) return; - lock(); + mouseOff(); for (i = 0; i != 8; i++) { fcs = _windowArray[i]; @@ -1154,7 +1154,7 @@ void SimonEngine::itemChildrenChanged(Item *item) { } } - unlock(); + mouseOn(); } void SimonEngine::unlinkItem(Item *item) { @@ -1663,15 +1663,15 @@ uint SimonEngine::get_fcs_ptr_3_index(FillOrCopyStruct *fcs) { return 0; } -void SimonEngine::lock() { - _lockCounter++; +void SimonEngine::mouseOff() { + _mouseHideCount++; } -void SimonEngine::unlock() { +void SimonEngine::mouseOn() { _lockWord |= 1; - if (_lockCounter != 0) - _lockCounter--; + if (_mouseHideCount != 0) + _mouseHideCount--; _lockWord &= ~1; } @@ -1679,7 +1679,7 @@ void SimonEngine::unlock() { void SimonEngine::handle_mouse_moved() { uint x; - if (_lockCounter) { + if (_mouseHideCount) { _system->showMouse(false); return; } @@ -1705,6 +1705,26 @@ void SimonEngine::handle_mouse_moved() { 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 (_bitArray[4] & 0x8000) { if (!_vgaVar9) { @@ -2672,7 +2692,7 @@ void SimonEngine::add_vga_timer(uint num, const byte *code_ptr, uint cur_sprite, void SimonEngine::o_mouseOn() { if (getGameType() == GType_SIMON2 && _bitArray[4] & 0x8000) _mouseCursor = 0; - _lockCounter = 0; + _mouseHideCount = 0; } void SimonEngine::o_mouseOff() { @@ -2867,7 +2887,7 @@ void SimonEngine::timer_proc1() { if (!_cepeFlag) expire_vga_timers(); - if (_lockCounter != 0 && _syncFlag2) { + if (_mouseHideCount != 0 && _syncFlag2) { _lockWord &= ~2; return; } @@ -4086,7 +4106,7 @@ void SimonEngine::delay(uint amount) { // 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 - if (!_lockCounter && !_showPreposition) + if (!_mouseHideCount && !_showPreposition) quick_load_or_save(); } else if (event.kbd.flags == OSystem::KBD_CTRL) { if (event.kbd.keycode == 'a') { diff --git a/simon/simon.h b/simon/simon.h index 0a48630f6a..de21fb6d76 100644 --- a/simon/simon.h +++ b/simon/simon.h @@ -284,7 +284,7 @@ protected: uint _needHitAreaRecalc; uint _verbHitArea; uint16 _hitAreaUnk4; - uint _lockCounter; + uint _mouseHideCount; uint16 _windowNum; @@ -583,8 +583,8 @@ protected: void o_inventory_descriptions(); - void lock(); - void unlock(); + void mouseOff(); + void mouseOn(); void drawIconArray(uint i, Item *item_ptr, int unk1, int unk2); diff --git a/simon/verb.cpp b/simon/verb.cpp index 4ef8e669a1..c8df543dd7 100644 --- a/simon/verb.cpp +++ b/simon/verb.cpp @@ -463,9 +463,9 @@ void SimonEngine::handle_uparrow_hitarea(FillOrCopyStruct *fcs) { if (fcs->fcs_data->unk1 == 0) return; - lock(); + mouseOff(); 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) { @@ -473,9 +473,9 @@ void SimonEngine::handle_downarrow_hitarea(FillOrCopyStruct *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); - unlock(); + mouseOn(); } void SimonEngine::setup_hitarea_from_pos(uint x, uint y, uint mode) { diff --git a/simon/vga.cpp b/simon/vga.cpp index 153d10be9c..341c381e5d 100644 --- a/simon/vga.cpp +++ b/simon/vga.cpp @@ -1528,15 +1528,15 @@ void SimonEngine::vc32_copyVar() { } void SimonEngine::vc33_setMouseOn() { - if (_lockCounter != 0) { - _lockCounter = 1; - unlock(); + if (_mouseHideCount != 0) { + _mouseHideCount = 1; + mouseOn(); } } void SimonEngine::vc34_setMouseOff() { - lock(); - _lockCounter = 200; + mouseOff(); + _mouseHideCount = 200; _leftButtonDown = 0; } |