www.pudn.com > chibi > CBPROMPT.CPP
///////////// // 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#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, "三 级"); 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: return &ml_Chao_Build_Main; break; case BUTTON_CHAO_MAIN_UPGRADE1: return &ml_Chao_Main_Upgrade1 ; break; case BUTTON_CHAO_MAIN_UPGRADE2: return &ml_Chao_Main_Upgrade2; break; case BUTTON_CHAO_MAIN_UPGRADE3: return &ml_Chao_Main_Upgrade3 ; break; // 刘备主帅帐命令集的消息 case BUTTON_LIU_BUILD_MAIN: return &ml_Liu_Build_Main; break; case BUTTON_LIU_MAIN_UPGRADE1: return &ml_Liu_Main_Upgrade1 ; break; case BUTTON_LIU_MAIN_UPGRADE2: return &ml_Liu_Main_Upgrade2 ; break; case BUTTON_LIU_MAIN_UPGRADE3: return &ml_Liu_Main_Upgrade3 ; break; case 0 : { if( grade == 0 ) return &ml_Chao_Build_Main ; else if( grade == 1 ) return &ml_Chao_Main_Upgrade1 ; else if( grade == 2 ) return &ml_Chao_Main_Upgrade2 ; else if( grade == 3 ) return &ml_Chao_Main_Upgrade3 ; } break; case 1 : { if( grade == 0 ) return &ml_Liu_Build_Main ; else if( grade == 1 ) return &ml_Liu_Main_Upgrade1 ; else if( grade == 2 ) return &ml_Liu_Main_Upgrade2 ; else if( grade == 3 ) return &ml_Liu_Main_Upgrade3 ; } break; // 木材厂命令集的消息 case BUTTON_CHAO_BUILD_LUMBER: case 4: return &ml_Chao_Build_Lumber; break; case BUTTON_LIU_BUILD_LUMBER: case 5: return &ml_Liu_Build_Lumber; break; case BUTTON_LUMBER_UPGRADEBOW1: return &ml_Lumber_UpgradeBow1 ; break; case BUTTON_LUMBER_UPGRADEBOW2: return &ml_Lumber_UpgradeBow2 ; break; case BUTTON_LUMBER_UPGRADEBOW3: return &ml_Lumber_UpgradeBow3 ; break; // 武器厂命令集的消息 case BUTTON_CHAO_BUILD_WEAPONFACTORY: case 2: return &ml_Chao_Build_WeaponFactory; break; case BUTTON_LIU_BUILD_WEAPONFACTORY: case 3: return &ml_Liu_Build_WeaponFactory; break; case BUTTON_WEAPONFACTORY_UPGRADEWEAPON1: return &ml_WeaponFactory_UpgradeWeapon1 ; break; case BUTTON_WEAPONFACTORY_UPGRADEWEAPON2: return &ml_WeaponFactory_UpgradeWeapon2 ; break; case BUTTON_WEAPONFACTORY_UPGRADEWEAPON3: return &ml_WeaponFactory_UpgradeWeapon3 ; break; case BUTTON_WEAPONFACTORY_UPGRADEARMOR1: return &ml_WeaponFactory_UpgradeArmor1 ; break; case BUTTON_WEAPONFACTORY_UPGRADEARMOR2: return &ml_WeaponFactory_UpgradeArmor2 ; break; case BUTTON_WEAPONFACTORY_UPGRADEARMOR3: return &ml_WeaponFactory_UpgradeArmor3 ; break; // 步兵所命令集的消息 case BUTTON_CHAO_BUILD_FOOTMANSCHOOL: case 12: return &ml_Chao_Build_FootmanSchool ; break; case BUTTON_LIU_BUILD_FOOTMANSCHOOL: case 13: return &ml_Liu_Build_FootmanSchool ; break; case 32: case BUTTON_FOOTMANSCHOOL_100: return &ml_FootmanSchool_100 ; break; case 38: case BUTTON_FOOTMANSCHOOL_200: return &ml_FootmanSchool_200 ; break; case BUTTON_FOOTMANSCHOOL_500: case 41: return &ml_FootmanSchool_500 ; break; case BUTTON_FOOTMANSCHOOL_1000: case 43: return &ml_FootmanSchool_1000 ; break; // 骑兵所命令集的消息 case BUTTON_CHAO_BUILD_KNIGHTSCHOOL: case 6: return &ml_Chao_Build_KnightSchool; break; case BUTTON_LIU_BUILD_KNIGHTSCHOOL: case 7: return &ml_Liu_Build_KnightSchool; break; case BUTTON_KNIGHTSCHOOL_100: case 36: return &ml_KnightSchool_100 ; break; case BUTTON_KNIGHTSCHOOL_200: case 37: return &ml_KnightSchool_200 ; break; case BUTTON_KNIGHTSCHOOL_500: case 40: return &ml_KnightSchool_500 ; break; // 弓兵所命令集的消息 case BUTTON_CHAO_BUILD_BOWMANSCHOOL: case 14: return &ml_Chao_Build_BowmanSchool ; break; case BUTTON_LIU_BUILD_BOWMANSCHOOL: case 15: return &ml_Liu_Build_BowmanSchool ; break; case BUTTON_BOWMANSCHOOL_100: case 45: return &ml_BowmanSchool_100 ; break; case BUTTON_BOWMANSCHOOL_200: case 39: return &ml_BowmanSchool_200 ; break; case BUTTON_BOWMANSCHOOL_500: case 42: return &ml_BowmanSchool_500 ; break; case BUTTON_BOWMANSCHOOL_1000: case 44: return &ml_BowmanSchool_1000 ; break; // 车兵所命令集的消息 case BUTTON_CHAO_BUILD_VEHICLEMANSCHOOL: case 8: return &ml_Chao_Build_VehiclemanSchool ; break; case BUTTON_LIU_BUILD_VEHICLEMANSCHOOL: case 9: return &ml_Liu_Build_VehiclemanSchool ; break; case BUTTON_VEHICLEMANSCHOOL_VEHICLEMAN : case 34: return &ml_VehiclemanSchool_Vehicleman ; break; case BUTTON_VEHICLEMANSCHOOL_UPGRADE1: return &ml_VehiclemanSchool_Upgrade1 ; break; case BUTTON_VEHICLEMANSCHOOL_UPGRADE2: return &ml_VehiclemanSchool_Upgrade2 ; break; // 造船厂命令集的消息 case BUTTON_CHAO_BUILD_SHIPYARD: // case BUTTON_LIU_BUILD_SHIPYARD: case 20: return &ml_Chao_Build_Shipyard ; break; case BUTTON_SHIPYARD_DESTROYER: case 46: return &ml_Shipyard_Destroyer ; break; case BUTTON_SHIPYARD_TRANSPORT: case 47: return &ml_Shipyard_Transport ; break; case BUTTON_SHIPYARD_BATTLESHIP : case 48: return &ml_Shipyard_Battleship ; break; case BUTTON_SHIPYARD_GROUPSHIP: case 49: return &ml_Shipyard_GroupShip ; break; case BUTTON_SHIPYARD_UPGRADEDESTROYER: return &ml_Shipyard_UpgradeDestroyer ; break; case BUTTON_SHIPYARD_UPGRADEBATTLESHIP: return &ml_Shipyard_UpgradeBattleship ; break; case BUTTON_SHIPYARD_UPGRADESHIPARMOR: return &ml_Shipyard_UpgradeShipArmor ; break; // 钱庄命令集的消息 case BUTTON_SHOP_SALE100WOOD: return &ml_Shop_Sale100Wood; break; case BUTTON_SHOP_SALE100FOOD: return &ml_Shop_Sale100Food; break; case BUTTON_SHOP_SALE100IRON: return &ml_Shop_Sale100Iron; break; case BUTTON_SHOP_SALE1000WOOD: return &ml_Shop_Sale1000Wood; break; case BUTTON_SHOP_SALE1000FOOD: return &ml_Shop_Sale1000Food; break; case BUTTON_SHOP_SALE1000IRON: return &ml_Shop_Sale1000Iron; break; // 君主为曹操的工人的建造命令集的消息 case BUTTON_CHAO_BUILD_FARM: case 10: return &ml_Chao_Build_Farm; break; case BUTTON_CHAO_BUILD_DOOR: case 16: return &ml_Chao_Build_Door; break; case BUTTON_CHAO_BUILD_TOWER: case 18: return &ml_Chao_Build_Tower; break; case BUTTON_CHAO_BUILD_SHOP: // case BUTTON_LIU_BUILD_SHOP: case 23: // return &ml_Liu_Build_Shop; return &ml_Chao_Build_Shop; break; case BUTTON_CHAO_BUILD_FLAG: // case BUTTON_LIU_BUILD_FLAG: case 26: // return &ml_Liu_Build_Flag; return &ml_Chao_Build_Flag; break; case 24: return &prompt_Chao_House; break; // 君主为刘备的工人的建造命令集的消息 case BUTTON_LIU_BUILD_FARM: case 11: return &ml_Liu_Build_Farm; break; case BUTTON_LIU_BUILD_DOOR: case 17: return &ml_Liu_Build_Door; break; case BUTTON_LIU_BUILD_TOWER: case 19: return &ml_Liu_Build_Tower; break; case 25: return &prompt_Liu_House; break; // some special resourcd case 22: return &prompt_Iron_Mine; break; case 27: return &prompt_Citizen_Male; break; case 28: return &prompt_Citizen_Female; break; } return &ml_Main_Peasant ; } void GetLineUp( int LineUpFlag ) { if(LineUpFlag<1 || LineUpFlag>10) LineUpKind[0] = '\0'; else { // to read the all string first CText_apply Text; Text.Text_open ("set\\hz.ext"); Text.Text_use (LineUpKind,19+LineUpFlag); Text.Text_close (); } } //////////////////////////////////// // to updata the resource amount BOOL FACE_UpdateGrade(int new_grade) { int iResult; class CDDText infor_text; // the text that inpur from FACE_CURRENT_PROMPT_BLOCK char Grade[8]; // 级别 if( FACE_CURRENT_PROMPT_BLOCK.PromptBlockId != PROMPT_CONSTRUCTION_IDLESS ) return FALSE; // to blit part of the prompt background to the back buffer POINT Dest ; RECT temp ; Dest.x = 552 ; Dest.y = 194 ; temp.left = 552 ; temp.top = 194 ; temp.right = 620 ; temp.bottom = 210 ; bmPromptArea.Blit(&Dest, &temp); // to blit the word of grade to the prompt area FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Construction_Idless.ConstructionGrade = new_grade ; // if the ConstructionBitmapId == 22 (铁矿) , don't show it grade, ironmine have no grade int gradetemp = FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Construction_Idless.ConstructionGrade ; if( gradetemp >= 0 && gradetemp < 5 ) { CText_apply Text; Text.Text_open ("set\\hz.ext"); Text.Text_use (Grade, gradetemp+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 ); } // 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(); // 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 updata the value of experence BOOL FACE_UpdateExperience(int experience) { int iResult; class CDDText prompt_text; // the prompt string class CDDText infor_text; // the text that inpur from FACE_CURRENT_PROMPT_BLOCK char Experience[8]; // 经验值 if( FACE_CURRENT_PROMPT_BLOCK.PromptBlockId != PROMPT_UNIT ) return FALSE; // to blit part of the prompt background to the back buffer POINT Dest ; RECT temp ; Dest.x = 501 ; Dest.y = 253 ; temp.left = 501 ; temp.top = 253 ; temp.right = 620 ; temp.bottom = 269 ; bmPromptArea.Blit(&Dest, &temp); FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Unit.Experience = experience; // 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 jy[50] ; //"经 验" memset (jy,0,sizeof(jy)); Text.Text_open ("set\\hz.ext"); Text.Text_use (jy,9); Text.Text_close (); // to blit the attribute prompt word to the prompt area prompt_text.MyTextOut(DD_GetBackBuffer(), 512, 253, jy); 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.Unit.Experience, Experience, 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(), 580, 253, Experience ); 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 updata the value of ruse BOOL FACE_UpdateRuse(int ruse) { int iResult; class CDDText prompt_text; // the prompt string class CDDText infor_text; // the text that inpur from FACE_CURRENT_PROMPT_BLOCK char Ruse[8]; if( FACE_CURRENT_PROMPT_BLOCK.PromptBlockId != PROMPT_UNIT ) return FALSE; // to blit part of the prompt background to the back buffer POINT Dest ; RECT temp ; Dest.x = 501 ; Dest.y = 272 ; temp.left = 501 ; temp.top = 272 ; temp.right = 620 ; temp.bottom = 288 ; bmPromptArea.Blit(&Dest, &temp); FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Unit.Ruse = ruse; // 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 ml[50] ; //"谋 略" memset (ml,0,sizeof(ml)); Text.Text_open ("set\\hz.ext"); Text.Text_use (ml,10); Text.Text_close (); // to blit the attribute prompt word to the prompt area prompt_text.MyTextOut(DD_GetBackBuffer(), 512, 272, ml); 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.Unit.Ruse, Ruse, 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(), 580, 272, Ruse ); 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 updata the value of ruse BOOL FACE_UpdateMorale(int morale) { int iResult; class CDDText prompt_text; // the prompt string class CDDText infor_text; // the text that inpur from FACE_CURRENT_PROMPT_BLOCK char Morale[8]; if( FACE_CURRENT_PROMPT_BLOCK.PromptBlockId != PROMPT_UNIT ) return FALSE; // to blit part of the prompt background to the back buffer POINT Dest ; RECT temp ; Dest.x = 501 ; Dest.y = 291 ; temp.left = 501 ; temp.top = 291 ; temp.right = 620 ; temp.bottom = 307 ; bmPromptArea.Blit(&Dest, &temp); FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Unit.UnitMorale = morale; // 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 sq[50] ; //"士 气" memset (sq,0,sizeof(sq)); Text.Text_open ("set\\hz.ext"); Text.Text_use (sq,11); Text.Text_close (); // to blit the attribute prompt word to the prompt area prompt_text.MyTextOut(DD_GetBackBuffer(), 512, 291, sq); 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.Unit.UnitMorale, Morale, 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(), 580, 291, Morale ); 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 updata the value of solider number BOOL FACE_UpdateSoliderNumber(int solider) { int iResult; class CDDText prompt_text; // the prompt string class CDDText infor_text; // the text that inpur from FACE_CURRENT_PROMPT_BLOCK char SoliderNumber[8]; //士兵数 if( FACE_CURRENT_PROMPT_BLOCK.PromptBlockId != PROMPT_UNIT ) return FALSE; // to blit part of the prompt background to the back buffer POINT Dest ; RECT temp ; Dest.x = 501 ; Dest.y = 308 ; temp.left = 501 ; temp.top = 308 ; temp.right = 620 ; temp.bottom = 324 ; bmPromptArea.Blit(&Dest, &temp); FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Unit.NumberOfSolider = solider; // 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 rs[50] ; //"人数" memset (rs,0,sizeof(rs)); Text.Text_open ("set\\hz.ext"); Text.Text_use (rs,12); Text.Text_close (); // to blit the attribute prompt word to the prompt area prompt_text.MyTextOut(DD_GetBackBuffer(), 512, 308, 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.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(), 580, 308, SoliderNumber ); 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 updata the office of general BOOL FACE_UpdateOffice(LPCTSTR office) { int iResult; class CDDText infor_text; // the text that inpur from FACE_CURRENT_PROMPT_BLOCK if( FACE_CURRENT_PROMPT_BLOCK.PromptBlockId != PROMPT_UNIT ) return FALSE; // to blit part of the prompt background to the back buffer POINT Dest ; RECT temp ; Dest.x = 568 ; Dest.y = 200 ; temp.left = 568 ; temp.top = 200 ; temp.right = 620 ; temp.bottom = 244 ; bmPromptArea.Blit(&Dest, &temp); strcpy(FACE_CURRENT_PROMPT_BLOCK.PromptBlockUnion.Unit.Office, office); char cFirstPart[7]; // 前三个字+'\0' char cSecondPart[7]; // 后三个字+'\0' cFirstPart[0] = office[0]; cFirstPart[1] = office[1]; cFirstPart[2] = office[2]; cFirstPart[3] = office[3]; cFirstPart[4] = office[4]; cFirstPart[5] = office[5]; cFirstPart[6] = '\0'; cSecondPart[0] = office[6]; cSecondPart[1] = office[7]; cSecondPart[2] = office[8]; cSecondPart[3] = office[9]; cSecondPart[4] = office[10]; cSecondPart[5] = office[11]; cSecondPart[6] = '\0'; // 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) ); infor_text.MyTextOut(DD_GetBackBuffer(), 570, 205, cFirstPart ); infor_text.GetDDSurface()->Erase(); infor_text.MyTextOut(DD_GetBackBuffer(), 570, 225, cSecondPart ); infor_text.GetDDSurface()->Erase(); // to release the text surface infor_text.EndText( ); // to blit all prompt word for attribute of this general to the prompt area ///////////////////////////////////////////////////////////// // 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; }