2003-02-16 04:01:45 +00:00
|
|
|
#include "global.h"
|
2002-07-27 19:29:51 +00:00
|
|
|
#include "GameConstantsAndTypes.h"
|
2003-02-28 08:12:47 +00:00
|
|
|
#include "GameState.h"
|
2004-02-22 03:20:21 +00:00
|
|
|
#include "RageUtil.h"
|
2005-02-02 06:53:31 +00:00
|
|
|
#include "ThemeMetric.h"
|
2004-03-29 09:44:00 +00:00
|
|
|
#include "EnumHelper.h"
|
2004-05-23 00:53:20 +00:00
|
|
|
#include "Foreach.h"
|
2005-02-18 12:06:19 +00:00
|
|
|
#include "LuaManager.h"
|
2005-02-22 23:11:59 +00:00
|
|
|
#include "GameManager.h"
|
2005-03-25 20:01:51 +00:00
|
|
|
#include <float.h>
|
2003-02-23 23:29:22 +00:00
|
|
|
|
2005-05-31 06:27:37 +00:00
|
|
|
#include "LuaFunctions.h"
|
2006-01-07 04:11:29 +00:00
|
|
|
#include "LocalizedString.h"
|
2005-06-24 06:06:16 +00:00
|
|
|
|
2006-01-22 01:00:06 +00:00
|
|
|
const RString RANKING_TO_FILL_IN_MARKER[NUM_PLAYERS] = {"#P1#","#P2#"};
|
2003-02-05 19:48:02 +00:00
|
|
|
|
2006-01-22 01:00:06 +00:00
|
|
|
extern const RString GROUP_ALL = "---Group All---";
|
2005-06-24 06:06:16 +00:00
|
|
|
|
2006-01-04 22:30:51 +00:00
|
|
|
static const char *RadarCategoryNames[] = {
|
2004-03-25 06:21:58 +00:00
|
|
|
"Stream",
|
|
|
|
|
"Voltage",
|
|
|
|
|
"Air",
|
|
|
|
|
"Freeze",
|
|
|
|
|
"Chaos",
|
2005-12-24 20:18:56 +00:00
|
|
|
"TapsAndHolds",
|
2004-03-25 06:21:58 +00:00
|
|
|
"Jumps",
|
|
|
|
|
"Holds",
|
|
|
|
|
"Mines",
|
|
|
|
|
"Hands",
|
2005-04-25 09:35:22 +00:00
|
|
|
"Rolls"
|
2004-03-12 08:31:40 +00:00
|
|
|
};
|
2006-01-07 04:11:29 +00:00
|
|
|
XToString( RadarCategory, NUM_RadarCategory );
|
|
|
|
|
XToLocalizedString( RadarCategory );
|
|
|
|
|
LuaFunction( RadarCategoryToLocalizedString, RadarCategoryToLocalizedString((RadarCategory) IArg(1)) );
|
2004-03-12 08:31:40 +00:00
|
|
|
|
2005-10-30 04:06:04 +00:00
|
|
|
static void LuaRadarCategory(lua_State* L)
|
|
|
|
|
{
|
|
|
|
|
FOREACH_RadarCategory( rc )
|
|
|
|
|
{
|
2006-01-22 01:00:06 +00:00
|
|
|
RString s = RadarCategoryToString( rc );
|
2005-12-24 20:18:56 +00:00
|
|
|
LUA->SetGlobal( "RadarCategory_"+s, rc );
|
2005-10-30 04:06:04 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
REGISTER_WITH_LUA_FUNCTION( LuaRadarCategory );
|
2004-03-12 08:31:40 +00:00
|
|
|
|
2005-02-23 05:02:28 +00:00
|
|
|
static void LuaStepsType(lua_State* L)
|
2005-02-22 23:11:59 +00:00
|
|
|
{
|
|
|
|
|
FOREACH_StepsType( st )
|
|
|
|
|
{
|
2006-01-22 01:00:06 +00:00
|
|
|
RString s = GAMEMAN->StepsTypeToString( st );
|
2005-02-22 23:11:59 +00:00
|
|
|
s.MakeUpper();
|
|
|
|
|
s.Replace('-','_');
|
|
|
|
|
LUA->SetGlobal( "STEPS_TYPE_"+s, st );
|
|
|
|
|
}
|
2005-08-03 03:13:55 +00:00
|
|
|
LUA->SetGlobal( "STEPS_TYPE_INVALID", STEPS_TYPE_INVALID );
|
2005-02-22 23:11:59 +00:00
|
|
|
}
|
|
|
|
|
REGISTER_WITH_LUA_FUNCTION( LuaStepsType );
|
|
|
|
|
|
|
|
|
|
|
2006-01-04 22:30:51 +00:00
|
|
|
static const char *PlayModeNames[] = {
|
2004-06-11 06:05:35 +00:00
|
|
|
"Regular",
|
2004-03-25 06:21:58 +00:00
|
|
|
"Nonstop",
|
|
|
|
|
"Oni",
|
|
|
|
|
"Endless",
|
|
|
|
|
"Battle",
|
|
|
|
|
"Rave",
|
2004-03-12 08:31:40 +00:00
|
|
|
};
|
2006-01-07 04:11:29 +00:00
|
|
|
XToString( PlayMode, NUM_PlayMode );
|
|
|
|
|
XToLocalizedString( PlayMode );
|
2004-03-12 08:31:40 +00:00
|
|
|
StringToX( PlayMode );
|
2005-05-31 06:27:37 +00:00
|
|
|
LuaXToString( PlayMode );
|
2006-01-07 04:11:29 +00:00
|
|
|
LuaFunction( PlayModeToLocalizedString, PlayModeToLocalizedString((PlayMode) IArg(1)) );
|
|
|
|
|
LuaXType( PlayMode, NUM_PlayMode, "PLAY_MODE_", true )
|
2003-01-24 02:43:07 +00:00
|
|
|
|
2004-08-30 06:41:56 +00:00
|
|
|
RankingCategory AverageMeterToRankingCategory( int iAverageMeter )
|
2003-01-24 02:43:07 +00:00
|
|
|
{
|
2004-08-30 06:45:43 +00:00
|
|
|
if( iAverageMeter <= 3 ) return RANKING_A;
|
|
|
|
|
else if( iAverageMeter <= 6 ) return RANKING_B;
|
|
|
|
|
else if( iAverageMeter <= 9 ) return RANKING_C;
|
2003-01-26 07:33:03 +00:00
|
|
|
else return RANKING_D;
|
2004-02-22 03:20:21 +00:00
|
|
|
}
|
2003-01-24 02:43:07 +00:00
|
|
|
|
2004-02-22 03:20:21 +00:00
|
|
|
|
2006-01-04 22:30:51 +00:00
|
|
|
static const char *RankingCategoryNames[] = {
|
2004-03-12 08:31:40 +00:00
|
|
|
"a",
|
|
|
|
|
"b",
|
|
|
|
|
"c",
|
|
|
|
|
"d",
|
|
|
|
|
};
|
2005-03-05 21:50:33 +00:00
|
|
|
XToString( RankingCategory, NUM_RANKING_CATEGORIES );
|
2004-03-12 08:31:40 +00:00
|
|
|
StringToX( RankingCategory );
|
2003-01-24 02:43:07 +00:00
|
|
|
|
2003-06-16 17:28:58 +00:00
|
|
|
|
2006-01-04 22:30:51 +00:00
|
|
|
static const char *PlayerControllerNames[] = {
|
2005-05-18 07:15:56 +00:00
|
|
|
"Human",
|
|
|
|
|
"Autoplay",
|
|
|
|
|
"Cpu",
|
|
|
|
|
};
|
2006-01-08 18:40:20 +00:00
|
|
|
XToString( PlayerController, NUM_PlayerController );
|
|
|
|
|
XToLocalizedString( PlayerController );
|
2005-05-18 07:15:56 +00:00
|
|
|
|
|
|
|
|
|
2006-01-04 22:30:51 +00:00
|
|
|
static const char *CoinModeNames[] = {
|
2004-03-12 08:31:40 +00:00
|
|
|
"home",
|
|
|
|
|
"pay",
|
|
|
|
|
"free",
|
|
|
|
|
};
|
2005-03-05 21:50:33 +00:00
|
|
|
XToString( CoinMode, NUM_COIN_MODES );
|
2005-05-06 19:51:29 +00:00
|
|
|
static void LuaCoinMode(lua_State* L)
|
|
|
|
|
{
|
|
|
|
|
FOREACH_CoinMode( i )
|
|
|
|
|
{
|
2006-01-22 01:00:06 +00:00
|
|
|
RString s = CoinModeNames[i];
|
2005-05-06 19:51:29 +00:00
|
|
|
s.MakeUpper();
|
2005-05-20 17:45:44 +00:00
|
|
|
LUA->SetGlobal( "COIN_MODE_"+s, i );
|
2005-05-06 19:51:29 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
REGISTER_WITH_LUA_FUNCTION( LuaCoinMode );
|
2004-03-12 08:31:40 +00:00
|
|
|
|
|
|
|
|
|
2006-01-04 22:30:51 +00:00
|
|
|
static const char *PremiumNames[] = {
|
2005-01-04 10:51:25 +00:00
|
|
|
"none",
|
2005-05-20 08:03:01 +00:00
|
|
|
"double",
|
2005-01-04 10:51:25 +00:00
|
|
|
"joint",
|
|
|
|
|
};
|
2005-03-05 21:50:33 +00:00
|
|
|
XToString( Premium, NUM_PREMIUMS );
|
2005-05-20 08:03:01 +00:00
|
|
|
static void LuaPremium(lua_State* L)
|
|
|
|
|
{
|
|
|
|
|
FOREACH_Premium( i )
|
|
|
|
|
{
|
2006-01-22 01:00:06 +00:00
|
|
|
RString s = PremiumNames[i];
|
2005-05-20 08:03:01 +00:00
|
|
|
s.MakeUpper();
|
|
|
|
|
LUA->SetGlobal( "PREMIUM_"+s, i );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
REGISTER_WITH_LUA_FUNCTION( LuaPremium );
|
2005-01-04 10:51:25 +00:00
|
|
|
|
|
|
|
|
|
2006-01-04 22:30:51 +00:00
|
|
|
static const char *SortOrderNames[] = {
|
2004-12-04 22:41:34 +00:00
|
|
|
"Preferred",
|
|
|
|
|
"Group",
|
|
|
|
|
"Title",
|
2005-07-16 02:59:58 +00:00
|
|
|
"BPM",
|
2004-12-04 22:41:34 +00:00
|
|
|
"Popularity",
|
2005-04-15 07:18:40 +00:00
|
|
|
"TopGrades",
|
2004-12-04 22:41:34 +00:00
|
|
|
"Artist",
|
2005-03-02 01:48:38 +00:00
|
|
|
"Genre",
|
2004-12-04 22:41:34 +00:00
|
|
|
"EasyMeter",
|
|
|
|
|
"MediumMeter",
|
|
|
|
|
"HardMeter",
|
|
|
|
|
"ChallengeMeter",
|
2005-04-15 07:18:40 +00:00
|
|
|
"ModeMenu",
|
|
|
|
|
"AllCourses",
|
2004-12-04 22:41:34 +00:00
|
|
|
"Nonstop",
|
|
|
|
|
"Oni",
|
|
|
|
|
"Endless",
|
|
|
|
|
"Roulette",
|
2003-07-20 06:26:29 +00:00
|
|
|
};
|
2005-03-05 21:50:33 +00:00
|
|
|
XToString( SortOrder, NUM_SORT_ORDERS );
|
2004-03-12 08:31:40 +00:00
|
|
|
StringToX( SortOrder );
|
|
|
|
|
|
2005-04-15 07:18:40 +00:00
|
|
|
static void LuaSortOrder(lua_State* L)
|
|
|
|
|
{
|
|
|
|
|
FOREACH_SortOrder( so )
|
|
|
|
|
{
|
2006-01-22 01:00:06 +00:00
|
|
|
RString s = SortOrderToString( so );
|
2005-04-15 07:18:40 +00:00
|
|
|
|
|
|
|
|
// [uppercase] -> _[uppercase]
|
|
|
|
|
for( unsigned i=0; i<s.size(); i++ )
|
|
|
|
|
{
|
|
|
|
|
if( isupper(s[i]) )
|
|
|
|
|
{
|
|
|
|
|
s.insert( s.begin()+i, '_' );
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
s.MakeUpper();
|
|
|
|
|
LUA->SetGlobal( "SORT"+s, so );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
REGISTER_WITH_LUA_FUNCTION( LuaSortOrder );
|
|
|
|
|
|
2004-03-12 08:31:40 +00:00
|
|
|
|
2006-01-04 22:30:51 +00:00
|
|
|
static const char *TapNoteScoreNames[] = {
|
2004-03-12 08:31:40 +00:00
|
|
|
"None",
|
|
|
|
|
"HitMine",
|
2005-04-13 01:11:44 +00:00
|
|
|
"AvoidMine",
|
2004-03-12 08:31:40 +00:00
|
|
|
"Miss",
|
2005-10-09 04:30:59 +00:00
|
|
|
"W5",
|
|
|
|
|
"W4",
|
|
|
|
|
"W3",
|
|
|
|
|
"W2",
|
|
|
|
|
"W1",
|
2004-03-12 08:31:40 +00:00
|
|
|
};
|
2005-10-08 00:57:40 +00:00
|
|
|
XToString( TapNoteScore, NUM_TapNoteScore );
|
2006-01-22 01:00:06 +00:00
|
|
|
TapNoteScore StringToTapNoteScore( const RString &s )
|
2005-10-08 00:57:40 +00:00
|
|
|
{
|
|
|
|
|
// new style
|
2005-10-09 04:30:59 +00:00
|
|
|
if ( s == "None" ) return TNS_None;
|
2005-10-08 00:57:40 +00:00
|
|
|
else if( s == "HitMine" ) return TNS_HitMine;
|
|
|
|
|
else if( s == "AvoidMine" ) return TNS_AvoidMine;
|
|
|
|
|
else if( s == "Miss" ) return TNS_Miss;
|
2005-10-09 04:30:59 +00:00
|
|
|
else if( s == "W5" ) return TNS_W5;
|
|
|
|
|
else if( s == "W4" ) return TNS_W4;
|
|
|
|
|
else if( s == "W3" ) return TNS_W3;
|
|
|
|
|
else if( s == "W2" ) return TNS_W2;
|
|
|
|
|
else if( s == "W1" ) return TNS_W1;
|
|
|
|
|
|
|
|
|
|
// for backward compatibility
|
|
|
|
|
else if( s == "Boo" ) return TNS_W5;
|
|
|
|
|
else if( s == "Good" ) return TNS_W4;
|
|
|
|
|
else if( s == "Great" ) return TNS_W3;
|
|
|
|
|
else if( s == "Perfect" ) return TNS_W2;
|
|
|
|
|
else if( s == "Marvelous" ) return TNS_W1;
|
2005-10-08 00:57:40 +00:00
|
|
|
|
|
|
|
|
return TNS_INVALID;
|
|
|
|
|
}
|
2006-01-07 04:11:29 +00:00
|
|
|
XToLocalizedString( TapNoteScore );
|
|
|
|
|
LuaFunction( TapNoteScoreToLocalizedString, TapNoteScoreToLocalizedString((TapNoteScore) IArg(1)) );
|
2005-06-16 07:37:22 +00:00
|
|
|
static void LuaTapNoteScores( lua_State* L )
|
|
|
|
|
{
|
|
|
|
|
FOREACH_TapNoteScore( i )
|
|
|
|
|
{
|
2006-01-22 01:00:06 +00:00
|
|
|
RString s = TapNoteScoreNames[i];
|
2005-06-16 07:37:22 +00:00
|
|
|
LUA->SetGlobal( "TNS_"+s, i );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
REGISTER_WITH_LUA_FUNCTION( LuaTapNoteScores );
|
2004-05-27 07:59:46 +00:00
|
|
|
|
|
|
|
|
|
2006-01-04 22:30:51 +00:00
|
|
|
static const char *HoldNoteScoreNames[] = {
|
2004-05-27 07:59:46 +00:00
|
|
|
"None",
|
2005-10-08 00:57:40 +00:00
|
|
|
"LetGo",
|
|
|
|
|
"Held",
|
2004-05-27 07:59:46 +00:00
|
|
|
};
|
2005-10-08 00:57:40 +00:00
|
|
|
XToString( HoldNoteScore, NUM_HoldNoteScore );
|
2006-01-22 01:00:06 +00:00
|
|
|
HoldNoteScore StringToHoldNoteScore( const RString &s )
|
2005-10-08 00:57:40 +00:00
|
|
|
{
|
|
|
|
|
// for backward compatibility
|
2005-10-09 04:30:59 +00:00
|
|
|
if ( s == "NG" ) return HNS_LetGo;
|
2005-10-08 00:57:40 +00:00
|
|
|
else if( s == "OK" ) return HNS_Held;
|
|
|
|
|
|
|
|
|
|
// new style
|
|
|
|
|
else if( s == "None" ) return HNS_None;
|
|
|
|
|
else if( s == "LetGo" ) return HNS_LetGo;
|
|
|
|
|
else if( s == "Held" ) return HNS_Held;
|
|
|
|
|
|
|
|
|
|
return HNS_INVALID;
|
|
|
|
|
}
|
2006-01-07 04:11:29 +00:00
|
|
|
XToLocalizedString( HoldNoteScore );
|
2005-06-16 07:37:22 +00:00
|
|
|
static void LuaHoldNoteScores( lua_State* L )
|
|
|
|
|
{
|
|
|
|
|
FOREACH_HoldNoteScore( i )
|
|
|
|
|
{
|
2006-01-22 01:00:06 +00:00
|
|
|
RString s = HoldNoteScoreNames[i];
|
2005-06-16 07:37:22 +00:00
|
|
|
LUA->SetGlobal( "HNS_"+s, i );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
REGISTER_WITH_LUA_FUNCTION( LuaHoldNoteScores );
|
2004-03-07 04:34:49 +00:00
|
|
|
|
|
|
|
|
|
2006-01-04 22:30:51 +00:00
|
|
|
static const char *MemoryCardStateNames[] = {
|
2004-03-12 08:31:40 +00:00
|
|
|
"ready",
|
2005-02-06 05:08:46 +00:00
|
|
|
"checking",
|
2004-03-12 08:31:40 +00:00
|
|
|
"late",
|
|
|
|
|
"error",
|
2005-02-06 05:08:46 +00:00
|
|
|
"removed",
|
2004-03-12 08:31:40 +00:00
|
|
|
"none",
|
|
|
|
|
};
|
2005-12-01 03:20:25 +00:00
|
|
|
XToString( MemoryCardState, NUM_MemoryCardState );
|
2004-03-07 04:34:49 +00:00
|
|
|
|
|
|
|
|
|
2006-01-04 22:30:51 +00:00
|
|
|
static const char *PerDifficultyAwardNames[] = {
|
2005-10-09 04:30:59 +00:00
|
|
|
"FullComboW3",
|
|
|
|
|
"SingleDigitW3",
|
|
|
|
|
"OneW3",
|
|
|
|
|
"FullComboW2",
|
|
|
|
|
"SingleDigitW2",
|
|
|
|
|
"OneW2",
|
|
|
|
|
"FullComboW1",
|
|
|
|
|
"Percent80W3",
|
|
|
|
|
"Percent90W3",
|
|
|
|
|
"Percent100W3",
|
2004-03-07 04:34:49 +00:00
|
|
|
};
|
2006-01-07 04:11:29 +00:00
|
|
|
XToString( PerDifficultyAward, NUM_PerDifficultyAward );
|
|
|
|
|
XToLocalizedString( PerDifficultyAward );
|
2004-03-07 04:34:49 +00:00
|
|
|
StringToX( PerDifficultyAward );
|
2006-01-07 04:11:29 +00:00
|
|
|
LuaFunction( PerDifficultyAwardToLocalizedString, PerDifficultyAwardToLocalizedString((PerDifficultyAward) IArg(1)) );
|
2005-08-30 04:30:08 +00:00
|
|
|
static void LuaPerDifficultyAward( lua_State* L )
|
|
|
|
|
{
|
|
|
|
|
FOREACH_PerDifficultyAward( i )
|
|
|
|
|
LUA->SetGlobal( PerDifficultyAwardNames[i], i );
|
|
|
|
|
}
|
|
|
|
|
REGISTER_WITH_LUA_FUNCTION( LuaPerDifficultyAward );
|
2004-03-12 08:31:40 +00:00
|
|
|
|
|
|
|
|
// Numbers are intentially not at the front of these strings so that the
|
|
|
|
|
// strings can be used as XML entity names.
|
|
|
|
|
// Numbers are intentially not at the back so that "1000" and "10000" don't
|
|
|
|
|
// conflict when searching for theme elements.
|
2006-01-04 22:30:51 +00:00
|
|
|
static const char *PeakComboAwardNames[] = {
|
2004-03-07 04:34:49 +00:00
|
|
|
"Peak1000Combo",
|
|
|
|
|
"Peak2000Combo",
|
|
|
|
|
"Peak3000Combo",
|
|
|
|
|
"Peak4000Combo",
|
|
|
|
|
"Peak5000Combo",
|
|
|
|
|
"Peak6000Combo",
|
|
|
|
|
"Peak7000Combo",
|
|
|
|
|
"Peak8000Combo",
|
|
|
|
|
"Peak9000Combo",
|
|
|
|
|
"Peak10000Combo",
|
|
|
|
|
};
|
2006-01-07 04:11:29 +00:00
|
|
|
XToString( PeakComboAward, NUM_PeakComboAward );
|
|
|
|
|
XToLocalizedString( PeakComboAward );
|
2004-03-07 04:34:49 +00:00
|
|
|
StringToX( PeakComboAward );
|
2006-01-07 04:11:29 +00:00
|
|
|
LuaFunction( PeakComboAwardToLocalizedString, PeakComboAwardToLocalizedString((PeakComboAward) IArg(1)) );
|
2005-08-30 04:30:08 +00:00
|
|
|
static void LuaPeakComboAward( lua_State* L )
|
|
|
|
|
{
|
|
|
|
|
FOREACH_PeakComboAward( i )
|
|
|
|
|
LUA->SetGlobal( PeakComboAwardNames[i], i );
|
|
|
|
|
}
|
|
|
|
|
REGISTER_WITH_LUA_FUNCTION( LuaPeakComboAward );
|
2004-05-11 06:10:21 +00:00
|
|
|
|
|
|
|
|
LuaXToString( Difficulty );
|
|
|
|
|
LuaStringToX( Difficulty );
|
2004-05-23 00:53:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
void DisplayBpms::Add( float f )
|
|
|
|
|
{
|
|
|
|
|
vfBpms.push_back( f );
|
|
|
|
|
}
|
|
|
|
|
|
2004-11-30 07:56:01 +00:00
|
|
|
float DisplayBpms::GetMin() const
|
2004-05-23 00:53:20 +00:00
|
|
|
{
|
2005-03-25 20:01:51 +00:00
|
|
|
float fMin = FLT_MAX;
|
2004-05-23 00:53:20 +00:00
|
|
|
FOREACH_CONST( float, vfBpms, f )
|
|
|
|
|
{
|
|
|
|
|
if( *f != -1 )
|
|
|
|
|
fMin = min( fMin, *f );
|
|
|
|
|
}
|
2005-03-25 20:01:51 +00:00
|
|
|
if( fMin == FLT_MAX )
|
2004-05-23 00:53:20 +00:00
|
|
|
return 0;
|
|
|
|
|
else
|
|
|
|
|
return fMin;
|
|
|
|
|
}
|
|
|
|
|
|
2004-11-30 07:56:01 +00:00
|
|
|
float DisplayBpms::GetMax() const
|
2004-05-23 00:53:20 +00:00
|
|
|
{
|
|
|
|
|
float fMax = 0;
|
|
|
|
|
FOREACH_CONST( float, vfBpms, f )
|
|
|
|
|
{
|
|
|
|
|
if( *f != -1 )
|
|
|
|
|
fMax = max( fMax, *f );
|
|
|
|
|
}
|
|
|
|
|
return fMax;
|
|
|
|
|
}
|
|
|
|
|
|
2004-11-30 07:56:01 +00:00
|
|
|
bool DisplayBpms::BpmIsConstant() const
|
2004-05-23 00:53:20 +00:00
|
|
|
{
|
2004-11-30 07:56:01 +00:00
|
|
|
return fabsf( GetMin() - GetMax() ) < 0.001f;
|
2004-05-23 00:53:20 +00:00
|
|
|
}
|
|
|
|
|
|
2005-03-10 22:54:55 +00:00
|
|
|
bool DisplayBpms::IsSecret() const
|
2004-05-23 00:53:20 +00:00
|
|
|
{
|
|
|
|
|
FOREACH_CONST( float, vfBpms, f )
|
|
|
|
|
{
|
|
|
|
|
if( *f == -1 )
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2004-05-31 22:42:12 +00:00
|
|
|
|
2006-01-04 22:30:51 +00:00
|
|
|
static const char *StyleTypeNames[] = {
|
2004-11-07 05:49:06 +00:00
|
|
|
"OnePlayerOneSide",
|
|
|
|
|
"TwoPlayersTwoSides",
|
|
|
|
|
"OnePlayerTwoSides",
|
|
|
|
|
};
|
2005-03-05 21:50:33 +00:00
|
|
|
XToString( StyleType, NUM_STYLE_TYPES );
|
2004-11-07 05:49:06 +00:00
|
|
|
StringToX( StyleType );
|
|
|
|
|
|
2005-02-06 05:15:57 +00:00
|
|
|
|
2006-01-04 22:30:51 +00:00
|
|
|
static const char *MenuDirNames[] = {
|
2005-02-06 05:15:57 +00:00
|
|
|
"Up",
|
|
|
|
|
"Down",
|
|
|
|
|
"Left",
|
|
|
|
|
"Right",
|
|
|
|
|
"Auto",
|
|
|
|
|
};
|
2005-03-05 21:50:33 +00:00
|
|
|
XToString( MenuDir, NUM_MENU_DIRS );
|
2005-02-17 19:36:10 +00:00
|
|
|
|
|
|
|
|
|
2006-01-04 22:30:51 +00:00
|
|
|
static const char *GoalTypeNames[] = {
|
2005-02-17 19:36:10 +00:00
|
|
|
"Calories",
|
|
|
|
|
"Time",
|
|
|
|
|
"None",
|
|
|
|
|
};
|
2005-03-05 21:50:33 +00:00
|
|
|
XToString( GoalType, NUM_GOAL_TYPES );
|
2005-02-17 19:36:10 +00:00
|
|
|
StringToX( GoalType );
|
2005-02-23 05:02:28 +00:00
|
|
|
static void LuaGoalType(lua_State* L)
|
2005-02-18 12:06:19 +00:00
|
|
|
{
|
|
|
|
|
FOREACH_GoalType( gt )
|
|
|
|
|
{
|
2006-01-22 01:00:06 +00:00
|
|
|
RString s = GoalTypeNames[gt];
|
2005-02-18 12:06:19 +00:00
|
|
|
s.MakeUpper();
|
2005-02-19 01:02:15 +00:00
|
|
|
LUA->SetGlobal( "GOAL_"+s, gt );
|
2005-02-18 12:06:19 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
REGISTER_WITH_LUA_FUNCTION( LuaGoalType );
|
2005-02-06 05:15:57 +00:00
|
|
|
|
|
|
|
|
|
2006-01-04 22:30:51 +00:00
|
|
|
static const char *StageNames[] = {
|
2005-05-06 10:48:32 +00:00
|
|
|
"1",
|
|
|
|
|
"2",
|
|
|
|
|
"3",
|
|
|
|
|
"4",
|
|
|
|
|
"5",
|
|
|
|
|
"6",
|
|
|
|
|
"Final",
|
|
|
|
|
"Extra1",
|
|
|
|
|
"Extra2",
|
|
|
|
|
"Nonstop",
|
|
|
|
|
"Oni",
|
|
|
|
|
"Endless",
|
|
|
|
|
"Event",
|
|
|
|
|
"Demo",
|
|
|
|
|
};
|
|
|
|
|
XToString( Stage, NUM_STAGES );
|
2005-09-08 06:07:38 +00:00
|
|
|
static void LuaStage(lua_State* L)
|
|
|
|
|
{
|
|
|
|
|
FOREACH_Stage( st )
|
|
|
|
|
{
|
2006-01-22 01:00:06 +00:00
|
|
|
RString s = StageNames[st];
|
2005-09-08 06:07:38 +00:00
|
|
|
s.MakeUpper();
|
|
|
|
|
LUA->SetGlobal( "STAGE_"+s, st );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
REGISTER_WITH_LUA_FUNCTION( LuaStage );
|
|
|
|
|
LuaXToString( Stage );
|
2005-05-06 10:48:32 +00:00
|
|
|
|
|
|
|
|
|
2004-05-31 22:42:12 +00:00
|
|
|
/*
|
|
|
|
|
* (c) 2001-2004 Chris Danford
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
|
* copy of this software and associated documentation files (the
|
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
|
* distribute, and/or sell copies of the Software, and to permit persons to
|
|
|
|
|
* whom the Software is furnished to do so, provided that the above
|
|
|
|
|
* copyright notice(s) and this permission notice appear in all copies of
|
|
|
|
|
* the Software and that both the above copyright notice(s) and this
|
|
|
|
|
* permission notice appear in supporting documentation.
|
|
|
|
|
*
|
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
|
|
|
|
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
|
|
|
|
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
|
|
|
|
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
|
|
|
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
|
|
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
|
|
* PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
*/
|