BOOLEAN DisplayCreditNode( CRDT_NODE *pCurrent ) { HVSURFACE hVSurface; //Currently, we have no need to display a node that doesnt have a string if( pCurrent->pString == NULL ) return( FALSE ); //if the node is new and we havent displayed it yet if( pCurrent->uiLastTime == 0 ) { } //else we have to restore were the string was else { // //Restore the background before blitting the text back on // //if the surface is at the bottom of the screen if( pCurrent->sOldPosY + pCurrent->sHeightOfString > CRDT_START_POS_Y ) { INT16 sHeight = SCREEN_HEIGHT - pCurrent->sOldPosY; //INT16 sHeight = 480 - pCurrent->sOldPosY; RestoreExternBackgroundRect( pCurrent->sOldPosX, pCurrent->sOldPosY, CRDT_WIDTH_OF_TEXT_AREA, sHeight ); } else if( pCurrent->sOldPosY > CRDT_LINE_NODE_DISAPPEARS_AT ) { RestoreExternBackgroundRect( pCurrent->sOldPosX, pCurrent->sOldPosY, CRDT_WIDTH_OF_TEXT_AREA, pCurrent->sHeightOfString ); } //if the surface is at the top of the screen else { INT16 sHeight = pCurrent->sOldPosY + pCurrent->sHeightOfString; RestoreExternBackgroundRect( pCurrent->sOldPosX, CRDT_LINE_NODE_DISAPPEARS_AT, CRDT_WIDTH_OF_TEXT_AREA, sHeight ); } } GetVideoSurface( &hVSurface, pCurrent->uiVideoSurfaceImage ); BltVideoSurfaceToVideoSurface( ghFrameBuffer, hVSurface, 0, pCurrent->sPosX, pCurrent->sPosY, VS_BLT_CLIPPED | VS_BLT_USECOLORKEY, NULL ); return( TRUE ); }
//sets up the loadscreen with specified ID, and draws it to the FRAME_BUFFER, //and refreshing the screen with it. void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) { VSURFACE_DESC vs_desc; HVSURFACE hVSurface; UINT32 uiLoadScreen; vs_desc.fCreateFlags = VSURFACE_CREATE_FROMFILE | VSURFACE_SYSTEM_MEM_USAGE; switch( ubLoadScreenID ) { case LOADINGSCREEN_NOTHING: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_Heli.sti"); break; case LOADINGSCREEN_DAYGENERIC: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayGeneric.sti"); break; case LOADINGSCREEN_DAYTOWN1: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayTown1.sti"); break; case LOADINGSCREEN_DAYTOWN2: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayTown2.sti"); break; case LOADINGSCREEN_DAYWILD: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayWild.sti"); break; case LOADINGSCREEN_DAYTROPICAL: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayTropical.sti"); break; case LOADINGSCREEN_DAYFOREST: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayForest.sti"); break; case LOADINGSCREEN_DAYDESERT: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayDesert.sti"); break; case LOADINGSCREEN_DAYPALACE: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayPalace.sti"); break; case LOADINGSCREEN_NIGHTGENERIC: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightGeneric.sti"); break; case LOADINGSCREEN_NIGHTWILD: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightWild.sti"); break; case LOADINGSCREEN_NIGHTTOWN1: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightTown1.sti"); break; case LOADINGSCREEN_NIGHTTOWN2: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightTown2.sti"); break; case LOADINGSCREEN_NIGHTFOREST: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightForest.sti"); break; case LOADINGSCREEN_NIGHTTROPICAL: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightTropical.sti"); break; case LOADINGSCREEN_NIGHTDESERT: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightDesert.sti"); break; case LOADINGSCREEN_NIGHTPALACE: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightPalace.sti"); break; case LOADINGSCREEN_HELI: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_Heli.sti"); break; case LOADINGSCREEN_BASEMENT: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_Basement.sti"); break; case LOADINGSCREEN_MINE: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_Mine.sti"); break; case LOADINGSCREEN_CAVE: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_Cave.sti"); break; case LOADINGSCREEN_DAYPINE: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayPine.sti"); break; case LOADINGSCREEN_NIGHTPINE: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightPine.sti"); break; case LOADINGSCREEN_DAYMILITARY: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayMilitary.sti"); break; case LOADINGSCREEN_NIGHTMILITARY: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightMilitary.sti"); break; case LOADINGSCREEN_DAYSAM: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DaySAM.sti"); break; case LOADINGSCREEN_NIGHTSAM: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightSAM.sti"); break; case LOADINGSCREEN_DAYPRISON: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayPrison.sti"); break; case LOADINGSCREEN_NIGHTPRISON: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightPrison.sti"); break; case LOADINGSCREEN_DAYHOSPITAL: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayHospital.sti"); break; case LOADINGSCREEN_NIGHTHOSPITAL: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightHospital.sti"); break; case LOADINGSCREEN_DAYAIRPORT: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayAirport.sti"); break; case LOADINGSCREEN_NIGHTAIRPORT: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightAirport.sti"); break; case LOADINGSCREEN_DAYLAB: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayLab.sti"); break; case LOADINGSCREEN_NIGHTLAB: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightLab.sti"); break; case LOADINGSCREEN_DAYOMERTA: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayOmerta.sti"); break; case LOADINGSCREEN_NIGHTOMERTA: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightOmerta.sti"); break; case LOADINGSCREEN_DAYCHITZENA: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayChitzena.sti"); break; case LOADINGSCREEN_NIGHTCHITZENA: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightChitzena.sti"); break; case LOADINGSCREEN_DAYMINE: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayMine.sti" ); break; case LOADINGSCREEN_NIGHTMINE: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightMine.sti" ); break; case LOADINGSCREEN_DAYBALIME: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_DayBalime.sti" ); break; case LOADINGSCREEN_NIGHTBALIME: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_NightBalime.sti" ); break; default: strcpy(vs_desc.ImageFile, "LOADSCREENS\\LS_Heli.sti"); break; } if( gfSchedulesHosed ) { SetFont( FONT10ARIAL ); SetFontForeground( FONT_YELLOW ); SetFontShadow( FONT_NEARBLACK ); ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, 640, 480, 0 ); mprintf( 5, 5, L"Error loading save, attempting to patch save to version 1.02...", vs_desc.ImageFile ); } else if( AddVideoSurface( &vs_desc, &uiLoadScreen ) ) { //Blit the background image GetVideoSurface( &hVSurface, uiLoadScreen ); BltVideoSurfaceToVideoSurface( ghFrameBuffer, hVSurface, 0, 0, 0, 0, NULL ); DeleteVideoSurfaceFromIndex( uiLoadScreen ); } else { //Failed to load the file, so use a black screen and print out message. SetFont( FONT10ARIAL ); SetFontForeground( FONT_YELLOW ); SetFontShadow( FONT_NEARBLACK ); ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, 0, 640, 480, 0 ); mprintf( 5, 5, L"%S loadscreen data file not found...", vs_desc.ImageFile ); } gubLastLoadingScreenID = ubLoadScreenID; InvalidateScreen( ); ExecuteBaseDirtyRectQueue(); EndFrameBufferRender(); RefreshScreen( NULL ); }
//Simply create videosurface, load image, and draw it to the screen. void InitJA2SplashScreen() { #ifdef ENGLISH ClearMainMenu(); #else UINT32 uiLogoID = 0; HVSURFACE hVSurface; // unused jonathanl // lalien reenabled for international versions VSURFACE_DESC VSurfaceDesc; //unused jonathanl // lalien reenabled for international versions # ifdef JA2TESTVERSION INT32 i = 0; memset( &VSurfaceDesc, 0, sizeof( VSURFACE_DESC ) ); VSurfaceDesc.fCreateFlags = VSURFACE_CREATE_FROMFILE | VSURFACE_SYSTEM_MEM_USAGE | VSURFACE_CREATE_FROMPNG_FALLBACK; sprintf( VSurfaceDesc.ImageFile, "LOADSCREENS\\Notification.sti" ); if( !AddVideoSurface( &VSurfaceDesc, &uiLogoID ) ) { //AssertMsg( 0, String( "Failed to load %s", VSurfaceDesc.ImageFile ) ); return; } GetVideoSurface(&hVSurface, uiLogoID ); //BltVideoSurfaceToVideoSurface( ghFrameBuffer, hVSurface, 0, 0, 0, 0, NULL ); BltVideoSurfaceToVideoSurface( ghFrameBuffer, hVSurface, 0, iScreenWidthOffset, iScreenHeightOffset, 0, NULL ); DeleteVideoSurfaceFromIndex( uiLogoID ); InvalidateScreen(); RefreshScreen( NULL ); guiSplashStartTime = GetJA2Clock(); while( i < 60 * 15 )//guiSplashStartTime + 15000 > GetJA2Clock() ) { //Allow the user to pick his bum. InvalidateScreen(); RefreshScreen( NULL ); i++; } # endif // JA2TESTVERSION memset( &VSurfaceDesc, 0, sizeof( VSURFACE_DESC ) ); VSurfaceDesc.fCreateFlags = VSURFACE_CREATE_FROMFILE | VSURFACE_SYSTEM_MEM_USAGE | VSURFACE_CREATE_FROMPNG_FALLBACK; GetMLGFilename( VSurfaceDesc.ImageFile, MLG_SPLASH ); try { if( !AddVideoSurface( &VSurfaceDesc, &uiLogoID ) ) { AssertMsg( 0, String( "Failed to load %s", VSurfaceDesc.ImageFile ) ); return; } } catch(std::exception &ex) { SGP_RETHROW(L"Failed loading splash screen", ex); } GetVideoSurface( &hVSurface, uiLogoID ); BltVideoSurfaceToVideoSurface( ghFrameBuffer, hVSurface, 0, iScreenWidthOffset, iScreenHeightOffset, 0, NULL ); DeleteVideoSurfaceFromIndex( uiLogoID ); #endif // ENGLISH InvalidateScreen(); RefreshScreen( NULL ); guiSplashStartTime = GetJA2Clock(); }
//Simply create videosurface, load image, and draw it to the screen. void InitJA2SplashScreen() { UINT32 uiLogoID = 0; STRING512 CurrentDir; STRING512 DataDir; HVSURFACE hVSurface; VSURFACE_DESC VSurfaceDesc; INT32 i = 0; InitializeJA2Clock(); //InitializeJA2TimerID(); // Get Executable Directory GetExecutableDirectory( CurrentDir ); // Adjust Current Dir sprintf( DataDir, "%s\\Data", CurrentDir ); if ( !SetFileManCurrentDirectory( DataDir ) ) { DebugMsg( TOPIC_JA2, DBG_LEVEL_3, "Could not find data directory, shutting down"); return; } //Initialize the file database InitializeFileDatabase( gGameLibaries, NUMBER_OF_LIBRARIES ); #if !defined( ENGLISH ) && defined( JA2TESTVERSION ) memset( &VSurfaceDesc, 0, sizeof( VSURFACE_DESC ) ); VSurfaceDesc.fCreateFlags = VSURFACE_CREATE_FROMFILE | VSURFACE_SYSTEM_MEM_USAGE; sprintf( VSurfaceDesc.ImageFile, "LOADSCREENS\\Notification.sti" ); if( !AddVideoSurface( &VSurfaceDesc, &uiLogoID ) ) { AssertMsg( 0, String( "Failed to load %s", VSurfaceDesc.ImageFile ) ); return; } GetVideoSurface(&hVSurface, uiLogoID ); BltVideoSurfaceToVideoSurface( ghFrameBuffer, hVSurface, 0, 0, 0, 0, NULL ); DeleteVideoSurfaceFromIndex( uiLogoID ); InvalidateScreen(); RefreshScreen( NULL ); guiSplashStartTime = GetJA2Clock(); while( i < 60 * 15 )//guiSplashStartTime + 15000 > GetJA2Clock() ) { //Allow the user to pick his bum. InvalidateScreen(); RefreshScreen( NULL ); i++; } #endif #ifdef ENGLISH ClearMainMenu(); #else { memset( &VSurfaceDesc, 0, sizeof( VSURFACE_DESC ) ); VSurfaceDesc.fCreateFlags = VSURFACE_CREATE_FROMFILE | VSURFACE_SYSTEM_MEM_USAGE; GetMLGFilename( VSurfaceDesc.ImageFile, MLG_SPLASH ); if( !AddVideoSurface( &VSurfaceDesc, &uiLogoID ) ) { AssertMsg( 0, String( "Failed to load %s", VSurfaceDesc.ImageFile ) ); return; } GetVideoSurface( &hVSurface, uiLogoID ); BltVideoSurfaceToVideoSurface( ghFrameBuffer, hVSurface, 0, 0, 0, 0, NULL ); DeleteVideoSurfaceFromIndex( uiLogoID ); } #endif InvalidateScreen(); RefreshScreen( NULL ); guiSplashStartTime = GetJA2Clock(); }