From fac1634f48835f46249ec25d2758c81addd09d52 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Sun, 30 Sep 2007 05:56:29 +0000 Subject: some minor bug fixes.. added Installer script.. for NSIS install compiler. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@451 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UFiles.pas | 41 ------------- Game/Code/Classes/UMain.pas | 16 +++-- Game/Code/Screens/UScreenScore.pas | 119 ++++--------------------------------- Game/Code/switches.inc | 2 +- 4 files changed, 24 insertions(+), 154 deletions(-) (limited to 'Game') diff --git a/Game/Code/Classes/UFiles.pas b/Game/Code/Classes/UFiles.pas index 565c5ee3..9cd3bdc1 100644 --- a/Game/Code/Classes/UFiles.pas +++ b/Game/Code/Classes/UFiles.pas @@ -54,47 +54,6 @@ implementation uses TextGL, UIni, UMain; -{* -//-------------------- -// Function sets all Absolute Paths e.g. Song Path and makes sure the Directorys exist -//-------------------- -procedure InitializePaths; - - // Initialize a Path Variable - // After Setting Paths, make sure that Paths exist - function initialize_path( out aPathVar : String; const aLocation : String ): boolean; - var - lWriteable: Boolean; - begin - aPathVar := aLocation; - - If DirectoryExists(aPathVar) then - lWriteable := ForceDirectories(aPathVar) - else - lWriteable := false; - - if not Writeable then - Log.LogError('Error: Dir ('+ aLocation +') is Readonly'); - - result := lWriteable; - end; - -begin - GamePath := ExtractFilePath(ParamStr(0)); - - initialize_path( LogPath , GamePath ); - initialize_path( SoundPath , GamePath + 'Sounds\' ); - initialize_path( SongPath , GamePath + 'Songs\' ); - initialize_path( ThemePath , GamePath + 'Themes\' ); - initialize_path( ScreenshotsPath , GamePath + 'Screenshots\'); - initialize_path( CoversPath , GamePath + 'Covers\' ); - initialize_path( LanguagesPath , GamePath + 'Languages\' ); - initialize_path( PluginPath , GamePath + 'Plugins\' ); - initialize_path( PlaylistPath , GamePath + 'Playlists\' ); - - DecimalSeparator := ','; -end; -*} //-------------------- // Clears Song Header values diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index 9b6ea3d5..66e1d07e 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -748,14 +748,22 @@ procedure InitializePaths; function initialize_path( out aPathVar : String; const aLocation : String ): boolean; var lWriteable: Boolean; + lAttrib : integer; begin - aPathVar := aLocation; + lWriteable := false; + aPathVar := aLocation; + + // Make sure the directory is needex + ForceDirectories(aPathVar); If DirectoryExists(aPathVar) then - lWriteable := ForceDirectories(aPathVar) - else - lWriteable := false; + begin + lAttrib := fileGetAttr('C:Temp'); + lWriteable := ( lAttrib and faDirectory <> 0 ) AND + NOT ( lAttrib and faReadOnly <> 0 ) + end; + if not lWriteable then Log.LogError('Error: Dir ('+ aLocation +') is Readonly'); diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index 222879ba..0182bbd2 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -192,7 +192,8 @@ var MaxH: real; // maximum height of score bar Wsp: real; begin -{ CountSkipTimeSet; +{* + CountSkipTimeSet; Animation := 0; Fadeout := false; @@ -224,7 +225,8 @@ begin 9010..10000: Text[3].Text := ' Superstar'; end; - Music.PlayShuffle;} + Music.PlayShuffle; +*} // Singstar Fadeout := false; @@ -300,112 +302,7 @@ begin Static[StaticLevel[P]].Visible := false; //V[P]; Static[StaticLevelRound[P]].Visible := false; //V[P]; end; -{ - if PlayersPlay <= 3 then begin // only for 1 screen mode - for P := 0 to PlayersPlay-1 do begin - case PlayersPlay of - 1: PP := 1; - 2: PP := P + 2; - 3: PP := P + 4; - end; - //PP := 1; - - Text[TextName[PP]].Text := Ini.Name[P]; - - //{$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'); - 4010..6000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_RISING_STAR'); - 6010..8000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_LEAD_SINGER'); - 8010..9000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_HIT_ARTIST'); - 9010..9800: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_SUPERSTAR'); - 9810..10000: Text[TextScore[PP]].Text := Language.Translate('SING_SCORE_ULTRASTAR'); - end; - (* {$ELSE}{ - case (Player[P].ScoreTotalI) of - 0..2000: Text[TextScore[PP]].Text := 'Tone Deaf'; - 2010..4000: Text[TextScore[PP]].Text := 'Amateur'; - 4010..6000: Text[TextScore[PP]].Text := 'Rising Star'; - 6010..8000: Text[TextScore[PP]].Text := 'Lead Singer'; - 8010..9000: Text[TextScore[PP]].Text := 'Hit Artist'; - 9010..9800: Text[TextScore[PP]].Text := 'Superstar'; - 9810..10000: Text[TextScore[PP]].Text := 'Ultrastar'; - end; -{ {$ENDIF} -//*) - -{ S := IntToStr(Player[P].ScoreI); - while (Length(S)<4) do S := '0' + S; - Text[TextNotesScore[PP]].Text := S; - S := IntToStr(Player[P].ScoreLineI); - while (Length(S)<4) do S := '0' + S; - Text[TextLineBonusScore[PP]].Text := S; - - S := IntToStr(Player[P].ScoreGoldenI); - while (Length(S)<4) do S := '0' + S; - Text[TextGoldenNotesScore[PP]].Text := S; - - S := IntToStr(Player[P].ScoreTotalI); - while (Length(S)<5) do S := '0' + S; - Text[TextTotalScore[PP]].Text := S; - - // Level bar length -(* - 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 - -{ Lev := Player[P].ScoreTotalI / 10000; - MaxH := Static[StaticBackLevel[PP]].Texture.H + Static[StaticBackLevelRound[PP]].Texture.H / 2; - - // developer note (Polish): - // w sumie np. 120 pix - // ten static moze miec 100 pix - // wlacza sie od 20 pix i rosnie do 120 pix - // wiec wysokosc = wyznaczona ilosc - 20 - // nie moze byc mniejsze od 0 - // Lev * MaxH = total number of pixels to draw - Static[StaticLevel[PP]].Visible := true; - Static[StaticLevel[PP]].Texture.H := Lev * MaxH - Static[StaticBackLevelRound[PP]].Texture.H / 2; - if Static[StaticLevel[PP]].Texture.H < 0 then Static[StaticLevel[PP]].Visible := false; - - // Y doesn't change and depend on the back texture coordinate - Static[StaticLevel[PP]].Texture.Y := Static[StaticBackLevel[PP]].Texture.Y + Static[StaticBackLevel[PP]].Texture.H - Static[StaticLevel[PP]].Texture.H; - - // we modify LevelRound texture by changing it's Y. TexY1 and TexY2 change when the height to draw is lower than 20 - if Lev * MaxH < Static[StaticBackLevelRound[PP]].Texture.H / 2 then begin - // when it's lower than 20 => we move TexY1 and TexY2 higher to show only part of this texture - Static[StaticLevelRound[PP]].Texture.Y := Static[StaticBackLevel[PP]].Texture.Y + Static[StaticBackLevel[PP]].Texture.H - Static[StaticBackLevelRound[PP]].Texture.H; - // - 0.25 when points = 0 - // - 0 wnen there are more points - // if Lev * MaxH = Static[StaticBackLevelRound[PP]].Texture.H / 2) then we do not change it - // if Lev * MaxH = 0 then we substract 0.25 - // we substract (0.25 - 0.25 * (Lev * MaxH)/Static[StaticBackLevelRound[PP]].Texture.H / 2) - Wsp := Lev * MaxH / (Static[StaticBackLevelRound[PP]].Texture.H / 2); - Static[StaticLevelRound[PP]].Texture.TexY1 := Static[StaticBackLevelRound[PP]].Texture.TexY1 - 0.25 + 0.25 * Wsp; - Static[StaticLevelRound[PP]].Texture.TexY2 := Static[StaticBackLevelRound[PP]].Texture.TexY2 - 0.25 + 0.25 * Wsp; - end else begin - // when it's higher or equal 20 => full texture is being shown - Static[StaticLevelRound[PP]].Texture.TexY1 := Static[StaticBackLevelRound[PP]].Texture.TexY1; - Static[StaticLevelRound[PP]].Texture.TexY2 := Static[StaticBackLevelRound[PP]].Texture.TexY2; - Static[StaticLevelRound[PP]].Texture.Y := Static[StaticLevel[PP]].Texture.Y - Static[StaticBackLevelRound[PP]].Texture.H; - end; - - end; // for - end; // if - - LCD.HideCursor; - LCD.Clear; - LCD.WriteText(1, Ini.Name[0]); - LCD.WriteText(2, 'Score: ' + Text[TextTotalScore[1]].Text); -} end; procedure TScreenScore.onShowFinish; @@ -684,6 +581,7 @@ const RaiseSmoothness : integer = 100; var RaiseStep : Real; + lTmpA : Real; begin // EaseOut_Step is the actual step in the raising process, like the 20iest step of EaseOut_MaxSteps RaiseStep := EaseOut_Step; @@ -695,7 +593,12 @@ begin // quadratic easing out - decelerating to zero velocity // -end_position * current_time * ( current_time - 2 ) + start_postion - Result := floor((-ScoreReached * RaiseStep * (RaiseStep - 20)) / RaiseSmoothness); + lTmpA := (-ScoreReached * RaiseStep * (RaiseStep - 20)); + if ( lTmpA > 0 ) AND + ( RaiseSmoothness > 0 ) THEN + begin + Result := floor( lTmpA / RaiseSmoothness); + end; end else begin diff --git a/Game/Code/switches.inc b/Game/Code/switches.inc index 0bace1cb..a895712a 100644 --- a/Game/Code/switches.inc +++ b/Game/Code/switches.inc @@ -2,7 +2,7 @@ {$UNDEF UseSerialPort} {$UNDEF UseMIDIPort} {$ELSE} - {$DEFINE UseSerialPort} + {$UNDEF UseSerialPort} {$DEFINE UseMIDIPort} {$ENDIF} -- cgit v1.2.3