Commit Graph
134 Commits
Author SHA1 Message Date
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
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 bd7e708fc3 SCI: Move resource related functionality into a separate folder 2020-11-29 14:34:55 +02:00
Cameron Cawley c877097b49 ALL: Remove use of "" in Common::U32String constructors 2020-11-16 16:56:58 +00:00
aryanrawlani28 d41d0e9b22 JANITORIAL: Fix formatting issues 2020-08-30 14:43:41 +02:00
aryanrawlani28 12e4f871a3 GUI: U32: Improve u32 in all engine subsystems
- Common: add wordWrap function to ustr.cpp
- Bladerunner: Explicitly state we have a U32String in subs (same as Subtitles::loadOuttakeSubsText)
- Don't use translations for engine specific "put strings", because they might not support.
- SCI: Use const references for showScummVMDialog
- SCUMM:
-- Don't use translation in md5 warning. left comments with the translated version.
-- Remove some redundant headers in help.cpp
-- Don't use translation in handleSaveload when printing to console
-- Also, display success transaction correctly via u32::format
- TESTBED: Use fake constructor when setting label of button
- SKY: Correctly use translation when using SaveStateDescription
- ULTIMA: Don't use translations when display_string
- ENGINES:
-- GenerateUnknownGameReport correctly, with proper translations.
-- There was an error, where a function had been declared twice, in a header file. Correct this.
2020-08-30 14:43:41 +02:00
aryanrawlani28 e22b32abfe GUI: U32: Use Common::U32String::format where necessary and GUIError to u32
- Where necessary as in, where translated messages are used.
- GUIErrorMessage now takes in U32String
- error messages across some engines use U32Strings. they are changed because they show a message dialog.
2020-08-30 14:43:41 +02:00
aryanrawlani28 bed05ea134 GUI: U32: Fix compilation errors across entire project
After the initial changes just to scummvm/gui for u32, this commit includes the whole project

- Widget creations now always have u32 descriptions, labels, or tooltips
- Message dialogs make use of default arguments instead of providing the same argument explicitly
- encode String::format properly before passing on as argument where necessary
- Modify hugo utils (yesNoBox and notify box) to use u32
- Also provide fake constructors for the above which redirect to the u32 constructor
- Convert all keymap descriptions to u32 across all engines
- showConfirmationDialog in mohawk now uses u32
- showScummVMDialog also uses u32
- Scumm engine has dialogs now which use u32
- General fixes and wrapping convertToU32String for setLabels and related functions
- Add a fake constructor to MesssageDialog which redirects to the u32 constructor
2020-08-30 14:43:41 +02:00
Walter van Niftrik 22593de73f SCI: Rename font.h/cpp to scifont.h/cpp
This avoids an issue with MSVC where if (non-SCI) "graphics/font.h" is
included through another include file from the SCI engine root, it finds
"sci/graphics/font.h" first and uses that instead.
2020-08-27 14:56:17 +02:00
Filippos Karapetis ff044aa431 SCI: Move the GK2 subtitle patch dialog inside the SciEngine class
This is now grouped together with the other GUI messages. The script
patcher class itself does not need to handle such logic
2020-02-09 23:27:11 +02:00
sluicebox 2df444cecb SCI32: Implement kInputText for PHANT2 easter eggs
Implements kInputText, which displays a black and white utility dialog
with a title and a text box in a fixed position using the system font.
The only known game that uses this is Phantasmagoria 2 for several
easter eggs, which now work. This was probably used by internal scripts
during game development.

kEditText and kInputText share a function in Sierra's interpreter for
processing events, so that code has been factored out and placed in
GfxControls32::processEditEvent().

GfxText32 can now measure text pixel height as SSCI did by identifying
the tallest character height in the current text, which the newly added
titled font bitmap code requires.

Fixes bug #10570
2020-01-25 18:11:57 -08:00
sluicebox 148a9b7058 SCI32: Fix kShakeScreen32 parameter count check 2019-06-28 08:30:19 +03: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 1b42146955 SCI32: Clean up GfxRemap32
* Rewrap comments to 80 columns
* Clarify comments where possible
2017-10-06 22:11:03 -05:00
Colin Snover f51b158f8c SCI32: Clean up GfxFrameout
* Rewrap doxygen comments to 80 columns
* Swap public/private sections so public APIs come first
* Clarify comments where easily possible
2017-10-06 22:10:51 -05:00
Colin Snover ff3503abde SCI32: Clean up GfxTransitions32
* Use containers where appropriate
* Re-wrap doxygen comments to 80 columns
* Clarify comments for parts of the engine that are understood now
  but were not understood at the time of the initial
  implementation
