Commit Graph
1475 Commits
Author SHA1 Message Date
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 e133c74403 SCI32: Fix unnecessary palette updates
Some games load palettes that include color 255, but this is
hardcoded to white in SSCI, so just ignore it during merges since
it is ignored when the hardware palette is updated anyway.
2016-07-12 14:43:56 -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 08821cf4e3 SCI32: Give planes a default type
With the addition of the transparent pic type code, the _type
property would be read uninitialised by setType if _pictureId was
set to kPlanePic.

CID 1357230, 1357231.
2016-07-11 10:39:50 -05:00
Colin Snover f171db965c SCI32: Guard against no split count
CID 1357229.
2016-07-11 10:39:50 -05:00
Colin Snover 60c3663142 SCI32: Fix incorrect logic of cycler overflow 2016-07-11 10:39:50 -05:00
Colin Snover bc362e5b7c SCI32: Minor cleanup of GfxPalette32 2016-07-11 10:39:50 -05:00
Colin Snover 8fb55564a6 SCI32: Fix bad output caused by missing palette copies
Sometimes, games accidentally use palette entries that are not
marked as used and expect them to be a particular colour, like the
Phantasmagoria title screen, or the white palette entry (always
255 in DOS/Win).
2016-07-11 10:39:50 -05:00
Colin Snover 4cfc387602 SCI32: Split GfxPalette and GfxPalette32 + HunkPalette 2016-07-11 10:39:50 -05:00
Colin Snover 19f90177b7 SCI32: Clean up Video32/VMDPlayer 2016-07-10 10:18:30 -05:00
Colin Snover b6dbc79021 SCI32: Add support for blacklined video
Ow. My eyeballs.
2016-07-10 09:36:10 -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 da48b1bbea SCI32: Document _remapOccurred flag 2016-07-02 22:28:53 -05:00
Colin Snover a4c059b864 SCI32: Improve accuracy of frameout throttler 2016-07-02 22:28:47 -05:00
Colin Snover 77991b7eac SCI32: Add const to getCurrentBuffer 2016-07-02 22:28:41 -05:00
Colin Snover 07b72c9fec SCI32: Document ScreenItem::_insetRect 2016-07-02 22:28:37 -05:00
Willem Jan Palenstijn 79b0309fd1 SCI32: Fix dropping events in kEditText 2016-07-02 22:56:53 +02:00
Colin Snover 948e448738 SCI32: Fix signed comparison warnings 2016-07-01 15:58:43 -05:00
Colin Snover 6c8661d144 SCI32: Fix bad rendering of subtitle backgrounds in Torin
The way dimensions of scaled screen items are calculated changed
over the lifetime of SSCI. In early low-resolution and
mixed-resolution games, scaled drawing needed to use at a global
cadence across the entire screen to ensure proper alignment, but
in later games (like Torin), local scaling of individual screen
items seems to be the way scaling is performed.
2016-07-01 15:54:27 -05:00
Colin Snover 4ee1901706 SCI32: Add transparent pic plane type
It is not clear if this is ever actually used by game scripts,
though.
2016-06-30 14:04:57 -05:00
Colin Snover e89bdf536d SCI32: Clean-up pass on rendering pipeline
This pass exposed two bugs, which have been fixed:

1. Checks of `_updated` and `_moved` were reversed in some areas,
   which lead to rendering bugs. In SQ6 the rendering bugs were
   subtle or non-existant, but in e.g. PQ:SWAT the Sierra logo and
   title screen animations were totally missing.

2. The renderer formerly kept reading from ScreenItemLists when
   new items were added in decrementScreenItemArrayCounts, but
   this was determined to be unnecessary.
2016-06-30 14:04:57 -05:00
Colin Snover 0310b4dc4d SCI32: Implement engine-accurate screen item list sorting
It seems highly probable that there are later SCI games that use
the "hi res" rendering path, so sorting and unsorting of
ScreenItemLists needs to be accurate.
2016-06-30 14:04:57 -05:00
Colin Snover a785147d6c SCI32: Document & clean up extra rect argument for frameOut
This extra rect seems to probably only ever be used by VMD
playback in some SCI2.1 games.
2016-06-30 14:04:57 -05:00
Colin Snover 29f7a66af4 SCI32: Add low resolution constants
In a few places in the graphics system, fixed low-resolution values
are used instead of the game script resolution.
2016-06-30 14:04:56 -05:00
Colin Snover 1632bd50c8 SCI32: Fix benchmarking for QFG4 2016-06-26 12:44:36 -05:00
Colin Snover 60849a16cb SCI32: Change Color::operator!= to all operator== directly 2016-06-26 12:44:35 -05:00
Colin Snover 3ffde88b18 SCI32: Fix typo 2016-06-26 12:44:35 -05:00
Colin Snover 26e7d3d9e9 SCI32: Remove no-longer-relevant comment 2016-06-26 12:44:35 -05:00
Colin Snover cfda8b9ecd SCI32: Fix broken Remap implementation
Remap would crash SCI2.1early games with 19 remap slots, and
did not actually work in most cases in SCI2.1mid+ games.

The SCI16 implementation was moved to its own separate file but
was otherwise touched as little as possible, so may still have
similar problems to the SCI32 code.

1. Split SCI16 and SCI32 code into separate files
2. Use -32 prefixes for SCI32 code and no prefix for SCI16 code,
   where possible, to match other existing code
3. Avoid accidental corruption of values from the VM that may be
   valid when signed or larger than 8 bits
