?? 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 <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
// 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 + -