2004-05-31 21:35:31 +00:00
|
|
|
/* Steps - Holds note information for a Song. A Song may have one or more Notes. */
|
|
|
|
|
|
2003-08-03 00:57:20 +00:00
|
|
|
#ifndef STEPS_H
|
|
|
|
|
#define STEPS_H
|
2002-05-20 08:59:37 +00:00
|
|
|
|
|
|
|
|
#include "GameConstantsAndTypes.h"
|
2003-02-26 00:20:00 +00:00
|
|
|
#include "PlayerNumber.h"
|
2002-05-20 08:59:37 +00:00
|
|
|
#include "Grade.h"
|
2004-07-11 07:21:33 +00:00
|
|
|
#include "RadarValues.h"
|
2005-01-22 19:36:39 +00:00
|
|
|
#include "Difficulty.h"
|
2005-07-03 03:05:54 +00:00
|
|
|
#include "RageUtil_AutoPtr.h"
|
2004-02-10 09:42:01 +00:00
|
|
|
class Profile;
|
2005-07-01 04:39:59 +00:00
|
|
|
class NoteData;
|
2005-02-22 23:06:51 +00:00
|
|
|
struct lua_State;
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2005-07-29 02:23:02 +00:00
|
|
|
const int MAX_EDIT_STEPS_DESCRIPTION_LENGTH = 12;
|
2005-03-07 05:23:18 +00:00
|
|
|
|
2003-08-03 00:57:20 +00:00
|
|
|
class Steps
|
2002-05-20 08:59:37 +00:00
|
|
|
{
|
|
|
|
|
public:
|
2003-08-03 00:57:20 +00:00
|
|
|
Steps();
|
|
|
|
|
~Steps();
|
2002-05-20 08:59:37 +00:00
|
|
|
|
2003-02-22 01:58:56 +00:00
|
|
|
// initializers
|
2003-12-29 22:50:54 +00:00
|
|
|
void AutogenFrom( const Steps *parent, StepsType ntTo );
|
2005-04-03 21:43:29 +00:00
|
|
|
void CopyFrom( Steps* pSource, StepsType ntTo, float fMusicLengthSeconds );
|
2003-08-07 06:16:17 +00:00
|
|
|
void CreateBlank( StepsType ntTo );
|
2002-12-14 21:43:00 +00:00
|
|
|
|
|
|
|
|
void Compress() const;
|
2003-02-22 01:58:56 +00:00
|
|
|
void Decompress() const;
|
2003-08-03 00:57:20 +00:00
|
|
|
void DeAutogen(); /* If this Steps is autogenerated, make it a real Steps. */
|
2002-12-14 21:43:00 +00:00
|
|
|
|
2004-02-08 01:05:53 +00:00
|
|
|
// Use a special value of difficulty
|
|
|
|
|
bool IsAnEdit() const { return m_Difficulty == DIFFICULTY_EDIT; }
|
2005-12-01 03:20:25 +00:00
|
|
|
bool IsAPlayerEdit() const { return m_Difficulty == DIFFICULTY_EDIT && GetLoadedFromProfileSlot() < ProfileSlot_Machine; }
|
|
|
|
|
bool WasLoadedFromProfile() const { return m_LoadedFromProfile != ProfileSlot_INVALID; }
|
2004-04-23 00:26:51 +00:00
|
|
|
ProfileSlot GetLoadedFromProfileSlot() const { return m_LoadedFromProfile; }
|
2004-04-23 00:53:29 +00:00
|
|
|
unsigned GetHash() const { return Real()->m_uHash; }
|
2006-01-22 01:00:06 +00:00
|
|
|
RString GetDescription() const { return Real()->m_sDescription; }
|
2003-01-02 22:10:51 +00:00
|
|
|
Difficulty GetDifficulty() const { return Real()->m_Difficulty; }
|
|
|
|
|
int GetMeter() const { return Real()->m_iMeter; }
|
2005-04-26 04:16:45 +00:00
|
|
|
const RadarValues& GetRadarValues() const { return Real()->m_CachedRadarValues; }
|
2003-01-02 22:10:51 +00:00
|
|
|
|
2006-01-22 01:00:06 +00:00
|
|
|
void SetFilename( RString fn ) { m_sFilename = fn; }
|
|
|
|
|
RString GetFilename() const { return m_sFilename; }
|
2005-03-08 07:57:14 +00:00
|
|
|
void SetSavedToDisk( bool b ) { m_bSavedToDisk = b; }
|
2005-12-03 20:34:49 +00:00
|
|
|
bool GetSavedToDisk() const { return m_bSavedToDisk; }
|
2006-01-22 01:00:06 +00:00
|
|
|
void SetDifficultyAndDescription( Difficulty dc, RString sDescription );
|
2005-04-13 08:45:00 +00:00
|
|
|
void SetDifficulty( Difficulty dc ) { SetDifficultyAndDescription( dc, this->GetDescription() ); }
|
2006-01-22 01:00:06 +00:00
|
|
|
void SetDescription( RString sDescription ) { SetDifficultyAndDescription( this->GetDifficulty(), sDescription ); }
|
|
|
|
|
static bool MakeValidEditDescription( RString &sPreferredDescription ); // return true if was modified
|
2005-03-07 05:23:18 +00:00
|
|
|
|
2004-04-16 23:47:24 +00:00
|
|
|
void SetLoadedFromProfile( ProfileSlot slot ) { m_LoadedFromProfile = slot; }
|
2003-01-02 22:10:51 +00:00
|
|
|
void SetMeter(int meter);
|
2005-04-26 04:16:45 +00:00
|
|
|
void SetCachedRadarValues( const RadarValues& v );
|
2003-01-02 22:10:51 +00:00
|
|
|
bool IsAutogen() const; // Was created by autogen?
|
2003-12-18 21:24:30 +00:00
|
|
|
float PredictMeter() const;
|
2003-12-18 20:35:46 +00:00
|
|
|
|
2003-11-17 03:38:24 +00:00
|
|
|
StepsType m_StepsType;
|
2002-05-27 08:23:27 +00:00
|
|
|
|
2004-10-23 17:43:49 +00:00
|
|
|
void GetNoteData( NoteData& noteDataOut ) const;
|
|
|
|
|
void SetNoteData( const NoteData& noteDataNew );
|
2006-01-22 01:00:06 +00:00
|
|
|
void SetSMNoteData( const RString ¬es_comp );
|
|
|
|
|
void GetSMNoteData( RString ¬es_comp_out ) const;
|
2003-01-30 07:18:33 +00:00
|
|
|
|
2002-07-03 03:13:13 +00:00
|
|
|
void TidyUpData();
|
2005-04-03 21:43:29 +00:00
|
|
|
void CalculateRadarValues( float fMusicLengthSeconds );
|
|
|
|
|
|
2005-02-22 23:06:51 +00:00
|
|
|
// Lua
|
|
|
|
|
void PushSelf( lua_State *L );
|
|
|
|
|
|
2002-09-06 23:36:04 +00:00
|
|
|
protected:
|
2003-08-03 00:57:20 +00:00
|
|
|
/* If this Steps is autogenerated, this will point to the autogen
|
2005-03-08 21:17:21 +00:00
|
|
|
* source. If this is true, m_sNoteDataCompressed will always be empty. */
|
2003-08-03 00:57:20 +00:00
|
|
|
const Steps *parent;
|
2002-09-06 23:36:04 +00:00
|
|
|
|
2003-01-02 22:10:51 +00:00
|
|
|
/* We can have one or both of these; if we have both, they're always identical.
|
2005-03-08 21:17:21 +00:00
|
|
|
* Call Compress() to force us to only have m_sNoteDataCompressed; otherwise, creation of
|
2003-01-02 22:10:51 +00:00
|
|
|
* these is transparent. */
|
2005-07-03 03:05:54 +00:00
|
|
|
mutable HiddenPtr<NoteData> m_pNoteData;
|
2005-03-08 21:17:21 +00:00
|
|
|
mutable bool m_bNoteDataIsFilled;
|
2006-01-22 01:00:06 +00:00
|
|
|
mutable RString m_sNoteDataCompressed;
|
2003-01-02 22:10:51 +00:00
|
|
|
|
2003-08-03 00:57:20 +00:00
|
|
|
const Steps *Real() const;
|
2003-01-02 22:10:51 +00:00
|
|
|
|
2006-01-22 01:00:06 +00:00
|
|
|
RString m_sFilename;
|
2005-12-03 20:34:49 +00:00
|
|
|
bool m_bSavedToDisk; // true if this was loaded from disk or has been saved to disk.
|
2004-07-22 21:02:07 +00:00
|
|
|
|
2003-01-02 22:10:51 +00:00
|
|
|
/* These values are pulled from the autogen source first, if there is one. */
|
2005-12-01 03:20:25 +00:00
|
|
|
ProfileSlot m_LoadedFromProfile; // ProfileSlot_INVALID if wasn't loaded from a profile
|
2004-04-23 00:53:29 +00:00
|
|
|
unsigned m_uHash; // only used if m_Difficulty == DIFFICULTY_EDIT
|
2006-01-22 01:00:06 +00:00
|
|
|
RString m_sDescription; // Step author, edit name, or something meaningful
|
2003-01-02 22:10:51 +00:00
|
|
|
Difficulty m_Difficulty; // difficulty classification
|
2004-02-07 05:57:19 +00:00
|
|
|
int m_iMeter; // difficulty rating from MIN_METER to MAX_METER
|
2005-04-26 04:16:45 +00:00
|
|
|
RadarValues m_CachedRadarValues;
|
2002-05-20 08:59:37 +00:00
|
|
|
};
|
|
|
|
|
|
2002-11-16 08:07:38 +00:00
|
|
|
#endif
|
2004-05-31 21:35:31 +00:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* (c) 2001-2004 Chris Danford, Glenn Maynard
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|