2017-10-06 22:10:50 -05:00
Colin Snover b2966f3fc8 SCI32: Fix support for RAMA demo
Fixes Trac#10251.
2017-09-30 01:08:12 -05:00
Colin Snover 3b8b4f1722 SCI32: Clean up unused kBitmap code/subops 2017-09-29 19:56:24 -05:00
Colin Snover 3cdf26b355 SCI32: Fix bad text rendering in RAMA
In SCI3, Sierra removed the ability of the main renderer to
automatically scale CelObjs with different source resolutions.
Instead, in SCI3, all CelObjs are treated as having the same
resolution as the screen (i.e. 640x480).

In all SCI3 games other than RAMA, keeping the code paths for
resolution-dependent scaling is not a problem because all the
assets and game code are correctly designed to use the same
640x480 resolution throughout. RAMA, on the other hand, was
written with the text subsystem set to a resolution of 630x450
(Phant1's screen resolution), and in SSCI, resolution-dependent
scaling code was not removed from the *text* subsystem. As a
result, RAMA's game scripts rely on the slightly larger scaled
dimensions coming out of the text system when determining the size
of screen items for rendering, and then also rely on the main
renderer ignoring the 630x450 resolution baked into the bitmaps
generated by the text subsystem when drawing them to the screen.
2017-09-29 19:56:24 -05:00
Colin Snover 43a07abb46 SCI32: Implement kCelLink
kCelLink exists in SSCI since 2.1mid, but it is only known to be
used in Lighthouse, during the weapon creation puzzle near the end
of the game.
2017-09-03 20:58:07 -05:00
Willem Jan Palenstijn 820caf370e SCI32: Fix kObjectIntersect
It was using SCI16 calls to get the NowSeenRects.

This fixes #9855.
2017-07-09 22:56:04 +02:00
Colin Snover c9cbb8e31c SCI: Translate messages passed to dialogues 2017-05-08 11:26:46 -05:00
Colin Snover 57dd79d4dc SCI32: Detect and handle tight loops around kGetEvent
In SSCI, mouse events are received through a hardware interrupt
and the cursor is drawn directly to the graphics card by the
interrupt handler. This allows game scripts to omit calls to
kFrameOut without stopping the mouse cursor from being redrawn
in response to mouse movement.

ScummVM, in contrast, needs to poll for events and submit screen
updates explicitly from the main thread. Submitting screen updates
may block on vsync, which means that this call should really only
be made once per frame, just after the game has finished updating
its back buffer. The closest signal in SCI32 for having completed
drawing a frame is the kFrameOut call, so this is where the
update is submitted (by calling OSystem::updateScreen).

The problem with the approach in ScummVM is that, even though the
mouse position is being updated (by calls to kGetEvent) and drawn
to the backend's back buffer (by GfxCursor32::drawToHardware),
OSystem::updateScreen is never called during game loops that omit
calls to kFrameOut.

This commit introduces a workaround that looks at the number of
times kGetEvent is called between calls to kFrameOut. If the
number of kGetEvent calls is higher than usual (where "usual"
seems to be 0 or 1), we assume that the game is running one of
these tight event loops, and kGetEvent starts calling
OSystem::updateScreen until the next kFrameOut call. We also
then start throttling the calls to kGetEvent to keep CPU usage
down. This fixes at least two such known loops:

1. When interacting with the menu bar at the top of the screen
   in LSL6hires;
2. When restoring a game in Phant2 and sitting on the "click mouse"
   screen.

A similar workaround may also be needed for kGetTime, though loops
around kGetTime should preferably be replaced using a script patch
to call kWait instead.
2017-05-06 19:03:54 -05:00
Colin Snover 68218d15f2 SCI32: Fix incorrect arguments to readPixel in kCelInfo
Fixes Trac#9750.
2017-05-02 11:00:45 -05:00
Colin Snover ede7976ede SCI32: Fix bad kPointSize implementation
Fixes text scaling gone mad in Phant2.
2017-04-22 19:25:20 -05:00
Colin Snover e504efe4da SCI32: Add palette code for late SCI2.1mid+ games
Sometime during SCI2.1mid, the palette manager was changed to
save and restore the source palette, and to add in-game gamma
correction. Previously, only the vary start and target palettes
were saved, and gamma correction was only configurable in SSCI by
editing RESOURCE.CFG.
2017-04-22 13:01:37 -05:00
Colin Snover 6b0cd955fa SCI32: Fix crash when using brightness slider in Shivers 2017-03-30 19:46:27 -05:00
Colin Snover 01e6d07360 SCI32: Split kCelInfo into subops
Different subops have different call signature requirements.
2017-01-09 19:34:54 -06:00
Colin Snover 97a47852c1 SCI32: Fix kSetShowStyle signature for SCI3 2017-01-09 19:34:54 -06:00
Colin Snover 70d1edf615 SCI32: Add validity checks to kList iteration methods
In GK2, restoring a save game causes the segment manager to reset
in the middle of a kListFirstTrue call, which invalidates all
pointers and reg_ts to stored data. This means that when
kListFirstTrue tries to decrement the list recursion counter at
the end of iteration, it is writing to freed memory, potentially
resulting in heap corruption.

SCI3 added checks to prevent this from happening, but these checks
seem like they should have also been applied to some SCI2.1 games
as well (like GK2).

Since there should be no negative side-effect to this check, it
is applied universally to all SCI32 games.
2017-01-05 16:00:59 -06: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 34bd1bcaa9 SCI32: Split out detection of features that cross SSCI versions 2016-10-20 11:33:29 -05:00
Colin Snover f35fafa525 SCI32: Fix kPalVary(SetVary) in SCI2.1early games
Game scripts pass an extra argument which is never used in SSCI.
This happens e.g. when warping from room 620 to room 860 in
LSL6hires.

Adding a signature for kPalVarySetVary for SCI2.1early games only
does not work because KQ7 1.51 is detected as SCI2.1early but the
interpreter includes kPalVary code that matches SCI2.1mid.

Fixes Trac#9611.
2016-10-15 18:00:37 -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 5baff4a1e5 SCI32: Fix some buildbot compiler warnings 2016-09-30 13:54:06 -05:00
Colin Snover e412eaffbc SCI32: Clean up and document GfxPalette32 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 c3335657f7 SCI32: Allow invalid bitmap references to be passed to kBitmapDestroy
SSCI explicitly ignored invalid references passed to this function.

Fixes GK1 room 410, when using the Rada Drum book on the drummer.
2016-08-27 12:03:37 -05:00
Willem Jan Palenstijn e880fd74ed SCI32: Fix warning 2016-08-26 18:57:43 +02:00
Filippos Karapetis 88cffa3220 SCI32: Add stubs for the kPlayVMDSetPreload and kPaletteSetGamma calls
These were introduced in SCI3, and are used by RAMA. We don't preload
videos, so we don't really need kPlayVMDSetPreload, but
kPaletteSetGamma may need an implementation.

With these two stubs, the main menu of RAMA is working again
2016-08-22 19:04:26 +03:00
Colin Snover 7f23c91de9 SCI32: Fix limited data range comparison warning
On at least DC platform, the ShowStyleType enum is fit to a 4-bit
data size, so the 16-bit input value needs to be checked for
validity *before* it is cast to a 4-bit ShowStyleType.
2016-08-19 15:23:10 -05:00
Colin Snover 4e1a9be816 SCI32: Remove CoordAdjuster32, at least for the moment
This may come back in the future to deduplicate some gfx code,
but SCI32 had two different inlined ways of doing coordinate
conversions with different rounding methods, so CoordAdjuster32
didn't get used when the graphics system was rewritten.

At the moment, SCI32 code uses the mulru/mulinc methods from
helper.h for scaling up/down coordinates.
2016-08-19 15:23:10 -05:00
Colin Snover b1d53ca25d SCI32: Add kSetNowSeen variant for older SCI32 games
KQ7 2.00b, PQ:SWAT, Phant1, GK2, and Torin are all verified as
using the 'ignore' variant; SQ6 and QFG4CD are verified as using
the 'fail' variant. MGDX and Shivers could not be checked as they
have only Phar Lap Win16 executables, so took a guess based on
their release dates.
2016-08-19 13:57:40 -05:00
Colin Snover 6e2e862d8e SCI32: Implement kShakeScreen for SCI32 2016-08-19 13:57:40 -05:00
Colin Snover ff00e93c67 SCI32: Remove GfxScreen from SCI32 2016-08-19 13:57:40 -05:00
Colin Snover 80d9182554 SCI32: Implement SCI32 cursor support 2016-08-19 13:57:40 -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 0f535e79f5 SCI32: Add 6-argument signature of kAddPicAt
This is used by Torin in room 50900.
2016-08-01 10:37:14 -05:00