📄 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 <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 "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 <string.h>
#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;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -