From dde3a51349fc2eb52a9535ffcdb463477d4b41d5 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sun, 27 Apr 2008 21:35:20 +0000 Subject: [PATCH] OptionIcon -> ModIcon to reduce confusion between OptionRow, OptionIconRow --- stepmania/src/OptionIcon.cpp | 88 -------------- stepmania/src/OptionIcon.h | 50 -------- stepmania/src/OptionIconRow.cpp | 209 -------------------------------- stepmania/src/OptionIconRow.h | 68 ----------- 4 files changed, 415 deletions(-) delete mode 100644 stepmania/src/OptionIcon.cpp delete mode 100644 stepmania/src/OptionIcon.h delete mode 100644 stepmania/src/OptionIconRow.cpp delete mode 100644 stepmania/src/OptionIconRow.h diff --git a/stepmania/src/OptionIcon.cpp b/stepmania/src/OptionIcon.cpp deleted file mode 100644 index a97371cf2d..0000000000 --- a/stepmania/src/OptionIcon.cpp +++ /dev/null @@ -1,88 +0,0 @@ -#include "global.h" -#include "ModIcon.h" -#include "ThemeManager.h" -#include "PlayerOptions.h" -#include "RageUtil.h" -#include "ActorUtil.h" - -ModIcon::ModIcon() -{ -} - -ModIcon::ModIcon( const ModIcon &cpy ): - ActorFrame(cpy), - m_sprFilled(cpy.m_sprFilled), - m_sprEmpty(cpy.m_sprEmpty), - m_text(cpy.m_text) -{ - this->RemoveAllChildren(); - this->AddChild( m_sprFilled ); - this->AddChild( m_sprEmpty ); - this->AddChild( &m_text ); -} - -void ModIcon::Load( RString sMetricsGroup ) -{ - m_sprFilled.Load( THEME->GetPathG(sMetricsGroup,"Filled") ); - this->AddChild( m_sprFilled ); - - m_sprEmpty.Load( THEME->GetPathG(sMetricsGroup,"Empty") ); - this->AddChild( m_sprEmpty ); - - m_text.LoadFromFont( THEME->GetPathF(sMetricsGroup,"Text") ); - m_text.SetName( "Text" ); - ActorUtil::SetXYAndOnCommand( m_text, sMetricsGroup ); - this->AddChild( &m_text ); - - Set(""); -} - -void ModIcon::Set( const RString &_sText ) -{ - RString sText = _sText; - - static const RString sStopWords[] = - { - "1X", - "DEFAULT", - "OVERHEAD", - "OFF", - }; - - for( unsigned i=0; iSetVisible( !bVacant ); - m_sprEmpty->SetVisible( bVacant ); - - m_text.SetText( sText ); -} - -/* - * (c) 2002-2004 Chris Danford - * 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. - */ diff --git a/stepmania/src/OptionIcon.h b/stepmania/src/OptionIcon.h deleted file mode 100644 index 6032a75246..0000000000 --- a/stepmania/src/OptionIcon.h +++ /dev/null @@ -1,50 +0,0 @@ -/* ModIcon - Shows PlayerOptions and SongOptions in icon form. */ - -#ifndef OPTION_ICON_H -#define OPTION_ICON_H - -#include "ActorFrame.h" -#include "AutoActor.h" -#include "BitmapText.h" -#include "PlayerNumber.h" - -class ModIcon : public ActorFrame -{ -public: - ModIcon(); - ModIcon( const ModIcon &cpy ); - void Load( RString sMetricsGroup ); - void Set( const RString &sText ); - -protected: - BitmapText m_text; - AutoActor m_sprFilled; - AutoActor m_sprEmpty; -}; - -#endif - -/* - * (c) 2002-2004 Chris Danford - * 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. - */ diff --git a/stepmania/src/OptionIconRow.cpp b/stepmania/src/OptionIconRow.cpp deleted file mode 100644 index 14fbe44129..0000000000 --- a/stepmania/src/OptionIconRow.cpp +++ /dev/null @@ -1,209 +0,0 @@ -#include "global.h" -#include "ModIconRow.h" -#include "ThemeManager.h" -#include "PlayerOptions.h" -#include "GameState.h" -#include "RageLog.h" -#include "PlayerState.h" -#include "ActorUtil.h" -#include "XmlFile.h" -#include "LuaManager.h" -#include "Foreach.h" - -REGISTER_ACTOR_CLASS( ModIconRow ) - -ModIconRow::ModIconRow() -{ - m_pn = PlayerNumber_Invalid; - - this->SubscribeToMessage( "PlayerOptionsChanged" ); -} - -ModIconRow::~ModIconRow() -{ - FOREACH( ModIcon*, m_vpModIcon, p ) - { - SAFE_DELETE( *p ); - } - this->RemoveAllChildren(); -} - -void ModIconRow::Load( const RString &sMetricsGroup, PlayerNumber pn ) -{ - ASSERT_M( m_pn == PlayerNumber_Invalid, "Multiple calls to Load" ); - - m_sMetricsGroup = sMetricsGroup; - m_pn = pn; - - SPACING_X.Load(sMetricsGroup,"SpacingX"); - SPACING_Y.Load(sMetricsGroup,"SpacingY"); - NUM_OPTION_ICONS.Load(sMetricsGroup,"NumModIcons"); - OPTION_ICON_METRICS_GROUP.Load(sMetricsGroup,"ModIconMetricsGroup"); - - for( int i=0; iSetName( "ModIcon" ); - p->SetXY( i*SPACING_X, i*SPACING_Y ); - p->Load( OPTION_ICON_METRICS_GROUP ); - ActorUtil::LoadAllCommands( p, sMetricsGroup ); - m_vpModIcon.push_back( p ); - this->AddChild( p ); - } - - SetFromGameState(); -} - -void ModIconRow::HandleMessage( const Message &msg ) -{ - if( msg.GetName() == "PlayerOptionsChanged" ) - SetFromGameState(); - - ActorFrame::HandleMessage( msg ); -} - - -struct OptionColumnEntry -{ - char szString[30]; - int iSlotIndex; -}; - -static const OptionColumnEntry g_OptionColumnEntries[] = -{ - {"Boost", 0}, - {"Brake", 0}, - {"Wave", 0}, - {"Expand", 0}, - {"Boomerang", 0}, - {"Drunk", 1}, - {"Dizzy", 1}, - {"Mini", 1}, - {"Flip", 1}, - {"Tornado", 1}, - {"Hidden", 2}, - {"Sudden", 2}, - {"Stealth", 2}, - {"Blink", 2}, - {"RandomVanish", 2}, - {"Mirror", 3}, - {"Left", 3}, - {"Right", 3}, - {"Shuffle", 3}, - {"SuperShuffle", 3}, - {"Little", 4}, - {"NoHolds", 4}, - {"Dark", 4}, - {"Blind", 4}, - {"Reverse", 5}, - {"Split", 5}, - {"Alternate", 5}, - {"Cross", 5}, - {"Centered", 5}, - {"Incoming", 6}, - {"Space", 6}, - {"Hallway", 6}, - {"Distant", 6}, -}; - -int OptionToPreferredColumn( RString sOptionText ) -{ - /* Speedups always go in column 0. digit ... x */ - if( sOptionText.size() > 1 && - isdigit(sOptionText[0]) && - tolower(sOptionText[sOptionText.size()-1]) == 'x' ) - { - return 0; - } - - for( unsigned i=0; iWarn("Unknown option: '%s'", sOptionText.c_str() ); - return 0; -} - -void ModIconRow::SetFromGameState() -{ - PlayerNumber pn = m_pn; - - RString sOptions = GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.GetStage().GetString(); - vector vsOptions; - split( sOptions, ", ", vsOptions, true ); - - vector vsText; // fill these with what will be displayed on the tabs - vsText.resize( m_vpModIcon.size() ); - - // for each option, look for the best column to place it in - for( unsigned i=0; iSet( vsText[i] ); -} - -// lua start -#include "LuaBinding.h" - -class LunaModIconRow: public Luna -{ -public: - static int Load( T* p, lua_State *L ) { p->Load( SArg(1), Enum::Check(L, 2) ); return 0; } - - LunaModIconRow() - { - ADD_METHOD( Load ); - } -}; - -LUA_REGISTER_DERIVED_CLASS( ModIconRow, ActorFrame ) - -// lua end - -/* - * (c) 2002-2004 Chris Danford - * 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. - */ diff --git a/stepmania/src/OptionIconRow.h b/stepmania/src/OptionIconRow.h deleted file mode 100644 index 4fe4ec47c6..0000000000 --- a/stepmania/src/OptionIconRow.h +++ /dev/null @@ -1,68 +0,0 @@ -/* ModIconRow - Shows PlayerOptions and SongOptions in icon form. */ - -#ifndef OPTION_ICON_ROW_H -#define OPTION_ICON_ROW_H - - -#include "ActorFrame.h" -#include "ModIcon.h" -#include "ThemeMetric.h" -class PlayerOptions; -struct lua_State; - -class ModIconRow : public ActorFrame -{ -public: - ModIconRow(); - ~ModIconRow(); - - void Load( const RString &sMetricsGroup, PlayerNumber pn ); - - virtual ModIconRow *Copy() const; - void SetFromGameState(); - - virtual void HandleMessage( const Message &msg ); - - // - // Commands - // - virtual void PushSelf( lua_State *L ); - -protected: - RString m_sMetricsGroup; - PlayerNumber m_pn; - - ThemeMetric SPACING_X; - ThemeMetric SPACING_Y; - ThemeMetric NUM_OPTION_ICONS; - ThemeMetric OPTION_ICON_METRICS_GROUP; - - vector m_vpModIcon; -}; - -#endif - -/* - * (c) 2002-2004 Chris Danford - * 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. - */