This reverts commit 3128c0be2f.
The md5s are for full files, it was never tested or even compiled,
as it is obvious from the PR#1333. There are different reasons why the
version was not detected, this will be fixed separately.
For each engine:
- Make a new folder detection
- Move detection-related files inside the folder
- Add a new module "enginename/detection"
- Add DETECT_OBJS here
- Adjust the normal engine module to remove detect_objs
- Adjust every file for the new changes.
Warning: breaks compatibility with previous savefiles.
They were mostly broken anyway, locking any NPC who
waited for kActionEndSound when savefile was created.
If Cath stands near the beginning or the end of a car,
looks at a door, and a NPC opens this door,
the volume of train noise is temporarily raised.
Controlled by variables SoundManager::_data{0,1,2},
renamed to be not so mysterious.
Now it works just like in the original game,
including fading where it is applicable
(e.g. in a passengers list if closing the list while a sound is playing).
By the way, p2s sequence is known as http://oeis.org/A000265 ,
p1s is 4 - A007814, and p2s[i]/2**p1s[i] is just i/16.
It is time to get rid of these arrays.
Not very obvious, but noticeable e.g. when knocking on harem doors.
I suppose this is the problem that wiki describes
as "improper triggering of actions on sound end".
The SoundFlag type is an enumeration which have a default underlying
type of unsigned int in most case.
Thus comparing this to -1 causes a compiler warning. Since the default
entity sound flag type is 0xFFFF... which is equivalent to -1, then
replacing this with the correct enum symbol fixes the issue and should
result in the correct behaviour. Examination of the resulting code line
seems to confirm that this is the correct expected logic.
The backend runs its own sound thread anyway,
with the corresponding bookkeeping that we use.
We don't need yet another sound thread,
and it is always nice to not have something
that could change our structures from underneath us.
SoundEntry::play() calls StreamedSound::setFilterId(),
StreamSound::setFilterId() requires the underlying reference to be alive.
SoundQueue::handleTimer() checks that the stream is still alive
by calling SoundEntry::isFinished(). However, if the stream is finalized
just between calls to SoundEntry::isFinished() and SoundEntry::play(),
the sound mixer frees the stream leading to use-after-free in setFilterId().
Turn off the automatical disposing, delete the stream in SoundEntry::~SoundEntry().
Merge SoundFlag and SoundStatus into a single enum;
SoundEntry::setupStatus just casts one to another.
Keep only definitions of bits in SoundFlag; drop compound flags
like kFlagSteam = kSoundTypeAmbient | kSoundFlagLooped | kVolume7,
use ORed simple flags in calls; change the signature
of SoundManager::playSoundWithSubtitles to use uint32
instead of SoundFlag to avoid excess casting.
Add meaningful names to flags; add some comments.
Get rid of endian-unsafe SoundStatusUnion.
Fixes an issue with big-endian hosts.
No changes in behaviour on little-endian hosts.
Wrong enum member used: (status & 0x7000000)
should be checked against 0x3000000, not against 3
(this is a check of sound type to skip menu sounds in savefiles).
Activate delay should not be compared with sound volume;
comparison with 0x8000000 is just a sanity check against overflow.
This was previously comparing the Object Model to the Object Enum.
This has been corrected, but should have no functional change as the
underlying enum value of 1 is identical for both symbols.
engines/lastexpress/entities/alexei.cpp: In member function ‘void LastExpress::Alexei::standingAtWindow(const LastExpress::SavePoint&)’:
engines/lastexpress/entities/alexei.cpp:772:49: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C++ engines/lastexpress/entities/chapters.o
engines/lastexpress/entities/august.cpp: In member function ‘void LastExpress::August::function21(const LastExpress::SavePoint&)’:
engines/lastexpress/entities/august.cpp:672:4: warning: this statement may fall through [-Wimplicit-fallthrough=]
switch(params->param5) {
^~~~~~
engines/lastexpress/entities/august.cpp:694:3: note: here
case 9:
^~~~
Checked the logic against the original game
(to be precise, DOS English version from GOG, although I think
AI logic has no significant differences with other versions).
Fixed a *lot* of errors with varying visibility for the user.
Also, save+exit+load sometimes resulted in memory corruption like
((EntityParametersSSII*)(new EntityParametersIIII))->param8 = 0;
load operation did not restore the correct type of NPC logic context,
the default one was used (which also has the smallest sizeof).
Should be fixed now. Save+load is still unusable because it locks
everybody waiting for kActionEndSound (the sound state is not restored),
but, at least, it should not corrupt the memory. Hopefully.
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.