📄 interfac.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 <stdio.h>
#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 "cbavi.h"
#include "cbarray.h"
#include "Interfac.h"
#include "Interfa1.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];
/////////////////////////////////////
/////////////////////////////////////////////////
// this veriable is decleared only for net_work
extern BOOL GAME_bNetwork ;
/////////////////////////////////////////////////
#define ENGLISH
/////////////////////////////////////////////
//////////////////Donghai///////////////////////////
#include "Network.h"
extern BYTE DP_SendMessageBuff[BUFFER_MAX_BYTE];
extern LPSTR DP_NickName;
//////////////////Donghai///////////////////////////
// the flag for message box
extern BOOL FACE_bMessageBox ; // 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 //
/////////////////////////////////////////////
extern char DIALOG_BUF[MAX_DIALOG_LETTER+1]; //to restore the string input to dialog
extern class CDDText DIALOG_TEXT; // the string attribute of DIALOG_BUF
extern int DIALOG_LETTER_X ; // x coordinates to use in dialog text matrix DIALOG_BUF
extern char MESSAGE_BUF[MAX_MESSAGE_LETTER+1] ; //keyboard buffer --> to restore your input for message
extern int MESSAGE_LETTER_X; // x coordinates to use in text matrix MESSAGE_BUF
extern char MESSAGE_PROMPT[MAX_PROMPT_LETTER+1] ; //prompt buffer -->to restore your message prompt only
extern char MESSAGE_STRING[MAX_PROMPT_LETTER + MAX_MESSAGE_LETTER + 1] ; //prompt the MESSAGE_PROMPT+MESSAGE_BUF --> to restore all message
extern char NETWORK_MESSAGE_BUF[NETWORK_MAX_MESSAGE_LETTER+1] ; //keyboard buffer --> to restore your input for message
extern int NETWORK_MESSAGE_LETTER_X ; // x coordinates to use in text matrix MESSAGE_BUF
extern char NETWORK_MESSAGE_PROMPT[MAX_PROMPT_LETTER+1] ; //prompt buffer -->to restore your message prompt only
extern 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
extern class CDDString Net_Message_1 ;
extern class CDDString Net_Message_2 ;
extern class CDDString Net_Message_3 ;
extern class CDDString Net_Message_4 ;
extern class CDDString Net_EchoPrompt_Message ;
// process bar veriable
class CPercentBar FACE_Stone; // to show the stone of a building
class CPercentBar FACE_Power; // to show the power of a general
class CPercentBar FACE_Blood; // to show the blood of a general
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
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
class CDDCommandUnit * pCurrentMainCommandUnit = NULL; // a pointer point to the current main command unit
class CDDCommandUnit * pCurrentCommandUnit = NULL; // 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
///////////////////////////////////////////
BOOL nNumState = FALSE; // 0 -> to show 1 --- 10
// 1 -> to show 11 -- 20
///////////////////////////////
// to declear command unit
///////////////////////////////
class CDDCommandUnit buCancel;
class CDDCommandUnit buPeasant_Chao;
class CDDCommandUnit buBuild_Chao_PageOne;
class CDDCommandUnit buBuild_Chao_PageTwo;
class CDDCommandUnit buPeasant_Liu;
class CDDCommandUnit buBuild_Liu_PageOne;
class CDDCommandUnit buBuild_Liu_PageTwo;
class CDDCommandUnit buFightUnit;
class CDDCommandUnit buLineUp_PageOne;
class CDDCommandUnit buLineUp_PageTwo;
class CDDCommandUnit buStratagem; // stratagem --> 计谋
class CDDCommandUnit buSingleSoldier;
class CDDCommandUnit buRegimentSoldier; // regiment --> 整编
class CDDCommandUnit buTransportShip;
class CDDCommandUnit buMainBuilding_Chao;
class CDDCommandUnit buMainBuilding_Liu;
class CDDCommandUnit buLumber;
class CDDCommandUnit buWeaponFactory;
class CDDCommandUnit buShop;
class CDDCommandUnit buFootmanSchool;
class CDDCommandUnit buKnightSchool;
class CDDCommandUnit buBowmanSchool;
class CDDCommandUnit buVehiclemanSchool;
class CDDCommandUnit buShipyard;
class CDDButtonUnit m_nSmallNumber;
class CDDButtonUnit m_nBigNumber;
/////////////////////////////////////
// main interface frame (four part)
/////////////////////////////////////
// ClassName VaribleName BitmapSize top-left point bottom-right point
class CDDBitmap * psMainBack = NULL; //(640,480) -> (0,0)-----------------(639,479)
class CDDBitmap bmCommandArea; //(120, 120) -> (501, 336) ---------------
class CDDBitmap bmPromptArea; //(120, 169) -> (501, 158) ---------------
class CDDBitmap bmButtonBackground; // the background of the command button when it show in prompt region
class CDDBitmap bmGeneralBackground; // the background of the general head picture when it show in prompt region
class CDDBitmap sTop; //(640,48) -> (0,0)-----------------(639,47)
class CDDBitmap sBottom; //(640,24) -> (0,456)---------------(639,479)
class CDDBitmap sLeft; //(24,408) -> (0,48)----------------(23,455)
class CDDBitmap sRight; //(157,408) -> (483,48)--------------(639,455)
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;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -