Checking for MusicEnabled

Moderator: GZDoom Developers

User avatar
Marrub
 
 
Posts: 1198
Joined: Tue Feb 26, 2013 2:48 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Arch Linux
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Checking for MusicEnabled

Post 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)
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49141
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Checking for MusicEnabled

Post 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.
User avatar
Marrub
 
 
Posts: 1198
Joined: Tue Feb 26, 2013 2:48 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Arch Linux
Graphics Processor: ATI/AMD with Vulkan/Metal Support

Re: Checking for MusicEnabled

Post 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.

Return to “Closed Feature Suggestions [GZDoom]”