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
/*
-----------------------------------------------------------------------------
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 <math.h>
#include "RageScreen.h"
#include "RageDisplay.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;
@@ -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
SCREEN->Scale( m_temp_scale.x, m_temp_scale.y, 1 );
DISPLAY->Translate( m_temp_pos.x, m_temp_pos.y, m_temp_pos.z ); // offset so that pixels are aligned to texels
DISPLAY->Scale( m_temp_scale.x, m_temp_scale.y, 1 );
// super slow!
// 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...
if( m_temp_rotation.z != 0 )
{
SCREEN->RotateZ( m_temp_rotation.z );
DISPLAY->RotateZ( m_temp_rotation.z );
}
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.
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>
class Actor
{
protected:
public:
Actor();
@@ -48,8 +39,8 @@ public:
virtual void Restore() {};
virtual void Invalidate() {};
virtual void Draw();
virtual void RenderPrimitives() = 0;
virtual void Draw(); // set up the world matrix, then calls DrawPrimitives()
virtual void DrawPrimitives() = 0;
virtual void Update( float fDeltaTime );
virtual float GetX() { return m_pos.x; };
@@ -280,7 +271,3 @@ protected:
bool m_bBlendAdd;
};
#endif
+2 -2
View File
@@ -5,14 +5,14 @@
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"
void ActorFrame::RenderPrimitives()
void ActorFrame::DrawPrimitives()
{
// draw all sub-ActorFrames while we're in the ActorFrame's local coordinate space
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.
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); };
virtual void Update( float fDeltaTime );
virtual void RenderPrimitives();
virtual void DrawPrimitives();
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
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 "ArrowEffects.h"
#include "NoteMetadata.h"
#include "Notes.h"
#include "ColorNote.h"
#include "GameConstantsAndTypes.h"
#include "GameManager.h"
@@ -18,7 +18,7 @@
float ArrowGetYOffset( const PlayerOptions& po, float fStepIndex, float fSongBeat )
{
float fBeatsUntilStep = NoteIndexToBeat( fStepIndex ) - fSongBeat;
float fBeatsUntilStep = NoteRowToBeat( fStepIndex ) - fSongBeat;
float fYOffset = fBeatsUntilStep * ARROW_GAP;
switch( po.m_EffectType )
{
+1 -1
View File
@@ -4,7 +4,7 @@
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
-----------------------------------------------------------------------------
*/
+3 -3
View File
@@ -5,7 +5,7 @@
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.SetZoomY( 40 );
m_textBPM.Load( THEME->GetPathTo(FONT_BOLD) );
m_textBPM.Load( THEME->GetPathTo(FONT_HEADER1) );
m_textBPM.TurnShadowOff();
m_textBPM.SetXY( CENTER_X, SCREEN_HEIGHT - 50 );
//m_textBPM.SetSequence( ssprintf("999") );
@@ -35,7 +35,7 @@ BPMDisplay::BPMDisplay()
m_textBPM.SetDiffuseColorTopEdge( D3DXCOLOR(1,1,0,1) ); // yellow
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.SetXY( 34, 2 );
m_textLabel.SetText( "BPM" );
+3 -3
View File
@@ -4,7 +4,7 @@
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 "ActorFrame.h"
#include "BitmapText.h"
#include "RectangleActor.h"
#include "Quad.h"
class BPMDisplay : public ActorFrame
@@ -30,7 +30,7 @@ public:
protected:
BitmapText m_textBPM;
BitmapText m_textLabel;
RectangleActor m_rectFrame;
Quad m_rectFrame;
float m_fCurrentBPM;
float m_fLowBPM, m_fHighBPM;
+8 -8
View File
@@ -5,7 +5,7 @@
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.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_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) );
}
@@ -38,7 +38,7 @@ bool Background::LoadFromSong( Song* pSong, bool bDisableVisualizations )
if( pSong->HasBackgroundMovie() )
{
// 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.SetZoomY( -1 );
m_sprSongBackground.SetDiffuseColor( D3DXCOLOR(0,0,0,1) );
@@ -47,8 +47,8 @@ bool Background::LoadFromSong( Song* pSong, bool bDisableVisualizations )
else
{
// load the static background (if available), and a visualization
if( pSong->HasBackground() ) m_sprSongBackground.Load( pSong->GetBackgroundPath(), TEXTURE_HINT_DITHER );
else m_sprSongBackground.Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BACKGROUND), TEXTURE_HINT_DITHER );
if( pSong->HasBackground() ) m_sprSongBackground.Load( pSong->GetBackgroundPath(), false, 2, 0, true );
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.SetDiffuseColor( D3DXCOLOR(0,0,0,1) );
@@ -91,9 +91,9 @@ void Background::Update( float fDeltaTime )
m_sprDangerBackground.Update( fDeltaTime );
}
void Background::RenderPrimitives()
void Background::DrawPrimitives()
{
ActorFrame::RenderPrimitives();
ActorFrame::DrawPrimitives();
if( m_bShowDanger && (GetTickCount() % 1000) > 500 )
{
+2 -2
View File
@@ -4,7 +4,7 @@
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 void Update( float fDeltaTime );
virtual void RenderPrimitives();
virtual void DrawPrimitives();
virtual void SetDiffuseColor( D3DXCOLOR c )
{
+68 -5
View File
@@ -5,7 +5,7 @@
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 "ThemeManager.h"
#include "SongManager.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
{
TurnOffRoulette();
Sprite::TurnShadowOff();
if( pSong == NULL ) Banner::Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BANNER), TEXTURE_HINT_NOMIPMAPS );
else if( pSong->HasBanner() ) Banner::Load( pSong->GetBannerPath(), TEXTURE_HINT_NOMIPMAPS );
else if( pSong->HasBackground() ) Banner::Load( pSong->GetBackgroundPath(), TEXTURE_HINT_NOMIPMAPS );
else 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() );
else if( pSong->HasBackground() ) Banner::Load( pSong->GetBackgroundPath() );
else Banner::Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BANNER) );
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.
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
-----------------------------------------------------------------------------
*/
@@ -23,10 +23,27 @@ class Banner : public CroppedSprite
public:
Banner()
{
m_bScrolling = false;
m_fPercentScrolling = 0;
m_fCropWidth = BANNER_WIDTH;
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.
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
-----------------------------------------------------------------------------
*/
+1 -1
View File
@@ -5,7 +5,7 @@
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
-----------------------------------------------------------------------------
*/
+83 -131
View File
@@ -5,7 +5,7 @@
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
-----------------------------------------------------------------------------
*/
@@ -38,7 +38,6 @@ BitmapText::BitmapText()
m_iNumLines = 0;
m_iWidestLineWidth = 0;
m_iNumV = 0;
for( int i=0; i<MAX_TEXT_LINES; i++ )
{
@@ -128,35 +127,22 @@ void BitmapText::SetText( CString sText )
}
void BitmapText::RebuildVertexBuffer()
// draw text at x, y using colorTop blended down to colorBottom, with size multiplied by scale
void BitmapText::DrawPrimitives()
{
//LOG->WriteLine( "BitmapText::RebuildVertexBuffer()" );
if( m_iNumLines == 0 )
return;
RageTexture* pTexture = m_pFont->m_pTexture;
// make the object in logical units centered at the origin
LPDIRECT3DVERTEXBUFFER8 pVB = SCREEN->GetVertexBuffer();
//LPDIRECT3DVERTEXBUFFER8 pVB = m_pVB;
CUSTOMVERTEX* v;
LPDIRECT3DVERTEXBUFFER8 pVB = DISPLAY->GetVertexBuffer();
RAGEVERTEX* v;
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 iFrameWidth = pTexture->GetSourceFrameWidth(); // width of a character frame in logical units
@@ -205,21 +191,21 @@ void BitmapText::RebuildVertexBuffer()
const float fExtraPixels = fPercentExtra * pTexture->GetSourceFrameWidth();
// first triangle
v[m_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 ); // top left
v[iNumV++].p = D3DXVECTOR3( (float)iX, iY+iHeight/2.0f, 0 ); // bottom left
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
v[m_iNumV++].p = v[m_iNumV-1].p; // top right
v[m_iNumV++].p = v[m_iNumV-3].p; // bottom left
v[m_iNumV++].p = D3DXVECTOR3( iX+fExtraPixels, iY+iHeight/2.0f, 0 ); // bottom right
v[iNumV++].p = v[iNumV-1].p; // top right
v[iNumV++].p = v[iNumV-3].p; // bottom left
v[iNumV++].p = D3DXVECTOR3( iX+fExtraPixels, iY+iHeight/2.0f, 0 ); // bottom right
//
// set texture coordinates
//
m_iNumV -= 6;
iNumV -= 6;
FRECT frectTexCoords = *pTexture->GetTextureCoordRect( iFrameNo );
@@ -232,146 +218,112 @@ void BitmapText::RebuildVertexBuffer()
const float fExtraTexCoords = fPercentExtra * pTexture->GetTextureFrameWidth() / pTexture->GetTextureWidth();
v[m_iNumV++].t = D3DXVECTOR2( frectTexCoords.left, frectTexCoords.top ); // top left
v[m_iNumV++].t = D3DXVECTOR2( frectTexCoords.left, frectTexCoords.bottom ); // bottom left
v[m_iNumV++].t = D3DXVECTOR2( frectTexCoords.right + fExtraTexCoords, frectTexCoords.top ); // top right
v[m_iNumV++].t = v[m_iNumV-1].t; // top right
v[m_iNumV++].t = v[m_iNumV-3].t; // bottom left
v[m_iNumV++].t = D3DXVECTOR2( frectTexCoords.right + fExtraTexCoords, frectTexCoords.bottom ); // bottom right
v[iNumV++].t = D3DXVECTOR2( frectTexCoords.left, frectTexCoords.top ); // top left
v[iNumV++].t = D3DXVECTOR2( frectTexCoords.left, frectTexCoords.bottom ); // bottom left
v[iNumV++].t = D3DXVECTOR2( frectTexCoords.right + fExtraTexCoords, frectTexCoords.top ); // top right
v[iNumV++].t = v[iNumV-1].t; // top right
v[iNumV++].t = v[iNumV-3].t; // bottom left
v[iNumV++].t = D3DXVECTOR2( frectTexCoords.right + fExtraTexCoords, frectTexCoords.bottom ); // bottom right
}
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();
}
// 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...
LPDIRECT3DDEVICE8 pd3dDevice = SCREEN->GetDevice();
LPDIRECT3DDEVICE8 pd3dDevice = DISPLAY->GetDevice();
pd3dDevice->SetTexture( 0, pTexture->GetD3DTexture() );
pd3dDevice->SetRenderState( D3DRS_SRCBLEND, m_bBlendAdd ? D3DBLEND_ONE : D3DBLEND_SRCALPHA );
pd3dDevice->SetRenderState( D3DRS_DESTBLEND, m_bBlendAdd ? D3DBLEND_ONE : D3DBLEND_INVSRCALPHA );
pd3dDevice->SetVertexShader( D3DFVF_CUSTOMVERTEX );
pd3dDevice->SetStreamSource( 0, pVB, sizeof(CUSTOMVERTEX) );
pd3dDevice->SetVertexShader( D3DFVF_RAGEVERTEX );
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 )
{
//////////////////////
// render the shadow
//////////////////////
if( m_bShadow )
{
SCREEN->PushMatrix();
SCREEN->TranslateLocal( m_fShadowLength, m_fShadowLength, 0 ); // shift by 5 units
DISPLAY->PushMatrix();
DISPLAY->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++ )
v[i].color = D3DXCOLOR(0,0,0,0.5f*m_temp_colorDiffuse[0].a); // semi-transparent black
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_COLORARG1, D3DTA_TFACTOR );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
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->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
//////////////////////
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++ )
v[i].color = m_temp_colorAdd;
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_COLORARG1, D3DTA_TFACTOR );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
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->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
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
-----------------------------------------------------------------------------
*/
#ifndef _BITMAPTEXT_H_
#define _BITMAPTEXT_H_
#include "Sprite.h"
#include "Font.h"
@@ -34,8 +32,7 @@ public:
int GetWidestLineWidthInSourcePixels() { return m_iWidestLineWidth; };
void RebuildVertexBuffer(); // fill the RageScreen's vertex buffer with what we're going to draw
virtual void RenderPrimitives();
virtual void DrawPrimitives();
void TurnRainbowOn() { m_bRainbow = true; };
void TurnRainbowOff() { m_bRainbow = false; };
@@ -52,12 +49,6 @@ protected:
int m_iLineWidths[MAX_TEXT_LINES]; // 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;
};
#endif
+9 -7
View File
@@ -5,28 +5,29 @@
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 "ThemeManager.h"
const float COMBO_TWEEN_TIME = 0.5f;
Combo::Combo()
{
m_iCurCombo = 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.SetX( 40 );
m_sprCombo.SetZoom( 1.0f );
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_sprCombo.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); // invisible
@@ -60,8 +61,9 @@ void Combo::ContinueCombo()
m_textComboNumber.SetZoom( fNewZoom );
m_textComboNumber.SetX( -40 - (fNewZoom-1)*30 );
//m_textComboNumber.BeginTweening( COMBO_TWEEN_TIME );
//m_textComboNumber.SetTweenZoom( 1 );
//this->SetZoom( 1.2f );
//this->BeginTweening( 0.3f );
//this->SetTweenZoom( 1 );
}
}
+1 -1
View File
@@ -4,7 +4,7 @@
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.
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.
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;
};
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 );
return true;
+1 -1
View File
@@ -5,7 +5,7 @@
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.
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) );
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) );
SetFromDescription( pNoteMetadata->m_sDescription );
SetFromDescription( pNotes->m_sDescription );
}
else
{
+3 -3
View File
@@ -5,7 +5,7 @@
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 )
{
@@ -70,7 +70,7 @@ void FocusingSprite::RenderPrimitives()
m_sprites[1].SetXY( -m_fPercentBlurred*BLUR_DISTANCE*2, -m_fPercentBlurred*BLUR_DISTANCE );
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.
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 RenderPrimitives();
virtual void DrawPrimitives();
void StartFocusing();
void StartBlurring();
+3 -3
View File
@@ -5,7 +5,7 @@
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
-----------------------------------------------------------------------------
*/
@@ -59,7 +59,7 @@ Font::Font( const CString &sFontFilePath )
m_sTexturePath.MakeLower();
m_pTexture = TEXTURE->LoadTexture( m_sTexturePath, 0, false );
m_pTexture = TEXTUREMAN->LoadTexture( m_sTexturePath );
assert( m_pTexture != NULL );
@@ -139,7 +139,7 @@ Font::Font( const CString &sFontFilePath )
Font::~Font()
{
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.
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
-----------------------------------------------------------------------------
*/
+1 -1
View File
@@ -5,7 +5,7 @@
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.
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
-----------------------------------------------------------------------------
*/
+53 -1
View File
@@ -5,7 +5,7 @@
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.
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 "Song.h"
#include "BitmapText.h"
@@ -22,51 +19,10 @@
class FootMeter : public BitmapText
{
public:
FootMeter()
{
Load( THEME->GetPathTo(FONT_FEET) );
FootMeter();
SetNumFeet( 0, "" );
};
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, "" );
}
};
void SetFromNotes( Notes* pNotes );
private:
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) );
};
void SetNumFeet( int iNumFeet, const CString &sDescription );
};
#endif
+17 -5
View File
@@ -5,7 +5,7 @@
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
-----------------------------------------------------------------------------
*/
@@ -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_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 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
{
@@ -160,16 +168,20 @@ struct GameOptions
m_bIgnoreJoyAxes = false;
m_bShowFPS = true;
m_bUseRandomVis = false;
m_bSkipCaution = false;
m_bAnnouncer = true;
m_bShowCaution = true;
m_bShowSelectDifficulty = true;
m_bShowSelectGroup = true;
m_iNumArcadeStages = 3;
m_JudgementDifficulty = JUDGE_NORMAL;
};
bool m_bIgnoreJoyAxes;
bool m_bShowFPS;
bool m_bUseRandomVis;
bool m_bSkipCaution;
bool m_bAnnouncer;
bool m_bShowCaution;
bool m_bShowSelectDifficulty;
bool m_bShowSelectGroup;
int m_iNumArcadeStages;
enum JudgementDifficulty { JUDGE_EASY=0, JUDGE_NORMAL, JUDGE_HARD };
JudgementDifficulty m_JudgementDifficulty;
+27 -1
View File
@@ -5,7 +5,7 @@
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
-----------------------------------------------------------------------------
*/
@@ -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 );
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").
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 "NoteMetadata.h"
#include "Notes.h"
#include "NoteData.h"
#include "GameInput.h"
#include "GameConstantsAndTypes.h"
@@ -64,6 +64,7 @@ public:
return false;
}
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 );
+1 -1
View File
@@ -5,7 +5,7 @@
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
-----------------------------------------------------------------------------
*/
+10 -1
View File
@@ -5,7 +5,7 @@
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
-----------------------------------------------------------------------------
*/
@@ -166,3 +166,12 @@ bool GameManager::IsPlayerEnabled( PlayerNumber PlayerNo )
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")
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
-----------------------------------------------------------------------------
*/
@@ -49,6 +49,7 @@ public:
InstrumentButton b = gi.button;
return GetCurrentGameDef()->GetPathToGraphic( m_sCurrentSkin[p], b, gbg );
}
void GetTweenColors( const PlayerNumber p, const ColumnNumber col, CArray<D3DXCOLOR,D3DXCOLOR> &aTweenColorsAddTo );
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_MISS: ASSERT( false ); break;
}
SetZoom( 1.0f );
BeginTweening( 0.3f );
SetTweenZoom( 1.5f );
SetZoom( 1.1f );
BeginTweening( 0.30f );
SetTweenZoom( 1.7f );
D3DXCOLOR colorTween = GetDiffuseColor();
colorTween.a = 0;
SetTweenDiffuseColor( colorTween );
+1 -1
View File
@@ -16,7 +16,7 @@ class GhostArrow;
#include "Sprite.h"
#include "NoteMetadata.h"
#include "Notes.h"
class GhostArrow : public Sprite
+1 -1
View File
@@ -38,7 +38,7 @@ void GhostArrowBright::Step( TapNoteScore score )
case TNS_MISS: ASSERT( false ); break;
}
SetState( 0 );
SetZoom( 1.2f );
SetZoom( 1.3f );
BeginTweening( 0.35f );
SetTweenZoom( 2.5f );
D3DXCOLOR colorTween = GetDiffuseColor();
+1 -1
View File
@@ -16,7 +16,7 @@ class GhostArrowBright;
#include "Sprite.h"
#include "NoteMetadata.h"
#include "Notes.h"
class GhostArrowBright : public Sprite
+2 -2
View File
@@ -5,7 +5,7 @@
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++ )
{
+2 -2
View File
@@ -5,7 +5,7 @@
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
-----------------------------------------------------------------------------
*/
@@ -24,7 +24,7 @@ class GhostArrowRow : public ActorFrame
public:
GhostArrowRow();
void Update( float fDeltaTime, float fSongBeat );
virtual void RenderPrimitives();
virtual void DrawPrimitives();
void Load( PlayerOptions po );
+1 -1
View File
@@ -5,7 +5,7 @@
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
-----------------------------------------------------------------------------
*/
+1 -1
View File
@@ -4,7 +4,7 @@
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
-----------------------------------------------------------------------------
*/
+15 -5
View File
@@ -5,7 +5,7 @@
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;
// SetGrade( GRADE_NO_DATA );
SetGrade( GRADE_NO_DATA );
}
void GradeDisplay::Update( float fDeltaTime )
@@ -47,11 +47,21 @@ void GradeDisplay::Update( float fDeltaTime )
this->SetCustomTextureRect( frectCurrentTextureCoords );
}
void GradeDisplay::DrawPrimitives()
{
if( m_Grade == GRADE_NO_DATA )
return;
Sprite::DrawPrimitives();
}
void GradeDisplay::SetGrade( Grade g )
{
// StopUsingCustomCoords();
m_Grade = g;
// SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
StopUsingCustomCoords();
SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
switch( g )
{
@@ -62,7 +72,7 @@ void GradeDisplay::SetGrade( Grade g )
case GRADE_C: SetState(4); break;
case GRADE_D: SetState(5); 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 );
}
};
+4 -1
View File
@@ -5,7 +5,7 @@
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();
virtual void Update( float fDeltaTime );
virtual void DrawPrimitives();
void SetGrade( Grade g );
void SpinAndSettleOn( Grade g );
protected:
Grade m_Grade;
// for scrolling
void ScrollToVirtualFrame( int iFrameNo ); // a virtual frame is a tiled state number
FRECT m_frectStartTexCoords;
+1 -1
View File
@@ -5,7 +5,7 @@
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
Chris Danford
-----------------------------------------------------------------------------
+2 -2
View File
@@ -4,7 +4,7 @@
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
Chris Danford
-----------------------------------------------------------------------------
@@ -16,7 +16,7 @@
#include "Sprite.h"
#include "NoteMetadata.h"
#include "Notes.h"
class GrayArrow : public Sprite
{
+2 -2
View File
@@ -5,7 +5,7 @@
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
-----------------------------------------------------------------------------
*/
@@ -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++ )
{
+2 -2
View File
@@ -4,7 +4,7 @@
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
-----------------------------------------------------------------------------
*/
@@ -26,7 +26,7 @@ class GrayArrowRow : public ActorFrame
public:
GrayArrowRow();
virtual void Update( float fDeltaTime, float fSongBeat );
virtual void RenderPrimitives();
virtual void DrawPrimitives();
void Load( PlayerOptions po );
+56 -19
View File
@@ -5,7 +5,7 @@
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,15 +20,13 @@
float RADAR_VALUE_ROTATION( int iValueIndex ) { return D3DX_PI/2 + D3DX_PI*2 / 5.0f * iValueIndex; }
GrooveRadar::GrooveRadar()
{
m_sprRadarBase.Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_RADAR_BASE) );
this->AddActor( &m_sprRadarBase );
this->AddActor( &m_GrooveRadarValueMap );
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);
float fX = cosf(fRotation) * fRadius;
@@ -52,6 +50,45 @@ GrooveRadar::GrooveRadar()
m_sprRadarLabels[c].SetXY( fX, fY );
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++ )
{
@@ -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++ )
{
const float fValueCurrent = m_fValuesOld[p][c] * (1-m_PercentTowardNew[p]) + m_fValuesNew[p][c] * m_PercentTowardNew[p];
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
@@ -84,13 +121,13 @@ void GrooveRadar::SetFromNoteMetadata( PlayerNumber p, NoteMetadata* pNoteMetada
m_bValuesVisible[p] = true;
}
else // pNoteMetadata == NULL
else // pNotes == NULL
{
m_bValuesVisible[p] = false;
}
}
void GrooveRadar::Update( float fDeltaTime )
void GrooveRadar::GrooveRadarValueMap::Update( float 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
const float fRadius = m_sprRadarBase.GetZoomedHeight()/2.0f;
LPDIRECT3DVERTEXBUFFER8 pVB = SCREEN->GetVertexBuffer();
LPDIRECT3DDEVICE8 pd3dDevice = SCREEN->GetDevice();
LPDIRECT3DVERTEXBUFFER8 pVB = DISPLAY->GetVertexBuffer();
LPDIRECT3DDEVICE8 pd3dDevice = DISPLAY->GetDevice();
pd3dDevice->SetTexture( 0, NULL );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
@@ -115,7 +152,7 @@ void GrooveRadar::RenderPrimitives()
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
CUSTOMVERTEX* v;
RAGEVERTEX* v;
for( int p=0; p<NUM_PLAYERS; p++ )
{
@@ -138,7 +175,7 @@ void GrooveRadar::RenderPrimitives()
{
const int c = i%NUM_RADAR_CATEGORIES;
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 fX = cosf(fRotation) * fDistFromCenter;
const float fY = -sinf(fRotation) * fDistFromCenter;
@@ -161,7 +198,7 @@ void GrooveRadar::RenderPrimitives()
{
const int c = i%NUM_RADAR_CATEGORIES;
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 fDistFromCenterOutter = fDistFromCenter+2;
const float fRotation = RADAR_VALUE_ROTATION(i);
@@ -184,7 +221,7 @@ void GrooveRadar::RenderPrimitives()
}
void GrooveRadar::TweenOnScreen()
void GrooveRadar::GrooveRadarValueMap::TweenOnScreen()
{
SetZoom( 0.5f );
SetRotation( D3DX_PI*4 );
@@ -193,7 +230,7 @@ void GrooveRadar::TweenOnScreen()
SetTweenRotationZ( 0 );
}
void GrooveRadar::TweenOffScreen()
void GrooveRadar::GrooveRadarValueMap::TweenOffScreen()
{
BeginTweening( 0.6f );
SetTweenRotationZ( D3DX_PI*4 );
+27 -10
View File
@@ -5,7 +5,7 @@
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
-----------------------------------------------------------------------------
*/
@@ -22,21 +22,38 @@ class GrooveRadar : public ActorFrame
public:
GrooveRadar();
virtual void Update( float fDeltaTime );
virtual void RenderPrimitives();
void SetFromNoteMetadata( PlayerNumber p, NoteMetadata* pNoteMetadata ); // NULL means no Song
void SetFromNotes( PlayerNumber p, Notes* pNotes ) // NULL means no Song
{
m_GrooveRadarValueMap.SetFromNotes( p, pNotes );
}
void TweenOnScreen();
void TweenOffScreen();
protected:
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];
// the value map must be a separate Actor so we can tween it separately from the labels
class GrooveRadarValueMap : public ActorFrame
{
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];
};
+1 -1
View File
@@ -16,7 +16,7 @@ class HoldGhostArrow;
#include "Sprite.h"
#include "NoteMetadata.h"
#include "Notes.h"
class HoldGhostArrow : public Sprite
+4 -4
View File
@@ -5,7 +5,7 @@
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()
{
m_fDisplayCountdown = 0;
m_sprJudgement.Load( THEME->GetPathTo(GRAPHIC_JUDGEMENT) );
m_sprJudgement.Load( THEME->GetPathTo(GRAPHIC_GAMEPLAY_JUDGEMENT) );
m_sprJudgement.StopAnimating();
this->AddActor( &m_sprJudgement );
}
@@ -35,11 +35,11 @@ void HoldJudgement::Update( float fDeltaTime )
m_fDisplayCountdown = 0;
}
void HoldJudgement::RenderPrimitives()
void HoldJudgement::DrawPrimitives()
{
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.
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();
void SetHoldJudgement( HoldNoteResult result );
virtual void Update( float fDeltaTime );
virtual void RenderPrimitives();
virtual void DrawPrimitives();
protected:
Sprite m_sprJudgement;
+1 -1
View File
@@ -4,7 +4,7 @@
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.
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.
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
-----------------------------------------------------------------------------
*/
@@ -16,13 +16,13 @@
#include "RageInput.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 )
{
INPUTM->Update();
INPUTMAN->Update();
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);
if( INPUTM->WasBeingPressed(di) )
if( INPUTMAN->WasBeingPressed(di) )
{
if( INPUTM->IsBeingPressed(di) )
if( INPUTMAN->IsBeingPressed(di) )
{
const float fOldHoldTime = m_fTimeHeld[d][b];
m_fTimeHeld[d][b] += fDeltaTime;
@@ -72,14 +72,14 @@ void InputFilter::GetInputEvents( InputEventArray &array, float fDeltaTime )
array.Add( InputEvent(di,iet) );
}
}
else // !INPUTM->IsBeingPressed(di)
else // !INPUTMAN->IsBeingPressed(di)
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) );
else // !INPUTM->IsBeingPressed(di)
else // !INPUTMAN->IsBeingPressed(di)
; // don't care
}
}
+2 -2
View File
@@ -7,7 +7,7 @@
represent when a button is first pressed, when a button is released,
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
-----------------------------------------------------------------------------
*/
@@ -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.
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
-----------------------------------------------------------------------------
*/
@@ -15,7 +15,7 @@
#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()
@@ -200,7 +200,7 @@ const HardCodedMenuKey g_HardCodedMenuKeys[] =
{ DEVICE_KEYBOARD, DIK_DOWN, PLAYER_1, MENU_BUTTON_DOWN },
{ DEVICE_KEYBOARD, DIK_LEFT, PLAYER_1, MENU_BUTTON_LEFT },
{ 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 },
};
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( INPUTM->IsBeingPressed( DeviceI ) )
if( INPUTMAN->IsBeingPressed( DeviceI ) )
return true;
}
}
+2 -2
View File
@@ -7,7 +7,7 @@
also has temporary holders for information that passed between windows - e.g.
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
-----------------------------------------------------------------------------
*/
@@ -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.
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"
const float JUDGEMENT_DISPLAY_TIME = 0.6f;
const float JUDGEMENT_DISPLAY_TIME = 0.8f;
Judgement::Judgement()
{
m_fDisplayCountdown = 0;
m_sprJudgement.Load( THEME->GetPathTo(GRAPHIC_JUDGEMENT) );
m_sprJudgement.Load( THEME->GetPathTo(GRAPHIC_GAMEPLAY_JUDGEMENT) );
m_sprJudgement.StopAnimating();
m_sprJudgement.TurnShadowOn();
this->AddActor( &m_sprJudgement );
}
@@ -35,11 +36,11 @@ void Judgement::Update( float fDeltaTime )
m_fDisplayCountdown = 0;
}
void Judgement::RenderPrimitives()
void Judgement::DrawPrimitives()
{
if( m_fDisplayCountdown > 0 )
{
ActorFrame::RenderPrimitives();
ActorFrame::DrawPrimitives();
}
}
@@ -60,19 +61,40 @@ void Judgement::SetJudgement( TapNoteScore score )
m_fDisplayCountdown = JUDGEMENT_DISPLAY_TIME;
m_sprJudgement.SetEffectNone();
if( score == TNS_MISS )
{
// falling down
m_sprJudgement.SetY( -30 );
m_sprJudgement.SetZoom( 1.0f );
m_sprJudgement.SetY( -20 );
//m_sprJudgement.SetZoom( 1.0f );
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
{
// zooming out
m_sprJudgement.SetZoom( 1.35f );
m_sprJudgement.BeginTweening( JUDGEMENT_DISPLAY_TIME/5.0f );
m_sprJudgement.SetTweenZoom( 1.0f );
float fMagnitudeX, fMagnitudeY;
switch( score )
{
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.
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();
void SetJudgement( TapNoteScore score );
virtual void Update( float fDeltaTime );
virtual void RenderPrimitives();
virtual void DrawPrimitives();
protected:
Sprite m_sprJudgement;
+10 -14
View File
@@ -5,7 +5,7 @@
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,11 +20,6 @@ const float SECTION_WIDTH = 1.0f/NUM_SECTIONS;
LifeMeterBar::LifeMeterBar()
{
}
void LifeMeterBar::SetPlayerOptions(const PlayerOptions& po) {
m_po = po;
//m_fLifePercentage = m_po.m_fInitialLifePercentage;
m_fLifePercentage = 0.5f;
m_fTrailingLifePercentage = 0;
m_fLifeVelocity = 0;
@@ -55,7 +50,7 @@ void LifeMeterBar::Update( float 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;
@@ -84,19 +79,20 @@ const D3DXCOLOR COLOR_FULL_2 = D3DXCOLOR(1,1,0,1);
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 )
return COLOR_FULL_1 * fPercentColor1 + COLOR_FULL_2 * (1-fPercentColor1);
else
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
LPDIRECT3DVERTEXBUFFER8 pVB = SCREEN->GetVertexBuffer();
CUSTOMVERTEX* v;
LPDIRECT3DVERTEXBUFFER8 pVB = DISPLAY->GetVertexBuffer();
RAGEVERTEX* v;
pVB->Lock( 0, 0, (BYTE**)&v, 0 );
int iNumV = 0;
@@ -175,7 +171,7 @@ void LifeMeterBar::RenderPrimitives()
pVB->Unlock();
LPDIRECT3DDEVICE8 pd3dDevice = SCREEN->GetDevice();
LPDIRECT3DDEVICE8 pd3dDevice = DISPLAY->GetDevice();
pd3dDevice->SetTexture( 0, NULL );
@@ -191,8 +187,8 @@ void LifeMeterBar::RenderPrimitives()
// finally! Pump those triangles!
pd3dDevice->SetVertexShader( D3DFVF_CUSTOMVERTEX );
pd3dDevice->SetStreamSource( 0, pVB, sizeof(CUSTOMVERTEX) );
pd3dDevice->SetVertexShader( D3DFVF_RAGEVERTEX );
pd3dDevice->SetStreamSource( 0, pVB, sizeof(RAGEVERTEX) );
pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, iNumV-2 );
}
+7 -14
View File
@@ -5,38 +5,31 @@
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
-----------------------------------------------------------------------------
*/
#include "ActorFrame.h"
#include "LifeMeter.h"
#include "Sprite.h"
#include "ScoreDisplayRolling.h"
#include "Quad.h"
class LifeMeterBar : public ActorFrame
class LifeMeterBar : public LifeMeter
{
public:
LifeMeterBar();
void SetPlayerOptions(const PlayerOptions& po);
virtual void Update( float fDeltaTime );
virtual void RenderPrimitives();
virtual void DrawPrimitives();
void SetBeat( float fSongBeat ) { m_fSongBeat = fSongBeat; };
void ChangeLife( TapNoteScore score );
float GetLifePercentage();
virtual void ChangeLife( TapNoteScore score );
virtual float GetLifePercentage();
private:
D3DXCOLOR GetColor( float fPercentIntoSection );
float m_fSongBeat;
float m_fLifePercentage;
float m_fTrailingLifePercentage; // this 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
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 "RageUtil.h"
#include "RageMusic.h"
#include "WindowManager.h"
#include "WindowDancing.h"
#include "ScreenManager.h"
#include "ScreenGameplay.h"
#include "GameConstantsAndTypes.h"
#include "ThemeManager.h"
#include "RageLog.h"
@@ -80,7 +81,7 @@ void MenuElements::TweenTopEdgeOnScreen()
m_textHelp.BeginTweening( MENU_ELEMENTS_TWEEN_TIME );
m_textHelp.SetTweenZoomY( fOriginalZoomY );
m_soundSwoosh.PlayRandom();
m_soundSwoosh.Play();
}
void MenuElements::TweenTopEdgeOffScreen()
@@ -92,7 +93,7 @@ void MenuElements::TweenTopEdgeOffScreen()
m_textHelp.BeginTweening( MENU_ELEMENTS_TWEEN_TIME );
m_textHelp.SetTweenZoomY( 0 );
m_soundSwoosh.PlayRandom();
m_soundSwoosh.Play();
}
void MenuElements::TweenBackgroundOnScreen()
@@ -106,7 +107,7 @@ void MenuElements::TweenBackgroundOnScreen()
m_sprBG.BeginTweening( MENU_ELEMENTS_TWEEN_TIME );
m_sprBG.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,1) );
m_soundSwoosh.PlayRandom();
m_soundSwoosh.Play();
}
void MenuElements::TweenBackgroundOffScreen()
@@ -118,7 +119,7 @@ void MenuElements::TweenBackgroundOffScreen()
m_sprBG.BeginTweening( MENU_ELEMENTS_TWEEN_TIME );
m_sprBG.SetTweenDiffuseColor( D3DXCOLOR(0,0,0,1) );
m_soundBack.PlayRandom();
m_soundBack.Play();
}
void MenuElements::TweenAllOnScreen()
@@ -154,7 +155,7 @@ void MenuElements::SetTopEdgeOffScreen()
}
void MenuElements::RenderPrimitives()
void MenuElements::DrawPrimitives()
{
// do nothing. Call DrawBottomLayer() and DrawTopLayer() instead.
}
+6 -6
View File
@@ -2,9 +2,9 @@
-----------------------------------------------------------------------------
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_
@@ -12,7 +12,7 @@
#include "Window.h"
#include "Screen.h"
#include "Sprite.h"
#include "BitmapText.h"
#include "RandomSample.h"
@@ -27,7 +27,7 @@ class MenuElements : public ActorFrame
public:
MenuElements();
virtual void RenderPrimitives();
virtual void DrawPrimitives();
void Load( CString sBackgroundPath, CString sTopEdgePath, CString sHelpText );
@@ -56,8 +56,8 @@ protected:
Sprite m_sprBottomEdge;
BitmapText m_textHelp;
RandomSample m_soundSwoosh;
RandomSample m_soundBack;
RageSoundSample m_soundSwoosh;
RageSoundSample m_soundBack;
};
+2 -2
View File
@@ -6,7 +6,7 @@
Desc: An input event specific to a menu navigation. This is generated based
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
-----------------------------------------------------------------------------
*/
@@ -19,7 +19,7 @@ enum MenuButton
MENU_BUTTON_RIGHT,
MENU_BUTTON_UP,
MENU_BUTTON_DOWN,
MENU_BUTTON_NEXT,
MENU_BUTTON_START,
MENU_BUTTON_BACK,
NUM_MENU_BUTTONS, // leave this at the end
MENU_BUTTON_NONE
+1 -1
View File
@@ -5,7 +5,7 @@
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.
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 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 GetY() { return m_sprites[0].GetY(); };
+1 -1
View File
@@ -5,7 +5,7 @@
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.
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.
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.
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 )
{
@@ -88,7 +88,7 @@ public:
break;
}
Sprite::RenderPrimitives();
Sprite::DrawPrimitives();
}
protected:
+132 -86
View File
@@ -5,7 +5,7 @@
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
-----------------------------------------------------------------------------
*/
@@ -16,13 +16,12 @@
#include "GameManager.h"
#include "ThemeManager.h"
#include "RageMusic.h"
#include "WindowManager.h" // for sending SM_PlayMusicSample
#include "ScreenManager.h" // for sending SM_PlayMusicSample
#include "RageLog.h"
#include "GameConstantsAndTypes.h"
const float SWITCH_MUSIC_TIME = 0.3f;
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 SCORE_X = 86;
const float SCORE_Y[NUM_PLAYERS] = { -34, 34 };
const float SCORE_X = 58;
const float SCORE_Y[NUM_PLAYERS] = { -40, 40 };
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()
@@ -46,41 +65,43 @@ WheelItemData::WheelItemData()
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_sSectionName = sSectionName;
}
void WheelItemData::LoadFromSong( Song* pSong )
{
ASSERT( pSong != NULL );
m_WheelItemType = wit;
m_pSong = pSong;
m_WheelItemType = TYPE_SONG;
m_sSectionName = sSectionName;
m_color = color;
}
WheelItemDisplay::WheelItemDisplay()
{
m_MusicStatusDisplay.SetXY( -136, 0 );
m_Banner.SetHorizAlign( align_left );
m_Banner.SetXY( -30, 0 );
m_TextBanner.SetHorizAlign( align_left );
m_TextBanner.SetXY( -30, 0 );
m_sprSongBar.Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_SONG_BAR) );
m_sprSongBar.SetXY( 0, 0 );
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.SetHorizAlign( align_left );
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.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++ )
{
@@ -100,6 +121,7 @@ void WheelItemDisplay::LoadFromWheelItemData( WheelItemData* pWID )
m_WheelItemType = pWID->m_WheelItemType;
m_sSectionName = pWID->m_sSectionName;
m_pSong = pWID->m_pSong;
m_color = pWID->m_color;
m_MusicStatusDisplayType = pWID->m_MusicStatusDisplayType;
@@ -109,35 +131,34 @@ void WheelItemDisplay::LoadFromWheelItemData( WheelItemData* pWID )
case TYPE_SECTION:
{
CString sDisplayName = SONG->ShortenGroupName(m_sSectionName);
if( sDisplayName.GetLength() <= 4 )
m_textSectionName.SetZoom( 2 );
else
m_textSectionName.SetZoom( 1 );
CString sDisplayName = SONGMAN->ShortenGroupName(m_sSectionName);
m_textSectionName.SetZoom( 1 );
m_textSectionName.SetText( sDisplayName );
m_textSectionName.SetDiffuseColor( COLOR_SECTION_LETTERS );
m_textSectionName.SetDiffuseColor( m_color );
m_textSectionName.TurnRainbowOff();
float fTextWidth, fSpriteWidth;
fTextWidth = m_textSectionName.GetWidestLineWidthInSourcePixels() * m_textSectionName.GetZoom();
fSpriteWidth = m_sprSectionBar.GetUnzoomedWidth() * m_sprSectionBar.GetZoom() - 20;
if( fTextWidth > fSpriteWidth )
m_textSectionName.SetZoomX( m_textSectionName.GetZoom() * fSpriteWidth / fTextWidth );
m_sprSectionBar.SetDiffuseColor( SONG->GetGroupColor( m_pSong->GetGroupName() ) );
float fSourcePixelWidth = (float)m_textSectionName.GetWidestLineWidthInSourcePixels();
float fMaxTextWidth = 200;
if( fSourcePixelWidth > fMaxTextWidth )
m_textSectionName.SetZoomX( fMaxTextWidth / fSourcePixelWidth );
}
break;
case TYPE_SONG:
{
m_Banner.LoadFromSong( m_pSong );
D3DXCOLOR color = SONG->GetGroupColor( m_pSong->GetGroupName() );
m_TextBanner.LoadFromSong( m_pSong );
D3DXCOLOR color = m_color;
color.r += 0.15f;
color.g += 0.15f;
color.b += 0.15f;
m_Banner.SetDiffuseColor( color );
m_TextBanner.SetDiffuseColor( color );
m_MusicStatusDisplay.SetType( m_MusicStatusDisplayType );
RefreshGrades();
}
break;
case TYPE_ROULETTE:
{
}
break;
default:
ASSERT( false ); // invalid type
}
@@ -147,17 +168,22 @@ void WheelItemDisplay::RefreshGrades()
{
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 );
m_GradeDisplay[p].SetGrade( grade );
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_textSectionName.Update( fDeltaTime );
break;
case TYPE_ROULETTE:
m_sprSectionBar.Update( fDeltaTime );
m_textRoulette.Update( fDeltaTime );
break;
case TYPE_SONG:
m_sprSongBar.Update( fDeltaTime );
m_MusicStatusDisplay.Update( fDeltaTime );
m_Banner.Update( fDeltaTime );
m_TextBanner.Update( fDeltaTime );
for( int p=0; p<NUM_PLAYERS; p++ )
m_GradeDisplay[p].Update( fDeltaTime );
break;
}
}
void WheelItemDisplay::RenderPrimitives()
void WheelItemDisplay::DrawPrimitives()
{
switch( m_WheelItemType )
{
@@ -188,10 +218,14 @@ void WheelItemDisplay::RenderPrimitives()
m_sprSectionBar.Draw();
m_textSectionName.Draw();
break;
case TYPE_ROULETTE:
m_sprSectionBar.Draw();
m_textRoulette.Draw();
break;
case TYPE_SONG:
m_sprSongBar.Draw();
m_MusicStatusDisplay.Draw();
m_Banner.Draw();
m_TextBanner.Draw();
for( int p=0; p<NUM_PLAYERS; p++ )
m_GradeDisplay[p].Draw();
break;
@@ -210,8 +244,8 @@ MusicWheel::MusicWheel()
m_sprHighScoreFrame[p].SetXY( SCORE_X, SCORE_Y[p] );
this->AddActor( &m_sprHighScoreFrame[p] );
m_HighScore[p].SetXY( SCORE_X-12, SCORE_Y[p]*0.97f );
m_HighScore[p].SetZoom( 0.5f );
m_HighScore[p].SetXY( SCORE_X, SCORE_Y[p]*0.97f );
m_HighScore[p].SetZoom( 0.6f );
this->AddActor( &m_HighScore[p] );
}
@@ -220,8 +254,8 @@ MusicWheel::MusicWheel()
m_sprSelectionOverlay.Load( THEME->GetPathTo(GRAPHIC_SELECT_MUSIC_SONG_HIGHLIGHT) );
m_sprSelectionOverlay.SetXY( 0, 0 );
m_sprSelectionOverlay.SetDiffuseColor( D3DXCOLOR(1,1,1,0.3f) );
m_sprSelectionOverlay.SetEffectGlowing( 1.0f, D3DXCOLOR(1,1,1,0.2f), D3DXCOLOR(1,1,1,0.8f) );
m_sprSelectionOverlay.SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
m_sprSelectionOverlay.SetEffectGlowing( 1.0f, D3DXCOLOR(1,1,1,0.4f), D3DXCOLOR(1,1,1,1) );
this->AddActor( &m_sprSelectionOverlay );
m_MusicSortDisplay.SetXY( SORT_ICON_ON_SCREEN_X, SORT_ICON_ON_SCREEN_Y );
@@ -240,7 +274,7 @@ MusicWheel::MusicWheel()
// init m_mapGroupNameToBannerColor
CArray<Song*, Song*> arraySongs;
arraySongs.Copy( SONG->m_pSongs );
arraySongs.Copy( SONGMAN->m_pSongs );
SortSongPointerArrayByGroup( arraySongs );
@@ -265,23 +299,23 @@ MusicWheel::MusicWheel()
BuildWheelItemDatas( m_WheelItemDatas[so], SongSortOrder(so) );
// select a song if none are selected
if( SONG->m_pCurSong == NULL && // if there is no currently selected song
SONG->m_pSongs.GetSize() > 0 ) // and there is at least one song
if( SONGMAN->m_pCurSong == NULL && // if there is no currently selected song
SONGMAN->m_pSongs.GetSize() > 0 ) // and there is at least one song
{
CArray<Song*, Song*> arraySongs;
SONG->GetSongsInGroup( SONG->m_sPreferredGroup, arraySongs );
SONGMAN->GetSongsInGroup( SONGMAN->m_sPreferredGroup, arraySongs );
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)
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_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;
// copy only song that have at least one NoteMetadata for the current GameMode
for( i=0; i<SONG->m_pSongs.GetSize(); i++ )
// copy only song that have at least one Notes for the current GameMode
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;
pSong->GetNoteMetadatasThatMatchGameAndStyle( GAME->m_sCurrentGame, GAME->m_sCurrentStyle, arraySteps );
CArray<Notes*, Notes*> arraySteps;
pSong->GetNotessThatMatchGameAndStyle( GAME->m_sCurrentGame, GAME->m_sCurrentStyle, arraySteps );
if( arraySteps.GetSize() > 0 )
arraySongs.Add( pSong );
}
// sort the SONG
// sort the SONGMAN
switch( so )
{
case SORT_GROUP:
@@ -358,9 +392,8 @@ void MusicWheel::BuildWheelItemDatas( CArray<WheelItemData, WheelItemData&> &arr
{
case SORT_MOST_PLAYED: 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_ARTIST:
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
CString sLastSection = "";
D3DXCOLOR colorSection;
int iCurWheelItem = 0;
for( int i=0; i< arraySongs.GetSize(); i++ )
{
Song* pSong = arraySongs[i];
CString sThisSection = GetSectionNameFromSongAndSort( pSong, so );
int iSectionColorIndex = 0;
if( sThisSection != sLastSection ) // new section, make a section item
{
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;
}
WheelItemData &WID = arrayWheelItemDatas[iCurWheelItem++];
WID.LoadFromSong( pSong );
WID.m_sSectionName = sThisSection;
WID.Load( TYPE_SONG, pSong, sThisSection, SONGMAN->GetGroupColor(pSong->GetGroupName()) );
}
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];
WheelItemData &WID = arrayWheelItemDatas[i];
WID.LoadFromSong( pSong );
WID.m_sSectionName = "";
WID.Load( TYPE_SONG, pSong, "", SONGMAN->GetGroupColor(pSong->GetGroupName()) );
}
}
}
@@ -408,8 +443,7 @@ void MusicWheel::BuildWheelItemDatas( CArray<WheelItemData, WheelItemData&> &arr
Song* pSong = arrayWheelItemDatas[i].m_pSong;
if( pSong != NULL )
{
MusicStatusDisplayType crown = (pSong->GetNumTimesPlayed()==0) ? TYPE_NEW : TYPE_NONE;
arrayWheelItemDatas[i].m_MusicStatusDisplayType = crown;
arrayWheelItemDatas[i].m_MusicStatusDisplayType = (pSong->GetNumTimesPlayed()==0) ? TYPE_NEW : TYPE_NONE;
}
}
@@ -418,8 +452,7 @@ void MusicWheel::BuildWheelItemDatas( CArray<WheelItemData, WheelItemData&> &arr
// init crown icons
for( int i=0; i<arrayWheelItemDatas.GetSize() && i<3; i++ )
{
MusicStatusDisplayType crown = MusicStatusDisplayType(TYPE_CROWN1 + i);
arrayWheelItemDatas[i].m_MusicStatusDisplayType = crown;
arrayWheelItemDatas[i].m_MusicStatusDisplayType = MusicStatusDisplayType(TYPE_CROWN1 + i);
}
}
@@ -428,7 +461,12 @@ void MusicWheel::BuildWheelItemDatas( CArray<WheelItemData, WheelItemData&> &arr
if( arrayWheelItemDatas.GetSize() == 0 )
{
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 )
{
return fPosOffsetsFromMiddle*44;
return (float)roundf( fPosOffsetsFromMiddle*44 );
}
float MusicWheel::GetBannerBrightness( float fPosOffsetsFromMiddle )
@@ -515,7 +553,7 @@ float MusicWheel::GetBannerX( float fPosOffsetsFromMiddle )
break;
}
return fX;
return (float)roundf( fX );
}
void MusicWheel::RebuildWheelItemDisplays()
@@ -563,10 +601,11 @@ void MusicWheel::RebuildWheelItemDisplays()
void MusicWheel::NotesChanged( PlayerNumber pn ) // update grade graphics and top score
{
DifficultyClass dc = PREFS->m_PreferredDifficultyClass[pn];
Song* pSong = SONG->m_pCurSong;
NoteMetadata* m_pNoteMetadata = SONG->m_pCurNoteMetadata[pn];
Song* pSong = SONGMAN->m_pCurSong;
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++ )
{
@@ -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++ )
{
@@ -600,7 +639,7 @@ void MusicWheel::RenderPrimitives()
}
ActorFrame::RenderPrimitives();
ActorFrame::DrawPrimitives();
}
void MusicWheel::Update( float fDeltaTime )
@@ -627,7 +666,7 @@ void MusicWheel::Update( float fDeltaTime )
{
case STATE_SWITCHING_MUSIC:
m_WheelState = STATE_IDLE; // now, wait for input
WM->SendMessageToTopWindow( SM_PlaySongSample, 0 );
SCREENMAN->SendMessageToTopScreen( SM_PlaySongSample, 0 );
break;
case STATE_FLYING_OFF_BEFORE_NEXT_SORT:
{
@@ -681,11 +720,11 @@ void MusicWheel::Update( float fDeltaTime )
}
break;
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
break;
case STATE_TWEENING_ON_SCREEN:
WM->SendMessageToTopWindow( SM_PlaySongSample, 0 );
SCREENMAN->SendMessageToTopScreen( SM_PlaySongSample, 0 );
m_WheelState = STATE_IDLE;
m_fTimeLeftInState = 0;
break;
@@ -778,6 +817,11 @@ void MusicWheel::NextMusic()
m_soundChangeMusic.Play();
}
void MusicWheel::PrevSort()
{
NextSort();
}
void MusicWheel::NextSort()
{
switch( m_WheelState )
@@ -833,6 +877,8 @@ bool MusicWheel::Select()
}
return false;
case TYPE_ROULETTE:
return false;
case TYPE_SONG:
default:
+23 -21
View File
@@ -5,7 +5,7 @@
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
-----------------------------------------------------------------------------
*/
@@ -14,7 +14,7 @@
#include "Song.h"
#include "ActorFrame.h"
#include "BitmapText.h"
#include "RectangleActor.h"
#include "Quad.h"
#include "TextBanner.h"
#include "RandomSample.h"
#include "GradeDisplay.h"
@@ -22,7 +22,7 @@
#include "GameConstantsAndTypes.h"
#include "MusicSortDisplay.h"
#include "MusicStatusDisplay.h"
#include "Window.h" // for WindowMessage
#include "Screen.h" // for ScreenMessage
#include "ScoreDisplayRolling.h"
#include "ScrollBar.h"
@@ -31,11 +31,11 @@ const int NUM_WHEEL_ITEMS_TO_DRAW = 13;
const float FADE_TIME = 0.7f;
const WindowMessage SM_SongChanged = WindowMessage(SM_User+47); // this should be unique!
const WindowMessage SM_PlaySongSample = WindowMessage(SM_User+48);
const ScreenMessage SM_SongChanged = ScreenMessage(SM_User+47); // this should be unique!
const ScreenMessage SM_PlaySongSample = ScreenMessage(SM_User+48);
enum WheelItemType { TYPE_SECTION, TYPE_SONG };
enum WheelItemType { TYPE_SECTION, TYPE_SONG, TYPE_ROULETTE };
struct WheelItemData
@@ -43,12 +43,12 @@ struct WheelItemData
public:
WheelItemData();
void LoadFromSectionName( const CString &sSectionName );
void LoadFromSong( Song* pSong );
void Load( WheelItemType wit, Song* pSong, const CString &sSectionName, const D3DXCOLOR color );
WheelItemType m_WheelItemType;
CString m_sSectionName;
Song* m_pSong;
D3DXCOLOR m_color; // either text color or section background color
MusicStatusDisplayType m_MusicStatusDisplayType;
};
@@ -60,24 +60,24 @@ public:
WheelItemDisplay();
virtual void Update( float fDeltaTime );
virtual void RenderPrimitives();
virtual void DrawPrimitives();
CString GetSectionName()
{
return m_sSectionName;
};
CString GetSectionName() { return m_sSectionName; }
void LoadFromWheelItemData( WheelItemData* pWID );
void RefreshGrades();
// for a section
Sprite m_sprSectionBar;
BitmapText m_textSectionName;
// for TYPE_SECTION and TYPE_ROULETTE
Sprite m_sprSectionBar;
// for TYPE_SECTION
BitmapText m_textSectionName;
// for TYPE_ROULETTE
BitmapText m_textRoulette;
// for a music
// for a TYPE_MUSIC
Sprite m_sprSongBar;
MusicStatusDisplay m_MusicStatusDisplay;
TextBanner m_Banner;
TextBanner m_TextBanner;
GradeDisplay m_GradeDisplay[NUM_PLAYERS];
};
@@ -91,13 +91,14 @@ public:
~MusicWheel();
virtual void Update( float fDeltaTime );
virtual void RenderPrimitives();
virtual void DrawPrimitives();
virtual void TweenOnScreen();
virtual void TweenOffScreen();
void PrevMusic();
void NextMusic();
void PrevSort();
void NextSort();
void NotesChanged( PlayerNumber pn ); // update grade graphics and top score
@@ -107,8 +108,9 @@ public:
float GetBannerX( float fPosOffsetsFromMiddle );
bool Select(); // return true if the selected item is a music, otherwise false
Song* GetSelectedSong() { return GetCurWheelItemDatas()[m_iSelection].m_pSong; };
CString GetSelectedSection() { return GetCurWheelItemDatas()[m_iSelection].m_sSectionName; };
WheelItemType GetSelectedType() { return GetCurWheelItemDatas()[m_iSelection].m_WheelItemType; };
Song* GetSelectedSong() { return GetCurWheelItemDatas()[m_iSelection].m_pSong; };
CString GetSelectedSection() { return GetCurWheelItemDatas()[m_iSelection].m_sSectionName; };
protected:
+157 -31
View File
@@ -5,7 +5,7 @@
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
-----------------------------------------------------------------------------
*/
@@ -22,16 +22,53 @@
NoteData::NoteData()
{
for( int i=0; i<MAX_NOTE_TRACKS; i++ )
{
for( int j=0; j<MAX_TAP_NOTE_ELEMENTS; j++ )
m_TapNotes[i][j] = '0';
}
memset( m_TapNotes, '0', MAX_NOTE_TRACKS*MAX_TAP_NOTE_ROWS );
m_iNumTracks = 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 )
{
// delete old TapNotes in the range
@@ -131,7 +168,7 @@ void NoteData::RemoveHoldNote( int index )
m_iNumHoldNotes--;
}
float NoteData::GetLastBeat()
int NoteData::GetLastRow()
{
int iOldestIndexFoundSoFar = 0;
@@ -143,7 +180,7 @@ float NoteData::GetLastBeat()
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++ )
{
@@ -157,14 +194,22 @@ float NoteData::GetLastBeat()
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;
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++ )
{
@@ -173,14 +218,46 @@ int NoteData::GetNumTapNotes()
}
}
iNumSteps += m_iNumHoldNotes;
return iNumSteps;
}
int NoteData::GetNumHoldNotes()
{
return m_iNumHoldNotes;
int NoteData::GetNumDoubles( const float fStartBeat, const float fEndBeat )
{
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
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';
}
@@ -219,14 +296,14 @@ void NoteData::CropToRightSide()
// clear out the left half
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';
}
// copy the right side into the left
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][i] = '0';
@@ -364,7 +441,7 @@ void NoteData::Turn( PlayerOptions::TurnType tt )
pNewData->m_iNumTracks = m_iNumTracks;
// 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++ )
{
@@ -402,7 +479,7 @@ void NoteData::Turn( PlayerOptions::TurnType tt )
void NoteData::MakeLittle()
{
// 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 )
{
@@ -424,11 +501,11 @@ void NoteData::Convert2sAnd3sToHoldNotes()
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
{
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' ||
m_TapNotes[col][j] == '3' ) // found it!
@@ -479,8 +556,8 @@ void NoteData::SnapToNearestNoteType( NoteType nt1, NoteType nt2, float fBeginBe
default: ASSERT( false );
}
int iNoteIndexBegin = BeatToNoteIndex( fBeginBeat );
int iNoteIndexEnd = BeatToNoteIndex( fEndBeat );
int iNoteIndexBegin = BeatToNoteRow( fBeginBeat );
int iNoteIndexEnd = BeatToNoteRow( fEndBeat );
//ConvertHoldNotesTo2sAnd3s();
@@ -488,13 +565,13 @@ void NoteData::SnapToNearestNoteType( NoteType nt1, NoteType nt2, float fBeginBe
for( int i=iNoteIndexBegin; i<=iNoteIndexEnd; i++ )
{
int iOldIndex = i;
float fOldBeat = NoteIndexToBeat( iOldIndex );
float fOldBeat = NoteRowToBeat( iOldIndex );
float fNewBeat1 = froundf( fOldBeat, fSnapInterval1 );
float fNewBeat2 = froundf( fOldBeat, fSnapInterval2 );
bool bNewBeat1IsCloser = fabsf(fNewBeat1-fOldBeat) < fabsf(fNewBeat2-fOldBeat);
float fNewBeat = bNewBeat1IsCloser ? fNewBeat1 : fNewBeat2;
int iNewIndex = BeatToNoteIndex( fNewBeat );
int iNewIndex = BeatToNoteRow( fNewBeat );
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 fBeat = (m + fPercentIntoMeasure) * BEATS_PER_MEASURE;
const int iIndex = BeatToNoteIndex( fBeat );
const int iIndex = BeatToNoteRow( fBeat );
CString sNoteLine = arrayNoteLines[l];
sNoteLine.TrimRight();
@@ -601,12 +678,61 @@ void NoteData::SetFromMeasureStrings( CStringArray &arrayMeasureStrings )
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[] )
{
// init
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_iNumHoldNotes = 0;
@@ -622,7 +748,7 @@ void NoteData::LoadTransformed( NoteData* pOriginal, int iNewNumTracks, TrackNum
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];
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
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
-----------------------------------------------------------------------------
*/
#include "GameConstantsAndTypes.h"
#include "GameConstantsAndTypes.h"
// '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 float NoteIndexToBeat( float fNoteIndex ) { return fNoteIndex / (float)ELEMENTS_PER_BEAT; };
inline float NoteIndexToBeat( int iNoteIndex ) { return NoteIndexToBeat( (float)iNoteIndex ); };
inline float NoteRowToBeat( float fNoteIndex ) { return fNoteIndex / (float)ELEMENTS_PER_BEAT; };
inline float NoteRowToBeat( int iNoteIndex ) { return NoteRowToBeat( (float)iNoteIndex ); };
@@ -85,24 +84,34 @@ class NoteData
{
public:
NoteData();
~NoteData();
int m_iNumTracks;
TapNote m_TapNotes[MAX_NOTE_TRACKS][MAX_TAP_NOTE_ELEMENTS];
HoldNote m_HoldNotes[MAX_HOLD_NOTE_ELEMENTS];
int m_iNumHoldNotes;
// 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
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 ClearAll() { ClearRange( 0, MAX_TAP_NOTE_ELEMENTS ); };
void ClearAll() { ClearRange( 0, MAX_TAP_NOTE_ROWS ); };
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 )
{
for( int t=0; t<m_iNumTracks; t++ )
{
if( m_TapNotes[t][index] != '0' )
return false;
}
return true;
}
@@ -110,18 +119,19 @@ public:
void AddHoldNote( HoldNote newNote ); // add note hold note merging overlapping HoldNotes and destroying TapNotes underneath
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
float GetLastBeat(); // return the beat number of the last beat in the song
int GetNumTapNotes();
int GetNumHoldNotes();
float GetLastBeat(); // return the beat number of the last note
int GetLastRow();
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
void LoadTransformed( NoteData* pOriginal, int iNewNumTracks, TrackNumber iNewToOriginalTrack[] );
+16 -13
View File
@@ -5,7 +5,7 @@
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
-----------------------------------------------------------------------------
*/
@@ -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_fNumBeatsToDrawBehind = fNumBeatsToDrawBehind;
@@ -49,8 +49,11 @@ void NoteField::Load( NoteData* pNoteData, PlayerOptions po, float fNumBeatsToDr
// init arrow rotations and X positions
for( int c=0; c<m_iNumTracks; c++ )
{
m_ColorNote[c].m_sprColorPart.Load( GAME->GetPathToGraphic( PLAYER_1, c, GRAPHIC_NOTE_COLOR_PART) );
m_ColorNote[c].m_sprGrayPart.Load( GAME->GetPathToGraphic( PLAYER_1, c, GRAPHIC_NOTE_GRAY_PART) );
CArray<D3DXCOLOR,D3DXCOLOR> arrayTweenColors;
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();
}
void NoteField::RenderPrimitives()
void NoteField::DrawPrimitives()
{
//LOG->WriteLine( "NoteField::RenderPrimitives()" );
//LOG->WriteLine( "NoteField::DrawPrimitives()" );
if( 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 iIndexFirstArrowToDraw = BeatToNoteIndex( m_fSongBeat - m_fNumBeatsToDrawBehind ); // 2 beats earlier
int iIndexFirstArrowToDraw = BeatToNoteRow( m_fSongBeat - m_fNumBeatsToDrawBehind ); // 2 beats earlier
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 );
@@ -183,11 +186,11 @@ void NoteField::RenderPrimitives()
{
if( m_fBeginMarker != -1 )
{
DrawMarkerBar( BeatToNoteIndex(m_fBeginMarker) );
DrawMarkerBar( BeatToNoteRow(m_fBeginMarker) );
}
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 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
@@ -264,7 +267,7 @@ void NoteField::RenderPrimitives()
if( j < iIndexFirstArrowToDraw || iIndexLastArrowToDraw < j)
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
CreateHoldNoteInstance( instances[iCount++], bActive, j, hn, fHoldNoteLife );
@@ -273,7 +276,7 @@ void NoteField::RenderPrimitives()
// draw the first arrow on top of the others
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
else
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.
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
-----------------------------------------------------------------------------
*/
@@ -19,7 +19,7 @@
#include "StyleDef.h"
#include "ColorNote.h"
#include "BitmapText.h"
#include "RectangleActor.h"
#include "Quad.h"
#include "ArrowEffects.h"
@@ -30,14 +30,14 @@ class NoteField : public NoteData, public ActorFrame
public:
NoteField();
virtual void Update( float fDeltaTime, float fSongBeat );
virtual void RenderPrimitives();
virtual void DrawPrimitives();
enum NoteFieldMode {
MODE_DANCING,
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 SetHoldNoteLife( int iIndex, float fLife );
@@ -65,7 +65,7 @@ protected:
ColorNote m_ColorNote[MAX_NOTE_TRACKS];
// used in MODE_EDIT
RectangleActor m_rectMeasureBar;
Quad m_rectMeasureBar;
BitmapText m_textMeasureNumber;
RectangleActor m_rectMarkerBar;
Quad m_rectMarkerBar;
};
+79 -41
View File
@@ -1,11 +1,11 @@
#include "stdafx.h"
/*
-----------------------------------------------------------------------------
Class: NoteMetadata
Class: Notes
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"
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 HOLD_JUDGEMENT_Y = ARROWS_Y + 80;
const float COMBO_Y = CENTER_Y + 60;
const float HOLD_ARROW_NG_TIME = 0.27f;
@@ -35,7 +38,7 @@ Player::Player()
m_PlayerNumber = PLAYER_NONE;
// 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++ )
{
@@ -52,10 +55,13 @@ Player::Player()
this->AddActor( &m_GrayArrowRow );
this->AddActor( &m_NoteField );
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++ )
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 )
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_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++ )
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
continue; // we don't need to update the logic for this one
float fStartBeat = NoteIndexToBeat( (float)hn.m_iStartIndex );
float fEndBeat = NoteIndexToBeat( (float)hn.m_iEndIndex );
float fStartBeat = NoteRowToBeat( (float)hn.m_iStartIndex );
float fEndBeat = NoteRowToBeat( (float)hn.m_iEndIndex );
const int iCol = 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
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 )
{
@@ -171,6 +184,8 @@ void Player::Update( float fDeltaTime, float fSongBeat, float fMaxBeatDifference
ActorFrame::Update( fDeltaTime );
m_frameJudgeAndCombo.Update( fDeltaTime );
m_pLifeMeter->SetBeat( 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;
if( m_PlayerOptions.m_EffectType == PlayerOptions::EFFECT_SPACE )
{
// turn off Z Buffering
SCREEN->GetDevice()->SetRenderState( D3DRS_ZENABLE, FALSE );
SCREEN->GetDevice()->SetRenderState( D3DRS_ZWRITEENABLE, FALSE );
DISPLAY->GetDevice()->SetRenderState( D3DRS_ZENABLE, FALSE );
DISPLAY->GetDevice()->SetRenderState( D3DRS_ZWRITEENABLE, FALSE );
// save old view and projection
SCREEN->GetDevice()->GetTransform( D3DTS_VIEW, &matOldView );
SCREEN->GetDevice()->GetTransform( D3DTS_PROJECTION, &matOldProj );
DISPLAY->GetDevice()->GetTransform( D3DTS_VIEW, &matOldView );
DISPLAY->GetDevice()->GetTransform( D3DTS_PROJECTION, &matOldProj );
// construct view and project matrix
@@ -202,11 +217,11 @@ void Player::RenderPrimitives()
&D3DXVECTOR3( CENTER_X
, GetY()+400.0f, 0.0f ),
&D3DXVECTOR3( 0.0f, -1.0f, 0.0f ) );
SCREEN->GetDevice()->SetTransform( D3DTS_VIEW, &matNewView );
DISPLAY->GetDevice()->SetTransform( D3DTS_VIEW, &matNewView );
D3DXMATRIX matNewProj;
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();
@@ -216,19 +231,18 @@ void Player::RenderPrimitives()
if( m_PlayerOptions.m_EffectType == PlayerOptions::EFFECT_SPACE )
{
// restire old view and projection
SCREEN->GetDevice()->SetTransform( D3DTS_VIEW, &matOldView );
SCREEN->GetDevice()->SetTransform( D3DTS_PROJECTION, &matOldProj );
DISPLAY->GetDevice()->SetTransform( D3DTS_VIEW, &matOldView );
DISPLAY->GetDevice()->SetTransform( D3DTS_PROJECTION, &matOldProj );
// turn Z Buffering back on
SCREEN->GetDevice()->SetRenderState( D3DRS_ZENABLE, TRUE );
SCREEN->GetDevice()->SetRenderState( D3DRS_ZWRITEENABLE, TRUE );
DISPLAY->GetDevice()->SetRenderState( D3DRS_ZENABLE, TRUE );
DISPLAY->GetDevice()->SetRenderState( D3DRS_ZWRITEENABLE, TRUE );
}
m_frameJudgeAndCombo.Draw();
m_Judgement.Draw();
for( int c=0; c<m_iNumTracks; c++ )
m_HoldJudgement[c].Draw();
m_Combo.Draw();
}
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
{
float fBeatDifference = fabsf( NoteIndexToBeat(hn.m_iStartIndex) - fSongBeat );
float fBeatDifference = fabsf( NoteRowToBeat(hn.m_iStartIndex) - fSongBeat );
if( fBeatDifference <= fMaxBeatDiff )
{
float fBeatsUntilStep = NoteIndexToBeat( (float)hn.m_iStartIndex ) - fSongBeat;
float fBeatsUntilStep = NoteRowToBeat( (float)hn.m_iStartIndex ) - fSongBeat;
float fPercentFromPerfect = fabsf( fBeatsUntilStep / fMaxBeatDiff );
//LOG->WriteLine( "fBeatsUntilStep: %f, fPercentFromPerfect: %f",
@@ -315,7 +329,18 @@ void Player::HandlePlayerStep( float fSongBeat, ColumnNumber col, float fMaxBeat
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()" );
// look for the closest matching step
int iIndexStartLookingAt = BeatToNoteIndex( fSongBeat );
int iNumElementsToExamine = BeatToNoteIndex( fMaxBeatDiff ); // number of elements to examine on either end of iIndexStartLookingAt
int iIndexStartLookingAt = BeatToNoteRow( fSongBeat );
int iNumElementsToExamine = BeatToNoteRow( fMaxBeatDiff ); // number of elements to examine on either end of iIndexStartLookingAt
//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;
// silly check to make sure we don't go out of bounds
iCurrentIndexEarlier = clamp( iCurrentIndexEarlier, 0, MAX_TAP_NOTE_ELEMENTS-1 );
iCurrentIndexLater = clamp( iCurrentIndexLater, 0, MAX_TAP_NOTE_ELEMENTS-1 );
iCurrentIndexEarlier = clamp( iCurrentIndexEarlier, 0, MAX_TAP_NOTE_ROWS-1 );
iCurrentIndexLater = clamp( iCurrentIndexLater, 0, MAX_TAP_NOTE_ROWS-1 );
////////////////////////////
// check the step to the left of iIndexStartLookingAt
////////////////////////////
//LOG->WriteLine( "Checking NoteMetadata[%d]", iCurrentIndexEarlier );
if( m_TapNotes[col][iCurrentIndexEarlier] != '0' ) // these NoteMetadata overlap
//LOG->WriteLine( "Checking Notes[%d]", iCurrentIndexEarlier );
if( m_TapNotes[col][iCurrentIndexEarlier] != '0' ) // these Notes overlap
{
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
////////////////////////////
//LOG->WriteLine( "Checking NoteMetadata[%d]", iCurrentIndexLater );
if( m_TapNotes[col][iCurrentIndexLater] != '0' ) // these NoteMetadata overlap
//LOG->WriteLine( "Checking Notes[%d]", iCurrentIndexLater );
if( m_TapNotes[col][iCurrentIndexLater] != '0' ) // these Notes overlap
{
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 )
{
float fStepBeat = NoteIndexToBeat( (float)iIndexThatWasSteppedOn );
float fStepBeat = NoteRowToBeat( (float)iIndexThatWasSteppedOn );
float fBeatsUntilStep = fStepBeat - fSongBeat;
@@ -431,6 +456,19 @@ void Player::OnRowDestroyed( float fSongBeat, ColumnNumber col, float fMaxBeatDi
m_Combo.EndCombo();
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;
for( int i=0; i<MAX_TAP_NOTE_ELEMENTS; i++ )
for( int i=0; i<MAX_TAP_NOTE_ROWS; i++ )
{
switch( m_TapNoteScores[i] )
{
@@ -480,9 +518,9 @@ ScoreSummary Player::GetScoreSummary()
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;
// 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,
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
-----------------------------------------------------------------------------
*/
#include "PrefsManager.h" // for ScoreSummary
#include "NoteMetadata.h"
#include "Notes.h"
#include "Sprite.h"
#include "BitmapText.h"
@@ -41,7 +41,7 @@ public:
Player();
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 CrossedIndex( int iIndex );
@@ -61,8 +61,8 @@ protected:
PlayerOptions m_PlayerOptions;
// 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
TapNoteScore m_TapNoteScores[MAX_TAP_NOTE_ELEMENTS];
TapNote m_TapNotesOriginal[MAX_NOTE_TRACKS][MAX_TAP_NOTE_ROWS]; // the original Notes that were loaded into player
TapNoteScore m_TapNoteScores[MAX_TAP_NOTE_ROWS];
HoldNoteScore m_HoldNoteScores[MAX_HOLD_NOTE_ELEMENTS];
@@ -70,8 +70,9 @@ protected:
NoteField m_NoteField;
GhostArrowRow m_GhostArrowRow;
Judgement m_Judgement;
HoldJudgement m_HoldJudgement[MAX_NOTE_TRACKS];
ActorFrame m_frameJudgeAndCombo;
Judgement m_Judgement;
Combo m_Combo;
LifeMeterBar* m_pLifeMeter;
ScoreDisplayRolling* m_pScore;
+21 -8
View File
@@ -5,7 +5,7 @@
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
-----------------------------------------------------------------------------
*/
@@ -121,12 +121,14 @@ void PrefsManager::ReadPrefsFromDisk()
{
pKey->GetNextAssoc( pos, name_string, value_string );
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 == "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 == "NumArcadeStages" ) m_GameOptions.m_iNumArcadeStages= atoi( value_string );
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 == "UseRandomVis" ) m_GameOptions.m_bUseRandomVis = ( 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 == "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 );
}
}
@@ -193,14 +195,25 @@ void PrefsManager::SavePrefsToDisk()
ini.SetValue( "GameOptions", "IgnoreJoyAxes", m_GameOptions.m_bIgnoreJoyAxes ? "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", "SkipCaution", m_GameOptions.m_bSkipCaution ? "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();
}
int PrefsManager::GetStageNumber()
{
return m_iCurrentStage;
}
bool PrefsManager::IsFinalStage()
{
return m_GameOptions.m_iNumArcadeStages == m_iCurrentStage;
}
CString PrefsManager::GetStageText()
{
+10 -7
View File
@@ -7,7 +7,7 @@
also has temporary holders for information that passed between windows - e.g.
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
-----------------------------------------------------------------------------
*/
@@ -28,16 +28,19 @@ public:
SongSortOrder m_SongSortOrder; // used by MusicWheel and should be saved until the app exits
GameMode m_GameMode;
int m_iCurrentStage; // number of stages played +1
int GetStageNumber();
bool IsFinalStage();
CString GetStageText();
DifficultyClass m_PreferredDifficultyClass[NUM_PLAYERS];
GameOptions m_GameOptions;
bool m_bWindowed;
GraphicProfile m_GraphicProfile;
DifficultyClass m_PreferredDifficultyClass[NUM_PLAYERS];
GameOptions m_GameOptions;
bool m_bWindowed;
GraphicProfile m_GraphicProfile;
GraphicProfileOptions* GetCustomGraphicProfileOptions();
GraphicProfileOptions* GetCurrentGraphicProfileOptions();
PlayerOptions m_PlayerOptions[NUM_PLAYERS];
SongOptions m_SongOptions;
PlayerOptions m_PlayerOptions[NUM_PLAYERS];
SongOptions m_SongOptions;
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.
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::RageBitmapTexture(
RageScreen* pScreen,
RageDisplay* pScreen,
const CString &sFilePath,
const DWORD dwMaxSize,
const DWORD dwTextureColorDepth,
const DWORD dwHints ) :
RageTexture( pScreen, sFilePath, dwMaxSize, dwTextureColorDepth, dwHints )
DWORD dwMaxSize,
DWORD dwTextureColorDepth,
int iMipMaps,
int iAlphaBits,
bool bDither,
bool bStretch
) :
RageTexture( pScreen, sFilePath, dwMaxSize, dwTextureColorDepth, iMipMaps, iAlphaBits, bDither, bStretch )
{
// LOG->WriteLine( "RageBitmapTexture::RageBitmapTexture()" );
m_pd3dTexture = NULL;
Create( dwMaxSize, dwTextureColorDepth, dwHints );
Create( dwMaxSize, dwTextureColorDepth, iMipMaps, iAlphaBits, bDither, bStretch );
CreateFrameRects();
}
@@ -53,12 +57,16 @@ RageBitmapTexture::~RageBitmapTexture()
}
void RageBitmapTexture::Reload(
const DWORD dwMaxSize,
const DWORD dwTextureColorDepth,
const DWORD dwHints )
DWORD dwMaxSize,
DWORD dwTextureColorDepth,
int iMipMaps,
int iAlphaBits,
bool bDither,
bool bStretch
)
{
SAFE_RELEASE(m_pd3dTexture);
Create( dwMaxSize, dwTextureColorDepth, dwHints );
Create( dwMaxSize, dwTextureColorDepth, iMipMaps, iAlphaBits, bDither, bStretch );
// leave m_iRefCount alone!
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;
// 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
///////////////////////
D3DFORMAT fmtTexture;
// look in the file name for a format hint
m_sFilePath.MakeLower();
switch( dwTextureColorDepth )
{
case 16:
if( -1 != m_sFilePath.Find("no alpha") )
fmtTexture = D3DFMT_R5G6B5;
else if( -1 != m_sFilePath.Find("1 alpha") )
fmtTexture = D3DFMT_A1R5G5B5;
else
fmtTexture = D3DFMT_A4R4G4B4;
break;
switch( iAlphaBits )
{
case 0: fmtTexture = D3DFMT_R5G6B5; break;
case 1: fmtTexture = D3DFMT_A1R5G5B5; break;
default: fmtTexture = D3DFMT_A4R4G4B4; break;
}
case 32:
fmtTexture = D3DFMT_A8R8G8B8;
break;
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
/////////////////////
bool bScaleImageToTextureSize;
D3DXIMAGE_INFO ddii;
if( FAILED( hr = D3DXGetImageInfoFromFile(
m_sFilePath,
@@ -124,9 +134,9 @@ void RageBitmapTexture::Create( DWORD dwMaxSize, DWORD dwTextureColorDepth, DWOR
}
// 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,
@@ -139,13 +149,13 @@ void RageBitmapTexture::Create( DWORD dwMaxSize, DWORD dwTextureColorDepth, DWOR
if( FAILED( hr = D3DXCreateTextureFromFileEx(
m_pd3dDevice, // device
m_sFilePath, // soure file
bScaleImageToTextureSize ? dwMaxSize : D3DX_DEFAULT, // width
bScaleImageToTextureSize ? dwMaxSize : D3DX_DEFAULT, // height
bCreateMipMaps ? 4 : 0, // mip map levels
bStretch ? dwMaxSize : D3DX_DEFAULT, // width
bStretch ? dwMaxSize : D3DX_DEFAULT, // height
iMipMaps, // mip map levels
0, // usage (is a render target?)
fmtTexture, // our preferred texture format
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
0, // no color key
&ddii, // struct to fill with source image info
@@ -171,7 +181,7 @@ void RageBitmapTexture::Create( DWORD dwMaxSize, DWORD dwTextureColorDepth, DWOR
m_TextureFormat = ddsd.Format;
if( bScaleImageToTextureSize )
if( bStretch )
{
m_iImageWidth = m_iTextureWidth;
m_iImageHeight = m_iTextureHeight;
@@ -182,11 +192,11 @@ void RageBitmapTexture::Create( DWORD dwMaxSize, DWORD dwTextureColorDepth, DWOR
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,
GetTextureWidth(),
GetTextureHeight(),
bScaleImageToTextureSize,
bStretch,
m_iSourceWidth,
m_iSourceHeight,
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.
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 RageBitmapTexture;
#ifndef _RageBitmapTexture_H_
#define _RageBitmapTexture_H_
#include "RageScreen.h"
#include "RageDisplay.h"
#include <d3dx8.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:
RageBitmapTexture(
RageScreen* pScreen,
RageDisplay* pScreen,
const CString &sFilePath,
const DWORD dwMaxSize = 2048,
const DWORD dwTextureColorDepth = 16,
const DWORD dwHints = 0
DWORD dwMaxSize = 2048,
DWORD dwTextureColorDepth = 16,
int iMipMaps = 4,
int iAlphaBits = 4,
bool bDither = false,
bool bStretch = false
);
~RageBitmapTexture();
virtual void Reload(
const DWORD dwMaxSize,
const DWORD dwTextureColorDepth,
const DWORD dwHints );
DWORD dwMaxSize,
DWORD dwTextureColorDepth,
int iMipMaps = 4,
int iAlphaBits = 4,
bool bDither = false,
bool bStretch = false
);
virtual LPDIRECT3DTEXTURE8 GetD3DTexture();
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;
};
#endif
+4 -2
View File
@@ -5,7 +5,7 @@
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"
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 )
{
LOG->WriteLine( "RageInput::RageInput()" );
int i;
m_hWnd = hWnd;
+4 -10
View File
@@ -1,17 +1,14 @@
#pragma once
/*
-----------------------------------------------------------------------------
File: RageInput.h
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
#define DIRECTINPUT_VERSION 0x0800
#endif
@@ -99,7 +96,7 @@ public:
class RageInput
{
// Our Windows Handle
// Our Screens Handle
HWND m_hWnd;
// Main DirectInput Object
@@ -155,7 +152,4 @@ public:
};
extern RageInput* INPUTM; // global and accessable from anywhere in our program
#endif
extern RageInput* INPUTMAN; // global and accessable from anywhere in our program
+1 -1
View File
@@ -5,7 +5,7 @@
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
-----------------------------------------------------------------------------
*/
+1 -1
View File
@@ -5,7 +5,7 @@
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
-----------------------------------------------------------------------------
*/
+15 -9
View File
@@ -5,7 +5,7 @@
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
-----------------------------------------------------------------------------
*/
@@ -243,12 +243,15 @@ HRESULT CTextureRenderer::DoRenderSample( IMediaSample * pSample )
// RageMovieTexture constructor
//-----------------------------------------------------------------------------
RageMovieTexture::RageMovieTexture(
RageScreen* pScreen,
RageDisplay* pScreen,
const CString &sFilePath,
const DWORD dwMaxSize,
const DWORD dwTextureColorDepth,
const DWORD dwHints ) :
RageTexture( pScreen, sFilePath, dwMaxSize, dwTextureColorDepth, dwHints )
DWORD dwMaxSize,
DWORD dwTextureColorDepth,
int iMipMaps,
int iAlphaBits,
bool bDither,
bool bStretch ) :
RageTexture( pScreen, sFilePath, dwMaxSize, dwTextureColorDepth, iMipMaps, iAlphaBits, bDither, bStretch )
{
LOG->WriteLine( "RageBitmapTexture::RageBitmapTexture()" );
@@ -269,9 +272,12 @@ RageMovieTexture::~RageMovieTexture()
}
void RageMovieTexture::Reload(
const DWORD dwMaxSize,
const DWORD dwTextureColorDepth,
const DWORD dwHints )
DWORD dwMaxSize,
DWORD dwTextureColorDepth,
int iMipMaps,
int iAlphaBits,
bool bDither,
bool bStretch )
{
// do nothing
}
+17 -9
View File
@@ -4,7 +4,7 @@
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
-----------------------------------------------------------------------------
*/
@@ -14,7 +14,7 @@
#define _RAGEMOVIETEXTURE_H_
#include "RageScreen.h"
#include "RageDisplay.h"
#include <d3dx8.h>
//#include <d3d8types.h>
#include <atlbase.h>
@@ -75,17 +75,25 @@ class RageMovieTexture : public RageTexture
{
public:
RageMovieTexture(
RageScreen* pScreen,
RageDisplay* pScreen,
const CString &sFilePath,
const DWORD dwMaxSize,
const DWORD dwTextureColorDepth,
const DWORD dwHints );
DWORD dwMaxSize = 2048,
DWORD dwTextureColorDepth = 16,
int iMipMaps = 4,
int iAlphaBits = 4,
bool bDither = false,
bool bStretch = false
);
virtual ~RageMovieTexture();
virtual void Reload(
const DWORD dwMaxSize,
const DWORD dwTextureColorDepth,
const DWORD dwHints );
DWORD dwMaxSize,
DWORD dwTextureColorDepth,
int iMipMaps = 4,
int iAlphaBits = 4,
bool bDither = false,
bool bStretch = false
);
LPDIRECT3DTEXTURE8 GetD3DTexture();
+16 -2
View File
@@ -5,7 +5,7 @@
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"
"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"
"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
}
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).
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
-----------------------------------------------------------------------------
*/
@@ -23,9 +23,10 @@ public:
RageSound( HWND hWnd );
~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 PlayOnceStreamedFromDir( CString sDir );
private:
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.
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::RageTexture(
RageScreen* pScreen,
RageDisplay* pScreen,
const CString &sFilePath,
const DWORD dwMaxSize,
const DWORD dwTextureColorDepth,
const DWORD dwHints )
DWORD dwMaxSize,
DWORD dwTextureColorDepth,
int iMipMaps,
int iAlphaBits,
bool bDither,
bool bStretch )
{
// LOG->WriteLine( "RageTexture::RageTexture()" );
+18 -11
View File
@@ -5,7 +5,7 @@
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
-----------------------------------------------------------------------------
*/
@@ -13,7 +13,7 @@
#include "RageScreen.h"
#include "RageDisplay.h"
#include <d3dx8.h>
#include <assert.h>
//#include <d3d8types.h>
@@ -32,7 +32,6 @@ public:
};
//-----------------------------------------------------------------------------
// RageTexture Class Declarations
//-----------------------------------------------------------------------------
@@ -40,17 +39,25 @@ class RageTexture
{
public:
RageTexture(
RageScreen* pScreen,
RageDisplay* pScreen,
const CString &sFilePath,
const DWORD dwMaxSize,
const DWORD dwTextureColorDepth,
const DWORD dwHints );
DWORD dwMaxSize = 2048,
DWORD dwTextureColorDepth = 16,
int iMipMaps = 4,
int iAlphaBits = 4,
bool bDither = false,
bool bStretch = false
);
virtual ~RageTexture() = 0;
virtual void Reload(
const DWORD dwMaxSize,
const DWORD dwTextureColorDepth,
const DWORD dwHints ) = 0;
DWORD dwMaxSize = 2048,
DWORD dwTextureColorDepth = 16,
int iMipMaps = 4,
int iAlphaBits = 4,
bool bDither = false,
bool bStretch = false
) = 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_iTextureWidth, m_iTextureHeight; // dimensions of the texture in memory
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.
int m_iFramesWide, m_iFramesHigh;
+12 -11
View File
@@ -1,11 +1,12 @@
#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 "ErrorCatcher/ErrorCatcher.h"
RageTextureManager* TEXTURE = NULL;
RageTextureManager* TEXTUREMAN = NULL;
//-----------------------------------------------------------------------------
// constructor/destructor
//-----------------------------------------------------------------------------
RageTextureManager::RageTextureManager( RageScreen* pScreen )
RageTextureManager::RageTextureManager( RageDisplay* pScreen )
{
assert( pScreen != NULL );
m_pScreen = pScreen;
@@ -43,7 +44,7 @@ RageTextureManager::~RageTextureManager()
while( pos != NULL ) // iterate over all k/v pairs in map
{
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 );
}
@@ -54,7 +55,7 @@ RageTextureManager::~RageTextureManager()
//-----------------------------------------------------------------------------
// 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();
@@ -72,7 +73,7 @@ RageTexture* RageTextureManager::LoadTexture( CString sTexturePath, const DWORD
{
pTexture->m_iRefCount++;
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 );
}
@@ -82,12 +83,12 @@ RageTexture* RageTextureManager::LoadTexture( CString sTexturePath, const DWORD
splitpath( false, sTexturePath, sDrive, sDir, sFName, sExt );
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
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 );
+8 -19
View File
@@ -1,24 +1,15 @@
#pragma once
/*
-----------------------------------------------------------------------------
File: RageTextureManager.h
Class: RageTextureManager
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 <d3dx8.h>
//#include <d3d8types.h>
//-----------------------------------------------------------------------------
@@ -27,10 +18,10 @@ class RageTextureManager;
class RageTextureManager
{
public:
RageTextureManager( RageScreen* pScreen );
RageTextureManager( RageDisplay* pScreen );
~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 );
void UnloadTexture( CString sTexturePath );
void ReloadAll();
@@ -46,7 +37,7 @@ public:
DWORD GetTextureColorDepth() { return m_dwTextureColorDepth; };
protected:
RageScreen* m_pScreen;
RageDisplay* m_pScreen;
DWORD m_dwMaxTextureSize;
DWORD m_dwTextureColorDepth;
@@ -55,6 +46,4 @@ protected:
CTypedPtrMap<CMapStringToPtr, CString, RageTexture*> m_mapPathToTexture;
};
extern RageTextureManager* TEXTURE; // global and accessable from anywhere in our program
#endif
extern RageTextureManager* TEXTUREMAN; // global and accessable from anywhere in our program
+60 -2
View File
@@ -5,7 +5,7 @@
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
-----------------------------------------------------------------------------
*/
@@ -275,6 +275,49 @@ void GetDirListing( CString sPath, CStringArray &AddTo, bool bOnlyDirs )
::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 )
{
HANDLE hFile = CreateFile(
@@ -290,7 +333,6 @@ DWORD GetFileSizeInBytes( const CString &sFilePath )
return GetFileSize( hFile, NULL );
}
bool DoesFileExist( const CString &sPath )
{
//LOG->WriteLine( "DoesFileExist(%s)", sPath );
@@ -376,4 +418,20 @@ HINSTANCE GotoURL(LPCTSTR url)
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
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
-----------------------------------------------------------------------------
*/
#ifndef _RAGEUTIL_H_
#define _RAGEUTIL_H_
//-----------------------------------------------------------------------------
// SAFE_ Macros
@@ -27,6 +24,8 @@
//-----------------------------------------------------------------------------
#define RECTWIDTH(rect) ((rect).right - (rect).left)
#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
#define max(a,b) (((a) > (b)) ? (a) : (b))
@@ -98,6 +97,9 @@ CString join(
);
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 );
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);
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