[splittiming] Let's break things again! (222)

We introduced a new class, called "SongPosition", that replaces some instance variables in the GameState class. (GameState::m_Position).
Then, you also have it in PlayerState class which keeps track of the position based on their steps. (PlayerState::m_Position).

Fixing the build errors:
- GAMESTATE->m_fSomething should now be:
  - GAMESTATE->m_Position.m_fSomething
  - pPlayerState->m_Position.m_fSomething (or m_pPlayerState for some instance!)
This commit is contained in:
Thai Pangsakulyanont
2011-05-10 19:54:05 +07:00
parent ce91d1a431
commit 241738c18b
7 changed files with 156 additions and 71 deletions
+69
View File
@@ -0,0 +1,69 @@
#ifndef SONGPOSITION_H
#define SONGPOSITION_H
#include "GameConstantsAndTypes.h"
#include "RageTimer.h"
#include "LightsManager.h"
#include "MessageManager.h"
#include "TimingData.h"
class SongPosition
{
public:
// Arcade - the current stage (one song).
// Oni/Endless - a single song in a course.
// Let a lot of classes access this info here so they don't have to keep their own copies.
// todo: [NUM_PLAYERS] this for split bpm lolol -aj
float m_fMusicSeconds; // time into the current song, not scaled by music rate
float m_fSongBeat;
float m_fSongBeatNoOffset;
float m_fCurBPS;
float m_fLightSongBeat; // g_fLightsFalloffSeconds ahead
//bool m_bStop; // in the middle of a stop (freeze or delay)
/** @brief A flag to determine if we're in the middle of a freeze/stop. */
bool m_bFreeze;
/** @brief A flag to determine if we're in the middle of a delay (Pump style stop). */
bool m_bDelay;
/** @brief The row used to start a warp. */
int m_iWarpBeginRow;
/** @brief The beat to warp to afterwards. */
float m_fWarpDestination;
RageTimer m_LastBeatUpdate; // time of last m_fSongBeat, etc. update
float m_fMusicSecondsVisible;
float m_fSongBeatVisible;
void UpdateSongPosition( float fPositionSeconds, const TimingData &timing, const RageTimer &timestamp = RageZeroTimer );
};
#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.
*/