Commit graph

155 commits

Author SHA1 Message Date
Colin Snover
7f53a26d9e SCI32: Split kPalCycle into subop functions 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
4d91b458e5 SCI32: Implement kPlayVMD 2016-07-10 09:35:24 -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
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 Palenstijn
ceee33ba2c SCI32: Add workaround for kScrollWindowAdd call in Phantasmagoria 2016-06-21 08:14:12 -05:00
Willem Jan Palenstijn
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
f939868f3a SCI32: Add kDoSound(play) workaround for LSL6hires 2016-06-20 21:52:41 -05:00
Colin Snover
f02107f682 SCI: Minor cleanup of kDoSound
Replaces unused kernel calls to use kEmpty, and set correct
signatures for SCI32 kernel calls.
2016-06-20 21:02:21 -05:00
Colin Snover
46551fd4b5 SCI32: Rewrite digital audio engine
This provides a complete implementation of kDoAudio through
SCI2.1mid, plus partial implementation of SCI3 features.

Digital audio calls shunted through kDoSound have also been
updated to go through the SCI32 audio mixer, though these shunts
are a bit hacky because the ScummVM implementation of kDoSound
does not currently match how SSCI kDoSound is designed.

It is probably possible in the future to just replace the SCI1.1
audio code (audio.cpp) with the new SCI32 code, since the major
differences seem to be that (1) SCI1.1 only supported one digital
audio playback channel (this is configurable already), (2) it
had extra commands for CD audio playback and queued sample
playback.
2016-06-20 21:02:21 -05:00
Colin Snover
c231d22c28 SCI32: Fix LSL6 hires control panel script bug
The control panel initialisation script makes an invalid two-argument
call to get the width of the settings dial; this only happens to work
because the third argument on the stack was set to zero by an earlier
call.
2016-05-25 19:16:11 -05:00
Colin Snover
30cb8f5c4f SCI32: Correct some kernel call signatures 2016-03-13 12:45:59 -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
4a16ebc970 SCI32: Implement kSetNowSeen 2016-03-10 14:16:56 -06:00
Colin Snover
eac416f480 SCI32: Implement kCantBeHere 2016-03-10 10:38:07 -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
Filippos Karapetis
5125652be2 SCI32: Add a workaround for kPalVarySetPercent in GK1 (chapter change) 2016-03-02 21:43:27 +02: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
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
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
Filippos Karapetis
f2e80ffc7f SCI: Do not map SetScroll twice 2016-01-15 21:34:42 +02:00
Filippos Karapetis
2a4b04f3b2 SCI: Add an initial implementation of kStringTrim
Thanks to lskovlun for his help
2016-01-15 03:25:40 +02:00
Filippos Karapetis
fbc9fe03c0 SCI: Allow null references to kStringGetData, for Torin's Passage
Added a TODO for rhis, for now
2016-01-15 02:46:35 +02:00
Colin Snover
fb891e4c08 SCI: Implement SCI32 kPalVary and kPalette setFade
This also fixes kPalCycle signatures to be more accurate.
2016-01-14 16:13:22 -06:00
Colin Snover
f1cf07eded SCI: Add kPalMorph stub 2016-01-14 16:13:22 -06:00
Colin Snover
dc42a86f7e SCI: Fix bad spacing in kernel tables 2016-01-14 16:13:22 -06:00
Filippos Karapetis
0434617018 SCI: Initialize kString properly for SCI2 games
SIG_UNTIL_SCI21MID did not account for SCI2 games. Fixes GK1 DOS
2016-01-08 11:37:13 +02:00
Colin Snover
70d89b3e39 SCI32: Add kSetPalStyleRange stub code 2016-01-07 16:35:09 -06:00
Martin Kiewitz
0dd760724e SCI32: split up SCI2.1 into EARLY/MIDDLE/LATE
- Detection works via signatures (couldn't find a better way)
- new kString subcalls were introduced SCI2.1 LATE
- kString now has signatures and is split via subcall table
- kString fix, so that KQ7 doesn't crash, when starting a chapter
- Sci2StringFunctionType removed, because no longer needed
2015-12-29 01:44:11 +01:00
Willem Jan Palenstijn
58ef44eb8d SCI: Register and save playBed option to PlaySound
The playBed option is not handled yet, only stored. This increases
the savegame format version.
2015-02-14 16:06:55 +01:00
Filippos Karapetis
1cbfe02bcf SCI: Allow invalid references to kUnload() - bug #6600
Since the reference will be invalidated anyway by kUnload itself,
there's no real reason to check for its validity. We do the same with
kGraph() and kDisplay().
2014-08-08 02:11:49 +03:00
Martin Kiewitz
d7f26886c3 SCI: more hoyle 4 workarounds (bug #6604) 2014-06-01 23:33:45 +02:00
Filippos Karapetis
311471c857 SCI: Fix script bug #6485 - "SCI: MUMG EGA - kStrCpy error" 2014-02-19 03:03:11 +02:00
Johannes Schickel
8fc7d60feb SCI: Make GPL headers consistent in themselves. 2014-02-18 02:39:37 +01:00
Filippos Karapetis
9addca7287 SCI: Allow saving without a VERSION file in Jones
Apparently, the original does the same. Fixes bug #6535
2014-02-17 11:52:49 +02:00
Filippos Karapetis
d58c5b89b5 SCI: Fix script bug #3615120 - "SCI: Crazy Nick Laura Bow - kReadNumber signature mismatch" 2013-10-30 08:47:46 +02:00
Filippos Karapetis
182f342a01 SCI: Add 2 workarounds for script bugs in QFG4 2013-01-11 02:24:17 +02:00
Filippos Karapetis
1286710248 SCI: Fix bug #3578335 - "SCI: Mixed-Up Mother Goose EGA - crash upon choosing kid"
In several SCI0 games, the parameter to kDoSoundFade can be null.
We handle that case, instead of adding individual workarounds per game
2012-10-22 12:47:28 +03:00
Johannes Schickel
89abab97e3 JANITORIAL: Remove trailing whitespaces.
Powered by:
git ls-files "*.cpp" "*.h" "*.m" "*.mm" | xargs sed -i -e 's/[ \t]*$//'
2012-09-26 04:17:55 +02:00
Filippos Karapetis
61e8fdbf1d SCI: Separate the early SCI11 version of kRemapColors from the SCI32 one 2012-07-24 00:18:31 +03:00
Filippos Karapetis
fb215929ef SCI: Some updates to SCI32 kernel graphics functions
- Added a stub for kSetScroll, which sets the target picture immediately
for now
- Added an initial stub of kPalCycle (doesn't work correctly yet)
- Adjusted the signatures of kUpdateLine and kDeleteLine for LSL6
- Unmapped kSetHotRectangles again, with updated information on how it
is used in Phantasmagoria
2012-07-05 13:58:41 +03:00
Filippos Karapetis
d61c5ae529 SCI: make g_base_opcode_formats and SciOpcodes a bit more readable 2012-07-04 11:57:40 +03:00
Filippos Karapetis
d74d211479 SCI: Mark the SetScroll and SetHotRectangles kernel functions as unused 2012-07-04 02:21:08 +03:00