Files
itgmania212121/stepmania/src/ScoreDisplayBattle.cpp
T

81 lines
2.3 KiB
C++
Raw Normal View History

2003-02-25 00:33:42 +00:00
#include "global.h"
/*
-----------------------------------------------------------------------------
Class: ScoreDisplayBattle.h
Desc: A graphic displayed in the ScoreDisplayBattle during Dancing.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
#include "ScoreDisplayBattle.h"
#include "RageUtil.h"
#include "RageLog.h"
#include "PrefsManager.h"
#include "RageLog.h"
#include "GameState.h"
#include "ThemeManager.h"
2003-04-22 04:54:04 +00:00
#include "RageTextureManager.h"
2003-02-25 00:33:42 +00:00
2003-05-02 20:36:41 +00:00
#define ITEM_X( i ) THEME->GetMetricF("ScoreDisplayBattle",ssprintf("Item%dX",i+1))
#define ITEM_Y( i ) THEME->GetMetricF("ScoreDisplayBattle",ssprintf("Item%dY",i+1))
2003-02-25 00:33:42 +00:00
ScoreDisplayBattle::ScoreDisplayBattle()
{
LOG->Trace( "ScoreDisplayBattle::ScoreDisplayBattle()" );
2003-05-05 06:48:20 +00:00
m_sprFrame.Load( THEME->GetPathToG("ScoreDisplayBattle frame") );
this->AddChild( &m_sprFrame );
for( int i=0; i<NUM_INVENTORY_SLOTS; i++ )
2003-02-25 00:33:42 +00:00
{
2003-05-02 20:36:41 +00:00
m_ItemIcon[i].SetXY( ITEM_X(i), ITEM_Y(i) );
2003-04-07 21:24:14 +00:00
m_ItemIcon[i].StopAnimating();
this->AddChild( &m_ItemIcon[i] );
}
2003-04-22 04:54:04 +00:00
CStringArray asIconPaths;
GetDirListing( THEME->GetCurThemeDir()+"Graphic/ScoreDisplayBattle icon*.*", asIconPaths );
for( unsigned j=0; j<asIconPaths.size(); j++ )
TEXTUREMAN->CacheTexture( asIconPaths[j] );
}
2003-02-25 00:33:42 +00:00
void ScoreDisplayBattle::Init( PlayerNumber pn )
{
ScoreDisplay::Init( pn );
2003-02-25 00:33:42 +00:00
}
void ScoreDisplayBattle::Update( float fDelta )
{
ScoreDisplay::Update( fDelta );
for( int s=0; s<NUM_INVENTORY_SLOTS; s++ )
2003-02-25 00:33:42 +00:00
{
2003-04-14 22:12:54 +00:00
GameState::Attack attack = GAMESTATE->m_Inventory[m_PlayerNumber][s];
CString sNewModifier = attack.sModifier;
2003-02-25 02:51:04 +00:00
2003-04-14 22:12:54 +00:00
if( sNewModifier != m_iLastSeenInventory[s] )
2003-02-25 00:33:42 +00:00
{
2003-04-14 22:12:54 +00:00
m_iLastSeenInventory[s] = sNewModifier;
2003-04-14 22:12:54 +00:00
if( sNewModifier == "" )
2003-04-07 21:24:14 +00:00
m_ItemIcon[s].Command( "linear,0.25;zoom,0" );
2003-02-25 02:51:04 +00:00
else
{
2003-04-07 21:24:14 +00:00
// TODO: Cache all of the icon graphics so we don't load them dynamically from disk.
2003-04-14 22:12:54 +00:00
m_ItemIcon[s].Load( THEME->GetPathToG("ScoreDisplayBattle icon "+sNewModifier) );
2003-04-07 21:24:14 +00:00
m_ItemIcon[s].StopTweening();
m_ItemIcon[s].Command( "diffuse,1,1,1,1;zoom,1;"
"sleep,0.1;linear,0;diffusealpha,0;"
"sleep,0.1;linear,0;diffusealpha,1;"
"sleep,0.1;linear,0;diffusealpha,0;"
"sleep,0.1;linear,0;diffusealpha,1;"
"sleep,0.1;linear,0;diffusealpha,0;"
"sleep,0.1;linear,0;diffusealpha,1;" );
2003-02-25 02:51:04 +00:00
}
2003-02-25 00:33:42 +00:00
}
2003-04-07 21:24:14 +00:00
}
2003-02-25 00:33:42 +00:00
}