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

📄 interfa1.cpp

📁 赤壁之战的游戏源代码
💻 CPP
📖 第 1 页 / 共 5 页
字号:

		Menu_System_Help_Operate.SetString(help_text) ;
		// to show the background of this menu
		Menu_System_Help_Operate.Show();
		return TRUE;
	}
	else if( lParam == MENU_SYSTEMENU_HELP_ICON )
	{
		strcpy( fname, "set\\m_shicon.exp" );
		FSCAN.scan_open (fname); 
		/*
		fp = fopen (fname, "r") ;  // Interfac.set store the all bitmap information
		if(!fp)									 // of game interface
		{
			ErrorMessage( hwndGame, INTERFACE_ERROR+0,"Cannot open menu data file: ",fname );
			return FALSE;
		}
		*/
		CurrentMenu = &Menu_System_Help_Icon;
		// to set this menu's ID
		Menu_System_Help_Icon.SetID( lParam );
		// to preload the background of this menu
		FSCAN.l_scan (sscanf (FSCAN.expand_buf,"%d%d%d", &BitmapFileId, &pShow.x, &pShow.y)); 
	    //fscanf( fp, "%d%d%d", &BitmapFileId, &pShow.x, &pShow.y);
		if( !Menu_System_Help_Icon.PreLoad(BitmapFileId, pShow.x, pShow.y) )
			return FALSE;
		// to preload all button of this menu
		for(int i=0; i<3; i++)
		{
			Menu_System_Help_Icon.m_MenuButtonUnit.m_pButton[i] = new CDDButton;
			FSCAN.l_scan (sscanf (FSCAN.expand_buf,"%d%d%d%d%d%d", &BitmapFileId, &pShow.x, &pShow.y, &nWidth, &nHeight, &nID));
			//fscanf( fp, "%d%d%d%d%d%d", &BitmapFileId, &pShow.x, &pShow.y, &nWidth, &nHeight, &nID);
			if( !Menu_System_Help_Icon.m_MenuButtonUnit.m_pButton[i]->
				PreLoad( BitmapFileId, pShow.x, pShow.y, nWidth, nHeight) )
				return FALSE;
			Menu_System_Help_Icon.m_MenuButtonUnit.m_pButton[i]->SetID(nID);
		}
		// to close the date file of this menu
		FSCAN.scan_close (); 
		// to read the help text from the information file
		CText_apply Text;			// the instance to open a pressed file for read the mission text
		char		help_text[1024] ;	// the string to store the input mission text	
		int			LineSer ;	// the line serial number of this mission in the mission.set

		// to set the column in a row
//		Menu_System_Help_Icon.SetStringColumn(42) ;
		// to set the string position
		Menu_System_Help_Icon.SetStringPos( 106, 170) ;

		Menu_System_Help_Icon.SetStringSer(20) ;
		LineSer = Menu_System_Help_Icon.GetStringSer() ;
		memset (help_text, 0, sizeof(help_text)) ;
		Text.Text_open ("set\\help.ext") ;
		Text.Text_use (help_text, LineSer) ;
		Text.Text_close ();
		Menu_System_Help_Icon.SetString(help_text) ;

		strcpy( fname, "set\\iconhelp.exp" );
		FSCAN.scan_open (fname); 
		// to preload the tital prompt bitmap file
		pAllBitmap[0] = new CDDBitmap;
		FSCAN.l_scan (sscanf (FSCAN.expand_buf,"%d%d%d%d%d", &BitmapFileId, &pShow.x, &pShow.y, &nWidth, &nHeight)); 
		if( !pAllBitmap[0]->PreLoad(BitmapFileId, pShow.x, pShow.y, nWidth, nHeight) )
			return FALSE;
		// to close the date file of this menu
		FSCAN.scan_close (); 

		// to show this menu
		Menu_System_Help_Icon.Blit();
		pAllBitmap[0]->Blit();
		Menu_System_Help_Icon.m_MenuButtonUnit.Blit();
		Menu_System_Help_Icon.Update();

		return TRUE;
	}
	else if( lParam == MENU_SYSTEMENU_HELP_GAME )
	{
		strcpy( fname, "set\\m_shgame.exp" );
		FSCAN.scan_open (fname); 
		/*
		fp = fopen (fname, "r") ;  // Interfac.set store the all bitmap information
		if(!fp)									 // of game interface
		{
			ErrorMessage( hwndGame, INTERFACE_ERROR+0,"Cannot open menu data file: ",fname );
			return FALSE;
		}
		*/
		CurrentMenu = &Menu_System_Help_Game;
		// to set this menu's ID
		Menu_System_Help_Game.SetID( lParam );
		// to preload the background of this menu
		FSCAN.l_scan (sscanf (FSCAN.expand_buf,"%d%d%d", &BitmapFileId, &pShow.x, &pShow.y)); 
	    //fscanf( fp, "%d%d%d", &BitmapFileId, &pShow.x, &pShow.y);
		if( !Menu_System_Help_Game.PreLoad(BitmapFileId, pShow.x, pShow.y) )
			return FALSE;
		// to preload all button of this menu
		for(int i=0; i<3; i++)
		{
			Menu_System_Help_Game.m_MenuButtonUnit.m_pButton[i] = new CDDButton;
			FSCAN.l_scan (sscanf (FSCAN.expand_buf,"%d%d%d%d%d%d", &BitmapFileId, &pShow.x, &pShow.y, &nWidth, &nHeight, &nID)); 
			//fscanf( fp, "%d%d%d%d%d%d", &BitmapFileId, &pShow.x, &pShow.y, &nWidth, &nHeight, &nID);
			if( !Menu_System_Help_Game.m_MenuButtonUnit.m_pButton[i]->
				PreLoad( BitmapFileId, pShow.x, pShow.y, nWidth, nHeight) )
				return FALSE;
			Menu_System_Help_Game.m_MenuButtonUnit.m_pButton[i]->SetID(nID);
		}
		// to close the date file of this menu
		FSCAN.scan_close (); 
		// to read the help text from the information file
		CText_apply Text;			// the instance to open a pressed file for read the mission text
		char		help_text[1024] ;	// the string to store the input mission text	
		int			LineSer ;	// the line serial number of this mission in the mission.set

		Menu_System_Help_Game.SetStringSer(40) ;
		LineSer = Menu_System_Help_Game.GetStringSer() ;
		memset (help_text, 0, sizeof(help_text)) ;
		Text.Text_open ("set\\help.ext") ;
		Text.Text_use (help_text, LineSer) ;
		Text.Text_close ();

		Menu_System_Help_Game.SetString(help_text) ;
		// to show the background of this menu
		Menu_System_Help_Game.Show();
		return TRUE;
	}
	else if( lParam == MENU_SYSTEMENU_EXIT )
	{
		strcpy( fname, "set\\M_sexit.exp" );
		FSCAN.scan_open (fname); 
		/*
		fp = fopen (fname, "r") ;  // Interfac.set store the all bitmap information
		if(!fp)									 // of game interface
		{
			ErrorMessage( hwndGame, INTERFACE_ERROR+0,"Cannot open menu data file: ",fname );
			return FALSE;
		}
		*/
		CurrentMenu = &Menu_System_Exit;
		// to set this menu's ID
		Menu_System_Exit.SetID( lParam );
		// to preload the background of this menu
		FSCAN.l_scan (sscanf (FSCAN.expand_buf,"%d%d%d", &BitmapFileId, &pShow.x, &pShow.y)); 
	    //fscanf( fp, "%d%d%d", &BitmapFileId, &pShow.x, &pShow.y);
		if( !Menu_System_Exit.PreLoad(BitmapFileId, pShow.x, pShow.y) )
			return FALSE;
		// to preload all button of this menu
		for(int i=0; i<4; i++)
		{
			Menu_System_Exit.m_MenuButtonUnit.m_pButton[i] = new CDDButton;
			FSCAN.l_scan (sscanf (FSCAN.expand_buf,"%d%d%d%d%d%d", &BitmapFileId, &pShow.x, &pShow.y, &nWidth, &nHeight, &nID)); 
			//fscanf( fp, "%d%d%d%d%d%d", &BitmapFileId, &pShow.x, &pShow.y, &nWidth, &nHeight, &nID);
			if( !Menu_System_Exit.m_MenuButtonUnit.m_pButton[i]->
				PreLoad( BitmapFileId, pShow.x, pShow.y, nWidth, nHeight) )
				return FALSE;
			Menu_System_Exit.m_MenuButtonUnit.m_pButton[i]->SetID(nID);
		}
		// to close the date file of this menu
		FSCAN.scan_close (); 
		//fclose(fp);
		// to show the background of this menu
		Menu_System_Exit.Show();
//		Menu_System_Exit.Update();
		return TRUE;
	}
	else if( lParam == MENU_SELECT_GENERAL )
	{
		CurrentMenu = &Menu_Select_General;
/*
		// to set this menu's ID
		Menu_Select_General.SetID( lParam );
		// to preload the background of this menu
		pAllListUnit[0] = new CDDListUnit;
		// to preload all list in this load game menu
		for(int j=0; j<6; j++)
		{
			pAllListUnit[0]->m_pList[j] = new CDDList;
		}
	*/
		// to set the state of all buttons in this menu's button-unit
		Menu_Select_General.m_MenuButtonUnit.SetMemberState( BUTTON_UP );
		pAllListUnit[0] = new CDDListUnit;

		pAllListUnit[0]->m_pList[0] = pEstablishList_1;
		pAllListUnit[0]->m_pList[1] = pEstablishList_2;
		pAllListUnit[0]->m_pList[2] = pEstablishList_3;
		pAllListUnit[0]->m_pList[3] = pEstablishList_4;
		pAllListUnit[0]->m_pList[4] = pEstablishList_5;
		pAllListUnit[0]->m_pList[5] = pEstablishList_6;

		pAllListUnit[0]->m_pList[0]->SetState(LIST_UP) ;
		pAllListUnit[0]->m_pList[1]->SetState(LIST_UP) ;
		pAllListUnit[0]->m_pList[2]->SetState(LIST_UP) ;
		pAllListUnit[0]->m_pList[3]->SetState(LIST_UP) ;
		pAllListUnit[0]->m_pList[4]->SetState(LIST_UP) ;
		pAllListUnit[0]->m_pList[5]->SetState(LIST_UP) ;
		// to close the menu date file
		// to show this menu
		Menu_Select_General.Blit();
		pAllListUnit[0]->Blit();
		Menu_Select_General.Update();

		return TRUE;
	}
	else if( lParam == MENU_SINGLE )
	{
		strcpy( fname, "set\\m_single.exp" );
		FSCAN.scan_open (fname); 

		CurrentMenu = &Menu_Single;
		// to set this menu's ID
		Menu_Single.SetID( lParam );
		// to preload the background of this menu
		FSCAN.l_scan (sscanf (FSCAN.expand_buf,"%d%d%d", &BitmapFileId, &pShow.x, &pShow.y)); 
	    //fscanf( fp, "%d%d%d", &BitmapFileId, &pShow.x, &pShow.y);
		if( !Menu_Single.PreLoad(BitmapFileId, pShow.x, pShow.y) )
			return FALSE;
		// to preload all button of this menu
		for(int i=0; i<2; i++)
		{
			Menu_Single.m_MenuButtonUnit.m_pButton[i] = new CDDButton;
			FSCAN.l_scan (sscanf (FSCAN.expand_buf,"%d%d%d%d%d%d", &BitmapFileId, &pShow.x, &pShow.y, &nWidth, &nHeight, &nID)); 
			if( !Menu_Single.m_MenuButtonUnit.m_pButton[i]->
				PreLoad( BitmapFileId, pShow.x, pShow.y, nWidth, nHeight) )
				return FALSE;
			Menu_Single.m_MenuButtonUnit.m_pButton[i]->SetID(nID);
		}
		// to close the date file of this menu
		FSCAN.scan_close (); 
		// to blit this menu's background and the two buttons
		Menu_Single.Blit();
// to blit the head image of the two generals
		// to blit the background that around the general's head finger
		bmGeneralBackground.SetPosition( 66, 161 ) ;
		bmGeneralBackground.Blit();
		bmGeneralBackground.SetPosition( 370, 161 ) ;
		bmGeneralBackground.Blit();
		// to calculate the sub rectangle of the first general's head finger in the whole face bitmap file->zzj_face.bmp
		RECT	FaceRect ;
		int		FaceId = Single_Battle.General_One.GeneralBitmapId ;

		FaceRect.left = ( (FaceId-1) % 10) * 59 ;	// one face of a general is  59 x 74 pixel
		FaceRect.right = FaceRect.left + 58 ;	// and the id of general is begin from 1
		FaceRect.top = ( (FaceId-1)/10) * 74 ;
		FaceRect.bottom = FaceRect.top + 73 ;
		// to blit the head finger of a general to the left-top corner
		FACE_GeneralFace.SetPosition( 68, 169 ) ;
		FACE_GeneralFace.Blit( &FaceRect );
		// to blit the power percent bar and blood percent bar 
		FACE_Power.SetPosition(67, 162) ;		//定武力条的位置
		FACE_Power.Blit( Single_Battle.General_One.GeneralPower );
		FACE_Blood.SetPosition(67, 243) ;		//定体力条的位置
		FACE_Blood.Blit( Single_Battle.General_One.GeneralBlood );
		// to calculate the sub rectangle of the second general's head finger in the whole face bitmap file
		FaceId = Single_Battle.General_Two.GeneralBitmapId ;
		FaceRect.left = ( (FaceId-1) % 10) * 59 ;	// one face of a general is  59 x 74 pixel
		FaceRect.right = FaceRect.left + 58 ;	// and the id of general is begin from 1
		FaceRect.top = ( (FaceId-1)/10) * 74 ;
		FaceRect.bottom = FaceRect.top + 73 ;
		// to blit the head finger of a general to the left-top corner
		FACE_GeneralFace.SetPosition( 372, 169 ) ;
		FACE_GeneralFace.Blit( &FaceRect );
		// to blit the power percent bar and blood percent bar 
		FACE_Power.SetPosition(371, 162) ;
		FACE_Power.Blit( Single_Battle.General_Two.GeneralPower );
		FACE_Blood.SetPosition(371, 243) ;
		FACE_Blood.Blit( Single_Battle.General_Two.GeneralBlood );
		// to set the blood percent bar and power percent bar back
		FACE_Power.SetPosition( 505, 162 ) ;
		FACE_Blood.SetPosition( 505, 243 ) ;
		// to blit the title of this menu
		CText_apply  Title;
		char FirstPart[256] ;	//将军向
		char SecondPart[256] ;	//将军挑战
		memset (FirstPart,0,sizeof(FirstPart));
		memset (SecondPart,0,sizeof(SecondPart));
		Title.Text_open ("set\\hz.ext");
		Title.Text_use (FirstPart,30);
		Title.Text_use (SecondPart,31);
		Title.Text_close ();

		class	CDDText prompt_text;		// the prompt string 
		int iResult = prompt_text.BeginText( 128 );
		if( ! iResult )
			return FALSE;
		// to set the color of this text show 
		prompt_text.SetTextColor( RGB(255, 255, 255) );
		prompt_text.MyTextOut(DD_GetBackBuffer(), 135-12, 121, Single_Battle.General_One.GeneralName);
		prompt_text.GetDDSurface()->Erase();
//		prompt_text.SetTextColor( RGB(255, 255, 120) );
		prompt_text.MyTextOut(DD_GetBackBuffer(), 183-8, 121, FirstPart);
		prompt_text.GetDDSurface()->Erase();
//		prompt_text.SetTextColor( RGB(255, 255, 255) );
		prompt_text.MyTextOut(DD_GetBackBuffer(), 231-4, 121, Single_Battle.General_Two.GeneralName);
		prompt_text.GetDDSurface()->Erase();
//		prompt_text.SetTextColor( RGB(255, 255, 120) );
		prompt_text.MyTextOut(DD_GetBackBuffer(), 279, 121, SecondPart);
		prompt_text.GetDDSurface()->Erase();
		// to blit the word of the general name, power and blood

//		prompt_text.SetTextColor( RGB(255, 255, 255) );
		prompt_text.MyTextOut(DD_GetBackBuffer(), 150, 163, Single_Battle.General_One.GeneralName);
		prompt_text.GetDDSurface()->Erase();
		prompt_text.MyTextOut(DD_GetBackBuffer(), 302, 163, Single_Battle.General_Two.GeneralName);
		prompt_text.GetDDSurface()->Erase();

		CText_apply  Text;
		char tl[256] ;	//体力
		char wl[256] ;	//武力
		memset (tl,0,sizeof(tl));
		memset (wl,0,sizeof(wl));
		Text.Text_open ("set\\hz.ext");
		Text.Text_use (tl,32);
		Text.Text_use (wl,33);
		Text.Text_close ();
		prompt_text.SetTextColor( RGB(255, 255, 120) );
		prompt_text.MyTextOut(DD_GetBackBuffer(), 142, 190, wl);
		prompt_text.MyTextOut(DD_GetBackBuffer(), 295, 190, wl);
		prompt_text.GetDDSurface()->Erase();
		prompt_text.MyTextOut(DD_GetBackBuffer(), 142, 220, tl);
		prompt_text.MyTextOut(DD_GetBackBuffer(), 295, 220, tl);
		prompt_text.GetDDSurface()->Erase();

		char tl_1[256] ;
		char tl_2[256] ;

⌨️ 快捷键说明

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