Commit Graph
51 Commits
Author SHA1 Message Date
Eugene Sandulenko abea37c9bb ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
Lars Skovlund 4b6e0e0e7d SCI32: Add feature detection for plane id base
This provides a generic fix for AddScreenItem crashes in early SCI32
floppy games that have previously required individual script patches.
2018-12-28 11:55:32 +02: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 31e1d0932c SCI32: Clean up Plane
* Rewrap comments to 80 columns
* Clarify comments where possible
2017-10-06 22:11:03 -05:00
Colin Snover 0ac5d84062 SCI32: Clean up ScreenItem
* Rewrap comments to 80 columns
* Clarify comments where possible
* Use smart pointers where appropriate
2017-10-06 22:10:50 -05:00
Torbjörn Andersson 70a2ca8b7d JANITORIAL: Silence more GCC 7 warnings
All these fall through were marked as deliberate, so again I've only
changed the comment to silence GCC.
2017-08-06 13:30:51 +02:00
Colin Snover 7543bd444d SCI32: Move priority comparison of ScreenItems into its own function
Rendering bugs in ScummVM are often caused by buggy game scripts
relying on the last ditch sort, which is not the same in ScummVM
as in SSCI (since the SSCI last ditch sort relies on a different
memory architecture and is super buggy). However, these bugs do
not show up very frequently these days, so it is easy to forget
all the places that need to be checked when debugging a rendering
problem that appears to be caused by sorting failure.

This commit breaks out the last ditch comparison formerly in
Plane::calcLists to hopefully make it more visible to future
programmers.

Refs Trac#9957.
2017-07-13 21:31:07 -05:00
Colin Snover 7057f232d7 SCI32: Improve kPlayVMD rendering
1. Added a new game option for linear interpolation when scaling
   overlay-mode video in ScummVM builds with USE_RGB_COLOR;
