cleanup of textures and fix of many misc bugs
This commit is contained in:
@@ -0,0 +1,18 @@
|
|||||||
|
#include "stdafx.h"
|
||||||
|
/*
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
File: FootMeter.h
|
||||||
|
|
||||||
|
Desc: The song's foot difficulty displayed in SelectSteps.
|
||||||
|
|
||||||
|
Copyright (c) 2001 Chris Danford. All rights reserved.
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "RageUtil.h"
|
||||||
|
|
||||||
|
#include "FootMeter.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
File: FootMeter.h
|
||||||
|
|
||||||
|
Desc: The song's foot difficulty displayed in SelectSteps.
|
||||||
|
|
||||||
|
Copyright (c) 2001 Chris Danford. All rights reserved.
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _FootBar_H_
|
||||||
|
#define _FootBar_H_
|
||||||
|
|
||||||
|
|
||||||
|
#include "Sprite.h"
|
||||||
|
#include "BitmapText.h"
|
||||||
|
|
||||||
|
|
||||||
|
const int MAX_NUM_FEET = 9;
|
||||||
|
|
||||||
|
|
||||||
|
class FootMeter : public Sprite
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
void SetNumFeet( int iNumFeet )
|
||||||
|
{
|
||||||
|
m_iNumFeet = iNumFeet;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Draw()
|
||||||
|
{
|
||||||
|
float fCenterX = GetX();
|
||||||
|
float fCenterY = GetY();
|
||||||
|
float fWidth = GetZoomedWidth() * 0.8f;
|
||||||
|
D3DXCOLOR color = GetColor();
|
||||||
|
|
||||||
|
for( int i=0; i<MAX_NUM_FEET; i++ ) {
|
||||||
|
// set X acording to offset
|
||||||
|
SetX( fCenterX + fWidth * i - fWidth * MAX_NUM_FEET / 2.0f );
|
||||||
|
|
||||||
|
// set color depending on m_iNumFeet
|
||||||
|
if( i < m_iNumFeet )
|
||||||
|
SetColor( color );
|
||||||
|
else
|
||||||
|
SetColor( color * 0.5f + D3DXCOLOR(0,0,0,1) ); // full alpha
|
||||||
|
|
||||||
|
Sprite::Draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
// set properties back to original
|
||||||
|
SetXY( fCenterX, fCenterY );
|
||||||
|
SetColor( color );
|
||||||
|
};
|
||||||
|
|
||||||
|
int m_iNumFeet;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
+49
-33
@@ -17,18 +17,11 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
//const float STEP_DOWN_TIME = 0.05f;
|
|
||||||
|
|
||||||
const int SCORE_ADD_PERFECT = 700;
|
|
||||||
const int SCORE_ADD_GREAT = 400;
|
|
||||||
const int SCORE_ADD_GOOD = 200;
|
|
||||||
const int SCORE_ADD_BOO = 100;
|
|
||||||
|
|
||||||
const float LIFE_PERFECT = 0.015f;
|
const float LIFE_PERFECT = 0.015f;
|
||||||
const float LIFE_GREAT = 0.008f;
|
const float LIFE_GREAT = 0.008f;
|
||||||
const float LIFE_GOOD = 0.000f;
|
const float LIFE_GOOD = 0.000f;
|
||||||
const float LIFE_BOO = -0.015f;
|
const float LIFE_BOO = -0.015f;
|
||||||
const float LIFE_MISS = -0.060f;
|
const float LIFE_MISS = -0.030f;
|
||||||
|
|
||||||
const int ARROW_SIZE = 64;
|
const int ARROW_SIZE = 64;
|
||||||
|
|
||||||
@@ -50,7 +43,7 @@ const CString SPRITE_COLOR_ARROW = "Sprites\\Color Arrow.sprite";
|
|||||||
const CString SPRITE_GRAY_ARROW = "Sprites\\Gray Arrow.sprite";
|
const CString SPRITE_GRAY_ARROW = "Sprites\\Gray Arrow.sprite";
|
||||||
|
|
||||||
|
|
||||||
const float JUDGEMENT_DISPLAY_TIME = 1.0f;
|
const float JUDGEMENT_DISPLAY_TIME = 0.6f;
|
||||||
const CString JUDGEMENT_SPRITE = "Sprites\\Judgement.sprite";
|
const CString JUDGEMENT_SPRITE = "Sprites\\Judgement.sprite";
|
||||||
const float JUDGEMENT_Y = CENTER_Y;
|
const float JUDGEMENT_Y = CENTER_Y;
|
||||||
|
|
||||||
@@ -80,7 +73,7 @@ Player::Player()
|
|||||||
m_iCurCombo = 0;
|
m_iCurCombo = 0;
|
||||||
m_iMaxCombo = 0;
|
m_iMaxCombo = 0;
|
||||||
m_fLifePercentage = 0.50f;
|
m_fLifePercentage = 0.50f;
|
||||||
m_fScore = 0.0f;
|
m_fScore = 0;
|
||||||
|
|
||||||
// init step elements
|
// init step elements
|
||||||
for( int i=0; i<MAX_STEP_ELEMENTS; i++ )
|
for( int i=0; i<MAX_STEP_ELEMENTS; i++ )
|
||||||
@@ -210,7 +203,7 @@ Player::Player()
|
|||||||
|
|
||||||
// score
|
// score
|
||||||
m_sprScoreFrame.LoadFromTexture( SCORE_FRAME_TEXTURE );
|
m_sprScoreFrame.LoadFromTexture( SCORE_FRAME_TEXTURE );
|
||||||
m_textScoreNum.LoadFromFontName( "Arial Bold" );
|
m_textScoreNum.LoadFromFontName( "Arial Black with Outline" );
|
||||||
m_textScoreNum.SetText( " " );
|
m_textScoreNum.SetText( " " );
|
||||||
|
|
||||||
|
|
||||||
@@ -242,7 +235,7 @@ void Player::SetSteps( const Steps& newSteps )
|
|||||||
|
|
||||||
void Player::Update( const float &fDeltaTime, float fSongBeat, float fMaxBeatDifference )
|
void Player::Update( const float &fDeltaTime, float fSongBeat, float fMaxBeatDifference )
|
||||||
{
|
{
|
||||||
//RageLog( "Player::Update(%f)", fDeltaTime );
|
//RageLog( "Player::Update(%f, %f, %f)", fDeltaTime, fSongBeat, fMaxBeatDifference );
|
||||||
|
|
||||||
int iNumMisses = UpdateStepsMissedOlderThan( fSongBeat-fMaxBeatDifference );
|
int iNumMisses = UpdateStepsMissedOlderThan( fSongBeat-fMaxBeatDifference );
|
||||||
if( iNumMisses > 0 )
|
if( iNumMisses > 0 )
|
||||||
@@ -349,20 +342,20 @@ void Player::OnCompleteStep( float fSongBeat, Step player_step, float fMaxBeatDi
|
|||||||
// fBeatsUntilStep, fPercentFromPerfect );
|
// fBeatsUntilStep, fPercentFromPerfect );
|
||||||
|
|
||||||
// compute what the score should be for the note we stepped on
|
// compute what the score should be for the note we stepped on
|
||||||
StepScore &score = m_StepScore[iIndexThatWasSteppedOn];
|
StepScore &stepscore = m_StepScore[iIndexThatWasSteppedOn];
|
||||||
|
|
||||||
if( fPercentFromPerfect < 0.20f ) score = perfect;
|
if( fPercentFromPerfect < 0.20f ) stepscore = perfect;
|
||||||
else if( fPercentFromPerfect < 0.45f ) score = great;
|
else if( fPercentFromPerfect < 0.45f ) stepscore = great;
|
||||||
else if( fPercentFromPerfect < 0.75f ) score = good;
|
else if( fPercentFromPerfect < 0.75f ) stepscore = good;
|
||||||
else score = boo;
|
else stepscore = boo;
|
||||||
|
|
||||||
// update the judgement, score, and life
|
// update the judgement, score, and life
|
||||||
SetJudgement( score );
|
SetJudgement( stepscore );
|
||||||
ChangeScore( score );
|
ChangeScore( stepscore, m_iCurCombo );
|
||||||
ChangeLife( score );
|
ChangeLife( stepscore );
|
||||||
|
|
||||||
// update the combo display
|
// update the combo display
|
||||||
switch( score )
|
switch( stepscore )
|
||||||
{
|
{
|
||||||
case perfect:
|
case perfect:
|
||||||
case great:
|
case great:
|
||||||
@@ -387,13 +380,15 @@ int Player::UpdateStepsMissedOlderThan( float fMissIfOlderThanThisBeat )
|
|||||||
// Instead, only check 10 elements back. Even 10 is overkill.
|
// Instead, only check 10 elements back. Even 10 is overkill.
|
||||||
int iStartCheckingAt = max( 0, iMissIfOlderThanThisIndex-10 );
|
int iStartCheckingAt = max( 0, iMissIfOlderThanThisIndex-10 );
|
||||||
|
|
||||||
|
//RageLog( "iStartCheckingAt: %d iMissIfOlderThanThisIndex: %d", iStartCheckingAt, iMissIfOlderThanThisIndex );
|
||||||
for( int i=iStartCheckingAt; i<iMissIfOlderThanThisIndex; i++ )
|
for( int i=iStartCheckingAt; i<iMissIfOlderThanThisIndex; i++ )
|
||||||
{
|
{
|
||||||
// RageLog( "Step %d: status == %d, score == %d", i, StatusArray[i], Score[i] );
|
//RageLog( "Checking for miss: %d: lefttostepon == %d, score == %d", i, m_LeftToStepOn[i], m_StepScore[i] );
|
||||||
if( m_LeftToStepOn[i] != 0 )
|
if( m_LeftToStepOn[i] != 0 && m_StepScore[i] != miss)
|
||||||
{
|
{
|
||||||
m_StepScore[i] = miss;
|
m_StepScore[i] = miss;
|
||||||
iNumMissesFound++;
|
iNumMissesFound++;
|
||||||
|
ChangeLife( miss );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -568,7 +563,7 @@ void Player::SetJudgement( StepScore score )
|
|||||||
m_fJudgementDisplayCountdown = JUDGEMENT_DISPLAY_TIME;
|
m_fJudgementDisplayCountdown = JUDGEMENT_DISPLAY_TIME;
|
||||||
|
|
||||||
m_sprJudgement.SetZoom( 1.5f );
|
m_sprJudgement.SetZoom( 1.5f );
|
||||||
m_sprJudgement.TweenTo( JUDGEMENT_DISPLAY_TIME/2.0,
|
m_sprJudgement.TweenTo( JUDGEMENT_DISPLAY_TIME/3.0,
|
||||||
m_sprJudgement.GetX(),
|
m_sprJudgement.GetX(),
|
||||||
m_sprJudgement.GetY() );
|
m_sprJudgement.GetY() );
|
||||||
}
|
}
|
||||||
@@ -666,6 +661,7 @@ void Player::ChangeLife( StepScore score )
|
|||||||
case great: m_fLifePercentage += LIFE_GREAT; break;
|
case great: m_fLifePercentage += LIFE_GREAT; break;
|
||||||
case good: m_fLifePercentage += LIFE_GOOD; break;
|
case good: m_fLifePercentage += LIFE_GOOD; break;
|
||||||
case boo: m_fLifePercentage += LIFE_BOO; break;
|
case boo: m_fLifePercentage += LIFE_BOO; break;
|
||||||
|
case miss: m_fLifePercentage += LIFE_MISS; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_fLifePercentage = clamp( m_fLifePercentage, 0, 1 );
|
m_fLifePercentage = clamp( m_fLifePercentage, 0, 1 );
|
||||||
@@ -703,21 +699,41 @@ void Player::DrawScore()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Player::ChangeScore( StepScore score )
|
void Player::ChangeScore( StepScore score, int iCurCombo )
|
||||||
{
|
{
|
||||||
int iScoreToAdd;
|
// The scoring system for DDR versions 1 and 2 (including the Plus remixes) is as follows:
|
||||||
|
// For every step:
|
||||||
|
//
|
||||||
|
// Multiplier (M) = (# of steps in your current combo / 4) rounded down
|
||||||
|
// "Good" step = M * 100 (and this ends your combo)
|
||||||
|
// "Great" step = M * M * 100
|
||||||
|
// "Perfect" step = M * M * 300
|
||||||
|
//
|
||||||
|
// e.g. When you get a 259 combo, the 260th step will earn you:
|
||||||
|
//
|
||||||
|
// M = (260 / 4) rounded down
|
||||||
|
// = 65
|
||||||
|
// step = M x M X 100
|
||||||
|
// = 65 x 65 x 100
|
||||||
|
// = 422,500
|
||||||
|
// Perfect step = Great step score x 3
|
||||||
|
// = 422,500 x 3
|
||||||
|
// = 1,267,500
|
||||||
|
|
||||||
|
float M = iCurCombo/4.0f;
|
||||||
|
|
||||||
|
int iScoreToAdd = 0;
|
||||||
switch( score )
|
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;
|
case miss: break;
|
||||||
|
case boo: break;
|
||||||
|
case good: iScoreToAdd = M * 100 + 100; break;
|
||||||
|
case great: iScoreToAdd = M * M * 100 + 300; break;
|
||||||
|
case perfect: iScoreToAdd = M * M * 300 + 500; break;
|
||||||
}
|
}
|
||||||
m_fScore += iScoreToAdd * (1 + m_iCurCombo/200.0f);
|
m_fScore += iScoreToAdd;
|
||||||
|
ASSERT( m_fScore > 0 );
|
||||||
|
|
||||||
// multiply the combo bonus
|
|
||||||
//m_fScore *= SCORE_MULT_BOO;
|
|
||||||
|
|
||||||
m_textScoreNum.SetText( ssprintf( "%9.0f", m_fScore ) );
|
m_textScoreNum.SetText( ssprintf( "%9.0f", m_fScore ) );
|
||||||
}
|
}
|
||||||
@@ -112,7 +112,7 @@ private:
|
|||||||
void SetScoreX( int iX );
|
void SetScoreX( int iX );
|
||||||
void UpdateScore( const float& fDeltaTime );
|
void UpdateScore( const float& fDeltaTime );
|
||||||
void DrawScore();
|
void DrawScore();
|
||||||
void ChangeScore( StepScore score );
|
void ChangeScore( StepScore stepscore, int iCurCombo );
|
||||||
float m_fScore;
|
float m_fScore;
|
||||||
Sprite m_sprScoreFrame;
|
Sprite m_sprScoreFrame;
|
||||||
BitmapText m_textScoreNum;
|
BitmapText m_textScoreNum;
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ LPDIRECT3DTEXTURE8 RageBitmapTexture::GetD3DTexture()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID RageBitmapTexture::Create()
|
void RageBitmapTexture::Create()
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
@@ -63,18 +63,18 @@ VOID RageBitmapTexture::Create()
|
|||||||
|
|
||||||
// load texture
|
// load texture
|
||||||
if (FAILED (hr = D3DXCreateTextureFromFileEx(
|
if (FAILED (hr = D3DXCreateTextureFromFileEx(
|
||||||
m_pd3dDevice,
|
m_pd3dDevice, // device
|
||||||
m_sFilePath,
|
m_sFilePath, // soure file
|
||||||
D3DX_DEFAULT, D3DX_DEFAULT,
|
D3DX_DEFAULT, D3DX_DEFAULT, // width, height
|
||||||
D3DX_DEFAULT,
|
D3DX_DEFAULT, // mip map levels
|
||||||
0,
|
0, // usage (is a render target?)
|
||||||
D3DFMT_A4R4G4B4, // this is our preferred format
|
D3DFMT_A4R4G4B4, // our preferred texture format
|
||||||
D3DPOOL_MANAGED,
|
D3DPOOL_MANAGED, // which memory pool
|
||||||
D3DX_DEFAULT,
|
D3DX_DEFAULT, // filter
|
||||||
D3DX_DEFAULT,
|
D3DX_DEFAULT, // mip filter
|
||||||
0, // no color key
|
0, // no color key
|
||||||
&ddii,
|
&ddii, // struct to fill with source image info
|
||||||
NULL, // no palette
|
NULL, // no palette
|
||||||
&m_pd3dTexture ) ) )
|
&m_pd3dTexture ) ) )
|
||||||
RageErrorHr( ssprintf("D3DXCreateTextureFromFileEx() failed for file '%s'.", m_sFilePath), hr );
|
RageErrorHr( ssprintf("D3DXCreateTextureFromFileEx() failed for file '%s'.", m_sFilePath), hr );
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ RageTexture::~RageTexture()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID RageTexture::CreateFrameRects()
|
void RageTexture::CreateFrameRects()
|
||||||
{
|
{
|
||||||
GetFrameDimensionsFromFileName( m_sFilePath, &m_uFramesWide, &m_uFramesHigh );
|
GetFrameDimensionsFromFileName( m_sFilePath, &m_uFramesWide, &m_uFramesHigh );
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ VOID RageTexture::CreateFrameRects()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
VOID RageTexture::GetFrameDimensionsFromFileName( CString sPath, UINT* puFramesWide, UINT* puFramesHigh ) const
|
void RageTexture::GetFrameDimensionsFromFileName( CString sPath, UINT* puFramesWide, UINT* puFramesHigh ) const
|
||||||
{
|
{
|
||||||
//////////////////////////////////////////////////
|
//////////////////////////////////////////////////
|
||||||
// Parse m_sFilePath for the frame dimensions
|
// Parse m_sFilePath for the frame dimensions
|
||||||
|
|||||||
@@ -308,11 +308,11 @@ SOURCE=.\BlurredTitle.h
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\FootBar.cpp
|
SOURCE=.\FootMeter.cpp
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\FootBar.h
|
SOURCE=.\FootMeter.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user