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

📄 cbprompt.cpp

📁 网页游戏赤壁
💻 CPP
📖 第 1 页 / 共 4 页
字号:
/////////////
//	CBPrompt.cpp	:	v0010
//	Written by		:	Li Haijun
//	Compiler		:	Microsoft Visual C++ 4.0 & DirectX
//	Library			:	No .Lib
//	Copyright (C)	:	1997 WayAhead Corporation 
//	v0010			:	Mar.16.1997
/////////////
// to declear the function to show the prompt block to prompt area
///////////////////////////////////////////////////////////////////////////

#include	"stdafx.h"
#include	<stdio.h>

#include	"memory.h"

#include	"Assert.h"
#include	"puthz.h"

// to include the read hz function that attend by One Fish
#include	"l_text.h"

#include	"cbprompt.h"
#include	"DDButton.h"
#include	"DDBitmap.h"
#include	"CBPerbar.h"

#include	"interfac.h"

// temperory
#include	"ddcompo.h"
////////////////////////////////
//	the current prompt block
struct	PROMPT_BLOCK	FACE_CURRENT_PROMPT_BLOCK;
// the background of prompt area
extern	class CDDBitmap		bmPromptArea;	//(120, 169) -> (501, 158) ---------------
extern	class CDDBitmap		bmButtonBackground;		// the background of the command button when it show in prompt region
extern	class CDDBitmap		bmGeneralBackground;	// the background of the general head picture when it show in prompt region
extern	class CDDBitmap		FACE_GeneralFace;		// the head paint of all attend general 
// the four percent bar of prompt area
extern	class	CPercentBar	FACE_Stone;		// to show the stone of a building
extern	class	CPercentBar FACE_Power;		// to show the power of a general//武力
extern	class	CPercentBar FACE_Blood;		// to show the blood of a general//体力
extern	class	CPercentBar FACE_Process;	// to show the process of a product to be producted

extern class	CDDButton		ml_Main_Peasant;
extern class	CDDButton		ml_Chao_Main_Upgrade1;
extern class	CDDButton		ml_Chao_Main_Upgrade2;
extern class	CDDButton		ml_Chao_Main_Upgrade3;
extern class	CDDButton		ml_Liu_Main_Upgrade1;
extern class	CDDButton		ml_Liu_Main_Upgrade2;
extern class	CDDButton		ml_Liu_Main_Upgrade3;

extern class	CDDButton		ml_Lumber_UpgradeBow1;
extern class	CDDButton		ml_Lumber_UpgradeBow2;
extern class	CDDButton		ml_Lumber_UpgradeBow3;

extern class	CDDButton		ml_WeaponFactory_UpgradeWeapon1;
extern class	CDDButton		ml_WeaponFactory_UpgradeWeapon2;
extern class	CDDButton		ml_WeaponFactory_UpgradeWeapon3;
extern class	CDDButton		ml_WeaponFactory_UpgradeArmor1;		// armor --> 盔甲,装甲
extern class	CDDButton		ml_WeaponFactory_UpgradeArmor2;
extern class	CDDButton		ml_WeaponFactory_UpgradeArmor3;

extern class	CDDButton		ml_Shop_Sale100Wood;
extern class	CDDButton		ml_Shop_Sale100Food;
extern class	CDDButton		ml_Shop_Sale100Iron;
extern class	CDDButton		ml_Shop_Sale1000Wood;
extern class	CDDButton		ml_Shop_Sale1000Food;
extern class	CDDButton		ml_Shop_Sale1000Iron;

extern class	CDDButton		ml_FootmanSchool_100;		// Footman --> 步兵
extern class	CDDButton		ml_FootmanSchool_200;
extern class	CDDButton		ml_FootmanSchool_500;
extern class	CDDButton		ml_FootmanSchool_1000;

extern class	CDDButton		ml_KnightSchool_100;		// Knight --> 骑兵
extern class	CDDButton		ml_KnightSchool_200;
extern class	CDDButton		ml_KnightSchool_500;

extern class	CDDButton		ml_BowmanSchool_100;		// bowman --> 弓兵
extern class	CDDButton		ml_BowmanSchool_200;
extern class	CDDButton		ml_BowmanSchool_500;
extern class	CDDButton		ml_BowmanSchool_1000;

