2003-12-22 10:30:10 +00:00
|
|
|
#include "global.h"
|
|
|
|
|
#include "ReceptorArrow.h"
|
|
|
|
|
#include "PrefsManager.h"
|
|
|
|
|
#include "GameState.h"
|
|
|
|
|
#include "ThemeManager.h"
|
|
|
|
|
#include "NoteFieldPositioning.h"
|
|
|
|
|
#include "NoteSkinManager.h"
|
|
|
|
|
#include "RageLog.h"
|
|
|
|
|
#include "RageUtil.h"
|
2004-09-06 02:49:36 +00:00
|
|
|
#include "Game.h"
|
2004-12-20 06:25:59 +00:00
|
|
|
#include "PlayerState.h"
|
2003-12-22 10:30:10 +00:00
|
|
|
|
2005-04-30 07:48:41 +00:00
|
|
|
// eventually, these will replace the pressblocks
|
|
|
|
|
const CString PRESS_COMMAND_NAME = "Press";
|
|
|
|
|
const CString LIFT_COMMAND_NAME = "Lift";
|
2003-12-22 10:30:10 +00:00
|
|
|
|
|
|
|
|
ReceptorArrow::ReceptorArrow()
|
|
|
|
|
{
|
|
|
|
|
m_bIsPressed = false;
|
2005-04-30 07:48:41 +00:00
|
|
|
m_bWasPressed = false;
|
2003-12-22 10:30:10 +00:00
|
|
|
StopAnimating();
|
|
|
|
|
}
|
|
|
|
|
|
2005-04-18 01:19:56 +00:00
|
|
|
bool ReceptorArrow::Load( const PlayerState* pPlayerState, int iColNo )
|
2003-12-22 10:30:10 +00:00
|
|
|
{
|
2004-12-20 06:25:59 +00:00
|
|
|
m_pPlayerState = pPlayerState;
|
2003-12-22 10:30:10 +00:00
|
|
|
m_iColNo = iColNo;
|
|
|
|
|
|
2005-01-15 02:01:26 +00:00
|
|
|
CString sButton = GAMESTATE->GetCurrentGame()->ColToButtonName( iColNo );
|
2003-12-22 10:30:10 +00:00
|
|
|
|
2005-04-18 01:19:56 +00:00
|
|
|
m_pReceptorWaiting.Load( NOTESKIN->GetPath(sButton,"receptor waiting") );
|
|
|
|
|
m_pReceptorGo.Load( NOTESKIN->GetPath(sButton,"receptor go") );
|
2004-08-28 21:14:39 +00:00
|
|
|
FOREACH_TapNoteScore( i )
|
2004-07-02 20:08:17 +00:00
|
|
|
{
|
2004-08-28 21:14:39 +00:00
|
|
|
CString sJudge = TapNoteScoreToString( i );
|
2004-07-02 20:08:17 +00:00
|
|
|
CString sCommand = Capitalize(sJudge)+"Command";
|
2005-04-18 01:19:56 +00:00
|
|
|
m_sScoreCommand[i] = NOTESKIN->GetMetricA(m_sName,sCommand);
|
2004-07-02 20:08:17 +00:00
|
|
|
}
|
2003-12-22 10:30:10 +00:00
|
|
|
|
2005-04-18 01:19:56 +00:00
|
|
|
m_pPressBlock.Load( NOTESKIN->GetPath(sButton,"KeypressBlock") );
|
2003-12-22 10:30:10 +00:00
|
|
|
|
2005-02-17 06:54:17 +00:00
|
|
|
m_pReceptorWaiting->SetEffectClock( Actor::CLOCK_BGM_BEAT );
|
|
|
|
|
m_pReceptorGo->SetEffectClock( Actor::CLOCK_BGM_BEAT );
|
|
|
|
|
m_pPressBlock->SetEffectClock( Actor::CLOCK_BGM_BEAT );
|
2004-10-26 19:23:41 +00:00
|
|
|
|
2003-12-22 10:54:29 +00:00
|
|
|
// draw pressblock before receptors
|
|
|
|
|
this->AddChild( m_pPressBlock );
|
2003-12-22 10:30:10 +00:00
|
|
|
this->AddChild( m_pReceptorWaiting );
|
|
|
|
|
this->AddChild( m_pReceptorGo );
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ReceptorArrow::Update( float fDeltaTime )
|
|
|
|
|
{
|
|
|
|
|
ActorFrame::Update( fDeltaTime );
|
|
|
|
|
|
|
|
|
|
// update pressblock alignment based on scroll direction
|
2005-08-03 23:38:06 +00:00
|
|
|
bool bReverse = m_pPlayerState->m_PlayerOptions.GetReversePercentForColumn(m_iColNo) > 0.5f;
|
2003-12-22 10:30:10 +00:00
|
|
|
m_pPressBlock->SetVertAlign( bReverse ? Actor::align_bottom : Actor::align_top );
|
2005-04-30 07:48:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
m_pReceptorGo->SetHidden( !GAMESTATE->m_bPastHereWeGo );
|
|
|
|
|
m_pReceptorWaiting->SetHidden( GAMESTATE->m_bPastHereWeGo );
|
|
|
|
|
|
|
|
|
|
m_pPressBlock->SetHidden( !m_bIsPressed );
|
2005-05-23 05:18:05 +00:00
|
|
|
}
|
2005-04-30 07:48:41 +00:00
|
|
|
|
2005-05-23 05:18:05 +00:00
|
|
|
void ReceptorArrow::DrawPrimitives()
|
|
|
|
|
{
|
2005-04-30 07:48:41 +00:00
|
|
|
if( m_bWasPressed && !m_bIsPressed )
|
|
|
|
|
{
|
|
|
|
|
m_pReceptorGo->PlayCommand( LIFT_COMMAND_NAME );
|
|
|
|
|
m_pReceptorWaiting->PlayCommand( LIFT_COMMAND_NAME );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_bWasPressed = m_bIsPressed;
|
|
|
|
|
m_bIsPressed = false; // it may get turned back on next update
|
2003-12-22 10:30:10 +00:00
|
|
|
|
2004-02-14 03:38:34 +00:00
|
|
|
ActorFrame::DrawPrimitives();
|
2003-12-22 10:30:10 +00:00
|
|
|
}
|
|
|
|
|
|
2004-07-02 20:08:17 +00:00
|
|
|
void ReceptorArrow::Step( TapNoteScore score )
|
2003-12-22 10:30:10 +00:00
|
|
|
{
|
2005-05-01 00:02:35 +00:00
|
|
|
m_bIsPressed = true;
|
|
|
|
|
|
2005-01-26 11:21:43 +00:00
|
|
|
m_pReceptorGo->RunCommands( *m_sScoreCommand[score] );
|
|
|
|
|
m_pReceptorWaiting->RunCommands( *m_sScoreCommand[score] );
|
2005-04-30 07:48:41 +00:00
|
|
|
|
|
|
|
|
m_pReceptorGo->PlayCommand( PRESS_COMMAND_NAME );
|
|
|
|
|
m_pReceptorWaiting->PlayCommand( PRESS_COMMAND_NAME );
|
2003-12-22 10:30:10 +00:00
|
|
|
}
|
2004-06-08 00:08:04 +00:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* (c) 2001-2004 Ben Nordstrom, 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.
|
|
|
|
|
*/
|