⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cbavi.cpp

📁 赤壁之战的游戏源代码
💻 CPP
📖 第 1 页 / 共 2 页
字号:
			}
//			WriteLogFile( "sound.log","KKKKK\n" );
			//DATA_WAVE_MusicPlay(0) ;
			// to fade in the interface of this game
			DDC_UpdateScreen();
			//--fade in
			DD_FadeInScreen( 5, 10 );
			DD_FadeRestore( palMain.GetPalette() );
			//--fade in
			// to show the mission dialog
			PostMessage(hwndGame, WM_COMMAND, SHOW_CAMPAIGN_MISSION, 0);
			// to restore all button's state
			FACE_RestoreAllButtonState();
		}
		// what are you going to do after play the real time AVI
		else if( nCommandState == COMMAND_STATE_AVI_REALTIME )
		{
			// to restore the palette
			palMain.ReloadPalette();
			//--fade in
			DD_FadeClear( palMain.GetPalette() );
			palMain.SetPalette();
			//--fade in

			// to get current cursor and show it
			CURSOR_Get()->Show(TRUE);
			FACE_SetProgramState( FACE_GetPreProgramState() );
			FACE_SetCommandState( FACE_GetPreCommandState() ) ;
			DDC_UpdateScreen();

			//to play the sound
			if( GAME_nDisk == 0 )
			{
				DATA_WAVE_MusicPlay( GAME.nMusicID );
			}
			//DATA_WAVE_MusicPlay(0) ;

			// to fade in the interface of this game
			DDC_UpdateScreen();
			//--fade in
			DD_FadeInScreen( 5, 10 );
			DD_FadeRestore( palMain.GetPalette() );
			//--fade in
			// to restore all button's state
			FACE_RestoreAllButtonState();
		}
		else if( nCommandState == COMMAND_STATE_AVI_SINGLE )
		{
			// to restore the palette
			palMain.ReloadPalette();
			//--fade in
			DD_FadeClear( palMain.GetPalette() );
			palMain.SetPalette();
			//--fade in

			// to get current cursor and show it
			CURSOR_Get()->Show(TRUE);
			FACE_SetProgramState( PROGRAM_STATE_MENU );
			FACE_SetCommandState( COMMAND_STATE_MENU ) ;

			//to play the sound
			if( GAME_nDisk == 0 )
			{
				DATA_WAVE_MusicPlay( GAME.nMusicID );
			}
			//DATA_WAVE_MusicPlay(0) ;

			// to fade in the interface of this game
			DDC_UpdateScreen();
			//--fade in
			DD_FadeInScreen( 5, 10 );
			DD_FadeRestore( palMain.GetPalette() );
			//--fade in

			PostMessage(hwndGame, WM_COMMAND, BUTTON_SINGLE_RESULT, 0 );
		}
		else if( nCommandState == COMMAND_STATE_AVI_HISTORY )
		{
			if( GAME_nDisk == 0 )
			{
				char wavfile[_MAX_FNAME];
				strcpy( wavfile, GAME_strSetupDirectory );
				strcat( wavfile, "\\sound\\Start.wav" );
				DATA_WAVE_MusicPlayS( wavfile );
			}
			
			// to get current cursor and show it
			CURSOR_Get()->Show(TRUE);
			FACE_SetProgramState( PROGRAM_STATE_MENU );
			FACE_SetCommandState( COMMAND_STATE_MENU );

			SendMessage(hwndGame, WM_COMMAND, SHOW_MAIN_MENU, 0);
			// to restore all button's state
			FACE_RestoreAllButtonState();
		}

		DDC_UpdateScreen() ;
		MAIN_bFirst = TRUE;
			
		return TRUE;
	}
	return FALSE;
}


