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

📄 interfa1.cpp

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

		CurrentMenu = &Menu_NewGame;
		Menu_NewGame.SetID( lParam );
		// to set the smallest box of this menu
		FSCAN.l_scan(sscanf (FSCAN.expand_buf,"%d%d%d%d", &pShow.x, &pShow.y, &nWidth, &nHeight)); 
		Menu_NewGame.SetPosition(pShow.x, pShow.y);
		Menu_NewGame.SetSize(nWidth, nHeight);
		// to store all bitmap of this menu
		for(int j=0; j<2; j++)
		{
			pAllBitmap[j] = new CDDBitmap;
			FSCAN.l_scan(sscanf (FSCAN.expand_buf,"%d%d%d%d%d", &BitmapFileId, &pShow.x, &pShow.y, &nWidth, &nHeight)); 
			//fscanf( fp, "%d%d%d%d%d", &BitmapFileId, &pShow.x, &pShow.y, &nWidth, &nHeight);
			if( !pAllBitmap[j]->PreLoad(BitmapFileId, pShow.x, pShow.y, nWidth, nHeight) )
			{
				FSCAN.scan_close ();
				return FALSE;
			}
			pAllBitmap[j]->Show();
		}
		// to preload all check-box of this menu
		pAllCheckBoxUnit[0] = new CDDCheckBoxUnit;
		for(int k=0; k<2; k++)
		{
			pAllCheckBoxUnit[0]->m_pCheckBox[k] = new CDDCheckBox;
			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( ! pAllCheckBoxUnit[0]->m_pCheckBox[k]->PreLoad(BitmapFileId, pShow.x, pShow.y, nWidth, nHeight) )
			{
				FSCAN.scan_close ();
				return FALSE;
			}
			pAllCheckBoxUnit[0]->m_pCheckBox[k]->SetID(nID);
		}
		if( GAME_nDisk == 1 )
		{
			//只可以选择曹操
			pAllCheckBoxUnit[0]->m_pCheckBox[1]->SetState( CHECKBOX_DISABLE );
		}
		else if( GAME_nDisk == 2 )
		{
			//只可以选择刘备
			pAllCheckBoxUnit[0]->m_pCheckBox[0]->SetState( CHECKBOX_DISABLE );
		}

		pAllCheckBoxUnit[0]->Show();
		// to preload all button of this menu
		for(int i=0; i<2; i++)
		{
			Menu_NewGame.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_NewGame.m_MenuButtonUnit.m_pButton[i]->
				PreLoad( BitmapFileId, pShow.x, pShow.y, nWidth, nHeight) )
			{
				FSCAN.scan_close ();
				return FALSE;
			}
			Menu_NewGame.m_MenuButtonUnit.m_pButton[i]->SetID(nID);
		}
		FSCAN.scan_close ();
		Menu_NewGame.Show();
