Commit Graph
67 Commits
Author SHA1 Message Date
Eugene Sandulenko abea37c9bb ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
sluicebox 0aa55ce452 SCI32: Avoid global constructors in CelObj
Fixes the last clang warning in the SCI engine
2021-08-24 18:01:42 -05:00
sluicebox a92582ef0e SCI32: Translate Mac colors when drawing CelObjColor
Fixes several kSetShowStyle transitions such as the iris effect
in LSL6 Hi-res Mac at the end of the beach scene at night (room 860)
2021-05-01 14:29:18 -07:00
Filippos Karapetis bd7e708fc3 SCI: Move resource related functionality into a separate folder 2020-11-29 14:34:55 +02:00
sluicebox 336bf0dd37 SCI32: Translate Mac colors when drawing cels
Fixes KQ7 credits, RAMA credits
2020-07-23 02:41:10 -07:00
Bastien Bouclet 553d2968bb SCI: Add override keywords 2020-02-09 12:43:16 +01:00
Colin Snover 07df6cc254 SCI: Add built-in resource patcher
The resource patcher can be used to patch non-script resources
like views, maps, sounds, etc. It is more primitive than the script
patcher in that it does not use signatures for safe and automatic
patch relocation, but it does at least allow existing resources to
be grown if needed.

Refs Trac#9788. Refs Trac#9690.
2020-01-19 21:37:20 +02:00
Filippos Karapetis 2fd416b0ac SCI32: Extend scaler sanity checks to all SCI32 versions
Fixes QFG4 bug #10765. It's preferable to have sanity checks in the
code, rather than crashing due to invalid draw rectangles from buggy
game scripts. It's no use checking which specific interpreter versions
had sanity checks and trust the game scripts of the other interpreters.
Thus, it's easier and safer to always enable these sanity checks.
2019-06-30 14:46:37 +03:00
Torbjörn Andersson bc1a9b06d4 SCI: Use LarryScale in games that support it, not just LSL7
This is the solution discussed in bug #10568 ("SCI: PHANT1: Crash
on startup"). I believe that it's the correct solution, and that
ScummVM will do the right thing, but I'm not 100% sure.
2018-06-29 21:59:39 +02:00
David Fioramonti fab1894f21 SCI32: Only enable larry scaler for LSL7
Fixes Trac#10568.
2018-06-15 11:39:28 -05:00
Daniel Wolf 999cf71dcf SCI: Add game option for enabling/disabling LarryScale in LSL7
All other SCI games continue using the default scaler.
2018-03-16 22:33:06 +01:00
Daniel Wolf f8c32b07e7 SCI: Use LarryScale cel scaler instead of nearest-neighbor 2018-03-16 22:33:06 +01: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 b6c3f0f547 SCI32: Clean up CelObj
* Rewrap comments to 80 columns
* Clarify comments where possible
* Use smart pointers where appropriate
* Change view/pic flags detection to always use word-size
  (byte-size check for flag 0x80 was a compiler optimisation)
2017-10-06 22:56:24 -05:00
Colin Snover b8af2ca66f SCI32: Fix clipping of inventory items in Phant2
This fixes overlapping of the left arrow in all cases, but the
scroll delta and initial offset of inventory items will only be
fixed in new games because the affected objects are global objects
whose bad properties get persisted into save games.

Fixes Trac#10037.
2017-09-15 12:08:31 -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
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 88f020c7d4 SCI32: Fix out-of-bounds reads of truncated uncompressed cels
This happens e.g. on the About page in LSL7 because of an
interpreter problem where bitmap handles are destroyed and then
reused without a kFrameOut call to remove old screen items from
the visible plane list before a kIsOnMe call that causes the
engine to try to read from reused bitmap handles with different
contents and dimensions.

