no message
This commit is contained in:
@@ -19,11 +19,24 @@
|
||||
|
||||
bool Banner::LoadFromSong( Song* pSong ) // NULL means no song
|
||||
{
|
||||
if( pSong == NULL ) Sprite::Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BANNER), HINT_NOMIPMAPS );
|
||||
else if( pSong->HasBanner() ) Sprite::Load( pSong->GetBannerPath(), HINT_NOMIPMAPS );
|
||||
else if( pSong->HasBackground() ) Sprite::Load( pSong->GetBackgroundPath(), HINT_NOMIPMAPS );
|
||||
else Sprite::Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BANNER), HINT_NOMIPMAPS );
|
||||
if( pSong == NULL ) Banner::Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BANNER), HINT_NOMIPMAPS );
|
||||
else if( pSong->HasBanner() ) Banner::Load( pSong->GetBannerPath(), HINT_NOMIPMAPS );
|
||||
else if( pSong->HasBackground() ) Banner::Load( pSong->GetBackgroundPath(), HINT_NOMIPMAPS );
|
||||
else Banner::Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BANNER), HINT_NOMIPMAPS );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Banner::Load( CString sFilePath, DWORD dwHints, bool bForceReload )
|
||||
{
|
||||
Sprite::Load( sFilePath, dwHints, bForceReload );
|
||||
CropToRightSize();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Banner::CropToRightSize()
|
||||
{
|
||||
Sprite::TurnShadowOff();
|
||||
|
||||
int iImageWidth = m_pTexture->GetImageWidth();
|
||||
@@ -93,7 +106,4 @@ bool Banner::LoadFromSong( Song* pSong ) // NULL means no song
|
||||
|
||||
// restore original XY
|
||||
SetXY( fOriginalX, fOriginalY );
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -23,9 +23,11 @@ const float BANNER_HEIGHT = 86;
|
||||
class Banner : public Sprite
|
||||
{
|
||||
public:
|
||||
|
||||
bool LoadFromSong( Song* pSong ); // NULL means no Song
|
||||
virtual bool Load( CString sFilePath, DWORD dwHints = 0, bool bForceReload = false );
|
||||
|
||||
protected:
|
||||
void CropToRightSize();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -213,12 +213,12 @@ void BitmapText::RebuildVertexBuffer()
|
||||
m_iNumV = 0; // the current vertex number
|
||||
|
||||
float fHeight = GetUnzoomedHeight();
|
||||
float fY;
|
||||
float fY; // the center of the first line
|
||||
switch( m_VertAlign )
|
||||
{
|
||||
case align_top: fY = -(m_sTextLines.GetSize()) * fHeight / 2; break;
|
||||
case align_middle: fY = 0; break;
|
||||
case align_bottom: fY = (m_sTextLines.GetSize()) * fHeight / 2; break;
|
||||
case align_top: fY = -(m_sTextLines.GetSize()-1) * fHeight; break;
|
||||
case align_middle: fY = -(m_sTextLines.GetSize()-1) * fHeight / 2; break;
|
||||
case align_bottom: fY = 0; break;
|
||||
default: ASSERT( false );
|
||||
}
|
||||
|
||||
|
||||
@@ -89,8 +89,9 @@ WheelItemDisplay::WheelItemDisplay()
|
||||
|
||||
m_textSectionName.Load( THEME->GetPathTo(FONT_OUTLINE) );
|
||||
m_textSectionName.TurnShadowOff();
|
||||
m_textSectionName.SetHorizAlign( align_left );
|
||||
m_textSectionName.SetXY( -85, 0 );
|
||||
m_textSectionName.SetHorizAlign( align_center );
|
||||
m_textSectionName.SetVertAlign( align_middle );
|
||||
m_textSectionName.SetXY( m_sprSectionBackground.GetX(), 0 );
|
||||
m_textSectionName.SetZoom( 1.5f );
|
||||
m_textSectionName.SetDiffuseColor( COLOR_SECTION_LETTER );
|
||||
}
|
||||
@@ -114,7 +115,20 @@ void WheelItemDisplay::LoadFromWheelItemData( WheelItemData* pWID )
|
||||
{
|
||||
|
||||
case TYPE_SECTION:
|
||||
m_textSectionName.SetText( m_sSectionName );
|
||||
if( m_sSectionName.GetLength() > 15 &&
|
||||
-1 != m_sSectionName.Find(' ', m_sSectionName.GetLength()/3) ) // this is space in the name
|
||||
{
|
||||
int iIndexSplit = m_sSectionName.Find( ' ', m_sSectionName.GetLength()/3 );
|
||||
m_sSectionName.SetAt( iIndexSplit, '\n' );
|
||||
|
||||
m_textSectionName.SetZoom( 0.75f );
|
||||
m_textSectionName.SetText( m_sSectionName );
|
||||
}
|
||||
else // this is a short name
|
||||
{
|
||||
m_textSectionName.SetZoom( 1.5f );
|
||||
m_textSectionName.SetText( m_sSectionName );
|
||||
}
|
||||
m_sprSectionBackground.SetDiffuseColor( m_colorTint );
|
||||
break;
|
||||
case TYPE_MUSIC:
|
||||
|
||||
@@ -107,6 +107,7 @@ public:
|
||||
|
||||
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; };
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
+25
-38
@@ -291,29 +291,28 @@ void splitrelpath( CString Path, CString& Dir, CString& FName, CString& Ext )
|
||||
}
|
||||
|
||||
|
||||
void GetDirListing( CString sPath, CStringArray &AddTo, BOOL bOnlyDirs )
|
||||
void GetDirListing( CString sPath, CStringArray &AddTo, bool bOnlyDirs )
|
||||
{
|
||||
WIN32_FIND_DATA fd;
|
||||
HANDLE hFind = ::FindFirstFile( sPath, &fd );
|
||||
|
||||
if( INVALID_HANDLE_VALUE != hFind )
|
||||
if( INVALID_HANDLE_VALUE == hFind ) // no files found
|
||||
return;
|
||||
|
||||
do
|
||||
{
|
||||
do
|
||||
{
|
||||
if( bOnlyDirs && !(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) )
|
||||
{
|
||||
; // do nothing
|
||||
}
|
||||
else
|
||||
{
|
||||
// add it
|
||||
CString sDirName( fd.cFileName );
|
||||
if( sDirName != "." && sDirName != ".." )
|
||||
AddTo.Add( sDirName );
|
||||
}
|
||||
} while( ::FindNextFile( hFind, &fd ) );
|
||||
::FindClose( hFind );
|
||||
}
|
||||
if( bOnlyDirs && !(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) )
|
||||
continue; // skip
|
||||
|
||||
CString sDirName( fd.cFileName );
|
||||
|
||||
if( sDirName == "." || sDirName == ".." )
|
||||
continue;
|
||||
|
||||
AddTo.Add( sDirName );
|
||||
|
||||
} while( ::FindNextFile( hFind, &fd ) );
|
||||
::FindClose( hFind );
|
||||
}
|
||||
|
||||
DWORD GetFileSizeInBytes( CString sFilePath )
|
||||
@@ -363,34 +362,20 @@ void SortCStringArray( CStringArray &arrayCStrings, BOOL bSortAcsending )
|
||||
|
||||
VOID DisplayErrorAndDie( CString sError )
|
||||
{
|
||||
/*
|
||||
////////////////////////
|
||||
// get a stack trace
|
||||
////////////////////////
|
||||
AfxDumpStack( AFX_STACK_DUMP_TARGET_CLIPBOARD );
|
||||
|
||||
//open the clipboard
|
||||
CString fromClipboard;
|
||||
if( OpenClipboard(NULL) )
|
||||
{
|
||||
HANDLE hData = GetClipboardData( CF_TEXT );
|
||||
char *buffer = (char*)GlobalLock( hData );
|
||||
fromClipboard = buffer;
|
||||
GlobalUnlock( hData );
|
||||
CloseClipboard();
|
||||
}
|
||||
sError += "\n\n" + fromClipboard;
|
||||
*/
|
||||
#ifdef DEBUG // don't use error handler in Release mode
|
||||
#ifdef DEBUG
|
||||
// display a message box, then break so we can see a stack trace in the debugger
|
||||
AfxMessageBox( sError );
|
||||
AfxDebugBreak();
|
||||
exit(1);
|
||||
#else
|
||||
|
||||
#else // RELEASE
|
||||
// write the error to a file so our pretty error dialog can display what happened.
|
||||
FILE* fp = fopen( g_sErrorFileName, "w" );
|
||||
fprintf( fp, sError );
|
||||
fclose( fp );
|
||||
// generate an exception so the error handler shows
|
||||
throw(1);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -446,3 +431,5 @@ HINSTANCE GotoURL(LPCTSTR url)
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -61,41 +61,21 @@ CString ssprintf( LPCTSTR fmt, ...);
|
||||
CString vssprintf( LPCTSTR fmt, va_list argList );
|
||||
|
||||
|
||||
/*
|
||||
@FUNCTION: Splits a Path into 4 parts (Directory, Drive, Filename, Extention).
|
||||
NOTE: Supports UNC path names.
|
||||
@PARAM1: Whether the Supplied Path (PARAM2) contains a directory name only
|
||||
or a file name (Reason: some directories will end with "xxx.xxx"
|
||||
which is like a file name).
|
||||
@PARAM2: Path to Split.
|
||||
@PARAM3: (Referenced) Directory.
|
||||
@PARAM4: (Referenced) Drive.
|
||||
@PARAM5: (Referenced) Filename.
|
||||
@PARAM6: (Referenced) Extention.
|
||||
*/
|
||||
// Splits a Path into 4 parts (Directory, Drive, Filename, Extention). Supports UNC path names.
|
||||
// param1: Whether the Supplied Path (PARAM2) contains a directory name only
|
||||
// or a file name (Reason: some directories will end with "xxx.xxx"
|
||||
// which is like a file name).
|
||||
void splitpath(BOOL UsingDirsOnly, CString Path, CString& Drive, CString& Dir, CString& FName, CString& Ext);
|
||||
|
||||
|
||||
void splitrelpath( CString Path, CString& Dir, CString& FName, CString& Ext );
|
||||
|
||||
|
||||
/*
|
||||
@FUNCTION: Splits a CString into an CStringArray according the Deliminator.
|
||||
NOTE: Supports UNC path names.
|
||||
@PARAM1: Source string to be Split.
|
||||
@PARAM2: Deliminator.
|
||||
@PARAM3: (Referenced) CStringArray to Add to.
|
||||
*/
|
||||
// Splits a CString into an CStringArray according the Deliminator. Supports UNC path names.
|
||||
void split(CString Source, CString Deliminator, CStringArray& AddIt, bool bIgnoreEmpty = true );
|
||||
|
||||
/*
|
||||
@FUNCTION: Joins a CStringArray to create a CString according the Deliminator.
|
||||
@PARAM1: Deliminator.
|
||||
@PARAM2: (Referenced) CStringArray to Add to.
|
||||
*/
|
||||
// Joins a CStringArray to create a CString according the Deliminator.
|
||||
CString join(CString Deliminator, CStringArray& Source);
|
||||
|
||||
void GetDirListing( CString sPath, CStringArray &AddTo, BOOL bOnlyDirs=FALSE );
|
||||
void GetDirListing( CString sPath, CStringArray &AddTo, bool bOnlyDirs=false );
|
||||
|
||||
bool DoesFileExist( CString sPath );
|
||||
DWORD GetFileSizeInBytes( CString sFilePath );
|
||||
@@ -113,13 +93,13 @@ void RageLogHr( HRESULT hr, LPCTSTR fmt, ...);
|
||||
//-----------------------------------------------------------------------------
|
||||
// Error helpers
|
||||
//-----------------------------------------------------------------------------
|
||||
VOID DisplayErrorAndDie( CString sError );
|
||||
|
||||
void DisplayErrorAndDie( CString sError );
|
||||
|
||||
#define RageError(str) DisplayErrorAndDie( ssprintf( "%s\n\n%s(%d)", str, __FILE__, (DWORD)__LINE__) )
|
||||
#define RageErrorHr(str,hr) DisplayErrorAndDie( ssprintf("%s (%s)\n\n%s(%d)", str, DXGetErrorString8(hr), __FILE__, (DWORD)__LINE__) )
|
||||
|
||||
|
||||
|
||||
LONG GetRegKey(HKEY key, LPCTSTR subkey, LPTSTR retdata);
|
||||
HINSTANCE GotoURL(LPCTSTR url);
|
||||
|
||||
|
||||
@@ -190,11 +190,7 @@ bool Song::LoadFromSongDir( CString sDir )
|
||||
RageError( ssprintf("Couldn't find any BMS or MSD files in '%s'", sDir) );
|
||||
}
|
||||
|
||||
RageLog( "m_fOffsetInSeconds is %f", m_fOffsetInSeconds );
|
||||
|
||||
|
||||
return TRUE;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -40,9 +40,75 @@ SongManager::~SongManager()
|
||||
|
||||
void SongManager::InitSongArrayFromDisk()
|
||||
{
|
||||
/////////////////////////////
|
||||
// Handle DWI support
|
||||
/////////////////////////////
|
||||
LoadStepManiaSongDir( "Songs" );
|
||||
LoadDWISongDir( "DWI Support" );
|
||||
RageLog( "Found %d Songs.", m_pSongs.GetSize() );
|
||||
}
|
||||
|
||||
void SongManager::LoadStepManiaSongDir( CString sDir )
|
||||
{
|
||||
// trim off the trailing slash if any
|
||||
sDir.TrimRight( "/\\" );
|
||||
|
||||
// Find all group directories in "Songs" folder
|
||||
CStringArray arrayGroupDirs;
|
||||
GetDirListing( sDir+"\\*.*", arrayGroupDirs, true );
|
||||
SortCStringArray( arrayGroupDirs );
|
||||
|
||||
for( int i=0; i< arrayGroupDirs.GetSize(); i++ ) // for each dir in /Songs/
|
||||
{
|
||||
CString sGroupDirName = arrayGroupDirs[i];
|
||||
|
||||
if( 0 == stricmp( sGroupDirName, "cvs" ) ) // the directory called "CVS"
|
||||
continue; // ignore it
|
||||
|
||||
// Check to see if they put a song directly inside of the group folder
|
||||
CStringArray arrayFiles;
|
||||
GetDirListing( ssprintf("%s\\%s\\*.mp3", sDir, sGroupDirName), arrayFiles );
|
||||
GetDirListing( ssprintf("%s\\%s\\*.wav", sDir, sGroupDirName), arrayFiles );
|
||||
if( arrayFiles.GetSize() > 0 )
|
||||
RageError(
|
||||
ssprintf( "The song folder '%s' must be placed inside of a group folder.\n\n"
|
||||
"All song folders must be placed below a group folder. For example, 'Songs\\DDR 4th Mix\\B4U'. See the StepMania readme for more info.",
|
||||
ssprintf("%s\\%s", sDir, sGroupDirName ) )
|
||||
);
|
||||
|
||||
// Look for a group banner in this group folder
|
||||
CStringArray arrayGroupBanners;
|
||||
GetDirListing( ssprintf("%s\\%s\\*.png", sDir, sGroupDirName), arrayGroupBanners );
|
||||
GetDirListing( ssprintf("%s\\%s\\*.jpg", sDir, sGroupDirName), arrayGroupBanners );
|
||||
GetDirListing( ssprintf("%s\\%s\\*.gif", sDir, sGroupDirName), arrayGroupBanners );
|
||||
GetDirListing( ssprintf("%s\\%s\\*.bmp", sDir, sGroupDirName), arrayGroupBanners );
|
||||
if( arrayGroupBanners.GetSize() > 0 )
|
||||
{
|
||||
m_mapGroupToBannerPath[sGroupDirName] = ssprintf("%s\\%s\\%s", sDir, sGroupDirName, arrayGroupBanners[0] );
|
||||
RageLog( ssprintf("Group banner for '%s' is '%s'.", sGroupDirName, m_mapGroupToBannerPath[sGroupDirName]) );
|
||||
}
|
||||
|
||||
// Find all Song folders in this group directory
|
||||
CStringArray arraySongDirs;
|
||||
GetDirListing( ssprintf("%s\\%s\\*.*", sDir, sGroupDirName), arraySongDirs, true );
|
||||
SortCStringArray( arraySongDirs );
|
||||
|
||||
for( int j=0; j< arraySongDirs.GetSize(); j++ ) // for each song dir
|
||||
{
|
||||
CString sSongDirName = arraySongDirs[j];
|
||||
|
||||
if( 0 == stricmp( sSongDirName, "cvs" ) ) // the directory called "CVS"
|
||||
continue; // ignore it
|
||||
|
||||
// this is a song directory. Load a new song!
|
||||
Song* pNewSong = new Song;
|
||||
pNewSong->LoadFromSongDir( ssprintf("%s\\%s\\%s", sDir, sGroupDirName, sSongDirName) );
|
||||
m_pSongs.Add( pNewSong );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SongManager::LoadDWISongDir( CString sDir )
|
||||
{
|
||||
// trim off the trailing slash if any
|
||||
sDir.TrimRight( "/\\" );
|
||||
|
||||
// Find all directories in "DWIs" folder
|
||||
CStringArray arrayDirs;
|
||||
@@ -72,51 +138,10 @@ void SongManager::InitSongArrayFromDisk()
|
||||
m_pSongs.Add( pNewSong );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////
|
||||
// Load songs from StepMania's directory structure in Songs
|
||||
/////////////////////////////
|
||||
|
||||
// Find all group directories in "Songs" folder
|
||||
CStringArray arrayGroupDirs;
|
||||
GetDirListing( "Songs\\*.*", arrayGroupDirs, true );
|
||||
SortCStringArray( arrayGroupDirs );
|
||||
|
||||
for( i=0; i< arrayGroupDirs.GetSize(); i++ ) // for each dir in /Songs/
|
||||
{
|
||||
CString sGroupDirName = arrayGroupDirs[i];
|
||||
sGroupDirName.MakeLower();
|
||||
|
||||
if( sGroupDirName == "cvs" ) // ignore the directory called "CVS"
|
||||
continue;
|
||||
|
||||
// Find all Song folders in this group directory
|
||||
CStringArray arraySongDirs;
|
||||
GetDirListing( ssprintf("Songs\\%s\\*.*", sGroupDirName, true), arraySongDirs );
|
||||
SortCStringArray( arraySongDirs );
|
||||
|
||||
for( int j=0; j< arraySongDirs.GetSize(); j++ ) // for each song dir
|
||||
{
|
||||
CString sSongDirName = arraySongDirs[j];
|
||||
sSongDirName.MakeLower();
|
||||
|
||||
if( sSongDirName == "cvs" ) // ignore the directory called "CVS"
|
||||
continue;
|
||||
|
||||
// load DWIs from the sub dirs
|
||||
Song* pNewSong = new Song;
|
||||
pNewSong->LoadFromSongDir( ssprintf("Songs\\%s\\%s", sGroupDirName, sSongDirName) );
|
||||
m_pSongs.Add( pNewSong );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
RageLog( "Found %d Songs.", m_pSongs.GetSize() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SongManager::CleanUpSongArray()
|
||||
{
|
||||
for( int i=0; i<m_pSongs.GetSize(); i++ )
|
||||
@@ -125,6 +150,7 @@ void SongManager::CleanUpSongArray()
|
||||
}
|
||||
|
||||
m_pSongs.RemoveAll();
|
||||
m_mapGroupToBannerPath.RemoveAll();
|
||||
}
|
||||
|
||||
|
||||
@@ -141,8 +167,8 @@ void SongManager::ReadStatisticsFromDisk()
|
||||
IniFile ini;
|
||||
ini.SetPath( g_sStatisticsFileName );
|
||||
if( !ini.ReadFile() ) {
|
||||
RageLog( "WARNING: Could not read config file '%s'.", g_sStatisticsFileName );
|
||||
return; // load nothing
|
||||
//RageError( "could not read config file" );
|
||||
}
|
||||
|
||||
|
||||
@@ -253,4 +279,15 @@ void SongManager::SaveStatisticsToDisk()
|
||||
}
|
||||
|
||||
ini.WriteFile();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CString SongManager::GetBannerPathFromGroup( CString sGroupName )
|
||||
{
|
||||
CString sPath;
|
||||
|
||||
if( m_mapGroupToBannerPath.Lookup( sGroupName, sPath ) )
|
||||
return sPath;
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -29,13 +29,21 @@ public:
|
||||
Steps* m_pStepsPlayer[NUM_PLAYERS];
|
||||
|
||||
void InitSongArrayFromDisk();
|
||||
|
||||
void CleanUpSongArray();
|
||||
void ReloadSongArray();
|
||||
|
||||
|
||||
void ReadStatisticsFromDisk();
|
||||
void SaveStatisticsToDisk();
|
||||
|
||||
|
||||
CString GetBannerPathFromGroup( CString sGroupName );
|
||||
|
||||
protected:
|
||||
void LoadStepManiaSongDir( CString sDir );
|
||||
void LoadDWISongDir( CString sDir );
|
||||
CMapStringToString m_mapGroupToBannerPath; // each song group has a banner associated with it
|
||||
|
||||
};
|
||||
|
||||
|
||||
+55
-12
@@ -132,20 +132,63 @@ BITMAP_ERROR BITMAP DISCARDABLE "error.bmp"
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_ERROR_DIALOG DIALOG DISCARDABLE 0, 0, 332, 234
|
||||
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION
|
||||
CAPTION "StepMania Error"
|
||||
IDD_ERROR_DIALOG DIALOGEX 0, 0, 320, 202
|
||||
STYLE WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||
EXSTYLE WS_EX_APPWINDOW
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
EDITTEXT IDC_EDIT_ERROR,5,80,320,80,ES_CENTER | ES_MULTILINE |
|
||||
ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP
|
||||
DEFPUSHBUTTON "Close",IDOK,265,215,60,15
|
||||
CONTROL 129,IDC_STATIC,"Static",SS_BITMAP,0,0,258,37
|
||||
LTEXT "We're sorry. An error has occurred while running StepMania.\r\n\r\nMore specific details about the error may be listeted in the box below:",
|
||||
IDC_STATIC,7,47,298,28
|
||||
PUSHBUTTON "Restart StepMania",IDC_BUTTON_RESTART,175,215,80,15
|
||||
PUSHBUTTON "Report the Error",IDC_BUTTON_REPORT,120,190,80,15
|
||||
PUSHBUTTON "View Log",IDC_BUTTON_VIEW_LOG,120,170,80,15
|
||||
CONTROL "",IDC_SHOCKWAVEFLASH1,
|
||||
"{D27CDB6E-AE6D-11CF-96B8-444553540000}",WS_TABSTOP,0,0,
|
||||
319,201
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO DISCARDABLE
|
||||
BEGIN
|
||||
IDD_ERROR_DIALOG, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 313
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 195
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog Info
|
||||
//
|
||||
|
||||
IDD_ERROR_DIALOG DLGINIT
|
||||
BEGIN
|
||||
IDC_SHOCKWAVEFLASH1, 0x376, 308, 0
|
||||
0x0000, 0x0000, 0x5567, 0x5566, 0x0300, 0x0000, 0x3182, 0x0000, 0x21cc,
|
||||
0x0000, 0x0008, 0x004a, 0x0000, 0x0066, 0x0069, 0x006c, 0x0065, 0x003a,
|
||||
0x002f, 0x002f, 0x002f, 0x0064, 0x003a, 0x005c, 0x0064, 0x0065, 0x0076,
|
||||
0x005c, 0x0066, 0x006c, 0x0061, 0x0073, 0x0068, 0x0020, 0x0074, 0x0065,
|
||||
0x0073, 0x0074, 0x005c, 0x0066, 0x0069, 0x0067, 0x0068, 0x0074, 0x0033,
|
||||
0x002e, 0x0073, 0x0077, 0x0066, 0x0000, 0x0008, 0x004a, 0x0000, 0x0066,
|
||||
0x0069, 0x006c, 0x0065, 0x003a, 0x002f, 0x002f, 0x002f, 0x0064, 0x003a,
|
||||
0x005c, 0x0064, 0x0065, 0x0076, 0x005c, 0x0066, 0x006c, 0x0061, 0x0073,
|
||||
0x0068, 0x0020, 0x0074, 0x0065, 0x0073, 0x0074, 0x005c, 0x0066, 0x0069,
|
||||
0x0067, 0x0068, 0x0074, 0x0033, 0x002e, 0x0073, 0x0077, 0x0066, 0x0000,
|
||||
0x0008, 0x000e, 0x0000, 0x0057, 0x0069, 0x006e, 0x0064, 0x006f, 0x0077,
|
||||
0x0000, 0x000b, 0xffff, 0x000b, 0xffff, 0x0008, 0x000a, 0x0000, 0x0048,
|
||||
0x0069, 0x0067, 0x0068, 0x0000, 0x0008, 0x0002, 0x0000, 0x0000, 0x000b,
|
||||
0xffff, 0x0008, 0x0002, 0x0000, 0x0000, 0x0008, 0x0010, 0x0000, 0x0053,
|
||||
0x0068, 0x006f, 0x0077, 0x0041, 0x006c, 0x006c, 0x0000, 0x000b, 0x0000,
|
||||
0x000b, 0x0000, 0x0008, 0x0002, 0x0000, 0x0000, 0x0008, 0x0002, 0x0000,
|
||||
0x0000, 0x0008, 0x000c, 0x0000, 0x0062, 0x0065, 0x006c, 0x006f, 0x0077,
|
||||
0x0000,
|
||||
0
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "ScreenDimensions.h"
|
||||
|
||||
#include "DXUtil.h"
|
||||
#include <Afxdisp.h>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Links
|
||||
@@ -86,6 +87,7 @@ BOOL SwitchDisplayMode();// BOOL bWindowed, DWORD dwWidth, DWORD dwHeight, DWORD
|
||||
//-----------------------------------------------------------------------------
|
||||
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow )
|
||||
{
|
||||
AfxEnableControlContainer();
|
||||
|
||||
#ifndef DEBUG // don't use error handler in Release mode
|
||||
try
|
||||
@@ -198,14 +200,17 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow )
|
||||
UnregisterClass( g_sAppClassName, hInstance );
|
||||
CoUninitialize(); // Uninitialize COM
|
||||
|
||||
#ifndef DEBUG // don't use error handler in Release mode
|
||||
}
|
||||
|
||||
|
||||
#ifndef DEBUG // only use pretty error handler in RELEASE build
|
||||
}
|
||||
catch(...) // catch all exceptions
|
||||
{
|
||||
CloseHandle( g_hMutex );
|
||||
DestroyObjects(); // deallocate our game objects and leave fullscreen
|
||||
ShowWindow( g_hWndMain, SW_HIDE );
|
||||
|
||||
// throw up a pretty error dialog
|
||||
DialogBox(
|
||||
hInstance,
|
||||
MAKEINTRESOURCE(IDD_ERROR_DIALOG),
|
||||
@@ -213,13 +218,11 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow )
|
||||
ErrorWndProc
|
||||
);
|
||||
exit( 1 );
|
||||
|
||||
DestroyWindow( g_hWndMain );
|
||||
UnregisterClass( g_sAppClassName, hInstance );
|
||||
CoUninitialize(); // Uninitialize COM
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
return 0L;
|
||||
}
|
||||
|
||||
@@ -352,7 +355,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
|
||||
|
||||
case WM_SETCURSOR:
|
||||
// Turn off Windows cursor in fullscreen mode
|
||||
if( !SCREEN->IsWindowed() )
|
||||
if( SCREEN && !SCREEN->IsWindowed() )
|
||||
{
|
||||
SetCursor( NULL );
|
||||
return TRUE; // prevent Windows from setting the cursor
|
||||
@@ -411,7 +414,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
|
||||
}
|
||||
case WM_NCHITTEST:
|
||||
// Prevent the user from selecting the menu in fullscreen mode
|
||||
if( !SCREEN->IsWindowed() )
|
||||
if( SCREEN && !SCREEN->IsWindowed() )
|
||||
return HTCLIENT;
|
||||
break;
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
//
|
||||
#define IDD_ERROR_DIALOG 111
|
||||
#define BITMAP_ERROR 129
|
||||
#define IDC_SHOCKWAVEFLASH1 1000
|
||||
#define IDR_MAIN_ACCEL 1001
|
||||
#define IDC_BUTTON_RESTART 1001
|
||||
#define IDM_TOGGLEFULLSCREEN 1002
|
||||
@@ -22,7 +23,7 @@
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 112
|
||||
#define _APS_NEXT_RESOURCE_VALUE 113
|
||||
#define _APS_NEXT_COMMAND_VALUE 40009
|
||||
#define _APS_NEXT_CONTROL_VALUE 1009
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
|
||||
Reference in New Issue
Block a user