Commit Graph
25 Commits
Author SHA1 Message Date
Evgeny Grechnikov af580eaa85 LASTEXPRESS: save/load sound state
Warning: breaks compatibility with previous savefiles.
They were mostly broken anyway, locking any NPC who
waited for kActionEndSound when savefile was created.
2018-10-20 16:35:23 +03:00
Evgeny Grechnikov 9f7ae73a7b LASTEXPRESS: loud train noise when NPC exits car
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.
2018-10-20 00:32:10 +03:00
Evgeny Grechnikov 06b7bb47ba LASTEXPRESS: case-insensitive lookup in sound queue 2018-10-19 23:37:35 +03:00
Evgeny Grechnikov 54562554f9 LASTEXPRESS: better names in sound code
Refactoring, no changes in behaviour.
2018-10-18 00:38:01 +03:00
Evgeny Grechnikov d561fd8a83 LASTEXPRESS: dynamic adjusting of sound volume
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.
2018-10-16 23:57:25 +03:00
Evgeny Grechnikov 29f6ce1d9a LASTEXPRESS: support for delay-activated sounds
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".
2018-10-16 23:01:26 +03:00
Evgeny Grechnikov 43fb9ebb1b LASTEXPRESS: drop sound thread
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.
2018-10-16 01:03:55 +03:00
Evgeny Grechnikov 53cd6616c9 LASTEXPRESS: refactor sound flags
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.
2018-10-14 20:08:32 +03:00
Evgeny Grechnikov f771fa40ad LASTEXPRESS: multiple fixes in NPC logic
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.
2018-08-26 12:09:43 +02:00
Johannes Schickel 3d4f409572 LASTEXPRESS: Make GPL headers consistent in themselves. 2014-02-18 02:39:35 +01:00
Littleboy cd5e750a7f LASTEXPRESS: Fix analysis warnings 2012-08-27 21:49:33 -04:00
Littleboy 7f05e1413c LASTEXPRESS: Remove use of skip from savegame functions when loading
We cannot accurately skip over compressed data as it is not know before decoding how much data will be used
2012-08-01 02:58:55 -04:00
Littleboy 6aeda2638b LASTEXPRESS: More include re-organization 2012-07-27 00:54:24 -04:00
Littleboy 9e64e62c08 LASTEXPRESS: Comment unused variable 2012-07-16 23:51:24 -04:00
Littleboy 0635d99ec7 LASTEXPRESS: Cleanup
- Add missing initializer/destructors
 - Add some const modifiers
 - Remove some unneeded casts
 - Use enumeration values in switch constructs
2012-07-14 14:26:00 -04:00
Littleboy 732a2c80dd LASTEXPRESS: Remove duplicated include statements 2012-07-14 13:23:54 -04:00
Littleboy bc298a58f5 LASTEXPRESS: Simplify SoundQueue::updateQueue()
- Remove useless cache code
 - Use helper function to get the proper sound entry
 - Fix crash on using an invalid entry
2011-07-08 22:03:34 -04:00
Eugene Sandulenko c4b2800145 LASTEXPRESS: implement Sound::updateQueue() and all dependent functions 2011-07-06 14:40:22 +03:00
Littleboy 47e9a6ccdc LASTEXPRESS: Move sound filtering to base Sound class
- Rename kSoundStatusRemoved to kSoundStatusClosed
 - Rename kSoundStatusClear2 to kSoundStatusCached
 - Remove sound cache handling
2011-07-04 14:26:31 -04:00
Littleboy 3385fd37b9 LASTEXPRESS: Hook up preliminary sound filtering
- Add debug checks in soundFilter()
 - Rename kSoundStatusClear1 to kSoundStatusFilterVariant
2011-06-29 12:06:33 -04:00
Littleboy 2788cb8bf7 LASTEXPRESS: Update sound timer and sound entry playing
- Move filtering to SoundEntry class
 - Make some methods of SoundEntry class private
 - Add methods to check if a StreamedSound/AppendableSound is done playing
2011-06-29 11:07:28 -04:00
Littleboy 9cc5d404c7 LASTEXPRESS: Replace shared sound buffer by per-entry buffer 2011-06-29 11:07:24 -04:00
Littleboy 04933a1937 LASTEXPRESS: Make SoundEntry members private 2011-06-28 23:17:13 -04:00
Littleboy b4ac4988cc LASTEXPRESS: Cleanup comments 2011-06-28 22:54:51 -04:00
Littleboy 6eace0ca75 LASTEXPRESS: Move sound queue related functions to a separate class
- Implement missing queue reset function
 - Cleanup SoundManager::playLoopingSound()
2011-06-28 22:13:40 -04:00