Commit graph

249 commits

Author SHA1 Message Date
Colin Snover
432fd522d2 ENGINES: Remove default1x scaler flag
This flag is removed for a few reasons:

* Engines universally set this flag to true for widths > 320,
  which made it redundant everywhere;
* This flag functioned primarily as a "force 1x scaler" flag,
  since its behaviour was almost completely undocumented and users
  would need to figure out that they'd need an explicit non-default
  scaler set to get a scaler to operate at widths > 320;
* (Most importantly) engines should not be in the business of
  deciding how the backend may choose to render its virtual screen.
  The choice of rendering behaviour belongs to the user, and the
  backend, in that order.

A nearby future commit restores the default1x scaler behaviour in
the SDL backend code for the moment, but in the future it is my
hope that there will be a better configuration UI to allow users
to specify how they want scaling to work for high resolutions.
2017-10-07 12:30:29 -05:00
Colin Snover
c7c5f28bdb SCI32: Clean up scriptWidth/scriptHeight/screenWidth/screenHeight
This removes the unnecessary Buffer subclass and stops most places
where the output buffer was being interrogated about dimensions
instead of GfxFrameout.
2017-10-06 22:56:26 -05:00
Colin Snover
f51b158f8c SCI32: Clean up GfxFrameout
* Rewrap doxygen comments to 80 columns
* Swap public/private sections so public APIs come first
* Clarify comments where easily possible
2017-10-06 22:10:51 -05:00
Colin Snover
b2966f3fc8 SCI32: Fix support for RAMA demo
Fixes Trac#10251.
2017-09-30 01:08:12 -05:00
Colin Snover
3cdf26b355 SCI32: Fix bad text rendering in RAMA
In SCI3, Sierra removed the ability of the main renderer to
automatically scale CelObjs with different source resolutions.
Instead, in SCI3, all CelObjs are treated as having the same
resolution as the screen (i.e. 640x480).

