WindowDancing and all its UI elements). All of the dancing UI elements have been consolidated into the Player class, which simplifies things a great deal. Steps and the classes that use them have been generalized to use a variable number of panels (6 panel, 8 panel). Only a little more work is needed on the ColorArrows portion of Player to fully support these panel modes.
113 lines
3.0 KiB
C++
113 lines
3.0 KiB
C++
/*
|
|
-----------------------------------------------------------------------------
|
|
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.
|
|
-----------------------------------------------------------------------------
|
|
*/
|
|
|
|
#ifndef _PLAYER_H_
|
|
#define _PLAYER_H_
|
|
|
|
#include "GameInfo.h" // for ScoreSummary
|
|
#include "Steps.h"
|
|
#include "Sprite.h"
|
|
#include "BitmapText.h"
|
|
|
|
|
|
class Player
|
|
{
|
|
public:
|
|
Player();
|
|
|
|
void SetSteps( const Steps& newSteps );
|
|
void SetX( int iX );
|
|
void Update( const float &fDeltaTime, float fSongBeat, float fMaxBeatDifference );
|
|
void Draw( float fSongBeat );
|
|
|
|
|
|
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; };
|
|
private:
|
|
float m_fLifePercentage;
|
|
Sprite m_sprLifeMeterFrame;
|
|
Sprite m_sprLifeMeterPills;
|
|
|
|
// 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;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif |