Files
itgmania212121/stepmania/src/GhostArrowRow.cpp
T

141 lines
4.2 KiB
C++
Raw Normal View History

2003-02-16 04:01:45 +00:00
#include "global.h"
2002-04-16 17:31:00 +00:00
#include "GhostArrowRow.h"
#include "RageUtil.h"
2002-05-01 19:14:55 +00:00
#include "GameConstantsAndTypes.h"
2002-04-16 17:31:00 +00:00
#include "ArrowEffects.h"
#include "NoteSkinManager.h"
2002-07-23 01:41:40 +00:00
#include "GameState.h"
2003-04-02 21:58:27 +00:00
#include "NoteFieldPositioning.h"
#include "Game.h"
#include "PlayerState.h"
2005-01-15 02:01:26 +00:00
#include "Style.h"
#include "ActorUtil.h"
2002-04-16 17:31:00 +00:00
GhostArrowRow::GhostArrowRow()
{
}
2005-02-28 05:42:36 +00:00
void GhostArrowRow::Load( const PlayerState* pPlayerState, float fYReverseOffset )
2002-04-16 17:31:00 +00:00
{
m_pPlayerState = pPlayerState;
m_fYReverseOffsetPixels = fYReverseOffset;
2002-04-16 17:31:00 +00:00
2004-06-28 07:26:00 +00:00
const Style* pStyle = GAMESTATE->GetCurrentStyle();
2002-04-16 17:31:00 +00:00
// init arrows
2005-10-12 03:15:01 +00:00
for( int c=0; c<pStyle->m_iColsPerPlayer; c++ )
2002-04-16 17:31:00 +00:00
{
const CString &sButton = GAMESTATE->GetCurrentGame()->ColToButtonName( c );
2003-04-17 21:45:37 +00:00
m_bHoldIsActive.push_back( false );
m_bHoldWasActive.push_back( false );
m_Ghost.push_back( ActorUtil::MakeActor( NOTESKIN->GetPath(sButton, "tap explosion") ) );
m_Ghost[c]->SetName( "GhostArrow" );
2002-04-16 17:31:00 +00:00
}
}
2005-10-06 01:16:42 +00:00
GhostArrowRow::~GhostArrowRow()
2004-07-27 04:31:01 +00:00
{
2005-10-12 03:15:01 +00:00
for( unsigned i = 0; i < m_Ghost.size(); ++i )
delete m_Ghost[i];
2004-07-27 04:31:01 +00:00
}
2002-04-16 17:31:00 +00:00
2002-07-28 20:28:37 +00:00
void GhostArrowRow::Update( float fDeltaTime )
2002-04-16 17:31:00 +00:00
{
2005-10-12 03:15:01 +00:00
for( unsigned c=0; c<m_Ghost.size(); c++ )
2002-04-16 17:31:00 +00:00
{
m_Ghost[c]->Update( fDeltaTime );
2002-04-16 17:31:00 +00:00
const float fX = ArrowEffects::GetXPos( m_pPlayerState, c, 0 );
const float fY = ArrowEffects::GetYPos( m_pPlayerState, c, 0, m_fYReverseOffsetPixels );
const float fZ = ArrowEffects::GetZPos( m_pPlayerState, c, 0 );
2003-04-02 21:58:27 +00:00
m_Ghost[c]->SetX( fX );
m_Ghost[c]->SetY( fY );
m_Ghost[c]->SetZ( fZ );
const float fZoom = ArrowEffects::GetZoom( m_pPlayerState );
m_Ghost[c]->SetZoom( fZoom );
}
for( unsigned i = 0; i < m_bHoldIsActive.size(); ++i )
{
if( !m_bHoldWasActive[i] && m_bHoldIsActive[i] )
m_Ghost[i]->PlayCommand( "HoldingOn" );
else if( m_bHoldWasActive[i] && !m_bHoldIsActive[i] )
m_Ghost[i]->PlayCommand( "HoldingOff" );
m_bHoldWasActive[i] = m_bHoldIsActive[i];
m_bHoldIsActive[i] = false;
}
}
void GhostArrowRow::DrawPrimitives()
{
2005-10-12 03:15:01 +00:00
for( unsigned c=0; c<m_Ghost.size(); c++ )
{
NoteFieldMode::BeginDrawTrack( m_pPlayerState, c );
m_Ghost[c]->Draw();
2005-01-15 02:01:26 +00:00
NoteFieldMode::EndDrawTrack( c );
2002-04-16 17:31:00 +00:00
}
}
2005-04-26 05:28:32 +00:00
void GhostArrowRow::DidTapNote( int iCol, TapNoteScore tns, bool bBright )
2002-04-16 17:31:00 +00:00
{
2005-10-12 03:15:01 +00:00
ASSERT( iCol >= 0 && iCol < (int) m_Ghost.size() );
m_Ghost[iCol]->PlayCommand( "Judgment" );
2002-04-16 17:31:00 +00:00
if( bBright )
m_Ghost[iCol]->PlayCommand( "Bright" );
2002-04-16 17:31:00 +00:00
else
m_Ghost[iCol]->PlayCommand( "Dim" );
CString sJudge = TapNoteScoreToString( tns );
m_Ghost[iCol]->PlayCommand( Capitalize(sJudge) );
2005-04-26 05:28:32 +00:00
}
void GhostArrowRow::DidHoldNote( int iCol, HoldNoteScore hns, bool bBright )
{
2005-10-12 03:15:01 +00:00
ASSERT( iCol >= 0 && iCol < (int) m_Ghost.size() );
m_Ghost[iCol]->PlayCommand( "Judgment" );
2005-04-26 05:28:32 +00:00
if( bBright )
m_Ghost[iCol]->PlayCommand( "Bright" );
2005-04-26 05:28:32 +00:00
else
m_Ghost[iCol]->PlayCommand( "Dim" );
CString sJudge = HoldNoteScoreToString( hns );
m_Ghost[iCol]->PlayCommand( Capitalize(sJudge) );
2002-04-16 17:31:00 +00:00
}
2004-01-01 01:53:25 +00:00
void GhostArrowRow::SetHoldIsActive( int iCol )
2002-04-16 17:31:00 +00:00
{
2005-10-12 03:15:01 +00:00
ASSERT( iCol >= 0 && iCol < (int) m_Ghost.size() );
m_bHoldIsActive[iCol] = true;
}
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.
*/