aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code
diff options
context:
space:
mode:
authorbrunzelchen <brunzelchen@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-05-22 15:56:27 +0000
committerbrunzelchen <brunzelchen@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-05-22 15:56:27 +0000
commit36f1d0eafe8dae5498bc75e6976e9cb3ddd0ac94 (patch)
treeb7183245d36f789acf26084e074c4d7b30832bda /Game/Code
parentca2c58342560af45662272348916f02449ac4366 (diff)
downloadusdx-36f1d0eafe8dae5498bc75e6976e9cb3ddd0ac94.tar.gz
usdx-36f1d0eafe8dae5498bc75e6976e9cb3ddd0ac94.tar.xz
usdx-36f1d0eafe8dae5498bc75e6976e9cb3ddd0ac94.zip
added video reflection (for video preview)
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/1.0.1 Challenge MOD@2397 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game/Code')
-rw-r--r--Game/Code/Classes/UVideo.pas62
-rw-r--r--Game/Code/Screens/UScreenEditSub.pas1
-rw-r--r--Game/Code/Screens/UScreenSong.pas110
3 files changed, 126 insertions, 47 deletions
diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas
index 97c1e79b..7957c8a8 100644
--- a/Game/Code/Classes/UVideo.pas
+++ b/Game/Code/Classes/UVideo.pas
@@ -38,9 +38,11 @@ uses SDL,
type
TRectCoords = record //from 1.1
- Left, Right: double;
- Upper, Lower: double;
- windowed: boolean;
+ Left, Right: double;
+ Upper, Lower: double;
+ windowed: boolean;
+ Reflection: boolean;
+ ReflactionSpacing: real;
end;
TAspectCorrection = (acoStretch, acoCrop, acoLetterBox); //from 1.1
@@ -723,6 +725,7 @@ begin
Window.Upper := 0;
Window.Lower := RenderH;
Window.windowed := false;
+ Window.Reflection := false;
acDrawGLi(Screen, Window, 1);
end;
@@ -746,8 +749,8 @@ begin
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
glDisable(GL_SCISSOR_TEST);
- end;{ else if EnableVideoDraw then
- glEnable(GL_BLEND);}
+ end else if EnableVideoDraw then
+ glEnable(GL_BLEND);
if not EnableVideoDraw then
Exit;
@@ -786,11 +789,54 @@ begin
glVertex2f(ScreenRect.Right, ScreenRect.Upper);
glEnd;
- //glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+
+ if Window.windowed then
+ glDisable(GL_SCISSOR_TEST);
+
+ glDisable(GL_BLEND);
+
+ //Draw Reflaction
+ if Window.Reflection then
+ begin
+ glScissor(round((Window.Left)*(ScreenW/Screens)/RenderW+(ScreenW/Screens)*(Screen-1)),
+ round((RenderH-Window.Lower-Window.ReflactionSpacing-(Window.Lower-Window.Upper)*0.5)*ScreenH/RenderH),
+ round((Window.Right-Window.Left)*(ScreenW/Screens)/RenderW),
+ round((Window.Lower-Window.Upper)*ScreenH/RenderH*0.5));
+ glEnable(GL_SCISSOR_TEST);
+
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+ //Draw
+ glBegin(GL_QUADS);//Top Left
+ glColor4f(1, 1, 1, Blend-0.3);
+ glTexCoord2f(TexRect.Left, TexRect.Lower);
+ glVertex2f(ScreenRect.Left, ScreenRect.Lower+ Window.ReflactionSpacing);
+
+ //Bottom Left
+ glColor4f(1, 1, 1, 0);
+ glTexCoord2f(TexRect.Left, (TexRect.Lower-TexRect.Upper)*0.5);
+ glVertex2f(ScreenRect.Left,
+ ScreenRect.Lower + (ScreenRect.Lower-ScreenRect.Upper)*0.5 + Window.ReflactionSpacing);
+
+ //Bottom Right
+ glColor4f(1, 1, 1, 0);
+ glTexCoord2f(TexRect.Right, (TexRect.Lower-TexRect.Upper)*0.5);
+ glVertex2f(ScreenRect.Right,
+ ScreenRect.Lower + (ScreenRect.Lower-ScreenRect.Upper)*0.5 + Window.ReflactionSpacing);
+
+ //Top Right
+ glColor4f(1, 1, 1, Blend-0.3);
+ glTexCoord2f(TexRect.Right, TexRect.Lower);
+ glVertex2f(ScreenRect.Right, ScreenRect.Lower + Window.ReflactionSpacing);
+ glEnd;
+
+ glDisable(GL_BLEND);
+ glDisable(GL_SCISSOR_TEST);
+ end;
+
glDisable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, 0);
- glDisable(GL_SCISSOR_TEST);
- //glDisable(GL_BLEND);
if (Ini.MovieSize < 1) and not Window.windowed then //HalfSize BG
begin
diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas
index 5570e965..7665d8a4 100644
--- a/Game/Code/Screens/UScreenEditSub.pas
+++ b/Game/Code/Screens/UScreenEditSub.pas
@@ -2224,6 +2224,7 @@ begin
Window.Right := 770;
Window.Upper := 65;
Window.Lower := 250;
+ Window.Reflection := false;
Window.windowed := true;
{if CoverTime>=Ini.PreviewFading then
diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas
index 9f015a80..6bbaacbb 100644
--- a/Game/Code/Screens/UScreenSong.pas
+++ b/Game/Code/Screens/UScreenSong.pas
@@ -2242,31 +2242,7 @@ begin
Text[TextPlugin].Visible := false;
end;
- //Instead of Draw FG Procedure:
- //We draw Buttons for our own
- for I := 0 to Length(Button) - 1 do
- Button[I].Draw;
-
- // Statics
- for I := 0 to Length(Static) - 1 do
- Static[I].Draw;
-
- // and texts
- for I := 0 to Length(Text) - 1 do
- Text[I].Draw;
-
-
-
- //Draw Equalizer
- if Theme.Song.Equalizer.Visible then
- DrawEqualizer;
-
- if (CatSongs.Song[Interaction].Main) or (CatSongs.VisibleSongs = 0) then
- begin
- acClose;
- VidVis := none;
- end;
-
+ //prepare Video
if UVideo.VideoOpened then
begin
Czas.Teraz := Czas.Teraz + TimeSkip;
@@ -2279,33 +2255,89 @@ begin
Window.Right := Button[Interaction].X+Button[Interaction].W;
Window.Upper := Button[Interaction].Y;
Window.Lower := Button[Interaction].Y+Button[Interaction].H;
+ Window.ReflactionSpacing := Button[Interaction].Reflectionspacing;
+ Window.Reflection := Button[Interaction].Reflection;
Window.windowed := true;
- {if CoverTime>=Ini.PreviewFading then
- begin
- glColor4f(0, 0, 0, 1);
-
- glbegin(gl_quads);
- glVertex2f(Window.Left, Window.Upper);
- glVertex2f(Window.Left, Window.Lower);
- glVertex2f(Window.Right, Window.Lower);
- glVertex2f(Window.Right, Window.Upper);
- glEnd;
- end; }
SetAspectCorrection(acoCrop);
Blend := (CoverTime-1.75)/Ini.PreviewFading;
if Blend<0 then
Blend := 0
else if Blend>1 then
Blend := 1;
+ end;
+ except
+ //If an Error occurs drawing: prevent Video from being Drawn again and Close Video
+ log.LogError('Error drawing Video, Video has been disabled for this Song/Session.');
+ Log.LogError('Corrupted File: ' + CatSongs.Song[Interaction].Video);
+ try
+ acClose;
+ VidVis := none;
+ except
+ end;
+ end;
+ end;
+
+ //Instead of Draw FG Procedure:
+ //We draw Buttons for our own (without interaction-button)
+ for I := 0 to Length(Button) - 1 do
+ begin
+ if (I<>Interaction) then
+ Button[I].Draw;
+ end;
+
+ //Draw Video preview and interaction-button
+ if UVideo.VideoOpened then
+ begin
+ if (Blend<1) or not EnableVideoDraw then
+ Button[Interaction].Draw;
+
+ try
+ if VidVis=windowed then
acDrawGLi(ScreenAct, Window, Blend);
- end else if VidVis=full then
+
+ if (Czas.Teraz>=Czas.Razem) then
begin
- acDrawGL(ScreenAct);
+ acClose;
+ VidVis := none;
end;
+ except
+ //If an Error occurs drawing: prevent Video from being Drawn again and Close Video
+ log.LogError('Error drawing Video, Video has been disabled for this Song/Session.');
+ Log.LogError('Corrupted File: ' + CatSongs.Song[Interaction].Video);
+ try
+ acClose;
+ VidVis := none;
+ except
+ end;
+ end;
+ end else
+ Button[Interaction].Draw;
+
+ // Statics
+ for I := 0 to Length(Static) - 1 do
+ Static[I].Draw;
+
+ // and texts
+ for I := 0 to Length(Text) - 1 do
+ Text[I].Draw;
+
+ //Draw Equalizer
+ if Theme.Song.Equalizer.Visible then
+ DrawEqualizer;
- //ResetAspectCorrection;
+ if (CatSongs.Song[Interaction].Main) or (CatSongs.VisibleSongs = 0) then
+ begin
+ acClose;
+ VidVis := none;
+ end;
+
+ if UVideo.VideoOpened then
+ begin
+ try
+ if VidVis=full then
+ acDrawGL(ScreenAct);
if (Czas.Teraz>=Czas.Razem) then
begin