www.pudn.com > chibi > INTERFA2.CPP


///////////// 
//	Interfac.cpp	:	v0010 
//	Written by		:	Li Haijun 
//	Compiler		:	Microsoft Visual C++ 4.0 & DirectX 
//	Library			:	DDraw.Lib 
//	Copyright (C)	:	1996 WayAhead Corporation  
//	v0010			:	Nev.7.1996 
///////////// 
// implementation file 
// This file provide basic interface function  
////////////////////////////// 
#include "stdafx.h" 
#include  
 
#include "Assert.h"		// debug function 
#include "puthz.h"		// to include the string output function 
#include "DDCompo.h" 
#include "CBGame.h"		// to include the GAME 
#include "CBDraw.h"		//  
#include "cbdata.h" 
#include "cbmini.h"		// to use the function MINI_Update  
 
#include "Marco.h"		// the define of all macroPO 
#include "DDButton.h"	// to include button's define  
#include "DDComUn.h"	// to include command unit's define 
#include "DDBitmap.h"	// to include class CDDBitmap's defnie 
#include "DDMenu.h"		// to include the menu 
#include "DDCheck.h"	// to include the check-box 
#include "DDList.h"		// to include the list 
#include "DDCombo.h"	// to include the combo-box 
#include "DDScroll.h"	// to include the scroll-bar 
#include "cbperbar.h"	// to include the process bar 
#include "cbprompt.h"	// to include the prompt block define 
#include "ddtext.h" 
 
#include "cbarray.h" 
#include "interfac.h" 
#include "Interfa1.h" 
#include "interfa2.h" 
 
#include "l_text.h"		// to include the read prompt information function writeen by LWC 
//////////////////////////// 
#include "l_scan.h" 
#include "l_allbmp.h" 
extern char	bmpfilename[30]; 
extern char	listfilename[30]; 
///////////////////////////////////// 
 
//#include 	 
 
#define		ENGLISH 
///////////////////////////////////////////// 
//////////////////Donghai/////////////////////////// 
#include	"Network.h" 
extern	BYTE	DP_SendMessageBuff[BUFFER_MAX_BYTE]; 
extern	LPSTR	DP_NickName; 
 
  
 
//////////////////Donghai/////////////////////////// 
 
//		the flag for message box 
BOOL	FACE_bMessageBox = FALSE;		// FALSE-->NO MESSAGE BOX 
								// TRUE -->SHOW MESSAGE BOX 
extern class	CDDBitmap	*	pAllBitmap[MAX_BITMAP];		//to store all bitmap's pointer  
extern class	CDDButton	*	pAllButton[MAX_BUTTON];		//to restore all button's pointer 
extern class	CDDButton	*	pAllCommandButton[MAX_COMMANDBUTTON];		//to restore all command button's pointer 
extern class	CDDCheckBoxUnit	*	pAllCheckBoxUnit[MAX_CHECKBOXUNIT];	//to restore all check-box's pointer 
extern class	CDDListUnit	*	pAllListUnit[MAX_LISTUNIT]; //to record all list-unit's pointer 
extern class	CDDComboBox	*	pAllComboBox[MAX_COMBOBOX];	//to record all combo-box's pointer 
extern class	CDDString	*	pAllString[MAX_TEXT] ;		// to store the four network game player's name in this 
 
extern class	CDDScrollBar *	pAllScrollBar[MAX_SCROLLBAR]; 
///////////////////////////////////////////// 
//		the flag for percent bar 
//BOOL	FACE_bPercentBar = FALSE;		// FALSE --> have no percent bar 
										// TRUE  --> have a percent bar 
///////////////////////////////////////////// 
//			Global		character		   // 
///////////////////////////////////////////// 
char	DIALOG_BUF[MAX_NAME_LETTER+1];	//to restore the string input to dialog 
class	CDDText DIALOG_TEXT;	// the string attribute of DIALOG_BUF 
int		DIALOG_LETTER_X = 0;	// x coordinates to use in dialog text matrix DIALOG_BUF 
 
char	MESSAGE_BUF[MAX_MESSAGE_LETTER+1] ; //keyboard buffer --> to restore your input for message 
int		MESSAGE_LETTER_X = 0;	// x coordinates to use in text matrix MESSAGE_BUF 
char	MESSAGE_PROMPT[MAX_PROMPT_LETTER+1] ; //prompt   buffer -->to restore your message prompt only 
char	MESSAGE_STRING[MAX_PROMPT_LETTER + MAX_MESSAGE_LETTER + 1] ; //prompt the MESSAGE_PROMPT+MESSAGE_BUF --> to restore all message 
 
char	NETWORK_MESSAGE_BUF[NETWORK_MAX_MESSAGE_LETTER+1] ; //keyboard buffer --> to restore your input for message 
int		NETWORK_MESSAGE_LETTER_X = 0;	// x coordinates to use in text matrix MESSAGE_BUF 
char	NETWORK_MESSAGE_PROMPT[MAX_PROMPT_LETTER+1] ; //prompt   buffer -->to restore your message prompt only 
char	NETWORK_MESSAGE_STRING[MAX_PROMPT_LETTER + NETWORK_MAX_MESSAGE_LETTER + 1] ; //prompt the MESSAGE_PROMPT+MESSAGE_BUF --> to restore all message 
 
// the following four string is used to store the network message that passed from the others 
class	CDDString	Net_Message_1 ; 
class	CDDString	Net_Message_2 ; 
class	CDDString	Net_Message_3 ; 
class	CDDString	Net_Message_4 ; 
 
class	CDDString	Net_EchoPrompt_Message ; 
 
//	process bar veriable 
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 
////////////////////////////////// 
//	the pointer array for all you general that can been select for establish battle unit 
extern	struct DATA_GENERAL_STRUCT * pAllGeneral[ MAX_ONEKINGGENERAL ]; 
// the pointer of all kind of element of menu 
extern class	CDDButton	*	pAllButton[MAX_BUTTON];		//to restore all button's pointer 
extern class			CDDButton	*	pAllCommandButton[MAX_COMMANDBUTTON];	//to store all command button's pointer 
extern class	CDDCheckBoxUnit	*	pAllCheckBoxUnit[MAX_CHECKBOXUNIT];	//to restore all check-box's pointer 
extern class	CDDListUnit	*	pAllListUnit[MAX_LISTUNIT]; //to record all list-unit's pointer 
extern class	CDDComboBox	*	pAllComboBox[MAX_COMBOBOX];	//to record all combo-box's pointer 
 
