Commit Graph
448 Commits
Author SHA1 Message Date
Colin Snover 80d9182554 SCI32: Implement SCI32 cursor support 2016-08-19 13:57:40 -05:00
Colin Snover 22c7be2c86 SCI: Fix sign comparison warning 2016-08-13 16:29:24 -05:00
Colin Snover 741ac22e17 SCI: Fix pointer invalidation caused by array storage moves
When objects are added to a SegmentObjTable, it may cause the
internal storage for the table to expand and move to a new
region of memory. When this happens, all pointers to objects held
by a SegmentObjTable of the same type would be invalidated, due
to an implementation detail that should not be exposed. To prevent
this, objects are now allocated separately on the heap, so even if
the table's storage moves due to insertions, the objects owned by
the table will not, so references remain valid for the lifetime of
the object.
2016-08-13 15:41:31 -05:00
Colin Snover 6a7ddd8ba1 SCI32: Actually save and load remaps 2016-08-06 11:23:18 -05:00
Colin Snover d5d42d5066 SCI32: Implement bitmap save routine 2016-08-01 10:37:14 -05:00
Colin Snover 6d1f8e8c87 SCI32: Fix invalid memory access after BitmapTable is extended
When new bitmaps are added and the underlying Common::Array needs
to move to expand, this invalidates all pointers to bitmaps, which
makes it basically impossible to use the bitmap segment since you
never know if a reference is going to be invalidated due to an
array move.

To solve this, BitmapTable is changed to hold pointers to
SciBitmaps that are allocated separately on the heap instead, so
when those bitmaps are looked up, the resulting pointers are valid
for the lifetime of the bitmap, instead of the lifetime of the
Common::Array used internally by BitmapTable.
2016-08-01 10:37:14 -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 4cfc387602 SCI32: Split GfxPalette and GfxPalette32 + HunkPalette 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 d44ad1e82e SCI32: Remove invalid TODO about CLUT for 16-bit graphics
The CLUT for 16-bit graphics is not saved in SSCI (nor is it
normally even part of the palette manager).
2016-05-28 19:57:56 -05:00
Johannes Schickel c412478a11 SCI: Fix compilation for C++98. 2016-04-06 23:22:44 +02:00
Johannes Schickel c11b09dff9 SCI: Remove commented out code line. 2016-03-25 01:15:26 +01:00
Johannes Schickel f23dd0f486 SCI: Use aggregation to store objects in SegmentObjTable.
This allows to store pointers and fundamental types in a SegmentObjTable.
2016-03-25 01:15:26 +01:00
Johannes Schickel 77b5ce075a SCI: Get rid of template hack for serialization.
The former template hack relied on specialized functions for various types. We
use a hand crafted set of functions for serialization functionality now.
2016-03-25 01:15:26 +01:00
Martin Kiewitz 54756498bc SCI: Add workaround for restoring kq6 saved games (lowres/hires)
KQ6 CD sets a global depending on lowres/hires state right at the
start and some scripts are using it instead of calling kPlatform.
This causes some graphics to be incorrect (well lowres)
in case the user saves in lowres mode, then switches to hires
mode and restores the previously saved game.
We now set that global directly after restoring saved games,
so that this issue does not happen anymore.
KQ6 CD demo did the same.
2016-03-16 14:49:21 +01:00
Martin Kiewitz 8588592947 SCI32: Don't do a syncWithScripts on restore from launcher
Causes issues in at least gk1 (option + inventory plane are shown)
Game::restore is not called, when doing restores from launcher,
so in the original interpreter this script code wasn't called
either.

Fixes option + inventory planes etc. being shown right after
restoring via launcher, when original save/load dialogs were
disabled.
2016-03-02 19:34:40 +01:00
Martin Kiewitz 480035d6aa SCI32: Do not clear screen when restoring for SCI32
Fixes graphical issues, when restoring saved games.
SCI32 did not clear the screen and also did not even redraw the
screen on restore. It only redraws elements that have changed.
Behavior verified using TSR in DOSBox (see comments).
Also added comment about clearing the screen for SCI16.
2016-02-22 21:38:01 +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 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
Martin Kiewitz ce595cb92d SCI: Script patch for Mixed Up Mother Goose SCI1
+ Mother Goose SCI1.1
Fixes graphic issues when restoring from GMM
Also make the fix ups for Mixed Up Mother Goose, Jones + PQ2
get applied all the time (debugger command not included)
2016-02-09 01:28:34 +01:00
Filippos Karapetis 7ffc4f9816 SCI: Silence false positive warning in MSVC 2016-02-05 23:50:53 +02:00
Colin Snover 76bd2eeb2e SCI: Use tick-based timing more consistently
This means tick-based times are saved to save games, as in SCI32
engine, instead of seconds, which are not accurate enough. It
also means places in SCI engine that need to access game ticks
should do so through g_sci instead of g_system or g_engine.
2016-01-14 16:13:22 -06: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 aeee621e44 SCI32: Add initial support for palette cycling (kPalCycle) and fading (kPalFade)
Graphics palette code was rewritten between SCI1 and SCI2, so
SCI32 palette engine code has been moved to a separate GfxPalette32
class.
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 30b5497e24 SCI: Clarify function name 2015-05-03 13:45:05 +02:00
Martin Kiewitz 02dd8cffcc SCI: move SCI32 plane clear to gamestate_restore() 2015-04-27 20:50:37 +02:00
Martin Kiewitz 031b9b8ced SCI: restore: clear screen when restoring
primarily to clear kPortrait graphics in kq6
when restoring during portrait animation
2015-04-26 15:50:12 +02:00
Martin Kiewitz 5f53b9255e SCI: restore: reset ports before loading memory
otherwise we could free hunk space of the
loaded saved game
2015-04-26 15:29:02 +02:00
Martin Kiewitz bfba28c335 SCI: implement delayed restore via ScummVM menu
will delay restoring a saved game until the next
 kGetEvent or kWait
