aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Screens
diff options
context:
space:
mode:
authormogguh <mogguh@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-12-20 00:21:32 +0000
committermogguh <mogguh@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-12-20 00:21:32 +0000
commit0d5fbd096cddf37bfc3a5f642644179c81bde582 (patch)
treeb1cb125f77f574a03c77b37b33b60ad0fdc9fdf7 /Game/Code/Screens
parent8239e84d1378a111c0336fa8e942fc6805dc847c (diff)
downloadusdx-0d5fbd096cddf37bfc3a5f642644179c81bde582.tar.gz
usdx-0d5fbd096cddf37bfc3a5f642644179c81bde582.tar.xz
usdx-0d5fbd096cddf37bfc3a5f642644179c81bde582.zip
Minor refinings in score screen
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@732 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game/Code/Screens')
-rw-r--r--Game/Code/Screens/UScreenScore.pas701
1 files changed, 534 insertions, 167 deletions
diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas
index 0ed04b89..35296233 100644
--- a/Game/Code/Screens/UScreenScore.pas
+++ b/Game/Code/Screens/UScreenScore.pas
@@ -19,20 +19,69 @@ uses
OpenGL12,
{$ifdef win32}
Windows,
+ dialogs,
{$endif}
math,
- ULCD;
-
+ ULCD,
+ UTexture;
// OpenGL;
+const
+ ZBars : real = 0.8; // Z value for the bars
+ ZRatingPic : real = 0.8; // Z value for the rating pictures
+
+ EaseOut_MaxSteps : real = 40; // that's the speed of the bars (10 is fast | 100 is slower)
+
type
+ TPlayerScoreScreenTexture = record // holds all colorized textures for up to 6 players
+ //Bar textures
+ Score_NoteBarLevel_Dark : TTexture; // Note
+ Score_NoteBarRound_Dark : TTexture; // that's the round thing on top
+
+ Score_NoteBarLevel_Light : TTexture; // LineBonus | Phrasebonus
+ Score_NoteBarRound_Light : TTexture;
+
+ Score_NoteBarLevel_Lightest : TTexture; // GoldenNotes
+ Score_NoteBarRound_Lightest : TTexture;
+ end;
+
+ TPlayerScoreScreenData = record // holds the positions and other data
+ Bar_X :Real;
+ Bar_Y :Real;
+ Bar_Height :Real; // this is the max height of the bar, who knows if there ever will be a theme with different heights :D
+ Bar_Width :Real; // another rather senseless setting, but you never know what our cool users do with the them :)
+
+ Bar_Actual_Height : Real; // this one holds the actual height of the bar, while we animate it
+ BarScore_ActualHeight : Real;
+ BarLine_ActualHeight : Real;
+ BarGolden_ActualHeight : Real;
+ end;
+
+ TPlayerScoreRatingPics = record // a fine array of the rating pictures
+ RatePic_X :Real;
+ RatePic_Y :Real;
+ RatePic_Height :Real;
+ RatePic_Width :Real;
+
+ RateEaseStep : Integer;
+ RateEaseValue: Real;
+ end;
+
TScreenScore = class(TMenu)
public
+ aPlayerScoreScreenTextures : array[1..6] of TPlayerScoreScreenTexture;
+ aPlayerScoreScreenDatas : array[1..6] of TPlayerScoreScreenData;
+ aPlayerScoreScreenRatings : array[1..6] of TPlayerScoreRatingPics;
+
+ BarScore_EaseOut_Step : real;
+ BarPhrase_EaseOut_Step : real;
+ BarGolden_EaseOut_Step : real;
+
TextArtist: integer;
TextTitle: integer;
TextArtistTitle : integer;
-
+
TextName: array[1..6] of integer;
TextScore: array[1..6] of integer;
@@ -61,19 +110,11 @@ type
Animation: real;
Fadeout: boolean;
- BarScore_ActualHeight : array[0..5] of real;
- BarPhrase_ActualHeight : array[0..5] of real;
- BarGolden_ActualHeight : array[0..5] of real;
-
- BarScore_EaseOut_Step : real;
- BarPhrase_EaseOut_Step : real;
- BarGolden_EaseOut_Step : real;
+ TextScore_ActualValue : array[1..6] of integer;
+ TextPhrase_ActualValue : array[1..6] of integer;
+ TextGolden_ActualValue : array[1..6] of integer;
- TextScore_ActualValue : array[0..5] of integer;
- TextPhrase_ActualValue : array[0..5] of integer;
- TextGolden_ActualValue : array[0..5] of integer;
- EaseOut_MaxSteps : real;
constructor Create; override;
function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override;
@@ -82,8 +123,13 @@ type
function Draw: boolean; override;
procedure FillPlayer(Item, P: integer);
- function RaiseBar(PlayerNumber: integer; BarStartPosY: Single; ActualHeight: real; Score: integer; ColorBrightness : String; EaseOut_Step: Real) : real;
- function IncrementScore(PlayerNumber: integer; ActualScoreValue: Integer; ScoreReached: integer; EaseOut_Step: Real) : integer;
+ function EaseBarIn(PlayerNumber : Integer; BarType: String) : real;
+ function EaseScoreIn(PlayerNumber : Integer; ScoreType: String) : real;
+
+ procedure FillPlayerItems(PlayerNumber : Integer; ScoreType: String);
+ procedure ShowRating(PlayerNumber: integer);
+
+ function elastique(PlayerNumber : Integer): real;
end;
implementation
@@ -142,20 +188,37 @@ end;
constructor TScreenScore.Create;
var
- P: integer;
- I, C: integer;
+ P : integer;
+ I, C : integer;
+ ArrayStartModifier : Byte;
+
begin
inherited Create;
LoadFromTheme(Theme.Score);
- TextArtist := AddText(Theme.Score.TextArtist);
- TextTitle := AddText(Theme.Score.TextTitle);
-
+ TextArtist := AddText(Theme.Score.TextArtist);
+ TextTitle := AddText(Theme.Score.TextTitle);
TextArtistTitle := AddText(Theme.Score.TextArtistTitle);
for P := 1 to 6 do
begin
+ //textures
+ aPlayerScoreScreenTextures[P].Score_NoteBarLevel_Dark := Tex_Score_NoteBarLevel_Dark[P];
+ aPlayerScoreScreenTextures[P].Score_NoteBarRound_Dark := Tex_Score_NoteBarRound_Dark[P];
+
+ aPlayerScoreScreenTextures[P].Score_NoteBarLevel_Light := Tex_Score_NoteBarLevel_Light[P];
+ aPlayerScoreScreenTextures[P].Score_NoteBarRound_Light := Tex_Score_NoteBarRound_Light[P];
+
+ aPlayerScoreScreenTextures[P].Score_NoteBarLevel_Lightest := Tex_Score_NoteBarLevel_Lightest[P];
+ aPlayerScoreScreenTextures[P].Score_NoteBarRound_Lightest := Tex_Score_NoteBarRound_Lightest[P];
+ end;
+
+
+//old stuff
+
+ for P := 1 to 6 do
+ begin
SetLength(PlayerStatic[P], Length(Theme.Score.PlayerStatic[P]));
SetLength(PlayerTexts[P], Length(Theme.Score.PlayerTexts[P]));
@@ -186,6 +249,7 @@ begin
StaticLevel[P] := AddStatic(Theme.Score.StaticLevel[P]);
StaticLevelRound[P] := AddStatic(Theme.Score.StaticLevelRound[P]);
end;
+
end;
procedure TScreenScore.onShow;
@@ -199,8 +263,44 @@ var
V: array[1..6] of boolean; // visibility array
MaxH: real; // maximum height of score bar
Wsp: real;
+ ArrayStartModifier :integer;
begin
+ case PlayersPlay of
+ 1: begin
+ ArrayStartModifier := 0;
+ end;
+ 2, 4: begin
+ ArrayStartModifier := 1;
+ end;
+ 3, 6: begin
+ ArrayStartModifier := 3;
+ end;
+ end;
+
+ for P := 1 to PlayersPlay do
+ begin
+ // data
+ aPlayerScoreScreenDatas[P].Bar_X := Theme.Score.StaticBackLevel[P + ArrayStartModifier].X;
+ aPlayerScoreScreenDatas[P].Bar_Y := Theme.Score.StaticBackLevel[P + ArrayStartModifier].Y;
+ aPlayerScoreScreenDatas[P].Bar_Height := Theme.Score.StaticBackLevel[P + ArrayStartModifier].H;
+ aPlayerScoreScreenDatas[P].Bar_Width := Theme.Score.StaticBackLevel[P + ArrayStartModifier].W;
+
+ aPlayerScoreScreenDatas[P].Bar_Actual_Height := 0;
+ aPlayerScoreScreenDatas[P].BarScore_ActualHeight := 0;
+ aPlayerScoreScreenDatas[P].BarLine_ActualHeight := 0;
+ aPlayerScoreScreenDatas[P].BarGolden_ActualHeight := 0;
+
+ // ratings
+ aPlayerScoreScreenRatings[P].RatePic_X := Theme.Score.StaticRatings[P + ArrayStartModifier].X;
+ aPlayerScoreScreenRatings[P].RatePic_Y := Theme.Score.StaticRatings[P + ArrayStartModifier].Y;
+ aPlayerScoreScreenRatings[P].RatePic_Height := Theme.Score.StaticRatings[P + ArrayStartModifier].H;
+ aPlayerScoreScreenRatings[P].RatePic_Width := Theme.Score.StaticRatings[P + ArrayStartModifier].W;
+ aPlayerScoreScreenRatings[P].RateEaseStep := 1;
+ aPlayerScoreScreenRatings[P].RateEaseValue := 20;
+ end;
+
+
// Singstar
Fadeout := false;
@@ -242,15 +342,18 @@ begin
Text[TextScore[P]].Visible := V[P];
// We set alpha to 0 , so we can nicely blend them in when we need them
- Text[TextScore[P]].Alpha := 0;
- Text[TextNotesScore[P]].Alpha := 0;
- Text[TextNotes[P]].Alpha := 0;
- Text[TextLineBonus[P]].Alpha := 0;
- Text[TextLineBonusScore[P]].Alpha := 0;
- Text[TextGoldenNotes[P]].Alpha := 0;
- Text[TextGoldenNotesScore[P]].Alpha := 0;
- Text[TextTotal[P]].Alpha := 0;
- Text[TextTotalScore[P]].Alpha := 0;
+ Text[TextScore[P]].Alpha := 0;
+ Text[TextNotesScore[P]].Alpha := 0;
+ Text[TextNotes[P]].Alpha := 0;
+ Text[TextLineBonus[P]].Alpha := 0;
+ Text[TextLineBonusScore[P]].Alpha := 0;
+ Text[TextGoldenNotes[P]].Alpha := 0;
+ Text[TextGoldenNotesScore[P]].Alpha := 0;
+ Text[TextTotal[P]].Alpha := 0;
+ Text[TextTotalScore[P]].Alpha := 0;
+ Static[StaticBoxLightest[P]].Texture.Alpha := 0;
+ Static[StaticBoxLight[P]].Texture.Alpha := 0;
+ Static[StaticBoxDark[P]].Texture.Alpha := 0;
Text[TextNotes[P]].Visible := V[P];
@@ -272,7 +375,7 @@ begin
Static[StaticBoxLight[P]].Visible := V[P];
Static[StaticBoxDark[P]].Visible := V[P];
-//
+// we draw that on our own
Static[StaticBackLevel[P]].Visible := false;
Static[StaticBackLevelRound[P]].Visible := false;
Static[StaticLevel[P]].Visible := false;
@@ -284,11 +387,8 @@ procedure TScreenScore.onShowFinish;
var
index : integer;
begin
-for index := 0 to (PlayersPlay-1) do
+for index := 1 to (PlayersPlay) do
begin
- BarScore_ActualHeight[index] := 0;
- BarPhrase_ActualHeight[index] := 0;
- BarGolden_ActualHeight[index] := 0;
TextScore_ActualValue[index] := 0;
TextPhrase_ActualValue[index] := 0;
@@ -298,8 +398,6 @@ for index := 0 to (PlayersPlay-1) do
BarScore_EaseOut_Step := 1;
BarPhrase_EaseOut_Step := 1;
BarGolden_EaseOut_Step := 1;
-
- EaseOut_MaxSteps := 100;
end;
function TScreenScore.Draw: boolean;
@@ -314,11 +412,14 @@ var
Item: integer;
P: integer;
- C: integer;
+ C, I: integer;
+
+ CurTime: Cardinal;
+
+ PlayerCounter : integer;
- katze : integer;
- ArrayStartModifier : integer;
begin
+{
// 0.5.0: try also use 4 players screen with nicks
if PlayersPlay = 4 then begin
@@ -339,7 +440,7 @@ begin
FillPlayer(Item, P);
-{ if ScreenAct = 1 then begin
+ if ScreenAct = 1 then begin
LoadColor(
Static[StaticBoxLightest[Item]].Texture.ColR,
Static[StaticBoxLightest[Item]].Texture.ColG,
@@ -353,57 +454,39 @@ begin
Static[StaticBoxLightest[Item]].Texture.ColG,
Static[StaticBoxLightest[Item]].Texture.ColB,
'P4Dark');
- end;}
+ end;
end;
+
+
end;
+}
+inherited Draw;
- inherited Draw;
+ player[0].ScoreI := 7000;
+ player[0].ScoreLineI := 2000;
+ player[0].ScoreGoldenI := 1000;
+ player[0].ScoreTotalI := 10000;
- //player[1].ScoreI := 7000;
- //player[1].ScoreLineI := 2000;
- //player[1].ScoreGoldenI := 1000;
+ player[1].ScoreI := 2500;
+ player[1].ScoreLineI := 1100;
+ player[1].ScoreGoldenI := 900;
+ player[1].ScoreTotalI := 4500;
- //player[2].ScoreI := 2500;
- //player[2].ScoreLineI := 1100;
- //player[2].ScoreGoldenI := 900;
// Let's arise the bars
+
ActualTime := GetTickCount div 33;
if ((ActualTime <> OldTime) and ShowFinish )then
begin
OldTime := ActualTime;
-// okay i hate that as much as you might do too, but there's no way around that yet (imho)
-// all statics / texts are loaded at start - so that we have them all even if we change the amount of players
-// array overview:
-
-// 1 Player -> Player[0].Score (The score for one player starts at 0)
-// -> Statics[1] (The statics for the one player screen start at 0)
-// 2 Player -> Player[0..1].Score
-// -> Statics[2..3]
-// 3 Player -> Player[0..5].Score
-// -> Statics[4..6]
-
- case PlayersPlay of
- 1: begin
- ArrayStartModifier := 1;
- end;
- 2, 4: begin
- ArrayStartModifier := 2;
- end;
- 3, 6: begin
- ArrayStartModifier := 4;
- end;
- end;
-
- For katze:= 0 to (PlayersPlay-1) do
+ For PlayerCounter := 1 to PlayersPlay do
begin
// We actually araise them in the right order, but we have to draw them in reverse order (golden -> phrase -> mainscore)
- Case BarScore_EaseOut_Step < EaseOut_MaxSteps * 10 of
- true : BarScore_EaseOut_Step := BarScore_EaseOut_Step + 1;
- end;
+ if (BarScore_EaseOut_Step < EaseOut_MaxSteps * 10)
+ then BarScore_EaseOut_Step := BarScore_EaseOut_Step + 1;
// PhrasenBonus
if (BarScore_EaseOut_Step >= (EaseOut_MaxSteps * 10)) then
@@ -423,79 +506,250 @@ begin
// Draw golden score bar #
//########################
- BarGolden_ActualHeight[katze] := RaiseBar(katze + ArrayStartModifier,
- Static[StaticBackLevel[katze + ArrayStartModifier]].Texture.y - BarScore_ActualHeight[katze] - BarPhrase_ActualHeight[katze],
- BarGolden_ActualHeight[katze],
- player[katze].ScoreGoldenI,
- 'Lightest',
- BarGolden_EaseOut_Step);
-
- // Increment and show total score and plain score
- TextGolden_ActualValue[katze] := IncrementScore(katze,
- TextGolden_ActualValue[katze],
- Player[katze].ScoreGoldenI,
- BarGolden_EaseOut_Step);
- Text[TextGoldenNotesScore[katze + ArrayStartModifier]].Text := IntToStr(TextGolden_ActualValue[katze]);
-
- // Blend in
- Text[TextGoldenNotesScore[katze + ArrayStartModifier]].Alpha := (BarGolden_EaseOut_Step / 100);
- Text[TextGoldenNotes[katze + ArrayStartModifier]].Alpha := (BarGolden_EaseOut_Step / 100);
+ EaseBarIn(PlayerCounter, 'Golden'); // ease bar for golden notes in
+ EaseScoreIn(PlayerCounter,'Golden');
end;
//########################
// Draw phrase score bar #
//########################
- BarPhrase_ActualHeight[katze] := RaiseBar(katze + ArrayStartModifier,
- Static[StaticBackLevel[katze + ArrayStartModifier]].Texture.y - BarScore_ActualHeight[katze],
- BarPhrase_ActualHeight[katze],
- Player[katze].ScoreLineI,
- 'Light',
- BarPhrase_EaseOut_Step);
-
- // Increment and show total score and plain score
- TextPhrase_ActualValue[katze] := IncrementScore(katze,
- TextPhrase_ActualValue[katze],
- Player[katze].ScoreLineI,
- BarPhrase_EaseOut_Step);
- Text[TextLineBonusScore[katze + ArrayStartModifier]].Text := IntToStr(TextPhrase_ActualValue[katze]);
- //Blend in
- Text[TextLineBonusScore[katze + ArrayStartModifier]].Alpha := (BarPhrase_EaseOut_Step / 100);
- Text[TextLineBonus[katze + ArrayStartModifier]].Alpha := (BarPhrase_EaseOut_Step / 100);
+ EaseBarIn(PlayerCounter, 'Line'); // ease bar for line bonus / phrasenbonus notes in
+ EaseScoreIn(PlayerCounter,'Line');
end;
//#######################
// Draw plain score bar #
//#######################
- BarScore_ActualHeight[katze] := RaiseBar(katze + ArrayStartModifier,
- Static[StaticBackLevel[katze + ArrayStartModifier]].Texture.y,
- BarScore_ActualHeight[katze],
- Player[katze].ScoreI,
- 'Dark',
- BarScore_EaseOut_Step);
- // Increment and show total score and plain score
- TextScore_ActualValue[katze] := IncrementScore(katze,
- TextScore_ActualValue[katze],
- Player[katze].ScoreI,
- BarScore_EaseOut_Step);
- Text[TextNotesScore[katze + ArrayStartModifier]].Text := IntToStr(TextScore_ActualValue[katze]);
-
- Text[TextTotalScore[katze + ArrayStartModifier]].Text := IntToStr(TextScore_ActualValue[katze] + TextPhrase_ActualValue[katze] + TextGolden_ActualValue[katze]);
-
- //Blend em in
- Text[TextTotalScore[katze + ArrayStartModifier]].Alpha := (BarScore_EaseOut_Step / 100);
- Text[TextTotal[katze + ArrayStartModifier]].Alpha := (BarScore_EaseOut_Step / 100);
- Text[TextNotesScore[katze + ArrayStartModifier]].Alpha := (BarScore_EaseOut_Step / 100);
- Text[TextNotes[katze + ArrayStartModifier]].Alpha := (BarScore_EaseOut_Step / 100);
- Text[TextScore[katze + ArrayStartModifier]].Alpha := (BarScore_EaseOut_Step / 100);
-
- end; // me loop
+
+
+ EaseBarIn(PlayerCounter, 'Note'); // ease bar for all other notes in
+ EaseScoreIn(PlayerCounter,'Note');
+
+
+ FillPlayerItems(PlayerCounter,'Funky');
+
+ end;
+ end;
+//todo: i need a clever method to draw statics with their z value
+ for I := 0 to Length(Static) - 1 do
+ Static[I].Draw;
+ for I := 0 to Length(Text) - 1 do
+ Text[I].Draw;
+end;
+
+procedure TscreenScore.FillPlayerItems(PlayerNumber : Integer; ScoreType: String);
+var
+ ArrayStartModifier : integer;
+begin
+// okay i hate that as much as you might do too, but there's no way around that yet (imho)
+// all statics / texts are loaded at start - so that we have them all even if we change the amount of players
+// array overview:
+
+// 1 Player -> Player[0].Score (The score for one player starts at 0)
+// -> Statics[1] (The statics for the one player screen start at 0)
+// 2 Player -> Player[0..1].Score
+// -> Statics[2..3]
+// 3 Player -> Player[0..5].Score
+// -> Statics[4..6]
+
+ case PlayersPlay of
+ 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];
+// end todo
+
+
+//golden
+ Text[TextGoldenNotesScore[PlayerNumber + ArrayStartModifier]].Text := IntToStr(TextGolden_ActualValue[PlayerNumber]);
+ Text[TextGoldenNotesScore[PlayerNumber + ArrayStartModifier]].Alpha := (BarGolden_EaseOut_Step / 100);
+
+ Static[StaticBoxLightest[PlayerNumber + ArrayStartModifier]].Texture.Alpha := (BarGolden_EaseOut_Step / 100);
+ Text[TextGoldenNotes[PlayerNumber + ArrayStartModifier]].Alpha := (BarGolden_EaseOut_Step / 100);
+
+ // line bonus
+ Text[TextLineBonusScore[PlayerNumber + ArrayStartModifier]].Text := IntToStr(TextPhrase_ActualValue[PlayerNumber]);
+ Text[TextLineBonusScore[PlayerNumber + ArrayStartModifier]].Alpha := (BarPhrase_EaseOut_Step / 100);
+
+ Static[StaticBoxLight[PlayerNumber + ArrayStartModifier]].Texture.Alpha := (BarPhrase_EaseOut_Step / 100);
+ Text[TextLineBonus[PlayerNumber + ArrayStartModifier]].Alpha := (BarPhrase_EaseOut_Step / 100);
+
+// plain score
+ Text[TextNotesScore[PlayerNumber + ArrayStartModifier]].Text := IntToStr(TextScore_ActualValue[PlayerNumber]);
+ Text[TextNotes[PlayerNumber + ArrayStartModifier]].Alpha := (BarScore_EaseOut_Step / 100);
+
+ Static[StaticBoxDark[PlayerNumber + ArrayStartModifier]].Texture.Alpha := (BarScore_EaseOut_Step / 100);
+ Text[TextNotesScore[PlayerNumber + ArrayStartModifier]].Alpha := (BarScore_EaseOut_Step / 100);
+
+// total score
+ Text[TextTotalScore[PlayerNumber + ArrayStartModifier]].Text := IntToStr(TextScore_ActualValue[PlayerNumber] + TextPhrase_ActualValue[PlayerNumber] + TextGolden_ActualValue[PlayerNumber]);
+ Text[TextTotalScore[PlayerNumber + ArrayStartModifier]].Alpha := (BarScore_EaseOut_Step / 100);
+
+ Text[TextTotal[PlayerNumber + ArrayStartModifier]].Alpha := (BarScore_EaseOut_Step / 100);
+
+ Text[TextTotal[PlayerNumber + ArrayStartModifier]].Alpha := (BarScore_EaseOut_Step / 100);
+
+ if(BarGolden_EaseOut_Step > 100) then
+ begin
+ ShowRating(PlayerNumber);
end;
+ end;
+
+
+procedure TScreenScore.ShowRating(PlayerNumber: integer);
+var
+ ArrayStartModifier : integer;
+ Rating : integer;
+ fu : integer;
+
+ Posx : real;
+ Posy : real;
+ 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;
+ 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;
+ {$ENDIF}
+
+// Bounce the rating picture in
+ PosX := aPlayerScoreScreenRatings[PlayerNumber].RatePic_X + (aPlayerScoreScreenRatings[PlayerNumber].RatePic_Width / 2);
+ PosY := aPlayerScoreScreenRatings[PlayerNumber].RatePic_Y + (aPlayerScoreScreenRatings[PlayerNumber].RatePic_Height / 2); ;
+
+ elastique(PlayerNumber);
+
+ width[PlayerNumber] := aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue/2;
+
+ glBindTexture(GL_TEXTURE_2D, Tex_Score_Ratings[Rating].TexNum);
+
+ glEnable(GL_TEXTURE_2D);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_BLEND);
+
+ glBegin(GL_QUADS);
+ glTexCoord2f(0, 0); glVertex2f(PosX - width[PlayerNumber], PosY - width[PlayerNumber]);
+ glTexCoord2f(Tex_Score_Ratings[Rating].TexW, 0); glVertex2f(PosX + width[PlayerNumber], PosY - width[PlayerNumber]);
+ glTexCoord2f(Tex_Score_Ratings[Rating].TexW, Tex_Score_Ratings[Rating].TexH); glVertex2f(PosX + width[PlayerNumber], PosY + width[PlayerNumber]);
+ glTexCoord2f(0, Tex_Score_Ratings[Rating].TexH); glVertex2f(PosX - width[PlayerNumber], PosY + width[PlayerNumber]);
+ glEnd;
+
+ glDisable(GL_BLEND);
+ glDisable(GL_TEXTURE_2d);
end;
-function TscreenScore.RaiseBar(PlayerNumber: integer; BarStartPosY: Single; ActualHeight: real; Score: integer; ColorBrightness : String; EaseOut_Step: Real) : real;
+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.EaseBarIn(PlayerNumber : Integer; BarType: String) : real;
const
RaiseSmoothness : integer = 100;
var
@@ -508,25 +762,52 @@ var
RaiseStep : real;
BarStartPosX : Single;
+ BarStartPosY : Single;
- R,G,B : real;
lTmp : real;
+ Score : integer;
+
+ //textures
+ TextureBar : integer;
+ TextureRound : integer;
begin
- MaxHeight := Static[StaticBackLevel[PlayerNumber]].Texture.H;
- Width := Static[StaticBackLevel[PlayerNumber]].Texture.W;
+ MaxHeight := aPlayerScoreScreenDatas[PlayerNumber].Bar_Height;
+ Width := aPlayerScoreScreenDatas[PlayerNumber].Bar_Width;
- BarStartPosX := Static[StaticBackLevel[PlayerNumber]].Texture.X;
+ BarStartPosX := aPlayerScoreScreenDatas[PlayerNumber].Bar_X;
- BarStartPosY := BarStartPosY + MaxHeight; // The texture starts in the upper left corner, so let's subtract the height - so we can arise it
+ // The texture starts in the upper left corner, so let's subtract the height - so we can arise it
+
+ // let's get the points according to the bar we draw
+ // score array starts at 0, which means the score for player 1 is in score[0]
+ // EaseOut_Step is the actual step in the raising process, like the 20iest step of EaseOut_MaxSteps
+ if (BarType = 'Note')
+ then
+ begin
+ Score := Player[PlayerNumber - 1].ScoreI;
+ RaiseStep := BarScore_EaseOut_Step;
+ BarStartPosY := aPlayerScoreScreenDatas[PlayerNumber].Bar_Y + MaxHeight;
+ end;
+ if (BarType = 'Line')
+ then
+ begin
+ Score := Player[PlayerNumber - 1].ScoreLineI;
+ RaiseStep := BarPhrase_EaseOut_Step;
+ BarStartPosY := aPlayerScoreScreenDatas[PlayerNumber].Bar_Y - aPlayerScoreScreenDatas[PlayerNumber].BarScore_ActualHeight + MaxHeight;
+ end;
+ if (BarType = 'Golden')
+ then
+ begin
+ Score := Player[PlayerNumber - 1].ScoreGoldenI;
+ RaiseStep := BarGolden_EaseOut_Step;
+ BarStartPosY := aPlayerScoreScreenDatas[PlayerNumber].Bar_Y - aPlayerScoreScreenDatas[PlayerNumber].BarScore_ActualHeight - aPlayerScoreScreenDatas[PlayerNumber].BarLine_ActualHeight + MaxHeight;
+ end;
// the height dependend of the score
Height2Reach := (Score / 10000) * MaxHeight;
- // EaseOut_Step is the actual step in the raising process, like the 20iest step of EaseOut_MaxSteps
- RaiseStep := EaseOut_Step;
-
- if (ActualHeight < Height2Reach) then
+ if (aPlayerScoreScreenDatas[PlayerNumber].Bar_Actual_Height < Height2Reach) then
begin
// Check http://proto.layer51.com/d.aspx?f=400 for more info on easing functions
// Calculate the actual step according to the maxsteps
@@ -535,58 +816,117 @@ begin
// quadratic easing out - decelerating to zero velocity
// -end_position * current_time * ( current_time - 2 ) + start_postion
lTmp := (-Height2Reach * RaiseStep * (RaiseStep - 20) + BarStartPosY);
- if ( RaiseSmoothness > 0 ) AND
- ( lTmp > 0 ) then
- begin
- NewHeight := lTmp / RaiseSmoothness;
- end;
+
+ if ( RaiseSmoothness > 0 ) AND ( lTmp > 0 )
+ then
+ begin
+ NewHeight := lTmp / RaiseSmoothness;
+ end;
end
else
begin
NewHeight := Height2Reach;
end;
- //+1
- LoadColor(R, G, B, 'P' + inttostr(PlayerNumber) + ColorBrightness); //dark, light, lightest
- glColor4f(R, G, B, 1);
- //the actual bar
- glBindTexture(GL_TEXTURE_2D, Static[StaticLevel[PlayerNumber]].Texture.TexNum);
+ glColor4f(1, 1, 1, 1);
+
+// set the texture for the bar
+ if (BarType = 'Note')
+ then
+ begin
+ glBindTexture(GL_TEXTURE_2D, aPlayerScoreScreenTextures[PlayerNumber].Score_NoteBarLevel_Dark.TexNum);
+ end;
+ if (BarType = 'Line')
+ then
+ begin
+ glBindTexture(GL_TEXTURE_2D, aPlayerScoreScreenTextures[PlayerNumber].Score_NoteBarLevel_Light.TexNum);
+ end;
+ if (BarType = 'Golden')
+ then
+ begin
+ glBindTexture(GL_TEXTURE_2D, aPlayerScoreScreenTextures[PlayerNumber].Score_NoteBarLevel_Lightest.TexNum);
+ end;
+ //draw it
glEnable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glBegin(GL_QUADS);
- glTexCoord2f(0, 0); glVertex2f(BarStartPosX, BarStartPosY - NewHeight);
- glTexCoord2f(1, 0); glVertex2f(BarStartPosX + Width, BarStartPosY - NewHeight);
- glTexCoord2f(1, 1); glVertex2f(BarStartPosX + Width, BarStartPosY);
- glTexCoord2f(0, 1); glVertex2f(BarStartPosX, BarStartPosY);
+ glTexCoord2f(0, 0); glVertex3f(BarStartPosX, BarStartPosY - NewHeight, ZBars);
+ glTexCoord2f(1, 0); glVertex3f(BarStartPosX + Width, BarStartPosY - NewHeight, ZBars);
+ glTexCoord2f(1, 1); glVertex3f(BarStartPosX + Width, BarStartPosY, ZBars);
+ glTexCoord2f(0, 1); glVertex3f(BarStartPosX, BarStartPosY, ZBars);
glEnd;
- //the round thing on top
- glBindTexture(GL_TEXTURE_2D, Static[StaticLevelRound[PlayerNumber]].Texture.TexNum);
+ glDisable(GL_BLEND);
+ glDisable(GL_TEXTURE_2d);
+
+ //the round thing on top
+ if (BarType = 'Note') then
+ glBindTexture(GL_TEXTURE_2D, aPlayerScoreScreenTextures[PlayerNumber].Score_NoteBarRound_Dark.TexNum);
+ if (BarType = 'Line') then
+ glBindTexture(GL_TEXTURE_2D, aPlayerScoreScreenTextures[PlayerNumber].Score_NoteBarRound_Light.TexNum);
+ if (BarType = 'Golden') then
+ glBindTexture(GL_TEXTURE_2D, aPlayerScoreScreenTextures[PlayerNumber].Score_NoteBarRound_Lightest.TexNum);
glEnable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glBegin(GL_QUADS);
- glTexCoord2f(0, 0); glVertex2f(BarStartPosX, (BarStartPosY - Static[StaticLevelRound[PlayerNumber]].Texture.h) - NewHeight);
- glTexCoord2f(1, 0); glVertex2f(BarStartPosX + Width, (BarStartPosY - Static[StaticLevelRound[PlayerNumber]].Texture.h) - NewHeight);
- glTexCoord2f(1, 1); glVertex2f(BarStartPosX + Width, BarStartPosY - NewHeight);
- glTexCoord2f(0, 1); glVertex2f(BarStartPosX, BarStartPosY - NewHeight);
+ glTexCoord2f(0, 0); glVertex3f(BarStartPosX, (BarStartPosY - Static[StaticLevelRound[PlayerNumber]].Texture.h) - NewHeight, ZBars);
+ glTexCoord2f(1, 0); glVertex3f(BarStartPosX + Width, (BarStartPosY - Static[StaticLevelRound[PlayerNumber]].Texture.h) - NewHeight, ZBars);
+ glTexCoord2f(1, 1); glVertex3f(BarStartPosX + Width, BarStartPosY - NewHeight, ZBars);
+ glTexCoord2f(0, 1); glVertex3f(BarStartPosX, BarStartPosY - NewHeight, ZBars);
glEnd;
- Result := NewHeight;
+ glDisable(GL_BLEND);
+ glDisable(GL_TEXTURE_2d);
+
+ if (BarType = 'Note')
+ then
+ aPlayerScoreScreenDatas[PlayerNumber].BarScore_ActualHeight := NewHeight;
+ if (BarType = 'Line')
+ then
+ aPlayerScoreScreenDatas[PlayerNumber].BarLine_ActualHeight := NewHeight;
+ if (BarType = 'Golden')
+ then
+ aPlayerScoreScreenDatas[PlayerNumber].BarGolden_ActualHeight := NewHeight;
end;
-function TScreenScore.IncrementScore(PlayerNumber: integer; ActualScoreValue: Integer; ScoreReached: integer; EaseOut_Step: Real) : integer;
+
+function TScreenScore.EaseScoreIn(PlayerNumber: integer; ScoreType : String) : real;
const
RaiseSmoothness : integer = 100;
var
RaiseStep : Real;
lTmpA : Real;
+ ScoreReached :Integer;
+ EaseOut_Step :Real;
+ ActualScoreValue:integer;
begin
+
+
+ if (ScoreType = 'Note') then
+ begin
+ EaseOut_Step := BarScore_EaseOut_Step;
+ ActualScoreValue := TextScore_ActualValue[PlayerNumber];
+ ScoreReached := Player[PlayerNumber-1].ScoreI;
+ end;
+ if (ScoreType = 'Line') then
+ begin
+ EaseOut_Step := BarPhrase_EaseOut_Step;
+ ActualScoreValue := TextPhrase_ActualValue[PlayerNumber];
+ ScoreReached := Player[PlayerNumber-1].ScoreLineI;
+ end;
+ if (ScoreType = 'Golden') then
+ begin
+ EaseOut_Step := BarGolden_EaseOut_Step;
+ ActualScoreValue := TextGolden_ActualValue[PlayerNumber];
+ ScoreReached := Player[PlayerNumber-1].ScoreGoldenI;
+ end;
+
// EaseOut_Step is the actual step in the raising process, like the 20iest step of EaseOut_MaxSteps
RaiseStep := EaseOut_Step;
@@ -601,12 +941,38 @@ begin
if ( lTmpA > 0 ) AND
( RaiseSmoothness > 0 ) THEN
begin
- Result := floor( lTmpA / RaiseSmoothness);
+
+ if (ScoreType = 'Note') then
+ begin
+ TextScore_ActualValue[PlayerNumber] := floor( lTmpA / RaiseSmoothness);
+ end;
+ if (ScoreType = 'Line') then
+ begin
+ TextPhrase_ActualValue[PlayerNumber] := floor( lTmpA / RaiseSmoothness);
+ end;
+ if (ScoreType = 'Golden') then
+ begin
+ TextGolden_ActualValue[PlayerNumber] := floor( lTmpA / RaiseSmoothness);
+ end;
+
end;
end
else
begin
- Result := ScoreReached;
+
+ if (ScoreType = 'Note') then
+ begin
+ TextScore_ActualValue[PlayerNumber] := ScoreReached;
+ end;
+ if (ScoreType = 'Line') then
+ begin
+ TextPhrase_ActualValue[PlayerNumber] := ScoreReached;
+ end;
+ if (ScoreType = 'Golden') then
+ begin
+ TextGolden_ActualValue[PlayerNumber] := ScoreReached;
+ end;
+
end;
end;
@@ -644,7 +1010,7 @@ begin
Text[TextName[Item]].ColG,
Text[TextName[Item]].ColB,
'P' + IntToStr(P+1) + 'Dark');
-
+ {
LoadColor(
Static[StaticBoxLightest[Item]].Texture.ColR,
Static[StaticBoxLightest[Item]].Texture.ColG,
@@ -662,6 +1028,7 @@ begin
Static[StaticBoxDark[Item]].Texture.ColG,
Static[StaticBoxDark[Item]].Texture.ColB,
'P' + IntToStr(P+1) + 'Dark');
+ }
end;
end.