Woah, behind.

This commit is contained in:
Jason Felds
2011-12-21 15:28:30 -05:00
11 changed files with 93 additions and 79 deletions
+31 -31
View File
@@ -500,7 +500,7 @@ void MusicWheel::BuildWheelItemDatas( vector<MusicWheelItemData *> &arrayWheelIt
split( MODE_MENU_CHOICE_NAMES, ",", vsNames ); split( MODE_MENU_CHOICE_NAMES, ",", vsNames );
for( unsigned i=0; i<vsNames.size(); ++i ) for( unsigned i=0; i<vsNames.size(); ++i )
{ {
MusicWheelItemData wid( TYPE_SORT, NULL, "", NULL, SORT_MENU_COLOR, 0 ); MusicWheelItemData wid( WheelItemDataType_Sort, NULL, "", NULL, SORT_MENU_COLOR, 0 );
wid.m_pAction = HiddenPtr<GameCommand>( new GameCommand ); wid.m_pAction = HiddenPtr<GameCommand>( new GameCommand );
wid.m_pAction->m_sName = vsNames[i]; wid.m_pAction->m_sName = vsNames[i];
wid.m_pAction->Load( i, ParseCommands(CHOICE.GetValue(vsNames[i])) ); wid.m_pAction->Load( i, ParseCommands(CHOICE.GetValue(vsNames[i])) );
@@ -674,38 +674,38 @@ void MusicWheel::BuildWheelItemDatas( vector<MusicWheelItemData *> &arrayWheelIt
// In certain situations (e.g. simulating Pump it Up), themes may // In certain situations (e.g. simulating Pump it Up), themes may
// want to only show one group at a time. // want to only show one group at a time.
if( !HIDE_INACTIVE_SECTIONS ) if( !HIDE_INACTIVE_SECTIONS )
arrayWheelItemDatas.push_back( new MusicWheelItemData(TYPE_SECTION, NULL, sThisSection, NULL, colorSection, iSectionCount) ); arrayWheelItemDatas.push_back( new MusicWheelItemData(WheelItemDataType_Section, NULL, sThisSection, NULL, colorSection, iSectionCount) );
sLastSection = sThisSection; sLastSection = sThisSection;
} }
} }
arrayWheelItemDatas.push_back( new MusicWheelItemData(TYPE_SONG, pSong, sLastSection, NULL, SONGMAN->GetSongColor(pSong), 0) ); arrayWheelItemDatas.push_back( new MusicWheelItemData(WheelItemDataType_Song, pSong, sLastSection, NULL, SONGMAN->GetSongColor(pSong), 0) );
} }
if( so != SORT_ROULETTE ) if( so != SORT_ROULETTE )
{ {
// todo: allow themers to change the order of the items. -aj // todo: allow themers to change the order of the items. -aj
if( SHOW_ROULETTE ) if( SHOW_ROULETTE )
arrayWheelItemDatas.push_back( new MusicWheelItemData(TYPE_ROULETTE, NULL, "", NULL, ROULETTE_COLOR, 0) ); arrayWheelItemDatas.push_back( new MusicWheelItemData(WheelItemDataType_Roulette, NULL, "", NULL, ROULETTE_COLOR, 0) );
// Only add TYPE_RANDOM and TYPE_PORTAL if there's at least // Only add WheelItemDataType_Random and WheelItemDataType_Portal if there's at least
// one song on the list. // one song on the list.
bool bFoundAnySong = false; bool bFoundAnySong = false;
for( unsigned i=0; !bFoundAnySong && i < arrayWheelItemDatas.size(); i++ ) for( unsigned i=0; !bFoundAnySong && i < arrayWheelItemDatas.size(); i++ )
if( arrayWheelItemDatas[i]->m_Type == TYPE_SONG ) if( arrayWheelItemDatas[i]->m_Type == WheelItemDataType_Song )
bFoundAnySong = true; bFoundAnySong = true;
if( SHOW_RANDOM && bFoundAnySong ) if( SHOW_RANDOM && bFoundAnySong )
arrayWheelItemDatas.push_back( new MusicWheelItemData(TYPE_RANDOM, NULL, "", NULL, RANDOM_COLOR, 0) ); arrayWheelItemDatas.push_back( new MusicWheelItemData(WheelItemDataType_Random, NULL, "", NULL, RANDOM_COLOR, 0) );
if( SHOW_PORTAL && bFoundAnySong ) if( SHOW_PORTAL && bFoundAnySong )
arrayWheelItemDatas.push_back( new MusicWheelItemData(TYPE_PORTAL, NULL, "", NULL, PORTAL_COLOR, 0) ); arrayWheelItemDatas.push_back( new MusicWheelItemData(WheelItemDataType_Portal, NULL, "", NULL, PORTAL_COLOR, 0) );
// add custom wheel items // add custom wheel items
vector<RString> vsNames; vector<RString> vsNames;
split( CUSTOM_WHEEL_ITEM_NAMES, ",", vsNames ); split( CUSTOM_WHEEL_ITEM_NAMES, ",", vsNames );
for( unsigned i=0; i<vsNames.size(); ++i ) for( unsigned i=0; i<vsNames.size(); ++i )
{ {
MusicWheelItemData wid( TYPE_CUSTOM, NULL, "", NULL, CUSTOM_CHOICE_COLORS.GetValue(vsNames[i]), 0 ); MusicWheelItemData wid( WheelItemDataType_Custom, NULL, "", NULL, CUSTOM_CHOICE_COLORS.GetValue(vsNames[i]), 0 );
wid.m_pAction = HiddenPtr<GameCommand>( new GameCommand ); wid.m_pAction = HiddenPtr<GameCommand>( new GameCommand );
wid.m_pAction->m_sName = vsNames[i]; wid.m_pAction->m_sName = vsNames[i];
wid.m_pAction->Load( i, ParseCommands(CUSTOM_CHOICES.GetValue(vsNames[i])) ); wid.m_pAction->Load( i, ParseCommands(CUSTOM_CHOICES.GetValue(vsNames[i])) );
@@ -830,12 +830,12 @@ void MusicWheel::BuildWheelItemDatas( vector<MusicWheelItemData *> &arrayWheelIt
{ {
RageColor c = SECTION_COLORS.GetValue(iSectionColorIndex); RageColor c = SECTION_COLORS.GetValue(iSectionColorIndex);
iSectionColorIndex = (iSectionColorIndex+1) % NUM_SECTION_COLORS; iSectionColorIndex = (iSectionColorIndex+1) % NUM_SECTION_COLORS;
arrayWheelItemDatas.push_back( new MusicWheelItemData(TYPE_SECTION, NULL, sThisSection, NULL, c, 0) ); arrayWheelItemDatas.push_back( new MusicWheelItemData(WheelItemDataType_Section, NULL, sThisSection, NULL, c, 0) );
sLastSection = sThisSection; sLastSection = sThisSection;
} }
RageColor c = ( pCourse->m_sGroupName.size() == 0 ) ? pCourse->GetColor() : SONGMAN->GetCourseColor(pCourse); RageColor c = ( pCourse->m_sGroupName.size() == 0 ) ? pCourse->GetColor() : SONGMAN->GetCourseColor(pCourse);
arrayWheelItemDatas.push_back( new MusicWheelItemData(TYPE_COURSE, NULL, sThisSection, pCourse, c, 0) ); arrayWheelItemDatas.push_back( new MusicWheelItemData(WheelItemDataType_Course, NULL, sThisSection, pCourse, c, 0) );
} }
break; break;
} }
@@ -894,10 +894,10 @@ void MusicWheel::FilterWheelItemDatas(vector<MusicWheelItemData *> &aUnFilteredD
unsigned unfilteredSize=aUnFilteredDatas.size(); unsigned unfilteredSize=aUnFilteredDatas.size();
/* Only add TYPE_PORTAL if there's at least one song on the list. */ /* Only add WheelItemDataType_Portal if there's at least one song on the list. */
bool bFoundAnySong = false; bool bFoundAnySong = false;
for( unsigned i=0; i < unfilteredSize; i++ ) { for( unsigned i=0; i < unfilteredSize; i++ ) {
if( aUnFilteredDatas[i]->m_Type == TYPE_SONG ) { if( aUnFilteredDatas[i]->m_Type == WheelItemDataType_Song ) {
bFoundAnySong = true; bFoundAnySong = true;
break; break;
} }
@@ -922,7 +922,7 @@ void MusicWheel::FilterWheelItemDatas(vector<MusicWheelItemData *> &aUnFilteredD
MusicWheelItemData& WID = *aUnFilteredDatas[i]; MusicWheelItemData& WID = *aUnFilteredDatas[i];
/* If we have no songs, remove Random and Portal. */ /* If we have no songs, remove Random and Portal. */
if( WID.m_Type == TYPE_RANDOM || WID.m_Type == TYPE_PORTAL ) if( WID.m_Type == WheelItemDataType_Random || WID.m_Type == WheelItemDataType_Portal )
{ {
if( !bFoundAnySong ) if( !bFoundAnySong )
aiRemove[i] = true; aiRemove[i] = true;
@@ -930,7 +930,7 @@ void MusicWheel::FilterWheelItemDatas(vector<MusicWheelItemData *> &aUnFilteredD
} }
/* Filter songs that we don't have enough stages to play. */ /* Filter songs that we don't have enough stages to play. */
if( WID.m_Type == TYPE_SONG ) if( WID.m_Type == WheelItemDataType_Song )
{ {
Song* pSong = WID.m_pSong; Song* pSong = WID.m_pSong;
@@ -984,7 +984,7 @@ void MusicWheel::FilterWheelItemDatas(vector<MusicWheelItemData *> &aUnFilteredD
} }
} }
if( WID.m_Type == TYPE_COURSE ) if( WID.m_Type == WheelItemDataType_Course )
{ {
if( !WID.m_pCourse->IsPlayableIn(GAMESTATE->GetCurrentStyle()->m_StepsType) ) if( !WID.m_pCourse->IsPlayableIn(GAMESTATE->GetCurrentStyle()->m_StepsType) )
aiRemove[i] = true; aiRemove[i] = true;
@@ -1007,7 +1007,7 @@ void MusicWheel::FilterWheelItemDatas(vector<MusicWheelItemData *> &aUnFilteredD
{ {
MusicWheelItemData& WID = *aFilteredData[i]; MusicWheelItemData& WID = *aFilteredData[i];
++i; ++i;
if( WID.m_Type != TYPE_SECTION ) if( WID.m_Type != WheelItemDataType_Section )
continue; continue;
// Count songs in this section // Count songs in this section
@@ -1021,7 +1021,7 @@ void MusicWheel::FilterWheelItemDatas(vector<MusicWheelItemData *> &aUnFilteredD
for( unsigned i=0; i < filteredSize; ++i ) for( unsigned i=0; i < filteredSize; ++i )
{ {
MusicWheelItemData& WID = *aFilteredData[i]; MusicWheelItemData& WID = *aFilteredData[i];
if( WID.m_Type != TYPE_SECTION ) if( WID.m_Type != WheelItemDataType_Section )
continue; continue;
if( WID.m_iSectionCount > 0 ) if( WID.m_iSectionCount > 0 )
continue; continue;
@@ -1042,7 +1042,7 @@ void MusicWheel::FilterWheelItemDatas(vector<MusicWheelItemData *> &aUnFilteredD
// If we've filtered all items, insert a dummy. // If we've filtered all items, insert a dummy.
if( aFilteredData.empty() ) if( aFilteredData.empty() )
aFilteredData.push_back( new MusicWheelItemData(TYPE_SECTION, NULL, EMPTY_STRING, NULL, RageColor(1,0,0,1), 0) ); aFilteredData.push_back( new MusicWheelItemData(WheelItemDataType_Section, NULL, EMPTY_STRING, NULL, RageColor(1,0,0,1), 0) );
} }
void MusicWheel::UpdateSwitch() void MusicWheel::UpdateSwitch()
@@ -1260,18 +1260,18 @@ bool MusicWheel::Select() // return true if this selection ends the screen
switch( m_CurWheelItemData[m_iSelection]->m_Type ) switch( m_CurWheelItemData[m_iSelection]->m_Type )
{ {
case TYPE_ROULETTE: case WheelItemDataType_Roulette:
StartRoulette(); StartRoulette();
return false; return false;
case TYPE_RANDOM: case WheelItemDataType_Random:
StartRandom(); StartRandom();
return false; return false;
case TYPE_SORT: case WheelItemDataType_Sort:
GetCurWheelItemData(m_iSelection)->m_pAction->ApplyToAllPlayers(); GetCurWheelItemData(m_iSelection)->m_pAction->ApplyToAllPlayers();
ChangeSort( GAMESTATE->m_PreferredSortOrder ); ChangeSort( GAMESTATE->m_PreferredSortOrder );
m_sLastModeMenuItem = GetCurWheelItemData(m_iSelection)->m_pAction->m_sName; m_sLastModeMenuItem = GetCurWheelItemData(m_iSelection)->m_pAction->m_sName;
return false; return false;
case TYPE_CUSTOM: case WheelItemDataType_Custom:
GetCurWheelItemData(m_iSelection)->m_pAction->ApplyToAllPlayers(); GetCurWheelItemData(m_iSelection)->m_pAction->ApplyToAllPlayers();
if( GetCurWheelItemData(m_iSelection)->m_pAction->m_sScreen != "" ) if( GetCurWheelItemData(m_iSelection)->m_pAction->m_sScreen != "" )
return true; return true;
@@ -1347,12 +1347,12 @@ void MusicWheel::SetOpenSection( RString group )
for( unsigned i = 0; i < from.size(); ++i ) for( unsigned i = 0; i < from.size(); ++i )
{ {
MusicWheelItemData &d = *from[i]; MusicWheelItemData &d = *from[i];
if( (d.m_Type == TYPE_SONG || d.m_Type == TYPE_COURSE) && !d.m_sText.empty() && if( (d.m_Type == WheelItemDataType_Song || d.m_Type == WheelItemDataType_Course) && !d.m_sText.empty() &&
d.m_sText != group ) d.m_sText != group )
continue; continue;
// If AUTO_SET_STYLE, hide courses that prefer a style that isn't available. // If AUTO_SET_STYLE, hide courses that prefer a style that isn't available.
if( d.m_Type == TYPE_COURSE && CommonMetrics::AUTO_SET_STYLE ) if( d.m_Type == WheelItemDataType_Course && CommonMetrics::AUTO_SET_STYLE )
{ {
const Style *pStyle = d.m_pCourse->GetCourseStyle( GAMESTATE->m_pCurGame, GAMESTATE->GetNumSidesJoined() ); const Style *pStyle = d.m_pCourse->GetCourseStyle( GAMESTATE->m_pCurGame, GAMESTATE->GetNumSidesJoined() );
if( pStyle ) if( pStyle )
@@ -1428,7 +1428,7 @@ RString MusicWheel::JumpToNextGroup()
unsigned int iLastSelection = m_iSelection; unsigned int iLastSelection = m_iSelection;
for( unsigned int i = m_iSelection; i < m_CurWheelItemData.size(); ++i ) for( unsigned int i = m_iSelection; i < m_CurWheelItemData.size(); ++i )
{ {
if( m_CurWheelItemData[i]->m_Type == TYPE_SECTION && i != (unsigned int)m_iSelection ) if( m_CurWheelItemData[i]->m_Type == WheelItemDataType_Section && i != (unsigned int)m_iSelection )
{ {
m_iSelection = i; m_iSelection = i;
return m_CurWheelItemData[i]->m_sText; return m_CurWheelItemData[i]->m_sText;
@@ -1438,7 +1438,7 @@ RString MusicWheel::JumpToNextGroup()
// the previous selection. // the previous selection.
for( unsigned int i = 0; i < iLastSelection; ++i ) for( unsigned int i = 0; i < iLastSelection; ++i )
{ {
if( m_CurWheelItemData[i]->m_Type == TYPE_SECTION && i != (unsigned int)m_iSelection ) if( m_CurWheelItemData[i]->m_Type == WheelItemDataType_Section && i != (unsigned int)m_iSelection )
{ {
m_iSelection = i; m_iSelection = i;
return m_CurWheelItemData[i]->m_sText; return m_CurWheelItemData[i]->m_sText;
@@ -1473,7 +1473,7 @@ RString MusicWheel::JumpToPrevGroup()
{ {
for( unsigned int i = m_iSelection; i > 0; --i ) for( unsigned int i = m_iSelection; i > 0; --i )
{ {
if( m_CurWheelItemData[i]->m_Type == TYPE_SECTION && i != (unsigned int)m_iSelection ) if( m_CurWheelItemData[i]->m_Type == WheelItemDataType_Section && i != (unsigned int)m_iSelection )
{ {
m_iSelection = i; m_iSelection = i;
return m_CurWheelItemData[i]->m_sText; return m_CurWheelItemData[i]->m_sText;
@@ -1483,7 +1483,7 @@ RString MusicWheel::JumpToPrevGroup()
for( unsigned int i = m_CurWheelItemData.size()-1; i > 0; --i ) for( unsigned int i = m_CurWheelItemData.size()-1; i > 0; --i )
{ {
LOG->Trace( "JumpToPrevGroup iteration 2 | i = %u",i ); LOG->Trace( "JumpToPrevGroup iteration 2 | i = %u",i );
if( m_CurWheelItemData[i]->m_Type == TYPE_SECTION ) if( m_CurWheelItemData[i]->m_Type == WheelItemDataType_Section )
{ {
m_iSelection = i; m_iSelection = i;
LOG->Trace( "finding it in #2 | i = %u | text = %s",i, m_CurWheelItemData[i]->m_sText.c_str() ); LOG->Trace( "finding it in #2 | i = %u | text = %s",i, m_CurWheelItemData[i]->m_sText.c_str() );
@@ -1523,7 +1523,7 @@ Song* MusicWheel::GetSelectedSong()
{ {
switch( m_CurWheelItemData[m_iSelection]->m_Type ) switch( m_CurWheelItemData[m_iSelection]->m_Type )
{ {
case TYPE_PORTAL: case WheelItemDataType_Portal:
return GetPreferredSelectionForRandomOrPortal(); return GetPreferredSelectionForRandomOrPortal();
default: default:
return GetCurWheelItemData(m_iSelection)->m_pSong; return GetCurWheelItemData(m_iSelection)->m_pSong;
@@ -1572,7 +1572,7 @@ Song *MusicWheel::GetPreferredSelectionForRandomOrPortal()
vDifficultiesToRequire.clear(); vDifficultiesToRequire.clear();
int iSelection = RandomInt( wid.size() ); int iSelection = RandomInt( wid.size() );
if( wid[iSelection]->m_Type != TYPE_SONG ) if( wid[iSelection]->m_Type != WheelItemDataType_Song )
continue; continue;
const Song *pSong = wid[iSelection]->m_pSong; const Song *pSong = wid[iSelection]->m_pSong;
+8 -8
View File
@@ -207,7 +207,7 @@ void MusicWheelItem::LoadFromWheelItemData( const WheelItemBaseData *pData, int
switch( pWID->m_Type ) switch( pWID->m_Type )
{ {
DEFAULT_FAIL( pWID->m_Type ); DEFAULT_FAIL( pWID->m_Type );
case TYPE_SONG: case WheelItemDataType_Song:
type = MusicWheelItemType_Song; type = MusicWheelItemType_Song;
m_TextBanner.SetFromSong( pWID->m_pSong ); m_TextBanner.SetFromSong( pWID->m_pSong );
@@ -219,7 +219,7 @@ void MusicWheelItem::LoadFromWheelItemData( const WheelItemBaseData *pData, int
m_WheelNotifyIcon.SetVisible( true ); m_WheelNotifyIcon.SetVisible( true );
RefreshGrades(); RefreshGrades();
break; break;
case TYPE_SECTION: case WheelItemDataType_Section:
{ {
sDisplayName = SONGMAN->ShortenGroupName(pWID->m_sText); sDisplayName = SONGMAN->ShortenGroupName(pWID->m_sText);
@@ -232,14 +232,14 @@ void MusicWheelItem::LoadFromWheelItemData( const WheelItemBaseData *pData, int
m_pTextSectionCount->SetVisible( true ); m_pTextSectionCount->SetVisible( true );
} }
break; break;
case TYPE_COURSE: case WheelItemDataType_Course:
sDisplayName = pWID->m_pCourse->GetDisplayFullTitle(); sDisplayName = pWID->m_pCourse->GetDisplayFullTitle();
sTranslitName = pWID->m_pCourse->GetTranslitFullTitle(); sTranslitName = pWID->m_pCourse->GetTranslitFullTitle();
type = MusicWheelItemType_Course; type = MusicWheelItemType_Course;
m_WheelNotifyIcon.SetFlags( pWID->m_Flags ); m_WheelNotifyIcon.SetFlags( pWID->m_Flags );
m_WheelNotifyIcon.SetVisible( true ); m_WheelNotifyIcon.SetVisible( true );
break; break;
case TYPE_SORT: case WheelItemDataType_Sort:
sDisplayName = pWID->m_sLabel; sDisplayName = pWID->m_sLabel;
// hack to get mode items working. -freem // hack to get mode items working. -freem
if( pWID->m_pAction->m_pm != PlayMode_Invalid ) if( pWID->m_pAction->m_pm != PlayMode_Invalid )
@@ -247,19 +247,19 @@ void MusicWheelItem::LoadFromWheelItemData( const WheelItemBaseData *pData, int
else else
type = MusicWheelItemType_Sort; type = MusicWheelItemType_Sort;
break; break;
case TYPE_ROULETTE: case WheelItemDataType_Roulette:
sDisplayName = THEME->GetString("MusicWheel","Roulette"); sDisplayName = THEME->GetString("MusicWheel","Roulette");
type = MusicWheelItemType_Roulette; type = MusicWheelItemType_Roulette;
break; break;
case TYPE_RANDOM: case WheelItemDataType_Random:
sDisplayName = THEME->GetString("MusicWheel","Random"); sDisplayName = THEME->GetString("MusicWheel","Random");
type = MusicWheelItemType_Random; type = MusicWheelItemType_Random;
break; break;
case TYPE_PORTAL: case WheelItemDataType_Portal:
sDisplayName = THEME->GetString("MusicWheel","Portal"); sDisplayName = THEME->GetString("MusicWheel","Portal");
type = MusicWheelItemType_Portal; type = MusicWheelItemType_Portal;
break; break;
case TYPE_CUSTOM: case WheelItemDataType_Custom:
sDisplayName = pWID->m_sLabel; sDisplayName = pWID->m_sLabel;
type = MusicWheelItemType_Custom; type = MusicWheelItemType_Custom;
break; break;
+3 -3
View File
@@ -29,7 +29,7 @@ void RoomWheel::Load( RString sType )
m_offset = 0; m_offset = 0;
LOG->Trace( "RoomWheel::Load('%s')", sType.c_str() ); LOG->Trace( "RoomWheel::Load('%s')", sType.c_str() );
AddPermanentItem( new RoomWheelItemData(TYPE_GENERIC, "Create Room", "Create a new game room", THEME->GetMetricC( m_sName, "CreateRoomColor")) ); AddPermanentItem( new RoomWheelItemData(WheelItemDataType_Generic, "Create Room", "Create a new game room", THEME->GetMetricC( m_sName, "CreateRoomColor")) );
BuildWheelItemsData( m_CurWheelItemData ); BuildWheelItemsData( m_CurWheelItemData );
RebuildWheelItems(); RebuildWheelItems();
@@ -90,7 +90,7 @@ void RoomWheelItem::Load( RString sType )
void RoomWheel::BuildWheelItemsData( vector<WheelItemBaseData*> &arrayWheelItemDatas ) void RoomWheel::BuildWheelItemsData( vector<WheelItemBaseData*> &arrayWheelItemDatas )
{ {
if( arrayWheelItemDatas.empty() ) if( arrayWheelItemDatas.empty() )
arrayWheelItemDatas.push_back( new RoomWheelItemData(TYPE_GENERIC, EMPTY_STRING, "", RageColor(1,0,0,1)) ); arrayWheelItemDatas.push_back( new RoomWheelItemData(WheelItemDataType_Generic, EMPTY_STRING, "", RageColor(1,0,0,1)) );
} }
void RoomWheel::AddPermanentItem( RoomWheelItemData *itemdata ) void RoomWheel::AddPermanentItem( RoomWheelItemData *itemdata )
@@ -137,7 +137,7 @@ void RoomWheel::RemoveItem( int index )
if( m_CurWheelItemData.size() < 1 ) if( m_CurWheelItemData.size() < 1 )
{ {
m_bEmpty = true; m_bEmpty = true;
m_CurWheelItemData.push_back( new WheelItemBaseData(TYPE_GENERIC, "- EMPTY -", RageColor(1,0,0,1)) ); m_CurWheelItemData.push_back( new WheelItemBaseData(WheelItemDataType_Generic, "- EMPTY -", RageColor(1,0,0,1)) );
} }
RebuildWheelItems(); RebuildWheelItems();
+2 -2
View File
@@ -255,13 +255,13 @@ void ScreenNetRoom::UpdateRoomsList()
{ {
difference = abs( difference ); difference = abs( difference );
for( int x = 0; x < difference; ++x ) for( int x = 0; x < difference; ++x )
m_RoomWheel.AddItem( new RoomWheelItemData(TYPE_GENERIC, "", "", RageColor(1,1,1,1)) ); m_RoomWheel.AddItem( new RoomWheelItemData(WheelItemDataType_Generic, "", "", RageColor(1,1,1,1)) );
} }
} }
else else
{ {
for ( unsigned int x = 0; x < m_Rooms.size(); ++x) for ( unsigned int x = 0; x < m_Rooms.size(); ++x)
m_RoomWheel.AddItem( new RoomWheelItemData(TYPE_GENERIC, "", "", RageColor(1,1,1,1)) ); m_RoomWheel.AddItem( new RoomWheelItemData(WheelItemDataType_Generic, "", "", RageColor(1,1,1,1)) );
} }
for( unsigned int i = 0; i < m_Rooms.size(); ++i ) for( unsigned int i = 0; i < m_Rooms.size(); ++i )
+1 -1
View File
@@ -392,7 +392,7 @@ void ScreenNetSelectMusic::MenuStart( const InputEventPlus &input )
if( !bResult ) if( !bResult )
return; return;
if( m_MusicWheel.GetSelectedType() != TYPE_SONG ) if( m_MusicWheel.GetSelectedType() != WheelItemDataType_Song )
return; return;
Song * pSong = m_MusicWheel.GetSelectedSong(); Song * pSong = m_MusicWheel.GetSelectedSong();
+13 -13
View File
@@ -1695,11 +1695,11 @@ void ScreenSelectMusic::AfterMusicChange()
switch( m_MusicWheel.GetSelectedType() ) switch( m_MusicWheel.GetSelectedType() )
{ {
case TYPE_SECTION: case WheelItemDataType_Section:
case TYPE_SORT: case WheelItemDataType_Sort:
case TYPE_ROULETTE: case WheelItemDataType_Roulette:
case TYPE_RANDOM: case WheelItemDataType_Random:
case TYPE_CUSTOM: case WheelItemDataType_Custom:
FOREACH_PlayerNumber( p ) FOREACH_PlayerNumber( p )
m_iSelection[p] = -1; m_iSelection[p] = -1;
@@ -1722,7 +1722,7 @@ void ScreenSelectMusic::AfterMusicChange()
switch( m_MusicWheel.GetSelectedType() ) switch( m_MusicWheel.GetSelectedType() )
{ {
case TYPE_SECTION: case WheelItemDataType_Section:
// reduce scope // reduce scope
{ {
SortOrder curSort = GAMESTATE->m_SortOrder; SortOrder curSort = GAMESTATE->m_SortOrder;
@@ -1740,25 +1740,25 @@ void ScreenSelectMusic::AfterMusicChange()
m_sSampleMusicToPlay = m_sSectionMusicPath; m_sSampleMusicToPlay = m_sSectionMusicPath;
} }
break; break;
case TYPE_SORT: case WheelItemDataType_Sort:
bWantBanner = false; // we load it ourself bWantBanner = false; // we load it ourself
m_Banner.LoadMode(); m_Banner.LoadMode();
if( SAMPLE_MUSIC_PREVIEW_MODE != SampleMusicPreviewMode_LastSong ) if( SAMPLE_MUSIC_PREVIEW_MODE != SampleMusicPreviewMode_LastSong )
m_sSampleMusicToPlay = m_sSortMusicPath; m_sSampleMusicToPlay = m_sSortMusicPath;
break; break;
case TYPE_ROULETTE: case WheelItemDataType_Roulette:
bWantBanner = false; // we load it ourself bWantBanner = false; // we load it ourself
m_Banner.LoadRoulette(); m_Banner.LoadRoulette();
if( SAMPLE_MUSIC_PREVIEW_MODE != SampleMusicPreviewMode_LastSong ) if( SAMPLE_MUSIC_PREVIEW_MODE != SampleMusicPreviewMode_LastSong )
m_sSampleMusicToPlay = m_sRouletteMusicPath; m_sSampleMusicToPlay = m_sRouletteMusicPath;
break; break;
case TYPE_RANDOM: case WheelItemDataType_Random:
bWantBanner = false; // we load it ourself bWantBanner = false; // we load it ourself
m_Banner.LoadRandom(); m_Banner.LoadRandom();
//if( SAMPLE_MUSIC_PREVIEW_MODE != SampleMusicPreviewMode_LastSong ) //if( SAMPLE_MUSIC_PREVIEW_MODE != SampleMusicPreviewMode_LastSong )
m_sSampleMusicToPlay = m_sRandomMusicPath; m_sSampleMusicToPlay = m_sRandomMusicPath;
break; break;
case TYPE_CUSTOM: case WheelItemDataType_Custom:
{ {
bWantBanner = false; // we load it ourself bWantBanner = false; // we load it ourself
RString sBannerName = GetMusicWheel()->GetCurWheelItemData( GetMusicWheel()->GetCurrentIndex() )->m_pAction->m_sName.c_str(); RString sBannerName = GetMusicWheel()->GetCurWheelItemData( GetMusicWheel()->GetCurrentIndex() )->m_pAction->m_sName.c_str();
@@ -1781,8 +1781,8 @@ void ScreenSelectMusic::AfterMusicChange()
} }
*/ */
break; break;
case TYPE_SONG: case WheelItemDataType_Song:
case TYPE_PORTAL: case WheelItemDataType_Portal:
// check SampleMusicPreviewMode here. // check SampleMusicPreviewMode here.
switch( SAMPLE_MUSIC_PREVIEW_MODE ) switch( SAMPLE_MUSIC_PREVIEW_MODE )
{ {
@@ -1818,7 +1818,7 @@ void ScreenSelectMusic::AfterMusicChange()
SwitchToPreferredDifficulty(); SwitchToPreferredDifficulty();
break; break;
case TYPE_COURSE: case WheelItemDataType_Course:
{ {
const Course *lCourse = m_MusicWheel.GetSelectedCourse(); const Course *lCourse = m_MusicWheel.GetSelectedCourse();
const Style *pStyle = NULL; const Style *pStyle = NULL;
+9 -3
View File
@@ -276,10 +276,10 @@ bool WheelBase::Select() // return true if this selection can end the screen
switch( m_CurWheelItemData[m_iSelection]->m_Type ) switch( m_CurWheelItemData[m_iSelection]->m_Type )
{ {
case TYPE_GENERIC: case WheelItemDataType_Generic:
m_LastSelection = m_CurWheelItemData[m_iSelection]; m_LastSelection = m_CurWheelItemData[m_iSelection];
break; break;
case TYPE_SECTION: case WheelItemDataType_Section:
{ {
RString sThisItemSectionName = m_CurWheelItemData[m_iSelection]->m_sText; RString sThisItemSectionName = m_CurWheelItemData[m_iSelection]->m_sText;
if( m_sExpandedSectionName == sThisItemSectionName ) // already expanded if( m_sExpandedSectionName == sThisItemSectionName ) // already expanded
@@ -468,7 +468,7 @@ void WheelBase::RebuildWheelItems( int iDist )
const WheelItemBaseData *pData = data[iIndex]; const WheelItemBaseData *pData = data[iIndex];
WheelItemBase *pDisplay = items[i]; WheelItemBase *pDisplay = items[i];
pDisplay->SetExpanded( pData->m_Type == TYPE_SECTION && pData->m_sText == m_sExpandedSectionName ); pDisplay->SetExpanded( pData->m_Type == WheelItemDataType_Section && pData->m_sText == m_sExpandedSectionName );
} }
for( int i=0; i<(int)items.size(); i++ ) for( int i=0; i<(int)items.size(); i++ )
@@ -530,6 +530,11 @@ public:
//static int Move( T* p, lua_State *L ){ p->Move( IArg(1) ); return 0; } //static int Move( T* p, lua_State *L ){ p->Move( IArg(1) ); return 0; }
//static int ChangeMusic( T* p, lua_State *L ){ p->ChangeMusicUnlessLocked( IArg(1) ); return 0; } //static int ChangeMusic( T* p, lua_State *L ){ p->ChangeMusicUnlessLocked( IArg(1) ); return 0; }
static int GetSelectedType( T* p, lua_State *L ) {
lua_pushnumber( L, p->GetSelectedType() );
return 1;
}
LunaWheelBase() LunaWheelBase()
{ {
ADD_METHOD( GetWheelItem ); ADD_METHOD( GetWheelItem );
@@ -538,6 +543,7 @@ public:
ADD_METHOD( SetOpenSection ); ADD_METHOD( SetOpenSection );
ADD_METHOD( GetCurrentIndex ); ADD_METHOD( GetCurrentIndex );
ADD_METHOD( GetNumItems ); ADD_METHOD( GetNumItems );
ADD_METHOD( GetSelectedType );
// evil shit // evil shit
//ADD_METHOD( Move ); //ADD_METHOD( Move );
//ADD_METHOD( ChangeMusic ); //ADD_METHOD( ChangeMusic );
+2
View File
@@ -49,6 +49,8 @@ public:
RString GetExpandedSectionName() { return m_sExpandedSectionName; } RString GetExpandedSectionName() { return m_sExpandedSectionName; }
int GetCurrentIndex() { return m_iSelection; } int GetCurrentIndex() { return m_iSelection; }
WheelItemDataType GetSelectedType() { return m_CurWheelItemData[m_iSelection]->m_Type; }
// Lua // Lua
void PushSelf( lua_State *L ); void PushSelf( lua_State *L );
+7 -3
View File
@@ -30,7 +30,7 @@ WheelItemBase::WheelItemBase(RString sType)
void WheelItemBase::Load( RString sType ) void WheelItemBase::Load( RString sType )
{ {
m_colorLocked = RageColor(0,0,0,0.25); m_colorLocked = RageColor(0,0,0,0.25f);
} }
void WheelItemBase::LoadFromWheelItemData( const WheelItemBaseData* pWID, int iIndex, bool bHasFocus, int iDrawIndex ) void WheelItemBase::LoadFromWheelItemData( const WheelItemBaseData* pWID, int iIndex, bool bHasFocus, int iDrawIndex )
@@ -73,13 +73,17 @@ class LunaWheelItemBase: public Luna<WheelItemBase>
public: public:
DEFINE_METHOD( GetColor, GetColor() ) DEFINE_METHOD( GetColor, GetColor() )
DEFINE_METHOD( GetText, GetText() ) DEFINE_METHOD( GetText, GetText() )
//DEFINE_METHOD( GetType, GetType() )
static int GetType( T* p, lua_State *L ) {
lua_pushnumber( L, p->GetType() );
return 1;
}
LunaWheelItemBase() LunaWheelItemBase()
{ {
ADD_METHOD( GetColor ); ADD_METHOD( GetColor );
ADD_METHOD( GetText ); ADD_METHOD( GetText );
//ADD_METHOD( GetType ); ADD_METHOD( GetType );
} }
}; };
LUA_REGISTER_DERIVED_CLASS( WheelItemBase, ActorFrame ) LUA_REGISTER_DERIVED_CLASS( WheelItemBase, ActorFrame )
+10 -9
View File
@@ -11,16 +11,17 @@ struct WheelItemBaseData;
/** @brief The different types of Wheel Items. */ /** @brief The different types of Wheel Items. */
enum WheelItemDataType enum WheelItemDataType
{ {
TYPE_GENERIC, /**< A generic item on the Wheel. */ WheelItemDataType_Generic, /**< A generic item on the Wheel. */
TYPE_SECTION, /**< A general section on the Wheel. */ WheelItemDataType_Section, /**< A general section on the Wheel. */
TYPE_SONG, /**< A Song on the Wheel. */ WheelItemDataType_Song, /**< A Song on the Wheel. */
TYPE_ROULETTE, /**< The roulette section on the Wheel. */ WheelItemDataType_Roulette, /**< The roulette section on the Wheel. */
TYPE_RANDOM, /**< The random section on the Wheel. */ WheelItemDataType_Random, /**< The random section on the Wheel. */
TYPE_PORTAL, /**< The portal section on the Wheel. */ WheelItemDataType_Portal, /**< The portal section on the Wheel. */
TYPE_COURSE, /**< A Course on the Wheel. */ WheelItemDataType_Course, /**< A Course on the Wheel. */
TYPE_SORT, /**< A generic sorting item on the Wheel. */ WheelItemDataType_Sort, /**< A generic sorting item on the Wheel. */
TYPE_CUSTOM /**< A custom item on the Wheel. */ WheelItemDataType_Custom /**< A custom item on the Wheel. */
}; };
LuaDeclareType( WheelItemDataType );
struct WheelItemBaseData struct WheelItemBaseData
{ {
@@ -24,9 +24,10 @@
NSSize size = [image size]; NSSize size = [image size];
NSRect viewRect, windowRect; NSRect viewRect, windowRect;
float height = 0.0f; float height = 0.0f;
float padding = 5.0f;
NSRect progressIndicatorRect; NSRect progressIndicatorRect;
progressIndicatorRect = NSMakeRect(0, 0, size.width, 0); progressIndicatorRect = NSMakeRect(padding, padding, size.width-padding*2.0f, 0);
m_ProgressIndicator = [[NSProgressIndicator alloc] initWithFrame:progressIndicatorRect]; m_ProgressIndicator = [[NSProgressIndicator alloc] initWithFrame:progressIndicatorRect];
[m_ProgressIndicator sizeToFit]; [m_ProgressIndicator sizeToFit];
[m_ProgressIndicator setIndeterminate:YES]; [m_ProgressIndicator setIndeterminate:YES];
@@ -39,28 +40,28 @@
NSFont *font = [NSFont systemFontOfSize:0.0f]; NSFont *font = [NSFont systemFontOfSize:0.0f];
NSRect textRect; NSRect textRect;
// Just give it a size until it is created. // Just give it a size until it is created.
textRect = NSMakeRect( 0, progressHeight, size.width, size.height ); textRect = NSMakeRect( 0, progressHeight + padding, size.width, size.height );
m_Text = [[NSTextView alloc] initWithFrame:textRect]; m_Text = [[NSTextView alloc] initWithFrame:textRect];
[m_Text setFont:font]; [m_Text setFont:font];
height = [[m_Text layoutManager] defaultLineHeightForFont:font]*3 + 4; height = [[m_Text layoutManager] defaultLineHeightForFont:font]*3 + 4;
textRect = NSMakeRect( 0, progressHeight, size.width, height ); textRect = NSMakeRect( 0, progressHeight + padding, size.width, height );
[m_Text setFrame:textRect]; [m_Text setFrame:textRect];
[m_Text setEditable:NO]; [m_Text setEditable:NO];
[m_Text setSelectable:NO]; [m_Text setSelectable:NO];
[m_Text setDrawsBackground:YES]; [m_Text setDrawsBackground:NO];
[m_Text setBackgroundColor:[NSColor lightGrayColor]]; [m_Text setBackgroundColor:[NSColor lightGrayColor]];
[m_Text setAlignment:NSCenterTextAlignment]; [m_Text setAlignment:NSCenterTextAlignment];
[m_Text setHorizontallyResizable:NO]; [m_Text setHorizontallyResizable:NO];
[m_Text setVerticallyResizable:NO]; [m_Text setVerticallyResizable:NO];
[m_Text setString:@"Initializing Hardware..."]; [m_Text setString:@"Initializing Hardware..."];
viewRect = NSMakeRect( 0, height + progressHeight, size.width, size.height ); viewRect = NSMakeRect( 0, height + progressHeight + padding, size.width, size.height );
NSImageView *iView = [[NSImageView alloc] initWithFrame:viewRect]; NSImageView *iView = [[NSImageView alloc] initWithFrame:viewRect];
[iView setImage:image]; [iView setImage:image];
[iView setImageFrameStyle:NSImageFrameNone]; [iView setImageFrameStyle:NSImageFrameNone];
windowRect = NSMakeRect( 0, 0, size.width, size.height + height + progressHeight); windowRect = NSMakeRect( 0, 0, size.width, size.height + height + progressHeight + padding);
m_Window = [[NSWindow alloc] initWithContentRect:windowRect m_Window = [[NSWindow alloc] initWithContentRect:windowRect
styleMask:NSTitledWindowMask styleMask:NSTitledWindowMask
backing:NSBackingStoreBuffered backing:NSBackingStoreBuffered