Opened 16 years ago

Closed 16 years ago

Last modified 7 months ago

#8187 closed patch (outdated)

Actor drawing hack

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

Description

I was hoping to do this differently, so it probably
shouldn't be applied right away, but for now here's the
hacky version:

We have a problem with actor drawing and camera
movement. When the camera moves, we call
redrawBGAreas(). This will mark the parts of the screen
that scrolled into view as dirty which should - in
theory - be enough to cause all actors in these areas
to be redrawn.

Problem is, when we draw actors we only set usage for
the strips that are actually in view. So if an actor
scrolls into view, he won't be drawn - not until he
moves anyway - since ScummVM doesn't realize the actor
is in a dirtied part of the screen.

In most cases this isn't a problem, because actors are
moving more-or-less constantly. But at least in CMI
there are some actors where it's very noticeable.
Kenny, for instance. If you enter the town from the
right and walk towards his booth, there's a good chance
that it will appear to be empty at first.

Once he has been drawn, scrolling him on/off screen
will work just fine. I believe this is because we also
only clear usage bits for strips that are in view.

I can see two possible solutions: Either we mark all
actors in the room for redraw when the camera moves,
like this patch does. This is very simple to implement,
and should be a completely safe thing to do. Still, it
doess seem like a hack to me.

Or we could set usage bits for off-screen strips. This
could be done from drawCostume(), if the information
about which strips the actor occupies was readily
available. Right now it doesn't seem to be. Just
checking _actorX and _width isn't quite enough since
you also have to take mirroring etc. into account. So
this is harder to implement, and I'm not entirely sure
whether or not it'd actually work.

Ticket imported from: #699980. Ticket imported from: patches/292.

Attachments (1)

actor-redraw-hack.diff (1.1 KB) - added by eriktorbjorn 16 years ago.
Patch against a March 7 CVS snapshot

Download all attachments as: .zip

Change History (9)

Changed 16 years ago by eriktorbjorn

Attachment: actor-redraw-hack.diff added

Patch against a March 7 CVS snapshot

comment:1 Changed 16 years ago by fingolfin

Hum. Also refer to my code in actor.cpp, around line 1040. I added that code to model the behaviour in the "old" drawing code around line 1002. It fixed various redraw issues, and possibly also the one you are trying to fix here, but apparently caused issues in The Dig ?!

comment:2 Changed 16 years ago by eriktorbjorn

It does seem to fix that bug, yes, but as you say it causes
problems in The Dig. Apparently one of the reasons for this
- perhaps the only reason - is that The Dig uses the "wait
until actor drawn" opcode, and with your change it's much
less likely that a->needRedraw will be false.

comment:3 Changed 16 years ago by fingolfin

Yes, the code is obviously incorrect, as it draws *whenever* a draw happened - far far too often,

However, it would be trivial to change the akos drawCostume to only return true if clipping occured (similiar to how the classic drawCostume only sets bit 1 if clipping occured).

Of course, I am not really sure if this is what we should do. I guess if the original code was doing this, it would be visible in our code, too, wouldn't it?

comment:4 Changed 16 years ago by fingolfin

Owner: set to fingolfin

comment:5 Changed 16 years ago by fingolfin

I revised my original "hack" in actor.cpp, when calling drawCostume. It
should now work exactly as for the old costume code, provided akos codec 1
is used - that is, off-screen / partially visible actors will be marked as dirty.

This fixes actor draw problems in COMI for me (e.g. the chickens in the
fortress are a good way to test it; didn't yet test the other cases you
mentioned, erik, maybe you could do that), and talking in The Dig still
works, too.

comment:6 Changed 16 years ago by fingolfin

The issue covered by my bug seems to be fixed by my AKOS/actor changes.

comment:7 Changed 16 years ago by fingolfin

Resolution: outdated
Status: newclosed

comment:8 Changed 7 months ago by digitall

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