handle MultiPlayer judgements with message parameters to clean
up judgement handling
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
#include "ThemeManager.h"
|
||||
#include "ThemeMetric.h"
|
||||
#include "ActorUtil.h"
|
||||
#include "StatsManager.h"
|
||||
#include "XmlFile.h"
|
||||
|
||||
REGISTER_ACTOR_CLASS( HoldJudgment )
|
||||
@@ -74,15 +73,20 @@ void HoldJudgment::LoadFromMultiPlayer( MultiPlayer mp )
|
||||
{
|
||||
ASSERT( m_mpToTrack == MultiPlayer_Invalid ); // assert only load once
|
||||
m_mpToTrack = mp;
|
||||
this->SubscribeToMessage( enum_add2(Message_ShowHoldJudgmentMuliPlayerP1,m_mpToTrack) );
|
||||
this->SubscribeToMessage( "Judgment" );
|
||||
}
|
||||
|
||||
void HoldJudgment::HandleMessage( const Message &msg )
|
||||
{
|
||||
if( msg == enum_add2(Message_ShowHoldJudgmentMuliPlayerP1,m_mpToTrack) )
|
||||
if( m_mpToTrack != MultiPlayer_Invalid && msg.GetName() == "Judgment" )
|
||||
{
|
||||
ASSERT( m_mpToTrack != MultiPlayer_Invalid );
|
||||
SetHoldJudgment( STATSMAN->m_CurStageStats.m_multiPlayer[m_mpToTrack].m_hnsLast );
|
||||
MultiPlayer mp;
|
||||
if( msg.GetParam("MultiPlayer", mp) && mp == m_mpToTrack )
|
||||
{
|
||||
HoldNoteScore hns;
|
||||
if( msg.GetParam("HoldNoteScore", hns) )
|
||||
SetHoldJudgment( hns );
|
||||
}
|
||||
}
|
||||
|
||||
ActorFrame::HandleMessage( msg );
|
||||
|
||||
@@ -2,11 +2,9 @@
|
||||
#include "Judgment.h"
|
||||
#include "RageUtil.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "GameState.h"
|
||||
#include "ThemeManager.h"
|
||||
#include "ThemeMetric.h"
|
||||
#include "ActorUtil.h"
|
||||
#include "StatsManager.h"
|
||||
#include "XmlFile.h"
|
||||
|
||||
REGISTER_ACTOR_CLASS( Judgment )
|
||||
@@ -102,13 +100,26 @@ void Judgment::LoadFromMultiPlayer( MultiPlayer mp )
|
||||
{
|
||||
ASSERT( m_mpToTrack == MultiPlayer_Invalid ); // assert only load once
|
||||
m_mpToTrack = mp;
|
||||
this->SubscribeToMessage( enum_add2(Message_ShowJudgmentMuliPlayerP1,m_mpToTrack) );
|
||||
this->SubscribeToMessage( "Judgment" );
|
||||
}
|
||||
|
||||
void Judgment::HandleMessage( const Message &msg )
|
||||
{
|
||||
if( m_mpToTrack != MultiPlayer_Invalid && msg == enum_add2(Message_ShowJudgmentMuliPlayerP1,m_mpToTrack) )
|
||||
SetJudgment( STATSMAN->m_CurStageStats.m_multiPlayer[m_mpToTrack].m_tnsLast, false ); // FIXME: save and pass early bool?
|
||||
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 );
|
||||
}
|
||||
|
||||
@@ -66,70 +66,6 @@ static const char *MessageIDNames[] = {
|
||||
"StorageDevicesChanged",
|
||||
"AutoJoyMappingApplied",
|
||||
"ScreenChanged",
|
||||
"ShowJudgmentMuliPlayerP1",
|
||||
"ShowJudgmentMuliPlayerP2",
|
||||
"ShowJudgmentMuliPlayerP3",
|
||||
"ShowJudgmentMuliPlayerP4",
|
||||
"ShowJudgmentMuliPlayerP5",
|
||||
"ShowJudgmentMuliPlayerP6",
|
||||
"ShowJudgmentMuliPlayerP7",
|
||||
"ShowJudgmentMuliPlayerP8",
|
||||
"ShowJudgmentMuliPlayerP9",
|
||||
"ShowJudgmentMuliPlayerP10",
|
||||
"ShowJudgmentMuliPlayerP11",
|
||||
"ShowJudgmentMuliPlayerP12",
|
||||
"ShowJudgmentMuliPlayerP13",
|
||||
"ShowJudgmentMuliPlayerP14",
|
||||
"ShowJudgmentMuliPlayerP15",
|
||||
"ShowJudgmentMuliPlayerP16",
|
||||
"ShowJudgmentMuliPlayerP17",
|
||||
"ShowJudgmentMuliPlayerP18",
|
||||
"ShowJudgmentMuliPlayerP19",
|
||||
"ShowJudgmentMuliPlayerP20",
|
||||
"ShowJudgmentMuliPlayerP21",
|
||||
"ShowJudgmentMuliPlayerP22",
|
||||
"ShowJudgmentMuliPlayerP23",
|
||||
"ShowJudgmentMuliPlayerP24",
|
||||
"ShowJudgmentMuliPlayerP25",
|
||||
"ShowJudgmentMuliPlayerP26",
|
||||
"ShowJudgmentMuliPlayerP27",
|
||||
"ShowJudgmentMuliPlayerP28",
|
||||
"ShowJudgmentMuliPlayerP29",
|
||||
"ShowJudgmentMuliPlayerP30",
|
||||
"ShowJudgmentMuliPlayerP31",
|
||||
"ShowJudgmentMuliPlayerP32",
|
||||
"ShowHoldJudgmentMuliPlayerP1",
|
||||
"ShowHoldJudgmentMuliPlayerP2",
|
||||
"ShowHoldJudgmentMuliPlayerP3",
|
||||
"ShowHoldJudgmentMuliPlayerP4",
|
||||
"ShowHoldJudgmentMuliPlayerP5",
|
||||
"ShowHoldJudgmentMuliPlayerP6",
|
||||
"ShowHoldJudgmentMuliPlayerP7",
|
||||
"ShowHoldJudgmentMuliPlayerP8",
|
||||
"ShowHoldJudgmentMuliPlayerP9",
|
||||
"ShowHoldJudgmentMuliPlayerP10",
|
||||
"ShowHoldJudgmentMuliPlayerP11",
|
||||
"ShowHoldJudgmentMuliPlayerP12",
|
||||
"ShowHoldJudgmentMuliPlayerP13",
|
||||
"ShowHoldJudgmentMuliPlayerP14",
|
||||
"ShowHoldJudgmentMuliPlayerP15",
|
||||
"ShowHoldJudgmentMuliPlayerP16",
|
||||
"ShowHoldJudgmentMuliPlayerP17",
|
||||
"ShowHoldJudgmentMuliPlayerP18",
|
||||
"ShowHoldJudgmentMuliPlayerP19",
|
||||
"ShowHoldJudgmentMuliPlayerP20",
|
||||
"ShowHoldJudgmentMuliPlayerP21",
|
||||
"ShowHoldJudgmentMuliPlayerP22",
|
||||
"ShowHoldJudgmentMuliPlayerP23",
|
||||
"ShowHoldJudgmentMuliPlayerP24",
|
||||
"ShowHoldJudgmentMuliPlayerP25",
|
||||
"ShowHoldJudgmentMuliPlayerP26",
|
||||
"ShowHoldJudgmentMuliPlayerP27",
|
||||
"ShowHoldJudgmentMuliPlayerP28",
|
||||
"ShowHoldJudgmentMuliPlayerP29",
|
||||
"ShowHoldJudgmentMuliPlayerP30",
|
||||
"ShowHoldJudgmentMuliPlayerP31",
|
||||
"ShowHoldJudgmentMuliPlayerP32",
|
||||
"SongModified",
|
||||
"ScoreMultiplierChangedP1",
|
||||
"ScoreMultiplierChangedP2",
|
||||
|
||||
@@ -63,70 +63,6 @@ enum MessageID
|
||||
Message_StorageDevicesChanged,
|
||||
Message_AutoJoyMappingApplied,
|
||||
Message_ScreenChanged,
|
||||
Message_ShowJudgmentMuliPlayerP1,
|
||||
Message_ShowJudgmentMuliPlayerP2,
|
||||
Message_ShowJudgmentMuliPlayerP3,
|
||||
Message_ShowJudgmentMuliPlayerP4,
|
||||
Message_ShowJudgmentMuliPlayerP5,
|
||||
Message_ShowJudgmentMuliPlayerP6,
|
||||
Message_ShowJudgmentMuliPlayerP7,
|
||||
Message_ShowJudgmentMuliPlayerP8,
|
||||
Message_ShowJudgmentMuliPlayerP9,
|
||||
Message_ShowJudgmentMuliPlayerP10,
|
||||
Message_ShowJudgmentMuliPlayerP11,
|
||||
Message_ShowJudgmentMuliPlayerP12,
|
||||
Message_ShowJudgmentMuliPlayerP13,
|
||||
Message_ShowJudgmentMuliPlayerP14,
|
||||
Message_ShowJudgmentMuliPlayerP15,
|
||||
Message_ShowJudgmentMuliPlayerP16,
|
||||
Message_ShowJudgmentMuliPlayerP17,
|
||||
Message_ShowJudgmentMuliPlayerP18,
|
||||
Message_ShowJudgmentMuliPlayerP19,
|
||||
Message_ShowJudgmentMuliPlayerP20,
|
||||
Message_ShowJudgmentMuliPlayerP21,
|
||||
Message_ShowJudgmentMuliPlayerP22,
|
||||
Message_ShowJudgmentMuliPlayerP23,
|
||||
Message_ShowJudgmentMuliPlayerP24,
|
||||
Message_ShowJudgmentMuliPlayerP25,
|
||||
Message_ShowJudgmentMuliPlayerP26,
|
||||
Message_ShowJudgmentMuliPlayerP27,
|
||||
Message_ShowJudgmentMuliPlayerP28,
|
||||
Message_ShowJudgmentMuliPlayerP29,
|
||||
Message_ShowJudgmentMuliPlayerP30,
|
||||
Message_ShowJudgmentMuliPlayerP31,
|
||||
Message_ShowJudgmentMuliPlayerP32,
|
||||
Message_ShowHoldJudgmentMuliPlayerP1,
|
||||
Message_ShowHoldJudgmentMuliPlayerP2,
|
||||
Message_ShowHoldJudgmentMuliPlayerP3,
|
||||
Message_ShowHoldJudgmentMuliPlayerP4,
|
||||
Message_ShowHoldJudgmentMuliPlayerP5,
|
||||
Message_ShowHoldJudgmentMuliPlayerP6,
|
||||
Message_ShowHoldJudgmentMuliPlayerP7,
|
||||
Message_ShowHoldJudgmentMuliPlayerP8,
|
||||
Message_ShowHoldJudgmentMuliPlayerP9,
|
||||
Message_ShowHoldJudgmentMuliPlayerP10,
|
||||
Message_ShowHoldJudgmentMuliPlayerP11,
|
||||
Message_ShowHoldJudgmentMuliPlayerP12,
|
||||
Message_ShowHoldJudgmentMuliPlayerP13,
|
||||
Message_ShowHoldJudgmentMuliPlayerP14,
|
||||
Message_ShowHoldJudgmentMuliPlayerP15,
|
||||
Message_ShowHoldJudgmentMuliPlayerP16,
|
||||
Message_ShowHoldJudgmentMuliPlayerP17,
|
||||
Message_ShowHoldJudgmentMuliPlayerP18,
|
||||
Message_ShowHoldJudgmentMuliPlayerP19,
|
||||
Message_ShowHoldJudgmentMuliPlayerP20,
|
||||
Message_ShowHoldJudgmentMuliPlayerP21,
|
||||
Message_ShowHoldJudgmentMuliPlayerP22,
|
||||
Message_ShowHoldJudgmentMuliPlayerP23,
|
||||
Message_ShowHoldJudgmentMuliPlayerP24,
|
||||
Message_ShowHoldJudgmentMuliPlayerP25,
|
||||
Message_ShowHoldJudgmentMuliPlayerP26,
|
||||
Message_ShowHoldJudgmentMuliPlayerP27,
|
||||
Message_ShowHoldJudgmentMuliPlayerP28,
|
||||
Message_ShowHoldJudgmentMuliPlayerP29,
|
||||
Message_ShowHoldJudgmentMuliPlayerP30,
|
||||
Message_ShowHoldJudgmentMuliPlayerP31,
|
||||
Message_ShowHoldJudgmentMuliPlayerP32,
|
||||
Message_SongModified,
|
||||
Message_ScoreMultiplierChangedP1,
|
||||
Message_ScoreMultiplierChangedP2,
|
||||
|
||||
@@ -2508,33 +2508,25 @@ bool Player::IsPlayingBeginner() const
|
||||
|
||||
void Player::SetJudgment( TapNoteScore tns, bool bEarly )
|
||||
{
|
||||
if( m_pPlayerStageStats )
|
||||
m_pPlayerStageStats->m_tnsLast = tns;
|
||||
if( m_pPlayerState->m_mp != MultiPlayer_Invalid )
|
||||
MESSAGEMAN->Broadcast( enum_add2(Message_ShowJudgmentMuliPlayerP1,m_pPlayerState->m_mp) );
|
||||
|
||||
if( m_pJudgment )
|
||||
m_pJudgment->SetJudgment( tns, bEarly );
|
||||
|
||||
Message msg("Judgment");
|
||||
msg.SetParam( "Player", m_pPlayerState->m_PlayerNumber );
|
||||
msg.SetParam( "MultiPlayer", m_pPlayerState->m_mp );
|
||||
msg.SetParam( "TapNoteScore", tns );
|
||||
msg.SetParam( "HoldNoteScore", HoldNoteScore_Invalid );
|
||||
msg.SetParam( "Early", bEarly );
|
||||
MESSAGEMAN->Broadcast( msg );
|
||||
}
|
||||
|
||||
void Player::SetHoldJudgment( TapNoteScore tns, HoldNoteScore hns, int iTrack )
|
||||
{
|
||||
if( m_pPlayerStageStats != NULL )
|
||||
m_pPlayerStageStats->m_hnsLast = hns;
|
||||
if( m_pPlayerState->m_mp != MultiPlayer_Invalid )
|
||||
MESSAGEMAN->Broadcast( enum_add2(Message_ShowHoldJudgmentMuliPlayerP1,m_pPlayerState->m_mp) );
|
||||
|
||||
ASSERT( iTrack < (int)m_vHoldJudgment.size() );
|
||||
m_vHoldJudgment[iTrack]->SetHoldJudgment( hns );
|
||||
|
||||
Message msg("Judgment");
|
||||
msg.SetParam( "Player", m_pPlayerState->m_PlayerNumber );
|
||||
msg.SetParam( "MultiPlayer", m_pPlayerState->m_mp );
|
||||
msg.SetParam( "TapNoteScore", tns );
|
||||
msg.SetParam( "HoldNoteScore", hns );
|
||||
MESSAGEMAN->Broadcast( msg );
|
||||
|
||||
@@ -40,8 +40,6 @@ void PlayerStageStats::Init()
|
||||
m_iSongsPlayed = 0;
|
||||
m_fLifeRemainingSeconds = 0;
|
||||
m_fCaloriesBurned = 0;
|
||||
m_tnsLast = TapNoteScore_Invalid;
|
||||
m_hnsLast = HoldNoteScore_Invalid;
|
||||
|
||||
ZERO( m_iTapNoteScores );
|
||||
ZERO( m_iHoldNoteScores );
|
||||
|
||||
@@ -59,9 +59,6 @@ public:
|
||||
// workout
|
||||
float m_fCaloriesBurned;
|
||||
|
||||
TapNoteScore m_tnsLast;
|
||||
HoldNoteScore m_hnsLast;
|
||||
|
||||
map<float,float> m_fLifeRecord;
|
||||
void SetLifeRecordAt( float fLife, float fStepsSecond );
|
||||
void GetLifeRecord( float *fLifeOut, int iNumSamples, float fStepsEndSecond ) const;
|
||||
|
||||
Reference in New Issue
Block a user