aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Classes
diff options
context:
space:
mode:
authorjaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-03-04 07:08:11 +0000
committerjaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-03-04 07:08:11 +0000
commit5d8cb78bc5b8187da6e80954124f076c408b3c34 (patch)
tree6c31a05725b8832ddfb978101d49f9c718e9de2c /Game/Code/Classes
parent1d1b3b37b1aa462c33be8124a1947b8ea237c73b (diff)
downloadusdx-5d8cb78bc5b8187da6e80954124f076c408b3c34.tar.gz
usdx-5d8cb78bc5b8187da6e80954124f076c408b3c34.tar.xz
usdx-5d8cb78bc5b8187da6e80954124f076c408b3c34.zip
Patchs from AlexanderS & f1fth_freed0m
also some minor bug fixes from myself. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@904 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r--Game/Code/Classes/UDataBase.pas17
-rw-r--r--Game/Code/Classes/ULyrics.pas108
2 files changed, 80 insertions, 45 deletions
diff --git a/Game/Code/Classes/UDataBase.pas b/Game/Code/Classes/UDataBase.pas
index b5636d52..2bd29e75 100644
--- a/Game/Code/Classes/UDataBase.pas
+++ b/Game/Code/Classes/UDataBase.pas
@@ -74,7 +74,7 @@ const
Procedure TDataBaseSystem.Init(const Filename: string);
begin
- writeln( 'TDataBaseSystem.Init' );
+ writeln( 'TDataBaseSystem.Init ('+Filename+') @ '+ floattostr( now() ) );
//Open Database
ScoreDB := TSqliteDatabase.Create( Filename );
@@ -251,8 +251,8 @@ begin
Case Typ of
0: Query := 'SELECT `Player` , `Difficulty` , `Score` , `Artist` , `Title` FROM `'+cUS_Scores+'` INNER JOIN `US_Songs` ON (`SongID` = `ID`) ORDER BY `Score`';
1: Query := 'SELECT `Player` , ROUND (Sum(`Score`) / COUNT(`Score`)) FROM `'+cUS_Scores+'` GROUP BY `Player` ORDER BY (Sum(`Score`) / COUNT(`Score`))';
- 2: Query := 'SELECT `Artist` , `Title` , `TimesPlayed` FROM `'+cUS_Scores+'` ORDER BY `TimesPlayed`';
- 3: Query := 'SELECT `Artist` , Sum(`TimesPlayed`) FROM `'+cUS_Scores+'` GROUP BY `Artist` ORDER BY Sum(`TimesPlayed`)';
+ 2: Query := 'SELECT `Artist` , `Title` , `TimesPlayed` FROM `'+cUS_Songs+'` ORDER BY `TimesPlayed`';
+ 3: Query := 'SELECT `Artist` , Sum(`TimesPlayed`) FROM `'+cUS_Songs+'` GROUP BY `Artist` ORDER BY Sum(`TimesPlayed`)';
end;
//Add Order Direction
@@ -265,11 +265,12 @@ begin
Query := Query + ' LIMIT ' + InttoStr(Count * Page) + ', ' + InttoStr(Count) + ';';
//Execute Query
- //try
+ try
TableData := ScoreDB.GetTable(Query);
- {except
- exit;
- end;}
+ except
+ exit; // this has a try except, because ( on linux at least ) it seems that doing a GetTable, that returns nothing
+ // causes an exception. and in the case of a new Database file, with no scores stored yet... this seems to except here.
+ end;
//if Result empty -> Exit
if (TableData.RowCount < 1) then
@@ -337,7 +338,7 @@ begin
exit;
end;
2: begin
- Query := 'SELECT COUNT(`ID`) FROM `'+cUS_Scores+'`;';
+ Query := 'SELECT COUNT(`ID`) FROM `'+cUS_Songs+'`;';
if not ScoreDB.TableExists( cUS_Songs ) then
exit;
end;
diff --git a/Game/Code/Classes/ULyrics.pas b/Game/Code/Classes/ULyrics.pas
index 165084a8..f76e822e 100644
--- a/Game/Code/Classes/ULyrics.pas
+++ b/Game/Code/Classes/ULyrics.pas
@@ -509,10 +509,26 @@ begin
with Line^.Words[Line^.CurWord] do
begin
Progress:=(Beat-Start)/Length;
+ if Progress >= 1 then
+ Progress := 1;
+
+ if Progress <= 0 then
+ Progress := 0;
+
CurWordStartTx:=TexPos;
CurWordEndTx:=TexPos+TexWidth;
CurWordStart:=X;
CurWordEnd:=X+Width;
+
+ // Slide Effect
+ // simply paint the active texture to the current position
+ if HoverEffekt = 3 then
+ begin
+ CurWordStartTx := CurWordStartTx + TexWidth * progress;
+ CurWordEndTx := CurWordStartTx;
+ CurWordStart := CurWordStart + Width * progress;
+ CurWordEnd := CurWordStart;
+ end;
end;
//Get Start Position:
@@ -561,7 +577,12 @@ begin
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, Line^.Tex);
- glColorRGB(LineColor_act);
+ if HoverEffekt = 4 then
+ // ball lyric effect - only highlight current word and not that ones before in this line
+ glColorRGB(LineColor_en)
+ else
+ glColorRGB(LineColor_act);
+
glBegin(GL_QUADS);
glTexCoord2f(0, 1); glVertex2f(LyricX, Y);
glTexCoord2f(0, 1-realfontsize/64); glVertex2f(LyricX, Y + realfontsize);
@@ -569,42 +590,55 @@ begin
glTexCoord2f(CurWordStartTx, 1); glVertex2f(LyricX+CurWordStart, Y);
glEnd;
-{ // draw active word - type 1: farbwechsel - HoverEffect=3 oder so?
- glColor4f(LineColor_en.r,LineColor_en.g,LineColor_en.b,1-progress);
- glBegin(GL_QUADS);
- glTexCoord2f(CurWordStartTx, 1); glVertex2f(LyricX+CurWordStart, Y);
- glTexCoord2f(CurWordStartTx, 0); glVertex2f(LyricX+CurWordStart, Y + 64);
- glTexCoord2f(CurWordEndTx, 0); glVertex2f(LyricX+CurWordEnd, Y + 64);
- glTexCoord2f(CurWordEndTx, 1); glVertex2f(LyricX+CurWordEnd, Y);
- glEnd;
- glColor4f(LineColor_act.r,LineColor_act.g,LineColor_act.b,progress);
- glBegin(GL_QUADS);
- glTexCoord2f(CurWordStartTx, 1); glVertex2f(LyricX+CurWordStart, Y);
- glTexCoord2f(CurWordStartTx, 0); glVertex2f(LyricX+CurWordStart, Y + 64);
- glTexCoord2f(CurWordEndTx, 0); glVertex2f(LyricX+CurWordEnd, Y + 64);
- glTexCoord2f(CurWordEndTx, 1); glVertex2f(LyricX+CurWordEnd, Y);
- glEnd;
-}
-
- // draw active word - type 2: zoom + farbwechsel - HoverEffect=4 ???
- glPushMatrix;
- glTranslatef(LyricX+CurWordStart+(CurWordEnd-CurWordStart)/2,Y+realfontsize/2,0);
- glScalef(1.0+(1-progress)/2,1.0+(1-progress)/2,1.0);
- glColor4f(LineColor_en.r,LineColor_en.g,LineColor_en.b,1-progress);
- glBegin(GL_QUADS);
- glTexCoord2f(CurWordStartTx+0.0001, 1); glVertex2f(-(CurWordEnd-CurWordStart)/2, -realfontsize/2);
- glTexCoord2f(CurWordStartTx+0.0001, 1-realfontsize/64); glVertex2f(-(CurWordEnd-CurWordStart)/2, + realfontsize/2);
- glTexCoord2f(CurWordEndTx-0.0001, 1-realfontsize/64); glVertex2f((CurWordEnd-CurWordStart)/2, + realfontsize/2);
- glTexCoord2f(CurWordEndTx-0.0001, 1); glVertex2f((CurWordEnd-CurWordStart)/2, -realfontsize/2);
- glEnd;
- glColor4f(LineColor_act.r,LineColor_act.g,LineColor_act.b,1);
- glBegin(GL_QUADS);
- glTexCoord2f(CurWordStartTx+0.0001, 1); glVertex2f(-(CurWordEnd-CurWordStart)/2, -realfontsize/2);
- glTexCoord2f(CurWordStartTx+0.0001, 1-realfontsize/64); glVertex2f(-(CurWordEnd-CurWordStart)/2, + realfontsize/2);
- glTexCoord2f(CurWordEndTx-0.0001, 1-realfontsize/64); glVertex2f((CurWordEnd-CurWordStart)/2, + realfontsize/2);
- glTexCoord2f(CurWordEndTx-0.0001, 1); glVertex2f((CurWordEnd-CurWordStart)/2, -realfontsize/2);
- glEnd;
- glPopMatrix;
+ // draw active word:
+ // type 1: simple lyric effect
+ // type 4: ball lyric effect
+ // only change the color of the current word
+ if (HoverEffekt = 1) or (HoverEffekt = 4) then
+ begin
+ {
+ glColor4f(LineColor_en.r,LineColor_en.g,LineColor_en.b,1-progress);
+ glBegin(GL_QUADS);
+ glTexCoord2f(CurWordStartTx, 1); glVertex2f(LyricX+CurWordStart, Y);
+ glTexCoord2f(CurWordStartTx, 0); glVertex2f(LyricX+CurWordStart, Y + 64);
+ glTexCoord2f(CurWordEndTx, 0); glVertex2f(LyricX+CurWordEnd, Y + 64);
+ glTexCoord2f(CurWordEndTx, 1); glVertex2f(LyricX+CurWordEnd, Y);
+ glEnd;
+ }
+
+ glColor3f(LineColor_act.r,LineColor_act.g,LineColor_act.b);
+ glBegin(GL_QUADS);
+ glTexCoord2f(CurWordStartTx, 1); glVertex2f(LyricX+CurWordStart, Y);
+ glTexCoord2f(CurWordStartTx, 0); glVertex2f(LyricX+CurWordStart, Y + 64);
+ glTexCoord2f(CurWordEndTx, 0); glVertex2f(LyricX+CurWordEnd, Y + 64);
+ glTexCoord2f(CurWordEndTx, 1); glVertex2f(LyricX+CurWordEnd, Y);
+ glEnd;
+ end
+
+ // draw active word:
+ // type 1: zoom lyric effect
+ // change color and zoom current word
+ else if HoverEffekt = 2 then
+ begin
+ glPushMatrix;
+ glTranslatef(LyricX+CurWordStart+(CurWordEnd-CurWordStart)/2,Y+realfontsize/2,0);
+ glScalef(1.0+(1-progress)/2,1.0+(1-progress)/2,1.0);
+ glColor4f(LineColor_en.r,LineColor_en.g,LineColor_en.b,1-progress);
+ glBegin(GL_QUADS);
+ glTexCoord2f(CurWordStartTx+0.0001, 1); glVertex2f(-(CurWordEnd-CurWordStart)/2, -realfontsize/2);
+ glTexCoord2f(CurWordStartTx+0.0001, 1-realfontsize/64); glVertex2f(-(CurWordEnd-CurWordStart)/2, + realfontsize/2);
+ glTexCoord2f(CurWordEndTx-0.0001, 1-realfontsize/64); glVertex2f((CurWordEnd-CurWordStart)/2, + realfontsize/2);
+ glTexCoord2f(CurWordEndTx-0.0001, 1); glVertex2f((CurWordEnd-CurWordStart)/2, -realfontsize/2);
+ glEnd;
+ glColor4f(LineColor_act.r,LineColor_act.g,LineColor_act.b,1);
+ glBegin(GL_QUADS);
+ glTexCoord2f(CurWordStartTx+0.0001, 1); glVertex2f(-(CurWordEnd-CurWordStart)/2, -realfontsize/2);
+ glTexCoord2f(CurWordStartTx+0.0001, 1-realfontsize/64); glVertex2f(-(CurWordEnd-CurWordStart)/2, + realfontsize/2);
+ glTexCoord2f(CurWordEndTx-0.0001, 1-realfontsize/64); glVertex2f((CurWordEnd-CurWordStart)/2, + realfontsize/2);
+ glTexCoord2f(CurWordEndTx-0.0001, 1); glVertex2f((CurWordEnd-CurWordStart)/2, -realfontsize/2);
+ glEnd;
+ glPopMatrix;
+ end;
// draw rest of sentence
glColorRGB(LineColor_en);