Commit Graph
1475 Commits
Author SHA1 Message Date
Colin Snover 7545bb7133 SCI32: Clip videos to the screen
This is needed for 8.VMD in Lighthouse (room 380, the credits
room), which is rendered partially off the bottom of the screen.
OSystem does not accept rects that are offscreen.

Technically this video probably should not have been doubled
vertically by game scripts, but there is not enough space to fix
the rendering with a regular script patch, and it is a very
unimportant video.
2017-09-03 20:58:07 -05:00
Colin Snover 43a07abb46 SCI32: Implement kCelLink
kCelLink exists in SSCI since 2.1mid, but it is only known to be
used in Lighthouse, during the weapon creation puzzle near the end
of the game.
2017-09-03 20:58:07 -05:00
Torbjörn Andersson 70a2ca8b7d JANITORIAL: Silence more GCC 7 warnings
All these fall through were marked as deliberate, so again I've only
changed the comment to silence GCC.
2017-08-06 13:30:51 +02:00
Bastien Bouclet ec49730711 VIDEO: Allow setting the mixer sound type used to play audio tracks 2017-07-27 06:40:07 +02:00
Colin Snover 580f3875c0 SCI32: Fix explicit mouse position changes
This was broken by 9f33f2b3df.
2017-07-23 11:42:55 -05:00
Colin Snover dabcacb0ca SCI32: Add missing method documentation 2017-07-23 10:35:13 -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
Colin Snover 2004aecb05 SCI32: Make stop flag condition more explicit 2017-07-23 10:35:13 -05:00
Colin Snover 2ed18b86db SCI32: Check for stop events before rendering the next frame
This should make things slightly more responsive and avoids
unnecessary rendering of frames that are just going to disappear
in a moment.
2017-07-23 10:35:13 -05:00
Colin Snover 0beb259278 SCI32: Improve performance when flushing events during video playback
Calling through EventManager::getSciEvent to flush events is
pretty inefficient and created stalls that lead to dropped
frames during the chapter 7 chase in Phantasmagoria 1.

If necessary, performance could be improved further by extending
Common::EventManager to expose SDL_FlushEvents, but this seems to
finish in 0-1ms so should be OK for now.

Refs Trac#9974, Trac#9975.
2017-07-23 10:35:13 -05:00
Colin Snover 5b166a5173 SCI32: Avoid extra cursor paints when the cursor has not moved 2017-07-23 10:35:13 -05:00
Colin Snover 9f33f2b3df SCI32: Don't warp the mouse when it doesn't need to be warped 2017-07-23 10:35:13 -05:00
Colin Snover 6ad230da7c SCI32: Fix kIsOnMe crashes in LSL7 About screen 2017-07-18 12:35:06 -05:00
Colin Snover 09ef11a8cb SCI32: Remove ENABLE_SCI3_GAMES ifdef, now that they are supported 2017-07-17 22:42:18 -05:00
Colin Snover d8eccdec32 SCI: Clarify Tab character & modifier workarounds in GfxMenu 2017-07-16 14:26:30 -05:00
Colin Snover 6379498303 SCI: Fix kMenuSelect to understand control characters
In b4c0be8b42 keyboard events were
adjusted to send control characters to game scripts, which matches
how keyboard input works in SSCI. Unfortunately this broke games
using kMenuSelect because that kernel code was not expecting to
receive control characters.

Here is an amended list of known types of keyboard shortcuts, for
future reference:

* All games with text inputs (Ctrl+C clears text boxes)
* Most games using MenuBar, like QFG1EGA (Ctrl+P pauses the
  game, Tab or Ctrl+I show inventory)
* QFG1VGA (Ctrl+S shows stats)
* Torin (Ctrl+N, Ctrl+O, Ctrl+S, etc. activate menu commands)
* LSL1VGA & LSL3 (Ctrl+Alt+X to bypass age check)
* Most in-game debuggers (Alt+T for teleport)

The shortcut handling code is still not 100% accurate since there
are some edge cases that are not implemented (e.g. in DOS/SSCI,
Shift+Ctrl+<key> usually sends the same key information as
Ctrl+<key>, but not if <key> is Tab), but it should now be working
in a consistent and rational manner for end-users.
2017-07-16 14:26:30 -05:00
Colin Snover bbad7ada1b SCI32: Ignore chest view palette in Phantasmagoria
This fixes the 3-frame glitch that was also present in the
original game when moving in the chapel from room 6500 to 6400 in
chapter 7.

Fixes Trac#9788.
2017-07-13 21:31:21 -05:00
Colin Snover 7543bd444d SCI32: Move priority comparison of ScreenItems into its own function
Rendering bugs in ScummVM are often caused by buggy game scripts
relying on the last ditch sort, which is not the same in ScummVM
as in SSCI (since the SSCI last ditch sort relies on a different
memory architecture and is super buggy). However, these bugs do
not show up very frequently these days, so it is easy to forget
all the places that need to be checked when debugging a rendering
problem that appears to be caused by sorting failure.

This commit breaks out the last ditch comparison formerly in
Plane::calcLists to hopefully make it more visible to future
programmers.

Refs Trac#9957.
2017-07-13 21:31:07 -05:00
Colin Snover 8047f3fa77 SCI32: Stop optimising palette merges
While this optimisation helped to reduce unnecessary palette
updates in KQ7, it broke Phant1, which relies on changes to index
255 in the source palette causing palette invalidation.

Refs Trac#9788.
2017-07-13 17:19:50 -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 f59269006c SCI32: Implement kShowStyle HShutterOut transition
This transition style was used when exiting the asteroids minigame
in PQ4, though it appears likely that this was an error in the
original game script since it does not actually do anything in the
context that it is used (neither here nor in the original
interpreter).

