working on battle
This commit is contained in:
@@ -242,6 +242,7 @@ const Attack& NoteData::GetAttackAt( int track, int row )
|
||||
{
|
||||
TapNote tn = GetTapNote(track, row);
|
||||
ASSERT( IsTapAttack(tn) );
|
||||
ASSERT( m_AttackMap.find(tn) != m_AttackMap.end() );
|
||||
return m_AttackMap[tn];
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "RageUtil.h"
|
||||
#include "RageLog.h"
|
||||
#include "PlayerOptions.h"
|
||||
#include "Song.h"
|
||||
|
||||
NoteType NoteDataUtil::GetSmallestNoteTypeForMeasure( const NoteData &n, int iMeasureIndex )
|
||||
{
|
||||
@@ -1236,6 +1237,31 @@ void NoteDataUtil::TransformNoteData( NoteData &nd, const PlayerOptions &po, Ste
|
||||
if( po.m_bTransforms[PlayerOptions::TRANSFORM_TWISTER] ) NoteDataUtil::Twister(nd, fStartBeat, fEndBeat);
|
||||
}
|
||||
|
||||
void NoteDataUtil::AddTapAttacks( NoteData &nd, Song* pSong )
|
||||
{
|
||||
// throw an attack in every 30 seconds
|
||||
|
||||
const char* szAttacks[3] =
|
||||
{
|
||||
"2x",
|
||||
"drunk",
|
||||
"dizzy",
|
||||
};
|
||||
|
||||
for( float sec=15; sec<pSong->m_fMusicLengthSeconds; sec+=30 )
|
||||
{
|
||||
float fBeat = pSong->GetBeatFromElapsedTime( sec );
|
||||
int iBeat = (int)fBeat;
|
||||
int iTrack = iBeat % nd.GetNumTracks(); // deterministically calculates track
|
||||
Attack attack;
|
||||
attack.fStartSecond = -1;
|
||||
attack.fSecsRemaining = 15;
|
||||
attack.sModifier = szAttacks[rand()%ARRAYSIZE(szAttacks)];
|
||||
attack.level = ATTACK_LEVEL_1;
|
||||
nd.SetTapAttackNote( iTrack, BeatToNoteRow(iBeat), attack );
|
||||
}
|
||||
}
|
||||
|
||||
void NoteDataUtil::Scale( NoteData &nd, float fScale )
|
||||
{
|
||||
ASSERT( fScale > 0 );
|
||||
|
||||
@@ -80,6 +80,7 @@ namespace NoteDataUtil
|
||||
bool RowPassesValidMask( NoteData &in, int row, const bool bValidMask[] );
|
||||
|
||||
void TransformNoteData( NoteData &nd, const PlayerOptions &po, StepsType st, float fStartBeat = 0, float fEndBeat = 99999 );
|
||||
void AddTapAttacks( NoteData &nd, Song* pSong );
|
||||
|
||||
void Scale( NoteData &nd, float fScale );
|
||||
|
||||
|
||||
@@ -137,6 +137,38 @@ void PlayerMinus::Load( PlayerNumber pn, const NoteData* pNoteData, LifeMeter* p
|
||||
|
||||
/* Apply transforms. */
|
||||
NoteDataUtil::TransformNoteData( *this, GAMESTATE->m_PlayerOptions[pn], GAMESTATE->GetCurrentStyleDef()->m_StepsType );
|
||||
|
||||
switch( GAMESTATE->m_PlayMode )
|
||||
{
|
||||
case PLAY_MODE_BATTLE:
|
||||
{
|
||||
// ugly, ugly, ugly. Works only w/ dance.
|
||||
NoteDataUtil::TransformNoteData( *this, GAMESTATE->m_PlayerOptions[pn], GAMESTATE->GetCurrentStyleDef()->m_StepsType );
|
||||
|
||||
// shuffle either p1 or p2
|
||||
static int count = 0;
|
||||
switch( count )
|
||||
{
|
||||
case 0:
|
||||
case 3:
|
||||
// do shuffle
|
||||
NoteDataUtil::Turn( *this, STEPS_TYPE_DANCE_SINGLE, NoteDataUtil::mirror);
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
// don't shuffle
|
||||
break;
|
||||
default:
|
||||
ASSERT(0);
|
||||
}
|
||||
count++;
|
||||
count %= 4;
|
||||
|
||||
// HACK: Autogen in attacks for battle
|
||||
NoteDataUtil::AddTapAttacks( *this, GAMESTATE->m_pCurSong );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
int iStartDrawingAtPixels = GAMESTATE->m_bEditing ? -100 : START_DRAWING_AT_PIXELS;
|
||||
int iStopDrawingAtPixels = GAMESTATE->m_bEditing ? 400 : STOP_DRAWING_AT_PIXELS;
|
||||
@@ -176,8 +208,9 @@ void PlayerMinus::Load( PlayerNumber pn, const NoteData* pNoteData, LifeMeter* p
|
||||
// Need to set Y positions of all these elements in Update since
|
||||
// they change depending on PlayerOptions.
|
||||
|
||||
m_soundMine.Load( THEME->GetPathToS(ssprintf("Player mine p%d",pn+1)) );
|
||||
m_soundAttack.Load( THEME->GetPathToS(ssprintf("Player attack p%d",pn+1)) );
|
||||
m_soundMine.Load( THEME->GetPathToS(ssprintf("Player mine p%d",pn+1)), true );
|
||||
m_soundAttackLaunch.Load( THEME->GetPathToS(ssprintf("Player attack launch p%d",pn+1)), true );
|
||||
m_soundAttackEnding.Load( THEME->GetPathToS(ssprintf("Player attack ending p%d",pn+1)), true );
|
||||
}
|
||||
|
||||
void PlayerMinus::Update( float fDeltaTime )
|
||||
@@ -187,6 +220,10 @@ void PlayerMinus::Update( float fDeltaTime )
|
||||
if( GAMESTATE->m_pCurSong==NULL )
|
||||
return;
|
||||
|
||||
if( GAMESTATE->m_bActiveAttackEndedThisUpdate[m_PlayerNumber] )
|
||||
m_soundAttackEnding.Play();
|
||||
|
||||
|
||||
const float fSongBeat = GAMESTATE->m_fSongBeat;
|
||||
|
||||
m_pNoteField->Update( fDeltaTime );
|
||||
@@ -591,7 +628,7 @@ void PlayerMinus::Step( int col, RageTimer tm )
|
||||
score = TNS_NONE; // don't score this as anything
|
||||
if( fScaledSecondsFromPerfect <= PREFSMAN->m_fJudgeWindowAttackSeconds )
|
||||
{
|
||||
m_soundAttack.Play();
|
||||
m_soundAttackLaunch.Play();
|
||||
// put attack in effect
|
||||
Attack attack = this->GetAttackAt( col, iIndexOverlappingNote );
|
||||
GAMESTATE->LaunchAttack( OPPOSITE_PLAYER[m_PlayerNumber], attack );
|
||||
@@ -681,7 +718,7 @@ void PlayerMinus::Step( int col, RageTimer tm )
|
||||
}
|
||||
if( IsTapAttack(tn) && score > TNS_GOOD )
|
||||
{
|
||||
m_soundAttack.Play();
|
||||
m_soundAttackLaunch.Play();
|
||||
score = TNS_NONE; // don't score this as anything
|
||||
|
||||
// put attack in effect
|
||||
@@ -716,7 +753,7 @@ void PlayerMinus::Step( int col, RageTimer tm )
|
||||
|
||||
if( IsTapAttack(tn) )
|
||||
{
|
||||
m_soundAttack.Play();
|
||||
m_soundAttackLaunch.Play();
|
||||
score = TNS_NONE; // don't score this as anything
|
||||
|
||||
// put attack in effect
|
||||
|
||||
@@ -93,7 +93,8 @@ protected:
|
||||
int m_iRowLastCrossed;
|
||||
|
||||
RageSound m_soundMine;
|
||||
RageSound m_soundAttack;
|
||||
RageSound m_soundAttackLaunch;
|
||||
RageSound m_soundAttackEnding;
|
||||
};
|
||||
|
||||
class Player : public PlayerMinus
|
||||
|
||||
@@ -530,14 +530,14 @@ ScreenGameplay::ScreenGameplay( CString sName, bool bDemonstration ) : Screen("S
|
||||
ZERO( m_pInventory );
|
||||
for( p=0; p<NUM_PLAYERS; p++ )
|
||||
{
|
||||
switch( GAMESTATE->m_PlayMode )
|
||||
{
|
||||
case PLAY_MODE_BATTLE:
|
||||
m_pInventory[p] = new Inventory;
|
||||
m_pInventory[p]->Load( (PlayerNumber)p );
|
||||
this->AddChild( m_pInventory[p] );
|
||||
break;
|
||||
}
|
||||
// switch( GAMESTATE->m_PlayMode )
|
||||
// {
|
||||
// case PLAY_MODE_BATTLE:
|
||||
// m_pInventory[p] = new Inventory;
|
||||
// m_pInventory[p]->Load( (PlayerNumber)p );
|
||||
// this->AddChild( m_pInventory[p] );
|
||||
// break;
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@@ -644,9 +644,9 @@ ScreenGameplay::ScreenGameplay( CString sName, bool bDemonstration ) : Screen("S
|
||||
m_announcerBattleTrickLevel1.Load( ANNOUNCER->GetPathTo("gameplay battle trick level1") );
|
||||
m_announcerBattleTrickLevel2.Load( ANNOUNCER->GetPathTo("gameplay battle trick level2") );
|
||||
m_announcerBattleTrickLevel3.Load( ANNOUNCER->GetPathTo("gameplay battle trick level3") );
|
||||
m_soundBattleTrickLevel1.Load( THEME->GetPathToS("ScreenGameplay battle trick level1") );
|
||||
m_soundBattleTrickLevel2.Load( THEME->GetPathToS("ScreenGameplay battle trick level2") );
|
||||
m_soundBattleTrickLevel3.Load( THEME->GetPathToS("ScreenGameplay battle trick level3") );
|
||||
m_soundBattleTrickLevel1.Load( THEME->GetPathToS("ScreenGameplay battle trick level1"), true );
|
||||
m_soundBattleTrickLevel2.Load( THEME->GetPathToS("ScreenGameplay battle trick level2"), true );
|
||||
m_soundBattleTrickLevel3.Load( THEME->GetPathToS("ScreenGameplay battle trick level3"), true );
|
||||
m_announcerBattleDamageLevel1.Load( ANNOUNCER->GetPathTo("gameplay battle damage level1") );
|
||||
m_announcerBattleDamageLevel2.Load( ANNOUNCER->GetPathTo("gameplay battle damage level2") );
|
||||
m_announcerBattleDamageLevel3.Load( ANNOUNCER->GetPathTo("gameplay battle damage level3") );
|
||||
@@ -1504,24 +1504,24 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ
|
||||
{
|
||||
m_Player[StyleI.player].Step( StyleI.col, DeviceI.ts );
|
||||
}
|
||||
else if( type==IET_FIRST_PRESS &&
|
||||
!PREFSMAN->m_bAutoPlay &&
|
||||
MenuI.IsValid() &&
|
||||
GAMESTATE->IsPlayerEnabled( MenuI.player ) &&
|
||||
GAMESTATE->IsBattleMode() )
|
||||
{
|
||||
int iItemSlot;
|
||||
switch( MenuI.button )
|
||||
{
|
||||
case MENU_BUTTON_LEFT: iItemSlot = 0; break;
|
||||
case MENU_BUTTON_START: iItemSlot = 1; break;
|
||||
case MENU_BUTTON_RIGHT: iItemSlot = 2; break;
|
||||
default: iItemSlot = -1; break;
|
||||
}
|
||||
|
||||
if( iItemSlot != -1 )
|
||||
m_pInventory[MenuI.player]->UseItem( iItemSlot );
|
||||
}
|
||||
// else if( type==IET_FIRST_PRESS &&
|
||||
// !PREFSMAN->m_bAutoPlay &&
|
||||
// MenuI.IsValifd() &&
|
||||
// GAMESTATE->IsPlayerEnabled( MenuI.player ) &&
|
||||
// GAMESTATE->IsBattleMode() )
|
||||
// {
|
||||
// int iItemSlot;
|
||||
// switch( MenuI.button )
|
||||
// {
|
||||
// case MENU_BUTTON_LEFT: iItemSlot = 0; break;
|
||||
// case MENU_BUTTON_START: iItemSlot = 1; break;
|
||||
// case MENU_BUTTON_RIGHT: iItemSlot = 2; break;
|
||||
// default: iItemSlot = -1; break;
|
||||
// }
|
||||
//
|
||||
// if( iItemSlot != -1 )
|
||||
// m_pInventory[MenuI.player]->UseItem( iItemSlot );
|
||||
// }
|
||||
}
|
||||
|
||||
void ScreenGameplay::UpdateAutoPlayText()
|
||||
@@ -1878,7 +1878,7 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
|
||||
m_announcerBattleTrickLevel1.PlayRandom();
|
||||
m_fTimeLeftBeforeDancingComment = SECONDS_BETWEEN_COMMENTS;
|
||||
}
|
||||
m_soundBattleTrickLevel1.PlayRandom();
|
||||
m_soundBattleTrickLevel1.Play();
|
||||
break;
|
||||
case SM_BattleTrickLevel2:
|
||||
if( SECS_SINCE_LAST_COMMENT > 3 )
|
||||
@@ -1886,7 +1886,7 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
|
||||
m_announcerBattleTrickLevel2.PlayRandom();
|
||||
m_fTimeLeftBeforeDancingComment = SECONDS_BETWEEN_COMMENTS;
|
||||
}
|
||||
m_soundBattleTrickLevel2.PlayRandom();
|
||||
m_soundBattleTrickLevel2.Play();
|
||||
break;
|
||||
case SM_BattleTrickLevel3:
|
||||
if( SECS_SINCE_LAST_COMMENT > 3 )
|
||||
@@ -1894,7 +1894,7 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
|
||||
m_announcerBattleTrickLevel3.PlayRandom();
|
||||
m_fTimeLeftBeforeDancingComment = SECONDS_BETWEEN_COMMENTS;
|
||||
}
|
||||
m_soundBattleTrickLevel3.PlayRandom();
|
||||
m_soundBattleTrickLevel3.Play();
|
||||
break;
|
||||
|
||||
case SM_BattleDamageLevel1:
|
||||
|
||||
@@ -181,9 +181,9 @@ protected:
|
||||
RandomSample m_announcerBattleTrickLevel1;
|
||||
RandomSample m_announcerBattleTrickLevel2;
|
||||
RandomSample m_announcerBattleTrickLevel3;
|
||||
RandomSample m_soundBattleTrickLevel1;
|
||||
RandomSample m_soundBattleTrickLevel2;
|
||||
RandomSample m_soundBattleTrickLevel3;
|
||||
RageSound m_soundBattleTrickLevel1;
|
||||
RageSound m_soundBattleTrickLevel2;
|
||||
RageSound m_soundBattleTrickLevel3;
|
||||
RandomSample m_announcerBattleDamageLevel1;
|
||||
RandomSample m_announcerBattleDamageLevel2;
|
||||
RandomSample m_announcerBattleDamageLevel3;
|
||||
|
||||
Reference in New Issue
Block a user