2003-02-16 04:01:45 +00:00
|
|
|
#include "global.h"
|
2002-02-24 01:43:11 +00:00
|
|
|
#include "Combo.h"
|
2002-11-11 04:53:31 +00:00
|
|
|
#include "ThemeManager.h"
|
2004-03-10 07:54:12 +00:00
|
|
|
#include "StageStats.h"
|
|
|
|
|
#include "GameState.h"
|
2004-03-13 01:47:52 +00:00
|
|
|
#include "song.h"
|
2004-11-06 20:36:04 +00:00
|
|
|
#include "ThemeMetric.h"
|
2005-01-26 11:21:43 +00:00
|
|
|
#include "Command.h"
|
2002-02-24 01:43:11 +00:00
|
|
|
|
|
|
|
|
|
2004-11-06 20:36:04 +00:00
|
|
|
ThemeMetric<float> LABEL_X ("Combo","LabelX");
|
|
|
|
|
ThemeMetric<float> LABEL_Y ("Combo","LabelY");
|
|
|
|
|
ThemeMetric<int> LABEL_HORIZ_ALIGN ("Combo","LabelHorizAlign");
|
|
|
|
|
ThemeMetric<int> LABEL_VERT_ALIGN ("Combo","LabelVertAlign");
|
|
|
|
|
ThemeMetric<float> NUMBER_X ("Combo","NumberX");
|
|
|
|
|
ThemeMetric<float> NUMBER_Y ("Combo","NumberY");
|
|
|
|
|
ThemeMetric<int> NUMBER_HORIZ_ALIGN ("Combo","NumberHorizAlign");
|
|
|
|
|
ThemeMetric<int> NUMBER_VERT_ALIGN ("Combo","NumberVertAlign");
|
|
|
|
|
ThemeMetric<int> SHOW_COMBO_AT ("Combo","ShowComboAt");
|
|
|
|
|
ThemeMetric<float> NUMBER_MIN_ZOOM ("Combo","NumberMinZoom");
|
|
|
|
|
ThemeMetric<float> NUMBER_MAX_ZOOM ("Combo","NumberMaxZoom");
|
|
|
|
|
ThemeMetric<float> NUMBER_MAX_ZOOM_AT ("Combo","NumberMaxZoomAt");
|
|
|
|
|
ThemeMetric<float> PULSE_ZOOM ("Combo","PulseZoom");
|
|
|
|
|
ThemeMetric<float> C_TWEEN_SECONDS ("Combo","TweenSeconds");
|
2005-01-26 11:21:43 +00:00
|
|
|
ThemeMetric<apActorCommands> FULL_COMBO_GREATS_COMMAND ("Combo","FullComboGreatsCommand");
|
|
|
|
|
ThemeMetric<apActorCommands> FULL_COMBO_PERFECTS_COMMAND ("Combo","FullComboPerfectsCommand");
|
|
|
|
|
ThemeMetric<apActorCommands> FULL_COMBO_MARVELOUSES_COMMAND ("Combo","FullComboMarvelousesCommand");
|
|
|
|
|
ThemeMetric<apActorCommands> FULL_COMBO_BROKEN_COMMAND ("Combo","FullComboBrokenCommand");
|
2004-11-06 20:36:04 +00:00
|
|
|
ThemeMetric<bool> SHOW_MISS_COMBO ("Combo","ShowMissCombo");
|
2002-08-26 08:11:52 +00:00
|
|
|
|
|
|
|
|
|
2002-02-24 01:43:11 +00:00
|
|
|
Combo::Combo()
|
|
|
|
|
{
|
2005-02-06 03:06:42 +00:00
|
|
|
m_sprComboLabel.Load( THEME->GetPathG("Combo","label") );
|
2004-07-31 21:26:11 +00:00
|
|
|
m_sprComboLabel.SetShadowLength( 4 );
|
|
|
|
|
m_sprComboLabel.StopAnimating();
|
|
|
|
|
m_sprComboLabel.SetXY( LABEL_X, LABEL_Y );
|
|
|
|
|
m_sprComboLabel.SetHorizAlign( (Actor::HorizAlign)(int)LABEL_HORIZ_ALIGN );
|
|
|
|
|
m_sprComboLabel.SetVertAlign( (Actor::VertAlign)(int)LABEL_VERT_ALIGN );
|
|
|
|
|
m_sprComboLabel.SetHidden( true );
|
|
|
|
|
this->AddChild( &m_sprComboLabel );
|
|
|
|
|
|
2005-02-06 03:06:42 +00:00
|
|
|
m_sprMissesLabel.Load( THEME->GetPathG("Combo","misses") );
|
2004-07-31 21:26:11 +00:00
|
|
|
m_sprMissesLabel.SetShadowLength( 4 );
|
|
|
|
|
m_sprMissesLabel.StopAnimating();
|
|
|
|
|
m_sprMissesLabel.SetXY( LABEL_X, LABEL_Y );
|
|
|
|
|
m_sprMissesLabel.SetHorizAlign( (Actor::HorizAlign)(int)LABEL_HORIZ_ALIGN );
|
|
|
|
|
m_sprMissesLabel.SetVertAlign( (Actor::VertAlign)(int)LABEL_VERT_ALIGN );
|
|
|
|
|
m_sprMissesLabel.SetHidden( true );
|
|
|
|
|
this->AddChild( &m_sprMissesLabel );
|
|
|
|
|
|
2005-02-06 03:06:42 +00:00
|
|
|
m_textNumber.LoadFromFont( THEME->GetPathF("Combo","numbers") );
|
2004-07-31 21:26:11 +00:00
|
|
|
m_textNumber.SetShadowLength( 4 );
|
|
|
|
|
m_textNumber.SetXY( NUMBER_X, NUMBER_Y );
|
|
|
|
|
m_textNumber.SetHorizAlign( (Actor::HorizAlign)(int)NUMBER_HORIZ_ALIGN );
|
|
|
|
|
m_textNumber.SetVertAlign( (Actor::VertAlign)(int)NUMBER_VERT_ALIGN );
|
|
|
|
|
m_textNumber.SetHidden( true );
|
|
|
|
|
this->AddChild( &m_textNumber );
|
2003-02-17 12:19:42 +00:00
|
|
|
}
|
2002-02-24 01:43:11 +00:00
|
|
|
|
2004-07-31 21:26:11 +00:00
|
|
|
void Combo::SetCombo( int iCombo, int iMisses )
|
2002-02-24 01:43:11 +00:00
|
|
|
{
|
2004-07-31 21:26:11 +00:00
|
|
|
bool bMisses = iMisses > 0;
|
|
|
|
|
int iNum = bMisses ? iMisses : iCombo;
|
|
|
|
|
|
|
|
|
|
if( (iNum < (int)SHOW_COMBO_AT) ||
|
|
|
|
|
(bMisses && !(bool)SHOW_MISS_COMBO) )
|
2002-08-26 05:53:48 +00:00
|
|
|
{
|
2004-07-31 21:26:11 +00:00
|
|
|
m_sprComboLabel.SetHidden( true );
|
|
|
|
|
m_sprMissesLabel.SetHidden( true );
|
|
|
|
|
m_textNumber.SetHidden( true );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_sprComboLabel.SetHidden( bMisses );
|
|
|
|
|
m_sprMissesLabel.SetHidden( !bMisses );
|
|
|
|
|
m_textNumber.SetHidden( false );
|
2003-03-16 20:55:45 +00:00
|
|
|
|
2004-07-31 21:26:11 +00:00
|
|
|
CString txt = ssprintf("%d", iNum);
|
|
|
|
|
/* Don't do anything if it's not changing. */
|
|
|
|
|
if(m_textNumber.GetText() == txt) return;
|
2003-03-26 21:32:28 +00:00
|
|
|
|
2004-07-31 21:26:11 +00:00
|
|
|
m_textNumber.SetText( txt );
|
|
|
|
|
float fNumberZoom = SCALE(iNum,0.f,(float)NUMBER_MAX_ZOOM_AT,(float)NUMBER_MIN_ZOOM,(float)NUMBER_MAX_ZOOM);
|
|
|
|
|
CLAMP( fNumberZoom, (float)NUMBER_MIN_ZOOM, (float)NUMBER_MAX_ZOOM );
|
|
|
|
|
m_textNumber.StopTweening();
|
|
|
|
|
m_textNumber.SetZoom( fNumberZoom * (float)PULSE_ZOOM );
|
|
|
|
|
m_textNumber.BeginTweening( C_TWEEN_SECONDS );
|
|
|
|
|
m_textNumber.SetZoom( fNumberZoom );
|
2003-03-16 20:55:45 +00:00
|
|
|
|
2004-07-31 21:26:11 +00:00
|
|
|
Sprite &sprLabel = bMisses ? m_sprMissesLabel : m_sprComboLabel;
|
2004-03-10 07:54:12 +00:00
|
|
|
|
2004-07-31 21:26:11 +00:00
|
|
|
sprLabel.StopTweening();
|
|
|
|
|
sprLabel.SetZoom( PULSE_ZOOM );
|
|
|
|
|
sprLabel.BeginTweening( C_TWEEN_SECONDS );
|
|
|
|
|
sprLabel.SetZoom( 1 );
|
2004-03-10 07:54:12 +00:00
|
|
|
|
2004-07-31 21:26:11 +00:00
|
|
|
// don't show a colored combo until 1/4 of the way through the song
|
|
|
|
|
bool bPastMidpoint = GAMESTATE->GetCourseSongIndex()>0 ||
|
|
|
|
|
GAMESTATE->m_fMusicSeconds > GAMESTATE->m_pCurSong->m_fMusicLengthSeconds/4;
|
2004-03-10 07:54:12 +00:00
|
|
|
|
2004-07-31 21:26:11 +00:00
|
|
|
if( bPastMidpoint )
|
|
|
|
|
{
|
2004-12-20 10:47:41 +00:00
|
|
|
if( g_CurStageStats.m_player[m_PlayerNumber].FullComboOfScore(TNS_MARVELOUS) )
|
2004-07-31 21:26:11 +00:00
|
|
|
{
|
2004-12-03 05:19:46 +00:00
|
|
|
sprLabel.RunCommands( FULL_COMBO_MARVELOUSES_COMMAND );
|
|
|
|
|
m_textNumber.RunCommands( FULL_COMBO_MARVELOUSES_COMMAND );
|
2004-07-31 21:26:11 +00:00
|
|
|
}
|
2004-12-20 10:47:41 +00:00
|
|
|
else if( bPastMidpoint && g_CurStageStats.m_player[m_PlayerNumber].FullComboOfScore(TNS_PERFECT) )
|
2004-07-31 21:26:11 +00:00
|
|
|
{
|
2004-12-03 05:19:46 +00:00
|
|
|
sprLabel.RunCommands( FULL_COMBO_PERFECTS_COMMAND );
|
|
|
|
|
m_textNumber.RunCommands( FULL_COMBO_PERFECTS_COMMAND );
|
2004-07-31 21:26:11 +00:00
|
|
|
}
|
2004-12-20 10:47:41 +00:00
|
|
|
else if( bPastMidpoint && g_CurStageStats.m_player[m_PlayerNumber].FullComboOfScore(TNS_GREAT) )
|
2004-03-10 07:54:12 +00:00
|
|
|
{
|
2004-12-03 05:19:46 +00:00
|
|
|
sprLabel.RunCommands( FULL_COMBO_GREATS_COMMAND );
|
|
|
|
|
m_textNumber.RunCommands( FULL_COMBO_GREATS_COMMAND );
|
2004-03-10 07:54:12 +00:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2004-12-03 05:19:46 +00:00
|
|
|
sprLabel.RunCommands( FULL_COMBO_BROKEN_COMMAND );
|
|
|
|
|
m_textNumber.RunCommands( FULL_COMBO_BROKEN_COMMAND );
|
2004-03-10 07:54:12 +00:00
|
|
|
}
|
2002-08-26 05:53:48 +00:00
|
|
|
}
|
2003-03-16 20:55:45 +00:00
|
|
|
else
|
2003-01-13 08:31:34 +00:00
|
|
|
{
|
2004-12-03 05:19:46 +00:00
|
|
|
sprLabel.RunCommands( FULL_COMBO_BROKEN_COMMAND );
|
|
|
|
|
m_textNumber.RunCommands( FULL_COMBO_BROKEN_COMMAND );
|
2002-02-24 01:43:11 +00:00
|
|
|
}
|
|
|
|
|
}
|
2004-06-08 00:08:04 +00:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* (c) 2001-2004 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.
|
|
|
|
|
*/
|