- added Edward-san's improvements for changemus command.

SVN r2902 (trunk)
This commit is contained in:
Christoph Oelckers 2010-10-05 22:35:59 +00:00
parent 5ff3b3f329
commit 0490c35347
5 changed files with 56 additions and 48 deletions

View file

@ -827,7 +827,7 @@ static FSoundChan *S_StartSound(AActor *actor, const sector_t *sec, const FPolyO
FVector3 pos, vel;
FRolloffInfo *rolloff;
if (sound_id <= 0 || volume <= 0 || nosfx)
if (sound_id <= 0 || volume <= 0 || nosfx || nosound )
return NULL;
int type;
@ -2582,38 +2582,41 @@ CCMD (idmus)
FString map;
int l;
if (argv.argc() > 1)
if (!nomusic)
{
if (gameinfo.flags & GI_MAPxx)
if (argv.argc() > 1)
{
l = atoi (argv[1]);
if (l <= 99)
if (gameinfo.flags & GI_MAPxx)
{
map = CalcMapName (0, l);
l = atoi (argv[1]);
if (l <= 99)
{
map = CalcMapName (0, l);
}
else
{
Printf ("%s\n", GStrings("STSTR_NOMUS"));
return;
}
}
else
{
map = CalcMapName (argv[1][0] - '0', argv[1][1] - '0');
}
if ( (info = FindLevelInfo (map)) )
{
if (info->Music.IsNotEmpty())
{
S_ChangeMusic (info->Music, info->musicorder);
Printf ("%s\n", GStrings("STSTR_MUS"));
}
}
else
{
Printf ("%s\n", GStrings("STSTR_NOMUS"));
return;
}
}
else
{
map = CalcMapName (argv[1][0] - '0', argv[1][1] - '0');
}
if ( (info = FindLevelInfo (map)) )
{
if (info->Music.IsNotEmpty())
{
S_ChangeMusic (info->Music, info->musicorder);
Printf ("%s\n", GStrings("STSTR_MUS"));
}
}
else
{
Printf ("%s\n", GStrings("STSTR_NOMUS"));
}
}
}
@ -2625,27 +2628,30 @@ CCMD (idmus)
CCMD (changemus)
{
if (argv.argc() > 1)
{
if (PlayList)
{
delete PlayList;
PlayList = NULL;
}
S_ChangeMusic (argv[1], argv.argc() > 2 ? atoi (argv[2]) : 0);
}
else
{
const char *currentmus = mus_playing.name.GetChars();
if(currentmus != NULL && *currentmus != 0)
{
Printf ("currently playing %s\n", currentmus);
}
else
{
Printf ("no music playing\n");
}
}
if (!nomusic)
{
if (argv.argc() > 1)
{
if (PlayList)
{
delete PlayList;
PlayList = NULL;
}
S_ChangeMusic (argv[1], argv.argc() > 2 ? atoi (argv[2]) : 0);
}
else
{
const char *currentmus = mus_playing.name.GetChars();
if(currentmus != NULL && *currentmus != 0)
{
Printf ("currently playing %s\n", currentmus);
}
else
{
Printf ("no music playing\n");
}
}
}
}
//==========================================================================

View file

@ -93,6 +93,6 @@ public:
bool m_Looping;
bool m_NotStartedYet; // Song has been created but not yet played
};
extern int nomusic;
#endif //__I_MUSIC_H__

View file

@ -593,6 +593,7 @@ protected:
void SetupForHMI(int len);
void SetupForHMP(int len);
void CheckCaps(int tech);
void DoInitialSetup();
void DoRestart();
bool CheckDone();
@ -749,6 +750,5 @@ MusInfo *GME_OpenSong(FILE *file, BYTE *musiccache, int len, const char *fmt);
// --------------------------------------------------------------------------
extern MusInfo *currSong;
extern int nomusic;
EXTERN_CVAR (Float, snd_musicvolume)

View file

@ -81,6 +81,7 @@ CVAR (String, snd_output, "default", CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CVAR (Bool, snd_pitched, false, CVAR_ARCHIVE)
SoundRenderer *GSnd;
bool nosound;
bool nosfx;
void I_CloseSound ();
@ -235,7 +236,7 @@ public:
void I_InitSound ()
{
/* Get command line options: */
bool nosound = !!Args->CheckParm ("-nosound");
nosound = !!Args->CheckParm ("-nosound");
nosfx = !!Args->CheckParm ("-nosfx");
if (nosound)

View file

@ -145,6 +145,7 @@ public:
extern SoundRenderer *GSnd;
extern bool nosfx;
extern bool nosound;
void I_InitSound ();
void I_ShutdownSound ();