Files
itgmania212121/src/NotesLoaderSM.h
T

164 lines
6.3 KiB
C++
Raw Normal View History

2011-03-17 01:47:30 -04:00
#ifndef NotesLoaderSM_H
#define NotesLoaderSM_H
#include "GameConstantsAndTypes.h"
#include "BackgroundUtil.h"
2011-05-14 17:24:18 -04:00
#include "MsdFile.h" // we require the struct from here.
2011-03-17 01:47:30 -04:00
class Song;
class Steps;
class TimingData;
2011-05-14 18:36:46 -04:00
/**
* @brief The highest allowable speed before Warps come in.
*
* This was brought in from StepMania 4's recent betas. */
const float FAST_BPM_WARP = 9999999.f;
2011-03-17 01:47:30 -04:00
/** @brief Reads a Song from an .SM file. */
2011-06-09 13:46:30 -04:00
struct SMLoader
2011-03-17 01:47:30 -04:00
{
2011-06-09 13:46:30 -04:00
virtual ~SMLoader() {}
2011-03-17 01:47:30 -04:00
bool LoadFromDir( const RString &sPath, Song &out );
2011-06-09 14:45:30 -04:00
/**
* @brief Perform some cleanup on the loaded song.
* @param song a reference to the song that may need cleaning up.
* @param bFromCache a flag to determine if this song is loaded from a cache file.
*/
2011-06-09 14:32:14 -04:00
virtual void TidyUpData( Song &song, bool bFromCache );
2011-03-17 01:47:30 -04:00
bool LoadFromSMFile( const RString &sPath, Song &out, bool bFromCache = false );
void GetApplicableFiles( const RString &sPath, vector<RString> &out );
2011-06-09 14:32:14 -04:00
virtual bool LoadEditFromFile( RString sEditFilePath, ProfileSlot slot, bool bAddStepsToSong );
virtual bool LoadEditFromBuffer( const RString &sBuffer, const RString &sEditFilePath, ProfileSlot slot );
virtual bool LoadEditFromMsd( const MsdFile &msd, const RString &sEditFilePath, ProfileSlot slot, bool bAddStepsToSong );
2011-06-09 13:46:30 -04:00
virtual bool LoadFromBGChangesString(BackgroundChange &change,
const RString &sBGChangeExpression );
2011-06-09 14:19:12 -04:00
/**
* @brief Process the BPM Segments from the string.
* @param out the TimingData being modified.
* @param line the string in question.
* @param rowsPerBeat the number of rows per beat for this purpose.
* @return true if there was at least one segment found, false otherwise. */
bool ProcessBPMs(TimingData & out,
const RString line,
const int rowsPerBeat = -1);
/**
* @brief Process the Stop Segments from the string.
* @param out the TimingData being modified.
* @param line the string in question.
* @param rowsPerBeat the number of rows per beat for this purpose. */
void ProcessStops(TimingData & out,
const RString line,
const int rowsPerBeat = -1);
/**
2011-06-09 14:32:14 -04:00
* @brief Process the Delay Segments from the string.
2011-06-09 14:19:12 -04:00
* @param out the TimingData being modified.
* @param line the string in question.
* @param rowsPerBeat the number of rows per beat for this purpose. */
void ProcessDelays(TimingData & out,
const RString line,
const int rowsPerBeat = -1);
2011-06-09 14:32:14 -04:00
/**
* @brief Process the Time Signature Segments from the string.
* @param out the TimingData being modified.
* @param line the string in question.
* @param rowsPerBeat the number of rows per beat for this purpose. */
void ProcessTimeSignatures(TimingData & out,
const RString line,
const int rowsPerBeat = -1);
/**
* @brief Process the Tickcount Segments from the string.
* @param out the TimingData being modified.
* @param line the string in question.
* @param rowsPerBeat the number of rows per beat for this purpose. */
void ProcessTickcounts(TimingData & out,
const RString line,
const int rowsPerBeat = -1);
2011-06-09 14:45:30 -04:00
/**
* @brief Process the Speed Segments from the string.
* @param out the TimingData being modified.
* @param line the string in question.
* @param rowsPerBeat the number of rows per beat for this purpose. */
virtual void ProcessSpeeds(TimingData & out,
const RString line,
const int rowsPerBeat = -1);
virtual void ProcessCombos(TimingData & out,
const RString line,
const int rowsPerBeat = -1) {}
2011-06-09 14:53:58 -04:00
/**
* @brief Process the Fake Segments from the string.
* @param out the TimingData being modified.
* @param line the string in question.
* @param rowsPerBeat the number of rows per beat for this purpose. */
virtual void ProcessFakes(TimingData & out,
const RString line,
const int rowsPerBeat = -1);
2011-06-09 14:45:30 -04:00
virtual void ProcessBGChanges( Song &out, const RString &sValueName,
const RString &sPath, const RString &sParam );
2011-05-14 17:24:18 -04:00
void ProcessAttacks( Song &out, MsdFile::value_t sParams );
2011-05-14 17:41:08 -04:00
void ProcessInstrumentTracks( Song &out, const RString &sParam );
2011-06-09 14:01:55 -04:00
/**
* @brief Convert a row value to the proper beat value.
*
* This is primarily used for assistance with converting SMA files.
* @param line The line that contains the value.
* @param rowsPerBeat the number of rows per beat according to the original file.
* @return the converted beat value. */
float RowToBeat(RString line, const int rowsPerBeat);
protected:
/**
* @brief Process the different tokens we have available to get NoteData.
* @param stepsType The current StepsType.
* @param description The description of the chart.
* @param difficulty The difficulty (in words) of the chart.
* @param meter the difficulty (in numbers) of the chart.
* @param radarValues the calculated radar values.
* @param noteData the note data itself.
* @param out the Steps getting the data. */
virtual void LoadFromTokens(RString sStepsType,
RString sDescription,
RString sDifficulty,
RString sMeter,
RString sRadarValues,
RString sNoteData,
Steps &out);
2011-06-09 13:46:30 -04:00
};
2011-03-17 01:47:30 -04:00
#endif
/**
* @file
* @author Chris Danford, Glenn Maynard (c) 2001-2004
* @section LICENSE
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/