mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
- implemented World Tour's developer commentaries.
This commit is contained in:
parent
3a459ac603
commit
b93a9b478a
10 changed files with 85 additions and 11 deletions
|
@ -1520,6 +1520,9 @@ void OpenALSoundRenderer::StopChannel(FISoundChannel *chan)
|
|||
if((i=SfxGroup.Find(source)) < SfxGroup.Size())
|
||||
SfxGroup.Delete(i);
|
||||
|
||||
if (!(chan->ChanFlags & CHANF_EVICTED))
|
||||
soundEngine->SoundDone(chan);
|
||||
|
||||
FreeSfx.Push(source);
|
||||
}
|
||||
|
||||
|
|
|
@ -1334,13 +1334,29 @@ void SoundEngine::ChannelEnded(FISoundChannel *ichan)
|
|||
}
|
||||
if (!evicted)
|
||||
{
|
||||
ReturnChannel(schan);
|
||||
schan->ChanFlags &= ~CHANF_EVICTED;
|
||||
}
|
||||
else
|
||||
{
|
||||
schan->ChanFlags |= CHANF_EVICTED;
|
||||
schan->SysChannel = NULL;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void SoundEngine::SoundDone(FISoundChannel* ichan)
|
||||
{
|
||||
FSoundChan* schan = static_cast<FSoundChan*>(ichan);
|
||||
if (schan != NULL)
|
||||
{
|
||||
ReturnChannel(schan);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -302,6 +302,10 @@ public:
|
|||
virtual void CacheSound(sfxinfo_t* sfx);
|
||||
void CacheSound(int sfx) { CacheSound(&S_sfx[sfx]); }
|
||||
void UnloadSound(sfxinfo_t* sfx);
|
||||
void UnloadSound(int sfx)
|
||||
{
|
||||
UnloadSound(&S_sfx[sfx]);
|
||||
}
|
||||
|
||||
void UpdateSounds(int time);
|
||||
|
||||
|
@ -409,6 +413,7 @@ public:
|
|||
// Allow this to be overridden for special needs.
|
||||
virtual float GetRolloff(const FRolloffInfo* rolloff, float distance);
|
||||
virtual void ChannelEnded(FISoundChannel* ichan); // allows the client to do bookkeeping on the sound.
|
||||
virtual void SoundDone(FISoundChannel* ichan); // gets called when the sound has been completely taken down.
|
||||
|
||||
// Lookup utilities.
|
||||
int FindSound(const char* logicalname);
|
||||
|
|
|
@ -38,7 +38,7 @@ source as it is released.
|
|||
#include "prediction.h"
|
||||
#include "names_d.h"
|
||||
|
||||
CVAR(Bool, dukewt_commentary, false, CVAR_ARCHIVE)
|
||||
EXTERN_CVAR(Bool, wt_commentary)
|
||||
|
||||
BEGIN_DUKE_NS
|
||||
|
||||
|
@ -60,7 +60,7 @@ void animatesprites_d(int x,int y,int a,int smoothratio)
|
|||
{
|
||||
case DEVELOPERCOMMENTARY:
|
||||
case DEVELOPERCOMMENTARY + 1:
|
||||
if(isWorldTour() && !dukewt_commentary)
|
||||
if(isWorldTour() && !wt_commentary)
|
||||
t->xrepeat = t->yrepeat = 0;
|
||||
break;
|
||||
case BLOODPOOL:
|
||||
|
|
|
@ -219,6 +219,7 @@ void GameInterface::DrawNativeMenuText(int fontnum, int state, double oxpos, dou
|
|||
|
||||
void GameInterface::MenuOpened()
|
||||
{
|
||||
StopCommentary();
|
||||
if (ud.multimode < 2)
|
||||
{
|
||||
screenpeek = myconnectindex;
|
||||
|
|
|
@ -1070,6 +1070,7 @@ void exitlevel(MapRecord *nextlevel)
|
|||
bool endofgame = nextlevel == nullptr;
|
||||
STAT_Update(endofgame);
|
||||
setpal(&ps[myconnectindex]);
|
||||
StopCommentary();
|
||||
|
||||
dobonus(endofgame? -1 : 0, [=](bool)
|
||||
{
|
||||
|
|
|
@ -46,9 +46,14 @@ source as it is released.
|
|||
|
||||
CVAR(Bool, wt_forcemidi, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) // quick hack to disable the oggs, which are of lower quality than playing the MIDIs with a good synth and sound font.
|
||||
CVAR(Bool, wt_forcevoc, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) // The same for sound effects. The re-recordings are rather poor and disliked
|
||||
CVAR(Bool, wt_commentary, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
|
||||
BEGIN_DUKE_NS
|
||||
|
||||
TArray<FString> specialmusic;
|
||||
static FSoundID currentCommentarySound;
|
||||
static int currentCommentarySprite;
|
||||
|
||||
|
||||
class DukeSoundEngine : public SoundEngine
|
||||
{
|
||||
|
@ -71,9 +76,23 @@ public:
|
|||
chan->Source = NULL;
|
||||
chan->SourceType = SOURCE_Unattached;
|
||||
}
|
||||
auto sndid = chan->SoundID;
|
||||
SoundEngine::StopChannel(chan);
|
||||
}
|
||||
|
||||
void SoundDone(FISoundChannel* ichan) override
|
||||
{
|
||||
FSoundChan* schan = static_cast<FSoundChan*>(ichan);
|
||||
|
||||
if (schan != NULL && schan->SoundID == currentCommentarySound)
|
||||
{
|
||||
UnloadSound(schan->SoundID);
|
||||
currentCommentarySound = 0;
|
||||
sprite[currentCommentarySprite].picnum--;
|
||||
}
|
||||
SoundEngine::SoundDone(schan);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
void S_InitSound()
|
||||
|
@ -735,7 +754,6 @@ void S_WorldTourMappingsForOldSounds()
|
|||
|
||||
static TArray<FString> Commentaries;
|
||||
|
||||
|
||||
void S_ParseDeveloperCommentary()
|
||||
{
|
||||
int lumpnum = fileSystem.FindFile("def/developer_commentary.def");
|
||||
|
@ -785,4 +803,37 @@ void S_ParseDeveloperCommentary()
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void StopCommentary()
|
||||
{
|
||||
if (currentCommentarySound > 0)
|
||||
{
|
||||
soundEngine->StopSound(SOURCE_None, nullptr, CHAN_VOICE, currentCommentarySound);
|
||||
}
|
||||
}
|
||||
|
||||
bool StartCommentary(int tag, int sprnum)
|
||||
{
|
||||
if (wt_commentary && Commentaries.Size() > tag && Commentaries[tag].IsNotEmpty())
|
||||
{
|
||||
FSoundID id = soundEngine->FindSound(Commentaries[tag]);
|
||||
if (id == 0)
|
||||
{
|
||||
int lump = fileSystem.FindFile(Commentaries[tag]);
|
||||
if (lump < 0)
|
||||
{
|
||||
Commentaries[tag] = "";
|
||||
return false;
|
||||
}
|
||||
id = FSoundID(soundEngine->AddSoundLump(Commentaries[tag], lump, 0));
|
||||
}
|
||||
StopCommentary();
|
||||
soundEngine->StartSound(SOURCE_None, nullptr, nullptr, CHAN_VOICE, CHANF_UI | CHANF_TRANSIENT | CHANF_OVERLAP, id, 1.f, 0.f);
|
||||
currentCommentarySound = id;
|
||||
currentCommentarySprite = sprnum;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
END_DUKE_NS
|
||||
|
|
|
@ -73,13 +73,8 @@ void S_ContinueLevelMusic(void);
|
|||
|
||||
void S_ParseDeveloperCommentary();
|
||||
|
||||
inline void StopCommentary()
|
||||
{}
|
||||
|
||||
inline bool StartCommentary(int tag, int sprnum)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
void StopCommentary();
|
||||
bool StartCommentary(int tag, int sprnum);
|
||||
|
||||
extern TArray<FString> specialmusic;
|
||||
|
||||
|
|
|
@ -1269,6 +1269,7 @@ OptionMenu SoundOptions //protected
|
|||
{
|
||||
Option "$SNDMNU_WTSOUND", "wt_forcevoc", "OnOff"
|
||||
Option "$SNDMNU_WTMUSIC", "wt_forcemidi", "OnOff"
|
||||
Option "$SNDMNU_WTCOOMENT", "wt_commentary", "OnOff"
|
||||
}
|
||||
ifgame(Duke, Nam, WW2GI, Redneck, RedneckRides, ShadowWarrior)
|
||||
{
|
||||
|
|
|
@ -693,6 +693,7 @@ Sound enabled,SNDMNU_SNDENABLED,,,,,Sound aktiv,,,,,Ääni päällä,,,,,,,,,,,,
|
|||
Music enabled,SNDMNU_MUSENABLED,,,,,Musik aktiv,,,,,Musiikki päällä,,,,,,,,,,,,
|
||||
CD Music Emulation,SNDMNU_CDEMU,,,,,CD-Musik-Emulation,,,,,CD-musiikin emulaatio,,,,,,,,,,Emulare CD muzică,,
|
||||
Play original Sounds,SNDMNU_WTSOUND,,,,,Original-Soundeffekte spielen,,,,,Toista alkuperäiset äänet,,,,,,,,,,Utilizare sunete originale,,
|
||||
Developer commentary,SNDMNU_WTCOMMENT,,,,,Entwicklerkommentar,,,Comentarios del desarrollador,,,Commentaire développeur,,Commentario sviluppatore,デベロッパーのコメンタリー,,,,Comentário de desenvolvedor,,,Комментарии разработчиков,
|
||||
Play original MIDI music,SNDMNU_WTMUSIC,,,,,Original-MIDI-Musik spielen,,,,,Toista alkuperäinen MIDI-musiikki,,,,,,,,,,Utilizare muzică MIDI originală,,
|
||||
Sound Ambience,SNDMNU_AMBIENCE,,,,,Umgebungsgeräusche,,,,,Taustaäänet,,,,,,,,,,Ambianță,,
|
||||
"Player Speech
|
||||
|
|
|
Loading…
Reference in a new issue