Rewind after pause (don't work atm)
This commit is contained in:
1 parent
46c12db857
commit
612cc358a3
6 files changed
+142
-18
No files matched your search
@@ -704,7 +704,7 @@ namespace Vocaluxe.Base
|
|||||||
/// <param name="args">Parameters</param>
|
/// <param name="args">Parameters</param>
|
||||||
public static void LoadCommandLineParams(string[] args)
|
public static void LoadCommandLineParams(string[] args)
|
||||||
{
|
{
|
||||||
var spliterParam = new Regex(@"-{1,2}|\/", RegexOptions.IgnoreCase);
|
Regex spliterParam = new Regex(@"-{1,2}|\/", RegexOptions.IgnoreCase);
|
||||||
|
|
||||||
//Complete argument string
|
//Complete argument string
|
||||||
string arguments = args.Aggregate(string.Empty, (current, arg) => current + (arg + " "));
|
string arguments = args.Aggregate(string.Empty, (current, arg) => current + (arg + " "));
|
||||||
@@ -713,7 +713,7 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
foreach (string text in args)
|
foreach (string text in args)
|
||||||
{
|
{
|
||||||
var spliterVal = new Regex(@"\s", RegexOptions.IgnoreCase);
|
Regex spliterVal = new Regex(@"\s", RegexOptions.IgnoreCase);
|
||||||
|
|
||||||
//split arg with Spilter-Regex and save in parts
|
//split arg with Spilter-Regex and save in parts
|
||||||
string[] parts = spliterVal.Split(text, 2);
|
string[] parts = spliterVal.Split(text, 2);
|
||||||
|
|||||||
+125
-5
@@ -274,7 +274,16 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
Players[p].NoteDiff = Math.Abs(tone - tonePlayer);
|
Players[p].NoteDiff = Math.Abs(tone - tonePlayer);
|
||||||
bool hit = Players[p].NoteDiff <= (2 - (int)CProfiles.GetDifficulty(Players[p].ProfileID));
|
bool hit = Players[p].NoteDiff <= (2 - (int)CProfiles.GetDifficulty(Players[p].ProfileID));
|
||||||
if (hit)
|
bool alreadySung = false;
|
||||||
|
if (Players[p].SungLines.Count - 1 == line)
|
||||||
|
{
|
||||||
|
if (note < Players[p].SungLines[line].NoteCount)
|
||||||
|
alreadySung = true;
|
||||||
|
}
|
||||||
|
else if (Players[p].SungLines.Count - 1 > line)
|
||||||
|
alreadySung = true;
|
||||||
|
|
||||||
|
if (hit && !alreadySung)
|
||||||
{
|
{
|
||||||
// valid
|
// valid
|
||||||
//CSound.RecordSetTone(p, Tone);
|
//CSound.RecordSetTone(p, Tone);
|
||||||
@@ -289,8 +298,9 @@ namespace Vocaluxe.Base
|
|||||||
if (Players[p].SungLines[line].NoteCount > 0)
|
if (Players[p].SungLines[line].NoteCount > 0)
|
||||||
{
|
{
|
||||||
CSungNote lastNote = Players[p].SungLines[line].LastNote;
|
CSungNote lastNote = Players[p].SungLines[line].LastNote;
|
||||||
|
|
||||||
if (notes[note].StartBeat == beat || lastNote.EndBeat + 1 != beat || lastNote.Tone != tone || !lastNote.Hit)
|
if (notes[note].StartBeat == beat || lastNote.EndBeat + 1 != beat || lastNote.Tone != tone || !lastNote.Hit)
|
||||||
Players[p].SungLines[line].AddNote(new CSungNote(beat, 1, tone, notes[note], points));
|
Players[p].SungLines[line].AddNote(new CSungNote(beat, 1, tone, notes[note], points, notes[note].NoteType == ENoteType.Golden));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Players[p].SungLines[line].IncLastNoteLength();
|
Players[p].SungLines[line].IncLastNoteLength();
|
||||||
@@ -298,12 +308,12 @@ namespace Vocaluxe.Base
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Players[p].SungLines[line].AddNote(new CSungNote(beat, 1, tone, notes[note], points));
|
Players[p].SungLines[line].AddNote(new CSungNote(beat, 1, tone, notes[note], points, notes[note].NoteType == ENoteType.Golden));
|
||||||
|
|
||||||
Players[p].SungLines[line].LastNote.CheckPerfect();
|
Players[p].SungLines[line].LastNote.CheckPerfect();
|
||||||
Players[p].SungLines[line].IsPerfect(lines[line]);
|
Players[p].SungLines[line].IsPerfect(lines[line]);
|
||||||
}
|
}
|
||||||
else
|
else //if(!alreadySung)
|
||||||
{
|
{
|
||||||
if (Players[p].SungLines[line].NoteCount > 0)
|
if (Players[p].SungLines[line].NoteCount > 0)
|
||||||
{
|
{
|
||||||
@@ -339,12 +349,122 @@ namespace Vocaluxe.Base
|
|||||||
double points = CSettings.LinebonusScore * factor * 1f / numLinesWithPoints;
|
double points = CSettings.LinebonusScore * factor * 1f / numLinesWithPoints;
|
||||||
Players[p].Points += points;
|
Players[p].Points += points;
|
||||||
Players[p].PointsLineBonus += points;
|
Players[p].PointsLineBonus += points;
|
||||||
Players[p].SungLines[line].BonusPoints = points;
|
Players[p].SungLines[line].BonusPoints += points;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_OldBeatD = ActBeatD;
|
_OldBeatD = ActBeatD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void ResetToLastLine(int soundStream, int vidStream)
|
||||||
|
{
|
||||||
|
float[] time = GetLastSungLineStart();
|
||||||
|
ResetToTime(time[0], time[1], soundStream, vidStream);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ResetToTime(float time, float nextStart, int soundStream, int vidStream)
|
||||||
|
{
|
||||||
|
if (time < 0)
|
||||||
|
time = 0;
|
||||||
|
|
||||||
|
Beat = GetBeatFromTime(time, GetSong().BPM, GetSong().Gap);
|
||||||
|
CurrentBeat = (int)Math.Floor(Beat);
|
||||||
|
|
||||||
|
for (int p = 0; p < _NumPlayer; p++)
|
||||||
|
{
|
||||||
|
Players[p].Points = 0;
|
||||||
|
Players[p].PointsGoldenNotes = 0;
|
||||||
|
Players[p].PointsLineBonus = 0;
|
||||||
|
int l = 0;
|
||||||
|
int deleteLine = 0;
|
||||||
|
foreach (CSungLine line in Players[p].SungLines)
|
||||||
|
{
|
||||||
|
int n = -1;
|
||||||
|
int deleteNote = 0;
|
||||||
|
Players[p].PointsLineBonus += line.BonusPoints;
|
||||||
|
foreach (CSungNote note in line.Notes)
|
||||||
|
{
|
||||||
|
if (note.StartBeat < nextStart)
|
||||||
|
{
|
||||||
|
if (note.GoldenNote)
|
||||||
|
Players[p].PointsGoldenNotes += note.Points;
|
||||||
|
Players[p].Points += note.Points;
|
||||||
|
}
|
||||||
|
else if(deleteNote != -1)
|
||||||
|
deleteNote = n;
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
while (line.NoteCount > n && n >= 0)
|
||||||
|
{
|
||||||
|
if (line.Notes[n].GoldenNote)
|
||||||
|
Players[p].PointsGoldenNotes -= line.Notes[n].Points;
|
||||||
|
Players[p].Points -= line.Notes[n].Points;
|
||||||
|
line.DeleteNote(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (line.LastNoteBeat > CurrentBeat && deleteLine == 0)
|
||||||
|
deleteLine = l;
|
||||||
|
l++;
|
||||||
|
}
|
||||||
|
Players[p].SungLines.RemoveRange(deleteLine, Players[p].SungLines.Count - deleteLine);
|
||||||
|
}
|
||||||
|
CSong song = GetSong();
|
||||||
|
for (int i = 0; i < GetSong().Notes.Voices[0].Lines.Length; i++)
|
||||||
|
{
|
||||||
|
CLog.LogError((i + 1) + ". " + song.Notes.Voices[0].Lines[i].NoteCount + " - " + Players[0].SungLines[i].NoteCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
CSound.SetPosition(soundStream, time);
|
||||||
|
CVideo.Skip(vidStream, time, GetSong().VideoGap);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static float[] GetLastSungLineStart()
|
||||||
|
{
|
||||||
|
return GetNoteTimeBeforeBeat(CurrentBeat);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static float[] GetNoteTimeBeforeBeat(int beat)
|
||||||
|
{
|
||||||
|
CSong song = GetSong();
|
||||||
|
int StartBeat = (int)Math.Floor(beat - GetBeatFromTime(CSettings.PauseResetTime, song.BPM, 0f));
|
||||||
|
int lastStart = 0;
|
||||||
|
int nextStart = 0;
|
||||||
|
foreach (CVoice voice in song.Notes.Voices)
|
||||||
|
{
|
||||||
|
int lastEnd = 0;
|
||||||
|
int voiceStart = 0;
|
||||||
|
int nextStartNote = 0;
|
||||||
|
foreach (CSongLine line in voice.Lines)
|
||||||
|
{
|
||||||
|
foreach (CSongNote note in line.Notes)
|
||||||
|
{
|
||||||
|
if (note.StartBeat > StartBeat)
|
||||||
|
{
|
||||||
|
nextStartNote = note.StartBeat;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
voiceStart = note.StartBeat;
|
||||||
|
lastEnd = note.EndBeat;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (nextStartNote > 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (nextStartNote - beat > CSettings.PauseResetTime)
|
||||||
|
lastStart = beat;
|
||||||
|
else if (nextStartNote - lastEnd > CSettings.PauseResetTime)
|
||||||
|
lastStart = nextStartNote - (int)Math.Floor(GetBeatFromTime(CSettings.PauseResetTime, song.BPM, 0f));
|
||||||
|
if (voiceStart > lastStart)
|
||||||
|
{
|
||||||
|
lastStart = voiceStart;
|
||||||
|
nextStart = nextStartNote;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new float[]{GetTimeFromBeats(lastStart, GetSong().BPM), nextStart};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+10
-10
@@ -218,7 +218,7 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
if (_Fading)
|
if (_Fading)
|
||||||
{
|
{
|
||||||
var fadeTime = (long)(CConfig.FadeTime * 1000);
|
long fadeTime = (long)(CConfig.FadeTime * 1000);
|
||||||
|
|
||||||
if ((_FadingTimer.ElapsedMilliseconds < fadeTime) && (CConfig.FadeTime > 0))
|
if ((_FadingTimer.ElapsedMilliseconds < fadeTime) && (CConfig.FadeTime > 0))
|
||||||
{
|
{
|
||||||
@@ -349,10 +349,10 @@ namespace Vocaluxe.Base
|
|||||||
#region private stuff
|
#region private stuff
|
||||||
private static bool _HandleInputs(CKeys keys, CMouse mouse)
|
private static bool _HandleInputs(CKeys keys, CMouse mouse)
|
||||||
{
|
{
|
||||||
var keyEvent = new SKeyEvent();
|
SKeyEvent keyEvent = new SKeyEvent();
|
||||||
var mouseEvent = new SMouseEvent();
|
SMouseEvent mouseEvent = new SMouseEvent();
|
||||||
var inputKeyEvent = new SKeyEvent();
|
SKeyEvent inputKeyEvent = new SKeyEvent();
|
||||||
var inputMouseEvent = new SMouseEvent();
|
SMouseEvent inputMouseEvent = new SMouseEvent();
|
||||||
|
|
||||||
bool popupPlayerControlAllowed = _CurrentScreen != EScreens.ScreenOptionsRecord && _CurrentScreen != EScreens.ScreenSing &&
|
bool popupPlayerControlAllowed = _CurrentScreen != EScreens.ScreenOptionsRecord && _CurrentScreen != EScreens.ScreenSing &&
|
||||||
(_CurrentScreen != EScreens.ScreenSong ||
|
(_CurrentScreen != EScreens.ScreenSong ||
|
||||||
@@ -541,8 +541,8 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
private static bool _HandleInputThemeEditor(CKeys keys, CMouse mouse)
|
private static bool _HandleInputThemeEditor(CKeys keys, CMouse mouse)
|
||||||
{
|
{
|
||||||
var keyEvent = new SKeyEvent();
|
SKeyEvent keyEvent = new SKeyEvent();
|
||||||
var mouseEvent = new SMouseEvent();
|
SMouseEvent mouseEvent = new SMouseEvent();
|
||||||
|
|
||||||
while (keys.PollEvent(ref keyEvent))
|
while (keys.PollEvent(ref keyEvent))
|
||||||
{
|
{
|
||||||
@@ -598,7 +598,7 @@ namespace Vocaluxe.Base
|
|||||||
if (CConfig.DebugLevel == EDebugLevel.TR_CONFIG_OFF)
|
if (CConfig.DebugLevel == EDebugLevel.TR_CONFIG_OFF)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var debugOutput = new List<string> {CTime.GetFPS().ToString("FPS: 000")};
|
List<String> debugOutput = new List<string> {CTime.GetFPS().ToString("FPS: 000")};
|
||||||
|
|
||||||
if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL1)
|
if (CConfig.DebugLevel >= EDebugLevel.TR_CONFIG_LEVEL1)
|
||||||
{
|
{
|
||||||
@@ -627,11 +627,11 @@ namespace Vocaluxe.Base
|
|||||||
CFonts.Style = EStyle.Normal;
|
CFonts.Style = EStyle.Normal;
|
||||||
CFonts.SetFont("Normal");
|
CFonts.SetFont("Normal");
|
||||||
CFonts.Height = 25;
|
CFonts.Height = 25;
|
||||||
var gray = new SColorF(1f, 1f, 1f, 0.5f);
|
SColorF gray = new SColorF(1f, 1f, 1f, 0.5f);
|
||||||
float y = 0;
|
float y = 0;
|
||||||
foreach (string txt in debugOutput)
|
foreach (string txt in debugOutput)
|
||||||
{
|
{
|
||||||
var rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), y, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));
|
RectangleF rect = new RectangleF(CSettings.RenderW - CFonts.GetTextWidth(txt), y, CFonts.GetTextWidth(txt), CFonts.GetTextHeight(txt));
|
||||||
CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear));
|
CDraw.DrawColor(gray, new SRectF(rect.X, rect.Top, rect.Width, rect.Height, CSettings.ZNear));
|
||||||
CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear);
|
CFonts.DrawText(txt, rect.X, rect.Y, CSettings.ZNear);
|
||||||
y += rect.Height;
|
y += rect.Height;
|
||||||
|
|||||||
@@ -142,6 +142,7 @@ namespace Vocaluxe.Base
|
|||||||
public const bool TabNavigation = false;
|
public const bool TabNavigation = false;
|
||||||
|
|
||||||
public const float BackgroundMusicFadeTime = 0.5f;
|
public const float BackgroundMusicFadeTime = 0.5f;
|
||||||
|
public const float PauseResetTime = 1f;
|
||||||
|
|
||||||
public static readonly List<string> MusicFileTypes = new List<string>
|
public static readonly List<string> MusicFileTypes = new List<string>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -868,6 +868,7 @@ namespace Vocaluxe.Screens
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
CGame.ResetToLastLine(_CurrentStream, _CurrentVideo);
|
||||||
_Buttons[_ButtonCancel].Visible = false;
|
_Buttons[_ButtonCancel].Visible = false;
|
||||||
_Buttons[_ButtonContinue].Visible = false;
|
_Buttons[_ButtonContinue].Visible = false;
|
||||||
_Buttons[_ButtonSkip].Visible = false;
|
_Buttons[_ButtonSkip].Visible = false;
|
||||||
|
|||||||
@@ -43,14 +43,16 @@ namespace VocaluxeLib.Songs
|
|||||||
/// <param name="duration"></param>
|
/// <param name="duration"></param>
|
||||||
/// <param name="tone"></param>
|
/// <param name="tone"></param>
|
||||||
/// <param name="hitNote"></param>
|
/// <param name="hitNote"></param>
|
||||||
public CSungNote(int startBeat, int duration, int tone, CSongNote hitNote, double points) : this(startBeat, duration, tone)
|
public CSungNote(int startBeat, int duration, int tone, CSongNote hitNote, double points, bool golden) : this(startBeat, duration, tone)
|
||||||
{
|
{
|
||||||
HitNote = hitNote;
|
HitNote = hitNote;
|
||||||
Points = points;
|
Points = points;
|
||||||
|
GoldenNote = golden;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Properties
|
#region Properties
|
||||||
public double Points;
|
public double Points;
|
||||||
|
public bool GoldenNote;
|
||||||
// for drawing player notes
|
// for drawing player notes
|
||||||
public bool Hit
|
public bool Hit
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user