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

📄 cbprompt.cpp

📁 网页游戏赤壁
💻 CPP
📖 第 1 页 / 共 4 页
字号:
			else if( FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Construction_Idless.ConstructionGrade == 3 )
				strcpy( Grade, "四 级");
			else if( FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Construction_Idless.ConstructionGrade == 4 )
				strcpy( Grade, "五 级");
*/
			int temp = FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Construction_Idless.ConstructionGrade ;
			if( temp >= 0 && temp < 5 )
			{
				CText_apply  Text;
				Text.Text_open ("set\\hz.ext");
				Text.Text_use (Grade, temp+4);	// the string "一 级" is place in #4 in the hz.set file
				Text.Text_close ();
			}
			else
			{
				_itoa(FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Construction_Idless.ConstructionGrade, Grade, 10 );
			}
		}
		else
		{
			char	temp[8];
			_itoa( FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Construction_Idless.ConstructionGrade, temp, 10 );
			strcpy( Grade, temp);
//			Grade[0] = '\0';
		}

//		Grade[8] = '\0';
		iResult = infor_text.BeginText( 8 );	// ( 640 - 30 ) / 16
		if( ! iResult )
			return FALSE;
		// to set the color of this text show
		infor_text.SetTextColor( RGB(255, 255, 255) );
		// to blit this text to the just position
		infor_text.MyTextOut( DD_GetBackBuffer(), 552, 194, Grade );
		infor_text.GetDDSurface()->Erase();
		infor_text.MyTextOut( DD_GetBackBuffer(), 552, 167, 
				FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Construction_Idless.ConstructionName );
		// to release the text surface
		infor_text.EndText( );
	}
	else if( FACE_CURRENT_PROMPT_BLOCK.PromptBlockId == PROMPT_UNIT )
	{
	// to blit the background that around the general's head finger
		bmGeneralBackground.SetPosition( 504, 161 ) ;
		bmGeneralBackground.Blit();
	// to calculate the sub rectangle of one general's head finger in the whole face bitmap file->zzj_face.bmp
		RECT	FaceRect ;
		int		FaceId = FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Unit.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( 506, 169 ) ;
		FACE_GeneralFace.Blit( &FaceRect );
// to blit the power percent bar and blood percent bar 
		FACE_Power.SetPosition( 505, 162 ) ;			//定武力条的位子
		FACE_Power.Blit( FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Unit.GeneralPower );
		FACE_Blood.SetPosition( 505, 243 ) ;			////定体力条的位子
		FACE_Blood.Blit( FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Unit.GeneralBlood );
		// to read the all string first
		CText_apply  Text;
		char jy[50] ;	//"经 验"
		char ml[50] ;	//"谋 略"
		char sq[50] ;	//"士 气"
		char rs[50] ;	//"人 数"
		memset (jy,0,sizeof(jy));
		memset (ml,0,sizeof(ml));
		memset (sq,0,sizeof(sq));
		memset (rs,0,sizeof(rs));
		Text.Text_open ("set\\hz.ext");
		Text.Text_use (jy,9);
		Text.Text_use (ml,10);
		Text.Text_use (sq,11);
		Text.Text_use (rs,12);
		Text.Text_close ();

// to blit all prompt word for attribute of this general to the prompt area
		iResult = prompt_text.BeginText( 8 );
		if( ! iResult )
			return FALSE;
		// to set the color of this text show 
		prompt_text.SetTextColor( RGB(255, 255, 120) );
		prompt_text.EndText();
		// to blit the attribute prompt word to the prompt area
		iResult = prompt_text.BeginText( 8 );
		if( ! iResult )
			return FALSE;
		prompt_text.SetTextColor( RGB( 255,,255, 120 ) ) ;
		prompt_text.MyTextOut(DD_GetBackBuffer(), 512, 253, jy);
		prompt_text.GetDDSurface()->Erase();
		prompt_text.MyTextOut(DD_GetBackBuffer(), 512, 272, ml);
		prompt_text.GetDDSurface()->Erase();
		prompt_text.MyTextOut(DD_GetBackBuffer(), 512, 291, sq);
		prompt_text.GetDDSurface()->Erase();
		prompt_text.MyTextOut(DD_GetBackBuffer(), 512, 308, rs);
		prompt_text.EndText();
	// to blit all attribute to the prompt area
		// to covert all int attribute to string 
		_itoa( FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Unit.Experience, Experience, 10 );
		_itoa( FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Unit.Ruse, Ruse, 10 );
		_itoa( FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Unit.UnitMorale, Morale, 10 );
		_itoa( FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Unit.NumberOfSolider, SoliderNumber, 10 );
		// to blit all attribute to the prompt area
		iResult = infor_text.BeginText( 12 );
		if( ! iResult )
			return FALSE;
		// to set the color of this text
		infor_text.SetTextColor( RGB(255, 255, 255) );
		// to blit the texts
		infor_text.MyTextOut(DD_GetBackBuffer(), 569, 175,
							FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Unit.GeneralName );
		infor_text.GetDDSurface()->Erase();
		// to get the office by a number
//		GetOffice( FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Unit.Office );
		// to divide the office kind to two part  2个字 + 3个字
		char	cFirstPart[7];		//	前三个字+'\0'
		char	cSecondPart[7];		//  后三个字+'\0'

		cFirstPart[0] = FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Unit.Office[0]; 
		cFirstPart[1] = FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Unit.Office[1]; 
		cFirstPart[2] = FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Unit.Office[2]; 
		cFirstPart[3] = FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Unit.Office[3]; 
		cFirstPart[4] = FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Unit.Office[4]; 
		cFirstPart[5] = FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Unit.Office[5]; 
		cFirstPart[6] = '\0'; 
		cSecondPart[0] = FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Unit.Office[6]; 
		cSecondPart[1] = FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Unit.Office[7]; 
		cSecondPart[2] = FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Unit.Office[8]; 
		cSecondPart[3] = FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Unit.Office[9]; 
		cSecondPart[4] = FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Unit.Office[10]; 
		cSecondPart[5] = FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Unit.Office[11]; 
		cSecondPart[6] = '\0'; 

		infor_text.MyTextOut(DD_GetBackBuffer(), 570, 205, cFirstPart );
		infor_text.GetDDSurface()->Erase();
		infor_text.MyTextOut(DD_GetBackBuffer(), 570, 225, cSecondPart );
		infor_text.GetDDSurface()->Erase();
		infor_text.MyTextOut(DD_GetBackBuffer(), 580, 253, Experience );
		infor_text.GetDDSurface()->Erase();
		infor_text.MyTextOut(DD_GetBackBuffer(), 580, 272, Ruse );
		infor_text.GetDDSurface()->Erase();
		infor_text.MyTextOut(DD_GetBackBuffer(), 580, 291, Morale );
		infor_text.GetDDSurface()->Erase();
		// to get the line up by a number
//		GetLineUp( FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Unit.UnitLineUp );
//		infor_text.MyTextOut(DD_GetBackBuffer(), 504, 307, LineUpKind );
		// to text the number of the soliders that belong to this general
		infor_text.MyTextOut(DD_GetBackBuffer(), 580, 308, SoliderNumber );
		infor_text.GetDDSurface()->Erase();
		// to release the text surface
		infor_text.EndText( );
	}
	else if( FACE_CURRENT_PROMPT_BLOCK.PromptBlockId == PROMPT_SOLDIER_SINGLE )
	{
		// to blit the background that around the button
		bmButtonBackground.Blit();
		// to blit the unit bitmap on the left-top of the prompt area
		temp1 = GetButtonPointer( FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Soldier_Single.SoldierBitmapId );
		temp1->SetPosition(506, 163);
		temp1->SetState(BUTTON_UP);
		temp1->Blit();
		temp1->SetState(BUTTON_HIDE);
	// to blit the power percent bar //对于单兵,SoldierPower 是体力
		FACE_Stone.Blit( FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Soldier_Single.SoldierPower );
	// to blit all prompt word for attribute of this general to the prompt area
		iResult = prompt_text.BeginText( 8 );
		if( ! iResult )
			return FALSE;
		// to set the color of this text show 
		prompt_text.SetTextColor( RGB(255, 255, 120) );
		// to read the all string first
		CText_apply  Text;
		char gs[50] ;	//"归 属"
		char gjl[50] ;	//"攻击力"
		char fyl[50] ;	//"防御力"
		char sc[50] ;	//"射 程"
		char sy[50] ;	//"视 野"
		memset (gs,0,sizeof(gs));
		memset (gjl,0,sizeof(gjl));
		memset (fyl,0,sizeof(fyl));
		memset (sc,0,sizeof(sc));
		memset (sy,0,sizeof(sy));
		Text.Text_open ("set\\hz.ext");
		Text.Text_use (gs,13);
		Text.Text_use (gjl,14);
		Text.Text_use (fyl,15);
		Text.Text_use (sc,16);
		Text.Text_use (sy,17);
		Text.Text_close ();
		// to blit the attribute prompt word to the prompt area
		prompt_text.MyTextOut(DD_GetBackBuffer(), 504, 219, gs);
		prompt_text.GetDDSurface()->Erase();
		prompt_text.MyTextOut(DD_GetBackBuffer(), 504, 239, gjl);
		prompt_text.GetDDSurface()->Erase();
		prompt_text.MyTextOut(DD_GetBackBuffer(), 504, 259, fyl);
		prompt_text.GetDDSurface()->Erase();
		prompt_text.MyTextOut(DD_GetBackBuffer(), 504, 279, sc);
		prompt_text.GetDDSurface()->Erase();
		prompt_text.MyTextOut(DD_GetBackBuffer(), 504, 299, sy);
		prompt_text.EndText();
	// to blit all attribute to the prompt area
		// to covert all int attribute to string 
		_itoa( FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Soldier_Single.SoldierAttack, Attack, 10 );
		_itoa( FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Soldier_Single.SoldierDefence, Defence, 10 );
		_itoa( FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Soldier_Single.SoldierCarry, Carry, 10 );
		_itoa( FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Soldier_Single.SoldierEyesight, Eyesight, 10 );
		// to blit all attribute to the prompt area
		iResult = infor_text.BeginText( 10 );
		if( ! iResult )
			return FALSE;
		// to set the color of this text
		infor_text.SetTextColor( RGB(255, 255, 255) );
		// to blit the texts
		infor_text.MyTextOut(DD_GetBackBuffer(), 552, 194,
					FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Soldier_Single.SoldierKind );
		infor_text.GetDDSurface()->Erase();
		infor_text.MyTextOut(DD_GetBackBuffer(), 562, 219,
					FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Soldier_Single.SoldierAscroption );
		infor_text.GetDDSurface()->Erase();
		infor_text.MyTextOut(DD_GetBackBuffer(), 562, 239, Attack );
		infor_text.GetDDSurface()->Erase();
		infor_text.MyTextOut(DD_GetBackBuffer(), 562, 259, Defence );
		infor_text.GetDDSurface()->Erase();
		infor_text.MyTextOut(DD_GetBackBuffer(), 562, 279, Carry );
		infor_text.GetDDSurface()->Erase();
		infor_text.MyTextOut(DD_GetBackBuffer(), 562, 299, Eyesight );
		// to release the text surface
		infor_text.EndText( );
	}
	else if( FACE_CURRENT_PROMPT_BLOCK.PromptBlockId == PROMPT_SOLDIER_MORE )
	{
	// to blit all prompt word for attribute of this general to the prompt area
		iResult = prompt_text.BeginText( 8 );
		if( ! iResult )
			return FALSE;
		// to set the color of this text show 
		prompt_text.SetTextColor( RGB(255, 255, 120) );
		// to read the all string first
		CText_apply  Text;
		char gs[50] ;	//"个数"
		char rs[50] ;	//"人数"
		memset (gs,0,sizeof(gs));
		memset (rs,0,sizeof(rs));
		Text.Text_open ("set\\hz.ext");
		Text.Text_use (gs,18);
		Text.Text_use (rs,19);
		Text.Text_close ();
		// to blit the attribute prompt word to the prompt area
		prompt_text.MyTextOut(DD_GetBackBuffer(), 512, 200, gs);
		prompt_text.GetDDSurface()->Erase();
		prompt_text.MyTextOut(DD_GetBackBuffer(), 512, 230, rs);
		prompt_text.EndText();
	// to blit all attribute to the prompt area
		// to covert all int attribute to string 
		_itoa( FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Soldier_More.UnitNumber, UnitNumber, 10 );
		_itoa( FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Soldier_More.Amount, Amount, 10 );
		// to blit all attribute to the prompt area
		iResult = infor_text.BeginText( 10 );
		if( ! iResult )
			return FALSE;
		// to set the color of this text
		infor_text.SetTextColor( RGB(255, 255, 255) );
		// to blit the texts
		infor_text.MyTextOut(DD_GetBackBuffer(), 580, 200, UnitNumber );
		infor_text.GetDDSurface()->Erase();
		infor_text.MyTextOut(DD_GetBackBuffer(), 580, 230, Amount );
		// to release the text surface
		infor_text.EndText( );
	}
	else if( FACE_CURRENT_PROMPT_BLOCK.PromptBlockId == PROMPT_TRANSPORT_SHIP )
	{
		// to blit the background that around the button
		bmButtonBackground.Blit();
		// to blit the unit bitmap on the left-top of the prompt area
		temp1 = GetButtonPointer( FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Transport_Ship.SoldierBitmapId );
		temp1->SetPosition(506, 163);
		temp1->SetState(BUTTON_UP);
		temp1->Blit();
		temp1->SetState(BUTTON_HIDE);
	// to blit the power percent bar //对于单兵来讲,SoldierPower是体力
		FACE_Stone.Blit( FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Transport_Ship.SoldierPower );
	// to blit all prompt word for attribute of this general to the prompt area
		iResult = prompt_text.BeginText( 8 );
		if( ! iResult )
			return FALSE;
		// to set the color of this text show 
		prompt_text.SetTextColor( RGB(255, 255, 120) );
		// to read the all string first
		CText_apply  Text;
		char gs[50] ;	//"个数"
		char rs[50] ;	//"人数"
		memset (gs,0,sizeof(gs));
		memset (rs,0,sizeof(rs));
		Text.Text_open ("set\\hz.ext");
		Text.Text_use (gs,18);
		Text.Text_use (rs,19);
		Text.Text_close ();
		// to blit the attribute prompt word to the prompt area
		prompt_text.MyTextOut(DD_GetBackBuffer(), 504, 230, gs);
		prompt_text.GetDDSurface()->Erase();
		prompt_text.MyTextOut(DD_GetBackBuffer(), 504, 260, rs);
		prompt_text.GetDDSurface()->Erase();
		prompt_text.EndText();
	// to blit all attribute to the prompt area
		// to covert all int attribute to string 
		_itoa( FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Transport_Ship.NumberOfUnit, UnitNumber, 10 );
		_itoa( FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Transport_Ship.NumberOfSolider, Amount, 10 );
		// to blit all attribute to the prompt area
		iResult = infor_text.BeginText( 10 );
		if( ! iResult )
			return FALSE;
		// to set the color of this text
		infor_text.SetTextColor( RGB(255, 255, 255) );
		// to blit the texts
		infor_text.MyTextOut(DD_GetBackBuffer(), 552, 194,
					FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Transport_Ship.SoldierKind );
		infor_text.GetDDSurface()->Erase();
		infor_text.MyTextOut(DD_GetBackBuffer(), 562, 230, UnitNumber );
		infor_text.GetDDSurface()->Erase();
		infor_text.MyTextOut(DD_GetBackBuffer(), 562, 260, Amount );
		infor_text.GetDDSurface()->Erase();
		// to release the text surface
		infor_text.EndText( );
	}

	/////////////////////////////////////////////////////////////
	// if current is displaying a menu, return with do nothing
	//	July.24.1997
	if( FACE_GetCommandState() == COMMAND_STATE_MENU )
		return FALSE ;


	bmPromptArea.Update();

	return TRUE;
}
//////////////////////////////////////////
//	to fine the button by a command id
CDDButton * GetButtonPointer( int ID, int grade/* = 0*/ )
{
	switch( ID )
	{
	case BUTTON_MAIN_PEASANT:
	case 30:
		return &ml_Main_Peasant ;
		break;
//	曹操主帅帐命令集的消息
	case BUTTON_CHAO_BUILD_MAIN:

⌨️ 快捷键说明

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