no message

This commit is contained in:
Chris Danford
2002-05-19 01:59:48 +00:00
parent 62f3f01a05
commit 2f80235590
141 changed files with 2540 additions and 2058 deletions
+13 -12
View File
@@ -1,17 +1,18 @@
#include "stdafx.h" // testing updates #include "stdafx.h" // testing updates
/* /*
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
File: Actor.h Class: Actor
Desc: Base class for all objects that appear on the screen. Desc: See header.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
#include "Actor.h" #include "Actor.h"
#include <math.h> #include <math.h>
#include "RageScreen.h" #include "RageDisplay.h"
#include "PrefsManager.h" #include "PrefsManager.h"
@@ -45,9 +46,9 @@ Actor::Actor()
} }
void Actor::Draw() // set the world matrix and calculate actor properties, the call RenderPrimitives void Actor::Draw() // set the world matrix and calculate actor properties, the call DrawPrimitives
{ {
SCREEN->PushMatrix(); // we're actually going to do some drawing in this function DISPLAY->PushMatrix(); // we're actually going to do some drawing in this function
int i; int i;
@@ -112,8 +113,8 @@ void Actor::Draw() // set the world matrix and calculate actor properties, the
SCREEN->Translate( m_temp_pos.x, m_temp_pos.y, m_temp_pos.z ); // offset so that pixels are aligned to texels DISPLAY->Translate( m_temp_pos.x, m_temp_pos.y, m_temp_pos.z ); // offset so that pixels are aligned to texels
SCREEN->Scale( m_temp_scale.x, m_temp_scale.y, 1 ); DISPLAY->Scale( m_temp_scale.x, m_temp_scale.y, 1 );
// super slow! // super slow!
// D3DXMatrixRotationYawPitchRoll( &matTemp, rotation.y, rotation.x, rotation.z ); // add in the rotation // D3DXMatrixRotationYawPitchRoll( &matTemp, rotation.y, rotation.x, rotation.z ); // add in the rotation
@@ -122,19 +123,19 @@ void Actor::Draw() // set the world matrix and calculate actor properties, the
// replace with... // replace with...
if( m_temp_rotation.z != 0 ) if( m_temp_rotation.z != 0 )
{ {
SCREEN->RotateZ( m_temp_rotation.z ); DISPLAY->RotateZ( m_temp_rotation.z );
} }
if( m_temp_rotation.y != 0 ) if( m_temp_rotation.y != 0 )
{ {
SCREEN->RotateY( m_temp_rotation.y ); DISPLAY->RotateY( m_temp_rotation.y );
} }
this->RenderPrimitives(); // call the most-derived version of RenderPrimitives(); this->DrawPrimitives(); // call the most-derived version of DrawPrimitives();
SCREEN->PopMatrix(); DISPLAY->PopMatrix();
} }
+6 -19
View File
@@ -1,29 +1,20 @@
#pragma once
/* /*
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
File: Actor.h Class: Actor
Desc: Base class for all objects that appear on the screen. Desc: Base class for all objects that appear on the screen.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
#ifndef _Actor_H_
#define _Actor_H_
#include "RageUtil.h"
#include <d3dx8math.h> #include <d3dx8math.h>
class Actor class Actor
{ {
protected:
public: public:
Actor(); Actor();
@@ -48,8 +39,8 @@ public:
virtual void Restore() {}; virtual void Restore() {};
virtual void Invalidate() {}; virtual void Invalidate() {};
virtual void Draw(); virtual void Draw(); // set up the world matrix, then calls DrawPrimitives()
virtual void RenderPrimitives() = 0; virtual void DrawPrimitives() = 0;
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
virtual float GetX() { return m_pos.x; }; virtual float GetX() { return m_pos.x; };
@@ -280,7 +271,3 @@ protected:
bool m_bBlendAdd; bool m_bBlendAdd;
}; };
#endif
+2 -2
View File
@@ -5,14 +5,14 @@
Desc: Base class for all objects that appear on the screen. Desc: Base class for all objects that appear on the screen.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
#include "ActorFrame.h" #include "ActorFrame.h"
void ActorFrame::RenderPrimitives() void ActorFrame::DrawPrimitives()
{ {
// draw all sub-ActorFrames while we're in the ActorFrame's local coordinate space // draw all sub-ActorFrames while we're in the ActorFrame's local coordinate space
for( int i=0; i<m_SubActors.GetSize(); i++ ) { for( int i=0; i<m_SubActors.GetSize(); i++ ) {
+2 -2
View File
@@ -4,7 +4,7 @@
Desc: Base class for all objects that appear on the screen. Desc: Base class for all objects that appear on the screen.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -29,7 +29,7 @@ public:
void AddActor( Actor* pActor) { m_SubActors.Add(pActor); }; void AddActor( Actor* pActor) { m_SubActors.Add(pActor); };
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
virtual void RenderPrimitives(); virtual void DrawPrimitives();
virtual void SetDiffuseColor( D3DXCOLOR c ); virtual void SetDiffuseColor( D3DXCOLOR c );
+3 -3
View File
@@ -5,12 +5,12 @@
Desc: Functions that return properties of arrows based on StyleDef and PlayerOptions Desc: Functions that return properties of arrows based on StyleDef and PlayerOptions
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
#include "ArrowEffects.h" #include "ArrowEffects.h"
#include "NoteMetadata.h" #include "Notes.h"
#include "ColorNote.h" #include "ColorNote.h"
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "GameManager.h" #include "GameManager.h"
@@ -18,7 +18,7 @@
float ArrowGetYOffset( const PlayerOptions& po, float fStepIndex, float fSongBeat ) float ArrowGetYOffset( const PlayerOptions& po, float fStepIndex, float fSongBeat )
{ {
float fBeatsUntilStep = NoteIndexToBeat( fStepIndex ) - fSongBeat; float fBeatsUntilStep = NoteRowToBeat( fStepIndex ) - fSongBeat;
float fYOffset = fBeatsUntilStep * ARROW_GAP; float fYOffset = fBeatsUntilStep * ARROW_GAP;
switch( po.m_EffectType ) switch( po.m_EffectType )
{ {
+1 -1
View File
@@ -4,7 +4,7 @@
Desc: Functions that return properties of arrows based on StyleDef and PlayerOptions Desc: Functions that return properties of arrows based on StyleDef and PlayerOptions
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
+3 -3
View File
@@ -5,7 +5,7 @@
Desc: A graphic displayed in the BPMDisplay during Dancing. Desc: A graphic displayed in the BPMDisplay during Dancing.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -26,7 +26,7 @@ BPMDisplay::BPMDisplay()
m_rectFrame.SetZoomX( 120 ); m_rectFrame.SetZoomX( 120 );
m_rectFrame.SetZoomY( 40 ); m_rectFrame.SetZoomY( 40 );
m_textBPM.Load( THEME->GetPathTo(FONT_BOLD) ); m_textBPM.Load( THEME->GetPathTo(FONT_HEADER1) );
m_textBPM.TurnShadowOff(); m_textBPM.TurnShadowOff();
m_textBPM.SetXY( CENTER_X, SCREEN_HEIGHT - 50 ); m_textBPM.SetXY( CENTER_X, SCREEN_HEIGHT - 50 );
//m_textBPM.SetSequence( ssprintf("999") ); //m_textBPM.SetSequence( ssprintf("999") );
@@ -35,7 +35,7 @@ BPMDisplay::BPMDisplay()
m_textBPM.SetDiffuseColorTopEdge( D3DXCOLOR(1,1,0,1) ); // yellow m_textBPM.SetDiffuseColorTopEdge( D3DXCOLOR(1,1,0,1) ); // yellow
m_textBPM.SetDiffuseColorBottomEdge( D3DXCOLOR(1,0.5f,0,1) ); // orange m_textBPM.SetDiffuseColorBottomEdge( D3DXCOLOR(1,0.5f,0,1) ); // orange
m_textLabel.Load( THEME->GetPathTo(FONT_BOLD) ); m_textLabel.Load( THEME->GetPathTo(FONT_HEADER1) );
m_textLabel.TurnShadowOff(); m_textLabel.TurnShadowOff();
m_textLabel.SetXY( 34, 2 ); m_textLabel.SetXY( 34, 2 );
m_textLabel.SetText( "BPM" ); m_textLabel.SetText( "BPM" );
+3 -3
View File
@@ -4,7 +4,7 @@
Desc: A graphic displayed in the BPMDisplay during Dancing. Desc: A graphic displayed in the BPMDisplay during Dancing.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -17,7 +17,7 @@
#include "Song.h" #include "Song.h"
#include "ActorFrame.h" #include "ActorFrame.h"
#include "BitmapText.h" #include "BitmapText.h"
#include "RectangleActor.h" #include "Quad.h"
class BPMDisplay : public ActorFrame class BPMDisplay : public ActorFrame
@@ -30,7 +30,7 @@ public:
protected: protected:
BitmapText m_textBPM; BitmapText m_textBPM;
BitmapText m_textLabel; BitmapText m_textLabel;
RectangleActor m_rectFrame; Quad m_rectFrame;
float m_fCurrentBPM; float m_fCurrentBPM;
float m_fLowBPM, m_fHighBPM; float m_fLowBPM, m_fHighBPM;
+8 -8
View File
@@ -5,7 +5,7 @@
Desc: Background behind arrows while dancing Desc: Background behind arrows while dancing
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -26,10 +26,10 @@ Background::Background()
m_sprDanger.SetZoom( 2 ); m_sprDanger.SetZoom( 2 );
m_sprDanger.SetEffectWagging(); m_sprDanger.SetEffectWagging();
m_sprDanger.Load( THEME->GetPathTo(GRAPHIC_DANGER_TEXT) ); m_sprDanger.Load( THEME->GetPathTo(GRAPHIC_GAMEPLAY_DANGER_TEXT) );
m_sprDanger.SetXY( CENTER_X, CENTER_Y ); m_sprDanger.SetXY( CENTER_X, CENTER_Y );
m_sprDangerBackground.Load( THEME->GetPathTo(GRAPHIC_DANGER_BACKGROUND) ); m_sprDangerBackground.Load( THEME->GetPathTo(GRAPHIC_GAMEPLAY_DANGER_BACKGROUND) );
m_sprDangerBackground.StretchTo( CRect((int)SCREEN_LEFT, (int)SCREEN_TOP, (int)SCREEN_RIGHT, (int)SCREEN_BOTTOM) ); m_sprDangerBackground.StretchTo( CRect((int)SCREEN_LEFT, (int)SCREEN_TOP, (int)SCREEN_RIGHT, (int)SCREEN_BOTTOM) );
} }
@@ -38,7 +38,7 @@ bool Background::LoadFromSong( Song* pSong, bool bDisableVisualizations )
if( pSong->HasBackgroundMovie() ) if( pSong->HasBackgroundMovie() )
{ {
// load the movie backgound, and don't load a visualization // load the movie backgound, and don't load a visualization
m_sprSongBackground.Load( pSong->HasBackground() ? pSong->GetBackgroundPath() : THEME->GetPathTo(GRAPHIC_FALLBACK_BACKGROUND) ); m_sprSongBackground.Load( pSong->GetBackgroundMoviePath() );
m_sprSongBackground.StretchTo( CRect( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ) ); m_sprSongBackground.StretchTo( CRect( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ) );
m_sprSongBackground.SetZoomY( -1 ); m_sprSongBackground.SetZoomY( -1 );
m_sprSongBackground.SetDiffuseColor( D3DXCOLOR(0,0,0,1) ); m_sprSongBackground.SetDiffuseColor( D3DXCOLOR(0,0,0,1) );
@@ -47,8 +47,8 @@ bool Background::LoadFromSong( Song* pSong, bool bDisableVisualizations )
else else
{ {
// load the static background (if available), and a visualization // load the static background (if available), and a visualization
if( pSong->HasBackground() ) m_sprSongBackground.Load( pSong->GetBackgroundPath(), TEXTURE_HINT_DITHER ); if( pSong->HasBackground() ) m_sprSongBackground.Load( pSong->GetBackgroundPath(), false, 2, 0, true );
else m_sprSongBackground.Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BACKGROUND), TEXTURE_HINT_DITHER ); else m_sprSongBackground.Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BACKGROUND), false, 2, 0, true );
m_sprSongBackground.StretchTo( CRect( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ) ); m_sprSongBackground.StretchTo( CRect( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ) );
m_sprSongBackground.SetDiffuseColor( D3DXCOLOR(0,0,0,1) ); m_sprSongBackground.SetDiffuseColor( D3DXCOLOR(0,0,0,1) );
@@ -91,9 +91,9 @@ void Background::Update( float fDeltaTime )
m_sprDangerBackground.Update( fDeltaTime ); m_sprDangerBackground.Update( fDeltaTime );
} }
void Background::RenderPrimitives() void Background::DrawPrimitives()
{ {
ActorFrame::RenderPrimitives(); ActorFrame::DrawPrimitives();
if( m_bShowDanger && (GetTickCount() % 1000) > 500 ) if( m_bShowDanger && (GetTickCount() % 1000) > 500 )
{ {
+2 -2
View File
@@ -4,7 +4,7 @@
Desc: Background behind arrows while dancing Desc: Background behind arrows while dancing
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -25,7 +25,7 @@ public:
virtual bool LoadFromSong( Song *pSong, bool bDisableVisualizations = false ); virtual bool LoadFromSong( Song *pSong, bool bDisableVisualizations = false );
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
virtual void RenderPrimitives(); virtual void DrawPrimitives();
virtual void SetDiffuseColor( D3DXCOLOR c ) virtual void SetDiffuseColor( D3DXCOLOR c )
{ {
+68 -5
View File
@@ -5,7 +5,7 @@
Desc: The song's banner displayed in SelectSong. Desc: The song's banner displayed in SelectSong.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -13,19 +13,82 @@
#include "Banner.h" #include "Banner.h"
#include "ThemeManager.h" #include "ThemeManager.h"
#include "SongManager.h"
#include "RageBitmapTexture.h" #include "RageBitmapTexture.h"
bool Banner::Load( CString sFilePath, bool bForceReload, int iMipMaps, int iAlphaBits, bool bDither, bool bStretch )
{
// note that the defaults are changes for faster loading
return CroppedSprite::Load( sFilePath, bForceReload, iMipMaps, iAlphaBits, bDither, bStretch );
};
void Banner::Update( float fDeltaTime )
{
CroppedSprite::Update( fDeltaTime );
if( m_bScrolling )
{
m_fPercentScrolling += fDeltaTime/2;
m_fPercentScrolling -= (int)m_fPercentScrolling;
float fTexCoords[8] =
{
0+m_fPercentScrolling, 1, // bottom left
0+m_fPercentScrolling, 0, // top left
1+m_fPercentScrolling, 1, // bottom right
1+m_fPercentScrolling, 0, // top right
};
Sprite::SetCustomTextureCoords( fTexCoords );
}
}
bool Banner::LoadFromSong( Song* pSong ) // NULL means no song bool Banner::LoadFromSong( Song* pSong ) // NULL means no song
{ {
TurnOffRoulette();
Sprite::TurnShadowOff(); Sprite::TurnShadowOff();
if( pSong == NULL ) Banner::Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BANNER), TEXTURE_HINT_NOMIPMAPS ); if( pSong == NULL ) Banner::Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BANNER) );
else if( pSong->HasBanner() ) Banner::Load( pSong->GetBannerPath(), TEXTURE_HINT_NOMIPMAPS ); else if( pSong->HasBanner() ) Banner::Load( pSong->GetBannerPath() );
else if( pSong->HasBackground() ) Banner::Load( pSong->GetBackgroundPath(), TEXTURE_HINT_NOMIPMAPS ); else if( pSong->HasBackground() ) Banner::Load( pSong->GetBackgroundPath() );
else Banner::Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BANNER), TEXTURE_HINT_NOMIPMAPS ); else Banner::Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BANNER) );
return true; return true;
} }
bool Banner::LoadFromGroup( CString sGroupName )
{
TurnOffRoulette();
CString sGroupBannerPath = SONGMAN->GetGroupBannerPath( sGroupName );
if( sGroupBannerPath == "" )
Banner::Load( sGroupBannerPath );
else
Banner::Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BANNER) );
return true;
}
bool Banner::LoadRoulette()
{
Banner::Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_ROULETTE_BANNER), false, 0, 0, false, true );
TurnOnRoulette();
return true;
}
void Banner::TurnOnRoulette()
{
m_bScrolling = true;
m_fPercentScrolling = 0;
SetEffectGlowing( 1, D3DXCOLOR(1,0,0,0), D3DXCOLOR(1,0,0,0.5f) );
}
void Banner::TurnOffRoulette()
{
m_bScrolling = false;
SetEffectNone();
}
+19 -2
View File
@@ -5,7 +5,7 @@
Desc: The song's banner displayed in SelectSong. Desc: The song's banner displayed in SelectSong.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -23,10 +23,27 @@ class Banner : public CroppedSprite
public: public:
Banner() Banner()
{ {
m_bScrolling = false;
m_fPercentScrolling = 0;
m_fCropWidth = BANNER_WIDTH; m_fCropWidth = BANNER_WIDTH;
m_fCropHeight = BANNER_HEIGHT; m_fCropHeight = BANNER_HEIGHT;
}; };
bool LoadFromSong( Song* pSong ); // NULL means no song virtual bool Load( CString sFilePath, bool bForceReload = false, int iMipMaps = 0, int iAlphaBits = 0, bool bDither = false, bool bStretch = false );
virtual void Update( float fDeltaTime );
bool LoadFromSong( Song* pSong ); // NULL means no song
bool LoadFromGroup( CString sGroupName );
bool LoadRoulette();
bool IsRouletteOn() { return m_bScrolling; };
void TurnOnRoulette();
void TurnOffRoulette();
protected:
bool m_bScrolling;
float m_fPercentScrolling;
}; };
+1 -1
View File
@@ -5,7 +5,7 @@
Desc: See header. Desc: See header.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
+1 -1
View File
@@ -5,7 +5,7 @@
Desc: bonus meters and max combo number. Desc: bonus meters and max combo number.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
+83 -131
View File
@@ -5,7 +5,7 @@
Desc: See header. Desc: See header.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -38,7 +38,6 @@ BitmapText::BitmapText()
m_iNumLines = 0; m_iNumLines = 0;
m_iWidestLineWidth = 0; m_iWidestLineWidth = 0;
m_iNumV = 0;
for( int i=0; i<MAX_TEXT_LINES; i++ ) for( int i=0; i<MAX_TEXT_LINES; i++ )
{ {
@@ -128,35 +127,22 @@ void BitmapText::SetText( CString sText )
} }
// draw text at x, y using colorTop blended down to colorBottom, with size multiplied by scale
void BitmapText::DrawPrimitives()
void BitmapText::RebuildVertexBuffer()
{ {
//LOG->WriteLine( "BitmapText::RebuildVertexBuffer()" ); if( m_iNumLines == 0 )
return;
RageTexture* pTexture = m_pFont->m_pTexture; RageTexture* pTexture = m_pFont->m_pTexture;
// make the object in logical units centered at the origin // make the object in logical units centered at the origin
LPDIRECT3DVERTEXBUFFER8 pVB = SCREEN->GetVertexBuffer(); LPDIRECT3DVERTEXBUFFER8 pVB = DISPLAY->GetVertexBuffer();
//LPDIRECT3DVERTEXBUFFER8 pVB = m_pVB; RAGEVERTEX* v;
CUSTOMVERTEX* v;
pVB->Lock( 0, 0, (BYTE**)&v, 0 ); pVB->Lock( 0, 0, (BYTE**)&v, 0 );
int iNumV = 0; // the current vertex number
m_iNumV = 0; // the current vertex number
const int iHeight = pTexture->GetSourceFrameHeight(); // height of a character const int iHeight = pTexture->GetSourceFrameHeight(); // height of a character
const int iFrameWidth = pTexture->GetSourceFrameWidth(); // width of a character frame in logical units const int iFrameWidth = pTexture->GetSourceFrameWidth(); // width of a character frame in logical units
@@ -205,21 +191,21 @@ void BitmapText::RebuildVertexBuffer()
const float fExtraPixels = fPercentExtra * pTexture->GetSourceFrameWidth(); const float fExtraPixels = fPercentExtra * pTexture->GetSourceFrameWidth();
// first triangle // first triangle
v[m_iNumV++].p = D3DXVECTOR3( (float)iX, iY-iHeight/2.0f, 0 ); // top left v[iNumV++].p = D3DXVECTOR3( (float)iX, iY-iHeight/2.0f, 0 ); // top left
v[m_iNumV++].p = D3DXVECTOR3( (float)iX, iY+iHeight/2.0f, 0 ); // bottom left v[iNumV++].p = D3DXVECTOR3( (float)iX, iY+iHeight/2.0f, 0 ); // bottom left
iX += iCharWidth; iX += iCharWidth;
v[m_iNumV++].p = D3DXVECTOR3( iX+fExtraPixels, iY-iHeight/2.0f, 0 ); // top right v[iNumV++].p = D3DXVECTOR3( iX+fExtraPixels, iY-iHeight/2.0f, 0 ); // top right
// 2nd triangle // 2nd triangle
v[m_iNumV++].p = v[m_iNumV-1].p; // top right v[iNumV++].p = v[iNumV-1].p; // top right
v[m_iNumV++].p = v[m_iNumV-3].p; // bottom left v[iNumV++].p = v[iNumV-3].p; // bottom left
v[m_iNumV++].p = D3DXVECTOR3( iX+fExtraPixels, iY+iHeight/2.0f, 0 ); // bottom right v[iNumV++].p = D3DXVECTOR3( iX+fExtraPixels, iY+iHeight/2.0f, 0 ); // bottom right
// //
// set texture coordinates // set texture coordinates
// //
m_iNumV -= 6; iNumV -= 6;
FRECT frectTexCoords = *pTexture->GetTextureCoordRect( iFrameNo ); FRECT frectTexCoords = *pTexture->GetTextureCoordRect( iFrameNo );
@@ -232,146 +218,112 @@ void BitmapText::RebuildVertexBuffer()
const float fExtraTexCoords = fPercentExtra * pTexture->GetTextureFrameWidth() / pTexture->GetTextureWidth(); const float fExtraTexCoords = fPercentExtra * pTexture->GetTextureFrameWidth() / pTexture->GetTextureWidth();
v[m_iNumV++].t = D3DXVECTOR2( frectTexCoords.left, frectTexCoords.top ); // top left v[iNumV++].t = D3DXVECTOR2( frectTexCoords.left, frectTexCoords.top ); // top left
v[m_iNumV++].t = D3DXVECTOR2( frectTexCoords.left, frectTexCoords.bottom ); // bottom left v[iNumV++].t = D3DXVECTOR2( frectTexCoords.left, frectTexCoords.bottom ); // bottom left
v[m_iNumV++].t = D3DXVECTOR2( frectTexCoords.right + fExtraTexCoords, frectTexCoords.top ); // top right v[iNumV++].t = D3DXVECTOR2( frectTexCoords.right + fExtraTexCoords, frectTexCoords.top ); // top right
v[m_iNumV++].t = v[m_iNumV-1].t; // top right v[iNumV++].t = v[iNumV-1].t; // top right
v[m_iNumV++].t = v[m_iNumV-3].t; // bottom left v[iNumV++].t = v[iNumV-3].t; // bottom left
v[m_iNumV++].t = D3DXVECTOR2( frectTexCoords.right + fExtraTexCoords, frectTexCoords.bottom ); // bottom right v[iNumV++].t = D3DXVECTOR2( frectTexCoords.right + fExtraTexCoords, frectTexCoords.bottom ); // bottom right
} }
iY += iHeight; iY += iHeight;
} }
//
// set vertex colors for the diffuse pass
//
if( m_bRainbow )
{
int color_index = (GetTickCount() / 200) % NUM_RAINBOW_COLORS;
for( int i=0; i<iNumV; i+=6 )
{
const D3DXCOLOR color = RAINBOW_COLORS[color_index];
for( int j=i; j<i+6; j++ )
v[j].color = color;
color_index = (color_index+1)%NUM_RAINBOW_COLORS;
}
}
else
{
for( int i=0; i<iNumV; i+=6 )
{
v[i ].color = m_temp_colorDiffuse[0]; // top left
v[i+1].color = m_temp_colorDiffuse[2]; // bottom left
v[i+2].color = m_temp_colorDiffuse[1]; // top right
v[i+3].color = m_temp_colorDiffuse[1]; // top right
v[i+4].color = m_temp_colorDiffuse[2]; // bottom left
v[i+5].color = m_temp_colorDiffuse[3]; // bottom right
}
}
pVB->Unlock(); pVB->Unlock();
}
// draw text at x, y using colorTop blended down to colorBottom, with size multiplied by scale
void BitmapText::RenderPrimitives()
{
if( m_iNumLines == 0 )
return;
RageTexture* pTexture = m_pFont->m_pTexture;
// fill the RageScreen's vertex buffer with what we're going to draw
RebuildVertexBuffer();
LPDIRECT3DVERTEXBUFFER8 pVB = SCREEN->GetVertexBuffer();
//LPDIRECT3DVERTEXBUFFER8 pVB = m_pVB;
CUSTOMVERTEX* v;
// Set the stage... // Set the stage...
LPDIRECT3DDEVICE8 pd3dDevice = SCREEN->GetDevice(); LPDIRECT3DDEVICE8 pd3dDevice = DISPLAY->GetDevice();
pd3dDevice->SetTexture( 0, pTexture->GetD3DTexture() ); pd3dDevice->SetTexture( 0, pTexture->GetD3DTexture() );
pd3dDevice->SetRenderState( D3DRS_SRCBLEND, m_bBlendAdd ? D3DBLEND_ONE : D3DBLEND_SRCALPHA ); pd3dDevice->SetRenderState( D3DRS_SRCBLEND, m_bBlendAdd ? D3DBLEND_ONE : D3DBLEND_SRCALPHA );
pd3dDevice->SetRenderState( D3DRS_DESTBLEND, m_bBlendAdd ? D3DBLEND_ONE : D3DBLEND_INVSRCALPHA ); pd3dDevice->SetRenderState( D3DRS_DESTBLEND, m_bBlendAdd ? D3DBLEND_ONE : D3DBLEND_INVSRCALPHA );
pd3dDevice->SetVertexShader( D3DFVF_CUSTOMVERTEX ); pd3dDevice->SetVertexShader( D3DFVF_RAGEVERTEX );
pd3dDevice->SetStreamSource( 0, pVB, sizeof(CUSTOMVERTEX) ); pd3dDevice->SetStreamSource( 0, pVB, sizeof(RAGEVERTEX) );
if( m_temp_colorDiffuse[0].a != 0 ) //////////////////////
// render the shadow
//////////////////////
if( m_bShadow && m_temp_colorDiffuse[0].a != 0 )
{ {
////////////////////// DISPLAY->PushMatrix();
// render the shadow DISPLAY->TranslateLocal( m_fShadowLength, m_fShadowLength, 0 ); // shift by 5 units
//////////////////////
if( m_bShadow )
{
SCREEN->PushMatrix();
SCREEN->TranslateLocal( m_fShadowLength, m_fShadowLength, 0 ); // shift by 5 units
pVB->Lock( 0, 0, (BYTE**)&v, 0 ); DWORD dwColor = D3DXCOLOR(0,0,0,0.5f*m_temp_colorDiffuse[0].a); // semi-transparent black
pd3dDevice->SetRenderState( D3DRS_TEXTUREFACTOR, dwColor );
for( int i=0; i<m_iNumV; i++ ) pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TFACTOR );
v[i].color = D3DXCOLOR(0,0,0,0.5f*m_temp_colorDiffuse[0].a); // semi-transparent black pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
pVB->Unlock();
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->DrawPrimitive( D3DPT_TRIANGLELIST, 0, m_iNumV/3 );
SCREEN->PopMatrix();
}
//////////////////////
// render the diffuse pass
//////////////////////
pVB->Lock( 0, 0, (BYTE**)&v, 0 );
if( m_bRainbow )
{
int color_index = (GetTickCount() / 200) % NUM_RAINBOW_COLORS;
for( int i=0; i<m_iNumV; i+=6 )
{
const D3DXCOLOR color = RAINBOW_COLORS[color_index];
for( int j=i; j<i+6; j++ )
v[j].color = color;
color_index = (color_index+1)%NUM_RAINBOW_COLORS;
}
}
else
{
for( int i=0; i<m_iNumV; i++ )
{
if( i%2 == 0 ) // this is a bottom vertex
v[i].color = m_temp_colorDiffuse[0];
else // this is a top vertex
v[i].color = m_temp_colorDiffuse[1];
}
}
pVB->Unlock();
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_TFACTOR );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ); pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, m_iNumV/3 ); 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 );
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 );
////////////////////// //////////////////////
// render the add pass // render the add pass
////////////////////// //////////////////////
if( m_temp_colorAdd.a != 0 ) if( m_temp_colorAdd.a != 0 )
{ {
pVB->Lock( 0, 0, (BYTE**)&v, 0 ); DWORD dwColor = m_temp_colorAdd;
pd3dDevice->SetRenderState( D3DRS_TEXTUREFACTOR, dwColor );
for( int i=0; i<m_iNumV; i++ ) pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TFACTOR );
v[i].color = m_temp_colorAdd; pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
pVB->Unlock();
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_ALPHAARG1, D3DTA_TEXTURE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_TFACTOR );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ); pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, m_iNumV/3 ); pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, iNumV/3 );
} }
} }
+3 -12
View File
@@ -1,17 +1,15 @@
#pragma once
/* /*
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
File: BitmapText File: BitmapText
Desc: An actor that holds a Font and draws text to the screen. Desc: An actor that holds a Font and draws text to the screen.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
#ifndef _BITMAPTEXT_H_
#define _BITMAPTEXT_H_
#include "Sprite.h" #include "Sprite.h"
#include "Font.h" #include "Font.h"
@@ -34,8 +32,7 @@ public:
int GetWidestLineWidthInSourcePixels() { return m_iWidestLineWidth; }; int GetWidestLineWidthInSourcePixels() { return m_iWidestLineWidth; };
void RebuildVertexBuffer(); // fill the RageScreen's vertex buffer with what we're going to draw virtual void DrawPrimitives();
virtual void RenderPrimitives();
void TurnRainbowOn() { m_bRainbow = true; }; void TurnRainbowOn() { m_bRainbow = true; };
void TurnRainbowOff() { m_bRainbow = false; }; void TurnRainbowOff() { m_bRainbow = false; };
@@ -52,12 +49,6 @@ protected:
int m_iLineWidths[MAX_TEXT_LINES]; // in source pixels int m_iLineWidths[MAX_TEXT_LINES]; // in source pixels
int m_iWidestLineWidth; // in source pixels int m_iWidestLineWidth; // in source pixels
// recalculate on RebuildVertexBuffer()
// LPDIRECT3DVERTEXBUFFER8 m_pVB;
int m_iNumV; // number of verticies we filled in the vertex buffer
bool m_bRainbow; bool m_bRainbow;
}; };
#endif
+9 -7
View File
@@ -5,28 +5,29 @@
Desc: A graphic displayed in the Combo during Dancing. Desc: A graphic displayed in the Combo during Dancing.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
#include "Combo.h" #include "Combo.h"
#include "ThemeManager.h" #include "ThemeManager.h"
const float COMBO_TWEEN_TIME = 0.5f;
Combo::Combo() Combo::Combo()
{ {
m_iCurCombo = 0; m_iCurCombo = 0;
m_iMaxCombo = 0; m_iMaxCombo = 0;
m_sprCombo.Load( THEME->GetPathTo(GRAPHIC_COMBO) ); m_sprCombo.Load( THEME->GetPathTo(GRAPHIC_GAMEPLAY_COMBO) );
m_sprCombo.TurnShadowOn();
m_sprCombo.StopAnimating(); m_sprCombo.StopAnimating();
m_sprCombo.SetX( 40 ); m_sprCombo.SetX( 40 );
m_sprCombo.SetZoom( 1.0f ); m_sprCombo.SetZoom( 1.0f );
m_textComboNumber.Load( THEME->GetPathTo(FONT_COMBO_NUMBERS) ); m_textComboNumber.Load( THEME->GetPathTo(FONT_COMBO_NUMBERS) );
m_textComboNumber.SetX( -40 ); m_textComboNumber.TurnShadowOn();
m_textComboNumber.SetHorizAlign( Actor::align_right );
m_textComboNumber.SetX( -20 );
m_textComboNumber.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); // invisible m_textComboNumber.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); // invisible
m_sprCombo.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); // invisible m_sprCombo.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); // invisible
@@ -60,8 +61,9 @@ void Combo::ContinueCombo()
m_textComboNumber.SetZoom( fNewZoom ); m_textComboNumber.SetZoom( fNewZoom );
m_textComboNumber.SetX( -40 - (fNewZoom-1)*30 ); m_textComboNumber.SetX( -40 - (fNewZoom-1)*30 );
//m_textComboNumber.BeginTweening( COMBO_TWEEN_TIME ); //this->SetZoom( 1.2f );
//m_textComboNumber.SetTweenZoom( 1 ); //this->BeginTweening( 0.3f );
//this->SetTweenZoom( 1 );
} }
} }
+1 -1
View File
@@ -4,7 +4,7 @@
Desc: A graphic displayed in the Combo during Dancing. Desc: A graphic displayed in the Combo during Dancing.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
+1 -1
View File
@@ -5,7 +5,7 @@
Desc: The song's CroppedSprite displayed in SelectSong. Desc: The song's CroppedSprite displayed in SelectSong.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
+3 -3
View File
@@ -4,7 +4,7 @@
Desc: The song's CroppedSprite displayed in SelectSong. Desc: The song's CroppedSprite displayed in SelectSong.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -24,9 +24,9 @@ public:
m_fCropWidth = m_fCropHeight = 100; m_fCropWidth = m_fCropHeight = 100;
}; };
bool Load( CString sFilePath, DWORD dwHints = 0, bool bForceReload = false ) bool Load( CString sFilePath, bool bForceReload = false, int iMipMaps = 4, int iAlphaBits = 4, bool bDither = false, bool bStretch = false )
{ {
Sprite::Load( sFilePath, dwHints, bForceReload ); Sprite::Load( sFilePath, bForceReload, iMipMaps, iAlphaBits, bDither, bStretch );
CropToSize( m_fCropWidth, m_fCropHeight ); CropToSize( m_fCropWidth, m_fCropHeight );
return true; return true;
+1 -1
View File
@@ -5,7 +5,7 @@
Desc: A graphic displayed in the DifficultyIcon during Dancing. Desc: A graphic displayed in the DifficultyIcon during Dancing.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
+5 -5
View File
@@ -4,7 +4,7 @@
Desc: A graphic displayed in the DifficultyIcon during Dancing. Desc: A graphic displayed in the DifficultyIcon during Dancing.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -27,15 +27,15 @@ public:
Load( THEME->GetPathTo(GRAPHIC_DIFFICULTY_ICONS) ); Load( THEME->GetPathTo(GRAPHIC_DIFFICULTY_ICONS) );
StopAnimating(); StopAnimating();
SetFromNoteMetadata( NULL ); SetFromNotes( NULL );
}; };
void SetFromNoteMetadata( NoteMetadata* pNoteMetadata ) void SetFromNotes( Notes* pNotes )
{ {
if( pNoteMetadata != NULL ) if( pNotes != NULL )
{ {
SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
SetFromDescription( pNoteMetadata->m_sDescription ); SetFromDescription( pNotes->m_sDescription );
} }
else else
{ {
+3 -3
View File
@@ -5,7 +5,7 @@
Desc: A graphic that appears to blur and come into focus. Desc: A graphic that appears to blur and come into focus.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -60,7 +60,7 @@ void FocusingSprite::Update( float fDeltaTime )
} }
void FocusingSprite::RenderPrimitives() void FocusingSprite::DrawPrimitives()
{ {
if( m_BlurState != invisible ) if( m_BlurState != invisible )
{ {
@@ -70,7 +70,7 @@ void FocusingSprite::RenderPrimitives()
m_sprites[1].SetXY( -m_fPercentBlurred*BLUR_DISTANCE*2, -m_fPercentBlurred*BLUR_DISTANCE ); m_sprites[1].SetXY( -m_fPercentBlurred*BLUR_DISTANCE*2, -m_fPercentBlurred*BLUR_DISTANCE );
m_sprites[2].SetXY( 0, 0 ); m_sprites[2].SetXY( 0, 0 );
ActorFrame::RenderPrimitives(); ActorFrame::DrawPrimitives();
} }
} }
+2 -2
View File
@@ -4,7 +4,7 @@
Desc: A graphic that appears to blur and come into focus. Desc: A graphic that appears to blur and come into focus.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -30,7 +30,7 @@ public:
}; };
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
virtual void RenderPrimitives(); virtual void DrawPrimitives();
void StartFocusing(); void StartFocusing();
void StartBlurring(); void StartBlurring();
+3 -3
View File
@@ -5,7 +5,7 @@
Desc: See header. Desc: See header.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -59,7 +59,7 @@ Font::Font( const CString &sFontFilePath )
m_sTexturePath.MakeLower(); m_sTexturePath.MakeLower();
m_pTexture = TEXTURE->LoadTexture( m_sTexturePath, 0, false ); m_pTexture = TEXTUREMAN->LoadTexture( m_sTexturePath );
assert( m_pTexture != NULL ); assert( m_pTexture != NULL );
@@ -139,7 +139,7 @@ Font::Font( const CString &sFontFilePath )
Font::~Font() Font::~Font()
{ {
if( m_pTexture != NULL ) if( m_pTexture != NULL )
TEXTURE->UnloadTexture( m_sTexturePath ); TEXTUREMAN->UnloadTexture( m_sTexturePath );
} }
+1 -1
View File
@@ -4,7 +4,7 @@
Desc: A holder for information that is used by BitmapText objects. Desc: A holder for information that is used by BitmapText objects.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
+1 -1
View File
@@ -5,7 +5,7 @@
Desc: Interface for loading and releasing textures. Desc: Interface for loading and releasing textures.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
+1 -1
View File
@@ -4,7 +4,7 @@
Desc: Manages Loading and Unloading of fonts. Desc: Manages Loading and Unloading of fonts.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
+53 -1
View File
@@ -5,7 +5,7 @@
Desc: A graphic displayed in the FootMeter during Dancing. Desc: A graphic displayed in the FootMeter during Dancing.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -16,3 +16,55 @@
FootMeter::FootMeter()
{
Load( THEME->GetPathTo(FONT_METER) );
SetNumFeet( 0, "" );
}
void FootMeter::SetFromNotes( Notes* pNotes )
{
if( pNotes != NULL )
{
SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
SetNumFeet( pNotes->m_iMeter, pNotes->m_sDescription );
if( pNotes->m_iMeter >= 10 )
this->SetEffectGlowing();
else
this->SetEffectNone();
this->StopTweening();
this->SetZoom( 1.1f );
this->BeginTweening( 0.3f, TWEEN_BOUNCE_BEGIN );
this->SetTweenZoom( 1 );
}
else
{
SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
SetNumFeet( 0, "" );
}
}
void FootMeter::SetNumFeet( int iNumFeet, const CString &sDescription )
{
CString sNewText;
for( int f=0; f<=8; f++ )
sNewText += (f<iNumFeet) ? "1" : "0";
for( f=9; f<=12; f++ )
if( f<iNumFeet )
sNewText += "1";
SetText( sNewText );
CString sTemp = sDescription;
sTemp.MakeLower();
if( sTemp.Find( "basic" ) != -1 ) SetDiffuseColor( D3DXCOLOR(1,1,0,1) );
else if( sTemp.Find( "trick" ) != -1 ) SetDiffuseColor( D3DXCOLOR(1,0,0,1) );
else if( sTemp.Find( "another" ) != -1 )SetDiffuseColor( D3DXCOLOR(1,0,0,1) );
else if( sTemp.Find( "maniac" ) != -1 ) SetDiffuseColor( D3DXCOLOR(0,1,0,1) );
else if( sTemp.Find( "ssr" ) != -1 ) SetDiffuseColor( D3DXCOLOR(0,1,0,1) );
else if( sTemp.Find( "battle" ) != -1 ) SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
else if( sTemp.Find( "couple" ) != -1 ) SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
else SetDiffuseColor( D3DXCOLOR(0.8f,0.8f,0.8f,1) );
}
+7 -51
View File
@@ -1,18 +1,15 @@
#pragma once
/* /*
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
File: FootMeter.h Class: FootMeter
Desc: A graphic displayed in the FootMeter during Dancing. Desc: A graphic displayed in the FootMeter during Dancing.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
#ifndef _FootMeter_H_
#define _FootMeter_H_
#include "Sprite.h" #include "Sprite.h"
#include "Song.h" #include "Song.h"
#include "BitmapText.h" #include "BitmapText.h"
@@ -22,51 +19,10 @@
class FootMeter : public BitmapText class FootMeter : public BitmapText
{ {
public: public:
FootMeter() FootMeter();
{
Load( THEME->GetPathTo(FONT_FEET) );
SetNumFeet( 0, "" ); void SetFromNotes( Notes* pNotes );
};
void SetFromNoteMetadata( NoteMetadata* pNoteMetadata )
{
if( pNoteMetadata != NULL )
{
SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
SetNumFeet( pNoteMetadata->m_iMeter, pNoteMetadata->m_sDescription );
}
else
{
SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
SetNumFeet( 0, "" );
}
};
private: private:
void SetNumFeet( int iNumFeet, const CString &sDescription );
void SetNumFeet( int iNumFeet, const CString &sDescription )
{
CString sNewText;
for( int f=0; f<=9; f++ )
sNewText += (f<iNumFeet) ? "1" : "0";
for( f=10; f<=12; f++ )
if( f<iNumFeet )
sNewText += "1";
SetText( sNewText );
CString sTemp = sDescription;
sTemp.MakeLower();
if( sTemp.Find( "basic" ) != -1 ) SetDiffuseColor( D3DXCOLOR(1,1,0,1) );
else if( sTemp.Find( "trick" ) != -1 ) SetDiffuseColor( D3DXCOLOR(1,0,0,1) );
else if( sTemp.Find( "another" ) != -1 )SetDiffuseColor( D3DXCOLOR(1,0,0,1) );
else if( sTemp.Find( "maniac" ) != -1 ) SetDiffuseColor( D3DXCOLOR(0,1,0,1) );
else if( sTemp.Find( "ssr" ) != -1 ) SetDiffuseColor( D3DXCOLOR(0,1,0,1) );
else if( sTemp.Find( "battle" ) != -1 ) SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
else if( sTemp.Find( "couple" ) != -1 ) SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
else SetDiffuseColor( D3DXCOLOR(0.8f,0.8f,0.8f,1) );
};
}; };
#endif
+17 -5
View File
@@ -5,7 +5,7 @@
Desc: These things don't change very often. Desc: These things don't change very often.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -32,11 +32,19 @@ const int MAX_BEATS = MAX_MEASURES * BEATS_PER_MEASURE;
const int ELEMENTS_PER_BEAT = 12; // It is important that this number is evenly divisible by 2, 3, 4, and 8 const int ELEMENTS_PER_BEAT = 12; // It is important that this number is evenly divisible by 2, 3, 4, and 8
const int ELEMENTS_PER_MEASURE = ELEMENTS_PER_BEAT * BEATS_PER_MEASURE; const int ELEMENTS_PER_MEASURE = ELEMENTS_PER_BEAT * BEATS_PER_MEASURE;
const int MAX_TAP_NOTE_ELEMENTS = MAX_BEATS*ELEMENTS_PER_BEAT; const int MAX_TAP_NOTE_ROWS = MAX_BEATS*ELEMENTS_PER_BEAT;
const int MAX_HOLD_NOTE_ELEMENTS = 200; const int MAX_HOLD_NOTE_ELEMENTS = 200;
const int NUM_RADAR_VALUES = 5; enum RadarCatrgory // starting from 12-o'clock rotating clockwise
{
RADAR_STREAM = 0,
RADAR_VOLTAGE,
RADAR_AIR,
RADAR_CHAOS,
RADAR_FREEZE,
NUM_RADAR_VALUES // leave this at the end
};
enum DifficultyClass enum DifficultyClass
{ {
@@ -160,16 +168,20 @@ struct GameOptions
m_bIgnoreJoyAxes = false; m_bIgnoreJoyAxes = false;
m_bShowFPS = true; m_bShowFPS = true;
m_bUseRandomVis = false; m_bUseRandomVis = false;
m_bSkipCaution = false;
m_bAnnouncer = true; m_bAnnouncer = true;
m_bShowCaution = true;
m_bShowSelectDifficulty = true;
m_bShowSelectGroup = true;
m_iNumArcadeStages = 3; m_iNumArcadeStages = 3;
m_JudgementDifficulty = JUDGE_NORMAL; m_JudgementDifficulty = JUDGE_NORMAL;
}; };
bool m_bIgnoreJoyAxes; bool m_bIgnoreJoyAxes;
bool m_bShowFPS; bool m_bShowFPS;
bool m_bUseRandomVis; bool m_bUseRandomVis;
bool m_bSkipCaution;
bool m_bAnnouncer; bool m_bAnnouncer;
bool m_bShowCaution;
bool m_bShowSelectDifficulty;
bool m_bShowSelectGroup;
int m_iNumArcadeStages; int m_iNumArcadeStages;
enum JudgementDifficulty { JUDGE_EASY=0, JUDGE_NORMAL, JUDGE_HARD }; enum JudgementDifficulty { JUDGE_EASY=0, JUDGE_NORMAL, JUDGE_HARD };
JudgementDifficulty m_JudgementDifficulty; JudgementDifficulty m_JudgementDifficulty;
+27 -1
View File
@@ -5,7 +5,7 @@
Desc: See header. Desc: See header.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -171,3 +171,29 @@ CString GameDef::GetPathToGraphic( const CString sSkinName, const int iInstrumen
FatalError( "The game button graphic '%s%s %s' is missing.", sSkinDir, sButtonName, sGraphicSuffix ); FatalError( "The game button graphic '%s%s %s' is missing.", sSkinDir, sButtonName, sGraphicSuffix );
return ""; return "";
} }
void GameDef::GetTweenColors( const CString sSkinName, const int iInstrumentButton, CArray<D3DXCOLOR,D3DXCOLOR> &arrayTweenColors )
{
const CString sSkinDir = ssprintf("%s\\%s\\", m_sGameDir, sSkinName);
const CString sButtonName = m_sButtonNames[ iInstrumentButton ];
const CString sColorsFilePath = sSkinDir + sButtonName + ".colors";
FILE* file = fopen( sColorsFilePath, "r" );
ASSERT( file != NULL );
if( file == NULL )
return;
bool bSuccess;
do
{
D3DXCOLOR color;
int retval = fscanf( file, "%f,%f,%f,%f\n", &color.r, &color.g, &color.b, &color.a );
bSuccess = retval == 4;
if( bSuccess )
arrayTweenColors.Add( color );
} while( bSuccess );
return;
}
+3 -2
View File
@@ -5,12 +5,12 @@
Desc: Holds information about a particular style of a game (e.g. "single", "double"). Desc: Holds information about a particular style of a game (e.g. "single", "double").
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
#include "NoteMetadata.h" #include "Notes.h"
#include "NoteData.h" #include "NoteData.h"
#include "GameInput.h" #include "GameInput.h"
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
@@ -64,6 +64,7 @@ public:
return false; return false;
} }
CString GetPathToGraphic( const CString sSkinName, const int iInstrumentButton, const GameButtonGraphic gbg ); CString GetPathToGraphic( const CString sSkinName, const int iInstrumentButton, const GameButtonGraphic gbg );
void GetTweenColors( const CString sSkinName, const int iInstrumentButton, CArray<D3DXCOLOR,D3DXCOLOR> &arrayTweenColors );
CString ElementToGraphicSuffix( const GameButtonGraphic gbg ); CString ElementToGraphicSuffix( const GameButtonGraphic gbg );
+1 -1
View File
@@ -5,7 +5,7 @@
Desc: An input event specific to a Game definied by an instrument and a button space. Desc: An input event specific to a Game definied by an instrument and a button space.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
+10 -1
View File
@@ -5,7 +5,7 @@
Desc: See Header. Desc: See Header.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -166,3 +166,12 @@ bool GameManager::IsPlayerEnabled( PlayerNumber PlayerNo )
return false; return false;
} }
void GameManager::GetTweenColors( const PlayerNumber p, const ColumnNumber col, CArray<D3DXCOLOR,D3DXCOLOR> &aTweenColorsAddTo )
{
GameDef* pGameDef = GetCurrentGameDef();
StyleDef* pStyleDef = GetCurrentStyleDef();
StyleInput StyleI( p, col );
GameInput GameI = pStyleDef->StyleInputToGameInput( StyleI );
pGameDef->GetTweenColors( m_sCurrentSkin[p], GameI.button, aTweenColorsAddTo );
}
+2 -1
View File
@@ -6,7 +6,7 @@
Desc: Manages GameDefs (which define different games, like "dance" and "pump") Desc: Manages GameDefs (which define different games, like "dance" and "pump")
and StyleDefs (which define different games, like "single" and "couple") and StyleDefs (which define different games, like "single" and "couple")
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -49,6 +49,7 @@ public:
InstrumentButton b = gi.button; InstrumentButton b = gi.button;
return GetCurrentGameDef()->GetPathToGraphic( m_sCurrentSkin[p], b, gbg ); return GetCurrentGameDef()->GetPathToGraphic( m_sCurrentSkin[p], b, gbg );
} }
void GetTweenColors( const PlayerNumber p, const ColumnNumber col, CArray<D3DXCOLOR,D3DXCOLOR> &aTweenColorsAddTo );
protected: protected:
+3 -3
View File
@@ -41,9 +41,9 @@ void GhostArrow::Step( TapNoteScore score )
case TNS_BOO: SetDiffuseColor( D3DXCOLOR(0.8f,0.0f,0.6f,0.6f) ); break; case TNS_BOO: SetDiffuseColor( D3DXCOLOR(0.8f,0.0f,0.6f,0.6f) ); break;
case TNS_MISS: ASSERT( false ); break; case TNS_MISS: ASSERT( false ); break;
} }
SetZoom( 1.0f ); SetZoom( 1.1f );
BeginTweening( 0.3f ); BeginTweening( 0.30f );
SetTweenZoom( 1.5f ); SetTweenZoom( 1.7f );
D3DXCOLOR colorTween = GetDiffuseColor(); D3DXCOLOR colorTween = GetDiffuseColor();
colorTween.a = 0; colorTween.a = 0;
SetTweenDiffuseColor( colorTween ); SetTweenDiffuseColor( colorTween );
+1 -1
View File
@@ -16,7 +16,7 @@ class GhostArrow;
#include "Sprite.h" #include "Sprite.h"
#include "NoteMetadata.h" #include "Notes.h"
class GhostArrow : public Sprite class GhostArrow : public Sprite
+1 -1
View File
@@ -38,7 +38,7 @@ void GhostArrowBright::Step( TapNoteScore score )
case TNS_MISS: ASSERT( false ); break; case TNS_MISS: ASSERT( false ); break;
} }
SetState( 0 ); SetState( 0 );
SetZoom( 1.2f ); SetZoom( 1.3f );
BeginTweening( 0.35f ); BeginTweening( 0.35f );
SetTweenZoom( 2.5f ); SetTweenZoom( 2.5f );
D3DXCOLOR colorTween = GetDiffuseColor(); D3DXCOLOR colorTween = GetDiffuseColor();
+1 -1
View File
@@ -16,7 +16,7 @@ class GhostArrowBright;
#include "Sprite.h" #include "Sprite.h"
#include "NoteMetadata.h" #include "Notes.h"
class GhostArrowBright : public Sprite class GhostArrowBright : public Sprite
+2 -2
View File
@@ -5,7 +5,7 @@
Desc: A graphic displayed in the GhostArrowRow during Dancing. Desc: A graphic displayed in the GhostArrowRow during Dancing.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -59,7 +59,7 @@ void GhostArrowRow::Update( float fDeltaTime, float fSongBeat )
} }
} }
void GhostArrowRow::RenderPrimitives() void GhostArrowRow::DrawPrimitives()
{ {
for( int c=0; c<m_iNumCols; c++ ) for( int c=0; c<m_iNumCols; c++ )
{ {
+2 -2
View File
@@ -5,7 +5,7 @@
Desc: A row of GhostArrow Actors Desc: A row of GhostArrow Actors
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -24,7 +24,7 @@ class GhostArrowRow : public ActorFrame
public: public:
GhostArrowRow(); GhostArrowRow();
void Update( float fDeltaTime, float fSongBeat ); void Update( float fDeltaTime, float fSongBeat );
virtual void RenderPrimitives(); virtual void DrawPrimitives();
void Load( PlayerOptions po ); void Load( PlayerOptions po );
+1 -1
View File
@@ -5,7 +5,7 @@
Desc: See header. Desc: See header.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
+1 -1
View File
@@ -4,7 +4,7 @@
Desc: This a mark the player receives after clearing a song. Desc: This a mark the player receives after clearing a song.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
+15 -5
View File
@@ -5,7 +5,7 @@
Desc: A graphic displayed in the Grade during Dancing. Desc: A graphic displayed in the Grade during Dancing.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -27,7 +27,7 @@ GradeDisplay::GradeDisplay()
m_fTimeLeftInScroll = 0; m_fTimeLeftInScroll = 0;
// SetGrade( GRADE_NO_DATA ); SetGrade( GRADE_NO_DATA );
} }
void GradeDisplay::Update( float fDeltaTime ) void GradeDisplay::Update( float fDeltaTime )
@@ -47,11 +47,21 @@ void GradeDisplay::Update( float fDeltaTime )
this->SetCustomTextureRect( frectCurrentTextureCoords ); this->SetCustomTextureRect( frectCurrentTextureCoords );
} }
void GradeDisplay::DrawPrimitives()
{
if( m_Grade == GRADE_NO_DATA )
return;
Sprite::DrawPrimitives();
}
void GradeDisplay::SetGrade( Grade g ) void GradeDisplay::SetGrade( Grade g )
{ {
// StopUsingCustomCoords(); m_Grade = g;
// SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); StopUsingCustomCoords();
SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
switch( g ) switch( g )
{ {
@@ -62,7 +72,7 @@ void GradeDisplay::SetGrade( Grade g )
case GRADE_C: SetState(4); break; case GRADE_C: SetState(4); break;
case GRADE_D: SetState(5); break; case GRADE_D: SetState(5); break;
case GRADE_E: SetState(6); break; case GRADE_E: SetState(6); break;
// case GRADE_NO_DATA: SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); break; case GRADE_NO_DATA: break; // don't draw at all if grade = GRADE_NO_DATA
default: ASSERT( false ); default: ASSERT( false );
} }
}; };
+4 -1
View File
@@ -5,7 +5,7 @@
Desc: A graphic displayed in the GradeDisplay during Dancing. Desc: A graphic displayed in the GradeDisplay during Dancing.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -22,12 +22,15 @@ public:
GradeDisplay(); GradeDisplay();
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
virtual void DrawPrimitives();
void SetGrade( Grade g ); void SetGrade( Grade g );
void SpinAndSettleOn( Grade g ); void SpinAndSettleOn( Grade g );
protected: protected:
Grade m_Grade;
// for scrolling // for scrolling
void ScrollToVirtualFrame( int iFrameNo ); // a virtual frame is a tiled state number void ScrollToVirtualFrame( int iFrameNo ); // a virtual frame is a tiled state number
FRECT m_frectStartTexCoords; FRECT m_frectStartTexCoords;
+1 -1
View File
@@ -5,7 +5,7 @@
Desc: A gray arrow that "receives" ColorNotes. Desc: A gray arrow that "receives" ColorNotes.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Ben Nordstrom Ben Nordstrom
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
+2 -2
View File
@@ -4,7 +4,7 @@
Desc: A gray arrow that "receives" ColorNotes. Desc: A gray arrow that "receives" ColorNotes.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Ben Nordstrom Ben Nordstrom
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
@@ -16,7 +16,7 @@
#include "Sprite.h" #include "Sprite.h"
#include "NoteMetadata.h" #include "Notes.h"
class GrayArrow : public Sprite class GrayArrow : public Sprite
{ {
+2 -2
View File
@@ -5,7 +5,7 @@
Desc: See header. Desc: See header.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -52,7 +52,7 @@ void GrayArrowRow::Update( float fDeltaTime, float fSongBeat )
} }
} }
void GrayArrowRow::RenderPrimitives() void GrayArrowRow::DrawPrimitives()
{ {
for( int c=0; c<m_iNumCols; c++ ) for( int c=0; c<m_iNumCols; c++ )
{ {
+2 -2
View File
@@ -4,7 +4,7 @@
Desc: A row of GrayArrow objects Desc: A row of GrayArrow objects
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -26,7 +26,7 @@ class GrayArrowRow : public ActorFrame
public: public:
GrayArrowRow(); GrayArrowRow();
virtual void Update( float fDeltaTime, float fSongBeat ); virtual void Update( float fDeltaTime, float fSongBeat );
virtual void RenderPrimitives(); virtual void DrawPrimitives();
void Load( PlayerOptions po ); void Load( PlayerOptions po );
+56 -19
View File
@@ -5,7 +5,7 @@
Desc: See header. Desc: See header.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -20,15 +20,13 @@
float RADAR_VALUE_ROTATION( int iValueIndex ) { return D3DX_PI/2 + D3DX_PI*2 / 5.0f * iValueIndex; } float RADAR_VALUE_ROTATION( int iValueIndex ) { return D3DX_PI/2 + D3DX_PI*2 / 5.0f * iValueIndex; }
GrooveRadar::GrooveRadar() GrooveRadar::GrooveRadar()
{ {
m_sprRadarBase.Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_RADAR_BASE) ); this->AddActor( &m_GrooveRadarValueMap );
this->AddActor( &m_sprRadarBase );
for( int c=0; c<NUM_RADAR_CATEGORIES; c++ ) for( int c=0; c<NUM_RADAR_CATEGORIES; c++ )
{ {
const float fRadius = m_sprRadarBase.GetZoomedHeight()/2.0f; const float fRadius = m_GrooveRadarValueMap.m_sprRadarBase.GetZoomedHeight()/2.0f;
const float fRotation = RADAR_VALUE_ROTATION(c); const float fRotation = RADAR_VALUE_ROTATION(c);
float fX = cosf(fRotation) * fRadius; float fX = cosf(fRotation) * fRadius;
@@ -52,6 +50,45 @@ GrooveRadar::GrooveRadar()
m_sprRadarLabels[c].SetXY( fX, fY ); m_sprRadarLabels[c].SetXY( fX, fY );
this->AddActor( &m_sprRadarLabels[c] ); this->AddActor( &m_sprRadarLabels[c] );
} }
}
void GrooveRadar::TweenOnScreen()
{
for( int c=0; c<NUM_RADAR_CATEGORIES; c++ )
{
float fOriginalX = m_sprRadarLabels[c].GetX();
m_sprRadarLabels[c].SetX( fOriginalX - 100 );
m_sprRadarLabels[c].SetZoom( 1.5f );
m_sprRadarLabels[c].SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
m_sprRadarLabels[c].BeginTweeningQueued( 0.6f+0.2f*c ); // sleep
m_sprRadarLabels[c].BeginTweeningQueued( 0.1f ); // begin fading on screen
m_sprRadarLabels[c].SetTweenAddColor( D3DXCOLOR(1,1,1,1) );
m_sprRadarLabels[c].BeginTweeningQueued( 0.3f, Actor::TWEEN_BIAS_BEGIN ); // fly to the right
m_sprRadarLabels[c].SetTweenX( fOriginalX );
m_sprRadarLabels[c].SetTweenZoom( 1 );
m_sprRadarLabels[c].SetTweenAddColor( D3DXCOLOR(1,1,1,0) );
m_sprRadarLabels[c].SetTweenDiffuseColor( D3DXCOLOR(1,1,1,1) );
}
m_GrooveRadarValueMap.TweenOnScreen();
}
void GrooveRadar::TweenOffScreen()
{
for( int c=0; c<NUM_RADAR_CATEGORIES; c++ )
{
m_sprRadarLabels[c].BeginTweening( 0.2f );
m_sprRadarLabels[c].SetTweenDiffuseColor( D3DXCOLOR(1,1,1,0) );
}
m_GrooveRadarValueMap.TweenOffScreen();
}
GrooveRadar::GrooveRadarValueMap::GrooveRadarValueMap()
{
m_sprRadarBase.Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_RADAR_BASE) );
this->AddActor( &m_sprRadarBase );
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
{ {
@@ -66,15 +103,15 @@ GrooveRadar::GrooveRadar()
} }
} }
void GrooveRadar::SetFromNoteMetadata( PlayerNumber p, NoteMetadata* pNoteMetadata ) // NULL means no song void GrooveRadar::GrooveRadarValueMap::SetFromNotes( PlayerNumber p, Notes* pNotes ) // NULL means no song
{ {
if( pNoteMetadata != NULL ) if( pNotes != NULL )
{ {
for( int c=0; c<NUM_RADAR_CATEGORIES; c++ ) for( int c=0; c<NUM_RADAR_CATEGORIES; c++ )
{ {
const float fValueCurrent = m_fValuesOld[p][c] * (1-m_PercentTowardNew[p]) + m_fValuesNew[p][c] * m_PercentTowardNew[p]; const float fValueCurrent = m_fValuesOld[p][c] * (1-m_PercentTowardNew[p]) + m_fValuesNew[p][c] * m_PercentTowardNew[p];
m_fValuesOld[p][c] = fValueCurrent; m_fValuesOld[p][c] = fValueCurrent;
m_fValuesNew[p][c] = randomf(0.5f,1.1f); m_fValuesNew[p][c] = pNotes->m_fRadarValues[c];
} }
if( m_bValuesVisible[p] == false ) // the values WERE invisible if( m_bValuesVisible[p] == false ) // the values WERE invisible
@@ -84,13 +121,13 @@ void GrooveRadar::SetFromNoteMetadata( PlayerNumber p, NoteMetadata* pNoteMetada
m_bValuesVisible[p] = true; m_bValuesVisible[p] = true;
} }
else // pNoteMetadata == NULL else // pNotes == NULL
{ {
m_bValuesVisible[p] = false; m_bValuesVisible[p] = false;
} }
} }
void GrooveRadar::Update( float fDeltaTime ) void GrooveRadar::GrooveRadarValueMap::Update( float fDeltaTime )
{ {
ActorFrame::Update( fDeltaTime ); ActorFrame::Update( fDeltaTime );
@@ -100,14 +137,14 @@ void GrooveRadar::Update( float fDeltaTime )
} }
} }
void GrooveRadar::RenderPrimitives() void GrooveRadar::GrooveRadarValueMap::DrawPrimitives()
{ {
ActorFrame::RenderPrimitives(); ActorFrame::DrawPrimitives();
// draw radar filling // draw radar filling
const float fRadius = m_sprRadarBase.GetZoomedHeight()/2.0f; const float fRadius = m_sprRadarBase.GetZoomedHeight()/2.0f;
LPDIRECT3DVERTEXBUFFER8 pVB = SCREEN->GetVertexBuffer(); LPDIRECT3DVERTEXBUFFER8 pVB = DISPLAY->GetVertexBuffer();
LPDIRECT3DDEVICE8 pd3dDevice = SCREEN->GetDevice(); LPDIRECT3DDEVICE8 pd3dDevice = DISPLAY->GetDevice();
pd3dDevice->SetTexture( 0, NULL ); pd3dDevice->SetTexture( 0, NULL );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
@@ -115,7 +152,7 @@ void GrooveRadar::RenderPrimitives()
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE ); pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
CUSTOMVERTEX* v; RAGEVERTEX* v;
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
{ {
@@ -138,7 +175,7 @@ void GrooveRadar::RenderPrimitives()
{ {
const int c = i%NUM_RADAR_CATEGORIES; const int c = i%NUM_RADAR_CATEGORIES;
const float fDistFromCenter = const float fDistFromCenter =
( m_fValuesOld[p][c] * (1-m_PercentTowardNew[p]) + m_fValuesNew[p][c] * m_PercentTowardNew[p] ) * fRadius; ( m_fValuesOld[p][c] * (1-m_PercentTowardNew[p]) + m_fValuesNew[p][c] * m_PercentTowardNew[p] + 0.15f ) * fRadius;
const float fRotation = RADAR_VALUE_ROTATION(i); const float fRotation = RADAR_VALUE_ROTATION(i);
const float fX = cosf(fRotation) * fDistFromCenter; const float fX = cosf(fRotation) * fDistFromCenter;
const float fY = -sinf(fRotation) * fDistFromCenter; const float fY = -sinf(fRotation) * fDistFromCenter;
@@ -161,7 +198,7 @@ void GrooveRadar::RenderPrimitives()
{ {
const int c = i%NUM_RADAR_CATEGORIES; const int c = i%NUM_RADAR_CATEGORIES;
const float fDistFromCenter = const float fDistFromCenter =
( m_fValuesOld[p][c] * (1-m_PercentTowardNew[p]) + m_fValuesNew[p][c] * m_PercentTowardNew[p] ) * fRadius; ( m_fValuesOld[p][c] * (1-m_PercentTowardNew[p]) + m_fValuesNew[p][c] * m_PercentTowardNew[p] + 0.15f ) * fRadius;
const float fDistFromCenterInner = fDistFromCenter-2; const float fDistFromCenterInner = fDistFromCenter-2;
const float fDistFromCenterOutter = fDistFromCenter+2; const float fDistFromCenterOutter = fDistFromCenter+2;
const float fRotation = RADAR_VALUE_ROTATION(i); const float fRotation = RADAR_VALUE_ROTATION(i);
@@ -184,7 +221,7 @@ void GrooveRadar::RenderPrimitives()
} }
void GrooveRadar::TweenOnScreen() void GrooveRadar::GrooveRadarValueMap::TweenOnScreen()
{ {
SetZoom( 0.5f ); SetZoom( 0.5f );
SetRotation( D3DX_PI*4 ); SetRotation( D3DX_PI*4 );
@@ -193,7 +230,7 @@ void GrooveRadar::TweenOnScreen()
SetTweenRotationZ( 0 ); SetTweenRotationZ( 0 );
} }
void GrooveRadar::TweenOffScreen() void GrooveRadar::GrooveRadarValueMap::TweenOffScreen()
{ {
BeginTweening( 0.6f ); BeginTweening( 0.6f );
SetTweenRotationZ( D3DX_PI*4 ); SetTweenRotationZ( D3DX_PI*4 );
+27 -10
View File
@@ -5,7 +5,7 @@
Desc: The song's GrooveRadar displayed in SelectSong. Desc: The song's GrooveRadar displayed in SelectSong.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -22,21 +22,38 @@ class GrooveRadar : public ActorFrame
public: public:
GrooveRadar(); GrooveRadar();
virtual void Update( float fDeltaTime ); void SetFromNotes( PlayerNumber p, Notes* pNotes ) // NULL means no Song
virtual void RenderPrimitives(); {
m_GrooveRadarValueMap.SetFromNotes( p, pNotes );
void SetFromNoteMetadata( PlayerNumber p, NoteMetadata* pNoteMetadata ); // NULL means no Song }
void TweenOnScreen(); void TweenOnScreen();
void TweenOffScreen(); void TweenOffScreen();
protected: protected:
bool m_bValuesVisible[NUM_PLAYERS]; // the value map must be a separate Actor so we can tween it separately from the labels
float m_PercentTowardNew[NUM_PLAYERS]; class GrooveRadarValueMap : public ActorFrame
float m_fValuesNew[NUM_PLAYERS][NUM_RADAR_CATEGORIES]; {
float m_fValuesOld[NUM_PLAYERS][NUM_RADAR_CATEGORIES]; public:
GrooveRadarValueMap();
Sprite m_sprRadarBase; virtual void Update( float fDeltaTime );
virtual void DrawPrimitives();
void SetFromNotes( PlayerNumber p, Notes* pNotes ); // NULL means no Song
void TweenOnScreen();
void TweenOffScreen();
bool m_bValuesVisible[NUM_PLAYERS];
float m_PercentTowardNew[NUM_PLAYERS];
float m_fValuesNew[NUM_PLAYERS][NUM_RADAR_CATEGORIES];
float m_fValuesOld[NUM_PLAYERS][NUM_RADAR_CATEGORIES];
Sprite m_sprRadarBase;
};
GrooveRadarValueMap m_GrooveRadarValueMap;
Sprite m_sprRadarLabels[NUM_RADAR_CATEGORIES]; Sprite m_sprRadarLabels[NUM_RADAR_CATEGORIES];
}; };
+1 -1
View File
@@ -16,7 +16,7 @@ class HoldGhostArrow;
#include "Sprite.h" #include "Sprite.h"
#include "NoteMetadata.h" #include "Notes.h"
class HoldGhostArrow : public Sprite class HoldGhostArrow : public Sprite
+4 -4
View File
@@ -5,7 +5,7 @@
Desc: A graphic displayed in the HoldJudgement during Dancing. Desc: A graphic displayed in the HoldJudgement during Dancing.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -21,7 +21,7 @@ const float JUDGEMENT_DISPLAY_TIME = 0.6f;
HoldJudgement::HoldJudgement() HoldJudgement::HoldJudgement()
{ {
m_fDisplayCountdown = 0; m_fDisplayCountdown = 0;
m_sprJudgement.Load( THEME->GetPathTo(GRAPHIC_JUDGEMENT) ); m_sprJudgement.Load( THEME->GetPathTo(GRAPHIC_GAMEPLAY_JUDGEMENT) );
m_sprJudgement.StopAnimating(); m_sprJudgement.StopAnimating();
this->AddActor( &m_sprJudgement ); this->AddActor( &m_sprJudgement );
} }
@@ -35,11 +35,11 @@ void HoldJudgement::Update( float fDeltaTime )
m_fDisplayCountdown = 0; m_fDisplayCountdown = 0;
} }
void HoldJudgement::RenderPrimitives() void HoldJudgement::DrawPrimitives()
{ {
if( m_fDisplayCountdown > 0 ) if( m_fDisplayCountdown > 0 )
{ {
ActorFrame::RenderPrimitives(); ActorFrame::DrawPrimitives();
} }
} }
+2 -2
View File
@@ -4,7 +4,7 @@
Desc: A graphic displayed in the HoldJudgement during Dancing. Desc: A graphic displayed in the HoldJudgement during Dancing.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -26,7 +26,7 @@ public:
HoldJudgement(); HoldJudgement();
void SetHoldJudgement( HoldNoteResult result ); void SetHoldJudgement( HoldNoteResult result );
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
virtual void RenderPrimitives(); virtual void DrawPrimitives();
protected: protected:
Sprite m_sprJudgement; Sprite m_sprJudgement;
+1 -1
View File
@@ -4,7 +4,7 @@
Desc: Wrapper for reading and writing an .ini file. Desc: Wrapper for reading and writing an .ini file.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
+1 -1
View File
@@ -4,7 +4,7 @@
Desc: Wrapper for reading and writing an .ini file. Desc: Wrapper for reading and writing an .ini file.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
+9 -9
View File
@@ -5,7 +5,7 @@
Desc: See header. Desc: See header.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -16,13 +16,13 @@
#include "RageInput.h" #include "RageInput.h"
#include "ErrorCatcher/ErrorCatcher.h" #include "ErrorCatcher/ErrorCatcher.h"
InputFilter* FILTER = NULL; // global and accessable from anywhere in our program InputFilter* INPUTFILTER = NULL; // global and accessable from anywhere in our program
void InputFilter::GetInputEvents( InputEventArray &array, float fDeltaTime ) void InputFilter::GetInputEvents( InputEventArray &array, float fDeltaTime )
{ {
INPUTM->Update(); INPUTMAN->Update();
for( int d=0; d<NUM_INPUT_DEVICES; d++ ) // foreach InputDevice for( int d=0; d<NUM_INPUT_DEVICES; d++ ) // foreach InputDevice
{ {
@@ -46,9 +46,9 @@ void InputFilter::GetInputEvents( InputEventArray &array, float fDeltaTime )
{ {
const DeviceInput di = DeviceInput(InputDevice(d),b); const DeviceInput di = DeviceInput(InputDevice(d),b);
if( INPUTM->WasBeingPressed(di) ) if( INPUTMAN->WasBeingPressed(di) )
{ {
if( INPUTM->IsBeingPressed(di) ) if( INPUTMAN->IsBeingPressed(di) )
{ {
const float fOldHoldTime = m_fTimeHeld[d][b]; const float fOldHoldTime = m_fTimeHeld[d][b];
m_fTimeHeld[d][b] += fDeltaTime; m_fTimeHeld[d][b] += fDeltaTime;
@@ -72,14 +72,14 @@ void InputFilter::GetInputEvents( InputEventArray &array, float fDeltaTime )
array.Add( InputEvent(di,iet) ); array.Add( InputEvent(di,iet) );
} }
} }
else // !INPUTM->IsBeingPressed(di) else // !INPUTMAN->IsBeingPressed(di)
m_fTimeHeld[d][b] = 0; m_fTimeHeld[d][b] = 0;
} }
else // !INPUTM->WasBeingPressed(di) else // !INPUTMAN->WasBeingPressed(di)
{ {
if( INPUTM->IsBeingPressed(di) ) if( INPUTMAN->IsBeingPressed(di) )
array.Add( InputEvent(di,IET_FIRST_PRESS) ); array.Add( InputEvent(di,IET_FIRST_PRESS) );
else // !INPUTM->IsBeingPressed(di) else // !INPUTMAN->IsBeingPressed(di)
; // don't care ; // don't care
} }
} }
+2 -2
View File
@@ -7,7 +7,7 @@
represent when a button is first pressed, when a button is released, represent when a button is first pressed, when a button is released,
or when an repeating input fires. or when an repeating input fires.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -53,5 +53,5 @@ public:
}; };
extern InputFilter* FILTER; // global and accessable from anywhere in our program extern InputFilter* INPUTFILTER; // global and accessable from anywhere in our program
+4 -4
View File
@@ -5,7 +5,7 @@
Desc: See Header. Desc: See Header.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -15,7 +15,7 @@
#include "GameManager.h" #include "GameManager.h"
InputMapper* MAPPER = NULL; // global and accessable from anywhere in our program InputMapper* INPUTMAPPER = NULL; // global and accessable from anywhere in our program
InputMapper::InputMapper() InputMapper::InputMapper()
@@ -200,7 +200,7 @@ const HardCodedMenuKey g_HardCodedMenuKeys[] =
{ DEVICE_KEYBOARD, DIK_DOWN, PLAYER_1, MENU_BUTTON_DOWN }, { DEVICE_KEYBOARD, DIK_DOWN, PLAYER_1, MENU_BUTTON_DOWN },
{ DEVICE_KEYBOARD, DIK_LEFT, PLAYER_1, MENU_BUTTON_LEFT }, { DEVICE_KEYBOARD, DIK_LEFT, PLAYER_1, MENU_BUTTON_LEFT },
{ DEVICE_KEYBOARD, DIK_RIGHT, PLAYER_1, MENU_BUTTON_RIGHT }, { DEVICE_KEYBOARD, DIK_RIGHT, PLAYER_1, MENU_BUTTON_RIGHT },
{ DEVICE_KEYBOARD, DIK_RETURN, PLAYER_1, MENU_BUTTON_NEXT }, { DEVICE_KEYBOARD, DIK_RETURN, PLAYER_1, MENU_BUTTON_START },
{ DEVICE_KEYBOARD, DIK_ESCAPE, PLAYER_1, MENU_BUTTON_BACK }, { DEVICE_KEYBOARD, DIK_ESCAPE, PLAYER_1, MENU_BUTTON_BACK },
}; };
const int NUM_HARD_CODED_MENU_KEYS = sizeof(g_HardCodedMenuKeys) / sizeof(HardCodedMenuKey); const int NUM_HARD_CODED_MENU_KEYS = sizeof(g_HardCodedMenuKeys) / sizeof(HardCodedMenuKey);
@@ -265,7 +265,7 @@ bool InputMapper::IsButtonDown( GameInput GameI )
if( GameToDevice( GameI, i, DeviceI ) ) if( GameToDevice( GameI, i, DeviceI ) )
{ {
if( INPUTM->IsBeingPressed( DeviceI ) ) if( INPUTMAN->IsBeingPressed( DeviceI ) )
return true; return true;
} }
} }
+2 -2
View File
@@ -7,7 +7,7 @@
also has temporary holders for information that passed between windows - e.g. also has temporary holders for information that passed between windows - e.g.
ScoreSummary. ScoreSummary.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -75,4 +75,4 @@ protected:
}; };
extern InputMapper* MAPPER; // global and accessable from anywhere in our program extern InputMapper* INPUTMAPPER; // global and accessable from anywhere in our program
+33 -11
View File
@@ -5,7 +5,7 @@
Desc: A graphic displayed in the Judgement during Dancing. Desc: A graphic displayed in the Judgement during Dancing.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -15,14 +15,15 @@
#include "ThemeManager.h" #include "ThemeManager.h"
const float JUDGEMENT_DISPLAY_TIME = 0.6f; const float JUDGEMENT_DISPLAY_TIME = 0.8f;
Judgement::Judgement() Judgement::Judgement()
{ {
m_fDisplayCountdown = 0; m_fDisplayCountdown = 0;
m_sprJudgement.Load( THEME->GetPathTo(GRAPHIC_JUDGEMENT) ); m_sprJudgement.Load( THEME->GetPathTo(GRAPHIC_GAMEPLAY_JUDGEMENT) );
m_sprJudgement.StopAnimating(); m_sprJudgement.StopAnimating();
m_sprJudgement.TurnShadowOn();
this->AddActor( &m_sprJudgement ); this->AddActor( &m_sprJudgement );
} }
@@ -35,11 +36,11 @@ void Judgement::Update( float fDeltaTime )
m_fDisplayCountdown = 0; m_fDisplayCountdown = 0;
} }
void Judgement::RenderPrimitives() void Judgement::DrawPrimitives()
{ {
if( m_fDisplayCountdown > 0 ) if( m_fDisplayCountdown > 0 )
{ {
ActorFrame::RenderPrimitives(); ActorFrame::DrawPrimitives();
} }
} }
@@ -60,19 +61,40 @@ void Judgement::SetJudgement( TapNoteScore score )
m_fDisplayCountdown = JUDGEMENT_DISPLAY_TIME; m_fDisplayCountdown = JUDGEMENT_DISPLAY_TIME;
m_sprJudgement.SetEffectNone();
if( score == TNS_MISS ) if( score == TNS_MISS )
{ {
// falling down // falling down
m_sprJudgement.SetY( -30 ); m_sprJudgement.SetY( -20 );
m_sprJudgement.SetZoom( 1.0f ); //m_sprJudgement.SetZoom( 1.0f );
m_sprJudgement.BeginTweening( JUDGEMENT_DISPLAY_TIME ); m_sprJudgement.BeginTweening( JUDGEMENT_DISPLAY_TIME );
m_sprJudgement.SetTweenY( 30 ); m_sprJudgement.SetTweenY( 20 );
}
else if( score == TNS_BOO )
{
// vibrate
m_sprJudgement.StopTweening();
m_sprJudgement.SetY( 0 );
m_sprJudgement.SetZoom( 1.0f );
m_sprJudgement.SetEffectVibrating();
} }
else else
{ {
// zooming out // zooming out
m_sprJudgement.SetZoom( 1.35f ); float fMagnitudeX, fMagnitudeY;
m_sprJudgement.BeginTweening( JUDGEMENT_DISPLAY_TIME/5.0f ); switch( score )
m_sprJudgement.SetTweenZoom( 1.0f ); {
case TNS_PERFECT: fMagnitudeX = 1.50f; fMagnitudeY = 2.00f; break;
case TNS_GREAT: fMagnitudeX = 1.30f; fMagnitudeY = 1.50f; break;
case TNS_GOOD: fMagnitudeX = 1.10f; fMagnitudeY = 1.25f; break;
default: ASSERT(false); // invalid score value
}
m_sprJudgement.StopTweening();
m_sprJudgement.SetY( 0 );
// m_sprJudgement.SetZoomY( fMagnitudeY );
// m_sprJudgement.SetZoomX( fMagnitudeX );
// m_sprJudgement.BeginTweening( JUDGEMENT_DISPLAY_TIME/5.0f );
// m_sprJudgement.SetTweenZoom( 1 );
} }
} }
+2 -2
View File
@@ -4,7 +4,7 @@
Desc: A graphic displayed in the Judgement during Dancing. Desc: A graphic displayed in the Judgement during Dancing.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -26,7 +26,7 @@ public:
Judgement(); Judgement();
void SetJudgement( TapNoteScore score ); void SetJudgement( TapNoteScore score );
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
virtual void RenderPrimitives(); virtual void DrawPrimitives();
protected: protected:
Sprite m_sprJudgement; Sprite m_sprJudgement;
+10 -14
View File
@@ -5,7 +5,7 @@
Desc: See header. Desc: See header.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -20,11 +20,6 @@ const float SECTION_WIDTH = 1.0f/NUM_SECTIONS;
LifeMeterBar::LifeMeterBar() LifeMeterBar::LifeMeterBar()
{ {
}
void LifeMeterBar::SetPlayerOptions(const PlayerOptions& po) {
m_po = po;
//m_fLifePercentage = m_po.m_fInitialLifePercentage;
m_fLifePercentage = 0.5f; m_fLifePercentage = 0.5f;
m_fTrailingLifePercentage = 0; m_fTrailingLifePercentage = 0;
m_fLifeVelocity = 0; m_fLifeVelocity = 0;
@@ -55,7 +50,7 @@ void LifeMeterBar::Update( float fDeltaTime )
m_fLifeVelocity += fDelta * fDeltaTime; m_fLifeVelocity += fDelta * fDeltaTime;
m_fLifeVelocity = clamp( m_fLifeVelocity, -0.15f, 0.15f ); m_fLifeVelocity = clamp( m_fLifeVelocity, -0.30f, 0.30f );
m_fLifeVelocity *= 1-fDeltaTime*2; m_fLifeVelocity *= 1-fDeltaTime*2;
@@ -84,19 +79,20 @@ const D3DXCOLOR COLOR_FULL_2 = D3DXCOLOR(1,1,0,1);
D3DXCOLOR LifeMeterBar::GetColor( float fPercentIntoSection ) D3DXCOLOR LifeMeterBar::GetColor( float fPercentIntoSection )
{ {
const float fPercentColor1 = fabsf( fPercentIntoSection*2 - 1 ); float fPercentColor1 = fabsf( fPercentIntoSection*2 - 1 );
fPercentColor1 *= fPercentColor1 * fPercentColor1;
if( m_fLifePercentage == 1 ) if( m_fLifePercentage == 1 )
return COLOR_FULL_1 * fPercentColor1 + COLOR_FULL_2 * (1-fPercentColor1); return COLOR_FULL_1 * fPercentColor1 + COLOR_FULL_2 * (1-fPercentColor1);
else else
return COLOR_NORMAL_1 * fPercentColor1 + COLOR_NORMAL_2 * (1-fPercentColor1); return COLOR_NORMAL_1 * fPercentColor1 + COLOR_NORMAL_2 * (1-fPercentColor1);
} }
void LifeMeterBar::RenderPrimitives() void LifeMeterBar::DrawPrimitives()
{ {
// make the object in logical units centered at the origin // make the object in logical units centered at the origin
LPDIRECT3DVERTEXBUFFER8 pVB = SCREEN->GetVertexBuffer(); LPDIRECT3DVERTEXBUFFER8 pVB = DISPLAY->GetVertexBuffer();
CUSTOMVERTEX* v; RAGEVERTEX* v;
pVB->Lock( 0, 0, (BYTE**)&v, 0 ); pVB->Lock( 0, 0, (BYTE**)&v, 0 );
int iNumV = 0; int iNumV = 0;
@@ -175,7 +171,7 @@ void LifeMeterBar::RenderPrimitives()
pVB->Unlock(); pVB->Unlock();
LPDIRECT3DDEVICE8 pd3dDevice = SCREEN->GetDevice(); LPDIRECT3DDEVICE8 pd3dDevice = DISPLAY->GetDevice();
pd3dDevice->SetTexture( 0, NULL ); pd3dDevice->SetTexture( 0, NULL );
@@ -191,8 +187,8 @@ void LifeMeterBar::RenderPrimitives()
// finally! Pump those triangles! // finally! Pump those triangles!
pd3dDevice->SetVertexShader( D3DFVF_CUSTOMVERTEX ); pd3dDevice->SetVertexShader( D3DFVF_RAGEVERTEX );
pd3dDevice->SetStreamSource( 0, pVB, sizeof(CUSTOMVERTEX) ); pd3dDevice->SetStreamSource( 0, pVB, sizeof(RAGEVERTEX) );
pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, iNumV-2 ); pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, iNumV-2 );
} }
+7 -14
View File
@@ -5,38 +5,31 @@
Desc: A graphic displayed in the LifeMeterBar during Dancing. Desc: A graphic displayed in the LifeMeterBar during Dancing.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
#include "ActorFrame.h" #include "LifeMeter.h"
#include "Sprite.h" #include "Sprite.h"
#include "ScoreDisplayRolling.h" #include "Quad.h"
class LifeMeterBar : public ActorFrame class LifeMeterBar : public LifeMeter
{ {
public: public:
LifeMeterBar(); LifeMeterBar();
void SetPlayerOptions(const PlayerOptions& po);
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
virtual void RenderPrimitives(); virtual void DrawPrimitives();
void SetBeat( float fSongBeat ) { m_fSongBeat = fSongBeat; }; virtual void ChangeLife( TapNoteScore score );
virtual float GetLifePercentage();
void ChangeLife( TapNoteScore score );
float GetLifePercentage();
private: private:
D3DXCOLOR GetColor( float fPercentIntoSection ); D3DXCOLOR GetColor( float fPercentIntoSection );
float m_fSongBeat;
float m_fLifePercentage; float m_fLifePercentage;
float m_fTrailingLifePercentage; // this approaches m_fLifePercentage float m_fTrailingLifePercentage; // this approaches m_fLifePercentage
float m_fLifeVelocity; // how m_fTrailingLifePercentage approaches m_fLifePercentage float m_fLifeVelocity; // how m_fTrailingLifePercentage approaches m_fLifePercentage
PlayerOptions m_po;
}; };
+10 -9
View File
@@ -3,9 +3,10 @@
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
File: MenuElements.h File: MenuElements.h
Desc: Base class for menu Windows. Desc: Base class for menu Screens.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -13,8 +14,8 @@
#include "RageTextureManager.h" #include "RageTextureManager.h"
#include "RageUtil.h" #include "RageUtil.h"
#include "RageMusic.h" #include "RageMusic.h"
#include "WindowManager.h" #include "ScreenManager.h"
#include "WindowDancing.h" #include "ScreenGameplay.h"
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "ThemeManager.h" #include "ThemeManager.h"
#include "RageLog.h" #include "RageLog.h"
@@ -80,7 +81,7 @@ void MenuElements::TweenTopEdgeOnScreen()
m_textHelp.BeginTweening( MENU_ELEMENTS_TWEEN_TIME ); m_textHelp.BeginTweening( MENU_ELEMENTS_TWEEN_TIME );
m_textHelp.SetTweenZoomY( fOriginalZoomY ); m_textHelp.SetTweenZoomY( fOriginalZoomY );
m_soundSwoosh.PlayRandom(); m_soundSwoosh.Play();
} }
void MenuElements::TweenTopEdgeOffScreen() void MenuElements::TweenTopEdgeOffScreen()
@@ -92,7 +93,7 @@ void MenuElements::TweenTopEdgeOffScreen()
m_textHelp.BeginTweening( MENU_ELEMENTS_TWEEN_TIME ); m_textHelp.BeginTweening( MENU_ELEMENTS_TWEEN_TIME );
m_textHelp.SetTweenZoomY( 0 ); m_textHelp.SetTweenZoomY( 0 );
m_soundSwoosh.PlayRandom(); m_soundSwoosh.Play();
} }
void MenuElements::TweenBackgroundOnScreen() void MenuElements::TweenBackgroundOnScreen()
@@ -106,7 +107,7 @@ void MenuElements::TweenBackgroundOnScreen()
m_sprBG.BeginTweening( MENU_ELEMENTS_TWEEN_TIME ); m_sprBG.BeginTweening( MENU_ELEMENTS_TWEEN_TIME );
m_sprBG.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,1) ); m_sprBG.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,1) );
m_soundSwoosh.PlayRandom(); m_soundSwoosh.Play();
} }
void MenuElements::TweenBackgroundOffScreen() void MenuElements::TweenBackgroundOffScreen()
@@ -118,7 +119,7 @@ void MenuElements::TweenBackgroundOffScreen()
m_sprBG.BeginTweening( MENU_ELEMENTS_TWEEN_TIME ); m_sprBG.BeginTweening( MENU_ELEMENTS_TWEEN_TIME );
m_sprBG.SetTweenDiffuseColor( D3DXCOLOR(0,0,0,1) ); m_sprBG.SetTweenDiffuseColor( D3DXCOLOR(0,0,0,1) );
m_soundBack.PlayRandom(); m_soundBack.Play();
} }
void MenuElements::TweenAllOnScreen() void MenuElements::TweenAllOnScreen()
@@ -154,7 +155,7 @@ void MenuElements::SetTopEdgeOffScreen()
} }
void MenuElements::RenderPrimitives() void MenuElements::DrawPrimitives()
{ {
// do nothing. Call DrawBottomLayer() and DrawTopLayer() instead. // do nothing. Call DrawBottomLayer() and DrawTopLayer() instead.
} }
+6 -6
View File
@@ -2,9 +2,9 @@
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
File: MenuElements.h File: MenuElements.h
Desc: Base class for menu Windows. Desc: Base class for menu Screens.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
#ifndef _MenuElements_H_ #ifndef _MenuElements_H_
@@ -12,7 +12,7 @@
#include "Window.h" #include "Screen.h"
#include "Sprite.h" #include "Sprite.h"
#include "BitmapText.h" #include "BitmapText.h"
#include "RandomSample.h" #include "RandomSample.h"
@@ -27,7 +27,7 @@ class MenuElements : public ActorFrame
public: public:
MenuElements(); MenuElements();
virtual void RenderPrimitives(); virtual void DrawPrimitives();
void Load( CString sBackgroundPath, CString sTopEdgePath, CString sHelpText ); void Load( CString sBackgroundPath, CString sTopEdgePath, CString sHelpText );
@@ -56,8 +56,8 @@ protected:
Sprite m_sprBottomEdge; Sprite m_sprBottomEdge;
BitmapText m_textHelp; BitmapText m_textHelp;
RandomSample m_soundSwoosh; RageSoundSample m_soundSwoosh;
RandomSample m_soundBack; RageSoundSample m_soundBack;
}; };
+2 -2
View File
@@ -6,7 +6,7 @@
Desc: An input event specific to a menu navigation. This is generated based Desc: An input event specific to a menu navigation. This is generated based
on a GameDef. on a GameDef.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -19,7 +19,7 @@ enum MenuButton
MENU_BUTTON_RIGHT, MENU_BUTTON_RIGHT,
MENU_BUTTON_UP, MENU_BUTTON_UP,
MENU_BUTTON_DOWN, MENU_BUTTON_DOWN,
MENU_BUTTON_NEXT, MENU_BUTTON_START,
MENU_BUTTON_BACK, MENU_BUTTON_BACK,
NUM_MENU_BUTTONS, // leave this at the end NUM_MENU_BUTTONS, // leave this at the end
MENU_BUTTON_NONE MENU_BUTTON_NONE
+1 -1
View File
@@ -5,7 +5,7 @@
Desc: A graphic that appears to blur and come into focus. Desc: A graphic that appears to blur and come into focus.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
+2 -2
View File
@@ -4,7 +4,7 @@
Desc: A graphic that appears to blur and come into focus. Desc: A graphic that appears to blur and come into focus.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -26,7 +26,7 @@ public:
virtual void Update( float fDeltaTime ) { for( int i=0; i<NUM_BLUR_GHOSTS; i++ ) m_sprites[i].Update( fDeltaTime ); }; virtual void Update( float fDeltaTime ) { for( int i=0; i<NUM_BLUR_GHOSTS; i++ ) m_sprites[i].Update( fDeltaTime ); };
virtual void Draw() { for(int i=0; i<NUM_BLUR_GHOSTS; i++) m_sprites[i].Draw(); }; virtual void Draw() { for(int i=0; i<NUM_BLUR_GHOSTS; i++) m_sprites[i].Draw(); };
virtual void RenderPrimitives() {}; virtual void DrawPrimitives() {};
virtual float GetX() { return m_sprites[0].GetX(); }; virtual float GetX() { return m_sprites[0].GetX(); };
virtual float GetY() { return m_sprites[0].GetY(); }; virtual float GetY() { return m_sprites[0].GetY(); };
+1 -1
View File
@@ -5,7 +5,7 @@
Desc: A graphic displayed in the MusicSortDisplay during Dancing. Desc: A graphic displayed in the MusicSortDisplay during Dancing.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
+1 -1
View File
@@ -4,7 +4,7 @@
Desc: A graphic displayed in the MusicSortDisplay during Dancing. Desc: A graphic displayed in the MusicSortDisplay during Dancing.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
+1 -1
View File
@@ -5,7 +5,7 @@
Desc: A graphic displayed in the MusicStatusDisplay during Dancing. Desc: A graphic displayed in the MusicStatusDisplay during Dancing.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
+3 -3
View File
@@ -4,7 +4,7 @@
Desc: A graphic displayed in the MusicStatusDisplay during Dancing. Desc: A graphic displayed in the MusicStatusDisplay during Dancing.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -72,7 +72,7 @@ public:
}; };
virtual void RenderPrimitives() virtual void DrawPrimitives()
{ {
switch( m_MusicStatusDisplayType ) switch( m_MusicStatusDisplayType )
{ {
@@ -88,7 +88,7 @@ public:
break; break;
} }
Sprite::RenderPrimitives(); Sprite::DrawPrimitives();
} }
protected: protected:
+132 -86
View File
@@ -5,7 +5,7 @@
Desc: See header. Desc: See header.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -16,13 +16,12 @@
#include "GameManager.h" #include "GameManager.h"
#include "ThemeManager.h" #include "ThemeManager.h"
#include "RageMusic.h" #include "RageMusic.h"
#include "WindowManager.h" // for sending SM_PlayMusicSample #include "ScreenManager.h" // for sending SM_PlayMusicSample
#include "RageLog.h" #include "RageLog.h"
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
const float SWITCH_MUSIC_TIME = 0.3f; const float SWITCH_MUSIC_TIME = 0.3f;
const float SORT_ICON_ON_SCREEN_X = -140; const float SORT_ICON_ON_SCREEN_X = -140;
@@ -32,12 +31,32 @@ const float SORT_ICON_OFF_SCREEN_X = SORT_ICON_ON_SCREEN_X;
const float SORT_ICON_OFF_SCREEN_Y = SORT_ICON_ON_SCREEN_Y - 64; const float SORT_ICON_OFF_SCREEN_Y = SORT_ICON_ON_SCREEN_Y - 64;
const float SCORE_X = 86; const float SCORE_X = 58;
const float SCORE_Y[NUM_PLAYERS] = { -34, 34 }; const float SCORE_Y[NUM_PLAYERS] = { -40, 40 };
const float SCROLLBAR_X = 150; const float SCROLLBAR_X = 150;
D3DXCOLOR COLOR_SECTION_LETTERS = D3DXCOLOR(1,1,0.3f,1); D3DXCOLOR COLOR_SECTION_TEXT = D3DXCOLOR(1,1,0.3f,1);
D3DXCOLOR SECTION_COLORS[] = {
D3DXCOLOR( 0.9f, 0.0f, 0.2f, 1 ), // red
D3DXCOLOR( 0.6f, 0.0f, 0.4f, 1 ), // pink
D3DXCOLOR( 0.2f, 0.1f, 0.3f, 1 ), // purple
D3DXCOLOR( 0.0f, 0.4f, 0.8f, 1 ), // sky blue
D3DXCOLOR( 0.0f, 0.6f, 0.6f, 1 ), // sea green
D3DXCOLOR( 0.0f, 0.6f, 0.2f, 1 ), // green
D3DXCOLOR( 0.8f, 0.6f, 0.0f, 1 ), // orange
};
const int NUM_SECTION_COLORS = sizeof(SECTION_COLORS)/sizeof(D3DXCOLOR);
inline D3DXCOLOR GetNextSectionColor()
{
static int i=0;
i = i % NUM_SECTION_COLORS;
return SECTION_COLORS[i++];
}
WheelItemData::WheelItemData() WheelItemData::WheelItemData()
@@ -46,41 +65,43 @@ WheelItemData::WheelItemData()
m_MusicStatusDisplayType = TYPE_NONE; m_MusicStatusDisplayType = TYPE_NONE;
} }
void WheelItemData::LoadFromSectionName( const CString &sSectionName ) void WheelItemData::Load( WheelItemType wit, Song* pSong, const CString &sSectionName, const D3DXCOLOR color )
{ {
m_WheelItemType = TYPE_SECTION; m_WheelItemType = wit;
m_sSectionName = sSectionName;
}
void WheelItemData::LoadFromSong( Song* pSong )
{
ASSERT( pSong != NULL );
m_pSong = pSong; m_pSong = pSong;
m_WheelItemType = TYPE_SONG; m_sSectionName = sSectionName;
m_color = color;
} }
WheelItemDisplay::WheelItemDisplay() WheelItemDisplay::WheelItemDisplay()
{ {
m_MusicStatusDisplay.SetXY( -136, 0 ); m_MusicStatusDisplay.SetXY( -136, 0 );
m_Banner.SetHorizAlign( align_left ); m_TextBanner.SetHorizAlign( align_left );
m_Banner.SetXY( -30, 0 ); m_TextBanner.SetXY( -30, 0 );
m_sprSongBar.Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_SONG_BAR) ); m_sprSongBar.Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_SONG_BAR) );
m_sprSongBar.SetXY( 0, 0 ); m_sprSongBar.SetXY( 0, 0 );
m_sprSectionBar.Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_SECTION_BAR) ); m_sprSectionBar.Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_SECTION_BAR) );
m_sprSectionBar.SetXY( -30, 0 ); m_sprSectionBar.SetXY( 0, 0 );
m_textSectionName.Load( THEME->GetPathTo(FONT_BOLD) ); m_textSectionName.Load( THEME->GetPathTo(FONT_HEADER1) );
m_textSectionName.TurnShadowOff(); m_textSectionName.TurnShadowOff();
m_textSectionName.SetHorizAlign( align_left ); m_textSectionName.SetHorizAlign( align_left );
m_textSectionName.SetVertAlign( align_middle ); m_textSectionName.SetVertAlign( align_middle );
m_textSectionName.SetXY( m_sprSectionBar.GetX() - m_sprSectionBar.GetUnzoomedWidth()/2 + 10, 0 ); m_textSectionName.SetXY( m_sprSectionBar.GetX() - m_sprSectionBar.GetUnzoomedWidth()/2 + 30, 0 );
m_textSectionName.SetZoom( 1.0f ); m_textSectionName.SetZoom( 1.0f );
m_textSectionName.SetDiffuseColor( COLOR_SECTION_LETTERS );
m_textRoulette.Load( THEME->GetPathTo(FONT_TEXT_BANNER) );
m_textRoulette.TurnShadowOff();
m_textRoulette.SetText( "ROULETTE" );
m_textRoulette.TurnRainbowOn();
m_textRoulette.SetZoom( 1.3f );
m_textRoulette.SetHorizAlign( align_left );
m_textRoulette.SetXY( -120, 0 );
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
{ {
@@ -100,6 +121,7 @@ void WheelItemDisplay::LoadFromWheelItemData( WheelItemData* pWID )
m_WheelItemType = pWID->m_WheelItemType; m_WheelItemType = pWID->m_WheelItemType;
m_sSectionName = pWID->m_sSectionName; m_sSectionName = pWID->m_sSectionName;
m_pSong = pWID->m_pSong; m_pSong = pWID->m_pSong;
m_color = pWID->m_color;
m_MusicStatusDisplayType = pWID->m_MusicStatusDisplayType; m_MusicStatusDisplayType = pWID->m_MusicStatusDisplayType;
@@ -109,35 +131,34 @@ void WheelItemDisplay::LoadFromWheelItemData( WheelItemData* pWID )
case TYPE_SECTION: case TYPE_SECTION:
{ {
CString sDisplayName = SONG->ShortenGroupName(m_sSectionName); CString sDisplayName = SONGMAN->ShortenGroupName(m_sSectionName);
m_textSectionName.SetZoom( 1 );
if( sDisplayName.GetLength() <= 4 )
m_textSectionName.SetZoom( 2 );
else
m_textSectionName.SetZoom( 1 );
m_textSectionName.SetText( sDisplayName ); m_textSectionName.SetText( sDisplayName );
m_textSectionName.SetDiffuseColor( COLOR_SECTION_LETTERS ); m_textSectionName.SetDiffuseColor( m_color );
m_textSectionName.TurnRainbowOff();
float fTextWidth, fSpriteWidth; float fSourcePixelWidth = (float)m_textSectionName.GetWidestLineWidthInSourcePixels();
fTextWidth = m_textSectionName.GetWidestLineWidthInSourcePixels() * m_textSectionName.GetZoom(); float fMaxTextWidth = 200;
fSpriteWidth = m_sprSectionBar.GetUnzoomedWidth() * m_sprSectionBar.GetZoom() - 20; if( fSourcePixelWidth > fMaxTextWidth )
if( fTextWidth > fSpriteWidth ) m_textSectionName.SetZoomX( fMaxTextWidth / fSourcePixelWidth );
m_textSectionName.SetZoomX( m_textSectionName.GetZoom() * fSpriteWidth / fTextWidth );
m_sprSectionBar.SetDiffuseColor( SONG->GetGroupColor( m_pSong->GetGroupName() ) );
} }
break; break;
case TYPE_SONG: case TYPE_SONG:
{ {
m_Banner.LoadFromSong( m_pSong ); m_TextBanner.LoadFromSong( m_pSong );
D3DXCOLOR color = SONG->GetGroupColor( m_pSong->GetGroupName() ); D3DXCOLOR color = m_color;
color.r += 0.15f; color.r += 0.15f;
color.g += 0.15f; color.g += 0.15f;
color.b += 0.15f; color.b += 0.15f;
m_Banner.SetDiffuseColor( color ); m_TextBanner.SetDiffuseColor( color );
m_MusicStatusDisplay.SetType( m_MusicStatusDisplayType ); m_MusicStatusDisplay.SetType( m_MusicStatusDisplayType );
RefreshGrades(); RefreshGrades();
} }
break; break;
case TYPE_ROULETTE:
{
}
break;
default: default:
ASSERT( false ); // invalid type ASSERT( false ); // invalid type
} }
@@ -147,17 +168,22 @@ void WheelItemDisplay::RefreshGrades()
{ {
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
{ {
if( GAME->IsPlayerEnabled( (PlayerNumber)p ) ) if( !GAME->IsPlayerEnabled( (PlayerNumber)p ) )
{
m_GradeDisplay[p].SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
continue;
}
const DifficultyClass dc = PREFS->m_PreferredDifficultyClass[p];
if( m_pSong ) // this is a song display
{ {
const DifficultyClass dc = PREFS->m_PreferredDifficultyClass[p];
ASSERT( m_pSong != NULL );
const Grade grade = m_pSong->GetGradeForDifficultyClass( GAME->m_sCurrentGame, GAME->m_sCurrentStyle, dc ); const Grade grade = m_pSong->GetGradeForDifficultyClass( GAME->m_sCurrentGame, GAME->m_sCurrentStyle, dc );
m_GradeDisplay[p].SetGrade( grade ); m_GradeDisplay[p].SetGrade( grade );
m_GradeDisplay[p].SetDiffuseColor( PlayerToColor((PlayerNumber)p) ); m_GradeDisplay[p].SetDiffuseColor( PlayerToColor((PlayerNumber)p) );
} }
else // !IsPlayerEnabled else // this is a section display
{ {
m_GradeDisplay[p].SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); m_GradeDisplay[p].SetGrade( GRADE_NO_DATA );
} }
} }
} }
@@ -170,17 +196,21 @@ void WheelItemDisplay::Update( float fDeltaTime )
m_sprSectionBar.Update( fDeltaTime ); m_sprSectionBar.Update( fDeltaTime );
m_textSectionName.Update( fDeltaTime ); m_textSectionName.Update( fDeltaTime );
break; break;
case TYPE_ROULETTE:
m_sprSectionBar.Update( fDeltaTime );
m_textRoulette.Update( fDeltaTime );
break;
case TYPE_SONG: case TYPE_SONG:
m_sprSongBar.Update( fDeltaTime ); m_sprSongBar.Update( fDeltaTime );
m_MusicStatusDisplay.Update( fDeltaTime ); m_MusicStatusDisplay.Update( fDeltaTime );
m_Banner.Update( fDeltaTime ); m_TextBanner.Update( fDeltaTime );
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
m_GradeDisplay[p].Update( fDeltaTime ); m_GradeDisplay[p].Update( fDeltaTime );
break; break;
} }
} }
void WheelItemDisplay::RenderPrimitives() void WheelItemDisplay::DrawPrimitives()
{ {
switch( m_WheelItemType ) switch( m_WheelItemType )
{ {
@@ -188,10 +218,14 @@ void WheelItemDisplay::RenderPrimitives()
m_sprSectionBar.Draw(); m_sprSectionBar.Draw();
m_textSectionName.Draw(); m_textSectionName.Draw();
break; break;
case TYPE_ROULETTE:
m_sprSectionBar.Draw();
m_textRoulette.Draw();
break;
case TYPE_SONG: case TYPE_SONG:
m_sprSongBar.Draw(); m_sprSongBar.Draw();
m_MusicStatusDisplay.Draw(); m_MusicStatusDisplay.Draw();
m_Banner.Draw(); m_TextBanner.Draw();
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
m_GradeDisplay[p].Draw(); m_GradeDisplay[p].Draw();
break; break;
@@ -210,8 +244,8 @@ MusicWheel::MusicWheel()
m_sprHighScoreFrame[p].SetXY( SCORE_X, SCORE_Y[p] ); m_sprHighScoreFrame[p].SetXY( SCORE_X, SCORE_Y[p] );
this->AddActor( &m_sprHighScoreFrame[p] ); this->AddActor( &m_sprHighScoreFrame[p] );
m_HighScore[p].SetXY( SCORE_X-12, SCORE_Y[p]*0.97f ); m_HighScore[p].SetXY( SCORE_X, SCORE_Y[p]*0.97f );
m_HighScore[p].SetZoom( 0.5f ); m_HighScore[p].SetZoom( 0.6f );
this->AddActor( &m_HighScore[p] ); this->AddActor( &m_HighScore[p] );
} }
@@ -220,8 +254,8 @@ MusicWheel::MusicWheel()
m_sprSelectionOverlay.Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_SONG_HIGHLIGHT) ); m_sprSelectionOverlay.Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_SONG_HIGHLIGHT) );
m_sprSelectionOverlay.SetXY( 0, 0 ); m_sprSelectionOverlay.SetXY( 0, 0 );
m_sprSelectionOverlay.SetDiffuseColor( D3DXCOLOR(1,1,1,0.3f) ); m_sprSelectionOverlay.SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
m_sprSelectionOverlay.SetEffectGlowing( 1.0f, D3DXCOLOR(1,1,1,0.2f), D3DXCOLOR(1,1,1,0.8f) ); m_sprSelectionOverlay.SetEffectGlowing( 1.0f, D3DXCOLOR(1,1,1,0.4f), D3DXCOLOR(1,1,1,1) );
this->AddActor( &m_sprSelectionOverlay ); this->AddActor( &m_sprSelectionOverlay );
m_MusicSortDisplay.SetXY( SORT_ICON_ON_SCREEN_X, SORT_ICON_ON_SCREEN_Y ); m_MusicSortDisplay.SetXY( SORT_ICON_ON_SCREEN_X, SORT_ICON_ON_SCREEN_Y );
@@ -240,7 +274,7 @@ MusicWheel::MusicWheel()
// init m_mapGroupNameToBannerColor // init m_mapGroupNameToBannerColor
CArray<Song*, Song*> arraySongs; CArray<Song*, Song*> arraySongs;
arraySongs.Copy( SONG->m_pSongs ); arraySongs.Copy( SONGMAN->m_pSongs );
SortSongPointerArrayByGroup( arraySongs ); SortSongPointerArrayByGroup( arraySongs );
@@ -265,23 +299,23 @@ MusicWheel::MusicWheel()
BuildWheelItemDatas( m_WheelItemDatas[so], SongSortOrder(so) ); BuildWheelItemDatas( m_WheelItemDatas[so], SongSortOrder(so) );
// select a song if none are selected // select a song if none are selected
if( SONG->m_pCurSong == NULL && // if there is no currently selected song if( SONGMAN->m_pCurSong == NULL && // if there is no currently selected song
SONG->m_pSongs.GetSize() > 0 ) // and there is at least one song SONGMAN->m_pSongs.GetSize() > 0 ) // and there is at least one song
{ {
CArray<Song*, Song*> arraySongs; CArray<Song*, Song*> arraySongs;
SONG->GetSongsInGroup( SONG->m_sPreferredGroup, arraySongs ); SONGMAN->GetSongsInGroup( SONGMAN->m_sPreferredGroup, arraySongs );
if( arraySongs.GetSize() > 0 ) if( arraySongs.GetSize() > 0 )
SONG->m_pCurSong = arraySongs[0]; // select the first song SONGMAN->m_pCurSong = arraySongs[0]; // select the first song
} }
if( SONG->m_pCurSong != NULL ) if( SONGMAN->m_pCurSong != NULL )
{ {
// find the previously selected song (if any) // find the previously selected song (if any)
for( int i=0; i<GetCurWheelItemDatas().GetSize(); i++ ) for( int i=0; i<GetCurWheelItemDatas().GetSize(); i++ )
{ {
if( GetCurWheelItemDatas()[i].m_pSong == SONG->m_pCurSong ) if( GetCurWheelItemDatas()[i].m_pSong == SONGMAN->m_pCurSong )
{ {
m_iSelection = i; // select it m_iSelection = i; // select it
m_sExpandedSectionName = GetCurWheelItemDatas()[m_iSelection].m_sSectionName; // make its group the currently expanded group m_sExpandedSectionName = GetCurWheelItemDatas()[m_iSelection].m_sSectionName; // make its group the currently expanded group
@@ -309,20 +343,20 @@ void MusicWheel::BuildWheelItemDatas( CArray<WheelItemData, WheelItemData&> &arr
/////////////////////////////////// ///////////////////////////////////
CArray<Song*, Song*> arraySongs; CArray<Song*, Song*> arraySongs;
// copy only song that have at least one NoteMetadata for the current GameMode // copy only song that have at least one Notes for the current GameMode
for( i=0; i<SONG->m_pSongs.GetSize(); i++ ) for( i=0; i<SONGMAN->m_pSongs.GetSize(); i++ )
{ {
Song* pSong = SONG->m_pSongs[i]; Song* pSong = SONGMAN->m_pSongs[i];
CArray<NoteMetadata*, NoteMetadata*> arraySteps; CArray<Notes*, Notes*> arraySteps;
pSong->GetNoteMetadatasThatMatchGameAndStyle( GAME->m_sCurrentGame, GAME->m_sCurrentStyle, arraySteps ); pSong->GetNotessThatMatchGameAndStyle( GAME->m_sCurrentGame, GAME->m_sCurrentStyle, arraySteps );
if( arraySteps.GetSize() > 0 ) if( arraySteps.GetSize() > 0 )
arraySongs.Add( pSong ); arraySongs.Add( pSong );
} }
// sort the SONG // sort the SONGMAN
switch( so ) switch( so )
{ {
case SORT_GROUP: case SORT_GROUP:
@@ -358,9 +392,8 @@ void MusicWheel::BuildWheelItemDatas( CArray<WheelItemData, WheelItemData&> &arr
{ {
case SORT_MOST_PLAYED: bUseSections = false; break; case SORT_MOST_PLAYED: bUseSections = false; break;
case SORT_BPM: bUseSections = false; break; case SORT_BPM: bUseSections = false; break;
case SORT_GROUP: bUseSections = SONG->m_sPreferredGroup != "ALL MUSIC"; break; case SORT_GROUP: bUseSections = SONGMAN->m_sPreferredGroup != "ALL MUSIC"; break;
case SORT_TITLE: bUseSections = true; break; case SORT_TITLE: bUseSections = true; break;
// case SORT_ARTIST:
default: ASSERT( false ); default: ASSERT( false );
} }
@@ -370,21 +403,24 @@ void MusicWheel::BuildWheelItemDatas( CArray<WheelItemData, WheelItemData&> &arr
arrayWheelItemDatas.SetSize( arraySongs.GetSize()*2 ); // make sure we have enough room for all music and section items arrayWheelItemDatas.SetSize( arraySongs.GetSize()*2 ); // make sure we have enough room for all music and section items
CString sLastSection = ""; CString sLastSection = "";
D3DXCOLOR colorSection;
int iCurWheelItem = 0; int iCurWheelItem = 0;
for( int i=0; i< arraySongs.GetSize(); i++ ) for( int i=0; i< arraySongs.GetSize(); i++ )
{ {
Song* pSong = arraySongs[i]; Song* pSong = arraySongs[i];
CString sThisSection = GetSectionNameFromSongAndSort( pSong, so ); CString sThisSection = GetSectionNameFromSongAndSort( pSong, so );
int iSectionColorIndex = 0;
if( sThisSection != sLastSection ) // new section, make a section item if( sThisSection != sLastSection ) // new section, make a section item
{ {
WheelItemData &WID = arrayWheelItemDatas[iCurWheelItem++]; WheelItemData &WID = arrayWheelItemDatas[iCurWheelItem++];
WID.LoadFromSectionName( sThisSection ); colorSection = (so==SORT_TITLE) ? SONGMAN->GetGroupColor(pSong->GetGroupName()) : SECTION_COLORS[iSectionColorIndex];
iSectionColorIndex = (iSectionColorIndex+1) % NUM_SECTION_COLORS;
WID.Load( TYPE_SECTION, NULL, sThisSection, colorSection );
sLastSection = sThisSection; sLastSection = sThisSection;
} }
WheelItemData &WID = arrayWheelItemDatas[iCurWheelItem++]; WheelItemData &WID = arrayWheelItemDatas[iCurWheelItem++];
WID.LoadFromSong( pSong ); WID.Load( TYPE_SONG, pSong, sThisSection, SONGMAN->GetGroupColor(pSong->GetGroupName()) );
WID.m_sSectionName = sThisSection;
} }
arrayWheelItemDatas.SetSize( iCurWheelItem ); // make sure we have enough room for all music and section items arrayWheelItemDatas.SetSize( iCurWheelItem ); // make sure we have enough room for all music and section items
} }
@@ -396,8 +432,7 @@ void MusicWheel::BuildWheelItemDatas( CArray<WheelItemData, WheelItemData&> &arr
{ {
Song* pSong = arraySongs[i]; Song* pSong = arraySongs[i];
WheelItemData &WID = arrayWheelItemDatas[i]; WheelItemData &WID = arrayWheelItemDatas[i];
WID.LoadFromSong( pSong ); WID.Load( TYPE_SONG, pSong, "", SONGMAN->GetGroupColor(pSong->GetGroupName()) );
WID.m_sSectionName = "";
} }
} }
} }
@@ -408,8 +443,7 @@ void MusicWheel::BuildWheelItemDatas( CArray<WheelItemData, WheelItemData&> &arr
Song* pSong = arrayWheelItemDatas[i].m_pSong; Song* pSong = arrayWheelItemDatas[i].m_pSong;
if( pSong != NULL ) if( pSong != NULL )
{ {
MusicStatusDisplayType crown = (pSong->GetNumTimesPlayed()==0) ? TYPE_NEW : TYPE_NONE; arrayWheelItemDatas[i].m_MusicStatusDisplayType = (pSong->GetNumTimesPlayed()==0) ? TYPE_NEW : TYPE_NONE;
arrayWheelItemDatas[i].m_MusicStatusDisplayType = crown;
} }
} }
@@ -418,8 +452,7 @@ void MusicWheel::BuildWheelItemDatas( CArray<WheelItemData, WheelItemData&> &arr
// init crown icons // init crown icons
for( int i=0; i<arrayWheelItemDatas.GetSize() && i<3; i++ ) for( int i=0; i<arrayWheelItemDatas.GetSize() && i<3; i++ )
{ {
MusicStatusDisplayType crown = MusicStatusDisplayType(TYPE_CROWN1 + i); arrayWheelItemDatas[i].m_MusicStatusDisplayType = MusicStatusDisplayType(TYPE_CROWN1 + i);
arrayWheelItemDatas[i].m_MusicStatusDisplayType = crown;
} }
} }
@@ -428,7 +461,12 @@ void MusicWheel::BuildWheelItemDatas( CArray<WheelItemData, WheelItemData&> &arr
if( arrayWheelItemDatas.GetSize() == 0 ) if( arrayWheelItemDatas.GetSize() == 0 )
{ {
arrayWheelItemDatas.SetSize( 1 ); arrayWheelItemDatas.SetSize( 1 );
arrayWheelItemDatas[0].LoadFromSectionName( "NO SONGS" ); arrayWheelItemDatas[0].Load( TYPE_SECTION, NULL, "NO SONGS", D3DXCOLOR(1,0,0,1) );
}
else
{
arrayWheelItemDatas.SetSize( arrayWheelItemDatas.GetSize()+1 );
arrayWheelItemDatas[arrayWheelItemDatas.GetSize()-1].Load( TYPE_ROULETTE, NULL, "", D3DXCOLOR(1,0,0,1) );
} }
} }
@@ -439,7 +477,7 @@ void MusicWheel::SwitchSortOrder()
float MusicWheel::GetBannerY( float fPosOffsetsFromMiddle ) float MusicWheel::GetBannerY( float fPosOffsetsFromMiddle )
{ {
return fPosOffsetsFromMiddle*44; return (float)roundf( fPosOffsetsFromMiddle*44 );
} }
float MusicWheel::GetBannerBrightness( float fPosOffsetsFromMiddle ) float MusicWheel::GetBannerBrightness( float fPosOffsetsFromMiddle )
@@ -515,7 +553,7 @@ float MusicWheel::GetBannerX( float fPosOffsetsFromMiddle )
break; break;
} }
return fX; return (float)roundf( fX );
} }
void MusicWheel::RebuildWheelItemDisplays() void MusicWheel::RebuildWheelItemDisplays()
@@ -563,10 +601,11 @@ void MusicWheel::RebuildWheelItemDisplays()
void MusicWheel::NotesChanged( PlayerNumber pn ) // update grade graphics and top score void MusicWheel::NotesChanged( PlayerNumber pn ) // update grade graphics and top score
{ {
DifficultyClass dc = PREFS->m_PreferredDifficultyClass[pn]; DifficultyClass dc = PREFS->m_PreferredDifficultyClass[pn];
Song* pSong = SONG->m_pCurSong; Song* pSong = SONGMAN->m_pCurSong;
NoteMetadata* m_pNoteMetadata = SONG->m_pCurNoteMetadata[pn]; Notes* m_pNotes = SONGMAN->m_pCurNotes[pn];
m_HighScore[pn].SetScore( (float)m_pNoteMetadata->m_iTopScore ); if( m_pNotes )
m_HighScore[pn].SetScore( (float)m_pNotes->m_iTopScore );
for( int i=0; i<NUM_WHEEL_ITEMS_TO_DRAW; i++ ) for( int i=0; i<NUM_WHEEL_ITEMS_TO_DRAW; i++ )
{ {
@@ -577,7 +616,7 @@ void MusicWheel::NotesChanged( PlayerNumber pn ) // update grade graphics and to
void MusicWheel::RenderPrimitives() void MusicWheel::DrawPrimitives()
{ {
for( int i=0; i<NUM_WHEEL_ITEMS_TO_DRAW; i++ ) for( int i=0; i<NUM_WHEEL_ITEMS_TO_DRAW; i++ )
{ {
@@ -600,7 +639,7 @@ void MusicWheel::RenderPrimitives()
} }
ActorFrame::RenderPrimitives(); ActorFrame::DrawPrimitives();
} }
void MusicWheel::Update( float fDeltaTime ) void MusicWheel::Update( float fDeltaTime )
@@ -627,7 +666,7 @@ void MusicWheel::Update( float fDeltaTime )
{ {
case STATE_SWITCHING_MUSIC: case STATE_SWITCHING_MUSIC:
m_WheelState = STATE_IDLE; // now, wait for input m_WheelState = STATE_IDLE; // now, wait for input
WM->SendMessageToTopWindow( SM_PlaySongSample, 0 ); SCREENMAN->SendMessageToTopScreen( SM_PlaySongSample, 0 );
break; break;
case STATE_FLYING_OFF_BEFORE_NEXT_SORT: case STATE_FLYING_OFF_BEFORE_NEXT_SORT:
{ {
@@ -681,11 +720,11 @@ void MusicWheel::Update( float fDeltaTime )
} }
break; break;
case STATE_FLYING_ON_AFTER_NEXT_SORT: case STATE_FLYING_ON_AFTER_NEXT_SORT:
WM->SendMessageToTopWindow( SM_PlaySongSample, 0 ); SCREENMAN->SendMessageToTopScreen( SM_PlaySongSample, 0 );
m_WheelState = STATE_IDLE; // now, wait for input m_WheelState = STATE_IDLE; // now, wait for input
break; break;
case STATE_TWEENING_ON_SCREEN: case STATE_TWEENING_ON_SCREEN:
WM->SendMessageToTopWindow( SM_PlaySongSample, 0 ); SCREENMAN->SendMessageToTopScreen( SM_PlaySongSample, 0 );
m_WheelState = STATE_IDLE; m_WheelState = STATE_IDLE;
m_fTimeLeftInState = 0; m_fTimeLeftInState = 0;
break; break;
@@ -778,6 +817,11 @@ void MusicWheel::NextMusic()
m_soundChangeMusic.Play(); m_soundChangeMusic.Play();
} }
void MusicWheel::PrevSort()
{
NextSort();
}
void MusicWheel::NextSort() void MusicWheel::NextSort()
{ {
switch( m_WheelState ) switch( m_WheelState )
@@ -833,6 +877,8 @@ bool MusicWheel::Select()
} }
return false; return false;
case TYPE_ROULETTE:
return false;
case TYPE_SONG: case TYPE_SONG:
default: default:
+23 -21
View File
@@ -5,7 +5,7 @@
Desc: A wheel with song names used in the Select Music screen. Desc: A wheel with song names used in the Select Music screen.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -14,7 +14,7 @@
#include "Song.h" #include "Song.h"
#include "ActorFrame.h" #include "ActorFrame.h"
#include "BitmapText.h" #include "BitmapText.h"
#include "RectangleActor.h" #include "Quad.h"
#include "TextBanner.h" #include "TextBanner.h"
#include "RandomSample.h" #include "RandomSample.h"
#include "GradeDisplay.h" #include "GradeDisplay.h"
@@ -22,7 +22,7 @@
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "MusicSortDisplay.h" #include "MusicSortDisplay.h"
#include "MusicStatusDisplay.h" #include "MusicStatusDisplay.h"
#include "Window.h" // for WindowMessage #include "Screen.h" // for ScreenMessage
#include "ScoreDisplayRolling.h" #include "ScoreDisplayRolling.h"
#include "ScrollBar.h" #include "ScrollBar.h"
@@ -31,11 +31,11 @@ const int NUM_WHEEL_ITEMS_TO_DRAW = 13;
const float FADE_TIME = 0.7f; const float FADE_TIME = 0.7f;
const WindowMessage SM_SongChanged = WindowMessage(SM_User+47); // this should be unique! const ScreenMessage SM_SongChanged = ScreenMessage(SM_User+47); // this should be unique!
const WindowMessage SM_PlaySongSample = WindowMessage(SM_User+48); const ScreenMessage SM_PlaySongSample = ScreenMessage(SM_User+48);
enum WheelItemType { TYPE_SECTION, TYPE_SONG }; enum WheelItemType { TYPE_SECTION, TYPE_SONG, TYPE_ROULETTE };
struct WheelItemData struct WheelItemData
@@ -43,12 +43,12 @@ struct WheelItemData
public: public:
WheelItemData(); WheelItemData();
void LoadFromSectionName( const CString &sSectionName ); void Load( WheelItemType wit, Song* pSong, const CString &sSectionName, const D3DXCOLOR color );
void LoadFromSong( Song* pSong );
WheelItemType m_WheelItemType; WheelItemType m_WheelItemType;
CString m_sSectionName; CString m_sSectionName;
Song* m_pSong; Song* m_pSong;
D3DXCOLOR m_color; // either text color or section background color
MusicStatusDisplayType m_MusicStatusDisplayType; MusicStatusDisplayType m_MusicStatusDisplayType;
}; };
@@ -60,24 +60,24 @@ public:
WheelItemDisplay(); WheelItemDisplay();
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
virtual void RenderPrimitives(); virtual void DrawPrimitives();
CString GetSectionName() CString GetSectionName() { return m_sSectionName; }
{
return m_sSectionName;
};
void LoadFromWheelItemData( WheelItemData* pWID ); void LoadFromWheelItemData( WheelItemData* pWID );
void RefreshGrades(); void RefreshGrades();
// for a section // for TYPE_SECTION and TYPE_ROULETTE
Sprite m_sprSectionBar; Sprite m_sprSectionBar;
BitmapText m_textSectionName; // for TYPE_SECTION
BitmapText m_textSectionName;
// for TYPE_ROULETTE
BitmapText m_textRoulette;
// for a music // for a TYPE_MUSIC
Sprite m_sprSongBar; Sprite m_sprSongBar;
MusicStatusDisplay m_MusicStatusDisplay; MusicStatusDisplay m_MusicStatusDisplay;
TextBanner m_Banner; TextBanner m_TextBanner;
GradeDisplay m_GradeDisplay[NUM_PLAYERS]; GradeDisplay m_GradeDisplay[NUM_PLAYERS];
}; };
@@ -91,13 +91,14 @@ public:
~MusicWheel(); ~MusicWheel();
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
virtual void RenderPrimitives(); virtual void DrawPrimitives();
virtual void TweenOnScreen(); virtual void TweenOnScreen();
virtual void TweenOffScreen(); virtual void TweenOffScreen();
void PrevMusic(); void PrevMusic();
void NextMusic(); void NextMusic();
void PrevSort();
void NextSort(); void NextSort();
void NotesChanged( PlayerNumber pn ); // update grade graphics and top score void NotesChanged( PlayerNumber pn ); // update grade graphics and top score
@@ -107,8 +108,9 @@ public:
float GetBannerX( float fPosOffsetsFromMiddle ); float GetBannerX( float fPosOffsetsFromMiddle );
bool Select(); // return true if the selected item is a music, otherwise false bool Select(); // return true if the selected item is a music, otherwise false
Song* GetSelectedSong() { return GetCurWheelItemDatas()[m_iSelection].m_pSong; }; WheelItemType GetSelectedType() { return GetCurWheelItemDatas()[m_iSelection].m_WheelItemType; };
CString GetSelectedSection() { return GetCurWheelItemDatas()[m_iSelection].m_sSectionName; }; Song* GetSelectedSong() { return GetCurWheelItemDatas()[m_iSelection].m_pSong; };
CString GetSelectedSection() { return GetCurWheelItemDatas()[m_iSelection].m_sSectionName; };
protected: protected:
+156 -30
View File
@@ -5,7 +5,7 @@
Desc: A pattern of ColorNotes that past Y==0. Desc: A pattern of ColorNotes that past Y==0.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -22,16 +22,53 @@
NoteData::NoteData() NoteData::NoteData()
{ {
for( int i=0; i<MAX_NOTE_TRACKS; i++ ) memset( m_TapNotes, '0', MAX_NOTE_TRACKS*MAX_TAP_NOTE_ROWS );
{
for( int j=0; j<MAX_TAP_NOTE_ELEMENTS; j++ )
m_TapNotes[i][j] = '0';
}
m_iNumTracks = 0; m_iNumTracks = 0;
m_iNumHoldNotes = 0; m_iNumHoldNotes = 0;
} }
NoteData::~NoteData()
{
}
void NoteData::WriteToCacheFile( FILE* file )
{
LOG->WriteLine( "NoteData::WriteToCacheFile()" );
ConvertHoldNotesTo2sAnd3s();
int iNumRows = GetLastRow();
fprintf( file, "%d\n", iNumRows );
fwrite( m_TapNotes, sizeof(TapNote), MAX_NOTE_TRACKS*iNumRows, file );
fprintf( file, "\n" );
Convert2sAnd3sToHoldNotes();
}
void NoteData::ReadFromCacheFile( FILE* file )
{
LOG->WriteLine( "NoteData::ReadFromCacheFile()" );
int iNumRows;
fscanf( file, "%d\n", &iNumRows );
fread( m_TapNotes, sizeof(TapNote), MAX_NOTE_TRACKS*iNumRows, file );
fscanf( file, "\n", &iNumRows );
Convert2sAnd3sToHoldNotes();
}
void NoteData::SkipOverDataInCacheFile( FILE* file )
{
LOG->WriteLine( "NoteData::SkipOverDataInCacheFile()" );
int iNumRows;
fscanf( file, "%d\n", &iNumRows );
int retval = fseek( file, sizeof(TapNote)*MAX_NOTE_TRACKS*iNumRows, SEEK_CUR );
ASSERT( retval == 0 );
fscanf( file, "\n", &iNumRows );
}
void NoteData::ClearRange( NoteIndex iNoteIndexBegin, NoteIndex iNoteIndexEnd ) void NoteData::ClearRange( NoteIndex iNoteIndexBegin, NoteIndex iNoteIndexEnd )
{ {
// delete old TapNotes in the range // delete old TapNotes in the range
@@ -131,7 +168,7 @@ void NoteData::RemoveHoldNote( int index )
m_iNumHoldNotes--; m_iNumHoldNotes--;
} }
float NoteData::GetLastBeat() int NoteData::GetLastRow()
{ {
int iOldestIndexFoundSoFar = 0; int iOldestIndexFoundSoFar = 0;
@@ -143,7 +180,7 @@ float NoteData::GetLastBeat()
iOldestIndexFoundSoFar = m_HoldNotes[i].m_iEndIndex; iOldestIndexFoundSoFar = m_HoldNotes[i].m_iEndIndex;
} }
for( i=MAX_TAP_NOTE_ELEMENTS-1; i>=iOldestIndexFoundSoFar; i-- ) // iterate back to front for( i=MAX_TAP_NOTE_ROWS-1; i>=iOldestIndexFoundSoFar; i-- ) // iterate back to front
{ {
for( int t=0; t<m_iNumTracks; t++ ) for( int t=0; t<m_iNumTracks; t++ )
{ {
@@ -157,14 +194,22 @@ float NoteData::GetLastBeat()
done_searching_tap_notes: done_searching_tap_notes:
return NoteIndexToBeat( iOldestIndexFoundSoFar ); return iOldestIndexFoundSoFar;
} }
int NoteData::GetNumTapNotes() float NoteData::GetLastBeat()
{
return NoteRowToBeat( GetLastRow() );
}
int NoteData::GetNumTapNotes( const float fStartBeat, const float fEndBeat )
{ {
int iNumSteps = 0; int iNumSteps = 0;
for( int i=0; i<MAX_TAP_NOTE_ELEMENTS; i++ ) int iStartIndex = BeatToNoteRow( fStartBeat );
int iEndIndex = BeatToNoteRow( fEndBeat );
for( int i=iStartIndex; i<min(iEndIndex, MAX_TAP_NOTE_ROWS); i++ )
{ {
for( int t=0; t<m_iNumTracks; t++ ) for( int t=0; t<m_iNumTracks; t++ )
{ {
@@ -173,14 +218,46 @@ int NoteData::GetNumTapNotes()
} }
} }
iNumSteps += m_iNumHoldNotes;
return iNumSteps; return iNumSteps;
} }
int NoteData::GetNumHoldNotes() int NoteData::GetNumDoubles( const float fStartBeat, const float fEndBeat )
{ {
return m_iNumHoldNotes; int iNumDoubles = 0;
int iStartIndex = BeatToNoteRow( fStartBeat );
int iEndIndex = BeatToNoteRow( fEndBeat );
for( int i=iStartIndex; i<min(iEndIndex, MAX_TAP_NOTE_ROWS); i++ )
{
int iNumNotesThisIndex = 0;
for( int t=0; t<m_iNumTracks; t++ )
{
if( m_TapNotes[t][i] != '0' )
iNumNotesThisIndex++;
}
if( iNumNotesThisIndex >= 2 )
iNumDoubles++;
}
return iNumDoubles;
}
int NoteData::GetNumHoldNotes( const float fStartBeat, const float fEndBeat )
{
int iNumSteps = 0;
int iStartIndex = BeatToNoteRow( fStartBeat );
int iEndIndex = BeatToNoteRow( fEndBeat );
for( int i=0; i<m_iNumHoldNotes; i++ )
{
float fHoldStartBeat = NoteRowToBeat( m_HoldNotes[i].m_iStartIndex );
if( fStartBeat >= fHoldStartBeat && fStartBeat < fEndBeat )
iNumSteps++;
}
return iNumSteps;
} }
@@ -192,7 +269,7 @@ void NoteData::CropToLeftSide()
// clear out the right half // clear out the right half
for( int c=iFirstRightSideColumn; c<=iLastRightSideColumn; c++ ) for( int c=iFirstRightSideColumn; c<=iLastRightSideColumn; c++ )
{ {
for( int i=0; i<MAX_TAP_NOTE_ELEMENTS; i++ ) // foreach TapNote for( int i=0; i<MAX_TAP_NOTE_ROWS; i++ ) // foreach TapNote
m_TapNotes[c][i] = '0'; m_TapNotes[c][i] = '0';
} }
@@ -219,14 +296,14 @@ void NoteData::CropToRightSide()
// clear out the left half // clear out the left half
for( c=0; c<iFirstRightSideColumn; c++ ) for( c=0; c<iFirstRightSideColumn; c++ )
{ {
for( int i=0; i<MAX_TAP_NOTE_ELEMENTS; i++ ) // foreach TapNote for( int i=0; i<MAX_TAP_NOTE_ROWS; i++ ) // foreach TapNote
m_TapNotes[c][i] = '0'; m_TapNotes[c][i] = '0';
} }
// copy the right side into the left // copy the right side into the left
for( c=iFirstRightSideColumn; c<=iLastRightSideColumn; c++ ) for( c=iFirstRightSideColumn; c<=iLastRightSideColumn; c++ )
{ {
for( int i=0; i<MAX_TAP_NOTE_ELEMENTS; i++ ) // foreach TapNote for( int i=0; i<MAX_TAP_NOTE_ROWS; i++ ) // foreach TapNote
{ {
m_TapNotes[c-4][i] = m_TapNotes[c][i]; m_TapNotes[c-4][i] = m_TapNotes[c][i];
m_TapNotes[c][i] = '0'; m_TapNotes[c][i] = '0';
@@ -364,7 +441,7 @@ void NoteData::Turn( PlayerOptions::TurnType tt )
pNewData->m_iNumTracks = m_iNumTracks; pNewData->m_iNumTracks = m_iNumTracks;
// transform m_TapNotes // transform m_TapNotes
for( int i=0; i<MAX_TAP_NOTE_ELEMENTS; i++ ) for( int i=0; i<MAX_TAP_NOTE_ROWS; i++ )
{ {
for( int j=0; j<12; j++ ) for( int j=0; j<12; j++ )
{ {
@@ -402,7 +479,7 @@ void NoteData::Turn( PlayerOptions::TurnType tt )
void NoteData::MakeLittle() void NoteData::MakeLittle()
{ {
// filter out all non-quarter notes // filter out all non-quarter notes
for( int i=0; i<MAX_TAP_NOTE_ELEMENTS; i++ ) for( int i=0; i<MAX_TAP_NOTE_ROWS; i++ )
{ {
if( i%ELEMENTS_PER_BEAT != 0 ) if( i%ELEMENTS_PER_BEAT != 0 )
{ {
@@ -424,11 +501,11 @@ void NoteData::Convert2sAnd3sToHoldNotes()
for( int col=0; col<m_iNumTracks; col++ ) // foreach column for( int col=0; col<m_iNumTracks; col++ ) // foreach column
{ {
for( int i=0; i<MAX_TAP_NOTE_ELEMENTS; i++ ) // foreach TapNote element for( int i=0; i<MAX_TAP_NOTE_ROWS; i++ ) // foreach TapNote element
{ {
if( m_TapNotes[col][i] == '2' ) // this is a HoldNote begin marker if( m_TapNotes[col][i] == '2' ) // this is a HoldNote begin marker
{ {
for( int j=i; j<MAX_TAP_NOTE_ELEMENTS; j++ ) // search for end of HoldNote for( int j=i; j<MAX_TAP_NOTE_ROWS; j++ ) // search for end of HoldNote
{ {
if( m_TapNotes[col][j] == '1' || if( m_TapNotes[col][j] == '1' ||
m_TapNotes[col][j] == '3' ) // found it! m_TapNotes[col][j] == '3' ) // found it!
@@ -479,8 +556,8 @@ void NoteData::SnapToNearestNoteType( NoteType nt1, NoteType nt2, float fBeginBe
default: ASSERT( false ); default: ASSERT( false );
} }
int iNoteIndexBegin = BeatToNoteIndex( fBeginBeat ); int iNoteIndexBegin = BeatToNoteRow( fBeginBeat );
int iNoteIndexEnd = BeatToNoteIndex( fEndBeat ); int iNoteIndexEnd = BeatToNoteRow( fEndBeat );
//ConvertHoldNotesTo2sAnd3s(); //ConvertHoldNotesTo2sAnd3s();
@@ -488,13 +565,13 @@ void NoteData::SnapToNearestNoteType( NoteType nt1, NoteType nt2, float fBeginBe
for( int i=iNoteIndexBegin; i<=iNoteIndexEnd; i++ ) for( int i=iNoteIndexBegin; i<=iNoteIndexEnd; i++ )
{ {
int iOldIndex = i; int iOldIndex = i;
float fOldBeat = NoteIndexToBeat( iOldIndex ); float fOldBeat = NoteRowToBeat( iOldIndex );
float fNewBeat1 = froundf( fOldBeat, fSnapInterval1 ); float fNewBeat1 = froundf( fOldBeat, fSnapInterval1 );
float fNewBeat2 = froundf( fOldBeat, fSnapInterval2 ); float fNewBeat2 = froundf( fOldBeat, fSnapInterval2 );
bool bNewBeat1IsCloser = fabsf(fNewBeat1-fOldBeat) < fabsf(fNewBeat2-fOldBeat); bool bNewBeat1IsCloser = fabsf(fNewBeat1-fOldBeat) < fabsf(fNewBeat2-fOldBeat);
float fNewBeat = bNewBeat1IsCloser ? fNewBeat1 : fNewBeat2; float fNewBeat = bNewBeat1IsCloser ? fNewBeat1 : fNewBeat2;
int iNewIndex = BeatToNoteIndex( fNewBeat ); int iNewIndex = BeatToNoteRow( fNewBeat );
for( int c=0; c<m_iNumTracks; c++ ) for( int c=0; c<m_iNumTracks; c++ )
{ {
@@ -581,7 +658,7 @@ void NoteData::SetFromMeasureStrings( CStringArray &arrayMeasureStrings )
{ {
const float fPercentIntoMeasure = l/(float)arrayNoteLines.GetSize(); const float fPercentIntoMeasure = l/(float)arrayNoteLines.GetSize();
const float fBeat = (m + fPercentIntoMeasure) * BEATS_PER_MEASURE; const float fBeat = (m + fPercentIntoMeasure) * BEATS_PER_MEASURE;
const int iIndex = BeatToNoteIndex( fBeat ); const int iIndex = BeatToNoteRow( fBeat );
CString sNoteLine = arrayNoteLines[l]; CString sNoteLine = arrayNoteLines[l];
sNoteLine.TrimRight(); sNoteLine.TrimRight();
@@ -601,12 +678,61 @@ void NoteData::SetFromMeasureStrings( CStringArray &arrayMeasureStrings )
ASSERT( m_iNumTracks != 0 ); ASSERT( m_iNumTracks != 0 );
} }
float NoteData::GetStreamRadarValue( float fSongSeconds )
{
// density of steps
int iNumNotes = GetNumTapNotes() + GetNumHoldNotes();
float fBeatsPerSecond = iNumNotes/fSongSeconds;
return fBeatsPerSecond / 5;
}
float NoteData::GetVoltageRadarValue( float fSongSeconds )
{
// peak density of steps
float fMaxDensityPerSecSoFar = 0;
for( int i=0; i<MAX_BEATS; i+=8 )
{
int iNumNotesThisMeasure = GetNumTapNotes((float)i,(float)i+8) + GetNumHoldNotes((float)i,(float)i+8);
float fDensityThisMeasure = iNumNotesThisMeasure/2.0f;
float fDensityPerSecThisMeasure = fDensityThisMeasure / fSongSeconds;
if( fDensityPerSecThisMeasure > fMaxDensityPerSecSoFar )
fMaxDensityPerSecSoFar = fDensityPerSecThisMeasure;
}
return fMaxDensityPerSecSoFar;
}
float NoteData::GetAirRadarValue( float fSongSeconds )
{
// number of doubles
int iNumDoubles = GetNumDoubles();
return iNumDoubles / fSongSeconds * 2;
}
float NoteData::GetChaosRadarValue( float fSongSeconds )
{
// irregularity of steps
return fabsf( GetStreamRadarValue(fSongSeconds) - GetVoltageRadarValue(fSongSeconds) );
}
float NoteData::GetFreezeRadarValue( float fSongSeconds )
{
// number of hold steps
return GetNumHoldNotes() / fSongSeconds * 10;
}
void NoteData::LoadTransformed( NoteData* pOriginal, int iNewNumTracks, TrackNumber iNewToOriginalTrack[] ) void NoteData::LoadTransformed( NoteData* pOriginal, int iNewNumTracks, TrackNumber iNewToOriginalTrack[] )
{ {
// init // init
for( int i=0; i<MAX_NOTE_TRACKS; i++ ) for( int i=0; i<MAX_NOTE_TRACKS; i++ )
{ {
for( int j=0; j<MAX_TAP_NOTE_ELEMENTS; j++ ) for( int j=0; j<MAX_TAP_NOTE_ROWS; j++ )
m_TapNotes[i][j] = '0'; m_TapNotes[i][j] = '0';
} }
m_iNumHoldNotes = 0; m_iNumHoldNotes = 0;
@@ -622,7 +748,7 @@ void NoteData::LoadTransformed( NoteData* pOriginal, int iNewNumTracks, TrackNum
int i; int i;
for( i=0; i<MAX_TAP_NOTE_ELEMENTS; i++ ) for( i=0; i<MAX_TAP_NOTE_ROWS; i++ )
m_TapNotes[t][i] = pOriginal->m_TapNotes[iOriginalTrack][i]; m_TapNotes[t][i] = pOriginal->m_TapNotes[iOriginalTrack][i];
for( i=0; i<MAX_HOLD_NOTE_ELEMENTS; i++ ) for( i=0; i<MAX_HOLD_NOTE_ELEMENTS; i++ )
+34 -24
View File
@@ -8,12 +8,11 @@
track - corresponds to different columns of notes on the screen track - corresponds to different columns of notes on the screen
index - corresponds to subdivisions of beats index - corresponds to subdivisions of beats
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
#include "GameConstantsAndTypes.h"
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
// '1' = tap note // '1' = tap note
@@ -73,10 +72,10 @@ struct HoldNoteScore
inline int BeatToNoteIndex( float fBeatNum ) { return int( fBeatNum * ELEMENTS_PER_BEAT + 0.5f); }; // round inline int BeatToNoteRow( float fBeatNum ) { return int( fBeatNum * ELEMENTS_PER_BEAT + 0.5f); }; // round
inline int BeatToNoteIndexNotRounded( float fBeatNum ){ return (int)( fBeatNum * ELEMENTS_PER_BEAT ); }; inline int BeatToNoteIndexNotRounded( float fBeatNum ){ return (int)( fBeatNum * ELEMENTS_PER_BEAT ); };
inline float NoteIndexToBeat( float fNoteIndex ) { return fNoteIndex / (float)ELEMENTS_PER_BEAT; }; inline float NoteRowToBeat( float fNoteIndex ) { return fNoteIndex / (float)ELEMENTS_PER_BEAT; };
inline float NoteIndexToBeat( int iNoteIndex ) { return NoteIndexToBeat( (float)iNoteIndex ); }; inline float NoteRowToBeat( int iNoteIndex ) { return NoteRowToBeat( (float)iNoteIndex ); };
@@ -85,24 +84,34 @@ class NoteData
{ {
public: public:
NoteData(); NoteData();
~NoteData();
int m_iNumTracks; // used for loading
TapNote m_TapNotes[MAX_NOTE_TRACKS][MAX_TAP_NOTE_ELEMENTS]; void SetFromMeasureStrings( CStringArray &arrayMeasureStrings ); // for loading from a .notes file
HoldNote m_HoldNotes[MAX_HOLD_NOTE_ELEMENTS]; void SetFromDWIInfo(); // for loading from a .dwi file
int m_iNumHoldNotes; void SetFromBMSInfo(); // for loading from a .bms file
void ReadFromCacheFile( FILE* file );
static void SkipOverDataInCacheFile( FILE* file );
// used for saving
void GetMeasureStrings( CStringArray &arrayMeasureStrings ); // for saving to a .notes file
void WriteToCacheFile( FILE* file );
int m_iNumTracks;
TapNote m_TapNotes[MAX_NOTE_TRACKS][MAX_TAP_NOTE_ROWS];
HoldNote m_HoldNotes[MAX_HOLD_NOTE_ELEMENTS];
int m_iNumHoldNotes;
void ClearRange( NoteIndex iNoteIndexBegin, NoteIndex iNoteIndexEnd ); void ClearRange( NoteIndex iNoteIndexBegin, NoteIndex iNoteIndexEnd );
void ClearAll() { ClearRange( 0, MAX_TAP_NOTE_ELEMENTS ); }; void ClearAll() { ClearRange( 0, MAX_TAP_NOTE_ROWS ); };
void CopyRange( NoteData* pFrom, NoteIndex iNoteIndexBegin, NoteIndex iNoteIndexEnd ); void CopyRange( NoteData* pFrom, NoteIndex iNoteIndexBegin, NoteIndex iNoteIndexEnd );
void CopyAll( NoteData* pFrom ) { m_iNumTracks = pFrom->m_iNumTracks; CopyRange( pFrom, 0, MAX_TAP_NOTE_ELEMENTS ); }; void CopyAll( NoteData* pFrom ) { m_iNumTracks = pFrom->m_iNumTracks; CopyRange( pFrom, 0, MAX_TAP_NOTE_ROWS ); };
inline bool IsRowEmpty( NoteIndex index ) inline bool IsRowEmpty( NoteIndex index )
{ {
for( int t=0; t<m_iNumTracks; t++ ) for( int t=0; t<m_iNumTracks; t++ )
{
if( m_TapNotes[t][index] != '0' ) if( m_TapNotes[t][index] != '0' )
return false; return false;
}
return true; return true;
} }
@@ -110,18 +119,19 @@ public:
void AddHoldNote( HoldNote newNote ); // add note hold note merging overlapping HoldNotes and destroying TapNotes underneath void AddHoldNote( HoldNote newNote ); // add note hold note merging overlapping HoldNotes and destroying TapNotes underneath
void RemoveHoldNote( int index ); void RemoveHoldNote( int index );
// used for saving
void GetMeasureStrings( CStringArray &arrayMeasureStrings ); // for saving to a .notes file
// used for loading
void SetFromMeasureStrings( CStringArray &arrayMeasureStrings ); // for loading from a .notes file
void SetFromDWIInfo(); // for loading from a .dwi file
void SetFromBMSInfo(); // for loading from a .bms file
// statistics // statistics
float GetLastBeat(); // return the beat number of the last beat in the song float GetLastBeat(); // return the beat number of the last note
int GetNumTapNotes(); int GetLastRow();
int GetNumHoldNotes(); int GetNumTapNotes( const float fStartBeat = 0, const float fEndBeat = MAX_BEATS );
int GetNumDoubles( const float fStartBeat = 0, const float fEndBeat = MAX_BEATS );
int GetNumHoldNotes( const float fStartBeat = 0, const float fEndBeat = MAX_BEATS );
// radar values - return between 0.0 and 1.2
float GetStreamRadarValue( float fSongSeconds );
float GetVoltageRadarValue( float fSongSeconds );
float GetAirRadarValue( float fSongSeconds );
float GetChaosRadarValue( float fSongSeconds );
float GetFreezeRadarValue( float fSongSeconds );
// Transformations // Transformations
void LoadTransformed( NoteData* pOriginal, int iNewNumTracks, TrackNumber iNewToOriginalTrack[] ); void LoadTransformed( NoteData* pOriginal, int iNewNumTracks, TrackNumber iNewToOriginalTrack[] );
+16 -13
View File
@@ -5,7 +5,7 @@
Desc: See header. Desc: See header.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -37,7 +37,7 @@ NoteField::NoteField()
} }
void NoteField::Load( NoteData* pNoteData, PlayerOptions po, float fNumBeatsToDrawBehind, float fNumBeatsToDrawAhead, NoteFieldMode mode ) void NoteField::Load( NoteData* pNoteData, PlayerNumber p, PlayerOptions po, float fNumBeatsToDrawBehind, float fNumBeatsToDrawAhead, NoteFieldMode mode )
{ {
m_PlayerOptions = po; m_PlayerOptions = po;
m_fNumBeatsToDrawBehind = fNumBeatsToDrawBehind; m_fNumBeatsToDrawBehind = fNumBeatsToDrawBehind;
@@ -49,8 +49,11 @@ void NoteField::Load( NoteData* pNoteData, PlayerOptions po, float fNumBeatsToDr
// init arrow rotations and X positions // init arrow rotations and X positions
for( int c=0; c<m_iNumTracks; c++ ) for( int c=0; c<m_iNumTracks; c++ )
{ {
m_ColorNote[c].m_sprColorPart.Load( GAME->GetPathToGraphic( PLAYER_1, c, GRAPHIC_NOTE_COLOR_PART) ); CArray<D3DXCOLOR,D3DXCOLOR> arrayTweenColors;
m_ColorNote[c].m_sprGrayPart.Load( GAME->GetPathToGraphic( PLAYER_1, c, GRAPHIC_NOTE_GRAY_PART) ); GAME->GetTweenColors( p, c, arrayTweenColors );
m_ColorNote[c].m_sprColorPart.Load( GAME->GetPathToGraphic( p, c, GRAPHIC_NOTE_COLOR_PART) );
m_ColorNote[c].m_sprGrayPart.Load( GAME->GetPathToGraphic( p, c, GRAPHIC_NOTE_GRAY_PART) );
} }
@@ -149,18 +152,18 @@ void NoteField::DrawMarkerBar( const int iIndex )
m_rectMarkerBar.Draw(); m_rectMarkerBar.Draw();
} }
void NoteField::RenderPrimitives() void NoteField::DrawPrimitives()
{ {
//LOG->WriteLine( "NoteField::RenderPrimitives()" ); //LOG->WriteLine( "NoteField::DrawPrimitives()" );
if( m_fSongBeat < 0 ) if( m_fSongBeat < 0 )
m_fSongBeat = 0; m_fSongBeat = 0;
int iBaseFrameNo = (int)(m_fSongBeat*2.5) % NUM_FRAMES_IN_COLOR_ARROW_SPRITE; // 2.5 is a "fudge number" :-) This should be based on BPM int iBaseFrameNo = (int)(m_fSongBeat*2.5) % NUM_FRAMES_IN_COLOR_ARROW_SPRITE; // 2.5 is a "fudge number" :-) This should be based on BPM
int iIndexFirstArrowToDraw = BeatToNoteIndex( m_fSongBeat - m_fNumBeatsToDrawBehind ); // 2 beats earlier int iIndexFirstArrowToDraw = BeatToNoteRow( m_fSongBeat - m_fNumBeatsToDrawBehind ); // 2 beats earlier
if( iIndexFirstArrowToDraw < 0 ) iIndexFirstArrowToDraw = 0; if( iIndexFirstArrowToDraw < 0 ) iIndexFirstArrowToDraw = 0;
int iIndexLastArrowToDraw = BeatToNoteIndex( m_fSongBeat + m_fNumBeatsToDrawAhead ); // 7 beats later int iIndexLastArrowToDraw = BeatToNoteRow( m_fSongBeat + m_fNumBeatsToDrawAhead ); // 7 beats later
//LOG->WriteLine( "Drawing elements %d through %d", iIndexFirstArrowToDraw, iIndexLastArrowToDraw ); //LOG->WriteLine( "Drawing elements %d through %d", iIndexFirstArrowToDraw, iIndexLastArrowToDraw );
@@ -183,11 +186,11 @@ void NoteField::RenderPrimitives()
{ {
if( m_fBeginMarker != -1 ) if( m_fBeginMarker != -1 )
{ {
DrawMarkerBar( BeatToNoteIndex(m_fBeginMarker) ); DrawMarkerBar( BeatToNoteRow(m_fBeginMarker) );
} }
if( m_fEndMarker != -1 ) if( m_fEndMarker != -1 )
{ {
DrawMarkerBar( BeatToNoteIndex(m_fEndMarker) ); DrawMarkerBar( BeatToNoteRow(m_fEndMarker) );
} }
} }
@@ -252,7 +255,7 @@ void NoteField::RenderPrimitives()
const int iCol = hn.m_iTrack; const int iCol = hn.m_iTrack;
const float fHoldNoteLife = m_HoldNoteLife[i]; const float fHoldNoteLife = m_HoldNoteLife[i];
const bool bActive = NoteIndexToBeat(hn.m_iStartIndex) > m_fSongBeat && m_fSongBeat < NoteIndexToBeat(hn.m_iEndIndex); const bool bActive = NoteRowToBeat(hn.m_iStartIndex) > m_fSongBeat && m_fSongBeat < NoteRowToBeat(hn.m_iEndIndex);
// draw the gray parts // draw the gray parts
@@ -264,7 +267,7 @@ void NoteField::RenderPrimitives()
if( j < iIndexFirstArrowToDraw || iIndexLastArrowToDraw < j) if( j < iIndexFirstArrowToDraw || iIndexLastArrowToDraw < j)
continue; // skip this arrow continue; // skip this arrow
if( fHoldNoteLife > 0 && m_Mode == MODE_DANCING && NoteIndexToBeat(j) < m_fSongBeat ) if( fHoldNoteLife > 0 && m_Mode == MODE_DANCING && NoteRowToBeat(j) < m_fSongBeat )
continue; // don't draw continue; // don't draw
CreateHoldNoteInstance( instances[iCount++], bActive, j, hn, fHoldNoteLife ); CreateHoldNoteInstance( instances[iCount++], bActive, j, hn, fHoldNoteLife );
@@ -273,7 +276,7 @@ void NoteField::RenderPrimitives()
// draw the first arrow on top of the others // draw the first arrow on top of the others
j = (float)hn.m_iStartIndex; j = (float)hn.m_iStartIndex;
if( fHoldNoteLife > 0 && m_Mode == MODE_DANCING && NoteIndexToBeat(j) < m_fSongBeat ) if( fHoldNoteLife > 0 && m_Mode == MODE_DANCING && NoteRowToBeat(j) < m_fSongBeat )
; // don't draw ; // don't draw
else else
CreateHoldNoteInstance( instances[iCount++], bActive, j, hn, fHoldNoteLife ); CreateHoldNoteInstance( instances[iCount++], bActive, j, hn, fHoldNoteLife );
+6 -6
View File
@@ -5,7 +5,7 @@
Desc: A stream of ColorNotes that scrolls past Y==0. Desc: A stream of ColorNotes that scrolls past Y==0.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -19,7 +19,7 @@
#include "StyleDef.h" #include "StyleDef.h"
#include "ColorNote.h" #include "ColorNote.h"
#include "BitmapText.h" #include "BitmapText.h"
#include "RectangleActor.h" #include "Quad.h"
#include "ArrowEffects.h" #include "ArrowEffects.h"
@@ -30,14 +30,14 @@ class NoteField : public NoteData, public ActorFrame
public: public:
NoteField(); NoteField();
virtual void Update( float fDeltaTime, float fSongBeat ); virtual void Update( float fDeltaTime, float fSongBeat );
virtual void RenderPrimitives(); virtual void DrawPrimitives();
enum NoteFieldMode { enum NoteFieldMode {
MODE_DANCING, MODE_DANCING,
MODE_EDITING, MODE_EDITING,
}; };
void Load( NoteData* pNoteData, PlayerOptions po, float fNumArrowsToDrawBehind, float fNumArrowsToDrawAhead, NoteFieldMode mode ); void Load( NoteData* pNoteData, PlayerNumber p, PlayerOptions po, float fNumArrowsToDrawBehind, float fNumArrowsToDrawAhead, NoteFieldMode mode );
void RemoveTapNoteRow( int iIndex ); void RemoveTapNoteRow( int iIndex );
void SetHoldNoteLife( int iIndex, float fLife ); void SetHoldNoteLife( int iIndex, float fLife );
@@ -65,7 +65,7 @@ protected:
ColorNote m_ColorNote[MAX_NOTE_TRACKS]; ColorNote m_ColorNote[MAX_NOTE_TRACKS];
// used in MODE_EDIT // used in MODE_EDIT
RectangleActor m_rectMeasureBar; Quad m_rectMeasureBar;
BitmapText m_textMeasureNumber; BitmapText m_textMeasureNumber;
RectangleActor m_rectMarkerBar; Quad m_rectMarkerBar;
}; };
+79 -41
View File
@@ -1,11 +1,11 @@
#include "stdafx.h" #include "stdafx.h"
/* /*
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
Class: NoteMetadata Class: Notes
Desc: See header. Desc: See header.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -20,10 +20,13 @@
#include "InputMapper.h" #include "InputMapper.h"
const float JUDGEMENT_Y = CENTER_Y; // these two items are in the
const float FRAME_JUDGE_AND_COMBO_Y = CENTER_Y;
const float JUDGEMENT_Y_OFFSET = -26;
const float COMBO_Y_OFFSET = +26;
const float ARROWS_Y = SCREEN_TOP + ARROW_SIZE * 1.5f; const float ARROWS_Y = SCREEN_TOP + ARROW_SIZE * 1.5f;
const float HOLD_JUDGEMENT_Y = ARROWS_Y + 80; const float HOLD_JUDGEMENT_Y = ARROWS_Y + 80;
const float COMBO_Y = CENTER_Y + 60;
const float HOLD_ARROW_NG_TIME = 0.27f; const float HOLD_ARROW_NG_TIME = 0.27f;
@@ -35,7 +38,7 @@ Player::Player()
m_PlayerNumber = PLAYER_NONE; m_PlayerNumber = PLAYER_NONE;
// init step elements // init step elements
for( int i=0; i<MAX_TAP_NOTE_ELEMENTS; i++ ) for( int i=0; i<MAX_TAP_NOTE_ROWS; i++ )
{ {
for( int c=0; c<MAX_NOTE_TRACKS; c++ ) for( int c=0; c<MAX_NOTE_TRACKS; c++ )
{ {
@@ -52,10 +55,13 @@ Player::Player()
this->AddActor( &m_GrayArrowRow ); this->AddActor( &m_GrayArrowRow );
this->AddActor( &m_NoteField ); this->AddActor( &m_NoteField );
this->AddActor( &m_GhostArrowRow ); this->AddActor( &m_GhostArrowRow );
this->AddActor( &m_Judgement );
m_frameJudgeAndCombo.AddActor( &m_Judgement );
m_frameJudgeAndCombo.AddActor( &m_Combo );
this->AddActor( &m_frameJudgeAndCombo );
for( int c=0; c<MAX_NOTE_TRACKS; c++ ) for( int c=0; c<MAX_NOTE_TRACKS; c++ )
this->AddActor( &m_HoldJudgement[c] ); this->AddActor( &m_HoldJudgement[c] );
this->AddActor( &m_Combo );
} }
@@ -78,14 +84,21 @@ void Player::Load( PlayerNumber player_no, NoteData* pNoteData, const PlayerOpti
if( po.m_bLittle ) if( po.m_bLittle )
this->MakeLittle(); this->MakeLittle();
m_NoteField.Load( (NoteData*)this, po, 1.5f, 5.5f, NoteField::MODE_DANCING ); m_NoteField.Load( (NoteData*)this, player_no, po, 1.5f, 5.5f, NoteField::MODE_DANCING );
for( int t=0; t<pNoteData->m_iNumTracks; t++ )
{
for( int r=0; r<MAX_TAP_NOTE_ROWS; r++ )
m_TapNotesOriginal[t][r] = pNoteData->m_TapNotes[t][r];
}
m_GrayArrowRow.Load( po ); m_GrayArrowRow.Load( po );
m_GhostArrowRow.Load( po ); m_GhostArrowRow.Load( po );
m_frameJudgeAndCombo.SetY( FRAME_JUDGE_AND_COMBO_Y );
m_Combo.SetY( po.m_bReverseScroll ? -COMBO_Y_OFFSET : COMBO_Y_OFFSET );
m_Judgement.SetY( po.m_bReverseScroll ? -JUDGEMENT_Y_OFFSET : JUDGEMENT_Y_OFFSET );
m_Combo.SetY( po.m_bReverseScroll ? SCREEN_HEIGHT - COMBO_Y : COMBO_Y );
m_Judgement.SetY( po.m_bReverseScroll ? SCREEN_HEIGHT - JUDGEMENT_Y : JUDGEMENT_Y );
for( int c=0; c<MAX_NOTE_TRACKS; c++ ) for( int c=0; c<MAX_NOTE_TRACKS; c++ )
m_HoldJudgement[c].SetY( po.m_bReverseScroll ? SCREEN_HEIGHT - HOLD_JUDGEMENT_Y : HOLD_JUDGEMENT_Y ); m_HoldJudgement[c].SetY( po.m_bReverseScroll ? SCREEN_HEIGHT - HOLD_JUDGEMENT_Y : HOLD_JUDGEMENT_Y );
@@ -123,8 +136,8 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference
if( hns.m_Result != HNR_NONE ) // if this HoldNote already has a result if( hns.m_Result != HNR_NONE ) // if this HoldNote already has a result
continue; // we don't need to update the logic for this one continue; // we don't need to update the logic for this one
float fStartBeat = NoteIndexToBeat( (float)hn.m_iStartIndex ); float fStartBeat = NoteRowToBeat( (float)hn.m_iStartIndex );
float fEndBeat = NoteIndexToBeat( (float)hn.m_iEndIndex ); float fEndBeat = NoteRowToBeat( (float)hn.m_iEndIndex );
const int iCol = hn.m_iTrack; const int iCol = hn.m_iTrack;
const StyleInput StyleI( m_PlayerNumber, hn.m_iTrack ); const StyleInput StyleI( m_PlayerNumber, hn.m_iTrack );
@@ -133,7 +146,7 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference
// update the life // update the life
if( fStartBeat < m_fSongBeat && m_fSongBeat < fEndBeat ) // if the song beat is in the range of this hold if( fStartBeat < m_fSongBeat && m_fSongBeat < fEndBeat ) // if the song beat is in the range of this hold
{ {
const bool bIsHoldingButton = MAPPER->IsButtonDown( GameI ); const bool bIsHoldingButton = INPUTMAPPER->IsButtonDown( GameI );
if( bIsHoldingButton ) if( bIsHoldingButton )
{ {
@@ -171,6 +184,8 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference
ActorFrame::Update( fDeltaTime ); ActorFrame::Update( fDeltaTime );
m_frameJudgeAndCombo.Update( fDeltaTime );
m_pLifeMeter->SetBeat( fSongBeat ); m_pLifeMeter->SetBeat( fSongBeat );
m_GrayArrowRow.Update( fDeltaTime, fSongBeat ); m_GrayArrowRow.Update( fDeltaTime, fSongBeat );
@@ -181,19 +196,19 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference
} }
void Player::RenderPrimitives() void Player::DrawPrimitives()
{ {
D3DXMATRIX matOldView, matOldProj; D3DXMATRIX matOldView, matOldProj;
if( m_PlayerOptions.m_EffectType == PlayerOptions::EFFECT_SPACE ) if( m_PlayerOptions.m_EffectType == PlayerOptions::EFFECT_SPACE )
{ {
// turn off Z Buffering // turn off Z Buffering
SCREEN->GetDevice()->SetRenderState( D3DRS_ZENABLE, FALSE ); DISPLAY->GetDevice()->SetRenderState( D3DRS_ZENABLE, FALSE );
SCREEN->GetDevice()->SetRenderState( D3DRS_ZWRITEENABLE, FALSE ); DISPLAY->GetDevice()->SetRenderState( D3DRS_ZWRITEENABLE, FALSE );
// save old view and projection // save old view and projection
SCREEN->GetDevice()->GetTransform( D3DTS_VIEW, &matOldView ); DISPLAY->GetDevice()->GetTransform( D3DTS_VIEW, &matOldView );
SCREEN->GetDevice()->GetTransform( D3DTS_PROJECTION, &matOldProj ); DISPLAY->GetDevice()->GetTransform( D3DTS_PROJECTION, &matOldProj );
// construct view and project matrix // construct view and project matrix
@@ -202,11 +217,11 @@ void Player::RenderPrimitives()
&D3DXVECTOR3( CENTER_X &D3DXVECTOR3( CENTER_X
, GetY()+400.0f, 0.0f ), , GetY()+400.0f, 0.0f ),
&D3DXVECTOR3( 0.0f, -1.0f, 0.0f ) ); &D3DXVECTOR3( 0.0f, -1.0f, 0.0f ) );
SCREEN->GetDevice()->SetTransform( D3DTS_VIEW, &matNewView ); DISPLAY->GetDevice()->SetTransform( D3DTS_VIEW, &matNewView );
D3DXMATRIX matNewProj; D3DXMATRIX matNewProj;
D3DXMatrixPerspectiveFovLH( &matNewProj, D3DX_PI/4.0f, SCREEN_WIDTH/(float)SCREEN_HEIGHT, 0.0f, 1000.0f ); D3DXMatrixPerspectiveFovLH( &matNewProj, D3DX_PI/4.0f, SCREEN_WIDTH/(float)SCREEN_HEIGHT, 0.0f, 1000.0f );
SCREEN->GetDevice()->SetTransform( D3DTS_PROJECTION, &matNewProj ); DISPLAY->GetDevice()->SetTransform( D3DTS_PROJECTION, &matNewProj );
} }
m_GrayArrowRow.Draw(); m_GrayArrowRow.Draw();
@@ -216,19 +231,18 @@ void Player::RenderPrimitives()
if( m_PlayerOptions.m_EffectType == PlayerOptions::EFFECT_SPACE ) if( m_PlayerOptions.m_EffectType == PlayerOptions::EFFECT_SPACE )
{ {
// restire old view and projection // restire old view and projection
SCREEN->GetDevice()->SetTransform( D3DTS_VIEW, &matOldView ); DISPLAY->GetDevice()->SetTransform( D3DTS_VIEW, &matOldView );
SCREEN->GetDevice()->SetTransform( D3DTS_PROJECTION, &matOldProj ); DISPLAY->GetDevice()->SetTransform( D3DTS_PROJECTION, &matOldProj );
// turn Z Buffering back on // turn Z Buffering back on
SCREEN->GetDevice()->SetRenderState( D3DRS_ZENABLE, TRUE ); DISPLAY->GetDevice()->SetRenderState( D3DRS_ZENABLE, TRUE );
SCREEN->GetDevice()->SetRenderState( D3DRS_ZWRITEENABLE, TRUE ); DISPLAY->GetDevice()->SetRenderState( D3DRS_ZWRITEENABLE, TRUE );
} }
m_frameJudgeAndCombo.Draw();
m_Judgement.Draw();
for( int c=0; c<m_iNumTracks; c++ ) for( int c=0; c<m_iNumTracks; c++ )
m_HoldJudgement[c].Draw(); m_HoldJudgement[c].Draw();
m_Combo.Draw();
} }
bool Player::IsThereANoteAtIndex( int iIndex ) bool Player::IsThereANoteAtIndex( int iIndex )
@@ -277,11 +291,11 @@ void Player::HandlePlayerStep( float fSongBeat, ColumnNumber col, float fMaxBeat
if( col == m_HoldNotes[i].m_iTrack ) // the player's step is the same as this HoldNote if( col == m_HoldNotes[i].m_iTrack ) // the player's step is the same as this HoldNote
{ {
float fBeatDifference = fabsf( NoteIndexToBeat(hn.m_iStartIndex) - fSongBeat ); float fBeatDifference = fabsf( NoteRowToBeat(hn.m_iStartIndex) - fSongBeat );
if( fBeatDifference <= fMaxBeatDiff ) if( fBeatDifference <= fMaxBeatDiff )
{ {
float fBeatsUntilStep = NoteIndexToBeat( (float)hn.m_iStartIndex ) - fSongBeat; float fBeatsUntilStep = NoteRowToBeat( (float)hn.m_iStartIndex ) - fSongBeat;
float fPercentFromPerfect = fabsf( fBeatsUntilStep / fMaxBeatDiff ); float fPercentFromPerfect = fabsf( fBeatsUntilStep / fMaxBeatDiff );
//LOG->WriteLine( "fBeatsUntilStep: %f, fPercentFromPerfect: %f", //LOG->WriteLine( "fBeatsUntilStep: %f, fPercentFromPerfect: %f",
@@ -315,7 +329,18 @@ void Player::HandlePlayerStep( float fSongBeat, ColumnNumber col, float fMaxBeat
break; break;
} }
// zoom the judgement and combo like a heart beat
float fStartZoom;
switch( score )
{
case TNS_PERFECT: fStartZoom = 1.5f; break;
case TNS_GREAT: fStartZoom = 1.3f; break;
case TNS_GOOD: fStartZoom = 1.2f; break;
case TNS_BOO: fStartZoom = 1.0f; break;
}
m_frameJudgeAndCombo.SetZoom( fStartZoom );
m_frameJudgeAndCombo.BeginTweening( 0.2f );
m_frameJudgeAndCombo.SetTweenZoom( 1 );
} }
} }
} }
@@ -328,8 +353,8 @@ void Player::CheckForCompleteRow( float fSongBeat, ColumnNumber col, float fMaxB
//LOG->WriteLine( "Player::CheckForCompleteRow()" ); //LOG->WriteLine( "Player::CheckForCompleteRow()" );
// look for the closest matching step // look for the closest matching step
int iIndexStartLookingAt = BeatToNoteIndex( fSongBeat ); int iIndexStartLookingAt = BeatToNoteRow( fSongBeat );
int iNumElementsToExamine = BeatToNoteIndex( fMaxBeatDiff ); // number of elements to examine on either end of iIndexStartLookingAt int iNumElementsToExamine = BeatToNoteRow( fMaxBeatDiff ); // number of elements to examine on either end of iIndexStartLookingAt
//LOG->WriteLine( "iIndexStartLookingAt = %d, iNumElementsToExamine = %d", iIndexStartLookingAt, iNumElementsToExamine ); //LOG->WriteLine( "iIndexStartLookingAt = %d, iNumElementsToExamine = %d", iIndexStartLookingAt, iNumElementsToExamine );
@@ -340,14 +365,14 @@ void Player::CheckForCompleteRow( float fSongBeat, ColumnNumber col, float fMaxB
int iCurrentIndexLater = iIndexStartLookingAt + delta; int iCurrentIndexLater = iIndexStartLookingAt + delta;
// silly check to make sure we don't go out of bounds // silly check to make sure we don't go out of bounds
iCurrentIndexEarlier = clamp( iCurrentIndexEarlier, 0, MAX_TAP_NOTE_ELEMENTS-1 ); iCurrentIndexEarlier = clamp( iCurrentIndexEarlier, 0, MAX_TAP_NOTE_ROWS-1 );
iCurrentIndexLater = clamp( iCurrentIndexLater, 0, MAX_TAP_NOTE_ELEMENTS-1 ); iCurrentIndexLater = clamp( iCurrentIndexLater, 0, MAX_TAP_NOTE_ROWS-1 );
//////////////////////////// ////////////////////////////
// check the step to the left of iIndexStartLookingAt // check the step to the left of iIndexStartLookingAt
//////////////////////////// ////////////////////////////
//LOG->WriteLine( "Checking NoteMetadata[%d]", iCurrentIndexEarlier ); //LOG->WriteLine( "Checking Notes[%d]", iCurrentIndexEarlier );
if( m_TapNotes[col][iCurrentIndexEarlier] != '0' ) // these NoteMetadata overlap if( m_TapNotes[col][iCurrentIndexEarlier] != '0' ) // these Notes overlap
{ {
m_TapNotes[col][iCurrentIndexEarlier] = '0'; // mark hit m_TapNotes[col][iCurrentIndexEarlier] = '0'; // mark hit
@@ -365,8 +390,8 @@ void Player::CheckForCompleteRow( float fSongBeat, ColumnNumber col, float fMaxB
//////////////////////////// ////////////////////////////
// check the step to the right of iIndexStartLookingAt // check the step to the right of iIndexStartLookingAt
//////////////////////////// ////////////////////////////
//LOG->WriteLine( "Checking NoteMetadata[%d]", iCurrentIndexLater ); //LOG->WriteLine( "Checking Notes[%d]", iCurrentIndexLater );
if( m_TapNotes[col][iCurrentIndexLater] != '0' ) // these NoteMetadata overlap if( m_TapNotes[col][iCurrentIndexLater] != '0' ) // these Notes overlap
{ {
m_TapNotes[col][iCurrentIndexLater] = '0'; // mark hit m_TapNotes[col][iCurrentIndexLater] = '0'; // mark hit
@@ -385,7 +410,7 @@ void Player::CheckForCompleteRow( float fSongBeat, ColumnNumber col, float fMaxB
void Player::OnRowDestroyed( float fSongBeat, ColumnNumber col, float fMaxBeatDiff, int iIndexThatWasSteppedOn ) void Player::OnRowDestroyed( float fSongBeat, ColumnNumber col, float fMaxBeatDiff, int iIndexThatWasSteppedOn )
{ {
float fStepBeat = NoteIndexToBeat( (float)iIndexThatWasSteppedOn ); float fStepBeat = NoteRowToBeat( (float)iIndexThatWasSteppedOn );
float fBeatsUntilStep = fStepBeat - fSongBeat; float fBeatsUntilStep = fStepBeat - fSongBeat;
@@ -431,6 +456,19 @@ void Player::OnRowDestroyed( float fSongBeat, ColumnNumber col, float fMaxBeatDi
m_Combo.EndCombo(); m_Combo.EndCombo();
break; break;
} }
// zoom the judgement and combo like a heart beat
float fStartZoom;
switch( score )
{
case TNS_PERFECT: fStartZoom = 1.5f; break;
case TNS_GREAT: fStartZoom = 1.3f; break;
case TNS_GOOD: fStartZoom = 1.2f; break;
case TNS_BOO: fStartZoom = 1.0f; break;
}
m_frameJudgeAndCombo.SetZoom( fStartZoom );
m_frameJudgeAndCombo.BeginTweening( 0.2f );
m_frameJudgeAndCombo.SetTweenZoom( 1 );
} }
@@ -438,7 +476,7 @@ ScoreSummary Player::GetScoreSummary()
{ {
ScoreSummary scoreSummary; ScoreSummary scoreSummary;
for( int i=0; i<MAX_TAP_NOTE_ELEMENTS; i++ ) for( int i=0; i<MAX_TAP_NOTE_ROWS; i++ )
{ {
switch( m_TapNoteScores[i] ) switch( m_TapNoteScores[i] )
{ {
@@ -480,9 +518,9 @@ ScoreSummary Player::GetScoreSummary()
int Player::UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat ) int Player::UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat )
{ {
//LOG->WriteLine( "NoteMetadata::UpdateTapNotesMissedOlderThan(%f)", fMissIfOlderThanThisBeat ); //LOG->WriteLine( "Notes::UpdateTapNotesMissedOlderThan(%f)", fMissIfOlderThanThisBeat );
int iMissIfOlderThanThisIndex = BeatToNoteIndex( fMissIfOlderThanThisBeat ); int iMissIfOlderThanThisIndex = BeatToNoteRow( fMissIfOlderThanThisBeat );
int iNumMissesFound = 0; int iNumMissesFound = 0;
// Since this is being called every frame, let's not check the whole array every time. // Since this is being called every frame, let's not check the whole array every time.
+7 -6
View File
@@ -6,13 +6,13 @@
Desc: Object that accepts pad input, knocks down ColorNotes that were stepped on, Desc: Object that accepts pad input, knocks down ColorNotes that were stepped on,
and keeps score for the player. and keeps score for the player.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
#include "PrefsManager.h" // for ScoreSummary #include "PrefsManager.h" // for ScoreSummary
#include "NoteMetadata.h" #include "Notes.h"
#include "Sprite.h" #include "Sprite.h"
#include "BitmapText.h" #include "BitmapText.h"
@@ -41,7 +41,7 @@ public:
Player(); Player();
void Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference ); void Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference );
void RenderPrimitives(); void DrawPrimitives();
void Load( PlayerNumber player_no, NoteData* pNoteData, const PlayerOptions& po, LifeMeterBar* pLM, ScoreDisplayRolling* pScore ); void Load( PlayerNumber player_no, NoteData* pNoteData, const PlayerOptions& po, LifeMeterBar* pLM, ScoreDisplayRolling* pScore );
void CrossedIndex( int iIndex ); void CrossedIndex( int iIndex );
@@ -61,8 +61,8 @@ protected:
PlayerOptions m_PlayerOptions; PlayerOptions m_PlayerOptions;
// maintain this extra data in addition to the NoteData // maintain this extra data in addition to the NoteData
TapNote m_TapNotesOriginal[MAX_NOTE_TRACKS][MAX_TAP_NOTE_ELEMENTS]; // the original NoteMetadata that were loaded into player TapNote m_TapNotesOriginal[MAX_NOTE_TRACKS][MAX_TAP_NOTE_ROWS]; // the original Notes that were loaded into player
TapNoteScore m_TapNoteScores[MAX_TAP_NOTE_ELEMENTS]; TapNoteScore m_TapNoteScores[MAX_TAP_NOTE_ROWS];
HoldNoteScore m_HoldNoteScores[MAX_HOLD_NOTE_ELEMENTS]; HoldNoteScore m_HoldNoteScores[MAX_HOLD_NOTE_ELEMENTS];
@@ -70,8 +70,9 @@ protected:
NoteField m_NoteField; NoteField m_NoteField;
GhostArrowRow m_GhostArrowRow; GhostArrowRow m_GhostArrowRow;
Judgement m_Judgement;
HoldJudgement m_HoldJudgement[MAX_NOTE_TRACKS]; HoldJudgement m_HoldJudgement[MAX_NOTE_TRACKS];
ActorFrame m_frameJudgeAndCombo;
Judgement m_Judgement;
Combo m_Combo; Combo m_Combo;
LifeMeterBar* m_pLifeMeter; LifeMeterBar* m_pLifeMeter;
ScoreDisplayRolling* m_pScore; ScoreDisplayRolling* m_pScore;
+21 -8
View File
@@ -5,7 +5,7 @@
Desc: See Header. Desc: See Header.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -121,12 +121,14 @@ void PrefsManager::ReadPrefsFromDisk()
{ {
pKey->GetNextAssoc( pos, name_string, value_string ); pKey->GetNextAssoc( pos, name_string, value_string );
if( name_string == "IgnoreJoyAxes" ) m_GameOptions.m_bIgnoreJoyAxes = ( value_string == "1" ); if( name_string == "IgnoreJoyAxes" ) m_GameOptions.m_bIgnoreJoyAxes = ( value_string == "1" );
if( name_string == "ShowFPS" ) m_GameOptions.m_bShowFPS = ( value_string == "1" ); if( name_string == "ShowFPS" ) m_GameOptions.m_bShowFPS = ( value_string == "1" );
if( name_string == "UseRandomVis" ) m_GameOptions.m_bUseRandomVis = ( value_string == "1" ); if( name_string == "UseRandomVis" ) m_GameOptions.m_bUseRandomVis = ( value_string == "1" );
if( name_string == "SkipCaution" ) m_GameOptions.m_bSkipCaution = ( value_string == "1" ); if( name_string == "Announcer" ) m_GameOptions.m_bAnnouncer = ( value_string == "1" );
if( name_string == "Announcer" ) m_GameOptions.m_bAnnouncer = ( value_string == "1" ); if( name_string == "ShowCaution" ) m_GameOptions.m_bShowCaution = ( value_string == "1" );
if( name_string == "NumArcadeStages" ) m_GameOptions.m_iNumArcadeStages= atoi( value_string ); if( name_string == "ShowSelectDifficulty" ) m_GameOptions.m_bShowSelectDifficulty = ( value_string == "1" );
if( name_string == "ShowSelectGroup" ) m_GameOptions.m_bShowSelectGroup = ( value_string == "1" );
if( name_string == "NumArcadeStages" ) m_GameOptions.m_iNumArcadeStages = atoi( value_string );
if( name_string == "JudgementDifficulty" ) m_GameOptions.m_JudgementDifficulty= (GameOptions::JudgementDifficulty) atoi( value_string ); if( name_string == "JudgementDifficulty" ) m_GameOptions.m_JudgementDifficulty= (GameOptions::JudgementDifficulty) atoi( value_string );
} }
} }
@@ -193,14 +195,25 @@ void PrefsManager::SavePrefsToDisk()
ini.SetValue( "GameOptions", "IgnoreJoyAxes", m_GameOptions.m_bIgnoreJoyAxes ? "1":"0" ); ini.SetValue( "GameOptions", "IgnoreJoyAxes", m_GameOptions.m_bIgnoreJoyAxes ? "1":"0" );
ini.SetValue( "GameOptions", "ShowFPS", m_GameOptions.m_bShowFPS ? "1":"0" ); ini.SetValue( "GameOptions", "ShowFPS", m_GameOptions.m_bShowFPS ? "1":"0" );
ini.SetValue( "GameOptions", "UseRandomVis", m_GameOptions.m_bUseRandomVis ? "1":"0" ); ini.SetValue( "GameOptions", "UseRandomVis", m_GameOptions.m_bUseRandomVis ? "1":"0" );
ini.SetValue( "GameOptions", "SkipCaution", m_GameOptions.m_bSkipCaution ? "1":"0" );
ini.SetValue( "GameOptions", "Announcer", m_GameOptions.m_bAnnouncer ? "1":"0" ); ini.SetValue( "GameOptions", "Announcer", m_GameOptions.m_bAnnouncer ? "1":"0" );
ini.SetValue( "GameOptions", "ShowCaution", m_GameOptions.m_bShowCaution ? "1":"0" );
ini.SetValue( "GameOptions", "ShowSelectDifficulty",m_GameOptions.m_bShowSelectDifficulty ? "1":"0" );
ini.SetValue( "GameOptions", "ShowSelectGroup", m_GameOptions.m_bShowSelectGroup ? "1":"0" );
ini.WriteFile(); ini.WriteFile();
} }
int PrefsManager::GetStageNumber()
{
return m_iCurrentStage;
}
bool PrefsManager::IsFinalStage()
{
return m_GameOptions.m_iNumArcadeStages == m_iCurrentStage;
}
CString PrefsManager::GetStageText() CString PrefsManager::GetStageText()
{ {
+10 -7
View File
@@ -7,7 +7,7 @@
also has temporary holders for information that passed between windows - e.g. also has temporary holders for information that passed between windows - e.g.
ScoreSummary. ScoreSummary.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -28,16 +28,19 @@ public:
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
GameMode m_GameMode; GameMode m_GameMode;
int m_iCurrentStage; // number of stages played +1 int m_iCurrentStage; // number of stages played +1
int GetStageNumber();
bool IsFinalStage();
CString GetStageText(); CString GetStageText();
DifficultyClass m_PreferredDifficultyClass[NUM_PLAYERS]; DifficultyClass m_PreferredDifficultyClass[NUM_PLAYERS];
GameOptions m_GameOptions; GameOptions m_GameOptions;
bool m_bWindowed; bool m_bWindowed;
GraphicProfile m_GraphicProfile; GraphicProfile m_GraphicProfile;
GraphicProfileOptions* GetCustomGraphicProfileOptions(); GraphicProfileOptions* GetCustomGraphicProfileOptions();
GraphicProfileOptions* GetCurrentGraphicProfileOptions(); GraphicProfileOptions* GetCurrentGraphicProfileOptions();
PlayerOptions m_PlayerOptions[NUM_PLAYERS]; PlayerOptions m_PlayerOptions[NUM_PLAYERS];
SongOptions m_SongOptions; SongOptions m_SongOptions;
void ReadPrefsFromDisk(); void ReadPrefsFromDisk();
+53 -43
View File
@@ -5,7 +5,7 @@
Desc: Holder for a static texture with metadata. Can load just about any image format. Desc: Holder for a static texture with metadata. Can load just about any image format.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -31,18 +31,22 @@
// RageBitmapTexture constructor // RageBitmapTexture constructor
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
RageBitmapTexture::RageBitmapTexture( RageBitmapTexture::RageBitmapTexture(
RageScreen* pScreen, RageDisplay* pScreen,
const CString &sFilePath, const CString &sFilePath,
const DWORD dwMaxSize, DWORD dwMaxSize,
const DWORD dwTextureColorDepth, DWORD dwTextureColorDepth,
const DWORD dwHints ) : int iMipMaps,
RageTexture( pScreen, sFilePath, dwMaxSize, dwTextureColorDepth, dwHints ) int iAlphaBits,
bool bDither,
bool bStretch
) :
RageTexture( pScreen, sFilePath, dwMaxSize, dwTextureColorDepth, iMipMaps, iAlphaBits, bDither, bStretch )
{ {
// LOG->WriteLine( "RageBitmapTexture::RageBitmapTexture()" ); // LOG->WriteLine( "RageBitmapTexture::RageBitmapTexture()" );
m_pd3dTexture = NULL; m_pd3dTexture = NULL;
Create( dwMaxSize, dwTextureColorDepth, dwHints ); Create( dwMaxSize, dwTextureColorDepth, iMipMaps, iAlphaBits, bDither, bStretch );
CreateFrameRects(); CreateFrameRects();
} }
@@ -53,12 +57,16 @@ RageBitmapTexture::~RageBitmapTexture()
} }
void RageBitmapTexture::Reload( void RageBitmapTexture::Reload(
const DWORD dwMaxSize, DWORD dwMaxSize,
const DWORD dwTextureColorDepth, DWORD dwTextureColorDepth,
const DWORD dwHints ) int iMipMaps,
int iAlphaBits,
bool bDither,
bool bStretch
)
{ {
SAFE_RELEASE(m_pd3dTexture); SAFE_RELEASE(m_pd3dTexture);
Create( dwMaxSize, dwTextureColorDepth, dwHints ); Create( dwMaxSize, dwTextureColorDepth, iMipMaps, iAlphaBits, bDither, bStretch );
// leave m_iRefCount alone! // leave m_iRefCount alone!
CreateFrameRects(); CreateFrameRects();
} }
@@ -72,49 +80,51 @@ LPDIRECT3DTEXTURE8 RageBitmapTexture::GetD3DTexture()
} }
void RageBitmapTexture::Create( DWORD dwMaxSize, DWORD dwTextureColorDepth, DWORD dwHints ) void RageBitmapTexture::Create(
DWORD dwMaxSize,
DWORD dwTextureColorDepth,
int iMipMaps,
int iAlphaBits,
bool bDither,
bool bStretch
)
{ {
HRESULT hr; HRESULT hr;
// look in the file name for a format hints
m_sFilePath.MakeLower();
if( -1 != m_sFilePath.Find("no alpha") )
iAlphaBits = 0;
else if( -1 != m_sFilePath.Find("1 alpha") )
iAlphaBits = 1;
if( -1 != m_sFilePath.Find("dither") )
bDither = true;
/////////////////////// ///////////////////////
// Figure out which texture format to use // Figure out which texture format to use
/////////////////////// ///////////////////////
D3DFORMAT fmtTexture; D3DFORMAT fmtTexture;
// look in the file name for a format hint
m_sFilePath.MakeLower();
switch( dwTextureColorDepth ) switch( dwTextureColorDepth )
{ {
case 16: case 16:
if( -1 != m_sFilePath.Find("no alpha") ) switch( iAlphaBits )
fmtTexture = D3DFMT_R5G6B5; {
else if( -1 != m_sFilePath.Find("1 alpha") ) case 0: fmtTexture = D3DFMT_R5G6B5; break;
fmtTexture = D3DFMT_A1R5G5B5; case 1: fmtTexture = D3DFMT_A1R5G5B5; break;
else default: fmtTexture = D3DFMT_A4R4G4B4; break;
fmtTexture = D3DFMT_A4R4G4B4; }
break;
case 32: case 32:
fmtTexture = D3DFMT_A8R8G8B8; fmtTexture = D3DFMT_A8R8G8B8;
break; break;
default: default:
ASSERT( false ); // invalid color depth value FatalError( "Invalid color depth: %d bits", dwTextureColorDepth );
} }
// look in the file name for a dither hint
bool bDither = (dwHints & TEXTURE_HINT_DITHER)
|| -1 != m_sFilePath.Find("dither");
bool bCreateMipMaps = !(dwHints & TEXTURE_HINT_NOMIPMAPS);
///////////////////// /////////////////////
// Figure out whether the texture can fit into texture memory unscaled // Figure out whether the texture can fit into texture memory unscaled
///////////////////// /////////////////////
bool bScaleImageToTextureSize;
D3DXIMAGE_INFO ddii; D3DXIMAGE_INFO ddii;
if( FAILED( hr = D3DXGetImageInfoFromFile( if( FAILED( hr = D3DXGetImageInfoFromFile(
m_sFilePath, m_sFilePath,
@@ -124,9 +134,9 @@ void RageBitmapTexture::Create( DWORD dwMaxSize, DWORD dwTextureColorDepth, DWOR
} }
// find out what the min texture size is // find out what the min texture size is
dwMaxSize = min( dwMaxSize, SCREEN->GetDeviceCaps().MaxTextureWidth ); dwMaxSize = min( dwMaxSize, DISPLAY->GetDeviceCaps().MaxTextureWidth );
bScaleImageToTextureSize = ddii.Width > dwMaxSize || ddii.Height > dwMaxSize; bStretch |= ddii.Width > dwMaxSize || ddii.Height > dwMaxSize;
/* /*
// HACK: The stupid Savage driver will report that it can hold the entire texture, // HACK: The stupid Savage driver will report that it can hold the entire texture,
@@ -139,13 +149,13 @@ void RageBitmapTexture::Create( DWORD dwMaxSize, DWORD dwTextureColorDepth, DWOR
if( FAILED( hr = D3DXCreateTextureFromFileEx( if( FAILED( hr = D3DXCreateTextureFromFileEx(
m_pd3dDevice, // device m_pd3dDevice, // device
m_sFilePath, // soure file m_sFilePath, // soure file
bScaleImageToTextureSize ? dwMaxSize : D3DX_DEFAULT, // width bStretch ? dwMaxSize : D3DX_DEFAULT, // width
bScaleImageToTextureSize ? dwMaxSize : D3DX_DEFAULT, // height bStretch ? dwMaxSize : D3DX_DEFAULT, // height
bCreateMipMaps ? 4 : 0, // mip map levels iMipMaps, // mip map levels
0, // usage (is a render target?) 0, // usage (is a render target?)
fmtTexture, // our preferred texture format fmtTexture, // our preferred texture format
D3DPOOL_MANAGED, // which memory pool D3DPOOL_MANAGED, // which memory pool
(bScaleImageToTextureSize ? D3DX_FILTER_BOX : D3DX_FILTER_NONE) | (bDither ? D3DX_FILTER_DITHER : 0), // filter (bStretch ? D3DX_FILTER_BOX : D3DX_FILTER_NONE) | (bDither ? D3DX_FILTER_DITHER : 0), // filter
D3DX_FILTER_BOX | (bDither ? D3DX_FILTER_DITHER : 0), // mip filter D3DX_FILTER_BOX | (bDither ? D3DX_FILTER_DITHER : 0), // mip filter
0, // no color key 0, // no color key
&ddii, // struct to fill with source image info &ddii, // struct to fill with source image info
@@ -171,7 +181,7 @@ void RageBitmapTexture::Create( DWORD dwMaxSize, DWORD dwTextureColorDepth, DWOR
m_TextureFormat = ddsd.Format; m_TextureFormat = ddsd.Format;
if( bScaleImageToTextureSize ) if( bStretch )
{ {
m_iImageWidth = m_iTextureWidth; m_iImageWidth = m_iTextureWidth;
m_iImageHeight = m_iTextureHeight; m_iImageHeight = m_iTextureHeight;
@@ -182,11 +192,11 @@ void RageBitmapTexture::Create( DWORD dwMaxSize, DWORD dwTextureColorDepth, DWOR
m_iImageHeight = m_iSourceHeight; m_iImageHeight = m_iSourceHeight;
} }
LOG->WriteLine( "RageBitmapTexture: Loaded '%s' (%ux%u) from disk. bScaleImageToTextureSize = %d, source %d,%d; image %d,%d.", LOG->WriteLine( "RageBitmapTexture: Loaded '%s' (%ux%u) from disk. bStretch = %d, source %d,%d; image %d,%d.",
m_sFilePath, m_sFilePath,
GetTextureWidth(), GetTextureWidth(),
GetTextureHeight(), GetTextureHeight(),
bScaleImageToTextureSize, bStretch,
m_iSourceWidth, m_iSourceWidth,
m_iSourceHeight, m_iSourceHeight,
m_iImageWidth, m_iImageWidth,
+27 -29
View File
@@ -1,30 +1,18 @@
#pragma once
/* /*
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
File: RageBitmapTexture.h Class: RageBitmapTexture
Desc: Holder for a static texture with metadata. Can load just about any image format. Desc: Holder for a static texture with metadata. Can load just about any image format.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
#include "RageDisplay.h"
class RageBitmapTexture;
#ifndef _RageBitmapTexture_H_
#define _RageBitmapTexture_H_
#include "RageScreen.h"
#include <d3dx8.h> #include <d3dx8.h>
#include <assert.h> #include <assert.h>
//#include <d3d8types.h>
const DWORD TEXTURE_HINT_NOMIPMAPS = 1 << 0;
const DWORD TEXTURE_HINT_DITHER = 1 << 1;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -34,26 +22,36 @@ class RageBitmapTexture : public RageTexture
{ {
public: public:
RageBitmapTexture( RageBitmapTexture(
RageScreen* pScreen, RageDisplay* pScreen,
const CString &sFilePath, const CString &sFilePath,
const DWORD dwMaxSize = 2048, DWORD dwMaxSize = 2048,
const DWORD dwTextureColorDepth = 16, DWORD dwTextureColorDepth = 16,
const DWORD dwHints = 0 int iMipMaps = 4,
int iAlphaBits = 4,
bool bDither = false,
bool bStretch = false
); );
~RageBitmapTexture(); ~RageBitmapTexture();
virtual void Reload( virtual void Reload(
const DWORD dwMaxSize, DWORD dwMaxSize,
const DWORD dwTextureColorDepth, DWORD dwTextureColorDepth,
const DWORD dwHints ); int iMipMaps = 4,
int iAlphaBits = 4,
bool bDither = false,
bool bStretch = false
);
virtual LPDIRECT3DTEXTURE8 GetD3DTexture(); virtual LPDIRECT3DTEXTURE8 GetD3DTexture();
protected: protected:
virtual void Create( DWORD dwMaxSize, DWORD dwTextureColorDepth, DWORD dwHints ); virtual void Create(
DWORD dwMaxSize,
DWORD dwTextureColorDepth,
int iMipMaps,
int iAlphaBits,
bool bDither,
bool bStretch
);
LPDIRECT3DTEXTURE8 m_pd3dTexture; LPDIRECT3DTEXTURE8 m_pd3dTexture;
}; };
#endif
+4 -2
View File
@@ -5,7 +5,7 @@
Desc: Wrapper for DirectInput. Generates InputEvents. Desc: Wrapper for DirectInput. Generates InputEvents.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -28,7 +28,7 @@
#include "ErrorCatcher/ErrorCatcher.h" #include "ErrorCatcher/ErrorCatcher.h"
RageInput* INPUTM = NULL; // globally accessable input device RageInput* INPUTMAN = NULL; // globally accessable input device
@@ -283,6 +283,8 @@ BOOL CALLBACK EnumAxesCallback( const DIDEVICEOBJECTINSTANCE* pdidoi,
RageInput::RageInput( HWND hWnd ) RageInput::RageInput( HWND hWnd )
{ {
LOG->WriteLine( "RageInput::RageInput()" );
int i; int i;
m_hWnd = hWnd; m_hWnd = hWnd;
+4 -10
View File
@@ -1,17 +1,14 @@
#pragma once
/* /*
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
File: RageInput.h File: RageInput.h
Desc: Wrapper for DirectInput. Generates InputEvents. Desc: Wrapper for DirectInput. Generates InputEvents.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
#ifndef _RAGEINPUT_H_
#define _RAGEINPUT_H_
#ifndef DIRECTINPUT_VERSION #ifndef DIRECTINPUT_VERSION
#define DIRECTINPUT_VERSION 0x0800 #define DIRECTINPUT_VERSION 0x0800
#endif #endif
@@ -99,7 +96,7 @@ public:
class RageInput class RageInput
{ {
// Our Windows Handle // Our Screens Handle
HWND m_hWnd; HWND m_hWnd;
// Main DirectInput Object // Main DirectInput Object
@@ -155,7 +152,4 @@ public:
}; };
extern RageInput* INPUTM; // global and accessable from anywhere in our program extern RageInput* INPUTMAN; // global and accessable from anywhere in our program
#endif
+1 -1
View File
@@ -5,7 +5,7 @@
Desc: See header. Desc: See header.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
+1 -1
View File
@@ -5,7 +5,7 @@
Desc: Manages logging Desc: Manages logging
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
+15 -9
View File
@@ -5,7 +5,7 @@
Desc: See header. Desc: See header.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -243,12 +243,15 @@ HRESULT CTextureRenderer::DoRenderSample( IMediaSample * pSample )
// RageMovieTexture constructor // RageMovieTexture constructor
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
RageMovieTexture::RageMovieTexture( RageMovieTexture::RageMovieTexture(
RageScreen* pScreen, RageDisplay* pScreen,
const CString &sFilePath, const CString &sFilePath,
const DWORD dwMaxSize, DWORD dwMaxSize,
const DWORD dwTextureColorDepth, DWORD dwTextureColorDepth,
const DWORD dwHints ) : int iMipMaps,
RageTexture( pScreen, sFilePath, dwMaxSize, dwTextureColorDepth, dwHints ) int iAlphaBits,
bool bDither,
bool bStretch ) :
RageTexture( pScreen, sFilePath, dwMaxSize, dwTextureColorDepth, iMipMaps, iAlphaBits, bDither, bStretch )
{ {
LOG->WriteLine( "RageBitmapTexture::RageBitmapTexture()" ); LOG->WriteLine( "RageBitmapTexture::RageBitmapTexture()" );
@@ -269,9 +272,12 @@ RageMovieTexture::~RageMovieTexture()
} }
void RageMovieTexture::Reload( void RageMovieTexture::Reload(
const DWORD dwMaxSize, DWORD dwMaxSize,
const DWORD dwTextureColorDepth, DWORD dwTextureColorDepth,
const DWORD dwHints ) int iMipMaps,
int iAlphaBits,
bool bDither,
bool bStretch )
{ {
// do nothing // do nothing
} }
+17 -9
View File
@@ -4,7 +4,7 @@
Desc: Based on the DShowTextures example in the DX8 SDK. Desc: Based on the DShowTextures example in the DX8 SDK.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -14,7 +14,7 @@
#define _RAGEMOVIETEXTURE_H_ #define _RAGEMOVIETEXTURE_H_
#include "RageScreen.h" #include "RageDisplay.h"
#include <d3dx8.h> #include <d3dx8.h>
//#include <d3d8types.h> //#include <d3d8types.h>
#include <atlbase.h> #include <atlbase.h>
@@ -75,17 +75,25 @@ class RageMovieTexture : public RageTexture
{ {
public: public:
RageMovieTexture( RageMovieTexture(
RageScreen* pScreen, RageDisplay* pScreen,
const CString &sFilePath, const CString &sFilePath,
const DWORD dwMaxSize, DWORD dwMaxSize = 2048,
const DWORD dwTextureColorDepth, DWORD dwTextureColorDepth = 16,
const DWORD dwHints ); int iMipMaps = 4,
int iAlphaBits = 4,
bool bDither = false,
bool bStretch = false
);
virtual ~RageMovieTexture(); virtual ~RageMovieTexture();
virtual void Reload( virtual void Reload(
const DWORD dwMaxSize, DWORD dwMaxSize,
const DWORD dwTextureColorDepth, DWORD dwTextureColorDepth,
const DWORD dwHints ); int iMipMaps = 4,
int iAlphaBits = 4,
bool bDither = false,
bool bStretch = false
);
LPDIRECT3DTEXTURE8 GetD3DTexture(); LPDIRECT3DTEXTURE8 GetD3DTexture();
+16 -2
View File
@@ -5,7 +5,7 @@
Desc: Sound effects library (currently a wrapper around Bass Sound Library). Desc: Sound effects library (currently a wrapper around Bass Sound Library).
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -40,7 +40,7 @@ RageSound::RageSound( HWND hWnd )
"The most likely cause of this problem is that you do not have a sound card\n" "The most likely cause of this problem is that you do not have a sound card\n"
"installed, or that you have not yet installed a driver for your sound card.\n" "installed, or that you have not yet installed a driver for your sound card.\n"
"Before running this program again, please verify that your sound card is\n" "Before running this program again, please verify that your sound card is\n"
"is working in other Windows applications." "is working in other Screens applications."
); );
} }
@@ -87,3 +87,17 @@ void RageSound::PlayOnceStreamed( CString sPath )
// this stream will free itself when stopped // this stream will free itself when stopped
} }
void RageSound::PlayOnceStreamedFromDir( CString sDir )
{
// make sure there's a backslash at the end of this path
if( sDir[sDir.GetLength()-1] != '\\' )
sDir += "\\";
CStringArray arraySoundFiles;
GetDirListing( sDir + "*.mp3", arraySoundFiles );
GetDirListing( sDir + "*.wav", arraySoundFiles );
GetDirListing( sDir + "*.ogg", arraySoundFiles );
int index = rand() % arraySoundFiles.GetSize();
PlayOnceStreamed( sDir + arraySoundFiles[index] );
}
+3 -2
View File
@@ -5,7 +5,7 @@
Desc: Sound effects library (currently a wrapper around Bass Sound Library). Desc: Sound effects library (currently a wrapper around Bass Sound Library).
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -23,9 +23,10 @@ public:
RageSound( HWND hWnd ); RageSound( HWND hWnd );
~RageSound(); ~RageSound();
float GetPlayLatency() { return m_info.latency / 1000.0f; }; float GetPlayLatency() { return m_info.latency / 1000.0f; }; // latency between when Play() is called and sound starts coming out
void PlayOnceStreamed( CString sPath ); void PlayOnceStreamed( CString sPath );
void PlayOnceStreamedFromDir( CString sDir );
private: private:
HWND m_hWndApp; // this is set on GRAPHICS_Create() HWND m_hWndApp; // this is set on GRAPHICS_Create()
+8 -5
View File
@@ -5,7 +5,7 @@
Desc: Abstract class for a texture with metadata. Desc: Abstract class for a texture with metadata.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -21,11 +21,14 @@
// RageTexture constructor // RageTexture constructor
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
RageTexture::RageTexture( RageTexture::RageTexture(
RageScreen* pScreen, RageDisplay* pScreen,
const CString &sFilePath, const CString &sFilePath,
const DWORD dwMaxSize, DWORD dwMaxSize,
const DWORD dwTextureColorDepth, DWORD dwTextureColorDepth,
const DWORD dwHints ) int iMipMaps,
int iAlphaBits,
bool bDither,
bool bStretch )
{ {
// LOG->WriteLine( "RageTexture::RageTexture()" ); // LOG->WriteLine( "RageTexture::RageTexture()" );
+18 -11
View File
@@ -5,7 +5,7 @@
Desc: Abstract class for a texture and holds metadata. Desc: Abstract class for a texture and holds metadata.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -13,7 +13,7 @@
#include "RageScreen.h" #include "RageDisplay.h"
#include <d3dx8.h> #include <d3dx8.h>
#include <assert.h> #include <assert.h>
//#include <d3d8types.h> //#include <d3d8types.h>
@@ -32,7 +32,6 @@ public:
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// RageTexture Class Declarations // RageTexture Class Declarations
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -40,17 +39,25 @@ class RageTexture
{ {
public: public:
RageTexture( RageTexture(
RageScreen* pScreen, RageDisplay* pScreen,
const CString &sFilePath, const CString &sFilePath,
const DWORD dwMaxSize, DWORD dwMaxSize = 2048,
const DWORD dwTextureColorDepth, DWORD dwTextureColorDepth = 16,
const DWORD dwHints ); int iMipMaps = 4,
int iAlphaBits = 4,
bool bDither = false,
bool bStretch = false
);
virtual ~RageTexture() = 0; virtual ~RageTexture() = 0;
virtual void Reload( virtual void Reload(
const DWORD dwMaxSize, DWORD dwMaxSize = 2048,
const DWORD dwTextureColorDepth, DWORD dwTextureColorDepth = 16,
const DWORD dwHints ) = 0; int iMipMaps = 4,
int iAlphaBits = 4,
bool bDither = false,
bool bStretch = false
) = 0;
virtual LPDIRECT3DTEXTURE8 GetD3DTexture() = 0; virtual LPDIRECT3DTEXTURE8 GetD3DTexture() = 0;
@@ -88,7 +95,7 @@ protected:
int m_iSourceWidth, m_iSourceHeight; // dimensions of the original image loaded from disk int m_iSourceWidth, m_iSourceHeight; // dimensions of the original image loaded from disk
int m_iTextureWidth, m_iTextureHeight; // dimensions of the texture in memory int m_iTextureWidth, m_iTextureHeight; // dimensions of the texture in memory
int m_iImageWidth, m_iImageHeight; // dimensions of the image in the texture int m_iImageWidth, m_iImageHeight; // dimensions of the image in the texture
D3DFORMAT m_TextureFormat; D3DFORMAT m_TextureFormat;
// The number of frames of animation in each row and column of this texture. // The number of frames of animation in each row and column of this texture.
int m_iFramesWide, m_iFramesHigh; int m_iFramesWide, m_iFramesHigh;
+12 -11
View File
@@ -1,11 +1,12 @@
#include "stdafx.h" #include "stdafx.h"
/* /*
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
File: RageTextureManager.cpp Class: RageTextureManager
Desc: Interface for loading and releasing textures. Desc: See header.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -20,12 +21,12 @@
#include "RageLog.h" #include "RageLog.h"
#include "ErrorCatcher/ErrorCatcher.h" #include "ErrorCatcher/ErrorCatcher.h"
RageTextureManager* TEXTURE = NULL; RageTextureManager* TEXTUREMAN = NULL;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// constructor/destructor // constructor/destructor
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
RageTextureManager::RageTextureManager( RageScreen* pScreen ) RageTextureManager::RageTextureManager( RageDisplay* pScreen )
{ {
assert( pScreen != NULL ); assert( pScreen != NULL );
m_pScreen = pScreen; m_pScreen = pScreen;
@@ -43,7 +44,7 @@ RageTextureManager::~RageTextureManager()
while( pos != NULL ) // iterate over all k/v pairs in map while( pos != NULL ) // iterate over all k/v pairs in map
{ {
m_mapPathToTexture.GetNextAssoc( pos, sPath, pTexture ); m_mapPathToTexture.GetNextAssoc( pos, sPath, pTexture );
LOG->WriteLine( "TEXTURE LEAK: '%s', RefCount = %d.", sPath, pTexture->m_iRefCount ); LOG->WriteLine( "TEXTUREMAN LEAK: '%s', RefCount = %d.", sPath, pTexture->m_iRefCount );
SAFE_DELETE( pTexture ); SAFE_DELETE( pTexture );
} }
@@ -54,7 +55,7 @@ RageTextureManager::~RageTextureManager()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Load/Unload textures from disk // Load/Unload textures from disk
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
RageTexture* RageTextureManager::LoadTexture( CString sTexturePath, const DWORD dwHints, const bool bForceReload ) RageTexture* RageTextureManager::LoadTexture( CString sTexturePath, bool bForceReload, int iMipMaps, int iAlphaBits, bool bDither, bool bStretch )
{ {
sTexturePath.MakeLower(); sTexturePath.MakeLower();
@@ -72,7 +73,7 @@ RageTexture* RageTextureManager::LoadTexture( CString sTexturePath, const DWORD
{ {
pTexture->m_iRefCount++; pTexture->m_iRefCount++;
if( bForceReload ) if( bForceReload )
pTexture->Reload( m_dwMaxTextureSize, m_dwTextureColorDepth, dwHints ); pTexture->Reload( m_dwMaxTextureSize, m_dwTextureColorDepth, iMipMaps, iAlphaBits, bDither );
LOG->WriteLine( "RageTextureManager: '%s' now has %d references.", sTexturePath, pTexture->m_iRefCount ); LOG->WriteLine( "RageTextureManager: '%s' now has %d references.", sTexturePath, pTexture->m_iRefCount );
} }
@@ -82,12 +83,12 @@ RageTexture* RageTextureManager::LoadTexture( CString sTexturePath, const DWORD
splitpath( false, sTexturePath, sDrive, sDir, sFName, sExt ); splitpath( false, sTexturePath, sDrive, sDir, sFName, sExt );
if( sExt == "avi" || sExt == "mpg" || sExt == "mpeg" ) if( sExt == "avi" || sExt == "mpg" || sExt == "mpeg" )
pTexture = (RageTexture*) new RageMovieTexture( m_pScreen, sTexturePath, m_dwMaxTextureSize, m_dwTextureColorDepth, dwHints ); pTexture = (RageTexture*) new RageMovieTexture( m_pScreen, sTexturePath, m_dwMaxTextureSize, m_dwTextureColorDepth, iMipMaps, iAlphaBits, bDither, bStretch );
else else
pTexture = (RageTexture*) new RageBitmapTexture( m_pScreen, sTexturePath, m_dwMaxTextureSize, m_dwTextureColorDepth, dwHints ); pTexture = (RageTexture*) new RageBitmapTexture( m_pScreen, sTexturePath, m_dwMaxTextureSize, m_dwTextureColorDepth, iMipMaps, iAlphaBits, bDither, bStretch );
LOG->WriteLine( "RageTextureManager: Finished loading '%s' - %d references.", sTexturePath ); LOG->WriteLine( "RageTextureManager: Finished loading '%s' - %d references.", sTexturePath, pTexture->m_iRefCount );
m_mapPathToTexture.SetAt( sTexturePath, pTexture ); m_mapPathToTexture.SetAt( sTexturePath, pTexture );
+8 -19
View File
@@ -1,24 +1,15 @@
#pragma once
/* /*
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
File: RageTextureManager.h Class: RageTextureManager
Desc: Interface for loading and releasing textures. Desc: Interface for loading and releasing textures.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
class RageTextureManager;
#ifndef _RAGETEXTUREMANAGER_H_
#define _RAGETEXTUREMANAGER_H_
#include "RageTexture.h" #include "RageTexture.h"
//#include <d3dx8.h>
//#include <d3d8types.h>
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -27,10 +18,10 @@ class RageTextureManager;
class RageTextureManager class RageTextureManager
{ {
public: public:
RageTextureManager( RageScreen* pScreen ); RageTextureManager( RageDisplay* pScreen );
~RageTextureManager(); ~RageTextureManager();
RageTexture* LoadTexture( CString sTexturePath, const DWORD dwHints = 0, const bool bForceReload = false ); RageTexture* LoadTexture( CString sTexturePath, bool bForceReload = false, int iMipMaps = 4, int iAlphaBits = 4, bool bDither = false, bool bStretch = false );
bool IsTextureLoaded( CString sTexturePath ); bool IsTextureLoaded( CString sTexturePath );
void UnloadTexture( CString sTexturePath ); void UnloadTexture( CString sTexturePath );
void ReloadAll(); void ReloadAll();
@@ -46,7 +37,7 @@ public:
DWORD GetTextureColorDepth() { return m_dwTextureColorDepth; }; DWORD GetTextureColorDepth() { return m_dwTextureColorDepth; };
protected: protected:
RageScreen* m_pScreen; RageDisplay* m_pScreen;
DWORD m_dwMaxTextureSize; DWORD m_dwMaxTextureSize;
DWORD m_dwTextureColorDepth; DWORD m_dwTextureColorDepth;
@@ -55,6 +46,4 @@ protected:
CTypedPtrMap<CMapStringToPtr, CString, RageTexture*> m_mapPathToTexture; CTypedPtrMap<CMapStringToPtr, CString, RageTexture*> m_mapPathToTexture;
}; };
extern RageTextureManager* TEXTURE; // global and accessable from anywhere in our program extern RageTextureManager* TEXTUREMAN; // global and accessable from anywhere in our program
#endif
+60 -2
View File
@@ -5,7 +5,7 @@
Desc: See header. Desc: See header.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
@@ -275,6 +275,49 @@ void GetDirListing( CString sPath, CStringArray &AddTo, bool bOnlyDirs )
::FindClose( hFind ); ::FindClose( hFind );
} }
ULONG GetHashForString( CString s )
{
ULONG hash = 0;
for( int i=0; i<s.GetLength(); i++ )
{
hash *= 10;
hash += (DWORD)s[i];
}
return hash;
}
ULONG GetHashForFile( CString sPath )
{
ULONG hash = 0;
hash += GetHashForString( sPath );
hash += GetFileSizeInBytes( sPath );
CFileStatus status;
if( CFile::GetStatus(sPath, status) )
hash += status.m_mtime.GetHour() * 3600 + status.m_mtime.GetMinute() * 60 + status.m_mtime.GetSecond();
return hash;
}
ULONG GetHashForDirectory( CString sDir )
{
ULONG hash = 0;
hash += GetHashForFile( sDir );
CStringArray arrayFiles;
GetDirListing( sDir+"\\*.*", arrayFiles, false );
for( int i=0; i<arrayFiles.GetSize(); i++ )
{
const CString sFilePath = sDir + arrayFiles[i];
hash += GetHashForFile( sFilePath );
}
return hash;
}
DWORD GetFileSizeInBytes( const CString &sFilePath ) DWORD GetFileSizeInBytes( const CString &sFilePath )
{ {
HANDLE hFile = CreateFile( HANDLE hFile = CreateFile(
@@ -290,7 +333,6 @@ DWORD GetFileSizeInBytes( const CString &sFilePath )
return GetFileSize( hFile, NULL ); return GetFileSize( hFile, NULL );
} }
bool DoesFileExist( const CString &sPath ) bool DoesFileExist( const CString &sPath )
{ {
//LOG->WriteLine( "DoesFileExist(%s)", sPath ); //LOG->WriteLine( "DoesFileExist(%s)", sPath );
@@ -376,4 +418,20 @@ HINSTANCE GotoURL(LPCTSTR url)
return result; return result;
} }
void WriteStringToFile( FILE* file, CString s )
{
if( s == "" )
s = "_";
fprintf( file, "%s\n", s );
}
void ReadStringFromFile( FILE* file, CString& s )
{
char szTemp[MAX_PATH];
fscanf( file, "%[^\n]\n", szTemp );
s = szTemp;
if( s == "_" )
s = "";
}
+9 -6
View File
@@ -1,18 +1,15 @@
#pragma once
/* /*
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
File: RageUtil File: RageUtil
Desc: Miscellaneous helper functions. Desc: Miscellaneous helper functions.
Copyright (c) 2001-2002 by the persons listed below. All rights reserved. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford Chris Danford
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
#ifndef _RAGEUTIL_H_
#define _RAGEUTIL_H_
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// SAFE_ Macros // SAFE_ Macros
@@ -27,6 +24,8 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#define RECTWIDTH(rect) ((rect).right - (rect).left) #define RECTWIDTH(rect) ((rect).right - (rect).left)
#define RECTHEIGHT(rect) ((rect).bottom - (rect).top) #define RECTHEIGHT(rect) ((rect).bottom - (rect).top)
inline int RECTCENTERX(RECT rect) { return rect.left + (rect.right-rect.left)/2; }
inline int RECTCENTERY(RECT rect) { return rect.top + (rect.bottom-rect.top)/2; }
#ifndef max #ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b)) #define max(a,b) (((a) > (b)) ? (a) : (b))
@@ -98,6 +97,9 @@ CString join(
); );
void GetDirListing( CString sPath, CStringArray &AddTo, bool bOnlyDirs=false ); void GetDirListing( CString sPath, CStringArray &AddTo, bool bOnlyDirs=false );
ULONG GetHashForString( CString s );
ULONG GetHashForFile( CString sPath );
ULONG GetHashForDirectory( CString sDir ); // a hash value that remains the same as long as nothing in the directory has changed
bool DoesFileExist( const CString &sPath ); bool DoesFileExist( const CString &sPath );
DWORD GetFileSizeInBytes( const CString &sFilePath ); DWORD GetFileSizeInBytes( const CString &sFilePath );
@@ -110,5 +112,6 @@ void SortCStringArray( CStringArray &AddTo, const bool bSortAcsending = true );
LONG GetRegKey(HKEY key, LPCTSTR subkey, LPTSTR retdata); LONG GetRegKey(HKEY key, LPCTSTR subkey, LPTSTR retdata);
HINSTANCE GotoURL(LPCTSTR url); HINSTANCE GotoURL(LPCTSTR url);
void WriteStringToFile( FILE* file, CString s );
void ReadStringFromFile( FILE* file, CString& s );
#endif

Some files were not shown because too many files have changed in this diff Show More