From 873f177f08dc7c4fe2d7e50bbe7709df98e238d3 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Wed, 27 Aug 2008 14:58:32 +0000 Subject: rename Screen part2 git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1306 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 934 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 934 insertions(+) create mode 100644 src/screens/UScreenSing.pas (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas new file mode 100644 index 00000000..911d122e --- /dev/null +++ b/src/screens/UScreenSing.pas @@ -0,0 +1,934 @@ +unit UScreenSing; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + + +uses UMenu, + UMusic, + SDL, + SysUtils, + UFiles, + UTime, + USongs, + UIni, + ULog, + UTexture, + ULyrics, + TextGL, + gl, + UThemes, + UGraphicClasses, + USingScores; + +type + TLyricsSyncSource = class(TSyncSource) + function GetClock(): real; override; + end; + +type + TScreenSing = class(TMenu) + protected + Paused: boolean; //Pause Mod + LyricsSync: TLyricsSyncSource; + NumEmptySentences: integer; + public + //TextTime: integer; + + // TimeBar fields + StaticTimeProgress: integer; + TextTimeText: integer; + + StaticP1: integer; + TextP1: integer; + + //shown when game is in 2/4 player modus + StaticP1TwoP: integer; + TextP1TwoP: integer; + + //shown when game is in 3/6 player modus + StaticP1ThreeP: integer; + TextP1ThreeP: integer; + + StaticP2R: integer; + TextP2R: integer; + + StaticP2M: integer; + TextP2M: integer; + + StaticP3R: integer; + TextP3R: integer; + + StaticPausePopup: integer; + + Tex_Background: TTexture; + FadeOut: boolean; + Lyrics: TLyricEngine; + + //Score Manager: + Scores: TSingScores; + + fShowVisualization: boolean; + fCurrentVideoPlaybackEngine: IVideoPlayback; + + constructor Create; override; + procedure onShow; override; + procedure onShowFinish; override; + + function ParseInput(PressedKey: cardinal; CharCode: widechar; + PressedDown: boolean): boolean; override; + function Draw: boolean; override; + + procedure Finish; virtual; + procedure Pause; // Toggle Pause + + procedure OnSentenceEnd(SentenceIndex: cardinal); // for LineBonus + Singbar + procedure OnSentenceChange(SentenceIndex: cardinal); // for Golden Notes + end; + +implementation + +uses UGraphic, + UDraw, + UMain, + USong, + Classes, + URecord, + ULanguage, + Math; + + // Method for input parsing. If False is returned, GetNextWindow + // should be checked to know the next window to load; +function TScreenSing.ParseInput(PressedKey: cardinal; CharCode: widechar; + PressedDown: boolean): boolean; +begin + Result := True; + if (PressedDown) then + begin // Key Down + // check normal keys + case WideCharUpperCase(CharCode)[1] of + 'Q': + begin + //When not ask before Exit then Finish now + if (Ini.AskbeforeDel <> 1) then + Finish + //else just Pause and let the Popup make the Work + else if not Paused then + Pause; + + Result := False; + Exit; + end; + 'V': //Show Visualization + begin + fShowVisualization := not fShowVisualization; + + if fShowVisualization then + fCurrentVideoPlaybackEngine := Visualization + else + fCurrentVideoPlaybackEngine := VideoPlayback; + + if fShowVisualization then + fCurrentVideoPlaybackEngine.play; + + Exit; + end; + 'P': + begin + Pause; + Exit; + end; + end; + + // check special keys + case PressedKey of + SDLK_ESCAPE, + SDLK_BACKSPACE: + begin + //Record Sound Hack: + //Sound[0].BufferLong + + Finish; + AudioPlayback.PlaySound(SoundLib.Back); + FadeTo(@ScreenScore); + end; + + SDLK_SPACE: + begin + Pause; + end; + + SDLK_TAB: //Change Visualization Preset + begin + if fShowVisualization then + fCurrentVideoPlaybackEngine.Position := now; // move to a random position + end; + + SDLK_RETURN: + begin + end; + + // Up and Down could be done at the same time, + // but I don't want to declare variables inside + // functions like this one, called so many times + SDLK_DOWN: + begin + end; + SDLK_UP: + begin + end; + end; + end; +end; + +//Pause Mod +procedure TScreenSing.Pause; +begin + if (not Paused) then //enable Pause + begin + // pause Time + Paused := True; + + LyricsState.Pause(); + + // pause Music + AudioPlayback.Pause; + + // pause Video + if (CurrentSong.Video <> '') and FileExists(CurrentSong.Path + + CurrentSong.Video) then + fCurrentVideoPlaybackEngine.Pause; + + end + else //disable Pause + begin + LyricsState.Resume(); + + // Play Music + AudioPlayback.Play; + + // Video + if (CurrentSong.Video <> '') and FileExists(CurrentSong.Path + + CurrentSong.Video) then + fCurrentVideoPlaybackEngine.Pause; + + Paused := False; + end; +end; +//Pause Mod End + +constructor TScreenSing.Create; +var + I: integer; + P: integer; +begin + inherited Create; + + fShowVisualization := False; + + fCurrentVideoPlaybackEngine := VideoPlayback; + + //Create Score Class + Scores := TSingScores.Create; + Scores.LoadfromTheme; + + LoadFromTheme(Theme.Sing); + + //TimeBar + StaticTimeProgress := AddStatic(Theme.Sing.StaticTimeProgress); + TextTimeText := AddText(Theme.Sing.TextTimeText); + + // 1 player | P1 + StaticP1 := AddStatic(Theme.Sing.StaticP1); + TextP1 := AddText(Theme.Sing.TextP1); + + // 2 or 4 players | P1 + StaticP1TwoP := AddStatic(Theme.Sing.StaticP1TwoP); + TextP1TwoP := AddText(Theme.Sing.TextP1TwoP); + + // | P2 + StaticP2R := AddStatic(Theme.Sing.StaticP2R); + TextP2R := AddText(Theme.Sing.TextP2R); + + // 3 or 6 players | P1 + StaticP1ThreeP := AddStatic(Theme.Sing.StaticP1ThreeP); + TextP1ThreeP := AddText(Theme.Sing.TextP1ThreeP); + + // | P2 + StaticP2M := AddStatic(Theme.Sing.StaticP2M); + TextP2M := AddText(Theme.Sing.TextP2M); + + // | P3 + StaticP3R := AddStatic(Theme.Sing.StaticP3R); + TextP3R := AddText(Theme.Sing.TextP3R); + + StaticPausePopup := AddStatic(Theme.Sing.PausePopUp); + + //Pausepopup is not visibile at the beginning + Static[StaticPausePopup].Visible := False; + + Lyrics := TLyricEngine.Create(80, Skin_LyricsT, 640, 12, 80, Skin_LyricsT + 36, 640, 12); + + LyricsSync := TLyricsSyncSource.Create(); +end; + +procedure TScreenSing.onShow; +var + P: integer; + V1: boolean; + V1TwoP: boolean; //Position of ScoreBox in two-player mode + V1ThreeP: boolean; //Position of ScoreBox in three-player mode + V2R: boolean; + V2M: boolean; + V3R: boolean; + NR: TRecR; //Some enlightment of who, how and what this is here please + Color: TRGB; + + success: boolean; +begin + inherited; + + Log.LogStatus('Begin', 'onShow'); + FadeOut := False; + + // reset video playback engine, to play Video Clip... + fCurrentVideoPlaybackEngine := VideoPlayback; + + // setup score manager + Scores.ClearPlayers; // clear old player values + Color.R := 0; + Color.G := 0; + Color.B := 0; // dummy atm <- \(O.o)/? B like bummy? + + // add new players + for P := 0 to PlayersPlay - 1 do + begin + Scores.AddPlayer(Tex_ScoreBG[P], Color); + end; + + Scores.Init; //Get Positions for Players + + // prepare players + SetLength(Player, PlayersPlay); + + case PlayersPlay of + 1: + begin + V1 := True; + V1TwoP := False; + V1ThreeP := False; + V2R := False; + V2M := False; + V3R := False; + end; + 2: + begin + V1 := False; + V1TwoP := True; + V1ThreeP := False; + V2R := True; + V2M := False; + V3R := False; + end; + 3: + begin + V1 := False; + V1TwoP := False; + V1ThreeP := True; + V2R := False; + V2M := True; + V3R := True; + end; + 4: + begin // double screen + V1 := False; + V1TwoP := True; + V1ThreeP := False; + V2R := True; + V2M := False; + V3R := False; + end; + 6: + begin // double screen + V1 := False; + V1TwoP := False; + V1ThreeP := True; + V2R := False; + V2M := True; + V3R := True; + end; + + end; + + //This one is shown in 1P mode + Static[StaticP1].Visible := V1; + Text[TextP1].Visible := V1; + + + //This one is shown in 2/4P mode + Static[StaticP1TwoP].Visible := V1TwoP; + Text[TextP1TwoP].Visible := V1TwoP; + + Static[StaticP2R].Visible := V2R; + Text[TextP2R].Visible := V2R; + + + //This one is shown in 3/6P mode + Static[StaticP1ThreeP].Visible := V1ThreeP; + Text[TextP1ThreeP].Visible := V1ThreeP; + + + Static[StaticP2M].Visible := V2M; + Text[TextP2M].Visible := V2M; + + + Static[StaticP3R].Visible := V3R; + Text[TextP3R].Visible := V3R; + + + // FIXME: sets Path and Filename to '' + ResetSingTemp; + + CurrentSong := CatSongs.Song[CatSongs.Selected]; + + // FIXME: bad style, put the try-except into LoadSong() and not here + try + // Check if file is XML + if copy(CurrentSong.FileName, length(CurrentSong.FileName) - 3, 4) = '.xml' then + success := CurrentSong.LoadXMLSong() + else + success := CurrentSong.LoadSong(); + except + success := False; + end; + + if (not success) then + begin + // error loading song -> go back to song screen and show some error message + FadeTo(@ScreenSong); + // select new song in party mode + if ScreenSong.Mode = smPartyMode then + ScreenSong.SelectRandomSong(); + ScreenPopupError.ShowPopup(Language.Translate('ERROR_CORRUPT_SONG')); + // FIXME: do we need this? + CurrentSong.Path := CatSongs.Song[CatSongs.Selected].Path; + Exit; + end; + + // reset video playback engine, to play video clip... + fCurrentVideoPlaybackEngine.Close; + fCurrentVideoPlaybackEngine := VideoPlayback; +{** + * == Background == + * We have four types of backgrounds: + * + Blank : Nothing has been set, this is our fallback + * + Picture : Picture has been set, and exists - otherwise we fallback + * + Video : Video has been set, and exists - otherwise we fallback + * + Visualization: + Off : No Visialization + * + WhenNoVideo: Overwrites Blank and Picture + * + On : Overwrites Blank, Picture and Video + *} +{** + * set background to: video + *} + CurrentSong.VideoLoaded := False; + fShowVisualization := False; + if (CurrentSong.Video <> '') and FileExists(CurrentSong.Path + CurrentSong.Video) then + begin + if (fCurrentVideoPlaybackEngine.Open(CurrentSong.Path + CurrentSong.Video)) then + begin + fShowVisualization := False; + fCurrentVideoPlaybackEngine := VideoPlayback; + fCurrentVideoPlaybackEngine.Position := CurrentSong.VideoGAP + CurrentSong.Start; + CurrentSong.VideoLoaded := True; + fCurrentVideoPlaybackEngine.play; + end; + end; + +{** + * set background to: picture + *} + if (CurrentSong.Background <> '') and (CurrentSong.VideoLoaded = False) + and (TVisualizerOption(Ini.VisualizerOption) = voOff) then + try + Tex_Background := Texture.LoadTexture(CurrentSong.Path + CurrentSong.Background); + except + Log.LogError('Background could not be loaded: ' + CurrentSong.Path + + CurrentSong.Background); + Tex_Background.TexNum := 0; + end + else + Tex_Background.TexNum := 0; +{** + * set background to: visualization (Overwrites all) + *} + if (TVisualizerOption(Ini.VisualizerOption) in [voOn]) then + begin + fShowVisualization := True; + fCurrentVideoPlaybackEngine := Visualization; + fCurrentVideoPlaybackEngine.play; + end; + +{** + * set background to: visualization (Videos are still shown) + *} + if ((TVisualizerOption(Ini.VisualizerOption) in [voWhenNoVideo]) and + (CurrentSong.VideoLoaded = False)) then + begin + fShowVisualization := True; + fCurrentVideoPlaybackEngine := Visualization; + fCurrentVideoPlaybackEngine.play; + end; + + // prepare lyrics timer + LyricsState.Reset(); + LyricsState.SetCurrentTime(CurrentSong.Start); + LyricsState.StartTime := CurrentSong.Gap; + if (CurrentSong.Finish > 0) then + LyricsState.TotalTime := CurrentSong.Finish / 1000 + else + LyricsState.TotalTime := AudioPlayback.Length; + LyricsState.UpdateBeats(); + + // prepare music + AudioPlayback.Stop(); + AudioPlayback.Position := CurrentSong.Start; + // synchronize music to the lyrics + AudioPlayback.SetSyncSource(LyricsSync); + + // prepare and start voice-capture + AudioInput.CaptureStart; + + for P := 0 to High(Player) do + ClearScores(P); + + // main text + Lyrics.Clear(CurrentSong.BPM[0].BPM, CurrentSong.Resolution); + + // set custom options + case Ini.LyricsFont of + 0: + begin + Lyrics.UpperLineSize := 14; + Lyrics.LowerLineSize := 14; + Lyrics.FontStyle := 0; + + Lyrics.LineColor_en.R := Skin_FontR; + Lyrics.LineColor_en.G := Skin_FontG; + Lyrics.LineColor_en.B := Skin_FontB; + Lyrics.LineColor_en.A := 1; + + Lyrics.LineColor_dis.R := 0.4; + Lyrics.LineColor_dis.G := 0.4; + Lyrics.LineColor_dis.B := 0.4; + Lyrics.LineColor_dis.A := 1; + + Lyrics.LineColor_act.R := 5 / 256; + Lyrics.LineColor_act.G := 163 / 256; + Lyrics.LineColor_act.B := 210 / 256; + Lyrics.LineColor_act.A := 1; + end; + 1: + begin + Lyrics.UpperLineSize := 14; + Lyrics.LowerLineSize := 14; + Lyrics.FontStyle := 2; + + Lyrics.LineColor_en.R := 0.75; + Lyrics.LineColor_en.G := 0.75; + Lyrics.LineColor_en.B := 1; + Lyrics.LineColor_en.A := 1; + + Lyrics.LineColor_dis.R := 0.8; + Lyrics.LineColor_dis.G := 0.8; + Lyrics.LineColor_dis.B := 0.8; + Lyrics.LineColor_dis.A := 1; + + Lyrics.LineColor_act.R := 0.5; + Lyrics.LineColor_act.G := 0.5; + Lyrics.LineColor_act.B := 1; + Lyrics.LineColor_act.A := 1; + end; + 2: + begin + Lyrics.UpperLineSize := 12; + Lyrics.LowerLineSize := 12; + Lyrics.FontStyle := 3; + + Lyrics.LineColor_en.R := 0.75; + Lyrics.LineColor_en.G := 0.75; + Lyrics.LineColor_en.B := 1; + Lyrics.LineColor_en.A := 1; + + Lyrics.LineColor_dis.R := 0.8; + Lyrics.LineColor_dis.G := 0.8; + Lyrics.LineColor_dis.B := 0.8; + Lyrics.LineColor_dis.A := 1; + + Lyrics.LineColor_act.R := 0.5; + Lyrics.LineColor_act.G := 0.5; + Lyrics.LineColor_act.B := 1; + Lyrics.LineColor_act.A := 1; + end; + end; // case + + // Initialize lyrics by filling its queue + while (not Lyrics.IsQueueFull) and (Lyrics.LineCounter <= + High(Lines[0].Line)) do + begin + Lyrics.AddLine(@Lines[0].Line[Lyrics.LineCounter]); + end; + + // Deactivate pause + Paused := False; + + // Kill all stars not killed yet (GoldenStarsTwinkle Mod) + GoldenRec.SentenceChange; + + // set Position of Line Bonus - Line Bonus end + // set number of empty sentences for Line Bonus + NumEmptySentences := 0; + for P := Low(Lines[0].Line) to High(Lines[0].Line) do + if Lines[0].Line[P].TotalNotes = 0 then + Inc(NumEmptySentences); + + Log.LogStatus('End', 'onShow'); +end; + +procedure TScreenSing.onShowFinish; +begin + // start lyrics + LyricsState.Resume(); + + // start music + AudioPlayback.Play(); + + // start timer + CountSkipTimeSet; +end; + +function TScreenSing.Draw: boolean; +var + Min: integer; + Sec: integer; + Tekst: string; + Flash: real; + S: integer; + T: integer; + CurLyricsTime: real; +begin + + // set player names (for 2 screens and only Singstar skin) + if ScreenAct = 1 then + begin + Text[TextP1].Text := 'P1'; + Text[TextP1TwoP].Text := 'P1'; + Text[TextP1ThreeP].Text := 'P1'; + Text[TextP2R].Text := 'P2'; + Text[TextP2M].Text := 'P2'; + Text[TextP3R].Text := 'P3'; + end; + + if ScreenAct = 2 then + begin + case PlayersPlay of + 4: + begin + Text[TextP1TwoP].Text := 'P3'; + Text[TextP2R].Text := 'P4'; + end; + 6: + begin + Text[TextP1ThreeP].Text := 'P4'; + Text[TextP2M].Text := 'P5'; + Text[TextP3R].Text := 'P6'; + end; + end; // case + end; // if + + + //// + // dual screen, part 1 + //////////////////////// + + // Note: ScreenX is the offset of the current screen in dual-screen mode so we + // will move the statics and texts to the correct screen here. + // FIXME: clean up this weird stuff. Commenting this stuff out, nothing + // was missing on screen w/ 6 players - so do we even need this stuff? + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10 * ScreenX; + + Text[TextP1].X := Text[TextP1].X + 10 * ScreenX; + + {Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX;} + + + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10 * ScreenX; + + Text[TextP2R].X := Text[TextP2R].X + 10 * ScreenX; + + {Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX;} + + // end of weird stuff + + Static[1].Texture.X := Static[1].Texture.X + 10 * ScreenX; + + for T := 0 to 1 do + Text[T].X := Text[T].X + 10 * ScreenX; + + + + // retrieve current lyrics time, we have to store the value to avoid + // that min- and sec-values do not match + CurLyricsTime := LyricsState.GetCurrentTime(); + Min := Round(CurLyricsTime) div 60; + Sec := Round(CurLyricsTime) mod 60; + + // update static menu with time ... + Text[TextTimeText].Text := ''; + if Min < 10 then + Text[TextTimeText].Text := '0'; + Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Min) + ':'; + if Sec < 10 then + Text[TextTimeText].Text := Text[TextTimeText].Text + '0'; + Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Sec); + + // draw static menu (BG) + // Note: there is no menu and the animated background brakes the video playback + //DrawBG; + + // Draw Background + SingDrawBackground; + + // update and draw movie + if (ShowFinish and (CurrentSong.VideoLoaded or fShowVisualization)) then + begin + if assigned(fCurrentVideoPlaybackEngine) then + begin + fCurrentVideoPlaybackEngine.GetFrame(LyricsState.GetCurrentTime()); + fCurrentVideoPlaybackEngine.DrawGL(ScreenAct); + end; + end; + + // draw static menu (FG) + DrawFG; + + // check for music finish + //Log.LogError('Check for music finish: ' + BoolToStr(Music.Finished) + ' ' + FloatToStr(LyricsState.CurrentTime*1000) + ' ' + IntToStr(CurrentSong.Finish)); + if ShowFinish then + begin + if (not AudioPlayback.Finished) and ((CurrentSong.Finish = 0) or + (LyricsState.GetCurrentTime() * 1000 <= CurrentSong.Finish)) then + begin + // analyze song if not paused + if (not Paused) then + Sing(Self); + end + else + begin + if (not FadeOut) then + begin + Finish; + FadeOut := True; + FadeTo(@ScreenScore); + end; + end; + end; + + // always draw custom items + SingDraw; + + //GoldenNoteStarsTwinkle + GoldenRec.SpawnRec; + + //Draw Scores + Scores.Draw; + + //// + // dual screen, part 2 + //////////////////////// + + // Note: ScreenX is the offset of the current screen in dual-screen mode so we + // will move the statics and texts to the correct screen here. + // FIXME: clean up this weird stuff + + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10 * ScreenX; + Text[TextP1].X := Text[TextP1].X - 10 * ScreenX; + + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10 * ScreenX; + Text[TextP2R].X := Text[TextP2R].X - 10 * ScreenX; + + //end of weird + + Static[1].Texture.X := Static[1].Texture.X - 10 * ScreenX; + + for T := 0 to 1 do + Text[T].X := Text[T].X - 10 * ScreenX; + + // Draw Pausepopup + // FIXME: this is a workaround that the Static is drawn over the Lyrics, Lines, Scores and Effects + // maybe someone could find a better solution + if Paused then + begin + Static[StaticPausePopup].Visible := True; + Static[StaticPausePopup].Draw; + Static[StaticPausePopup].Visible := False; + end; + + Result := True; +end; + +procedure TScreenSing.Finish; +begin + AudioInput.CaptureStop; + AudioPlayback.Stop; + AudioPlayback.SetSyncSource(nil); + + if (Ini.SavePlayback = 1) then + begin + Log.BenchmarkStart(0); + Log.LogVoice(0); + Log.LogVoice(1); + Log.LogVoice(2); + Log.BenchmarkEnd(0); + Log.LogBenchmark('Creating files', 0); + end; + + if CurrentSong.VideoLoaded then + begin + fCurrentVideoPlaybackEngine.Close; + CurrentSong.VideoLoaded := False; // to prevent drawing closed video + end; + + SetFontItalic(False); +end; + +procedure TScreenSing.OnSentenceEnd(SentenceIndex: cardinal); +var + PlayerIndex: integer; + CurrentPlayer: PPLayer; + CurrentScore: real; + Line: PLine; + LinePerfection: real; // perfection of singing performance on the current line + Rating: integer; + LineScore: real; + LineBonus: real; + MaxSongScore: integer; // max. points for the song (without line bonus) + MaxLineScore: real; // max. points for the current line +const + // TODO: move this to a better place + MAX_LINE_RATING = 8; // max. rating for singing performance +begin + Line := @Lines[0].Line[SentenceIndex]; + + // check for empty sentence + if (Line.TotalNotes <= 0) then + Exit; + + // set max song score + if (Ini.LineBonus = 0) then + MaxSongScore := MAX_SONG_SCORE + else + MaxSongScore := MAX_SONG_SCORE - MAX_SONG_LINE_BONUS; + + // Note: ScoreValue is the sum of all note values of the song + MaxLineScore := MaxSongScore * (Line.TotalNotes / Lines[0].ScoreValue); + + for PlayerIndex := 0 to High(Player) do + begin + CurrentPlayer := @Player[PlayerIndex]; + CurrentScore := CurrentPlayer.Score + CurrentPlayer.ScoreGolden; + + // Line Bonus + + // points for this line + LineScore := CurrentScore - CurrentPlayer.ScoreLast; + + // determine LinePerfection + // Note: the "+2" extra points are a little bonus so the player does not + // have to be that perfect to reach the bonus steps. + LinePerfection := (LineScore + 2) / MaxLineScore; + + // clamp LinePerfection to range [0..1] + if (LinePerfection < 0) then + LinePerfection := 0 + else if (LinePerfection > 1) then + LinePerfection := 1; + + // add line-bonus if enabled + if (Ini.LineBonus > 0) then + begin + // line-bonus points (same for each line, no matter how long the line is) + LineBonus := MAX_SONG_LINE_BONUS / (Length(Lines[0].Line) - + NumEmptySentences); + // apply line-bonus + CurrentPlayer.ScoreLine := + CurrentPlayer.ScoreLine + LineBonus * LinePerfection; + CurrentPlayer.ScoreLineInt := Round(CurrentPlayer.ScoreLine / 10) * 10; + // update total score + CurrentPlayer.ScoreTotalInt := + CurrentPlayer.ScoreInt + + CurrentPlayer.ScoreGoldenInt + + CurrentPlayer.ScoreLineInt; + + // spawn rating pop-up + Rating := Round(LinePerfection * MAX_LINE_RATING); + Scores.SpawnPopUp(PlayerIndex, Rating, CurrentPlayer.ScoreTotalInt); + end; + + // PerfectLineTwinkle (effect), Part 1 + if (Ini.EffectSing = 1) then + CurrentPlayer.LastSentencePerfect := (LinePerfection >= 1); + + // refresh last score + CurrentPlayer.ScoreLast := CurrentScore; + end; + + // PerfectLineTwinkle (effect), Part 2 + if (Ini.EffectSing = 1) then + GoldenRec.SpawnPerfectLineTwinkle; +end; + + // Called on sentence change + // SentenceIndex: index of the new active sentence +procedure TScreenSing.OnSentenceChange(SentenceIndex: cardinal); +var + LyricEngine: TLyricEngine; +begin + //GoldenStarsTwinkle + GoldenRec.SentenceChange; + + // Fill lyrics queue and set upper line to the current sentence + while (Lyrics.GetUpperLineIndex() < SentenceIndex) or + (not Lyrics.IsQueueFull) do + begin + // Add the next line to the queue or a dummy if no more lines are available + if (Lyrics.LineCounter <= High(Lines[0].Line)) then + Lyrics.AddLine(@Lines[0].Line[Lyrics.LineCounter]) + else + Lyrics.AddLine(nil); + end; + + // AddLine draws the passed line to the back-buffer of the render context + // and copies it into a texture afterwards (offscreen rendering). + // This leaves an in invalidated screen. Calling Draw() makes sure, + // that the back-buffer stores the sing-screen, when the next + // swap between the back- and front-buffer is done (eliminates flickering) + // calling AddLine() right before the regular screen update (Display.Draw) + // would be a better solution. + Draw; +end; + +function TLyricsSyncSource.GetClock(): real; +begin + Result := LyricsState.GetCurrentTime(); +end; + +end. + -- cgit v1.2.3 From c1814154c5dc76654aef640353693553a6a38381 Mon Sep 17 00:00:00 2001 From: tobigun Date: Sat, 13 Sep 2008 10:59:55 +0000 Subject: Unload background textures when leaving the sing-screen. Thanks to Hawkear for the patch. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1377 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 911d122e..e20a142d 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -79,7 +79,8 @@ type constructor Create; override; procedure onShow; override; procedure onShowFinish; override; - + procedure onHide; override; + function ParseInput(PressedKey: cardinal; CharCode: widechar; PressedDown: boolean): boolean; override; function Draw: boolean; override; @@ -612,6 +613,16 @@ begin CountSkipTimeSet; end; +procedure TScreenSing.onHide; +begin + // Unload background texture + if (Tex_Background.TexNum > 0) then + begin + glDeleteTextures(1, PGLuint(@Tex_Background.TexNum)); + Tex_Background.TexNum := 0; + end; +end; + function TScreenSing.Draw: boolean; var Min: integer; -- cgit v1.2.3 From a40eb015f8dc43ee087bb8374e67c6a75eb9fbc6 Mon Sep 17 00:00:00 2001 From: tobigun Date: Sat, 13 Sep 2008 13:02:27 +0000 Subject: - stop both Video and Visualizer (because of the video-toggle with 'v'-key both could have been active) (See SF-tracker Patch 2078902) - VideoLoaded does not belong to the song state anymore git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1381 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 92 +++++++++++++++++++++++++-------------------- 1 file changed, 51 insertions(+), 41 deletions(-) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index e20a142d..b8c7612f 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -33,13 +33,13 @@ type type TScreenSing = class(TMenu) + private + VideoLoaded: boolean; protected Paused: boolean; //Pause Mod LyricsSync: TLyricsSyncSource; NumEmptySentences: integer; public - //TextTime: integer; - // TimeBar fields StaticTimeProgress: integer; TextTimeText: integer; @@ -424,21 +424,23 @@ begin // reset video playback engine, to play video clip... fCurrentVideoPlaybackEngine.Close; fCurrentVideoPlaybackEngine := VideoPlayback; -{** - * == Background == - * We have four types of backgrounds: - * + Blank : Nothing has been set, this is our fallback - * + Picture : Picture has been set, and exists - otherwise we fallback - * + Video : Video has been set, and exists - otherwise we fallback - * + Visualization: + Off : No Visialization - * + WhenNoVideo: Overwrites Blank and Picture - * + On : Overwrites Blank, Picture and Video - *} -{** - * set background to: video - *} - CurrentSong.VideoLoaded := False; - fShowVisualization := False; + + {* + * == Background == + * We have four types of backgrounds: + * + Blank : Nothing has been set, this is our fallback + * + Picture : Picture has been set, and exists - otherwise we fallback + * + Video : Video has been set, and exists - otherwise we fallback + * + Visualization: + Off : No Visialization + * + WhenNoVideo: Overwrites Blank and Picture + * + On : Overwrites Blank, Picture and Video + *} + + {* + * set background to: video + *} + VideoLoaded := False; + fShowVisualization := False; if (CurrentSong.Video <> '') and FileExists(CurrentSong.Path + CurrentSong.Video) then begin if (fCurrentVideoPlaybackEngine.Open(CurrentSong.Path + CurrentSong.Video)) then @@ -446,15 +448,15 @@ begin fShowVisualization := False; fCurrentVideoPlaybackEngine := VideoPlayback; fCurrentVideoPlaybackEngine.Position := CurrentSong.VideoGAP + CurrentSong.Start; - CurrentSong.VideoLoaded := True; - fCurrentVideoPlaybackEngine.play; + fCurrentVideoPlaybackEngine.Play; + VideoLoaded := True; end; end; -{** - * set background to: picture - *} - if (CurrentSong.Background <> '') and (CurrentSong.VideoLoaded = False) + {* + * set background to: picture + *} + if (CurrentSong.Background <> '') and (VideoLoaded = False) and (TVisualizerOption(Ini.VisualizerOption) = voOff) then try Tex_Background := Texture.LoadTexture(CurrentSong.Path + CurrentSong.Background); @@ -464,26 +466,31 @@ begin Tex_Background.TexNum := 0; end else + begin Tex_Background.TexNum := 0; -{** - * set background to: visualization (Overwrites all) - *} + end; + + {* + * set background to: visualization (Overwrites all) + *} if (TVisualizerOption(Ini.VisualizerOption) in [voOn]) then begin fShowVisualization := True; fCurrentVideoPlaybackEngine := Visualization; - fCurrentVideoPlaybackEngine.play; + if (fCurrentVideoPlaybackEngine <> nil) then + fCurrentVideoPlaybackEngine.Play; end; -{** - * set background to: visualization (Videos are still shown) - *} + {* + * set background to: visualization (Videos are still shown) + *} if ((TVisualizerOption(Ini.VisualizerOption) in [voWhenNoVideo]) and - (CurrentSong.VideoLoaded = False)) then + (VideoLoaded = False)) then begin fShowVisualization := True; fCurrentVideoPlaybackEngine := Visualization; - fCurrentVideoPlaybackEngine.play; + if (fCurrentVideoPlaybackEngine <> nil) then + fCurrentVideoPlaybackEngine.Play; end; // prepare lyrics timer @@ -579,8 +586,8 @@ begin end; // case // Initialize lyrics by filling its queue - while (not Lyrics.IsQueueFull) and (Lyrics.LineCounter <= - High(Lines[0].Line)) do + while (not Lyrics.IsQueueFull) and + (Lyrics.LineCounter <= High(Lines[0].Line)) do begin Lyrics.AddLine(@Lines[0].Line[Lyrics.LineCounter]); end; @@ -718,7 +725,7 @@ begin SingDrawBackground; // update and draw movie - if (ShowFinish and (CurrentSong.VideoLoaded or fShowVisualization)) then + if (ShowFinish and (VideoLoaded or fShowVisualization)) then begin if assigned(fCurrentVideoPlaybackEngine) then begin @@ -801,6 +808,15 @@ begin AudioPlayback.Stop; AudioPlayback.SetSyncSource(nil); + if (VideoPlayback <> nil) then + VideoPlayback.Close; + + if (Visualization <> nil) then + Visualization.Close; + + // to prevent drawing closed video + VideoLoaded := False; + if (Ini.SavePlayback = 1) then begin Log.BenchmarkStart(0); @@ -811,12 +827,6 @@ begin Log.LogBenchmark('Creating files', 0); end; - if CurrentSong.VideoLoaded then - begin - fCurrentVideoPlaybackEngine.Close; - CurrentSong.VideoLoaded := False; // to prevent drawing closed video - end; - SetFontItalic(False); end; -- cgit v1.2.3 From f16756422a5dbb24ce1b751bb9e2bb1de4f19713 Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 23 Sep 2008 21:17:50 +0000 Subject: added file headers git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1404 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index b8c7612f..e280855d 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -1,3 +1,28 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + *} + unit UScreenSing; interface -- cgit v1.2.3 From e5222f99929e0a893fca4ea0ffe08c3bb90fd5c3 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 28 Sep 2008 16:30:08 +0000 Subject: Songclass now reports an error if there is no linebreak in a txt file. Error is written to log. Added detailed error description to ERROR_CORRUPT_SONG Popup. Some translation may be added to this one git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1423 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index e280855d..1aa9dcde 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -440,7 +440,10 @@ begin // select new song in party mode if ScreenSong.Mode = smPartyMode then ScreenSong.SelectRandomSong(); - ScreenPopupError.ShowPopup(Language.Translate('ERROR_CORRUPT_SONG')); + if (Length(CurrentSong.LastError) > 0) then + ScreenPopupError.ShowPopup(Language.Translate('ERROR_CORRUPT_SONG') + '\n' + CurrentSong.LastError) + else + ScreenPopupError.ShowPopup(Language.Translate('ERROR_CORRUPT_SONG')); // FIXME: do we need this? CurrentSong.Path := CatSongs.Song[CatSongs.Selected].Path; Exit; -- cgit v1.2.3 From 5a237b4a0da9b4058e08b0db1a46e4c66277ede4 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 28 Sep 2008 19:17:48 +0000 Subject: Fixed effects from last song are drawn in next song, see http://www.assembla.com/spaces/usdx/tickets/23 ClearScores method updated: this fixes that first sentence of song is awful if a song was sung before git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1426 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 1aa9dcde..3eb3742d 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -844,6 +844,9 @@ begin // to prevent drawing closed video VideoLoaded := False; + + //Kill all Stars and Effects + GoldenRec.KillAll; if (Ini.SavePlayback = 1) then begin -- cgit v1.2.3 From 528d8cd40ec3763bb3018da4829803404d1cd04b Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 9 Oct 2008 17:57:10 +0000 Subject: Errormessages during songload now translatable German and English translations updated Added four new language strings: ERROR_CORRUPT_SONG_FILE_NOT_FOUND ERROR_CORRUPT_SONG_NO_NOTES ERROR_CORRUPT_SONG_NO_BREAKS ERROR_CORRUPT_SONG_UNKNOWN_IN_LINE git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1443 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 3eb3742d..d0908ff8 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -441,7 +441,7 @@ begin if ScreenSong.Mode = smPartyMode then ScreenSong.SelectRandomSong(); if (Length(CurrentSong.LastError) > 0) then - ScreenPopupError.ShowPopup(Language.Translate('ERROR_CORRUPT_SONG') + '\n' + CurrentSong.LastError) + ScreenPopupError.ShowPopup(Format(Language.Translate(CurrentSong.LastError), [CurrentSong.ErrorLineNo])) else ScreenPopupError.ShowPopup(Language.Translate('ERROR_CORRUPT_SONG')); // FIXME: do we need this? @@ -656,6 +656,8 @@ begin glDeleteTextures(1, PGLuint(@Tex_Background.TexNum)); Tex_Background.TexNum := 0; end; + + Background.OnFinish; end; function TScreenSing.Draw: boolean; @@ -669,6 +671,8 @@ var CurLyricsTime: real; begin + Background.Draw; + // set player names (for 2 screens and only Singstar skin) if ScreenAct = 1 then begin -- cgit v1.2.3 From 9ecbf3bb2d137e2c6f04ab615a34becb4b999abb Mon Sep 17 00:00:00 2001 From: f1fth_freed0m Date: Fri, 10 Oct 2008 14:21:49 +0000 Subject: Fixed Compilation This maybe happed by mistake. whiteshark shoud take a look, its his code git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1444 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index d0908ff8..abfee360 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -657,7 +657,7 @@ begin Tex_Background.TexNum := 0; end; - Background.OnFinish; +// Background.OnFinish; end; function TScreenSing.Draw: boolean; @@ -671,7 +671,7 @@ var CurLyricsTime: real; begin - Background.Draw; +// Background.Draw; // set player names (for 2 screens and only Singstar skin) if ScreenAct = 1 then -- cgit v1.2.3 From 5b04bb1198e14bf6f142ea9735cee2af8e9c021c Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 18 Oct 2008 20:03:10 +0000 Subject: uncommented an accidentally commented line git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1454 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index abfee360..6791e235 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -671,7 +671,7 @@ var CurLyricsTime: real; begin -// Background.Draw; + Background.Draw; // set player names (for 2 screens and only Singstar skin) if ScreenAct = 1 then -- cgit v1.2.3 From f004b6574c5311c743472010beb01a723e0baac5 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 18 Oct 2008 20:16:39 +0000 Subject: just another commented line git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1455 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 6791e235..d0908ff8 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -657,7 +657,7 @@ begin Tex_Background.TexNum := 0; end; -// Background.OnFinish; + Background.OnFinish; end; function TScreenSing.Draw: boolean; -- cgit v1.2.3 From 6edda5db659a67a119b3469ad92080e168ed2944 Mon Sep 17 00:00:00 2001 From: tobigun Date: Sun, 19 Oct 2008 11:36:41 +0000 Subject: offscreen rendering removed: - fixes zoom errors - fixes missing lyric lines if window is too small - better text quality - fixes some other errors git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1457 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index d0908ff8..1267bab8 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -298,7 +298,9 @@ begin //Pausepopup is not visibile at the beginning Static[StaticPausePopup].Visible := False; - Lyrics := TLyricEngine.Create(80, Skin_LyricsT, 640, 12, 80, Skin_LyricsT + 36, 640, 12); + Lyrics := TLyricEngine.Create( + Skin_LyricsUpperX, Skin_LyricsUpperY, Skin_LyricsUpperW, Skin_LyricsUpperH, + Skin_LyricsLowerX, Skin_LyricsLowerY, Skin_LyricsLowerW, Skin_LyricsLowerH); LyricsSync := TLyricsSyncSource.Create(); end; @@ -550,8 +552,6 @@ begin case Ini.LyricsFont of 0: begin - Lyrics.UpperLineSize := 14; - Lyrics.LowerLineSize := 14; Lyrics.FontStyle := 0; Lyrics.LineColor_en.R := Skin_FontR; @@ -571,8 +571,6 @@ begin end; 1: begin - Lyrics.UpperLineSize := 14; - Lyrics.LowerLineSize := 14; Lyrics.FontStyle := 2; Lyrics.LineColor_en.R := 0.75; @@ -592,8 +590,6 @@ begin end; 2: begin - Lyrics.UpperLineSize := 12; - Lyrics.LowerLineSize := 12; Lyrics.FontStyle := 3; Lyrics.LineColor_en.R := 0.75; @@ -970,15 +966,6 @@ begin else Lyrics.AddLine(nil); end; - - // AddLine draws the passed line to the back-buffer of the render context - // and copies it into a texture afterwards (offscreen rendering). - // This leaves an in invalidated screen. Calling Draw() makes sure, - // that the back-buffer stores the sing-screen, when the next - // swap between the back- and front-buffer is done (eliminates flickering) - // calling AddLine() right before the regular screen update (Display.Draw) - // would be a better solution. - Draw; end; function TLyricsSyncSource.GetClock(): real; -- cgit v1.2.3 From e8a388e32a4563ac9ea0895ca6c7cdf83cf9d3ec Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 28 Oct 2008 18:57:02 +0000 Subject: - glPrint(Pchar) -> glPrint(string) - glPrintLetter removed - font engine handles FT_PIXEL_MODE_MONO as FT_Glyph_To_Bitmap(FT_RENDER_MODE_NORMAL) might return a 1bit/pixel black/white image instead of 8bit/pixel gray shaded one (happened with 16px japanese glyphs of simsun.ttf, latin ones were correct). git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1482 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 33 +++++++-------------------------- 1 file changed, 7 insertions(+), 26 deletions(-) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 1267bab8..b6384b79 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -550,9 +550,9 @@ begin // set custom options case Ini.LyricsFont of - 0: + 0: // normal fonts begin - Lyrics.FontStyle := 0; + Lyrics.FontStyle := 0; Lyrics.LineColor_en.R := Skin_FontR; Lyrics.LineColor_en.G := Skin_FontG; @@ -564,33 +564,14 @@ begin Lyrics.LineColor_dis.B := 0.4; Lyrics.LineColor_dis.A := 1; - Lyrics.LineColor_act.R := 5 / 256; - Lyrics.LineColor_act.G := 163 / 256; - Lyrics.LineColor_act.B := 210 / 256; + Lyrics.LineColor_act.R := 0.02; + Lyrics.LineColor_act.G := 0.6; + Lyrics.LineColor_act.B := 0.8; Lyrics.LineColor_act.A := 1; end; - 1: - begin - Lyrics.FontStyle := 2; - - Lyrics.LineColor_en.R := 0.75; - Lyrics.LineColor_en.G := 0.75; - Lyrics.LineColor_en.B := 1; - Lyrics.LineColor_en.A := 1; - - Lyrics.LineColor_dis.R := 0.8; - Lyrics.LineColor_dis.G := 0.8; - Lyrics.LineColor_dis.B := 0.8; - Lyrics.LineColor_dis.A := 1; - - Lyrics.LineColor_act.R := 0.5; - Lyrics.LineColor_act.G := 0.5; - Lyrics.LineColor_act.B := 1; - Lyrics.LineColor_act.A := 1; - end; - 2: + 1, 2: // outline fonts (is TScalableOutlineFont) begin - Lyrics.FontStyle := 3; + Lyrics.FontStyle := Ini.LyricsFont + 1; Lyrics.LineColor_en.R := 0.75; Lyrics.LineColor_en.G := 0.75; -- cgit v1.2.3 From 6585afce2ccd8e7c5ccb3bb3599d4723b00a0433 Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 28 Oct 2008 20:16:05 +0000 Subject: some compiler warnings/hints removed git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1485 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 9 --------- 1 file changed, 9 deletions(-) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index b6384b79..5783366d 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -249,9 +249,6 @@ end; //Pause Mod End constructor TScreenSing.Create; -var - I: integer; - P: integer; begin inherited Create; @@ -314,7 +311,6 @@ var V2R: boolean; V2M: boolean; V3R: boolean; - NR: TRecR; //Some enlightment of who, how and what this is here please Color: TRGB; success: boolean; @@ -641,9 +637,6 @@ function TScreenSing.Draw: boolean; var Min: integer; Sec: integer; - Tekst: string; - Flash: real; - S: integer; T: integer; CurLyricsTime: real; begin @@ -931,8 +924,6 @@ end; // Called on sentence change // SentenceIndex: index of the new active sentence procedure TScreenSing.OnSentenceChange(SentenceIndex: cardinal); -var - LyricEngine: TLyricEngine; begin //GoldenStarsTwinkle GoldenRec.SentenceChange; -- cgit v1.2.3 From 746427f3779275441ee62393fb695a9182703e94 Mon Sep 17 00:00:00 2001 From: tobigun Date: Sun, 2 Nov 2008 21:15:36 +0000 Subject: VideoGap fixed (Tracker Item #2138228) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1496 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 5783366d..d49ecc7c 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -731,7 +731,7 @@ begin begin if assigned(fCurrentVideoPlaybackEngine) then begin - fCurrentVideoPlaybackEngine.GetFrame(LyricsState.GetCurrentTime()); + fCurrentVideoPlaybackEngine.GetFrame(CurrentSong.VideoGAP + LyricsState.GetCurrentTime()); fCurrentVideoPlaybackEngine.DrawGL(ScreenAct); end; end; -- cgit v1.2.3 From c027a665e0d63c8aaba2833b60ec7834987fa8f9 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Wed, 4 Feb 2009 21:46:02 +0000 Subject: many cosmetic changes git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1587 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 262 +++++++++++++++++++++----------------------- 1 file changed, 127 insertions(+), 135 deletions(-) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index d49ecc7c..b7e6b0ec 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -33,7 +33,6 @@ interface {$I switches.inc} - uses UMenu, UMusic, SDL, @@ -61,22 +60,22 @@ type private VideoLoaded: boolean; protected - Paused: boolean; //Pause Mod + Paused: boolean; // pause mod LyricsSync: TLyricsSyncSource; NumEmptySentences: integer; public - // TimeBar fields + // timebar fields StaticTimeProgress: integer; TextTimeText: integer; StaticP1: integer; TextP1: integer; - //shown when game is in 2/4 player modus + // shown when game is in 2/4 player modus StaticP1TwoP: integer; TextP1TwoP: integer; - //shown when game is in 3/6 player modus + // shown when game is in 3/6 player modus StaticP1ThreeP: integer; TextP1ThreeP: integer; @@ -95,7 +94,7 @@ type FadeOut: boolean; Lyrics: TLyricEngine; - //Score Manager: + // score manager: Scores: TSingScores; fShowVisualization: boolean; @@ -105,21 +104,22 @@ type procedure onShow; override; procedure onShowFinish; override; procedure onHide; override; - + function ParseInput(PressedKey: cardinal; CharCode: widechar; PressedDown: boolean): boolean; override; function Draw: boolean; override; procedure Finish; virtual; - procedure Pause; // Toggle Pause + procedure Pause; // toggle pause - procedure OnSentenceEnd(SentenceIndex: cardinal); // for LineBonus + Singbar - procedure OnSentenceChange(SentenceIndex: cardinal); // for Golden Notes + procedure OnSentenceEnd(SentenceIndex: cardinal); // for linebonus + singbar + procedure OnSentenceChange(SentenceIndex: cardinal); // for golden notes end; implementation -uses UGraphic, +uses + UGraphic, UDraw, UMain, USong, @@ -128,29 +128,30 @@ uses UGraphic, ULanguage, Math; - // Method for input parsing. If False is returned, GetNextWindow - // should be checked to know the next window to load; +// method for input parsing. if false is returned, getnextwindow +// should be checked to know the next window to load; + function TScreenSing.ParseInput(PressedKey: cardinal; CharCode: widechar; PressedDown: boolean): boolean; begin - Result := True; + Result := true; if (PressedDown) then - begin // Key Down - // check normal keys + begin // key down + // check normal keys case WideCharUpperCase(CharCode)[1] of 'Q': begin - //When not ask before Exit then Finish now + // when not ask before exit then finish now if (Ini.AskbeforeDel <> 1) then Finish - //else just Pause and let the Popup make the Work + // else just pause and let the popup make the work else if not Paused then Pause; - Result := False; + Result := false; Exit; end; - 'V': //Show Visualization + 'V': // show visualization begin fShowVisualization := not fShowVisualization; @@ -176,7 +177,7 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE: begin - //Record Sound Hack: + // record sound hack: //Sound[0].BufferLong Finish; @@ -189,7 +190,7 @@ begin Pause; end; - SDLK_TAB: //Change Visualization Preset + SDLK_TAB: // change visualization preset begin if fShowVisualization then fCurrentVideoPlaybackEngine.Position := now; // move to a random position @@ -199,8 +200,8 @@ begin begin end; - // Up and Down could be done at the same time, - // but I don't want to declare variables inside + // up and down could be done at the same time, + // but i don't want to declare variables inside // functions like this one, called so many times SDLK_DOWN: begin @@ -212,57 +213,57 @@ begin end; end; -//Pause Mod +// pause mod procedure TScreenSing.Pause; begin - if (not Paused) then //enable Pause + if (not Paused) then // enable pause begin - // pause Time - Paused := True; + // pause time + Paused := true; LyricsState.Pause(); - // pause Music + // pause music AudioPlayback.Pause; - // pause Video + // pause video if (CurrentSong.Video <> '') and FileExists(CurrentSong.Path + CurrentSong.Video) then fCurrentVideoPlaybackEngine.Pause; end - else //disable Pause + else // disable pause begin LyricsState.Resume(); - // Play Music + // play music AudioPlayback.Play; - // Video + // video if (CurrentSong.Video <> '') and FileExists(CurrentSong.Path + CurrentSong.Video) then fCurrentVideoPlaybackEngine.Pause; - Paused := False; + Paused := false; end; end; -//Pause Mod End +// pause mod end constructor TScreenSing.Create; begin inherited Create; - fShowVisualization := False; + fShowVisualization := false; fCurrentVideoPlaybackEngine := VideoPlayback; - //Create Score Class + // create score class Scores := TSingScores.Create; Scores.LoadfromTheme; LoadFromTheme(Theme.Sing); - //TimeBar + // timebar StaticTimeProgress := AddStatic(Theme.Sing.StaticTimeProgress); TextTimeText := AddText(Theme.Sing.TextTimeText); @@ -274,7 +275,7 @@ begin StaticP1TwoP := AddStatic(Theme.Sing.StaticP1TwoP); TextP1TwoP := AddText(Theme.Sing.TextP1TwoP); - // | P2 + // | P2 StaticP2R := AddStatic(Theme.Sing.StaticP2R); TextP2R := AddText(Theme.Sing.TextP2R); @@ -282,18 +283,18 @@ begin StaticP1ThreeP := AddStatic(Theme.Sing.StaticP1ThreeP); TextP1ThreeP := AddText(Theme.Sing.TextP1ThreeP); - // | P2 + // | P2 StaticP2M := AddStatic(Theme.Sing.StaticP2M); TextP2M := AddText(Theme.Sing.TextP2M); - // | P3 + // | P3 StaticP3R := AddStatic(Theme.Sing.StaticP3R); TextP3R := AddText(Theme.Sing.TextP3R); StaticPausePopup := AddStatic(Theme.Sing.PausePopUp); - //Pausepopup is not visibile at the beginning - Static[StaticPausePopup].Visible := False; + // pausepopup is not visibile at the beginning + Static[StaticPausePopup].Visible := false; Lyrics := TLyricEngine.Create( Skin_LyricsUpperX, Skin_LyricsUpperY, Skin_LyricsUpperW, Skin_LyricsUpperH, @@ -306,8 +307,8 @@ procedure TScreenSing.onShow; var P: integer; V1: boolean; - V1TwoP: boolean; //Position of ScoreBox in two-player mode - V1ThreeP: boolean; //Position of ScoreBox in three-player mode + V1TwoP: boolean; // position of score box in two player mode + V1ThreeP: boolean; // position of score box in three player mode V2R: boolean; V2M: boolean; V3R: boolean; @@ -318,9 +319,9 @@ begin inherited; Log.LogStatus('Begin', 'onShow'); - FadeOut := False; + FadeOut := false; - // reset video playback engine, to play Video Clip... + // reset video playback engine, to play video clip ... fCurrentVideoPlaybackEngine := VideoPlayback; // setup score manager @@ -335,7 +336,7 @@ begin Scores.AddPlayer(Tex_ScoreBG[P], Color); end; - Scores.Init; //Get Positions for Players + Scores.Init; // get positions for players // prepare players SetLength(Player, PlayersPlay); @@ -343,92 +344,87 @@ begin case PlayersPlay of 1: begin - V1 := True; - V1TwoP := False; - V1ThreeP := False; - V2R := False; - V2M := False; - V3R := False; + V1 := true; + V1TwoP := false; + V1ThreeP := false; + V2R := false; + V2M := false; + V3R := false; end; 2: begin - V1 := False; - V1TwoP := True; - V1ThreeP := False; - V2R := True; - V2M := False; - V3R := False; + V1 := false; + V1TwoP := true; + V1ThreeP := false; + V2R := true; + V2M := false; + V3R := false; end; 3: begin - V1 := False; - V1TwoP := False; - V1ThreeP := True; - V2R := False; - V2M := True; - V3R := True; + V1 := false; + V1TwoP := false; + V1ThreeP := true; + V2R := false; + V2M := true; + V3R := true; end; 4: begin // double screen - V1 := False; - V1TwoP := True; - V1ThreeP := False; - V2R := True; - V2M := False; - V3R := False; + V1 := false; + V1TwoP := true; + V1ThreeP := false; + V2R := true; + V2M := false; + V3R := false; end; 6: begin // double screen - V1 := False; - V1TwoP := False; - V1ThreeP := True; - V2R := False; - V2M := True; - V3R := True; + V1 := false; + V1TwoP := false; + V1ThreeP := true; + V2R := false; + V2M := true; + V3R := true; end; end; - //This one is shown in 1P mode + // this one is shown in 1P mode Static[StaticP1].Visible := V1; Text[TextP1].Visible := V1; - - //This one is shown in 2/4P mode + // this one is shown in 2/4P mode Static[StaticP1TwoP].Visible := V1TwoP; Text[TextP1TwoP].Visible := V1TwoP; Static[StaticP2R].Visible := V2R; Text[TextP2R].Visible := V2R; - - //This one is shown in 3/6P mode + // this one is shown in 3/6P mode Static[StaticP1ThreeP].Visible := V1ThreeP; Text[TextP1ThreeP].Visible := V1ThreeP; - Static[StaticP2M].Visible := V2M; Text[TextP2M].Visible := V2M; - Static[StaticP3R].Visible := V3R; Text[TextP3R].Visible := V3R; - - // FIXME: sets Path and Filename to '' + // FIXME: sets path and filename to '' ResetSingTemp; CurrentSong := CatSongs.Song[CatSongs.Selected]; - // FIXME: bad style, put the try-except into LoadSong() and not here + // FIXME: bad style, put the try-except into loadsong() and not here try - // Check if file is XML + // check if file is xml if copy(CurrentSong.FileName, length(CurrentSong.FileName) - 3, 4) = '.xml' then success := CurrentSong.LoadXMLSong() else success := CurrentSong.LoadSong(); except - success := False; + success := false; end; if (not success) then @@ -447,7 +443,7 @@ begin Exit; end; - // reset video playback engine, to play video clip... + // reset video playback engine, to play video clip ... fCurrentVideoPlaybackEngine.Close; fCurrentVideoPlaybackEngine := VideoPlayback; @@ -457,32 +453,32 @@ begin * + Blank : Nothing has been set, this is our fallback * + Picture : Picture has been set, and exists - otherwise we fallback * + Video : Video has been set, and exists - otherwise we fallback - * + Visualization: + Off : No Visialization - * + WhenNoVideo: Overwrites Blank and Picture - * + On : Overwrites Blank, Picture and Video + * + Visualization: + Off : No visualization + * + WhenNoVideo: Overwrites blank and picture + * + On : Overwrites blank, picture and video *} {* * set background to: video *} - VideoLoaded := False; - fShowVisualization := False; + VideoLoaded := false; + fShowVisualization := false; if (CurrentSong.Video <> '') and FileExists(CurrentSong.Path + CurrentSong.Video) then begin if (fCurrentVideoPlaybackEngine.Open(CurrentSong.Path + CurrentSong.Video)) then begin - fShowVisualization := False; + fShowVisualization := false; fCurrentVideoPlaybackEngine := VideoPlayback; fCurrentVideoPlaybackEngine.Position := CurrentSong.VideoGAP + CurrentSong.Start; fCurrentVideoPlaybackEngine.Play; - VideoLoaded := True; + VideoLoaded := true; end; end; {* * set background to: picture *} - if (CurrentSong.Background <> '') and (VideoLoaded = False) + if (CurrentSong.Background <> '') and (VideoLoaded = false) and (TVisualizerOption(Ini.VisualizerOption) = voOff) then try Tex_Background := Texture.LoadTexture(CurrentSong.Path + CurrentSong.Background); @@ -501,7 +497,7 @@ begin *} if (TVisualizerOption(Ini.VisualizerOption) in [voOn]) then begin - fShowVisualization := True; + fShowVisualization := true; fCurrentVideoPlaybackEngine := Visualization; if (fCurrentVideoPlaybackEngine <> nil) then fCurrentVideoPlaybackEngine.Play; @@ -511,9 +507,9 @@ begin * set background to: visualization (Videos are still shown) *} if ((TVisualizerOption(Ini.VisualizerOption) in [voWhenNoVideo]) and - (VideoLoaded = False)) then + (VideoLoaded = false)) then begin - fShowVisualization := True; + fShowVisualization := true; fCurrentVideoPlaybackEngine := Visualization; if (fCurrentVideoPlaybackEngine <> nil) then fCurrentVideoPlaybackEngine.Play; @@ -586,21 +582,21 @@ begin end; end; // case - // Initialize lyrics by filling its queue + // initialize lyrics by filling its queue while (not Lyrics.IsQueueFull) and (Lyrics.LineCounter <= High(Lines[0].Line)) do begin Lyrics.AddLine(@Lines[0].Line[Lyrics.LineCounter]); end; - // Deactivate pause - Paused := False; + // deactivate pause + Paused := false; - // Kill all stars not killed yet (GoldenStarsTwinkle Mod) + // kill all stars not killed yet (goldenstarstwinkle mod) GoldenRec.SentenceChange; - // set Position of Line Bonus - Line Bonus end - // set number of empty sentences for Line Bonus + // set position of line bonus - line bonus end + // set number of empty sentences for line bonus NumEmptySentences := 0; for P := Low(Lines[0].Line) to High(Lines[0].Line) do if Lines[0].Line[P].TotalNotes = 0 then @@ -623,7 +619,7 @@ end; procedure TScreenSing.onHide; begin - // Unload background texture + // background texture if (Tex_Background.TexNum > 0) then begin glDeleteTextures(1, PGLuint(@Tex_Background.TexNum)); @@ -643,7 +639,7 @@ begin Background.Draw; - // set player names (for 2 screens and only Singstar skin) + // set player names (for 2 screens and only singstar skin) if ScreenAct = 1 then begin Text[TextP1].Text := 'P1'; @@ -671,7 +667,6 @@ begin end; // case end; // if - //// // dual screen, part 1 //////////////////////// @@ -687,7 +682,6 @@ begin {Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX;} - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10 * ScreenX; Text[TextP2R].X := Text[TextP2R].X + 10 * ScreenX; @@ -702,8 +696,6 @@ begin for T := 0 to 1 do Text[T].X := Text[T].X + 10 * ScreenX; - - // retrieve current lyrics time, we have to store the value to avoid // that min- and sec-values do not match CurLyricsTime := LyricsState.GetCurrentTime(); @@ -723,7 +715,7 @@ begin // Note: there is no menu and the animated background brakes the video playback //DrawBG; - // Draw Background + // draw background SingDrawBackground; // update and draw movie @@ -755,7 +747,7 @@ begin if (not FadeOut) then begin Finish; - FadeOut := True; + FadeOut := true; FadeTo(@ScreenScore); end; end; @@ -764,10 +756,10 @@ begin // always draw custom items SingDraw; - //GoldenNoteStarsTwinkle + // goldennotestarstwinkle GoldenRec.SpawnRec; - //Draw Scores + // draw scores Scores.Draw; //// @@ -784,24 +776,24 @@ begin Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10 * ScreenX; Text[TextP2R].X := Text[TextP2R].X - 10 * ScreenX; - //end of weird + // end of weird Static[1].Texture.X := Static[1].Texture.X - 10 * ScreenX; for T := 0 to 1 do Text[T].X := Text[T].X - 10 * ScreenX; - // Draw Pausepopup - // FIXME: this is a workaround that the Static is drawn over the Lyrics, Lines, Scores and Effects + // draw pausepopup + // FIXME: this is a workaround that the static is drawn over the lyrics, lines, scores and effects // maybe someone could find a better solution if Paused then begin - Static[StaticPausePopup].Visible := True; + Static[StaticPausePopup].Visible := true; Static[StaticPausePopup].Draw; - Static[StaticPausePopup].Visible := False; + Static[StaticPausePopup].Visible := false; end; - Result := True; + Result := true; end; procedure TScreenSing.Finish; @@ -817,11 +809,11 @@ begin Visualization.Close; // to prevent drawing closed video - VideoLoaded := False; + VideoLoaded := false; - //Kill all Stars and Effects + // kill all stars and effects GoldenRec.KillAll; - + if (Ini.SavePlayback = 1) then begin Log.BenchmarkStart(0); @@ -832,7 +824,7 @@ begin Log.LogBenchmark('Creating files', 0); end; - SetFontItalic(False); + SetFontItalic(false); end; procedure TScreenSing.OnSentenceEnd(SentenceIndex: cardinal); @@ -871,14 +863,14 @@ begin CurrentPlayer := @Player[PlayerIndex]; CurrentScore := CurrentPlayer.Score + CurrentPlayer.ScoreGolden; - // Line Bonus + // line bonus // points for this line LineScore := CurrentScore - CurrentPlayer.ScoreLast; // determine LinePerfection // Note: the "+2" extra points are a little bonus so the player does not - // have to be that perfect to reach the bonus steps. + // have to be that perfect to reach the bonus steps. LinePerfection := (LineScore + 2) / MaxLineScore; // clamp LinePerfection to range [0..1] @@ -908,7 +900,7 @@ begin Scores.SpawnPopUp(PlayerIndex, Rating, CurrentPlayer.ScoreTotalInt); end; - // PerfectLineTwinkle (effect), Part 1 + // PerfectLineTwinkle (effect), part 1 if (Ini.EffectSing = 1) then CurrentPlayer.LastSentencePerfect := (LinePerfection >= 1); @@ -916,7 +908,7 @@ begin CurrentPlayer.ScoreLast := CurrentScore; end; - // PerfectLineTwinkle (effect), Part 2 + // PerfectLineTwinkle (effect), part 2 if (Ini.EffectSing = 1) then GoldenRec.SpawnPerfectLineTwinkle; end; @@ -925,14 +917,14 @@ end; // SentenceIndex: index of the new active sentence procedure TScreenSing.OnSentenceChange(SentenceIndex: cardinal); begin - //GoldenStarsTwinkle + // goldenstarstwinkle GoldenRec.SentenceChange; - // Fill lyrics queue and set upper line to the current sentence + // fill lyrics queue and set upper line to the current sentence while (Lyrics.GetUpperLineIndex() < SentenceIndex) or (not Lyrics.IsQueueFull) do begin - // Add the next line to the queue or a dummy if no more lines are available + // add the next line to the queue or a dummy if no more lines are available if (Lyrics.LineCounter <= High(Lines[0].Line)) then Lyrics.AddLine(@Lines[0].Line[Lyrics.LineCounter]) else -- cgit v1.2.3 From 5a9b4134bdc9813ad7337848be7f0bfe91b079f0 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Wed, 25 Feb 2009 23:53:32 +0000 Subject: does this fix the score calculation? git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1606 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index b7e6b0ec..da0dc6c9 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -888,7 +888,7 @@ begin // apply line-bonus CurrentPlayer.ScoreLine := CurrentPlayer.ScoreLine + LineBonus * LinePerfection; - CurrentPlayer.ScoreLineInt := Round(CurrentPlayer.ScoreLine / 10) * 10; + CurrentPlayer.ScoreLineInt := Floor(CurrentPlayer.ScoreLine / 10) * 10; // update total score CurrentPlayer.ScoreTotalInt := CurrentPlayer.ScoreInt + -- cgit v1.2.3 From f57b5a260d4d98a910f62316efe653a1a7e704b7 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 1 Mar 2009 12:53:55 +0000 Subject: fixed first screen was cleared when second screen was drawn. #76 should be fixed now commented some weird stuff in TScreenSing.Draw git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1613 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index da0dc6c9..4e977d66 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -636,7 +636,6 @@ var T: integer; CurLyricsTime: real; begin - Background.Draw; // set player names (for 2 screens and only singstar skin) @@ -675,26 +674,26 @@ begin // will move the statics and texts to the correct screen here. // FIXME: clean up this weird stuff. Commenting this stuff out, nothing // was missing on screen w/ 6 players - so do we even need this stuff? - Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10 * ScreenX; + {Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10 * ScreenX; - Text[TextP1].X := Text[TextP1].X + 10 * ScreenX; + Text[TextP1].X := Text[TextP1].X + 10 * ScreenX; } {Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX;} - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10 * ScreenX; + {Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10 * ScreenX; - Text[TextP2R].X := Text[TextP2R].X + 10 * ScreenX; + Text[TextP2R].X := Text[TextP2R].X + 10 * ScreenX; } {Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX;} // end of weird stuff + { + Static[1].Texture.X := Static[1].Texture.X + 10 * ScreenX; } - Static[1].Texture.X := Static[1].Texture.X + 10 * ScreenX; - - for T := 0 to 1 do - Text[T].X := Text[T].X + 10 * ScreenX; + { for T := 0 to 1 do + Text[T].X := Text[T].X + 10 * ScreenX; } // retrieve current lyrics time, we have to store the value to avoid // that min- and sec-values do not match @@ -770,7 +769,7 @@ begin // will move the statics and texts to the correct screen here. // FIXME: clean up this weird stuff - Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10 * ScreenX; + {Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10 * ScreenX; Text[TextP1].X := Text[TextP1].X - 10 * ScreenX; Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10 * ScreenX; @@ -781,7 +780,7 @@ begin Static[1].Texture.X := Static[1].Texture.X - 10 * ScreenX; for T := 0 to 1 do - Text[T].X := Text[T].X - 10 * ScreenX; + Text[T].X := Text[T].X - 10 * ScreenX; } // draw pausepopup // FIXME: this is a workaround that the static is drawn over the lyrics, lines, scores and effects -- cgit v1.2.3 From 9be9439fce30028c619a401523793ec101dccaed Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Fri, 6 Mar 2009 23:45:10 +0000 Subject: Clear Scores moved to UScreenSing and inlined. Reduce clutter in UMain git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1624 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 4e977d66..f232bdc1 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -305,7 +305,7 @@ end; procedure TScreenSing.onShow; var - P: integer; + Index: integer; V1: boolean; V1TwoP: boolean; // position of score box in two player mode V1ThreeP: boolean; // position of score box in three player mode @@ -331,9 +331,9 @@ begin Color.B := 0; // dummy atm <- \(O.o)/? B like bummy? // add new players - for P := 0 to PlayersPlay - 1 do + for Index := 0 to PlayersPlay - 1 do begin - Scores.AddPlayer(Tex_ScoreBG[P], Color); + Scores.AddPlayer(Tex_ScoreBG[Index], Color); end; Scores.Init; // get positions for players @@ -534,8 +534,24 @@ begin // prepare and start voice-capture AudioInput.CaptureStart; - for P := 0 to High(Player) do - ClearScores(P); + // clear the scores of all players + + for Index := 0 to High(Player) do + with Player[Index] do + begin + Score := 0; + ScoreLine := 0; + ScoreGolden := 0; + + ScoreInt := 0; + ScoreLineInt := 0; + ScoreGoldenInt := 0; + ScoreTotalInt := 0; + + ScoreLast := 0; + + LastSentencePerfect := false; + end; // main text Lyrics.Clear(CurrentSong.BPM[0].BPM, CurrentSong.Resolution); @@ -598,8 +614,8 @@ begin // set position of line bonus - line bonus end // set number of empty sentences for line bonus NumEmptySentences := 0; - for P := Low(Lines[0].Line) to High(Lines[0].Line) do - if Lines[0].Line[P].TotalNotes = 0 then + for Index := Low(Lines[0].Line) to High(Lines[0].Line) do + if Lines[0].Line[Index].TotalNotes = 0 then Inc(NumEmptySentences); Log.LogStatus('End', 'onShow'); -- cgit v1.2.3 From f469075a0335399c753ae5d2d362047dedf116b1 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Sat, 7 Mar 2009 21:14:14 +0000 Subject: final cleanup of Umain. Creation of UNote git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1627 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index f232bdc1..fcf448a9 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -33,22 +33,23 @@ interface {$I switches.inc} -uses UMenu, - UMusic, - SDL, +uses SysUtils, + gl, + SDL, + TextGL, UFiles, - UTime, - USongs, + UGraphicClasses, UIni, ULog, - UTexture, ULyrics, - TextGL, - gl, + UMenu, + UMusic, + USingScores, + USongs, + UTexture, UThemes, - UGraphicClasses, - USingScores; + UTime; type TLyricsSyncSource = class(TSyncSource) @@ -119,14 +120,14 @@ type implementation uses - UGraphic, - UDraw, - UMain, - USong, Classes, - URecord, + Math, + UDraw, + UGraphic, ULanguage, - Math; + UNote, + URecord, + USong; // method for input parsing. if false is returned, getnextwindow // should be checked to know the next window to load; -- cgit v1.2.3 From 486feffb21e42c713fa97a157cf860554be66976 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 7 Mar 2009 21:42:17 +0000 Subject: overdrawing of first screen when using visualizations fixed. visualizations are still streched over both screens when UseTexture in UVisualizer is undefined git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1628 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index fcf448a9..ee5164db 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -655,6 +655,12 @@ var begin Background.Draw; + // draw background picture (if any, and if no visualizations) + // when we don't check for visualizations the visualizations would + // be overdrawn by the picture when {UNDEFINED UseTexture} in UVisualizer + if (not fShowVisualization) then + SingDrawBackground; + // set player names (for 2 screens and only singstar skin) if ScreenAct = 1 then begin @@ -731,15 +737,17 @@ begin // Note: there is no menu and the animated background brakes the video playback //DrawBG; - // draw background - SingDrawBackground; - // update and draw movie if (ShowFinish and (VideoLoaded or fShowVisualization)) then begin if assigned(fCurrentVideoPlaybackEngine) then begin - fCurrentVideoPlaybackEngine.GetFrame(CurrentSong.VideoGAP + LyricsState.GetCurrentTime()); + // Just call this once + // when Screens = 2 + If (ScreenAct = 1) then + fCurrentVideoPlaybackEngine.GetFrame(CurrentSong.VideoGAP + LyricsState.GetCurrentTime()); + + fCurrentVideoPlaybackEngine.DrawGL(ScreenAct); end; end; -- cgit v1.2.3 From 41d17ac45a0e1178354148798defcc07ee4d481e Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Mon, 23 Mar 2009 12:53:06 +0000 Subject: Fixed some displaying issues w/ old party mode - score wasn't drawn - video wasn't drawn Lyricshelper is still not present git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1653 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index ee5164db..b5b93831 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -58,9 +58,8 @@ type type TScreenSing = class(TMenu) - private - VideoLoaded: boolean; protected + VideoLoaded: boolean; Paused: boolean; // pause mod LyricsSync: TLyricsSyncSource; NumEmptySentences: integer; -- cgit v1.2.3 From c7f5d683c1eae49e30ee42a76557661f57311b9e Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Sat, 25 Apr 2009 10:09:59 +0000 Subject: Cosmetics. No code change git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1694 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index b5b93831..c29c0e2c 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -743,10 +743,9 @@ begin begin // Just call this once // when Screens = 2 - If (ScreenAct = 1) then + if (ScreenAct = 1) then fCurrentVideoPlaybackEngine.GetFrame(CurrentSong.VideoGAP + LyricsState.GetCurrentTime()); - fCurrentVideoPlaybackEngine.DrawGL(ScreenAct); end; end; -- cgit v1.2.3 From 4f8afae1ce76884c54d4b2de9de2186e29115c57 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 16 May 2009 22:04:15 +0000 Subject: add lyric-bar bounds to theme thx to Krueger git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1746 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index c29c0e2c..4389352a 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -297,8 +297,8 @@ begin Static[StaticPausePopup].Visible := false; Lyrics := TLyricEngine.Create( - Skin_LyricsUpperX, Skin_LyricsUpperY, Skin_LyricsUpperW, Skin_LyricsUpperH, - Skin_LyricsLowerX, Skin_LyricsLowerY, Skin_LyricsLowerW, Skin_LyricsLowerH); + Theme.LyricBar.UpperX, Theme.LyricBar.UpperY, Theme.LyricBar.UpperW, Theme.LyricBar.UpperH, + Theme.LyricBar.LowerX, Theme.LyricBar.LowerY, Theme.LyricBar.LowerW, Theme.LyricBar.LowerH); LyricsSync := TLyricsSyncSource.Create(); end; -- cgit v1.2.3 From 257854c587f0876a912cfbeb4fe0a30970d25a9b Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 31 May 2009 14:10:42 +0000 Subject: merged (experimental) mouse support patch by d0ccrazy some changes to patch - implemented software cursor (texturable) - option to turn of mouse support or switch between hardware and software cursor - hide software cursor if there is no mouse activity for 5 seconds - soft fade in and out for software cursor - some test cursor-textures for deluxe theme (mog pls change these horible looking images) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1789 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 4389352a..ae75c74d 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -126,7 +126,8 @@ uses ULanguage, UNote, URecord, - USong; + USong, + UDisplay; // method for input parsing. if false is returned, getnextwindow // should be checked to know the next window to load; @@ -253,6 +254,9 @@ constructor TScreenSing.Create; begin inherited Create; + //too dangerous, a mouse button is quickly pressed by accident + RightMbESC := false; + fShowVisualization := false; fCurrentVideoPlaybackEngine := VideoPlayback; @@ -623,6 +627,9 @@ end; procedure TScreenSing.onShowFinish; begin + // hide cursor on singscreen show + Display.SetCursor; + // start lyrics LyricsState.Resume(); @@ -643,6 +650,7 @@ begin end; Background.OnFinish; + Display.SetCursor; end; function TScreenSing.Draw: boolean; -- cgit v1.2.3 From d9341fd1b98b39b641f1ab0d216cbc0daedcc67f Mon Sep 17 00:00:00 2001 From: s_alexander Date: Mon, 29 Jun 2009 01:43:51 +0000 Subject: fixed bug #88 fixed bug, that under some circumstances you got line bonus even with no input https://www.assembla.com/spaces/usdx/tickets/88-get-sometimes-10-points-linebonus-even-with-no-input git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1839 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index ae75c74d..9dd25cd1 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -899,9 +899,9 @@ begin LineScore := CurrentScore - CurrentPlayer.ScoreLast; // determine LinePerfection - // Note: the "+2" extra points are a little bonus so the player does not + // Note: the "-2" extra points are a little bonus so the player does not // have to be that perfect to reach the bonus steps. - LinePerfection := (LineScore + 2) / MaxLineScore; + LinePerfection := LineScore / (MaxLineScore - 2); // clamp LinePerfection to range [0..1] if (LinePerfection < 0) then -- cgit v1.2.3 From 9ceadd2532207fcb512fcfecbd2895055422ad99 Mon Sep 17 00:00:00 2001 From: s_alexander Date: Fri, 3 Jul 2009 00:02:02 +0000 Subject: fixed possible division by zero bug, if line has only 1 oder 2 points git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1845 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 9dd25cd1..9a620320 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -898,10 +898,14 @@ begin // points for this line LineScore := CurrentScore - CurrentPlayer.ScoreLast; - // determine LinePerfection - // Note: the "-2" extra points are a little bonus so the player does not - // have to be that perfect to reach the bonus steps. - LinePerfection := LineScore / (MaxLineScore - 2); + // check for lines with low points + if (MaxLineScore <= 2) then + LinePerfection := 1 + else + // determine LinePerfection + // Note: the "+2" extra points are a little bonus so the player does not + // have to be that perfect to reach the bonus steps. + LinePerfection := LineScore / (MaxLineScore - 2); // clamp LinePerfection to range [0..1] if (LinePerfection < 0) then -- cgit v1.2.3 From a77cf53f7f71a525a33c7617d74d57b4fd84e357 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 16 Aug 2009 13:17:01 +0000 Subject: some changes to prevent integer size conversions attempt to fix weird score bugs git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1932 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 9a620320..157f7e64 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -859,7 +859,7 @@ end; procedure TScreenSing.OnSentenceEnd(SentenceIndex: cardinal); var - PlayerIndex: integer; + PlayerIndex: byte; CurrentPlayer: PPLayer; CurrentScore: real; Line: PLine; -- cgit v1.2.3 From 917901e8e33438c425aef50a0a7417f32d77b760 Mon Sep 17 00:00:00 2001 From: s_alexander Date: Mon, 9 Nov 2009 00:27:55 +0000 Subject: merged unicode branch (r1931) into trunk git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1939 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 61 +++++++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 27 deletions(-) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 157f7e64..20805737 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -35,9 +35,9 @@ interface uses SysUtils, - gl, SDL, TextGL, + gl, UFiles, UGraphicClasses, UIni, @@ -49,6 +49,7 @@ uses USongs, UTexture, UThemes, + UPath, UTime; type @@ -101,11 +102,11 @@ type fCurrentVideoPlaybackEngine: IVideoPlayback; constructor Create; override; - procedure onShow; override; - procedure onShowFinish; override; - procedure onHide; override; + procedure OnShow; override; + procedure OnShowFinish; override; + procedure OnHide; override; - function ParseInput(PressedKey: cardinal; CharCode: widechar; + function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; function Draw: boolean; override; @@ -127,20 +128,21 @@ uses UNote, URecord, USong, - UDisplay; + UDisplay, + UUnicodeUtils; // method for input parsing. if false is returned, getnextwindow // should be checked to know the next window to load; -function TScreenSing.ParseInput(PressedKey: cardinal; CharCode: widechar; +function TScreenSing.ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; begin Result := true; if (PressedDown) then begin // key down // check normal keys - case WideCharUpperCase(CharCode)[1] of - 'Q': + case UCS4UpperCase(CharCode) of + Ord('Q'): begin // when not ask before exit then finish now if (Ini.AskbeforeDel <> 1) then @@ -152,7 +154,7 @@ begin Result := false; Exit; end; - 'V': // show visualization + Ord('V'): // show visualization begin fShowVisualization := not fShowVisualization; @@ -166,7 +168,7 @@ begin Exit; end; - 'P': + Ord('P'): begin Pause; Exit; @@ -216,6 +218,8 @@ end; // pause mod procedure TScreenSing.Pause; +var + VideoFile: IPath; begin if (not Paused) then // enable pause begin @@ -228,8 +232,8 @@ begin AudioPlayback.Pause; // pause video - if (CurrentSong.Video <> '') and FileExists(CurrentSong.Path + - CurrentSong.Video) then + VideoFile := CurrentSong.Path.Append(CurrentSong.Video); + if (CurrentSong.Video.IsSet) and VideoFile.Exists then fCurrentVideoPlaybackEngine.Pause; end @@ -241,8 +245,8 @@ begin AudioPlayback.Play; // video - if (CurrentSong.Video <> '') and FileExists(CurrentSong.Path + - CurrentSong.Video) then + VideoFile := CurrentSong.Path.Append(CurrentSong.Video); + if (CurrentSong.Video.IsSet) and VideoFile.Exists then fCurrentVideoPlaybackEngine.Pause; Paused := false; @@ -307,7 +311,7 @@ begin LyricsSync := TLyricsSyncSource.Create(); end; -procedure TScreenSing.onShow; +procedure TScreenSing.OnShow; var Index: integer; V1: boolean; @@ -317,12 +321,12 @@ var V2M: boolean; V3R: boolean; Color: TRGB; - + VideoFile, BgFile: IPath; success: boolean; begin inherited; - Log.LogStatus('Begin', 'onShow'); + Log.LogStatus('Begin', 'OnShow'); FadeOut := false; // reset video playback engine, to play video clip ... @@ -423,7 +427,7 @@ begin // FIXME: bad style, put the try-except into loadsong() and not here try // check if file is xml - if copy(CurrentSong.FileName, length(CurrentSong.FileName) - 3, 4) = '.xml' then + if CurrentSong.FileName.GetExtension.ToUTF8 = '.xml' then success := CurrentSong.LoadXMLSong() else success := CurrentSong.LoadSong(); @@ -467,9 +471,10 @@ begin *} VideoLoaded := false; fShowVisualization := false; - if (CurrentSong.Video <> '') and FileExists(CurrentSong.Path + CurrentSong.Video) then + VideoFile := CurrentSong.Path.Append(CurrentSong.Video); + if (CurrentSong.Video.IsSet) and VideoFile.IsFile then begin - if (fCurrentVideoPlaybackEngine.Open(CurrentSong.Path + CurrentSong.Video)) then + if (fCurrentVideoPlaybackEngine.Open(VideoFile)) then begin fShowVisualization := false; fCurrentVideoPlaybackEngine := VideoPlayback; @@ -482,15 +487,17 @@ begin {* * set background to: picture *} - if (CurrentSong.Background <> '') and (VideoLoaded = false) + if (CurrentSong.Background.IsSet) and (VideoLoaded = false) and (TVisualizerOption(Ini.VisualizerOption) = voOff) then + begin + BgFile := CurrentSong.Path.Append(CurrentSong.Background); try - Tex_Background := Texture.LoadTexture(CurrentSong.Path + CurrentSong.Background); + Tex_Background := Texture.LoadTexture(BgFile); except - Log.LogError('Background could not be loaded: ' + CurrentSong.Path + - CurrentSong.Background); + Log.LogError('Background could not be loaded: ' + BgFile.ToNative); Tex_Background.TexNum := 0; end + end else begin Tex_Background.TexNum := 0; @@ -622,7 +629,7 @@ begin if Lines[0].Line[Index].TotalNotes = 0 then Inc(NumEmptySentences); - Log.LogStatus('End', 'onShow'); + Log.LogStatus('End', 'OnShow'); end; procedure TScreenSing.onShowFinish; @@ -640,7 +647,7 @@ begin CountSkipTimeSet; end; -procedure TScreenSing.onHide; +procedure TScreenSing.OnHide; begin // background texture if (Tex_Background.TexNum > 0) then -- cgit v1.2.3 From 526ba53e63926cf2837a9e8feb7cda3ac8526300 Mon Sep 17 00:00:00 2001 From: brunzelchen Date: Mon, 7 Dec 2009 21:47:43 +0000 Subject: add the score to db only if the song was sung to the end (last word of last sentence+length) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2002 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 20805737..342abac1 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -98,6 +98,9 @@ type // score manager: Scores: TSingScores; + //the song was sung to the end + SungToEnd: boolean; + fShowVisualization: boolean; fCurrentVideoPlaybackEngine: IVideoPlayback; @@ -329,6 +332,9 @@ begin Log.LogStatus('Begin', 'OnShow'); FadeOut := false; + //the song was sung to the end + SungToEnd := false; + // reset video playback engine, to play video clip ... fCurrentVideoPlaybackEngine := VideoPlayback; @@ -666,6 +672,8 @@ var Sec: integer; T: integer; CurLyricsTime: real; + Line: TLyricLine; + LastWord: TLyricWord; begin Background.Draw; @@ -751,6 +759,15 @@ begin // Note: there is no menu and the animated background brakes the video playback //DrawBG; + //the song was sung to the end? + Line := Lyrics.GetUpperLine(); + if Line.LastLine then + begin + LastWord := Line.Words[Length(Line.Words)-1]; + if CurLyricsTime >= GetTimeFromBeat(LastWord.Start+LastWord.Length) then + SungToEnd := true; + end; + // update and draw movie if (ShowFinish and (VideoLoaded or fShowVisualization)) then begin -- cgit v1.2.3 From 46e4f20c37be63c326b9ac798c656c266301d5b0 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 13 Dec 2009 13:32:09 +0000 Subject: fixed score display with linebonus=off git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2026 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 342abac1..20f3b15e 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -956,7 +956,9 @@ begin // spawn rating pop-up Rating := Round(LinePerfection * MAX_LINE_RATING); Scores.SpawnPopUp(PlayerIndex, Rating, CurrentPlayer.ScoreTotalInt); - end; + end + else + Scores.RaiseScore(PlayerIndex, CurrentPlayer.ScoreTotalInt); // PerfectLineTwinkle (effect), part 1 if (Ini.EffectSing = 1) then -- cgit v1.2.3 From 115be023b64d9de135a09ab2a63553856eef15d9 Mon Sep 17 00:00:00 2001 From: s_alexander Date: Sun, 20 Dec 2009 20:35:40 +0000 Subject: changed TSyncSource to interface ISyncSource git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2051 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 20f3b15e..0b7dfba4 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -53,8 +53,8 @@ uses UTime; type - TLyricsSyncSource = class(TSyncSource) - function GetClock(): real; override; + TLyricsSyncSource = class(TInterfacedObject,ISyncSource) + function GetClock(): real; end; type -- cgit v1.2.3 From 1b38db896c698b754ff145931e432f4f3ee05345 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Tue, 29 Dec 2009 14:04:52 +0000 Subject: revert submission 2051. leeds to crash on 2nd song. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2056 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 0b7dfba4..20f3b15e 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -53,8 +53,8 @@ uses UTime; type - TLyricsSyncSource = class(TInterfacedObject,ISyncSource) - function GetClock(): real; + TLyricsSyncSource = class(TSyncSource) + function GetClock(): real; override; end; type -- cgit v1.2.3 From 4711217f127aa0c10fa52755fd567c570277a1a1 Mon Sep 17 00:00:00 2001 From: s_alexander Date: Tue, 12 Jan 2010 17:42:41 +0000 Subject: merged lua into trunk git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2071 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 62 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 55 insertions(+), 7 deletions(-) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 20f3b15e..18496517 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -50,7 +50,8 @@ uses UTexture, UThemes, UPath, - UTime; + UTime, + UHookableEvent; type TLyricsSyncSource = class(TSyncSource) @@ -61,7 +62,9 @@ type TScreenSing = class(TMenu) protected VideoLoaded: boolean; - Paused: boolean; // pause mod + eSongLoaded: THookableEvent; //< event is called after lyrics of a song are loaded on OnShow + protected + Paused: boolean; //pause Mod LyricsSync: TLyricsSyncSource; NumEmptySentences: integer; public @@ -104,6 +107,19 @@ type fShowVisualization: boolean; fCurrentVideoPlaybackEngine: IVideoPlayback; + // some settings to be set by plugins + settings: record + Finish: Boolean; //< if true, screen will finish on next draw + + LyricsVisible: Boolean; //< shows or hides lyrics + NotesVisible: Integer; //< if bit[playernum] is set the notes for the specified player are visible. By default all players notes are visible + + PlayerEnabled: Integer; //< defines whether a player can score atm + end; + procedure ClearSettings; + procedure ApplySettings; //< applies changes of settings record + procedure EndSong; + constructor Create; override; procedure OnShow; override; procedure OnShowFinish; override; @@ -132,6 +148,7 @@ uses URecord, USong, UDisplay, + UParty, UUnicodeUtils; // method for input parsing. if false is returned, getnextwindow @@ -312,6 +329,10 @@ begin Theme.LyricBar.LowerX, Theme.LyricBar.LowerY, Theme.LyricBar.LowerW, Theme.LyricBar.LowerH); LyricsSync := TLyricsSyncSource.Create(); + + eSongLoaded := THookableEvent.Create('ScreenSing.SongLoaded'); + + ClearSettings; end; procedure TScreenSing.OnShow; @@ -334,8 +355,10 @@ begin //the song was sung to the end SungToEnd := false; + ClearSettings; + Party.CallBeforeSing; - // reset video playback engine, to play video clip ... + // reset video playback engine, to play Video Clip... fCurrentVideoPlaybackEngine := VideoPlayback; // setup score manager @@ -443,8 +466,8 @@ begin if (not success) then begin - // error loading song -> go back to song screen and show some error message - FadeTo(@ScreenSong); + // error loading song -> go back to previous screen and show some error message + Display.AbortScreenChange; // select new song in party mode if ScreenSong.Mode = smPartyMode then ScreenSong.SelectRandomSong(); @@ -635,6 +658,8 @@ begin if Lines[0].Line[Index].TotalNotes = 0 then Inc(NumEmptySentences); + eSongLoaded.CallHookChain(False); + Log.LogStatus('End', 'OnShow'); end; @@ -653,6 +678,25 @@ begin CountSkipTimeSet; end; +procedure TScreenSing.ClearSettings; +begin + Settings.Finish := False; + Settings.LyricsVisible := True; + Settings.NotesVisible := high(Integer); + Settings.PlayerEnabled := high(Integer); +end; + +{ applies changes of settings record } +procedure TScreenSing.ApplySettings; +begin + // +end; + +procedure TScreenSing.EndSong; +begin + Settings.Finish := True; +end; + procedure TScreenSing.OnHide; begin // background texture @@ -790,11 +834,14 @@ begin if ShowFinish then begin if (not AudioPlayback.Finished) and ((CurrentSong.Finish = 0) or - (LyricsState.GetCurrentTime() * 1000 <= CurrentSong.Finish)) then + (LyricsState.GetCurrentTime() * 1000 <= CurrentSong.Finish)) and (not Settings.Finish) then begin // analyze song if not paused if (not Paused) then + begin Sing(Self); + Party.CallOnSing; + end; end else begin @@ -802,7 +849,6 @@ begin begin Finish; FadeOut := true; - FadeTo(@ScreenScore); end; end; end; @@ -879,6 +925,8 @@ begin end; SetFontItalic(false); + + Party.CallAfterSing; end; procedure TScreenSing.OnSentenceEnd(SentenceIndex: cardinal); -- cgit v1.2.3 From f761eb20ce8d3b5ef718be4a305b78712641248d Mon Sep 17 00:00:00 2001 From: tobigun Date: Sun, 18 Apr 2010 13:43:36 +0000 Subject: change variable names "static" to "statics" - "static" is a reserved name and should not be used - code-completion in lazarus does not work as it is not able to cope with variables that are named "static" git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2246 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 18496517..74c09b4f 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -322,7 +322,7 @@ begin StaticPausePopup := AddStatic(Theme.Sing.PausePopUp); // pausepopup is not visibile at the beginning - Static[StaticPausePopup].Visible := false; + Statics[StaticPausePopup].Visible := false; Lyrics := TLyricEngine.Create( Theme.LyricBar.UpperX, Theme.LyricBar.UpperY, Theme.LyricBar.UpperW, Theme.LyricBar.UpperH, @@ -428,24 +428,24 @@ begin end; // this one is shown in 1P mode - Static[StaticP1].Visible := V1; + Statics[StaticP1].Visible := V1; Text[TextP1].Visible := V1; // this one is shown in 2/4P mode - Static[StaticP1TwoP].Visible := V1TwoP; + Statics[StaticP1TwoP].Visible := V1TwoP; Text[TextP1TwoP].Visible := V1TwoP; - Static[StaticP2R].Visible := V2R; + Statics[StaticP2R].Visible := V2R; Text[TextP2R].Visible := V2R; // this one is shown in 3/6P mode - Static[StaticP1ThreeP].Visible := V1ThreeP; + Statics[StaticP1ThreeP].Visible := V1ThreeP; Text[TextP1ThreeP].Visible := V1ThreeP; - Static[StaticP2M].Visible := V2M; + Statics[StaticP2M].Visible := V2M; Text[TextP2M].Visible := V2M; - Static[StaticP3R].Visible := V3R; + Statics[StaticP3R].Visible := V3R; Text[TextP3R].Visible := V3R; // FIXME: sets path and filename to '' @@ -763,23 +763,23 @@ begin // will move the statics and texts to the correct screen here. // FIXME: clean up this weird stuff. Commenting this stuff out, nothing // was missing on screen w/ 6 players - so do we even need this stuff? - {Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10 * ScreenX; + {Statics[StaticP1].Texture.X := Statics[StaticP1].Texture.X + 10 * ScreenX; Text[TextP1].X := Text[TextP1].X + 10 * ScreenX; } - {Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; + {Statics[StaticP1ScoreBG].Texture.X := Statics[StaticP1ScoreBG].Texture.X + 10*ScreenX; Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX;} - {Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10 * ScreenX; + {Statics[StaticP2R].Texture.X := Statics[StaticP2R].Texture.X + 10 * ScreenX; Text[TextP2R].X := Text[TextP2R].X + 10 * ScreenX; } - {Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; + {Statics[StaticP2RScoreBG].Texture.X := Statics[StaticP2RScoreBG].Texture.X + 10*ScreenX; Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX;} // end of weird stuff { - Static[1].Texture.X := Static[1].Texture.X + 10 * ScreenX; } + Statics[1].Texture.X := Statics[1].Texture.X + 10 * ScreenX; } { for T := 0 to 1 do Text[T].X := Text[T].X + 10 * ScreenX; } @@ -870,15 +870,15 @@ begin // will move the statics and texts to the correct screen here. // FIXME: clean up this weird stuff - {Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10 * ScreenX; + {Statics[StaticP1].Texture.X := Statics[StaticP1].Texture.X - 10 * ScreenX; Text[TextP1].X := Text[TextP1].X - 10 * ScreenX; - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10 * ScreenX; + Statics[StaticP2R].Texture.X := Statics[StaticP2R].Texture.X - 10 * ScreenX; Text[TextP2R].X := Text[TextP2R].X - 10 * ScreenX; // end of weird - Static[1].Texture.X := Static[1].Texture.X - 10 * ScreenX; + Statics[1].Texture.X := Statics[1].Texture.X - 10 * ScreenX; for T := 0 to 1 do Text[T].X := Text[T].X - 10 * ScreenX; } @@ -888,9 +888,9 @@ begin // maybe someone could find a better solution if Paused then begin - Static[StaticPausePopup].Visible := true; - Static[StaticPausePopup].Draw; - Static[StaticPausePopup].Visible := false; + Statics[StaticPausePopup].Visible := true; + Statics[StaticPausePopup].Draw; + Statics[StaticPausePopup].Visible := false; end; Result := true; -- cgit v1.2.3 From 868ce765441473e7d1fec9b3ad22a707f121a637 Mon Sep 17 00:00:00 2001 From: tobigun Date: Wed, 21 Apr 2010 18:27:36 +0000 Subject: - add video loop option - allow multiple instances of a video git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2260 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 69 ++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 36 deletions(-) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 74c09b4f..5f39ec49 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -105,7 +105,8 @@ type SungToEnd: boolean; fShowVisualization: boolean; - fCurrentVideoPlaybackEngine: IVideoPlayback; + fCurrentVideo: IVideo; + fVideoClip: IVideo; // some settings to be set by plugins settings: record @@ -179,13 +180,14 @@ begin fShowVisualization := not fShowVisualization; if fShowVisualization then - fCurrentVideoPlaybackEngine := Visualization + begin + fCurrentVideo := Visualization.Open(PATH_NONE); + fCurrentVideo.play; + end else - fCurrentVideoPlaybackEngine := VideoPlayback; - - if fShowVisualization then - fCurrentVideoPlaybackEngine.play; - + begin + fCurrentVideo := fVideoClip; + end; Exit; end; Ord('P'): @@ -216,7 +218,7 @@ begin SDLK_TAB: // change visualization preset begin if fShowVisualization then - fCurrentVideoPlaybackEngine.Position := now; // move to a random position + fCurrentVideo.Position := now; // move to a random position end; SDLK_RETURN: @@ -254,7 +256,7 @@ begin // pause video VideoFile := CurrentSong.Path.Append(CurrentSong.Video); if (CurrentSong.Video.IsSet) and VideoFile.Exists then - fCurrentVideoPlaybackEngine.Pause; + fCurrentVideo.Pause; end else // disable pause @@ -267,7 +269,7 @@ begin // video VideoFile := CurrentSong.Path.Append(CurrentSong.Video); if (CurrentSong.Video.IsSet) and VideoFile.Exists then - fCurrentVideoPlaybackEngine.Pause; + fCurrentVideo.Pause; Paused := false; end; @@ -283,7 +285,7 @@ begin fShowVisualization := false; - fCurrentVideoPlaybackEngine := VideoPlayback; + fCurrentVideo := nil; // create score class Scores := TSingScores.Create; @@ -358,8 +360,8 @@ begin ClearSettings; Party.CallBeforeSing; - // reset video playback engine, to play Video Clip... - fCurrentVideoPlaybackEngine := VideoPlayback; + // reset video playback engine + fCurrentVideo := nil; // setup score manager Scores.ClearPlayers; // clear old player values @@ -480,10 +482,6 @@ begin Exit; end; - // reset video playback engine, to play video clip ... - fCurrentVideoPlaybackEngine.Close; - fCurrentVideoPlaybackEngine := VideoPlayback; - {* * == Background == * We have four types of backgrounds: @@ -503,12 +501,13 @@ begin VideoFile := CurrentSong.Path.Append(CurrentSong.Video); if (CurrentSong.Video.IsSet) and VideoFile.IsFile then begin - if (fCurrentVideoPlaybackEngine.Open(VideoFile)) then + fVideoClip := VideoPlayback.Open(VideoFile); + fCurrentVideo := fVideoClip; + if (fVideoClip <> nil) then begin fShowVisualization := false; - fCurrentVideoPlaybackEngine := VideoPlayback; - fCurrentVideoPlaybackEngine.Position := CurrentSong.VideoGAP + CurrentSong.Start; - fCurrentVideoPlaybackEngine.Play; + fCurrentVideo.Position := CurrentSong.VideoGAP + CurrentSong.Start; + fCurrentVideo.Play; VideoLoaded := true; end; end; @@ -538,9 +537,9 @@ begin if (TVisualizerOption(Ini.VisualizerOption) in [voOn]) then begin fShowVisualization := true; - fCurrentVideoPlaybackEngine := Visualization; - if (fCurrentVideoPlaybackEngine <> nil) then - fCurrentVideoPlaybackEngine.Play; + fCurrentVideo := Visualization.Open(PATH_NONE); + if (fCurrentVideo <> nil) then + fCurrentVideo.Play; end; {* @@ -550,9 +549,9 @@ begin (VideoLoaded = false)) then begin fShowVisualization := true; - fCurrentVideoPlaybackEngine := Visualization; - if (fCurrentVideoPlaybackEngine <> nil) then - fCurrentVideoPlaybackEngine.Play; + fCurrentVideo := Visualization.Open(PATH_NONE); + if (fCurrentVideo <> nil) then + fCurrentVideo.Play; end; // prepare lyrics timer @@ -815,14 +814,14 @@ begin // update and draw movie if (ShowFinish and (VideoLoaded or fShowVisualization)) then begin - if assigned(fCurrentVideoPlaybackEngine) then + if assigned(fCurrentVideo) then begin // Just call this once // when Screens = 2 if (ScreenAct = 1) then - fCurrentVideoPlaybackEngine.GetFrame(CurrentSong.VideoGAP + LyricsState.GetCurrentTime()); + fCurrentVideo.GetFrame(CurrentSong.VideoGAP + LyricsState.GetCurrentTime()); - fCurrentVideoPlaybackEngine.DrawGL(ScreenAct); + fCurrentVideo.DrawGL(ScreenAct); end; end; @@ -902,15 +901,13 @@ begin AudioPlayback.Stop; AudioPlayback.SetSyncSource(nil); - if (VideoPlayback <> nil) then - VideoPlayback.Close; - - if (Visualization <> nil) then - Visualization.Close; - // to prevent drawing closed video VideoLoaded := false; + // close video files + fVideoClip := nil; + fCurrentVideo := nil; + // kill all stars and effects GoldenRec.KillAll; -- cgit v1.2.3 From deba59815a59cc6857c72872b7ae5d6d332bcb48 Mon Sep 17 00:00:00 2001 From: tobigun Date: Wed, 21 Apr 2010 19:17:12 +0000 Subject: major bug-fix: - TScreenSong.OnHide() interfered with TScreenSing.OnShow() method as the changes of AudioPlayback in TScreenSing.OnShow() were overwritten by TScreenSong.OnHide() which is called later. -> moved AudioPlayback initialization to OnShowFinish - The audio file was opened in TScreenSong, mainly that caused the interference. Now the audio file is opened in TScreenSing. This looks more cleaner too. - this patch fixes: - some race conditions - Dead Smiling Pirates song (and others) were not played from the beginning (especially on linux) cleanup: - removed unused MusicPreviewTimer git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2262 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 5f39ec49..5000d096 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -564,12 +564,6 @@ begin LyricsState.TotalTime := AudioPlayback.Length; LyricsState.UpdateBeats(); - // prepare music - AudioPlayback.Stop(); - AudioPlayback.Position := CurrentSong.Start; - // synchronize music to the lyrics - AudioPlayback.SetSyncSource(LyricsSync); - // prepare and start voice-capture AudioInput.CaptureStart; @@ -666,7 +660,16 @@ procedure TScreenSing.onShowFinish; begin // hide cursor on singscreen show Display.SetCursor; - + + // prepare music + // Important: AudioPlayback must not be initialized in onShow() as TScreenSong + // uses stops AudioPlayback in onHide() which interferes with TScreenSings onShow. + AudioPlayback.Open(CurrentSong.Path.Append(CurrentSong.Mp3)); + AudioPlayback.SetVolume(1.0); + AudioPlayback.Position := CurrentSong.Start; + // synchronize music to the lyrics + AudioPlayback.SetSyncSource(LyricsSync); + // start lyrics LyricsState.Resume(); -- cgit v1.2.3 From 898eb68e995d88f3e64040b7db08ab158159abe1 Mon Sep 17 00:00:00 2001 From: tobigun Date: Wed, 21 Apr 2010 21:38:54 +0000 Subject: - already show first video frame at sing-screen at onShow (no white screen) - removed some obsolete vars git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2268 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 62 ++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 31 deletions(-) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 5000d096..269ef201 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -60,12 +60,14 @@ type type TScreenSing = class(TMenu) + private + fShowVisualization: boolean; + fCurrentVideo: IVideo; + fVideoClip: IVideo; + fLyricsSync: TLyricsSyncSource; protected - VideoLoaded: boolean; eSongLoaded: THookableEvent; //< event is called after lyrics of a song are loaded on OnShow - protected Paused: boolean; //pause Mod - LyricsSync: TLyricsSyncSource; NumEmptySentences: integer; public // timebar fields @@ -104,12 +106,8 @@ type //the song was sung to the end SungToEnd: boolean; - fShowVisualization: boolean; - fCurrentVideo: IVideo; - fVideoClip: IVideo; - // some settings to be set by plugins - settings: record + Settings: record Finish: Boolean; //< if true, screen will finish on next draw LyricsVisible: Boolean; //< shows or hides lyrics @@ -240,8 +238,6 @@ end; // pause mod procedure TScreenSing.Pause; -var - VideoFile: IPath; begin if (not Paused) then // enable pause begin @@ -254,8 +250,7 @@ begin AudioPlayback.Pause; // pause video - VideoFile := CurrentSong.Path.Append(CurrentSong.Video); - if (CurrentSong.Video.IsSet) and VideoFile.Exists then + if (fCurrentVideo <> nil) then fCurrentVideo.Pause; end @@ -267,8 +262,7 @@ begin AudioPlayback.Play; // video - VideoFile := CurrentSong.Path.Append(CurrentSong.Video); - if (CurrentSong.Video.IsSet) and VideoFile.Exists then + if (fCurrentVideo <> nil) then fCurrentVideo.Pause; Paused := false; @@ -330,7 +324,7 @@ begin Theme.LyricBar.UpperX, Theme.LyricBar.UpperY, Theme.LyricBar.UpperW, Theme.LyricBar.UpperH, Theme.LyricBar.LowerX, Theme.LyricBar.LowerY, Theme.LyricBar.LowerW, Theme.LyricBar.LowerH); - LyricsSync := TLyricsSyncSource.Create(); + fLyricsSync := TLyricsSyncSource.Create(); eSongLoaded := THookableEvent.Create('ScreenSing.SongLoaded'); @@ -496,7 +490,6 @@ begin {* * set background to: video *} - VideoLoaded := false; fShowVisualization := false; VideoFile := CurrentSong.Path.Append(CurrentSong.Video); if (CurrentSong.Video.IsSet) and VideoFile.IsFile then @@ -508,14 +501,13 @@ begin fShowVisualization := false; fCurrentVideo.Position := CurrentSong.VideoGAP + CurrentSong.Start; fCurrentVideo.Play; - VideoLoaded := true; end; end; {* * set background to: picture *} - if (CurrentSong.Background.IsSet) and (VideoLoaded = false) + if (CurrentSong.Background.IsSet) and (fVideoClip = nil) and (TVisualizerOption(Ini.VisualizerOption) = voOff) then begin BgFile := CurrentSong.Path.Append(CurrentSong.Background); @@ -546,7 +538,7 @@ begin * set background to: visualization (Videos are still shown) *} if ((TVisualizerOption(Ini.VisualizerOption) in [voWhenNoVideo]) and - (VideoLoaded = false)) then + (fVideoClip = nil)) then begin fShowVisualization := true; fCurrentVideo := Visualization.Open(PATH_NONE); @@ -668,7 +660,7 @@ begin AudioPlayback.SetVolume(1.0); AudioPlayback.Position := CurrentSong.Start; // synchronize music to the lyrics - AudioPlayback.SetSyncSource(LyricsSync); + AudioPlayback.SetSyncSource(fLyricsSync); // start lyrics LyricsState.Resume(); @@ -718,6 +710,7 @@ var Sec: integer; T: integer; CurLyricsTime: real; + VideoFrameTime: Extended; Line: TLyricLine; LastWord: TLyricWord; begin @@ -815,17 +808,27 @@ begin end; // update and draw movie - if (ShowFinish and (VideoLoaded or fShowVisualization)) then + if Assigned(fCurrentVideo) then begin - if assigned(fCurrentVideo) then + // Just call this once + // when Screens = 2 + if (ScreenAct = 1) then begin - // Just call this once - // when Screens = 2 - if (ScreenAct = 1) then - fCurrentVideo.GetFrame(CurrentSong.VideoGAP + LyricsState.GetCurrentTime()); - - fCurrentVideo.DrawGL(ScreenAct); + if (ShowFinish) then + begin + // everything is setup, determine the current position + VideoFrameTime := CurrentSong.VideoGAP + LyricsState.GetCurrentTime(); + end + else + begin + // Important: do not yet start the triggered timer by a call to + // LyricsState.GetCurrentTime() + VideoFrameTime := CurrentSong.VideoGAP; + end; + fCurrentVideo.GetFrame(VideoFrameTime); end; + + fCurrentVideo.DrawGL(ScreenAct); end; // draw static menu (FG) @@ -904,9 +907,6 @@ begin AudioPlayback.Stop; AudioPlayback.SetSyncSource(nil); - // to prevent drawing closed video - VideoLoaded := false; - // close video files fVideoClip := nil; fCurrentVideo := nil; -- cgit v1.2.3 From edfc692c991e08af0163aa6812e5972478d7191b Mon Sep 17 00:00:00 2001 From: tobigun Date: Thu, 22 Apr 2010 01:04:24 +0000 Subject: - now it is possible to sync lyrics to audio - ini option SyncTo added - lyric to audio is default now (instead of sync audio to lyrics) - modified RelativeTimer (hopefully easier to use and more self-explanatory) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2273 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 269ef201..e4764760 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -58,6 +58,10 @@ type function GetClock(): real; override; end; + TMusicSyncSource = class(TSyncSource) + function GetClock(): real; override; + end; + type TScreenSing = class(TMenu) private @@ -65,6 +69,7 @@ type fCurrentVideo: IVideo; fVideoClip: IVideo; fLyricsSync: TLyricsSyncSource; + fMusicSync: TMusicSyncSource; protected eSongLoaded: THookableEvent; //< event is called after lyrics of a song are loaded on OnShow Paused: boolean; //pause Mod @@ -256,7 +261,7 @@ begin end else // disable pause begin - LyricsState.Resume(); + LyricsState.Start(); // play music AudioPlayback.Play; @@ -325,6 +330,7 @@ begin Theme.LyricBar.LowerX, Theme.LyricBar.LowerY, Theme.LyricBar.LowerW, Theme.LyricBar.LowerH); fLyricsSync := TLyricsSyncSource.Create(); + fMusicSync := TMusicSyncSource.Create(); eSongLoaded := THookableEvent.Create('ScreenSing.SongLoaded'); @@ -659,11 +665,21 @@ begin AudioPlayback.Open(CurrentSong.Path.Append(CurrentSong.Mp3)); AudioPlayback.SetVolume(1.0); AudioPlayback.Position := CurrentSong.Start; - // synchronize music to the lyrics - AudioPlayback.SetSyncSource(fLyricsSync); + + // synchronize music + if (Ini.SyncTo = Ord(stLyrics)) then + AudioPlayback.SetSyncSource(fLyricsSync) + else + AudioPlayback.SetSyncSource(nil); + + // synchronize lyrics (do not set this before AudioPlayback is initialized) + if (Ini.SyncTo = Ord(stMusic)) then + LyricsState.SetSyncSource(fMusicSync) + else + LyricsState.SetSyncSource(nil); // start lyrics - LyricsState.Resume(); + LyricsState.Start(true); // start music AudioPlayback.Play(); @@ -907,6 +923,9 @@ begin AudioPlayback.Stop; AudioPlayback.SetSyncSource(nil); + LyricsState.Stop(); + LyricsState.SetSyncSource(nil); + // close video files fVideoClip := nil; fCurrentVideo := nil; @@ -1045,5 +1064,10 @@ begin Result := LyricsState.GetCurrentTime(); end; +function TMusicSyncSource.GetClock(): real; +begin + Result := AudioPlayback.Position; +end; + end. -- cgit v1.2.3 From 69cf82185e7f559d8858b44fa76379c771acc6b6 Mon Sep 17 00:00:00 2001 From: tobigun Date: Fri, 23 Apr 2010 22:39:26 +0000 Subject: - font fallback added - more configurable fonts.ini - ftNormal/ftBold/ftOutline1/2 added git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2293 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index e4764760..233f1e38 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -591,7 +591,7 @@ begin case Ini.LyricsFont of 0: // normal fonts begin - Lyrics.FontStyle := 0; + Lyrics.FontStyle := ftNormal; Lyrics.LineColor_en.R := Skin_FontR; Lyrics.LineColor_en.G := Skin_FontG; @@ -608,9 +608,12 @@ begin Lyrics.LineColor_act.B := 0.8; Lyrics.LineColor_act.A := 1; end; - 1, 2: // outline fonts (is TScalableOutlineFont) + 1, 2: // outline fonts begin - Lyrics.FontStyle := Ini.LyricsFont + 1; + if (Ini.LyricsFont = 1) then + Lyrics.FontStyle := ftOutline1 + else + Lyrics.FontStyle := ftOutline2; Lyrics.LineColor_en.R := 0.75; Lyrics.LineColor_en.G := 0.75; -- cgit v1.2.3 From 649bc453f74b3af59c29ade469f5009a17b93995 Mon Sep 17 00:00:00 2001 From: tobigun Date: Thu, 3 Jun 2010 13:04:48 +0000 Subject: - cleanup (removed some commented unused code) - added timebar display toggling with the 'T'-key to switch between current, remaining and total time in sing-screen git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2437 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 120 +++++++++++++++++++------------------------- 1 file changed, 52 insertions(+), 68 deletions(-) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 233f1e38..67855e77 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -62,6 +62,12 @@ type function GetClock(): real; override; end; + TTimebarMode = ( + tbmCurrent, // current song position + tbmRemaining, // remaining time + tbmTotal // total time + ); + type TScreenSing = class(TMenu) private @@ -70,6 +76,7 @@ type fVideoClip: IVideo; fLyricsSync: TLyricsSyncSource; fMusicSync: TMusicSyncSource; + fTimebarMode: TTimebarMode; protected eSongLoaded: THookableEvent; //< event is called after lyrics of a song are loaded on OnShow Paused: boolean; //pause Mod @@ -178,7 +185,9 @@ begin Result := false; Exit; end; - Ord('V'): // show visualization + + // show visualization + Ord('V'): begin fShowVisualization := not fShowVisualization; @@ -193,11 +202,23 @@ begin end; Exit; end; + + // pause Ord('P'): begin Pause; Exit; end; + + // toggle time display + Ord('T'): + begin + if (fTimebarMode = High(TTimebarMode)) then + fTimebarMode := Low(TTimebarMode) + else + Inc(fTimebarMode); + Exit; + end; end; // check special keys @@ -450,6 +471,8 @@ begin Statics[StaticP3R].Visible := V3R; Text[TextP3R].Visible := V3R; + fTimebarMode := tbmCurrent; + // FIXME: sets path and filename to '' ResetSingTemp; @@ -725,8 +748,10 @@ end; function TScreenSing.Draw: boolean; var - Min: integer; - Sec: integer; + DisplayTime: real; + DisplayPrefix: string; + DisplayMin: integer; + DisplaySec: integer; T: integer; CurLyricsTime: real; VideoFrameTime: Extended; @@ -769,53 +794,31 @@ begin end; // case end; // if - //// - // dual screen, part 1 - //////////////////////// - - // Note: ScreenX is the offset of the current screen in dual-screen mode so we - // will move the statics and texts to the correct screen here. - // FIXME: clean up this weird stuff. Commenting this stuff out, nothing - // was missing on screen w/ 6 players - so do we even need this stuff? - {Statics[StaticP1].Texture.X := Statics[StaticP1].Texture.X + 10 * ScreenX; - - Text[TextP1].X := Text[TextP1].X + 10 * ScreenX; } - - {Statics[StaticP1ScoreBG].Texture.X := Statics[StaticP1ScoreBG].Texture.X + 10*ScreenX; - Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX;} - - {Statics[StaticP2R].Texture.X := Statics[StaticP2R].Texture.X + 10 * ScreenX; - - Text[TextP2R].X := Text[TextP2R].X + 10 * ScreenX; } - - {Statics[StaticP2RScoreBG].Texture.X := Statics[StaticP2RScoreBG].Texture.X + 10*ScreenX; - Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX;} - - // end of weird stuff - { - Statics[1].Texture.X := Statics[1].Texture.X + 10 * ScreenX; } - - { for T := 0 to 1 do - Text[T].X := Text[T].X + 10 * ScreenX; } - // retrieve current lyrics time, we have to store the value to avoid // that min- and sec-values do not match CurLyricsTime := LyricsState.GetCurrentTime(); - Min := Round(CurLyricsTime) div 60; - Sec := Round(CurLyricsTime) mod 60; + + // retrieve time for timebar text + case (fTimebarMode) of + tbmRemaining: begin + DisplayTime := LyricsState.TotalTime - CurLyricsTime; + DisplayPrefix := '-'; + end; + tbmTotal: begin + DisplayTime := LyricsState.TotalTime; + DisplayPrefix := '#'; + end; + else begin + DisplayTime := CurLyricsTime; + DisplayPrefix := ''; + end; + end; + DisplayMin := Round(DisplayTime) div 60; + DisplaySec := Round(DisplayTime) mod 60; // update static menu with time ... - Text[TextTimeText].Text := ''; - if Min < 10 then - Text[TextTimeText].Text := '0'; - Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Min) + ':'; - if Sec < 10 then - Text[TextTimeText].Text := Text[TextTimeText].Text + '0'; - Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Sec); - - // draw static menu (BG) - // Note: there is no menu and the animated background brakes the video playback - //DrawBG; + Text[TextTimeText].Text := Format('%s%.2d:%.2d', + [DisplayPrefix, DisplayMin, DisplaySec]); //the song was sung to the end? Line := Lyrics.GetUpperLine(); @@ -857,8 +860,10 @@ begin //Log.LogError('Check for music finish: ' + BoolToStr(Music.Finished) + ' ' + FloatToStr(LyricsState.CurrentTime*1000) + ' ' + IntToStr(CurrentSong.Finish)); if ShowFinish then begin - if (not AudioPlayback.Finished) and ((CurrentSong.Finish = 0) or - (LyricsState.GetCurrentTime() * 1000 <= CurrentSong.Finish)) and (not Settings.Finish) then + if (not AudioPlayback.Finished) and + ((CurrentSong.Finish = 0) or + (LyricsState.GetCurrentTime() * 1000 <= CurrentSong.Finish)) and + (not Settings.Finish) then begin // analyze song if not paused if (not Paused) then @@ -886,27 +891,6 @@ begin // draw scores Scores.Draw; - //// - // dual screen, part 2 - //////////////////////// - - // Note: ScreenX is the offset of the current screen in dual-screen mode so we - // will move the statics and texts to the correct screen here. - // FIXME: clean up this weird stuff - - {Statics[StaticP1].Texture.X := Statics[StaticP1].Texture.X - 10 * ScreenX; - Text[TextP1].X := Text[TextP1].X - 10 * ScreenX; - - Statics[StaticP2R].Texture.X := Statics[StaticP2R].Texture.X - 10 * ScreenX; - Text[TextP2R].X := Text[TextP2R].X - 10 * ScreenX; - - // end of weird - - Statics[1].Texture.X := Statics[1].Texture.X - 10 * ScreenX; - - for T := 0 to 1 do - Text[T].X := Text[T].X - 10 * ScreenX; } - // draw pausepopup // FIXME: this is a workaround that the static is drawn over the lyrics, lines, scores and effects // maybe someone could find a better solution -- cgit v1.2.3 From b272c672d0fb3857f760bf39d3571028919c14b0 Mon Sep 17 00:00:00 2001 From: tobigun Date: Sun, 6 Jun 2010 08:41:02 +0000 Subject: - Now on sing-screen entry a check is performed if mics are assigned to all players. If not an error popup is displayed (but the sing-screen does not abort). - Player 1 is not assigned to the first detected audio device anymore - Previously the auto-detected one might have been a non-mic port of the internal sound card like mono or stereo mix - If the user has singstar mics he does not have to check for other automatically assigned devices for player 1 what caused many problems in the past -> Providing no default might be better (and the user can check the input volume, too) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2449 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 67855e77..aa32dd4a 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -370,6 +370,8 @@ var Color: TRGB; VideoFile, BgFile: IPath; success: boolean; + PlayerState: TBooleanDynArray; + BadPlayer: integer; begin inherited; @@ -585,6 +587,14 @@ begin LyricsState.TotalTime := AudioPlayback.Length; LyricsState.UpdateBeats(); + BadPlayer := AudioInputProcessor.CheckPlayersConfig(PlayersPlay, PlayerState); + if (BadPlayer <> 0) then + begin + ScreenPopupError.ShowPopup( + Format(Language.Translate('ERROR_PLAYER_NO_DEVICE_ASSIGNMENT'), + [BadPlayer])); + end; + // prepare and start voice-capture AudioInput.CaptureStart; -- cgit v1.2.3 From 81945c399590c1bd2c6837bdae0091f6b649b3a1 Mon Sep 17 00:00:00 2001 From: tobigun Date: Sun, 6 Jun 2010 10:08:25 +0000 Subject: - URecord.ValidateSettings should not display the popup itself - Array free version of CheckPlayersConfig git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2450 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index aa32dd4a..fe8ea8e8 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -370,7 +370,6 @@ var Color: TRGB; VideoFile, BgFile: IPath; success: boolean; - PlayerState: TBooleanDynArray; BadPlayer: integer; begin inherited; @@ -587,7 +586,7 @@ begin LyricsState.TotalTime := AudioPlayback.Length; LyricsState.UpdateBeats(); - BadPlayer := AudioInputProcessor.CheckPlayersConfig(PlayersPlay, PlayerState); + BadPlayer := AudioInputProcessor.CheckPlayersConfig(PlayersPlay); if (BadPlayer <> 0) then begin ScreenPopupError.ShowPopup( -- cgit v1.2.3 From f261cd24db299daee8a0d8e470ff7d173f1a1c75 Mon Sep 17 00:00:00 2001 From: brunzelchen Date: Thu, 10 Jun 2010 18:27:53 +0000 Subject: merge of VideoPreview branch into trunk git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2475 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index fe8ea8e8..3e0d8078 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -522,7 +522,7 @@ begin *} fShowVisualization := false; VideoFile := CurrentSong.Path.Append(CurrentSong.Video); - if (CurrentSong.Video.IsSet) and VideoFile.IsFile then + if (Ini.VideoEnabled = 1) and CurrentSong.Video.IsSet() and VideoFile.IsFile then begin fVideoClip := VideoPlayback.Open(VideoFile); fCurrentVideo := fVideoClip; @@ -859,7 +859,8 @@ begin fCurrentVideo.GetFrame(VideoFrameTime); end; - fCurrentVideo.DrawGL(ScreenAct); + fCurrentVideo.SetScreen(ScreenAct); + fCurrentVideo.Draw; end; // draw static menu (FG) -- cgit v1.2.3 From 6731fad709d6ae924c15b0781d8debadaaf4840c Mon Sep 17 00:00:00 2001 From: brunzelchen Date: Sun, 4 Jul 2010 15:16:46 +0000 Subject: - divide ScreenW by 2 in modi list if screens=2 and fullscreen (UIni) - fixed crash after singing (with screens=2) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2572 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 3e0d8078..b0318072 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -230,8 +230,8 @@ begin //Sound[0].BufferLong Finish; + FadeOut := true; AudioPlayback.PlaySound(SoundLib.Back); - FadeTo(@ScreenScore); end; SDLK_SPACE: @@ -884,7 +884,7 @@ begin end else begin - if (not FadeOut) then + if (not FadeOut) and (Screens=1) or (ScreenAct=2) then begin Finish; FadeOut := true; @@ -942,7 +942,8 @@ begin SetFontItalic(false); - Party.CallAfterSing; + if not FadeOut then + Party.CallAfterSing; end; procedure TScreenSing.OnSentenceEnd(SentenceIndex: cardinal); -- cgit v1.2.3 From 8920d1734579bd3e66590ce6a8b4b8df6e04eb85 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 19 Aug 2010 20:47:55 +0000 Subject: reload header in screensing.OnShow git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2614 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/screens/UScreenSing.pas') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index b0318072..3b8fda40 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -483,9 +483,9 @@ begin try // check if file is xml if CurrentSong.FileName.GetExtension.ToUTF8 = '.xml' then - success := CurrentSong.LoadXMLSong() + success := CurrentSong.AnalyseXML and CurrentSong.LoadXMLSong() else - success := CurrentSong.LoadSong(); + success := CurrentSong.Analyse and CurrentSong.LoadSong(); except success := false; end; -- cgit v1.2.3