From 8449179efa0239afa27d1658cedb699dab10e58f Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sun, 25 Nov 2001 23:22:20 +0000 Subject: [PATCH] cleanup of textures and fix of many misc bugs --- stepmania/src/FootMeter.cpp | 18 +++++++ stepmania/src/FootMeter.h | 60 +++++++++++++++++++++ stepmania/src/Player.cpp | 82 +++++++++++++++++------------ stepmania/src/Player.h | 2 +- stepmania/src/RageBitmapTexture.cpp | 26 ++++----- stepmania/src/RageTexture.cpp | 4 +- stepmania/src/StepMania.dsp | 4 +- 7 files changed, 145 insertions(+), 51 deletions(-) create mode 100644 stepmania/src/FootMeter.cpp create mode 100644 stepmania/src/FootMeter.h diff --git a/stepmania/src/FootMeter.cpp b/stepmania/src/FootMeter.cpp new file mode 100644 index 0000000000..65594cf1dd --- /dev/null +++ b/stepmania/src/FootMeter.cpp @@ -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" + + + diff --git a/stepmania/src/FootMeter.h b/stepmania/src/FootMeter.h new file mode 100644 index 0000000000..4b35c2de20 --- /dev/null +++ b/stepmania/src/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 0 ) @@ -349,20 +342,20 @@ void Player::OnCompleteStep( float fSongBeat, Step player_step, float fMaxBeatDi // fBeatsUntilStep, fPercentFromPerfect ); // 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; - else if( fPercentFromPerfect < 0.45f ) score = great; - else if( fPercentFromPerfect < 0.75f ) score = good; - else score = boo; + if( fPercentFromPerfect < 0.20f ) stepscore = perfect; + else if( fPercentFromPerfect < 0.45f ) stepscore = great; + else if( fPercentFromPerfect < 0.75f ) stepscore = good; + else stepscore = boo; // update the judgement, score, and life - SetJudgement( score ); - ChangeScore( score ); - ChangeLife( score ); + SetJudgement( stepscore ); + ChangeScore( stepscore, m_iCurCombo ); + ChangeLife( stepscore ); // update the combo display - switch( score ) + switch( stepscore ) { case perfect: case great: @@ -387,13 +380,15 @@ int Player::UpdateStepsMissedOlderThan( float fMissIfOlderThanThisBeat ) // Instead, only check 10 elements back. Even 10 is overkill. int iStartCheckingAt = max( 0, iMissIfOlderThanThisIndex-10 ); + //RageLog( "iStartCheckingAt: %d iMissIfOlderThanThisIndex: %d", iStartCheckingAt, iMissIfOlderThanThisIndex ); for( int i=iStartCheckingAt; i 0 ); - // multiply the combo bonus - //m_fScore *= SCORE_MULT_BOO; m_textScoreNum.SetText( ssprintf( "%9.0f", m_fScore ) ); } \ No newline at end of file diff --git a/stepmania/src/Player.h b/stepmania/src/Player.h index 9a78bb4b2b..27d1555824 100644 --- a/stepmania/src/Player.h +++ b/stepmania/src/Player.h @@ -112,7 +112,7 @@ private: void SetScoreX( int iX ); void UpdateScore( const float& fDeltaTime ); void DrawScore(); - void ChangeScore( StepScore score ); + void ChangeScore( StepScore stepscore, int iCurCombo ); float m_fScore; Sprite m_sprScoreFrame; BitmapText m_textScoreNum; diff --git a/stepmania/src/RageBitmapTexture.cpp b/stepmania/src/RageBitmapTexture.cpp index f908a2cbe6..1e074e8e8b 100644 --- a/stepmania/src/RageBitmapTexture.cpp +++ b/stepmania/src/RageBitmapTexture.cpp @@ -55,7 +55,7 @@ LPDIRECT3DTEXTURE8 RageBitmapTexture::GetD3DTexture() } -VOID RageBitmapTexture::Create() +void RageBitmapTexture::Create() { HRESULT hr; @@ -63,18 +63,18 @@ VOID RageBitmapTexture::Create() // load texture if (FAILED (hr = D3DXCreateTextureFromFileEx( - m_pd3dDevice, - m_sFilePath, - D3DX_DEFAULT, D3DX_DEFAULT, - D3DX_DEFAULT, - 0, - D3DFMT_A4R4G4B4, // this is our preferred format - D3DPOOL_MANAGED, - D3DX_DEFAULT, - D3DX_DEFAULT, - 0, // no color key - &ddii, - NULL, // no palette + m_pd3dDevice, // device + m_sFilePath, // soure file + D3DX_DEFAULT, D3DX_DEFAULT, // width, height + D3DX_DEFAULT, // mip map levels + 0, // usage (is a render target?) + D3DFMT_A4R4G4B4, // our preferred texture format + D3DPOOL_MANAGED, // which memory pool + D3DX_DEFAULT, // filter + D3DX_DEFAULT, // mip filter + 0, // no color key + &ddii, // struct to fill with source image info + NULL, // no palette &m_pd3dTexture ) ) ) RageErrorHr( ssprintf("D3DXCreateTextureFromFileEx() failed for file '%s'.", m_sFilePath), hr ); diff --git a/stepmania/src/RageTexture.cpp b/stepmania/src/RageTexture.cpp index b165607e87..a128cd978a 100644 --- a/stepmania/src/RageTexture.cpp +++ b/stepmania/src/RageTexture.cpp @@ -50,7 +50,7 @@ RageTexture::~RageTexture() } -VOID RageTexture::CreateFrameRects() +void RageTexture::CreateFrameRects() { GetFrameDimensionsFromFileName( m_sFilePath, &m_uFramesWide, &m_uFramesHigh ); @@ -76,7 +76,7 @@ VOID RageTexture::CreateFrameRects() } #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 diff --git a/stepmania/src/StepMania.dsp b/stepmania/src/StepMania.dsp index 4e32e4d8f2..d77ba5832f 100644 --- a/stepmania/src/StepMania.dsp +++ b/stepmania/src/StepMania.dsp @@ -308,11 +308,11 @@ SOURCE=.\BlurredTitle.h # End Source File # Begin Source File -SOURCE=.\FootBar.cpp +SOURCE=.\FootMeter.cpp # End Source File # Begin Source File -SOURCE=.\FootBar.h +SOURCE=.\FootMeter.h # End Source File # Begin Source File