#include "global.h" /* ----------------------------------------------------------------------------- File: GameConstantsAndTypes.cpp Desc: See header. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ #include "GameConstantsAndTypes.h" #include "GameState.h" #include "RageUtil.h" #include "ThemeManager.h" CString RadarCategoryToString( RadarCategory cat ) { switch( cat ) { case RADAR_STREAM: return "stream"; case RADAR_VOLTAGE: return "voltage"; case RADAR_AIR: return "air"; case RADAR_FREEZE: return "freeze"; case RADAR_CHAOS: return "chaos"; case RADAR_NUM_TAPS_AND_HOLDS: return "taps"; case RADAR_NUM_JUMPS: return "jumps"; case RADAR_NUM_HOLDS: return "holds"; case RADAR_NUM_MINES: return "mines"; case RADAR_NUM_HANDS: return "hands"; default: ASSERT(0); return ""; // invalid } } CString DifficultyToString( Difficulty dc ) { switch( dc ) { case DIFFICULTY_BEGINNER: return "beginner"; case DIFFICULTY_EASY: return "easy"; case DIFFICULTY_MEDIUM: return "medium"; case DIFFICULTY_HARD: return "hard"; case DIFFICULTY_CHALLENGE: return "challenge"; case DIFFICULTY_EDIT: return "edit"; default: ASSERT(0); return ""; // invalid Difficulty } } /* We prefer the above names; recognize a number of others, too. (They'l * get normalized when written to SMs, etc.) */ Difficulty StringToDifficulty( CString sDC ) { sDC.MakeLower(); if( sDC == "beginner" ) return DIFFICULTY_BEGINNER; else if( sDC == "easy" ) return DIFFICULTY_EASY; else if( sDC == "basic" ) return DIFFICULTY_EASY; else if( sDC == "light" ) return DIFFICULTY_EASY; else if( sDC == "medium" ) return DIFFICULTY_MEDIUM; else if( sDC == "another" ) return DIFFICULTY_MEDIUM; else if( sDC == "trick" ) return DIFFICULTY_MEDIUM; else if( sDC == "standard" ) return DIFFICULTY_MEDIUM; else if( sDC == "difficult") return DIFFICULTY_MEDIUM; else if( sDC == "hard" ) return DIFFICULTY_HARD; else if( sDC == "ssr" ) return DIFFICULTY_HARD; else if( sDC == "maniac" ) return DIFFICULTY_HARD; else if( sDC == "heavy" ) return DIFFICULTY_HARD; else if( sDC == "smaniac" ) return DIFFICULTY_CHALLENGE; else if( sDC == "challenge" ) return DIFFICULTY_CHALLENGE; else if( sDC == "expert" ) return DIFFICULTY_CHALLENGE; else if( sDC == "oni" ) return DIFFICULTY_CHALLENGE; else if( sDC == "edit" ) return DIFFICULTY_EDIT; else return DIFFICULTY_INVALID; } CString CourseDifficultyToString( CourseDifficulty dc ) { switch( dc ) { case COURSE_DIFFICULTY_REGULAR: return "regular"; case COURSE_DIFFICULTY_DIFFICULT: return "difficult"; default: ASSERT(0); return ""; // invalid Difficulty } } /* We prefer the above names; recognize a number of others, too. (They'l * get normalized when written to SMs, etc.) */ CourseDifficulty StringToCourseDifficulty( CString sDC ) { sDC.MakeLower(); if( sDC == "regular" ) return COURSE_DIFFICULTY_REGULAR; else if( sDC == "difficult" ) return COURSE_DIFFICULTY_DIFFICULT; else return COURSE_DIFFICULTY_INVALID; } CString PlayModeToString( PlayMode pm ) { switch( pm ) { case PLAY_MODE_ARCADE: return "arcade"; case PLAY_MODE_ONI: return "oni"; case PLAY_MODE_NONSTOP: return "nonstop"; case PLAY_MODE_ENDLESS: return "endless"; case PLAY_MODE_BATTLE: return "battle"; case PLAY_MODE_RAVE: return "rave"; default: ASSERT(0); return ""; } } PlayMode StringToPlayMode( CString s ) { for( int i=0; iGetMetric( #X, X##ToString(x) ); \ } #define StringToX(X) \ X StringTo##X( CString s ) \ { \ unsigned i; \ for( i = 0; i < ARRAYSIZE(X##Names); ++i ) \ if( !s.CompareNoCase(X##Names[i]) ) \ return (X)i; \ return (X)i; \ } static const char *PerDifficultyAwardNames[NUM_PER_DIFFICULTY_AWARDS] = { "FullComboGreats", "FullComboPerfects", "FullComboMarvelouses", "SingleDigitGreats", "SingleDigitPerfects", "Greats80Percent", "Greats90Percent", "Greats100Percent", }; XToString( PerDifficultyAward ); XToThemedString( PerDifficultyAward ); StringToX( PerDifficultyAward ); // The number is not at the front so that these strings can be used as XML entity names // The number is not at the back so that "1000" and "10000" don't conflict when // searching for theme elements. static const char *PeakComboAwardNames[NUM_PEAK_COMBO_AWARDS] = { "Peak1000Combo", "Peak2000Combo", "Peak3000Combo", "Peak4000Combo", "Peak5000Combo", "Peak6000Combo", "Peak7000Combo", "Peak8000Combo", "Peak9000Combo", "Peak10000Combo", }; XToString( PeakComboAward ); XToThemedString( PeakComboAward ); StringToX( PeakComboAward );