Files
itgmania212121/stepmania/src/Player.h
T

113 lines
3.0 KiB
C++
Raw Normal View History

/*
-----------------------------------------------------------------------------
File: Player.cpp
Desc: Object that accepts pad input, knocks down ColorArrows that were stepped on,
and keeps score for the player.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
2001-11-03 10:52:42 +00:00
#ifndef _PLAYER_H_
#define _PLAYER_H_
#include "GameInfo.h" // for ScoreSummary
2001-11-03 10:52:42 +00:00
#include "Steps.h"
#include "Sprite.h"
#include "BitmapText.h"
2001-11-03 10:52:42 +00:00
class Player
{
public:
Player();
2001-11-03 10:52:42 +00:00
void SetSteps( const Steps& newSteps );
void SetX( int iX );
void Update( const float &fDeltaTime, float fSongBeat, float fMaxBeatDifference );
void Draw( float fSongBeat );
2001-11-03 10:52:42 +00:00
ScoreSummary GetScoreSummary();
int UpdateStepsMissedOlderThan( float fMissIfOlderThanThisBeat );
void HandlePlayerStep( float fSongBeat, Step player_step, float fMaxBeatDiff );
protected:
void CheckForCompleteStep( float fSongBeat, Step player_step, float fMaxBeatDiff );
void OnCompleteStep( float fSongBeat, Step player_step, float fMaxBeatDiff, int iStepIndex );
int m_iCurCombo;
int m_iMaxCombo;
enum StepScore{ none, perfect, great, good, boo, miss };
enum StepTiming{ no_timing, early, late };
// index is quarter beat number (e.g. beat 30 is index 30*4)
Step m_OriginalStep[MAX_STEP_ELEMENTS];
Step m_LeftToStepOn[MAX_STEP_ELEMENTS];
StepScore m_StepScore[MAX_STEP_ELEMENTS];
//StepTiming m_StepTiming[MAX_STEP_ELEMENTS];
int m_iArrowsCenterX;
// color arrows
void SetColorArrowsX( int iX );
void UpdateColorArrows( const float& fDeltaTime );
int GetColorArrowYPos( int iStepIndex, float fSongBeat );
void DrawColorArrows( float fSongBeat );
Sprite m_sprColorArrow[4];
int m_iColorArrowFrameOffset[MAX_STEP_ELEMENTS];
// gray arrows
void SetGrayArrowsX( int iX );
void UpdateGrayArrows( const float& fDeltaTime );
void DrawGrayArrows();
void GrayArrowStep( int index );
void GrayArrowGhostStep( int index );
Sprite m_sprGrayArrow[4];
Sprite m_sprGrayArrowGhost[4];
// judgement
void SetJudgementX( int iX );
void UpdateJudgement( const float& fDeltaTime );
void DrawJudgement();
void SetJudgement( StepScore score );
float m_fJudgementDisplayCountdown;
Sprite m_sprJudgement;
// combo
void SetComboX( int iX );
void UpdateCombo( const float& fDeltaTime );
void DrawCombo();
void SetCombo( int iNum );
BOOL m_bComboVisible;
Sprite m_sprCombo;
BitmapText m_textComboNum;
// life meter
void SetLifeMeterX( int iX );
void UpdateLifeMeter( const float& fDeltaTime );
void DrawLifeMeter( float fSongBeat );
void ChangeLife( StepScore score );
public:
float GetLifePercentage() { return m_fLifePercentage; };
2001-11-03 10:52:42 +00:00
private:
float m_fLifePercentage;
Sprite m_sprLifeMeterFrame;
Sprite m_sprLifeMeterPills;
2001-11-03 10:52:42 +00:00
// score
void SetScoreX( int iX );
void UpdateScore( const float& fDeltaTime );
void DrawScore();
void ChangeScore( StepScore score );
float m_fScore;
Sprite m_sprScoreFrame;
BitmapText m_textScoreNum;
2001-11-03 10:52:42 +00:00
};
#endif