extern class	CDDScrollBar *	pAllScrollBar[MAX_SCROLLBAR]; 
// major parameter for bitmap(it record the current state of operate) 
extern	int		nPreviousButtonState;	// previous button's state,0-up,1-down,2-disable,3-focus,4-disable,5-hide 
extern	int		nCurrentButtonState;	// current button's state,0-up,1-down,2-disable,3-focus,4-disable,5-hide 
extern	int		nPreviousCheckBoxState;	// previous check-box's state,0-uncheck-up,1-uncheck-down,2-check-up,3-check-down,4-disable 
extern	int		nCurrentCheckBoxState;	// current check-box's state,0-uncheck-up,1-uncheck-down,2-check-up,3-check-down,4-disable 
extern	int		nCurrentListState;	// current List's state,0-up,1-down,2-focus,3-disable,4-hide 
// current command unit pointer 
// peasant-command-unit is a main command unit to build command unit 
extern class	CDDCommandUnit	* pCurrentMainCommandUnit ;	// a pointer point to the current main command unit 
extern class	CDDCommandUnit	* pCurrentCommandUnit ;	// a pointer point to the current command unit 
//////////////////////////////// 
//	the current prompt block 
extern	struct	PROMPT_BLOCK	FACE_CURRENT_PROMPT_BLOCK; 
/////////////////////////////////////////// 
//	to decide which unit of number to show 
/////////////////////////////////////////// 
extern BOOL	nNumState ;		//	0 -> to show   1 --- 10 
								//  1 -> to show   11 -- 20 
/////////////////////////////// 
// to declear command unit 
/////////////////////////////// 
///////////////////////////////////// 
//	main interface frame (four part) 
///////////////////////////////////// 
//	  ClassName   VaribleName         BitmapSize   top-left point	 bottom-right point 
extern class CDDBitmap	*	psMainBack;	//(640,480) -> (0,0)-----------------(639,479) 
extern class CDDBitmap		bmCommandArea;	//(120, 120) -> (501, 336) --------------- 
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		sTop;		//(640,48)  -> (0,0)-----------------(639,47) 
extern class CDDBitmap		sBottom;	//(640,24)  -> (0,456)---------------(639,479) 
extern class CDDBitmap		sLeft;		//(24,408)  -> (0,48)----------------(23,455) 
extern class CDDBitmap		sRight;		//(157,408) -> (483,48)--------------(639,455) 
 
