XNode *HighScoreImpl::CreateNode() const { XNode *pNode = new XNode( "HighScore" ); const bool bWriteSimpleValues = RadarValues::WRITE_SIMPLE_VALIES; const bool bWriteComplexValues = RadarValues::WRITE_COMPLEX_VALIES; // TRICKY: Don't write "name to fill in" markers. pNode->AppendChild( "Name", IsRankingToFillIn(sName) ? RString("") : sName ); pNode->AppendChild( "Grade", GradeToString(grade) ); pNode->AppendChild( "Score", iScore ); pNode->AppendChild( "PercentDP", fPercentDP ); pNode->AppendChild( "SurviveSeconds", fSurviveSeconds ); pNode->AppendChild( "MaxCombo", iMaxCombo ); pNode->AppendChild( "StageAward", StageAwardToString(stageAward) ); pNode->AppendChild( "PeakComboAward", PeakComboAwardToString(peakComboAward) ); pNode->AppendChild( "Modifiers", sModifiers ); pNode->AppendChild( "DateTime", dateTime.GetString() ); pNode->AppendChild( "PlayerGuid", sPlayerGuid ); pNode->AppendChild( "MachineGuid", sMachineGuid ); pNode->AppendChild( "ProductID", iProductID ); XNode* pTapNoteScores = pNode->AppendChild( "TapNoteScores" ); FOREACH_ENUM( TapNoteScore, tns ) if( tns != TNS_None ) // HACK: don't save meaningless "none" count pTapNoteScores->AppendChild( TapNoteScoreToString(tns), iTapNoteScores[tns] ); XNode* pHoldNoteScores = pNode->AppendChild( "HoldNoteScores" ); FOREACH_ENUM( HoldNoteScore, hns ) if( hns != HNS_None ) // HACK: don't save meaningless "none" count pHoldNoteScores->AppendChild( HoldNoteScoreToString(hns), iHoldNoteScores[hns] ); pNode->AppendChild( radarValues.CreateNode(bWriteSimpleValues, bWriteComplexValues) ); pNode->AppendChild( "LifeRemainingSeconds", fLifeRemainingSeconds ); pNode->AppendChild( "Disqualified", bDisqualified); return pNode; }
bool ReceptorArrow::Load( const CString &NoteSkin, PlayerNumber pn, int iColNo ) { m_PlayerNumber = pn; m_iColNo = iColNo; NoteFieldMode &mode = g_NoteFieldMode[pn]; CString sButton = mode.GrayButtonNames[iColNo]; if( sButton == "" ) sButton = GAMESTATE->GetCurrentGame()->ColToButtonName( iColNo ); CString sPath; m_pReceptorWaiting.Load( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin,sButton,"receptor waiting") ); m_pReceptorGo.Load( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin,sButton,"receptor go") ); FOREACH_TapNoteScore( i ) { CString sJudge = TapNoteScoreToString( i ); m_sScoreCommand[i] = NOTESKIN->GetMetric( NoteSkin, m_sName, Capitalize(sJudge)+"Command" ); } m_pPressBlock.Load( NOTESKIN->GetPathToFromNoteSkinAndButton(NoteSkin,sButton,"KeypressBlock") ); // draw pressblock before receptors this->AddChild( m_pPressBlock ); this->AddChild( m_pReceptorWaiting ); this->AddChild( m_pReceptorGo ); return true; }
void ReceptorArrow::Step( TapNoteScore score ) { m_bIsPressed = true; RString sJudge = TapNoteScoreToString( score ); m_pReceptor->PlayCommand( Capitalize(sJudge) ); }
void ScoreDisplayLifeTime::Init( const PlayerState* pPlayerState, const PlayerStageStats* pPlayerStageStats ) { ScoreDisplay::Init( pPlayerState, pPlayerStageStats ); const RString sType = "ScoreDisplayLifeTime"; m_sprFrame.Load( THEME->GetPathG(sType,"frame") ); m_sprFrame->SetName( "Frame" ); this->AddChild( m_sprFrame ); ActorUtil::LoadAllCommandsAndOnCommand( m_sprFrame, sType ); m_textTimeRemaining.LoadFromFont( THEME->GetPathF(sType, "TimeRemaining") ); m_textTimeRemaining.SetName( "TimeRemaining" ); this->AddChild( &m_textTimeRemaining ); ActorUtil::LoadAllCommandsAndOnCommand( m_textTimeRemaining, sType ); m_textDeltaSeconds.LoadFromFont( THEME->GetPathF(sType,"DeltaSeconds") ); m_textDeltaSeconds.SetName( "DeltaSeconds" ); this->AddChild( &m_textDeltaSeconds ); ActorUtil::LoadAllCommandsAndOnCommand( m_textDeltaSeconds, sType ); FOREACH_ENUM( TapNoteScore, tns ) { const RString &sCommand = TapNoteScoreToString(tns); if( !m_textDeltaSeconds.HasCommand( sCommand ) ) ActorUtil::LoadCommand( m_textDeltaSeconds, sType, sCommand ); } FOREACH_ENUM( HoldNoteScore, hns ) { const RString &sCommand = HoldNoteScoreToString(hns); if( !m_textDeltaSeconds.HasCommand( sCommand ) ) ActorUtil::LoadCommand( m_textDeltaSeconds, sType, sCommand ); } }
XNode* TapNoteResult::CreateNode() const { XNode *p = new XNode( "TapNoteResult" ); p->AppendAttr( "TapNoteScore", TapNoteScoreToString(tns) ); p->AppendAttr( "TapNoteOffset", fTapNoteOffset ); return p; }
void HighScoreImpl::LoadFromNode( const XNode *pNode ) { ASSERT( pNode->GetName() == "HighScore" ); RString s; pNode->GetChildValue( "Name", sName ); pNode->GetChildValue( "Grade", s ); grade = StringToGrade( s ); pNode->GetChildValue( "Score", iScore ); pNode->GetChildValue( "PercentDP", fPercentDP ); pNode->GetChildValue( "SurviveSeconds", fSurviveSeconds ); pNode->GetChildValue( "MaxCombo", iMaxCombo ); pNode->GetChildValue( "StageAward", s ); stageAward = StringToStageAward(s); pNode->GetChildValue( "PeakComboAward", s ); peakComboAward = StringToPeakComboAward(s); pNode->GetChildValue( "Modifiers", sModifiers ); pNode->GetChildValue( "DateTime", s ); dateTime.FromString( s ); pNode->GetChildValue( "PlayerGuid", sPlayerGuid ); pNode->GetChildValue( "MachineGuid", sMachineGuid ); pNode->GetChildValue( "ProductID", iProductID ); const XNode* pTapNoteScores = pNode->GetChild( "TapNoteScores" ); if( pTapNoteScores ) FOREACH_ENUM( TapNoteScore, tns ) pTapNoteScores->GetChildValue( TapNoteScoreToString(tns), iTapNoteScores[tns] ); const XNode* pHoldNoteScores = pNode->GetChild( "HoldNoteScores" ); if( pHoldNoteScores ) FOREACH_ENUM( HoldNoteScore, hns ) pHoldNoteScores->GetChildValue( HoldNoteScoreToString(hns), iHoldNoteScores[hns] ); const XNode* pRadarValues = pNode->GetChild( "RadarValues" ); if( pRadarValues ) radarValues.LoadFromNode( pRadarValues ); pNode->GetChildValue( "LifeRemainingSeconds", fLifeRemainingSeconds ); pNode->GetChildValue( "Disqualified", bDisqualified); // Validate input. grade = clamp( grade, Grade_Tier01, Grade_Failed ); }