|
@@ -12,7 +12,7 @@
|
|
|
#pragma newdecls required
|
|
|
#include <round_end_music>
|
|
|
|
|
|
-#define PLUGIN_VERSION "0.4.2"
|
|
|
+#define PLUGIN_VERSION "0.5.0"
|
|
|
public Plugin myinfo = {
|
|
|
name = "[CSRD] Round End Music",
|
|
|
author = "nosoop",
|
|
@@ -229,6 +229,15 @@ void EmitRoundEndMusic(MusicEntry song) {
|
|
|
}
|
|
|
|
|
|
if (result != Plugin_Stop) {
|
|
|
+ /**
|
|
|
+ * Plugins listening to OnRoundEndMusicPlayed might check if the song was already
|
|
|
+ * played, so we'll have to fire off the event before it gets put into the "played"
|
|
|
+ * list.
|
|
|
+ *
|
|
|
+ * I can't remember if there was any reason why it was last in the first place...
|
|
|
+ */
|
|
|
+ FireOnREMPlayedPostEvent(song);
|
|
|
+
|
|
|
if (g_PlayedSongs.FindValue(song) == -1) {
|
|
|
g_PlayedSongs.Push(song);
|
|
|
}
|
|
@@ -237,8 +246,6 @@ void EmitRoundEndMusic(MusicEntry song) {
|
|
|
if ( (pos = g_ActiveSongs.FindValue(song)) != -1 ) {
|
|
|
g_ActiveSongs.Erase(pos);
|
|
|
}
|
|
|
-
|
|
|
- FireOnREMPlayedPostEvent(song);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -286,6 +293,7 @@ public APLRes AskPluginLoad2(Handle self, bool late, char[] error, int err_max)
|
|
|
CreateNative("REM_RegisterSource", Native_RegisterSource);
|
|
|
CreateNative("REM_AddSong", Native_AddSong);
|
|
|
CreateNative("REM_GetActiveSongCount", Native_GetActiveSongCount);
|
|
|
+ CreateNative("REM_SongWasRecentlyPlayed", Native_SongWasRecentlyPlayed);
|
|
|
}
|
|
|
|
|
|
public int Native_RegisterSource(Handle hPlugin, int nArgs) {
|
|
@@ -339,4 +347,17 @@ public int Native_AddSong(Handle hPlugin, int nArgs) {
|
|
|
|
|
|
public int Native_GetActiveSongCount(Handle hPlugin, int nArgs) {
|
|
|
return g_nMaxActiveSongs;
|
|
|
+}
|
|
|
+
|
|
|
+public int Native_SongWasRecentlyPlayed(Handle hPlugin, int nArgs) {
|
|
|
+ MusicEntry song = GetNativeCell(1);
|
|
|
+
|
|
|
+ for (int i = 0; i < g_PlayedSongs.Length; i++) {
|
|
|
+ MusicEntry playedSong = g_PlayedSongs.Get(i);
|
|
|
+
|
|
|
+ if (song.Equals(playedSong)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
}
|