Files
itgmania212121/stepmania/src/ScoreKeeperRave.cpp
T

111 lines
3.4 KiB
C++
Raw Normal View History

2003-06-30 18:08:27 +00:00
#include "global.h"
/*
-----------------------------------------------------------------------------
Class: ScoreKeeperRave
Desc: See header.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
#include "ScoreKeeperRave.h"
#include "ThemeManager.h"
#include "RageUtil.h"
#include "GameState.h"
#include "Character.h"
2003-07-28 07:56:25 +00:00
#include "ScreenManager.h"
2003-06-30 18:08:27 +00:00
CachedThemeMetricF ATTACK_DURATION_SECONDS ("ScoreKeeperRave","AttackDurationSeconds");
const PlayerNumber OPPOSITE_PLAYER[NUM_PLAYERS] = { PLAYER_2, PLAYER_1 };
ScoreKeeperRave::ScoreKeeperRave(PlayerNumber pn) : ScoreKeeper(pn)
{
ATTACK_DURATION_SECONDS.Refresh();
m_soundLaunchAttack.Load( THEME->GetPathToS(ssprintf("ScoreKeeperRave launch attack p%d",pn+1)) );
m_soundAttackEnding.Load( THEME->GetPathToS(ssprintf("ScoreKeeperRave attack end p%d",pn+1)) );
}
2003-08-03 00:13:55 +00:00
void ScoreKeeperRave::OnNextSong( int iSongInCourseIndex, Steps* pNotes, NoteData* pNoteData )
2003-06-30 18:08:27 +00:00
{
}
#define CROSSED( val ) (fOld < val && fNew >= val)
#define CROSSED_ATTACK_LEVEL( level ) CROSSED(1.f/NUM_ATTACK_LEVELS*(level+1))
2003-08-10 08:56:50 +00:00
void ScoreKeeperRave::HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTapsInRow, int iNumAdditions )
2003-06-30 18:08:27 +00:00
{
AttackLevel oldAL = (AttackLevel)(int)GAMESTATE->m_fSuperMeter[m_PlayerNumber];
float fPercentToMove;
switch( scoreOfLastTap )
{
case TNS_MARVELOUS: fPercentToMove = +0.04f; break;
case TNS_PERFECT: fPercentToMove = +0.04f; break;
case TNS_GREAT: fPercentToMove = +0.02f; break;
2003-06-30 18:08:27 +00:00
case TNS_GOOD: fPercentToMove = +0.00f; break;
case TNS_BOO: fPercentToMove = -0.08f; break;
case TNS_MISS: fPercentToMove = -0.16f; break;
2003-06-30 18:08:27 +00:00
default: ASSERT(0); fPercentToMove = +0.00f; break;
}
GAMESTATE->m_fSuperMeter[m_PlayerNumber] += fPercentToMove * GAMESTATE->m_fSuperMeterGrowthScale[m_PlayerNumber];
CLAMP( GAMESTATE->m_fSuperMeter[m_PlayerNumber], 0.f, NUM_ATTACK_LEVELS );
AttackLevel newAL = (AttackLevel)(int)GAMESTATE->m_fSuperMeter[m_PlayerNumber];
if( newAL > oldAL )
{
if( newAL == NUM_ATTACK_LEVELS ) // hit upper bounds of meter
GAMESTATE->m_fSuperMeter[m_PlayerNumber] -= 1.f;
LaunchAttack( oldAL );
2003-06-30 18:08:27 +00:00
}
}
2003-07-08 20:56:25 +00:00
void ScoreKeeperRave::HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore )
2003-06-30 18:08:27 +00:00
{
}
void ScoreKeeperRave::Update( float fDelta )
{
if( GAMESTATE->m_bActiveAttackEndedThisUpdate[m_PlayerNumber] )
m_soundAttackEnding.Play();
}
void ScoreKeeperRave::LaunchAttack( AttackLevel al )
{
CString* asAttacks = GAMESTATE->m_pCurCharacters[m_PlayerNumber]->m_sAttacks[al]; // [NUM_ATTACKS_PER_LEVEL]
2003-08-31 02:26:07 +00:00
CString sAttackToGive;
if (GAMESTATE->m_pCurCharacters[m_PlayerNumber] != NULL)
sAttackToGive = asAttacks[ rand()%NUM_ATTACKS_PER_LEVEL ];
else
{
/* If you add any note skins here, you need to make sure they're cached, too. */
2003-08-31 02:26:07 +00:00
CString DefaultAttacks[8] = { "1.5x", "2.0x", "0.5x", "reverse", "sudden", "boost", "brake", "wave" };
sAttackToGive = DefaultAttacks[ rand()%8 ];
}
2003-06-30 18:08:27 +00:00
PlayerNumber pnToAttack = OPPOSITE_PLAYER[m_PlayerNumber];
GameState::Attack a;
a.level = al;
a.fSecsRemaining = ATTACK_DURATION_SECONDS;
a.sModifier = sAttackToGive;
2003-07-28 07:56:25 +00:00
// remove current attack (if any)
GAMESTATE->RemoveActiveAttacksForPlayer( pnToAttack );
// apply new attack
2003-06-30 18:08:27 +00:00
GAMESTATE->LaunchAttack( pnToAttack, a );
2003-07-28 07:56:25 +00:00
SCREENMAN->SystemMessage( ssprintf( "attacking %d with %s", pnToAttack, sAttackToGive.c_str() ) );
2003-06-30 18:08:27 +00:00
m_soundLaunchAttack.Play();
}