aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine/kevent.cpp
AgeCommit message (Collapse)Author
2017-09-27SCI: Add support for keyup eventsColin Snover
Basic keyup event support appears to have been added in the SCI1.1 IBM keyboard driver, and more robust support was provided in SCI32 which actually gets used by at least Lighthouse. This patch adds support for keyup events in SCI1.1+. Fixes Trac#10242.
2017-09-27SCI: Do some clean-up of event handling systemColin Snover
Convert macros and vars to enums, rename keyboard events in preparation for adding key up events, clean up unnecessary nested conditionals, add TODOs for potential future work.
2017-07-23SCI: Minor cleanups in kGetEventColin Snover
2017-07-23SCI32: Fix hot rectangle eventsColin Snover
This fixes delayed mouse cursor updates during the chase scene in Phant1. Refs Trac#9975.
2017-07-06SCI32: Centralise OSystem screen updatesColin Snover
2017-05-06SCI32: Detect and handle tight loops around kGetEventColin Snover
In SSCI, mouse events are received through a hardware interrupt and the cursor is drawn directly to the graphics card by the interrupt handler. This allows game scripts to omit calls to kFrameOut without stopping the mouse cursor from being redrawn in response to mouse movement. ScummVM, in contrast, needs to poll for events and submit screen updates explicitly from the main thread. Submitting screen updates may block on vsync, which means that this call should really only be made once per frame, just after the game has finished updating its back buffer. The closest signal in SCI32 for having completed drawing a frame is the kFrameOut call, so this is where the update is submitted (by calling OSystem::updateScreen). The problem with the approach in ScummVM is that, even though the mouse position is being updated (by calls to kGetEvent) and drawn to the backend's back buffer (by GfxCursor32::drawToHardware), OSystem::updateScreen is never called during game loops that omit calls to kFrameOut. This commit introduces a workaround that looks at the number of times kGetEvent is called between calls to kFrameOut. If the number of kGetEvent calls is higher than usual (where "usual" seems to be 0 or 1), we assume that the game is running one of these tight event loops, and kGetEvent starts calling OSystem::updateScreen until the next kFrameOut call. We also then start throttling the calls to kGetEvent to keep CPU usage down. This fixes at least two such known loops: 1. When interacting with the menu bar at the top of the screen in LSL6hires; 2. When restoring a game in Phant2 and sitting on the "click mouse" screen. A similar workaround may also be needed for kGetTime, though loops around kGetTime should preferably be replaced using a script patch to call kWait instead.
2017-04-22SCI: Implement delayed restore for SCI32 and move implementations to ↵Colin Snover
GuestAdditions
2017-04-22SCI: Clean up unnecessary delayed restore flagsColin Snover
_delayedRestoreGame is always set and cleared at the same time as _delayedRestoreGameId, and _delayedRestoreFromLauncher is written but never read.
2016-10-09SCI32: Change storage type of int16 arrays to hold reg_ts insteadColin Snover
Memory references and integers in SSCI are both 16-bit numbers, so game scripts frequently (incorrectly) use an IntArray instead of an IDArray for holding references. Since references in ScummVM are 32-bit reg_ts, IntArray entries must be large enough to hold reg_ts in order to be compatible with game scripts that store references in integer arrays. The alternative solution is to find and patch all incorrect use of IntArray across all games. This is possible, but a bit risky from a save game stability perspective, since incorrect IntArray usage is sometimes not apparent until well after the array is instantiated (like GK1's global interview array). This change invalidates existing SCI32 save games.
2016-10-09JANITORIAL: Remove trailing spacesEugene Sandulenko
2016-09-29SCI32: Implement kSetHotRectanglesColin Snover
Used only by chapter 7 of Phant1.
2016-09-29SCI32: Update screen on frameout, instead of in the event loopColin Snover
2016-08-19SCI32: Fix kGlobalToLocal and kLocalToGlobalColin Snover
Fixes (at least) the native SCI save dialogs.
2016-08-19SCI32: Implement SCI32 cursor supportColin Snover
2016-08-13SCI: Fix pseudo mouse in various SCI1 games like e.g. Larry5Martin Kiewitz
Pseudo mouse was functionality in SCI1+ games, that allowed the user to control the mouse via keyboard cursor keys. This new class only worked, when a tiny difference inside the keyboard driver happened on kMapKeyToDir calls. We previously tried to enable this behavior depending on cursor type, but this didn't work correctly (Larry 5 for example was not detected as such, but had PseudoMouse support).
2016-03-11SCI32: Fix incorrect mouse event coordinates in SCI2 hiresColin Snover
2016-03-05SCI: Make cursor workaround work properly on OpenPandoraMartin Kiewitz
Other platforms, that support analog stick + touch screen at the same time, are possibly also affected. Cursor workarounds exist for qfg1vga, qfg3, lsl5 and Island of Dr. Brain. Those sometimes worked and sometimes didn't on at least OpenPandora and should be fixed now.
2016-02-02SCI: Do not pass/use .data for mouse button typeMartin Kiewitz
Also added comment about .data field. Should be renamed.
2016-02-02SCI: Fix control/Fx keys not working anymoreMartin Kiewitz
Was effectively caused by commit adding the keyboard driver bug for SCI0/SCI01, although the bug is actually real and happens. It seems Sierra did not check the key-modifier in kMenuSelect. We do and that's why the code didn't recognize all sorts of menu keys anymore. We now isolate the lower byte before comparing. I also noticed, that Sierra passed keyboard modifiers in mouse events. This was probably done, so that owners of a 1-button mouse were able to right-click. We do this now too. Also added information about mouse modifiers in kGetEvent. Moved the mouse modifier code into getScummVMEvent(). This should fix bug #7009.
2016-01-03SCI: kGetEvent modifiers bug was fixed in SCI1Martin Kiewitz
- SCI1 EGA QfG2 keyboard driver resets AH In the original commit I forgot to mention: - thanks to lskovlun for figuring out that bit 9 is checked/set - thanks to wjp for checking SCI32
2016-01-03SCI: implement kGetEvent modifiers DOS bugMartin Kiewitz
Will fix darts minigame in the fan game "Betrayed Alliance" This bug in the original interpreter/keyboard driver seems to have been fixed in SCI32.
2015-12-29SCI32: split up SCI2.1 into EARLY/MIDDLE/LATEMartin Kiewitz
- Detection works via signatures (couldn't find a better way) - new kString subcalls were introduced SCI2.1 LATE - kString now has signatures and is split via subcall table - kString fix, so that KQ7 doesn't crash, when starting a chapter - Sci2StringFunctionType removed, because no longer needed
2015-04-26SCI: implement delayed restore via ScummVM menuMartin Kiewitz
will delay restoring a saved game until the next kGetEvent or kWait also implement aborting playback for kPortrait and kShowMovie
2015-04-26SCI: Stop processing in kGetEvent after loadingWillem Jan Palenstijn
getSciEvent can trigger the main ScummVM menu, which can trigger loading a game, which will invalidate the game state that kGetEvent is operating on. Other kernel functions may still have the same problem, and a better solution may be necessary.
2014-05-27ALL: Rename Debugger::DebugPrintf to Debugger::debugPrintf.Johannes Schickel
2014-02-18SCI: Make GPL headers consistent in themselves.Johannes Schickel
2013-04-28SCI: Change wording for the cursor position workaroundsFilippos Karapetis
2012-06-18SCI: Add setter/getter methods to reg_t'sFilippos Karapetis
No functionality change has been made with this commit. This avoids setting and getting the reg_t members directly, and is the basis of any future work on large SCI3 scripts (larger than 64KB)
2011-06-20ALL: Remove trailing whitespacesMax Horn
This tries to make our code a bit more compliant with our code formatting conventions. For future use, this is the command I used: git ls-files "*.cpp" "*.h" | xargs sed -i -e 's/[ \t]*$//'
2011-05-12GIT: Clean up: Suppress SVN tags, now uselessstrangerke
2011-03-09SCI: Implement Mac iconbar event handling.Walter van Niftrik
2011-03-09SCI: Save mouse position in SciEvent.Johannes Schickel
Instead of querying the event manager for the current mouse cursor coordinates kGetEvent now uses the saved mouse positions, which will assure every event will be processed with the correct coordinates instead of the current ones. Various other functions using SciEvent directly were adapted too. This fixes cursor click positions for the WinCE backend. Thanks to wjp and waltervn for helping me with this.
2011-02-15SCI: Cleaned up kMapKeyToDir and removed an incorrect heuristicmd5
The heuristic in question was used to detect the pseudo mouse control functionality, however the change in controls seems to have occurred with the transition to cursor views. Fixes keypad control in Conquest of the Longbow. Moreover, the code also checked for key scan code 76 when checking for the middle keypad button, which seems to be a mistake, as that case never occurred.
2010-12-26SCI: A more efficient solution for bug #3037874 (SCI high CPU usage), which ↵Filippos Karapetis
will hopefully not clash with the speed throttler. This is a more proper fix for bug #3058865, and a partial fix for bug #3127824 svn-id: r55046
2010-09-03SCI: Fixed bug #3058865 - "Jones in the Fast Lane CD: Graphics Missing"Filippos Karapetis
svn-id: r52511
2010-08-31SCI: adding workaround for platform-specificMartin Kiewitz
incompatibility with some sierra games. Some games open a new menu, set mouse cursor within that menu and expect the mouse cursor to be in there and will close it, if it's outside. In case of Wiimote/touch interfaces this logic won't work of course. Fixes island of dr. brain and QfG1VGA on Wii and touch-interface platforms svn-id: r52474
2010-08-29SCI: Fixed bug #3037874 - "SCI1.1: High cpu usage when a textbox is displayed"Filippos Karapetis
svn-id: r52432
2010-07-25SCI: sci32 coord adjustment changesMartin Kiewitz
- fixes lsl6hires inventory svn-id: r51275
2010-07-25SCI: sci32 changesMartin Kiewitz
- mouse position now gets adjusted inside kGetEvent - priority is read out during kFrameout - check planeRect - check if plane picture resource actually exists fixes sq6 svn-id: r51270
2010-07-21SCI: more work on coordadjustment sci32Martin Kiewitz
svn-id: r51084
2010-07-19SCI: fixing commentMartin Kiewitz
svn-id: r51037
2010-07-12SCI: Turn global object g_debugState into SciEngine member varMax Horn
svn-id: r50836
2010-06-30SCI: Removed the FreeSCI music codeFilippos Karapetis
svn-id: r50532
2010-06-29SCI: Made the SoundCommandParser a member of the SciEngine class and removed ↵Filippos Karapetis
it from the EngineState, since it's static throughout the course of a game svn-id: r50484
2010-06-19SCI: implemented checking of keyboard driver in case of SCI1EGA/EARLY, also ↵Martin Kiewitz
renamed SCI_EVENT_JOYSTICK to SCI_EVENT_DIRECTION svn-id: r50045
2010-06-18SCI: set resulting type to keyboard+joystick for sci1middle+ in kMapKeyToDir ↵Martin Kiewitz
- fixes keyboard controlling of mouse in all sorts of games - although this is not 100% done, the change actually happened inbetween sci1early, added fixme svn-id: r50034
2010-06-17SCI: Rename sciEvent to SciEventMax Horn
svn-id: r49960
2010-06-17SCI: Moved the event code a little bit around.Max Horn
* Move sleep() from EventManager to SciEngine * Rename EventManager methods: get -> getSciEvent, and getFromScummVM -> getScummVMEvent * Make scancode_rows static const * Turn altify & numlockify from EventManager methods into static functions (and comment out the currently unused numlockify) svn-id: r49959
2010-06-15SCI: SciGui/SciGui32 gone for good...Martin Kiewitz
svn-id: r49860
2010-06-15Fix spelling, cleanupMax Horn
svn-id: r49843