support Transforms as attacks
This commit is contained in:
@@ -521,6 +521,18 @@ void GameState::LaunchAttack( PlayerNumber target, Attack a )
|
|||||||
{
|
{
|
||||||
LOG->Trace( "Launch attack '%s' against P%d", a.sModifier.c_str(), target+1 );
|
LOG->Trace( "Launch attack '%s' against P%d", a.sModifier.c_str(), target+1 );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Peek at the effect being applied. If it's a transform, add it to
|
||||||
|
// a list of transforms that should be applied by the Player on its
|
||||||
|
// next update.
|
||||||
|
//
|
||||||
|
PlayerOptions po;
|
||||||
|
po.FromString( a.sModifier );
|
||||||
|
if( po.m_Transform != PlayerOptions::TRANSFORM_NONE )
|
||||||
|
{
|
||||||
|
m_TransformsToApply[target].push_back( po.m_Transform );
|
||||||
|
}
|
||||||
|
|
||||||
// search for an open slot
|
// search for an open slot
|
||||||
for( int s=0; s<NUM_INVENTORY_SLOTS; s++ )
|
for( int s=0; s<NUM_INVENTORY_SLOTS; s++ )
|
||||||
if( m_ActiveAttacks[target][s].fSecsRemaining <= 0 )
|
if( m_ActiveAttacks[target][s].fSecsRemaining <= 0 )
|
||||||
|
|||||||
@@ -167,6 +167,7 @@ public:
|
|||||||
void MakeBlank() { sModifier=""; }
|
void MakeBlank() { sModifier=""; }
|
||||||
};
|
};
|
||||||
Attack m_ActiveAttacks[NUM_PLAYERS][NUM_INVENTORY_SLOTS];
|
Attack m_ActiveAttacks[NUM_PLAYERS][NUM_INVENTORY_SLOTS];
|
||||||
|
vector<PlayerOptions::Transform> m_TransformsToApply[NUM_PLAYERS];
|
||||||
|
|
||||||
// used in PLAY_MODE_BATTLE
|
// used in PLAY_MODE_BATTLE
|
||||||
Attack m_Inventory[NUM_PLAYERS][NUM_INVENTORY_SLOTS];
|
Attack m_Inventory[NUM_PLAYERS][NUM_INVENTORY_SLOTS];
|
||||||
|
|||||||
@@ -482,7 +482,7 @@ void NoteDataUtil::SwapSides( NoteData &in )
|
|||||||
in.Convert4sToHoldNotes();
|
in.Convert4sToHoldNotes();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoteDataUtil::Little(NoteData &in)
|
void NoteDataUtil::Little(NoteData &in, float fStartBeat, float fEndBeat)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -498,13 +498,21 @@ void NoteDataUtil::Little(NoteData &in)
|
|||||||
in.RemoveHoldNote( i );
|
in.RemoveHoldNote( i );
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoteDataUtil::Wide( NoteData &in )
|
void NoteDataUtil::Wide( NoteData &in, float fStartBeat, float fEndBeat )
|
||||||
{
|
{
|
||||||
|
// Make all all quarter notes into jumps.
|
||||||
|
|
||||||
in.ConvertHoldNotesTo4s();
|
in.ConvertHoldNotesTo4s();
|
||||||
|
|
||||||
// make all all quarter notes jumps
|
int first_row = 0;
|
||||||
int max_row = in.GetLastRow();
|
if( fStartBeat != -1 )
|
||||||
for( int i=0; i<=max_row; i+=ROWS_PER_BEAT*2 ) // every even beat
|
first_row = BeatToNoteRow(fStartBeat);
|
||||||
|
|
||||||
|
int last_row = in.GetLastRow();
|
||||||
|
if( fEndBeat != -1 )
|
||||||
|
last_row = BeatToNoteRow(fEndBeat);
|
||||||
|
|
||||||
|
for( int i=first_row; i<=last_row; i+=ROWS_PER_BEAT*2 ) // every even beat
|
||||||
{
|
{
|
||||||
if( in.GetNumTapNonEmptyTracks(i) != 1 )
|
if( in.GetNumTapNonEmptyTracks(i) != 1 )
|
||||||
continue; // skip. Don't place during holds
|
continue; // skip. Don't place during holds
|
||||||
@@ -545,32 +553,40 @@ void NoteDataUtil::Wide( NoteData &in )
|
|||||||
in.Convert4sToHoldNotes();
|
in.Convert4sToHoldNotes();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoteDataUtil::Big( NoteData &in )
|
void NoteDataUtil::Big( NoteData &in, float fStartBeat, float fEndBeat )
|
||||||
{
|
{
|
||||||
InsertIntelligentTaps(in,1.0f,0.5f,false); // add 8ths between 4ths
|
InsertIntelligentTaps(in,1.0f,0.5f,false,fStartBeat,fEndBeat); // add 8ths between 4ths
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoteDataUtil::Quick( NoteData &in )
|
void NoteDataUtil::Quick( NoteData &in, float fStartBeat, float fEndBeat )
|
||||||
{
|
{
|
||||||
InsertIntelligentTaps(in,0.5f,0.25f,false); // add 16ths between 8ths
|
InsertIntelligentTaps(in,0.5f,0.25f,false,fStartBeat,fEndBeat); // add 16ths between 8ths
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoteDataUtil::Skippy( NoteData &in )
|
void NoteDataUtil::Skippy( NoteData &in, float fStartBeat, float fEndBeat )
|
||||||
{
|
{
|
||||||
InsertIntelligentTaps(in,1.0f,0.75f,true); // add 16ths between 4ths
|
InsertIntelligentTaps(in,1.0f,0.75f,true,fStartBeat,fEndBeat); // add 16ths between 4ths
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoteDataUtil::InsertIntelligentTaps( NoteData &in, float fBeatInterval, float fInsertBeatOffset, bool bNewTapSameAsBeginning )
|
void NoteDataUtil::InsertIntelligentTaps( NoteData &in, float fBeatInterval, float fInsertBeatOffset, bool bSkippy, float fStartBeat, float fEndBeat )
|
||||||
{
|
{
|
||||||
ASSERT( fInsertBeatOffset <= fBeatInterval );
|
ASSERT( fInsertBeatOffset <= fBeatInterval );
|
||||||
|
|
||||||
in.ConvertHoldNotesTo4s();
|
in.ConvertHoldNotesTo4s();
|
||||||
|
|
||||||
// insert a beat in the middle of every fBeatInterval
|
// Insert a beat in the middle of every fBeatInterval.
|
||||||
int max_row = in.GetLastRow();
|
|
||||||
|
int first_row = 0;
|
||||||
|
if( fStartBeat != -1 )
|
||||||
|
first_row = BeatToNoteRow(fStartBeat);
|
||||||
|
|
||||||
|
int last_row = in.GetLastRow();
|
||||||
|
if( fEndBeat != -1 )
|
||||||
|
last_row = BeatToNoteRow(fEndBeat);
|
||||||
|
|
||||||
int rows_per_interval = BeatToNoteRow( fBeatInterval );
|
int rows_per_interval = BeatToNoteRow( fBeatInterval );
|
||||||
int insert_row_offset = BeatToNoteRow( fInsertBeatOffset );
|
int insert_row_offset = BeatToNoteRow( fInsertBeatOffset );
|
||||||
for( int i=0; i<=max_row; i+=rows_per_interval )
|
for( int i=first_row; i<=last_row; i+=rows_per_interval )
|
||||||
{
|
{
|
||||||
int iRowEarlier = i;
|
int iRowEarlier = i;
|
||||||
int iRowLater = i + rows_per_interval;
|
int iRowLater = i + rows_per_interval;
|
||||||
@@ -596,12 +612,12 @@ void NoteDataUtil::InsertIntelligentTaps( NoteData &in, float fBeatInterval, flo
|
|||||||
int iTrackOfNoteEarlier = in.GetFirstNonEmptyTrack(iRowEarlier);
|
int iTrackOfNoteEarlier = in.GetFirstNonEmptyTrack(iRowEarlier);
|
||||||
int iTrackOfNoteLater = in.GetFirstNonEmptyTrack(iRowLater);
|
int iTrackOfNoteLater = in.GetFirstNonEmptyTrack(iRowLater);
|
||||||
int iTrackOfNoteToAdd = 0;
|
int iTrackOfNoteToAdd = 0;
|
||||||
if( bNewTapSameAsBeginning &&
|
if( bSkippy &&
|
||||||
iTrackOfNoteEarlier != iTrackOfNoteLater ) // Don't make skips on the same note
|
iTrackOfNoteEarlier != iTrackOfNoteLater ) // Don't make skips on the same note
|
||||||
{
|
{
|
||||||
iTrackOfNoteToAdd = iTrackOfNoteEarlier;
|
iTrackOfNoteToAdd = iTrackOfNoteEarlier;
|
||||||
}
|
}
|
||||||
else // bNewTapSameAsBeginning
|
else
|
||||||
{
|
{
|
||||||
// choose a randomish track
|
// choose a randomish track
|
||||||
if( abs(iTrackOfNoteEarlier-iTrackOfNoteLater) == 2 )
|
if( abs(iTrackOfNoteEarlier-iTrackOfNoteLater) == 2 )
|
||||||
@@ -624,6 +640,28 @@ void NoteDataUtil::InsertIntelligentTaps( NoteData &in, float fBeatInterval, flo
|
|||||||
in.Convert4sToHoldNotes();
|
in.Convert4sToHoldNotes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NoteDataUtil::Mines( NoteData &in, float fStartBeat, float fEndBeat )
|
||||||
|
{
|
||||||
|
int iTapCount = 0;
|
||||||
|
|
||||||
|
int first_row = 0;
|
||||||
|
if( fStartBeat != -1 )
|
||||||
|
first_row = BeatToNoteRow(fStartBeat);
|
||||||
|
|
||||||
|
int last_row = in.GetLastRow();
|
||||||
|
if( fEndBeat != -1 )
|
||||||
|
last_row = BeatToNoteRow(fEndBeat);
|
||||||
|
|
||||||
|
for( int r=first_row; r<=last_row; r++ )
|
||||||
|
for( int t=0; t<in.GetNumTracks(); t++ )
|
||||||
|
if( in.GetTapNote(t,r) == TAP_TAP )
|
||||||
|
{
|
||||||
|
iTapCount++;
|
||||||
|
if( (iTapCount%7) == 6 )
|
||||||
|
in.SetTapNote(t,r,TAP_MINE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void NoteDataUtil::SnapToNearestNoteType( NoteData &in, NoteType nt1, NoteType nt2, float fBeginBeat, float fEndBeat )
|
void NoteDataUtil::SnapToNearestNoteType( NoteData &in, NoteType nt1, NoteType nt2, float fBeginBeat, float fEndBeat )
|
||||||
{
|
{
|
||||||
@@ -877,20 +915,6 @@ void NoteDataUtil::ConvertAdditionsToRegular( NoteData &in )
|
|||||||
in.SetTapNote(t,r,TAP_TAP);
|
in.SetTapNote(t,r,TAP_TAP);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoteDataUtil::Mines( NoteData &in )
|
|
||||||
{
|
|
||||||
int iTapCount = 0;
|
|
||||||
|
|
||||||
for( int r=0; r<=in.GetLastRow(); r++ )
|
|
||||||
for( int t=0; t<in.GetNumTracks(); t++ )
|
|
||||||
if( in.GetTapNote(t,r) == TAP_TAP )
|
|
||||||
{
|
|
||||||
iTapCount++;
|
|
||||||
if( (iTapCount%7) == 6 )
|
|
||||||
in.SetTapNote(t,r,TAP_MINE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void NoteDataUtil::TransformNoteData( NoteData &nd, PlayerOptions &po, StepsType st )
|
void NoteDataUtil::TransformNoteData( NoteData &nd, PlayerOptions &po, StepsType st )
|
||||||
{
|
{
|
||||||
if( !po.m_bHoldNotes )
|
if( !po.m_bHoldNotes )
|
||||||
|
|||||||
@@ -42,13 +42,13 @@ namespace NoteDataUtil
|
|||||||
void RemoveHoldNotes( NoteData &in );
|
void RemoveHoldNotes( NoteData &in );
|
||||||
enum TurnType { left, right, mirror, shuffle, super_shuffle, NUM_TURN_TYPES };
|
enum TurnType { left, right, mirror, shuffle, super_shuffle, NUM_TURN_TYPES };
|
||||||
void Turn( NoteData &in, StepsType st, TurnType tt );
|
void Turn( NoteData &in, StepsType st, TurnType tt );
|
||||||
void Little( NoteData &in );
|
void Little( NoteData &in, float fStartBeat = -1, float fEndBeat = -1 );
|
||||||
void Wide( NoteData &in );
|
void Wide( NoteData &in, float fStartBeat = -1, float fEndBeat = -1 );
|
||||||
void Big( NoteData &in );
|
void Big( NoteData &in, float fStartBeat = -1, float fEndBeat = -1 );
|
||||||
void Quick( NoteData &in );
|
void Quick( NoteData &in, float fStartBeat = -1, float fEndBeat = -1 );
|
||||||
void Skippy( NoteData &in );
|
void Skippy( NoteData &in, float fStartBeat = -1, float fEndBeat = -1 );
|
||||||
void Mines( NoteData &in );
|
void Mines( NoteData &in, float fStartBeat = -1, float fEndBeat = -1 );
|
||||||
void InsertIntelligentTaps( NoteData &in, float fBeatInterval, float fInsertBeatOffset, bool bNewTapSameAsBeginning );
|
void InsertIntelligentTaps( NoteData &in, float fBeatInterval, float fInsertBeatOffset, bool bSkippy, float fStartBeat = -1, float fEndBeat = -1 );
|
||||||
void SuperShuffleTaps( NoteData &in );
|
void SuperShuffleTaps( NoteData &in );
|
||||||
|
|
||||||
// change all TAP_ADDITIONs to TAP_TAPs
|
// change all TAP_ADDITIONs to TAP_TAPs
|
||||||
|
|||||||
@@ -316,6 +316,52 @@ void Player::Update( float fDeltaTime )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// process transforms that are waiting to be applied
|
||||||
|
for( i=0; i<GAMESTATE->m_TransformsToApply[m_PlayerNumber].size(); i++ )
|
||||||
|
{
|
||||||
|
// Start beat needs to be far enough ahead to be off screen so that
|
||||||
|
// addition arrows don't suddenly pop on.
|
||||||
|
float fStartBeat = GAMESTATE->m_fSongBeat + BEATS_PER_MEASURE*2;
|
||||||
|
fStartBeat = ((int)fStartBeat)+1;
|
||||||
|
float fStartSeconds = GAMESTATE->m_pCurSong->GetElapsedTimeFromBeat( fStartBeat );
|
||||||
|
float fEndSeconds = fStartSeconds+10;
|
||||||
|
float fEndBeat = GAMESTATE->m_pCurSong->GetBeatFromElapsedTime( fEndSeconds );
|
||||||
|
fEndBeat = ((int)fEndBeat)+1;
|
||||||
|
|
||||||
|
switch( GAMESTATE->m_TransformsToApply[m_PlayerNumber][i] )
|
||||||
|
{
|
||||||
|
case PlayerOptions::TRANSFORM_LITTLE:
|
||||||
|
NoteDataUtil::Little( *this, fStartBeat, fEndBeat );
|
||||||
|
NoteDataUtil::Little( m_NoteField, fStartBeat, fEndBeat );
|
||||||
|
break;
|
||||||
|
case PlayerOptions::TRANSFORM_WIDE:
|
||||||
|
NoteDataUtil::Wide( *this, fStartBeat, fEndBeat );
|
||||||
|
NoteDataUtil::Wide( m_NoteField, fStartBeat, fEndBeat );
|
||||||
|
break;
|
||||||
|
case PlayerOptions::TRANSFORM_BIG:
|
||||||
|
NoteDataUtil::Big( *this, fStartBeat, fEndBeat );
|
||||||
|
NoteDataUtil::Big( m_NoteField, fStartBeat, fEndBeat );
|
||||||
|
break;
|
||||||
|
case PlayerOptions::TRANSFORM_QUICK:
|
||||||
|
NoteDataUtil::Quick( *this, fStartBeat, fEndBeat );
|
||||||
|
NoteDataUtil::Quick( m_NoteField, fStartBeat, fEndBeat );
|
||||||
|
break;
|
||||||
|
case PlayerOptions::TRANSFORM_SKIPPY:
|
||||||
|
NoteDataUtil::Skippy( *this, fStartBeat, fEndBeat );
|
||||||
|
NoteDataUtil::Skippy( m_NoteField, fStartBeat, fEndBeat );
|
||||||
|
break;
|
||||||
|
case PlayerOptions::TRANSFORM_MINES:
|
||||||
|
NoteDataUtil::Mines( *this, fStartBeat, fEndBeat );
|
||||||
|
NoteDataUtil::Mines( m_NoteField, fStartBeat, fEndBeat );
|
||||||
|
break;
|
||||||
|
case PlayerOptions::TRANSFORM_NONE:
|
||||||
|
default:
|
||||||
|
ASSERT(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
GAMESTATE->m_TransformsToApply[m_PlayerNumber].clear();
|
||||||
|
|
||||||
|
|
||||||
ActorFrame::Update( fDeltaTime );
|
ActorFrame::Update( fDeltaTime );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -179,6 +179,10 @@ XBCP=xbecopy.exe
|
|||||||
# ADD BASE XBCP /NOLOGO
|
# ADD BASE XBCP /NOLOGO
|
||||||
# ADD XBCP /NOLOGO
|
# ADD XBCP /NOLOGO
|
||||||
# Begin Special Build Tool
|
# Begin Special Build Tool
|
||||||
|
IntDir=.\StepMania___Xbox_Release
|
||||||
|
TargetDir=\stepmania\stepmania
|
||||||
|
TargetName=default
|
||||||
|
SOURCE="$(InputPath)"
|
||||||
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
||||||
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi
|
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi
|
||||||
# End Special Build Tool
|
# End Special Build Tool
|
||||||
|
|||||||
Reference in New Issue
Block a user