#include "stdafx.h" /* ----------------------------------------------------------------------------- Class: ThemeManager Desc: See header. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ #include "ThemeManager.h" #include "RageLog.h" #include "PrefsManager.h" #include "RageException.h" #include "GameState.h" #include "GameDef.h" ThemeManager* THEME = NULL; // global object accessable from anywhere in the program const CString BASE_THEME_NAME = "default"; const CString THEMES_DIR = "Themes\\"; ThemeManager::ThemeManager() { m_sCurThemeName = BASE_THEME_NAME; // Use te base theme for now. It's up to PrefsManager to change this. CStringArray arrayThemeNames; GetAllThemeNames( arrayThemeNames ); for( int i=0; i=0; i-- ) if( 0 == stricmp( AddTo[i], "cvs" ) ) AddTo.RemoveAt(i); } void ThemeManager::GetThemeNamesForCurGame( CStringArray& AddTo ) { GetAllThemeNames( AddTo ); // strip out announcers that don't have the current game name in them CString sGameName = GAMESTATE->GetCurrentGameDef()->m_szName; sGameName.MakeLower(); for( int i=AddTo.GetSize()-1; i>=0; i-- ) { CString sLowercaseVer = AddTo[i]; sLowercaseVer.MakeLower(); if( sLowercaseVer.Find(sGameName)==-1 ) AddTo.RemoveAt(i); } } bool ThemeManager::DoesThemeExist( CString sThemeName ) { CStringArray asThemeNames; GetAllThemeNames( asThemeNames ); for( int i=0; i 0 ) return asPossibleElementFilePaths[0]; else throw RageException( "Theme element '%s' could not be found in '%s' or '%s'.", sAssetPrefix, GetThemeDirFromName(m_sCurThemeName), GetThemeDirFromName(BASE_THEME_NAME) ); return ""; }