no message

This commit is contained in:
Chris Danford
2002-01-29 21:56:14 +00:00
parent 8c513e0174
commit 2713332a43
6 changed files with 90 additions and 36 deletions
+34 -23
View File
@@ -17,34 +17,39 @@
bool Banner::LoadFromSong( Song &song )
bool Banner::LoadFromSong( Song* pSong ) // NULL means no song
{
if( song.HasBanner() )
Sprite::LoadFromTexture( song.GetBannerPath() );
else if( song.HasBackground() )
Sprite::LoadFromTexture( song.GetBackgroundPath() );
if( pSong == NULL )
Sprite::Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BANNER) );
if( pSong->HasBanner() )
Sprite::Load( pSong->GetBannerPath() );
else if( pSong->HasBackground() )
Sprite::Load( pSong->GetBackgroundPath() );
else
Sprite::LoadFromTexture( THEME->GetPathTo(GRAPHIC_FALLBACK_BANNER) );
Sprite::Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BANNER) );
//Sprite::TurnShadowOff();
Sprite::TurnShadowOff();
int iSourceWidth = m_pTexture->GetSourceWidth();
int iSourceHeight = m_pTexture->GetSourceHeight();
int iImageWidth = m_pTexture->GetImageWidth();
int iImageHeight = m_pTexture->GetImageHeight();
// save the original X&Y. We're going to resore them later.
float fOriginalX = GetX();
float fOriginalY = GetY();
if( iSourceWidth == iSourceHeight ) // this is a SSR/DWI style banner
if( iImageWidth == iImageHeight ) // this is a SSR/DWI style banner
{
float fCustomTexCoords[8] = {
float fCustomImageCoords[8] = {
0.22f, 0.98f, // bottom left
0.02f, 0.78f, // top left
0.98f, 0.22f, // bottom right
0.78f, 0.02f, // top right
};
Sprite::SetCustomTexCoords( fCustomTexCoords );
SetCustomImageCoords( fCustomImageCoords );
SetWidth( BANNER_WIDTH );
SetHeight( BANNER_HEIGHT );
SetZoom( 1 );
}
else // this is a normal sized banner
{
@@ -65,11 +70,12 @@ bool Banner::LoadFromSong( Song &song )
float fPercentageToCutOffEachSide = fPercentageToCutOff / 2;
// generate a rectangle with new texture coordinates
FRECT frectNewSrc( fPercentageToCutOffEachSide,
0,
1 - fPercentageToCutOffEachSide,
1 );
Sprite::SetCustomSrcRect( frectNewSrc );
FRECT fCustomImageCoords(
fPercentageToCutOffEachSide,
0,
1 - fPercentageToCutOffEachSide,
1 );
SetCustomImageRect( fCustomImageCoords );
}
else // crop Y
{
@@ -77,16 +83,21 @@ bool Banner::LoadFromSong( Song &song )
float fPercentageToCutOffEachSide = fPercentageToCutOff / 2;
// generate a rectangle with new texture coordinates
FRECT frectNewSrc( 0,
fPercentageToCutOffEachSide,
1,
1 - fPercentageToCutOffEachSide );
Sprite::SetCustomSrcRect( frectNewSrc );
FRECT fCustomImageCoords(
0,
fPercentageToCutOffEachSide,
1,
1 - fPercentageToCutOffEachSide );
SetCustomImageRect( fCustomImageCoords );
}
SetWidth( BANNER_WIDTH );
SetHeight( BANNER_HEIGHT );
SetZoom( 1 );
}
// restore original XY
SetXY( fOriginalX, fOriginalY );
return true;
}
+3 -3
View File
@@ -16,15 +16,15 @@
#include "Song.h"
const float BANNER_WIDTH = 192; // from the source art of DDR
const float BANNER_HEIGHT = 55;
const float BANNER_WIDTH = 264;
const float BANNER_HEIGHT = 86;
class Banner : public Sprite
{
public:
bool LoadFromSong( Song &song);
bool LoadFromSong( Song* pSong ); // NULL means no Song
};
+10 -5
View File
@@ -67,13 +67,13 @@ void RageBitmapTexture::Create()
///////////////////////
D3DFORMAT fmtTexture;
// look in the file name for a hint
// look in the file name for a format hint
m_sFilePath.MakeLower();
if( -1 != m_sFilePath.Find("(no alpha)") )
if( -1 != m_sFilePath.Find("no alpha") )
{
fmtTexture = D3DFMT_R5G6B5;
}
else if( -1 != m_sFilePath.Find("(1 alpha)") )
else if( -1 != m_sFilePath.Find("1 alpha") )
{
fmtTexture = D3DFMT_A1R5G5B5;
}
@@ -82,6 +82,11 @@ void RageBitmapTexture::Create()
fmtTexture = D3DFMT_A4R4G4B4;
}
// look in the file name for a dither hint
bool bDither = false;//-1 == m_sFilePath.Find("no dither");
// if the user has requested high color textures, use the higher color
if( GAMEINFO != NULL
&& GAMEINFO->m_GameOptions.m_iDisplayColor == 32
@@ -119,8 +124,8 @@ void RageBitmapTexture::Create()
0, // usage (is a render target?)
fmtTexture, // our preferred texture format
D3DPOOL_MANAGED, // which memory pool
bScaleImageToTextureSize ? D3DX_FILTER_BOX : D3DX_FILTER_NONE, // filter
D3DX_DEFAULT, // mip filter
(bScaleImageToTextureSize ? D3DX_FILTER_BOX : D3DX_FILTER_NONE) | (bDither ? D3DX_FILTER_DITHER : 0), // filter
D3DX_DEFAULT | (bDither ? D3DX_FILTER_DITHER : 0), // mip filter
0, // no color key
&ddii, // struct to fill with source image info
NULL, // no palette
+26 -2
View File
@@ -404,7 +404,7 @@ void Sprite::SetState( UINT uNewState )
m_fSecsIntoState = 0.0;
}
void Sprite::SetCustomSrcRect( FRECT new_texcoord_frect )
void Sprite::SetCustomTextureRect( FRECT new_texcoord_frect )
{
m_bUsingCustomTexCoords = true;
m_CustomTexCoords[0] = new_texcoord_frect.left; m_CustomTexCoords[1] = new_texcoord_frect.bottom; // bottom left
@@ -414,10 +414,34 @@ void Sprite::SetCustomSrcRect( FRECT new_texcoord_frect )
}
void Sprite::SetCustomTexCoords( float fTexCoords[8] ) // order: bottom left, top left, bottom right, top right
void Sprite::SetCustomTextureCoords( float fTexCoords[8] ) // order: bottom left, top left, bottom right, top right
{
m_bUsingCustomTexCoords = true;
for( int i=0; i<8; i++ )
m_CustomTexCoords[i] = fTexCoords[i];
}
void Sprite::SetCustomImageRect( FRECT rectImageCoords )
{
// Convert to a rectangle in texture coordinate space.
rectImageCoords.left *= m_pTexture->GetImageWidth() / (float)m_pTexture->GetTextureWidth();
rectImageCoords.right *= m_pTexture->GetImageWidth() / (float)m_pTexture->GetTextureWidth();
rectImageCoords.top *= m_pTexture->GetImageHeight() / (float)m_pTexture->GetTextureHeight();
rectImageCoords.bottom *= m_pTexture->GetImageHeight() / (float)m_pTexture->GetTextureHeight();
SetCustomTextureRect( rectImageCoords );
}
void Sprite::SetCustomImageCoords( float fImageCoords[8] ) // order: bottom left, top left, bottom right, top right
{
// convert image coords to texture coords in place
for( int i=0; i<8; i+=2 )
{
fImageCoords[i+0] *= m_pTexture->GetImageWidth() / (float)m_pTexture->GetTextureWidth();
fImageCoords[i+1] *= m_pTexture->GetImageHeight() / (float)m_pTexture->GetTextureHeight();
}
SetCustomTextureCoords( fImageCoords );
}
+5 -2
View File
@@ -47,8 +47,11 @@ public:
CString GetTexturePath() { return m_sTexturePath; };
void SetCustomSrcRect( FRECT new_texcoord_frect ); // for cropping
void SetCustomTexCoords( float fTexCoords[8] );
void SetCustomTextureRect( FRECT new_texcoord_frect );
void SetCustomTextureCoords( float fTexCoords[8] );
void SetCustomSourceRect( FRECT rectSourceCoords ); // in source pixel space
void SetCustomImageRect( FRECT rectImageCoords ); // in image pixel space
void SetCustomImageCoords( float fImageCoords[8] );
void TurnShadowOn() { m_bHasShadow = true; };
void TurnShadowOff() { m_bHasShadow = false; };
+12 -1
View File
@@ -355,6 +355,17 @@ HRESULT CreateObjects( HWND hWnd )
WM = new WindowManager;
// Ugly... Switch the screen resolution again so that the system message will display
SwitchDisplayMode(
go.m_bWindowed,
go.m_iResolution,
go.m_iResolution==640 ? 480 : 240,
go.m_iDisplayColor
);
WM->SystemMessage( ssprintf("Found %d songs.", GAMEINFO->m_pSongs.GetSize()) );
//WM->SetNewWindow( new WindowLoading );
//WM->SetNewWindow( new WindowSandbox );
//WM->SetNewWindow( new WindowMenuResults );
@@ -606,7 +617,7 @@ BOOL SwitchDisplayMode( BOOL bWindowed, DWORD dwWidth, DWORD dwHeight, DWORD dwB
if( WM )
{
WM->SetSystemMessage( ssprintf("%s - %ux%u - %u bits", bWindowed ? "Windowed" : "FullScreen", dwWidth, dwHeight, dwBPP) );
WM->SystemMessage( ssprintf("%s - %ux%u - %u bits", bWindowed ? "Windowed" : "FullScreen", dwWidth, dwHeight, dwBPP) );
}
return true;