This is to avoid file name inclusion clashes with graphics/palette.h
placed in common code, as uncovered by PR #6471
After discussing with @sluicebox, this is a simpler solution, where
only the offending palette.* files are renamed, without affecting
palette32.*, or introducing a sci prefix in files
gfxdrivers.cpp has become quite large. So I've now made a
separate file for each driver. I also separated the mode
validation and driver init code from the enigine and put
it into an extra file.
SQ4/CD/Windows uses a simiar interpreter to the KQ6 one, minus the hires
graphics support. It has the same upscaling to 640x440 (or 320x220 for small
windows) and also support the same 16 colors mode.
Also removed some whitespace...
I have attached the SQ4 Windows variant to the gfx drivers I made for KQ6.
The 16 colors mode now requires the SCIWV.EXE executable, though. I had
hard coded the 512 bytes color pattern table for KQ6, since I thought it
would remain the only one necessary. But SQ4 has a different table. So I now
load them from the executable.
There might be more Windows games like that, I just currently don't know
about it (probably other SCI_VERSION_1_1 titles). Adding support would be
super easy. But it will not work right out of the box, since I explicitly check
the game IDs in customizeGuiOptions(), to avoid any nonsense to happen.
I made a mistake in that PR by assuming that the
handles for the hires graphics would be unique. So
when removing an object from the drawing chain
I really only removed the first object. But in reality
they often have the same handle and the original
interpreter continues to go over the loop until all
of the same handle have been removed.
Also, the original checks for already existent draw
objects with the same x/y-coordinates.
(items 1- 3 from bug ticket no. 15594)
I have added redrawing functionality for the hires GFX from the
original interpreter. I guess the original only needed that code
to handle WM_PAINT messages (= full window redraw). It also
does actually call a redraw in kDisposeWindow, the same way I
implemented it here, to refresh the inventory. But that is really
only needed for the speech+text mode which isn't supported
in the original. Maybe they ditched the mode only after they
had already implemented that, who knows...
I have also improved the workaround for the out-of-bounds
portraits to catch the case from the bug ticket.
I added a check in kDisposeWindow. It isn't strictly necessary,
but it it makes the code easier to understand.
I also renamed a var that I had previously renamed in a way
that makes no sense. I had renamed it from `upscaledHiresRect'
to 'portraitRect' since it is neither upscaled nor hires (it is just a
lowres rect). But it isn't a portrait rect either. The portraits get
drawn elsewhere. It's more likely to be a picture frame, a GUI
control or an inventory item.
I noticed that in the Meeps scene there was green
sjis text color. It is always supposed to be black. The
original interpreter can't do anything else. Same
for SCI1, although for different reasons. I think I broke
that when I fixed the PQ2 colors.
As the GFX_SCREEN_MASK_DISPLAY flag is no longer
used, I have made a new workaround. Nowadays it
seems to be needed only for the mixed speech/text
mode (which didn't exist in the original game, but has
been added to ScummVM via script patches). The
problem is that the hires portrait frames will be drawn
at y = 5 in mixed speech/text mode. The window/port
rect starts at y=10, though. The engine is not meant to
update screen parts outside the port dimensions.
Another solution would be to improve the vertical
placement of the portraits with these patches, but
that seems to be more complicated.
The original interpreter supports that, although it is slightly
broken. It will show black boxes for the hires graphics, since
the mode isn't properly checked. I have fixed that here to
show the the lores graphics.
- The main purpose was to move more upscaling logic out of the engine
- This actually contains various precision fixes to the hires code. There
were some comments about being unsure what to. I think I managed to
fix all of these, although it shouldn't make a visible difference, since the
workarounds worked as intended.
- It does actually fix a very minor glitch: The portraits were vertically off
by one pixel. And the opening AVI video is probably also vertically fixed
by one pixel (although the video display in the original is not done very
well, anyway).
(SQ4 Korean text not rendered after refactor)
This should get some testing if possible.
Also, it would be interesting to know if other
controls (icon, list, text edit) would also need
a similar solution.
Currently the screen shakes will not be scaled to the driver's
screen resolution. This patch fixes that.
Now, this isn't exactly the original behaviour. The screen
shaking was a hardware feature that only EGA and VGA
adapters had. Therefore, the screen shake function is
only implemented in the drivers for these devices. For
all other graphics hardware the drivers have an empty
dummy function for the screen shake (at least from
what I have see). But we needn't be strict here, we can
shake everything...
The PC-98 targets all use the xoring method, like SCI0early.
Also, this does not only apply to the button control, but
also to the text and icon controls.
I noticed that the original PQ2 interpreter can have other text
colors than blue. It can also draw text in yellow and white. I don't
think that it gets used, but I'd rather just fix it, before I try to find
that out...