also implement aborting playback for kPortrait
 and kShowMovie
2015-04-26 09:08:46 +02:00
Martin Kiewitz 179ef7adb2 SCI: fix Camelot save on map screen bug #6744
don't put restored script windows into
_windowList[]
2015-04-23 18:54:07 +02:00
Willem Jan Palenstijn 5028487038 SCI: Use sound resource priority by default for songs
SCI1 sound resources can have an embedded priority. We now use that by
default, unless an explicit DoSound/SetPriority call overrides it.
Thanks waltervn.

This fixes relative priority of songs in at least PQ3 room 29.

Also increase savegame version to 33.
2015-02-15 14:05:36 +01:00
Willem Jan Palenstijn 5964cc239b SCI: Always re-sort playlist in soundPlay
Previously, it would only sort if a song wasn't already in the playlist.
Since initSound already adds it, this effectively prevented the list
from being sorted.
2015-02-15 13:57:03 +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
Willem Jan Palenstijn 4e20a93931 SCI: Fix comment for workaround.
The previous explanation just wasn't true.
2014-12-13 14:09:36 +01:00
Willem Jan Palenstijn 1860c2107a SCI: Add notes 2014-10-19 23:44:45 +02:00
Johannes Schickel 8fc7d60feb SCI: Make GPL headers consistent in themselves. 2014-02-18 02:39:37 +01:00
Filippos Karapetis d80f1adb31 SCI: Provide more accurate error messages for unsupported saved games 2014-02-17 11:46:24 +02:00
Willem Jan Palenstijn 78e7f5b51c SCI: Make second pass when loading objects
This is because objects may be loaded before their base objects,
which causes initBaseObject to fail for SCI0.

Script::initializeObjectsSci0 already did this, but
SegManager::saveLoadWithSerializer did not when calling
initBaseObject after loading a savegame.
2013-12-14 14:19:33 +01:00
Martin Kiewitz eaf6367bb2 Merge branch 'master' of github.com:scummvm/scummvm 2013-12-04 20:42:50 +01:00
Martin Kiewitz 8bdffcb2fb SCI: script patcher is now a separate class 2013-12-04 20:42:16 +01:00
Strangerke 6795fdf639 SCI: Janitorial - Fix spacing errors 2013-11-23 11:02:24 +01:00
m-kiewitz 158d12e555 SCI: abbrev. ffs to FE and priority check fix 2013-09-21 14:34:42 +02:00
m-kiewitz 4443793b97 SCI: sfx/music priority int16 fixes bug #3615038
it seems that sound system up till SCI0_LATE uses int16, afterwards it seems they changed to byte
main music object (conMusic) in Laura Bow 1 uses -1 as priority. This was truncated to 255 till now, which resulted in many sound effects not getting played, because those used priority 0
2013-09-21 14:27:16 +02:00
Filippos Karapetis 46ebf37ec9 SCI: Change wording for bug/further info references 2013-04-27 14:04:27 +03:00
Filippos Karapetis fb0788d12f SCI: Properly reset the palVary signal when loading (bug #3575569) 2012-11-15 14:57:55 +02:00
Filippos Karapetis 3b5e92d4f3 SCI: Fix bug #3575569 - "SCI: QFG1VGA: Palette/hue bug after loading"
We make sure that any leftover palVary timers are removed when
loading. This is an edge case, but it won't hurt to remove these
timers just in case
2012-11-07 18:11:09 +02:00
Filippos Karapetis 2b50824133 SCI: Add setter/getter methods to reg_t's
No functionality change has been made with this commit. This avoids
setting and getting the reg_t members directly, and is the basis of any
future work on large SCI3 scripts (larger than 64KB)
2012-06-18 05:24:06 +03:00
Filippos Karapetis 562a8a980c SCI: Further cleanup of the script code
Merge the init() and load() Script methods and reset the script when
necessary
2012-06-15 12:53:17 +03:00
Filippos Karapetis 21b6b81f16 SCI: A separate implementation is needed for syncStringHeap() for SCI3 2012-06-14 12:20:39 +03:00