From 43eaa036549522a3039e822e58a7de2601489b37 Mon Sep 17 00:00:00 2001
From: Major Cooke <majorcooke22@gmail.com>
Date: Wed, 27 Feb 2019 12:53:30 -0600
Subject: [PATCH] Exported MusPlayingInfo to ZScript.

- Allows grabbing the currently playing song, base order, and loop properties.

# Conflicts:
#	wadsrc/static/zscript/base.zs

# Conflicts:
#	wadsrc/static/zscript/base.zs
---
 src/s_sound.cpp               | 5 +++++
 wadsrc/static/zscript/base.zs | 8 ++++++++
 2 files changed, 13 insertions(+)

diff --git a/src/s_sound.cpp b/src/s_sound.cpp
index 2df0f6a96..42692dab0 100644
--- a/src/s_sound.cpp
+++ b/src/s_sound.cpp
@@ -148,6 +148,11 @@ static FString	 LastSong;			// last music that was played
 static FPlayList *PlayList;
 static int		RestartEvictionsAt;	// do not restart evicted channels before this level.time
 
+DEFINE_GLOBAL(mus_playing);
+DEFINE_FIELD_X(MusPlayingInfo, MusPlayingInfo, name);
+DEFINE_FIELD_X(MusPlayingInfo, MusPlayingInfo, baseorder);
+DEFINE_FIELD_X(MusPlayingInfo, MusPlayingInfo, loop);
+
 // PUBLIC DATA DEFINITIONS -------------------------------------------------
 
 int sfx_empty;
diff --git a/wadsrc/static/zscript/base.zs b/wadsrc/static/zscript/base.zs
index 30ebf0fb7..e17f3cd94 100644
--- a/wadsrc/static/zscript/base.zs
+++ b/wadsrc/static/zscript/base.zs
@@ -45,9 +45,17 @@ struct _ native	// These are the global variables, the struct is only here to av
 	native readonly Weapon WP_NOCHANGE;
 	native int LocalViewPitch;
 	deprecated("3.8") native readonly bool globalfreeze;
+	native readonly @MusPlayingInfo mus_playing;
 
 }
 
+struct MusPlayingInfo native
+{
+	native String name;
+	native int baseorder;
+	native bool loop;
+};
+
 struct TexMan
 {
 	enum EUseTypes