2004-03-17 06:01:17 +00:00
|
|
|
#include "global.h"
|
|
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
File: ActiveAttackList.h
|
|
|
|
|
|
|
|
|
|
Desc: A graphic displayed in the ActiveAttackList during Dancing.
|
|
|
|
|
|
|
|
|
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
|
|
|
|
Chris Danford
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "ActiveAttackList.h"
|
|
|
|
|
#include "RageUtil.h"
|
|
|
|
|
#include "GameState.h"
|
|
|
|
|
#include "ThemeManager.h"
|
|
|
|
|
#include "Inventory.h"
|
|
|
|
|
#include "RageTimer.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ActiveAttackList::ActiveAttackList()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ActiveAttackList::Init( PlayerNumber pn )
|
|
|
|
|
{
|
|
|
|
|
m_PlayerNumber = pn;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ActiveAttackList::Update( float fDelta )
|
|
|
|
|
{
|
|
|
|
|
BitmapText::Update( fDelta );
|
|
|
|
|
|
|
|
|
|
// refresh text only once every second
|
|
|
|
|
float fNowSeconds = RageTimer::GetTimeSinceStart();
|
|
|
|
|
float fLastSeconds = RageTimer::GetTimeSinceStart() - fDelta;
|
|
|
|
|
|
|
|
|
|
if( (int)fNowSeconds != (int)fLastSeconds )
|
|
|
|
|
{
|
|
|
|
|
CString s;
|
|
|
|
|
|
|
|
|
|
const AttackArray& attacks = GAMESTATE->m_ActiveAttacks[m_PlayerNumber]; // NUM_INVENTORY_SLOTS
|
|
|
|
|
|
|
|
|
|
// clear all lines, then add all active attacks
|
2004-03-17 06:26:01 +00:00
|
|
|
for( unsigned i=0; i<attacks.size(); i++ )
|
2004-03-17 06:01:17 +00:00
|
|
|
{
|
|
|
|
|
const Attack& attack = attacks[i];
|
|
|
|
|
|
|
|
|
|
if( !attack.bOn )
|
|
|
|
|
continue; /* hasn't started yet */
|
|
|
|
|
|
|
|
|
|
CString sDisplayText = attack.sModifier;
|
2004-03-21 17:22:51 +00:00
|
|
|
|
|
|
|
|
// Strip out the approach speed token
|
|
|
|
|
if( !sDisplayText.empty() && sDisplayText[0]=='*' )
|
|
|
|
|
{
|
|
|
|
|
int iPos = sDisplayText.Find(' ');
|
|
|
|
|
if( iPos != -1 )
|
|
|
|
|
sDisplayText.erase( sDisplayText.begin(), sDisplayText.begin()+iPos+1 );
|
|
|
|
|
}
|
|
|
|
|
|
2004-03-17 06:01:17 +00:00
|
|
|
if( s.empty() )
|
|
|
|
|
s = sDisplayText;
|
|
|
|
|
else
|
|
|
|
|
s = sDisplayText + "\n" + s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this->SetText( s ); // BitmapText will not rebuild vertices if these strings are the same.
|
|
|
|
|
}
|
|
|
|
|
}
|