extern class	CDDButton		ml_VehiclemanSchool_Vehicleman;		// Vehicleman --> 车兵
extern class	CDDButton		ml_VehiclemanSchool_Upgrade1;
extern class	CDDButton		ml_VehiclemanSchool_Upgrade2;

extern class	CDDButton		ml_Shipyard_Destroyer;				// destroyer  --> 驱逐舰 (快船)
extern class	CDDButton		ml_Shipyard_Battleship;				// battleship --> 主力舰 (战船)
extern class	CDDButton		ml_Shipyard_Transport;				// transport  --> 运输船
extern class	CDDButton		ml_Shipyard_UpgradeDestroyer;
extern class	CDDButton		ml_Shipyard_UpgradeBattleship;
extern class	CDDButton		ml_Shipyard_UpgradeShipArmor;
extern class	CDDButton		ml_Shipyard_GroupShip;				// group ship --> 连锁船

extern class	CDDButton		ml_Establish;	// establish --> 组建
extern class	CDDButton		ml_Join;		// join --> 加入

extern class	CDDButton		ml_Move;
extern class	CDDButton		ml_Attack;
extern class	CDDButton		ml_Guard;		// guard --> 防御
extern class	CDDButton		ml_LineUp;		// lineup --> 阵型
extern class	CDDButton		ml_Rest;		
extern class	CDDButton		ml_Stratagem;	// stratagem --> 计谋
extern class	CDDButton		ml_Dismiss;		// dismiss --> 解散
extern class	CDDButton		ml_Single;		// single --> 单挑
extern class	CDDButton		ml_Transport;	// transport --> 运载
extern class	CDDButton		ml_Chao_Build;	// 君主为曹操时的建造
extern class	CDDButton		ml_Liu_Build;	// 君主为刘备时的建造
extern class	CDDButton		ml_Repair;
extern class	CDDButton		ml_Ship;
extern class	CDDButton		ml_Unship;

extern class	CDDButton		ml_Chao_Build_Main;
extern class	CDDButton		ml_Chao_Build_Farm;
extern class	CDDButton		ml_Chao_Build_Lumber;
extern class	CDDButton		ml_Chao_Build_WeaponFactory;
extern class	CDDButton		ml_Chao_Build_Shop;
extern class	CDDButton		ml_Chao_Build_FootmanSchool;
extern class	CDDButton		ml_Chao_Build_KnightSchool;
extern class	CDDButton		ml_Chao_Build_BowmanSchool;
extern class	CDDButton		ml_Chao_Build_VehiclemanSchool;
extern class	CDDButton		ml_Chao_Build_Shipyard;
extern class	CDDButton		ml_Chao_Build_Tower;
extern class	CDDButton		ml_Chao_Build_Flag;
extern class	CDDButton		ml_Chao_Build_Door;
extern class	CDDButton		ml_Chao_Build_PageUp;
extern class	CDDButton		ml_Chao_Build_PageDown;
extern class	CDDButton		prompt_Chao_House;

extern class	CDDButton		ml_Liu_Build_Main;
extern class	CDDButton		ml_Liu_Build_Farm;
extern class	CDDButton		ml_Liu_Build_Lumber;
extern class	CDDButton		ml_Liu_Build_WeaponFactory;
extern class	CDDButton		ml_Liu_Build_Shop;
extern class	CDDButton		ml_Liu_Build_FootmanSchool;
extern class	CDDButton		ml_Liu_Build_KnightSchool;
extern class	CDDButton		ml_Liu_Build_BowmanSchool;
extern class	CDDButton		ml_Liu_Build_VehiclemanSchool;
extern class	CDDButton		ml_Liu_Build_Shipyard;
extern class	CDDButton		ml_Liu_Build_Tower;
extern class	CDDButton		ml_Liu_Build_Flag;
extern class	CDDButton		ml_Liu_Build_Door;
extern class	CDDButton		ml_Liu_Build_PageUp;
extern class	CDDButton		ml_Liu_Build_PageDown;
extern class	CDDButton		prompt_Liu_House;

