Files
itgmania212121/stepmania/src/ScoreDisplayBattle.cpp
T

99 lines
3.4 KiB
C++
Raw Normal View History

2003-02-25 00:33:42 +00:00
#include "global.h"
#include "ScoreDisplayBattle.h"
#include "RageUtil.h"
#include "RageLog.h"
#include "RageLog.h"
#include "GameState.h"
#include "ThemeManager.h"
#include "PlayerState.h"
2005-01-26 11:21:43 +00:00
#include "Command.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()" );
2005-02-06 03:32:53 +00:00
m_sprFrame.Load( THEME->GetPathG("ScoreDisplayBattle","frame") );
2003-05-05 06:48:20 +00:00
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
2005-12-09 21:36:22 +00:00
vector<CString> asIconPaths;
2005-09-03 18:17:17 +00:00
GetDirListing( THEME->GetCurThemeDir()+"Graphic/ScoreDisplayBattle icon*", asIconPaths );
2003-04-22 04:54:04 +00:00
for( unsigned j=0; j<asIconPaths.size(); j++ )
2005-06-30 22:41:22 +00:00
m_TexturePreload.Load( asIconPaths[j] );
}
2003-02-25 00:33:42 +00:00
void ScoreDisplayBattle::Init( const PlayerState* pPlayerState, const PlayerStageStats* pPlayerStageStats )
{
ScoreDisplay::Init( pPlayerState, pPlayerStageStats );
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
{
const Attack& attack = m_pPlayerState->m_Inventory[s];
2005-05-20 08:57:59 +00:00
CString sNewModifier = attack.sModifiers;
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 == "" )
{
m_ItemIcon[s].RunCommands( ActorCommands( "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.
2005-02-06 03:32:53 +00:00
m_ItemIcon[s].Load( THEME->GetPathG("ScoreDisplayBattle","icon "+sNewModifier) );
2003-04-07 21:24:14 +00:00
m_ItemIcon[s].StopTweening();
ActorCommands acmds(
"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;" );
2005-01-26 11:21:43 +00:00
m_ItemIcon[s].RunCommands( acmds );
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
}
2004-06-08 00:08:04 +00:00
/*
* (c) 2001-2003 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.
*/