fix demonstration doing badly when modifiers are active

This commit is contained in:
Glenn Maynard
2005-01-28 18:40:20 +00:00
parent 1823bbcbcc
commit 3d0a566093
+16 -9
View File
@@ -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 && iCpuSkill<NUM_SKILL_LEVELS, ssprintf("%i", iCpuSkill) );
ASSERT_M( pPlayerState->m_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 && iCpuSkill<NUM_SKILL_LEVELS, ssprintf("%i", iCpuSkill) );
ASSERT_M( pPlayerState->m_PlayerController == PC_CPU, ssprintf("%i", pPlayerState->m_PlayerController) );
iCpuSkill -= iSumOfAttackLevels*3;
CLAMP( iCpuSkill, 0, NUM_SKILL_LEVELS-1 );
}
TapScoreDistribution& distribution = g_Distributions[iCpuSkill];