Commit graph

2095 commits

Author SHA1 Message Date
Eugene Sandulenko
de6f0984c4
ULTIMA: Dropping ADGF_TESTING flag 2021-10-01 14:11:05 +03:00
Matthew Duggan
2e135b284e ULTIMA8: Adjust proc loop detection workaround again
The previous workaround value chosen to fix U8 bug #12913 really locked up
Crusader too long (>10 s), so there's no clean solution here that works for
both games it seems.  Revert the threshold back for Crusader games only, and
keep the high threshold for U8.  I hope the next time I touch this line is to
remove it because I work out the root cause of the problem :|
2021-09-23 16:09:55 +09:00
Matthew Duggan
b476d645f9 ULTIMA8: Put back ARG_NULL8 macro with fix
Removed this macro in dc17170 because it had one usage and was wrong anyway,
but it's nice to avoid the unused variable warning.
2021-09-23 07:47:44 +09:00
Matthew Duggan
8fcfd9cd6f ULTIMA8: Use 2 bytes of intrinsic stack for UINT8
This fixes #12917.

The usecode "push byte" opcodes (0x0A and 0x5D) always push 16 bits on the
stack, but the ARG_UINT8 macro was only removing 1 byte.  Most of the time this
went unnoticed because the UINT8 was the last argument in most cases (eg, a z
val), or unused.

This led to an inconsistency where sometimes z values were being popped with
ARG_UINT16 and sometimes ARG_UINT8.  The original games do not support z values
beyond 254, so this should always be UINT8.

Additionaly, a while back "push byte" was fixed so it always sign extends, but
this could result in a case where we pop incorrect values.  For example, a high
Z value could get sign-extended on push, and then popped back as a UINT16,
giving a z of 64000ish.

Fix by always moving the SP by 2 bytes, only use the first one.

Correcting this also fixes the strange color ordering I thought was needed for
I_jumpToAllGivenColor in Crusader: No Regret, where actually it should have
been popping the values as 16-bit instead of 8-bit.
2021-09-23 07:47:35 +09:00
Matthew Duggan
17fe1125af ULTIMA8: Allow turning while retreating in Crusader
The original game allows you to turn while retreating, but that was not
previously possible.

To make the turn always possible, step() now does not wait for the movement
animation.  This should work as AvatarMoverProcess::run terminates early if the
Avatar is busy.
2021-09-11 22:17:04 +09:00
Matthew Duggan
98444ff234 ULTIMA8: Fix Crusader targeting slightly
There were two differences to the original which caused occasional targeting
mishaps:
1.  The reticle and actual shots were using different starting positions for
the shot (Avatar centre vs Avatar corner)
2. Z difference was not being taken into account when finding the "best" target

This fixes both problems.
2021-09-10 22:07:51 +09:00
Matthew Duggan
7b0a1a3340 ULTIMA8: Fix Crusader shield hit damage
The `shieldCost` field from the firetype table should be used to subtract from
shields, not the weapon damage.  Normally shieldCost is a larger value, so it
affects game difficulty a lot.
2021-09-09 23:32:56 +09:00
Matthew Duggan
e5944517ab ULTIMA8: Fix Crusader NPC weapons in No Remorse difficulty
The NPCs should get randomly harder weapons at No Remorse difficulty level, but
this never happened because I missed a line in the original to reset the "alt"
weapon type in this case.
2021-09-09 23:32:51 +09:00
Matthew Duggan
a5bad57fce ULTIMA8: Fix where Crusader BA-40 ammo is used
After rechecking, the original game has expendable BA-40 ammo on every
difficulty above *1*, not *2*.  Confirmed in dosbox and the disassembly
(function at 13c8:2975).
2021-09-09 23:06:44 +09:00
Matthew Duggan
c7406a4077 ULTIMA8: Limit BA-40 ammo in high Crusader difficulties
Bug #12880.  The BA-40 should consume ammo in the higher 2 difficulty levels
for Crusader: No Remorse.  A similar change is probably needed for No Regret,
but it will be done separately.
2021-09-09 22:23:36 +09:00
Matthew Duggan
127306a90a ULTIMA8: Increase process loop detection theeshold
As reported in #12913, the current process loop detection can incorrectly fire
on certain U8 map transitions.  Bump the threshold way up to avoid problems.
This will result in a nasty pause in Crusader: No Remorse Map 3, but it's
better than breaking U8.
2021-09-08 10:00:50 +09:00
Matthew Duggan
24093ec783 ULTIMA8: Reduce incorrect global warnings in U8
Because the games have different global sizes, the logic for when to print a
pop-to-global warning was wrong.  It should warn for size > 2 in Crusader
(where the globals are *bytes*), or if the size popped doesn't fit in
the number of *bits* for U8.
2021-09-08 10:00:44 +09:00
Matthew Duggan
632bfd5c21 ULTIMA8: Provide message on why movies and sound don't work
A few people have not noticed that the GOG version includes a CD image and some
files need to be taken from there.  This should help those people.

