81 lines
2.3 KiB
C++
81 lines
2.3 KiB
C++
#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 "ThemeManager.h"
|
|
|
|
#define COLOR_P1 THEME->GetMetricC("Common","ColorP1")
|
|
#define COLOR_P2 THEME->GetMetricC("Common","ColorP2")
|
|
|
|
|
|
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";
|
|
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 == "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;
|
|
|
|
return DIFFICULTY_INVALID;
|
|
}
|
|
|
|
RageColor PlayerToColor( PlayerNumber pn )
|
|
{
|
|
switch( pn )
|
|
{
|
|
case PLAYER_1: return COLOR_P1;
|
|
case PLAYER_2: return COLOR_P2;
|
|
default: ASSERT(0); return RageColor(0.5f,0.5f,0.5f,1);
|
|
}
|
|
};
|
|
|
|
RageColor PlayerToColor( int p )
|
|
{
|
|
return PlayerToColor( (PlayerNumber)p );
|
|
}
|
|
|
|
|
|
RankingCategory AverageMeterToRankingCategory( float fAverageMeter )
|
|
{
|
|
if( fAverageMeter <= 3 ) return RANKING_A;
|
|
else if( fAverageMeter <= 6 ) return RANKING_B;
|
|
else if( fAverageMeter <= 9 ) return RANKING_C;
|
|
else return RANKING_D;
|
|
|
|
}
|
|
|