From b67552407373e14f7d27426c429ea6f4263d51eb Mon Sep 17 00:00:00 2001 From: AJ Kelly Date: Sun, 25 Sep 2011 23:31:11 -0500 Subject: [PATCH] eol crap? are you serious bro? --- src/ScreenOptions.h | 388 ++++++++++++++++++++++---------------------- 1 file changed, 194 insertions(+), 194 deletions(-) diff --git a/src/ScreenOptions.h b/src/ScreenOptions.h index b05c3918cf..784181a54e 100644 --- a/src/ScreenOptions.h +++ b/src/ScreenOptions.h @@ -1,194 +1,194 @@ -#ifndef SCREENOPTIONS_H -#define SCREENOPTIONS_H - -#include "ScreenWithMenuElements.h" -#include "DualScrollBar.h" -#include "ThemeMetric.h" -#include "OptionRow.h" -#include "OptionsCursor.h" -#include "LuaExpressionTransform.h" -#include "InputEventPlus.h" -#include "RageSound.h" - -class OptionRowHandler; - -AutoScreenMessage( SM_ExportOptions ); - -/** @brief The list of input modes for the given row. */ -enum InputMode -{ - INPUTMODE_INDIVIDUAL, /**< each player controls their own cursor */ - INPUTMODE_SHARE_CURSOR, /**< both players control the same cursor */ - NUM_InputMode, /**< The number of input modes available. */ - InputMode_Invalid -}; -InputMode StringToInputMode( const RString& str ); - -/** @brief A custom foreach loop for the player options for each player. */ -#define FOREACH_OptionsPlayer( pn ) \ - for( PlayerNumber pn=GetNextHumanPlayer((PlayerNumber)-1); \ - pn!=PLAYER_INVALID && (m_InputMode==INPUTMODE_INDIVIDUAL || pn==0); \ - pn=GetNextHumanPlayer(pn) ) - -/** @brief A grid of options; the selected option is drawn with a highlight rectangle. */ -class ScreenOptions : public ScreenWithMenuElements -{ -public: - ScreenOptions(); - virtual void Init(); - virtual void BeginScreen(); - void InitMenu( const vector &vHands ); - virtual ~ScreenOptions(); - virtual void Update( float fDeltaTime ); - virtual void Input( const InputEventPlus &input ); - virtual void HandleScreenMessage( const ScreenMessage SM ); - - virtual void TweenOnScreen(); - virtual void TweenOffScreen(); - - // Lua - virtual void PushSelf( lua_State *L ); - friend class LunaScreenOptions; - -protected: - virtual void ImportOptions( int iRow, const vector &vpns ) = 0; - virtual void ExportOptions( int iRow, const vector &vpns ) = 0; - - void RestartOptions(); - void GetWidthXY( PlayerNumber pn, int iRow, int iChoiceOnRow, - int &iWidthOut, int &iXOut, int &iYOut ) const; - RString GetExplanationText( int iRow ) const; - void RefreshIcons( int iRow, PlayerNumber pn ); - void PositionCursor( PlayerNumber pn ); - void PositionRows( bool bTween ); - void TweenCursor( PlayerNumber pn ); - void StoreFocus( PlayerNumber pn ); - - void BeginFadingOut(); - virtual bool FocusedItemEndsScreen( PlayerNumber pn ) const; - RString GetNextScreenForFocusedItem( PlayerNumber pn ) const; - - void ChangeValueInRowRelative( int iRow, PlayerNumber pn, int iDelta, bool bRepeat ); - void ChangeValueInRowAbsolute( int iRow, PlayerNumber pn, int iChoiceIndex, bool bRepeat ); - /** - * @brief Perform an action after a row has changed its value. - * - * Override this to detect when the value in a row has changed. */ - virtual void AfterChangeValueInRow( int iRow, PlayerNumber pn ); - bool MoveRowRelative( PlayerNumber pn, int iDir, bool bRepeat ); - bool MoveRowAbsolute( PlayerNumber pn, int iRow ); - /** - * @brief Perform an action after moving to a new row. - * - * Override this to detect when the row has changed. */ - virtual void AfterChangeRow( PlayerNumber pn ); - virtual void AfterChangeValueOrRow( PlayerNumber pn ); - - virtual void MenuBack( const InputEventPlus &input ); - virtual void MenuStart( const InputEventPlus &input ); - virtual void ProcessMenuStart( const InputEventPlus &input ); - virtual void MenuLeft( const InputEventPlus &input ); - virtual void MenuRight( const InputEventPlus &input ); - virtual void MenuUp( const InputEventPlus &input ); - virtual void MenuDown( const InputEventPlus &input ); - virtual void MenuSelect( const InputEventPlus &input ); - virtual void MenuUpDown( const InputEventPlus &input, int iDir ); // iDir == -1 or iDir == +1 - - int GetCurrentRow( PlayerNumber pn = PLAYER_1 ) const { return m_iCurrentRow[pn]; } - bool AllAreOnLastRow() const; - OptionRow* GetRow( int iRow ) const { return m_pRows[iRow]; } - //void SetOptionRowFromName( const RString& nombre ); - -protected: // derived classes need access to these - enum Navigation { NAV_THREE_KEY, NAV_THREE_KEY_MENU, NAV_THREE_KEY_ALT, NAV_FIVE_KEY, NAV_TOGGLE_THREE_KEY, NAV_TOGGLE_FIVE_KEY }; - void SetNavigation( Navigation nav ) { m_OptionsNavigation = nav; } - void SetInputMode( InputMode im ) { m_InputMode = im; } - - /** @brief Map menu lines to m_OptionRow entries. */ - vector m_pRows; - /** @brief The current row each player is on. */ - int m_iCurrentRow[NUM_PLAYERS]; - - OptionRowType m_OptionRowTypeNormal; - OptionRowType m_OptionRowTypeExit; - - Navigation m_OptionsNavigation; - InputMode m_InputMode; - - int m_iFocusX[NUM_PLAYERS]; - bool m_bWasOnExit[NUM_PLAYERS]; - - /** @brief True if at least one player pressed Start after selecting the song. - * - * TRICKY: People hold Start to get to PlayerOptions, then the repeat events - * cause them to zip to the bottom. So, ignore Start repeat events until - * we've seen one first pressed event. */ - bool m_bGotAtLeastOneStartPressed[NUM_PLAYERS]; - - // actors - ActorFrame m_frameContainer; - AutoActor m_sprPage; - - OptionsCursor m_Cursor[NUM_PLAYERS]; - AutoActor m_sprLineHighlight[NUM_PLAYERS]; - - BitmapText m_textExplanation[NUM_PLAYERS]; - BitmapText m_textExplanationTogether; - DualScrollBar m_ScrollBar; - AutoActor m_sprMore; - - RageSound m_SoundChangeCol; - RageSound m_SoundNextRow; - RageSound m_SoundPrevRow; - RageSound m_SoundToggleOn; - RageSound m_SoundToggleOff; - - // metrics - ThemeMetric NUM_ROWS_SHOWN; - ThemeMetric ROW_INIT_COMMAND; - ThemeMetric ROW_ON_COMMAND; - ThemeMetric ROW_OFF_COMMAND; - LuaExpressionTransform m_exprRowPositionTransformFunction; // params: self,offsetFromCenter,itemIndex,numItems - ThemeMetric SHOW_SCROLL_BAR; - ThemeMetric SCROLL_BAR_HEIGHT; - ThemeMetric SCROLL_BAR_TIME; - ThemeMetric LINE_HIGHLIGHT_X; - ThemeMetric SHOW_EXIT_ROW; - ThemeMetric SEPARATE_EXIT_ROW; - ThemeMetric SEPARATE_EXIT_ROW_Y; - ThemeMetric SHOW_EXPLANATIONS; - ThemeMetric ALLOW_REPEATING_CHANGE_VALUE_INPUT; - ThemeMetric CURSOR_TWEEN_SECONDS; - ThemeMetric WRAP_VALUE_IN_ROW; - ThemeMetric OPTION_ROW_NORMAL_METRICS_GROUP; - ThemeMetric OPTION_ROW_EXIT_METRICS_GROUP; -}; - -#endif - -/** - * @file - * @author Chris Danford, Glenn Maynard (c) 2001-2004 - * @section LICENSE - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +#ifndef SCREENOPTIONS_H +#define SCREENOPTIONS_H + +#include "ScreenWithMenuElements.h" +#include "DualScrollBar.h" +#include "ThemeMetric.h" +#include "OptionRow.h" +#include "OptionsCursor.h" +#include "LuaExpressionTransform.h" +#include "InputEventPlus.h" +#include "RageSound.h" + +class OptionRowHandler; + +AutoScreenMessage( SM_ExportOptions ); + +/** @brief The list of input modes for the given row. */ +enum InputMode +{ + INPUTMODE_INDIVIDUAL, /**< each player controls their own cursor */ + INPUTMODE_SHARE_CURSOR, /**< both players control the same cursor */ + NUM_InputMode, /**< The number of input modes available. */ + InputMode_Invalid +}; +InputMode StringToInputMode( const RString& str ); + +/** @brief A custom foreach loop for the player options for each player. */ +#define FOREACH_OptionsPlayer( pn ) \ + for( PlayerNumber pn=GetNextHumanPlayer((PlayerNumber)-1); \ + pn!=PLAYER_INVALID && (m_InputMode==INPUTMODE_INDIVIDUAL || pn==0); \ + pn=GetNextHumanPlayer(pn) ) + +/** @brief A grid of options; the selected option is drawn with a highlight rectangle. */ +class ScreenOptions : public ScreenWithMenuElements +{ +public: + ScreenOptions(); + virtual void Init(); + virtual void BeginScreen(); + void InitMenu( const vector &vHands ); + virtual ~ScreenOptions(); + virtual void Update( float fDeltaTime ); + virtual void Input( const InputEventPlus &input ); + virtual void HandleScreenMessage( const ScreenMessage SM ); + + virtual void TweenOnScreen(); + virtual void TweenOffScreen(); + + // Lua + virtual void PushSelf( lua_State *L ); + friend class LunaScreenOptions; + +protected: + virtual void ImportOptions( int iRow, const vector &vpns ) = 0; + virtual void ExportOptions( int iRow, const vector &vpns ) = 0; + + void RestartOptions(); + void GetWidthXY( PlayerNumber pn, int iRow, int iChoiceOnRow, + int &iWidthOut, int &iXOut, int &iYOut ) const; + RString GetExplanationText( int iRow ) const; + void RefreshIcons( int iRow, PlayerNumber pn ); + void PositionCursor( PlayerNumber pn ); + void PositionRows( bool bTween ); + void TweenCursor( PlayerNumber pn ); + void StoreFocus( PlayerNumber pn ); + + void BeginFadingOut(); + virtual bool FocusedItemEndsScreen( PlayerNumber pn ) const; + RString GetNextScreenForFocusedItem( PlayerNumber pn ) const; + + void ChangeValueInRowRelative( int iRow, PlayerNumber pn, int iDelta, bool bRepeat ); + void ChangeValueInRowAbsolute( int iRow, PlayerNumber pn, int iChoiceIndex, bool bRepeat ); + /** + * @brief Perform an action after a row has changed its value. + * + * Override this to detect when the value in a row has changed. */ + virtual void AfterChangeValueInRow( int iRow, PlayerNumber pn ); + bool MoveRowRelative( PlayerNumber pn, int iDir, bool bRepeat ); + bool MoveRowAbsolute( PlayerNumber pn, int iRow ); + /** + * @brief Perform an action after moving to a new row. + * + * Override this to detect when the row has changed. */ + virtual void AfterChangeRow( PlayerNumber pn ); + virtual void AfterChangeValueOrRow( PlayerNumber pn ); + + virtual void MenuBack( const InputEventPlus &input ); + virtual void MenuStart( const InputEventPlus &input ); + virtual void ProcessMenuStart( const InputEventPlus &input ); + virtual void MenuLeft( const InputEventPlus &input ); + virtual void MenuRight( const InputEventPlus &input ); + virtual void MenuUp( const InputEventPlus &input ); + virtual void MenuDown( const InputEventPlus &input ); + virtual void MenuSelect( const InputEventPlus &input ); + virtual void MenuUpDown( const InputEventPlus &input, int iDir ); // iDir == -1 or iDir == +1 + + int GetCurrentRow( PlayerNumber pn = PLAYER_1 ) const { return m_iCurrentRow[pn]; } + bool AllAreOnLastRow() const; + OptionRow* GetRow( int iRow ) const { return m_pRows[iRow]; } + //void SetOptionRowFromName( const RString& nombre ); + +protected: // derived classes need access to these + enum Navigation { NAV_THREE_KEY, NAV_THREE_KEY_MENU, NAV_THREE_KEY_ALT, NAV_FIVE_KEY, NAV_TOGGLE_THREE_KEY, NAV_TOGGLE_FIVE_KEY }; + void SetNavigation( Navigation nav ) { m_OptionsNavigation = nav; } + void SetInputMode( InputMode im ) { m_InputMode = im; } + + /** @brief Map menu lines to m_OptionRow entries. */ + vector m_pRows; + /** @brief The current row each player is on. */ + int m_iCurrentRow[NUM_PLAYERS]; + + OptionRowType m_OptionRowTypeNormal; + OptionRowType m_OptionRowTypeExit; + + Navigation m_OptionsNavigation; + InputMode m_InputMode; + + int m_iFocusX[NUM_PLAYERS]; + bool m_bWasOnExit[NUM_PLAYERS]; + + /** @brief True if at least one player pressed Start after selecting the song. + * + * TRICKY: People hold Start to get to PlayerOptions, then the repeat events + * cause them to zip to the bottom. So, ignore Start repeat events until + * we've seen one first pressed event. */ + bool m_bGotAtLeastOneStartPressed[NUM_PLAYERS]; + + // actors + ActorFrame m_frameContainer; + AutoActor m_sprPage; + + OptionsCursor m_Cursor[NUM_PLAYERS]; + AutoActor m_sprLineHighlight[NUM_PLAYERS]; + + BitmapText m_textExplanation[NUM_PLAYERS]; + BitmapText m_textExplanationTogether; + DualScrollBar m_ScrollBar; + AutoActor m_sprMore; + + RageSound m_SoundChangeCol; + RageSound m_SoundNextRow; + RageSound m_SoundPrevRow; + RageSound m_SoundToggleOn; + RageSound m_SoundToggleOff; + + // metrics + ThemeMetric NUM_ROWS_SHOWN; + ThemeMetric ROW_INIT_COMMAND; + ThemeMetric ROW_ON_COMMAND; + ThemeMetric ROW_OFF_COMMAND; + LuaExpressionTransform m_exprRowPositionTransformFunction; // params: self,offsetFromCenter,itemIndex,numItems + ThemeMetric SHOW_SCROLL_BAR; + ThemeMetric SCROLL_BAR_HEIGHT; + ThemeMetric SCROLL_BAR_TIME; + ThemeMetric LINE_HIGHLIGHT_X; + ThemeMetric SHOW_EXIT_ROW; + ThemeMetric SEPARATE_EXIT_ROW; + ThemeMetric SEPARATE_EXIT_ROW_Y; + ThemeMetric SHOW_EXPLANATIONS; + ThemeMetric ALLOW_REPEATING_CHANGE_VALUE_INPUT; + ThemeMetric CURSOR_TWEEN_SECONDS; + ThemeMetric WRAP_VALUE_IN_ROW; + ThemeMetric OPTION_ROW_NORMAL_METRICS_GROUP; + ThemeMetric OPTION_ROW_EXIT_METRICS_GROUP; +}; + +#endif + +/** + * @file + * @author Chris Danford, Glenn Maynard (c) 2001-2004 + * @section LICENSE + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */