mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-12 03:00:38 +00:00
- a few sounds play, but it's still very buggy.
This commit is contained in:
parent
38dc39b8cd
commit
4f9eda189a
4 changed files with 11 additions and 4 deletions
|
@ -473,6 +473,7 @@ int RunGame()
|
||||||
GStrings.LoadStrings();
|
GStrings.LoadStrings();
|
||||||
V_InitFonts();
|
V_InitFonts();
|
||||||
C_CON_SetAliases();
|
C_CON_SetAliases();
|
||||||
|
sfx_empty = fileSystem.FindFile("demolition/dsempty.lmp"); // this must be done outside the sound code because it's initialized late.
|
||||||
Mus_Init();
|
Mus_Init();
|
||||||
InitStatistics();
|
InitStatistics();
|
||||||
M_Init();
|
M_Init();
|
||||||
|
|
|
@ -804,7 +804,7 @@ void SoundEngine::LoadSound3D(sfxinfo_t *sfx, FSoundLoadBuffer *pBuffer)
|
||||||
{
|
{
|
||||||
snd = GSnd->LoadSoundBuffered(pBuffer, true);
|
snd = GSnd->LoadSoundBuffered(pBuffer, true);
|
||||||
}
|
}
|
||||||
else
|
else if (sfx->lumpnum >= 0)
|
||||||
{
|
{
|
||||||
auto sfxdata = ReadSound(sfx->lumpnum);
|
auto sfxdata = ReadSound(sfx->lumpnum);
|
||||||
int size = sfxdata.Size();
|
int size = sfxdata.Size();
|
||||||
|
|
|
@ -101,7 +101,7 @@ void cacheAllSounds(void)
|
||||||
|
|
||||||
static inline int S_GetPitch(int num)
|
static inline int S_GetPitch(int num)
|
||||||
{
|
{
|
||||||
auto const* snd = (sound_t*)soundEngine->GetUserData(num);
|
auto const* snd = (sound_t*)soundEngine->GetUserData(num+1);
|
||||||
int const range = abs(snd->pitchEnd - snd->pitchStart);
|
int const range = abs(snd->pitchEnd - snd->pitchStart);
|
||||||
|
|
||||||
return (range == 0) ? snd->pitchStart : min(snd->pitchStart, snd->pitchEnd) + rand() % range;
|
return (range == 0) ? snd->pitchStart : min(snd->pitchStart, snd->pitchEnd) + rand() % range;
|
||||||
|
@ -154,6 +154,7 @@ int S_DefineSound(unsigned index, const char *filename, int minpitch, int maxpit
|
||||||
sndinf->volAdjust = clamp(distance, INT16_MIN, INT16_MAX);
|
sndinf->volAdjust = clamp(distance, INT16_MIN, INT16_MAX);
|
||||||
sfx->Volume = volume;
|
sfx->Volume = volume;
|
||||||
sfx->NearLimit = 4;
|
sfx->NearLimit = 4;
|
||||||
|
sfx->bTentative = false;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,8 +228,12 @@ boost:
|
||||||
// Now calculate the virtual position in sound system coordinates.
|
// Now calculate the virtual position in sound system coordinates.
|
||||||
FVector3 sndvec = { float(pos->x - cam->x), (pos->z - cam->z) / 16.f, float(pos->y - cam->y) }; // distance vector. Note that the z-coordinate has different precision.
|
FVector3 sndvec = { float(pos->x - cam->x), (pos->z - cam->z) / 16.f, float(pos->y - cam->y) }; // distance vector. Note that the z-coordinate has different precision.
|
||||||
FVector3 campos = { float(pos->x), (cam->z) / 16.f, float(cam->y) }; // camera position
|
FVector3 campos = { float(pos->x), (cam->z) / 16.f, float(cam->y) }; // camera position
|
||||||
sndvec *= float(sndist) / orgsndist; // adjust by what was calculated above;
|
if (orgsndist > 0)
|
||||||
*sndPos = campos + sndvec; // final sound pos - still in Build fixed point coordinates.
|
{
|
||||||
|
sndvec *= float(sndist) / orgsndist; // adjust by what was calculated above;
|
||||||
|
*sndPos = campos + sndvec; // final sound pos - still in Build fixed point coordinates.
|
||||||
|
}
|
||||||
|
else *sndPos = campos;
|
||||||
*sndPos *= (1.f / 16); sndPos->Z = -sndPos->Z; // The sound engine works with Doom's coordinate system so do the necessary conversions
|
*sndPos *= (1.f / 16); sndPos->Z = -sndPos->Z; // The sound engine works with Doom's coordinate system so do the necessary conversions
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -368,6 +373,7 @@ void S_Update(void)
|
||||||
}
|
}
|
||||||
listener.ListenerObject = ud.camerasprite == -1 ? nullptr : &sprite[ud.camerasprite];
|
listener.ListenerObject = ud.camerasprite == -1 ? nullptr : &sprite[ud.camerasprite];
|
||||||
soundEngine->SetListener(listener);
|
soundEngine->SetListener(listener);
|
||||||
|
soundEngine->UpdateSounds((int)totalclock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
BIN
wadsrc/static/demolition/dsempty.lmp
Normal file
BIN
wadsrc/static/demolition/dsempty.lmp
Normal file
Binary file not shown.
Loading…
Reference in a new issue