Fix PlayerStageStats::SetLifeRecordAt to broadcast correct message for the player. Also adds Message::Message(MessageID) constructor.
This commit is contained in:
@@ -8,6 +8,12 @@ ________________________________________________________________________________
|
|||||||
StepMania current development
|
StepMania current development
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
2014/08/06
|
||||||
|
----------
|
||||||
|
* [ScreenGameplay] LifeMeterChangedP1 message is no longer broadcast for for
|
||||||
|
P2's lifemeter. Use LifeMeterChangedP2. "Life" and "StepsSecond" are passed
|
||||||
|
in the params table for the message.
|
||||||
|
|
||||||
2013/10/09
|
2013/10/09
|
||||||
----------
|
----------
|
||||||
* [CombinedLifeMeterTug] Added names and commands to Separator and Frame items.
|
* [CombinedLifeMeterTug] Added names and commands to Separator and Frame items.
|
||||||
|
|||||||
@@ -102,6 +102,13 @@ Message::Message( const RString &s )
|
|||||||
m_bBroadcast = false;
|
m_bBroadcast = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Message::Message(const MessageID id)
|
||||||
|
{
|
||||||
|
m_sName= MessageIDToString(id);
|
||||||
|
m_pParams = new LuaTable;
|
||||||
|
m_bBroadcast = false;
|
||||||
|
}
|
||||||
|
|
||||||
Message::Message( const RString &s, const LuaReference ¶ms )
|
Message::Message( const RString &s, const LuaReference ¶ms )
|
||||||
{
|
{
|
||||||
m_sName = s;
|
m_sName = s;
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ const RString& MessageIDToString( MessageID m );
|
|||||||
struct Message
|
struct Message
|
||||||
{
|
{
|
||||||
explicit Message( const RString &s );
|
explicit Message( const RString &s );
|
||||||
|
explicit Message(const MessageID id);
|
||||||
Message( const RString &s, const LuaReference ¶ms );
|
Message( const RString &s, const LuaReference ¶ms );
|
||||||
~Message();
|
~Message();
|
||||||
|
|
||||||
|
|||||||
@@ -25,8 +25,12 @@ const float LESSON_PASS_THRESHOLD = 0.8f;
|
|||||||
|
|
||||||
Grade GetGradeFromPercent( float fPercent );
|
Grade GetGradeFromPercent( float fPercent );
|
||||||
|
|
||||||
void PlayerStageStats::Init()
|
void PlayerStageStats::InternalInit()
|
||||||
{
|
{
|
||||||
|
m_for_multiplayer= false;
|
||||||
|
m_player_number= PLAYER_1;
|
||||||
|
m_multiplayer_number= MultiPlayer_P1;
|
||||||
|
|
||||||
m_bPlayerCanAchieveFullCombo = true;
|
m_bPlayerCanAchieveFullCombo = true;
|
||||||
m_bJoined = false;
|
m_bJoined = false;
|
||||||
m_vpPossibleSteps.clear();
|
m_vpPossibleSteps.clear();
|
||||||
@@ -67,6 +71,18 @@ void PlayerStageStats::Init()
|
|||||||
m_HighScore = HighScore();
|
m_HighScore = HighScore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PlayerStageStats::Init(PlayerNumber pn)
|
||||||
|
{
|
||||||
|
m_for_multiplayer= false;
|
||||||
|
m_player_number= pn;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlayerStageStats::Init(MultiPlayer pn)
|
||||||
|
{
|
||||||
|
m_for_multiplayer= true;
|
||||||
|
m_multiplayer_number= pn;
|
||||||
|
}
|
||||||
|
|
||||||
void PlayerStageStats::AddStats( const PlayerStageStats& other )
|
void PlayerStageStats::AddStats( const PlayerStageStats& other )
|
||||||
{
|
{
|
||||||
m_bJoined = other.m_bJoined;
|
m_bJoined = other.m_bJoined;
|
||||||
@@ -353,7 +369,10 @@ void PlayerStageStats::SetLifeRecordAt( float fLife, float fStepsSecond )
|
|||||||
// fSecond will always be greater than any value already in the map.
|
// fSecond will always be greater than any value already in the map.
|
||||||
m_fLifeRecord[fStepsSecond] = fLife;
|
m_fLifeRecord[fStepsSecond] = fLife;
|
||||||
|
|
||||||
MESSAGEMAN->Broadcast( Message_LifeMeterChangedP1 );
|
Message msg(static_cast<MessageID>(Message_LifeMeterChangedP1+m_player_number));
|
||||||
|
msg.SetParam("Life", fLife);
|
||||||
|
msg.SetParam("StepsSecond", fStepsSecond);
|
||||||
|
MESSAGEMAN->Broadcast(msg);
|
||||||
|
|
||||||
// Memory optimization:
|
// Memory optimization:
|
||||||
// If we have three consecutive records A, B, and C all with the same fLife,
|
// If we have three consecutive records A, B, and C all with the same fLife,
|
||||||
|
|||||||
@@ -13,8 +13,10 @@ class PlayerStageStats
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** @brief Set up the PlayerStageStats with default values. */
|
/** @brief Set up the PlayerStageStats with default values. */
|
||||||
PlayerStageStats() { Init(); }
|
PlayerStageStats() { InternalInit(); }
|
||||||
void Init();
|
void InternalInit();
|
||||||
|
void Init(PlayerNumber pn);
|
||||||
|
void Init(MultiPlayer pn);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Add stats from one PlayerStageStats to another.
|
* @brief Add stats from one PlayerStageStats to another.
|
||||||
@@ -31,6 +33,10 @@ public:
|
|||||||
int GetLessonScoreNeeded() const;
|
int GetLessonScoreNeeded() const;
|
||||||
void ResetScoreForLesson();
|
void ResetScoreForLesson();
|
||||||
|
|
||||||
|
bool m_for_multiplayer;
|
||||||
|
PlayerNumber m_player_number;
|
||||||
|
MultiPlayer m_multiplayer_number;
|
||||||
|
|
||||||
bool m_bJoined;
|
bool m_bJoined;
|
||||||
bool m_bPlayerCanAchieveFullCombo;
|
bool m_bPlayerCanAchieveFullCombo;
|
||||||
vector<Steps*> m_vpPossibleSteps;
|
vector<Steps*> m_vpPossibleSteps;
|
||||||
|
|||||||
@@ -29,6 +29,14 @@ StageStats::StageStats()
|
|||||||
m_fGameplaySeconds = 0;
|
m_fGameplaySeconds = 0;
|
||||||
m_fStepsSeconds = 0;
|
m_fStepsSeconds = 0;
|
||||||
m_fMusicRate = 1;
|
m_fMusicRate = 1;
|
||||||
|
FOREACH_PlayerNumber(pn)
|
||||||
|
{
|
||||||
|
m_player[pn].Init(pn);
|
||||||
|
}
|
||||||
|
FOREACH_MultiPlayer(pn)
|
||||||
|
{
|
||||||
|
m_multiPlayer[pn].Init(pn);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StageStats::Init()
|
void StageStats::Init()
|
||||||
|
|||||||
Reference in New Issue
Block a user