From 94cefdb78044e0f9996e3032de34b690de98b708 Mon Sep 17 00:00:00 2001 From: tobigun Date: Thu, 23 Jul 2009 12:34:07 +0000 Subject: - revert to 1777 - Ocean.ini and SVN properties are not reverted git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/experimental@1854 b956fd51-792f-4845-bead-9b4dfca2ff2c --- unicode/src/screens/UScreenSingModi.pas | 419 ++++++++++++++++++++++---------- 1 file changed, 290 insertions(+), 129 deletions(-) (limited to 'unicode/src/screens/UScreenSingModi.pas') diff --git a/unicode/src/screens/UScreenSingModi.pas b/unicode/src/screens/UScreenSingModi.pas index 3ae5b7dc..b9c9365d 100644 --- a/unicode/src/screens/UScreenSingModi.pas +++ b/unicode/src/screens/UScreenSingModi.pas @@ -33,45 +33,74 @@ interface {$I switches.inc} -uses - UMenu, - UMusic, - SDL, - SysUtils, - UFiles, - UTime, - USongs, - UIni, - ULog, - UTexture, - ULyrics, - TextGL, - gl, - - UThemes, - UScreenSing, - ModiSDK; + +uses UMenu, + UMusic, + SDL, + SysUtils, + UFiles, + UTime, + USongs, + UIni, + ULog, + UTexture, + ULyrics, + TextGL, + gl, + + UThemes, + UScreenSing, + ModiSDK; type TScreenSingModi = class(TScreenSing) protected - + //paused: boolean; //Pause Mod + //PauseTime: Real; + //NumEmptySentences: integer; public - Winner: byte; //Who Wins + //TextTime: integer; + + //StaticP1: integer; + //StaticP1ScoreBG: integer; + //TextP1: integer; + //TextP1Score: integer; + + //StaticP2R: integer; + //StaticP2RScoreBG: integer; + //TextP2R: integer; + //TextP2RScore: integer; + + //StaticP2M: integer; + //StaticP2MScoreBG: integer; + //TextP2M: integer; + //TextP2MScore: integer; + + //StaticP3R: integer; + //StaticP3RScoreBG: integer; + //TextP3R: integer; + //TextP3RScore: integer; + + //Tex_Background: TTexture; + //FadeOut: boolean; + //LyricMain: TLyric; + //LyricSub: TLyric; + Winner: Byte; //Who Wins PlayerInfo: TPlayerInfo; TeamInfo: TTeamInfo; constructor Create; override; procedure onShow; override; //procedure onShowFinish; override; - function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + function ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; override; function Draw: boolean; override; procedure Finish; override; + //procedure Pause; //Pause Mod(Toggles Pause) end; type TCustomSoundEntry = record - Filename : string; + Filename : String; Stream : TAudioPlaybackStream; end; @@ -80,19 +109,11 @@ var CustomSounds: array of TCustomSoundEntry; //Procedured for Plugin -function LoadTex(const Name: PChar; Typ: TTextureType): TsmallTexture; - {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} -//function Translate (const Name: PChar): PChar; -// {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} -//Procedure to Print Text -procedure Print(const Style, Size: byte; const X, Y: real; const Text: PChar); - {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} -//Procedure that loads a Custom Sound -function LoadSound(const Name: PChar): cardinal; - {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} -//Plays a Custom Sound -procedure PlaySound(const Index: cardinal); - {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} +function LoadTex (const Name: PChar; Typ: TTextureType): TsmallTexture; stdcall; +//function Translate (const Name: PChar): PChar; stdcall; +procedure Print (const Style, Size: Byte; const X, Y: Real; const Text: PChar); stdcall; //Procedure to Print Text +function LoadSound (const Name: PChar): Cardinal; stdcall; //Procedure that loads a Custom Sound +procedure PlaySound (const Index: Cardinal); stdcall; //Plays a Custom Sound //Utilys function ToSentences(Const Lines: TLines): TSentences; @@ -112,12 +133,12 @@ uses URecord, USkins; -// Method for input parsing. If false is returned, GetNextWindow +// Method for input parsing. If False is returned, GetNextWindow // should be checked to know the next window to load; -function TScreenSingModi.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; +function TScreenSingModi.ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; begin Result := true; - if (PressedDown) then + If (PressedDown) Then begin // Key Down case PressedKey of @@ -143,7 +164,7 @@ end; function ToSentences(Const Lines: TLines): TSentences; var - I, J: integer; + I, J: Integer; begin Result.Current := Lines.Current; Result.High := Lines.High; @@ -178,7 +199,7 @@ end; procedure TScreenSingModi.onShow; var - I: integer; + I: Integer; begin inherited; @@ -200,14 +221,14 @@ begin PlayerInfo.Playerinfo[I].Name := PChar(Ini.Name[I]); PlayerInfo.Playerinfo[I].Score := 0; PlayerInfo.Playerinfo[I].Bar := 50; - PlayerInfo.Playerinfo[I].Enabled := true; + PlayerInfo.Playerinfo[I].Enabled := True; end; for I := PlayerInfo.NumPlayers to high(PlayerInfo.Playerinfo) do begin PlayerInfo.Playerinfo[I].Score:= 0; PlayerInfo.Playerinfo[I].Bar := 0; - PlayerInfo.Playerinfo[I].Enabled := false; + PlayerInfo.Playerinfo[I].Enabled := False; end; {Case PlayersPlay of @@ -254,22 +275,18 @@ begin end; // Set Background (Little Workaround, maybe change sometime) - if (DLLMan.Selected.LoadBack) and (DLLMan.Selected.LoadSong) then + if (DLLMan.Selected.LoadBack) AND (DLLMan.Selected.LoadSong) then ScreenSing.Tex_Background := Tex_Background; Winner := 0; //Set Score Visibility - Scores.Visible := DLLMan.Selected.ShowScore; - - {if PlayersPlay = 1 then - begin + {if PlayersPlay = 1 then begin Text[TextP1Score].Visible := DLLMan.Selected.ShowScore; Static[StaticP1ScoreBG].Visible := DLLMan.Selected.ShowScore; end; - if (PlayersPlay = 2) or (PlayersPlay = 4) then - begin + if (PlayersPlay = 2) OR (PlayersPlay = 4) then begin Text[TextP1TwoPScore].Visible := DLLMan.Selected.ShowScore; Static[StaticP1TwoPScoreBG].Visible := DLLMan.Selected.ShowScore; @@ -277,8 +294,7 @@ begin Static[StaticP2RScoreBG].Visible := DLLMan.Selected.ShowScore; end; - if (PlayersPlay = 3) or (PlayersPlay = 6) then - begin + if (PlayersPlay = 3) OR (PlayersPlay = 6) then begin Text[TextP1ThreePScore].Visible := DLLMan.Selected.ShowScore; Static[StaticP1ThreePScoreBG].Visible := DLLMan.Selected.ShowScore; @@ -314,39 +330,116 @@ begin end; end; - Background.Draw; + //Show Score + if DLLMan.Selected.ShowScore then + begin + {//ScoreBG Mod + // set player colors + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, + Static[StaticP1TwoP].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P2Dark'); - // 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 (DllMan.Selected.LoadSong) and (DllMan.Selected.LoadBack) and (not fShowVisualization) then - SingDrawBackground; - // set player names (for 2 screens and only Singstar skin) - if ScreenAct = 1 then - begin - Text[TextP1].Text := 'P1'; - Text[TextP1TwoP].Text := 'P1'; // added for ps3 skin - Text[TextP1ThreeP].Text := 'P1'; // added for ps3 skin - Text[TextP2R].Text := 'P2'; - Text[TextP2M].Text := 'P2'; - Text[TextP3R].Text := 'P3'; - end - Else 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 + LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, + Static[StaticP1TwoPScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); + + + + end; + if ScreenAct = 2 then begin + LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, + Static[StaticP1TwoP].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P4Dark'); + + + + LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, + Static[StaticP1TwoPScoreBG].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark'); + + + + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, + Static[StaticP1ThreeP].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P2Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P3Dark'); + + + + LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, + Static[StaticP1ThreePScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); + LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, + Static[StaticP3RScoreBG].Texture.ColB, 'P3Dark'); + + + + end; + if ScreenAct = 2 then begin + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, + Static[StaticP1ThreeP].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P5Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P6Dark'); + + + + + LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, + Static[StaticP1ThreePScoreBG].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark'); + LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, + Static[StaticP3RScoreBG].Texture.ColB, 'P6Dark'); + + + + + end; + end; + //end ScoreBG Mod } + + // set player names (for 2 screens and only Singstar skin) + if ScreenAct = 1 then begin + Text[TextP1].Text := 'P1'; + Text[TextP1TwoP].Text := 'P1'; // added for ps3 skin + Text[TextP1ThreeP].Text := 'P1'; // added for ps3 skin + 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 + // stereo <- and where iss P2M? or P3? Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; @@ -358,6 +451,92 @@ begin 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;} + + // .. and scores + {if PlayersPlay = 1 then begin + TextStr := IntToStr(Player[0].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP1Score].Text := TextStr; + end; + + if PlayersPlay = 2 then begin + TextStr := IntToStr(Player[0].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP1TwoPScore].Text := TextStr; + + TextStr := IntToStr(Player[1].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP2RScore].Text := TextStr; + end; + + if PlayersPlay = 3 then begin + TextStr := IntToStr(Player[0].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP1ThreePScore].Text := TextStr; + + TextStr := IntToStr(Player[1].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP2MScore].Text := TextStr; + + TextStr := IntToStr(Player[2].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP3RScore].Text := TextStr; + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + TextStr := IntToStr(Player[0].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP1TwoPScore].Text := TextStr; + + TextStr := IntToStr(Player[1].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP2RScore].Text := TextStr; + end; + if ScreenAct = 2 then begin + TextStr := IntToStr(Player[2].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP1TwoPScore].Text := TextStr; + + TextStr := IntToStr(Player[3].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP2RScore].Text := TextStr; + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + TextStr := IntToStr(Player[0].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP1ThreePScore].Text := TextStr; + + TextStr := IntToStr(Player[1].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP2MScore].Text := TextStr; + + TextStr := IntToStr(Player[2].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP3RScore].Text := TextStr; + end; + if ScreenAct = 2 then begin + TextStr := IntToStr(Player[3].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP1ThreePScore].Text := TextStr; + + TextStr := IntToStr(Player[4].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP2MScore].Text := TextStr; + + TextStr := IntToStr(Player[5].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP3RScore].Text := TextStr; + end; + end; } + + end; //ShowScore + for S := 1 to 1 do Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX; @@ -378,43 +557,30 @@ begin Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Sec); end; + // draw static menu (BG) + DrawBG; + + //Draw Background + if (DllMan.Selected.LoadSong) AND (DllMan.Selected.LoadBack) then + SingDrawBackground; + // update and draw movie -{ if ShowFinish and CurrentSong.VideoLoaded and DllMan.Selected.LoadVideo then - begin +{ if ShowFinish and CurrentSong.VideoLoaded AND DllMan.Selected.LoadVideo then begin UpdateSmpeg; // this only draws end;} - // update and draw movie - if (ShowFinish and (VideoLoaded or fShowVisualization) and DllMan.Selected.LoadVideo) then - begin - if assigned(fCurrentVideoPlaybackEngine) then - begin - // Just call this once - // when Screens = 2 - if (ScreenAct = 1) then - fCurrentVideoPlaybackEngine.GetFrame(CurrentSong.VideoGAP + LyricsState.GetCurrentTime()); - - fCurrentVideoPlaybackEngine.DrawGL(ScreenAct); - end; - end; - // draw static menu (FG) DrawFG; - if ShowFinish then - begin + if ShowFinish then begin if DllMan.Selected.LoadSong then begin - if (not AudioPlayback.Finished) and ((CurrentSong.Finish = 0) or (LyricsState.GetCurrentTime*1000 <= CurrentSong.Finish)) then - begin + if (not AudioPlayback.Finished) and ((CurrentSong.Finish = 0) or (LyricsState.GetCurrentTime*1000 <= CurrentSong.Finish)) then begin //Pause Mod: if not Paused then Sing(Self); // analyze song - end - else - begin - if not FadeOut then - begin + end else begin + if not FadeOut then begin Finish; FadeOut := true; FadeTo(@ScreenPartyScore); @@ -430,9 +596,6 @@ begin GoldenRec.SpawnRec; //GoldenNoteStarsTwinkle Mod - //Draw Score - Scores.Draw; - //Update PlayerInfo for I := 0 to PlayerInfo.NumPlayers-1 do begin @@ -443,15 +606,14 @@ begin end; end; - if ((ShowFinish) and (not Paused)) then + if ((ShowFinish) AND (NOT Paused)) then begin if not DLLMan.PluginDraw(Playerinfo, Lines[0].Current) then begin - if not FadeOut then - begin - Finish; - FadeOut := true; - FadeTo(@ScreenPartyScore); + if not FadeOut then begin + Finish; + FadeOut := true; + FadeTo(@ScreenPartyScore); end; end; end; @@ -475,12 +637,14 @@ 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; {Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX;} + for S := 1 to 1 do Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX; @@ -501,13 +665,13 @@ Winner := DllMan.PluginFinish(PlayerInfo); //DLLMan.UnLoadPlugin; end; -function LoadTex(const Name: PChar; Typ: TTextureType): TsmallTexture; +function LoadTex (const Name: PChar; Typ: TTextureType): TsmallTexture; stdcall; var - Texname, EXT: string; + Texname, EXT: String; Tex: TTexture; begin //Get texture Name - TexName := Skin.GetTextureFileName(string(Name)); + TexName := Skin.GetTextureFileName(String(Name)); //Get File Typ Ext := ExtractFileExt(TexName); if (uppercase(Ext) = '.JPG') then @@ -524,11 +688,10 @@ end; { function Translate (const Name: PChar): PChar; stdcall; begin - Result := PChar(Language.Translate(string(Name))); + Result := PChar(Language.Translate(String(Name))); end; } -//Procedure to Print Text -procedure Print(const Style, Size: byte; const X, Y: real; const Text: PChar); +procedure Print(const Style, Size: Byte; const X, Y: Real; const Text: PChar); stdcall; //Procedure to Print Text begin SetFontItalic ((Style and 128) = 128); SetFontStyle(Style and 7); @@ -536,15 +699,14 @@ begin // used by Hold_The_Line / TeamDuell SetFontSize(Size); SetFontPos (X, Y); - glPrint (Language.Translate(string(Text))); + glPrint (Language.Translate(String(Text))); end; -//Procedure that loads a Custom Sound -function LoadSound(const Name: PChar): cardinal; +function LoadSound(const Name: PChar): Cardinal; stdcall; //Procedure that loads a Custom Sound var Stream: TAudioPlaybackStream; - i: integer; - Filename: string; + i: Integer; + Filename: String; begin //Search for Sound in already loaded Sounds Filename := UpperCase(SoundPath + Name); @@ -557,7 +719,7 @@ begin end; end; - Stream := AudioPlayback.OpenSound(SoundPath + string(Name)); + Stream := AudioPlayback.OpenSound(SoundPath + String(Name)); if (Stream = nil) then begin Result := 0; @@ -569,8 +731,7 @@ begin Result := High(CustomSounds); end; -//Plays a Custom Sound -procedure PlaySound(const Index: cardinal); +procedure PlaySound(const Index: Cardinal); stdcall; //Plays a Custom Sound begin if (Index <= High(CustomSounds)) then AudioPlayback.PlaySound(CustomSounds[Index].Stream); -- cgit v1.2.3