OptionIcon -> ModIcon to reduce confusion between OptionRow, OptionIconRow

This commit is contained in:
Chris Danford
2008-04-27 21:31:56 +00:00
parent c8d8b8925d
commit 00c9ffcd67
18 changed files with 520 additions and 102 deletions
+2 -1
View File
@@ -320,8 +320,9 @@ GradeDisplay.cpp GradeDisplay.h GraphDisplay.cpp GraphDisplay.h \
GrooveRadar.cpp GrooveRadar.h GroupList.cpp GroupList.h HelpDisplay.cpp HelpDisplay.h \
MemoryCardDisplay.cpp MemoryCardDisplay.h \
MenuTimer.cpp MenuTimer.h MusicBannerWheel.cpp MusicBannerWheel.h \
ModIcon.cpp ModIcon.h ModIconRow.cpp ModIconRow.h \
MusicList.cpp MusicList.h MusicWheel.cpp MusicWheel.h \
MusicWheelItem.cpp MusicWheelItem.h OptionIcon.cpp OptionIcon.h OptionIconRow.cpp OptionIconRow.h \
MusicWheelItem.cpp MusicWheelItem.h \
OptionRow.cpp OptionRow.h OptionsCursor.cpp OptionsCursor.h \
PaneDisplay.cpp PaneDisplay.h ScrollBar.cpp ScrollBar.h \
ScrollingList.cpp ScrollingList.h SnapDisplay.cpp SnapDisplay.h \
+88
View File
@@ -0,0 +1,88 @@
#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::LoadAllCommandsAndSetXYAndOnCommand( 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; i<ARRAYLEN(sStopWords); i++ )
if( 0==stricmp(sText,sStopWords[i]) )
sText = "";
sText.Replace( " ", "\n" );
bool bVacant = (sText=="");
m_sprFilled->SetVisible( !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.
*/
+50
View File
@@ -0,0 +1,50 @@
/* ModIcon - Shows PlayerOptions and SongOptions in icon form. */
#ifndef ModIcon_H
#define ModIcon_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.
*/
+209
View File
@@ -0,0 +1,209 @@
#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; i<NUM_OPTION_ICONS; i++ )
{
ModIcon *p = new ModIcon;
p->SetName( "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; i<ARRAYLEN(g_OptionColumnEntries); i++ )
if( g_OptionColumnEntries[i].szString == sOptionText )
return g_OptionColumnEntries[i].iSlotIndex;
/* This warns about C1234 and noteskins. */
// LOG->Warn("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<RString> vsOptions;
split( sOptions, ", ", vsOptions, true );
vector<RString> 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; i<vsOptions.size(); i++ )
{
RString sOption = vsOptions[i];
int iPerferredCol = OptionToPreferredColumn( sOption );
clamp( iPerferredCol, 0, (int)m_vpModIcon.size()-1 );
if( iPerferredCol == -1 )
continue; // skip
// search for a vacant spot
for( int i=iPerferredCol; i<NUM_OPTION_ICONS; i++ )
{
if( vsText[i] != "" )
{
continue;
}
else
{
vsText[i] = sOption;
break;
}
}
}
for( unsigned i=0; i<vsOptions.size(); i++ )
m_vpModIcon[i]->Set( vsText[i] );
}
// lua start
#include "LuaBinding.h"
class LunaModIconRow: public Luna<ModIconRow>
{
public:
static int Load( T* p, lua_State *L ) { p->Load( SArg(1), Enum::Check<PlayerNumber>(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.
*/
+68
View File
@@ -0,0 +1,68 @@
/* ModIconRow - Shows PlayerOptions and SongOptions in icon form. */
#ifndef ModIconRow_H
#define ModIconRow_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<float> SPACING_X;
ThemeMetric<float> SPACING_Y;
ThemeMetric<int> NUM_OPTION_ICONS;
ThemeMetric<RString> OPTION_ICON_METRICS_GROUP;
vector<ModIcon*> 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.
*/
+5 -5
View File
@@ -1,15 +1,15 @@
#include "global.h"
#include "OptionIcon.h"
#include "ModIcon.h"
#include "ThemeManager.h"
#include "PlayerOptions.h"
#include "RageUtil.h"
#include "ActorUtil.h"
OptionIcon::OptionIcon()
ModIcon::ModIcon()
{
}
OptionIcon::OptionIcon( const OptionIcon &cpy ):
ModIcon::ModIcon( const ModIcon &cpy ):
ActorFrame(cpy),
m_sprFilled(cpy.m_sprFilled),
m_sprEmpty(cpy.m_sprEmpty),
@@ -21,7 +21,7 @@ OptionIcon::OptionIcon( const OptionIcon &cpy ):
this->AddChild( &m_text );
}
void OptionIcon::Load( RString sMetricsGroup )
void ModIcon::Load( RString sMetricsGroup )
{
m_sprFilled.Load( THEME->GetPathG(sMetricsGroup,"Filled") );
this->AddChild( m_sprFilled );
@@ -37,7 +37,7 @@ void OptionIcon::Load( RString sMetricsGroup )
Set("");
}
void OptionIcon::Set( const RString &_sText )
void ModIcon::Set( const RString &_sText )
{
RString sText = _sText;
+4 -4
View File
@@ -1,4 +1,4 @@
/* OptionIcon - Shows PlayerOptions and SongOptions in icon form. */
/* ModIcon - Shows PlayerOptions and SongOptions in icon form. */
#ifndef OPTION_ICON_H
#define OPTION_ICON_H
@@ -8,11 +8,11 @@
#include "BitmapText.h"
#include "PlayerNumber.h"
class OptionIcon : public ActorFrame
class ModIcon : public ActorFrame
{
public:
OptionIcon();
OptionIcon( const OptionIcon &cpy );
ModIcon();
ModIcon( const ModIcon &cpy );
void Load( RString sMetricsGroup );
void Set( const RString &sText );
+19 -19
View File
@@ -1,5 +1,5 @@
#include "global.h"
#include "OptionIconRow.h"
#include "ModIconRow.h"
#include "ThemeManager.h"
#include "PlayerOptions.h"
#include "GameState.h"
@@ -10,25 +10,25 @@
#include "LuaManager.h"
#include "Foreach.h"
REGISTER_ACTOR_CLASS( OptionIconRow )
REGISTER_ACTOR_CLASS( ModIconRow )
OptionIconRow::OptionIconRow()
ModIconRow::ModIconRow()
{
m_pn = PlayerNumber_Invalid;
this->SubscribeToMessage( "PlayerOptionsChanged" );
}
OptionIconRow::~OptionIconRow()
ModIconRow::~ModIconRow()
{
FOREACH( OptionIcon*, m_vpOptionIcon, p )
FOREACH( ModIcon*, m_vpModIcon, p )
{
SAFE_DELETE( *p );
}
this->RemoveAllChildren();
}
void OptionIconRow::Load( const RString &sMetricsGroup, PlayerNumber pn )
void ModIconRow::Load( const RString &sMetricsGroup, PlayerNumber pn )
{
ASSERT_M( m_pn == PlayerNumber_Invalid, "Multiple calls to Load" );
@@ -37,24 +37,24 @@ void OptionIconRow::Load( const RString &sMetricsGroup, PlayerNumber pn )
SPACING_X.Load(sMetricsGroup,"SpacingX");
SPACING_Y.Load(sMetricsGroup,"SpacingY");
NUM_OPTION_ICONS.Load(sMetricsGroup,"NumOptionIcons");
OPTION_ICON_METRICS_GROUP.Load(sMetricsGroup,"OptionIconMetricsGroup");
NUM_OPTION_ICONS.Load(sMetricsGroup,"NumModIcons");
OPTION_ICON_METRICS_GROUP.Load(sMetricsGroup,"ModIconMetricsGroup");
for( int i=0; i<NUM_OPTION_ICONS; i++ )
{
OptionIcon *p = new OptionIcon;
p->SetName( "OptionIcon" );
ModIcon *p = new ModIcon;
p->SetName( "ModIcon" );
p->SetXY( i*SPACING_X, i*SPACING_Y );
p->Load( OPTION_ICON_METRICS_GROUP );
ActorUtil::LoadAllCommands( p, sMetricsGroup );
m_vpOptionIcon.push_back( p );
m_vpModIcon.push_back( p );
this->AddChild( p );
}
SetFromGameState();
}
void OptionIconRow::HandleMessage( const Message &msg )
void ModIconRow::HandleMessage( const Message &msg )
{
if( msg.GetName() == "PlayerOptionsChanged" )
SetFromGameState();
@@ -125,7 +125,7 @@ int OptionToPreferredColumn( RString sOptionText )
return 0;
}
void OptionIconRow::SetFromGameState()
void ModIconRow::SetFromGameState()
{
PlayerNumber pn = m_pn;
@@ -134,14 +134,14 @@ void OptionIconRow::SetFromGameState()
split( sOptions, ", ", vsOptions, true );
vector<RString> vsText; // fill these with what will be displayed on the tabs
vsText.resize( m_vpOptionIcon.size() );
vsText.resize( m_vpModIcon.size() );
// for each option, look for the best column to place it in
for( unsigned i=0; i<vsOptions.size(); i++ )
{
RString sOption = vsOptions[i];
int iPerferredCol = OptionToPreferredColumn( sOption );
clamp( iPerferredCol, 0, (int)m_vpOptionIcon.size()-1 );
clamp( iPerferredCol, 0, (int)m_vpModIcon.size()-1 );
if( iPerferredCol == -1 )
continue; // skip
@@ -162,24 +162,24 @@ void OptionIconRow::SetFromGameState()
}
for( unsigned i=0; i<vsOptions.size(); i++ )
m_vpOptionIcon[i]->Set( vsText[i] );
m_vpModIcon[i]->Set( vsText[i] );
}
// lua start
#include "LuaBinding.h"
class LunaOptionIconRow: public Luna<OptionIconRow>
class LunaModIconRow: public Luna<ModIconRow>
{
public:
static int Load( T* p, lua_State *L ) { p->Load( SArg(1), Enum::Check<PlayerNumber>(L, 2) ); return 0; }
LunaOptionIconRow()
LunaModIconRow()
{
ADD_METHOD( Load );
}
};
LUA_REGISTER_DERIVED_CLASS( OptionIconRow, ActorFrame )
LUA_REGISTER_DERIVED_CLASS( ModIconRow, ActorFrame )
// lua end
+7 -7
View File
@@ -1,24 +1,24 @@
/* OptionIconRow - Shows PlayerOptions and SongOptions in icon form. */
/* ModIconRow - Shows PlayerOptions and SongOptions in icon form. */
#ifndef OPTION_ICON_ROW_H
#define OPTION_ICON_ROW_H
#include "ActorFrame.h"
#include "OptionIcon.h"
#include "ModIcon.h"
#include "ThemeMetric.h"
class PlayerOptions;
struct lua_State;
class OptionIconRow : public ActorFrame
class ModIconRow : public ActorFrame
{
public:
OptionIconRow();
~OptionIconRow();
ModIconRow();
~ModIconRow();
void Load( const RString &sMetricsGroup, PlayerNumber pn );
virtual OptionIconRow *Copy() const;
virtual ModIconRow *Copy() const;
void SetFromGameState();
virtual void HandleMessage( const Message &msg );
@@ -37,7 +37,7 @@ protected:
ThemeMetric<int> NUM_OPTION_ICONS;
ThemeMetric<RString> OPTION_ICON_METRICS_GROUP;
vector<OptionIcon*> m_vpOptionIcon;
vector<ModIcon*> m_vpModIcon;
};
#endif
+20 -20
View File
@@ -34,8 +34,8 @@ RString OptionRow::GetThemedItemText( int iChoice ) const
return s;
}
RString ITEMS_LONG_ROW_X_NAME( size_t p ) { return ssprintf("ItemsLongRowP%dX",int(p+1)); }
RString ICONS_X_NAME( size_t p ) { return ssprintf("IconsP%dX",int(p+1)); }
RString ITEMS_LONG_ROW_X_NAME( size_t p ) { return ssprintf("ItemsLongRowP%dX",int(p+1)); }
RString MOD_ICON_X_NAME( size_t p ) { return ssprintf("ModIconP%dX",int(p+1)); }
OptionRow::OptionRow( const OptionRowType *pSource )
{
@@ -43,7 +43,7 @@ OptionRow::OptionRow( const OptionRowType *pSource )
m_pHand = NULL;
m_textTitle = NULL;
ZERO( m_OptionIcons );
ZERO( m_ModIcons );
Clear();
this->AddChild( &m_Frame );
@@ -100,17 +100,17 @@ void OptionRowType::Load( const RString &sType, Actor *pParent )
ITEM_GAIN_FOCUS_COMMAND .Load(sType,"ItemGainFocusCommand");
ITEM_LOSE_FOCUS_COMMAND .Load(sType,"ItemLoseFocusCommand");
EXIT_HIDE_ITEM .Load(sType,"ExitHideItem");
ICONS_X .Load(sType,ICONS_X_NAME,NUM_PLAYERS);
ICONS_ON_COMMAND .Load(sType,"IconsOnCommand");
MOD_ICON_X .Load(sType,MOD_ICON_X_NAME,NUM_PLAYERS);
MOD_ICON_ON_COMMAND .Load(sType,"ModIconOnCommand");
COLOR_SELECTED .Load(sType,"ColorSelected");
COLOR_NOT_SELECTED .Load(sType,"ColorNotSelected");
COLOR_DISABLED .Load(sType,"ColorDisabled");
CAPITALIZE_ALL_OPTION_NAMES .Load(sType,"CapitalizeAllOptionNames");
TWEEN_SECONDS .Load(sType,"TweenSeconds");
SHOW_BPM_IN_SPEED_TITLE .Load(sType,"ShowBpmInSpeedTitle");
SHOW_OPTION_ICONS .Load(sType,"ShowOptionIcons");
SHOW_MOD_ICONS .Load(sType,"ShowModIcons");
SHOW_UNDERLINES .Load(sType,"ShowUnderlines");
OPTION_ICON_METRICS_GROUP .Load(sType,"OptionIconMetricsGroup");
MOD_ICON_METRICS_GROUP .Load(sType,"ModIconMetricsGroup");
m_textItem.LoadFromFont( THEME->GetPathF(sType,"item") );
if( SHOW_UNDERLINES )
@@ -121,8 +121,8 @@ void OptionRowType::Load( const RString &sType, Actor *pParent )
m_textTitle.LoadFromFont( THEME->GetPathF(sType,"title") );
m_sprFrameNormal.Load( ActorUtil::MakeActor( THEME->GetPathG(sType,"FrameNormal"), pParent ) );
m_sprFrameExit.Load( ActorUtil::MakeActor( THEME->GetPathG(sType,"FrameExit"), pParent ) );
if( SHOW_OPTION_ICONS )
m_OptionIcon.Load( OPTION_ICON_METRICS_GROUP );
if( SHOW_MOD_ICONS )
m_ModIcon.Load( MOD_ICON_METRICS_GROUP );
}
void OptionRow::LoadNormal( OptionRowHandler *pHand, bool bFirstItemGoesDown )
@@ -265,21 +265,21 @@ void OptionRow::InitText( RowType type )
m_sprFrame->SetDrawOrder(-1); // under title
m_Frame.AddChild( m_sprFrame );
if( m_pParentType->SHOW_OPTION_ICONS )
if( m_pParentType->SHOW_MOD_ICONS )
{
switch( m_RowType )
{
case RowType_Normal:
FOREACH_PlayerNumber( p )
{
m_OptionIcons[p] = new OptionIcon( m_pParentType->m_OptionIcon );
m_OptionIcons[p]->SetDrawOrder(-1); // under title
m_OptionIcons[p]->RunCommands( m_pParentType->ICONS_ON_COMMAND );
m_ModIcons[p] = new ModIcon( m_pParentType->m_ModIcon );
m_ModIcons[p]->SetDrawOrder(-1); // under title
m_ModIcons[p]->RunCommands( m_pParentType->MOD_ICON_ON_COMMAND );
m_Frame.AddChild( m_OptionIcons[p] );
m_Frame.AddChild( m_ModIcons[p] );
GameCommand gc;
SetOptionIcon( p, "", gc );
SetModIcon( p, "", gc );
}
break;
case RowType_Exit:
@@ -520,11 +520,11 @@ void OptionRow::PositionUnderlines( PlayerNumber pn )
void OptionRow::PositionIcons( PlayerNumber pn )
{
OptionIcon *pIcon = m_OptionIcons[pn];
ModIcon *pIcon = m_ModIcons[pn];
if( pIcon == NULL )
return;
pIcon->SetX( m_pParentType->ICONS_X.GetValue(pn) );
pIcon->SetX( m_pParentType->MOD_ICON_X.GetValue(pn) );
}
/* This is called when the focus changes, to update "long row" text. */
@@ -672,14 +672,14 @@ void OptionRow::Update( float fDeltaTime )
m_Frame.SetBaseAlpha( fAlpha );
}
void OptionRow::SetOptionIcon( PlayerNumber pn, const RString &sText, GameCommand &gc )
void OptionRow::SetModIcon( PlayerNumber pn, const RString &sText, GameCommand &gc )
{
// update row frame
Message msg( "Refresh" );
msg.SetParam( "GameCommand", &gc );
m_sprFrame->HandleMessage( msg );
if( m_OptionIcons[pn] != NULL )
m_OptionIcons[pn]->Set( sText );
if( m_ModIcons[pn] != NULL )
m_ModIcons[pn]->Set( sText );
}
const BitmapText &OptionRow::GetTextItemForRow( PlayerNumber pn, int iChoiceOnRow ) const
+21 -21
View File
@@ -6,7 +6,7 @@
#include "ActorFrame.h"
#include "BitmapText.h"
#include "OptionsCursor.h"
#include "OptionIcon.h"
#include "ModIcon.h"
#include "ThemeMetric.h"
#include "AutoActor.h"
@@ -27,7 +27,7 @@ private:
AutoActor m_sprFrameNormal;
AutoActor m_sprFrameExit;
BitmapText m_textTitle;
OptionIcon m_OptionIcon;
ModIcon m_ModIcon;
// metrics
ThemeMetric<float> FRAME_X;
@@ -46,17 +46,17 @@ private:
ThemeMetric<apActorCommands> ITEM_GAIN_FOCUS_COMMAND;
ThemeMetric<apActorCommands> ITEM_LOSE_FOCUS_COMMAND;
ThemeMetric<bool> EXIT_HIDE_ITEM;
ThemeMetric1D<float> ICONS_X;
ThemeMetric<apActorCommands> ICONS_ON_COMMAND;
ThemeMetric1D<float> MOD_ICON_X;
ThemeMetric<apActorCommands> MOD_ICON_ON_COMMAND;
ThemeMetric<RageColor> COLOR_SELECTED;
ThemeMetric<RageColor> COLOR_NOT_SELECTED;
ThemeMetric<RageColor> COLOR_DISABLED;
ThemeMetric<bool> CAPITALIZE_ALL_OPTION_NAMES;
ThemeMetric<float> TWEEN_SECONDS;
ThemeMetric<bool> SHOW_BPM_IN_SPEED_TITLE;
ThemeMetric<bool> SHOW_OPTION_ICONS;
ThemeMetric<bool> SHOW_MOD_ICONS;
ThemeMetric<bool> SHOW_UNDERLINES;
ThemeMetric<RString> OPTION_ICON_METRICS_GROUP;
ThemeMetric<RString> MOD_ICON_METRICS_GROUP;
friend class OptionRow;
};
@@ -72,7 +72,7 @@ public:
void LoadNormal( OptionRowHandler *pHand, bool bFirstItemGoesDown );
void LoadExit();
void SetOptionIcon( PlayerNumber pn, const RString &sText, GameCommand &gc );
void SetModIcon( PlayerNumber pn, const RString &sText, GameCommand &gc );
void ImportOptions( const vector<PlayerNumber> &vpns );
int ExportOptions( const vector<PlayerNumber> &vpns, bool bRowHasFocus[NUM_PLAYERS] );
@@ -132,26 +132,26 @@ public:
protected:
RString GetRowTitle() const;
const OptionRowType *m_pParentType;
RowType m_RowType;
OptionRowHandler* m_pHand;
const OptionRowType *m_pParentType;
RowType m_RowType;
OptionRowHandler* m_pHand;
ActorFrame m_Frame;
ActorFrame m_Frame;
vector<BitmapText *> m_textItems; // size depends on m_bRowIsLong and which players are joined
vector<OptionsCursor *> m_Underline[NUM_PLAYERS]; // size depends on m_bRowIsLong and which players are joined
vector<BitmapText *> m_textItems; // size depends on m_bRowIsLong and which players are joined
vector<OptionsCursor *> m_Underline[NUM_PLAYERS]; // size depends on m_bRowIsLong and which players are joined
Actor *m_sprFrame;
BitmapText *m_textTitle;
OptionIcon *m_OptionIcons[NUM_PLAYERS];
Actor *m_sprFrame;
BitmapText *m_textTitle;
ModIcon *m_ModIcons[NUM_PLAYERS];
bool m_bFirstItemGoesDown;
bool m_bRowHasFocus[NUM_PLAYERS];
bool m_bFirstItemGoesDown;
bool m_bRowHasFocus[NUM_PLAYERS];
int m_iChoiceInRowWithFocus[NUM_PLAYERS]; // this choice has input focus
int m_iChoiceInRowWithFocus[NUM_PLAYERS]; // this choice has input focus
// Only one will true at a time if m_pHand->m_Def.bMultiSelect
vector<bool> m_vbSelected[NUM_PLAYERS]; // size = m_pHand->m_Def.choices.size()
Actor::TweenState m_tsDestination; // this should approach m_tsDestination.
vector<bool> m_vbSelected[NUM_PLAYERS]; // size = m_pHand->m_Def.choices.size()
Actor::TweenState m_tsDestination; // this should approach m_tsDestination.
public:
void SetDestination( Actor::TweenState &ts, bool bTween );
+2
View File
@@ -1,3 +1,5 @@
/* OptionsList - A popup options list. */
#ifndef SCREEN_OPTIONS_LIST_H
#define SCREEN_OPTIONS_LIST_H
+7 -7
View File
@@ -89,11 +89,11 @@ void ScreenNetSelectMusic::Init()
FOREACH_EnabledPlayer( p )
{
m_OptionIconRow[p].SetName( ssprintf("OptionIconsP%d",p+1) );
m_OptionIconRow[p].Load( "OptionIconRowSelectMusic", p );
m_OptionIconRow[p].SetFromGameState();
LOAD_ALL_COMMANDS_AND_SET_XY_AND_ON_COMMAND( m_OptionIconRow[p] );
this->AddChild( &m_OptionIconRow[p] );
m_ModIconRow[p].SetName( ssprintf("ModIconsP%d",p+1) );
m_ModIconRow[p].Load( "ModIconRowSelectMusic", p );
m_ModIconRow[p].SetFromGameState();
LOAD_ALL_COMMANDS_AND_SET_XY_AND_ON_COMMAND( m_ModIconRow[p] );
this->AddChild( &m_ModIconRow[p] );
}
//Load SFX next
@@ -278,7 +278,7 @@ void ScreenNetSelectMusic::HandleScreenMessage( const ScreenMessage SM )
//Update changes
FOREACH_EnabledPlayer(p)
m_OptionIconRow[p].SetFromGameState();
m_ModIconRow[p].SetFromGameState();
}
else if( SM == SM_SongChanged )
{
@@ -454,7 +454,7 @@ void ScreenNetSelectMusic::TweenOffScreen()
{
OFF_COMMAND( m_DifficultyDisplays[pn] );
OFF_COMMAND( m_DifficultyIcon[pn] );
OFF_COMMAND( m_OptionIconRow[pn] );
OFF_COMMAND( m_ModIconRow[pn] );
}
OFF_COMMAND( m_MusicWheel );
+2 -2
View File
@@ -10,7 +10,7 @@
#include "Difficulty.h"
#include "DifficultyDisplay.h"
#include "MusicWheel.h"
#include "OptionIconRow.h"
#include "ModIconRow.h"
#include "BPMDisplay.h"
class ScreenNetSelectMusic : public ScreenNetSelectBase
@@ -74,7 +74,7 @@ private:
RageSound m_soundChangeSel;
BPMDisplay m_BPMDisplay;
OptionIconRow m_OptionIconRow[NUM_PLAYERS];
ModIconRow m_ModIconRow[NUM_PLAYERS];
Song * m_cSong;
+1 -1
View File
@@ -416,7 +416,7 @@ void ScreenOptions::RefreshIcons( int iRow, PlayerNumber pn )
if( def.m_bOneChoiceForAllPlayers )
sIcon = "";
m_pRows[iRow]->SetOptionIcon( pn, sIcon, gc );
m_pRows[iRow]->SetModIcon( pn, sIcon, gc );
}
void ScreenOptions::PositionCursor( PlayerNumber pn )
+2 -2
View File
@@ -7,7 +7,7 @@
#include "Sprite.h"
#include "RageSound.h"
#include "GameConstantsAndTypes.h"
#include "OptionIcon.h"
#include "ModIcon.h"
#include "Banner.h"
@@ -59,7 +59,7 @@ private:
Sprite m_sprCardArrows[NUM_PLAYERS];
Sprite m_sprAttackFrame[NUM_PLAYERS];
OptionIcon m_AttackIcons[NUM_PLAYERS][NUM_ATTACK_LEVELS][NUM_ATTACKS_PER_LEVEL];
ModIcon m_AttackIcons[NUM_PLAYERS][NUM_ATTACK_LEVELS][NUM_ATTACKS_PER_LEVEL];
Sprite m_sprExplanation;
+1 -1
View File
@@ -37,7 +37,7 @@ static const char *SelectionStateNames[] = {
XToString( SelectionState );
const int NUM_SCORE_DIGITS = 9;
const int NUM_SCORE_DIGITS = 9;
#define SHOW_OPTIONS_MESSAGE_SECONDS THEME->GetMetricF( m_sName, "ShowOptionsMessageSeconds" )
+12 -12
View File
@@ -1430,6 +1430,18 @@ cl /Zl /nologo /c verstub.cpp /Fo&quot;$(IntDir)&quot;\
<File
RelativePath="MenuTimer.h">
</File>
<File
RelativePath=".\ModIcon.cpp">
</File>
<File
RelativePath=".\ModIcon.h">
</File>
<File
RelativePath=".\ModIconRow.cpp">
</File>
<File
RelativePath=".\ModIconRow.h">
</File>
<File
RelativePath="MusicBannerWheel.cpp">
</File>
@@ -1454,18 +1466,6 @@ cl /Zl /nologo /c verstub.cpp /Fo&quot;$(IntDir)&quot;\
<File
RelativePath="MusicWheelItem.h">
</File>
<File
RelativePath="OptionIcon.cpp">
</File>
<File
RelativePath="OptionIcon.h">
</File>
<File
RelativePath="OptionIconRow.cpp">
</File>
<File
RelativePath="OptionIconRow.h">
</File>
<File
RelativePath="OptionRow.cpp">
</File>