diff options
author | jaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2007-12-20 01:33:30 +0000 |
---|---|---|
committer | jaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2007-12-20 01:33:30 +0000 |
commit | cdfdd0ea3fa2eb92893db46c158cf61b7a9411d7 (patch) | |
tree | 87c2d16f4daca23d3f7ed5c7c39cfb1961809bb4 /Game/Code | |
parent | 0fc1609b13b256acef7fe9ab456225b68a806730 (diff) | |
download | usdx-cdfdd0ea3fa2eb92893db46c158cf61b7a9411d7.tar.gz usdx-cdfdd0ea3fa2eb92893db46c158cf61b7a9411d7.tar.xz usdx-cdfdd0ea3fa2eb92893db46c158cf61b7a9411d7.zip |
fixed divide by 0 bugs in score screen.
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@734 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r-- | Game/Code/Screens/UScreenScore.pas | 331 |
1 files changed, 170 insertions, 161 deletions
diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index 7273a06c..84fd4e15 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -267,15 +267,15 @@ var begin case PlayersPlay of - 1: begin
- ArrayStartModifier := 0;
- end;
- 2, 4: begin
- ArrayStartModifier := 1;
- end;
- 3, 6: begin
- ArrayStartModifier := 3;
- end;
+ 1: begin + ArrayStartModifier := 0; + end; + 2, 4: begin + ArrayStartModifier := 1; + end; + 3, 6: begin + ArrayStartModifier := 3; + end; end; for P := 1 to PlayersPlay do @@ -309,36 +309,36 @@ begin Text[TextArtistTitle].Text := AktSong.Artist + ' - ' + AktSong.Title; // set visibility - case PlayersPlay of
- 1: begin
- V[1] := true;
- V[2] := false;
- V[3] := false;
- V[4] := false;
- V[5] := false;
- V[6] := false;
- end;
- 2, 4: begin
- V[1] := false;
- V[2] := true;
- V[3] := true;
- V[4] := false;
- V[5] := false;
- V[6] := false;
- end;
- 3, 6: begin
- V[1] := false;
- V[2] := false;
- V[3] := false;
- V[4] := true;
- V[5] := true;
- V[6] := true;
- end;
+ case PlayersPlay of + 1: begin + V[1] := true; + V[2] := false; + V[3] := false; + V[4] := false; + V[5] := false; + V[6] := false; + end; + 2, 4: begin + V[1] := false; + V[2] := true; + V[3] := true; + V[4] := false; + V[5] := false; + V[6] := false; + end; + 3, 6: begin + V[1] := false; + V[2] := false; + V[3] := false; + V[4] := true; + V[5] := true; + V[6] := true; + end; end; for P := 1 to 6 do begin - Text[TextName[P]].Visible := V[P];
+ Text[TextName[P]].Visible := V[P]; Text[TextScore[P]].Visible := V[P]; // We set alpha to 0 , so we can nicely blend them in when we need them @@ -352,27 +352,27 @@ begin Text[TextTotal[P]].Alpha := 0; Text[TextTotalScore[P]].Alpha := 0; Static[StaticBoxLightest[P]].Texture.Alpha := 0; - Static[StaticBoxLight[P]].Texture.Alpha := 0;
+ Static[StaticBoxLight[P]].Texture.Alpha := 0; Static[StaticBoxDark[P]].Texture.Alpha := 0; Text[TextNotes[P]].Visible := V[P]; - Text[TextNotesScore[P]].Visible := V[P];
- Text[TextLineBonus[P]].Visible := V[P];
- Text[TextLineBonusScore[P]].Visible := V[P];
- Text[TextGoldenNotes[P]].Visible := V[P];
- Text[TextGoldenNotesScore[P]].Visible := V[P];
- Text[TextTotal[P]].Visible := V[P];
- Text[TextTotalScore[P]].Visible := V[P];
-
- for I := 0 to high(PlayerStatic[P]) do
- Static[PlayerStatic[P, I]].Visible := V[P];
-
- for I := 0 to high(PlayerTexts[P]) do
- Text[PlayerTexts[P, I]].Visible := V[P];
-
- Static[StaticBoxLightest[P]].Visible := V[P];
- Static[StaticBoxLight[P]].Visible := V[P];
+ Text[TextNotesScore[P]].Visible := V[P]; + Text[TextLineBonus[P]].Visible := V[P]; + Text[TextLineBonusScore[P]].Visible := V[P]; + Text[TextGoldenNotes[P]].Visible := V[P]; + Text[TextGoldenNotesScore[P]].Visible := V[P]; + Text[TextTotal[P]].Visible := V[P]; + Text[TextTotalScore[P]].Visible := V[P]; + + for I := 0 to high(PlayerStatic[P]) do + Static[PlayerStatic[P, I]].Visible := V[P]; + + for I := 0 to high(PlayerTexts[P]) do + Text[PlayerTexts[P, I]].Visible := V[P]; + + Static[StaticBoxLightest[P]].Visible := V[P]; + Static[StaticBoxLight[P]].Visible := V[P]; Static[StaticBoxDark[P]].Visible := V[P]; // we draw that on our own @@ -555,19 +555,19 @@ begin // -> Statics[4..6] case PlayersPlay of - 1: begin
- ArrayStartModifier := 0;
- end;
- 2, 4: begin
- ArrayStartModifier := 1;
- end;
- 3, 6: begin
- ArrayStartModifier := 3;
- end;
+ 1: begin + ArrayStartModifier := 0; + end; + 2, 4: begin + ArrayStartModifier := 1; + end; + 3, 6: begin + ArrayStartModifier := 3; + end; end; // todo: take the name from player[PlayerNumber].Name instead of the ini when this is done (mog) - Text[TextName[PlayerNumber + ArrayStartModifier]].Text := Ini.Name[PlayerNumber - 1];
+ Text[TextName[PlayerNumber + ArrayStartModifier]].Text := Ini.Name[PlayerNumber - 1]; // end todo @@ -618,70 +618,75 @@ var width : array[1..3] of real; begin case PlayersPlay of - 1: begin
- ArrayStartModifier := 0;
- end;
- 2, 4: begin
- ArrayStartModifier := 1;
- end;
- 3, 6: begin
- ArrayStartModifier := 3;
- end;
+ 1: begin + ArrayStartModifier := 0; + end; + 2, 4: begin + ArrayStartModifier := 1; + end; + 3, 6: begin + ArrayStartModifier := 3; + end; end; -
fu := PlayerNumber + ArrayStartModifier; -
-//todo: this could break if the width is not given, for instance when there's a skin with no picture for ratings
- Text[TextScore[PlayerNumber + ArrayStartModifier]].Alpha := aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue / aPlayerScoreScreenRatings[PlayerNumber].RatePic_Width;
-// end todo
- {{$IFDEF TRANSLATE}
- case (Player[PlayerNumber-1].ScoreTotalI) of
- 0..2000:
- begin
- Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_TONE_DEAF');
- Rating := 0;
- end;
- 2010..4000:
- begin
- Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_AMATEUR');
- Rating := 1;
- end;
- 4010..6000:
- begin
- Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_RISING_STAR');
- Rating := 2;
- end;
- 6010..8000:
- begin
- Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_LEAD_SINGER');
- Rating := 3;
- end;
- 8010..9000:
- begin
- Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_HIT_ARTIST');
- Rating := 4;
- end;
- 9010..9800:
- begin
- Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_SUPERSTAR');
- Rating := 5;
- end;
- 9810..10000:
- begin
- Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_ULTRASTAR');
- Rating := 6;
- end;
- end;
- {{$ELSE}{
- case (Player[P].ScoreTotalI-1) of
- 0..2000: Text[TextScore[fu]].Text := 'Tone Deaf';
- 2010..4000: Text[TextScore[fu]].Text := 'Amateur';
- 4010..6000: Text[TextScore[fu]].Text := 'Rising Star';
- 6010..8000: Text[TextScore[fu]].Text := 'Lead Singer';
- 8010..9000: Text[TextScore[fu]].Text := 'Hit Artist';
- 9010..9800: Text[TextScore[fu]].Text := 'Superstar';
- 9810..10000: Text[TextScore[fu]].Text := 'Ultrastar';
- end;
+ fu := PlayerNumber + ArrayStartModifier; + +//todo: this could break if the width is not given, for instance when there's a skin with no picture for ratings + if ( aPlayerScoreScreenRatings[PlayerNumber].RatePic_Width > 0 ) AND // JB :) + ( aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue > 0 ) then + begin + Text[TextScore[PlayerNumber + ArrayStartModifier]].Alpha := aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue / aPlayerScoreScreenRatings[PlayerNumber].RatePic_Width; + end; + +// end todo + {{$IFDEF TRANSLATE} + case (Player[PlayerNumber-1].ScoreTotalI) of + 0..2000: + begin + Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_TONE_DEAF'); + Rating := 0; + end; + 2010..4000: + begin + Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_AMATEUR'); + Rating := 1; + end; + 4010..6000: + begin + Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_RISING_STAR'); + Rating := 2; + end; + 6010..8000: + begin + Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_LEAD_SINGER'); + Rating := 3; + end; + 8010..9000: + begin + Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_HIT_ARTIST'); + Rating := 4; + end; + 9010..9800: + begin + Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_SUPERSTAR'); + Rating := 5; + end; + 9810..10000: + begin + Text[TextScore[fu]].Text := Language.Translate('SING_SCORE_ULTRASTAR'); + Rating := 6; + end; + end; + {{$ELSE}{ + case (Player[P].ScoreTotalI-1) of + 0..2000: Text[TextScore[fu]].Text := 'Tone Deaf'; + 2010..4000: Text[TextScore[fu]].Text := 'Amateur'; + 4010..6000: Text[TextScore[fu]].Text := 'Rising Star'; + 6010..8000: Text[TextScore[fu]].Text := 'Lead Singer'; + 8010..9000: Text[TextScore[fu]].Text := 'Hit Artist'; + 9010..9800: Text[TextScore[fu]].Text := 'Superstar'; + 9810..10000: Text[TextScore[fu]].Text := 'Ultrastar'; + end; {$ENDIF} // Bounce the rating picture in @@ -710,43 +715,47 @@ begin end; -function TscreenScore.elastique(PlayerNumber : Integer): real;
-var
- ReturnValue : real;
- p, s : real;
-
- RaiseStep, Actual_Value, MaxVal : real;
- EaseOut_Step : integer;
-begin
-
- EaseOut_Step := aPlayerScoreScreenRatings[PlayerNumber].RateEaseStep;
- Actual_Value := aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue;
- MaxVal := aPlayerScoreScreenRatings[PlayerNumber].RatePic_Width;
-
- RaiseStep := EaseOut_Step;
-
- if (RaiseStep = 0)
- then ReturnValue := MaxVal;
-
- RaiseStep := RaiseStep / MaxVal;
-
- if (RaiseStep = 1)
- then
- begin
- ReturnValue := MaxVal;
- end
- else
- begin
- p := MaxVal * 0.4;
-
- s := p/(2*PI) * arcsin (1);
- ReturnValue := MaxVal * power(2,-5 * RaiseStep) * sin( (RaiseStep * MaxVal - s) * (2 * PI) / p) + MaxVal;
-
- inc(aPlayerScoreScreenRatings[PlayerNumber].RateEaseStep);
- aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue := ReturnValue;
- end;
- Result := ReturnValue;
-end;
+function TscreenScore.elastique(PlayerNumber : Integer): real; +var + ReturnValue : real; + p, s : real; + + RaiseStep, Actual_Value, MaxVal : real; + EaseOut_Step : integer; +begin + + EaseOut_Step := aPlayerScoreScreenRatings[PlayerNumber].RateEaseStep; + Actual_Value := aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue; + MaxVal := aPlayerScoreScreenRatings[PlayerNumber].RatePic_Width; + + RaiseStep := EaseOut_Step; + + if (RaiseStep = 0) + then ReturnValue := MaxVal; + + if ( MaxVal > 0 ) AND // JB :) + ( RaiseStep > 0 ) then + begin + RaiseStep := RaiseStep / MaxVal; + end; + + if (RaiseStep = 1) + then + begin + ReturnValue := MaxVal; + end + else + begin + p := MaxVal * 0.4; + + s := p/(2*PI) * arcsin (1); + ReturnValue := MaxVal * power(2,-5 * RaiseStep) * sin( (RaiseStep * MaxVal - s) * (2 * PI) / p) + MaxVal; + + inc(aPlayerScoreScreenRatings[PlayerNumber].RateEaseStep); + aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue := ReturnValue; + end; + Result := ReturnValue; +end; function TscreenScore.EaseBarIn(PlayerNumber : Integer; BarType: String) : real; |