2003-02-17 12:19:42 +00:00
|
|
|
#include "global.h"
|
|
|
|
|
#include "Judgment.h"
|
|
|
|
|
#include "RageUtil.h"
|
|
|
|
|
#include "GameConstantsAndTypes.h"
|
|
|
|
|
#include "GameState.h"
|
|
|
|
|
#include "ThemeManager.h"
|
2004-11-06 20:36:04 +00:00
|
|
|
#include "ThemeMetric.h"
|
2006-04-21 00:07:27 +00:00
|
|
|
#include "ActorUtil.h"
|
|
|
|
|
#include "StatsManager.h"
|
2006-07-11 17:10:16 +00:00
|
|
|
#include "XmlFile.h"
|
2004-11-06 20:36:04 +00:00
|
|
|
|
2006-04-21 00:07:27 +00:00
|
|
|
REGISTER_ACTOR_CLASS( Judgment )
|
|
|
|
|
|
2003-02-17 12:19:42 +00:00
|
|
|
Judgment::Judgment()
|
|
|
|
|
{
|
2006-10-07 03:43:41 +00:00
|
|
|
m_mpToTrack = MultiPlayer_Invalid;
|
2005-04-28 00:13:01 +00:00
|
|
|
}
|
2003-11-29 11:17:13 +00:00
|
|
|
|
2006-10-09 08:24:10 +00:00
|
|
|
void Judgment::LoadFromNode( const XNode* pNode )
|
2006-07-11 17:10:16 +00:00
|
|
|
{
|
|
|
|
|
RString sFile;
|
2006-10-09 06:55:28 +00:00
|
|
|
if( ActorUtil::GetAttrPath(pNode, "File", sFile) )
|
2006-07-11 17:10:16 +00:00
|
|
|
{
|
|
|
|
|
CollapsePath( sFile );
|
|
|
|
|
LoadNormal( sFile );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
LoadNormal();
|
|
|
|
|
}
|
|
|
|
|
|
2006-10-09 08:24:10 +00:00
|
|
|
ActorFrame::LoadFromNode( pNode );
|
2006-07-11 17:10:16 +00:00
|
|
|
}
|
|
|
|
|
|
2006-07-11 16:55:38 +00:00
|
|
|
void Judgment::LoadNormal()
|
2005-04-28 00:13:01 +00:00
|
|
|
{
|
2006-07-11 17:10:16 +00:00
|
|
|
LoadNormal( THEME->GetPathG("Judgment","label") );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Judgment::LoadNormal( const RString &sPath )
|
|
|
|
|
{
|
|
|
|
|
m_sprJudgment.Load( sPath );
|
2005-04-28 00:13:01 +00:00
|
|
|
ASSERT( m_sprJudgment.GetNumStates() == 6 || m_sprJudgment.GetNumStates() == 12 );
|
2003-02-17 12:19:42 +00:00
|
|
|
m_sprJudgment.StopAnimating();
|
2006-08-21 21:33:00 +00:00
|
|
|
m_sprJudgment.SetName( "Judgment" );
|
|
|
|
|
ActorUtil::LoadAllCommands( m_sprJudgment, "Judgment" );
|
2003-03-09 00:55:49 +00:00
|
|
|
Reset();
|
2003-02-17 12:19:42 +00:00
|
|
|
this->AddChild( &m_sprJudgment );
|
|
|
|
|
}
|
|
|
|
|
|
2003-03-09 00:55:49 +00:00
|
|
|
void Judgment::Reset()
|
|
|
|
|
{
|
2004-03-24 07:05:50 +00:00
|
|
|
m_sprJudgment.FinishTweening();
|
2003-11-27 02:46:26 +00:00
|
|
|
m_sprJudgment.SetXY( 0, 0 );
|
2005-07-24 03:11:03 +00:00
|
|
|
m_sprJudgment.StopEffect();
|
2004-03-24 07:05:50 +00:00
|
|
|
m_sprJudgment.SetHidden( true );
|
2003-03-09 00:55:49 +00:00
|
|
|
}
|
|
|
|
|
|
2005-04-28 00:13:01 +00:00
|
|
|
void Judgment::SetJudgment( TapNoteScore score, bool bEarly )
|
2003-02-17 12:19:42 +00:00
|
|
|
{
|
|
|
|
|
//LOG->Trace( "Judgment::SetJudgment()" );
|
|
|
|
|
|
2003-03-09 00:55:49 +00:00
|
|
|
Reset();
|
2003-02-17 12:19:42 +00:00
|
|
|
|
2004-03-24 07:05:50 +00:00
|
|
|
m_sprJudgment.SetHidden( false );
|
|
|
|
|
|
2005-05-13 00:22:36 +00:00
|
|
|
int iStateMult = (m_sprJudgment.GetNumStates()==12) ? 2 : 1;
|
|
|
|
|
int iStateAdd = ( bEarly || ( iStateMult == 1 ) ) ? 0 : 1;
|
2005-04-28 00:13:01 +00:00
|
|
|
|
2003-03-09 00:55:49 +00:00
|
|
|
switch( score )
|
2003-02-17 12:19:42 +00:00
|
|
|
{
|
2005-10-09 04:30:59 +00:00
|
|
|
case TNS_W1:
|
2005-04-28 00:13:01 +00:00
|
|
|
m_sprJudgment.SetState( 0 * iStateMult + iStateAdd );
|
2006-08-21 21:33:00 +00:00
|
|
|
m_sprJudgment.PlayCommand( "W1" );
|
2003-03-09 00:55:49 +00:00
|
|
|
break;
|
2005-10-09 04:30:59 +00:00
|
|
|
case TNS_W2:
|
2005-04-28 00:13:01 +00:00
|
|
|
m_sprJudgment.SetState( 1 * iStateMult + iStateAdd );
|
2006-08-21 21:33:00 +00:00
|
|
|
m_sprJudgment.PlayCommand( "W2" );
|
2003-03-09 00:55:49 +00:00
|
|
|
break;
|
2005-10-09 04:30:59 +00:00
|
|
|
case TNS_W3:
|
2005-04-28 00:13:01 +00:00
|
|
|
m_sprJudgment.SetState( 2 * iStateMult + iStateAdd );
|
2006-08-21 21:33:00 +00:00
|
|
|
m_sprJudgment.PlayCommand( "W3" );
|
2003-03-09 00:55:49 +00:00
|
|
|
break;
|
2005-10-09 04:30:59 +00:00
|
|
|
case TNS_W4:
|
2005-04-28 00:13:01 +00:00
|
|
|
m_sprJudgment.SetState( 3 * iStateMult + iStateAdd );
|
2006-08-21 21:33:00 +00:00
|
|
|
m_sprJudgment.PlayCommand( "W4" );
|
2003-03-09 00:55:49 +00:00
|
|
|
break;
|
2005-10-09 04:30:59 +00:00
|
|
|
case TNS_W5:
|
2005-04-28 00:13:01 +00:00
|
|
|
m_sprJudgment.SetState( 4 * iStateMult + iStateAdd );
|
2006-08-21 21:33:00 +00:00
|
|
|
m_sprJudgment.PlayCommand( "W5" );
|
2003-03-09 00:55:49 +00:00
|
|
|
break;
|
2005-10-08 00:57:40 +00:00
|
|
|
case TNS_Miss:
|
2005-04-28 00:13:01 +00:00
|
|
|
m_sprJudgment.SetState( 5 * iStateMult + iStateAdd );
|
2006-08-21 21:33:00 +00:00
|
|
|
m_sprJudgment.PlayCommand( "Miss" );
|
2003-03-09 00:55:49 +00:00
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
ASSERT(0);
|
2003-02-17 12:19:42 +00:00
|
|
|
}
|
|
|
|
|
}
|
2004-06-08 00:08:04 +00:00
|
|
|
|
2006-04-21 00:07:27 +00:00
|
|
|
void Judgment::LoadFromMultiPlayer( MultiPlayer mp )
|
|
|
|
|
{
|
2006-10-07 03:43:41 +00:00
|
|
|
ASSERT( m_mpToTrack == MultiPlayer_Invalid ); // assert only load once
|
2006-04-21 00:07:27 +00:00
|
|
|
m_mpToTrack = mp;
|
|
|
|
|
this->SubscribeToMessage( enum_add2(Message_ShowJudgmentMuliPlayerP1,m_mpToTrack) );
|
|
|
|
|
}
|
|
|
|
|
|
2006-11-13 23:11:25 +00:00
|
|
|
void Judgment::HandleMessage( const Message &msg )
|
2006-04-21 00:07:27 +00:00
|
|
|
{
|
2006-11-13 23:11:25 +00:00
|
|
|
if( m_mpToTrack != MultiPlayer_Invalid && msg == enum_add2(Message_ShowJudgmentMuliPlayerP1,m_mpToTrack) )
|
2006-04-21 00:07:27 +00:00
|
|
|
SetJudgment( STATSMAN->m_CurStageStats.m_multiPlayer[m_mpToTrack].tnsLast, false ); // FIXME: save and pass early bool?
|
|
|
|
|
|
2006-11-13 23:11:25 +00:00
|
|
|
ActorFrame::HandleMessage( msg );
|
2006-04-21 00:07:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// lua start
|
|
|
|
|
#include "LuaBinding.h"
|
|
|
|
|
|
|
|
|
|
class LunaJudgment: public Luna<Judgment>
|
|
|
|
|
{
|
|
|
|
|
public:
|
2006-09-27 06:18:11 +00:00
|
|
|
static int LoadFromMultiPlayer( T* p, lua_State *L ) { p->LoadFromMultiPlayer( Enum::Check<MultiPlayer>(L, 1) ); return 0; }
|
2006-04-21 00:07:27 +00:00
|
|
|
|
2006-09-27 20:10:14 +00:00
|
|
|
LunaJudgment()
|
2006-04-21 00:07:27 +00:00
|
|
|
{
|
2006-09-27 20:10:14 +00:00
|
|
|
ADD_METHOD( LoadFromMultiPlayer );
|
2006-04-21 00:07:27 +00:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
LUA_REGISTER_DERIVED_CLASS( Judgment, ActorFrame )
|
|
|
|
|
// lua end
|
|
|
|
|
|
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.
|
|
|
|
|
*/
|