From efead3615cd34b23baaf7ca3d7fb9a07068a6633 Mon Sep 17 00:00:00 2001 From: Gary Kertopermono Date: Mon, 8 Apr 2019 15:16:00 +0200 Subject: [PATCH] Added basic support for rap notes and golden rap notes --- Vocaluxe/Base/CGame.cs | 9 ++++++--- VocaluxeLib/Enums.cs | 4 +++- VocaluxeLib/Songs/CSongLoader.cs | 4 ++++ VocaluxeLib/Songs/CSongNote.cs | 2 ++ VocaluxeLib/Songs/CSongWriter.cs | 6 ++++++ 5 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Vocaluxe/Base/CGame.cs b/Vocaluxe/Base/CGame.cs index a90b062a..444d5208 100644 --- a/Vocaluxe/Base/CGame.cs +++ b/Vocaluxe/Base/CGame.cs @@ -302,6 +302,9 @@ namespace Vocaluxe.Base if(p == 0) tonePlayer = tone; #endif + if (notes[note].Type == ENoteType.Rap || notes[note].Type == ENoteType.RapGolden) + tonePlayer = tone; + Players[p].NoteDiff = Math.Abs(tone - tonePlayer); bool hit = Players[p].NoteDiff <= (2 - (int)CProfiles.GetDifficulty(Players[p].ProfileID)); @@ -311,7 +314,7 @@ namespace Vocaluxe.Base //CRecord.RecordSetTone(p, Tone); double points = (CSettings.MaxScore - CSettings.LinebonusScore) * (double)notes[note].PointsForBeat / song.Notes.GetVoice(Players[p].VoiceNr).Points; - if (notes[note].Type == ENoteType.Golden) + if (notes[note].Type == ENoteType.Golden || notes[note].Type == ENoteType.RapGolden) Players[p].PointsGoldenNotes += points; Players[p].Points += points; @@ -411,7 +414,7 @@ namespace Vocaluxe.Base { if (note.StartBeat < nextStart) { - if (note.Hit && note.HitNote.Type == ENoteType.Golden) + if (note.Hit && (note.HitNote.Type == ENoteType.Golden || note.HitNote.Type == ENoteType.RapGolden)) Players[p].PointsGoldenNotes += note.Points; Players[p].Points += note.Points; } @@ -421,7 +424,7 @@ namespace Vocaluxe.Base } while (line.NoteCount > n && n >= 0) { - if (line.Notes[n].Hit && line.Notes[n].HitNote.Type == ENoteType.Golden) + if (line.Notes[n].Hit && (line.Notes[n].HitNote.Type == ENoteType.Golden || line.Notes[n].HitNote.Type == ENoteType.RapGolden)) Players[p].PointsGoldenNotes -= line.Notes[n].Points; Players[p].Points -= line.Notes[n].Points; line.DeleteNote(n); diff --git a/VocaluxeLib/Enums.cs b/VocaluxeLib/Enums.cs index 8ba2a416..746e04c7 100644 --- a/VocaluxeLib/Enums.cs +++ b/VocaluxeLib/Enums.cs @@ -364,7 +364,9 @@ namespace VocaluxeLib { Normal, Golden, - Freestyle + Freestyle, + Rap, + RapGolden } public enum EMusicType diff --git a/VocaluxeLib/Songs/CSongLoader.cs b/VocaluxeLib/Songs/CSongLoader.cs index 99702bc8..650971cb 100644 --- a/VocaluxeLib/Songs/CSongLoader.cs +++ b/VocaluxeLib/Songs/CSongLoader.cs @@ -616,6 +616,10 @@ namespace VocaluxeLib.Songs noteType = ENoteType.Golden; else if (tag.Equals('F')) noteType = ENoteType.Freestyle; + else if (tag.Equals('R')) + noteType = ENoteType.Rap; + else if (tag.Equals('G')) + noteType = ENoteType.RapGolden; else noteType = ENoteType.Normal; diff --git a/VocaluxeLib/Songs/CSongNote.cs b/VocaluxeLib/Songs/CSongNote.cs index 3079c61e..f0ce3d73 100644 --- a/VocaluxeLib/Songs/CSongNote.cs +++ b/VocaluxeLib/Songs/CSongNote.cs @@ -49,8 +49,10 @@ namespace VocaluxeLib.Songs switch (Type) { case ENoteType.Normal: + case ENoteType.Rap: return 1; case ENoteType.Golden: + case ENoteType.RapGolden: return 2; case ENoteType.Freestyle: return 0; diff --git a/VocaluxeLib/Songs/CSongWriter.cs b/VocaluxeLib/Songs/CSongWriter.cs index bdae39c4..957905e3 100644 --- a/VocaluxeLib/Songs/CSongWriter.cs +++ b/VocaluxeLib/Songs/CSongWriter.cs @@ -187,6 +187,12 @@ namespace VocaluxeLib.Songs case ENoteType.Freestyle: tag = "F"; break; + case ENoteType.Rap: + tag = "R"; + break; + case ENoteType.RapGolden: + tag = "G"; + break; default: throw new NotImplementedException("Note type " + note.Type); }