extern class CDDBitmap		sInputName;		//(216,26) -> (211,337)--------------(427,362) 
///////////////////////////////////// 
// all bitmap button 
///////////////////////////////////// 
//		ClassName   VaribleName		BitmapSize       top-left point   bottom-right point 
/* 
class	CDDBitmap		tq;		//(16,16)	  ->	(3,101)---------(18,116)	  
class	CDDBitmap		fx;		//(16,16)	  ->	(3,123)---------(18,138)	  
class	CDDBitmap		sz;		//(16,16)	  ->	(3,145)---------(18,160)	  
class	CDDBitmap		FACE_GeneralFace;		//(59,74)	  ->	(3,145)---------(18,160)	  
 
class	CDDButton		zt;			//(16,16)	  ->	(3,167)---------(18,182)	  
 
class	CDDButton		num_arr;    //(16,16)	  ->	(3,391)---------(18,406) 
class	CDDButton		num_01;		//(16,16)	  ->	(3,228)---------(18,243) 
class	CDDButton		num_02;		//(16,16)	  ->	(3,244)---------(18,259) 
class	CDDButton		num_03;		//(16,16)	  ->	(3,260)---------(18,275) 
class	CDDButton		num_04;		//(16,16)	  ->	(3,276)---------(18,291) 
class	CDDButton		num_05;		//(16,16)	  ->	(3,292)---------(18,307) 
class	CDDButton		num_06;		//(16,16)	  ->	(3,308)---------(18,323) 
class	CDDButton		num_07;		//(16,16)	  ->	(3,324)---------(18,339) 
class	CDDButton		num_08;		//(16,16)	  ->	(3,340)---------(18,355) 
class	CDDButton		num_09;		//(16,16)	  ->	(3,356)---------(18,371) 
class	CDDButton		num_10;		//(16,16)	  ->	(3,372)---------(18,387) 
 
class	CDDButton		num_11;		//(16,16)	  ->	(3,228)---------(18,243) 
class	CDDButton		num_12;		//(16,16)	  ->	(3,244)---------(18,259) 
class	CDDButton		num_13;		//(16,16)	  ->	(3,260)---------(18,275) 
class	CDDButton		num_14;		//(16,16)	  ->	(3,276)---------(18,291) 
class	CDDButton		num_15;		//(16,16)	  ->	(3,292)---------(18,307) 
class	CDDButton		num_16;		//(16,16)	  ->	(3,308)---------(18,323) 
class	CDDButton		num_17;		//(16,16)	  ->	(3,324)---------(18,339) 
class	CDDButton		num_18;		//(16,16)	  ->	(3,340)---------(18,355) 
class	CDDButton		num_19;		//(16,16)	  ->	(3,356)---------(18,371) 
class	CDDButton		num_20;		//(16,16)	  ->	(3,372)---------(18,387) 
 
class	CDDButton		systemenu;	 
 
class	CDDButton		ml_Cancel;		// to cancel the last command 
 
class	CDDButton		prompt_Iron_Mine;		// 铁矿的图标 
class	CDDButton		prompt_Citizen_Male;	// 男平民 
class	CDDButton		prompt_Citizen_Female;	// 女平民 
 
class	CDDButton		ml_Main_Peasant; 
class	CDDButton		ml_Chao_Main_Upgrade1; 
class	CDDButton		ml_Chao_Main_Upgrade2; 
class	CDDButton		ml_Chao_Main_Upgrade3; 
class	CDDButton		ml_Liu_Main_Upgrade1; 
class	CDDButton		ml_Liu_Main_Upgrade2; 
class	CDDButton		ml_Liu_Main_Upgrade3; 
 
class	CDDButton		ml_Lumber_UpgradeBow1; 
class	CDDButton		ml_Lumber_UpgradeBow2; 
class	CDDButton		ml_Lumber_UpgradeBow3; 
 
class	CDDButton		ml_WeaponFactory_UpgradeWeapon1; 
class	CDDButton		ml_WeaponFactory_UpgradeWeapon2; 
class	CDDButton		ml_WeaponFactory_UpgradeWeapon3; 
class	CDDButton		ml_WeaponFactory_UpgradeArmor1;		// armor --> 盔甲,装甲 
class	CDDButton		ml_WeaponFactory_UpgradeArmor2; 
class	CDDButton		ml_WeaponFactory_UpgradeArmor3; 
 
class	CDDButton		ml_Shop_Sale100Wood; 
class	CDDButton		ml_Shop_Sale100Food; 
class	CDDButton		ml_Shop_Sale100Iron; 
class	CDDButton		ml_Shop_Sale1000Wood; 
class	CDDButton		ml_Shop_Sale1000Food; 
class	CDDButton		ml_Shop_Sale1000Iron; 
 
class	CDDButton		ml_FootmanSchool_100;		// Footman --> 步兵 
class	CDDButton		ml_FootmanSchool_200; 
class	CDDButton		ml_FootmanSchool_500; 
class	CDDButton		ml_FootmanSchool_1000; 
 
class	CDDButton		ml_KnightSchool_100;		// Knight --> 骑兵 
class	CDDButton		ml_KnightSchool_200; 
class	CDDButton		ml_KnightSchool_500; 
 
class	CDDButton		ml_BowmanSchool_100;		// bowman --> 弓兵 
class	CDDButton		ml_BowmanSchool_200; 
class	CDDButton		ml_BowmanSchool_500; 
class	CDDButton		ml_BowmanSchool_1000; 
 
class	CDDButton		ml_VehiclemanSchool_Vehicleman;		// Vehicleman --> 车兵 
class	CDDButton		ml_VehiclemanSchool_Upgrade1; 
class	CDDButton		ml_VehiclemanSchool_Upgrade2; 
 
class	CDDButton		ml_Shipyard_Destroyer;				// destroyer  --> 驱逐舰 (快船) 
class	CDDButton		ml_Shipyard_Battleship;				// battleship --> 主力舰 (战船) 
class	CDDButton		ml_Shipyard_Transport;				// transport  --> 运输船 
class	CDDButton		ml_Shipyard_UpgradeDestroyer; 
class	CDDButton		ml_Shipyard_UpgradeBattleship; 
class	CDDButton		ml_Shipyard_UpgradeShipArmor; 
class	CDDButton		ml_Shipyard_GroupShip;				// group ship --> 连锁船 
 
class	CDDButton		ml_Establish;	// establish --> 组建 
class	CDDButton		ml_Join;		// join --> 加入 
 
class	CDDButton		ml_Move; 
class	CDDButton		ml_Attack; 
class	CDDButton		ml_Guard;		// guard --> 防御 
class	CDDButton		ml_LineUp;		// lineup --> 阵型 
class	CDDButton		ml_Rest;		 
class	CDDButton		ml_Stratagem;	// stratagem --> 计谋 
class	CDDButton		ml_Dismiss;		// dismiss --> 解散 
class	CDDButton		ml_Single;		// single --> 单挑 
class	CDDButton		ml_Transport;	// transport --> 运载 
class	CDDButton		ml_Chao_Build;	// 君主为曹操时的建造 
class	CDDButton		ml_Liu_Build;	// 君主为刘备时的建造 
class	CDDButton		ml_Repair; 
class	CDDButton		ml_Ship; 
class	CDDButton		ml_Unship; 
class	CDDButton		ml_Back;		// 回送 
 
class	CDDButton		ml_Chao_Build_Main; 
class	CDDButton		ml_Chao_Build_Farm; 
class	CDDButton		ml_Chao_Build_Lumber; 
class	CDDButton		ml_Chao_Build_WeaponFactory; 
class	CDDButton		ml_Chao_Build_Shop; 
class	CDDButton		ml_Chao_Build_FootmanSchool; 
class	CDDButton		ml_Chao_Build_KnightSchool; 
class	CDDButton		ml_Chao_Build_BowmanSchool; 
class	CDDButton		ml_Chao_Build_VehiclemanSchool; 
class	CDDButton		ml_Chao_Build_Shipyard; 
class	CDDButton		ml_Chao_Build_Tower; 
class	CDDButton		ml_Chao_Build_Flag; 
class	CDDButton		ml_Chao_Build_Door; 
class	CDDButton		ml_Chao_Build_PageUp; 
class	CDDButton		ml_Chao_Build_PageDown; 
class	CDDButton		prompt_Chao_House;				// 曹操方民居图标 
 
class	CDDButton		ml_Liu_Build_Main; 
class	CDDButton		ml_Liu_Build_Farm; 
class	CDDButton		ml_Liu_Build_Lumber; 
class	CDDButton		ml_Liu_Build_WeaponFactory; 
class	CDDButton		ml_Liu_Build_Shop; 
class	CDDButton		ml_Liu_Build_FootmanSchool; 
class	CDDButton		ml_Liu_Build_KnightSchool; 
class	CDDButton		ml_Liu_Build_BowmanSchool; 
class	CDDButton		ml_Liu_Build_VehiclemanSchool; 
class	CDDButton		ml_Liu_Build_Shipyard; 
class	CDDButton		ml_Liu_Build_Tower; 
class	CDDButton		ml_Liu_Build_Flag; 
class	CDDButton		ml_Liu_Build_Door; 
class	CDDButton		ml_Liu_Build_PageUp; 
class	CDDButton		ml_Liu_Build_PageDown; 
class	CDDButton		prompt_Liu_House;				// 刘备方民居图标 
 
class	CDDButton		ml_LineUp_One;		//一字长蛇阵 
class	CDDButton		ml_LineUp_Two;		//二龙出水阵 
class	CDDButton		ml_LineUp_Three;	//三才天地阵 
class	CDDButton		ml_LineUp_Four;		//四象奇门阵 
class	CDDButton		ml_LineUp_Five;		//五行梅花阵 
class	CDDButton		ml_LineUp_Six;		//六合连环阵 
class	CDDButton		ml_LineUp_Seven;	//七星北斗阵 
class	CDDButton		ml_LineUp_Eight;	//八门金锁阵 
class	CDDButton		ml_LineUp_Nine;		//九宫八卦阵 
class	CDDButton		ml_LineUp_Ten;		//十面埋伏阵 
class	CDDButton		ml_LineUp_PageUp; 
class	CDDButton		ml_LineUp_PageDown; 
 
class	CDDButton		ml_Stratagem_Encourage;	//激励 
class	CDDButton		ml_Stratagem_SpeedUp;	//加速 
class	CDDButton		ml_Stratagem_SpeedDown;	//减速 
class	CDDButton		ml_Stratagem_SeeFar;	//远视 
class	CDDButton		ml_Stratagem_Anarchy;	//混乱  
class	CDDButton		ml_Stratagem_RollTimber;//滚木 
class	CDDButton		ml_Stratagem_Ambuscade;	//埋伏 
class	CDDButton		ml_Stratagem_BringBack;	//恢复 
class	CDDButton		ml_Stratagem_Fire;		//火攻 
*/ 
//////////////////////////////////// 
//	       all menu 
//////////////////////////////////// 
extern	CDDMenu		* CurrentMenu; 
extern	CDDMenu		Menu_Main; 
extern	CDDMenu		Menu_NewGame; 
extern	CDDMenu		Menu_MainLoad; 
extern	CDDMenu		Menu_NetWork; 
extern	CDDMenu		Menu_NetWork_InputName; 
extern	CDDMenu		Menu_NetWork_Serial; 
extern	CDDMenu		Menu_NetWork_Internet; 
extern	CDDMenu		Menu_NetWork_Ipx; 
extern	CDDMenu		Menu_NetWork_SetNet; 
extern	CDDMenu		Menu_NetWork_SetNet_SelectMap; 
extern	CDDMenu		Menu_NetWork_SetNet_SelectKing; 
extern	CDDMenu		Menu_NetWork_Modem; 
///////////////////////////// 
//	system menu structure 
extern	CDDMenu		Menu_System; 
extern	CDDMenu		Menu_System_Save; 
extern	CDDMenu		Menu_System_Load; 
extern	CDDMenu		Menu_System_Query; 
extern	CDDMenu		Menu_System_Query_General_1; 
extern	CDDMenu		Menu_System_Query_General_2; 
extern	CDDMenu		Menu_System_Query_Army; 
extern	CDDMenu		Menu_System_Query_Building; 
extern	CDDMenu		Menu_System_Query_Campaign_Mission; 
extern	CDDMenu		Menu_System_Option; 
extern	CDDMenu		Menu_System_Help; 
extern	CDDMenu		Menu_System_Help_Operate; 
extern	CDDMenu		Menu_System_Help_Icon; 
extern	CDDMenu		Menu_System_Help_Game; 
extern	CDDMenu		Menu_System_Exit; 
/////////////////////////// 
//	menu to select general 
extern	CDDMenu		Menu_Select_General; 
//	menu to show the information of the generals want to single battle 
extern	CDDMenu		Menu_Single ; 
extern	CDDMenu		Menu_Single_Reject ; 
extern	CDDMenu		Menu_Single_Result ; 
///////////////////////////////////// 
// menu to show some error and prompt information 
extern	CDDMenu		Menu_Link_Error ; 
///////////////////////////////////// 
// to store the six golbal list pointers for establish menu 
//////////////////////////////////// 
/*class	CDDList	* pEstablishList_1; 
class	CDDList	* pEstablishList_2; 
class	CDDList	* pEstablishList_3; 
class	CDDList	* pEstablishList_4; 
class	CDDList	* pEstablishList_5; 
class	CDDList	* pEstablishList_6; 
*/ 
////////////////////////////////////////////////////// 
//				mouse	function 
//////////////////////////////////////// 
// to test whether a button is clicked 
///////////////////////////////////////// 
BOOL	FACE_LeftButtonDown(int xPos, int yPos) 
{ 
	if( FACE_GetCommandState() == COMMAND_STATE_MENU &&  
		CurrentMenu == &Menu_Select_General ) 
	{ 
		if(  xPos<495 || xPos>623 || yPos<153 || yPos>458 ) 
		{	// 选择将领菜单之外 
			SendMessage( hwndGame, WM_COMMAND, BUTTON_SELECT_GENERAL_CANCEL, 0 ) ; 
		} 
	} 
 
	if( (FACE_GetCommandState() == COMMAND_STATE_MENU)|| 
		(FACE_GetCommandState() == COMMAND_STATE_DIALOG)  
	) 
	{ 
////////////////////////// 
		// I must to detect scroll-bar before button 
		// so keep the sequence of the following lines 
		if( LeftButtonDownOnScrollBar(xPos, yPos) ) 
			return TRUE; 
 
		if( LeftButtonDownOnButton(xPos, yPos) ) 
			return TRUE; 
///////////////////////// 
		if( LeftButtonDownOnComboBox(xPos, yPos) ) 
			return TRUE; 
 
		if( LeftButtonDownOnCheckBox(xPos, yPos) ) 
			return TRUE; 
 
		if( LeftButtonDownOnList( xPos, yPos) ) 
			return TRUE; 
 
 
		return FALSE; 
	} 
	else if( xPos<50 || xPos>450 || yPos< 100 ) 
		return LeftButtonDownOnButton(xPos, yPos); 
	else 
		return FALSE; 
} 
 
