1646 Commits

Author SHA1 Message Date
sluicebox
49a2fac05e SCI: Reduce global engine usage 2023-11-16 18:44:42 -08:00
sluicebox
c6bf55f1fc SCI: Update header guards 2023-11-14 16:40:53 -08:00
sluicebox
44436a91f2 SCI: Remove SciCallOrigin from error messages
`errorString` now adds this context (and more) to `error` messages
2023-11-14 16:06:45 -08:00
sluicebox
a54b882502 SCI: Clarify text-code processing. PVS-Studio V560 2023-11-07 16:07:10 -08:00
sluicebox
9dc86697f0 SCI32: Clarify logging function. PVS-Studio V547 2023-11-07 16:07:10 -08:00
sluicebox
e397f36be2 SCI: Remove redundant checks 2023-11-03 20:53:50 -07:00
sluicebox
1f4124b121 SCI: Remove or disable unused functions 2023-11-03 15:12:41 -07:00
sluicebox
cd319125ef SCI: More const ref parameters 2023-11-03 15:12:41 -07:00
sluicebox
c241f21baa SCI: Reduce scope of variables 2023-11-03 15:12:40 -07:00
sluicebox
56c122e6dd SCI32: Simplify cursor skip-color code. PVS-Studio V730
Previous code was based on SSCI's structure, but also introduced
an uninitialized read. Now we just use the skip color without the
unnecessary state.
2023-10-29 15:42:12 -07:00
sluicebox
2801803b5f SCI: Remove redundant checks. PVS-Studio V547, V560, V654 2023-10-29 15:42:12 -07:00
sluicebox
71cabc11a6 SCI: Fix memory leak in GfxFontSjis and GfxFontKorean
Coverity CID 1511585
2023-10-18 22:59:58 -07:00
sluicebox
e8c7f6f7e8 SCI32: Reuse DrawLists when rendering frames
When converting DrawList to use Common::Array in the previous commit,
I couldn't see a reason to not reuse them in frameOut() and avoid
the extra heap allocations on every frame.
2023-09-30 12:26:46 +03:00
sluicebox
b016bcdf70 SCI32: Fix DrawList overflow with a dynamic array
This is an engine limitation that also exists in SSCI,
but it can be exceeded under normal conditions.

Fixes crash at LSL7 pool entrance, bug #14632
2023-09-30 12:26:46 +03:00
BLooperZ
17a4318a72 SCI: Add comments regarding usage of SRT subtitles 2023-08-06 14:46:10 +02:00
BLooperZ
cf13eb315f SCI: Calculate subtitle position by draw rect 2023-08-06 14:46:10 +02:00
BLooperZ
b1420626e6 SCI: Show SRT subtitles on SCI32 videos 2023-08-06 14:46:10 +02:00
sluicebox
5a9f14cc4e SCI32: Fix kSetShowStyle version checks
Fix version checks and divisions table. Now the early SQ6 demos start.

Fix version typo introduced in e23f5fe85517083bdd396e91f1963480dfd85fb4
2023-07-18 11:48:26 -07:00
sluicebox
34201e3c31 SCI: Remove dead code from GfxPicture
This code handled SCI32 pictures before SCI32 was separated

Coverity CID 1373259
2023-03-18 14:03:16 -07:00
UrQuan1
e81858c25d SCI: Fix desynchronized kMenuSelect inversion
When selecting a new menu while another menu open, the new menu
will be drawn before inverting the old item selection. In the
next loop iteration, when the inversion happens, it now inverts
the brand new white item.

(cherry picked from commit f7c44a452953415c3ba4dbdf96162f83efde8f51)
2023-01-24 13:34:06 -08:00
sluicebox
a316bde435 SCI: Use default parameter in Path::toString() 2023-01-08 11:41:01 -08:00
sluicebox
ae5db52c2e SCI: Remove speed test detector
This heuristic was originally how all SCI16 speed tests were handled.
It has been gradually replaced with script patches, until all games
were patched in: ea48986006a1d85b5302f0c3d2ac828e29a66813

At the time, I left this in because it had the benefit of speeding up
the SCI11 test variants so that they didn't produce a startup delay.
Now we know that this heuristic has been identifying regular rooms as
speed tests and unthrottling them too, causing unintended effects.
Some of this behavior was masked by fast-cast throttling occurring
everywhere, until: e09010f7d8b7cc30ae3c8477d1a8b61b24d96306

For example, the QFG1VGA Sierra logo animation changes speed and runs
very fast as soon as the sparkle is finished. The Longbow map rooms
were also detected as speed test rooms and animated too fast. Cast-less
rooms like LB2's title screen run unthrottled and consume CPU.