extern class	CDDButton		ml_LineUp_One;		//一字长蛇阵
extern class	CDDButton		ml_LineUp_Two;		//二龙出水阵
extern class	CDDButton		ml_LineUp_Three;	//三才天地阵
extern class	CDDButton		ml_LineUp_Four;		//四象奇门阵
extern class	CDDButton		ml_LineUp_Five;		//五行梅花阵
extern class	CDDButton		ml_LineUp_Six;		//六合连环阵
extern class	CDDButton		ml_LineUp_Seven;	//七星北斗阵
extern class	CDDButton		ml_LineUp_Eight;	//八门金锁阵
extern class	CDDButton		ml_LineUp_Nine;		//九宫八卦阵
extern class	CDDButton		ml_LineUp_Ten;		//十面埋伏阵
extern class	CDDButton		ml_LineUp_PageUp;
extern class	CDDButton		ml_LineUp_PageDown;

extern class	CDDButton		ml_Stratagem_Encourage;	//激励
extern class	CDDButton		ml_Stratagem_SpeedUp;	//加速
extern class	CDDButton		ml_Stratagem_SpeedDown;	//减速
extern class	CDDButton		ml_Stratagem_SeeFar;	//远视
extern class	CDDButton		ml_Stratagem_Anarchy;	//混乱 
extern class	CDDButton		ml_Stratagem_RollTimber;//滚木
extern class	CDDButton		ml_Stratagem_Ambuscade;	//埋伏
extern class	CDDButton		ml_Stratagem_BringBack;	//恢复
extern class	CDDButton		ml_Stratagem_Fire;		//火攻

extern class	CDDButton		prompt_Iron_Mine;		//铁矿
extern class	CDDButton		prompt_Citizen_Male;	//男平民
extern class	CDDButton		prompt_Citizen_Female;	//女平民

//char	OfficeKind[12];
char	LineUpKind[12];

///////////////////////////////////////
//	to show the four process bars
///////////////////////////////////////
BOOL	FACE_ShowProcessBar( int BarID, int NewData )
{
	switch( BarID )
	{
	case PROCESSBAR_STONE:					//建筑的坚固度
		FACE_Stone.UpdateData(NewData);
		break;
	case PROCESSBAR_POWER:					//将领武力条
		FACE_Power.UpdateData(NewData);
		break;
	case PROCESSBAR_BLOOD:					//将领体力条
		FACE_Blood.UpdateData(NewData);
		break;
	case PROCESSBAR_PROCESS:				//建造进度条
		FACE_Process.UpdateData(NewData);
		break;
	default:
		return FALSE;
	}
	return TRUE;
}
// to show prompt block
void	FACE_ShowPromptBlock( struct	PROMPT_BLOCK PromptBlock )
{
	FACE_SetCurrentPromptBlock( PromptBlock );
	FACE_ShowCurrentBlock();
}

// to set the prompt block to the global struct veriable FACE_PROMPT_BLOCK
void	FACE_SetCurrentPromptBlock( struct	PROMPT_BLOCK PromptBlock )
{
	memcpy( &FACE_CURRENT_PROMPT_BLOCK,	&PromptBlock, sizeof(PROMPT_BLOCK) );
}

//		to define the function to show the prompt block to the prompt area
BOOL	FACE_ShowCurrentBlock( )
{
	int		iResult;

	CDDButton	* temp1;
	CDDButton	* temp2;
	class	CDDText prompt_text;		// the prompt string 
	class	CDDText	infor_text;			// the text that inpur from FACE_CURRENT_PROMPT_BLOCK
	char	Grade[8];		//	级别
	char	Experience[8];	//	经验值
	char	Ruse[8];		//	谋略
	char	Morale[6];		//	士气
	char	SoliderNumber[8];	//士兵数
	char	Attack[8];		//	攻击力
	char	Defence[8];		//	防御力
	char	Carry[6];		//	射程
	char	Eyesight[6];	//	视野
	char	UnitNumber[6];	//	个数
	char	Amount[6];		//	人数

	// to blit the prompt background to the back buffer 
	bmPromptArea.Blit();

// to blit the prompt block information to the prompt area
	if( FACE_CURRENT_PROMPT_BLOCK.PromptBlockId == PROMPT_CONSTRUCTION_BUILDING )
	{
		// to blit the background that around the button
		bmButtonBackground.Blit();
		// to blit the bitmap on the left-top of the prompt area
		temp1 = GetButtonPointer( FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Construction_Building.ConstructionBitmapId,
								  FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Construction_Building.ConstructionGrade );
		// to set the position of this bitmap 
		temp1->SetPosition(506, 163);
		temp1->SetState(BUTTON_UP);
		temp1->Blit();
		// to set the button as a bitmap instead of a button
		temp1->SetState(BUTTON_HIDE);
		// to blit the stone percent bar
		FACE_Stone.Blit( FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Construction_Building.Stone );
		// blit the text to the prompt area
		
		iResult = infor_text.BeginText( 10 );	// ( 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(), 556, 194,
				FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Construction_Building.ConstructionName );
		// to release the text surface
		infor_text.EndText( );
		// to blit the process bar
		FACE_Process.Blit( FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Construction_Building.Stone );
	}
	else if( FACE_CURRENT_PROMPT_BLOCK.PromptBlockId == PROMPT_CONSTRUCTION_WORKING )
	{
		// to blit the background that around the button
		bmButtonBackground.Blit();
		// to blit the construct bitmap on the left-top of the prompt area
		temp1 = GetButtonPointer( FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Construction_Working.ConstructionBitmapId,
								  FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Construction_Working.ConstructionGrade );
		temp1->SetPosition(506, 163);
		temp1->SetState(BUTTON_UP);
		temp1->Blit();
		temp1->SetState(BUTTON_HIDE);
		// to blit the stone percent bar
		FACE_Stone.Blit(FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Construction_Working.Stone);
		// to blit the bitmap of product thar this construction is producting
		temp2 = GetButtonPointer( FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Construction_Working.ProductBitmapId );
		temp2->SetPosition(504, 254);
		temp2->SetState(BUTTON_UP);
		temp2->Blit();
		temp2->SetState(BUTTON_HIDE);
		// blit the text to the prompt area
/*		if( FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Construction_Working.ConstructionGrade == 0 )
			strcpy( Grade, "一 级");
		else if( FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Construction_Working.ConstructionGrade == 1 )
			strcpy( Grade, "二 级");
		else if( FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Construction_Working.ConstructionGrade == 2 )
			strcpy( Grade, "三 级");
		else
			return FALSE;
*/
		int temp = FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Construction_Working.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
			return FALSE ;

//		strcat( Grade, "\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_Working.ConstructionName );
		// to release the text surface
		infor_text.EndText( );
		// to blit the process bar
		FACE_Process.Blit(FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Construction_Working.Percent);
	}
	else if( FACE_CURRENT_PROMPT_BLOCK.PromptBlockId == PROMPT_CONSTRUCTION_IDLESS )
	{
		// to blit the background that around the button
		bmButtonBackground.Blit();
		// to blit the construct bitmap on the left-top of the prompt area
		temp1 = GetButtonPointer( FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Construction_Idless.ConstructionBitmapId,
								  FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Construction_Idless.ConstructionGrade	);
		temp1->SetPosition(506, 163);
		temp1->SetState(BUTTON_UP);
		temp1->Blit();
		temp1->SetState(BUTTON_HIDE);
		// to blit the stone percent bar
		FACE_Stone.Blit(FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Construction_Idless.Stone);
		//	to blit the word of grade to the prompt area
		//	if the ConstructionBitmapId == 22 (铁矿) , don't show it grade, ironmine have no grade
		if( FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Construction_Idless.ConstructionBitmapId != 22 )	
		{
/*			if( FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Construction_Idless.ConstructionGrade == 0 )
				strcpy( Grade, "一 级");
			else if( FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Construction_Idless.ConstructionGrade == 1 )
				strcpy( Grade, "二 级");
			else if( FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Construction_Idless.ConstructionGrade == 2 )
				strcpy( Grade, "三 级");

⌨️ 快捷键说明

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