Opened 23 years ago

Closed 23 years ago

Last modified 6 years ago

#7927 closed patch (fixed)

setShake() Patch v2

Reported by: SF/stauff1 Owned by:
Priority: normal Component: Engine: SCUMM
Version: Keywords:
Cc: Game:

Description

Hi,

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).

Enjoy!

- Matthew Duggan

Ticket imported from: #493613. Ticket imported from: patches/32.

Attachments (2)

scummvm-shake.patch (7.4 KB ) - added by SF/stauff1 23 years ago.
The patch file
scummvm-shake2.patch (8.0 KB ) - added by SF/stauff1 23 years ago.

Download all attachments as: .zip

Change History (9)

by SF/stauff1, 23 years ago

Attachment: scummvm-shake.patch added

The patch file

by SF/stauff1, 23 years ago

Attachment: scummvm-shake2.patch added

comment:1 by SF/stauff1, 23 years ago

Sorry, ignore the first file, scummvm-shake2.patch is the correct patch. In a fit of pure skill, I clicked on the wrong file to upload.

- Matthew

comment:2 by SF/ender, 23 years ago

Perfect! :)

Really well done - only one question... why only "particually implemented"? There's no other state I've seen for SetShake except 1 (on) or 0 (off)...

comment:3 by SF/stauff1, 23 years ago

Oh, well I left the warning there because it still doesn't work if you compile for GDI, but I'm not sure if that's a common thing for people to do, since SDL is faster anyway..

- Matthew

comment:4 by SF/strigeus, 23 years ago

I implemented a slightly different version of shaking that doesn't need a second SDL surface. Doesn't work with GDI version yet. It's on CVS now.

comment:5 by SF/strigeus, 23 years ago

Resolution: fixed
Status: newclosed

comment:6 by SF/stauff1, 23 years ago

Hmm.. good. That's much better than the way I did it.

- Matthew

comment:7 by digitall, 6 years ago

Component: Engine: SCUMM
Note: See TracTickets for help on using tickets.