Still, this code is already written, and it fixes the crash, so in
it goes.

Fixes Trac#9856.
2017-07-07 23:42:30 -05:00
Colin Snover 12d24d5b46 SCI32: Fix bad palette entries when built without USE_RGB_COLOR
This is only a problem for the Windows games that need some
palette entries to be ignored.
2017-07-06 19:12:40 -05:00
Colin Snover 3f0e061eaa SCI32: Refactor DuckPlayer to use common video playback code
This lets DuckPlayer support configurable black-lined video and
configurable high-quality scaling.
2017-07-06 19:12:39 -05:00
Colin Snover f15f9e3b7c SCI32: Refactor Video32 code to reduce code & feature duplication 2017-07-06 19:12:39 -05:00
Colin Snover 71256a0d3c SCI32: Improve playback quality of SEQ videos 2017-07-06 19:12:39 -05: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 8cb35442c0 SCI32: Improve kShowMovieWin (AVI) rendering
1. Added a new game option for linear interpolation when scaling
   video in ScummVM builds with USE_RGB_COLOR;
2. 8bpp videos that put black in a palette index other than 0
   (KQ7) should now always render correctly without the earlier
   game-specific workarounds which did not work very well;
3. Data from game scripts regarding video size and position are
   now ignored, since games always just try to show videos in the
   middle of the screen, but frequently get this a little bit
   wrong, causing either bad aspect ratios or off-center videos;
4. Builds without USE_RGB_COLOR support will not crash when
   attempting to play >8bpp AVIs, like those from KQ7 2.00b.

Fixes Trac#9843, Trac#9762.
2017-07-06 19:12:38 -05:00
Colin Snover e9bef89646 SCI32: Remove useless call
The show list is already cleared by showBits so it does not need to
be cleared a second time.
2017-07-06 19:12:38 -05:00
Colin Snover 2d6fe2b8cd SCI32: Work around bogus palette entries in select Windows games 2017-07-06 19:12:37 -05:00
Colin Snover c6f5840196 SCI32: Remove magic numbers in HunkPalette 2017-07-06 19:12:37 -05:00
Colin Snover f7fcce24e1 SCI32: Remove unused method declaration 2017-07-06 19:12:37 -05:00
Colin Snover 35346bc71b SCI32: Update mouse position for rendering in all frameOuts 2017-07-06 19:12:37 -05:00
Colin Snover 1fbee2f51e SCI32: Allow skipping SEQ animations
In SSCI, SEQ animations cannot be skipped.
2017-07-06 19:12:36 -05:00
Colin Snover 9f910535c9 SCI32: Centralise OSystem screen updates 2017-07-06 19:12:35 -05:00
Colin Snover f40ea8c2e7 SCI32: Stop setting unused palette timestamp property 2017-07-06 19:12:35 -05:00
Colin Snover a689fee663 SCI32: Speed up & deduplicate palette submission code 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 58c83dcd14 COMMON: Make SpanOwner copy assignment make a copy of the owned Span
To move data from one SpanOwner to another, use `moveFrom`.
Thanks @waltervn for pointing out the problem.
2017-06-08 10:45:55 -05:00
Colin Snover f940346812 SCI32: Minor cleanup to plane debug information 2017-05-27 23:36:11 -05:00
Filippos Karapetis 03c1b3307c SCI: Remove a leftover SCI32 hack 2017-05-27 13:32:02 +03:00
Willem Jan Palenstijn d9807b0fca SCI32: Fix warning 2017-05-26 19:33:59 +02:00
Willem Jan Palenstijn 388419c53c SCI: Ignore priority and transparency for KQ6 hi-res views
This fixes bug 9786. Thanks to m_kiewitz for verifying with disasm.
2017-05-15 22:03:25 +02:00
Colin Snover 604ac1a375 SCI32: Update cursor even when position appears unchanged
This may be masking another bug, but at least what happens in
Phant1 is that the mouse does not get redrawn after being moved
programmatically to the fast-forward button when deviceMoved
returns early.
2017-05-06 19:00:04 -05:00
Colin Snover 85105294f2 SCI32: Add some missing onFrame hooks for the debugger 2017-05-06 10:38:59 -05:00
Colin Snover 8a590e600f SCI32: Disable VMD kPlayFlagBlackPalette flag
Videos in GK2 use this flag (e.g. the chapter 6 intro).

Now that GfxPalette32::updateHardware no longer calls
OSystem::updateScreen (only GfxFrameout::frameOut does this now),
every time a palette swap occurs during playback, there is a frame
of blackness that should not exist. This is because the order of
operation is:

1. Send black palette
2. Call frameOut (which updates the screen)
3. Send new, correct palette
4. No frameOut (so the screen is not updated with the correct
   palette)

OSystem::updateScreen cannot be called multiple times for the same
frame due to vsync, but also, there does not appear to be any
reason to send a black palette, since it seems to be intended to
avoid temporarily rendering video frames with the wrong palette on
a hardware device that cannot guarantee simultaneous application
of a new palette and new pixel data. ScummVM does not have such
a problem, so this feature appears to be unnecessary for us.

For the moment, this 'feature' remains hidden behind an ifdef,
instead of being removed entirely, to avoid potential confusion
when comparing VMD code from SSCI.
2017-05-06 10:38:58 -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 575ed98da1 SCI32: Centralize handling of pixel format switches 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 bb40889a60 Revert "SCI32: Add debugging calls to GfxCursor32"
This reverts commit c02f2674ad.

Two minutes after committing this, the author of the ticket
resolved the problem, which was caused by missing VMDs.
2017-05-01 21:16:20 -05:00