Commit Graph
123 Commits
Author SHA1 Message Date
Filippos Karapetis 0101ac6f71 SCI: Add a default case to the switch in toDebugString()
Silences a false positive in MSVC
2018-08-25 12:39:13 +03:00
Eugene Sandulenko ec08412925 SCI: Fix shadowing warning 2018-06-29 09:14:17 +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 b6c3f0f547 SCI32: Clean up CelObj
* Rewrap comments to 80 columns
* Clarify comments where possible
* Use smart pointers where appropriate
* Change view/pic flags detection to always use word-size
  (byte-size check for flag 0x80 was a compiler optimisation)
2017-10-06 22:56:24 -05:00
Colin Snover 643a572610 Revert "SCI: Fix Warnings about Copy Constructor Failing to Call Base Class."
This reverts commit d2dd942ad7.

The Serializable class is an interface class and has only the
empty default copy constructor. There is no reason to call this
explicitly. Whatever is warning about this should be fixed to stop
warning about it, rather than adding such unnecessary calls to the
engine code.
2017-09-23 20:57:03 -05:00
Colin Snover dced2fb9f5 SCI32: Fix handling of array copies
kArrayCopy would perform an unnecessary memory copy of the source
array, the treatment of the count value as unsigned was clearly
not correct since it was being sign-extended and checked against
-1.
2017-09-23 20:57:03 -05:00
Colin Snover 0ceab96e91 SCI32: Remove unused shrink-to-fit function for string arrays 2017-09-23 20:37:51 -05:00
Colin Snover 50cfb7ad46 SCI32: Fix size for dereferencing non-raw SCI32 arrays
The maxSize given when generating a SegmentRef is supposed to be
the maximum size of raw data that can be held inside the offset-
part of a reg_t, not the entire size including the segment.

This fixes a buffer overflow in "Inside the Chest", which still
does not work, but at least doesn't cause heap overflows anymore
with this change.
2017-09-23 20:37:51 -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
Hein-Pieter van Braam 04fb40be2d SCI32: Fix kArrayFill
The ScummVM implementation of class SciArray::fill() has a bug where it
will overwrite the array[index] with the value count times, rather than
fill the array starting from index count times.

This patch fixes that behavior. This was noticed because the LSL7 dice
game was broken, it was impossible to lose. After this patch the dice
game works as expected.

Closes gh-953.
2017-05-26 12:21:43 -05:00
Colin Snover eadf5d818f SCI: Fix support for 32-bit SCI3 script offsets 2017-04-23 13:07:25 -05:00
Colin Snover 4284488244 SCI32: Improve bounds checking in SciString trim 2017-03-30 19:46:27 -05:00
Colin Snover 10d97ce379 SCI: Fix more unsafe C-string usage 2017-02-05 12:38:21 -06:00
D G Turner d2dd942ad7 SCI: Fix Warnings about Copy Constructor Failing to Call Base Class. 2017-01-14 08:26:29 +00:00
Colin Snover 809dcf12ab SCI32: Fix overlapped memory copies in SciString 2017-01-06 13:13:59 -06:00
Filippos Karapetis d9b2b7d484 SCI32: Fix a subtle bug in SciArray::trim()
With this bug, whenever a string was trimmed from the right, the last
character was always cut off, even if it wasn't whitespace. This was
apparent in the RAMA demo, which parses a text file for its scenes,
and each line is trimmed
2017-01-06 13:13:21 -06:00
Colin Snover 0c40d60d24 SCI32: Fix off-by-one error in array resizing
This bug existed in SSCI and was pulled in carelessly during
initial implementation of SciArray. Closer examination of SCI3
reveals that this only happened to work in SSCI because it would
always allocate on the first resize, and would always allocate 25
extra elements per allocation.
2017-01-05 16:01:05 -06:00
Colin Snover 5220ce1e4f SCI32: Undefine macro for SciBitmap when it is done being used 2016-12-19 14:46:59 -06:00
Colin Snover a238f720db SCI32: Fix nitpicky output errors in SCI32 bitmap debugging 2016-12-19 13:56:37 -06:00
Colin Snover 20c211192d SCI32: Add segment table debugging info for SCI32 arrays 2016-12-19 12:47:48 -06:00
Colin Snover 07919b79ba SCI32: Improve SciBitmap segment table debugging output 2016-12-17 18:55:22 -06:00
Colin Snover e12496bd0c SCI32: Read byte/string array values as signed in SCI2.1early-
KQ7 1.51 writes int16s from the save game catalogue into a Str
object, then retrieves byte 0 from the string and compares it to
-1. This happens to work out because (1) characters were treated
as signed in SCI2.1early and earlier, and (2) int16s in the save
game catalogue were little-endian.

In SCI2.1mid and later, this trick no longer works because
characters are treated as unsigned and get zero-extended instead.

Fixes Trac#9632.
2016-10-27 20:23:10 -05:00
Colin Snover 40444b0aeb SCI32: Clarify some identifiers
transparentColor -> skipColor
displace -> origin
scaledWidth -> xResolution
scaledHeight -> yResolution
2016-10-09 11:21:46 -05:00
Colin Snover 8c555200d9 SCI32: Change storage type of int16 arrays to hold reg_ts instead
Memory references and integers in SSCI are both 16-bit numbers,
so game scripts frequently (incorrectly) use an IntArray instead
of an IDArray for holding references. Since references in ScummVM
are 32-bit reg_ts, IntArray entries must be large enough to hold
reg_ts in order to be compatible with game scripts that store
references in integer arrays.

The alternative solution is to find and patch all incorrect use of
IntArray across all games. This is possible, but a bit risky from
a save game stability perspective, since incorrect IntArray usage
is sometimes not apparent until well after the array is
instantiated (like GK1's global interview array).

This change invalidates existing SCI32 save games.
2016-10-09 11:21:13 -05:00
Eugene Sandulenko dead4aa014 JANITORIAL: Remove trailing spaces 2016-10-09 14:59:58 +02:00
Colin Snover 5877542d7e SCI32: Ease debugging of wrong array types 2016-09-29 19:39:16 -05:00
Colin Snover 9d2397e1e9 SCI32: Implement kBitmapCreateFromView and kBitmapGetInfo
Used by Torin room 40300 to perform pathfinding by bitmap.
2016-09-29 19:39:16 -05:00
Colin Snover 3f91726765 SCI32: Rewrite kArray & kString
This change invalidates earlier SCI32 save games, which separated
arrays and strings in an incompatible manner. Old save games
contain invalid references to a string segment which no longer
exists, and contain incompatible array structures that lack
critical type information.
2016-09-29 19:39:16 -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 efaf7f20d6 SCI32: Fix crash when multiple nodes are deleted during kListEachElementDo
This happens in e.g. Phant1, when walking from dining, to
reception, to up the stairs.
2016-08-12 10:26:06 -05:00
Eugene Sandulenko 6f87a2b2e8 SCI: Fix warnings 2016-08-01 23:56:32 +03: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 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
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 1c6112e121 SCI: Introduce accessors for SegmentObjTable entries.
This makes code not use _table directly whenever possible. An exception is the
save game code which is not easy to adapt due to design deficiencies.
2016-03-25 01:15:26 +01:00
Filippos Karapetis cdbd7c8add SCI: Use uint32 instead of unsigned int 2016-03-01 01:12:58 +02:00
Johannes Schickel 8fc7d60feb SCI: Make GPL headers consistent in themselves. 2014-02-18 02:39:37 +01: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
Tarek Soliman edc5249772 JANITORIAL: Fix template definition whitespace 2012-02-10 21:17:27 -06:00
Matthew Hoops 28301e2bd1 ALL: analyse -> analyze 2011-05-25 10:50:47 -04:00
strangerke 69b1485a22 GIT: Clean up: Suppress SVN tags, now useless 2011-05-12 01:16:22 +02:00
D G Turner bcb9179a8b SCI: Close Memory Leak from kAnimate Calls.
This was due to a missing destructor in the HunkTable.
Thanks to wjp for this patch.
2011-03-24 20:59:20 +00:00
md5 12e7d3078b SCI: Cleanup 2011-03-08 20:13:08 +02:00
md5 0642b30933 SCI: Cleanup 2011-03-08 14:46:03 +02:00
md5 0d555c497d SCI: Moved hunk pointer handling to the GC, and removed some related workarounds
SCI scripts can contain stale pointers, which are used later on. We now delete
the contents of hunk entries without invalidating the relevant pointers and let
the GC clear the references. Many thanks to waltervn and wjp for all their work
and help on this.
2011-02-28 15:56:03 +02:00
Filippos Karapetis de2ef2edc0 SCI: Removed the system strings code and replaced it with a much more simplified version, thus greatly simplifying handling of system strings
svn-id: r54805
2010-12-07 00:47:05 +00:00
Filippos Karapetis 3b07056a47 SCI: Moved the Object class in a separate file
svn-id: r54361
2010-11-19 08:18:24 +00:00
Filippos Karapetis 4609f11137 SCI: Added species selector functionality for SCI3
svn-id: r54351
2010-11-18 22:27:56 +00:00