This commit is contained in:
nukeykt 2019-09-19 22:38:28 +09:00 committed by Christoph Oelckers
parent 6c9e6a3bfc
commit bf07930b8c
5 changed files with 23 additions and 15 deletions

View file

@ -502,7 +502,11 @@ int32_t MV_GetFrequency(int32_t handle, int32_t *frequency)
if (voice == NULL || !frequency) if (voice == NULL || !frequency)
return MV_Error; return MV_Error;
if (voice->SamplingRate == 0)
voice->GetSound(voice);
*frequency = voice->SamplingRate; *frequency = voice->SamplingRate;
MV_EndService();
return MV_Ok; return MV_Ok;
} }

View file

@ -1860,6 +1860,8 @@ int app_main(int argc, char const* const* argv)
SetupInput(); SetupInput();
InitView(); InitView();
myloadconfig(); myloadconfig();
InitFX();
LoadFX();
setCDaudiovolume(gMusicVolume); setCDaudiovolume(gMusicVolume);
seq_LoadSequences(); seq_LoadSequences();
InitStatus(); InitStatus();
@ -1877,9 +1879,6 @@ int app_main(int argc, char const* const* argv)
ResetEngine(); ResetEngine();
EraseScreen(overscanindex); EraseScreen(overscanindex);
InitFX();
LoadFX();
ResetView(); ResetView();
GrabPalette(); GrabPalette();

View file

@ -191,6 +191,8 @@ int seq_ReadSequence(const char *seqName)
SeqBase[sequences + i] += frames; SeqBase[sequences + i] += frames;
} }
short vdi = frames;
int16_t nFrames; int16_t nFrames;
kread(hFile, &nFrames, sizeof(nFrames)); kread(hFile, &nFrames, sizeof(nFrames));
@ -269,10 +271,9 @@ int seq_ReadSequence(const char *seqName)
kread(hFile, &var_28, sizeof(var_28)); kread(hFile, &var_28, sizeof(var_28));
kread(hFile, &var_2C, sizeof(var_2C)); kread(hFile, &var_2C, sizeof(var_2C));
int hSound = 0; int hSound = LoadSound(&buffer[(var_2C&0x1FF)*10]);
// int hSound = LoadSound();
FrameSound[frames + var_28] = hSound | (var_2C & 0xFE00); FrameSound[vdi + var_28] = hSound | (var_2C & 0xFE00);
} }
} }

View file

@ -746,8 +746,8 @@ void UpdateSounds()
} }
else else
{ {
dx = sprite[nSoundSprite].x-pASound->f_1e; dx = x-sprite[nSoundSprite].x;
dy = sprite[nSoundSprite].y-pASound->f_22; dy = y-sprite[nSoundSprite].y;
} }
dx >>= 8; dx >>= 8;
@ -815,14 +815,17 @@ void UpdateSounds()
if (nCreaturesLeft > 0 && !(SectFlag[nPlayerViewSect[nLocalPlayer]]&0x2000)) if (nCreaturesLeft > 0 && !(SectFlag[nPlayerViewSect[nLocalPlayer]]&0x2000))
{ {
int vsi = seq_GetFrameSound(SeqOffsets[kSeqCreepy], totalmoves%SeqSize[SeqOffsets[kSeqCreepy]]); int vsi = seq_GetFrameSound(SeqOffsets[kSeqCreepy], totalmoves%SeqSize[SeqOffsets[kSeqCreepy]]);
int vdx = (totalmoves+32)&31; if (vsi >= 0 && (vsi&0x1ff) < kMaxSounds)
if (totalmoves & 1) {
vdx = -vdx; int vdx = (totalmoves+32)&31;
int vax = (totalmoves+32)&63; if (totalmoves & 1)
if (totalmoves & 2) vdx = -vdx;
vax = -vax; int vax = (totalmoves+32)&63;
if (totalmoves & 2)
vax = -vax;
PlayFXAtXYZ(vsi, pSprite->x+vdx, pSprite->y+vax, pSprite->z, pSprite->sectnum); PlayFXAtXYZ(vsi, pSprite->x+vdx, pSprite->y+vax, pSprite->z, pSprite->sectnum);
}
} }
nCreepyTimer = 450; nCreepyTimer = 450;
} }

View file

@ -103,6 +103,7 @@ int GetLocalSound();
void UpdateLocalSound(); void UpdateLocalSound();
void StopLocalSound(); void StopLocalSound();
void PlayLocalSound(short nSound, short val); void PlayLocalSound(short nSound, short val);
int LoadSound(const char* sound);
void BendAmbientSound(); void BendAmbientSound();
void CheckAmbience(short nSector); void CheckAmbience(short nSector);