The same problem will happen for anyone who has an old install of the game and
forgets that it uses some files from the CD.
2021-09-08 07:29:41 +09:00
Matthew Duggan
4bffdec4e7 ULTIMA8: Always turn in Crusader when arrow keys are tapped
In the original game, while walking or running even a very brief tap on the
arrow key will always result in a turn.  Now we do that too by remembering a
tap happened.
2021-09-05 15:23:37 +09:00
SupSuper
8c86319923 BACKENDS: Use U32String for FSNode::getDisplayName 2021-08-23 21:22:27 +01:00
Matthew Duggan
901849af8c ULTIMA8: JANITORIAL whitespace 2021-08-21 10:04:18 +09:00
Matthew Duggan
53e8f5090c ULTIMA8: Refine hack of destroying things that fall below floor
Fixes Mordea disappearing during wake-up game event (#12803).

The proper fix here is maybe to never let items fall below 0, which I think is
how the originals work, but that could have significant other impacts I'm not
sure about, so for now just refine the workaround.
2021-08-21 10:02:14 +09:00
Matthew Duggan
ccc574430b ULTIMA8: Print warning if bark fails 2021-08-21 10:01:51 +09:00
Matthew Duggan
0bce42b8f2 ULTIMA8: Fix saving when using original journal UI 2021-08-21 08:48:59 +09:00
Coen Rampen
0c9b5a93f3 ULTIMA6: Fix journey onwards
The Journey Onwards menu option would not actually load a savegame if the user
selected it from the main menu; it would just start a new game. Changed this to
loading the savegame in the last slot used for saving. This fixes bug #12531.
2021-08-16 21:58:11 +02:00
Coen Rampen
3fd7f5d168 ULTIMA6: Fix yes/no dialog null pointer
The yes/no dialog would not pass a pointer to itself as a data parameter to the
callback when an otherwise unhandled key was pressed. Events::callback needs
this pointer to clear the dialog and would dereference the null data parameter.
Fixed this by adding the missing parameter. This fixes bug #12533.
2021-08-14 21:48:10 +02:00
Cameron Cawley
f24bffab48 ULTIMA8: Move getExtraGuiOption() into UltimaMetaEngineDetection 2021-08-14 13:57:54 +02:00
Matthew Duggan
294b22a90d ULTIMA8: Rework Crusader startup to better match original
The original has 2 ways to start a new game:

1. start from dos -> intro movies -> difficulty menu -> voice mail movie
	-> game
2. playing game (press esc) -> game menu (new game) -> difficulty menu
	-> voice mail movie -> game

We now match those sequences correctly.

There is one difference still - if you have a saved game, we will by default
load that.  Previously the game jumped straight into that, but since there is
now no other way to see the intro movies again, now they are always shown
first.  So the 3rd flow is (if you have a save game):

3. start scummvm -> intro movies -> game

Since some people might want to just jump straight into the game, I also added
a skip_intro config file setting which will skip the movies in this case.

Fixes #12758.
2021-08-14 13:31:04 +09:00
Matthew Duggan
d317df77d2 ULTIMA8: Fix x offset of Crusader movie subtitle background 2021-08-14 13:24:06 +09:00
Coen Rampen
4a0c6a93a2 ULTIMA8: Fix overlaid music transitions
Some music transitions are intended to play on top of the currently playing
track (mostly fade-outs). ScummVM would stop the current track and then play
the transition. This commit changes this so it overlays the transitions like
the original interpreter does.
2021-08-12 14:30:52 +02:00
Coen Rampen
9ab34c4166 ULTIMA8: Fix music transitions playing incorrectly
The music transition numbers from the song info data were incorrectly parsed.
For overlaid transition numbers starting with !, the first character is
skipped when parsing the number, but this was also done for instant transition
numbers which do not start with !, resulting in incorrect numbers. Also, the
overlaid transition numbers were 1 lower than what the music process was
expecting.
After a transition was started, the music process' run method would immediately
stop the transition and start the next track. This is fixed by waiting for the
transition to finish before starting the next track.
2021-08-12 14:30:52 +02:00
Matthew Duggan
c93716ead2 ULTIMA8: Improve I18N for Crusader option
Silencer is the player-character and so should probably be capitalized - I had
capitalized it in other places in the code and comments.

Also added a I18N comment so translators know what it is.
2021-08-11 19:05:32 +09:00
djsrv
ba28d7fde6 ALL: Change listMatchingMembers pattern to a Path
This handles any potential differences in directory separators passed to
the function, as with the other Archive functions.
2021-08-09 17:47:30 -04:00
Matthew Duggan
4fd4570f41 ULTIMA8: Crusader subtitle improvements
* Add the black box behind them to make them more readable
* Fix the bug which meant the first subtitle sometimes got lost
2021-08-09 14:53:56 +09:00
Matthew Duggan
2009ddac79 ULTIMA8: Fix debug message 2021-08-09 14:53:26 +09:00
Matthew Duggan
2e1cc976af ULTIMA8: Update list of Crusader NPC types not notify when weapon fired
Remorse and Regret have a slightly different list in this function.
2021-08-09 11:58:57 +09:00
Matthew Duggan
c8d834f555 ULTIMA8: Add option for camera to follow avatar in Crusader 2021-08-09 11:58:57 +09:00
Coen Rampen
403e9bae34 ULTIMA8: Fix function call swapped parameters
A call to the AudioProcess::stopSFX function seemed to have its parameters
swapped. This commit fixes this.
2021-08-08 23:21:12 +02:00
Coen Rampen
7faa62d66f ULTIMA8: Pause audio when ScummVM dialogs are shown
When showing the ScummVM menu using Ctrl-F5, gameplay in Ultima 8 would pause,
but MIDI music would continue to play (AdLib would pause) and sound effects
would finish playing as well. This commit pauses all music and digital audio
when the ScummVM menu is shown.
2021-08-08 22:12:07 +02:00
Coen Rampen
543591c9c5 ULTIMA8: Add music fade-out in intro
In the Ultima 8 intro, the last music track fades out in the original
interpreter, but in ScummVM it stopped abruptly. This seems to be because the
SKF_SlowStopMusic action was not fully implemented. This commit adds an
implementation to this action, which restores the fade-out in the intro.
2021-08-08 22:12:06 +02:00
Coen Rampen
04f3083f4d ULTIMA8: Fix SFX and speech volume control
The SFX and speech user volume controls for Ultima 8 did not work because
digital audio was played using the plain sound type instead of SFX or speech.
To distinguish between the two, a flag was added to the AudioChannel::playSample
function to indicate if the sample is a sound effect or speech.
2021-08-08 22:12:06 +02:00
Coen Rampen
88e214745d ULTIMA8: Enable MIDI config tabs for Ultima 8
Ultima 8 uses MIDI, but the MIDI configuration tabs were disabled. This commit
enables the MIDI configuration by removing the GUIO_NOMIDI flag from the
detection entries.
2021-08-08 22:12:06 +02:00
Coen Rampen
1cb0f6b474 ULTIMA8: Fix AdLib music
To make the Ultima 8 AdLib music sound like the original interpreter, the
MidiPlayer class has been updated to use the Miles MIDI drivers. This allows
the game's AdLib instruments to be used. Because the Audio::MidiPlayer does not
work well with the Miles drivers, I've removed the dependency on this class and
implemented the necessary functionality in the Ultima 8 MidiPlayer.
2021-08-08 22:12:05 +02:00
Max Horn
5bd265637b ULTIMA: fix global constructor warnings
This also makes the code independent of the user's locale (being
dependent on that by accident can lead to difficult to track down bugs)

