diff options
author | b1indy <b1indy@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2007-05-03 16:14:05 +0000 |
---|---|---|
committer | b1indy <b1indy@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2007-05-03 16:14:05 +0000 |
commit | 0ef472e08a64e5f9b8c33d6b0206a559a56c71ba (patch) | |
tree | bee3c4b1b0cd78e168782b0607867a83936bc777 /Game/Code/Menu | |
parent | c7db744c1dcbafb38f25a5cb005219faf16134b8 (diff) | |
download | usdx-0ef472e08a64e5f9b8c33d6b0206a559a56c71ba.tar.gz usdx-0ef472e08a64e5f9b8c33d6b0206a559a56c71ba.tar.xz usdx-0ef472e08a64e5f9b8c33d6b0206a559a56c71ba.zip |
screen fades to black at game end, when fading is enabled
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@161 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r-- | Game/Code/Menu/UDisplay.pas | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/Game/Code/Menu/UDisplay.pas b/Game/Code/Menu/UDisplay.pas index e6c0c4f0..ae7f901d 100644 --- a/Game/Code/Menu/UDisplay.pas +++ b/Game/Code/Menu/UDisplay.pas @@ -8,6 +8,9 @@ type TDisplay = class
ActualScreen: PMenu;
NextScreen: PMenu;
+
+ //fade-to-black-hack
+ BlackScreen: Boolean;
//popup hack
NextScreenWithCheck: Pmenu;
CheckOK: Boolean;
@@ -36,8 +39,6 @@ type var
Display: TDisplay;
-// ActualScreen: PMenu;
-// NextScreen: PMenu;
implementation
@@ -52,6 +53,7 @@ begin CheckOK:=False;
NextScreen:=NIL;
NextScreenWithCheck:=NIL;
+ BlackScreen:=False;
// fade mod
myfade:=0;
@@ -134,11 +136,11 @@ begin CheckOk:=False;
end
else
- Result:=False;
+ BlackScreen:=True; // end of game - fade to black before exit
//end popup hack
// ActualScreen.SetAnimationProgress(1);
- if not assigned (NextScreen) then begin
+ if (not assigned (NextScreen)) and (not BlackScreen) then begin
ActualScreen.Draw;
//popup mod
if ScreenPopupError <> NIL then if ScreenPopupError.Visible then ScreenPopupError.Draw else
@@ -169,13 +171,15 @@ begin ActualScreen.Draw;
glBindTexture(GL_TEXTURE_2D, pTex[S]);
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 512, 512, 0);
- if glGetError = GL_NO_ERROR then
+ if glGetError <> GL_NO_ERROR then
begin
canFade := False;
ScreenPopupError.ShowPopup('Error copying\nfade texture\nfading\ndisabled'); //show error message
end;
glViewPort((S-1) * ScreenW div Screens, 0, ScreenW div Screens, ScreenH);
- NextScreen.onShow;
+ // blackscreen-hack
+ if not BlackScreen then
+ NextScreen.onShow;
lastTime:=GetTickCount;
if (S=2) or (Screens = 1) then
myfade:=myfade+1;
@@ -197,7 +201,13 @@ begin // ActualScreen.SetAnimationProgress(Fade-1); // nop?
- NextScreen.Draw; // draw next screen
+ // blackscreen-hack
+ if not BlackScreen then
+ NextScreen.Draw // draw next screen
+ else begin
+ glClearColor(0, 0, 0 , 0);
+ glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
+ end;
// and draw old screen over it... slowly fading out
myfade2:=(myfade*myfade)/10000;
@@ -215,7 +225,11 @@ begin glDisable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
end
- else NextScreen.OnShow;
+ else
+ // blackscreen hack
+ if not BlackScreen then
+ NextScreen.OnShow;
+
if (myfade > 40) or (not doFade) or (not canFade) then begin // fade out complete...
@@ -224,8 +238,13 @@ begin ActualScreen.ShowFinish:=False;
ActualScreen:=NextScreen;
NextScreen := nil;
- ActualScreen.onShowFinish;
- ActualScreen.ShowFinish := true;
+ if not blackscreen then
+ begin
+ ActualScreen.onShowFinish;
+ ActualScreen.ShowFinish := true;
+ end
+ else
+ Result:=False;
// end of fade mod
end;
end; // if
|