This commit is contained in:
Glenn Maynard
2007-03-03 01:31:08 +00:00
parent c147bda34f
commit 6b54a07f3c
4 changed files with 0 additions and 371 deletions
-89
View File
@@ -1,89 +0,0 @@
#include "global.h"
#include "Combo.h"
#include "ThemeManager.h"
#include "StatsManager.h"
#include "GameState.h"
#include "song.h"
#include "PlayerState.h"
Combo::Combo()
{
m_iLastSeenCombo = -1;
m_pPlayerState = NULL;
m_pPlayerStageStats = NULL;
}
void Combo::Load( const RString &sPath, const PlayerState *pPlayerState, const PlayerStageStats *pPlayerStageStats )
{
ASSERT( m_SubActors.empty() ); // don't load twice
m_pPlayerState = pPlayerState;
m_pPlayerStageStats = pPlayerStageStats;
m_sprComboLabel.Load( sPath );
this->AddChild( m_sprComboLabel );
}
void Combo::SetCombo( int iCombo, int iMisses )
{
if( m_iLastSeenCombo == -1 ) // first update, don't set bIsMilestone=true
m_iLastSeenCombo = iCombo;
bool b100Milestone = false;
bool b1000Milestone = false;
for( int i=m_iLastSeenCombo+1; i<=iCombo; i++ )
{
if( i < 600 )
b100Milestone |= ((i % 100) == 0);
else
b1000Milestone |= ((i % 200) == 0);
}
m_iLastSeenCombo = iCombo;
if( b100Milestone )
this->PlayCommand( "100Milestone" );
if( b1000Milestone )
this->PlayCommand( "1000Milestone" );
// don't show a colored combo until 1/4 of the way through the song
bool bPastMidpoint = GAMESTATE->GetCourseSongIndex()>0 ||
GAMESTATE->m_fMusicSeconds > GAMESTATE->m_pCurSong->m_fMusicLengthSeconds/4;
Message msg("Combo");
if( iCombo )
msg.SetParam( "Combo", iCombo );
if( iMisses )
msg.SetParam( "Misses", iMisses );
if( bPastMidpoint && m_pPlayerStageStats->FullComboOfScore(TNS_W1) )
msg.SetParam( "FullComboW1", true );
if( bPastMidpoint && m_pPlayerStageStats->FullComboOfScore(TNS_W2) )
msg.SetParam( "FullComboW2", true );
if( bPastMidpoint && m_pPlayerStageStats->FullComboOfScore(TNS_W3) )
msg.SetParam( "FullComboW3", true );
this->HandleMessage( msg );
}
/*
* (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.
*/
-55
View File
@@ -1,55 +0,0 @@
/* Combo - Text that displays the size of the current combo. */
#ifndef COMBO_H
#define COMBO_H
#include "ActorFrame.h"
#include "AutoActor.h"
#include "PlayerNumber.h"
class PlayerState;
class PlayerStageStats;
class Combo : public ActorFrame
{
public:
Combo();
void Load( const RString &sPath, const PlayerState *pPlayerState, const PlayerStageStats *pPlayerStageStats );
void SetCombo( int iCombo, int iMisses );
protected:
const PlayerState *m_pPlayerState;
const PlayerStageStats *m_pPlayerStageStats;
AutoActor m_sprComboLabel;
int m_iLastSeenCombo;
};
#endif
/*
* (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.
*/
-168
View File
@@ -1,168 +0,0 @@
#include "global.h"
#include "Judgment.h"
#include "RageUtil.h"
#include "GameConstantsAndTypes.h"
#include "ThemeManager.h"
#include "ThemeMetric.h"
#include "ActorUtil.h"
#include "XmlFile.h"
REGISTER_ACTOR_CLASS( Judgment )
Judgment::Judgment()
{
m_mpToTrack = MultiPlayer_Invalid;
}
void Judgment::LoadFromNode( const XNode* pNode )
{
RString sFile;
if( ActorUtil::GetAttrPath(pNode, "File", sFile) )
{
CollapsePath( sFile );
LoadNormal( sFile );
}
else
{
LoadNormal();
}
ActorFrame::LoadFromNode( pNode );
}
void Judgment::LoadNormal()
{
LoadNormal( THEME->GetPathG("Judgment","label") );
}
void Judgment::LoadNormal( const RString &sPath )
{
m_sprJudgment.Load( sPath );
m_sprJudgment->SetName( "Judgment" );
ASSERT( m_sprJudgment->GetNumStates() == 6 || m_sprJudgment->GetNumStates() == 12 );
m_sprJudgment->StopAnimating();
ActorUtil::LoadAllCommands( m_sprJudgment, "Judgment" );
Reset();
this->AddChild( m_sprJudgment );
}
void Judgment::Reset()
{
m_sprJudgment->FinishTweening();
m_sprJudgment->SetXY( 0, 0 );
m_sprJudgment->StopEffect();
m_sprJudgment->SetVisible( false );
}
void Judgment::SetJudgment( TapNoteScore score, bool bEarly )
{
//LOG->Trace( "Judgment::SetJudgment()" );
Reset();
m_sprJudgment->SetVisible( true );
int iStateMult = (m_sprJudgment->GetNumStates()==12) ? 2 : 1;
int iStateAdd = ( bEarly || ( iStateMult == 1 ) ) ? 0 : 1;
switch( score )
{
case TNS_W1:
m_sprJudgment->SetState( 0 * iStateMult + iStateAdd );
this->PlayCommand( "W1" );
break;
case TNS_W2:
m_sprJudgment->SetState( 1 * iStateMult + iStateAdd );
this->PlayCommand( "W2" );
break;
case TNS_W3:
m_sprJudgment->SetState( 2 * iStateMult + iStateAdd );
this->PlayCommand( "W3" );
break;
case TNS_W4:
m_sprJudgment->SetState( 3 * iStateMult + iStateAdd );
this->PlayCommand( "W4" );
break;
case TNS_W5:
m_sprJudgment->SetState( 4 * iStateMult + iStateAdd );
this->PlayCommand( "W5" );
break;
case TNS_Miss:
m_sprJudgment->SetState( 5 * iStateMult + iStateAdd );
this->PlayCommand( "Miss" );
break;
default:
ASSERT(0);
}
}
void Judgment::LoadFromMultiPlayer( MultiPlayer mp )
{
ASSERT( m_mpToTrack == MultiPlayer_Invalid ); // assert only load once
m_mpToTrack = mp;
this->SubscribeToMessage( "Judgment" );
}
void Judgment::HandleMessage( const Message &msg )
{
if( m_mpToTrack != MultiPlayer_Invalid && msg.GetName() == "Judgment" )
{
MultiPlayer mp;
HoldNoteScore hns;
if( msg.GetParam("MultiPlayer", mp) &&
mp == m_mpToTrack &&
!msg.GetParam("HoldNoteScore", hns) )
{
TapNoteScore tns;
bool bEarly;
msg.GetParam( "TapNoteScore", tns );
msg.GetParam( "Early", bEarly );
SetJudgment( tns, bEarly );
}
}
ActorFrame::HandleMessage( msg );
}
// lua start
#include "LuaBinding.h"
class LunaJudgment: public Luna<Judgment>
{
public:
static int LoadFromMultiPlayer( T* p, lua_State *L ) { p->LoadFromMultiPlayer( Enum::Check<MultiPlayer>(L, 1) ); return 0; }
LunaJudgment()
{
ADD_METHOD( LoadFromMultiPlayer );
}
};
LUA_REGISTER_DERIVED_CLASS( Judgment, ActorFrame )
// lua end
/*
* (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.
*/
-59
View File
@@ -1,59 +0,0 @@
/* Judgment - An Actor that displays a tap judgement. */
#ifndef JUDGMENT_H
#define JUDGMENT_H
#include "ActorFrame.h"
#include "AutoActor.h"
#include "GameConstantsAndTypes.h"
class Judgment : public ActorFrame
{
public:
Judgment();
virtual Judgment *Copy() const;
void LoadNormal();
void LoadNormal( const RString &sPath );
void LoadFromMultiPlayer( MultiPlayer mp );
void LoadFromNode( const XNode* pNode );
void Reset();
void SetJudgment( TapNoteScore score, bool bEarly );
void HandleMessage( const Message &msg );
//
// Lua
//
virtual void PushSelf( lua_State *L );
protected:
AutoActor m_sprJudgment;
MultiPlayer m_mpToTrack;
};
#endif
/*
* (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.
*/