Files
itgmania212121/stepmania/src/Player.h
T

171 lines
5.4 KiB
C++
Raw Normal View History

2004-06-08 00:08:04 +00:00
/* Player - Accepts input, knocks down TapNotes that were stepped on, and keeps score for the player. */
#ifndef PLAYER_H
#define PLAYER_H
2001-11-03 10:52:42 +00:00
2001-12-20 12:37:38 +00:00
#include "ActorFrame.h"
2003-02-17 12:19:42 +00:00
#include "Judgment.h"
#include "HoldJudgment.h"
2002-02-24 01:43:11 +00:00
#include "Combo.h"
2002-06-24 22:04:31 +00:00
#include "NoteDataWithScoring.h"
#include "RageSound.h"
2003-11-26 08:25:45 +00:00
#include "AttackDisplay.h"
2005-01-25 18:29:42 +00:00
#include "NoteData.h"
2003-07-13 00:34:30 +00:00
2003-02-25 02:51:04 +00:00
class ScoreDisplay;
class LifeMeter;
2003-06-30 18:08:27 +00:00
class CombinedLifeMeter;
2003-02-25 02:51:04 +00:00
class ScoreKeeper;
class Inventory;
2005-01-25 18:29:42 +00:00
class RageTimer;
class NoteField;
class PlayerStageStats;
2001-11-29 11:05:04 +00:00
2005-05-18 04:43:41 +00:00
#define SAMPLE_COUNT 32
2005-01-15 01:03:48 +00:00
class Player: public ActorFrame
2001-11-03 10:52:42 +00:00
{
public:
Player( bool bShowNoteField = true, bool bShowJudgment = true );
2005-01-15 01:03:48 +00:00
~Player();
2001-11-03 10:52:42 +00:00
2002-07-28 20:28:37 +00:00
virtual void Update( float fDeltaTime );
2005-10-10 04:06:37 +00:00
virtual void ProcessMessages( float fDeltaTime );
2002-07-28 20:28:37 +00:00
virtual void DrawPrimitives();
2005-05-19 23:29:39 +00:00
virtual void HandleMessage( const CString& sMessage );
2002-01-16 10:01:32 +00:00
void Init(
2005-02-26 05:59:12 +00:00
const CString &sType,
PlayerState* pPlayerState,
PlayerStageStats* pPlayerStageStats,
2004-10-23 17:43:49 +00:00
LifeMeter* pLM,
CombinedLifeMeter* pCombinedLM,
ScoreDisplay* pScoreDisplay,
ScoreDisplay* pSecondaryScoreDisplay,
Inventory* pInventory,
ScoreKeeper* pPrimaryScoreKeeper,
2005-01-15 01:03:48 +00:00
ScoreKeeper* pSecondaryScoreKeeper );
void Load( const NoteData& noteData );
2002-07-28 20:28:37 +00:00
void CrossedRow( int iNoteRow );
void CrossedMineRow( int iNoteRow );
void Step( int col, const RageTimer &tm, bool bHeld = false );
2004-10-23 17:43:49 +00:00
void RandomizeNotes( int iNoteRow );
void FadeToFail();
TapNoteScore GetLastTapNoteScore() const { return m_LastTapNoteScore; }
2003-12-23 02:17:28 +00:00
void ApplyWaitingTransforms();
2005-03-11 03:54:40 +00:00
void SetPaused( bool bPaused ) { m_bPaused = bPaused; }
2003-12-23 02:17:28 +00:00
2005-04-28 00:13:01 +00:00
float GetMaxStepDistanceSeconds();
NoteData m_NoteData;
bool HasNoteField() { return m_pNoteField != NULL; }
2004-10-23 17:43:49 +00:00
protected:
void HandleStep( int col, const RageTimer &tm, bool bHeld );
2004-05-24 04:26:54 +00:00
void UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat );
void DisplayJudgedRow( int iIndexThatWasSteppedOn, TapNoteScore score, int iTrack );
void OnRowCompletelyJudged( int iStepIndex );
void HandleTapRowScore( unsigned row );
2003-03-16 17:45:32 +00:00
void HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore );
void HandleAutosync(float fNoteOffset);
void DrawTapJudgments();
void DrawHoldJudgments();
2002-07-28 20:28:37 +00:00
int GetClosestNoteDirectional( int col, int iStartRow, int iMaxRowsAhead, bool bAllowGraded, bool bForward ) const;
int GetClosestNote( int col, int iNoteRow, int iMaxRowsAhead, int iMaxRowsBehind, bool bAllowGraded ) const;
2003-02-09 02:07:30 +00:00
2005-04-28 00:13:01 +00:00
bool IsPlayingBeginner() const;
2005-07-22 21:04:27 +00:00
bool m_bLoaded;
PlayerState *m_pPlayerState;
PlayerStageStats*m_pPlayerStageStats;
float m_fNoteFieldHeight;
2001-12-19 01:50:57 +00:00
2005-03-11 03:54:40 +00:00
bool m_bPaused;
float m_fOffset[SAMPLE_COUNT]; // for AutoSync
int m_iOffsetSample;
NoteField *m_pNoteField;
2002-07-23 01:41:40 +00:00
vector<HoldJudgment*> m_vHoldJudgment;
2002-10-01 01:53:56 +00:00
Judgment *m_pJudgment;
AutoActor m_sprJudgmentFrame;
2002-07-23 01:41:40 +00:00
Combo *m_pCombo;
2002-07-23 01:41:40 +00:00
AttackDisplay *m_pAttackDisplay;
2003-11-26 08:25:45 +00:00
TapNoteScore m_LastTapNoteScore;
LifeMeter* m_pLifeMeter;
CombinedLifeMeter* m_pCombinedLifeMeter;
ScoreDisplay* m_pScoreDisplay;
ScoreDisplay* m_pSecondaryScoreDisplay;
ScoreKeeper* m_pPrimaryScoreKeeper;
ScoreKeeper* m_pSecondaryScoreKeeper;
Inventory* m_pInventory;
2003-04-22 04:54:04 +00:00
int m_iRowLastCrossed;
int m_iMineRowLastCrossed;
RageSound m_soundMine;
RageSound m_soundAttackLaunch;
RageSound m_soundAttackEnding;
2004-10-23 23:41:49 +00:00
vector<RageSound> m_vKeysounds;
2005-02-15 07:09:07 +00:00
CString m_sMessageToSendOnStep;
2005-02-26 05:59:12 +00:00
ThemeMetric<float> GRAY_ARROWS_Y_STANDARD;
ThemeMetric<float> GRAY_ARROWS_Y_REVERSE;
ThemeMetric2D<float> COMBO_X;
ThemeMetric<float> COMBO_Y;
ThemeMetric<float> COMBO_Y_REVERSE;
2005-04-05 21:40:30 +00:00
ThemeMetric<float> COMBO_CENTERED_ADDY;
ThemeMetric<float> COMBO_CENTERED_ADDY_REVERSE;
2005-02-26 05:59:12 +00:00
ThemeMetric2D<float> ATTACK_DISPLAY_X;
ThemeMetric<float> ATTACK_DISPLAY_Y;
ThemeMetric<float> ATTACK_DISPLAY_Y_REVERSE;
ThemeMetric<float> HOLD_JUDGMENT_Y_STANDARD;
ThemeMetric<float> HOLD_JUDGMENT_Y_REVERSE;
ThemeMetric<int> BRIGHT_GHOST_COMBO_THRESHOLD;
ThemeMetric<bool> TAP_JUDGMENTS_UNDER_FIELD;
ThemeMetric<bool> HOLD_JUDGMENTS_UNDER_FIELD;
ThemeMetric<int> START_DRAWING_AT_PIXELS;
ThemeMetric<int> STOP_DRAWING_AT_PIXELS;
ThemeMetric<int> MAX_PRO_TIMING_ERROR;
#define NUM_REVERSE 2
#define NUM_CENTERED 2
TweenState m_tsJudgment[NUM_REVERSE][NUM_CENTERED];
2001-11-03 10:52:42 +00:00
};
#endif
2004-06-08 00:08:04 +00:00
/*
* (c) 2001-2004 Chris Danford
* 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.
*/