- removed a few obsolete definitions from basictypes.h

This commit is contained in:
Christoph Oelckers 2019-06-26 22:13:12 +02:00
parent e93de62f98
commit 1081338af2
5 changed files with 19 additions and 57 deletions

View file

@ -17,19 +17,6 @@ typedef struct _GUID
} GUID;
#endif
union QWORD_UNION
{
uint64_t AsOne;
struct
{
#ifdef __BIG_ENDIAN__
unsigned int Hi, Lo;
#else
unsigned int Lo, Hi;
#endif
};
};
//
// fixed point, 32bit as 16.16.
//
@ -41,9 +28,6 @@ typedef int32_t fixed_t;
#define FIXED_MAX (signed)(0x7fffffff)
#define FIXED_MIN (signed)(0x80000000)
#define DWORD_MIN ((uint32_t)0)
#define DWORD_MAX ((uint32_t)0xffffffff)
// the last remnants of tables.h
#define ANGLE_90 (0x40000000)
#define ANGLE_180 (0x80000000)

View file

@ -2084,7 +2084,7 @@ void S_EvictAllChannels()
{
if (!(chan->ChanFlags & CHAN_ABSTIME))
{
chan->StartTime.AsOne = GSnd ? GSnd->GetPosition(chan) : 0;
chan->StartTime = GSnd ? GSnd->GetPosition(chan) : 0;
chan->ChanFlags |= CHAN_ABSTIME;
}
S_StopChannel(chan);
@ -2414,7 +2414,7 @@ static FSerializer &Serialize(FSerializer &arc, const char *key, FSoundChan &cha
("entchannel", chan.EntChannel)
("priority", chan.Priority)
("nearlimit", chan.NearLimit)
("starttime", chan.StartTime.AsOne)
("starttime", chan.StartTime)
("rolloftype", chan.Rolloff.RolloffType)
("rolloffmin", chan.Rolloff.MinDistance)
("rolloffmax", chan.Rolloff.MaxDistance)
@ -2468,10 +2468,10 @@ void S_SerializeSounds(FSerializer &arc)
for (unsigned int i = chans.Size(); i-- != 0; )
{
// Replace start time with sample position.
uint64_t start = chans[i]->StartTime.AsOne;
chans[i]->StartTime.AsOne = GSnd ? GSnd->GetPosition(chans[i]) : 0;
uint64_t start = chans[i]->StartTime;
chans[i]->StartTime = GSnd ? GSnd->GetPosition(chans[i]) : 0;
arc(nullptr, *chans[i]);
chans[i]->StartTime.AsOne = start;
chans[i]->StartTime = start;
}
arc.EndArray();
}

View file

@ -101,7 +101,7 @@ struct SoundHandle
struct FISoundChannel
{
void *SysChannel; // Channel information from the system interface.
QWORD_UNION StartTime; // Sound start time in DSP clocks.
uint64_t StartTime; // Sound start time in DSP clocks.
// The sound interface doesn't use these directly but it needs to pass them to a
// callback that can't be passed a sound channel pointer

View file

@ -1602,17 +1602,17 @@ FISoundChannel *OpenALSoundRenderer::StartSound(SoundHandle sfx, float vol, int
else
alSourcef(source, AL_PITCH, PITCH(pitch));
if(!reuse_chan || reuse_chan->StartTime.AsOne == 0)
if(!reuse_chan || reuse_chan->StartTime == 0)
alSourcef(source, AL_SEC_OFFSET, 0.f);
else
{
if((chanflags&SNDF_ABSTIME))
alSourcei(source, AL_SAMPLE_OFFSET, reuse_chan->StartTime.Lo);
alSourcei(source, AL_SAMPLE_OFFSET, ALint(reuse_chan->StartTime));
else
{
float offset = std::chrono::duration_cast<std::chrono::duration<float>>(
std::chrono::steady_clock::now().time_since_epoch() -
std::chrono::steady_clock::time_point::duration(reuse_chan->StartTime.AsOne)
std::chrono::steady_clock::time_point::duration(reuse_chan->StartTime)
).count();
if(offset > 0.f) alSourcef(source, AL_SEC_OFFSET, offset);
}
@ -1813,17 +1813,17 @@ FISoundChannel *OpenALSoundRenderer::StartSound3D(SoundHandle sfx, SoundListener
else
alSourcef(source, AL_PITCH, PITCH(pitch));
if(!reuse_chan || reuse_chan->StartTime.AsOne == 0)
if(!reuse_chan || reuse_chan->StartTime == 0)
alSourcef(source, AL_SEC_OFFSET, 0.f);
else
{
if((chanflags&SNDF_ABSTIME))
alSourcei(source, AL_SAMPLE_OFFSET, reuse_chan->StartTime.Lo);
alSourcei(source, AL_SAMPLE_OFFSET, ALint(reuse_chan->StartTime));
else
{
float offset = std::chrono::duration_cast<std::chrono::duration<float>>(
std::chrono::steady_clock::now().time_since_epoch() -
std::chrono::steady_clock::time_point::duration(reuse_chan->StartTime.AsOne)
std::chrono::steady_clock::time_point::duration(reuse_chan->StartTime)
).count();
if(offset > 0.f) alSourcef(source, AL_SEC_OFFSET, offset);
}
@ -2220,7 +2220,7 @@ void OpenALSoundRenderer::MarkStartTime(FISoundChannel *chan)
{
// FIXME: Get current time (preferably from the audio clock, but the system
// time will have to do)
chan->StartTime.AsOne = std::chrono::steady_clock::now().time_since_epoch().count();
chan->StartTime = std::chrono::steady_clock::now().time_since_epoch().count();
}
float OpenALSoundRenderer::GetAudibility(FISoundChannel *chan)

View file

@ -101,36 +101,14 @@ bool UseKnownFolders()
bool GetKnownFolder(int shell_folder, REFKNOWNFOLDERID known_folder, bool create, FString &path)
{
// SHGetKnownFolderPath knows about more folders than SHGetFolderPath, but is
// new to Vista, hence the reason we support both.
if (!SHGetKnownFolderPath)
PWSTR wpath;
if (FAILED(SHGetKnownFolderPath(known_folder, create ? KF_FLAG_CREATE : 0, NULL, &wpath)))
{
if (shell_folder < 0)
{ // Not supported by SHGetFolderPath
return false;
}
if (create)
{
shell_folder |= CSIDL_FLAG_CREATE;
}
if (FAILED(SHGetFolderPathW(NULL, shell_folder, NULL, 0, pathstr)))
{
return false;
}
path = pathstr;
return true;
}
else
{
PWSTR wpath;
if (FAILED(SHGetKnownFolderPath(known_folder, create ? KF_FLAG_CREATE : 0, NULL, &wpath)))
{
return false;
}
path = wpath;
CoTaskMemFree(wpath);
return true;
return false;
}
path = wpath;
CoTaskMemFree(wpath);
return true;
}
//===========================================================================