2. Implemented SCI2.1-variant of the VMD player renderer (fixes
   Trac#9857), which bypasses the engine's normal rendering
   pipeline;
3. Improved accuracy of the SCI3-variant of the VMD player by
   writing HunkPalettes into the VMD's CelObjMem instead of
   submitting palettes directly to GfxPalette32.
2017-07-06 19:12:38 -05:00
Colin Snover f940346812 SCI32: Minor cleanup to plane debug information 2017-05-27 23:36:11 -05:00
Colin Snover 4d9b019b18 SCI32: Activate SCI3 draw/erase list calculation algorithm
This code branch, existing since at least SQ6 but apparently never
used by any SCI2/2.1 game, is in fact the algorithm used by SCI3.

This fixes (at least) doubled rendering of transparent surfaces
like the background of the inventory window and conversation
choices panel in LSL7.
2017-04-23 13:07:25 -05: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 ba619a08dd SCI32: Change plane and screen item sorting algorithm
SSCI's last resort comparison here was to compare the object IDs
of planes & screen items, but this randomly breaks (at least) the
"you have died" dialog at the end of Phant1, and text & buttons
in Hoyle5, even in SSCI itself.

This commit changes last resort comparison to use a monotonically
increasing ID instead, which keeps objects with identical priority
& z-index in creation order when compared.

Fixes Trac#9585.
2016-12-19 14:46:58 -06:00
Colin Snover 45f7aef8cb SCI32: Fix typo 2016-10-20 11:33:29 -05:00
Colin Snover 34bd1bcaa9 SCI32: Split out detection of features that cross SSCI versions 2016-10-20 11:33:29 -05:00
Colin Snover a854c7e274 SCI32: Fix screen items incorrectly drawing over higher planes
Fixes Trac#9583.
2016-10-16 21:21:13 -05:00
Colin Snover 5ab363a436 SCI32: Fix potential null pointer dereference
CID 1351620.
2016-09-29 19:39:16 -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 49eed5dd24 SCI32: Use extern instead of #include frameout.h for splitRects 2016-07-27 08:49:44 -05:00
Colin Snover 08821cf4e3 SCI32: Give planes a default type
With the addition of the transparent pic type code, the _type
property would be read uninitialised by setType if _pictureId was
set to kPlanePic.

CID 1357230, 1357231.
2016-07-11 10:39:50 -05:00
Colin Snover f171db965c SCI32: Guard against no split count
CID 1357229.
2016-07-11 10:39:50 -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 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 4ee5b0f910 SCI32: Use better name for fixed priority field
The old name matches the selector, but isn’t as clear.
2016-05-27 15:54:14 -05:00
Colin Snover 741e26cfd2 SCI32: Remove unused Plane fields
These fields were written and never read in SSCI.
2016-05-26 19:06:35 -05:00
Filippos Karapetis f7ec415582 SCI32: Fix updated screen item count in remapMarkRedraw()
Thanks to snover for noticing this
2016-03-16 23:18:02 +02:00
Filippos Karapetis be58e5bc30 SCI32: More work on remapping
Still not working
2016-03-15 21:06:46 +02:00
Colin Snover 80098c8423 SCI32: Remove incorrect note about dword_C6288
Any reason why flipping this condition did anything to GK1
rendering was due to other unrelated bugs in the renderer.
2016-03-13 13:20:17 -05:00
Colin Snover 8dea740086 SCI32: Implement kMovePlaneItems 2016-03-10 18:28:53 -06:00
Colin Snover 695e5db9a7 SCI32: Remove side-effect-abusing calls to ScreenItem::getCelObj 2016-03-10 14:16:56 -06:00
Johannes Schickel 693f8dc295 SCI: Add missing namespace comments in graphics/. 2016-03-08 20:13:05 +01:00
Colin Snover 4297305dd5 SCI32: Clean up renderer code a bit more 2016-03-07 16:46:25 -06:00
Willem Jan Palenstijn 8be1ff109f SCI32: Fix adding too many items to drawlist 2016-03-07 23:41:06 +01:00
Colin Snover 56806161a7 SCI32: Make PlaneList definition order match declaration order 2016-03-06 21:34:44 -06:00
Colin Snover 36800b7017 SCI32: Fix memory leaks 2016-03-06 21:34:43 -06:00
Colin Snover 3e631ca5e3 SCI32: "Improve" comparison algorithm for planes and screen items
This adds a slightly more accurate comparison algorithm that will
at least ensure that all the engine-generated planes and screen
items with matching priorities will be sorted above
script-generated planes and screen items, like in the original
engine. It still does not sort script-generated items by memory
handle order, so if that is ever a thing that actually happens,
those may still be in the wrong order.
2016-03-06 21:34:43 -06:00
Colin Snover 1337cd3dec SCI32: Implement kEditText 2016-03-06 21:34:43 -06:00
Colin Snover 4ba7f24632 SCI32: Fix incorrect insertion of new planes 2016-03-05 23:13:38 -06:00
Colin Snover 7ee2af4198 SCI32: Fix changed screen items drawing on top of higher screen items 2016-03-02 08:59:17 -06:00
Colin Snover 2e75f4b2b8 SCI32: Add consts and remove redundant conditional
Adding consts to try to isolate rectangles that change during
draw list processing, to be investigated for incorrect mutations
causing lower screen items to be drawn over higher screen items at
their edges.
2016-03-02 00:02:25 -06:00
Colin Snover 97d5e92185 SCI32: Review rect rounding in Plane and ScreenItem
These changes should cause ScummVM to be more accurate in edge
case rounding.
2016-03-02 00:01:13 -06:00
Filippos Karapetis 806fa64d74 SCI32: Add a note about the menu bars in GK1 2016-03-01 04:50:26 +02:00
Colin Snover 0abd5b5c4e SCI: Use nullptr instead of 0 for null pointer checks 2016-02-21 09:32:34 -06:00
Willem Jan Palenstijn 26a5efe6e8 SCI: Fix redrawAll updating visiblePlanes
It was comparing ScreenItem*'s directly, instead of objects.
2016-02-21 12:52:25 +01:00
Willem Jan Palenstijn 53ed7f6ac1 SCI: Rewrite Plane::mergeToRectList
The old one would continue reading from outerRect after it was deleted.
2016-02-20 12:26:54 +01:00
Colin Snover 1c4778d571 SCI: Minor cleanup
1. Reorder member initialisations to match class member order
2. Use #pragma mark instead of comments for annotating sections
3. Remove useless >=0 checks on unsigned types
2016-02-18 21:11:06 -06:00
Colin Snover 3e820ee9b3 SCI: Fix bad positioning of relatively positioned pic cels 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 3c9b930506 SCI: Add comments to plane code 2016-02-18 13:18:03 -06:00