Commit Graph
209 Commits
Author SHA1 Message Date
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
Colin Snover 948e448738 SCI32: Fix signed comparison warnings 2016-07-01 15:58:43 -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 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 1632bd50c8 SCI32: Fix benchmarking for QFG4 2016-06-26 12:44:36 -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 4495ae3de0 SCI32: Remove unused dependencies from GfxFrameout 2016-06-21 08:17:28 -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
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
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 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 abee16c563 SCI32: Use correct script dimensions for later SCI32 games
These values are hard-coded in the engine executable for each game.
2016-03-18 18:51:01 -05:00
Colin Snover e25d928a9c SCI32: Fix crashes in kIsOnMe caused by stale CelObjs 2016-03-18 13:08:37 -05:00
Colin Snover 5917467c1b SCI32: Fix incorrect double-read from CLUT 2016-03-18 09:14:53 -05:00
Colin Snover 804e132476 SCI32: Remove outdated note about state of frameout code
This code is engine-accurate now, not based on guesswork.
2016-03-17 10:43:08 -05:00
Colin Snover 17ec528c9a SCI32: Temporarily remove dead SCI2.1early transitions code
This code sneaked in with the graphics engine rewrite, but is not
ready yet to be used. It will return shortly, once it is enabled
and working.
2016-03-17 10:43:07 -05:00
Colin Snover 35fde1bbcf SCI32: Update unimplemented TODO to reflect the correct operation type 2016-03-17 10:43:07 -05:00
Colin Snover 7f4149d491 SCI32: Enable redrawAllCount in palMorphFrameOut 2016-03-17 10:43:07 -05:00
Colin Snover 33cac79373 SCI32: Work around bad Styler script in KQ7 2.0b
The SCI2.1mid version of the game includes scripts designed for
SCI2.1early which means wrong parameters are sent to the kernel.
2016-03-16 22:00:38 -05:00
Filippos Karapetis a393a1348a SCI32: Remove dead code related to priority map handling
The priority map is not used at all in SCI32 at the engine level by
design, so all the relevant code that handles picture priority is
pretty much dead
2016-03-16 01:51:07 +02:00
Filippos Karapetis b50d425387 SCI32: Global 12 contains the previous room 2016-03-16 01:51:06 +02:00
Filippos Karapetis be58e5bc30 SCI32: More work on remapping
Still not working
2016-03-15 21:06:46 +02:00
Filippos Karapetis 8f7ab881ee SCI32: Add remap counters and hook them up to frameOut 2016-03-11 07:54:45 +02:00
Colin Snover ac403ac746 SCI32: Clean up debug messages in GfxFrameout
Error messages now contain the name of the failed function and
plane/screen item information that can be used to look up the
plane/screen item in a debugger, if the games ever crash in a
release in this code, per suggestion by @m-kiewitz.

Commented out messages that were used during the rearchitecture of
the main graphics engine are also removed, since that code is stable
now.
2016-03-10 18:28:53 -06:00
Colin Snover 8dea740086 SCI32: Implement kMovePlaneItems 2016-03-10 18:28:53 -06:00
Colin Snover 4a16ebc970 SCI32: Implement kSetNowSeen 2016-03-10 14:16:56 -06:00
Colin Snover a2e9cc4965 SCI32: Clean up kIsOnMe and fix rounding bug
The implementation was not correctly rounding the scaled position
with mulru, leading to occasionally incorrect hit detection at
the boundaries of boxes.
2016-03-08 10:29:05 -06:00
Colin Snover bd75b26d56 SCI32: Change magnifier warning to error
If anything actually uses this feature, we should know about it
eventually.
2016-03-07 17:27:38 -06:00
Colin Snover 13f2a2c3bd SCI32: Add debugger command to view screen items in the visible plane list 2016-03-07 16:46:25 -06:00
Colin Snover 36800b7017 SCI32: Fix memory leaks 2016-03-06 21:34:43 -06:00
Colin Snover 1337cd3dec SCI32: Implement kEditText 2016-03-06 21:34:43 -06:00
Colin Snover b6a7d8c6a5 SCI32: Minor consistency improvement to FrameOut 2016-03-02 14:02:49 -06:00
Colin Snover 5e0cff364f SCI32: "Fix" missing fade transitions
The original engine had some members on PlaneShowStyle to
allow wall clock timing but never actually used them in the
processing loop so transitions simply ran as quickly as the
CPU could process them. For the moment, we will just limit
these transitions to ~30fps, which hopefully roughly matches
the speed of the engine on hardware of the era.
2016-03-02 14:02:49 -06:00
Willem Jan Palenstijn 93af01a58a SCI32: Comment splitRects 2016-02-21 21:12:13 +01:00
Martin Kiewitz 86a8886409 SCI32: Clean up Gfx::FrameoutsyncWithScripts() 2016-02-21 20:56:26 +01:00
Martin Kiewitz 1ac8533b1f SCI32: Fix save patching for ScummVM dialog
- Patch game super object for saving instead of game object
- Remove re-adding planes+screen items, game::replay does that
We would only have to do that for soft-failing on restore
- Change debug levels of kNumLoops/kNumCels to 9
- Add special comment about -info- selector in syncWithScripts()

This should now make ScummVM menu saving work properly at
least in SQ6.
2016-02-21 20:33:17 +01:00
Martin Kiewitz 210a6b10ac SCI32: Add comment about SQ6's option plane 2016-02-21 17:30:25 +01:00
Martin Kiewitz 3e4efdbd27 SCI32: Implement syncing planes+screen items from VM for restore
Fixes restoring saved games, when ScummVM dialogs are patched in
Removing clearing planes+screen items as well, because the scripts
actually did that, but did not clear everything.
Fixes "Invalid screen item" message when entering options menu,
after restoring in SQ6.
2016-02-21 17:21:48 +01:00