In all SCI3 games other than RAMA, keeping the code paths for
resolution-dependent scaling is not a problem because all the
assets and game code are correctly designed to use the same
640x480 resolution throughout. RAMA, on the other hand, was
written with the text subsystem set to a resolution of 630x450
(Phant1's screen resolution), and in SSCI, resolution-dependent
scaling code was not removed from the *text* subsystem. As a
result, RAMA's game scripts rely on the slightly larger scaled
dimensions coming out of the text system when determining the size
of screen items for rendering, and then also rely on the main
renderer ignoring the 630x450 resolution baked into the bitmaps
generated by the text subsystem when drawing them to the screen.
2017-09-29 19:56:24 -05:00
Colin Snover
d363234129 SCI32: Fix GfxFrameout::addPlane from causing possible leaks 2017-09-19 19:54:30 -05:00
Colin Snover
d6139890fe SCI32: Exit early from screen shake if engine is quitting 2017-09-03 20:58:10 -05:00
Colin Snover
8d32353394 SCI32: Stop throttling of kFrameOut during interactive VMD playback
Refs Trac#9974, Trac#9975.
2017-07-23 10:35:13 -05:00
Willem Jan Palenstijn
820caf370e SCI32: Fix kObjectIntersect
It was using SCI16 calls to get the NowSeenRects.

This fixes #9855.
2017-07-09 22:56:04 +02:00
Colin Snover
7057f232d7 SCI32: Improve kPlayVMD rendering
1. Added a new game option for linear interpolation when scaling
   overlay-mode video in ScummVM builds with USE_RGB_COLOR;
2. Implemented SCI2.1-variant of the VMD player renderer (fixes
   Trac#9857), which bypasses the engine's normal rendering
   pipeline;
3. Improved accuracy of the SCI3-variant of the VMD player by
   writing HunkPalettes into the VMD's CelObjMem instead of
   submitting palettes directly to GfxPalette32.
2017-07-06 19:12:38 -05:00
Colin Snover
35346bc71b SCI32: Update mouse position for rendering in all frameOuts 2017-07-06 19:12:37 -05:00
Colin Snover
9f910535c9 SCI32: Centralise OSystem screen updates 2017-07-06 19:12:35 -05:00
Colin Snover
832cd25ef1 SCI32: Avoid out-of-bounds read of pixel data in kIsOnMe
Fixes Trac#9761, Trac#9844, Trac#9850, Trac#9851.
2017-06-17 14:35:42 -05:00
Colin Snover
8b49313af3 SCI32: Fix terrible rendering performance when vsync is enabled
More than one call to OSystem::updateScreen per frame on systems
with vsync ruins performance because the call is blocked until
the next vsync interval.

This also fixes bad rendering performance with the OpenGL backend.
2017-05-06 10:38:58 -05:00
Colin Snover
91df45c6c5 SCI32: Fix missing/incorrect game features detection 2017-05-06 10:38:58 -05:00
Colin Snover
8d94a04605 SCI32: Disable game script video benchmarking
The approach to video benchmarking used by SCI engine does not
translate very well to modern video devices -- it will either be
so slow that the games think the system is not capable of showing
normal visual effects, or so fast that the benchmarks overflow
their counters. So, game scripts that perform video benchmarking
are now patched to unconditionally return the highest speed value.

A pleasant but subtle side-effect of this change is that the extra
time sitting at a blank screen before the start of a game (while
benchmarks ran) is now gone.

Fixes Trac#9741.
2017-05-04 23:00:53 -05:00
Colin Snover
5dd9618842 SCI32: Remove unnecessary GfxFrameout::_frameNowVisible
This flag was used in SSCI to read from VRAM instead of from the
back buffer when a mouse interrupt was received in the middle of
a back buffer update. Since ScummVM controls when mouse events
are received via polling, it is not possible to receive a mouse
event in the middle of back buffer updates, so this code is
unnecessary for the engine to work properly.

This also fixes Valgrind warnings about use of uninitialized
memory at the start of the game, caused by not filling the cursor
memory buffers because `_frameNowVisible` was false until the first
frame was rendered.
2017-04-29 14:31:01 -05:00
Colin Snover
ec12c5a342 SCI: Move ScummVM save/restore to GuestAdditions and reimplement for SCI32 2017-04-22 13:01:16 -05:00
Colin Snover
739047f887 SCI32: Always reinit GfxText32 statics on game startup
Fixes bad scaling of text when switching between games with
different script resolutions.
2017-03-30 19:46:27 -05:00
Colin Snover
dd13fdfe17 SCI32: "Fix" renderer for PQ4CD
PQ4CD and several other games contain a hack in two renderer
methods to avoid rendering invalid screen items with zero or
negative-dimension target rects. This prevents PQ4CD from
crashing during the fifth phase of target practice.
2017-01-12 13:14:10 -06:00
Colin Snover
7156a82a64 SCI32: Improve mouse responsiveness
This is most noticeable at the beginning of the game during
benchmarking, where the benchmarking loop used to cause the mouse
to get stuck for the duration of the benchmark.
2017-01-11 11:01:38 -06:00
Colin Snover
126378fa26 SCI32: Fix bad coordinates in PQ:SWAT demo 2017-01-09 19:34:54 -06:00
Colin Snover
b818e54027 SCI32: Fix crashes and bad cel positioning in GK2 demo 2017-01-09 19:34:54 -06:00
Colin Snover
4cff1e400f SCI32: Add support for alternate graphics selectors
Used by at least Phantasmagoria 2.
2016-12-19 14:46:59 -06:00
Colin Snover
724385eb5e SCI32: Fix slow SCI2.1mid transitions
SSCI transitions code sends a large number of small show rects
to the graphics manager, one at a time, for each division of a
transition. Each time a rect is submitted, a call to showBits
is made. This design was used when transitions for SCI32 were
first implemented in ScummVM, and it worked OK because the
hardware surface was updated by EventManager::getSciEvent,
not showBits, so the large number of calls to showBits from the
transitions code did not adversely affect engine performance.

Later in SCI32 engine development, hardware surface updates
were changed to occur in showBits so that the hardware surface
would be updated at frame-out time, instead of at input-in time.
This change meant that now the large number of calls to showBits
from transitions became very expensive, and the engine would
stall constantly refreshing the entire hardware surface.

To fix this problem, the transitions code now (1) maximises the
size of rects coming from transitions, when possible, and (2) only
calls showBits when all the rects from one frame of a transition
have been calculated and added to the show rects list.

Additionally, there were some arithmetic errors in the
implementation of pixel dissolve that have been corrected in this
changeset.

Fixes Trac#9614.
2016-10-22 13:18:38 -05:00
Colin Snover
4b6b328bbb SCI32: Check for existence of visiblePlane before dereferencing
CID 1351620.
2016-10-10 19:35:28 -05:00
Colin Snover
40444b0aeb SCI32: Clarify some identifiers
transparentColor -> skipColor
displace -> origin
scaledWidth -> xResolution
scaledHeight -> yResolution
2016-10-09 11:21:46 -05:00
Colin Snover
6290f1e5fc SCI: Add prefix to global variable constants 2016-09-29 19:39:16 -05:00
Colin Snover
b5d0fffb8b SCI: Replace magic numbers for globals with named constants 2016-09-29 19:39:16 -05:00
Colin Snover
658fb7f8e4 SCI32: Improved game resolution detection 2016-09-29 19:39:16 -05:00
Colin Snover
d0517f515e SCI32: Update screen on frameout, instead of in the event loop 2016-09-29 19:39:16 -05:00
Colin Snover
da62a99a00 SCI32: Remove unused ResourceManager from GfxFrameout 2016-08-19 15:23:10 -05:00
Colin Snover
4e1a9be816 SCI32: Remove CoordAdjuster32, at least for the moment
This may come back in the future to deduplicate some gfx code,
but SCI32 had two different inlined ways of doing coordinate
conversions with different rounding methods, so CoordAdjuster32
didn't get used when the graphics system was rewritten.

At the moment, SCI32 code uses the mulru/mulinc methods from
helper.h for scaling up/down coordinates.
2016-08-19 15:23:10 -05:00
Colin Snover
0f2748b15a SCI32: Implement kRobot 2016-08-19 14:08:22 -05:00
Colin Snover
6e2e862d8e SCI32: Implement kShakeScreen for SCI32 2016-08-19 13:57:40 -05:00
Colin Snover
89a82f5b55 SCI32: Fix signature of kSetNowSeen 2016-08-19 13:57:40 -05:00
Colin Snover
c8a2b9af22 SCI32: Fix comment 2016-08-19 13:57:40 -05:00
Colin Snover
80d9182554 SCI32: Implement SCI32 cursor support 2016-08-19 13:57:40 -05:00
Colin Snover
9bfeb3c297 SCI32: Remove GfxScreen from GfxFrameout
Only cursor remains to be updated to go through GfxFrameout, and
then we can let GfxScreen go back to being SCI16-only.
2016-08-19 13:57:40 -05:00
Colin Snover
c28a5733e0 SCI32: Fix GfxFrameout::_isHiRes flag to be accurate for all games 2016-08-11 20:50:33 -05:00
Colin Snover
4e31c9aaf4 SCI32: Don't crash on zero-dimension show rects
In the original engine this would have simply resulted in no draw,
but ScummVM is more strict about it. It is not 100% clear whether
these are normal and should be allowed or not, so for the moment
we'll emit a warning whenever a zero-dimension show rect is seen.

For now they only seem to be generated by plane transitions, and
these zero-dimension screen items cannot simply be omitted because
the 2.1early transitions code requires a fixed number of screen
items per step.
2016-08-01 10:37:14 -05:00
Colin Snover
0f535e79f5 SCI32: Add 6-argument signature of kAddPicAt
This is used by Torin in room 50900.
2016-08-01 10:37:14 -05:00
Colin Snover
156c68fe58 SCI32: Implement plane transitions (kSetShowStyle and kSetScroll)
This commit implements all of the known plane transitions from
SCI2 through SCI2.1mid games. Because kSetShowStyle is always
called indirectly via the Styler game script, it is difficult to
find all the places where transitions are used. As such,
transitions that appeared to never be used have been added as
stubs which will trigger a game crash with a message to report
what was being done, so any missed transition types can be
identified quickly and then implemented.
2016-08-01 10:37:14 -05:00
Colin Snover
20106fff7b SCI32: Fix backwards kFrameOut throttle timings 2016-07-27 08:49:38 -05:00
Colin Snover
65ca749f0a SCI32: Improve behaviour of screen transitions
1. Use the same throttling speed as normal frameouts. The
   old throttling speed seemed a bit too slow.
2. Exit the event loop immediately if the engine is supposed to
   quit, instead of forcing the user to wait until the transition
   has finished before quitting.
2016-07-24 11:36:48 -05:00
Colin Snover
efc12ffc5c SCI32: Avoid flash of incorrect colour when palettes are changed
Avoid forcing the screen to refresh after a palette change if the
screen is also about to be drawn to, as the palette change + draw
is intended to be an atomic operation.
2016-07-12 14:41:17 -05:00
Colin Snover
593560e876 SCI32: Add detection for Hoyle 5 demo 2016-07-11 13:02:27 -05:00
Colin Snover
4d91b458e5 SCI32: Implement kPlayVMD 2016-07-10 09:35:24 -05:00
Colin Snover
57a53420c3 SCI32: Expose graphics throttling code
Controls that manage their own event loops and call frameOut
directly generally need to sleep in order to avoid 100% CPU,
just like the main VM event loop.
2016-07-02 22:29:28 -05:00
Colin Snover
a4c059b864 SCI32: Improve accuracy of frameout throttler 2016-07-02 22:28:47 -05:00