From cc49e8d56d3e346699241cfc8ad9b500d6787c44 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Tue, 26 Sep 2006 09:09:38 +0000 Subject: [PATCH] use bound types --- stepmania/Themes/default/metrics.ini | 4 ++-- stepmania/src/Actor.cpp | 33 +++------------------------- stepmania/src/Actor.h | 3 --- 3 files changed, 5 insertions(+), 35 deletions(-) diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index 30bead218c..26c11fdd06 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -470,8 +470,8 @@ StageOnCommand=draworder,101;bounceend,0.5;addx,SCREEN_WIDTH*0.6 StageOffCommand=bouncebegin,0.5;addx,-SCREEN_WIDTH*0.6 CDTitleX=-170 CDTitleY=SCREEN_CENTER_Y-98 -CDTitleFrontCommand=roll,1;spin;effectmagnitude,0,150,0;cullmode,back; -CDTitleBackCommand=roll,1;spin;effectmagnitude,0,150,0;cullmode,front;diffuse,#606060; +CDTitleFrontCommand=roll,1;spin;effectmagnitude,0,150,0;cullmode,"CullMode_Back"; +CDTitleBackCommand=roll,1;spin;effectmagnitude,0,150,0;cullmode,"CullMode_Front";diffuse,#606060; CDTitleOnCommand=bounceend,0.5;addx,SCREEN_WIDTH*0.6;draworder,101 CDTitleOffCommand=bouncebegin,0.5;addx,-SCREEN_WIDTH*0.6 ScoreFrameP1X=SCREEN_CENTER_X-265+SCREEN_WIDTH*0.6 diff --git a/stepmania/src/Actor.cpp b/stepmania/src/Actor.cpp index bbc2751f06..f40b895d10 100644 --- a/stepmania/src/Actor.cpp +++ b/stepmania/src/Actor.cpp @@ -1182,33 +1182,6 @@ void Actor::TweenState::MakeWeightedAverage( TweenState& average_out, const Twee average_out.aux = lerp( fPercentBetween, ts1.aux, ts2.aux ); } -void Actor::SetBlendModeString( const RString &s ) -{ - if (s.EqualsNoCase("normal")) this->SetBlendMode( BLEND_NORMAL ); - else if(s.EqualsNoCase("add")) this->SetBlendMode( BLEND_ADD ); - else if(s.EqualsNoCase("weightedmultiply")) this->SetBlendMode( BLEND_WEIGHTED_MULTIPLY ); - else if(s.EqualsNoCase("invertdest")) this->SetBlendMode( BLEND_INVERT_DEST ); - else if(s.EqualsNoCase("noeffect")) this->SetBlendMode( BLEND_NO_EFFECT ); - else ASSERT(0); -} - -void Actor::SetCullModeString( const RString &s ) -{ - if (s.EqualsNoCase("back")) this->SetCullMode( CULL_BACK ); - else if(s.EqualsNoCase("front")) this->SetCullMode( CULL_FRONT ); - else if(s.EqualsNoCase("none")) this->SetCullMode( CULL_NONE ); - else ASSERT(0); -} - -void Actor::SetZTestModeString( const RString &s ) -{ - // for metrics backward compatibility - if(s.EqualsNoCase("off")) this->SetZTestMode( ZTEST_OFF ); - else if(s.EqualsNoCase("writeonpass")) this->SetZTestMode( ZTEST_WRITE_ON_PASS ); - else if(s.EqualsNoCase("writeonfail")) this->SetZTestMode( ZTEST_WRITE_ON_FAIL ); - else ASSERT(0); -} - void Actor::Sleep( float time ) { BeginTweening( time, TWEEN_LINEAR ); @@ -1447,15 +1420,15 @@ public: static int setstate( T* p, lua_State *L ) { p->SetState(IArg(1)); return 0; } static int texturewrapping( T* p, lua_State *L ) { p->SetTextureWrapping(!!IArg(1)); return 0; } static int additiveblend( T* p, lua_State *L ) { p->SetBlendMode(!!IArg(1) ? BLEND_ADD : BLEND_NORMAL); return 0; } - static int blend( T* p, lua_State *L ) { p->SetBlendModeString(SArg(1)); return 0; } + static int blend( T* p, lua_State *L ) { p->SetBlendMode( Enum::Check(L, 1) ); return 0; } static int zbuffer( T* p, lua_State *L ) { p->SetUseZBuffer(!!IArg(1)); return 0; } static int ztest( T* p, lua_State *L ) { p->SetZTestMode((!!IArg(1))?ZTEST_WRITE_ON_PASS:ZTEST_OFF); return 0; } - static int ztestmode( T* p, lua_State *L ) { p->SetZTestModeString(SArg(1)); return 0; } + static int ztestmode( T* p, lua_State *L ) { p->SetZTestMode( Enum::Check(L, 1) ); return 0; } static int zwrite( T* p, lua_State *L ) { p->SetZWrite(!!IArg(1)); return 0; } static int zbias( T* p, lua_State *L ) { p->SetZBias(FArg(1)); return 0; } static int clearzbuffer( T* p, lua_State *L ) { p->SetClearZBuffer(!!IArg(1)); return 0; } static int backfacecull( T* p, lua_State *L ) { p->SetCullMode((!!IArg(1)) ? CULL_BACK : CULL_NONE); return 0; } - static int cullmode( T* p, lua_State *L ) { p->SetCullModeString(SArg(1)); return 0; } + static int cullmode( T* p, lua_State *L ) { p->SetCullMode( Enum::Check(L, 1)); return 0; } static int visible( T* p, lua_State *L ) { p->SetVisible(!!IArg(1)); return 0; } static int hidden( T* p, lua_State *L ) { p->SetHidden(!!IArg(1)); return 0; } static int hibernate( T* p, lua_State *L ) { p->SetHibernate(FArg(1)); return 0; } diff --git a/stepmania/src/Actor.h b/stepmania/src/Actor.h index 7efa049be8..220b411003 100644 --- a/stepmania/src/Actor.h +++ b/stepmania/src/Actor.h @@ -314,16 +314,13 @@ public: // render states // void SetBlendMode( BlendMode mode ) { m_BlendMode = mode; } - void SetBlendModeString( const RString &s ); // convenience void SetTextureWrapping( bool b ) { m_bTextureWrapping = b; } void SetClearZBuffer( bool b ) { m_bClearZBuffer = b; } void SetUseZBuffer( bool b ) { SetZTestMode(b?ZTEST_WRITE_ON_PASS:ZTEST_OFF); SetZWrite(b); } virtual void SetZTestMode( ZTestMode mode ) { m_ZTestMode = mode; } - void SetZTestModeString( const RString &s ); // convenience virtual void SetZWrite( bool b ) { m_bZWrite = b; } void SetZBias( float f ) { m_fZBias = f; } virtual void SetCullMode( CullMode mode ) { m_CullMode = mode; } - void SetCullModeString( const RString &s ); // convenience // // Lua