There are only a few SCI11 speed test rooms, so now they're explicitly
unthrottled in kGameIsRestarting with the other throttling exceptions.
2022-12-21 12:26:51 -08:00
Vladimir Serbinenko
97bc2d843a SCI: Don't use rawString 2022-12-14 05:08:46 +01:00
sluicebox
aaebd2aa85 SCI: Fix some comments 2022-11-12 19:33:37 -08:00
sluicebox
daed465639 SCI: Add option for high resolution Mac fonts
This adds the existing GAMEOPTION_HIGH_RESOLUTION_GRAPHICS option to
Mac games with native fonts. Default is enabled. If disabled, then the
low resolution Mac fonts are used and the game isn't upscaled.
2022-11-06 23:05:20 -08:00
sluicebox
1efdb1cb6c SCI: Add support for Macintosh fonts
High-resolution native Macintosh fonts are now supported in the
following games when the game's executable is present:

- Castle of Dr. Brain
- Freddy Pharkas
- King's Quest 6
- Leisure Suit Larry 1
- Leisure Suit Larry 5
- Space Quest 1

And in these games when classicmacfonts.dat is present:

- Leisure Suit Larry 6 (floppy)
- Quest for Glory 1
2022-11-06 23:05:20 -08:00
sluicebox
1eeb0b1f24 SCI: Add scaling for Mac icon bar
Required for Mac fonts.

This also makes the disabled icons appear as they did in the original.
Mac SSCI would draw the disabled pattern at high resolution after
upscaling the icon image, not before.
2022-11-06 23:05:20 -08:00
sluicebox
2506f89717 SCI: Add scaling for Mac cursors (SCI16)
Required for Mac fonts
2022-11-06 23:05:20 -08:00
sluicebox
f779535e3e SCI: Fix vector pattern regression
Restores correct adjustments for vector patterns that extend past the
left or top picture edges. This was accidentally altered to occur
after the port adjustment in: 44b6050915ed6012f9e2e14c8ffa81d9e366529d

Fixes bug #13914 where the top of PQ2 room 1 was drawn out of bounds.
2022-11-03 21:06:06 -07:00
Hubert Maier
b756b36aa9
SCI: Correct spelling mistake
questionaire -> questionnaire
2022-10-27 15:57:28 +02:00
Le Philousophe
0b918a5352 SCI: Rename strcpy function to prepare for forbidden name
Even though strcpy in SegManager isn't a problem, our forbidden symbols
list being defined at preprocessor level, we won't be able to use this
name anymore.
2022-10-23 22:46:19 +02:00
Zvika Haramaty
34873d127f SCI32: Make RTL BiDi conversion direction hard coded
The default behaviour for `Common::convertBiDiString` is to use
BIDI_PAR_ON for direction, which means that it tries to guess to
paragraph language, and choose the direction according to it.

However, in SQ6 many (all?) texts begin with control characters,
which make that function to think that these are English texts,
and therefore it chooses LTR direction, and punctuations are wrongly
placed.

Since the call to the function is under `if` clause for RTL,
it's safe to hard code that direction.
2022-09-05 20:24:07 +03:00
sluicebox
e09010f7d8 SCI: Restrict kGetEvent throttling to fast cast mode
In 2010 a 10 ms delay was added to every kGetEvent call to prevent
maxing out the CPU when some games display message boxes:
b0b4ddcc5232485100fd42dcd14d164a8d2eaeac

This rapid kGetEvent polling is called fast cast and it only exists in
SCI1.1 games and some SCI1 games. It occurs in an inner loop when the
fast cast global is set.

Now the workaround is only applied to fast cast games and only when the
kGetEvent polling occurs.

Removing this 10 ms delay from every SCI16 game cycle doesn't change
game speed by itself because the larger dynamic throttling in
kGameIsRestarting has been absorbing the 10 ms. But this does make the
other throttles easier to understand and work with, and solves minor
edge cases where delays from multiple kGetEvent calls add up.
2022-08-02 17:23:34 -04:00
sluicebox
c346905a1a SCI: Reset palette cycling when loading games
Fixes frozen palette animation when loading from within the engine
2022-07-30 16:39:26 -04:00
sluicebox
c84e747e3b SCI32: Initialize ScrollWindow line indices
ScrollWindow's constructor was missing a call to initialize
line indices. Using a scrollbar before any text had been added
accessed an uninitialized array and failed an assertion.