4. Added documentation
5. Add missing remap CelObj calls
6. Inline where possible in performance-critical code paths
7. Fix bad `matchColor` function, and move it from GfxPalette to
   GfxRemap32 since it is only used by GfxRemap32
8. Fix bad capitalisation in getCycleMap
9. Remove unnecessary initialisation of SingleRemaps
10. Update architecture to more closely mirror how SSCI worked
11. Clarify the purpose of each type of remap type (and
    associated variable names)
12. Split large `apply` function into smaller units
13. Fix buffer overrun when loading a SCI2.1early game with remap
14. Remove use of `#define` constants
15. Warn instead of crashing with an error on invalid input (to
    match SSCI more closely)
16. Change the collision avoidance mechanism between the RemapType
    enum and remap kernel functions
17. Add save/load function
2016-06-26 12:42:58 -05:00
Colin Snover d6d0e00dc5 SCI32: Expose a draw buffer on BitmapResource objects
Most of the time, we get a bitmap to draw on it. Exposing a buffer
avoids consumers having to create their own all the time, and
encourages use of common drawing code exposed by the buffer.
2016-06-21 16:11:43 -05:00
Colin Snover 4495ae3de0 SCI32: Remove unused dependencies from GfxFrameout 2016-06-21 08:17:28 -05:00
Colin Snover 820e6b8bd3 SCI32: Fixes to GfxText32
1. Inline borderSize constant in createFontBitmap for consistency
2. Fix "DrawTextBox GetLongest=0" warning to only appear in games
   that actually had this check (SQ6 and MGDX)
3. "Fix" implementation of getTextSize for SCI2.1early, which
   gave lines with word wrap disabled a height of 0
4. Add inlining hints to some methods in BitmapResource that were
   missing them for some reason
2016-06-21 08:17:28 -05:00
Colin Snover 52505dc57f SCI32: Implement basic kMessageBox
This kernel call seems only to be used by KQ7 1.51 (which was
Windows-only) to send warnings to the user.

It was easy enough to do a basic implementation in the ScummVM
GUI rather than just make it an empty call, so now it is a thing.
2016-06-21 08:14:12 -05:00
Willem Jan PalenstijnandColin Snover ab864ba366 SCI32: Implement kScrollWindow
These should be all the actually used subfunctions.

Co-authored-by: Colin Snover <github.com@zetafleet.com>
2016-06-21 08:14:12 -05:00
Colin Snover a613a27b44 SCI32: Implement line drawing (kAddLine/kUpdateLine/kRemoveLine)
This line drawing code lives in a remodelled GfxPaint32 class
that is totally separate from GfxPaint16.
2016-06-21 08:14:12 -05:00
Willem Jan Palenstijn 94328f0ec8 SCI32: Make GfxText32::_scaledWidth/Height statics
They were global in SSCI. This way secondary GfxText32 instances
(such as in ScrollWindow) use the correct scaling.
2016-06-21 08:14:12 -05:00
Willem Jan Palenstijn c4b41f5d7c SCI32: Fix drawText on consecutive control codes 2016-06-21 08:14:11 -05:00
Willem Jan Palenstijn 97c11e7d5f SCI32: Fix getTextWidth on consecutive control codes 2016-06-21 08:14:11 -05:00
Colin Snover b56266d28d SCI32: Fix video performance benchmarking in most SCI32 games
Most SCI32 games draw a "fred" object to the screen when the game
first starts to benchmark video performance. When framerate
throttling is enabled (which fixes many/most timing-related bugs
and reduces system load caused by unnecessary graphics updates),
the game's performance check will think that video card is slow,
causing some "high-performance" game features to be disabled.

To avoid this, we simply disable throttling during benchmarking by
detecting the "fred" object.
2016-06-14 20:58:53 -05:00
Filippos Karapetis a4ef3f9d73 SCI32: All versions of KQ7 are using the older remap range semantics 2016-06-13 12:01:28 +03:00
Filippos Karapetis 00761de4a3 SCI32: Remove the unused newColors array 2016-06-13 12:01:28 +03:00
Colin Snover de78651a5d SCI32: Really guard against null pointer dereference in calcLists
CID 1356125.
2016-05-30 08:35:53 -05:00
Colin Snover 694d4edd15 SCI32: Provide default value for vmap minDiffIndex
SSCI did not initialise minDiffIndex and would always flow into
the condition that sets it, but some compilers complain that the
value may be used uninitialised, so we will just set it to map
back to its original palette index by default.
2016-05-28 11:02:40 -05:00
Colin Snover 0c708ddcf7 SCI32: Simplify default text width equation 2016-05-28 10:31:23 -05:00
Eugene Sandulenko 986f4bbbf6 SCI: Explicit type conversion. Avoids warnings on number of compilers. 2016-05-28 17:11:49 +02:00
Eugene Sandulenko 4bb793a72d SCI: Fix warning 2016-05-28 17:09:50 +02:00
Colin Snover c8019487f9 SCI32: Remove unused titled text bitmap code
Titled text bitmaps do not appear to be used by any game scripts.
They seem to only be used by the error manager in SSCI, but
ScummVM has its own error handling, so we don’t need this
implementation.
2016-05-28 09:14:33 -05:00
Colin Snover 371b50e75a SCI32: Add explicit checks for null pointers
CID 1351617, 1351618, 1351619, 1351620, 1351621, 1351622, 1354791.
2016-05-27 19:20:22 -05:00