#pragma once /* ----------------------------------------------------------------------------- File: NoteData.h Desc: Holds data about the notes that the player is supposed to hit. NoteData is organized by: track - corresponds to different columns of notes on the screen index - corresponds to subdivisions of beats Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ #include "GameConstantsAndTypes.h" // '1' = tap note // '2' = hold note begin // '3' = hold note end ('1' can also end a HoldNote) ('3' without a matching '2' is ignored // ... for future expansion struct HoldNote { int m_iTrack; int m_iStartIndex; int m_iEndIndex; }; inline int BeatToNoteRow( float fBeatNum ) { return int( fBeatNum * ELEMENTS_PER_BEAT + 0.5f); }; // round inline int BeatToNoteRowNotRounded( float fBeatNum ) { return (int)( fBeatNum * ELEMENTS_PER_BEAT ); }; inline float NoteRowToBeat( float fNoteIndex ) { return fNoteIndex / (float)ELEMENTS_PER_BEAT; }; inline float NoteRowToBeat( int iNoteIndex ) { return NoteRowToBeat( (float)iNoteIndex ); }; class NoteData { public: NoteData(); void Init(); ~NoteData(); // used for loading void SetFromMeasureStrings( CStringArray &arrayMeasureStrings ); // for loading from a .notes file void SetFromDWIInfo(); // for loading from a .dwi file void SetFromBMSInfo(); // for loading from a .bms file void ReadFromCacheFile( FILE* file ); static void SkipOverDataInCacheFile( FILE* file ); // used for saving void GetMeasureStrings( CStringArray &arrayMeasureStrings ); // for saving to a .notes file void WriteToCacheFile( FILE* file ); int m_iNumTracks; TapNote m_TapNotes[MAX_NOTE_TRACKS][MAX_TAP_NOTE_ROWS]; HoldNote m_HoldNotes[MAX_HOLD_NOTE_ELEMENTS]; int m_iNumHoldNotes; void ClearRange( int iNoteIndexBegin, int iNoteIndexEnd ); void ClearAll() { ClearRange( 0, MAX_TAP_NOTE_ROWS ); }; void CopyRange( NoteData* pFrom, int iFromIndexBegin, int iFromIndexEnd, int iToIndexBegin = -1 ); void CopyAll( NoteData* pFrom ) { m_iNumTracks = pFrom->m_iNumTracks; m_iNumHoldNotes = 0; CopyRange( pFrom, 0, MAX_TAP_NOTE_ROWS ); }; inline bool IsRowEmpty( int index ) { for( int t=0; t