// close avi step 1, close AVI files
BOOL	FACE_Avi_Close1()
{
	if( (FACE_GetCommandState() == COMMAND_STATE_AVI_BEGIN ) ||
		(FACE_GetCommandState() == COMMAND_STATE_AVI_END ) ||
		(FACE_GetCommandState() == COMMAND_STATE_AVI_MISSION ) ||
		(FACE_GetCommandState() == COMMAND_STATE_AVI_REALTIME ) ||
		(FACE_GetCommandState() == COMMAND_STATE_AVI_SINGLE ) ||
		(FACE_GetCommandState() == COMMAND_STATE_AVI_HISTORY ) 
	  )
	{	// 会接收到两次消息

		// to erase the whole screen to black
		// 不能使用,否则出错
//		DD_EraseFrontScreen();

		if( FACE_AVI_FLAG == FALSE )
		{
		}
		else if( MAIN_bMMX == TRUE 
			&& FACE_GetCommandState() != COMMAND_STATE_AVI_SINGLE )
		{
			Assert( bMoviePlaying == TRUE );
			MovieStop( hwndGame );
			MovieFileClose( hwndGame );
			MovieTerminate( hwndGame );
			nCurrentVideoID = -1;
			bMoviePlaying = FALSE;
		}
		else
		{
			Assert( nCurrentVideoID != -1 );
			MCI_AVI_Stop( hwndGame, nCurrentVideoID );
			MCI_AVI_Close( nCurrentVideoID );
			nCurrentVideoID = -1;
		}
		return TRUE;
	}
	return FALSE;
}

