Commit Graph
134 Commits
Author SHA1 Message Date
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 4a637d65c3 SCI32: Enable optional explicit memory management of hunk entries
Bitmaps in ScrollWindow and Robot code are managed by the kernel
and not by game scripts, although they must be able to be
referenced through a reg_t. To prevent incorrect GC of bitmaps
that are in use but not referenced by any game script, explicit
memory management of hunk entries can be enabled.
2016-08-01 10:37:14 -05:00
Colin Snover 4cfc387602 SCI32: Split GfxPalette and GfxPalette32 + HunkPalette 2016-07-11 10:39:50 -05:00
Colin Snover 7f53a26d9e SCI32: Split kPalCycle into subop functions 2016-07-11 10:39:50 -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 5b6114f4cc SCI32: Implement kBitmapDrawView 2016-06-21 16:12:33 -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 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
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 371b50e75a SCI32: Add explicit checks for null pointers
CID 1351617, 1351618, 1351619, 1351620, 1351621, 1351622, 1354791.
2016-05-27 19:20:22 -05:00
Ori Avtalion 253e18c440 JANITORIAL: Reduce GUI header dependencies 2016-04-14 13:30:14 +03:00
Colin Snover eec95957bf SCI32: Clean up outdated/wrong comments 2016-03-20 09:33:13 -05:00
Colin Snover f4e5c6d2de SCI32: Return correct value from kSetFontHeight 2016-03-20 09:32:53 -05:00
Colin Snover 37b8bd9404 SCI32: Do not change accumulator in non-returning kernel calls
This did not cause any known bugs, but is wrong according to the
way the actual engine works.
2016-03-20 09:31:28 -05:00
Colin Snover 9335e40997 SCI32: Use signed values for displacement position 2016-03-20 09:12:43 -05:00
Filippos Karapetis 9b92960691 SCI32: Document kAddLine 2016-03-15 11:30:53 +02:00
Filippos Karapetis 16a7bcb0c3 SCI32: Implement kBitmapSetDisplace 2016-03-15 11:29:24 +02:00
Colin Snover 3a067f3b79 SCI32: Implement kBitmapDrawColor 2016-03-14 19:49:33 -05:00
Colin Snover 3f2469c33e SCI32: Implement kCelInfo 2016-03-13 23:38:26 -05:00
Colin Snover 362b46259f SCI32: Implement kCelHigh and kCelWide SCI32 versions
The SCI16 versions do not implement the scaling algorithm used
by SCI32 so would be off by one in some cases.
2016-03-13 12:40:16 -05:00
Filippos Karapetis 3a770fa0d8 SCI32: Initial implementation of kRemapColors
applyRemap() is still not finished, so nothing is actually visible yet
2016-03-11 05:10:32 +02:00
Colin Snover 8dea740086 SCI32: Implement kMovePlaneItems 2016-03-10 18:28:53 -06:00
Colin Snover 0bb4c32c50 SCI32: Minor cleanup of kernel calls 2016-03-10 14:16:56 -06:00
Colin Snover eac416f480 SCI32: Implement kCantBeHere 2016-03-10 10:38:07 -06:00
Filippos Karapetis aa69563f8a SCI32: Disable kRemapColors32, as SCI32 remapping is still incomplete 2016-03-08 20:36:02 +02: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 b9fa04c201 SCI32: Implement kBitmapDrawText 2016-03-07 20:51:06 -06:00
Colin Snover 73eea88939 SCI32: Move in-memory bitmap read/write into its own class 2016-03-07 20:51:06 -06:00
Colin Snover 1337cd3dec SCI32: Implement kEditText 2016-03-06 21:34:43 -06:00
Colin Snover 445980f010 SCI32: Fix misidentification of createFontBitmap(CelInfo &) 2016-03-03 21:29:53 -06:00
Colin Snover 9a280d3965 SCI32: Add all kBitmap signatures
Not all SCI2.1late/SCI3 function signatures are fully known yet,
but all subops are now represented in the kernel tables.
2016-03-03 20:31:10 -06:00
Colin Snover b6a7d8c6a5 SCI32: Minor consistency improvement to FrameOut 2016-03-02 14:02:49 -06:00
Willem Jan Palenstijn d03ab8b716 SCI32: Revert GK1 hacks
Replacing a valid signature error by a warning isn't useful.
2016-03-01 11:32:02 +01:00
Filippos Karapetis 03754d4127 SCI32: Warn when the unhandled parameter is set in kPalVarySetPercent 2016-03-01 04:21:09 +02:00
Filippos Karapetis 6ba31a88f0 SCI32: GK1 adds another optional parameter to kPalVarySetPercent 2016-03-01 04:12:36 +02:00
Colin Snover 3e5adc33a8 SCI32: Non-titled text bitmap implementation
This implementation is not 100% engine accurate, but it is
more accurate than what was there, and hopefully the differences
between this and the engine code are merely cosmetic.

