setShake() Patch v2
|Reported by:||SF/stauff1||Owned by:|
This is my second attempt at making a working version of setShake(). This is pretty much the same method as the previous one with a few more smarts, a bit less cpu load (shake speed is limited), and the DOTT problem has been totally(?) fixed. The mouse cursor now works fine.
One bug remains, that when switching to a new scene during a shake (as in DOTT when you turn on Green's stereo for the first time), the palette will be wrong for <1 frame.
The following is a slightly modified copy of the explanation I posted with the first patch:
Using an off-screen buffer during "shake" events, this patch produces the same shake as in the original games (tested with Sam'n'Max & DOTT - there's a shake event during the opening sequence when Sam throws the head- bomb out the window and when you turn on Green's stereo).
The basic method is:
setup: * The Scumm::_shakeMode flag is set * The Scumm::_shakeFrame is set to 0 (used to oscillate between above and below normal position) * The current screen is copied to the offscreen buffer
during shake: * Screen updates go to the offscreen buffer * The offscreen is copied to the SDL "screen" with an offset * Full screen update is requested from SDL for new frame, single Blts have their rectangles modified to stay correct
cleanup: * Scumm::_shakeMode is set to 0 * Buffer is copied back to screen in entireity * Updates go directly to screen * Scumm::_shakeFrame reset to 0
The patch is currently SDL only. I have produced a patched windows.cpp, but it only works for GDI because currently the DirectX version doesn't even compile!
I'll produce a full patch for windows.cpp if someone wants it.
This patch was made against the latest cvs version as at time of posting.
While I was at it, I added an error check to the SDL setup which could have left a null screen pointer previously, and fixed a bug with fullRedraw (flag was never reset).
- Matthew Duggan
Ticket imported from: #493613. Ticket imported from: patches/32.