no message

This commit is contained in:
Chris Danford
2002-05-29 09:47:24 +00:00
parent f3c360a7d6
commit bfc327df13
27 changed files with 332 additions and 228 deletions
+4 -2
View File
@@ -215,14 +215,16 @@ void Actor::Update( float fDeltaTime )
if( TS.m_fTimeLeftInTween <= 0 ) // The tweening is over. Stop the tweening
{
int i;
m_pos = TS.m_end_pos;
m_scale = TS.m_end_scale;
m_rotation = TS.m_end_rotation;
for(int i=0; i<4; i++) m_colorDiffuse[i] = TS.m_end_colorDiffuse[i];
for(i=0; i<4; i++) m_colorDiffuse[i] = TS.m_end_colorDiffuse[i];
m_colorAdd = TS.m_end_colorAdd;
// delete the head tween
for( int i=0; i<m_iNumTweenStates-1; i++ )
for( i=0; i<m_iNumTweenStates-1; i++ )
m_QueuedTweens[i] = m_QueuedTweens[i+1];
m_iNumTweenStates--;
return;
+84 -42
View File
@@ -229,9 +229,73 @@ void BitmapText::DrawPrimitives()
iY += iHeight;
}
//
pVB->Unlock();
// Set the stage...
LPDIRECT3DDEVICE8 pd3dDevice = DISPLAY->GetDevice();
pd3dDevice->SetTexture( 0, pTexture->GetD3DTexture() );
pd3dDevice->SetRenderState( D3DRS_SRCBLEND, m_bBlendAdd ? D3DBLEND_ONE : D3DBLEND_SRCALPHA );
pd3dDevice->SetRenderState( D3DRS_DESTBLEND, m_bBlendAdd ? D3DBLEND_ONE : D3DBLEND_INVSRCALPHA );
pd3dDevice->SetVertexShader( D3DFVF_RAGEVERTEX );
pd3dDevice->SetStreamSource( 0, pVB, sizeof(RAGEVERTEX) );
//////////////////////
// render the shadow
//////////////////////
if( m_bShadow && m_temp_colorDiffuse[0].a != 0 )
{
DISPLAY->PushMatrix();
DISPLAY->TranslateLocal( m_fShadowLength, m_fShadowLength, 0 ); // shift by 5 units
DWORD dwColor = D3DXCOLOR(0,0,0,0.5f*m_temp_colorDiffuse[0].a); // semi-transparent black
/*
// YUCK. It is very common in crapier drivers that the texture factor doesn't work.
// Too bad because using the texture factor instead of recoloring the verticies is very fast.
pd3dDevice->SetRenderState( D3DRS_TEXTUREFACTOR, dwColor );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TFACTOR );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_TFACTOR );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
*/
// recolor the verticies for a shadow
pVB->Lock( 0, 0, (BYTE**)&v, 0 );
for( int i=0; i<iNumV; i++ )
v[i].color = dwColor;
pVB->Unlock();
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG2 );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, iNumV/3 );
DISPLAY->PopMatrix();
}
//////////////////////
// render the diffuse pass
//////////////////////
//
// set vertex colors for the diffuse pass
//
pVB->Lock( 0, 0, (BYTE**)&v, 0 );
if( m_bRainbow )
{
int color_index = (GetTickCount() / 200) % NUM_RAINBOW_COLORS;
@@ -259,46 +323,6 @@ void BitmapText::DrawPrimitives()
pVB->Unlock();
// Set the stage...
LPDIRECT3DDEVICE8 pd3dDevice = DISPLAY->GetDevice();
pd3dDevice->SetTexture( 0, pTexture->GetD3DTexture() );
pd3dDevice->SetRenderState( D3DRS_SRCBLEND, m_bBlendAdd ? D3DBLEND_ONE : D3DBLEND_SRCALPHA );
pd3dDevice->SetRenderState( D3DRS_DESTBLEND, m_bBlendAdd ? D3DBLEND_ONE : D3DBLEND_INVSRCALPHA );
pd3dDevice->SetVertexShader( D3DFVF_RAGEVERTEX );
pd3dDevice->SetStreamSource( 0, pVB, sizeof(RAGEVERTEX) );
//////////////////////
// render the shadow
//////////////////////
if( m_bShadow && m_temp_colorDiffuse[0].a != 0 )
{
DISPLAY->PushMatrix();
DISPLAY->TranslateLocal( m_fShadowLength, m_fShadowLength, 0 ); // shift by 5 units
DWORD dwColor = D3DXCOLOR(0,0,0,0.5f*m_temp_colorDiffuse[0].a); // semi-transparent black
pd3dDevice->SetRenderState( D3DRS_TEXTUREFACTOR, dwColor );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TFACTOR );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_TFACTOR );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, iNumV/3 );
DISPLAY->PopMatrix();
}
//////////////////////
// render the diffuse pass
//////////////////////
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE );
@@ -315,6 +339,11 @@ void BitmapText::DrawPrimitives()
if( m_temp_colorAdd.a != 0 )
{
DWORD dwColor = m_temp_colorAdd;
/*
// See above comment about some cards not correctly handling the
// texture factor render state.
pd3dDevice->SetRenderState( D3DRS_TEXTUREFACTOR, dwColor );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TFACTOR );
@@ -322,7 +351,20 @@ void BitmapText::DrawPrimitives()
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_TFACTOR );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
*/
// recolor the verticies for
pVB->Lock( 0, 0, (BYTE**)&v, 0 );
for( int i=0; i<iNumV; i++ )
v[i].color = dwColor;
pVB->Unlock();
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG2 );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, iNumV/3 );
}
-2
View File
@@ -71,8 +71,6 @@ void GradeDisplay::SetGrade( Grade g )
StopUsingCustomCoords();
SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
switch( g )
{
case GRADE_AAA: SetState(0); break;
+1 -3
View File
@@ -146,12 +146,10 @@ void GrooveRadar::GrooveRadarValueMap::DrawPrimitives()
LPDIRECT3DVERTEXBUFFER8 pVB = DISPLAY->GetVertexBuffer();
LPDIRECT3DDEVICE8 pd3dDevice = DISPLAY->GetDevice();
pd3dDevice->SetTexture( 0, NULL );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG2 );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG2 );
RAGEVERTEX* v;
for( int p=0; p<NUM_PLAYERS; p++ )
+1
View File
@@ -23,6 +23,7 @@ HoldJudgement::HoldJudgement()
m_fDisplayCountdown = 0;
m_sprJudgement.Load( THEME->GetPathTo(GRAPHIC_GAMEPLAY_JUDGEMENT) );
m_sprJudgement.StopAnimating();
m_sprJudgement.TurnShadowOn();
this->AddActor( &m_sprJudgement );
}
+21 -25
View File
@@ -31,20 +31,24 @@ void LifeMeterBar::ChangeLife( TapNoteScore score )
{
bool bWasDoingGreat = IsDoingGreat();
float fDeltaLife;
switch( score )
{
case TNS_PERFECT: m_fLifePercentage += 0.02f; break;
case TNS_GREAT: m_fLifePercentage += 0.01f; break;
case TNS_GOOD: m_fLifePercentage += 0.00f; break;
case TNS_BOO: m_fLifePercentage -= 0.05f; break;
case TNS_MISS: m_fLifePercentage -= 0.10f; break;
case TNS_PERFECT: fDeltaLife = +0.02f; break;
case TNS_GREAT: fDeltaLife = +0.01f; break;
case TNS_GOOD: fDeltaLife = +0.00f; break;
case TNS_BOO: fDeltaLife = -0.06f; break;
case TNS_MISS: fDeltaLife = -0.12f; break;
}
if( bWasDoingGreat && !IsDoingGreat() )
fDeltaLife = -0.12f; // make it take a while to get back to "doing great"
m_fLifePercentage += fDeltaLife;
m_fLifePercentage = clamp( m_fLifePercentage, 0, 1 );
bool bIsDoingGreat = IsDoingGreat();
if( bWasDoingGreat && !bIsDoingGreat )
m_fLifePercentage -= 0.10f; // make it take a while to get back to "doing great"
if( m_fLifePercentage == 0 )
m_bHasFailed = true;
ResetBarVelocity();
}
@@ -74,24 +78,16 @@ bool LifeMeterBar::HasFailed()
void LifeMeterBar::Update( float fDeltaTime )
{
m_fLifeVelocity *= 1-fDeltaTime*2; // dampen
float fDelta = m_fLifePercentage - m_fTrailingLifePercentage;
m_fLifeVelocity += fDelta * fDeltaTime; // accelerate
m_fLifeVelocity *= 1-fDeltaTime; // dampen
m_fTrailingLifePercentage += m_fLifeVelocity * fDeltaTime;
// there are some cases where we want to snap the meter
bool bSnap = m_fTrailingLifePercentage >= 1;
float fNewDelta = m_fLifePercentage - m_fTrailingLifePercentage;
if( bSnap )
{
m_fTrailingLifePercentage = m_fLifePercentage;
m_fLifeVelocity = 0;
}
else
{
m_fTrailingLifePercentage += m_fLifeVelocity * fDeltaTime;
m_fTrailingLifePercentage = clamp( m_fTrailingLifePercentage, 0, 1 );
}
if( m_fLifePercentage == 0 )
m_bHasFailed = true;
if( fDelta * fNewDelta < 0 ) // the deltas have different signs
m_fLifeVelocity /= 4;
m_fTrailingLifePercentage = clamp( m_fTrailingLifePercentage, 0, 1 );
}
+1 -1
View File
@@ -35,5 +35,5 @@ private:
float m_fLifePercentage;
float m_fTrailingLifePercentage; // this approaches m_fLifePercentage
float m_fLifeVelocity; // how m_fTrailingLifePercentage approaches m_fLifePercentage
bool m_bHasFailed;
bool m_bHasFailed; // set this to true when life dips below 0
};
+5 -3
View File
@@ -190,7 +190,7 @@ void MenuElements::TweenOnScreenFromBlack( ScreenMessage smSendWhenDone )
{
TweenTopLayerOnScreen();
TweenBottomLayerOnScreen();
m_Wipe.OpenWipingRight( smSendWhenDone );
//m_Wipe.OpenWipingRight( smSendWhenDone );
m_soundSwoosh.Play();
}
@@ -201,9 +201,11 @@ void MenuElements::TweenOffScreenToBlack( ScreenMessage smSendWhenDone, bool bPl
TweenTopLayerOffScreen();
TweenBottomLayerOffScreen();
}
m_Wipe.CloseWipingRight( smSendWhenDone );
if( bPlayBackSound )
else
{
m_soundBack.Play();
m_Wipe.CloseWipingLeft( smSendWhenDone );
}
}
void MenuElements::DrawPrimitives()
+57 -30
View File
@@ -146,14 +146,14 @@ void WheelItemDisplay::LoadFromWheelItemData( WheelItemData* pWID )
break;
case TYPE_SONG:
{
m_TextBanner.LoadFromSong( m_pSong );
D3DXCOLOR color = m_color;
color.r += 0.15f;
color.g += 0.15f;
color.b += 0.15f;
m_TextBanner.SetDiffuseColor( color );
m_MusicStatusDisplay.SetType( m_MusicStatusDisplayType );
RefreshGrades();
m_TextBanner.LoadFromSong( m_pSong );
D3DXCOLOR color = m_color;
color.r += 0.15f;
color.g += 0.15f;
color.b += 0.15f;
m_TextBanner.SetDiffuseColor( color );
m_MusicStatusDisplay.SetType( m_MusicStatusDisplayType );
RefreshGrades();
}
break;
case TYPE_ROULETTE:
@@ -167,6 +167,7 @@ void WheelItemDisplay::LoadFromWheelItemData( WheelItemData* pWID )
void WheelItemDisplay::RefreshGrades()
{
// Refresh Grades
for( int p=0; p<NUM_PLAYERS; p++ )
{
if( !GAMEMAN->IsPlayerEnabled( (PlayerNumber)p ) )
@@ -175,20 +176,22 @@ void WheelItemDisplay::RefreshGrades()
continue;
}
const DifficultyClass dc = PREFSMAN->m_PreferredDifficultyClass[p];
if( m_pSong ) // this is a song display
{
const DifficultyClass dc = PREFSMAN->m_PreferredDifficultyClass[p];
const Grade grade = m_pSong->GetGradeForDifficultyClass( GAMEMAN->GetCurrentStyleDef()->m_NotesType, dc );
m_GradeDisplay[p].SetGrade( grade );
m_GradeDisplay[p].SetDiffuseColor( PlayerToColor((PlayerNumber)p) );
//m_GradeDisplay[p].SetDiffuseColor( PlayerToColor((PlayerNumber)p) );
}
else // this is a section display
{
m_GradeDisplay[p].SetGrade( GRADE_NO_DATA );
}
}
}
void WheelItemDisplay::Update( float fDeltaTime )
{
Actor::Update( fDeltaTime );
@@ -247,15 +250,20 @@ MusicWheel::MusicWheel()
GAMEMAN->m_CurStyle = STYLE_DANCE_SINGLE;
m_frameOverlay.SetXY( 0, 0 );
for( int p=0; p<NUM_PLAYERS; p++ )
{
if( !GAMEMAN->IsPlayerEnabled((PlayerNumber)p) )
continue; // skip
m_sprHighScoreFrame[p].Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_SCORE_FRAME) );
m_sprHighScoreFrame[p].SetXY( SCORE_X, SCORE_Y[p] );
this->AddActor( &m_sprHighScoreFrame[p] );
m_frameOverlay.AddActor( &m_sprHighScoreFrame[p] );
m_HighScore[p].SetXY( SCORE_X, SCORE_Y[p]*0.97f );
m_HighScore[p].SetZoom( 0.6f );
this->AddActor( &m_HighScore[p] );
m_frameOverlay.AddActor( &m_HighScore[p] );
}
m_sprHighScoreFrame[1].SetZoomY( -1 ); // flip vertically
@@ -265,11 +273,14 @@ MusicWheel::MusicWheel()
m_sprSelectionOverlay.SetXY( 0, 0 );
m_sprSelectionOverlay.SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
m_sprSelectionOverlay.SetEffectGlowing( 1.0f, D3DXCOLOR(1,1,1,0.4f), D3DXCOLOR(1,1,1,1) );
this->AddActor( &m_sprSelectionOverlay );
m_frameOverlay.AddActor( &m_sprSelectionOverlay );
m_MusicSortDisplay.SetXY( SORT_ICON_ON_SCREEN_X, SORT_ICON_ON_SCREEN_Y );
m_MusicSortDisplay.SetEffectGlowing( 1.0f );
this->AddActor( &m_MusicSortDisplay );
m_frameOverlay.AddActor( &m_MusicSortDisplay );
this->AddActor( &m_frameOverlay );
m_ScrollBar.SetX( SCROLLBAR_X );
this->AddActor( &m_ScrollBar );
@@ -315,7 +326,7 @@ MusicWheel::MusicWheel()
SONGMAN->GetSongsInGroup( SONGMAN->m_sPreferredGroup, arraySongs );
if( arraySongs.GetSize() > 0 )
SONGMAN->m_pCurSong = arraySongs[0]; // select the first song
SONGMAN->SetCurrentSong( arraySongs[0] ); // select the first song
}
@@ -324,7 +335,7 @@ MusicWheel::MusicWheel()
// find the previously selected song (if any)
for( int i=0; i<GetCurWheelItemDatas().GetSize(); i++ )
{
if( GetCurWheelItemDatas()[i].m_pSong == SONGMAN->m_pCurSong )
if( GetCurWheelItemDatas()[i].m_pSong == SONGMAN->GetCurrentSong() )
{
m_iSelection = i; // select it
m_sExpandedSectionName = GetCurWheelItemDatas()[m_iSelection].m_sSectionName; // make its group the currently expanded group
@@ -572,8 +583,8 @@ void MusicWheel::RebuildWheelItemDisplays()
void MusicWheel::NotesChanged( PlayerNumber pn ) // update grade graphics and top score
{
DifficultyClass dc = PREFSMAN->m_PreferredDifficultyClass[pn];
Song* pSong = SONGMAN->m_pCurSong;
Notes* m_pNotes = SONGMAN->m_pCurNotes[pn];
Song* pSong = SONGMAN->GetCurrentSong();
Notes* m_pNotes = SONGMAN->GetCurrentNotes( pn );
if( m_pNotes )
m_HighScore[pn].SetScore( (float)m_pNotes->m_iTopScore );
@@ -886,12 +897,22 @@ void MusicWheel::TweenOnScreen()
}
float fX = GetBannerX(0);
float fY = GetBannerY(0);
m_sprSelectionOverlay.SetXY( fX+320, fY );
m_sprSelectionOverlay.BeginTweeningQueued( 0.5f ); // sleep
m_sprSelectionOverlay.BeginTweeningQueued( 0.2f, Actor::TWEEN_BIAS_BEGIN );
m_sprSelectionOverlay.SetTweenX( fX );
float fX, fY;
fX = GetBannerX(0);
fY = GetBannerY(0);
m_frameOverlay.SetXY( fX+320, fY );
m_frameOverlay.BeginTweeningQueued( 0.5f ); // sleep
m_frameOverlay.BeginTweeningQueued( 0.4f, Actor::TWEEN_BIAS_BEGIN );
m_frameOverlay.SetTweenX( fX );
fX = m_ScrollBar.GetX();
fY = m_ScrollBar.GetY();
m_ScrollBar.SetXY( fX+30, fY );
m_ScrollBar.BeginTweeningQueued( 0.7f ); // sleep
m_ScrollBar.BeginTweeningQueued( 0.2f, Actor::TWEEN_BIAS_BEGIN );
m_ScrollBar.SetTweenX( fX );
for( int i=0; i<NUM_WHEEL_ITEMS_TO_DRAW; i++ )
@@ -927,12 +948,18 @@ void MusicWheel::TweenOffScreen()
}
float fX = GetBannerX(0);
float fY = GetBannerY(0);
m_sprSelectionOverlay.SetXY( fX, fY );
m_sprSelectionOverlay.BeginTweeningQueued( 0 ); // sleep
m_sprSelectionOverlay.BeginTweeningQueued( 0.2f, Actor::TWEEN_BIAS_END );
m_sprSelectionOverlay.SetTweenX( fX+320 );
float fX, fY;
fX = GetBannerX(0);
fY = GetBannerY(0);
m_frameOverlay.SetXY( fX, fY );
m_frameOverlay.BeginTweeningQueued( 0 ); // sleep
m_frameOverlay.BeginTweeningQueued( 0.2f, Actor::TWEEN_BIAS_END );
m_frameOverlay.SetTweenX( fX+320 );
m_ScrollBar.BeginTweeningQueued( 0 );
m_ScrollBar.BeginTweeningQueued( 0.2f, Actor::TWEEN_BIAS_BEGIN );
m_ScrollBar.SetTweenX( m_ScrollBar.GetX()+30 );
for( int i=0; i<NUM_WHEEL_ITEMS_TO_DRAW; i++ )
+5 -2
View File
@@ -120,13 +120,16 @@ protected:
ScrollBar m_ScrollBar;
Sprite m_sprSelectionOverlay;
SongSortOrder m_SortOrder;
MusicSortDisplay m_MusicSortDisplay;
ActorFrame m_frameOverlay;
// Actors inside of m_frameOverlay
Sprite m_sprSelectionOverlay;
Sprite m_sprHighScoreFrame[NUM_PLAYERS];
ScoreDisplayRolling m_HighScore[NUM_PLAYERS];
SongSortOrder m_SortOrder;
CArray<WheelItemData, WheelItemData&> m_WheelItemDatas[NUM_SORT_ORDERS];
CArray<WheelItemData, WheelItemData&> &GetCurWheelItemDatas() { return m_WheelItemDatas[m_SortOrder]; };
+28 -30
View File
@@ -115,14 +115,7 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference
//
// Check for TapNote misses
//
int iNumMisses = UpdateTapNotesMissedOlderThan( m_fSongBeat-fMaxBeatDifference );
if( iNumMisses > 0 )
{
m_Judgement.SetJudgement( TNS_MISS );
m_Combo.EndCombo();
for( int i=0; i<iNumMisses; i++ )
m_pLifeMeter->ChangeLife( TNS_MISS );
}
UpdateTapNotesMissedOlderThan( m_fSongBeat-fMaxBeatDifference );
//
@@ -358,6 +351,8 @@ void Player::CheckForCompleteRow( float fSongBeat, int col, float fMaxBeatDiff )
//LOG->WriteLine( "iIndexStartLookingAt = %d, iNumElementsToExamine = %d", iIndexStartLookingAt, iNumElementsToExamine );
int iIndexOverlappingNote = -1; // leave as -1 if we don't find any
// 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++ )
{
@@ -374,38 +369,35 @@ void Player::CheckForCompleteRow( float fSongBeat, int col, float fMaxBeatDiff )
//LOG->WriteLine( "Checking Notes[%d]", iCurrentIndexEarlier );
if( m_TapNotes[col][iCurrentIndexEarlier] != '0' ) // these Notes overlap
{
m_TapNotes[col][iCurrentIndexEarlier] = '0'; // mark hit
bool bRowDestroyed = true;
for( int t=0; t<m_iNumTracks; t++ ) // did this complete the elminiation of the row?
{
if( m_TapNotes[col][iCurrentIndexEarlier] != '0' )
bRowDestroyed = false;
}
if( bRowDestroyed )
OnRowDestroyed( fSongBeat, col, fMaxBeatDiff, iCurrentIndexEarlier );
return;
iIndexOverlappingNote = iCurrentIndexEarlier;
break;
}
////////////////////////////
// check the step to the right of iIndexStartLookingAt
////////////////////////////
//LOG->WriteLine( "Checking Notes[%d]", iCurrentIndexLater );
if( m_TapNotes[col][iCurrentIndexLater] != '0' ) // these Notes overlap
{
m_TapNotes[col][iCurrentIndexLater] = '0'; // mark hit
bool bRowDestroyed = true;
for( int t=0; t<m_iNumTracks; t++ ) // did this complete the elminiation of the row?
{
if( m_TapNotes[col][iCurrentIndexLater] != '0' )
bRowDestroyed = false;
}
if( bRowDestroyed )
OnRowDestroyed( fSongBeat, col, fMaxBeatDiff, iCurrentIndexLater );
return;
iIndexOverlappingNote = iCurrentIndexLater;
break;
}
}
if( iIndexOverlappingNote != -1 )
{
m_TapNotes[col][iIndexOverlappingNote] = '0'; // mark hit
bool bRowDestroyed = true;
for( int t=0; t<m_iNumTracks; t++ ) // did this complete the elminiation of the row?
{
if( m_TapNotes[t][iIndexOverlappingNote] != '0' )
bRowDestroyed = false;
}
if( bRowDestroyed )
OnRowDestroyed( fSongBeat, col, fMaxBeatDiff, iIndexOverlappingNote );
}
}
void Player::OnRowDestroyed( float fSongBeat, int col, float fMaxBeatDiff, int iIndexThatWasSteppedOn )
@@ -542,6 +534,12 @@ int Player::UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat )
}
}
if( iNumMissesFound > 0 )
{
m_Judgement.SetJudgement( TNS_MISS );
m_Combo.EndCombo();
}
return iNumMissesFound;
}
+14 -7
View File
@@ -35,7 +35,7 @@ PrefsManager::PrefsManager()
m_PreferredDifficultyClass[p] = CLASS_EASY;
m_SongSortOrder = SORT_GROUP;
m_PlayMode = PLAY_MODE_ARCADE;
m_iCurrentStage = 1;
m_iCurrentStageIndex = 0;
ReadPrefsFromDisk();
}
@@ -84,29 +84,36 @@ void PrefsManager::SavePrefsToDisk()
ini.WriteFile();
}
int PrefsManager::GetStageIndex()
{
return m_iCurrentStageIndex;
}
int PrefsManager::GetStageNumber()
{
return m_iCurrentStage;
return m_iCurrentStageIndex+1;
}
bool PrefsManager::IsFinalStage()
{
return m_iNumArcadeStages == m_iCurrentStage;
return m_iCurrentStageIndex == m_iNumArcadeStages-1;
}
CString PrefsManager::GetStageText()
{
if( m_iCurrentStage == 3 )
if( m_iCurrentStageIndex == m_iNumArcadeStages-1 )
return "Final";
int iStageNo = m_iCurrentStageIndex+1;
CString sNumberSuffix;
if( ( (m_iCurrentStage/10) % 10 ) == 1 ) // in the teens (e.g. 19, 213)
if( ( (iStageNo/10) % 10 ) == 1 ) // in the teens (e.g. 19, 213)
{
sNumberSuffix = "th";
}
else // not in the teens
{
const int iLastDigit = m_iCurrentStage%10;
const int iLastDigit = iStageNo%10;
switch( iLastDigit )
{
case 1: sNumberSuffix = "st"; break;
@@ -115,6 +122,6 @@ CString PrefsManager::GetStageText()
default:sNumberSuffix = "th"; break;
}
}
return ssprintf( "%d%s", PREFSMAN->m_iCurrentStage, sNumberSuffix );
return ssprintf( "%d%s", this->GetStageNumber(), sNumberSuffix );
}
+3 -2
View File
@@ -42,10 +42,11 @@ public:
// Options that are NOT saved between sessions
DifficultyClass m_PreferredDifficultyClass[NUM_PLAYERS];
SongSortOrder m_SongSortOrder; // used by MusicWheel and should be saved until the app exits
SongSortOrder m_SongSortOrder; // used by MusicWheel and should be saved until the app exits
PlayMode m_PlayMode;
int m_iCurrentStage; // starts at 1, and is incremented with each Stage Clear
int m_iCurrentStageIndex; // starts at 0, and is incremented with each Stage Clear
int GetStageIndex();
int GetStageNumber();
bool IsFinalStage();
CString GetStageText();
+15 -5
View File
@@ -31,10 +31,7 @@ RageLog::RageLog()
// delete old log files
DeleteFile( LOG_FILE_NAME );
// create a new console window and attach standard handles
AllocConsole();
freopen("CONOUT$","wb",stdout);
freopen("CONOUT$","wb",stderr);
ShowConsole();
// Open log file and leave it open. Let the OS close it when the app exits
m_fileLog = fopen( LOG_FILE_NAME, "w" );
@@ -51,11 +48,24 @@ RageLog::RageLog()
RageLog::~RageLog()
{
FreeConsole();
Flush();
FreeConsole();
fclose( m_fileLog );
}
void RageLog::ShowConsole()
{
// create a new console window and attach standard handles
AllocConsole();
freopen("CONOUT$","wb",stdout);
freopen("CONOUT$","wb",stderr);
}
void RageLog::HideConsole()
{
FreeConsole();
}
void RageLog::WriteLine( LPCTSTR fmt, ...)
{
va_list va;
+3
View File
@@ -21,6 +21,9 @@ public:
void WriteLineHr( HRESULT hr, LPCTSTR fmt, ...);
void Flush();
void ShowConsole();
void HideConsole();
protected:
FILE* m_fileLog;
};
+23 -35
View File
@@ -15,6 +15,9 @@
#include "ThemeManager.h"
const float SCORE_TWEEN_TIME = 0.5f;
ScoreDisplayRolling::ScoreDisplayRolling()
{
LOG->WriteLine( "ScoreDisplayRolling::ScoreDisplayRolling()" );
@@ -23,12 +26,7 @@ ScoreDisplayRolling::ScoreDisplayRolling()
Load( THEME->GetPathTo(FONT_SCORE_NUMBERS) );
TurnShadowOff();
// init the digits
for( int i=0; i<NUM_SCORE_DIGITS; i++ )
{
m_iCurrentScoreDigits[i] = 0;
m_iDestinationScoreDigits[i] = 0;
}
m_fTrailingScore = 0;
SetScore( 0 );
}
@@ -43,15 +41,9 @@ void ScoreDisplayRolling::SetScore( float fNewScore )
{
m_fScore = fNewScore;
// super inefficient (but isn't called very often)
CString sFormatString = ssprintf( "%%%d.0f", NUM_SCORE_DIGITS );
CString sScore = ssprintf( sFormatString, fNewScore );
for( int i=0; i<NUM_SCORE_DIGITS; i++ )
{
m_iDestinationScoreDigits[i] = atoi( sScore.Mid(i,1) );
}
float fDelta = m_fScore - m_fTrailingScore;
m_fScoreVelocity = fDelta / SCORE_TWEEN_TIME; // in score units per second
}
@@ -64,36 +56,32 @@ float ScoreDisplayRolling::GetScore()
void ScoreDisplayRolling::Update( float fDeltaTime )
{
BitmapText::Update( fDeltaTime );
float fDeltaBefore = m_fScore - m_fTrailingScore;
m_fTrailingScore += m_fScoreVelocity * fDeltaTime;
float fDeltaAfter = m_fScore - m_fTrailingScore;
if( fDeltaBefore * fDeltaAfter < 0 ) // the sign changed
{
m_fTrailingScore = m_fScore;
m_fScoreVelocity = 0;
}
}
void ScoreDisplayRolling::Draw()
{
// find the leftmost current digit that doesn't match the destination digit
for( int i=0; i<NUM_SCORE_DIGITS; i++ )
if( m_fScore == 0 )
{
if( m_iCurrentScoreDigits[i] != m_iDestinationScoreDigits[i] )
break;
CString sFormat = ssprintf( "%%%d.0d", NUM_SCORE_DIGITS );
SetText( ssprintf(sFormat, 0) );
}
// and increment that digit and everything after
for( ; i<NUM_SCORE_DIGITS; i++ )
else
{
m_iCurrentScoreDigits[i]++;
if( m_iCurrentScoreDigits[i] > 9 )
m_iCurrentScoreDigits[i] = 0;
CString sFormat = ssprintf( "%%%d.0f", NUM_SCORE_DIGITS );
SetText( ssprintf(sFormat, m_fTrailingScore) );
}
int iCurScore = 0;
int iMultiplier = 1;
for( int d=NUM_SCORE_DIGITS-1; d>=0; d-- ) // foreach digit
{
iCurScore += m_iCurrentScoreDigits[d] * iMultiplier;
iMultiplier *= 10;
}
CString sFormat = ssprintf( "%%%d.0d", NUM_SCORE_DIGITS );
SetText( ssprintf(sFormat, iCurScore) );
BitmapText::Draw();
}
+2 -2
View File
@@ -35,6 +35,6 @@ public:
protected:
float m_fScore;
int m_iCurrentScoreDigits[NUM_SCORE_DIGITS];
int m_iDestinationScoreDigits[NUM_SCORE_DIGITS];
float m_fTrailingScore;
float m_fScoreVelocity;
};
+6 -6
View File
@@ -53,7 +53,7 @@ ScreenEdit::ScreenEdit()
{
LOG->WriteLine( "ScreenEdit::ScreenEdit()" );
m_pSong = SONGMAN->m_pCurSong;
m_pSong = SONGMAN->GetCurrentSong();
m_Mode = MODE_EDIT;
@@ -80,7 +80,7 @@ ScreenEdit::ScreenEdit()
NoteData noteData;
noteData.m_iNumTracks = GAMEMAN->GetCurrentStyleDef()->m_iColsPerPlayer;
if( SONGMAN->m_pCurNotes[PLAYER_1] != NULL )
noteData = *SONGMAN->m_pCurNotes[PLAYER_1]->GetNoteData();
noteData = *SONGMAN->GetCurrentNotes(PLAYER_1)->GetNoteData();
m_NoteFieldEdit.SetXY( EDIT_CENTER_X, EDIT_GRAY_Y );
m_NoteFieldEdit.SetZoom( 0.5f );
@@ -364,20 +364,20 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
case DIK_S:
// copy edit into current Notes
Notes* pNotes;
pNotes = SONGMAN->m_pCurNotes[PLAYER_1];
pNotes = SONGMAN->GetCurrentNotes(PLAYER_1);
if( pNotes == NULL )
{
// allocate a new Notes
SONGMAN->m_pCurSong->m_arrayNotes.SetSize( SONGMAN->m_pCurSong->m_arrayNotes.GetSize() + 1 );
pNotes = &SONGMAN->m_pCurSong->m_arrayNotes[ SONGMAN->m_pCurSong->m_arrayNotes.GetSize()-1 ];
SONGMAN->GetCurrentSong()->m_arrayNotes.SetSize( SONGMAN->GetCurrentSong()->m_arrayNotes.GetSize() + 1 );
pNotes = &SONGMAN->GetCurrentSong()->m_arrayNotes[ SONGMAN->GetCurrentSong()->m_arrayNotes.GetSize()-1 ];
pNotes->m_NotesType = GAMEMAN->m_CurNotesType;
pNotes->m_sDescription = "Untitled";
pNotes->m_iMeter = 1;
}
pNotes->SetNoteData( (NoteData*)&m_NoteFieldEdit );
SONGMAN->m_pCurSong->Save();
SONGMAN->GetCurrentSong()->Save();
break;
case DIK_UP:
case DIK_DOWN:
+2 -2
View File
@@ -310,9 +310,9 @@ void ScreenEditMenu::MenuStart( const PlayerNumber p )
MUSIC->Stop();
SONGMAN->m_pCurSong = GetSelectedSong();
SONGMAN->SetCurrentSong( GetSelectedSong() );
GAMEMAN->m_CurNotesType = GetSelectedNotesType();
SONGMAN->m_pCurNotes[PLAYER_1] = GetSelectedNotes();
SONGMAN->SetCurrentNotes( PLAYER_1, GetSelectedNotes() );
m_soundSelect.PlayRandom();
+4 -4
View File
@@ -71,10 +71,10 @@ ScreenGameplay::ScreenGameplay()
m_fTimeLeftBeforeDancingComment = TIME_BETWEEN_DANCING_COMMENTS;
m_bHasFailed = false;
m_pSong = SONGMAN->m_pCurSong;
m_pSong = SONGMAN->GetCurrentSong();
m_Background.LoadFromSong( SONGMAN->m_pCurSong );
m_Background.LoadFromSong( m_pSong );
m_Background.SetDiffuseColor( D3DXCOLOR(0.4f,0.4f,0.4f,1) );
this->AddActor( &m_Background );
@@ -91,11 +91,11 @@ ScreenGameplay::ScreenGameplay()
if( PREFSMAN->m_PlayerOptions[p].m_bReverseScroll )
fDifficultyY = SCREEN_HEIGHT - DIFFICULTY_Y;
m_DifficultyBanner[p].SetXY( DIFFICULTY_X[p], fDifficultyY );
m_DifficultyBanner[p].SetFromNotes( SONGMAN->m_pCurNotes[p] );
m_DifficultyBanner[p].SetFromNotes( SONGMAN->GetCurrentNotes((PlayerNumber)p) );
this->AddActor( &m_DifficultyBanner[p] );
NoteData* pOriginalNoteData = SONGMAN->m_pCurNotes[p]->GetNoteData();
NoteData* pOriginalNoteData = SONGMAN->GetCurrentNotes((PlayerNumber)p)->GetNoteData();
NoteData newNoteData;
GAMEMAN->GetCurrentStyleDef()->GetTransformedNoteDataForStyle( (PlayerNumber)p, pOriginalNoteData, newNoteData );
+1 -1
View File
@@ -280,7 +280,7 @@ void ScreenSelectGroup::MenuStart( const PlayerNumber p )
m_soundSelect.PlayRandom();
m_bChosen = true;
SONGMAN->m_pCurSong = NULL;
SONGMAN->SetCurrentSong( NULL );
SONGMAN->m_sPreferredGroup = m_arrayGroupNames[m_iSelection];
if( 0 == stricmp(SONGMAN->m_sPreferredGroup, "All Music") )
+9 -10
View File
@@ -114,7 +114,7 @@ ScreenSelectMusic::ScreenSelectMusic()
m_textHoldForOptions.SetZoom( 1 );
m_textHoldForOptions.SetZoomY( 0 );
m_textHoldForOptions.SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
m_textHoldForOptions.SetZ( -4 );
m_textHoldForOptions.SetZ( -2 );
this->AddActor( &m_textHoldForOptions );
@@ -348,18 +348,13 @@ void ScreenSelectMusic::MenuStart( const PlayerNumber p )
return;
}
TweenOffScreen();
m_Menu.TweenOffScreenToBlack( SM_None, false );
m_soundSelect.PlayRandom();
bool bIsNew = m_MusicWheel.GetSelectedSong()->IsNew();
bool bIsHard = false;
for( int p=0; p<NUM_PLAYERS; p++ )
{
if( !GAMEMAN->IsPlayerEnabled( (PlayerNumber)p ) )
continue; // skip
if( SONGMAN->m_pCurNotes[p] && SONGMAN->m_pCurNotes[p]->m_iMeter >= 9 )
if( SONGMAN->GetCurrentNotes((PlayerNumber)p) && SONGMAN->GetCurrentNotes((PlayerNumber)p)->m_iMeter >= 9 )
bIsHard = true;
}
@@ -370,12 +365,16 @@ void ScreenSelectMusic::MenuStart( const PlayerNumber p )
else
SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_SELECT_MUSIC_COMMENT_GENERAL) );
;
TweenOffScreen();
m_soundSelect.PlayRandom();
// show "hold NEXT for options"
m_textHoldForOptions.SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
m_textHoldForOptions.BeginTweeningQueued( 0.25f ); // fade in
m_textHoldForOptions.SetTweenZoomY( 1 );
m_textHoldForOptions.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,1) );
m_textHoldForOptions.BeginTweeningQueued( 2.0f ); // sleep
m_textHoldForOptions.BeginTweeningQueued( 0.25f ); // fade out
m_textHoldForOptions.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,0) );
@@ -412,7 +411,7 @@ void ScreenSelectMusic::AfterNotesChange( const PlayerNumber p )
Notes* pNotes = m_arrayNotes.GetSize()>0 ? m_arrayNotes[m_iSelection[p]] : NULL;
SONGMAN->m_pCurNotes[p] = pNotes;
SONGMAN->SetCurrentNotes( p, pNotes );
m_DifficultyIcon[p].SetFromNotes( pNotes );
m_FootMeter[p].SetFromNotes( pNotes );
@@ -423,7 +422,7 @@ void ScreenSelectMusic::AfterNotesChange( const PlayerNumber p )
void ScreenSelectMusic::AfterMusicChange()
{
Song* pSong = m_MusicWheel.GetSelectedSong();
SONGMAN->m_pCurSong = pSong;
SONGMAN->SetCurrentSong( pSong );
m_arrayNotes.RemoveAll();
+28 -3
View File
@@ -15,6 +15,7 @@
#include "IniFile.h"
#include "RageLog.h"
#include "ErrorCatcher/ErrorCatcher.h"
#include "PrefsManager.h"
SongManager* SONGMAN = NULL; // global and accessable from anywhere in our program
@@ -35,9 +36,12 @@ const int NUM_GROUP_COLORS = sizeof(GROUP_COLORS) / sizeof(D3DXCOLOR);
SongManager::SongManager()
{
m_pCurSong = NULL;
for( int p=0; p<NUM_PLAYERS; p++ )
m_pCurNotes[p] = NULL;
for( int i=0; i<MAX_SONG_QUEUE_SIZE; i++ )
{
m_pCurSong[i] = NULL;
for( int p=0; p<NUM_PLAYERS; p++ )
m_pCurNotes[i][p] = NULL;
}
InitSongArrayFromDisk();
ReadStatisticsFromDisk();
@@ -52,6 +56,27 @@ SongManager::~SongManager()
}
Song* SongManager::GetCurrentSong()
{
return m_pCurSong[ PREFSMAN->GetStageIndex() ];
}
Notes* SongManager::GetCurrentNotes( PlayerNumber p )
{
return m_pCurNotes[ PREFSMAN->GetStageIndex() ][p];
}
void SongManager::SetCurrentSong( Song* pSong )
{
m_pCurSong[ PREFSMAN->GetStageIndex() ] = pSong;
}
void SongManager::SetCurrentNotes( PlayerNumber p, Notes* pNotes )
{
m_pCurNotes[ PREFSMAN->GetStageIndex() ][p] = pNotes;
}
void SongManager::InitSongArrayFromDisk()
{
LoadStepManiaSongDir( "Songs" );
+10 -2
View File
@@ -15,6 +15,7 @@
#include "Song.h"
//#include <d3dxmath.h> // for D3DXCOLOR
const int MAX_SONG_QUEUE_SIZE = 30;
class SongManager
{
@@ -22,14 +23,21 @@ public:
SongManager();
~SongManager();
Song* m_pCurSong;
Notes* m_pCurNotes[NUM_PLAYERS];
Song* m_pCurSong[MAX_SONG_QUEUE_SIZE];
Notes* m_pCurNotes[MAX_SONG_QUEUE_SIZE][NUM_PLAYERS];
CString m_sPreferredGroup;
CArray<Song*, Song*> m_pSongs; // all songs that can be played
void InitSongArrayFromDisk();
Song* GetCurrentSong();
Notes* GetCurrentNotes( PlayerNumber p );
void SetCurrentSong( Song* pSong );
void SetCurrentNotes( PlayerNumber p, Notes* pNotes );
void CleanUpSongArray();
void ReloadSongArray();
+3 -1
View File
@@ -233,7 +233,9 @@ void MainLoop()
CreateObjects( g_hWndMain ); // Create the game objects
ShowWindow( g_hWndMain, SW_SHOW );
#ifdef RELEASE
LOG->HideConsole();
#endif
// Now we're ready to recieve and process Windows messages.
MSG msg;
+2 -2
View File
@@ -65,7 +65,7 @@ LINK32=link.exe
# PROP Use_MFC 1
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "../"
# PROP Intermediate_Dir "../Debug"
# PROP Intermediate_Dir "../Debug-VC6"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
@@ -79,7 +79,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /out:"../StepMania-debug.exe" /pdbtype:sept
# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /out:"../StepMania-debug-VC6.exe" /pdbtype:sept
!ENDIF
-6
View File
@@ -719,12 +719,6 @@
<File
RelativePath="ScoreDisplayRolling.h">
</File>
<File
RelativePath="ScoreDisplayRollingWithFrame.cpp">
</File>
<File
RelativePath="ScoreDisplayRollingWithFrame.h">
</File>
</Filter>
<Filter
Name="Rage"