//		Menu_NewGame.Update();

		return	TRUE; 
	}
	else if( lParam == MENU_MAIN_LOAD )
	{
		strcpy( fname, "set\\M_mload.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_MainLoad;
		Menu_MainLoad.SetID( lParam );
		// to set the smallest box of this menu
		FSCAN.l_scan (sscanf (FSCAN.expand_buf,"%d%d%d%d", &pShow.x, &pShow.y, &nWidth, &nHeight)); 
		//fscanf( fp, "%d%d%d%d", &pShow.x, &pShow.y, &nWidth, &nHeight);
		Menu_MainLoad.SetPosition(pShow.x, pShow.y);
		Menu_MainLoad.SetSize(nWidth, nHeight);
		// to preload the scroll bar 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));
	    //fscanf( fp, "%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 preload all button of this menu
		for(int i=0; i<4; i++)
		{
			Menu_MainLoad.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_MainLoad.m_MenuButtonUnit.m_pButton[i]->
				PreLoad( BitmapFileId, pShow.x, pShow.y, nWidth, nHeight) )
				return FALSE;
			Menu_MainLoad.m_MenuButtonUnit.m_pButton[i]->SetID(nID);
		}
		pAllListUnit[0] = new CDDListUnit;
		// to preload all list in this load game menu
		for(int j=0; j<4; j++)
		{
			pAllListUnit[0]->m_pList[j] = new CDDList;
			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( !pAllListUnit[0]->m_pList[j]->
				PreLoad( BitmapFileId, pShow.x, pShow.y, nWidth, nHeight) )
				return FALSE;
			pAllListUnit[0]->m_pList[j]->SetID( nID );
		}
		// to close the menu date file
		FSCAN.scan_close ();
		//fclose (fp) ;
		// to show this menu
		pAllBitmap[0]->Blit();
		Menu_MainLoad.Blit();
		pAllListUnit[0]->Blit();
		Menu_MainLoad.Update();

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

		int	OneBitmapWidth = 0 ;
		int	OneBitmapHeight = 0 ;

		CurrentMenu = &Menu_NetWork_InputName;
		// to set this menu's ID
		Menu_NetWork_InputName.SetID( lParam );
		// to set the smallest box of this menu
		FSCAN.l_scan (sscanf (FSCAN.expand_buf,"%d%d%d%d", &pShow.x, &pShow.y, &nWidth, &nHeight)); 
		//fscanf( fp, "%d%d%d%d", &pShow.x, &pShow.y, &nWidth, &nHeight);
		Menu_NetWork_InputName.SetPosition(pShow.x, pShow.y);
		Menu_NetWork_InputName.SetSize(nWidth, nHeight);

		// to preload all button of this menu
		for(int i=0; i<2; i++)
		{
			Menu_NetWork_InputName.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_NetWork_InputName.m_MenuButtonUnit.m_pButton[i]->
				PreLoad( BitmapFileId, pShow.x, pShow.y, nWidth, nHeight) )
				return FALSE;
			Menu_NetWork_InputName.m_MenuButtonUnit.m_pButton[i]->SetID(nID);
		}

		// to preload the back-ground 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;

		FSCAN.l_scan(sscanf (FSCAN.expand_buf,"%d%d%d%d%d", &BitmapFileId, &pShow.x, &pShow.y, &OneBitmapWidth, &OneBitmapHeight ));
		//fscanf( fp, "%d%d%d%d%d", &BitmapFileId, &pShow.x, &pShow.y, &OneBitmapWidth, &OneBitmapHeight );
		if( !sInputName.PreLoad( BitmapFileId, pShow.x, pShow.y, OneBitmapWidth, OneBitmapHeight) )
			return FALSE;

		FSCAN.scan_close (); 
		// to blit the bitmap to the back
		pAllBitmap[0]->Blit() ;
		sInputName.Blit();
		// to show this menu
		Menu_NetWork_InputName.Show();

		return	TRUE; 
	}
	else if( lParam == MENU_MAIN_NETWORK )
	{
		strcpy( fname, "set\\M_net.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_NetWork;
		Menu_NetWork.SetID( lParam );
		// to set the smallest box of this menu
		FSCAN.l_scan (sscanf (FSCAN.expand_buf,"%d%d%d%d", &pShow.x, &pShow.y, &nWidth, &nHeight));
		//fscanf( fp, "%d%d%d%d", &pShow.x, &pShow.y, &nWidth, &nHeight);
		Menu_NetWork.SetPosition(pShow.x, pShow.y);
		Menu_NetWork.SetSize(nWidth, nHeight);
	// to preload all button of this menu
		for(int i=0; i<4; i++)
		{
			Menu_NetWork.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_NetWork.m_MenuButtonUnit.m_pButton[i]->
				PreLoad( BitmapFileId, pShow.x, pShow.y, nWidth, nHeight) )
				return FALSE;
			Menu_NetWork.m_MenuButtonUnit.m_pButton[i]->SetID(nID);
		}
		FSCAN.scan_close ();

		Menu_NetWork.Show();

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

		CurrentMenu = &Menu_NetWork_Serial;
		// to set this menu's ID
		Menu_NetWork_Serial.SetID( lParam );
		// to set the smallest box of this menu
		FSCAN.l_scan (sscanf (FSCAN.expand_buf,"%d%d%d%d", &pShow.x, &pShow.y, &nWidth, &nHeight)); 
		Menu_NetWork_Serial.SetPosition(pShow.x, pShow.y);
		Menu_NetWork_Serial.SetSize(nWidth, nHeight);
		// to preload all button of this menu
		for(int i=0; i<3; i++)
		{
			Menu_NetWork_Serial.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_NetWork_Serial.m_MenuButtonUnit.m_pButton[i]->
				PreLoad( BitmapFileId, pShow.x, pShow.y, nWidth, nHeight) )
				return FALSE;
			Menu_NetWork_Serial.m_MenuButtonUnit.m_pButton[i]->SetID(nID);
		}
		FSCAN.scan_close (); 
		// to show this menu
		Menu_NetWork_Serial.Show();

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

		CurrentMenu = &Menu_NetWork_Ipx;
		// to set this menu's ID
		Menu_NetWork_Ipx.SetID( lParam );
		// to set the smallest box of this menu
		FSCAN.l_scan (sscanf (FSCAN.expand_buf,"%d%d%d%d", &pShow.x, &pShow.y, &nWidth, &nHeight)); 
		Menu_NetWork_Ipx.SetPosition(pShow.x, pShow.y);
		Menu_NetWork_Ipx.SetSize(nWidth, nHeight);
		// to preload the scroll bar 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 preload all button of this menu
		for(int i=0; i<5; i++)
		{
			Menu_NetWork_Ipx.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_NetWork_Ipx.m_MenuButtonUnit.m_pButton[i]->
				PreLoad( BitmapFileId, pShow.x, pShow.y, nWidth, nHeight) )
				return FALSE;
			Menu_NetWork_Ipx.m_MenuButtonUnit.m_pButton[i]->SetID(nID);
		}
		// to preload all list in this load game menu
		pAllListUnit[0] = new CDDListUnit;
		for(int j=0; j<4; j++)
		{
			pAllListUnit[0]->m_pList[j] = new CDDList;
			FSCAN.l_scan (sscanf (FSCAN.expand_buf,"%d%d%d%d%d%d", &BitmapFileId, &pShow.x, &pShow.y, &nWidth, &nHeight, &nID)); 
			if( !pAllListUnit[0]->m_pList[j]->
				PreLoad( BitmapFileId, pShow.x, pShow.y, nWidth, nHeight) )
				return FALSE;
			pAllListUnit[0]->m_pList[j]->SetID( nID );
		}
		FSCAN.scan_close (); 
		// to show this menu
		pAllBitmap[0]->Blit();
		Menu_NetWork_Ipx.Blit();
		pAllListUnit[0]->Blit();
		Menu_NetWork_Ipx.Update();

		return	TRUE; 
	}
	else if( lParam == MENU_MAIN_NETWORK_SETNET )
	{
		strcpy( fname, "set\\setnt_ic.exp" );

		FSCAN.scan_open (fname); 
		CurrentMenu = &Menu_NetWork_SetNet;
		// to set this menu's ID
		Menu_NetWork_SetNet.SetID( lParam );
		// to preload the back-ground 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 preload the button that be BUTTON_UP state to every game player
		for(int i=0; i<1; i++)
		{
			Menu_NetWork_SetNet.m_MenuButtonUnit.m_pButton[i] = new CDDButton;
			FSCAN.l_scan (sscanf (FSCAN.expand_buf,"%d%d%d%d%d%d%d", &BitmapFileId, &pShow.x, &pShow.y, &nWidth, &nHeight, &nID, &nState)); 
			if( !Menu_NetWork_SetNet.m_MenuButtonUnit.m_pButton[i]->
				PreLoad( BitmapFileId, pShow.x, pShow.y, nWidth, nHeight) )
				return FALSE;
			Menu_NetWork_SetNet.m_MenuButtonUnit.m_pButton[i]->SetID(nID);
			Menu_NetWork_SetNet.m_MenuButtonUnit.m_pButton[i]->SetState( BUTTON_DISABLE );
		}

		for( int king=0; king<4; king++ )
		{
			Menu_NetWork_SetNet.m_MenuButtonUnit.m_pButton[1+king] = new CDDButton;
			FSCAN.l_scan (sscanf (FSCAN.expand_buf,"%d%d%d%d%d%d%d", &BitmapFileId, &pShow.x, &pShow.y, &nWidth, &nHeight, &nID, &nState)); 
			if( !Menu_NetWork_SetNet.m_MenuButtonUnit.m_pButton[1+king]->
				PreLoad( BitmapFileId, pShow.x, pShow.y, nWidth, nHeight) )
				return FALSE;
			Menu_NetWork_SetNet.m_MenuButtonUnit.m_pButton[1+king]->SetID(nID);
			Menu_NetWork_SetNet.m_MenuButtonUnit.m_pButton[1+king]->SetState( BUTTON_UP );
			Menu_NetWork_SetNet.m_MenuButtonUnit.m_pButton[1+king]->m_nState = BUTTON_DISABLE ;
		}
		
		// to preload the button that only be BUTTON_UP state to the game creater

⌨️ 快捷键说明

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