From 994ff6bfd803edd76f45e7b2e083c2bbd06e0cf3 Mon Sep 17 00:00:00 2001 From: brunzelchen Date: Wed, 7 Apr 2010 20:17:42 +0000 Subject: - fixed "vista-no-mic-leads-to-crash" bug - better fading texture handling - fixed black video background on second screen in song menu - "Blue Sensation" as default theme git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/1.0.1 Challenge MOD@2224 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UIni.pas | 6 +- Game/Code/Classes/UVideo.pas | 26 ++++++--- Game/Code/Menu/UDisplay.pas | 94 ++++++++++++++++++------------ Game/Code/Screens/UScreenOptions.pas | 12 ++-- Game/Code/Screens/UScreenOptionsRecord.pas | 15 ++--- Game/Code/UltraStar.dpr | 2 +- Game/Output/Languages/English.ini | 4 ++ Game/Output/Languages/German.ini | 4 ++ Game/Output/Languages/Italian.ini | 4 ++ 9 files changed, 108 insertions(+), 59 deletions(-) diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas index e5891f58..37258a44 100644 --- a/Game/Code/Classes/UIni.pas +++ b/Game/Code/Classes/UIni.pas @@ -428,7 +428,7 @@ begin //Theme List Patch - //I2 Saves the no of the Deluxe (Standard-) Theme + //I2 Saves the no of the (Standard-) Theme I2 := 0; //I counts is the cur. Theme no I := 0; @@ -441,8 +441,8 @@ begin Tekst := UpperCase(ThemeIni.ReadString('Theme','Name',GetFileName(SR.Name))); ThemeIni.Free; - //if Deluxe Theme then save Themeno to I2 - if (Tekst = 'DELUXE') then + //if Default Theme then save Themeno to I2 + if (Tekst = 'Blue Sensation') then I2 := I; //Search for Skins for this Theme diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas index b37166c1..9e04a8ec 100644 --- a/Game/Code/Classes/UVideo.pas +++ b/Game/Code/Classes/UVideo.pas @@ -767,14 +767,23 @@ var begin // have a nice black background to draw on (even if there were errors opening the vid) - if (Screen=1) and not Window.windowed then begin + if Not Window.windowed then + begin glDisable(GL_BLEND); //glDisable(GL_DEPTH_TEST); //glDepthMask(GL_FALSE); //glDisable(GL_CULL_FACE); + + glScissor(round((ScreenW/Screens)*(Screen-1)), + 0, + round(ScreenW/Screens), + round(ScreenH)); + glEnable(GL_SCISSOR_TEST); glClearColor(0,0,0,1); glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + + glDisable(GL_SCISSOR_TEST); end else glEnable(GL_BLEND); @@ -786,13 +795,14 @@ begin GetVideoRect(ScreenRect, TexRect, Window); - - glScissor(round((Window.Left)*(ScreenW/Screens)/RenderW+(ScreenW/Screens)*(Screen-1)), - round((RenderH-Window.Lower)*ScreenH/RenderH), - round((Window.Right-Window.Left)*(ScreenW/Screens)/RenderW), - round((Window.Lower-Window.Upper)*ScreenH/RenderH)); - glEnable(GL_SCISSOR_TEST); - + if Window.windowed then + begin + glScissor(round((Window.Left)*(ScreenW/Screens)/RenderW+(ScreenW/Screens)*(Screen-1)), + round((RenderH-Window.Lower)*ScreenH/RenderH), + round((Window.Right-Window.Left)*(ScreenW/Screens)/RenderW), + round((Window.Lower-Window.Upper)*ScreenH/RenderH)); + glEnable(GL_SCISSOR_TEST); + end; glEnable(GL_TEXTURE_2D); glColor4f(1, 1, 1, Blend); diff --git a/Game/Code/Menu/UDisplay.pas b/Game/Code/Menu/UDisplay.pas index 56fa8ce1..d2027ca7 100644 --- a/Game/Code/Menu/UDisplay.pas +++ b/Game/Code/Menu/UDisplay.pas @@ -20,13 +20,13 @@ type Fade: Real; // fade-mod - doFade: Boolean; - canFade: Boolean; - DoneOnShow: Boolean; - myFade: integer; - lastTime: Cardinal; - pTexData : Pointer; - pTex : array[1..2] of glUInt; + doFade: Boolean; + canFade: Boolean; + DoneOnShow: Boolean; + myFade: integer; + lastTime: Cardinal; + pTex: array[1..2] of glUInt; + TexW, TexH: Cardinal; // end //FPS Counter @@ -54,10 +54,12 @@ var implementation -uses UGraphic, UTime, Graphics, Jpeg, UFiles, UTexture, UIni, TextGL, UCommandLine; +uses UGraphic, UTime, Math, Graphics, Jpeg, UFiles, UTexture, UIni, TextGL, UCommandLine; constructor TDisplay.Create; -var i: integer; +var + i: integer; + begin inherited Create; @@ -77,28 +79,32 @@ begin doFade:=False; canFade:=True; - // generate texture for fading between screens - GetMem(pTexData, 512*512*3); - if pTexData <> NIL then + for i:= 1 to 2 do begin + TexW := Round(Power(2, Ceil(Log2(ScreenW div Screens)))); + TexH := Round(Power(2, Ceil(Log2(ScreenH)))); + + glGetError(); + glGenTextures(1, pTex[i]); if glGetError <> GL_NO_ERROR then canFade := False; + glBindTexture(GL_TEXTURE_2D, pTex[i]); if glGetError <> GL_NO_ERROR then canFade := False; - glTexImage2D(GL_TEXTURE_2D, 0, 3, 512, 512, 0, GL_RGB, GL_UNSIGNED_BYTE, pTexData); + + //glTexEnvi(GL_TEXTURE_2D, GL_TEXTURE_ENV_MODE, GL_REPLACE); + //if glGetError <> GL_NO_ERROR then canFade := False; + + glTexImage2D(GL_TEXTURE_2D, 0, 3, TexW, TexH, 0, GL_RGB, GL_UNSIGNED_BYTE, nil); if glGetError <> GL_NO_ERROR then canFade := False; + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); if glGetError <> GL_NO_ERROR then canFade := False; + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); if glGetError <> GL_NO_ERROR then canFade := False; - end - else - begin - canFade:=False; end; - FreeMem(pTexData); - // end //Set LastError for OSD to No Error OSD_LastError := 'No Errors'; @@ -115,14 +121,15 @@ end; function TDisplay.Draw: Boolean; var - S: integer; - Col: Real; + S: integer; + Col: Real; // fade mod - myFade2: Real; - currentTime: Cardinal; - glError: glEnum; - glErrorStr: String; - Ticks: Cardinal; + myFade2: Real; + FadeW, FadeH: Real; + currentTime: Cardinal; + glError: glEnum; + glErrorStr: String; + Ticks: Cardinal; // end begin Result := True; @@ -197,11 +204,14 @@ begin //Create Fading texture if we're just starting if myfade = 0 then begin - glViewPort(0, 0, 512, 512); + //glViewPort(0, 0, 512, 512); ActualScreen.Draw; glGetError(); + glBindTexture(GL_TEXTURE_2D, pTex[S]); - glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, 512, 512, 0); + glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, (S-1) * ScreenW div Screens, 0, + ScreenW div Screens, ScreenH); + glError:=glGetError; if glError <> GL_NO_ERROR then begin @@ -217,7 +227,7 @@ begin end; ScreenPopupError.ShowPopup('Error copying\nfade texture\n('+glErrorStr+')\nfading\ndisabled'); //show error message end; - glViewPort((S-1) * ScreenW div Screens, 0, ScreenW div Screens, ScreenH); + //glViewPort((S-1) * ScreenW div Screens, 0, ScreenW div Screens, ScreenH); lastTime:=GetTickCount; if (S=2) or (Screens = 1) then @@ -257,16 +267,27 @@ begin // and draw old screen over it... slowly fading out myfade2:=(myfade*myfade)/10000; + FadeW := (ScreenW div Screens)/TexW; + FadeH := ScreenH/TexH; + glBindTexture(GL_TEXTURE_2D, pTex[S]); glColor4f(1, 1, 1, (1000-myfade*myfade)/1000); // strange calculation - alpha gets negative... but looks good this way + glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + //glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); glBegin(GL_QUADS); - glTexCoord2f(0+myfade2,0+myfade2);glVertex2f(0, 600); - glTexCoord2f(0+myfade2,1-myfade2);glVertex2f(0, 0); - glTexCoord2f(1-myfade2,1-myfade2);glVertex2f(800, 0); - glTexCoord2f(1-myfade2,0+myfade2);glVertex2f(800, 600); + glTexCoord2f((0+myfade2)*FadeW, (0+myfade2)*FadeH); + glVertex2f(0, RenderH); + + glTexCoord2f((0+myfade2)*FadeW, (1-myfade2)*FadeH); + glVertex2f(0, 0); + + glTexCoord2f((1-myfade2)*FadeW, (1-myfade2)*FadeH); + glVertex2f(RenderW, 0); + + glTexCoord2f((1-myfade2)*FadeW, (0+myfade2)*FadeH); + glVertex2f(RenderW, RenderH); glEnd; glDisable(GL_BLEND); glDisable(GL_TEXTURE_2D); @@ -276,7 +297,6 @@ begin if (not BlackScreen) AND (S = 1) then NextScreen.OnShow; - if ((myfade > 40) or (not doFade) or (not canFade)) And (S = 1) then begin // fade out complete... //if not DoneOnShow then // ScreenPopupError.ShowPopup('Wheres OnShow ?'); //show error message @@ -311,7 +331,9 @@ begin FPSCounter := 0; NextFPSSwap := Ticks + 250; end; - Inc(FPSCounter); + + if(S = 1) then + Inc(FPSCounter); //Draw OSD only on first Screen if Debug Mode is enabled if ((Ini.Debug = 1) OR (Params.Debug)) AND (S=1) then diff --git a/Game/Code/Screens/UScreenOptions.pas b/Game/Code/Screens/UScreenOptions.pas index f5a29054..ee4c2cba 100644 --- a/Game/Code/Screens/UScreenOptions.pas +++ b/Game/Code/Screens/UScreenOptions.pas @@ -19,10 +19,10 @@ type const ID='ID_006'; //for help system - + implementation -uses UGraphic, UHelp, ULog; +uses UGraphic, UHelp, ULog, URecord, ULanguage; function TScreenOptions.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; begin @@ -74,8 +74,12 @@ begin end; if SelInteraction = 5 then begin - Music.PlayStart; - FadeTo(@ScreenOptionsRecord); + if (Length(Recording.SoundCard)>0) then + begin + Music.PlayStart; + FadeTo(@ScreenOptionsRecord); + end else + ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_SOUND_INPUT')); end; if SelInteraction = 6 then begin diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas index 8b3df639..8dda4a6f 100644 --- a/Game/Code/Screens/UScreenOptionsRecord.pas +++ b/Game/Code/Screens/UScreenOptionsRecord.pas @@ -90,21 +90,22 @@ begin LoadFromTheme(Theme.OptionsRecord); SetLength(ICard, Length(Recording.SoundCard)); + for SC := 0 to High(Recording.SoundCard) do ICard[SC] := Recording.SoundCard[SC].Description; // end; -// if Length(Recording.SoundCard[Ini.Card].Input) > 0 then begin + if (Length(Recording.SoundCard)>0) then + begin SetLength(IInput, Length(Recording.SoundCard[Ini.Card].Input)); for SCI := 0 to High(Recording.SoundCard[Ini.Card].Input) do IInput[SCI] := Recording.SoundCard[Ini.Card].Input[SCI].Name; -// end; - - AddSelectSlide(Theme.OptionsRecord.SelectSlideCard, Ini.Card, ICard); - SelectSlideInput := AddSelectSlide(Theme.OptionsRecord.SelectSlideInput, Ini.CardList[0].Input, IInput); - SelectSlideChannelL := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelL, Ini.CardList[0].ChannelL, IChannel); - SelectSlideChannelR := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelR, Ini.CardList[0].ChannelR, IChannel); + AddSelectSlide(Theme.OptionsRecord.SelectSlideCard, Ini.Card, ICard); + SelectSlideInput := AddSelectSlide(Theme.OptionsRecord.SelectSlideInput, Ini.CardList[0].Input, IInput); + SelectSlideChannelL := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelL, Ini.CardList[0].ChannelL, IChannel); + SelectSlideChannelR := AddSelectSlide(Theme.OptionsRecord.SelectSlideChannelR, Ini.CardList[0].ChannelR, IChannel); + end; AddButton(Theme.OptionsRecord.ButtonExit); if (Length(Button[0].Text)=0) then diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index f8f8b397..056f2f78 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -124,7 +124,7 @@ uses acinerella in 'lib\acinerella\acinerella.pas'; const - Version = 'UltraStar Deluxe v1.0.1a Challenge-MOD r7b beta 2 2010-04-04'; + Version = 'UltraStar Deluxe v1.0.1a Challenge-MOD r7b beta 5 2010-04-07'; var WndTitle: string; diff --git a/Game/Output/Languages/English.ini b/Game/Output/Languages/English.ini index d8e44373..8fe018a8 100644 --- a/Game/Output/Languages/English.ini +++ b/Game/Output/Languages/English.ini @@ -413,6 +413,10 @@ MSG_HELP_KEYMAP=Key mapping ;new SING_OPTIONS_ADVANCED_SUMPLAYERS=Sum up Top 8 +#### Options #### +;new +ERROR_NO_SOUND_INPUT=No sound input devices found! + ######################################################### # Help System # ######################################################### diff --git a/Game/Output/Languages/German.ini b/Game/Output/Languages/German.ini index 37b457b9..42be25ba 100644 --- a/Game/Output/Languages/German.ini +++ b/Game/Output/Languages/German.ini @@ -414,6 +414,10 @@ MSG_HELP_KEYMAP=Tastenbelegung ;new SING_OPTIONS_ADVANCED_SUMPLAYERS=Sum up Top 8 +#### Options #### +;new +ERROR_NO_SOUND_INPUT=Keine Aufnahmegeräte gefunden! + #-------------------------------------------------------# # Help System # #-------------------------------------------------------# diff --git a/Game/Output/Languages/Italian.ini b/Game/Output/Languages/Italian.ini index cd79a0cf..df194739 100644 --- a/Game/Output/Languages/Italian.ini +++ b/Game/Output/Languages/Italian.ini @@ -404,6 +404,10 @@ EDITOR_CAPITALIZE_LETTER=Capitalized letter at the beginning of line ;new SING_OPTIONS_ADVANCED_SUMPLAYERS=Sum up Top 8 +#### Options #### +;new +ERROR_NO_SOUND_INPUT=No sound input devices found! + #-------------------------------------------------------# # Help System # #-------------------------------------------------------# -- cgit v1.2.3