- implemented World Tour's developer commentaries.

This commit is contained in:
Christoph Oelckers 2020-09-26 17:43:34 +02:00
parent 3a459ac603
commit b93a9b478a
10 changed files with 85 additions and 11 deletions

View file

@ -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);
}

View file

@ -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);
}
}

View file

@ -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);

View file

@ -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:

View file

@ -219,6 +219,7 @@ void GameInterface::DrawNativeMenuText(int fontnum, int state, double oxpos, dou
void GameInterface::MenuOpened()
{
StopCommentary();
if (ud.multimode < 2)
{
screenpeek = myconnectindex;

View file

@ -1070,6 +1070,7 @@ void exitlevel(MapRecord *nextlevel)
bool endofgame = nextlevel == nullptr;
STAT_Update(endofgame);
setpal(&ps[myconnectindex]);
StopCommentary();
dobonus(endofgame? -1 : 0, [=](bool)
{

View file

@ -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

View file

@ -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;

View file

@ -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)
{

View file

@ -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

1 default Identifier Remarks Filter eng enc ena enz eni ens enj enb enl ent enw cs de el eo es esm esn esg esc esa esd esv eso esr ess esf esl esy esz esb ese esh esi esu fi fr hu it jp ko nl pl pt ptg ro ru sr
693 Weapon Mode On Mighty Foot Engaged WEAPON MODE ON MIGHTY FOOT ENGAGED Waffenmodus: An Fusstritt aktiviert Modo arma ACTIVADO Patadón activado Asetila päällä Mahtava jalka otettu käyttöön Mode arme : oui Puissant coup de pied activé Modalità arma sì Piede potente in uso 武器モード オン マイティーフットを起動 Modo arma lig. Chute do poder ativado Режим оружия вкл Могучая нога активирована
694 Weapon Mode Off Weapon Mode On WEAPON MODE OFF WEAPON MODE ON Waffenmodus: Aus Waffenmodus: An Modo arma DESACTIVADO Modo arma ACTIVADO Asetila pois päältä Asetila päällä Mode arme : non Mode arme : oui Modalità arma no Modalità arma sì 武器モード オフ 武器モード オン Modo arma desl. Modo arma lig. Режим оружия откл Режим оружия вкл
695 Follow Mode Off Weapon Mode Off FOLLOW MODE OFF WEAPON MODE OFF Kartenverfolgungsmodus Aus Waffenmodus: Aus Modo de seguimiento de mapa DESACTIVADO Modo arma DESACTIVADO Seurantatila pois päältä Asetila pois päältä Mode suivi carte : non Mode arme : non Modalità mappa a scorrimento no Modalità arma no マップフォローモード オフ 武器モード オフ Modo seguir mapa desl. Modo arma desl. Режим слежения на карте откл Режим оружия откл
696 Follow Mode Off FOLLOW MODE OFF Kartenverfolgungsmodus Aus Modo de seguimiento de mapa DESACTIVADO Seurantatila pois päältä Mode suivi carte : non Modalità mappa a scorrimento no マップフォローモード オフ Modo seguir mapa desl. Режим слежения на карте откл
697 Follow Mode On FOLLOW MODE ON Kartenverfolgungsmodus An Modo seguimiento de mapa ACTIVADO Seurantatila päällä Mode suivi carte : oui Modalità mappa a scorrimento sì マップフォローモード オン Modo seguir mapa lig. Режим слежения на карте вкл
698 Run Mode Off RUN MODE OFF Laufmodus: Aus Modo Carrera DESACTIVADO Juoksutila pois päältä Mode course : non Modalità corsa no 走行モード オフ Modo correr desl. Режим бега откл
699 Run Mode On RUN MODE ON Laufmodus: An Modo Carrera ACTIVADO Juoksutila päällä Mode course : oui Modalità corsa sì 走行モード オン Modo correr lig. Режим бега вкл