From 3d0a566093887ff97d6776c5bca7006bc4c80045 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 28 Jan 2005 18:40:20 +0000 Subject: [PATCH] fix demonstration doing badly when modifiers are active --- stepmania/src/PlayerAI.cpp | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/stepmania/src/PlayerAI.cpp b/stepmania/src/PlayerAI.cpp index d180f749ee..4034b4e370 100644 --- a/stepmania/src/PlayerAI.cpp +++ b/stepmania/src/PlayerAI.cpp @@ -29,7 +29,7 @@ struct TapScoreDistribution }; -TapScoreDistribution g_Distributions[NUM_SKILL_LEVELS]; +static TapScoreDistribution g_Distributions[NUM_SKILL_LEVELS]; void PlayerAI::InitFromDisk() @@ -65,16 +65,23 @@ void PlayerAI::InitFromDisk() TapNoteScore PlayerAI::GetTapNoteScore( const PlayerState* pPlayerState ) { int iCpuSkill = pPlayerState->m_iCpuSkill; - int iSumOfAttackLevels = - pPlayerState->m_fSecondsUntilAttacksPhasedOut > 0 ? - pPlayerState->m_iLastPositiveSumOfAttackLevels : - 0; - ASSERT_M( iCpuSkill>=0 && iCpuSkillm_PlayerController == PC_CPU, ssprintf("%i", pPlayerState->m_PlayerController) ); + /* If we're in battle mode, reduce the skill based on the number of modifier attacks + * against us. If we're in demonstration or jukebox mode with modifiers attached, + * don't make demonstration miss a lot. */ + if( !GAMESTATE->m_bDemonstrationOrJukebox ) + { + int iSumOfAttackLevels = + pPlayerState->m_fSecondsUntilAttacksPhasedOut > 0 ? + pPlayerState->m_iLastPositiveSumOfAttackLevels : + 0; - iCpuSkill -= iSumOfAttackLevels*3; - CLAMP( iCpuSkill, 0, NUM_SKILL_LEVELS-1 ); + ASSERT_M( iCpuSkill>=0 && iCpuSkillm_PlayerController == PC_CPU, ssprintf("%i", pPlayerState->m_PlayerController) ); + + iCpuSkill -= iSumOfAttackLevels*3; + CLAMP( iCpuSkill, 0, NUM_SKILL_LEVELS-1 ); + } TapScoreDistribution& distribution = g_Distributions[iCpuSkill];