aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorb1indy <b1indy@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-04-14 14:30:37 +0000
committerb1indy <b1indy@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-04-14 14:30:37 +0000
commitb627232ec93e4cb32790ddf30e3d27e7a2775cbb (patch)
tree3bd6cfa77db8858904201fe9688f85537ebe95f2
parent12eb3f055c7c75dbfeb168d5c38f87a901a6ab89 (diff)
downloadusdx-b627232ec93e4cb32790ddf30e3d27e7a2775cbb.tar.gz
usdx-b627232ec93e4cb32790ddf30e3d27e7a2775cbb.tar.xz
usdx-b627232ec93e4cb32790ddf30e3d27e7a2775cbb.zip
added some error checking to screen-fade-effect,
restored proper order of credits git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@88 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r--Game/Code/Menu/UDisplay.pas114
-rw-r--r--Game/Code/Screens/UScreenMain.pas6
2 files changed, 76 insertions, 44 deletions
diff --git a/Game/Code/Menu/UDisplay.pas b/Game/Code/Menu/UDisplay.pas
index d7439dc9..876fb6b6 100644
--- a/Game/Code/Menu/UDisplay.pas
+++ b/Game/Code/Menu/UDisplay.pas
@@ -14,7 +14,9 @@ type
Fade: Real;
// fade-mod
- myfade: integer;
+ doFade: Boolean;
+ myFade: integer;
+ lastTime: Cardinal;
pTexData : Pointer;
pTex : glUInt;
// end
@@ -42,22 +44,36 @@ begin
inherited Create;
// fade mod
myfade:=0;
+ doFade:=True;
// generate texture for fading between screens
GetMem(pTexData, 1024*1024*4);
- glGenTextures(1, pTex);
- glBindTexture(GL_TEXTURE_2D, pTex);
-
- glTexImage2D(GL_TEXTURE_2D, 0, 3, 1024, 1024, 0, GL_RGBA, GL_UNSIGNED_BYTE, pTexData);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- FreeMem(pTexData);
+ if pTexData <> NIL then
+ begin
+ glGenTextures(1, pTex);
+ if glGetError <> GL_NO_ERROR then doFade := False;
+ glBindTexture(GL_TEXTURE_2D, pTex);
+ if glGetError <> GL_NO_ERROR then doFade := False;
+ glTexImage2D(GL_TEXTURE_2D, 0, 3, 1024, 1024, 0, GL_RGBA, GL_UNSIGNED_BYTE, pTexData);
+ if glGetError <> GL_NO_ERROR then doFade := False;
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ if glGetError <> GL_NO_ERROR then doFade := False;
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ if glGetError <> GL_NO_ERROR then doFade := False;
+ FreeMem(pTexData);
+ end
+ else
+ begin
+ doFade:=False;
+ end;
+ if not doFade then showmessage('Fehler beim Initialisieren der Fading-Textur... Fading deaktiviert');
// end
end;
// fade mod
destructor TDisplay.Destroy;
begin
- glDeleteTextures(1,@pTex);
+ if doFade then
+ glDeleteTextures(1,@pTex);
inherited Destroy;
end;
// end
@@ -66,7 +82,8 @@ function TDisplay.Draw: Boolean;
var
S: integer;
// fade mod
- myfade2:integer;
+ myFade2:integer;
+ currentTime: Cardinal;
// end
begin
Result := True;
@@ -97,53 +114,68 @@ begin
myfade:=0;
// end
end
- else begin
- // fade mod
- //Create Fading texture if we're just starting
- if myfade = 0 then
+ else
+ begin
+ if doFade then
begin
- ActualScreen.Draw;
- glBindTexture(GL_TEXTURE_2D, pTex);
- glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, 1024, 1024, 0);
- NextScreen.onShow;
- end;
-
+ // fade mod
+ //Create Fading texture if we're just starting
+ if myfade = 0 then
+ begin
+ ActualScreen.Draw;
+ glBindTexture(GL_TEXTURE_2D, pTex);
+ glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, 1024, 1024, 0);
+ if glGetError <> GL_NO_ERROR then
+ begin
+ doFade := False;
+ showmessage('Fehler beim Kopieren der Fade-Textur... Fading deaktiviert');
+ end;
+ NextScreen.onShow;
+ lastTime:=GetTickCount;
+ myfade:=myfade+1;
+ end;
+ currentTime:=GetTickCount;
+ if currentTime > lastTime+30 then
+ begin
+ myfade:=myfade+4;
+ lastTime:=currentTime;
+ end;
// LastFade := Fade; // whatever
// Fade := Fade -0.999; // start fading out
- myfade:=myfade+1;
+
// ActualScreen.ShowFinish := false; // no purpose?
// ActualScreen.SetAnimationProgress(Fade-1); // nop?
- NextScreen.Draw; // draw next screen
+ NextScreen.Draw; // draw next screen
// and draw old screen over it... slowly fading out
- myfade2:=myfade*myfade;
- glBindTexture(GL_TEXTURE_2D, pTex);
- glColor4f(1, 1, 1, (1000-myfade2)/1000); // strange calculation - alpha gets negative... but looks good this way
- glEnable(GL_TEXTURE_2D);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
- glBegin(GL_QUADS);
- glTexCoord2f(0,0);glVertex2f(0-myfade2, 600+myfade2);
- glTexCoord2f(0,ScreenH/1024);glVertex2f(0-myfade2, 0-myfade2);
- glTexCoord2f(ScreenW/1024,ScreenH/1024);glVertex2f(800+myfade2, 0-myfade2);
- glTexCoord2f(ScreenW/1024,0);glVertex2f(800+myfade2, 600+myfade2);
- glEnd;
- glDisable(GL_BLEND);
- glDisable(GL_TEXTURE_2D);
- end;
-
- if myfade > 50 then begin // fade out complete...
- myfade:=0;
+ myfade2:=myfade*myfade;
+ glBindTexture(GL_TEXTURE_2D, pTex);
+ glColor4f(1, 1, 1, (1000-myfade2)/1000); // strange calculation - alpha gets negative... but looks good this way
+ glEnable(GL_TEXTURE_2D);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_BLEND);
+ glBegin(GL_QUADS);
+ glTexCoord2f(0,0);glVertex2f(0-myfade2, 600+myfade2);
+ glTexCoord2f(0,ScreenH/1024);glVertex2f(0-myfade2, 0-myfade2);
+ glTexCoord2f(ScreenW/1024,ScreenH/1024);glVertex2f(800+myfade2, 0-myfade2);
+ glTexCoord2f(ScreenW/1024,0);glVertex2f(800+myfade2, 600+myfade2);
+ glEnd;
+ glDisable(GL_BLEND);
+ glDisable(GL_TEXTURE_2D);
+ end;
+ if (myfade > 40) or (not doFade) then begin // fade out complete...
+ myFade:=0;
ActualScreen.onHide; // nop... whatever
ActualScreen.ShowFinish:=False;
ActualScreen:=NextScreen;
NextScreen := nil;
ActualScreen.onShowFinish; // one more nop...
ActualScreen.ShowFinish := true; // who wrote this crap?
- // end of fade mod
+ // end of fade mod
+ end;
end; // if
end; // for
// SwapBuffers(h_DC);
diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas
index 70916437..5849341c 100644
--- a/Game/Code/Screens/UScreenMain.pas
+++ b/Game/Code/Screens/UScreenMain.pas
@@ -36,6 +36,9 @@ const Credits_Text: Array[0..49] of PChar = (
':SPACE:',
'The Ultrastar Deluxe Team:',
':SPACE:',
+ 'blindy:',
+ 'VFX Programming',
+ ':SPACE:',
'commandi00:',
'Beta Testing',
':SPACE:',
@@ -48,9 +51,6 @@ const Credits_Text: Array[0..49] of PChar = (
'Mog:',
'Programming, Graphics',
':SPACE:',
- 'blindy:',
- 'VFX Programming',
- ':SPACE:',
'Mota:',
'Programming, Idea of creating this Mod',
':SPACE:',