combo and judgement can be complex actors; allow changing which actors is

affected by realtime repositioning
This commit is contained in:
Glenn Maynard
2007-03-03 04:47:01 +00:00
parent 0c056ca597
commit b1952bff19
2 changed files with 39 additions and 6 deletions
+29 -6
View File
@@ -332,13 +332,15 @@ void Player::Init(
m_Combo.Load( THEME->GetPathG(sType,"combo") );
m_Combo->SetName( "Combo" );
ActorUtil::LoadAllCommandsAndOnCommand( m_Combo, sType );
m_pActorWithJudgmentPosition = &*m_pJudgment;
this->AddChild( m_Combo );
m_Combo->PlayCommand( "On" );
m_pJudgment.Load( THEME->GetPathG(sType,"judgment") );
m_pJudgment->SetName( "Judgment" );
ActorUtil::LoadAllCommandsAndOnCommand( m_pJudgment, sType );
m_pActorWithComboPosition = &*m_Combo;
this->AddChild( m_pJudgment );
m_pJudgment->PlayCommand( "On" );
}
// Load HoldJudgments
@@ -560,16 +562,18 @@ void Player::Update( float fDeltaTime )
const bool bReverse = m_pPlayerState->m_PlayerOptions.GetCurrent().GetReversePercentForColumn(0) == 1;
float fPercentCentered = m_pPlayerState->m_PlayerOptions.GetCurrent().m_fScrolls[PlayerOptions::SCROLL_CENTERED];
if( m_pActorWithJudgmentPosition != NULL )
{
const Actor::TweenState &ts1 = m_tsJudgment[bReverse?1:0][0];
const Actor::TweenState &ts2 = m_tsJudgment[bReverse?1:0][1];
Actor::TweenState::MakeWeightedAverage( m_pJudgment->DestTweenState(), ts1, ts2, fPercentCentered );
Actor::TweenState::MakeWeightedAverage( m_pActorWithJudgmentPosition->DestTweenState(), ts1, ts2, fPercentCentered );
}
if( m_pActorWithComboPosition != NULL )
{
const Actor::TweenState &ts1 = m_tsCombo[bReverse?1:0][0];
const Actor::TweenState &ts2 = m_tsCombo[bReverse?1:0][1];
Actor::TweenState::MakeWeightedAverage( m_Combo->DestTweenState(), ts1, ts2, fPercentCentered );
Actor::TweenState::MakeWeightedAverage( m_pActorWithComboPosition->DestTweenState(), ts1, ts2, fPercentCentered );
}
float fNoteFieldZoom = 1 - fTinyPercent*0.5f;
@@ -2246,7 +2250,7 @@ void Player::RandomizeNotes( int iNoteRow )
void Player::HandleTapRowScore( unsigned row )
{
bool bNoCheating = true;
bool bNoCheating = 0;//true;
#ifdef DEBUG
bNoCheating = false;
#endif
@@ -2355,7 +2359,7 @@ void Player::HandleHoldScore( const TapNote &tn )
{
HoldNoteScore holdScore = tn.HoldResult.hns;
TapNoteScore tapScore = tn.result.tns;
bool NoCheating = true;
bool NoCheating = 0;//true;
#ifdef DEBUG
NoCheating = false;
#endif
@@ -2486,6 +2490,25 @@ void Player::SetCombo( int iCombo, int iMisses )
this->HandleMessage( msg );
}
// lua start
#include "LuaBinding.h"
class LunaPlayer: public Luna<Player>
{
public:
static int SetActorWithJudgmentPosition( T* p, lua_State *L ) { Actor *pActor = Luna<Actor>::check(L, 1); p->SetActorWithJudgmentPosition(pActor); return 0; }
static int SetActorWithComboPosition( T* p, lua_State *L ) { Actor *pActor = Luna<Actor>::check(L, 1); p->SetActorWithComboPosition(pActor); return 0; }
LunaPlayer()
{
ADD_METHOD( SetActorWithJudgmentPosition );
ADD_METHOD( SetActorWithComboPosition );
}
};
LUA_REGISTER_DERIVED_CLASS( Player, ActorFrame )
// lua end
/*
* (c) 2001-2006 Chris Danford, Steve Checkoway
* All rights reserved.
+10
View File
@@ -99,6 +99,14 @@ public:
const NoteData &GetNoteData() const { return m_NoteData; }
bool HasNoteField() const { return m_pNoteField != NULL; }
void SetActorWithJudgmentPosition( Actor *pActor ) { m_pActorWithJudgmentPosition = pActor; }
void SetActorWithComboPosition( Actor *pActor ) { m_pActorWithComboPosition = pActor; }
//
// Lua
//
virtual void PushSelf( lua_State *L );
protected:
void UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat );
void UpdateJudgedRows();
@@ -145,6 +153,8 @@ protected:
AutoActor m_pJudgment;
AutoActor m_Combo;
Actor *m_pActorWithJudgmentPosition;
Actor *m_pActorWithComboPosition;
AttackDisplay *m_pAttackDisplay;