no message

This commit is contained in:
Chris Danford
2002-03-06 08:25:09 +00:00
parent 42c3642d0b
commit 044ac127da
13 changed files with 236 additions and 154 deletions
+17 -7
View File
@@ -19,11 +19,24 @@
bool Banner::LoadFromSong( Song* pSong ) // NULL means no song bool Banner::LoadFromSong( Song* pSong ) // NULL means no song
{ {
if( pSong == NULL ) 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() ) Sprite::Load( pSong->GetBannerPath(), HINT_NOMIPMAPS ); else if( pSong->HasBanner() ) Banner::Load( pSong->GetBannerPath(), HINT_NOMIPMAPS );
else if( pSong->HasBackground() ) Sprite::Load( pSong->GetBackgroundPath(), HINT_NOMIPMAPS ); else if( pSong->HasBackground() ) Banner::Load( pSong->GetBackgroundPath(), HINT_NOMIPMAPS );
else Sprite::Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BANNER), 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(); Sprite::TurnShadowOff();
int iImageWidth = m_pTexture->GetImageWidth(); int iImageWidth = m_pTexture->GetImageWidth();
@@ -93,7 +106,4 @@ bool Banner::LoadFromSong( Song* pSong ) // NULL means no song
// restore original XY // restore original XY
SetXY( fOriginalX, fOriginalY ); SetXY( fOriginalX, fOriginalY );
return true;
} }
+3 -1
View File
@@ -23,9 +23,11 @@ const float BANNER_HEIGHT = 86;
class Banner : public Sprite class Banner : public Sprite
{ {
public: public:
bool LoadFromSong( Song* pSong ); // NULL means no Song bool LoadFromSong( Song* pSong ); // NULL means no Song
virtual bool Load( CString sFilePath, DWORD dwHints = 0, bool bForceReload = false );
protected:
void CropToRightSize();
}; };
+4 -4
View File
@@ -213,12 +213,12 @@ void BitmapText::RebuildVertexBuffer()
m_iNumV = 0; // the current vertex number m_iNumV = 0; // the current vertex number
float fHeight = GetUnzoomedHeight(); float fHeight = GetUnzoomedHeight();
float fY; float fY; // the center of the first line
switch( m_VertAlign ) switch( m_VertAlign )
{ {
case align_top: fY = -(m_sTextLines.GetSize()) * fHeight / 2; break; case align_top: fY = -(m_sTextLines.GetSize()-1) * fHeight; break;
case align_middle: fY = 0; break; case align_middle: fY = -(m_sTextLines.GetSize()-1) * fHeight / 2; break;
case align_bottom: fY = (m_sTextLines.GetSize()) * fHeight / 2; break; case align_bottom: fY = 0; break;
default: ASSERT( false ); default: ASSERT( false );
} }
+16 -2
View File
@@ -89,8 +89,9 @@ WheelItemDisplay::WheelItemDisplay()
m_textSectionName.Load( THEME->GetPathTo(FONT_OUTLINE) ); m_textSectionName.Load( THEME->GetPathTo(FONT_OUTLINE) );
m_textSectionName.TurnShadowOff(); m_textSectionName.TurnShadowOff();
m_textSectionName.SetHorizAlign( align_left ); m_textSectionName.SetHorizAlign( align_center );
m_textSectionName.SetXY( -85, 0 ); m_textSectionName.SetVertAlign( align_middle );
m_textSectionName.SetXY( m_sprSectionBackground.GetX(), 0 );
m_textSectionName.SetZoom( 1.5f ); m_textSectionName.SetZoom( 1.5f );
m_textSectionName.SetDiffuseColor( COLOR_SECTION_LETTER ); m_textSectionName.SetDiffuseColor( COLOR_SECTION_LETTER );
} }
@@ -114,7 +115,20 @@ void WheelItemDisplay::LoadFromWheelItemData( WheelItemData* pWID )
{ {
case TYPE_SECTION: case TYPE_SECTION:
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 ); 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 ); m_sprSectionBackground.SetDiffuseColor( m_colorTint );
break; break;
case TYPE_MUSIC: case TYPE_MUSIC:
+1
View File
@@ -107,6 +107,7 @@ public:
bool Select(); // return true if the selected item is a music, otherwise false bool Select(); // return true if the selected item is a music, otherwise false
Song* GetSelectedSong() { return GetCurWheelItemDatas()[m_iSelection].m_pSong; }; Song* GetSelectedSong() { return GetCurWheelItemDatas()[m_iSelection].m_pSong; };
CString GetSelectedSection() { return GetCurWheelItemDatas()[m_iSelection].m_sSectionName; };
protected: protected:
+19 -32
View File
@@ -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; WIN32_FIND_DATA fd;
HANDLE hFind = ::FindFirstFile( sPath, &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) ) if( bOnlyDirs && !(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) )
{ continue; // skip
; // do nothing
}
else
{
// add it
CString sDirName( fd.cFileName ); CString sDirName( fd.cFileName );
if( sDirName != "." && sDirName != ".." )
if( sDirName == "." || sDirName == ".." )
continue;
AddTo.Add( sDirName ); AddTo.Add( sDirName );
}
} while( ::FindNextFile( hFind, &fd ) ); } while( ::FindNextFile( hFind, &fd ) );
::FindClose( hFind ); ::FindClose( hFind );
}
} }
DWORD GetFileSizeInBytes( CString sFilePath ) DWORD GetFileSizeInBytes( CString sFilePath )
@@ -363,34 +362,20 @@ void SortCStringArray( CStringArray &arrayCStrings, BOOL bSortAcsending )
VOID DisplayErrorAndDie( CString sError ) VOID DisplayErrorAndDie( CString sError )
{ {
/* #ifdef DEBUG
//////////////////////// // display a message box, then break so we can see a stack trace in the debugger
// 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
AfxMessageBox( sError ); AfxMessageBox( sError );
AfxDebugBreak(); AfxDebugBreak();
exit(1); 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" ); FILE* fp = fopen( g_sErrorFileName, "w" );
fprintf( fp, sError ); fprintf( fp, sError );
fclose( fp ); fclose( fp );
// generate an exception so the error handler shows // generate an exception so the error handler shows
throw(1); throw(1);
#endif #endif
} }
@@ -446,3 +431,5 @@ HINSTANCE GotoURL(LPCTSTR url)
return result; return result;
} }
+9 -29
View File
@@ -61,41 +61,21 @@ CString ssprintf( LPCTSTR fmt, ...);
CString vssprintf( LPCTSTR fmt, va_list argList ); CString vssprintf( LPCTSTR fmt, va_list argList );
/* // Splits a Path into 4 parts (Directory, Drive, Filename, Extention). Supports UNC path names.
@FUNCTION: Splits a Path into 4 parts (Directory, Drive, Filename, Extention). // param1: Whether the Supplied Path (PARAM2) contains a directory name only
NOTE: Supports UNC path names. // or a file name (Reason: some directories will end with "xxx.xxx"
@PARAM1: Whether the Supplied Path (PARAM2) contains a directory name only // which is like a file name).
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.
*/
void splitpath(BOOL UsingDirsOnly, CString Path, CString& Drive, CString& Dir, CString& FName, CString& Ext); void splitpath(BOOL UsingDirsOnly, CString Path, CString& Drive, CString& Dir, CString& FName, CString& Ext);
void splitrelpath( CString Path, CString& Dir, CString& FName, CString& Ext ); void splitrelpath( CString Path, CString& Dir, CString& FName, CString& Ext );
// Splits a CString into an CStringArray according the Deliminator. Supports UNC path names.
/*
@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.
*/
void split(CString Source, CString Deliminator, CStringArray& AddIt, bool bIgnoreEmpty = true ); void split(CString Source, CString Deliminator, CStringArray& AddIt, bool bIgnoreEmpty = true );
/* // Joins a CStringArray to create a CString according the Deliminator.
@FUNCTION: Joins a CStringArray to create a CString according the Deliminator.
@PARAM1: Deliminator.
@PARAM2: (Referenced) CStringArray to Add to.
*/
CString join(CString Deliminator, CStringArray& Source); 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 ); bool DoesFileExist( CString sPath );
DWORD GetFileSizeInBytes( CString sFilePath ); DWORD GetFileSizeInBytes( CString sFilePath );
@@ -113,13 +93,13 @@ void RageLogHr( HRESULT hr, LPCTSTR fmt, ...);
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Error helpers // 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 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__) ) #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); LONG GetRegKey(HKEY key, LPCTSTR subkey, LPTSTR retdata);
HINSTANCE GotoURL(LPCTSTR url); HINSTANCE GotoURL(LPCTSTR url);
-4
View File
@@ -190,11 +190,7 @@ bool Song::LoadFromSongDir( CString sDir )
RageError( ssprintf("Couldn't find any BMS or MSD files in '%s'", sDir) ); RageError( ssprintf("Couldn't find any BMS or MSD files in '%s'", sDir) );
} }
RageLog( "m_fOffsetInSeconds is %f", m_fOffsetInSeconds );
return TRUE; return TRUE;
} }
+83 -46
View File
@@ -40,9 +40,75 @@ SongManager::~SongManager()
void SongManager::InitSongArrayFromDisk() void SongManager::InitSongArrayFromDisk()
{ {
///////////////////////////// LoadStepManiaSongDir( "Songs" );
// Handle DWI support 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 // Find all directories in "DWIs" folder
CStringArray arrayDirs; CStringArray arrayDirs;
@@ -72,51 +138,10 @@ void SongManager::InitSongArrayFromDisk()
m_pSongs.Add( pNewSong ); 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() void SongManager::CleanUpSongArray()
{ {
for( int i=0; i<m_pSongs.GetSize(); i++ ) for( int i=0; i<m_pSongs.GetSize(); i++ )
@@ -125,6 +150,7 @@ void SongManager::CleanUpSongArray()
} }
m_pSongs.RemoveAll(); m_pSongs.RemoveAll();
m_mapGroupToBannerPath.RemoveAll();
} }
@@ -141,8 +167,8 @@ void SongManager::ReadStatisticsFromDisk()
IniFile ini; IniFile ini;
ini.SetPath( g_sStatisticsFileName ); ini.SetPath( g_sStatisticsFileName );
if( !ini.ReadFile() ) { if( !ini.ReadFile() ) {
RageLog( "WARNING: Could not read config file '%s'.", g_sStatisticsFileName );
return; // load nothing return; // load nothing
//RageError( "could not read config file" );
} }
@@ -254,3 +280,14 @@ void SongManager::SaveStatisticsToDisk()
ini.WriteFile(); ini.WriteFile();
} }
CString SongManager::GetBannerPathFromGroup( CString sGroupName )
{
CString sPath;
if( m_mapGroupToBannerPath.Lookup( sGroupName, sPath ) )
return sPath;
else
return "";
}
+8
View File
@@ -29,13 +29,21 @@ public:
Steps* m_pStepsPlayer[NUM_PLAYERS]; Steps* m_pStepsPlayer[NUM_PLAYERS];
void InitSongArrayFromDisk(); void InitSongArrayFromDisk();
void CleanUpSongArray(); void CleanUpSongArray();
void ReloadSongArray(); void ReloadSongArray();
void ReadStatisticsFromDisk(); void ReadStatisticsFromDisk();
void SaveStatisticsToDisk(); void SaveStatisticsToDisk();
CString GetBannerPathFromGroup( CString sGroupName );
protected: protected:
void LoadStepManiaSongDir( CString sDir );
void LoadDWISongDir( CString sDir );
CMapStringToString m_mapGroupToBannerPath; // each song group has a banner associated with it
}; };
+55 -12
View File
@@ -132,20 +132,63 @@ BITMAP_ERROR BITMAP DISCARDABLE "error.bmp"
// Dialog // Dialog
// //
IDD_ERROR_DIALOG DIALOG DISCARDABLE 0, 0, 332, 234 IDD_ERROR_DIALOG DIALOGEX 0, 0, 320, 202
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION STYLE WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "StepMania Error" EXSTYLE WS_EX_APPWINDOW
FONT 8, "MS Sans Serif" FONT 8, "MS Sans Serif"
BEGIN BEGIN
EDITTEXT IDC_EDIT_ERROR,5,80,320,80,ES_CENTER | ES_MULTILINE | CONTROL "",IDC_SHOCKWAVEFLASH1,
ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP "{D27CDB6E-AE6D-11CF-96B8-444553540000}",WS_TABSTOP,0,0,
DEFPUSHBUTTON "Close",IDOK,265,215,60,15 319,201
CONTROL 129,IDC_STATIC,"Static",SS_BITMAP,0,0,258,37 END
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 // 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 END
#endif // English (U.S.) resources #endif // English (U.S.) resources
+10 -7
View File
@@ -34,6 +34,7 @@
#include "ScreenDimensions.h" #include "ScreenDimensions.h"
#include "DXUtil.h" #include "DXUtil.h"
#include <Afxdisp.h>
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Links // Links
@@ -86,6 +87,7 @@ BOOL SwitchDisplayMode();// BOOL bWindowed, DWORD dwWidth, DWORD dwHeight, DWORD
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow ) int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow )
{ {
AfxEnableControlContainer();
#ifndef DEBUG // don't use error handler in Release mode #ifndef DEBUG // don't use error handler in Release mode
try try
@@ -198,7 +200,9 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow )
UnregisterClass( g_sAppClassName, hInstance ); UnregisterClass( g_sAppClassName, hInstance );
CoUninitialize(); // Uninitialize COM 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 catch(...) // catch all exceptions
{ {
@@ -206,6 +210,7 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow )
DestroyObjects(); // deallocate our game objects and leave fullscreen DestroyObjects(); // deallocate our game objects and leave fullscreen
ShowWindow( g_hWndMain, SW_HIDE ); ShowWindow( g_hWndMain, SW_HIDE );
// throw up a pretty error dialog
DialogBox( DialogBox(
hInstance, hInstance,
MAKEINTRESOURCE(IDD_ERROR_DIALOG), MAKEINTRESOURCE(IDD_ERROR_DIALOG),
@@ -213,13 +218,11 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR, int nCmdShow )
ErrorWndProc ErrorWndProc
); );
exit( 1 ); exit( 1 );
DestroyWindow( g_hWndMain );
UnregisterClass( g_sAppClassName, hInstance );
CoUninitialize(); // Uninitialize COM
} }
#endif #endif
return 0L; return 0L;
} }
@@ -352,7 +355,7 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
case WM_SETCURSOR: case WM_SETCURSOR:
// Turn off Windows cursor in fullscreen mode // Turn off Windows cursor in fullscreen mode
if( !SCREEN->IsWindowed() ) if( SCREEN && !SCREEN->IsWindowed() )
{ {
SetCursor( NULL ); SetCursor( NULL );
return TRUE; // prevent Windows from setting the cursor 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: case WM_NCHITTEST:
// Prevent the user from selecting the menu in fullscreen mode // Prevent the user from selecting the menu in fullscreen mode
if( !SCREEN->IsWindowed() ) if( SCREEN && !SCREEN->IsWindowed() )
return HTCLIENT; return HTCLIENT;
break; break;
+2 -1
View File
@@ -4,6 +4,7 @@
// //
#define IDD_ERROR_DIALOG 111 #define IDD_ERROR_DIALOG 111
#define BITMAP_ERROR 129 #define BITMAP_ERROR 129
#define IDC_SHOCKWAVEFLASH1 1000
#define IDR_MAIN_ACCEL 1001 #define IDR_MAIN_ACCEL 1001
#define IDC_BUTTON_RESTART 1001 #define IDC_BUTTON_RESTART 1001
#define IDM_TOGGLEFULLSCREEN 1002 #define IDM_TOGGLEFULLSCREEN 1002
@@ -22,7 +23,7 @@
// //
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #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_COMMAND_VALUE 40009
#define _APS_NEXT_CONTROL_VALUE 1009 #define _APS_NEXT_CONTROL_VALUE 1009
#define _APS_NEXT_SYMED_VALUE 101 #define _APS_NEXT_SYMED_VALUE 101