Opened 20 years ago

Closed 20 years ago

Last modified 20 years ago

#1802 closed defect (fixed)

DIG: Graphics glitch when scrolling

Reported by: eriktorbjorn Owned by: fingolfin
Priority: normal Component: Engine: SCUMM
Version: Keywords:
Cc: Game: The Dig


The Dig, English DOS version Latest ScummVM CVS snapshot

In the Dig, when you're at the power station beneath the Nexus, if you send the repair drone too far to the left there will be a glitch as the screen scrolls. See the attached screenshot. See the attached screenshot.

One possible culprit is this line from akos.cpp:

if (v1.x < 0 || v1.x >= _outwidth)

In this case, _outwidth is 328. If I change it to

if (v1.x < 0 || v1.x >= _vm->_screenWidth)

it seems to work. But I'm not certain if this is the correct fix.

Ticket imported from: #1042802. Ticket imported from: bugs/1802.

Attachments (2)

dig-glitch.png (20.3 KB ) - added by eriktorbjorn 20 years ago.
Screenshot of the glitch
dig.s05 (14.4 KB ) - added by eriktorbjorn 20 years ago.
Savegame at the power station

Download all attachments as: .zip

Change History (7)

by eriktorbjorn, 20 years ago

Attachment: dig-glitch.png added

Screenshot of the glitch

by eriktorbjorn, 20 years ago

Attachment: dig.s05 added

Savegame at the power station

comment:1 by eriktorbjorn, 20 years ago

Owner: set to fingolfin

comment:2 by eriktorbjorn, 20 years ago

Assigning to fingolfin since we've already discussed this glitch on IRC.

comment:3 by fingolfin, 20 years ago

Very strange. The "pitch" in that room is 328, so _outwidth being 328 should be just fine. Hm

Anyway, if you change virtscr[0].xstart = screenLeft; in camera.cpp to virtscr[0].xstart = _screenStartStrip * 8; which effectively turns off smooth scrolling, things work fine again, too.

Put together, those two factlets make up for a very irritating total :-)

comment:4 by fingolfin, 20 years ago

OK, I understand it now, and your change was on the right track. A proper fix is in CVS now.

Some explanation: Initially when I did the smooth-scrolling code, I imagined that all "backend" drawing code (room, objects, actors) would work just like now, only perform its work on a slightly bigger (8pixel wider) canvas. Then to achieve smooth scrolling, we blit only a portion of the canvas to the screen. That's still how we do it for the room background and objects; but for actors, I did things a bit differently; they still draw on the 328 wide canvas, but the origin is shifted to match the camera pos (or rather, to match camera pos mod 8). Problem was, I did the clipping wrong, neglecting to take that shift into account.

So my fix now is to clip against the visible screen width (like erik suggested), just that I use the width of the virtual screen instead of _screenWidth.

This should work since we currently do a full actor redraw when we scroll. Though we might change it, to optimize things a little -- if we went through with my original plan of drawing actors on the "big canvas", too, then we wouldn't have to redraw actors quite as often. (Note: this probably requires us to somewhat rework the way the costume drawing code is invoked).

comment:5 by fingolfin, 20 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.