Commit graph

4058 commits

Author SHA1 Message Date
Eugene Sandulenko
ec08412925 SCI: Fix shadowing warning 2018-06-29 09:14:17 +02:00
David Fioramonti
d52937cc7e SCI: Update rad2deg usage 2018-05-20 11:21:06 +01:00
Adrian Frühwirth
1967efc5cf JANITORIAL: Silence GCC 7 fallthrough warning
This wasn't explicitly marked as intentional but it very much looks it.
Committing separately in the unlikely case this needs to be reverted.
2018-03-23 18:38:37 +01:00
Willem Jan Palenstijn
0f98a60d35 SCI: Sabotage qfg1vga's speed test
This ensures the detected speed will end up at the highest level. This
improves the detail in Yorick's room (96), and slightly changes the
timing in other rooms.

Fixes bug #10296.
2018-02-01 20:08:20 +01:00
Colin Snover
2e061d95c5 COMMON: Move VER macro for serializer into common code 2018-01-31 17:58:01 +01:00
David Fioramonti
9518fd7210 SCI32: Fix PQ4 Barbie shoe points patch selector
The original script patch had the correct literal value but the
wrong selector name in the comment for the literal value, so when
it was converted to use a selector lookup in
c5dce17b1f, the patch broke because
the wrong selector name was used.

Fixes Trac#10392. Closes gh-1107.
2018-01-16 21:32:38 -06:00
Colin Snover
f4bc714677 SCI32: Add uninitialized read workaround for LSL6hires
Fixes Trac#10361.
2017-12-19 23:49:07 -06:00
Colin Snover
57db3f7535 SCI: Partially clean up SCI16 video playback code 2017-12-01 18:48:35 -06:00
Colin Snover
673d25a9cd SCI32: Fix crash starting KQ7 demo
Fixes Trac#10343.
2017-11-28 16:47:37 -06:00
Colin Snover
37459bc6c1 SCI: Fix UB in SegManager memcpy/strcpy operations
Passing overlapping buffers to C standard library memcpy, strcpy,
and strncpy is undefined behavior. In SSCI these operations would
perform a forward copy, and most stdlib implementations do the
same, but at least newer Linux glibc on x86 copies bytes in
reverse, so just using the standard library on this platform
results in broken output.

Because SSCI used a blind forward copy instead of memmove for
overlapping copy operations, this patch implements an explicit
forward copy to ensure that overlapping copies continue to operate
the same as in SSCI.

This fixes the Island of Dr. Brain v1.1 flamingo puzzle
(script 185, flamingos::init, localCall 4c3) on platforms that do
not perform forward copy in memcpy/strcpy/strncpy.

Thanks to @moralrecordings for research on this bug and an initial
patch using memmove.

Closes gh-1034.
2017-10-29 13:18:37 -05:00
Willem Jan Palenstijn
9030b09ecc SCI: Allow lofsa string printing in disasm for all SCI versions 2017-10-21 19:13:38 +02:00
Willem Jan Palenstijn
fab43f0f71 SCI: Fix offsets in disasm for multi-param opcodes
This code was assuming that retval points to the start of the next
instruction, which is only true if the current parameter is the last
one. This fixes op_call printing.
2017-10-21 18:55:40 +02:00
David Fioramonti
ce052fbef4 SCI32: Fix cursor color when quitting for phant1
When quitting the game at the main menu and hitting no
or quitting the game while playing the cursor color
over the buttons will be tan the first time rather
than red. This fix makes it so it will be red.

This was done by removing a check in HotSpot::doit()
which checks the global193 value. Removing this check
fixes the problem.

Fixes Trac#9977.

Thanks snover and wjp for your help.
2017-10-16 19:37:36 -05:00
Colin Snover
bb02d730b4 SCI32: Fix crash restoring save from endgame of RAMA
Fixes Trac#10263.
2017-10-08 19:25:54 -05:00
Martin Kiewitz
bd94bbc3e3 SCI: Add QfG4 script patch to fix sliding down slope bug #9801
It's quite difficult to patch. I hope this finally solved it.
2017-10-09 01:58:16 +02:00
Martin Kiewitz
870cd80202 SCI: Crazy Nick's Larry workaround bug #10184
Added this already through last commit by accident
Was supposed to get added by this.
Workaround for reading uninitialized temp game bug.
2017-10-08 20:54:59 +02:00
Martin Kiewitz
656de5e360 SCI: Restrict some workarounds to certain temps
Also add a bit more documentation / Fix some documentation
2017-10-08 20:52:48 +02:00
Martin Kiewitz
60c2c2867c SCI: Change index inside workaround tables to an index range
So that one can specify an entire range of temp variables
by using just one single entry.
2017-10-07 22:11:25 +02:00
Colin Snover
7d037495be SCI: Use explicit indexes in castlebrain/islandbrain word search workarounds 2017-10-07 14:50:21 -05:00
Colin Snover
1b669d2489 SCI: Add workaround for uninitialized reads in Island of Dr Brain
Leaning on the enter key during a word search puzzle will trigger
this bug, just like in Castle of Dr Brain.
2017-10-07 14:46:01 -05:00
Colin Snover
432fd522d2 ENGINES: Remove default1x scaler flag
This flag is removed for a few reasons:

