2003-11-26 08:25:45 +00:00
|
|
|
#include "global.h"
|
|
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
Class: AttackDisplay
|
|
|
|
|
|
|
|
|
|
Desc: See header.
|
|
|
|
|
|
|
|
|
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
|
|
|
|
Chris Danford
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "AttackDisplay.h"
|
|
|
|
|
#include "ThemeManager.h"
|
|
|
|
|
#include "GameState.h"
|
|
|
|
|
|
2003-11-27 02:30:54 +00:00
|
|
|
#define TEXT_ON_COMMAND( p ) THEME->GetMetric("AttackDisplay",ssprintf("TextP%dOnCommand",p+1))
|
|
|
|
|
|
2003-11-26 08:25:45 +00:00
|
|
|
|
|
|
|
|
AttackDisplay::AttackDisplay()
|
|
|
|
|
{
|
2003-12-01 21:32:19 +00:00
|
|
|
if( GAMESTATE->m_PlayMode != PLAY_MODE_BATTLE &&
|
|
|
|
|
GAMESTATE->m_PlayMode != PLAY_MODE_RAVE )
|
|
|
|
|
return;
|
|
|
|
|
|
2003-11-26 08:25:45 +00:00
|
|
|
m_textAttack.LoadFromFont( THEME->GetPathToF("AttackDisplay") );
|
|
|
|
|
m_textAttack.SetDiffuseAlpha( 0 ); // invisible
|
|
|
|
|
this->AddChild( &m_textAttack );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AttackDisplay::Update( float fDelta )
|
|
|
|
|
{
|
|
|
|
|
ActorFrame::Update( fDelta );
|
|
|
|
|
|
2003-12-01 21:32:19 +00:00
|
|
|
if( GAMESTATE->m_PlayMode != PLAY_MODE_BATTLE &&
|
|
|
|
|
GAMESTATE->m_PlayMode != PLAY_MODE_RAVE )
|
|
|
|
|
return;
|
2003-11-27 02:30:54 +00:00
|
|
|
|
2003-12-01 21:32:19 +00:00
|
|
|
if( !GAMESTATE->m_bAttackBeganThisUpdate[m_PlayerNumber] )
|
|
|
|
|
return;
|
|
|
|
|
// don't handle this again
|
|
|
|
|
GAMESTATE->m_bAttackBeganThisUpdate[m_PlayerNumber] = false;
|
|
|
|
|
|
|
|
|
|
for( unsigned s=0; s<GAMESTATE->m_ActiveAttacks[m_PlayerNumber].size(); s++ )
|
|
|
|
|
{
|
|
|
|
|
if( GAMESTATE->m_ActiveAttacks[m_PlayerNumber][s].fStartSecond >= 0 )
|
|
|
|
|
continue; /* hasn't started yet */
|
2003-11-27 02:30:54 +00:00
|
|
|
|
2003-12-01 21:32:19 +00:00
|
|
|
if( GAMESTATE->m_ActiveAttacks[m_PlayerNumber][s].fSecsRemaining <= 0 )
|
|
|
|
|
continue; /* ended already */
|
2003-11-27 02:30:54 +00:00
|
|
|
|
2003-12-01 21:32:19 +00:00
|
|
|
if( GAMESTATE->m_ActiveAttacks[m_PlayerNumber][s].IsBlank() )
|
|
|
|
|
continue;
|
2003-11-27 02:30:54 +00:00
|
|
|
|
2003-12-01 21:32:19 +00:00
|
|
|
CString sText = GAMESTATE->m_ActiveAttacks[m_PlayerNumber][s].sModifier;
|
2003-11-27 02:30:54 +00:00
|
|
|
|
2003-12-01 21:32:19 +00:00
|
|
|
m_textAttack.SetDiffuseAlpha( 1 );
|
|
|
|
|
m_textAttack.SetText( sText );
|
|
|
|
|
m_textAttack.Command( TEXT_ON_COMMAND(m_PlayerNumber) );
|
2003-11-27 02:30:54 +00:00
|
|
|
|
2003-12-01 21:32:19 +00:00
|
|
|
break;
|
2003-11-26 08:25:45 +00:00
|
|
|
}
|
|
|
|
|
}
|