diff options
author | mogguh <mogguh@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2007-12-06 15:01:07 +0000 |
---|---|---|
committer | mogguh <mogguh@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2007-12-06 15:01:07 +0000 |
commit | 5ec90c178c0c04b42ed80918d0497bb24ee774ed (patch) | |
tree | 2afeea326ef20db7b72d30e7f51ec1a7050aa179 /Game/Code/Screens | |
parent | 011d12dd56e5c18e08c311e880d010e73674a029 (diff) | |
download | usdx-5ec90c178c0c04b42ed80918d0497bb24ee774ed.tar.gz usdx-5ec90c178c0c04b42ed80918d0497bb24ee774ed.tar.xz usdx-5ec90c178c0c04b42ed80918d0497bb24ee774ed.zip |
Fixed array issues, moving through the several arrays is ugly - but at least it works
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@689 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game/Code/Screens')
-rw-r--r-- | Game/Code/Screens/UScreenScore.pas | 355 |
1 files changed, 171 insertions, 184 deletions
diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index 3537a26d..0ed04b89 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -61,17 +61,17 @@ type Animation: real; Fadeout: boolean; - BarScore_ActualHeight : array[1..6] of real; - BarPhrase_ActualHeight : array[1..6] of real; - BarGolden_ActualHeight : array[1..6] of real; + 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; @@ -150,44 +150,41 @@ begin LoadFromTheme(Theme.Score); TextArtist := AddText(Theme.Score.TextArtist); - TextTitle := AddText(Theme.Score.TextTitle); + TextTitle := AddText(Theme.Score.TextTitle); TextArtistTitle := AddText(Theme.Score.TextArtistTitle); - for P := 1 to 6 do begin - TextName[P] := AddText(Theme.Score.TextName[P]); - TextScore[P] := AddText(Theme.Score.TextScore[P]); - - TextNotes[P] := AddText(Theme.Score.TextNotes[P]); - TextNotesScore[P] := AddText(Theme.Score.TextNotesScore[P]); - TextLineBonus[P] := AddText(Theme.Score.TextLineBonus[P]); - TextLineBonusScore[P] := AddText(Theme.Score.TextLineBonusScore[P]); - TextGoldenNotes[P] := AddText(Theme.Score.TextGoldenNotes[P]); - TextGoldenNotesScore[P] := AddText(Theme.Score.TextGoldenNotesScore[P]); - TextTotal[P] := AddText(Theme.Score.TextTotal[P]); - TextTotalScore[P] := AddText(Theme.Score.TextTotalScore[P]); - - SetLength(PlayerStatic[P], Length(Theme.Score.PlayerStatic[P])); - - SetLength(PlayerTexts[P], Length(Theme.Score.PlayerTexts[P])); + for P := 1 to 6 do + begin + SetLength(PlayerStatic[P], Length(Theme.Score.PlayerStatic[P])); + SetLength(PlayerTexts[P], Length(Theme.Score.PlayerTexts[P])); for I := 0 to High(Theme.Score.PlayerStatic[P]) do - PlayerStatic[P, I] := AddStatic(Theme.Score.PlayerStatic[P, I]); + PlayerStatic[P, I] := AddStatic(Theme.Score.PlayerStatic[P, I]); - - //added by mog for C := 0 to High(Theme.Score.PlayerTexts[P]) do - PlayerTexts[P, C] := AddText(Theme.Score.PlayerTexts[P, C]); - // more skinable now - - StaticBoxLightest[P] := AddStatic(Theme.Score.StaticBoxLightest[P]); - StaticBoxLight[P] := AddStatic(Theme.Score.StaticBoxLight[P]); - StaticBoxDark[P] := AddStatic(Theme.Score.StaticBoxDark[P]); - - StaticBackLevel[P] := AddStatic(Theme.Score.StaticBackLevel[P]); - StaticBackLevelRound[P] := AddStatic(Theme.Score.StaticBackLevelRound[P]); - StaticLevel[P] := AddStatic(Theme.Score.StaticLevel[P]); - StaticLevelRound[P] := AddStatic(Theme.Score.StaticLevelRound[P]); + PlayerTexts[P, C] := AddText(Theme.Score.PlayerTexts[P, C]); + + TextName[P] := AddText(Theme.Score.TextName[P]); + TextScore[P] := AddText(Theme.Score.TextScore[P]); + + TextNotes[P] := AddText(Theme.Score.TextNotes[P]); + TextNotesScore[P] := AddText(Theme.Score.TextNotesScore[P]); + TextLineBonus[P] := AddText(Theme.Score.TextLineBonus[P]); + TextLineBonusScore[P] := AddText(Theme.Score.TextLineBonusScore[P]); + TextGoldenNotes[P] := AddText(Theme.Score.TextGoldenNotes[P]); + TextGoldenNotesScore[P] := AddText(Theme.Score.TextGoldenNotesScore[P]); + TextTotal[P] := AddText(Theme.Score.TextTotal[P]); + TextTotalScore[P] := AddText(Theme.Score.TextTotalScore[P]); + + StaticBoxLightest[P] := AddStatic(Theme.Score.StaticBoxLightest[P]); + StaticBoxLight[P] := AddStatic(Theme.Score.StaticBoxLight[P]); + StaticBoxDark[P] := AddStatic(Theme.Score.StaticBoxDark[P]); + + StaticBackLevel[P] := AddStatic(Theme.Score.StaticBackLevel[P]); + StaticBackLevelRound[P] := AddStatic(Theme.Score.StaticBackLevelRound[P]); + StaticLevel[P] := AddStatic(Theme.Score.StaticLevel[P]); + StaticLevelRound[P] := AddStatic(Theme.Score.StaticLevelRound[P]); end; end; @@ -203,124 +200,91 @@ var MaxH: real; // maximum height of score bar Wsp: real; begin -{* - CountSkipTimeSet; - - Animation := 0; - Fadeout := false; - - Text[1].Text := AktSong.Artist + ' - ' + AktSong.Title; - Text[2].Text := ' ' + IntToStr((Round(Gracz[0].Punkty) div 10) * 10) + ' points'; - - Static[0].Texture.X := -2000; - Static[1].Texture.X := -2000; - Static[2].Texture.X := -2000; - Static[3].Texture.X := -2000; - Static[4].Texture.X := -2000; - Static[5].Texture.X := -2000; - Static[6].Texture.X := -2000; - Static[7].Texture.X := -2000; - - Text[0].X := -2000; - Text[1].X := -2000; - Text[2].X := -2000; - Text[3].X := -2000; - - - case (Round(Gracz[0].Punkty) div 10) * 10 of - 0..1000: Text[3].Text := ' Tone Deaf'; - 2010..4000: Text[3].Text := ' Amateur'; - 4010..6000: Text[3].Text := ' Rising Star'; - 6010..8000: Text[3].Text := ' Lead Singer'; - 8010..9000: Text[3].Text := ' Hit Artist'; - 9010..10000: Text[3].Text := ' Superstar'; - end; - - Music.PlayShuffle; -*} // Singstar Fadeout := false; - Text[TextArtist].Text := AktSong.Artist; - Text[TextTitle].Text := AktSong.Title; + Text[TextArtist].Text := AktSong.Artist; + Text[TextTitle].Text := AktSong.Title; 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; - end; - - for P := 1 to 6 do begin - 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 - 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[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]; - Static[StaticBoxDark[P]].Visible := V[P]; - - Static[StaticBackLevel[P]].Visible := false; //V[P]; - Static[StaticBackLevelRound[P]].Visible := false; //V[P]; - Static[StaticLevel[P]].Visible := false; //V[P]; - Static[StaticLevelRound[P]].Visible := false; //V[P]; + 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[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[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];
+ Static[StaticBoxDark[P]].Visible := V[P]; + +// + Static[StaticBackLevel[P]].Visible := false; + Static[StaticBackLevelRound[P]].Visible := false; + Static[StaticLevel[P]].Visible := false; + Static[StaticLevelRound[P]].Visible := false; + end; end; procedure TScreenScore.onShowFinish; var index : integer; begin -for index := 1 to 2 do +for index := 0 to (PlayersPlay-1) do begin BarScore_ActualHeight[index] := 0; BarPhrase_ActualHeight[index] := 0; @@ -331,7 +295,6 @@ for index := 1 to 2 do TextGolden_ActualValue[index] := 0; end; - BarScore_EaseOut_Step := 1; BarPhrase_EaseOut_Step := 1; BarGolden_EaseOut_Step := 1; @@ -354,6 +317,7 @@ var C: integer; katze : integer; + ArrayStartModifier : integer; begin // 0.5.0: try also use 4 players screen with nicks @@ -395,22 +359,45 @@ begin end; inherited Draw; -{ - player[1].ScoreI := 7000; - player[1].ScoreLineI := 2000; - player[1].ScoreGoldenI := 1000; - - player[2].ScoreI := 2500; - player[2].ScoreLineI := 1100; - player[2].ScoreGoldenI := 900; - } + + //player[1].ScoreI := 7000; + //player[1].ScoreLineI := 2000; + //player[1].ScoreGoldenI := 1000; + + //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; - For katze:= 0 to 5 do +// 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 begin // We actually araise them in the right order, but we have to draw them in reverse order (golden -> phrase -> mainscore) @@ -436,72 +423,72 @@ begin // Draw golden score bar # //######################## - BarGolden_ActualHeight[katze] := RaiseBar(katze, - Static[StaticBackLevel[katze+1]].Texture.y - BarScore_ActualHeight[katze] - BarPhrase_ActualHeight[katze], + BarGolden_ActualHeight[katze] := RaiseBar(katze + ArrayStartModifier, + Static[StaticBackLevel[katze + ArrayStartModifier]].Texture.y - BarScore_ActualHeight[katze] - BarPhrase_ActualHeight[katze], BarGolden_ActualHeight[katze], - player[katze+1].ScoreGoldenI, + 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+1].ScoreGoldenI, + Player[katze].ScoreGoldenI, BarGolden_EaseOut_Step); - Text[TextGoldenNotesScore[katze+1]].Text := IntToStr(TextGolden_ActualValue[katze]); + Text[TextGoldenNotesScore[katze + ArrayStartModifier]].Text := IntToStr(TextGolden_ActualValue[katze]); // Blend in - Text[TextGoldenNotesScore[katze+1]].Alpha := (BarGolden_EaseOut_Step / 100); - Text[TextGoldenNotes[katze+1]].Alpha := (BarGolden_EaseOut_Step / 100); + Text[TextGoldenNotesScore[katze + ArrayStartModifier]].Alpha := (BarGolden_EaseOut_Step / 100); + Text[TextGoldenNotes[katze + ArrayStartModifier]].Alpha := (BarGolden_EaseOut_Step / 100); end; //######################## // Draw phrase score bar # //######################## - BarPhrase_ActualHeight[katze] := RaiseBar(katze, - Static[StaticBackLevel[katze+1]].Texture.y - BarScore_ActualHeight[katze], + BarPhrase_ActualHeight[katze] := RaiseBar(katze + ArrayStartModifier, + Static[StaticBackLevel[katze + ArrayStartModifier]].Texture.y - BarScore_ActualHeight[katze], BarPhrase_ActualHeight[katze], - Player[katze+1].ScoreLineI, + 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+1].ScoreLineI, + Player[katze].ScoreLineI, BarPhrase_EaseOut_Step); - Text[TextLineBonusScore[katze+1]].Text := IntToStr(TextPhrase_ActualValue[katze]); + Text[TextLineBonusScore[katze + ArrayStartModifier]].Text := IntToStr(TextPhrase_ActualValue[katze]); //Blend in - Text[TextLineBonusScore[katze+1]].Alpha := (BarPhrase_EaseOut_Step / 100); - Text[TextLineBonus[katze+1]].Alpha := (BarPhrase_EaseOut_Step / 100); + Text[TextLineBonusScore[katze + ArrayStartModifier]].Alpha := (BarPhrase_EaseOut_Step / 100); + Text[TextLineBonus[katze + ArrayStartModifier]].Alpha := (BarPhrase_EaseOut_Step / 100); end; //####################### // Draw plain score bar # //####################### - BarScore_ActualHeight[katze] := RaiseBar(katze, - Static[StaticBackLevel[katze+1]].Texture.y, + BarScore_ActualHeight[katze] := RaiseBar(katze + ArrayStartModifier, + Static[StaticBackLevel[katze + ArrayStartModifier]].Texture.y, BarScore_ActualHeight[katze], - Player[katze+1].ScoreI, + 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+1].ScoreI, + Player[katze].ScoreI, BarScore_EaseOut_Step); - Text[TextNotesScore[katze+1]].Text := IntToStr(TextScore_ActualValue[katze]); + Text[TextNotesScore[katze + ArrayStartModifier]].Text := IntToStr(TextScore_ActualValue[katze]); - Text[TextTotalScore[katze+1]].Text := IntToStr(TextScore_ActualValue[katze] + TextPhrase_ActualValue[katze] + TextGolden_ActualValue[katze]); + Text[TextTotalScore[katze + ArrayStartModifier]].Text := IntToStr(TextScore_ActualValue[katze] + TextPhrase_ActualValue[katze] + TextGolden_ActualValue[katze]); //Blend em in - Text[TextTotalScore[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); - Text[TextTotal[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); - Text[TextNotesScore[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); - Text[TextNotes[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); - Text[TextScore[katze+1]].Alpha := (BarScore_EaseOut_Step / 100); + 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 end; @@ -526,10 +513,10 @@ var lTmp : real; begin - MaxHeight := Static[StaticBackLevel[PlayerNumber + 1]].Texture.H; - Width := Static[StaticBackLevel[PlayerNumber + 1]].Texture.W; + MaxHeight := Static[StaticBackLevel[PlayerNumber]].Texture.H; + Width := Static[StaticBackLevel[PlayerNumber]].Texture.W; - BarStartPosX := Static[StaticBackLevel[PlayerNumber + 1]].Texture.X; + BarStartPosX := Static[StaticBackLevel[PlayerNumber]].Texture.X; BarStartPosY := BarStartPosY + MaxHeight; // The texture starts in the upper left corner, so let's subtract the height - so we can arise it @@ -559,11 +546,11 @@ begin NewHeight := Height2Reach; end; //+1 - LoadColor(R, G, B, 'P' + inttostr(PlayerNumber+1) + ColorBrightness); //dark, light, lightest + 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 + 1]].Texture.TexNum); + glBindTexture(GL_TEXTURE_2D, Static[StaticLevel[PlayerNumber]].Texture.TexNum); glEnable(GL_TEXTURE_2D); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -577,15 +564,15 @@ begin glEnd; //the round thing on top - glBindTexture(GL_TEXTURE_2D, Static[StaticLevelRound[PlayerNumber + 1]].Texture.TexNum); + glBindTexture(GL_TEXTURE_2D, Static[StaticLevelRound[PlayerNumber]].Texture.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 + 1]].Texture.h) - NewHeight); - glTexCoord2f(1, 0); glVertex2f(BarStartPosX + Width, (BarStartPosY - Static[StaticLevelRound[PlayerNumber + 1]].Texture.h) - NewHeight); + 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); glEnd; |