This replaces bad memory reads on the About page in LSL7 with an
assertion failure, until the problem with the About page can be
properly addressed.
2017-04-23 13:07:25 -05:00
Colin Snover 31daa956d6 SCI: Implement bounds-checked reads of game resources 2017-03-27 19:42:31 -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 4cff1e400f SCI32: Add support for alternate graphics selectors
Used by at least Phantasmagoria 2.
2016-12-19 14:46:59 -06:00
Colin Snover e8c429832f SCI32: Automate kNumCels workaround 2016-11-02 15:43:07 -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 ab88597a4a SCI32: Make kNumCels error more detailed 2016-10-01 15:26:34 -05:00
Colin Snover e412eaffbc SCI32: Clean up and document GfxPalette32 2016-09-29 19:39:16 -05:00
Colin Snover 8fd19f84c8 SCI: Deduplicate call origin formatting 2016-09-29 19:39:16 -05:00
Colin Snover 2035e21667 SCI32: Add workaround for kNumCels
This workaround may be able to be vastly simplified in the future
since, so far, simply returning the number of cels in loop 0 is
enough to make all the scripts with this bug work as expected.
2016-09-29 19:39:16 -05:00
Colin Snover 3208f063b5 SCI32: Extra bounds checking in CelObj renderer 2016-09-29 19:39:16 -05:00
Colin Snover 9a64c0587b SCI32: Always build scaler tables to the maximum possible size
This fixes rendering errors in Torin caused by the scaler table
being cut off early when cels larger than the dimensions of the
screen are scaled.
2016-09-29 19:39:16 -05:00
Colin Snover cb66bfead0 SCI32: Fix CelObj scaling in games with hi-res scripts 2016-09-29 19:39:16 -05:00
Colin Snover 240b0ca348 SCI32: Add a trap for invalid calls to kNumCels 2016-09-29 19:39:16 -05:00
Colin Snover 71294a8a98 SCI32: Remove extra ! in error message 2016-08-24 15:23:30 -05:00
Colin Snover 64f4ad4ad5 SCI32: Fix incorrect boolean operator 2016-08-24 15:22:55 -05:00
Colin Snover 1b6ea78216 SCI32: Remove error check for negative celNo
Negative cel numbers are exploited by at least the hi-res mode of
PQ4CD.
2016-08-24 15:21:42 -05:00
Colin Snover 051eae4639 SCI32: Increase maximum line width for graphics
Torin renders pics that are wider than 1024px; SCI3 bumps the
maximum line width to 4k.
2016-08-19 15:23:10 -05:00
Colin Snover fdb2290415 SCI32: Add some bounds checking, const-correctness, and errors to CelObj 2016-08-19 13:57:40 -05:00
Colin Snover ff00e93c67 SCI32: Remove GfxScreen from SCI32 2016-08-19 13:57:40 -05:00
Colin Snover 2071196f42 SCI32: Add bitmap segment and remove GC option from hunk segment 2016-08-01 10:37:14 -05:00
Colin Snover 631d22c4ac SCI32: Remove dead placeholder rendering code 2016-07-27 08:50:03 -05:00
Colin Snover 4cfc387602 SCI32: Split GfxPalette and GfxPalette32 + HunkPalette 2016-07-11 10:39:50 -05:00
Colin Snover b6dbc79021 SCI32: Add support for blacklined video
Ow. My eyeballs.
2016-07-10 09:36:10 -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 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 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 371b50e75a SCI32: Add explicit checks for null pointers
CID 1351617, 1351618, 1351619, 1351620, 1351621, 1351622, 1354791.
2016-05-27 19:20:22 -05:00
Colin Snover 4840b889d7 SCI32: Initialise pointers in CelObj scaler
This ensures that if there is a bug in the drawing code that causes
the row to be unset, it will not result in silently reading garbage
out of random memory.

CID 1354802
2016-05-27 15:54:14 -05:00
Colin Snover 746c4e7b03 SCI32: Fix CelObj cache
The previous implementation did not work properly, assigning the
next insertion index to the oldest object instead of filling empty
cache slots on a cache miss.
2016-05-27 15:54:14 -05:00
Filippos Karapetis 5a547bd242 SCI32: Implement analyzeForRemap() 2016-03-16 01:51:09 +02:00
Filippos Karapetis 5be798c92f SCI32: Implement the remapping drawing functions 2016-03-16 01:51:09 +02:00
Filippos Karapetis 1f47766b60 SCI32: Implement analyzeUncompressedForRemap() 2016-03-16 01:51:08 +02:00