Commit graph

589 commits

Author SHA1 Message Date
athrxx
45cdc8ab07 SCUMM: (v1-3) - move load post processing to extra function 2022-06-05 23:17:28 +02:00
athrxx
dfe6082a12 SCUMM: (v1-3) - fix sound recovery when loading savegames
Prevent "stuttering" from starting the music multiple times (which may now happen due to the improved savegame loading for v1-3).

Also add some more tweaks to minimize stuttering, like setting volume to 0 during loading.

The result now seems to match what I get when using an emulator.
2022-06-05 23:17:28 +02:00
athrxx
ed8e1c4870 SCUMM: (v1-3) - imitate original style savegame loading
Similar to what has been added for Loom, this tries to emulate the original (script driven) loading behavior for the rest of the v1-3 games.

This fixes bugs like the music not being restarted properly when loading a game (happens in MM and ZAK).

https://bugs.scummvm.org/ticket/4494 will not be fixed, though, since I don't support Mac with this fix.

The Mac games work differently, they don't have a save/load room but these Mac style menus instead. Someone would have to do examine the save scripts for these...
2022-06-05 23:17:28 +02:00
AndywinXp
612f453f1b SCUMM: LOOM: Fix game and music timers for the Steam variant 2022-05-22 23:27:40 +02:00
AndywinXp
015e37a003 SCUMM: Fix VAR_TIMER and VAR_TIMER_NEXT assignment
Unless a slow host machine was used, the previous calculation always yielded 0.
Also, by disasms, those two timers should be assigned exactly in the same way as VAR_TMR_1, 2 and 3.
2022-05-22 22:08:44 +02:00
Torbjörn Andersson
09432c45d0 SCUMM: Initialize _lastWaitTime 2022-05-22 13:06:43 +02:00
Torbjörn Andersson
9c455472eb SCUMM: Fix regression in the replacement music timer
The replacement music timer operates on real time, and is adjusted for
the expected length of the Loom overture in order to accommodate for
different recordings of it. It's completely independent of the SCUMM
engine's timer frequency.
2022-05-22 12:07:21 +02:00
AndywinXp
ebb3f2a842 SCUMM: Implement Amiga timings 2022-05-21 22:44:01 +03:00
Andrea Boscarino
e42ad88690 SCUMM: Implement original CD Audio timing handling 2022-05-21 22:44:01 +03:00
Andrea Boscarino
6bc2df1709 SCUMM: Correctly notify the music timer of the current ticks 2022-05-21 22:44:01 +03:00
Andrea Boscarino
9cf60930b9 SCUMM: Fix the timings update for the script variable
This fixes music/game sync issues at the end of DOTT intro (before the main theme)
2022-05-21 22:44:01 +03:00
Andrea Boscarino
caae9399f5 SCUMM: Add PIT behavior for ZAK v1 2022-05-21 22:44:01 +03:00
Andrea Boscarino
95894ae9fe SCUMM: Implement accurate PIT timings for DOS versions 2022-05-21 22:44:01 +03:00
Andrea Boscarino
9fc868c7ed SCUMM: Implement quarter frame precision timing 2022-05-21 22:44:01 +03:00
ShaharAriel
fe642720d8 SCUMM: Add RTL support for MM
This add MM to existing fixes of RTL support
2022-05-15 16:26:04 +03:00
Orgad Shaneh
0e2ddd6899 SCUMM: Centralize RTL support condition
Store it in a member instead of duplicating the condition.
2022-05-15 02:48:46 +03:00
Orgad Shaneh
3231a6e3a2 SCUMM: Use inline member initialization
and initialize all members.
2022-05-13 22:34:56 +03:00
athrxx
f66aad48d9 SCUMM: (LOOM) - fix/improve comments 2022-05-12 19:00:03 +02:00
athrxx
5522beae53 SCUMM: (LOOM) - fix bugs #6011 and #13369
(try to emulate the behavior of the save script without actually calling it)
2022-05-12 19:00:03 +02:00
Torbjörn Andersson
7586876887 SCUMM: Make skipping Sam & Max sound pre-loading an enhancement
The original commit message says "Skip sound caching in Sam & Max
(Talkie)", with no mention of copy protection being involved. I guess
the _copyProtection flag was re-used as a convenient but rather
unintuitive way of preserving the original behavior.
2022-05-06 19:51:11 +02:00
Andrea Boscarino
024aa1f22b SCUMM: SMUSH: Implement audio sub-engine 2022-04-16 23:25:31 +02:00
athrxx
997e2c4b05 SCUMM: (SCUMM7/8) - cleanup
- remove outdated code
- move things from V6 to V7
2022-04-08 19:53:44 +02:00
athrxx
f5f49d1b3f SCUMM: (SCUMM7/8) - improve ingame text wrapping and positioning for DIG and COMI
This fixes a couple of regressions (mostly camera related). For DIG it seems that the older version of the interpreter uses CharsetRenderClassic type text display while the newer version uses COMI style. I stick with the COMI style, but with the necessary tweeks to make it pixel perfect for all versions.