* Engines universally set this flag to true for widths > 320,
  which made it redundant everywhere;
* This flag functioned primarily as a "force 1x scaler" flag,
  since its behaviour was almost completely undocumented and users
  would need to figure out that they'd need an explicit non-default
  scaler set to get a scaler to operate at widths > 320;
* (Most importantly) engines should not be in the business of
  deciding how the backend may choose to render its virtual screen.
  The choice of rendering behaviour belongs to the user, and the
  backend, in that order.

A nearby future commit restores the default1x scaler behaviour in
the SDL backend code for the moment, but in the future it is my
hope that there will be a better configuration UI to allow users
to specify how they want scaling to work for high resolutions.
2017-10-07 12:30:29 -05:00
Martin Kiewitz
83436e685f SCI: Improve Larry 1 Spanish script patch
So that it also works even when the patch files are missing.
2017-10-07 19:06:16 +02:00
Martin Kiewitz
eb1f9030a7 SCI: Add script patch for Larry 1 Spanish bug #10240
Fixes buying an apple from man wearing a barrel, who walks
around in front of the casino.
2017-10-07 18:56:29 +02:00
Martin Kiewitz
54cac32003 Revert "SCI: Add workaround for uninitialized reads in Island of Dr Brain"
This reverts commit ae8e4fa8e9.

This change is wrong in any case. It should be specific to temp
14+15 at the very least. I also did not get an answer on what
is actually happening internally. That's not how we should
add workarounds. My review was also still pending.
2017-10-07 11:25:12 +02:00
Colin Snover
ae8e4fa8e9 SCI: Add workaround for uninitialized reads in Island of Dr Brain
Leaning on the enter key during a word search puzzle will trigger
this bug, just like in Castle of Dr Brain.
2017-10-07 00:56:00 -05:00
David Fioramonti
ec1cfcbf47 SCI: Add workaround for uninit read during wordsearch in castlebrain
During the wordsearch puzzle (room 320 click left door) the
game will crash because of an uninitalized read of temp
variables in word::dispatchEvent (which gets called a lot),
if the player clicks the same letter or different letters
aggressively or holds down the enter key.

Fixes Trac#9783.
2017-10-07 00:56:00 -05: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
8c9276e75a SCI32: Clean up script patch comments 2017-10-06 22:56:25 -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
31e1d0932c SCI32: Clean up Plane
* Rewrap comments to 80 columns
* Clarify comments where possible
2017-10-06 22:11:03 -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
93c8044f69 SCI32: Clean up Audio32
* Rewrap comments to 80 columns
* Remove resolved TODOs
* Use containers and smart pointers where appropriate
2017-10-06 22:10:52 -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
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
Colin Snover
5cffa3891f SCI32: Clean up GfxPalette32
* Replace raw pointers with smart pointers
* Use references instead of const pointers where appropriate
* Tweak initialisation
* Tweak palette copies to the stack
2017-10-06 22:10:50 -05:00
Colin Snover
90036a56f8 SCI32: Speed up memory check counter in lighthouse in Lighthouse 2017-10-04 00:27:18 -05:00
Colin Snover
08f501117b SCI32: Give more specific game version numbers 2017-10-04 00:27:18 -05:00
Colin Snover
88cd54c057 SCI32: Restore gameplay time in RAMA
This will cause non-linear time shifts in the system timer that
the game's custom save logic may not expect, but in initial testing
the game doesn't seem to care about this.

Fixes Trac#10259.
2017-10-03 18:56:35 -05:00
Colin Snover
128031c6a6 SCI32: Fix crash when dying in RAMA
As it turns out, autorama.sg *is* actually used sometimes.

Fixes Trac#10253.
2017-09-30 11:42:49 -05:00
Colin Snover
be37a62591 SCI: Fix printing of super calls on clones in debugger 2017-09-30 01:08:12 -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
Martin Kiewitz
6f163b9325 SCI: Add script patch for QfG2 Jackalmen Oops - bug #10218
Was a game bug, finally fixed.
This was a combined effort of wjp and myself. Thanks to wjp.
We both don't own QfG2 1.000 atm, so we could not try it for that
version.
2017-09-28 23:51:35 +02:00
Colin Snover
f570e4b351 SCI32: Disable change directory button in original save/load in RAMA 2017-09-28 14:58:18 -05:00
Colin Snover
7de9c1682b SCI32: Allow save games to be deleted from original save/restore in RAMA 2017-09-28 14:58:18 -05:00
Colin Snover
c81348e3fe SCI32: Block RAMA from creating PREF.DAT file
This file normally stores brightness, music volume, and most
recently used save game directory. Since we store the music volume
ourselves and don't use the save game directory, the only
potentially useful information is the brightness level, and that
is fine to just restore from the save games.
2017-09-28 14:58:18 -05:00
Colin Snover
81d6706cf4 SCI: Remove resolved TODO 2017-09-28 14:58:17 -05:00
Colin Snover
cd6130cdd6 SCI32: Add audio volume sync support for RAMA 2017-09-28 14:58:17 -05:00