Пример #1
0
/* Add a list of available characters to the given row/handler. */
void ScreenOptionsMaster::SetCharacter( OptionRowData &row, OptionRowHandler &hand )
{
	hand.type = ROW_CHARACTER;
	row.bOneChoiceForAllPlayers = false;
	hand.Default.m_pCharacter = GAMESTATE->GetDefaultCharacter();

	ModeChoice mc;

	{
		row.choices.push_back( ENTRY_NAME("Off") );
		mc.m_pCharacter = GAMESTATE->GetDefaultCharacter();
		hand.ListEntries.push_back( mc );
	}

	vector<Character*> apCharacters;
	GAMESTATE->GetCharacters( apCharacters );
	for( unsigned i=0; i<apCharacters.size(); i++ )
	{
		Character* pCharacter = apCharacters[i];
		CString s = pCharacter->m_sName;
		s.MakeUpper();

		row.choices.push_back( s ); 
		mc.m_pCharacter = pCharacter;
		hand.ListEntries.push_back( mc );
	}
}
Пример #2
0
/* Add the list named "ListName" to the given row/handler. */
void ScreenOptionsMaster::SetList( OptionRowData &row, OptionRowHandler &hand, const CString &ListName, CString &TitleOut )
{
	hand.type = ROW_LIST;

	TitleOut = ListName;
	if( !ListName.CompareNoCase("noteskins") )
	{
		hand.Default.Init(); /* none */
		row.bOneChoiceForAllPlayers = false;

		CStringArray arraySkinNames;
		NOTESKIN->GetNoteSkinNames( arraySkinNames );
		ModeChoice mc;
		for( unsigned skin=0; skin<arraySkinNames.size(); skin++ )
		{
			arraySkinNames[skin].MakeUpper();
			mc.m_sModifiers = arraySkinNames[skin];
			hand.ListEntries.push_back( mc );
			row.choices.push_back( arraySkinNames[skin] );
		}
		return;
	}

	hand.Default.Load( -1, ENTRY_DEFAULT(ListName) );

	/* Parse the basic configuration metric. */
	CStringArray asParts;
	split( ENTRY(ListName), ",", asParts );
	if( asParts.size() < 1 )
		RageException::Throw( "Parse error in ScreenOptionsMasterEntries::ListName%s", ListName.c_str() );

	row.bOneChoiceForAllPlayers = false;
	const int NumCols = atoi( asParts[0] );
	for( unsigned i=0; i<asParts.size(); i++ )
	{
		if( asParts[i].CompareNoCase("together") == 0 )
			row.bOneChoiceForAllPlayers = true;
		else if( asParts[i].CompareNoCase("multiselect") == 0 )
			row.bMultiSelect = true;
	}

	for( int col = 0; col < NumCols; ++col )
	{
		ModeChoice mc;
		mc.Load( 0, ENTRY_MODE(ListName, col) );
		if( mc.m_sName == "" )
			RageException::Throw( "List \"%s\", col %i has no name", ListName.c_str(), col );

		if( !mc.IsPlayable() )
			continue;

		hand.ListEntries.push_back( mc );

		CString sChoice = ENTRY_NAME(mc.m_sName);
		row.choices.push_back( sChoice );
	}
}
Пример #3
0
struct ext2_directory_entry *ext2_read_entry_from_directory(struct ext2_disk *disk, struct ext2_inode *cwd, const char *name) {
    struct ext2_directory_entry *entry = NULL;

    // Iterate over the 12 direct block pointers
    int i;
    for (i = 0; i < 12; i++) {
        while ((entry = _next_directory_entry(disk, cwd->direct_blocks[i], entry))->inode_addr != 0) {
            // Check if the name matches
            if (strcmp(ENTRY_NAME(entry), name) == 0)
                // Name matches; return this entry
                return entry;
        }
    }

    return entry;
}
Пример #4
0
ScreenOptionsMaster::ScreenOptionsMaster( const CString &sClassName ):
	ScreenOptions( sClassName )
{
	LOG->Trace("ScreenOptionsMaster::ScreenOptionsMaster(%s)", m_sName.c_str() );

	/* If this file doesn't exist, leave the music alone (eg. ScreenPlayerOptions music sample
	 * left over from ScreenSelectMusic).  If you really want to play no music, add a redir
	 * to _silent. */
	CString MusicPath = THEME->GetPathToS( ssprintf("%s music", m_sName.c_str()), true );
	if( MusicPath != "" )
		SOUND->PlayMusic( MusicPath );

	CStringArray asLineNames;
	split( LINE_NAMES, ",", asLineNames );
	if( asLineNames.empty() )
		RageException::Throw( "%s::LineNames is empty.", m_sName.c_str() );


	CStringArray Flags;
	split( OPTION_MENU_FLAGS, ";", Flags, true );
	InputMode im = INPUTMODE_INDIVIDUAL;
	bool Explanations = false;
	
	unsigned i;
	for( i = 0; i < Flags.size(); ++i )
	{
		CString &flag = Flags[i];
		flag.MakeLower();

		if( flag == "together" )
			im = INPUTMODE_SHARE_CURSOR;
		else if( flag == "explanations" )
			Explanations = true;
		else if( flag == "forceallplayers" )
		{
			FOREACH_PlayerNumber( pn )
				GAMESTATE->m_bSideIsJoined[pn] = true;
			GAMESTATE->m_MasterPlayerNumber = PlayerNumber(0);
		}
		else if( flag == "smnavigation" )
			SetNavigation( NAV_THREE_KEY_MENU );
		else if( flag == "toggle" || flag == "firstchoicegoesdown" )
			SetNavigation( PREFSMAN->m_bArcadeOptionsNavigation? NAV_TOGGLE_THREE_KEY:NAV_TOGGLE_FIVE_KEY );
	}

	m_OptionRowAlloc = new OptionRowData[asLineNames.size()];
	for( i = 0; i < asLineNames.size(); ++i )
	{
		OptionRowData &row = m_OptionRowAlloc[i];
		
		vector<ParsedCommand> vCommands;
		ParseCommands( LINE(asLineNames[i]), vCommands );
		
		if( vCommands.size() < 1 )
			RageException::Throw( "Parse error in %s::Line%i", m_sName.c_str(), i+1 );

		OptionRowHandler hand;
		for( unsigned part = 0; part < vCommands.size(); ++part)
		{
			ParsedCommand& command = vCommands[part];

			HandleParams;

			const CString name = sParam(0);

			if( !name.CompareNoCase("list") )
			{
				SetList( row, hand, sParam(1), row.name );
			}
			else if( !name.CompareNoCase("steps") )
			{
				SetStep( row, hand );
				row.name = "Steps";
			}
			else if( !name.CompareNoCase("conf") )
			{
				SetConf( row, hand, sParam(1), row.name );
			}
			else if( !name.CompareNoCase("characters") )
			{
				SetCharacter( row, hand );
				row.name = "Characters";
			}
			else
				RageException::Throw( "Unexpected type '%s' in %s::Line%i", name.c_str(), m_sName.c_str(), i );

			CheckHandledParams;
		}

		// TRICKY:  Insert a down arrow as the first choice in the row.
		if( m_OptionsNavigation == NAV_TOGGLE_THREE_KEY )
		{
			row.choices.insert( row.choices.begin(), ENTRY_NAME("NextRow") );
			hand.ListEntries.insert( hand.ListEntries.begin(), ModeChoice() );
		}

		OptionRowHandlers.push_back( hand );
	}

	ASSERT( OptionRowHandlers.size() == asLineNames.size() );

	Init( im, m_OptionRowAlloc, asLineNames.size() );
}