The list of whitespace used now is what the C standard guarantees as
minimal set of characters accepted by `isspace` as whitespace.
2021-08-07 10:46:14 +02:00
djsrv
0d65c2fd12 ALL: Use Path type in File functions 2021-08-07 10:44:37 +02:00
djsrv
7eb4841065 ALL: Use Path type in Archive functions 2021-08-07 10:44:37 +02:00
Max Horn
2f1f8f502e DEVTOOLS: move credits from devtools/credits.pl to engines
This employs a "lazy" approach: the "format" for the credits stays
exactly as it was, i.e., perl code. Of course one may want to change
this to another format (e.g. YAML, JSON, XML; or also shell script or
AWK, like `configure.engine` uses). But I deliberately kept it simple,
to get a minimal change that is easy to verify. Any further changes to
e.g. the format can be layered atop this.
2021-08-05 00:01:46 +02:00
Matthew Duggan
1afa2eab91 ULTIMA8: Fix crash after watching Crusader credits and saving game 2021-08-01 11:03:49 +09:00
Matthew Duggan
c6e10b26f5 ULTIMA8: Correct crusader splash damage divisor
Checking the original game again, because our coordinate system is double, we
should halve the divisor factor to calculate the correct damage.
2021-07-31 12:58:56 +09:00
Matthew Duggan
2cf53816cc ULTIMA8: Alert nearby NPCs when Crusader weapons fires
This is a feature from the original that somehow I missed.  Finally
non-soldiers will properly surrender when you fire your weapon near them.
2021-07-31 12:56:24 +09:00
Matthew Duggan
0b7b312173 ULTIMA8: Fix Crusader check for moving Crusader camera on Z
A while back I updated the camera position to avatar center but forgot to
update this check for invalid locations.
2021-07-30 19:50:33 +09:00
Matthew Duggan
167310867f ULTIMA8: Fix Crusader robot control camera location
Previously we set the camera process to follow the robot, but it should snap to
the robot's location and then use the SnapProcess to update location in chunks.
2021-07-27 22:21:36 +09:00
Matthew Duggan
14288d8293 ULTIMA8: Improve trigger conditions for Crusader NPC attacks
There were some small differences from the original as to when attacks should
be triggered from Pace and Guard.  This should improve them to be more like
original.
2021-07-27 22:10:48 +09:00
Matthew Duggan
3410b5e776 ULTIMA8: Really fix keypad gump cheat code this time 2021-07-25 15:40:03 +09:00
Matthew Duggan
8377ac93d6 ULTIMA8: Explicitly set in-between pixels to black on doubled videos
Color 0 on the palette is not black in all versions of the game, so we need to
force the background color.  This is not a super-efficient way to do it, but it
works ok.
2021-07-25 15:40:03 +09:00