From ed19821e09096607b4d7603162d2d3291eb39c64 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Fri, 3 Dec 2004 05:19:46 +0000 Subject: [PATCH] rename: ActorCommand -> Command Make Command smaller and more generic. Parse arguments on use, not in Command::Load. --- stepmania/src/Actor.cpp | 182 +++++++++--------- stepmania/src/Actor.h | 12 +- stepmania/src/ActorCommands.h | 107 ---------- stepmania/src/ActorFrame.cpp | 16 +- stepmania/src/ActorFrame.h | 6 +- stepmania/src/ActorUtil.cpp | 6 +- stepmania/src/AttackDisplay.cpp | 2 +- stepmania/src/BGAnimation.cpp | 2 +- stepmania/src/BGAnimationLayer.cpp | 16 +- stepmania/src/Background.cpp | 8 +- stepmania/src/BitmapText.cpp | 14 +- stepmania/src/BitmapText.h | 2 +- stepmania/src/Combo.cpp | 28 +-- .../src/{ActorCommands.cpp => Command.cpp} | 93 +++++---- stepmania/src/Command.h | 96 +++++++++ stepmania/src/DifficultyDisplay.cpp | 10 +- stepmania/src/DifficultyList.cpp | 24 +-- stepmania/src/DifficultyList.h | 2 +- stepmania/src/GameCommand.h | 4 +- stepmania/src/GameState.cpp | 2 +- stepmania/src/GhostArrow.cpp | 2 +- stepmania/src/GhostArrow.h | 2 +- stepmania/src/GrooveRadar.cpp | 8 +- stepmania/src/GroupList.cpp | 40 ++-- stepmania/src/HoldGhostArrow.cpp | 2 +- stepmania/src/HoldJudgment.cpp | 20 +- stepmania/src/Judgment.cpp | 60 +++--- stepmania/src/LyricDisplay.cpp | 8 +- stepmania/src/Makefile.am | 5 +- stepmania/src/MenuTimer.cpp | 10 +- stepmania/src/Model.cpp | 12 +- stepmania/src/Model.h | 2 +- stepmania/src/MusicList.cpp | 4 +- stepmania/src/MusicWheel.cpp | 2 +- stepmania/src/NoteFieldPositioning.cpp | 8 +- stepmania/src/NoteFieldPositioning.h | 6 +- stepmania/src/NoteSkinManager.cpp | 4 +- stepmania/src/NoteSkinManager.h | 4 +- stepmania/src/PaneDisplay.cpp | 2 +- stepmania/src/Player.cpp | 10 +- stepmania/src/ProTimingDisplay.cpp | 18 +- stepmania/src/RageMath.cpp | 26 +-- stepmania/src/ReceptorArrow.cpp | 10 +- stepmania/src/ReceptorArrow.h | 2 +- stepmania/src/ScoreDisplayBattle.cpp | 4 +- stepmania/src/ScreenBranch.cpp | 2 +- stepmania/src/ScreenEvaluation.cpp | 6 +- stepmania/src/ScreenEz2SelectMusic.cpp | 34 ++-- stepmania/src/ScreenMapControllers.cpp | 12 +- stepmania/src/ScreenNameEntryTraditional.cpp | 16 +- stepmania/src/ScreenOptions.cpp | 8 +- stepmania/src/ScreenOptionsMaster.cpp | 20 +- stepmania/src/ScreenSelect.cpp | 4 +- stepmania/src/ScreenSelectCharacter.cpp | 28 +-- stepmania/src/ScreenSelectDifficulty.cpp | 10 +- stepmania/src/ScreenSelectMusic.cpp | 6 +- stepmania/src/ScreenSelectStyle.cpp | 8 +- stepmania/src/ScreenSystemLayer.cpp | 4 +- stepmania/src/ScreenTitleMenu.cpp | 12 +- stepmania/src/ScreenUnlock.cpp | 16 +- stepmania/src/Sprite.cpp | 22 +-- stepmania/src/Sprite.h | 2 +- stepmania/src/StepMania.dsp | 12 +- stepmania/src/StepMania.vcproj | 12 +- stepmania/src/TextBanner.cpp | 24 +-- stepmania/src/ThemeManager.cpp | 6 +- stepmania/src/ThemeManager.h | 6 +- 67 files changed, 592 insertions(+), 581 deletions(-) delete mode 100644 stepmania/src/ActorCommands.h rename stepmania/src/{ActorCommands.cpp => Command.cpp} (57%) create mode 100644 stepmania/src/Command.h diff --git a/stepmania/src/Actor.cpp b/stepmania/src/Actor.cpp index 2343dbbec5..f4a16db3b2 100644 --- a/stepmania/src/Actor.cpp +++ b/stepmania/src/Actor.cpp @@ -252,8 +252,8 @@ void Actor::UpdateTweening( float fDeltaTime ) m_start = m_current; // set the start position // Execute the command in this tween (if any). - const ActorCommand &command = TS.command; - if( !command.vTokens.empty() ) + const Command &command = TS.command; + if( command.m_vsArgs.size() ) this->HandleCommand( command ); } @@ -617,22 +617,22 @@ void Actor::AddRotationR( float rot ) RageQuatMultiply( &DestTweenState().quat, DestTweenState().quat, RageQuatFromR(rot) ); } -void Actor::Command( const ActorCommands &vCommands ) +void Actor::RunCommands( const Commands &vCommands ) { - FOREACH_CONST( ActorCommand, vCommands.v, c ) + FOREACH_CONST( Command, vCommands.v, c ) this->HandleCommand( *c ); } -void Actor::HandleCommand( const ActorCommand &command ) +void Actor::HandleCommand( const Command &command ) { - BeginHandleParams; + BeginHandleArgs; - const CString& sName = sParam(0); + const CString &sName = command.GetName(); #if defined(DEBUG) if( sName == "x" || sName == "y" ) // an absolute X or Y position { - if( isdigit(sParam(1)[0]) && sParam(1).Find('-') == -1 && sParam(1).Find('+') == -1 ) + if( isdigit(sArg(1)[0]) && sArg(1).Find('-') == -1 && sArg(1).Find('+') == -1 ) { LOG->Warn( "Command '%s' should contain a SCREEN_* constant", command.GetOriginalCommandString().c_str() ); } @@ -640,63 +640,63 @@ void Actor::HandleCommand( const ActorCommand &command ) #endif // Commands that go in the tweening queue: - if ( sName=="sleep" ) Sleep( fParam(1) ); - else if( sName=="linear" ) BeginTweening( fParam(1), TWEEN_LINEAR ); - else if( sName=="accelerate" ) BeginTweening( fParam(1), TWEEN_ACCELERATE ); - else if( sName=="decelerate" ) BeginTweening( fParam(1), TWEEN_DECELERATE ); - else if( sName=="bouncebegin" ) BeginTweening( fParam(1), TWEEN_BOUNCE_BEGIN ); - else if( sName=="bounceend" ) BeginTweening( fParam(1), TWEEN_BOUNCE_END ); - else if( sName=="spring" ) BeginTweening( fParam(1), TWEEN_SPRING ); + if ( sName=="sleep" ) Sleep( fArg(1) ); + else if( sName=="linear" ) BeginTweening( fArg(1), TWEEN_LINEAR ); + else if( sName=="accelerate" ) BeginTweening( fArg(1), TWEEN_ACCELERATE ); + else if( sName=="decelerate" ) BeginTweening( fArg(1), TWEEN_DECELERATE ); + else if( sName=="bouncebegin" ) BeginTweening( fArg(1), TWEEN_BOUNCE_BEGIN ); + else if( sName=="bounceend" ) BeginTweening( fArg(1), TWEEN_BOUNCE_END ); + else if( sName=="spring" ) BeginTweening( fArg(1), TWEEN_SPRING ); else if( sName=="stoptweening" ) { StopTweening(); BeginTweening( 0.0001f, TWEEN_LINEAR ); } // Why BeginT again? -Chris else if( sName=="finishtweening" ) FinishTweening(); - else if( sName=="hurrytweening" ) HurryTweening( fParam(1) ); - else if( sName=="x" ) SetX( fParam(1) ); - else if( sName=="y" ) SetY( fParam(1) ); - else if( sName=="z" ) SetZ( fParam(1) ); - else if( sName=="addx" ) AddX( fParam(1) ); - else if( sName=="addy" ) AddY( fParam(1) ); - else if( sName=="addz" ) AddZ( fParam(1) ); - else if( sName=="zoom" ) SetZoom( fParam(1) ); - else if( sName=="zoomx" ) SetZoomX( fParam(1) ); - else if( sName=="zoomy" ) SetZoomY( fParam(1) ); - else if( sName=="zoomz" ) SetZoomZ( fParam(1) ); - else if( sName=="zoomtowidth" ) ZoomToWidth( fParam(1) ); - else if( sName=="zoomtoheight" ) ZoomToHeight( fParam(1) ); - else if( sName=="stretchto" ) StretchTo( RectF( fParam(1), fParam(2), fParam(3), fParam(4) ) ); - else if( sName=="cropleft" ) SetCropLeft( fParam(1) ); - else if( sName=="croptop" ) SetCropTop( fParam(1) ); - else if( sName=="cropright" ) SetCropRight( fParam(1) ); - else if( sName=="cropbottom" ) SetCropBottom( fParam(1) ); - else if( sName=="fadeleft" ) SetFadeLeft( fParam(1) ); - else if( sName=="fadetop" ) SetFadeTop( fParam(1) ); - else if( sName=="faderight" ) SetFadeRight( fParam(1) ); - else if( sName=="fadebottom" ) SetFadeBottom( fParam(1) ); - else if( sName=="fadecolor" ) SetFadeDiffuseColor( cParam(1) ); - else if( sName=="diffuse" ) SetDiffuse( cParam(1) ); - else if( sName=="diffuseleftedge" ) SetDiffuseLeftEdge( cParam(1) ); - else if( sName=="diffuserightedge" ) SetDiffuseRightEdge( cParam(1) ); - else if( sName=="diffusetopedge" ) SetDiffuseTopEdge( cParam(1) ); - else if( sName=="diffusebottomedge" ) SetDiffuseBottomEdge( cParam(1) ); + else if( sName=="hurrytweening" ) HurryTweening( fArg(1) ); + else if( sName=="x" ) SetX( fArg(1) ); + else if( sName=="y" ) SetY( fArg(1) ); + else if( sName=="z" ) SetZ( fArg(1) ); + else if( sName=="addx" ) AddX( fArg(1) ); + else if( sName=="addy" ) AddY( fArg(1) ); + else if( sName=="addz" ) AddZ( fArg(1) ); + else if( sName=="zoom" ) SetZoom( fArg(1) ); + else if( sName=="zoomx" ) SetZoomX( fArg(1) ); + else if( sName=="zoomy" ) SetZoomY( fArg(1) ); + else if( sName=="zoomz" ) SetZoomZ( fArg(1) ); + else if( sName=="zoomtowidth" ) ZoomToWidth( fArg(1) ); + else if( sName=="zoomtoheight" ) ZoomToHeight( fArg(1) ); + else if( sName=="stretchto" ) StretchTo( RectF( fArg(1), fArg(2), fArg(3), fArg(4) ) ); + else if( sName=="cropleft" ) SetCropLeft( fArg(1) ); + else if( sName=="croptop" ) SetCropTop( fArg(1) ); + else if( sName=="cropright" ) SetCropRight( fArg(1) ); + else if( sName=="cropbottom" ) SetCropBottom( fArg(1) ); + else if( sName=="fadeleft" ) SetFadeLeft( fArg(1) ); + else if( sName=="fadetop" ) SetFadeTop( fArg(1) ); + else if( sName=="faderight" ) SetFadeRight( fArg(1) ); + else if( sName=="fadebottom" ) SetFadeBottom( fArg(1) ); + else if( sName=="fadecolor" ) SetFadeDiffuseColor( cArg(1) ); + else if( sName=="diffuse" ) SetDiffuse( cArg(1) ); + else if( sName=="diffuseleftedge" ) SetDiffuseLeftEdge( cArg(1) ); + else if( sName=="diffuserightedge" ) SetDiffuseRightEdge( cArg(1) ); + else if( sName=="diffusetopedge" ) SetDiffuseTopEdge( cArg(1) ); + else if( sName=="diffusebottomedge" ) SetDiffuseBottomEdge( cArg(1) ); /* Add left/right/top/bottom for alpha if needed. */ - else if( sName=="diffusealpha" ) SetDiffuseAlpha( fParam(1) ); - else if( sName=="diffusecolor" ) SetDiffuseColor( cParam(1) ); - else if( sName=="glow" ) SetGlow( cParam(1) ); + else if( sName=="diffusealpha" ) SetDiffuseAlpha( fArg(1) ); + else if( sName=="diffusecolor" ) SetDiffuseColor( cArg(1) ); + else if( sName=="glow" ) SetGlow( cArg(1) ); else if( sName=="glowmode" ) { - if(!sParam(1).CompareNoCase("whiten")) + if(!sArg(1).CompareNoCase("whiten")) SetGlowMode( GLOW_WHITEN ); - else if(!sParam(1).CompareNoCase("brighten")) + else if(!sArg(1).CompareNoCase("brighten")) SetGlowMode( GLOW_BRIGHTEN ); else ASSERT(0); } - else if( sName=="rotationx" ) SetRotationX( fParam(1) ); - else if( sName=="rotationy" ) SetRotationY( fParam(1) ); - else if( sName=="rotationz" ) SetRotationZ( fParam(1) ); - else if( sName=="heading" ) AddRotationH( fParam(1) ); - else if( sName=="pitch" ) AddRotationP( fParam(1) ); - else if( sName=="roll" ) AddRotationR( fParam(1) ); - else if( sName=="shadowlength" ) SetShadowLength( fParam(1) ); - else if( sName=="horizalign" ) SetHorizAlign( sParam(1) ); - else if( sName=="vertalign" ) SetVertAlign( sParam(1) ); + else if( sName=="rotationx" ) SetRotationX( fArg(1) ); + else if( sName=="rotationy" ) SetRotationY( fArg(1) ); + else if( sName=="rotationz" ) SetRotationZ( fArg(1) ); + else if( sName=="heading" ) AddRotationH( fArg(1) ); + else if( sName=="pitch" ) AddRotationP( fArg(1) ); + else if( sName=="roll" ) AddRotationR( fArg(1) ); + else if( sName=="shadowlength" ) SetShadowLength( fArg(1) ); + else if( sName=="horizalign" ) SetHorizAlign( sArg(1) ); + else if( sName=="vertalign" ) SetVertAlign( sArg(1) ); else if( sName=="diffuseblink" ) SetEffectDiffuseBlink(); else if( sName=="diffuseshift" ) SetEffectDiffuseShift(); else if( sName=="glowblink" ) SetEffectGlowBlink(); @@ -709,45 +709,45 @@ void Actor::HandleCommand( const ActorCommand &command ) else if( sName=="spin" ) SetEffectSpin(); else if( sName=="vibrate" ) SetEffectVibrate(); else if( sName=="stopeffect" ) SetEffectNone(); - else if( sName=="effectcolor1" ) SetEffectColor1( cParam(1) ); - else if( sName=="effectcolor2" ) SetEffectColor2( cParam(1) ); - else if( sName=="effectperiod" ) SetEffectPeriod( fParam(1) ); - else if( sName=="effectoffset" ) SetEffectOffset( fParam(1) ); - else if( sName=="effectdelay" ) SetEffectDelay( fParam(1) ); - else if( sName=="effectclock" ) SetEffectClock( sParam(1) ); - else if( sName=="effectmagnitude" ) SetEffectMagnitude( RageVector3(fParam(1),fParam(2),fParam(3)) ); - else if( sName=="scaletocover" ) { RectF R(fParam(1), fParam(2), fParam(3), fParam(4)); ScaleToCover(R); } - else if( sName=="scaletofit" ) { RectF R(fParam(1), fParam(2), fParam(3), fParam(4)); ScaleToFitInside(R); } + else if( sName=="effectcolor1" ) SetEffectColor1( cArg(1) ); + else if( sName=="effectcolor2" ) SetEffectColor2( cArg(1) ); + else if( sName=="effectperiod" ) SetEffectPeriod( fArg(1) ); + else if( sName=="effectoffset" ) SetEffectOffset( fArg(1) ); + else if( sName=="effectdelay" ) SetEffectDelay( fArg(1) ); + else if( sName=="effectclock" ) SetEffectClock( sArg(1) ); + else if( sName=="effectmagnitude" ) SetEffectMagnitude( RageVector3(fArg(1),fArg(2),fArg(3)) ); + else if( sName=="scaletocover" ) { RectF R(fArg(1), fArg(2), fArg(3), fArg(4)); ScaleToCover(R); } + else if( sName=="scaletofit" ) { RectF R(fArg(1), fArg(2), fArg(3), fArg(4)); ScaleToFitInside(R); } // Commands that take effect immediately (ignoring the tweening queue): - else if( sName=="animate" ) EnableAnimation( bParam(1) ); + else if( sName=="animate" ) EnableAnimation( bArg(1) ); else if( sName=="play" ) EnableAnimation( true ); else if( sName=="pause" ) EnableAnimation( false ); - else if( sName=="setstate" ) SetState( iParam(1) ); - else if( sName=="texturewrapping" ) SetTextureWrapping( bParam(1) ); - else if( sName=="additiveblend" ) SetBlendMode( bParam(1) ? BLEND_ADD : BLEND_NORMAL ); - else if( sName=="blend" ) SetBlendMode( sParam(1) ); - else if( sName=="zbuffer" ) SetUseZBuffer( bParam(1) ); - else if( sName=="ztest" ) SetZTestMode( bParam(1)?ZTEST_WRITE_ON_PASS:ZTEST_OFF ); - else if( sName=="ztestmode" ) SetZTestMode( sParam(1) ); - else if( sName=="zwrite" ) SetZWrite( bParam(1) ); - else if( sName=="clearzbuffer" ) SetClearZBuffer( bParam(1) ); - else if( sName=="backfacecull" ) SetCullMode( bParam(1) ? CULL_BACK : CULL_NONE ); - else if( sName=="cullmode" ) SetCullMode( sParam(1) ); - else if( sName=="hidden" ) SetHidden( bParam(1) ); - else if( sName=="hibernate" ) SetHibernate( fParam(1) ); - else if( sName=="draworder" ) SetDrawOrder( iParam(1) ); - else if( sName=="playcommand" ) PlayCommand( sParam(1) ); + else if( sName=="setstate" ) SetState( iArg(1) ); + else if( sName=="texturewrapping" ) SetTextureWrapping( bArg(1) ); + else if( sName=="additiveblend" ) SetBlendMode( bArg(1) ? BLEND_ADD : BLEND_NORMAL ); + else if( sName=="blend" ) SetBlendMode( sArg(1) ); + else if( sName=="zbuffer" ) SetUseZBuffer( bArg(1) ); + else if( sName=="ztest" ) SetZTestMode( bArg(1)?ZTEST_WRITE_ON_PASS:ZTEST_OFF ); + else if( sName=="ztestmode" ) SetZTestMode( sArg(1) ); + else if( sName=="zwrite" ) SetZWrite( bArg(1) ); + else if( sName=="clearzbuffer" ) SetClearZBuffer( bArg(1) ); + else if( sName=="backfacecull" ) SetCullMode( bArg(1) ? CULL_BACK : CULL_NONE ); + else if( sName=="cullmode" ) SetCullMode( sArg(1) ); + else if( sName=="hidden" ) SetHidden( bArg(1) ); + else if( sName=="hibernate" ) SetHibernate( fArg(1) ); + else if( sName=="draworder" ) SetDrawOrder( iArg(1) ); + else if( sName=="playcommand" ) PlayCommand( sArg(1) ); else if( sName=="queuecommand" ) { - ActorCommand newcommand = command; - newcommand.vTokens.erase( newcommand.vTokens.begin() ); + Command newcommand = command; + newcommand.m_vsArgs.erase( newcommand.m_vsArgs.begin() ); QueueCommand( newcommand ); - return; // don't do parameter number checking + return; // don't do argument count checking } /* These are commands intended for a Sprite commands, but they will get * sent to all sub-actors (which aren't necessarily Sprites) on - * GainFocus and LoseFocus. So, don't run EndHandleParams + * GainFocus and LoseFocus. So, don't run EndHandleArgs * on these commands. */ else if( sName=="customtexturerect" || sName=="texcoordvelocity" || sName=="scaletoclipped" || sName=="stretchtexcoords" || sName=="position" || sName=="loop" || @@ -760,13 +760,13 @@ void Actor::HandleCommand( const ActorCommand &command ) Dialog::OK( sError ); } - EndHandleParams; + EndHandleArgs; } -float Actor::GetCommandsLengthSeconds( const ActorCommands &vCommands ) +float Actor::GetCommandsLengthSeconds( const Commands &vCommands ) { Actor temp; - temp.Command(vCommands); + temp.RunCommands(vCommands); return temp.GetTweenTimeLeft(); } @@ -785,7 +785,7 @@ float Actor::GetTweenTimeLeft() const /* This is a hack to change all tween states while leaving existing tweens alone. * - * Perhaps the regular Set methods should also take an optional parameter, eg. + * Perhaps the regular Set methods should also take an optional argument, eg. * "SET_TWEEN" (normal behavior) or "SET_GLOBAL" to set regardless of tweens. * That might be ugly, too. */ @@ -904,7 +904,7 @@ void Actor::Sleep( float time ) BeginTweening( 0, TWEEN_LINEAR ); } -void Actor::QueueCommand( ActorCommand command ) +void Actor::QueueCommand( Command command ) { BeginTweening( 0, TWEEN_LINEAR ); DestTweenState().command = command; diff --git a/stepmania/src/Actor.h b/stepmania/src/Actor.h index 9cc062e4c1..7366b18f16 100644 --- a/stepmania/src/Actor.h +++ b/stepmania/src/Actor.h @@ -4,7 +4,7 @@ #define ACTOR_H #include "RageTypes.h" -#include "ActorCommands.h" // for ActorCommand +#include "Command.h" #include #define DRAW_ORDER_BEFORE_EVERYTHING -100 @@ -49,7 +49,7 @@ public: RageColor diffuse[4]; RageColor glow; GlowMode glowmode; - ActorCommand command; // command to execute when this + Command command; // command to execute when this void Init(); static void MakeWeightedAverage( TweenState& average_out, const TweenState& ts1, const TweenState& ts2, float fPercentBetween ); @@ -186,7 +186,7 @@ public: void BeginTweening( float time, TweenType tt = TWEEN_LINEAR ); void StopTweening(); void Sleep( float time ); - void QueueCommand( ActorCommand command ); + void QueueCommand( Command command ); virtual void FinishTweening(); virtual void HurryTweening( float factor ); // Let ActorFrame and BGAnimation override @@ -305,9 +305,9 @@ public: // // Commands // - void Command( const ActorCommands &vCommands ); - virtual void HandleCommand( const ActorCommand &command ); // derivable - static float GetCommandsLengthSeconds( const ActorCommands &vCommands ); + void RunCommands( const Commands &vCommands ); + virtual void HandleCommand( const Command &command ); // derivable + static float GetCommandsLengthSeconds( const Commands &vCommands ); // // Animation diff --git a/stepmania/src/ActorCommands.h b/stepmania/src/ActorCommands.h deleted file mode 100644 index fa50be542d..0000000000 --- a/stepmania/src/ActorCommands.h +++ /dev/null @@ -1,107 +0,0 @@ -/* ActorCommands - Actor command parsing and reading helpers. */ - -#ifndef ActorCommands_H -#define ActorCommands_H - -#include "RageTypes.h" - -struct ActorCommandToken -{ - void Set( const CString &sParam ); // fill in all the different types - - CString s; - float f; - RageColor c; // HTML-type color which is packed into one parameter - // true if c is a valid HTML-type color. Otherwise, this value is the red component - // and the next 3 params are the other components. - bool bColorIsValid; - - operator const CString &() const { return s; }; - operator const float () const { return f; }; - operator const int () const { return (int)f; }; - operator const bool () const { return ((int)f)!=0; }; - operator const RageColor &() const { return c; }; -}; - -struct ActorCommand -{ - void Set( const CString &sCommand ); - - vector vTokens; - - CString GetOriginalCommandString() const; // for when reporting an error in number of params -}; - -struct ActorCommands -{ - vector v; -}; - -// Take a command list string and return pointers to each of the tokens in the -// string. sCommand list is a list of commands separated by ';'. -// TODO: This is expensive to do during the game. Eventually, -// move all calls to ParseActorCommands to happen during load, then execute -// from the parsed ActorCommand structures. -void ParseActorCommands( const CString &sCommands, ActorCommands &vCommandsOut ); -ActorCommands ParseActorCommands( const CString &sCommands ); - - -#define BeginHandleParams int iMaxIndexAccessed = 0; -#define sParam(i) (GetParam(command,i,iMaxIndexAccessed)) -#define fParam(i) (GetParam(command,i,iMaxIndexAccessed)) -#define iParam(i) (GetParam(command,i,iMaxIndexAccessed)) -#define bParam(i) (GetParam(command,i,iMaxIndexAccessed)) -#define cParam(i) (ColorParam(command,i,iMaxIndexAccessed)) -#define EndHandleParams if( iMaxIndexAccessed != (int)command.vTokens.size()-1 ) { IncorrectActorParametersWarning( command, iMaxIndexAccessed ); } -void IncorrectActorParametersWarning( const ActorCommand& command, int iMaxIndexAccessed ); - -template -inline T GetParam( const ActorCommand& command, int iIndex, int& iMaxIndexAccessedOut ) -{ - iMaxIndexAccessedOut = max( iIndex, iMaxIndexAccessedOut ); - if( iIndex < int(command.vTokens.size()) ) - { - return (T)command.vTokens[iIndex]; - } - else - { - ActorCommandToken pct; - pct.Set( "" ); - return (T)pct; - } -} - -inline RageColor ColorParam( const ActorCommand& command, int iIndex, int& iMaxIndexAccessed ) -{ - if( command.vTokens[iIndex].bColorIsValid ) - return GetParam(command,iIndex,iMaxIndexAccessed); - else - return RageColor( fParam(iIndex+0),fParam(iIndex+1),fParam(iIndex+2),fParam(iIndex+3) ); -} - -#endif - -/* - * (c) 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. - */ diff --git a/stepmania/src/ActorFrame.cpp b/stepmania/src/ActorFrame.cpp index 269b6f9622..e6af2abfb4 100644 --- a/stepmania/src/ActorFrame.cpp +++ b/stepmania/src/ActorFrame.cpp @@ -67,13 +67,13 @@ void ActorFrame::DrawPrimitives() m_SubActors[i]->Draw(); } -void ActorFrame::RunCommandOnChildren( const ActorCommands &cmd ) +void ActorFrame::RunCommandOnChildren( const Commands &cmd ) { for( unsigned i=0; iCommand( cmd ); + m_SubActors[i]->RunCommands( cmd ); } -void ActorFrame::RunCommandOnChildren( const ActorCommand &cmd ) +void ActorFrame::RunCommandOnChildren( const Command &cmd ) { for( unsigned i=0; iHandleCommand( cmd ); @@ -155,16 +155,16 @@ void ActorFrame::DeleteAllChildren() m_SubActors.clear(); } -void ActorFrame::HandleCommand( const ActorCommand &command ) +void ActorFrame::HandleCommand( const Command &command ) { - BeginHandleParams; + BeginHandleArgs; - const CString& sName = sParam(0); + const CString& sName = command.GetName(); do { if( sName=="propagate" ) { - m_bPropagateCommands = bParam(1); + m_bPropagateCommands = bArg(1); RunCommandOnChildren( command ); } else @@ -172,7 +172,7 @@ void ActorFrame::HandleCommand( const ActorCommand &command ) Actor::HandleCommand( command ); break; } - EndHandleParams; + EndHandleArgs; } while(0); /* By default, don't propograte most commands to children; it makes no sense diff --git a/stepmania/src/ActorFrame.h b/stepmania/src/ActorFrame.h index 6d6ab540d4..70b49b93d7 100644 --- a/stepmania/src/ActorFrame.h +++ b/stepmania/src/ActorFrame.h @@ -19,9 +19,9 @@ public: void DeleteAllChildren(); - virtual void RunCommandOnChildren( const ActorCommands &cmds ); /* but not on self */ - virtual void RunCommandOnChildren( const ActorCommand &cmd ); /* but not on self */ - virtual void HandleCommand( const ActorCommand &command ); // derivable + virtual void RunCommandOnChildren( const Commands &cmds ); /* but not on self */ + virtual void RunCommandOnChildren( const Command &cmd ); /* but not on self */ + virtual void HandleCommand( const Command &command ); // derivable virtual void Update( float fDeltaTime ); virtual void DrawPrimitives(); diff --git a/stepmania/src/ActorUtil.cpp b/stepmania/src/ActorUtil.cpp index ccfb94352a..226a5fb883 100644 --- a/stepmania/src/ActorUtil.cpp +++ b/stepmania/src/ActorUtil.cpp @@ -290,8 +290,8 @@ void UtilCommand( Actor& actor, const CString &sClassName, const CString &sComma // if( actor.GetHidden() ) // return 0; - ActorCommand ac; - ac.Set("playcommand,"+sCommandName); + Command ac; + ac.Load("playcommand,"+sCommandName); actor.HandleCommand( ac ); // HACK: It's very often that we command things to TweenOffScreen @@ -309,7 +309,7 @@ void UtilCommand( Actor& actor, const CString &sClassName, const CString &sComma sClassName.c_str(), sCommandName.c_str()) ); } - actor.Command( THEME->GetMetricA(sClassName,actor.GetID()+sCommandName+"Command") ); + actor.RunCommands( THEME->GetMetricA(sClassName,actor.GetID()+sCommandName+"Command") ); } void AutoActor::Load( const CString &sPath ) diff --git a/stepmania/src/AttackDisplay.cpp b/stepmania/src/AttackDisplay.cpp index b464c532e8..bccacd6f19 100644 --- a/stepmania/src/AttackDisplay.cpp +++ b/stepmania/src/AttackDisplay.cpp @@ -100,7 +100,7 @@ void AttackDisplay::SetAttack( const CString &sText ) m_sprAttack.SetDiffuseAlpha( 1 ); m_sprAttack.Load( path ); const CString sName = ssprintf( "%sP%i", sText.c_str(), m_PlayerNumber+1 ); - m_sprAttack.Command( THEME->GetMetricA("AttackDisplay", sName + "OnCommand" ) ); + m_sprAttack.RunCommands( THEME->GetMetricA("AttackDisplay", sName + "OnCommand" ) ); } /* diff --git a/stepmania/src/BGAnimation.cpp b/stepmania/src/BGAnimation.cpp index 59bb8265ee..b64bba3adb 100644 --- a/stepmania/src/BGAnimation.cpp +++ b/stepmania/src/BGAnimation.cpp @@ -178,7 +178,7 @@ void BGAnimation::LoadFromAniDir( CString sAniDir ) /* There's an InitCommand. Run it now. This can be used to eg. change Z to * modify draw order between BGAs in a Foreground. Most things should be done * in metrics.ini commands, not here. */ - this->Command( ParseActorCommands(sInitCommand) ); + this->RunCommands( ParseCommands(sInitCommand) ); } } else diff --git a/stepmania/src/BGAnimationLayer.cpp b/stepmania/src/BGAnimationLayer.cpp index 80057ba846..6ca1cf7730 100644 --- a/stepmania/src/BGAnimationLayer.cpp +++ b/stepmania/src/BGAnimationLayer.cpp @@ -991,10 +991,10 @@ void BGAnimationLayer::GainFocus( float fRate, bool bRewindMovie, bool bLoop ) // TODO: Don't special case subActor[0]. The movie layer should be set up with // a LoseFocusCommand that pauses, and a GainFocusCommand that plays. if( bRewindMovie ) - RunCommandOnChildren( ParseActorCommands("position,0") ); - RunCommandOnChildren( ParseActorCommands(ssprintf("loop,%i",bLoop)) ); - RunCommandOnChildren( ParseActorCommands("play") ); - RunCommandOnChildren( ParseActorCommands(ssprintf("rate,%f",fRate)) ); + RunCommandOnChildren( ParseCommands("position,0") ); + RunCommandOnChildren( ParseCommands(ssprintf("loop,%i",bLoop)) ); + RunCommandOnChildren( ParseCommands("play") ); + RunCommandOnChildren( ParseCommands(ssprintf("rate,%f",fRate)) ); if( m_fRepeatCommandEverySeconds == -1 ) // if not repeating { @@ -1003,7 +1003,7 @@ void BGAnimationLayer::GainFocus( float fRate, bool bRewindMovie, bool bLoop ) * should run OnCommand when they're actually displayed, when GainFocus * gets called. We've already run OnCommand; abort it so we don't run tweens * twice. */ - RunCommandOnChildren( ParseActorCommands("stoptweening") ); + RunCommandOnChildren( ParseCommands("stoptweening") ); PlayCommand( "On" ); } @@ -1017,7 +1017,7 @@ void BGAnimationLayer::LoseFocus() if( !m_SubActors.size() ) return; - RunCommandOnChildren( ParseActorCommands("pause") ); + RunCommandOnChildren( ParseCommands("pause") ); PlayCommand( "LoseFocus" ); } @@ -1025,7 +1025,7 @@ void BGAnimationLayer::LoseFocus() void BGAnimationLayer::PlayCommand( const CString &sCommandName ) { for( unsigned i=0; iCommand( ParseActorCommands("playcommand,"+sCommandName) ); + m_SubActors[i]->RunCommands( ParseCommands("playcommand,"+sCommandName) ); CString sKey = sCommandName; sKey.MakeLower(); @@ -1035,7 +1035,7 @@ void BGAnimationLayer::PlayCommand( const CString &sCommandName ) return; for( unsigned i=0; iCommand( ParseActorCommands(it->second) ); + m_SubActors[i]->RunCommands( ParseCommands(it->second) ); } /* diff --git a/stepmania/src/Background.cpp b/stepmania/src/Background.cpp index bd95301cc4..25d0c5cddc 100644 --- a/stepmania/src/Background.cpp +++ b/stepmania/src/Background.cpp @@ -28,7 +28,7 @@ ThemeMetric BOTTOM_EDGE ("Background","BottomEdge"); #define RECT_BACKGROUND RectF (LEFT_EDGE,TOP_EDGE,RIGHT_EDGE,BOTTOM_EDGE) ThemeMetric BLINK_DANGER_ALL ("Background","BlinkDangerAll"); ThemeMetric DANGER_ALL_IS_OPAQUE ("Background","DangerAllIsOpaque"); -ThemeMetric BRIGHTNESS_FADE_COMMAND ("Background","BrightnessFadeCommand"); +ThemeMetric BRIGHTNESS_FADE_COMMAND ("Background","BrightnessFadeCommand"); static float g_fBackgroundCenterWidth = 40; const CString STATIC_BACKGROUND = "static background"; @@ -435,9 +435,9 @@ void Background::LoadFromSong( const Song* pSong ) * may look something like "BGAnimation, BGAnimationLayer, Sprite" or it * may be deeper, like "BGAnimation, BGAnimationLayer, BGAnimation, * BGAnimationLayer, Sprite". */ - pBGA->Command( ParseActorCommands("propagate,1") ); - pBGA->Command( ParseActorCommands("effectclock,music") ); - pBGA->Command( ParseActorCommands("propagate,0") ); + pBGA->RunCommands( ParseCommands("propagate,1") ); + pBGA->RunCommands( ParseCommands("effectclock,music") ); + pBGA->RunCommands( ParseCommands("propagate,0") ); } } diff --git a/stepmania/src/BitmapText.cpp b/stepmania/src/BitmapText.cpp index 787e470e40..c5a1448aae 100644 --- a/stepmania/src/BitmapText.cpp +++ b/stepmania/src/BitmapText.cpp @@ -9,7 +9,7 @@ #include "ThemeManager.h" #include "GameConstantsAndTypes.h" #include "Font.h" -#include "ActorUtil.h" // for BeginHandleParams +#include "ActorUtil.h" // for BeginHandleArgs /* XXX: * We need some kind of font modifier string for metrics. For example, @@ -514,23 +514,23 @@ void BitmapText::SetVertAlign( VertAlign va ) BuildChars(); } -void BitmapText::HandleCommand( const ActorCommand &command ) +void BitmapText::HandleCommand( const Command &command ) { - BeginHandleParams; + BeginHandleArgs; - const CString& sName = sParam(0); + const CString& sName = command.GetName(); // Commands that go in the tweening queue: // Commands that take effect immediately (ignoring the tweening queue): - if( sName=="wrapwidthpixels" ) SetWrapWidthPixels( iParam(1) ); - else if( sName=="maxwidth" ) SetMaxWidth( fParam(1) ); + if( sName=="wrapwidthpixels" ) SetWrapWidthPixels( iArg(1) ); + else if( sName=="maxwidth" ) SetMaxWidth( fArg(1) ); else { Actor::HandleCommand( command ); return; } - EndHandleParams; + EndHandleArgs; } void BitmapText::SetWrapWidthPixels( int iWrapWidthPixels ) diff --git a/stepmania/src/BitmapText.h b/stepmania/src/BitmapText.h index bf8ebedae6..ca952a3f6d 100644 --- a/stepmania/src/BitmapText.h +++ b/stepmania/src/BitmapText.h @@ -37,7 +37,7 @@ public: /* Return true if the string 's' will use an alternate string, if available. */ bool StringWillUseAlternate(CString sText, CString sAlternateText) const; - virtual void HandleCommand( const ActorCommand &command ); + virtual void HandleCommand( const Command &command ); public: Font* m_pFont; diff --git a/stepmania/src/Combo.cpp b/stepmania/src/Combo.cpp index 12249ef85a..d3cfae50bc 100644 --- a/stepmania/src/Combo.cpp +++ b/stepmania/src/Combo.cpp @@ -21,10 +21,10 @@ ThemeMetric NUMBER_MAX_ZOOM ("Combo","NumberMaxZoom"); ThemeMetric NUMBER_MAX_ZOOM_AT ("Combo","NumberMaxZoomAt"); ThemeMetric PULSE_ZOOM ("Combo","PulseZoom"); ThemeMetric C_TWEEN_SECONDS ("Combo","TweenSeconds"); -ThemeMetric FULL_COMBO_GREATS_COMMAND ("Combo","FullComboGreatsCommand"); -ThemeMetric FULL_COMBO_PERFECTS_COMMAND ("Combo","FullComboPerfectsCommand"); -ThemeMetric FULL_COMBO_MARVELOUSES_COMMAND ("Combo","FullComboMarvelousesCommand"); -ThemeMetric FULL_COMBO_BROKEN_COMMAND ("Combo","FullComboBrokenCommand"); +ThemeMetric FULL_COMBO_GREATS_COMMAND ("Combo","FullComboGreatsCommand"); +ThemeMetric FULL_COMBO_PERFECTS_COMMAND ("Combo","FullComboPerfectsCommand"); +ThemeMetric FULL_COMBO_MARVELOUSES_COMMAND ("Combo","FullComboMarvelousesCommand"); +ThemeMetric FULL_COMBO_BROKEN_COMMAND ("Combo","FullComboBrokenCommand"); ThemeMetric SHOW_MISS_COMBO ("Combo","ShowMissCombo"); @@ -102,29 +102,29 @@ void Combo::SetCombo( int iCombo, int iMisses ) { if( g_CurStageStats.FullComboOfScore(m_PlayerNumber,TNS_MARVELOUS) ) { - sprLabel.Command( FULL_COMBO_MARVELOUSES_COMMAND ); - m_textNumber.Command( FULL_COMBO_MARVELOUSES_COMMAND ); + sprLabel.RunCommands( FULL_COMBO_MARVELOUSES_COMMAND ); + m_textNumber.RunCommands( FULL_COMBO_MARVELOUSES_COMMAND ); } else if( bPastMidpoint && g_CurStageStats.FullComboOfScore(m_PlayerNumber,TNS_PERFECT) ) { - sprLabel.Command( FULL_COMBO_PERFECTS_COMMAND ); - m_textNumber.Command( FULL_COMBO_PERFECTS_COMMAND ); + sprLabel.RunCommands( FULL_COMBO_PERFECTS_COMMAND ); + m_textNumber.RunCommands( FULL_COMBO_PERFECTS_COMMAND ); } else if( bPastMidpoint && g_CurStageStats.FullComboOfScore(m_PlayerNumber,TNS_GREAT) ) { - sprLabel.Command( FULL_COMBO_GREATS_COMMAND ); - m_textNumber.Command( FULL_COMBO_GREATS_COMMAND ); + sprLabel.RunCommands( FULL_COMBO_GREATS_COMMAND ); + m_textNumber.RunCommands( FULL_COMBO_GREATS_COMMAND ); } else { - sprLabel.Command( FULL_COMBO_BROKEN_COMMAND ); - m_textNumber.Command( FULL_COMBO_BROKEN_COMMAND ); + sprLabel.RunCommands( FULL_COMBO_BROKEN_COMMAND ); + m_textNumber.RunCommands( FULL_COMBO_BROKEN_COMMAND ); } } else { - sprLabel.Command( FULL_COMBO_BROKEN_COMMAND ); - m_textNumber.Command( FULL_COMBO_BROKEN_COMMAND ); + sprLabel.RunCommands( FULL_COMBO_BROKEN_COMMAND ); + m_textNumber.RunCommands( FULL_COMBO_BROKEN_COMMAND ); } } diff --git a/stepmania/src/ActorCommands.cpp b/stepmania/src/Command.cpp similarity index 57% rename from stepmania/src/ActorCommands.cpp rename to stepmania/src/Command.cpp index e19cc87f7b..eced90c352 100644 --- a/stepmania/src/ActorCommands.cpp +++ b/stepmania/src/Command.cpp @@ -1,77 +1,88 @@ #include "global.h" // testing updates -#include "ActorCommands.h" +#include "Command.h" #include "RageUtil.h" #include "RageLog.h" #include "arch/Dialog/Dialog.h" #include "LuaHelpers.h" -void IncorrectActorParametersWarning( const ActorCommand &command, int iMaxIndexAccessed ) +void IncorrectNumberArgsWarning( const Command &command, int iMaxIndexAccessed ) { - const CString sError = ssprintf( "Actor::HandleCommand: Wrong number of parameters in command '%s'. Expected %d but there are %u.", - command.GetOriginalCommandString().c_str(), iMaxIndexAccessed+1, unsigned(command.vTokens.size()) ); + const CString sError = ssprintf( "Actor::HandleCommand: Wrong number of arguments in command '%s'. Expected %d but there are %u.", + command.GetOriginalCommandString().c_str(), iMaxIndexAccessed+1, unsigned(command.m_vsArgs.size()) ); LOG->Warn( sError ); Dialog::OK( sError ); } -void ActorCommandToken::Set( const CString &sParam ) +CString Command::GetName() const +{ + if( m_vsArgs.empty() ) + return ""; + CString s = m_vsArgs[0]; + s.MakeLower(); + return s; +} + +Command::Arg Command::GetArg( unsigned index ) const +{ + Arg a; + if( index < m_vsArgs.size() ) + a.s = m_vsArgs[index]; + return a; +} + +Command::Arg::operator CString () +{ + return s; +} + +Command::Arg::operator float () { - s = sParam; - CString s = sParam; Lua::PrepareExpression( s ); // strip invalid chars - f = Lua::RunExpressionF( s ); - bColorIsValid = c.FromString( sParam ); + return Lua::RunExpressionF( s ); } -void ActorCommand::Set( const CString &sCommand ) +Command::Arg::operator int () { - CStringArray vsTokens; - split( sCommand, ",", vsTokens, false ); // don't ignore empty - - vTokens.resize( vsTokens.size() ); - - for( unsigned i=0; i m_vsArgs; +}; + +class Commands +{ +public: + vector v; +}; + +// Take a command list string and return pointers to each of the tokens in the +// string. sCommand list is a list of commands separated by ';'. +// TODO: This is expensive to do during the game. Eventually, +// move all calls to ParseCommands to happen during load, then execute +// from the parsed Command structures. +void ParseCommands( const CString &sCmds, Commands &vCmdsOut ); +Commands ParseCommands( const CString &sCmds ); + + +#define BeginHandleArgs int iMaxIndexAccessed = 0; +#define GET_ARG(type,i) iMaxIndexAccessed = max( i, iMaxIndexAccessed ); command.GetArg##type( i ); +#define sArg(i) GetArg(command,i,iMaxIndexAccessed) +#define fArg(i) GetArg(command,i,iMaxIndexAccessed) +#define iArg(i) GetArg(command,i,iMaxIndexAccessed) +#define bArg(i) GetArg(command,i,iMaxIndexAccessed) +#define cArg(i) GetColorArg(command,i,iMaxIndexAccessed) +#define EndHandleArgs if( iMaxIndexAccessed != (int)command.m_vsArgs.size()-1 ) { IncorrectNumberArgsWarning( command, iMaxIndexAccessed ); } +void IncorrectNumberArgsWarning( const Command& command, int iMaxIndexAccessed ); + +template +inline T GetArg( const Command& command, int iIndex, int& iMaxIndexAccessedOut ) +{ + iMaxIndexAccessedOut = max( iIndex, iMaxIndexAccessedOut ); + return (T)command.GetArg(iIndex); +} + +inline RageColor GetColorArg( const Command& command, int iIndex, int& iMaxIndexAccessed ) +{ + RageColor c; + if( c.FromString( GetArg(command,iIndex,iMaxIndexAccessed) ) ) + return c; + else + return RageColor( fArg(iIndex+0),fArg(iIndex+1),fArg(iIndex+2),fArg(iIndex+3) ); +} + +#endif + +/* + * (c) 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. + */ diff --git a/stepmania/src/DifficultyDisplay.cpp b/stepmania/src/DifficultyDisplay.cpp index acf961a9f4..d3508f4a10 100644 --- a/stepmania/src/DifficultyDisplay.cpp +++ b/stepmania/src/DifficultyDisplay.cpp @@ -3,8 +3,8 @@ #include "song.h" #include "ThemeMetric.h" -ThemeMetric ICONONCOMMAND ("DifficultyDisplay","IconOnCommand"); -ThemeMetric ICONOFFCOMMAND ("DifficultyDisplay","IconOffCommand"); +ThemeMetric ICONONCOMMAND ("DifficultyDisplay","IconOnCommand"); +ThemeMetric ICONOFFCOMMAND ("DifficultyDisplay","IconOffCommand"); DifficultyDisplay::DifficultyDisplay() { @@ -34,16 +34,16 @@ void DifficultyDisplay::SetDifficulties( const Song* pSong, StepsType curType ) for( int diff = DIFFICULTY_BEGINNER; diff <= DIFFICULTY_CHALLENGE; ++diff ) { if( pSong->HasStepsTypeAndDifficulty( curType, Difficulty(diff) ) ) - m_difficulty[diff].Command( ICONONCOMMAND ); + m_difficulty[diff].RunCommands( ICONONCOMMAND ); else - m_difficulty[diff].Command( ICONOFFCOMMAND ); + m_difficulty[diff].RunCommands( ICONOFFCOMMAND ); } } void DifficultyDisplay::UnsetDifficulties() { for( int diff = DIFFICULTY_BEGINNER; diff <= DIFFICULTY_CHALLENGE; ++diff ) - m_difficulty[diff].Command( ICONOFFCOMMAND ); + m_difficulty[diff].RunCommands( ICONOFFCOMMAND ); } /* diff --git a/stepmania/src/DifficultyList.cpp b/stepmania/src/DifficultyList.cpp index 601494800b..823e4ced4f 100644 --- a/stepmania/src/DifficultyList.cpp +++ b/stepmania/src/DifficultyList.cpp @@ -216,10 +216,10 @@ void DifficultyList::PositionItems() if( m_Lines[m].m_Number.GetDestY() != row.m_fY || m_Lines[m].m_Number.DestTweenState().diffuse[0][3] != DiffuseAlpha ) { - m_Lines[m].m_Description.Command( MOVE_COMMAND ); - m_Lines[m].m_Meter.Command( MOVE_COMMAND ); + m_Lines[m].m_Description.RunCommands( MOVE_COMMAND ); + m_Lines[m].m_Meter.RunCommands( MOVE_COMMAND ); m_Lines[m].m_Meter.RunCommandOnChildren( MOVE_COMMAND ); - m_Lines[m].m_Number.Command( MOVE_COMMAND ); + m_Lines[m].m_Number.RunCommands( MOVE_COMMAND ); } m_Lines[m].m_Description.SetY( row.m_fY ); @@ -233,10 +233,10 @@ void DifficultyList::PositionItems() if( m_bShown && m < (int)m_Rows.size() ) bHidden = m_Rows[m].m_bHidden; - const ActorCommands cmds = ParseActorCommands( ssprintf("diffusealpha,%f",bHidden?0.0f:1.0f) ); - m_Lines[m].m_Description.Command( cmds ); + const Commands cmds = ParseCommands( ssprintf("diffusealpha,%f",bHidden?0.0f:1.0f) ); + m_Lines[m].m_Description.RunCommands( cmds ); m_Lines[m].m_Meter.RunCommandOnChildren( cmds ); - m_Lines[m].m_Number.Command( cmds ); + m_Lines[m].m_Number.RunCommands( cmds ); } @@ -356,10 +356,10 @@ void DifficultyList::HideRows() { for( unsigned m = 0; m < m_Rows.size(); ++m ) { - static const ActorCommands cmds = ParseActorCommands( "finishtweening;diffusealpha,0" ); - m_Lines[m].m_Description.Command( cmds ); + static const Commands cmds = ParseCommands( "finishtweening;diffusealpha,0" ); + m_Lines[m].m_Description.RunCommands( cmds ); m_Lines[m].m_Meter.RunCommandOnChildren( cmds ); - m_Lines[m].m_Number.Command( cmds ); + m_Lines[m].m_Number.RunCommands( cmds ); } } @@ -369,10 +369,10 @@ void DifficultyList::TweenOnScreen() m_bShown = true; for( unsigned m = 0; m < m_Rows.size(); ++m ) { - static const ActorCommands cmds = ParseActorCommands( "finishtweening" ); - m_Lines[m].m_Description.Command( cmds ); + static const Commands cmds = ParseCommands( "finishtweening" ); + m_Lines[m].m_Description.RunCommands( cmds ); m_Lines[m].m_Meter.RunCommandOnChildren( cmds ); - m_Lines[m].m_Number.Command( cmds ); + m_Lines[m].m_Number.RunCommands( cmds ); } // PositionItems(); diff --git a/stepmania/src/DifficultyList.h b/stepmania/src/DifficultyList.h index dc2720400e..d15addfbe5 100644 --- a/stepmania/src/DifficultyList.h +++ b/stepmania/src/DifficultyList.h @@ -63,7 +63,7 @@ private: vector m_Rows; - ThemeMetric MOVE_COMMAND; + ThemeMetric MOVE_COMMAND; }; #endif diff --git a/stepmania/src/GameCommand.h b/stepmania/src/GameCommand.h index 9ba38227a7..3a1b0f3d85 100644 --- a/stepmania/src/GameCommand.h +++ b/stepmania/src/GameCommand.h @@ -14,14 +14,14 @@ class Trail; class Character; class Style; class Game; -struct ActorCommands; +class Commands; struct GameCommand // used in SelectMode { GameCommand() { Init(); } void Init(); - void Load( int iIndex, const ActorCommands& acs ); + void Load( int iIndex, const Commands& acs ); void ApplyToAllPlayers() const; void Apply( PlayerNumber pn ) const; bool DescribesCurrentMode( PlayerNumber pn ) const; diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 0f80e4e2bb..6285596514 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -86,7 +86,7 @@ void GameState::ApplyCmdline() for( int i = 0; GetCommandlineArgument( "mode", &sMode, i ); ++i ) { GameCommand m; - m.Load( 0, ParseActorCommands(sMode) ); + m.Load( 0, ParseCommands(sMode) ); CString why; if( !m.IsPlayable(&why) ) RageException::Throw( "Can't apply mode \"%s\": %s", sMode.c_str(), why.c_str() ); diff --git a/stepmania/src/GhostArrow.cpp b/stepmania/src/GhostArrow.cpp index c4fdd7606f..a5c9600e41 100644 --- a/stepmania/src/GhostArrow.cpp +++ b/stepmania/src/GhostArrow.cpp @@ -53,7 +53,7 @@ void GhostArrow::Step( TapNoteScore score ) m_spr[score].SetHidden( false ); m_spr[score].StopTweening(); - m_spr[score].Command( m_acScoreCommand[score] ); + m_spr[score].RunCommands( m_acScoreCommand[score] ); } /* diff --git a/stepmania/src/GhostArrow.h b/stepmania/src/GhostArrow.h index a0f144e585..774066a634 100644 --- a/stepmania/src/GhostArrow.h +++ b/stepmania/src/GhostArrow.h @@ -21,7 +21,7 @@ public: protected: PlayerNumber m_PlayerNumber; Sprite m_spr[NUM_TAP_NOTE_SCORES]; - ActorCommands m_acScoreCommand[NUM_TAP_NOTE_SCORES]; + Commands m_acScoreCommand[NUM_TAP_NOTE_SCORES]; }; diff --git a/stepmania/src/GrooveRadar.cpp b/stepmania/src/GrooveRadar.cpp index 65960fa524..a9e482a541 100644 --- a/stepmania/src/GrooveRadar.cpp +++ b/stepmania/src/GrooveRadar.cpp @@ -11,9 +11,9 @@ #define LABEL_OFFSET_X( i ) THEME->GetMetricF("GrooveRadar",ssprintf("Label%dOffsetX",i+1)) #define LABEL_OFFSET_Y( i ) THEME->GetMetricF("GrooveRadar",ssprintf("Label%dOffsetY",i+1)) -static const ThemeMetric LABEL_ON_COMMAND ("GrooveRadar","LabelOnCommand"); +static const ThemeMetric LABEL_ON_COMMAND ("GrooveRadar","LabelOnCommand"); static const ThemeMetric LABEL_ON_DELAY ("GrooveRadar","LabelOnDelay"); -static const ThemeMetric LABEL_ON_COMMAND_POST_DELAY ("GrooveRadar","LabelOnCommandPostDelay"); +static const ThemeMetric LABEL_ON_COMMAND_POST_DELAY ("GrooveRadar","LabelOnCommandPostDelay"); static const ThemeMetric DISABLE_RADAR ("GrooveRadar","DisableRadar"); float RADAR_VALUE_ROTATION( int iValueIndex ) { return PI/2 + PI*2 / 5.0f * iValueIndex; } @@ -40,9 +40,9 @@ void GrooveRadar::TweenOnScreen() for( int c=0; c START_X ("GroupList","StartX"); static const ThemeMetric START_Y ("GroupList","StartY"); static const ThemeMetric SPACING_X ("GroupList","SpacingX"); static const ThemeMetric SPACING_Y ("GroupList","SpacingY"); -static const ThemeMetric SCROLL_TWEEN_COMMAND ("GroupList","ScrollTweenCommand"); -static const ThemeMetric GAIN_FOCUS_ITEM_COMMAND ("GroupList","GainFocusItemCommand"); -static const ThemeMetric LOSE_FOCUS_ITEM_COMMAND ("GroupList","LoseFocusItemCommand"); -static const ThemeMetric GAIN_FOCUS_GROUP_COMMAND ("GroupList","GainFocusGroupCommand"); -static const ThemeMetric LOSE_FOCUS_GROUP_COMMAND ("GroupList","LoseFocusGroupCommand"); -static const ThemeMetric HIDE_ITEM_COMMAND ("GroupList","HideItemCommand"); -static const ThemeMetric SHOW_ITEM_COMMAND ("GroupList","ShowItemCommand"); +static const ThemeMetric SCROLL_TWEEN_COMMAND ("GroupList","ScrollTweenCommand"); +static const ThemeMetric GAIN_FOCUS_ITEM_COMMAND ("GroupList","GainFocusItemCommand"); +static const ThemeMetric LOSE_FOCUS_ITEM_COMMAND ("GroupList","LoseFocusItemCommand"); +static const ThemeMetric GAIN_FOCUS_GROUP_COMMAND ("GroupList","GainFocusGroupCommand"); +static const ThemeMetric LOSE_FOCUS_GROUP_COMMAND ("GroupList","LoseFocusGroupCommand"); +static const ThemeMetric HIDE_ITEM_COMMAND ("GroupList","HideItemCommand"); +static const ThemeMetric SHOW_ITEM_COMMAND ("GroupList","ShowItemCommand"); const int MAX_GROUPS_ONSCREEN = 7; @@ -105,16 +105,16 @@ void GroupList::ResetTextSize( int i ) void GroupList::BeforeChange() { - m_sprButtons[m_iSelection]->Command( LOSE_FOCUS_ITEM_COMMAND ); - m_textLabels[m_iSelection]->Command( LOSE_FOCUS_ITEM_COMMAND ); - m_ButtonFrames[m_iSelection]->Command( LOSE_FOCUS_GROUP_COMMAND ); + m_sprButtons[m_iSelection]->RunCommands( LOSE_FOCUS_ITEM_COMMAND ); + m_textLabels[m_iSelection]->RunCommands( LOSE_FOCUS_ITEM_COMMAND ); + m_ButtonFrames[m_iSelection]->RunCommands( LOSE_FOCUS_GROUP_COMMAND ); } void GroupList::AfterChange() { m_Frame.StopTweening(); - m_Frame.Command( SCROLL_TWEEN_COMMAND ); + m_Frame.RunCommands( SCROLL_TWEEN_COMMAND ); m_Frame.SetY( -m_iTop*SPACING_Y ); for( int i=0; i < (int) m_asLabels.size(); i++ ) @@ -124,22 +124,22 @@ void GroupList::AfterChange() if( IsHidden && !WasHidden ) { - m_sprButtons[i]->Command( HIDE_ITEM_COMMAND ); - m_textLabels[i]->Command( HIDE_ITEM_COMMAND ); + m_sprButtons[i]->RunCommands( HIDE_ITEM_COMMAND ); + m_textLabels[i]->RunCommands( HIDE_ITEM_COMMAND ); } else if( !IsHidden && WasHidden ) { - m_sprButtons[i]->Command( SHOW_ITEM_COMMAND ); - m_textLabels[i]->Command( SHOW_ITEM_COMMAND ); + m_sprButtons[i]->RunCommands( SHOW_ITEM_COMMAND ); + m_textLabels[i]->RunCommands( SHOW_ITEM_COMMAND ); ResetTextSize( i ); } m_bHidden[i] = IsHidden; } - m_sprButtons[m_iSelection]->Command( GAIN_FOCUS_ITEM_COMMAND ); - m_textLabels[m_iSelection]->Command( GAIN_FOCUS_ITEM_COMMAND ); - m_ButtonFrames[m_iSelection]->Command( GAIN_FOCUS_GROUP_COMMAND ); + m_sprButtons[m_iSelection]->RunCommands( GAIN_FOCUS_ITEM_COMMAND ); + m_textLabels[m_iSelection]->RunCommands( GAIN_FOCUS_ITEM_COMMAND ); + m_ButtonFrames[m_iSelection]->RunCommands( GAIN_FOCUS_GROUP_COMMAND ); } void GroupList::Up() @@ -206,8 +206,8 @@ void GroupList::TweenOnScreen() /* If this item isn't visible, hide it and skip tweens. */ if( !ItemIsOnScreen(i) ) { - m_sprButtons[i]->Command( HIDE_ITEM_COMMAND ); - m_textLabels[i]->Command( HIDE_ITEM_COMMAND ); + m_sprButtons[i]->RunCommands( HIDE_ITEM_COMMAND ); + m_textLabels[i]->RunCommands( HIDE_ITEM_COMMAND ); m_sprButtons[i]->FinishTweening(); m_textLabels[i]->FinishTweening(); diff --git a/stepmania/src/HoldGhostArrow.cpp b/stepmania/src/HoldGhostArrow.cpp index 5bbbdb34a3..39b466a6ae 100644 --- a/stepmania/src/HoldGhostArrow.cpp +++ b/stepmania/src/HoldGhostArrow.cpp @@ -10,7 +10,7 @@ HoldGhostArrow::HoldGhostArrow() void HoldGhostArrow::Load( CString sNoteSkin, CString sButton, CString sElement ) { Sprite::Load( NOTESKIN->GetPathToFromNoteSkinAndButton(sNoteSkin, sButton, sElement) ); // not optional - this->Command( NOTESKIN->GetMetricA(sNoteSkin,"HoldGhostArrow","OnCommand") ); + this->RunCommands( NOTESKIN->GetMetricA(sNoteSkin,"HoldGhostArrow","OnCommand") ); } void HoldGhostArrow::Update( float fDeltaTime ) diff --git a/stepmania/src/HoldJudgment.cpp b/stepmania/src/HoldJudgment.cpp index c50253b856..77d412fde4 100644 --- a/stepmania/src/HoldJudgment.cpp +++ b/stepmania/src/HoldJudgment.cpp @@ -6,12 +6,12 @@ #include "ThemeManager.h" #include "ThemeMetric.h" -ThemeMetric OK_COMMAND ("HoldJudgment","OKCommand"); -ThemeMetric NG_COMMAND ("HoldJudgment","NGCommand"); -ThemeMetric OK_ODD_COMMAND ("HoldJudgment","OKOddCommand"); -ThemeMetric NG_ODD_COMMAND ("HoldJudgment","NGOddCommand"); -ThemeMetric OK_EVEN_COMMAND ("HoldJudgment","OKEvenCommand"); -ThemeMetric NG_EVEN_COMMAND ("HoldJudgment","NGEvenCommand"); +ThemeMetric OK_COMMAND ("HoldJudgment","OKCommand"); +ThemeMetric NG_COMMAND ("HoldJudgment","NGCommand"); +ThemeMetric OK_ODD_COMMAND ("HoldJudgment","OKOddCommand"); +ThemeMetric NG_ODD_COMMAND ("HoldJudgment","NGOddCommand"); +ThemeMetric OK_EVEN_COMMAND ("HoldJudgment","OKEvenCommand"); +ThemeMetric NG_EVEN_COMMAND ("HoldJudgment","NGEvenCommand"); HoldJudgment::HoldJudgment() @@ -54,13 +54,13 @@ void HoldJudgment::SetHoldJudgment( HoldNoteScore hns ) ASSERT(0); case HNS_OK: m_sprJudgment.SetState( 0 ); - m_sprJudgment.Command( (m_iCount%2) ? OK_ODD_COMMAND : OK_EVEN_COMMAND ); - m_sprJudgment.Command( OK_COMMAND ); + m_sprJudgment.RunCommands( (m_iCount%2) ? OK_ODD_COMMAND : OK_EVEN_COMMAND ); + m_sprJudgment.RunCommands( OK_COMMAND ); break; case HNS_NG: m_sprJudgment.SetState( 1 ); - m_sprJudgment.Command( (m_iCount%2) ? NG_ODD_COMMAND : NG_EVEN_COMMAND ); - m_sprJudgment.Command( NG_COMMAND ); + m_sprJudgment.RunCommands( (m_iCount%2) ? NG_ODD_COMMAND : NG_EVEN_COMMAND ); + m_sprJudgment.RunCommands( NG_COMMAND ); break; default: ASSERT(0); diff --git a/stepmania/src/Judgment.cpp b/stepmania/src/Judgment.cpp index a5a4d61479..3a0d125d63 100644 --- a/stepmania/src/Judgment.cpp +++ b/stepmania/src/Judgment.cpp @@ -7,26 +7,26 @@ #include "ThemeManager.h" #include "ThemeMetric.h" -static ThemeMetric MARVELOUS_COMMAND ("Judgment","MarvelousCommand"); -static ThemeMetric PERFECT_COMMAND ("Judgment","PerfectCommand"); -static ThemeMetric GREAT_COMMAND ("Judgment","GreatCommand"); -static ThemeMetric GOOD_COMMAND ("Judgment","GoodCommand"); -static ThemeMetric BOO_COMMAND ("Judgment","BooCommand"); -static ThemeMetric MISS_COMMAND ("Judgment","MissCommand"); +static ThemeMetric MARVELOUS_COMMAND ("Judgment","MarvelousCommand"); +static ThemeMetric PERFECT_COMMAND ("Judgment","PerfectCommand"); +static ThemeMetric GREAT_COMMAND ("Judgment","GreatCommand"); +static ThemeMetric GOOD_COMMAND ("Judgment","GoodCommand"); +static ThemeMetric BOO_COMMAND ("Judgment","BooCommand"); +static ThemeMetric MISS_COMMAND ("Judgment","MissCommand"); -static ThemeMetric MARVELOUS_ODD_COMMAND ("Judgment","MarvelousOddCommand"); -static ThemeMetric PERFECT_ODD_COMMAND ("Judgment","PerfectOddCommand"); -static ThemeMetric GREAT_ODD_COMMAND ("Judgment","GreatOddCommand"); -static ThemeMetric GOOD_ODD_COMMAND ("Judgment","GoodOddCommand"); -static ThemeMetric BOO_ODD_COMMAND ("Judgment","BooOddCommand"); -static ThemeMetric MISS_ODD_COMMAND ("Judgment","MissOddCommand"); +static ThemeMetric MARVELOUS_ODD_COMMAND ("Judgment","MarvelousOddCommand"); +static ThemeMetric PERFECT_ODD_COMMAND ("Judgment","PerfectOddCommand"); +static ThemeMetric GREAT_ODD_COMMAND ("Judgment","GreatOddCommand"); +static ThemeMetric GOOD_ODD_COMMAND ("Judgment","GoodOddCommand"); +static ThemeMetric BOO_ODD_COMMAND ("Judgment","BooOddCommand"); +static ThemeMetric MISS_ODD_COMMAND ("Judgment","MissOddCommand"); -static ThemeMetric MARVELOUS_EVEN_COMMAND ("Judgment","MarvelousEvenCommand"); -static ThemeMetric PERFECT_EVEN_COMMAND ("Judgment","PerfectEvenCommand"); -static ThemeMetric GREAT_EVEN_COMMAND ("Judgment","GreatEvenCommand"); -static ThemeMetric GOOD_EVEN_COMMAND ("Judgment","GoodEvenCommand"); -static ThemeMetric BOO_EVEN_COMMAND ("Judgment","BooEvenCommand"); -static ThemeMetric MISS_EVEN_COMMAND ("Judgment","MissEvenCommand"); +static ThemeMetric MARVELOUS_EVEN_COMMAND ("Judgment","MarvelousEvenCommand"); +static ThemeMetric PERFECT_EVEN_COMMAND ("Judgment","PerfectEvenCommand"); +static ThemeMetric GREAT_EVEN_COMMAND ("Judgment","GreatEvenCommand"); +static ThemeMetric GOOD_EVEN_COMMAND ("Judgment","GoodEvenCommand"); +static ThemeMetric BOO_EVEN_COMMAND ("Judgment","BooEvenCommand"); +static ThemeMetric MISS_EVEN_COMMAND ("Judgment","MissEvenCommand"); Judgment::Judgment() @@ -60,33 +60,33 @@ void Judgment::SetJudgment( TapNoteScore score ) { case TNS_MARVELOUS: m_sprJudgment.SetState( 0 ); - m_sprJudgment.Command( (m_iCount%2) ? MARVELOUS_ODD_COMMAND : MARVELOUS_EVEN_COMMAND ); - m_sprJudgment.Command( MARVELOUS_COMMAND ); + m_sprJudgment.RunCommands( (m_iCount%2) ? MARVELOUS_ODD_COMMAND : MARVELOUS_EVEN_COMMAND ); + m_sprJudgment.RunCommands( MARVELOUS_COMMAND ); break; case TNS_PERFECT: m_sprJudgment.SetState( 1 ); - m_sprJudgment.Command( (m_iCount%2) ? PERFECT_ODD_COMMAND : PERFECT_EVEN_COMMAND ); - m_sprJudgment.Command( PERFECT_COMMAND ); + m_sprJudgment.RunCommands( (m_iCount%2) ? PERFECT_ODD_COMMAND : PERFECT_EVEN_COMMAND ); + m_sprJudgment.RunCommands( PERFECT_COMMAND ); break; case TNS_GREAT: m_sprJudgment.SetState( 2 ); - m_sprJudgment.Command( (m_iCount%2) ? GREAT_ODD_COMMAND : GREAT_EVEN_COMMAND ); - m_sprJudgment.Command( GREAT_COMMAND ); + m_sprJudgment.RunCommands( (m_iCount%2) ? GREAT_ODD_COMMAND : GREAT_EVEN_COMMAND ); + m_sprJudgment.RunCommands( GREAT_COMMAND ); break; case TNS_GOOD: m_sprJudgment.SetState( 3 ); - m_sprJudgment.Command( (m_iCount%2) ? GOOD_ODD_COMMAND : GOOD_EVEN_COMMAND ); - m_sprJudgment.Command( GOOD_COMMAND ); + m_sprJudgment.RunCommands( (m_iCount%2) ? GOOD_ODD_COMMAND : GOOD_EVEN_COMMAND ); + m_sprJudgment.RunCommands( GOOD_COMMAND ); break; case TNS_BOO: m_sprJudgment.SetState( 4 ); - m_sprJudgment.Command( (m_iCount%2) ? BOO_ODD_COMMAND : BOO_EVEN_COMMAND ); - m_sprJudgment.Command( BOO_COMMAND ); + m_sprJudgment.RunCommands( (m_iCount%2) ? BOO_ODD_COMMAND : BOO_EVEN_COMMAND ); + m_sprJudgment.RunCommands( BOO_COMMAND ); break; case TNS_MISS: m_sprJudgment.SetState( 5 ); - m_sprJudgment.Command( (m_iCount%2) ? MISS_ODD_COMMAND : MISS_EVEN_COMMAND ); - m_sprJudgment.Command( MISS_COMMAND ); + m_sprJudgment.RunCommands( (m_iCount%2) ? MISS_ODD_COMMAND : MISS_EVEN_COMMAND ); + m_sprJudgment.RunCommands( MISS_COMMAND ); break; default: ASSERT(0); diff --git a/stepmania/src/LyricDisplay.cpp b/stepmania/src/LyricDisplay.cpp index 246fde586e..e44b0ae4f0 100644 --- a/stepmania/src/LyricDisplay.cpp +++ b/stepmania/src/LyricDisplay.cpp @@ -5,8 +5,8 @@ #include "GameState.h" #include "ThemeMetric.h" -static ThemeMetric IN_COMMAND ("LyricDisplay","InCommand"); -static ThemeMetric OUT_COMMAND ("LyricDisplay","OutCommand"); +static ThemeMetric IN_COMMAND ("LyricDisplay","InCommand"); +static ThemeMetric OUT_COMMAND ("LyricDisplay","OutCommand"); static ThemeMetric WIPE_DIM_FACTOR ("LyricDisplay","WipeDimFactor"); static float g_TweenInTime, g_TweenOutTime; @@ -112,14 +112,14 @@ void LyricDisplay::Update( float fDeltaTime ) m_textLyrics[i].SetCropLeft(0); if( i==1 ) m_textLyrics[i].SetCropRight(1); - m_textLyrics[i].Command(IN_COMMAND); + m_textLyrics[i].RunCommands(IN_COMMAND); m_textLyrics[i].BeginTweening( fShowLength * 0.75f ); /* sleep */ if( i==0 ) m_textLyrics[i].SetCropLeft(1); if( i==1 ) m_textLyrics[i].SetCropRight(0); m_textLyrics[i].BeginTweening( fShowLength * 0.25f ); /* sleep */ - m_textLyrics[i].Command(OUT_COMMAND); + m_textLyrics[i].RunCommands(OUT_COMMAND); } m_iCurLyricNumber++; diff --git a/stepmania/src/Makefile.am b/stepmania/src/Makefile.am index c89d795a39..ff48f49265 100644 --- a/stepmania/src/Makefile.am +++ b/stepmania/src/Makefile.am @@ -54,7 +54,8 @@ ScreenTitleMenu.cpp ScreenTitleMenu.h ScreenUnlock.cpp ScreenUnlock.h ScreenWith DataStructures = \ Attack.cpp Attack.h AutoKeysounds.cpp AutoKeysounds.h BannerCache.cpp BannerCache.h CatalogXml.cpp CatalogXml.h \ Character.cpp Character.h CharacterHead.cpp CharacterHead.h \ -CodeDetector.cpp CodeDetector.h Difficulty.cpp Difficulty.h EnumHelper.cpp EnumHelper.h Course.cpp Course.h \ +CodeDetector.cpp CodeDetector.h +Command.cpp Command.h Difficulty.cpp Difficulty.h EnumHelper.cpp EnumHelper.h Course.cpp Course.h \ CourseUtil.cpp CourseUtil.h DateTime.cpp DateTime.h Font.cpp Font.h FontCharAliases.cpp FontCharAliases.h \ FontCharmaps.cpp FontCharmaps.h Game.cpp Game.h GameCommand.cpp GameCommand.h \ GameConstantsAndTypes.cpp GameConstantsAndTypes.h \ @@ -251,7 +252,7 @@ RageTimer.cpp RageTimer.h RageTypes.h RageUtil.cpp RageUtil.h RageUtil_CharConve RageUtil_BackgroundLoader.cpp RageUtil_BackgroundLoader.h RageUtil_FileDB.cpp RageUtil_FileDB.h RageUtil_CircularBuffer.h Actors = \ -Actor.cpp Actor.h ActorCollision.h ActorCommands.cpp ActorCommands.h ActorFrame.cpp ActorFrame.h \ +Actor.cpp Actor.h ActorCollision.h ActorFrame.cpp ActorFrame.h \ ActorScroller.cpp ActorScroller.h ActorUtil.cpp ActorUtil.h BitmapText.cpp BitmapText.h Model.cpp Model.h \ ModelManager.cpp ModelManager.h ModelTypes.cpp ModelTypes.h Quad.h Sprite.cpp Sprite.h diff --git a/stepmania/src/MenuTimer.cpp b/stepmania/src/MenuTimer.cpp index b61cb98ce1..3b58b51fb4 100644 --- a/stepmania/src/MenuTimer.cpp +++ b/stepmania/src/MenuTimer.cpp @@ -13,7 +13,7 @@ static const ThemeMetric WARNING_START ("MenuTimer","WarningStart"); static const ThemeMetric WARNING_BEEP_START ("MenuTimer","WarningBeepStart"); #define WARNING_COMMAND(i) THEME->GetMetricA ("MenuTimer", ssprintf("WarningCommand%i",i)) -static const ThemeMetric ON_COMMAND ("MenuTimer","OnCommand"); +static const ThemeMetric ON_COMMAND ("MenuTimer","OnCommand"); static const int TIMER_SECONDS = 99; static const int MAX_STALL_SECONDS = 30; @@ -81,8 +81,8 @@ void MenuTimer::Update( float fDeltaTime ) if( iNewDisplay <= WARNING_START ) { - m_textDigit1.Command( WARNING_COMMAND(iNewDisplay) ); - m_textDigit2.Command( WARNING_COMMAND(iNewDisplay) ); + m_textDigit1.RunCommands( WARNING_COMMAND(iNewDisplay) ); + m_textDigit2.RunCommands( WARNING_COMMAND(iNewDisplay) ); } if( iNewDisplay == 0 ) @@ -134,8 +134,8 @@ void MenuTimer::SetSeconds( int iSeconds ) m_fSecondsLeft = (float)iSeconds; CLAMP( m_fSecondsLeft, 0, 99 ); - m_textDigit1.Command( ON_COMMAND ); - m_textDigit2.Command( ON_COMMAND ); + m_textDigit1.RunCommands( ON_COMMAND ); + m_textDigit2.RunCommands( ON_COMMAND ); SetText( iSeconds ); } diff --git a/stepmania/src/Model.cpp b/stepmania/src/Model.cpp index 6ae6e95b87..5c535fba57 100644 --- a/stepmania/src/Model.cpp +++ b/stepmania/src/Model.cpp @@ -719,20 +719,22 @@ void Model::SetSecondsIntoAnimation( float fSeconds ) } } -void Model::HandleCommand( const ActorCommand &command ) +void Model::HandleCommand( const Command &command ) { - BeginHandleParams; + BeginHandleArgs; - const CString& sName = sParam(0); + const CString& sName = command.GetName(); if( sName=="play" ) - PlayAnimation( sParam(1),fParam(2) ); + { + PlayAnimation( sArg(1),fArg(2) ); + } else { Actor::HandleCommand( command ); return; } - EndHandleParams; + EndHandleArgs; } /* diff --git a/stepmania/src/Model.h b/stepmania/src/Model.h index 424b72f85e..c586ae70c9 100644 --- a/stepmania/src/Model.h +++ b/stepmania/src/Model.h @@ -43,7 +43,7 @@ public: void SetDefaultAnimation( CString sAnimation, float fPlayRate = 1 ); bool m_bRevertToDefaultAnimation; - virtual void HandleCommand( const ActorCommand &command ); + virtual void HandleCommand( const Command &command ); private: RageModelGeometry *m_pGeometry; diff --git a/stepmania/src/MusicList.cpp b/stepmania/src/MusicList.cpp index 57938ca7e5..8643d56d29 100644 --- a/stepmania/src/MusicList.cpp +++ b/stepmania/src/MusicList.cpp @@ -12,7 +12,7 @@ static const ThemeMetric START_X ("MusicList","StartX"); static const ThemeMetric START_Y ("MusicList","StartY"); static const ThemeMetric SPACING_X ("MusicList","SpacingX"); static const ThemeMetric CROP_WIDTH ("MusicList","CropWidth"); -static const ThemeMetric INIT_COMMAND ("MusicList","InitCommand"); +static const ThemeMetric INIT_COMMAND ("MusicList","InitCommand"); MusicList::MusicList() { @@ -25,7 +25,7 @@ void MusicList::Load() { m_textTitles[i].LoadFromFont( THEME->GetPathToF("MusicList titles") ); m_textTitles[i].SetXY( START_X + i*SPACING_X, START_Y ); - m_textTitles[i].Command( INIT_COMMAND ); + m_textTitles[i].RunCommands( INIT_COMMAND ); this->AddChild( &m_textTitles[i] ); } } diff --git a/stepmania/src/MusicWheel.cpp b/stepmania/src/MusicWheel.cpp index 12327b1210..be483e6f29 100644 --- a/stepmania/src/MusicWheel.cpp +++ b/stepmania/src/MusicWheel.cpp @@ -437,7 +437,7 @@ void MusicWheel::BuildWheelItemDatas( vector &arrayWheelItemDatas WheelItemData wid( TYPE_SORT, NULL, "", NULL, SORT_MENU_COLOR, so ); wid.m_sLabel = Names[i]; - wid.m_Action.Load( i, ParseActorCommands(Actions[i]) ); + wid.m_Action.Load( i, ParseCommands(Actions[i]) ); switch( so ) { diff --git a/stepmania/src/NoteFieldPositioning.cpp b/stepmania/src/NoteFieldPositioning.cpp index 29af743317..6457e59861 100644 --- a/stepmania/src/NoteFieldPositioning.cpp +++ b/stepmania/src/NoteFieldPositioning.cpp @@ -76,8 +76,8 @@ void NoteFieldMode::Load(IniFile &ini, CString id, int pn) GetValue( ini, pn, id, "PixelsDrawBehindScale", m_fLastPixelToDrawScale ); CString s; - if( GetValue( ini, pn, id, "Judgment", s ) ) m_JudgmentCmd = ParseActorCommands(s); - if( GetValue( ini, pn, id, "Combo", s ) ) m_ComboCmd = ParseActorCommands(s); + if( GetValue( ini, pn, id, "Judgment", s ) ) m_JudgmentCmd = ParseCommands(s); + if( GetValue( ini, pn, id, "Combo", s ) ) m_ComboCmd = ParseCommands(s); /* Load per-track data: */ int t; @@ -92,8 +92,8 @@ void NoteFieldMode::Load(IniFile &ini, CString id, int pn) GetValue( ini, pn, id, ssprintf("GhostButton"), GhostButtonNames[t] ); GetValue( ini, pn, id, ssprintf("GhostButton%i", t+1), GhostButtonNames[t] ); - if( GetValue( ini, pn, id, ssprintf("HoldJudgment"), s ) ) m_HoldJudgmentCmd[t] = ParseActorCommands(s); - if( GetValue( ini, pn, id, ssprintf("HoldJudgment%i",t+1), s ) ) m_HoldJudgmentCmd[t] = ParseActorCommands(s); + if( GetValue( ini, pn, id, ssprintf("HoldJudgment"), s ) ) m_HoldJudgmentCmd[t] = ParseCommands(s); + if( GetValue( ini, pn, id, ssprintf("HoldJudgment%i",t+1), s ) ) m_HoldJudgmentCmd[t] = ParseCommands(s); } } diff --git a/stepmania/src/NoteFieldPositioning.h b/stepmania/src/NoteFieldPositioning.h index dced7dbaa9..e8a594ad04 100644 --- a/stepmania/src/NoteFieldPositioning.h +++ b/stepmania/src/NoteFieldPositioning.h @@ -3,7 +3,7 @@ #include "PlayerNumber.h" #include "Style.h" -#include "ActorCommands.h" +#include "Command.h" class IniFile; @@ -33,8 +33,8 @@ struct NoteFieldMode float m_fFirstPixelToDrawScale, m_fLastPixelToDrawScale; CString m_Backdrop; - ActorCommands m_JudgmentCmd, m_ComboCmd, m_AttackDisplayCmd; - ActorCommands m_HoldJudgmentCmd[MAX_NOTE_TRACKS]; + Commands m_JudgmentCmd, m_ComboCmd, m_AttackDisplayCmd; + Commands m_HoldJudgmentCmd[MAX_NOTE_TRACKS]; }; class NoteFieldPositioning diff --git a/stepmania/src/NoteSkinManager.cpp b/stepmania/src/NoteSkinManager.cpp index 627a57b901..6ab555fc67 100644 --- a/stepmania/src/NoteSkinManager.cpp +++ b/stepmania/src/NoteSkinManager.cpp @@ -197,9 +197,9 @@ RageColor NoteSkinManager::GetMetricC( const CString &sNoteSkinName, const CStri return c; } -ActorCommands NoteSkinManager::GetMetricA( const CString &sNoteSkinName, const CString &sButtonName, const CString &sValueName ) +Commands NoteSkinManager::GetMetricA( const CString &sNoteSkinName, const CString &sButtonName, const CString &sValueName ) { - return ParseActorCommands( GetMetric(sNoteSkinName,sButtonName,sValueName) ); + return ParseCommands( GetMetric(sNoteSkinName,sButtonName,sValueName) ); } CString NoteSkinManager::GetPathToFromNoteSkinAndButton( const CString &NoteSkin, const CString &sButtonName, const CString &sElement, bool bOptional ) diff --git a/stepmania/src/NoteSkinManager.h b/stepmania/src/NoteSkinManager.h index 6af30a4272..8061306c80 100644 --- a/stepmania/src/NoteSkinManager.h +++ b/stepmania/src/NoteSkinManager.h @@ -1,7 +1,7 @@ #ifndef NoteSkinMANAGER_H #define NoteSkinMANAGER_H -#include "ActorCommands.h" +#include "Command.h" #include "RageTypes.h" #include "PlayerNumber.h" #include "IniFile.h" @@ -28,7 +28,7 @@ public: float GetMetricF( const CString &sNoteSkinName, const CString &sButtonName, const CString &sValueName ); bool GetMetricB( const CString &sNoteSkinName, const CString &sButtonName, const CString &sValueName ); RageColor GetMetricC( const CString &sNoteSkinName, const CString &sButtonName, const CString &sValueName ); - ActorCommands GetMetricA( const CString &sNoteSkinName, const CString &sButtonName, const CString &sValueName ); + Commands GetMetricA( const CString &sNoteSkinName, const CString &sButtonName, const CString &sValueName ); CString GetNoteSkinDir( const CString &sSkinName ); diff --git a/stepmania/src/PaneDisplay.cpp b/stepmania/src/PaneDisplay.cpp index 2fe6819cb5..4c49f50fc6 100644 --- a/stepmania/src/PaneDisplay.cpp +++ b/stepmania/src/PaneDisplay.cpp @@ -322,7 +322,7 @@ done: continue; spec.erase( spec.begin(), spec.begin()+1 ); - m_textContents[c].Command( ParseActorCommands(join(";", spec)) ); + m_textContents[c].RunCommands( ParseCommands(join(";", spec)) ); break; } } diff --git a/stepmania/src/Player.cpp b/stepmania/src/Player.cpp index e3f70d136e..1b35899e26 100644 --- a/stepmania/src/Player.cpp +++ b/stepmania/src/Player.cpp @@ -201,15 +201,15 @@ void PlayerMinus::Load( m_ProTimingDisplay.SetY( bReverse ? SCREEN_BOTTOM-JUDGMENT_Y : SCREEN_TOP+JUDGMENT_Y ); /* These commands add to the above positioning, and are usually empty. */ - m_Judgment.Command( g_NoteFieldMode[pn].m_JudgmentCmd ); - m_ProTimingDisplay.Command( g_NoteFieldMode[pn].m_JudgmentCmd ); - m_Combo.Command( g_NoteFieldMode[pn].m_ComboCmd ); - m_AttackDisplay.Command( g_NoteFieldMode[pn].m_AttackDisplayCmd ); + m_Judgment.RunCommands( g_NoteFieldMode[pn].m_JudgmentCmd ); + m_ProTimingDisplay.RunCommands( g_NoteFieldMode[pn].m_JudgmentCmd ); + m_Combo.RunCommands( g_NoteFieldMode[pn].m_ComboCmd ); + m_AttackDisplay.RunCommands( g_NoteFieldMode[pn].m_AttackDisplayCmd ); for( int c=0; cm_iColsPerPlayer; c++ ) { NoteFieldMode &mode = g_NoteFieldMode[pn]; - m_HoldJudgment[c].Command( mode.m_HoldJudgmentCmd[c] ); + m_HoldJudgment[c].RunCommands( mode.m_HoldJudgmentCmd[c] ); } // Need to set Y positions of all these elements in Update since diff --git a/stepmania/src/ProTimingDisplay.cpp b/stepmania/src/ProTimingDisplay.cpp index aca6276590..568d9cf7c9 100644 --- a/stepmania/src/ProTimingDisplay.cpp +++ b/stepmania/src/ProTimingDisplay.cpp @@ -4,15 +4,15 @@ #include "RageUtil.h" #include "ThemeMetric.h" -static const ThemeMetric MARVELOUS_COMMAND ("ProTimingDisplay","MarvelousCommand"); -static const ThemeMetric PERFECT_COMMAND ("ProTimingDisplay","PerfectCommand"); -static const ThemeMetric GREAT_COMMAND ("ProTimingDisplay","GreatCommand"); -static const ThemeMetric GOOD_COMMAND ("ProTimingDisplay","GoodCommand"); -static const ThemeMetric BOO_COMMAND ("ProTimingDisplay","BooCommand"); -static const ThemeMetric MISS_COMMAND ("ProTimingDisplay","MissCommand"); -static const ThemeMetric HIT_MINE_COMMAND ("ProTimingDisplay","HitMineCommand"); +static const ThemeMetric MARVELOUS_COMMAND ("ProTimingDisplay","MarvelousCommand"); +static const ThemeMetric PERFECT_COMMAND ("ProTimingDisplay","PerfectCommand"); +static const ThemeMetric GREAT_COMMAND ("ProTimingDisplay","GreatCommand"); +static const ThemeMetric GOOD_COMMAND ("ProTimingDisplay","GoodCommand"); +static const ThemeMetric BOO_COMMAND ("ProTimingDisplay","BooCommand"); +static const ThemeMetric MISS_COMMAND ("ProTimingDisplay","MissCommand"); +static const ThemeMetric HIT_MINE_COMMAND ("ProTimingDisplay","HitMineCommand"); -static const ThemeMetric *g_Commands[NUM_TAP_NOTE_SCORES] = +static const ThemeMetric *g_Commands[NUM_TAP_NOTE_SCORES] = { NULL, /* no TNS_NONE */ &HIT_MINE_COMMAND, @@ -50,7 +50,7 @@ void ProTimingDisplay::SetJudgment( int ms, TapNoteScore score ) ASSERT( score != TNS_NONE ); ASSERT( score < NUM_TAP_NOTE_SCORES ); - m_Judgment.Command( *g_Commands[score] ); + m_Judgment.RunCommands( *g_Commands[score] ); } /* diff --git a/stepmania/src/RageMath.cpp b/stepmania/src/RageMath.cpp index bcd8380a75..1bd640ee8a 100644 --- a/stepmania/src/RageMath.cpp +++ b/stepmania/src/RageMath.cpp @@ -235,25 +235,25 @@ void RageMatrixCommand( CString sCommandString, RageMatrix &mat ) int iMaxIndexAccessed = 0; -#define sParam(i) (GetParam(asTokens,i,iMaxIndexAccessed)) -#define fParam(i) (strtof(sParam(i),NULL)) -#define iParam(i) (atoi(sParam(i))) -#define bParam(i) (iParam(i)!=0) +#define sArg(i) (GetParam(asTokens,i,iMaxIndexAccessed)) +#define fArg(i) (strtof(sArg(i),NULL)) +#define iArg(i) (atoi(sArg(i))) +#define bArg(i) (iArg(i)!=0) CString& sName = asTokens[0]; sName.MakeLower(); RageMatrix b; // Act on command - if( sName=="x" ) RageMatrixTranslation( &b, fParam(1),0,0 ); - else if( sName=="y" ) RageMatrixTranslation( &b, 0,fParam(1),0 ); - else if( sName=="z" ) RageMatrixTranslation( &b, 0,0,fParam(1) ); - else if( sName=="zoomx" ) RageMatrixScaling(&b, fParam(1),1,1 ); - else if( sName=="zoomy" ) RageMatrixScaling(&b, 1,fParam(1),1 ); - else if( sName=="zoomz" ) RageMatrixScaling(&b, 1,1,fParam(1) ); - else if( sName=="rotationx" ) RageMatrixRotationX( &b, fParam(1) ); - else if( sName=="rotationy" ) RageMatrixRotationY( &b, fParam(1) ); - else if( sName=="rotationz" ) RageMatrixRotationZ( &b, fParam(1) ); + if( sName=="x" ) RageMatrixTranslation( &b, fArg(1),0,0 ); + else if( sName=="y" ) RageMatrixTranslation( &b, 0,fArg(1),0 ); + else if( sName=="z" ) RageMatrixTranslation( &b, 0,0,fArg(1) ); + else if( sName=="zoomx" ) RageMatrixScaling(&b, fArg(1),1,1 ); + else if( sName=="zoomy" ) RageMatrixScaling(&b, 1,fArg(1),1 ); + else if( sName=="zoomz" ) RageMatrixScaling(&b, 1,1,fArg(1) ); + else if( sName=="rotationx" ) RageMatrixRotationX( &b, fArg(1) ); + else if( sName=="rotationy" ) RageMatrixRotationY( &b, fArg(1) ); + else if( sName=="rotationz" ) RageMatrixRotationZ( &b, fArg(1) ); else { CString sError = ssprintf( "MatrixCommand: Unrecognized matrix command name '%s' in command string '%s'.", sName.c_str(), sCommandString.c_str() ); diff --git a/stepmania/src/ReceptorArrow.cpp b/stepmania/src/ReceptorArrow.cpp index 4dd7fdeb68..9fc29d234f 100644 --- a/stepmania/src/ReceptorArrow.cpp +++ b/stepmania/src/ReceptorArrow.cpp @@ -38,9 +38,9 @@ bool ReceptorArrow::Load( CString NoteSkin, PlayerNumber pn, int iColNo ) m_pPressBlock.Load( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin,sButton,"KeypressBlock") ); - m_pReceptorWaiting->Command( ParseActorCommands("effectclock,beat") ); - m_pReceptorGo->Command( ParseActorCommands("effectclock,beat") ); - m_pPressBlock->Command( ParseActorCommands("effectclock,beat") ); + m_pReceptorWaiting->RunCommands( ParseCommands("effectclock,beat") ); + m_pReceptorGo->RunCommands( ParseCommands("effectclock,beat") ); + m_pPressBlock->RunCommands( ParseCommands("effectclock,beat") ); // draw pressblock before receptors this->AddChild( m_pPressBlock ); @@ -73,8 +73,8 @@ void ReceptorArrow::Step( TapNoteScore score ) { m_pReceptorGo->FinishTweening(); m_pReceptorWaiting->FinishTweening(); - m_pReceptorGo->Command( m_sScoreCommand[score] ); - m_pReceptorWaiting->Command( m_sScoreCommand[score] ); + m_pReceptorGo->RunCommands( m_sScoreCommand[score] ); + m_pReceptorWaiting->RunCommands( m_sScoreCommand[score] ); } /* diff --git a/stepmania/src/ReceptorArrow.h b/stepmania/src/ReceptorArrow.h index 12f7a9c7b6..a389f4e3f7 100644 --- a/stepmania/src/ReceptorArrow.h +++ b/stepmania/src/ReceptorArrow.h @@ -25,7 +25,7 @@ private: AutoActor m_pReceptorWaiting; AutoActor m_pReceptorGo; - ActorCommands m_sScoreCommand[NUM_TAP_NOTE_SCORES]; + Commands m_sScoreCommand[NUM_TAP_NOTE_SCORES]; AutoActor m_pPressBlock; bool m_bIsPressed; diff --git a/stepmania/src/ScoreDisplayBattle.cpp b/stepmania/src/ScoreDisplayBattle.cpp index afdc6a172b..ed83590601 100644 --- a/stepmania/src/ScoreDisplayBattle.cpp +++ b/stepmania/src/ScoreDisplayBattle.cpp @@ -51,14 +51,14 @@ void ScoreDisplayBattle::Update( float fDelta ) if( sNewModifier == "" ) { - m_ItemIcon[s].Command( ParseActorCommands("linear,0.25;zoom,0") ); + m_ItemIcon[s].RunCommands( ParseCommands("linear,0.25;zoom,0") ); } else { // TODO: Cache all of the icon graphics so we don't load them dynamically from disk. m_ItemIcon[s].Load( THEME->GetPathToG("ScoreDisplayBattle icon "+sNewModifier) ); m_ItemIcon[s].StopTweening(); - m_ItemIcon[s].Command( ParseActorCommands( + m_ItemIcon[s].RunCommands( ParseCommands( "diffuse,1,1,1,1;zoom,1;" "sleep,0.1;linear,0;diffusealpha,0;" "sleep,0.1;linear,0;diffusealpha,1;" diff --git a/stepmania/src/ScreenBranch.cpp b/stepmania/src/ScreenBranch.cpp index b7e3215861..4083edb246 100644 --- a/stepmania/src/ScreenBranch.cpp +++ b/stepmania/src/ScreenBranch.cpp @@ -44,7 +44,7 @@ void ScreenBranch::HandleScreenMessage( const ScreenMessage SM ) LOG->Trace( "Branching to '%s'", sNextScreen.c_str() ); GameCommand mc; - mc.Load( 0, ParseActorCommands(sNextScreen) ); + mc.Load( 0, ParseCommands(sNextScreen) ); if( mc.m_sScreen == "" ) RageException::Throw("Metric %s::%s must set \"screen\"", m_sName.c_str(), ("NextScreen"+m_sChoice).c_str() ); diff --git a/stepmania/src/ScreenEvaluation.cpp b/stepmania/src/ScreenEvaluation.cpp index 7ad3fb6a2c..55f2fa066f 100644 --- a/stepmania/src/ScreenEvaluation.cpp +++ b/stepmania/src/ScreenEvaluation.cpp @@ -515,7 +515,7 @@ void ScreenEvaluation::Init() m_Percent[p].Load( p, &g_CurStageStats, true ); m_Percent[p].SetXY( THEME->GetMetricF(m_sName, ssprintf("PercentP%dX",p+1)), THEME->GetMetricF(m_sName,ssprintf("PercentP%dY",p+1)) ); - m_Percent[p].Command( THEME->GetMetricA(m_sName,ssprintf("PercentP%dOnCommand",p+1)) ); + m_Percent[p].RunCommands( THEME->GetMetricA(m_sName,ssprintf("PercentP%dOnCommand",p+1)) ); this->AddChild( &m_Percent[p] ); } } @@ -552,7 +552,7 @@ void ScreenEvaluation::Init() // .99999 is fairly close to 1.00, so we use that if( stageStats.radarActual[p][r] > 0.99999f ) - m_sprActualBar[p][r].Command( BAR_ACTUAL_MAX_COMMAND ); + m_sprActualBar[p][r].RunCommands( BAR_ACTUAL_MAX_COMMAND ); this->AddChild( &m_sprActualBar[p][r] ); } } @@ -1176,7 +1176,7 @@ void ScreenEvaluation::TweenOffScreen() FOREACH_EnabledPlayer( p ) { OFF_COMMAND( m_sprPercentFrame[p] ); - m_Percent[p].Command( THEME->GetMetricA(m_sName,ssprintf("PercentP%dOffCommand",p+1)) ); + m_Percent[p].RunCommands( THEME->GetMetricA(m_sName,ssprintf("PercentP%dOffCommand",p+1)) ); m_Percent[p].TweenOffScreen(); } } diff --git a/stepmania/src/ScreenEz2SelectMusic.cpp b/stepmania/src/ScreenEz2SelectMusic.cpp index 5ac8fd9b58..55dec8c163 100644 --- a/stepmania/src/ScreenEz2SelectMusic.cpp +++ b/stepmania/src/ScreenEz2SelectMusic.cpp @@ -412,28 +412,28 @@ void ScreenEz2SelectMusic::MenuBack( PlayerNumber pn ) void ScreenEz2SelectMusic::TweenOffScreen() { - static const ActorCommands cmds = ParseActorCommands("linear,0.5;zoomy,0"); - m_MusicBannerWheel.Command( cmds ); + static const Commands cmds = ParseCommands("linear,0.5;zoomy,0"); + m_MusicBannerWheel.RunCommands( cmds ); - static const ActorCommands cmds2 = ParseActorCommands("Linear,1;DiffuseAlpha,0"); - m_PumpDifficultyCircle.Command( cmds2 ); - m_Guide.Command( cmds2 ); - m_PumpDifficultyRating.Command( cmds2 ); - m_Guide.Command( cmds2 ); - m_ChoiceListFrame.Command( cmds2 ); - m_ChoiceListHighlight.Command( cmds2 ); - m_CurrentGroup.Command( cmds2 ); - m_CurrentTitle.Command( cmds2 ); - m_CurrentArtist.Command( cmds2 ); + static const Commands cmds2 = ParseCommands("Linear,1;DiffuseAlpha,0"); + m_PumpDifficultyCircle.RunCommands( cmds2 ); + m_Guide.RunCommands( cmds2 ); + m_PumpDifficultyRating.RunCommands( cmds2 ); + m_Guide.RunCommands( cmds2 ); + m_ChoiceListFrame.RunCommands( cmds2 ); + m_ChoiceListHighlight.RunCommands( cmds2 ); + m_CurrentGroup.RunCommands( cmds2 ); + m_CurrentTitle.RunCommands( cmds2 ); + m_CurrentArtist.RunCommands( cmds2 ); //This should be fixed and changed to OFF_COMMAND for(int i=0; i EVEN_LINE_IN ("ScreenMapControllers","EvenLineIn"); -static const ThemeMetric EVEN_LINE_OUT ("ScreenMapControllers","EvenLineOut"); -static const ThemeMetric ODD_LINE_IN ("ScreenMapControllers","OddLineIn"); -static const ThemeMetric ODD_LINE_OUT ("ScreenMapControllers","OddLineOut"); +static const ThemeMetric EVEN_LINE_IN ("ScreenMapControllers","EvenLineIn"); +static const ThemeMetric EVEN_LINE_OUT ("ScreenMapControllers","EvenLineOut"); +static const ThemeMetric ODD_LINE_IN ("ScreenMapControllers","OddLineIn"); +static const ThemeMetric ODD_LINE_OUT ("ScreenMapControllers","OddLineOut"); const int FramesToWaitForInput = 2; @@ -79,7 +79,7 @@ ScreenMapControllers::ScreenMapControllers( CString sClassName ) : ScreenWithMen m_Line[b].SetY( LINE_START_Y + b*LINE_GAP_Y ); this->AddChild( &m_Line[b] ); - m_Line[b].Command( (b%2)? ODD_LINE_IN : EVEN_LINE_IN ); + m_Line[b].RunCommands( (b%2)? ODD_LINE_IN : EVEN_LINE_IN ); } m_textError.LoadFromFont( THEME->GetPathToF("Common normal") ); @@ -298,7 +298,7 @@ void ScreenMapControllers::Input( const DeviceInput& DeviceI, const InputEventTy SCREENMAN->PlayStartSound(); StartTransitioning( SM_GoToNextScreen ); for( int b=0; bGetCurrentGame()->m_iButtonsPerController; b++ ) - m_Line[b].Command( (b%2)? ODD_LINE_OUT:EVEN_LINE_OUT ); + m_Line[b].RunCommands( (b%2)? ODD_LINE_OUT:EVEN_LINE_OUT ); } break; case KEY_ENTER: /* Change the selection. */ diff --git a/stepmania/src/ScreenNameEntryTraditional.cpp b/stepmania/src/ScreenNameEntryTraditional.cpp index 63b12a00d5..b905c97990 100644 --- a/stepmania/src/ScreenNameEntryTraditional.cpp +++ b/stepmania/src/ScreenNameEntryTraditional.cpp @@ -83,10 +83,10 @@ void HighScoreWheelItem::LoadBlank( int iRankIndex ) void HighScoreWheelItem::ShowFocus() { - ActorCommands cmds = ParseActorCommands("diffuseshift;EffectColor1,1,1,0,1;EffectColor2,0,1,1,1"); - m_textRank.Command( cmds ); - m_textName.Command( cmds ); - m_textScore.Command( cmds ); + Commands cmds = ParseCommands("diffuseshift;EffectColor1,1,1,0,1;EffectColor2,0,1,1,1"); + m_textRank.RunCommands( cmds ); + m_textName.RunCommands( cmds ); + m_textScore.RunCommands( cmds ); } void HighScoreWheel::Load( const HighScoreList& hsl, int iIndexToFocus ) @@ -220,7 +220,7 @@ ScreenNameEntryTraditional::ScreenNameEntryTraditional( CString sClassName ) : S Letter->SetText( ssprintf("%lc", Chars[ch]) ); m_textAlphabet[p].push_back( Letter ); m_Keyboard[p].AddChild( Letter ); - Letter->Command( THEME->GetMetricA("ScreenNameEntryTraditional","AlphabetInitCommand") ); + Letter->RunCommands( THEME->GetMetricA("ScreenNameEntryTraditional","AlphabetInitCommand") ); m_AlphabetLetter[p].push_back( Chars[ch] ); } @@ -237,7 +237,7 @@ ScreenNameEntryTraditional::ScreenNameEntryTraditional( CString sClassName ) : S m_Keyboard[p].AddChild( Letter ); m_AlphabetLetter[p].push_back( CHAR_BACK ); - Letter->Command( THEME->GetMetricA("ScreenNameEntryTraditional","OKInitCommand") ); + Letter->RunCommands( THEME->GetMetricA("ScreenNameEntryTraditional","OKInitCommand") ); } /* Add "OK". */ @@ -252,7 +252,7 @@ ScreenNameEntryTraditional::ScreenNameEntryTraditional( CString sClassName ) : S m_Keyboard[p].AddChild( Letter ); m_AlphabetLetter[p].push_back( CHAR_OK ); - Letter->Command( THEME->GetMetricA("ScreenNameEntryTraditional","OKInitCommand") ); + Letter->RunCommands( THEME->GetMetricA("ScreenNameEntryTraditional","OKInitCommand") ); } m_sprCursor[p].SetName( ssprintf("CursorP%i",p+1) ); @@ -442,7 +442,7 @@ void ScreenNameEntryTraditional::PositionCharsAndCursor( int pn ) const bool hidden = ( Pos < First || Pos > Last ); const int ActualPos = clamp( Pos, First-1, Last+1 ); - bt->Command( ParseActorCommands("stoptweening;decelerate,.12") ); + bt->RunCommands( ParseCommands("stoptweening;decelerate,.12") ); bt->SetX( ActualPos * ALPHABET_GAP_X ); bt->SetDiffuseAlpha( hidden? 0.0f:1.0f ); } diff --git a/stepmania/src/ScreenOptions.cpp b/stepmania/src/ScreenOptions.cpp index 0312e1ff37..fc37da19c6 100644 --- a/stepmania/src/ScreenOptions.cpp +++ b/stepmania/src/ScreenOptions.cpp @@ -121,7 +121,7 @@ ScreenOptions::ScreenOptions( CString sClassName ) : ScreenWithMenuElements(sCla m_bGotAtLeastOneStartPressed[p] = false; } - m_framePage.Command( FRAME_ON_COMMAND ); + m_framePage.RunCommands( FRAME_ON_COMMAND ); } void ScreenOptions::LoadOptionIcon( PlayerNumber pn, int iRow, CString sText ) @@ -921,7 +921,7 @@ void ScreenOptions::HandleScreenMessage( const ScreenMessage SM ) SCREENMAN->PlayStartSound(); - m_framePage.Command( FRAME_OFF_COMMAND ); + m_framePage.RunCommands( FRAME_OFF_COMMAND ); break; case SM_GainFocus: INPUTFILTER->SetRepeatRate( 0.25f, 12, 0.25f, 12 ); @@ -1099,7 +1099,7 @@ void ScreenOptions::OnChange( PlayerNumber pn ) if( pText->GetText() != text ) { pText->FinishTweening(); - pText->Command( EXPLANATION_ON_COMMAND(pn) ); + pText->RunCommands( EXPLANATION_ON_COMMAND(pn) ); pText->SetText( text ); } break; @@ -1108,7 +1108,7 @@ void ScreenOptions::OnChange( PlayerNumber pn ) if( pText->GetText() != text ) { pText->FinishTweening(); - pText->Command( EXPLANATION_TOGETHER_ON_COMMAND ); + pText->RunCommands( EXPLANATION_TOGETHER_ON_COMMAND ); pText->SetText( text ); } break; diff --git a/stepmania/src/ScreenOptionsMaster.cpp b/stepmania/src/ScreenOptionsMaster.cpp index c13968adbd..d51c82052e 100644 --- a/stepmania/src/ScreenOptionsMaster.cpp +++ b/stepmania/src/ScreenOptionsMaster.cpp @@ -58,7 +58,7 @@ void ScreenOptionsMaster::SetList( OptionRowData &row, OptionRowHandler &hand, C return; } - hand.Default.Load( -1, ParseActorCommands(ENTRY_DEFAULT(ListName)) ); + hand.Default.Load( -1, ParseCommands(ENTRY_DEFAULT(ListName)) ); /* Parse the basic configuration metric. */ CStringArray asParts; @@ -79,7 +79,7 @@ void ScreenOptionsMaster::SetList( OptionRowData &row, OptionRowHandler &hand, C for( int col = 0; col < NumCols; ++col ) { GameCommand mc; - mc.Load( 0, ParseActorCommands(ENTRY_MODE(ListName, col)) ); + mc.Load( 0, ParseCommands(ENTRY_MODE(ListName, col)) ); if( mc.m_sName == "" ) RageException::Throw( "List \"%s\", col %i has no name", ListName.c_str(), col ); @@ -247,8 +247,8 @@ ScreenOptionsMaster::ScreenOptionsMaster( CString sClassName ): CString sRowCommands = LINE(sLineName); - ActorCommands vCommands; - ParseActorCommands( sRowCommands, vCommands ); + Commands vCommands; + ParseCommands( sRowCommands, vCommands ); if( vCommands.v.size() < 1 ) RageException::Throw( "Parse error in %s::Line%i", m_sName.c_str(), i+1 ); @@ -256,15 +256,15 @@ ScreenOptionsMaster::ScreenOptionsMaster( CString sClassName ): OptionRowHandler hand; for( unsigned part = 0; part < vCommands.v.size(); ++part) { - ActorCommand& command = vCommands.v[part]; + Command& command = vCommands.v[part]; - BeginHandleParams; + BeginHandleArgs; - const CString name = sParam(0); + const CString &name = command.GetName(); if( !name.CompareNoCase("list") ) { - SetList( row, hand, sParam(1), row.name ); + SetList( row, hand, sArg(1), row.name ); } else if( !name.CompareNoCase("steps") ) { @@ -273,7 +273,7 @@ ScreenOptionsMaster::ScreenOptionsMaster( CString sClassName ): } else if( !name.CompareNoCase("conf") ) { - SetConf( row, hand, sParam(1), row.name ); + SetConf( row, hand, sArg(1), row.name ); } else if( !name.CompareNoCase("characters") ) { @@ -283,7 +283,7 @@ ScreenOptionsMaster::ScreenOptionsMaster( CString sClassName ): else RageException::Throw( "Unexpected type '%s' in %s::Line%i", name.c_str(), m_sName.c_str(), i ); - EndHandleParams; + EndHandleArgs; } // TRICKY: Insert a down arrow as the first choice in the row. diff --git a/stepmania/src/ScreenSelect.cpp b/stepmania/src/ScreenSelect.cpp index d797dff735..5bcc024ebb 100644 --- a/stepmania/src/ScreenSelect.cpp +++ b/stepmania/src/ScreenSelect.cpp @@ -51,7 +51,7 @@ ScreenSelect::ScreenSelect( CString sClassName ) : ScreenWithMenuElements(sClass GameCommand mc; mc.m_sName = sChoiceName; - mc.Load( c, ParseActorCommands(sChoice) ); + mc.Load( c, ParseCommands(sChoice) ); m_aGameCommands.push_back( mc ); CString sBGAnimationDir = THEME->GetPath(BGAnimations, m_sName, mc.m_sName, true); // true="optional" @@ -74,7 +74,7 @@ ScreenSelect::ScreenSelect( CString sClassName ) : ScreenWithMenuElements(sClass m_aCodes.push_back( code ); m_aCodeActions.push_back( CODE_ACTION(c) ); GameCommand mc; - mc.Load( c, ParseActorCommands(CODE_ACTION(c)) ); + mc.Load( c, ParseCommands(CODE_ACTION(c)) ); m_aCodeChoices.push_back( mc ); } diff --git a/stepmania/src/ScreenSelectCharacter.cpp b/stepmania/src/ScreenSelectCharacter.cpp index 6b7e788ead..ada7f0a808 100644 --- a/stepmania/src/ScreenSelectCharacter.cpp +++ b/stepmania/src/ScreenSelectCharacter.cpp @@ -94,15 +94,15 @@ ScreenSelectCharacter::ScreenSelectCharacter( CString sClassName ) : ScreenWithM m_sprTitle[p].Load( THEME->GetPathToG("ScreenSelectCharacter title 2x2") ); m_sprTitle[p].SetState( GAMESTATE->IsHumanPlayer(p) ? p : 2+p ); m_sprTitle[p].StopAnimating(); - m_sprTitle[p].Command( TITLE_ON_COMMAND(p) ); + m_sprTitle[p].RunCommands( TITLE_ON_COMMAND(p) ); this->AddChild( &m_sprTitle[p] ); - m_sprCard[p].Command( CARD_ON_COMMAND(p) ); + m_sprCard[p].RunCommands( CARD_ON_COMMAND(p) ); this->AddChild( &m_sprCard[p] ); m_sprCardArrows[p].Load( THEME->GetPathToG("ScreenSelectCharacter card arrows") ); - m_sprCardArrows[p].Command( CARD_ARROWS_ON_COMMAND(p) ); + m_sprCardArrows[p].RunCommands( CARD_ARROWS_ON_COMMAND(p) ); this->AddChild( &m_sprCardArrows[p] ); for( unsigned i=0; iGetPathToG("ScreenSelectCharacter attack frame 1x2") ); m_sprAttackFrame[p].StopAnimating(); m_sprAttackFrame[p].SetState( p ); - m_sprAttackFrame[p].Command( ATTACK_FRAME_ON_COMMAND(p) ); + m_sprAttackFrame[p].RunCommands( ATTACK_FRAME_ON_COMMAND(p) ); this->AddChild( &m_sprAttackFrame[p] ); for( int i=0; iAddChild( &m_AttackIcons[p][i][j] ); } } } m_sprExplanation.Load( THEME->GetPathToG("ScreenSelectCharacter explanation") ); - m_sprExplanation.Command( EXPLANATION_ON_COMMAND ); + m_sprExplanation.RunCommands( EXPLANATION_ON_COMMAND ); this->AddChild( &m_sprExplanation ); @@ -151,7 +151,7 @@ ScreenSelectCharacter::ScreenSelectCharacter( CString sClassName ) : ScreenWithM } for( unsigned i=0; im_PlayMode == PLAY_MODE_BATTLE || GAMESTATE->m_PlayMode == PLAY_MODE_RAVE) { - m_sprAttackFrame[p].Command( ATTACK_FRAME_OFF_COMMAND(p) ); + m_sprAttackFrame[p].RunCommands( ATTACK_FRAME_OFF_COMMAND(p) ); for( int i=0; iIsExtraStage() || GAMESTATE->IsExtraStage2() ) - m_textSongOptions.Command( SONG_OPTIONS_EXTRA_COMMAND ); + m_textSongOptions.RunCommands( SONG_OPTIONS_EXTRA_COMMAND ); } void ScreenSelectMusic::TweenOffScreen() @@ -623,8 +623,8 @@ void ScreenSelectMusic::TweenScoreOnAndOffAfterChangeSort() { if( !GAMESTATE->IsHumanPlayer(p) ) continue; // skip - m_textHighScore[p].Command( SCORE_SORT_CHANGE_COMMAND(p) ); - m_sprHighScoreFrame[p].Command( SCORE_FRAME_SORT_CHANGE_COMMAND(p) ); + m_textHighScore[p].RunCommands( SCORE_SORT_CHANGE_COMMAND(p) ); + m_sprHighScoreFrame[p].RunCommands( SCORE_FRAME_SORT_CHANGE_COMMAND(p) ); } switch( GAMESTATE->m_SortOrder ) diff --git a/stepmania/src/ScreenSelectStyle.cpp b/stepmania/src/ScreenSelectStyle.cpp index 4467c4016c..4787e13cf0 100644 --- a/stepmania/src/ScreenSelectStyle.cpp +++ b/stepmania/src/ScreenSelectStyle.cpp @@ -262,8 +262,8 @@ void ScreenSelectStyle::UpdateSelectableChoices() void ScreenSelectStyle::BeforeChange() { // dim/hide old selection - m_sprIcon[m_iSelection].Command( ICON_LOSE_FOCUS_COMMAND ); - m_textIcon[m_iSelection].Command( ICON_LOSE_FOCUS_COMMAND ); + m_sprIcon[m_iSelection].RunCommands( ICON_LOSE_FOCUS_COMMAND ); + m_textIcon[m_iSelection].RunCommands( ICON_LOSE_FOCUS_COMMAND ); m_sprPicture[m_iSelection].StopTweening(); m_sprInfo[m_iSelection].StopTweening(); m_sprPicture[m_iSelection].SetDiffuse( RageColor(1,1,1,0) ); @@ -274,8 +274,8 @@ void ScreenSelectStyle::BeforeChange() void ScreenSelectStyle::AfterChange() { - m_sprIcon[m_iSelection].Command( ICON_GAIN_FOCUS_COMMAND ); - m_textIcon[m_iSelection].Command( ICON_GAIN_FOCUS_COMMAND ); + m_sprIcon[m_iSelection].RunCommands( ICON_GAIN_FOCUS_COMMAND ); + m_textIcon[m_iSelection].RunCommands( ICON_GAIN_FOCUS_COMMAND ); m_sprPicture[m_iSelection].SetDiffuse( RageColor(1,1,1,1) ); m_sprInfo[m_iSelection].SetDiffuse( RageColor(1,1,1,1) ); m_sprPicture[m_iSelection].SetZoom( 1 ); diff --git a/stepmania/src/ScreenSystemLayer.cpp b/stepmania/src/ScreenSystemLayer.cpp index 0665d62707..d04c1f026b 100644 --- a/stepmania/src/ScreenSystemLayer.cpp +++ b/stepmania/src/ScreenSystemLayer.cpp @@ -97,8 +97,8 @@ void ScreenSystemLayer::ReloadCreditsText() void ScreenSystemLayer::SystemMessage( const CString &sMessage ) { m_textMessage.SetText( sMessage ); - static const ActorCommands cmds = ParseActorCommands("finishtweening;diffusealpha,1;addx,-640;linear,0.5;addx,+640;sleep,5;linear,0.5;diffusealpha,0"); - m_textMessage.Command( cmds ); + static const Commands cmds = ParseCommands("finishtweening;diffusealpha,1;addx,-640;linear,0.5;addx,+640;sleep,5;linear,0.5;diffusealpha,0"); + m_textMessage.RunCommands( cmds ); } void ScreenSystemLayer::SystemMessageNoAnimate( const CString &sMessage ) diff --git a/stepmania/src/ScreenTitleMenu.cpp b/stepmania/src/ScreenTitleMenu.cpp index 721b550198..24c55f7910 100644 --- a/stepmania/src/ScreenTitleMenu.cpp +++ b/stepmania/src/ScreenTitleMenu.cpp @@ -78,7 +78,7 @@ ScreenTitleMenu::ScreenTitleMenu( CString sClassName ) : ScreenSelect( sClassNam m_sprLogo.Load( THEME->GetPathG("ScreenLogo",GAMESTATE->GetCurrentGame()->m_szName) ); - m_sprLogo.Command( PREFSMAN->GetCoinMode()==COIN_HOME ? LOGO_HOME_ON_COMMAND : LOGO_ON_COMMAND ); + m_sprLogo.RunCommands( PREFSMAN->GetCoinMode()==COIN_HOME ? LOGO_HOME_ON_COMMAND : LOGO_ON_COMMAND ); this->AddChild( &m_sprLogo ); if( PREFSMAN->GetCoinMode() != COIN_HOME ) @@ -97,13 +97,13 @@ ScreenTitleMenu::ScreenTitleMenu( CString sClassName ) : ScreenSelect( sClassNam } m_textVersion.LoadFromFont( THEME->GetPathToF("Common normal") ); - m_textVersion.Command( VERSION_ON_COMMAND ); + m_textVersion.RunCommands( VERSION_ON_COMMAND ); m_textVersion.SetText( PRODUCT_VER ); this->AddChild( &m_textVersion ); m_textSongs.LoadFromFont( THEME->GetPathToF("Common normal") ); - m_textSongs.Command( SONGS_ON_COMMAND ); + m_textSongs.RunCommands( SONGS_ON_COMMAND ); CString text = ssprintf("%d songs in %d groups, %d courses", SONGMAN->GetNumSongs(), SONGMAN->GetNumGroups(), SONGMAN->GetNumCourses() ); if( PREFSMAN->m_bUseUnlockSystem ) text += ssprintf(", %d unlocks", UNLOCKMAN->GetNumUnlocks() ); @@ -111,7 +111,7 @@ ScreenTitleMenu::ScreenTitleMenu( CString sClassName ) : ScreenSelect( sClassNam this->AddChild( &m_textSongs ); m_textMaxStages.LoadFromFont( THEME->GetPathF(m_sName,"MaxStages") ); - m_textMaxStages.Command( MAX_STAGES_ON_COMMAND ); + m_textMaxStages.RunCommands( MAX_STAGES_ON_COMMAND ); CString sText = PREFSMAN->m_bEventMode ? CString("event mode") : @@ -120,7 +120,7 @@ ScreenTitleMenu::ScreenTitleMenu( CString sClassName ) : ScreenSelect( sClassNam this->AddChild( &m_textMaxStages ); m_textLifeDifficulty.LoadFromFont( THEME->GetPathF(m_sName,"LifeDifficulty") ); - m_textLifeDifficulty.Command( LIFE_DIFFICULTY_ON_COMMAND ); + m_textLifeDifficulty.RunCommands( LIFE_DIFFICULTY_ON_COMMAND ); int iLifeDifficulty; const CStringArray dummy; LifeDifficulty( iLifeDifficulty, true, dummy ); @@ -184,7 +184,7 @@ ScreenTitleMenu::ScreenTitleMenu( CString sClassName ) : ScreenSelect( sClassNam if( i != m_Choice ) { m_textChoice[i].SetZoom( ZOOM_NOT_SELECTED ); - m_textChoice[i].Command( MENU_ITEM_CREATE ); + m_textChoice[i].RunCommands( MENU_ITEM_CREATE ); } else GainFocus( m_Choice ); diff --git a/stepmania/src/ScreenUnlock.cpp b/stepmania/src/ScreenUnlock.cpp index 7c92b2da76..1e48022f2f 100644 --- a/stepmania/src/ScreenUnlock.cpp +++ b/stepmania/src/ScreenUnlock.cpp @@ -45,7 +45,7 @@ ScreenUnlock::ScreenUnlock( CString sClassName ) : ScreenAttract( sClassName ) PointsUntilNextUnlock.LoadFromFont( THEME->GetPathToF("Common normal") ); PointsUntilNextUnlock.SetHorizAlign( Actor::align_left ); - const ActorCommands IconCommand = ICON_COMMAND; + const Commands IconCommand = ICON_COMMAND; for( unsigned i=1; i <= NumUnlocks; i++ ) { // get pertaining UnlockEntry @@ -72,7 +72,7 @@ ScreenUnlock::ScreenUnlock( CString sClassName ) : ScreenAttract( sClassName ) entry->SetName( ssprintf("Unlock%d",i) ); SET_XY( *entry ); - entry->Command(IconCommand); + entry->RunCommands(IconCommand); Unlocks.push_back(entry); if ( !pSong->IsLocked() ) @@ -166,12 +166,12 @@ ScreenUnlock::ScreenUnlock( CString sClassName ) : ScreenAttract( sClassName ) LOG->Trace("Target Row: %f", TargetRow); LOG->Trace("command for icon %d: %s", i, ssprintf("diffusealpha,0;sleep,%f;diffusealpha,1;linear,%f;y,%f;linear,%f;y,%f;linear,0.1;diffusealpha,0", SECS_PER_CYCLE * (i - 1), FirstCycleTime, StopOffPoint, SecondCycleTime * 2, ScrollingTextEndY).c_str() ); CString sCommand = ssprintf("diffusealpha,0;sleep,%f;diffusealpha,1;linear,%f;y,%f;linear,%f;y,%f;linear,0.1;diffusealpha,0", SECS_PER_CYCLE * (i - 1), FirstCycleTime, StopOffPoint, SecondCycleTime, ScrollingTextEndY); - text->Command( ParseActorCommands(sCommand) ); + text->RunCommands( ParseCommands(sCommand) ); } else { CString sCommand = ssprintf("diffusealpha,0;sleep,%f;diffusealpha,1;linear,%f;y,%f;linear,0.1;diffusealpha,0", SECS_PER_CYCLE * (i - 1), SECS_PER_CYCLE * (ScrollingTextRows), ScrollingTextEndY); - text->Command( ParseActorCommands(sCommand) ); + text->RunCommands( ParseCommands(sCommand) ); } item.push_back(text); @@ -198,12 +198,12 @@ ScreenUnlock::ScreenUnlock( CString sClassName ) : ScreenAttract( sClassName ) LOG->Trace("Target Row: %f", TargetRow); LOG->Trace("command for icon %d: %s", i, ssprintf("diffusealpha,0;sleep,%f;diffusealpha,1;linear,%f;y,%f;linear,%f;y,%f;linear,0.1;diffusealpha,0", SECS_PER_CYCLE * (i - 1), FirstCycleTime, StopOffPoint, SecondCycleTime * 2, ScrollingTextEndY).c_str() ); CString sCommand = ssprintf("diffusealpha,0;sleep,%f;diffusealpha,1;linear,%f;y,%f;linear,%f;y,%f;linear,0.1;diffusealpha,0", SECS_PER_CYCLE * (i - 1), FirstCycleTime, StopOffPoint, SecondCycleTime, ScrollingTextEndY); - IconCount->Command( ParseActorCommands(sCommand) ); + IconCount->RunCommands( ParseCommands(sCommand) ); } else { CString sCommand = ssprintf("diffusealpha,0;sleep,%f;diffusealpha,1;linear,%f;y,%f;linear,0.1;diffusealpha,0", SECS_PER_CYCLE * (i - 1), SECS_PER_CYCLE * (ScrollingTextRows), ScrollingTextEndY); - IconCount->Command( ParseActorCommands(sCommand) ); + IconCount->RunCommands( ParseCommands(sCommand) ); } ItemIcons.push_back(IconCount); @@ -269,7 +269,7 @@ ScreenUnlock::ScreenUnlock( CString sClassName ) : ScreenAttract( sClassName ) NewText->SetXY(ScrollingTextX, ScrollingTextStartY); { CString sCommand = ssprintf("diffusealpha,0;sleep,%f;diffusealpha,1;linear,%f;y,%f;", SECS_PER_CYCLE * (NumUnlocks + 2 * i - 2), SECS_PER_CYCLE * ((ScrollingTextRows - i) * 2 + 1 ), (ScrollingTextStartY + (ScrollingTextEndY - ScrollingTextStartY) * (ScrollingTextRows - i + 0.5) / ScrollingTextRows )); - NewText->Command( ParseActorCommands(sCommand) ); + NewText->RunCommands( ParseCommands(sCommand) ); } // new unlock graphic @@ -280,7 +280,7 @@ ScreenUnlock::ScreenUnlock( CString sClassName ) : ScreenAttract( sClassName ) NewIcon->SetWidth(UNLOCK_TEXT_SCROLL_ICON_SIZE); { CString sCommand = ssprintf("diffusealpha,0;sleep,%f;diffusealpha,1;linear,%f;y,%f;", SECS_PER_CYCLE * (NumUnlocks + 2 * i - 2), SECS_PER_CYCLE * ((ScrollingTextRows - i) * 2 + 1 ), (ScrollingTextStartY + (ScrollingTextEndY - ScrollingTextStartY) * (ScrollingTextRows - i + 0.5) / ScrollingTextRows )); - NewIcon->Command( ParseActorCommands(sCommand) ); + NewIcon->RunCommands( ParseCommands(sCommand) ); } ItemIcons.push_back(NewIcon); diff --git a/stepmania/src/Sprite.cpp b/stepmania/src/Sprite.cpp index 8085bd5e7d..264da1f3ca 100644 --- a/stepmania/src/Sprite.cpp +++ b/stepmania/src/Sprite.cpp @@ -888,33 +888,33 @@ void Sprite::StretchTexCoords( float fX, float fY ) SetCustomTextureCoords( fTexCoords ); } -void Sprite::HandleCommand( const ActorCommand &command ) +void Sprite::HandleCommand( const Command &command ) { - BeginHandleParams; + BeginHandleArgs; - const CString& sName = sParam(0); + const CString& sName = command.GetName(); // Commands that go in the tweening queue: // Commands that take effect immediately (ignoring the tweening queue): - if( sName=="customtexturerect" ) SetCustomTextureRect( RectF(fParam(1),fParam(2),fParam(3),fParam(4)) ); - else if( sName=="texcoordvelocity" ) SetTexCoordVelocity( fParam(1),fParam(2) ); - else if( sName=="scaletoclipped" ) ScaleToClipped( fParam(1),fParam(2) ); - else if( sName=="stretchtexcoords" ) StretchTexCoords( fParam(1),fParam(2) ); + if( sName=="customtexturerect" ) SetCustomTextureRect( RectF(fArg(1),fArg(2),fArg(3),fArg(4)) ); + else if( sName=="texcoordvelocity" ) SetTexCoordVelocity( fArg(1),fArg(2) ); + else if( sName=="scaletoclipped" ) ScaleToClipped( fArg(1),fArg(2) ); + else if( sName=="stretchtexcoords" ) StretchTexCoords( fArg(1),fArg(2) ); /* Texture commands; these could be moved to RageTexture* (even though that's * not an Actor) if these are needed for other things that use textures. * We'd need to break the command helpers into a separate function; RageTexture * shouldn't depend on Actor. */ - else if( sName=="position" ) GetTexture()->SetPosition( fParam(1) ); - else if( sName=="loop" ) GetTexture()->SetLooping( bParam(1) ); - else if( sName=="rate" ) GetTexture()->SetPlaybackRate( fParam(1) ); + else if( sName=="position" ) GetTexture()->SetPosition( fArg(1) ); + else if( sName=="loop" ) GetTexture()->SetLooping( bArg(1) ); + else if( sName=="rate" ) GetTexture()->SetPlaybackRate( fArg(1) ); else { Actor::HandleCommand( command ); return; } - EndHandleParams; + EndHandleArgs; } /* diff --git a/stepmania/src/Sprite.h b/stepmania/src/Sprite.h index e700b663ee..ad91ef8ef2 100644 --- a/stepmania/src/Sprite.h +++ b/stepmania/src/Sprite.h @@ -60,7 +60,7 @@ public: void ScaleToClipped( float fWidth, float fHeight ); static bool IsDiagonalBanner( int iWidth, int iHeight ); - virtual void HandleCommand( const ActorCommand &command ); + virtual void HandleCommand( const Command &command ); protected: virtual bool LoadFromTexture( RageTextureID ID ); diff --git a/stepmania/src/StepMania.dsp b/stepmania/src/StepMania.dsp index 95c57d6f1e..43f534e349 100644 --- a/stepmania/src/StepMania.dsp +++ b/stepmania/src/StepMania.dsp @@ -62,7 +62,7 @@ IntDir=.\../Debug6 TargetDir=\stepmania\stepmania\Program TargetName=StepMania-debug SOURCE="$(InputPath)" -PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ +PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ PostBuild_Cmds=archutils\Win32\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi # End Special Build Tool @@ -99,7 +99,7 @@ IntDir=.\../Release6 TargetDir=\stepmania\stepmania\Program TargetName=StepMania SOURCE="$(InputPath)" -PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ +PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ PostBuild_Cmds=archutils\Win32\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi # End Special Build Tool @@ -664,6 +664,14 @@ SOURCE=.\CodeDetector.h # End Source File # Begin Source File +SOURCE=.\Command.cpp +# End Source File +# Begin Source File + +SOURCE=.\Command.h +# End Source File +# Begin Source File + SOURCE=.\Course.cpp # End Source File # Begin Source File diff --git a/stepmania/src/StepMania.vcproj b/stepmania/src/StepMania.vcproj index 4686fd6f19..e2a42119af 100644 --- a/stepmania/src/StepMania.vcproj +++ b/stepmania/src/StepMania.vcproj @@ -629,6 +629,12 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\ + + + + @@ -2216,12 +2222,6 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\ - - - - diff --git a/stepmania/src/TextBanner.cpp b/stepmania/src/TextBanner.cpp index 9d31bd1534..1f4e04f7f2 100644 --- a/stepmania/src/TextBanner.cpp +++ b/stepmania/src/TextBanner.cpp @@ -10,12 +10,12 @@ #include "ThemeMetric.h" ThemeMetric ARTIST_PREPEND_STRING ("TextBanner","ArtistPrependString"); -ThemeMetric TWO_LINES_TITLE_COMMAND ("TextBanner","TwoLinesTitleCommand"); -ThemeMetric TWO_LINES_SUBTITLE_COMMAND ("TextBanner","TwoLinesSubtitleCommand"); -ThemeMetric TWO_LINES_ARTIST_COMMAND ("TextBanner","TwoLinesArtistCommand"); -ThemeMetric THREE_LINES_TITLE_COMMAND ("TextBanner","ThreeLinesTitleCommand"); -ThemeMetric THREE_LINES_SUBTITLE_COMMAND ("TextBanner","ThreeLinesSubtitleCommand"); -ThemeMetric THREE_LINES_ARTIST_COMMAND ("TextBanner","ThreeLinesArtistCommand"); +ThemeMetric TWO_LINES_TITLE_COMMAND ("TextBanner","TwoLinesTitleCommand"); +ThemeMetric TWO_LINES_SUBTITLE_COMMAND ("TextBanner","TwoLinesSubtitleCommand"); +ThemeMetric TWO_LINES_ARTIST_COMMAND ("TextBanner","TwoLinesArtistCommand"); +ThemeMetric THREE_LINES_TITLE_COMMAND ("TextBanner","ThreeLinesTitleCommand"); +ThemeMetric THREE_LINES_SUBTITLE_COMMAND ("TextBanner","ThreeLinesSubtitleCommand"); +ThemeMetric THREE_LINES_ARTIST_COMMAND ("TextBanner","ThreeLinesArtistCommand"); void TextBanner::Init() { @@ -58,15 +58,15 @@ void TextBanner::LoadFromString( if( bTwoLines ) { - m_textTitle.Command( TWO_LINES_TITLE_COMMAND ); - m_textSubTitle.Command( TWO_LINES_SUBTITLE_COMMAND ); - m_textArtist.Command( TWO_LINES_ARTIST_COMMAND ); + m_textTitle.RunCommands( TWO_LINES_TITLE_COMMAND ); + m_textSubTitle.RunCommands( TWO_LINES_SUBTITLE_COMMAND ); + m_textArtist.RunCommands( TWO_LINES_ARTIST_COMMAND ); } else { - m_textTitle.Command( THREE_LINES_TITLE_COMMAND ); - m_textSubTitle.Command( THREE_LINES_SUBTITLE_COMMAND ); - m_textArtist.Command( THREE_LINES_ARTIST_COMMAND ); + m_textTitle.RunCommands( THREE_LINES_TITLE_COMMAND ); + m_textSubTitle.RunCommands( THREE_LINES_SUBTITLE_COMMAND ); + m_textArtist.RunCommands( THREE_LINES_ARTIST_COMMAND ); } m_textTitle.SetText( sDisplayTitle, sTranslitTitle ); diff --git a/stepmania/src/ThemeManager.cpp b/stepmania/src/ThemeManager.cpp index 11d39bab67..f0988e26ba 100644 --- a/stepmania/src/ThemeManager.cpp +++ b/stepmania/src/ThemeManager.cpp @@ -703,9 +703,9 @@ RageColor ThemeManager::GetMetricC( const CString &sClassName, const CString &sV return ret; } -ActorCommands ThemeManager::GetMetricA( const CString &sClassName, const CString &sValueName ) +Commands ThemeManager::GetMetricA( const CString &sClassName, const CString &sValueName ) { - return ParseActorCommands( GetMetricRaw(sClassName,sValueName) ); + return ParseCommands( GetMetricRaw(sClassName,sValueName) ); } void ThemeManager::NextTheme() @@ -765,7 +765,7 @@ void ThemeManager::GetModifierNames( set& AddTo ) } } -void ThemeManager::GetMetric( const CString &sClassName, const CString &sValueName, ActorCommands &valueOut ) +void ThemeManager::GetMetric( const CString &sClassName, const CString &sValueName, Commands &valueOut ) { valueOut = GetMetricA( sClassName, sValueName ); } diff --git a/stepmania/src/ThemeManager.h b/stepmania/src/ThemeManager.h index a7a3a85b48..f567541cd8 100644 --- a/stepmania/src/ThemeManager.h +++ b/stepmania/src/ThemeManager.h @@ -10,7 +10,7 @@ class IThemeMetric; class IniFile; -struct ActorCommands; +class Commands; enum ElementCategory { BGAnimations, Fonts, Graphics, Numbers, Sounds, Other, NUM_ELEMENT_CATEGORIES }; @@ -59,14 +59,14 @@ public: float GetMetricF( const CString &sClassName, const CString &sValueName ); bool GetMetricB( const CString &sClassName, const CString &sValueName ); RageColor GetMetricC( const CString &sClassName, const CString &sValueName ); - ActorCommands GetMetricA( const CString &sClassName, const CString &sValueName ); + Commands GetMetricA( const CString &sClassName, const CString &sValueName ); void GetMetric( const CString &sClassName, const CString &sValueName, CString &valueOut ) { valueOut = GetMetric( sClassName, sValueName ); } void GetMetric( const CString &sClassName, const CString &sValueName, int &valueOut ) { valueOut = GetMetricI( sClassName, sValueName ); } void GetMetric( const CString &sClassName, const CString &sValueName, float &valueOut ) { valueOut = GetMetricF( sClassName, sValueName ); } void GetMetric( const CString &sClassName, const CString &sValueName, bool &valueOut ) { valueOut = GetMetricB( sClassName, sValueName ); } void GetMetric( const CString &sClassName, const CString &sValueName, RageColor &valueOut ) { valueOut = GetMetricC( sClassName, sValueName ); } - void GetMetric( const CString &sClassName, const CString &sValueName, ActorCommands &valueOut ); + void GetMetric( const CString &sClassName, const CString &sValueName, Commands &valueOut ); // // For self-registering metrics