Opened 3 years ago

Closed 3 years ago

#13065 closed defect (fixed)

SCUMM: Incorrect screen shaking

Reported by: eriktorbjorn Owned by: athrxx
Priority: normal Component: Engine: SCUMM
Version: Keywords:
Cc: Game:

Description

At least in some SCUMM games (it's been verified with Full Throttle and Day of the Tentacle) ScummVM shakes the screen incorrectly.

In Full Throttle, you can test this by hitting the wrong parts of the dumpster you start in. The game draws a dent and the screen shakes briefly. In DOSBox, the screen is moved upwards. In ScummVM, it's moved downwards. Also, Full Throttle displays more shake frames than ScummVM does.

In Day of the Tentacle, if you turn on the stereo the screen starts shaking. Again, DOSBox moves the screen upwards. ScummVM moves it downwards.

At lest in Day of the Tentacle, DOSBox shakes the mouse pointer along with the rest of the screen. ScummVM doesn't. If we're going to emulate this, we have to make sure that mouse clicks are registered at the correct coordinates.

Change History (10)

comment:1 by athrxx, 3 years ago

Also interesting that we multiply the line offsets in shake_positions with 2. The original has the same offsets, but multiplies them with 80. Reason is that the vram is accessed in dwords when writing these offsets into the crt control register. So a multiplication with 80 is exactly one line, not two. Also, apparently it has been misunderstood that these offsets will move the screen up and not down.

I'll check a bit more whether I understand the timing issue...

comment:2 by athrxx, 3 years ago

I have made a fix. Please test whether you find the outcome satisfactory.

My own test have been mainly with DOTT, since that really leaves on the shaking permanently, but FT also seems okay.

Are there any more known targets which make use of that opcode?

DOTT and FOA seem to use the same offset table and shaking rate, but there is really no guarantee that all games would do it like that.

Version 0, edited 3 years ago by athrxx (next)

comment:3 by eriktorbjorn, 3 years ago

Looks good to me, but I wasn't the one that noticed the discrepancy in the first place.

I don't have any complete list of games that use screen shaking. But some examples of games and their uses of it (not necessarily the most convenient ones to reproduce) are:

  • The Secret of Monkey Island, hitting the banana tree with the catapult
  • Monkey Island 2, the explosion when escaping LeChuck's fortress
  • Sam & Max hit the road, the explosion near the end of the intro
  • Indiana Jones and the Fate of Atlantis, turning on the machine at the end

These all look fine to me, but I haven't compared to the original.

comment:4 by athrxx, 3 years ago

Thanks for testing all these :-)

I will just take a quick look at the shake offset tables for these games. What I still don't understand is why the values in our code were multiplied with 2. Whoever did that implementation must have seen a situation where this seemed the right thing to do.

comment:5 by eriktorbjorn, 3 years ago

The earliest stable version I can find where shaking appears to be implemented is 0.1.0:

/* power of 2 */
#define NUM_SHAKE_POSITIONS 8

static const int8 shake_positions[NUM_SHAKE_POSITIONS] = {
	0,1*2,2*2,1*2,0*2,2*2,3*2,1*2
};

But I don't know which game it was derived from. The documentation lists the following games as "reported to work":

  • Monkey Island 1 (CD version)
  • Monkey Island 2
  • Indiana Jones And The Fate Of Atlantis
  • Day Of The Tentacle
  • Sam & Max (partially)

The commit is https://github.com/scummvm/scummvm/commit/0355b5df912758b7c21cb4f416aa4949c51003e4 but that doesn't really tell me anything either.

comment:6 by AndywinXp, 3 years ago

Sorry for the intrusion, I don't know if it can be useful but I just found out that The Dig uses the screen shake when talking multiple times to Brink while his hand is stuck. It seems to work fine, but I don't have a savegame for the original EXE to do comparisons.

comment:7 by athrxx, 3 years ago

Heya, please feel free to intrude :-). Your help is always welcome.

It isn't really necessary to have a full comparison with the originals if it is obvious from disasm that they use the same timing and offset tables (which I haven't checked yet, though).

It would be interesting to know if any of the earlier games (Scumm 3) use the shake effect. IIRC it is definitely present in the original code, but it doesn't matter if it never gets used.

comment:8 by eriktorbjorn, 3 years ago

Indiana Jones and the Last Crusade uses it in a few places as well. At the very least when crashing the biplane, or if the Grail temple collapses at the end.

Loom uses it as well. The earliest place is probably if you try to cast the "open" draft on the graves, but also in the scene where lightning strikes the tree.

I'm not familiar enough with Maniac Mansion, and even less with Zak McKracken, to know if it's used there.

comment:9 by athrxx, 3 years ago

So, almost ready to close this ticket :-)

I have found exactly one specific case where the 2x multiplication is required: the Japanese FM-Towns versions and the Mac versions with their hires scaling.

What about COMI? Is it worth investigating? Or does it not use the effect anyway?

comment:10 by athrxx, 3 years ago

Owner: set to athrxx
Resolution: fixed
Status: newclosed

Okay, sometimes I can even answer my own questions. o8_roomOps() does not have support for screen shaking. Maybe a hardware/OS limitation. I guess, with Windows95 it wasn't allowed to write into the vga adapter's registers any more and software emulation might have been to slow back then...

I'll close this ticket, since eriktorbjorn has told me that the shaking is good...

Note: See TracTickets for help on using tickets.