Actor drawing hack
|Reported by:||eriktorbjorn||Owned by:||fingolfin|
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.