From c4f1b4f542dc44b00e2a49ae8ab097130e0c050a Mon Sep 17 00:00:00 2001 From: brunzelchen Date: Fri, 8 Oct 2010 16:04:14 +0000 Subject: - ultrastar should detect on every single beat now - new option: mic delay (between screen/music and tone detection) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/1.0.1 Challenge MOD@2640 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UIni.pas | 12 + Game/Code/Classes/UMain.pas | 495 +++++++++++++++--------------- Game/Code/Classes/UThemes.pas | 2 + Game/Code/Screens/UScreenOptionsSound.pas | 14 +- 4 files changed, 266 insertions(+), 257 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas index 682016b8..66bfba26 100644 --- a/Game/Code/Classes/UIni.pas +++ b/Game/Code/Classes/UIni.pas @@ -51,6 +51,7 @@ type BeatClick: integer; SavePlayback: integer; Threshold: integer; + Delay: integer; //Song Preview PreviewVolume: integer; @@ -168,6 +169,8 @@ const IBeatClick: array[0..1] of string = ('Off', 'On'); ISavePlayback: array[0..1] of string = ('Off', 'On'); IThreshold: array[0..3] of string = ('5%', '10%', '15%', '20%'); + IDelay: array[0..9] of string = ('0ms', '10ms', '20ms', '30ms', '40ms', '50ms', '60ms', '70ms', '80ms', '90ms'); + //Song Preview IPreviewVolume: array[0..10] of string = ('Off', '10%', '20%', '30%', '40%', '50%', '60%', '70%', '80%', '90%', '100%'); IPreviewFading: array[0..5] of string = ('Off', '1 Sec', '2 Secs', '3 Secs', '4 Secs', '5 Secs'); @@ -434,6 +437,11 @@ begin for Pet := 0 to High(IThreshold) do if Tekst = IThreshold[Pet] then Ini.Threshold := Pet; + // Delay + Tekst := IniFile.ReadString('Sound', 'Delay', IDelay[5]); + for Pet := 0 to High(IDelay) do + if Tekst = IDelay[Pet] then Ini.Delay := Pet; + //Song Preview Tekst := IniFile.ReadString('Sound', 'PreviewVolume', IPreviewVolume[7]); for Pet := 0 to High(IPreviewVolume) do @@ -791,6 +799,10 @@ begin Tekst := IThreshold[Ini.Threshold]; IniFile.WriteString('Sound', 'Threshold', Tekst); + // Delay + Tekst := IDelay[Ini.Delay]; + IniFile.WriteString('Sound', 'Delay', Tekst); + // Song Preview Tekst := IPreviewVolume[Ini.PreviewVolume]; IniFile.WriteString('Sound', 'PreviewVolume', Tekst); diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index ecbc9c59..9b472528 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -56,7 +56,7 @@ type Nuta: array of record Start: integer; Dlugosc: integer; - Detekt: real; // dokladne miejsce, w ktorym wykryto ta nute + //Detekt: real; // dokladne miejsce, w ktorym wykryto ta nute Ton: real; Perfect: boolean; // true if the note matches the original one, lit the star @@ -259,21 +259,25 @@ procedure GetMidBeatSub(BPMNum: integer; var Time: real; var CurBeat: real); var NewTime: real; begin - if High(AktSong.BPM) = BPMNum then begin + if High(AktSong.BPM) = BPMNum then + begin // last BPM CurBeat := AktSong.BPM[BPMNum].StartBeat + GetBeats(AktSong.BPM[BPMNum].BPM, Time); Time := 0; - end else begin + end else + begin // not last BPM // count how much time is it for start of the new BPM and store it in NewTime NewTime := GetTimeForBeats(AktSong.BPM[BPMNum].BPM, AktSong.BPM[BPMNum+1].StartBeat - AktSong.BPM[BPMNum].StartBeat); // compare it to remaining time - if (Time - NewTime) > 0 then begin + if (Time - NewTime) > 0 then + begin // there is still remaining time CurBeat := AktSong.BPM[BPMNum].StartBeat; Time := Time - NewTime; - end else begin + end else + begin // there is no remaining time CurBeat := AktSong.BPM[BPMNum].StartBeat + GetBeats(AktSong.BPM[BPMNum].BPM, Time); Time := 0; @@ -285,37 +289,19 @@ function GetMidBeat(Time: real): real; var CurBeat: real; CurBPM: integer; -// TopBeat: real; -// TempBeat: real; -// TempTime: real; + begin Result := 0; if Length(AktSong.BPM) = 1 then Result := Time * AktSong.BPM[0].BPM / 60; - (* 2 BPMs *) -{ if Length(AktSong.BPM) > 1 then begin - (* new system *) - CurBeat := 0; - TopBeat := GetBeats(AktSong.BPM[0].BPM, Time); - if TopBeat > AktSong.BPM[1].StartBeat then begin - // analyze second BPM - Time := Time - GetTimeForBeats(AktSong.BPM[0].BPM, AktSong.BPM[1].StartBeat - CurBeat); - CurBeat := AktSong.BPM[1].StartBeat; - TopBeat := GetBeats(AktSong.BPM[1].BPM, Time); - Result := CurBeat + TopBeat; - - end else begin - (* pierwszy przedzial *) - Result := TopBeat; - end; - end; // if} - (* more BPMs *) - if Length(AktSong.BPM) > 1 then begin + if Length(AktSong.BPM) > 1 then + begin CurBeat := 0; CurBPM := 0; - while (Time > 0) do begin + while (Time > 0) do + begin GetMidBeatSub(CurBPM, Time, CurBeat); Inc(CurBPM); end; @@ -332,26 +318,25 @@ begin if Length(AktSong.BPM) = 1 then Result := AktSong.GAP / 1000 + Beat * 60 / AktSong.BPM[0].BPM; (* more BPMs *) - if Length(AktSong.BPM) > 1 then begin + if Length(AktSong.BPM) > 1 then + begin Result := AktSong.GAP / 1000; CurBPM := 0; - while (CurBPM <= High(AktSong.BPM)) and (Beat > AktSong.BPM[CurBPM].StartBeat) do begin - if (CurBPM < High(AktSong.BPM)) and (Beat >= AktSong.BPM[CurBPM+1].StartBeat) then begin + while (CurBPM <= High(AktSong.BPM)) and (Beat > AktSong.BPM[CurBPM].StartBeat) do + begin + if (CurBPM < High(AktSong.BPM)) and (Beat >= AktSong.BPM[CurBPM+1].StartBeat) then + begin // full range Result := Result + (60 / AktSong.BPM[CurBPM].BPM) * (AktSong.BPM[CurBPM+1].StartBeat - AktSong.BPM[CurBPM].StartBeat); end; - if (CurBPM = High(AktSong.BPM)) or (Beat < AktSong.BPM[CurBPM+1].StartBeat) then begin + if (CurBPM = High(AktSong.BPM)) or (Beat < AktSong.BPM[CurBPM+1].StartBeat) then + begin // in the middle Result := Result + (60 / AktSong.BPM[CurBPM].BPM) * (Beat - AktSong.BPM[CurBPM].StartBeat); end; Inc(CurBPM); end; - -{ while (Time > 0) do begin - GetMidBeatSub(CurBPM, Time, CurBeat); - Inc(CurBPM); - end;} end; // if} end; @@ -375,7 +360,7 @@ begin Czas.AktBeatC := Floor(Czas.MidBeatC); Czas.OldBeatD := Czas.AktBeatD; - Czas.MidBeatD := -0.5+GetMidBeat(Czas.Teraz - (AktSong.Gap + 120 + 20) / 1000); // MidBeat with addition GAP + Czas.MidBeatD := -0.5+GetMidBeat(Czas.Teraz - (AktSong.Gap + 120 + Ini.Delay*10) / 1000); // MidBeat with addition GAP Czas.AktBeatD := Floor(Czas.MidBeatD); Czas.FracBeatD := Frac(Czas.MidBeatD); @@ -493,10 +478,11 @@ begin for Pet := 0 to Czesci[CP].Czesc[Czesci[CP].Akt].HighNut do begin - if (Czesci[CP].Czesc[Czesci[CP].Akt].Nuta[Pet].Start = Czas.AktBeat) then + if (Czesci[CP].Czesc[Czesci[CP].Akt].Nuta[Pet].Start <= Czas.AktBeat) and + (Sender.LyricMain[CP].Selected <> Pet) then begin // operates on currently beated note - Sender.LyricMain[CP].Selected := Pet + Sender.LyricMain[CP].Selected := Pet; end; end; end; @@ -560,12 +546,18 @@ var SMin: integer; SMax: integer; SDet: integer; // temporary: sentence of detected note + BRange: integer; // beat range + + AktTon: integer; + Pet: integer; Mozna: boolean; Nowa: boolean; Range: integer; NoteHit:boolean; begin + SDet := 0; + for CP := 0 to PlayersPlay-1 do begin if (not AktSong.isDuet) then @@ -579,136 +571,135 @@ begin SMin := 0; SMax := Czesci[P].Akt; - SDet := SMin; - // check if we can add new note - Mozna := false; - for S := SMin to SMax do + for BRange := Czas.OldBeatD+1 to Czas.AktBeatD do begin - for Pet := 0 to Czesci[P].Czesc[S].HighNut do + SDet := SMin; + // check if we can add new note + Mozna := false; + for S := SMin to SMax do begin - if ((Czesci[P].Czesc[S].Nuta[Pet].Start <= Czas.AktBeatD) - and (Czesci[P].Czesc[S].Nuta[Pet].Start + Czesci[P].Czesc[S].Nuta[Pet].Dlugosc - 1 >= Czas.AktBeatD)) - and (not Czesci[P].Czesc[S].Nuta[Pet].FreeStyle) // but don't allow when it's FreeStyle note - and (Czesci[P].Czesc[S].Nuta[Pet].Dlugosc > 0) // and make sure the note lenghts is at least 1 - then + for Pet := 0 to Czesci[P].Czesc[S].HighNut do begin - SDet := S; - Mozna := true; - Break; + if ((Czesci[P].Czesc[S].Nuta[Pet].Start <= BRange) + and (Czesci[P].Czesc[S].Nuta[Pet].Start + Czesci[P].Czesc[S].Nuta[Pet].Dlugosc - 1 >= BRange)) + and (not Czesci[P].Czesc[S].Nuta[Pet].FreeStyle) // but don't allow when it's FreeStyle note + and (Czesci[P].Czesc[S].Nuta[Pet].Dlugosc > 0) // and make sure the note lenghts is at least 1 + then + begin + SDet := S; + Mozna := true; + Break; + end; end; end; - end; - S := SDet; + S := SDet; - if (Sound[CP].SzczytJest or DEBUG_NOTE_HIT) and (Mozna) then - begin - // operowanie na ostatniej nucie - for Pet := 0 to Czesci[P].Czesc[S].HighNut do + if (Sound[CP].SzczytJest or DEBUG_NOTE_HIT) and Mozna then begin - if (Czesci[P].Czesc[S].Nuta[Pet].Start <= Czas.OldBeatD+1) - and (Czesci[P].Czesc[S].Nuta[Pet].Start + - Czesci[P].Czesc[S].Nuta[Pet].Dlugosc > Czas.OldBeatD+1) then + // operate on the actual note + for Pet := 0 to Czesci[P].Czesc[S].HighNut do begin - // przesuwanie tonu w odpowiednia game - while (Sound[CP].Ton - Czesci[P].Czesc[S].Nuta[Pet].Ton > 6) do - Sound[CP].Ton := Sound[CP].Ton - 12; - while (Sound[CP].Ton - Czesci[P].Czesc[S].Nuta[Pet].Ton < -6) do - Sound[CP].Ton := Sound[CP].Ton + 12; - - // Half size Notes Patch - NoteHit := false; - - //if Ini.Difficulty = 0 then Range := 2; - //if Ini.Difficulty = 1 then Range := 1; - //if Ini.Difficulty = 2 then Range := 0; - Range := 2 - Ini.Difficulty; - if (abs(Czesci[P].Czesc[S].Nuta[Pet].Ton - Sound[CP].Ton) <= Range) or - DEBUG_NOTE_HIT then + if (Czesci[P].Czesc[S].Nuta[Pet].Start <= BRange) + and (Czesci[P].Czesc[S].Nuta[Pet].Start + + Czesci[P].Czesc[S].Nuta[Pet].Dlugosc > BRange) then begin - Sound[CP].Ton := Czesci[P].Czesc[S].Nuta[Pet].Ton; + // przesuwanie tonu w odpowiednia game => shifting tone in the corresponding game? + while (Sound[CP].Ton - Czesci[P].Czesc[S].Nuta[Pet].Ton > 6) do + Sound[CP].Ton := Sound[CP].Ton - 12; + while (Sound[CP].Ton - Czesci[P].Czesc[S].Nuta[Pet].Ton < -6) do + Sound[CP].Ton := Sound[CP].Ton + 12; // Half size Notes Patch - NoteHit := true; + NoteHit := false; - if (Ini.LineBonus = 0) then + Range := 2 - Ini.Difficulty; + if (abs(Czesci[P].Czesc[S].Nuta[Pet].Ton - Sound[CP].Ton) <= Range) or + DEBUG_NOTE_HIT then begin - // add points without LineBonus - case Czesci[P].Czesc[S].Nuta[Pet].Wartosc of - 1: Player[CP].Score := Player[CP].Score + 10000 / Czesci[P].Wartosc * - Czesci[P].Czesc[S].Nuta[Pet].Wartosc; - 2: Player[CP].ScoreGolden := Player[CP].ScoreGolden + 10000 / Czesci[P].Wartosc * - Czesci[P].Czesc[S].Nuta[Pet].Wartosc; + AktTon := Czesci[P].Czesc[S].Nuta[Pet].Ton; + + // Half size Notes Patch + NoteHit := true; + + if (Ini.LineBonus = 0) then + begin + // add points without LineBonus + case Czesci[P].Czesc[S].Nuta[Pet].Wartosc of + 1: Player[CP].Score := Player[CP].Score + 10000 / Czesci[P].Wartosc * + Czesci[P].Czesc[S].Nuta[Pet].Wartosc; + 2: Player[CP].ScoreGolden := Player[CP].ScoreGolden + 10000 / Czesci[P].Wartosc * + Czesci[P].Czesc[S].Nuta[Pet].Wartosc; + end; + end else + begin + // add points with Line Bonus + case Czesci[P].Czesc[S].Nuta[Pet].Wartosc of + 1: Player[CP].Score := Player[CP].Score + 9000 / Czesci[P].Wartosc * + Czesci[P].Czesc[S].Nuta[Pet].Wartosc; + 2: Player[CP].ScoreGolden := Player[CP].ScoreGolden + 9000 / Czesci[P].Wartosc * + Czesci[P].Czesc[S].Nuta[Pet].Wartosc; + end; end; - end else - begin - // add points with Line Bonus - case Czesci[P].Czesc[S].Nuta[Pet].Wartosc of - 1: Player[CP].Score := Player[CP].Score + 9000 / Czesci[P].Wartosc * - Czesci[P].Czesc[S].Nuta[Pet].Wartosc; - 2: Player[CP].ScoreGolden := Player[CP].ScoreGolden + 9000 / Czesci[P].Wartosc * - Czesci[P].Czesc[S].Nuta[Pet].Wartosc; - end; - end; - Player[CP].ScoreI := Floor(Player[CP].Score / 10) * 10; - Player[CP].ScoreGoldenI := Floor(Player[CP].ScoreGolden / 10) * 10; - - Player[CP].ScoreTotalI := Player[CP].ScoreI + Player[CP].ScoreGoldenI + Player[CP].ScoreLineI; - end; - end; // operowanie - end; - - // sprawdzanie czy to nowa nuta, czy przedluzenie - if S = SMax then - begin - Nowa := true; - // jezeli ostatnia ma ten sam ton - if (Player[CP].IlNut > 0 ) and (Player[CP].Nuta[Player[CP].HighNut].Ton = Sound[CP].Ton) - and (Player[CP].Nuta[Player[CP].HighNut].Start + Player[CP].Nuta[Player[CP].HighNut].Dlugosc = Czas.AktBeatD) - then - Nowa := false; - - // jezeli jest jakas nowa nuta na sprawdzanym beacie - for Pet := 0 to Czesci[P].Czesc[S].HighNut do - if (Czesci[P].Czesc[S].Nuta[Pet].Start = Czas.AktBeatD) then - Nowa := true; + Player[CP].ScoreI := Floor(Player[CP].Score / 10) * 10; + Player[CP].ScoreGoldenI := Floor(Player[CP].ScoreGolden / 10) * 10; - // dodawanie nowej nuty - if Nowa then - begin - // nowa nuta - Player[CP].IlNut := Player[CP].IlNut + 1; - Player[CP].HighNut := Player[CP].HighNut + 1; - SetLength(Player[CP].Nuta, Player[CP].IlNut); - Player[CP].Nuta[Player[CP].HighNut].Start := Czas.AktBeatD; - Player[CP].Nuta[Player[CP].HighNut].Dlugosc := 1; - Player[CP].Nuta[Player[CP].HighNut].Ton := Sound[CP].Ton; // Ton || TonDokl - Player[CP].Nuta[Player[CP].HighNut].Detekt := Czas.MidBeat; - - // Half Note Patch - Player[CP].Nuta[Player[CP].HighNut].Hit := NoteHit; - end else - begin - // przedluzenie nuty - Player[CP].Nuta[Player[CP].HighNut].Dlugosc := Player[CP].Nuta[Player[CP].HighNut].Dlugosc + 1; + Player[CP].ScoreTotalI := Player[CP].ScoreI + Player[CP].ScoreGoldenI + Player[CP].ScoreLineI; + end; + end; // operowanie end; - - // check for perfect note and then lit the star (on Draw) - for Pet := 0 to Czesci[P].Czesc[S].HighNut do + // checking whether a new note, or extend + if S = SMax then begin - if (Czesci[P].Czesc[S].Nuta[Pet].Start = Player[CP].Nuta[Player[CP].HighNut].Start) - and (Czesci[P].Czesc[S].Nuta[Pet].Dlugosc = Player[CP].Nuta[Player[CP].HighNut].Dlugosc) - and (Czesci[P].Czesc[S].Nuta[Pet].Ton = Player[CP].Nuta[Player[CP].HighNut].Ton) then + Nowa := true; + // if the latter has the same tone + if (Player[CP].IlNut > 0 ) and (Player[CP].Nuta[Player[CP].HighNut].Ton = AktTon) + and (Player[CP].Nuta[Player[CP].HighNut].Start + Player[CP].Nuta[Player[CP].HighNut].Dlugosc = BRange) + then + Nowa := false; + + // If there is a new note on the checked Beat + for Pet := 0 to Czesci[P].Czesc[S].HighNut do + if (Czesci[P].Czesc[S].Nuta[Pet].Start = BRange) then + Nowa := true; + + // add a new note + if Nowa then + begin + // nowa nuta + Player[CP].IlNut := Player[CP].IlNut + 1; + Player[CP].HighNut := Player[CP].HighNut + 1; + SetLength(Player[CP].Nuta, Player[CP].IlNut); + Player[CP].Nuta[Player[CP].HighNut].Start := BRange; + Player[CP].Nuta[Player[CP].HighNut].Dlugosc := 1; + Player[CP].Nuta[Player[CP].HighNut].Ton := AktTon; // Ton || TonDokl + //Player[CP].Nuta[Player[CP].HighNut].Detekt := Czas.MidBeat; + + // Half Note Patch + Player[CP].Nuta[Player[CP].HighNut].Hit := NoteHit; + end else begin - Player[CP].Nuta[Player[CP].HighNut].Perfect := true; + // extend notes + Player[CP].Nuta[Player[CP].HighNut].Dlugosc := Player[CP].Nuta[Player[CP].HighNut].Dlugosc + 1; end; - end;// else beep; // if S = SMax - end; //for - end; // if moze + // check for perfect note and then lit the star (on Draw) + for Pet := 0 to Czesci[P].Czesc[S].HighNut do + begin + if (Czesci[P].Czesc[S].Nuta[Pet].Start = Player[CP].Nuta[Player[CP].HighNut].Start) + and (Czesci[P].Czesc[S].Nuta[Pet].Dlugosc = Player[CP].Nuta[Player[CP].HighNut].Dlugosc) + and (Czesci[P].Czesc[S].Nuta[Pet].Ton = Player[CP].Nuta[Player[CP].HighNut].Ton) then + begin + Player[CP].Nuta[Player[CP].HighNut].Perfect := true; + end; + + end;// else beep; // if S = SMax + end; //for + end; // if moze + end; // for BRange //calc score last SumN := 0; NumS := 0; @@ -758,135 +749,135 @@ begin SMin := 0; SMax := Czesci[P].Akt; - SDet := SMin; - // check if we can add new note - Mozna := false; - for S := SMin to SMax do + for BRange := Czas.OldBeatD+1 to Czas.AktBeatD do begin - for Pet := 0 to Czesci[P].Czesc[S].HighNut do + SDet := SMin; + // check if we can add new note + Mozna := false; + for S := SMin to SMax do begin - if ((Czesci[P].Czesc[S].Nuta[Pet].Start <= Czas.AktBeatD) - and (Czesci[P].Czesc[S].Nuta[Pet].Start + Czesci[P].Czesc[S].Nuta[Pet].Dlugosc - 1 >= Czas.AktBeatD)) - and (not Czesci[P].Czesc[S].Nuta[Pet].FreeStyle) // but don't allow when it's FreeStyle note - and (Czesci[P].Czesc[S].Nuta[Pet].Dlugosc > 0) // and make sure the note lenghts is at least 1 - then + for Pet := 0 to Czesci[P].Czesc[S].HighNut do begin - SDet := S; - Mozna := true; - Break; + if ((Czesci[P].Czesc[S].Nuta[Pet].Start <= BRange) + and (Czesci[P].Czesc[S].Nuta[Pet].Start + Czesci[P].Czesc[S].Nuta[Pet].Dlugosc - 1 >= BRange)) + and (not Czesci[P].Czesc[S].Nuta[Pet].FreeStyle) // but don't allow when it's FreeStyle note + and (Czesci[P].Czesc[S].Nuta[Pet].Dlugosc > 0) // and make sure the note lenghts is at least 1 + then + begin + SDet := S; + Mozna := true; + Break; + end; end; end; - end; - S := SDet; + S := SDet; - if (Sound[CP].SzczytJest or DEBUG_NOTE_HIT) and (Mozna) then - begin - // operowanie na ostatniej nucie - for Pet := 0 to Czesci[P].Czesc[S].HighNut do + if (Sound[CP].SzczytJest or DEBUG_NOTE_HIT) and (Mozna) then begin - if (Czesci[P].Czesc[S].Nuta[Pet].Start <= Czas.OldBeatD+1) - and (Czesci[P].Czesc[S].Nuta[Pet].Start + - Czesci[P].Czesc[S].Nuta[Pet].Dlugosc > Czas.OldBeatD+1) then + // operowanie na ostatniej nucie + for Pet := 0 to Czesci[P].Czesc[S].HighNut do begin - // przesuwanie tonu w odpowiednia game - while (Sound[CP].Ton - Czesci[P].Czesc[S].Nuta[Pet].Ton > 6) do - Sound[CP].Ton := Sound[CP].Ton - 12; - while (Sound[CP].Ton - Czesci[P].Czesc[S].Nuta[Pet].Ton < -6) do - Sound[CP].Ton := Sound[CP].Ton + 12; - - // Half size Notes Patch - NoteHit := false; - - //if Ini.Difficulty = 0 then Range := 2; - //if Ini.Difficulty = 1 then Range := 1; - //if Ini.Difficulty = 2 then Range := 0; - Range := 2 - Ini.Difficulty; - if (abs(Czesci[P].Czesc[S].Nuta[Pet].Ton - Sound[CP].Ton) <= Range) or - DEBUG_NOTE_HIT then + if (Czesci[P].Czesc[S].Nuta[Pet].Start <= BRange) + and (Czesci[P].Czesc[S].Nuta[Pet].Start + + Czesci[P].Czesc[S].Nuta[Pet].Dlugosc > BRange) then begin - Sound[CP].Ton := Czesci[P].Czesc[S].Nuta[Pet].Ton; + // przesuwanie tonu w odpowiednia game + while (Sound[CP].Ton - Czesci[P].Czesc[S].Nuta[Pet].Ton > 6) do + Sound[CP].Ton := Sound[CP].Ton - 12; + while (Sound[CP].Ton - Czesci[P].Czesc[S].Nuta[Pet].Ton < -6) do + Sound[CP].Ton := Sound[CP].Ton + 12; // Half size Notes Patch - NoteHit := true; + NoteHit := false; - if (Ini.LineBonus = 0) then - begin - // add points without LineBonus - case Czesci[P].Czesc[S].Nuta[Pet].Wartosc of - 1: Player[CP].Score := Player[CP].Score + 10000 / Czesci[P].Wartosc * - Czesci[P].Czesc[S].Nuta[Pet].Wartosc; - 2: Player[CP].ScoreGolden := Player[CP].ScoreGolden + 10000 / Czesci[P].Wartosc * - Czesci[P].Czesc[S].Nuta[Pet].Wartosc; - end; - end else + Range := 2 - Ini.Difficulty; + if (abs(Czesci[P].Czesc[S].Nuta[Pet].Ton - Sound[CP].Ton) <= Range) or + DEBUG_NOTE_HIT then begin - // add points with Line Bonus - case Czesci[P].Czesc[S].Nuta[Pet].Wartosc of - 1: Player[CP].Score := Player[CP].Score + 9000 / Czesci[P].Wartosc * - Czesci[P].Czesc[S].Nuta[Pet].Wartosc; - 2: Player[CP].ScoreGolden := Player[CP].ScoreGolden + 9000 / Czesci[P].Wartosc * - Czesci[P].Czesc[S].Nuta[Pet].Wartosc; + AktTon := Czesci[P].Czesc[S].Nuta[Pet].Ton; + + // Half size Notes Patch + NoteHit := true; + + if (Ini.LineBonus = 0) then + begin + // add points without LineBonus + case Czesci[P].Czesc[S].Nuta[Pet].Wartosc of + 1: Player[CP].Score := Player[CP].Score + 10000 / Czesci[P].Wartosc * + Czesci[P].Czesc[S].Nuta[Pet].Wartosc; + 2: Player[CP].ScoreGolden := Player[CP].ScoreGolden + 10000 / Czesci[P].Wartosc * + Czesci[P].Czesc[S].Nuta[Pet].Wartosc; + end; + end else + begin + // add points with Line Bonus + case Czesci[P].Czesc[S].Nuta[Pet].Wartosc of + 1: Player[CP].Score := Player[CP].Score + 9000 / Czesci[P].Wartosc * + Czesci[P].Czesc[S].Nuta[Pet].Wartosc; + 2: Player[CP].ScoreGolden := Player[CP].ScoreGolden + 9000 / Czesci[P].Wartosc * + Czesci[P].Czesc[S].Nuta[Pet].Wartosc; + end; end; - end; - - Player[CP].ScoreI := Floor(Player[CP].Score / 10) * 10; - Player[CP].ScoreGoldenI := Floor(Player[CP].ScoreGolden / 10) * 10; - - Player[CP].ScoreTotalI := Player[CP].ScoreI + Player[CP].ScoreGoldenI + Player[CP].ScoreLineI; - end; - end; // operowanie - end; - // sprawdzanie czy to nowa nuta, czy przedluzenie - if S = SMax then - begin - Nowa := true; - // jezeli ostatnia ma ten sam ton - if (Player[CP].IlNut > 0 ) and (Player[CP].Nuta[Player[CP].HighNut].Ton = Sound[CP].Ton) - and (Player[CP].Nuta[Player[CP].HighNut].Start + Player[CP].Nuta[Player[CP].HighNut].Dlugosc = Czas.AktBeatD) - then - Nowa := false; - - // jezeli jest jakas nowa nuta na sprawdzanym beacie - for Pet := 0 to Czesci[P].Czesc[S].HighNut do - if (Czesci[P].Czesc[S].Nuta[Pet].Start = Czas.AktBeatD) then - Nowa := true; + Player[CP].ScoreI := Floor(Player[CP].Score / 10) * 10; + Player[CP].ScoreGoldenI := Floor(Player[CP].ScoreGolden / 10) * 10; - // dodawanie nowej nuty - if Nowa then - begin - // nowa nuta - Player[CP].IlNut := Player[CP].IlNut + 1; - Player[CP].HighNut := Player[CP].HighNut + 1; - SetLength(Player[CP].Nuta, Player[CP].IlNut); - Player[CP].Nuta[Player[CP].HighNut].Start := Czas.AktBeatD; - Player[CP].Nuta[Player[CP].HighNut].Dlugosc := 1; - Player[CP].Nuta[Player[CP].HighNut].Ton := Sound[CP].Ton; // Ton || TonDokl - Player[CP].Nuta[Player[CP].HighNut].Detekt := Czas.MidBeat; - - // Half Note Patch - Player[CP].Nuta[Player[CP].HighNut].Hit := NoteHit; - end else - begin - // przedluzenie nuty - Player[CP].Nuta[Player[CP].HighNut].Dlugosc := Player[CP].Nuta[Player[CP].HighNut].Dlugosc + 1; + Player[CP].ScoreTotalI := Player[CP].ScoreI + Player[CP].ScoreGoldenI + Player[CP].ScoreLineI; + end; + end; // operowanie end; - - // check for perfect note and then lit the star (on Draw) - for Pet := 0 to Czesci[P].Czesc[S].HighNut do + // sprawdzanie czy to nowa nuta, czy przedluzenie + if S = SMax then begin - if (Czesci[P].Czesc[S].Nuta[Pet].Start = Player[CP].Nuta[Player[CP].HighNut].Start) - and (Czesci[P].Czesc[S].Nuta[Pet].Dlugosc = Player[CP].Nuta[Player[CP].HighNut].Dlugosc) - and (Czesci[P].Czesc[S].Nuta[Pet].Ton = Player[CP].Nuta[Player[CP].HighNut].Ton) then + Nowa := true; + // jezeli ostatnia ma ten sam ton + if (Player[CP].IlNut > 0 ) and (Player[CP].Nuta[Player[CP].HighNut].Ton = AktTon) + and (Player[CP].Nuta[Player[CP].HighNut].Start + Player[CP].Nuta[Player[CP].HighNut].Dlugosc = BRange) + then + Nowa := false; + + // jezeli jest jakas nowa nuta na sprawdzanym beacie + for Pet := 0 to Czesci[P].Czesc[S].HighNut do + if (Czesci[P].Czesc[S].Nuta[Pet].Start = BRange) then + Nowa := true; + + // dodawanie nowej nuty + if Nowa then + begin + // nowa nuta + Player[CP].IlNut := Player[CP].IlNut + 1; + Player[CP].HighNut := Player[CP].HighNut + 1; + SetLength(Player[CP].Nuta, Player[CP].IlNut); + Player[CP].Nuta[Player[CP].HighNut].Start := BRange; + Player[CP].Nuta[Player[CP].HighNut].Dlugosc := 1; + Player[CP].Nuta[Player[CP].HighNut].Ton := AktTon; // Ton || TonDokl + //Player[CP].Nuta[Player[CP].HighNut].Detekt := Czas.MidBeat; + + // Half Note Patch + Player[CP].Nuta[Player[CP].HighNut].Hit := NoteHit; + end else begin - Player[CP].Nuta[Player[CP].HighNut].Perfect := true; + // przedluzenie nuty + Player[CP].Nuta[Player[CP].HighNut].Dlugosc := Player[CP].Nuta[Player[CP].HighNut].Dlugosc + 1; end; - end;// else beep; // if S = SMax - end; //for - end; // if moze + + // check for perfect note and then lit the star (on Draw) + for Pet := 0 to Czesci[P].Czesc[S].HighNut do + begin + if (Czesci[P].Czesc[S].Nuta[Pet].Start = Player[CP].Nuta[Player[CP].HighNut].Start) + and (Czesci[P].Czesc[S].Nuta[Pet].Dlugosc = Player[CP].Nuta[Player[CP].HighNut].Dlugosc) + and (Czesci[P].Czesc[S].Nuta[Pet].Ton = Player[CP].Nuta[Player[CP].HighNut].Ton) then + begin + Player[CP].Nuta[Player[CP].HighNut].Perfect := true; + end; + + end;// else beep; // if S = SMax + end; //for + end; // if moze + end; // for BRange //calc score last SumN := 0; diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index 25cec01b..3d1fa79c 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -523,6 +523,7 @@ type //Song Preview SelectSlidePreviewVolume: TThemeSelectSlide; SelectSlidePreviewFading: TThemeSelectSlide; + SelectSlideDelay: TThemeSelectSlide; ButtonExit: TThemeButton; end; @@ -1497,6 +1498,7 @@ begin //Song Preview ThemeLoadSelectSlide(OptionsSound.SelectSlidePreviewVolume, 'OptionsSoundSelectSlidePreviewVolume'); ThemeLoadSelectSlide(OptionsSound.SelectSlidePreviewFading, 'OptionsSoundSelectSlidePreviewFading'); + ThemeLoadSelectSlide(OptionsSound.SelectSlideDelay, 'OptionsSoundSelectSlideDelay'); ThemeLoadButton(OptionsSound.ButtonExit, 'OptionsSoundButtonExit'); diff --git a/Game/Code/Screens/UScreenOptionsSound.pas b/Game/Code/Screens/UScreenOptionsSound.pas index b9969aa5..5f842589 100644 --- a/Game/Code/Screens/UScreenOptionsSound.pas +++ b/Game/Code/Screens/UScreenOptionsSound.pas @@ -45,7 +45,8 @@ begin end; SDLK_RETURN: begin - if SelInteraction = 6 then begin + if SelInteraction = 7 then + begin Ini.Save; Music.PlayBack; ScreenSong.MP3Volume := Ini.PreviewVolume * 10; @@ -58,14 +59,16 @@ begin InteractPrev; SDLK_RIGHT: begin - if (SelInteraction >= 0) and (SelInteraction <= 5) then begin + if (SelInteraction >= 0) and (SelInteraction <= 6) then + begin Music.PlayOption; InteractInc; end; end; SDLK_LEFT: begin - if (SelInteraction >= 0) and (SelInteraction <= 5) then begin + if (SelInteraction >= 0) and (SelInteraction <= 6) then + begin Music.PlayOption; InteractDec; end; @@ -87,8 +90,9 @@ begin //Song Preview AddSelectSlide(Theme.OptionsSound.SelectSlidePreviewVolume, Ini.PreviewVolume, IPreviewVolume); - AddSelectSlide - (Theme.OptionsSound.SelectSlidePreviewFading, Ini.PreviewFading, IPreviewFading); + AddSelectSlide(Theme.OptionsSound.SelectSlidePreviewFading, Ini.PreviewFading, IPreviewFading); + + AddSelectSlide(Theme.OptionsSound.SelectSlideDelay, Ini.Delay, IDelay); AddButton(Theme.OptionsSound.ButtonExit); if (Length(Button[0].Text)=0) then -- cgit v1.2.3