// close avi step 2, do anything after closing AVI files
// 必须接着FACE_Avi_Close1()
BOOL	FACE_Avi_Close2()
{
	if( (FACE_GetCommandState() == COMMAND_STATE_AVI_BEGIN ) ||
		(FACE_GetCommandState() == COMMAND_STATE_AVI_END ) ||
		(FACE_GetCommandState() == COMMAND_STATE_AVI_MISSION ) ||
		(FACE_GetCommandState() == COMMAND_STATE_AVI_REALTIME ) ||
		(FACE_GetCommandState() == COMMAND_STATE_AVI_SINGLE ) ||
		(FACE_GetCommandState() == COMMAND_STATE_AVI_HISTORY ) 
	  )
	{	// 会接收到两次消息

		// to do the next thing by the current program state
		int		nCommandState;

		nCommandState = FACE_GetCommandState();
		if( GAME_nDisk != 0 )
		{
			if( nCommandState == COMMAND_STATE_AVI_BEGIN )
			{
				char wavfile[_MAX_FNAME];
				strcpy( wavfile, GAME_strSetupDirectory );
				strcat( wavfile, "\\sound\\Start.wav" );
				DATA_WAVE_MusicPlayS( wavfile );
				strcpy( GAME.strStartWAV, wavfile );
			}
			else if( nCommandState == COMMAND_STATE_AVI_END )
			{
				DATA_WAVE_MusicPlay( GAME.nMusicID );
			}
			else if( nCommandState == COMMAND_STATE_AVI_MISSION )
			{
				DATA_WAVE_MusicPlay( GAME.nMusicID );
			}
			else if( nCommandState == COMMAND_STATE_AVI_REALTIME )
			{
				DATA_WAVE_MusicPlay( GAME.nMusicID );
			}
			else if( nCommandState == COMMAND_STATE_AVI_SINGLE )
			{
				DATA_WAVE_MusicPlay( GAME.nMusicID );
			}
			else if( nCommandState == COMMAND_STATE_AVI_HISTORY )
			{
				char wavfile[_MAX_FNAME];
				strcpy( wavfile, GAME_strSetupDirectory );
				strcat( wavfile, "\\sound\\Start.wav" );
				DATA_WAVE_MusicPlayS( wavfile );
			}
		}

		// to get the sound device 
		DS_InitSound( hwndGame ) ;

		// what are you going to do after play the begin AVI
		if( nCommandState == COMMAND_STATE_AVI_BEGIN )
		{
			DD_EraseFrontScreen();
			MAIN_InitOthers();

			if( GAME_nDisk == 0 )
			{
				char wavfile[_MAX_FNAME];
				strcpy( wavfile, GAME_strSetupDirectory );
				strcat( wavfile, "\\sound\\Start.wav" );
				DATA_WAVE_MusicPlayS( wavfile );
				strcpy( GAME.strStartWAV, wavfile );
			}
			
			GAME.nID = 0;
			FACE_SetProgramState( PROGRAM_STATE_PLAY );
			FACE_SetCommandState( COMMAND_STATE_PLAY );
			SendMessage(hwndGame, WM_COMMAND, SHOW_MAIN_MENU, 0);
			// to restore all button's state
			FACE_RestoreAllButtonState();
		}
		// what are you going to do after play the end AVI
		else if( nCommandState == COMMAND_STATE_AVI_END )
		{
			//to play the sound 
			if( GAME_nDisk == 0 )
			{
				DATA_WAVE_MusicPlay( GAME.nMusicID );
			}
			//DATA_WAVE_MusicPlay(0) ;
//			WriteLogFile( "sound.log","IIIII\n" );
			// to restore all button's state
			FACE_RestoreAllButtonState();
		}
		// what are you going to do after play the mission AVI
		else if( nCommandState == COMMAND_STATE_AVI_MISSION )
		{
			// to restore the palette
			palMain.ReloadPalette();
			//--fade in
			DD_FadeClear( palMain.GetPalette() );
			palMain.SetPalette();
			//--fade in

			// to get current cursor and show it
			CURSOR_Get()->Show(TRUE);
//			FACE_SetProgramState( FACE_GetPreProgramState() );
			FACE_SetProgramState( PROGRAM_STATE_PLAY );
			FACE_SetCommandState( COMMAND_STATE_MENU );

			//to play the sound 
			if( GAME_nDisk == 0 )
			{
				DATA_WAVE_MusicPlay( GAME.nMusicID );
			}
//			WriteLogFile( "sound.log","KKKKK\n" );
			//DATA_WAVE_MusicPlay(0) ;
			// to fade in the interface of this game
			DDC_UpdateScreen();
			//--fade in
			DD_FadeInScreen( 5, 10 );
			DD_FadeRestore( palMain.GetPalette() );
			//--fade in
			// to show the mission dialog
			PostMessage(hwndGame, WM_COMMAND, SHOW_CAMPAIGN_MISSION, 0);
			// to restore all button's state
			FACE_RestoreAllButtonState();
		}
		// what are you going to do after play the real time AVI
		else if( nCommandState == COMMAND_STATE_AVI_REALTIME )
		{
			// to restore the palette
			palMain.ReloadPalette();
			//--fade in
			DD_FadeClear( palMain.GetPalette() );
			palMain.SetPalette();
			//--fade in

			// to get current cursor and show it
			CURSOR_Get()->Show(TRUE);
			FACE_SetProgramState( FACE_GetPreProgramState() );
			FACE_SetCommandState( FACE_GetPreCommandState() ) ;
			DDC_UpdateScreen();

			//to play the sound
			if( GAME_nDisk == 0 )
			{
				DATA_WAVE_MusicPlay( GAME.nMusicID );
			}
			//DATA_WAVE_MusicPlay(0) ;

			// to fade in the interface of this game
			DDC_UpdateScreen();
			//--fade in
			DD_FadeInScreen( 5, 10 );
			DD_FadeRestore( palMain.GetPalette() );
			//--fade in
			// to restore all button's state
			FACE_RestoreAllButtonState();
		}
		else if( nCommandState == COMMAND_STATE_AVI_SINGLE )
		{
			// to restore the palette
			palMain.ReloadPalette();
			//--fade in
			DD_FadeClear( palMain.GetPalette() );
			palMain.SetPalette();
			//--fade in

			// to get current cursor and show it
			CURSOR_Get()->Show(TRUE);
			FACE_SetProgramState( PROGRAM_STATE_MENU );
			FACE_SetCommandState( COMMAND_STATE_MENU ) ;

			//to play the sound
			if( GAME_nDisk == 0 )
			{
				DATA_WAVE_MusicPlay( GAME.nMusicID );
			}
			//DATA_WAVE_MusicPlay(0) ;

			// to fade in the interface of this game
			DDC_UpdateScreen();
			//--fade in
			DD_FadeInScreen( 5, 10 );
			DD_FadeRestore( palMain.GetPalette() );
			//--fade in

			PostMessage(hwndGame, WM_COMMAND, BUTTON_SINGLE_RESULT, 0 );
		}
		else if( nCommandState == COMMAND_STATE_AVI_HISTORY )
		{
			if( GAME_nDisk == 0 )
			{
				char wavfile[_MAX_FNAME];
				strcpy( wavfile, GAME_strSetupDirectory );
				strcat( wavfile, "\\sound\\Start.wav" );
				DATA_WAVE_MusicPlayS( wavfile );
			}
			
			// to get current cursor and show it
			CURSOR_Get()->Show(TRUE);
			FACE_SetProgramState( PROGRAM_STATE_MENU );
			FACE_SetCommandState( COMMAND_STATE_MENU );

			SendMessage(hwndGame, WM_COMMAND, SHOW_MAIN_MENU, 0);
			// to restore all button's state
			FACE_RestoreAllButtonState();
		}

		DDC_UpdateScreen() ;
		MAIN_bFirst = TRUE;
			
		return TRUE;
	}
	return FALSE;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -