- Fixed: The new rolloff values being stored in FSoundChan need to be serialized

for savegames.


SVN r1209 (trunk)
This commit is contained in:
Christoph Oelckers 2008-09-09 21:23:09 +00:00
parent e033cbf9f8
commit d02097976e
5 changed files with 20 additions and 15 deletions

View file

@ -1,4 +1,6 @@
September 9, 2008 (Changes by Graf Zahl) September 9, 2008 (Changes by Graf Zahl)
- Fixed: The new rolloff values being stored in FSoundChan need to be serialized
for savegames.
- Since loading of the sound lump is now done in S_LoadSound I added an IsNull - Since loading of the sound lump is now done in S_LoadSound I added an IsNull
method to the SoundRenderer class so that this function doesn't need to method to the SoundRenderer class so that this function doesn't need to
load the sound for the NullSoundRenderer. load the sound for the NullSoundRenderer.

View file

@ -1100,7 +1100,7 @@ void S_RestartSound(FSoundChan *chan)
SoundListener listener; SoundListener listener;
S_SetListener(listener, players[consoleplayer].camera); S_SetListener(listener, players[consoleplayer].camera);
ochan = GSnd->StartSound3D(sfx->data, &listener, chan->Volume, chan->Rolloff, chan->DistanceScale, chan->Pitch, ochan = GSnd->StartSound3D(sfx->data, &listener, chan->Volume, &chan->Rolloff, chan->DistanceScale, chan->Pitch,
chan->Priority, pos, vel, chan->EntChannel, chan->ChanFlags, chan); chan->Priority, pos, vel, chan->EntChannel, chan->ChanFlags, chan);
} }
else else
@ -1793,16 +1793,19 @@ static FArchive &operator<<(FArchive &arc, FSoundChan &chan)
case SOURCE_Unattached: arc << chan.Point[0] << chan.Point[1] << chan.Point[2]; break; case SOURCE_Unattached: arc << chan.Point[0] << chan.Point[1] << chan.Point[2]; break;
default: I_Error("Unknown sound source type %d\n", chan.SourceType); break; default: I_Error("Unknown sound source type %d\n", chan.SourceType); break;
} }
arc << chan.SoundID; arc << chan.SoundID
arc << chan.OrgID; << chan.OrgID
arc << chan.Volume; << chan.Volume
arc << chan.DistanceScale; << chan.DistanceScale
arc << chan.Pitch; << chan.Pitch
arc << chan.ChanFlags; << chan.ChanFlags
arc << chan.EntChannel; << chan.EntChannel
arc << chan.Priority; << chan.Priority
arc << chan.NearLimit; << chan.NearLimit
arc << chan.StartTime; << chan.StartTime
<< chan.Rolloff.RolloffType
<< chan.Rolloff.MinDistance
<< chan.Rolloff.MaxDistance;
if (arc.IsLoading()) if (arc.IsLoading())
{ {

View file

@ -185,7 +185,7 @@ struct FSoundChan
FSoundChan *NextChan; // Next channel in this list. FSoundChan *NextChan; // Next channel in this list.
FSoundChan **PrevChan; // Previous channel in this list. FSoundChan **PrevChan; // Previous channel in this list.
sfxinfo_t *SfxInfo; // Sound information. sfxinfo_t *SfxInfo; // Sound information.
FRolloffInfo *Rolloff; // Rolloff parameters (do not necessarily come from SfxInfo!) FRolloffInfo Rolloff; // Rolloff parameters (do not necessarily come from SfxInfo!)
QWORD_UNION StartTime; // Sound start time in DSP clocks. QWORD_UNION StartTime; // Sound start time in DSP clocks.
FSoundID SoundID; // Sound ID of playing sound. FSoundID SoundID; // Sound ID of playing sound.
FSoundID OrgID; // Sound ID of sound used to start this channel. FSoundID OrgID; // Sound ID of sound used to start this channel.

View file

@ -1463,7 +1463,7 @@ FSoundChan *FMODSoundRenderer::StartSound3D(SoundHandle sfx, SoundListener *list
HandleChannelDelay(chan, reuse_chan, freq); HandleChannelDelay(chan, reuse_chan, freq);
chan->setPaused(false); chan->setPaused(false);
FSoundChan *schan = CommonChannelSetup(chan, reuse_chan); FSoundChan *schan = CommonChannelSetup(chan, reuse_chan);
schan->Rolloff = rolloff; schan->Rolloff = *rolloff;
return schan; return schan;
} }
@ -2091,7 +2091,7 @@ float F_CALLBACK FMODSoundRenderer::RolloffCallback(FMOD_CHANNEL *channel, float
} }
else if (chan->getUserData((void **)&schan) == FMOD_OK && schan != NULL) else if (chan->getUserData((void **)&schan) == FMOD_OK && schan != NULL)
{ {
rolloff = schan->Rolloff; rolloff = &schan->Rolloff;
distance *= schan->DistanceScale; distance *= schan->DistanceScale;
} }
else else

View file

@ -75,7 +75,7 @@
// SAVESIG should match SAVEVER. // SAVESIG should match SAVEVER.
// MINSAVEVER is the minimum level snapshot version that can be loaded. // MINSAVEVER is the minimum level snapshot version that can be loaded.
#define MINSAVEVER 1190 #define MINSAVEVER 1209
#if SVN_REVISION_NUMBER < MINSAVEVER #if SVN_REVISION_NUMBER < MINSAVEVER
// Never write a savegame with a version lower than what we need // Never write a savegame with a version lower than what we need