From 62c82114318ed04ce42617fa9ce2e179834dbda4 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Wed, 19 Sep 2007 11:44:10 +0000 Subject: added UCommon ( in classes ) for lazarus... common functions needed for lazarus ( and others ) can be put in here. also this now compiles on lazarus.. ( dosnt link yet... but I dont get any critical compiler errors ) tested to compile in my delphi, and basic functionality is fine. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@395 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Screens/UScreenCredits.pas | 12 ++---------- Game/Code/Screens/UScreenEditConvert.pas | 14 +++++++++++++- Game/Code/Screens/UScreenEditSub.pas | 12 ++++++++++-- Game/Code/Screens/UScreenScore.pas | 14 ++++++++++---- Game/Code/Screens/UScreenSing.pas | 10 ++++++++-- Game/Code/Screens/UScreenSong.pas | 7 ++++--- Game/Code/Screens/UScreenTop5.pas | 13 +++++++++---- 7 files changed, 56 insertions(+), 26 deletions(-) (limited to 'Game/Code/Screens') diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index 21e164b9..3b1efc6e 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -104,24 +104,16 @@ const implementation -uses // Dialogs, - Windows, +uses Windows, UGraphic, UMain, UIni, USongs, Textgl, -// opengl, ULanguage, + UCommon, Math; -{$IFDEF FPC} -// TODO : JB - move this to a lazarus common file for ultrastar -function RandomRange(aMin: Integer; aMax: Integer) : Integer; -begin -RandomRange := Random(aMax-aMin) + aMin ; -end; -{$ENDIF} function TScreenCredits.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; begin diff --git a/Game/Code/Screens/UScreenEditConvert.pas b/Game/Code/Screens/UScreenEditConvert.pas index cb6aef6d..762f84c2 100644 --- a/Game/Code/Screens/UScreenEditConvert.pas +++ b/Game/Code/Screens/UScreenEditConvert.pas @@ -2,6 +2,10 @@ unit UScreenEditConvert; interface +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + {$I switches.inc} uses UMenu, @@ -353,11 +357,13 @@ begin if ((ATrack[T].Status div 1) and 1) = 1 then Inc(Result); end; +{$IFDEF UseMIDIPort} procedure TScreenEditConvert.MidiFile1MidiEvent(event: PMidiEvent); begin // Log.LogStatus(IntToStr(event.event), 'MIDI'); MidiOut.PutShort(event.event, event.data1, event.data2); end; +{$ENDIF} constructor TScreenEditConvert.Create; var @@ -407,6 +413,7 @@ var C: integer; // channel CN: integer; // channel note begin +{$IFDEF UseMIDIPort} MidiOut := TMidiOutput.Create(nil); if Ini.Debug = 1 then MidiOut.ProductName := 'Microsoft GS Wavetable SW Synth'; // for my kxproject without midi table @@ -486,6 +493,7 @@ begin end; Interaction := 0; +{$ENDIF} end; function TScreenEditConvert.Draw: boolean; @@ -552,7 +560,9 @@ begin end; // playing line - X := 60+MidiFile.GetCurrentTime/MidiFile.GetTrackLength*730; + {$IFDEF UseMIDIPort} + X := 60 + MidiFile.GetCurrentTime/MidiFile.GetTrackLength*730; + {$ENDIF} DrawLine(X, Y, X, Bottom, 0.3, 0.3, 0.3); @@ -560,8 +570,10 @@ end; procedure TScreenEditConvert.onHide; begin +{$IFDEF UseMIDIPort} MidiOut.Close; MidiOut.Free; +{$ENDIF} end; end. diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index 7184b0b6..3843fbf4 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -1169,11 +1169,12 @@ begin Exit; end else begin + {$IFDEF UseMIDIPort} MidiOut := TMidiOutput.Create(nil); if Ini.Debug = 1 then MidiOut.ProductName := 'Microsoft GS Wavetable SW Synth'; // for my kxproject without midi table MidiOut.Open; - + {$ENDIF} Text[TextTitle].Text := AktSong.Title; Text[TextArtist].Text := AktSong.Artist; Text[TextMp3].Text := AktSong.Mp3; @@ -1224,11 +1225,13 @@ begin if PlaySentenceMidi then begin MidiPos := USTime.GetTime - MidiTime + MidiStart; + {$IFDEF UseMIDIPort} // stop the music if (MidiPos > MidiStop) then begin MidiOut.PutShort($81, Czesci[0].Czesc[Czesci[0].Akt].Nuta[MidiLastNote].Ton + 60, 127); PlaySentenceMidi := false; end; + {$ENDIF} // click AktBeat := Floor(GetMidBeat(MidiPos - AktSong.GAP / 1000)); @@ -1236,13 +1239,16 @@ begin if AktBeat <> LastClick then begin for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do - if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = AktBeat) then begin + if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = AktBeat) then + begin + {$IFDEF UseMIDIPort} LastClick := AktBeat; if Pet > 0 then MidiOut.PutShort($81, Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet-1].Ton + 60, 127); MidiOut.PutShort($91, Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Ton + 60, 127); MidiLastNote := Pet; + {$ENDIF} end; end; @@ -1312,8 +1318,10 @@ end; procedure TScreenEditSub.onHide; begin + {$IFDEF UseMIDIPort} MidiOut.Close; MidiOut.Free; + {$ENDIF} //Music.SetVolume(100); end; diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index 19e934f4..42edf4c9 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -2,6 +2,10 @@ unit UScreenScore; interface +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + uses UMenu, SDL, @@ -274,7 +278,7 @@ begin Text[TextName[PP]].Text := Ini.Name[P]; - {{$IFDEF TRANSLATE} + //{$IFDEF TRANSLATE} case (Player[P].ScoreTotalI) of 0..2000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_TONE_DEAF'); 2010..4000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_AMATEUR'); @@ -284,7 +288,7 @@ begin 9010..9800: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_SUPERSTAR'); 9810..10000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_ULTRASTAR'); end; - {{$ELSE}{ + (* {$ELSE}{ case (Player[P].ScoreTotalI) of 0..2000: Text[TextScore[PP]].Text := 'Tone Deaf'; 2010..4000: Text[TextScore[PP]].Text := 'Amateur'; @@ -294,7 +298,7 @@ begin 9010..9800: Text[TextScore[PP]].Text := 'Superstar'; 9810..10000: Text[TextScore[PP]].Text := 'Ultrastar'; end; - {$ENDIF} + {$ENDIF} *) S := IntToStr(Player[P].ScoreI); while (Length(S)<4) do S := '0' + S; @@ -313,10 +317,12 @@ begin Text[TextTotalScore[PP]].Text := S; // Level bar length -{ Lev := ((Round(Player[P].Punkty) div 10) * 10) / 10000; +(* + Lev := ((Round(Player[P].Punkty) div 10) * 10) / 10000; Static[StaticLevel[PP]].Texture.H := Round(Static[StaticBackLevel[PP]].Texture.H * Lev); Static[StaticLevel[PP]].Texture.Y := Static[StaticBackLevel[PP]].Texture.Y + Static[StaticBackLevel[PP]].Texture.H - Static[StaticLevel[PP]].Texture.H; Static[StaticLevelRound[PP]].Texture.Y := Static[StaticLevel[PP]].Texture.Y - Static[StaticLevelRound[PP]].Texture.H;} +*) // doesn't align too much... (to fix) // hint: play with wrapping textures // resolution: setting TexY1 and TexY2 to 0.1 and 0.9 diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index a5f6a317..1dd31ae9 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -2,6 +2,11 @@ unit UScreenSing; interface +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, UTexture, ULyrics, TextGL, OpenGL12, BASS, UThemes, ULCD, UGraphicClasses, UVideo; @@ -364,8 +369,9 @@ begin // set movie if (AktSong.Video <> '') and FileExists(AktSong.Path + AktSong.Video) then begin -{ OpenSmpeg(AktSong.Path + AktSong.Video); - SkipSmpeg(AktSong.VideoGAP + AktSong.Start);} +(* OpenSmpeg(AktSong.Path + AktSong.Video); + SkipSmpeg(AktSong.VideoGAP + AktSong.Start);*) + // todo: VideoGap and Start time verwursten FFmpegOpenFile(pAnsiChar(AktSong.Path + AktSong.Video)); FFmpegSkip(AktSong.VideoGAP + AktSong.Start); diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 2d10c9dc..7b16c315 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -1078,7 +1078,8 @@ begin end; end; -{procedure TScreenSong.SetScroll4; // rotate +(* +procedure TScreenSong.SetScroll4; // rotate var B: integer; Wsp: real; @@ -1158,7 +1159,7 @@ begin else Button[B].Visible := False; end; end; -end; } +end; *) procedure TScreenSong.SetScroll5; // rotate var @@ -2003,4 +2004,4 @@ FixSelected; } end; -end. \ No newline at end of file +end. diff --git a/Game/Code/Screens/UScreenTop5.pas b/Game/Code/Screens/UScreenTop5.pas index f9de4114..4971d12a 100644 --- a/Game/Code/Screens/UScreenTop5.pas +++ b/Game/Code/Screens/UScreenTop5.pas @@ -2,6 +2,11 @@ unit UScreenTop5; interface +{$IFDEF FPC} + {$MODE DELPHI} +{$ENDIF} + + uses UMenu, SDL, SysUtils, UDisplay, UMusic, USongs, UThemes, ULCD; @@ -131,7 +136,7 @@ function TScreenTop5.Draw: boolean; C: integer;} begin // Singstar - let it be...... with 6 statics -{ if PlayersPlay = 6 then begin +(* if PlayersPlay = 6 then begin for Item := 4 to 6 do begin if ScreenAct = 1 then P := Item-4; if ScreenAct = 2 then P := Item-1; @@ -152,10 +157,10 @@ begin Static[StaticBoxLightest[Item]].Texture.ColG, Static[StaticBoxLightest[Item]].Texture.ColB, 'P4Dark'); - end;} + end; } -{ end; - end;} + end; + end; *) inherited Draw; end; -- cgit v1.2.3