The known (intentional) differences are:

1. Uses ScummVM rects inside the engine code, converting to/from
   SCI rects on the kernel edges and when scaling
2. Fewer side effects when performing operations that *should*
   have been pure from the start (like text dimension calculation).
   Still not side-effect-free, but at least things like colours
   and alignment do not need to be reset every time a measurement
   is taken, unlike in the actual engine.

Editor controls and some other kBitmap code are temporarily
disabled as a result of changes to GfxText32 until they can be
updated to be engine-accurate.
2016-02-28 21:48:56 -06:00
Martin Kiewitz 7b9c15634f SCI32: Use debugC instead of debugCN for debug output 2016-02-21 14:20:11 +01:00
Martin Kiewitz edd1efb049 SCI32: Add debug output to Add/Update/DeleteScreenItem+Planes
debugflag Graphics
level 6 for Add+Delete
level 7 for Update
2016-02-21 14:14:11 +01:00
Martin Kiewitz 0941dcdb67 SCI32: Add a bit more debug info to errors + screenitems 2016-02-21 13:59:17 +01:00
Martin Kiewitz a1246901ee SCI32: Change kAddLine to use kStubNull b/c signatures 2016-02-20 16:27:59 +01:00
Martin Kiewitz 19283b94a9 SCI32: Some work on kIsOnMe
Plenty of hotspots seem to work now
Not fully done yet
2016-02-20 05:38:22 +01:00
Filippos Karapetis 62ae61dd22 SCI: Silence false positive warnings by MSVC 2016-02-19 02:36:12 +02:00
Colin Snover 766cf6cee7 SCI: Fix too-fast rendering
Now that the renderer is loading resources without spinning CPU time
on decompression every frame, it becomes apparent that kFrameOut is
spammed constantly by the interpreter and needs to be throttled to
ensure that transitions and fades work properly.
2016-02-18 13:18:03 -06:00
Colin Snover 03e3f2c68c SCI: Fix some rect off-by-ones 2016-02-18 13:18:03 -06:00
Colin Snover 2c0e64fdaf SCI: Add short-lived kSetFontRes kernel function
kSetFontRes didn't exist in SCI2, showed up in SCI2.1early,
then was replaced with kFont subop 1 in SCI2.1mid.
2016-02-18 13:18:02 -06:00
Colin Snover 20ccad80bf SCI: WIP GfxText32 code
This at least prevents SQ6 from crashing when going into the
introduction
2016-02-18 13:18:02 -06:00
Colin Snover 3bddd869ab SCI: Build kernel table for ScrollWindow and stub seen functions
Signatures in subops table are correct for length but unknown
types are marked as . instead of the correct type.
2016-02-18 13:18:02 -06:00
Colin Snover 75ccabc325 SCI: Implement accurate renderer architecture for SCI32 2016-02-18 13:18:02 -06:00