Files
itgmania212121/stepmania/src/ReceptorArrow.cpp
T

88 lines
2.9 KiB
C++
Raw Normal View History

2003-12-22 10:30:10 +00:00
#include "global.h"
#include "ReceptorArrow.h"
#include "GameState.h"
#include "NoteSkinManager.h"
#include "RageLog.h"
#include "RageUtil.h"
#include "Game.h"
#include "PlayerState.h"
2003-12-22 10:30:10 +00:00
ReceptorArrow::ReceptorArrow()
{
m_bIsPressed = false;
m_bWasPressed = false;
m_bWasReverse = false;
2003-12-22 10:30:10 +00:00
}
2005-10-10 06:06:42 +00:00
void ReceptorArrow::Load( const PlayerState* pPlayerState, int iColNo )
2003-12-22 10:30:10 +00:00
{
m_pPlayerState = pPlayerState;
2003-12-22 10:30:10 +00:00
m_iColNo = iColNo;
2006-01-22 01:00:06 +00:00
RString sButton = GAMESTATE->GetCurrentGame()->ColToButtonName( iColNo );
2005-10-12 00:01:47 +00:00
m_pReceptor.Load( NOTESKIN->GetPath(sButton,"receptor") );
this->AddChild( m_pReceptor );
bool bReverse = m_pPlayerState->m_PlayerOptions.GetReversePercentForColumn(m_iColNo) > 0.5f;
m_pReceptor->PlayCommand( bReverse? "ReverseOn":"ReverseOff" );
m_bWasReverse = bReverse;
2003-12-22 10:30:10 +00:00
}
void ReceptorArrow::Update( float fDeltaTime )
{
ActorFrame::Update( fDeltaTime );
2005-08-03 23:38:06 +00:00
bool bReverse = m_pPlayerState->m_PlayerOptions.GetReversePercentForColumn(m_iColNo) > 0.5f;
if( bReverse != m_bWasReverse )
{
m_pReceptor->PlayCommand( bReverse? "ReverseOn":"ReverseOff" );
m_bWasReverse = bReverse;
}
}
void ReceptorArrow::DrawPrimitives()
{
if( m_bWasPressed && !m_bIsPressed )
2005-10-12 02:39:59 +00:00
m_pReceptor->PlayCommand( "Lift" );
2006-01-24 00:24:15 +00:00
else if( !m_bWasPressed && m_bIsPressed )
m_pReceptor->PlayCommand( "Press" );
m_bWasPressed = m_bIsPressed;
m_bIsPressed = false; // it may get turned back on next update
2003-12-22 10:30:10 +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;
2006-01-22 01:00:06 +00:00
RString sJudge = TapNoteScoreToString( score );
2005-10-12 00:01:47 +00:00
m_pReceptor->PlayCommand( Capitalize(sJudge) );
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.
*/