add ScoreDisplayCalories
This commit is contained in:
@@ -89,7 +89,10 @@ Actor* ActorUtil::LoadFromActorFile( const CString& sAniDir, const XNode* pNode
|
|||||||
p->LoadFromNode( sAniDir, pNode );
|
p->LoadFromNode( sAniDir, pNode );
|
||||||
pActor = p;
|
pActor = p;
|
||||||
}
|
}
|
||||||
else if( sType == "GenreDisplay" )
|
else if(
|
||||||
|
sType == "GenreDisplay" ||
|
||||||
|
sType == "RollingNumbers" ||
|
||||||
|
sType == "ScoreDisplayCalories" )
|
||||||
{
|
{
|
||||||
pActor = ActorUtil::Create( sType, sAniDir, pNode );
|
pActor = ActorUtil::Create( sType, sAniDir, pNode );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
#include "GameplayMessages.h"
|
#include "GameplayMessages.h"
|
||||||
#include "GameSoundManager.h"
|
#include "GameSoundManager.h"
|
||||||
#include "Style.h"
|
#include "Style.h"
|
||||||
|
#include "MessageManager.h"
|
||||||
|
|
||||||
CString JUDGMENT_X_NAME( size_t p, size_t both_sides ) { return "JudgmentXOffset" + (both_sides ? CString("BothSides") : ssprintf("OneSideP%d",p+1) ); }
|
CString JUDGMENT_X_NAME( size_t p, size_t both_sides ) { return "JudgmentXOffset" + (both_sides ? CString("BothSides") : ssprintf("OneSideP%d",p+1) ); }
|
||||||
CString COMBO_X_NAME( size_t p, size_t both_sides ) { return "ComboXOffset" + (both_sides ? CString("BothSides") : ssprintf("OneSideP%d",p+1) ); }
|
CString COMBO_X_NAME( size_t p, size_t both_sides ) { return "ComboXOffset" + (both_sides ? CString("BothSides") : ssprintf("OneSideP%d",p+1) ); }
|
||||||
@@ -89,7 +90,6 @@ Player::Player()
|
|||||||
for( int c=0; c<MAX_NOTE_TRACKS; c++ )
|
for( int c=0; c<MAX_NOTE_TRACKS; c++ )
|
||||||
this->AddChild( &m_HoldJudgment[c] );
|
this->AddChild( &m_HoldJudgment[c] );
|
||||||
|
|
||||||
|
|
||||||
PlayerAI::InitFromDisk();
|
PlayerAI::InitFromDisk();
|
||||||
|
|
||||||
m_pNoteField = new NoteField;
|
m_pNoteField = new NoteField;
|
||||||
@@ -122,6 +122,12 @@ void Player::Init(
|
|||||||
m_pPrimaryScoreKeeper = pPrimaryScoreKeeper;
|
m_pPrimaryScoreKeeper = pPrimaryScoreKeeper;
|
||||||
m_pSecondaryScoreKeeper = pSecondaryScoreKeeper;
|
m_pSecondaryScoreKeeper = pSecondaryScoreKeeper;
|
||||||
|
|
||||||
|
// TODO: Remove use of PlayerNumber.
|
||||||
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
|
|
||||||
|
m_sMessageToSendOnStep = ssprintf("StepP%d",pn+1);
|
||||||
|
|
||||||
|
|
||||||
m_soundMine.Load( THEME->GetPathS("Player","mine"), true );
|
m_soundMine.Load( THEME->GetPathS("Player","mine"), true );
|
||||||
|
|
||||||
/* Attacks can be launched in course modes and in battle modes. They both come
|
/* Attacks can be launched in course modes and in battle modes. They both come
|
||||||
@@ -139,8 +145,6 @@ void Player::Init(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Remove use of PlayerNumber.
|
|
||||||
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
|
||||||
|
|
||||||
RageSoundParams p;
|
RageSoundParams p;
|
||||||
GameSoundManager::SetPlayerBalance( pn, p );
|
GameSoundManager::SetPlayerBalance( pn, p );
|
||||||
@@ -674,10 +678,27 @@ void Player::Step( int col, const RageTimer &tm )
|
|||||||
if( bOniDead )
|
if( bOniDead )
|
||||||
return; // do nothing
|
return; // do nothing
|
||||||
|
|
||||||
|
HandleStep( col, tm );
|
||||||
|
|
||||||
|
MESSAGEMAN->Broadcast( m_sMessageToSendOnStep );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Player::HandleStep( int col, const RageTimer &tm )
|
||||||
|
{
|
||||||
|
|
||||||
//LOG->Trace( "Player::HandlePlayerStep()" );
|
//LOG->Trace( "Player::HandlePlayerStep()" );
|
||||||
|
|
||||||
ASSERT_M( col >= 0 && col <= m_NoteData.GetNumTracks(), ssprintf("%i, %i", col, m_NoteData.GetNumTracks()) );
|
ASSERT_M( col >= 0 && col <= m_NoteData.GetNumTracks(), ssprintf("%i, %i", col, m_NoteData.GetNumTracks()) );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Count calories for this step.
|
||||||
|
//
|
||||||
|
if( m_pPlayerStageStats )
|
||||||
|
{
|
||||||
|
// FIXME:
|
||||||
|
m_pPlayerStageStats->fCaloriesBurned += randomf( 1.f, 2.f );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
float fPositionSeconds = GAMESTATE->m_fMusicSeconds;
|
float fPositionSeconds = GAMESTATE->m_fMusicSeconds;
|
||||||
fPositionSeconds -= tm.Ago();
|
fPositionSeconds -= tm.Ago();
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ public:
|
|||||||
NoteData m_NoteData;
|
NoteData m_NoteData;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void HandleStep( int col, const RageTimer &tm );
|
||||||
void UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat );
|
void UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat );
|
||||||
void OnRowCompletelyJudged( int iStepIndex );
|
void OnRowCompletelyJudged( int iStepIndex );
|
||||||
void HandleTapRowScore( unsigned row );
|
void HandleTapRowScore( unsigned row );
|
||||||
@@ -103,6 +104,8 @@ protected:
|
|||||||
RageSound m_soundAttackEnding;
|
RageSound m_soundAttackEnding;
|
||||||
|
|
||||||
vector<RageSound> m_vKeysounds;
|
vector<RageSound> m_vKeysounds;
|
||||||
|
|
||||||
|
CString m_sMessageToSendOnStep;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -2,6 +2,12 @@
|
|||||||
#include "RollingNumbers.h"
|
#include "RollingNumbers.h"
|
||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
#include "XmlFile.h"
|
#include "XmlFile.h"
|
||||||
|
#include "ActorUtil.h"
|
||||||
|
|
||||||
|
// lua start
|
||||||
|
LUA_REGISTER_CLASS( RollingNumbers )
|
||||||
|
// lua end
|
||||||
|
REGISTER_ACTOR_CLASS( RollingNumbers );
|
||||||
|
|
||||||
RollingNumbers::RollingNumbers()
|
RollingNumbers::RollingNumbers()
|
||||||
{
|
{
|
||||||
@@ -36,6 +42,8 @@ void RollingNumbers::Update( float fDeltaTime )
|
|||||||
|
|
||||||
void RollingNumbers::SetTargetNumber( float fTargetNumber )
|
void RollingNumbers::SetTargetNumber( float fTargetNumber )
|
||||||
{
|
{
|
||||||
|
if( fTargetNumber == m_fTargetNumber ) // no change
|
||||||
|
return;
|
||||||
m_fTargetNumber = fTargetNumber;
|
m_fTargetNumber = fTargetNumber;
|
||||||
m_fScoreVelocity = (m_fTargetNumber-m_fCurrentNumber) / m_fApproachSeconds;
|
m_fScoreVelocity = (m_fTargetNumber-m_fCurrentNumber) / m_fApproachSeconds;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,19 @@
|
|||||||
#include "BitmapText.h"
|
#include "BitmapText.h"
|
||||||
|
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
class LunaRollingNumbers : public LunaBitmapText<T>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LunaRollingNumbers() { LUA->Register( Register ); }
|
||||||
|
|
||||||
|
static void Register(lua_State *L)
|
||||||
|
{
|
||||||
|
LunaBitmapText<T>::Register( L );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class RollingNumbers : public BitmapText
|
class RollingNumbers : public BitmapText
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -19,6 +32,11 @@ public:
|
|||||||
|
|
||||||
void UpdateText();
|
void UpdateText();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Commands
|
||||||
|
//
|
||||||
|
virtual void PushSelf( lua_State *L );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Loaded attributes
|
// Loaded attributes
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -0,0 +1,71 @@
|
|||||||
|
#include "global.h"
|
||||||
|
#include "ScoreDisplayCalories.h"
|
||||||
|
#include "MessageManager.h"
|
||||||
|
#include "PlayerNumber.h"
|
||||||
|
#include "PlayerState.h"
|
||||||
|
#include "RageUtil.h"
|
||||||
|
#include "StageStats.h"
|
||||||
|
#include "XmlFile.h"
|
||||||
|
#include "ActorUtil.h"
|
||||||
|
|
||||||
|
// lua start
|
||||||
|
LUA_REGISTER_CLASS( ScoreDisplayCalories )
|
||||||
|
// lua end
|
||||||
|
REGISTER_ACTOR_CLASS( ScoreDisplayCalories );
|
||||||
|
|
||||||
|
ScoreDisplayCalories::ScoreDisplayCalories()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ScoreDisplayCalories::~ScoreDisplayCalories()
|
||||||
|
{
|
||||||
|
MESSAGEMAN->Unsubscribe( this, m_sMessageOnStep );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScoreDisplayCalories::LoadFromNode( const CString& sDir, const XNode* pNode )
|
||||||
|
{
|
||||||
|
RollingNumbers::LoadFromNode( sDir, pNode );
|
||||||
|
|
||||||
|
bool b = pNode->GetAttrValue( "PlayerNumber", (int&)m_PlayerNumber );
|
||||||
|
ASSERT( b );
|
||||||
|
|
||||||
|
m_sMessageOnStep = ssprintf("StepP%d",m_PlayerNumber+1);
|
||||||
|
|
||||||
|
MESSAGEMAN->Subscribe( this, m_sMessageOnStep );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScoreDisplayCalories::PlayCommand( const CString &sCommandName )
|
||||||
|
{
|
||||||
|
if( sCommandName == m_sMessageOnStep )
|
||||||
|
{
|
||||||
|
float fCals = g_CurStageStats.m_player[m_PlayerNumber].fCaloriesBurned;
|
||||||
|
this->SetTargetNumber( fCals );
|
||||||
|
}
|
||||||
|
|
||||||
|
RollingNumbers::PlayCommand( sCommandName );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (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.
|
||||||
|
*/
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
/* ScoreDisplayCalories - Shows point score during gameplay and some menus. */
|
||||||
|
|
||||||
|
#ifndef ScoreDisplayCalories_H
|
||||||
|
#define ScoreDisplayCalories_H
|
||||||
|
|
||||||
|
#include "RollingNumbers.h"
|
||||||
|
#include "PlayerNumber.h"
|
||||||
|
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
class LunaScoreDisplayCalories : public LunaRollingNumbers<T>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LunaScoreDisplayCalories() { LUA->Register( Register ); }
|
||||||
|
|
||||||
|
static void Register(lua_State *L)
|
||||||
|
{
|
||||||
|
LunaRollingNumbers<T>::Register( L );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class ScoreDisplayCalories : public RollingNumbers
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ScoreDisplayCalories();
|
||||||
|
~ScoreDisplayCalories();
|
||||||
|
|
||||||
|
void LoadFromNode( const CString& sDir, const XNode* pNode );
|
||||||
|
|
||||||
|
void PlayCommand( const CString &sCommandName );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Commands
|
||||||
|
//
|
||||||
|
virtual void PushSelf( lua_State *L );
|
||||||
|
|
||||||
|
private:
|
||||||
|
PlayerNumber m_PlayerNumber;
|
||||||
|
CString m_sMessageOnStep;
|
||||||
|
};
|
||||||
|
|
||||||
|
#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.
|
||||||
|
*/
|
||||||
Reference in New Issue
Block a user