JA2 Splash.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #ifdef PRECOMPILEDHEADERS
  2. #include "JA2 All.h"
  3. #else
  4. //add includes here!
  5. #endif
  6. UINT32 guiSplashFrameFade = 10;
  7. UINT32 guiSplashStartTime = 0;
  8. extern HVSURFACE ghFrameBuffer;
  9. //Simply create videosurface, load image, and draw it to the screen.
  10. void InitJA2SplashScreen()
  11. {
  12. UINT32 uiLogoID = 0;
  13. STRING512 CurrentDir;
  14. STRING512 DataDir;
  15. HVSURFACE hVSurface;
  16. VSURFACE_DESC VSurfaceDesc;
  17. INT32 i = 0;
  18. InitializeJA2Clock();
  19. //InitializeJA2TimerID();
  20. // Get Executable Directory
  21. GetExecutableDirectory( CurrentDir );
  22. // Adjust Current Dir
  23. sprintf( DataDir, "%s\\Data", CurrentDir );
  24. if ( !SetFileManCurrentDirectory( DataDir ) )
  25. {
  26. DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Could not find data directory, shutting down");
  27. return;
  28. }
  29. //Initialize the file database
  30. InitializeFileDatabase( gGameLibaries, NUMBER_OF_LIBRARIES );
  31. #if !defined( ENGLISH ) && defined( JA2TESTVERSION )
  32. memset( &VSurfaceDesc, 0, sizeof( VSURFACE_DESC ) );
  33. VSurfaceDesc.fCreateFlags = VSURFACE_CREATE_FROMFILE | VSURFACE_SYSTEM_MEM_USAGE;
  34. sprintf( VSurfaceDesc.ImageFile, "LOADSCREENS\\Notification.sti" );
  35. if( !AddVideoSurface( &VSurfaceDesc, &uiLogoID ) )
  36. {
  37. AssertMsg( 0, String( "Failed to load %s", VSurfaceDesc.ImageFile ) );
  38. return;
  39. }
  40. GetVideoSurface(&hVSurface, uiLogoID );
  41. BltVideoSurfaceToVideoSurface( ghFrameBuffer, hVSurface, 0, 0, 0, 0, NULL );
  42. DeleteVideoSurfaceFromIndex( uiLogoID );
  43. InvalidateScreen();
  44. RefreshScreen( NULL );
  45. guiSplashStartTime = GetJA2Clock();
  46. while( i < 60 * 15 )//guiSplashStartTime + 15000 > GetJA2Clock() )
  47. {
  48. //Allow the user to pick his bum.
  49. InvalidateScreen();
  50. RefreshScreen( NULL );
  51. i++;
  52. }
  53. #endif
  54. #ifdef ENGLISH
  55. ClearMainMenu();
  56. #else
  57. {
  58. memset( &VSurfaceDesc, 0, sizeof( VSURFACE_DESC ) );
  59. VSurfaceDesc.fCreateFlags = VSURFACE_CREATE_FROMFILE | VSURFACE_SYSTEM_MEM_USAGE;
  60. GetMLGFilename( VSurfaceDesc.ImageFile, MLG_SPLASH );
  61. if( !AddVideoSurface( &VSurfaceDesc, &uiLogoID ) )
  62. {
  63. AssertMsg( 0, String( "Failed to load %s", VSurfaceDesc.ImageFile ) );
  64. return;
  65. }
  66. GetVideoSurface( &hVSurface, uiLogoID );
  67. BltVideoSurfaceToVideoSurface( ghFrameBuffer, hVSurface, 0, 0, 0, 0, NULL );
  68. DeleteVideoSurfaceFromIndex( uiLogoID );
  69. }
  70. #endif
  71. InvalidateScreen();
  72. RefreshScreen( NULL );
  73. guiSplashStartTime = GetJA2Clock();
  74. }