Major rewrite of all classes related to gameplay (Song, Steps, Player,

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.
This commit is contained in:
Chris Danford
2001-11-04 19:34:28 +00:00
parent 7caffe0c93
commit a40558031b
50 changed files with 1093 additions and 1092 deletions
+9 -7
View File
@@ -1,11 +1,13 @@
#include "stdafx.h" // testing updates
//-----------------------------------------------------------------------------
// File: Actor.cpp
//
// Desc: Base class for all objects that appear on the screen.
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
File: Actor.h
Desc: Base class for all objects that appear on the screen.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
#include "Actor.h"
#include <math.h>
+9 -7
View File
@@ -1,10 +1,12 @@
//-----------------------------------------------------------------------------
// File: Actor.h
//
// Desc: Base class for all objects that appear on the screen.
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
File: Actor.h
Desc: Base class for all objects that appear on the screen.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
#ifndef _ACTOR_H_
+8 -7
View File
@@ -1,12 +1,13 @@
#include "stdafx.h"
//-----------------------------------------------------------------------------
// File: Background.cpp
//
// Desc: Cropped version of the song background displayed in Song Select.
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
File: Background.h
Desc: A graphic displayed in the background during Dancing.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
#include "Background.h"
#include "RageUtil.h"
+10 -7
View File
@@ -1,10 +1,13 @@
//-----------------------------------------------------------------------------
// File: Background.h
//
// Desc: Cropped version of the song background displayed in Song Select.
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
File: Background.h
Desc: A graphic displayed in the background during Dancing.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
#ifndef _Background_H_
#define _Background_H_
+7 -7
View File
@@ -1,13 +1,13 @@
#include "stdafx.h"
//-----------------------------------------------------------------------------
// File: Banner.cpp
//
// Desc: The song's banner displayed in Song Select.
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
File: Banner.h
Desc: The song's banner displayed in SelectSong.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
#include "RageUtil.h"
+9 -7
View File
@@ -1,10 +1,12 @@
//-----------------------------------------------------------------------------
// File: Banner.h
//
// Desc: The song's banner displayed in Song Select.
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
File: Banner.h
Desc: The song's banner displayed in SelectSong.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
#ifndef _Banner_H_
#define _Banner_H_
+8 -7
View File
@@ -1,12 +1,13 @@
#include "stdafx.h"
//-----------------------------------------------------------------------------
// File: BitmapText.cpp
//
// Desc: A font class that draws from a bitmap.
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
File: BitmapText.h
Desc: A font class that draws characters from a bitmap.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
#include "BitmapText.h"
#include <assert.h>
+9 -7
View File
@@ -1,10 +1,12 @@
//-----------------------------------------------------------------------------
// File: BitmapText.h
//
// Desc: A font class that draws from a bitmap.
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
File: BitmapText.h
Desc: A font class that draws characters from a bitmap.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
#ifndef _BITMAPTEXT_H_
#define _BITMAPTEXT_H_
-83
View File
@@ -1,83 +0,0 @@
#include "stdafx.h"
//-----------------------------------------------------------------------------
// File: Combo.cpp
//
// Desc: Combo counter that displays while dancing.
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
#include "RageUtil.h"
#include "Combo.h"
#define CENTER_X 320
#define CENTER_Y 240
#define FONT "Fonts\\Font - Arial Bold numbers 30px.font"
#define COMBO_TWEEN_TIME 0.5f
#define COMBO_SPRITE "Sprites\\Combo.sprite"
#define COMBO_Y (CENTER_Y+60)
Combo::Combo()
{
m_bVisible = FALSE;
m_sprCombo.LoadFromSpriteFile( COMBO_SPRITE );
m_textNum.LoadFromFontFile( FONT );
m_textNum.SetText( "" );
SetX( CENTER_X );
}
Combo::~Combo()
{
}
void Combo::SetX( int iNewX )
{
m_sprCombo.SetXY( iNewX+40, COMBO_Y );
m_textNum.SetXY( iNewX-50, COMBO_Y );
}
void Combo::Update( const FLOAT &fDeltaTime )
{
m_sprCombo.Update( fDeltaTime );
m_textNum.Update( fDeltaTime );
}
void Combo::Draw()
{
if( m_bVisible )
{
m_textNum.Draw();
m_sprCombo.Draw();
}
}
void Combo::SetCombo( int iNum )
{
if( iNum <= 4 )
{
m_bVisible = FALSE;
}
else
{
m_bVisible = TRUE;
m_textNum.SetText( ssprintf("%d", iNum) );
m_textNum.SetZoom( 1.0f + iNum/200.0f );
m_textNum.TweenTo( COMBO_TWEEN_TIME, m_textNum.GetX(), m_textNum.GetY() );
}
}
-40
View File
@@ -1,40 +0,0 @@
//-----------------------------------------------------------------------------
// File: Combo.h
//
// Desc: Combo counter that displays while dancing.
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
#ifndef _COMBO_H_
#define _COMBO_H_
#include "Sprite.h"
#include "BitmapText.h"
class Combo
{
public:
Combo();
~Combo();
void SetX( int iNewX );
void Update( const FLOAT &fDeltaTime );
void Draw();
void SetCombo( int iNum );
private:
BOOL m_bVisible;
Sprite m_sprCombo;
BitmapText m_textNum;
};
#endif
+9 -7
View File
@@ -1,10 +1,12 @@
//-----------------------------------------------------------------------------
// File: IniFile.cpp
//
// Desc: wrapper for reading and writing an .ini file.
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
File: IniFile.h
Desc: Wrapper for reading and writing an .ini file.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
#include "stdafx.h"
#include "IniFile.h"
+10 -7
View File
@@ -1,10 +1,13 @@
//-----------------------------------------------------------------------------
// File: IniFile.h
//
// Desc: wrapper for reading and writing an .ini file.
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
File: IniFile.h
Desc: Wrapper for reading and writing an .ini file.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
#ifndef _INIFILE_H_
#define _INIFILE_H_
-87
View File
@@ -15,90 +15,3 @@
#define CENTER_X 320
#define CENTER_Y 240
#define JUDGEMENT_DISPLAY_TIME 1.0f
#define JUDGEMENT_SPRITE "Sprites\\Judgement.sprite"
#define JUDGEMENT_Y CENTER_Y
Judgement::Judgement() :
m_fDisplayTimeLeft( 0.0 )
{
m_sprJudgement.LoadFromSpriteFile( JUDGEMENT_SPRITE );
SetX( CENTER_X );
}
Judgement::~Judgement()
{
}
void Judgement::SetX( int iNewX )
{
m_sprJudgement.SetXY( iNewX, CENTER_Y );
}
void Judgement::Update( const FLOAT &fDeltaTime )
{
if( m_fDisplayTimeLeft > 0.0 )
m_fDisplayTimeLeft -= fDeltaTime;
m_sprJudgement.Update( fDeltaTime );
}
void Judgement::Draw()
{
// RageLog( "Judgement::Draw()" );
if( m_fDisplayTimeLeft > 0.0 )
m_sprJudgement.Draw();
}
void Judgement::Perfect()
{
RageLog( "Judgement::Perfect()" );
m_sprJudgement.SetState( 0 );
TweenFromBigToSmall();
}
void Judgement::Great()
{
m_sprJudgement.SetState( 1 );
TweenFromBigToSmall();
}
void Judgement::Good()
{
m_sprJudgement.SetState( 2 );
TweenFromBigToSmall();
}
void Judgement::Boo()
{
m_sprJudgement.SetState( 3 );
TweenFromBigToSmall();
}
void Judgement::Miss()
{
m_sprJudgement.SetState( 4 );
TweenFromBigToSmall();
}
void Judgement::TweenFromBigToSmall()
{
m_fDisplayTimeLeft = JUDGEMENT_DISPLAY_TIME;
m_sprJudgement.SetZoom( 1.5f );
m_sprJudgement.TweenTo( JUDGEMENT_DISPLAY_TIME/2.0,
m_sprJudgement.GetX(),
m_sprJudgement.GetY() );
}
-26
View File
@@ -13,32 +13,6 @@
#include "Sprite.h"
class Judgement
{
public:
Judgement();
~Judgement();
void SetX( int iNewX );
void Update( const FLOAT &fDeltaTime );
void Draw();
void Perfect();
void Great();
void Good();
void Boo();
void Miss();
private:
void TweenFromBigToSmall();
FLOAT m_fDisplayTimeLeft;
Sprite m_sprJudgement;
};
-102
View File
@@ -1,102 +0,0 @@
#include "stdafx.h"
//-----------------------------------------------------------------------------
// File: LifeMeter.cpp
//
// Desc: LifeMeter counter that displays while dancing.
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
#include "RageUtil.h"
#include "LifeMeter.h"
#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 480
#define CENTER_X 320
#define CENTER_Y 240
#define FONT "Fonts\\Font - Arial Bold numbers 30px.font"
#define NUM_PILLS 17
//#define LIFEMETER_TWEEN_TIME 0.5f
#define LIFEMETER_FRAME_SPRITE "Sprites\\Life Meter Frame.sprite"
#define LIFEMETER_PILLS_SPRITE "Sprites\\Life Meter Pills.sprite"
#define LIFEMETER_Y 30
#define LIFEMETER_PILLS_Y (LIFEMETER_Y+2)
const FLOAT PILL_OFFSET[NUM_PILLS] = {
0.3f, 0.7f, 1.0f, 0.7f, 0.3f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f
};
LifeMeter::LifeMeter() :
m_fLifePercentage( 0.5f )
{
m_sprLifeMeterFrame.LoadFromSpriteFile( LIFEMETER_FRAME_SPRITE );
m_sprLifeMeterPills.LoadFromSpriteFile( LIFEMETER_PILLS_SPRITE );
SetX( CENTER_X );
}
LifeMeter::~LifeMeter()
{
}
void LifeMeter::SetX( FLOAT iNewX )
{
m_sprLifeMeterFrame.SetXY( iNewX, LIFEMETER_Y );
m_sprLifeMeterPills.SetXY( iNewX, LIFEMETER_PILLS_Y );
}
void LifeMeter::Update( const FLOAT &fDeltaTime )
{
m_sprLifeMeterFrame.Update( fDeltaTime );
m_sprLifeMeterPills.Update( fDeltaTime );
}
void LifeMeter::Draw( FLOAT fSongBeat )
{
FLOAT fBeatPercentage = fSongBeat - (int)fSongBeat;
int iOffsetStart = roundf( NUM_PILLS*fBeatPercentage );
m_sprLifeMeterFrame.Draw();
FLOAT iX = m_sprLifeMeterFrame.GetLeftEdge() + 27;
int iNumPills = (int)(m_sprLifeMeterPills.GetNumStates() * m_fLifePercentage);
int iPillWidth = m_sprLifeMeterPills.GetZoomedWidth();
for( int i=0; i<iNumPills; i++ )
{
m_sprLifeMeterPills.SetState( i );
m_sprLifeMeterPills.SetX( iX );
int iOffsetNum = (iOffsetStart - i + NUM_PILLS) % NUM_PILLS;
int iOffset = roundf( PILL_OFFSET[iOffsetNum] * m_fLifePercentage * 8.0f );
m_sprLifeMeterPills.SetY( LIFEMETER_PILLS_Y - iOffset );
m_sprLifeMeterPills.Draw();
iX += iPillWidth;
}
}
void LifeMeter::SetLife( FLOAT fNewLife )
{
assert( fNewLife >= 0.0f && fNewLife <= 1.0f );
m_fLifePercentage = fNewLife;
if( fNewLife >= 0.9f )
m_sprLifeMeterFrame.SetEffectCamelion( 5, D3DXCOLOR(0.2f,0.2f,0.2f,1), D3DXCOLOR(1,1,1,1) );
else if( fNewLife < 0.25f )
m_sprLifeMeterFrame.SetEffectCamelion( 5, D3DXCOLOR(1,0.8f,0.8f,1), D3DXCOLOR(1,0.2f,0.2f,1) );
else
m_sprLifeMeterFrame.SetEffectNone();
}
-39
View File
@@ -1,39 +0,0 @@
//-----------------------------------------------------------------------------
// File: LifeMeter.h
//
// Desc: LifeMeter display at the bottom of the screen while dancing.
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
#ifndef _LIFEMETER_H_
#define _LIFEMETER_H_
#include "Sprite.h"
class LifeMeter
{
public:
LifeMeter();
~LifeMeter();
void SetX( FLOAT iNewX );
void Update( const FLOAT &fDeltaTime );
void Draw( FLOAT fSongBeat );
void SetLife( FLOAT fNewLife );
private:
Sprite m_sprLifeMeterFrame;
Sprite m_sprLifeMeterPills;
FLOAT m_fLifePercentage;
};
#endif
+559 -162
View File
@@ -1,18 +1,19 @@
#include "stdafx.h"
//-----------------------------------------------------------------------------
// 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.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
File: Player.cpp
Desc: Object that accepts pad input, knocks down ColorArrows that were stepped on,
and keeps score for the player.
#include "Util.h"
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
#include "ScreenDimensions.h"
#include "Math.h" // for fabs()
#include "Player.h"
#include "RageUtil.h"
@@ -23,220 +24,302 @@
#define SCORE_ADD_GOOD 200
#define SCORE_ADD_BOO 100
#define SCORE_MULT_PERFECT 1.007f
#define SCORE_MULT_GREAT 1.004f
#define SCORE_MULT_GOOD 1.002f
#define SCORE_MULT_BOO 1.001f
#define LIFE_PERFECT 0.015f
#define LIFE_GREAT 0.008f
#define LIFE_GOOD 0.000f
#define LIFE_BOO -0.015f
#define LIFE_MISS -0.060f
#define SPRITE_COLOR_ARROW_LEFT "Sprites\\Color Arrow Left.sprite"
#define SPRITE_COLOR_ARROW_DOWN "Sprites\\Color Arrow Down.sprite"
#define SPRITE_COLOR_ARROW_UP "Sprites\\Color Arrow Up.sprite"
#define SPRITE_COLOR_ARROW_RIGHT "Sprites\\Color Arrow Right.sprite"
void Player::Set( GrayArrows *pGA, ColorArrows *pCA,
Judgement *pJ, Combo *pC,
Score *pS, LifeMeter *pL,
Steps steps, FLOAT fMaxBeatDifference )
const int ARROW_X_OFFSET[4] = {
(int)(64*-1.5),
(int)(64*-0.5),
(int)(64* 0.5),
(int)(64* 1.5)
};
#define GRAY_ARROW_Y ((int)(64* 1.5))
#define GRAY_ARROW_POP_UP_TIME 0.30f
#define ARROW_HEIGHT 70
#define NUM_FRAMES_IN_COLOR_ARROW_SPRITE 12
const CString SPRITE_COLOR_ARROW[4] = {
"Sprites\\Color Arrow Left.sprite",
"Sprites\\Color Arrow Down.sprite",
"Sprites\\Color Arrow Up.sprite",
"Sprites\\Color Arrow Right.sprite"
};
const CString SPRITE_GRAY_ARROW[4] = {
"Sprites\\Gray Arrow Left.sprite",
"Sprites\\Gray Arrow Down.sprite",
"Sprites\\Gray Arrow Up.sprite",
"Sprites\\Gray Arrow Right.sprite"
};
#define JUDGEMENT_DISPLAY_TIME 1.0f
#define JUDGEMENT_SPRITE "Sprites\\Judgement.sprite"
#define JUDGEMENT_Y CENTER_Y
#define FONT_COMBO "Fonts\\Font - Arial Bold numbers 30px.font"
#define COMBO_TWEEN_TIME 0.5f
#define COMBO_SPRITE "Sprites\\Combo.sprite"
#define COMBO_Y (CENTER_Y+60)
#define LIEFMETER_NUM_PILLS 17
#define LIFEMETER_FRAME_SPRITE "Sprites\\Life Meter Frame.sprite"
#define LIFEMETER_PILLS_SPRITE "Sprites\\Life Meter Pills.sprite"
#define LIFEMETER_Y 30
#define LIFEMETER_PILLS_Y (LIFEMETER_Y+2)
const float PILL_OFFSET_Y[LIEFMETER_NUM_PILLS] = {
0.3f, 0.7f, 1.0f, 0.7f, 0.3f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f
};
#define FONT_SCORE "Fonts\\Font - Arial Bold numbers 30px.font"
#define SCORE_FRAME_TEXTURE "Textures\\Score Frame 1x1.png"
#define SCORE_Y (480-40)
Player::Player()
{
RageLog( "Player::Set()" );
m_iCurCombo = 0;
m_iMaxCombo = 0;
m_fLifePercentage = 0.50f;
m_fScore = 0.0f;
m_pGA = pGA;
m_pCA = pCA;
m_pJudgement = pJ;
m_pCombo = pC;
m_pScore = pS;
m_pLifeMeter = pL;
if( m_pLifeMeter ) m_pLifeMeter->SetLife( m_fLife );
for( int i=0; i<MAX_STEP_ELEMENTS; i++ ) {
m_OriginalStep[i] = 0;
m_LeftToStepOn[i] = 0;
m_StepScore[i] = none;
}
m_Steps = steps;
// gray arrows
for( i=0; i<4; i++ )
{
m_sprGrayArrow[i].LoadFromSpriteFile( SPRITE_GRAY_ARROW[i] );
m_sprGrayArrowGhost[i].LoadFromSpriteFile( SPRITE_GRAY_ARROW[i] );
m_sprGrayArrowGhost[i].StopAnimating();
m_sprGrayArrowGhost[i].SetState( 1 );
m_sprGrayArrowGhost[i].SetColor( D3DXCOLOR(1,1,1,0) );
}
m_StepScore.SetSize( MAX_STEP_ELEMENTS );
for( int i=0; i<m_StepScore.GetSize(); i++ )
m_StepScore[i] = no_score;
// color arrows
for( i=0; i<4; i++ )
{
m_sprColorArrow[i].LoadFromSpriteFile( SPRITE_COLOR_ARROW[i] );
m_sprColorArrow[i].StopAnimating();
}
for( i=0; i<MAX_STEP_ELEMENTS; i++ )
m_iColorArrowFrameOffset[i] = 0;
m_fMaxBeatDifference = fMaxBeatDifference;
// judgement
m_fJudgementDisplayCountdown = 0;
m_sprJudgement.LoadFromSpriteFile( JUDGEMENT_SPRITE );
// combo
m_bComboVisible = FALSE;
m_sprCombo.LoadFromSpriteFile( COMBO_SPRITE );
m_textComboNum.LoadFromFontFile( FONT_COMBO );
m_textComboNum.SetText( "" );
// life meter
m_sprLifeMeterFrame.LoadFromSpriteFile( LIFEMETER_FRAME_SPRITE );
m_sprLifeMeterPills.LoadFromSpriteFile( LIFEMETER_PILLS_SPRITE );
// score
m_sprScoreFrame.LoadFromTexture( SCORE_FRAME_TEXTURE );
m_textScoreNum.LoadFromFontFile( FONT_SCORE );
m_textScoreNum.SetText( " " );
SetX( CENTER_X );
}
void Player::Update( const FLOAT &fDeltaTime )
void Player::SetX( int iX )
{
m_iArrowsCenterX = iX;
SetGrayArrowsX(iX);
SetColorArrowsX(iX);
SetJudgementX(iX);
SetComboX(iX);
SetScoreX(iX);
SetLifeMeterX(iX);
}
void Player::SetSteps( const Steps& newSteps )
{
for( int i=0; i<MAX_STEP_ELEMENTS; i++ ) {
m_OriginalStep[i] = newSteps.m_steps[i];
m_LeftToStepOn[i] = newSteps.m_steps[i];
m_iColorArrowFrameOffset[i] = (int)( i/(FLOAT)ELEMENTS_PER_BEAT*NUM_FRAMES_IN_COLOR_ARROW_SPRITE );
}
}
void Player::Update( const float &fDeltaTime, float fSongBeat, float fMaxBeatDifference )
{
//RageLog( "Player::Update(%f)", fDeltaTime );
for( int i=0; i<2; i++ ) {
for( int j=0; j<4; j++ ) {
if( m_fStepCountDown[i][j] > 0.0 )
m_fStepCountDown[i][j] -= fDeltaTime;
}
}
int iNumMisses = UpdateMissedStepsOlderThan( m_fSongBeat-m_fMaxBeatDifference );
int iNumMisses = UpdateStepsMissedOlderThan( fSongBeat-fMaxBeatDifference );
if( iNumMisses > 0 )
{
m_pJudgement->Miss();
SetJudgement( miss );
m_iCurCombo = 0;
m_pCombo->SetCombo( 0 );
m_fLife += LIFE_MISS * iNumMisses;
if( m_fLife < 0.0f )
m_fLife = 0.0f;
m_pLifeMeter->SetLife( m_fLife );
SetCombo( 0 );
for( int i=0; i<iNumMisses; i++ )
ChangeLife( miss );
}
UpdateGrayArrows( fDeltaTime );
UpdateColorArrows( fDeltaTime );
UpdateJudgement( fDeltaTime );
UpdateCombo( fDeltaTime );
UpdateScore( fDeltaTime );
UpdateLifeMeter( fDeltaTime );
}
void Player::StepOn( Step player_step )
void Player::Draw( float fSongBeat )
{
// DebugLog( CString("Player::Step() ") + padStepL.ToString() + CString(" ") + padStepR.ToString() );
// Fill the "step buffer" so that the player doesn't have to hit 2 buttons
// at the exact same time in order to hit a two direction step
if( player_step & STEP_P1_LEFT ) m_fStepCountDown[0][0] = STEP_DOWN_TIME;
if( player_step & STEP_P1_DOWN ) m_fStepCountDown[0][1] = STEP_DOWN_TIME;
if( player_step & STEP_P1_UP ) m_fStepCountDown[0][2] = STEP_DOWN_TIME;
if( player_step & STEP_P1_RIGHT ) m_fStepCountDown[0][3] = STEP_DOWN_TIME;
// make the gray foot steps on the screen follow the input
m_pGA->StepOn( player_step );
HandleStep();
DrawGrayArrows();
DrawColorArrows( fSongBeat );
DrawJudgement();
DrawCombo();
DrawScore();
DrawLifeMeter( fSongBeat );
}
void Player::HandleStep()
void Player::HandlePlayerStep( float fSongBeat, Step player_step, float fMaxBeatDiff )
{
//RageLog( "Player::HandleStep()" );
RageLog( "Player::HandlePlayerStep()" );
// This is being called just after a step, so we know at
// least one direction is being depressed.
// update gray arrows
if( player_step & STEP_P1_LEFT ) GrayArrowStep( 0 );
if( player_step & STEP_P1_DOWN ) GrayArrowStep( 1 );
if( player_step & STEP_P1_UP ) GrayArrowStep( 2 );
if( player_step & STEP_P1_RIGHT ) GrayArrowStep( 3 );
// Build pad steps to check against
Step player_step = 0x0000;
if( m_fStepCountDown[0][0] > 0.0f ) player_step |= STEP_P1_LEFT;
if( m_fStepCountDown[0][1] > 0.0f ) player_step |= STEP_P1_DOWN;
if( m_fStepCountDown[0][2] > 0.0f ) player_step |= STEP_P1_UP;
if( m_fStepCountDown[0][3] > 0.0f ) player_step |= STEP_P1_RIGHT;
CheckForCompleteStep( fSongBeat, player_step, fMaxBeatDiff );
}
void Player::CheckForCompleteStep( float fSongBeat, Step player_step, float fMaxBeatDiff )
{
RageLog( "Player::CheckForCompleteStep()" );
// look for the closest matching step
int iIndexStartLookingAt = BeatToStepIndex( fSongBeat );
int iNumElementsToExamine = BeatToStepIndex( fMaxBeatDiff ); // number of elements to examine on either end of iIndexStartLookingAt
// find the closest step that our PadSteps cover
//RageLog( "I ask: What step %s, %s, is near %f (within %f )",
// padStepL.ToString(),
// padStepR.ToString(),
// m_fSongBeat,
// MAX_BEAT_DIFFERENCE );
RageLog( "iIndexStartLookingAt = %d, iNumElementsToExamine = %d", iIndexStartLookingAt, iNumElementsToExamine );
int iIndexOfClosest =
m_Steps.GetIndexOfClosestStep( m_fSongBeat,
m_fMaxBeatDifference,
player_step );
// Start at iIndexStartLookingAt and search outward. The first one that overlaps the player's step is the closest match.
for( int delta=0; delta <= iNumElementsToExamine; delta++ )
{
int iCurrentIndexEarlier = iIndexStartLookingAt - delta;
int iCurrentIndexLater = iIndexStartLookingAt + delta;
if( iIndexOfClosest == -1 ) // if no steps in our specified range are covered
return;
// silly check to make sure we don't go out of bounds
iCurrentIndexEarlier = clamp( iCurrentIndexEarlier, 0, MAX_STEP_ELEMENTS-1 );
iCurrentIndexLater = clamp( iCurrentIndexLater, 0, MAX_STEP_ELEMENTS-1 );
FLOAT fStepBeat = StepIndexToBeat( iIndexOfClosest ); // this is the beat of the note we stepped on
////////////////////////////
// check the step to the left of iIndexStartLookingAt
////////////////////////////
RageLog( "Checking steps[%d]", iCurrentIndexEarlier );
if( m_LeftToStepOn[iCurrentIndexEarlier] & player_step ) // these steps overlap
{
m_LeftToStepOn[iCurrentIndexEarlier] &= ~player_step; // subtract player_step
if( m_LeftToStepOn[iCurrentIndexEarlier] == 0 ) { // did this complete the step?
OnCompleteStep( fSongBeat, player_step, fMaxBeatDiff, iCurrentIndexEarlier );
return;
}
}
//RageLog( "GetClosestMatch returned: iIndexOfClosest = %d (%s, %s, fStepBeat: %f)",
// iIndexOfClosest,
// m_Steps.StepsLeft [iIndexOfClosest].ToString(),
// m_Steps.StepsRight[iIndexOfClosest].ToString(),
// fStepBeat );
////////////////////////////
// check the step to the right of iIndexStartLookingAt
////////////////////////////
RageLog( "Checking steps[%d]", iCurrentIndexLater );
if( m_LeftToStepOn[iCurrentIndexLater] & player_step ) // these steps overlap
{
m_LeftToStepOn[iCurrentIndexLater] &= ~player_step; // subtract player_step
if( m_LeftToStepOn[iCurrentIndexLater] == 0 ) { // did this complete the step?
OnCompleteStep( fSongBeat, player_step, fMaxBeatDiff, iCurrentIndexLater );
return;
}
}
}
}
void Player::OnCompleteStep( float fSongBeat, Step player_step, float fMaxBeatDiff, int iIndexThatWasSteppedOn )
{
float fStepBeat = StepIndexToBeat( iIndexThatWasSteppedOn );
FLOAT fBeatsUntilStep = fStepBeat - m_fSongBeat;
FLOAT fPercentFromPerfect = (FLOAT)fabs( fBeatsUntilStep / m_fMaxBeatDifference );
// show the gray arrow ghost
if( player_step & STEP_P1_LEFT ) GrayArrowGhostStep( 0 );
if( player_step & STEP_P1_DOWN ) GrayArrowGhostStep( 1 );
if( player_step & STEP_P1_UP ) GrayArrowGhostStep( 2 );
if( player_step & STEP_P1_RIGHT ) GrayArrowGhostStep( 3 );
float fBeatsUntilStep = fStepBeat - fSongBeat;
float fPercentFromPerfect = (float)fabs( fBeatsUntilStep / fMaxBeatDiff );
RageLog( "fBeatsUntilStep: %f, fPercentFromPerfect: %f",
fBeatsUntilStep, fPercentFromPerfect );
// step on the note so that it can't be stepped on any more
m_Steps.StatusArray[iIndexOfClosest] = stepped_on;
// compute what the score should be for the note we stepped on
StepScore &score = m_StepScore[iIndexOfClosest];
StepScore &score = m_StepScore[iIndexThatWasSteppedOn];
if( fPercentFromPerfect < 0.20f )
score = perfect;
else if( fPercentFromPerfect < 0.45f )
score = great;
else if( fPercentFromPerfect < 0.75f )
score = good;
else
score = boo;
if( fPercentFromPerfect < 0.20f ) score = perfect;
else if( fPercentFromPerfect < 0.45f ) score = great;
else if( fPercentFromPerfect < 0.75f ) score = good;
else score = boo;
// update the judgement display
switch( score )
{
case perfect: m_pJudgement->Perfect(); break;
case great: m_pJudgement->Great(); break;
case good: m_pJudgement->Good(); break;
case boo: m_pJudgement->Boo(); break;
}
// update the judgement, score, and life
SetJudgement( score );
ChangeScore( score );
ChangeLife( score );
// update the combo display
switch( score )
{
case perfect:
case great:
m_iCurCombo++;
m_pCombo->SetCombo( m_iCurCombo );
SetCombo( m_iCurCombo+1 ); // combo continuing
break;
case good:
case boo:
// combo stopped
if( m_iCurCombo > m_iMaxCombo )
m_iMaxCombo = m_iCurCombo;
m_iCurCombo = 0;
m_pCombo->SetCombo( m_iCurCombo );
SetCombo( 0 ); // combo stopped
break;
}
// remove the arrows from the ColorArrow columns if the score is high enough
if( score == perfect || score == great )
{
m_pCA->StepOn( BeatToStepIndex(fStepBeat) );
}
// update running score
switch( score )
{
case perfect: m_fScore += SCORE_ADD_PERFECT; m_fScore *= SCORE_MULT_PERFECT; break;
case great: m_fScore += SCORE_ADD_GREAT; m_fScore *= SCORE_MULT_GREAT; break;
case good: m_fScore += SCORE_ADD_GOOD; m_fScore *= SCORE_MULT_GOOD; break;
case boo: m_fScore += SCORE_ADD_BOO; m_fScore *= SCORE_MULT_BOO; break;
case miss: break;
}
// update life meter
switch( score )
{
case perfect: m_fLife += LIFE_PERFECT; break;
case great: m_fLife += LIFE_GREAT; break;
case good: m_fLife += LIFE_GOOD; break;
case boo: m_fLife += LIFE_BOO; break;
}
if( m_fLife < 0.0f ) m_fLife = 0.0f;
else if( m_fLife > 1.0f ) m_fLife = 1.0f;
m_pScore->SetScore( m_fScore );
m_pLifeMeter->SetLife( m_fLife );
}
int Player::UpdateMissedStepsOlderThan( FLOAT iMissIfOlderThanThisBeat )
{
//RageLog( "Steps::UpdateMissedStepsOlderThan(%f)", iMissIfOlderThanThisBeat );
int iMissIfOlderThanThisIndex = BeatToStepIndex( iMissIfOlderThanThisBeat );
int Player::UpdateStepsMissedOlderThan( float fMissIfOlderThanThisBeat )
{
//RageLog( "Steps::UpdateStepsMissedOlderThan(%f)", fMissIfOlderThanThisBeat );
int iMissIfOlderThanThisIndex = BeatToStepIndex( fMissIfOlderThanThisBeat );
int iNumMissesFound = 0;
// Since this is being called frame, let's not check the whole array every time.
// Instead, only check 10 elements back. Even 10 is overkill.
int iStartCheckingAt = max( 0, iMissIfOlderThanThisIndex-10 );
for( int i=0; i<iMissIfOlderThanThisIndex; i++ )
for( int i=iStartCheckingAt; i<iMissIfOlderThanThisIndex; i++ )
{
// RageLog( "Step %d: status == %d, score == %d", i, StatusArray[i], Score[i] );
if( m_Steps.StatusArray[i] == not_stepped_on && m_StepScore[i] == no_score )
if( m_LeftToStepOn[i] != 0 )
{
m_StepScore[i] = miss;
iNumMissesFound++;
@@ -251,7 +334,7 @@ ScoreSummary Player::GetScoreSummary()
{
ScoreSummary scoreSummary;
for( int i=0; i<m_StepScore.GetSize(); i++ )
for( int i=0; i<MAX_STEP_ELEMENTS; i++ )
{
switch( m_StepScore[i] )
{
@@ -260,11 +343,325 @@ ScoreSummary Player::GetScoreSummary()
case good: scoreSummary.good++; break;
case boo: scoreSummary.boo++; break;
case miss: scoreSummary.miss++; break;
case no_score: break;
case none: break;
}
}
scoreSummary.max_combo = m_iMaxCombo;
scoreSummary.score = m_fScore;
return scoreSummary;
}
void Player::UpdateGrayArrows( const float &fDeltaTime )
{
for( int i=0; i<4; i++ )
m_sprGrayArrow[i].Update( fDeltaTime );
for( i=0; i<4; i++ )
m_sprGrayArrowGhost[i].Update( fDeltaTime );
}
void Player::DrawGrayArrows()
{
for( int i=0; i<4; i++ )
m_sprGrayArrow[i].Draw();
}
void Player::SetGrayArrowsX( int iNewX )
{
for( int i=0; i<4; i++ )
m_sprGrayArrow[i].SetXY( iNewX + ARROW_X_OFFSET[i], GRAY_ARROW_Y );
}
void Player::SetColorArrowsX( int iNewX )
{
}
void Player::GrayArrowStep( int index )
{
m_sprGrayArrow[index].SetZoom( 0.50 );
m_sprGrayArrow[index].TweenTo( GRAY_ARROW_POP_UP_TIME,
m_sprGrayArrow[index].GetX(),
m_sprGrayArrow[index].GetY(),
1.0f );
}
void Player::GrayArrowGhostStep( int index )
{
m_sprGrayArrowGhost[index].SetXY( m_iArrowsCenterX + ARROW_X_OFFSET[index], GRAY_ARROW_Y );
m_sprGrayArrowGhost[index].SetZoom( 1 );
m_sprGrayArrowGhost[index].SetColor( D3DXCOLOR(1,1,0.5f,1) );
m_sprGrayArrowGhost[index].SetTweening( 0.3f );
m_sprGrayArrowGhost[index].SetTweenZoom( 1.5 );
m_sprGrayArrowGhost[index].SetTweenColor( D3DXCOLOR(1,1,0.5f,0) );
}
void Player::UpdateColorArrows( const float &fDeltaTime )
{
}
void Player::DrawColorArrows( float fSongBeat )
{
//RageLog( "ColorArrows::Draw(%f)", fSongBeat );
int iBaseFrameNo = (int)(fSongBeat*2.5) % 12; // 2.5 is a "fudge number" :-) This should be based on BPM
int iIndexFirstArrowToDraw = BeatToStepIndex( fSongBeat - 2.0f ); // 2 beats earlier
if( iIndexFirstArrowToDraw < 0 ) iIndexFirstArrowToDraw = 0;
int iIndexLastArrowToDraw = BeatToStepIndex( fSongBeat + 7.0f ); // 7 beats later
//RageLog( "Drawing elements %d through %d", iIndexFirstArrowToDraw, iIndexLastArrowToDraw );
for( int i=iIndexFirstArrowToDraw; i<=iIndexLastArrowToDraw; i++ )
{
if( m_LeftToStepOn[i] != 0 ) // if there is a step here and it hasn't been stepped
{
int iYPos = GetColorArrowYPos( i, fSongBeat );
// calculate which frame to display
int iFrameNo = iBaseFrameNo + m_iColorArrowFrameOffset[i];
iFrameNo = iFrameNo % NUM_FRAMES_IN_COLOR_ARROW_SPRITE;
//RageLog( "iYPos: %d, iFrameNo: %d, m_OriginalStep[i]: %d", iYPos, iFrameNo, m_OriginalStep[i] );
if( m_OriginalStep[i] & STEP_P1_LEFT )
{
//RageLog( "Draw a left arrow at %d, %d", m_iArrowsCenterX + ARROW_X_OFFSET[0], iYPos );
m_sprColorArrow[0].SetXY( m_iArrowsCenterX + ARROW_X_OFFSET[0], iYPos );
m_sprColorArrow[0].SetState( iFrameNo );
m_sprColorArrow[0].Draw();
}
if( m_OriginalStep[i] & STEP_P1_DOWN )
{
m_sprColorArrow[1].SetXY( m_iArrowsCenterX + ARROW_X_OFFSET[1], iYPos );
m_sprColorArrow[1].SetState( iFrameNo );
m_sprColorArrow[1].Draw();
}
if( m_OriginalStep[i] & STEP_P1_UP )
{
m_sprColorArrow[2].SetXY( m_iArrowsCenterX + ARROW_X_OFFSET[2], iYPos );
m_sprColorArrow[2].SetState( iFrameNo );
m_sprColorArrow[2].Draw();
}
if( m_OriginalStep[i] & STEP_P1_RIGHT )
{
m_sprColorArrow[3].SetXY( m_iArrowsCenterX + ARROW_X_OFFSET[3], iYPos );
m_sprColorArrow[3].SetState( iFrameNo );
m_sprColorArrow[3].Draw();
}
} // end if there is a step
} // end foreach arrow to draw
for( i=0; i<4; i++ )
{
m_sprGrayArrowGhost[i].Draw();
}
}
int Player::GetColorArrowYPos( int iStepIndex, float fSongBeat )
{
float fBeatsUntilStep = StepIndexToBeat( iStepIndex ) - fSongBeat;
return (int)(fBeatsUntilStep * ARROW_HEIGHT) + GRAY_ARROW_Y;
}
void Player::SetJudgementX( int iNewX )
{
m_sprJudgement.SetXY( iNewX, CENTER_Y );
}
void Player::UpdateJudgement( const float &fDeltaTime )
{
if( m_fJudgementDisplayCountdown > 0.0 )
m_fJudgementDisplayCountdown -= fDeltaTime;
m_sprJudgement.Update( fDeltaTime );
}
void Player::DrawJudgement()
{
if( m_fJudgementDisplayCountdown > 0.0 )
m_sprJudgement.Draw();
}
void Player::SetJudgement( StepScore score )
{
RageLog( "Judgement::SetJudgement()" );
switch( score )
{
case perfect: m_sprJudgement.SetState( 0 ); break;
case great: m_sprJudgement.SetState( 1 ); break;
case good: m_sprJudgement.SetState( 2 ); break;
case boo: m_sprJudgement.SetState( 3 ); break;
case miss: m_sprJudgement.SetState( 4 ); break;
}
m_fJudgementDisplayCountdown = JUDGEMENT_DISPLAY_TIME;
m_sprJudgement.SetZoom( 1.5f );
m_sprJudgement.TweenTo( JUDGEMENT_DISPLAY_TIME/2.0,
m_sprJudgement.GetX(),
m_sprJudgement.GetY() );
}
void Player::SetComboX( int iNewX )
{
m_sprCombo.SetXY( iNewX+40, COMBO_Y );
m_textComboNum.SetXY( iNewX-50, COMBO_Y );
}
void Player::UpdateCombo( const float &fDeltaTime )
{
m_sprCombo.Update( fDeltaTime );
m_textComboNum.Update( fDeltaTime );
}
void Player::DrawCombo()
{
if( m_bComboVisible )
{
m_textComboNum.Draw();
m_sprCombo.Draw();
}
}
void Player::SetCombo( int iNewCombo )
{
// new max combo
if( iNewCombo > m_iMaxCombo )
m_iMaxCombo = iNewCombo;
m_iCurCombo = iNewCombo;
if( iNewCombo <= 4 )
{
m_bComboVisible = FALSE;
}
else
{
m_bComboVisible = TRUE;
m_textComboNum.SetText( ssprintf("%d", iNewCombo) );
m_textComboNum.SetZoom( 1.0f + iNewCombo/200.0f );
m_textComboNum.TweenTo( COMBO_TWEEN_TIME, m_textComboNum.GetX(), m_textComboNum.GetY() );
}
}
void Player::SetLifeMeterX( int iNewX )
{
m_sprLifeMeterFrame.SetXY( iNewX, LIFEMETER_Y );
m_sprLifeMeterPills.SetXY( iNewX, LIFEMETER_PILLS_Y );
}
void Player::UpdateLifeMeter( const float &fDeltaTime )
{
m_sprLifeMeterFrame.Update( fDeltaTime );
m_sprLifeMeterPills.Update( fDeltaTime );
}
void Player::DrawLifeMeter( float fSongBeat )
{
float fBeatPercentage = fSongBeat - (int)fSongBeat;
int iOffsetStart = roundf( LIEFMETER_NUM_PILLS*fBeatPercentage );
m_sprLifeMeterFrame.Draw();
float iX = m_sprLifeMeterFrame.GetLeftEdge() + 27;
int iNumPills = (int)(m_sprLifeMeterPills.GetNumStates() * m_fLifePercentage);
int iPillWidth = m_sprLifeMeterPills.GetZoomedWidth();
for( int i=0; i<iNumPills; i++ )
{
m_sprLifeMeterPills.SetState( i );
m_sprLifeMeterPills.SetX( iX );
int iOffsetNum = (iOffsetStart - i + LIEFMETER_NUM_PILLS) % LIEFMETER_NUM_PILLS;
int iOffset = roundf( PILL_OFFSET_Y[iOffsetNum] * m_fLifePercentage * 8.0f );
m_sprLifeMeterPills.SetY( LIFEMETER_PILLS_Y - iOffset );
m_sprLifeMeterPills.Draw();
iX += iPillWidth;
}
}
void Player::ChangeLife( StepScore score )
{
switch( score )
{
case perfect: m_fLifePercentage += LIFE_PERFECT; break;
case great: m_fLifePercentage += LIFE_GREAT; break;
case good: m_fLifePercentage += LIFE_GOOD; break;
case boo: m_fLifePercentage += LIFE_BOO; break;
}
m_fLifePercentage = clamp( m_fLifePercentage, 0, 1 );
if( m_fLifePercentage == 1 )
m_sprLifeMeterFrame.SetEffectCamelion( 5, D3DXCOLOR(0.2f,0.2f,0.2f,1), D3DXCOLOR(1,1,1,1) );
else if( m_fLifePercentage < 0.25f )
m_sprLifeMeterFrame.SetEffectCamelion( 5, D3DXCOLOR(1,0.8f,0.8f,1), D3DXCOLOR(1,0.2f,0.2f,1) );
else
m_sprLifeMeterFrame.SetEffectNone();
}
void Player::SetScoreX( int iNewX )
{
m_sprScoreFrame.SetXY( iNewX, SCORE_Y );
m_textScoreNum.SetXY( iNewX, SCORE_Y );
}
void Player::UpdateScore( const float &fDeltaTime )
{
m_sprScoreFrame.Update( fDeltaTime );
m_textScoreNum.Update( fDeltaTime );
}
void Player::DrawScore()
{
m_textScoreNum.Draw();
m_sprScoreFrame.Draw();
}
void Player::ChangeScore( StepScore score )
{
int iScoreToAdd;
switch( score )
{
case perfect: iScoreToAdd = SCORE_ADD_PERFECT; break;
case great: iScoreToAdd = SCORE_ADD_GREAT; break;
case good: iScoreToAdd = SCORE_ADD_GOOD; break;
case boo: iScoreToAdd = SCORE_ADD_BOO; break;
case miss: break;
}
m_fScore += iScoreToAdd * (1 + m_iCurCombo/200.0f);
// multiply the combo bonus
//m_fScore *= SCORE_MULT_BOO;
m_textScoreNum.SetText( ssprintf( "%9.0f", m_fScore ) );
}
+90 -76
View File
@@ -1,96 +1,110 @@
//-----------------------------------------------------------------------------
// File: Player.h
//
// 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.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
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 "GameOptions.h"
#include "GrayArrows.h"
#include "GameInfo.h" // for ScoreSummary
#include "Steps.h"
#include "ColorArrows.h"
#include "Judgement.h"
#include "Combo.h"
#include "Score.h"
#include "LifeMeter.h"
enum StepScore { no_score, perfect, great, good, boo, miss };
#include "Sprite.h"
#include "BitmapText.h"
class Player
{
public:
Player()
{
m_fSongBeat = 0.0;
Player();
for( int i=0; i<2; i++ ) {
for( int j=0; j<4; j++ ) {
m_fStepCountDown[i][j] = 0.0;
}
}
void SetSteps( const Steps& newSteps );
void SetX( int iX );
void Update( const float &fDeltaTime, float fSongBeat, float fMaxBeatDifference );
void Draw( float fSongBeat );
m_pGA = NULL;
m_pCA = NULL;
m_pJudgement = NULL;
m_pCombo = NULL;
m_pScore = NULL;
m_pLifeMeter = NULL;
m_iCurCombo = 0;
m_iMaxCombo = 0;
m_fScore = 0.0f;
m_fLife = 0.50f;
};
~Player() {};
void Set( GrayArrows *pGA, ColorArrows *pCA,
Judgement *pJ, Combo *pC,
Score *pS, LifeMeter *pL,
Steps steps, FLOAT fMaxBeatDifference );
void SetSongBeat( const FLOAT &fSongBeat ) { m_fSongBeat = fSongBeat; };
void Update( const FLOAT &fDeltaTime );
void StepOn( Step player_step );
void HandleStep();
int UpdateMissedStepsOlderThan( FLOAT iMissIfOlderThanThisBeat );
FLOAT GetLife() { return m_fLife; };
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;
FLOAT m_fSongBeat;
FLOAT m_fMaxBeatDifference;
// 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;
// step cache (so player doesn't have to hit buttons
// on exact same update in order to hit two arrow notes)
FLOAT m_fStepCountDown[2][4];
GrayArrows *m_pGA;
ColorArrows *m_pCA;
Judgement *m_pJudgement;
Combo *m_pCombo;
Score *m_pScore;
LifeMeter *m_pLifeMeter;
Steps m_Steps;
CArray<StepScore, StepScore&> m_StepScore;
int m_iCurCombo;
int m_iMaxCombo;
FLOAT m_fLife;
FLOAT m_fScore;
};
+9 -7
View File
@@ -1,11 +1,13 @@
#include "stdafx.h"
//-----------------------------------------------------------------------------
// File: RageBitmapTexture.cpp
//
// Desc:
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
File: RageBitmapTexture.h
Desc: Holder for a static texture with metadata. Can load just about any image format.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
+10 -7
View File
@@ -1,10 +1,13 @@
//-----------------------------------------------------------------------------
// File: RageBitmapTexture.h
//
// Desc:
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
File: RageBitmapTexture.h
Desc: Holder for a static texture with metadata. Can load just about any image format.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
class RageBitmapTexture;
typedef RageBitmapTexture* LPRageBitmapTexture;
+10 -7
View File
@@ -1,11 +1,14 @@
#include "stdafx.h"
//-----------------------------------------------------------------------------
// File: RageInput.cpp
//
// Desc: DirectInput wrapper class
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
File: RageInput.h
Desc: Wrapper for DirectInput. Generates InputEvents.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// In-line Links
+9 -7
View File
@@ -1,10 +1,12 @@
//-----------------------------------------------------------------------------
// File: RageInput.h
//
// Desc: DirectInput wrapper class
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
File: RageInput.h
Desc: Wrapper for DirectInput. Generates InputEvents.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
#ifndef _RAGEINPUT_H_
#define _RAGEINPUT_H_
+9 -7
View File
@@ -1,11 +1,13 @@
#include "stdafx.h"
//-----------------------------------------------------------------------------
// File: RageMovieTexture.cpp
//
// Desc: Based on the DShowTextures example in the DX8 SDK.
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
File: RageMovieTexture.h
Desc: Based on the DShowTextures example in the DX8 SDK.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
+10 -7
View File
@@ -1,10 +1,13 @@
//-----------------------------------------------------------------------------
// File: RageMovieTexture.h
//
// Desc: Based on the DShowTextures example in the DX8 SDK.
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
File: RageMovieTexture.h
Desc: Based on the DShowTextures example in the DX8 SDK.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
#ifndef _RAGEMOVIETEXTURE_H_
#define _RAGEMOVIETEXTURE_H_
+8 -7
View File
@@ -1,12 +1,13 @@
#include "stdafx.h"
//-----------------------------------------------------------------------------
// File: RageSound.cpp
//
// Desc: Sound effects library (currently a wrapper around Bass Sound Library).
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
File: RageSound.cpp
Desc: Sound effects library (currently a wrapper around Bass Sound Library).
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
#include "RageSound.h"
+10 -7
View File
@@ -1,10 +1,13 @@
//-----------------------------------------------------------------------------
// File: RageSound.h
//
// Desc: Sound effects library (currently a wrapper around Bass Sound Library).
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
File: RageSound.h
Desc: Sound effects library (currently a wrapper around Bass Sound Library).
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
#ifndef _RAGESOUND_H_
#define _RAGESOUND_H_
+9 -7
View File
@@ -1,11 +1,13 @@
#include "stdafx.h"
//-----------------------------------------------------------------------------
// File: RageTexture.cpp
//
// Desc:
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
File: RageTexture.h
Desc: Abstract class for a texture with metadata.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
+9 -7
View File
@@ -1,10 +1,12 @@
//-----------------------------------------------------------------------------
// File: RageTexture.h
//
// Desc:
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
File: RageTexture.h
Desc: Abstract class for a texture with metadata.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
class RageTexture;
typedef RageTexture* LPRageTexture;
+9 -7
View File
@@ -1,11 +1,13 @@
#include "stdafx.h"
//-----------------------------------------------------------------------------
// File: RageTextureManager.cpp
//
// Desc: Loads and releases textures
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
File: RageTextureManager.cpp
Desc: Interface for loading and releasing textures.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
+9 -7
View File
@@ -1,10 +1,12 @@
//-----------------------------------------------------------------------------
// File: RageTextureManager.h
//
// Desc: Loads and releases textures
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
File: RageTextureManager.h
Desc: Interface for loading and releasing textures.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
class RageTextureManager;
typedef RageTextureManager* LPRageTextureManager;
+9 -7
View File
@@ -1,11 +1,13 @@
#include "stdafx.h"
//-----------------------------------------------------------------------------
// File: RageUtil.cpp
//
// Desc:
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
File: RageUtil.cpp
Desc: Helper and error-controlling function used throughout the program.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
#include "RageUtil.h"
+19 -7
View File
@@ -1,10 +1,12 @@
//-----------------------------------------------------------------------------
// File: RageUtil.h
//
// Desc:
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
File: RageUtil.h
Desc: Helper and error-controlling function used throughout the program.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
#ifndef _RAGEUTIL_H_
#define _RAGEUTIL_H_
@@ -23,6 +25,16 @@
#define RECTWIDTH(rect) ((rect).right - (rect).left)
#define RECTHEIGHT(rect) ((rect).bottom - (rect).top)
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
#define clamp(val,low,high) ( min( (val), max((low),(high)) ) )
//-----------------------------------------------------------------------------
// Misc helper functions
+51 -126
View File
@@ -1,11 +1,13 @@
#include "stdafx.h"
//-----------------------------------------------------------------------------
// File: Song.cpp
//
// Desc: Holds metadata for a song and the song's step data.
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
File: Song.h
Desc: Holds metadata for a song and the song's step data.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
#include "Util.h"
@@ -21,6 +23,11 @@
//////////////////////////////
// Song
//////////////////////////////
Song::Song()
{
m_fBPM = 0;
m_fBeatOffset = 0;
}
bool Song::LoadFromSongDir( CString sDir )
{
@@ -57,8 +64,15 @@ bool Song::LoadFromSongDir( CString sDir )
if( iNumBMSFiles > 0 )
{
for( int i=0; i<iNumBMSFiles; i++ )
LoadFromBMSFile( sDir + arrayBMSFileNames.GetAt(i) );
// Load the Song info from the first BMS file. Silly BMS duplicates the song info in every
// file, so this method assumes that the song info is identical for every BMS file in
// the directory.
LoadSongInfoFromBMSFile( sDir + arrayBMSFileNames.GetAt(0) );
for( int i=0; i<iNumBMSFiles; i++ ) {
arraySteps.SetSize( arraySteps.GetSize()+1 );
Steps &new_steps = arraySteps[ arraySteps.GetSize()-1 ];
new_steps.LoadStepsFromBMSFile( sDir + arrayBMSFileNames.GetAt(i) );
}
}
else if( iNumMSDFiles == 1 )
{
@@ -76,55 +90,46 @@ bool Song::LoadFromSongDir( CString sDir )
}
BOOL Song::LoadFromBMSFile( CString sPath )
bool Song::LoadSongInfoFromBMSFile( CString sPath )
{
RageLog( "Song::LoadFromBMSFile(%s)", sPath );
BmsFile bms( sPath );
bms.ReadFile();
Steps new_steps; // just assume one steps per file for now
CMapStringToString &mapValues = bms.mapValues;
POSITION pos = mapValues.GetStartPosition();
while( pos != NULL )
{
CString valuename;
CString value_name;
CString data_string;
CStringArray data_array;
mapValues.GetNextAssoc( pos, valuename, data_string );
mapValues.GetNextAssoc( pos, value_name, data_string );
split(data_string, ":", data_array);
// handle the data
if( valuename == "#PLAYER" )
;
else if( valuename == "#GENRE" )
if( value_name == "#GENRE" )
m_sCreator = data_array[0];
else if( valuename == "#TITLE" )
else if( value_name == "#TITLE" ) {
m_sTitle = data_array[0];
else if( valuename == "#ARTIST" )
// strip steps type out of description leaving only song title (looks like 'Music <BASIC>')
int iPosBracket = m_sTitle.Find( " <" );
if( iPosBracket != -1 )
m_sTitle = m_sTitle.Left( iPosBracket );
}
else if( value_name == "#ARTIST" )
m_sArtist = data_array[0];
else if( valuename == "#BPM" )
else if( value_name == "#BPM" )
m_fBPM = (FLOAT)atof( data_array[0] );
else if( valuename == "#PLAYLEVEL" )
new_steps.iDifficulty = atoi( data_array[0] );
else if( valuename == "#BackBMP" || valuename == "#backBMP")
else if( value_name == "#BackBMP" || value_name == "#backBMP")
m_sBackground = data_array[0];
else if( valuename == "#WAV99" )
else if( value_name == "#WAV99" )
m_sMusic = data_array[0];
else if( valuename.GetLength() == 6 ) // this is probably step or offset data. Looks like "#00705"
else if( value_name.GetLength() == 6 ) // this is probably step or offset data. Looks like "#00705"
{
int iMeasureNo = atoi( valuename.Mid(1,3) );
int iNoteNum = atoi( valuename.Mid(4,2) );
int iMeasureNo = atoi( value_name.Mid(1,3) );
int iNoteNum = atoi( value_name.Mid(4,2) );
CString sNoteData = data_array[0];
CArray<BOOL, BOOL&> arrayNotes;
@@ -146,107 +151,27 @@ BOOL Song::LoadFromBMSFile( CString sPath )
// index is in quarter beats starting at beat 0
int iStepIndex = (int) ( (iMeasureNo + fPercentThroughMeasure)
* BEATS_IN_MEASURE * ELEMENTS_PER_BEAT );
// BMS encoding:
// 4&8panel: Player1 Player2
// Left 11 21
// Down 13 23
// Up 15 25
// Right 16 26
// 6panel: Player1 Player2
// Left 11 21
// Left+Up 12 22
// Down 13 23
// Up 14 24
// Up+Right 15 25
// Right 16 26
//
// Notice that 15 and 25 have two different meanings! What were they thinking???
// While reading in, use the 6 panel mapping. After reading in, detect if only 4 notes
// are filled in. If so, shift the Up+Right column back to the Up column
//
// Our internal encoding:
// 0x0001 left player 1
// 0x0002 left+up player 1
// 0x0004 down player 1
// 0x0008 up player 1
// 0x0010 up+right player 1
// 0x0020 right player 1
// 0x0040 left player 2
// 0x0080 left+up player 2
// 0x0100 down player 2
// 0x0200 up player 2
// 0x0400 up+right player 2
// 0x0800 right player 2
CMap<int, int, Step, Step> mapBMSNumberToOurStepBit;
mapBMSNumberToOurStepBit[11] = 0x0001;
mapBMSNumberToOurStepBit[12] = 0x0002;
mapBMSNumberToOurStepBit[13] = 0x0004;
mapBMSNumberToOurStepBit[14] = 0x0008;
mapBMSNumberToOurStepBit[15] = 0x0010;
mapBMSNumberToOurStepBit[16] = 0x0020;
mapBMSNumberToOurStepBit[21] = 0x0040;
mapBMSNumberToOurStepBit[22] = 0x0080;
mapBMSNumberToOurStepBit[23] = 0x0100;
mapBMSNumberToOurStepBit[24] = 0x0200;
mapBMSNumberToOurStepBit[25] = 0x0400;
mapBMSNumberToOurStepBit[26] = 0x0800;
new_steps.StepArray[iStepIndex] |= mapBMSNumberToOurStepBit[iNoteNum];
new_steps.StatusArray[iStepIndex] = not_stepped_on;
* BEATS_PER_MEASURE * ELEMENTS_PER_BEAT );
switch( iNoteNum )
{
case 01: // offset
m_fBeatOffset = StepIndexToBeat(iStepIndex);
//RageLog( "Found offset to be index %d, beat %f", iStepIndex, StepIndexToBeat(iStepIndex) );
break;
}
}
}
}
}
int iNumSteps = 0;
for( int i=0; i<new_steps.StatusArray.GetSize(); i++ ) {
if( new_steps.StatusArray[i] == not_stepped_on ) {
iNumSteps++;
}
}
RageLog( "%d of %d steps elements are filled", iNumSteps, new_steps.StatusArray.GetSize() );
// we're done reading in all of the BMS values
if( m_sTitle.Find("<BASIC>") >0 ) new_steps.sDescription = "BASIC";
else if( m_sTitle.Find("<ANOTHER>") >0 ) new_steps.sDescription = "ANOTHER";
else if( m_sTitle.Find("<TRICK>") >0 ) new_steps.sDescription = "TRICK";
else if( m_sTitle.Find("<MANIAC>") >0 ) new_steps.sDescription = "MANIAC";
else if( m_sTitle.Find("<SSR>") >0 ) new_steps.sDescription = "SSR";
else if( m_sTitle.Find("<6PANELS BASIC>") >0 ) new_steps.sDescription = "BASIC";
else if( m_sTitle.Find("<6PANELS ANOTHER>") >0 ) new_steps.sDescription = "ANOTHER";
else if( m_sTitle.Find("<6PANELS TRICK>") >0 ) new_steps.sDescription = "TRICK";
else if( m_sTitle.Find("<6PANELS MANIAC>") >0 ) new_steps.sDescription = "MANIAC";
else if( m_sTitle.Find("<6PANELS SSR>") >0 ) new_steps.sDescription = "SSR";
else if( m_sTitle.Find("<BASIC DOUBLE>") >0 ) new_steps.sDescription = "BASIC DOUBLE";
else if( m_sTitle.Find("<ANOTHER DOUBLE>") >0 ) new_steps.sDescription = "ANOTHER DOUBLE";
else if( m_sTitle.Find("<TRICK DOUBLE>") >0 ) new_steps.sDescription = "TRICK DOUBLE";
else if( m_sTitle.Find("<MANIAC DOUBLE>") >0 ) new_steps.sDescription = "MANIAC DOUBLE";
else if( m_sTitle.Find("<SSR DOUBLE>") >0 ) new_steps.sDescription = "SSR DOUBLE";
else if( m_sTitle.Find("<COUPLE>") >0 ) new_steps.sDescription = "COUPLE";
else if( m_sTitle.Find("<BATTLE>") >0 ) new_steps.sDescription = "BATTLE";
else new_steps.sDescription = "UNKNOWN";
if( new_steps.sDescription.Find("COUPLE") >0 ) new_steps.type = st_couple;
else if( new_steps.sDescription.Find("BATTLE") >0 ) new_steps.type = st_couple;
else if( new_steps.sDescription.Find("DOUBLE") >0 ) new_steps.type = st_double;
else new_steps.type = st_single;
arraySteps.Add( new_steps );
// strip steps type out of description
m_sTitle.Replace( " <" + new_steps.sDescription + ">", "" );
FillEmptyValuesWithDefaults();
return TRUE;
}
BOOL Song::LoadFromMSDFile( CString sPath )
bool Song::LoadSongInfoFromMSDFile( CString sPath )
{
RageLog( "Song::LoadFromMSDFile(%s)", sPath );
@@ -361,11 +286,11 @@ void Song::FillEmptyValuesWithDefaults()
if( m_sTitle == "" ) m_sTitle = "Untitled song";
if( m_sArtist == "" ) m_sArtist = "Unknown artist";
if( m_sCreator == "" ) m_sCreator = "";
if( m_fBPM == 0.0 )
if( m_fBPM == 0 )
RageError( ssprintf("No #BPM specified in '%s.'", GetSongFilePath()) );
if( m_fBeatOffset == 0.0 )
RageLog( "Warning: #OFFSET or #GAP in '%s' is either 0.0, or was missing.", GetSongFilePath() );
RageLog( "WARNING: #OFFSET or #GAP in '%s' is either 0.0, or was missing.", GetSongFilePath() );
if( m_sMusic == "" )
{
+9 -7
View File
@@ -1,11 +1,13 @@
#include "stdafx.h"
//-----------------------------------------------------------------------------
// File: Sprite.cpp
//
// Desc: A bitmap actor that animates and moves around.
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
File: Sprite.cpp
Desc: A bitmap actor that animates and moves around.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
#include "Sprite.h"
+9 -7
View File
@@ -1,10 +1,12 @@
//-----------------------------------------------------------------------------
// File: Sprite.h
//
// Desc: A bitmap Actor that animates and moves around.
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
File: Sprite.h
Desc: A bitmap Actor that animates and moves around.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
#ifndef _SPRITE_H_
#define _SPRITE_H_
+11 -3
View File
@@ -1,6 +1,14 @@
// stdafx.cpp : source file that includes just the standard includes
// Basic.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
/*
-----------------------------------------------------------------------------
File: stdafx.cpp
Desc: Basic.pch will be the pre-compiled header
stdafx.obj will contain the pre-compiled type information.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
#include "stdafx.h"
+9 -4
View File
@@ -1,7 +1,12 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
/*
-----------------------------------------------------------------------------
File: stdafx.h
Desc: Include file for standard system include files.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
#if !defined(AFX_STDAFX_H__9FF379EB_FAE2_11D1_BFC5_D41F722B624A__INCLUDED_)
#define AFX_STDAFX_H__9FF379EB_FAE2_11D1_BFC5_D41F722B624A__INCLUDED_
+20 -19
View File
@@ -1,11 +1,13 @@
#include "stdafx.h"
//-----------------------------------------------------------------------------
// File: StepMania.cpp
//
// Desc:
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
File: StepMania.cpp
Desc:
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
//-----------------------------------------------------------------------------
// Includes
@@ -18,7 +20,7 @@
#include "RageMusic.h"
#include "RageInput.h"
#include "GameOptions.h"
#include "GameInfo.h"
#include "WindowManager.h"
#include "WindowIntroCovers.h"
@@ -42,9 +44,7 @@ const CString g_sAppClassName = "StepMania Class";
HWND g_hWndMain; // Main Window Handle
HINSTANCE g_hInstance; // The Handle to Window Instance
const DWORD g_dwScreenWidth = 640; // The window width
const DWORD g_dwScreenHeight = 480; // The window height
#include "ScreenDimensions.h"
const DWORD g_dwWindowStyle = WS_VISIBLE|WS_POPUP|WS_CAPTION|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_SYSMENU;
@@ -101,7 +101,7 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow )
// Set the window's initial width
RECT rcWnd;
SetRect( &rcWnd, 0, 0, g_dwScreenWidth, g_dwScreenHeight );
SetRect( &rcWnd, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
AdjustWindowRect( &rcWnd, g_dwWindowStyle, FALSE );
@@ -198,7 +198,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
// don't allow the window to be resized smaller than the screen resolution
RECT rcWnd;
SetRect( &rcWnd, 0, 0, g_dwScreenWidth, g_dwScreenHeight );
SetRect( &rcWnd, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
DWORD dwWindowStyle = GetWindowLong( g_hWndMain, GWL_STYLE );
AdjustWindowRect( &rcWnd, dwWindowStyle, FALSE );
@@ -289,7 +289,7 @@ HRESULT CreateObjects( HWND hWnd )
MUSIC = new RageMusic;
INPUT = new RageInput( hWnd );
GAMEOPTIONS = new GameOptions;
GAMEINFO = new GameInfo;
WM = new WindowManager;
RageLogStart();
@@ -297,6 +297,7 @@ HRESULT CreateObjects( HWND hWnd )
WM->SetNewWindow( new WindowIntroCovers );
srand( (unsigned)time(NULL) );
// Start the accurate timer
DXUtil_Timer( TIMER_START );
@@ -313,7 +314,7 @@ void DestroyObjects()
DXUtil_Timer( TIMER_STOP );
SAFE_DELETE( WM );
SAFE_DELETE( GAMEOPTIONS );
SAFE_DELETE( GAMEINFO );
SAFE_DELETE( INPUT );
SAFE_DELETE( MUSIC );
@@ -339,7 +340,7 @@ HRESULT RestoreObjects()
SetRect( &rcWnd, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN) );
else // if( !g_bFullscreen )
{
SetRect( &rcWnd, 0, 0, g_dwScreenWidth, g_dwScreenHeight );
SetRect( &rcWnd, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT );
AdjustWindowRect( &rcWnd, g_dwWindowStyle, FALSE );
}
@@ -404,7 +405,7 @@ void Update()
while( pos != NULL )
{
ri = listRawInput.GetNext( pos );
pi = GAMEOPTIONS->RawToPad( ri );
pi = GAMEINFO->RawToPad( ri );
WM->Input( ri, pi );
}
@@ -471,7 +472,7 @@ void SetFullscreen( BOOL bFullscreen )
InvalidateObjects();
g_bFullscreen = bFullscreen;
SCREEN->SwitchDisplayModes( g_bFullscreen,
g_dwScreenWidth,
g_dwScreenHeight );
SCREEN_WIDTH,
SCREEN_HEIGHT );
RestoreObjects();
}
+6 -50
View File
@@ -308,22 +308,6 @@ SOURCE=.\button.h
# End Source File
# Begin Source File
SOURCE=.\ColorArrows.cpp
# End Source File
# Begin Source File
SOURCE=.\ColorArrows.h
# End Source File
# Begin Source File
SOURCE=.\Combo.cpp
# End Source File
# Begin Source File
SOURCE=.\Combo.h
# End Source File
# Begin Source File
SOURCE=.\FootBar.cpp
# End Source File
# Begin Source File
@@ -332,35 +316,11 @@ SOURCE=.\FootBar.h
# End Source File
# Begin Source File
SOURCE=.\GameOptions.cpp
SOURCE=.\GameInfo.cpp
# End Source File
# Begin Source File
SOURCE=.\GameOptions.h
# End Source File
# Begin Source File
SOURCE=.\GrayArrows.cpp
# End Source File
# Begin Source File
SOURCE=.\GrayArrows.h
# End Source File
# Begin Source File
SOURCE=.\Judgement.cpp
# End Source File
# Begin Source File
SOURCE=.\Judgement.h
# End Source File
# Begin Source File
SOURCE=.\LifeMeter.cpp
# End Source File
# Begin Source File
SOURCE=.\LifeMeter.h
SOURCE=.\GameInfo.h
# End Source File
# Begin Source File
@@ -384,14 +344,6 @@ SOURCE=.\previewgraphic.h
# End Source File
# Begin Source File
SOURCE=.\Score.cpp
# End Source File
# Begin Source File
SOURCE=.\Score.h
# End Source File
# Begin Source File
SOURCE=.\Song.cpp
# End Source File
# Begin Source File
@@ -456,6 +408,10 @@ SOURCE=.\resource.h
# End Source File
# Begin Source File
SOURCE=.\ScreenDimensions.h
# End Source File
# Begin Source File
SOURCE=.\StdAfx.cpp
# End Source File
# Begin Source File
+8 -7
View File
@@ -1,12 +1,13 @@
#include "stdafx.h"
//-----------------------------------------------------------------------------
// File: Transition.cpp
//
// Desc: Abstract base class for all transitions
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
File: Transition.cpp
Desc: Abstract base class for all transitions.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
#include "RageUtil.h"
+9 -7
View File
@@ -1,10 +1,12 @@
//-----------------------------------------------------------------------------
// File: Transition.cpp
//
// Desc: Abstract base class for all transitions
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
File: Transition.cpp
Desc: Abstract base class for all transitions.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
#ifndef _Transition_H_
+9 -7
View File
@@ -1,11 +1,13 @@
#include "stdafx.h"
//-----------------------------------------------------------------------------
// File: TransitionFade.cpp
//
// Desc: "Window blinds"-type transition.
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
File: TransitionFade.cpp
Desc: Fades out or in.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
#include "RageUtil.h"
+9 -7
View File
@@ -1,10 +1,12 @@
//-----------------------------------------------------------------------------
// File: TransitionFade.cpp
//
// Desc: "Window blinds"-type transition.
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
File: TransitionFade.cpp
Desc: Fades out or in.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
#ifndef _TransitionFade_H_
+9 -7
View File
@@ -1,11 +1,13 @@
#include "stdafx.h"
//-----------------------------------------------------------------------------
// File: TransitionFadeWipe.cpp
//
// Desc: "Window blinds"-type transition.
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
File: TransitionFadeWipe.cpp
Desc: Fades out or in.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
#include "RageUtil.h"
+8 -7
View File
@@ -1,11 +1,12 @@
//-----------------------------------------------------------------------------
// File: TransitionFadeWipe.cpp
//
// Desc: "Window blinds"-type transition.
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
File: TransitionFadeWipe.cpp
Desc: Fades out or in.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
#ifndef _TransitionFadeWipe_H_
#define _TransitionFadeWipe_H_
+8 -7
View File
@@ -1,12 +1,13 @@
#include "stdafx.h"
//-----------------------------------------------------------------------------
// File: TransitionRectWipe.cpp
//
// Desc: "Window blinds"-type transition.
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
File: TransitionStarWipe.cpp
Desc: Black bands (horizontal window blinds) gradually close.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
#include "RageUtil.h"
+8 -7
View File
@@ -1,11 +1,12 @@
//-----------------------------------------------------------------------------
// File: TransitionRectWipe.cpp
//
// Desc: "Window blinds"-type transition.
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
File: TransitionStarWipe.cpp
Desc: Black bands (horizontal window blinds) gradually close.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
#ifndef _TransitionRectWipe_H_
#define _TransitionRectWipe_H_
+8 -7
View File
@@ -1,12 +1,13 @@
#include "stdafx.h"
//-----------------------------------------------------------------------------
// File: TransitionStarWipe.cpp
//
// Desc: "Window blinds"-type transition.
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
File: TransitionStarWipe.cpp
Desc: Shooting start across the screen leave a black trail.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
#include "RageUtil.h"
+8 -7
View File
@@ -1,11 +1,12 @@
//-----------------------------------------------------------------------------
// File: TransitionStarWipe.cpp
//
// Desc: "Window blinds"-type transition.
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
File: TransitionStarWipe.cpp
Desc: Shooting start across the screen leave a black trail.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
#ifndef _TransitionStarWipe_H_
#define _TransitionStarWipe_H_
+18 -23
View File
@@ -1,30 +1,25 @@
//-----------------------------------------------------------------------------
// File: Song.h
//
// Desc: Holds metadata for a song and the song's step data.
//
// Copyright (c) 2001 Chris Danford. All rights reserved.
//-----------------------------------------------------------------------------
/*
-----------------------------------------------------------------------------
File: Song.h
Desc: Holds metadata for a song and the song's step data.
Copyright (c) 2001 Chris Danford. All rights reserved.
-----------------------------------------------------------------------------
*/
#ifndef _SONG_H_
#define _SONG_H_
#include <afxtempl.h>
#include "Steps.h"
#define BEATS_IN_MEASURE 4
class Song
{
public:
Song() :
m_fBPM(0.0),
m_fBeatOffset(0.0)
{
};
Song();
Song( Song &from )
{
Copy( from );
@@ -65,8 +60,8 @@ public:
};
private:
BOOL LoadFromBMSFile( CString sPath );
BOOL LoadFromMSDFile( CString sPath );
bool LoadSongInfoFromBMSFile( CString sPath );
bool LoadSongInfoFromMSDFile( CString sPath );
void FillEmptyValuesWithDefaults();
@@ -82,9 +77,9 @@ public:
CString GetTitle() {return m_sTitle; };
CString GetArtist() {return m_sArtist; };
CString GetCreator() {return m_sCreator; };
FLOAT GetBeatOffset() {return m_fBeatOffset; };
FLOAT GetBPM() {return m_fBPM; };
FLOAT GetBeatsPerSecond() {return m_fBPM / 60.0f; };
float GetBeatOffset() {return m_fBeatOffset; };
float GetBPM() {return m_fBPM; };
float GetBeatsPerSecond() {return m_fBPM / 60.0f; };
public:
@@ -96,8 +91,8 @@ private:
CString m_sTitle;
CString m_sArtist;
CString m_sCreator;
FLOAT m_fBPM;
FLOAT m_fBeatOffset;
float m_fBPM;
float m_fBeatOffset;
CString m_sMusic;
CString m_sSample;