Fixes bug #13542 in LSL6-Hires
2022-06-06 17:30:47 -04:00
sluicebox
ea48986006 SCI: Disable speed tests with script patches
Disables SCI16 speed tests with generic script patches.

- All games now pass their speed tests, and consistently.
- Handles games/versions that the benchmarking heuristic misses.
- Fixes bug #13529 (speed test overflow on fast CPUs) on all games.
- Replaces most game-specific patches.

I've left the benchmarking heuristic so that any game or version that
still needs patching will still be handled with unthrottling.
2022-06-06 17:20:58 -04:00
sluicebox
fed2504257 SCI: Fix QFG1VGA PC pic window initialization
I forgot the platform test in a3c38658774319eae3c3ce1ef34f663d4dc6f783

Also, a second attempt at explaining something confusing
2022-06-06 17:20:58 -04:00
sluicebox
3c3ed549f1 SCI: Disable JONES speed test
Fixes bug #13529
2022-06-03 12:00:58 -04:00
sluicebox
a3c3865877 SCI: Initialize pic window correctly for QFG1VGA Mac
Fixes the opening background being drawn 10 pixels too low
2022-05-20 14:20:22 -04:00
sluicebox
34983d1017 SCI: Fix out of bounds read when measuring text
Found with valgrind. The OOB read did not affect behavior.
Introduced in 8a87d1030c706db7fede0b5ece0aeabdf1a671cb
2022-05-18 14:26:06 -04:00
sluicebox
510f0e684d SCI: Fix some function declarations 2022-03-27 18:58:24 -04:00
sluicebox
e23f5fe855 SCI32: Update kSetShowStyle version checks for Mac
Consolidated kSetShowStyle version/argument checks and updated them to
handle SCI2.1 Mac games and PC demos. (The demos where the wrong
arguments were being applied happened to work anyway.)

Fixes LSL7 Mac pixel dissolve at the start of the game between the
postcard and the boat (rooms 120 and 130)
2022-03-22 07:32:55 -04:00
D G Turner
78db82f6e1 SCI: Fix Undefined Macro Compiler Warnings
These warnings are emitted by GCC if -Wundef is passed.
2022-03-15 10:17:12 +00:00
sluicebox
44b6050915 SCI: Fix vector pattern clipping behavior
Vector patterns weren't drawn accurately if the pattern's box touched
the right edge of the screen. This was due to clipping behavior that
differed from the original:

- The pattern's box was re-positioned one pixel too far to the right.
- The pattern's box was clipped to the screen and then drawn.
  Patterns require evaluating all pixels (consuming pattern and texture
  data) even if a pixel has to be skipped for being out of bounds.

Fixes a subtle inaccuracy in picture 2 of SQ3.
Unrelated to 4c369d5adfe2ddc5b9e5fd1f715b068695b0be2a

Thanks again to @eientei95 for spotting this!
2022-03-02 01:00:57 -05:00
sluicebox
4c369d5adf SCI: Fix incorrect values in vector texture table
Fixes incorrect values that trace back to SCI Decoder in 1992.

These caused subtle inaccuracies when drawing EGA vector pictures
with certain texture patterns. In SQ3 there are two of these
surrounding the escape pod in picture 2 in the first room.

Thanks to @eientei95 for spotting the picture discrepancy!
2022-03-02 00:55:51 -05:00
Eugene Sandulenko
abea37c9bb
ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
Filippos Karapetis
8a748f7e03 SCI: Add TTS support for SCI32 floppy games (QFG4, GK1, PQ4) 2021-12-24 02:57:27 +02:00
Filippos Karapetis
ee2995fe82 SCI: Don't hook up kDisplay to TTS
kDisplay is used to redraw parts of the UI, so it's not ideal to hook
TTS there, as it keeps spamming sentences that get redrawn in the UI
frequently, such as the intro text and the points in SQ5
2021-12-24 02:57:27 +02:00
Filippos Karapetis
a488bb47e8 SCI: Text to Speech (TTS) functionality for SCI16 (SCI0 - SCI1.1) games
This is based on the work done for GSoC by @taylorzhancher in PR #3256

Highlights:
- TTS has been hooked globally onto places where text is shown
- TTS is currently performed for textboxes and button texts
- TTS stops when text windows are disposed (which enhances the in-game
  experience)
- No game-specific logic has been added
- This hasn't been extensively tested with all SCI16 games yet
- There will be cases that are not handled properly yet
- The TTS functions have been grouped under a SciTTS class
2021-12-24 02:57:27 +02:00
sluicebox
c577976cd7 SCI: Remove FIXME from intended fall-throughs 2021-12-20 23:04:42 -05:00