Allow #ENDSHORT tags

Detect where Preview and ShortEnd came from
Introduce a function to check whether a given GameMode is available for a song
This commit is contained in:
Flamefire committed 2013-10-12 21:42:03 +02:00
1 parent 87ba525811
commit b12e4156fa
14 files changed
+167 -97

No files matched your search

+16 -14
View File
@@ -22,6 +22,7 @@ using System.IO;
using System.Xml;
using VocaluxeLib.Draw;
using VocaluxeLib.PartyModes;
using VocaluxeLib.Songs;
namespace VocaluxeLib.Menu.SongMenu
{
@@ -101,7 +102,7 @@ namespace VocaluxeLib.Menu.SongMenu
private readonly Stopwatch _Timer = new Stopwatch();
private readonly Stopwatch _VideoFadeTimer = new Stopwatch();
private readonly List<int> _Streams = new List<int>();
private int _Actsong = -1;
private int _ActSongId = -1;
private int _Actsongstream = -1;
protected CTexture _Vidtex;
@@ -186,7 +187,7 @@ namespace VocaluxeLib.Menu.SongMenu
protected int _ActSong
{
get { return _Actsong; }
get { return _ActSongId; }
}
public SRectF Rect
@@ -206,7 +207,7 @@ namespace VocaluxeLib.Menu.SongMenu
public virtual int GetActualSelection()
{
return _Actsong;
return _ActSongId;
}
private bool _Selected;
@@ -434,7 +435,7 @@ namespace VocaluxeLib.Menu.SongMenu
if (!_Initialized)
return;
if (_Actsong != _PreviewSelected)
if (_ActSongId != _PreviewSelected)
_SelectSong(_PreviewSelected);
if (_Streams.Count <= 0 || _Video == -1)
@@ -607,7 +608,7 @@ namespace VocaluxeLib.Menu.SongMenu
protected void _SelectSong(int nr)
{
if (CBase.Songs.IsInCategory() && (CBase.Songs.GetNumSongsVisible() > 0) && (nr >= 0) && ((_Actsong != nr) || (_Streams.Count == 0)))
if (CBase.Songs.IsInCategory() && (CBase.Songs.GetNumSongsVisible() > 0) && (nr >= 0) && ((_ActSongId != nr) || (_Streams.Count == 0)))
{
_Streams.ForEach(soundStream => CBase.Sound.FadeAndStop(soundStream, 0f, 1f));
_Streams.Clear();
@@ -617,18 +618,19 @@ namespace VocaluxeLib.Menu.SongMenu
CBase.Drawing.RemoveTexture(ref _Vidtex);
_Actsong = nr;
if (_Actsong >= CBase.Songs.GetNumSongsVisible())
_Actsong = 0;
_ActSongId = nr;
if (_ActSongId >= CBase.Songs.GetNumSongsVisible())
_ActSongId = 0;
int stream = CBase.Sound.Load(Path.Combine(CBase.Songs.GetVisibleSong(_Actsong).Folder, CBase.Songs.GetVisibleSong(_Actsong).MP3FileName), true);
CSong actSong = CBase.Songs.GetVisibleSong(_ActSongId);
int stream = CBase.Sound.Load(Path.Combine(actSong.Folder, actSong.MP3FileName), true);
CBase.Sound.SetStreamVolumeMax(stream, _MaxVolume);
CBase.Sound.SetStreamVolume(stream, 0f);
float startposition = CBase.Songs.GetVisibleSong(_Actsong).PreviewStart;
float startposition = actSong.Preview.StartTime;
if (Math.Abs(startposition) < 0.001)
if (actSong.Preview.Source == EDataSource.None)
startposition = CBase.Sound.GetLength(stream) / 4f;
if (startposition >= 0.5f)
@@ -640,12 +642,12 @@ namespace VocaluxeLib.Menu.SongMenu
_Streams.Add(stream);
_Actsongstream = stream;
if (CBase.Songs.GetVisibleSong(_Actsong).VideoFileName != "" && CBase.Config.GetVideoPreview() == EOffOn.TR_CONFIG_ON)
if (actSong.VideoFileName != "" && CBase.Config.GetVideoPreview() == EOffOn.TR_CONFIG_ON)
{
_Video = CBase.Video.Load(Path.Combine(CBase.Songs.GetVisibleSong(_Actsong).Folder, CBase.Songs.GetVisibleSong(_Actsong).VideoFileName));
_Video = CBase.Video.Load(Path.Combine(actSong.Folder, actSong.VideoFileName));
if (_Video == -1)
return;
CBase.Video.Skip(_Video, startposition, CBase.Songs.GetVisibleSong(_Actsong).VideoGap);
CBase.Video.Skip(_Video, startposition, actSong.VideoGap);
_VideoFadeTimer.Stop();
_VideoFadeTimer.Reset();
_VideoFadeTimer.Start();