From b61e647b67ac0d449d764b89b117a3ac8b603403 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Tue, 8 May 2007 19:00:47 +0000 Subject: Readded Q Shortcut (Exit Application) on all Screens Clean up Popup Code a little bit git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@180 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/UMain.pas | 35 ++++++++-- Game/Code/Screens/UScreenEdit.pas | 4 ++ Game/Code/Screens/UScreenEditHeader.pas | 4 ++ Game/Code/Screens/UScreenLevel.pas | 8 +-- Game/Code/Screens/UScreenMain.pas | 8 +-- Game/Code/Screens/UScreenOpen.pas | 4 ++ Game/Code/Screens/UScreenOptionsAdvanced.pas | 4 ++ Game/Code/Screens/UScreenOptionsGame.pas | 4 ++ Game/Code/Screens/UScreenOptionsLyrics.pas | 4 ++ Game/Code/Screens/UScreenOptionsRecord.pas | 4 ++ Game/Code/Screens/UScreenOptionsSound.pas | 4 ++ Game/Code/Screens/UScreenOptionsThemes.pas | 4 ++ Game/Code/Screens/UScreenPartyNewRound.pas | 8 +-- Game/Code/Screens/UScreenPartyOptions.pas | 8 +-- Game/Code/Screens/UScreenPopup.pas | 101 +++++---------------------- Game/Code/Screens/UScreenSing.pas | 25 ++++--- Game/Code/Screens/UScreenSong.pas | 17 ++--- Game/Code/Screens/UScreenSongJumpto.pas | 8 +-- Game/Code/Screens/UScreenSongMenu.pas | 8 +-- 19 files changed, 108 insertions(+), 154 deletions(-) (limited to 'Game') diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index 69eca419..29ca5fcb 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -112,7 +112,7 @@ begin CheckEvents; // display - done:=not Display.Draw; + done := not Display.Draw; SwapBuffers; // light @@ -158,12 +158,35 @@ Begin begin // popup hack... if there is a visible popup then let it handle input instead of underlying screen // shoud be done in a way to be sure the topmost popup has preference (maybe error, then check) - if ScreenPopupError <> NIL then if ScreenPopupError.Visible then ScreenPopupError.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True) else - if ScreenPopupCheck <> NIL then if ScreenPopupCheck.Visible then ScreenPopupCheck.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True) else + if (ScreenPopupError <> NIL) and (ScreenPopupError.Visible) then + done := not ScreenPopupError.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True) + else if (ScreenPopupCheck <> NIL) AND (ScreenPopupCheck.Visible) then + done := not ScreenPopupCheck.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True) + // end of popup hack - if (Not Display.ActualScreen^.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True)) then -// if (Not Display.ActualScreen^.ParseInput(Event.key.keysym.scancode, True)) then - done := true; // exit game + + else + begin + // check for Screen want to Exit + done := Not Display.ActualScreen^.ParseInput(Event.key.keysym.sym, Event.key.keysym.unicode, True); + + //If Screen wants to Exit + if done then + begin + //If Question Option is enabled then Show Exit Popup + if (Ini.AskbeforeDel = 1) then + begin + Display.ActualScreen^.CheckFadeTo(NIL,'MSG_QUIT_USDX'); + end + else //When asking for exit is disabled then simply exit + begin + Display.Fade := 0; + Display.NextScreenWithCheck := nil; + Display.CheckOK := True; + end; + end; + + end; // if (Not Display.ActualScreen^.ParseInput(Event.key.keysym.scancode, True)) then end; // SDL_JOYAXISMOTION: // begin diff --git a/Game/Code/Screens/UScreenEdit.pas b/Game/Code/Screens/UScreenEdit.pas index 00df0418..ac2964cd 100644 --- a/Game/Code/Screens/UScreenEdit.pas +++ b/Game/Code/Screens/UScreenEdit.pas @@ -28,6 +28,10 @@ begin If (PressedDown) Then begin // Key Down case PressedKey of + SDLK_Q: + begin + Result := false; + end; SDLK_ESCAPE : begin Music.PlayBack; diff --git a/Game/Code/Screens/UScreenEditHeader.pas b/Game/Code/Screens/UScreenEditHeader.pas index dbdd186c..f3e21fd0 100644 --- a/Game/Code/Screens/UScreenEditHeader.pas +++ b/Game/Code/Screens/UScreenEditHeader.pas @@ -53,6 +53,10 @@ begin Result := true; If (PressedDown) Then begin // Key Down case PressedKey of + SDLK_Q: + begin + Result := false; + end; SDLK_ESCAPE : begin // Music.PlayBack; diff --git a/Game/Code/Screens/UScreenLevel.pas b/Game/Code/Screens/UScreenLevel.pas index 80d42773..a1d8fa33 100644 --- a/Game/Code/Screens/UScreenLevel.pas +++ b/Game/Code/Screens/UScreenLevel.pas @@ -53,13 +53,7 @@ begin SDLK_RIGHT: InteractNext; SDLK_LEFT: InteractPrev; end; - end - else // Key Up - case PressedKey of - SDLK_RETURN : - begin - end; - end; + end; end; constructor TScreenLevel.Create; diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index f339fa04..6fd458d7 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -55,9 +55,7 @@ begin SDLK_ESCAPE : begin - //popup hack - CheckFadeTo(NIL,'MSG_QUIT_USDX'); -// Result := False; + Result := False; end; SDLK_C: @@ -133,9 +131,7 @@ begin //Exit if Interaction = 5 then begin - //popup hack - CheckFadeTo(NIL,'MSG_QUIT_USDX'); -// Result := false; + Result := false; end; end; // Up and Down could be done at the same time, diff --git a/Game/Code/Screens/UScreenOpen.pas b/Game/Code/Screens/UScreenOpen.pas index 4f0c32c5..3a78b3e2 100644 --- a/Game/Code/Screens/UScreenOpen.pas +++ b/Game/Code/Screens/UScreenOpen.pas @@ -41,6 +41,10 @@ begin end; case PressedKey of + SDLK_Q: + begin + Result := false; + end; 8: // del begin if Interaction = 0 then diff --git a/Game/Code/Screens/UScreenOptionsAdvanced.pas b/Game/Code/Screens/UScreenOptionsAdvanced.pas index 256b02db..3e3f2da7 100644 --- a/Game/Code/Screens/UScreenOptionsAdvanced.pas +++ b/Game/Code/Screens/UScreenOptionsAdvanced.pas @@ -23,6 +23,10 @@ begin If (PressedDown) Then begin // Key Down case PressedKey of + SDLK_Q: + begin + Result := false; + end; SDLK_ESCAPE : begin Ini.Save; diff --git a/Game/Code/Screens/UScreenOptionsGame.pas b/Game/Code/Screens/UScreenOptionsGame.pas index 88bb34e3..540931af 100644 --- a/Game/Code/Screens/UScreenOptionsGame.pas +++ b/Game/Code/Screens/UScreenOptionsGame.pas @@ -25,6 +25,10 @@ begin If (PressedDown) Then begin // Key Down case PressedKey of + SDLK_Q: + begin + Result := false; + end; SDLK_ESCAPE : begin Music.PlayBack; diff --git a/Game/Code/Screens/UScreenOptionsLyrics.pas b/Game/Code/Screens/UScreenOptionsLyrics.pas index ff03b2ba..f60c9765 100644 --- a/Game/Code/Screens/UScreenOptionsLyrics.pas +++ b/Game/Code/Screens/UScreenOptionsLyrics.pas @@ -23,6 +23,10 @@ begin If (PressedDown) Then begin // Key Down case PressedKey of + SDLK_Q: + begin + Result := false; + end; SDLK_ESCAPE : begin Ini.Save; diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas index af7d2cd6..c474bd7f 100644 --- a/Game/Code/Screens/UScreenOptionsRecord.pas +++ b/Game/Code/Screens/UScreenOptionsRecord.pas @@ -28,6 +28,10 @@ begin If (PressedDown) Then begin // Key Down case PressedKey of + SDLK_Q: + begin + Result := false; + end; SDLK_ESCAPE, SDLK_BACKSPACE: begin Ini.Save; diff --git a/Game/Code/Screens/UScreenOptionsSound.pas b/Game/Code/Screens/UScreenOptionsSound.pas index ee53ef02..d4ab27d2 100644 --- a/Game/Code/Screens/UScreenOptionsSound.pas +++ b/Game/Code/Screens/UScreenOptionsSound.pas @@ -23,6 +23,10 @@ begin If (PressedDown) Then begin // Key Down case PressedKey of + SDLK_Q: + begin + Result := false; + end; SDLK_ESCAPE : begin Ini.Save; diff --git a/Game/Code/Screens/UScreenOptionsThemes.pas b/Game/Code/Screens/UScreenOptionsThemes.pas index c0bf2e15..580f9c4d 100644 --- a/Game/Code/Screens/UScreenOptionsThemes.pas +++ b/Game/Code/Screens/UScreenOptionsThemes.pas @@ -26,6 +26,10 @@ begin If (PressedDown) Then begin // Key Down case PressedKey of + SDLK_Q: + begin + Result := false; + end; SDLK_ESCAPE : begin Ini.Save; diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas index 894e96d2..c914ee4b 100644 --- a/Game/Code/Screens/UScreenPartyNewRound.pas +++ b/Game/Code/Screens/UScreenPartyNewRound.pas @@ -104,13 +104,7 @@ begin end; end; end; - end - else // Key Up - case PressedKey of - SDLK_RETURN : - begin - end; - end; + end; end; constructor TScreenPartyNewRound.Create; diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas index f0df9871..7f3b1209 100644 --- a/Game/Code/Screens/UScreenPartyOptions.pas +++ b/Game/Code/Screens/UScreenPartyOptions.pas @@ -139,13 +139,7 @@ begin end; end; end; - end - else // Key Up - case PressedKey of - SDLK_RETURN : - begin - end; - end; + end; end; constructor TScreenPartyOptions.Create; diff --git a/Game/Code/Screens/UScreenPopup.pas b/Game/Code/Screens/UScreenPopup.pas index 019632ff..9b71eb9a 100644 --- a/Game/Code/Screens/UScreenPopup.pas +++ b/Game/Code/Screens/UScreenPopup.pas @@ -42,36 +42,6 @@ implementation uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UPlaylist, UDisplay; function TScreenPopupCheck.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; - function IsVisible: Boolean; - begin - Result := True; - if (Interactions[Interaction].Typ = 0) then - begin - Result := Button[Interactions[Interaction].Num].Visible; - end - else if (Interactions[Interaction].Typ = 1) then - begin - //Result := Selects[Interactions[Interaction].Num].Visible; - end - else if (Interactions[Interaction].Typ = 3) then - begin - Result := SelectsS[Interactions[Interaction].Num].Visible; - end; - end; - - Procedure SelectNext; - begin - repeat - InteractNext; - until IsVisible; - end; - - Procedure SelectPrev; - begin - repeat - InteractPrev; - until IsVisible; - end; begin Result := true; If (PressedDown) Then @@ -95,6 +65,15 @@ begin begin case Interaction of 0: begin + //Hack to Finish Singscreen correct on Exit with Q Shortcut + if (Display.NextScreenWithCheck = NIL) then + begin + if (Display.ActualScreen = @ScreenSing) then + ScreenSing.Finish + else if (Display.ActualScreen = @ScreenSingModi) then + ScreenSingModi.Finish; + end; + Display.CheckOK:=True; end; 1: begin @@ -106,19 +85,13 @@ begin Result := false; end; - SDLK_DOWN: SelectNext; - SDLK_UP: SelectPrev; + SDLK_DOWN: InteractNext; + SDLK_UP: InteractPrev; - SDLK_RIGHT: SelectNext; - SDLK_LEFT: SelectPrev; - end; - end - else // Key Up - case PressedKey of - SDLK_RETURN : - begin - end; + SDLK_RIGHT: InteractNext; + SDLK_LEFT: InteractPrev; end; + end; end; constructor TScreenPopupCheck.Create; @@ -175,36 +148,6 @@ end; // error popup function TScreenPopupError.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; - function IsVisible: Boolean; - begin - Result := True; - if (Interactions[Interaction].Typ = 0) then - begin - Result := Button[Interactions[Interaction].Num].Visible; - end - else if (Interactions[Interaction].Typ = 1) then - begin - //Result := Selects[Interactions[Interaction].Num].Visible; - end - else if (Interactions[Interaction].Typ = 3) then - begin - Result := SelectsS[Interactions[Interaction].Num].Visible; - end; - end; - - Procedure SelectNext; - begin - repeat - InteractNext; - until IsVisible; - end; - - Procedure SelectPrev; - begin - repeat - InteractPrev; - until IsVisible; - end; begin Result := true; If (PressedDown) Then @@ -228,19 +171,13 @@ begin Result := false; end; - SDLK_DOWN: SelectNext; - SDLK_UP: SelectPrev; + SDLK_DOWN: InteractNext; + SDLK_UP: InteractPrev; - SDLK_RIGHT: SelectNext; - SDLK_LEFT: SelectPrev; - end; - end - else // Key Up - case PressedKey of - SDLK_RETURN : - begin - end; + SDLK_RIGHT: InteractNext; + SDLK_LEFT: InteractPrev; end; + end; end; constructor TScreenPopupError.Create; diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 3e66b197..6985672f 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -92,6 +92,17 @@ begin If (PressedDown) Then begin // Key Down case PressedKey of + SDLK_Q: + begin + //When not ask before Exit then Finish now + if (Ini.AskbeforeDel <> 1) then + Finish + //else just Pause and let the Popup make the Work + else if not paused then + Pause; + + Result := false; + end; SDLK_ESCAPE : begin //Record Sound Hack: @@ -102,12 +113,6 @@ begin FadeTo(@ScreenScore); end; - SDLK_Q: - begin - Finish; - Result := false; - end; - SDLK_P://Pause Mod begin Pause; @@ -127,13 +132,7 @@ begin begin end; end; - end - else // Key Up - case PressedKey of - SDLK_RETURN : - begin - end; - end; + end; end; //Pause Mod diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index e4ab8854..139d6984 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -248,6 +248,10 @@ begin end; case PressedKey of + SDLK_Q: + begin + Result := false; + end; SDLK_ESCAPE : begin if (Mode = 0) then @@ -605,19 +609,8 @@ begin SetJoker; end; end; - - SDLK_Q: - begin - Result := false; - end; - end; - end - else // Key Up - case PressedKey of - SDLK_RETURN : - begin - end; end; + end; end; constructor TScreenSong.Create; diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas index b90c558b..44c12f51 100644 --- a/Game/Code/Screens/UScreenSongJumpto.pas +++ b/Game/Code/Screens/UScreenSongJumpto.pas @@ -139,13 +139,7 @@ begin end; end; end; - end - else // Key Up - case PressedKey of - SDLK_RETURN : - begin - end; - end; + end; end; constructor TScreenSongJumpto.Create; diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index fd875527..73b38a05 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -97,13 +97,7 @@ begin InteractDec; end; end; - end - else // Key Up - case PressedKey of - SDLK_RETURN : - begin - end; - end; + end; end; constructor TScreenSongMenu.Create; -- cgit v1.2.3