From b1952bff193b701f19442c468a1cbd68937dad9c Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sat, 3 Mar 2007 04:47:01 +0000 Subject: [PATCH] combo and judgement can be complex actors; allow changing which actors is affected by realtime repositioning --- stepmania/src/Player.cpp | 35 +++++++++++++++++++++++++++++------ stepmania/src/Player.h | 10 ++++++++++ 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/stepmania/src/Player.cpp b/stepmania/src/Player.cpp index 4ecba82653..a076e98b89 100644 --- a/stepmania/src/Player.cpp +++ b/stepmania/src/Player.cpp @@ -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 +{ +public: + static int SetActorWithJudgmentPosition( T* p, lua_State *L ) { Actor *pActor = Luna::check(L, 1); p->SetActorWithJudgmentPosition(pActor); return 0; } + static int SetActorWithComboPosition( T* p, lua_State *L ) { Actor *pActor = Luna::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. diff --git a/stepmania/src/Player.h b/stepmania/src/Player.h index 57f870ae5e..9b76f62c7c 100644 --- a/stepmania/src/Player.h +++ b/stepmania/src/Player.h @@ -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;