From 4ff430076cfd25af375fc1f358380ea6b2c57311 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sun, 28 Dec 2003 21:48:43 +0000 Subject: [PATCH] AttackDisplay work --- stepmania/src/AttackDisplay.cpp | 23 +++++++++++++++-------- stepmania/src/AttackDisplay.h | 3 ++- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/stepmania/src/AttackDisplay.cpp b/stepmania/src/AttackDisplay.cpp index a4278825ac..c5f1ffd783 100644 --- a/stepmania/src/AttackDisplay.cpp +++ b/stepmania/src/AttackDisplay.cpp @@ -13,8 +13,7 @@ #include "AttackDisplay.h" #include "ThemeManager.h" #include "GameState.h" - -#define TEXT_ON_COMMAND( p ) THEME->GetMetric("AttackDisplay",ssprintf("TextP%dOnCommand",p+1)) +#include "ActorUtil.h" AttackDisplay::AttackDisplay() @@ -23,11 +22,18 @@ AttackDisplay::AttackDisplay() GAMESTATE->m_PlayMode != PLAY_MODE_RAVE ) return; + m_textAttack.SetName( ssprintf("TextP%d",m_PlayerNumber+1) ); m_textAttack.LoadFromFont( THEME->GetPathToF("AttackDisplay") ); m_textAttack.SetDiffuseAlpha( 0 ); // invisible this->AddChild( &m_textAttack ); } +void AttackDisplay::Init( PlayerNumber pn ) +{ + m_PlayerNumber = pn; +} + + void AttackDisplay::Update( float fDelta ) { ActorFrame::Update( fDelta ); @@ -52,13 +58,14 @@ void AttackDisplay::Update( float fDelta ) if( GAMESTATE->m_ActiveAttacks[m_PlayerNumber][s].IsBlank() ) continue; - CString sText = GAMESTATE->m_ActiveAttacks[m_PlayerNumber][s].sModifier; - - m_textAttack.SetDiffuseAlpha( 1 ); - m_textAttack.SetText( sText ); - m_textAttack.Command( TEXT_ON_COMMAND(m_PlayerNumber) ); - + SetAttack( GAMESTATE->m_ActiveAttacks[m_PlayerNumber][s].sModifier ); break; } } +void AttackDisplay::SetAttack( const CString &sText ) +{ + m_textAttack.SetDiffuseAlpha( 1 ); + m_textAttack.SetText( sText ); + UtilOnCommand( m_textAttack, "AttackDisplay" ); +} diff --git a/stepmania/src/AttackDisplay.h b/stepmania/src/AttackDisplay.h index 2fb55181b1..6510714448 100644 --- a/stepmania/src/AttackDisplay.h +++ b/stepmania/src/AttackDisplay.h @@ -23,7 +23,8 @@ class AttackDisplay : public ActorFrame public: AttackDisplay(); - void Init( PlayerNumber pn ) { m_PlayerNumber = pn; } + void Init( PlayerNumber pn ); + void SetAttack( const CString &mod ); virtual void Update( float fDelta );