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.
Clang 11 and newer check the types of return values more strictly and
generate an error if there is a discrepancy.
However the "bool loadGame()" function, returns the value "NULL", if
loading of a savegame was unsucessful, whereas Clang expects a return
value of type "bool".
Remedy the issue by using "false" as return value instead of "NULL".
I experienced weird string modifications while trying to improve the text code. Turns out that this workaround will kick in even for 0 length strings and will lead to values being written to "negative" (before the original dst ptr argument) offsets.
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.
Some AGS games (f.e. 5 Days A Stranger) use sustain controller events in their
MIDI data. When stopping playback in the middle of a track, sustained notes
will hang unless sustain is turned off. This commit fixes this issue by turning
on the "send sustain off on notes off" option of the MIDI parser. This fixes
issue #12905.
It seems the older version of AGSFlashlight didn't persist
it's fields in the savegame like the latest version does.
I decided against trying to explicitly figure out which
version of AGSFlashlight different games used, and instead
simply have fallback handling if the savegame doesn't
have the data.
The only minor disadvantage is that this means that whilst
savegames are portable from standalone AGS to ScummVM for
the game, it won't in the other direction. But I don't
think that's too major an issue, since it's only for the
few games that do use the old AGSFlashlight
In order to specify that they should be treated as signed
Some ports may treat an (unspecified) "char" as unsigned by default. Android does this for its ARM architectures and while we did fix this by enforcing -fsigned-char to its compiler, the issue may come up for other ports. Also it should be better to clarify in the engine when a variable is not actually storing string characters.
I've spotted and changed the most "safe" cases I could find for this. As far as I can tell, out of these, only the Outline field and fontoutline array could potentially be assigned valid negative values which would cause bugs for ports treating chars as unsigned.
The old RNG method had non-standard periods, ranging from some seeds looping on themselves (seed = 1184201285) to some seeds having periods as low as 11 or 48, as listed in https://github.com/scummvm/scummvm/pull/3340. This is a problem even for games that run the RNG once a frame, as the possibilities for random events is greatly reduced should the initial seed be in one of these sets of small periods.
Xorshift* is a standard, fast, non-cryptographic PRNG with academic backing that has period 2^32-1 (all seeds lead to another seed except 0, which is excluded from the initial seeds). Many different flavors are possible, as listed in the paper, but the choice implemented in this pull request uses only a single 32-bit integer as a state, like the old PRNG.
Co-authored-by: Thierry Crozat <criezy@scummvm.org>
Co-authored-by: Filippos Karapetis <bluegr@gmail.com>
Previously the file format had all chunks, offsets and values stored in
little-endian format. The one exception was screenshots, which used the
existing THMB code in graphics/thumbnail.cpp, that is entirely
big-endian. Any tooling which attempts to parse the Event Recorder file
format must make a special exception for THMB chunks, and read the chunk
size and contents as big-endian.
In the interests of making the file format more consistant
to parse, and given that backwards compatibility is not required for
this iteration of Event Recorder, this patch changes everything to
big-endian.
This new mode is functionally identical to playback mode, however
a new recording file is used to track the actual output of ScummVM.
This feature can be used to update a suite of existing recordings after
a renderer or a timing change.
Screen update boundaries are now used as sync points.
Screenshots are now processed on a screen update boundary.
This change increments the version of the Event Recorder
file format to 2; version 1 files will still play back as
before, without synchronising to screen updates.
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.
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.
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).
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.