// to test whether cursor is on current button when left button up 
BOOL	FACE_LeftButtonUp(int xPos, int yPos) 
{ 
	if( (FACE_GetCommandState() == COMMAND_STATE_MENU)|| 
		(FACE_GetCommandState() == COMMAND_STATE_DIALOG)  
	) 
	{ 
		if( LeftButtonUpOnCheckBox(xPos, yPos) ) 
			return TRUE; 
		if( LeftButtonUpOnButton(xPos, yPos) ) 
			return TRUE; 
		return FALSE; 
	} 
	else if( xPos<50 || xPos>450 || yPos< 100 ) 
		// to test whether cursor is on current button when left button up 
		return LeftButtonUpOnButton(xPos, yPos); 
	else 
		return FALSE; 
} 
 
// to test whether cursor is moved on a button 
BOOL	FACE_MouseMove(WPARAM wParam, int xPos, int yPos) 
{ 
	static	BOOL	IsShowGeneralPrompt = FALSE ; 
 
	if( (FACE_GetCommandState() == COMMAND_STATE_MENU) || 
		(FACE_GetCommandState() == COMMAND_STATE_DIALOG)  
	) 
	{ 
		// to test whether cursor is moved on a check-box --- WM_ONMOUSEMOVE 
		if( MouseMoveOnList( xPos, yPos) ) 
			return TRUE; 
		if( MouseMoveOnButton(xPos, yPos) ) 
			return TRUE; 
		if( MouseMoveOnComboBox(xPos, yPos) ) 
			return TRUE; 
		if( MouseMoveOnCheckBox(wParam, xPos, yPos) ) 
			return TRUE; 
		return FALSE; 
	} 
	////////////////////////////////////////////// 
	// to add the following lines just for the Japanese 
	// July.24.1997 
	else if( (IsShowGeneralPrompt == TRUE)&& 
			 ( ( 504>xPos ) || ( xPos>565 ) || ( 161>yPos ) || ( yPos>249 ) ) 
		   ) 
	{ 
		// to update the bottom block of interfac 
		FACE_UpdateMessageRect() ; 
		// to set this flag to false 
		IsShowGeneralPrompt = FALSE ; 
 
		return TRUE ; 
	} 
	else if( ( FACE_GetCommandState() == COMMAND_STATE_PLAY )&& 
			 ( FACE_bMessageBox == FALSE ) && 
			 ( 504Erase(); 
		prompt_text.MyTextOut(DD_GetBackBuffer(), 200, 460, tl); 
		prompt_text.GetDDSurface()->Erase(); 
 
		char tl_1[256] ; 
		char wl_1[256] ; 
 
		memset( tl_1, 0, sizeof(tl_1) ) ; 
		memset( wl_1, 0, sizeof(wl_1) ) ; 
		_itoa( FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Unit.GeneralPower, wl_1, 10 ) ; 
		_itoa( FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Unit.GeneralBlood, tl_1, 10 ) ; 
 
		prompt_text.SetTextColor( RGB(255, 255, 250) ); 
		prompt_text.MyTextOut(DD_GetBackBuffer(), 100, 460, wl_1); 
		prompt_text.GetDDSurface()->Erase(); 
		prompt_text.MyTextOut(DD_GetBackBuffer(), 270, 460, tl_1); 
		prompt_text.GetDDSurface()->Erase(); 
		prompt_text.EndText(); 
 
		sBottom.Update(); 
 
		return TRUE ; 
	} 
	else if( xPos<50 || xPos>450 || yPos< 100 ) 
		return MouseMoveOnButton(xPos, yPos); 
	else  
		return FALSE; 
} 
// to test whether cursor is select a general for the team that you want to establish 
BOOL	FACE_LeftButtonDoubleClick(WPARAM wParam, int xPos, int yPos)  
{ 
	if( GAME.nCommandState != COMMAND_STATE_MENU ) 
	{ 
		if( xPos<50 || xPos>450 || yPos< 100 ) 
			return LeftButtonDownOnButton(xPos, yPos); 
		else  
			return FALSE ; 
	} 
	// to place this line here to resolve the problem of LEFT-BUTTON-DOUBLE-CLICK send one wm_lbutdown, one wm_lbutdblclk and two wm_lbutup 
	if( LeftButtonDownOnCheckBox(xPos, yPos) ) 
		return TRUE; 
 
	// I must to detect scroll-bar before button 
	// so keep the sequence of the following lines 
	if( LeftButtonDownOnScrollBar(xPos, yPos) ) 
		return TRUE; 
 
	if( LeftButtonDownOnButton(xPos, yPos) ) 
		return TRUE; 
 
	// TODO: Add your message handler code here and/or call default 
	if( CurrentMenu == &Menu_Select_General ) 
	{ 
		if( LeftButtonDownOnList( xPos, yPos) ) 
		{ 
			CurrentMenu = NULL; 
//			Menu_Select_General.Release(); 
 
			FACE_SetProgramState(PROGRAM_STATE_PLAY); 
			FACE_SetCommandState(COMMAND_STATE_PLAY); 
			FACE_RestoreAllButtonState(); 
			// to set the state of all buttons in this menu's button-unit 
			Menu_Select_General.m_MenuButtonUnit.SetMemberState( BUTTON_DISABLE ); 
 
			int	temp = pAllListUnit[0]->m_nSerialNum; 
			if( (temp != NONE)&&(pAllGeneral[ ToPageAllGeneral(GET_CURRENT)+temp ] != NULL ) ) 
				SendMessage(hwndGame, WM_COMMAND, ESTABLISH_UNIT, 
							pAllGeneral[ ToPageAllGeneral(GET_CURRENT)+temp ]->nID ); 
			else 
				SendMessage(hwndGame, WM_COMMAND, ESTABLISH_UNIT, 0 ); 
 
			pAllListUnit[0]->m_pList[0]->SetState(LIST_DISABLE) ; 
			pAllListUnit[0]->m_pList[1]->SetState(LIST_DISABLE) ; 
			pAllListUnit[0]->m_pList[2]->SetState(LIST_DISABLE) ; 
			pAllListUnit[0]->m_pList[3]->SetState(LIST_DISABLE) ; 
			pAllListUnit[0]->m_pList[4]->SetState(LIST_DISABLE) ; 
			pAllListUnit[0]->m_pList[5]->SetState(LIST_DISABLE) ; 
 
			pAllListUnit[0]->m_pList[0] = NULL ; 
			pAllListUnit[0]->m_pList[1] = NULL ; 
			pAllListUnit[0]->m_pList[2] = NULL ; 
			pAllListUnit[0]->m_pList[3] = NULL ; 
			pAllListUnit[0]->m_pList[4] = NULL ; 
			pAllListUnit[0]->m_pList[5] = NULL ; 
 
			FACE_DeleteAllList(); 
 
//			FACE_DeleteAllList(); 
			FACE_ShowRightBlock(); 
			MINI_Update(FALSE); 
			sRight.Update(); 
 
			return TRUE ; 
		} 
	} 
 
	if( LeftButtonDownOnList( xPos, yPos) ) 
		return TRUE; 
 
	return FALSE ; 
} 
 
void	FACE_RightButtonDown(WPARAM wParam, int xPos, int yPos)  
{ 
	// TODO: Add your message handler code here and/or call default 
	if( CurrentMenu == &Menu_Select_General ) 
	{ 
		CurrentMenu = NULL; 
 
		FACE_RestoreAllButtonState(); 
		// to set the state of all buttons in this menu's button-unit 
		Menu_Select_General.m_MenuButtonUnit.SetMemberState( BUTTON_DISABLE ); 
 
		FACE_SetProgramState(PROGRAM_STATE_PLAY); 
		FACE_SetCommandState(COMMAND_STATE_PLAY); 
 
		pAllListUnit[0]->m_pList[0]->SetState(LIST_DISABLE) ; 
		pAllListUnit[0]->m_pList[1]->SetState(LIST_DISABLE) ; 
		pAllListUnit[0]->m_pList[2]->SetState(LIST_DISABLE) ; 
		pAllListUnit[0]->m_pList[3]->SetState(LIST_DISABLE) ; 
		pAllListUnit[0]->m_pList[4]->SetState(LIST_DISABLE) ; 
		pAllListUnit[0]->m_pList[5]->SetState(LIST_DISABLE) ; 
 
		pAllListUnit[0]->m_pList[0] = NULL ; 
		pAllListUnit[0]->m_pList[1] = NULL ; 
		pAllListUnit[0]->m_pList[2] = NULL ; 
		pAllListUnit[0]->m_pList[3] = NULL ; 
		pAllListUnit[0]->m_pList[4] = NULL ; 
		pAllListUnit[0]->m_pList[5] = NULL ; 
 
		FACE_DeleteAllList(); 
 
		FACE_ShowRightBlock(); 
		MINI_Update(FALSE); 
		sRight.Update(); 
 
		SendMessage(hwndGame, WM_COMMAND, ESTABLISH_UNIT, 0 ); 
	} 
} 
 
//////////////////////////////////////////////////////////////////// 
//	to manage the input string  
BOOL FACE_IsInputString( HWND hwnd, UINT message,  
	    			WPARAM wParam, LPARAM lParam) 
{ 
	if( FACE_GetProgramState() == PROGRAM_STATE_PAUSE ) 
		return FALSE ; 
 
	if( ( FACE_GetCommandState() != COMMAND_STATE_DIALOG )&& 
		( FACE_bMessageBox != TRUE )&& 
	    ( CurrentMenu != &Menu_NetWork_SetNet ) 
	) 
		return FALSE; 
 
	if( ( FACE_GetProgramState() == PROGRAM_STATE_MENU )&& 
		( CurrentMenu == &Menu_NetWork_InputName ) 
	) 
	{ 
		switch(wParam) 
		{ 
			case 0x08:	// Backspace 
			// move the caret back one space, and then process this like the DEL key 
				if( DIALOG_LETTER_X > 0 ) 
				{ 
					DIALOG_BUF[DIALOG_LETTER_X - 1] = DIALOG_BUF[DIALOG_LETTER_X]; 
					DIALOG_BUF[DIALOG_LETTER_X] = '\0'; 
					DIALOG_LETTER_X--; 
				// draw the character on the screen 
					FACE_Echo_prompt(hwnd); 
				} 
				break; 
			case 0x1B:	// Escape 
			// to send message like button-cancle 
				PostMessage( hwndGame, WM_COMMAND, BUTTON_MENU_MAIN_NETWORK_INPUTNAME_CANCEL, 0 ); 
				break;		 
			case 0x13:	// Return 
				// to send message like button-ok 
				PostMessage( hwndGame, WM_COMMAND, BUTTON_MENU_MAIN_NETWORK_INPUTNAME_OK, 0 ); 
				break;		 
			default:	// all other characters 
				{ 
				// add the character to the text buffer. 
					if( DIALOG_LETTER_X +1 == MAX_DIALOG_LETTER ) 
					{ 
	           			::MessageBeep (0) ; 
						break; 
					} 
					if( wParam == 13 )		// Enter or Return 
						return FALSE; 
					DIALOG_BUF[DIALOG_LETTER_X + 1]	= DIALOG_BUF[DIALOG_LETTER_X]; 
					DIALOG_BUF[DIALOG_LETTER_X] = (char) wParam; 
					DIALOG_LETTER_X++; 
				// draw the character on the screen 
					FACE_Echo_prompt(hwnd); 
				} 
				break; 
			} 
	} 
	else if( FACE_bMessageBox == TRUE ) 
	{ 
		switch(wParam) 
		{ 
			case 0x08:	// Backspace 
			// move the caret back one space, and then process this like the DEL key 
				if( MESSAGE_LETTER_X > 0 ) 
				{ 
					MESSAGE_BUF[MESSAGE_LETTER_X - 1] = MESSAGE_BUF[MESSAGE_LETTER_X]; 
					MESSAGE_BUF[MESSAGE_LETTER_X] = '\0'; 
					MESSAGE_LETTER_X--; 
				// draw the character on the screen 
					FACE_Echo_prompt(hwnd); 
				} 
				break; 
			default:	// all other characters 
				{ 
				// add the character to the text buffer. 
					if( MESSAGE_LETTER_X +1 == MAX_MESSAGE_LETTER ) 
					{ 
	           			::MessageBeep (0) ; 
						break; 
					} 
					if( wParam == 13 )		// Enter or Return 
						return FALSE; 
					MESSAGE_BUF[MESSAGE_LETTER_X + 1]	= MESSAGE_BUF[MESSAGE_LETTER_X]; 
					MESSAGE_BUF[MESSAGE_LETTER_X] = (char) wParam; 
					MESSAGE_LETTER_X++; 
				// draw the character on the screen 
					FACE_Echo_prompt(hwnd); 
				} 
				break; 
			} 
	} 
	else if( ( FACE_GetProgramState() == PROGRAM_STATE_MENU )&& 
 			 ( CurrentMenu == &Menu_NetWork_SetNet ) 
		) 
	{ 
		switch(wParam) 
		{ 
			case 0x08:	// Backspace 
			// move the caret back one space, and then process this like the DEL key 
				if( NETWORK_MESSAGE_LETTER_X > 0 ) 
				{ 
					NETWORK_MESSAGE_BUF[NETWORK_MESSAGE_LETTER_X - 1] = NETWORK_MESSAGE_BUF[NETWORK_MESSAGE_LETTER_X]; 
					NETWORK_MESSAGE_BUF[NETWORK_MESSAGE_LETTER_X] = '\0'; 
					NETWORK_MESSAGE_LETTER_X--; 
				// draw the character on the screen 
					FACE_Echo_prompt(hwnd); 
				} 
				break; 
			default:	// all other characters 
				{ 
				// add the character to the text buffer. 
					if( NETWORK_MESSAGE_LETTER_X +1 == NETWORK_MAX_MESSAGE_LETTER ) 
					{ 
	           			::MessageBeep (0) ; 
						break; 
					} 
					if( wParam == 13 )		// Enter or Return 
						return FALSE; 
					NETWORK_MESSAGE_BUF[NETWORK_MESSAGE_LETTER_X + 1]	= NETWORK_MESSAGE_BUF[NETWORK_MESSAGE_LETTER_X]; 
					NETWORK_MESSAGE_BUF[NETWORK_MESSAGE_LETTER_X] = (char) wParam; 
					NETWORK_MESSAGE_LETTER_X++; 
				// draw the character on the screen 
					FACE_Echo_prompt(hwnd); 
				} 
				break; 
			} 
	} 
 
	return TRUE; 
} 
// to get the current input string from out of this file					 
LPCTSTR	FACE_GetCurrentString() 
{ 
	return	MESSAGE_BUF; 
} 
////////////////////////////////////////////////////////////////////////////////////////// 
//     						prompt functions											// 
//																						// 
//		LPCTSTR	GetCurrentString()														// 
//		void Prompt( HWND hwnd, LPCTSTR message, int posX = 30, int posY = 460 )			// 
//		void echo_prompt( HWND hwnd, LPCTSTR message, int posX = 30, int posY = 460 )	// 
////////////////////////////////////////////////////////////////////////////////////////// 
//extern LPDIRECTDRAWSURFACE lpDDSFront; 
//////////////////////////////////////// 
// to show message box 
//////////////////////////////////////// 
void	FACE_SetMessage(void) 
{ 
	if( FACE_bMessageBox == FALSE ) 
		return; 
 
	memset( MESSAGE_PROMPT, 0, sizeof(MESSAGE_PROMPT) ) ; 
	memset( MESSAGE_STRING, 0, sizeof(MESSAGE_STRING) ) ; 
	memset( MESSAGE_BUF, 0, sizeof(MESSAGE_BUF) ) ; 
	MESSAGE_BUF[0] = '_'; 
	MESSAGE_LETTER_X = 0; 
 
	// to read the help text from the information file 
	CText_apply Text;			// the instance to open a pressed file for read the mission text 
 
	memset (MESSAGE_PROMPT, 0, sizeof(MESSAGE_PROMPT)) ; 
	Text.Text_open ("set\\hz.ext") ; 
	Text.Text_use (MESSAGE_PROMPT, 39) ; 
	Text.Text_close (); 
 
	return; 
} 
// to set the message for the set network menu 
void	FACE_NetWorkSetMessage(void) 
{ 
	if( CurrentMenu != &Menu_NetWork_SetNet ) 
		return; 
 
	memset( MESSAGE_PROMPT, 0, sizeof(MESSAGE_PROMPT) ); 
	memset( NETWORK_MESSAGE_STRING, 0, sizeof(NETWORK_MESSAGE_STRING) ); 
	memset( NETWORK_MESSAGE_BUF, 0, sizeof(NETWORK_MESSAGE_BUF) ); 
	NETWORK_MESSAGE_BUF[0] = '_'; 
	NETWORK_MESSAGE_LETTER_X = 0; 
 
	// to read the help text from the information file 
	CText_apply Text;			// the instance to open a pressed file for read the mission text 
 
	memset (MESSAGE_PROMPT, 0, sizeof(MESSAGE_PROMPT)) ; 
	Text.Text_open ("set\\hz.ext") ; 
	Text.Text_use (MESSAGE_PROMPT, 39) ; 
	Text.Text_close (); 
 
	return; 
} 
//////////////////////////////////////////////////////////// 
//	to show the prompt string at the bottom of the interfac 
//	this function will be used by Liu Gang and Li Haijun 
void FACE_Prompt( HWND hwnd, LPCTSTR message, int posX /*= 30*/, int posY /*= 460*/ ) 
{ 
	RECT	MessageRect; 
	class	CDDText MESSAGE_TEXT;		// the string attribute of MESSAGE_STRING 
	char	message_temp1[8];		// to place the '(' character temperary 
	char	message_temp2[4];		// to place the 'A' capital character of a command 
	char	message_temp3[256];		// to place the ').............'  string 
	char	message_money[256];		// to place the word "钱" 
	char	message_moneyNum[256];	// to place the number of money 
	char	message_food[256];		// to place the word "粮" 
	char	message_foodNum[256] ;	// to place the number of food 
	char	message_wood[256];		// to place the word "木" 
	char	message_woodNum[256] ;	// to place the number of wood 
	char	message_iron[256];		// to place the word "铁" 
	char	message_ironNum[256] ;	// to place the number of iron 
 
	char	message_jm[256] ;		// to place the word "需计谋" 
	char	message_jmNum[256] ;	// to place the number of 计谋 
 
	int		ZyFlag = 0 ;			// to record how many '@' appear in message_temp3 to flag the  资源 
	int		JmFlag = 0 ;			// to record how many '&' appear in message_temp3 to flag the  计谋 
 
	// to go out this function if the bottom block is showing the message box now 
	if( FACE_bMessageBox == TRUE ) 
		return ; 
 
	// to get a surface for you string 
	MESSAGE_TEXT.BeginText( 76 );	// ( 640 - 30 ) / 16 
 
if( FACE_GetProgramState() != PROGRAM_STATE_MENU ) 
{ 
	memset(message_temp1, 0,sizeof(message_temp1)) ; 
	memset(message_temp2, 0,sizeof(message_temp2)) ; 
	memset(message_temp3, 0,sizeof(message_temp3)) ; 
 
	MessageRect.left = posX; 
	MessageRect.top = posY; 
	MessageRect.right = 640; 
	MessageRect.bottom = 480; 
	// TO UPDATE THE MESSAGE BACKGROUND 
	sBottom.Blit(); 
 
	// to judge whether this message is a command prompt 
	if( message[0] == '(' ) 
	{ 
		message_temp1[0] = '('; 
		message_temp1[1] = '\0'; 
		message_temp2[0] = message[1]; 
		message_temp2[1] = '\0'; 
		memmove( message_temp3, message+2, strlen(message)-1 ); 
 
		int	len = strlen(message_temp3) ; 
 
		memset(message_moneyNum, 0,sizeof(message_moneyNum)) ; 
		memset(message_foodNum, 0,sizeof(message_foodNum)) ; 
		memset(message_woodNum, 0,sizeof(message_woodNum)) ; 
		memset(message_ironNum, 0,sizeof(message_ironNum)) ; 
 
		memset(message_jmNum, 0,sizeof(message_jmNum)) ; 
 
		for( int i=0; iBlit(&ptDest, &dSource); 
	 
		Net_EchoPrompt_Message.SetString( message ) ; 
		Net_EchoPrompt_Message.Blit() ; 
/* 
		// to get a surface for you string 
		MESSAGE_TEXT.BeginText( 76 );	// ( 640 - 30 ) / 16 
		MESSAGE_TEXT.SetTextColor( RGB(255, 255, 255) ); 
		MESSAGE_TEXT.MyTextOut( DD_GetBackBuffer(), ptDest.x+2, ptDest.y+8, message ); 
		// to release the character surface 
		MESSAGE_TEXT.EndText( ); 
*/		 
		DDC_UpdateScreen( &dSource ); 
	} 
	else 
	{ 
		MessageRect.left = posX; 
		MessageRect.top = posY; 
		MessageRect.right = 640; 
		MessageRect.bottom = 480; 
		// TO UPDATE THE MESSAGE BACKGROUND 
		sBottom.Blit(); 
 
		// to get a surface for you string 
		MESSAGE_TEXT.BeginText( 76 );	// ( 640 - 30 ) / 16 
		MESSAGE_TEXT.SetTextColor( RGB(255, 255, 255) ); 
		MESSAGE_TEXT.MyTextOut( DD_GetBackBuffer(), MessageRect.left, MessageRect.top, message ); 
		// to release the character surface 
		MESSAGE_TEXT.EndText( ); 
		 
		sBottom.Update(); 
	} 
 
	return; 
}                               
//////////////////////////////////////////////////////////////////////////// 
//	this function is to show you input letter from keybroad real time 
//	as a echo of you input , so named echo_prompt 
void FACE_Echo_prompt( HWND hwnd, int posX /*=30*/, int posY /*= 460*/ ) 
{ 
	if( ( FACE_GetProgramState() == PROGRAM_STATE_MENU )&& 
		( CurrentMenu == &Menu_NetWork_InputName ) 
	) 
	{ 
		FACE_Prompt( hwnd, DIALOG_BUF, 215, 339 ) ; 
	} 
	else if( ( FACE_GetProgramState() == PROGRAM_STATE_MENU )&& 
		( CurrentMenu == &Menu_NetWork_SetNet ) 
	) 
	{ 
		// to init the MESSAGE_PROMPT AND MESSAGE_STRING AND MESSAGE_BUF string 
		strcpy(NETWORK_MESSAGE_STRING, MESSAGE_PROMPT) ; 
		strcat(NETWORK_MESSAGE_STRING, NETWORK_MESSAGE_BUF) ; 
		FACE_ShowMessage( hwnd, NETWORK_MESSAGE_STRING, posX, posY ) ; 
	} 
	else if( FACE_bMessageBox == TRUE ) 
	{ 
		// to init the MESSAGE_PROMPT AND MESSAGE_STRING AND MESSAGE_BUF string 
		strcpy(MESSAGE_STRING, MESSAGE_PROMPT) ; 
		strcat(MESSAGE_STRING, MESSAGE_BUF) ; 
		FACE_ShowMessage( hwnd, MESSAGE_STRING, posX, posY ) ; 
	} 
 
	return; 
}  
 
////////////////////////////////////////////////////////////////////// 
//	This function is be used by  FACE_Prompt() ,  
// to clear the message rectangle after echo-show the message string 
void FACE_UpdateMessageRect() 
{ 
	if( FACE_bMessageBox == FALSE ) 
		sBottom.Show(); 
} 
 
 
//////////////////////////////////////////////////////////////////////// 
// 
// 
//		The following functions are used to send message and show them  
// 
//			at the rectly rectangle areas 
// 
//////////////////////////////////////////////////////////////////////// 
 
///////////////////////////////////////////////////////////////// 
//	to send the message to the others and show it at my own  
//		network message rectangle display area 
void	FACE_NetworkSendMessage() 
{ 
	if( (NETWORK_MESSAGE_BUF[0] == '_')&& 
		( strlen(NETWORK_MESSAGE_BUF) == 1 ) 
	) 
		return ; 
 
	char	temp[NETWORK_MAX_MESSAGE_LETTER+1] ; 
	strcpy( temp, NETWORK_MESSAGE_BUF ) ; 
	int ret = strlen( temp ) ; 
	temp[ ret-1 ] = '\0' ; 
 
	// to send the message to other players 
	memset(DP_SendMessageBuff,0,BUFFER_MAX_BYTE); 
	wsprintf((char *)DP_SendMessageBuff,"%d %s %s",DP_TALK,DP_NickName,temp); 
	if(DP_NetworkInterface(DP_SEND_MESSAGE,NULL)!=OK) 
		{ 
			//////////////////////////////////////////////////////////////// 
			//无法正常发送时,出错处理。 
			#ifdef	NETWORK 
			MessageBox(NULL,"Send Counter message error!!!","Error",MB_OK); 
			#endif 
		} 
	// to show this message in your message display rectangle 
	FACE_SetNetworkMessage( DP_NickName, temp ) ; 
	// to erase the message that has been sended 
	FACE_UpdateNetWorkMessageRect() ; 
} 
 
///////////////////////////////////////////////////////////////// 
// to update the send message rectangle of the set network menu 
void FACE_UpdateNetWorkMessageRect(void) 
{ 
	if( CurrentMenu != &Menu_NetWork_SetNet ) 
		return ; 
	// to init the NETWORK_MESSAGE_BUF and the NETWORK_MESSAGE_STRING and the other string 
	FACE_NetWorkSetMessage() ; 
	FACE_ShowMessage( NULL, MESSAGE_PROMPT ) ; 
} 
// to update the display message rectangle of the set network menu 
void FACE_UpdateNetworkComMessageRect(void) 
{ 
 
	class	CDDText MESSAGE_TEXT;		// the string attribute of MESSAGE_STRING 
 
	if( ( FACE_GetProgramState() != PROGRAM_STATE_MENU )|| 
		( CurrentMenu != &Menu_NetWork_SetNet) ) 
		return ; 
 
	// TO UPDATE THE MESSAGE BACKGROUND 
	POINT	ptDest ; 
	RECT	dSource ; 
 
	ptDest.x = Net_Message_1.GetPosX()-4 ;	//72 ; 
	ptDest.y = Net_Message_1.GetPosY()-4 ;	//191 ; 
 
	dSource.left = ptDest.x ;	//72 ; 
	dSource.top = ptDest.y ;	//191 ; 
	dSource.right = ptDest.x+263 ;	//335 ; 
	dSource.bottom = ptDest.y+87 ;	//278 ; 
 
	pAllBitmap[0]->Blit(&ptDest, &dSource); 
 
	Net_Message_1.Blit() ; 
	Net_Message_2.Blit() ; 
	Net_Message_3.Blit() ; 
	Net_Message_4.Blit() ; 
 
	DDC_UpdateScreen( &dSource ); 
} 
/////////////////////////////////////////////////////////////////////// 
//	to init the four string that store the network message 
void	FACE_InitNetworkMessage(void) 
{ 
	Net_Message_1.m_bIsUse = FALSE ; 
	Net_Message_2.m_bIsUse = FALSE ; 
	Net_Message_3.m_bIsUse = FALSE ; 
	Net_Message_4.m_bIsUse = FALSE ; 
} 
/////////////////////////////////////////////////////////////////////// 
//	to set the network message and show it 
void	FACE_SetNetworkMessage(	LPCTSTR name, LPCTSTR message ) 
{ 
//	if( ( FACE_GetProgramState() != PROGRAM_STATE_MENU )|| 
//		( CurrentMenu != &Menu_NetWork_SetNet) ) 
	if( FACE_GetProgramState() != PROGRAM_STATE_MENU ) 
		return ; 
 
	char	temp[NETWORK_MAX_MESSAGE_LETTER+1+2+MAX_NAME_LETTER] ; 
	 
	strcpy( temp, name ) ; 
	strcat( temp, ": " ) ; 
	strcat( temp, message ) ; 
 
	if( Net_Message_1.m_bIsUse == FALSE ) 
	{ 
		Net_Message_1.SetString( temp ) ; 
		Net_Message_1.m_bIsUse = TRUE ; 
	} 
	else if( Net_Message_2.m_bIsUse == FALSE ) 
	{ 
		Net_Message_2.SetString( temp ) ; 
		Net_Message_2.m_bIsUse = TRUE ; 
	} 
	else if( Net_Message_3.m_bIsUse == FALSE ) 
	{ 
		Net_Message_3.SetString( temp ) ; 
		Net_Message_3.m_bIsUse = TRUE ; 
	} 
	else if( Net_Message_4.m_bIsUse == FALSE ) 
	{ 
		Net_Message_4.SetString( temp ) ; 
		Net_Message_4.m_bIsUse = TRUE ; 
	} 
	else 
	{ 
		char	string[ NETWORK_MAX_MESSAGE_LETTER+1+2+MAX_NAME_LETTER ] ; 
 
		Net_Message_2.GetString( string ) ; 
		Net_Message_1.SetString( string ) ; 
 
		Net_Message_3.GetString( string ) ; 
		Net_Message_2.SetString( string ) ; 
 
		Net_Message_4.GetString( string ) ; 
		Net_Message_3.SetString( string ) ; 
 
		Net_Message_4.SetString( temp ) ; 
	} 
	// to show the net work message that communicate from others and me 
	FACE_UpdateNetworkComMessageRect() ; 
} 
 
 
/////////////////////////////////////////////////////////////////////// 
//	This function is be used by Liu Gang  
//	to show the prompt text of the game_AI 
//	for example : to show " We are under Attack ! " 
void	FACE_ShowPromptInfor( int InforId ) 
{ 
	int			iResult ; 
	class		CDDText	mission_text;	// the text surface to blit to the back buffer 
	CText_apply Text;			// the instance to open a pressed file for read the mission text 
	char		mission[80] ;	// the string to store the input mission text	 
	int			theMissionLine ;	// the line serial number of this mission in the mission.set 
 
	// to go out if the bottom block is showing the message box 
	if( FACE_bMessageBox == TRUE) 
		return ; 
 
	iResult = mission_text.BeginText( 80 ); 
//	if( ! iResult ) 
//		return FALSE; 
 
	theMissionLine = InforId + 1 ;	// 1 --> the first line of prompt information is at 1st line in mission.set 
									// and the Text_use function is base on zero	 
	memset (mission, 0, sizeof(mission)) ; 
	Text.Text_open ("set\\mission.ext") ; 
	Text.Text_use (mission, theMissionLine) ; 
	Text.Text_close (); 
 
	FACE_Prompt( hwndGame, mission ) ; 
} 
////////////////////////////////////////////////////////// 
// to initialation all CDDString instances and all strings 
void FACE_InitAllStrings()  
{ 
	Net_Message_1.ToEmpty() ; 
	Net_Message_2.ToEmpty() ; 
	Net_Message_3.ToEmpty() ; 
	Net_Message_4.ToEmpty() ; 
 
	for( int i=0; iToEmpty() ; 
 
	Net_EchoPrompt_Message.ToEmpty() ; 
 
	memset( NETWORK_MESSAGE_BUF, 0, sizeof(NETWORK_MESSAGE_BUF) ) ; 
	memset( NETWORK_MESSAGE_PROMPT, 0, sizeof(NETWORK_MESSAGE_BUF) ) ; 
	memset( NETWORK_MESSAGE_STRING, 0, sizeof(NETWORK_MESSAGE_STRING) ) ; 
 
	memset( DIALOG_BUF, 0, sizeof(DIALOG_BUF) ) ; 
 
	memset( MESSAGE_BUF, 0, sizeof(MESSAGE_BUF) ) ; 
	memset( MESSAGE_PROMPT, 0, sizeof(MESSAGE_PROMPT) ) ; 
	memset( MESSAGE_STRING, 0, sizeof(MESSAGE_STRING) ) ; 
}