COMI (I've tested English and Chinese) seemed to be pixel perfect without having to do much, same for DIG Chinese (new interpreter version). Even the verbs seem to be fine, although I haven't changed anything there yet (applies to COMI only afaik, I think DIG doesn't have text verbs).

DIG English (old interpreter version) is another matter. That one wraps text quite differently. Our version looked quite different from the original. But now it also seems to be fine. I even fixed a weirdo problem with the character width (It seems that the fonts have some kerning data; if we use that like we did the 'a' character gets displayed too narrow by 1 pixel. So all lines containing 'a' characters were slightly off). I have examined several strings in several camera settings for pixel perfect drawing in DIG and all seems good now...

FT: I'll do that separately. I haven't even checked if it needs any fixing. Maybe it is fine already. But it sure would be nice to get rid of any redundancies...
2022-04-08 19:53:44 +02:00
athrxx
0256e92c25 SCUMM: (SCUMM7/8) - reorganize font rendering - second part
- Attach actor talk texts to the appropriate text renderer and get rid of redundant code.
- Cleanup subtitle text handling.
- Fix handling of ^codes.
- Fix more regressions from last commit.
- Correct some x/y positioning.
2022-04-08 19:53:44 +02:00
athrxx
1f56132725 SCUMM: (SCUMM7/8) - reorganize font rendering - first part
(inspired by PR 3276 - this here has the desired effect, but actually allows the removal of hacks, workarounds and redundancy code instead of adding more of that sort)

The purpose is to have the same accurate font rendering that we already have in the Smush code also for the ingame texts. The original interpreters draw the text like that, so this is not a weirdo invention of mine.

This is still broken. The main purpose was to get as much code done as necessary to have it at least compile again and correctly run the Smush texts.

The rest still needs quite some work...
2022-04-08 19:53:44 +02:00
Torbjörn Andersson
b66e84d57a SCUMM: Change "Use correct font spacing" to a game-specific enhancement
It doesn't make much sense to keep this as a separate option, when
fixing the font spacing is an enhancement specifically for the Mac
version of Indiana Jones and the Last Crusade.
2022-03-23 15:23:10 +01:00
Torbjörn Andersson
cb561f462e SCUMM: Read the "enable_enhancements" setting only once
I can't change during gameplay, it's shorter to type, and we won't
accidentally involve the config manater in some tight loop.
2022-03-23 15:23:10 +01:00
Torbjörn Andersson
4ed1777b00 SCUMM: Fix regression when pausing games
If for any reason waitForTimer() lags behind by "a lot", return the real
time instead of the expected time. One such case if is the game was
paused (which we could detect and set a flag for), but there are other
possible cases (e.g. the process being suspended) which I don't think we
have any good way of detecting.

This keeps the game from rushing to catch up after pausing.
2022-03-18 10:38:00 +01:00
Torbjörn Andersson
619619fe9c SCUMM: Fix engine stalling in fast mode
This was a regression from the recent timing fixes. In fast mode, the
main loop would still assume waitForTimer() took the normal amount of
time to finish. Now waitForTimer() returns the expected end time,
adjusted for fast mode.
2022-03-17 16:35:32 +01:00
athrxx
e2da112934 SCUMM: (INDYZAK/FM-TOWNS) - fix scrolling for the demo
The demo scrolling is not yet as refined as in the final products. An adjustment to the timing that was made for the final products is not present in the demo. This adjustment will actually make the scrolling more sloppy in the demo (due to different scumm timer parameters set by the scripts) , so I disable it here.

Please note that the scrolling still won't be as smooth as it is in the final products. This is the same when viewing the demo in an emulator, though (I actually think it is slightly better in ScummVM). It is probably the reason why they made the change for the final products.
2022-03-16 19:50:20 +01:00
Torbjörn Andersson
638bad3bed SCUMM: Make WaitForTimer() a bit more precise
It doesn't matter for the main loop, since any overshoot is still
accounted for and they're just fewer and smaller now. But the function
is called from some other places as well.
2022-03-16 12:10:11 +01:00
Torbjörn Andersson
f4c14d9b38 SCUMM: Attempt to improve timing
The waitForTimer() function is almost guaranteed to overshoot its
target. Keep assuming that it's exact, but factor in the difference when
timing how long scummLoop() takes.
2022-03-16 12:10:11 +01:00
Torbjörn Andersson
b36347c1e9 SCUMM: Improve Loom Overture timing with replacement music
Before, the music timer was based on the number of SCUMM ticks that had
passed since the track started. But this meant that the timing could
differ by several seconds depending on your hardware.

Now it's instead based on the amount of time that has passed since the
replacement track started playing. Time that passes while the game is
paused does not count. Of course, if the player suspends the process that
time still counts. But the player was clearly asking for it then!

Would it be better to tie it to the current position in the audio track?
Possibly, but the CD audio manager doesn't provide that information.
Even if it did, the timer has to run even if the track ends prematurely,
because we can't just assume that every available recording has the
expected length.

But at least, we now have a well defined unit of measurement: We
hard-code the point in time where the Overture transition should happen
with the Ozawa recording. Ten ticks on the settings slider moves this
point by one second, allowing the user to adjust it by 20 seconds in
each direction. Surely that should be enough?
2022-02-11 12:21:29 +01:00
Torbjörn Andersson
fc1c686909 SCUMM: Don't require the Roland update for the Loom demos
The Roland update is only required to get MT-32 music from the full EGA
version of Loom. The demos include the Roland music already.
2022-02-08 13:31:39 +01:00
Torbjörn Andersson
3899a50503 SCUMM: Fix bugs when initializing default Loom Overture tempo
We now store the difference compared to the default value, rather than
the actual SCUMM ticks. Therefore, the default value for the setting is
0, not DEFAULT_LOOM_OVERTURE_TICKS.
2022-02-08 13:31:39 +01:00
Torbjörn Andersson
c80adc3e8b SCUMM: Add setting for the Loom Overture tempo on the Engine tab
It's hard to make this appear only on EGA Loom, so the tooltip has to
document the fact that it's only useful there. The setting is made
relative to the default tempo, which I feel is a much more sensible way
of presenting it to the user than the raw ticks value.
2022-02-08 13:31:39 +01:00
Torbjörn Andersson
13faad39a3 SCUMM: Enable Loom replacement tracks for more versions
Thanks to eientei and GandalfTheWhite for confirming that the Atari ST
and Amiga versions use the same track numbering as the EGA (AdLib) and
Macintosh versions. That should mean that only the versions that already
use CD audio track need to be excluded.
2022-02-08 13:31:39 +01:00
Torbjörn Andersson
5d32eccf72 SCUMM: Fix Loom Overture stalling if replacement track ends
For the Loom Overture to end, the music timer has to reach at least 278.
Keep the music timer updated for as long as there is a current CD sound,
even if the track itself has ended. If the track ends very early during
the Overture, skip ahead to the scene change. There will be several
seconds of silence, but this seems unlikely to ever happen to begin
with.
2022-02-08 13:31:39 +01:00
Torbjörn Andersson
48bebe680d SCUMM: Emulate the music timer for replacement audio tracks
This is currently hard-coded for the Loom Overture, and counts the
number of SCUMM ticks that have passed since the song started. Perhaps
it would make more sence to query the CD position, but our CD audio
manager doesn't support that at the time of writing.
2022-02-08 13:31:39 +01:00
Torbjörn Andersson
8ad80a83c1 SCUMM: Initial work on replacement audio tracks for Loom
This allows EGA Loom and Mac Loom to use replacement audio tracks, e.g.
from the FM Towns or TurboGrafx-16 versions or, with a bit work, any
recording of the original ballet.

Currently the Ouverture doesn't work, since it relies on the music
timer being updated.
2022-02-08 13:31:39 +01:00
Orgad Shaneh
6be5b08c78 SCUMM: Show subtitles on talkie versions without sound file
If the game is a talkie version, on which the verbs reference sounds, but
it is missing the sound file, and the user chose Voice Only, a warning
appears for every playback attempt.

Force subtitles on this case, to avoid these warnings.

Fixes trac 13151
2022-01-30 13:30:27 +02:00
Thunderforge
fd129ebc0c JANITORIAL: "Mac OS X" and "OS X" to "macOS" in comments
Apple's desktop operating system was formerly called "Mac OS X" and "OS X", but since 2016 it has been called "macOS" (starting with version 10.12).

Changing across all comments and documentation to use this current terminology, except in cases where the historical versions are explicitly referenced. No code changes are made; we should consider changing those in future PRs.
2022-01-29 14:15:05 +01:00
Andrea Boscarino
c20a92b3ac SCUMM: Remove DiMUSE specific code from main engine 2021-12-29 14:26:53 +01:00
Eugene Sandulenko
abea37c9bb
ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
Torbjörn Andersson
513fffe950 SCUMM: Check for the appropriate audio tracks for indyzak and zakloom
The FM Towns demos use audio tracks, but neither have a track 1. This
caused ScummVM to warn that the audio tracks had not been properly
ripped from the CD.
2021-11-22 19:38:40 +02:00
Eugene Sandulenko
c505b27662
SCUMM: Improved wording of the BUN/SOU compressed warning 2021-11-18 23:49:10 +01:00
athrxx
32837a858f SCUMM: tweak screen shakes some more
- fix Japanes FM-Towns: the shake positions have to be multiplied with the _textSurfaceMultiplier

- slightly reduce shake speed for SCUMM <=3
2021-11-18 00:37:30 +01:00
athrxx
33d1804b4e SCUMM: fix bug no. 13065 ("Incorrect screen shaking") 2021-11-16 20:35:32 +01:00
Andrea Boscarino
f731cfd648
SCUMM: DiMUSE: New Digital iMUSE Engine (#3368)
SCUMM: DiMUSE: Add new implementation of the engine
2021-11-16 00:05:18 +01:00
Orgad Shaneh
ed5489929c SCUMM: Use nullptr
Using clang-tidy modernize-use-nullptr
2021-11-14 15:51:59 +02:00