Page 1 of 1

Checking for MusicEnabled

Posted: Thu Dec 14, 2023 8:57 am
by Marrub
This function exists in music.cpp:

Code: Select all

int MusicEnabled() // int return is for scripting
Strange comment, as it's never been available for scripting, and I have no clue why scripting would require an int return. It's the only thing that ever queries the `-nomusic` flag, and it combines that with checking `mus_enabled`, which can already be checked. The function itself, hopefully returning a boolean and not an integer, would be useful in ZScript. Additionally, I've sighted a couple of times `mus_enabled` is directly checked instead of `MusicEnabled`, which appears to be erroneous.

Code: Select all

	// Just record it if volume is 0 or music was disabled
	if (snd_musicvolume <= 0 || !mus_enabled)

Code: Select all

	if (!mus_playing.LastSong.IsEmpty() && mus_enabled)

Re: Checking for MusicEnabled

Posted: Thu Dec 14, 2023 12:27 pm
by Graf Zahl

Code: Select all

struct System native
{
	native static void StopMusic();
	native static void StopAllSounds();
	native static bool SoundEnabled();
	native static bool MusicEnabled();

{snip}
As you can see it's already in.

Re: Checking for MusicEnabled

Posted: Thu Dec 14, 2023 3:00 pm
by Marrub
Graf Zahl wrote: Thu Dec 14, 2023 12:27 pm

Code: Select all

struct System native
{
	native static void StopMusic();
	native static void StopAllSounds();
	native static bool SoundEnabled();
	native static bool MusicEnabled();

{snip}
As you can see it's already in.
What the fuck? Text search fails me... Oh well, thank you.