Files
itgmania212121/stepmania/src/GhostArrowRow.cpp
T

168 lines
4.6 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-07-23 01:41:40 +00:00
#include "PrefsManager.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"
#include "PrefsManager.h"
2003-04-02 21:58:27 +00:00
#include "NoteFieldPositioning.h"
2002-04-16 17:31:00 +00:00
GhostArrowRow::GhostArrowRow()
{
m_iNumCols = 0;
}
2004-07-27 04:31:01 +00:00
#include "RageLog.h"
2003-11-27 23:45:38 +00:00
void GhostArrowRow::Load( PlayerNumber pn, CString NoteSkin, float fYReverseOffset )
2002-04-16 17:31:00 +00:00
{
2004-07-27 04:31:01 +00:00
Unload();
2002-07-28 20:28:37 +00:00
m_PlayerNumber = pn;
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
2004-06-28 07:26:00 +00:00
m_iNumCols = pStyle->m_iColsPerPlayer;
2002-04-16 17:31:00 +00:00
// init arrows
for( int c=0; c<m_iNumCols; c++ )
{
2004-06-19 23:04:10 +00:00
NoteFieldMode &mode = g_NoteFieldMode[pn];
CString Button = mode.GhostButtonNames[c];
2003-04-17 21:45:37 +00:00
if(Button == "")
Button = NoteSkinManager::ColToButtonName(c);
2004-07-27 04:31:01 +00:00
m_GhostDim.push_back( new GhostArrow );
m_GhostBright.push_back( new GhostArrow );
m_HoldGhost.push_back( new HoldGhostArrow );
m_GhostDim[c]->SetName( "GhostArrowDim" );
m_GhostBright[c]->SetName( "GhostArrowBright" );
m_HoldGhost[c]->SetName( "HoldGhostArrow" );
2004-07-27 04:31:01 +00:00
m_GhostDim[c]->Init( pn );
m_GhostBright[c]->Init( pn );
//m_HoldGhost[c]->Init( pn );
2004-07-27 04:31:01 +00:00
m_GhostDim[c]->Load( NoteSkin, Button, "tap explosion dim" );
m_GhostBright[c]->Load( NoteSkin, Button, "tap explosion bright" );
m_HoldGhost[c]->Load( NoteSkin, Button, "hold explosion" );
2002-04-16 17:31:00 +00:00
}
}
2004-07-27 04:31:01 +00:00
void GhostArrowRow::Unload()
{
for( int i = 0; i < m_iNumCols; ++i )
{
delete m_GhostDim[i];
delete m_GhostBright[i];
delete m_HoldGhost[i];
}
m_GhostDim.clear();
m_GhostBright.clear();
m_HoldGhost.clear();
m_iNumCols = 0;
}
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
{
for( int c=0; c<m_iNumCols; c++ )
{
2004-07-27 04:31:01 +00:00
m_GhostDim[c]->Update( fDeltaTime );
m_GhostBright[c]->Update( fDeltaTime );
m_HoldGhost[c]->Update( fDeltaTime );
2002-04-16 17:31:00 +00:00
const float fX = ArrowGetXPos( m_PlayerNumber, c, 0 );
const float fY = ArrowGetYPos( m_PlayerNumber, c, 0, m_fYReverseOffsetPixels );
const float fZ = ArrowGetZPos( m_PlayerNumber, c, 0 );
2003-04-02 21:58:27 +00:00
2004-07-27 04:31:01 +00:00
m_GhostDim[c]->SetX( fX );
m_GhostBright[c]->SetX( fX );
m_HoldGhost[c]->SetX( fX );
2004-07-27 04:31:01 +00:00
m_GhostDim[c]->SetY( fY );
m_GhostBright[c]->SetY( fY );
m_HoldGhost[c]->SetY( fY );
2004-07-27 04:31:01 +00:00
m_GhostDim[c]->SetZ( fZ );
m_GhostBright[c]->SetZ( fZ );
m_HoldGhost[c]->SetZ( fZ );
const float fZoom = ArrowGetZoom( m_PlayerNumber );
2004-07-27 04:31:01 +00:00
m_GhostDim[c]->SetZoom( fZoom );
m_GhostBright[c]->SetZoom( fZoom );
m_HoldGhost[c]->SetZoom( fZoom );
}
}
void GhostArrowRow::DrawPrimitives()
{
for( int c=0; c<m_iNumCols; c++ )
{
g_NoteFieldMode[m_PlayerNumber].BeginDrawTrack(c);
2002-04-16 17:31:00 +00:00
2004-07-27 04:31:01 +00:00
m_GhostDim[c]->Draw();
m_GhostBright[c]->Draw();
m_HoldGhost[c]->Draw();
2003-04-02 21:58:27 +00:00
g_NoteFieldMode[m_PlayerNumber].EndDrawTrack(c);
2002-04-16 17:31:00 +00:00
}
}
void GhostArrowRow::DidTapNote( int iCol, TapNoteScore score, bool bBright )
2002-04-16 17:31:00 +00:00
{
ASSERT( iCol >= 0 && iCol < m_iNumCols );
if( bBright )
2004-07-27 04:31:01 +00:00
m_GhostBright[iCol]->Step( score );
2002-04-16 17:31:00 +00:00
else
2004-07-27 04:31:01 +00:00
m_GhostDim[iCol]->Step( score );
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
{
ASSERT( iCol >= 0 && iCol < m_iNumCols );
2004-07-27 04:31:01 +00:00
m_HoldGhost[iCol]->SetHoldIsActive( true );
}
void GhostArrowRow::CopyTweening( const GhostArrowRow &from )
{
for( int c=0; c<m_iNumCols; c++ )
{
2004-07-27 04:31:01 +00:00
m_GhostDim[c]->CopyTweening( *from.m_GhostDim[c] );
m_GhostBright[c]->CopyTweening( *from.m_GhostBright[c] );
m_HoldGhost[c]->CopyTweening( *from.m_HoldGhost[c] );
}
ActorFrame::CopyTweening( from );
}
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.
*/